Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How does one clear the kill ring in emacs? I use browse-kill-ring.el but the buffer it provides is read-only.

share|improve this question
up vote 7 down vote accepted

For me, M-: (setq kill-ring nil) works. See also Internals of Kill Ring in the elisp manual. Don't ask me about side effects and security aspects, though.

Invoking the garbage collection right away as in

(progn (setq kill-ring nil) (garbage-collect))

makes the conses less accessible, so this might give you some degree of security.

share|improve this answer
Thanks, that's quite practical. I don't know enough about the internals of emacs memory management but I would guess setting a variable to nil doesn't guarantee deleting the contents from memory. So naturally, my next question would be about the security implications of this but you beat me to it :-). Googling about this gives me surprisingly little info. Am I the only one editing "sensitive" files with emacs? – Stefanos Klironomos Feb 5 '13 at 11:52
Maybe garbage collecting makes the list cells less accessible? See the modified answer. – artistoex Feb 9 '13 at 11:27
I guess that's the best bet. Thanks. – Stefanos Klironomos Feb 9 '13 at 14:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .