emacs-devel
[Top][All Lists]
Advanced

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

Re: subword-mode


From: Stefan Monnier
Subject: Re: subword-mode
Date: Wed, 25 Nov 2009 09:19:25 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

>> I just bumped into find-word-boundary-function-table, which lead me to
>> its only user: cap-words.el.
>> It seems both subword.el and cap-words.el provide the same feature (tho
>> cap-words.el is obviously not good at advertising itself, ahem).

> Given that it's only about 3 lines long, and apparently works by taking
> advantage of some existing low-level mechanism, cap-words.el seems by
> far the more elegant implementation...

Of course, it also has its disadvantages:
- the mechanism was not pre-existing (i.e. the implementation of
  cap-words.el included a patch to syntax.c to add the relevant hook).
- because it operates at a low level it sometimes does more than one
  asks for: e.g. since abbrevs are defined by default as "words", it
  means that "FooBar" cannot be an abbrev without extra work.

BTW, looking at both subword and cap-words I'm surpried at the use of
2 completely separate regexps when going forward and backward.
I'd expect the use of a regexp like
"\\([[:lower:]]\\)[[:upper:][:digit:]]" where (match-end 1) says where
to stop and that should work in either direction.  That can be combined
with "\\<" or "\\>" depending on the direction, (although I'd actually
prefer using forward-word to find that boundary, so it also obeys script
boundaries).


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]