summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2011-02-09 08:55:58 +0100
committerCarsten Dominik <carsten.dominik@gmail.com>2011-02-09 09:04:04 +0100
commit09c5ff835973f4353d2022a4c746d60df4d7f0f0 (patch)
treed43e5700c3320feb59dfa2059630962e187b6c37
parentca220e9c40e4467f436a0a1501fb1fd730093cec (diff)
downloadorg-mode-09c5ff835973f4353d2022a4c746d60df4d7f0f0.tar.gz
Refresh agenda when updating the filter while the clock report is following
* lisp/org-agenda.el (org-agenda-filter-by-tag): Refresh agenda when updating the filter while the clock report is following the filter. When the clock table in the agenda has been set up to respect the current agenda tags filter, modifying the filter will now automatically rebuild the agenda to make sure that also the clock report is updated along with it. Updating the entire agenda is not strictly necessary - updating the table would be enough. However, right now we do not really have a function that will update only the clock table, as inserting the table is currently part of building the agenda itself. Maybe someone can optimize this in the future. This feature was requested by Sebastien Vauban.
-rw-r--r--lisp/org-agenda.el19
1 files changed, 12 insertions, 7 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index d146f83..2a13cf3 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3609,7 +3609,7 @@ given in `org-agenda-start-on-weekday'."
(when (and org-agenda-clockreport-mode clocktable-start)
(let ((org-agenda-files (org-agenda-files nil 'ifmode))
;; the above line is to ensure the restricted range!
- (p org-agenda-clockreport-parameter-plist)
+ (p (copy-sequence org-agenda-clockreport-parameter-plist))
tbl)
(setq p (org-plist-delete p :block))
(setq p (plist-put p :tstart clocktable-start))
@@ -3623,7 +3623,6 @@ given in `org-agenda-start-on-weekday'."
""
x))
filter ""))))
- (message "%s" (plist-get p :tags)) (sit-for 2)
(setq tbl (apply 'org-get-clocktable p))
(insert tbl)))
(goto-char (point-min))
@@ -5922,7 +5921,7 @@ to switch to narrowing."
(effort-prompt "")
(inhibit-read-only t)
(current org-agenda-filter)
- a n tag)
+ maybe-reftresh a n tag)
(unless char
(message
"%s by tag [%s ], [TAB], %s[/]:off, [+-]:narrow, [>=<?]:effort: "
@@ -5968,11 +5967,13 @@ to switch to narrowing."
(if modifier
(push modifier org-agenda-filter))))
(if (not (null org-agenda-filter))
- (org-agenda-filter-apply org-agenda-filter))))
+ (org-agenda-filter-apply org-agenda-filter)))
+ (setq maybe-reftresh t))
((equal char ?/)
(org-agenda-filter-by-tag-show-all)
(when (get 'org-agenda-filter :preset-filter)
- (org-agenda-filter-apply org-agenda-filter)))
+ (org-agenda-filter-apply org-agenda-filter))
+ (setq maybe-reftresh t))
((or (equal char ?\ )
(setq a (rassoc char alist))
(and (>= char ?0) (<= char ?9)
@@ -5988,8 +5989,12 @@ to switch to narrowing."
(setq org-agenda-filter
(cons (concat (if strip "-" "+") tag)
(if narrow current nil)))
- (org-agenda-filter-apply org-agenda-filter))
- (t (error "Invalid tag selection character %c" char)))))
+ (org-agenda-filter-apply org-agenda-filter)
+ (setq maybe-reftresh t))
+ (t (error "Invalid tag selection character %c" char)))
+ (when (and maybe-reftresh
+ (eq org-agenda-clockreport-mode 'with-filter))
+ (org-agenda-redo))))
(defun org-agenda-get-represented-tags ()
"Get a list of all tags currently represented in the agenda."