Browse Source

Clock history: Present all tasks fontified

Bernt Hansen requested this.
Carsten Dominik 16 years ago
parent
commit
e1f6e949ed
3 changed files with 19 additions and 1 deletions
  1. 5 0
      lisp/ChangeLog
  2. 5 1
      lisp/org-clock.el
  3. 9 0
      lisp/org.el

+ 5 - 0
lisp/ChangeLog

@@ -1,5 +1,10 @@
 2009-05-05  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-clock.el (org-clock-insert-selection-line): Make sure tasks
+	are properly fontified before shown in the selection menu.
+
+	* org.el (org-fontify-like-in-org-mode): New function.
+
 	* org-latex.el (org-export-latex-links): Use the property list to
 	retrieve the default image attributes.
 

+ 5 - 1
lisp/org-clock.el

@@ -238,6 +238,9 @@ of a different task.")
        (t (error "Invalid task choice %c" rpl))))))
 
 (defun org-clock-insert-selection-line (i marker)
+  "Insert a line for the clock selection menu.
+And return a cons cell with the selection character integer and the marker
+pointing to it."
   (when (marker-buffer marker)
     (let (file cat task)
       (with-current-buffer (org-base-buffer (marker-buffer marker))
@@ -249,7 +252,8 @@ of a different task.")
 		  cat (or (org-get-category)
 			  (progn (org-refresh-category-properties)
 				 (org-get-category)))
-		  task (org-get-heading 'notags)))))
+		  task (org-fontify-like-in-org-mode
+			(org-get-heading 'notags) org-odd-levels-only)))))
       (when (and cat task)
 	(insert (format "[%c] %-15s %s\n" i cat task))
 	(cons i marker)))))

+ 9 - 0
lisp/org.el

@@ -4490,6 +4490,15 @@ between words."
 		   '(org-font-lock-keywords t nil nil backward-paragraph))
     (kill-local-variable 'font-lock-keywords) nil))
 
+(defun org-fontify-like-in-org-mode (s &optional odd-levels)
+  "Fontify string S like in Org-mode"
+  (with-temp-buffer
+    (insert s)
+    (let ((org-odd-levels-only odd-levels))
+      (org-mode)
+      (font-lock-fontify-buffer)
+      (buffer-string))))
+
 (defvar org-m nil)
 (defvar org-l nil)
 (defvar org-f nil)