summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2018-04-21 15:21:25 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2018-04-21 15:21:25 +0200
commitcb63ccb78e43428503a1e6c4c877c4771b0cb527 (patch)
treeeea8c0536a9daa95d96a854718d5740843142412
parentc75c574d580ca751e28881fcb6acc8a250adec88 (diff)
downloadorg-mode-cb63ccb78e43428503a1e6c4c877c4771b0cb527.tar.gz
org-capture: Fix error on capture abortrelease_9.1.11
* 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>
-rw-r--r--lisp/org-capture.el19
1 files changed, 6 insertions, 13 deletions
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index e5a1597..cd54491 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -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)