diff options
Diffstat (limited to 'dot_emacs')
-rw-r--r-- | dot_emacs | 475 |
1 files changed, 288 insertions, 187 deletions
@@ -1,20 +1,24 @@ ;; -*- emacs-lisp -*- ;; (setq debug-on-error t) -(require 'package) -(setq package-enable-at-startup nil) -(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) (let ((default-directory "~/.emacs.d/lisp/")) (normal-top-level-add-subdirs-to-load-path)) -(package-initialize) -;; Bootstrap `use-package' -(unless (package-installed-p 'use-package) - (package-refresh-contents) - (package-install 'use-package)) +;; Boostrap straight.el +(defvar bootstrap-version) +(let ((bootstrap-file + (expand-file-name + "straight/repos/straight.el/bootstrap.el" + (or (bound-and-true-p straight-base-dir) + user-emacs-directory))) + (bootstrap-version 7)) + (load bootstrap-file nil 'nomessage)) +;; use-package integration: +(straight-use-package 'use-package) +;; prevent org version mismatches +(straight-use-package 'org) -(eval-when-compile - (require 'use-package)) +(setq package-enable-at-startup nil) ;;; General emacs configuration (use-package emacs @@ -26,10 +30,11 @@ :bind ; key bindings (("C-x a r" . align-regexp)) :config ; executed after package is loaded - (defadvice ; align-regexp should use spaces. - align-regexp - (around align-regexp-with-spaces activate) + (defun align-regexp--align-regexp-with-spaces () + "Never use tabs for alignment." (let ((indent-tabs-mode nil)) ad-do-it)) + (advice-add 'align-regexp--align-regexp-with-spaces + :around #'align-regexp-with-spaces) :custom (inhibit-startup-screen t) (default-input-method "TeX") @@ -37,23 +42,32 @@ (user-mail-address "rak@rak.ac") (mail-user-agent 'mu4e-user-agent) (read-mail-command 'mu4e) + ;; Support opening new minibuffers from inside existing minibuffers. + (enable-recursive-minibuffers t) + ;; Hide commands in M-x which do not work in the current mode. Vertico + ;; commands are hidden in normal buffers. This setting is useful beyond + ;; Vertico. + (read-extended-command-predicate #'command-completion-default-include-p) + ;; Do not allow the cursor in the minibuffer prompt + (minibuffer-prompt-properties + '(read-only t cursor-intangible t face minibuffer-prompt)) :custom-face (default ((t (:family "Iosevka"))))) (if (string= (system-name) "demeter.rak.ac") (use-package leuven-theme ; nice theme for lecturing / projectors - :ensure t + :straight t :config (load-theme 'leuven t)) (use-package moe-theme - :ensure t + :straight t :after powerline ; must be loaded after for powerline-moe-theme to work :config (moe-dark) (moe-theme-powerline))) (use-package ace-window - :ensure t + :straight t :custom ;; home row keys (aw-keys '(?h ?t ?n ?s ?a ?o ?e ?u ?i ?d)) @@ -62,21 +76,21 @@ ;; need to redefine a few of these because the defaults ;; overlap with customized aw-keys (setq aw-dispatch-alist - '((?x aw-delete-window "Delete Window") - (?m aw-swap-window "Swap Windows") - (?M aw-move-window "Move Window") - (?c aw-copy-window "Copy Window") - (?j aw-switch-buffer-in-window "Select Buffer") - (?f aw-flip-window) - (?p aw-switch-buffer-other-window "Switch Buffer Other Window") - (?c aw-split-window-fair "Split Fair Window") - (?v aw-split-window-vert "Split Vert Window") - (?b aw-split-window-horz "Split Horz Window") - (?1 delete-other-windows "Delete Other Windows") - (?? aw-show-dispatch-help)))) + '((?x aw-delete-window "Delete Window") + (?m aw-swap-window "Swap Windows") + (?M aw-move-window "Move Window") + (?c aw-copy-window "Copy Window") + (?j aw-switch-buffer-in-window "Select Buffer") + (?f aw-flip-window) + (?p aw-switch-buffer-other-window "Switch Buffer Other Window") + (?c aw-split-window-fair "Split Fair Window") + (?v aw-split-window-vert "Split Vert Window") + (?b aw-split-window-horz "Split Horz Window") + (?1 delete-other-windows "Delete Other Windows") + (?? aw-show-dispatch-help)))) (use-package aggressive-indent - :ensure t + :straight t :config (global-aggressive-indent-mode 1)) @@ -84,7 +98,7 @@ :diminish auto-revert-mode) (use-package avy - :ensure t + :straight t :config (avy-setup-default) :bind @@ -211,7 +225,7 @@ Extended Format date in the date field and return it as a string obeing (seq-do (lambda (pair) (add-to-list 'bibtex-autokey-titleword-change-strings pair)) charMap)))) (use-package bibtex-completion - :ensure ivy-bibtex + :straight ivy-bibtex :custom (bibtex-completion-bibliography "~/Documents/papers/library.bib") (bibtex-completion-library-path '("~/Documents/papers/pdfs/")) @@ -219,74 +233,93 @@ Extended Format date in the date field and return it as a string obeing (bibtex-completion-notes-extension ".org") (bibtex-completion-pdf-extension '(".pdf" ".djvu" ".txt"))) +(use-package cape + :straight t + ;; Bind prefix keymap providing all Cape commands under a mnemonic key. + ;; Press C-c p ? to for help. + :bind ("C-c p" . cape-prefix-map) ;; Alternative key: M-<tab>, M-p, M-+ + ;; Alternatively bind Cape commands individually. + ;; :bind (("C-c p d" . cape-dabbrev) + ;; ("C-c p h" . cape-history) + ;; ("C-c p f" . cape-file) + ;; ...) + :hook + (completion-at-point-functions . cape-dabbrev) + (completion-at-point-functions . cape-file) + (completion-at-point-functions . cape-elisp-block) + (completion-at-point-functions .cape-keyword)) + (use-package cc-mode :custom (c-default-style "bsd")) -(use-package company - :ensure t - :diminish - :bind - ("<tab>" . company-indent-or-complete-common) - :hook - (after-init . global-company-mode)) - -(use-package company-auctex - :ensure t - :after latex - :config - (company-auctex-init)) - (use-package company-bibtex - :ensure t + :straight t :hook (bibtex-mode . (lambda () (add-to-list 'company-backends 'company-bibtex)))) -(use-package company-box - :ensure t - :diminish - :hook (company-mode . company-box-mode)) - (use-package company-coq - :ensure t + :straight t :hook (coq-mode . company-coq-mode)) -(use-package company-math - :ensure t - :config - (add-to-list 'company-backends 'company-math-symbols-unicode) - (add-to-list 'company-backends 'company-latex-commands)) - -(use-package company-org-block - :ensure t - :hook ((org-mode . (lambda () - (setq-local company-backends '(company-org-block)) - (company-mode +1))))) +(use-package consult + :straight t + :bind + (("C-x b" . consult-buffer) + ("C-x C-f" . find-file) + ("C-s" . consult-line) + ("M-x" . execute-extended-command))) -(use-package counsel - :ensure t +(use-package consult-mu + :after (consult mu4e) :bind - (("C-x b" . counsel-switch-buffer) - ("C-x C-b" . counsel-ibuffer) - ("C-x C-f" . counsel-find-file) - ("M-x" . counsel-M-x) - ("M-y" . counsel-yank-pop) - ("<f2> i" . counsel-info-lookup-symbol) - ("<f2> j" . counsel-set-variable) - ("<f2> u" . counsel-unicode-char)) - :config - (add-to-list 'ivy-initial-inputs-alist - '(counsel-M-x . ""))) + :custom + ;;maximum number of results shown in minibuffer + (consult-mu-maxnum 200) + ;;show preview when pressing any keys + (consult-mu-preview-key 'any) + ;;do not mark email as read when previewed + (consult-mu-mark-previewed-as-read nil) + ;;do not amrk email as read when selected. This is a good starting point to ensure you would not miss important emails marked as read by mistake especially when trying this package out. Later you can change this to t. + (consult-mu-mark-viewed-as-read nil) + ;; open the message in mu4e-view-buffer when selected. + (consult-mu-action #'consult-mu--view-action)) + +(use-package consult-mu-compose) +(use-package consult-mu-contacts) +(setq consult-mu-compose-preview-key "M-o") +(setq consult-mu-embark-attach-file-key "C-a") + +(use-package corfu + :straight t + :bind + (:map corfu-map + ("SPC" . corfu-insert-separator)) + :init + (global-corfu-mode)) (use-package csv-mode - :ensure t) + :straight t) (use-package cus-edit :custom (custom-file null-device "Don't store customizations")) +;; Use Dabbrev with Corfu! +(use-package dabbrev + :straight t + ;; Swap M-/ and C-M-/ + :bind (("M-/" . dabbrev-completion) + ("C-M-/" . dabbrev-expand)) + :config + (add-to-list 'dabbrev-ignored-buffer-regexps "\\` ") + ;; Since 29.1, use `dabbrev-ignored-buffer-regexps' on older. + (add-to-list 'dabbrev-ignored-buffer-modes 'doc-view-mode) + (add-to-list 'dabbrev-ignored-buffer-modes 'pdf-view-mode) + (add-to-list 'dabbrev-ignored-buffer-modes 'tags-table-mode)) + (use-package diary - :ensure diary-lib + :straight diary-lib :custom (diary-display-function 'diary-fancy-display) :hook ((diary-list-entries . diary-include-other-diary-files) @@ -295,53 +328,101 @@ Extended Format date in the date field and return it as a string obeing (use-package dictem) (use-package diminish - :ensure t) + :straight t) (use-package doi-utils ;; provided by org-ref - :ensure org-ref) + :straight org-ref) (use-package dtrt-indent - :ensure t) + :straight t) (use-package dune - :ensure t) + :straight t) (use-package dune-format - :ensure t) + :straight t) (use-package eldoc :diminish) (use-package elpher - :ensure t) + :straight t) (use-package elpy - :ensure t + :straight t :after python :config (elpy-enable) :custom (elpy-rpc-python-command "python3")) +(use-package embark + :straight t + :bind + (("C-." . embark-act) ;; Begin the embark process + ("C-;" . embark-dwim) ;; good alternative: M-. + ("C-h B" . embark-bindings)) ;; alternative for `describe-bindings' + ) + +(use-package embark-consult + :straight t) + (use-package ess - :ensure t) + :straight t) (use-package erc - :ensure t + :straight t :custom - (erc-hide-list '("JOIN" "PART" "QUIT")) + (erc-hide-list '("JOIN" "PART" "QUIT" "353")) (erc-lurker-hide-list '("JOIN" "PART" "QUIT")) - ;; :config - ;; (erc-tls :server "libera.pounce.rak.ac" - ;; :port 40404 - ;; :nick "rak" - ;; :client-certificate '("/home/rak/.config/catgirl/weechat.pem" - ;; "/home/rak/.config/catgirl/weechat.pem") - ;; :user "koios-erc") - ) + (erc-fill-column 120) + (erc-fill-function 'erc-fill-static) + (erc-fill-static-center 20) + (erc-track-exclude '("#debian-devel-changes")) + (erc-track-visibility nil) + (erc-truncate-mode t) + (erc-input-line-position -1) + :config + (defun my/connect-irc () + (interactive) + (erc-tls :server "libera.pounce.rak.ac" + :port 40404 + :nick "rak" + :client-certificate '("/home/rak/.config/catgirl/weechat.pem" + "/home/rak/.config/catgirl/weechat.pem") + :user "koios-erc") + (erc-tls :server "oftc.pounce.rak.ac" + :port 40404 + :nick "rak" + :client-certificate '("/home/rak/.config/catgirl/weechat.pem" + "/home/rak/.config/catgirl/weechat.pem") + :user "koios-erc") + (erc-tls :server "tilde.pounce.rak.ac" + :port 40404 + :nick "rak" + :client-certificate '("/home/rak/.config/catgirl/weechat-sdf.pem" + "/home/rak/.config/catgirl/weechat-sdf.pem") + :user "koios-erc") + (erc-tls :server "sdf.pounce.rak.ac" + :port 40404 + :nick "rak" + :client-certificate '("/home/rak/.config/catgirl/weechat-sdf.pem" + "/home/rak/.config/catgirl/weechat-sdf.pem") + :user "koios-erc")) + (add-to-list 'erc-modules 'nickbar) + (add-to-list 'erc-modules 'nicks) + (add-to-list 'erc-modules 'notifications) + (add-to-list 'erc-modules 'spelling) + (add-to-list 'erc-modules 'truncate) + :hook + ((erc-mode . (lambda () + ;; to help ensure the ERC> prompt stays at the bottom + (setq-local scroll-conservatively 101)))) + :bind + (("C-<f6>" . my/connect-irc))) (use-package fill-column-indicator - :ensure t) + :straight t) (use-package flyspell :bind @@ -349,16 +430,14 @@ Extended Format date in the date field and return it as a string obeing :config (unbind-key "C-;" flyspell-mode-map)) -(use-package flyspell-correct-ivy - :ensure t +(use-package flyspell-correct :after flyspell :bind - ("C-<f12>" . flyspell-correct-wrapper) - :config - (setq flyspell-correct-interface #'flyspell-correct-ivy)) + (:map flyspell-mode-map + ("C-;" . flyspell-correct-wrapper))) (use-package gnus - :ensure t + :straight t :defer t :bind ;; (:map gnus-summary-buffer-map @@ -408,41 +487,28 @@ Extended Format date in the date field and return it as a string obeing (gnus-group-mode . gnus-topic-mode)) (use-package haskell-mode - :ensure t + :straight t :hook ((haskell-mode . turn-on-haskell-doc-mode) (haskell-mode . turn-on-haskell-indentation))) (use-package info-look - :ensure t) + :straight t) (use-package ispell - :ensure t + :straight t :defer t :custom (ispell-dictionary "en_CA-w_accents")) -(use-package ivy - :ensure t - :diminish - :bind - (("C-c v" . ivy-push-view) - ("C-c V" . ivy-pop-view) - ("C-c C-r" . ivy-resume)) - :custom - (ivy-use-virtual-buffers t) - (ivy-count-format "(%d/%d) ") - :config - (ivy-mode 1)) - (use-package ivy-bibtex - :ensure t + :straight t :bind (("C-c b" . ivy-bibtex))) (use-package ivy-hydra - :ensure t) + :straight t) (use-package latex - :ensure auctex + :straight auctex :after info-look :mode ("\\.tex\\'" . LaTeX-mode) :init @@ -513,27 +579,44 @@ Otherwise split the current paragraph into one sentence per line." (:map LaTeX-mode-map ("M-q" . ales/fill-paragraph))) -(use-package libmpdel - ;; used by mpdel to connect to mpd +(use-package lsp-mode + :straight t :custom - (libmpdel-hostname "asteria.home.arpa")) + (lsp-completion-provider :none) ;; we use Corfu! + :init + (defun my/lsp-mode-setup-completion () + (setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults)) + '(orderless))) ;; Configure orderless + :hook + (lsp-completion-mode . my/lsp-mode-setup-completion)) (use-package magit - :ensure t + :straight t :config (put 'magit-clean 'disabled nil) :custom (magit-diff-refine-hunk 'all)) +(use-package marginalia + :straight t + :bind (:map minibuffer-local-map + ("M-A" . marginalia-cycle)) + :init + (marginalia-mode)) + (use-package markdown-mode - :ensure t + :straight t :init (autoload 'markdown-mode "markdown-mode" "Major mode for editing Markdown files" t) - :hook ((markdown-mode . (lambda () - (setq-default indent-tabs-mode nil)))) + :hook + ((markdown-mode . (lambda () + (setq-default indent-tabs-mode nil)))) + (markdown-mode . turn-off-auto-fill) + (markdown-mode . visual-line-mode) + (markdown-mode . visual-fill-column-mode) :mode (("\\.markdown\\'" . markdown-mode) - ("\\.mdown\'" . markdown-mode))) + ("\\.mdown\'" . markdown-mode))) (use-package menu-bar :config @@ -543,7 +626,7 @@ Otherwise split the current paragraph into one sentence per line." (use-package merlin ;; ocaml assistant - :ensure t) + :straight t) (use-package message :custom @@ -556,7 +639,7 @@ Otherwise split the current paragraph into one sentence per line." (message-mode . visual-fill-column-mode)) (use-package message-view-patch - :ensure t) + :straight t) (use-package minibuffer :config @@ -570,16 +653,8 @@ Otherwise split the current paragraph into one sentence per line." :custom (mpc-host "asteria.home.arpa")) -(use-package mpdel - ;; mpd client - ;; host/port customization under libmpdel package - :ensure t - :diminish - :config - (mpdel-mode)) - (use-package mu4e - :ensure t + :straight t :bind (("<f6>" . mu4e)) :config @@ -691,6 +766,10 @@ Otherwise split the current paragraph into one sentence per line." ;; compose messages in new frame (mu4e-compose-in-new-frame t) + ;; use default emacs completion + (mu4e-read-option-use-builtin nil) + (mu4e-completing-read-function 'completing-read) + ;; hide long list off addresses from main view and silence warnings ;; about mu4e not recognizing user-mail-address against regexp (mu4e-main-hide-personal-addresses t) @@ -704,18 +783,34 @@ Otherwise split the current paragraph into one sentence per line." ("/gmail/INBOX" . ?g) ("/queensu/INBOX" . ?q)))) +(use-package mu4e-column-faces + :straight t + :after mu4e + :config (mu4e-column-faces-mode)) + ;; provided through git/chezmoi -(use-package mu4e-goodies-tags) +(use-package mu4e-goodies-tags + :after mu4e) (use-package oauth2 - :ensure t) + :straight t) (use-package ocp-indent - :ensure t) + :straight t) (use-package octave :mode ("\\.m\'" . octave-mode)) +(use-package orderless + :straight t + :custom + ;; Configure a custom style dispatcher (see the Consult wiki) + ;; (orderless-style-dispatchers '(+orderless-consult-dispatch orderless-affix-dispatch)) + ;; (orderless-component-separator #'orderless-escapable-split-on-space) + (completion-styles '(orderless basic)) + (completion-category-defaults nil) + (completion-category-overrides '((file (styles partial-completion))))) + (use-package org :bind (:map org-mode-map ("<tab>" . org-cycle)) @@ -725,20 +820,20 @@ Otherwise split the current paragraph into one sentence per line." (org-link-file-path-type 'relative)) (use-package org-chef - :ensure t) + :straight t) (use-package org-noter - :ensure t + :straight t :custom ;; Surely there's an easier way of setting this? (org-noter-notes-search-path '("~/Documents/papers/notes/"))) (use-package org-ref - :ensure t + :straight t :after ivy-bibtex) (use-package org-ref-arxiv - :ensure org-ref + :straight org-ref :custom (arxiv-entry-format-string "@Misc{%s, title = {%s}, @@ -785,7 +880,7 @@ Returns a formatted BibTeX entry." (advice-add 'arxiv-get-bibtex-entry-via-arxiv-api :override 'my/arxiv-get-bibtex-entry-via-arxiv-api)) (use-package org-ref-bibtex - :ensure org-ref + :straight org-ref :after bibtex-completion ; needs bibtex-completion-library-path :custom (org-ref-title-case-types '(("article" "title") @@ -837,10 +932,10 @@ Returns a formatted BibTeX entry." ((prog-mode . flyspell-prog-mode))) (use-package reftex-cite - :ensure t) + :straight t) (use-package org-ref-core - :ensure org-ref + :straight org-ref :after org-ref-bibtex :after reftex-cite :after ivy-bibtex @@ -984,27 +1079,27 @@ If not, issue a warning." orcb-clean-nil-opinionated))) (use-package org-ref-isbn - :ensure org-ref) + :straight org-ref) (use-package org-ref-pdf - :ensure org-ref) + :straight org-ref) (use-package ox-md ;; org-mode to markdown exporter - :ensure org + :straight org :after (org)) (use-package outline - :ensure t + :straight t :hook (LaTeX-mode . outline-minor-mode)) (use-package outline-magic - :ensure t + :straight t :after outline :bind (:map outline-minor-mode-map ([f10] . outline-cycle))) (use-package paren - :ensure t + :straight t :config (show-paren-mode t) :custom @@ -1012,7 +1107,7 @@ If not, issue a warning." (show-paren-style 'expression)) (use-package pdf-tools - :ensure t + :straight t :config (pdf-tools-install)) @@ -1022,10 +1117,10 @@ If not, issue a warning." ("C-s" . isearch-forward))) (use-package powerline - :ensure t) + :straight t) (use-package proof-general - :ensure t + :straight t :custom (proof-disappearing-proofs t) (proof-electric-terminator-enable t) @@ -1035,13 +1130,13 @@ If not, issue a warning." (proof-locked-face ((t (:weight bold))))) (use-package py-autopep8 - :ensure t + :straight t :hook (python-mode . py-autopep8-enable-on-save) :custom (py-autopep8-options '("--max-line-length=80"))) (use-package python - :ensure t + :straight t :mode ("\\.py\\'" . python-mode) :custom (python-python-command "/usr/bin/python3") :interpreter ("python3" . python-mode) @@ -1051,14 +1146,14 @@ If not, issue a warning." (python-shell-interpreter "python3")) (use-package rainbow-delimiters - :ensure t + :straight t :hook ((LaTeX-mode prog-mode) . rainbow-delimiters-mode)) (use-package rainbow-mode - :ensure t) + :straight t) (use-package reftex - :ensure t + :straight t :after latex :hook (LaTeX-mode . reftex-mode) :custom @@ -1091,7 +1186,12 @@ If not, issue a warning." (rfc2047-quote-decoded-words-containing-tspecials t)) (use-package sass-mode - :ensure t) + :straight t) + +;; Persist history over Emacs restarts. Vertico sorts by history position. +(use-package savehist + :init + (savehist-mode)) (use-package scroll-bar :custom @@ -1113,7 +1213,7 @@ If not, issue a warning." (setq smerge-command-prefix (kbd "C-c v"))) (use-package sml-mode - :ensure t + :straight t :mode ("\\.sml\\'" . sml-mode)) (use-package solar @@ -1126,16 +1226,11 @@ If not, issue a warning." (calendar-location-name "Montreal, QC")) (use-package spaceline - :ensure t + :straight t :requires spaceline-config) -(use-package swiper - :ensure t - :bind - (("C-s" . swiper))) - (use-package tex - :ensure auctex + :straight auctex :custom (reftex-plug-into-AUCTeX t) (TeX-parse-self t) ; Parse documents to provide completion for packages, etc. @@ -1169,39 +1264,45 @@ If not, issue a warning." (tramp-default-method "ssh")) (use-package tuareg - :ensure t + :straight t :config (add-hook 'tuareg-mode-hook 'merlin-mode t)) -(use-package twittering-mode - :ensure t - :custom - (twittering-icon-mode t) - (twittering-icon-storage-file "~/.emacs.d/storage/twittering-mode-icons.gz") - (twittering-use-icon-storage t)) - (use-package vc-git :requires vc :config (add-to-list 'vc-handled-backends 'git)) +(use-package vertico + :straight t + :custom + (vertico-scroll-margin 0) ;; Different scroll margin + (vertico-count 20) ;; Show more candidates + (vertico-resize t) ;; Grow and shrink the Vertico minibuffer + (vertico-cycle t) ;; Enable cycling for `vertico-next/previous' + :init + (vertico-mode)) + +(use-package vertico-directory + :straight vertico) + (use-package visual-fill-column - :ensure t) + :straight t) (use-package wc-mode - :ensure t) + :straight t) (use-package windmove - :ensure t + :straight t :config (windmove-default-keybindings) :custom (windmove-wrap-around t)) (use-package ws-butler - :ensure t + :straight t :config (ws-butler-global-mode)) (use-package yaml-mode - :ensure t) + :straight t) |