Subject: bug#51858: 29.0.50; pcomplete not ignoring case

From: Lars Ingebrigtsen <[email-masked]>
Date: Mon, 15 Nov 2021 09:00:38 +0100

Carlos Pita <[email-masked]> writes:

>> Just to clarify -- read-file-name-completion-ignore-case works
>> everywhere else, but doesn't work in a *shell* buffer?
>
> C-x C-f ~/desk<tab>  --> ~/Desktop
>
> M-x shell<enter> cd ~/desk<tab>  --> no completion
>
> M-x shell<enter> cd ~/Desk<tab>  --> ~/Desktop

I think that's a "yes".  😀

Following the call sequence here is quite complicated.  The following
fixes the issue, but is it the correct solution here?

diff --git a/lisp/comint.el b/lisp/comint.el
index 544f0b8b82..0182839d5c 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -3289,22 +3289,23 @@ comint-filename-completion
     (comint--complete-file-name-data)))
 
 (defun comint-completion-file-name-table (string pred action)
-  (if (not (file-name-absolute-p string))
-      (completion-file-name-table string pred action)
-    (cond
-     ((memq action '(t lambda))
-      (completion-file-name-table
-       (concat comint-file-name-prefix string) pred action))
-     ((null action)
-      (let ((res (completion-file-name-table
-                  (concat comint-file-name-prefix string) pred action)))
-        (if (and (stringp res)
-                 (string-match
-                  (concat "\\`" (regexp-quote comint-file-name-prefix))
-                  res))
-            (substring res (match-end 0))
-          res)))
-     (t (completion-file-name-table string pred action)))))
+  (let ((completion-ignore-case read-file-name-completion-ignore-case))
+    (if (not (file-name-absolute-p string))
+        (completion-file-name-table string pred action)
+      (cond
+       ((memq action '(t lambda))
+        (completion-file-name-table
+         (concat comint-file-name-prefix string) pred action))
+       ((null action)
+        (let ((res (completion-file-name-table
+                    (concat comint-file-name-prefix string) pred action)))
+          (if (and (stringp res)
+                   (string-match
+                    (concat "\\`" (regexp-quote comint-file-name-prefix))
+                    res))
+              (substring res (match-end 0))
+            res)))
+       (t (completion-file-name-table string pred action))))))
 
 (defvar comint-unquote-function #'comint--unquote-argument
   "Function to use for completion of quoted data.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no