[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
recentf improvement
From: |
Richard Stallman |
Subject: |
recentf improvement |
Date: |
Sat, 20 Sep 2003 17:27:23 -0400 |
This looks good to me. David, what do you think?
Date: Sat, 20 Sep 2003 14:43:53 +0900 (JST)
To: address@hidden
From: Masatake YAMATO <address@hidden>
In-Reply-To: <address@hidden>
Cc: address@hidden
Subject: Re: default value of file-name-history
Sender: address@hidden
> > How do you think initialize file-name-history with the
> > value of `recentf-list'? So you can do C-x C-f M-p M-p M-p...
> > just after launching emacs.
>
> Please, not unless the user already has recentf-mode turned on!
How about this one?
Masatake YAMATO
Index: lisp/recentf.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/recentf.el,v
retrieving revision 1.27
diff -u -r1.27 recentf.el
--- lisp/recentf.el 15 Sep 2003 16:24:35 -0000 1.27
+++ lisp/recentf.el 20 Sep 2003 05:39:28 -0000
@@ -251,6 +251,13 @@
If it returns nil, the filename is left unchanged."
:group 'recentf
:type 'function)
+
+(defcustom recentf-install-to-file-name-history t
+ "Use the `recentf-list' as the initial value of `file-name-history' or not.
+If non-nil and `file-name-history' is empty, use `recentf-list' as its initial.
+Else do nothing."
+ :group 'recentf
+ :type 'boolean)
;;; Utilities
;;
@@ -1161,6 +1168,14 @@
(setq recentf-list (nreverse newlist))
(message "Cleaning up the recentf list...done")))
+(defun recentf-install-to-file-name-history ()
+ "Use the value of `recentf-list' as the initial value for
`file-name-history'.
+If `file-name-history' is not empty, do nothing."
+ (when (= 0 (length file-name-history))
+ (setq file-name-history (mapcar
+ 'abbreviate-file-name
+ recentf-list))))
+
;;;###autoload
(define-minor-mode recentf-mode
"Toggle recentf mode.
@@ -1173,7 +1188,9 @@
:group 'recentf
(unless (and recentf-mode (recentf-enabled-p))
(if recentf-mode
- (recentf-load-list)
+ (progn (recentf-load-list)
+ (if recentf-install-to-file-name-history
+ (recentf-install-to-file-name-history)))
(recentf-save-list))
(recentf-auto-cleanup)
(recentf-clear-data)
_______________________________________________
Emacs-devel mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/emacs-devel