From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ryan Thompson Subject: Re: org-remember-AFTER-finalize-hook , anyone? Date: Sun, 28 Mar 2010 14:12:25 -0700 Message-ID: <2a4ba2fd1003281412u615ce90do49748a7cc49e6769@mail.gmail.com> References: <20100130165419.GA9466@usha.takhisis.invalid> <2a4ba2fd1001301023g6ab70661l529733de212f2b64@mail.gmail.com> <20100130234501.GA16336@usha.takhisis.invalid> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nvzmv-0002G0-3n for emacs-orgmode@gnu.org; Sun, 28 Mar 2010 17:12:53 -0400 Received: from [140.186.70.92] (port=38851 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nvzms-0002Fg-FY for emacs-orgmode@gnu.org; Sun, 28 Mar 2010 17:12:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nvzmq-00028D-TG for emacs-orgmode@gnu.org; Sun, 28 Mar 2010 17:12:50 -0400 Received: from mail-gx0-f217.google.com ([209.85.217.217]:38833) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nvzmq-000285-QP for emacs-orgmode@gnu.org; Sun, 28 Mar 2010 17:12:48 -0400 Received: by gxk9 with SMTP id 9so1132601gxk.8 for ; Sun, 28 Mar 2010 14:12:47 -0700 (PDT) In-Reply-To: <20100130234501.GA16336@usha.takhisis.invalid> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Stefano Zacchiroli Cc: emacs-orgmode@gnu.org Ok, I finally recreated my setup. There's some bug in emacs daemon where if no X frame currently exist and you use emacsclient -e '(some-function-that-creates-a-frame)', then the frame that is created will immediately be deleted when the command terminates. (Note: this is only a problem with an emacs that wasn't started originally with an X frame, i.e. either emacs -nw or emacs --daemon) To fix this, the key is to use emacsclient -c to create a new frame, and then use -e to eval some code that creates the frame you actually want, and then deletes the first frame. Here's my script: #!/bin/sh exec emacsclient -c -e ' (let ((sacframe (selected-frame))) ; the frame create by the -c options is the "sacrificial frame" (make-frame-invisible sacframe t) (remember-other-frame) (delete-frame sacframe t)) ' Put that in a script in your $PATH somewhere and add a keybinding using e.g. xbindkeys. Personally, I use Windows Key + R. On Sat, Jan 30, 2010 at 4:45 PM, Stefano Zacchiroli wrote= : > On Sat, Jan 30, 2010 at 10:23:20AM -0800, Ryan Thompson wrote: >> Ooh, I solved this problem before, but then I accidentally deleted all m= y >> files. I have a backup, but I haven't gotten around to restoring everyth= ing >> yet. I'll get back to you later. > > In the meantime, I've implemented a workaround, based on the following > idea: > > =A0(add-hook 'org-remember-mode-hook 'delete-other-windows) > =A0(defadvice org-remember-finalize (after delete-frame-at-end activate) > =A0 =A0"Delete frame at remember finalization" > =A0 =A0(delete-frame)) > =A0(defadvice org-remember-kill (after delete-frame-at-end activate) > =A0 =A0"Delete frame at remember abort" > =A0 =A0(delete-frame)) > > It works properly, but it assumes that org-remember is invoked only > externally via org-protocol (i.e. if I invoke org-remember by hand I > risk my frame). > > So I've conceived the following horror to constraint the effect to > org-protocol invocation (yes, with a serious race condition involved): > > =A0(add-hook 'org-remember-mode-hook 'delete-other-windows) > =A0(setq my-org-protocol-flag nil) > =A0(defadvice org-remember-finalize (after delete-frame-at-end activate) > =A0 =A0"Delete frame at remember finalization" > =A0 =A0(progn > =A0 =A0 =A0(if my-org-protocol-flag (delete-frame)) > =A0 =A0 =A0(setq my-org-protocol-flag nil))) > =A0(defadvice org-remember-kill (after delete-frame-at-end activate) > =A0 =A0"Delete frame at remember abort" > =A0 =A0(progn > =A0 =A0 =A0(if my-org-protocol-flag (delete-frame)) > =A0 =A0 =A0(setq my-org-protocol-flag nil))) > =A0(defadvice org-protocol-remember (before set-org-protocol-flag activat= e) > =A0 =A0(setq my-org-protocol-flag t)) > > Any suggestions on how to achieve the same result in a more proper way > will be appreciated ... > > Cheers. > > -- > Stefano Zacchiroli -o- PhD in Computer Science \ PostDoc @ Univ. Paris 7 > zack@{upsilon.cc,pps.jussieu.fr,debian.org} -<>- http://upsilon.cc/zack/ > Dietro un grande uomo c'=E8 ..| =A0. =A0|. Et ne m'en veux pas si je te t= utoie > sempre uno zaino ...........| ..: |.... Je dis tu =E0 tous ceux que j'aim= e > > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode >