emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Save undo history after org-edit-src-save.
@ 2012-01-23 22:05 Peter Danenberg
  2012-01-24 14:00 ` Bastien
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Danenberg @ 2012-01-23 22:05 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 133 bytes --]

It's been irritating me that after saving an edit buffer, the undo
history disappears; the attached patch restores the undo history.

[-- Attachment #2: org-edit-src-save-with-undo-history.patch --]
[-- Type: text/plain, Size: 842 bytes --]

diff --git a/lisp/org-src.el b/lisp/org-src.el
index 8cdf81e..e85e04e 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -661,7 +661,7 @@ the language, a switch telling if the content should be in a single line."
       (setq org-edit-src-saved-temp-window-config nil))))
 
 (defmacro org-src-in-org-buffer (&rest body)
-  `(let ((p (point)) (m (mark)) msg)
+  `(let ((p (point)) (m (mark)) (ul buffer-undo-list) msg)
      (save-window-excursion
        (org-edit-src-exit 'save)
        ,@body
@@ -670,6 +670,7 @@ the language, a switch telling if the content should be in a single line."
 	   (let ((org-src-window-setup 'current-window))
 	     (org-edit-src-code 'save))
 	 (org-edit-src-code 'save)))
+     (setq buffer-undo-list ul)
      (push-mark m 'nomessage)
      (goto-char (min p (point-max)))
      (message (or msg ""))))

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-24 18:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-23 22:05 [PATCH] Save undo history after org-edit-src-save Peter Danenberg
2012-01-24 14:00 ` Bastien
2012-01-24 18:57   ` Peter Danenberg

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).