Skip to content

Instantly share code, notes, and snippets.

@dsjt
Created May 7, 2015 12:50
Show Gist options
  • Save dsjt/b87210618caead2c9418 to your computer and use it in GitHub Desktop.
Save dsjt/b87210618caead2c9418 to your computer and use it in GitHub Desktop.
(require 'recentf)
(require 'dired-open)
;;;###autoload
(defun my-add-recentf-in-dired ()
"Add a file to the recentf list when you try to open the file using dired-open.el."
(interactive)
(let ((file (dired-get-filename)))
(when file
(recentf-add-file file)))
nil)
(add-hook 'dired-open-functions 'my-add-recentf-in-dired)
(add-to-list 'recentf-used-hooks '(dired-open-functions my-add-recentf-in-dired))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment