[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Last call for lua-mode contributors
From: |
Miles Bader |
Subject: |
Re: Last call for lua-mode contributors |
Date: |
Fri, 20 Jan 2012 14:12:08 +0900 |
2012/1/20 Ken Raeburn <address@hidden>:
> My "instincts" have long been to interpret "word" as "identifier or
> keyword" in programming modes, to the point of customizing the
> syntax tables at startup to make "_" a word component. Not for
> regular expressions, but for word-motion commands; I like the fact
> that I can skip over one identifier with M-f no matter how many
> underscores it contains -- string_to_widget, stringToWidget,
> string2widget, and stringtowidget are all treated the same. It's
> also more useful in constructing keyboard macros that kill-word
> identifiers and later yank them from the kill ring; typing in a
> regexp search would be much more annoying.
Emacs contains convenient commands to do exactly those things
regardless of word-syntax: C-M-f (forward-sexp), C-M-k (kill-sexp)
etc. Obviously these commands are even _more_ "reliable" in that
sense because they work the same in _all_ programming modes, and don't
depend on user-customization.
So when editing in a programming-mode buffer, one can use whichever
unit is most suited for the job: moving over/killing/etc _symbols_ if
that's what one wants to do, but allowing convenient editing of words
within symbols when _that's_ the goal -- and in my experience, I very
often want to the latter, even when programming (which is why lua-mode
drives me crazy). One really can have the best of all worlds:
convenience, reliability, consistency, flexibility ... but only if
modes don't randomly screw around with syntax...
For instance, I want to write a new function "mypackage_frob_numnum".
I copy an existing function "mypackage_snort_numnum", and change
"frob" to "snort" ... but in lua-mode the hardwired-into-my-fingers
method of doing this doesn't work, I have to hit C-f a bunch of times
(typically only _after_ trying to use M-f and having it do the wrong
thing)...
> I haven't made the customization yet at my new (well, ~2 years) job
> -- but that's because our coding standards use
> camelCaseAndNoUnderscores so the word-motion commands already work
> on identifiers and not on (English) words. (Though I've been
> dealing with Linux code lately, so it may be time to make the
> change.) If I often wanted to deal with the individual English
> words making up an identifier, the handling of underscore wouldn't
> be enough to make Emacs work correctly.
[There are actually modes which make word-commands respect
"STuDlyCapS" though...]
> I realize I'm much closer to the power-user end of the spectrum than
> most typical users, but among those heavily using programming modes,
> is this such a strange mind-set?
Wellllllll.... it does seem like a "power-user," and especially a
programmer, would be most likely to know about and use Emacs'
programming-specialized movement commands ..... :]
-miles
--
Cat is power. Cat is peace.