diff --git a/config.org b/config.org index 9eeb124..3080822 100644 --- a/config.org +++ b/config.org @@ -3,10 +3,10 @@ * Personal Information - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (setq user-full-name "Marc Pohling" user-mail-address "marc.pohling@googlemail.com") - #+END_SRC +#+END_SRC * Stuff to add / to fix - smartparens @@ -32,7 +32,7 @@ - user-global: directory for files which work on any machine - the backup and auto-save files go right to /tmp - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (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")) @@ -43,37 +43,37 @@ (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 - #+END_SRC +#+END_SRC These functions are useful. Activate them. - #+begin_src emacs-lisp +#+BEGIN_SRC emacs-lisp (put 'downcase-region 'disabled nil) (put 'upcase-region 'disabled nil) (put 'narrow-to-region 'disabled nil) (put 'dired-find-alternate-file 'disabled nil) - #+end_src + #+END_SRC Answering just 'y' or 'n' should be enough. - #+begin_src emacs-lisp +#+BEGIN_SRC emacs-lisp (defalias 'yes-or-no-p 'y-or-n-p) - #+end_src +#+END_SRC Don't count two spaces after a period as the end of a sentence. Just one space is needed - #+begin_src emacs-lisp +#+BEGIN_SRC emacs-lisp (setq sentence-end-double-space nil) - #+end_src +#+END_SRC Delete the region when typing, just like as we expect nowadays. - #+begin_src emacs-lisp +#+BEGIN_SRC emacs-lisp (delete-selection-mode t) - #+end_src +#+END_SRC Auto-indent when pressing RET, just new-line when C-j - #+begin_src emacs-lisp +#+BEGIN_SRC emacs-lisp (define-key global-map (kbd "RET") 'newline-and-indent) (define-key global-map (kbd "C-j") 'newline) - #+end_src +#+END_SRC Set the default window size depending on the system emacs is running on. ;; TODO: @@ -81,7 +81,7 @@ ;; hyperv is way smaller, use fullscreen here ;; pm should be fullscreen, too - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (if (display-graphic-p) (progn (setq initial-frame-alist @@ -93,7 +93,7 @@ (width . 165) (height . 70)))) ) - #+END_SRC +#+END_SRC * Visuals ** Theme @@ -101,35 +101,35 @@ Don't add the font in the work environment, which I am logged in as POH - #+begin_src emacs-lisp +#+BEGIN_SRC emacs-lisp (unless (string-equal user-login-name "POH") (set-face-attribute 'default nil :font "Hack-12") ) - #+end_src +#+END_SRC *** Material Theme The [[https://github.com/cpaulik/emacs-material-theme][Material Theme]] comes in a dark and a light variant. Not too dark to be strenious though. b - #+begin_src emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package material-theme :if (window-system) :defer t :ensure t ;; :init ) - #+end_src +#+END_SRC *** Apropospriate Theme Variants dark and light - #+begin_src emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package apropospriate-theme :if (window-system) :defer t :ensure t :config ) - #+end_src +#+END_SRC *** Ample Theme Variants: @@ -137,20 +137,20 @@ - ample-flat - ample-light - #+begin_src emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package ample-theme :defer t :ensure t :init (load-theme 'ample-flat) ) - #+end_src +#+END_SRC ** 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. - #+begin_src emacs-lisp +#+BEGIN_SRC emacs-lisp (global-visual-line-mode) (diminish 'visual-line-mode) (use-package adaptive-wrap @@ -162,12 +162,12 @@ (adaptive-wrap-prefix-mode (if visual-line-mode 1 -1))) (add-hook 'visual-line-mode-hook 'my-activate-adaptive-wrap-prefix-mode)) ) - #+end_src +#+END_SRC ** Mode Line Change the default mode line to something prettier. [[https://github.com/Malabarba/smart-mode-line][Source]] - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package smart-mode-line :ensure t :config @@ -178,7 +178,7 @@ (set-face-attribute 'mode-line nil :box nil) (sml/setup)) - #+END_SRC +#+END_SRC ** Line numbers @@ -234,7 +234,7 @@ Smooth scrolling. Emacs tends to be jumpy, this should change it. Click [[https://github.com/justbur/emacs-which-key][here]] for source and more info. Info in Emacs: M-x customize-group which-key - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package which-key :ensure t :diminish which-key-mode @@ -244,18 +244,18 @@ Smooth scrolling. Emacs tends to be jumpy, this should change it. (which-key-setup-minibuffer) (setq which-key-idle-delay 0.5) ) - #+end_src +#+END_SRC ** Recentf Activate and configure recentf - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (recentf-mode t) (setq recentf-max-saved-items 200) - #+END_SRC +#+END_SRC ** Hydra Hydra allows grouping of commands - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package hydra :ensure t :bind @@ -264,12 +264,12 @@ Smooth scrolling. Emacs tends to be jumpy, this should change it. :config (setq-default hydra-default-hint nil) ) - #+end_src +#+END_SRC ** Evil So... Evil Mode might be worth a try - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package evil :ensure t :defer .1 ;; don't block emacs when starting, load evil immediately after startup @@ -277,74 +277,74 @@ Smooth scrolling. Emacs tends to be jumpy, this should change it. (setq evil-want-integration nil) ;; required by evil-collection :config (evil-mode 1)) ;; for now deactivate per default - #+END_SRC +#+END_SRC Evil-collection is a bundle of configs for different modes. 2018-05-01: evil collection causes error "Invalid function: with-helm-buffer" - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp ;(use-package evil-collection ; :after evil ; :ensure t ; :config ; (evil-collection-init)) - #+END_SRC +#+END_SRC Evil-goggles give visual hints when editing texts, so it's more obvious what is actually happening. [[https://github.com/edkolev/evil-goggles][Source]] - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package evil-goggles :after evil :ensure t :config (evil-goggles-mode) (evil-goggles-use-diff-faces)) - #+END_SRC +#+END_SRC ** 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. - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package general :ensure t ) - #+END_SRC +#+END_SRC ** Custom key mappings Now some keymaps. If there is no map defined, it is considered the global key map. - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (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")) - #+END_SRC +#+END_SRC A map for org-mode - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (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")) - #+END_SRC +#+END_SRC ** List buffers Ibuffer is the improved version of list-buffers. Make ibuffer the default buffer lister. [[http://ergoemacs.org/emacs/emacs_buffer_management.html][Source]] - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (defalias 'list-buffers 'ibuffer) - #+end_src +#+END_SRC Also auto refresh dired, but be quiet about it. [[http://whattheemacsd.com/sane-defaults.el-01.html][Source]] - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (add-hook 'dired-mode-hook 'auto-revert-mode) (setq global-auto-revert-non-file-buffers t) (setq auto-revert-verbose nil) - #+end_src +#+END_SRC ** ivy / counsel / swiper Flx is required for fuzzy-matching Is it really necessary? @@ -354,7 +354,7 @@ Smooth scrolling. Emacs tends to be jumpy, this should change it. Ivy displays a window with suggestions for hotkeys and M-x - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package ivy :ensure t :diminish @@ -370,11 +370,11 @@ Smooth scrolling. Emacs tends to be jumpy, this should change it. (setq ivy-re-builders-alist ;; regex replaces spaces with * '((t . ivy--regex-plus))) ) - #+end_src +#+END_SRC The find-file replacement is nicer to navigate - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package counsel :ensure t :bind* ;; load counsel when pressed @@ -387,11 +387,11 @@ Smooth scrolling. Emacs tends to be jumpy, this should change it. ("M-i" . counsel-imenu) ) ) - #+end_src +#+END_SRC Swiper ivy-enhances isearch - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package swiper :ensure t :bind @@ -399,19 +399,19 @@ Smooth scrolling. Emacs tends to be jumpy, this should change it. ("C-c C-r" . ivy-resume) ) ) - #+end_src +#+END_SRC Ivy-Hydra adds stuff in minibuffer when you press C-o - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package ivy-hydra :ensure t) - #+END_SRC +#+END_SRC ** Helm This is just a try to see how it works differently. - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package helm :ensure t :init @@ -434,23 +434,23 @@ Smooth scrolling. Emacs tends to be jumpy, this should change it. :ensure t :config (helm-projectile-on)) - #+END_SRC +#+END_SRC ** Undo Show an undo tree in a new buffer which can be navigated. - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package undo-tree :ensure t :diminish undo-tree-mode :init (undo-tree-mode)) - #+END_SRC +#+END_SRC ** Ido (currently inactive) better completion - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp ;(use-package ido ; :init ; (setq ido-enable-flex-matching t) @@ -464,7 +464,7 @@ Smooth scrolling. Emacs tends to be jumpy, this should change it. ; (setq ido-vertical-define-keys 'C-n-and-C-p-only) ; ) ;) - #+end_src +#+END_SRC ** Treemacs A file manager comparable to neotree. @@ -480,7 +480,7 @@ Smooth scrolling. Emacs tends to be jumpy, this should change it. No idea what this executable-find is about. TODO check it out! - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package treemacs :ensure t :defer t @@ -517,18 +517,18 @@ Smooth scrolling. Emacs tends to be jumpy, this should change it. (:map global-map ([f8] . treemacs-toggle)) ) - #+end_src +#+END_SRC Treemacs-projectile is useful for uhh.. TODO explain! - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package treemacs-projectile :ensure t :defer t :config (setq treemacs-header-function #'treemacs-projectile-create-header) ) - #+end_src +#+END_SRC TODO Hydrastuff or keybindings for functions: @@ -544,13 +544,13 @@ Smooth scrolling. Emacs tends to be jumpy, this should change it. *** Ace-Window - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package ace-window :ensure t :init (global-set-key (kbd "C-x o") 'ace-window) ) - #+end_src +#+END_SRC *** Windmove Windmove easens the navigation between windows. @@ -558,13 +558,13 @@ Smooth scrolling. Emacs tends to be jumpy, this should change it. CURRENTLY NOT WORKING, defaults are blocked. Also not sure if necessary when using ace-window. - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package windmove :ensure t :config (windmove-default-keybindings) ) - #+end_src +#+END_SRC * Org Mode ** Installation @@ -572,20 +572,20 @@ Smooth scrolling. Emacs tends to be jumpy, this should change it. Added a hook to complete org functions, company-capf is necessary for this - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package org :ensure org-plus-contrib :init (add-hook 'org-mode-hook 'company/org-mode-hook) ) - #+end_src +#+END_SRC 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: - #+BEGIN_SRC shell +#+BEGIN_SRC shell 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 - #+end_src +#+END_SRC *** Org key bindings Set up some global key bindings that integrate with Org mode features @@ -594,13 +594,13 @@ 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) -#+end_src +#+END_SRC Org overwrites RET and C-j, so I need to disable the rebinds #+BEGIN_SRC emacs-lisp (define-key org-mode-map (kbd "RET") nil) ;;org-return (define-key org-mode-map (kbd "C-j") nil) ;;org-return-indent -#+end_src +#+END_SRC *** Org agenda For a more detailed example [[https://github.com/sachac/.emacs.d/blob/83d21e473368adb1f63e582a6595450fcd0e787c/Sacha.org#org-agenda][see here]]. @@ -612,45 +612,45 @@ For a more detailed example [[https://github.com/sachac/.emacs.d/blob/83d21e4733 '("~/Archiv/Dokumente/Agenda")) ) ) -#+end_src +#+END_SRC *** Org capture #+BEGIN_SRC emacs-lisp (bind-key "C-c c" 'org-capture) (setq org-default-notes-file "~/Archiv/Dokumente/Notizen/notes.org") -#+end_src +#+END_SRC ** Org Setup 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. - #+BEGIN_SRC emacs-lisp + #+BEGIN_SRC emacs-lisp (setq org-use-speed-commands t) (setq org-image-actual-width 550) (setq org-highlight-latex-and-related '(latex script entities)) - #+end_src + #+END_SRC Hide emphasis markup (e.g. / ... / for italics, etc.) - #+BEGIN_SRC emacs-lisp + #+BEGIN_SRC emacs-lisp (setq org-hide-emphasis-markers t) - #+end_src + #+END_SRC Setting some environment paths - #+BEGIN_SRC emacs-lisp + #+BEGIN_SRC emacs-lisp (if (string-equal user-login-name "POH") (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/")) ) - #+end_src + #+END_SRC Sort org agenda by deadline and priority - #+BEGIN_SRC emacs-lisp + #+BEGIN_SRC emacs-lisp (setq org-agenda-sorting-strategy (quote ((agenda deadline-up priority-down) @@ -658,20 +658,20 @@ For a more detailed example [[https://github.com/sachac/.emacs.d/blob/83d21e4733 (tags priority-down category-keep) (search category-keep))) ) - #+end_src + #+END_SRC Custom todo-keywords, depending on environment - #+BEGIN_SRC emacs-lisp + #+BEGIN_SRC emacs-lisp (if (string-equal user-login-name "POH") (setq org-todo-keywords '((sequence "OPEN" "TODO" "UNCLEAR" "|" "DONE" "IMPOSSIBLE"))) ) - #+end_src + #+END_SRC Set locations of some org files - #+BEGIN_SRC emacs-lisp + #+BEGIN_SRC emacs-lisp (if (string-equal user-login-name "POH") (progn (setq org-default-notes-file (concat PATH_ORG_FILES "notes.org")) @@ -680,11 +680,11 @@ For a more detailed example [[https://github.com/sachac/.emacs.d/blob/83d21e4733 (concat PATH_ORG_FILES "todo.org")))) ) (setq org-id-locations-file (concat PATH_USER_LOCAL ".org-id-locations")) - #+end_src + #+END_SRC Work specific org-capture-templates - #+BEGIN_SRC emacs-lisp + #+BEGIN_SRC emacs-lisp (if (string-equal user-login-name "POH") (setq org-capture-templates '(("t" "todo" entry (file (concat PATH_ORG_FILES "todo.org")) @@ -695,11 +695,11 @@ For a more detailed example [[https://github.com/sachac/.emacs.d/blob/83d21e4733 ("u" "Unterbrechung" entry (file org-default-notes-file) "* Unterbrechnung durch %? :Unterbrechung:\n%t" :clock-in t :clock-resume t))) ) - #+end_src + #+END_SRC Customize the org agenda - #+BEGIN_SRC emacs-lisp + #+BEGIN_SRC emacs-lisp (defun my-org-skip-subtree-if-priority (priority) "Skip an agenda subtree if it has a priority of PRIORITY. @@ -725,19 +725,19 @@ For a more detailed example [[https://github.com/sachac/.emacs.d/blob/83d21e4733 (org-agenda-skip-if nil '(scheduled deadline)))) (org-agenda-overriding-header "Sonstige Aufgaben:")))))) ) - #+end_src + #+END_SRC ** Org tags The default value 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. - #+BEGIN_SRC emacs-lisp + #+BEGIN_SRC emacs-lisp (setq org-tags-column 45) - #+end_src + #+END_SRC ** Org babel languages This code block is linux specific. Loading languages which aren't available seems to be a problem - #+BEGIN_SRC emacs-lisp + #+BEGIN_SRC emacs-lisp (cond ((eq system-type 'gnu/linux) (org-babel-do-load-languages 'org-babel-load-languages @@ -759,9 +759,9 @@ For a more detailed example [[https://github.com/sachac/.emacs.d/blob/83d21e4733 ) )) ) - #+end_src + #+END_SRC - #+BEGIN_SRC emacs-lisp + #+BEGIN_SRC emacs-lisp (defun my-org-confirm-babel-evaluate (lang body) "Do not confirm evaluation for these languages." (not (or (string= lang "beancount") @@ -773,30 +773,30 @@ For a more detailed example [[https://github.com/sachac/.emacs.d/blob/83d21e4733 (string= lang "R") (string= lang "sqlite")))) (setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate) - #+end_src + #+END_SRC I want plots! - #+BEGIN_SRC emacs-lisp + #+BEGIN_SRC emacs-lisp (use-package ess :ensure t ) (add-hook 'org-babel-after-execute-hook 'org-display-inline-images) (add-hook 'org-mode-hook 'org-display-inline-images) - #+end_src + #+END_SRC ** 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 - #+BEGIN_SRC emacs-lisp + #+BEGIN_SRC emacs-lisp (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) - #+end_src + #+END_SRC @@ -804,17 +804,17 @@ For a more detailed example [[https://github.com/sachac/.emacs.d/blob/83d21e4733 * Pandoc Convert between formats, like from org to html. Pandoc needs to be installed on the system - #+BEGIN_SRC shell +#+BEGIN_SRC shell sudo apt install pandoc - #+END_SRC +#+END_SRC Pandoc-mode is a minor mode to interact with pandoc - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package pandoc-mode :ensure t :init (add-hook 'markdown-mode-hook 'pandoc-mode)) - #+END_SRC +#+END_SRC * Emails Currently following tools are required: @@ -831,20 +831,20 @@ sudo apt install pandoc - hydra for notmuch? - maybe org-notmuch? - some way to refresh the notmuch db before I run notmuch? - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (unless (string-equal user-login-name "POH") (use-package notmuch :ensure t ) ) - #+end_src +#+END_SRC * 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 - #+BEGIN_SRC shell +#+BEGIN_SRC shell sudo su cd /opt python3 -m venv beancount @@ -852,13 +852,13 @@ sudo apt install pandoc pip3 install wheel pip3 install beancount deactivate - #+end_src +#+END_SRC When using beancount, it will automatically pick the created virtual environment. Activate the beancount mode. ATTENTION: This mode is made by myself. - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (unless (string-equal user-login-name "POH") (load "/home/marc/.emacs.d/user-local/elisp/beancount-mode.el") ; somehow load-path in use-package doesn't work (use-package beancount @@ -875,11 +875,11 @@ sudo apt install pandoc (setq beancount-filename-main "/home/marc/Archiv/Finanzen/transactions.beancount") ) ) - #+end_src +#+END_SRC Installing fava for reports is strongly recommended. - #+BEGIN_SRC shell +#+BEGIN_SRC shell sudo su cd /opt python3 -m venv vava @@ -887,12 +887,12 @@ sudo apt install pandoc pip3 install wheel pip3 install fava deactivate - #+end_src +#+END_SRC Start fava with - #+BEGIN_SRC shell +#+BEGIN_SRC shell fava my_file.beancount - #+end_src +#+END_SRC It is accessable on this URL: [[http://127.0.0.1:5000][Fava]] Beancount-mode can start fava and open the URL right away. @@ -920,7 +920,7 @@ Highlight whitespaces, tabs, empty lines. :config (setq-default whitespace-style '(face empty tab trailing)) ) -#+end_src +#+END_SRC Disable Eldoc, it interferes with flycheck @@ -930,7 +930,7 @@ Disable Eldoc, it interferes with flycheck :config (global-eldoc-mode -1) ) -#+end_src +#+END_SRC Colorize colors as text with their value #+BEGIN_SRC emacs-lisp @@ -943,7 +943,7 @@ Colorize colors as text with their value :config (setq-default rainbow-x-colors-major-mode-list '()) ) -#+end_src +#+END_SRC Highlight parens etc. for improved readability #+BEGIN_SRC emacs-lisp @@ -952,18 +952,18 @@ Highlight parens etc. for improved readability :config (add-hook 'prog-mode-hook 'rainbow-delimiters-mode) ) -#+end_src +#+END_SRC ** Smartparens Smartparens is a beast on its own, so it's worth having a dedicated section for it - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package smartparens :ensure t :diminish smartparens-mode :config (add-hook 'prog-mode-hook 'smartparens-mode) ) - #+end_src +#+END_SRC ** Git *** Magit [[https://magit.vc/manual/magit/index.html][Link]] @@ -983,7 +983,7 @@ Highlight parens etc. for improved readability - P u git push - F u git pull - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package magit :ensure t :init @@ -994,22 +994,22 @@ Highlight parens etc. for improved readability :defer t :bind (("C-x g" . magit-status)) ) - #+end_src +#+END_SRC *** Git-gutter Display line changes in gutter based on git history. Enable it everywhere [[https://github.com/syohex/emacs-git-gutter][Source]] - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package git-gutter :ensure t :config (global-git-gutter-mode t) :diminish git-gutter-mode ) - #+end_src +#+END_SRC Some persistent navigation in git-gutter is nice, so here's a hydra for it: - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (defhydra hydra-git-gutter (:body-pre (git-gutter-mode 1) :hint nil) " @@ -1034,16 +1034,16 @@ _l_: last hunk set start _R_evision ("q" nil :color blue) ("g" magit-status) ) - #+END_SRC +#+END_SRC *** Git-timemachine Time machine lets me step through the history of a file as recorded in git. [[https://github.com/pidu/git-timemachine][Source]] - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package git-timemachine :ensure t ) - #+end_src +#+END_SRC ** Company Mode Complete Anything! @@ -1063,7 +1063,7 @@ Activate company and make it react nearly instantly ;; (define-key company-active-map (kbd "RET") nil) (company-tng-configure-default) ) -#+end_src +#+END_SRC For a nicer suggestion box: company-box ([[https://github.com/sebastiencs/company-box][Source]]) It is only available for emacs 26 and higher. @@ -1074,7 +1074,7 @@ It is only available for emacs 26 and higher. :ensure t :init (add-hook 'company-mode-hook 'company-box-mode))) -#+end_src +#+END_SRC *** Company backend hooks @@ -1095,7 +1095,7 @@ Common backends are: ;; '((company-jedi company-dabbrev) company-capf company-files)) (company-mode t) ) -#+end_src +#+END_SRC (defun add-pcomplete-to-capf () (add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t)) @@ -1110,7 +1110,7 @@ Backend for Orgmode (add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t) (company-mode t) ) -#+end_src +#+END_SRC Backend configuration for lisp-mode @@ -1120,7 +1120,7 @@ Backend configuration for lisp-mode '((company-elisp company-dabbrev) company-capf company-files)) (company-mode t) ) -#+end_src +#+END_SRC Backend configuration for beancount @@ -1131,7 +1131,7 @@ Backend configuration for beancount ; '((company-beancount company-dabbrev) company-capf company-files)) (company-mode t) ) -#+end_src +#+END_SRC *** Misc Company packages @@ -1146,7 +1146,7 @@ Addon to sort suggestions by usage :config (company-statistics-mode 1) ) -#+end_src +#+END_SRC Get a popup with documentation of the completion candidate. For the popups the package pos-tip.el is used and automatically installed. @@ -1160,13 +1160,13 @@ For the popups the package pos-tip.el is used and automatically installed. :config (company-quickhelp-mode 1) ) -#+end_src +#+END_SRC Maybe add [[https://github.com/hlissner/emacs-company-dict][company-dict]]? It's a dictionary based on major modes, plus it has Yasnippet integration. ** Flycheck Show errors right away! - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package flycheck :ensure t :diminish flycheck-mode " ✓" @@ -1177,12 +1177,12 @@ Maybe add [[https://github.com/hlissner/emacs-company-dict][company-dict]]? It's ; (semantic-mode 1) ; (flycheck-select-checker 'python-pylint))) ) -#+end_src +#+END_SRC ** Projectile Brings search functions on project level - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package projectile :ensure t :defer t @@ -1200,12 +1200,13 @@ Maybe add [[https://github.com/hlissner/emacs-company-dict][company-dict]]? It's projectile-enable-caching t projectile-mode-line '(:eval (projectile-project-name))) ) - #+end_src +#+END_SRC + ** Yasnippet Snippets! TODO: yas-minor-mode? what's that? - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package yasnippet :ensure t :diminish yas-minor-mode @@ -1216,12 +1217,12 @@ Maybe add [[https://github.com/hlissner/emacs-company-dict][company-dict]]? It's ; :config ; (yas-reload-all) ;; ensure snippets are updated and available, necessary when not using global-mode ) - #+end_src +#+END_SRC ** Lisp #+BEGIN_SRC emacs-lisp (add-hook 'emacs-lisp-mode-hook 'company/elisp-mode-hook) -#+end_src +#+END_SRC Add some helpers to handle and understand macros #+BEGIN_SRC emacs-lisp @@ -1230,7 +1231,7 @@ Add some helpers to handle and understand macros :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)) -#+end_src +#+END_SRC ** Python Systemwide following packages need to be installed: @@ -1248,7 +1249,7 @@ Add some helpers to handle and understand macros Also limit the completion backends to those which make sense in Python. - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package python :mode ("\\.py\\'" . python-mode) :interpreter ("python" . python-mode) @@ -1260,7 +1261,7 @@ Add some helpers to handle and understand macros :config (setq python-shell-completion-native-enable nil) ) - #+end_src +#+END_SRC Jedi is a backend for python autocompletion and needs to be installed on the server: @@ -1281,7 +1282,7 @@ Code checks need to be installed, too: (setq jedi:use-shortcuts t) ;; (add-hook 'python-mode-hook 'company/python-mode-hook) ) -#+end_src +#+END_SRC 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. @@ -1315,7 +1316,7 @@ TODO: automatically start an inferior python process or switch to it if already ;; (setq flycheck-checker 'python-flake8) (add-hook 'pyvenv-post-activate-hooks 'my/post-activate-hook) ) -#+end_src +#+END_SRC I want Emacs to automatically start the proper virtual environment. @@ -1336,7 +1337,7 @@ Depends on pyvenv ;; activate on focus in ;; (add-hook 'focus-in-hook 'auto-virtualenv-set-virtualenv) ) -#+end_src +#+END_SRC Anaconda test @@ -1369,7 +1370,7 @@ end_src - Latex - pdf-tools - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (unless (string-equal user-login-name "POH") (use-package pdf-tools :ensure t @@ -1379,18 +1380,18 @@ end_src (setq TeX-view-program-list '(("pdf-tools" "Tex-pdf-tools-sync-view"))) ) ) - #+end_src +#+END_SRC 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]] Update 2018-03: It seems to work without this patch. I will keep it here in case something breaks again. - #+BEGIN_SRC +#+BEGIN_SRC latex-preview-pane-update-p() --- (doc-view-revert-buffer nil t) +++ (revert-buffer-nil t 'preserve-modes) - #+end_src +#+END_SRC After that M-x byte-compile-file - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package latex-preview-pane :ensure t ) @@ -1402,19 +1403,19 @@ end_src ;; necessary, because linum-mode isn't compatible and prints errors (add-hook 'pdf-view-mode-hook (lambda () (linum-mode -1))) - #+end_src +#+END_SRC ** Markdown Major mode to edit markdown files. For previews it needs markdown installed on the system. For debian: - #+BEGIN_SRC shell +#+BEGIN_SRC shell sudo apt install markdown - #+END_SRC +#+END_SRC - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (use-package markdown-mode :ensure t) - #+END_SRC +#+END_SRC ** Hydra Flycheck Flycheck is necessary, obviously @@ -1441,7 +1442,7 @@ _v_ verify setup _f_ check _s_ select ("s" flycheck-select-checker) ("v" flycheck-verify-setup) ) -#+end_src +#+END_SRC