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

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

Re: delete-region - is their a way to get the deleted text?


From: Thorsten Jolitz
Subject: Re: delete-region - is their a way to get the deleted text?
Date: Fri, 14 Jun 2013 10:20:29 +0200
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux)

David Engster <deng@randomsample.de> writes:

> Thorsten Jolitz writes:
>> I found a function that would be useful for me as is - if only I would
>> have access to the region deleted with 'delete-region' inside that
>> function.
>>
>> ,------------------------------------------------------------------
>> | (delete-region START END)
>> | Delete the text between START and END.
>> | This command deletes buffer text without modifying the kill ring.
>> `------------------------------------------------------------------
>>
>> If its not in the kill ring - is there any other way to get the text
>> that deleted, or is it simply gone and lost?
>
> Well, there's always the super-hacky way:
>
> (require 'cl)
>
> (defadvice your-function-of-interest
>   (around replace-delete-with-kill activate)
>   "Replace `delete-region' with `kill-region'."
>   (flet ((delete-region (x y)
>                       (kill-region x y)))
>     ad-do-it))
>
> And then just yank...

Not that I understand all of it, but it seems to do exactly what I want.
Thanks!

-- 
cheers,
Thorsten




reply via email to

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