From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: recentf improvement Date: Sat, 20 Sep 2003 17:27:23 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: Reply-To: rms@gnu.org NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1064093436 32727 80.91.224.253 (20 Sep 2003 21:30:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 20 Sep 2003 21:30:36 +0000 (UTC) Cc: Masatake YAMATO , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sat Sep 20 23:30:34 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1A0pJK-0000Eg-00 for ; Sat, 20 Sep 2003 23:30:34 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1A0pOO-0000lp-00 for ; Sat, 20 Sep 2003 23:35:49 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 1A0pIr-0001Jn-6h for emacs-devel@quimby.gnus.org; Sat, 20 Sep 2003 17:30:05 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.22) id 1A0pGT-0008BO-HJ for emacs-devel@gnu.org; Sat, 20 Sep 2003 17:27:37 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.22) id 1A0pGR-0008AL-Ee for emacs-devel@gnu.org; Sat, 20 Sep 2003 17:27:36 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 1A0pGR-0008A9-35 for emacs-devel@gnu.org; Sat, 20 Sep 2003 17:27:35 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.20) id 1A0pGF-0005x0-Vs; Sat, 20 Sep 2003 17:27:23 -0400 Original-to: david@dponce.com X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:16513 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:16513 This looks good to me. David, what do you think? Date: Sat, 20 Sep 2003 14:43:53 +0900 (JST) To: ihs_4664@yahoo.com From: Masatake YAMATO In-Reply-To: <3F6B318E.2000903@yahoo.com> Cc: emacs-devel@gnu.org Subject: Re: default value of file-name-history Sender: emacs-devel-bounces+rms=gnu.org@gnu.org > > 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 Emacs-devel@gnu.org http://mail.gnu.org/mailman/listinfo/emacs-devel