]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix 'insert-directory' in Turkish language-environment
authorEli Zaretskii <eliz@gnu.org>
Wed, 25 Jun 2025 16:17:59 +0000 (12:17 -0400)
committerEshel Yaron <me@eshelyaron.com>
Wed, 23 Jul 2025 19:18:26 +0000 (21:18 +0200)
* lisp/files.el (insert-directory-clean, insert-directory): Use
case-sensitive search for "//DIRED//" and similar strings.
(Bug#78894)

(cherry picked from commit e68ad70af6d621895016548b6929e42b8a743a93)

lisp/files.el

index 61c6698459a4f58a2a8016fb1a2381e43bfdedc8..b335d8d9651c6242de1d98523e09e96c7ebe6835 100644 (file)
@@ -8220,10 +8220,14 @@ Valid wildcards are `*', `?', `[abc]' and `[a-z]'."
     ;; "//DIRED-OPTIONS//" line, but no "//DIRED//" line.
     ;; We take care of that case later.
     (forward-line -2)
-    (when (looking-at "//SUBDIRED//")
+    ;; We reset case-fold-search here and elsewhere, because
+    ;; case-insensitive search for strings with uppercase 'I' will fail
+    ;; in language environments (such as Turkish) where 'I' downcases to
+    ;; 'ı', not to 'i'.
+    (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)
@@ -8260,7 +8264,7 @@ Valid wildcards are `*', `?', `[abc]' and `[a-z]'."
       ;; "//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
@@ -8402,11 +8406,12 @@ normally equivalent short `-D' option is just passed on to
                  (string-match "--dired\\>" switches)
                (member "--dired" switches))
          (save-excursion
-           (forward-line -2)
-           (when (looking-at "//SUBDIRED//")
-             (forward-line -1))
-           (if (looking-at "//DIRED//")
-               (setq result 0))))
+            (let ((case-fold-search nil))
+             (forward-line -2)
+             (when (looking-at "//SUBDIRED//")
+               (forward-line -1))
+             (if (looking-at "//DIRED//")
+                 (setq result 0)))))
 
        (when (and (not (eq 0 result))
                   (eq insert-directory-ls-version 'unknown))