Function: xref--alistify
xref--alistify is a byte-compiled function defined in xref.el.gz.
Signature
(xref--alistify LIST KEY)
Documentation
Partition the elements of LIST into an alist.
KEY extracts the key from an element.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/xref.el.gz
;;; misc utilities
(defun xref--alistify (list key)
"Partition the elements of LIST into an alist.
KEY extracts the key from an element."
(let ((table (make-hash-table :test #'equal)))
(dolist (e list)
(let* ((k (funcall key e))
(probe (gethash k table)))
(if probe
(puthash k (cons e probe) table)
(puthash k (list e) table))))
;; Put them back in order.
(cl-loop for key being hash-keys of table using (hash-values value)
collect (cons key (nreverse value)))))