Browse Source

Add tabulated

master
10sr 6 years ago
parent
commit
2c90c7836d
Signed by: 10sr GPG Key ID: 7BEC428194130EB2
1 changed files with 36 additions and 1 deletions
  1. +36
    -1
      emacs.el

+ 36
- 1
emacs.el View File

@@ -2202,7 +2202,7 @@ files to choose from. It defaults to the whole recent list.
If optional argument BUFFER-NAME is non-nil, it is a buffer name to If optional argument BUFFER-NAME is non-nil, it is a buffer name to
use for the buffer. It defaults to \"*recetf-show*\"." use for the buffer. It defaults to \"*recetf-show*\"."
(interactive) (interactive)
(let ((bf (recently-show-create-buffer files buffer-name)))
(let ((bf (recently-show--create-buffer-tabulated files buffer-name)))
(if bf (if bf
(progn (progn
;; (recently-save-list) ;; (recently-save-list)
@@ -2214,6 +2214,41 @@ use for the buffer. It defaults to \"*recetf-show*\"."
(shrink-window-if-larger-than-buffer (selected-window))) (shrink-window-if-larger-than-buffer (selected-window)))
(message "No recent file!")))) (message "No recent file!"))))


(defun recently-show--create-buffer-tabulated (&optional files buffer-name)
"Create buffer listing recently files FILES."
(let ((bname (or buffer-name
"*recently-show-tabulated*"))
(list (or files
(progn
(recently-reload)
recently-list))))
(when list
(when (get-buffer bname)
(kill-buffer bname))
(with-current-buffer (get-buffer-create bname)
(setq tabulated-list-format
`[("Name" 30 t)
("Full Path" 0 t)])
;; (setq tabulated-list-sort-key (cons "Name" nil))
(setq tabulated-list-entries
(mapcar (lambda (f)
(list f
(vector (file-name-nondirectory f) f)))
;; list
recently-list
))
(recently-show-tabulated-mode)
(current-buffer)))))

(define-derived-mode recently-show-tabulated-mode tabulated-list-mode "Recently Show"
"Major mode for browsing recently opened files and directories."
(setq tabulated-list-padding 2)
;; TODO: Implement revert
;; (add-hook 'tabulated-list-revert-hook 'recently-reload nil t)
;; TODO: Implement open
(tabulated-list-init-header)
(tabulated-list-print nil nil))

(defun recently-show-create-buffer (&optional files buffer-name) (defun recently-show-create-buffer (&optional files buffer-name)
"Create buffer listing recently files." "Create buffer listing recently files."
(let ((bname (or buffer-name (let ((bname (or buffer-name


Loading…
Cancel
Save