Browse Source

Fix bug with updating agenda lines with correct tags.

Updating agenda lines did display tags incorrectly, because it used
the list of tags available as a property to remake the list.  However,
that list contains down-cased versions of the tags, because all the
filtering in the agenda does ignore case in tags.

This patch implements a fresh scan for the tags each time a line is
updated, and in this way fixes the problem.  It also reverses a
previous attempt to fix a similar problem.
Carsten Dominik 16 years ago
parent
commit
ff8ef0aa14
2 changed files with 15 additions and 8 deletions
  1. 7 0
      lisp/ChangeLog
  2. 8 8
      lisp/org-agenda.el

+ 7 - 0
lisp/ChangeLog

@@ -1,3 +1,10 @@
+2008-12-18  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-agenda.el (org-agenda-set-tags): Leave getting the tags to
+	`org-agenda-change-all-lines'.
+	(org-agenda-change-all-lines): Removed FORCE-TAGS argument, the
+	tags are now retrieved locally.
+
 2008-12-17  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org.el (org-get-outline-path): Fix bug if level is not given.

+ 8 - 8
lisp/org-agenda.el

@@ -5068,8 +5068,7 @@ the same tree node, and the headline of the tree node in the Org-mode file."
       (org-add-note))))
 
 (defun org-agenda-change-all-lines (newhead hdmarker
-					    &optional fixface just-this
-					    force-tags)
+					    &optional fixface just-this)
   "Change all lines in the agenda buffer which match HDMARKER.
 The new content of the line will be NEWHEAD (as modified by
 `org-format-agenda-item').  HDMARKER is checked with
@@ -5080,6 +5079,10 @@ If JUST-THIS is non-nil, change just the current line, not all.
 If FORCE-TAGS is non nil, the car of it returns the new tags."
   (let* ((inhibit-read-only t)
 	 (line (org-current-line))
+	 (thetags (with-current-buffer (marker-buffer hdmarker)
+		    (save-excursion (save-restriction (widen)
+						      (goto-char hdmarker)
+						      (org-get-tags-at)))))
 	 props m pl undone-face done-face finish new dotime cat tags)
     (save-excursion
       (goto-char (point-max))
@@ -5092,9 +5095,7 @@ If FORCE-TAGS is non nil, the car of it returns the new tags."
 	  (setq props (text-properties-at (point))
 		dotime (get-text-property (point) 'dotime)
 		cat (get-text-property (point) 'org-category)
-		tags (if force-tags
-			 (car force-tags)
-		       (get-text-property (point) 'tags))
+		tags thetags
 		new (org-format-agenda-item "x" newhead cat tags dotime 'noprefix)
 		pl (get-text-property (point) 'prefix-length)
 		undone-face (get-text-property (point) 'undone-face)
@@ -5197,7 +5198,7 @@ the same tree node, and the headline of the tree node in the Org-mode file."
 	   (buffer (marker-buffer hdmarker))
 	   (pos (marker-position hdmarker))
 	   (inhibit-read-only t)
-	   newhead tags)
+	   newhead)
       (org-with-remote-undo buffer
 	(with-current-buffer buffer
 	  (widen)
@@ -5209,10 +5210,9 @@ the same tree node, and the headline of the tree node in the Org-mode file."
 		 (org-flag-heading nil)))   ; show the next heading
 	  (goto-char pos)
 	  (call-interactively 'org-set-tags)
-	  (setq tags (org-get-tags-at))
 	  (end-of-line 1)
 	  (setq newhead (org-get-heading)))
-	(org-agenda-change-all-lines newhead hdmarker nil nil (list tags))
+	(org-agenda-change-all-lines newhead hdmarker)
 	(beginning-of-line 1)))))
 
 (defun org-agenda-toggle-archive-tag ()