浏览代码

Agenda: Fix bugs with FILETAGS

Harri Kiiskinen writes:

>  It seems that org-use-tag-inheritance set to regexp, the use of
>  #+FILETAGS: and org-todo-list do not work together. It seems, that a
>  regexp in org-use-tag-inheritance matching a tag set in #+FILETAGS
>  causes this error:
>
>  Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>   string-match("^ +" nil)
>  [...]
>  when org-use-tag-inheritance is set to regexp "te"
>  with this file:
>
>  --------
>  #+STARTUP:
>  #+FILETAGS: tea
>  * TODO testing 		       :test:
>  ** TODO too			       :data:
>  -----
>
>  When the regexp is "tes", so that the FILETAG does not match,
>  org-todo-list produces a correct list.

This is indeed a bug.  The all to `org-get-tags-at' does change the
match data if there is a match for the inheritance regexp.  This
problem is now avoided by first extracting (match-string 1), and then
getting the tags.

Studying this bug also exposed another one, namely that file tags are
not marked as inherited tags.  This is now fixed, immediately when
the #+FILETAGS line is parsed.
Carsten Dominik 16 年之前
父节点
当前提交
70b975f89c
共有 3 个文件被更改,包括 9 次插入2 次删除
  1. 5 0
      lisp/ChangeLog
  2. 2 1
      lisp/org-agenda.el
  3. 2 1
      lisp/org.el

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2009-03-25  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-agenda.el (org-agenda-get-todos): Fix bug with match-data.
+	(org-agenda-get-todos): Mark file tags as inherited.
+
 2009-03-24  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-feed.el (org-feed-assume-stable): New option.

+ 2 - 1
lisp/org-agenda.el

@@ -3574,8 +3574,9 @@ the documentation of `org-diary'."
 	(goto-char (match-beginning 1))
 	(setq marker (org-agenda-new-marker (match-beginning 0))
 	      category (org-get-category)
+	      txt (match-string 1)
 	      tags (org-get-tags-at (point))
-	      txt (org-format-agenda-item "" (match-string 1) category tags)
+	      txt (org-format-agenda-item "" txt category tags)
 	      priority (1+ (org-get-priority txt))
 	      todo-state (org-get-todo-state))
 	(org-add-props txt props

+ 2 - 1
lisp/org.el

@@ -3426,7 +3426,8 @@ means to push this value onto the list in the variable.")
 	(org-set-local 'org-lowest-priority  (nth 1 prio))
 	(org-set-local 'org-default-priority (nth 2 prio)))
       (and props (org-set-local 'org-file-properties (nreverse props)))
-      (and ftags (org-set-local 'org-file-tags ftags))
+      (and ftags (org-set-local 'org-file-tags
+				(mapcar 'org-add-prop-inherited ftags)))
       (and drawers (org-set-local 'org-drawers drawers))
       (and arch (org-set-local 'org-archive-location arch))
       (and links (setq org-link-abbrev-alist-local (nreverse links)))