Преглед изворни кода

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.
Bastien Guerry пре 12 година
родитељ
комит
d621d2eac3
1 измењених фајлова са 11 додато и 5 уклоњено
  1. 11 5
      lisp/org-agenda.el

+ 11 - 5
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.