From caa2788b26a1c0832a3772f529f4846e57430e0f Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Fri, 25 Jul 2008 17:05:37 -0700 Subject: [PATCH] Allow a user-defined filter for the values in column view. --- lisp/ChangeLog | 20 ++++++++++++++++++++ lisp/org-colview-xemacs.el | 21 ++++++++++++++------- lisp/org-colview.el | 21 ++++++++++++++------- lisp/org.el | 12 ++++++++++++ 4 files changed, 60 insertions(+), 14 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index efe464681..70c14bd37 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,25 @@ +2008-07-26 Carsten Dominik + + * 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 + * 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. diff --git a/lisp/org-colview-xemacs.el b/lisp/org-colview-xemacs.el index 680cfaf00..4acad13dc 100644 --- a/lisp/org-colview-xemacs.el +++ b/lisp/org-colview-xemacs.el @@ -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 diff --git a/lisp/org-colview.el b/lisp/org-colview.el index 5c6d46bec..de2ee3c78 100644 --- a/lisp/org-colview.el +++ b/lisp/org-colview.el @@ -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 diff --git a/lisp/org.el b/lisp/org.el index f5598144d..bd4009e77 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -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.