emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Revisit: recentf-cleanup, file-readable-p & remote files


From: Michael Mauger
Subject: Revisit: recentf-cleanup, file-readable-p & remote files
Date: Fri, 11 Mar 2005 14:32:37 -0800 (PST)

Not to drag up old discussions, but I was reviewing some old patches that
I still use.

Back in Sep 2003, a request was made to exclude remote files from the
automatic cleanup process that recentf.el runs when it is enabled.  The
discussion ended forking off into a discussion of performance of Tramp
and detecting network connectivity.

I am now in a situation where about half of the files I edit are local
and the remainder are on a remote Unix server.  I appreciate the
automatic cleanup of files on the recentf list and would like to leave
that feature in place.  Unfortunately the time to connect to the badly
overloaded server and checking files there has gotten painful.  Having
the remote filenames on the recentf list is valuable (thus I don't want
to place remote files on the recentf-exclude list).  What I would like to
be able to do is just not check these remote files as part of the auto
cleanup process.

Below is a simple patch which adds a customizable flag indicating whether
remote files should be cleaned up.  This flag is then checked before
checking the status of a remote file.  The default is to check remote
files, thus behavior is unchanged.  I've been using this patch for a year
without problems.

2005-03-11  Michael R. Mauger  <address@hidden>

        * recentf.el (recentf-cleanup-remote): New variable.  Should
        remote files be cleaned up?
        (recentf-cleanup): Use variable to conditionally check availablity
        of remote files.

Index: emacs/lisp/recentf.el
===================================================================
RCS file: /c/cvsroot/emacs/emacs/lisp/recentf.el,v
retrieving revision 1.30
diff -u -r1.30 recentf.el
--- emacs/lisp/recentf.el       20 Apr 2004 20:54:53 -0000      1.30
+++ emacs/lisp/recentf.el       9 Jun 2004 20:38:01 -0000
@@ -255,6 +255,11 @@
 If it returns nil, the filename is left unchanged."
   :group 'recentf
   :type 'function)
+
+(defcustom recentf-cleanup-remote t
+  "*non-nil means to auto cleanup remote files."
+  :group 'recentf
+  :type  'boolean)
 ^L
 ;;; Utilities
 ;;
@@ -1168,7 +1173,10 @@
   (message "Cleaning up the recentf list...")
   (let (newlist)
     (dolist (f recentf-list)
-      (if (and (recentf-include-p f) (recentf-file-readable-p f))
+      (if (and (recentf-include-p f)
+              (or (and (file-remote-p f)
+                       (not recentf-cleanup-remote))
+                  (recentf-file-readable-p f)))
           (push f newlist)
         (message "File %s removed from the recentf list" f)))
     (setq recentf-list (nreverse newlist))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]