summaryrefslogtreecommitdiff
path: root/tw/home/files
diff options
context:
space:
mode:
Diffstat (limited to 'tw/home/files')
-rw-r--r--tw/home/files/emacs-init.el108
-rw-r--r--tw/home/files/emacs-packages/org-latex-classes.el54
2 files changed, 92 insertions, 70 deletions
diff --git a/tw/home/files/emacs-init.el b/tw/home/files/emacs-init.el
index b4481ca3..eac4b666 100644
--- a/tw/home/files/emacs-init.el
+++ b/tw/home/files/emacs-init.el
@@ -80,6 +80,7 @@
"Enable word wrapping."
(toggle-word-wrap +1))
(add-hook 'markdown-mode-hook #'tw/enable-word-wrap)
+(add-hook 'org-mode-hook #'tw/enable-word-wrap)
;; `use-package' requirements.
(require 'package)
@@ -135,11 +136,15 @@
:config (counsel-mode +1)
:diminish counsel-mode)
+(use-package dash-docs)
+
(defun tw/counsel-dash-is-help ()
"Install `counsel-dash-at-point' as `evil-lookup-func'."
(setq-local evil-lookup-func #'counsel-dash-at-point))
(use-package counsel-dash
+ :after (dash-docs)
+ :commands (counsel-dash-at-point) :demand t
:bind (("<leader>K" . counsel-dash-at-point) ; TODO: just install as `evil-lookup-func'?
("<leader>dK" . counsel-dash)
("<leader>di" . counsel-dash-install-docset)
@@ -164,7 +169,7 @@
;; Included in Emacs >= 26. Better than `linum-mode'.
;; There is also `global-display-line-numbers-mode', but that also
;; enables line numbers in help windows, which I don't want.
- :hook (prog-mode conf-mode alidist-mode))
+ :hook (prog-mode conf-mode yaml-mode alidist-mode))
(use-package which-key
:commands (which-key-mode) :demand t
@@ -208,7 +213,7 @@
(use-package flymake
:after (evil which-key)
:demand t ; needed for `flymake-collection'
- :hook prog-mode
+ :hook (prog-mode yaml-mode alidist-mode)
:init (which-key-add-key-based-replacements
"<leader>e" '("errors" . "Flymake"))
:bind (("<leader>eb" . flymake-start)
@@ -302,9 +307,13 @@
:mode (rx "." (or "htm" "html" "js" "css" "scss") eos))
(use-package yaml-mode
- :mode (rx ".y" (? "a") "ml" eos))
+ :mode (rx (or (seq ".y" (? "a") "ml")
+ (seq "aliPublish" (* (not ?/)) ".conf"))
+ eos))
(use-package ledger-mode
+ :after (evil)
+ :commands (ledger-mode)
:mode (rx ".journal" eos)
:custom
(ledger-default-date-format ledger-iso-date-format "Use hledger-style dates.")
@@ -313,7 +322,10 @@
(ledger-post-account-alignment-column 2 "Use 2-space indents.")
(ledger-post-amount-alignment-at :decimal "Align amounts at decimal points/commas.")
(ledger-post-amount-alignment-column 52 "Align amounts' decimal points to the 52nd column.")
- (ledger-highlight-xact-under-point nil "Don't highlight the transaction at point."))
+ (ledger-highlight-xact-under-point nil "Don't highlight the transaction at point.")
+ :config
+ (evil-define-key 'normal ledger-mode-map
+ (kbd "TAB") #'ledger-indent-line))
(use-package geiser
:after (evil)
@@ -336,9 +348,63 @@
:after (geiser))
;; Org-mode
-(use-package org)
+(use-package org
+ :commands (org-mode)
+ :mode (rx ".org" eos)
+ :custom
+ (org-latex-src-block-backend 'minted "Colourise source code.")
+ (org-latex-packages-alist
+ '(("" "svg")
+ ("" "minted"))
+ "Use svg and syntax highlighting packages.")
+ (org-latex-pdf-process
+ '("latexmk -shell-escape -f -pdf -%latex -interaction=nonstopmode -output-directory=%o %f")
+ "Allow -shell-escape needed by svg and minted packages."))
+
(use-package ob ; org-babel
- :after (org))
+ :after (org)
+ :custom
+ (org-confirm-babel-evaluate nil "Allow running code blocks without confirmation.")
+ ;; List of supported languages:
+ ;; https://orgmode.org/worg/org-contrib/babel/languages/index.html
+ (org-babel-load-languages
+ '((emacs-lisp . t)
+ (lisp . t)
+ (dot . t)
+ (python . t)
+ (rec . t)) ; see `ob-rec' below
+ "Load bindings for more languages for use in #+begin_src blocks."))
+
+(defun tw/latex-section-commands (name)
+ "Create a pair of section commands like (\"\\NAME{%s}\" . \"\\NAME*{%s}\").
+For use in `org-latex-classes'."
+ (cons (format "\\%s{%%s}" name) (format "\\%s*{%%s}" name)))
+(defconst tw/latex-part (tw/latex-section-commands "part")
+ "Part LaTeX commands for `org-latex-classes'.")
+(defconst tw/latex-chapter (tw/latex-section-commands "chapter")
+ "Chapter LaTeX commands for `org-latex-classes'.")
+(defconst tw/latex-section-and-below
+ (mapcar #'tw/latex-section-commands
+ '("section" "subsection" "subsubsection" "paragraph" "subparagraph"))
+ "Section to subparagraph LaTeX commands for `org-latex-classes'.")
+
+(use-package ox-latex ; org-export-latex
+ :after (org)
+ :custom
+ (org-latex-classes
+ `(("paperlike" "\\documentclass{paperlike}" . ,tw/latex-section-and-below)
+ ("examtext" "\\documentclass{examtext}" . ,tw/latex-section-and-below)
+ ("minutes" "\\documentclass{minutes}" . ,tw/latex-section-and-below)
+ ("mapreport" "\\documentclass{mapreport}" ,tw/latex-chapter . ,tw/latex-section-and-below)
+ ("pt3report" "\\documentclass{pt3report}" ,tw/latex-chapter . ,tw/latex-section-and-below)
+ ("article" "\\documentclass{article}" . ,tw/latex-section-and-below)
+ ("scrartcl" "\\documentclass{scrartcl}" . ,tw/latex-section-and-below)
+ ("report" "\\documentclass{report}" ,tw/latex-part ,tw/latex-chapter . ,tw/latex-section-and-below)
+ ("report-noparts" "\\documentclass{report}" ,tw/latex-chapter . ,tw/latex-section-and-below)
+ ("book" "\\documentclass{book}" ,tw/latex-part ,tw/latex-chapter . ,tw/latex-section-and-below)
+ ("book-noparts" "\\documentclass{book}" ,tw/latex-chapter . ,tw/latex-section-and-below)
+ ("checklist" "\\documentclass{checklist}" . ,tw/latex-section-and-below))
+ "Define more documentclasses for org-latex."))
(use-package outline
:commands (outline-mode outline-minor-mode)
@@ -375,10 +441,6 @@
(: ".environment.d/" (1+ (not ?\/)) ".conf"))
eos))
-(use-package org-latex-classes
- :after (ox-latex)
- :load-path "include/")
-
(use-package ob-rec
;; `org-babel' hooks for `rec-mode'
:after (org ob rec-mode)
@@ -422,6 +484,11 @@
(evil-mode +1)
(evil-set-leader '(normal visual) (kbd "SPC")) ; <leader>
(evil-set-leader '(normal visual) (kbd "\\") t) ; <localleader>
+ ;; For some reason, in `diff-mode', space isn't assigned to the leader key
+ ;; automatically, unlike in other modes.
+ (evil-define-key '(normal visual) diff-mode-shared-map ; not `diff-mode-map', else toggling `read-only-mode' destroys the binding
+ (kbd "SPC") #'evil-send-leader
+ (kbd "\\") #'evil-send-localleader)
(evil-define-key '(normal insert visual replace) 'global
(kbd "C-s") #'save-buffer)
;; Global major-mode-independent keys should be defined here. Major
@@ -469,7 +536,9 @@
:after (evil)
:commands (evil-collection-init) :demand t
:config (evil-collection-init)
- :diminish evil-collection-unimpaired-mode)
+ :diminish evil-collection-unimpaired-mode
+ :custom
+ (evil-collection-setup-minibuffer t "Use evil-collection in minibuffer to match `evil-want-minibuffer'."))
(use-package evil-org
:after (evil org)
@@ -477,6 +546,18 @@
:config
(evil-define-key '(normal visual) org-mode-map
(kbd "<localleader>\\") #'org-ctrl-c-ctrl-c
+ (kbd "<localleader>ib") #'org-insert-structure-template
+ (kbd "<localleader>id") #'org-insert-drawer
+ (kbd "<localleader>iD") #'org-insert-time-stamp
+ (kbd "<localleader>ih") #'org-insert-heading
+ (kbd "<localleader>iH") #'org-insert-subheading
+ (kbd "<localleader>it") #'org-insert-todo-heading
+ (kbd "<localleader>iT") #'org-insert-todo-subheading
+ (kbd "<localleader>ii") #'org-insert-item
+ (kbd "<localleader>il") #'org-insert-link
+ (kbd "<localleader>p") #'org-set-property
+ (kbd "<localleader>t") #'org-set-tags
+ ;; Source code block editing
(kbd "<localleader>'") #'org-edit-src-code
(kbd "<localleader>e") #'org-export-dispatch)
(evil-define-key '(normal visual) org-src-mode-map
@@ -594,11 +675,6 @@
(kbd "<localleader>el") #'eval-last-sexp
(kbd "<localleader>ep") #'eval-print-last-sexp)
-;; For some reason, in `diff-mode', space isn't assigned to the leader key
-;; automatically, unlike in other modes.
-(evil-define-key '(normal visual) diff-mode-shared-map ; not `diff-mode-map', else toggling `read-only-mode' destroys the binding
- (kbd "SPC") #'evil-send-leader)
-
;; Guix-related .dir-locals.el entries. These are fine; don't prompt every time.
(mapc (apply-partially #'add-to-list 'safe-local-eval-forms)
'((modify-syntax-entry 126 "'")
diff --git a/tw/home/files/emacs-packages/org-latex-classes.el b/tw/home/files/emacs-packages/org-latex-classes.el
deleted file mode 100644
index 90d13341..00000000
--- a/tw/home/files/emacs-packages/org-latex-classes.el
+++ /dev/null
@@ -1,54 +0,0 @@
-;;; org-latex-classes.el --- LaTeX documentclass definitions for org-mode.
-;;; Commentary:
-;;; Code:
-(require 'ox-latex)
-
-(defun tw/latex-section-commands (name)
- "Create a pair of section commands like (\"\\NAME{%s}\" . \"\\NAME*{%s}\")."
- (cons (format "\\%s{%%s}" name) (format "\\%s*{%%s}" name)))
-
-(defconst tw/latex-part (tw/latex-section-commands "part"))
-(defconst tw/latex-chapter (tw/latex-section-commands "chapter"))
-(defconst tw/latex-section-and-below
- (mapcar #'tw/latex-section-commands
- '("section" "subsection" "subsubsection" "paragraph" "subparagraph")))
-
-(setq org-latex-classes
- `(("paperlike" "\\documentclass{paperlike}"
- . ,tw/latex-section-and-below)
-
- ("examtext" "\\documentclass{examtext}"
- . ,tw/latex-section-and-below)
-
- ("minutes" "\\documentclass{minutes}"
- . ,tw/latex-section-and-below)
-
- ("mapreport" "\\documentclass{mapreport}"
- ,tw/latex-chapter . ,tw/latex-section-and-below)
-
- ("pt3report" "\\documentclass{pt3report}"
- ,tw/latex-chapter . ,tw/latex-section-and-below)
-
- ("article" "\\documentclass{article}"
- . ,tw/latex-section-and-below)
-
- ("scrartcl" "\\documentclass{scrartcl}"
- . ,tw/latex-section-and-below)
-
- ("report" "\\documentclass{report}"
- ,tw/latex-part ,tw/latex-chapter . ,tw/latex-section-and-below)
-
- ("report-noparts" "\\documentclass{report}"
- ,tw/latex-chapter . ,tw/latex-section-and-below)
-
- ("book" "\\documentclass{book}"
- ,tw/latex-part ,tw/latex-chapter . ,tw/latex-section-and-below)
-
- ("book-noparts" "\\documentclass{book}"
- ,tw/latex-chapter . ,tw/latex-section-and-below)
-
- ("checklist" "\\documentclass{checklist}"
- . ,tw/latex-section-and-below)))
-
-(provide 'org-latex-classes)
-;;; org-latex-classes.el ends here