summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2020-09-27 23:56:32 -0400
committerKyle Meyer <kyle@kyleam.com>2020-09-28 00:04:53 -0400
commit6676a97d27d0b9ab90d842c90a119d00bff44ad6 (patch)
tree3d95f0a4a76553a0bffe62484eb234ea5820fdc5
parentf8ae0cd6b729db47450d746cf17f2ce9e949d38d (diff)
downloadorg-mode-6676a97d27d0b9ab90d842c90a119d00bff44ad6.tar.gz
org-tags-expand: Fix handling of downcased group tags
* lisp/org.el (org-tags-expand): Support using an upper- or mix-case tag as MATCH when SINGLE-AS-LIST and DOWNCASED are non-nil, fixing a regression from v9.2. * testing/lisp/test-org.el (test-org/tags-expand): Add test. org-agenda-filter-by-tag reads a case-sensitive tag from the user, and downstream code passes this tag as is to org-tags-expand along with non-nil values for SINGLE-AS-LIST and DOWNCASED. As of 9df82be07 (Fix tag groups expansion as a regexp, 2018-11-08), org-tags-expand fails to return the group tags in this scenario for queries that contains an uppercase letter, breaking org-agenda-filter-by-tag. Downcase MATCH if SINGLE-AS-LIST and DOWNCASED are non-nil. Reported-by: Leon Weber <leon.weber@net2.ch> Ref: https://orgmode.org/list/c1f8cc32-dc16-697c-c24d-e5e05124bd66@net2.ch
-rw-r--r--lisp/org.el4
-rw-r--r--testing/lisp/test-org.el9
2 files changed, 11 insertions, 2 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 693e406..5a8e618 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11742,7 +11742,9 @@ When DOWNCASED is non-nil, expand downcased TAGS."
(if (not downcased) g
(mapcar (lambda (s) (mapcar #'downcase s)) g)))))
(cond
- (single-as-list (org--tags-expand-group (list match) tag-groups nil))
+ (single-as-list (org--tags-expand-group
+ (list (if downcased (downcase match) match))
+ tag-groups nil))
(org-group-tags
(let* ((case-fold-search t)
(tag-syntax org-mode-syntax-table)
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 38bab1a..edd1efd 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -7106,7 +7106,14 @@ Paragraph<point>"
(equal "{A+}"
(org-test-with-temp-text "#+TAGS: [ A : B C ]"
(org-mode-restart)
- (let ((org-tag-alist-for-agenda nil)) (org-tags-expand "{A+}"))))))
+ (let ((org-tag-alist-for-agenda nil)) (org-tags-expand "{A+}")))))
+ ;; Uppercase MATCH works with a non-nil DOWNCASED and SINGLE-AS-LIST.
+ (should
+ (equal (list "a" "b" "c")
+ (org-test-with-temp-text "#+TAGS: [ A : B C ]"
+ (org-mode-restart)
+ (let ((org-tag-alist-for-agenda nil))
+ (sort (org-tags-expand "A" t t) #'string-lessp))))))
;;; TODO keywords