Function: org-agenda-columns

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

Signature

(org-agenda-columns)

Documentation

Turn on or update column view in the agenda.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-colview.el.gz
;;; Column view in the agenda

;;;###autoload
(defun org-agenda-columns ()
  "Turn on or update column view in the agenda."
  (interactive)
  (org-columns-remove-overlays)
  (if (markerp org-columns-begin-marker)
      (move-marker org-columns-begin-marker (point))
    (setq org-columns-begin-marker (point-marker)))
  (let* ((org-columns--time (float-time))
	 (org-done-keywords org-done-keywords-for-agenda)
	 (fmt
	  (cond
	   ((bound-and-true-p org-overriding-columns-format))
	   ((bound-and-true-p org-local-columns-format))
	   ((bound-and-true-p org-columns-default-format-for-agenda))
	   ((let ((m (org-get-at-bol 'org-hd-marker)))
	      (and m
		   (or (org-entry-get m "COLUMNS" t)
		       (with-current-buffer (marker-buffer m)
			 org-columns-default-format)))))
	   ((and (local-variable-p 'org-columns-current-fmt)
		 org-columns-current-fmt))
	   ((let ((m (next-single-property-change (point-min) 'org-hd-marker)))
	      (and m
		   (let ((m (get-text-property m 'org-hd-marker)))
		     (or (org-entry-get m "COLUMNS" t)
			 (with-current-buffer (marker-buffer m)
			   org-columns-default-format))))))
	   (t org-columns-default-format)))
	 (compiled-fmt (org-columns-compile-format fmt)))
    (setq org-columns-current-fmt fmt)
    (when org-agenda-columns-compute-summary-properties
      (org-agenda-colview-compute org-columns-current-fmt-compiled))
    (save-excursion
      ;; Collect properties for each headline in current view.
      (goto-char (point-min))
      (let (cache)
	(while (not (eobp))
	  (let ((m (org-get-at-bol 'org-hd-marker)))
	    (when m
	      (push (cons (line-beginning-position)
			  ;; `org-columns-current-fmt-compiled' is
			  ;; initialized but only set locally to the
			  ;; agenda buffer.  Since current buffer is
			  ;; changing, we need to force the original
			  ;; compiled-fmt there.
			  (org-with-point-at m
			    (org-columns--collect-values compiled-fmt)))
		    cache)))
	  (forward-line))
	(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))
	  (dolist (entry cache)
	    (goto-char (car entry))
	    (org-columns--display-here (cdr entry)))
	  (setq-local org-agenda-columns-active t)
	  (when org-agenda-columns-show-summaries
	    (org-agenda-colview-summarize cache)))))))