Function: org-columns-new
org-columns-new is an interactive and byte-compiled function defined
in org-colview.el.gz.
Signature
(org-columns-new &optional SPEC &rest ATTRIBUTES)
Documentation
Insert a new column, to the left of the current column.
Interactively fill attributes for new column. When column format specification SPEC is provided, edit it instead.
When optional argument attributes can be a list of columns
specifications attributes to create the new column
non-interactively. See org-columns-compile-format for
details.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-colview.el.gz
(defun org-columns-new (&optional spec &rest attributes)
"Insert a new column, to the left of the current column.
Interactively fill attributes for new column. When column format
specification SPEC is provided, edit it instead.
When optional argument attributes can be a list of columns
specifications attributes to create the new column
non-interactively. See `org-columns-compile-format' for
details."
(interactive)
(let ((new (or attributes
(let ((prop
(completing-read
"Property: "
(mapcar #'list (org-buffer-property-keys t nil t))
nil nil (nth 0 spec))))
(list prop
(read-string (format "Column title [%s]: " prop)
(nth 1 spec))
;; Use `read-string' instead of `read-number'
;; to allow empty width.
(let ((w (read-string
"Column width: "
(and (nth 2 spec)
(number-to-string (nth 2 spec))))))
(and (org-string-nw-p w) (string-to-number w)))
(org-string-nw-p
(completing-read
"Summary: "
(delete-dups
(cons '("") ;Allow empty operator.
(mapcar (lambda (x) (list (car x)))
(append
org-columns-summary-types
org-columns-summary-types-default))))
nil t (nth 3 spec)))
(org-string-nw-p
(read-string "Format: " (nth 4 spec))))))))
(if spec
(progn (setcar spec (car new))
(setcdr spec (cdr new)))
(push new (nthcdr (org-current-text-column) org-columns-current-fmt-compiled)))
(org-columns-store-format)
(org-columns-redo)))