summaryrefslogtreecommitdiff
path: root/emacs-init.org
diff options
context:
space:
mode:
Diffstat (limited to 'emacs-init.org')
-rw-r--r--emacs-init.org168
1 files changed, 117 insertions, 51 deletions
diff --git a/emacs-init.org b/emacs-init.org
index ea29924..23f5309 100644
--- a/emacs-init.org
+++ b/emacs-init.org
@@ -1,5 +1,5 @@
# -*- coding: utf-8-unix -*-
-#+PROPERTY: header-args:emacs-lisp :tangle tangle/emacs-init.el :results silent :noweb yes
+#+PROPERTY: header-args:emacs-lisp :tangle tangle/emacs-10-init.el :results silent :noweb yes
* Contents :QUOTE:TOC_2_gh:
#+BEGIN_QUOTE
- [[#overview][Overview]]
@@ -77,10 +77,10 @@ directory. Instead of symlinking the files could also be directly
tangled to =~/.emacs.d/=.
#+BEGIN_SRC shell :results silent :tangle tangle/symlink.sh :shebang "#!/bin/bash" :noweb yes
ln -siv $(pwd)/emacs-init.org ~/.emacs.d/
-ln -siv $(pwd)/tangle/emacs-init.el ~/.emacs.d/
-ln -siv $(pwd)/tangle/init-exwm.el ~/.emacs.d/
-ln -siv $(pwd)/emacs-private.el.gpg ~/.emacs.d/
ln -siv $(pwd)/tangle/init.el ~/.emacs.d/
+ln -siv $(pwd)/tangle/emacs-10-init.el ~/.emacs.d/
+ln -siv $(pwd)/tangle/init-exwm.el ~/.emacs.d/
+ls emacs-*.el.gpg | xargs -I FILE ln -siv $(pwd)/FILE ~/.emacs.d
<<symlinks>>
#+END_SRC
@@ -167,12 +167,11 @@ git config --global diff.gpg.textconv "gpg --no-tty --decrypt"
echo "*.gpg filter=gpg diff=gpg" > .gitattributes
#+end_src
A similar behaviour can be achieved using [[https://github.com/AGWA/git-crypt][git-crypt]]. I save private
-details regarding my emacs configuration in =emacs-private.el.gpg= and
-load this file here.
-#+begin_src emacs-lisp
-(setq secret-file (expand-file-name "emacs-private.el.gpg"
- user-emacs-directory))
-(load secret-file)
+details regarding my emacs configuration in =.el.gpg= files and
+load them in =init.el= using some code like this.
+#+begin_src emacs-lisp :tangle no
+(mapc (lambda (file) (load file))
+ (directory-files default-directory t "^emacs-.*el.gpg$"))
#+end_src
This is the content of =init.el=. Notice the ~:tangle tangle/init.el~
@@ -191,7 +190,8 @@ header argument in the source code.
(append default-frame-alist '((inhibit-double-buffering . t))))
(setq posframe-inhibit-double-buffering t)
-(load (expand-file-name "emacs-init.el" user-emacs-directory))
+(mapc (lambda (file) (load file))
+ (directory-files user-emacs-directory t "^emacs-.*el\\(.gpg\\)\\{0,1\\}"))
#+end_src
I always wanted to reorganize my old init file with >5000 lines, but
@@ -217,6 +217,7 @@ with other package definition and customization.
;; (package-initialize)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") nil)
+(package-refresh-contents t)
#+END_SRC
*** straight.el
:PROPERTIES:
@@ -1386,7 +1387,7 @@ This call now creates a custom theme based on the settings in the sections
#+end_src
Now we just have to link the tangled themes to the ~load-path~
-#+BEGIN_SRC shell :results silent :tangle tangle/symlink.sh :shebang "#!/bin/bash"
+#+BEGIN_SRC shell :results silent :noweb-ref symlinks :tangle no
ln -siv $(pwd)/tangle/spacemacs-dark-customizations-theme.el ~/.emacs.d/
ln -siv $(pwd)/tangle/spacemacs-light-customizations-theme.el ~/.emacs.d/
#+END_SRC
@@ -1682,7 +1683,12 @@ When switching between monitors with different resolution, scaling the
(scale (if arg -10 10))
(new (+ height scale)))
(set-face-attribute 'default nil :height new)
- (message "Default height: %s" new)))
+ (message "Default height: %s. Use +,- for further adjustment" new)
+ (set-transient-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map (vector '(?-)) (lambda () (interactive) (fpi/scale-default-face t)))
+ (define-key map (vector '(?+)) (lambda () (interactive) (fpi/scale-default-face nil)))
+ map))))
#+end_src
#+begin_src emacs-lisp :tangle no :noweb-ref fpi-bindings
(fpi/define-key fpi-map (kbd "+") #'fpi/scale-default-face "Zoom")
@@ -2455,7 +2461,8 @@ of src_shell{getconf "PATH"}. See [[elisp:(describe-variable
#+end_src
** Git
*** Git annex
-There are some great ressources on [[https://git-annex.branchable.com/][git-annex]] integration in emacs in [[https://github.com/mm--/dot-emacs/blob/master/jmm-emacs.org][Josh's config]]. Most of my configuration is copied from there.
+There are some great resources on [[https://git-annex.branchable.com/][git-annex]] integration in emacs in [[https://github.com/mm--/dot-emacs/blob/master/jmm-emacs.org][Josh's config]]. Most of my configuration is copied from there.
+Or use magit-annex instead?
#+begin_src emacs-lisp :noweb-ref straight-recipe-overrides :tangle no :eval never
(git-annex :type git :flavor melpa :host github :repo "jwiegley/git-annex-el")
#+end_src
@@ -2464,7 +2471,7 @@ There are some great ressources on [[https://git-annex.branchable.com/][git-anne
:straight (:host github :repo "fpiper/git-annex-el" :branch "master")
:config
<<git-annex-config>>
- :after (dired)
+ :after dired
:bind
(:map git-annex-dired-map
<<git-annex-dired-bindings>>)
@@ -2794,7 +2801,7 @@ For example, ARGS could be \"--in=here\""
#+BEGIN_SRC emacs-lisp
(use-package magit
:straight t
- :custom (magit-completing-read-function 'magit-ido-completing-read)
+ :custom (magit-completing-read-function 'magit-builtin-completing-read)
:init (global-magit-file-mode))
#+END_SRC
@@ -3322,8 +3329,6 @@ I use a org version with some custom patches. Rather than using something like =
("C-c a" . org-agenda)
("C-c l" . org-store-link))
:custom
- (org-format-latex-options '(:foreground default :background default :scale 1.5 :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 :matchers
- ("begin" "$1" "$" "$$" "\\(" "\\[")))
(org-catch-invisible-edits 'smart)
(org-agenda-diary-file "~/sync/diary.org")
(org-use-speed-commands (lambda () (and (looking-at org-outline-regexp) (looking-back "^\**"))))
@@ -3342,8 +3347,9 @@ I use a org version with some custom patches. Rather than using something like =
<<org-custom-no-inheritance-tags>>
))
<<org-custom>>
+ :hook
+ <<org-hook>>
:config
- (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
(add-to-list 'org-structure-template-alist (cons "f" "figure"))
;; (add-to-list 'org-tags-exclude-from-inheritance "MARKED")
<<org-config>>
@@ -3407,10 +3413,6 @@ I use a org version with some custom patches. Rather than using something like =
#+END_SRC
#+begin_src emacs-lisp
-(use-package ox
- :custom
- (org-export-with-broken-links 'match)
- (org-export-backends '(ascii beamer html icalendar latex man md odt org groff koma-letter)))
(use-package org-pdftools
:straight t
:hook (org-load . org-pdftools-setup-link))
@@ -3419,7 +3421,6 @@ I use a org version with some custom patches. Rather than using something like =
(org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id)
<<org-id-custom>>)
#+end_src
-
I prefer to use timestamp based ID's as they are
#+begin_src emacs-lisp :tangle no :noweb-ref org-id-custom
(org-id-method 'ts)
@@ -3495,11 +3496,19 @@ Here is a list of nice ones: ◉, ○, ►, •. The default ones are ~'("◉" "
:custom (org-bullets-bullet-list '(" "))
:config (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
#+end_src
-Use imagemagick and standalone class for latex preview.
#+begin_src emacs-lisp
-(setq org-preview-latex-default-process 'imagemagick)
-(setq
- org-format-latex-header
+(use-package org-num
+ :delight
+ :after org
+ :hook (org-mode . org-num-mode))
+#+end_src
+*** Org & Latex
+:PROPERTIES:
+:header-args:emacs-lisp: :tangle no
+:END:
+
+#+begin_src emacs-lisp :noweb-ref org-custom
+(org-format-latex-header
"\\documentclass{standalone}
\\usepackage[usenames]{color}
[PACKAGES]
@@ -3507,19 +3516,85 @@ Use imagemagick and standalone class for latex preview.
\\pagestyle{empty} % do not remove")
#+end_src
-Also let us define some more default latex packages.
-#+begin_src emacs-lisp :noweb-ref org-config :tangle no
-(add-to-list 'org-latex-packages-alist '("" "uniinput"))
+#+begin_src emacs-lisp :noweb-ref org-custom
+(org-latex-default-packages-alist
+ '(("mathletters" "ucs")
+ ("AUTO" "inputenc" t ("pdflatex"))
+ ("T1" "fontenc" t ("pdflatex"))
+ ("" "graphicx" t)
+ ("" "grffile" t)
+ ("" "longtable" nil)
+ ("" "wrapfig" nil)
+ ("" "rotating" nil)
+ ("normalem" "ulem" t)
+ ("" "amsmath" t)
+ ("" "textcomp" t)
+ ("" "amssymb" t)
+ ("" "capt-of" nil)
+ ("" "hyperref" nil)))
+#+end_src
+
+#+begin_src emacs-lisp :noweb-ref org-config
(add-to-list 'org-latex-packages-alist '("" "siunitx"))
+(add-to-list 'org-latex-packages-alist '("" "personal"))
+(add-to-list 'org-latex-packages-alist '("" "svg"))
(add-to-list 'org-latex-packages-alist '("" "tikz"))
(add-to-list 'org-latex-packages-alist '("" "circuitikz"))
#+end_src
+
+#+begin_src emacs-lisp :noweb-ref org-hook
+(org-mode . turn-on-org-cdlatex)
+#+end_src
+*** Org Exporter =ox=
#+begin_src emacs-lisp
-(use-package org-num
- :delight
- :after org
- :hook (org-mode . org-num-mode))
+(use-package ox
+ :custom
+ (org-export-with-broken-links 'match)
+ (org-export-backends '(ascii beamer html icalendar latex man md odt org groff koma-letter)))
+#+end_src
+**** Latex & Beamer
+#+begin_src emacs-lisp
+(use-package ox-latex
+ :custom
+ (org-latex-compiler "lualatex")
+ (org-latex-pdf-process
+ '("latexmk -f -pdf -%latex -shell-escape -interaction=nonstopmode -output-directory=%o %f")))
+#+end_src
+Allow ~\framebreak{}~ by default, set a default theme and we also redefine the beamer latex class to use an aspect ratio of 16:9. The frame size will then be 160 mm by 90 mm.
+#+begin_src emacs-lisp
+(use-package ox-beamer
+ :custom
+ (org-beamer-frame-default-options "allowframebreaks")
+ (org-beamer-theme "Hannover")
+ :config
+ (remove (assoc "beamer" org-latex-classes) org-latex-classes)
+ (add-to-list 'org-latex-classes
+ '("beamer"
+ "\\documentclass[presentation,aspectratio=169]{beamer}"
+ ("\\section{%s}" . "\\section*{%s}")
+ ("\\subsection{%s}" . "\\subsection*{%s}")
+ ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
+ )
#+end_src
+Latex preview
+#+begin_src emacs-lisp :tangle no :noweb-rew org-custom
+(org-preview-latex-default-process 'imagemagick)
+(org-format-latex-options
+ '(:foreground default :background default :scale 1.5 :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\[")))
+(org-preview-latex-process-alist
+'(
+(dvipng :programs ("latex" "dvipng") :description "dvi > png" :message "you need to install the programs: latex and dvipng." :image-input-type "dvi" :image-output-type "png" :image-size-adjust (1.0 . 1.0) :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f") :image-converter ("dvipng -D %D -T tight -bg Transparent -o %O %f"))
+(dvisvgm :programs ("latex" "dvisvgm") :description "dvi > svg" :message "you need to install the programs: latex and dvisvgm." :image-input-type "dvi" :image-output-type "svg" :image-size-adjust (1.7 . 1.5) :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f") :image-converter ("dvisvgm %f -n -b min -c %S -o %O"))
+(imagemagick :programs ("latex" "convert") :description "pdf > png" :message "you need to install the programs: latex and imagemagick." :image-input-type "pdf" :image-output-type "png" :image-size-adjust (1.0 . 1.0) :latex-compiler ("lualatex -interaction nonstopmode -output-directory %o %f") :image-converter ("convert -density %D -trim -antialias %f -quality 100 %O"))
+(pdf2svg :programs ("lualatex" "pdf2svg") :description "pdf > svg" :message "" :image-input-type "pdf" :image-output-type "svg" :image-size-adjust (2.0 . 2.0) :latex-compiler ("lualatex -interaction nonstopmode -output-directory %o %f") :image-converter ("pdf2svg %f %O"))))
+#+end_src
+**** ox-reveal
+#+BEGIN_SRC emacs-lisp
+(use-package ox-reveal
+ :straight t)
+(use-package reveal)
+(setq org-reveal-root "http://cdn.jsdelivr.net/reveal.js/3.0.0/")
+#+END_SRC
*** Timekeeping & Clocking
- Remove clocks with zero time.
- Save a clocking history of the list 50 clocked items.
@@ -4288,7 +4363,7 @@ Make gnorb consider the same refile targets as org.
Resize inline images to 400px but respect width specifications in attribute lines.
#+begin_src emacs-lisp :noweb-ref org-custom :tangle no
-(org-image-actual-width '(600))
+(org-image-actual-width t)
#+end_src
Also display remote images by downloading them.
#+begin_src emacs-lisp :noweb-ref org-custom :tangle no
@@ -4296,7 +4371,7 @@ Also display remote images by downloading them.
#+end_src
#+begin_src emacs-lisp :noweb-ref ob-hooks :tangle no
-(org-babel-after-execute . org-display-inline-images)
+(org-babel-after-execute . org-redisplay-inline-images)
#+end_src
*** Babel
This function is handy to use in header arguments to create names based on the current org heading. E.g. =:var data=(fpi/format-headline "/tmp/prefix_")=
@@ -4384,15 +4459,6 @@ Some tests for ~fpi/ob-name~:
#+RESULTS:
| /tmp/babel-gwZcjh/291f3f60f3e5d467584a3b5bda4d7b05 | /tmp/babel-gwZcjh/291f3f60f3e5d467584a3b5bda4d7b05-SUFFIX | /tmp/babel-gwZcjh/PREFIX-291f3f60f3e5d467584a3b5bda4d7b05 | /tmp/babel-gwZcjh/PREFIX-291f3f60f3e5d467584a3b5bda4d7b05-SUFFIX | /tmp/babel-gwZcjh/291f3f60f3e5d467584a3b5bda4d7b05-SUF42FIX |
-*** ox-reveal
-#+BEGIN_SRC emacs-lisp
-(use-package ox-reveal
- :straight t)
-(use-package reveal)
-(setq org-reveal-root (concat "file:///home/fpi/" "reveal.js"))
-;;(setq org-reveal-root "http://cdn.jsdelivr.net/reveal.js/3.0.0/")
-#+END_SRC
-
*** ol-bbdb
#+begin_src emacs-lisp
(use-package ol-bbdb)
@@ -4438,7 +4504,7 @@ Set some prettify symbols for org mode.
#+end_src
*** org-roam
Org-roam mainly provides a display of backlinks to the current file. This allows the creation of a one-subject-per-file Zettelkasten.
-#+begin_src emacs-lisp :tangle tangle/emacs-init.el :noweb yes :results silent
+#+begin_src emacs-lisp :tangle tangle/emacs-10-init.el :noweb yes :results silent
(use-package org-roam
:straight (:host github
:repo "org-roam/org-roam"
@@ -4709,7 +4775,7 @@ Org Edna
*** org-attach
=org-attach= is useful to attach reference material to org files. This can be reference images, data or other files. A special link type is available for attached files: ~[[attachment:file]]~.
-- Inheritance :: While inheritance for attachments sounds useful, so subheadings can access their parents attachments, I find that the current implementation (Org 9.3.1) instead of inheriting just sets the attachment dir of all children to that of the parent. So for now I decided not to use it.
+- Inheritance :: Note that inheritance here means, that the attachment dir of all children is set to that of the parent.
- Attachment Folder :: While I do not like the default double nested
folder structure it creates, I also do not want to set an individual
=DIR= property for all headings I want to attach something to.
@@ -4718,7 +4784,7 @@ Org Edna
#+begin_src emacs-lisp
(use-package org-attach
:custom
- (org-attach-use-inheritance nil)
+ (org-attach-use-inheritance t)
(org-attach-preferred-new-method 'id)
(org-attach-store-link-p t)
:config
@@ -4914,7 +4980,7 @@ Instead of project related capture templates, I use the same template for all ta
:ID: 28704dfb-7647-43ac-b96f-5967383d1188
:END:
Org-protocol is an easy way to capture stuff from outside emacs.
-#+begin_src emacs-lisp :tangle tangle/emacs-init.el :eval yes :results silent
+#+begin_src emacs-lisp :tangle tangle/emacs-10-init.el :eval yes :results silent
(use-package org-protocol)
#+end_src
To install the handler for =org-protocol://= URIs under linux you probably need a =.desktop= file similar to the one below. Place it under =~/.local/share/applications= and run src_shell{update-desktop-database}.
@@ -6068,7 +6134,7 @@ I change the group buffer to something more memorable. This needs to be set befo
#+end_src
To synchronize the database across devices I symlink it to my central synchronization directory:
#+begin_src shell :noweb-ref symlinks :tangle no
-ln -siv ~/sync/bbdb/bbdb ~/.emacs.d/1
+ln -siv ~/sync/bbdb/bbdb ~/.emacs.d/bbdb
#+end_src
** Compile
Fix ansi colors in compile buffers. From [[https://endlessparentheses.com/ansi-colors-in-the-compilation-buffer-output.html][endlessparentheses]].