add some stuff for LaTeX org export
This commit is contained in:
parent
2092b846b4
commit
8cc78d8ded
480
config.org
480
config.org
@ -1,8 +1,10 @@
|
|||||||
* Emacs Configuration
|
#+TITLE: Emacs Configuration
|
||||||
|
#+AUTHOR: Camden Dixie O'Brien
|
||||||
|
#+ATTR_LATEX: :float t
|
||||||
|
|
||||||
Shout out to Harry R. Schwartz; A whole bunch of this config
|
Shout out to Harry R. Schwartz; A whole bunch of this config
|
||||||
(including the idea of embeddeding the lot in an Org document) is
|
(including the idea of embeddeding the lot in an Org document) is
|
||||||
yanked from [[https://github.com/hts/dotfiles][his dotfiles repo]].
|
yanked from [[https://github.com/hrs/dotfiles][his dotfiles repo]].
|
||||||
|
|
||||||
The rest of this config grabs packages via =use-package=, so that
|
The rest of this config grabs packages via =use-package=, so that
|
||||||
needs to be set up to install them if they aren't already.
|
needs to be set up to install them if they aren't already.
|
||||||
@ -12,269 +14,305 @@ needs to be set up to install them if they aren't already.
|
|||||||
(setq use-package-always-ensure t)
|
(setq use-package-always-ensure t)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** UI
|
* UI
|
||||||
|
|
||||||
The start-up message gets pretty annoying, so disable that.
|
The start-up message gets pretty annoying, so disable that.
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(setq inhibit-startup-screen t)
|
(setq inhibit-startup-screen t)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
The default window size is just a little too small for my taste.
|
The default window size is just a little too small for my taste.
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(when window-system (set-frame-size (selected-frame) 90 48))
|
(when window-system (set-frame-size (selected-frame) 90 48))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
And I like a little more line spacing than default.
|
And I like a little more line spacing than default.
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(setq-default line-spacing 0.2)
|
(setq-default line-spacing 0.2)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
Also, the menu-, tool- and scroll-bar are ugly, take up space and I
|
Also, the menu-, tool- and scroll-bar are ugly, take up space and I
|
||||||
don't use them.
|
don't use them.
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(menu-bar-mode -1)
|
(menu-bar-mode -1)
|
||||||
(tool-bar-mode -1)
|
(tool-bar-mode -1)
|
||||||
(scroll-bar-mode -1)
|
(scroll-bar-mode -1)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
*** Colour Scheme
|
** Colour Scheme
|
||||||
|
|
||||||
Currently using =spacemacs-theme='s light variant, but I prefer a pure
|
Currently using =spacemacs-theme='s light variant, but I prefer a pure
|
||||||
white background to the off-white it has by default.
|
white background to the off-white it has by default.
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package spacemacs-theme
|
(use-package spacemacs-theme
|
||||||
:defer t)
|
:defer t)
|
||||||
(setq spacemacs-theme-custom-colors
|
(setq spacemacs-theme-custom-colors
|
||||||
'((bg1 . "#ffffff")
|
'((bg1 . "#ffffff")
|
||||||
(comment-bg . "#ffffff")))
|
(comment-bg . "#ffffff")))
|
||||||
(load-theme 'spacemacs-light t)
|
(load-theme 'spacemacs-light t)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
*** Font
|
** Font
|
||||||
|
|
||||||
I am addicted to programming ligatures but Fira Code (my preferred
|
I am addicted to programming ligatures but Fira Code (my preferred
|
||||||
ligature font) requires some hackery to display properly; this is
|
ligature font) requires some hackery to display properly; this is
|
||||||
defined in [[file:fira-code-mode/fira-code-mode.el][fira-code-mode.el]] so first we load that.
|
defined in [[file:fira-code-mode/fira-code-mode.el][fira-code-mode.el]] so first we load that.
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(add-to-list 'load-path "/home/cdo/.emacs.d/fira-code-mode")
|
(add-to-list 'load-path "/home/cdo/.emacs.d/fira-code-mode")
|
||||||
(require 'fira-code-mode)
|
(require 'fira-code-mode)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
And then make sure that mode is enabled for any =prog-mode= buffer.
|
And then make sure that mode is enabled for any =prog-mode= buffer.
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(add-hook 'prog-mode-hook 'fira-code-mode)
|
(add-hook 'prog-mode-hook 'fira-code-mode)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Magit
|
* Magit
|
||||||
|
|
||||||
=magit= is truly a wonderful creation! Only deviations from defaults
|
=magit= is truly a wonderful creation! Only deviations from defaults
|
||||||
here are a keybinding for =magit-status= and a maximum length for the
|
here are a keybinding for =magit-status= and a maximum length for the
|
||||||
summary line of commit messages (after which the excess is
|
summary line of commit messages (after which the excess is
|
||||||
highlighted).
|
highlighted).
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package magit
|
(use-package magit
|
||||||
:bind
|
:bind
|
||||||
("C-x g" . magit-status)
|
("C-x g" . magit-status)
|
||||||
:config
|
:config
|
||||||
(setq git-commit-summary-max-length 50))
|
(setq git-commit-summary-max-length 50))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Language Integrations
|
* Language Integrations
|
||||||
|
|
||||||
Generally, 8-character-wide tabs are not my thing.
|
Generally, 8-character-wide tabs are not my thing.
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(setq-default tab-width 4)
|
(setq-default tab-width 4)
|
||||||
(setq-default basic-offset 4)
|
(setq-default basic-offset 4)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
*** C
|
And generally indenting with spaces is more common, so make that the default:
|
||||||
|
|
||||||
For C, I like to indent with tabs and align with spaces: this
|
#+begin_src emacs-lisp
|
||||||
behaviour is provided by =smart-tabs-mode=.
|
(setq-default indent-tabs-mode nil)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
** C
|
||||||
(use-package smart-tabs-mode)
|
|
||||||
(smart-tabs-insinuate 'c)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
I'll generally format my code in BSD style but I also use
|
For C, I like to indent with tabs and align with spaces: this
|
||||||
=clang-format= a lot, so I have a keybinding to run that.
|
behaviour is provided by =smart-tabs-mode=.
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(setq c-default-style "bsd")
|
(use-package smart-tabs-mode)
|
||||||
(use-package clang-format)
|
(smart-tabs-insinuate 'c)
|
||||||
(add-hook 'c-mode-hook
|
#+end_src
|
||||||
(lambda ()
|
|
||||||
(define-key c-mode-map (kbd "C-M-f")
|
|
||||||
'clang-format-buffer)))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Meson is my build system of choice for C, but I also use CMake a lot.
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
I'll generally format my code in BSD style but I also use
|
||||||
(use-package meson-mode)
|
=clang-format= a lot, so I have a keybinding to run that.
|
||||||
(use-package cmake-mode)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
*** Haskell
|
#+begin_src emacs-lisp
|
||||||
|
(setq c-default-style "bsd")
|
||||||
My workflow with Haskell is very REPL-based, so I always want
|
(use-package clang-format)
|
||||||
=interactive-haskell-mode= on.
|
(add-hook 'c-mode-hook
|
||||||
|
(lambda ()
|
||||||
#+begin_src emacs-lisp
|
(define-key c-mode-map (kbd "C-M-f")
|
||||||
(use-package haskell-mode)
|
'clang-format-buffer)))
|
||||||
(require 'haskell-interactive-mode)
|
#+end_src
|
||||||
(add-hook 'haskell-mode-hook 'interactive-haskell-mode)
|
|
||||||
#+end_src
|
Meson is my build system of choice for C, but I also use CMake a lot.
|
||||||
|
|
||||||
And, of course, that REPL needs to be taking advantage of parallelism!
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(require 'haskell-process)
|
|
||||||
(set-variable 'haskell-process-args-ghci
|
|
||||||
'("-threaded" "+RTS" "-N8" "-RTS"))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
*** Idris
|
|
||||||
|
|
||||||
The only thing to change from the defaults here is to add a more
|
|
||||||
convenient way to case-split.
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package idris-mode)
|
|
||||||
(add-hook 'idris-mode-hook
|
|
||||||
(lambda ()
|
|
||||||
(define-key idris-mode-map (kbd "C-c SPC")
|
|
||||||
'idris-case-split)))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
*** Rust
|
#+begin_src emacs-lisp
|
||||||
|
(use-package meson-mode)
|
||||||
|
(use-package cmake-mode)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
I never really use Rust without Cargo, so always turn on the minor
|
** Haskell
|
||||||
mode for Cargo in Rust buffers.
|
|
||||||
|
My workflow with Haskell is very REPL-based, so I always want
|
||||||
|
=interactive-haskell-mode= on.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package haskell-mode)
|
||||||
|
(require 'haskell-interactive-mode)
|
||||||
|
(add-hook 'haskell-mode-hook 'interactive-haskell-mode)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
And, of course, that REPL needs to be taking advantage of parallelism!
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(require 'haskell-process)
|
||||||
|
(set-variable 'haskell-process-args-ghci
|
||||||
|
'("-threaded" "+RTS" "-N8" "-RTS"))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
** Idris
|
||||||
(use-package rust-mode)
|
|
||||||
(use-package cargo)
|
|
||||||
(add-hook 'rust-mode-hook 'cargo-minor-mode)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
*** Lisps
|
The only thing to change from the defaults here is to add a more
|
||||||
|
convenient way to case-split.
|
||||||
|
|
||||||
Get =racket-mode= for some Racket-specific things, like searching documentation
|
#+begin_src emacs-lisp
|
||||||
|
(use-package idris-mode)
|
||||||
|
(add-hook 'idris-mode-hook
|
||||||
|
(lambda ()
|
||||||
|
(define-key idris-mode-map (kbd "C-c SPC")
|
||||||
|
'idris-case-split)))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
** Rust
|
||||||
(use-package racket-mode)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Use SLIME and Quicklisp for Common Lisp (SBCL), with a convenient
|
|
||||||
binding for =slime-selector=
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
I never really use Rust without Cargo, so always turn on the minor
|
||||||
(use-package slime)
|
mode for Cargo in Rust buffers.
|
||||||
(setq inferior-lisp-program "sbcl")
|
|
||||||
(global-set-key (kbd "C-c s") 'slime-selector)
|
|
||||||
(load (expand-file-name "~/quicklisp/slime-helper.el"))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
=paredit= is generally very useful for balancing parenthesis so we
|
#+begin_src emacs-lisp
|
||||||
want that turned on for all the lisps. Additionally, it's nice to have
|
(use-package rust-mode)
|
||||||
an entire expression highlighted when the cursor is on one of its
|
(use-package cargo)
|
||||||
enclosing parens.
|
(add-hook 'rust-mode-hook 'cargo-minor-mode)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
** Lisps
|
||||||
(use-package paredit)
|
|
||||||
(setq lispy-mode-hooks
|
|
||||||
'(emacs-lisp-mode-hook
|
|
||||||
lisp-mode-hook
|
|
||||||
racket-mode-hook
|
|
||||||
scheme-mode-hook))
|
|
||||||
(dolist (hook lispy-mode-hooks)
|
|
||||||
(add-hook hook (lambda ()
|
|
||||||
(setq show-paren-style 'expression)
|
|
||||||
(paredit-mode))))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Org-mode
|
|
||||||
|
|
||||||
I use a couple non-standard bits and pieces, but not a whole bunch. I
|
|
||||||
really like the =<s= to insert a source block thing (which was
|
|
||||||
deprecated); =org-tempo= brings that back.
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package org
|
|
||||||
:ensure org-plus-contrib
|
|
||||||
:config
|
|
||||||
(require 'org-tempo))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Org is better suited as scratch space than Emacs lisp, I'd say.
|
Get =racket-mode= for some Racket-specific things, like searching documentation
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(setq initial-major-mode 'org-mode)
|
(use-package racket-mode)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
Set up a keybinding for =org-agenda= and tell it where to look.
|
Use SLIME and Quicklisp for Common Lisp (SBCL), with a convenient
|
||||||
|
binding for =slime-selector=
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(define-key global-map (kbd "C-c a") 'org-agenda)
|
(use-package slime)
|
||||||
(setq org-agenda-files '("~/org/events.org"
|
(setq inferior-lisp-program "sbcl")
|
||||||
"~/org/projects.org"
|
(global-set-key (kbd "C-c s") 'slime-selector)
|
||||||
"~/org/tasks.org"))
|
(load (expand-file-name "~/quicklisp/slime-helper.el"))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
Log when tasks were marked =DONE=, just for graphs.
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(setq org-log-done t)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
*** Source Blocks
|
|
||||||
|
|
||||||
Pressing tab inside a source block should indent appropriately for its
|
|
||||||
language.
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
=paredit= is generally very useful for balancing parenthesis so we
|
||||||
(setq org-src-tab-acts-natively t)
|
want that turned on for all the lisps. Additionally, it's nice to have
|
||||||
#+end_src
|
an entire expression highlighted when the cursor is on one of its
|
||||||
|
enclosing parens.
|
||||||
=babel= lets us evaluate Org documents containing source blocks! I
|
|
||||||
currently only use it for this very file, so it's only turned on for
|
|
||||||
Emacs lisp.
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(org-babel-do-load-languages
|
|
||||||
'org-babel-load-languages
|
|
||||||
'((emacs-lisp . t)))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
*** HTML Exporting
|
#+begin_src emacs-lisp
|
||||||
|
(use-package paredit)
|
||||||
|
(setq lispy-mode-hooks
|
||||||
|
'(emacs-lisp-mode-hook
|
||||||
|
lisp-mode-hook
|
||||||
|
racket-mode-hook
|
||||||
|
scheme-mode-hook))
|
||||||
|
(dolist (hook lispy-mode-hooks)
|
||||||
|
(add-hook hook (lambda ()
|
||||||
|
(setq show-paren-style 'expression)
|
||||||
|
(paredit-mode))))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
=htmlize= is needed for decent HTML exporting, and there is no need
|
* Org-mode
|
||||||
for all that stuff at the bottom.
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package htmlize)
|
|
||||||
(setq org-html-postamble nil)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Music Player
|
I use a couple non-standard bits and pieces, but not a whole bunch. I
|
||||||
|
really like the =<s= to insert a source block thing (which was
|
||||||
I use MPD because it is clearly the best way to play music; sometimes
|
deprecated); =org-tempo= brings that back.
|
||||||
it's nice to control it from Emacs, so I use MPDel for that.
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
#+begin_src emacs-lisp
|
(use-package org
|
||||||
(use-package mpdel
|
:ensure org-plus-contrib
|
||||||
:config
|
:config
|
||||||
(mpdel-mode))
|
(require 'org-tempo))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
Org is better suited as scratch space than Emacs lisp, I'd say.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(setq initial-major-mode 'org-mode)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
Set up a keybinding for =org-agenda= and tell it where to look.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(define-key global-map (kbd "C-c a") 'org-agenda)
|
||||||
|
(setq org-agenda-files '("~/org/events.org"
|
||||||
|
"~/org/projects.org"
|
||||||
|
"~/org/tasks.org"))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
Log when tasks were marked =DONE=, just for graphs.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(setq org-log-done t)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Source Blocks
|
||||||
|
|
||||||
|
Pressing tab inside a source block should indent appropriately for its
|
||||||
|
language.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(setq org-src-tab-acts-natively t)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
=babel= lets us evaluate Org documents containing source blocks! I
|
||||||
|
currently only use it for this very file, so it's only turned on for
|
||||||
|
Emacs lisp.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(org-babel-do-load-languages
|
||||||
|
'org-babel-load-languages
|
||||||
|
'((emacs-lisp . t)))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Exporting
|
||||||
|
|
||||||
|
*** HTML
|
||||||
|
|
||||||
|
=htmlize= is needed for decent HTML exporting, and there is no need
|
||||||
|
for all that stuff at the bottom.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package htmlize)
|
||||||
|
(setq org-html-postamble nil)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
*** LaTeX
|
||||||
|
|
||||||
|
Use =minted= (LaTeX package) to do syntax highlighting in code blocks:
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(add-to-list 'org-latex-packages-alist '("" "minted"))
|
||||||
|
(setq org-latex-listings 'minted)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
=minted= actually calls =pygments= through the shell, which =pdflatex=
|
||||||
|
doesn't like; you have to tell it not to worry, and that everything is
|
||||||
|
going to be OK.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(setq org-latex-pdf-process
|
||||||
|
'("xelatex -shell-escape -interaction nonstopmode -output-directory %o %f"
|
||||||
|
"xelatex -shell-escape -interaction nonstopmode -output-directory %o %f"
|
||||||
|
"xelatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
Also, I don't like Emacs' built-in PDF viewer, so open PDFs in [[https://mupdf.com/][MuPDF]] instead:
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(eval-after-load "org"
|
||||||
|
'(progn
|
||||||
|
(setcdr (assoc "\\.pdf\\'" org-file-apps) "mupdf %s")))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
* Music Player
|
||||||
|
|
||||||
|
I use MPD because it is clearly the best way to play music; sometimes
|
||||||
|
it's nice to control it from Emacs, so I use MPDel for that.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package mpdel
|
||||||
|
:config
|
||||||
|
(mpdel-mode))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user