From 89cdbda63e292806d681f87fdba90399a0c09df2 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Tue, 28 Aug 2012 13:02:01 +0200 Subject: [PATCH] org-agenda.el: Use the current command's match to set the buffer name * org-agenda.el (org-agenda): In sticky agendas, use the current command's match to set the buffer name. This gives more information to the user and allows to distinguish various agendas triggered by the same key. (org-batch-store-agenda-views): Handle the new sticky agenda buffer name. --- lisp/org-agenda.el | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index ff4aa842b..2025fe939 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -2460,11 +2460,6 @@ Pressing `<' twice means to restrict to the current subtree or region (setq ans (org-agenda-get-restriction-and-command prefix-descriptions) keys (car ans) restriction (cdr ans))) - ;; If we have sticky agenda buffers, set a name for the buffer, - ;; depending on the invoking keys. The user may still set this - ;; as a command option, which will overwrite what we do here. - (if org-agenda-sticky - (setq org-agenda-buffer-name (format "*Org Agenda(%s)*" keys))) ;; Establish the restriction, if any (when (and (not org-agenda-overriding-restriction) restriction) (put 'org-agenda-files 'org-restrict (list bfn)) @@ -2488,6 +2483,13 @@ Pressing `<' twice means to restrict to the current subtree or region (progn (setq type (nth 2 entry) match (eval (nth 3 entry)) lprops (nth 4 entry)) + ;; If we have sticky agenda buffers, set a name for the buffer, + ;; depending on the invoking keys. The user may still set this + ;; as a command option, which will overwrite what we do here. + (if org-agenda-sticky + (setq org-agenda-buffer-name + (or (and (stringp match) (format "*Org Agenda(%s:%s)*" keys match)) + (format "*Org Agenda(%s)*" keys)))) (put 'org-agenda-redo-command 'org-lprops lprops) (cond ((eq type 'agenda) @@ -2962,12 +2964,17 @@ This ensures the export commands can easily use it." (pop-up-frames nil) (dir default-directory) (pars (org-make-parameter-alist parameters)) - cmd thiscmdkey files opts cmd-or-set bufname) + cmd thiscmdkey thiscmdcmd files opts cmd-or-set bufname) (save-window-excursion (while cmds (setq cmd (pop cmds) thiscmdkey (car cmd) - bufname (if org-agenda-sticky (format "*Org Agenda(%s)*" thiscmdkey) + thiscmdcmd (cdr cmd) + match (nth 2 thiscmdcmd) + bufname (if org-agenda-sticky + (or (and (stringp match) + (format "*Org Agenda(%s:%s)*" thiscmdkey match)) + (format "*Org Agenda(%s)*" thiscmdkey)) org-agenda-buffer-name) cmd-or-set (nth 2 cmd) opts (nth (if (listp cmd-or-set) 3 4) cmd) -- 2.11.4.GIT