Mercurial > emacs
comparison lisp/replace.el @ 104244:97bc7c2be2d0
(read-regexp): Return empty string when `default-value' is nil.
(keep-lines-read-args): Don't use empty string as the
default value for `read-regexp'. (Bug#2495)
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Wed, 12 Aug 2009 20:55:31 +0000 |
parents | 7f8b299098d7 |
children | 6b8dce5c4461 |
comparison
equal
deleted
inserted
replaced
104243:a3d4286317ce | 104244:97bc7c2be2d0 |
---|---|
554 (format "%s (default %s): " prompt | 554 (format "%s (default %s): " prompt |
555 (query-replace-descr default-value)) | 555 (query-replace-descr default-value)) |
556 (format "%s: " prompt)) | 556 (format "%s: " prompt)) |
557 nil nil nil 'regexp-history defaults t))) | 557 nil nil nil 'regexp-history defaults t))) |
558 (if (equal input "") | 558 (if (equal input "") |
559 default-value | 559 (or default-value input) |
560 (prog1 input | 560 (prog1 input |
561 (add-to-history 'regexp-history input))))) | 561 (add-to-history 'regexp-history input))))) |
562 | 562 |
563 | 563 |
564 (defalias 'delete-non-matching-lines 'keep-lines) | 564 (defalias 'delete-non-matching-lines 'keep-lines) |
568 | 568 |
569 (defun keep-lines-read-args (prompt) | 569 (defun keep-lines-read-args (prompt) |
570 "Read arguments for `keep-lines' and friends. | 570 "Read arguments for `keep-lines' and friends. |
571 Prompt for a regexp with PROMPT. | 571 Prompt for a regexp with PROMPT. |
572 Value is a list, (REGEXP)." | 572 Value is a list, (REGEXP)." |
573 (list (read-regexp prompt "") nil nil t)) | 573 (list (read-regexp prompt) nil nil t)) |
574 | 574 |
575 (defun keep-lines (regexp &optional rstart rend interactive) | 575 (defun keep-lines (regexp &optional rstart rend interactive) |
576 "Delete all lines except those containing matches for REGEXP. | 576 "Delete all lines except those containing matches for REGEXP. |
577 A match split across lines preserves all the lines it lies in. | 577 A match split across lines preserves all the lines it lies in. |
578 When called from Lisp (and usually interactively as well, see below) | 578 When called from Lisp (and usually interactively as well, see below) |