Function: tabulated-list-set-col
tabulated-list-set-col is a byte-compiled function defined in
tabulated-list.el.gz.
Signature
(tabulated-list-set-col COL DESC &optional CHANGE-ENTRY-DATA)
Documentation
Change the Tabulated List entry at point, setting COL to DESC.
COL is the column number to change, or the name of the column to change.
DESC is the new column descriptor, which is inserted via
tabulated-list-print-col.
If CHANGE-ENTRY-DATA is non-nil, modify the underlying entry data
by setting the appropriate slot of the vector originally used to
print this entry. If tabulated-list-entries has a list value,
this is the vector stored within it.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/tabulated-list.el.gz
(defun tabulated-list-set-col (col desc &optional change-entry-data)
"Change the Tabulated List entry at point, setting COL to DESC.
COL is the column number to change, or the name of the column to change.
DESC is the new column descriptor, which is inserted via
`tabulated-list-print-col'.
If CHANGE-ENTRY-DATA is non-nil, modify the underlying entry data
by setting the appropriate slot of the vector originally used to
print this entry. If `tabulated-list-entries' has a list value,
this is the vector stored within it."
(let* ((opoint (point))
(eol (line-end-position))
(pos (line-beginning-position))
(id (tabulated-list-get-id pos))
(entry (tabulated-list-get-entry pos))
(prop 'tabulated-list-column-name)
(inhibit-read-only t)
name)
(cond ((numberp col)
(setq name (car (aref tabulated-list-format col))))
((stringp col)
(setq name col
col (tabulated-list--column-number col)))
(t
(error "Invalid column %s" col)))
(unless entry
(error "No Tabulated List entry at position %s" opoint))
(unless (equal (get-text-property pos prop) name)
(while (and (setq pos
(next-single-property-change pos prop nil eol))
(< pos eol)
(not (equal (get-text-property pos prop) name)))))
(when (< pos eol)
(delete-region pos (next-single-property-change pos prop nil eol))
(goto-char pos)
(let ((tabulated-list--near-rows
(list
(tabulated-list-get-entry (point-at-bol 0))
entry
(or (tabulated-list-get-entry (point-at-bol 2)) entry))))
(tabulated-list-print-col col desc (current-column)))
(if change-entry-data
(aset entry col desc))
(put-text-property pos (point) 'tabulated-list-id id)
(put-text-property pos (point) 'tabulated-list-entry entry)
(goto-char opoint))))