Skip to content

Instantly share code, notes, and snippets.

@rmcm
Created July 24, 2010 04:43
Show Gist options
  • Save rmcm/488405 to your computer and use it in GitHub Desktop.
Save rmcm/488405 to your computer and use it in GitHub Desktop.
ido recent files or directories
; ----------------------------------------
; recent files and directories
; ----------------------------------------
(require 'recentf)
(setq
recentf-exclude '(".*_flymake.*" ".ftp:.*" ".sudo:.*" "~/.emacs.d/tmp/*")
recentf-keep '(file-remote-p file-readable-p)
recentf-max-saved-items 100 ; this was set to 500, and things were slow
recentf-save-file "~/.emacs.d/save-recentf.el")
(recentf-mode t)
(defun my-ido-find-file ()
"Find a recent file using Ido."
(interactive)
(let ((file (ido-completing-read "Choose recent file: " recentf-list nil t)))
(when file
(find-file file))))
(defun my-ido-find-dired ()
"Find a recent directory using Ido."
(interactive)
(let ((dir (ido-completing-read
"Choose recent directory: "
(delete-dups (mapcar 'file-name-directory recentf-list)) nil t)))
(when dir
(find-file dir))))
(global-set-key (kbd "C-c e r") 'my-ido-find-file)
(global-set-key (kbd "C-c e d") 'my-ido-find-dired)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment