emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Gregor Zattler <telegraph@gmx.net>,
	emacs-orgmode <emacs-orgmode@gnu.org>,
	help-gnu-emacs@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: Sun, 14 Jul 2013 07:22:18 -0700 (PDT)	[thread overview]
Message-ID: <c91c987e-d59b-449c-9685-fbfdb9e9b1fe@default> (raw)
In-Reply-To: <20130714141134.GA31324@boo.workgroup>

> (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.

  reply	other threads:[~2013-07-14 14:22 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 [this message]
2013-07-23 11:06           ` Gregor Zattler

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=c91c987e-d59b-449c-9685-fbfdb9e9b1fe@default \
    --to=drew.adams@oracle.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    --cc=telegraph@gmx.net \
    /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).