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.

735 lines
22 KiB

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
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
  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. ;; some display customizations
  287. (setq org-pretty-entities t
  288. org-startup-truncated t
  289. org-startup-align-all-tables t)
  290. (setq org-src-window-setup 'current-window)) ;; C-c ' opens in current window
  291. #+END_SRC
  292. ** habits
  293. :PROPERTIES:
  294. :ID: 61735b0c-5016-4697-80c6-beb7b3f27a1b
  295. :END:
  296. #+BEGIN_SRC emacs-lisp
  297. (require 'org-habit) ;;TODO Lösung ohne require finden, scheint mir nicht ideal zu sein, nur um ein org-modul zu aktivieren
  298. ;; (add-to-list 'org-modules "org-habit")
  299. (setq org-habit-graph-column 80
  300. org-habit-preceding-days 30
  301. org-habit-following-days 7
  302. org-habit-show-habits-only-for-today nil)
  303. #+END_SRC
  304. ** org-id
  305. :PROPERTIES:
  306. :ID: 017ef411-8239-4bfe-bbef-66b98a2971a9
  307. :END:
  308. #+BEGIN_SRC emacs-lisp
  309. (use-package org-id
  310. :config
  311. (setq org-id-link-to-org-use-id t)
  312. (org-id-update-id-locations)) ;; update id file .org-id-locations on startup
  313. #+END_SRC
  314. ** *TODO*
  315. org-super-agenda
  316. ** org-caldav
  317. Vorerst deaktiviert, Nutzen evtl. nicht vorhanden
  318. BEGIN_SRC emacs-lisp
  319. (use-package org-caldav
  320. :ensure t
  321. :config
  322. (setq org-caldav-url "https://nextcloud.cloudsphere.duckdns.org/remote.php/dav/calendars/marc"
  323. org-caldav-calendar-id "orgmode"
  324. org-caldav-inbox (expand-file-name "~/Archiv/Organisieren/caldav-inbox")
  325. org-caldav-files (concat MY--PATH_ORG_FILES "tasks")))
  326. END_SRC
  327. ** journal
  328. :PROPERTIES:
  329. :ID: 0b7243ac-049f-4b9c-a062-7a349c515133
  330. :END:
  331. [[https://github.com/bastibe/org-journal][Source]]
  332. #+BEGIN_SRC emacs-lisp
  333. (use-package org-journal
  334. :ensure t
  335. :defer t
  336. :custom
  337. (org-journal-dir MY--PATH_ORG_JOURNAl)
  338. (org-journal-enable-agenda-integration t))
  339. #+END_SRC
  340. * ivy / counsel / swiper
  341. :PROPERTIES:
  342. :ID: c2146a70-03f4-4f60-9bce-094eec28cefe
  343. :END:
  344. #+BEGIN_SRC emacs-lisp
  345. ; (require 'ivy)
  346. (use-package ivy
  347. :ensure t
  348. :diminish
  349. (ivy-mode . "")
  350. :init
  351. (ivy-mode 1)
  352. :bind
  353. ("C-r" . ivy-resume) ;; overrides isearch-backwards binding
  354. :config
  355. (setq ivy-use-virtual-buffers t ;; recent files and bookmarks in ivy-switch-buffer
  356. ivy-height 20 ;; height of ivy window
  357. ivy-count-format "%d/%d" ;; current and total number
  358. ivy-re-builders-alist ;; regex replaces spaces with *
  359. '((t . ivy--regex-plus))))
  360. (use-package counsel
  361. :ensure t
  362. :bind*
  363. (("M-x" . counsel-M-x)
  364. ("C-x C-f" . counsel-find-file)
  365. ("C-x C-r" . counsel-recentf)
  366. ("C-c C-f" . counsel-git)
  367. ("C-c h f" . counsel-describe-function)
  368. ("C-c h v" . counsel-describe-variable)
  369. ("M-i" . counsel-imenu)))
  370. (use-package swiper
  371. :ensure t
  372. :bind
  373. ("C-s" . swiper))
  374. (use-package ivy-hydra
  375. :ensure t)
  376. #+END_SRC
  377. * company
  378. :PROPERTIES:
  379. :ID: 1630ac5e-7467-458c-940c-4f724e283813
  380. :END:
  381. #+BEGIN_SRC emacs-lisp
  382. ; (require 'company)
  383. (use-package company
  384. :defer 1
  385. :bind
  386. (:map company-active-map
  387. ("RET" . nil)
  388. ([return] . nil)
  389. ("TAB" . company-complete-selection)
  390. ([tab] . company-complete-selection)
  391. ("<right>" . company-complete-common))
  392. :config
  393. (global-company-mode 1)
  394. (setq-default
  395. company-idle-delay .2
  396. company-minimum-prefix-length 1
  397. company-require-match nil
  398. company-show-numbers t
  399. company-tooltip-align-annotations t))
  400. ; (require 'company-statistics)
  401. (use-package company-statistics
  402. :ensure t
  403. :after company
  404. :init
  405. (setq company-statistics-file (concat MY--PATH_USER_LOCAL "company-statistics-cache.el"));~/.emacs.d/user-dir/company-statistics-cache.el")
  406. :config
  407. (company-statistics-mode 1))
  408. (use-package company-dabbrev
  409. :ensure nil
  410. :after company
  411. :config
  412. (setq-default company-dabbrev-downcase nil))
  413. (use-package company-box
  414. :ensure t
  415. :init
  416. (add-hook 'company-mode-hook 'company-box-mode))
  417. #+END_SRC
  418. ** company backends
  419. :PROPERTIES:
  420. :ID: 6ac59f9d-54e3-422d-883f-128fb172468d
  421. :END:
  422. #+BEGIN_SRC emacs-lisp
  423. (defun company/org-mode-hook()
  424. (set (make-local-variable 'company-backends)
  425. '(company-capf company-files))
  426. (add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t)
  427. (message "company/org-mode-hook"))
  428. (defun company/elisp-mode-hook()
  429. (set (make-local-variable 'company-backends)
  430. '((company-elisp company-dabbrev) company-capf company-files))
  431. (message "company/elisp-mode-hook"))
  432. (defun company/beancount-mode-hook()
  433. (set (make-local-variable 'company-backends)
  434. '(company-beancount)))
  435. #+END_SRC
  436. * Programming
  437. ** Magit / Git
  438. :PROPERTIES:
  439. :ID: a947f806-181d-4d33-9734-435849385b0b
  440. :END:
  441. Little crash course in magit:
  442. - magit-init to init a git project
  443. - magit-status (C-x g) to call the status window
  444. In status buffer:
  445. - s stage files
  446. - u unstage files
  447. - U unstage all files
  448. - a apply changes to staging
  449. - c c commit (type commit message, then C-c C-c to commit)
  450. - b b switch to another branch
  451. - P u git push
  452. - F u git pull
  453. #+BEGIN_SRC emacs-lisp
  454. (use-package magit
  455. :ensure t
  456. :defer t
  457. :init
  458. ; set git-path in work environment
  459. (if (string-equal user-login-name "POH")
  460. (setq magit-git-executable "P:/Eigene Dateien/Tools/Git/bin/git.exe")
  461. )
  462. :bind (("C-x g" . magit-status))
  463. )
  464. #+END_SRC
  465. ** LSP
  466. :PROPERTIES:
  467. :ID: d529d096-ec38-42e6-91c9-099c1d8bdd06
  468. :END:
  469. Configuration for the language server protocol
  470. *ACHTUNG* Dateipfad muss absolut sein, symlink im Pfad führt zumindest beim ersten Start zu Fehlern beim lsp
  471. Sobald der lsp einmal lief, kann zukünftig der symlink-Pfad genommen werden.
  472. Getestet wurde die funktionierende Datei selbst und neu erstellte Dateien im selben Pfad.
  473. TODO Unterverzeichnisse wurden noch nicht getestet
  474. #+BEGIN_SRC emacs-lisp
  475. (use-package lsp-mode
  476. :defer t
  477. :commands lsp
  478. :custom
  479. (lsp-auto-guess-root nil)
  480. (lsp-prefer-flymake nil) ; use flycheck instead
  481. (lsp-file-watch-threshold 2000)
  482. :bind (:map lsp-mode-map ("C-c C-f" . lsp-format-buffer))
  483. :hook ((python-mode
  484. js-mode
  485. js2-mode
  486. typescript-mode
  487. web-mode) . lsp))
  488. (use-package lsp-ui
  489. :after lsp-mode
  490. :ensure t
  491. :diminish
  492. :commands lsp-ui-mode
  493. :config
  494. (setq lsp-ui-doc-enable t
  495. lsp-ui-doc-header t
  496. lsp-ui-doc-include-signature t
  497. lsp-ui-doc-position 'top
  498. lsp-ui-doc-border (face-foreground 'default)
  499. lsp-ui-sideline-enable nil
  500. lsp-ui-sideline-ignore-duplicate t
  501. lsp-ui-sideline-show-code-actions nil)
  502. (when (display-graphic-p)
  503. (setq lsp-ui-doc-use-webkit t))
  504. ;; workaround hide mode-line of lsp-ui-imenu buffer
  505. (defadvice lsp-ui-imenu (after hide-lsp-ui-imenu-mode-line activate)
  506. (setq mode-line-format nil)))
  507. (use-package company-lsp
  508. :requires company
  509. :defer t
  510. :ensure t
  511. :config
  512. ;;disable client-side cache because lsp server does a better job
  513. (setq company-transformers nil
  514. company-lsp-async t
  515. company-lsp-cache-candidates nil))
  516. #+END_SRC
  517. ** flycheck
  518. :PROPERTIES:
  519. :ID: c8090ddb-4f22-49ba-8ab1-1de132e1d772
  520. :END:
  521. #+BEGIN_SRC emacs-lisp
  522. (use-package flycheck
  523. :ensure t
  524. :hook
  525. ((css-mode . flycheck-mode)
  526. (emacs-lisp-mode . flycheck-mode)
  527. (python-mode . flycheck-mode))
  528. :init
  529. (setq flycheck-emacs-lisp-load-path 'inherit)
  530. :config
  531. (setq-default
  532. flycheck-check-synta-automatically '(save mode-enabled)
  533. flycheck-disable-checkers '(emacs-lisp-checkdoc)
  534. eldoc-idle-delay .1 ;; let eldoc echo faster than flycheck
  535. flycheck-display-errors-delay .3)) ;; this way any errors will override eldoc messages
  536. #+END_SRC
  537. ** Projectile
  538. :PROPERTIES:
  539. :ID: 3cc5c1d2-1a5d-4d1a-bfeb-48de8172dd63
  540. :END:
  541. Manage projects and jump quickly between its files
  542. #+BEGIN_SRC emacs-lisp
  543. (use-package projectile
  544. :ensure t
  545. :defer t
  546. :bind
  547. (("C-c p p" . projectile-switch-project)
  548. ("C-c p c" . projectile-command-map)
  549. ("C-c p s s" . projectile-ag))
  550. :init
  551. (setq-default projectile-cache-file (concat MY--PATH_USER_LOCAL ".projectile-cache")
  552. projectile-known-projects-file (concat MY--PATH_USER_LOCAL ".projectile-bookmarks"))
  553. :config
  554. (projectile-mode t)
  555. (setq-default projectile-completion-system 'ivy
  556. projectile-enable-caching t
  557. projectile-mode-line '(:eval (projectile-project-name))))
  558. #+END_SRC
  559. ** lisp
  560. :PROPERTIES:
  561. :ID: e5ce0263-3b21-460e-a037-3fe27d6e836a
  562. :END:
  563. #+BEGIN_SRC emacs-lisp
  564. (add-hook 'emacs-lisp-mode-hook 'company/elisp-mode-hook)
  565. #+END_SRC
  566. ** web
  567. :PROPERTIES:
  568. :ID: 5649b885-839f-48db-8b4f-8d594df7ebd8
  569. :END:
  570. apt install npm
  571. sudo npm install -g vscode-html-languageserver-bin
  572. evtl alternativ typescript-language-server?
  573. #+BEGIN_SRC emacs-lisp
  574. (use-package web-mode
  575. :ensure t
  576. :defer t
  577. :mode
  578. ("\\.phtml\\'"
  579. "\\.tpl\\.php\\'"
  580. "\\.djhtml\\'"
  581. "\\.[t]?html?\\'"))
  582. #+END_SRC
  583. ** Python
  584. :PROPERTIES:
  585. :ID: cd4bbd1f-9980-42c9-a5af-aa808779d524
  586. :END:
  587. Systemseitig muss python-language-server installiert sein:
  588. pip3 install 'python-language-server[all]'
  589. für andere language servers
  590. https://github.com/emacs-lsp/lsp-mode#install-language-server
  591. #+BEGIN_SRC emacs-lisp
  592. (if (string-equal system-type "gnu/linux")
  593. (use-package pyvenv
  594. :ensure t
  595. :config
  596. (setenv "WORKON_HOME" (expand-file-name "~/Archiv/Programmierprojekte/Python/virtualenv/"))
  597. (add-hook 'pyvenv-post-activate-hooks #'my/postactivatehook))
  598. (defun my/postactivatehook ()
  599. (setq lsp-python-ms-extra-paths pyvenv-virtual-env))
  600. (use-package virtualenvwrapper
  601. :ensure t
  602. :hook (venv-postmkvirtualenv . (lambda() (shell-command "pip3 install importmagic epc")))
  603. :config
  604. (setq venv-location (expand-file-name "~/Archiv/Programmierprojekte/Python/virtualenv/")))
  605. (use-package lsp-python-ms
  606. :ensure t
  607. :after lsp-mode python))
  608. ; :custom (lsp-python-executable-cmd "python3"))
  609. #+END_SRC
  610. * beancount
  611. ** Installation
  612. :PROPERTIES:
  613. :ID: 0c5f3396-4b08-4549-ac68-0c516cfd4435
  614. :END:
  615. #+BEGIN_SRC shell
  616. sudo su
  617. cd /opt
  618. python3 -m venv beancount
  619. source ./beancount/bin/activate
  620. pip3 install wheel
  621. pip3 install beancount
  622. sleep 100
  623. echo "shell running!"
  624. deactivate
  625. #+END_SRC
  626. #+BEGIN_SRC emacs-lisp
  627. (if (string-equal system-type "gnu/linux")
  628. (use-package beancount
  629. :load-path "user-local/elisp"
  630. ; :ensure t
  631. :defer t
  632. :mode
  633. ("\\.beancount$" . beancount-mode)
  634. :init
  635. (add-hook 'beancount-mode-hook 'company/beancount-mode-hook)
  636. ; (add-hook 'beancount-mode-hook (pyvenv-activate "/opt/beancount"))
  637. ; (setenv "PATH"
  638. ; (concat "/opt/beancount/bin:"
  639. ; (getenv "PATH")))
  640. :config
  641. (setq beancount-filename-main "/home/marc/Archiv/Finanzen/Transaktionen/transactions.beancount")))
  642. #+END_SRC
  643. To support org-babel, check if it can find the symlink to ob-beancount.el
  644. #+BEGIN_SRC shell
  645. orgpath=`find /home/marc/.emacs.d/elpa/ -type d -name "org-plus*" -print`
  646. beansym="$orgpath/ob-beancount.el
  647. bean="/home/marc/Archiv/Programmierprojekte/Lisp/beancount-mode/ob-beancount.el"
  648. if [ -h "$beansym" ]
  649. then
  650. echo "$beansym found"
  651. elif [ -e "$bean" ]
  652. then
  653. echo "creating symlink"
  654. ln -s "$bean" "$beansym"
  655. else
  656. echo "$bean not found, symlink creation aborted"
  657. fi
  658. #+END_SRC
  659. Fava is strongly recommended.
  660. #+BEGIN_SRC shell
  661. cd /opt
  662. python3 -m venv fava
  663. source ./fava/bin/activate
  664. pip3 install wheel
  665. pip3 install fava
  666. deactivate
  667. #+END_SRC
  668. Start fava with fava my_file.beancount
  669. It is accessable on this URL: [[http://127.0.0.1:5000][Fava]]
  670. Beancount-mode can start fava and open the URL right away.