From: Aaron Ecay <aaronecay@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] * lisp/org-src.el (org-edit-src-exit): disable undo.
Date: Tue, 5 Mar 2013 23:05:50 -0500 [thread overview]
Message-ID: <1362542750-22550-1-git-send-email-aaronecay@gmail.com> (raw)
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
next reply other threads:[~2013-03-06 4:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-06 4:05 Aaron Ecay [this message]
2013-03-08 17:31 ` [PATCH] * lisp/org-src.el (org-edit-src-exit): disable undo Bastien
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=1362542750-22550-1-git-send-email-aaronecay@gmail.com \
--to=aaronecay@gmail.com \
--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).