[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Removing the last entry from the kill-ring
From: |
Cecil Westerhof |
Subject: |
Re: Removing the last entry from the kill-ring |
Date: |
Sun, 12 Jan 2014 22:45:15 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) |
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