Generalize +org-capture-frame-p
Plus minor refactor of +org-capture/open-frame.
This commit is contained in:
parent
bce0cc2152
commit
3ce752a227
1 changed files with 4 additions and 4 deletions
|
@ -29,7 +29,8 @@
|
||||||
(defun +org-capture-frame-p (&rest _)
|
(defun +org-capture-frame-p (&rest _)
|
||||||
"Return t if the current frame is an org-capture frame opened by
|
"Return t if the current frame is an org-capture frame opened by
|
||||||
`+org-capture/open-frame'."
|
`+org-capture/open-frame'."
|
||||||
(and (equal "doom-capture" (frame-parameter nil 'name))
|
(and (equal (alist-get 'name +org-capture-frame-parameters)
|
||||||
|
(frame-parameter nil 'name))
|
||||||
(frame-parameter nil 'transient)))
|
(frame-parameter nil 'transient)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
@ -49,14 +50,13 @@ you're done. This can be called from an external shell script."
|
||||||
(with-selected-frame frame
|
(with-selected-frame frame
|
||||||
(require 'org-capture)
|
(require 'org-capture)
|
||||||
(condition-case ex
|
(condition-case ex
|
||||||
(cl-letf (((symbol-function #'pop-to-buffer)
|
(cl-letf (((symbol-function #'pop-to-buffer) #'switch-to-buffer))
|
||||||
(symbol-function #'switch-to-buffer)))
|
|
||||||
(switch-to-buffer (doom-fallback-buffer))
|
(switch-to-buffer (doom-fallback-buffer))
|
||||||
(let ((org-capture-initial initial-input)
|
(let ((org-capture-initial initial-input)
|
||||||
org-capture-entry)
|
org-capture-entry)
|
||||||
(when (and key (not (string-empty-p key)))
|
(when (and key (not (string-empty-p key)))
|
||||||
(setq org-capture-entry (org-capture-select-template key)))
|
(setq org-capture-entry (org-capture-select-template key)))
|
||||||
(call-interactively +org-capture-fn)))
|
(funcall +org-capture-fn)))
|
||||||
('error
|
('error
|
||||||
(message "org-capture: %s" (error-message-string ex))
|
(message "org-capture: %s" (error-message-string ex))
|
||||||
(delete-frame frame))))))
|
(delete-frame frame))))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue