Function: tabulated-list--sort-by-column-name

tabulated-list--sort-by-column-name is a byte-compiled function defined in tabulated-list.el.gz.

Signature

(tabulated-list--sort-by-column-name NAME)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/tabulated-list.el.gz
(defun tabulated-list--sort-by-column-name (name)
  (when (and name (derived-mode-p 'tabulated-list-mode))
    (unless tabulated-list--original-order
      ;; Store the original order so that we can restore it later.
      (setq tabulated-list--original-order (make-hash-table))
      (cl-loop for elem in tabulated-list-entries
               for i from 0
               do (setf (gethash elem tabulated-list--original-order) i)))
    ;; Flip the sort order on a second click.
    (if (equal name (car tabulated-list-sort-key))
	(setcdr tabulated-list-sort-key
		(not (cdr tabulated-list-sort-key)))
      (setq tabulated-list-sort-key (cons name nil)))
    (tabulated-list-init-header)
    (tabulated-list-print t)))