bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#48134: [External] : bug#48134: When sitting on top of a M-x item in


From: Drew Adams
Subject: bug#48134: [External] : bug#48134: When sitting on top of a M-x item in the manual
Date: Sat, 1 May 2021 14:01:26 +0000

> Do (info "(emacs) Colors")
> Now put the cursor on top of ‘M-x list-colors-display’
> and hope emacs realizes it... but it doesn't so we end up typing...

Icicles provides a trivial remedy for this, which
isn't really connected with completion or anything
particular to do with Icicles (except that it helps):

It binds `M-.' in `minibuffer-local-map' to a command
(`icicle-insert-string-at-point') that inserts some
text at point into the minibuffer.

With cursor on `list-colors-display', `M-x', then `M-.'
pulls that text into the minibuffer: `M-x M-. RET'.

You can use `M-.' anytime the minibuffer is active.
It inserts the text at point in the minibuffer.  You
can use it to pull in more than one bit of text.

I suggested several times that vanilla Emacs have such
a simple feature, but...
_____________

See this description:

https://www.emacswiki.org/emacs/Icicles_-_Inserting_Text_from_Cursor
_____________

And here's the doc string:

icicle-insert-string-at-point is an interactive compiled Lisp function
in ‘icicles-mcmd.el’.

(icicle-insert-string-at-point &optional ARG)

Insert text at the cursor into the minibuffer.

Each time this command is called, some text at or near the cursor is
inserted into the minibuffer.  One of two things happens, depending on
the value of option `icicle-default-thing-insertion' and whether or
not you use `C-u'.

See the doc for option `icicle-thing-at-point-functions' for a
complete description of its behavior.  What follows is an overview.

`icicle-thing-at-point-functions' is a cons of two parts - call them
ALTERNATIVES and FORWARD-THING.

If ALTERNATIVES is not nil and one of the following is true:
 - FORWARD-THING is nil
 - the value of `icicle-default-thing-insertion' is `alternatives' and
   you have not used plain `C-u' in this series of `M-.'
 - the value of `icicle-default-thing-insertion' is `more-of-the-same'
   and you have used plain `C-u' in this series of `M-.'
then the next function in ALTERNATIVES is used to retrieve the text to
be inserted.

If FORWARD-THING is not nil and one of the following is true:
 - ALTERNATIVES is nil
 - the value of `icicle-default-thing-insertion' is `more-of-the-same'
   and you have not used `C-u' in this series of `M-.'
 - the value of `icicle-default-thing-insertion' is `alternatives' and
   you have used `C-u' in this series of `M-.'
then function FORWARD-THING is used to retrieve the text to be
inserted.

If you use a numeric prefix arg (not just plain `C-u'), the behavior
is as follows.

* If a function in ALTERNATIVES is used (see above), then the text
  that is grabbed at or near point is read as a Lisp sexp and
  evaluated, and the value is inserted instead of the grabbed text.

  Yes, this means you need to know when the particular ALTERNATIVES
  function that you want is coming up next, and use, say, `C-9' just
  before hitting `M-.' for that alternative.

* If the FORWARD-THING is being used, then the prefix arg determines
  the number of things to grab, and the direction of grabbing.: A
  negative argument grabs text to the left of the cursor; a positive
  argument grabs text to the right.

You can use this command only from the minibuffer (`M-.').

reply via email to

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