[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] [PATCH] * lisp/org-src.el (org-edit-src-exit): disable undo.
From: |
Aaron Ecay |
Subject: |
[O] [PATCH] * lisp/org-src.el (org-edit-src-exit): disable undo. |
Date: |
Tue, 5 Mar 2013 23:05:50 -0500 |
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
- [O] [PATCH] * lisp/org-src.el (org-edit-src-exit): disable undo.,
Aaron Ecay <=