erlang-mode; $-bug

Dave Love <>
Fri Feb 11 13:13:24 CET 2005


Mats Cronqvist <> writes:

>    hello,
>
>    erlang-mode doesn't do paren-matching correctly if there is a
> $-paren in a string);
>
> "{x=${abc}}"  %% these parens don't match, according to erlang-mode

The behaviour of `"$"' is worse.

>    problem is that ${ is seen as a char (which is right for erlang code);
>
> {${}          %% these parens do match

Contrast `[$\{]', though.

>    i think that behavior is wrong inside a string.
>
>    anyone have a fix?
>
>    mats

The syntax code of `$' is inappropriate.  $ is actually similar to `?'
in Emacs Lisp, but Erlang mode makes it `character quote' (shown by
C-u C-x e).  I'd suggest making it either `symbol' ("_") or perhaps
`prefix' ("'") to improve sexp motion.  Then to regain your balance
you write `$\{' instead of `${'.

[The proper way to do it, as documented somewhere, is:

  (defvar erlang-mode-syntax-table
    (let ((table (make-syntax-table)))
      ...
      (modify-syntax-entry ?$ "'" table)
      ...
      table))

and then have `erlang-mode' just do

  (set-syntax-table erlang-mode-syntax-table)
]



More information about the erlang-questions mailing list