如何获取GNU Emacs中的最近文件列表?

时间:2020-03-05 18:49:35  来源:igfitidea点击:

当我使用Emacs时,我希望能够轻松地显示和浏览我从当前会话开始但在以前的会话中工作的文件列表。 (顺便说一句,在Windows上运行Emacs 22.2)

解决方案

回答

从Joe Grossberg的博客(不再可用)中:

But if you're using GNU Emacs 21.2
  (the latest version, which includes
  this as part of the standard distro),
  you can just put the following lines
  into your .emacs file

;; recentf stuff
(require 'recentf)
(recentf-mode 1)
(setq recentf-max-menu-items 25)
(global-set-key "\C-x\ \C-r" 'recentf-open-files)

  
  Then, when you launch emacs, hit
  `CTRL`-`X` `CTRL`-`R`. It will show a list of
  the recently-opened files in a buffer.
  Move the cursor to a line and press
  `ENTER`. That will open the file in
  question, and move it to the top of
  your recent-file list.
  
  (Note: Emacs records file names.
  Therefore, if you move or rename a
  file outside of Emacs, it won't
  automatically update the list. You'll
  have to open the renamed file with the
  normal `CTRL`-`X` `CTRL`-`F` method.)
  
  Jayakrishnan Varnam has a page
  including screenshots of how this
  package works.

注意:我们不需要`(requiref')。