summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Wahl <marcowahlsoft@gmail.com>2019-12-03 12:10:45 +0100
committerMarco Wahl <marcowahlsoft@gmail.com>2019-12-03 12:10:45 +0100
commitcb8183d3b710416fae0874345ad0ba24130bda30 (patch)
treeb00f1d4cae293a5d7ca31e34aaa2f2c5aadef7f9
parent0ce8d372b00fa18d19fbb4cb01eda37b8d887452 (diff)
downloadorg-mode-cb8183d3b710416fae0874345ad0ba24130bda30.tar.gz
agenda: Refactor a little
* lisp/org-agenda.el (org-agenda-filter-apply): Simplyfy some.
-rw-r--r--lisp/org-agenda.el43
1 files changed, 20 insertions, 23 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 090e632..a25016e 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -7992,29 +7992,26 @@ argument EXPAND can be used for the TYPE tag and will expand the
tags in the FILTER if any of the tags in FILTER are grouptags."
;; Deactivate `org-agenda-entry-text-mode' when filtering
(when org-agenda-entry-text-mode (org-agenda-entry-text-mode))
- (let (tags cat txt)
- (setq org-agenda-filter-form (org-agenda-filter-make-matcher
- filter type expand))
- ;; Only set `org-agenda-filtered-by-category' to t when a unique
- ;; category is used as the filter:
- (setq org-agenda-filtered-by-category
- (and (eq type 'category)
- (not (equal (substring (car filter) 0 1) "-"))))
- (org-agenda-set-mode-name)
- (save-excursion
- (goto-char (point-min))
- (while (not (eobp))
- (if (org-get-at-bol 'org-hd-marker)
- (progn
- (setq tags (org-get-at-bol 'tags)
- cat (org-agenda-get-category)
- txt (org-get-at-bol 'txt))
- (unless (eval org-agenda-filter-form)
- (org-agenda-filter-hide-line type))
- (beginning-of-line 2))
- (beginning-of-line 2))))
- (when (get-char-property (point) 'invisible)
- (ignore-errors (org-agenda-previous-line)))))
+ (setq org-agenda-filter-form (org-agenda-filter-make-matcher
+ filter type expand))
+ ;; Only set `org-agenda-filtered-by-category' to t when a unique
+ ;; category is used as the filter:
+ (setq org-agenda-filtered-by-category
+ (and (eq type 'category)
+ (not (equal (substring (car filter) 0 1) "-"))))
+ (org-agenda-set-mode-name)
+ (save-excursion
+ (goto-char (point-min))
+ (while (not (eobp))
+ (when (org-get-at-bol 'org-hd-marker)
+ (let ((tags (org-get-at-bol 'tags))
+ (cat (org-agenda-get-category))
+ (txt (org-get-at-bol 'txt)))
+ (unless (eval org-agenda-filter-form)
+ (org-agenda-filter-hide-line type))))
+ (beginning-of-line 2)))
+ (when (get-char-property (point) 'invisible)
+ (ignore-errors (org-agenda-previous-line))))
(defun org-agenda-filter-top-headline-apply (hl &optional negative)
"Filter by top headline HL."