]> git.donarmstrong.com Git - lib.git/commitdiff
Switch to capf primarily in company, fix headers and pieces
authorDon Armstrong <don@donarmstrong.com>
Sun, 1 Jan 2023 19:06:49 +0000 (11:06 -0800)
committerDon Armstrong <don@donarmstrong.com>
Sun, 1 Jan 2023 19:06:49 +0000 (11:06 -0800)
emacs_el/configuration/don-configuration.org

index 803aea916dc22f6516c4d7a9d7c0b7855878ba4a..003a8188062e24dbba26cc85a0113b40fe1087f5 100644 (file)
@@ -456,6 +456,19 @@ value, scrolling continues until there is no more output.
         company-minimum-prefix-length 1
         company-global-modes '(not)
         company-lighter-base "(C)")
+  (setq company-backends '(company-capf
+                           company-keywords
+                           company-semantic
+                           company-files
+                           company-etags
+                           company-elisp
+                           company-clang
+                           company-irony-c-headers
+                           company-irony
+                           company-jedi
+                           company-cmake
+                           company-ispell
+                           company-yasnippet))
   (global-company-mode 1)
   :bind (:map company-active-map
               ("C-n" . company-select-next)
@@ -467,24 +480,25 @@ value, scrolling continues until there is no more output.
 #+END_SRC
 *** C/C++
 #+BEGIN_SRC emacs-lisp
-  (use-package company-c-headers
-    :ensure t
-    :config (progn
-              (defun malb/ede-object-system-include-path ()
-                "Return the system include path for the current buffer."
-                (when ede-object
-                  (ede-system-include-path ede-object)))
-
-              (setq company-c-headers-path-system
-                    #'malb/ede-object-system-include-path)
+(use-package company-c-headers
+  :ensure t
+  :config (progn
+            (defun malb/ede-object-system-include-path ()
+              "Return the system include path for the current buffer."
+              (when ede-object
+                (ede-system-include-path ede-object)))
 
-              (add-to-list 'company-backends #'company-c-headers)))
+            (setq company-c-headers-path-system
+                  #'malb/ede-object-system-include-path)))
 #+END_SRC
 *** Python
 #+BEGIN_SRC emacs-lisp
-(use-package company-anaconda
+(use-package company-jedi
   :ensure t
-  :config (add-to-list 'company-backends #'company-anaconda))
+  :hook (python-mode  . 'jedi:setup)
+  :config
+  (setq jedi:complete-on-dot t)
+  )
 #+END_SRC
 *** Perl
 #+BEGIN_SRC emacs-lisp
@@ -520,6 +534,7 @@ value, scrolling continues until there is no more output.
               )
     )
 #+END_SRC
+**** Bibtex
 #+BEGIN_SRC emacs-lisp
   (use-package company-bibtex
     :ensure t
@@ -527,64 +542,64 @@ value, scrolling continues until there is no more output.
 #+END_SRC
 *** Shell
 
- #+BEGIN_SRC emacs-lisp
-   (use-package company-shell
-     :ensure t
-     :config (progn
-               (setq company-shell-modes '(sh-mode shell-mode))
-               (add-to-list 'company-backends 'company-shell)))
- #+END_SRC
+#+BEGIN_SRC emacs-lisp
+(use-package company-shell
+  :ensure t
+  :config (progn
+            (setq company-shell-modes '(sh-mode shell-mode))
+            (add-to-list 'company-backends 'company-shell)))
+#+END_SRC
 
 *** YaSnippet
 
- Add YasSippet support for all company backends. ([[https://github.com/syl20bnr/spacemacs/pull/179][source]])
+Add YasSippet support for all company backends. ([[https://github.com/syl20bnr/spacemacs/pull/179][source]])
 
- *Note:* Do this at the end of =company-mode= config.
+*Note:* Do this at the end of =company-mode= config.
 
- #+BEGIN_SRC emacs-lisp
-   (defvar malb/company-mode/enable-yas t
-     "Enable yasnippet for all backends.")
+#+BEGIN_SRC emacs-lisp
+(defvar malb/company-mode/enable-yas t
+  "Enable yasnippet for all backends.")
 
-   (defun malb/company-mode/backend-with-yas (backend)
-     (if (or (not malb/company-mode/enable-yas)
-             (and (listp backend)
-                  (member 'company-yasnippet backend)))
-         backend
-       (append (if (consp backend) backend (list backend))
-               '(:with company-yasnippet))))
+(defun malb/company-mode/backend-with-yas (backend)
+  (if (or (not malb/company-mode/enable-yas)
+          (and (listp backend)
+               (member 'company-yasnippet backend)))
+      backend
+    (append (if (consp backend) backend (list backend))
+            '(:with company-yasnippet))))
 
-   (setq company-backends
-         (mapcar #'malb/company-mode/backend-with-yas company-backends))
- #+END_SRC
+(setq company-backends
+      (mapcar #'malb/company-mode/backend-with-yas company-backends))
+#+END_SRC
 
 *** All the words
 
- Enable/disable company completion from ispell dictionaries ([[https://github.com/redguardtoo/emacs.d/blob/master/lisp/init-company.el][source]])
+Enable/disable company completion from ispell dictionaries ([[https://github.com/redguardtoo/emacs.d/blob/master/lisp/init-company.el][source]])
 
- #+BEGIN_SRC emacs-lisp
-   (defun malb/toggle-company-ispell ()
-     (interactive)
-     (cond
-      ((member '(company-ispell :with company-yasnippet) company-backends)
-       (setq company-backends (delete '(company-ispell :with company-yasnippet) company-backends))
-       (add-to-list 'company-backends '(company-dabbrev :with company-yasnippet) t)
-       (message "company-ispell disabled"))
-      (t
-       (setq company-backends (delete '(company-dabbrev :with company-yasnippet) company-backends))
-       (add-to-list 'company-backends '(company-ispell :with company-yasnippet) t)
-       (message "company-ispell enabled!"))))
-
-   (defun malb/company-ispell-setup ()
-     ;; @see https://github.com/company-mode/company-mode/issues/50
-     (when (boundp 'company-backends)
-       (make-local-variable 'company-backends)
-       (setq company-backends (delete '(company-dabbrev :with company-yasnippet) company-backends))
-       (add-to-list 'company-backends '(company-ispell :with company-yasnippet) t)
-       ;; https://github.com/redguardtoo/emacs.d/issues/473
-       (if (and (boundp 'ispell-alternate-dictionary)
-                ispell-alternate-dictionary)
-           (setq company-ispell-dictionary ispell-alternate-dictionary))))
- #+END_SRC
+#+BEGIN_SRC emacs-lisp
+(defun malb/toggle-company-ispell ()
+  (interactive)
+  (cond
+   ((member '(company-ispell :with company-yasnippet) company-backends)
+    (setq company-backends (delete '(company-ispell :with company-yasnippet) company-backends))
+    (add-to-list 'company-backends '(company-dabbrev :with company-yasnippet) t)
+    (message "company-ispell disabled"))
+   (t
+    (setq company-backends (delete '(company-dabbrev :with company-yasnippet) company-backends))
+    (add-to-list 'company-backends '(company-ispell :with company-yasnippet) t)
+    (message "company-ispell enabled!"))))
+
+(defun malb/company-ispell-setup ()
+  ;; @see https://github.com/company-mode/company-mode/issues/50
+  (when (boundp 'company-backends)
+    (make-local-variable 'company-backends)
+    (setq company-backends (delete '(company-dabbrev :with company-yasnippet) company-backends))
+    (add-to-list 'company-backends '(company-ispell :with company-yasnippet) t)
+    ;; https://github.com/redguardtoo/emacs.d/issues/473
+    (if (and (boundp 'ispell-alternate-dictionary)
+             ispell-alternate-dictionary)
+        (setq company-ispell-dictionary ispell-alternate-dictionary))))
+#+END_SRC
 
 *** Tab DWIM
 
@@ -1455,16 +1470,6 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
   (elpy-enable)
   )
 #+END_SRC
-# *** Jedi
-# #+BEGIN_SRC emacs-lisp
-#   (use-package company-jedi
-#     :ensure t
-#     :hook (python-mode . (add-to-list 'company-backends 'company-jedi))
-#     :hook (python-mode  . 'jedi:setup)
-#     :config
-#     (setq jedi:complete-on-dot t)
-#     )
-# #+END_SRC
 *** Black
 #+begin_src emacs-lisp :tangle yes
   (use-package python-black