[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/recentf.el
From: |
David Ponce |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/recentf.el |
Date: |
Fri, 30 Sep 2005 02:18:55 -0400 |
Index: emacs/lisp/recentf.el
diff -c emacs/lisp/recentf.el:1.45 emacs/lisp/recentf.el:1.46
*** emacs/lisp/recentf.el:1.45 Thu Sep 15 08:01:31 2005
--- emacs/lisp/recentf.el Fri Sep 30 06:18:55 2005
***************
*** 260,273 ****
:group 'recentf
:type 'hook)
! (defcustom recentf-filename-handler nil
! "Function to call to process filename handled by recentf.
! It is passed a filename to give a chance to transform it.
! If it returns nil, the filename is left unchanged."
:group 'recentf
! :type '(choice (const :tag "None" nil)
! (const abbreviate-file-name)
! function))
(defcustom recentf-show-file-shortcuts-flag t
"Whether to show ``[N]'' for the Nth item up to 10.
--- 260,276 ----
:group 'recentf
:type 'hook)
! (defcustom recentf-filename-handlers nil
! "Functions to post process recent file names.
! They are successively passed a file name to transform it."
:group 'recentf
! :type '(choice
! (const :tag "None" nil)
! (repeat :tag "Functions"
! (choice
! (const file-truename)
! (const abbreviate-file-name)
! (function :tag "Other function")))))
(defcustom recentf-show-file-shortcuts-flag t
"Whether to show ``[N]'' for the Nth item up to 10.
***************
*** 362,376 ****
(and m (setq recentf-list (delq (car m) recentf-list)))
(push filename recentf-list)))
(defsubst recentf-expand-file-name (name)
! "Convert filename NAME to absolute, and canonicalize it.
! See also the function `expand-file-name'.
! If defined, call the function `recentf-filename-handler'
! to post process the canonical name."
! (let* ((filename (expand-file-name name)))
! (or (and recentf-filename-handler
! (funcall recentf-filename-handler filename))
! filename)))
(defun recentf-include-p (filename)
"Return non-nil if FILENAME should be included in the recent list.
--- 365,389 ----
(and m (setq recentf-list (delq (car m) recentf-list)))
(push filename recentf-list)))
+ (defun recentf-apply-filename-handlers (name)
+ "Apply `recentf-filename-handlers' to file NAME.
+ Return the transformed file name, or NAME if any handler failed, or
+ returned nil."
+ (or (condition-case nil
+ (let ((handlers recentf-filename-handlers)
+ (filename name))
+ (while (and filename handlers)
+ (setq filename (funcall (car handlers) filename)
+ handlers (cdr handlers)))
+ filename)
+ (error nil))
+ name))
+
(defsubst recentf-expand-file-name (name)
! "Convert file NAME to absolute, and canonicalize it.
! NAME is first passed to the function `expand-file-name', then to
! `recentf-filename-handlers' to post process it."
! (recentf-apply-filename-handlers (expand-file-name name)))
(defun recentf-include-p (filename)
"Return non-nil if FILENAME should be included in the recent list.
***************
*** 436,458 ****
;;; Menu building
;;
(defvar recentf-menu-items-for-commands
! (list ["Cleanup list"
! recentf-cleanup
! :help "Remove all excluded and non-kept files from the recent list"
! :active t]
! ["Edit list..."
! recentf-edit-list
! :help "Edit the files that are kept in the recent list"
! :active t]
! ["Save list now"
! recentf-save-list
! :help "Save the list of recently opened files now"
! :active t]
! ["Options..."
! (customize-group "recentf")
! :help "Customize recently opened files menu and options"
! :active t]
! )
"List of menu items for recentf commands.")
(defvar recentf-menu-filter-commands nil
--- 449,472 ----
;;; Menu building
;;
(defvar recentf-menu-items-for-commands
! (list
! ["Cleanup list"
! recentf-cleanup
! :help "Remove duplicates, and obsoletes files from the recent list"
! :active t]
! ["Edit list..."
! recentf-edit-list
! :help "Manually remove files from the recent list"
! :active t]
! ["Save list now"
! recentf-save-list
! :help "Save the list of recently opened files now"
! :active t]
! ["Options..."
! (customize-group "recentf")
! :help "Customize recently opened files menu and options"
! :active t]
! )
"List of menu items for recentf commands.")
(defvar recentf-menu-filter-commands nil
***************
*** 1236,1248 ****
recentf-list))))))
(defun recentf-cleanup ()
! "Remove all non-kept and excluded files from the recent list."
(interactive)
(message "Cleaning up the recentf list...")
(let ((n 0) newlist)
(dolist (f recentf-list)
(if (and (recentf-include-p f)
! (recentf-keep-p f))
(push f newlist)
(setq n (1+ n))
(message "File %s removed from the recentf list" f)))
--- 1250,1265 ----
recentf-list))))))
(defun recentf-cleanup ()
! "Cleanup the recent list.
! That is, remove duplicates, non-kept, and excluded files."
(interactive)
(message "Cleaning up the recentf list...")
(let ((n 0) newlist)
(dolist (f recentf-list)
+ (setq f (recentf-expand-file-name f))
(if (and (recentf-include-p f)
! (recentf-keep-p f)
! (not (recentf-string-member f newlist)))
(push f newlist)
(setq n (1+ n))
(message "File %s removed from the recentf list" f)))