emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christoph Groth <christoph@grothesque.org>
To: Thomas Plass <thunk2@arcor.de>, John Kitchin <jkitchin@andrew.cmu.edu>
Cc: emacs-orgmode@gnu.org
Subject: Re: Temporarily setting agenda files list, cleaning up
Date: Tue, 28 May 2019 17:12:03 +0200	[thread overview]
Message-ID: <87woia396k.fsf@neron> (raw)
In-Reply-To: <23788.12721.384364.291804@AGAME7.local> (Thomas Plass's message of "Mon, 27 May 2019 20:51:29 +0200")

[-- Attachment #1: Type: text/plain, Size: 1906 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

      reply	other threads:[~2019-05-28 15:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-27 12:04 Temporarily setting agenda files list, cleaning up Christoph Groth
2019-05-27 12:46 ` John Kitchin
2019-05-27 18:51 ` Thomas Plass
2019-05-28 15:12   ` Christoph Groth [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=87woia396k.fsf@neron \
    --to=christoph@grothesque.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=jkitchin@andrew.cmu.edu \
    --cc=thunk2@arcor.de \
    /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).