Здесь возможно два решения (в зависимости от точности прецедента вы хотите).
(defun zin/open-recent-file()
"Open the most recent currently closed file.
This will omit currently open files, instead it will retrieve the
next oldest file in recentf-list."
(interactive)
(let* ((count 0)
(recent recentf-list)
(r-length (length recent))
(buffers (mapcar 'buffer-file-name (buffer-list))))
;; Compare next file on the list to open buffers, if open skip it.
(while (member (nth count recent)
buffers)
(setq count (1+ count))
(if (= r-length count)
(error "All recent buffers already open")))
(find-file (nth count recent))))
(lexical-let ((recent-count 0))
(defun zin/visit-recent-file()
"Visit files on the recentf-list in descending order.
This will work backwards through recentf-list visiting each file
in turn."
(interactive)
;; If last command was not to cycle through the files, then start
;; back at the first in the list.
(unless (eq last-command 'zin/visit-recent-file)
(setq recent-count 0))
;; If current buffer is the current entry on the list, increment.
(if (equal (buffer-file-name) (nth 0 recentf-list))
(setq recent-count (1+ recent-count)))
;; Error if all entries have been processed
(if (= recent-count (length recentf-list))
(error "At oldest recent buffer"))
;; Open appropriate file.
(find-file (nth recent-count recentf-list))))
Первый будут проходить через список последних файлов (recentf-list
) и откройте следующий нераскрытый файл. Второй будет использовать recentf-list
для перехода к следующему буфере в списке, пока все не будут посещены, а затем вычеркните ошибку (поскольку порядок списка изменится по мере возобновления файлов).
Чтобы его перезапустить велосипедный, когда он доходит до конца, просто изменить (error ...)
к
(setq recent-count 0)
Так как мы определение «Browse» в «просматривать реальные файлы»? – phils
Посетите файлы в буфере. Таким образом, нажатие клавиши (например, A-down) откроет последний открытый файл, и повторное обращение к нему снова посетит следующий последний и т. Д. – incandescentman