0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-08-24 20:02:51 +00:00

org-colview: Clean up items in agenda mode too.

* org-colview.el (org-columns-display-here): Clean up items in
org-agenda-mode too.
(org-columns-cleanup-item): Take a new argument CPHR to allow
passing a complex heading regexp.  Rewrite to cleanup ITEM
correctly in `org-agenda-mode'.

Thanks to Christian Schmidt for pointing at this problem.
This commit is contained in:
Bastien Guerry 2011-08-17 16:56:27 +02:00
parent 8c3ecbe39a
commit 2edd05eaac

View file

@ -209,9 +209,9 @@ This is the compiled version of the format.")
(funcall org-columns-modify-value-for-display-function (funcall org-columns-modify-value-for-display-function
title val)) title val))
((equal property "ITEM") ((equal property "ITEM")
(if (org-mode-p)
(org-columns-cleanup-item (org-columns-cleanup-item
val org-columns-current-fmt-compiled))) val org-columns-current-fmt-compiled
(or org-complex-heading-regexp cphr)))
((and calc (functionp calc) ((and calc (functionp calc)
(not (string= val "")) (not (string= val ""))
(not (get-text-property 0 'org-computed val))) (not (get-text-property 0 'org-computed val)))
@ -341,11 +341,15 @@ for the duration of the command.")
(when (local-variable-p 'org-colview-initial-truncate-line-value) (when (local-variable-p 'org-colview-initial-truncate-line-value)
(setq truncate-lines org-colview-initial-truncate-line-value))))) (setq truncate-lines org-colview-initial-truncate-line-value)))))
(defun org-columns-cleanup-item (item fmt) (defun org-columns-cleanup-item (item fmt cphr)
"Remove from ITEM what is a column in the format FMT." "Remove from ITEM what is a column in the format FMT.
(if (not org-complex-heading-regexp) CPHR is the complex heading regexp to use for parsing ITEM."
(let (fixitem)
(if (not cphr)
item item
(when (string-match org-complex-heading-regexp item) (unless (string-match "\*+ " item)
(setq item (concat "* " item) fixitem t))
(if (string-match cphr item)
(setq item (setq item
(concat (concat
(org-add-props (match-string 1 item) nil (org-add-props (match-string 1 item) nil
@ -358,7 +362,7 @@ for the duration of the command.")
0 (1+ (match-end 1)) 0 (1+ (match-end 1))
(list 'org-whitespace (* 2 (1- (org-reduced-level (- (match-end 1) (match-beginning 1)))))) (list 'org-whitespace (* 2 (1- (org-reduced-level (- (match-end 1) (match-beginning 1))))))
item) item)
item))) (if fixitem (replace-regexp-in-string "^\*+ " "" item) item)))))
(defun org-columns-compact-links (s) (defun org-columns-compact-links (s)
"Replace [[link][desc]] with [desc] or [link]." "Replace [[link][desc]] with [desc] or [link]."