Mercurial > hg > xemacs-beta
comparison lisp/minibuf.el @ 430:a5df635868b2 r21-2-23
Import from CVS: tag r21-2-23
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:29:08 +0200 |
parents | 3ecd8885ac67 |
children | 9d177e8d4150 |
comparison
equal
deleted
inserted
replaced
429:8305706cbb93 | 430:a5df635868b2 |
---|---|
342 | 342 |
343 (defun read-from-minibuffer (prompt &optional initial-contents | 343 (defun read-from-minibuffer (prompt &optional initial-contents |
344 keymap | 344 keymap |
345 readp | 345 readp |
346 history | 346 history |
347 abbrev-table) | 347 abbrev-table |
348 default) | |
348 "Read a string from the minibuffer, prompting with string PROMPT. | 349 "Read a string from the minibuffer, prompting with string PROMPT. |
349 If optional second arg INITIAL-CONTENTS is non-nil, it is a string | 350 If optional second arg INITIAL-CONTENTS is non-nil, it is a string |
350 to be inserted into the minibuffer before reading input. | 351 to be inserted into the minibuffer before reading input. |
351 If INITIAL-CONTENTS is (STRING . POSITION), the initial input | 352 If INITIAL-CONTENTS is (STRING . POSITION), the initial input |
352 is STRING, but point is placed POSITION characters into the string. | 353 is STRING, but point is placed POSITION characters into the string. |
364 which INITIAL-CONTENTS corresponds to). | 365 which INITIAL-CONTENTS corresponds to). |
365 If HISTORY is `t', no history will be recorded. | 366 If HISTORY is `t', no history will be recorded. |
366 Positions are counted starting from 1 at the beginning of the list. | 367 Positions are counted starting from 1 at the beginning of the list. |
367 Sixth arg ABBREV-TABLE, if non-nil, becomes the value of `local-abbrev-table' | 368 Sixth arg ABBREV-TABLE, if non-nil, becomes the value of `local-abbrev-table' |
368 in the minibuffer. | 369 in the minibuffer. |
370 Seventh arg DEFAULT, if non-nil, will be returned when user enters | |
371 an empty string. | |
369 | 372 |
370 See also the variable completion-highlight-first-word-only for control over | 373 See also the variable completion-highlight-first-word-only for control over |
371 completion display." | 374 completion display." |
372 (if (and (not enable-recursive-minibuffers) | 375 (if (and (not enable-recursive-minibuffers) |
373 (> (minibuffer-depth) 0) | 376 (> (minibuffer-depth) 0) |
488 (signal 'quit '()) | 491 (signal 'quit '()) |
489 ;; return value | 492 ;; return value |
490 (let* ((val (progn (set-buffer buffer) | 493 (let* ((val (progn (set-buffer buffer) |
491 (if minibuffer-exit-hook | 494 (if minibuffer-exit-hook |
492 (run-hooks 'minibuffer-exit-hook)) | 495 (run-hooks 'minibuffer-exit-hook)) |
493 (buffer-string))) | 496 (if (and (eq (char-after (point-min)) nil) |
494 (histval val) | 497 default) |
498 default | |
499 (buffer-string)))) | |
500 (histval (if (and default (string= val "")) | |
501 default | |
502 val)) | |
495 (err nil)) | 503 (err nil)) |
496 (if readp | 504 (if readp |
497 (condition-case e | 505 (condition-case e |
498 (let ((v (read-from-string val))) | 506 (let ((v (read-from-string val))) |
499 (if (< (cdr v) (length val)) | 507 (if (< (cdr v) (length val)) |
782 initial-contents | 790 initial-contents |
783 (if (not require-match) | 791 (if (not require-match) |
784 minibuffer-local-completion-map | 792 minibuffer-local-completion-map |
785 minibuffer-local-must-match-map) | 793 minibuffer-local-must-match-map) |
786 nil | 794 nil |
787 history)) | 795 history |
796 nil | |
797 default)) | |
788 (if (and (string= ret "") | 798 (if (and (string= ret "") |
789 default) | 799 default) |
790 default | 800 default |
791 ret))) | 801 ret))) |
792 | 802 |
1432 (alist (mapcar #'(lambda (b) (cons (buffer-name b) b)) | 1442 (alist (mapcar #'(lambda (b) (cons (buffer-name b) b)) |
1433 (buffer-list))) | 1443 (buffer-list))) |
1434 result) | 1444 result) |
1435 (while (progn | 1445 (while (progn |
1436 (setq result (completing-read prompt alist nil require-match | 1446 (setq result (completing-read prompt alist nil require-match |
1437 nil 'buffer-history)) | 1447 nil 'buffer-history |
1448 (if default (buffer-name default)))) | |
1438 (cond ((not (equal result "")) | 1449 (cond ((not (equal result "")) |
1439 nil) | 1450 nil) |
1440 ((not require-match) | 1451 ((not require-match) |
1441 (setq result default) | 1452 (setq result default) |
1442 nil) | 1453 nil) |