dev: merge from master

This commit is contained in:
Matt Nish-Lapidus 2024-08-25 17:59:12 -04:00
commit 1f75958e90
11 changed files with 91 additions and 53 deletions

View file

@ -74,31 +74,23 @@ orderless."
(completion-styles +vertico-company-completion-styles))
(apply fn args)))
(setq orderless-affix-dispatch-alist
`((?! . ,#'orderless-without-literal)
(?& . ,#'orderless-annotation)
(?% . ,#'char-fold-to-regexp)
(?` . ,#'orderless-initialism)
(?= . ,#'orderless-literal)
(?^ . ,#'orderless-literal-prefix)
(?~ . ,#'orderless-flex)))
(defun +vertico-orderless-dispatch (pattern _index _total)
(cond
;; Ensure $ works with Consult commands, which add disambiguation suffixes
((string-suffix-p "$" pattern)
`(orderless-regexp . ,(concat (substring pattern 0 -1) "[\x200000-\x300000]*$")))
;; Ignore single !
((string= "!" pattern) `(orderless-literal . ""))
;; Without literal
((string-prefix-p "!" pattern) `(orderless-without-literal . ,(substring pattern 1)))
;; Annotation
((string-prefix-p "&" pattern) `(orderless-annotation . ,(substring pattern 1)))
((string-suffix-p "&" pattern) `(orderless-annotation . ,(substring pattern 0 -1)))
;; Character folding
((string-prefix-p "%" pattern) `(char-fold-to-regexp . ,(substring pattern 1)))
((string-suffix-p "%" pattern) `(char-fold-to-regexp . ,(substring pattern 0 -1)))
;; Initialism matching
((string-prefix-p "`" pattern) `(orderless-initialism . ,(substring pattern 1)))
((string-suffix-p "`" pattern) `(orderless-initialism . ,(substring pattern 0 -1)))
;; Literal matching
((string-prefix-p "=" pattern) `(orderless-literal . ,(substring pattern 1)))
((string-suffix-p "=" pattern) `(orderless-literal . ,(substring pattern 0 -1)))
;; Flex matching
((string-prefix-p "~" pattern) `(orderless-flex . ,(substring pattern 1)))
((string-suffix-p "~" pattern) `(orderless-flex . ,(substring pattern 0 -1)))))
;; TODO: Find a way to deduplicate this code from the corfu module.
`(orderless-regexp . ,(concat (substring pattern 0 -1) "[\x200000-\x300000]*$")))))
(add-to-list 'orderless-style-dispatchers '+vertico-orderless-dispatch)
(add-to-list
'completion-styles-alist
'(+vertico-basic-remote
@ -110,7 +102,6 @@ orderless."
;; note that despite override in the name orderless can still be used in
;; find-file etc.
completion-category-overrides '((file (styles +vertico-basic-remote orderless partial-completion)))
orderless-style-dispatchers '(+vertico-orderless-dispatch)
orderless-component-separator #'orderless-escapable-split-on-space)
;; ...otherwise find-file gets different highlighting than other commands
(set-face-attribute 'completions-first-difference nil :inherit nil))