diff options
| author | Juri Linkov | 2007-11-16 01:20:20 +0000 |
|---|---|---|
| committer | Juri Linkov | 2007-11-16 01:20:20 +0000 |
| commit | 7dc5b46da516e81dbf6208b3d52c94cfff648009 (patch) | |
| tree | 5a11e8f7650e4a645cf2434046a156b738f7d63e | |
| parent | 2f8a5963f229a4eff56402bda73d5606a5c47bb7 (diff) | |
| download | emacs-7dc5b46da516e81dbf6208b3d52c94cfff648009.tar.gz emacs-7dc5b46da516e81dbf6208b3d52c94cfff648009.zip | |
(keep-lines-read-args, occur-read-primary-args):
Use a list of default values for DEFAULT arg of read-from-minibuffer.
| -rw-r--r-- | lisp/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/replace.el | 57 |
2 files changed, 48 insertions, 20 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4b333ca8ab8..93fe154e313 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2007-11-16 Juri Linkov <juri@jurta.org> | ||
| 2 | |||
| 3 | * dired-aux.el (dired-read-shell-command-default): New function. | ||
| 4 | (dired-read-shell-command): Use its return value for DEFAULT arg. | ||
| 5 | |||
| 6 | * replace.el (keep-lines-read-args, occur-read-primary-args): | ||
| 7 | Use a list of default values for DEFAULT arg of read-from-minibuffer. | ||
| 8 | |||
| 9 | * man.el (Man-heading-regexp): Add 0-9. | ||
| 10 | (Man-first-heading-regexp): Remove leading space [ \t]* before NAME. | ||
| 11 | |||
| 1 | 2007-11-15 Stefan Monnier <monnier@iro.umontreal.ca> | 12 | 2007-11-15 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 13 | ||
| 3 | * doc-view.el (doc-view-ghostscript-options): Remove resolution arg. | 14 | * doc-view.el (doc-view-ghostscript-options): Remove resolution arg. |
diff --git a/lisp/replace.el b/lisp/replace.el index 7876f9bb47c..8e02ee3b347 100644 --- a/lisp/replace.el +++ b/lisp/replace.el | |||
| @@ -533,9 +533,20 @@ which will run faster and will not set the mark or print anything." | |||
| 533 | "Read arguments for `keep-lines' and friends. | 533 | "Read arguments for `keep-lines' and friends. |
| 534 | Prompt for a regexp with PROMPT. | 534 | Prompt for a regexp with PROMPT. |
| 535 | Value is a list, (REGEXP)." | 535 | Value is a list, (REGEXP)." |
| 536 | (list (read-from-minibuffer prompt nil nil nil | 536 | (let* ((default (list |
| 537 | 'regexp-history nil t) | 537 | (regexp-quote |
| 538 | nil nil t)) | 538 | (or (funcall (or find-tag-default-function |
| 539 | (get major-mode 'find-tag-default-function) | ||
| 540 | 'find-tag-default)) | ||
| 541 | "")) | ||
| 542 | (car regexp-search-ring) | ||
| 543 | (regexp-quote (or (car search-ring) "")) | ||
| 544 | (car (symbol-value | ||
| 545 | query-replace-from-history-variable)))) | ||
| 546 | (default (delete-dups (delq nil (delete "" default))))) | ||
| 547 | (list (read-from-minibuffer prompt nil nil nil | ||
| 548 | 'regexp-history default t) | ||
| 549 | nil nil t))) | ||
| 539 | 550 | ||
| 540 | (defun keep-lines (regexp &optional rstart rend interactive) | 551 | (defun keep-lines (regexp &optional rstart rend interactive) |
| 541 | "Delete all lines except those containing matches for REGEXP. | 552 | "Delete all lines except those containing matches for REGEXP. |
| @@ -938,23 +949,29 @@ which means to discard all text properties." | |||
| 938 | (nreverse result)))) | 949 | (nreverse result)))) |
| 939 | 950 | ||
| 940 | (defun occur-read-primary-args () | 951 | (defun occur-read-primary-args () |
| 941 | (list (let* ((default (car regexp-history)) | 952 | (let* ((default |
| 942 | (input | 953 | (list (and transient-mark-mode mark-active |
| 943 | (read-from-minibuffer | 954 | (regexp-quote |
| 944 | (if default | 955 | (buffer-substring-no-properties |
| 945 | (format "List lines matching regexp (default %s): " | 956 | (region-beginning) (region-end)))) |
| 946 | (query-replace-descr default)) | 957 | (regexp-quote |
| 947 | "List lines matching regexp: ") | 958 | (or (funcall |
| 948 | nil | 959 | (or find-tag-default-function |
| 949 | nil | 960 | (get major-mode 'find-tag-default-function) |
| 950 | nil | 961 | 'find-tag-default)) |
| 951 | 'regexp-history | 962 | "")) |
| 952 | default))) | 963 | (car regexp-search-ring) |
| 953 | (if (equal input "") | 964 | (regexp-quote (or (car search-ring) "")) |
| 954 | default | 965 | (car (symbol-value |
| 955 | input)) | 966 | query-replace-from-history-variable)))) |
| 956 | (when current-prefix-arg | 967 | (default (delete-dups (delq nil (delete "" default)))) |
| 957 | (prefix-numeric-value current-prefix-arg)))) | 968 | (input |
| 969 | (read-from-minibuffer | ||
| 970 | "List lines matching regexp: " | ||
| 971 | nil nil nil 'regexp-history default))) | ||
| 972 | (list input | ||
| 973 | (when current-prefix-arg | ||
| 974 | (prefix-numeric-value current-prefix-arg))))) | ||
| 958 | 975 | ||
| 959 | (defun occur-rename-buffer (&optional unique-p interactive-p) | 976 | (defun occur-rename-buffer (&optional unique-p interactive-p) |
| 960 | "Rename the current *Occur* buffer to *Occur: original-buffer-name*. | 977 | "Rename the current *Occur* buffer to *Occur: original-buffer-name*. |