From: João Távora Date: Tue, 19 Dec 2023 10:06:45 +0000 (-0600) Subject: Fido-mode: don't error if case-fold-search is globally nil X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c0c79b0b4602d7c3505c41e08596386f725c2afd;p=emacs.git 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 --- 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'.")