keymap
readp
history
- abbrev-table)
+ abbrev-table
+ default)
"Read a string from the minibuffer, prompting with string PROMPT.
If optional second arg INITIAL-CONTENTS is non-nil, it is a string
to be inserted into the minibuffer before reading input.
Positions are counted starting from 1 at the beginning of the list.
Sixth arg ABBREV-TABLE, if non-nil, becomes the value of `local-abbrev-table'
in the minibuffer.
+Seventh arg DEFAULT, if non-nil, will be returned when user enters
+ an empty string.
See also the variable completion-highlight-first-word-only for control over
completion display."
(let* ((val (progn (set-buffer buffer)
(if minibuffer-exit-hook
(run-hooks 'minibuffer-exit-hook))
- (buffer-string)))
- (histval val)
+ (if (and (eq (char-after (point-min)) nil)
+ default)
+ default
+ (buffer-string))))
+ (histval (if (and default (string= val ""))
+ default
+ val))
(err nil))
(if readp
(condition-case e
minibuffer-local-completion-map
minibuffer-local-must-match-map)
nil
- history))
+ history
+ nil
+ default))
(if (and (string= ret "")
default)
default
result)
(while (progn
(setq result (completing-read prompt alist nil require-match
- nil 'buffer-history))
+ nil 'buffer-history
+ (if default (buffer-name default))))
(cond ((not (equal result ""))
nil)
((not require-match)