Subject: bug#78894: 29.3; DIRED OUTPUT

From: Eli Zaretskii <[email-masked]>
Date: Wed, 25 Jun 2025 19:04:07 +0300

> 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))