]> git.eshelyaron.com Git - emacs.git/commitdiff
(recentf-initialize-file-name-history): New defcustom.
authorEli Zaretskii <eliz@gnu.org>
Sun, 28 Sep 2003 08:42:49 +0000 (08:42 +0000)
committerEli Zaretskii <eliz@gnu.org>
Sun, 28 Sep 2003 08:42:49 +0000 (08:42 +0000)
(recentf-load-list): When `recentf-initialize-file-name-history'
is non-nil, initialize an empty `file-name-history' with the
recent list.

lisp/ChangeLog
lisp/recentf.el

index 469988dcbd569816c30e686b2881b54cdeba16ae..89291362998d946e9d3477cf58b110e17b88a2db 100644 (file)
@@ -1,3 +1,11 @@
+2003-09-28  David Ponce  <david@dponce.com>
+
+       * recentf.el (recentf-initialize-file-name-history): New
+       defcustom.
+       (recentf-load-list): When `recentf-initialize-file-name-history'
+       is non-nil, initialize an empty `file-name-history' with the
+       recent list.
+
 2003-09-28  Evgeni Dobrev  <evgeni_dobrev@developer.bg> (tiny patch)
 
        * man.el (Man-default-man-entry): Remove the leading `*' from the
index a35e33d5742c493ee434cdb1710eec87fc92067b..f2700fcf21045664659fb385e6b91ae7f0b3fa11 100644 (file)
@@ -8,7 +8,7 @@
 ;; Maintainer: FSF
 ;; Keywords: files
 
-(defconst recentf-version "$Revision: 1.26 $")
+(defconst recentf-version "$Revision: 1.27 $")
 
 ;; This file is part of GNU Emacs.
 
@@ -240,6 +240,12 @@ cleanup the list."
            ;; Unavailable until recentf has been loaded.
            (recentf-auto-cleanup))))
 
+(defcustom recentf-initialize-file-name-history t
+  "*non-nil means to initialize `file-name-history' with the recent list.
+If `file-name-history' is not empty, do nothing."
+  :group 'recentf
+  :type  'boolean)
+
 (defcustom recentf-load-hook nil
    "*Normal hook run at end of loading the `recentf' package."
   :group 'recentf
@@ -1143,11 +1149,17 @@ Write data into the file specified by `recentf-save-file'."
 
 (defun recentf-load-list ()
   "Load a previously saved recent list.
-Read data from the file specified by `recentf-save-file'."
+Read data from the file specified by `recentf-save-file'.
+When `recentf-initialize-file-name-history' is non-nil, initialize an
+empty `file-name-history' with the recent list."
   (interactive)
   (let ((file (expand-file-name recentf-save-file)))
     (when (file-readable-p file)
-      (load-file file))))
+      (load-file file)
+      (and recentf-initialize-file-name-history
+           (not file-name-history)
+           (setq file-name-history (mapcar 'abbreviate-file-name
+                                           recentf-list))))))
 
 (defun recentf-cleanup ()
   "Remove all excluded or non-readable files from the recent list."