2
The command counsel-yank-pop which is part of the swiper package, gives you an interactive way to browse and insert elements from you kill ring.
2
I don't know why your kill-ring gets messed up. It might be that it is some inter-program action that modifies the kill-ring.
But the right way to implement deleting instead of killing is:
(defun delete-word (arg)
"Delete characters forward until encountering the end of a word.
With argument ARG, do this that many times."
(interactive "p")
(delete-...
1
Are you asking how to check whether the kill-ring is empty? If so, just test whether kill-ring is non-nil:
(when kill-ring ...)
Or are you asking how to avoid the error that it's empty? If so, just put something in it, to start with, using kill-new. For example:
(kill-new "DUMMY")
You can also use ignore-errors to just ignore that error or all ...
1
The main problem lies in yanking nowhere useful because it'll yank after call-interactively returns, not inside its execution.
Basically you don't need anything else than calling this if you already have done M-w on region, as it actually adds it to kill-ring.
(defun find-file-region()
(interactive)
(find-file (substring-no-properties (car kill-ring))))...
Only top voted, non community-wiki answers of a minimum length are eligible
Related Tags
kill-ring × 57yank × 18
copy-paste × 10
clipboard × 9
region × 6
evil × 4
text-editing × 3
rectangle × 3
org-mode × 2
helm × 2
debugging × 2
microsoft-windows × 2
shell × 2
comment × 2
comint × 2
undo × 2
deletion × 2
registers × 2
init-file × 1
elisp × 1
window × 1
osx × 1
org-table × 1
font-lock × 1
terminal-emacs × 1