comparison lisp/recentf.el @ 81893:5608c829dbac

* recentf.el (recentf-keep-default-predicate): New defun. (recentf-keep): Use it as initial value.
author Michael Albinus <michael.albinus@gmx.de>
date Sun, 15 Jul 2007 19:55:14 +0000
parents e0a9f7f7486a
children 66d338352087
comparison
equal deleted inserted replaced
81892:cf78c05b3254 81893:5608c829dbac
87 this value. By default give R/W access only to the user who owns that 87 this value. By default give R/W access only to the user who owns that
88 file. See also the function `set-file-modes'." 88 file. See also the function `set-file-modes'."
89 :group 'recentf 89 :group 'recentf
90 :type '(choice (const :tag "Don't change" nil) 90 :type '(choice (const :tag "Don't change" nil)
91 integer)) 91 integer))
92 92
93 (defcustom recentf-exclude nil 93 (defcustom recentf-exclude nil
94 "*List of regexps and predicates for filenames excluded from the recent list. 94 "*List of regexps and predicates for filenames excluded from the recent list.
95 When a filename matches any of the regexps or satisfies any of the 95 When a filename matches any of the regexps or satisfies any of the
96 predicates it is excluded from the recent list. 96 predicates it is excluded from the recent list.
97 A predicate is a function that is passed a filename to check and that 97 A predicate is a function that is passed a filename to check and that
98 must return non-nil to exclude it." 98 must return non-nil to exclude it."
99 :group 'recentf 99 :group 'recentf
100 :type '(repeat (choice regexp function))) 100 :type '(repeat (choice regexp function)))
101 101
102 (defun recentf-keep-default-predicate (file)
103 "Return non-nil if FILE should be kept in the recent list.
104 It handles the case of remote files as well."
105 (cond
106 ((file-remote-p file t) (file-readable-p file))
107 ((file-remote-p file))
108 ((file-readable-p file))))
109
102 (defcustom recentf-keep 110 (defcustom recentf-keep
103 '(file-readable-p) 111 '(recentf-keep-default-predicate)
104 "*List of regexps and predicates for filenames kept in the recent list. 112 "*List of regexps and predicates for filenames kept in the recent list.
105 Regexps and predicates are tried in the specified order. 113 Regexps and predicates are tried in the specified order.
106 When nil all filenames are kept in the recent list. 114 When nil all filenames are kept in the recent list.
107 When a filename matches any of the regexps or satisfies any of the 115 When a filename matches any of the regexps or satisfies any of the
108 predicates it is kept in the recent list. 116 predicates it is kept in the recent list.
109 The default is to keep readable files. 117 The default is to keep readable files. Remote files are checked
118 for readability only in case a connection is established to that
119 remote system, otherwise they are kept in the recent list without
120 checking their readability.
110 A predicate is a function that is passed a filename to check and that 121 A predicate is a function that is passed a filename to check and that
111 must return non-nil to keep it. For example, you can add the 122 must return non-nil to keep it."
112 `file-remote-p' predicate in front of this list to keep remote file
113 names in the recent list without checking their readability through a
114 remote access."
115 :group 'recentf 123 :group 'recentf
116 :type '(repeat (choice regexp function))) 124 :type '(repeat (choice regexp function)))
117 125
118 (defun recentf-menu-customization-changed (variable value) 126 (defun recentf-menu-customization-changed (variable value)
119 "Function called when the recentf menu customization has changed. 127 "Function called when the recentf menu customization has changed.