Function: recentf-mode

recentf-mode is an autoloaded, interactive and byte-compiled function defined in recentf.el.gz.

Signature

(recentf-mode &optional ARG)

Documentation

Toggle "Open Recent" menu (Recentf mode).

This is a minor mode. If called interactively, toggle the Recentf mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate (default-value \=recentf-mode)'.

The mode's hook is called both when the mode is enabled and when it is disabled.

When Recentf mode is enabled, a "Open Recent" submenu is displayed in the "File" menu, containing a list of files that were operated on recently, in the most-recently-used order.

By default, only operations like opening a file, writing a buffer to a file, and killing a buffer is counted as "operating" on the file. If instead you want to prioritize files that appear in buffers you switch to a lot, you can say something like the following:

  (add-hook 'buffer-list-update-hook 'recentf-track-opened-file)

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/recentf.el.gz
;;;###autoload
(define-minor-mode recentf-mode
  "Toggle \"Open Recent\" menu (Recentf mode).

When Recentf mode is enabled, a \"Open Recent\" submenu is
displayed in the \"File\" menu, containing a list of files that
were operated on recently, in the most-recently-used order.

By default, only operations like opening a file, writing a buffer
to a file, and killing a buffer is counted as \"operating\" on
the file.  If instead you want to prioritize files that appear in
buffers you switch to a lot, you can say something like the following:

  (add-hook 'buffer-list-update-hook 'recentf-track-opened-file)"
  :global t
  :group 'recentf
  :keymap recentf-mode-map
  (unless (and recentf-mode (recentf-enabled-p))
    (if recentf-mode
        (progn
          (recentf-load-list)
          (recentf-show-menu))
      (recentf-hide-menu)
      (recentf-save-list))
    (recentf-auto-cleanup)
    (let ((hook-setup (if recentf-mode 'add-hook 'remove-hook)))
      (dolist (hook recentf-used-hooks)
        (apply hook-setup hook)))))