[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

default value of file-name-history

From: Masatake YAMATO
Subject: default value of file-name-history
Date: Fri, 19 Sep 2003 19:12:03 +0900 (JST)

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 @@
        (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 via email to

[Prev in Thread] Current Thread [Next in Thread]