From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Cecil Westerhof Newsgroups: gmane.emacs.help Subject: Re: Removing the last entry from the kill-ring Date: Sun, 12 Jan 2014 22:45:15 +0100 Organization: Decebal Computing Message-ID: <87a9f0c1sk.fsf@Equus.Decebal.nl> References: <878uulcdkz.fsf@Equus.Decebal.nl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1389564610 16404 80.91.229.3 (12 Jan 2014 22:10:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 12 Jan 2014 22:10:10 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jan 12 23:10:19 2014 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 1W2TEY-0004Tl-Jn for geh-help-gnu-emacs@m.gmane.org; Sun, 12 Jan 2014 23:10:18 +0100 Original-Received: from localhost ([::1]:39611 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2TEY-0001lw-0R for geh-help-gnu-emacs@m.gmane.org; Sun, 12 Jan 2014 17:10:18 -0500 Original-Path: usenet.stanford.edu!goblin1!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!rt.uk.eu.org!feed.xsnews.nl!border01.ams.xsnews.nl!feeder01.ams.xsnews.nl!frontend-F09-04.ams.news.kpn.nl Original-Newsgroups: gnu.emacs.help X-Face: "(y8cC@tg_12{">GF'UXTW]FHI2wMiZNrnf'1EFQ&O#$m:f#O7+7}kR,v+Pti8=Vi/Z"g^?b"E X-Homepage: http://www.decebal.nl/ User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) Cancel-Lock: sha1:JM+FmKQBVZwILAZKk/A3l1vmV7k= Original-Lines: 32 Original-NNTP-Posting-Host: 77.171.42.144 Original-X-Trace: 1389563941 news.kpn.nl 24815 77.171.42.144@kpn/77.171.42.144:45286 Original-Xref: usenet.stanford.edu gnu.emacs.help:203094 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:95363 Archived-At: Op Sunday 12 Jan 2014 19:07 CET schreef Michael Heerdegen: > Hi Cecil, > >> I wrote the following function, to copy the current buffer to a >> temporary buffer: >> (defun dcbl-buffer-to-temp () >> (interactive) >> (let ((buffer-name (generate-new-buffer-name "tempory-edit"))) >> (copy-region-as-kill (point-min) (point-max)) >> (switch-to-buffer buffer-name) >> (yank))) >> >> This works OK (I think) except for one problem: there is an entry >> added to the kill-ring. Is there a way to remove this? > > Just don't use the kill-ring and its commands for that. I.e. use > e.g. `buffer-substring[-no-properties]' for copying and `insert' for > pasting. Thanks. I changed it to: (defun dcbl-buffer-to-temp () (interactive) (let ((buffer-name (generate-new-buffer-name "tempory-edit")) (text (buffer-substring (point-min) (point-max)))) (switch-to-buffer buffer-name) (insert text))) -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof