From: Masatake YAMATO <jet@gyve.org>
Cc: emacs-devel@gnu.org
Subject: Re: default value of file-name-history
Date: Sat, 20 Sep 2003 14:43:53 +0900 (JST) [thread overview]
Message-ID: <20030920.144353.63121910.jet@gyve.org> (raw)
In-Reply-To: <3F6B318E.2000903@yahoo.com>
> > 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)
\f
;;; 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)
next prev parent reply other threads:[~2003-09-20 5:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-19 10:12 default value of file-name-history Masatake YAMATO
2003-09-19 16:40 ` Kevin Rodgers
2003-09-19 17:00 ` Henrik Enberg
2003-09-20 5:43 ` Masatake YAMATO [this message]
2003-09-20 7:20 ` David Ponce
2003-09-19 16:57 ` Stefan Monnier
2003-09-19 23:11 ` Stefan Daschek
2003-09-20 2:13 ` Miles Bader
2003-09-20 21:27 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030920.144353.63121910.jet@gyve.org \
--to=jet@gyve.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.