Browse Source

Fix bug with tag inheritance.

This bug caused (org-get-tags-at) to return no tags at all
when inheritance was turned off, even if the entry
does have local tags.
Carsten Dominik 16 năm trước cách đây
mục cha
commit
43e6633a15
2 tập tin đã thay đổi với 20 bổ sung16 xóa
  1. 1 0
      lisp/ChangeLog
  2. 19 16
      lisp/org.el

+ 1 - 0
lisp/ChangeLog

@@ -2,6 +2,7 @@
 
 	* org.el (org-refile): Allow refiling to the last entry in the
 	buffer.
+	(org-get-tags-at): Fix bug when inheritance is turned off.
 
 2008-09-19  Carsten Dominik  <dominik@science.uva.nl>
 

+ 19 - 16
lisp/org.el

@@ -9746,22 +9746,25 @@ ignore inherited ones."
 	(widen)
 	(goto-char (or pos (point)))
 	(save-match-data
-	  (condition-case nil
-	      (progn
-		(org-back-to-heading t)
-		(while (not (equal lastpos (point)))
-		  (setq lastpos (point))
-		  (when (looking-at (org-re "[^\r\n]+?:\\([[:alnum:]_@:]+\\):[ \t]*$"))
-		    (setq ltags (org-split-string
-				 (org-match-string-no-properties 1) ":"))
-		    (setq tags (append (org-remove-uniherited-tags ltags)
-				       tags)))
-		  (or org-use-tag-inheritance (error ""))
-		  (if local
-		      (setq lastpos (point)) ; stop here
-		    (org-up-heading-all 1))
-		  (setq parent t)))
-	    (error nil))))
+	  (catch 'done
+	    (condition-case nil
+		(progn
+		  (org-back-to-heading t)
+		  (while (not (equal lastpos (point)))
+		    (setq lastpos (point))
+		    (when (looking-at (org-re "[^\r\n]+?:\\([[:alnum:]_@:]+\\):[ \t]*$"))
+		      (setq ltags (org-split-string
+				   (org-match-string-no-properties 1) ":"))
+		      (setq tags (append
+				  (if parent
+				      (org-remove-uniherited-tags ltags)
+				    ltags)
+				  tags)))
+		    (or org-use-tag-inheritance (throw 'done t))
+		    (if local (throw 'done t))
+		    (org-up-heading-all 1)
+		    (setq parent t)))
+	      (error nil)))))
       (append (org-remove-uniherited-tags org-file-tags) tags))))
 
 (defun org-toggle-tag (tag &optional onoff)