emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Gregor Zattler <telegraph@gmx.net>
To: Drew Adams <drew.adams@oracle.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: automagically add/remove org mode buffers to agenda files list (was: Re: collect info from org files in agenda when open?)
Date: Tue, 23 Jul 2013 13:06:23 +0200	[thread overview]
Message-ID: <20130723110623.GE21141@boo.workgroup> (raw)
In-Reply-To: <c91c987e-d59b-449c-9685-fbfdb9e9b1fe@default>

Hi Drew, org-mode-community,
* Drew Adams <drew.adams@oracle.com> [14. Jul. 2013]:
>> (add-hook 'kill-buffer-hook 'org-remove-file)
>> 
>> But the last hook does not work as espected.  Instead it says
>> "Current buffer does not visit a file".  But according to the
>> documentation kill-buffer-hook is run before the buffer is
>> actually killed and the buffer is current when calling the hook.
>> Any ideas what I'm doing wrong?
> 
> I have no idea what `org-remove-file' does, but if it expects
> the current buffer to be visiting a file then that explains
> your problem.  `kill-buffer-hook' is run whenever ANY buffer is
> killed, not just a buffer visiting a file.  And Emacs uses lots
> of buffers that are not visiting files.
> 
> What you can do is use a different function, `foo', that first
> tests whether the current buffer is the kind of buffer you want
> to apply `org-remove-file' to, and if so invoke that, and if not
> do nothing.

Thanks, this helped.  

For the record: I wrote function which tests if the current
buffer is associated with a file and if it is in org-mode.  Iff
so I remove it from the list of agenda files.



Ciao, Gregor
-- 
 -... --- .-. . -.. ..--.. ...-.-

      reply	other threads:[~2013-07-23 11:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-12 22:16 collect info from org files in agenda when open? Gregor Zattler
2013-07-13  8:10 ` Noorul Islam K M
2013-07-13  8:33   ` Gregor Zattler
2013-07-13 15:09     ` Eric Abrahamsen
2013-07-14 14:11       ` automagically add/remove org mode buffers to agenda files list (was: Re: collect info from org files in agenda when open?) Gregor Zattler
2013-07-14 14:22         ` Drew Adams
2013-07-23 11:06           ` Gregor Zattler [this message]

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=20130723110623.GE21141@boo.workgroup \
    --to=telegraph@gmx.net \
    --cc=drew.adams@oracle.com \
    --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).