فهرست منبع

Merge branch 'maint'

Nicolas Goaziou 8 سال پیش
والد
کامیت
d82d309095
2فایلهای تغییر یافته به همراه55 افزوده شده و 41 حذف شده
  1. 20 16
      doc/org.texi
  2. 35 25
      lisp/org-agenda.el

+ 20 - 16
doc/org.texi

@@ -8637,8 +8637,10 @@ selected.
 Filter the current agenda view with respect to the category of the item at
 Filter the current agenda view with respect to the category of the item at
 point.  Pressing @code{<} another time will remove this filter.  When called
 point.  Pressing @code{<} another time will remove this filter.  When called
 with a prefix argument exclude the category of the item at point from the
 with a prefix argument exclude the category of the item at point from the
-agenda.  You can add a filter preset through the option
-@code{org-agenda-category-filter-preset} (see below.)
+agenda.
+
+You can add a filter preset in custom agenda commands through the option
+@code{org-agenda-category-filter-preset}.  @xref{Setting options}.
 
 
 @orgcmd{^,org-agenda-filter-by-top-headline}
 @orgcmd{^,org-agenda-filter-by-top-headline}
 Filter the current agenda view and only display the siblings and the parent
 Filter the current agenda view and only display the siblings and the parent
@@ -8651,8 +8653,10 @@ Filter the agenda view by a regular expression: only show agenda entries
 matching the regular expression the user entered.  When called with a prefix
 matching the regular expression the user entered.  When called with a prefix
 argument, it will filter @emph{out} entries matching the regexp.  With two
 argument, it will filter @emph{out} entries matching the regexp.  With two
 universal prefix arguments, it will remove all the regexp filters, which can
 universal prefix arguments, it will remove all the regexp filters, which can
-be accumulated.  You can add a filter preset through the option
-@code{org-agenda-category-filter-preset} (see below.)
+be accumulated.
+
+You can add a filter preset in custom agenda commands through the option
+@code{org-agenda-regexp-filter-preset}.  @xref{Setting options}.
 
 
 @orgcmd{_,org-agenda-filter-by-effort}
 @orgcmd{_,org-agenda-filter-by-effort}
 @vindex org-agenda-effort-filter-preset
 @vindex org-agenda-effort-filter-preset
@@ -8671,6 +8675,13 @@ or larger-or-equal than the selected value.  For application of the operator,
 entries without a defined effort will be treated according to the value of
 entries without a defined effort will be treated according to the value of
 @code{org-sort-agenda-noeffort-is-high}.
 @code{org-sort-agenda-noeffort-is-high}.
 
 
+When called with a prefix argument, it will remove entries matching the
+condition.  With two universal prefix arguments, it will clear effort
+filters, which can be accumulated.
+
+You can add a filter preset in custom agenda commands through the option
+@code{org-agenda-effort-filter-preset}.  @xref{Setting options}.
+
 @orgcmd{|,org-agenda-filter-remove-all}
 @orgcmd{|,org-agenda-filter-remove-all}
 Remove all filters in the current agenda view.
 Remove all filters in the current agenda view.
 @end table
 @end table
@@ -8921,32 +8932,25 @@ file or subtree (@pxref{Agenda files}).
 
 
 @tsubheading{Secondary filtering and query editing}
 @tsubheading{Secondary filtering and query editing}
 
 
-For a detailed description of these commands, see @pxref{Filtering/limiting
+For a detailed description of these commands, @pxref{Filtering/limiting
 agenda items}.
 agenda items}.
 
 
 @orgcmd{/,org-agenda-filter-by-tag}
 @orgcmd{/,org-agenda-filter-by-tag}
-@vindex org-agenda-tag-filter-preset
 Filter the agenda view with respect to a tag and/or effort estimates.
 Filter the agenda view with respect to a tag and/or effort estimates.
 
 
 @orgcmd{<,org-agenda-filter-by-category}
 @orgcmd{<,org-agenda-filter-by-category}
-@vindex org-agenda-category-filter-preset
-
 Filter the current agenda view with respect to the category of the item at
 Filter the current agenda view with respect to the category of the item at
-point.  Pressing @code{<} another time will remove this filter.
+point.
 
 
 @orgcmd{^,org-agenda-filter-by-top-headline}
 @orgcmd{^,org-agenda-filter-by-top-headline}
 Filter the current agenda view and only display the siblings and the parent
 Filter the current agenda view and only display the siblings and the parent
 headline of the one at point.
 headline of the one at point.
 
 
 @orgcmd{=,org-agenda-filter-by-regexp}
 @orgcmd{=,org-agenda-filter-by-regexp}
-@vindex org-agenda-regexp-filter-preset
+Filter the agenda view by a regular expression.
 
 
-Filter the agenda view by a regular expression: only show agenda entries
-matching the regular expression the user entered.  When called with a prefix
-argument, it will filter @emph{out} entries matching the regexp.  With two
-universal prefix arguments, it will remove all the regexp filters, which can
-be accumulated.  You can add a filter preset through the option
-@code{org-agenda-category-filter-preset} (see below.)
+@orgcmd{_,org-agenda-filter-by-effort}
+Filter the agenda view with respect to effort estimates.
 
 
 @orgcmd{|,org-agenda-filter-remove-all}
 @orgcmd{|,org-agenda-filter-remove-all}
 Remove all filters in the current agenda view.
 Remove all filters in the current agenda view.

+ 35 - 25
lisp/org-agenda.el

@@ -7340,31 +7340,41 @@ With no prefix argument, keep entries matching the effort condition.
 With one prefix argument, filter out entries matching the condition.
 With one prefix argument, filter out entries matching the condition.
 With two prefix arguments, remove the effort filters."
 With two prefix arguments, remove the effort filters."
   (interactive "P")
   (interactive "P")
-  (cond ((member strip '(nil 4))
-	 (let ((efforts (org-split-string
-			 (or (cdr (assoc (concat org-effort-property "_ALL")
-					 org-global-properties))
-			     "0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00 8:00"
-			     "")))
-	       (eff -1)
-	       effort-prompt op)
-	   (while (not (member op '(?< ?> ?=)))
-	     (setq op (read-char-exclusive "Effort operator? (> = or <)")))
-	   (cl-loop for i from 0 to 9 do
-		    (setq effort-prompt
-			  (concat
-			   effort-prompt " ["
-			   (if (= i 9) "0" (int-to-string (1+ i)))
-			   "]" (nth i efforts))))
-	   (message "Effort %s%s" (char-to-string op) effort-prompt)
-	   (while (or (< eff 0) (> eff 9))
-	     (setq eff (string-to-number (char-to-string (read-char-exclusive)))))
-	   (setq org-agenda-effort-filter
-		 (list (concat (if strip "-" "+")
-			       (char-to-string op) (nth (1- eff) efforts))))
-	   (org-agenda-filter-apply org-agenda-effort-filter 'effort)))
-	(t (org-agenda-filter-show-all-effort)
-	   (message "Effort filter removed"))))
+  (cond
+   ((member strip '(nil 4))
+    (let* ((efforts (split-string
+		     (or (cdr (assoc (concat org-effort-property "_ALL")
+				     org-global-properties))
+			 "0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00")))
+	   ;; XXX: the following handles only up to 10 different
+	   ;; effort values.
+	   (allowed-keys (if (null efforts) nil
+			   (mapcar (lambda (n) (mod n 10)) ;turn 10 into 0
+				   (number-sequence 1 (length efforts)))))
+	   (op nil))
+      (while (not (memq op '(?< ?> ?=)))
+	(setq op (read-char-exclusive "Effort operator? (> = or <)")))
+      ;; Select appropriate duration.  Ignore non-digit characters.
+      (let ((prompt
+	     (apply #'format
+		    (concat "Effort %c "
+			    (mapconcat (lambda (s) (concat "[%d]" s))
+				       efforts
+				       " "))
+		    op allowed-keys))
+	    (eff -1))
+	(while (not (memq eff allowed-keys))
+	  (message prompt)
+	  (setq eff (- (read-char-exclusive) 48)))
+	(setq org-agenda-effort-filter
+	      (list (concat (if strip "-" "+")
+			    (char-to-string op)
+			    ;; Numbering is 1 2 3 ... 9 0, but we want
+			    ;; 0 1 2 ... 8 9.
+			    (nth (mod (1- eff) 10) efforts)))))
+      (org-agenda-filter-apply org-agenda-effort-filter 'effort)))
+   (t (org-agenda-filter-show-all-effort)
+      (message "Effort filter removed"))))
 
 
 (defun org-agenda-filter-remove-all ()
 (defun org-agenda-filter-remove-all ()
   "Remove all filters from the current agenda buffer."
   "Remove all filters from the current agenda buffer."