1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-12-01 08:17:34 +00:00

org-capture: Fix error on capture abort

* lisp/org-capture.el (org-capture-finalize): Do not set `abort-note'
  to `dirty' too easily.

Reported-by: Brad Knotwell <bknotwell@yahoo.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-04/msg00183.html>
This commit is contained in:
Nicolas Goaziou 2018-04-21 15:21:25 +02:00
parent c75c574d58
commit cb63ccb78e

View File

@ -743,9 +743,7 @@ captured item after finalizing."
(org-with-point-at clock-in-task (org-clock-in)))
(message "Interrupted clock has been resumed"))))
(let ((beg (point-min))
(end (point-max))
(abort-note nil))
(let ((abort-note nil))
;; Store the size of the capture buffer
(org-capture-put :captured-entry-size (- (point-max) (point-min)))
(widen)
@ -753,16 +751,11 @@ captured item after finalizing."
(org-capture-put :insertion-point (point))
(if org-note-abort
(let ((m1 (org-capture-get :begin-marker 'local))
(m2 (org-capture-get :end-marker 'local)))
(if (and m1 m2 (= m1 beg) (= m2 end))
(progn
(setq m2 (if (cdr (assq 'heading org-blank-before-new-entry))
m2 (1+ m2))
m2 (if (< (point-max) m2) (point-max) m2))
(setq abort-note 'clean)
(kill-region m1 m2))
(setq abort-note 'dirty)))
(let ((beg (org-capture-get :begin-marker 'local))
(end (org-capture-get :end-marker 'local)))
(if (not (and beg end)) (setq abort-note 'dirty)
(setq abort-note t)
(org-with-wide-buffer (kill-region beg end))))
;; Postprocessing: Update Statistics cookies, do the sorting
(when (derived-mode-p 'org-mode)