Browse Source

Fix bug with tags setting from agenda.

Setting tags from the agenda no longer updated the agenda display
correctly.  Now this works again.

Report by John Wiegley.
Carsten Dominik 17 years ago
parent
commit
2b49ebc8fc
2 changed files with 19 additions and 5 deletions
  1. 7 0
      lisp/ChangeLog
  2. 12 5
      lisp/org-agenda.el

+ 7 - 0
lisp/ChangeLog

@@ -1,3 +1,10 @@
+2008-12-16  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-agenda.el (org-agenda-change-all-lines): New argument
+	FORCE-TAGS.
+	(org-agenda-set-tags): Cet the new tags and pas them to
+	`org-format-agenda-item'.
+
 2008-12-15  Carsten Dominik  <carsten.dominik@gmail.com>
 2008-12-15  Carsten Dominik  <carsten.dominik@gmail.com>
 
 
 	* org-export-latex.el (org-export-latex-emphasis-alist): Switch to
 	* org-export-latex.el (org-export-latex-emphasis-alist): Switch to

+ 12 - 5
lisp/org-agenda.el

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