2023-11-06 07:11:31 +00:00
|
|
|
#+TITLE: Emacs Config
|
|
|
|
#+AUTHOR: Evie Litherland-Smith
|
|
|
|
#+EMAIL: evie@xenia.me.uk
|
|
|
|
#+FILETAGS: :emacs:config:org:
|
2023-11-06 12:38:43 +00:00
|
|
|
#+PROPERTY: header-args:emacs-lisp :tangle yes :mkdirp yes :results output silent
|
2023-11-06 07:11:31 +00:00
|
|
|
|
2023-11-06 11:53:18 +00:00
|
|
|
* Common defaults
|
2023-11-06 12:09:47 +00:00
|
|
|
#+BEGIN_SRC emacs-lisp :results output silent
|
2023-11-07 06:26:37 +00:00
|
|
|
(setq custom-file (locate-user-emacs-file "custom.el"))
|
|
|
|
(when (and custom-file (file-exists-p custom-file))
|
|
|
|
(load custom-file nil 'nomessage))
|
|
|
|
|
2023-11-06 12:09:47 +00:00
|
|
|
(setq user-full-name "Evie Litherland-Smith"
|
2023-11-06 12:18:59 +00:00
|
|
|
user-mail-address "evie@xenia.me.uk"
|
2023-11-07 06:26:37 +00:00
|
|
|
use-short-answers t
|
2023-11-06 12:18:59 +00:00
|
|
|
load-prefer-newer t
|
|
|
|
indent-tabs-mode nil
|
2023-11-15 09:47:27 +00:00
|
|
|
even-window-sizes nil
|
2023-11-06 12:18:59 +00:00
|
|
|
global-auto-revert-non-file-buffers t
|
|
|
|
dired-auto-revert-buffer t
|
|
|
|
dired-dwim-target t
|
2023-11-30 04:48:36 +00:00
|
|
|
fill-column 79
|
2023-11-06 12:18:59 +00:00
|
|
|
tab-always-indent 'complete
|
|
|
|
completion-cycle-threshold 3
|
|
|
|
completions-detailed t
|
|
|
|
xref-show-definitions-function #'xref-show-definitions-completing-read
|
|
|
|
kill-do-not-save-duplicates t
|
|
|
|
auto-window-vscroll nil
|
|
|
|
fast-but-imprecise-scrolling t
|
|
|
|
scroll-conservatively 101
|
|
|
|
scroll-margin 0
|
|
|
|
scroll-preserve-screen-position 1)
|
|
|
|
|
2023-11-06 12:09:47 +00:00
|
|
|
(set-default-coding-systems 'utf-8)
|
|
|
|
(set-terminal-coding-system 'utf-8)
|
|
|
|
(set-keyboard-coding-system 'utf-8)
|
2023-11-06 12:18:59 +00:00
|
|
|
|
|
|
|
(global-auto-revert-mode +1)
|
|
|
|
(delete-selection-mode)
|
2023-11-14 07:29:36 +00:00
|
|
|
(recentf-mode -1)
|
2023-11-06 12:18:59 +00:00
|
|
|
|
2023-11-16 12:50:37 +00:00
|
|
|
|
2023-11-06 12:18:59 +00:00
|
|
|
(keymap-global-set "M-#" #'dictionary-lookup-definition)
|
|
|
|
|
|
|
|
;; turn on spell checking, if available.
|
|
|
|
(when (and (require 'ispell nil :noerror) (executable-find ispell-program-name))
|
|
|
|
(add-hook 'text-mode-hook #'flyspell-mode)
|
|
|
|
(add-hook 'prog-mode-hook #'flyspell-prog-mode))
|
|
|
|
|
|
|
|
;; Make shebang (#!) file executable when saved
|
|
|
|
(add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p)
|
2023-11-06 12:09:47 +00:00
|
|
|
#+END_SRC
|
|
|
|
|
2023-11-21 06:55:18 +00:00
|
|
|
** Auto-save file settings
|
2023-11-19 07:53:06 +00:00
|
|
|
#+begin_src emacs-lisp :tangle yes
|
|
|
|
(setq backup-directory-alist '(("." . "~/.local/state/emacs/backups"))
|
2023-11-19 09:34:23 +00:00
|
|
|
tramp-backup-directory-alist backup-directory-alist
|
2023-11-21 06:55:18 +00:00
|
|
|
tramp-auto-save-directory (cdr (assoc "." tramp-backup-directory-alist)))
|
2023-11-19 07:53:06 +00:00
|
|
|
#+end_src
|
2023-11-06 12:09:47 +00:00
|
|
|
** package-archive with priorities
|
|
|
|
#+begin_src emacs-lisp :results output silent
|
|
|
|
(when (require 'package nil :noerror)
|
|
|
|
(add-to-list 'package-archives '("stable" . "https://stable.melpa.org/packages/"))
|
|
|
|
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
|
|
|
|
|
|
|
|
(setq package-archive-priorities '(("gnu" . 99)
|
|
|
|
("nongnu" . 80)
|
|
|
|
("stable" . 70)
|
|
|
|
("melpa" . 0))))
|
|
|
|
#+end_src
|
|
|
|
|
2023-11-07 06:26:37 +00:00
|
|
|
** Authentication
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(when (require 'auth-source nil :noerror)
|
|
|
|
(setq auth-sources '("secrets:Login"))
|
2023-11-08 06:27:32 +00:00
|
|
|
(when (require 'auth-source-pass nil :noerror)
|
|
|
|
(auth-source-pass-enable)))
|
2023-11-07 06:26:37 +00:00
|
|
|
#+end_src
|
2023-11-08 06:27:32 +00:00
|
|
|
|
|
|
|
** Helpful
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
;; Make `describe-*' screens more helpful
|
|
|
|
(use-package helpful
|
|
|
|
:ensure t
|
|
|
|
:bind (("<remap> <describe-command>" . helpful-command)
|
|
|
|
("<remap> <describe-function>" . helpful-callable)
|
|
|
|
("<remap> <describe-key>" . helpful-key)
|
|
|
|
("<remap> <describe-symbol>" . helpful-symbol)
|
|
|
|
("<remap> <describe-variable>" . helpful-variable)
|
|
|
|
("C-h F" . helpful-function)
|
|
|
|
:map helpful-mode-map
|
|
|
|
("<remap> <revert-buffer>" . helpful-update)))
|
|
|
|
|
|
|
|
;; Bind extra `describe-*' commands
|
|
|
|
(keymap-global-set "C-h K" #'describe-keymap)
|
|
|
|
#+end_src
|
|
|
|
|
2023-11-16 12:50:37 +00:00
|
|
|
** ibuffer
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package ibuffer
|
|
|
|
:ensure t
|
|
|
|
:bind (("C-c b" . ibuffer)))
|
|
|
|
|
|
|
|
(use-package ibuffer-project
|
|
|
|
:ensure t
|
|
|
|
:after ibuffer
|
|
|
|
:hook ((ibuffer . (lambda ()
|
|
|
|
(setq ibuffer-filter-groups (ibuffer-project-generate-filter-groups))
|
|
|
|
(unless (eq ibuffer-sorting-mode 'project-file-relative)
|
|
|
|
(ibuffer-do-sort-by-project-file-relative))))))
|
|
|
|
#+end_src
|
|
|
|
|
2023-11-08 06:56:46 +00:00
|
|
|
** Link hint keymaps
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package link-hint
|
|
|
|
:ensure t
|
|
|
|
:bind (("C-c l o" . link-hint-open-link)
|
|
|
|
("C-c l c" . link-hint-copy-link)
|
|
|
|
("C-c l C-o" . link-hint-open-all-link)
|
|
|
|
("C-c l C-c" . link-hint-copy-all-link)))
|
|
|
|
#+end_src
|
2023-11-12 19:40:21 +00:00
|
|
|
|
|
|
|
** Avy keymaps
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package avy
|
|
|
|
:ensure t
|
|
|
|
:bind (("C-c j w" . avy-goto-word-0)
|
|
|
|
("C-c j c" . avy-goto-char)
|
|
|
|
("C-c j l" . avy-goto-line)))
|
|
|
|
#+end_src
|
2023-11-07 06:26:37 +00:00
|
|
|
* UI
|
2023-11-08 06:27:32 +00:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(setq use-dialog-box nil
|
|
|
|
fill-column 80
|
|
|
|
truncate-lines nil
|
|
|
|
truncate-partial-width-windows nil)
|
|
|
|
|
|
|
|
(menu-bar-mode -1)
|
|
|
|
(tool-bar-mode -1)
|
|
|
|
(scroll-bar-mode -1)
|
2023-11-15 09:47:27 +00:00
|
|
|
(tab-bar-mode -1)
|
2023-11-08 06:27:32 +00:00
|
|
|
(global-display-line-numbers-mode -1)
|
|
|
|
(global-prettify-symbols-mode +1)
|
|
|
|
(global-visual-line-mode +1)
|
|
|
|
|
|
|
|
(use-package which-key
|
|
|
|
:ensure t
|
|
|
|
:config (which-key-mode +1))
|
|
|
|
|
|
|
|
(use-package page-break-lines
|
|
|
|
:ensure t
|
|
|
|
:config (global-page-break-lines-mode +1))
|
|
|
|
|
|
|
|
;; add visual pulse when changing focus, like beacon but built-in
|
|
|
|
;; from from https://karthinks.com/software/batteries-included-with-emacs/
|
|
|
|
(defun pulse-line (&rest _)
|
|
|
|
"Pulse the current line."
|
|
|
|
(pulse-momentary-highlight-one-line (point)))
|
|
|
|
|
|
|
|
(dolist (command '(scroll-up-command
|
|
|
|
scroll-down-command
|
|
|
|
recenter-top-bottom
|
|
|
|
other-window))
|
|
|
|
(advice-add command :after #'pulse-line))
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** Theme, font and nerd-icons
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(set-frame-parameter nil 'alpha-background 80)
|
2023-11-10 11:35:05 +00:00
|
|
|
(set-frame-font "Fira Code-12")
|
2023-11-08 06:27:32 +00:00
|
|
|
|
|
|
|
;; Theme
|
|
|
|
(use-package modus-themes
|
|
|
|
:ensure t
|
2023-11-29 16:23:33 +00:00
|
|
|
:custom (modus-themes-disable-other-themes t)
|
|
|
|
:config (modus-themes-load-theme 'modus-vivendi-tinted))
|
2023-11-08 06:27:32 +00:00
|
|
|
|
|
|
|
;; Nerd-Icons modes
|
|
|
|
(use-package nerd-icons
|
|
|
|
:ensure t
|
|
|
|
:config (nerd-icons-set-font "Symbols Nerd Font Mono"))
|
|
|
|
|
|
|
|
(use-package nerd-icons-dired
|
|
|
|
:ensure t
|
|
|
|
:hook (dired-mode))
|
|
|
|
|
|
|
|
(use-package nerd-icons-ibuffer
|
|
|
|
:ensure t
|
|
|
|
:hook (ibuffer-mode))
|
|
|
|
|
|
|
|
(use-package nerd-icons-completion
|
|
|
|
:ensure t
|
|
|
|
:config (nerd-icons-completion-mode +1))
|
2023-11-12 13:24:09 +00:00
|
|
|
|
2023-11-14 17:23:49 +00:00
|
|
|
(use-package nerd-icons-corfu
|
|
|
|
:ensure t
|
|
|
|
:after corfu
|
|
|
|
:config (add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter))
|
|
|
|
|
2023-11-12 13:24:09 +00:00
|
|
|
(keymap-global-set "C-c i n" #'nerd-icons-insert)
|
2023-11-08 06:27:32 +00:00
|
|
|
#+end_src
|
2023-11-07 06:26:37 +00:00
|
|
|
|
2023-11-19 06:01:43 +00:00
|
|
|
** Window management
|
|
|
|
|
|
|
|
*** winner
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package winner
|
2023-11-27 15:19:26 +00:00
|
|
|
:ensure t
|
|
|
|
:demand
|
2023-11-29 11:21:24 +00:00
|
|
|
:bind (("C-c w u" . winner-undo)
|
2023-11-27 15:19:26 +00:00
|
|
|
("C-c w r" . winner-redo))
|
2023-11-19 06:01:43 +00:00
|
|
|
:config
|
|
|
|
(winner-mode))
|
|
|
|
#+end_src
|
|
|
|
|
2023-11-07 06:26:37 +00:00
|
|
|
** Font ligatures
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package ligature
|
|
|
|
:ensure t
|
|
|
|
:config
|
|
|
|
;; Enable the "www" ligature in every possible major mode
|
|
|
|
(ligature-set-ligatures 't '("www"))
|
|
|
|
;; Enable traditional ligature support in eww-mode, if the
|
|
|
|
;; `variable-pitch' face supports it
|
|
|
|
(ligature-set-ligatures 'eww-mode '("ff" "fi" "ffi"))
|
|
|
|
;; Enable all Cascadia and Fira Code ligatures in programming modes
|
2023-11-21 06:26:05 +00:00
|
|
|
(ligature-set-ligatures '(prog-mode org-mode)
|
2023-11-07 06:26:37 +00:00
|
|
|
'(;; == === ==== => =| =>>=>=|=>==>> ==< =/=//=// =~
|
|
|
|
;; =:= =!=
|
|
|
|
("=" (rx (+ (or ">" "<" "|" "/" "~" ":" "!" "="))))
|
|
|
|
;; ;; ;;;
|
|
|
|
(";" (rx (+ ";")))
|
|
|
|
;; && &&&
|
|
|
|
("&" (rx (+ "&")))
|
|
|
|
;; !! !!! !. !: !!. != !== !~
|
|
|
|
("!" (rx (+ (or "=" "!" "\." ":" "~"))))
|
|
|
|
;; ?? ??? ?: ?= ?.
|
|
|
|
("?" (rx (or ":" "=" "\." (+ "?"))))
|
|
|
|
;; %% %%%
|
|
|
|
("%" (rx (+ "%")))
|
|
|
|
;; |> ||> |||> ||||> |] |} || ||| |-> ||-||
|
|
|
|
;; |->>-||-<<-| |- |== ||=||
|
|
|
|
;; |==>>==<<==<=>==//==/=!==:===>
|
|
|
|
("|" (rx (+ (or ">" "<" "|" "/" ":" "!" "}" "\]"
|
|
|
|
"-" "=" ))))
|
|
|
|
;; \\ \\\ \/
|
|
|
|
("\\" (rx (or "/" (+ "\\"))))
|
|
|
|
;; ++ +++ ++++ +>
|
|
|
|
("+" (rx (or ">" (+ "+"))))
|
|
|
|
;; :: ::: :::: :> :< := :// ::=
|
|
|
|
(":" (rx (or ">" "<" "=" "//" ":=" (+ ":"))))
|
|
|
|
;; // /// //// /\ /* /> /===:===!=//===>>==>==/
|
|
|
|
("/" (rx (+ (or ">" "<" "|" "/" "\\" "\*" ":" "!"
|
|
|
|
"="))))
|
|
|
|
;; .. ... .... .= .- .? ..= ..<
|
2023-11-21 10:40:50 +00:00
|
|
|
;; ("\." (rx (or "=" "-" "\?" "\.=" "\.<" (+ "\."))))
|
2023-11-07 06:26:37 +00:00
|
|
|
;; -- --- ---- -~ -> ->> -| -|->-->>->--<<-|
|
|
|
|
("-" (rx (+ (or ">" "<" "|" "~" "-"))))
|
|
|
|
;; *> */ *) ** *** ****
|
|
|
|
("*" (rx (or ">" "/" ")" (+ "*"))))
|
|
|
|
;; www wwww
|
|
|
|
("w" (rx (+ "w")))
|
|
|
|
;; <> <!-- <|> <: <~ <~> <~~ <+ <* <$ </ <+> <*>
|
|
|
|
;; <$> </> <| <|| <||| <|||| <- <-| <-<<-|-> <->>
|
|
|
|
;; <<-> <= <=> <<==<<==>=|=>==/==//=!==:=>
|
|
|
|
;; << <<< <<<<
|
|
|
|
("<" (rx (+ (or "\+" "\*" "\$" "<" ">" ":" "~" "!"
|
|
|
|
"-" "/" "|" "="))))
|
|
|
|
;; >: >- >>- >--|-> >>-|-> >= >== >>== >=|=:=>>
|
|
|
|
;; >> >>> >>>>
|
|
|
|
(">" (rx (+ (or ">" "<" "|" "/" ":" "=" "-"))))
|
|
|
|
;; #: #= #! #( #? #[ #{ #_ #_( ## ### #####
|
|
|
|
("#" (rx (or ":" "=" "!" "(" "\?" "\[" "{" "_(" "_"
|
|
|
|
(+ "#"))))
|
|
|
|
;; ~~ ~~~ ~= ~- ~@ ~> ~~>
|
|
|
|
("~" (rx (or ">" "=" "-" "@" "~>" (+ "~"))))
|
|
|
|
;; __ ___ ____ _|_ __|____|_
|
|
|
|
("_" (rx (+ (or "_" "|"))))
|
|
|
|
;; The few not covered by the regexps.
|
|
|
|
"{|" "[|" "]#" "(*" "}#" "$>" "^="))
|
2023-11-21 06:55:18 +00:00
|
|
|
(ligature-set-ligatures 'prog-mode
|
|
|
|
'(;; Fira code: 0xFF 0x12
|
|
|
|
("0" (rx (and "x" (+ (in "A-F" "a-f" "0-9")))))
|
|
|
|
;; Fira code:
|
|
|
|
"Fl" "Tl" "fi" "fj" "fl" "ft"))
|
2023-11-07 06:26:37 +00:00
|
|
|
;; Enables ligature checks globally in all buffers. You can also do it
|
|
|
|
;; per mode with `ligature-mode'.
|
|
|
|
(global-ligature-mode t))
|
|
|
|
#+end_src
|
2023-11-08 06:27:32 +00:00
|
|
|
|
|
|
|
** Modeline
|
|
|
|
#+begin_src emacs-lisp
|
2023-11-17 14:48:04 +00:00
|
|
|
(line-number-mode +1)
|
|
|
|
(column-number-mode +1)
|
|
|
|
(size-indication-mode +1)
|
|
|
|
(display-time-mode -1)
|
|
|
|
(display-battery-mode -1)
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
*** Doom Modeline
|
2023-11-21 06:26:05 +00:00
|
|
|
#+begin_src emacs-lisp :tangle yes
|
2023-11-08 06:27:32 +00:00
|
|
|
(use-package doom-modeline
|
|
|
|
:ensure t
|
2023-11-19 09:34:23 +00:00
|
|
|
:custom
|
|
|
|
(doom-modeline-icon t)
|
|
|
|
(doom-modeline-buffer-encoding 'nondefault)
|
|
|
|
(doom-modeline-enable-word-count t)
|
|
|
|
(doom-modeline-continuous-word-count-modes
|
|
|
|
'(org-mode markdown-mode gfm-mode))
|
2023-11-16 06:17:49 +00:00
|
|
|
:config
|
2023-11-17 07:12:59 +00:00
|
|
|
(doom-modeline-mode +1))
|
2023-11-08 06:27:32 +00:00
|
|
|
#+end_src
|
|
|
|
|
2023-11-13 14:41:28 +00:00
|
|
|
** Darkroom
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package darkroom
|
|
|
|
:ensure t
|
|
|
|
:bind (("C-c d" . darkroom-mode)))
|
|
|
|
#+end_src
|
2023-11-15 09:47:27 +00:00
|
|
|
|
2023-11-06 11:53:18 +00:00
|
|
|
* Org-mode
|
|
|
|
For reference information, see [[https://orgmode.com][Org-mode website]]
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp :results output silent
|
|
|
|
(setq org-directory "~/Org"
|
|
|
|
org-default-notes-file (expand-file-name "notes.org" org-directory)
|
|
|
|
org-pretty-entities-include-sub-superscripts t
|
|
|
|
org-pretty-entities-include-sub-superscripts t
|
|
|
|
org-tags-column 0
|
|
|
|
org-outline-path-complete-in-steps nil
|
2023-11-13 08:22:37 +00:00
|
|
|
org-return-follows-link t
|
|
|
|
org-mouse-1-follows-link t
|
|
|
|
org-link-descriptive t
|
2023-11-06 11:53:18 +00:00
|
|
|
org-refile-use-outline-path t
|
|
|
|
org-refile-allow-creating-parent-nodes t
|
|
|
|
org-refile-use-outline-path 'file
|
|
|
|
org-refile-targets '((nil :maxlevel . 3)
|
|
|
|
(org-agenda-files :maxlevel . 3)))
|
2023-11-13 08:22:37 +00:00
|
|
|
|
|
|
|
;; Visually indent org-mode files to a given header level
|
|
|
|
(add-hook 'org-mode-hook #'org-indent-mode)
|
2023-11-27 15:19:26 +00:00
|
|
|
|
|
|
|
(use-package org
|
|
|
|
:ensure t
|
|
|
|
:custom
|
|
|
|
(org-babel-load-languages '((emacs-lisp . t)
|
|
|
|
(python . t))))
|
2023-11-06 11:53:18 +00:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Keymaps
|
|
|
|
#+begin_src emacs-lisp :results output silent
|
2023-11-28 10:45:14 +00:00
|
|
|
(keymap-global-set "C-c o ." #'calendar)
|
2023-11-08 06:32:27 +00:00
|
|
|
(keymap-global-set "C-c o e" #'org-edit-src-code)
|
2023-11-06 11:53:18 +00:00
|
|
|
(keymap-global-set "C-c o a" #'org-agenda)
|
|
|
|
(keymap-global-set "C-c o n" #'org-capture)
|
|
|
|
(keymap-global-set "C-c o l" #'org-capture-goto-last-stored)
|
|
|
|
|
2023-11-10 07:21:46 +00:00
|
|
|
(use-package org-modern
|
|
|
|
:ensure t
|
|
|
|
:hook ((org-mode . org-modern-mode)
|
2023-11-19 09:34:23 +00:00
|
|
|
(org-agenda-finalize . org-modern-agenda))
|
|
|
|
:custom
|
|
|
|
(org-modern-tag nil))
|
2023-11-06 11:53:18 +00:00
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** org-agenda
|
|
|
|
#+begin_src emacs-lisp :results output silent
|
2023-11-09 07:17:55 +00:00
|
|
|
(setq org-agenda-span 'week
|
|
|
|
org-agenda-start-on-weekday 1
|
|
|
|
org-agenda-files (list (expand-file-name org-directory)
|
2023-11-06 11:53:18 +00:00
|
|
|
(expand-file-name "journal" org-directory)
|
|
|
|
(expand-file-name "projects" org-directory))
|
2023-11-09 07:17:55 +00:00
|
|
|
org-agenda-sticky t
|
2023-11-06 11:53:18 +00:00
|
|
|
org-agenda-window-setup 'current-window
|
|
|
|
org-agenda-prefix-format '((agenda . " %-12:c%?-12t% s")
|
|
|
|
(todo . " %-12:c")
|
|
|
|
(tags . " %-12:c")
|
|
|
|
(search . " %-12:c")))
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** org-journal
|
|
|
|
#+BEGIN_SRC emacs-lisp :results output silent
|
2023-11-19 09:34:23 +00:00
|
|
|
(use-package org-journal
|
|
|
|
:bind (("C-c o j" . org-journal-new-entry))
|
|
|
|
:custom
|
|
|
|
(org-journal-dir (expand-file-name "journal" org-directory))
|
|
|
|
(org-journal-file-type 'monthly)
|
|
|
|
(org-journal-file-format "%Y-%m.org"))
|
2023-11-06 11:53:18 +00:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Capture templates
|
|
|
|
#+BEGIN_SRC emacs-lisp :results output silent
|
|
|
|
(setq org-capture-templates
|
|
|
|
'(("n" "Note" entry
|
|
|
|
(file+headline "inbox.org" "Note")
|
|
|
|
"* %?"
|
|
|
|
:prepend t
|
|
|
|
:empty-lines 1)
|
|
|
|
("t" "Task" entry
|
|
|
|
(file+headline "inbox.org" "Task")
|
|
|
|
"* TODO %?"
|
|
|
|
:prepend t
|
|
|
|
:empty-lines 1)
|
2023-11-06 12:38:43 +00:00
|
|
|
("m" "Email Workflow")
|
|
|
|
("mf" "Follow Up" entry (file+olp "mail.org" "Follow Up")
|
|
|
|
"* TODO Follow up with %:fromname on %a\nSCHEDULED:%t\nDEADLINE: %(org-insert-time-stamp (org-read-date nil t \"+2d\"))\n\n%i")
|
|
|
|
("mr" "Read Later" entry (file+olp "mail.org" "Read Later")
|
|
|
|
"* TODO Read %:subject\nSCHEDULED:%t\nDEADLINE: %(org-insert-time-stamp (org-read-date nil t \"+2d\"))\n\n%a\n\n%i")
|
2023-11-06 11:53:18 +00:00
|
|
|
))
|
|
|
|
#+END_SRC
|
|
|
|
|
2023-11-22 06:30:54 +00:00
|
|
|
** TODO Citar
|
2023-11-06 11:53:18 +00:00
|
|
|
#+begin_src emacs-lisp :results output silent
|
2023-11-13 16:19:05 +00:00
|
|
|
(let ((citar-base-directory "~/References"))
|
2023-11-22 06:30:54 +00:00
|
|
|
(setq citar-bibliography (expand-file-name "main.bib" citar-base-directory)
|
|
|
|
citar-library-paths (list (expand-file-name "library" citar-base-directory))
|
|
|
|
citar-notes-paths (list (expand-file-name "notes" citar-base-directory))))
|
|
|
|
(use-package citar
|
|
|
|
:ensure t
|
|
|
|
:bind (("C-c o c o" . citar-open))
|
|
|
|
:config
|
|
|
|
(defvar citar-indicator-files-icons
|
|
|
|
(citar-indicator-create
|
|
|
|
:symbol (nerd-icons-octicon
|
|
|
|
"nf-oct-file"
|
|
|
|
:face 'nerd-icons-green
|
|
|
|
:v-adjust -0.1)
|
|
|
|
:function #'citar-has-files
|
|
|
|
:padding " " ; need this because the default padding is too low for these icons
|
|
|
|
:tag "has:files"))
|
|
|
|
(defvar citar-indicator-links-icons
|
|
|
|
(citar-indicator-create
|
|
|
|
:symbol (nerd-icons-octicon
|
|
|
|
"nf-oct-link"
|
|
|
|
:face 'nerd-icons-orange
|
|
|
|
:v-adjust 0.01)
|
|
|
|
:function #'citar-has-links
|
|
|
|
:padding " "
|
|
|
|
:tag "has:links"))
|
|
|
|
(defvar citar-indicator-notes-icons
|
|
|
|
(citar-indicator-create
|
|
|
|
:symbol (nerd-icons-octicon
|
|
|
|
"nf-oct-note"
|
|
|
|
:face 'nerd-icons-blue
|
|
|
|
:v-adjust -0.3)
|
|
|
|
:function #'citar-has-notes
|
|
|
|
:padding " "
|
|
|
|
:tag "has:notes"))
|
|
|
|
(defvar citar-indicator-cited-icons
|
|
|
|
(citar-indicator-create
|
|
|
|
:symbol (nerd-icons-octicon
|
|
|
|
"nf-oct-circle"
|
|
|
|
:face 'nerd-icon-green)
|
|
|
|
:function #'citar-is-cited
|
|
|
|
:padding " "
|
|
|
|
:tag "is:cited"))
|
|
|
|
(setq citar-indicators (list citar-indicator-files-icons
|
|
|
|
citar-indicator-links-icons
|
|
|
|
citar-indicator-notes-icons
|
|
|
|
citar-indicator-cited-icons)))
|
2023-11-06 11:53:18 +00:00
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** Khalel
|
|
|
|
#+begin_src emacs-lisp :results output silent
|
2023-11-19 09:34:23 +00:00
|
|
|
(use-package khalel
|
2023-11-28 07:09:14 +00:00
|
|
|
:demand
|
2023-11-19 09:34:23 +00:00
|
|
|
:hook (org-agenda-mode . khalel-import-events)
|
|
|
|
:config
|
|
|
|
(khalel-add-capture-template "e")
|
|
|
|
:custom
|
|
|
|
(khalel-import-org-file (expand-file-name "calendar.org" org-directory))
|
|
|
|
(khalel-import-org-file-read-only nil)
|
|
|
|
(khalel-import-org-file-confirm-overwrite nil)
|
|
|
|
(khalel-import-start-date "-30d")
|
|
|
|
(khalel-import-end-date "+30d"))
|
2023-11-06 11:53:18 +00:00
|
|
|
#+end_src
|
2023-11-09 08:10:57 +00:00
|
|
|
** TODO Crafted config
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
2023-11-13 08:22:37 +00:00
|
|
|
|
2023-11-09 08:10:57 +00:00
|
|
|
|
|
|
|
;; Disable auto-pairing of "<" in org-mode with electric-pair-mode
|
|
|
|
(defun crafted-org-enhance-electric-pair-inhibit-predicate ()
|
|
|
|
"Disable auto-pairing of \"<\" in `org-mode' when using `electric-pair-mode'."
|
|
|
|
(when (and electric-pair-mode (eql major-mode #'org-mode))
|
|
|
|
(setq-local electric-pair-inhibit-predicate
|
|
|
|
`(lambda (c)
|
|
|
|
(if (char-equal c ?<)
|
|
|
|
t
|
|
|
|
(,electric-pair-inhibit-predicate c))))))
|
|
|
|
|
|
|
|
;; Add hook to both electric-pair-mode-hook and org-mode-hook
|
|
|
|
;; This ensures org-mode buffers don't behave weirdly,
|
|
|
|
;; no matter when electric-pair-mode is activated.
|
|
|
|
(add-hook 'electric-pair-mode-hook #'crafted-org-enhance-electric-pair-inhibit-predicate)
|
|
|
|
(add-hook 'org-mode-hook #'crafted-org-enhance-electric-pair-inhibit-predicate)
|
|
|
|
#+END_SRC
|
|
|
|
|
2023-11-29 14:16:16 +00:00
|
|
|
* Remote Editing
|
|
|
|
|
|
|
|
** TRAMP
|
|
|
|
#+begin_src emacs-lisp :tangle yes
|
|
|
|
(use-package tramp
|
|
|
|
:defer t
|
|
|
|
:config
|
|
|
|
(add-to-list 'tramp-remote-path 'tramp-own-remote-path))
|
|
|
|
#+end_src
|
2023-11-08 06:56:46 +00:00
|
|
|
* Development Environment
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package rainbow-delimiters
|
|
|
|
:ensure t
|
|
|
|
:hook (prog-mode))
|
|
|
|
|
|
|
|
(use-package apheleia
|
|
|
|
:ensure t
|
|
|
|
:defer nil
|
|
|
|
:bind (("C-c c f" . apheleia-format-buffer))
|
2023-11-19 09:34:23 +00:00
|
|
|
:custom (apheleia-remote-algorithm 'local)
|
2023-11-08 06:56:46 +00:00
|
|
|
:config (apheleia-global-mode +1))
|
|
|
|
|
|
|
|
(use-package treesit-auto
|
|
|
|
:config (global-treesit-auto-mode +1))
|
|
|
|
|
|
|
|
(use-package direnv
|
2023-11-10 07:21:46 +00:00
|
|
|
:ensure t
|
2023-11-19 09:34:23 +00:00
|
|
|
:custom (direnv-always-show-summary nil)
|
2023-11-08 06:56:46 +00:00
|
|
|
:config (direnv-mode +1))
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Eglot LSP
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
2023-11-19 09:34:23 +00:00
|
|
|
(use-package eglot
|
|
|
|
:ensure t
|
2023-11-29 16:48:37 +00:00
|
|
|
:bind (("C-c c e" . eglot)
|
|
|
|
("C-c c a" . eglot-code-actions))
|
2023-11-28 14:45:07 +00:00
|
|
|
:hook ((nix-mode
|
|
|
|
fortran-mode
|
|
|
|
shell-script-mode
|
|
|
|
markdown-mode
|
|
|
|
lua-mode
|
|
|
|
python-mode
|
|
|
|
python-ts-mode
|
|
|
|
rust-mode
|
|
|
|
rust-ts-mode) . eglot-ensure)
|
2023-11-19 09:34:23 +00:00
|
|
|
:custom
|
|
|
|
(eglot-extend-to-xref t)
|
|
|
|
(eglot-autoshutdown t)
|
|
|
|
(eglot-autoreconnect nil))
|
2023-11-08 17:17:04 +00:00
|
|
|
#+END_SRC
|
2023-11-27 15:24:47 +00:00
|
|
|
|
|
|
|
** Flymake
|
|
|
|
#+begin_src emacs-lisp :tangle yes
|
|
|
|
(use-package flymake
|
|
|
|
:ensure t
|
|
|
|
:bind (("C-c C-." . flymake-goto-next-error)
|
|
|
|
("C-c C-," . flymake-goto-prev-error)))
|
|
|
|
#+end_src
|
2023-11-09 07:41:26 +00:00
|
|
|
** Project
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(setq project-switch-use-entire-map t
|
2023-11-23 08:19:40 +00:00
|
|
|
project-switch-commands 'project-dired)
|
2023-11-09 07:41:26 +00:00
|
|
|
#+END_SRC
|
|
|
|
** Version control
|
2023-11-15 09:50:48 +00:00
|
|
|
*** Magit
|
2023-11-09 07:41:26 +00:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package magit
|
2023-11-15 17:17:56 +00:00
|
|
|
:ensure t
|
2023-11-17 07:29:22 +00:00
|
|
|
:bind (("C-c g g" . magit-status)
|
2023-11-15 17:17:56 +00:00
|
|
|
("C-c g d" . magit-dispatch)
|
|
|
|
("C-c g f" . magit-file-dispatch)
|
|
|
|
("C-c g p" . magit-pull)
|
|
|
|
("C-c g P" . magit-push)
|
|
|
|
("<remap> <project-vc-dir" . magit-project-status)
|
|
|
|
:map project-prefix-map
|
|
|
|
("m" . magit-project-status))
|
2023-11-19 09:34:23 +00:00
|
|
|
:custom
|
|
|
|
(magit-define-global-key-bindings nil)
|
|
|
|
(magit-clone-default-directory "~/Projects/")
|
|
|
|
(magit-commit-show-diff nil)
|
2023-11-25 17:25:04 +00:00
|
|
|
(magit-commit-diff-inhibit-same-window t))
|
2023-11-09 07:41:26 +00:00
|
|
|
#+end_src
|
2023-11-13 08:22:37 +00:00
|
|
|
** Completion
|
|
|
|
*** Vertico
|
2023-11-09 08:10:57 +00:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package vertico
|
|
|
|
:ensure t
|
2023-11-19 09:34:23 +00:00
|
|
|
:custom
|
|
|
|
(vertico-cycle t)
|
2023-11-09 08:10:57 +00:00
|
|
|
:config
|
|
|
|
(require 'vertico-directory)
|
|
|
|
(vertico-mode +1))
|
|
|
|
#+end_src
|
2023-11-06 07:11:31 +00:00
|
|
|
|
2023-11-13 08:22:37 +00:00
|
|
|
*** Marginalia
|
2023-11-09 08:10:57 +00:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package marginalia
|
|
|
|
:ensure t
|
2023-11-19 09:34:23 +00:00
|
|
|
:custom
|
|
|
|
(marginalia-annotators '(marginalia-annotators-heavy
|
|
|
|
marginalia-annotators-light
|
|
|
|
nil))
|
2023-11-09 08:10:57 +00:00
|
|
|
:config (marginalia-mode +1))
|
|
|
|
#+end_src
|
2023-11-06 07:11:31 +00:00
|
|
|
|
2023-11-13 08:22:37 +00:00
|
|
|
*** Orderless
|
2023-11-09 08:10:57 +00:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package orderless
|
|
|
|
:ensure t
|
2023-11-19 09:34:23 +00:00
|
|
|
:custom
|
|
|
|
(completion-styles '(orderless basic))
|
|
|
|
(completion-category-defaults nil)
|
|
|
|
(completion-category-overrides '((file (styles . (partial-completion))))))
|
2023-11-09 08:10:57 +00:00
|
|
|
#+end_src
|
2023-11-06 07:11:31 +00:00
|
|
|
|
2023-11-13 08:22:37 +00:00
|
|
|
*** Corfu and Cape
|
2023-11-09 08:10:57 +00:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package corfu
|
|
|
|
:ensure t
|
2023-11-19 09:34:23 +00:00
|
|
|
:custom
|
|
|
|
(corfu-cycle t)
|
|
|
|
(corfu-auto t)
|
|
|
|
(corfu-auto-prefix 3)
|
2023-11-09 08:10:57 +00:00
|
|
|
:config
|
|
|
|
(global-corfu-mode +1)
|
2023-11-06 07:11:31 +00:00
|
|
|
(when (require 'corfu-popupinfo nil :noerror)
|
|
|
|
(corfu-popupinfo-mode 1)
|
|
|
|
(eldoc-add-command #'corfu-insert)
|
|
|
|
(keymap-set corfu-map "M-p" #'corfu-popupinfo-scroll-down)
|
|
|
|
(keymap-set corfu-map "M-n" #'corfu-popupinfo-scroll-up)
|
2023-11-14 15:21:34 +00:00
|
|
|
(keymap-set corfu-map "M-d" #'corfu-popupinfo-toggle))
|
|
|
|
(defun crafted-completion-corfu-eshell ()
|
|
|
|
"Special settings for when using corfu with eshell."
|
|
|
|
(setq-local corfu-quit-at-boundary t
|
|
|
|
corfu-quit-no-match t
|
|
|
|
corfu-auto nil)
|
|
|
|
(corfu-mode))
|
|
|
|
(add-hook 'eshell-mode-hook #'crafted-completion-corfu-eshell))
|
2023-11-06 07:11:31 +00:00
|
|
|
|
2023-11-09 08:10:57 +00:00
|
|
|
(use-package cape
|
|
|
|
:ensure t
|
|
|
|
:config
|
2023-11-06 07:11:31 +00:00
|
|
|
(add-to-list 'completion-at-point-functions #'cape-file)
|
|
|
|
(add-to-list 'completion-at-point-functions #'cape-dabbrev)
|
|
|
|
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent)
|
2023-11-14 15:21:34 +00:00
|
|
|
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify))
|
2023-11-09 08:10:57 +00:00
|
|
|
#+end_src
|
|
|
|
|
2023-11-13 08:22:37 +00:00
|
|
|
*** Consult
|
2023-11-09 08:10:57 +00:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package consult
|
|
|
|
:ensure t
|
|
|
|
:bind (("C-s" . consult-line)
|
2023-11-09 11:10:42 +00:00
|
|
|
("<remap> <imenu>" . consult-imenu )
|
|
|
|
("<remap> <switch-to-buffer>" . consult-buffer)
|
|
|
|
("<remap> <project-switch-to-buffer>" . consult-project-buffer)
|
2023-11-10 07:24:53 +00:00
|
|
|
("<remap> <org-goto>" . consult-org-heading)
|
2023-11-09 11:10:42 +00:00
|
|
|
("C-c s f" . consult-fd)
|
|
|
|
("C-c s g" . consult-ripgrep)
|
|
|
|
("C-c s e" . consult-flymake)
|
|
|
|
("C-c s t" . consult-theme)
|
2023-11-09 08:10:57 +00:00
|
|
|
:map minibuffer-local-map
|
2023-11-10 07:24:53 +00:00
|
|
|
("C-r" . consult-history))
|
2023-11-09 08:10:57 +00:00
|
|
|
:config (setq completion-in-region-function #'consult-completion-in-region))
|
2023-11-14 17:23:49 +00:00
|
|
|
|
|
|
|
(use-package consult-yasnippet
|
|
|
|
:ensure t
|
|
|
|
:after consult
|
2023-11-19 09:34:23 +00:00
|
|
|
:commands (consult-yasnippet))
|
|
|
|
|
|
|
|
(use-package consult-eglot
|
|
|
|
:ensure t
|
|
|
|
:after consult
|
|
|
|
:requires eglot
|
|
|
|
:commands (consult-eglot-symbols)
|
|
|
|
:bind (("C-c s s" . consult-eglot-symbols)))
|
2023-11-09 08:10:57 +00:00
|
|
|
#+end_src
|
|
|
|
|
2023-11-13 08:22:37 +00:00
|
|
|
*** Embark
|
2023-11-09 08:10:57 +00:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package embark
|
|
|
|
:ensure t
|
|
|
|
:bind (("<remap> <describe-bindings>" . embark-bindings)
|
|
|
|
("C-." . embark-act))
|
|
|
|
:config (setq prefix-help-command #'embark-prefix-help-command))
|
2023-11-06 07:11:31 +00:00
|
|
|
|
2023-11-09 08:10:57 +00:00
|
|
|
(use-package embark-consult
|
|
|
|
:ensure t
|
|
|
|
:after (embark consult)
|
|
|
|
:hook (embark-collect-mode . consult-preview-at-point-mode))
|
|
|
|
#+end_src
|
2023-11-14 07:29:36 +00:00
|
|
|
** Snippets
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package yasnippet
|
|
|
|
:ensure t
|
|
|
|
:hook ((prog-mode org-mode) . yas-minor-mode))
|
|
|
|
|
|
|
|
(use-package yasnippet-snippets
|
|
|
|
:ensure t
|
|
|
|
:after yasnippet
|
|
|
|
:config (yas-reload-all))
|
|
|
|
|
2023-11-14 15:21:34 +00:00
|
|
|
(use-package yasnippet-capf
|
|
|
|
:ensure t
|
|
|
|
:after cape
|
|
|
|
:config
|
|
|
|
(add-to-list 'completion-at-point-functions #'yasnippet-capf))
|
2023-11-14 07:29:36 +00:00
|
|
|
#+end_src
|
2023-11-17 14:48:04 +00:00
|
|
|
** Aggressive Indent
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package aggressive-indent
|
|
|
|
:ensure t
|
2023-11-28 13:00:09 +00:00
|
|
|
:hook (elisp-mode
|
|
|
|
lisp-mode
|
|
|
|
lisp-data-mode
|
|
|
|
rust-mode))
|
2023-11-17 14:48:04 +00:00
|
|
|
#+end_src
|
|
|
|
|
2023-11-09 08:10:57 +00:00
|
|
|
* Internet
|
2023-11-22 06:30:54 +00:00
|
|
|
|
|
|
|
** TODO Gnus
|
|
|
|
#+begin_src emacs-lisp :tangle yes
|
2023-11-29 11:27:47 +00:00
|
|
|
(setq gnus-select-method '(nnrss "http://www.fsf.org/static/fsforg/rss/news.xml"))
|
2023-11-22 06:30:54 +00:00
|
|
|
#+end_src
|
2023-11-29 11:27:47 +00:00
|
|
|
** Email
|
2023-11-06 07:11:31 +00:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2023-11-09 08:10:57 +00:00
|
|
|
(setq sendmail-program (executable-find "msmtp")
|
|
|
|
send-mail-function #'smtpmail-send-it
|
|
|
|
message-sendmail-f-is-evil t
|
|
|
|
message-sendmail-extra-arguments '("--read-envelope-from")
|
|
|
|
message-send-mail-function #'message-send-mail-with-sendmail
|
2023-11-19 07:53:06 +00:00
|
|
|
message-auto-save-directory nil
|
2023-11-09 08:10:57 +00:00
|
|
|
message-kill-buffer-on-exit t
|
|
|
|
mail-user-agent 'mu4e-user-agent
|
2023-11-28 17:09:47 +00:00
|
|
|
read-mail-command 'mu4e)
|
2023-11-06 07:11:31 +00:00
|
|
|
|
2023-11-09 08:10:57 +00:00
|
|
|
(use-package mu4e
|
2023-11-17 07:29:22 +00:00
|
|
|
:bind (("C-c o m" . mu4e))
|
2023-11-28 16:45:34 +00:00
|
|
|
:custom
|
2023-11-28 17:09:47 +00:00
|
|
|
(mu4e-completing-read-function #'completing-read-default)
|
|
|
|
(mu4e-split-view 'horizontal)
|
|
|
|
(mu4e-attachment-dir "~/Downloads")
|
|
|
|
(mu4e-get-mail-command "mbsync -a")
|
|
|
|
(mu4e-update-interval (* 5 60)) ; Every 5 minutes
|
2023-11-29 11:27:47 +00:00
|
|
|
(mu4e-headers-auto-update nil)
|
2023-11-28 17:09:47 +00:00
|
|
|
(mu4e-sent-messages-behavior 'sent)
|
|
|
|
(mu4e-change-filenames-when-moving t)
|
|
|
|
(mu4e-context-policy 'ask-if-none)
|
|
|
|
(mu4e-compose-context-policy 'ask-if-none)
|
2023-11-29 13:51:08 +00:00
|
|
|
(mu4e-search-full nil)
|
|
|
|
(mu4e-search-include-related t)
|
|
|
|
(mu4e-search-threads t)
|
|
|
|
(mu4e-search-skip-duplicates t)
|
2023-11-28 17:09:47 +00:00
|
|
|
(mu4e-maildir-shortcuts '((:maildir "/Proton/Inbox/" :key ?p)
|
|
|
|
(:maildir "/iCloud/Inbox/" :key ?i)
|
|
|
|
(:maildir "/Outlook/Inbox/" :key ?w)))
|
2023-11-29 13:51:08 +00:00
|
|
|
(mu4e-bookmarks '((:name "Unread messages" :query "flag:unread AND NOT flag:trashed" :key ?u :favorite t)
|
|
|
|
(:name "Today's messages" :query "date:today..now" :key ?t)
|
|
|
|
(:name "Flagged messages" :query "flag:flagged" :key ?f)
|
|
|
|
(:name "Last 7 days" :query "date:7d..now" :hide-unread t :key ?w)))
|
2023-11-28 17:05:24 +00:00
|
|
|
(mu4e-headers-fields
|
|
|
|
'((:human-date . 8)
|
2023-11-29 13:51:08 +00:00
|
|
|
(:from . 30)
|
|
|
|
(:subject . 72)
|
2023-11-28 17:05:24 +00:00
|
|
|
(:flags)))
|
|
|
|
(mu4e-headers-visible-flags
|
|
|
|
'(draft
|
|
|
|
flagged
|
|
|
|
unread
|
|
|
|
passed
|
|
|
|
replied
|
|
|
|
trashed
|
|
|
|
attach
|
|
|
|
calendar
|
|
|
|
encrypted
|
|
|
|
signed
|
|
|
|
list
|
|
|
|
personal))
|
2023-11-17 14:48:04 +00:00
|
|
|
:config
|
2023-11-28 16:45:34 +00:00
|
|
|
(setq
|
2023-11-28 17:05:24 +00:00
|
|
|
mu4e-use-fancy-chars t
|
|
|
|
mu4e-modeline-all-read '("R:" . " ")
|
|
|
|
mu4e-modeline-all-clear '("C:" . " ")
|
|
|
|
mu4e-modeline-new-items '("N:" . " ")
|
|
|
|
mu4e-modeline-unread-items '("U:" . " ")
|
|
|
|
mu4e-search-full-label '("F" . " ")
|
|
|
|
mu4e-search-hide-label '("H" . " ")
|
|
|
|
mu4e-search-related-label '("R" . " ")
|
|
|
|
mu4e-search-skip-duplicates-label '("D" . " ")
|
|
|
|
mu4e-search-threaded-label'("T" . " ")
|
2023-11-28 16:45:34 +00:00
|
|
|
mu4e-headers-draft-mark '("D" . " ")
|
|
|
|
mu4e-headers-flagged-mark '("F" . " ")
|
|
|
|
mu4e-headers-unread-mark '("u" . " ")
|
|
|
|
mu4e-headers-passed-mark '("P" . " ")
|
|
|
|
mu4e-headers-replied-mark '("R" . " ")
|
|
|
|
mu4e-headers-trashed-mark '("T" . " ")
|
|
|
|
mu4e-headers-attach-mark '("a" . " ")
|
|
|
|
mu4e-headers-calendar-mark '("c" . " ")
|
|
|
|
mu4e-headers-encrypted-mark '("x" . " ")
|
|
|
|
mu4e-headers-signed-mark '("s" . " ")
|
|
|
|
mu4e-headers-list-mark '("l" . " ")
|
|
|
|
mu4e-headers-personal-mark '("p" . " ")
|
|
|
|
mu4e-headers-seen-mark '("S" . " ")
|
2023-11-28 17:05:24 +00:00
|
|
|
mu4e-headers-new-mark '("N" . " ")
|
|
|
|
mu4e-headers-from-or-to-prefix '(" " . "To ")
|
|
|
|
mu4e-headers-thread-root-prefix '("* " . "* ")
|
|
|
|
mu4e-headers-thread-duplicate-prefix '("= " . "= ")
|
|
|
|
mu4e-headers-thread-blank-prefix '(" " . " ")
|
|
|
|
mu4e-headers-thread-single-orphan-prefix '("─>" . "─▶")
|
|
|
|
mu4e-headers-thread-orphan-prefix '("┬>" . "┬▶")
|
|
|
|
mu4e-headers-thread-connection-prefix '("│ " . "│ ")
|
|
|
|
mu4e-headers-thread-first-child-prefix '("├>" . "├▶")
|
|
|
|
mu4e-headers-thread-child-prefix '("├>" . "├▶")
|
2023-11-28 17:21:03 +00:00
|
|
|
mu4e-headers-thread-last-child-prefix '("└>" . "╰▶")
|
|
|
|
mu4e-marks '((refile :char
|
|
|
|
("r" . " ")
|
|
|
|
:prompt "refile" :dyn-target
|
|
|
|
(lambda
|
|
|
|
(target msg)
|
|
|
|
(mu4e-get-refile-folder msg))
|
|
|
|
:action
|
|
|
|
(lambda
|
|
|
|
(docid msg target)
|
|
|
|
(mu4e--server-move docid
|
|
|
|
(mu4e--mark-check-target target)
|
|
|
|
"-N")))
|
|
|
|
(delete :char
|
|
|
|
("D" . " ")
|
|
|
|
:prompt "Delete" :show-target
|
|
|
|
(lambda
|
|
|
|
(target)
|
|
|
|
"delete")
|
|
|
|
:action
|
|
|
|
(lambda
|
|
|
|
(docid msg target)
|
|
|
|
(mu4e--server-remove docid)))
|
|
|
|
(flag :char
|
|
|
|
("+" . " ")
|
|
|
|
:prompt "+flag" :show-target
|
|
|
|
(lambda
|
|
|
|
(target)
|
|
|
|
"flag")
|
|
|
|
:action
|
|
|
|
(lambda
|
|
|
|
(docid msg target)
|
|
|
|
(mu4e--server-move docid nil "+F-u-N")))
|
|
|
|
(move :char
|
|
|
|
("m" . " ")
|
|
|
|
:prompt "move" :ask-target mu4e--mark-get-move-target :action
|
|
|
|
(lambda
|
|
|
|
(docid msg target)
|
|
|
|
(mu4e--server-move docid
|
|
|
|
(mu4e--mark-check-target target)
|
|
|
|
"-N")))
|
|
|
|
(read :char
|
|
|
|
("!" . " ")
|
|
|
|
:prompt "!read" :show-target
|
|
|
|
(lambda
|
|
|
|
(target)
|
|
|
|
"read")
|
|
|
|
:action
|
|
|
|
(lambda
|
|
|
|
(docid msg target)
|
|
|
|
(mu4e--server-move docid nil "+S-u-N")))
|
|
|
|
(trash :char
|
|
|
|
("d" . " ")
|
|
|
|
:prompt "dtrash" :dyn-target
|
|
|
|
(lambda
|
|
|
|
(target msg)
|
|
|
|
(mu4e-get-trash-folder msg))
|
|
|
|
:action
|
|
|
|
(lambda
|
|
|
|
(docid msg target)
|
|
|
|
(mu4e--server-move docid
|
|
|
|
(mu4e--mark-check-target target)
|
|
|
|
"+T-N")))
|
|
|
|
(unflag :char
|
|
|
|
("-" . " ")
|
|
|
|
:prompt "-unflag" :show-target
|
|
|
|
(lambda
|
|
|
|
(target)
|
|
|
|
"unflag")
|
|
|
|
:action
|
|
|
|
(lambda
|
|
|
|
(docid msg target)
|
|
|
|
(mu4e--server-move docid nil "-F-N")))
|
|
|
|
(untrash :char
|
|
|
|
("=" . " ")
|
|
|
|
:prompt "=untrash" :show-target
|
|
|
|
(lambda
|
|
|
|
(target)
|
|
|
|
"untrash")
|
|
|
|
:action
|
|
|
|
(lambda
|
|
|
|
(docid msg target)
|
|
|
|
(mu4e--server-move docid nil "-T")))
|
|
|
|
(unread :char
|
|
|
|
("?" . " ")
|
|
|
|
:prompt "?unread" :show-target
|
|
|
|
(lambda
|
|
|
|
(target)
|
|
|
|
"unread")
|
|
|
|
:action
|
|
|
|
(lambda
|
|
|
|
(docid msg target)
|
|
|
|
(mu4e--server-move docid nil "-S+u-N")))
|
|
|
|
(unmark :char " " :prompt "unmark" :action
|
|
|
|
(mu4e-error "No action for unmarking"))
|
|
|
|
(action :char
|
|
|
|
("a" . " ")
|
|
|
|
:prompt "action" :ask-target
|
|
|
|
(lambda nil
|
|
|
|
(mu4e-read-option "Action: " mu4e-headers-actions))
|
|
|
|
:action
|
|
|
|
(lambda
|
|
|
|
(docid msg actionfunc)
|
|
|
|
(save-excursion
|
|
|
|
(when
|
|
|
|
(mu4e~headers-goto-docid docid)
|
|
|
|
(mu4e-headers-action actionfunc)))))
|
|
|
|
(something :char
|
|
|
|
("*" . " ")
|
|
|
|
:prompt "*something" :action
|
|
|
|
(mu4e-error "No action for deferred mark"))))
|
2023-11-17 14:48:04 +00:00
|
|
|
(require 'mu4e-org)
|
2023-11-20 16:18:34 +00:00
|
|
|
(mu4e-modeline-mode)
|
2023-11-17 14:48:04 +00:00
|
|
|
(setq mu4e-contexts
|
|
|
|
(list
|
|
|
|
(make-mu4e-context
|
|
|
|
:name "Xenia"
|
|
|
|
:vars '((user-mail-address . "evie@xenia.me.uk")
|
|
|
|
(mu4e-sent-folder . "/Proton/Sent")
|
|
|
|
(mu4e-drafts-folder . "/Proton/Drafts")
|
|
|
|
(mu4e-trash-folder . "/Proton/Trash")
|
|
|
|
(mu4e-refile-folder . "/Proton/Archive")))
|
|
|
|
(make-mu4e-context
|
|
|
|
:name "Proton"
|
|
|
|
:match-func (lambda (msg) (when msg (string-prefix-p "/Proton" (mu4e-message-field msg :maildir))))
|
|
|
|
:vars '((user-mail-address . "e.litherlandsmith@proton.me")
|
|
|
|
(mu4e-sent-folder . "/Proton/Sent")
|
|
|
|
(mu4e-drafts-folder . "/Proton/Drafts")
|
|
|
|
(mu4e-trash-folder . "/Proton/Trash")
|
|
|
|
(mu4e-refile-folder . "/Proton/Archive")))
|
|
|
|
(make-mu4e-context
|
|
|
|
:name "iCloud"
|
|
|
|
:match-func (lambda (msg) (when msg (string-prefix-p "/iCloud" (mu4e-message-field msg :maildir))))
|
|
|
|
:vars '((user-mail-address . "e.litherlandsmith@icloud.com")
|
|
|
|
(mu4e-sent-folder . "/iCloud/Sent Messages")
|
|
|
|
(mu4e-drafts-folder . "/iCloud/Drafts")
|
|
|
|
(mu4e-trash-folder . "/iCloud/Deleted Messages")
|
|
|
|
(mu4e-refile-folder . "/iCloud/Archive")))
|
|
|
|
(make-mu4e-context
|
|
|
|
:name "Work"
|
|
|
|
:match-func (lambda (msg) (when msg (string-prefix-p "/Outlook" (mu4e-message-field msg :maildir))))
|
|
|
|
:vars '((user-mail-address . "evie.litherland-smith@ukaea.uk")
|
|
|
|
(mu4e-sent-folder . "/Outlook/Sent")
|
|
|
|
(mu4e-drafts-folder . "/Outlook/Drafts")
|
|
|
|
(mu4e-trash-folder . "/Outlook/Trash")
|
|
|
|
(mu4e-refile-folder . "/Outlook/Archive"))))))
|
2023-11-06 07:11:31 +00:00
|
|
|
|
2023-11-09 08:10:57 +00:00
|
|
|
(use-package mu4e-alert
|
|
|
|
:after mu4e
|
|
|
|
:config
|
|
|
|
(mu4e-alert-set-default-style 'libnotify)
|
|
|
|
(mu4e-alert-enable-notifications)
|
2023-11-20 16:18:34 +00:00
|
|
|
(mu4e-alert-disable-mode-line-display))
|
2023-11-06 07:11:31 +00:00
|
|
|
|
2023-11-09 08:10:57 +00:00
|
|
|
#+END_SRC
|
2023-11-06 07:11:31 +00:00
|
|
|
|
2023-11-22 06:30:54 +00:00
|
|
|
** TODO Feeds
|
2023-11-09 08:10:57 +00:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(let ((elfeed-base-directory "~/.elfeed"))
|
2023-11-22 06:30:54 +00:00
|
|
|
(setq elfeed-db-directory (expand-file-name "db" elfeed-base-directory)
|
|
|
|
elfeed-enclosure-default-dir (expand-file-name "enclosures" elfeed-base-directory)
|
|
|
|
rmh-elfeed-org-files (list (expand-file-name "feeds.org" elfeed-base-directory))))
|
|
|
|
(use-package elfeed
|
|
|
|
:bind (("C-c f f" . elfeed)
|
|
|
|
("C-c f u" . elfeed-update))
|
|
|
|
:hook (elfeed-search-mode . elfeed-update)
|
|
|
|
:config
|
|
|
|
(use-package elfeed-org
|
|
|
|
:ensure t
|
|
|
|
:config (elfeed-org))
|
|
|
|
(use-package elfeed-tube
|
|
|
|
:ensure t
|
|
|
|
:config (elfeed-tube-setup)))
|
2023-11-06 07:11:31 +00:00
|
|
|
#+END_SRC
|
|
|
|
|
2023-11-09 08:10:57 +00:00
|
|
|
** Social
|
2023-11-16 08:38:09 +00:00
|
|
|
|
|
|
|
*** Mastodon
|
2023-11-06 07:11:31 +00:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2023-11-09 08:10:57 +00:00
|
|
|
(use-package mastodon
|
2023-11-19 09:34:23 +00:00
|
|
|
:commands mastodon
|
|
|
|
:custom
|
|
|
|
(mastodon-instance-url "https://tech.lgbt")
|
|
|
|
(mastodon-active-user "Tux922"))
|
2023-11-16 08:38:09 +00:00
|
|
|
#+END_SRC
|
2023-11-09 08:10:57 +00:00
|
|
|
|
2023-11-16 08:38:09 +00:00
|
|
|
*** Matrix / Ement.el
|
|
|
|
#+begin_src emacs-lisp
|
2023-11-16 12:00:15 +00:00
|
|
|
(defun my/ement-connect-pantalaimon ()
|
|
|
|
"Connect to ement.el by calling `ement-connect' with pantalaimon service as uri-prefix"
|
|
|
|
(interactive)
|
|
|
|
(ement-connect
|
2023-11-23 09:24:32 +00:00
|
|
|
:user-id "@evie:xenia.me.uk"
|
2023-11-16 12:00:15 +00:00
|
|
|
:uri-prefix "http://localhost:8008"))
|
2023-11-17 07:29:22 +00:00
|
|
|
|
|
|
|
(use-package ement
|
|
|
|
:ensure t
|
|
|
|
:commands ement-connect
|
|
|
|
:bind (("C-c m m" . ement-list-rooms)
|
2023-11-19 05:20:25 +00:00
|
|
|
("C-c m n" . ement-notifications)
|
2023-11-17 07:29:22 +00:00
|
|
|
("C-c m j" . ement-room-join)
|
|
|
|
("C-c m l" . ement-room-leave)
|
|
|
|
("C-c m v" . ement-room-view)
|
2023-11-29 07:03:54 +00:00
|
|
|
("C-c m s" . ement-view-space)
|
2023-11-30 04:48:36 +00:00
|
|
|
("C-c m k" . ement-kill-buffers)
|
2023-11-19 09:34:23 +00:00
|
|
|
("C-c m c" . my/ement-connect-pantalaimon))
|
|
|
|
:custom
|
|
|
|
(ement-save-sessions t))
|
2023-11-16 08:38:09 +00:00
|
|
|
#+end_src
|
|
|
|
|
2023-11-09 08:10:57 +00:00
|
|
|
|
2023-11-22 06:30:54 +00:00
|
|
|
* Media
|
2023-11-19 08:51:05 +00:00
|
|
|
|
2023-11-22 06:30:54 +00:00
|
|
|
** EMMS
|
2023-11-09 08:10:57 +00:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2023-11-29 07:45:06 +00:00
|
|
|
(setq emms-mode-line-icon-enabled-p nil)
|
2023-11-22 06:30:54 +00:00
|
|
|
(use-package emms
|
2023-11-27 16:00:20 +00:00
|
|
|
:bind (("C-c e e" . emms-pause)
|
2023-11-27 16:01:04 +00:00
|
|
|
("C-c e s" . emms-stop)
|
2023-11-22 06:30:54 +00:00
|
|
|
("C-c e b" . emms-browser)
|
2023-11-27 16:00:20 +00:00
|
|
|
("C-c e p" . emms-playlist-mode-go)
|
2023-11-30 05:27:02 +00:00
|
|
|
("<XF86AudioPlay>" . emms-pause)
|
|
|
|
("<XF86AudioPrev>" . emms-previous)
|
|
|
|
("<XF86AudioNext>" . emms-next))
|
2023-11-22 06:30:54 +00:00
|
|
|
:custom
|
|
|
|
(emms-info-functions '(emms-info-native))
|
|
|
|
(emms-source-file-default-directory "~/Music")
|
|
|
|
(emms-lyrics-dir "~/Music/lyrics")
|
|
|
|
:config
|
2023-11-09 08:10:57 +00:00
|
|
|
(emms-all)
|
2023-11-30 05:27:02 +00:00
|
|
|
(emms-default-players)
|
2023-11-27 15:35:33 +00:00
|
|
|
(emms-mpris-enable)
|
2023-11-29 07:45:06 +00:00
|
|
|
(add-hook 'emms-player-started-hook #'emms-show))
|
2023-11-06 07:11:31 +00:00
|
|
|
#+END_SRC
|
|
|
|
|
2023-11-29 16:23:33 +00:00
|
|
|
* Writing
|
|
|
|
|
|
|
|
** Doc-view
|
|
|
|
#+begin_src emacs-lisp :tangle yes
|
|
|
|
(use-package doc-view
|
|
|
|
:defer t
|
|
|
|
:ensure t
|
|
|
|
:custom
|
|
|
|
(doc-view-resolution 200)
|
|
|
|
(doc-view-continuous t)
|
|
|
|
(doc-view-imenu-enabled t)
|
|
|
|
(doc-view-scale-internally t)
|
|
|
|
(doc-view-image-width 850))
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** TODO Crafted Config
|
2023-11-06 07:11:31 +00:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
;;; Whitespace
|
|
|
|
(defun crafted-writing-configure-whitespace (use-tabs &optional use-globally &rest enabled-modes)
|
|
|
|
"Helper function to configure `whitespace' mode.
|
|
|
|
|
|
|
|
Enable using TAB characters if USE-TABS is non-nil. If
|
|
|
|
USE-GLOBALLY is non-nil, turn on `global-whitespace-mode'. If
|
|
|
|
ENABLED-MODES is non-nil, it will be a list of modes to activate
|
|
|
|
whitespace mode using hooks. The hooks will be the name of the
|
|
|
|
mode in the list with `-hook' appended. If USE-GLOBALLY is
|
|
|
|
non-nil, ENABLED-MODES is ignored.
|
|
|
|
|
|
|
|
Configuring whitespace mode is not buffer local. So calling this
|
|
|
|
function twice with different settings will not do what you
|
|
|
|
think. For example, if you wanted to use spaces instead of tabs
|
|
|
|
globally except for in Makefiles, doing the following won't work:
|
|
|
|
|
|
|
|
;; turns on global-whitespace-mode to use spaces instead of tabs
|
|
|
|
(crafted-writing-configure-whitespace nil t)
|
|
|
|
|
|
|
|
;; overwrites the above to turn to use tabs instead of spaces,
|
|
|
|
;; does not turn off global-whitespace-mode, adds a hook to
|
|
|
|
;; makefile-mode-hook
|
|
|
|
(crafted-writing-configure-whitespace t nil 'makefile-mode)
|
|
|
|
|
|
|
|
Instead, use a configuration like this:
|
|
|
|
;; turns on global-whitespace-mode to use spaces instead of tabs
|
|
|
|
(crafted-writing-configure-whitespace nil t)
|
|
|
|
|
|
|
|
;; turn on the buffer-local mode for using tabs instead of spaces.
|
|
|
|
(add-hook 'makefile-mode-hook #'indent-tabs-mode)
|
|
|
|
|
|
|
|
For more information on `indent-tabs-mode', See the info
|
|
|
|
node `(emacs)Just Spaces'
|
|
|
|
|
|
|
|
Example usage:
|
|
|
|
|
|
|
|
;; Configuring whitespace mode does not turn on whitespace mode
|
|
|
|
;; since we don't know which modes to turn it on for.
|
|
|
|
;; You will need to do that in your configuration by adding
|
|
|
|
;; whitespace mode to the appropriate mode hooks.
|
|
|
|
(crafted-writing-configure-whitespace nil)
|
|
|
|
|
|
|
|
;; Configure whitespace mode, but turn it on globally.
|
|
|
|
(crafted-writing-configure-whitespace nil t)
|
|
|
|
|
|
|
|
;; Configure whitespace mode and turn it on only for prog-mode
|
|
|
|
;; and derived modes.
|
|
|
|
(crafted-writing-configure-whitespace nil nil 'prog-mode)"
|
|
|
|
(if use-tabs
|
|
|
|
(customize-set-variable 'whitespace-style
|
|
|
|
'(face empty trailing indentation::tab
|
|
|
|
space-after-tab::tab
|
|
|
|
space-before-tab::tab))
|
|
|
|
;; use spaces instead of tabs
|
|
|
|
(customize-set-variable 'whitespace-style
|
|
|
|
'(face empty trailing tab-mark
|
|
|
|
indentation::space)))
|
|
|
|
|
|
|
|
(if use-globally
|
|
|
|
(global-whitespace-mode 1)
|
|
|
|
(when enabled-modes
|
|
|
|
(dolist (mode enabled-modes)
|
|
|
|
(add-hook (intern (format "%s-hook" mode)) #'whitespace-mode))))
|
|
|
|
|
|
|
|
;; cleanup whitespace
|
|
|
|
(customize-set-variable 'whitespace-action '(cleanup auto-cleanup)))
|
|
|
|
|
|
|
|
;;; parentheses
|
|
|
|
(electric-pair-mode 1) ; auto-insert matching bracket
|
|
|
|
(show-paren-mode 1) ; turn on paren match highlighting
|
|
|
|
|
|
|
|
;;; LaTeX configuration
|
|
|
|
(with-eval-after-load 'latex
|
|
|
|
(customize-set-variable 'TeX-auto-save t)
|
|
|
|
(customize-set-variable 'TeX-parse-self t)
|
|
|
|
(setq-default TeX-master nil)
|
|
|
|
|
|
|
|
;; compile to pdf
|
|
|
|
(tex-pdf-mode)
|
|
|
|
|
|
|
|
;; correlate the source and the output
|
|
|
|
(TeX-source-correlate-mode)
|
|
|
|
|
|
|
|
;; set a correct indentation in a few additional environments
|
|
|
|
(add-to-list 'LaTeX-indent-environment-list '("lstlisting" current-indentation))
|
|
|
|
(add-to-list 'LaTeX-indent-environment-list '("tikzcd" LaTeX-indent-tabular))
|
|
|
|
(add-to-list 'LaTeX-indent-environment-list '("tikzpicture" current-indentation))
|
|
|
|
|
|
|
|
;; add a few macros and environment as verbatim
|
|
|
|
(add-to-list 'LaTeX-verbatim-environments "lstlisting")
|
|
|
|
(add-to-list 'LaTeX-verbatim-environments "Verbatim")
|
|
|
|
(add-to-list 'LaTeX-verbatim-macros-with-braces "lstinline")
|
|
|
|
(add-to-list 'LaTeX-verbatim-macros-with-delims "lstinline")
|
|
|
|
|
|
|
|
;; electric pairs in auctex
|
|
|
|
(customize-set-variable 'TeX-electric-sub-and-superscript t)
|
|
|
|
(customize-set-variable 'LaTeX-electric-left-right-brace t)
|
|
|
|
(customize-set-variable 'TeX-electric-math (cons "$" "$"))
|
|
|
|
|
|
|
|
;; open all buffers with the math mode and auto-fill mode
|
|
|
|
(add-hook 'LaTeX-mode-hook #'auto-fill-mode)
|
|
|
|
(add-hook 'LaTeX-mode-hook #'LaTeX-math-mode)
|
|
|
|
|
|
|
|
;; add support for references
|
|
|
|
(add-hook 'LaTeX-mode-hook #'turn-on-reftex)
|
|
|
|
(customize-set-variable 'reftex-plug-into-AUCTeX t)
|
|
|
|
|
|
|
|
;; to have the buffer refresh after compilation
|
|
|
|
(add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer))
|
|
|
|
|
|
|
|
(defun crafted-latex-use-pdf-tools ()
|
|
|
|
"Use PDF Tools instead of docview, requires a build environment
|
|
|
|
to compile PDF Tools.
|
|
|
|
|
|
|
|
Depends on having `pdf-tools'."
|
|
|
|
|
|
|
|
(with-eval-after-load 'latex
|
|
|
|
(customize-set-variable 'TeX-view-program-selection '((output-pdf "PDF Tools")))
|
|
|
|
(customize-set-variable 'TeX-view-program-list '(("PDF Tools" TeX-pdf-tools-sync-view)))
|
|
|
|
(customize-set-variable 'TeX-source-correlate-start-server t)))
|
|
|
|
|
|
|
|
;; message the user if the latex executable is not found
|
|
|
|
(defun crafted-writing-tex-warning-if-no-latex-executable ()
|
|
|
|
"Print a message to the minibuffer if the \"latex\" executable cannot be found."
|
|
|
|
(unless (executable-find "latex")
|
|
|
|
(message "latex executable not found")))
|
|
|
|
(add-hook 'tex-mode-hook #'crafted-writing-tex-warning-if-no-latex-executable)
|
|
|
|
|
|
|
|
(when (and (executable-find "latex")
|
|
|
|
(executable-find "latexmk"))
|
|
|
|
(with-eval-after-load 'latex
|
|
|
|
(when (require 'auctex-latexmk nil 'noerror)
|
|
|
|
(with-eval-after-load 'auctex-latexmk
|
|
|
|
(auctex-latexmk-setup)
|
|
|
|
(customize-set-variable 'auctex-latexmk-inherit-TeX-PDF-mode t))
|
|
|
|
|
|
|
|
(defun crafted-writing-tex-make-latexmk-default-command ()
|
|
|
|
"Set `TeX-command-default' to \"LatexMk\"."
|
|
|
|
(setq TeX-command-default "LatexMk"))
|
|
|
|
(add-hook 'TeX-mode-hook #'crafted-writing-tex-make-latexmk-default-command))))
|
|
|
|
|
|
|
|
;;; Markdown
|
|
|
|
(when (fboundp 'markdown-mode)
|
|
|
|
;; because the markdown-command variable may not be loaded (yet),
|
|
|
|
;; check manually for the other markdown processors. If it is
|
|
|
|
;; loaded, the others are superfluous but `or' fails fast, so they
|
|
|
|
;; are not checked if `markdown-command' is set and the command is
|
|
|
|
;; indeed found.
|
|
|
|
(unless (or (and (boundp 'markdown-command)
|
|
|
|
(executable-find markdown-command))
|
|
|
|
(executable-find "markdown")
|
|
|
|
(executable-find "pandoc"))
|
|
|
|
(message "No markdown processor found, preview may not possible."))
|
|
|
|
|
|
|
|
(with-eval-after-load 'markdown-mode
|
|
|
|
(customize-set-variable 'markdown-enable-math t)
|
|
|
|
(customize-set-variable 'markdown-enable-html t)
|
|
|
|
(add-hook 'markdown-mode-hook #'conditionally-turn-on-pandoc)))
|
|
|
|
|
|
|
|
;;; PDF Support when using pdf-tools
|
|
|
|
(when (locate-library "pdf-tools")
|
|
|
|
;; load pdf-tools when going into doc-view-mode
|
|
|
|
(defun crafted-writing-load-pdf-tools ()
|
|
|
|
"Attempts to require pdf-tools, but for attaching to hooks."
|
|
|
|
(require 'pdf-tools nil :noerror))
|
|
|
|
(add-hook 'doc-view-mode-hook #'crafted-writing-load-pdf-tools)
|
|
|
|
|
|
|
|
;; when pdf-tools is loaded, apply settings.
|
|
|
|
(with-eval-after-load 'pdf-tools
|
|
|
|
(setq-default pdf-view-display-size 'fit-width)))
|
|
|
|
#+END_SRC
|