hbin
hbin

Reputation: 2737

Emacs reopen previous killed buffer?

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.

Upvotes: 13

Views: 1121

Answers (1)

huaiyuan
huaiyuan

Reputation: 26529

(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)

Upvotes: 12

Related Questions