From mboxrd@z Thu Jan 1 00:00:00 1970 From: Micah Anderson Subject: Re: org-capture-hook only when in frame? Date: Tue, 20 Sep 2011 20:21:32 -0400 Message-ID: <87pqiupwxf.fsf@algae.riseup.net> References: <87pqiual4k.fsf@algae.riseup.net> <87k4927orp.fsf@hermes.hocat.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([140.186.70.92]:57253) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6AZQ-0000rU-3f for emacs-orgmode@gnu.org; Tue, 20 Sep 2011 20:21:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R6AZO-0001ca-Vt for emacs-orgmode@gnu.org; Tue, 20 Sep 2011 20:21:48 -0400 Received: from lo.gmane.org ([80.91.229.12]:60650) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6AZO-0001cL-N8 for emacs-orgmode@gnu.org; Tue, 20 Sep 2011 20:21:46 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1R6AZN-0006Xm-JD for emacs-orgmode@gnu.org; Wed, 21 Sep 2011 02:21:45 +0200 Received: from 209.234.253.228 ([209.234.253.228]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 21 Sep 2011 02:21:45 +0200 Received: from micah by 209.234.253.228 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 21 Sep 2011 02:21:45 +0200 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-orgmode@gnu.org Tom Prince writes: > On Tue, 20 Sep 2011 18:45:31 -0400, Micah Anderson wrote: > Non-text part: multipart/signed >> >> I have a function to create a frame for capture mode that I can call >> with emacsclient at any time: >> >> ;; Initialization of capture frames >> (defun make-capture-frame () >> "Create a new frame and run org-capture" >> (interactive) >> (make-frame '((name . "capture") (width . 80) (height . 10))) >> (select-frame-by-name "capture") >> ;; Org-remember splits windows, force it to a single window > (let ((org-capture-mode-hook)) >> (add-hook 'org-capture-mode-hook 'delete-other-windows) >> (org-capture) > ) >> ) > Would probably work, although there may be better ways. Actually, it seems like I didn't need to do the hook at all, I just had to put a (delete-other-window) after the (org-capture), like this: (defun make-capture-frame () "Create a new frame and run org-capture." (interactive) (make-frame '((name . "capture") (width . 80 ) (height . 10))) (select-frame-by-name "capture") (org-capture) (delete-other-windows) ) Now I am trying to get the frame to be destroyed after I've either canceled, or saved the capture, I found these referenced on the mailing list, and I've added them and loaded them, but for some reason they aren't working: (defadvice capture-finalize (after delete-capture-frame activate) "Advise capture-finalize to close the frame if it is the capture frame" (if (equal "capture" (frame-parameter nil 'name)) (delete-frame))) (defadvice capture-destroy (after delete-capture-frame activate) "Advise capture-destroy to close the frame if it is the rememeber frame" (if (equal "capture" (frame-parameter nil 'name)) (delete-frame))) what happens is I get the frame, I get the org-capture template, I enter my item, I finalize it, and then I'm switched back to the scratch buffer, rather than the frame being destroyed :P micah