You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1252 lines
35 KiB

5 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. #+TITLE: Emacs configuration file
  2. #+AUTHOR: Marc
  3. #+BABEL: :cache yes
  4. #+PROPERTY: header-args :tangle yes
  5. * TODOS
  6. - early-init.el? What to outsource here?
  7. - Paket exec-path-from-shell, um PATH aus Linux auch in emacs zu haben
  8. - Smart mode line?
  9. - Theme
  10. - evil-collection or custom in init file?
  11. - Hydra
  12. - General
  13. - (defalias 'list-buffers 'ibuffer) ;; change default to ibuffer
  14. - ido?
  15. - treemacs (for linux)
  16. - treemacs-evil?
  17. - treemacs-projectile
  18. windmove?
  19. - tramp (in linux)
  20. - visual-regexp
  21. - org configuration: paths
  22. - org custom agenda
  23. - org-ql (related to org agendas)
  24. - org configuration: everything else
  25. - beancount configuration from config.org
  26. - CONTINUE TODO from config.org at Programming
  27. - all-the-icons?
  28. * Header
  29. :PROPERTIES:
  30. :ID: a14d7c89-24ea-41ae-b185-944bab49aa02
  31. :END:
  32. Emacs variables are dynamically scoped. That's unusual for most languages, so disable it here, too
  33. #+begin_src emacs-lisp
  34. ;;; init.el --- -*- lexical-binding: t -*-
  35. #+end_src
  36. * First start
  37. :PROPERTIES:
  38. :ID: 1c24d48e-0124-4a0b-8e78-82e4c531e818
  39. :END:
  40. When pulling the repository the first time, an initial init.el needs to be setup. After start it will replace itself with the configuration from init.org
  41. #+BEGIN_SRC emacs-lisp :tangle no
  42. (require 'org')
  43. (find-file (concat user-emacs-directory "init.org"))
  44. (org-babel-tangle)
  45. (load-file (concat user-emacs-directory "init.el"))
  46. (byte-compile-file (concat user-emacs-directory "init.el"))
  47. #+END_SRC
  48. This function updates init.el whenever changes in init.org are made. The update will be active after saving.
  49. #+BEGIN_SRC emacs-lisp
  50. (defun me/tangle-init ()
  51. "If the current buffer is 'init.org', the code blocks are tangled, and the tangled file is compiled."
  52. (when (equal (buffer-file-name)
  53. (expand-file-name (concat user-emacs-directory "init.org")))
  54. ;; avoid running hooks
  55. (let ((prog-mode-hook nil))
  56. (org-babel-tangle)
  57. (byte-compile-file (concat user-emacs-directory "init.el"))
  58. (load-file user-init-file))))
  59. (add-hook 'after-save-hook 'me/tangle-init)
  60. #+END_SRC
  61. A small function to measure start up time.
  62. Compare that to
  63. emacs -q --eval='(message "%s" (emacs-init-time))'
  64. (roughly 0.27s)
  65. https://blog.d46.us/advanced-emacs-startup/
  66. #+begin_src emacs-lisp
  67. (add-hook 'emacs-startup-hook
  68. (lambda ()
  69. (message "Emacs ready in %s with %d garbage collections."
  70. (format "%.2f seconds"
  71. (float-time
  72. (time-subtract after-init-time before-init-time)))
  73. gcs-done)))
  74. (setq gc-cons-threshold (* 50 1000 1000))
  75. #+end_src
  76. #+BEGIN_SRC emacs-lisp
  77. (require 'package)
  78. (add-to-list 'package-archives '("elpa" . "https://elpa.gnu.org/packages/") t)
  79. (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
  80. (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
  81. (add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
  82. ;(when (< emacs-major-version 27)
  83. ; (package-initialize))
  84. #+END_SRC
  85. #+BEGIN_SRC emacs-lisp
  86. (unless (package-installed-p 'use-package)
  87. (package-refresh-contents)
  88. (package-install 'use-package))
  89. (eval-when-compile
  90. (require 'use-package))
  91. (require 'bind-key)
  92. (setq use-package-verbose nil)
  93. (use-package diminish
  94. :ensure t)
  95. #+END_SRC
  96. cl is deprecated in favor for cl-lib, some packages like emmet still depend on cl.
  97. Shut off the compiler warning about it.
  98. Maybe turn it on again at some point before the next major emacs upgrade
  99. #+begin_src emacs-lisp
  100. (setq byte-compile-warnings '(cl-functions))
  101. #+end_src
  102. * Default settings
  103. :PROPERTIES:
  104. :ID: 3512d679-d111-4ccd-8372-6fc2acbc0374
  105. :END:
  106. #+BEGIN_SRC emacs-lisp
  107. (defconst *sys/gui*
  108. (display-graphic-p)
  109. "Is emacs running in a gui?")
  110. (defconst *sys/linux*
  111. (string-equal system-type 'gnu/linux)
  112. "Is the system running Linux?")
  113. (defconst *sys/windows*
  114. (string-equal system-type 'windows-nt)
  115. "Is the system running Windows?")
  116. (defconst *home_desktop*
  117. (string-equal (system-name) "marc")
  118. "Is emacs running on my desktop?")
  119. (defconst *home_laptop*
  120. (string-equal (system-name) "laptop")
  121. "Is emacs running on my laptop?")
  122. (defconst *work_local*
  123. (string-equal (system-name) "PMPCNEU08")
  124. "Is emacs running at work on the local system?")
  125. (defconst *work_remote*
  126. (string-equal (system-name) "PMTS01")
  127. "Is emacs running at work on the remote system?")
  128. #+END_SRC
  129. #+BEGIN_SRC emacs-lisp
  130. (defvar MY--PATH_USER_LOCAL (concat user-emacs-directory "user-local/"))
  131. (defvar MY--PATH_USER_GLOBAL (concat user-emacs-directory "user-global/"))
  132. (add-to-list 'custom-theme-load-path (concat MY--PATH_USER_GLOBAL "themes"))
  133. (when *sys/linux*
  134. (defconst MY--PATH_ORG_FILES (expand-file-name "~/Archiv/Organisieren/"))
  135. (defconst MY--PATH_ORG_FILES_MOBILE (expand-file-name "~/Archiv/Organisieren/mobile/")))
  136. (defconst MY--PATH_ORG_JOURNAl (expand-file-name "~/Archiv/Organisieren/Journal/"))
  137. (when *work_remote*
  138. (defconst MY--PATH_ORG_FILES "p:/Eigene Dateien/Notizen/")
  139. (defconst MY--PATH_ORG_FILES_MOBILE nil) ;; hacky way to prevent "free variable" compiler error
  140. (defconst MY--PATH_ORG_JOURNAL nil) ;; hacky way to prevent "free variable" compiler error
  141. (defconst MY--PATH_START "p:/Eigene Dateien/Notizen/"))
  142. (setq recentf-save-file (concat MY--PATH_USER_LOCAL "recentf"))
  143. ;; exclude some dirs from spamming recentf
  144. (use-package recentf
  145. :config
  146. (recentf-mode)
  147. (setq recentf-exclude '(".*-autoloads\\.el\\"
  148. "[/\\]\\.elpa/")))
  149. (setq custom-file (concat MY--PATH_USER_LOCAL "custom.el")) ;; don't spam init.e with saved customization settings
  150. (setq abbrev-file-name (concat MY--PATH_USER_GLOBAL "abbrev_defs"))
  151. (setq backup-directory-alist `((".*" . ,temporary-file-directory)))
  152. (setq auto-save-file-name-transforms `((".*" ,temporary-file-directory)))
  153. (setq save-abbrevs 'silently) ;; don't bother me with asking for abbrev saving
  154. (setq-default create-lockfiles nil) ;; disable lock files, can cause trouble in e.g. lsp-mode
  155. (defalias 'yes-or-no-p 'y-or-n-p) ;; answer with y and n
  156. (setq custom-safe-themes t) ;; don't ask me if I want to load a theme
  157. (setq sentence-end-double-space nil) ;; don't coun two spaces after a period as the end of a sentence.
  158. (delete-selection-mode t) ;; delete selected region when typing
  159. (save-place-mode 1) ;; saves position in file when it's closed
  160. (setq save-place-forget-unreadable-files nil) ;; checks if file is readable before saving position
  161. (set-charset-priority 'unicode)
  162. (setq locale-coding-system 'utf-8)
  163. (set-terminal-coding-system 'utf-8)
  164. (set-keyboard-coding-system 'utf-8)
  165. (set-selection-coding-system 'utf-8)
  166. (setq default-process-coding-system '(utf-8-unix . utf-8-unix))
  167. (if *sys/windows*
  168. (prefer-coding-system 'utf-8-dos)
  169. (prefer-coding-system 'utf-8))
  170. (blink-cursor-mode -1) ;; turn off blinking cursor
  171. (column-number-mode t)
  172. (setq uniquify-buffer-name-style 'forward)
  173. (setq-default indent-tabs-mode nil) ;; avoid tabs in place of multiple spaces (they look bad in tex)
  174. (setq-default indicate-empty-lines t) ;; show empty lines
  175. (setq scroll-margin 5 ;; smooth scrolling
  176. scroll-conservatively 10000
  177. scroll-preserve-screen-position 1
  178. scroll-step 1)
  179. (global-hl-line-mode t) ;; highlight current line
  180. (menu-bar-mode 0) ;; disable menu bar
  181. (tool-bar-mode 0) ;; disable tool bar
  182. (scroll-bar-mode 0) ;; disable scroll bar
  183. #+END_SRC
  184. Bookmarks
  185. Usage:
  186. - C-x r m (bookmark-set): add bookmark
  187. - C-x r l (list-bookmark): list bookmarks
  188. - C-x r b (bookmark-jump): open bookmark
  189. Edit bookmarks (while in bookmark file):
  190. - d: mark current item
  191. - x: delete marked items
  192. - r: rename current item
  193. - s: save changes
  194. #+begin_src emacs-lisp
  195. (use-package bookmark
  196. :custom
  197. (bookmark-default-file (concat MY--PATH_USER_LOCAL "bookmarks")))
  198. #+end_src
  199. Some windows specific stuff
  200. #+BEGIN_SRC emacs-lisp
  201. (when *sys/windows*
  202. (remove-hook 'find-file-hook 'vc-refresh-state)
  203. (progn
  204. (setq gc-cons-threshold (* 511 1024 1024)
  205. gc-cons-percentage 0.5
  206. garbage-collection-messages t)
  207. (run-with-idle-timer 5 t #'garbage-collect))
  208. (when (boundp 'w32-pipe-read-delay)
  209. (setq w32-pipe-read-delay 0))
  210. (when (boundp 'w32-get-true-file-attributes)
  211. (setq w32-get-true-file-attributes nil)))
  212. #+END_SRC
  213. * visuals
  214. ** Font
  215. :PROPERTIES:
  216. :ID: dc8eb670-e6bb-4bfb-98f0-aae1860234fb
  217. :END:
  218. #+BEGIN_SRC emacs-lisp
  219. (when *sys/linux*
  220. (set-face-font 'default "Hack-10"))
  221. (when *work_remote*
  222. (set-face-font 'default "Lucida Sans Typewriter-11"))
  223. #+END_SRC
  224. ** Themes
  225. :PROPERTIES:
  226. :ID: 9ccf37c0-6837-43cb-bed8-5a353799d8b1
  227. :END:
  228. #+BEGIN_SRC emacs-lisp
  229. (defun my/toggle-theme ()
  230. (interactive)
  231. (when (or *sys/windows* *sys/linux*)
  232. (if (eq (car custom-enabled-themes) 'tango-dark)
  233. (progn (disable-theme 'tango-dark)
  234. (load-theme 'tango))
  235. (progn
  236. (disable-theme 'tango)
  237. (load-theme 'tango-dark)))))
  238. (bind-key "C-c t" 'my/toggle-theme)
  239. #+END_SRC
  240. Windows Theme:
  241. #+BEGIN_SRC emacs-lisp
  242. (when *sys/windows*
  243. (load-theme 'tango))
  244. (when *sys/linux*
  245. (load-theme 'plastic))
  246. #+END_SRC
  247. ** line wrappings
  248. :PROPERTIES:
  249. :ID: 14ae933e-2941-4cc3-82de-38f90f91bfd3
  250. :END:
  251. #+BEGIN_SRC emacs-lisp
  252. (global-visual-line-mode)
  253. (diminish 'visual-line-mode)
  254. (use-package adaptive-wrap
  255. :ensure t
  256. :config
  257. (add-hook 'visual-line-mode-hook #'adaptive-wrap-prefix-mode))
  258. ; :init
  259. ; (when (fboundp 'adaptive-wrap-prefix-mode)
  260. ; (defun my/activate-adaptive-wrap-prefix-mode ()
  261. ; "Toggle `visual-line-mode' and `adaptive-wrap-prefix-mode' simultaneously."
  262. ; (adaptive-wrap-prefix-mode (if visual-line-mode 1 -1)))
  263. ; (add-hook 'visual-line-mode-hook 'my/activate-adaptive-wrap-prefix-mode)))
  264. #+END_SRC
  265. ** line numbers
  266. :PROPERTIES:
  267. :ID: 7b969436-98c9-4b61-ba7a-9fb22c9781ad
  268. :END:
  269. #+BEGIN_SRC emacs-lisp
  270. (use-package display-line-numbers
  271. :init
  272. (add-hook 'prog-mode-hook 'display-line-numbers-mode)
  273. (add-hook 'org-src-mode-hook 'display-line-numbers-mode)
  274. :config
  275. (setq-default display-line-numbers-type 'visual
  276. display-line-numbers-current-absolute t
  277. display-line-numbers-with 4
  278. display-line-numbers-widen t))
  279. ; (add-hook 'emacs-lisp-mode-hook 'display-line-numbers-mode)
  280. #+END_SRC
  281. ** misc
  282. :PROPERTIES:
  283. :ID: a2873138-16ee-4990-89a2-26eab778ea74
  284. :END:
  285. #+BEGIN_SRC emacs-lisp
  286. (use-package rainbow-mode
  287. :ensure t
  288. :diminish
  289. :hook ((org-mode
  290. emacs-lisp-mode) . rainbow-mode))
  291. (use-package delight
  292. :ensure t)
  293. (show-paren-mode t) ;; show other part of brackets
  294. (use-package rainbow-delimiters
  295. :ensure t
  296. :hook ((prog-mode . rainbow-delimiters-mode)))
  297. #+END_SRC
  298. * undo
  299. :PROPERTIES:
  300. :ID: d57621b2-5472-4c89-a520-b4133db0b9af
  301. :END:
  302. #+BEGIN_SRC emacs-lisp
  303. (use-package undo-tree
  304. :ensure t
  305. :diminish undo-tree-mode
  306. :init
  307. (global-undo-tree-mode 1))
  308. #+END_SRC
  309. * ace-window
  310. #+begin_src emacs-lisp
  311. (use-package ace-window
  312. :ensure t
  313. :bind
  314. (:map global-map
  315. ("C-x o" . ace-window)))
  316. #+end_src
  317. * imenu-list
  318. :PROPERTIES:
  319. :ID: 0ae27ec9-5d77-43cf-ac76-5e12cc959046
  320. :END:
  321. A minor mode to show imenu in a sidebar.
  322. Call imenu-list-smart-toggle.
  323. [[https://github.com/bmag/imenu-list][Source]]
  324. #+BEGIN_SRC emacs-lisp
  325. (use-package imenu-list
  326. :ensure t
  327. :defer t
  328. :config
  329. (setq imenu-list-focus-after-activation t
  330. imenu-list-auto-resize t
  331. imenu-list-position 'right)
  332. :bind
  333. (:map global-map
  334. ([f9] . imenu-list-smart-toggle))
  335. )
  336. #+END_SRC
  337. * which-key
  338. :PROPERTIES:
  339. :ID: a880f079-b3a3-4706-bf1e-5f6c680101f1
  340. :END:
  341. #+BEGIN_SRC emacs-lisp
  342. (use-package which-key
  343. :ensure t
  344. :diminish which-key-mode
  345. :defer t
  346. :config
  347. (which-key-mode)
  348. (which-key-setup-side-window-right-bottom)
  349. (which-key-setup-minibuffer)
  350. (setq which-key-idle-delay 0.5))
  351. #+END_SRC
  352. * Evil
  353. :PROPERTIES:
  354. :ID: 80ca70e2-a146-46db-b581-418d655dc1fc
  355. :END:
  356. #+BEGIN_SRC emacs-lisp
  357. (use-package evil
  358. :ensure t
  359. :defer .1 ;; don't block emacs when starting, load evil immediately after startup
  360. :config
  361. (evil-mode 1))
  362. #+END_SRC
  363. * General (key mapper)
  364. :PROPERTIES:
  365. :ID: a20f183f-d41a-4dff-bc37-3bc4e25c8036
  366. :END:
  367. #+BEGIN_SRC emacs-lisp
  368. (use-package general
  369. :ensure t)
  370. (general-define-key
  371. :states 'normal
  372. :keymaps 'imenu-list-major-mode-map
  373. (kbd "RET") '(imenu-list-goto-entry :which-key "goto")
  374. (kbd "TAB") '(hs-toggle-hiding :which-key "collapse")
  375. "d" '(imenu-list-display-entry :which-key "show")
  376. "q" '(imenu-list-quit-window :which-key "quit"))
  377. #+END_SRC
  378. * ivy / counsel / swiper
  379. :PROPERTIES:
  380. :ID: 55c74ba9-7761-4545-8ddd-087d6ee33e4b
  381. :END:
  382. #+BEGIN_SRC emacs-lisp
  383. ; (require 'ivy)
  384. (use-package ivy
  385. :ensure t
  386. :diminish
  387. (ivy-mode . "")
  388. :defer t
  389. :init
  390. (ivy-mode 1)
  391. :bind
  392. ("C-r" . ivy-resume) ;; overrides isearch-backwards binding
  393. :config
  394. (setq ivy-use-virtual-buffers t ;; recent files and bookmarks in ivy-switch-buffer
  395. ivy-height 20 ;; height of ivy window
  396. ivy-count-format "%d/%d" ;; current and total number
  397. ivy-re-builders-alist ;; regex replaces spaces with *
  398. '((t . ivy--regex-plus))))
  399. ; make counsel-M-x more descriptive
  400. (use-package ivy-rich
  401. :ensure t
  402. :defer t
  403. :init
  404. (ivy-rich-mode 1))
  405. (use-package counsel
  406. :ensure t
  407. :defer t
  408. :bind
  409. (("M-x" . counsel-M-x)
  410. ("C-x C-f" . counsel-find-file)
  411. ("C-x C-r" . counsel-recentf)
  412. ("C-x b" . counsel-switch-buffer)
  413. ("C-c C-f" . counsel-git)
  414. ("C-c h f" . counsel-describe-function)
  415. ("C-c h v" . counsel-describe-variable)
  416. ("M-i" . counsel-imenu)))
  417. ; :map minibuffer-local-map ;;currently mapped to evil-redo
  418. ; ("C-r" . 'counsel-minibuffer-history)))
  419. (use-package swiper
  420. :ensure t
  421. :bind
  422. ("C-s" . swiper))
  423. (use-package ivy-hydra
  424. :ensure t)
  425. #+END_SRC
  426. * misc
  427. #+begin_src emacs-lisp
  428. (use-package autorevert
  429. :diminish auto-revert-mode)
  430. #+end_src
  431. * company
  432. :PROPERTIES:
  433. :ID: 944563b6-b04a-44f2-9b21-a6a3e200867c
  434. :END:
  435. #+BEGIN_SRC emacs-lisp
  436. (use-package company
  437. :defer 1
  438. :diminish
  439. :defer t
  440. :bind
  441. (("C-<tab>" . company-complete)
  442. :map company-active-map
  443. ("RET" . nil)
  444. ([return] . nil)
  445. ("TAB" . company-complete-selection)
  446. ([tab] . company-complete-selection)
  447. ("<right>" . company-complete-common))
  448. :hook
  449. (after-init . global-company-mode)
  450. :config
  451. (setq company-idle-delay .2
  452. company-minimum-prefix-length 1
  453. company-require-match nil
  454. company-show-numbers t
  455. company-tooltip-align-annotations t))
  456. (use-package company-statistics
  457. :ensure t
  458. :after company
  459. :defer t
  460. :init
  461. (setq company-statistics-file (concat MY--PATH_USER_LOCAL "company-statistics-cache.el"));~/.emacs.d/user-dir/company-statistics-cache.el")
  462. :config
  463. (company-statistics-mode 1))
  464. (use-package company-dabbrev
  465. :ensure nil
  466. :after company
  467. :defer t
  468. :config
  469. (setq-default company-dabbrev-downcase nil))
  470. (use-package company-box
  471. :ensure t
  472. :diminish
  473. :defer t
  474. :init
  475. (add-hook 'company-mode-hook 'company-box-mode))
  476. #+END_SRC
  477. ** company backends
  478. :PROPERTIES:
  479. :ID: 4ce2e728-276d-41f9-9538-84e6e08afd8d
  480. :END:
  481. #+BEGIN_SRC emacs-lisp
  482. (defun company/org-mode-hook()
  483. (set (make-local-variable 'company-backends)
  484. '(company-capf company-files))
  485. (add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t)
  486. (message "company/org-mode-hook"))
  487. (defun company/elisp-mode-hook()
  488. (set (make-local-variable 'company-backends)
  489. '(company-capf company-files))
  490. (message "company/elisp-mode-hook"))
  491. (defun company/beancount-mode-hook()
  492. (set (make-local-variable 'company-backends)
  493. '(company-beancount)))
  494. #+END_SRC
  495. * orgmode
  496. ** org
  497. :PROPERTIES:
  498. :ID: b89d7639-080c-4168-8884-bd5d8965f466
  499. :END:
  500. #+BEGIN_SRC emacs-lisp
  501. (use-package org
  502. :ensure org-plus-contrib
  503. :mode (("\.org$" . org-mode))
  504. :diminish org-indent-mode
  505. :defer t
  506. :init
  507. (add-hook 'org-mode-hook 'company/org-mode-hook)
  508. (add-hook 'org-src-mode-hook 'smartparens-mode)
  509. (add-hook 'org-mode-hook 'org-indent-mode)
  510. :config
  511. (setq org-modules (quote (org-id
  512. org-habit
  513. org-tempo ;; easy templates
  514. )))
  515. (setq org-default-notes-file (concat MY--PATH_ORG_FILES "notes.org")
  516. org-agenda-files (list (concat MY--PATH_ORG_FILES "notes.org")
  517. (concat MY--PATH_ORG_FILES "projects.org")
  518. (concat MY--PATH_ORG_FILES "tasks.org")))
  519. (when *sys/linux*
  520. (nconc org-agenda-files
  521. (directory-files-recursively MY--PATH_ORG_FILES_MOBILE "\\.org$")))
  522. (setq org-id-locations-file (concat MY--PATH_USER_LOCAL ".org-id-locations")
  523. org-log-into-drawer "LOGBOOK")
  524. ;; some display customizations
  525. (setq org-pretty-entities t
  526. org-startup-truncated t
  527. org-startup-align-all-tables t)
  528. ;; some source code blocks customizations
  529. (setq org-src-window-setup 'current-window ;; C-c ' opens in current window
  530. org-src-fontify-natively t ;; use syntax highlighting in code blocks
  531. org-src-preserve-indentation t ;; no extra indentation
  532. org-src-tab-acts-natively t)
  533. (setq org-log-done 'time)) ;; create timestamp when task is done
  534. #+END_SRC
  535. ** languages
  536. :PROPERTIES:
  537. :ID: ad3af718-d0db-448c-9f75-eb9e250c2862
  538. :END:
  539. Set some languages and disable confirmation for evaluating code blocks C-c C-c
  540. +BEGIN_SRC emacs-lisp
  541. (org-babel-do-load-languages
  542. 'org-babel-load-languages
  543. '((emacs-lisp . t)
  544. (gnuplot . t)
  545. (js . t)
  546. (latex . t)
  547. (lisp . t)
  548. (python . t)
  549. (shell . t)
  550. (sqlite . t)
  551. (org . t)
  552. (R . t)
  553. (scheme . t)))
  554. (setq org-confirm-babel-evaluate nil)
  555. +END_SRC
  556. Another setup, because org-babel-do-load-languages requires eager loading
  557. #+begin_src emacs-lisp
  558. (use-package ob-org
  559. :defer t
  560. :ensure org-plus-contrib
  561. :commands
  562. (org-babel-execute:org
  563. org-babel-expand-body:org))
  564. (use-package ob-python
  565. :defer t
  566. :ensure org-plus-contrib
  567. :commands (org-babel-execute:python))
  568. (use-package ob-js
  569. :defer t
  570. :ensure org-plus-contrib
  571. :commands (org-babel-execute:js))
  572. (use-package ob-shell
  573. :defer t
  574. :ensure org-plus-contrib
  575. :commands
  576. (org-babel-execute:sh
  577. org-babel-expand-body:sh
  578. org-babel-execute:bash
  579. org-babel-expand-body:bash))
  580. (use-package ob-emacs-lisp
  581. :defer t
  582. :ensure org-plus-contrib
  583. :commands
  584. (org-babel-execute:emacs-lisp
  585. org-babel-expand-body:emacs-lisp))
  586. (use-package ob-lisp
  587. :defer t
  588. :ensure org-plus-contrib
  589. :commands
  590. (org-babel-execute:lisp
  591. org-babel-expand-body:lisp))
  592. (use-package ob-gnuplot
  593. :defer t
  594. :ensure org-plus-contrib
  595. :commands
  596. (org-babel-execute:gnuplot
  597. org-babel-expand-body:gnuplot))
  598. (use-package ob-sqlite
  599. :defer t
  600. :ensure org-plus-contrib
  601. :commands
  602. (org-babel-execute:sqlite
  603. org-babel-expand-body:sqlite))
  604. (use-package ob-latex
  605. :defer t
  606. :ensure org-plus-contrib
  607. :commands
  608. (org-babel-execute:latex
  609. org-babel-expand-body:latex))
  610. (use-package ob-R
  611. :defer t
  612. :ensure org-plus-contrib
  613. :commands
  614. (org-babel-execute:R
  615. org-babel-expand-body:R))
  616. (use-package ob-scheme
  617. :defer t
  618. :ensure org-plus-contrib
  619. :commands
  620. (org-babel-execute:scheme
  621. org-babel-expand-body:scheme))
  622. #+end_src
  623. ** habits
  624. :PROPERTIES:
  625. :ID: fcc91d0a-d040-4910-b2cf-3221496a3842
  626. :END:
  627. #+BEGIN_SRC emacs-lisp
  628. (require 'org-habit) ;;TODO Lösung ohne require finden, scheint mir nicht ideal zu sein, nur um ein org-modul zu aktivieren
  629. ;; (add-to-list 'org-modules "org-habit")
  630. (setq org-habit-graph-column 80
  631. org-habit-preceding-days 30
  632. org-habit-following-days 7
  633. org-habit-show-habits-only-for-today nil)
  634. #+END_SRC
  635. ** org-id
  636. :PROPERTIES:
  637. :ID: c4017c45-d650-410c-8bd4-bc3cf42bbbb9
  638. :END:
  639. Currently it causes some debugger errors "not a standard org time string", so it's disabled
  640. #+BEGIN_SRC emacs-lisp
  641. ;; (use-package org-id
  642. ;; :config
  643. ;; (setq org-id-link-to-org-use-id t)
  644. ;; (org-id-update-id-locations)) ;; update id file .org-id-locations on startup
  645. #+END_SRC
  646. ** org-agenda
  647. :PROPERTIES:
  648. :ID: 03b67efb-4179-41e5-bc2e-c472b13f8be6
  649. :END:
  650. Custom keywords, depending on environment
  651. #+BEGIN_SRC emacs-lisp
  652. (when *work_remote*
  653. (setq org-todo-keywords
  654. '((sequence "OPEN" "TODO" "UNCLEAR" "|" "DONE" "IMPOSSIBLE" "CANCELLED"))))
  655. #+END_SRC
  656. Add some key bindings
  657. #+BEGIN_SRC emacs-lisp
  658. (bind-key "C-c l" 'org-store-link)
  659. (bind-key "C-c c" 'org-capture)
  660. (bind-key "C-c a" 'org-agenda)
  661. #+END_SRC
  662. Sort agenda by deadline and priority
  663. #+BEGIN_SRC emacs-lisp
  664. (setq org-agenda-sorting-strategy
  665. (quote
  666. ((agenda deadline-up priority-down)
  667. (todo priority-down category-keep)
  668. (tags priority-down category-keep)
  669. (search category-keep))))
  670. #+END_SRC
  671. Customize the org agenda
  672. #+BEGIN_SRC emacs-lisp
  673. (defun me--org-skip-subtree-if-priority (priority)
  674. "Skip an agenda subtree if it has a priority of PRIORITY.
  675. PRIORITY may be one of the characters ?A, ?B, or ?C."
  676. (let ((subtree-end (save-excursion (org-end-of-subtree t)))
  677. (pri-value (* 1000 (- org-lowest-priority priority)))
  678. (pri-current (org-get-priority (thing-at-point 'line t))))
  679. (if (= pri-value pri-current)
  680. subtree-end
  681. nil)))
  682. (setq org-agenda-custom-commands
  683. '(("c" "Simple agenda view"
  684. ((tags "PRIORITY=\"A\""
  685. ((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
  686. (org-agenda-overriding-header "Hohe Priorität:")))
  687. (agenda ""
  688. ((org-agenda-span 7)
  689. (org-agenda-start-on-weekday nil)
  690. (org-agenda-overriding-header "Nächste 7 Tage:")))
  691. (alltodo ""
  692. ((org-agenda-skip-function '(or (me--org-skip-subtree-if-priority ?A)
  693. (org-agenda-skip-if nil '(scheduled deadline))))
  694. (org-agenda-overriding-header "Sonstige Aufgaben:")))))))
  695. #+END_SRC
  696. ** *TODO*
  697. org-super-agenda
  698. ** org-caldav
  699. :PROPERTIES:
  700. :ID: 6bd24369-0d04-452f-85a0-99914dfb74ff
  701. :END:
  702. Vorerst deaktiviert, Nutzen evtl. nicht vorhanden
  703. #+BEGIN_SRC emacs-lisp
  704. ;;(use-package org-caldav
  705. ;; :ensure t
  706. ;; :config
  707. ;; (setq org-caldav-url "https://nextcloud.cloudsphere.duckdns.org/remote.php/dav/calendars/marc"
  708. ;; org-caldav-calendar-id "orgmode"
  709. ;; org-caldav-inbox (expand-file-name "~/Archiv/Organisieren/caldav-inbox")
  710. ;; org-caldav-files (concat MY--PATH_ORG_FILES "tasks")))
  711. #+END_SRC
  712. ** journal
  713. :PROPERTIES:
  714. :ID: a1951e18-d862-4198-9652-016e979053c8
  715. :END:
  716. [[https://github.com/bastibe/org-journal][Source]]
  717. #+BEGIN_SRC emacs-lisp
  718. (use-package org-journal
  719. :if *sys/linux*
  720. :ensure t
  721. :defer t
  722. :config
  723. ;; feels hacky, but this way compiler error "assignment to free variable" disappears
  724. (when (and (boundp 'org-journal-dir)
  725. (boundp 'org-journal-enable-agenda-integration))
  726. (setq org-journal-dir MY--PATH_ORG_JOURNAl
  727. org-journal-enable-agenda-integration t)))
  728. #+END_SRC
  729. * Programming
  730. ** misc
  731. #+begin_src emacs-lisp
  732. (use-package eldoc
  733. :diminish eldoc-mode
  734. :defer t)
  735. #+end_src
  736. ** Magit / Git
  737. :PROPERTIES:
  738. :ID: d3589460-317f-40f6-9056-053be9ba3217
  739. :END:
  740. Little crash course in magit:
  741. - magit-init to init a git project
  742. - magit-status (C-x g) to call the status window
  743. In status buffer:
  744. - s stage files
  745. - u unstage files
  746. - U unstage all files
  747. - a apply changes to staging
  748. - c c commit (type commit message, then C-c C-c to commit)
  749. - b b switch to another branch
  750. - P u git push
  751. - F u git pull
  752. #+BEGIN_SRC emacs-lisp
  753. (use-package magit
  754. :ensure t
  755. :defer t
  756. :init
  757. ; set git-path in work environment
  758. (if (string-equal user-login-name "POH")
  759. (setq magit-git-executable "P:/Eigene Dateien/Tools/Git/bin/git.exe")
  760. )
  761. :bind (("C-x g" . magit-status)))
  762. #+END_SRC
  763. ** LSP
  764. :PROPERTIES:
  765. :ID: 06ad00e0-44a6-4bfb-ba6f-b1672811e053
  766. :END:
  767. Configuration for the language server protocol
  768. *ACHTUNG* Dateipfad muss absolut sein, symlink im Pfad führt zumindest beim ersten Start zu Fehlern beim lsp
  769. Sobald der lsp einmal lief, kann zukünftig der symlink-Pfad genommen werden.
  770. Getestet wurde die funktionierende Datei selbst und neu erstellte Dateien im selben Pfad.
  771. TODO Unterverzeichnisse wurden noch nicht getestet
  772. #+BEGIN_SRC emacs-lisp
  773. (setq read-process-output-max (* 1024 1024)) ;; support reading large blobs of data for LSP's sake
  774. (use-package lsp-mode
  775. :defer t
  776. :commands (lsp lsp-execute-code-action)
  777. :custom
  778. (lsp-auto-guess-root nil)
  779. (lsp-prefer-flymake nil) ; use flycheck instead
  780. (lsp-file-watch-threshold 5000)
  781. (lsb-print-performance t)
  782. (lsp-log-io t)
  783. (lsp-diagnostics-modeline-scope :project)
  784. (lsp-enable-file-watchers nil)
  785. :bind (:map lsp-mode-map ("C-c C-f" . lsp-format-buffer))
  786. :hook
  787. (((python-mode
  788. js-mode
  789. js2-mode
  790. typescript-mode
  791. web-mode) . lsp)
  792. (lsp-mode . lsp-enable-which-key-integration)
  793. (lsp-mode . lsp-diagnostics-modeline-mode)))
  794. (use-package lsp-ui
  795. :after lsp-mode
  796. :ensure t
  797. :defer t
  798. :diminish
  799. :commands lsp-ui-mode
  800. :config
  801. (setq lsp-ui-doc-enable t
  802. lsp-ui-doc-header t
  803. lsp-ui-doc-include-signature t
  804. lsp-ui-doc-position 'top
  805. lsp-ui-doc-border (face-foreground 'default)
  806. lsp-ui-sideline-enable nil
  807. lsp-ui-sideline-ignore-duplicate t
  808. lsp-ui-sideline-show-code-actions nil)
  809. (when *sys/gui*
  810. (setq lsp-ui-doc-use-webkit t))
  811. ;; workaround hide mode-line of lsp-ui-imenu buffer
  812. (defadvice lsp-ui-imenu (after hide-lsp-ui-imenu-mode-line activate)
  813. (setq mode-line-format nil)))
  814. (use-package company-lsp
  815. :requires company
  816. :defer t
  817. :ensure t
  818. :config
  819. ;;disable client-side cache because lsp server does a better job
  820. (setq company-transformers nil
  821. company-lsp-async t
  822. company-lsp-cache-candidates nil))
  823. #+END_SRC
  824. ** yasnippet
  825. :PROPERTIES:
  826. :ID: 935d89ef-645e-4e92-966f-2fe3bebb2880
  827. :END:
  828. For useful snippet either install yasnippet-snippets or get them from here
  829. [[https://github.com/AndreaCrotti/yasnippet-snippets][Github]]
  830. #+begin_src emacs-lisp
  831. (use-package yasnippet
  832. :ensure t
  833. :defer t
  834. :diminish yas-minor-mode
  835. :config
  836. (setq yas-snippet-dirs (list (concat MY--PATH_USER_GLOBAL "snippets")))
  837. (yas-global-mode t)
  838. (yas-reload-all)
  839. (unbind-key "TAB" yas-minor-mode-map)
  840. (unbind-key "<tab>" yas-minor-mode-map))
  841. #+end_src
  842. ** hippie expand
  843. :PROPERTIES:
  844. :ID: c55245bc-813d-4816-a0ca-b4e2e793e28b
  845. :END:
  846. With hippie expand I am able to use yasnippet and emmet at the same time with the same key.
  847. #+begin_src emacs-lisp
  848. (use-package hippie-exp
  849. :defer t
  850. :bind
  851. ("C-<return>" . hippie-expand)
  852. :config
  853. (setq hippie-expand-try-functions-list
  854. '(yas-hippie-try-expand emmet-expand-line)))
  855. #+end_src
  856. ** flycheck
  857. :PROPERTIES:
  858. :ID: 3d8f2547-c5b3-46d0-91b0-9667f9ee5c47
  859. :END:
  860. #+BEGIN_SRC emacs-lisp
  861. (use-package flycheck
  862. :ensure t
  863. :hook
  864. ((css-mode . flycheck-mode)
  865. (emacs-lisp-mode . flycheck-mode)
  866. (python-mode . flycheck-mode))
  867. :defer 1.0
  868. :init
  869. (setq flycheck-emacs-lisp-load-path 'inherit)
  870. :config
  871. (setq-default
  872. flycheck-check-synta-automatically '(save mode-enabled)
  873. flycheck-disable-checkers '(emacs-lisp-checkdoc)
  874. eldoc-idle-delay .1 ;; let eldoc echo faster than flycheck
  875. flycheck-display-errors-delay .3)) ;; this way any errors will override eldoc messages
  876. #+END_SRC
  877. ** Projectile
  878. :PROPERTIES:
  879. :ID: a90329fd-4d36-435f-8308-a2771ac4c320
  880. :END:
  881. Manage projects and jump quickly between its files
  882. #+BEGIN_SRC emacs-lisp
  883. (use-package projectile
  884. :ensure t
  885. :defer 1.0
  886. :diminish
  887. :hook (projectile-after-switch-project . (lambda () (set-workon_home))) ;; for pyvenv to auto activate environment
  888. :bind-keymap
  889. ("C-c p" . projectile-command-map)
  890. ; :bind
  891. ; (("C-c p p" . projectile-switch-project)
  892. ; ("C-c p c" . projectile-command-map)
  893. ; ("C-c p s s" . projectile-ag))
  894. :preface
  895. (defun set-workon_home()
  896. (setenv "WORKON_HOME" (projectile-project-root)))
  897. :init
  898. (setq-default projectile-cache-file (concat MY--PATH_USER_LOCAL ".projectile-cache")
  899. projectile-known-projects-file (concat MY--PATH_USER_LOCAL ".projectile-bookmarks"))
  900. :config
  901. (projectile-mode t)
  902. (setq-default projectile-completion-system 'ivy
  903. projectile-enable-caching t
  904. projectile-mode-line '(:eval (projectile-project-name))))
  905. ;; requires ripgrep on system for rg functions
  906. (use-package counsel-projectile
  907. :ensure t
  908. :config (counsel-projectile-mode))
  909. #+END_SRC
  910. ** smartparens
  911. :PROPERTIES:
  912. :ID: 997ec416-33e6-41ed-8c7c-75a7bc47d285
  913. :END:
  914. #+BEGIN_SRC emacs-lisp
  915. (use-package smartparens
  916. :ensure t
  917. :diminish smartparens-mode
  918. :bind
  919. (:map smartparens-mode-map
  920. ("C-M-f" . sp-forward-sexp)
  921. ("C-M-b" . sp-backward-sexp)
  922. ("C-M-a" . sp-backward-down-sexp)
  923. ("C-M-e" . sp-up-sexp)
  924. ("C-M-w" . sp-copy-sexp)
  925. ("M-k" . sp-kill-sexp)
  926. ("C-M-<backspace>" . sp-slice-sexp-killing-backward)
  927. ("C-S-<backspace>" . sp-slice-sexp-killing-around)
  928. ("C-]" . sp-select-next-thing-exchange))
  929. :config
  930. (setq sp-show-pair-from-inside nil
  931. sp-escape-quotes-after-insert nil)
  932. (require 'smartparens-config))
  933. #+END_SRC
  934. ** lisp
  935. :PROPERTIES:
  936. :ID: a2bc3e08-b203-49d3-b337-fb186a14eecb
  937. :END:
  938. #+BEGIN_SRC emacs-lisp
  939. (add-hook 'emacs-lisp-mode-hook 'company/elisp-mode-hook)
  940. #+END_SRC
  941. ** web
  942. :PROPERTIES:
  943. :ID: c0b0b4e4-2162-429f-b80d-6e5334b1290e
  944. :END:
  945. apt install npm
  946. sudo npm install -g vscode-html-languageserver-bin
  947. evtl alternativ typescript-language-server?
  948. Unter Windows:
  949. Hier runterladen: https://nodejs.org/dist/latest/
  950. und in ein Verzeichnis entpacken.
  951. Optional: PATH erweitern unter Windows (so kann exec-path-from-shell den Pfad ermitteln):
  952. PATH=P:\path\to\node;%path%
  953. #+BEGIN_SRC emacs-lisp
  954. (use-package web-mode
  955. :ensure t
  956. :defer t
  957. :mode
  958. ("\\.phtml\\'"
  959. "\\.tpl\\.php\\'"
  960. "\\.djhtml\\'"
  961. "\\.[t]?html?\\'")
  962. :init
  963. (if *work_remote*
  964. (setq exec-path (append exec-path '("P:/Tools/node"))))
  965. :config
  966. (setq web-mode-enable-auto-closing t
  967. web-mode-enable-auto-pairing t)
  968. (add-hook 'web-mode-hook 'smartparens-mode))
  969. #+END_SRC
  970. Emmet offers snippets, similar to yasnippet.
  971. Default completion is C-j
  972. [[https://github.com/smihica/emmet-mode#usage][Github]]
  973. #+begin_src emacs-lisp
  974. (use-package emmet-mode
  975. :ensure t
  976. :defer t
  977. :hook
  978. ((web-mode . emmet-mode)
  979. (css-mode . emmet-mode))
  980. :config
  981. (unbind-key "C-<return>" emmet-mode-keymap))
  982. #+end_src
  983. ** YAML
  984. :PROPERTIES:
  985. :ID: 95413247-04d5-4e02-8431-06c162ec8f3b
  986. :END:
  987. #+begin_src emacs-lisp
  988. (use-package yaml-mode
  989. :if *sys/linux*
  990. :ensure t
  991. :defer t
  992. :mode ("\\.yml$" . yaml-mode))
  993. #+end_src
  994. ** R
  995. #+BEGIN_SRC emacs-lisp
  996. (use-package ess
  997. :ensure t
  998. :defer t
  999. :init
  1000. (if *work_remote*
  1001. (setq exec-path (append exec-path '("P:/Tools/R/bin/x64"))
  1002. org-babel-R-command "P:/Tools/R/bin/x64/R --slave --no-save")))
  1003. #+END_SRC
  1004. ** Python
  1005. :PROPERTIES:
  1006. :ID: 8c76fcd1-c57c-48ab-8af0-aa782de6337f
  1007. :END:
  1008. Systemseitig muss python-language-server installiert sein:
  1009. apt install python3-pip python3-setuptools python3-wheel
  1010. apt install build-essential python3-dev
  1011. pip3 install 'python-language-server[all]'
  1012. für andere language servers
  1013. https://github.com/emacs-lsp/lsp-mode#install-language-server
  1014. #+BEGIN_SRC emacs-lisp
  1015. (use-package lsp-python-ms
  1016. :if *sys/linux*
  1017. :ensure t
  1018. :defer t
  1019. :custom (lsp-python-ms-auto-install-server t))
  1020. (use-package python
  1021. :if *sys/linux*
  1022. :delight "π "
  1023. :defer t
  1024. :bind (("M-[" . python-nav-backward-block)
  1025. ("M-]" . python-nav-forward-block)))
  1026. (use-package pyvenv
  1027. :if *sys/linux*
  1028. :ensure t
  1029. :defer t
  1030. :after python
  1031. :hook ((python-mode . pyvenv-mode)
  1032. (python-mode . (lambda ()
  1033. (if-let ((pyvenv-directory (find-pyvenv-directory (buffer-file-name))))
  1034. (pyvenv-activate pyvenv-directory))
  1035. (lsp))))
  1036. :custom
  1037. (pyvenv-default-virtual-env-name "env")
  1038. (pyvenv-mode-line-indicator '(pyvenv-virtual-env-name ("[venv:" pyvenv-virtual-env-name "]")))
  1039. :preface
  1040. (defun find-pyvenv-directory (path)
  1041. "Check if a pyvenv directory exists."
  1042. (cond
  1043. ((not path) nil)
  1044. ((file-regular-p path) (find-pyvenv-directory (file-name-directory path)))
  1045. ((file-directory-p path)
  1046. (or
  1047. (seq-find
  1048. (lambda (path) (file-regular-p (expand-file-name "pyvenv.cfg" path)))
  1049. (directory-files path t))
  1050. (let ((parent (file-name-directory (directory-file-name path))))
  1051. (unless (equal parent path) (find-pyvenv-directory parent))))))))
  1052. ;; manage multiple python version
  1053. ;; needs to be installed on system
  1054. ; (use-package pyenv-mode
  1055. ; :ensure t
  1056. ; :after python
  1057. ; :hook ((python-mode . pyenv-mode)
  1058. ; (projectile-switch-project . projectile-pyenv-mode-set))
  1059. ; :custom (pyenv-mode-set "3.8.5")
  1060. ; :preface
  1061. ; (defun projectile-pyenv-mode-set ()
  1062. ; "Set pyenv version matching project name."
  1063. ; (let ((project (projectile-project-name)))
  1064. ; (if (member project (pyenv-mode-versions))
  1065. ; (pyenv-mode-set project)
  1066. ; (pyenv-mode-unset)))))
  1067. ;)
  1068. #+END_SRC
  1069. * beancount
  1070. ** Installation
  1071. :PROPERTIES:
  1072. :ID: 2c329043-b7a9-437d-a5cf-f2ad6514be91
  1073. :END:
  1074. #+BEGIN_SRC shell
  1075. sudo su
  1076. cd /opt
  1077. python3 -m venv beancount
  1078. source ./beancount/bin/activate
  1079. pip3 install wheel
  1080. pip3 install beancount
  1081. sleep 100
  1082. echo "shell running!"
  1083. deactivate
  1084. #+END_SRC
  1085. #+BEGIN_SRC emacs-lisp
  1086. (use-package beancount
  1087. :if *sys/linux*
  1088. :load-path "user-global/elisp"
  1089. ; :ensure t
  1090. :defer t
  1091. :mode
  1092. ("\\.beancount$" . beancount-mode)
  1093. :init
  1094. (add-hook 'beancount-mode-hook 'company/beancount-mode-hook)
  1095. ; (add-hook 'beancount-mode-hook (pyvenv-activate "/opt/beancount"))
  1096. ; (setenv "PATH"
  1097. ; (concat "/opt/beancount/bin:"
  1098. ; (getenv "PATH")))
  1099. :config
  1100. (setq beancount-filename-main "/home/marc/Archiv/Finanzen/Transaktionen/transactions.beancount"))
  1101. #+END_SRC
  1102. To support org-babel, check if it can find the symlink to ob-beancount.el
  1103. #+BEGIN_SRC shell
  1104. orgpath=`find /home/marc/.emacs.d/elpa/ -type d -name "org-plus*" -print`
  1105. beansym="$orgpath/ob-beancount.el
  1106. bean="/home/marc/Archiv/Programmierprojekte/Lisp/beancount-mode/ob-beancount.el"
  1107. if [ -h "$beansym" ]
  1108. then
  1109. echo "$beansym found"
  1110. elif [ -e "$bean" ]
  1111. then
  1112. echo "creating symlink"
  1113. ln -s "$bean" "$beansym"
  1114. else
  1115. echo "$bean not found, symlink creation aborted"
  1116. fi
  1117. #+END_SRC
  1118. Fava is strongly recommended.
  1119. #+BEGIN_SRC shell
  1120. cd /opt
  1121. python3 -m venv fava
  1122. source ./fava/bin/activate
  1123. pip3 install wheel
  1124. pip3 install fava
  1125. deactivate
  1126. #+END_SRC
  1127. Start fava with fava my_file.beancount
  1128. It is accessable on this URL: [[http://127.0.0.1:5000][Fava]]
  1129. Beancount-mode can start fava and open the URL right away.
  1130. * Stuff after everything else
  1131. Set garbage collector to a smaller value to let it kick in faster.
  1132. Maybe a problem on Windows?
  1133. #+begin_src emacs-lisp
  1134. (setq gc-cons-threshold (* 2 1000 1000))
  1135. #+end_src