summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2021-12-11 16:36:40 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2021-12-11 16:36:40 +0100
commit6d076f24807eec4fbc2c5f75414887c80ec5e028 (patch)
treee284e7d039959c6b05053df8442b89f777181270
parent89aaca77891d9c2c5c055a88b7e899470d92fe7c (diff)
README: Document company--multi-backend-adapter
-rw-r--r--README.org22
1 files changed, 21 insertions, 1 deletions
diff --git a/README.org b/README.org
index 5178cdf..dea6d1f 100644
--- a/README.org
+++ b/README.org
@@ -29,7 +29,9 @@ The command ~cape-symbol~ is particularily useful for documentation of Elisp
packages or configurations, since it completes elisp symbols anywere.
On the more experimental side, Cape has the super power to transform Company
-backends into Capfs and merge multiple Capfs into a Super-Capf!
+backends into Capfs and merge multiple Capfs into a Super-Capf! These
+transformers allow you to still take advantage of Company backends even if you
+are not using Company as frontend.
* Available Capfs
@@ -141,6 +143,21 @@ example completion backend, which can be used with both ~completion-at-point~
(setq company-backends '(emoji-backend))
#+end_src
+It is possible to merge/group multiple Company backends and use them as a single
+Capf using the ~company--multi-backend-adapter~ function from Company. The adapter
+transforms multiple Company backends into a single Company backend, which can
+then be used as a Capf via ~cape-company-to-capf~.
+
+#+begin_src emacs-lisp
+ (require 'company)
+ ;; Use the company-dabbrev and company-elisp backends together.
+ (setq completion-at-point-functions
+ (list
+ (cape-company-to-capf
+ (apply-partially #'company--multi-backend-adapter
+ '(company-dabbrev company-elisp)))))
+#+end_src
+
** Super-Capf - Merging multiple Capfs
/Throw multiple Capfs under the Cape and get a Super-Capf!/
@@ -157,6 +174,9 @@ and ~completion-table-in-turn~.
(list (cape-super-capf #'cape-dabbrev #'cape-dict #'cape-keyword)))
#+end_src
+See also the aforementioned ~~company--multi-backend-adapter~~ from Company, which
+allows you to merge multiple Company backends.
+
** Capf-Buster - Cache busting
/The Capf-Buster ensures that you always get a fresh set of candidates!/