[ prog / sol / mona ]

prog


Everything Emacsen

208 2023-12-27 20:58

There's a function in a third party library that puts something on the kill ring that I want to use from my own function, but I don't want to pollute the user's kill ring. I ended up with this:

(let ((old-kill kill-ring))
  (unwind-protect
      (progn
        ;; stuff that messes with the kill ring here
        )
    (setq kill-ring old-kill)))

It seems to work but I was sure there would be something that already did this, but I couldn't find anything. Is doing something like this frowned upon? Or why couldn't I find anything?

220


VIP:

do not edit these