diff options
| -rw-r--r-- | etc/NEWS | 8 | ||||
| -rw-r--r-- | lisp/ChangeLog | 13 | ||||
| -rw-r--r-- | lisp/dired.el | 4 | ||||
| -rw-r--r-- | lisp/isearch.el | 4 | ||||
| -rw-r--r-- | lisp/progmodes/grep.el | 4 | ||||
| -rw-r--r-- | lisp/replace.el | 31 |
6 files changed, 41 insertions, 23 deletions
| @@ -750,6 +750,14 @@ in Emacs 24.1: | |||
| 750 | **** `special-display-function' | 750 | **** `special-display-function' |
| 751 | **** `display-buffer-function' | 751 | **** `display-buffer-function' |
| 752 | 752 | ||
| 753 | ** Minibuffer | ||
| 754 | |||
| 755 | *** `read-regexp' has a new argument HISTORY; the first argument PROMPT | ||
| 756 | of `read-regexp' accepts a string ending with a colon and space, and its | ||
| 757 | second argument DEFAULTS can be a list of strings accessible via M-n | ||
| 758 | in the minibuffer ahead of other hard-coded useful regexp-related values. | ||
| 759 | More commands use `read-regexp' now to read their regexp arguments. | ||
| 760 | |||
| 753 | ** Completion | 761 | ** Completion |
| 754 | 762 | ||
| 755 | *** New function `completion-table-with-quoting' to handle completion | 763 | *** New function `completion-table-with-quoting' to handle completion |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1d4dd0ed827..f7f4193e777 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,18 @@ | |||
| 1 | 2012-09-20 Juri Linkov <juri@jurta.org> | 1 | 2012-09-20 Juri Linkov <juri@jurta.org> |
| 2 | 2 | ||
| 3 | * replace.el (query-replace-read-from): Use `read-regexp' instead | ||
| 4 | of `read-from-minibuffer' when `regexp-flag' is non-nil. | ||
| 5 | (occur-read-primary-args): Use `read-regexp' instead of | ||
| 6 | `read-string'. | ||
| 7 | (multi-occur-in-matching-buffers): Use `read-regexp' instead of | ||
| 8 | `read-from-minibuffer'. | ||
| 9 | * isearch.el (isearch-occur): Use `read-regexp' instead of | ||
| 10 | `read-string'. | ||
| 11 | * dired.el (dired-read-regexp): Use `read-regexp' instead of | ||
| 12 | `read-from-minibuffer'. | ||
| 13 | * progmodes/grep.el (grep-read-regexp): Use `read-regexp' instead | ||
| 14 | of `read-string'. (Bug#7567) | ||
| 15 | |||
| 3 | * replace.el (read-regexp): Rename DEFAULT-VALUE arg to DEFAULTS | 16 | * replace.el (read-regexp): Rename DEFAULT-VALUE arg to DEFAULTS |
| 4 | and allow accepting a list of strings prepended to a list of | 17 | and allow accepting a list of strings prepended to a list of |
| 5 | standard default values. Doc fix. (Bug#12321) | 18 | standard default values. Doc fix. (Bug#12321) |
diff --git a/lisp/dired.el b/lisp/dired.el index a4fbaddec38..a5169fc301c 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -3178,8 +3178,8 @@ As always, hidden subdirs are not affected." | |||
| 3178 | (defvar dired-regexp-history nil | 3178 | (defvar dired-regexp-history nil |
| 3179 | "History list of regular expressions used in Dired commands.") | 3179 | "History list of regular expressions used in Dired commands.") |
| 3180 | 3180 | ||
| 3181 | (defun dired-read-regexp (prompt) | 3181 | (defun dired-read-regexp (prompt &optional default history) |
| 3182 | (read-from-minibuffer prompt nil nil nil 'dired-regexp-history)) | 3182 | (read-regexp prompt default (or history 'dired-regexp-history))) |
| 3183 | 3183 | ||
| 3184 | (defun dired-mark-files-regexp (regexp &optional marker-char) | 3184 | (defun dired-mark-files-regexp (regexp &optional marker-char) |
| 3185 | "Mark all files matching REGEXP for use in later commands. | 3185 | "Mark all files matching REGEXP for use in later commands. |
diff --git a/lisp/isearch.el b/lisp/isearch.el index 04f5a7acc2c..37993767013 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -1649,9 +1649,9 @@ characters in that string." | |||
| 1649 | (isearch-done nil t) | 1649 | (isearch-done nil t) |
| 1650 | (isearch-clean-overlays) | 1650 | (isearch-clean-overlays) |
| 1651 | (let ((default (car occur-collect-regexp-history))) | 1651 | (let ((default (car occur-collect-regexp-history))) |
| 1652 | (read-string | 1652 | (read-regexp |
| 1653 | (format "Regexp to collect (default %s): " default) | 1653 | (format "Regexp to collect (default %s): " default) |
| 1654 | nil 'occur-collect-regexp-history default))) | 1654 | default 'occur-collect-regexp-history))) |
| 1655 | ;; Otherwise normal occur takes numerical prefix argument. | 1655 | ;; Otherwise normal occur takes numerical prefix argument. |
| 1656 | (when current-prefix-arg | 1656 | (when current-prefix-arg |
| 1657 | (prefix-numeric-value current-prefix-arg)))))) | 1657 | (prefix-numeric-value current-prefix-arg)))))) |
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index a6ae42f86b1..c056b0f4e26 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el | |||
| @@ -817,11 +817,11 @@ substitution string. Note dynamic scoping of variables.") | |||
| 817 | (defun grep-read-regexp () | 817 | (defun grep-read-regexp () |
| 818 | "Read regexp arg for interactive grep." | 818 | "Read regexp arg for interactive grep." |
| 819 | (let ((default (grep-tag-default))) | 819 | (let ((default (grep-tag-default))) |
| 820 | (read-string | 820 | (read-regexp |
| 821 | (concat "Search for" | 821 | (concat "Search for" |
| 822 | (if (and default (> (length default) 0)) | 822 | (if (and default (> (length default) 0)) |
| 823 | (format " (default \"%s\"): " default) ": ")) | 823 | (format " (default \"%s\"): " default) ": ")) |
| 824 | nil 'grep-regexp-history default))) | 824 | default 'grep-regexp-history))) |
| 825 | 825 | ||
| 826 | (defun grep-read-files (regexp) | 826 | (defun grep-read-files (regexp) |
| 827 | "Read files arg for interactive grep." | 827 | "Read files arg for interactive grep." |
diff --git a/lisp/replace.el b/lisp/replace.el index 435c6c2fb60..f192574a7e2 100644 --- a/lisp/replace.el +++ b/lisp/replace.el | |||
| @@ -128,20 +128,21 @@ wants to replace FROM with TO." | |||
| 128 | (if query-replace-interactive | 128 | (if query-replace-interactive |
| 129 | (car (if regexp-flag regexp-search-ring search-ring)) | 129 | (car (if regexp-flag regexp-search-ring search-ring)) |
| 130 | (let* ((history-add-new-input nil) | 130 | (let* ((history-add-new-input nil) |
| 131 | (prompt | ||
| 132 | (if query-replace-defaults | ||
| 133 | (format "%s (default %s -> %s): " prompt | ||
| 134 | (query-replace-descr (car query-replace-defaults)) | ||
| 135 | (query-replace-descr (cdr query-replace-defaults))) | ||
| 136 | (format "%s: " prompt))) | ||
| 131 | (from | 137 | (from |
| 132 | ;; The save-excursion here is in case the user marks and copies | 138 | ;; The save-excursion here is in case the user marks and copies |
| 133 | ;; a region in order to specify the minibuffer input. | 139 | ;; a region in order to specify the minibuffer input. |
| 134 | ;; That should not clobber the region for the query-replace itself. | 140 | ;; That should not clobber the region for the query-replace itself. |
| 135 | (save-excursion | 141 | (save-excursion |
| 136 | (read-from-minibuffer | 142 | (if regexp-flag |
| 137 | (if query-replace-defaults | 143 | (read-regexp prompt nil query-replace-from-history-variable) |
| 138 | (format "%s (default %s -> %s): " prompt | 144 | (read-from-minibuffer |
| 139 | (query-replace-descr (car query-replace-defaults)) | 145 | prompt nil nil nil query-replace-from-history-variable nil t))))) |
| 140 | (query-replace-descr (cdr query-replace-defaults))) | ||
| 141 | (format "%s: " prompt)) | ||
| 142 | nil nil nil | ||
| 143 | query-replace-from-history-variable | ||
| 144 | nil t)))) | ||
| 145 | (if (and (zerop (length from)) query-replace-defaults) | 146 | (if (and (zerop (length from)) query-replace-defaults) |
| 146 | (cons (car query-replace-defaults) | 147 | (cons (car query-replace-defaults) |
| 147 | (query-replace-compile-replacement | 148 | (query-replace-compile-replacement |
| @@ -1139,9 +1140,9 @@ which means to discard all text properties." | |||
| 1139 | "\\&" | 1140 | "\\&" |
| 1140 | ;; Get the regexp for collection pattern. | 1141 | ;; Get the regexp for collection pattern. |
| 1141 | (let ((default (car occur-collect-regexp-history))) | 1142 | (let ((default (car occur-collect-regexp-history))) |
| 1142 | (read-string | 1143 | (read-regexp |
| 1143 | (format "Regexp to collect (default %s): " default) | 1144 | (format "Regexp to collect (default %s): " default) |
| 1144 | nil 'occur-collect-regexp-history default))) | 1145 | default 'occur-collect-regexp-history))) |
| 1145 | ;; Otherwise normal occur takes numerical prefix argument. | 1146 | ;; Otherwise normal occur takes numerical prefix argument. |
| 1146 | (when current-prefix-arg | 1147 | (when current-prefix-arg |
| 1147 | (prefix-numeric-value current-prefix-arg)))))) | 1148 | (prefix-numeric-value current-prefix-arg)))))) |
| @@ -1228,14 +1229,10 @@ See also `multi-occur'." | |||
| 1228 | (cons | 1229 | (cons |
| 1229 | (let* ((default (car regexp-history)) | 1230 | (let* ((default (car regexp-history)) |
| 1230 | (input | 1231 | (input |
| 1231 | (read-from-minibuffer | 1232 | (read-regexp |
| 1232 | (if current-prefix-arg | 1233 | (if current-prefix-arg |
| 1233 | "List lines in buffers whose names match regexp: " | 1234 | "List lines in buffers whose names match regexp: " |
| 1234 | "List lines in buffers whose filenames match regexp: ") | 1235 | "List lines in buffers whose filenames match regexp: ")))) |
| 1235 | nil | ||
| 1236 | nil | ||
| 1237 | nil | ||
| 1238 | 'regexp-history))) | ||
| 1239 | (if (equal input "") | 1236 | (if (equal input "") |
| 1240 | default | 1237 | default |
| 1241 | input)) | 1238 | input)) |