emacs-devel
[Top][All Lists]
Advanced

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

RE: make `occur' use word at point as default


From: Drew Adams
Subject: RE: make `occur' use word at point as default
Date: Wed, 31 Aug 2005 09:03:12 -0700

        > But the problem remains: too often I have to first mark a
        > word or symbol, copy the region, start a command (`grep',
        > `occur', `query-replace', whatever), paste it, press <enter>.
        > That's three keystrokes too many.

        How about making the thing at point be accessible via M-n?

    By convention, M-n is supposed to insert _the default_.
    I do not want to make exceptions to that.

    We could conceivably make a second M-n insert another possible input
    that one might want.  In effect, this would mean putting another
    element at the "front" of the history list.  That could be a new
    convention that could be generalized to other things.

    Now is not the time to implement this, but I'm interested in hearing
    if there are any objections to the idea.

My opinion: Keep the history list (and ways of accessing it) separate from
the default value (and ways of accessing it).

M-n and M-p are for the history list. M-n already pulls the default value
into the minibuffer and adds it (possibly edited) to the history list. This
is enough connection between the two.

In this case, you seem to want the default value to be the _previous_
history value (so that empty input "searches the same thing again"). This
means that M-n, M-p, and empty input will all do more or less the same
thing: use the last (i.e. previous) history value. That's a lot of
convenience for accessing that one value, but it leaves no easy way to use
the word/symbol at point - which several people have mentioned is an obvious
thing to want to do with `occur'.

For `occur', I would use the word/symbol at point as the default value, and
let people use `M-p RET' to get the last history value. Consistent, and not
terribly inconvenient, IMO (one extra keystroke: M-p).

Wrt your general proposal - Given that you don't want the default value to
be automatically inserted into the minibuffer (my preference), you should
stick with M-n to insert it. I think extending this to a second M-n, for a
possible second "default value" would be confusing, with little reward.

However, you might consider giving access to a list of "default values"
(more than just 1 or 2) via _different_ keys from M-n and M-p - the arrow
keys, for instance. A reasonable (default) set of default-value candidates
would be those in `minibuffer-completion-table' (perhaps as filtered by
`minibuffer-completion-predicate').

This is what several existing libraries do, including my icicles library.
You might look to such libraries for ideas on possibilities (food for
thought). The icicles code is here:
http://www.emacswiki.org/cgi-bin/emacs/icicles.el.







reply via email to

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