Sometimes I got itchy finger and kill some buffer that I meant to bury instead. The problem is, I use tramp to edit files from multiple machines, and those file names get long and nasty and just in general I'm not that good at finding where my files are anyways. So I would like to have emacs keep track of the files I just closed so that I can re-open them easily (via, ideally, an ido prompt).
Here is what I have so far, which is not working:
(defvar closed-files '())
(defun track-closed-file ()
(message buffer-file-name)
(and buffer-file-name
(cons buffer-file-name closed-files)))
(defun last-closed-files ()
(interactive)
(find-file (ido-completing-read "Last closed: " closed-files)))
(add-hook 'kill-buffer-hook 'track-closed-file)
I'm really not great at elisp and probably mess up somewhere in defining the variable and adding cell to it...
[I do know about recentf
, but that keeps track of opened files, instead of closed files.]