emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] * lisp/org-src.el (org-edit-src-exit): disable undo.
@ 2013-03-06  4:05 Aaron Ecay
  2013-03-08 17:31 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: Aaron Ecay @ 2013-03-06  4:05 UTC (permalink / raw)
  To: emacs-orgmode

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

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

* Re: [PATCH] * lisp/org-src.el (org-edit-src-exit): disable undo.
  2013-03-06  4:05 [PATCH] * lisp/org-src.el (org-edit-src-exit): disable undo Aaron Ecay
@ 2013-03-08 17:31 ` Bastien
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2013-03-08 17:31 UTC (permalink / raw)
  To: Aaron Ecay; +Cc: emacs-orgmode

Hi Aaron,

Aaron Ecay <aaronecay@gmail.com> writes:

> 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).

Applied, thanks!

-- 
 Bastien

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

end of thread, other threads:[~2013-03-08 17:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-06  4:05 [PATCH] * lisp/org-src.el (org-edit-src-exit): disable undo Aaron Ecay
2013-03-08 17:31 ` Bastien

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).