From d03aa078723a1e30b7238ab76aee673032e8d453 Mon Sep 17 00:00:00 2001 From: Konstantin Kliakhandler Date: Tue, 6 May 2014 21:04:20 +0300 Subject: [PATCH] Fixed bad behavior of org-agenda-redo and org-batch-store-agenda-views. --- lisp/ChangeLog | 5 +++++ lisp/org-agenda.el | 34 ++++++++++++++++++++-------------- 2 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 lisp/ChangeLog diff --git a/lisp/ChangeLog b/lisp/ChangeLog new file mode 100644 index 0000000..9534e13 --- /dev/null +++ b/lisp/ChangeLog @@ -0,0 +1,5 @@ +2014-05-06 Konstantin Kliakhandler + + * org-agenda.el + (org-agenda-redo): Making sure to feed `org-agenda-filter-apply' with the appropriate value. + (org-batch-store-agenda-views): Restoring the original `org-agenda-category-filter' value after constructing the exported agendas. diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 576d5b9..134af00 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -3282,17 +3282,20 @@ This ensures the export commands can easily use it." opts (nth (if (listp cmd-or-set) 3 4) cmd) files (nth (if (listp cmd-or-set) 4 5) cmd)) (if (stringp files) (setq files (list files))) - (when files - (org-eval-in-environment (append org-agenda-exporter-settings - opts pars) - (org-agenda nil thiscmdkey)) - (set-buffer bufname) - (while files - (org-eval-in-environment (append org-agenda-exporter-settings - opts pars) - (org-agenda-write (expand-file-name (pop files) dir) nil t bufname))) - (and (get-buffer bufname) - (kill-buffer bufname))))))) + (let ((org-agenda-category-filter-plist (copy-sequence (symbol-plist 'org-agenda-category-filter)))) + (unwind-protect + (when files + (org-eval-in-environment (append org-agenda-exporter-settings + opts pars) + (org-agenda nil thiscmdkey)) + (set-buffer bufname) + (while files + (org-eval-in-environment (append org-agenda-exporter-settings + opts pars) + (org-agenda-write (expand-file-name (pop files) dir) nil t bufname))) + (and (get-buffer bufname) + (kill-buffer bufname))) + (setplist 'org-agenda-category-filter org-agenda-category-filter-plist))))))) (defvar org-agenda-current-span nil "The current span used in the agenda view.") ; local variable in the agenda buffer @@ -7325,9 +7328,12 @@ in the agenda." (put 'org-agenda-tag-filter :preset-filter tag-preset) (put 'org-agenda-category-filter :preset-filter cat-preset) (put 'org-agenda-regexp-filter :preset-filter re-preset) - (and (or tag-filter tag-preset) (org-agenda-filter-apply tag-filter 'tag)) - (and (or cat-filter cat-preset) (org-agenda-filter-apply cat-filter 'category)) - (and (or re-filter re-preset) (org-agenda-filter-apply re-filter 'regexp)) + (let ((tag (or tag-filter tag-preset)) + (cat (or cat-filter cat-preset)) + (re (or re-filter re-preset))) + (when tag (org-agenda-filter-apply tag 'tag)) + (when cat (org-agenda-filter-apply cat 'category)) + (when re (org-agenda-filter-apply re 'regexp))) (and top-hl-filter (org-agenda-filter-top-headline-apply top-hl-filter)) (and cols (org-called-interactively-p 'any) (org-agenda-columns)) (org-goto-line line) -- 1.8.5.3