Update emacs tangle

This commit is contained in:
Marco Thomas
2022-03-15 21:43:34 +01:00
parent 25a03bc77f
commit 1e31627469
3 changed files with 103 additions and 101 deletions

View File

@@ -1,41 +1,24 @@
#+TITLE:emacs configuration #+TITLE:emacs configuration
#+AUTHOR: Marco Thomas #+AUTHOR: Marco Thomas
#+PROPERTY: header-args :tangle "~/.emacs.d/init.el"
* Meta * Meta
** init.el vs init.org ** init.el vs init.org
All changes to the configuration should be done in =init.org=, *not* in All changes to the configuration should be done in =init.org=, *not* in
=init.el=. Any changes in the =init.el= will be overwritten by saving =init.el=.
=init.org=. The =init.el= in this repo should not be tracked by git, and
is replaced the first time Emacs is started (assuming it has been renamed
to =~/.emacs.d=).
This file replaces itself with the actual configuration at first run. This is what the initial =init.el= should look like.
#+BEGIN_SRC emacs-lisp :tangle no #+BEGIN_SRC emacs-lisp :tangle no
(require 'org) (require 'org)
(find-file (concat (getenv "HOME") "/.dots/files/emacs/.emacs.d/init.org")) (find-file (concat (getenv "HOME") "/.dots/files/emacs/.emacs.d/init.org"))
(org-babel-tangle) (org-babel-tangle)
(load-file (concat (getenv "HOME") "/.dots/files/emacs/.emacs.d/init.el")) (load-file (concat (getenv "HOME") "/.emacs.d/init.el"))
#+END_SRC
It tangles the org-file, so that this file is overwritten with the actual
configuration.
There is no reason to track the =init.el= that is generated; by running
the following command =git= will not bother tracking it:
#+BEGIN_SRC sh :tangle no
git update-index --assume-unchanged init.el
#+END_SRC
If one wishes to make changes to the repo-version of =init.el= start
tracking again with:
#+BEGIN_SRC sh :tangle no
git update-index --no-assume-unchanged init.el
#+END_SRC #+END_SRC
** Startup ** Startup
=lexical-binding= can improve speed. =lexical-binding= can improve speed.
#+BEGIN_SRC emacs-lisp :tangle yes #+BEGIN_SRC emacs-lisp
;;; -*- lexical-binding: t -*- ;;; -*- lexical-binding: t -*-
#+END_SRC #+END_SRC
@@ -50,7 +33,7 @@ To avoid doing this each time a change is made we can add a function to
the =after-save-hook= ensuring to always tangle and byte-compile the the =after-save-hook= ensuring to always tangle and byte-compile the
=org=-document after changes. =org=-document after changes.
#+BEGIN_SRC emacs-lisp :tangle yes #+BEGIN_SRC emacs-lisp
(defun tangle-init () (defun tangle-init ()
(when (equal (buffer-file-name) (when (equal (buffer-file-name)
(expand-file-name (concat (getenv "HOME") "/.dots/files/emacs/.emacs.d/init.org"))) (expand-file-name (concat (getenv "HOME") "/.dots/files/emacs/.emacs.d/init.org")))
@@ -66,7 +49,7 @@ the =after-save-hook= ensuring to always tangle and byte-compile the
A common optimization is to temporarily disable garbage collection during A common optimization is to temporarily disable garbage collection during
initialization. Here, we set the =gc-cons-threshold= to a ridiculously large initialization. Here, we set the =gc-cons-threshold= to a ridiculously large
number, and restore the default value after initialization. number, and restore the default value after initialization.
#+BEGIN_SRC emacs-lisp :tangle yes #+BEGIN_SRC emacs-lisp
(setq gc-cons-threshold most-positive-fixnum) (setq gc-cons-threshold most-positive-fixnum)
(add-hook 'emacs-startup-hook (add-hook 'emacs-startup-hook
(lambda () (lambda ()
@@ -78,7 +61,7 @@ number, and restore the default value after initialization.
** Performance ** Performance
*** lsp-mode *** lsp-mode
Some optimization for =lsp-mode= Some optimization for =lsp-mode=
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(setq read-process-output-max (* 3 1024 1024)) (setq read-process-output-max (* 3 1024 1024))
#+end_src #+end_src
@@ -86,7 +69,7 @@ Some optimization for =lsp-mode=
Disable bidirectional text scanning for a modest performance boost. I've set Disable bidirectional text scanning for a modest performance boost. I've set
this to =nil= in the past, but the =bidi-display-reordering='s docs say that this to =nil= in the past, but the =bidi-display-reordering='s docs say that
is an undefined state and suggest this to be just as good: is an undefined state and suggest this to be just as good:
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(setq-default bidi-display-reordering 'left-to-right (setq-default bidi-display-reordering 'left-to-right
bidi-paragraph-direction 'left-to-right) bidi-paragraph-direction 'left-to-right)
#+end_src #+end_src
@@ -95,26 +78,26 @@ Disabling the BPA makes redisplay faster, but might produce incorrect display
reordering of bidirectional text with embedded parentheses and other bracket reordering of bidirectional text with embedded parentheses and other bracket
characters whose =paired-bracket= Unicode property is non-nil. characters whose =paired-bracket= Unicode property is non-nil.
Emacs 27+ only. Emacs 27+ only.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(setq bidi-inhibit-bpa t) (setq bidi-inhibit-bpa t)
#+end_src #+end_src
Reduce rendering/line scan work for Emacs by not rendering cursors or regions Reduce rendering/line scan work for Emacs by not rendering cursors or regions
in non-focused windows. in non-focused windows.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(setq-default cursor-in-non-selected-windows nil) (setq-default cursor-in-non-selected-windows nil)
(setq highlight-nonselected-windows nil) (setq highlight-nonselected-windows nil)
#+end_src #+end_src
Emacs "updates" its ui more often than it needs to, so slow it down slightly. Emacs "updates" its ui more often than it needs to, so slow it down slightly.
Default is 0.5. Default is 0.5.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(setq idle-update-delay 1.0) (setq idle-update-delay 1.0)
#+end_src #+end_src
Introduced in Emacs HEAD (b2f8c9f), this inhibits fontification while Introduced in Emacs HEAD (b2f8c9f), this inhibits fontification while
receiving input, which should help a little with scrolling performance. receiving input, which should help a little with scrolling performance.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(setq redisplay-skip-fontification-on-input t) (setq redisplay-skip-fontification-on-input t)
#+end_src #+end_src
@@ -122,7 +105,7 @@ receiving input, which should help a little with scrolling performance.
** General ** General
*** Super general *** Super general
Some defaults, which i forget the reason of using it. Some defaults, which i forget the reason of using it.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(setq make-backup-files nil (setq make-backup-files nil
auto-mode-case-fold nil auto-mode-case-fold nil
auto-save-default nil auto-save-default nil
@@ -135,31 +118,31 @@ Some defaults, which i forget the reason of using it.
*** Auto revert *** Auto revert
Automaticly revert =doc-view=-buffers when the file changes on disk. Automaticly revert =doc-view=-buffers when the file changes on disk.
#+BEGIN_SRC emacs-lisp :tangle yes #+BEGIN_SRC emacs-lisp
(add-hook 'doc-view-mode-hook 'auto-revert-mode) (add-hook 'doc-view-mode-hook 'auto-revert-mode)
#+END_SRC #+END_SRC
*** Short yes/no *** Short yes/no
Answering /yes/ and /no/ to each question from Emacs can be tedious, a Answering /yes/ and /no/ to each question from Emacs can be tedious, a
single /y/ or /n/ will suffice. single /y/ or /n/ will suffice.
#+BEGIN_SRC emacs-lisp :tangle yes #+BEGIN_SRC emacs-lisp
(fset 'yes-or-no-p 'y-or-n-p) (fset 'yes-or-no-p 'y-or-n-p)
#+END_SRC #+END_SRC
*** Quit prompts *** Quit prompts
Make ESC quit prompts. Make ESC quit prompts.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(global-set-key (kbd "<escape>") 'keyboard-escape-quit) (global-set-key (kbd "<escape>") 'keyboard-escape-quit)
#+end_src #+end_src
*** Soft wrap *** Soft wrap
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(global-visual-line-mode t) (global-visual-line-mode t)
#+end_src #+end_src
** straight.el (Packages) ** straight.el (Packages)
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(setq straight-check-for-modifications 'live) (setq straight-check-for-modifications 'live)
(defvar bootstrap-version) (defvar bootstrap-version)
@@ -177,7 +160,7 @@ Make ESC quit prompts.
#+end_src #+end_src
Inhibit package.el from loading, as we don't need it. Inhibit package.el from loading, as we don't need it.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(setq package-enable-at-startup nil) (setq package-enable-at-startup nil)
(straight-use-package 'use-package) (straight-use-package 'use-package)
#+end_src #+end_src
@@ -186,7 +169,7 @@ Inhibit package.el from loading, as we don't need it.
** Keybindings ** Keybindings
*** leader key *** leader key
=general= allows me to use key-binds with a leader key, just like =vim=. =general= allows me to use key-binds with a leader key, just like =vim=.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package general (use-package general
:straight t :straight t
:init :init
@@ -195,7 +178,7 @@ Inhibit package.el from loading, as we don't need it.
*** which-key *** which-key
Show me a cool completion bar at the bottom of the screen, with all possible keybindings. Show me a cool completion bar at the bottom of the screen, with all possible keybindings.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package which-key (use-package which-key
:straight t :straight t
:init :init
@@ -208,7 +191,7 @@ Show me a cool completion bar at the bottom of the screen, with all possible key
*** evil-mode *** evil-mode
Forgive me, but I'm =evil=. Forgive me, but I'm =evil=.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package evil (use-package evil
:straight t :straight t
:bind :bind
@@ -246,7 +229,7 @@ I mainly use these fonts:
+ JuliaMono as main mono-spaced + JuliaMono as main mono-spaced
+ Noto Emoji to show emojis in emacs + Noto Emoji to show emojis in emacs
+ Noto JP for japanese characters + Noto JP for japanese characters
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(set-face-attribute 'default nil :font "JuliaMono" :height 100) (set-face-attribute 'default nil :font "JuliaMono" :height 100)
(set-fontset-font t 'unicode "Noto Color Emoji" nil 'prepend) (set-fontset-font t 'unicode "Noto Color Emoji" nil 'prepend)
(set-fontset-font t 'unicode "Noto Sans Mono CJK JP" nil 'append) (set-fontset-font t 'unicode "Noto Sans Mono CJK JP" nil 'append)
@@ -267,7 +250,7 @@ Blocks will still be mono-spaced.
*** Bars *** Bars
I don't need ugly ass bars. I don't need ugly ass bars.
#+begin_src emacs-lisp :tangle yes #+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)
@@ -275,14 +258,14 @@ I don't need ugly ass bars.
*** Parenthesis *** Parenthesis
Show me the friend of my parenthesis. Show me the friend of my parenthesis.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(show-paren-mode t) (show-paren-mode t)
(setq show-paren-style 'paranthesis) (setq show-paren-style 'paranthesis)
#+end_src #+end_src
*** Line numbers *** Line numbers
Show me relative line numbers, when in =normal= mode and absolute ones, when in =insert= mode. Show me relative line numbers, when in =normal= mode and absolute ones, when in =insert= mode.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(setq-default display-line-numbers 'relative (setq-default display-line-numbers 'relative
display-line-numbers-widen t display-line-numbers-widen t
;; this is the default ;; this is the default
@@ -300,17 +283,16 @@ Show me relative line numbers, when in =normal= mode and absolute ones, when in
#+end_src #+end_src
Show me both line and column counter in my bar. Show me both line and column counter in my bar.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(line-number-mode) (line-number-mode)
(column-number-mode) (column-number-mode)
#+end_src #+end_src
*** Theme *** Theme
Setting my beloved light theme with some icons. Setting my beloved light theme with some icons.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package doom-themes (use-package doom-themes
:straight (doom-themes :type git :host github :repo "hlissner/emacs-doom-themes" :straight (doom-themes :type git :host github :repo "hlissner/emacs-doom-themes")
:fork (:host github :repo "CramMK/emacs-doom-themes"))
:config :config
(setq doom-themes-enable-bold t (setq doom-themes-enable-bold t
doom-themes-enable-italic t doom-themes-enable-italic t
@@ -322,7 +304,7 @@ Setting my beloved light theme with some icons.
*** Modeline *** Modeline
Use =doom-modeline= as a bar... together with icons and nyan cat! Use =doom-modeline= as a bar... together with icons and nyan cat!
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package doom-modeline (use-package doom-modeline
:straight t :straight t
:config :config
@@ -345,18 +327,18 @@ Use =doom-modeline= as a bar... together with icons and nyan cat!
*** Inline colors *** Inline colors
Show me color codes as colors! Show me color codes as colors!
TODO: Disable this in c/c++ mode. #+begin_src emacs-lisp
#+begin_src emacs-lisp :tangle yes
(use-package rainbow-mode (use-package rainbow-mode
:straight t :straight t
:hook :hook
(prog-mode . rainbow-mode) (prog-mode . rainbow-mode)
(org-mode . rainbow-mode)) (org-mode . rainbow-mode)
(c-mode . (lambda() (rainbow-mode -1))))
#+end_src #+end_src
*** Whitespaces *** Whitespaces
Show me those pesky trailing whitespaces... I hate them. Kill them. Show me those pesky trailing whitespaces... I hate them. Kill them.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(global-whitespace-mode t) (global-whitespace-mode t)
(setq whitespace-style '(face trailing tabs tab-mark)) (setq whitespace-style '(face trailing tabs tab-mark))
(add-hook 'before-save-hook 'whitespace-cleanup) (add-hook 'before-save-hook 'whitespace-cleanup)
@@ -381,7 +363,7 @@ Show me a nice column indicator line.
*** Highlight indentation *** Highlight indentation
Show me indentation markers. Show me indentation markers.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package highlight-indent-guides (use-package highlight-indent-guides
:straight t :straight t
:config :config
@@ -393,7 +375,7 @@ Show me indentation markers.
*** File bar *** File bar
Sometimes I want to see all of my files. Sometimes I want to see all of my files.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package treemacs (use-package treemacs
:straight t :straight t
:defer t :defer t
@@ -438,7 +420,7 @@ Sometimes I want to see all of my files.
*** ivy *** ivy
Ivy - a generic completion frontend for Emacs. Ivy - a generic completion frontend for Emacs.
Swiper - isearch with an overview, and more. Oh, man! Swiper - isearch with an overview, and more. Oh, man!
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package ivy (use-package ivy
:straight t :straight t
:diminish :diminish
@@ -461,7 +443,7 @@ Swiper - isearch with an overview, and more. Oh, man!
*** counsel *** counsel
Spice up some of those old buffers. Spice up some of those old buffers.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package counsel (use-package counsel
:straight t :straight t
:bind (("M-x" . counsel-M-x) :bind (("M-x" . counsel-M-x)
@@ -477,7 +459,7 @@ Spice up some of those old buffers.
*** Setup and keys *** Setup and keys
Bootstrap =org-mode= together with keybindings. Bootstrap =org-mode= together with keybindings.
=C-c C-t= for =org-todo=. =C-c C-t= for =org-todo=.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package org (use-package org
:straight t :straight t
:general :general
@@ -498,7 +480,7 @@ Bootstrap =org-mode= together with keybindings.
#+end_src #+end_src
*** Misc *** Misc
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(setq org-startup-with-inline-images t ;; start with inline images enabled (setq org-startup-with-inline-images t ;; start with inline images enabled
org-image-actual-width nil ;; rescale inline images org-image-actual-width nil ;; rescale inline images
org-directory "~/org" ;; set org file directory org-directory "~/org" ;; set org file directory
@@ -510,14 +492,14 @@ Bootstrap =org-mode= together with keybindings.
*** org-todo faces *** org-todo faces
Which =org-todo= keywords should be used and how they look. Which =org-todo= keywords should be used and how they look.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(setq org-todo-keywords '((sequence "TODO" "PROGRESS" "REVIEW" "|" "DONE")) (setq org-todo-keywords '((sequence "TODO" "PROGRESS" "REVIEW" "|" "DONE"))
org-todo-keyword-faces '(("TODO" . "#cc241d") ("PROGRESS" . "#a6cc70") ("REVIEW" . "#b16286") ("DONE" . "#abb0b6"))) org-todo-keyword-faces '(("TODO" . "#cc241d") ("PROGRESS" . "#a6cc70") ("REVIEW" . "#b16286") ("DONE" . "#abb0b6")))
#+end_src #+end_src
*** org-capture *** org-capture
Set some capture templates, for quick notes. Set some capture templates, for quick notes.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(setq org-capture-templates (setq org-capture-templates
(quote (("w" "Work" entry (file "~/org/work.org") "* TODO %?\n" :empty-lines-before 1) (quote (("w" "Work" entry (file "~/org/work.org") "* TODO %?\n" :empty-lines-before 1)
("u" "University" entry (file "~/org/uni.org") "* TODO %?\n" :empty-lines-before 1) ("u" "University" entry (file "~/org/uni.org") "* TODO %?\n" :empty-lines-before 1)
@@ -528,12 +510,13 @@ Set some capture templates, for quick notes.
Executing code inline is just a breeze. Executing code inline is just a breeze.
Firstly tho, they must be enabled here. Firstly tho, they must be enabled here.
Also be *careful* with =haskell= recursion, it can lead to system crashes (at least for me). Also be *careful* with =haskell= recursion, it can lead to system crashes (at least for me).
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(org-babel-do-load-languages 'org-babel-load-languages '((python . t) (org-babel-do-load-languages 'org-babel-load-languages '((python . t)
(shell . t) (shell . t)
(haskell . t) (haskell . t)
(C . t) (C . t)
(dot . t))) (dot . t)
(octave . t)))
(use-package sage-shell-mode (use-package sage-shell-mode
:straight t) :straight t)
@@ -544,7 +527,7 @@ Also be *careful* with =haskell= recursion, it can lead to system crashes (at l
*** org-agenda *** org-agenda
The default =agenda= looks a bit messy. The default =agenda= looks a bit messy.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package org-super-agenda (use-package org-super-agenda
:straight t :straight t
:after org :after org
@@ -554,7 +537,7 @@ The default =agenda= looks a bit messy.
#+end_src #+end_src
Setup some stuff for =agenda= Setup some stuff for =agenda=
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(setq org-agenda-files (quote ("~/org")) ;; indexed files by org agenda (setq org-agenda-files (quote ("~/org")) ;; indexed files by org agenda
org-agenda-start-on-weekday nil ;; my week starts on a monday org-agenda-start-on-weekday nil ;; my week starts on a monday
calendar-week-start-day 1 ;; my week starts on a monday calendar-week-start-day 1 ;; my week starts on a monday
@@ -562,7 +545,7 @@ Setup some stuff for =agenda=
#+end_src #+end_src
I need my =hjkl= :( I need my =hjkl= :(
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(define-key org-agenda-mode-map (kbd "h") 'org-agenda-earlier) (define-key org-agenda-mode-map (kbd "h") 'org-agenda-earlier)
(define-key org-agenda-mode-map (kbd "l") 'org-agenda-later) (define-key org-agenda-mode-map (kbd "l") 'org-agenda-later)
(define-key org-agenda-mode-map (kbd "j") 'org-agenda-next-line) (define-key org-agenda-mode-map (kbd "j") 'org-agenda-next-line)
@@ -576,39 +559,50 @@ I need my =hjkl= :(
(define-key org-super-agenda-header-map (kbd "t") 'org-agenda-goto-today) (define-key org-super-agenda-header-map (kbd "t") 'org-agenda-goto-today)
#+end_src #+end_src
*** org-ref
#+begin_src emacs-lisp
(use-package org-ref
:straight t
:after org
:init
(setq org-ref-completion-library 'org-ref-ivy-cite))
#+end_src
*** LaTeX Export *** LaTeX Export
Enable LaTeX export with =pdflatex= and use =minted= for code highlighting. Enable LaTeX export with =pdflatex= and use =minted= for code highlighting.
Also fix math =utf8= chars. Also fix math =utf8= chars.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(setq org-latex-listings 'minted (setq org-latex-listings 'minted
org-latex-packages-alist '(("" "minted")) org-latex-packages-alist '(("" "minted"))
org-latex-pdf-process org-latex-pdf-process
'("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"bibtex %b"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f") "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f")
org-latex-inputenc-alist '(("utf8" . "utf8x")) org-latex-inputenc-alist '(("utf8" . "utf8x"))
org-latex-default-packages-alist (cons '("mathletters" "ucs" nil) org-latex-default-packages-alist) org-latex-default-packages-alist (cons '("mathletters" "ucs" nil) org-latex-default-packages-alist)
org-format-latex-options (plist-put org-format-latex-options :scale 0.5)) org-format-latex-options (plist-put org-format-latex-options :scale 1))
#+end_src #+end_src
For some reason =\alert= is misinterpreted in LaTeX. For some reason =\alert= is misinterpreted in LaTeX.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(defun mth/beamer-bold (contents backend info) (defun mth/beamer-bold (contents backend info)
(when (eq backend 'beamer) (when (eq backend 'beamer)
(replace-regexp-in-string "\\`\\\\[A-Za-z0-9]+" "\\\\textbf" contents))) (replace-regexp-in-string "\\`\\\\[A-Za-z0-9]+" "\\\\textbf" contents)))
#+end_src #+end_src
Use the above fix and disable creating of =.tex= files. Use the above fix and disable creating of =.tex= files.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package ox (use-package ox
:after org :after org
:config :config
(add-to-list 'org-export-filter-bold-functions 'mth/beamer-bold) (add-to-list 'org-export-filter-bold-functions 'mth/beamer-bold)
(add-to-list 'org-latex-logfiles-extensions "tex")) (add-to-list 'org-latex-logfiles-extensions "tex")
(add-to-list 'org-latex-logfiles-extensions "bbl"))
#+end_src #+end_src
Show math equations inline! Show math equations inline!
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp :tangle no
(use-package org-fragtog (use-package org-fragtog
:straight t :straight t
:hook :hook
@@ -616,7 +610,7 @@ Show math equations inline!
#+end_src #+end_src
Use graphivz to draw graphs. Use graphivz to draw graphs.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package graphviz-dot-mode (use-package graphviz-dot-mode
:straight t :straight t
:hook :hook
@@ -627,7 +621,7 @@ Use graphivz to draw graphs.
*** Fonts and fancy *** Fonts and fancy
Some custom fonts stuff. Some custom fonts stuff.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(setq org-ellipsis " ⮷" ;; folding icon (setq org-ellipsis " ⮷" ;; folding icon
;; org-hide-emphasis-markers t ;; hide markers such as *, =, _ ;; org-hide-emphasis-markers t ;; hide markers such as *, =, _
) )
@@ -635,7 +629,7 @@ Some custom fonts stuff.
I want my =org-bullets= to look fancy, so I'm using some UTF8 chars. I want my =org-bullets= to look fancy, so I'm using some UTF8 chars.
Use =(setq inhibit-compacting-font-caches t)=, if performance is low. Use =(setq inhibit-compacting-font-caches t)=, if performance is low.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package org-superstar (use-package org-superstar
:straight t :straight t
:after org :after org
@@ -650,7 +644,7 @@ Use =(setq inhibit-compacting-font-caches t)=, if performance is low.
** General programming tools ** General programming tools
*** Indentation *** Indentation
Use some magic heuristics for indentation. Use some magic heuristics for indentation.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package dtrt-indent (use-package dtrt-indent
:straight t :straight t
:hook :hook
@@ -662,7 +656,7 @@ Use some magic heuristics for indentation.
*** Auto pairs *** Auto pairs
Auto matching pairs are reaaaaally nice. Auto matching pairs are reaaaaally nice.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package electric-pair (use-package electric-pair
:config :config
(setq electric-pair-open-newline-between-pairs nil) (setq electric-pair-open-newline-between-pairs nil)
@@ -673,9 +667,9 @@ Auto matching pairs are reaaaaally nice.
(markdown-mode . electric-pair-mode)) (markdown-mode . electric-pair-mode))
#+end_src #+end_src
*** Git *** =git=
=magit= aka most convenient git client, I've ever used. =magit= aka most convenient git client, I've ever used.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package magit (use-package magit
:straight t :straight t
:general :general
@@ -699,7 +693,7 @@ Auto matching pairs are reaaaaally nice.
*** Highlight todo's *** Highlight todo's
Sometimes, a big red TODO is more intimidating than one with normal text color. Sometimes, a big red TODO is more intimidating than one with normal text color.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package hl-todo (use-package hl-todo
:straight t :straight t
:hook :hook
@@ -719,7 +713,7 @@ Sometimes, a big red TODO is more intimidating than one with normal text color.
** Code completion ** Code completion
*** completion *** completion
First of all, we need a backend for our completion and analysis. First of all, we need a backend for our completion and analysis.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package company (use-package company
:straight t :straight t
:hook :hook
@@ -737,7 +731,7 @@ First of all, we need a backend for our completion and analysis.
#+end_src #+end_src
Then we can sprinkle in a fancy front-end for it. Then we can sprinkle in a fancy front-end for it.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package company-box (use-package company-box
:straight t :straight t
:config :config
@@ -750,7 +744,7 @@ Then we can sprinkle in a fancy front-end for it.
*** snippets *** snippets
**** completion **** completion
Here I use =company= to display snippet recommendations. Here I use =company= to display snippet recommendations.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(defun company-mode/backend-with-yas (backend) (defun company-mode/backend-with-yas (backend)
(if (and (listp backend) (member 'company-yasnippet backend)) (if (and (listp backend) (member 'company-yasnippet backend))
backend backend
@@ -762,7 +756,7 @@ Here I use =company= to display snippet recommendations.
#+end_src #+end_src
**** yasnippet **** yasnippet
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package yasnippet (use-package yasnippet
:straight t :straight t
:init :init
@@ -774,7 +768,7 @@ Here I use =company= to display snippet recommendations.
#+end_src #+end_src
We also need the actual snippets. We also need the actual snippets.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package yasnippet-snippets (use-package yasnippet-snippets
:straight (yasnippet-snippets :type git :host github :repo "AndreaCrotti/yasnippet-snippets" :straight (yasnippet-snippets :type git :host github :repo "AndreaCrotti/yasnippet-snippets"
:fork (:host github :fork (:host github
@@ -786,7 +780,7 @@ We also need the actual snippets.
** LSP and projects ** LSP and projects
*** lsp-mode *** lsp-mode
=lsp-mode= is feature-richer than =eglot=, so I'm using this one. =lsp-mode= is feature-richer than =eglot=, so I'm using this one.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package lsp-mode :straight t (use-package lsp-mode :straight t
:commands (lsp lsp-deferred) :commands (lsp lsp-deferred)
:init :init
@@ -805,7 +799,7 @@ We also need the actual snippets.
#+end_src #+end_src
In order for =lsp-mode= to work, it needs to compile code on the =fly=. In order for =lsp-mode= to work, it needs to compile code on the =fly=.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package flycheck (use-package flycheck
:straight t :straight t
:after lsp) :after lsp)
@@ -813,7 +807,7 @@ In order for =lsp-mode= to work, it needs to compile code on the =fly=.
*** tags *** tags
=tags= can be used to search for =tagged= entities, such as =structs= etc. =tags= can be used to search for =tagged= entities, such as =structs= etc.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package lsp-ivy (use-package lsp-ivy
:straight t :straight t
:after lsp-mode :after lsp-mode
@@ -821,7 +815,7 @@ In order for =lsp-mode= to work, it needs to compile code on the =fly=.
#+end_src #+end_src
*** projects *** projects
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package projectile (use-package projectile
:straight t :straight t
:after lsp :after lsp
@@ -833,7 +827,7 @@ In order for =lsp-mode= to work, it needs to compile code on the =fly=.
*** language servers *** language servers
**** rust **** rust
Basic =rust-mode= with some fancy characters. Basic =rust-mode= with some fancy characters.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package rust-mode (use-package rust-mode
:straight t :straight t
:hook :hook
@@ -847,14 +841,14 @@ Basic =rust-mode= with some fancy characters.
#+end_src #+end_src
I want to use =rust-analyzer= and see inlay type hints for variables. I want to use =rust-analyzer= and see inlay type hints for variables.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(setq lsp-rust-server 'rust-analyzer (setq lsp-rust-server 'rust-analyzer
lsp-rust-analyzer-server-display-inlay-hints t) lsp-rust-analyzer-server-display-inlay-hints t)
(add-hook 'rust-mode 'lsp-rust-analyzer-inlay-hints-mode) (add-hook 'rust-mode 'lsp-rust-analyzer-inlay-hints-mode)
#+end_src #+end_src
**** haskell **** haskell
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package haskell-mode (use-package haskell-mode
:straight t :straight t
:hook :hook
@@ -877,9 +871,17 @@ I want to use =rust-analyzer= and see inlay type hints for variables.
**** python **** python
Python's lsp has auto configuration for =lsp-mode= Python's lsp has auto configuration for =lsp-mode=
*** octave
#+begin_src emacs-lisp
(use-package octave-mode
:mode ("\\.m\\'" . octave-mode)
:hook
(octave-mode . company-mode))
#+end_src
** Debugging with dap-mode
#+begin_src emacs-lisp :tangle yes ** Debugging with =dap-mode=
#+begin_src emacs-lisp
(use-package dap-mode (use-package dap-mode
:straight t) :straight t)
#+end_src #+end_src
@@ -887,7 +889,7 @@ Python's lsp has auto configuration for =lsp-mode=
*** python *** python
Setup some things to use dap-mode together with python. Setup some things to use dap-mode together with python.
It depends on =ptvsd=, which can be installed via =pip=. It depends on =ptvsd=, which can be installed via =pip=.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(require 'dap-python) (require 'dap-python)
#+end_src #+end_src
@@ -898,7 +900,7 @@ TODO: add rust config for debugging
** Input methods ** Input methods
*** spelling *** spelling
Sjoe my speling misttakes. Sjoe my speling misttakes.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package ispell (use-package ispell
:straight t :straight t
:if (executable-find "hunspell") :if (executable-find "hunspell")
@@ -915,7 +917,7 @@ Sjoe my speling misttakes.
*** math *** math
Who needs LaTeX when you can have the power of unicode? Who needs LaTeX when you can have the power of unicode?
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package math-symbol-lists (use-package math-symbol-lists
:straight t :straight t
:config :config
@@ -998,7 +1000,7 @@ Keybinds:
+ =C-s=: search, just as in =swiper= + =C-s=: search, just as in =swiper=
+ =C-s= (again): forward search + =C-s= (again): forward search
+ =C-r=: backward search + =C-r=: backward search
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp
(use-package pdf-tools (use-package pdf-tools
:straight t :straight t
:config :config

View File

@@ -17,9 +17,8 @@
#+LATEX_HEADER: \usepackage{tikz} #+LATEX_HEADER: \usepackage{tikz}
#+LATEX_HEADER: \usepackage{graphicx} #+LATEX_HEADER: \usepackage{graphicx}
#+LATEX_HEADER: \usepackage{listings} #+LATEX_HEADER: \usepackage{listings}
#+LATEX_HEADER: \usepackage{color}
#+LATEX_HEADER: \usepackage{proof}
#+LATEX_HEADER: \usepackage{xcolor} #+LATEX_HEADER: \usepackage{xcolor}
#+LATEX_HEADER: \usepackage{color}
%%% break page on new section %%% break page on new section
#+LATEX_HEADER: \usepackage{titlesec} #+LATEX_HEADER: \usepackage{titlesec}
@@ -37,6 +36,7 @@
#+LATEX_HEADER: \fancyhead[R]{\thepage} #+LATEX_HEADER: \fancyhead[R]{\thepage}
%%% theorem-style environments %%% theorem-style environments
#+LATEX_HEADER: \usepackage{proof}
% use `most` if you don't want the boxes % use `most` if you don't want the boxes
#+LATEX_HEADER: \usepackage[]{tcolorbox} #+LATEX_HEADER: \usepackage[]{tcolorbox}

View File

@@ -5,6 +5,7 @@
#+OPTIONS: toc:t H:2 #+OPTIONS: toc:t H:2
#+BEAMER_THEME: Singapore #+BEAMER_THEME: Singapore
#+BEAMER_COLOR_THEME: rose #+BEAMER_COLOR_THEME: rose
#+LATEX_HEADER: \date{\today}
#+COLUMNS: %40ITEM %10BEAMER_env(Env) %9BEAMER_envargs(Env Args) %4BEAMER_col(Col) %10BEAMER_extra(Extra) #+COLUMNS: %40ITEM %10BEAMER_env(Env) %9BEAMER_envargs(Env Args) %4BEAMER_col(Col) %10BEAMER_extra(Extra)
@@ -22,4 +23,3 @@
#+LATEX_HEADER: \usepackage{color} #+LATEX_HEADER: \usepackage{color}
#+LATEX_HEADER: \usepackage{proof} #+LATEX_HEADER: \usepackage{proof}
#+LATEX_HEADER: \date{\today}