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.

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