Browse Source

Fix bug when all tags are hidden in the agenda

Patch by Stephan Schmitt, who writes:

> An error was thrown when all tags of a headline are hidden by
> org-agenda-hide-tags-regexp (in this case the function
> get-text-property got nil as third argument)
Carsten Dominik 15 years ago
parent
commit
6b8af94de3
2 changed files with 14 additions and 9 deletions
  1. 5 0
      lisp/ChangeLog
  2. 9 9
      lisp/org-agenda.el

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2010-01-11  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-agenda.el (org-agenda-fix-displayed-tags): Fix bug when all
+	tags are hidden.
+
 2010-01-10  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-latex.el (org-export-latex-fix-inputenc): New function.

+ 9 - 9
lisp/org-agenda.el

@@ -4762,16 +4762,16 @@ The modified list may contain inherited tags, and tags matched by
   (when (or add-inherited hide-re)
     (if (string-match (org-re "\\([ \t]+\\)\\(:[[:alnum:]_@:]+:\\)[ \t]*$") txt)
 	(setq txt (substring txt 0 (match-beginning 0))))
+    (setq tags
+	  (delq nil
+		(mapcar (lambda (tg)
+			  (if (or (and hide-re (string-match hide-re tg))
+				  (and (not add-inherited)
+				       (get-text-property 0 'inherited tg)))
+			      nil
+			    tg))
+			tags)))
     (when tags
-      (setq tags
-	    (delq nil
-		  (mapcar (lambda (tg)
-			    (if (or (and hide-re (string-match hide-re tg))
-				    (and (not add-inherited)
-					 (get-text-property 0 'inherited tg)))
-				nil
-			      tg))
-			  tags)))
       (let ((have-i (get-text-property 0 'inherited (car tags)))
 	    i)
 	(setq txt (concat txt " :"