[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/recentf.el
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/recentf.el |
Date: |
Mon, 15 Sep 2003 12:24:35 -0400 |
Index: emacs/lisp/recentf.el
diff -c emacs/lisp/recentf.el:1.26 emacs/lisp/recentf.el:1.27
*** emacs/lisp/recentf.el:1.26 Mon Sep 8 15:00:17 2003
--- emacs/lisp/recentf.el Mon Sep 15 12:24:35 2003
***************
*** 8,14 ****
;; Maintainer: FSF
;; Keywords: files
! (defconst recentf-version "$Revision: 1.26 $")
;; This file is part of GNU Emacs.
--- 8,14 ----
;; Maintainer: FSF
;; Keywords: files
! (defconst recentf-version "$Revision: 1.27 $")
;; This file is part of GNU Emacs.
***************
*** 78,86 ****
:type 'file)
(defcustom recentf-exclude nil
! "*List of regexps for filenames excluded from the recent list."
:group 'recentf
! :type '(repeat regexp))
(defun recentf-menu-customization-changed (variable value)
"Function called when the recentf menu customization has changed.
--- 78,90 ----
:type 'file)
(defcustom recentf-exclude nil
! "*List of regexps and predicates for filenames excluded from the recent list.
! When a filename matches any of the regexps or satisfies any of the
! predicates it is excluded from the recent list.
! A predicate is a function that is passed a filename to check and that
! must return non-nil to exclude it."
:group 'recentf
! :type '(repeat (choice regexp function)))
(defun recentf-menu-customization-changed (variable value)
"Function called when the recentf menu customization has changed.
***************
*** 343,359 ****
(funcall recentf-filename-handler filename))
filename)))
(defun recentf-include-p (filename)
! "Return t if FILENAME match none of the `recentf-exclude' regexps."
(let ((case-fold-search recentf-case-fold-search)
! (rl recentf-exclude))
! (while (and rl (not (string-match (car rl) filename)))
! (setq rl (cdr rl)))
! (null rl)))
(defsubst recentf-add-file (filename)
"Add or move FILENAME at the beginning of the recent list.
! Does nothing it if it matches any of the `recentf-exclude' regexps."
(setq filename (recentf-expand-file-name filename))
(when (recentf-include-p filename)
(recentf-push filename)))
--- 347,380 ----
(funcall recentf-filename-handler filename))
filename)))
+ (defsubst recentf-file-readable-p (filename)
+ "Return t if file FILENAME exists and you can read it.
+ Like the function `file-readable-p' but return nil on error."
+ (condition-case nil
+ (file-readable-p filename)
+ (error nil)))
+
(defun recentf-include-p (filename)
! "Return non-nil if FILENAME should be included in the recent list.
! That is, if it doesn't match any of the `recentf-exclude' checks."
(let ((case-fold-search recentf-case-fold-search)
! (checks recentf-exclude)
! (keepit t)
! check)
! (while (and checks keepit)
! (setq check (car checks)
! checks (cdr checks)
! keepit (not (if (stringp check)
! ;; A regexp
! (string-match check filename)
! ;; A predicate
! (funcall check filename)))))
! keepit))
(defsubst recentf-add-file (filename)
"Add or move FILENAME at the beginning of the recent list.
! Does nothing if the name satisfies any of the `recentf-exclude' regexps or
! predicates."
(setq filename (recentf-expand-file-name filename))
(when (recentf-include-p filename)
(recentf-push filename)))
***************
*** 361,367 ****
(defsubst recentf-remove-if-non-readable (filename)
"Remove FILENAME from the recent list, if file is not readable.
Return non-nil if FILENAME has been removed."
! (unless (file-readable-p filename)
(let ((m (recentf-string-member
(recentf-expand-file-name filename) recentf-list)))
(and m (setq recentf-list (delq (car m) recentf-list))))))
--- 382,388 ----
(defsubst recentf-remove-if-non-readable (filename)
"Remove FILENAME from the recent list, if file is not readable.
Return non-nil if FILENAME has been removed."
! (unless (recentf-file-readable-p filename)
(let ((m (recentf-string-member
(recentf-expand-file-name filename) recentf-list)))
(and m (setq recentf-list (delq (car m) recentf-list))))))
***************
*** 1112,1122 ****
"Save the recent list.
Write data into the file specified by `recentf-save-file'."
(interactive)
! (with-temp-file (expand-file-name recentf-save-file)
(erase-buffer)
(insert (format recentf-save-file-header (current-time-string)))
(recentf-dump-variable 'recentf-list recentf-max-saved-items)
(recentf-dump-variable 'recentf-filter-changer-state)
nil))
(defun recentf-load-list ()
--- 1133,1144 ----
"Save the recent list.
Write data into the file specified by `recentf-save-file'."
(interactive)
! (with-temp-buffer
(erase-buffer)
(insert (format recentf-save-file-header (current-time-string)))
(recentf-dump-variable 'recentf-list recentf-max-saved-items)
(recentf-dump-variable 'recentf-filter-changer-state)
+ (write-file (expand-file-name recentf-save-file))
nil))
(defun recentf-load-list ()
***************
*** 1128,1139 ****
(load-file file))))
(defun recentf-cleanup ()
! "Remove all non-readable and excluded files from the recent list."
(interactive)
(message "Cleaning up the recentf list...")
(let (newlist)
(dolist (f recentf-list)
! (if (and (recentf-include-p f) (file-readable-p f))
(push f newlist)
(message "File %s removed from the recentf list" f)))
(setq recentf-list (nreverse newlist))
--- 1150,1161 ----
(load-file file))))
(defun recentf-cleanup ()
! "Remove all excluded or non-readable files from the recent list."
(interactive)
(message "Cleaning up the recentf list...")
(let (newlist)
(dolist (f recentf-list)
! (if (and (recentf-include-p f) (recentf-file-readable-p f))
(push f newlist)
(message "File %s removed from the recentf list" f)))
(setq recentf-list (nreverse newlist))