Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Emacs: copy word without selection
(defun jz/copy-word
"Copy words at point into kill-ring.
Adapted from
The original implementation doesn't work if the cursor is at the beginning of current word. It copies one word back instead.
With this tweak, this function works in that case, but won't work if the current cursor is at the end of current word.
But it's good enough for my use case because I use ace jump a lot so my cursor usually lands at the first char of the word.
(interactive "P")
(copy-thing 'forward-word 'backward-word arg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.