emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Stefano Zacchiroli <zack@upsilon.cc>
To: emacs-orgmode@gnu.org
Subject: Re: org-remember-AFTER-finalize-hook , anyone?
Date: Sun, 31 Jan 2010 00:45:01 +0100	[thread overview]
Message-ID: <20100130234501.GA16336@usha.takhisis.invalid> (raw)
In-Reply-To: <2a4ba2fd1001301023g6ab70661l529733de212f2b64@mail.gmail.com>

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
zack@{upsilon.cc,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

  reply	other threads:[~2010-01-30 23:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-30 16:54 org-remember-AFTER-finalize-hook , anyone? Stefano Zacchiroli
2010-01-30 18:23 ` Ryan Thompson
2010-01-30 23:45   ` Stefano Zacchiroli [this message]
2010-03-28 21:12     ` Ryan Thompson
2010-03-28 21:13       ` Ryan Thompson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100130234501.GA16336@usha.takhisis.invalid \
    --to=zack@upsilon.cc \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).