Subject: Re: bug#40940: 27.0.91; project-query-replace-regexp stops too early

From: Eli Zaretskii <[email-masked]>
Date: Sun, 03 May 2020 20:10:38 +0300

> Cc: [email-masked], [email-masked], [email-masked]
> From: Dmitry Gutov <[email-masked]>
> Date: Sun, 3 May 2020 04:43:26 +0300
> 
> +(defun fileloop--case-fold (regexp case-fold)
> +  (let ((value
> +         (if (memql case-fold '(nil t))
> +             case-fold
> +           case-fold-search)))
> +    (if (and value search-upper-case)
> +        (isearch-no-upper-case-p regexp t)
> +      value)))

LGTM, thanks.  But don't you need to require isearch to get
isearch-no-upper-case-p? or to autoload it?

Here's the doc string I promised:

  (defun fileloop-initialize-replace (from to files case-fold &optional delimited)
    "Initialize a new round of query&replace on several files.
  FROM is a regexp and TO is the replacement to use.
  FILES describes the files, as in `fileloop-initialize'.
  CASE-FOLD can be t, nil, or `default':
    if it is nil, matching of FROM is case-sensitive.
    if it is t, matching of FROM is case-insensitive, except
       when `search-upper-case' is non-nil and FROM includes
       upper-case letters.
    if it is `default', the function uses the value of
       `case-fold-search' instead.
  DELIMITED if non-nil means replace only word-delimited matches."