[erlang-questions] Emacs Erlang Mode: a different face for module and function name in external function calls
Johan Claesson
johanclaesson@REDACTED
Tue Oct 7 22:24:37 CEST 2014
Hi,
The function name is also fontified by
erlang-font-lock-keywords-int-function-calls. That can be prevented by
pre-pending "[^:]" to it as below.
(defvar erlang-font-lock-keywords-int-function-calls
(list
(list (concat "[^:]" erlang-atom-regexp "\\s-*(")
1 'font-lock-type-face))
"Font lock keyword highlighting an internal function call.")
But if you later update erlang.el to a newer version this will of course
be lost. Alternatively you could instead of editing erlang.el inserting
something like the following in your .emacs before (require 'erlang) or
whatever that is loading erlang.el:
(setq erlang-font-lock-keywords-ext-function-calls
(list
(list (concat erlang-atom-regexp "\\s-*:\\s-*"
erlang-atom-regexp "\\s-*(")
'(1 'font-lock-type-face)
'(2 'font-lock-function-name-face))))
(setq erlang-font-lock-keywords-int-function-calls
(list
(list (concat "[^:]" erlang-atom-regexp "\\s-*(")
1 'font-lock-type-face)))
If you want to do it after erlang.el is loaded for some reason then the
following is also needed:
(setq erlang-font-lock-keywords-4 erlang-font-lock-keywords-ext-function-calls)
(setq erlang-font-lock-keywords-4
(append erlang-font-lock-keywords-3
erlang-font-lock-keywords-exported-function-header
erlang-font-lock-keywords-int-function-calls
erlang-font-lock-keywords-ext-function-calls
erlang-font-lock-keywords-fun-n
erlang-font-lock-keywords-lc))
Regards,
/Johan
egarrulo <egarrulo@REDACTED> writes:
> Hello everybody,
>
> Erlang Mode highlights both the module and the function name of an
> external function call (for instance "lists:map") with the same face
> (`font-lock-type-face'). I would like Erlang Mode to use two
> different faces.
>
> Apparently, this behaviour is determined by this code in "erlang.el":
>
> (defvar erlang-font-lock-keywords-ext-function-calls
> (list
> (list (concat erlang-atom-regexp "\\s-*:\\s-*"
> erlang-atom-regexp "\\s-*(")
> '(1 'font-lock-type-face)
> '(2 'font-lock-type-face)))
> "Font lock keyword highlighting an external function call.")
>
> I have modified the second face to `font-lock-function-name-face',
> like this:
>
> '(2 'font-lock-function-name-face)))
>
> saved "erlang.el" and restarted Emacs, but the highlighting hasn't changed.
>
> I have tried with "emacs -Q", too.
>
> Any help? Thanks.
>
> Software:
> - GNU Emacs 24.3.1
> - Erlang Mode 2.7
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions
mailing list