emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Temporarily setting agenda files list, cleaning up


From: Christoph Groth
Subject: Re: [O] Temporarily setting agenda files list, cleaning up
Date: Tue, 28 May 2019 17:12:03 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Many thanks to John and Thomas for their suggestions! 

Thomas Plass wrote:

> This will use a private set of 'org-agenda-files and kill their
> buffers after executing `org-agenda-list':
>
> (...)

This function is a very good prototype of what I had in mind.  The
details like it closing buffers that were already open before do not
matter for now.  (John's post offers a solution to this particular
problem.)  I replaced the call to org-agenda-list with one to
org-agenda, in order to get the full thing, and this works.

The prototype reveals a problem with the approach: if the buffers with
the agenda files are closed immediately (to avoid cluttering the buffer
list with possibly hundreds of buffers), most of the agenda
functionality no longer works.  It's not possible to jump to entries,
reschedule them, etc.

I guess that modifying orgmode so that agenda buffers open files as
needed would by rather complicated.  The simpler alternative should be
to keep the buffers open and only kill them when the associated agenda
buffer itself gets killed.

I suppose that this can be done by using kill-buffer-hook.  It seems
that the buffer killing can be made smarter by storing the
buffer-modified-tick at the time of the agenda construction for all the
buffers that are to be closed.  This information can then be used later
to only kill buffers that haven't been touched since.  Ideally, one
should also check whether it is still the *same* buffer, because it
might have been closed and reopened on purpose by the user.  (I have no
good idea how to check for that, other than storing opening times of org
buffers using some hook and using that.)

By the way, the function directory-files-recursively takes 1.5 s to
search my (huge) work directory for org files.  Using
shell-command-to-string to launch the 'find' shell command takes only
0.2 s.

Christoph

Attachment: signature.asc
Description: PGP signature


reply via email to

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