29 lines
1.1 KiB
EmacsLisp
29 lines
1.1 KiB
EmacsLisp
;;; ../../lyfi/configs/apps/doom/custom/unifiedlist.el -*- lexical-binding: t; -*-
|
|
|
|
(defun my/get-unified-list ()
|
|
"Combine buffers and recentf into a list for tabulated-list-mode."
|
|
(let ((items '()))
|
|
;; Add Live Buffers
|
|
(dolist (buf (buffer-list))
|
|
(with-current-buffer buf
|
|
(push (list buf (vector (buffer-name) "Live" (format-mode-line mode-name) (or (buffer-file-name) ""))) items)))
|
|
;; Add Recent Files (if not already open)
|
|
(dolist (file recentf-list)
|
|
(unless (get-file-buffer file)
|
|
(push (list file (vector (file-name-nondirectory file) "Recent" "File" file)) items)))
|
|
(nreverse items)))
|
|
|
|
(define-derived-mode my-unified-list-mode tabulated-list-mode "Unified-List"
|
|
(setq tabulated-list-format [("Name" 30 t)
|
|
("Status" 10 t)
|
|
("Mode" 15 t)
|
|
("Path" 0 t)])
|
|
(setq tabulated-list-entries #'my/get-unified-list)
|
|
(tabulated-list-init-header))
|
|
|
|
(defun my/open-unified-list ()
|
|
(interactive)
|
|
(pop-to-buffer "*Unified Switcher*")
|
|
(my-unified-list-mode)
|
|
(tabulated-list-print))
|