minor updates to emacs config

This commit is contained in:
William Ball 2025-03-23 10:49:48 -07:00
parent 1324b23f0d
commit cb9ccbbf96
Signed by: wball
GPG key ID: B8682D8137B70765

View file

@ -26,10 +26,10 @@
(make-directory wball/backup-directory t)) (make-directory wball/backup-directory t))
(setq backup-directory-alist `(("." . ,wball/backup-directory))) (setq backup-directory-alist `(("." . ,wball/backup-directory)))
(setq make-backup-files t (setq make-backup-files t
backup-by-copying t backup-by-copying t
version-control t version-control t
delete-old-versions t delete-old-versions t
auto-save-default t) auto-save-default t)
#+end_src #+end_src
* Packages * Packages
@ -38,15 +38,15 @@
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defvar bootstrap-version) (defvar bootstrap-version)
(let ((bootstrap-file (let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5)) (bootstrap-version 5))
(unless (file-exists-p bootstrap-file) (unless (file-exists-p bootstrap-file)
(with-current-buffer (with-current-buffer
(url-retrieve-synchronously (url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies) 'silent 'inhibit-cookies)
(goto-char (point-max)) (goto-char (point-max))
(eval-print-last-sexp))) (eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage)) (load bootstrap-file nil 'nomessage))
#+end_src #+end_src
@ -92,22 +92,22 @@
(use-package fontaine (use-package fontaine
:config :config
(setq fontaine-presets (setq fontaine-presets
'((regular '((regular
:default-height 150) :default-height 150)
(small (small
:default-height 110) :default-height 110)
(large (large
:default-weight semilight :default-weight semilight
:default-height 180 :default-height 180
:bold-weight extrabold) :bold-weight extrabold)
(extra-large (extra-large
:default-weight semilight :default-weight semilight
:default-height 210 :default-height 210
:bold-weight extrabold) :bold-weight extrabold)
(t (t
:default-family "Iosevka Nerd Font" :default-family "Iosevka Nerd Font"
:default-weight normal :default-weight normal
:variable-pitch-family "Inter"))) :variable-pitch-family "Inter")))
(fontaine-set-preset 'regular)) (fontaine-set-preset 'regular))
#+end_src #+end_src
@ -150,20 +150,6 @@
:config :config
(load-theme 'catppuccin :no-confirm)) (load-theme 'catppuccin :no-confirm))
#+end_src #+end_src
*** Modus Themes
#+begin_src emacs-lisp
;; (use-package emacs
;; :config
;; (require-theme 'modus-themes)
;; (setq modus-themes-italic-constructs t
;; modus-themes-bold-constructs t
;; modus-themes-links '(no-underline background faint)
;; modus-themes-prompts '(bold intense)
;; modus-themes-mode-line '(borderless accented moody)
;; modus-themes-org-blocks 'gray-background
;; modus-themes-region '(bg-only no-extend))
;; (modus-themes-load-operandi))
#+end_src
* Completion * Completion
** Vertico ** Vertico
@ -185,8 +171,8 @@
(use-package orderless (use-package orderless
:init :init
(setq completion-styles '(orderless flex) (setq completion-styles '(orderless flex)
completion-category-defaults nil completion-category-defaults nil
completion-category-overrides '((file (styles partial-completion))))) completion-category-overrides '((file (styles partial-completion)))))
#+end_src #+end_src
** Corfu ** Corfu
@ -219,42 +205,39 @@
** Consult ** Consult
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; Example configuration for Consult
(use-package consult (use-package consult
;; Replace bindings. Lazily loaded by `use-package'. :bind (("C-c M-x" . consult-mode-command)
:bind (;; C-c bindings in `mode-specific-map'
("C-c M-x" . consult-mode-command)
("C-c h" . consult-history) ("C-c h" . consult-history)
("C-c k" . consult-kmacro) ("C-c k" . consult-kmacro)
("C-c m" . consult-man) ("C-c m" . consult-man)
("C-c i" . consult-info) ("C-c i" . consult-info)
([remap Info-search] . consult-info) ([remap Info-search] . consult-info)
;; C-x bindings in `ctl-x-map' ;; C-x bindings in `ctl-x-map'
("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command ("C-x M-:" . consult-complex-command)
("C-x b" . consult-buffer) ;; orig. switch-to-buffer ("C-x b" . consult-buffer)
("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window ("C-x 4 b" . consult-buffer-other-window)
("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame ("C-x 5 b" . consult-buffer-other-frame)
("C-x t b" . consult-buffer-other-tab) ;; orig. switch-to-buffer-other-tab ("C-x t b" . consult-buffer-other-tab)
("C-x r b" . consult-bookmark) ;; orig. bookmark-jump ("C-x r b" . consult-bookmark)
("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer ("C-x p b" . consult-project-buffer)
;; Custom M-# bindings for fast register access ;; Custom M-# bindings for fast register a
("M-#" . consult-register-load) ("M-#" . consult-register-load)
("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated) ("M-'" . consult-register-store)
("C-M-#" . consult-register) ("C-M-#" . consult-register)
;; Other custom bindings ;; Other custom bindings
("M-y" . consult-yank-pop) ;; orig. yank-pop ("M-y" . consult-yank-pop)
;; M-g bindings in `goto-map' ;; M-g bindings in `goto-map'
("M-g e" . consult-compile-error) ("M-g e" . consult-compile-error)
("M-g f" . consult-flymake) ;; Alternative: consult-flycheck ("M-g f" . consult-flymake)
("M-g g" . consult-goto-line) ;; orig. goto-line ("M-g g" . consult-goto-line)
("M-g M-g" . consult-goto-line) ;; orig. goto-line ("M-g M-g" . consult-goto-line)
("M-g o" . consult-outline) ;; Alternative: consult-org-heading ("M-g o" . consult-outline)
("M-g m" . consult-mark) ("M-g m" . consult-mark)
("M-g k" . consult-global-mark) ("M-g k" . consult-global-mark)
("M-g i" . consult-imenu) ("M-g i" . consult-imenu)
("M-g I" . consult-imenu-multi) ("M-g I" . consult-imenu-multi)
;; M-s bindings in `search-map' ;; M-s bindings in `search-map'
("M-s d" . consult-find) ;; Alternative: consult-fd ("M-s d" . consult-fd)
("M-s c" . consult-locate) ("M-s c" . consult-locate)
("M-s g" . consult-grep) ("M-s g" . consult-grep)
("M-s G" . consult-git-grep) ("M-s G" . consult-git-grep)
@ -266,68 +249,51 @@
;; Isearch integration ;; Isearch integration
("M-s e" . consult-isearch-history) ("M-s e" . consult-isearch-history)
:map isearch-mode-map :map isearch-mode-map
("M-e" . consult-isearch-history) ;; orig. isearch-edit-string ("M-e" . consult-isearch-history)
("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string ("M-s e" . consult-isearch-history)
("M-s l" . consult-line) ;; needed by consult-line to detect isearch ("M-s l" . consult-line)
("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch ("M-s L" . consult-line-multi)
;; Minibuffer history ;; Minibuffer history
:map minibuffer-local-map :map minibuffer-local-map
("M-s" . consult-history) ;; orig. next-matching-history-element ("M-s" . consult-history)
("M-r" . consult-history)) ;; orig. previous-matching-history-element ("M-r" . consult-history))
;; Enable automatic preview at point in the *Completions* buffer. This is
;; relevant when you use the default completion UI.
:hook (completion-list-mode . consult-preview-at-point-mode) :hook (completion-list-mode . consult-preview-at-point-mode)
;; The :init configuration is always executed (Not lazy)
:init :init
;; Tweak the register preview for `consult-register-load',
;; `consult-register-store' and the built-in commands. This improves the
;; register formatting, adds thin separator lines, register sorting and hides
;; the window mode line.
(advice-add #'register-preview :override #'consult-register-window) (advice-add #'register-preview :override #'consult-register-window)
(setq register-preview-delay 0.5) (setq register-preview-delay 0.5)
;; Use Consult to select xref locations with preview
(setq xref-show-xrefs-function #'consult-xref (setq xref-show-xrefs-function #'consult-xref
xref-show-definitions-function #'consult-xref) xref-show-definitions-function #'consult-xref)
;; Configure other variables and modes in the :config section,
;; after lazily loading the package.
:config :config
;; Optionally configure preview. The default value
;; is 'any, such that any key triggers the preview.
;; (setq consult-preview-key 'any)
;; (setq consult-preview-key "M-.")
;; (setq consult-preview-key '("S-<down>" "S-<up>"))
;; For some commands and buffer sources it is useful to configure the
;; :preview-key on a per-command basis using the `consult-customize' macro.
(consult-customize (consult-customize
consult-theme :preview-key '(:debounce 0.2 any) consult-theme :preview-key '(:debounce 0.2 any)
consult-ripgrep consult-git-grep consult-grep consult-ripgrep consult-git-grep consult-grep
consult-bookmark consult-recent-file consult-xref consult-bookmark consult-recent-file consult-xref
consult--source-bookmark consult--source-file-register consult--source-bookmark consult--source-file-register
consult--source-recent-file consult--source-project-recent-file consult--source-recent-file consult--source-project-recent-file
;; :preview-key "M-."
:preview-key '(:debounce 0.4 any)) :preview-key '(:debounce 0.4 any))
;; Optionally configure the narrowing key. (setq consult-narrow-key "<"))
;; Both < and C-+ work reasonably well.
(setq consult-narrow-key "<") ;; "C-+"
;; Optionally make narrowing help available in the minibuffer.
;; You may want to use `embark-prefix-help-command' or which-key instead.
;; (keymap-set consult-narrow-map (concat consult-narrow-key " ?") #'consult-narrow-help)
)
#+end_src #+end_src
* Lsp * Lsp
I'm not a fan of =lsp-mode=, but =lean4-mode= requires it as a dependency, so I might as well actually install it.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package lsp-ui) (use-package lsp-mode
(use-package lsp-mode) :bind-keymap ("C-;" . lsp-command-map)
:init
(setq lsp-keymap-prefix "C-;")
:hook (lsp-mode . lsp-enable-which-key-integration)
:custom
(lsp-semantic-tokens-enable t)
(lsp-keep-workspace-alive nil)
(lsp-signature-doc-lines 5))
(use-package lsp-ui
:after lsp-mode)
#+end_src #+end_src
* Languages * Languages
@ -341,12 +307,27 @@ I'm not a fan of =lsp-mode=, but =lean4-mode= requires it as a dependency, so I
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package idris2-mode (use-package idris2-mode
:straight (:type git :straight (:type git
:host github :host github
:repo "idris-community/idris2-mode")) :repo "idris-community/idris2-mode"))
;; :hook ((idris2-mode . lsp))
;; :custom
;; (idris2-semantic-source-highlighting nil)
;; :config
;; (add-to-list 'lsp-language-id-configuration '(idris-mode . "idris2"))
;; (lsp-register-client
;; (make-lsp-client
;; :new-connection (lsp-stdio-connection "idris2-lsp")
;; :major-modes '(idris2-mode)
;; :server-id 'idris2-lsp)))
#+end_src #+end_src
** Haskell ** Haskell
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package haskell-mode) (use-package haskell-mode)
(use-package lsp-haskell
:after lsp-mode
:hook (haskell-mode . lsp))
#+end_src #+end_src
** PG ** PG
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -405,7 +386,8 @@ I'm not a fan of =lsp-mode=, but =lean4-mode= requires it as a dependency, so I
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun wball/beginning-of-word () (defun wball/beginning-of-word ()
(or (= (preceding-char) 32) (= (preceding-char) 0) (= (preceding-char) 10))) "Return t if point is at the beginning of a word."
(eq (point) (car (bounds-of-thing-at-point 'word))))
(use-package laas (use-package laas
:hook ((LaTeX-mode . laas-mode) :hook ((LaTeX-mode . laas-mode)
@ -472,19 +454,19 @@ I'm not a fan of =lsp-mode=, but =lean4-mode= requires it as a dependency, so I
(org-preview-latex-default-process 'imagemagick) (org-preview-latex-default-process 'imagemagick)
(org-highlight-latex-and-related '(native)) (org-highlight-latex-and-related '(native))
(org-default-notes-file (mapcar (lambda (x) (concat org-directory x)) (org-default-notes-file (mapcar (lambda (x) (concat org-directory x))
'("/todo.org" "/done.org"))) '("/todo.org" "/done.org")))
:after ox-latex :after ox-latex
:config :config
(setq org-format-latex-options (plist-put org-format-latex-options :scale 0.6)) (setq org-format-latex-options (plist-put org-format-latex-options :scale 0.6))
(add-to-list 'org-latex-classes '("myreport" "\\documentclass[11pt]{report}" (add-to-list 'org-latex-classes '("myreport" "\\documentclass[11pt]{report}"
("\\chapter{%s}" . "\\chapter*{%s}") ("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}") ("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))) ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
(require 'org-tempo) (require 'org-tempo)
:bind (("C-c c" . org-capture) :bind (("C-c c" . org-capture)
("C-c l" . org-store-link) ("C-c l" . org-store-link)
("C-c a" . org-agenda)) ("C-c a" . org-agenda))
:hook (org-mode . visual-line-mode) :hook (org-mode . visual-line-mode)
(org-mode . flyspell-mode)) (org-mode . flyspell-mode))
#+end_src #+end_src
@ -493,7 +475,7 @@ I'm not a fan of =lsp-mode=, but =lean4-mode= requires it as a dependency, so I
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package org-modern (use-package org-modern
:hook ((org-mode . org-modern-mode) :hook ((org-mode . org-modern-mode)
(org-agenda-finalize . org-modern-agenda))) (org-agenda-finalize . org-modern-agenda)))
#+end_src #+end_src
** Citeproc ** Citeproc
@ -526,9 +508,9 @@ Once [[https://abode.karthinks.com/org-latex-preview/][the improvements to =org-
(add-to-list 'eshell-output-filter-functions 'eshell-truncate-buffer) (add-to-list 'eshell-output-filter-functions 'eshell-truncate-buffer)
(setq eshell-history-size 10000 (setq eshell-history-size 10000
eshell-buffer-maximum-lines 10000 eshell-buffer-maximum-lines 10000
eshell-history-ignoredups t eshell-history-ignoredups t
eshell-scroll-to-bottom-on-input t)) eshell-scroll-to-bottom-on-input t))
(use-package eshell (use-package eshell
:ensure nil :ensure nil