Function: query-replace-read-args

query-replace-read-args is a byte-compiled function defined in replace.el.gz.

Signature

(query-replace-read-args PROMPT REGEXP-FLAG &optional NOERROR NO-HIGHLIGHT)

Source Code

;; Defined in /usr/src/emacs/lisp/replace.el.gz
(defun query-replace-read-args (prompt regexp-flag &optional noerror no-highlight)
  (unless noerror
    (barf-if-buffer-read-only))
  (save-mark-and-excursion
    (let* ((delimited-flag (and current-prefix-arg
                                (not (eq current-prefix-arg '-))))
           (from (minibuffer-with-setup-hook
                     (minibuffer-lazy-highlight-setup
                      :case-fold case-fold-search
                      :filter (when (use-region-p)
                                (replace--region-filter
                                 (funcall region-extract-function 'bounds)))
                      :highlight (and query-replace-lazy-highlight (not no-highlight))
                      :regexp regexp-flag
                      :regexp-function (or replace-regexp-function
                                           delimited-flag
                                           (and replace-char-fold
                                                (not regexp-flag)
                                                #'char-fold-to-regexp))
                      :transform (lambda (string)
                                   (let* ((split (query-replace--split-string string))
                                          (from-string (if (consp split) (car split) split)))
                                     (when (and case-fold-search search-upper-case)
                                       (setq isearch-case-fold-search
                                             (isearch-no-upper-case-p from-string regexp-flag)))
                                     from-string)))
                   (query-replace-read-from prompt regexp-flag)))
           (to (if (consp from) (prog1 (cdr from) (setq from (car from)))
                 (query-replace-read-to from prompt regexp-flag))))
      (list from to
            (or delimited-flag
                (and (plist-member (text-properties-at 0 from) 'isearch-regexp-function)
                     (get-text-property 0 'isearch-regexp-function from)))
            (and current-prefix-arg (eq current-prefix-arg '-))))))