]> git.donarmstrong.com Git - lib.git/blobdiff - emacs_el/configuration/don-configuration.org
Switch to capf primarily in company, fix headers and pieces
[lib.git] / emacs_el / configuration / don-configuration.org
index 3b175db2402c6a62efbd73af9a835e3a926530f8..003a8188062e24dbba26cc85a0113b40fe1087f5 100644 (file)
 #+BEGIN_SRC emacs-lisp
 ;; From http://www.emacswiki.org/emacs/LoadingLispFiles
 ;; execute conditional code when loading libraries
-(defmacro with-library (symbol &rest body)
-  `(when (require ,symbol nil t)
-     ,@body))
-(put 'with-library 'lisp-indent-function 1)
+(defmacro with-library (symbol &rest body)
+  `(when (require ,symbol nil t)
+;     ,@body))
+(put 'with-library 'lisp-indent-function 1)
 #+END_SRC
 
 * Variables
 #+BEGIN_SRC emacs-lisp
   (use-package flyspell
     :ensure t
-    :diminish flyspell-mode 🐝
+    :delight flyspell-mode 🐝
     :config
     (add-hook 'text-mode-hook 'turn-on-flyspell)
     (add-hook 'c-mode-common-hook 'flyspell-prog-mode)
 #+begin_src emacs-lisp :tangle yes
 (use-package flycheck
   :ensure t
-  :diminish 🦋
+  :delight 🦋
   :if (version<= "24.4" emacs-version)
   :commands flycheck-mode
   :hook ((prog-mode . flycheck-mode)
 ** Flymake
 #+begin_src emacs-lisp :tangle yes
   (use-package flymake
-    :diminish "Φ")
+    :delight "Φ")
 #+end_src
 
 ** Winnermode
 #+BEGIN_SRC emacs-lisp
   (use-package eyebrowse
     :ensure t
-    :diminish eyebrowse-mode
+    :delight eyebrowse-mode
     :init (setq eyebrowse-keymap-prefix (kbd "C-c e"))
     :config (progn
               (setq eyebrowse-wrap-around t)
@@ -312,9 +312,9 @@ value, scrolling continues until there is no more output.
 #+END_SRC
 
 ** Mode line cleaning
-*** Diminish
+*** Delight
 #+BEGIN_SRC emacs-lisp
-  (use-package diminish
+  (use-package delight
     :ensure t)
 #+END_SRC
 
@@ -365,7 +365,7 @@ value, scrolling continues until there is no more output.
 #+BEGIN_SRC emacs-lisp
 (use-package yasnippet
   :ensure t
-  :diminish yas-minor-mode
+  :delight yas-minor-mode
   :config (progn
             (yas-global-mode)
             (setq yas-verbosity 1)
@@ -436,7 +436,6 @@ value, scrolling continues until there is no more output.
        lsp-pyright-venv-path "~/miniconda3/envs")
   :hook ((python-mode . (lambda () 
                           (require 'lsp-pyright) (lsp-deferred)))))
-xb
 #+END_SRC
 ** Company
 #+BEGIN_SRC emacs-lisp
@@ -457,6 +456,19 @@ xb
         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)
@@ -468,24 +480,25 @@ xb
 #+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
@@ -521,6 +534,7 @@ xb
               )
     )
 #+END_SRC
+**** Bibtex
 #+BEGIN_SRC emacs-lisp
   (use-package company-bibtex
     :ensure t
@@ -528,64 +542,64 @@ xb
 #+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
 
@@ -794,6 +808,11 @@ Attempts to automatically identify the right indentation for a file
 
   ;; Optionally enable cycling for `vertico-next' and `vertico-previous'.
   ;; (setq vertico-cycle t)
+  :config
+  (define-key vertico-map "\r" #'vertico-directory-enter)
+  (define-key vertico-map "\d" #'vertico-directory-delete-char)
+  (define-key vertico-map "\M-\d" #'vertico-directory-delete-word)
+  (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy
   )
 
 ;; Persist history over Emacs restarts. Vertico sorts by history position.
@@ -1288,7 +1307,8 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
 ** Outlining
 *** Outline magic
 #+BEGIN_SRC emacs-lisp
-  (use-package outline-magic)
+; this package doesn't really do exactly what we want it to do
+;  (use-package outline-magic)
 #+END_SRC
 *** Outline mode
 #+BEGIN_SRC emacs-lisp
@@ -1399,7 +1419,7 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
 ** Abbrev Mode
 #+BEGIN_SRC emacs-lisp
   (use-package abbrev
-    :diminish abbrev-mode
+    :delight abbrev-mode
     :config
     ;; load abbreviations from 
     (setq abbrev-file-name       
@@ -1422,6 +1442,7 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
 ** Python Programming
 #+BEGIN_SRC emacs-lisp
 (use-package python-mode
+  :delight 🐍
   :hook
   (python-mode . pyenv-mode)
   (python-mode . flycheck-mode)
@@ -1434,9 +1455,10 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
   :ensure t
   )
 (use-package blacken
+  :delight ⚑
   :init
   (setq-default blacken-fast-unsafe t)
-  (setq-default blacken-line-length 80)
+  (setq-default blacken-line-length 80)
   :ensure t)
 (use-package anaconda-mode
   :ensure t
@@ -1448,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
@@ -1481,7 +1493,7 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
 ** Go language
 #+BEGIN_SRC emacs-lisp
 (use-package go-mode
-             :diminish "go"
+             :delight "go"
              :mode "\\.go"
              )
 #+END_SRC
@@ -1515,7 +1527,7 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
 #+BEGIN_SRC emacs-lisp
 (use-package message
   :ensure f
-  :diminish (message "✉")
+  :delight (message "✉")
   :mode ("muttng-[a-z0-9]+-[0-9]+-" . message-mode)
   :mode ("mutt-[a-z0-9]+-[0-9]+-" . message-mode)
   :hook 'my/message-mode-settings