Browse Source

ox: Fix "wrong type argument listp" when filtering tags

* lisp/org.el (org--setup-process-tags): Fill `org-tag-groups-alist'
  only when group tags are defined.

Reported-by: Elric Milon <emacs@whirm.eu>
<http://permalink.gmane.org/gmane.emacs.orgmode/92406>
Nicolas Goaziou 10 years ago
parent
commit
f49833293a
1 changed files with 25 additions and 23 deletions
  1. 25 23
      lisp/org.el

+ 25 - 23
lisp/org.el

@@ -5219,29 +5219,31 @@ FILETAGS is a list of tags, as strings."
   (org-set-local 'org-tag-groups-alist nil)
   (org-set-local 'org-tag-alist nil)
   (let (group-flag)
-    (dolist (e tags)
-      (cond
-       ((equal e "{")
-	(push '(:startgroup) org-tag-alist)
-	(setq group-flag t))
-       ((equal e "}")
-	(push '(:endgroup) org-tag-alist)
-	(setq group-flag nil))
-       ((equal e ":")
-	(push '(:grouptags) org-tag-alist)
-	(setq group-flag 'append))
-       ((equal e "\\n") (push '(:newline) org-tag-alist))
-       ((string-match (org-re "\\`\\([[:alnum:]_@#%]+\\)\\(?:(\\(.\\))\\)?\\'")
-		      e)
-	(let ((tag (match-string 1 e))
-	      (key (and (match-beginning 2)
-			(string-to-char (match-string 2 e)))))
-	  (cond ((eq group-flag 'append)
-		 (setcar org-tag-groups-alist
-			 (append (car org-tag-groups-alist) (list tag))))
-		(group-flag (push (list tag) org-tag-groups-alist)))
-	  (unless (assoc tag org-tag-alist)
-	    (push (cons tag key) org-tag-alist)))))))
+    (while tags
+      (let ((e (car tags)))
+	(setq tags (cdr tags))
+	(cond
+	 ((equal e "{")
+	  (push '(:startgroup) org-tag-alist)
+	  (when (equal (nth 1 tags) ":") (setq group-flag t)))
+	 ((equal e "}")
+	  (push '(:endgroup) org-tag-alist)
+	  (setq group-flag nil))
+	 ((equal e ":")
+	  (push '(:grouptags) org-tag-alist)
+	  (setq group-flag 'append))
+	 ((equal e "\\n") (push '(:newline) org-tag-alist))
+	 ((string-match
+	   (org-re "\\`\\([[:alnum:]_@#%]+\\)\\(?:(\\(.\\))\\)?\\'") e)
+	  (let ((tag (match-string 1 e))
+		(key (and (match-beginning 2)
+			  (string-to-char (match-string 2 e)))))
+	    (cond ((eq group-flag 'append)
+		   (setcar org-tag-groups-alist
+			   (append (car org-tag-groups-alist) (list tag))))
+		  (group-flag (push (list tag) org-tag-groups-alist)))
+	    (unless (assoc tag org-tag-alist)
+	      (push (cons tag key) org-tag-alist))))))))
   (setq org-tag-alist (nreverse org-tag-alist)))
 
 (defun org-file-contents (file &optional noerror)