Function: org-columns

org-columns is an autoloaded, interactive and byte-compiled function defined in org-colview.el.gz.

Signature

(org-columns &optional GLOBAL COLUMNS-FMT-STRING)

Documentation

Turn on column view on an Org mode file.

Column view applies to the whole buffer if point is before the first headline. Otherwise, it applies to the first ancestor setting
"COLUMNS" property. If there is none, it defaults to the current
headline. With a C-u (universal-argument) prefix argument, GLOBAL, turn on column view for the whole buffer unconditionally.

When COLUMNS-FMT-STRING is non-nil, use it as the column format.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-colview.el.gz
;;;###autoload
(defun org-columns (&optional global columns-fmt-string)
  "Turn on column view on an Org mode file.

Column view applies to the whole buffer if point is before the first
headline.  Otherwise, it applies to the first ancestor setting
\"COLUMNS\" property.  If there is none, it defaults to the current
headline.  With a `\\[universal-argument]' prefix \ argument, GLOBAL,
turn on column view for the whole buffer unconditionally.

When COLUMNS-FMT-STRING is non-nil, use it as the column format."
  (interactive "P")
  (org-columns-remove-overlays)
  (save-excursion
    (when global (goto-char (point-min)))
    (if (markerp org-columns-begin-marker)
	(move-marker org-columns-begin-marker (point))
      (setq org-columns-begin-marker (point-marker)))
    (org-columns-goto-top-level)
    ;; Initialize `org-columns-current-fmt' and
    ;; `org-columns-current-fmt-compiled'.
    (let ((org-columns--time (float-time)))
      (org-columns-get-format columns-fmt-string)
      (unless org-columns-inhibit-recalculation (org-columns-compute-all))
      (save-restriction
	(when (and (not global) (org-at-heading-p))
	  (narrow-to-region (point) (org-end-of-subtree t t)))
	(when (assoc "CLOCKSUM" org-columns-current-fmt-compiled)
	  (org-clock-sum))
	(when (assoc "CLOCKSUM_T" org-columns-current-fmt-compiled)
	  (org-clock-sum-today))
	(let ((cache
	       ;; Collect contents of columns ahead of time so as to
	       ;; compute their maximum width.
               (org-scan-tags
		(lambda () (cons (point) (org-columns--collect-values))) t org--matcher-tags-todo-only)))
	  (when cache
	    (org-columns--set-widths cache)
	    (org-columns--display-here-title)
	    (when (setq-local org-columns-flyspell-was-active
			      (bound-and-true-p flyspell-mode))
	      (flyspell-mode 0))
	    (unless (local-variable-p 'org-colview-initial-truncate-line-value)
	      (setq-local org-colview-initial-truncate-line-value
			  truncate-lines))
            (if (not global-visual-line-mode)
                (setq truncate-lines t))
	    (dolist (entry cache)
	      (goto-char (car entry))
	      (org-columns--display-here (cdr entry)))))))))