oantolin / orderless

Emacs completion style that matches multiple regexps in any order

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cannot rename with orderless

mohan43u opened this issue · comments

Hi, this is my config

;; orderless                                                                                                                                                                                   
(use-package orderless
  :ensure t
  :custom
  (completion-styles '(orderless basic))
  (completion-category-overrides '((file . (styles basic partial-completion)))))

with this, when I try to rename a file workspaces-myprojects.org to workspace-myprojects.org from dired, emacs always thinks that I'm giving the same filename, but I'm not giving the same filename, I'm taking out last s from the workspaces, the completion selection when I type the new filename always shows workspaces-myprojects.org, it should not show after I type workspace-. How can I prevent this?

There are two separate issues here, neither of which actually has anything to do with orderless:

  1. Why does workspace-myprojects.org match workspace-myprojects.org even though it does not have the final s?

The answer is that this is not because of orderless. In your configuration you have specified that for file names you want Emacs to using the basic and partial-completion styles before it tries orderless. The partial-completion style is defined so that these two names match; indeed even wor-myp.org would match.

  1. How do you tell Emacs to use workspace-myprojects.org verbatim even if it does match workspaces-myprojects.org?

This was nothing to do with orderless or indeed any completion style and is instead something that you need to know how to do in the completion UI you are using, most have a dedicated command for this:

  • In vertico you use M-RET (vertico-exit-input).
  • In icomplete-mode or icomplete-vertical-mode you use RET (icomplete-ret)
  • In fido-mode or fido-vertical-mode you use M-j (icomplete-fido-exit)
  • Ivy and Helm have their own methods which I don't recall off the top of my head.