How can I insert some text (thing) at point from the buffer into the minibuffer at a text prompt or during an incremental search? Is there a convenient way to insert, e.g., the sexp around point?
1 Answer
If you use library Icicles then you can use M-.
at any time from the minibuffer to insert a thing-at-point from the buffer.
You can repeat M-.
to either (a) append subsequent such things from the buffer or (b) change the kind of thing, inserting a different kind instead (cycling through thing types).
This is explained at Icicles - Inserting Text from Cursor.
If you use library ThingAtPoint+ (thingatpt+.el
) then you can grab additional kinds of thing, and you can grab them near point as well as at point.
Keep in mind that none of this has to do with Isearch, which does not in fact use the minibuffer (except when you use M-e
, to edit the search string).
If you want to grab (yank) a thing at point and append it to your Isearch search string, you can use library Isearch+ (isearch+.el
) to yank these kinds of thing:
C-y C-_
isearchp-yank-symbol-or-char
C-y C-(
isearchp-yank-sexp-symbol-or-char
C-y C-c
isearchp-yank-char
C-y C-e
isearchp-yank-line
C-y C-w
isearchp-yank-word-or-char
And you can define your own yank command that yanks whatever you want from the buffer. For example, you can have it move point around temporarily and grab, for example, the full word (or sexp or whatever) that point is in. See the definitions of other Isearch yank commands for how this is done. It is quite simple, but since you do not specify what behavior you are after there is little sense in showing code here that tries to guess what that is.
M-s . C-s
in emacs 24.4.el-get-install
. Surely I can install from package-menu buffer, but it not so quick. Or for grep commands.overriding-terminal-local-map
temporarily, so it interprets each input char/event its own way. It bindscursor-in-echo-area
, to show the cursor in the echo area. And it usesmessage
to show the "prompt" and the current search string in the echo area. In short, it uses the echo area (an output area) instead of the minibuffer (an input area).