From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Danenberg Subject: [PATCH] Save undo history after org-edit-src-save. Date: Mon, 23 Jan 2012 16:05:53 -0600 Message-ID: <20120123220553.GA13336@klutometis.wikitex.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="0OAP2g/MAC+5xKAE" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:54766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpS1U-0008KO-FQ for emacs-orgmode@gnu.org; Mon, 23 Jan 2012 17:05:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RpS1T-0007m8-8p for emacs-orgmode@gnu.org; Mon, 23 Jan 2012 17:05:56 -0500 Received: from klutometis.wikitex.org ([72.51.35.14]:53275) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpS1T-0007lu-0R for emacs-orgmode@gnu.org; Mon, 23 Jan 2012 17:05:55 -0500 Received: from klutometis.wikitex.org (localhost.localdomain [127.0.0.1]) by klutometis.wikitex.org (8.13.1/8.13.1) with ESMTP id q0NM5rk9013718 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 23 Jan 2012 16:05:53 -0600 Received: (from pcdanenb@localhost) by klutometis.wikitex.org (8.13.1/8.13.1/Submit) id q0NM5rU3013717 for emacs-orgmode@gnu.org; Mon, 23 Jan 2012 16:05:53 -0600 Content-Disposition: inline List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline It's been irritating me that after saving an edit buffer, the undo history disappears; the attached patch restores the undo history. --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="org-edit-src-save-with-undo-history.patch" 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 "")))) --0OAP2g/MAC+5xKAE--