forked from mirrors/org-mode
org-capture: Fix bug when capturing with templates using `function'
* org-capture.el (org-capture): Store :return-to-wconf earlier. (org-capture-place-template): Don't store :return-to-wconf when called from a capture template using `function', rely on the early :return-to-wconf value store from `org-capture'. Thanks to Brett Viren for raising this issue.
This commit is contained in:
parent
2911965bfe
commit
747f46aa1f
|
@ -577,8 +577,9 @@ of the day at point (if any) or the current HH:MM time."
|
|||
(file-name-nondirectory
|
||||
(buffer-file-name orig-buf)))
|
||||
:annotation annotation
|
||||
:initial initial)
|
||||
(org-capture-put :default-time
|
||||
:initial initial
|
||||
:return-to-wconf (current-window-configuration)
|
||||
:default-time
|
||||
(or org-overriding-default-time
|
||||
(org-current-time)))
|
||||
(org-capture-set-target-location)
|
||||
|
@ -593,7 +594,8 @@ of the day at point (if any) or the current HH:MM time."
|
|||
;;insert at point
|
||||
(org-capture-insert-template-here)
|
||||
(condition-case error
|
||||
(org-capture-place-template)
|
||||
(org-capture-place-template
|
||||
(equal (car (org-capture-get :target)) 'function))
|
||||
((error quit)
|
||||
(if (and (buffer-base-buffer (current-buffer))
|
||||
(string-match "\\`CAPTURE-" (buffer-name)))
|
||||
|
@ -986,9 +988,12 @@ it. When it is a variable, retrieve the value. Return whatever we get."
|
|||
(ignore-errors (org-set-local (car v) (cdr v))))
|
||||
(buffer-local-variables buffer)))
|
||||
|
||||
(defun org-capture-place-template ()
|
||||
"Insert the template at the target location, and display the buffer."
|
||||
(org-capture-put :return-to-wconf (current-window-configuration))
|
||||
(defun org-capture-place-template (&optional inhibit-wconf-store)
|
||||
"Insert the template at the target location, and display the buffer.
|
||||
When `inhibit-wconf-store', don't store the window configuration, as it
|
||||
may have been stored before."
|
||||
(unless inhibit-wconf-store
|
||||
(org-capture-put :return-to-wconf (current-window-configuration)))
|
||||
(delete-other-windows)
|
||||
(org-switch-to-buffer-other-window
|
||||
(org-capture-get-indirect-buffer (org-capture-get :buffer) "CAPTURE"))
|
||||
|
|
Loading…
Reference in a new issue