changeset 85514:bcd144422383

(goto-history-element): Allow minibuffer-default to be a list of default values accessible by typing M-n in the minibuffer.
author Juri Linkov <juri@jurta.org>
date Mon, 22 Oct 2007 00:17:26 +0000
parents dfdbd485bfa6
children 7fa3f0c5ecbf
files lisp/simple.el
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Sun Oct 21 20:10:06 2007 +0000
+++ b/lisp/simple.el	Mon Oct 22 00:17:26 2007 +0000
@@ -1295,7 +1295,11 @@
   "Puts element of the minibuffer history in the minibuffer.
 The argument NABS specifies the absolute history position."
   (interactive "p")
-  (let ((minimum (if minibuffer-default -1 0))
+  (let ((minimum (if minibuffer-default
+		     (- (if (listp minibuffer-default)
+			    (length minibuffer-default)
+			  1))
+		   0))
 	elt minibuffer-returned-to-present)
     (if (and (zerop minibuffer-history-position)
 	     (null minibuffer-text-before-history))
@@ -1317,8 +1321,10 @@
     (goto-char (point-max))
     (delete-minibuffer-contents)
     (setq minibuffer-history-position nabs)
-    (cond ((= nabs -1)
-	   (setq elt minibuffer-default))
+    (cond ((< nabs 0)
+	   (setq elt (if (listp minibuffer-default)
+			 (nth (1- (abs nabs)) minibuffer-default)
+		       minibuffer-default)))
 	  ((= nabs 0)
 	   (setq elt (or minibuffer-text-before-history ""))
 	   (setq minibuffer-returned-to-present t)