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.

1916 lines
57 KiB

5 years ago
6 years ago
6 years ago
6 years ago
5 years ago
6 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
5 years ago
6 years ago
6 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
5 years ago
5 years ago
5 years ago
6 years ago
  1. #+TITLE: Emacs Configuration
  2. #+AUTHOR: Marc Pohling
  3. #+BABEL: :cache yes
  4. #+PROPERTY: :header-args :tangle yes
  5. * Personal Information
  6. #+BEGIN_SRC emacs-lisp
  7. (setq user-full-name "Marc Pohling"
  8. user-mail-address "marc.pohling@googlemail.com")
  9. #+END_SRC
  10. I need a function to know what computer emacs is running on. The display width of 1152 pixel is an oddity of hyper-v and for my usecase specific enough to tell the machine.
  11. #+BEGIN_SRC emacs-lisp
  12. (defvar my/whoami
  13. (if (string-equal user-login-name "POH")
  14. "work_remote"
  15. (if (equal (display-pixel-width) 1152)
  16. "work_hyperv"
  17. (if (string-equal system-type "gnu/linux")
  18. "home"))))
  19. #+END_SRC
  20. * Stuff to add / to fix
  21. - smartparens
  22. a sane default configuration for navigation, manipulation etc. is still necessary
  23. - Spaceline / Powerline or similar
  24. I want a pretty status bar!
  25. - Git gutter:
  26. Do some configuration to make it useful (see given source link in the [[*Git][Section]] of gutter)
  27. Maybe only enable it for modes where it is likely I use git?
  28. - Some webmode stuff
  29. - markdown:
  30. add hooks for certain file extensions, maybe add a smart way to start gfm-mode if markdown-file is in a git-project
  31. - move package dependend configurations inside the package configuration itself, like keymaps for magit
  32. - get rid of user-local and user-global and work with git-ignore
  33. * Update config in a running config
  34. Two options:
  35. - reload the open file: M-x load-file, then press twice to accept
  36. the default filename, which is the currently opened
  37. - Point at the end of any sexp and press C-x C-e
  38. * Customize default settings
  39. Keep the .emacs.d clean by moving user files into separate directories.
  40. - user-local: directory for machine specific files
  41. - user-global: directory for files which work on any machine
  42. - the backup and auto-save files go right to /tmp
  43. #+BEGIN_SRC emacs-lisp
  44. (defvar PATH_USER_LOCAL (expand-file-name "~/.emacs.d/user-local/"))
  45. (defvar PATH_USER_GLOBAL (expand-file-name "~/.emacs.d/user-global/"))
  46. (setq bookmark-default-file (concat PATH_USER_LOCAL "bookmarks"))
  47. (setq recentf-save-file (concat PATH_USER_LOCAL "recentf"))
  48. (setq custom-file (concat PATH_USER_LOCAL "custom.el")) ;don't spam init.el with saved customize settings
  49. (setq abbrev-file-name (concat PATH_USER_GLOBAL "abbrev_defs"))
  50. (setq backup-directory-alist `((".*" . ,temporary-file-directory)))
  51. (setq auto-save-file-name-transforms `((".*" ,temporary-file-directory)))
  52. (setq save-abbrevs 'silently) ; don't bother me with asking if new abbrevs should be saved
  53. #+END_SRC
  54. These functions are useful. Activate them.
  55. #+BEGIN_SRC emacs-lisp
  56. (put 'downcase-region 'disabled nil)
  57. (put 'upcase-region 'disabled nil)
  58. (put 'narrow-to-region 'disabled nil)
  59. (put 'dired-find-alternate-file 'disabled nil)
  60. #+END_SRC
  61. Disable lock files, which cause trouble in e.g. lsp-mode
  62. #+BEGIN_SRC emacs-lisp
  63. (setq-default create-lockfiles nil)
  64. #+END_SRC
  65. Answering just 'y' or 'n' should be enough.
  66. #+BEGIN_SRC emacs-lisp
  67. (defalias 'yes-or-no-p 'y-or-n-p)
  68. #+END_SRC
  69. Don't ask me if I want to load themes.
  70. #+BEGIN_SRC emacs-lisp
  71. (setq custom-safe-themes t)
  72. #+END_SRC
  73. Don't count two spaces after a period as the end of a sentence.
  74. Just one space is needed
  75. #+BEGIN_SRC emacs-lisp
  76. (setq sentence-end-double-space nil)
  77. #+END_SRC
  78. Scroll to the end / beginning of buffer before you throw an error
  79. #+BEGIN_SRC emacs-lisp
  80. (setq scroll-error-top-bottom t)
  81. #+END_SRC
  82. Delete the region when typing, just like as we expect nowadays.
  83. #+BEGIN_SRC emacs-lisp
  84. (delete-selection-mode t)
  85. #+END_SRC
  86. Auto-indent when pressing RET, just new-line when C-j
  87. #+BEGIN_SRC emacs-lisp
  88. (define-key global-map (kbd "RET") 'newline-and-indent)
  89. (define-key global-map (kbd "C-j") 'newline)
  90. #+END_SRC
  91. Set the default window size depending on the system emacs is running on.
  92. ;; TODO:
  93. ;; This size is only reasonable for linux@home
  94. ;; hyperv is way smaller, use fullscreen here
  95. ;; pm should be fullscreen, too
  96. #+BEGIN_SRC emacs-lisp
  97. (if (display-graphic-p)
  98. (pcase my/whoami
  99. ("home" (progn
  100. (setq initial-frame-alist
  101. '((width . 165)
  102. (height . 70)))
  103. (setq default-frame-alist
  104. '((width . 165)
  105. (height . 70)))))
  106. ("work_remote" (add-to-list 'initial-frame-alist '(fullscreen . maximized)))
  107. ("work_hyperv" (add-to-list 'initial-frame-alist '(fullscreen . maximized)))))
  108. #+END_SRC
  109. * Windows specific stuff
  110. ** Performance
  111. [[https://github.com/cbowdon/Config/blob/master/emacs/init.org][Got it from here]]
  112. #+BEGIN_SRC emacs-lisp
  113. (when (eq system-type 'windows-nt)
  114. (if (>= emacs-major-version 25)
  115. (remove-hook 'find-file-hooks 'vc-refresh-state)
  116. (remove-hook 'find-file-hooks 'vc-find-file-hook))
  117. (progn
  118. (setq gc-cons-threshold (* 511 1024 1024)
  119. gc-cons-percentage 0.5
  120. garbage-collection-messages t
  121. w32-get-true-file-attributes nil)
  122. (run-with-idle-timer 5 t #'garbage-collect)))
  123. #+END_SRC
  124. Hopefully this makes magit faster
  125. #+BEGIN_SRC emacs-lisp
  126. (when (eq system-type 'windows-nt)
  127. (setq w32-pipe-read-delay 0)
  128. (setq w32-get-true-file-attributes nil))
  129. #+END_SRC
  130. * Visuals
  131. ** Font
  132. Don't add the font in the work environment, which I am logged in as POH
  133. #+BEGIN_SRC emacs-lisp
  134. ; (set-face-attribute 'default nil
  135. ; :family "Hack Nerd Font Mono-14"
  136. ; :height 110
  137. ; :weight 'normal
  138. ; :width 'normal)
  139. (set-face-font 'default "Hack Nerd Font Mono-10")
  140. ; (pcase my/whoami
  141. ; ("home" (set-face-font 'default "Hack Nerd Font Mono-10"))
  142. ;; ("home" (set-face-attribute 'default nil :font "Hack-10"))
  143. ; ("work_hyperv" (set-face-attribute 'default nil :font "Hack-12"))
  144. ; )
  145. #+END_SRC
  146. ** Themes
  147. *** Material Theme
  148. The [[https://github.com/cpaulik/emacs-material-theme][Material Theme]] comes in a dark and a light variant. Not too dark
  149. to be strenious though.
  150. b
  151. #+BEGIN_SRC emacs-lisp
  152. (use-package material-theme
  153. :if (window-system)
  154. :defer t
  155. :ensure t
  156. )
  157. #+END_SRC
  158. *** Apropospriate Theme
  159. Variants dark and light
  160. #+BEGIN_SRC emacs-lisp
  161. (use-package apropospriate-theme
  162. :if (window-system)
  163. :defer t
  164. :ensure t
  165. )
  166. #+END_SRC
  167. *** Ample Theme
  168. Variants:
  169. - ample
  170. - ample-flat
  171. - ample-light
  172. #+BEGIN_SRC emacs-lisp
  173. (use-package ample-theme
  174. :if (window-system)
  175. :defer t
  176. :ensure t
  177. :init
  178. (load-theme 'ample-flat t)
  179. )
  180. #+END_SRC
  181. ** Prettier Line Wraps
  182. By default there is no line wrapping. M-q actually modifies the buffer, which might not be wanted.
  183. So: enable visual wrapping and keep indentation if there are any.
  184. #+BEGIN_SRC emacs-lisp
  185. (global-visual-line-mode)
  186. (diminish 'visual-line-mode)
  187. (use-package adaptive-wrap
  188. :ensure t
  189. :init
  190. (when (fboundp 'adaptive-wrap-prefix-mode)
  191. (defun my-activate-adaptive-wrap-prefix-mode ()
  192. "Toggle `visual-line-mode' and `adaptive-wrap-prefix-mode' simultaneously."
  193. (adaptive-wrap-prefix-mode (if visual-line-mode 1 -1)))
  194. (add-hook 'visual-line-mode-hook 'my-activate-adaptive-wrap-prefix-mode))
  195. )
  196. #+END_SRC
  197. ** Mode Line
  198. Change the default mode line to something prettier. [[https://github.com/Malabarba/smart-mode-line][Source]]
  199. #+BEGIN_SRC emacs-lisp
  200. (use-package smart-mode-line
  201. :ensure t
  202. :config
  203. (tool-bar-mode -1)
  204. (setq sml/theme 'respectful)
  205. (setq sml/name-width 40)
  206. (setq sml/mode-width 'full)
  207. (set-face-attribute 'mode-line nil
  208. :box nil)
  209. (sml/setup))
  210. #+END_SRC
  211. ** Line numbers
  212. #+BEGIN_SRC emacs-lisp
  213. (use-package linum
  214. :ensure t
  215. :init
  216. (add-hook 'prog-mode-hook 'linum-mode))
  217. #+END_SRC
  218. ** Misc
  219. UTF-8 please, but don't mess with line endings.
  220. #+BEGIN_SRC emacs-lisp
  221. (setq locale-coding-system 'utf-8)
  222. (set-terminal-coding-system 'utf-8)
  223. (set-keyboard-coding-system 'utf-8)
  224. (set-selection-coding-system 'utf-8)
  225. (if (eq system-type 'windows-nt)
  226. (prefer-coding-system 'utf-8-dos)
  227. (prefer-coding-system 'utf-8))
  228. #+END_SRC
  229. Turn off blinking cursor
  230. #+BEGIN_SRC emacs-lisp
  231. (blink-cursor-mode -1)
  232. #+END_SRC
  233. #+BEGIN_SRC emacs-lisp
  234. (show-paren-mode t)
  235. (column-number-mode t)
  236. (setq uniquify-buffer-name-style 'forward)
  237. #+END_SRC
  238. Avoid tabs in place of multiple spaces (they look bad in TeX) and show empty lines
  239. #+BEGIN_SRC emacs-lisp
  240. (setq-default indent-tabs-mode nil)
  241. (setq-default indicate-empty-lines t)
  242. #+END_SRC
  243. Smooth scrolling. Emacs tends to be jumpy, this should change it.
  244. #+BEGIN_SRC emacs-lisp
  245. (setq scroll-margin 5
  246. scroll-conservatively 10000
  247. scroll-preserve-screen-position 1
  248. scroll-step 1)
  249. #+END_SRC
  250. Highlight current line
  251. #+BEGIN_SRC emacs-lisp
  252. (global-hl-line-mode t)
  253. #+END_SRC
  254. * Usability
  255. ** which-key
  256. Greatly increases discovery of functions!
  257. Click [[https://github.com/justbur/emacs-which-key][here]] for source and more info.
  258. Info in Emacs: M-x customize-group which-key
  259. #+BEGIN_SRC emacs-lisp
  260. (use-package which-key
  261. :ensure t
  262. :diminish which-key-mode
  263. :config
  264. (which-key-mode)
  265. (which-key-setup-side-window-right-bottom)
  266. (which-key-setup-minibuffer)
  267. (setq which-key-idle-delay 0.5)
  268. )
  269. #+END_SRC
  270. ** Recentf
  271. Activate and configure recentf
  272. #+BEGIN_SRC emacs-lisp
  273. (recentf-mode t)
  274. (setq recentf-max-saved-items 200)
  275. #+END_SRC
  276. ** Hydra
  277. Hydra allows grouping of commands
  278. #+BEGIN_SRC emacs-lisp
  279. (use-package hydra
  280. :ensure t
  281. :bind
  282. ("C-c f" . hydra-flycheck/body)
  283. ("C-c g" . hydra-git-gutter/body)
  284. :config
  285. (setq-default hydra-default-hint nil)
  286. )
  287. #+END_SRC
  288. ** Evil
  289. So... Evil Mode might be worth a try
  290. #+BEGIN_SRC emacs-lisp
  291. (use-package evil
  292. :ensure t
  293. :defer .1 ;; don't block emacs when starting, load evil immediately after startup
  294. :init
  295. (setq evil-want-integration nil) ;; required by evil-collection
  296. :config
  297. (evil-mode 1)) ;; for now deactivate per default
  298. #+END_SRC
  299. Evil-collection is a bundle of configs for different modes.
  300. 2018-05-01: evil collection causes error
  301. "Invalid function: with-helm-buffer"
  302. #+BEGIN_SRC emacs-lisp
  303. ;(use-package evil-collection
  304. ; :after evil
  305. ; :ensure t
  306. ; :config
  307. ; (evil-collection-init))
  308. #+END_SRC
  309. Evil-goggles give visual hints when editing texts, so it's more obvious what is actually happening. [[https://github.com/edkolev/evil-goggles][Source]]
  310. #+BEGIN_SRC emacs-lisp
  311. (use-package evil-goggles
  312. :after evil
  313. :ensure t
  314. :diminish evil-goggles-mode
  315. :config
  316. (evil-goggles-mode)
  317. (evil-goggles-use-diff-faces))
  318. #+END_SRC
  319. ** General (keymapper)
  320. I just use general.el to define keys and keymaps. With it I can set leader keys and create keymaps for them. It also integrates well with which-key.
  321. [[https://github.com/noctuid/general.el][Source]]
  322. #+BEGIN_SRC emacs-lisp
  323. (use-package general
  324. :ensure t
  325. )
  326. #+END_SRC
  327. ** Custom key mappings
  328. Now some keymaps.
  329. If there is no map defined, it is considered the global key map.
  330. #+BEGIN_SRC emacs-lisp
  331. (general-define-key
  332. :states '(normal visual insert emacs)
  333. :prefix "SPC"
  334. :non-normal-prefix "M-SPC"
  335. "TAB" '(ivy-switch-buffer :which-key "prev buffer")
  336. "SPC" '(counsel-M-x :which-key "M-x")
  337. "g" '(:ignore t :which-key "Git")
  338. "gs" '(magit-status :which-key "git-status")
  339. )
  340. #+END_SRC
  341. A map for org-mode
  342. #+BEGIN_SRC emacs-lisp
  343. (general-define-key
  344. :states '(normal visual insert emacs)
  345. :keymaps 'org-mode-map
  346. :prefix "SPC"
  347. :non-normal-prefix "M-SPC"
  348. "t" '(counsel-org-tag :which-key "org-tag"))
  349. #+END_SRC
  350. A map for dired, based on [[https://github.com/emacs-evil/evil-collection/blob/master/evil-collection-dired.el][evil-collection]]
  351. #+BEGIN_SRC emacs-lisp
  352. (general-define-key
  353. :states '(normal visual insert emacs)
  354. :keymaps 'dired-mode-map
  355. "q" '(quit-window :which-key "quit-window")
  356. "j" '(dired-next-line :which-key "next line")
  357. "k" '(dired-previous-line :which-key "previous line")
  358. "D" '(dired-do-delete :which-key "delete")
  359. "C" '(dired-do-copy :which-key "copy")
  360. "t" '(:ignore t :which-key "dir navigation")
  361. "td" '(dired-tree-down :which-key "tree down")
  362. "tu" '(dired-tree-up :which-key "tree up")
  363. "tn" '(dired-next-subdir :which-key "next subdir")
  364. "tp" '(dired-prev-subdir :which-key "previous subdir")
  365. )
  366. #+END_SRC
  367. #+BEGIN_SRC emacs-lisp
  368. (general-define-key
  369. :states '(normal)
  370. :keymaps 'lsp-ui-imenu-mode-map
  371. (kbd "RET") '(lsp-ui-imenu--view :which-key "view")
  372. (kbd "M-RET") '(lsp-ui-imenu--visit :which-key "visit")
  373. )
  374. #+END_SRC
  375. ** List buffers
  376. Ibuffer is the improved version of list-buffers.
  377. Make ibuffer the default buffer lister. [[http://ergoemacs.org/emacs/emacs_buffer_management.html][Source]]
  378. #+BEGIN_SRC emacs-lisp
  379. (defalias 'list-buffers 'ibuffer)
  380. #+END_SRC
  381. Also auto refresh dired, but be quiet about it. [[http://whattheemacsd.com/sane-defaults.el-01.html][Source]]
  382. #+BEGIN_SRC emacs-lisp
  383. (add-hook 'dired-mode-hook 'auto-revert-mode)
  384. (setq global-auto-revert-non-file-buffers t)
  385. (setq auto-revert-verbose nil)
  386. #+END_SRC
  387. ** ivy / counsel / swiper
  388. Flx is required for fuzzy-matching
  389. Is it really necessary?
  390. BEGIN_SRC emacs-lisp
  391. (use-package flx)
  392. end_src
  393. Ivy displays a window with suggestions for hotkeys and M-x
  394. #+BEGIN_SRC emacs-lisp
  395. (use-package ivy
  396. :ensure t
  397. :diminish
  398. (ivy-mode . "") ;; does not display ivy in the mode line
  399. :init
  400. (ivy-mode 1)
  401. :bind
  402. ("C-c C-r" . ivy-resume)
  403. :config
  404. (setq ivy-use-virtual-buffers t) ;; recent files and bookmarks in ivy-switch-buffer
  405. (setq ivy-height 20) ;; height of ivy window
  406. (setq ivy-count-format "%d/%d") ;; current and total number
  407. (setq ivy-re-builders-alist ;; regex replaces spaces with *
  408. '((t . ivy--regex-plus)))
  409. )
  410. #+END_SRC
  411. The find-file replacement is nicer to navigate
  412. #+BEGIN_SRC emacs-lisp
  413. (use-package counsel
  414. :ensure t
  415. :bind* ;; load counsel when pressed
  416. (("M-x" . counsel-M-x)
  417. ("C-x C-f" . counsel-find-file)
  418. ("C-x C-r" . counsel-recentf)
  419. ("C-c C-f" . counsel-git)
  420. ("C-c h f" . counsel-describe-function)
  421. ("C-c h v" . counsel-describe-variable)
  422. ("M-i" . counsel-imenu)
  423. )
  424. )
  425. #+END_SRC
  426. Swiper ivy-enhances isearch
  427. #+BEGIN_SRC emacs-lisp
  428. (use-package swiper
  429. :ensure t
  430. :bind
  431. (("C-s" . swiper)
  432. ("C-c C-r" . ivy-resume)
  433. )
  434. )
  435. #+END_SRC
  436. Ivy-Hydra adds stuff in minibuffer when you press C-o
  437. #+BEGIN_SRC emacs-lisp
  438. (use-package ivy-hydra
  439. :ensure t)
  440. #+END_SRC
  441. ** Helm
  442. This is just a try to see how it works differently.
  443. #+BEGIN_SRC emacs-lisp
  444. (use-package helm
  445. :ensure t
  446. :init
  447. (helm-mode 1)
  448. :bind
  449. ; (("M-x" . helm-M-x)
  450. ; ("C-x C-f" . helm-find-files)
  451. ; ("C-x C-r" . helm-recentf)
  452. ; ("C-x b" . helm-buffers-list))
  453. :config
  454. (setq helm-buffers-fuzzy-matching t)
  455. )
  456. (use-package helm-descbinds
  457. :ensure t
  458. :bind
  459. ("C-h b" . helm-descbinds))
  460. (use-package helm-projectile
  461. :ensure t
  462. :config
  463. (helm-projectile-on))
  464. #+END_SRC
  465. ** Undo
  466. Show an undo tree in a new buffer which can be navigated.
  467. #+BEGIN_SRC emacs-lisp
  468. (use-package undo-tree
  469. :ensure t
  470. :diminish undo-tree-mode
  471. :init
  472. (global-undo-tree-mode 1))
  473. #+END_SRC
  474. ** Ido (currently inactive)
  475. better completion
  476. #+BEGIN_SRC emacs-lisp
  477. ;(use-package ido
  478. ; :init
  479. ; (setq ido-enable-flex-matching t)
  480. ; (setq ido-everywhere t)
  481. ; (ido-mode t)
  482. ; (use-package ido-vertical-mode
  483. ; :ensure t
  484. ; :defer t
  485. ; :init
  486. ; (ido-vertical-mode 1)
  487. ; (setq ido-vertical-define-keys 'C-n-and-C-p-only)
  488. ; )
  489. ;)
  490. #+END_SRC
  491. ** imenu-list
  492. A minor mode to show imenu in a sidebar.
  493. Call imenu-list-smart-toggle.
  494. [[https://github.com/bmag/imenu-list][Source]]
  495. #+BEGIN_SRC emacs-lisp
  496. (use-package imenu-list
  497. :ensure t
  498. :config
  499. (setq imenu-list-focus-after-activation t
  500. imenu-list-auto-resize t
  501. imenu-list-position 'right)
  502. :bind
  503. (:map global-map
  504. ([f9] . imenu-list-smart-toggle))
  505. )
  506. #+END_SRC
  507. ** Treemacs
  508. A file manager comparable to neotree.
  509. [[https://github.com/Alexander-Miller/treemacs][Github]]
  510. 2018-09-01: Treemacs needs emacs 25.2, debian stretch runs 25.1. Sucks.
  511. It has some requirements, which gets used here anyway:
  512. - ace-window
  513. - hydra
  514. - projectile
  515. - python
  516. I copied the configuration example from the github site.
  517. No idea what this executable-find is about.
  518. TODO check it out!
  519. BEGIN_SRC emacs-lisp
  520. (use-package treemacs
  521. :ensure t
  522. :defer t
  523. :config
  524. (setq treemacs-collapse-dirs (if (executable-find "python") 3 0)
  525. treemacs-file-event-delay 5000
  526. treemacs-follow-after-init t
  527. treemacs-follow-recenter-distance 0.1
  528. treemacs-goto-tag-strategy 'refetch-index
  529. treemacs-indentation 2
  530. treemacs-indentation-string " "
  531. treemacs-is-never-other-window nil
  532. treemacs-no-png-images nil
  533. treemacs-project-follow-cleanup nil
  534. treemacs-recenter-after-file-follow nil
  535. treemacs-recenter-after-tag-follow nil
  536. treemacs-show-hidden-files t
  537. treemacs-silent-filewatch nil
  538. treemacs-silent-refresh nil
  539. treemacs-sorting 'alphabetic-desc
  540. treemacs-tag-follow-cleanup t
  541. treemacs-tag-follow-delay 1.5
  542. treemacs-width 35)
  543. (treemacs-follow-mode t)
  544. (treemacs-filewatch-mode t)
  545. (pcase (cons (not (null (executable-find "git")))
  546. (not (null (executable-find "python3"))))
  547. (`(t . t)
  548. (treemacs-git-mode 'extended))
  549. (`(t . _)
  550. (treemacs-git-mode 'simple)))
  551. :bind
  552. (:map global-map
  553. ([f8] . treemacs))
  554. )
  555. END_SRC
  556. Treemacs-Evil is necessary when using evil
  557. BEGIN_SRC emacs-lisp
  558. (use-package treemacs-evil
  559. :after treemacs evil
  560. :ensure t)
  561. END_SRC
  562. Treemacs-projectile is useful for uhh.. TODO explain!
  563. BEGIN_SRC emacs-lisp
  564. (use-package treemacs-projectile
  565. :ensure t
  566. :after treemacs projectile
  567. :defer t
  568. :config
  569. (setq treemacs-header-function #'treemacs-projectile-create-header)
  570. )
  571. END_SRC
  572. TODO
  573. Hydrastuff or keybindings for functions:
  574. - treemacs-projectile
  575. - treemacs-projectile-toggle
  576. - treemacs-toggle
  577. - treemacs-bookmark
  578. - treemacs-find-file
  579. - treemacs-find-tag
  580. ** Window Handling
  581. Some tools to easen the navigation, creation and deletion of windows
  582. *** Ace-Window
  583. #+BEGIN_SRC emacs-lisp
  584. (use-package ace-window
  585. :ensure t
  586. :init
  587. (global-set-key (kbd "C-x o") 'ace-window)
  588. )
  589. #+END_SRC
  590. *** Windmove
  591. Windmove easens the navigation between windows.
  592. Here we are setting the default keybindings (shift+arrow)
  593. CURRENTLY NOT WORKING, defaults are blocked.
  594. Also not sure if necessary when using ace-window.
  595. #+BEGIN_SRC emacs-lisp
  596. (use-package windmove
  597. :ensure t
  598. :config
  599. (windmove-default-keybindings)
  600. )
  601. #+END_SRC
  602. ** Tramp
  603. With tramp you can handle remote files like local files.
  604. Usage example:
  605. C-x C-f /ssh:name@server:/path
  606. To open a file as sudo:
  607. C-x C-f /ssh:/name@server|sudo:name@server:/path
  608. #+BEGIN_SRC emacs-lisp
  609. (use-package tramp
  610. :ensure t
  611. )
  612. #+END_SRC
  613. ** misc
  614. Visual feedback when using regexp on the buffer
  615. #+BEGIN_SRC emacs-lisp
  616. (use-package visual-regexp
  617. :ensure t
  618. :defer t
  619. :bind (("C-c r s" . query-replace)
  620. ("C-c r R" . vr/replace)
  621. ("C-c r r" . vr/query-replace)
  622. ("C-c r m" . vr/mc-mark)))
  623. #+END_SRC
  624. Newline at the end of file
  625. #+BEGIN_SRC emacs-lisp
  626. (setq require-final-newline t)
  627. #+END_SRC
  628. Delete the selection with a keypress
  629. #+BEGIN_SRC emacs-lisp
  630. (delete-selection-mode t)
  631. #+END_SRC
  632. Remember the current location in a file
  633. #+BEGIN_SRC emacs-lisp
  634. (use-package saveplace
  635. :unless noninteractive
  636. :config
  637. (save-place-mode))
  638. #+END_SRC
  639. * Company Mode
  640. Complete Anything!
  641. Activate company and make it react nearly instantly
  642. #+BEGIN_SRC emacs-lisp
  643. (use-package company
  644. :ensure t
  645. :config
  646. (setq-default company-minimum-prefix-length 1
  647. company-tooltip-align-annotation t
  648. company-tooltop-flip-when-above t
  649. company-show-numbers t
  650. company-idle-delay 0.1)
  651. ; (define-key company-active-map (kbd "RET") nil)
  652. (company-tng-configure-default)
  653. :bind
  654. (:map company-active-map
  655. ("TAB" . company-complete-selection)
  656. ("<tab>" . company-complete-selection))
  657. )
  658. #+END_SRC
  659. For a nicer suggestion box: company-box ([[https://github.com/sebastiencs/company-box][Source]])
  660. It is only available for emacs 26 and higher.
  661. #+BEGIN_SRC emacs-lisp
  662. (when (> emacs-major-version 25)
  663. (use-package company-box
  664. :ensure t
  665. :init
  666. (add-hook 'company-mode-hook 'company-box-mode)))
  667. #+END_SRC
  668. * Org Mode
  669. ** Installation
  670. Although org mode ships with Emacs, the latest version can be installed externally. The configuration here follows the [[http://orgmode.org/elpa.html][Org mode ELPA Installation instructions.]]
  671. Added a hook to complete org functions, company-capf is necessary for this
  672. #+BEGIN_SRC emacs-lisp
  673. (use-package org
  674. :ensure org-plus-contrib
  675. :init
  676. (add-hook 'org-mode-hook 'company/org-mode-hook)
  677. )
  678. (add-hook 'org-mode-hook 'company/org-mode-hook)
  679. #+END_SRC
  680. To avoid problems executing source blocks out of the box. [[https://emacs.stackexchange.com/a/28604][Others have the same problem, too]]. The solution is to remove the .elc files form the package directory:
  681. #+BEGIN_SRC shell
  682. var ORG_DIR=(let* ((org-v (cadr (split-string (org-version nil t) "@"))) (len (length org-v))) (substring org-v 1 (- len 2)))
  683. rm ${ORG_DIR}/*.elc
  684. echo 'cleaned .elc from package directory'
  685. #+END_SRC
  686. ** Setup
  687. *** Paths
  688. Paths need to be different for work and home
  689. #+BEGIN_SRC emacs-lisp
  690. (pcase my/whoami
  691. ("work_remote"
  692. (progn
  693. (defvar PATH_ORG_FILES "p:/Eigene Dateien/Notizen/")
  694. (defvar PATH_ORG_JOURNAL "p:/Eigene Dateien/Notizen/Journal/")
  695. (defvar PATH_START "p:/Eigene Dateien/Notizen/"))
  696. (setq org-default-notes-file (concat PATH_ORG_FILES "notes.org"))
  697. (setq org-agenda-files (list(concat PATH_ORG_FILES "notes.org")
  698. (concat PATH_ORG_FILES "projects.org")
  699. (concat PATH_ORG_FILES "todo.org"))))
  700. ("home"
  701. (progn
  702. (defvar PATH_ORG_FILES_MOBILE "~/Archiv/Organisieren/mobile/")
  703. (defvar PATH_ORG_JOURNAL "~/Archiv/Organisieren/Journal/")
  704. (defvar PATH_ORG_FILES "~/Archiv/Organisieren/")
  705. (setq org-default-notes-file (concat PATH_ORG_FILES "notes.org"))
  706. ;; TODO: ignore notes.org, which shouldn't include any todos
  707. ;; (setq org-agenda-file-regexp "'\\`[^.].*\\.org\\'")
  708. (setq org-agenda-files (list PATH_ORG_FILES PATH_ORG_FILES_MOBILE))))
  709. )
  710. (setq org-id-locations-file (concat PATH_USER_LOCAL ".org-id-locations"))
  711. #+END_SRC
  712. *** Settings
  713. Speed commands are a nice and quick way to perform certain actions while at the beginning of a heading. It's not activated by default.
  714. See the doc for speed keys by checking out the documentation for speed keys in Org mode.
  715. #+BEGIN_SRC emacs-lisp
  716. (setq org-use-speed-commands t)
  717. (setq org-image-actual-width 550)
  718. (setq org-highlight-latex-and-related '(latex script entities))
  719. #+END_SRC
  720. Hide emphasis markup (e.g. / ... / for italics, etc.)
  721. #+BEGIN_SRC emacs-lisp
  722. (setq org-hide-emphasis-markers t)
  723. #+END_SRC
  724. The default value for the org tag column is -77, which is weird for smaller width windows. I'd rather have the tags align horizontally with the header.
  725. 45 is a good column number to do that.
  726. #+BEGIN_SRC emacs-lisp
  727. (setq org-tags-column 45)
  728. #+END_SRC
  729. Set the org-refile targets.
  730. TODO: change maxlevel if necessary
  731. #+BEGIN_SRC emacs-lisp
  732. (setq org-refile-targets '((org-agenda-files . (:maxlevel . 1))))
  733. #+END_SRC
  734. *** Org key bindings
  735. Set up some global key bindings that integrate with Org mode features
  736. #+BEGIN_SRC emacs-lisp
  737. (bind-key "C-c l" 'org-store-link)
  738. (bind-key "C-c c" 'org-capture)
  739. (bind-key "C-c a" 'org-agenda)
  740. #+END_SRC
  741. Org overwrites RET and C-j, so I need to disable the rebinds
  742. #+BEGIN_SRC emacs-lisp
  743. (define-key org-mode-map (kbd "RET") nil) ;;org-return
  744. (define-key org-mode-map (kbd "C-j") nil) ;;org-return-indent
  745. #+END_SRC
  746. *** Org agenda
  747. For a more detailed example [[https://github.com/sachac/.emacs.d/blob/83d21e473368adb1f63e582a6595450fcd0e787c/Sacha.org#org-agenda][see here]].
  748. Custom todo-keywords, depending on environment
  749. #+BEGIN_SRC emacs-lisp
  750. (pcase my/whoami
  751. ("work_remote")
  752. (setq org-todo-keywords
  753. '((sequence "OPEN" "TODO" "UNCLEAR" "|" "DONE" "IMPOSSIBLE")))
  754. )
  755. #+END_SRC
  756. Sort org agenda by deadline and priority
  757. #+BEGIN_SRC emacs-lisp
  758. (setq org-agenda-sorting-strategy
  759. (quote
  760. ((agenda deadline-up priority-down)
  761. (todo priority-down category-keep)
  762. (tags priority-down category-keep)
  763. (search category-keep)))
  764. )
  765. #+END_SRC
  766. Customize the org agenda
  767. #+BEGIN_SRC emacs-lisp
  768. (defun my-org-skip-subtree-if-priority (priority)
  769. "Skip an agenda subtree if it has a priority of PRIORITY.
  770. PRIORITY may be one of the characters ?A, ?B, or ?C."
  771. (let ((subtree-end (save-excursion (org-end-of-subtree t)))
  772. (pri-value (* 1000 (- org-lowest-priority priority)))
  773. (pri-current (org-get-priority (thing-at-point 'line t))))
  774. (if (= pri-value pri-current)
  775. subtree-end
  776. nil)))
  777. (setq org-agenda-custom-commands
  778. '(("c" "Simple agenda view"
  779. ((tags "PRIORITY=\"A\""
  780. ((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
  781. (org-agenda-overriding-header "Hohe Priorität:")))
  782. (agenda ""
  783. ((org-agenda-span 7)
  784. (org-agenda-start-on-weekday nil)
  785. (org-agenda-overriding-header "Nächsten 7 Tage:")))
  786. (alltodo ""
  787. ((org-agenda-skip-function '(or (my-org-skip-subtree-if-priority ?A)
  788. (org-agenda-skip-if nil '(scheduled deadline))))
  789. (org-agenda-overriding-header "Sonstige Aufgaben:"))))))
  790. )
  791. #+END_SRC
  792. *** Org Capture
  793. The basic format is:
  794. hotkey - name - type - location - content
  795. For todos a prompt for the title is demanded. This made it possible to place the cursor for the content to the right position. Just typing, C-c C-c, done!
  796. #+BEGIN_SRC emacs-lisp
  797. (pcase my/whoami
  798. ("home"
  799. (setq org-capture-templates
  800. `(("n" "note" entry (org-default-notes-file))
  801. ("t" "todo" entry (file+headline ,(concat PATH_ORG_FILES "tasks.org") "Tasks")
  802. "* TODO %^{Title}\n %u\n %?\n")
  803. ("c" "coding todo" entry (file+headline ,(concat PATH_ORG_FILES "tasks.org") "Tasks")
  804. "* TODO %^{Title}\n %u %a\n %?\n")
  805. ("p" "project" entry (file+headline ,(concat PATH_ORG_FILES "tasks.org") "Projects")
  806. "* TODO %^{Title} %^g\n %u\n %?\n"))))
  807. ("work_remote"
  808. (setq org-capture-templates
  809. `(("n" "note" entry (file org-default-notes-file))
  810. ("t" "todo" entry (file+headline ,(concat PATH_ORG_FILES "todo.org") "Todos")
  811. "* TODO %^{Title}\n %u\n %?\n")
  812. ("p" "project" entry (file+headline ,(concat PATH_ORG_FILES "projects.org") "Projekte")
  813. "* OPEN %^{Title}\n %u\n** Beschreibung\n %?\n** Zu erledigen\n*** \n** Verlauf\n*** a\n"))))
  814. )
  815. #+END_SRC
  816. ** Org babel languages
  817. This code block is linux specific. Loading languages which aren't available seems to be a problem.
  818. New: Load languages on demand. I need to test if this works as intended.
  819. #+BEGIN_SRC emacs-lisp
  820. (defadvice org-babel-execute-src-block (around load-language nil activate)
  821. "Load language if needed"
  822. (let ((language (org-element-property :language (org-element-at-point))))
  823. (unless (cdr (assoc (intern language) org-babel-load-languages))
  824. (add-to-list 'org-babel-load-languages (cons (intern language) t))
  825. (org-babel-do-load-languages 'org-babel-load-languages org-babel-load-languages))
  826. ad-do-it))
  827. #+END_SRC
  828. BEGIN_SRC emacs-lisp
  829. (cond ((eq system-type 'gnu/linux)
  830. (org-babel-do-load-languages
  831. 'org-babel-load-languages
  832. '(
  833. (C . t)
  834. (calc . t)
  835. (java . t)
  836. (ipython . t)
  837. (js . t)
  838. (latex . t)
  839. (ledger . t)
  840. (beancount . t)
  841. (lisp . t)
  842. (python . t)
  843. (R . t)
  844. (ruby . t)
  845. (scheme . t)
  846. (shell . t)
  847. (sqlite . t)
  848. )
  849. ))
  850. )
  851. END_SRC
  852. #+BEGIN_SRC emacs-lisp
  853. (defun my-org-confirm-babel-evaluate (lang body)
  854. "Do not confirm evaluation for these languages."
  855. (not (or (string= lang "beancount")
  856. (string= lang "C")
  857. (string= lang "emacs-lisp")
  858. (string= lang "ipython")
  859. (string= lang "java")
  860. (string= lang "ledger")
  861. (string= lang "python")
  862. (string= lang "R")
  863. (string= lang "sqlite"))))
  864. (setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate)
  865. #+END_SRC
  866. #+BEGIN_SRC emacs-lisp
  867. (add-hook 'org-babel-after-execute-hook 'org-display-inline-images)
  868. (add-hook 'org-mode-hook 'org-display-inline-images)
  869. #+END_SRC
  870. ** Org babel/source blocks
  871. I like to have source blocks properly syntax highlighted and with the editing popup window staying within the same window so all the windows don't jump around. Also, having the top and bottom trailing lines in the block is a waste of space, so we can remove them
  872. I noticed that fontification doesn't work with markdown mode when the block is indented after editing it in the org src buffer - the leading #s for headers don't get fontified properly because they apppear as Org comments. Setting ~org-src-preserve-identation~ makes things consistent as it doesn't pad source blocks with leading spaces
  873. #+BEGIN_SRC emacs-lisp
  874. (setq org-src-fontify-natively t
  875. org-src-window-setup 'current-window
  876. org-src-strip-leading-and-trailing-blank-lines t
  877. org-src-preserve-indentation nil ; these two lines respect the indentation of
  878. org-edit-src-content-indentation 0 ; the surrounding text around the source block
  879. org-src-tab-acts-natively t)
  880. #+END_SRC
  881. ** Org babel helper functions
  882. * Pandoc
  883. Convert between formats, like from org to html.
  884. Pandoc needs to be installed on the system
  885. #+BEGIN_EXAMPLE
  886. sudo apt install pandoc
  887. #+END_EXAMPLE
  888. Pandoc-mode is a minor mode to interact with pandoc
  889. #+BEGIN_SRC emacs-lisp
  890. (use-package pandoc-mode
  891. :ensure t
  892. :init
  893. (add-hook 'markdown-mode-hook 'pandoc-mode))
  894. #+END_SRC
  895. * Emails
  896. Currently following tools are required:
  897. - notmuch (edit, read, tag, delete emails)
  898. - isync /mbsync (fetch or sync emails)
  899. After setting up mbsync, notmuch must be configured. Execute "notmuch" from the command line to launch the setup wizard. After it, "notmuch new" to create a new database, which will index the available local e-mails.
  900. TODO:
  901. - setup of mbsync on linux
  902. - setup of notmuch on linux
  903. - shell script for installation of isync and notmuch
  904. - more config for notmuch?
  905. - hydra for notmuch?
  906. - maybe org-notmuch?
  907. - some way to refresh the notmuch db before I run notmuch?
  908. #+BEGIN_SRC emacs-lisp
  909. (unless (string-equal my/whoami "work_remote")
  910. (use-package notmuch
  911. :defer t
  912. :ensure t
  913. )
  914. )
  915. #+END_SRC
  916. * Personal Finances
  917. After trying ledger, I chose beancount. It is closer to real bookkeeping and has stricter rules.
  918. Since there is no debian package, it is an option to install it via pip.
  919. I picked /opt for the installation path
  920. #+BEGIN_EXAMPLE
  921. sudo su
  922. cd /opt
  923. python3 -m venv beancount
  924. source ./beancount/bin/activate
  925. pip3 install wheel
  926. pip3 install beancount
  927. sleep 100
  928. echo "shell running!"
  929. deactivate
  930. #+END_EXAMPLE
  931. When using beancount, it will automatically pick the created virtual environment.
  932. Activate the beancount mode. ATTENTION: This mode is made by myself.
  933. #+BEGIN_SRC emacs-lisp
  934. (unless (string-equal my/whoami "work_remote")
  935. (load "/home/marc/.emacs.d/user-local/elisp/beancount-mode.el") ; somehow load-path in use-package doesn't work
  936. (use-package beancount
  937. :load-path "/home/marc/.emacs.d/elisp"
  938. :defer t
  939. :mode ("\\.beancount$" . beancount-mode)
  940. :init
  941. (add-hook 'beancount-mode-hook 'company/beancount-mode-hook)
  942. (setenv "PATH"
  943. (concat
  944. "/opt/beancount/bin:"
  945. (getenv "PATH"))
  946. )
  947. :config
  948. (setq beancount-filename-main "/home/marc/Archiv/Finanzen/Transaktionen/transactions.beancount")
  949. )
  950. )
  951. #+END_SRC
  952. To support org-babel, check if it can find the symlink to ob-beancount.el.
  953. #+BEGIN_SRC shell
  954. orgpath=`find /home/marc/.emacs.d/elpa/ -type d -name "org-plus*" -print`
  955. beansym="$orgpath/ob-beancount.el"
  956. bean="/home/marc/Archiv/Programmierprojekte/Lisp/beancount-mode/ob-beancount.el"
  957. if [ -h "$beansym" ]
  958. then
  959. echo "$beansym found"
  960. elif [ -e "$bean" ]
  961. then
  962. echo "creating symlink"
  963. ln -s "$bean" "$beansym"
  964. else
  965. echo "$bean not found, symlink creation aborted"
  966. fi
  967. #+END_SRC
  968. #+RESULTS:
  969. : /home/marc/.emacs.d/elpa/org-plus-contrib-20180521/ob-beancount.el found
  970. Installing fava for reports is strongly recommended.
  971. #+BEGIN_EXAMPLE
  972. cd /opt
  973. python3 -m venv fava
  974. source ./fava/bin/activate
  975. pip3 install wheel
  976. pip3 install fava
  977. deactivate
  978. #+END_EXAMPLE
  979. Start fava with
  980. #+BEGIN_EXAMPLE
  981. fava my_file.beancount
  982. #+END_EXAMPLE
  983. It is accessable on this URL: [[http://127.0.0.1:5000][Fava]]
  984. Beancount-mode can start fava and open the URL right away.
  985. * Programming
  986. ** Common things
  987. List of plugins and settings which are shared between the language plugins
  988. Highlight whitespaces, tabs, empty lines.
  989. #+BEGIN_SRC emacs-lisp
  990. (use-package whitespace
  991. :demand t
  992. :ensure nil
  993. :diminish whitespace-mode;;mode shall be active, but not shown in mode line
  994. :init
  995. (dolist (hook '(prog-mode-hook
  996. text-mode-hook
  997. conf-mode-hook))
  998. (add-hook hook #'whitespace-mode))
  999. ;; :hook ;;not working in use-package 2.3
  1000. ;; ((prog-mode . whitespace-turn-on)
  1001. ;; (text-mode . whitespace-turn-on))
  1002. :config
  1003. (setq-default whitespace-style '(face empty tab trailing))
  1004. )
  1005. #+END_SRC
  1006. Disable Eldoc, it interferes with flycheck
  1007. #+BEGIN_SRC emacs-lisp
  1008. (use-package eldoc
  1009. :ensure nil
  1010. :config
  1011. (global-eldoc-mode -1)
  1012. )
  1013. #+END_SRC
  1014. Colorize colors as text with their value
  1015. #+BEGIN_SRC emacs-lisp
  1016. (use-package rainbow-mode
  1017. :ensure t
  1018. :init
  1019. (add-hook 'prog-mode-hook 'rainbow-mode t)
  1020. :diminish rainbow-mode
  1021. ;; :hook prog-mode ;; not working in use-package 2.3
  1022. :config
  1023. (setq-default rainbow-x-colors-major-mode-list '())
  1024. )
  1025. #+END_SRC
  1026. Highlight parens etc. for improved readability
  1027. #+BEGIN_SRC emacs-lisp
  1028. (use-package rainbow-delimiters
  1029. :ensure t
  1030. :config
  1031. (add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
  1032. )
  1033. #+END_SRC
  1034. Treat CamelCase combined words as individual words
  1035. #+BEGIN_SRC emacs-lisp
  1036. (use-package subword
  1037. :diminish subword-mode
  1038. :config
  1039. (add-hook 'python-mode-hook 'subword-mode))
  1040. #+END_SRC
  1041. ** Smartparens
  1042. Smartparens is a beast on its own, so it's worth having a dedicated section for it
  1043. #+BEGIN_SRC emacs-lisp
  1044. (use-package smartparens
  1045. :ensure t
  1046. :diminish smartparens-mode
  1047. :config
  1048. (add-hook 'prog-mode-hook 'smartparens-mode)
  1049. )
  1050. #+END_SRC
  1051. ** Git
  1052. *** Magit
  1053. [[https://magit.vc/manual/magit/index.html][Link]]
  1054. I want to do git stuff here, not in a separate terminal window
  1055. Little crashcourse in magit:
  1056. - magit-init to init a git project
  1057. - magit-status (C-x g) to call the status window
  1058. in status buffer:
  1059. - s stage files
  1060. - u unstage files
  1061. - U unstage all files
  1062. - a apply changed to staging
  1063. - c c commit (type commit message, then C-c C-c to commit)
  1064. - b b switch to another branch
  1065. - P u git push
  1066. - F u git pull
  1067. #+BEGIN_SRC emacs-lisp
  1068. (use-package magit
  1069. :ensure t
  1070. :defer t
  1071. :init
  1072. ;; set git-path in work environment
  1073. (if (string-equal user-login-name "POH")
  1074. (setq magit-git-executable "P:/Eigene Dateien/Tools/Git/bin/git.exe")
  1075. )
  1076. :defer t
  1077. :bind (("C-x g" . magit-status))
  1078. )
  1079. #+END_SRC
  1080. *** Git-gutter
  1081. Display line changes in gutter based on git history. Enable it everywhere
  1082. [[https://github.com/syohex/emacs-git-gutter][Source]]
  1083. #+BEGIN_SRC emacs-lisp
  1084. (use-package git-gutter
  1085. :ensure t
  1086. :defer t
  1087. :config
  1088. (global-git-gutter-mode t)
  1089. :diminish git-gutter-mode
  1090. )
  1091. #+END_SRC
  1092. Some persistent navigation in git-gutter is nice, so here's a hydra for it:
  1093. #+BEGIN_SRC emacs-lisp
  1094. (defhydra hydra-git-gutter (:body-pre (git-gutter-mode 1)
  1095. :hint nil)
  1096. "
  1097. ^Git Gutter^ ^Git^ ^misc^
  1098. ^──────────^────────^───^────────────────^────^──────────────────────────
  1099. _j_: next hunk _s_tage hunk _q_uit
  1100. _k_: previous hunk _r_evert hunk _g_ : call magit-status
  1101. _h_: first hunk _p_opup hunk
  1102. _l_: last hunk set start _R_evision
  1103. ^^ ^^ ^^
  1104. "
  1105. ("j" git-gutter:next-hunk)
  1106. ("k" git-gutter:previous-hunk)
  1107. ("h" (progn (goto-char (point-min))
  1108. (git-gutter:next-hunk 1)))
  1109. ("l" (progn (goto-char (point-min))
  1110. (git-gutter:previous-hunk 1)))
  1111. ("s" git-gutter:stage-hunk)
  1112. ("r" git-gutter:revert-hunk)
  1113. ("p" git-gutter:popup-hunk)
  1114. ("R" git-gutter:set-start-revision)
  1115. ("q" nil :color blue)
  1116. ("g" magit-status)
  1117. )
  1118. #+END_SRC
  1119. *** Git-timemachine
  1120. Time machine lets me step through the history of a file as recorded in git.
  1121. [[https://github.com/pidu/git-timemachine][Source]]
  1122. #+BEGIN_SRC emacs-lisp
  1123. (use-package git-timemachine
  1124. :ensure t
  1125. :defer t
  1126. )
  1127. #+END_SRC
  1128. ** Company backend hooks
  1129. Backend configuration for python-mode
  1130. Common backends are:
  1131. - company-files: files & directory
  1132. - company-keywords: keywords
  1133. - company-capf: ??
  1134. - company-abbrev: ??
  1135. - company-dabbrev: dynamic abbreviations
  1136. - company-ispell: ??
  1137. So far I cannot differenciate a true python mode and a source block of ipython in org-mode, so the python-mode-hook should include both completion backends.
  1138. #+BEGIN_SRC emacs-lisp
  1139. (defun company/python-mode-hook()
  1140. (message "company/python-mode-hook activated")
  1141. (set (make-local-variable 'company-backends)
  1142. '(company-jedi))
  1143. ; '((company-jedi company-yasnippet company-dabbrev-code) company-dabbrev))
  1144. ; '((company-ob-ipython company-lsp)))
  1145. ; '((company-ob-ipython company-jedi)))
  1146. ; '((company-jedi company-dabbrev-code company-yasnippet) company-capf company-files))
  1147. ; '((company-lsp company-yasnippet) company-capf company-dabbrev company-files))
  1148. (company-mode t)
  1149. )
  1150. #+END_SRC
  1151. I have yet to find the proper hook to call this.
  1152. #+BEGIN_SRC emacs-lisp
  1153. (defun company/ipython-mode-hook()
  1154. (message "company/ipython-mode-hook activated")
  1155. (set (make-local-variable 'company-backends)
  1156. '((company-ob-ipython)))
  1157. (company-mode t)
  1158. )
  1159. #+END_SRC
  1160. #+BEGIN_SRC emacs-lisp
  1161. (defun company/ess-mode-hook()
  1162. (message "company/ess-mode-hook activated")
  1163. ; (set (make-local-variable 'company-backends)
  1164. ; '((company-ess-backend company-R-args company-R-objects)))
  1165. (ess-indent-with-fancy-comments nil)
  1166. (company-mode t))
  1167. #+END_SRC
  1168. (defun add-pcomplete-to-capf ()
  1169. (add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t))
  1170. ;; (add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t)
  1171. (add-hook 'org-mode-hook #'add-pcomplete-to-capf)
  1172. Backend for Orgmode
  1173. #+BEGIN_SRC emacs-lisp
  1174. (defun company/org-mode-hook()
  1175. (set (make-local-variable 'company-backends)
  1176. '(company-capf company-files))
  1177. (add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t)
  1178. (message "company/org-mode-hook")
  1179. (company-mode t)
  1180. )
  1181. #+END_SRC
  1182. Backend configuration for lisp-mode
  1183. #+BEGIN_SRC emacs-lisp
  1184. (defun company/elisp-mode-hook()
  1185. (set (make-local-variable 'company-backends)
  1186. '((company-elisp company-dabbrev) company-capf company-files))
  1187. (company-mode t)
  1188. )
  1189. #+END_SRC
  1190. Backend configuration for beancount
  1191. #+BEGIN_SRC emacs-lisp
  1192. (defun company/beancount-mode-hook()
  1193. (set (make-local-variable 'company-backends)
  1194. '(company-beancount))
  1195. ; '((company-beancount company-dabbrev) company-capf company-files))
  1196. (company-mode t)
  1197. )
  1198. #+END_SRC
  1199. Backend configuration for lua
  1200. #+BEGIN_SRC emacs-lisp
  1201. (defun company/lua-mode-hook()
  1202. (set (make-local-variable 'company-backends)
  1203. '(company-lua))
  1204. (company-mode t)
  1205. )
  1206. #+END_SRC
  1207. ** Misc Company packages
  1208. Addon to sort suggestions by usage
  1209. #+BEGIN_SRC emacs-lisp
  1210. (use-package company-statistics
  1211. :ensure t
  1212. :after company
  1213. :init
  1214. (setq company-statistics-file (concat PATH_USER_LOCAL "company-statistics-cache.el"));~/.emacs.d/user-dir/company-statistics-cache.el")
  1215. :config
  1216. (company-statistics-mode 1)
  1217. )
  1218. #+END_SRC
  1219. Get a popup with documentation of the completion candidate.
  1220. For the popups the package pos-tip.el is used and automatically installed.
  1221. [[https://github.com/expez/company-quickhelp][Company Quickhelp]]
  1222. [[https://www.emacswiki.org/emacs/PosTip][See here for Pos-Tip details]]
  1223. #+BEGIN_SRC emacs-lisp
  1224. (use-package company-quickhelp
  1225. :ensure t
  1226. :after company
  1227. :config
  1228. (company-quickhelp-mode 1)
  1229. )
  1230. #+END_SRC
  1231. Maybe add [[https://github.com/hlissner/emacs-company-dict][company-dict]]? It's a dictionary based on major modes, plus it has Yasnippet integration.
  1232. ** Flycheck
  1233. Show errors right away!
  1234. #+BEGIN_SRC emacs-lisp
  1235. (use-package flycheck
  1236. :ensure t
  1237. :diminish flycheck-mode " ✓"
  1238. :init
  1239. (setq flycheck-emacs-lisp-load-path 'inherit)
  1240. (add-hook 'after-init-hook #'global-flycheck-mode)
  1241. ; (add-hook 'python-mode-hook (lambda ()
  1242. ; (semantic-mode 1)
  1243. ; (flycheck-select-checker 'python-pylint)))
  1244. )
  1245. #+END_SRC
  1246. ** Projectile
  1247. Brings search functions on project level
  1248. #+BEGIN_SRC emacs-lisp
  1249. (use-package projectile
  1250. :ensure t
  1251. :defer t
  1252. :bind
  1253. (("C-c p p" . projectile-switch-project)
  1254. ("C-c p s s" . projectile-ag))
  1255. :init
  1256. (setq-default
  1257. projectile-cache-file (concat PATH_USER_LOCAL ".projectile-cache")
  1258. projectile-known-projects-file (concat PATH_USER_LOCAL ".projectile-bookmarks"))
  1259. :config
  1260. (projectile-mode t)
  1261. (setq-default
  1262. projectile-completion-system 'ivy
  1263. projectile-enable-caching t
  1264. projectile-mode-line '(:eval (projectile-project-name)))
  1265. )
  1266. #+END_SRC
  1267. ** Yasnippet
  1268. Snippets!
  1269. TODO: yas-minor-mode? what's that?
  1270. #+BEGIN_SRC emacs-lisp
  1271. (use-package yasnippet
  1272. :ensure t
  1273. :defer t
  1274. :diminish yas-minor-mode
  1275. :init
  1276. (yas-global-mode t)
  1277. ;; (setq yas-snippet-dirs '(concat PATH_USER_GLOBAL "snippets"))
  1278. :mode ("\\.yasnippet" . snippet-mode)
  1279. :config
  1280. (unless (string-equal my/whoami "work_remote") ; very hacky, but yas-reload-all throws a wrongp error at work
  1281. (yas-reload-all)) ;; ensure snippets are updated and available, necessary when not using global-mode
  1282. )
  1283. #+END_SRC
  1284. #+RESULTS:
  1285. ** Lisp
  1286. Not sure about this one, but dynamic binding gets some bad vibes.
  1287. #+BEGIN_SRC emacs-lisp
  1288. (setq lexical-binding t)
  1289. #+END_SRC
  1290. #+BEGIN_SRC emacs-lisp
  1291. (add-hook 'emacs-lisp-mode-hook 'company/elisp-mode-hook)
  1292. #+END_SRC
  1293. Add some helpers to handle and understand macros
  1294. #+BEGIN_SRC emacs-lisp
  1295. (use-package macrostep
  1296. :ensure t
  1297. :defer t
  1298. :init
  1299. (define-key emacs-lisp-mode-map (kbd "C-c e") 'macrostep-expand)
  1300. (define-key emacs-lisp-mode-map (kbd "C-c c") 'macrostep-collapse))
  1301. #+END_SRC
  1302. ** LUA
  1303. #+BEGIN_SRC emacs-lisp
  1304. (use-package lua-mode
  1305. :ensure t
  1306. :mode (("\\.lua$" . lua-mode))
  1307. :init
  1308. (add-hook 'lua-mode-hook 'company/lua-mode-hook)
  1309. )
  1310. #+END_SRC
  1311. ** R
  1312. TODO: test it
  1313. For now only enable ESS at home. Not sure if it is useful at work.
  1314. Also I got "locate-file" errors at work; the debugger listet random files not related to anything within the emacs configuraion
  1315. #+BEGIN_SRC emacs-lisp
  1316. (pcase my/whoami
  1317. ("home"
  1318. (use-package ess-r-mode ;ess-site lädt alle Sprachen (Julia, Stata, S, S+, SAS, BUGS/JAGS
  1319. :ensure ess
  1320. ; :load-path "/usr/share/emacs/site-lisp/ess/"
  1321. ; :load-path "/home/marc/.emacs.d/elpa/ess-20180825.900/"
  1322. :defer t
  1323. :mode (("\\.R$" . R-mode)
  1324. ("\\.r$" . R-mode))
  1325. ; :init (require 'ess-site)
  1326. :commands
  1327. (R-mode)
  1328. :config
  1329. (use-package ess-R-data-view :ensure t)
  1330. ; (use-package ess-smart-equals :ensure t) ; requires julia-mode
  1331. (use-package ess-smart-underscore :ensure t)
  1332. ; (use-package ess-view :ensure t) ; requires julia-mode
  1333. (setq ess-use-flymake nil
  1334. ess-use-ido nil ;;else ESS will use ido whenever possible
  1335. ess-eval-visibly 'nowait
  1336. ess-ask-for-ess-directory nil
  1337. ess-local-process-name "R"
  1338. ess-use-tracebug t
  1339. ess-indent-with-fancy-comments nil ; otherwise ess indents comments sometimes
  1340. ess-describe-at-point-method 'tooltip))) ; 'tooltip or nil (buffer)
  1341. )
  1342. #+END_SRC
  1343. ** Lua
  1344. #+BEGIN_SRC emacs-lisp
  1345. (use-package lua-mode
  1346. :defer t
  1347. :ensure t
  1348. :mode "\\.lua\\'"
  1349. :config
  1350. (setq lua-indent-level 2))
  1351. #+END_SRC
  1352. ** Python
  1353. *** Intro
  1354. Systemwide following packages need to be installed:
  1355. - venv
  1356. - pylint / pylint3 (depending on default python version)
  1357. flycheck complains if no pylint is available and org tries to fontify python code natively.
  1358. The virtual environments need to have following modules installed:
  1359. - wheel (for some reason it isn't pulled by other packages, yet they complain about missing wheel)
  1360. - jedi
  1361. - epc
  1362. - pylint
  1363. *** Python-Mode
  1364. Automatically start python-mode when opening a .py-file.
  1365. Not sure if python.el is better than python-mode.el.
  1366. See [[https://github.com/jorgenschaefer/elpy/issues/887][here]] for info about ~python-shell-completion-native-enable~.
  1367. The custom function is to run inferiour processes (do I really need that?), see [[https://emacs.stackexchange.com/questions/16361/how-to-automatically-run-inferior-process-when-loading-major-mode][here]].
  1368. Also limit the completion backends to those which make sense in Python.
  1369. #+BEGIN_SRC emacs-lisp
  1370. (use-package python
  1371. :mode ("\\.py\\'" . python-mode)
  1372. :interpreter ("python" . python-mode)
  1373. :defer t
  1374. :after company-mode
  1375. :init
  1376. (message "python mode init")
  1377. (add-hook 'python-mode-hook (lambda ()
  1378. (company/python-mode-hook)
  1379. (semantic-mode t)
  1380. (flycheck-select-checker 'python-pylint)))
  1381. :config
  1382. (setq python-shell-completion-native-enable nil)
  1383. )
  1384. #+END_SRC
  1385. *** IPython-Mode
  1386. Not sure if this configuraton will interfere with Python-Mode
  1387. #+BEGIN_SRC emacs-lisp
  1388. (use-package ob-ipython
  1389. :ensure t
  1390. :defer t
  1391. :init
  1392. (add-hook 'ob-ipython-mode-hook (lambda ()
  1393. 'company/ipython-mode-hook
  1394. (semantic-mode t)
  1395. (flycheck-select-checker 'pylint))))
  1396. #+END_SRC
  1397. *** Jedi / Company
  1398. Jedi is a backend for python autocompletion and needs to be installed on the server:
  1399. - pip install jedi
  1400. Code checks need to be installed, too:
  1401. - pip install flake8
  1402. If jedi doesn't work, it might be a problem with jediepcserver.py.
  1403. See [[https://github.com/tkf/emacs-jedi/issues/293][here]]
  1404. To fix it:
  1405. - Figure out which jediepcserver is running (first guess is melpa/jedi-core../jediepcserver.py
  1406. - Change some code:
  1407. #+BEGIN_SRC python
  1408. 100 return dict(
  1409. 101 # p.get_code(False) should do the job. But jedi-vim use replace.
  1410. 102 # So follow what jedi.vim does...
  1411. 103 - params=[p.get_code().replace('\n', '') for p in call_def.params],
  1412. 103 + params=[p.name for p in call_def.params],
  1413. 104 index=call-def.index,
  1414. 105 - call_name=call_def.call_name,
  1415. 105 + call_name=call_def.name,
  1416. 106 )
  1417. #+END_SRC
  1418. #+BEGIN_SRC emacs-lisp
  1419. (use-package company-jedi
  1420. :defer t
  1421. ;; :after company
  1422. :ensure t
  1423. :config
  1424. (setq jedi:environment-virtualenv (list (expand-file-name "~/Archiv/Programmierprojekte/Python/virtualenv/")))
  1425. (setq jedi:python-environment-directory (list (expand-file-name "~/Archiv/Programmierprojekte/Python/virtualenv/")))
  1426. (add-hook 'python-mode-hook 'jedi:setup)
  1427. (setq jedi:complete-on-dot t)
  1428. (setq jedi:use-shortcuts t)
  1429. ;; (add-hook 'python-mode-hook 'company/python-mode-hook)
  1430. )
  1431. #+END_SRC
  1432. *** Virtual Environments
  1433. A wrapper to handle virtual environments.
  1434. I strongly recommend to install virtual environments on the terminal, not through this wrapper, but changing venvs is fine.
  1435. TODO: automatically start an inferior python process or switch to it if already created
  1436. #+BEGIN_SRC emacs-lisp
  1437. (use-package pyvenv
  1438. :ensure t
  1439. :defer t
  1440. :init
  1441. (setenv "WORKON_HOME" (expand-file-name "~/Archiv/Programmierprojekte/Python/virtualenv/"))
  1442. :config
  1443. (pyvenv-mode t)
  1444. (defun my/pyvenv-post-activate-hook()
  1445. ; (setq jedi:environment-root pyvenv-virtual-env)
  1446. ; (setq jedi:environment-virtualenv pyvenv-virtual-env)
  1447. ; (setq jedi:tooltip-method '(nil)) ;; variants: nil or pos-tip and/or popup
  1448. (setq python-shell-virtualenv-root pyvenv-virtual-env)
  1449. ;; default traceback, other option M-x jedi:toggle-log-traceback
  1450. ;; traceback is in jedi:pop-to-epc-buffer
  1451. ; (jedi:setup)
  1452. ;; (company/python-mode-hook)
  1453. ; (setq jedi:server-args '("--log-traceback"))
  1454. (message "pyvenv-post-activate-hook activated"))
  1455. (add-hook 'pyvenv-post-activate-hooks 'my/pyvenv-post-activate-hook)
  1456. )
  1457. #+END_SRC
  1458. I want Emacs to automatically start the proper virtual environment.
  1459. Required is a .python-version file with, content in the first line being /path/to/virtualenv/
  1460. [[https://github.com/marcwebbie/auto-virtualenv][Github source]]
  1461. Depends on pyvenv
  1462. #+BEGIN_SRC emacs-lisp
  1463. (use-package auto-virtualenv
  1464. :ensure t
  1465. ;; :after pyvenv
  1466. :defer t
  1467. :init
  1468. (add-hook 'python-mode-hook 'auto-virtualenv-set-virtualenv)
  1469. ;; activate on changing buffers
  1470. ;; (add-hook 'window-configuration-change-hook 'auto-virtualenv-set-virtualenv)
  1471. ;; activate on focus in
  1472. ;; (add-hook 'focus-in-hook 'auto-virtualenv-set-virtualenv)
  1473. )
  1474. #+END_SRC
  1475. *** Visuals
  1476. Highlight indentations
  1477. #+BEGIN_SRC emacs-lisp
  1478. (use-package highlight-indentation
  1479. :ensure t
  1480. :init
  1481. (add-hook 'python-mode-hook 'highlight-indentation-current-column-mode)
  1482. (add-hook 'python-mode-hook 'highlight-indentation-mode)
  1483. :config
  1484. (set-face-background 'highlight-indentation-face "#454545")
  1485. (set-face-background 'highlight-indentation-current-column-face "#656565"))
  1486. #+END_SRC
  1487. *** Python language server (inactive)
  1488. On python side following needs to be installed:
  1489. - python-language-server[all]
  1490. First test for lsp-python.
  1491. Some intro: [[https://vxlabs.com/2018/06/08/python-language-server-with-emacs-and-lsp-mode/][Intro]]
  1492. Source python language server: [[https://github.com/palantir/python-language-server][Link]]
  1493. Source lsp-mode:
  1494. Source lsp-python: [[https://github.com/emacs-lsp/lsp-python][Link]]
  1495. Source company-lsp: [[https://github.com/tigersoldier/company-lsp][Link]]
  1496. Source lsp-ui: [[https://github.com/emacs-lsp/lsp-ui][Link]]
  1497. BEGIN_SRC emacs-lisp
  1498. (use-package lsp-mode
  1499. :ensure t
  1500. :config
  1501. ;; make sure we have lsp-imenu everywhere we have lsp
  1502. (require 'lsp-imenu)
  1503. (add-hook 'lsp-after-open-hook 'lsp-enable-imenu)
  1504. ;; get lsp-python-enable defined
  1505. ;; nb: use either projectile-project-root or ffip-get-project-root-directory
  1506. ;; or any other function that can be used to find the root dir of a project
  1507. (lsp-define-stdio-client lsp-python "python"
  1508. #'projectile-project-root
  1509. '("pyls"))
  1510. ;; make sure this is activated when python-mode is activated
  1511. ;; lsp-python-enable is created by macro above
  1512. (add-hook 'python-mode-hook
  1513. (lambda ()
  1514. (lsp-python-enable)
  1515. (company/python-mode-hook)))
  1516. ;; lsp extras
  1517. (use-package lsp-ui
  1518. :ensure t
  1519. :config
  1520. (setq lsp-ui-sideline-ignore-duplicate t)
  1521. (add-hook 'lsp-mode-hook 'lsp-ui-mode))
  1522. (use-package company-lsp
  1523. :ensure t)
  1524. ; :config
  1525. ; (push 'company-lsp company-backends))
  1526. ;; NB: only required if you prefer flake8 instead of the default
  1527. ;; send pyls config via lsp-after-initialize-hook -- harmless for
  1528. ;; other servers due to pyls key, but would prefer only sending this
  1529. ;; when pyls gets initialised (:initialize function in
  1530. ;; lsp-define-stdio-client is invoked too early (before server
  1531. ;; start))
  1532. (defun lsp-set-cfg ()
  1533. (let ((lsp-cfg `(:pyls (:configurationSources ("flake8")))))
  1534. ;; TODO: check lsp--cur-workspace here to decide per server / project
  1535. (lsp--set-configuration lsp-cfg)))
  1536. (add-hook 'lsp-after-initialize-hook 'lsp-set-cfg)
  1537. )
  1538. END_SRC
  1539. BEGIN_SRC emacs-lisp
  1540. (use-package lsp-mode
  1541. :ensure t
  1542. :defer t)
  1543. (add-hook 'lsp-mode-hook #'(lambda ()
  1544. (customize-set-variable 'lsp-enable-eldoc nil)
  1545. (flycheck-mode 1)
  1546. (company-mode 1)))
  1547. (use-package lsp-ui
  1548. :ensure t
  1549. :defer t)
  1550. (use-package company-lsp
  1551. :ensure t
  1552. :defer t)
  1553. (use-package lsp-python
  1554. :ensure t
  1555. :after lsp-mode
  1556. :defer t
  1557. :init
  1558. (add-hook 'python-mode-hook #'(lambda ()
  1559. (lsp-python-enable)
  1560. (flycheck-select-checker 'python-flake8))))
  1561. END_SRC
  1562. ** Latex
  1563. Requirements for Debian:
  1564. - texlive (texlive-base?)
  1565. - elpa-pdf-tools
  1566. - dh-autoreconf?
  1567. Recommended:
  1568. - texlive-lang-german
  1569. - texlive-latex-extra
  1570. The midnight mode hook is disabled for now, because CVs with my pic just look weird in this mode.
  1571. #+BEGIN_SRC emacs-lisp
  1572. (unless (string-equal my/whoami "work_remote")
  1573. (use-package pdf-tools
  1574. :ensure t
  1575. :defer t
  1576. :mode (("\\.pdf\\'" . pdf-view-mode))
  1577. :init
  1578. ; (add-hook 'pdf-view-mode-hook 'pdf-view-midnight-minor-mode)
  1579. :config
  1580. (pdf-tools-install)
  1581. (setq pdf-view-resize-factor 1.1 ;; more finegraned zoom
  1582. pdf-view-midnight-colors '("#c6c6c6" . "#363636")
  1583. TeX-view-program-selection '((output-pdf "pdf-tools"))
  1584. TeX-view-program-list '(("pdf-tools" "Tex-pdf-tools-sync-view")))
  1585. )
  1586. )
  1587. #+END_SRC
  1588. For latex-preview-pane a patch might be necessary (as of 2017-10), see the issue [[https://github.com/jsinglet/latex-preview-pane/issues/37][here]].
  1589. Without it, the preview pane won't update, even when compiling works fine.
  1590. #+BEGIN_SRC
  1591. latex-preview-pane-update-p()
  1592. --- (doc-view-revert-buffer nil t)
  1593. +++ (revert-buffer nil t 'preserve-modes)
  1594. #+END_SRC
  1595. After that M-x byte-compile-file
  1596. #+BEGIN_SRC emacs-lisp
  1597. (use-package latex-preview-pane
  1598. :ensure t
  1599. :defer t
  1600. :init
  1601. ;; one of these works
  1602. (add-hook 'LaTeX-mode-hook 'latex-preview-pane-mode)
  1603. (add-hook 'latex-mode-hook 'latex-preview-pane-mode)
  1604. (setq auto-mode-alist
  1605. (append '(("\\.tex$" . latex-mode)) auto-mode-alist))
  1606. )
  1607. ;; necessary, because linum-mode isn't compatible and prints errors
  1608. (add-hook 'pdf-view-mode-hook (lambda () (linum-mode -1)))
  1609. #+END_SRC
  1610. ** Markdown
  1611. Major mode to edit markdown files.
  1612. For previews it needs markdown installed on the system.
  1613. For debian:
  1614. #+BEGIN_EXAMPLE
  1615. sudo apt install markdown
  1616. #+END_EXAMPLE
  1617. #+BEGIN_SRC emacs-lisp
  1618. (use-package markdown-mode
  1619. :ensure t
  1620. :defer t)
  1621. #+END_SRC
  1622. ** Config languages
  1623. #+BEGIN_SRC emacs-lisp
  1624. (use-package nginx-mode
  1625. :ensure t
  1626. :defer t)
  1627. #+END_SRC
  1628. ** Hydra Flycheck
  1629. Flycheck is necessary, obviously
  1630. #+BEGIN_SRC emacs-lisp
  1631. (defhydra hydra-flycheck (:color blue)
  1632. "
  1633. ^
  1634. ^Flycheck^ ^Errors^ ^Checker^
  1635. ^────────^──────────^──────^────────────^───────^───────────
  1636. _q_ quit _<_ previous _?_ describe
  1637. _m_ manual _>_ next _d_ disable
  1638. _v_ verify setup _f_ check _s_ select
  1639. ^^ ^^ ^^
  1640. "
  1641. ("q" nil)
  1642. ("<" flycheck-previous-error :color red)
  1643. (">" flycheck-next-error :color red)
  1644. ("?" flycheck-describe-checker)
  1645. ("d" flycheck-disable-checker)
  1646. ("f" flycheck-buffer)
  1647. ("m" flycheck-manual)
  1648. ("s" flycheck-select-checker)
  1649. ("v" flycheck-verify-setup)
  1650. )
  1651. #+END_SRC
  1652. * Orchestrate the configuration
  1653. Some settings should be set for all systems, some need to be specific (like my job-emacs doesn't need development tools).
  1654. ** Common
  1655. ** Home
  1656. ** Work
  1657. I mainly only use org
  1658. ** Work, Hyper-V
  1659. For testing purproses I keep a working emacs in a debian on hyper-v. The demands here are different to the other work-emacs
  1660. * Finishing
  1661. Stuff which I want to run in the end
  1662. #+BEGIN_SRC emacs-lisp
  1663. (message (emacs-init-time))
  1664. #+END_SRC