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.
 

56 KiB

Emacs Configuration

Personal Information

  (setq user-full-name "Marc Pohling"
        user-mail-address "marc.pohling@googlemail.com")

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.

  (defvar my/whoami
    (if (string-equal user-login-name "POH")
        "work_remote"
      (if (equal (display-pixel-width) 1152)
          "work_hyperv"
        (if (string-equal system-type "gnu/linux")
        "home"))))

Stuff to add / to fix

  • smartparens a sane default configuration for navigation, manipulation etc. is still necessary

  • Spaceline / Powerline or similar I want a pretty status bar!

  • Git gutter: Do some configuration to make it useful (see given source link in the Section of gutter) Maybe only enable it for modes where it is likely I use git?

  • Some webmode stuff

  • markdown: add hooks for certain file extensions, maybe add a smart way to start gfm-mode if markdown-file is in a git-project

  • move package dependend configurations inside the package configuration itself, like keymaps for magit

Update config in a running config

Two options:

  • reload the open file: M-x load-file, then press twice to accept the default filename, which is the currently opened

  • Point at the end of any sexp and press C-x C-e

Customize default settings

Keep the .emacs.d clean by moving user files into separate directories.

  • user-local: directory for machine specific files

  • user-global: directory for files which work on any machine

  • the backup and auto-save files go right to /tmp

(defvar PATH_USER_LOCAL (expand-file-name "~/.emacs.d/user-local/"))
(defvar PATH_USER_GLOBAL (expand-file-name "~/.emacs.d/user-global/"))
(setq bookmark-default-file (concat PATH_USER_LOCAL "bookmarks"))
(setq recentf-save-file (concat PATH_USER_LOCAL "recentf"))
(setq custom-file (concat PATH_USER_LOCAL "custom.el"))                ;don't spam init.el with saved customize settings
(setq abbrev-file-name (concat PATH_USER_GLOBAL "abbrev_defs"))
(setq backup-directory-alist `((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms `((".*" ,temporary-file-directory)))

(setq save-abbrevs 'silently)                                          ; don't bother me with asking if new abbrevs should be saved

These functions are useful. Activate them.

  (put 'downcase-region 'disabled nil)
  (put 'upcase-region 'disabled nil)
  (put 'narrow-to-region 'disabled nil)
  (put 'dired-find-alternate-file 'disabled nil)

Disable lock files, which cause trouble in e.g. lsp-mode

(setq-default create-lockfiles nil)

Answering just 'y' or 'n' should be enough.

  (defalias 'yes-or-no-p 'y-or-n-p)

Don't ask me if I want to load themes.

  (setq custom-safe-themes t)

Don't count two spaces after a period as the end of a sentence. Just one space is needed

  (setq sentence-end-double-space nil)

Scroll to the end / beginning of buffer before you throw an error

  (setq scroll-error-top-bottom t)

Delete the region when typing, just like as we expect nowadays.

  (delete-selection-mode t)

Auto-indent when pressing RET, just new-line when C-j

  (define-key global-map (kbd "RET") 'newline-and-indent)
  (define-key global-map (kbd "C-j") 'newline)

Set the default window size depending on the system emacs is running on. ;; TODO: ;; This size is only reasonable for linux@home ;; hyperv is way smaller, use fullscreen here ;; pm should be fullscreen, too

(if (display-graphic-p)
    (pcase my/whoami
      ("home" (progn
                       (setq initial-frame-alist
                             '((width . 165)
                               (height . 70)))
                       (setq default-frame-alist
                             '((width . 165)
                               (height . 70)))))
      ("work_remote" (add-to-list 'initial-frame-alist '(fullscreen . maximized)))
      ("work_hyperv" (add-to-list 'initial-frame-alist '(fullscreen . maximized)))))

Windows specific stuff

Performance

Got it from here

(when (eq system-type 'windows-nt)
  (if (>= emacs-major-version 25)
      (remove-hook 'find-file-hooks 'vc-refresh-state)
    (remove-hook 'find-file-hooks 'vc-find-file-hook))
  (progn
    (setq gc-cons-threshold (* 511 1024 1024)
          gc-cons-percentage 0.5
          garbage-collection-messages t)
    (run-with-idle-timer 5 t #'garbage-collect)))

Hopefully this makes magit faster

(when (eq system-type 'windows-nt)
  (setq w32-pipe-read-delay 0)
  (setq w32-get-true-file-attributes nil))

Visuals

Font

Don't add the font in the work environment, which I am logged in as POH

(pcase my/whoami
  ("home"        (set-face-attribute 'default nil :font "Hack-10"))
  ("work_hyperv" (set-face-attribute 'default nil :font "Hack-12"))
)

Themes

Material Theme

The Material Theme comes in a dark and a light variant. Not too dark to be strenious though. b

 (use-package material-theme
     :if (window-system)
     :defer t
     :ensure t
 )

Apropospriate Theme

Variants dark and light

 (use-package apropospriate-theme
     :if (window-system)
     :defer t
     :ensure t
 )

Ample Theme

Variants:

  • ample

  • ample-flat

  • ample-light

(use-package ample-theme
  :if (window-system)
  :defer t
  :ensure t
  :init
  (load-theme 'ample-flat t)
)

Prettier Line Wraps

By default there is no line wrapping. M-q actually modifies the buffer, which might not be wanted. So: enable visual wrapping and keep indentation if there are any.

   (global-visual-line-mode)
   (diminish 'visual-line-mode)
   (use-package adaptive-wrap
     :ensure t
     :init
     (when (fboundp 'adaptive-wrap-prefix-mode)
       (defun my-activate-adaptive-wrap-prefix-mode ()
         "Toggle `visual-line-mode' and `adaptive-wrap-prefix-mode' simultaneously."
         (adaptive-wrap-prefix-mode (if visual-line-mode 1 -1)))
       (add-hook 'visual-line-mode-hook 'my-activate-adaptive-wrap-prefix-mode))
   )

Mode Line

Change the default mode line to something prettier. Source

(use-package smart-mode-line
  :ensure t
  :config
  (tool-bar-mode -1)
  (setq sml/theme 'respectful)
  (setq sml/name-width 40)
  (setq sml/mode-width 'full)
  (set-face-attribute 'mode-line nil
                      :box nil)
  (sml/setup))

Line numbers

(use-package linum
  :ensure t
  :init
  (add-hook 'prog-mode-hook 'linum-mode))

Misc

UTF-8 please, but don't mess with line endings.

(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(if (eq system-type 'windows-nt)
    (prefer-coding-system 'utf-8-dos)
  (prefer-coding-system 'utf-8))

Turn off blinking cursor

 (blink-cursor-mode -1)
 (show-paren-mode t)
 (column-number-mode t)
 (setq uniquify-buffer-name-style 'forward)

Avoid tabs in place of multiple spaces (they look bad in TeX) and show empty lines

 (setq-default indent-tabs-mode nil)
 (setq-default indicate-empty-lines t)

Smooth scrolling. Emacs tends to be jumpy, this should change it.

(setq scroll-margin 5
      scroll-conservatively 10000
      scroll-preserve-screen-position 1
      scroll-step 1)

Highlight current line

(global-hl-line-mode t)

Usability

which-key

Greatly increases discovery of functions! Click here for source and more info. Info in Emacs: M-x customize-group which-key

   (use-package which-key
       :ensure t
       :diminish which-key-mode
       :config
       (which-key-mode)
       (which-key-setup-side-window-right-bottom)
       (which-key-setup-minibuffer)
       (setq which-key-idle-delay 0.5)
   )

Recentf

Activate and configure recentf

   (recentf-mode t)
   (setq recentf-max-saved-items 200)

Hydra

Hydra allows grouping of commands

   (use-package hydra
       :ensure t
       :bind
       ("C-c f" . hydra-flycheck/body)
       ("C-c g" . hydra-git-gutter/body)
       :config
       (setq-default hydra-default-hint nil)
   )

Evil

So… Evil Mode might be worth a try

   (use-package evil
     :ensure t
     :defer .1 ;; don't block emacs when starting, load evil immediately after startup
     :init
     (setq evil-want-integration nil) ;; required by evil-collection
     :config
     (evil-mode 1)) ;; for now deactivate per default

Evil-collection is a bundle of configs for different modes. 2018-05-01: evil collection causes error "Invalid function: with-helm-buffer"

   ;(use-package evil-collection
   ;  :after evil
   ;  :ensure t
   ;  :config
   ;  (evil-collection-init))

Evil-goggles give visual hints when editing texts, so it's more obvious what is actually happening. Source

(use-package evil-goggles
  :after evil
  :ensure t
  :diminish evil-goggles-mode
  :config
  (evil-goggles-mode)
  (evil-goggles-use-diff-faces))

General (keymapper)

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. Source

   (use-package general
     :ensure t
   )

Custom key mappings

Now some keymaps. If there is no map defined, it is considered the global key map.

(general-define-key
 :states '(normal visual insert emacs)
 :prefix "SPC"
 :non-normal-prefix "M-SPC"
 "TAB" '(ivy-switch-buffer :which-key "prev buffer")
 "SPC" '(counsel-M-x :which-key "M-x")
 "g"   '(:ignore t :which-key "Git")
 "gs"  '(magit-status :which-key "git-status")
)

A map for org-mode

   (general-define-key
    :states '(normal visual insert emacs)
    :keymaps 'org-mode-map
    :prefix "SPC"
    :non-normal-prefix "M-SPC"
    "t" '(counsel-org-tag :which-key "org-tag"))

A map for dired, based on evil-collection

(general-define-key
 :states '(normal visual insert emacs)
 :keymaps 'dired-mode-map
 "q"  '(quit-window :which-key "quit-window")
 "j"  '(dired-next-line :which-key "next line")
 "k"  '(dired-previous-line :which-key "previous line")
 "D"  '(dired-do-delete :which-key "delete")
 "C"  '(dired-do-copy :which-key "copy")
 "t"  '(:ignore t :which-key "dir navigation")
 "td" '(dired-tree-down :which-key "tree down")
 "tu" '(dired-tree-up :which-key "tree up")
 "tn" '(dired-next-subdir :which-key "next subdir")
 "tp" '(dired-prev-subdir :which-key "previous subdir")
)
(general-define-key
 :states '(normal)
 :keymaps 'lsp-ui-imenu-mode-map
 (kbd "RET")   '(lsp-ui-imenu--view :which-key "view")
 (kbd "M-RET") '(lsp-ui-imenu--visit :which-key "visit")
)

List buffers

Ibuffer is the improved version of list-buffers. Make ibuffer the default buffer lister. Source

   (defalias 'list-buffers 'ibuffer)

Also auto refresh dired, but be quiet about it. Source

   (add-hook 'dired-mode-hook 'auto-revert-mode)
   (setq global-auto-revert-non-file-buffers t)
   (setq auto-revert-verbose nil)

ivy / counsel / swiper

Flx is required for fuzzy-matching Is it really necessary? BEGIN_SRC emacs-lisp (use-package flx) end_src

Ivy displays a window with suggestions for hotkeys and M-x

   (use-package ivy
       :ensure t
       :diminish
       (ivy-mode . "")                   ;; does not display ivy in the mode line
       :init
       (ivy-mode 1)
       :bind
       ("C-c C-r" . ivy-resume)
       :config
       (setq ivy-use-virtual-buffers t)  ;; recent files and bookmarks in ivy-switch-buffer
       (setq ivy-height 20)              ;; height of ivy window
       (setq ivy-count-format "%d/%d")   ;; current and total number
       (setq ivy-re-builders-alist       ;; regex replaces spaces with *
             '((t . ivy--regex-plus)))
   )

The find-file replacement is nicer to navigate

   (use-package counsel
       :ensure t
       :bind*                           ;; load counsel when pressed
       (("M-x"     . counsel-M-x)
        ("C-x C-f" . counsel-find-file)
        ("C-x C-r" . counsel-recentf)
        ("C-c C-f" . counsel-git)
        ("C-c h f" . counsel-describe-function)
        ("C-c h v" . counsel-describe-variable)
        ("M-i"     . counsel-imenu)
       )
   )

Swiper ivy-enhances isearch

   (use-package swiper
       :ensure t
       :bind
       (("C-s"     . swiper)
        ("C-c C-r" . ivy-resume)
       )
   )

Ivy-Hydra adds stuff in minibuffer when you press C-o

   (use-package ivy-hydra
     :ensure t)

Helm

This is just a try to see how it works differently.

   (use-package helm
     :ensure t
     :init
     (helm-mode 1)
     :bind
   ;  (("M-x" . helm-M-x)
   ;   ("C-x C-f" . helm-find-files)
   ;   ("C-x C-r" . helm-recentf)
   ;   ("C-x b" . helm-buffers-list))
     :config
     (setq helm-buffers-fuzzy-matching t)
   )

   (use-package helm-descbinds
     :ensure t
     :bind
     ("C-h b" . helm-descbinds))

   (use-package helm-projectile
     :ensure t
     :config
     (helm-projectile-on))

Undo

Show an undo tree in a new buffer which can be navigated.

(use-package undo-tree
  :ensure t
  :diminish undo-tree-mode
  :init
  (global-undo-tree-mode 1))

Ido (currently inactive)

better completion

   ;(use-package ido
   ;    :init
   ;    (setq ido-enable-flex-matching t)
   ;    (setq ido-everywhere t)
   ;    (ido-mode t)
   ;    (use-package ido-vertical-mode
   ;        :ensure t
   ;        :defer t
   ;        :init
   ;        (ido-vertical-mode 1)
   ;        (setq ido-vertical-define-keys 'C-n-and-C-p-only)
   ;    )
   ;)

imenu-list

A minor mode to show imenu in a sidebar. Call imenu-list-smart-toggle. Source

(use-package imenu-list
  :ensure t
  :config
  (setq imenu-list-focus-after-activation t
        imenu-list-auto-resize t
        imenu-list-position 'right)
  :bind
  (:map global-map
        ([f9]  . imenu-list-smart-toggle))
  )

Treemacs

A file manager comparable to neotree. Github

It has some requirements, which gets used here anyway:

  • ace-window

  • hydra

  • projectile

  • python

I copied the configuration example from the github site. No idea what this executable-find is about. TODO check it out!

   (use-package treemacs
     :ensure t
     :defer t
     :config
     (setq treemacs-collapse-dirs              (if (executable-find "python") 3 0)
           treemacs-file-event-delay           5000
           treemacs-follow-after-init          t
           treemacs-follow-recenter-distance   0.1
           treemacs-goto-tag-strategy          'refetch-index
           treemacs-indentation                2
           treemacs-indentation-string         " "
           treemacs-is-never-other-window      nil
           treemacs-no-png-images              nil
           treemacs-project-follow-cleanup     nil
           treemacs-recenter-after-file-follow nil
           treemacs-recenter-after-tag-follow  nil
           treemacs-show-hidden-files          t
           treemacs-silent-filewatch           nil
           treemacs-silent-refresh             nil
           treemacs-sorting                    'alphabetic-desc
           treemacs-tag-follow-cleanup         t
           treemacs-tag-follow-delay           1.5
           treemacs-width                      35)
     (treemacs-follow-mode t)
     (treemacs-filewatch-mode t)
     (pcase (cons (not (null (executable-find "git")))
                  (not (null (executable-find "python3"))))
       (`(t . t)
        (treemacs-git-mode 'extended))
       (`(t . _)
        (treemacs-git-mode 'simple)))
     :bind
     (:map global-map
           ([f8]        . treemacs))
   )

Treemacs-Evil is necessary when using evil

(use-package treemacs-evil
  :after treemacs evil
  :ensure t)

Treemacs-projectile is useful for uhh.. TODO explain!

(use-package treemacs-projectile
  :ensure t
  :after treemacs projectile
  :defer t
  :config
  (setq treemacs-header-function #'treemacs-projectile-create-header)
)

TODO Hydrastuff or keybindings for functions:

  • treemacs-projectile

  • treemacs-projectile-toggle

  • treemacs-toggle

  • treemacs-bookmark

  • treemacs-find-file

  • treemacs-find-tag

Window Handling

Some tools to easen the navigation, creation and deletion of windows

Ace-Window

    (use-package ace-window
      :ensure t
      :init
      (global-set-key (kbd "C-x o") 'ace-window)
    )

Windmove

Windmove easens the navigation between windows. Here we are setting the default keybindings (shift+arrow)

CURRENTLY NOT WORKING, defaults are blocked. Also not sure if necessary when using ace-window.

    (use-package windmove
      :ensure t
      :config
      (windmove-default-keybindings)
    )

Tramp

With tramp you can handle remote files like local files. Usage example: C-x C-f /ssh:name@server:/path To open a file as sudo: C-x C-f /ssh:/name@server|sudo:name@server:/path

(use-package tramp
  :ensure t
  )

misc

Visual feedback when using regexp on the buffer

(use-package visual-regexp
  :ensure t
  :defer t
  :bind (("C-c r s" . query-replace)
         ("C-c r R" . vr/replace)
         ("C-c r r" . vr/query-replace)
         ("C-c r m" . vr/mc-mark)))

Newline at the end of file

(setq require-final-newline t)

Delete the selection with a keypress

(delete-selection-mode t)

Remember the current location in a file

(use-package saveplace
  :unless noninteractive
  :config
  (save-place-mode))

Org Mode

Installation

Although org mode ships with Emacs, the latest version can be installed externally. The configuration here follows the Org mode ELPA Installation instructions. Added a hook to complete org functions, company-capf is necessary for this

(use-package org-plus-contrib
    :ensure t 
    :init
    (add-hook 'org-mode-hook 'company/org-mode-hook)
)
(add-hook 'org-mode-hook 'company/org-mode-hook)

To avoid problems executing source blocks out of the box. Others have the same problem, too. The solution is to remove the .elc files form the package directory:

var ORG_DIR=(let* ((org-v (cadr (split-string (org-version nil t) "@"))) (len (length org-v))) (substring org-v 1 (- len 2)))
rm ${ORG_DIR}/*.elc
echo 'cleaned .elc from package directory'

Setup

Paths

Paths need to be different for work and home

(pcase my/whoami
  ("work_remote"
   (progn
     (defvar PATH_ORG_FILES   "p:/Eigene Dateien/Notizen/")
     (defvar PATH_ORG_JOURNAL "p:/Eigene Dateien/Notizen/Journal/")
     (defvar PATH_START       "p:/Eigene Dateien/Notizen/"))
     (setq org-default-notes-file (concat PATH_ORG_FILES "notes.org"))
     (setq org-agenda-files (list(concat PATH_ORG_FILES "notes.org")
                                 (concat PATH_ORG_FILES "projects.org")
                                 (concat PATH_ORG_FILES "todo.org"))))
  ("home"
   (progn
     (defvar PATH_ORG_FILES_MOBILE "~/Archiv/Organisieren/mobile/")
     (defvar PATH_ORG_JOURNAL      "~/Archiv/Organisieren/Journal/")
     (defvar PATH_ORG_FILES        "~/Archiv/Organisieren/")
     (setq org-default-notes-file (concat PATH_ORG_FILES "notes.org"))
     ;; TODO: ignore notes.org, which shouldn't include any todos
;;     (setq org-agenda-file-regexp "'\\`[^.].*\\.org\\'")
     (setq org-agenda-files (list PATH_ORG_FILES PATH_ORG_FILES_MOBILE))))
)
(setq org-id-locations-file (concat PATH_USER_LOCAL ".org-id-locations"))

Settings

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.

See the doc for speed keys by checking out the documentation for speed keys in Org mode.

   (setq org-use-speed-commands t)
   (setq org-image-actual-width 550)
   (setq org-highlight-latex-and-related '(latex script entities))

Hide emphasis markup (e.g. / … / for italics, etc.)

   (setq org-hide-emphasis-markers t)

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. 45 is a good column number to do that.

   (setq org-tags-column 45)

Set the org-refile targets. TODO: change maxlevel if necessary

(setq org-refile-targets '((org-agenda-files . (:maxlevel . 1))))

Org key bindings

Set up some global key bindings that integrate with Org mode features

 (bind-key "C-c l" 'org-store-link)
 (bind-key "C-c c" 'org-capture)
 (bind-key "C-c a" 'org-agenda)

Org overwrites RET and C-j, so I need to disable the rebinds

 (define-key org-mode-map (kbd "RET") nil) ;;org-return
 (define-key org-mode-map (kbd "C-j") nil) ;;org-return-indent

Org agenda

For a more detailed example see here.

Custom todo-keywords, depending on environment

(pcase my/whoami
  ("work_remote")
  (setq org-todo-keywords
        '((sequence "OPEN" "TODO" "UNCLEAR" "|" "DONE" "IMPOSSIBLE")))
)

Sort org agenda by deadline and priority

   (setq org-agenda-sorting-strategy
         (quote
          ((agenda deadline-up priority-down)
           (todo priority-down category-keep)
           (tags priority-down category-keep)
           (search category-keep)))
   )

Customize the org agenda

   (defun my-org-skip-subtree-if-priority (priority)
     "Skip an agenda subtree if it has a priority of PRIORITY.

      PRIORITY may be one of the characters ?A, ?B, or ?C."
     (let ((subtree-end (save-excursion (org-end-of-subtree t)))
           (pri-value (* 1000 (- org-lowest-priority priority)))
           (pri-current (org-get-priority (thing-at-point 'line t))))
       (if (= pri-value pri-current)
           subtree-end
         nil)))

   (setq org-agenda-custom-commands
         '(("c" "Simple agenda view"
            ((tags "PRIORITY=\"A\""
                   ((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
                    (org-agenda-overriding-header "Hohe Priorität:")))
             (agenda ""
                     ((org-agenda-span 7)
                      (org-agenda-start-on-weekday nil)
                      (org-agenda-overriding-header "Nächsten 7 Tage:")))
             (alltodo ""
                      ((org-agenda-skip-function '(or (my-org-skip-subtree-if-priority ?A)
                                                      (org-agenda-skip-if nil '(scheduled deadline))))
                      (org-agenda-overriding-header "Sonstige Aufgaben:"))))))
   )

Org Capture

The basic format is: hotkey - name - type - location - content 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!

(pcase my/whoami
  ("home"
   (setq org-capture-templates
         `(("n" "note"        entry (org-default-notes-file))
           ("t" "todo"        entry (file+headline ,(concat PATH_ORG_FILES "tasks.org") "Tasks")
            "* TODO %^{Title}\n  %u\n   %?\n")
           ("c" "coding todo" entry (file+headline ,(concat PATH_ORG_FILES "tasks.org") "Tasks")
            "* TODO %^{Title}\n  %u %a\n   %?\n")
           ("p" "project"     entry (file+headline ,(concat PATH_ORG_FILES "tasks.org") "Projects")
            "* TODO %^{Title}   %^g\n  %u\n   %?\n"))))
  ("work_remote"
   (setq org-capture-templates
         `(("n" "note" entry (file org-default-notes-file))
           ("t" "todo" entry (file+headline ,(concat PATH_ORG_FILES "todo.org") "Todos")
            "* TODO %^{Title}\n  %u\n   %?\n")
           ("p" "project" entry (file+headline ,(concat PATH_ORG_FILES "projects.org") "Projekte")
            "* OPEN %^{Title}\n  %u\n** Beschreibung\n    %?\n** Zu erledigen\n*** \n** Verlauf\n*** a\n"))))
)

Org babel languages

This code block is linux specific. Loading languages which aren't available seems to be a problem. New: Load languages on demand. I need to test if this works as intended.

(defadvice org-babel-execute-src-block (around load-language nil activate)
  "Load language if needed"
  (let ((language (org-element-property :language (org-element-at-point))))
    (unless (cdr (assoc (intern language) org-babel-load-languages))
      (add-to-list 'org-babel-load-languages (cons (intern language) t))
      (org-babel-do-load-languages 'org-babel-load-languages org-babel-load-languages))
    ad-do-it))

BEGIN_SRC emacs-lisp (cond ((eq system-type 'gnu/linux) (org-babel-do-load-languages 'org-babel-load-languages '( (C . t) (calc . t) (java . t) (ipython . t) (js . t) (latex . t) (ledger . t) (beancount . t) (lisp . t) (python . t) (R . t) (ruby . t) (scheme . t) (shell . t) (sqlite . t) ) )) ) END_SRC

(defun my-org-confirm-babel-evaluate (lang body)
    "Do not confirm evaluation for these languages."
    (not (or (string= lang "beancount")
             (string= lang "C")
             (string= lang "emacs-lisp")
             (string= lang "ipython")
             (string= lang "java")
             (string= lang "ledger")
             (string= lang "python")
             (string= lang "R")
             (string= lang "sqlite"))))
(setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate)

TODO: ess belongs to programming languages to start an ess instance C-c C-s

 (use-package ess
   :ensure t
   :init
   (add-hook 'ess-mode-hook 'company/ess-mode-hook)
 )
(add-hook 'org-babel-after-execute-hook 'org-display-inline-images)
(add-hook 'org-mode-hook 'org-display-inline-images)

Org babel/source blocks

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

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

   (setq org-src-fontify-natively t
         org-src-window-setup 'current-window
         org-src-strip-leading-and-trailing-blank-lines t
         org-src-preserve-indentation nil                 ; these two lines respect the indentation of
         org-edit-src-content-indentation 0               ; the surrounding text around the source block
         org-src-tab-acts-natively t)

Org babel helper functions

Pandoc

Convert between formats, like from org to html. Pandoc needs to be installed on the system

sudo apt install pandoc

Pandoc-mode is a minor mode to interact with pandoc

(use-package pandoc-mode
  :ensure t
  :init
  (add-hook 'markdown-mode-hook 'pandoc-mode))

Emails

Currently following tools are required:

  • notmuch (edit, read, tag, delete emails)

  • isync /mbsync (fetch or sync emails)

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.

TODO:

  • setup of mbsync on linux

  • setup of notmuch on linux

  • shell script for installation of isync and notmuch

  • more config for notmuch?

  • hydra for notmuch?

  • maybe org-notmuch?

  • some way to refresh the notmuch db before I run notmuch?

(unless (string-equal my/whoami "work_remote")
  (use-package notmuch
    :defer t
    :ensure t
  )
)

Personal Finances

After trying ledger, I chose beancount. It is closer to real bookkeeping and has stricter rules. Since there is no debian package, it is an option to install it via pip. I picked /opt for the installation path

sudo su
cd /opt
python3 -m venv beancount
source ./beancount/bin/activate
pip3 install wheel
pip3 install beancount
sleep 100
echo "shell running!"
deactivate

When using beancount, it will automatically pick the created virtual environment.

Activate the beancount mode. ATTENTION: This mode is made by myself.

(unless (string-equal my/whoami "work_remote")
  (load "/home/marc/.emacs.d/user-local/elisp/beancount-mode.el") ; somehow load-path in use-package doesn't work
  (use-package beancount
    :load-path "/home/marc/.emacs.d/elisp"
    :defer t
    :mode ("\\.beancount$" . beancount-mode)
    :init
    (add-hook 'beancount-mode-hook 'company/beancount-mode-hook)
    (setenv "PATH"
          (concat
           "/opt/beancount/bin:"
           (getenv "PATH"))
          )
    :config
    (setq beancount-filename-main "/home/marc/Archiv/Finanzen/Transaktionen/transactions.beancount")
  )
)

To support org-babel, check if it can find the symlink to ob-beancount.el.

orgpath=`find /home/marc/.emacs.d/elpa/ -type d -name "org-plus*" -print`
beansym="$orgpath/ob-beancount.el"
bean="/home/marc/Archiv/Programmierprojekte/Lisp/beancount-mode/ob-beancount.el"

if [ -h "$beansym" ]
then
    echo "$beansym found"
elif [ -e "$bean" ]
then
    echo "creating symlink"
    ln -s "$bean" "$beansym"
else
    echo "$bean not found, symlink creation aborted"
fi
/home/marc/.emacs.d/elpa/org-plus-contrib-20180521/ob-beancount.el found

Installing fava for reports is strongly recommended.

  cd /opt
  python3 -m venv vava
  source ./vava/bin/activate
  pip3 install wheel
  pip3 install fava
  deactivate

Start fava with

  fava my_file.beancount

It is accessable on this URL: Fava Beancount-mode can start fava and open the URL right away.

Programming

Common things

List of plugins and settings which are shared between the language plugins

Highlight whitespaces, tabs, empty lines.

 (use-package whitespace
   :demand t
   :ensure nil
   :diminish whitespace-mode;;mode shall be active, but not shown in mode line
   :init
   (dolist (hook '(prog-mode-hook
                   text-mode-hook
                   conf-mode-hook))
    (add-hook hook #'whitespace-mode))
;;   :hook ;;not working in use-package 2.3
;;   ((prog-mode . whitespace-turn-on)
;;    (text-mode . whitespace-turn-on))
   :config
   (setq-default whitespace-style '(face empty tab trailing))
 )

Disable Eldoc, it interferes with flycheck

 (use-package eldoc
   :ensure nil
   :config
   (global-eldoc-mode -1)
 )

Colorize colors as text with their value

 (use-package rainbow-mode
   :ensure t
   :init
   (add-hook 'prog-mode-hook 'rainbow-mode t)
   :diminish rainbow-mode
;;   :hook prog-mode ;; not working in use-package 2.3
   :config
   (setq-default rainbow-x-colors-major-mode-list '())
 )

Highlight parens etc. for improved readability

(use-package rainbow-delimiters
  :ensure t
  :config
  (add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
)

Treat CamelCase combined words as individual words

(use-package subword
  :diminish subword-mode
  :config
  (add-hook 'python-mode-hook 'subword-mode))

Smartparens

Smartparens is a beast on its own, so it's worth having a dedicated section for it

(use-package smartparens
  :ensure t
  :diminish smartparens-mode
  :config
  (add-hook 'prog-mode-hook 'smartparens-mode)
)

Git

Magit

Link I want to do git stuff here, not in a separate terminal window

Little crashcourse in magit:

  • magit-init to init a git project

  • magit-status (C-x g) to call the status window

in status buffer:

  • s stage files

  • u unstage files

  • U unstage all files

  • a apply changed to staging

  • c c commit (type commit message, then C-c C-c to commit)

  • b b switch to another branch

  • P u git push

  • F u git pull

(use-package magit
  :ensure t
  :defer t
  :init
  ;; set git-path in work environment
  (if (string-equal user-login-name "POH")
    (setq magit-git-executable "P:/Eigene Dateien/Tools/Git/bin/git.exe")
  )
  :defer t
  :bind (("C-x g" . magit-status))
)

Git-gutter

Display line changes in gutter based on git history. Enable it everywhere Source

(use-package git-gutter
  :ensure t
  :defer t
  :config
  (global-git-gutter-mode t)
  :diminish git-gutter-mode
)

Some persistent navigation in git-gutter is nice, so here's a hydra for it:

   (defhydra hydra-git-gutter (:body-pre (git-gutter-mode 1)
                                         :hint nil)
  "
^Git Gutter^        ^Git^                ^misc^
^──────────^────────^───^────────────────^────^──────────────────────────
_j_: next hunk      _s_tage hunk         _q_uit
_k_: previous hunk  _r_evert hunk        _g_ : call magit-status
_h_: first hunk     _p_opup hunk
_l_: last hunk      set start _R_evision
^^                  ^^                   ^^
"
  ("j" git-gutter:next-hunk)
  ("k" git-gutter:previous-hunk)
  ("h" (progn (goto-char (point-min))
              (git-gutter:next-hunk 1)))
  ("l" (progn (goto-char (point-min))
              (git-gutter:previous-hunk 1)))
  ("s" git-gutter:stage-hunk)
  ("r" git-gutter:revert-hunk)
  ("p" git-gutter:popup-hunk)
  ("R" git-gutter:set-start-revision)
  ("q" nil :color blue)
  ("g" magit-status)
)

Git-timemachine

Time machine lets me step through the history of a file as recorded in git. Source

(use-package git-timemachine
  :ensure t
  :defer t
)

Company Mode

Complete Anything!

Activate company and make it react nearly instantly

 (use-package company
     :ensure t
     :config
     (setq-default company-minimum-prefix-length 1
                   company-tooltip-align-annotation t
                   company-tooltop-flip-when-above t
                   company-show-numbers t
                   company-idle-delay 0.1)
;     (define-key company-active-map (kbd "TAB") #'company-complete-selection)
;     (define-key company-active-map (kbd "RET") nil)
     (company-tng-configure-default)
 )

For a nicer suggestion box: company-box (Source) It is only available for emacs 26 and higher.

(when (> emacs-major-version 25)
  (use-package company-box
    :ensure t
    :init
    (add-hook 'company-mode-hook 'company-box-mode)))

Company backend hooks

Backend configuration for python-mode

Common backends are:

  • company-files: files & directory

  • company-keywords: keywords

  • company-capf: ??

  • company-abbrev: ??

  • company-dabbrev: dynamic abbreviations

  • company-ispell: ??

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.

 (defun company/python-mode-hook()
   (message "company/python-mode-hook activated")
   (set (make-local-variable 'company-backends)
         '((company-jedi company-yasnippet)))
;        '((company-ob-ipython company-lsp)))
;        '((company-ob-ipython company-jedi)))
;        '((company-jedi company-dabbrev-code company-yasnippet) company-capf company-files))
;        '((company-lsp company-yasnippet) company-capf company-dabbrev company-files))
   (company-mode t)
 )

I have yet to find the proper hook to call this.

 (defun company/ipython-mode-hook()
   (message "company/ipython-mode-hook activated")
   (set (make-local-variable 'company-backends)
        '((company-ob-ipython)))
   (company-mode t)
 )
(defun company/ess-mode-hook()
  (message "company/ess-mode-hook activated")
;  (set (make-local-variable 'company-backends)
;       '((company-ess-backend company-R-args company-R-objects)))
  (company-mode t))

(defun add-pcomplete-to-capf () (add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t)) ;; (add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t) (add-hook 'org-mode-hook #'add-pcomplete-to-capf)

Backend for Orgmode

(defun company/org-mode-hook()
  (set (make-local-variable 'company-backends)
       '(company-capf company-files))
  (add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t)
  (message "company/org-mode-hook")
  (company-mode t)
)

Backend configuration for lisp-mode

 (defun company/elisp-mode-hook()
   (set (make-local-variable 'company-backends)
        '((company-elisp company-dabbrev) company-capf company-files))
   (company-mode t)
 )

Backend configuration for beancount

(defun company/beancount-mode-hook()
  (set (make-local-variable 'company-backends)
       '(company-beancount))
;       '((company-beancount company-dabbrev) company-capf company-files))
  (company-mode t)
)

Misc Company packages

Addon to sort suggestions by usage

 (use-package company-statistics
     :ensure t
     :after company
     :init
     (setq company-statistics-file (concat PATH_USER_LOCAL "company-statistics-cache.el"));~/.emacs.d/user-dir/company-statistics-cache.el")
     :config
     (company-statistics-mode 1)
 )

Get a popup with documentation of the completion candidate. For the popups the package pos-tip.el is used and automatically installed. Company Quickhelp See here for Pos-Tip details

 (use-package company-quickhelp
     :ensure t
     :after company
     :config
     (company-quickhelp-mode 1)
 )

Maybe add company-dict? It's a dictionary based on major modes, plus it has Yasnippet integration.

Flycheck

Show errors right away!

   (use-package flycheck
       :ensure t
       :diminish flycheck-mode " ✓"
       :init
       (setq flycheck-emacs-lisp-load-path 'inherit)
       (add-hook 'after-init-hook #'global-flycheck-mode)
;       (add-hook 'python-mode-hook (lambda ()
;                                       (semantic-mode 1)
;                                       (flycheck-select-checker 'python-pylint)))
   )

Projectile

Brings search functions on project level

(use-package projectile
  :ensure t
  :defer t
  :bind
  (("C-c p p" . projectile-switch-project)
   ("C-c p s s" . projectile-ag))
  :init
  (setq-default
   projectile-cache-file (concat PATH_USER_LOCAL ".projectile-cache")
   projectile-known-projects-file (concat PATH_USER_LOCAL ".projectile-bookmarks"))
  :config
  (projectile-mode t)
  (setq-default
   projectile-completion-system 'ivy
   projectile-enable-caching t
   projectile-mode-line '(:eval (projectile-project-name)))
 )

Yasnippet

Snippets! TODO: yas-minor-mode? what's that?

    (use-package yasnippet
      :ensure t
      :defer t
      :diminish yas-minor-mode
      :init
      (yas-global-mode t)
      (setq yas-snippet-dirs (concat PATH_USER_GLOBAL "snippets"))
      :mode ("\\.yasnippet" . snippet-mode)
      :config
      (yas-reload-all) ;; ensure snippets are updated and available, necessary when not using global-mode
    )

Lisp

Not sure about this one, but dynamic binding gets some bad vibes.

(setq lexical-binding t)
(add-hook 'emacs-lisp-mode-hook 'company/elisp-mode-hook)

Add some helpers to handle and understand macros

(use-package macrostep
  :ensure t
  :defer t
  :init
  (define-key emacs-lisp-mode-map (kbd "C-c e") 'macrostep-expand)
  (define-key emacs-lisp-mode-map (kbd "C-c c") 'macrostep-collapse))

R

TODO: test it For now only enable ESS at home. Not sure if it is useful at work. Also I got "locate-file" errors at work; the debugger listet random files not related to anything within the emacs configuraion

(pcase my/whoami
  ("home"
   (use-package ess-site
     :ensure ess
     :defer t
     :mode (("\\.R\\'" . r-mode))
     :init (require 'ess-site)
     :config
     (use-package ess-R-data-view :ensure t)
     (use-package ess-smart-equals :ensure t)
     (use-package ess-smart-underscore :ensure t)
     (use-package ess-view :ensure t)
     (setq ess-use-flymake nil
           ess-use-ido nil ;;else ESS will use ido whenever possible
           ess-eval-visibly 'nowait
           ess-ask-for-ess-directory nil
           ess-local-process-name "R"
           ess-use-tracebug t
           ess-describe-at-point-method 'tooltip))) ; 'tooltip or nil (buffer)
)

Lua

(use-package lua-mode
  :defer t
  :ensure t
  :mode "\\.lua\\'"
  :config
  (setq lua-indent-level 2))

Python

Intro

Systemwide following packages need to be installed:

  • venv

  • pylint / pylint3 (depending on default python version) flycheck complains if no pylint is available and org tries to fontify python code natively.

The virtual environments need to have following modules installed:

  • wheel (for some reason it isn't pulled by other packages, yet they complain about missing wheel)

  • jedi

  • epc

  • pylint

Python-Mode

Automatically start python-mode when opening a .py-file. Not sure if python.el is better than python-mode.el. See here for info about python-shell-completion-native-enable. The custom function is to run inferiour processes (do I really need that?), see here.

Also limit the completion backends to those which make sense in Python.

(use-package python
    :mode ("\\.py\\'" . python-mode)
    :interpreter ("python" . python-mode)
    :defer t
    :after company-mode
    :init
    (message "python mode init")
    (add-hook 'python-mode-hook (lambda ()
                                  (company/python-mode-hook)
                                  (semantic-mode t)
                                  (flycheck-select-checker 'python-pylint)))
    :config
    (setq python-shell-completion-native-enable nil)
)

IPython-Mode

Not sure if this configuraton will interfere with Python-Mode

(use-package ob-ipython
  :ensure t
  :defer t
  :init
  (add-hook 'ob-ipython-mode-hook (lambda ()
                                    'company/ipython-mode-hook
                                    (semantic-mode t)
                                    (flycheck-select-checker 'pylint))))

Python language server (inactive)

On python side following needs to be installed:

  • python-language-server[all]

First test for lsp-python. Some intro: Intro Source python language server: Link Source lsp-mode: Source lsp-python: Link Source company-lsp: Link Source lsp-ui: Link

BEGIN_SRC emacs-lisp (use-package lsp-mode :ensure t :config ;; make sure we have lsp-imenu everywhere we have lsp (require 'lsp-imenu) (add-hook 'lsp-after-open-hook 'lsp-enable-imenu) ;; get lsp-python-enable defined ;; nb: use either projectile-project-root or ffip-get-project-root-directory ;; or any other function that can be used to find the root dir of a project (lsp-define-stdio-client lsp-python "python" #'projectile-project-root '("pyls")) ;; make sure this is activated when python-mode is activated ;; lsp-python-enable is created by macro above (add-hook 'python-mode-hook (lambda () (lsp-python-enable) (company/python-mode-hook))) ;; lsp extras (use-package lsp-ui :ensure t :config (setq lsp-ui-sideline-ignore-duplicate t) (add-hook 'lsp-mode-hook 'lsp-ui-mode))

(use-package company-lsp :ensure t) ; :config ; (push 'company-lsp company-backends))

;; NB: only required if you prefer flake8 instead of the default ;; send pyls config via lsp-after-initialize-hook – harmless for ;; other servers due to pyls key, but would prefer only sending this ;; when pyls gets initialised (:initialize function in ;; lsp-define-stdio-client is invoked too early (before server ;; start)) (defun lsp-set-cfg () (let ((lsp-cfg `(:pyls (:configurationSources ("flake8"))))) ;; TODO: check lsp–cur-workspace here to decide per server / project (lsp–set-configuration lsp-cfg)))

(add-hook 'lsp-after-initialize-hook 'lsp-set-cfg) ) END_SRC BEGIN_SRC emacs-lisp (use-package lsp-mode :ensure t :defer t)

(add-hook 'lsp-mode-hook #'(lambda () (customize-set-variable 'lsp-enable-eldoc nil) (flycheck-mode 1) (company-mode 1)))

(use-package lsp-ui :ensure t :defer t)

(use-package company-lsp :ensure t :defer t)

(use-package lsp-python :ensure t :after lsp-mode :defer t :init (add-hook 'python-mode-hook #'(lambda () (lsp-python-enable) (flycheck-select-checker 'python-flake8))))

END_SRC

Jedi / Company

Jedi is a backend for python autocompletion and needs to be installed on the server:

  • pip install jedi

Code checks need to be installed, too:

  • pip install flake8

If jedi doesn't work, it might be a problem with jediepcserver.py. See here To fix it:

  • Figure out which jediepcserver is running (first guess is melpa/jedi-core../jediepcserver.py

  • Change some code:

100   return dict(
101     # p.get_code(False) should do the job. But jedi-vim use replace.
102     # So follow what jedi.vim does...
103 -   params=[p.get_code().replace('\n', '') for p in call_def.params],
103 +   params=[p.name for p in call_def.params],
104     index=call-def.index,
105 -   call_name=call_def.call_name,
105 +   call_name=call_def.name,
106   )
 (use-package company-jedi
     :defer t
;;     :after company
     :ensure t
     :config
     (setq jedi:environment-virtualenv (list (expand-file-name "~/Archiv/Programmierprojekte/Python/virtualenv/")))
     (setq jedi:python-environment-directory (list (expand-file-name "~/Archiv/Programmierprojekte/Python/virtualenv/")))
     (add-hook 'python-mode-hook 'jedi:setup)
     (setq jedi:complete-on-dot t)
     (setq jedi:use-shortcuts t)
;;     (add-hook 'python-mode-hook 'company/python-mode-hook)
 )

Virtual Environments

A wrapper to handle virtual environments. I strongly recommend to install virtual environments on the terminal, not through this wrapper, but changing venvs is fine.

TODO: automatically start an inferior python process or switch to it if already created

 (use-package pyvenv
     :ensure t
     :defer t
     :init
     (setenv "WORKON_HOME" (expand-file-name "~/Archiv/Programmierprojekte/Python/virtualenv/"))
     :config
     (pyvenv-mode t)
     (defun my/pyvenv-post-activate-hook()
;         (setq jedi:environment-root pyvenv-virtual-env)
;         (setq jedi:environment-virtualenv pyvenv-virtual-env)
;         (setq jedi:tooltip-method '(nil)) ;; variants: nil or pos-tip and/or popup
         (setq python-shell-virtualenv-root pyvenv-virtual-env)
         ;; default traceback, other option M-x jedi:toggle-log-traceback
         ;; traceback is in  jedi:pop-to-epc-buffer
;         (jedi:setup)
;;         (company/python-mode-hook)
;         (setq jedi:server-args '("--log-traceback"))
         (message "pyvenv-post-activate-hook activated"))
     (add-hook 'pyvenv-post-activate-hooks 'my/pyvenv-post-activate-hook)
 )

I want Emacs to automatically start the proper virtual environment. Required is a .python-version file with, content in the first line being path/to/virtualenv Github source

Depends on pyvenv

 (use-package auto-virtualenv
     :ensure t
;;     :after pyvenv
     :defer t
     :init
     (add-hook 'python-mode-hook 'auto-virtualenv-set-virtualenv)
     ;; activate on changing buffers
     ;; (add-hook 'window-configuration-change-hook 'auto-virtualenv-set-virtualenv)
     ;; activate on focus in
     ;; (add-hook 'focus-in-hook 'auto-virtualenv-set-virtualenv)
 )

Visuals

Highlight indentations

(use-package highlight-indentation
  :init
  (add-hook 'python-mode-hook 'highlight-indentation-current-column-mode)
  (add-hook 'python-mode-hook 'highlight-indentation-mode)
  :config
  (set-face-background 'highlight-indentation-face "#454545")
  (set-face-background 'highlight-indentation-current-column-face "#656565"))

BEGIN_SRC emacs-lisp (use-package highlight-indent-guides :ensure t :defer t :init (add-hook 'python-mode-hook 'highlight-indent-guides-mode) :config (setq highlight-indent-guides-method 'column ;'character ;highlight-indent-guides-character ?\| highlight-indent-guides-auto-odd-face-perc 15 highlight-indent-guides-auto-even-face-perc 15 highlight-indent-guides-auto-character-face-perc 20)) END_SRC

Anaconda (inactive)

Anaconda test

; (use-package anaconda-mode
;     :ensure t
;     :defer t
;     :init
;     (add-hook 'python-mode-hook 'anaconda-mode)
;;     (add-hook 'python-mode-hook 'anaconda-eldoc-mode)
;     :config
;     (setq anaconda-eldoc-mode 1)
; )
; (use-package company-anaconda
;     :ensure t
;     :defer t
;     :init
;     (defun my/company-anaconda-hook()
;         (add-to-list 'company-backends 'company-anaconda))
;     (add-hook 'python-mode-hook 'my/company-anaconda-hook)
; )

Latex

Requirements for Linux:

  • Latex

  • pdf-tools

The midnight mode hook is disabled for now, because CVs with my pic just look weird in this mode.

(unless (string-equal my/whoami "work_remote")
  (use-package pdf-tools
    :ensure t
    :defer t
    :mode (("\\.pdf\\'" . pdf-view-mode))
    :init
;    (add-hook 'pdf-view-mode-hook 'pdf-view-midnight-minor-mode)
    :config
    (pdf-tools-install)
    (setq pdf-view-resize-factor 1.1  ;; more finegraned zoom
          pdf-view-midnight-colors '("#c6c6c6" . "#363636")
          TeX-view-program-selection '((output-pdf "pdf-tools"))
          TeX-view-program-list '(("pdf-tools" "Tex-pdf-tools-sync-view")))
  )
)

For latex-preview-pane a patch might be necessary (as of 2017-10), see the issue here Update 2018-03: It seems to work without this patch. I will keep it here in case something breaks again.

       latex-preview-pane-update-p()
   ---  (doc-view-revert-buffer nil t)
   +++  (revert-buffer-nil t 'preserve-modes)

After that M-x byte-compile-file

(use-package latex-preview-pane
  :ensure t
  :defer t
  :init
  ;; one of these works
  (add-hook 'LaTeX-mode-hook 'latex-preview-pane-mode)
  (add-hook 'latex-mode-hook 'latex-preview-pane-mode)
  (setq auto-mode-alist
        (append '(("\\.tex$" . latex-mode)) auto-mode-alist))
)

;; necessary, because linum-mode isn't compatible and prints errors
(add-hook 'pdf-view-mode-hook (lambda () (linum-mode -1)))

Markdown

Major mode to edit markdown files. For previews it needs markdown installed on the system. For debian:

   sudo apt install markdown
   (use-package markdown-mode
     :ensure t
     :defer t)

Config languages

(use-package nginx-mode
  :ensure t
  :defer t)

Hydra Flycheck

Flycheck is necessary, obviously

 (defhydra hydra-flycheck (:color blue)

  "
^
^Flycheck^          ^Errors^            ^Checker^
^────────^──────────^──────^────────────^───────^───────────
_q_ quit            _<_ previous        _?_ describe
_m_ manual          _>_ next            _d_ disable
_v_ verify setup    _f_ check           _s_ select
^^                  ^^                  ^^
"
     ("q" nil)
     ("<" flycheck-previous-error :color red)
     (">" flycheck-next-error :color red)
     ("?" flycheck-describe-checker)
     ("d" flycheck-disable-checker)
     ("f" flycheck-buffer)
     ("m" flycheck-manual)
     ("s" flycheck-select-checker)
     ("v" flycheck-verify-setup)
 )

Orchestrate the configuration

Some settings should be set for all systems, some need to be specific (like my job-emacs doesn't need development tools).

Common

Home

Work

I mainly only use org

Work, Hyper-V

For testing purproses I keep a working emacs in a debian on hyper-v. The demands here are different to the other work-emacs

Finishing

Stuff which I want to run in the end

(message (emacs-init-time))