[erlang-patches] Tweaking regexp in erlang-font-lock-keywords-vars
Thomas Järvstrand
tjarvstrand@REDACTED
Wed Nov 7 11:16:27 CET 2012
Hi!
I've updated the patch.
Currently font-lock fontification in erlang-mode fails for the first erlang
variable in the fontification region if the region to fontify starts on the
same position as the variable. This is because the current regexp requires
at least one character (any character except #) to be present before the
actual variable names starts. This patch exchanges the straight regexp with
a fun that searches for a match for erlang-variable-regexp and then asserts
that the match is not preceeded by a #, thus relieving the requirement of
at least one preceeding character to be present in the search range before
a variable name.
The use case is that I'm trying to accomplish syntax highlighting in the
erlang-shell inside Emacs and the problem I encountered was that in the
following example only Bar would be highlighted as a variable.
1> Foo = Bar.
>
Repo:
git fetch git@REDACTED:tjarvstrand/
otp.git erlang-font-lock-keyword-vars
Comparison:
https://github.com/tjarvstrand/otp/compare/erlang-font-lock-keyword-vars
https://github.com/tjarvstrand/otp/compare/erlang-font-lock-keyword-vars.patch
Regards
Thomas Järvstrand
2012/11/6 Thomas Järvstrand <tjarvstrand@REDACTED>
> Please disregard this patch, it does not work as intended. Sorry for the
> noise.
>
> Thomas
>
>
> 2012/11/6 Thomas Järvstrand <tjarvstrand@REDACTED>
>
>> Hi!
>>
>> Currently font-lock fontification in erlang-mode fails for the first
>> erlang variable in the fontification region if the region to fontify starts
>> on the same position as the variable. This is because the current regexp
>> requires at least one character (any character except #) to be present
>> before the actual variable names starts. This patch tweaks the regexp
>> slightly to allow either a start-of-word or a non-# at the head of the
>> variable-name.
>>
>> The use case is that I'm trying to accomplish syntax highlighting in the
>> erlang-shell inside Emacs and the problem I encountered was that in the
>> following example only Bar would be highlighted as a variable.
>>
>> 1> Foo = Bar.
>>>
>>
>> Repo:
>> git fetch git@REDACTED:tjarvstrand/otp.git
>> erlang-font-lock-keyword-vars
>>
>> Comparison:
>> https://github.com/tjarvstrand/otp/compare/erlang-font-lock-keyword-vars
>>
>> https://github.com/tjarvstrand/otp/compare/erlang-font-lock-keyword-vars.patch
>>
>> Regards
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20121107/38b41971/attachment.htm>
More information about the erlang-patches
mailing list