From: Juri Linkov Date: Mon, 22 Oct 2007 00:17:55 +0000 (+0000) Subject: (goto-history-element): Allow minibuffer-default to be X-Git-Tag: emacs-pretest-23.0.90~10167 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b38fc7f11ade8c23edd9581b5ab2d3c062da6256;p=emacs.git (goto-history-element): Allow minibuffer-default to be a list of default values accessible by typing M-n in the minibuffer. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ea696bf9358..f96e92a6150 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2007-10-22 Juri Linkov + + * simple.el (goto-history-element): Allow minibuffer-default to be + a list of default values accessible by typing M-n in the minibuffer. + 2007-10-21 Stefan Monnier * emacs-lisp/byte-opt.el (byte-optimize-featurep): Fix paren typo. diff --git a/lisp/simple.el b/lisp/simple.el index ebf0a5ff71e..eb76cd490d4 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1295,7 +1295,11 @@ makes the search case-sensitive." "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 @@ The argument NABS specifies the absolute history position." (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)