smart-scan icon indicating copy to clipboard operation
smart-scan copied to clipboard

Case is ignored when case-fold-search is t

Open djr7C4 opened this issue 3 years ago • 1 comments

Ideally, smartscan would know which languages have case insensitive symbols (like Common Lisp) and know when to ignore case and when to be case sensitive. However, this is probably more trouble than it is worth since symbols are almost always written with the same cases anyway.

An easy fix that seems good enough is to simply wrap the calls to search-forward, re-search-forward and re-search-backward in smartscan-symbol-replace and smartscan-symbol-goto with a

(let ((case-fold-search nil))
  ...)

djr7C4 avatar Jan 03 '23 07:01 djr7C4

Until this is patched, I'm using the following advice (posted in case anyone else wants it).

(defun without-case-folding (orig-fun &rest args)
  (let ((case-fold-search nil))
    (apply orig-fun args)))

(advice-add 'smartscan-symbol-goto :around 'without-case-folding)
(advice-add 'smartscan-symbol-replace :around 'without-case-folding)

djr7C4 avatar Jan 03 '23 07:01 djr7C4