forked from mirrors/org-mode
org-colview: Handle user-defined inheritance
* lisp/org-colview.el (org-columns): Rely on `org-entry-get' instead of `org-entry-properties' in order to handle inheritance properly. Also limit search to properties actually used as columns instead of all properties. Reported-by: Nik Clayton <nik@ngo.org.uk> <http://permalink.gmane.org/gmane.emacs.orgmode/98091>
This commit is contained in:
parent
b42642f244
commit
0f93638ce1
|
@ -671,49 +671,48 @@ When COLUMNS-FMT-STRING is non-nil, use it as the column format."
|
||||||
(org-verify-version 'columns)
|
(org-verify-version 'columns)
|
||||||
(org-columns-remove-overlays)
|
(org-columns-remove-overlays)
|
||||||
(move-marker org-columns-begin-marker (point))
|
(move-marker org-columns-begin-marker (point))
|
||||||
(let ((org-columns-time (time-to-number-of-days (current-time)))
|
(org-columns-goto-top-level)
|
||||||
beg end fmt cache maxwidths)
|
;; Initialize `org-columns-current-fmt' and
|
||||||
(org-columns-goto-top-level)
|
;; `org-columns-current-fmt-compiled'.
|
||||||
(setq fmt (org-columns-get-format columns-fmt-string))
|
(let ((org-columns-time (time-to-number-of-days (current-time))))
|
||||||
(save-excursion
|
(org-columns-get-format columns-fmt-string))
|
||||||
(goto-char org-columns-top-level-marker)
|
(unless org-columns-inhibit-recalculation (org-columns-compute-all))
|
||||||
(setq beg (point))
|
(save-excursion
|
||||||
(unless org-columns-inhibit-recalculation
|
(save-restriction
|
||||||
(org-columns-compute-all))
|
(narrow-to-region
|
||||||
(setq end (or (condition-case nil (org-end-of-subtree t t) (error nil))
|
org-columns-top-level-marker
|
||||||
(point-max)))
|
(or (ignore-errors (org-end-of-subtree t t)) (point-max)))
|
||||||
;; Get and cache the properties
|
(goto-char (point-min))
|
||||||
(goto-char beg)
|
|
||||||
(when (assoc "CLOCKSUM" org-columns-current-fmt-compiled)
|
(when (assoc "CLOCKSUM" org-columns-current-fmt-compiled)
|
||||||
(save-excursion
|
(org-clock-sum))
|
||||||
(save-restriction
|
|
||||||
(narrow-to-region beg end)
|
|
||||||
(org-clock-sum))))
|
|
||||||
(when (assoc "CLOCKSUM_T" org-columns-current-fmt-compiled)
|
(when (assoc "CLOCKSUM_T" org-columns-current-fmt-compiled)
|
||||||
(save-excursion
|
(org-clock-sum-today))
|
||||||
(save-restriction
|
(let* ((column-names (mapcar #'car org-columns-current-fmt-compiled))
|
||||||
(narrow-to-region beg end)
|
(cache
|
||||||
(org-clock-sum-today))))
|
(org-map-entries
|
||||||
(while (re-search-forward org-outline-regexp-bol end t)
|
(lambda ()
|
||||||
(if (and org-columns-skip-archived-trees
|
(cons (org-current-line)
|
||||||
(looking-at (concat ".*:" org-archive-tag ":")))
|
(mapcar
|
||||||
(org-end-of-subtree t)
|
(lambda (p)
|
||||||
(push (cons (org-current-line) (org-entry-properties)) cache)))
|
(cons p (org-entry-get nil p 'selective t)))
|
||||||
(when cache
|
column-names)))
|
||||||
(setq maxwidths (org-columns-get-autowidth-alist fmt cache))
|
nil nil (and org-columns-skip-archived-trees 'archive))))
|
||||||
(org-set-local 'org-columns-current-maxwidths maxwidths)
|
(when cache
|
||||||
(org-columns-display-here-title)
|
(org-set-local 'org-columns-current-maxwidths
|
||||||
(when (org-set-local 'org-columns-flyspell-was-active
|
(org-columns-get-autowidth-alist
|
||||||
(org-bound-and-true-p flyspell-mode))
|
org-columns-current-fmt
|
||||||
(flyspell-mode 0))
|
cache))
|
||||||
(unless (local-variable-p 'org-colview-initial-truncate-line-value)
|
(org-columns-display-here-title)
|
||||||
(org-set-local 'org-colview-initial-truncate-line-value
|
(when (org-set-local 'org-columns-flyspell-was-active
|
||||||
truncate-lines))
|
(org-bound-and-true-p flyspell-mode))
|
||||||
(setq truncate-lines t)
|
(flyspell-mode 0))
|
||||||
(mapc (lambda (x)
|
(unless (local-variable-p 'org-colview-initial-truncate-line-value)
|
||||||
(org-goto-line (car x))
|
(org-set-local 'org-colview-initial-truncate-line-value
|
||||||
(org-columns-display-here (cdr x)))
|
truncate-lines))
|
||||||
cache)))))
|
(setq truncate-lines t)
|
||||||
|
(dolist (x cache)
|
||||||
|
(org-goto-line (car x))
|
||||||
|
(org-columns-display-here (cdr x))))))))
|
||||||
|
|
||||||
(eval-when-compile (defvar org-columns-time))
|
(eval-when-compile (defvar org-columns-time))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue