diff options
Diffstat (limited to 'lisp/org-capture.el')
-rw-r--r-- | lisp/org-capture.el | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lisp/org-capture.el b/lisp/org-capture.el index a4f0fd0..0a6e4e4 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -1267,8 +1267,11 @@ Of course, if exact position has been required, just put it there." (save-restriction (widen) (goto-char pos) - (with-demoted-errors - (bookmark-set "org-capture-last-stored")) + (let ((bookmark-name (plist-get org-bookmark-names-plist + :last-capture))) + (when bookmark-name + (with-demoted-errors + (bookmark-set bookmark-name)))) (move-marker org-capture-last-stored-marker (point))))))) (defun org-capture-narrow (beg end) @@ -1734,11 +1737,15 @@ The template may still contain \"%?\" for cursor positioning." (goto-char (match-beginning 0)) (let ((template-start (point))) (forward-char 1) - (let ((result (org-eval - (org-capture--expand-keyword-in-embedded-elisp - (read (current-buffer)))))) + (let* ((sexp (read (current-buffer))) + (result (org-eval + (org-capture--expand-keyword-in-embedded-elisp sexp)))) (delete-region template-start (point)) - (insert result)))))) + (when result + (if (stringp result) + (insert result) + (error "Capture template sexp `%s' must evaluate to string or nil" + sexp)))))))) (defun org-capture--expand-keyword-in-embedded-elisp (attr) "Recursively replace capture link keywords in ATTR sexp. |