clinspect: Auto-compute column width.
parent
0f0b64f284
commit
25ba3e0868
|
@ -5,11 +5,27 @@
|
|||
|
||||
(require 'cl-lib)
|
||||
|
||||
(defun clinspect--tabulated-list-format (header _data)
|
||||
;; TODO: Use data to compute the column size.
|
||||
(apply #'vector (mapcar (lambda (column)
|
||||
(list column 12 t . nil))
|
||||
header)))
|
||||
(defvar clinspect-column-max-width 40)
|
||||
|
||||
(defun clinspect--tabulated-list-format (header entries)
|
||||
(apply #'vector (mapcar (lambda (index)
|
||||
(let ((column (nth index header)))
|
||||
(list column
|
||||
(min clinspect-column-max-width
|
||||
(max (length column)
|
||||
(apply #'max (mapcar
|
||||
(lambda (entry)
|
||||
(length (prin1-to-string
|
||||
(nth index entry))))
|
||||
entries))))
|
||||
t
|
||||
;; (if (numberp (nth index (car data)))
|
||||
;; (lambda (a b)
|
||||
;; (< (nth index a)
|
||||
;; (nth index b)))
|
||||
;; t)
|
||||
)))
|
||||
(number-sequence 0 (1- (length header))))))
|
||||
|
||||
(define-derived-mode clinspect-mode tabulated-list-mode "Clinspect"
|
||||
"Mode to inspect Common Lisp sequences."
|
||||
|
|
Loading…
Reference in New Issue