From ecad7cfbba68231a54afdee78e2f256c78519db4 Mon Sep 17 00:00:00 2001
From: Alan Pearce
Date: Wed, 26 Oct 2016 14:23:33 +0200
Subject: zsh: load and save history
---
tag-zsh/config/zsh/zshrc | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc
index 2a37b508..392343ad 100644
--- a/tag-zsh/config/zsh/zshrc
+++ b/tag-zsh/config/zsh/zshrc
@@ -15,6 +15,10 @@ zplug "gerges/oh-my-zsh-jira-plus", as:plugin, if:"[[ ${(SN)HOST%spotcap} ]]"
zplug "lukechilds/zsh-better-npm-completion", if:"[[ -n $commands[npm] ]]", nice:10
zplug "hlissner/zsh-autopair", nice:10
+HISTSIZE=3000
+SAVEHIST=10000
+HISTFILE=${XDG_CACHE_HOME:=$HOME/.cache}/zsh/history
+
WORDCHARS=${${WORDCHARS//[-.]}//[\/]}
if [[ ${path[(I)$HOME/bin ]} ]]
--
cgit 1.4.1
From 4ad23a478f7de66c7e322a9e5551f6f7da10993f Mon Sep 17 00:00:00 2001
From: Alan Pearce
Date: Thu, 27 Oct 2016 16:22:21 +0200
Subject: Emacs: Update js2-mode configuration
---
tag-emacs/emacs.d/init.org | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org
index 821d5af3..c01f63ad 100644
--- a/tag-emacs/emacs.d/init.org
+++ b/tag-emacs/emacs.d/init.org
@@ -1843,7 +1843,6 @@ it though
(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 ()
@@ -1852,7 +1851,7 @@ it though
(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
+ (setq js2-basic-offset 2
js2-include-node-externs t)))
#+END_SRC
--
cgit 1.4.1
From 636e48e8333a9023d1d0ffe1a3f2fde6982d9e86 Mon Sep 17 00:00:00 2001
From: Alan Pearce
Date: Thu, 27 Oct 2016 16:43:49 +0200
Subject: Remove Syncthing LaunchAgent
It should be included with the software via either ports or brew
---
LaunchAgents/net.syncthing.syncthing.plist | 30 ------------------------------
1 file changed, 30 deletions(-)
delete mode 100644 LaunchAgents/net.syncthing.syncthing.plist
diff --git a/LaunchAgents/net.syncthing.syncthing.plist b/LaunchAgents/net.syncthing.syncthing.plist
deleted file mode 100644
index 1fcd1281..00000000
--- a/LaunchAgents/net.syncthing.syncthing.plist
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
- Label
- net.syncthing.syncthing
-
- ProgramArguments
-
- /Users/apearce/bin/syncthing
-
-
- EnvironmentVariables
-
- HOME
- /Users/apearce
- STNORESTART
- 1
-
-
- KeepAlive
-
-
- LowPriorityIO
-
-
- ProcessType
- Background
-
-
--
cgit 1.4.1
From 999b7ac844c980b46044d4e0c188e1a3bf76bc2e Mon Sep 17 00:00:00 2001
From: Alan Pearce
Date: Mon, 31 Oct 2016 10:49:40 +0100
Subject: Change indentation setup to two spaces
---
tag-emacs/emacs.d/init.org | 60 +++++++++++++++++++++++++---------------------
1 file changed, 33 insertions(+), 27 deletions(-)
diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org
index c01f63ad..80c6b637 100644
--- a/tag-emacs/emacs.d/init.org
+++ b/tag-emacs/emacs.d/init.org
@@ -621,11 +621,12 @@ I like a horizonal diff setup, with everything in one frame.
* Indentation
Ah, a complicated topic. One day we’ll all be using elastic
-tabstops. Until then, I want 4-wide tabs, and make them real tabs!
+tabstops. I’ve recently switched to using two spaces, since elastic
+tabstops is probably never going to happen.
#+BEGIN_SRC emacs-lisp
- (setq-default tab-width 4
- indent-tabs-mode t)
+ (setq-default tab-width 2
+ indent-tabs-mode nil)
#+END_SRC
** auto-indent-mode
@@ -639,7 +640,7 @@ whitespace-sensitive language, of course.
(setq auto-indent-key-for-end-of-line-then-newline ""
auto-indent-key-for-end-of-line-insert-char-then-newline ""
auto-indent-blank-lines-on-move nil
- auto-indent-assign-indent-level 4
+ auto-indent-assign-indent-level 2
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
@@ -665,7 +666,7 @@ with spaces. Perfect!
(use-package smart-tabs-mode
:defer 1
:config (progn
- (smart-tabs-insinuate 'c 'cperl 'javascript 'python)
+ (smart-tabs-insinuate 'c 'cperl 'python)
(add-hook 'php-mode-hook (lambda ()
(smart-tabs-mode indent-tabs-mode)))
(with-eval-after-load "align.el"
@@ -1307,10 +1308,7 @@ configuration files.
: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)))
(define-derived-mode xmonad-mode haskell-mode "XM")
(add-to-list 'auto-mode-alist '("xmobarrc\\'" . xmonad-mode))
@@ -1319,9 +1317,7 @@ configuration files.
(use-package nginx-mode
:defer t
:mode (("/nginx/servers/" . nginx-mode)
- ("/nginx/.*\\.d/" . nginx-mode))
- :config (progn
- (setq nginx-indent-tabs-mode t)))
+ ("/nginx/.*\\.d/" . nginx-mode)))
(use-package lua-mode
:defer t)
@@ -1368,9 +1364,6 @@ works really nicely.
(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 "€"
@@ -1563,6 +1556,20 @@ write to the Android calendar, and then for DAVDroid to sync with the server.
org-icalendar-alarm-time 60)))
#+END_SRC
+**** org-page
+
+I would like to convert my website from using hugo to something else
+that I can work with nicely from inside Emacs. I wonder if org-page
+will do the trick.
+
+#+BEGIN_SRC emacs-lisp
+ (use-package org-page
+ :config (progn
+ (setq op/site-domain "https://alanpearce.uk/"
+ op/repository-directory "~/projects/alanpearce/"
+ op/personal-github-link "https://github.com/alanpearce")))
+#+END_SRC
+
* Music
Emacs actually supports playing music via mpd.
@@ -1636,8 +1643,7 @@ A nice completion backend for programming modes.
*** All
Lisp modes don’t seem to have a common ancestor. So I made a custom
-hook which I trigger in every lispy-mode. Of course, no tabs in
-lisps. Even I understand that.
+hook which I trigger in every lispy-mode.
#+BEGIN_SRC emacs-lisp
(defcustom lisp-mode-common-hook nil
@@ -1646,8 +1652,7 @@ lisps. Even I understand that.
:group 'lisp)
(defun ap/lisp-setup ()
- (run-hooks 'lisp-mode-common-hook)
- (setq indent-tabs-mode nil))
+ (run-hooks 'lisp-mode-common-hook))
#+END_SRC
**** Redshank
@@ -1946,9 +1951,9 @@ of them as well.
("/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
+ (setq web-mode-code-indent-offset 2
+ web-mode-css-indent-offset 2
+ web-mode-markup-indent-offset 2
web-mode-style-padding 0
web-mode-script-padding 0
web-mode-comment-style 2
@@ -1979,12 +1984,13 @@ I derived a mode for twig, in order to use its =mode-hook=.
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)
+ (add-hook 'after-save-hook
+ #'executable-make-buffer-file-executable-if-script-p)
-(use-package sh-script
- :mode (("\\.zsh\\'" . shell-script-mode))
- :config (setq sh-shell-file "/usr/bin/env zsh"))
+ (use-package sh-script
+ :mode (("\\.zsh\\'" . shell-script-mode))
+ :config (setq sh-shell-file "/usr/bin/env zsh"
+ sh-indentation 2))
#+END_SRC
#+BEGIN_SRC emacs-lisp
--
cgit 1.4.1
From 13c81a22ce6e9e206d47feb618e9ad5c9ac0ce28 Mon Sep 17 00:00:00 2001
From: Alan Pearce
Date: Mon, 31 Oct 2016 10:56:22 +0100
Subject: Reindent all the things
---
LaunchAgents/gnu.emacs.daemon.plist | 26 ++---
hooks/post-up/emacs | 6 +-
hooks/post-up/zsh | 22 ++--
host-ap-spotcap.local/config/zsh/zshenv.local | 2 +-
tag-ssh/ssh/rc | 2 +-
tag-zsh/config/zsh/zshenv | 26 ++---
tag-zsh/config/zsh/zshrc | 142 +++++++++++++-------------
7 files changed, 113 insertions(+), 113 deletions(-)
mode change 100644 => 100755 tag-ssh/ssh/rc
diff --git a/LaunchAgents/gnu.emacs.daemon.plist b/LaunchAgents/gnu.emacs.daemon.plist
index ecce7db7..873e28ff 100644
--- a/LaunchAgents/gnu.emacs.daemon.plist
+++ b/LaunchAgents/gnu.emacs.daemon.plist
@@ -2,18 +2,18 @@
- ServiceDescription
- Gnu Emacs Daemon
- ProgramArguments
-
- /Applications/Emacs.app/Contents/MacOS/Emacs
- --daemon
-
- RunAtLoad
-
- WorkingDirectory
- /Users/alan
- Label
- gnu.emacs.daemon
+ ServiceDescription
+ Gnu Emacs Daemon
+ ProgramArguments
+
+ /Applications/Emacs.app/Contents/MacOS/Emacs
+ --daemon
+
+ RunAtLoad
+
+ WorkingDirectory
+ /Users/alan
+ Label
+ gnu.emacs.daemon
diff --git a/hooks/post-up/emacs b/hooks/post-up/emacs
index aad74be7..cb9c0916 100755
--- a/hooks/post-up/emacs
+++ b/hooks/post-up/emacs
@@ -2,8 +2,8 @@
if [[ -s $commands[emacs] ]]
then
- pushd ~/.emacs.d
- emacs --batch --eval "(progn
+ pushd ~/.emacs.d
+ emacs --batch --eval "(progn
(setq vc-follow-symlinks nil)
(find-file \"init.org\")
(require 'ob-tangle)
@@ -11,5 +11,5 @@ then
(byte-compile-file \"init.el\")
(load-file \"init.el\")
)"
- popd
+ popd
fi
diff --git a/hooks/post-up/zsh b/hooks/post-up/zsh
index b7a7d4a2..3eef6e51 100755
--- a/hooks/post-up/zsh
+++ b/hooks/post-up/zsh
@@ -4,26 +4,26 @@ ZDOTDIR="${XDG_CONFIG_HOME:=~/.config}/zsh"
pushd $ZDOTDIR
for f in z*(-.)
do
- if [[ -e .$f ]]
- then
- if [[ ! -h .$f ]]
- then
- echo ".$f already exists as a regular file, ignoring"
- fi
- else
- ln -s $f .$f
- fi
+ if [[ -e .$f ]]
+ then
+ if [[ ! -h .$f ]]
+ then
+ echo ".$f already exists as a regular file, ignoring"
+ fi
+ else
+ ln -s $f .$f
+ fi
done
popd
if [[ ! -d ~/.cache/zsh ]]
then
- mkdir -p ~/.cache/zsh
+ mkdir -p ~/.cache/zsh
fi
if [[ -z $commands[zplug] && ! -d ~/projects/zplug/ ]]
then
- git clone git://github.com/zplug/zplug ~/projects/zplug/
+ git clone git://github.com/zplug/zplug ~/projects/zplug/
fi
zsh -ic "zplug install"
diff --git a/host-ap-spotcap.local/config/zsh/zshenv.local b/host-ap-spotcap.local/config/zsh/zshenv.local
index f6881be2..55a6031d 100644
--- a/host-ap-spotcap.local/config/zsh/zshenv.local
+++ b/host-ap-spotcap.local/config/zsh/zshenv.local
@@ -1,5 +1,5 @@
# -*- mode: sh; -*-
if [[ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]]
then
- . $HOME/.nix-profile/etc/profile.d/nix.sh;
+ . $HOME/.nix-profile/etc/profile.d/nix.sh;
fi
diff --git a/tag-ssh/ssh/rc b/tag-ssh/ssh/rc
old mode 100644
new mode 100755
index 7b6da3a8..59e4cfd1
--- a/tag-ssh/ssh/rc
+++ b/tag-ssh/ssh/rc
@@ -1,5 +1,5 @@
#!/bin/sh
if [ "$SSH_AUTH_SOCK" ]
then
- ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
+ ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
fi
diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv
index 93893530..86efc02d 100644
--- a/tag-zsh/config/zsh/zshenv
+++ b/tag-zsh/config/zsh/zshenv
@@ -1,19 +1,19 @@
if [[ $SHLVL -eq 1 || (-n $DISPLAY && $SHLVL -lt 3) ]]
then
- if [[ -f $ZDOTDIR/zshenv.local ]]
- then
- . $ZDOTDIR/zshenv.local
- fi
+ if [[ -f $ZDOTDIR/zshenv.local ]]
+ then
+ . $ZDOTDIR/zshenv.local
+ fi
- if [[ -f $ZDOTDIR/zshenv.private ]]
- then
- . $ZDOTDIR/zshenv.private
- fi
+ if [[ -f $ZDOTDIR/zshenv.private ]]
+ then
+ . $ZDOTDIR/zshenv.private
+ fi
- ZPLUG_HOME=${ZPLUG_HOME:-~/projects/zplug}
+ ZPLUG_HOME=${ZPLUG_HOME:-~/projects/zplug}
- if [[ -z $SSH_AUTH_SOCK ]]
- then
- export SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/ssh-agent.socket
- fi
+ if [[ -z $SSH_AUTH_SOCK ]]
+ then
+ export SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/ssh-agent.socket
+ fi
fi
diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc
index 392343ad..662ab660 100644
--- a/tag-zsh/config/zsh/zshrc
+++ b/tag-zsh/config/zsh/zshrc
@@ -7,8 +7,8 @@ zplug "clvv/fasd", hook-build:"PREFIX=$HOME make install"
zplug "caarlos0/zsh-open-pr", as:plugin
if [[ -n $commands[nix-env] ]]
then
- zplug "spwhitt/nix-zsh-completions", as:plugin
- fpath=($fpath $ZPLUG_REPOS/spwhitt/nix-zsh-completions)
+ zplug "spwhitt/nix-zsh-completions", as:plugin
+ fpath=($fpath $ZPLUG_REPOS/spwhitt/nix-zsh-completions)
fi
zplug "gerges/oh-my-zsh-jira-plus", as:plugin, if:"[[ ${(SN)HOST%spotcap} ]]"
@@ -23,17 +23,17 @@ WORDCHARS=${${WORDCHARS//[-.]}//[\/]}
if [[ ${path[(I)$HOME/bin ]} ]]
then
- path+=($HOME/bin)
+ path+=($HOME/bin)
fi
export EDITOR=emacsclient
alias ec=emacsclient
alias open-project=projectile
_emacs_function () {
- emacsclient -e "($1 \"$2\")" > /dev/null
+ emacsclient -e "($1 \"$2\")" > /dev/null
}
projectile () {
- _emacs_function projectile-switch-project-by-name ${1:-$PWD}
+ _emacs_function projectile-switch-project-by-name ${1:-$PWD}
}
ls='\ls'
@@ -43,25 +43,25 @@ bsd_ls_options="-p"
bsd_ls_isodate="-D '%F %k:%M'"
case $OSTYPE in
- darwin*)
- if [[ -n $commands[gls] ]]
- then
- ls='\gls'
- ls_options=$gnu_ls_options
- ls_isodate=$gnu_ls_isodate
- else
- ls_options=$bsd_ls_options
- ls_isodate=$bsd_ls_isodate
- fi
- ;;
- freebsd*)
- ls_options=$bsd_ls_options
- ls_isodate=$bsd_ls_isodate
- ;;
- linux-gnu)
- ls_options=$gnu_ls_options
- ls_isodate=$gnu_ls_isodate
- ;;
+ darwin*)
+ if [[ -n $commands[gls] ]]
+ then
+ ls='\gls'
+ ls_options=$gnu_ls_options
+ ls_isodate=$gnu_ls_isodate
+ else
+ ls_options=$bsd_ls_options
+ ls_isodate=$bsd_ls_isodate
+ fi
+ ;;
+ freebsd*)
+ ls_options=$bsd_ls_options
+ ls_isodate=$bsd_ls_isodate
+ ;;
+ linux-gnu)
+ ls_options=$gnu_ls_options
+ ls_isodate=$gnu_ls_isodate
+ ;;
esac
alias l="${ls} ${ls_options} -Bp"
alias l1="${ls} ${ls_options} -1"
@@ -79,19 +79,19 @@ bindkey '\e[3~' delete-char
bindkey '\C-hd' describe-key-briefly
backward-argument () {
- local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\""
- zle backward-word
+ local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\""
+ zle backward-word
}
forward-argument () {
- local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\""
- zle forward-word
+ local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\""
+ zle forward-word
}
kill-argument () {
- local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\""
- zle backward-argument
- zle kill-word
+ local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\""
+ zle backward-argument
+ zle kill-word
}
zle -N backward-argument
@@ -102,92 +102,92 @@ bindkey '\e^f' forward-argument
bindkey '\e^k' kill-argument
ds () {
- du -hd1 $1 | sort -h
+ du -hd1 $1 | sort -h
}
zle -C hist-complete complete-word _generic
zstyle ':completion:hist-complete:*' completer _history
-bindkey '\e ' hist-complete
+bindkey '\e ' hist-complete
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' '+m:{A-Z}={a-z}'
zstyle ':completion:*' completer _expand _complete _match
if [[ -z $SSH_AUTH_SOCK && $commands[ssh-agent] ]]
then
- eval $(ssh-agent)
+ eval $(ssh-agent)
fi
if zplug check Tarrasch/zsh-autoenv
then
- AUTOENV_FILE_ENTER=.envrc
- AUTOENV_HANDLE_LEAVE=0
- AUTOENV_LOOK_UPWARDS=1
+ AUTOENV_FILE_ENTER=.envrc
+ AUTOENV_HANDLE_LEAVE=0
+ AUTOENV_LOOK_UPWARDS=1
fi
if zplug check gerges/oh-my-zsh-jira-plus
then
- JIRA_RAPID_BOARD=true
+ JIRA_RAPID_BOARD=true
fi
# Then, source plugins and add commands to $PATH
zplug load
# General configuration
-setopt auto_cd # Change directories without `cd`
+setopt auto_cd # Change directories without `cd`
if zplug check zsh-users/zsh-completions
then
- autoload -U compinit && compinit
+ autoload -U compinit && compinit
fi
if [[ -n $commands[hub] ]]
then
- compdef _hub hub
- alias git=hub
- alias gh=hub
+ compdef _hub hub
+ alias git=hub
+ alias gh=hub
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
+ 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="> "
+ PROMPT="> "
else
- unset RPROMPT
- # show username@host if logged in through SSH
- [[ "$SSH_CONNECTION" != '' ]] && prompt_pure_username=' %F{242}%n@%m%f'
+ unset RPROMPT
+ # show username@host if logged in through SSH
+ [[ "$SSH_CONNECTION" != '' ]] && prompt_pure_username=' %F{242}%n@%m%f'
- # show username@host if root, with username in white
- [[ $UID -eq 0 ]] && prompt_pure_username=' %F{white}%n%f%F{242}@%m%f'
+ # show username@host if root, with username in white
+ [[ $UID -eq 0 ]] && prompt_pure_username=' %F{white}%n%f%F{242}@%m%f'
- setopt prompt_subst
- setopt prompt_cr
- PROMPT='%F{blue}%~%f${prompt_pure_username}
+ setopt prompt_subst
+ setopt prompt_cr
+ PROMPT='%F{blue}%~%f${prompt_pure_username}
%(?.%F{magenta}.%F{red})>%f '
fi
if zplug check clvv/fasd
then
- if [[ -n $commands[fasd] ]]
- then
- _FASD_DATA="$HOME/.cache/zsh/fasd-data"
- source =fasd
-
- fasd_cache="$HOME/.fasd-init-zsh"
- if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
- fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install >| "$fasd_cache"
- fi
- source "$fasd_cache"
- unset fasd_cache
- else
- echo "no fasd"
- fi
+ if [[ -n $commands[fasd] ]]
+ then
+ _FASD_DATA="$HOME/.cache/zsh/fasd-data"
+ source =fasd
+
+ fasd_cache="$HOME/.fasd-init-zsh"
+ if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
+ fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install >| "$fasd_cache"
+ fi
+ source "$fasd_cache"
+ unset fasd_cache
+ else
+ echo "no fasd"
+ fi
fi
-unsetopt flow_control # Let me use ^S and ^Q
+unsetopt flow_control # Let me use ^S and ^Q
--
cgit 1.4.1
From 035dc06da0911c3abea6e1932749fde7e3bbfd35 Mon Sep 17 00:00:00 2001
From: Alan Pearce
Date: Mon, 31 Oct 2016 10:56:31 +0100
Subject: Remove unnecessary zsh override for prefect
---
host-prefect/config/zsh/zshenv.local | 1 -
1 file changed, 1 deletion(-)
delete mode 100644 host-prefect/config/zsh/zshenv.local
diff --git a/host-prefect/config/zsh/zshenv.local b/host-prefect/config/zsh/zshenv.local
deleted file mode 100644
index 8ed2dc3d..00000000
--- a/host-prefect/config/zsh/zshenv.local
+++ /dev/null
@@ -1 +0,0 @@
-PURE_PROMPT_SYMBOL='>'
--
cgit 1.4.1
From 606968a957b29edaf37b1dc9dd4bc4aadd951b93 Mon Sep 17 00:00:00 2001
From: Alan Pearce
Date: Mon, 31 Oct 2016 10:56:49 +0100
Subject: Emacs: Fix sh-mode indentation
---
tag-emacs/emacs.d/init.org | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org
index 80c6b637..c803895d 100644
--- a/tag-emacs/emacs.d/init.org
+++ b/tag-emacs/emacs.d/init.org
@@ -1990,7 +1990,8 @@ Make a shell-script buffer executable after saving it, if it has a shebang.
(use-package sh-script
:mode (("\\.zsh\\'" . shell-script-mode))
:config (setq sh-shell-file "/usr/bin/env zsh"
- sh-indentation 2))
+ sh-indentation 2
+ sh-basic-offset 2))
#+END_SRC
#+BEGIN_SRC emacs-lisp
--
cgit 1.4.1
From e6df5c84a11e58733ddc32393e144cb60787ab05 Mon Sep 17 00:00:00 2001
From: Alan Pearce
Date: Mon, 31 Oct 2016 10:57:06 +0100
Subject: Emacs: Open zshrc/zshenv in shell-script-mode
---
tag-emacs/emacs.d/init.org | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org
index c803895d..cd58c176 100644
--- a/tag-emacs/emacs.d/init.org
+++ b/tag-emacs/emacs.d/init.org
@@ -1988,7 +1988,9 @@ Make a shell-script buffer executable after saving it, if it has a shebang.
#'executable-make-buffer-file-executable-if-script-p)
(use-package sh-script
- :mode (("\\.zsh\\'" . shell-script-mode))
+ :mode (("\\.zsh\\'" . shell-script-mode)
+ ("zshenv\\'" . shell-script-mode)
+ ("zshrc\\'" . shell-script-mode))
:config (setq sh-shell-file "/usr/bin/env zsh"
sh-indentation 2
sh-basic-offset 2))
--
cgit 1.4.1
From 8040ffef312042bab871b30e3f99b928f6df3d3f Mon Sep 17 00:00:00 2001
From: Alan Pearce
Date: Mon, 31 Oct 2016 13:22:10 +0100
Subject: npm/yarn: Install to ~/.local
---
npmrc | 1 +
tag-zsh/config/zsh/zshrc | 8 ++++++++
2 files changed, 9 insertions(+)
create mode 100644 npmrc
diff --git a/npmrc b/npmrc
new file mode 100644
index 00000000..6804f657
--- /dev/null
+++ b/npmrc
@@ -0,0 +1 @@
+prefix = ${HOME}/.local/
\ No newline at end of file
diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc
index 662ab660..f5327507 100644
--- a/tag-zsh/config/zsh/zshrc
+++ b/tag-zsh/config/zsh/zshrc
@@ -26,6 +26,11 @@ then
path+=($HOME/bin)
fi
+if [[ ${path[(I)$HOME/.local/bin ]} ]]
+then
+ path+=($HOME/.local/bin)
+fi
+
export EDITOR=emacsclient
alias ec=emacsclient
alias open-project=projectile
@@ -35,6 +40,9 @@ _emacs_function () {
projectile () {
_emacs_function projectile-switch-project-by-name ${1:-$PWD}
}
+yarn () {
+ PREFIX=$HOME/.local command yarn "$@"
+}
ls='\ls'
gnu_ls_options="-v --group-directories-first --color=auto"
--
cgit 1.4.1
From a32381dad8fdd9e488d5191f6c72aaeda3ee4ffd Mon Sep 17 00:00:00 2001
From: Alan Pearce
Date: Mon, 31 Oct 2016 14:57:08 +0100
Subject: Reindent init.org
---
tag-emacs/emacs.d/init.org | 2106 ++++++++++++++++++++++----------------------
1 file changed, 1052 insertions(+), 1054 deletions(-)
diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org
index cd58c176..db31c419 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
@@ -37,34 +37,34 @@ the buffer to be empty.
#+BEGIN_SRC emacs-lisp
(eval-and-compile
- (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
- ("marmalade" . "http://marmalade-repo.org/packages/")
- ("melpa-stable" . "http://stable.melpa.org/packages/")
- ("melpa" . "http://melpa.org/packages/"))
- package-user-dir (concat "~/.emacs.d/packages/" emacs-version "/elpa")
- package-pinned-packages '(("use-package" . melpa-stable)
- ("diminish" . melpa-stable)
- ("bind-key" . melpa-stable))
- package-archive-priorities '(("melpa-stable" . 10)
- ("gnu" . 10)
- ("marmalade" . 5)
- ("melpa" . 0))
- package-menu-async t
- package-menu-hide-low-priority t)
- (package-initialize)
- (unless (package-installed-p 'use-package)
- (package-refresh-contents)
- (package-install 'use-package)))
+ (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
+ ("marmalade" . "http://marmalade-repo.org/packages/")
+ ("melpa-stable" . "http://stable.melpa.org/packages/")
+ ("melpa" . "http://melpa.org/packages/"))
+ package-user-dir (concat "~/.emacs.d/packages/" emacs-version "/elpa")
+ package-pinned-packages '(("use-package" . melpa-stable)
+ ("diminish" . melpa-stable)
+ ("bind-key" . melpa-stable))
+ package-archive-priorities '(("melpa-stable" . 10)
+ ("gnu" . 10)
+ ("marmalade" . 5)
+ ("melpa" . 0))
+ package-menu-async t
+ package-menu-hide-low-priority t)
+ (package-initialize)
+ (unless (package-installed-p 'use-package)
+ (package-refresh-contents)
+ (package-install 'use-package)))
(eval-when-compile (require 'use-package))
(unless (featurep 'use-package)
- (require 'diminish)
- (require 'bind-key)
- (use-package use-package
- :commands (use-package-autoload-keymap)
- :defer 5))
+ (require 'diminish)
+ (require 'bind-key)
+ (use-package use-package
+ :commands (use-package-autoload-keymap)
+ :defer 5))
(setq use-package-verbose t
- use-package-always-ensure t
- package-enable-at-startup nil)
+ use-package-always-ensure t
+ package-enable-at-startup nil)
#+END_SRC
* Customize
@@ -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,44 +148,44 @@ 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 ap/set-fonts (mono-face mono-font-size variable-face variable-font-size)
- (when mono-face
- (let ((default-font (font-spec :name mono-face :size 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 (font-spec :name variable-face :size 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 "SF Mono" 12 "Lucida Grande" 12)
- (ap/set-fonts "ProggyTiny" 11 "Lucida Grande" 12))))
- ((eq window-system 'x)
- (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 12))
- (ap/set-fonts "Terminus" 12 "Lucida" 10))))
-
- (ap/set-fonts-according-to-system))
+ (daemonp))
+
+ (defun use-variable-fonts ()
+ (interactive)
+ (variable-pitch-mode)
+ (setq cursor-type 'bar))
+
+ (defun ap/set-fonts (mono-face mono-font-size variable-face variable-font-size)
+ (when mono-face
+ (let ((default-font (font-spec :name mono-face :size 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 (font-spec :name variable-face :size 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 "SF Mono" 12 "Lucida Grande" 12)
+ (ap/set-fonts "ProggyTiny" 11 "Lucida Grande" 12))))
+ ((eq window-system 'x)
+ (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 12))
+ (ap/set-fonts "Terminus" 12 "Lucida" 10))))
+
+ (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
@@ -197,14 +197,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
@@ -213,7 +213,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
@@ -222,9 +222,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
@@ -234,20 +234,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
@@ -260,16 +260,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
@@ -312,25 +312,23 @@ configuration with crux.el
#+BEGIN_SRC emacs-lisp
(use-package crux
- :bind (("M-o" . crux-smart-open-line-above)
- ("C-o" . crux-smart-open-line)
-
- ("C-x 4 t" . crux-transpose-windows)
- ("C-c e" . crux-eval-and-replace)
- ("C-c D" . crux-delete-file-and-buffer)
- ("C-c R" . crux-rename-file-and-buffer))
- :init (progn
- (defalias 'delete-current-buffer-file #'crux-delete-file-and-buffer)
- (defalias 'rename-current-buffer-file #'crux-rename-file-and-buffer)))
-
+ :bind (("M-o" . crux-smart-open-line-above)
+ ("C-o" . crux-smart-open-line)
+ ("C-x 4 t" . crux-transpose-windows)
+ ("C-c e" . crux-eval-and-replace)
+ ("C-c D" . crux-delete-file-and-buffer)
+ ("C-c R" . crux-rename-file-and-buffer))
+ :init (progn
+ (defalias 'delete-current-buffer-file #'crux-delete-file-and-buffer)
+ (defalias 'rename-current-buffer-file #'crux-rename-file-and-buffer)))
#+END_SRC
* 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
@@ -343,8 +341,8 @@ configuration with crux.el
#+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
@@ -355,38 +353,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
@@ -397,14 +395,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
@@ -417,7 +415,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
@@ -427,12 +425,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
@@ -442,15 +440,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
@@ -462,7 +460,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
@@ -474,7 +472,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
@@ -483,29 +481,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
@@ -526,9 +524,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
@@ -537,16 +535,16 @@ with a buffer.
#+BEGIN_SRC emacs-lisp
(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
@@ -556,11 +554,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
@@ -570,7 +568,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
@@ -580,30 +578,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
@@ -614,8 +612,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
@@ -626,7 +624,7 @@ tabstops is probably never going to happen.
#+BEGIN_SRC emacs-lisp
(setq-default tab-width 2
- indent-tabs-mode nil)
+ indent-tabs-mode nil)
#+END_SRC
** auto-indent-mode
@@ -636,25 +634,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 ""
- auto-indent-key-for-end-of-line-insert-char-then-newline ""
- auto-indent-blank-lines-on-move nil
- auto-indent-assign-indent-level 2
- 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 ""
+ auto-indent-key-for-end-of-line-insert-char-then-newline ""
+ auto-indent-blank-lines-on-move nil
+ auto-indent-assign-indent-level 2
+ 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
@@ -664,39 +662,39 @@ with spaces. Perfect!
#+BEGIN_SRC emacs-lisp
(use-package smart-tabs-mode
- :defer 1
- :config (progn
- (smart-tabs-insinuate 'c 'cperl '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 '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
@@ -706,15 +704,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
@@ -724,9 +722,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
@@ -738,42 +736,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
@@ -794,18 +792,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
@@ -815,14 +813,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
@@ -832,8 +830,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
@@ -843,9 +841,9 @@ Directional window movement
#+BEGIN_SRC emacs-lisp
(use-package windmove
:bind (("S-" . windmove-left)
- ("S-" . windmove-right)
- ("S-" . windmove-up)
- ("S-" . windmove-down)))
+ ("S-" . windmove-right)
+ ("S-" . windmove-up)
+ ("S-" . windmove-down)))
#+END_SRC
* Completion
@@ -854,8 +852,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
@@ -866,35 +864,35 @@ seems to work perfectly well for me.
#+BEGIN_SRC emacs-lisp
(use-package company
- :commands (company-mode)
- :diminish "Cmpl"
- :bind (("C-" . 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-" . 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
#+BEGIN_SRC emacs-lisp
(use-package company-nixos-options
- :if (eq system-type 'gnu/linux)
- :config (progn
- (add-to-list 'company-backends 'company-nixos-options)))
+ :if (eq system-type 'gnu/linux)
+ :config (progn
+ (add-to-list 'company-backends 'company-nixos-options)))
#+END_SRC
* Dates & Times
@@ -904,12 +902,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.
@@ -919,24 +917,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
@@ -951,64 +949,64 @@ copying/moving files between them.
:defer 3
:ensure nil
:config (progn
- (bind-key "" #'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 "" #'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
@@ -1020,9 +1018,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
@@ -1034,7 +1032,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
@@ -1043,32 +1041,32 @@ helps to make documentation for other languages easier to access
#+BEGIN_SRC emacs-lisp
(defmacro ap/create-counsel-dash-hook (mode docsets)
- (let* ((mode-s (symbol-name mode))
- (fun (intern (concat "counsel-dash-hook-" mode-s)))
- (hook (intern (concat mode-s "-mode-hook"))))
- `(progn
- (defun ,fun ()
- (when (require 'counsel-dash nil :noerror)
- (-each (-difference ',docsets
- (helm-dash-installed-docsets))
- #'counsel-dash-install-docset)
- (setq-local counsel-dash-docsets ',docsets)))
- (add-hook (quote ,hook) (function ,fun)))))
+ (let* ((mode-s (symbol-name mode))
+ (fun (intern (concat "counsel-dash-hook-" mode-s)))
+ (hook (intern (concat mode-s "-mode-hook"))))
+ `(progn
+ (defun ,fun ()
+ (when (require 'counsel-dash nil :noerror)
+ (-each (-difference ',docsets
+ (helm-dash-installed-docsets))
+ #'counsel-dash-install-docset)
+ (setq-local counsel-dash-docsets ',docsets)))
+ (add-hook (quote ,hook) (function ,fun)))))
(use-package counsel-dash
- :defer 20
- :defines counsel-dash-docsets
- :config (progn
- (setq counsel-dash-browser-func #'eww)
- (ap/create-counsel-dash-hook nginx ("Nginx"))
- (ap/create-counsel-dash-hook ansible ("Ansible"))
- (ap/create-counsel-dash-hook php ("PHP" "Symfony"))
- (ap/create-counsel-dash-hook twig ("Twig"))
- (ap/create-counsel-dash-hook js2 ("JavaScript" "NodeJS" "jQuery" "Express" "SailsJS" "Lo-Dash"))
- (ap/create-counsel-dash-hook markdown ("Markdown"))
- (ap/create-counsel-dash-hook saltstack ("SaltStack"))
- (ap/create-counsel-dash-hook clojure ("Clojure"))
- (ap/create-counsel-dash-hook sql ("PostgreSQL" "MySQL"))))
+ :defer 20
+ :defines counsel-dash-docsets
+ :config (progn
+ (setq counsel-dash-browser-func #'eww)
+ (ap/create-counsel-dash-hook nginx ("Nginx"))
+ (ap/create-counsel-dash-hook ansible ("Ansible"))
+ (ap/create-counsel-dash-hook php ("PHP" "Symfony"))
+ (ap/create-counsel-dash-hook twig ("Twig"))
+ (ap/create-counsel-dash-hook js2 ("JavaScript" "NodeJS" "jQuery" "Express" "SailsJS" "Lo-Dash"))
+ (ap/create-counsel-dash-hook markdown ("Markdown"))
+ (ap/create-counsel-dash-hook saltstack ("SaltStack"))
+ (ap/create-counsel-dash-hook clojure ("Clojure"))
+ (ap/create-counsel-dash-hook sql ("PostgreSQL" "MySQL"))))
#+END_SRC
** discover-my-major
@@ -1076,8 +1074,8 @@ helps to make documentation for other languages easier to access
A nicer way to browse keybindings for major modes.
#+BEGIN_SRC emacs-lisp
-(use-package discover-my-major
- :bind ("" . discover-my-major))
+ (use-package discover-my-major
+ :bind ("" . discover-my-major))
#+END_SRC
** which-key
@@ -1086,10 +1084,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
@@ -1102,52 +1100,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)
@@ -1174,9 +1172,9 @@ 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 #'save-buffers-kill-emacs))
+ (if (daemonp)
+ (defalias 'exit-emacs #'delete-frame)
+ (defalias 'exit-emacs #'save-buffers-kill-emacs))
#+END_SRC
** swiper/ivy
@@ -1186,71 +1184,71 @@ replacement for helm so far.
#+BEGIN_SRC emacs-lisp
(use-package swiper
- :bind (("C-s" . swiper)
- ("C-r" . swiper)
- ("C-c C-r" . ivy-resume)
- ("C-x i" . ivy-imenu-goto)
- ("C-=" . swiper))
- :diminish ivy-mode
- :demand t
- :config (progn
- (ivy-mode 1)
- (setq ivy-re-builders-alist '((internal-complete-buffer . ivy--regex-fuzzy)
- (t . ivy--regex-plus)))
- (defun ivy-imenu-get-candidates-from (alist &optional prefix)
- (cl-loop for elm in alist
- nconc (if (imenu--subalist-p elm)
- (ivy-imenu-get-candidates-from
- (cl-loop for (e . v) in (cdr elm) collect
- (cons e (if (integerp v) (copy-marker v) v)))
- (concat prefix (if prefix ".") (car elm)))
- (and (cdr elm) ; bug in imenu, should not be needed.
- (setcdr elm (copy-marker (cdr elm))) ; Same as [1].
- (list (cons (concat prefix (if prefix ".") (car elm))
- (copy-marker (cdr elm))))))))
-
- (defun ivy-imenu-goto ()
- "Go to buffer position"
- (interactive)
- (let ((imenu-auto-rescan t) items)
- (unless (featurep 'imenu)
- (require 'imenu nil t))
- (setq items (imenu--make-index-alist t))
- (ivy-read "imenu items:"
- (ivy-imenu-get-candidates-from (delete (assoc "*Rescan*" items) items))
- :action (lambda (k) (goto-char k)))))
- (ivy-set-actions 'ivy-switch-buffer '(("k" (lambda (x)
- (kill-buffer x)
- (ivy--reset-state ivy-last))
- "kill")))
- (add-to-list 'ivy-initial-inputs-alist '(counsel-M-x . ""))))
+ :bind (("C-s" . swiper)
+ ("C-r" . swiper)
+ ("C-c C-r" . ivy-resume)
+ ("C-x i" . ivy-imenu-goto)
+ ("C-=" . swiper))
+ :diminish ivy-mode
+ :demand t
+ :config (progn
+ (ivy-mode 1)
+ (setq ivy-re-builders-alist '((internal-complete-buffer . ivy--regex-fuzzy)
+ (t . ivy--regex-plus)))
+ (defun ivy-imenu-get-candidates-from (alist &optional prefix)
+ (cl-loop for elm in alist
+ nconc (if (imenu--subalist-p elm)
+ (ivy-imenu-get-candidates-from
+ (cl-loop for (e . v) in (cdr elm) collect
+ (cons e (if (integerp v) (copy-marker v) v)))
+ (concat prefix (if prefix ".") (car elm)))
+ (and (cdr elm) ; bug in imenu, should not be needed.
+ (setcdr elm (copy-marker (cdr elm))) ; Same as [1].
+ (list (cons (concat prefix (if prefix ".") (car elm))
+ (copy-marker (cdr elm))))))))
+
+ (defun ivy-imenu-goto ()
+ "Go to buffer position"
+ (interactive)
+ (let ((imenu-auto-rescan t) items)
+ (unless (featurep 'imenu)
+ (require 'imenu nil t))
+ (setq items (imenu--make-index-alist t))
+ (ivy-read "imenu items:"
+ (ivy-imenu-get-candidates-from (delete (assoc "*Rescan*" items) items))
+ :action (lambda (k) (goto-char k)))))
+ (ivy-set-actions 'ivy-switch-buffer '(("k" (lambda (x)
+ (kill-buffer x)
+ (ivy--reset-state ivy-last))
+ "kill")))
+ (add-to-list 'ivy-initial-inputs-alist '(counsel-M-x . ""))))
#+END_SRC
** counsel
#+BEGIN_SRC emacs-lisp
(use-package counsel
- :config (progn
- (bind-key "M-x" #'counsel-M-x)
- (bind-key "" #'counsel-M-x)
- (bind-key "