update emacs config

This commit is contained in:
Valentin Boettcher 2022-11-22 17:58:40 +01:00
parent bc5d9c5160
commit e17f82f33e
No known key found for this signature in database
GPG key ID: E034E12B7AF56ACE

View file

@ -7,6 +7,7 @@
#+begin_src emacs-lisp :tangle yes
;; -*- lexical-binding: t -*-
#+end_src
*** Allow Dangerous Stuff
:PROPERTIES:
:ID: 5e3711ab-6ce4-4297-a757-e67ada5deb32
@ -166,10 +167,6 @@ HL line mode is nonsensical in term.
(setq cursor-type 'bar)
(turn-off-boon-mode)
(setq global-hl-line-mode nil)))
;; (use-package eterm-256color
;; :config
;; (add-hook 'term-mode-hook #'eterm-256color-mode))
#+end_src
*** VTerm
@ -350,8 +347,7 @@ We use the doom theme.
doom-themes-enable-italic t) ; if nil, italics is universally disabled
(load-theme 'doom-solarized-light t)
(doom-themes-treemacs-config)
(doom-themes-org-config)
)
(doom-themes-org-config))
(use-package doom-modeline
:ensure t
@ -382,7 +378,6 @@ We use the doom theme.
#+END_SRC
This allows us to disable it locally
#+begin_src emacs-lisp :tangle yes
(make-variable-buffer-local 'global-hl-line-mode)
#+end_src
@ -443,31 +438,43 @@ A nice completion style.
completion-category-overrides nil)
(savehist-mode))
#+end_src
*** Prescient
#+begin_src emacs-lisp :tangle yes
(use-package prescient
:config
(prescient-persist-mode +1))
#+end_src
*** Selectrum
Use selectrum for selection dialogs.
#+begin_src emacs-lisp :tangle yes
(use-package selectrum-prescient)
(use-package selectrum
:config (selectrum-mode +1)
(setq orderless-skip-highlighting (lambda () selectrum-is-active))
(setq selectrum-highlight-candidates-function #'orderless-highlight-matches))
:after (orderless selectrum-prescient)
:init
(setq orderless-skip-highlighting (lambda () selectrum-is-active))
(setq selectrum-highlight-candidates-function #'orderless-highlight-matches)
(setq selectrum-prescient-enable-filtering nil)
(selectrum-mode +1)
(selectrum-prescient-mode +1))
#+end_src
*** Marginalia
Extra info in the minibuffer.
#+begin_src emacs-lisp :tangle yes
;; Enable richer annotations using the Marginalia package
(use-package marginalia
;; Either bind `marginalia-cycle` globally or only in the minibuffer
:bind (("M-A" . marginalia-cycle)
:map minibuffer-local-map
("M-A" . marginalia-cycle))
;; Enable richer annotations using the Marginalia package
(use-package marginalia
;; Either bind `marginalia-cycle` globally or only in the minibuffer
:bind (("M-A" . marginalia-cycle)
:map minibuffer-local-map
("M-A" . marginalia-cycle))
;; The :init configuration is always executed (Not lazy!)
:init
;; The :init configuration is always executed (Not lazy!)
:init
;; Must be in the :init section of use-package such that the mode gets
;; enabled right away. Note that this forces loading the package.
(marginalia-mode))
;; Must be in the :init section of use-package such that the mode gets
;; enabled right away. Note that this forces loading the package.
(marginalia-mode))
#+end_src
*** Consult
@ -482,7 +489,7 @@ Swiper and rg alternative.
("C-c k" . consult-kmacro)
;; C-x bindings (ctl-x-map)
("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
("C-x b" . consult-buffer) ;; orig. switch-to-buffer
("C-x B" . consult-buffer) ;; orig. switch-to-buffer
("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
;; Custom M-# bindings for fast register access
@ -540,9 +547,6 @@ Swiper and rg alternative.
;; This adds thin lines, sorting and hides the mode line of the window.
(advice-add #'register-preview :override #'consult-register-window)
;; Optionally replace `completing-read-multiple' with an enhanced version.
(advice-add #'completing-read-multiple :override #'consult-completing-read-multiple)
;; Use Consult to select xref locations with preview
(setq xref-show-xrefs-function #'consult-xref
xref-show-definitions-function #'consult-xref)
@ -625,6 +629,9 @@ Swiper and rg alternative.
#+end_src
*** Nicer Search
I found that searching with great speed is better than a beatiful
preview in the minibuffer.
#+begin_src emacs-lisp :tangle yes
(use-package ctrlf
:config
@ -660,11 +667,22 @@ Swiper and rg alternative.
:ID: 033b54d9-e5a3-420c-af9e-26be143c20e7
:END:
#+begin_src emacs-lisp :tangle yes
(global-set-key (kbd "M-p") 'previous-buffer)
(global-set-key (kbd "M-n") 'next-buffer)
(global-set-key (kbd "M-<end>") 'previous-buffer)
(global-set-key (kbd "M-S-<end>") 'next-buffer)
#+end_src
*** Misc
*** Bufler
Better buffer overview. IBuffer alternative.
#+begin_src emacs-lisp :tangle yes
(use-package bufler
:init (bufler-mode 1)
:bind
("C-x C-b" . bufler)
("C-x b" . bufler-switch-buffer))
#+end_src
*** Backup Location
:PROPERTIES:
:ID: 5a653d75-bc36-479d-8f4f-1bf83d5f0af2
:END:
@ -679,8 +697,7 @@ Centralize the backup location.
)
#+END_SRC
*** Navigation
**** Avy
*** Avy
:PROPERTIES:
:ID: 45e310ac-0893-46f7-ad4e-fd10e4223d5d
:END:
@ -704,41 +721,6 @@ Move whole lines easily.
:config (move-text-default-bindings))
#+END_SRC
*** Treemacs
:PROPERTIES:
:ID: cfb56f78-fbaa-46ae-b291-b4363695dfbe
:END:
#+BEGIN_SRC emacs-lisp :tangle yes
(use-package treemacs
:ensure t
:defer t
:init
(with-eval-after-load 'winum
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
:bind
(:map global-map
("M-0" . treemacs-select-window)
("C-x t 1" . treemacs-delete-other-windows)
("C-x t t" . treemacs)
("C-x t B" . treemacs-bookmark)
("C-x t C-t" . treemacs-find-file)
("C-x t M-t" . treemacs-find-tag)))
(use-package treemacs-projectile
:after treemacs projectile
:bind ("<f5>" . projectile-compile-project)
:ensure t)
(use-package treemacs-icons-dired
:after treemacs dired
:ensure t
:config (treemacs-icons-dired-mode))
(use-package treemacs-magit
:after treemacs magit
:ensure t)
#+END_SRC
*** Rainbow Delimiters, Identifiers
:PROPERTIES:
:ID: dc0ff24a-4d59-42b4-b99b-95b65274ceb0
@ -786,7 +768,7 @@ Color code matching delimiters.
(use-package rg
:config
(rg-enable-default-bindings)
:bind ("C-x p" . rg-menu))
:bind ("C-x G" . rg-menu))
#+end_src
*** Flyspell
@ -807,6 +789,7 @@ Color code matching delimiters.
#+begin_src emacs-lisp :tangle yes
(use-package hydra)
#+end_src
*** Direnv Support
:PROPERTIES:
:ID: de7c7800-9d2a-49bf-a004-159d688fd715
@ -816,6 +799,7 @@ Color code matching delimiters.
:config
(direnv-mode))
#+end_src
*** Writeroom
:PROPERTIES:
:ID: 7ef0eb70-75c3-4f69-b50d-637fc34051bb
@ -837,7 +821,6 @@ Distraction free writing.
(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)))
#+end_src
*** Return to Minibuffer
Taken from [[https://emacs.stackexchange.com/questions/42287/set-focus-to-minibuffer-window][stackoverlow]]. Returns the focus to the minibuffer.
#+begin_src emacs-lisp :tangle yes
@ -850,20 +833,12 @@ Taken from [[https://emacs.stackexchange.com/questions/42287/set-focus-to-minibu
(global-set-key "\C-co" 'switch-to-minibuffer) ;
#+end_src
*** Highlight Indent
#+begin_src emacs-lisp :tangle yes
;; (use-package highlight-indent-guides
;; :config
;; (setq highlight-indent-guides-method 'character)
;; (setq highlight-indent-guides-responsive 'top)
;; :hook (prog-mode . highlight-indent-guides-mode))
#+end_src
*** Whichkey
#+begin_src emacs-lisp :tangle yes
(use-package which-key
:config (which-key-mode))
:init (which-key-mode))
#+end_src
** Programming / Language Support
@ -882,7 +857,7 @@ Completion at point.
;; Opt
:config
(setq tab-always-indent 'complete)
(corfu-global-mode))
(global-corfu-mode))
#+end_src
*** LSP
:PROPERTIES:
@ -1100,27 +1075,6 @@ Multiple major modes in one buffer.
(org-clock-persistence-insinuate)
(setq org-id-link-to-org-use-id 'create-if-interactive)
#+END_SRC
**** Bars
Add pretty bars to the org indent.
#+begin_src emacs-lisp :tangle yes
;; (use-package org-bars
;; :straight (:host github :repo "tonyaldon/org-bars")
;; :hook (org-mode . org-bars-mode)
;; :config
;; (setq org-bars-color-options '(:desaturate-level-faces 30 :darken-level-faces 15)))
#+end_src
And disable the ellipsis.
#+begin_src emacs-lisp :tangle yes
;; (defun org-no-ellipsis-in-headlines ()
;; "Remove use of ellipsis in headlines.
;; See `buffer-invisibility-spec'."
;; (remove-from-invisibility-spec '(outline . t))
;; (add-to-invisibility-spec 'outline))
;; (add-hook 'org-mode-hook 'org-no-ellipsis-in-headlines)
#+end_src
**** Refile
:PROPERTIES:
:ID: 25e8eb21-b15c-4cd1-9cde-4b458a885b71
@ -1133,7 +1087,7 @@ And disable the ellipsis.
(org-agenda-files :maxlevel . 9))))
#+END_SRC
- Use full outline paths for refile targets - we file directly with IDO
- Use full outline paths for refile targets
#+BEGIN_SRC emacs-lisp :tangle yes
(setq org-refile-use-outline-path t)
#+END_SRC
@ -1199,17 +1153,23 @@ And disable the ellipsis.
(org-tags-match-list-sublevels t))
("~/Documents/org/out/next.html"))
("f" "Questions"
tags
"QUESTION"
todo
"ASK|RESOLVE"
((org-agenda-overriding-header "Questions")
(org-tags-match-list-sublevels t))
("~/Documents/org/out/question.html"))
("l" "Einkaufsliste"
("l" "Readlist"
todo
"OUTOFSTOCK"
((org-agenda-overriding-header "Einkaufsliste")
"WILLREAD|READING"
((org-agenda-overriding-header "Readlist")
(org-tags-match-list-sublevels t))
("~/Documents/org/out/einkaufsliste.html"))))
("~/Documents/org/out/readlist.html"))
("r" "Research"
todo
"RESEARCH"
((org-agenda-overriding-header "To Research")
(org-tags-match-list-sublevels t))
("~/Documents/org/out/research.html"))))
#+END_SRC
**** Super Agenda
@ -1260,14 +1220,16 @@ Buff the agenda to use Groups.
#+BEGIN_SRC emacs-lisp :tangle yes
(setq org-directory "~/Documents/org")
(setq org-default-notes-file "~/Documents/org/refile.org")
(setq org-default-todos-file "~/Documents/org/todo.org")
(setq org-default-calendar-file "~/Documents/org/general.org")
#+END_SRC
Agenda Files:
Agenda Files (default and current projects):
#+BEGIN_SRC emacs-lisp :tangle yes
(setq
org-agenda-files
(list "~/Documents/org/todo.org"
"~/Documents/Projects/UNI/master/masterarb/project.org"))
(setq
org-agenda-files
(list org-default-todos-file org-default-notes-file org-default-calendar-file
"~/Documents/PhD/LightEngineering/project.org"))
#+END_SRC
**** Automatically mark task as done if all subtasks are done
@ -1282,47 +1244,22 @@ Agenda Files:
(add-hook 'org-after-todo-statistics-hook 'org-summary-todo)
#+end_src
**** Custom States
:PROPERTIES:
:ID: 9a13b076-b2cb-4617-85a0-8f37a18c15eb
:END:
- states
#+BEGIN_SRC emacs-lisp :tangle yes
(setq org-todo-keywords
'((sequence "TODO" "WAITING" "NEXT" "HOLD" "|"
"DONE")
(sequence "BESORGEN" "WARTEN" "|" "BESORGT")
(sequence "OUTOFSTOCK" "|" "INSTOCK")
(sequence "RESOLVE" "ASK" "RESEARCH" "|" "RESOLVED")
(sequence "HOMEWORK" "ACTIVE" "|" "FINISHED")))
(setq org-todo-keywords
'((sequence "TODO" "WAITING" "NEXT" "HOLD" "|"
"DONE")
(sequence "RESOLVE" "ASK" "RESEARCH" "|" "RESOLVED")
(sequence "WILLREAD" "READING" "PUTASIDE" "|" "READ")
(sequence "HOMEWORK" "ACTIVE" "|" "FINISHED")))
#+END_SRC
- triggers
#+BEGIN_SRC emacs-lisp :tangle yes
(setq org-todo-state-tags-triggers
(quote
(("CANCELLED"
("CANCELLED" . t))
("WAITING"
("WAITING" . t))
("HOLD"
("WAITING")
("HOLD" . t))
(done ("WAITING")
("HOLD"))
("TODO"
("WAITING")
("CANCELLED")
("HOLD"))
("NEXT"
("WAITING")
("CANCELLED")
("HOLD"))
("DONE"
("WAITING")
("CANCELLED")
("HOLD")))))
#+END_SRC
**** Capture Templates
:PROPERTIES:
:ID: 534bc598-1e8f-4f63-91b9-2653d30cd173
@ -1332,7 +1269,7 @@ Agenda Files:
(quote
(("t" "Todo"
entry
(file org-default-notes-file)
(file org-default-todos-file)
"* TODO %?\n%U\n%a\n")
("n" "Note"
entry
@ -1350,13 +1287,17 @@ Agenda Files:
entry
(file+datetree "~/Documents/org/diary.org")
"**** %?\n%U\n")
("m" "Meeting"
("g" "Group Meeting Entry"
entry
(file+headline "~/Documents/org/general.org" "Meetings")
(file+datetree "~/Documents/PhD/group_meetings/group_meetings.org")
"**** %?\n%U\n")
("m" "Meeting"
entyr
(file+headline org-default-calendar-file "Meetings")
"** %? :MEETING:\n")
("p" "Appointment"
entry
(file+headline "~/Documents/org/general.org" "Appointments")
(file+headline org-default-calendar-file "Appointments")
"** %? :APPOINTMENT:\n"))))
#+END_SRC
@ -1514,14 +1455,6 @@ Org tree slide is a presentation tool for org mode.
#+begin_src emacs-lisp :tangle yes
(setq org-format-latex-options (plist-put org-format-latex-options :scale 2.0))
#+end_src
**** Instant latex preview
:PROPERTIES:
:ID: efa1372a-d79f-4eb2-bee8-572fa1aa2669
:END:
#+begin_src emacs-lisp :tangle yes
;; (use-package org-fragtog
;; :hook org-mode)
#+end_src
**** Archive all DONE
:PROPERTIES:
:ID: 30bddaf0-e2c0-4d52-85d1-984d8509f8f4
@ -1573,7 +1506,7 @@ Ox-hugo allows to export org mode to hugo for my [[https://protagon.space][websi
:config
(require 'org-macs)
(setq bibtex-completion-bibliography '("~/bibliography/references.bib")
(setq bibtex-completion-bibliography '("~/bibliography/references.bib" "~/bibliography/new.bib")
bibtex-completion-library-path '("~/bibliography/bibtex-pdfs/")
bibtex-completion-notes-path "~/bibliography/notes.org"
bibtex-completion-notes-template-multiple-files "* ${author-or-editor}, ${title}, ${journal}, (${year}) :${=type=}: \n\nSee [[cite:&${=key=}]]\n"
@ -1735,29 +1668,10 @@ See https://www.orgroam.com/manual.html.
:if-new
(file+head "references/${citekey}.org" "#+title: ${title}\n")
:unnarrowed t)))
(setq rm-base "~/Documents/rm_notes")
(defun my-get-note-name ()
(let* ((filename (buffer-file-name (window-buffer (minibuffer-selected-window))))
(relative (file-name-sans-extension (file-relative-name filename org-roam-directory))))
relative))
(defun open-rm-note ()
"Opens the handwritten notes coressponding to the buffer."
(interactive)
(let ((pdf (concat (file-name-as-directory rm-base) (my-get-note-name) "/notes.pdf")))
(if (file-exists-p pdf)
(find-file pdf))))
(defun sync-rm-note ()
(interactive)
(let ((name (my-get-note-name)))
(shell-command (concat "bash "
"sync_rm "
name))))
:bind (("C-c n l" . org-roam-buffer-toggle)
("C-c n f" . org-roam-node-find)
("C-c n i" . org-roam-node-insert)
("C-c n s" . sync-rm-note)
("C-c n d" . open-rm-note)))
("C-c n i" . org-roam-node-insert)))
#+end_src
***** Bibtex
@ -1790,13 +1704,12 @@ For a nice mindmap in the browser.
org-roam-ui-follow t
org-roam-ui-update-on-save t
org-roam-ui-open-on-start t))
#+end_src
**** Org Noter
**** Org Noter
#+begin_src emacs-lisp :tangle yes
(use-package org-noter
:after org-roam
:after (org-roam org-roam-bibtex)
:config
(setq
;; The WM can handle splits
@ -1918,6 +1831,7 @@ Enable electric braces for math mode: ~\( \)~
(setq LaTeX-electric-left-right-brace t)
(defun my-auctex-init ()
(auto-fill-mode t)
(refill-mode t)
(latex-math-mode t)
(turn-on-reftex)
(setq font-latex-fontify-script 'multi-level)
@ -2246,14 +2160,11 @@ Support for sphinx style docstrings.
:END:
#+begin_src emacs-lisp :tangle yes
(use-package ansi-color
:after jupyter
:config
;; (defun jupyter-ansi-color-apply-on-region (begin end)
;; (ansi-color-apply-on-region begin end t))
)
:after jupyter)
(use-package popup)
(use-package jupyter
:straight (:host github :repo "vale981/emacs-jupyter" :branch "patch-1")
:after (popup ansi-color)
:config
(require 'jupyter-python)
(require 'jupyter-julia)
@ -2265,7 +2176,6 @@ Support for sphinx style docstrings.
(jupyter . t)))
(setq jupyter-eval-use-overlays t)
(setq jupyter-eval-short-result-display-function #'popup-tip))
#+end_src
*** YASnippets
@ -2580,13 +2490,6 @@ Fish shell script mode.
#+BEGIN_SRC emacs-lisp :tangle yes
(use-package fish-mode)
#+END_SRC
*** Arch PKGBUILD
:PROPERTIES:
:ID: 76851fc8-b7eb-458a-8d42-c60c31c429bc
:END:
#+BEGIN_SRC emacs-lisp :tangle yes
(use-package pkgbuild-mode)
#+END_SRC
*** C++
:PROPERTIES:
:ID: 5eb6b743-18bd-4c18-ba40-a5372793e570
@ -2826,7 +2729,7 @@ Hooking into aggressive indent.
(setq lsp-ltex-latex-commands "{'\\fixme{}': 'ignore'}"))
#+end_src
** Applications
*** Ank
*** Anki
:PROPERTIES:
:ID: f8d492d4-6bbc-4f0c-888e-0b12837a661f
:END:
@ -2867,46 +2770,6 @@ Stolen from https://yiufung.net/post/anki-org/.
;; Initialize
(anki-editor-reset-cloze-number))
#+end_src
*** MU4E
:PROPERTIES:
:ID: 19002b1b-7dab-4239-ba33-83ab204df86d
:END:
#+begin_src emacs-lisp :tangle yes
;; (use-package mu4e
;; :config
;; (setq mu4e-view-show-images t)
;; (when (fboundp 'imagemagick-register-types)
;; (imagemagick-register-types))
;; (setq mu4e-compose-in-new-frame t)
;; (setq mu4e-sent-messages-behavior 'delete)
;; (add-hook 'mu4e-headers-mode-hook
;; (defun my/mu4e-change-headers ()
;; (interactive)
;; (setq mu4e-headers-fields
;; `((:human-date . 25) ;; alternatively, use :date
;; (:flags . 6)
;; (:from . 22)
;; (:thread-subject . ,(- (window-body-width) 70)) ;; alternatively, use :subject
;; (:size . 7)))))
;; (add-hook 'mu4e-compose-mode-hook
;; (defun my-do-compose-stuff ()
;; "My settings for message composition."
;; (visual-line-mode)
;; (org-mu4e-compose-org-mode)
;; (use-hard-newlines -1)
;; (flyspell-mode)))
;; (setq mu4e-contexts
;; `(
;; ,(make-mu4e-context
;; :name "Protagon"
;; :match-func (lambda (msg) (when msg
;; (string-prefix-p "/Gmail" (mu4e-message-field msg :maildir))))
;; :vars '(
;; (mu4e-trash-folder . "/Gmail/[Gmail].Trash")
;; (mu4e-refile-folder . "/Gmail/[Gmail].Archive")
;; )))))
#+end_src
*** Bibtex Frontend
#+begin_src emacs-lisp :tangle yes
(use-package citar
@ -2916,7 +2779,7 @@ Stolen from https://yiufung.net/post/anki-org/.
:map minibuffer-local-map
("M-b" . citar-insert-preset))
:config
(setq citar-bibliography (car bibtex-completion-bibliography))
(setq citar-bibliography bibtex-completion-bibliography)
(setq citar-library-paths org-ref-pdf-directory))
(use-package citar-org
@ -2937,7 +2800,7 @@ A matrix client right inside emacs.
(use-package ement
:straight
'(:host github :repo "alphapapa/ement.el" :branch "master")
:config ;(ement-connect :uri-prefix "http://localhost:8009")
:config ;; (ement-connect :uri-prefix "http://localhost:8009")
:custom
;; (ement-room-message-format-spec "%B%r%R%t")
(ement-save-sessions t))