org-colview: Use regular "ITEM" property

* lisp/org-colview.el (org-columns-display-here): Use regular "ITEM"
  value instead of computing another one.  Simplify process.
  (org-columns-cleanup-item): Remove function.

* contrib/lisp/org-colview-xemacs.el (org-columns-display-here): Use
  regular "ITEM" value instead of computing another one.  Simplify
  process.  (org-columns-cleanup-item): Remove function.

* etc/ORG-NEWS: Document change.
This commit is contained in:
Nicolas Goaziou 2014-11-10 16:41:34 +01:00
parent 9309fd5d20
commit ece68a7a6f
3 changed files with 6 additions and 70 deletions

View File

@ -303,10 +303,6 @@ This is the compiled version of the format.")
(beginning-of-line 1)
(and (looking-at "\\(\\**\\)\\(\\* \\)")
(org-get-level-face 2))))
(item (save-match-data
(org-remove-tabs
(buffer-substring-no-properties
(point-at-bol) (point-at-eol)))))
(color (if (featurep 'xemacs)
(save-excursion
(beginning-of-line 1)
@ -335,9 +331,7 @@ This is the compiled version of 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))
ass (assoc property props)
width (or (cdr (assoc property org-columns-current-maxwidths))
(nth 2 column)
(length property))
@ -351,9 +345,7 @@ This is the compiled version of the format.")
(funcall org-columns-modify-value-for-display-function
title val))
((equal property "ITEM")
(if (derived-mode-p 'org-mode)
(org-columns-cleanup-item
val org-columns-current-fmt-compiled)))
(org-columns-compact-links val))
((and calc (functionp calc)
(not (string= val ""))
(not (get-text-property 0 'org-computed val)))
@ -503,26 +495,6 @@ This is the compiled version of the format.")
(current-buffer))
(setq truncate-lines org-colview-initial-truncate-line-value)))))
(defun org-columns-cleanup-item (item fmt)
"Remove from ITEM what is a column in the format FMT."
(if (not org-complex-heading-regexp)
item
(when (string-match org-complex-heading-regexp item)
(setq item
(concat
(org-add-props (match-string 1 item) nil
'org-whitespace (* 2 (1- (org-reduced-level (- (match-end 1) (match-beginning 1))))))
(and (match-end 2) (not (assoc "TODO" fmt)) (concat " " (match-string 2 item)))
(and (match-end 3) (not (assoc "PRIORITY" fmt)) (concat " " (match-string 3 item)))
" " (save-match-data (org-columns-compact-links (or (match-string 4 item) "")))
(and (match-end 5) (not (assoc "TAGS" fmt)) (concat " " (match-string 5 item)))))
(add-text-properties
0 (1+ (match-end 1))
(list 'org-whitespace (* 2 (1- (org-reduced-level (- (match-end 1) (match-beginning 1))))))
item)
item)))
(defun org-columns-compact-links (s)
"Replace [[link][desc]] with [desc] or [link]."
(while (string-match org-bracket-link-regexp s)

View File

@ -150,6 +150,8 @@ Headlines, for which the property ~UNNUMBERED~ is non-nil, are now
exported without section numbers irrespective of their levels. The
property is inherited by children.
** Miscellaneous
*** Strip all meta data from ITEM special property
ITEM special property do not contain anymore TODO, priority or tags.
*** File names in links accept are now compatible with URI syntax
Absolute file names can now start with =///= in addition to =/=. E.g.,
=[[file:///home/me/unicorn.jpg]]=.

View File

@ -186,20 +186,7 @@ This is the compiled version of the format.")
(while (setq column (pop fmt))
(setq property (car column)
title (nth 1 column)
ass (if (equal property "ITEM")
(cons "ITEM"
;; When in a buffer, get the whole line,
;; we'll clean it later…
(if (derived-mode-p 'org-mode)
(save-match-data
(org-remove-tabs
(buffer-substring-no-properties
(point-at-bol) (point-at-eol))))
;; In agenda, just get the `txt' property
(or (org-get-at-bol 'txt)
(buffer-substring-no-properties
(point) (progn (end-of-line) (point))))))
(assoc property props))
ass (assoc property props)
width (or (cdr (assoc property org-columns-current-maxwidths))
(nth 2 column)
(length property))
@ -214,9 +201,7 @@ This is the compiled version of the format.")
(funcall org-columns-modify-value-for-display-function
title val))
((equal property "ITEM")
(org-columns-cleanup-item
val org-columns-current-fmt-compiled
(or org-complex-heading-regexp cphr)))
(org-columns-compact-links val))
(fc (org-columns-number-to-string
(org-columns-string-to-number val fm) fm fc))
((and calc (functionp calc)
@ -348,29 +333,6 @@ for the duration of the command.")
(when (local-variable-p 'org-colview-initial-truncate-line-value)
(setq truncate-lines org-colview-initial-truncate-line-value)))))
(defun org-columns-cleanup-item (item fmt cphr)
"Remove from ITEM what is a column in the format FMT.
CPHR is the complex heading regexp to use for parsing ITEM."
(let (fixitem)
(if (not cphr)
item
(unless (string-match "^\*+ " item)
(setq item (concat "* " item) fixitem t))
(if (string-match cphr item)
(setq item
(concat
(org-add-props (match-string 1 item) nil
'org-whitespace (* 2 (1- (org-reduced-level (- (match-end 1) (match-beginning 1))))))
(and (match-end 2) (not (assoc "TODO" fmt)) (concat " " (match-string 2 item)))
(and (match-end 3) (not (assoc "PRIORITY" fmt)) (concat " " (match-string 3 item)))
" " (save-match-data (org-columns-compact-links (or (match-string 4 item) "")))
(and (match-end 5) (not (assoc "TAGS" fmt)) (concat " " (match-string 5 item)))))
(add-text-properties
0 (1+ (match-end 1))
(list 'org-whitespace (* 2 (1- (org-reduced-level (- (match-end 1) (match-beginning 1))))))
item))
(if fixitem (replace-regexp-in-string "^\*+ " "" item) item))))
(defun org-columns-compact-links (s)
"Replace [[link][desc]] with [desc] or [link]."
(while (string-match org-bracket-link-regexp s)