[erlang-bugs] erlang.el breaks Emacs unicode handling

Matthias Radestock <>
Sun Apr 1 12:00:27 CEST 2007

The Erlang Emacs mode under lib/tools/emacs/erlang.el in the OTP
distribution contains a bug that breaks unicode handling in other parts
of Emacs after an Erlang buffer has been visited.

I noticed the problem on XEmacs 21.4.19 where after loading an Erlang
file, visiting a Gnus (v5.10.7) summary buffer containing unicode
subject lines produces an error like this:

(args-out-of-range "<unicode string>" 34)
  string-match("\\b[^@ 	<>]+[!@][^@ 	<>]+\\b" "<unicode string>")

I subsequently managed to reproduce the problem using the following
1) start XEmacs
2) visit an Erlang buffer
3) execute the following Elisp expression: (string-match "\\b" "硬")
--> args-out-of-range-error

When omitting step 2, step 3 succeeds.

I tracked down the problem to a missing buffer-local declaration in
erlang.el. Adding

  (make-local-variable 'parse-sexp-lookup-properties)

to erlang-electric-init fixes that. I have attached a patch.

The bug is present in R11B-4 and R11B-3. I haven't looked back further,
but chances are it has been there for a while. It is also present in the
erlang-mode debian package.

I cannot reproduce the bug on Gnu Emacs, though I suspect that there too
some undesirable behaviour can result from erlang.el stomping on
parse-sexp-lookup-properties. The fix certainly doesn't appear to do any


-------------- next part --------------
A non-text attachment was scrubbed...
Name: erlang-mode.patch
Type: text/x-diff
Size: 416 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20070401/35f3f382/attachment.bin>

More information about the erlang-bugs mailing list