Tweak the orderless and minibuffer setups

This commit is contained in:
Gerard Vermeulen 2022-04-17 21:04:03 +02:00
parent c063df796c
commit 0ba35a5940

View File

@ -858,22 +858,21 @@ file.
:CUSTOM_ID: sec:orderless-configuration
:END:
Listing [[lst:configure-orderless]] enables =orderless=.
Listing [[lst:configure-orderless]] configures [[info:orderless#Company][orderless for company (info)]].
#+caption[Configure =orderless=]:
#+caption: Configure =orderless=.
#+name: lst:configure-orderless
#+begin_src emacs-lisp
(when (fboundp 'orderless-filter)
(with-eval-after-load 'orderless
(custom-set-variables
;; https://github.com/purcell/emacs.d/issues/778
'(completion-styles '(basic completion-partial orderless))
'(completion-category-defaults nil)
'(completion-category-overrides
'((file (styles partial-completion)))))
(add-hook 'minibuffer-setup-hook
(defun my-on-minibuffer-setup-hook()
(setq-default completion-styles '(substring orderless)))))
'(orderless-component-separator " +"))
(defun just-one-face (fn &rest args)
(let ((orderless-match-faces [completions-common-part]))
(apply fn args)))
(advice-add 'company-capf--candidates :around #'just-one-face))
#+end_src
** [[info:embark#Top][Embark (info)]]
@ -1047,7 +1046,14 @@ previous input in the minibuffer. Listing
#+caption: Enable =minibuffer-history-completion=.
#+name: lst:enable-minibuffer-history-completion
#+begin_src emacs-lisp
(with-eval-after-load 'emacs
(with-eval-after-load 'minibuffer
;; https://github.com/oantolin/emacs-config/blob/master/init.el#L333
(custom-set-variables
'(completion-category-defaults nil)
'(completion-category-overrides '((file (styles basic partial-completion))))
'(completion-ignore-case t)
'(completion-styles '(orderless basic partial-completion)))
(defun minibuffer-setup-history-completions ()
(unless (or minibuffer-completion-table minibuffer-completion-predicate)
(setq-local minibuffer-completion-table