Browse Source

Merge branch 'maint' into master

Kyle Meyer 4 years ago
parent
commit
16f505db22
2 changed files with 12 additions and 3 deletions
  1. 4 2
      lisp/org.el
  2. 8 1
      testing/lisp/test-org.el

+ 4 - 2
lisp/org.el

@@ -11703,7 +11703,7 @@ See also `org-scan-tags'."
       (cons match0 `(lambda (todo tags-list level) ,matcher)))))
 
 (defun org--tags-expand-group (group tag-groups expanded)
-  "Recursively Expand all tags in GROUP, according to TAG-GROUPS.
+  "Recursively expand all tags in GROUP, according to TAG-GROUPS.
 TAG-GROUPS is the list of groups used for expansion.  EXPANDED is
 an accumulator used in recursive calls."
   (dolist (tag group)
@@ -11751,7 +11751,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)

+ 8 - 1
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