diff options
author | Amin Bandali <bandali@gnu.org> | 2020-04-12 13:09:13 -0400 |
---|---|---|
committer | Amin Bandali <bandali@gnu.org> | 2020-04-12 13:13:59 -0400 |
commit | f7910e3d16fad267a1919aa471b9efd537d22cfc (patch) | |
tree | 8e09398620410e844071dba23ccbd1bd0ddc0056 /lisp | |
parent | 8b1a2f3244208cebd3dc595d8e7027bb9c5c3625 (diff) | |
download | configs-f7910e3d16fad267a1919aa471b9efd537d22cfc.tar.gz configs-f7910e3d16fad267a1919aa471b9efd537d22cfc.tar.xz configs-f7910e3d16fad267a1919aa471b9efd537d22cfc.zip |
Move Org setup to lisp/bandali-org.el and fix time & battery display
Diffstat (limited to '')
-rw-r--r-- | lisp/bandali-org.el | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/lisp/bandali-org.el b/lisp/bandali-org.el new file mode 100644 index 0000000..957417f --- /dev/null +++ b/lisp/bandali-org.el @@ -0,0 +1,97 @@ +(use-package org + :config + (setq org-src-tab-acts-natively t + org-src-preserve-indentation nil + org-edit-src-content-indentation 0 + org-link-email-description-format "Email %c: %s" ; %.30s + org-highlight-latex-and-related '(entities) + org-use-speed-commands t + org-startup-folded 'content + org-catch-invisible-edits 'show-and-error + org-log-done 'time) + (when (version< org-version "9.3") + (setq org-email-link-description-format + org-link-email-description-format)) + (add-to-list 'org-structure-template-alist '("L" . "src emacs-lisp") t) + (add-to-list 'org-modules 'org-habit) + :bind + (("C-c a o a" . org-agenda) + :map org-mode-map + ("M-L" . org-insert-last-stored-link) + ("M-O" . org-toggle-link-display)) + :hook ((org-mode . org-indent-mode) + (org-mode . auto-fill-mode) + (org-mode . flyspell-mode)) + :custom + (org-pretty-entities t) + (org-agenda-files '("~/usr/org/todos/personal.org" + "~/usr/org/todos/habits.org" + "~/src/git/masters-thesis/todo.org")) + (org-agenda-start-on-weekday 0) + (org-agenda-time-leading-zero t) + (org-habit-graph-column 44) + (org-latex-packages-alist '(("" "listings") ("" "color"))) + :custom-face + '(org-block-begin-line ((t (:foreground "#5a5b5a" :background "#1d1f21")))) + '(org-block ((t (:background "#1d1f21")))) + '(org-latex-and-related ((t (:foreground "#b294bb"))))) + +(use-package ox-latex + :after ox + :config + (setq org-latex-listings 'listings + ;; org-latex-prefer-user-labels t + ) + (add-to-list 'org-latex-classes + '("IEEEtran" "\\documentclass[11pt]{IEEEtran}" + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}") + ("\\paragraph{%s}" . "\\paragraph*{%s}") + ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) + t) + (require 'ox-beamer)) + +(use-package ox-extra + :config + (ox-extras-activate '(latex-header-blocks ignore-headlines))) + +;; asynchronous tangle, using emacs-async to asynchronously tangle an +;; org file. closely inspired by +;; https://github.com/dieggsy/dotfiles/tree/cc10edf7701958eff1cd94d4081da544d882a28c/emacs.d#dotfiles +(with-eval-after-load 'org + (defvar b/show-async-tangle-results nil + "Keep *emacs* async buffers around for later inspection.") + + (defvar b/show-async-tangle-time nil + "Show the time spent tangling the file.") + + (defun b/async-babel-tangle () + "Tangle org file asynchronously." + (interactive) + (let* ((file-tangle-start-time (current-time)) + (file (buffer-file-name)) + (file-nodir (file-name-nondirectory file)) + ;; (async-quiet-switch "-q") + (file-noext (file-name-sans-extension file))) + (async-start + `(lambda () + (require 'org) + (org-babel-tangle-file ,file)) + (unless b/show-async-tangle-results + `(lambda (result) + (if result + (message "Tangled %s%s" + ,file-nodir + (if b/show-async-tangle-time + (format " (%.3fs)" + (float-time (time-subtract (current-time) + ',file-tangle-start-time))) + "")) + (message "Tangling %s failed" ,file-nodir)))))))) + +(add-to-list + 'safe-local-variable-values + '(eval add-hook 'after-save-hook #'b/async-babel-tangle 'append 'local)) + +(provide 'bandali-org) |