aboutsummaryrefslogtreecommitdiff
path: root/.config/doom
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2024-03-31 12:13:21 +0200
committerMiquel Sabaté Solà <msabate@suse.com>2024-04-02 16:38:42 +0200
commit9be35b7d7ae6156765a8bd3616b38d529f2722ff (patch)
tree3d2f00e3c058ec0d184b4ed0f0d4a44d6ef70708 /.config/doom
parentaf506d19f05695ec99e28670fbcb5ce894d39d12 (diff)
downloaddotfiles-9be35b7d7ae6156765a8bd3616b38d529f2722ff.tar.gz
dotfiles-9be35b7d7ae6156765a8bd3616b38d529f2722ff.zip
Moved .doom.d -> .config/doom
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to '.config/doom')
-rw-r--r--.config/doom/README.org16
-rw-r--r--.config/doom/abbrevs.el317
-rw-r--r--.config/doom/config.el386
-rw-r--r--.config/doom/custom.el17
-rw-r--r--.config/doom/init.el175
-rw-r--r--.config/doom/packages.el6
6 files changed, 917 insertions, 0 deletions
diff --git a/.config/doom/README.org b/.config/doom/README.org
new file mode 100644
index 0000000..7418747
--- /dev/null
+++ b/.config/doom/README.org
@@ -0,0 +1,16 @@
+* 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/doom/abbrevs.el b/.config/doom/abbrevs.el
new file mode 100644
index 0000000..fc8c556
--- /dev/null
+++ b/.config/doom/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/doom/config.el b/.config/doom/config.el
new file mode 100644
index 0000000..b895de2
--- /dev/null
+++ b/.config/doom/config.el
@@ -0,0 +1,386 @@
+;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
+
+;;; Basic information.
+
+(defconst mssola-backup-dir "/home/backup"
+ "Directory located in a big partition where I dump a lot of crap.")
+
+;; 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")
+
+;;; General utility functions.
+
+(defun mssola/workstation-p ()
+ "Returns true if the current machine is my workstation."
+
+ (string= (system-name) "freezeezy"))
+
+;;; General
+
+;; Bindings for managing windows, buffers, etc.
+(map! "C-x k" #'kill-this-buffer)
+(map! "C-x K" #'kill-buffer-and-window)
+(map! "C-x v" #'split-window-right)
+(map! "C-x V" (lambda () (interactive) (split-window-right) (other-window 1)))
+
+;; 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)))
+
+;;; UI
+
+;; Some time ago I created this title format, and now I prefer it over other
+;; options, including Doom's default one.
+(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"))))))
+
+;; Color theme: try to use my own theme called `soria', otherwise let's go for
+;; Doom's default one (`doom-one'). 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). If none of this worked, then just go with
+;; doom's default theme.
+(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.
+ (if (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))
+ (setq doom-theme 'doom-one)))
+
+(defun mssola/face-at-point (pos)
+ "Writes a message with the name of the face at the current
+ point. The `POS' argument contains the current position of the
+ cursor."
+
+ (interactive "d")
+
+ (let ((face (or (get-char-property (point) 'read-face-name)
+ (get-char-property (point) 'face))))
+ (if face (message "Face: %s" face) (message "No face at %d" pos))))
+
+;; Binding so we know the current face at a given point. Convenient when hacking
+;; the `soria' theme.
+(map! "C-c f" #'mssola/face-at-point)
+
+;; Doom allows us to define the font depending on the contex which is really
+;; cool. Let's define Droid Sans Mono Dotted just because I've grown used to
+;; it...
+(setq doom-font (font-spec :name "Droid Sans Mono Dotted for Powerline-10")
+ doom-big-font (font-spec :name "Droid Sans Mono Dotted for Powerline-10" :size 24))
+
+;; When in Evil mode, it just makes sense to have line numbers relatively.
+(setq display-line-numbers-type 'relative)
+
+;; I *really* don't like highlighting the current line, let's remove it now...
+(remove-hook 'doom-first-buffer-hook #'global-hl-line-mode)
+
+;; 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)
+
+;; The modeline I was using even before switching to Doom. I modify quite a few
+;; things from the default installation so it is simpler.
+(use-package! doom-modeline
+ :init
+ (setq 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))
+
+;;; Editor
+
+;; Some bindings that I've grown used to over the years.
+(map! :i "C-z" #'evil-escape)
+(map! :n "C-z" #'evil-escape)
+(map! :n "C-s" #'save-buffer)
+(map! :n "C-e" #'evil-end-of-line)
+(map! :i "C-s" (lambda () (interactive) (save-buffer) (evil-force-normal-state)))
+(map! :n "C-2"
+ (lambda (n)
+ (interactive "p")
+ (evil-execute-macro n "@q")))
+
+;; Doom by default inserts Evil's snipe mode, which is really confusing and I
+;; *really* don't like it. Let's remove it and bring back the original search
+;; behavior.
+(remove-hook 'doom-first-input-hook #'evil-snipe-mode)
+
+;; Abbreviations live in the Doom private directory, where it's versioned and
+;; it's shared across computers. Moreover, abbrev mode should only spring up
+;; with very specific environments, so let's enable it explicitely for them.
+(setq abbrev-file-name (concat doom-private-dir "abbrevs.el")
+ save-abbrevs 'silent)
+
+(dolist (hook '(erc-mode-hook org-mode-hook text-mode-hook))
+ (add-hook hook #'abbrev-mode))
+
+;; Tweaking more defaults.
+(setq-default tab-width 4)
+(setq-default auto-save-default nil)
+
+;;; Spell checking
+
+(map! "<f8>" #'ispell-word)
+(map! "M-<f8>" #'flyspell-buffer)
+
+(let ((lt-path "/usr/share/languagetool"))
+ (setq langtool-language-tool-jar (concat lt-path "/languagetool-commandline.jar")
+ langtool-mother-tongue "ca"))
+
+(when (fboundp 'langtool-check)
+ (map! "<f9>" #'langtool-check-buffer)
+ (map! "M-<f9>" #'langtool-correct-buffer))
+
+;;; Organization
+
+;; Setting this variable before org-mode loads.
+(setq org-directory "~/org/")
+
+;; I know there are better ways to use org, but that's how I ended up using org
+;; and I don't think I will change for the foreseeable future...
+(map! "C-c C-o"
+ (lambda ()
+ (interactive)
+ (find-file (concat (file-name-as-directory org-directory) "index.org"))))
+
+;; Remove some Doom defaults for org (yeah yeah, I'm boring, I know).
+(after! org
+ (setq! org-startup-indented nil
+ org-hide-leading-stars nil))
+
+;;; Exporting: some functions I use when exporting to PDF cleanly.
+
+(defun mssola/move-file-to-out (dir name ext)
+ "Move out from `DIR' the given file `NAME' if it exists.
+Note that `EXT' must include the period character."
+
+ (when (file-exists-p (concat dir name ext))
+ (unless (file-directory-p (concat dir "out/"))
+ (make-directory (concat dir "out/")))
+ (when (file-exists-p (concat dir "out/" name ext))
+ (delete-file (concat dir "out/" name ext)))
+ (rename-file (concat dir name ext) (concat dir "out/" name ext))))
+
+(defun mssola/export-to-pdf ()
+ "Export the current org document to PDF.
+The generated file will live in an `out' directory (created if it
+isn't there already). Everything else will be cleaned up, so no
+littering will happen locally."
+
+ (interactive)
+
+ (with-current-buffer (current-buffer)
+ (org-latex-export-to-pdf)
+
+ (let* ((fn (buffer-file-name (current-buffer)))
+ (dir (file-name-directory fn))
+ (name (file-name-base fn))
+ (autodir (concat dir "auto")))
+
+ (when (file-directory-p autodir)
+ (delete-directory autodir t))
+
+ (when (file-exists-p (concat dir name ".tex"))
+ (delete-file (concat dir name ".tex")))
+
+ (mssola/move-file-to-out dir name ".pdf"))))
+
+(map! "<f1>" #'mssola/export-to-pdf)
+
+;; Do funny things so both pdflatex and bibtex just work as expected.
+(setq org-latex-pdf-process
+ '("pdflatex -interaction nonstopmode -output-directory %o %f"
+ "bibtex %b"
+ "pdflatex -interaction nonstopmode -output-directory %o %f"
+ "pdflatex -interaction nonstopmode -output-directory %o %f"))
+
+;;; Email
+
+;; Sometimes the load path is not properly set for RPM installs...
+(add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e")
+
+(after! 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:/desuse/inbox OR maildir:/ajuntament/inbox OR maildir:/sindicat/inbox OR maildir:/uoc/inbox"
+ :key ?n))
+
+ ;; Things to look for when acting as a cootw.
+ (add-to-list 'mu4e-bookmarks
+ '(:name "COOTW"
+ :query "to:scc-feedback@suse.de"
+ :key ?c))
+
+ ;; General mu4e settings.
+ (setq message-kill-buffer-on-exit t
+ mu4e-update-interval 600
+ mu4e-use-fancy-chars nil
+
+ ;; doom-emacs adds a lot of clutter here and I'm a simple man.
+ mu4e-headers-fields
+ '((:human-date . 8)
+ (:from-or-to . 25)
+ (:subject))
+
+ ;; Always ask, I don't trust mu4e on this and an error on this can be
+ ;; rather silent and embarrasing at the same time.
+ mu4e-context-policy 'ask-if-none
+ mu4e-compose-context-policy 'always-ask
+
+ mu4e-change-filenames-when-moving t))
+
+;; Let the account party begin!
+
+(defun mssola/mail-signature (key)
+ "Return the proper mail signature for the given `KEY'."
+
+ (cond
+ ((string= key "pgp")
+ (concat
+ "Miquel Sabaté Solà,\n"
+ "PGP: 4096R / 1BA5 3C7A C93D CA2A CFDF DA97 96BE 8C6F D89D 6565\n"))
+ ((string= key "town")
+ (concat
+ "Miquel Sabaté Solà,\n"
+ "Regidor de Joventut, Participació ciutadana i Transparència\n"
+ "\n"
+ "Ajuntament de Capellades\n"
+ "Carrer de Ramon Godó, 9, 08786 - Capellades\n"
+ "Tel. 93 801 10 01 – mòbil 677 12 72 07\n"
+ "sabatesm@capellades.cat\n"))))
+
+(set-email-account! "gmail"
+ '((mu4e-sent-folder . "/gmail/Sent")
+ (mu4e-drafts-folder . "/gmail/Drafts")
+ (mu4e-trash-folder . "/gmail/Trash")
+ (mu4e-refile-folder . "/gmail/All")
+ (smtpmail-smtp-user . "mikisabate@gmail.com")
+ (user-mail-address . "mikisabate@gmail.com")
+ (mu4e-compose-signature . (mssola/mail-signature "pgp")))
+ t)
+
+(set-email-account! "uoc"
+ '((mu4e-sent-folder . "/uoc/Sent")
+ (mu4e-drafts-folder . "/uoc/Drafts")
+ (mu4e-trash-folder . "/uoc/Trash")
+ (mu4e-refile-folder . "/uoc/All")
+ (smtpmail-smtp-user . "mssola@uoc.edu")
+ (user-mail-address . "mssola@uoc.edu")
+ (mu4e-compose-signature . (mssola/mail-signature "pgp")))
+ nil)
+
+(set-email-account! "rovira"
+ '((mu4e-sent-folder . "/urv/Sent Items")
+ (mu4e-drafts-folder . "/urv/Drafts")
+ (mu4e-trash-folder . "/urv/Trash")
+ (mu4e-refile-folder . "/urv/Archive")
+ (smtpmail-smtp-user . "47108707-S@epp.urv.cat")
+ (user-mail-address . "47108707-S@epp.urv.cat")
+ (mu4e-compose-signature . (mssola/mail-signature "pgp")))
+ nil)
+
+(set-email-account! "ajuntament"
+ '((mu4e-sent-folder . "/ajuntament/Elements enviats")
+ (mu4e-drafts-folder . "/ajuntament/Esborranys")
+ (mu4e-trash-folder . "/ajuntament/Elements suprimits")
+ (mu4e-refile-folder . "/ajuntament/Arxiu")
+ (smtpmail-smtp-user . "sabatesm@capellades.cat")
+ (user-mail-address . "sabatesm@capellades.cat")
+ (mu4e-compose-signature . (mssola/mail-signature "town")))
+ nil)
+
+(set-email-account! "sindicat"
+ '((mu4e-sent-folder . "/sindicat/inbox/Sent")
+ (mu4e-drafts-folder . "/sindicat/inbox/Drafts")
+ (mu4e-trash-folder . "/sindicat/inbox/Trash")
+ (mu4e-refile-folder . "/sindicat/inbox/Archive")
+ (smtpmail-smtp-user . "msabate@cgtsuse.org")
+ (user-mail-address . "msabate@cgtsuse.org")
+ (mu4e-compose-signature . (mssola/mail-signature "pgp")))
+ nil)
+
+(set-email-account! "comsuse"
+ '((mu4e-sent-folder . "/comsuse/Elements enviats")
+ (mu4e-drafts-folder . "/comsuse/Esborranys")
+ (mu4e-trash-folder . "/comsuse/Elements suprimits")
+ (mu4e-refile-folder . "/comsuse/Arxiu")
+ (smtpmail-smtp-user . "msabate@suse.com")
+ (user-mail-address . "msabate@suse.com")
+ (mu4e-compose-signature . (mssola/mail-signature "pgp")))
+ nil)
+
+(set-email-account! "desuse"
+ '((mu4e-sent-folder . "/desuse/Sent")
+ (mu4e-drafts-folder . "/desuse/Drafts")
+ (mu4e-trash-folder . "/desuse/Trash")
+ (mu4e-refile-folder . "/desuse/Archives")
+ (smtpmail-smtp-user . "msabate@suse.de")
+ (user-mail-address . "msabate@suse.de")
+ (mu4e-compose-signature . (mssola/mail-signature "pgp")))
+ nil)
+
+;; My main account is properly accounted as a gmail one, but the UOC one is not.
+;; Let's add it here (we need to have them all listed).
+(setq +mu4e-gmail-accounts '(("mikisabate@gmail.com" . "/gmail")
+ ("mssola@uoc.edu" . "/uoc")))
+
+;; Last but not least, let's configure PGP with mu4e.
+(setq mml-secure-openpgp-signers '("0x96BE8C6FD89D6565")
+ mml-secure-openpgp-sign-with-sender t)
+
+(add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime)
+
+(defun mssola/clean-email-env ()
+ "Clean the maildir environment."
+
+ (interactive)
+
+ ;; The 'ajuntament' maildir is a bit special, since I have to handle it
+ ;; manually for embarrasing reasons.
+ (mapc (lambda (f)
+ (unless (file-directory-p f)
+ (delete-file f)))
+ (directory-files (concat (file-name-as-directory mssola-backup-dir)
+ "mail/ajuntament/inbox/new")
+ t)))
+
+;; This is the only hook that `mu4e' allows us to actually do something around
+;; fetching emails. Let's clean the environment before anything, which should be
+;; fine for stupid maildirs such as 'ajuntament'.
+;;
+;; NOTE: this is only done for my workstation. For other machines this is not so
+;; relevant.
+(when (mssola/workstation-p)
+ (add-hook 'mu4e-update-pre-hook 'mssola/clean-email-env))
+
+;; And a binding!
+(map! "C-c m" #'mu4e)
diff --git a/.config/doom/custom.el b/.config/doom/custom.el
new file mode 100644
index 0000000..5108d7e
--- /dev/null
+++ b/.config/doom/custom.el
@@ -0,0 +1,17 @@
+(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
+ '("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)
+ '(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/doom/init.el b/.config/doom/init.el
new file mode 100644
index 0000000..084e17e
--- /dev/null
+++ b/.config/doom/init.el
@@ -0,0 +1,175 @@
+;;; init.el -*- lexical-binding: t; -*-
+
+(doom! :input
+ ;;chinese
+ ;;japanese
+ ;;layout ; auie,ctsrnm is the superior home row
+
+ :completion
+ company ; the ultimate code completion backend
+ ;;helm ; the *other* search engine for love and life
+ ;;ido ; the other *other* search engine...
+ ;;ivy ; a search engine for love and life
+ vertico ; the search engine of the future
+
+ :ui
+ ;;deft ; notational velocity for Emacs
+ doom ; what makes DOOM look the way it does
+ ;;doom-dashboard ; a nifty splash screen for Emacs
+ ;;doom-quit ; DOOM quit-message prompts when you quit Emacs
+ ;;(emoji +unicode) ; 🙂
+ hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
+ ;;hydra
+ ;;indent-guides ; highlighted indent columns
+ ;;ligatures ; ligatures and symbols to make your code pretty again
+ ;;minimap ; show a map of the code on the side
+ modeline ; snazzy, Atom-inspired modeline, plus API
+ ;;nav-flash ; blink cursor line after big motions
+ ;;neotree ; a project drawer, like NERDTree for vim
+ ;;ophints ; highlight the region an operation acts on
+ (popup +defaults) ; tame sudden yet inevitable temporary windows
+ ;;tabs ; a tab bar for Emacs
+ ;;treemacs ; a project drawer, like neotree but cooler
+ ;;unicode ; extended unicode support for various languages
+ ;;vc-gutter ; vcs diff in the fringe
+ ;;vi-tilde-fringe ; fringe tildes to mark beyond EOB
+ ;;window-select ; visually switch windows
+ ;;workspaces ; tab emulation, persistence & separate workspaces
+ ;;zen ; distraction-free coding or writing
+
+ :editor
+ (evil +everywhere) ; come to the dark side, we have cookies
+ file-templates ; auto-snippets for empty files
+ ;;fold ; (nigh) universal code folding
+ (format +onsave) ; automated prettiness
+ ;;god ; run Emacs commands without modifier keys
+ ;;lispy ; vim for lisp, for people who don't like vim
+ ;;multiple-cursors ; editing in many places at once
+ ;;objed ; text object editing for the innocent
+ ;;parinfer ; turn lisp into python, sort of
+ ;;rotate-text ; cycle region at point between text candidates
+ snippets ; my elves. They type so I don't have to
+ ;;word-wrap ; soft wrapping with language-aware indent
+
+ :emacs
+ dired ; making dired pretty [functional]
+ electric ; smarter, keyword-based electric-indent
+ ;;ibuffer ; interactive buffer management
+ undo ; persistent, smarter undo for your inevitable mistakes
+ vc ; version-control and Emacs, sitting in a tree
+
+ :term
+ ;;eshell ; the elisp shell that works everywhere
+ ;;shell ; simple shell REPL for Emacs
+ ;;term ; basic terminal emulator for Emacs
+ ;;vterm ; the best terminal emulation in Emacs
+
+ :checkers
+ syntax ; tasing you for every semicolon you forget
+ (spell +flyspell +hunspell) ; tasing you for misspelling mispelling
+ ;;grammar ; tasing grammar mistake every you make
+
+ :tools
+ ;;ansible
+ ;;debugger ; FIXME stepping through code, to help you add bugs
+ ;;direnv
+ docker
+ ;;editorconfig ; let someone else argue about tabs vs spaces
+ ;;ein ; tame Jupyter notebooks with emacs
+ (eval +overlay) ; run code, run (also, repls)
+ ;;gist ; interacting with github gists
+ lookup ; navigate your code and its documentation
+ ;;lsp ; M-x vscode
+ magit ; a git porcelain for Emacs
+ ;;make ; run make tasks from Emacs
+ ;;pass ; password manager for nerds
+ ;;pdf ; pdf enhancements
+ ;;prodigy ; FIXME managing external services & code builders
+ ;;rgb ; creating color strings
+ ;;taskrunner ; taskrunner for all your projects
+ terraform ; infrastructure as code
+ ;;tmux ; an API for interacting with tmux
+ ;;upload ; map local to remote projects via ssh/ftp
+
+ :os
+ (:if IS-MAC macos) ; improve compatibility with macOS
+ (tty +osc) ; improve the terminal Emacs experience
+
+ :lang
+ ;;agda ; types of types of types of types...
+ ;;beancount ; mind the GAAP
+ cc ; C > C++ == 1
+ ;;clojure ; java with a lisp
+ ;;common-lisp ; if you've seen one lisp, you've seen them all
+ ;;coq ; proofs-as-programs
+ ;;crystal ; ruby at the speed of c
+ ;;csharp ; unity, .NET, and mono shenanigans
+ ;;data ; config/data formats
+ ;;(dart +flutter) ; paint ui and not much else
+ ;;dhall
+ ;;elixir ; erlang done right
+ ;;elm ; care for a cup of TEA?
+ emacs-lisp ; drown in parentheses
+ ;;erlang ; an elegant language for a more civilized age
+ ;;ess ; emacs speaks statistics
+ ;;factor
+ ;;faust ; dsp, but you get to keep your soul
+ ;;fsharp ; ML stands for Microsoft's Language
+ ;;fstar ; (dependent) types and (monadic) effects and Z3
+ ;;gdscript ; the language you waited for
+ go ; the hipster dialect
+ ;;(haskell +lsp) ; a language that's lazier than I am
+ ;;hy ; readability of scheme w/ speed of python
+ ;;idris ; a language you can depend on
+ json ; At least it ain't XML
+ ;;(java +meghanada) ; the poster child for carpal tunnel syndrome
+ javascript ; all(hope(abandon(ye(who(enter(here))))))
+ ;;julia ; a better, faster MATLAB
+ ;;kotlin ; a better, slicker Java(Script)
+ latex ; writing papers in Emacs has never been so fun
+ ;;lean ; for folks with too much to prove
+ ;;ledger ; be audit you can be
+ lua ; one-based indices? one-based indices
+ markdown ; writing docs for people to ignore
+ ;;nim ; python + lisp at the speed of c
+ ;;nix ; I hereby declare "nix geht mehr!"
+ ;;ocaml ; an objective camel
+ org ; organize your plain life in plain text
+ ;;php ; perl's insecure younger brother
+ ;;plantuml ; diagrams for confusing people more
+ ;;purescript ; javascript, but functional
+ ;;python ; beautiful is better than ugly
+ ;;qt ; the 'cutest' gui framework ever
+ ;;racket ; a DSL for DSLs
+ ;;raku ; the artist formerly known as perl6
+ ;;rest ; Emacs as a REST client
+ ;;rst ; ReST in peace
+ (ruby +rails +rvm) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
+ rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
+ ;;scala ; java, but good
+ ;;(scheme +guile) ; a fully conniving family of lisps
+ sh ; she sells {ba,z,fi}sh shells on the C xor
+ ;;sml
+ ;;solidity ; do you need a blockchain? No.
+ ;;swift ; who asked for emoji variables?
+ ;;terra ; Earth and Moon in alignment for performance.
+ web ; the tubes
+ yaml ; JSON, but readable
+ ;;zig ; C, but simpler
+
+ :email
+ (mu4e +gmail)
+ ;;notmuch
+ ;;(wanderlust +gmail)
+
+ :app
+ ;;calendar
+ ;;emms
+ ;;everywhere ; *leave* Emacs!? You must be joking
+ ;;irc ; how neckbeards socialize
+ ;;(rss +org) ; emacs as an RSS reader
+ ;;twitter ; twitter client https://twitter.com/vnought
+
+ :config
+ ;;literate
+ (default +bindings +smartparens))
diff --git a/.config/doom/packages.el b/.config/doom/packages.el
new file mode 100644
index 0000000..c8ce441
--- /dev/null
+++ b/.config/doom/packages.el
@@ -0,0 +1,6 @@
+;; -*- no-byte-compile: t; -*-
+;;; $DOOMDIR/packages.el
+
+(package! crux)
+(package! langtool)
+(package! mu4e-alert :disable t)