]> code.delx.au - gnu-emacs/blobdiff - lisp/replace.el
* lisp/emacs-lisp/pcase.el: Use PAT rather than UPAT in docstring
[gnu-emacs] / lisp / replace.el
index 2c7ad19ea3b94a4f1987e6236a89fd405a1d5f0b..8e71615ca14bba359e0967358a5e6a77a9eb8ca7 100644 (file)
@@ -1,6 +1,6 @@
 ;;; replace.el --- replace commands for Emacs
 
-;; Copyright (C) 1985-1987, 1992, 1994, 1996-1997, 2000-2014 Free
+;; Copyright (C) 1985-1987, 1992, 1994, 1996-1997, 2000-2015 Free
 ;; Software Foundation, Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
@@ -68,12 +68,12 @@ to the minibuffer that reads the string to replace, or invoke replacements
 from Isearch by using a key sequence like `C-s C-s M-%'." "24.3")
 
 (defcustom query-replace-from-to-separator
-  (propertize
-   (or (ignore-errors
-        (if (char-displayable-p ?\u2192) " \u2192 " " -> "))
-       " -> ")
-   'face 'minibuffer-prompt)
+  (propertize (if (char-displayable-p ?\u2192) " \u2192 " " -> ")
+              'face 'minibuffer-prompt)
   "String that separates FROM and TO in the history of replacement pairs."
+  ;; Avoids error when attempt to autoload char-displayable-p fails
+  ;; while preparing to dump, also stops customize-rogue listing this.
+  :initialize 'custom-initialize-delay
   :group 'matching
   :type 'sexp
   :version "25.1")
@@ -142,6 +142,8 @@ The return value can also be a pair (FROM . TO) indicating that the user
 wants to replace FROM with TO."
   (if query-replace-interactive
       (car (if regexp-flag regexp-search-ring search-ring))
+    ;; Reevaluating will check char-displayable-p that is
+    ;; unavailable while preparing to dump.
     (custom-reevaluate-setting 'query-replace-from-to-separator)
     (let* ((history-add-new-input nil)
           (separator
@@ -179,8 +181,7 @@ wants to replace FROM with TO."
                 (cdar query-replace-defaults) regexp-flag))
        (let* ((to (if (and (string-match separator from)
                            (get-text-property (match-beginning 0) 'separator from))
-                      (query-replace-compile-replacement
-                       (substring-no-properties from (match-end 0)) regexp-flag)))
+                      (substring-no-properties from (match-end 0))))
               (from (if to (substring-no-properties from 0 (match-beginning 0))
                       (substring-no-properties from))))
          (add-to-history query-replace-from-history-variable from nil t)
@@ -198,7 +199,7 @@ wants to replace FROM with TO."
              from
            (add-to-history query-replace-to-history-variable to nil t)
            (add-to-history 'query-replace-defaults (cons from to) nil t)
-           (cons from to)))))))
+           (cons from (query-replace-compile-replacement to regexp-flag))))))))
 
 (defun query-replace-compile-replacement (to regexp-flag)
   "Maybe convert a regexp replacement TO to Lisp.
@@ -1366,7 +1367,7 @@ See also `multi-occur-in-matching-buffers'."
           (ido-ignore-item-temp-list bufs))
       (while (not (string-equal
                   (setq buf (read-buffer
-                             (if (eq read-buffer-function 'ido-read-buffer)
+                             (if (eq read-buffer-function #'ido-read-buffer)
                                  "Next buffer to search (C-j to end): "
                                "Next buffer to search (RET to end): ")
                              nil t))