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.

1919 lines
57 KiB

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