unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Masatake YAMATO <jet@gyve.org>
Subject: default value of file-name-history
Date: Fri, 19 Sep 2003 19:12:03 +0900 (JST)	[thread overview]
Message-ID: <20030919.191203.202255364.jet@gyve.org> (raw)

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.

(M-x describe-variable recentf-list: "List of recently opened files.")

Masatake YAMATO

Index: lisp/simple.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v
retrieving revision 1.620
diff -u -r1.620 simple.el
--- lisp/simple.el	8 Sep 2003 08:01:41 -0000	1.620
+++ lisp/simple.el	19 Sep 2003 10:09:24 -0000
@@ -900,10 +900,23 @@
 	   elt))
 	(goto-char (or minibuffer-temporary-goal-position (point-max))))))
 
+(defvar previous-history-element-used-recentf nil)
 (defun previous-history-element (n)
   "Inserts the previous element of the minibuffer history into the minibuffer."
   (interactive "p")
-  (next-history-element (- n)))
+  (let (result)
+  (unwind-protect
+      (setq result (next-history-element (- n)))
+    (if (and (= 0 (length (symbol-value minibuffer-history-variable)))
+	     (eq minibuffer-history-variable 'file-name-history)
+	     (not previous-history-element-used-recentf))
+	(progn (require 'recentf)
+	       (recentf-load-list) 
+	       (setq previous-history-element-used-recentf t
+		     file-name-history (mapcar 
+					'abbreviate-file-name
+					recentf-list))))
+    result)))
 
 (defun next-complete-history-element (n)
   "Get next history element which completes the minibuffer before the point.

             reply	other threads:[~2003-09-19 10:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-19 10:12 Masatake YAMATO [this message]
2003-09-19 16:40 ` default value of file-name-history Kevin Rodgers
2003-09-19 17:00   ` Henrik Enberg
2003-09-20  5:43   ` Masatake YAMATO
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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030919.191203.202255364.jet@gyve.org \
    --to=jet@gyve.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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).