;;; recentf.el --- setup a menu of recently opened files
-;; Copyright (C) 1999-2011 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2015 Free Software Foundation, Inc.
;; Author: David Ponce <david@dponce.com>
;; Created: July 19 1999
:group 'recentf
:type 'integer)
-(defcustom recentf-save-file (convert-standard-filename "~/.recentf")
+(defcustom recentf-save-file (locate-user-emacs-file "recentf" ".recentf")
"File to save the recent list into."
:group 'recentf
+ :version "24.4"
:type 'file
:initialize 'custom-initialize-default
:set (lambda (symbol value)
(checks recentf-exclude)
(keepit t))
(while (and checks keepit)
- (setq keepit (condition-case nil
- (not (if (stringp (car checks))
- ;; A regexp
- (string-match (car checks) filename)
- ;; A predicate
- (funcall (car checks) filename)))
- (error nil))
+ ;; If there was an error in a predicate, err on the side of
+ ;; keeping the file. (Bug#5843)
+ (setq keepit (not (ignore-errors
+ (if (stringp (car checks))
+ ;; A regexp
+ (string-match (car checks) filename)
+ ;; A predicate
+ (funcall (car checks) filename))))
checks (cdr checks)))
keepit))
(if (and l (functionp filter))
(let ((case-fold-search recentf-case-fold-search)
elts others)
- ;; split L into two sub-listes, one of sub-menus elements and
+ ;; split L into two sub-lists, one of sub-menus elements and
;; another of single menu elements.
(dolist (elt l)
(if (recentf-sub-menu-element-p elt)
;; Count the number of assigned menu shortcuts.
(defvar recentf-menu-shortcuts)
-(defun recentf-make-menu-items (&optional menu)
+(defun recentf-make-menu-items (&optional _menu)
"Make menu items from the recent list.
This is a menu filter function which ignores the MENU argument."
(setq recentf-menu-filter-commands nil)
;;; Common dialog stuff
;;
-(defun recentf-cancel-dialog (&rest ignore)
+(defun recentf-cancel-dialog (&rest _ignore)
"Cancel the current dialog.
IGNORE arguments."
(interactive)
(let ((km (copy-keymap recentf--shortcuts-keymap)))
(set-keymap-parent km widget-keymap)
(define-key km "q" 'recentf-cancel-dialog)
+ (define-key km "n" 'next-line)
+ (define-key km "p" 'previous-line)
(define-key km [follow-link] "\C-m")
km)
"Keymap used in recentf dialogs.")
;;
(defvar recentf-edit-list nil)
-(defun recentf-edit-list-select (widget &rest ignore)
+(defun recentf-edit-list-select (widget &rest _ignore)
"Toggle a file selection based on the checkbox WIDGET state.
IGNORE other arguments."
(let ((value (widget-get widget :tag))
(setq recentf-edit-list (delq value recentf-edit-list)))
(message "%s %sselected" value (if check "" "un"))))
-(defun recentf-edit-list-validate (&rest ignore)
+(defun recentf-edit-list-validate (&rest _ignore)
"Process the recent list when the edit list dialog is committed.
IGNORE arguments."
(if recentf-edit-list
\f
;;; Open file dialog
;;
-(defun recentf-open-files-action (widget &rest ignore)
+(defun recentf-open-files-action (widget &rest _ignore)
"Open the file stored in WIDGET's value when notified.
IGNORE other arguments."
(kill-buffer (current-buffer))
;;;###autoload
(define-minor-mode recentf-mode
- "Toggle recentf mode.
-With prefix argument ARG, turn on if positive, otherwise off.
-Returns non-nil if the new state is enabled.
-
-When recentf mode is enabled, it maintains a menu for visiting files
-that were operated on recently."
+ "Toggle \"Open Recent\" menu (Recentf mode).
+With a prefix argument ARG, enable Recentf mode if ARG is
+positive, and disable it otherwise. If called from Lisp, enable
+Recentf mode if ARG is omitted or nil.
+
+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."
:global t
:group 'recentf
:keymap recentf-mode-map