From fbf969e3ae0ee96c37ac27550d7869d5d9de1c61 Mon Sep 17 00:00:00 2001 From: Narendra Joshi Date: Mon, 28 Jun 2021 22:16:15 +0200 Subject: Add note about custom styles for `company-capf' --- README.org | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.org b/README.org index a6dc214..d27ffc6 100644 --- a/README.org +++ b/README.org @@ -387,6 +387,19 @@ But there are a couple of points of discomfort: #+end_src (Aren't dynamically scoped variables and the advice system nifty?) + + If you would like to use different =completion-styles= with =company-capf= instead, you + can add this to your config: + + #+begin_src emacs-lisp + ;; https://www.reddit.com/r/emacs/comments/nichkl/how_to_use_different_completion_styles_in_the/ + (advice-add 'company-capf + :around + (lambda (capf-fn &rest args) + (let ((completion-styles '(basic partial-completion))) + (apply capf-fn args)))) + #+end_src + * Related packages -- cgit v1.0 From 531372bd5486a3bcf46ca6689e7a0bd0f1f8e359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20Antol=C3=ADn?= Date: Sun, 23 Oct 2022 12:07:40 -0500 Subject: Name advice function, link to u/hvis's comment --- README.org | 21 +++++++++++---------- orderless.texi | 13 +++++++++++++ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/README.org b/README.org index d27ffc6..a660016 100644 --- a/README.org +++ b/README.org @@ -388,17 +388,18 @@ But there are a couple of points of discomfort: (Aren't dynamically scoped variables and the advice system nifty?) - If you would like to use different =completion-styles= with =company-capf= instead, you - can add this to your config: +If you would like to use different =completion-styles= with =company-capf= instead, you +can add this to your config: - #+begin_src emacs-lisp - ;; https://www.reddit.com/r/emacs/comments/nichkl/how_to_use_different_completion_styles_in_the/ - (advice-add 'company-capf - :around - (lambda (capf-fn &rest args) - (let ((completion-styles '(basic partial-completion))) - (apply capf-fn args)))) - #+end_src +#+begin_src emacs-lisp + ;; We follow a suggestion by company maintainer u/hvis: + ;; https://www.reddit.com/r/emacs/comments/nichkl/comment/gz1jr3s/ + (defun company-completion-styles (capf-fn &rest args) + (let ((completion-styles '(basic partial-completion))) + (apply capf-fn args)) + + (advice-add 'company-capf :around #'company-completion-styles) +#+end_src * Related packages diff --git a/orderless.texi b/orderless.texi index 3b84d37..e4404c4 100644 --- a/orderless.texi +++ b/orderless.texi @@ -460,6 +460,19 @@ face with this configuration: (Aren't dynamically scoped variables and the advice system nifty?) @end enumerate +If you would like to use different @samp{completion-styles} with @samp{company-capf} instead, you +can add this to your config: + +@lisp +;; We follow a suggestion by company maintainer u/hvis: +;; https://www.reddit.com/r/emacs/comments/nichkl/comment/gz1jr3s/ +(defun company-completion-styles (capf-fn &rest args) + (let ((completion-styles '(basic partial-completion))) + (apply capf-fn args)) + +(advice-add 'company-capf :around #'company-completion-styles) +@end lisp + @node Related packages @chapter Related packages -- cgit v1.0