How to yank in a search in an emacs lisp function

115 views Asked by At
(defun search-for-what-is-just-killed () 
(interactive)
(search-forward latestkillringvariable? nil t)
)

How to use "yank" in an emacs lisp function?

1

There are 1 answers

2
Bozhidar Batsov On BEST ANSWER

You can access directly the kill-ring list to access the latest kill:

 (substring-no-properties (car kill-ring))

The substring-no-properties bit is important since text is kept in the kill ring with additional properties (like fontification specific to a particular mode and you'll probably want to strip those).