瀏覽代碼

Cleanup ITEM when used in column view in the agenda.

Carsten Dominik 17 年之前
父節點
當前提交
68cca55732
共有 4 個文件被更改,包括 49 次插入2 次删除
  1. 7 1
      ORGWEBPAGE/Changes.org
  2. 5 0
      lisp/ChangeLog
  3. 18 0
      lisp/org-agenda.el
  4. 19 1
      lisp/org-colview.el

+ 7 - 1
ORGWEBPAGE/Changes.org

@@ -10,10 +10,16 @@
 #+LINK_UP: index.html
 #+LINK_HOME: http://orgmode.org
 
-* Version 6.04
+* Version 6.05
 :PROPERTIES:
 :VISIBILITY: content
 :END:
+** Details
+*** Column view in the agenda now cleans the ITEM field
+    See the new variable
+    =org-agenda-columns-remove-prefix-from-item=.
+
+* Version 6.04
 
 ** Overview
 

+ 5 - 0
lisp/ChangeLog

@@ -1,5 +1,10 @@
 2008-05-28  Carsten Dominik  <dominik@science.uva.nl>
 
+	* org-agenda.el (org-agenda-columns-remove-prefix-from-item): New
+	option.
+
+	* org-colview.el (org-agenda-columns-cleanu-item): New function.
+
 	* org-exp.el (org-export-ascii-preprocess): Renamed from
 	`org-export-ascii-clean-string'.
 	(org-export-kill-licensed-text)

+ 18 - 0
lisp/org-agenda.el

@@ -945,6 +945,16 @@ a names face, or a list like `(:background \"Red\")'."
   :group 'org-agenda-column-view
   :type 'boolean)
 
+(defcustom org-agenda-columns-remove-prefix-from-item t
+  "Non-nil means, remove the prefix from a headline for agenda column view.
+The special ITEM field in the columns format contains the current line, with
+all information shown in other columns (like the TODO state or a tag).
+When this variable is non-nil, also the agenda prefix will be removed from
+the content of the ITEM field, to make sure as much as possible of the
+headline can be shown in the limited width of the field."
+  :group 'org-agenda
+  :type 'boolean)
+
 (defcustom org-agenda-columns-compute-summary-properties t
   "Non-nil means, recompute all summary properties before column view.
 When column view in the agenda is listing properties that have a summary
@@ -2429,6 +2439,7 @@ in `org-agenda-text-search-extra-files'."
 		      'done-face 'org-done
 		      'org-not-done-regexp org-not-done-regexp
 		      'org-todo-regexp org-todo-regexp
+		      'org-complex-heading-regexp org-complex-heading-regexp
 		      'mouse-face 'highlight
 		      'keymap org-agenda-keymap
 		      'help-echo (format "mouse-2 or RET jump to location")))
@@ -2543,6 +2554,7 @@ in `org-agenda-text-search-extra-files'."
 		      (org-add-props txt props
 			'org-marker marker 'org-hd-marker marker
 			'org-todo-regexp org-todo-regexp
+			'org-complex-heading-regexp org-complex-heading-regexp
 			'priority 1000 'org-category category
 			'type "search")
 		      (push txt ee)
@@ -3068,6 +3080,7 @@ the documentation of `org-diary'."
 		      'done-face 'org-done
 		      'org-not-done-regexp org-not-done-regexp
 		      'org-todo-regexp org-todo-regexp
+		      'org-complex-heading-regexp org-complex-heading-regexp
 		      'mouse-face 'highlight
 		      'keymap org-agenda-keymap
 		      'help-echo
@@ -3126,6 +3139,7 @@ the documentation of `org-diary'."
   (let* ((props (list 'face nil
 		      'org-not-done-regexp org-not-done-regexp
 		      'org-todo-regexp org-todo-regexp
+		      'org-complex-heading-regexp org-complex-heading-regexp
 		      'mouse-face 'highlight
 		      'keymap org-agenda-keymap
 		      'help-echo
@@ -3258,6 +3272,7 @@ the documentation of `org-diary'."
   (let* ((props (list 'mouse-face 'highlight
 		      'org-not-done-regexp org-not-done-regexp
 		      'org-todo-regexp org-todo-regexp
+		      'org-complex-heading-regexp org-complex-heading-regexp
 		      'keymap org-agenda-keymap
 		      'help-echo
 		      (format "mouse-2 or RET jump to org file %s"
@@ -3312,6 +3327,7 @@ the documentation of `org-diary'."
   (let* ((props (list 'mouse-face 'highlight
 		      'org-not-done-regexp org-not-done-regexp
 		      'org-todo-regexp org-todo-regexp
+		      'org-complex-heading-regexp org-complex-heading-regexp
 		      'keymap org-agenda-keymap
 		      'help-echo
 		      (format "mouse-2 or RET jump to org file %s"
@@ -3397,6 +3413,7 @@ FRACTION is what fraction of the head-warning time has passed."
   "Return the scheduled information for agenda display."
   (let* ((props (list 'org-not-done-regexp org-not-done-regexp
 		      'org-todo-regexp org-todo-regexp
+		      'org-complex-heading-regexp org-complex-heading-regexp
 		      'done-face 'org-done
 		      'mouse-face 'highlight
 		      'keymap org-agenda-keymap
@@ -3472,6 +3489,7 @@ FRACTION is what fraction of the head-warning time has passed."
   (let* ((props (list 'face nil
 		      'org-not-done-regexp org-not-done-regexp
 		      'org-todo-regexp org-todo-regexp
+		      'org-complex-heading-regexp org-complex-heading-regexp
 		      'mouse-face 'highlight
 		      'keymap org-agenda-keymap
 		      'help-echo

+ 19 - 1
lisp/org-colview.el

@@ -139,6 +139,8 @@ This is the compiled version of the format.")
 		       'default))
 	 (color (list :foreground (face-attribute ref-face :foreground)))
 	 (face (list color 'org-column ref-face))
+	 (pl (get-text-property (point-at-bol) 'prefix-length))
+	 (cphr (get-text-property (point-at-bol) 'org-complex-heading-regexp))
 	 pom property ass width f string ov column val modval)
     ;; Check if the entry is in another buffer.
     (unless props
@@ -164,7 +166,11 @@ This is the compiled version of the format.")
 	    f (format "%%-%d.%ds | " width width)
 	    val (or (cdr ass) "")
 	    modval (if (equal property "ITEM")
-		       (org-columns-cleanup-item val org-columns-current-fmt-compiled))
+		       (if (org-mode-p)
+			   (org-columns-cleanup-item
+			    val org-columns-current-fmt-compiled)
+			 (org-agenda-columns-cleanu-item
+			  val pl cphr org-columns-current-fmt-compiled)))
 	    string (format f (or modval val)))
       ;; Create the overlay
       (org-unmodified
@@ -280,6 +286,18 @@ for the duration of the command.")
        " " (match-string 4 item)
        (and (match-end 5) (not (assoc "TAGS" fmt)) (concat " " (match-string 5 item)))))))
 
+(defun org-agenda-columns-cleanu-item (item pl cphr fmt)
+  "Cleanup the tiem property for agenda column view.
+See also the variable `org-agenda-columns-remove-prefix'."
+  (let* ((org-complex-heading-regexp cphr)
+	 (prefix (substring item 0 pl))
+	 (rest (substring item pl))
+	 (fake (concat "* " rest))
+	 (cleaned (substring (org-columns-cleanup-item fake fmt) 1)))
+    (if org-agenda-columns-remove-prefix-from-item
+	cleaned
+      (concat prefix cleaned))))
+
 (defun org-columns-show-value ()
   "Show the full value of the property."
   (interactive)