[Top][All Lists]

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

bug#36525: M-x default when cursor on top of a M-x command in INFO

From: Drew Adams
Subject: bug#36525: M-x default when cursor on top of a M-x command in INFO
Date: Sat, 6 Jul 2019 15:55:10 +0000 (UTC)

> 2. Put the cursor on top of
> ‘M-x list-coding-systems’
> 3. Hit M-x
> Wouldn't it be great if we saw that it was now
> the default in the minibuffer?
> That way we could just hit RET to run it.
> Currently C-h C-f knows what the cursor is on,
> but not M-x (ESC x).

A better way to handle this is to have a key
(Icicles uses `M-.') that pulls text from the
buffer into the minibuffer, appending it to
whatever input text might already be there.

This is much more general than just pulling
in a command name from an Info buffer.

But it also means that users should be given
some way to control over _which_ text from the
buffer should be inserted into the minibuffer.
There are several reasonable possibilities.

As food for thought, Icicles handles this as
described here:



Repeated `M-.' can have two different behaviors.
You can choose (by an option) which one to use.

1. Repeating `M-.' cycles through alternative
   bits of text from the buffer.  Each time you
   hit `M-.' consecutively it inserts a different 
   string of text (replacing the previously
   inserted one).

   You can configure (user option) which kinds
   of text to grab.  By default the kinds are:

   . `non-nil-symbol-name-nearest-point'
   . `word-nearest-point'
   . `list-nearest-point-as-string'
   . Same (nearest list), but 2 levels up.
   . Same (nearest list), but 3 levels up.
   . `ffap-guesser' (but first deactivate a
     large active region)
   . `thing-at-point-url-at-point'

2. Repeating `M-.' grabs another thing of the
   chosen kind.  By default it is the next
   word (using `forward-word').

IOW, you can either (1) keep using `M-.' to
insert _additional_ text things of a kind you
choose with an option setting or (2) use `M-.'
to cycle to get one thing of a kind that you
choose on the fly.

[Note that for your example, either (1) or (2)
does what you request: `list-coding-system'
is added to the minibuffer.  `forward-word'
and `non-nil-symbol-name-nearest-point' both
grab that text.]

Whether vanilla Emacs would allow flexibility
to this degree is not so important as at
least having Emacs have a key that grabs
_something_ from the buffer text and appends
it to minibuffer input.  Choice #2 above is
pretty simple to realize - give users an
option to specify which kind of text thing
they want to insert.

Alternatively, Emacs itself could provide
some context-sensitive DWIM to determine the
kind of text thing to grab.  (As one user,
I prefer to control that choice myself, but
I'm sure that some others would be OK with
Emacs choosing.)

reply via email to

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