Allow a user-defined filter for the values in column view.

This commit is contained in:
Carsten Dominik 2008-07-25 17:05:37 -07:00
parent 2c26217b88
commit caa2788b26
4 changed files with 60 additions and 14 deletions

View File

@ -1,5 +1,25 @@
2008-07-26 Carsten Dominik <dominik@science.uva.nl>
* org-colview.el (org-columns-display-here): Use
`org-columns-modify-value-for-display-function'.
* org-colview-xemacs.el (org-columns-display-here): Use
`org-columns-modify-value-for-display-function'.
2008-07-25 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-columns-modify-value-for-display-function): New option.
* org-publish.el (org-publish-file): Make sure the directory match
for the publishing directory works correctly.

View File

@ -323,7 +323,7 @@ This is the compiled version of the format.")
(face (if (featurep 'xemacs) color (list color 'org-column)))
(pl (or (get-text-property (point-at-bol) 'prefix-length) 0))
(cphr (get-text-property (point-at-bol) 'org-complex-heading-regexp))
pom property ass width f string ov column val modval s1 s2)
pom property ass width f string ov column val modval s1 s2 title)
;; Check if the entry is in another buffer.
(unless props
(if (eq major-mode 'org-agenda-mode)
@ -334,6 +334,7 @@ This is the compiled version of the format.")
;; Walk the format
(while (setq column (pop fmt))
(setq property (car column)
title (nth 1 column)
ass (if (equal property "ITEM")
(cons "ITEM" item)
(assoc property props))
@ -343,12 +344,18 @@ This is the compiled version of the format.")
f (format (if (featurep 'xemacs) "%%-%d.%ds |" "%%-%d.%ds | ")
width width)
val (or (cdr ass) "")
modval (if (equal property "ITEM")
(if (org-mode-p)
(org-columns-cleanup-item
val org-columns-current-fmt-compiled)
(org-agenda-columns-cleanup-item
val pl cphr org-columns-current-fmt-compiled))))
modval (or (and org-columns-modify-value-for-display-function
(functionp
org-columns-modify-value-for-display-function)
(funcall
org-columns-modify-value-for-display-function
title val))
(if (equal property "ITEM")
(if (org-mode-p)
(org-columns-cleanup-item
val org-columns-current-fmt-compiled)
(org-agenda-columns-cleanup-item
val pl cphr org-columns-current-fmt-compiled)))))
(setq s2 (org-columns-add-ellipses (or modval val) width))
(setq string (format f s2))
;; Create the overlay

View File

@ -147,7 +147,7 @@ This is the compiled version of the format.")
(face (list color 'org-column ref-face))
(pl (or (get-text-property (point-at-bol) 'prefix-length) 0))
(cphr (get-text-property (point-at-bol) 'org-complex-heading-regexp))
pom property ass width f string ov column val modval s1 s2)
pom property ass width f string ov column val modval s1 s2 title)
;; Check if the entry is in another buffer.
(unless props
(if (eq major-mode 'org-agenda-mode)
@ -158,6 +158,7 @@ This is the compiled version of the format.")
;; Walk the format
(while (setq column (pop fmt))
(setq property (car column)
title (nth 1 column)
ass (if (equal property "ITEM")
(cons "ITEM"
(save-match-data
@ -171,12 +172,18 @@ This is the compiled version of the format.")
(length property))
f (format "%%-%d.%ds | " width width)
val (or (cdr ass) "")
modval (if (equal property "ITEM")
(if (org-mode-p)
(org-columns-cleanup-item
val org-columns-current-fmt-compiled)
(org-agenda-columns-cleanup-item
val pl cphr org-columns-current-fmt-compiled))))
modval (or (and org-columns-modify-value-for-display-function
(functionp
org-columns-modify-value-for-display-function)
(funcall
org-columns-modify-value-for-display-function
title val))
(if (equal property "ITEM")
(if (org-mode-p)
(org-columns-cleanup-item
val org-columns-current-fmt-compiled)
(org-agenda-columns-cleanup-item
val pl cphr org-columns-current-fmt-compiled)))))
(setq s2 (org-columns-add-ellipses (or modval val) width))
(setq string (format f s2))
;; Create the overlay

View File

@ -1900,6 +1900,18 @@ ellipses string, only part of the ellipses string will be shown."
:group 'org-properties
:type 'string)
(defcustom org-columns-modify-value-for-display-function nil
"Function that modifies values for display in column view.
For example, it can be used to cut out a certain part from a time stamp.
The function must take 2 argments:
column-title The tite of the column (*not* the property name)
value The value that should be modified.
The function should return the value that should be displayed,
or nil if the normal value should be used."
:group 'org-properties
:type 'function)
(defcustom org-effort-property "Effort"
"The property that is being used to keep track of effort estimates.