emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Peter Danenberg <pcd@roxygen.org>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Save undo history after org-edit-src-save.
Date: Mon, 23 Jan 2012 16:05:53 -0600	[thread overview]
Message-ID: <20120123220553.GA13336@klutometis.wikitex.org> (raw)

[-- 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 ""))))

             reply	other threads:[~2012-01-23 22:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-23 22:05 Peter Danenberg [this message]
2012-01-24 14:00 ` [PATCH] Save undo history after org-edit-src-save Bastien
2012-01-24 18:57   ` Peter Danenberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120123220553.GA13336@klutometis.wikitex.org \
    --to=pcd@roxygen.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).