diff --git a/init.org b/init.org index e6a70d6..d1335a1 100644 --- a/init.org +++ b/init.org @@ -207,11 +207,7 @@ (let* ((package--builtins nil) (packages - '(org ; Outline-based notes management and organizer - org-bullets ; Show bullets in org-mode as UTF-8 characters - org-msg ; Org mode to send and reply to email in HTML - ox-gfm ; Export Github Flavored Markdown from Org - paredit ; minor mode for editing parentheses + '(paredit ; minor mode for editing parentheses pdf-tools ; Emacs support library for PDF files proof-general ; A generic Emacs interface for proof assistants racket-mode ; Major mode for Racket language @@ -813,37 +809,181 @@ * Org - When editing org-files with source-blocks, we want the source blocks to be - themed as they would in their native mode. + I use Org mode extensively. Some of these configurations may be unfortunate, + but it is a bit impractical to change, as I have years worth of org-files and + want to avoid having to reformat a lot of files. + + One example is =org-adapt-indentation=, which changed default value in + version 9.5 of Org mode. Another is that I for some unknown reason decided to + content within source content not be indented by two spaces (which is the + default). + + Note that I disable some safety features, so please don't copy and paste + mindlessly (see the documentation for =org-confirm-babel-evaluate= and + =org-export-allow-bind-keywords=). #+begin_src emacs-lisp - (setq org-src-fontify-natively t - org-src-tab-acts-natively t - org-confirm-babel-evaluate nil - org-edit-src-content-indentation 0) + ;; Outline-based notes management and organizer + (use-package org + :defer t + :config + (setq org-adapt-indentation t + org-src-fontify-natively t + org-confirm-babel-evaluate nil + org-export-allow-bind-keywords t + org-edit-src-content-indentation 0)) #+end_src - This is quite an ugly fix for allowing code markup for expressions like - ="this string"=, because the quotation marks causes problems. +** LaTeX export - #+begin_src emacs-lisp + For LaTeX export, I default to using XeLaTeX for compilation, and the [[https://www.ctan.org/pkg/minted][minted]] + package for syntax highlighting source blocks. I have PDFs open directly in + Emacs ([[PDF Tools]]). In addition, I have support for a couple of custom LaTeX + classes. - (with-eval-after-load 'org - (require 'org-tempo) - (setcar (nthcdr 2 org-emphasis-regexp-components) " \t\n,") - (custom-set-variables `(org-emphasis-alist ',org-emphasis-alist))) + #+begin_src emacs-lisp - #+end_src + ;; LaTeX Back-End for Org Export Engine + (use-package ox-latex + :ensure nil + :after org + :config + ;; Use Minted and XeLaTeX + (setq org-latex-src-block-backend 'minted + org-latex-packages-alist '(("newfloat" "minted")) + org-latex-pdf-process + '("latexmk -pdflatex='xelatex -shell-escape -interaction nonstopmode' -pdf -f %f")) - Enable org-bullets when opening org-files. + (add-to-list 'org-file-apps '("\\.pdf\\'" . emacs)) - #+begin_src emacs-lisp + (add-to-list 'org-latex-classes + '("ifimaster" + "\\documentclass{ifimaster} + [DEFAULT-PACKAGES] + [PACKAGES] + [EXTRA] + \\usepackage{babel,csquotes,ifimasterforside,url,varioref}" + ("\\chapter{%s}" . "\\chapter*{%s}") + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}") + ("\\paragraph{%s}" . "\\paragraph*{%s}") + ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))) - (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))) + (add-to-list 'org-latex-classes + '("easychair" "\\documentclass{easychair}" + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}") + ("\\paragraph{%s}" . "\\paragraph*{%s}") + ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))) - #+end_src + #+end_src + +** Babel + + Add a few languages for org-babel. + + #+begin_src emacs-lisp + + ;; Working with Code Blocks in Org + (use-package ob + :ensure nil + :after org + :config + (org-babel-do-load-languages + 'org-babel-load-languages + '((emacs-lisp . t) + (python . t) + (clojure . t) + (chatgpt-shell . t)))) + + #+end_src + + Default to use whatever interpreter is set by =python-shell-interpreter=. + + #+begin_src emacs-lisp + + ;; Babel Functions for Python + (use-package ob-python + :ensure nil + :after (ob python) + :config + (setq org-babel-python-command python-shell-interpreter)) + + #+end_src + +** Tempo + + Since version 9.2 of Org mode, typing =