[Org] Code to make frame for spontaneous capturing

This commit is contained in:
Daniel - 2018-11-18 16:39:43 +01:00
parent 3459213765
commit 5b64a89943
Signed by: dbo
GPG Key ID: 4F63DB96D45AA9C6
2 changed files with 24 additions and 1 deletions

View File

@ -595,7 +595,8 @@
db/org-timestamp-difference
db/read-clockline
db/org-capture-code-snippet
hydra-org-clock/body))
hydra-org-clock/body
db/make-org-capture-frame))
(use-package org
:commands (org-store-link)

View File

@ -235,6 +235,28 @@ In ~%s~:
org-src-mode
code-snippet))))
;; Make capture frame, made for being called via emacsclient
;; https://cestlaz.github.io/posts/using-emacs-24-capture-2/
(defun db/make-org-capture-frame ()
"Create a new frame for capturing."
(interactive)
(make-frame '((name . "capture")))
(select-frame-by-name "capture")
(delete-other-windows)
(let ((org-capture-after-finalize-hook org-capture-after-finalize-hook))
(org-capture)))
(defun db/delete-frame-if-capture (&rest r)
"If current frame was made for a capture, close after done."
(ignore r)
(when (equal (frame-parameter nil 'name)
"capture")
(delete-frame)))
(advice-add 'org-capture-finalize
:after #'db/delete-frame-if-capture)
;;; Refiling