oantolin / orderless

Emacs completion style that matches multiple regexps in any order

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Orderless with vertico cannot case-insensitively search files by default

IceAsteroid opened this issue · comments

Orderless with vertico cannot search case-insensitively for (find-file)/C-x-f by default with the following configuration:

;; vertico.el: A better completion minibuffer
  ;; Install & enable vertico
  (use-package vertico
    :init
    (vertico-mode)
    ;; Different scroll margin
    ;;;;(setq vertico-scroll-margin 0)
    ;; Show more candidates
    (setq vertico-count 25)
    ;; Grow and shrink the Vertico minibuffer
    ;;(setq vertico-resize t)
    ;; Optionally enable cycling for `vertico-next' and `vertico-previous'.
    (setq vertico-cycle t)
    )
  ;; Persist history over Emacs restarts. Vertico sorts by history position.
  (savehist-mode)

;; orderless.el: Advanced search scheme
#+begin_src emacs-lisp
  ;; Optionally use the `orderless' completion style.
  (use-package orderless
    :init
    ;; Configure a custom style dispatcher (see the Consult wiki)
    ;; (setq orderless-style-dispatchers '(+orderless-consult-dispatch orderless-affix-dispatch)
    ;;       orderless-component-separator #'orderless-escapable-split-on-space)
    (setq completion-styles '(orderless basic)
	  completion-category-overrides '((file (styles basic partial-completion)))))
  ;;; Disable case-sensitivity when minibuffer isn't invoked with orderless(Not sure)
  ;;;-Such as (find-file)
  ;;;(setq read-file-name-completion-ignore-case t
  ;;;   read-buffer-completion-ignore-case t
  ;;;   completion-ignore-case t)

Unless I uncomment the following lines, which are part in "(use-package orderless", as mentioned in the vertico repo's readme page, it then works.

  ;;; Disable case-sensitivity when minibuffer isn't invoked with orderless(Not sure)
  ;;;-Such as (find-file)
  ;;;(setq read-file-name-completion-ignore-case t
  ;;;   read-buffer-completion-ignore-case t
  ;;;   completion-ignore-case t)

Is this behavior expected by design, or is it just misconfigured, or a bug?

The commented lines are there precisely to ask for case insensitive file matching, uncomment them if that's what you want.

Actually, the lines

;;; Disable case-sensitivity when minibuffer isn't invoked with orderless(Not sure)
;;;-Such as (find-file)

were added by me..

This is why I asked, I was not sure if (find-file) was invoked with orderless properly. If invoked properly, the vertico readme page also says orderless enables case-insensitivity by default, but apparently I couldn't do it.


Edit:

Ok, I was confused by the weird behavior of eshell which it was enabled with case-insensitive completion, and thought I had case-insensitive completion enabled by orderless, but it was not, it was offered by either settings in bash, or eshell itself.

But after I specified the code as follows:

  ;;; Disable case-sensitivity when minibuffer isn't invoked with orderless(Not sure)
  ;;;-Such as (find-file)
  (setq read-file-name-completion-ignore-case t
     read-buffer-completion-ignore-case t
     completion-ignore-case t)

And eshell completion only matched files case-insensitively but not for directories even after the above code for case-insensitive completion was enabled, so it made me ask this questioni,

The solution is to set the following variable, found in here

(setq eshell-glob-case-insensitive t) ;does not work .
(setq eshell-cmpl-ignore-case t) ;;this works. Put it in your .emacs or .emacs.d/init.el.

Anyway, sorry for the disturbance.