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: Stefan Monnier
Subject: Re: delete-region - is their a way to get the deleted text?
Date: Thu, 13 Jun 2013 11:11:06 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> ,------------------------------------------------------------------
> | (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?

By and large it's gone and lost.  What you can do:
- copy the text before calling the function (then try and figure out
  which part of the text was deleted).
- make sure the function is called with undo enabled, then look for the
  deleted string in the undo log (that's how delete-and-extract-region
  was originally coded, back when I wrote it in Elisp).
- temporarily advise delete-region so it stashes its result in
  some variable.
- even nastier hacks can be imagined, of course.


        Stefan


reply via email to

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