Make pressing `_' twice in agenda remove the effort filter
* lisp/org-agenda.el (org-agenda-filter-by-effort): Pressing `_' again will remove the effort filter. This aligns the command with the tags filter.
This commit is contained in:
parent
8dfe826a0b
commit
8c011126b5
|
@ -7537,27 +7537,31 @@ With two prefix arguments, remove the effort filters."
|
||||||
(mapcar (lambda (n) (mod n 10)) ;turn 10 into 0
|
(mapcar (lambda (n) (mod n 10)) ;turn 10 into 0
|
||||||
(number-sequence 1 (length efforts)))))
|
(number-sequence 1 (length efforts)))))
|
||||||
(op nil))
|
(op nil))
|
||||||
(while (not (memq op '(?< ?> ?=)))
|
(while (not (memq op '(?< ?> ?= ?_)))
|
||||||
(setq op (read-char-exclusive "Effort operator? (> = or <)")))
|
(setq op (read-char-exclusive "Effort operator? (> = or <) or press `_' again to remove filter")))
|
||||||
;; Select appropriate duration. Ignore non-digit characters.
|
;; Select appropriate duration. Ignore non-digit characters.
|
||||||
(let ((prompt
|
(if (eq op ?_)
|
||||||
(apply #'format
|
(progn
|
||||||
(concat "Effort %c "
|
(org-agenda-filter-show-all-effort)
|
||||||
(mapconcat (lambda (s) (concat "[%d]" s))
|
(message "Effort filter removed"))
|
||||||
efforts
|
(let ((prompt
|
||||||
" "))
|
(apply #'format
|
||||||
op allowed-keys))
|
(concat "Effort %c "
|
||||||
(eff -1))
|
(mapconcat (lambda (s) (concat "[%d]" s))
|
||||||
(while (not (memq eff allowed-keys))
|
efforts
|
||||||
(message prompt)
|
" "))
|
||||||
(setq eff (- (read-char-exclusive) 48)))
|
op allowed-keys))
|
||||||
(setq org-agenda-effort-filter
|
(eff -1))
|
||||||
(list (concat (if strip "-" "+")
|
(while (not (memq eff allowed-keys))
|
||||||
(char-to-string op)
|
(message prompt)
|
||||||
;; Numbering is 1 2 3 ... 9 0, but we want
|
(setq eff (- (read-char-exclusive) 48)))
|
||||||
;; 0 1 2 ... 8 9.
|
(setq org-agenda-effort-filter
|
||||||
(nth (mod (1- eff) 10) efforts)))))
|
(list (concat (if strip "-" "+")
|
||||||
(org-agenda-filter-apply org-agenda-effort-filter 'effort)))
|
(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)
|
(t (org-agenda-filter-show-all-effort)
|
||||||
(message "Effort filter removed"))))
|
(message "Effort filter removed"))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue