From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Getting rid of split frame with org-capture Date: Sat, 12 Nov 2011 23:13:11 -0500 Message-ID: <1377.1321157591@alphaville.dokosmarshall.org> References: <20111112155731.GA5939@shi.workgroup> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([140.186.70.92]:43709) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPRRV-0001BT-IR for emacs-orgmode@gnu.org; Sat, 12 Nov 2011 23:13:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RPRRU-0003q0-1C for emacs-orgmode@gnu.org; Sat, 12 Nov 2011 23:13:17 -0500 Received: from g1t0027.austin.hp.com ([15.216.28.34]:9174) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPRRT-0003pn-RJ for emacs-orgmode@gnu.org; Sat, 12 Nov 2011 23:13:15 -0500 Received: from g1t0038.austin.hp.com (g1t0038.austin.hp.com [16.236.32.44]) by g1t0027.austin.hp.com (Postfix) with ESMTP id 0193438121 for ; Sun, 13 Nov 2011 04:13:12 +0000 (UTC) In-Reply-To: Message from Gregor Zattler of "Sat, 12 Nov 2011 16:57:31 +0100." <20111112155731.GA5939@shi.workgroup> 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 Cc: nicholas.dokos@hp.com Gregor Zattler wrote: > Hi Thomas, org-mode community, > * Thomas Lockney [10. Nov. 2011]: > > I'm attempting to get some code working that should create a new frame > > with *just* org-capture, > > this is something I also tried hard to achive. > > > but when I run it, I keep getting a split > > despite various attempts at running delete-other-windows. I'm running > > on "GNU Emacs 24.0.90.1 (i386-apple-darwin10.8.0, NS > > apple-appkit-1038.36)" so perhaps this is a 24 specific issue. Here's > > the code I've currently got: > > > > (defadvice org-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 org-capture-destroy (after delete-capture-frame activate) > > "Advise capture-destroy to close the frame if it is the capture frame" > > (if (equal "capture" (frame-parameter nil 'name)) > > (delete-frame))) > > > > (defun make-capture-frame () > > "Create a new frame and run org-capture." > > (interactive) > > (make-frame '((name . "Capture") > > (width . 100) > > (height . 15))) > > (select-frame-by-name "Capture") > > (delete-other-windows) > > (org-capture)) > > I played a bit with your code. I also use emacs24. I also get a > split frame. I think it's org-capture which splits the frame. > > I want to run this with emacsclient. But when there is no > graphical (X11) frame then emacsclient -e '(make-capture-frame)' > does nothing, no frame pops up. > > > I've also tried this using the org-capture-mode-hook to call > > delete-other-windows and I've tried placing delete-other-windows after > > the call to org-capture (both of those based on solutions I've seen > > posted to this list at various times). Anyone have any clues on this? > > I'm stumped, but I'm also fairly inexperienced at programming > > emacs. > > me too. For my capture needs I would like to automatically open a frame for > org-capture and also automatically close it when finishing the > capture. This should happen regardless of other frames or the > lack of other frames. > AFAICT, this is not possible with the current code. The above is attacking the problem at the wrong level: you can't change that behavior from the outside; you need to change the existing code in order to implement it. If you wish to hack, the relevant function is org-capture-place-template: changing the org-switch-to-buffer-other-window to org-switch-to-buffer-other-frame (and adding a definition for the latter function in analogy to the former) would indeed pop up a frame and you can enter your capture and finalize it - that's the easy part. But note that org-capture-finalize would need a tweak too in order to delete the now useless frame. And of course all of this would need to be done conditionally based on a new user option, perhaps org-capture-in-new-frame (nil by default). And don't forget to make it customizable. Not worth the bother IMO[fn:1], but if you wish to implement it and submit a patch, I'd be happy to review it. Nick Footnotes: [fn:1] Remember, capture is supposed to be as unobtrusive as possible: you just want to squirrel away something for future reference. Bells and whistles (which, IMO, this change would be) are not the point: you want to get in, record the data and get out and back to work as fast as possible. Popping up frames slows things down but more importantly jolts you away from what you were doing. At least, it would me (I think): that's why I don't think it's worth it, but you may very well disagree.