lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Doug Rogers <rogers@innocon.com> writes:
> I've used Emacs' lua-mode for a long time and often wondered why '_' was
> included in the definition of a word. This is unlike the other
> programming language modes I've used.

This is one of the biggest problems with the current lua-mode in my
opinion.  The distinction between words and symbols is heavily ingrained
into many users' editing habits, and modes which break that can be
pretty annoying.

> So I looked at the source and found the following lines in
> /usr/share/emacs/site-lisp/lua-mode/lua-mode.el (Linux):
>
>     ;; _ needs to be part of a word, or the regular expressions will
>     ;; incorrectly regognize end_ to be matched by "\\<end\\>"!
>     (modify-syntax-entry ?_ "w")

In a modern version of emacs, the right way to match symbol
beginnings/ends instead of word begs/ends, is to use the \_< and \_> regexp
constructs, e.g. "\\_<end\\_>".

-Miles

-- 
Alliance, n. In international politics, the union of two thieves who have
their hands so deeply inserted in each other's pockets that they cannot
separately plunder a third.