summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2011-07-12 00:57:57 +0200
committerBastien Guerry <bzg@altern.org>2011-07-12 08:29:02 +0200
commit17603418ab47df2def38340c208e4f7c00194c19 (patch)
tree1c54f1707dc596e3ab7baa1cb6ec1860a5dcdbbb
parent462c0d1e8635c1c0e3d600cd5b84df1fb35be41e (diff)
downloadorg-mode-17603418ab47df2def38340c208e4f7c00194c19.tar.gz
org-capture.el: Fix bug about insert blank line when aborting.
* org-capture.el (org-capture-finalize): bugfix about inserted blank line when killing the capture buffer and `org-blank-before-new-entry' tells to not insert anything before a heading. Thanks to Leo for reporting this.
-rw-r--r--lisp/org-capture.el12
1 files changed, 7 insertions, 5 deletions
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index d547f3d..dd74ecc 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -551,6 +551,9 @@ captured item after finalizing."
(m2 (org-capture-get :end-marker 'local)))
(if (and m1 m2 (= m1 beg) (= m2 end))
(progn
+ (setq m2 (if (cdr (assoc '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)))
@@ -576,16 +579,14 @@ captured item after finalizing."
(org-at-table-p))
(if (org-table-get-stored-formulas)
(org-table-recalculate 'all) ;; FIXME: Should we iterate???
- (org-table-align)))
- )
+ (org-table-align))))
;; Store this place as the last one where we stored something
;; Do the marking in the base buffer, so that it makes sense after
;; the indirect buffer has been killed.
(org-capture-bookmark-last-stored-position)
;; Run the hook
- (run-hooks 'org-capture-before-finalize-hook)
- )
+ (run-hooks 'org-capture-before-finalize-hook))
;; Kill the indirect buffer
(save-buffer)
@@ -665,7 +666,8 @@ already gone. Any prefix argument will be passed to the refile command."
(interactive)
;; FIXME: This does not do the right thing, we need to remove the new stuff
;; By hand it is easy: undo, then kill the buffer
- (let ((org-note-abort t) (org-capture-before-finalize-hook nil))
+ (let ((org-note-abort t)
+ (org-capture-before-finalize-hook nil))
(org-capture-finalize)))
(defun org-capture-goto-last-stored ()