[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: recentf improvement
From: |
David Ponce |
Subject: |
Re: recentf improvement |
Date: |
Sun, 21 Sep 2003 00:47:51 +0200 |
User-agent: |
Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.5) Gecko/20030916 |
Hi,
> This looks good to me. David, what do you think?
I would prefer to rename `recentf-install-to-file-name-history' to
`recentf-init-file-name-history'. I found that name clearer.
Also, IMO, it is better to handle initialization of the
file-name-history just after the recent list is loaded, that is in
function `recentf-load-list'.
Finally, I don't see the point of calling `abbreviate-file-name' on
every recent file before copying them to file-name-history?
So I suggest you this simplified patch.
David
2003-09-21 David Ponce <address@hidden>
* recentf.el (recentf-init-file-name-history): New option.
(recentf-load-list): Initialize file-name-history if necessary.
Index: lisp/recentf.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/recentf.el,v
retrieving revision 1.27
diff -c -r1.27 recentf.el
*** lisp/recentf.el 15 Sep 2003 16:24:35 -0000 1.27
--- lisp/recentf.el 20 Sep 2003 22:30:10 -0000
***************
*** 240,245 ****
--- 240,251 ----
;; Unavailable until recentf has been loaded.
(recentf-auto-cleanup))))
+ (defcustom recentf-init-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,1153 ****
(defun recentf-load-list ()
"Load a previously saved recent list.
! Read data from the file specified by `recentf-save-file'."
(interactive)
(let ((file (expand-file-name recentf-save-file)))
(when (file-readable-p file)
! (load-file file))))
(defun recentf-cleanup ()
"Remove all excluded or non-readable files from the recent list."
--- 1149,1164 ----
(defun recentf-load-list ()
"Load a previously saved recent list.
! Read data from the file specified by `recentf-save-file'.
! When `recentf-init-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)
! (and recentf-init-file-name-history
! (not file-name-history)
! (setq file-name-history recentf-list)))))
(defun recentf-cleanup ()
"Remove all excluded or non-readable files from the recent list."