emacs-devel
[Top][All Lists]
Advanced

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

RE: FW: commands to select things of different kinds


From: Drew Adams
Subject: RE: FW: commands to select things of different kinds
Date: Sun, 9 Mar 2008 20:30:20 -0800

> Could you digest it into a single thread of text.  The current mess of
> forward and backward quoting is just unreadable.

Everything important is in the original post. I've repeated it below.

RMS asked how it knows what kind of thing to select, to which I repeated
that if the region is not yet active you are prompted with completion for
the type of thing to select (default: sexp).


--- original post ---
From: Drew Adams Sent: Monday, July 16, 2007 12:17 AM

Any interest in these commands? They let you select (that is, mark) various
things at or near point. They are most useful in Transient Mark mode - they
act differently depending on whether the mark is active.

* `mark-thing' selects successive things, starting at point. The mark is put
at the same place that command 'forward-'thing would put it (using the same
prefix argument). If the region is not yet active, then you are prompted
(with completion) for the type of thing to select. The default type is
`sexp'.

* `cycle-thing-region' selects one thing at or near point (just the thing,
not from point through the thing, even if the thing is not exactly at
point). Repeat it to cycle among the thing types - one thing of the current
type is selected at each invocation. The default order of types is `word',
`sexp', `list', `line', `sentence', `paragraph', `page', `defun', `number',
`form'. That order is customizable, and a major mode could also change it to
put the most commonly used types first.

I bind `mark-thing' to `C-M-SPC' as a replacement for `mark-sexp'.

I bind `cycle-thing-region' to `M-@' as a replacement for `mark-word'. (By
default, it does what `mark-word' does without a prefix arg. Unlike,
`mark-thing', however, `cycle-thing-region' does not accept a prefix arg.)

I don't propose these bindings for Emacs generally, but if you use
transient-mark mode you might want to give them a try.

To select successive things in transient-mark mode, you can use
`cycle-thing-region' as an alternative to completion for choosing the thing
type for `mark-thing' - but you need to use `C-x C-x' between the two. That
is, you can use 'M-@ C-x C-x C-M-SPC' to select successive words, 'M-@ M-@
C-x C-x C-M-SPC' for successive symbols, and so on.

The code is attached.


Attachment: thing-cmds.el
Description: Binary data


reply via email to

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