Add convenience C-c e p binding for pp-macroexpand-last-sexp
[~bandali/configs] / lisp / bandali-org.el
CommitLineData
f7910e3d
AB
1(use-package org
2 :config
3 (setq org-src-tab-acts-natively t
4 org-src-preserve-indentation nil
5 org-edit-src-content-indentation 0
6 org-link-email-description-format "Email %c: %s" ; %.30s
7 org-highlight-latex-and-related '(entities)
8 org-use-speed-commands t
9 org-startup-folded 'content
10 org-catch-invisible-edits 'show-and-error
11 org-log-done 'time)
f7910e3d
AB
12 (add-to-list 'org-structure-template-alist '("L" . "src emacs-lisp") t)
13 (add-to-list 'org-modules 'org-habit)
14 :bind
15 (("C-c a o a" . org-agenda)
16 :map org-mode-map
17 ("M-L" . org-insert-last-stored-link)
18 ("M-O" . org-toggle-link-display))
19 :hook ((org-mode . org-indent-mode)
20 (org-mode . auto-fill-mode)
21 (org-mode . flyspell-mode))
22 :custom
23 (org-pretty-entities t)
24 (org-agenda-files '("~/usr/org/todos/personal.org"
25 "~/usr/org/todos/habits.org"
26 "~/src/git/masters-thesis/todo.org"))
27 (org-agenda-start-on-weekday 0)
28 (org-agenda-time-leading-zero t)
29 (org-habit-graph-column 44)
30 (org-latex-packages-alist '(("" "listings") ("" "color")))
31 :custom-face
32 '(org-block-begin-line ((t (:foreground "#5a5b5a" :background "#1d1f21"))))
33 '(org-block ((t (:background "#1d1f21"))))
34 '(org-latex-and-related ((t (:foreground "#b294bb")))))
35
36(use-package ox-latex
37 :after ox
38 :config
39 (setq org-latex-listings 'listings
40 ;; org-latex-prefer-user-labels t
41 )
42 (add-to-list 'org-latex-classes
43 '("IEEEtran" "\\documentclass[11pt]{IEEEtran}"
44 ("\\section{%s}" . "\\section*{%s}")
45 ("\\subsection{%s}" . "\\subsection*{%s}")
46 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
47 ("\\paragraph{%s}" . "\\paragraph*{%s}")
48 ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
49 t)
50 (require 'ox-beamer))
51
52(use-package ox-extra
53 :config
54 (ox-extras-activate '(latex-header-blocks ignore-headlines)))
55
56;; asynchronous tangle, using emacs-async to asynchronously tangle an
57;; org file. closely inspired by
58;; https://github.com/dieggsy/dotfiles/tree/cc10edf7701958eff1cd94d4081da544d882a28c/emacs.d#dotfiles
59(with-eval-after-load 'org
60 (defvar b/show-async-tangle-results nil
61 "Keep *emacs* async buffers around for later inspection.")
62
63 (defvar b/show-async-tangle-time nil
64 "Show the time spent tangling the file.")
65
66 (defun b/async-babel-tangle ()
67 "Tangle org file asynchronously."
68 (interactive)
69 (let* ((file-tangle-start-time (current-time))
70 (file (buffer-file-name))
71 (file-nodir (file-name-nondirectory file))
72 ;; (async-quiet-switch "-q")
73 (file-noext (file-name-sans-extension file)))
74 (async-start
75 `(lambda ()
76 (require 'org)
77 (org-babel-tangle-file ,file))
78 (unless b/show-async-tangle-results
79 `(lambda (result)
80 (if result
81 (message "Tangled %s%s"
82 ,file-nodir
83 (if b/show-async-tangle-time
84 (format " (%.3fs)"
85 (float-time (time-subtract (current-time)
86 ',file-tangle-start-time)))
87 ""))
88 (message "Tangling %s failed" ,file-nodir))))))))
89
90(add-to-list
91 'safe-local-variable-values
92 '(eval add-hook 'after-save-hook #'b/async-babel-tangle 'append 'local))
93
94(provide 'bandali-org)