diff options
author | Rasmus <rasmus@gmx.us> | 2018-01-22 15:57:42 +0100 |
---|---|---|
committer | Rasmus <rasmus@gmx.us> | 2018-01-22 16:02:55 +0100 |
commit | bb396a369c93e57b033844003c7ceab61d61aa08 (patch) | |
tree | 31a9ef7d5792d64bf181b17cb8255386efd5d96d /lisp/org/org-capture.el | |
parent | fa582153f7a75e1eaaef4bfd2b381916233dc0a7 (diff) | |
download | emacs-bb396a369c93e57b033844003c7ceab61d61aa08.tar.gz |
Update Org to v9.1.6
Please note this is a bugfix release. See etc/ORG-NEWS for details.
Diffstat (limited to 'lisp/org/org-capture.el')
-rw-r--r-- | lisp/org/org-capture.el | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el index 24fc0a61f0b..cb1741f2f91 100644 --- a/lisp/org/org-capture.el +++ b/lisp/org/org-capture.el @@ -927,18 +927,24 @@ Store them in the capture property list." (_ (error "Cannot find target ID \"%s\"" id)))) (`(file+headline ,path ,headline) (set-buffer (org-capture-target-buffer path)) + ;; Org expects the target file to be in Org mode, otherwise + ;; it throws an error. However, the default notes files + ;; should work out of the box. In this case, we switch it to + ;; Org mode. (unless (derived-mode-p 'org-mode) - (error "Target buffer \"%s\" for file+headline not in Org mode" - (current-buffer))) + (org-display-warning + (format "Capture requirement: switching buffer %S to Org mode" + (current-buffer))) + (org-mode)) (org-capture-put-target-region-and-position) (widen) (goto-char (point-min)) (if (re-search-forward (format org-complex-heading-regexp-format (regexp-quote headline)) nil t) - (goto-char (line-beginning-position)) + (beginning-of-line) (goto-char (point-max)) - (or (bolp) (insert "\n")) + (unless (bolp) (insert "\n")) (insert "* " headline "\n") (beginning-of-line 0))) (`(file+olp ,path . ,outline-path) |