emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master c0c79b0b460: Fido-mode: don't error if case-fold-search is global


From: João Távora
Subject: master c0c79b0b460: Fido-mode: don't error if case-fold-search is globally nil
Date: Tue, 19 Dec 2023 05:07:35 -0500 (EST)

branch: master
commit c0c79b0b4602d7c3505c41e08596386f725c2afd
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Fido-mode: don't error if case-fold-search is globally nil
    
    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
---
 lisp/minibuffer.el | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 1af890968d0..905ccacb2a7 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -4059,15 +4059,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'.")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]