]> git.eshelyaron.com Git - emacs.git/commitdiff
Fido-mode: don't error if case-fold-search is globally nil
authorJoão Távora <joaotavora@gmail.com>
Tue, 19 Dec 2023 10:06:45 +0000 (04:06 -0600)
committerEshel Yaron <me@eshelyaron.com>
Thu, 21 Dec 2023 20:53:59 +0000 (21:53 +0100)
bug#67884

To prevent errors, the same case-fold-search setting used for
originally selecting the candidate should be used when scoring it.

* lisp/minibuffer.el (completion--flex-score): Fix

(cherry picked from commit c0c79b0b4602d7c3505c41e08596386f725c2afd)

lisp/minibuffer.el

index 323a87cc6f9ca2094c234c7d52428560e7a0e621..1e8ee1abf3f0c6028f28dd7808699a949c8433a3 100644 (file)
@@ -4111,15 +4111,16 @@ LEN is the length of the completion string."
 (defun completion--flex-score (str re &optional dont-error)
   "Compute flex score of completion STR based on RE.
 If DONT-ERROR, just return nil if RE doesn't match STR."
-  (cond ((string-match re str)
-         (let* ((match-end (match-end 0))
-                (md (cddr
-                     (setq
-                      completion--flex-score-last-md
-                      (match-data t completion--flex-score-last-md)))))
-           (completion--flex-score-1 md match-end (length str))))
-        ((not dont-error)
-         (error "Internal error: %s does not match %s" re str))))
+  (let ((case-fold-search completion-ignore-case))
+    (cond ((string-match re str)
+           (let* ((match-end (match-end 0))
+                  (md (cddr
+                       (setq
+                        completion--flex-score-last-md
+                        (match-data t completion--flex-score-last-md)))))
+             (completion--flex-score-1 md match-end (length str))))
+          ((not dont-error)
+           (error "Internal error: %s does not match %s" re str)))))
 
 (defvar completion-pcm--regexp nil
   "Regexp from PCM pattern in `completion-pcm--hilit-commonality'.")