Mercurial > emacs
comparison lisp/replace.el @ 98909:5574362352ff
(read-regexp): Rename arg `default' to `default-value'. Doc fix.
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Sun, 19 Oct 2008 22:04:02 +0000 |
parents | 9d5c120a08ec |
children | f989303f1963 |
comparison
equal
deleted
inserted
replaced
98908:96eaae8a24b8 | 98909:5574362352ff |
---|---|
520 "History list for some commands that read regular expressions. | 520 "History list for some commands that read regular expressions. |
521 | 521 |
522 Maximum length of the history list is determined by the value | 522 Maximum length of the history list is determined by the value |
523 of `history-length', which see.") | 523 of `history-length', which see.") |
524 | 524 |
525 (defun read-regexp (prompt &optional default) | 525 (defun read-regexp (prompt &optional default-value) |
526 "Read regexp as a string using the regexp history and some useful defaults. | 526 "Read regexp as a string using the regexp history and some useful defaults. |
527 Prompt for a regular expression with PROMPT (without a colon and | 527 Prompt for a regular expression with PROMPT (without a colon and |
528 space) in the minibuffer. The optional string argument DEFAULT | 528 space) in the minibuffer. The optional argument DEFAULT-VALUE |
529 provides the basic default value, that is returned on typing RET. | 529 provides the value to display in the minibuffer prompt that is |
530 Additional defaults are the string at point, the last isearch regexp, | 530 returned if the user just types RET. |
531 the last isearch string, and the last replacement regexp." | 531 Values available via M-n are the string at point, the last isearch |
532 regexp, the last isearch string, and the last replacement regexp." | |
532 (let* ((defaults | 533 (let* ((defaults |
533 (list (regexp-quote | 534 (list (regexp-quote |
534 (or (funcall (or find-tag-default-function | 535 (or (funcall (or find-tag-default-function |
535 (get major-mode 'find-tag-default-function) | 536 (get major-mode 'find-tag-default-function) |
536 'find-tag-default)) | 537 'find-tag-default)) |
542 (defaults (delete-dups (delq nil (delete "" defaults)))) | 543 (defaults (delete-dups (delq nil (delete "" defaults)))) |
543 ;; Don't add automatically the car of defaults for empty input | 544 ;; Don't add automatically the car of defaults for empty input |
544 (history-add-new-input nil) | 545 (history-add-new-input nil) |
545 (input | 546 (input |
546 (read-from-minibuffer | 547 (read-from-minibuffer |
547 (if default | 548 (if default-value |
548 (format "%s (default %s): " prompt (query-replace-descr default)) | 549 (format "%s (default %s): " prompt |
550 (query-replace-descr default-value)) | |
549 (format "%s: " prompt)) | 551 (format "%s: " prompt)) |
550 nil nil nil 'regexp-history defaults t))) | 552 nil nil nil 'regexp-history defaults t))) |
551 (if (equal input "") | 553 (if (equal input "") |
552 default | 554 default-value |
553 (prog1 input | 555 (prog1 input |
554 (add-to-history 'regexp-history input))))) | 556 (add-to-history 'regexp-history input))))) |
555 | 557 |
556 | 558 |
557 (defalias 'delete-non-matching-lines 'keep-lines) | 559 (defalias 'delete-non-matching-lines 'keep-lines) |