Hi All,

I have some bookmarks in chrome which trigger capture via org-protocol.
I would like the windowing behavior of capture to be different depending
where it is invoked.

For example, when I invoke capture from my bookmark, I want the frame
that the capture used to vanish after C-c C-c or C-c C-k.  I achieved
this via the following code.


(defun jws/org-protocol-capture-p ()
  "Return true if this capture was initiated via org-protocol."
  (equal (buffer-name (org-capture-get :original-buffer)) " *server*"))

(defun jws/org-capture-after-finalize ()
  "Delete frame if capture was initiated via org-protocol"
  (if (jws/org-protocol-capture-p) (delete-frame)))

(add-hook 'org-capture-after-finalize-hook 'jws/org-capture-after-finalize)


When I invoke the capture from my bookmark, I also want capture to be
the only window in the frame.  I can make all captures act that way by
setting (add-hook 'org-capture-mode-hook 'delete-other-windows)

But when I tried to have this part be source dependent with

(defun jws/org-capture-initialize ()
  (if (jws/org-protocol-capture-p) 'delete-other-windows))

(add-hook 'org-capture-mode-hook 'jws/org-capture-initialize)

it still gave me a frame with two windows, for reasons I don't
understand.  I stepped through the code with edebug and confirmed that
jws/org-protocol-capture-p was evaluating to true.


Or perhaps there is there something more suitable for my hook than
'delete-other-windows?  Has anyone successfully done something similar?

Best,
Josiah

Reply via email to