summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2012-08-28 13:02:01 +0200
committerBastien Guerry <bzg@altern.org>2012-08-28 13:02:01 +0200
commit89cdbda63e292806d681f87fdba90399a0c09df2 (patch)
tree2810b5c2c444dd8a4133baabb7324e6d4a388e88
parent9c2b17bac3d3dccfa37c4ae83097faebbdd0f285 (diff)
downloadorg-mode-89cdbda63e292806d681f87fdba90399a0c09df2.tar.gz
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.
-rw-r--r--lisp/org-agenda.el21
1 files changed, 14 insertions, 7 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index ff4aa84..2025fe9 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)