This is my Doom Emacs config. It requires src_emacs-lisp[:eval no :tangle no :exports code]{:config literate} to be enabled in init.el.
Remember that you don’t have to run src_sh[:tangle no :eval no :exports code]{doom sync} after modifying this file.
First of all, we enable lexical binding. This is the default for Doom Emacs config files and you can see the differences with dynamic binding here.
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
Many packages require the full name and email address to be stored in these variables.
(setq user-full-name "Carlos José Ruiz-Henestrosa Ruiz"
user-mail-address "ruizh.cj@gmail.com")
Doom exposes five (optional) variables for controlling fonts in Doom. Here are the three important ones:
- src_emacs-lisp[:eval no :tangle no :exports code]{doom-font}
- src_emacs-lisp[:eval no :tangle no :exports code]{doom-variable-pitch-font}
- src_emacs-lisp[:eval no :tangle no :exports code]{doom-big-font}, used for src_emacs-lisp[:eval no :tangle no :exports code]{doom-big-font-mode}; use this for presentations or streaming.
They all accept either a font-spec, font string (=”Input Mono-12”=), or xlfd font string.
(setq doom-font (font-spec :family "Fira Code" :size 16))
There are two ways to load a theme. Both assume the theme is installed and available. You can either set `doom-theme’ or manually load a theme with the `load-theme’ function. This is the default:
(setq doom-theme 'doom-dracula)
(setq org-directory "~/org/")
(after! org
(setq org-agenda-start-on-weekday 1)
(setq calendar-week-start-day 1)
(add-to-list 'org-latex-packages-alist '("AUTO" "babel" t ("pdflatex")))
(add-to-list 'org-latex-packages-alist '("AUTO" "polyglossia" t ("xelatex" "lualatex"))))
(use-package! org-noter
:after (:any org pdf-view)
:config
(setq
org-noter-notes-window-location 'other-frame
org-noter-always-create-frame nil
org-noter-hide-other nil
org-noter-notes-search-path (list "/home/cj/org/notes/")))
org-ref is an org-mode module for citations and bibliographies en org-mode with bibtex support. It is not currently part of any Doom Emacs modules, so we have to install it separately:
(package! org-ref)
We only load the package after org
and set the PDF opener to the default. There are more options in the README.
(use-package! org-ref
:after org
:config
(setq org-ref-pdf-directory "~/Documentos/bibliography/bibtex-pdfs/"
org-ref-default-bibliography "~/Documentos/bibliography/references.bib")
(setq bibtex-completion-bibliography org-ref-default-bibliography
bibtex-completion-library-path "~/Documentos/bibliography/bibtex-pdfs")
;; (setq bibtex-completion-pdf-open-function 'org-open-file)
(setq org-latex-pdf-process (list "latexmk -shell-escape -bibtex -f -pdf %f"))
)
For HTML export I use ox-twbs.
(package! ox-twbs)
;; This determines the style of line numbers in effect. If set to `nil', line
;; numbers are disabled. For relative line numbers, set this to `relative'.
(setq display-line-numbers-type 'relative)
(after! latex
First, we set TeX-electric-math
so that pressing $
writes
$...$
in plain TeX files and \(...\)
in LaTeX files.
(setq-hook! 'plain-tex-mode-hook
TeX-electric-math (cons "$" ""))
(setq-hook! 'LaTeX-mode-hook
TeX-electric-math (cons "\\(" ""))
Enable LaTeX-math-mode
(for fast mathematical input)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
LaTeX-math-abbrev-prefix
needs to be set through customize
.
doom
provides setq!
to help with this, but I can’t seem to get it to work.
See https://lists.gnu.org/archive/html/help-gnu-emacs/2008-06/msg00651.html for the suggestion
and (defcustom LaTeX-math-abbrev-prefix "`"= near [[file://~/.emacs.d/.local/straight/repos/auctex/latex.el:4722][auctex/latex.el:4722]]
for the explanation of what using =customize
does.
If it did work, we could just do this:
(setq! LaTeX-math-abbrev-prefix "ç")
(add-hook 'LaTeX-math-mode-hook
(customize-set-variable 'LaTeX-math-abbrev-prefix "ç"))
But instead we have to do everything manually.
(add-hook! 'LaTeX-math-mode-hook
(define-key LaTeX-math-mode-map
(LaTeX-math-abbrev-prefix) t) ; Unbind "`"
(set-default 'LaTeX-math-abbrev-prefix "ç") ; Set "ç" as new prefix
(define-key LaTeX-math-mode-map
(LaTeX-math-abbrev-prefix) LaTeX-math-keymap)) ; Bind "ç"
Finally we close the src_emacs-lisp[:eval no :tangle no :exports code]{after! latex} block:
)
(after! conda
(setq conda-anaconda-home "~/.conda"))
;; (after! python
;; (setq python-shell-interpreter "ipython"))
(after! hideshow
(add-to-list 'hs-special-modes-alist
'(conf-mode "{{{" "}}}" "\"")))
I run emacs-pgtk, which doesn’t recognise some dead keys by default. Fortunately, we can fix that by running:
(when (eq window-system 'pgtk)
(pgtk-use-im-context t))
(after! ess-r-mode
(appendq! +pretty-code-symbols
'(:assign "⟵"
:multiply "×"))
(set-pretty-symbols! 'ess-r-mode
;; Functional
:def "function"
;; Types
:null "NULL"
:true "TRUE"
:false "FALSE"
:int "int"
:float "float"
:bool "bool"
;; Flow
:not "!"
:and "&&" :or "||"
:for "for"
:in "%in%"
:return "return"
;; Other
:assign "<-"
:multiply "%*%"))
(after! mu4e
(setq mu4e-view-use-gnus t)
;; Each path is relative to `+mu4e-mu4e-mail-path', which is ~/.mail by default
(set-email-account! "GMail"
'((mu4e-sent-folder . "/gmail/[Gmail]/Enviados")
(mu4e-drafts-folder . "/gmail/[Gmail]/Borradores")
(mu4e-trash-folder . "/gmail/[Gmail]/Papelera")
(mu4e-refile-folder . "/gmail/[Gmail]/Todos")
(smtpmail-smtp-user . "ruizh.cj@gmail.com")
(mu4e-compose-signature . "--\nCarlos José Ruiz-Henestrosa Ruiz")) t))
(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.
'(safe-local-variable-values '((TeX-engine . xelatex))))
(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.
)