unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Miles Bader <miles@gnu.org>
To: Ken Raeburn <raeburn@raeburn.org>
Cc: Emacs Dev <emacs-devel@gnu.org>
Subject: Re: Last call for lua-mode contributors
Date: Fri, 20 Jan 2012 14:12:08 +0900	[thread overview]
Message-ID: <CADCnXoYCU=D55CPvnPFMEMf8UxXmWRWj1_C8PASo_ZGCciF3tg@mail.gmail.com> (raw)
In-Reply-To: <E24079C5-D39C-4F27-B075-8664DD9662DF@raeburn.org>

2012/1/20 Ken Raeburn <raeburn@raeburn.org>:
> 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.



  parent reply	other threads:[~2012-01-20  5:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAERznn_UcioQzHojyW=JaDsSHkfihAP3b0YfcUz_NT2cLefTTg@mail.gmail.com>
     [not found] ` <CAERznn9+Y8OFPBNSDk=S_wRF+eP0u4_zfzUQjA9=Y=f=zf+MKw@mail.gmail.com>
2012-01-18  4:32   ` Last call for lua-mode contributors Miles Bader
2012-01-19 17:15     ` Ken Raeburn
2012-01-19 18:57       ` Underscores and word commands Stefan Monnier
2012-01-19 20:39         ` John Yates
2012-01-20 21:25           ` Stefan Monnier
2012-01-20  5:12       ` Miles Bader [this message]
2012-01-20  7:12         ` Last call for lua-mode contributors Ken Raeburn
2012-01-20 14:17     ` Stefan Monnier
2012-01-21  3:20       ` Miles Bader

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADCnXoYCU=D55CPvnPFMEMf8UxXmWRWj1_C8PASo_ZGCciF3tg@mail.gmail.com' \
    --to=miles@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=raeburn@raeburn.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).