diff options
author | David Morgan <djm_uk@protonmail.com> | 2022-08-26 16:02:24 +0100 |
---|---|---|
committer | David Morgan <djm_uk@protonmail.com> | 2022-08-26 16:02:24 +0100 |
commit | 088688b8433325c81c96a561f78e9166107e1aa4 (patch) | |
tree | dc52e5bea2b68ae9f7da692125a72a19cec0deff | |
parent | d9e2d08549c313375d261e7dc2dbb8f895b0a137 (diff) | |
download | dotfiles-088688b8433325c81c96a561f78e9166107e1aa4.tar.gz |
Add version of orderless-strict-leading-initialism
-rw-r--r-- | .emacs.d/lisp/init-completion.el | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/.emacs.d/lisp/init-completion.el b/.emacs.d/lisp/init-completion.el index 4c42716..429a6f5 100644 --- a/.emacs.d/lisp/init-completion.el +++ b/.emacs.d/lisp/init-completion.el @@ -67,6 +67,15 @@ (setq-local orderless-matching-styles '(orderless-literal) orderless-style-dispatchers nil)) :config + (defun orderless-strict-leading-initialism (component) + "Match a component as a strict leading initialism. +This means the characters in COMPONENT must occur in the +candidate, in that order, at the beginning of words, with +no words in between, beginning with the first word." + (orderless--separated-by '(seq (zero-or-more word) (zero-or-more punct)) + (cl-loop for char across component collect `(seq word-start ,char)) + '(seq string-start))) + ;; Recognizes the following patterns: ;; * ~flex flex~ ;; * =literal literal= @@ -90,17 +99,15 @@ ((string-prefix-p "!" pattern) `(orderless-without-literal . ,(substring pattern 1))) ((string-suffix-p "!" pattern) `(orderless-without-literal . ,(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))) + ((string-prefix-p "`" pattern) `(orderless-strict-leading-initialism . ,(substring pattern 1))) + ((string-suffix-p "`" pattern) `(orderless-strict-leading-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))))) - ;; (setq orderless-matching-styles '(orderless-literal orderless-regexp orderless-strict-leading-initialism) - ;; orderless-style-dispatchers '(my/orderless-dispatch)) - (setq orderless-matching-styles '(orderless-literal orderless-regexp orderless-initialism) + (setq orderless-matching-styles '(orderless-literal orderless-prefixes orderless-regexp orderless-strict-leading-initialism) orderless-style-dispatchers '(my/orderless-dispatch))) ;; code completion - corfu |