diff options
-rw-r--r-- | host-ap-spotcap.local/config/zsh/zshenv.local | 2 | ||||
-rw-r--r-- | tag-emacs/emacs.d/init.org | 1815 | ||||
-rw-r--r-- | tag-zsh/config/zsh/zshrc | 8 |
3 files changed, 922 insertions, 903 deletions
diff --git a/host-ap-spotcap.local/config/zsh/zshenv.local b/host-ap-spotcap.local/config/zsh/zshenv.local index 35fe7a3..a5ec0b4 100644 --- a/host-ap-spotcap.local/config/zsh/zshenv.local +++ b/host-ap-spotcap.local/config/zsh/zshenv.local @@ -4,3 +4,5 @@ then . $HOME/.nix-profile/etc/profile.d/nix.sh; fi export ZPLUG_HOME=/usr/local/opt/zplug + +export HOMEBREW_NO_AUTO_UPDATE=1 diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 1f74f26..ce1e635 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -10,7 +10,7 @@ This is a living document, detailing my Emacs configuration using org-mode Open Emacs with just a plain window. No graphics or messages, please! #+BEGIN_SRC emacs-lisp (put 'inhibit-startup-echo-area-message 'saved-value - (setq inhibit-startup-echo-area-message (user-login-name))) + (setq inhibit-startup-echo-area-message (user-login-name))) (setq inhibit-startup-screen t) (setq gc-cons-threshold 100000000) (setq file-name-handler-alist nil) @@ -22,13 +22,13 @@ programming mode in one, then I’ll just call it manually. I also like the buffer to be empty. #+BEGIN_SRC emacs-lisp (setq initial-scratch-message "" - initial-major-mode 'text-mode) + initial-major-mode 'text-mode) #+END_SRC ** Personal Information #+BEGIN_SRC emacs-lisp (setq user-mail-address "alan@alanpearce.co.uk" - user-full-name "Alan Pearce") + user-full-name "Alan Pearce") #+end_src * Packaging @@ -91,22 +91,22 @@ Disable all the bars, unless on OSX, in which case, keep the menu bar. #+BEGIN_SRC emacs-lisp (when (and menu-bar-mode (not (eq window-system 'ns))) - (menu-bar-mode -1)) + (menu-bar-mode -1)) (with-eval-after-load 'scroll-bar - (set-scroll-bar-mode nil)) + (set-scroll-bar-mode nil)) (with-eval-after-load 'tooltip - (tooltip-mode -1)) + (tooltip-mode -1)) (with-eval-after-load 'tool-bar - (tool-bar-mode -1)) + (tool-bar-mode -1)) #+END_SRC Ring the bell sometimes, but not so often #+BEGIN_SRC emacs-lisp (setq ring-bell-function - (lambda () - (unless (memq this-command - '(isearch-abort abort-recursive-edit exit-minibuffer keyboard-quit undo-tree-undo)) - (ding)))) + (lambda () + (unless (memq this-command + '(isearch-abort abort-recursive-edit exit-minibuffer keyboard-quit undo-tree-undo)) + (ding)))) #+END_SRC #+BEGIN_SRC emacs-lisp @@ -119,27 +119,27 @@ I quite like solarized. I don’t think it’s perfect, but it supports a lot of modes. #+BEGIN_SRC emacs-lisp (use-package solarized-theme - :disabled t - :config (progn - (setq solarized-distinct-fringe-background t) - (setq solarized-high-contrast-mode-line t) - (load-theme 'solarized-light t))) + :disabled t + :config (progn + (setq solarized-distinct-fringe-background t) + (setq solarized-high-contrast-mode-line t) + (load-theme 'solarized-light t))) #+END_SRC Let’s try a more minimal theme. #+BEGIN_SRC emacs-lisp (use-package minimal-theme - :config (progn - (load-theme 'minimal-light t))) + :config (progn + (load-theme 'minimal-light t))) #+END_SRC Highlighting quasi-quoted expressions in lisps is quite useful. #+BEGIN_SRC emacs-lisp (use-package highlight-stages - :diminish highlight-stages-mode - :config (progn - (add-hook 'lisp-mode-common-hook #'highlight-stages-mode))) + :diminish highlight-stages-mode + :config (progn + (add-hook 'lisp-mode-common-hook #'highlight-stages-mode))) #+END_SRC ** Fonts @@ -148,46 +148,46 @@ When possible, set up fonts. I don’t have any settings here for X11, because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresources/main][XResources file]]. #+BEGIN_SRC emacs-lisp (when (or (display-graphic-p) - (daemonp)) - - (defun use-variable-fonts () - (interactive) - (variable-pitch-mode) - (setq cursor-type 'bar)) - - (defun format-font (name style size) - (format "-*-%s-%s-*-*-*-%s-*-*-*-*-*-*" name style size)) - - (defun ap/set-fonts (mono-face mono-font-size variable-face variable-font-size) - (when mono-face - (let ((default-font (format-font mono-face "normal" mono-font-size))) - (add-to-list 'default-frame-alist `(font . ,default-font)) - (set-face-font 'fixed-pitch default-font) - (set-frame-font default-font t t))) - (when variable-face - (set-face-font 'variable-pitch (format-font variable-face "normal" variable-font-size)))) - - (defun ap/set-fonts-according-to-system () - (interactive) - (cond - ((eq window-system 'w32) - (ap/set-fonts "Liberation Mono" 11 "Segoe UI" 11)) - ((eq window-system 'ns) - (let ((displays (string-to-number (shell-command-to-string "system_profiler SPDisplaysDataType | grep \"Online: Yes\" | wc -l")))) - (if (eq displays 1) - (ap/set-fonts "Monoid" 12 "Lucida Grande" 12) - (ap/set-fonts "ProggyTiny" 11 "Lucida Grande" 12)))) - ((eq window-system 'x) - (ap/set-fonts "Source Code Pro" 13 "Liberation Sans" 13)))) - - (ap/set-fonts-according-to-system)) + (daemonp)) + + (defun use-variable-fonts () + (interactive) + (variable-pitch-mode) + (setq cursor-type 'bar)) + + (defun format-font (name style size) + (format "-*-%s-%s-*-*-*-%s-*-*-*-*-*-*" name style size)) + + (defun ap/set-fonts (mono-face mono-font-size variable-face variable-font-size) + (when mono-face + (let ((default-font (format-font mono-face "normal" mono-font-size))) + (add-to-list 'default-frame-alist `(font . ,default-font)) + (set-face-font 'fixed-pitch default-font) + (set-frame-font default-font t t))) + (when variable-face + (set-face-font 'variable-pitch (format-font variable-face "normal" variable-font-size)))) + + (defun ap/set-fonts-according-to-system () + (interactive) + (cond + ((eq window-system 'w32) + (ap/set-fonts "Liberation Mono" 11 "Segoe UI" 11)) + ((eq window-system 'ns) + (let ((displays (string-to-number (shell-command-to-string "system_profiler SPDisplaysDataType | grep \"Online: Yes\" | wc -l")))) + (if (eq displays 1) + (ap/set-fonts "Monoid HalfTight" 12 "Lucida Grande" 12) + (ap/set-fonts "ProggyTiny" 11 "Lucida Grande" 12)))) + ((eq window-system 'x) + (ap/set-fonts "Source Code Pro" 13 "Liberation Sans" 13)))) + + (ap/set-fonts-according-to-system)) #+END_SRC Reduce font decoration. I’m trying to see whether this helps me focus on the right things. #+BEGIN_SRC emacs-lisp (setq font-lock-maximum-decoration '((dired-mode . 1) - (t . 1))) + (t . 1))) #+END_SRC ** Page Breaks @@ -199,14 +199,14 @@ correct, at least for Liberation Mono. #+BEGIN_SRC emacs-lisp (use-package page-break-lines - :defer 5 - :diminish page-break-lines-mode - :config (progn - (global-page-break-lines-mode) - (unless (eq (char-displayable-p ?─) (char-displayable-p ?a)) - (set-fontset-font "fontset-default" - (cons page-break-lines-char page-break-lines-char) - (face-attribute 'default :family))))) + :defer 5 + :diminish page-break-lines-mode + :config (progn + (global-page-break-lines-mode) + (unless (eq (char-displayable-p ?─) (char-displayable-p ?a)) + (set-fontset-font "fontset-default" + (cons page-break-lines-char page-break-lines-char) + (face-attribute 'default :family))))) #+END_SRC ** Modeline @@ -215,7 +215,7 @@ correct, at least for Liberation Mono. (size-indication-mode t) (setq frame-title-format - '("%f" (dired-directory dired-directory))) + '("%f" (dired-directory dired-directory))) #+END_SRC ** Highlight Changes @@ -224,9 +224,9 @@ Highlight what just changed when I undo, yank, and so on. #+BEGIN_SRC emacs-lisp (use-package volatile-highlights - :diminish volatile-highlights-mode - :config (progn - (volatile-highlights-mode t))) + :diminish volatile-highlights-mode + :config (progn + (volatile-highlights-mode t))) #+END_SRC ** Renaming major modes @@ -236,20 +236,20 @@ modes. #+BEGIN_SRC emacs-lisp (use-package cyphejor - :defer 2 - :config (progn - (setq cyphejor-rules `(("emacs" "ε") - ("diff" "Δ") - ("js2" "js") - ("magit-status" ,(char-to-string (-find #'char-displayable-p '(11942 5848 177)))) - ("inferior" "i" :prefix) - ("interaction" "i" :prefix) - ("interactive" "i" :prefix) - ("menu" "▤" :postfix) - ("ledger" "Ledger") - ("mode" "") - ("shell" "sh" :postfix))) - (cyphejor-mode 1))) + :defer 2 + :config (progn + (setq cyphejor-rules `(("emacs" "ε") + ("diff" "Δ") + ("js2" "js") + ("magit-status" ,(char-to-string (-find #'char-displayable-p '(11942 5848 177)))) + ("inferior" "i" :prefix) + ("interaction" "i" :prefix) + ("interactive" "i" :prefix) + ("menu" "▤" :postfix) + ("ledger" "Ledger") + ("mode" "") + ("shell" "sh" :postfix))) + (cyphejor-mode 1))) #+END_SRC @@ -262,16 +262,16 @@ Option/alt, then Control. #+BEGIN_SRC emacs-lisp (when (eq system-type 'darwin) - (set-keyboard-coding-system nil) - (custom-set-variables - '(mac-option-modifier 'meta) - '(mac-right-option-modifier 'none) - '(mac-control-modifier 'control) - '(mac-right-control-modifier 'left) - '(mac-command-modifier 'super) - '(mac-right-command-modifier 'left) - '(mac-function-modifier 'hyper)) - (unbind-key "s-x")) + (set-keyboard-coding-system nil) + (custom-set-variables + '(mac-option-modifier 'meta) + '(mac-right-option-modifier 'none) + '(mac-control-modifier 'control) + '(mac-right-control-modifier 'left) + '(mac-command-modifier 'super) + '(mac-right-command-modifier 'left) + '(mac-function-modifier 'hyper)) + (unbind-key "s-x")) #+END_SRC #+BEGIN_SRC emacs-lisp @@ -309,8 +309,8 @@ Option/alt, then Control. * Projects #+BEGIN_SRC emacs-lisp - (defvar work-project-directory "~/work") - (defvar home-project-directory "~/projects") + (defvar work-project-directory "~/work") + (defvar home-project-directory "~/projects") #+END_SRC #+BEGIN_SRC emacs-lisp @@ -323,8 +323,8 @@ Option/alt, then Control. #+BEGIN_SRC emacs-lisp (use-package ag - :defer 30 - :config (setq ag-project-root-function #'projectile-project-root)) + :defer 30 + :config (setq ag-project-root-function #'projectile-project-root)) #+END_SRC ** Projectile @@ -335,38 +335,38 @@ based upon some folder conventions I use. #+BEGIN_SRC emacs-lisp (use-package projectile - :bind (("C-c C-f" . projectile-find-file) - ("s-x s-f" . projectile-find-file) - ("C-x g" . projectile-vc) - ("s-G" . projectile-vc)) - :demand t - :diminish projectile-mode - :config (progn - (projectile-global-mode) - (add-to-list 'projectile-globally-ignored-directories ".stversions") - (defun ap/subfolder-projects (dir) - (--map (file-relative-name it dir) - (-filter (lambda (subdir) - (--reduce-from (or acc (funcall it subdir)) nil - projectile-project-root-files-functions)) - (-filter #'file-directory-p (directory-files dir t "\\<"))))) - - (defun ap/open-subfolder-project (from-dir &optional arg) - (let ((project-dir (projectile-completing-read "Open project: " - (ap/subfolder-projects from-dir)))) - (projectile-switch-project-by-name (expand-file-name project-dir from-dir) arg))) - - (defun ap/open-work-project (&optional arg) - (interactive "P") - (ap/open-subfolder-project work-project-directory arg)) - - (defun ap/open-home-project (&optional arg) - (interactive "P") - (ap/open-subfolder-project home-project-directory arg)) - - (setq projectile-switch-project-action #'projectile-dired - projectile-remember-window-configs t - projectile-completion-system 'ivy))) + :bind (("C-c C-f" . projectile-find-file) + ("s-x s-f" . projectile-find-file) + ("C-x g" . projectile-vc) + ("s-G" . projectile-vc)) + :demand t + :diminish projectile-mode + :config (progn + (projectile-global-mode) + (add-to-list 'projectile-globally-ignored-directories ".stversions") + (defun ap/subfolder-projects (dir) + (--map (file-relative-name it dir) + (-filter (lambda (subdir) + (--reduce-from (or acc (funcall it subdir)) nil + projectile-project-root-files-functions)) + (-filter #'file-directory-p (directory-files dir t "\\<"))))) + + (defun ap/open-subfolder-project (from-dir &optional arg) + (let ((project-dir (projectile-completing-read "Open project: " + (ap/subfolder-projects from-dir)))) + (projectile-switch-project-by-name (expand-file-name project-dir from-dir) arg))) + + (defun ap/open-work-project (&optional arg) + (interactive "P") + (ap/open-subfolder-project work-project-directory arg)) + + (defun ap/open-home-project (&optional arg) + (interactive "P") + (ap/open-subfolder-project home-project-directory arg)) + + (setq projectile-switch-project-action #'projectile-dired + projectile-remember-window-configs t + projectile-completion-system 'ivy))) #+END_SRC ** perspective @@ -377,14 +377,14 @@ it needs hooking into projectile and a key bound to switch between projects. #+BEGIN_SRC emacs-lisp (use-package perspective - :bind* ("s-p" . projectile-persp-switch-project) - :demand t - :config (progn - (setq persp-show-modestring t) - (persp-mode))) + :bind* ("s-p" . projectile-persp-switch-project) + :demand t + :config (progn + (setq persp-show-modestring t) + (persp-mode))) (use-package persp-projectile - :ensure t) + :ensure t) #+END_SRC ** vc @@ -397,7 +397,7 @@ occasions that I’m working with something other than git. :defer t :bind (("C-x v C" . vc-resolve-conflicts)) :config (progn - (setq vc-follow-symlinks t))) + (setq vc-follow-symlinks t))) #+END_SRC ** diff-hl @@ -407,12 +407,12 @@ changed. This package colours the fringe #+BEGIN_SRC emacs-lisp (use-package diff-hl - :defer 2 - :config (progn - (global-diff-hl-mode 1) - (add-hook 'dired-mode-hook (lambda () - (diff-hl-dired-mode 1))) - (add-hook 'magit-post-refresh-hook #'diff-hl-magit-post-refresh))) + :defer 2 + :config (progn + (global-diff-hl-mode 1) + (add-hook 'dired-mode-hook (lambda () + (diff-hl-dired-mode 1))) + (add-hook 'magit-post-refresh-hook #'diff-hl-magit-post-refresh))) #+END_SRC ** magit @@ -422,15 +422,15 @@ time. Make sure to set it up with a nice =completing-read-function= #+BEGIN_SRC emacs-lisp (use-package magit - :defer 5 - :commands (magit-status) - :config (progn (setq magit-last-seen-setup-instructions "1.4.0" - magit-completing-read-function #'magit-builtin-completing-read - magit-popup-use-prefix-argument 'default - magit-push-always-verify nil - global-magit-file-mode nil) - (add-to-list 'magit-no-confirm 'safe-with-wip)) - :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) + :defer 5 + :commands (magit-status) + :config (progn (setq magit-last-seen-setup-instructions "1.4.0" + magit-completing-read-function #'magit-builtin-completing-read + magit-popup-use-prefix-argument 'default + magit-push-always-verify nil + global-magit-file-mode nil) + (add-to-list 'magit-no-confirm 'safe-with-wip)) + :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) #+END_SRC ** git-timemachine @@ -442,7 +442,7 @@ a particular way, but it changed later. #+BEGIN_SRC emacs-lisp (use-package git-timemachine - :commands git-timemachine) + :commands git-timemachine) #+END_SRC * Files @@ -454,7 +454,7 @@ the filesystem. I don’t want emacs-specific lockfiles, either. #+BEGIN_SRC emacs-lisp (setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t)) - create-lockfiles nil) + create-lockfiles nil) #+END_SRC ** Backups @@ -463,29 +463,29 @@ a subfolder of its configuration directory for that. Also, use the trash for deleting on OS X. #+BEGIN_SRC emacs-lisp (let ((backup-dir (expand-file-name "~/.emacs.d/backups/"))) - (unless (file-directory-p backup-dir) - (make-directory backup-dir)) - (setq backup-directory-alist `((".*" . ,backup-dir)) - backup-by-copying-when-linked t - backup-by-copying-when-mismatch t)) + (unless (file-directory-p backup-dir) + (make-directory backup-dir)) + (setq backup-directory-alist `((".*" . ,backup-dir)) + backup-by-copying-when-linked t + backup-by-copying-when-mismatch t)) (if (eq system-type 'darwin) - (setq delete-by-moving-to-trash t) - (if (and (executable-find "trash") (not (fboundp #'system-move-file-to-trash))) - (defun system-move-file-to-trash (file) - (call-process (executable-find "trash") - nil 0 nil - file)))) + (setq delete-by-moving-to-trash t) + (if (and (executable-find "trash") (not (fboundp #'system-move-file-to-trash))) + (defun system-move-file-to-trash (file) + (call-process (executable-find "trash") + nil 0 nil + file)))) #+END_SRC ** autorevert #+BEGIN_SRC emacs-lisp (use-package autorevert - :diminish auto-revert-mode - :init (progn - (global-auto-revert-mode 1) - (setq auto-revert-verbose nil - auto-revert-use-notify (not (eq system-type 'darwin))))) + :diminish auto-revert-mode + :init (progn + (global-auto-revert-mode 1) + (setq auto-revert-verbose nil + auto-revert-use-notify (not (eq system-type 'darwin))))) #+END_SRC ** Encoding @@ -506,9 +506,9 @@ especially nice when starting new projects. #+BEGIN_SRC emacs-lisp (defun my-create-non-existent-directory () (let ((parent-directory (file-name-directory buffer-file-name))) - (when (and (not (file-exists-p parent-directory)) - (y-or-n-p (format "Directory `%s' does not exist! Create it?" parent-directory))) - (make-directory parent-directory t)))) + (when (and (not (file-exists-p parent-directory)) + (y-or-n-p (format "Directory `%s' does not exist! Create it?" parent-directory))) + (make-directory parent-directory t)))) (add-to-list 'find-file-not-found-functions #'my-create-non-existent-directory) #+END_SRC @@ -517,46 +517,46 @@ with a buffer. #+BEGIN_SRC emacs-lisp (defun rename-current-buffer-file () - "Renames current buffer and file it is visiting." - (interactive) - (let ((name (buffer-name)) - (filename (buffer-file-name))) - (if (not (and filename (file-exists-p filename))) - (error "Buffer '%s' is not visiting a file!" name) - (let ((new-name (read-file-name "New name: " filename))) - (if (get-buffer new-name) - (error "A buffer named '%s' already exists!" new-name) - (cond - ((vc-backend filename) (vc-rename-file filename new-name)) - (t (rename-file filename new-name t) - (rename-buffer new-name) - (set-visited-file-name new-name) - (set-buffer-modified-p nil) - (message "File '%s' successfully renamed to '%s'" - name (file-name-nondirectory new-name))))))))) + "Renames current buffer and file it is visiting." + (interactive) + (let ((name (buffer-name)) + (filename (buffer-file-name))) + (if (not (and filename (file-exists-p filename))) + (error "Buffer '%s' is not visiting a file!" name) + (let ((new-name (read-file-name "New name: " filename))) + (if (get-buffer new-name) + (error "A buffer named '%s' already exists!" new-name) + (cond + ((vc-backend filename) (vc-rename-file filename new-name)) + (t (rename-file filename new-name t) + (rename-buffer new-name) + (set-visited-file-name new-name) + (set-buffer-modified-p nil) + (message "File '%s' successfully renamed to '%s'" + name (file-name-nondirectory new-name))))))))) (defun delete-current-buffer-file () - "Removes file connected to current buffer and kills buffer." - (interactive) - (let ((filename (buffer-file-name))) - (if (not (and filename (file-exists-p filename))) - (kill-this-buffer) - (when (yes-or-no-p "Are you sure you want to remove this file? ") - (delete-file filename) - (kill-this-buffer) - (message "File '%s' successfully removed" filename))))) + "Removes file connected to current buffer and kills buffer." + (interactive) + (let ((filename (buffer-file-name))) + (if (not (and filename (file-exists-p filename))) + (kill-this-buffer) + (when (yes-or-no-p "Are you sure you want to remove this file? ") + (delete-file filename) + (kill-this-buffer) + (message "File '%s' successfully removed" filename))))) (defun kill-or-delete-this-buffer-dwim (&optional arg) - "Kills current buffer. With prefix arg, delete it." - (interactive "P") - (if (equal arg '(4)) - (delete-current-buffer-file) - (if server-buffer-clients - (server-edit) - (let ((buf (buffer-name))) - (when (equal buf "*HTTP Response*") - (other-window 1)) - (kill-buffer buf))))) + "Kills current buffer. With prefix arg, delete it." + (interactive "P") + (if (equal arg '(4)) + (delete-current-buffer-file) + (if server-buffer-clients + (server-edit) + (let ((buf (buffer-name))) + (when (equal buf "*HTTP Response*") + (other-window 1)) + (kill-buffer buf))))) #+END_SRC ** Whitespace Butler @@ -566,11 +566,11 @@ open it. Whitespace butler fixes whitespace only for lines that I’m editing. #+BEGIN_SRC emacs-lisp (use-package ws-butler - :if window-system - :diminish ws-butler-mode - :config (ws-butler-global-mode 1)) + :if window-system + :diminish ws-butler-mode + :config (ws-butler-global-mode 1)) (if (daemonp) - (add-hook 'before-make-frame-hook (lambda () (ws-butler-global-mode 1)))) + (add-hook 'before-make-frame-hook (lambda () (ws-butler-global-mode 1)))) #+END_SRC ** shrink-whitespace @@ -580,7 +580,7 @@ for similar things any more. #+BEGIN_SRC emacs-lisp (use-package shrink-whitespace - :bind ("M-SPC" . shrink-whitespace)) + :bind ("M-SPC" . shrink-whitespace)) #+END_SRC ** Tramp @@ -590,30 +590,30 @@ that I can sudo on remote machines #+BEGIN_SRC emacs-lisp (use-package tramp - :defer 7 - :config (progn - (unless (getenv "SSH_AUTH_SOCK") - (setenv "SSH_AUTH_SOCK" "/run/user/1000/ssh-agent.socket")) - (setq tramp-default-method "ssh" - tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root")) - tramp-backup-directory-alist backup-directory-alist - backup-enable-predicate (lambda (name) - (and (normal-backup-enable-predicate name) - (not (let ((method (file-remote-p name 'method))) - (when (stringp method) - (member method '("su" "sudo"))))))) - tramp-shell-prompt-pattern "\\(?:^\\| \\)[^]#$%>\n]*#?[]#$%>❯›] *\\(\\[[0-9;]*[a-zA-Z] *\\)*") - (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" (concat "/" tramp-default-method ":%h:"))) - (add-to-list 'tramp-default-proxies-alist `(,(regexp-quote (system-name)) nil nil)) - (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil)) - (add-to-list 'tramp-default-proxies-alist '("router" nil nil)))) + :defer 7 + :config (progn + (unless (getenv "SSH_AUTH_SOCK") + (setenv "SSH_AUTH_SOCK" "/run/user/1000/ssh-agent.socket")) + (setq tramp-default-method "ssh" + tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root")) + tramp-backup-directory-alist backup-directory-alist + backup-enable-predicate (lambda (name) + (and (normal-backup-enable-predicate name) + (not (let ((method (file-remote-p name 'method))) + (when (stringp method) + (member method '("su" "sudo"))))))) + tramp-shell-prompt-pattern "\\(?:^\\| \\)[^]#$%>\n]*#?[]#$%>❯›] *\\(\\[[0-9;]*[a-zA-Z] *\\)*") + (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" (concat "/" tramp-default-method ":%h:"))) + (add-to-list 'tramp-default-proxies-alist `(,(regexp-quote (system-name)) nil nil)) + (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil)) + (add-to-list 'tramp-default-proxies-alist '("router" nil nil)))) (use-package tramp-sh - :ensure nil - :defer t - :config (progn - (add-to-list 'tramp-remote-path "/usr/local/sbin") - (add-to-list 'tramp-remote-path "~/bin"))) + :ensure nil + :defer t + :config (progn + (add-to-list 'tramp-remote-path "/usr/local/sbin") + (add-to-list 'tramp-remote-path "~/bin"))) #+END_SRC ** ediff @@ -624,8 +624,8 @@ I like a horizonal diff setup, with everything in one frame. (use-package ediff :defer t :config (progn - (setq ediff-split-window-function 'split-window-horizontally - ediff-window-setup-function 'ediff-setup-windows-plain))) + (setq ediff-split-window-function 'split-window-horizontally + ediff-window-setup-function 'ediff-setup-windows-plain))) #+END_SRC * Indentation @@ -645,25 +645,25 @@ whitespace-sensitive language, of course. #+BEGIN_SRC emacs-lisp (use-package auto-indent-mode - :config (progn - (setq auto-indent-key-for-end-of-line-then-newline "<C-return>" - auto-indent-key-for-end-of-line-insert-char-then-newline "<C-S-return>" - auto-indent-blank-lines-on-move nil - auto-indent-assign-indent-level 4 - auto-indent-backward-delete-char-behavior nil - auto-indent-delete-trailing-whitespace-on-save-file t - auto-indent-mode-untabify-on-yank-or-paste nil - auto-indent-start-org-indent nil - auto-indent-known-indent-level-variables - (remq 'lisp-body-indent auto-indent-known-indent-level-variables)) - (add-to-list 'auto-indent-disabled-modes-list 'jinja2-mode) - (add-to-list 'auto-indent-disabled-modes-list 'yaml-mode) - (add-to-list 'auto-indent-disabled-modes-list 'saltstack-mode) - (add-to-list 'auto-indent-disabled-modes-list 'nix-mode) - (add-to-list 'auto-indent-disabled-modes-list 'coffee-mode) - (add-to-list 'auto-indent-disabled-modes-list 'yaml-mode) - (add-to-list 'auto-indent-disabled-modes-list 'ansible-mode) - (auto-indent-global-mode))) + :config (progn + (setq auto-indent-key-for-end-of-line-then-newline "<C-return>" + auto-indent-key-for-end-of-line-insert-char-then-newline "<C-S-return>" + auto-indent-blank-lines-on-move nil + auto-indent-assign-indent-level 4 + auto-indent-backward-delete-char-behavior nil + auto-indent-delete-trailing-whitespace-on-save-file t + auto-indent-mode-untabify-on-yank-or-paste nil + auto-indent-start-org-indent nil + auto-indent-known-indent-level-variables + (remq 'lisp-body-indent auto-indent-known-indent-level-variables)) + (add-to-list 'auto-indent-disabled-modes-list 'jinja2-mode) + (add-to-list 'auto-indent-disabled-modes-list 'yaml-mode) + (add-to-list 'auto-indent-disabled-modes-list 'saltstack-mode) + (add-to-list 'auto-indent-disabled-modes-list 'nix-mode) + (add-to-list 'auto-indent-disabled-modes-list 'coffee-mode) + (add-to-list 'auto-indent-disabled-modes-list 'yaml-mode) + (add-to-list 'auto-indent-disabled-modes-list 'ansible-mode) + (auto-indent-global-mode))) #+END_SRC ** smart-tabs-mode @@ -673,39 +673,39 @@ with spaces. Perfect! #+BEGIN_SRC emacs-lisp (use-package smart-tabs-mode - :defer 1 - :config (progn - (smart-tabs-insinuate 'c 'cperl 'javascript 'python) - (add-hook 'php-mode-hook (lambda () - (smart-tabs-mode indent-tabs-mode))) - (with-eval-after-load "align.el" - (smart-tabs-mode/no-tabs-mode-advice align) - (smart-tabs-mode/no-tabs-mode-advice align-regexp)) - (eval-after-load "indent.el" - '(smart-tabs-mode/no-tabs-mode-advice indent-relative)) - (eval-after-load "newcomment.el" - '(progn (smart-tabs-mode/no-tabs-mode-advice comment-dwim) - (smart-tabs-mode/no-tabs-mode-advice comment-box) - (smart-tabs-mode/no-tabs-mode-advice comment-indent))) - - (unless - (ad-find-advice 'indent-according-to-mode 'around 'smart-tabs) - (defadvice indent-according-to-mode (around smart-tabs activate) - (if smart-tabs-mode - (let ((indent-tabs-mode indent-tabs-mode)) - (if (memq indent-line-function - '(indent-relative - indent-relative-maybe)) - (setq indent-tabs-mode nil)) - ad-do-it) - ad-do-it))))) + :defer 1 + :config (progn + (smart-tabs-insinuate 'c 'cperl 'javascript 'python) + (add-hook 'php-mode-hook (lambda () + (smart-tabs-mode indent-tabs-mode))) + (with-eval-after-load "align.el" + (smart-tabs-mode/no-tabs-mode-advice align) + (smart-tabs-mode/no-tabs-mode-advice align-regexp)) + (eval-after-load "indent.el" + '(smart-tabs-mode/no-tabs-mode-advice indent-relative)) + (eval-after-load "newcomment.el" + '(progn (smart-tabs-mode/no-tabs-mode-advice comment-dwim) + (smart-tabs-mode/no-tabs-mode-advice comment-box) + (smart-tabs-mode/no-tabs-mode-advice comment-indent))) + + (unless + (ad-find-advice 'indent-according-to-mode 'around 'smart-tabs) + (defadvice indent-according-to-mode (around smart-tabs activate) + (if smart-tabs-mode + (let ((indent-tabs-mode indent-tabs-mode)) + (if (memq indent-line-function + '(indent-relative + indent-relative-maybe)) + (setq indent-tabs-mode nil)) + ad-do-it) + ad-do-it))))) #+END_SRC ** editorconfig #+BEGIN_SRC emacs-lisp (use-package editorconfig - :config (editorconfig-mode 1)) + :config (editorconfig-mode 1)) #+END_SRC ** dtrt-indent-mode @@ -715,15 +715,15 @@ guesses the correct settings for me. #+BEGIN_SRC emacs-lisp (use-package dtrt-indent - :config (progn - (defun ap/dtrt-adapt-if-needed () - (unless editorconfig-mode - (dtrt-indent-adapt))) - (if (fboundp #'editorconfig-mode) - (add-hook 'after-change-major-mode-hook #'ap/dtrt-adapt-if-needed) - (add-hook 'after-change-major-mode-hook #'dtrt-indent-adapt)) - (defadvice dtrt-indent-try-set-offset (after toggle-smart-tabs activate) - (smart-tabs-mode (or indent-tabs-mode -1))))) + :config (progn + (defun ap/dtrt-adapt-if-needed () + (unless editorconfig-mode + (dtrt-indent-adapt))) + (if (fboundp #'editorconfig-mode) + (add-hook 'after-change-major-mode-hook #'ap/dtrt-adapt-if-needed) + (add-hook 'after-change-major-mode-hook #'dtrt-indent-adapt)) + (defadvice dtrt-indent-try-set-offset (after toggle-smart-tabs activate) + (smart-tabs-mode (or indent-tabs-mode -1))))) #+END_SRC * Security @@ -733,9 +733,9 @@ guesses the correct settings for me. This is a frontend to the GPG-powered =pass= program. #+BEGIN_SRC emacs-lisp (use-package password-store - :defer 15 - :config (progn - (setq password-store-password-length 16))) + :defer 15 + :config (progn + (setq password-store-password-length 16))) #+END_SRC * Buffers @@ -747,42 +747,42 @@ often though, as it doesn’t really work with perspectives. (use-package ibuffer :bind (("C-x C-b" . ibuffer)) :config (progn - (setq ibuffer-saved-filter-groups - (quote (("default" - ("org" (mode . org-mode)) - ("emacs" (mode . emacs-lisp-mode)) - ("zsh" (filename . "/zsh")) - ("server" (filename . "/su:root@server")))))) - - ;; Human-readable base-2 size column - (define-ibuffer-column size-h - (:name "Size" :inline t) - (cond - ((> (buffer-size) 1024) - (format "%7.2fK" (/ (buffer-size) 1024.0))) - ((> (buffer-size) 1048576) - (format "%7.2fM" (/ (buffer-size) 1048576.0))) - (t - (format "%8d" (buffer-size))))) - - (setq ibuffer-formats - '((mark modified read-only " " - (name 18 18 :left :elide) - " " - (size-h 9 -1 :right) - " " - (mode 16 16 :left :elide) - " " - filename-and-process))))) + (setq ibuffer-saved-filter-groups + (quote (("default" + ("org" (mode . org-mode)) + ("emacs" (mode . emacs-lisp-mode)) + ("zsh" (filename . "/zsh")) + ("server" (filename . "/su:root@server")))))) + + ;; Human-readable base-2 size column + (define-ibuffer-column size-h + (:name "Size" :inline t) + (cond + ((> (buffer-size) 1024) + (format "%7.2fK" (/ (buffer-size) 1024.0))) + ((> (buffer-size) 1048576) + (format "%7.2fM" (/ (buffer-size) 1048576.0))) + (t + (format "%8d" (buffer-size))))) + + (setq ibuffer-formats + '((mark modified read-only " " + (name 18 18 :left :elide) + " " + (size-h 9 -1 :right) + " " + (mode 16 16 :left :elide) + " " + filename-and-process))))) #+END_SRC ** Relative Buffer names #+BEGIN_SRC emacs-lisp (use-package relative-buffers - :defer 15 - :config (progn - (global-relative-buffers-mode))) + :defer 15 + :config (progn + (global-relative-buffers-mode))) #+END_SRC ** Narrowing @@ -803,18 +803,18 @@ I don’t often have many windows open at once, but when I do, (use-package ace-window :bind (("s-s" . ace-window)) :config (progn - (setq aw-dispatch-always t - aw-dispatch-alist '((?k aw-delete-window " Ace - Delete Window") - (?K aw-delete-window) - (?m aw-swap-window " Ace - Swap Window") - (?f aw-flip-window) - (?v aw-split-window-vert " Ace - Split Vert Window") - (?b aw-split-window-horz " Ace - Split Horz Window") - (?m delete-other-windows " Ace - Maximize Window") - (?l delete-other-windows) - (?, winner-undo) - (?. winner-redo)) - aw-keys '(?a ?r ?s ?t ?n ?e ?i ?o)))) + (setq aw-dispatch-always t + aw-dispatch-alist '((?k aw-delete-window " Ace - Delete Window") + (?K aw-delete-window) + (?m aw-swap-window " Ace - Swap Window") + (?f aw-flip-window) + (?v aw-split-window-vert " Ace - Split Vert Window") + (?b aw-split-window-horz " Ace - Split Horz Window") + (?m delete-other-windows " Ace - Maximize Window") + (?l delete-other-windows) + (?, winner-undo) + (?. winner-redo)) + aw-keys '(?a ?r ?s ?t ?n ?e ?i ?o)))) #+END_SRC * Windows @@ -824,14 +824,14 @@ point whilst I’m moving about. #+BEGIN_SRC emacs-lisp (setq scroll-conservatively 100 - scroll-margin 1 - scroll-preserve-screen-position t - mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control))) - split-height-threshold 80 - split-width-threshold 130 - frame-resize-pixelwise nil) + scroll-margin 1 + scroll-preserve-screen-position t + mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control))) + split-height-threshold 80 + split-width-threshold 130 + frame-resize-pixelwise nil) (if (boundp 'ns-pop-up-frames) - (setq ns-pop-up-frames nil)) + (setq ns-pop-up-frames nil)) #+END_SRC ** winner @@ -841,8 +841,8 @@ Undo, for window-based commands. #+BEGIN_SRC emacs-lisp (use-package winner :init (progn - (winner-mode 1) - (setq winner-boring-buffers '("*Completions*" "*Help*" "*Apropos*" "*Buffer List*" "*info*" "*Compile-Log*")))) + (winner-mode 1) + (setq winner-boring-buffers '("*Completions*" "*Help*" "*Apropos*" "*Buffer List*" "*info*" "*Compile-Log*")))) #+END_SRC ** windmove @@ -852,9 +852,9 @@ Directional window movement #+BEGIN_SRC emacs-lisp (use-package windmove :bind (("S-<left>" . windmove-left) - ("S-<right>" . windmove-right) - ("S-<up>" . windmove-up) - ("S-<down>" . windmove-down))) + ("S-<right>" . windmove-right) + ("S-<up>" . windmove-up) + ("S-<down>" . windmove-down))) #+END_SRC * Completion @@ -863,8 +863,8 @@ and initial-based completion and ignoring case. #+BEGIN_SRC emacs-lisp (setq completion-styles '(basic initials partial-completion substring) - completion-ignore-case t - tab-always-indent 'complete) + completion-ignore-case t + tab-always-indent 'complete) #+END_SRC ** Company @@ -875,28 +875,28 @@ seems to work perfectly well for me. #+BEGIN_SRC emacs-lisp (use-package company - :commands (company-mode) - :diminish "Cmpl" - :bind (("C-<tab>" . company-complete) - ("TAB" . company-indent-or-complete-common)) - :init (progn - (add-hook 'prog-mode-hook #'company-mode) - (setq company-backends '(company-bbdb company-web-html company-tern company-nxml company-css company-eclim company-semantic company-elisp - company-clang company-xcode company-cmake company-capf - company-files (company-dabbrev-code company-gtags - company-etags company-keywords) company-oddmuse - company-dabbrev) - company-idle-delay .3 - company-begin-commands '(self-insert-command) - company-auto-complete #'company-explicit-action-p - company-auto-complete-chars '(?\ ?\( ?\) ?.) - company-tooltip-align-annotations t - company-dabbrev-downcase nil))) + :commands (company-mode) + :diminish "Cmpl" + :bind (("C-<tab>" . company-complete) + ("TAB" . company-indent-or-complete-common)) + :init (progn + (add-hook 'prog-mode-hook #'company-mode) + (setq company-backends '(company-bbdb company-web-html company-tern company-nxml company-css company-eclim company-semantic company-elisp + company-clang company-xcode company-cmake company-capf + company-files (company-dabbrev-code company-gtags + company-etags company-keywords) company-oddmuse + company-dabbrev) + company-idle-delay .3 + company-begin-commands '(self-insert-command) + company-auto-complete #'company-explicit-action-p + company-auto-complete-chars '(?\ ?\( ?\) ?.) + company-tooltip-align-annotations t + company-dabbrev-downcase nil))) #+END_SRC #+BEGIN_SRC emacs-lisp (use-package company-web - :after company) + :after company) #+END_SRC * Dates & Times @@ -906,12 +906,12 @@ seems to work perfectly well for me. Weeks start on Monday for me and I prefer ISO-style dates. #+BEGIN_SRC emacs-lisp (use-package calendar - :defer 1 - :config (progn - (setq calendar-week-start-day 1) - (calendar-set-date-style 'iso) - (setq calendar-latitude 52.52 - calendar-longitude 13.40))) + :defer 1 + :config (progn + (setq calendar-week-start-day 1) + (calendar-set-date-style 'iso) + (setq calendar-latitude 52.52 + calendar-longitude 13.40))) #+END_SRC Sometimes I want to insert a date or time into a buffer. @@ -921,24 +921,24 @@ Sometimes I want to insert a date or time into a buffer. two prefix arguments, write out the day and month name." (interactive "P") (let ((format (cond - ((not prefix) "%Y-%m-%d") - ((equal prefix '(4)) "%d/%m/%Y") - ((equal prefix '(16)) "%A, %d %B %Y")))) - (insert (format-time-string format)))) + ((not prefix) "%Y-%m-%d") + ((equal prefix '(4)) "%d/%m/%Y") + ((equal prefix '(16)) "%A, %d %B %Y")))) + (insert (format-time-string format)))) (defun insert-datetime (prefix) "Insert the current date and time." (interactive "P") (let ((format (cond - ((not prefix) "%Y-%m-%d %H:%M:%S") - ((equal prefix '(4)) "%Y-%m-%dT%H:%M:%SZ")))) - (insert (format-time-string format)))) + ((not prefix) "%Y-%m-%d %H:%M:%S") + ((equal prefix '(4)) "%Y-%m-%dT%H:%M:%SZ")))) + (insert (format-time-string format)))) #+END_SRC #+BEGIN_SRC emacs-lisp (defun yesterday-time () - "Provide the date/time 24 hours before the time now in the format of current-time." - (timer-relative-time (current-time) -86400)) + "Provide the date/time 24 hours before the time now in the format of current-time." + (timer-relative-time (current-time) -86400)) #+END_SRC * Directories @@ -953,64 +953,64 @@ copying/moving files between them. :defer 3 :ensure nil :config (progn - (bind-key "<return>" #'dired-find-file dired-mode-map) - (bind-key "^" (lambda () (interactive) (find-alternate-file "..")) dired-mode-map) - (setq dired-dwim-target t - dired-recursive-copies 'top - dired-recursive-deletes 'top - dired-listing-switches "-alh" - dired-bind-jump nil) - (when (and (eq system-type 'darwin) (executable-find "gls")) - (setq insert-directory-program (executable-find "gls"))) - (put 'dired-find-alternate-file 'disabled nil))) + (bind-key "<return>" #'dired-find-file dired-mode-map) + (bind-key "^" (lambda () (interactive) (find-alternate-file "..")) dired-mode-map) + (setq dired-dwim-target t + dired-recursive-copies 'top + dired-recursive-deletes 'top + dired-listing-switches "-alh" + dired-bind-jump nil) + (when (and (eq system-type 'darwin) (executable-find "gls")) + (setq insert-directory-program (executable-find "gls"))) + (put 'dired-find-alternate-file 'disabled nil))) #+END_SRC Don’t show uninteresting files in dired listings. #+BEGIN_SRC emacs-lisp (defun turn-on-dired-omit-mode () - (interactive) - (dired-omit-mode 1)) + (interactive) + (dired-omit-mode 1)) (use-package dired-x - :commands (dired-omit-mode - dired-expunge) - :ensure nil - :config (progn - (setq dired-omit-files "#\\|\\.$" - dired-omit-verbose nil - dired-find-subdir t)) - :init (progn - (add-hook 'dired-mode-hook #'turn-on-dired-omit-mode))) + :commands (dired-omit-mode + dired-expunge) + :ensure nil + :config (progn + (setq dired-omit-files "#\\|\\.$" + dired-omit-verbose nil + dired-find-subdir t)) + :init (progn + (add-hook 'dired-mode-hook #'turn-on-dired-omit-mode))) #+END_SRC #+BEGIN_SRC emacs-lisp (use-package dired+ - :defer 5 - :config (progn - (diredp-toggle-find-file-reuse-dir 1) - (unbind-key "C-h C-m" dired-mode-map))) + :defer 5 + :config (progn + (diredp-toggle-find-file-reuse-dir 1) + (unbind-key "C-h C-m" dired-mode-map))) #+END_SRC Expand subfolders like a tree inside the parent #+BEGIN_SRC emacs-lisp (with-eval-after-load 'dired - (use-package dired-subtree - :functions (dired-subtree--get-ov - dired-subtree-maybe-up) - :init (progn - (setq dired-subtree-use-backgrounds nil) - (defun dired-subtree-maybe-up () - "Jump up one subtree or directory" - (interactive) - (let ((ov (dired-subtree--get-ov))) - (if ov - (progn (goto-char (overlay-start ov)) - (dired-previous-line 1)) - (dired-up-directory)))) - (bind-key "^" #'dired-subtree-maybe-up dired-mode-map) - (bind-key "i" #'dired-subtree-toggle dired-mode-map)))) + (use-package dired-subtree + :functions (dired-subtree--get-ov + dired-subtree-maybe-up) + :init (progn + (setq dired-subtree-use-backgrounds nil) + (defun dired-subtree-maybe-up () + "Jump up one subtree or directory" + (interactive) + (let ((ov (dired-subtree--get-ov))) + (if ov + (progn (goto-char (overlay-start ov)) + (dired-previous-line 1)) + (dired-up-directory)))) + (bind-key "^" #'dired-subtree-maybe-up dired-mode-map) + (bind-key "i" #'dired-subtree-toggle dired-mode-map)))) #+END_SRC ** Dired-narrow @@ -1022,9 +1022,9 @@ the buffer, removing the filter. #+BEGIN_SRC emacs-lisp (with-eval-after-load 'dired - (use-package dired-narrow - :bind (:map dired-mode-map - ("/" . dired-narrow)))) + (use-package dired-narrow + :bind (:map dired-mode-map + ("/" . dired-narrow)))) #+END_SRC * Documentation @@ -1036,7 +1036,7 @@ improves the normal help commands, mostly by making quitting them easier. #+BEGIN_SRC emacs-lisp (use-package ehelp - :bind-keymap ("C-h" . ehelp-map)) + :bind-keymap ("C-h" . ehelp-map)) #+END_SRC ** counsel-dash @@ -1088,10 +1088,10 @@ Popup keybindings following a prefix automatically. #+BEGIN_SRC emacs-lisp (use-package which-key - :diminish which-key-mode - :config (progn - (which-key-mode 1) - (which-key-setup-side-window-right-bottom))) + :diminish which-key-mode + :config (progn + (which-key-mode 1) + (which-key-setup-side-window-right-bottom))) #+END_SRC ** eldoc @@ -1104,52 +1104,52 @@ rather useful. :commands (eldoc-mode) :diminish eldoc-mode :config (progn - (setq eldoc-idle-delay 0.1) - (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) + (setq eldoc-idle-delay 0.1) + (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) #+END_SRC * Misc #+BEGIN_SRC emacs-lisp (defvar *init-file* - (let ((init-file (or user-init-file - (expand-file-name "init.el" user-emacs-directory)))) - (expand-file-name "init.el" - (file-name-directory (file-truename init-file)))) - "Where the emacs init file really is, passing through symlinks.") + (let ((init-file (or user-init-file + (expand-file-name "init.el" user-emacs-directory)))) + (expand-file-name "init.el" + (file-name-directory (file-truename init-file)))) + "Where the emacs init file really is, passing through symlinks.") (set-register ?e `(file . ,*init-file*)) (defun ap/remove-extra-cr () - "Remove extraneous CR codes from a file" - (interactive) - (save-excursion - (goto-char (point-min)) - (while (search-forward " + "Remove extraneous CR codes from a file" + (interactive) + (save-excursion + (goto-char (point-min)) + (while (search-forward " " nil t) - (replace-match "")))) + (replace-match "")))) (use-package rect - :ensure nil - :init (defun copy-rectangle (start end) - "Copy the region-rectangle." - (interactive "r") - (setq killed-rectangle (extract-rectangle start end)))) + :ensure nil + :init (defun copy-rectangle (start end) + "Copy the region-rectangle." + (interactive "r") + (setq killed-rectangle (extract-rectangle start end)))) (defun shell-execute (to-current-buffer) - (interactive "P") - (let ((file-buffer (if (buffer-file-name) - (file-name-nondirectory (buffer-file-name)) - "")) - (command (read-shell-command "Shell command: " nil nil nil))) - (shell-command (replace-regexp-in-string "%" file-buffer command) to-current-buffer))) + (interactive "P") + (let ((file-buffer (if (buffer-file-name) + (file-name-nondirectory (buffer-file-name)) + "")) + (command (read-shell-command "Shell command: " nil nil nil))) + (shell-command (replace-regexp-in-string "%" file-buffer command) to-current-buffer))) (defun narrow-to-region-indirect (start end) - "Restrict editing in this buffer to the current region, indirectly." - (interactive "r") - (deactivate-mark) - (let ((buf (clone-indirect-buffer nil nil))) - (with-current-buffer buf - (narrow-to-region start end)) - (switch-to-buffer buf))) + "Restrict editing in this buffer to the current region, indirectly." + (interactive "r") + (deactivate-mark) + (let ((buf (clone-indirect-buffer nil nil))) + (with-current-buffer buf + (narrow-to-region start end)) + (switch-to-buffer buf))) (bind-key* "M-!" #'shell-execute) (bind-key* "C-x r M-w" #'copy-rectangle) @@ -1177,7 +1177,7 @@ the prompt. I don’t remember what exactly. Occasionally, I exit emacs. I should probably reduce the frequency of this. #+BEGIN_SRC emacs-lisp (if (daemonp) - (defalias 'exit-emacs #'delete-frame) + (defalias 'exit-emacs #'delete-frame) (defalias 'exit-emacs #'save-buffers-kill-emacs)) #+END_SRC @@ -1232,27 +1232,27 @@ replacement for helm so far. #+BEGIN_SRC emacs-lisp (use-package counsel - :config (progn - (bind-key "M-x" #'counsel-M-x) - (bind-key "<apps>" #'counsel-M-x) - (bind-key "<menu>" #'counsel-M-x) - (bind-key "C-c M-x" #'execute-extended-command) - (bind-key "C-x C-f" #'counsel-find-file) - (bind-key "C-x b" #'counsel-switch-to-persp-buffer) - (defadvice counsel-find-file (after find-file-sudo activate) - "Find file as root if necessary." - (when (and buffer-file-name - (not (file-writable-p buffer-file-name))) - (message "File not writable %s" buffer-file-name) - (find-alternate-file (concat "/sudo::" buffer-file-name)))) - (defun counsel-switch-to-persp-buffer (arg) - "Forward to `persp-switch-to-buffer'." - (interactive "P") - (ivy-read (format "Switch to buffer [%s]: " (persp-name persp-curr)) - (remq nil (mapcar #'buffer-name (persp-buffers persp-curr))) - :preselect (buffer-name (other-buffer (current-buffer))) - :action #'ivy--switch-buffer-action - :keymap ivy-switch-buffer-map)))) + :config (progn + (bind-key "M-x" #'counsel-M-x) + (bind-key "<apps>" #'counsel-M-x) + (bind-key "<menu>" #'counsel-M-x) + (bind-key "C-c M-x" #'execute-extended-command) + (bind-key "C-x C-f" #'counsel-find-file) + (bind-key "C-x b" #'counsel-switch-to-persp-buffer) + (defadvice counsel-find-file (after find-file-sudo activate) + "Find file as root if necessary." + (when (and buffer-file-name + (not (file-writable-p buffer-file-name))) + (message "File not writable %s" buffer-file-name) + (find-alternate-file (concat "/sudo::" buffer-file-name)))) + (defun counsel-switch-to-persp-buffer (arg) + "Forward to `persp-switch-to-buffer'." + (interactive "P") + (ivy-read (format "Switch to buffer [%s]: " (persp-name persp-curr)) + (remq nil (mapcar #'buffer-name (persp-buffers persp-curr))) + :preselect (buffer-name (other-buffer (current-buffer))) + :action #'ivy--switch-buffer-action + :keymap ivy-switch-buffer-map)))) #+END_SRC @@ -1264,20 +1264,20 @@ don’t use it directly. #+BEGIN_SRC emacs-lisp (use-package smex - :commands (smex - smex-update - smex-initialize) - :config (progn - (setq smex-key-advice-ignore-menu-bar t - smex-auto-update nil) - (defun smex-update-after-load (_unused) - (if (boundp 'smex-cache) - (smex-update))) - (add-hook 'after-load-functions 'smex-update-after-load)) - :init (progn - (setq smex-history-length 100 - smex-save-file (concat user-emacs-directory - "smex-items")))) + :commands (smex + smex-update + smex-initialize) + :config (progn + (setq smex-key-advice-ignore-menu-bar t + smex-auto-update nil) + (defun smex-update-after-load (_unused) + (if (boundp 'smex-cache) + (smex-update))) + (add-hook 'after-load-functions 'smex-update-after-load)) + :init (progn + (setq smex-history-length 100 + smex-save-file (concat user-emacs-directory + "smex-items")))) #+END_SRC * Modes @@ -1299,55 +1299,55 @@ Some modes that I don’t really customise much, mostly for configuration files. #+BEGIN_SRC emacs-lisp (use-package xrdb-mode - :ensure nil - :mode (("\\.Xdefaults\\'" . xrdb-mode) - ("\\.Xresources\\'" . xrdb-mode))) + :ensure nil + :mode (("\\.Xdefaults\\'" . xrdb-mode) + ("\\.Xresources\\'" . xrdb-mode))) (use-package haskell-mode - :mode (("\\.hs\\'" . haskell-mode))) + :mode (("\\.hs\\'" . haskell-mode))) (use-package dockerfile-mode - :mode (("Dockerfile\\'" . dockerfile-mode))) + :mode (("Dockerfile\\'" . dockerfile-mode))) (use-package nix-mode - :mode (("\\.nix\\'" . nix-mode)) - :config (progn - (add-hook 'nix-mode-hook (lambda () - (setq-local indent-tabs-mode nil))))) + :mode (("\\.nix\\'" . nix-mode)) + :config (progn + (add-hook 'nix-mode-hook (lambda () + (setq-local indent-tabs-mode nil))))) (define-derived-mode xmonad-mode haskell-mode "XM") (add-to-list 'auto-mode-alist '("xmobarrc\\'" . xmonad-mode)) (add-to-list 'auto-mode-alist '("xmonad.hs\\'" . xmonad-mode)) (use-package nginx-mode - :defer t - :mode (("/nginx/servers/" . nginx-mode) - ("/nginx/.*\\.d/" . nginx-mode)) - :config (progn - (setq nginx-indent-tabs-mode t))) + :defer t + :mode (("/nginx/servers/" . nginx-mode) + ("/nginx/.*\\.d/" . nginx-mode)) + :config (progn + (setq nginx-indent-tabs-mode t))) (use-package lua-mode - :defer t) + :defer t) (use-package ruby-mode - :mode (("\\.rb\\'" . ruby-mode) - ("\\.cap\\'" . ruby-mode))) + :mode (("\\.rb\\'" . ruby-mode) + ("\\.cap\\'" . ruby-mode))) (use-package go-mode - :mode (("\\.go\\'" . go-mode))) + :mode (("\\.go\\'" . go-mode))) (use-package jinja2-mode - :mode (("\\.j2\\'" . jinja2-mode) - ("\\.jinja\\'" . jinja2-mode))) + :mode (("\\.j2\\'" . jinja2-mode) + ("\\.jinja\\'" . jinja2-mode))) (use-package scss-mode - :defer t - :config (progn - (setq scss-compile-at-save nil))) + :defer t + :config (progn + (setq scss-compile-at-save nil))) (use-package yaml-mode - :mode (("/group_vars/.*" . yaml-mode) - ("/host_vars/.*" . yaml-mode))) + :mode (("/group_vars/.*" . yaml-mode) + ("/host_vars/.*" . yaml-mode))) (define-derived-mode ansible-mode yaml-mode "Ansible") (add-to-list 'auto-mode-alist '("\\(?:ansible.+\\|roles/.+/\\(?:tasks\\|handlers\\)\\)/.+\\.yml\\'" . ansible-mode)) @@ -1363,38 +1363,38 @@ works really nicely. #+BEGIN_SRC emacs-lisp (use-package ledger-mode - :mode ("\\.ledger\\'" . ledger-mode) - :init (progn - (defun open-budget () - (interactive) - (projectile-persp-switch-project "~/Sync") - (find-file (expand-file-name "ledger/my.ledger" (projectile-project-root))) - (ledger-report "Budget (Cumulative)" nil))) - :config (progn - (defun setup-ledger-mode () - (setq-local indent-tabs-mode nil)) - (add-hook 'ledger-mode-hook #'setup-ledger-mode) - (setq ledger-use-iso-dates t - ledger-post-use-completion-engine :built-in - ledger-reconcile-default-commodity "€" - ledger-clear-whole-transactions t - ledger-narrow-on-reconcile t - ledger-default-date-format "%Y-%m-%d" - ledger-reports '(("Monthly Expenses" "ledger -f %(ledger-file) reg -M Expenses --real -l \"payee != 'Opening Balances'\"") - ("Expenses:This Month" "ledger -f %(ledger-file) bal \\^Expenses -p \"this month\"") - ("On-budget Balances" "ledger -f %(ledger-file) bal --current -R :Budget: Assets:Receivable Liabilities:Personal") - ("All Account Balances" "ledger -f %(ledger-file) bal --current -R \\^Assets \\^Liabilities") - ("Budget Values (Current Month)" "ledger -f %(ledger-file) bal -p \"this month\" --limit \"payee=~/budget/\" \\^Funds") - ("Budget (Cumulative)" "ledger -f %(ledger-file) bal -E \\^Funds") - ("Budget Allocation" "ledger -f %(ledger-file) bal -p \"this month\" --limit \"payee=~/budget/\" \\^Funds --format \"\\ - %-17((depth_spacer)+(partial_account))\\ - %10(percent(market(display_total), market(parent.total)))\\ - %16(market(display_total))\n%/\"") - ("bal" "ledger -f %(ledger-file) bal") - ("reg" "ledger -f %(ledger-file) reg") - ("equity" "ledger -f %(ledger-file) equity") - ("payee" "ledger -f %(ledger-file) reg @%(payee)") - ("account" "ledger -f %(ledger-file) reg %(account)"))))) + :mode ("\\.ledger\\'" . ledger-mode) + :init (progn + (defun open-budget () + (interactive) + (projectile-persp-switch-project "~/Sync") + (find-file (expand-file-name "ledger/my.ledger" (projectile-project-root))) + (ledger-report "Budget (Cumulative)" nil))) + :config (progn + (defun setup-ledger-mode () + (setq-local indent-tabs-mode nil)) + (add-hook 'ledger-mode-hook #'setup-ledger-mode) + (setq ledger-use-iso-dates t + ledger-post-use-completion-engine :built-in + ledger-reconcile-default-commodity "€" + ledger-clear-whole-transactions t + ledger-narrow-on-reconcile t + ledger-default-date-format "%Y-%m-%d" + ledger-reports '(("Monthly Expenses" "ledger -f %(ledger-file) reg -M Expenses --real -l \"payee != 'Opening Balances'\"") + ("Expenses:This Month" "ledger -f %(ledger-file) bal \\^Expenses -p \"this month\"") + ("On-budget Balances" "ledger -f %(ledger-file) bal --current -R :Budget: Assets:Receivable Liabilities:Personal") + ("All Account Balances" "ledger -f %(ledger-file) bal --current -R \\^Assets \\^Liabilities") + ("Budget Values (Current Month)" "ledger -f %(ledger-file) bal -p \"this month\" --limit \"payee=~/budget/\" \\^Funds") + ("Budget (Cumulative)" "ledger -f %(ledger-file) bal -E \\^Funds") + ("Budget Allocation" "ledger -f %(ledger-file) bal -p \"this month\" --limit \"payee=~/budget/\" \\^Funds --format \"\\ + %-17((depth_spacer)+(partial_account))\\ + %10(percent(market(display_total), market(parent.total)))\\ + %16(market(display_total))\n%/\"") + ("bal" "ledger -f %(ledger-file) bal") + ("reg" "ledger -f %(ledger-file) reg") + ("equity" "ledger -f %(ledger-file) equity") + ("payee" "ledger -f %(ledger-file) reg @%(payee)") + ("account" "ledger -f %(ledger-file) reg %(account)"))))) #+END_SRC ** Markdown @@ -1403,7 +1403,7 @@ works really nicely. (use-package markdown-mode :defer t :config (progn - (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) + (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) #+END_SRC ** Org @@ -1414,60 +1414,60 @@ Org is wünderbar. #+BEGIN_SRC emacs-lisp (use-package org - :bind (("C-c C-a" . org-agenda-list) - ("C-c a" . org-agenda) - ("C-c l" . org-store-link)) - :defer 8 - :init (setq org-replace-disputed-keys t - org-ellipsis "…") - :config (progn - (setq org-directory "~/Sync/org" - org-agenda-files `(,(concat org-directory "/agenda")) + :bind (("C-c C-a" . org-agenda-list) + ("C-c a" . org-agenda) + ("C-c l" . org-store-link)) + :defer 8 + :init (setq org-replace-disputed-keys t + org-ellipsis "…") + :config (progn + (setq org-directory "~/Sync/org" + org-agenda-files `(,(concat org-directory "/agenda")) - org-default-notes-file (concat org-directory "/notes") + org-default-notes-file (concat org-directory "/notes") - ;; ‘Remember’: new items at top - org-reverse-note-order t + ;; ‘Remember’: new items at top + org-reverse-note-order t - org-modules '(org-habit - org-protocol) + org-modules '(org-habit + org-protocol) - ;; Add time done to ‘done’ tasks - org-log-done 'time + ;; Add time done to ‘done’ tasks + org-log-done 'time - ;; Allow refiling into any org file - org-refile-targets '((org-agenda-files :maxlevel . 3)) + ;; Allow refiling into any org file + org-refile-targets '((org-agenda-files :maxlevel . 3)) - org-list-allow-alphabetical t + org-list-allow-alphabetical t - org-adapt-indentation nil + org-adapt-indentation nil - org-pretty-entities t + org-pretty-entities t - org-table-duration-custom-format 'seconds + org-table-duration-custom-format 'seconds - org-src-fontify-natively nil + org-src-fontify-natively nil - org-export-have-math t + org-export-have-math t - org-blank-before-new-entry '((heading . t) - (plain-list-item . auto)) - org-fontify-done-headline t + org-blank-before-new-entry '((heading . t) + (plain-list-item . auto)) + org-fontify-done-headline t - org-todo-keywords '((sequence "BACKLOG(b)" "TODO(t)" "WAIT(w@/!)" "STARTED(s!)" "|" "DONE(d!)") - (sequence "|" "CANCELLED(c@)")) - org-log-into-drawer "LOGBOOK") - (set-register ?o `(file . ,(expand-file-name "organiser.org" org-directory))) - (add-hook 'org-mode-hook #'turn-on-auto-fill) - (org-load-modules-maybe t) - (defadvice org-clock-in (after wicked activate) - "Mark STARTED when clocked in" - (save-excursion - (catch 'exit - (org-back-to-heading t) - (if (looking-at org-outline-regexp) (goto-char (1- (match-end 0)))) - (if (looking-at (concat " +" org-todo-regexp "\\( +\\|[ \t]*$\\)")) - (org-todo "STARTED"))))) + org-todo-keywords '((sequence "BACKLOG(b)" "TODO(t)" "WAIT(w@/!)" "STARTED(s!)" "|" "DONE(d!)") + (sequence "|" "CANCELLED(c@)")) + org-log-into-drawer "LOGBOOK") + (set-register ?o `(file . ,(expand-file-name "organiser.org" org-directory))) + (add-hook 'org-mode-hook #'turn-on-auto-fill) + (org-load-modules-maybe t) + (defadvice org-clock-in (after wicked activate) + "Mark STARTED when clocked in" + (save-excursion + (catch 'exit + (org-back-to-heading t) + (if (looking-at org-outline-regexp) (goto-char (1- (match-end 0)))) + (if (looking-at (concat " +" org-todo-regexp "\\( +\\|[ \t]*$\\)")) + (org-todo "STARTED"))))) #+END_SRC **** org-babel @@ -1482,9 +1482,9 @@ with R or something. :defer t :ensure nil :config (org-babel-do-load-languages - 'org-babel-load-languages - '((ledger . t) - (sh . t)))) + 'org-babel-load-languages + '((ledger . t) + (sh . t)))) #+END_SRC **** org-journal @@ -1493,57 +1493,57 @@ I can use this to keep a journal. I should use it. #+BEGIN_SRC emacs-lisp (use-package org-journal - :bind ("s-j" . org-journal-new-entry) - :defer 20 - :config (progn - (setq org-journal-date-format "%A, %d %B %Y") - (defun org-journal-display-entry-yesterday () - "Show org-journal entry for yesterday" - (interactive) - (org-journal-read-or-display-entry (yesterday-time))))) + :bind ("s-j" . org-journal-new-entry) + :defer 20 + :config (progn + (setq org-journal-date-format "%A, %d %B %Y") + (defun org-journal-display-entry-yesterday () + "Show org-journal entry for yesterday" + (interactive) + (org-journal-read-or-display-entry (yesterday-time))))) #+END_SRC **** org-mobile #+BEGIN_SRC emacs-lisp (defun ap/org-mobile-pull (descriptor action file) - (org-mobile-pull)) + (org-mobile-pull)) (use-package org-mobile - :defer 30 - :ensure nil - :disabled t - :config (progn - (setq org-mobile-directory "~/Mobile/Org" - org-mobile-inbox-for-pull "~/Mobile/Org/from-mobile.org") - (defvar org-mobile-push-timer nil - "Timer that `org-mobile-push-timer' used to reschedule itself, or nil.") - - (defun org-mobile-push-with-delay (secs) - (when org-mobile-push-timer - (cancel-timer org-mobile-push-timer)) - (setq org-mobile-push-timer - (run-with-idle-timer - (* 1 secs) nil 'org-mobile-push))) - - (add-hook 'after-save-hook - (lambda () - (when (eq major-mode 'org-mode) - (dolist (file (org-mobile-files-alist)) - (if (string= (file-truename (expand-file-name (car file))) - (file-truename (buffer-file-name))) - (org-mobile-push-with-delay 30)))))) - - (run-at-time "00:05" 86400 '(lambda () (org-mobile-push-with-delay 1))) ;; refreshes agenda file each day - (org-mobile-pull) ;; run org-mobile-pull at startup - - (defvar org-mobile-watcher nil) - (when file-notify--library - (let ((org-file (expand-file-name - (concat - (file-name-as-directory org-mobile-directory) - org-mobile-capture-file)))) - (setq org-mobile-watcher - (file-notify-add-watch org-file '(change) #'ap/org-mobile-pull)))))))) + :defer 30 + :ensure nil + :disabled t + :config (progn + (setq org-mobile-directory "~/Mobile/Org" + org-mobile-inbox-for-pull "~/Mobile/Org/from-mobile.org") + (defvar org-mobile-push-timer nil + "Timer that `org-mobile-push-timer' used to reschedule itself, or nil.") + + (defun org-mobile-push-with-delay (secs) + (when org-mobile-push-timer + (cancel-timer org-mobile-push-timer)) + (setq org-mobile-push-timer + (run-with-idle-timer + (* 1 secs) nil 'org-mobile-push))) + + (add-hook 'after-save-hook + (lambda () + (when (eq major-mode 'org-mode) + (dolist (file (org-mobile-files-alist)) + (if (string= (file-truename (expand-file-name (car file))) + (file-truename (buffer-file-name))) + (org-mobile-push-with-delay 30)))))) + + (run-at-time "00:05" 86400 '(lambda () (org-mobile-push-with-delay 1))) ;; refreshes agenda file each day + (org-mobile-pull) ;; run org-mobile-pull at startup + + (defvar org-mobile-watcher nil) + (when file-notify--library + (let ((org-file (expand-file-name + (concat + (file-name-as-directory org-mobile-directory) + org-mobile-capture-file)))) + (setq org-mobile-watcher + (file-notify-add-watch org-file '(change) #'ap/org-mobile-pull)))))))) #+END_SRC **** org-caldav @@ -1554,18 +1554,27 @@ write to the Android calendar, and then for DAVDroid to sync with the server. #+BEGIN_SRC emacs-lisp (use-package org-caldav - :defer 30 - :config (progn - (setq org-caldav-url "https://calendar.alanpearce.uk/alan" - org-caldav-calendar-id "caldav" - org-caldav-inbox (concat org-directory "/agenda/caldav.org") - org-caldav-files `(,(concat org-directory "/agenda/organiser.org")) - org-icalendar-timezone "Europe/Berlin" - org-icalendar-use-scheduled '(event-if-todo event-if-not-todo todo-start) - org-icalendar-use-deadline '(event-if-todo event-if-not-todo todo-due) - org-icalendar-alarm-time 60))) + :defer 30 + :config (progn + (setq org-caldav-url "https://calendar.alanpearce.uk/alan" + org-caldav-calendar-id "caldav" + org-caldav-inbox (concat org-directory "/agenda/caldav.org") + org-caldav-files `(,(concat org-directory "/agenda/organiser.org")) + org-icalendar-timezone "Europe/Berlin" + org-icalendar-use-scheduled '(event-if-todo event-if-not-todo todo-start) + org-icalendar-use-deadline '(event-if-todo event-if-not-todo todo-due) + org-icalendar-alarm-time 60))) #+END_SRC +* Music +Emacs actually supports playing music via mpd. + +#+BEGIN_SRC emacs-lisp + (use-package mpc + :defer t + :config (progn + (setq mpc-browser-tags '(Genre Albumartist|Composer|Performer Album|Playlist)))) +#+END_SRC * Programming ** flycheck @@ -1573,11 +1582,11 @@ On-the-fly error checking in programming modes? Yes please. #+BEGIN_SRC emacs-lisp (use-package flycheck - :diminish " ✓" - :defer 5 - :config (progn - (global-flycheck-mode) - (setq flycheck-check-syntax-automatically '(save new-line mode-enabled)))) + :diminish " ✓" + :defer 5 + :config (progn + (global-flycheck-mode) + (setq flycheck-check-syntax-automatically '(save new-line mode-enabled)))) #+END_SRC ** golang @@ -1586,24 +1595,24 @@ Go has a few packages to inter-operate with other emacs packages. #+BEGIN_SRC emacs-lisp (use-package company-go - :commands company-go - :config (progn - (setq company-go-show-annotation t)) - :init (progn - (defun ap/company-go-setup () - (set (make-local-variable 'company-backends) - '(company-go))) - (add-hook 'go-mode-hook #'ap/company-go-setup))) + :commands company-go + :config (progn + (setq company-go-show-annotation t)) + :init (progn + (defun ap/company-go-setup () + (set (make-local-variable 'company-backends) + '(company-go))) + (add-hook 'go-mode-hook #'ap/company-go-setup))) (use-package go-eldoc - :commands go-eldoc-setup - :init (progn - (add-hook 'go-mode-hook #'go-eldoc-setup))) + :commands go-eldoc-setup + :init (progn + (add-hook 'go-mode-hook #'go-eldoc-setup))) (use-package go-projectile - :defer t - :config (progn - (setq go-projectile-switch-gopath 'maybe))) + :defer t + :config (progn + (setq go-projectile-switch-gopath 'maybe))) #+END_SRC @@ -1614,15 +1623,15 @@ A nice completion backend for programming modes. #+BEGIN_SRC emacs-lisp (use-package ggtags - :commands turn-on-ggtags-mode - :functions (ggtags-navigation-mode-abort) - :config (progn - (bind-key "q" #'ggtags-navigation-mode-abort ggtags-navigation-mode-map)) - :init (progn - (defun turn-on-ggtags-mode () - (interactive) - (ggtags-mode 1)) - (add-hook 'c-mode-common-hook #'turn-on-ggtags-mode))) + :commands turn-on-ggtags-mode + :functions (ggtags-navigation-mode-abort) + :config (progn + (bind-key "q" #'ggtags-navigation-mode-abort ggtags-navigation-mode-map)) + :init (progn + (defun turn-on-ggtags-mode () + (interactive) + (ggtags-mode 1)) + (add-hook 'c-mode-common-hook #'turn-on-ggtags-mode))) #+END_SRC ** Lisps @@ -1635,13 +1644,13 @@ lisps. Even I understand that. #+BEGIN_SRC emacs-lisp (defcustom lisp-mode-common-hook nil - "Hook run when entering any Lisp mode." - :type 'hook - :group 'lisp) + "Hook run when entering any Lisp mode." + :type 'hook + :group 'lisp) (defun ap/lisp-setup () - (run-hooks 'lisp-mode-common-hook) - (setq indent-tabs-mode nil)) + (run-hooks 'lisp-mode-common-hook) + (setq indent-tabs-mode nil)) #+END_SRC **** Redshank @@ -1651,10 +1660,10 @@ operations that aren’t part of paredit, like extracting variables into let bindings. #+BEGIN_SRC emacs-lisp (use-package redshank - :diminish " Λ" - :after (paredit) - :config (progn - (add-hook 'lisp-mode-common-hook #'turn-on-redshank-mode))) + :diminish " Λ" + :after (paredit) + :config (progn + (add-hook 'lisp-mode-common-hook #'turn-on-redshank-mode))) #+END_SRC *** Emacs Lisp @@ -1671,10 +1680,10 @@ Go-to function for elisp. Except it works through the entire Emacs ecosystem. #+BEGIN_SRC emacs-lisp (use-package elisp-slime-nav - :commands elisp-slime-nav-mode - :diminish elisp-slime-nav-mode - :init (progn - (add-hook 'emacs-lisp-mode-hook #'elisp-slime-nav-mode))) + :commands elisp-slime-nav-mode + :diminish elisp-slime-nav-mode + :init (progn + (add-hook 'emacs-lisp-mode-hook #'elisp-slime-nav-mode))) #+END_SRC Interactive elisp @@ -1684,8 +1693,8 @@ Interactive elisp :defer t :ensure nil :config (progn - (add-hook 'ielm-mode-hook (lambda () - (run-hooks 'lisp-mode-common-hook))))) + (add-hook 'ielm-mode-hook (lambda () + (run-hooks 'lisp-mode-common-hook))))) #+END_SRC I don’t only use this in elisp. It’s nice to do calculations in other @@ -1698,10 +1707,10 @@ don’t have to worry about a selection. (interactive) (backward-kill-sexp) (condition-case nil - (prin1 (eval (read (current-kill 0))) - (current-buffer)) - (error (message "Invalid expression") - (insert (current-kill 0))))) + (prin1 (eval (read (current-kill 0))) + (current-buffer)) + (error (message "Invalid expression") + (insert (current-kill 0))))) (bind-key "C-c e" #'eval-and-replace) #+END_SRC @@ -1714,8 +1723,8 @@ I don’t work with these as often as I would like (add-hook 'scheme-mode-hook #'ap/lisp-setup) (add-hook 'lisp-mode-hook #'ap/lisp-setup) (defun set-common-lisp-indentation () - (set (make-local-variable 'lisp-indent-function) - #'common-lisp-indent-function)) + (set (make-local-variable 'lisp-indent-function) + #'common-lisp-indent-function)) (add-hook 'lisp-mode-hook #'set-common-lisp-indentation) #+END_SRC @@ -1727,9 +1736,9 @@ future. #+BEGIN_SRC emacs-lisp (use-package geiser :commands (geiser-mode - geiser - run-geiser - run-racket)) + geiser + run-geiser + run-racket)) #+END_SRC **** slime @@ -1740,31 +1749,31 @@ A REPL thing (and more) for Lisp. (use-package slime :commands (slime) :config (progn - (let ((ql-slime-helper (expand-file-name "~/quicklisp/slime-helper.el"))) - (if (file-exists-p ql-slime-helper) - (load ql-slime-helper)) - (slime-setup)) - (setq inferior-lisp-program (executable-find "sbcl")))) + (let ((ql-slime-helper (expand-file-name "~/quicklisp/slime-helper.el"))) + (if (file-exists-p ql-slime-helper) + (load ql-slime-helper)) + (slime-setup)) + (setq inferior-lisp-program (executable-find "sbcl")))) #+END_SRC *** Clojure #+BEGIN_SRC emacs-lisp (use-package clojure-mode - :defer t - :init (progn - (add-hook 'cider-repl-mode-hook (lambda () (highlight-changes-mode -1))) - (add-hook 'clojure-mode-hook #'ap/lisp-setup))) + :defer t + :init (progn + (add-hook 'cider-repl-mode-hook (lambda () (highlight-changes-mode -1))) + (add-hook 'clojure-mode-hook #'ap/lisp-setup))) (use-package clj-refactor - :defer t - :functions (clj-refactor-mode cljr-add-keybindings-with-prefix) - :config (progn - (cljr-add-keybindings-with-prefix "C-c C-m")) - :init (progn - (defun turn-on-clj-refactor-mode () - (clj-refactor-mode 1)) - (add-hook 'clojure-mode-hook #'turn-on-clj-refactor-mode))) + :defer t + :functions (clj-refactor-mode cljr-add-keybindings-with-prefix) + :config (progn + (cljr-add-keybindings-with-prefix "C-c C-m")) + :init (progn + (defun turn-on-clj-refactor-mode () + (clj-refactor-mode 1)) + (add-hook 'clojure-mode-hook #'turn-on-clj-refactor-mode))) #+END_SRC **** cider @@ -1775,9 +1784,9 @@ A REPL thing for Clojure (use-package cider :defer t :config (progn - (setq nrepl-hide-special-buffers t) - (unbind-key "C-c C-f" cider-mode-map) - (add-hook 'cider-mode-hook #'eldoc-mode))) + (setq nrepl-hide-special-buffers t) + (unbind-key "C-c C-f" cider-mode-map) + (add-hook 'cider-mode-hook #'eldoc-mode))) #+END_SRC ** Auto-compile @@ -1798,13 +1807,13 @@ quite a few other modes are derived from it. (use-package cc-mode :defer 5 :init (progn - (add-hook 'c-mode-common-hook #'electric-indent-mode)) + (add-hook 'c-mode-common-hook #'electric-indent-mode)) :config (progn - (setq c-default-style '((java-mode . "java") - (awk-mode . "awk") - (other . "k&r")) - c-basic-offset 4) - (c-set-offset 'case-label '+))) + (setq c-default-style '((java-mode . "java") + (awk-mode . "awk") + (other . "k&r")) + c-basic-offset 4) + (c-set-offset 'case-label '+))) #+END_SRC ** quickrun @@ -1822,14 +1831,14 @@ Let’s try using Scala. #+BEGIN_SRC emacs-lisp (use-package scala-mode - :pin melpa-stable) + :pin melpa-stable) #+END_SRC And add ensime, an IDE-style environment. #+BEGIN_SRC emacs-lisp (use-package ensime - :pin melpa-stable) + :pin melpa-stable) #+END_SRC ** Web development @@ -1843,38 +1852,38 @@ it though #+BEGIN_SRC emacs-lisp (use-package js2-mode - :mode (("\\.js\\'" . js2-mode) - ("\\.jsx\\'" . js2-jsx-mode)) - :interpreter ("node" . js2-mode) - :functions js2-next-error - :config (progn - (define-key js2-mode-map [menu-bar Javascript] nil) - (defun js2--imenu-around (do-it name) - "Don't create a menu from js2-mode" - (if (and (not (string-equal name "IM-Javascript-IDE")) - (fboundp #'do-it)) - (do-it name))) - (advice-add 'imenu-add-to-menubar :around #'js2--imenu-around) - (setq js2-skip-preprocessor-directives t) - (defun ap/javascript-setup () - (auto-indent-mode -1)) - (defun ap/js2-prev-error () - (interactive) - (js2-next-error -1)) - (bind-key "M-g M-n" #'js2-next-error js2-mode-map) - (bind-key "M-g M-p" #'ap/js2-prev-error js2-mode-map) - (add-hook 'js2-mode-hook #'ap/javascript-setup) - (setq js2-basic-offset 4 - js2-include-node-externs t))) + :mode (("\\.js\\'" . js2-mode) + ("\\.jsx\\'" . js2-jsx-mode)) + :interpreter ("node" . js2-mode) + :functions js2-next-error + :config (progn + (define-key js2-mode-map [menu-bar Javascript] nil) + (defun js2--imenu-around (do-it name) + "Don't create a menu from js2-mode" + (if (and (not (string-equal name "IM-Javascript-IDE")) + (fboundp #'do-it)) + (do-it name))) + (advice-add 'imenu-add-to-menubar :around #'js2--imenu-around) + (setq js2-skip-preprocessor-directives t) + (defun ap/javascript-setup () + (auto-indent-mode -1)) + (defun ap/js2-prev-error () + (interactive) + (js2-next-error -1)) + (bind-key "M-g M-n" #'js2-next-error js2-mode-map) + (bind-key "M-g M-p" #'ap/js2-prev-error js2-mode-map) + (add-hook 'js2-mode-hook #'ap/javascript-setup) + (setq js2-basic-offset 4 + js2-include-node-externs t))) #+END_SRC *** coffee-mode #+BEGIN_SRC emacs-lisp (use-package coffee-mode - :mode ("\\.coffee\\'" . coffee-mode) - :config (progn - (setq coffee-indent-like-python-mode t))) + :mode ("\\.coffee\\'" . coffee-mode) + :config (progn + (setq coffee-indent-like-python-mode t))) #+END_SRC *** tern @@ -1884,27 +1893,27 @@ completions, besides other IDE-like things. #+BEGIN_SRC emacs-lisp (use-package tern - :commands ap/enable-tern - :defer 5 - :config (progn - (setq tern-command (list (executable-find "tern"))) - (defun ap/enable-tern () - (tern-mode 1)) - (add-hook 'js2-mode-hook #'ap/enable-tern) - (add-hook 'web-mode-hook #'ap/enable-tern))) + :commands ap/enable-tern + :defer 5 + :config (progn + (setq tern-command (list (executable-find "tern"))) + (defun ap/enable-tern () + (tern-mode 1)) + (add-hook 'js2-mode-hook #'ap/enable-tern) + (add-hook 'web-mode-hook #'ap/enable-tern))) (with-eval-after-load 'tern - (use-package company-tern)) + (use-package company-tern)) #+END_SRC *** json-mode #+BEGIN_SRC emacs-lisp (use-package json-mode - :mode (("\\.json\\'" . json-mode) - ("\\.sailsrc\\'" . json-mode) - ("composer\\.lock\\'" . json-mode) - ("\\.tern-project\\'" . json-mode))) + :mode (("\\.json\\'" . json-mode) + ("\\.sailsrc\\'" . json-mode) + ("composer\\.lock\\'" . json-mode) + ("\\.tern-project\\'" . json-mode))) #+END_SRC *** restclient @@ -1915,13 +1924,13 @@ integration between the two yet. #+BEGIN_SRC emacs-lisp (use-package restclient - :mode ("\\.api\\'" . restclient-mode) - :config (progn - (defun imenu-restclient-sections () - (setq imenu-prev-index-position-function nil) - (add-to-list 'imenu-generic-expression '("Services" "^## ?\\(.+\\)$" 1) t) - (add-to-list 'imenu-generic-expression '("Calls" "^# ?\\(.+\\)$" 1) t)) - (add-hook 'restclient-mode-hook #'imenu-restclient-sections))) + :mode ("\\.api\\'" . restclient-mode) + :config (progn + (defun imenu-restclient-sections () + (setq imenu-prev-index-position-function nil) + (add-to-list 'imenu-generic-expression '("Services" "^## ?\\(.+\\)$" 1) t) + (add-to-list 'imenu-generic-expression '("Calls" "^# ?\\(.+\\)$" 1) t)) + (add-hook 'restclient-mode-hook #'imenu-restclient-sections))) #+END_SRC *** sgml-mode @@ -1942,7 +1951,7 @@ frameworks that require multiple nested elements to do anything useful. :commands (emmet-mode) :diminish (emmet-mode . " >") :init (progn - (add-hook 'web-mode-hook #'emmet-mode))) + (add-hook 'web-mode-hook #'emmet-mode))) #+END_SRC *** web-mode @@ -1953,20 +1962,20 @@ of them as well. #+BEGIN_SRC emacs-lisp (use-package web-mode - :mode (("/views/.*\\.php\\'" . web-mode) - ("/layouts/.*\\.html\\'" . web-mode) - ("/templates/.*\\.php\\'" . web-mode) - ("\\.ejs\\'" . web-mode)) - :config (progn - (setq web-mode-code-indent-offset 4 - web-mode-css-indent-offset 4 - web-mode-markup-indent-offset 4 - web-mode-style-padding 0 - web-mode-script-padding 0 - web-mode-comment-style 2 - web-mode-enable-auto-pairing nil - web-mode-enable-auto-quoting nil) - (sp-local-pair '(web-mode) "<%" "%>"))) + :mode (("/views/.*\\.php\\'" . web-mode) + ("/layouts/.*\\.html\\'" . web-mode) + ("/templates/.*\\.php\\'" . web-mode) + ("\\.ejs\\'" . web-mode)) + :config (progn + (setq web-mode-code-indent-offset 4 + web-mode-css-indent-offset 4 + web-mode-markup-indent-offset 4 + web-mode-style-padding 0 + web-mode-script-padding 0 + web-mode-comment-style 2 + web-mode-enable-auto-pairing nil + web-mode-enable-auto-quoting nil) + (sp-local-pair '(web-mode) "<%" "%>"))) #+END_SRC I derived a mode for twig, in order to use its =mode-hook=. @@ -1982,8 +1991,8 @@ I derived a mode for twig, in order to use its =mode-hook=. (use-package ispell :bind (("<f8>" . ispell-word)) :config (progn - (setq ispell-program-name "aspell" - ispell-dictionary "british"))) + (setq ispell-program-name "aspell" + ispell-dictionary "british"))) #+END_SRC * Scripting @@ -1992,7 +2001,7 @@ Make a shell-script buffer executable after saving it, if it has a shebang. #+BEGIN_SRC emacs-lisp (add-hook 'after-save-hook - #'executable-make-buffer-file-executable-if-script-p) + #'executable-make-buffer-file-executable-if-script-p) (use-package sh-script :mode (("\\.zsh\\'" . shell-script-mode)) @@ -2066,7 +2075,7 @@ Emacs has an editor within. (put 'upcase-region 'disabled nil) (put 'downcase-region 'disabled nil) (setq sentence-end-double-space t - line-move-visual nil) + line-move-visual nil) #+END_SRC ** align @@ -2076,13 +2085,13 @@ The most important one for me is JSON property alignment. #+BEGIN_SRC emacs-lisp (use-package align - :defer 10 - :ensure nil - :config (progn - (add-to-list 'align-rules-list - '(colon-key-value - (regexp . ":\\(\\s-*\\)") - (modes . '(js2-mode)))))) + :defer 10 + :ensure nil + :config (progn + (add-to-list 'align-rules-list + '(colon-key-value + (regexp . ":\\(\\s-*\\)") + (modes . '(js2-mode)))))) #+END_SRC ** Clipboard @@ -2092,7 +2101,7 @@ I like to use the clipboard more than the primary selection in X11. #+BEGIN_SRC emacs-lisp (setq x-select-enable-clipboard t) (if (functionp 'x-cut-buffer-or-selection-value) - (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)) + (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)) (when (boundp 'x-select-request-type) (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))) #+END_SRC @@ -2110,8 +2119,8 @@ Sub-word movement is really nice for camel- and Pascal-case #+BEGIN_SRC emacs-lisp (use-package subword - :diminish subword-mode - :init (global-subword-mode t)) + :diminish subword-mode + :init (global-subword-mode t)) #+END_SRC I find that =zap-up-to-char= normally makes more sense to me than @@ -2121,7 +2130,7 @@ I find that =zap-up-to-char= normally makes more sense to me than (use-package misc :ensure nil :bind (("M-z" . zap-up-to-char) - ("M-Z" . zap-to-char))) + ("M-Z" . zap-to-char))) #+END_SRC Expanding the region by semantic units was something I quite liked @@ -2129,8 +2138,8 @@ from Sublime Text. As always, there’s a mode for that. #+BEGIN_SRC emacs-lisp (use-package expand-region - :bind ("C-M-SPC" . er/expand-region) - :config (setq expand-region-fast-keys-enabled nil)) + :bind ("C-M-SPC" . er/expand-region) + :config (setq expand-region-fast-keys-enabled nil)) #+END_SRC ** Typography @@ -2149,15 +2158,15 @@ somehow I prefer it. #+BEGIN_SRC emacs-lisp (use-package avy - :bind* (("M-g g" . avy-goto-line) - ("M-g M-g" . avy-goto-line) - ("C-|" . avy-goto-line) + :bind* (("M-g g" . avy-goto-line) + ("M-g M-g" . avy-goto-line) + ("C-|" . avy-goto-line) ("M-r" . avy-goto-word-1) - ("C-c SPC" . avy-goto-char-timer)) - :config (progn - (avy-setup-default) - (setq avy-all-windows nil - avy-keys '(?a ?r ?s ?t ?d ?h ?n ?e ?i ?\;)))) + ("C-c SPC" . avy-goto-char-timer)) + :config (progn + (avy-setup-default) + (setq avy-all-windows nil + avy-keys '(?a ?r ?s ?t ?d ?h ?n ?e ?i ?\;)))) #+END_SRC ** goto-chg @@ -2180,11 +2189,11 @@ saw that multiple-cursors was released for Emacs. (use-package multiple-cursors :defer 1 :config (progn - (bind-key "C-." #'mc/mark-next-like-this) - (bind-key "C-," #'mc/mark-previous-like-this) - (bind-key "M-<f3>" #'mc/mark-all-like-this-dwim) - (bind-key "C-<f3>" #'mc/mark-more-like-this-extended) - (bind-key "C-S-L" #'mc/edit-lines))) + (bind-key "C-." #'mc/mark-next-like-this) + (bind-key "C-," #'mc/mark-previous-like-this) + (bind-key "M-<f3>" #'mc/mark-all-like-this-dwim) + (bind-key "C-<f3>" #'mc/mark-more-like-this-extended) + (bind-key "C-S-L" #'mc/edit-lines))) #+END_SRC ** paredit @@ -2194,12 +2203,12 @@ movement commands are much more interesting. #+BEGIN_SRC emacs-lisp (use-package paredit - :diminish "()" - :config (progn - (add-hook 'lisp-mode-common-hook #'enable-paredit-mode) - (put #'paredit-forward-delete 'delete-selection 'supersede) - (put #'paredit-backward-delete 'delete-selection 'supersede) - (add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode))) + :diminish "()" + :config (progn + (add-hook 'lisp-mode-common-hook #'enable-paredit-mode) + (put #'paredit-forward-delete 'delete-selection 'supersede) + (put #'paredit-backward-delete 'delete-selection 'supersede) + (add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode))) #+END_SRC ** smartparens @@ -2211,31 +2220,31 @@ nice as the real version #+BEGIN_SRC emacs-lisp (eval-when-compile (require 'smartparens nil :noerror)) (use-package smartparens-config - :ensure smartparens - :config (progn - (sp-use-smartparens-bindings) - (setq sp-highlight-pair-overlay nil) - (fset 'wrap-with-paren "\C-](") ;; `sp-select-next-thing-exchange' - (bind-key "C-(" #'wrap-with-paren smartparens-mode-map) - (bind-key "C-)" #'sp-forward-slurp-sexp smartparens-mode-map) - (bind-key "M-<backspace>" #'backward-kill-word smartparens-mode-map) - (bind-key "M-?" #'sp-convolute-sexp smartparens-mode-map) - (bind-key "C-M-t" #'sp-transpose-sexp smartparens-mode-map) - (bind-key "M-R" #'sp-raise-sexp smartparens-mode-map) - (bind-key "M-S" #'sp-splice-sexp smartparens-mode-map) - (bind-key "C-M-s" #'sp-split-sexp smartparens-mode-map) - (bind-key "M-J" #'sp-join-sexp smartparens-mode-map) - (bind-key "M-<up>" #'sp-splice-sexp-killing-backward smartparens-mode-map) - (bind-key "M-<down>" #'sp-splice-sexp-killing-forward smartparens-mode-map) - (bind-key "C-M-S-k" #'sp-kill-hybrid-sexp smartparens-mode-map) - (bind-key "C-S-<right>" #'sp-slurp-hybrid-sexp smartparens-mode-map) - (sp-with-modes '(twig-mode) - (sp-local-pair "{%" "%}") - (sp-local-pair "{{" "}}")) - (show-smartparens-global-mode t) - (smartparens-global-strict-mode t) - (add-hook 'lisp-mode-common-hook #'turn-off-smartparens-mode) - (add-hook 'coffee-mode-hook #'turn-off-smartparens-mode))) + :ensure smartparens + :config (progn + (sp-use-smartparens-bindings) + (setq sp-highlight-pair-overlay nil) + (fset 'wrap-with-paren "\C-](") ;; `sp-select-next-thing-exchange' + (bind-key "C-(" #'wrap-with-paren smartparens-mode-map) + (bind-key "C-)" #'sp-forward-slurp-sexp smartparens-mode-map) + (bind-key "M-<backspace>" #'backward-kill-word smartparens-mode-map) + (bind-key "M-?" #'sp-convolute-sexp smartparens-mode-map) + (bind-key "C-M-t" #'sp-transpose-sexp smartparens-mode-map) + (bind-key "M-R" #'sp-raise-sexp smartparens-mode-map) + (bind-key "M-S" #'sp-splice-sexp smartparens-mode-map) + (bind-key "C-M-s" #'sp-split-sexp smartparens-mode-map) + (bind-key "M-J" #'sp-join-sexp smartparens-mode-map) + (bind-key "M-<up>" #'sp-splice-sexp-killing-backward smartparens-mode-map) + (bind-key "M-<down>" #'sp-splice-sexp-killing-forward smartparens-mode-map) + (bind-key "C-M-S-k" #'sp-kill-hybrid-sexp smartparens-mode-map) + (bind-key "C-S-<right>" #'sp-slurp-hybrid-sexp smartparens-mode-map) + (sp-with-modes '(twig-mode) + (sp-local-pair "{%" "%}") + (sp-local-pair "{{" "}}")) + (show-smartparens-global-mode t) + (smartparens-global-strict-mode t) + (add-hook 'lisp-mode-common-hook #'turn-off-smartparens-mode) + (add-hook 'coffee-mode-hook #'turn-off-smartparens-mode))) #+END_SRC ** move-text @@ -2255,18 +2264,18 @@ it much clearer. It’s especially helpful for protoyping and refactoring. #+BEGIN_SRC emacs-lisp (use-package undo-tree :config (progn - (global-undo-tree-mode) - ;; Keep region when undoing in region - (defadvice undo-tree-undo (around keep-region activate) - (if (use-region-p) - (let ((m (set-marker (make-marker) (mark))) - (p (set-marker (make-marker) (point)))) - ad-do-it - (goto-char p) - (set-mark m) - (set-marker p nil) - (set-marker m nil)) - ad-do-it))) + (global-undo-tree-mode) + ;; Keep region when undoing in region + (defadvice undo-tree-undo (around keep-region activate) + (if (use-region-p) + (let ((m (set-marker (make-marker) (mark))) + (p (set-marker (make-marker) (point)))) + ad-do-it + (goto-char p) + (set-mark m) + (set-marker p nil) + (set-marker m nil)) + ad-do-it))) :diminish undo-tree-mode) #+END_SRC @@ -2279,8 +2288,8 @@ the buffer for me. #+BEGIN_SRC emacs-lisp (use-package visual-regexp :bind (("C-c r" . vr/replace) - ("C-c q" . vr/query-replace) - ("C-c m" . vc/mc-mark))) + ("C-c q" . vr/query-replace) + ("C-c m" . vc/mc-mark))) #+END_SRC * Tangling @@ -2298,39 +2307,39 @@ the =org=-document after changes. #+BEGIN_SRC emacs-lisp (use-package async - :commands (async-start) - :defer 2) + :commands (async-start) + :defer 2) (defun tangle-if-init () - "If the current buffer is 'init.org' the code-blocks are - tangled, and the tangled file is compiled." + "If the current buffer is 'init.org' the code-blocks are + tangled, and the tangled file is compiled." - (when (string-suffix-p "init.org" (buffer-file-name)) - (tangle-init))) + (when (string-suffix-p "init.org" (buffer-file-name)) + (tangle-init))) (defun tangle-init-sync () - (interactive) - (message "Tangling init") - ;; Avoid running hooks when tangling. - (let ((prog-mode-hook nil) - (src (expand-file-name "init.org" user-emacs-directory)) - (dest (expand-file-name "init.el" user-emacs-directory))) - (require 'ob-tangle) - (org-babel-tangle-file src dest) - (if (byte-compile-file dest) - (byte-compile-dest-file dest) - (with-current-buffer byte-compile-log-buffer - (buffer-string))))) + (interactive) + (message "Tangling init") + ;; Avoid running hooks when tangling. + (let ((prog-mode-hook nil) + (src (expand-file-name "init.org" user-emacs-directory)) + (dest (expand-file-name "init.el" user-emacs-directory))) + (require 'ob-tangle) + (org-babel-tangle-file src dest) + (if (byte-compile-file dest) + (byte-compile-dest-file dest) + (with-current-buffer byte-compile-log-buffer + (buffer-string))))) (defun tangle-init () - "Tangle init.org asynchronously." + "Tangle init.org asynchronously." - (interactive) - (message "Tangling init") - (async-start - (symbol-function #'tangle-init-sync) - (lambda (result) - (message "Init tangling completed: %s" result)))) + (interactive) + (message "Tangling init") + (async-start + (symbol-function #'tangle-init-sync) + (lambda (result) + (message "Init tangling completed: %s" result)))) #+END_SRC # Local Variables: @@ -2341,14 +2350,14 @@ the =org=-document after changes. Start a server if possible. A daemon is already a server. #+BEGIN_SRC emacs-lisp (run-with-idle-timer 2 nil (lambda () - (unless (daemonp) - (require 'server) - (unless (server-running-p server-name) - (server-start))))) + (unless (daemonp) + (require 'server) + (unless (server-running-p server-name) + (server-start))))) (setq gc-cons-threshold 800000 - file-name-handler-alist '(("\\(?:\\.dz\\|\\.txz\\|\\.xz\\|\\.lzma\\|\\.lz\\|\\.g?z\\|\\.\\(?:tgz\\|svgz\\|sifz\\)\\|\\.tbz2?\\|\\.bz2\\|\\.Z\\)\\(?:~\\|\\.~[-[:alnum:]:#@^._]+\\(?:~[[:digit:]]+\\)?~\\)?\\'" . jka-compr-handler) - ("\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'" . epa-file-handler) - ("\\`/[^/]*\\'" . tramp-completion-file-name-handler) - ("\\`/[^/|:][^/|]*:" . tramp-file-name-handler) - ("\\`/:" . file-name-non-special))) + file-name-handler-alist '(("\\(?:\\.dz\\|\\.txz\\|\\.xz\\|\\.lzma\\|\\.lz\\|\\.g?z\\|\\.\\(?:tgz\\|svgz\\|sifz\\)\\|\\.tbz2?\\|\\.bz2\\|\\.Z\\)\\(?:~\\|\\.~[-[:alnum:]:#@^._]+\\(?:~[[:digit:]]+\\)?~\\)?\\'" . jka-compr-handler) + ("\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'" . epa-file-handler) + ("\\`/[^/]*\\'" . tramp-completion-file-name-handler) + ("\\`/[^/|:][^/|]*:" . tramp-file-name-handler) + ("\\`/:" . file-name-non-special))) #+END_SRC diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 0e57228..cf28f44 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -124,6 +124,14 @@ then autoload -U compinit && compinit fi +if [[ -n $commands[lunchy] ]] +then + LUNCHY_DIR=$(dirname $(gem which lunchy))/../extras + if [ -f $LUNCHY_DIR/lunchy-completion.zsh ]; then + . $LUNCHY_DIR/lunchy-completion.zsh + fi +fi + if [[ $TERM == "dumb" ]] then PROMPT="> " |