From 01f9e698bd904897a8945f026fbb87368e404e2d Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Tue, 12 Dec 2017 17:19:08 +0100 Subject: emacs: updated custome.el file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- emacs/custom.el | 2 +- emacs/init.html | 2220 +++++++++++++++++++++++++++---------------------------- 2 files changed, 1111 insertions(+), 1111 deletions(-) diff --git a/emacs/custom.el b/emacs/custom.el index 39a56ae..fa1ed6c 100644 --- a/emacs/custom.el +++ b/emacs/custom.el @@ -15,7 +15,7 @@ '(markdown-command "/usr/bin/markdown-calibre") '(package-selected-packages (quote - (bats-mode bool-flip salt-mode flycheck-rust rust-playground rust-mode vue-mode coffee-mode json-reformat erc-hl-nicks emoji-cheat-sheet-plus helm-circe htmlize cmake-mode websocket markdown-mode go-mode magit evil-leader evil helm projectile writeroom-mode org-eldoc evil-commentary yasnippet yaml-mode which-key web-mode wc-mode use-package terraform-mode smart-tabs-mode slim-mode scss-mode rainbow-delimiters php-mode org-evil olivetti mu4e-alert mmm-jinja2 markdown-preview-mode helm-projectile helm-ag go-eldoc go-add-tags flycheck expand-region evil-surround evil-org evil-numbers evil-mu4e evil-magit evil-args dockerfile-mode disable-mouse default-text-scale crux cmake-font-lock ag)))) + (diminish bats-mode bool-flip salt-mode flycheck-rust rust-playground rust-mode vue-mode coffee-mode json-reformat erc-hl-nicks emoji-cheat-sheet-plus helm-circe htmlize cmake-mode websocket markdown-mode go-mode magit evil-leader evil helm projectile writeroom-mode org-eldoc evil-commentary yasnippet yaml-mode which-key web-mode wc-mode use-package terraform-mode smart-tabs-mode slim-mode scss-mode rainbow-delimiters php-mode org-evil olivetti mu4e-alert mmm-jinja2 markdown-preview-mode helm-projectile helm-ag go-eldoc go-add-tags flycheck expand-region evil-surround evil-org evil-numbers evil-mu4e evil-magit evil-args dockerfile-mode disable-mouse default-text-scale crux cmake-font-lock ag)))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. diff --git a/emacs/init.html b/emacs/init.html index dd2beb4..785557b 100644 --- a/emacs/init.html +++ b/emacs/init.html @@ -4,7 +4,7 @@ mssola's GNU Emacs configuration - + @@ -144,71 +144,71 @@ for the JavaScript code in this tag.

Table of Contents

-

1 Preface

+

Preface

This is my attempt of getting my configuration organized with literate @@ -221,23 +221,23 @@ file always. The initial contents of the init.el are:

-
;; We can't tangle without org!
-(require 'org)
+
;; We can't tangle without org!
+(require 'org)
 
-;; Follow symlinks
-(setq vc-follow-symlinks t)
+;; Follow symlinks
+(setq vc-follow-symlinks t)
 
-;; Open the configuration
-(find-file (concat user-emacs-directory "init.org"))
+;; Open the configuration
+(find-file (concat user-emacs-directory "init.org"))
 
-;; Tangle it
-(org-babel-tangle)
+;; Tangle it
+(org-babel-tangle)
 
-;; Load it
-(load-file (concat user-emacs-directory "init.el"))
+;; Load it
+(load-file (concat user-emacs-directory "init.el"))
 
-;; Finally byte-compile it
-(byte-compile-file (concat user-emacs-directory "init.el"))
+;; Finally byte-compile it
+(byte-compile-file (concat user-emacs-directory "init.el"))
 
@@ -260,28 +260,28 @@ on each change, the following function is provided:
-
(defun tangle-init ()
-  "If the current buffer is 'init.org' the code-blocks are
-  tangled, and the tangled file is compiled. Morever, an init.html is generated."
+
(defun tangle-init ()
+  "If the current buffer is 'init.org' the code-blocks are
+  tangled, and the tangled file is compiled. Morever, an init.html is generated."
 
-  (when (or (equal (buffer-file-name)
-                   (expand-file-name (concat user-emacs-directory "init.org")))
-            (string-suffix-p "dotfiles/emacs/init.org" (buffer-file-name)))
+  (when (or (equal (buffer-file-name)
+                   (expand-file-name (concat user-emacs-directory "init.org")))
+            (string-suffix-p "dotfiles/emacs/init.org" (buffer-file-name)))
 
-    ;; Avoid running hooks when tangling
-    (let ((prog-mode-hook nil))
-      (org-babel-tangle)
-      (org-html-export-to-html)
-      (byte-compile-file (concat user-emacs-directory "init.el")))))
+    ;; Avoid running hooks when tangling
+    (let ((prog-mode-hook nil))
+      (org-babel-tangle)
+      (org-html-export-to-html)
+      (byte-compile-file (concat user-emacs-directory "init.el")))))
 
-(add-hook 'after-save-hook 'tangle-init)
+(add-hook 'after-save-hook 'tangle-init)
 
-

2 Introduction

+

Introduction

I'm using GNU Emacs 25, but everything should be working in GNU Emacs 24. There @@ -291,8 +291,8 @@ individually handled.

-
(unless (>= emacs-major-version 24)
-  (error "Don't be a cheap bastard and upgrade to at least GNU Emacs 24"))
+
(unless (>= emacs-major-version 24)
+  (error "Don't be a cheap bastard and upgrade to at least GNU Emacs 24"))
 
@@ -303,11 +303,11 @@ Temporarily reduce garbage collection so startup time is lower. Idea taken from
-
(defconst mssola-initial-gc-cons-threshold gc-cons-threshold
-  "Initial value of `gc-cons-threshold' at start-up time.")
-(setq gc-cons-threshold (* 1024 1024 1024))
-(add-hook 'after-init-hook
-          (lambda () (setq gc-cons-threshold mssola-initial-gc-cons-threshold)))
+
(defconst mssola-initial-gc-cons-threshold gc-cons-threshold
+  "Initial value of `gc-cons-threshold' at start-up time.")
+(setq gc-cons-threshold (* 1024 1024 1024))
+(add-hook 'after-init-hook
+          (lambda () (setq gc-cons-threshold mssola-initial-gc-cons-threshold)))
 
@@ -317,18 +317,18 @@ User name and email.
-
(setq user-full-name "Miquel Sabaté Solà"
-      user-mail-address "mikisabate@gmail.com")
+
(setq user-full-name "Miquel Sabaté Solà"
+      user-mail-address "mikisabate@gmail.com")
 
-

3 General

+

General

-

3.1 GUI

+

GUI

I like a minimalistic GUI. Because of this, almost all GUI elements have been @@ -342,12 +342,12 @@ name of the buffer is displayed (e.g. "mssola: scratch").

-
(setq frame-title-format
-  '((:eval
-    (concat (user-real-login-name) ": "
-      (if (buffer-file-name)
-        (abbreviate-file-name (buffer-file-name))
-        "%b")))))
+
(setq frame-title-format
+  '((:eval
+    (concat (user-real-login-name) ": "
+      (if (buffer-file-name)
+        (abbreviate-file-name (buffer-file-name))
+        "%b")))))
 
@@ -358,28 +358,28 @@ modes.
-
(menu-bar-mode -1)
-(when (fboundp 'set-scroll-bar-mode)
-  (set-scroll-bar-mode nil))
-(when (fboundp 'tool-bar-mode)
-  (tool-bar-mode -1))
-(when (fboundp 'tooltip-mode)
-  (tooltip-mode 0))
+
(menu-bar-mode -1)
+(when (fboundp 'set-scroll-bar-mode)
+  (set-scroll-bar-mode nil))
+(when (fboundp 'tool-bar-mode)
+  (tool-bar-mode -1))
+(when (fboundp 'tooltip-mode)
+  (tooltip-mode 0))
 
-(line-number-mode 1)
-(column-number-mode 1)
+(line-number-mode 1)
+(column-number-mode 1)
 
-;; Nice scrolling
-(setq scroll-margin 0
+;; Nice scrolling
+(setq scroll-margin 0
       scroll-conservatively 100000
-      scroll-preserve-screen-position 1)
+      scroll-preserve-screen-position 1)
 
-

3.2 Basic editing configuration

+

Basic editing configuration

Use UTF-8 always. @@ -387,11 +387,11 @@ Use UTF-8 always.

-
(prefer-coding-system 'utf-8)
-(set-default-coding-systems 'utf-8)
-(set-terminal-coding-system 'utf-8)
-(set-keyboard-coding-system 'utf-8)
-(set-language-environment 'utf-8)
+
(prefer-coding-system 'utf-8)
+(set-default-coding-systems 'utf-8)
+(set-terminal-coding-system 'utf-8)
+(set-keyboard-coding-system 'utf-8)
+(set-language-environment 'utf-8)
 
@@ -401,39 +401,39 @@ Some editing tweaks like tabs vs spaces, maximum column width, etc.
-
;; Emacs modes typically provide a standard means to change the indentation
-;; width (e.g. c-basic-offset). Moreover, even though I prefer tabs over space,
-;; for most coding conventions this is not the case (e.g. ruby). For this
-;; reason, I will disable them by default and enabled them back for each
-;; specific case (e.g. C). I'm also using the smart-tabs-mode package, see
-;; below in the languages section.
-(setq-default indent-tabs-mode nil)
-(setq-default tab-width 4)
+
;; Emacs modes typically provide a standard means to change the indentation
+;; width (e.g. c-basic-offset). Moreover, even though I prefer tabs over space,
+;; for most coding conventions this is not the case (e.g. ruby). For this
+;; reason, I will disable them by default and enabled them back for each
+;; specific case (e.g. C). I'm also using the smart-tabs-mode package, see
+;; below in the languages section.
+(setq-default indent-tabs-mode nil)
+(setq-default tab-width 4)
 
-;; Maximum 80 columns.
-(setq-default fill-column 80)
-(setq-default auto-fill-function 'do-auto-fill)
+;; Maximum 80 columns.
+(setq-default fill-column 80)
+(setq-default auto-fill-function 'do-auto-fill)
 
-;; Do not break lines
-(set-default 'truncate-lines t)
+;; Do not break lines
+(set-default 'truncate-lines t)
 
-;; Delete the selection with a keypress.
-(delete-selection-mode t)
+;; Delete the selection with a keypress.
+(delete-selection-mode t)
 
-;; Remove whitespaces at the end of line
-(add-hook 'before-save-hook 'delete-trailing-whitespace)
+;; Remove whitespaces at the end of line
+(add-hook 'before-save-hook 'delete-trailing-whitespace)
 
-;; Cursor
-(blink-cursor-mode 0)
-(global-hl-line-mode -1)
-(show-paren-mode 1)
+;; Cursor
+(blink-cursor-mode 0)
+(global-hl-line-mode -1)
+(show-paren-mode 1)
 
-

3.3 Font and theme

+

Font and theme

I'm using "Droid Sans Mono" simply because I've grown used to it. @@ -441,17 +441,17 @@ I'm using "Droid Sans Mono" simply because I've grown used to it.

-
(set-frame-font "Droid Sans Mono Dotted for Powerline-10")
-(add-to-list 'default-frame-alist '(font . "Droid Sans Mono Dotted for Powerline-10"))
+
(set-frame-font "Droid Sans Mono Dotted for Powerline-10")
+(add-to-list 'default-frame-alist '(font . "Droid Sans Mono Dotted for Powerline-10"))
 
-; Emacs in daemon mode does not like `set-face-attribute` because this is only
-; applied if there is a frame in place, which doesn't happen when starting the
-; daemon. Thus, we should call that after the frame has been created (e.g. by
-; emacsclient).
-; See: https://lists.gnu.org/archive/html/help-gnu-emacs/2015-03/msg00016.html
-(add-hook 'after-make-frame-functions-hook
-  (lambda ()
-    (set-face-attribute 'default t :font "Droid Sans Mono Dotted for Powerline-10")))
+; Emacs in daemon mode does not like `set-face-attribute` because this is only
+; applied if there is a frame in place, which doesn't happen when starting the
+; daemon. Thus, we should call that after the frame has been created (e.g. by
+; emacsclient).
+; See: https://lists.gnu.org/archive/html/help-gnu-emacs/2015-03/msg00016.html
+(add-hook 'after-make-frame-functions-hook
+  (lambda ()
+    (set-face-attribute 'default t :font "Droid Sans Mono Dotted for Powerline-10")))
 
@@ -462,7 +462,7 @@ I've hacked my own theme called soria<
-
(load-theme 'soria t)
+
(load-theme 'soria t)
 
@@ -474,24 +474,24 @@ get exactly that:
-
(defun mssola-face-at-point (pos)
-  "Writes a message with the name of the face at the current point.  The POS
-  argument contains the current position of the cursor."
+
(defun mssola-face-at-point (pos)
+  "Writes a message with the name of the face at the current point.  The POS
+  argument contains the current position of the cursor."
 
-  (interactive "d")
+  (interactive "d")
 
-  (let ((face (or (get-char-property (point) 'read-face-name)
-                  (get-char-property (point) 'face))))
-    (if face (message "Face: %s" face) (message "No face at %d" pos))))
+  (let ((face (or (get-char-property (point) 'read-face-name)
+                  (get-char-property (point) 'face))))
+    (if face (message "Face: %s" face) (message "No face at %d" pos))))
 
-(global-set-key (kbd "C-c f") 'mssola-face-at-point)
+(global-set-key (kbd "C-c f") 'mssola-face-at-point)
 
-

3.4 General global key bindings

+

General global key bindings

Use kill-this-buffer instead of kill-buffer. @@ -499,7 +499,7 @@ Use kill-this-buffer instead of kill-buffer.

-
(global-set-key (kbd "C-x k") 'kill-this-buffer)
+
(global-set-key (kbd "C-x k") 'kill-this-buffer)
 
@@ -511,7 +511,7 @@ cannot be loaded due to some error.
-
(global-unset-key (kbd "C-z"))
+
(global-unset-key (kbd "C-z"))
 
@@ -521,8 +521,8 @@ Disable all the Fn keys.
-
(dotimes (i 12)
-  (global-unset-key (kbd (format "<f%d>" (+ i 1)))))
+
(dotimes (i 12)
+  (global-unset-key (kbd (format "<f%d>" (+ i 1)))))
 
@@ -532,14 +532,14 @@ Disable overwrite-mode.
-
(define-key global-map [(insert)] nil)
+
(define-key global-map [(insert)] nil)
 
-

3.5 Others

+

Others

Revert buffers automatically when underlying files are changed externally. @@ -547,7 +547,7 @@ Revert buffers automatically when underlying files are changed externally.

-
(global-auto-revert-mode t)
+
(global-auto-revert-mode t)
 
@@ -557,7 +557,7 @@ Follow symlinks.
-
(setq vc-follow-symlinks t)
+
(setq vc-follow-symlinks t)
 
@@ -567,7 +567,7 @@ Remove the initial message from the scratch buffer.
-
(setq initial-scratch-message nil)
+
(setq initial-scratch-message nil)
 
@@ -577,17 +577,17 @@ Never kill the scratch buffer, bury it instead.
-
(defadvice kill-buffer (around kill-buffer-around-advice activate)
-  (let ((buffer-to-kill (ad-get-arg 0)))
-    (if (equal buffer-to-kill "*scratch*")
-        (bury-buffer)
-      ad-do-it)))
+
(defadvice kill-buffer (around kill-buffer-around-advice activate)
+  (let ((buffer-to-kill (ad-get-arg 0)))
+    (if (equal buffer-to-kill "*scratch*")
+        (bury-buffer)
+      ad-do-it)))
 
-(defadvice kill-this-buffer (around kill-buffer-around-advice activate)
-  (let ((buffer-to-kill (ad-get-arg 0)))
-    (if (equal buffer-to-kill "*scratch*")
-        (bury-buffer)
-      ad-do-it)))
+(defadvice kill-this-buffer (around kill-buffer-around-advice activate)
+  (let ((buffer-to-kill (ad-get-arg 0)))
+    (if (equal buffer-to-kill "*scratch*")
+        (bury-buffer)
+      ad-do-it)))
 
@@ -597,8 +597,8 @@ No backups
-
(setq-default make-backup-files nil)
-(setq-default auto-save-default nil)
+
(setq-default make-backup-files nil)
+(setq-default auto-save-default nil)
 
@@ -608,13 +608,13 @@ But at least save the list of recently open files.
-
(require 'recentf)
+
(require 'recentf)
 
-(recentf-mode 1)
-(global-set-key "\C-x\ \C-r" 'recentf-open-files)
+(recentf-mode 1)
+(global-set-key "\C-x\ \C-r" 'recentf-open-files)
 
-; Save the list every 5 minutes
-(run-at-time nil (* 5 60) 'recentf-save-list)
+; Save the list every 5 minutes
+(run-at-time nil (* 5 60) 'recentf-save-list)
 
@@ -624,7 +624,7 @@ No welcome screen
-
(setq-default inhibit-startup-message t)
+
(setq-default inhibit-startup-message t)
 
@@ -634,7 +634,7 @@ Enable y/n answers
-
(fset 'yes-or-no-p 'y-or-n-p)
+
(fset 'yes-or-no-p 'y-or-n-p)
 
@@ -644,7 +644,7 @@ Let flyspell be performant.
-
(defvar flyspell-issue-message-flag nil)
+
(defvar flyspell-issue-message-flag nil)
 
@@ -654,9 +654,9 @@ Save custom-variables somewhere else.
-
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
-(if (file-exists-p custom-file)
-    (load custom-file))
+
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
+(if (file-exists-p custom-file)
+    (load custom-file))
 
@@ -664,7 +664,7 @@ Save custom-variables somewhere else.
-

4 Calendar

+

Calendar

We catalans start our weeks on Monday. @@ -672,7 +672,7 @@ We catalans start our weeks on Monday.

-
(defvar calendar-week-start-day 1)
+
(defvar calendar-week-start-day 1)
 
@@ -682,7 +682,7 @@ Global key binding.
-
(global-set-key (kbd "M-c") 'calendar)
+
(global-set-key (kbd "M-c") 'calendar)
 
@@ -692,29 +692,29 @@ Fix some stuff for evil mode.
-
(with-eval-after-load "evil"
-  (evil-set-initial-state 'calendar-mode 'normal)
-  (evil-define-key 'normal calendar-mode-map
-    "j" 'calendar-forward-week
-    "k" 'calendar-backward-week
-    "b" 'calendar-backward-day
-    "h" 'calendar-backward-day
-    "l" 'calendar-forward-day
-    "w" 'calendar-forward-day
-    "q" 'calendar-exit
-    "\C-h" 'evil-window-left
-    "\C-l" 'evil-window-right
-    "\C-j" 'evil-window-down
-    "\C-k" 'evil-window-up
-    "\C-n" 'calendar-scroll-left-three-months
-    "\C-p" 'calendar-scroll-right-three-months))
+
(with-eval-after-load "evil"
+  (evil-set-initial-state 'calendar-mode 'normal)
+  (evil-define-key 'normal calendar-mode-map
+    "j" 'calendar-forward-week
+    "k" 'calendar-backward-week
+    "b" 'calendar-backward-day
+    "h" 'calendar-backward-day
+    "l" 'calendar-forward-day
+    "w" 'calendar-forward-day
+    "q" 'calendar-exit
+    "\C-h" 'evil-window-left
+    "\C-l" 'evil-window-right
+    "\C-j" 'evil-window-down
+    "\C-k" 'evil-window-up
+    "\C-n" 'calendar-scroll-left-three-months
+    "\C-p" 'calendar-scroll-right-three-months))
 
-

5 General purpose defuns

+

General purpose defuns

I want to read the latest news. That's why I define a function that downloads @@ -723,15 +723,15 @@ the NEWS file from the git server and then opens it in a buffer.

-
(defun mssola-view-emacs-latest-news ()
-  "Allow users to fetch the latest Emacs' NEWS file."
-  (interactive)
+
(defun mssola-view-emacs-latest-news ()
+  "Allow users to fetch the latest Emacs' NEWS file."
+  (interactive)
 
-  (url-copy-file
-   "http://git.savannah.gnu.org/cgit/emacs.git/plain/etc/NEWS"
-   "/tmp/emacs-news" t)
+  (url-copy-file
+   "http://git.savannah.gnu.org/cgit/emacs.git/plain/etc/NEWS"
+   "/tmp/emacs-news" t)
 
-  (find-file-read-only "/tmp/emacs-news" t))
+  (find-file-read-only "/tmp/emacs-news" t))
 
@@ -741,24 +741,24 @@ Sometimes I want to debug my initialization time.
-
(defun emacs-init-time ()
-  "Redefine the `emacs-init-time' function so it is more detailed.
-Idea taken from @purcell."
+
(defun emacs-init-time ()
+  "Redefine the `emacs-init-time' function so it is more detailed.
+Idea taken from @purcell."
 
-  (interactive)
-  (let ((init-time
-         (float-time (time-subtract after-init-time before-init-time))))
-    (message "%.3fs" init-time)))
+  (interactive)
+  (let ((init-time
+         (float-time (time-subtract after-init-time before-init-time))))
+    (message "%.3fs" init-time)))
 
-

6 Lisp packages

+

Lisp packages

-

6.1 Custom packages

+

Custom packages

Compile the g.el script and bind it to M-g. @@ -766,15 +766,15 @@ Compile the g.el script and bind it to M-g.

-
(byte-compile-file (concat user-emacs-directory "lisp/g.el") t)
-(global-set-key (kbd "M-g") 'g)
+
(byte-compile-file (concat user-emacs-directory "lisp/g.el") t)
+(global-set-key (kbd "M-g") 'g)
 
-

6.2 use-package

+

use-package

Initialize package. @@ -782,14 +782,14 @@ Initialize package.

-
(require 'package)
+
(require 'package)
 
-(add-to-list 'package-archives
-             '("melpa" . "http://melpa.milkbox.net/packages/") t)
-(add-to-list 'package-archives
-             '("melpa-stable" . "https://stable.melpa.org/packages/") t)
+(add-to-list 'package-archives
+             '("melpa" . "http://melpa.milkbox.net/packages/") t)
+(add-to-list 'package-archives
+             '("melpa-stable" . "https://stable.melpa.org/packages/") t)
 
-(package-initialize)
+(package-initialize)
 
@@ -802,9 +802,9 @@ package-install, I decided on use-package because I feel more well-organized.
-
(unless (package-installed-p 'use-package)
-  (package-refresh-contents)
-  (package-install 'use-package))
+
(unless (package-installed-p 'use-package)
+  (package-refresh-contents)
+  (package-install 'use-package))
 
@@ -815,8 +815,8 @@ require it here on the very top.
-
(use-package diminish
-  :ensure t)
+
(use-package diminish
+  :ensure t)
 
@@ -824,7 +824,7 @@ require it here on the very top.
-

7 Project

+

Project

First of all, load the silver searcher, which is a convenient and fast searcher. @@ -833,19 +833,19 @@ Ayo silver!

-
(use-package ag
-  :ensure t
-  :config
+
(use-package ag
+  :ensure t
+  :config
 
-  ; Avoid some disagreements between ag and evil.
-  (with-eval-after-load 'evil
-    (add-hook 'ag-mode-hook
-              (lambda ()
-                (define-key ag-mode-map (kbd "n") 'evil-search-next)
-                (define-key ag-mode-map (kbd "N") 'evil-search-previous)
-                (define-key ag-mode-map (kbd "gg") 'evil-goto-first-line))))
-  (setq ag-reuse-buffers t)
-  (setq ag-reuse-window t))
+  ; Avoid some disagreements between ag and evil.
+  (with-eval-after-load 'evil
+    (add-hook 'ag-mode-hook
+              (lambda ()
+                (define-key ag-mode-map (kbd "n") 'evil-search-next)
+                (define-key ag-mode-map (kbd "N") 'evil-search-previous)
+                (define-key ag-mode-map (kbd "gg") 'evil-goto-first-line))))
+  (setq ag-reuse-buffers t)
+  (setq ag-reuse-window t))
 
@@ -855,57 +855,57 @@ Then, for keeping up with my projects I use the Projectile + Helm combination.
-
(use-package projectile
-  :ensure t
-  :config
-  (projectile-mode 1))
+
(use-package projectile
+  :ensure t
+  :config
+  (projectile-mode 1))
 
-(use-package helm
-  :ensure t
-  :config
-  (setq projectile-completion-system 'helm)
+(use-package helm
+  :ensure t
+  :config
+  (setq projectile-completion-system 'helm)
 
-  ; Allow the search pattern to be on the header. Taken from this Reddit thread:
-  ; https://www.reddit.com/r/emacs/comments/3asbyn/new_and_very_useful_helm_feature_enter_search/
-  (setq helm-echo-input-in-header-line t)
+  ; Allow the search pattern to be on the header. Taken from this Reddit thread:
+  ; https://www.reddit.com/r/emacs/comments/3asbyn/new_and_very_useful_helm_feature_enter_search/
+  (setq helm-echo-input-in-header-line t)
 
-  (defun helm-hide-minibuffer-maybe ()
-    "Hide the minibuffer if we are in a Helm session"
+  (defun helm-hide-minibuffer-maybe ()
+    "Hide the minibuffer if we are in a Helm session"
 
-    (when (with-helm-buffer helm-echo-input-in-header-line)
-      (let ((ov (make-overlay (point-min) (point-max) nil nil t)))
-        (overlay-put ov 'window (selected-window))
-        (overlay-put ov 'face (let ((bg-color (face-background 'default nil)))
-                                `(:background ,bg-color :foreground ,bg-color)))
-        (setq-local cursor-type nil))))
+    (when (with-helm-buffer helm-echo-input-in-header-line)
+      (let ((ov (make-overlay (point-min) (point-max) nil nil t)))
+        (overlay-put ov 'window (selected-window))
+        (overlay-put ov 'face (let ((bg-color (face-background 'default nil)))
+                                `(:background ,bg-color :foreground ,bg-color)))
+        (setq-local cursor-type nil))))
 
-  (add-hook 'helm-minibuffer-set-up-hook 'helm-hide-minibuffer-maybe)
-  (setq helm-split-window-inside-p t)
+  (add-hook 'helm-minibuffer-set-up-hook 'helm-hide-minibuffer-maybe)
+  (setq helm-split-window-inside-p t)
 
-  ; Preview files with tab
-  (define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action)
+  ; Preview files with tab
+  (define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action)
 
-  ; Show available options
-  (define-key helm-map (kbd "C-a")  'helm-select-action)
+  ; Show available options
+  (define-key helm-map (kbd "C-a")  'helm-select-action)
 
-  ; Some vim-like bindings
-  (define-key helm-map (kbd "C-j") 'helm-next-line)
-  (define-key helm-map (kbd "C-k") 'helm-previous-line)
+  ; Some vim-like bindings
+  (define-key helm-map (kbd "C-j") 'helm-next-line)
+  (define-key helm-map (kbd "C-k") 'helm-previous-line)
 
-  (global-set-key (kbd "M-x") 'helm-M-x)
+  (global-set-key (kbd "M-x") 'helm-M-x)
 
-  (use-package helm-ag
-    :ensure t))
+  (use-package helm-ag
+    :ensure t))
 
-(use-package helm-projectile
-  :ensure t
-  :config
-  (helm-projectile-on)
+(use-package helm-projectile
+  :ensure t
+  :config
+  (helm-projectile-on)
 
-  ; Define M-p as a way to quickly list all the available projects.
-  (with-eval-after-load 'evil
-    (define-key evil-normal-state-map (kbd "M-p")
-      'helm-projectile-switch-project)))
+  ; Define M-p as a way to quickly list all the available projects.
+  (with-eval-after-load 'evil
+    (define-key evil-normal-state-map (kbd "M-p")
+      'helm-projectile-switch-project)))
 
@@ -918,37 +918,37 @@ buffers.
-
(defun mssola-erc-helm-buffer-list ()
-  "Returns a list with the ERC buffers."
-  (mapcar 'buffer-name (erc-buffer-list)))
+
(defun mssola-erc-helm-buffer-list ()
+  "Returns a list with the ERC buffers."
+  (mapcar 'buffer-name (erc-buffer-list)))
 
-(defconst mssola-helm-source-erc-channel-list
-      '((name . "ERC Channels")
-        (candidates . mssola-erc-helm-buffer-list)
-        (action . switch-to-buffer)))
+(defconst mssola-helm-source-erc-channel-list
+      '((name . "ERC Channels")
+        (candidates . mssola-erc-helm-buffer-list)
+        (action . switch-to-buffer)))
 
-(defun mssola-erc-helm-switch-buffer ()
-  "Use helm to select an active ERC buffer."
+(defun mssola-erc-helm-switch-buffer ()
+  "Use helm to select an active ERC buffer."
 
-  (interactive)
+  (interactive)
 
-  (helm :sources '(mssola-helm-source-erc-channel-list)
-        :buffer "*helm-erc-channels*"))
+  (helm :sources '(mssola-helm-source-erc-channel-list)
+        :buffer "*helm-erc-channels*"))
 
-(defun mssola-find-file ()
-  "Call the proper Helm function for finding files."
+(defun mssola-find-file ()
+  "Call the proper Helm function for finding files."
 
-  (interactive)
+  (interactive)
 
-  (if (string= major-mode "erc-mode")
-      (mssola-erc-helm-switch-buffer)
-    (condition-case nil
-        (helm-projectile-find-file)
-      (error
-       (helm-find-files nil)))))
+  (if (string= major-mode "erc-mode")
+      (mssola-erc-helm-switch-buffer)
+    (condition-case nil
+        (helm-projectile-find-file)
+      (error
+       (helm-find-files nil)))))
 
-(with-eval-after-load 'evil
-  (define-key evil-normal-state-map (kbd "C-p") 'mssola-find-file))
+(with-eval-after-load 'evil
+  (define-key evil-normal-state-map (kbd "C-p") 'mssola-find-file))
 
@@ -959,24 +959,24 @@ binding to ,a a function that calls to the proper function.
-
(defun mssola-helm-ag ()
-  "Call the right ag command for helm-ag."
+
(defun mssola-helm-ag ()
+  "Call the right ag command for helm-ag."
 
-  (interactive)
+  (interactive)
 
-  (condition-case nil
-      (helm-ag-project-root)
-    (error (helm-ag))))
+  (condition-case nil
+      (helm-ag-project-root)
+    (error (helm-ag))))
 
-(with-eval-after-load 'evil-leader
-  (evil-leader/set-key "a" 'mssola-helm-ag))
+(with-eval-after-load 'evil-leader
+  (evil-leader/set-key "a" 'mssola-helm-ag))
 
-

8 Edit

+

Edit

In this section I define some useful packages for editing. First of all, one of @@ -988,18 +988,18 @@ recent versions of GNU Emacs.

-
(with-eval-after-load 'undo-tree
-  (global-undo-tree-mode 1)
+
(with-eval-after-load 'undo-tree
+  (global-undo-tree-mode 1)
 
-  (setq undo-tree-visualizer-diff t
+  (setq undo-tree-visualizer-diff t
         undo-tree-visualizer-timestamps t
-        undo-tree-visualizer-relative-timestamps t)
+        undo-tree-visualizer-relative-timestamps t)
 
-  (diminish 'undo-tree-mode)
+  (diminish 'undo-tree-mode)
 
-  (with-eval-after-load 'evil-leader
-    (evil-leader/set-key
-      "u" 'undo-tree-visualize)))
+  (with-eval-after-load 'evil-leader
+    (evil-leader/set-key
+      "u" 'undo-tree-visualize)))
 
@@ -1010,21 +1010,21 @@ extension. This works with lots of languages with proper glue code.
-
(use-package let-alist
-  :ensure t)
+
(use-package let-alist
+  :ensure t)
 
-(use-package flycheck
-  :ensure t
-  :diminish
-  :config
-  (add-hook 'after-init-hook 'global-flycheck-mode)
+(use-package flycheck
+  :ensure t
+  :diminish
+  :config
+  (add-hook 'after-init-hook 'global-flycheck-mode)
 
-  ;; Only show the errors buffer if it isn't there and if I'm saving the
-  ;; buffer.
-  (setq flycheck-emacs-lisp-load-path 'inherit)
-  (setq flycheck-check-syntax-automatically '(mode-enabled save))
-  (setq flycheck-display-errors-function
-    #'flycheck-display-error-messages-unless-error-list))
+  ;; Only show the errors buffer if it isn't there and if I'm saving the
+  ;; buffer.
+  (setq flycheck-emacs-lisp-load-path 'inherit)
+  (setq flycheck-check-syntax-automatically '(mode-enabled save))
+  (setq flycheck-display-errors-function
+    #'flycheck-display-error-messages-unless-error-list))
 
@@ -1036,11 +1036,11 @@ with your editor, you have to increase/decrease the fonts. I use the
-
(use-package default-text-scale
-  :ensure t
-  :config
-  (global-set-key (kbd "C-+") 'default-text-scale-increase)
-  (global-set-key (kbd "C--") 'default-text-scale-decrease))
+
(use-package default-text-scale
+  :ensure t
+  :config
+  (global-set-key (kbd "C-+") 'default-text-scale-increase)
+  (global-set-key (kbd "C--") 'default-text-scale-decrease))
 
@@ -1053,8 +1053,8 @@ supports it).
-
(use-package rainbow-delimiters
-  :ensure t)
+
(use-package rainbow-delimiters
+  :ensure t)
 
@@ -1064,11 +1064,11 @@ I never use the mouse.
-
(use-package disable-mouse
-  :ensure t
-  :config
-  (global-disable-mouse-mode)
-  (setq global-disable-mouse-mode-lighter ""))
+
(use-package disable-mouse
+  :ensure t
+  :config
+  (global-disable-mouse-mode)
+  (setq global-disable-mouse-mode-lighter ""))
 
@@ -1080,11 +1080,11 @@ commands for the current chord as a list.
-
(use-package which-key
-  :ensure t
-  :diminish which-key-mode
-  :config
-  (which-key-mode))
+
(use-package which-key
+  :ensure t
+  :diminish which-key-mode
+  :config
+  (which-key-mode))
 
@@ -1095,8 +1095,8 @@ this, we have wc-mode.
-
(use-package wc-mode
-  :ensure t)
+
(use-package wc-mode
+  :ensure t)
 
@@ -1107,8 +1107,8 @@ that often, but it's cool to have a distraction-free screen from time to time.
-
(use-package writeroom-mode
-  :ensure t)
+
(use-package writeroom-mode
+  :ensure t)
 
@@ -1120,27 +1120,27 @@ most of my uses, it's convenient to have this tool anyways.
-
(use-package expand-region
-  :ensure t
-  :config
+
(use-package expand-region
+  :ensure t
+  :config
 
-  ; Set C-e as the expand command (mnemonic: expand). This command will
-  ; supercede the evil binding for "move one line", which I never use anyways.
-  (global-set-key (kbd "\C-e") 'er/expand-region)
-  (with-eval-after-load 'evil
-    (define-key evil-normal-state-map (kbd "\C-e") 'er/expand-region)
-    (define-key evil-visual-state-map (kbd "\C-e") 'er/expand-region)))
+  ; Set C-e as the expand command (mnemonic: expand). This command will
+  ; supercede the evil binding for "move one line", which I never use anyways.
+  (global-set-key (kbd "\C-e") 'er/expand-region)
+  (with-eval-after-load 'evil
+    (define-key evil-normal-state-map (kbd "\C-e") 'er/expand-region)
+    (define-key evil-visual-state-map (kbd "\C-e") 'er/expand-region)))
 
-(defun er/add-text-mode-expansions ()
-  "This way we can also expand the region into paragraphs & pages in text mode.
-Directly taken from: https://github.com/magnars/expand-region.el."
+(defun er/add-text-mode-expansions ()
+  "This way we can also expand the region into paragraphs & pages in text mode.
+Directly taken from: https://github.com/magnars/expand-region.el."
 
-  (set (make-local-variable 'er/try-expand-list) (append
+  (set (make-local-variable 'er/try-expand-list) (append
                                                   er/try-expand-list
-                                                  '(mark-paragraph
-                                                    mark-page))))
+                                                  '(mark-paragraph
+                                                    mark-page))))
 
-(add-hook 'text-mode-hook 'er/add-text-mode-expansions)
+(add-hook 'text-mode-hook 'er/add-text-mode-expansions)
 
@@ -1154,12 +1154,12 @@ this same file as root:
-
(defadvice find-file (after find-file-sudo activate)
-  "Find file as root if necessary."
-  (if (and buffer-file-name
-           (not (file-writable-p buffer-file-name)))
-    (if (yes-or-no-p "Do you want to edit this file as root?")
-        (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))))
+
(defadvice find-file (after find-file-sudo activate)
+  "Find file as root if necessary."
+  (if (and buffer-file-name
+           (not (file-writable-p buffer-file-name)))
+    (if (yes-or-no-p "Do you want to edit this file as root?")
+        (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))))
 
@@ -1172,14 +1172,14 @@ remember some of these snippets, I've mapped , h to
-
(use-package yasnippet
-  :ensure t
-  :diminish yas-minor-mode
-  :init (yas-global-mode)
-  :config
-  (yas-global-mode 1)
-  (with-eval-after-load 'evil-leader
-    (evil-leader/set-key "h" 'yas-describe-tables)))
+
(use-package yasnippet
+  :ensure t
+  :diminish yas-minor-mode
+  :init (yas-global-mode)
+  :config
+  (yas-global-mode 1)
+  (with-eval-after-load 'evil-leader
+    (evil-leader/set-key "h" 'yas-describe-tables)))
 
@@ -1189,17 +1189,17 @@ remember some of these snippets, I've mapped , h to
-
(use-package bool-flip
-  :ensure t
-  :config
-  (global-set-key (kbd "C-c b") 'bool-flip-do-flip))
+
(use-package bool-flip
+  :ensure t
+  :config
+  (global-set-key (kbd "C-c b") 'bool-flip-do-flip))
 
-

9 Dired

+

Dired

I use dired mode mainly for attaching document into emails. That being said, @@ -1208,9 +1208,9 @@ whenever I use it, I want basic evil movement.

-
(with-eval-after-load 'evil
-  (evil-add-hjkl-bindings dired-mode-map 'normal
-    (kbd "w") 'evil-forward-word-begin))
+
(with-eval-after-load 'evil
+  (evil-add-hjkl-bindings dired-mode-map 'normal
+    (kbd "w") 'evil-forward-word-begin))
 
@@ -1220,12 +1220,12 @@ I also extend dired with some handy tweaks.
-
(setq directory-free-space-args "-Pkh"
+
(setq directory-free-space-args "-Pkh"
       dired-dwim-target t
       dired-omit-mode nil
       dired-recursive-copies 'always
       dired-recursive-deletes 'always
-      delete-old-versions t)
+      delete-old-versions t)
 
@@ -1237,31 +1237,31 @@ from the
mu4
-
(require 'gnus-dired)
+
(require 'gnus-dired)
 
-;; Make the `gnus-dired-mail-buffers' function also work on message-mode derived
-;; modes, such as mu4e-compose-mode.
-(defun gnus-dired-mail-buffers ()
-  "Return a list of active message buffers."
+;; Make the `gnus-dired-mail-buffers' function also work on message-mode derived
+;; modes, such as mu4e-compose-mode.
+(defun gnus-dired-mail-buffers ()
+  "Return a list of active message buffers."
 
-  (let (buffers)
-    (save-current-buffer
-      (dolist (buffer (buffer-list t))
-        (set-buffer buffer)
-        (when (and (derived-mode-p 'message-mode)
-                (null message-sent-message-via))
-          (push (buffer-name buffer) buffers))))
-    (nreverse buffers)))
+  (let (buffers)
+    (save-current-buffer
+      (dolist (buffer (buffer-list t))
+        (set-buffer buffer)
+        (when (and (derived-mode-p 'message-mode)
+                (null message-sent-message-via))
+          (push (buffer-name buffer) buffers))))
+    (nreverse buffers)))
 
-(setq gnus-dired-mail-mode 'mu4e-user-agent)
-(add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)
+(setq gnus-dired-mail-mode 'mu4e-user-agent)
+(add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)
 
-

10 Evil

+

Evil

Forgive me, Father, for I have sinned. I've been exposed to modal editing @@ -1277,65 +1277,65 @@ First of all, let's define a function that will be called whenever Evil is loade

-
(defun mssola-evil ()
-  "Configure evil mode."
+
(defun mssola-evil ()
+  "Configure evil mode."
 
-  ; We can safely remap <C-u> because the counting will be handled a-la Vim.
-  (define-key evil-normal-state-map (kbd "C-u") 'evil-scroll-up)
+  ; We can safely remap <C-u> because the counting will be handled a-la Vim.
+  (define-key evil-normal-state-map (kbd "C-u") 'evil-scroll-up)
 
-  ; Make window navigation easier.
-  (define-key evil-normal-state-map (kbd "C-j") 'evil-window-down)
-  (define-key evil-normal-state-map (kbd "C-k") 'evil-window-up)
-  (define-key evil-normal-state-map (kbd "C-l") 'evil-window-right)
-  (define-key evil-normal-state-map (kbd "C-h") 'evil-window-left)
+  ; Make window navigation easier.
+  (define-key evil-normal-state-map (kbd "C-j") 'evil-window-down)
+  (define-key evil-normal-state-map (kbd "C-k") 'evil-window-up)
+  (define-key evil-normal-state-map (kbd "C-l") 'evil-window-right)
+  (define-key evil-normal-state-map (kbd "C-h") 'evil-window-left)
 
-  ; The window navigation tweaks effectively wipe out the help prefix, which
-  ; is bad. Fortunately we can workaround this by providing "M-h" as the new
-  ; help prefix. This prefix is only used in emacs mode to mark lines, which is
-  ; something already handled by Evil.
-  (define-key global-map (kbd "M-h") 'help-command)
-  (fset 'help-command help-map)
+  ; The window navigation tweaks effectively wipe out the help prefix, which
+  ; is bad. Fortunately we can workaround this by providing "M-h" as the new
+  ; help prefix. This prefix is only used in emacs mode to mark lines, which is
+  ; something already handled by Evil.
+  (define-key global-map (kbd "M-h") 'help-command)
+  (fset 'help-command help-map)
 
-  ; I use the Super key in combination with j & k to move around i3. Let's unset
-  ; M- combos for these two fellows for whenever I misstype them.
-  (global-unset-key (kbd "M-j"))
-  (global-unset-key (kbd "M-k"))
+  ; I use the Super key in combination with j & k to move around i3. Let's unset
+  ; M- combos for these two fellows for whenever I misstype them.
+  (global-unset-key (kbd "M-j"))
+  (global-unset-key (kbd "M-k"))
 
-  ; both this function and the subsequent lines about [escape] are taken from
-  ; @aaronbieber configuration.
-  (defun minibuffer-keyboard-quit ()
-    "Abort recursive edit.
-In Delete Selection mode, if the mark is active, just deactivate it;
-then it takes a second \\[keyboard-quit] to abort the minibuffer."
-    (interactive)
-    (if (and delete-selection-mode transient-mark-mode mark-active)
-        (setq deactivate-mark  t)
-      (when (get-buffer "*Completions*") (delete-windows-on "*Completions*"))
-      (abort-recursive-edit)))
+  ; both this function and the subsequent lines about [escape] are taken from
+  ; @aaronbieber configuration.
+  (defun minibuffer-keyboard-quit ()
+    "Abort recursive edit.
+In Delete Selection mode, if the mark is active, just deactivate it;
+then it takes a second \\[keyboard-quit] to abort the minibuffer."
+    (interactive)
+    (if (and delete-selection-mode transient-mark-mode mark-active)
+        (setq deactivate-mark  t)
+      (when (get-buffer "*Completions*") (delete-windows-on "*Completions*"))
+      (abort-recursive-edit)))
 
-  ;; Make escape quit everything, whenever possible.
-  (define-key evil-normal-state-map [escape] 'keyboard-quit)
-  (define-key evil-visual-state-map [escape] 'keyboard-quit)
-  (define-key minibuffer-local-map [escape] 'minibuffer-keyboard-quit)
-  (define-key minibuffer-local-ns-map [escape] 'minibuffer-keyboard-quit)
-  (define-key minibuffer-local-completion-map [escape] 'minibuffer-keyboard-quit)
-  (define-key minibuffer-local-must-match-map [escape] 'minibuffer-keyboard-quit)
-  (define-key minibuffer-local-isearch-map [escape] 'minibuffer-keyboard-quit)
+  ;; Make escape quit everything, whenever possible.
+  (define-key evil-normal-state-map [escape] 'keyboard-quit)
+  (define-key evil-visual-state-map [escape] 'keyboard-quit)
+  (define-key minibuffer-local-map [escape] 'minibuffer-keyboard-quit)
+  (define-key minibuffer-local-ns-map [escape] 'minibuffer-keyboard-quit)
+  (define-key minibuffer-local-completion-map [escape] 'minibuffer-keyboard-quit)
+  (define-key minibuffer-local-must-match-map [escape] 'minibuffer-keyboard-quit)
+  (define-key minibuffer-local-isearch-map [escape] 'minibuffer-keyboard-quit)
 
-  ; I store macros on the <q> register for convenience, so I used to use the
-  ; <C-q> combo to execute this macro in Vim. In Emacs though, this combo is
-  ; reserved to a rather useful function, and I'd like to keep it that way. So,
-  ; now the mapping is set to <C-2> (mnemonic: where the @ symbol is). Moreover,
-  ; it's applied as many times as specified by the numeric prefix argument.
-  (define-key evil-normal-state-map (kbd "C-2")
-    (lambda (n)
-      (interactive "p")
-      (evil-execute-macro n "@q")))
+  ; I store macros on the <q> register for convenience, so I used to use the
+  ; <C-q> combo to execute this macro in Vim. In Emacs though, this combo is
+  ; reserved to a rather useful function, and I'd like to keep it that way. So,
+  ; now the mapping is set to <C-2> (mnemonic: where the @ symbol is). Moreover,
+  ; it's applied as many times as specified by the numeric prefix argument.
+  (define-key evil-normal-state-map (kbd "C-2")
+    (lambda (n)
+      (interactive "p")
+      (evil-execute-macro n "@q")))
 
-  ; C-s: switch to normal mode and save the buffer. I know :)
-  (define-key evil-normal-state-map (kbd "C-s") 'save-buffer)
-  (define-key evil-insert-state-map (kbd "C-s")
-    (lambda () (interactive) (save-buffer) (evil-force-normal-state))))
+  ; C-s: switch to normal mode and save the buffer. I know :)
+  (define-key evil-normal-state-map (kbd "C-s") 'save-buffer)
+  (define-key evil-insert-state-map (kbd "C-s")
+    (lambda () (interactive) (save-buffer) (evil-force-normal-state))))
 
@@ -1345,24 +1345,24 @@ Now make sure that Evil is installed, and call the relevant configuration functi
-
(use-package evil
-  :ensure t
-  :config
+
(use-package evil
+  :ensure t
+  :config
 
-  (add-hook 'evil-mode-hook 'mssola-evil)
-  (evil-mode 1)
+  (add-hook 'evil-mode-hook 'mssola-evil)
+  (evil-mode 1)
 
-  ;; C-z is unused and it's close to my beloved C-c. Since I don't want to mess
-  ;; with one of the most sacred Emacs prefixes, I'm moving to C-z.
-  (define-key key-translation-map (kbd "C-z") [escape])
-  (define-key evil-operator-state-map (kbd "C-z") 'keyboard-quit)
-  (set-quit-char "C-z")
+  ;; C-z is unused and it's close to my beloved C-c. Since I don't want to mess
+  ;; with one of the most sacred Emacs prefixes, I'm moving to C-z.
+  (define-key key-translation-map (kbd "C-z") [escape])
+  (define-key evil-operator-state-map (kbd "C-z") 'keyboard-quit)
+  (set-quit-char "C-z")
 
-  ;; Use the proper initial evil state for the following modes.
-  (evil-set-initial-state 'help-mode 'normal)
-  (evil-set-initial-state 'debugger-mode 'normal)
-  (evil-set-initial-state 'describe-mode 'normal)
-  (evil-set-initial-state 'Buffer-menu-mode 'normal)
+  ;; Use the proper initial evil state for the following modes.
+  (evil-set-initial-state 'help-mode 'normal)
+  (evil-set-initial-state 'debugger-mode 'normal)
+  (evil-set-initial-state 'describe-mode 'normal)
+  (evil-set-initial-state 'Buffer-menu-mode 'normal)
 
@@ -1375,22 +1375,22 @@ Vim into Evil.
-
(use-package evil-leader
-  :ensure t
-  :config
-  (global-evil-leader-mode)
-  (evil-leader/set-leader ",")
-  (setq evil-leader/in-all-states 1)
-  (evil-leader/set-key
-    "," 'back-to-indentation
-    "c" 'delete-window
-    "k" 'kill-buffer-and-window
-    "v" 'split-window-right
-    "V" (lambda () (interactive) (split-window-right) (other-window 1))
-    "f" 'flycheck-list-errors
-    "e" 'eval-last-sexp
-    "b" 'view-buffer
-    "o" 'browse-url-at-point))
+
(use-package evil-leader
+  :ensure t
+  :config
+  (global-evil-leader-mode)
+  (evil-leader/set-leader ",")
+  (setq evil-leader/in-all-states 1)
+  (evil-leader/set-key
+    "," 'back-to-indentation
+    "c" 'delete-window
+    "k" 'kill-buffer-and-window
+    "v" 'split-window-right
+    "V" (lambda () (interactive) (split-window-right) (other-window 1))
+    "f" 'flycheck-list-errors
+    "e" 'eval-last-sexp
+    "b" 'view-buffer
+    "o" 'browse-url-at-point))
 
@@ -1402,10 +1402,10 @@ having double quotes with single quotes in a single command).
-
(use-package evil-surround
-  :ensure t
-  :config
-  (global-evil-surround-mode 1))
+
(use-package evil-surround
+  :ensure t
+  :config
+  (global-evil-surround-mode 1))
 
@@ -1418,10 +1418,10 @@ the current line, regardless of the programming language.
-
(use-package evil-commentary
-  :ensure t
-  :config
-  (evil-commentary-mode t))
+
(use-package evil-commentary
+  :ensure t
+  :config
+  (evil-commentary-mode t))
 
@@ -1434,20 +1434,20 @@ respectively.
-
(use-package evil-args
-  :ensure t
-  :config
-  ; Configuration taken from the documentation of evil-args.
+
(use-package evil-args
+  :ensure t
+  :config
+  ; Configuration taken from the documentation of evil-args.
 
-  ;; Bind evil-args text objects
-  (define-key evil-inner-text-objects-map "a" 'evil-inner-arg)
-  (define-key evil-outer-text-objects-map "a" 'evil-outer-arg)
+  ;; Bind evil-args text objects
+  (define-key evil-inner-text-objects-map "a" 'evil-inner-arg)
+  (define-key evil-outer-text-objects-map "a" 'evil-outer-arg)
 
-  ;; Bind evil-forward/backward-args
-  (define-key evil-normal-state-map "L" 'evil-forward-arg)
-  (define-key evil-normal-state-map "H" 'evil-backward-arg)
-  (define-key evil-motion-state-map "L" 'evil-forward-arg)
-  (define-key evil-motion-state-map "H" 'evil-backward-arg))
+  ;; Bind evil-forward/backward-args
+  (define-key evil-normal-state-map "L" 'evil-forward-arg)
+  (define-key evil-normal-state-map "H" 'evil-backward-arg)
+  (define-key evil-motion-state-map "L" 'evil-forward-arg)
+  (define-key evil-motion-state-map "H" 'evil-backward-arg))
 
@@ -1460,18 +1460,18 @@ into Evil: C-a for increasing a number, and
-
(use-package evil-numbers
-  :ensure t
-  :config
-  (define-key evil-normal-state-map (kbd "C-a") 'evil-numbers/inc-at-pt)
-  (define-key evil-normal-state-map (kbd "C-c -") 'evil-numbers/dec-at-pt)))
+
(use-package evil-numbers
+  :ensure t
+  :config
+  (define-key evil-normal-state-map (kbd "C-a") 'evil-numbers/inc-at-pt)
+  (define-key evil-normal-state-map (kbd "C-c -") 'evil-numbers/dec-at-pt)))
 
-

11 Magit

+

Magit

A git porcelain for GNU Emacs. Even if I'm still using the git CLI, it's @@ -1480,9 +1480,9 @@ certainly useful for some common tasks (I guess that I still need some learning)

-
(use-package magit
-  :ensure t
-  :config
+
(use-package magit
+  :ensure t
+  :config
 
@@ -1493,9 +1493,9 @@ cases, set the proper default mode.
-
(with-eval-after-load 'evil
-  (add-hook 'git-commit-mode-hook 'evil-insert-state)
-  (evil-set-initial-state 'magit-log-edit-mode 'insert))
+
(with-eval-after-load 'evil
+  (add-hook 'git-commit-mode-hook 'evil-insert-state)
+  (evil-set-initial-state 'magit-log-edit-mode 'insert))
 
@@ -1506,11 +1506,11 @@ the rest.
-
(add-hook 'magit-section-set-visibility-hook
-          '(lambda (section)
-             (if (string= (magit-section-type section) "branch")
+
(add-hook 'magit-section-set-visibility-hook
+          '(lambda (section)
+             (if (string= (magit-section-type section) "branch")
                  'hide
-               'show)))
+               'show)))
 
@@ -1520,7 +1520,7 @@ Set a key binding for magit-log-buffer-file.
-
(global-set-key (kbd "C-c l") 'magit-log-buffer-file)
+
(global-set-key (kbd "C-c l") 'magit-log-buffer-file)
 
@@ -1530,27 +1530,27 @@ And repair some key bindings from Evil mode.
-
(with-eval-after-load 'evil-leader
-  (evil-leader/set-key "s" 'magit-status)
+
(with-eval-after-load 'evil-leader
+  (evil-leader/set-key "s" 'magit-status)
 
-  (use-package evil-magit
-    :ensure t
-    :config
+  (use-package evil-magit
+    :ensure t
+    :config
 
-    ; The magit + evil-magit combo messes up some chords, let's fix this.
-    (evil-define-key 'normal magit-mode-map
-      "\C-h" 'evil-window-left
-      "\C-l" 'evil-window-right
-      "\C-j" 'evil-window-down
-      "\C-k" 'evil-window-up
-      "\M-p"  'helm-projectile-switch-project))))
+    ; The magit + evil-magit combo messes up some chords, let's fix this.
+    (evil-define-key 'normal magit-mode-map
+      "\C-h" 'evil-window-left
+      "\C-l" 'evil-window-right
+      "\C-j" 'evil-window-down
+      "\C-k" 'evil-window-up
+      "\M-p"  'helm-projectile-switch-project))))
 
-

12 mu4e

+

mu4e

@@ -1578,9 +1578,9 @@ Diferent SMTP options that will be used for each context.
-
(setq message-send-mail-function 'smtpmail-send-it
-      mu4e-maildir (expand-file-name "~/.mail")
-      starttls-use-gnutls t)
+
(setq message-send-mail-function 'smtpmail-send-it
+      mu4e-maildir (expand-file-name "~/.mail")
+      starttls-use-gnutls t)
 
@@ -1591,35 +1591,35 @@ the configuration.
-
(defun mssola-smtp (server port)
-  "Set SMTP variables depending on the given SERVER and PORT."
+
(defun mssola-smtp (server port)
+  "Set SMTP variables depending on the given SERVER and PORT."
 
-  (require 'smtpmail)
+  (require 'smtpmail)
 
-  (setq smtpmail-starttls-credentials
-        '((server port nil nil))
+  (setq smtpmail-starttls-credentials
+        '((server port nil nil))
         smtpmail-auth-credentials
-        (expand-file-name "~/.authinfo.gpg")
+        (expand-file-name "~/.authinfo.gpg")
         smtpmail-default-smtp-server server
         smtpmail-smtp-server server
-        smtpmail-smtp-service port))
+        smtpmail-smtp-service port))
 
-; https://www.reddit.com/r/emacs/comments/47t9ec/share_your_mu4econtext_configs/d0fsih6
-(defun mu4e-message-maildir-matches (msg rx)
-  "Returns true if the maildir of MSG matches the given regexp RX."
+; https://www.reddit.com/r/emacs/comments/47t9ec/share_your_mu4econtext_configs/d0fsih6
+(defun mu4e-message-maildir-matches (msg rx)
+  "Returns true if the maildir of MSG matches the given regexp RX."
 
-  (when rx
-    (if (listp rx)
-        ;; if rx is a list, try each one for a match
-        (or (mu4e-message-maildir-matches msg (car rx))
-            (mu4e-message-maildir-matches msg (cdr rx)))
-      ;; not a list, check rx
-      (string-match rx (mu4e-message-field msg :maildir)))))
+  (when rx
+    (if (listp rx)
+        ;; if rx is a list, try each one for a match
+        (or (mu4e-message-maildir-matches msg (car rx))
+            (mu4e-message-maildir-matches msg (cdr rx)))
+      ;; not a list, check rx
+      (string-match rx (mu4e-message-field msg :maildir)))))
 
-(defun suse-refile-folder (key)
-  "Returns the refile folder for the given SUSE account in the KEY arg"
-  (concat "/" key "/Archives/"
-          (format-time-string "%Y" (current-time))))
+(defun suse-refile-folder (key)
+  "Returns the refile folder for the given SUSE account in the KEY arg"
+  (concat "/" key "/Archives/"
+          (format-time-string "%Y" (current-time))))
 
@@ -1630,58 +1630,58 @@ this way is relatively new (since mu 0.9.16).
-
(setq mu4e-contexts
-      `(
-        ;; GMail
-        ,(make-mu4e-context
-          :name "gmail"
-          :enter-func (lambda ()
-                        (mu4e-message "Switching to gmail.com")
-                        (mssola-smtp "smtp.gmail.com" 587))
-          :match-func (lambda (msg)
-                        (when msg
-                          (mu4e-message-maildir-matches msg "^/gmail")))
-          :vars '(
-                  (user-mail-address     . "mikisabate@gmail.com")
-                  (mu4e-reply-to-address . "mikisabate@gmail.com")
-                  (mu4e-drafts-folder    . "/gmail/Drafts")
-                  (mu4e-sent-folder      . "/gmail/Sent")
-                  (mu4e-refile-folder    . "/gmail/All")
-                  (mu4e-trash-folder     . "/gmail/Trash")))
-
-        ;; suse.com
-        ,(make-mu4e-context
-          :name "comsuse"
-          :enter-func (lambda ()
-                        (mu4e-message "Switching to suse.com")
-                        (mssola-smtp "smtp.novell.com" 25))
-          :match-func (lambda (msg)
-                        (when msg
-                          (mu4e-message-maildir-matches msg "^/susecom")))
-          :vars `(
-                  (user-mail-address     . "msabate@suse.com")
-                  (mu4e-reply-to-address . "msabate@suse.com")
-                  (mu4e-drafts-folder    . "/susecom/Drafts")
-                  (mu4e-sent-folder      . "/susecom/Sent")
-                  (mu4e-refile-folder    . ,(suse-refile-folder "susecom"))
-                  (mu4e-trash-folder     . "/susecom/Trash")))
-
-        ;; suse.de
-        ,(make-mu4e-context
-          :name "desuse"
-          :enter-func (lambda ()
-                        (mu4e-message "Switching to suse.de")
-                        (mssola-smtp "imap.suse.de" 587))
-          :match-func (lambda (msg)
-                        (when msg
-                          (mu4e-message-maildir-matches msg "^/susede")))
-          :vars `(
-                  (user-mail-address     . "msabate@suse.de")
-                  (mu4e-reply-to-address . "msabate@suse.de")
-                  (mu4e-drafts-folder    . "/susede/Drafts")
-                  (mu4e-sent-folder      . "/susede/Sent")
-                  (mu4e-refile-folder    . ,(suse-refile-folder "susede"))
-                  (mu4e-trash-folder     . "/susede/Trash")))))
+
(setq mu4e-contexts
+      `(
+        ;; GMail
+        ,(make-mu4e-context
+          :name "gmail"
+          :enter-func (lambda ()
+                        (mu4e-message "Switching to gmail.com")
+                        (mssola-smtp "smtp.gmail.com" 587))
+          :match-func (lambda (msg)
+                        (when msg
+                          (mu4e-message-maildir-matches msg "^/gmail")))
+          :vars '(
+                  (user-mail-address     . "mikisabate@gmail.com")
+                  (mu4e-reply-to-address . "mikisabate@gmail.com")
+                  (mu4e-drafts-folder    . "/gmail/Drafts")
+                  (mu4e-sent-folder      . "/gmail/Sent")
+                  (mu4e-refile-folder    . "/gmail/All")
+                  (mu4e-trash-folder     . "/gmail/Trash")))
+
+        ;; suse.com
+        ,(make-mu4e-context
+          :name "comsuse"
+          :enter-func (lambda ()
+                        (mu4e-message "Switching to suse.com")
+                        (mssola-smtp "smtp.novell.com" 25))
+          :match-func (lambda (msg)
+                        (when msg
+                          (mu4e-message-maildir-matches msg "^/susecom")))
+          :vars `(
+                  (user-mail-address     . "msabate@suse.com")
+                  (mu4e-reply-to-address . "msabate@suse.com")
+                  (mu4e-drafts-folder    . "/susecom/Drafts")
+                  (mu4e-sent-folder      . "/susecom/Sent")
+                  (mu4e-refile-folder    . ,(suse-refile-folder "susecom"))
+                  (mu4e-trash-folder     . "/susecom/Trash")))
+
+        ;; suse.de
+        ,(make-mu4e-context
+          :name "desuse"
+          :enter-func (lambda ()
+                        (mu4e-message "Switching to suse.de")
+                        (mssola-smtp "imap.suse.de" 587))
+          :match-func (lambda (msg)
+                        (when msg
+                          (mu4e-message-maildir-matches msg "^/susede")))
+          :vars `(
+                  (user-mail-address     . "msabate@suse.de")
+                  (mu4e-reply-to-address . "msabate@suse.de")
+                  (mu4e-drafts-folder    . "/susede/Drafts")
+                  (mu4e-sent-folder      . "/susede/Sent")
+                  (mu4e-refile-folder    . ,(suse-refile-folder "susede"))
+                  (mu4e-trash-folder     . "/susede/Trash")))))
 
@@ -1691,8 +1691,8 @@ If mu4e cannot figure things out, ask me.
-
(setq mu4e-context-policy 'ask)
-(setq mu4e-compose-context-policy 'ask)
+
(setq mu4e-context-policy 'ask)
+(setq mu4e-compose-context-policy 'ask)
 
@@ -1702,13 +1702,13 @@ Fill the mu4e-user-mail-address-list variable with the contexts.
-
(setq mu4e-user-mail-address-list
-      (delq nil
-            (mapcar (lambda (context)
-                      (when (mu4e-context-vars context)
-                        (cdr (assq 'user-mail-address
-                                   (mu4e-context-vars context)))))
-                    mu4e-contexts)))
+
(setq mu4e-user-mail-address-list
+      (delq nil
+            (mapcar (lambda (context)
+                      (when (mu4e-context-vars context)
+                        (cdr (assq 'user-mail-address
+                                   (mu4e-context-vars context)))))
+                    mu4e-contexts)))
 
@@ -1718,10 +1718,10 @@ Setting my bookmarks
-
(setq mu4e-bookmarks
-      '(("maildir:/gmail/inbox OR maildir:/susecom/inbox OR maildir:/susede/inbox" "Inbox Folders" ?n)
-        ("flag:unread AND NOT flag:trashed" "Unread messages" ?u)
-        ("date:today..now" "Today's messages" ?t)))
+
(setq mu4e-bookmarks
+      '(("maildir:/gmail/inbox OR maildir:/susecom/inbox OR maildir:/susede/inbox" "Inbox Folders" ?n)
+        ("flag:unread AND NOT flag:trashed" "Unread messages" ?u)
+        ("date:today..now" "Today's messages" ?t)))
 
@@ -1732,10 +1732,10 @@ format=flowed or not.
-
(setq mu4e-compose-signature
-      (concat
-       "Miquel Sabaté Solà,\n"
-       "PGP: 4096R / 1BA5 3C7A C93D CA2A CFDF DA97 96BE 8C6F D89D 6565\n"))
+
(setq mu4e-compose-signature
+      (concat
+       "Miquel Sabaté Solà,\n"
+       "PGP: 4096R / 1BA5 3C7A C93D CA2A CFDF DA97 96BE 8C6F D89D 6565\n"))
 
@@ -1745,7 +1745,7 @@ Sign outgoing emails always.
-
(add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime)
+
(add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime)
 
@@ -1755,7 +1755,7 @@ To avoid UID clashes. See
-
(setq mu4e-change-filenames-when-moving t)
+
(setq mu4e-change-filenames-when-moving t)
 
@@ -1765,19 +1765,19 @@ Miscellaneous settings.
-
(setq mu4e-html2text-command "w3m -T text/html"
-      mu4e-attachment-dir  "~/Downloads"
-      mu4e-headers-date-format "%Y-%m-%d %H:%M"
-      message-citation-line-format "%N @ %Y-%m-%d %H:%M %Z:\n"
+
(setq mu4e-html2text-command "w3m -T text/html"
+      mu4e-attachment-dir  "~/Downloads"
+      mu4e-headers-date-format "%Y-%m-%d %H:%M"
+      message-citation-line-format "%N @ %Y-%m-%d %H:%M %Z:\n"
       message-citation-line-function 'message-insert-formatted-citation-line
       message-kill-buffer-on-exit t
-      mu4e-get-mail-command "mbsync -aqV"
+      mu4e-get-mail-command "mbsync -aqV"
       mu4e-update-interval 600
       mu4e-compose-dont-reply-to-self t
       mu4e-compose-format-flowed t
       mu4e-headers-skip-duplicates t
       mu4e-headers-include-related t
-      mu4e-headers-auto-update t)
+      mu4e-headers-auto-update t)
 
@@ -1789,11 +1789,11 @@ These are the defaults:
-
(setq mu4e-headers-fields
-      '( (:date          .  18)
-         (:mailing-list  .  15)
-         (:from-or-to    .  20)
-         (:subject       .  nil)))
+
(setq mu4e-headers-fields
+      '( (:date          .  18)
+         (:mailing-list  .  15)
+         (:from-or-to    .  20)
+         (:subject       .  nil)))
 
@@ -1803,12 +1803,12 @@ Show images
-
(setq mu4e-view-show-images t
-      mu4e-view-image-max-width 800)
+
(setq mu4e-view-show-images t
+      mu4e-view-image-max-width 800)
 
-; Use imagemagick, if available
-(when (fboundp 'imagemagick-register-types)
-  (imagemagick-register-types))
+; Use imagemagick, if available
+(when (fboundp 'imagemagick-register-types)
+  (imagemagick-register-types))
 
@@ -1819,9 +1819,9 @@ render an HTML message with Webkit.
-
(if (>= emacs-major-version 25)
-    (add-to-list 'mu4e-view-actions
-                 '("webkit" . mu4e-action-view-with-xwidget)))
+
(if (>= emacs-major-version 25)
+    (add-to-list 'mu4e-view-actions
+                 '("webkit" . mu4e-action-view-with-xwidget)))
 
@@ -1833,9 +1833,9 @@ on it.
-
(let ((exec (locate-file "msg2pdf" exec-path exec-suffixes)))
-  (if exec
-      (setq mu4e-msg2pdf exec)))
+
(let ((exec (locate-file "msg2pdf" exec-path exec-suffixes)))
+  (if exec
+      (setq mu4e-msg2pdf exec)))
 
@@ -1845,33 +1845,33 @@ Adding hooks for composing and viewing messages.
-
(defun mssola-compose-mode ()
-  "My settings for message composition."
+
(defun mssola-compose-mode ()
+  "My settings for message composition."
 
-  ; If we are composing an email from scratch, it's more convenient to be in
-  ; insert mode. Otherwise start with normal mode.
-  (with-eval-after-load 'evil
-    (if mu4e-compose-parent-message
-        (evil-set-initial-state 'mu4e-compose-mode 'normal)
-      (evil-set-initial-state 'mu4e-compose-mode 'insert)))
+  ; If we are composing an email from scratch, it's more convenient to be in
+  ; insert mode. Otherwise start with normal mode.
+  (with-eval-after-load 'evil
+    (if mu4e-compose-parent-message
+        (evil-set-initial-state 'mu4e-compose-mode 'normal)
+      (evil-set-initial-state 'mu4e-compose-mode 'insert)))
 
-  ; Guess hard newlines
-  (use-hard-newlines t 'guess)
+  ; Guess hard newlines
+  (use-hard-newlines t 'guess)
 
-  ; So it's easy to encrypt/decrypt emails.
-  (epa-mail-mode)
+  ; So it's easy to encrypt/decrypt emails.
+  (epa-mail-mode)
 
-  ; Spellz
-  (flyspell-mode))
+  ; Spellz
+  (flyspell-mode))
 
-(add-hook 'mu4e-compose-mode-hook 'mssola-compose-mode)
+(add-hook 'mu4e-compose-mode-hook 'mssola-compose-mode)
 
-; I want to read messages in the format that the sender used. I'm also
-; enabling epa-mail-mode, so it's easy to decrypt received emails.
-(add-hook 'mu4e-view-mode-hook
-          (lambda ()
-            (epa-mail-mode)
-            (visual-line-mode 1)))
+; I want to read messages in the format that the sender used. I'm also
+; enabling epa-mail-mode, so it's easy to decrypt received emails.
+(add-hook 'mu4e-view-mode-hook
+          (lambda ()
+            (epa-mail-mode)
+            (visual-line-mode 1)))
 
@@ -1881,35 +1881,35 @@ I want desktop notifications when receiving email.
-
(use-package mu4e-alert
-  :ensure t
-  :config
+
(use-package mu4e-alert
+  :ensure t
+  :config
 
-  ; Notify me for unread emails from my inbox.
-  (mu4e-alert-set-default-style 'libnotify)
-  (add-hook 'after-init-hook #'mu4e-alert-enable-notifications)
-  (add-hook 'after-init-hook #'mu4e-alert-enable-mode-line-display)
-  (setq mu4e-alert-interesting-mail-query
-        (concat
-         "(maildir:/gmail/inbox OR maildir:/susecom/inbox OR maildir:/susede/inbox) "
-         "AND flag:unread AND NOT flag:trashed"))
-  (setq mu4e-alert-email-notification-types '(count)))
+  ; Notify me for unread emails from my inbox.
+  (mu4e-alert-set-default-style 'libnotify)
+  (add-hook 'after-init-hook #'mu4e-alert-enable-notifications)
+  (add-hook 'after-init-hook #'mu4e-alert-enable-mode-line-display)
+  (setq mu4e-alert-interesting-mail-query
+        (concat
+         "(maildir:/gmail/inbox OR maildir:/susecom/inbox OR maildir:/susede/inbox) "
+         "AND flag:unread AND NOT flag:trashed"))
+  (setq mu4e-alert-email-notification-types '(count)))
 
-; Evil mode in mu4e
-(with-eval-after-load 'evil
-  (use-package evil-mu4e
-    :ensure t
-    :config
+; Evil mode in mu4e
+(with-eval-after-load 'evil
+  (use-package evil-mu4e
+    :ensure t
+    :config
 
-    ; Idea taken from evil-mu4e.el
-    (defvar mssola-evil-mu4e-mode-map-bindings
-      `((,evil-mu4e-state mu4e-headers-mode-map "\C-u" evil-scroll-up)
-        (,evil-mu4e-state mu4e-main-mode-map    "\C-u" evil-scroll-up)
-        (,evil-mu4e-state mu4e-view-mode-map    "h" evil-backward-char)))
+    ; Idea taken from evil-mu4e.el
+    (defvar mssola-evil-mu4e-mode-map-bindings
+      `((,evil-mu4e-state mu4e-headers-mode-map "\C-u" evil-scroll-up)
+        (,evil-mu4e-state mu4e-main-mode-map    "\C-u" evil-scroll-up)
+        (,evil-mu4e-state mu4e-view-mode-map    "h" evil-backward-char)))
 
-    (dolist (binding mssola-evil-mu4e-mode-map-bindings)
-      (evil-define-key
-        (nth 0 binding) (nth 1 binding) (nth 2 binding) (nth 3 binding)))))
+    (dolist (binding mssola-evil-mu4e-mode-map-bindings)
+      (evil-define-key
+        (nth 0 binding) (nth 1 binding) (nth 2 binding) (nth 3 binding)))))
 
@@ -1919,16 +1919,16 @@ And finally define a proper shortcut.
-
; The trailing parenthesis closes the "(when (featurep 'mu4e)" statement from
-; the very beginning.
-(global-set-key (kbd "C-c m") 'mu4e))
+
; The trailing parenthesis closes the "(when (featurep 'mu4e)" statement from
+; the very beginning.
+(global-set-key (kbd "C-c m") 'mu4e))
 
-

13 org

+

org

org mode is an incredible tool that keeps me organized: TODOs, notes, agenda, @@ -1937,13 +1937,13 @@ etc. Moreover, it's built in GNU Emacs:

-
(require 'org)
+
(require 'org)
 
-

13.1 General settings

+

General settings

First of all, let me define some helper functions. @@ -1951,34 +1951,34 @@ First of all, let me define some helper functions.

-
(defun mssola-org-skip-if-priority (priority &optional subtree)
-  "Skip an agenda item if it has a priority of PRIORITY.
-PRIORITY may be one of the characters ?A, ?B, or ?C.
-Skips the current entry unless SUBTREE is not nil.  This function has been
-copied from @aaronbieber."
+
(defun mssola-org-skip-if-priority (priority &optional subtree)
+  "Skip an agenda item if it has a priority of PRIORITY.
+PRIORITY may be one of the characters ?A, ?B, or ?C.
+Skips the current entry unless SUBTREE is not nil.  This function has been
+copied from @aaronbieber."
 
-  (let ((end (if subtree (save-excursion (org-end-of-subtree t))
-               (save-excursion (progn (outline-next-heading) (1- (point))))))
-        (pri-value (* 1000 (- org-lowest-priority priority)))
-        (pri-current (org-get-priority (thing-at-point 'line t))))
-    (if (= pri-value pri-current)
+  (let ((end (if subtree (save-excursion (org-end-of-subtree t))
+               (save-excursion (progn (outline-next-heading) (1- (point))))))
+        (pri-value (* 1000 (- org-lowest-priority priority)))
+        (pri-current (org-get-priority (thing-at-point 'line t))))
+    (if (= pri-value pri-current)
         end
-      nil)))
+      nil)))
 
-(defun mssola-org-skip-if-not-closed-in-day (time &optional subtree)
-  "Skip entries that were not closed in the given TIME.
-Skip the current entry unless SUBTREE is not nil, in which case skip
-the entire subtree.  Idea taken from @aaronbieber"
+(defun mssola-org-skip-if-not-closed-in-day (time &optional subtree)
+  "Skip entries that were not closed in the given TIME.
+Skip the current entry unless SUBTREE is not nil, in which case skip
+the entire subtree.  Idea taken from @aaronbieber"
 
-  (let ((end (if subtree (save-excursion (org-end-of-subtree t))
-               (save-excursion (progn (outline-next-heading) (1- (point))))))
-        (day-prefix (format-time-string "%Y-%m-%d" time)))
+  (let ((end (if subtree (save-excursion (org-end-of-subtree t))
+               (save-excursion (progn (outline-next-heading) (1- (point))))))
+        (day-prefix (format-time-string "%Y-%m-%d" time)))
 
-    (if (save-excursion
-          (and (re-search-forward org-closed-time-regexp end t)
-               (string= (substring (match-string-no-properties 1) 0 10) day-prefix)))
+    (if (save-excursion
+          (and (re-search-forward org-closed-time-regexp end t)
+               (string= (substring (match-string-no-properties 1) 0 10) day-prefix)))
         nil
-      end)))
+      end)))
 
@@ -1988,21 +1988,21 @@ Some general UI settings for org mode.
-
(setq org-src-tab-acts-natively t
+
(setq org-src-tab-acts-natively t
       org-confirm-babel-evaluate nil
-      org-edit-src-content-indentation 0)
+      org-edit-src-content-indentation 0)
 
-(setq org-todo-keywords
-      '((sequence "TODO(t)"  "|"  "DONE(d!)")
-        (sequence "IDEA(i)"  "WORKING(w)"  "|"  "USED(u@/!)"  "DISCARDED(x@/!)")))
+(setq org-todo-keywords
+      '((sequence "TODO(t)"  "|"  "DONE(d!)")
+        (sequence "IDEA(i)"  "WORKING(w)"  "|"  "USED(u@/!)"  "DISCARDED(x@/!)")))
 
-(setq org-todo-keyword-faces
-      '(("TODO"      . org-todo)
-        ("IDEA"      . font-lock-constant-face)
-        ("WORKING"   . font-lock-constant-face)
-        ("DONE"      . org-done)
-        ("USED"      . org-done)
-        ("DISCARDED" . org-done)))
+(setq org-todo-keyword-faces
+      '(("TODO"      . org-todo)
+        ("IDEA"      . font-lock-constant-face)
+        ("WORKING"   . font-lock-constant-face)
+        ("DONE"      . org-done)
+        ("USED"      . org-done)
+        ("DISCARDED" . org-done)))
 
@@ -2012,9 +2012,9 @@ Logging settings.
-
(setq org-log-done t)
-(setq org-log-redeadline (quote time))
-(setq org-log-reschedule (quote time))
+
(setq org-log-done t)
+(setq org-log-redeadline (quote time))
+(setq org-log-reschedule (quote time))
 
@@ -2024,14 +2024,14 @@ Where org files reside.
-
(setq org-agenda-files '("~/org/"))
+
(setq org-agenda-files '("~/org/"))
 
-

13.2 Publishing

+

Publishing

In order to publish files into HTML, I would like to have htmlize installed. @@ -2041,8 +2041,8 @@ blocks to be converted into HTML as well, so we can properly colorize it).

-
(use-package htmlize
-  :ensure t)
+
(use-package htmlize
+  :ensure t)
 
@@ -2052,13 +2052,13 @@ And now let's set all the related settings.
-
(setq org-src-fontify-natively t
+
(setq org-src-fontify-natively t
       org-html-include-timestamps nil
       org-html-toplevel-hlevel 2
       org-html-htmlize-output-type 'css
       org-export-with-section-numbers nil
       org-export-with-sub-superscripts nil
-      org-export-htmlize-output-type 'css)
+      org-export-htmlize-output-type 'css)
 
@@ -2069,14 +2069,14 @@ perform this first:
-
(require 'ox-man)
+
(require 'ox-man)
 
-

13.3 Agenda

+

Agenda

Custom commands for org-agenda. @@ -2084,73 +2084,73 @@ Custom commands for org-agenda.

-
(setq org-agenda-custom-commands
-      '(("p" "Printed agenda"
-         ; Daily agenda with a 2-weeks deadline warning. Tasks are
-         ; represented as [ ] items.
-         ((agenda ""
-                  ((org-agenda-ndays 1)
-                   (org-deadline-warning-days 14)
-                   (org-agenda-todo-keyword-format "[ ]")
-                   (org-agenda-scheduled-leaders '("" ""))))
-
-         ; Display a "High Priority" list of tasks on top.
-          (tags "PRIORITY=\"A\""
-                ((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
-                 (org-agenda-sorting-strategy '(tag-up priority-down))
-                 (org-agenda-todo-keyword-format "")
-                 (org-agenda-overriding-header "\nHigh priority\n--------------\n")))
-
-
-          ; All tasks except those already listed as high priority or
-          ; ideas. Scheduled and deadlines are also ignored here.
-          (alltodo ""
-                   ((org-agenda-skip-function '(or (mssola-org-skip-if-priority ?A)
-                                                   (org-agenda-skip-entry-if 'todo '("IDEA" "WORKING"))
-                                                   (org-agenda-skip-if nil '(scheduled deadline))))
-                    (org-agenda-sorting-strategy '(tag-up priority-down))
-                    (org-agenda-todo-keyword-format "")
-                    (org-agenda-overriding-header "\nAll tasks\n----------\n")))
-
-          ; List of ideas.
-          (todo "IDEA"
-                ((org-agenda-overriding-header "\nIdeas\n------\n")
-                 (org-agenda-todo-keyword-format ""))))
-
-         ((org-agenda-compact-blocks t)
-          (org-agenda-remove-tags t)))
-
-        ; List of done items. Useful for standups, review meetings, weekly
-        ; reports, etc.
-        ("d" "Done items"
-         ; First show the items done yesterday. Useful for standups.
-         ((todo "DONE"
-                ((org-agenda-overriding-header "Done yesterday\n---------------\n")
-                 (org-agenda-skip-function
-                  '(mssola-org-skip-if-not-closed-in-day
-                    (time-subtract (current-time) (seconds-to-time 86400))))
-                 (org-agenda-todo-keyword-format "")))
-
-          ; Then show what I've done today.
-          (todo "DONE"
-                ((org-agenda-overriding-header "\nDone today\n-----------\n")
-                 (org-agenda-skip-function
-                  '(mssola-org-skip-if-not-closed-in-day
-                    (current-time)))
-                 (org-agenda-todo-keyword-format "")))
-
-          ; Finally show what I've been doing in the past 15 days. Useful for
-          ; review meetings and weekly reports.
-          (todo "DONE"
-                ((org-agenda-start-day "-15d")
-                 (org-agenda-span 15)
-                 (org-agenda-start-on-weekday nil)
-                 (org-agenda-todo-keyword-format "")
-                 (org-agenda-scheduled-leaders '("" ""))
-                 (org-agenda-overriding-header "\nDone during the past 15 days\n-----------------------------\n"))))
-
-         ((org-agenda-compact-blocks t)
-          (org-agenda-remove-tags t)))))
+
(setq org-agenda-custom-commands
+      '(("p" "Printed agenda"
+         ; Daily agenda with a 2-weeks deadline warning. Tasks are
+         ; represented as [ ] items.
+         ((agenda ""
+                  ((org-agenda-ndays 1)
+                   (org-deadline-warning-days 14)
+                   (org-agenda-todo-keyword-format "[ ]")
+                   (org-agenda-scheduled-leaders '("" ""))))
+
+         ; Display a "High Priority" list of tasks on top.
+          (tags "PRIORITY=\"A\""
+                ((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
+                 (org-agenda-sorting-strategy '(tag-up priority-down))
+                 (org-agenda-todo-keyword-format "")
+                 (org-agenda-overriding-header "\nHigh priority\n--------------\n")))
+
+
+          ; All tasks except those already listed as high priority or
+          ; ideas. Scheduled and deadlines are also ignored here.
+          (alltodo ""
+                   ((org-agenda-skip-function '(or (mssola-org-skip-if-priority ?A)
+                                                   (org-agenda-skip-entry-if 'todo '("IDEA" "WORKING"))
+                                                   (org-agenda-skip-if nil '(scheduled deadline))))
+                    (org-agenda-sorting-strategy '(tag-up priority-down))
+                    (org-agenda-todo-keyword-format "")
+                    (org-agenda-overriding-header "\nAll tasks\n----------\n")))
+
+          ; List of ideas.
+          (todo "IDEA"
+                ((org-agenda-overriding-header "\nIdeas\n------\n")
+                 (org-agenda-todo-keyword-format ""))))
+
+         ((org-agenda-compact-blocks t)
+          (org-agenda-remove-tags t)))
+
+        ; List of done items. Useful for standups, review meetings, weekly
+        ; reports, etc.
+        ("d" "Done items"
+         ; First show the items done yesterday. Useful for standups.
+         ((todo "DONE"
+                ((org-agenda-overriding-header "Done yesterday\n---------------\n")
+                 (org-agenda-skip-function
+                  '(mssola-org-skip-if-not-closed-in-day
+                    (time-subtract (current-time) (seconds-to-time 86400))))
+                 (org-agenda-todo-keyword-format "")))
+
+          ; Then show what I've done today.
+          (todo "DONE"
+                ((org-agenda-overriding-header "\nDone today\n-----------\n")
+                 (org-agenda-skip-function
+                  '(mssola-org-skip-if-not-closed-in-day
+                    (current-time)))
+                 (org-agenda-todo-keyword-format "")))
+
+          ; Finally show what I've been doing in the past 15 days. Useful for
+          ; review meetings and weekly reports.
+          (todo "DONE"
+                ((org-agenda-start-day "-15d")
+                 (org-agenda-span 15)
+                 (org-agenda-start-on-weekday nil)
+                 (org-agenda-todo-keyword-format "")
+                 (org-agenda-scheduled-leaders '("" ""))
+                 (org-agenda-overriding-header "\nDone during the past 15 days\n-----------------------------\n"))))
+
+         ((org-agenda-compact-blocks t)
+          (org-agenda-remove-tags t)))))
 
@@ -2160,9 +2160,9 @@ The prefix for the different kinds of types being used.
-
(setq org-agenda-prefix-format '((agenda . "%t%s")
-                                 (tags   . "%c:%s")
-                                 (todo   . "%c:%t%s")))
+
(setq org-agenda-prefix-format '((agenda . "%t%s")
+                                 (tags   . "%c:%s")
+                                 (todo   . "%c:%t%s")))
 
@@ -2172,14 +2172,14 @@ Set up a key binding for org-agenda.
-
(global-set-key (kbd "C-c a") 'org-agenda)
+
(global-set-key (kbd "C-c a") 'org-agenda)
 
-

13.4 Capture

+

Capture

Set the default notes file and the key binding. @@ -2187,8 +2187,8 @@ Set the default notes file and the key binding.

-
(setq org-default-notes-file (concat org-directory "/notes.org"))
-(define-key global-map "\C-cc" 'org-capture)
+
(setq org-default-notes-file (concat org-directory "/notes.org"))
+(define-key global-map "\C-cc" 'org-capture)
 
@@ -2198,16 +2198,16 @@ And finally set org-capture-templates.
-
(setq org-capture-templates
-      `(("t" "todo" entry (file "") "* TODO %?\n%U\n")
-        ("i" "idea" entry (file "") "* %? :IDEA:\n%U\n%a\n")))
+
(setq org-capture-templates
+      `(("t" "todo" entry (file "") "* TODO %?\n%U\n")
+        ("i" "idea" entry (file "") "* %? :IDEA:\n%U\n%a\n")))
 
-

13.6 TODO shortcut for making an org link, and transforming a link into a proper org link

+

TODO shortcut for making an org link, and transforming a link into a proper org link

-

13.7 TODO make it work with evil

+

TODO make it work with evil

-

13.8 TODO Proper keybindings for quick access.

+

TODO Proper keybindings for quick access.

-

13.9 TODO shortcuts for stuff like: create something urgent for today

+

TODO shortcuts for stuff like: create something urgent for today

-

14 IRC

+

IRC

@@ -2270,8 +2270,8 @@ First of all, let's add some basic modules.
-
(dolist (mod '(autojoin track truncate))
-  (add-to-list 'erc-modules mod))
+
(dolist (mod '(autojoin track truncate))
+  (add-to-list 'erc-modules mod))
 
@@ -2281,27 +2281,27 @@ Setting up basic stuff.
-
(setq erc-hide-list '("PART")
-      erc-prompt (lambda () (concat (buffer-name) ">"))
-      erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE")
-      erc-server-coding-system '(utf-8 . utf-8)
+
(setq erc-hide-list '("PART")
+      erc-prompt (lambda () (concat (buffer-name) ">"))
+      erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE")
+      erc-server-coding-system '(utf-8 . utf-8)
       erc-kill-buffer-on-part t
       erc-kill-queries-on-quit t
       erc-kill-server-buffer-on-quit t
       erc-fill-column 100
-      erc-fill-prefix ""
-      erc-timestamp-format "[%H:%M] "
+      erc-fill-prefix ""
+      erc-timestamp-format "[%H:%M] "
       erc-insert-timestamp-function 'erc-insert-timestamp-left
       erc-insert-away-timestamp-function 'erc-insert-timestamp-left
       erc-hide-timestamps nil
       erc-whowas-on-nosuchnick t
       erc-public-away-p nil
-      erc-echo-notice-always-hook '(erc-echo-notice-in-minibuffer)
+      erc-echo-notice-always-hook '(erc-echo-notice-in-minibuffer)
       erc-auto-set-away nil
-      erc-autoaway-message "%i seconds out..."
-      erc-away-nickname "msabate"
+      erc-autoaway-message "%i seconds out..."
+      erc-away-nickname "msabate"
       erc-enable-logging t
-      erc-query-on-unjoined-chan-privmsg t)
+      erc-query-on-unjoined-chan-privmsg t)
 
@@ -2312,14 +2312,14 @@ that on /quit or /part, but it's better to be safe tha
-
(require 'erc-log)
-(erc-log-enable)
+
(require 'erc-log)
+(erc-log-enable)
 
-(setq erc-log-channels-directory "~/.emacs.d/erc"
+(setq erc-log-channels-directory "~/.emacs.d/erc"
       erc-save-buffer-on-part nil
       erc-save-queries-on-quit nil
       erc-log-write-after-send t
-      erc-log-write-after-insert t)
+      erc-log-write-after-insert t)
 
@@ -2329,9 +2329,9 @@ Servers and channels to auto-join.
-
(setq erc-autojoin-channels-alist
-      '(("irc.freenode.net" "#gnu" "#emacs")
-        ("irc.suse.de" "#suse" "#docker")))
+
(setq erc-autojoin-channels-alist
+      '(("irc.freenode.net" "#gnu" "#emacs")
+        ("irc.suse.de" "#suse" "#docker")))
 
@@ -2341,11 +2341,11 @@ Use the erc-hl-nicks package, so highlight support for nicknames is
-
(use-package erc-hl-nicks
-  :ensure t
-  :init
-  (with-eval-after-load 'erc
-    (add-to-list 'erc-modules 'hl-nicks)))
+
(use-package erc-hl-nicks
+  :ensure t
+  :init
+  (with-eval-after-load 'erc
+    (add-to-list 'erc-modules 'hl-nicks)))
 
@@ -2357,13 +2357,13 @@ GNU Emacs 24.3.
-
(with-eval-after-load 'erc
-  (setq erc-notifications-icon
-        (concat
-         "/usr/share/emacs/"
-         (format "%s.%s" emacs-major-version emacs-minor-version)
-         "/etc/images/icons/hicolor/24x24/apps/emacs.png"))
-  (add-to-list 'erc-modules 'notifications))
+
(with-eval-after-load 'erc
+  (setq erc-notifications-icon
+        (concat
+         "/usr/share/emacs/"
+         (format "%s.%s" emacs-major-version emacs-minor-version)
+         "/etc/images/icons/hicolor/24x24/apps/emacs.png"))
+  (add-to-list 'erc-modules 'notifications))
 
@@ -2373,8 +2373,8 @@ At this point, we can safely update all the loaded ERC modules.
-
(add-hook 'erc-connect-pre-hook
-          (lambda (x) (erc-update-modules)))
+
(add-hook 'erc-connect-pre-hook
+          (lambda (x) (erc-update-modules)))
 
@@ -2385,12 +2385,12 @@ Start some modules which won't do it by default. Moreover, according to the
-
(add-hook 'erc-mode-hook
-          '(lambda ()
-             (erc-track-mode t)
-             (auto-fill-mode -1)
-             (erc-log-mode 1)
-             (erc-autojoin-mode 1)))
+
(add-hook 'erc-mode-hook
+          '(lambda ()
+             (erc-track-mode t)
+             (auto-fill-mode -1)
+             (erc-log-mode 1)
+             (erc-autojoin-mode 1)))
 
@@ -2400,25 +2400,25 @@ And now define a function to connect to both IRC servers.
-
(defun mssola-erc ()
-  "Join pre-specified servers and channels."
+
(defun mssola-erc ()
+  "Join pre-specified servers and channels."
 
-  (interactive)
+  (interactive)
 
-  (erc :server "irc.freenode.net" :port 6667 :nick "mssola")
-  (erc-tls :server "irc.suse.de" :port 6697 :nick "mssola"))
+  (erc :server "irc.freenode.net" :port 6667 :nick "mssola")
+  (erc-tls :server "irc.suse.de" :port 6697 :nick "mssola"))
 
-(global-set-key (kbd "C-c i") 'mssola-erc))
+(global-set-key (kbd "C-c i") 'mssola-erc))
 
-

15 Languages

+

Languages

-

15.1 General

+

General

First of all, define a function that identifies some warning keywords @@ -2427,12 +2427,12 @@ First of all, define a function that identifies some warning keywords

-
(defun warnings-mode-hook ()
-  "Hook for enabling the warning face on strings with a warning prefix."
+
(defun warnings-mode-hook ()
+  "Hook for enabling the warning face on strings with a warning prefix."
 
-  (font-lock-add-keywords nil
-    '(("\\(XXX\\|FIXME\\|TODO\\|HACK\\|NOTE\\)"
-    1 font-lock-warning-face prepend))))
+  (font-lock-add-keywords nil
+    '(("\\(XXX\\|FIXME\\|TODO\\|HACK\\|NOTE\\)"
+    1 font-lock-warning-face prepend))))
 
@@ -2443,29 +2443,29 @@ context too. In this case, I want spell check and wc-mode activated
-
(add-hook 'text-mode-hook
-          (lambda ()
-            (flyspell-mode 1)
-            (wc-mode 1)))
+
(add-hook 'text-mode-hook
+          (lambda ()
+            (flyspell-mode 1)
+            (wc-mode 1)))
 
-

15.2 Shell

+

Shell

-
(use-package bats-mode
-  :ensure t)
+
(use-package bats-mode
+  :ensure t)
 
-

15.3 Lisp

+

Lisp

Emacs lisp needs rainbow-delimiters, so the amount of parenthesis is less @@ -2475,20 +2475,20 @@ confusing. Moreover, I'm also enabling eldoc-mode and the aforement

-
(add-hook 'emacs-lisp-mode-hook
-          (lambda ()
-            (eldoc-mode 1)
-            (warnings-mode-hook)
-            (rainbow-delimiters-mode 1)
-            ; https://github.com/jhenahan/emacs.d/blob/master/emacs-init.org#emacs-lisp
-            (setq mode-name "ξ")))
+
(add-hook 'emacs-lisp-mode-hook
+          (lambda ()
+            (eldoc-mode 1)
+            (warnings-mode-hook)
+            (rainbow-delimiters-mode 1)
+            ; https://github.com/jhenahan/emacs.d/blob/master/emacs-init.org#emacs-lisp
+            (setq mode-name "ξ")))
 
-

15.4 C and C++

+

C and C++

C and C++ only require the warnings-mode-hook function, spell checking for the @@ -2497,17 +2497,17 @@ comments and the usage of tabs instead of spaces.

-
; Note that C-common includes languages with a similar syntax of C.
-(add-hook 'c-mode-common-hook 'warnings-mode-hook)
-(add-hook 'c-mode-common-hook (lambda() (flyspell-prog-mode)))
+
; Note that C-common includes languages with a similar syntax of C.
+(add-hook 'c-mode-common-hook 'warnings-mode-hook)
+(add-hook 'c-mode-common-hook (lambda() (flyspell-prog-mode)))
 
-;; C
-(add-hook 'c-mode-hook
-  (lambda () (setq indent-tabs-mode t)))
+;; C
+(add-hook 'c-mode-hook
+  (lambda () (setq indent-tabs-mode t)))
 
-;; C++
-(add-hook 'c++-mode-hook
-  (lambda () (setq indent-tabs-mode t)))
+;; C++
+(add-hook 'c++-mode-hook
+  (lambda () (setq indent-tabs-mode t)))
 
@@ -2517,29 +2517,29 @@ CMake for y'all.
-
(use-package cmake-mode
-  :ensure t
-  :config
+
(use-package cmake-mode
+  :ensure t
+  :config
 
-  (setq auto-mode-alist
-        (append
-         '(("CMakeLists\\.txt\\'" . cmake-mode))
-         '(("\\.cmake\\'" . cmake-mode))
-         auto-mode-alist))
+  (setq auto-mode-alist
+        (append
+         '(("CMakeLists\\.txt\\'" . cmake-mode))
+         '(("\\.cmake\\'" . cmake-mode))
+         auto-mode-alist))
 
-  (use-package cmake-font-lock
-    :ensure t
-    :config
+  (use-package cmake-font-lock
+    :ensure t
+    :config
 
-    (add-hook 'cmake-mode-hook 'cmake-font-lock-activate)
-    (add-hook 'yaml-mode-hook 'warnings-mode-hook)))
+    (add-hook 'cmake-mode-hook 'cmake-font-lock-activate)
+    (add-hook 'yaml-mode-hook 'warnings-mode-hook)))
 
-

15.5 Ruby

+

Ruby

Include warning keywords in Ruby. @@ -2547,14 +2547,14 @@ Include warning keywords in Ruby.

-
(add-hook 'ruby-mode-hook 'warnings-mode-hook)
+
(add-hook 'ruby-mode-hook 'warnings-mode-hook)
 
-

15.6 Go

+

Go

And now my Go configuration. This includes stuff like the usage of goimports, @@ -2563,53 +2563,53 @@ And now my Go configuration. This includes stuff like the usage of goimpor

-
(defun mssola-go-mode ()
-  "My configuration for Go mode."
+
(defun mssola-go-mode ()
+  "My configuration for Go mode."
 
-  ; Use goimports instead of go-fmt
-  (setq gofmt-command "goimports")
+  ; Use goimports instead of go-fmt
+  (setq gofmt-command "goimports")
 
-  ; Call Gofmt before saving
-  (add-hook 'before-save-hook 'gofmt-before-save)
+  ; Call Gofmt before saving
+  (add-hook 'before-save-hook 'gofmt-before-save)
 
-  ; Integration flycheck with Go
-  (add-to-list 'load-path
-    (concat (getenv "GOPATH") "/src/github.com/dougm/goflymake"))
-  (require 'go-flycheck)
+  ; Integration flycheck with Go
+  (add-to-list 'load-path
+    (concat (getenv "GOPATH") "/src/github.com/dougm/goflymake"))
+  (require 'go-flycheck)
 
-  (evil-leader/set-key
-    "." 'godef-jump-other-window)
+  (evil-leader/set-key
+    "." 'godef-jump-other-window)
 
-  (setq indent-tabs-mode t)
-  (flyspell-prog-mode)
+  (setq indent-tabs-mode t)
+  (flyspell-prog-mode)
 
-  ; eldoc support
-  (use-package go-eldoc
-    :ensure t
-    :config
-    (require 'go-eldoc))
+  ; eldoc support
+  (use-package go-eldoc
+    :ensure t
+    :config
+    (require 'go-eldoc))
 
-  (use-package go-add-tags
-    :ensure t
-    :config
-    (evil-leader/set-key "t" 'go-add-tags)))
+  (use-package go-add-tags
+    :ensure t
+    :config
+    (evil-leader/set-key "t" 'go-add-tags)))
 
-;; Go
-(use-package go-mode
-  :ensure t
-  :pin melpa-stable
-  :config
+;; Go
+(use-package go-mode
+  :ensure t
+  :pin melpa-stable
+  :config
 
-  (add-hook 'go-mode-hook 'warnings-mode-hook)
-  (add-hook 'go-mode-hook 'go-eldoc-setup)
-  (add-hook 'go-mode-hook 'mssola-go-mode))
+  (add-hook 'go-mode-hook 'warnings-mode-hook)
+  (add-hook 'go-mode-hook 'go-eldoc-setup)
+  (add-hook 'go-mode-hook 'mssola-go-mode))
 
-

15.7 Rust

+

Rust

Install rust-mode and add some hooks to make it friendlier. @@ -2617,27 +2617,27 @@ Install rust-mode and add some hooks to make it friendlier.

-
(use-package rust-mode
-  :ensure t
-  :config
+
(use-package rust-mode
+  :ensure t
+  :config
 
-  (add-hook 'before-save-hook
-            #'(lambda ()
-                (when (eq major-mode 'rust-mode)
-                  (rust-format-buffer))))
+  (add-hook 'before-save-hook
+            #'(lambda ()
+                (when (eq major-mode 'rust-mode)
+                  (rust-format-buffer))))
 
-  (use-package flycheck-rust
-    :ensure t
-    :config
+  (use-package flycheck-rust
+    :ensure t
+    :config
 
-    (add-hook 'flycheck-mode-hook #'flycheck-rust-setup)))
+    (add-hook 'flycheck-mode-hook #'flycheck-rust-setup)))
 
-

15.8 Tabs vs spaces

+

Tabs vs spaces

Tabs or spaces? Both. The smart-tabs-mode has the philosophy of: tabs for @@ -2647,53 +2647,53 @@ usings tabs for indentation (C, C++ and Go).

-
(use-package smart-tabs-mode
-  :ensure t
-  :config
-  (smart-tabs-add-language-support golang go-mode-hook
-    ((c-indent-line . c-basic-offset)
-     (c-indent-region . c-basic-offset)))
-  (smart-tabs-insinuate 'c 'c++ 'golang))
+
(use-package smart-tabs-mode
+  :ensure t
+  :config
+  (smart-tabs-add-language-support golang go-mode-hook
+    ((c-indent-line . c-basic-offset)
+     (c-indent-region . c-basic-offset)))
+  (smart-tabs-insinuate 'c 'c++ 'golang))
 
-

15.9 Inferior markup languages.

+

Inferior markup languages.

-
;; Markdown mode with preview mode in the browser.
-(use-package markdown-mode
-  :ensure t
-  :config
+
;; Markdown mode with preview mode in the browser.
+(use-package markdown-mode
+  :ensure t
+  :config
 
-  ; This is the one that I got from openSUSE.
-  (custom-set-variables
-    '(markdown-command "/usr/bin/markdown-calibre"))
+  ; This is the one that I got from openSUSE.
+  (custom-set-variables
+    '(markdown-command "/usr/bin/markdown-calibre"))
 
-  ; Preview mode does its things through websockets, so it's a requirement.
-  ; After that, we can safely require it.
-  (use-package websocket
-    :ensure t
-    :config
-    (use-package markdown-preview-mode
-      :ensure t)))
+  ; Preview mode does its things through websockets, so it's a requirement.
+  ; After that, we can safely require it.
+  (use-package websocket
+    :ensure t
+    :config
+    (use-package markdown-preview-mode
+      :ensure t)))
 
-; YAML
-(use-package yaml-mode
-  :ensure t
-  :config
+; YAML
+(use-package yaml-mode
+  :ensure t
+  :config
 
-  (add-hook 'yaml-mode-hook 'warnings-mode-hook))
+  (add-hook 'yaml-mode-hook 'warnings-mode-hook))
 
-

15.10 Web-related stuff.

+

Web-related stuff.

Slim and SCSS. @@ -2701,18 +2701,18 @@ Slim and SCSS.

-
(use-package slim-mode
-  :ensure t)
+
(use-package slim-mode
+  :ensure t)
 
-(use-package scss-mode
-  :ensure t
-  :config
+(use-package scss-mode
+  :ensure t
+  :config
 
-  (setq scss-compile-at-save nil)
-  (add-hook 'yaml-mode-hook 'warnings-mode-hook))
+  (setq scss-compile-at-save nil)
+  (add-hook 'yaml-mode-hook 'warnings-mode-hook))
 
-(use-package coffee-mode
-  :ensure t)
+(use-package coffee-mode
+  :ensure t)
 
@@ -2723,44 +2723,44 @@ bundle of features which are interesting for web-related stuff.
-
(use-package php-mode
-  :ensure t)
+
(use-package php-mode
+  :ensure t)
 
-(use-package web-mode
-  :ensure t
-  :config
+(use-package web-mode
+  :ensure t
+  :config
 
-  (add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
-  (add-to-list 'auto-mode-alist '("\\.jinja\\'" . web-mode))
-  (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
+  (add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
+  (add-to-list 'auto-mode-alist '("\\.jinja\\'" . web-mode))
+  (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
 
-  (add-hook 'web-mode-hook
-            (lambda ()
-              (setq web-mode-markup-indent-offset 2)
-              (setq web-mode-css-indent-offset 2)
-              (setq web-mode-code-indent-offset 2)))
+  (add-hook 'web-mode-hook
+            (lambda ()
+              (setq web-mode-markup-indent-offset 2)
+              (setq web-mode-css-indent-offset 2)
+              (setq web-mode-code-indent-offset 2)))
 
-  (add-hook 'js-mode-hook
-            (lambda ()
-              (setq js-indent-level 2)
-              (rainbow-delimiters-mode 1)))
+  (add-hook 'js-mode-hook
+            (lambda ()
+              (setq js-indent-level 2)
+              (rainbow-delimiters-mode 1)))
 
-  (use-package vue-mode
-    :ensure t
-    :config
-    (setq mmm-submode-decoration-level 0))
+  (use-package vue-mode
+    :ensure t
+    :config
+    (setq mmm-submode-decoration-level 0))
 
-  ; React: treat it as a derived mode. Idea taken from spacemacs.
-  (define-derived-mode react-mode web-mode "react")
-  (add-to-list 'auto-mode-alist '("\\.jsx\\'" . react-mode))
-  (add-to-list 'auto-mode-alist '("\\.react.js\\'" . react-mode))
+  ; React: treat it as a derived mode. Idea taken from spacemacs.
+  (define-derived-mode react-mode web-mode "react")
+  (add-to-list 'auto-mode-alist '("\\.jsx\\'" . react-mode))
+  (add-to-list 'auto-mode-alist '("\\.react.js\\'" . react-mode))
 
-  (add-hook 'react-mode-hook
-            (lambda ()
-              (yas-activate-extra-mode 'js-mode)
-              (web-mode-set-content-type "jsx")
-              (setq-local web-mode-enable-auto-quoting nil)
-              (rainbow-delimiters 1))))
+  (add-hook 'react-mode-hook
+            (lambda ()
+              (yas-activate-extra-mode 'js-mode)
+              (web-mode-set-content-type "jsx")
+              (setq-local web-mode-enable-auto-quoting nil)
+              (rainbow-delimiters 1))))
 
@@ -2772,15 +2772,15 @@ can be frustrating without proper formatting.
-
(use-package json-reformat
-  :ensure t)
+
(use-package json-reformat
+  :ensure t)
 
-

15.11 Devops

+

Devops

Highlighting for Dockerfiles. @@ -2788,11 +2788,11 @@ Highlighting for Dockerfiles.

-
(use-package dockerfile-mode
-  :ensure t
-  :config
+
(use-package dockerfile-mode
+  :ensure t
+  :config
 
-  (add-to-list 'auto-mode-alist '("Dockerfile\\'" . dockerfile-mode)))
+  (add-to-list 'auto-mode-alist '("Dockerfile\\'" . dockerfile-mode)))
 
@@ -2802,28 +2802,28 @@ Stuff from Hashicorp like terraform and HCL.
-
(use-package terraform-mode
-  :ensure t
-  :config
+
(use-package terraform-mode
+  :ensure t
+  :config
 
-  (terraform-format-on-save-mode))
+  (terraform-format-on-save-mode))
 
-(use-package hcl-mode
-  :ensure t)
+(use-package hcl-mode
+  :ensure t)
 
-
(use-package salt-mode
-  :ensure t)
+
(use-package salt-mode
+  :ensure t)
 
-

15.12 Others

+

Others

The soria theme has the soria-purple-identifiers hook. This hook instructs @@ -2834,11 +2834,11 @@ criteria really).

-
(dolist (lang-hook '(ruby-mode-hook
+
(dolist (lang-hook '(ruby-mode-hook
                      php-mode-hook
                      perl-mode-hook
-                     emacs-lisp-mode-hook))
-  (add-hook lang-hook 'soria-purple-identifiers))
+                     emacs-lisp-mode-hook))
+  (add-hook lang-hook 'soria-purple-identifiers))
 
@@ -2846,7 +2846,7 @@ criteria really).
-

16 WoMan

+

WoMan

WoMan is a package that is included inside of GNU Emacs by default, and that @@ -2855,16 +2855,16 @@ takes care of visualizing man pages. Let's properly setup Evil mode for this:

-
(with-eval-after-load "evil"
-  (evil-set-initial-state 'woman-mode 'normal)
-  (evil-define-key 'normal woman-mode-map
-    "J" 'Man-next-section
-    "K" 'Man-previous-section
-    "\C-h" 'evil-window-left
-    "\C-l" 'evil-window-right
-    "\C-j" 'evil-window-down
-    "\C-k" 'evil-window-up
-    "\C-u" 'evil-scroll-up))
+
(with-eval-after-load "evil"
+  (evil-set-initial-state 'woman-mode 'normal)
+  (evil-define-key 'normal woman-mode-map
+    "J" 'Man-next-section
+    "K" 'Man-previous-section
+    "\C-h" 'evil-window-left
+    "\C-l" 'evil-window-right
+    "\C-j" 'evil-window-down
+    "\C-k" 'evil-window-up
+    "\C-u" 'evil-scroll-up))
 
@@ -2874,14 +2874,14 @@ Finally, I want man pages to fill all the frame:
-
(setq woman-fill-frame t)
+
(setq woman-fill-frame t)
 
-

17 Misc

+

Misc

Install a set of useful functions from @bbatsov. The bindings are following @@ -2891,20 +2891,20 @@ too many things into my leader and these shortcuts look sensible to me).

-
(use-package crux
-  :ensure t
-  :config
+
(use-package crux
+  :ensure t
+  :config
 
-  (global-set-key (kbd "C-c d") 'crux-delete-file-and-buffer)
-  (global-set-key (kbd "C-c r") 'crux-rename-file-and-buffer)
-  (global-set-key (kbd "C-c o") 'crux-open-with))
+  (global-set-key (kbd "C-c d") 'crux-delete-file-and-buffer)
+  (global-set-key (kbd "C-c r") 'crux-rename-file-and-buffer)
+  (global-set-key (kbd "C-c o") 'crux-open-with))
 
-

18 Credits

+

Credits

I've built this file by simply scavenging from other people's emacs.d/dotfiles @@ -2931,7 +2931,7 @@ repositories. I have taken lots of pieces from here and there, but most notably:

-

19 License

+

License

@@ -2956,8 +2956,8 @@ along with this program. If not, see <

Author: Miquel Sabaté Solà

-

Created: 2017-12-06 Wed 13:33

-

Emacs 25.3.1 (Org mode 8.2.10)

+

Created: 2017-12-12 Tue 17:18

+

Emacs 25.2.1 (Org mode 8.2.10)

Validate

-- cgit v1.2.3