emacs-devel
[Top][All Lists]
Advanced

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

RE: key to yank text at point into minibuffer?


From: Drew Adams
Subject: RE: key to yank text at point into minibuffer?
Date: Fri, 24 Feb 2006 08:44:13 -0800

    > `M-x foobar M-- M-. M-. M-. C-b C-f C-u 1 M-.' will yank
    > three words to the left of point and one word to the right of it.

    Repeating `M-.' many times to find the necessary thing to yank doesn't
    seem very convenient.  What do you think about using `M-.' as a
    prefix key?

    `M-. s' - yank symbol at point to the minibuffer
    `M-. u' - yank URL at point
    `M-. w' - yank word at point
    `M-. c' - yank character at point

1. I think you missed the point of that example. It was in the cumulative
mode where `M-.' grabs and yanks successive words, not the mode where `M-.'
cycles among various kinds of thing. Making `M-.' a prefix key would make
matters worse, not better. The above example would then become: `M-x foobar
M-- M-. w  M-. w  M-. w  C-b C-f C-u 1 M-.' - note the added `w's.

Without a prefix binding, you can simply press and hold `M-.' until you've
accumulated as much text (e.g. as many words) as you want. In my
implementation, this single-grabber-function (words), append/accumulate
behavior is the default. (You proposed this cumulative behavior, and I agree
that it is very useful.)


2. Ignoring the cumulative example, and replying to your point (which speaks
to the non-cumulative mode, where `M-.' cycles among various kinds of
thing):

This kind of decision (prefix key or not) really rests on determining the
most common use pattern(s). As I said, in my case I use only a single `M-.'
(yank symbol) 90% of the time, so I have never experienced the inconvenience
you cite. Symbol syntax also picks up file names and URLs. (The separate
URL-grabbing function goes to the trouble of prefixing "http://"; if it's
missing.)

In your proposal, I would need to use two keystrokes (`M-. <whatever>')
instead of one (`M-.') 90% of the time, which is less, not more, convenient.

And, just as in the cumulative mode, a prefix key works against ease of
repetition. If the binding is simply `M-.' (my proposal), then, in the case
where `M-.' cycles among alternative grab+yank functions, you can just hold
down Meta and repeatedly hit `.' to cycle among the alternatives. With a
prefix key (your proposal), you must remember, find, and hit a separate key
(s, u, w, or c).

With an alternatives list of length 3, the worst case for my approach is
hitting `.' 3 times. That's still quicker, for me, than coming up with the
correct two-key sequence `M-. <whatever>'. Even if the list were length 20,
I would probably still find repetition of the same key `.' 20 times to be
more convenient than remembering 20 different bindings. But different people
have different ideas of convenience.

To make an analogy, imagine that, instead of having `C-s M-p' cycle among
search-ring elements, you had a separate binding for each element, and `M-p'
was just a prefix key to indicate that you wanted to use the search-ring.
You would use one of `C-s M-p 1', `C-s M-p 2', and so on, instead of simply
repeating `M-p': `C-s M-p M-p M-p'. Would you find that more convenient?
(Granted, the analogy is not entirely fair, because 1, 2, ... are not
mnemonic as are s, u, w, c, or, rather, even if 3 clearly stands for the
third history element, it's unlikely that you would know that you wanted the
third element, without seeing what it is.)

Anyway, as I say, it's the various use cases, and especially the most common
use case, that should guide us here. Try the implementation I pointed to,
and see what you think. You can easily change the bindings to those that you
proposed (prefix key) and compare. Try a few different scenarios and let us
know what you find.

Meta-anyway: It sounds like you and I, Juri, think similarly about this
general idea, but no one else has spoken up about it. Perhaps that's because
people are concentrating on putting out the release (that would be good). Or
perhaps it's because everyone agrees with the idea (also good). Or perhaps
we (like the answer, my friend) are blowin' in the wind.





reply via email to

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