Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs reopen previous killed buffer?

Tags:

emacs

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.

like image 753
hbin Avatar asked May 01 '12 06:05

hbin


1 Answers

(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)
like image 163
huaiyuan Avatar answered Oct 19 '22 17:10

huaiyuan