emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] automagically add/remove org mode buffers to agenda files list (


From: Drew Adams
Subject: Re: [O] 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)

> (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 via email to

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