help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: clear-kill-ring function


From: Joost Kremers
Subject: Re: clear-kill-ring function
Date: 28 Oct 2015 10:37:05 GMT
User-agent: slrn/1.0.1 (Linux)

Sharon Kimble wrote:
>=2D-8<---------------cut here---------------start------------->8---
> #+begin_src emacs-lisp
> (defun clear-kill-ring ()
> (interactive)
>   "Clear the kill ring variable"
>   (setq kill-ring nil))
> (global-set-key (kbd "s-/") 'clear-kill-ring)
> #+end_src
>=2D-8<---------------cut here---------------end--------------->8---

Note that the doc string should go before the (interactive) call:

```
(defun clear-kill-ring ()
  "Clear the kill ring variable"
  (interactive)
  (setq kill-ring nil))
(global-set-key (kbd "s-/") 'clear-kill-ring)
```

> And have restarted emacs several times, but if I do a "s-." before hand
> I can see several items on the kill-ring. So I then do "s-/" to clear
> the kill-ring, and if I then do a further "s-." it shows that there
> still remains the same items on the kill-ring, i.e. nothing has changed!
> Or, IOW, the function isn't working!

It probably is. Assuming that you have `s-.` bound to
`cliphist-paste-item` as in your original post, hitting `s-.` will
(presumably; I don't know cliphist) populate the kill ring with the
items in the clipboard history. Emtpying the Emacs kill ring doesn't
change the clipboard history, because they're two different things.

To see the contents of the kill ring, you can evaluate the variable
`kill-ring` in the *scratch* buffer (put `kill-ring` on a separate line
and hit C-j). Or use `C-h v kill-ring RET`.

There's also the packge `browse-kill-ring`, which shows the contents of
the kill ring in a separate buffer and allows you to pick any item to
paste.

HTH

-- 
Joost Kremers                                   joostkremers@fastmail.fm
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]