From mboxrd@z Thu Jan 1 00:00:00 1970 From: Josiah Schwab Subject: Changing capture frame/window behavior depending on source Date: Fri, 06 Dec 2013 21:52:32 -0800 Message-ID: <87wqjhus0v.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33291) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VpAoq-0001wH-5l for emacs-orgmode@gnu.org; Sat, 07 Dec 2013 00:52:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VpAof-0003VZ-GL for emacs-orgmode@gnu.org; Sat, 07 Dec 2013 00:52:48 -0500 Received: from mail-pb0-x234.google.com ([2607:f8b0:400e:c01::234]:53119) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VpAof-0003VM-9R for emacs-orgmode@gnu.org; Sat, 07 Dec 2013 00:52:37 -0500 Received: by mail-pb0-f52.google.com with SMTP id uo5so2256856pbc.25 for ; Fri, 06 Dec 2013 21:52:36 -0800 (PST) Received: from localhost (75-101-48-233.dsl.static.sonic.net. [75.101.48.233]) by mx.google.com with ESMTPSA id xv2sm1787869pbb.39.2013.12.06.21.52.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Dec 2013 21:52:35 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-org list 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