13

Any add-on to reopen the last killed buffer/file? Just like the C-S-t do in firefox.

I know about that recentf-mode can remember the recent visited files history.

hbin
  • 2,657
  • 1
  • 23
  • 23
  • 4
    This can't really work in general--what if you had some process running in your buffer? Would it restart the process (and potentially do some side-effect twice) or give you a buffer without a process attached? Neither solution sounds particularly good. – Tikhon Jelvis May 01 '12 at 06:12
  • There is kill buffer hook. It should be possible to build and maintain a list of killed buffers. With the help of this list the recently killed buffers should be accessible. no? – Matthias May 01 '12 at 12:04

1 Answers1

12
(require 'cl)
(require 'recentf)

(defun find-last-killed-file ()
  (interactive)
  (let ((active-files (loop for buf in (buffer-list)
                            when (buffer-file-name buf) collect it)))
    (loop for file in recentf-list
          unless (member file active-files) return (find-file file))))

(define-key global-map (kbd "C-S-t") 'find-last-killed-file)
huaiyuan
  • 26,129
  • 5
  • 57
  • 63