Difference between revisions of "Recentf"

From WikEmacs
Jump to: navigation, search
(followup to previous)
(How to make use Ido for accessing recent files?: revise, add some alternatives)
Line 20: Line 20:
 
==Customization==
 
==Customization==
  
=== How to make use [[Ido]] for accessing recent files? ===
+
=== Alternative Ways to Access Recent Files ===
  
{{Note| The following snippet binding {{Keys|M-f11}}. change
+
There are a variety of ways to use the recent file list maintained by [[Recentf]].
for according to your [[Global key binding | taste]] }}
+
 
 +
==== Use Ido selection ====
 +
 
 +
To use [[Ido]] selection to choose a recent file, add the following function to your {{EmacsConfigFile}} and bind it to your preferred [[Key Bindings|key sequence]]. This example uses {{Keys|C-c f}}.
  
 
<syntaxhighlight lang="lisp">
 
<syntaxhighlight lang="lisp">
(defun steve-ido-choose-from-recentf ()
+
(defun ido-choose-from-recentf ()
   "Use ido to select a recently opened file from the `recentf-list'"
+
   "Use ido to select a recently visited file from the `recentf-list'"
 
   (interactive)
 
   (interactive)
 
   (find-file (ido-completing-read "Open file: " recentf-list nil t)))
 
   (find-file (ido-completing-read "Open file: " recentf-list nil t)))
  
   ;;; bind it to "M-f11"
+
   ;;; bind it to "C-c f"
(global-set-key [(meta f11)] 'steve-ido-choose-from-recentf)
+
(global-set-key (kbd "C-c f") 'ido-choose-from-recentf)
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
==== Show recent files when switching buffers ====
 +
 +
If you use [[Ido]] to switch buffers, there is an option to include recent files at the end of the buffer list. Try {{CustomizeVariable|ido-use-virtual-buffers}}.
 +
 +
==== Use Helm selection ====
 +
 +
You can use [[Helm]] to select a recent file, see {{Command|helm-recentf}}.
  
 
== See Also ==
 
== See Also ==

Revision as of 21:16, 1 April 2012

recentf
Description helps opening a file that is recently visited
Author David Ponce
Maintainer FSF
Source http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/recentf.el
Part of Emacs yes

recentf helps you to open files that are recently accessed.This package maintains a menu for visiting files that were operated on recently. When enabled a new "Open Recent" sub menu is displayed in the "File" menu. The recent files list is automatically saved across Emacs sessions. You can customize the number of recent files displayed, the location of the menu and others options (see the source code for details).


Basic setup

To enable this package, add the following to your .emacs

 (recentf-mode 1)

Customization

Alternative Ways to Access Recent Files

There are a variety of ways to use the recent file list maintained by Recentf.

Use Ido selection

To use Ido selection to choose a recent file, add the following function to your Emacs configuration file and bind it to your preferred key sequence. This example uses [C-c f].

(defun ido-choose-from-recentf ()
  "Use ido to select a recently visited file from the `recentf-list'"
  (interactive)
  (find-file (ido-completing-read "Open file: " recentf-list nil t)))
 
  ;;; bind it to "C-c f"
(global-set-key (kbd "C-c f") 'ido-choose-from-recentf)

Show recent files when switching buffers

If you use Ido to switch buffers, there is an option to include recent files at the end of the buffer list. Try M-x customize-variable RET ido-use-virtual-buffers.

Use Helm selection

You can use Helm to select a recent file, see M-x helm-recentf.

See Also

Bookmarks