summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien <bzg@gnu.org>2020-01-29 22:12:55 +0100
committerBastien <bzg@gnu.org>2020-01-29 22:12:55 +0100
commit9fe7dbfd154397dbfddb1a562eefacedf3dc2532 (patch)
tree6c27cbbedb1e26d70121a5a1665e96b37c94ca9e
parenta7770e633318ea39063c22953152e880ff079d2e (diff)
downloadorg-mode-9fe7dbfd154397dbfddb1a562eefacedf3dc2532.tar.gz
org-agenda.el: Small `org-agenda-filter' enhancement
* lisp/org-agenda.el (org-agenda-filter): Use existing filters as the initial prompt input.
-rw-r--r--lisp/org-agenda.el10
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 0035df4..54b589e 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -7614,7 +7614,6 @@ consistency with the other filter commands."
(if keep current nil)))
(org-agenda-filter-apply org-agenda-effort-filter 'effort)))))
-
(defun org-agenda-filter (&optional strip-or-accumulate)
"Prompt for a general filter string and apply it to the agenda.
@@ -7665,11 +7664,18 @@ the variable `org-agenda-auto-exclude-function'."
(let* ((tag-list (org-agenda-get-represented-tags))
(category-list (org-agenda-get-represented-categories))
(negate (equal strip-or-accumulate '(4)))
+ (cf (mapconcat #'identity org-agenda-category-filter ""))
+ (tf (mapconcat #'identity org-agenda-tag-filter ""))
+ (rpl-fn (lambda (c) (replace-regexp-in-string "^\+" "" (or (car c) ""))))
+ (ef (replace-regexp-in-string "^\+" "" (or (car org-agenda-effort-filter) "")))
+ (rf (replace-regexp-in-string "^\+" "" (or (car org-agenda-regexp-filter) "")))
+ (ff (concat cf tf ef (when (not (equal rf "")) (concat "/" rf "/"))))
(f-string (completing-read
(concat
(if negate "Negative filter" "Filter")
" [+cat-tag<0:10-/regexp/]: ")
- 'org-agenda-filter-completion-function))
+ 'org-agenda-filter-completion-function
+ nil nil ff))
(keep (or (if (string-match "^\\+[+-]" f-string)
(progn (setq f-string (substring f-string 1)) t))
(equal strip-or-accumulate '(16))))