emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] org-remember-AFTER-finalize-hook , anyone?


From: Ryan Thompson
Subject: Re: [Orgmode] org-remember-AFTER-finalize-hook , anyone?
Date: Sun, 28 Mar 2010 14:13:21 -0700

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 <address@hidden> 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"
>  (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 <address@hidden> 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 my
>>> files. I have a backup, but I haven't gotten around to restoring everything
>>> yet. I'll get back to you later.
>>
>> In the meantime, I've implemented a workaround, based on the following
>> idea:
>>
>>  (add-hook 'org-remember-mode-hook 'delete-other-windows)
>>  (defadvice org-remember-finalize (after delete-frame-at-end activate)
>>    "Delete frame at remember finalization"
>>    (delete-frame))
>>  (defadvice org-remember-kill (after delete-frame-at-end activate)
>>    "Delete frame at remember abort"
>>    (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):
>>
>>  (add-hook 'org-remember-mode-hook 'delete-other-windows)
>>  (setq my-org-protocol-flag nil)
>>  (defadvice org-remember-finalize (after delete-frame-at-end activate)
>>    "Delete frame at remember finalization"
>>    (progn
>>      (if my-org-protocol-flag (delete-frame))
>>      (setq my-org-protocol-flag nil)))
>>  (defadvice org-remember-kill (after delete-frame-at-end activate)
>>    "Delete frame at remember abort"
>>    (progn
>>      (if my-org-protocol-flag (delete-frame))
>>      (setq my-org-protocol-flag nil)))
>>  (defadvice org-protocol-remember (before set-org-protocol-flag activate)
>>    (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
>> address@hidden,pps.jussieu.fr,debian.org} -<>- http://upsilon.cc/zack/
>> Dietro un grande uomo c'è ..|  .  |. Et ne m'en veux pas si je te tutoie
>> sempre uno zaino ...........| ..: |.... Je dis tu à tous ceux que j'aime
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> address@hidden
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]