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.

729 lines
21 KiB

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
4 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
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
4 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
4 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 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
5 years ago
4 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. - Paket exec-path-from-shell, um PATH aus Linux auch in emacs zu haben
  7. - Smart mode line?
  8. - Theme
  9. - evil-collection or custom in init file?
  10. - Hydra
  11. - General
  12. - (defalias 'list-buffers 'ibuffer) ;; change default to ibuffer
  13. - ido?
  14. - treemacs (for linux)
  15. - treemacs-evil?
  16. - treemacs-projectile
  17. - ace-window
  18. - windmove?
  19. - tramp (in linux)
  20. - visual-regexp
  21. - org configuration: paths
  22. - org custom agenda
  23. - org configuration: everything else
  24. - beancount configuration from config.org
  25. - CONTINUE TODO from config.org at Programming
  26. * First start
  27. :PROPERTIES:
  28. :ID: ec248005-527f-4fa1-bdef-9343f2fa28b0
  29. :END:
  30. 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
  31. #+BEGIN_SRC emacs-lisp :tangle no
  32. (require 'org')
  33. (find-file (concat user-emacs-directory "init.org"))
  34. (org-babel-tangle)
  35. (load-file (concat user-emacs-directory "init.el"))
  36. (byte-compile-file (concat user-emacs-directory "init.el"))
  37. #+END_SRC
  38. This function updates init.el whenever changes in init.org are made. The update will be active after saving.
  39. #+BEGIN_SRC emacs-lisp
  40. (defun me/tangle-init ()
  41. "If the current buffer is 'init.org',
  42. the code blocks are tangled, and the tangled file is compiled."
  43. (when (equal (buffer-file-name)
  44. (expand-file-name (concat user-emacs-directory "init.org")))
  45. ;; avoid running hooks
  46. (let ((prog-mode-hook nil))
  47. (org-babel-tangle)
  48. (byte-compile-file (concat user-emacs-directory "init.el"))
  49. (load-file user-init-file))))
  50. (add-hook 'after-save-hook 'me/tangle-init)
  51. #+END_SRC
  52. #+BEGIN_SRC emacs-lisp
  53. (require 'package)
  54. ;; bug before emacs 26.3
  55. (when (version< emacs-version "26.3")
  56. (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3"))
  57. (add-to-list 'package-archives '("elpa" . "https://elpa.gnu.org/packages/") t)
  58. (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
  59. (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
  60. (add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
  61. (package-initialize)
  62. #+END_SRC
  63. #+BEGIN_SRC emacs-lisp
  64. (unless (package-installed-p 'use-package)
  65. (package-refresh-contents)
  66. (package-install 'use-package))
  67. (setq use-package-verbose nil)
  68. (eval-when-compile
  69. (require 'use-package))
  70. (require 'bind-key)
  71. (use-package diminish
  72. :ensure t)
  73. #+END_SRC
  74. * Default settings
  75. :PROPERTIES:
  76. :ID: 00b48602-2a95-492e-a90b-c1e3a94c1ecb
  77. :END:
  78. #+BEGIN_SRC emacs-lisp
  79. (defvar me/whoami
  80. (if (string-equal (system-name) "PMTS01")
  81. "work_remote"
  82. (if (string-equal (system-name) "laptop")
  83. "home_laptop"
  84. (if (string-equal (system-name) "PMPCNEU08")
  85. "work_local"
  86. "home_desktop"))))
  87. #+END_SRC
  88. #+BEGIN_SRC emacs-lisp
  89. (defvar MY--PATH_USER_LOCAL (expand-file-name "~/.emacs.d/user-local/"))
  90. (defvar MY--PATH_USER_GLOBAL (expand-file-name "~/.emacs.d/user-global/"))
  91. (defvar MY--PATH_ORG_FILES (expand-file-name "~/Archiv/Organisieren/"))
  92. (defvar MY--PATH_ORG_FILES_MOBILE (expand-file-name "~/Archiv/Organisieren/mobile/"))
  93. (defvar MY--PATH_ORG_JOURNAl (expand-file-name "~/Archiv/Organisieren/Journal/"))
  94. (setq bookmark-default-file (concat MY--PATH_USER_LOCAL "bookmarks"))
  95. (setq recentf-save-file (concat MY--PATH_USER_LOCAL "recentf"))
  96. (setq custom-file (concat MY--PATH_USER_LOCAL "custom.el")) ;; don't spam init.e with saved customization settings
  97. (setq abbrev-file-name (concat MY--PATH_USER_GLOBAL "abbrev_defs"))
  98. (setq backup-directory-alist `((".*" . ,temporary-file-directory)))
  99. (setq auto-save-file-name-transforms `((".*" ,temporary-file-directory)))
  100. (setq save-abbrevs 'silently) ;; don't bother me with asking for abbrev saving
  101. (setq-default create-lockfiles nil) ;; disable lock files, can cause trouble in e.g. lsp-mode
  102. (defalias 'yes-or-no-p 'y-or-n-p) ;; answer with y and n
  103. (setq custom-safe-themes t) ;; don't ask me if I want to load a theme
  104. (setq sentence-end-double-space nil) ;; don't coun two spaces after a period as the end of a sentence.
  105. (delete-selection-mode t) ;; delete selected region when typing
  106. (save-place-mode 1) ;; saves position in file when it's closed
  107. (setq save-place-forget-unreadable-files nil) ;; checks if file is readable before saving position
  108. (setq locale-coding-system 'utf-8)
  109. (set-terminal-coding-system 'utf-8)
  110. (set-keyboard-coding-system 'utf-8)
  111. (set-selection-coding-system 'utf-8)
  112. (if (eq system-type 'windows-nt)
  113. (prefer-coding-system 'utf-8-dos)
  114. (prefer-coding-system 'utf-8))
  115. (blink-cursor-mode -1) ;; turn off blinking cursor
  116. (show-paren-mode t) ;; show other part of brackets
  117. (column-number-mode t)
  118. (setq uniquify-buffer-name-style 'forward)
  119. (setq-default indent-tabs-mode nil) ;; avoid tabs in place of multiple spaces (they look bad in tex)
  120. (setq-default indicate-empty-lines t) ;; show empty lines
  121. (setq scroll-margin 5 ;; smooth scrolling
  122. scroll-conservatively 10000
  123. scroll-preserve-screen-position 1
  124. scroll-step 1)
  125. (global-hl-line-mode t) ;; highlight current line
  126. (menu-bar-mode 0) ;; disable menu bar
  127. (tool-bar-mode 0) ;; disable tool bar
  128. (scroll-bar-mode 0) ;; disable scroll bar
  129. #+END_SRC
  130. Some windows specific stuff
  131. #+BEGIN_SRC emacs-lisp
  132. (when (eq system-type 'windows-nt)
  133. (remove-hook 'find-file-hooks 'vc-refresh-state)
  134. (progn
  135. (setq gc-cons-threshold (* 511 1024 1024)
  136. gc-cons-percentage 0.5
  137. garbage-collection-messages t
  138. w32-pipe-read-delay 0
  139. w32-get-true-file-attributes nil)
  140. (run-with-idle-timer 5 t #'garbage-collect)))
  141. #+END_SRC
  142. * visuals
  143. ** Font
  144. :PROPERTIES:
  145. :ID: cdfaaf73-b027-4b86-8d27-ebdce4b85009
  146. :END:
  147. #+BEGIN_SRC emacs-lisp
  148. (if (string-equal system-type "gnu/linux")
  149. (set-face-font 'default "Hack-10"))
  150. #+END_SRC
  151. ** line wrappings
  152. :PROPERTIES:
  153. :ID: 60b1f231-ab1e-4c47-ac6d-262dc208a520
  154. :END:
  155. #+BEGIN_SRC emacs-lisp
  156. (global-visual-line-mode)
  157. (diminish 'visual-line-mode)
  158. (use-package adaptive-wrap
  159. :ensure t
  160. :config
  161. (add-hook 'visual-line-mode-hook #'adaptive-wrap-prefix-mode))
  162. ; :init
  163. ; (when (fboundp 'adaptive-wrap-prefix-mode)
  164. ; (defun my/activate-adaptive-wrap-prefix-mode ()
  165. ; "Toggle `visual-line-mode' and `adaptive-wrap-prefix-mode' simultaneously."
  166. ; (adaptive-wrap-prefix-mode (if visual-line-mode 1 -1)))
  167. ; (add-hook 'visual-line-mode-hook 'my/activate-adaptive-wrap-prefix-mode)))
  168. #+END_SRC
  169. ** line numbers
  170. :PROPERTIES:
  171. :ID: d3dfb79a-103a-4318-a5af-5a55e12674ce
  172. :END:
  173. #+BEGIN_SRC emacs-lisp
  174. (use-package display-line-numbers
  175. :init
  176. (add-hook 'prog-mode-hook 'display-line-numbers-mode)
  177. (add-hook 'org-src-mode-hook 'display-line-numbers-mode)
  178. :config
  179. (setq-default display-line-numbers-type 'visual
  180. display-line-numbers-current-absolute t
  181. display-line-numbers-with 4
  182. display-line-numbers-widen t))
  183. ; (add-hook 'emacs-lisp-mode-hook 'display-line-numbers-mode)
  184. #+END_SRC
  185. ** misc
  186. :PROPERTIES:
  187. :ID: f0f774d6-db13-4871-9192-d36e78120dde
  188. :END:
  189. #+BEGIN_SRC emacs-lisp
  190. (use-package rainbow-mode
  191. :ensure t
  192. :diminish
  193. :hook ((org-mode
  194. emacs-lisp-mode) . rainbow-mode))
  195. #+END_SRC
  196. * undo
  197. :PROPERTIES:
  198. :ID: fde526fa-b053-48dd-9ac1-c443d987f4d2
  199. :END:
  200. #+BEGIN_SRC emacs-lisp
  201. (use-package undo-tree
  202. :ensure t
  203. :diminish undo-tree-mode
  204. :init
  205. (global-undo-tree-mode 1))
  206. #+END_SRC
  207. * imenu-list
  208. :PROPERTIES:
  209. :ID: 796d00db-aadb-412b-a291-619b029977f3
  210. :END:
  211. A minor mode to show imenu in a sidebar.
  212. Call imenu-list-smart-toggle.
  213. [[https://github.com/bmag/imenu-list][Source]]
  214. #+BEGIN_SRC emacs-lisp
  215. (use-package imenu-list
  216. :ensure t
  217. :config
  218. (setq imenu-list-focus-after-activation t
  219. imenu-list-auto-resize t
  220. imenu-list-position 'right)
  221. :bind
  222. (:map global-map
  223. ([f9] . imenu-list-smart-toggle))
  224. )
  225. #+END_SRC
  226. * which-key
  227. :PROPERTIES:
  228. :ID: 0a67aeb4-4060-4f4d-a7ff-61c70fe7ec7b
  229. :END:
  230. #+BEGIN_SRC emacs-lisp
  231. (use-package which-key
  232. :ensure t
  233. :diminish which-key-mode
  234. :config
  235. (which-key-mode)
  236. (which-key-setup-side-window-right-bottom)
  237. (which-key-setup-minibuffer)
  238. (setq which-key-idle-delay 0.5))
  239. #+END_SRC
  240. * Evil
  241. :PROPERTIES:
  242. :ID: a3389b7d-3833-42b7-97e1-413b8c4d9833
  243. :END:
  244. #+BEGIN_SRC emacs-lisp
  245. (use-package evil
  246. :ensure t
  247. :defer .1 ;; don't block emacs when starting, load evil immediately after startup
  248. :config
  249. (evil-mode 1))
  250. #+END_SRC
  251. * General (key mapper)
  252. :PROPERTIES:
  253. :ID: 027bdcf8-95c9-4e9b-88ba-6e9d3e5116c0
  254. :END:
  255. #+BEGIN_SRC emacs-lisp
  256. (use-package general
  257. :ensure t)
  258. (general-define-key
  259. :states 'normal
  260. :keymaps 'imenu-list-major-mode-map
  261. (kbd "RET") '(imenu-list-goto-entry :which-key "goto")
  262. (kbd "TAB") '(hs-toggle-hiding :which-key "collapse")
  263. "d" '(imenu-list-display-entry :which-key "show")
  264. "q" '(imenu-list-quit-window :which-key "quit"))
  265. #+END_SRC
  266. * orgmode
  267. ** org
  268. :PROPERTIES:
  269. :ID: 3877251e-5ece-4006-baa6-1f1b4846a8f3
  270. :END:
  271. #+BEGIN_SRC emacs-lisp
  272. (use-package org
  273. :ensure org-plus-contrib
  274. :mode (("\.org$" . org-mode))
  275. :init
  276. (add-hook 'org-mode-hook 'company/org-mode-hook)
  277. :config
  278. (setq org-modules (quote (org-id
  279. org-habit
  280. )))
  281. (setq org-default-notes-file (concat MY--PATH_ORG_FILES "notes.org")
  282. org-agenda-files (list MY--PATH_ORG_FILES
  283. MY--PATH_ORG_FILES_MOBILE)
  284. org-id-locations-file (concat MY--PATH_USER_LOCAL ".org-id-locations")
  285. org-log-into-drawer "LOGBOOK")
  286. (setq org-src-window-setup 'current-window)) ;; C-c ' opens in current window
  287. #+END_SRC
  288. ** habits
  289. :PROPERTIES:
  290. :ID: 61735b0c-5016-4697-80c6-beb7b3f27a1b
  291. :END:
  292. #+BEGIN_SRC emacs-lisp
  293. (require 'org-habit) ;;TODO Lösung ohne require finden, scheint mir nicht ideal zu sein, nur um ein org-modul zu aktivieren
  294. ;; (add-to-list 'org-modules "org-habit")
  295. (setq org-habit-graph-column 80
  296. org-habit-preceding-days 30
  297. org-habit-following-days 7
  298. org-habit-show-habits-only-for-today nil)
  299. #+END_SRC
  300. ** org-id
  301. :PROPERTIES:
  302. :ID: 017ef411-8239-4bfe-bbef-66b98a2971a9
  303. :END:
  304. #+BEGIN_SRC emacs-lisp
  305. (use-package org-id
  306. :config
  307. (setq org-id-link-to-org-use-id t)
  308. (org-id-update-id-locations)) ;; update id file .org-id-locations on startup
  309. #+END_SRC
  310. ** *TODO*
  311. org-super-agenda
  312. ** org-caldav
  313. Vorerst deaktiviert, Nutzen evtl. nicht vorhanden
  314. BEGIN_SRC emacs-lisp
  315. (use-package org-caldav
  316. :ensure t
  317. :config
  318. (setq org-caldav-url "https://nextcloud.cloudsphere.duckdns.org/remote.php/dav/calendars/marc"
  319. org-caldav-calendar-id "orgmode"
  320. org-caldav-inbox (expand-file-name "~/Archiv/Organisieren/caldav-inbox")
  321. org-caldav-files (concat MY--PATH_ORG_FILES "tasks")))
  322. END_SRC
  323. ** journal
  324. :PROPERTIES:
  325. :ID: 0b7243ac-049f-4b9c-a062-7a349c515133
  326. :END:
  327. [[https://github.com/bastibe/org-journal][Source]]
  328. #+BEGIN_SRC emacs-lisp
  329. (use-package org-journal
  330. :ensure t
  331. :defer t
  332. :custom
  333. (org-journal-dir MY--PATH_ORG_JOURNAl)
  334. (org-journal-enable-agenda-integration t))
  335. #+END_SRC
  336. * ivy / counsel / swiper
  337. :PROPERTIES:
  338. :ID: c2146a70-03f4-4f60-9bce-094eec28cefe
  339. :END:
  340. #+BEGIN_SRC emacs-lisp
  341. ; (require 'ivy)
  342. (use-package ivy
  343. :ensure t
  344. :diminish
  345. (ivy-mode . "")
  346. :init
  347. (ivy-mode 1)
  348. :bind
  349. ("C-r" . ivy-resume) ;; overrides isearch-backwards binding
  350. :config
  351. (setq ivy-use-virtual-buffers t ;; recent files and bookmarks in ivy-switch-buffer
  352. ivy-height 20 ;; height of ivy window
  353. ivy-count-format "%d/%d" ;; current and total number
  354. ivy-re-builders-alist ;; regex replaces spaces with *
  355. '((t . ivy--regex-plus))))
  356. (use-package counsel
  357. :ensure t
  358. :bind*
  359. (("M-x" . counsel-M-x)
  360. ("C-x C-f" . counsel-find-file)
  361. ("C-x C-r" . counsel-recentf)
  362. ("C-c C-f" . counsel-git)
  363. ("C-c h f" . counsel-describe-function)
  364. ("C-c h v" . counsel-describe-variable)
  365. ("M-i" . counsel-imenu)))
  366. (use-package swiper
  367. :ensure t
  368. :bind
  369. ("C-s" . swiper))
  370. (use-package ivy-hydra
  371. :ensure t)
  372. #+END_SRC
  373. * company
  374. :PROPERTIES:
  375. :ID: 1630ac5e-7467-458c-940c-4f724e283813
  376. :END:
  377. #+BEGIN_SRC emacs-lisp
  378. ; (require 'company)
  379. (use-package company
  380. :defer 1
  381. :bind
  382. (:map company-active-map
  383. ("RET" . nil)
  384. ([return] . nil)
  385. ("TAB" . company-complete-selection)
  386. ([tab] . company-complete-selection)
  387. ("<right>" . company-complete-common))
  388. :config
  389. (global-company-mode 1)
  390. (setq-default
  391. company-idle-delay .2
  392. company-minimum-prefix-length 1
  393. company-require-match nil
  394. company-show-numbers t
  395. company-tooltip-align-annotations t))
  396. ; (require 'company-statistics)
  397. (use-package company-statistics
  398. :ensure t
  399. :after company
  400. :init
  401. (setq company-statistics-file (concat MY--PATH_USER_LOCAL "company-statistics-cache.el"));~/.emacs.d/user-dir/company-statistics-cache.el")
  402. :config
  403. (company-statistics-mode 1))
  404. (use-package company-dabbrev
  405. :ensure nil
  406. :after company
  407. :config
  408. (setq-default company-dabbrev-downcase nil))
  409. (use-package company-box
  410. :ensure t
  411. :init
  412. (add-hook 'company-mode-hook 'company-box-mode))
  413. #+END_SRC
  414. ** company backends
  415. :PROPERTIES:
  416. :ID: 6ac59f9d-54e3-422d-883f-128fb172468d
  417. :END:
  418. #+BEGIN_SRC emacs-lisp
  419. (defun company/org-mode-hook()
  420. (set (make-local-variable 'company-backends)
  421. '(company-capf company-files))
  422. (add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t)
  423. (message "company/org-mode-hook"))
  424. (defun company/elisp-mode-hook()
  425. (set (make-local-variable 'company-backends)
  426. '((company-elisp company-dabbrev) company-capf company-files))
  427. (message "company/elisp-mode-hook"))
  428. (defun company/beancount-mode-hook()
  429. (set (make-local-variable 'company-backends)
  430. '(company-beancount)))
  431. #+END_SRC
  432. * Programming
  433. ** Magit / Git
  434. :PROPERTIES:
  435. :ID: a947f806-181d-4d33-9734-435849385b0b
  436. :END:
  437. Little crash course in magit:
  438. - magit-init to init a git project
  439. - magit-status (C-x g) to call the status window
  440. In status buffer:
  441. - s stage files
  442. - u unstage files
  443. - U unstage all files
  444. - a apply changes to staging
  445. - c c commit (type commit message, then C-c C-c to commit)
  446. - b b switch to another branch
  447. - P u git push
  448. - F u git pull
  449. #+BEGIN_SRC emacs-lisp
  450. (use-package magit
  451. :ensure t
  452. :defer t
  453. :init
  454. ; set git-path in work environment
  455. (if (string-equal user-login-name "POH")
  456. (setq magit-git-executable "P:/Eigene Dateien/Tools/Git/bin/git.exe")
  457. )
  458. :bind (("C-x g" . magit-status))
  459. )
  460. #+END_SRC
  461. ** LSP
  462. :PROPERTIES:
  463. :ID: d529d096-ec38-42e6-91c9-099c1d8bdd06
  464. :END:
  465. Configuration for the language server protocol
  466. *ACHTUNG* Dateipfad muss absolut sein, symlink im Pfad führt zumindest beim ersten Start zu Fehlern beim lsp
  467. Sobald der lsp einmal lief, kann zukünftig der symlink-Pfad genommen werden.
  468. Getestet wurde die funktionierende Datei selbst und neu erstellte Dateien im selben Pfad.
  469. TODO Unterverzeichnisse wurden noch nicht getestet
  470. #+BEGIN_SRC emacs-lisp
  471. (use-package lsp-mode
  472. :defer t
  473. :commands lsp
  474. :custom
  475. (lsp-auto-guess-root nil)
  476. (lsp-prefer-flymake nil) ; use flycheck instead
  477. (lsp-file-watch-threshold 2000)
  478. :bind (:map lsp-mode-map ("C-c C-f" . lsp-format-buffer))
  479. :hook ((python-mode
  480. js-mode
  481. js2-mode
  482. typescript-mode
  483. web-mode) . lsp))
  484. (use-package lsp-ui
  485. :after lsp-mode
  486. :ensure t
  487. :diminish
  488. :commands lsp-ui-mode
  489. :config
  490. (setq lsp-ui-doc-enable t
  491. lsp-ui-doc-header t
  492. lsp-ui-doc-include-signature t
  493. lsp-ui-doc-position 'top
  494. lsp-ui-doc-border (face-foreground 'default)
  495. lsp-ui-sideline-enable nil
  496. lsp-ui-sideline-ignore-duplicate t
  497. lsp-ui-sideline-show-code-actions nil)
  498. (when (display-graphic-p)
  499. (setq lsp-ui-doc-use-webkit t))
  500. ;; workaround hide mode-line of lsp-ui-imenu buffer
  501. (defadvice lsp-ui-imenu (after hide-lsp-ui-imenu-mode-line activate)
  502. (setq mode-line-format nil)))
  503. (use-package company-lsp
  504. :requires company
  505. :defer t
  506. :ensure t
  507. :config
  508. ;;disable client-side cache because lsp server does a better job
  509. (setq company-transformers nil
  510. company-lsp-async t
  511. company-lsp-cache-candidates nil))
  512. #+END_SRC
  513. ** flycheck
  514. :PROPERTIES:
  515. :ID: c8090ddb-4f22-49ba-8ab1-1de132e1d772
  516. :END:
  517. #+BEGIN_SRC emacs-lisp
  518. (use-package flycheck
  519. :ensure t
  520. :hook
  521. ((css-mode . flycheck-mode)
  522. (emacs-lisp-mode . flycheck-mode)
  523. (python-mode . flycheck-mode))
  524. :init
  525. (setq flycheck-emacs-lisp-load-path 'inherit)
  526. :config
  527. (setq-default
  528. flycheck-check-synta-automatically '(save mode-enabled)
  529. flycheck-disable-checkers '(emacs-lisp-checkdoc)
  530. eldoc-idle-delay .1 ;; let eldoc echo faster than flycheck
  531. flycheck-display-errors-delay .3)) ;; this way any errors will override eldoc messages
  532. #+END_SRC
  533. ** Projectile
  534. :PROPERTIES:
  535. :ID: 3cc5c1d2-1a5d-4d1a-bfeb-48de8172dd63
  536. :END:
  537. Manage projects and jump quickly between its files
  538. #+BEGIN_SRC emacs-lisp
  539. (use-package projectile
  540. :ensure t
  541. :defer t
  542. :bind
  543. (("C-c p p" . projectile-switch-project)
  544. ("C-c p c" . projectile-command-map)
  545. ("C-c p s s" . projectile-ag))
  546. :init
  547. (setq-default projectile-cache-file (concat MY--PATH_USER_LOCAL ".projectile-cache")
  548. projectile-known-projects-file (concat MY--PATH_USER_LOCAL ".projectile-bookmarks"))
  549. :config
  550. (projectile-mode t)
  551. (setq-default projectile-completion-system 'ivy
  552. projectile-enable-caching t
  553. projectile-mode-line '(:eval (projectile-project-name))))
  554. #+END_SRC
  555. ** lisp
  556. :PROPERTIES:
  557. :ID: e5ce0263-3b21-460e-a037-3fe27d6e836a
  558. :END:
  559. #+BEGIN_SRC emacs-lisp
  560. (add-hook 'emacs-lisp-mode-hook 'company/elisp-mode-hook)
  561. #+END_SRC
  562. ** web
  563. :PROPERTIES:
  564. :ID: 5649b885-839f-48db-8b4f-8d594df7ebd8
  565. :END:
  566. apt install npm
  567. sudo npm install -g vscode-html-languageserver-bin
  568. evtl alternativ typescript-language-server?
  569. #+BEGIN_SRC emacs-lisp
  570. (use-package web-mode
  571. :ensure t
  572. :defer t
  573. :mode
  574. ("\\.phtml\\'"
  575. "\\.tpl\\.php\\'"
  576. "\\.djhtml\\'"
  577. "\\.[t]?html?\\'"))
  578. #+END_SRC
  579. ** Python
  580. :PROPERTIES:
  581. :ID: cd4bbd1f-9980-42c9-a5af-aa808779d524
  582. :END:
  583. Systemseitig muss python-language-server installiert sein:
  584. pip3 install 'python-language-server[all]'
  585. für andere language servers
  586. https://github.com/emacs-lsp/lsp-mode#install-language-server
  587. #+BEGIN_SRC emacs-lisp
  588. (if (string-equal system-type "gnu/linux")
  589. (use-package pyvenv
  590. :ensure t
  591. :config
  592. (setenv "WORKON_HOME" (expand-file-name "~/Archiv/Programmierprojekte/Python/virtualenv/"))
  593. (add-hook 'pyvenv-post-activate-hooks #'my/postactivatehook))
  594. (defun my/postactivatehook ()
  595. (setq lsp-python-ms-extra-paths pyvenv-virtual-env))
  596. (use-package virtualenvwrapper
  597. :ensure t
  598. :hook (venv-postmkvirtualenv . (lambda() (shell-command "pip3 install importmagic epc")))
  599. :config
  600. (setq venv-location (expand-file-name "~/Archiv/Programmierprojekte/Python/virtualenv/")))
  601. (use-package lsp-python-ms
  602. :ensure t
  603. :after lsp-mode python))
  604. ; :custom (lsp-python-executable-cmd "python3"))
  605. #+END_SRC
  606. * beancount
  607. ** Installation
  608. :PROPERTIES:
  609. :ID: 0c5f3396-4b08-4549-ac68-0c516cfd4435
  610. :END:
  611. #+BEGIN_SRC shell
  612. sudo su
  613. cd /opt
  614. python3 -m venv beancount
  615. source ./beancount/bin/activate
  616. pip3 install wheel
  617. pip3 install beancount
  618. sleep 100
  619. echo "shell running!"
  620. deactivate
  621. #+END_SRC
  622. #+BEGIN_SRC emacs-lisp
  623. (if (string-equal system-type "gnu/linux")
  624. (use-package beancount
  625. :load-path "user-local/elisp"
  626. ; :ensure t
  627. :defer t
  628. :mode
  629. ("\\.beancount$" . beancount-mode)
  630. :init
  631. (add-hook 'beancount-mode-hook 'company/beancount-mode-hook)
  632. ; (add-hook 'beancount-mode-hook (pyvenv-activate "/opt/beancount"))
  633. ; (setenv "PATH"
  634. ; (concat "/opt/beancount/bin:"
  635. ; (getenv "PATH")))
  636. :config
  637. (setq beancount-filename-main "/home/marc/Archiv/Finanzen/Transaktionen/transactions.beancount")))
  638. #+END_SRC
  639. To support org-babel, check if it can find the symlink to ob-beancount.el
  640. #+BEGIN_SRC shell
  641. orgpath=`find /home/marc/.emacs.d/elpa/ -type d -name "org-plus*" -print`
  642. beansym="$orgpath/ob-beancount.el
  643. bean="/home/marc/Archiv/Programmierprojekte/Lisp/beancount-mode/ob-beancount.el"
  644. if [ -h "$beansym" ]
  645. then
  646. echo "$beansym found"
  647. elif [ -e "$bean" ]
  648. then
  649. echo "creating symlink"
  650. ln -s "$bean" "$beansym"
  651. else
  652. echo "$bean not found, symlink creation aborted"
  653. fi
  654. #+END_SRC
  655. Fava is strongly recommended.
  656. #+BEGIN_SRC shell
  657. cd /opt
  658. python3 -m venv fava
  659. source ./fava/bin/activate
  660. pip3 install wheel
  661. pip3 install fava
  662. deactivate
  663. #+END_SRC
  664. Start fava with fava my_file.beancount
  665. It is accessable on this URL: [[http://127.0.0.1:5000][Fava]]
  666. Beancount-mode can start fava and open the URL right away.