1 ;;; bandali-org.el --- bandali's Org setup -*- lexical-binding: t; -*-
3 ;; Copyright (C) 2018-2020 Amin Bandali
5 ;; Author: Amin Bandali <bandali@gnu.org>
6 ;; Keywords: calendar, data, docs, hypermedia, outlines
8 ;; This program is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program. If not, see <https://www.gnu.org/licenses/>.
23 ;; My set up for Org (org-mode) and all things Org.
27 (with-eval-after-load 'org
28 (csetq org-src-tab-acts-natively t
29 org-src-preserve-indentation nil
30 org-edit-src-content-indentation
0
31 org-id-locations-file
(b/var
"org/id-locations.el")
32 org-link-email-description-format
"Email %c: %s" ; %.30s
33 org-highlight-latex-and-related
'(entities)
34 org-use-speed-commands t
35 org-startup-folded
'content
36 org-catch-invisible-edits
'show-and-error
39 org-agenda-files
'("~/usr/org/todos/personal.org"
40 "~/usr/org/todos/habits.org"
41 "~/src/git/masters-thesis/todo.org")
42 org-agenda-start-on-weekday
0
43 org-agenda-time-leading-zero t
44 org-habit-graph-column
44
45 org-latex-packages-alist
'(("" "listings") ("" "color")))
46 (add-to-list 'org-structure-template-alist
'("L" .
"src emacs-lisp") t
)
47 (add-to-list 'org-modules
'org-habit
)
49 '(org-block-begin-line
50 ((t (:foreground
"#5a5b5a" :background
"#1d1f21"))))
51 '(org-block ((t (:background
"#1d1f21"))))
52 '(org-latex-and-related ((t (:foreground
"#b294bb")))))
54 (define-key org-mode-map
(kbd "M-L") #'org-insert-last-stored-link
)
55 (define-key org-mode-map
(kbd "M-O") #'org-toggle-link-display
)
57 (add-hook 'org-mode-hook
#'org-indent-mode
)
58 (add-hook 'org-mode-hook
#'auto-fill-mode
)
59 (add-hook 'org-mode-hook
#'flyspell-mode
)
61 ;; asynchronous tangle, using emacs-async to asynchronously tangle an
62 ;; org file. closely inspired by
63 ;; https://github.com/dieggsy/dotfiles/tree/cc10edf7701958eff1cd94d4081da544d882a28c/emacs.d#dotfiles
64 (defvar b
/show-async-tangle-results nil
65 "Keep *emacs* async buffers around for later inspection.")
67 (defvar b
/show-async-tangle-time nil
68 "Show the time spent tangling the file.")
70 (defun b/async-babel-tangle
()
71 "Tangle org file asynchronously."
73 (let* ((file-tangle-start-time (current-time))
74 (file (buffer-file-name))
75 (file-nodir (file-name-nondirectory file
))
76 ;; (async-quiet-switch "-q")
77 ;; (file-noext (file-name-sans-extension file))
82 (org-babel-tangle-file ,file
))
83 (unless b
/show-async-tangle-results
86 (message "Tangled %s%s"
88 (if b
/show-async-tangle-time
90 (float-time (time-subtract (current-time)
91 ',file-tangle-start-time
)))
93 (message "Tangling %s failed" ,file-nodir
)))))))
95 'safe-local-variable-values
96 '(eval add-hook
'after-save-hook
#'b
/async-babel-tangle
'append
'local
)))
97 ;; global key bindings
98 (global-set-key (kbd "C-c a o a") #'org-agenda
)
100 (with-eval-after-load 'ox-latex
101 (csetq org-latex-listings
'listings
102 ;; org-latex-prefer-user-labels t
104 (add-to-list 'org-latex-classes
105 '("IEEEtran" "\\documentclass[11pt]{IEEEtran}"
106 ("\\section{%s}" .
"\\section*{%s}")
107 ("\\subsection{%s}" .
"\\subsection*{%s}")
108 ("\\subsubsection{%s}" .
"\\subsubsection*{%s}")
109 ("\\paragraph{%s}" .
"\\paragraph*{%s}")
110 ("\\subparagraph{%s}" .
"\\subparagraph*{%s}"))
112 (require 'ox-beamer
))
114 (with-eval-after-load 'ox-extra
115 (declare-function ox-extras-activate
"ox-extra" (extras))
116 (ox-extras-activate '(latex-header-blocks ignore-headlines
)))
118 (provide 'bandali-org
)
119 ;;; bandali-org.el ends here