all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Is it possible to save undo state in file and reload again?
@ 2023-01-06 15:24 Jean Louis
  0 siblings, 0 replies; only message in thread
From: Jean Louis @ 2023-01-06 15:24 UTC (permalink / raw)
  To: Help GNU Emacs

There must exist some "undo" state in Emacs for {C-x u} to work,
right?

Is it maybe the contents of variable `pending-undo-list'?

I have tried saving it this way:

(defun data-to-file (data file)
  "PRIN1 Emacs Lisp DATA to FILE"
  (string-to-file-force (prin1-to-string data) file))

(defun data-from-file (file)
  "Reads and returns Emacs Lisp data from FILE"
  (condition-case nil
      (car (read-from-string
	    (file-to-string file)))
    (error nil)))

(data-to-file pending-undo-list "pul") ➜ "pul"

(file-to-string "pul") works and I can see what is inside.

But then my function `data-from-file' can't handle it:

(data-from-file "pul")

because I get this error

(read-from-string (file-to-string "pul")) 
eval: Invalid read syntax: "#"

How can I save it in file and read from file with that read syntax
"#"? It should be somehow possible.

When editing database objects I would try to capture the undo state
and at any new editing to reload the undo state.


--
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-06 15:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-06 15:24 Is it possible to save undo state in file and reload again? Jean Louis

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.