[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Is it possible to save undo state in file and reload again?
From: |
Jean Louis |
Subject: |
Is it possible to save undo state in file and reload again? |
Date: |
Fri, 06 Jan 2023 18:24:41 +0300 |
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/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Is it possible to save undo state in file and reload again?,
Jean Louis <=