I'd like my fixed-string searches to be always case insensitive, my regexp searches to be always case sensitive, and I don't want search-upper-case to change the case of my search strings. This should apply to Isearch, query-replace[-regexp], {flush,keep}-lines, etc.
The way I went about it is I made searches case sensitive by default,
(setq-default case-fold-search nil) (setq search-upper-case nil) and let-bound case-fold-search to t around functions that search using fixed strings:
(defun ignoring-case (orig-fn &rest args) "Make ORIG-FN match ignoring case." (let ((case-fold-search t)) (apply orig-fn args))) (advice-add 'isearch-backward :around #'ignoring-case) (advice-add 'isearch-forward :around #'ignoring-case) (advice-add 'query-replace :around #'ignoring-case) It works mostly alright, except query-replace's preview of matches is always case-sensitive:
It's lying in the picture above. It will actually stop on all [Aa]'s to ask about replacing them:
How can I fix this?


M-x query-replace RET aa, all the matches (regardless of case) are highlighted. Does that not work for you? Am I missing something? Here is a screenshot .