Fix 'insert-directory' in Turkish language-environment

* lisp/files.el (insert-directory-clean, insert-directory): Use
case-sensitive search for "//DIRED//" and similar strings.
(Bug#78894)
This commit is contained in:
Eli Zaretskii 2025-06-25 12:17:59 -04:00
parent 1406e583fe
commit e68ad70af6

View file

@ -8160,10 +8160,14 @@ Valid wildcards are `*', `?', `[abc]' and `[a-z]'."
;; "//DIRED-OPTIONS//" line, but no "//DIRED//" line. ;; "//DIRED-OPTIONS//" line, but no "//DIRED//" line.
;; We take care of that case later. ;; We take care of that case later.
(forward-line -2) (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))) (delete-region (point) (progn (forward-line 1) (point)))
(forward-line -1)) (forward-line -1))
(if (looking-at "//DIRED//") (if (let ((case-fold-search nil)) (looking-at "//DIRED//"))
(let ((end (line-end-position)) (let ((end (line-end-position))
(linebeg (point)) (linebeg (point))
error-lines) error-lines)
@ -8200,7 +8204,7 @@ Valid wildcards are `*', `?', `[abc]' and `[a-z]'."
;; "//DIRED-OPTIONS//"-line, but no "//DIRED//"-line ;; "//DIRED-OPTIONS//"-line, but no "//DIRED//"-line
;; and we went one line too far back (see above). ;; and we went one line too far back (see above).
(forward-line 1)) (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)))))) (delete-region (point) (progn (forward-line 1) (point))))))
;; insert-directory ;; insert-directory
@ -8342,11 +8346,12 @@ normally equivalent short `-D' option is just passed on to
(string-match "--dired\\>" switches) (string-match "--dired\\>" switches)
(member "--dired" switches)) (member "--dired" switches))
(save-excursion (save-excursion
(forward-line -2) (let ((case-fold-search nil))
(when (looking-at "//SUBDIRED//") (forward-line -2)
(forward-line -1)) (when (looking-at "//SUBDIRED//")
(if (looking-at "//DIRED//") (forward-line -1))
(setq result 0)))) (if (looking-at "//DIRED//")
(setq result 0)))))
(when (and (not (eq 0 result)) (when (and (not (eq 0 result))
(eq insert-directory-ls-version 'unknown)) (eq insert-directory-ls-version 'unknown))