From f1191b86e377538b58f94fba79075621b5858803 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sun, 6 Jan 2013 09:11:08 +0100 Subject: [PATCH 1/4] org-agenda.el (org-agenda-finalize): Only mark clocking task when there is one * org-agenda.el (org-agenda-finalize): Only mark clocking task when there is one. --- lisp/org-agenda.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 03bb69e9f..a3bf996ea 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -3538,9 +3538,10 @@ generating a new one." (org-agenda-dim-blocked-tasks)) ;; We need to widen when `org-agenda-finalize' is called from ;; `org-agenda-change-all-lines' (e.g. in `org-agenda-clock-in') - (save-restriction - (widen) - (org-agenda-mark-clocking-task)) + (when org-clock-current-task + (save-restriction + (widen) + (org-agenda-mark-clocking-task))) (when org-agenda-entry-text-mode (org-agenda-entry-text-hide) (org-agenda-entry-text-show)) From cd00d36ca2872b746a8ee1e749658eda0aa8711a Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sun, 6 Jan 2013 09:14:54 +0100 Subject: [PATCH 2/4] org-agenda.el (org-agenda-finalize): Only try to draw the habit consistency graph when there is a habit in the buffer * org-agenda.el (org-agenda-finalize): Only try to draw the habit consistency graph when there is a habit in the buffer. --- lisp/org-agenda.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index a3bf996ea..a9e7a7a6a 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -3545,7 +3545,8 @@ generating a new one." (when org-agenda-entry-text-mode (org-agenda-entry-text-hide) (org-agenda-entry-text-show)) - (if (functionp 'org-habit-insert-consistency-graphs) + (if (and (functionp 'org-habit-insert-consistency-graphs) + (save-excursion (next-single-property-change (point-min) 'org-habit-p))) (org-habit-insert-consistency-graphs)) (let ((inhibit-read-only t)) (run-hooks 'org-agenda-finalize-hook)) From 806a141f1e39b4f8523cdfa0b0cebccc30491552 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sun, 6 Jan 2013 09:20:30 +0100 Subject: [PATCH 3/4] org-agenda.el (org-agenda-finalize): Don't try to align tags when there are no tags * org-agenda.el (org-agenda-finalize): Don't try to align tags when there are no tags. --- lisp/org-agenda.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index a9e7a7a6a..2468a9b0d 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -3522,7 +3522,9 @@ generating a new one." (while (org-activate-plain-links (point-max)) (add-text-properties (match-beginning 0) (match-end 0) '(face org-link)))) - (org-agenda-align-tags) + (when (cadr (assoc 'org-prefix-has-tag + (car org-prefix-format-compiled))) + (org-agenda-align-tags)) (unless org-agenda-with-colors (remove-text-properties (point-min) (point-max) '(face nil)))) (if (and (boundp 'org-agenda-overriding-columns-format) From d621d2eac37b1e63fa9612075666733b8d37ed97 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sun, 6 Jan 2013 12:31:20 +0100 Subject: [PATCH 4/4] New default value nil for `org-agenda-dim-blocked-tasks' * org-agenda.el (org-agenda-dim-blocked-tasks): Default to nil. (org-agenda-dim-blocked-tasks): Make interactive and allow an optional parameter 'invisible to hide blocked tasks instead of just dimming them. (org-agenda-mode-map): Bind `org-agenda-dim-blocked-tasks' to "#". With a default value of t for `org-agenda-dim-blocked-tasks', any non-nil value for `org-enforce-todo-checkbox-dependencies' or `org-enforce-todo-dependencies' (or both) will slow down the agenda generation too much, which might surprise the user. --- lisp/org-agenda.el | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 2468a9b0d..1b2337cd1 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -840,7 +840,7 @@ entry, the rest of the entry will not be searched." :group 'org-agenda-daily/weekly :type 'boolean) -(defcustom org-agenda-dim-blocked-tasks t +(defcustom org-agenda-dim-blocked-tasks nil "Non-nil means dim blocked tasks in the agenda display. This causes some overhead during agenda construction, but if you have turned on `org-enforce-todo-dependencies', @@ -857,6 +857,7 @@ that is blocked because of checkboxes will never be made invisible, it will only be dimmed." :group 'org-agenda-daily/weekly :group 'org-agenda-todo-list + :version "24.3" :type '(choice (const :tag "Do not dim" nil) (const :tag "Dim to a gray face" t) @@ -2012,6 +2013,7 @@ The following commands are available: (org-defkey org-agenda-mode-map "\C-c\C-w" 'org-agenda-refile) (org-defkey org-agenda-mode-map "m" 'org-agenda-bulk-mark) (org-defkey org-agenda-mode-map "*" 'org-agenda-bulk-mark-all) +(org-defkey org-agenda-mode-map "#" 'org-agenda-dim-blocked-tasks) (org-defkey org-agenda-mode-map "%" 'org-agenda-bulk-mark-regexp) (org-defkey org-agenda-mode-map "u" 'org-agenda-bulk-unmark) (org-defkey org-agenda-mode-map "U" 'org-agenda-bulk-unmark-all) @@ -3537,7 +3539,7 @@ generating a new one." (when org-agenda-fontify-priorities (org-agenda-fontify-priorities)) (when (and org-agenda-dim-blocked-tasks org-blocker-hook) - (org-agenda-dim-blocked-tasks)) + (org-agenda-dim-blocked-tasks)) ;; We need to widen when `org-agenda-finalize' is called from ;; `org-agenda-change-all-lines' (e.g. in `org-agenda-clock-in') (when org-clock-current-task @@ -3613,15 +3615,18 @@ generating a new one." ((equal p h) 'bold))) (overlay-put ov 'org-type 'org-priority))))) -(defun org-agenda-dim-blocked-tasks () +(defun org-agenda-dim-blocked-tasks (&optional invisible) + (interactive "P") "Dim currently blocked TODO's in the agenda display." + (message "Dim or hide blocked tasks...") (mapc (lambda (o) (if (eq (overlay-get o 'org-type) 'org-blocked-todo) (delete-overlay o))) (overlays-in (point-min) (point-max))) (save-excursion (let ((inhibit-read-only t) (org-depend-tag-blocked nil) - (invis (eq org-agenda-dim-blocked-tasks 'invisible)) + (invis (or (not (null invisible)) + (eq org-agenda-dim-blocked-tasks 'invisible))) org-blocked-by-checkboxes invis1 b e p ov h l) (goto-char (point-min)) @@ -3642,7 +3647,8 @@ generating a new one." (if invis1 (overlay-put ov 'invisible t) (overlay-put ov 'face 'org-agenda-dimmed-todo-face)) - (overlay-put ov 'org-type 'org-blocked-todo))))))) + (overlay-put ov 'org-type 'org-blocked-todo)))))) + (message "Dim or hide blocked tasks...done")) (defvar org-agenda-skip-function nil "Function to be called at each match during agenda construction.