Subject: bug#78894: 29.3; DIRED OUTPUT

From: Burak Bayramli <[email-masked]>
Date: Wed, 25 Jun 2025 19:50:16 +0300

Hi, I applied your patch to the Emacs source on my installation
(29.3), under /usr/share/emacs/29.3/lisp/files.el.gz, I copied this
file under a seperate directory, outside git, and I did

```
patch -p1 lisp/files.el e1.patch
```

I get

```
patching file lisp/files.el
Hunk #1 FAILED at 8288.
Hunk #2 FAILED at 8328.
Hunk #3 FAILED at 8471.
3 out of 3 hunks FAILED -- saving rejects to file lisp/files.el.rej
```

I am not a regular contributor, I'm not sure I used the right command

On Wed, Jun 25, 2025 at 7:04 PM Eli Zaretskii <[email-masked]> wrote:

> > Cc: [email-masked]
> > Date: Wed, 25 Jun 2025 18:51:52 +0300
> > From: Eli Zaretskii <[email-masked]>
> >
> > > From: Burak Bayramli <[email-masked]>
> > > Date: Wed, 25 Jun 2025 18:39:50 +0300
> > >
> > > Additional info: I went through my .emacs and was able to find out
> when the corrupted output occurs, it
> > > happens whenever I have
> > >
> > > '(current-language-environment "Turkish")
> > >  '(default-input-method "turkish-postfix")
> >
> > Ah, now it all makes sense.  Turkish locale is known to cause some
> > problems when searching for text that includes the letter 'i' case
> > insensitively.  Let me see what can be done about this.
>
> The patch below should fix this, please try it.
>
> diff --git a/lisp/files.el b/lisp/files.el
> index 04a212b..e5085ed 100644
> --- a/lisp/files.el
> +++ b/lisp/files.el
> @@ -8288,10 +8288,10 @@ insert-directory-clean
>      ;; "//DIRED-OPTIONS//" line, but no "//DIRED//" line.
>      ;; We take care of that case later.
>      (forward-line -2)
> -    (when (looking-at "//SUBDIRED//")
> +    (when (let ((case-fold-search nil)) (looking-at "//SUBDIRED//"))
>        (delete-region (point) (progn (forward-line 1) (point)))
>        (forward-line -1))
> -    (if (looking-at "//DIRED//")
> +    (if (let ((case-fold-search nil)) (looking-at "//DIRED//"))
>         (let ((end (line-end-position))
>               (linebeg (point))
>               error-lines)
> @@ -8328,7 +8328,7 @@ insert-directory-clean
>        ;; "//DIRED-OPTIONS//"-line, but no "//DIRED//"-line
>        ;; and we went one line too far back (see above).
>        (forward-line 1))
> -    (if (looking-at "//DIRED-OPTIONS//")
> +    (if (let ((case-fold-search nil)) (looking-at "//DIRED-OPTIONS//"))
>         (delete-region (point) (progn (forward-line 1) (point))))))
>
>  ;; insert-directory
> @@ -8471,9 +8471,9 @@ insert-directory
>                 (member "--dired" switches))
>           (save-excursion
>             (forward-line -2)
> -           (when (looking-at "//SUBDIRED//")
> +           (when (let ((case-fold-search nil)) (looking-at
> "//SUBDIRED//"))
>               (forward-line -1))
> -           (if (looking-at "//DIRED//")
> +           (if (let ((case-fold-search nil)) (looking-at "//DIRED//"))
>                 (setq result 0))))
>
>         (when (and (not (eq 0 result))
>