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

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

undo-tree: restore state from register for different buffer?


From: Thorsten Jolitz
Subject: undo-tree: restore state from register for different buffer?
Date: Wed, 11 Jun 2014 17:44:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Hi List, 

I create a temporary buffer *FOO* and modify it in a program. I would
like to use undo-tree to

,---------------------------------
| undo-tree-save-state-to-register
`---------------------------------

and later 

,--------------------------------------
| undo-tree-restore-state-from-register
`--------------------------------------

but not for the same buffer, i.e. *FOO* is killed after the state is
saved to say register ?u, but later on a new identical (or almost
identical) temporary buffer named *FOO* too is created, and in this
buffer the saved state should be restored form register ?u. 

That does not work out of the box, rather a user-error is thrown because

,------------------------------------------------------------------
| (not (eq (current-buffer) (undo-tree-register-data-buffer data)))
`------------------------------------------------------------------

I copied & modified the undo-tree sources and changed this user error to
a simple message and tried to aset (current-buffer) as first element of
'data' (the saved-state vector), but to no avail, there is no error
anymore, but nothing happens.

On a lower level there are `buffer-undo-list' and `buffer-undo-tree'
that could be stored before killing original *FOO*, but I could not figure
out if its possible - and how to - restore the state of new *FOO* using
this list or tree. 

-- 
cheers,
Thorsten





reply via email to

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