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:13:21 -0700 Message-ID: <2a4ba2fd1003281413j38703b41ldce00bfc127da980@mail.gmail.com> References: <20100130165419.GA9466@usha.takhisis.invalid> <2a4ba2fd1001301023g6ab70661l529733de212f2b64@mail.gmail.com> <20100130234501.GA16336@usha.takhisis.invalid> <2a4ba2fd1003281412u615ce90do49748a7cc49e6769@mail.gmail.com> 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 1Nvznl-0002b7-2B for emacs-orgmode@gnu.org; Sun, 28 Mar 2010 17:13:45 -0400 Received: from [140.186.70.92] (port=38973 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nvznj-0002aQ-ML for emacs-orgmode@gnu.org; Sun, 28 Mar 2010 17:13:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nvzni-0002E4-2Q for emacs-orgmode@gnu.org; Sun, 28 Mar 2010 17:13:43 -0400 Received: from mail-iw0-f177.google.com ([209.85.223.177]:61344) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nvznh-0002E0-Vq for emacs-orgmode@gnu.org; Sun, 28 Mar 2010 17:13:42 -0400 Received: by iwn7 with SMTP id 7so9607462iwn.26 for ; Sun, 28 Mar 2010 14:13:41 -0700 (PDT) In-Reply-To: <2a4ba2fd1003281412u615ce90do49748a7cc49e6769@mail.gmail.com> 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 Oh, I guess you're using org-protocol, so your're going to have to do something a little different. But I hope my post gives you the idea of how to do it. On Sun, Mar 28, 2010 at 2:12 PM, Ryan Thompson wrote= : > 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" > =A0(make-frame-invisible sacframe t) > =A0(remember-other-frame) > =A0(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 wro= te: >> 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 = my >>> files. I have a backup, but I haven't gotten around to restoring everyt= hing >>> 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 activa= te) >> =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 = tutoie >> sempre uno zaino ...........| ..: |.... Je dis tu =E0 tous ceux que j'ai= me >> >> >> _______________________________________________ >> 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 >> >