From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.help Subject: Re: clear-kill-ring function Date: 28 Oct 2015 10:37:05 GMT Message-ID: References: <87lhaof6tm.fsf@skimble.plus.com> <87twpcoyjy.fsf@web.de> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1446028824 26079 80.91.229.3 (28 Oct 2015 10:40:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 28 Oct 2015 10:40:24 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 28 11:40:23 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZrO9W-00060I-1T for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Oct 2015 11:40:22 +0100 Original-Received: from localhost ([::1]:36658 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrO9V-0005Yq-4O for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Oct 2015 06:40:21 -0400 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 47 Original-X-Trace: individual.net MerQ3pCSqjmjDsNKp349jg+gHldZI+xXBUreuLwxdfii76cpOg Cancel-Lock: sha1:F6dbPMfyKBruW6wajc/VtP4O0LU= Mail-Copies-To: nobody X-Editor: Emacs of course! User-Agent: slrn/1.0.1 (Linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:215577 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:107863 Archived-At: 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)