diff options
Diffstat (limited to '.config')
| -rw-r--r-- | .config/doom/README.org | 16 | ||||
| -rw-r--r-- | .config/emacs/.gitignore | 8 | ||||
| -rw-r--r-- | .config/emacs/abbrevs.el | 317 | ||||
| -rw-r--r-- | .config/emacs/custom.el | 19 | ||||
| -rw-r--r-- | .config/emacs/early-init.el | 17 | ||||
| -rw-r--r-- | .config/emacs/init.el | 682 | ||||
| -rw-r--r-- | .config/emacs/straight/versions/default.el | 56 |
7 files changed, 1099 insertions, 16 deletions
diff --git a/.config/doom/README.org b/.config/doom/README.org deleted file mode 100644 index 7418747..0000000 --- a/.config/doom/README.org +++ /dev/null @@ -1,16 +0,0 @@ -* GNU Emacs configuration - -Since [[https://github.com/mssola/dotfiles/commit/7bfe3fe73208fa29a3fe4b7ddce675e79a70c246][this commit]] I have maintained my own configuration for GNU Emacs. This has -been a hell of a ride for about five years. During this time I have learned a -lot, including what I don't like: to maintain a huge blob of Lisp to keep this -beast running. That is, along the way I've been frustrated by stuff that didn't -quite work but I didn't have the time to actually fix them. Moreover, I knew -that there were plenty of things that I was missing out but that I just didn't -have enough time for it. Some time ago I discovered [[https://github.com/hlissner/doom-emacs][Doom Emacs]], a GNU Emacs -distribution that had quite a lot of appealing features. I've been including -some bits and pieces from Doom into my custom configuration, but then I decided -that it was enough: let's leave the gory details to experienced people and I can -work out on the specifics for myself. - -Thus, I'm using Doom Emacs. In order to install it you need to follow their -instructions. This is the directory where my specific configuration resides. diff --git a/.config/emacs/.gitignore b/.config/emacs/.gitignore new file mode 100644 index 0000000..f9f5a1a --- /dev/null +++ b/.config/emacs/.gitignore @@ -0,0 +1,8 @@ +.local/ +.lsp-session* +auto-save-list/ +eln-cache/ +history +projects +straight/ +transient/
\ No newline at end of file diff --git a/.config/emacs/abbrevs.el b/.config/emacs/abbrevs.el new file mode 100644 index 0000000..fc8c556 --- /dev/null +++ b/.config/emacs/abbrevs.el @@ -0,0 +1,317 @@ +;;-*-coding: utf-8;-*- +(define-abbrev-table 'Buffer-menu-mode-abbrev-table '()) + +(define-abbrev-table 'Custom-mode-abbrev-table '()) + +(define-abbrev-table 'Info-edit-mode-abbrev-table '()) + +(define-abbrev-table 'TeX-error-overview-mode-abbrev-table '()) + +(define-abbrev-table 'TeX-output-mode-abbrev-table '()) + +(define-abbrev-table 'TeX-special-mode-abbrev-table '()) + +(define-abbrev-table 'ag-mode-abbrev-table '()) + +(define-abbrev-table 'apropos-mode-abbrev-table '()) + +(define-abbrev-table 'awk-mode-abbrev-table + '( + )) + +(define-abbrev-table 'bats-mode-abbrev-table '()) + +(define-abbrev-table 'bibtex-mode-abbrev-table '()) + +(define-abbrev-table 'c++-mode-abbrev-table + '( + )) + +(define-abbrev-table 'c-mode-abbrev-table + '( + )) + +(define-abbrev-table 'calendar-mode-abbrev-table '()) + +(define-abbrev-table 'change-log-mode-abbrev-table '()) + +(define-abbrev-table 'cmake-mode-abbrev-table '()) + +(define-abbrev-table 'coffee-mode-abbrev-table '()) + +(define-abbrev-table 'comint-mode-abbrev-table '()) + +(define-abbrev-table 'completion-list-mode-abbrev-table '()) + +(define-abbrev-table 'diff-mode-abbrev-table '()) + +(define-abbrev-table 'dig-mode-abbrev-table '()) + +(define-abbrev-table 'display-time-world-mode-abbrev-table '()) + +(define-abbrev-table 'dockerfile-mode-abbrev-table '()) + +(define-abbrev-table 'doctex-mode-abbrev-table '()) + +(define-abbrev-table 'edebug-eval-mode-abbrev-table '()) + +(define-abbrev-table 'edit-abbrevs-mode-abbrev-table '()) + +(define-abbrev-table 'elisp-byte-code-mode-abbrev-table '()) + +(define-abbrev-table 'elpy-refactor-mode-abbrev-table '()) + +(define-abbrev-table 'emacs-lisp-mode-abbrev-table '()) + +(define-abbrev-table 'emojify-apropos-mode-abbrev-table '()) + +(define-abbrev-table 'emojify-description-mode-abbrev-table '()) + +(define-abbrev-table 'emojify-list-mode-abbrev-table '()) + +(define-abbrev-table 'epa-info-mode-abbrev-table '()) + +(define-abbrev-table 'epa-key-list-mode-abbrev-table '()) + +(define-abbrev-table 'epa-key-mode-abbrev-table '()) + +(define-abbrev-table 'erc-mode-abbrev-table '()) + +(define-abbrev-table 'eshell-mode-abbrev-table '()) + +(define-abbrev-table 'evil-command-window-mode-abbrev-table '()) + +(define-abbrev-table 'evil-list-view-mode-abbrev-table '()) + +(define-abbrev-table 'flycheck-error-list-mode-abbrev-table '()) + +(define-abbrev-table 'flycheck-error-message-mode-abbrev-table '()) + +(define-abbrev-table 'flymake-diagnostics-buffer-mode-abbrev-table '()) + +(define-abbrev-table 'fundamental-mode-abbrev-table '()) + +(define-abbrev-table 'gfm-mode-abbrev-table '()) + +(define-abbrev-table 'gfm-view-mode-abbrev-table '()) + +(define-abbrev-table 'git-commit-elisp-text-mode-abbrev-table '()) + +(define-abbrev-table 'global-abbrev-table + '( + ("..." "…" nil 0) + ("CIF" "Comissions Informatives" nil 0) + ("FiG" "Ferrer i Guàrdia" nil 0) + ("JGL" "Junta de Govern" nil 2) + ("PLJ" "Pla Local de Joventut" nil 1) + ("abbout" "about" nil 0) + ("afaict" "as far as I can tell" nil 0) + ("bibtex" "BibTeX" nil 0) + ("btw" "by the way" nil 0) + ("cca" "Consell Comarcal de l'Anoia" nil 0) + ("diba" "Diputació de Barcelona" nil 0) + ("ppcc" "Països Catalans" nil 0) + ("PPCC" "Països Catalans" nil 0) + )) + +(define-abbrev-table 'gnus-article-edit-mode-abbrev-table '()) + +(define-abbrev-table 'gnus-article-mode-abbrev-table '()) + +(define-abbrev-table 'gnus-group-mode-abbrev-table '()) + +(define-abbrev-table 'gnus-sticky-article-mode-abbrev-table '()) + +(define-abbrev-table 'go-dot-mod-mode-abbrev-table '()) + +(define-abbrev-table 'go-mode-abbrev-table '()) + +(define-abbrev-table 'godoc-mode-abbrev-table '()) + +(define-abbrev-table 'grep-mode-abbrev-table '()) + +(define-abbrev-table 'hcl-mode-abbrev-table '()) + +(define-abbrev-table 'helm-ag-mode-abbrev-table '()) + +(define-abbrev-table 'helm-grep-mode-abbrev-table '()) + +(define-abbrev-table 'helm-major-mode-abbrev-table '()) + +(define-abbrev-table 'helm-occur-mode-abbrev-table '()) + +(define-abbrev-table 'help-mode-abbrev-table '()) + +(define-abbrev-table 'ibuffer-mode-abbrev-table '()) + +(define-abbrev-table 'idl-mode-abbrev-table '()) + +(define-abbrev-table 'inf-ruby-mode-abbrev-table '()) + +(define-abbrev-table 'inferior-emacs-lisp-mode-abbrev-table '()) + +(define-abbrev-table 'inferior-python-mode-abbrev-table '()) + +(define-abbrev-table 'java-mode-abbrev-table + '( + )) + +(define-abbrev-table 'latex-mode-abbrev-table '()) + +(define-abbrev-table 'lisp-mode-abbrev-table '()) + +(define-abbrev-table 'log-edit-mode-abbrev-table '()) + +(define-abbrev-table 'log4e-mode-abbrev-table '()) + +(define-abbrev-table 'magit-cherry-mode-abbrev-table '()) + +(define-abbrev-table 'magit-diff-mode-abbrev-table '()) + +(define-abbrev-table 'magit-log-mode-abbrev-table '()) + +(define-abbrev-table 'magit-log-select-mode-abbrev-table '()) + +(define-abbrev-table 'magit-merge-preview-mode-abbrev-table '()) + +(define-abbrev-table 'magit-mode-abbrev-table '()) + +(define-abbrev-table 'magit-process-mode-abbrev-table '()) + +(define-abbrev-table 'magit-reflog-mode-abbrev-table '()) + +(define-abbrev-table 'magit-refs-mode-abbrev-table '()) + +(define-abbrev-table 'magit-repolist-mode-abbrev-table '()) + +(define-abbrev-table 'magit-revision-mode-abbrev-table '()) + +(define-abbrev-table 'magit-section-mode-abbrev-table '()) + +(define-abbrev-table 'magit-stash-mode-abbrev-table '()) + +(define-abbrev-table 'magit-stashes-mode-abbrev-table '()) + +(define-abbrev-table 'magit-status-mode-abbrev-table '()) + +(define-abbrev-table 'magit-submodule-list-mode-abbrev-table '()) + +(define-abbrev-table 'markdown-mode-abbrev-table '()) + +(define-abbrev-table 'markdown-view-mode-abbrev-table '()) + +(define-abbrev-table 'message-mode-abbrev-table '()) + +(define-abbrev-table 'messages-buffer-mode-abbrev-table '()) + +(define-abbrev-table 'mu4e-compose-mode-abbrev-table '()) + +(define-abbrev-table 'mu4e-org-mode-abbrev-table '()) + +(define-abbrev-table 'mu4e~update-mail-mode-abbrev-table '()) + +(define-abbrev-table 'objc-mode-abbrev-table + '( + )) + +(define-abbrev-table 'occur-edit-mode-abbrev-table '()) + +(define-abbrev-table 'occur-mode-abbrev-table '()) + +(define-abbrev-table 'org-export-stack-mode-abbrev-table '()) + +(define-abbrev-table 'org-mode-abbrev-table '()) + +(define-abbrev-table 'outline-mode-abbrev-table '()) + +(define-abbrev-table 'package-menu-mode-abbrev-table '()) + +(define-abbrev-table 'php-mode-abbrev-table '()) + +(define-abbrev-table 'pike-mode-abbrev-table + '( + )) + +(define-abbrev-table 'plain-tex-mode-abbrev-table '()) + +(define-abbrev-table 'process-menu-mode-abbrev-table '()) + +(define-abbrev-table 'prog-mode-abbrev-table '()) + +(define-abbrev-table 'python-mode-abbrev-table '()) + +(define-abbrev-table 'python-mode-skeleton-abbrev-table + '( + )) + +(define-abbrev-table 'react-mode-abbrev-table '()) + +(define-abbrev-table 'rst-mode-abbrev-table + '( + )) + +(define-abbrev-table 'rst-toc-mode-abbrev-table '()) + +(define-abbrev-table 'ruby-mode-abbrev-table '()) + +(define-abbrev-table 'rust-mode-abbrev-table '()) + +(define-abbrev-table 'salt-mode--doc-mode-abbrev-table '()) + +(define-abbrev-table 'salt-mode-abbrev-table '()) + +(define-abbrev-table 'scss-mode-abbrev-table '()) + +(define-abbrev-table 'select-tags-table-mode-abbrev-table '()) + +(define-abbrev-table 'sh-mode-abbrev-table '()) + +(define-abbrev-table 'shell-mode-abbrev-table '()) + +(define-abbrev-table 'slim-mode-abbrev-table '()) + +(define-abbrev-table 'slitex-mode-abbrev-table '()) + +(define-abbrev-table 'smime-mode-abbrev-table '()) + +(define-abbrev-table 'snippet-mode-abbrev-table '()) + +(define-abbrev-table 'special-mode-abbrev-table '()) + +(define-abbrev-table 'speedbar-mode-abbrev-table '()) + +(define-abbrev-table 'ssass-mode-abbrev-table '()) + +(define-abbrev-table 'tabulated-list-mode-abbrev-table '()) + +(define-abbrev-table 'tar-mode-abbrev-table '()) + +(define-abbrev-table 'terraform-mode-abbrev-table '()) + +(define-abbrev-table 'tex-mode-abbrev-table '()) + +(define-abbrev-table 'tex-shell-abbrev-table '()) + +(define-abbrev-table 'text-mode-abbrev-table '()) + +(define-abbrev-table 'url-cookie-mode-abbrev-table '()) + +(define-abbrev-table 'use-package-statistics-mode-abbrev-table '()) + +(define-abbrev-table 'vc-git-log-edit-mode-abbrev-table '()) + +(define-abbrev-table 'vc-git-log-view-mode-abbrev-table '()) + +(define-abbrev-table 'vc-git-region-history-mode-abbrev-table '()) + +(define-abbrev-table 'vc-svn-log-view-mode-abbrev-table '()) + +(define-abbrev-table 'vue-html-mode-abbrev-table '()) + +(define-abbrev-table 'vue-mode-abbrev-table '()) + +(define-abbrev-table 'web-mode-abbrev-table '()) + +(define-abbrev-table 'xref--xref-buffer-mode-abbrev-table '()) + +(define-abbrev-table 'yaml-mode-abbrev-table '()) diff --git a/.config/emacs/custom.el b/.config/emacs/custom.el new file mode 100644 index 0000000..fc8a483 --- /dev/null +++ b/.config/emacs/custom.el @@ -0,0 +1,19 @@ +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(ansi-color-names-vector + ["#1c1c1c" "#d78787" "#b9dc92" "#ffffaf" "#87afd7" "#875f87" "#dfafdf" "#d0d0d0"]) + '(custom-safe-themes + '("3334ff826da9dc6fd75b87f9b7759956fabf2d1ff898c6cddf1306ad0540d4a0" "87adaa6ee5799b9116c2bbdcf2109efe44d9102d23ebc0ec1c3d75b95ffa50b5" "2141e193a63c28589147d562384d6b3f3728e78ea94af5e4834cad91359cdf6a" "4e7e1be316e5095960f5dd27402a81f6d69e0ba380355ad5215797efb5466eea" "27982b03b7d049912b600301e50637882ec095f384124180a21772ec8da5f7e8" "6395777d3007cd6d3e613812d493ab9d09aa68f17d3dbf3935bfa1672279281e" "169e5b085078237c277753e3bd83e40a398e5eef98d922eb9b92fc3dbce9046d" "568969c0ed1874dc4ae94c2792eda17f10a40562ccb531c528a112f65889af75" "6c929cd6a199700c871ef92ad47ba20accd00810fc92e8343448da67dcde0898" "840588bd742f27724df70209930633b83567026a7290b2f4105939a6eabbb4cf" "806f76b435a02f1016a5b76a6aa8f9304d7c51f98f85ebd13f33f1b148227b7f" "8185f8e6c2d6a29da892e13e33d666cc26303a9639a8582c8035fbf0987c5f20" "9c538f4387a7db52b13fa988f93bd337ab13ead7c8fdb5fed29833d7d7e0f27c" "232b0c9752006e63d3bf8b5329bda6f3592e4ac1bdf96b17879bb076f16ea82c" "45847e51cdf4bcacfd2093d48be8c727da9837830911999b2d2b31ffa27de90b" "7938d6870d8bbf41504f1338ebb3b590eaacfb201327fb9389454b08abcef0df" "21f0483411dee48b338960db918d82630516a3d726f9432f8ae8c0b8554df25f" "d300a3efcf6b385537e11bd588d08aed850ce239b66ff37ee57a7f20f1b05e47" "f2d128f0ca6290df5c608a9e3e564bbe3ee2f22b61dc1409cdf5e3c200337e7d" "f42263201f447f8c15e57474a95d26500b7e6f932e3d75a3604802a6c9a9f18f" "af2817482b04be9d60ac90ad89e386dd076b9338f135d576ef9bd357e01f64ca" "053a91acd65e7592ec1f1451f81554da96f26781858f961db65c9f1be7c6ffe0" "d55733f0ab2ab8031b3206e900f3729deed13acc6d56cf09a171ae8e26cb7181" default)) + '(delete-selection-mode nil) + '(magit-todos-insert-after '(bottom) nil nil "Changed by setter of obsolete option `magit-todos-insert-at'") + '(safe-local-variable-values '((eval apheleia-mode nil) (+format-inhibit . t))) + '(warning-suppress-types '((org-element-cache)))) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + ) diff --git a/.config/emacs/early-init.el b/.config/emacs/early-init.el new file mode 100644 index 0000000..92eac3d --- /dev/null +++ b/.config/emacs/early-init.el @@ -0,0 +1,17 @@ +;; Copyright (C) 2016-Ω Miquel Sabaté Solà <mikisabate@gmail.com> +;; +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <https://www.gnu.org/licenses/>. + +;; Prevent package.el loading packages prior to their init-file loading. +(setq package-enable-at-startup nil) diff --git a/.config/emacs/init.el b/.config/emacs/init.el new file mode 100644 index 0000000..3762480 --- /dev/null +++ b/.config/emacs/init.el @@ -0,0 +1,682 @@ +;; Copyright (C) 2016-Ω Miquel Sabaté Solà <mikisabate@gmail.com> +;; +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <https://www.gnu.org/licenses/>. + +;;; +;; Early checks: force Linux and a recent GNU Emacs. + +(unless (string= system-type 'gnu/linux) + (error "You are supposed to be running Linux!")) + +(unless (>= emacs-major-version 30) + (error "You are supposed to be running an up-to-date GNU Emacs")) + +;;; +;; Package manager: straight.el. + +;; Change the repo url for nongnu-elpa as savannah is unreliable. This has been +;; changed in straight.el `develop` branch, but it's not there in the stable +;; branch. +(custom-set-variables + '(straight-recipe-overrides '((nil + (nongnu-elpa :type git + :repo "https://github.com/emacsmirror/nongnu_elpa" + :depth (full single-branch) + :local-repo "nongnu-elpa" + :build nil))))) + +;; As taken from the documentation, this is some fancy Emacs Lisp code to +;; bootstrap straight.el in case it isn't available on the system already. +(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)) + (unless (file-exists-p bootstrap-file) + (with-current-buffer + (url-retrieve-synchronously + "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" + 'silent 'inhibit-cookies) + (goto-char (point-max)) + (eval-print-last-sexp))) + (load bootstrap-file nil 'nomessage)) + +;; But we are actually going to use `use-package' always, so let's integrate +;; straight.el into it. +(straight-use-package 'use-package) +(setq straight-use-package-by-default t) + +;;; +;; Core + +;; There are some packages that expect us to have a `user-full-name' and a +;; `user-mail-address' defined. +(setq user-full-name "Miquel Sabaté Solà" + user-mail-address "mikisabate@gmail.com") + +;;; +;; Key bindings: using Evil mode and general.el for the key binding shenanigans. + +;; Forgive me Father, for I have sinned. +(use-package evil + :custom + (evil-want-keybinding nil) ; Defer Evil's default keybindings, let evil-collection handle it or define manually. + (evil-want-C-u-scroll t) + (evil-want-C-u-delete t) + (evil-want-C-d-scroll t) + (evil-want-C-w-delete t) + :config + (evil-mode 1)) + +;; Add the surround object. +(use-package evil-surround + :after evil + :config + (global-evil-surround-mode 1)) + +;; Carelessly comment out stuff in multiple languages. +(use-package evil-commentary + :after evil + :config + (evil-commentary-mode t)) + +;; Evil +everywhere. +(use-package evil-collection + :after evil + :config + (evil-collection-init)) + +;; Allow me to use C-z as my escape input. +(use-package evil-escape + :after general + :config + (general-define-key + :states '(insert normal) + "C-z" #'evil-escape)) + +;; Sane key-binding management. +(use-package general + :after evil + :config + + ;; Small C-<> mappings. + (general-define-key + :states 'normal + "C-s" #'save-buffer + "C-e" #'evil-end-of-line + "C-2" (lambda (n) + (interactive "p") + (evil-execute-macro n "@q"))) + + ;; And being cheeky with a C-s for saving even in insert mode. + (general-define-key + :states 'insert + "C-s" (lambda () (interactive) (save-buffer) (evil-force-normal-state))) + + ;; Expansions for the Emacs' C-x prefix, handling windows, buffers, etc. + (general-define-key + :prefix "C-x" + "k" #'kill-this-buffer + "K" #'kill-buffer-and-window + "v" #'split-window-right + "V" (lambda () (interactive) (split-window-right) (other-window 1))) + + ;; Expansions for the Emacs' C-c prefix. + (general-define-key + :prefix "C-c" + ;; The least-ambitious use of org-mode ever, I know. + "C-o" + (lambda () + (interactive) + (find-file (concat (file-name-as-directory org-directory) "index.org")))) + + ;; Define my leader key. + (general-create-definer mssola/leader-def + :prefix "SPC") + + ;; Define mappings based on a <leader>. + (mssola/leader-def + :states 'normal + :keymaps 'override + "j" 'xref-find-definitions + "m" 'mssola/mu4e + "p" 'project-switch-project + "s" 'consult-ripgrep + "u" 'xref-find-references ; TODO: in vertico buffer + "SPC" 'project-find-file)) + +;;; +;; General + +;; Follow symlinks. +(setq vc-follow-symlinks t) + +;; Default to y/n instead of full yes/no. +(fset 'yes-or-no-p 'y-or-n-p) + +;; Revert buffers automatically when underlying files are changed externally. +(global-auto-revert-mode t) + +;; No backups: they are more of a nuisance that an actual help… +(setq-default make-backup-files nil) +(setq-default auto-save-default nil) + +;; Save custom variables somewhere else +(setq custom-file (expand-file-name "custom.el" user-emacs-directory)) +(when (file-exists-p custom-file) + (load custom-file)) + +;; The crux package offers quite a few goodies, and I'm particularly interested +;; on the `crux-delete-file-and-buffer', which will delete the file related to +;; the current buffer as well as the buffer itself. +(use-package crux + :bind (("C-c D" . crux-delete-file-and-buffer))) + +;; Org mode directory. +(setq org-directory "~/org/") + +;; Show me which functions are available for the key I half-pressed. +(use-package which-key + :custom + (which-key-idle-delay 0.3) + (which-key-side-window-location 'bottom) + :hook (after-init . which-key-mode)) + +;;; +;; UI + +;; Some time ago I created this title format, and now I prefer it over other +;; options. +(setq frame-title-format + (setq icon-title-format '((:eval (concat (user-real-login-name) ": " + (if (buffer-file-name) + (abbreviate-file-name (buffer-file-name)) + "%b")))))) + +;; I’m using “Droid Sans Mono” simply because I’ve grown used to it. +(defconst mssola-font + "Droid Sans Mono Dotted for Powerline-10" + "The font to be used.") + +(add-to-list 'default-frame-alist `(font . ,mssola-font)) + +;; Emacs in daemon mode does not like `set-face-attribute` because this is only +;; applied if there is a frame in place, which doesn't happen when starting the +;; daemon. Thus, we should call that after the frame has been created (e.g. by +;; emacsclient). See: +;; https://lists.gnu.org/archive/html/help-gnu-emacs/2015-03/msg00016.html +(add-hook 'after-make-frame-functions-hook + (lambda () + (set-face-attribute 'default t :font mssola-font))) + +;; Remove the initial message from the scratch buffer. +(setq initial-scratch-message nil) + +;; No welcome screen +(setq-default inhibit-startup-message t) + +;; Minimalistic UI. +(menu-bar-mode -1) +(when (fboundp 'set-scroll-bar-mode) + (set-scroll-bar-mode nil)) +(when (fboundp 'tool-bar-mode) + (tool-bar-mode -1)) +(when (fboundp 'tooltip-mode) + (tooltip-mode 0)) + +;; Display helpful information on where we are. +(line-number-mode 1) +(column-number-mode 1) +(size-indication-mode 1) +(add-hook 'prog-mode-hook 'display-line-numbers-mode) + +;; Let's make scrolling suck less. +(setq scroll-margin 0 + scroll-conservatively 100000 + scroll-preserve-screen-position 1) + +;; There is somewhere someone who likes to be interrupted with stupid beep +;; sounds. That sorry soul is not me. +(setq ring-bell-function 'ignore) + +;; Use the modeline for Doom, which is simply superior to whatever I can +;; half-ass. +(use-package doom-modeline + :custom + (doom-modeline-height 20) + (doom-modeline-persp-name nil) + (doom-modeline-major-mode-icon nil) + (doom-modeline-modal-icon t) + (doom-modeline-icon t) + (doom-modeline-buffer-file-name-style 'relative-from-project) + :hook (after-init . doom-modeline-mode)) + +;; Color theme: try to use my own theme called `soria'. There are two paths +;; where the `soria' theme might reside. The first path we are going to try is +;; my local dev environment, otherwise we will try the global installation path +;; (as pointed out on the documentation of the RPM package). +(let ((dev-dir (concat (getenv "HOME") "/src/github.com/mssola/soria")) + (global-dir "/usr/share/emacs/site-lisp/themes")) + (if (file-exists-p dev-dir) + (add-to-list 'custom-theme-load-path dev-dir) + (when (file-exists-p global-dir) + (add-to-list 'custom-theme-load-path global-dir))) + + ;; If soria could be loaded as a theme, let's set the + ;; `soria-theme-purple-identifiers' hook for the relevant modes. + (when (load-theme 'soria t) + (dolist (lang-hook '(ruby-mode-hook + php-mode-hook + perl-mode-hook + emacs-lisp-mode-hook)) + (add-hook lang-hook 'soria-theme-purple-identifiers)))) + +;; When in Evil mode, it just makes sense to have line numbers relatively. +(setq display-line-numbers-type 'relative) + +;; For whatever reason someone thought that having the tilde fringe as it +;; happens to vi was a good idea. I disagree. +(remove-hook 'text-mode-hook #'vi-tilde-fringe-mode) + +;; Enable number highlighting. +(use-package highlight-numbers + :hook ((prog-mode-hook conf-mode-hook) . highlight-numbers-mode)) + +;; Highlight todos, warnings, et al. +(use-package hl-todo + :hook ((prog-mode yaml-mode) . hl-todo-mode)) + +;;; +;; Core editor. + +;; UTF-8 everywhere. +(prefer-coding-system 'utf-8) +(set-default-coding-systems 'utf-8) +(set-terminal-coding-system 'utf-8) +(set-keyboard-coding-system 'utf-8) +(set-language-environment 'utf-8) + +;; GNU Emacs modes typically provide a standard means to change the indentation +;; width (e.g. c-basic-offset), and that will inevitably conflict with the “tabs +;; vs spaces” question and the myriad of code conventions for each programming +;; language. We will deal with all this later. +(setq-default indent-tabs-mode nil) +(setq-default tab-width 4) + +;; If an .editorconfig is around, use that. +(editorconfig-mode 1) + +;; As for word wrapping and filling we will take a conservative default, and +;; later we will discard it for some modes. For example, it makes sense to +;; perform auto-fill in text-mode (which includes org-mode), but there is no +;; point of doing it in source code. +(setq-default fill-column 80) +(setq-default auto-fill-function 'do-auto-fill) + +;; Do not break lines +(set-default 'truncate-lines t) + +;; It’s pretty bananas that I have to say it, but if I’ve pressed a key when +;; selecting text, I want that text to be nuked and replaced with whatever I’ve +;; typed. This will be overriden anyways with evil-mode, but let’s do this now +;; just in case evil-mode is disabled or something. Delete the selection with a +;; keypress. +(delete-selection-mode t) + +;; There are uncivilized barbarians that do not delete trailing +;; whitespaces. This is not my case. +(add-hook 'before-save-hook #'delete-trailing-whitespace) + +;; And finally, let’s make the cursor a little more relevant. For starters, the +;; default of the cursor blinking is plain idiotic. Secondly, I don’t want +;; special highlighting for the current line. And finally, I’d like matching +;; parenthesis to say something whenever the cursor is on top of one of them. +(blink-cursor-mode 0) +(global-hl-line-mode -1) +(show-paren-mode 1) + +;;; +;; Completion. + +;; Ignore case on completion. +(setq read-file-name-completion-ignore-case t + read-buffer-completion-ignore-case t + completion-ignore-case t) + +;; Code completion. +(use-package company + :hook (after-init . global-company-mode)) + +;; Vertico: vertical completion for search elements. +(use-package vertico + :after general + :custom + (vertico-count 20) + (vertico-resize nil) + (vertico-cycle t) + :init + (vertico-mode) + :bind + (:map vertico-map + ("C-k" . vertico-previous) + ("C-j" . vertico-next))) + +;; Persist history over Emacs restarts. Vertico sorts by history position. +(use-package savehist + :init + (savehist-mode)) + +;; Emacs minibuffer configurations. +(use-package emacs + :custom + ;; Enable context menu. `vertico-multiform-mode' adds a menu in the minibuffer + ;; to switch display modes. + (context-menu-mode t) + ;; 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))) + +;; Optionally use the `orderless' completion style. +(use-package orderless + :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))))) + +;; Needed in order to get `consult-ripgrep', which is great for searching text +;; on the current project. +(use-package consult + :after vertico) + +;; Put abbrevs into my emacs directory so it can be tracked on Git. +(setq abbrev-file-name (expand-file-name "abbrevs.el" user-emacs-directory) + save-abbrevs 'silent) + +;; And apply abbrevs.el where relevant. +(dolist (hook '(org-mode-hook text-mode-hook)) + (add-hook hook #'abbrev-mode)) + +;;; +;; Tools + +;; Enable spelling checks (only on text, not on code). +(use-package flyspell + :defer t + :config + (setq flyspell-issue-welcome-flag nil + flyspell-issue-message-flag nil) + (general-define-key "<f8>" 'ispell-word)) + +;; And integrate it with vertico. +(use-package flyspell-correct + :defer t + :commands flyspell-correct-previous + :general ([remap ispell-word] #'flyspell-correct-at-point)) + +(defun mssola/git-commit-hook () + "Things to run upon entering git-commit mode." + + (setq fill-column 72) + (when (and (bound-and-true-p evil-local-mode) + (not (evil-emacs-state-p)) + (bobp) (eolp)) + (evil-insert-state))) + +;; I mostly stick to Git CLI, but it's really nice when staging chunks, checking +;; diffs, showing logs; and similar scenarios where Git can be tedious. +(use-package magit + :defer t + :config + (setq magit-diff-refine-hunk t ; show granular diffs in selected hunk + ;; Don't autosave repo buffers. This is too magical, and saving can + ;; trigger a bunch of unwanted side-effects, like save hooks and + ;; formatters. Trust the user to know what they're doing. + magit-save-repository-buffers nil + ;; Don't display parent/related refs in commit buffers; they are rarely + ;; helpful and only add to runtime costs. + magit-revision-insert-related-refs nil + ;; If two projects have the same project name (e.g. A/src and B/src will + ;; both resolve to the name "src"), Magit will treat them as the same + ;; project and destructively hijack each other's magit buffers. This is + ;; especially problematic if you use workspaces and have magit open in + ;; each, and the two projects happen to have the same name! By unsetting + ;; `magit-uniquify-buffer-names', magit uses the project's full path as + ;; its name, preventing such naming collisions. + magit-uniquify-buffer-names nil) + + ;; Turn ref links into clickable buttons. + (add-hook 'magit-process-mode-hook #'goto-address-mode) + + ;; Git commit mode. + (setq git-commit-summary-max-length 50 + git-commit-style-convention-checks '(overlong-summary-line non-empty-second-line)) + + (add-hook 'git-commit-mode-hook 'mssola/git-commit-hook)) + +;; Nicer diffs. +(use-package magit-delta + :when (executable-find "git-delta") + :hook (magit-mode . magit-delta-mode)) + +;; Highlighting for git-related files. +(use-package git-modes + :defer t) + +;;; +;; Languages + +;; I'm fine with the basic support from GNU Emacs for most languages. Here I'm +;; adding support from modes which are not installed by default. + +(use-package markdown-mode + :defer t) + +(use-package adoc-mode + :defer t) + +(use-package yaml-mode + :defer t) + +(use-package dockerfile-mode + :defer t) + +;; I don't want to go LSP all the way, but for certain languages is almost +;; required (e.g. Go). In any case, let's keep it simple. + +(use-package lsp-mode + :defer t + :config + (setq lsp-enable-folding nil + lsp-enable-text-document-color nil + lsp-enable-on-type-formatting nil + lsp-headerline-breadcrumb-enable nil)) + +;; Better LSP integration, configuration taken from Doom. +(use-package lsp-ui + :hook (lsp-mode . lsp-ui-mode) + :config + (setq lsp-ui-peek-enable nil + lsp-ui-doc-max-height 8 + lsp-ui-doc-max-width 72 + lsp-ui-doc-delay 0.75 + lsp-ui-doc-show-with-mouse nil + lsp-ui-doc-position 'at-point + lsp-ui-sideline-ignore-duplicate t + lsp-ui-sideline-show-hover nil + lsp-ui-sideline-actions-icon lsp-ui-sideline-actions-icon-default)) + +(defun mssola/golang-before-save-hooks () + "Setup before-save-hooks relevant to Go." + + (add-hook 'before-save-hook #'lsp-format-buffer nil t) + (add-hook 'before-save-hook #'lsp-organize-imports nil t)) + +;; Support for Go with LSP integration. +(use-package go-mode + :defer t + :hook ((go-mode . lsp-deferred) + (go-mode . mssola/golang-before-save-hooks))) + +;; Utils + +;; Provide the `xref-find-definitions' interactive function which can be used to +;; jump between definitions in any language. It's basically `rg' on steroids but +;; it works remarkably well for what it is. +(use-package dumb-jump + :defer t) + +;;; +;; Email + +;; I take mu4e not from MELPA but from the openSUSE repositories. Hence, +;; instead of using `use-package' we are going to pin point the installation +;; path and configure `mu4e' whenever I try to launch it. +(add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e") + +;; Set the maildir directory in any case. +(setq mu4e-maildir "~/data/mail") + +(defun mssola/mu4e () + "Configure mu4e in-place and launch it." + + (interactive) + + (progn + (require 'mu4e) + + ;; Use `msmtp' as the program for sending email. + (setq sendmail-program (executable-find "msmtp") + send-mail-function #'smtpmail-send-it + starttls-use-gnutls t + message-sendmail-f-is-evil t + message-sendmail-extra-arguments '("--read-envelope-from") + message-send-mail-function #'message-send-mail-with-sendmail) + + ;; The default bookmarks are cool and all, but they lack a proper sink that + ;; gathers all inboxes. + (add-to-list 'mu4e-bookmarks + '(:name "Inbox" + :query "maildir:/gmail/inbox OR maildir:/comsuse/inbox OR maildir:/sindicat/inbox OR maildir:/uoc/inbox" + :key ?n)) + + ;; For whatever reason I lost the "messages sent" bookmark. Let's re-add it. + (add-to-list 'mu4e-bookmarks + '(:name "Sent" + :query "from:mikisabate@gmail.com OR from:msabate@suse.com" + :key ?s)) + + ;; General mu4e settings. + (setq message-kill-buffer-on-exit t + mu4e-get-mail-command "mbsync --all" + mu4e-update-interval 600 + mu4e-use-fancy-chars nil + gnus-treat-display-smileys nil + mu4e-sent-messages-behavior 'sent + mu4e-notification-support t + mu4e-hide-index-messages t + mu4e-confirm-quit nil + + mu4e-headers-date-format "%Y-%m-%d %H:%M" + mu4e-headers-skip-duplicates t + mu4e-headers-include-related t + mu4e-headers-auto-update t + mu4e-headers-fields + '((:human-date . 8) + (:from-or-to . 25) + (:subject)) + + message-user-organization nil + message-organization nil + + message-citation-line-format "%N @ %Y-%m-%d %H:%M %Z:\n" + message-citation-line-function 'message-insert-formatted-citation-line + + message-kill-buffer-on-exit t + mu4e-view-show-addresses t + + mu4e-context-policy 'ask-if-none + mu4e-compose-context-policy 'always-ask + mu4e-compose-dont-reply-to-self t + + mu4e-completing-read-function #'completing-read + + mail-user-agent 'mu4e-user-agent + message-mail-user-agent 'mu4e-user-agent + + mu4e-attachment-dir (concat (expand-file-name (or (getenv "XDG_DOWNLOAD_DIR") "www") "~") "/") + mu4e-change-filenames-when-moving t) + + ;; PGP thingies. + (setq mml-secure-openpgp-signers '("0x96BE8C6FD89D6565") + mml-secure-openpgp-sign-with-sender t) + + (add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime) + + ;; And here comes the account shenanigans. + (setq mu4e-contexts + `( + ;; GMail + ,(make-mu4e-context + :name "gmail" + :enter-func (lambda () + (mu4e-message "Switching to gmail.com") + (setq mu4e-sent-messages-behavior 'delete)) + :match-func + (lambda (msg) + (when msg + (string-prefix-p "/gmail" (mu4e-message-field msg :maildir)))) + :vars '( + (user-mail-address . "mikisabate@gmail.com") + (mu4e-reply-to-address . "mikisabate@gmail.com") + (mu4e-drafts-folder . "/gmail/Drafts") + (mu4e-sent-folder . "/gmail/Sent") + (mu4e-refile-folder . "/gmail/All") + (mu4e-trash-folder . "/gmail/Trash"))) + + ;; suse.com + ,(make-mu4e-context + :name "suse" + :enter-func (lambda () + (mu4e-message "Switching to suse.com") + (setq mu4e-sent-messages-behavior 'delete)) + :match-func + (lambda (msg) + (when msg + (string-prefix-p "/comsuse" (mu4e-message-field msg :maildir)))) + :vars `( + (user-mail-address . "msabate@suse.com") + (mu4e-reply-to-address . "msabate@suse.com") + (mu4e-drafts-folder . "/comsuse/Esborranys") + (mu4e-sent-folder . "/comsuse/Elements enviats") + (mu4e-refile-folder . "/comsuse/All") + (mu4e-trash-folder . "/comsuse/Elements suprimits"))))) + ) + + ;; And finally call the real deal. + (mu4e)) + +;; Nice highlighting for patches inside of emails. +(use-package message-view-patch + :hook (gnus-part-display . message-view-patch-highlight)) diff --git a/.config/emacs/straight/versions/default.el b/.config/emacs/straight/versions/default.el new file mode 100644 index 0000000..8c1343b --- /dev/null +++ b/.config/emacs/straight/versions/default.el @@ -0,0 +1,56 @@ +(("adoc-mode" . "20772277b8a5b8c08d49bd03043d5d4dd7a815e9") + ("annalist.el" . "e1ef5dad75fa502d761f70d9ddf1aeb1c423f41d") + ("bind-key" . "ec9d0505febe2556b47457355763f5f1408a35ac") + ("company-mode" . "1924eabfa7438974da0500e85fff5fb32c27282c") + ("compat" . "97f24af413a38a7f1aaedb29f5aaaa333796a5b4") + ("consult" . "d32cccdcb5559b503306291fa9f52df19594d687") + ("crux" . "3b72275fce66162770b53cf72eb72515c3e68492") + ("dash.el" . "fcb5d831fc08a43f984242c7509870f30983c27c") + ("dockerfile-mode" . "8135740bfc6ad96ab82d39d9fe68dbce56180f4c") + ("doom-modeline" . "14b09e0b20f0e210be54167b12c3b5a201eb0327") + ("dumb-jump" . "42f97dea503367bf45c53a69de959177b06b0f59") + ("el-get" . "ec5cba8d965980b2c47a8a11dce30dd5e845ed2a") + ("eldoc" . "1d11743436e9ce0d11529bfdf1e548e64f31a92e") + ("emacs-which-key" . "38d4308d1143b61e4004b6e7a940686784e51500") + ("emacsmirror-mirror" . "5f795cc476f24d011e2cd83159a38522fe832a97") + ("evil" . "682e87fce99f39ea3155f11f87ee56b6e4593304") + ("evil-collection" . "d74647169703362433b1f55420623f145880b898") + ("evil-commentary" . "c5945f28ce47644c828aac1f5f6ec335478d17fb") + ("evil-escape" . "aebd1a78a6bd33e5164e7552096b3fe1172d3012") + ("evil-surround" . "da05c60b0621cf33161bb4335153f75ff5c29d91") + ("f.el" . "931b6d0667fe03e7bf1c6c282d6d8d7006143c52") + ("flyspell-correct" . "1e7a5a56362dd875dddf848b9a9e25d1395b9d37") + ("general.el" . "a48768f85a655fe77b5f45c2880b420da1b1b9c3") + ("git-modes" . "27af84f31ed022267b7108ad10ea286631f88e88") + ("gnu-elpa-mirror" . "f498c07548b83e13ff9e2b9e2f772a19256affdf") + ("go-mode.el" . "0ed3c5227e7f622589f1411b4939c3ee34711ebd") + ("goto-chg" . "72f556524b88e9d30dc7fc5b0dc32078c166fda7") + ("highlight-numbers" . "8b4744c7f46c72b1d3d599d4fb75ef8183dee307") + ("hl-todo" . "7ed8bbcadb5229d648b194e0e4c4d261825aa91b") + ("ht.el" . "1c49aad1c820c86f7ee35bf9fff8429502f60fef") + ("hydra" . "59a2a45a35027948476d1d7751b0f0215b1e61aa") + ("llama" . "0cc2daffded18eea7f00a318cfa3e216977ffe50") + ("lsp-mode" . "147233313576c844e2bf56640827b0d0e5c2ee6c") + ("lsp-ui" . "a0dde8b52b4411cbac2eb053ef1515635ea0b7ed") + ("magit" . "5b820a1d1e94649e0f218362286d520d9f29ac2c") + ("magit-delta" . "5fc7dbddcfacfe46d3fd876172ad02a9ab6ac616") + ("markdown-mode" . "7c51a2167c5a1330e0ab52fe5b2d03c1ead122ca") + ("melpa" . "544e3cd5c82fa5b86d3596b9ae934c6e6fc56d97") + ("message-view-patch" . "40bc2e554fc1d0b6f0c403192c0a3ceaa019a78d") + ("nerd-icons.el" . "4476b4cabe63f5efafa3c0a8b370db4f6a92e90c") + ("nongnu-elpa" . "fca2a26fd4e5e03ae82cb8f560de1ab3ef882a7e") + ("orderless" . "082a487f79ca5e960046a31599a5f97dac79a858") + ("parent-mode" . "fbd49857ab2e4cd0c5611c0cc83f93711657b298") + ("popup-el" . "24dd22186403a6566c26ce4996cdb1eedb1cc5cd") + ("s.el" . "dda84d38fffdaf0c9b12837b504b402af910d01d") + ("seq" . "da86da9bf111f68fb81efd466d76d53af5aebc00") + ("shrink-path.el" . "c14882c8599aec79a6e8ef2d06454254bb3e1e41") + ("spinner" . "fa117f0893788f3fe24673715a6b83bb34d238dd") + ("straight.el" . "4272a70d5a385c5c4f92f4f4b111f063db0afac7") + ("transient" . "49bbb29fd34b807948d4f2b91f61587c12a595f0") + ("use-package" . "29552cf3af755f17e297862a7f635c469a28b09f") + ("vertico" . "d8dc49a3520ab908c2b0f62a4a8ae32ca23f2726") + ("with-editor" . "f32cd7b09d518b629bfaa3eeb92b539891c6b9bc") + ("xterm-color" . "2ad407c651e90fff2ea85d17bf074cee2c022912") + ("yaml-mode" . "d91f878729312a6beed77e6637c60497c5786efa")) +:gamma |
