0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-30 01:27:53 +00:00

org-colview: Fix length of columns

* lisp/org-colview.el (org-columns-display-here): Do not add star to
  headlines at the display level...
(org-columns): ... but when collecting values, here...
(org-agenda-columns): ... and there.

Reported-by: Michael Brand <michael.ch.brand@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/104846>
This commit is contained in:
Nicolas Goaziou 2016-02-06 00:04:35 +01:00
parent aee808987d
commit 3178fcb90d

View file

@ -162,8 +162,7 @@ This is the compiled version of the format.")
(interactive) (interactive)
(save-excursion (save-excursion
(beginning-of-line) (beginning-of-line)
(let* ((level (or (org-current-level) 0)) (let* ((level-face (and (looking-at "\\(\\**\\)\\(\\* \\)")
(level-face (and (looking-at "\\(\\**\\)\\(\\* \\)")
(org-get-level-face 2))) (org-get-level-face 2)))
(ref-face (or level-face (ref-face (or level-face
(and (eq major-mode 'org-agenda-mode) (and (eq major-mode 'org-agenda-mode)
@ -212,10 +211,7 @@ This is the compiled version of the format.")
((functionp org-columns-modify-value-for-display-function) ((functionp org-columns-modify-value-for-display-function)
(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") (org-columns-compact-links val))
(concat (make-string level ?*)
" "
(org-columns-compact-links val)))
(fc (org-columns-number-to-string (fc (org-columns-number-to-string
(org-columns-string-to-number val fm) fm fc)) (org-columns-string-to-number val fm) fm fc))
((and calc (functionp calc) ((and calc (functionp calc)
@ -717,22 +713,28 @@ When COLUMNS-FMT-STRING is non-nil, use it as the column format."
(org-map-entries (org-map-entries
(lambda () (lambda ()
(cons (point) (cons (point)
(mapcar (lambda (p) (mapcar
(cons p (org-columns--value p (point)))) (lambda (p)
column-names))) (cons p
(let ((v (org-columns--value p (point))))
(if (not (equal "ITEM" p)) v
(concat (make-string (org-current-level) ?*)
" "
v)))))
column-names)))
nil nil (and org-columns-skip-archived-trees 'archive)))) nil nil (and org-columns-skip-archived-trees 'archive))))
(when cache (when cache
(setq-local org-columns-current-maxwidths (setq-local org-columns-current-maxwidths
(org-columns-get-autowidth-alist (org-columns-get-autowidth-alist
org-columns-current-fmt org-columns-current-fmt
cache)) cache))
(org-columns-display-here-title) (org-columns-display-here-title)
(when (setq-local org-columns-flyspell-was-active (when (setq-local org-columns-flyspell-was-active
(org-bound-and-true-p flyspell-mode)) (org-bound-and-true-p flyspell-mode))
(flyspell-mode 0)) (flyspell-mode 0))
(unless (local-variable-p 'org-colview-initial-truncate-line-value) (unless (local-variable-p 'org-colview-initial-truncate-line-value)
(setq-local org-colview-initial-truncate-line-value (setq-local org-colview-initial-truncate-line-value
truncate-lines)) truncate-lines))
(setq truncate-lines t) (setq truncate-lines t)
(dolist (x cache) (dolist (x cache)
(goto-char (car x)) (goto-char (car x))
@ -1430,29 +1432,34 @@ and tailing newline characters."
(let ((value (org-columns--value name (point)))) (let ((value (org-columns--value name (point))))
(cons (cons
name name
(if (and org-agenda-columns-add-appointments-to-effort-sum (cond
(not value) ((and org-agenda-columns-add-appointments-to-effort-sum
(eq (compare-strings name nil nil (not value)
org-effort-property nil nil (eq (compare-strings name nil nil
t) org-effort-property nil nil
t) t)
;; Effort property is not defined. Try t)
;; to use appointment duration. ;; Effort property is not defined. Try ;
(get-text-property (point) 'duration)) ;; to use appointment duration. ;
(org-propertize (get-text-property (point) 'duration))
(org-minutes-to-clocksum-string (org-propertize
(get-text-property (point) 'duration)) (org-minutes-to-clocksum-string
'face 'org-warning) (get-text-property (point) 'duration))
value)))) 'face 'org-warning))
((equal "ITEM" name)
(concat (make-string (org-current-level) ?*)
" "
value))
(t value)))))
names))) names)))
cache)) cache))
(forward-line))) (forward-line)))
(when cache (when cache
(setq-local org-columns-current-maxwidths (setq-local org-columns-current-maxwidths
(org-columns-get-autowidth-alist fmt cache)) (org-columns-get-autowidth-alist fmt cache))
(org-columns-display-here-title) (org-columns-display-here-title)
(when (setq-local org-columns-flyspell-was-active (when (setq-local org-columns-flyspell-was-active
(org-bound-and-true-p flyspell-mode)) (org-bound-and-true-p flyspell-mode))
(flyspell-mode 0)) (flyspell-mode 0))
(dolist (x cache) (dolist (x cache)
(goto-char (car x)) (goto-char (car x))