clinspect: Auto-compute column width.
parent
0f0b64f284
commit
25ba3e0868
|
@ -5,11 +5,27 @@
|
||||||
|
|
||||||
(require 'cl-lib)
|
(require 'cl-lib)
|
||||||
|
|
||||||
(defun clinspect--tabulated-list-format (header _data)
|
(defvar clinspect-column-max-width 40)
|
||||||
;; TODO: Use data to compute the column size.
|
|
||||||
(apply #'vector (mapcar (lambda (column)
|
(defun clinspect--tabulated-list-format (header entries)
|
||||||
(list column 12 t . nil))
|
(apply #'vector (mapcar (lambda (index)
|
||||||
header)))
|
(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"
|
(define-derived-mode clinspect-mode tabulated-list-mode "Clinspect"
|
||||||
"Mode to inspect Common Lisp sequences."
|
"Mode to inspect Common Lisp sequences."
|
||||||
|
|
Loading…
Reference in New Issue