mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2025-01-09 15:50:59 +00:00
src: Do not undo edit buffers back to empty state
* lisp/org-src.el (org-src--edit-element): Clear undo information once the initial contents have been inserted. * testing/lisp/test-org-src.el (test-org-src/undo): New test.
This commit is contained in:
parent
73e367fca4
commit
b0bbe512b4
@ -558,6 +558,10 @@ Leave point in edit buffer."
|
||||
(setq org-src-source-file-name source-file-name)
|
||||
;; Start minor mode.
|
||||
(org-src-mode)
|
||||
;; Clear undo information so we cannot undo back to the
|
||||
;; initial empty buffer.
|
||||
(buffer-disable-undo (current-buffer))
|
||||
(buffer-enable-undo)
|
||||
;; Move mark and point in edit buffer to the corresponding
|
||||
;; location.
|
||||
(if remote
|
||||
|
@ -58,6 +58,17 @@
|
||||
(goto-char (point-max))
|
||||
(should-error (org-edit-special))))
|
||||
|
||||
(ert-deftest test-org-src/undo ()
|
||||
"Undo-ing an edit buffer should not go back to empty state."
|
||||
(org-test-with-temp-text "
|
||||
#+begin_src emacs-lisp<point>
|
||||
(message hello)
|
||||
#+end_src
|
||||
"
|
||||
(org-edit-special)
|
||||
(should-error (undo))
|
||||
(org-edit-src-exit)))
|
||||
|
||||
(ert-deftest test-org-src/empty-block ()
|
||||
"Editing empty block."
|
||||
(org-test-with-temp-text
|
||||
|
Loading…
Reference in New Issue
Block a user