all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Joost Kremers <joost.m.kremers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: clear-kill-ring function
Date: 28 Oct 2015 10:37:05 GMT	[thread overview]
Message-ID: <d9bmqhFj9rhU1@mid.individual.net> (raw)
In-Reply-To: mailman.1186.1446012388.7904.help-gnu-emacs@gnu.org

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)


  parent reply	other threads:[~2015-10-28 10:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1159.1445970298.7904.help-gnu-emacs@gnu.org>
2015-10-27 18:49 ` clear-kill-ring function Barry Margolin
2015-10-27 19:29   ` Sharon Kimble
2015-10-27 20:18     ` Michael Heerdegen
2015-10-28  6:06       ` Sharon Kimble
     [not found]       ` <mailman.1186.1446012388.7904.help-gnu-emacs@gnu.org>
2015-10-28 10:37         ` Joost Kremers [this message]
2015-10-28 12:46           ` Michael Heerdegen
2015-10-29  2:34           ` Emanuel Berg
2015-10-28  2:14     ` Emanuel Berg
2015-10-27 18:24 Sharon Kimble

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d9bmqhFj9rhU1@mid.individual.net \
    --to=joost.m.kremers@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.