1

I've not found any straightforward way to re-visit a file whose buffer I just killed. Sort of like undoing the killing of the buffer.

I thought about getting the file's path from Ido's virtual buffers list: if you use recentf and set ido-use-virtual-buffers to t, after invoking ido-switch-buffers Ido shows the buffer names of recently closed file buffers (not Help buffers or other buffer's that weren't visiting a file), fontified using the face ido-virtual. I need the first one of those files, but I can't find a way to retrieve it.

Arch Stanton
  • 1,657
  • 11
  • 23

1 Answers1

-1

You tagged your question with the recentf tag, but did you know what it meant? To quote the package documentation:

This package maintains a list of recently opened files and makes it easy to visit them. The recent files list is automatically saved across Emacs sessions.

There are three ways to access recent files:

(1) M-x recentf-open prompts for a recently opened file.

(2) When this mode is enabled, a new “Open Recent” submenu is displayed in the “File” menu.

(3) M-x recentf-open-files lists recently visited files in a buffer.

You can customize the number of recent files displayed, the location of the menu and other options. Type:

M-x customize-group RET recentf RET

To enable this package, add this line to your Init file:

(recentf-mode 1)

You may wish to peruse chapter 19.18 Convenience Features for Finding Files in the Emacs manual.

db48x
  • 17,977
  • 1
  • 22
  • 28
  • 1
    To answer the question you'd need to say how to use recentf to visit the last-closed file. How to tell which is the last one closed? It's not clear what OP even means by "close" a file, in Emacs: kill its buffer? close its window? – Drew Mar 11 '24 at 23:59
  • I tagged it recentf because Ido uses recentf-list to create its list of virtual buffers. – Arch Stanton Mar 12 '24 at 09:31