]> git.donarmstrong.com Git - lib.git/blobdiff - emacs_el/configuration/don-configuration.org
remove magit and tiny-tools (I'm using straight to load them)
[lib.git] / emacs_el / configuration / don-configuration.org
index 7777f55ea13ed47740703c918ead72e19ebade5c..60f3c536bf3d40536761d963af0e11bd92987e80 100644 (file)
@@ -487,20 +487,29 @@ value, scrolling continues until there is no more output.
   (lsp-completion-mode . my/lsp-mode-setup-completion)
   :custom
   (lsp-completion-provider :none) ;; we use Corfu!
+  :config
+   (add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]venv\\'")
 )
-;; Provides visual help in the buffer 
-;; For example definitions on hover. 
-;; The `imenu` lets me browse definitions quickly.
+#+END_SRC
+** LSP mode
+#+BEGIN_SRC emacs-lisp
+;; provides visual help in the buffer 
+;; for example definitions on hover. 
+;; the `imenu` lets me browse definitions quickly.
 (use-package lsp-ui
   :defer t
+  :after lsp-mode
   :config
-  (setq lsp-ui-sideline-enable nil
+  (setq lsp-ui-sideline-enable t
            lsp-ui-doc-delay 2)
   :hook (lsp-mode . lsp-ui-mode)
   :bind (:map lsp-ui-mode-map
              ("C-c i" . lsp-ui-imenu)))
-;; Language server for Python 
-;; Read the docs for the different variables set in the config.
+#+END_SRC
+*** LSP Pyright -- Python language server
+#+BEGIN_SRC emacs-lisp
+;; language server for python 
+;; read the docs for the different variables set in the config.
 (use-package lsp-pyright
   :defer t
   :config
@@ -516,22 +525,35 @@ value, scrolling continues until there is no more output.
 ** Corfu
 #+BEGIN_SRC emacs-lisp
 (use-package corfu
-  :ensure t
-  :demand t
   ;; Optional customizations
   :custom
   (corfu-cycle t)                ;; Enable cycling for `corfu-next/previous'
   (corfu-auto t)                 ;; Enable auto completion
   (corfu-separator ?\s)          ;; Orderless field separator
-  (corfu-quit-at-boundary nil)   ;; Never quit at completion boundary
-  (corfu-quit-no-match nil)      ;; Never quit, even if there is no match
+  (corfu-quit-at-boundary t)
+  (corfu-quit-no-match 'separator)
   (corfu-preview-current nil)    ;; Disable current candidate preview
   (corfu-preselect 'prompt)      ;; Preselect the prompt
   (corfu-on-exact-match nil)     ;; Configure handling of exact matches
   (corfu-scroll-margin 5)        ;; Use scroll margin
 
+  :bind (
+         :map corfu-map
+              ("M-m" . corfu-move-to-minibuffer)
+              )
+  :init
+  (global-corfu-mode)
+  (setq completion-cycle-threshold 3)
+  (setq tab-always-indent 'complete)
   :config
-  (global-corfu-mode))
+  (defun corfu-move-to-minibuffer ()
+    (interactive)
+    (when completion-in-region--data
+      (let ((completion-extra-properties corfu--extra)
+            completion-cycle-threshold completion-cycling)
+        (apply #'consult-completion-in-region completion-in-region--data))))
+  (add-to-list 'corfu-continue-commands #'corfu-move-to-minibuffer)
+  )
 #+END_SRC
 ** Dabbrv
 #+BEGIN_SRC emacs-lisp
@@ -550,7 +572,6 @@ value, scrolling continues until there is no more output.
 ;; load tinyprocmail
 (use-package tinyprocmail
   :straight (tinytools :type git :type git :host github :repo "jaalto/project--emacs-tiny-tools")
-  ; :load-path "~/lib/emacs_el/tiny-tools/lisp/tiny"
   :mode (".procmailrc" . turn-on-tinyprocmail-mode)
   )
 #+END_SRC
@@ -567,15 +588,18 @@ value, scrolling continues until there is no more output.
   )
 (use-package magit-annex
   :defer t
+  :after magit
   )
 (use-package magit-vcsh
   :defer t
+  :after magit
   )
 #+END_SRC
 
 *** Forge (github/gitlab)
 #+BEGIN_SRC emacs-lisp
 (use-package forge
+  :defer t
   :after magit
   )
 #+END_SRC
@@ -583,15 +607,15 @@ value, scrolling continues until there is no more output.
 ** Perl
 #+BEGIN_SRC emacs-lisp
 (use-package cperl-mode
+  :mode ("\\.pl'" . cperl-mode)
+  ("\\.perl5\\'" . cperl-mode)
+  ("\\.perl\\'" . cperl-mode)
+  ("\\.miniperl\\'" . cperl-mode)
+  ("\\.\\([Pp][Llm]\\|al\\)\\'" . cperl-mode)
+    ;; use c-mode for perl .xs files
+  ("\\.xs\\'" . c-mode)
   :config
-  (progn
-    ;; Use c-mode for perl .xs files
-    (add-to-list 'auto-mode-alist '("\\.xs\\'" . c-mode))
-    (add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode))
-    (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
-    (add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
-    (add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
-    (setq cperl-hairy t
+       (setq cperl-hairy t
           cperl-indent-level 4
           cperl-auto-newline nil
           cperl-auto-newline-after-colon nil
@@ -606,13 +630,12 @@ value, scrolling continues until there is no more output.
           cperl-tab-always-indent t)
     (setq cperl-lazy-help-time nil)
     ;;(add-hook 'cperl-mode-hook (lambda () (cperl-set-style "PerlStyle")))
-))
+)
 #+END_SRC
 
 ** Markdown mode
 #+BEGIN_SRC emacs-lisp
 (use-package markdown-mode
-  :ensure t
   :defer t
   :mode (("\\.md\\'" . markdown-mode)
          ("\\.mdwn\\'" . markdown-mode)
@@ -632,9 +655,11 @@ value, scrolling continues until there is no more output.
 #+BEGIN_SRC emacs-lisp
 ; load sql-indent when sql is loaded
 (use-package sql-indent
+  :after sql
   :hook sql-mode
   )
 (use-package sql
+  :commands (sql-mode)
   :mode (("\\.sql\\'" . sql-mode))
   )
 #+END_SRC
@@ -740,8 +765,7 @@ Attempts to automatically identify the right indentation for a file
 ** Orderless: advanced completion style
 #+begin_src emacs-lisp
 (use-package orderless
-  :demand t
-  :config
+  :init
   ;; Configure a custom style dispatcher (see the Consult wiki)
   ;; (setq orderless-style-dispatchers '(+orderless-dispatch)
   ;;       orderless-component-separator #'orderless-escapable-split-on-space)
@@ -784,6 +808,12 @@ Attempts to automatically identify the right indentation for a file
   :hook
   (embark-collect-mode . consult-preview-at-point-mode))
 #+end_src
+** which-key (show possible completions of a key combination)
+#+BEGIN_SRC emacs-lisp
+(use-package which-key
+  :demand t
+  )
+#+END_SRC
 ** Consult
 #+begin_src emacs-lisp
 (use-package consult
@@ -1007,13 +1037,17 @@ _d_: subtree
 ** Reftex
 #+BEGIN_SRC emacs-lisp
 (use-package reftex
+  :hook ((LaTeX-mode latex-mode) . reftex-mode)
   :config
   (setq-default reftex-default-bibliography
-                  '("~/projects/research/references.bib")))
+                  '("~/projects/research/references.bib"))
+  (setq-default reftex-plug-into-AUCTeX t)
+  )
 #+END_SRC
 ** BibTex
 #+BEGIN_SRC emacs-lisp
 (use-package bibtex
+  :mode "\\.bib\\'"
   :config (setq bibtex-user-optional-fields
                 (quote (("annote" "Personal annotation (ignored)")
                         ("abstract" "")
@@ -1024,24 +1058,14 @@ _d_: subtree
 #+END_SRC
 ** LaTeX
 #+BEGIN_SRC emacs-lisp
-(use-package tex-site
+(use-package tex
   :straight auctex
   :mode ("\\.tex\\'" . LaTeX-mode)
-  :mode ("\\.bib\\'" . bibtex-mode)
   :config
   ; (add-to-list 'TeX-style-path '"/home/don/lib/emacs_el/auctex/style")
-  ;; REFTEX (much enhanced management of cross-ref, labels, etc)
-  ;; http://www.strw.leidenuniv.nl/~dominik/Tools/reftex/
-  ; (autoload 'reftex-mode     "reftex" "RefTeX Minor Mode" t)
-  ; (autoload 'turn-on-reftex  "reftex" "RefTeX Minor Mode" nil)
-  ; (autoload 'reftex-citation "reftex-cite" "Make citation" nil)
-  ; (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
-  (add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
-  (add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode
   (add-hook 'LaTeX-mode-hook 'outline-minor-mode)   ; with AUCTeX LaTeX mode
   (add-hook 'latex-mode-hook 'outline-minor-mode)   ; with Emacs latex mode
 
-  (setq-default reftex-plug-into-AUCTeX t)
   ;; support fake section headers
   (setq TeX-outline-extra
         '(("%chapter" 1)
@@ -1178,6 +1202,8 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
 
 #+BEGIN_SRC emacs-lisp
 (use-package rainbow-mode
+  :hook ((LaTeX-mode ess-mode python-mode cperl-mode) . rainbow-mode)
+  :delight πŸŒˆ
   ;; add ess to the x major mode
   :config (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[S])
   (add-to-list 'rainbow-x-colors-major-mode-list 'ESS[R])
@@ -1208,6 +1234,7 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
   :mode ("\\.Rmd" . poly-markdown+r-mode)
   )
 (use-package polymode
+  :defer t
   )
 
 #+END_SRC
@@ -1219,19 +1246,44 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
    :straight nil
    :delight
    :init
-   (setq outline-minor-mode-prefix "C-c C-2")
+   ; (setq outline-minor-mode-prefix nil)
+   :config
+   (define-prefix-command 'cm-map nil "Outline-")
+   (global-set-key "\M-o" cm-map)
+   ; Outline-minor-mode key map
+; HIDE
+(define-key cm-map "q" 'outline-hide-sublevels)    ; Hide everything but the top-level headings
+(define-key cm-map "t" 'outline-hide-body)         ; Hide everything but headings (all body lines)
+(define-key cm-map "o" 'outline-hide-other)        ; Hide other branches
+(define-key cm-map "c" 'outline-hide-entry)        ; Hide this entry's body
+(define-key cm-map "l" 'outline-hide-leaves)       ; Hide body lines in this entry and sub-entries
+(define-key cm-map "d" 'outline-hide-subtree)      ; Hide everything in this entry and sub-entries
+; SHOW
+(define-key cm-map "a" 'outline-show-all)          ; Show (expand) everything
+(define-key cm-map "e" 'outline-show-entry)        ; Show this heading's body
+(define-key cm-map "i" 'outline-show-children)     ; Show this heading's immediate child sub-headings
+(define-key cm-map "k" 'outline-show-branches)     ; Show all sub-headings under this heading
+(define-key cm-map "s" 'outline-show-subtree)      ; Show (expand) everything in this heading & below
+; MOVE
+(define-key cm-map "u" 'outline-up-heading)                ; Up
+(define-key cm-map "n" 'outline-next-visible-heading)      ; Next
+(define-key cm-map "p" 'outline-previous-visible-heading)  ; Previous
+(define-key cm-map "f" 'outline-forward-same-level)        ; Forward - same level
+(define-key cm-map "b" 'outline-backward-same-level)       ; Backward - same level
+
 )
 #+END_SRC
 *** outshine (outlining) integration
 #+BEGIN_SRC emacs-lisp
-(use-package outshine
-  :after outline
-  :hook (outline-minor-mode . outshine-mode)
-)
+(use-package outshine
+  :after outline
+  :hook (outline-minor-mode . outshine-mode)
+)
 #+END_SRC
 ** Writeroom Mode
 #+BEGIN_SRC emacs-lisp
 (use-package writeroom-mode
+  :commands (writeroom-mode)
   :config
   (defun my/writing-mode ()
     "Start my writing mode; enable visual-line-mode and auto-fill-mode"
@@ -1361,18 +1413,20 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
 (use-package python-mode
   :delight Py πŸ
   :hook
-  (python-mode . pyenv-mode)
+  (python-mode . pyvenv-mode)
   (python-mode . flycheck-mode)
   (python-mode . blacken-mode)
   (python-mode . yas-minor-mode)
   (python-mode . anaconda-mode)
   )
-(use-package pyenv-mode
+(use-package pyvenv
+  :delight
   :after python-mode
   )
 (use-package blacken
-  :delight βš‘
+  :delight
   :after python-mode
+  :commands (blacken-buffer)
   :config
   (setq-default blacken-fast-unsafe t)
 )
@@ -1380,7 +1434,8 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
 *** Black
 #+begin_src emacs-lisp :tangle yes
 (use-package python-black
-  :demand t
+  :delight
+  :commands (python-black-buffer python-black-statement)
   :after python)
 #+end_src
 *** Sphinx Documentation
@@ -1390,11 +1445,11 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
   :bind (:map python-mode-map
               ("C-c C-n" . numpydoc-generate)))
 (use-package sphinx-doc
+  :delight πŸˆ
   :config
-  (sphinx-doc-mode t)
   (setq sphinx-doc-include-types t)
   :after python
-  :hook (python-mode . sphinx-doc)
+  :hook (python-mode . sphinx-doc-mode)
   )
 (use-package python-docstring
   :delight 
@@ -1402,6 +1457,13 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
   :hook (python-mode . python-docstring-mode)
   )
 #+end_src
+*** Anaconda Mode (Documentation lookup and completion)
+#+BEGIN_SRC emacs-lisp
+(use-package anaconda-mode
+  :delight
+  :after python
+)
+#+END_SRC
 ** Go language
 #+BEGIN_SRC emacs-lisp
 (use-package go-mode
@@ -1427,9 +1489,12 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
 ** Beancount
 #+BEGIN_SRC emacs-lisp
 (use-package beancount
-  :straight nil
+  :straight (beancount
+             :type git
+             :host github
+             :repo "cnsunyour/beancount.el")
   :load-path "~/lib/emacs_el/beancount-mode/"
-  :mode "\\.beancount\\'"
+  :mode "\\.bean\\(?:count\\)?\\'"
   
   )
 #+END_SRC
@@ -1508,26 +1573,20 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
 (use-package mutt-mode
   :mode "muttngrc"
   :mode "muttrc"
+  :config
+  (setq mutt-alias-file-list (quote ("~/.mutt/aliases" "~/.mail_aliases")))
 )
 #+END_SRC
 *** Set mail User agent
 #+BEGIN_SRC emacs-lisp
 (setq mail-user-agent (quote sendmail-user-agent))
 #+END_SRC
-*** Mail aliases
-#+BEGIN_SRC emacs-lisp
-; (use-package
-;   :straight t
-;   :hook message
-;   :config
-;   (setq mutt-alias-file-list (quote ("~/.mutt/aliases" "~/.mail_aliases")))
-; )
-#+END_SRC
 * Base emacs
 ** Reverting buffers
 #+BEGIN_SRC emacs-lisp
 (use-package autorevert
   :delight auto-revert-mode
+  :demand t
   :config
   (setq global-auto-revert-non-file-buffers t
         global-auto-revert-ignore-modes '(pdf-view-mode)
@@ -1541,7 +1600,7 @@ From http://julien.danjou.info/projects/emacs-packages#rainbow-mode, this colori
 (use-package org
   :delight (org-mode "ΓΈ")
   :mode ("\\.\\(org\\|org_archive\\|txt\\)\\'" . org-mode)
-  :bind (("C-c l . org-store-link)
+  :bind (("C-c l l" . org-store-link)
          ("C-c a"  . org-agenda)
          ("C-c b"  . org-iswitchb))
 #+END_SRC
@@ -2673,28 +2732,6 @@ emacs, and use a different desktop file to restore history
 (put 'downcase-region 'disabled nil)
 (put 'narrow-to-region 'disabled nil)
 
-; Outline-minor-mode key map
-(define-prefix-command 'cm-map nil "Outline-")
-; HIDE
-(define-key cm-map "q" 'outline-hide-sublevels)    ; Hide everything but the top-level headings
-(define-key cm-map "t" 'outline-hide-body)         ; Hide everything but headings (all body lines)
-(define-key cm-map "o" 'outline-hide-other)        ; Hide other branches
-(define-key cm-map "c" 'outline-hide-entry)        ; Hide this entry's body
-(define-key cm-map "l" 'outline-hide-leaves)       ; Hide body lines in this entry and sub-entries
-(define-key cm-map "d" 'outline-hide-subtree)      ; Hide everything in this entry and sub-entries
-; SHOW
-(define-key cm-map "a" 'outline-show-all)          ; Show (expand) everything
-(define-key cm-map "e" 'outline-show-entry)        ; Show this heading's body
-(define-key cm-map "i" 'outline-show-children)     ; Show this heading's immediate child sub-headings
-(define-key cm-map "k" 'outline-show-branches)     ; Show all sub-headings under this heading
-(define-key cm-map "s" 'outline-show-subtree)      ; Show (expand) everything in this heading & below
-; MOVE
-(define-key cm-map "u" 'outline-up-heading)                ; Up
-(define-key cm-map "n" 'outline-next-visible-heading)      ; Next
-(define-key cm-map "p" 'outline-previous-visible-heading)  ; Previous
-(define-key cm-map "f" 'outline-forward-same-level)        ; Forward - same level
-(define-key cm-map "b" 'outline-backward-same-level)       ; Backward - same level
-(global-set-key "\M-o" cm-map)
 ; fix up tmux xterm keys
 ; stolen from http://unix.stackexchange.com/questions/24414/shift-arrow-not-working-in-emacs-within-tmux
 (defun fix-up-tmux-keys ()