| @@ -1974,14 +1974,14 @@ read." | |||||
| ;; ) | ;; ) | ||||
| ;;;###autoload | ;;;###autoload | ||||
| (defun recently-show (&optional files buffer-name) | |||||
| (defun recently-show (&optional buffer-name) | |||||
| "Show simplified list of recently opened files. | "Show simplified list of recently opened files. | ||||
| If optional argument FILES is non-nil, it is a list of recently-opened | |||||
| 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*\"." | ||||
| ;; If optional argument FILES is non-nil, it is a list of recently-opened | |||||
| ;; files to choose from. It defaults to the whole recent list. | |||||
| (interactive) | (interactive) | ||||
| (let ((bf (recently-show--create-buffer-tabulated files buffer-name))) | |||||
| (let ((bf (recently-show--create-buffer-tabulated buffer-name))) | |||||
| (if bf | (if bf | ||||
| (progn | (progn | ||||
| ;; (recently-save-list) | ;; (recently-save-list) | ||||
| @@ -1993,26 +1993,21 @@ use for the buffer. It defaults to \"*recetf-show*\"." | |||||
| ) | ) | ||||
| (message "No recent file!")))) | (message "No recent file!")))) | ||||
| (defun recently-show--create-buffer-tabulated (&optional files buffer-name) | |||||
| "Create buffer listing recently files FILES." | |||||
| (setq files | |||||
| (or files | |||||
| (progn | |||||
| (recently-reload) | |||||
| recently-list))) | |||||
| (defun recently-show--create-buffer-tabulated (&optional buffer-name) | |||||
| "Create buffer listing recently files." | |||||
| (let ((bname (or buffer-name | (let ((bname (or buffer-name | ||||
| "*recently-show-tabulated*"))) | "*recently-show-tabulated*"))) | ||||
| (when files | |||||
| (when (get-buffer bname) | |||||
| (kill-buffer bname)) | |||||
| (with-current-buffer (get-buffer-create bname) | |||||
| ;; (setq tabulated-list-sort-key (cons "Name" nil)) | |||||
| (recently-show--set-tabulated-list-mode-variables files) | |||||
| (recently-show-tabulated-mode) | |||||
| (current-buffer))))) | |||||
| (defun recently-show--set-tabulated-list-mode-variables (files) | |||||
| "Set variables for `tabulated-list-mode'. to use FILES." | |||||
| (when (get-buffer bname) | |||||
| (kill-buffer bname)) | |||||
| (with-current-buffer (get-buffer-create bname) | |||||
| ;; (setq tabulated-list-sort-key (cons "Name" nil)) | |||||
| (recently-show--set-tabulated-list-mode-variables) | |||||
| (recently-show-tabulated-mode) | |||||
| (current-buffer)))) | |||||
| (defun recently-show--set-tabulated-list-mode-variables () | |||||
| "Set variables for `tabulated-list-mode'." | |||||
| (recently-reload) | |||||
| (setq tabulated-list-entries | (setq tabulated-list-entries | ||||
| (mapcar (lambda (f) | (mapcar (lambda (f) | ||||
| (list f | (list f | ||||
| @@ -2020,7 +2015,7 @@ use for the buffer. It defaults to \"*recetf-show*\"." | |||||
| (if recently-show-abbreviate | (if recently-show-abbreviate | ||||
| (abbreviate-file-name f) | (abbreviate-file-name f) | ||||
| f)))) | f)))) | ||||
| files | |||||
| recently-list | |||||
| )) | )) | ||||
| (let ((max | (let ((max | ||||
| (apply 'max | (apply 'max | ||||
| @@ -2057,8 +2052,10 @@ use for the buffer. It defaults to \"*recetf-show*\"." | |||||
| (define-derived-mode recently-show-tabulated-mode tabulated-list-mode "Recently Show" | (define-derived-mode recently-show-tabulated-mode tabulated-list-mode "Recently Show" | ||||
| "Major mode for browsing recently opened files and directories." | "Major mode for browsing recently opened files and directories." | ||||
| (setq tabulated-list-padding 2) | (setq tabulated-list-padding 2) | ||||
| ;; TODO: Implement revert | |||||
| ;; (add-hook 'tabulated-list-revert-hook 'recently-reload nil t) | |||||
| (add-hook 'tabulated-list-revert-hook | |||||
| 'recently-show--set-tabulated-list-mode-variables | |||||
| nil | |||||
| t) | |||||
| (tabulated-list-init-header) | (tabulated-list-init-header) | ||||
| (tabulated-list-print nil nil)) | (tabulated-list-print nil nil)) | ||||