From mboxrd@z Thu Jan 1 00:00:00 1970 From: thunk2@arcor.de (Thomas Plass) Subject: Re: Temporarily setting agenda files list, cleaning up Date: Mon, 27 May 2019 20:51:29 +0200 Message-ID: <23788.12721.384364.291804@AGAME7.local> References: <87v9xwf6iu.fsf@neron> Reply-To: Thomas Plass Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([209.51.188.92]:38665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVKil-0007Lt-O4 for emacs-orgmode@gnu.org; Mon, 27 May 2019 14:51:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hVKik-0006KJ-UC for emacs-orgmode@gnu.org; Mon, 27 May 2019 14:51:43 -0400 Received: from mx009.vodafonemail.xion.oxcs.net ([153.92.174.39]:28319) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hVKik-0006CZ-Os for emacs-orgmode@gnu.org; Mon, 27 May 2019 14:51:42 -0400 In-Reply-To: Your message of Monday, May 27 2019 14:04:09 (ID: <87v9xwf6iu.fsf@neron>). 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: Christoph Groth Cc: emacs-orgmode@gnu.org Christoph Groth wrote at 14:04 on May 27, 2019: : Instead, I imagine a custom Emacs command to launch an agenda with : org-agenda-files that is temporarily set to a list of files that depends : on the current context. For starters, this list could contain all the : org files under the current directory: This will use a private set of 'org-agenda-files and kill their buffers after executing `org-agenda-list': (defun Groth/agenda-list (&optional dir) (interactive) (let* ((project-dir (or dir default-directory)) (org-agenda-files (directory-files-recursively project-dir "\\.org$")) tmp-agenda-buffer) (unwind-protect ;; FIXME: set org-agenda-list args as necessary: &optional ARG START-DAY SPAN WITH-HOUR) (org-agenda-list) (mapc (lambda (f) (and (setq tmp-agenda-buffer (find-buffer-visiting f)) (kill-buffer tmp-agenda-buffer))) org-agenda-files)))) Call it like this: M-x Groth/agenda-list or eval (Groth/agenda-list "/path/to/dir") I just whipped this up and it might need improvements such as optional prompting for a search directory and a set of arguments to `org-agenda-list' that fit your needs (refer to its docstring). Note that buffers for files on the old value of 'org-agenda-files that are already open will be killed, too. Regards Thomas