emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110121: * lisp/replace.el (query-rep


From: Juri Linkov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110121: * lisp/replace.el (query-replace-read-from): Use `read-regexp' instead
Date: Fri, 21 Sep 2012 00:57:13 +0300
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110121
fixes bug: http://debbugs.gnu.org/7567
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Fri 2012-09-21 00:57:13 +0300
message:
  * lisp/replace.el (query-replace-read-from): Use `read-regexp' instead
  of `read-from-minibuffer' when `regexp-flag' is non-nil.
  (occur-read-primary-args): Use `read-regexp' instead of
  `read-string'.
  (multi-occur-in-matching-buffers): Use `read-regexp' instead of
  `read-from-minibuffer'.
  * lisp/isearch.el (isearch-occur): Use `read-regexp' instead of
  `read-string'.
  * lisp/dired.el (dired-read-regexp): Use `read-regexp' instead of
  `read-from-minibuffer'.
  * lisp/progmodes/grep.el (grep-read-regexp): Use `read-regexp' instead
  of `read-string'.
modified:
  etc/NEWS
  lisp/ChangeLog
  lisp/dired.el
  lisp/isearch.el
  lisp/progmodes/grep.el
  lisp/replace.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2012-09-20 18:59:00 +0000
+++ b/etc/NEWS  2012-09-20 21:57:13 +0000
@@ -750,6 +750,14 @@
 **** `special-display-function'
 **** `display-buffer-function'
 
+** Minibuffer
+
+*** `read-regexp' has a new argument HISTORY; the first argument PROMPT
+of `read-regexp' accepts a string ending with a colon and space, and its
+second argument DEFAULTS can be a list of strings accessible via M-n
+in the minibuffer ahead of other hard-coded useful regexp-related values.
+More commands use `read-regexp' now to read their regexp arguments.
+
 ** Completion
 
 *** New function `completion-table-with-quoting' to handle completion

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-09-20 21:35:40 +0000
+++ b/lisp/ChangeLog    2012-09-20 21:57:13 +0000
@@ -1,5 +1,18 @@
 2012-09-20  Juri Linkov  <address@hidden>
 
+       * replace.el (query-replace-read-from): Use `read-regexp' instead
+       of `read-from-minibuffer' when `regexp-flag' is non-nil.
+       (occur-read-primary-args): Use `read-regexp' instead of
+       `read-string'.
+       (multi-occur-in-matching-buffers): Use `read-regexp' instead of
+       `read-from-minibuffer'.
+       * isearch.el (isearch-occur): Use `read-regexp' instead of
+       `read-string'.
+       * dired.el (dired-read-regexp): Use `read-regexp' instead of
+       `read-from-minibuffer'.
+       * progmodes/grep.el (grep-read-regexp): Use `read-regexp' instead
+       of `read-string'.  (Bug#7567)
+
        * replace.el (read-regexp): Rename DEFAULT-VALUE arg to DEFAULTS
        and allow accepting a list of strings prepended to a list of
        standard default values.  Doc fix.  (Bug#12321)

=== modified file 'lisp/dired.el'
--- a/lisp/dired.el     2012-09-20 10:19:05 +0000
+++ b/lisp/dired.el     2012-09-20 21:57:13 +0000
@@ -3178,8 +3178,8 @@
 (defvar dired-regexp-history nil
   "History list of regular expressions used in Dired commands.")
 
-(defun dired-read-regexp (prompt)
-  (read-from-minibuffer prompt nil nil nil 'dired-regexp-history))
+(defun dired-read-regexp (prompt &optional default history)
+  (read-regexp prompt default (or history 'dired-regexp-history)))
 
 (defun dired-mark-files-regexp (regexp &optional marker-char)
   "Mark all files matching REGEXP for use in later commands.

=== modified file 'lisp/isearch.el'
--- a/lisp/isearch.el   2012-09-09 22:15:24 +0000
+++ b/lisp/isearch.el   2012-09-20 21:57:13 +0000
@@ -1649,9 +1649,9 @@
                 (isearch-done nil t)
                 (isearch-clean-overlays)
                 (let ((default (car occur-collect-regexp-history)))
-                  (read-string
+                  (read-regexp
                    (format "Regexp to collect (default %s): " default)
-                   nil 'occur-collect-regexp-history default)))
+                   default 'occur-collect-regexp-history)))
             ;; Otherwise normal occur takes numerical prefix argument.
             (when current-prefix-arg
               (prefix-numeric-value current-prefix-arg))))))

=== modified file 'lisp/progmodes/grep.el'
--- a/lisp/progmodes/grep.el    2012-04-20 08:48:50 +0000
+++ b/lisp/progmodes/grep.el    2012-09-20 21:57:13 +0000
@@ -817,11 +817,11 @@
 (defun grep-read-regexp ()
   "Read regexp arg for interactive grep."
   (let ((default (grep-tag-default)))
-    (read-string
+    (read-regexp
      (concat "Search for"
             (if (and default (> (length default) 0))
                 (format " (default \"%s\"): " default) ": "))
-     nil 'grep-regexp-history default)))
+     default 'grep-regexp-history)))
 
 (defun grep-read-files (regexp)
   "Read files arg for interactive grep."

=== modified file 'lisp/replace.el'
--- a/lisp/replace.el   2012-09-20 21:35:40 +0000
+++ b/lisp/replace.el   2012-09-20 21:57:13 +0000
@@ -128,20 +128,21 @@
   (if query-replace-interactive
       (car (if regexp-flag regexp-search-ring search-ring))
     (let* ((history-add-new-input nil)
+          (prompt
+           (if query-replace-defaults
+               (format "%s (default %s -> %s): " prompt
+                       (query-replace-descr (car query-replace-defaults))
+                       (query-replace-descr (cdr query-replace-defaults)))
+             (format "%s: " prompt)))
           (from
            ;; The save-excursion here is in case the user marks and copies
            ;; a region in order to specify the minibuffer input.
            ;; That should not clobber the region for the query-replace itself.
            (save-excursion
-             (read-from-minibuffer
-              (if query-replace-defaults
-                  (format "%s (default %s -> %s): " prompt
-                          (query-replace-descr (car query-replace-defaults))
-                          (query-replace-descr (cdr query-replace-defaults)))
-                (format "%s: " prompt))
-              nil nil nil
-              query-replace-from-history-variable
-              nil t))))
+             (if regexp-flag
+                 (read-regexp prompt nil query-replace-from-history-variable)
+               (read-from-minibuffer
+                prompt nil nil nil query-replace-from-history-variable nil 
t)))))
       (if (and (zerop (length from)) query-replace-defaults)
          (cons (car query-replace-defaults)
                (query-replace-compile-replacement
@@ -1139,9 +1140,9 @@
                  "\\&"
                ;; Get the regexp for collection pattern.
                (let ((default (car occur-collect-regexp-history)))
-                 (read-string
+                 (read-regexp
                   (format "Regexp to collect (default %s): " default)
-                  nil 'occur-collect-regexp-history default)))
+                  default 'occur-collect-regexp-history)))
            ;; Otherwise normal occur takes numerical prefix argument.
            (when current-prefix-arg
              (prefix-numeric-value current-prefix-arg))))))
@@ -1228,14 +1229,10 @@
    (cons
     (let* ((default (car regexp-history))
           (input
-           (read-from-minibuffer
+           (read-regexp
             (if current-prefix-arg
                 "List lines in buffers whose names match regexp: "
-              "List lines in buffers whose filenames match regexp: ")
-            nil
-            nil
-            nil
-            'regexp-history)))
+              "List lines in buffers whose filenames match regexp: "))))
       (if (equal input "")
          default
        input))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]