From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Groth Subject: Re: Temporarily setting agenda files list, cleaning up Date: Tue, 28 May 2019 17:12:03 +0200 Message-ID: <87woia396k.fsf@neron> References: <87v9xwf6iu.fsf@neron> <23788.12721.384364.291804@AGAME7.local> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:59169) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVdlx-00036f-01 for emacs-orgmode@gnu.org; Tue, 28 May 2019 11:12:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hVdlv-0000X4-2X for emacs-orgmode@gnu.org; Tue, 28 May 2019 11:12:16 -0400 Received: from mail6.webfaction.com ([31.170.123.134]:48830 helo=smtp.webfaction.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hVdlr-0000U4-Dv for emacs-orgmode@gnu.org; Tue, 28 May 2019 11:12:12 -0400 In-Reply-To: <23788.12721.384364.291804@AGAME7.local> (Thomas Plass's message of "Mon, 27 May 2019 20:51:29 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Thomas Plass , John Kitchin Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Many thanks to John and Thomas for their suggestions!=20 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 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEUimQV/rXmWU8TwiKw/FH9ZgPNTUFAlztT8MACgkQw/FH9ZgP NTU0IBAAvbxvB0yrOzP8dwWEr168wTZ/gyBxrFTPj3CEKN7pbD7snythozmpng3M KvjcXXWrv4XaD4OHIJNUFSd3AMVRrVKVmVhqPP5P/Frzu6mniR9w3F0ozzl8LGpm ZZ/LgXiERFB4K8q+4wXL6lNX63dixXdwEYXO219EKi9GHDFOk+QKlKVj08Z/eFlK Lu29JsMMh9PWEXuKttl9UAcrbw2jN5GaCA0GGH5cT5E/K88hXimiCd9qckhUNPQm TsdCKIIejmo8nwnnnpVT3jzK17WJ/Ol2UZTQdjW4pjG00Qr7CGbM25K034OXZSvv 6TF+339EwRgmzxvAYnjer4EUSukzWo64X0Djib0fJCPPuJzjAlb2/WMx0XOtVw2o z+1UWMe5T42esIitJ2wCP6QOnxZPx7A+hx59uBJb8TVi6LhAezV+4SQic2TwCbQt +7sEEgdLikk3Eyrym4i6FOdup+lFoDppCM/mGd+dh5P4yTn4hYcMEhdikDSlb0mV 7Y93+uRwQKoBETlP8nUxvsEMR8MC5+ly9oQOQqPpq2kCieG48HY6+z4hUm124141 HkVV62/iPsHZ6jy4Ey6js4hh7J0KQuMCGVwDDVXKhICaforj01qgb/3Cembh3m0R s/lMPGXo1VF55DuzO8zFI7G2w99Z65LsNc33Ao1J7g2z93uXU4U= =Q7ta -----END PGP SIGNATURE----- --=-=-=--