From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: [PATCH] * lisp/org-src.el (org-edit-src-exit): disable undo. Date: Tue, 5 Mar 2013 23:05:50 -0500 Message-ID: <1362542750-22550-1-git-send-email-aaronecay@gmail.com> Return-path: Received: from eggs.gnu.org ([208.118.235.92]:55492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UD5c3-0004w1-C4 for emacs-orgmode@gnu.org; Tue, 05 Mar 2013 23:05:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UD5c2-0005pa-4h for emacs-orgmode@gnu.org; Tue, 05 Mar 2013 23:05:55 -0500 Received: from mail-qa0-f44.google.com ([209.85.216.44]:48285) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UD5c1-0005pW-VZ for emacs-orgmode@gnu.org; Tue, 05 Mar 2013 23:05:54 -0500 Received: by mail-qa0-f44.google.com with SMTP id bv4so2312478qab.3 for ; Tue, 05 Mar 2013 20:05:53 -0800 (PST) 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 Currently, this function modifies the buffer-undo-list, which it should not. One can reproduce the undesirable behavior by creating a new org buffer and manually typing in the following text: #+begin_src emacs-lisp foo bar #+end_src Then press C-c ' twice to enter and exit the edit-src. Then press C-/ to undo: the cursor moves to the beginning of the source block. Further presses of C-/ undo the original text entry (as expected). --- lisp/org-src.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index 81c0054..73e0751 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -737,11 +737,12 @@ with \",*\", \",#+\", \",,*\" and \",,#+\"." (kill-buffer buffer)) (goto-char beg) (when allow-write-back-p - (delete-region beg (max beg end)) - (unless (string-match "\\`[ \t]*\\'" code) - (insert code)) - (goto-char beg) - (if single (just-one-space))) + (let ((buffer-undo-list t)) + (delete-region beg (max beg end)) + (unless (string-match "\\`[ \t]*\\'" code) + (insert code)) + (goto-char beg) + (if single (just-one-space)))) (if (memq t (mapcar (lambda (overlay) (eq (overlay-get overlay 'invisible) 'org-hide-block)) -- 1.8.1.5