oantolin / orderless

Emacs completion style that matches multiple regexps in any order
GNU General Public License v3.0
771 stars 27 forks source link

Case insensitivity not working for Upper case. #159

Closed gety9 closed 9 months ago

gety9 commented 9 months ago

Thanks for amazing project.

Do i need anything else to make match case insensitive other than

  (setq completion-styles '(orderless)
    read-file-name-completion-ignore-case t
    read-buffer-completion-ignore-case t
    completion-ignore-case t))

Cause it's not working for me for Upper case letters. I mean if i have file "/.../Tech.el" and type "tech" it matched, but if i have file "/.../styles.el" and type "Styles" it doesn't match.

Full config

(use-package consult
  :config
  (consult-customize
    consult-buffer :preview-key ">"
    consult-line   :preview-key ">"))

(use-package embark
  :demand t)
(use-package embark-consult)

(defun my/vertico-truncate-candidates (args)
  (if-let ((arg (car args))
           (type (get-text-property 0 'multi-category arg))
           ((eq (car-safe type) 'file))
           (w (max 25 (- (window-width) 55)))
           (l (length arg))
           ((> l w)))
      (setcar args (concat "…" (truncate-string-to-width arg l (- l w)))))
  args)
(advice-add #'vertico--format-candidate :filter-args #'my/vertico-truncate-candidates)
(use-package vertico
  :init
  (vertico-mode))

(use-package marginalia
  :init
  (marginalia-mode))

(use-package orderless
  :demand t
  :init
  (setq completion-styles '(orderless)
    read-file-name-completion-ignore-case t
    read-buffer-completion-ignore-case t
    completion-ignore-case t))
oantolin commented 9 months ago

Orderless has a user option called orderless-smart-case which is set to t by default, which means "match case insensitively if the input is all lowercase; match case sensitively if there are any uppercase letters in the input". (This variable is patterned after the similar search-upper-case option for isearch.) If you set orderless-smart-case to nil, then orderless does no special case-sensitivity processing and case-sensitivity is determined by the values of completion-ignore-case, read-file-name-completion-ignore-case and read-buffer-completion-ignore-case.

Given that you use orderless, you could have found this option with C-h v case orderless. 😛

gety9 commented 9 months ago

thank you!