It's a simple thing. My cursor is over a word and I want to get the word so that I can do something with it. I see a few different ways to do this but want to avoid reinvention and use a standard method.
You can use the function
thing-at-point and tell it to return the
word at point and not return any text properties (unless you need them). Example buffer contents (| is the cursor):
(thing-at-point 'word 'no-properties) returns "world".
(current-word &optional STRICT REALLY-WORD)
Return the word at or near point, as a string. The return value includes no text properties.
If you want to insert the word (or anything else - file name etc.) at point into the minibuffer, when you are editing input, just use
M-., if you use Icicles.
You can use
M-. repeatedly (e.g.
M-. M-. M-.) to either:
- Cycle to a different kind of thing to grab at point, and insert it.
- Insert more (i.e., successive) things of the same type (e.g. words) from the buffer.