From 6bec14c2d18c915a3510aba36a37e78a8b83170f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 28 Apr 2013 20:53:15 +0100 Subject: Initial commit --- .gitignore | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..fa943767 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +# Emacs files +*~ +.#* + +# Byte-compiled files +*.elc +*.zwc +*.zwc.old -- cgit 1.4.1 From e7657d6ba54ad5714657cff9be86ec416d342a4c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 28 Apr 2013 20:54:18 +0100 Subject: Migrate repository from mercurial without history --- atoprc | 2 + dwm/config.h | 105 ++ emacs/elisp/ap-functions.el | 44 + emacs/elisp/el-get-setup.el | 66 ++ emacs/elisp/eldoc-context.el | 40 + emacs/elisp/eldoc-php.el | 48 + emacs/elisp/electric-return.el | 16 + emacs/elisp/package-install.el | 129 ++ emacs/elisp/php-electric.el | 218 ++++ emacs/elisp/shuffle-lines.el | 20 + emacs/elisp/web-vcs.el | 2342 +++++++++++++++++++++++++++++++++++++ emacs/elisp/xrdb-mode.el | 544 +++++++++ emacs/init.el | 1035 ++++++++++++++++ hgrc | 9 + install | 44 + minttyrc | 33 + ssh/rc | 5 + tmux.conf | 19 + xbindkeysrc.scm | 60 + xmobarrc | 40 + xresources/main | 32 + xresources/prefect | 1 + xresources/solarized-light | 70 ++ zsh/completion/_tmux_pane_words | 10 + zsh/fasd.zsh | 85 ++ zsh/fasdrc | 9 + zsh/functions/fasd/fasd | 624 ++++++++++ zsh/functions/runit/_sv | 7 + zsh/functions/runit/getservicedir | 2 + zsh/functions/runit/linksv | 16 + zsh/functions/runit/renamesv | 36 + zsh/zshrc | 367 ++++++ zsh/zshrc_freebsd | 8 + zsh/zshrc_gentoo | 4 + zsh/zshrc_prefect | 8 + zsh/zshrc_server | 20 + zsh/zshrc_sheldon | 5 + zsh/zshrc_st | 2 + 38 files changed, 6125 insertions(+) create mode 100644 atoprc create mode 100644 dwm/config.h create mode 100644 emacs/elisp/ap-functions.el create mode 100644 emacs/elisp/el-get-setup.el create mode 100644 emacs/elisp/eldoc-context.el create mode 100644 emacs/elisp/eldoc-php.el create mode 100644 emacs/elisp/electric-return.el create mode 100644 emacs/elisp/package-install.el create mode 100644 emacs/elisp/php-electric.el create mode 100644 emacs/elisp/shuffle-lines.el create mode 100644 emacs/elisp/web-vcs.el create mode 100644 emacs/elisp/xrdb-mode.el create mode 100644 emacs/init.el create mode 100644 hgrc create mode 100755 install create mode 100644 minttyrc create mode 100644 ssh/rc create mode 100644 tmux.conf create mode 100644 xbindkeysrc.scm create mode 100644 xmobarrc create mode 100644 xresources/main create mode 100644 xresources/prefect create mode 100644 xresources/solarized-light create mode 100644 zsh/completion/_tmux_pane_words create mode 100644 zsh/fasd.zsh create mode 100644 zsh/fasdrc create mode 100644 zsh/functions/fasd/fasd create mode 100644 zsh/functions/runit/_sv create mode 100644 zsh/functions/runit/getservicedir create mode 100644 zsh/functions/runit/linksv create mode 100644 zsh/functions/runit/renamesv create mode 100755 zsh/zshrc create mode 100755 zsh/zshrc_freebsd create mode 100644 zsh/zshrc_gentoo create mode 100644 zsh/zshrc_prefect create mode 100644 zsh/zshrc_server create mode 100644 zsh/zshrc_sheldon create mode 100644 zsh/zshrc_st diff --git a/atoprc b/atoprc new file mode 100644 index 00000000..d03319ea --- /dev/null +++ b/atoprc @@ -0,0 +1,2 @@ +flags Aa +maxlinecpu 0 \ No newline at end of file diff --git a/dwm/config.h b/dwm/config.h new file mode 100644 index 00000000..e9920707 --- /dev/null +++ b/dwm/config.h @@ -0,0 +1,105 @@ +/* See LICENSE file for copyright and license details. */ + +/* appearance */ +static const char font[] = "-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*"; +static const char normbordercolor[] = "#657b83"; +static const char normbgcolor[] = "#002b36"; +static const char normfgcolor[] = "#fdf6e3"; +static const char selbordercolor[] = "#859900"; +static const char selbgcolor[] = "#586e75"; +static const char selfgcolor[] = "#fdf6e3"; +static const unsigned int borderpx = 1; /* border pixel of windows */ +static const unsigned int snap = 32; /* snap pixel */ +static const Bool showbar = True; /* False means no bar */ +static const Bool topbar = True; /* False means bottom bar */ + +/* tagging */ +static const char *tags[] = { "shell", "code", "web", "misc" }; + +static const Rule rules[] = { + /* class instance title tags mask isfloating monitor */ + { "Firefox", NULL, NULL, 1 << 2, False, -1 }, + { "URxvt", NULL, NULL, 1 << 0, False, -1 }, + { "Emacs", NULL, NULL, 1 << 1, False, -1 }, + { "KeePass2", NULL, NULL, 1 << 3, False, -1 }, + { "deadbeef", NULL, NULL, 1 << 3, False, -1 }, +}; + +/* layout(s) */ +static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ +static const int nmaster = 1; /* number of clients in master area */ +static const Bool resizehints = True; /* True means respect size hints in tiled resizals */ + +static const Layout layouts[] = { + /* symbol arrange function */ + { "[]=", tile }, /* first entry is default */ + { "><>", NULL }, /* no layout function means floating behavior */ + { "[M]", monocle }, +}; + +/* key definitions */ +#define MODKEY Mod4Mask +#define TAGKEYS(KEY,TAG) \ + { MODKEY, KEY, toggleview, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask, KEY, view, {.ui = 1 << TAG} }, \ + { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, + +/* helper for spawning shell commands in the pre dwm-5.0 fashion */ +#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } + +/* commands */ +static const char *termcmd[] = { "urxvt", NULL }; + +static Key keys[] = { + /* modifier key function argument */ + { MODKEY|ShiftMask, XK_b, togglebar, {0} }, + { MODKEY, XK_e, focusstack, {.i = +1 } }, + { MODKEY, XK_i, focusstack, {.i = -1 } }, + { MODKEY, XK_s, incnmaster, {.i = +1 } }, + { MODKEY, XK_r, incnmaster, {.i = -1 } }, + { MODKEY, XK_n, setmfact, {.f = -0.05} }, + { MODKEY, XK_o, setmfact, {.f = +0.05} }, + { MODKEY, XK_Return, zoom, {0} }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY|ShiftMask, XK_c, killclient, {0} }, + { MODKEY, XK_g, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { MODKEY, XK_comma, focusmon, {.i = -1 } }, + { MODKEY, XK_period, focusmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + TAGKEYS( XK_1, 0) + TAGKEYS( XK_2, 1) + TAGKEYS( XK_3, 2) + TAGKEYS( XK_4, 3) + TAGKEYS( XK_5, 4) + TAGKEYS( XK_6, 5) + TAGKEYS( XK_7, 6) + TAGKEYS( XK_8, 7) + TAGKEYS( XK_9, 8) + { MODKEY|ShiftMask, XK_q, quit, {0} }, + { MODKEY|ShiftMask, XK_r, quit, { .i = 5 } }, +}; + +/* button definitions */ +/* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ +static Button buttons[] = { + /* click event mask button function argument */ + { ClkLtSymbol, 0, Button1, setlayout, {0} }, + { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, + { ClkWinTitle, 0, Button2, zoom, {0} }, + { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, + { ClkClientWin, MODKEY, Button1, movemouse, {0} }, + { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, + { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, + { ClkTagBar, 0, Button1, toggleview, {0} }, + { ClkTagBar, 0, Button3, view, {0} }, + { ClkTagBar, MODKEY, Button1, tag, {0} }, + { ClkTagBar, MODKEY, Button3, toggletag, {0} }, +}; diff --git a/emacs/elisp/ap-functions.el b/emacs/elisp/ap-functions.el new file mode 100644 index 00000000..d9278fa0 --- /dev/null +++ b/emacs/elisp/ap-functions.el @@ -0,0 +1,44 @@ +;;;###autoload +(defun ap/remove-extra-cr () + "Remove extraneous CR codes from a file" + (interactive) + (save-excursion + (goto-char (point-min)) + (while (search-forward " +" nil t) + (replace-match "")))) + +;;;###autoload +(defun copy-rectangle (start end) + "Copy the region-rectangle." + (interactive "r") + (setq killed-rectangle (extract-rectangle start end))) + +;;;###autoload +(defun eval-and-replace () + "Replace the preceding sexp with its value." + (interactive) + (backward-kill-sexp) + (condition-case nil + (prin1 (eval (read (current-kill 0))) + (current-buffer)) + (error (message "Invalid expression") + (insert (current-kill 0))))) + +;;;###autoload +(defun ap/byte-compile-get-dest (filename) + (let ((basename (file-name-nondirectory filename)) + (dirname (file-name-directory filename))) + (cond + ((string-equal basename "init.el") + (if (file-exists-p (concat user-emacs-directory "init.el")) + (concat user-emacs-directory "init.elc"))) + (t (let (byte-compile-dest-file-function) + (byte-compile-dest-file filename)))))) + +;;;###autoload +(defun shell-execute () + (interactive) + (let ((file-buffer (or (file-name-nondirectory (buffer-file-name)) "")) + (command (read-shell-command "Shell command: " nil nil nil))) + (shell-command (replace-regexp-in-string "%" file-buffer command)))) diff --git a/emacs/elisp/el-get-setup.el b/emacs/elisp/el-get-setup.el new file mode 100644 index 00000000..2d93e441 --- /dev/null +++ b/emacs/elisp/el-get-setup.el @@ -0,0 +1,66 @@ +(package-initialize) + +(setq + el-get-sources '( + (:name use-package + :type github + :pkgname "jwiegley/use-package") + (:name packed + :type github + :pkgname "tarsius/packed") + (:name auto-compile + :type github + :depends packed + :pkgname "tarsius/auto-compile") + (:name project-persist + :type github + :pkgname "rdallasgray/project-persist")) + + eg:basic-packages + '( + auto-compile + auto-indent-mode + autopair + ace-jump-mode + dired+ + diminish + expand-region + helm + help+ + help-fns+ + help-macro+ + help-mode+ + mic-paren + misc-cmds + multiple-cursors + projectile + project-persist + paredit + solarized-theme + smart-tab + smarttabs + smex + undo-tree + use-package + ) + + eg:windows-packages + '(ntcmd + w32-browser + ;; powershell + ;; powershell-mode + ) + + eg:cygwin-packages + '(windows-path)) + +(el-get-elpa-build-local-recipes) + +(el-get 'sync eg:basic-packages) + +(cond ((eq system-type 'cygwin) + (el-get 'sync eg:cygwin-packages) + (el-get 'sync eg:windows-packages)) + + ((eq system-type 'windows-nt) + (el-get 'sync eg:windows-packages))) diff --git a/emacs/elisp/eldoc-context.el b/emacs/elisp/eldoc-context.el new file mode 100644 index 00000000..df8797f2 --- /dev/null +++ b/emacs/elisp/eldoc-context.el @@ -0,0 +1,40 @@ +(provide 'eldoc-context) + +(defun rgr/toggle-context-help () + "Turn on or off the context help. +Note that if ON and you hide the help buffer then you need to +manually reshow it. A double toggle will make it reappear" + (interactive) + (with-current-buffer (help-buffer) + (unless (local-variable-p 'context-help) + (set (make-local-variable 'context-help) t)) + (if (setq context-help (not context-help)) + (progn + (if (not (get-buffer-window (help-buffer))) + (display-buffer (help-buffer))))) + (message "Context help %s" (if context-help "ON" "OFF")))) + +(defun rgr/context-help () + "Display function or variable at point in *Help* buffer if visible. +Default behaviour can be turned off by setting the buffer local +context-help to false" + (interactive) + (let ((rgr-symbol (symbol-at-point))) ; symbol-at-point http://www.emacswiki.org/cgi-bin/wiki/thingatpt%2B.el + (with-current-buffer (help-buffer) + (unless (local-variable-p 'context-help) + (set (make-local-variable 'context-help) t)) + (if (and context-help (get-buffer-window (help-buffer)) + rgr-symbol) + (if (fboundp rgr-symbol) + (describe-function rgr-symbol) + (if (boundp rgr-symbol) (describe-variable rgr-symbol))))))) + +(defadvice eldoc-print-current-symbol-info + (around eldoc-show-c-tag activate) + (cond + ((eq major-mode 'emacs-lisp-mode) (rgr/context-help) ad-do-it) + ((eq major-mode 'lisp-interaction-mode) (rgr/context-help) ad-do-it) + ((eq major-mode 'apropos-mode) (rgr/context-help) ad-do-it) + (t ad-do-it))) + +(global-set-key (kbd "C-c h") 'rgr/toggle-context-help) \ No newline at end of file diff --git a/emacs/elisp/eldoc-php.el b/emacs/elisp/eldoc-php.el new file mode 100644 index 00000000..8101fea0 --- /dev/null +++ b/emacs/elisp/eldoc-php.el @@ -0,0 +1,48 @@ +(require 'xml) +(provide 'eldoc-php) + +(setq my-php-function-doc-hash (make-hash-table :test 'equal)) + + +(defun my-php-fetch-function-doc (function) + (let ((doc (gethash function my-php-function-doc-hash 'nope))) + (when (eq doc 'nope) + (setq doc nil) + + (let ((buf (url-retrieve-synchronously (concat "http://uk3.php.net/manual-lookup.php?pattern=" function)))) + (with-current-buffer buf + (goto-char (point-min)) + (let (desc) + (when (re-search-forward "
\\(\\(.\\|\n\\)*?\\)
" nil t) + (setq desc + (replace-regexp-in-string + " +" " " + (replace-regexp-in-string + "\n" "" + (replace-regexp-in-string "<.*?>" "" (match-string-no-properties 1))))) + ;; Don't show the function description + ;; (when (re-search-forward "

\\(\\(.\\|\n\\)*?\\)

" nil t) + ;; (setq desc + ;; (concat desc "\n\n" + ;; (replace-regexp-in-string + ;; " +" " " + ;; (replace-regexp-in-string + ;; "\n" "" + ;; (replace-regexp-in-string "<.*?>" "" (match-string-no-properties 1))))))) + ) + + (if desc + (setq doc (xml-substitute-special desc))))) + + (kill-buffer buf)) + + (puthash function doc my-php-function-doc-hash)) + + doc)) + + +(defun my-php-eldoc-function () + (let ((symbol (thing-at-point 'symbol))) + (if (and symbol + (not (eq (elt symbol 0) ?$))) + (my-php-fetch-function-doc symbol)))) diff --git a/emacs/elisp/electric-return.el b/emacs/elisp/electric-return.el new file mode 100644 index 00000000..fcbebb3c --- /dev/null +++ b/emacs/elisp/electric-return.el @@ -0,0 +1,16 @@ +(defvar electrify-return-match + "[\]}\)\"]" + "If this regexp matches the text after the cursor, do an \"electric\" + return.") +(defun electrify-return-if-match (arg) + "If the text after the cursor matches `electrify-return-match' then + open and indent an empty line between the cursor and the text. Move the + cursor to the new line." + (interactive "P") + (let ((case-fold-search nil)) + (if (looking-at electrify-return-match) + (save-excursion (newline-and-indent))) + (newline arg) + (indent-according-to-mode))) +;; Using local-set-key in a mode-hook is a better idea. +;(global-set-key (kbd "RET") 'electrify-return-if-match) \ No newline at end of file diff --git a/emacs/elisp/package-install.el b/emacs/elisp/package-install.el new file mode 100644 index 00000000..f4ac9768 --- /dev/null +++ b/emacs/elisp/package-install.el @@ -0,0 +1,129 @@ +;;; package-install.el --- auto-installer for package.el + +;; Copyright (C) 2007, 2008 Tom Tromey + +;; This file is not (yet) part of GNU Emacs. +;; However, it is distributed under the same license. + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;; Code: + +;;; We don't want to define anything global here, so no defuns or +;;; defvars. + +;; Some values we need, copied from package.el, but with different +;; names. +(let ((my-archive-base "http://tromey.com/elpa/") + (my-user-dir (expand-file-name "~/.emacs.d/elpa"))) + + (require 'pp) + (let ((download + (lambda (url) + (if (fboundp 'url-retrieve-synchronously) + ;; Use URL to download. + (let ((buffer (url-retrieve-synchronously url))) + (save-excursion + (set-buffer buffer) + (goto-char (point-min)) + (re-search-forward "^$" nil 'move) + (forward-char) + (delete-region (point-min) (point)) + buffer)) + ;; Use wget to download. + (save-excursion + (with-current-buffer + (get-buffer-create + (generate-new-buffer-name " *Download*")) + (shell-command (concat "wget -q -O- " url) + (current-buffer)) + (goto-char (point-min)) + (current-buffer))))))) + + ;; Make the ELPA directory. + (make-directory my-user-dir t) + + ;; Download package.el and put it in the user dir. + (let ((pkg-buffer (funcall download (concat my-archive-base "package.el")))) + (save-excursion + (set-buffer pkg-buffer) + (setq buffer-file-name + (concat (file-name-as-directory my-user-dir) + "package.el")) + (save-buffer) + (kill-buffer pkg-buffer))) + + ;; Load package.el. + (load (expand-file-name "~/.emacs.d/elpa/package.el")) + + ;; Download URL package if we need it. + (unless (fboundp 'url-retrieve-synchronously) + ;; Note that we don't name the symbol "url-version", as that + ;; will cause us not to define the real url-version when + ;; url-vars is loaded, which in turn will cause errors later. + ;; Thanks to Tom Breton for this subtlety. + (let* ((the-version "1.15") + (pkg-buffer (funcall download (concat my-archive-base + "url-" the-version ".tar")))) + (save-excursion + (set-buffer pkg-buffer) + (package-unpack 'url the-version) + (kill-buffer pkg-buffer)))) + + ;; Arrange to load package.el at startup. + ;; Partly copied from custom-save-all. + + + (let ((filename (or user-init-file + (and (yes-or-no-p "You have no user-init-file, probably because Emacs was started with -q. Use ~/.emacs? ") + (convert-standard-filename "~/.emacs")))) + (magic (pp-to-string + '(when (load (expand-file-name "~/.emacs.d/elpa/package.el")) + (package-initialize))))) + (if (not filename) + (warn (concat "Cannot automatically activate package.el after reboot.\n" + "Please append the following code to your .emacs manually:\n" + "%s") magic) + (let ((old-buffer (find-buffer-visiting filename))) + (with-current-buffer (let ((find-file-visit-truename t)) + (or old-buffer (find-file-noselect filename))) + (unless (eq major-mode 'emacs-lisp-mode) + (emacs-lisp-mode)) + (let ((inhibit-read-only t)) + (save-excursion + (goto-char (point-max)) + (newline (if (bolp) 2 1)) + (insert ";;; This was installed by package-install.el.\n") + (insert ";;; This provides support for the package system and\n") + (insert ";;; interfacing with ELPA, the package archive.\n") + (insert ";;; Move this code earlier if you want to reference\n") + (insert ";;; packages in your .emacs.\n") + (insert magic))) + (let ((file-precious-flag t)) + (save-buffer)) + (unless old-buffer + (kill-buffer (current-buffer))))))) + + ;; Start the package manager. + (package-initialize) + + ;; Read package archive to give the user a nice initial + ;; experience. FIXME: this doesn't work, at least squid gave a + ;; weird error when I tried it :( + ;; (package-refresh-contents) + )) + +;;; package-install.el ends here diff --git a/emacs/elisp/php-electric.el b/emacs/elisp/php-electric.el new file mode 100644 index 00000000..599b2b1d --- /dev/null +++ b/emacs/elisp/php-electric.el @@ -0,0 +1,218 @@ +;; -*- Emacs-Lisp -*- +;; +;; php-electric.el --- electric submode for the php-mode +;; +;; Version: 1.0 +;; Release-Date: Sunday 04 March 2007 +;; +;; Copyright (C) 2007 +;; by Nikolay V. Nemshilov aka St. +;; +;; +;; License +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License +;; as published by the Free Software Foundation; either version 2 +;; of the License, or (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, write to the Free Software +;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +;; +;; +;; Features: +;; * autocompletion of the language contructions +;; such as if, for, foreach, etc blocks, +;; +;; * autocompletion of classes, interfaces and functions +;; definitions +;; +;; * autocompletion of the paired symbols, like [], (), "",'' +;; +;; +;; Usage: +;; Nothing magical, just place the file in a directory where +;; Emacs can find it, and write +;; +;; (require 'php-electric) +;; +;; in your configuration files ~/.emacs or wherever you keep it. +;; Then you can switch on/off the mode by the following command +;; +;; M-x php-electric-mode +;; +;; If you like to have it switched on automatically, you should +;; put the command in your php-mode hook or create new one, +;; like that +;; +;; (add-hook 'php-mode-hook '(lambda () (php-electric-mode))) +;; +;; That's it. +;; +;; +;; Changelog: +;; Sunday 04 March 2007 +;; The first version 1.0 has been came out. +;; + +(defgroup php-electric nil + "Minor php-electric mode" + :group 'php) + +;; list of keywords which expandible by the {} pair +(defconst php-electric-expandible-simple-re + "\\(try\\|else\\|do\\)") + +;; list of keywords which expandible with the (){} construction +(defconst php-electric-expandible-as-struct-re + "\\(while\\|for\\|foreach\\|if\\|elseif\\|catch\\)") + +;; list of keywords which expandible with the name(){} construction +(defconst php-electric-expandible-as-func-re + "\\(function\\)") + +;; list of keywords which expandible with the name{} construction +(defconst php-electric-expandible-as-class-re + "\\(class\\|interface\\)") + +;; list of the paired chars +(defvar php-electric-matching-delimeter-alist + '((?\[ . ?\]) + (?\( . ?\)) + (?\" . ?\") + (?\' . ?\'))) + +;; the minor-mode definition +(define-minor-mode php-electric-mode + "Minor electric-mode for the php-mode" + nil + "-El" + php-mode-map + (php-electric-keymap)) + +;; list of accessible keys +(defun php-electric-keymap() + (define-key php-mode-map " " 'php-electric-space) + (define-key php-mode-map "{" 'php-electric-curlies) + (define-key php-mode-map "(" 'php-electric-brackets) + (define-key php-mode-map "[" 'php-electric-matching-char) + (define-key php-mode-map "\"" 'php-electric-matching-char) + (define-key php-mode-map "\'" 'php-electric-matching-char)) + +;; handler for the spaces insertions +(defun php-electric-space(arg) + (interactive "P") + (self-insert-command (prefix-numeric-value arg)) + (if (php-electric-is-code-at-point-p) + (if (php-electric-line-is-simple-expandible) + ;; inserting just a pair of curleis + (progn + (insert "{")(php-electric-insert-new-line-and-statement-end)) + (if (php-electric-line-is-expandible-as-struct) + ;; inserting a structure definition + (progn + (if (not (char-equal ?\( (preceding-char))) + ;; cmd () { - style construction + (progn + (insert "(")(set-register 98 (point-marker))(insert ") {")) + + ;; cmd( ){ - style construction + (progn + (insert " ")(set-register 98 (point-marker))(insert " ){"))) + (php-electric-insert-new-line-and-statement-end) + (jump-to-register 98)(set-register 98 nil)) + (if (php-electric-line-is-expandible-as-func) + ;; inserting the function expanding + (save-excursion + (insert "(){")(php-electric-insert-new-line-and-statement-end)) + (if (php-electric-line-is-expandible-as-class) + ;; inserting the class expanding + (save-excursion + (insert "{")(php-electric-insert-new-line-and-statement-end)))))))) + +;; handler for the { chars +(defun php-electric-curlies(arg) + (interactive "P") + (self-insert-command (prefix-numeric-value arg)) + (if (php-electric-is-code-at-point-p) + (progn + (php-electric-insert-new-line-and-statement-end)))) + +;; handler for the ( chars +(defun php-electric-brackets(arg) + (interactive "P") + + (if (php-electric-is-code-at-point-p) + ;; checking if it's a statement + (if (php-electric-line-is-expandible-as-struct) + (progn (php-electric-space arg)) + (progn (php-electric-matching-char arg))) + (self-insert-command (prefix-numeric-value arg)))) + +;; handler for the paired chars, [], (), "", '' +(defun php-electric-matching-char(arg) + (interactive "P") + (self-insert-command (prefix-numeric-value arg)) + (if (php-electric-is-code-at-point-p) + (save-excursion + (insert (cdr (assoc last-command-char + php-electric-matching-delimeter-alist)))))) + +;; checks if the current pointer situated in a piece of code +(defun php-electric-is-code-at-point-p() + (and php-electric-mode + (let* ((properties (text-properties-at (point)))) + (and (null (memq 'font-lock-string-face properties)) + (null (memq 'font-lock-comment-face properties)))))) + +;; checks if the current line expandible with a simple {} construction +(defun php-electric-line-is-simple-expandible() + (let* ((php-electric-expandible-simple-real-re + (concat php-electric-expandible-simple-re "\\s-$"))) + (save-excursion + (backward-word 1) + (looking-at php-electric-expandible-simple-real-re)))) + +;; checks if the current line expandible with the (){} construction +(defun php-electric-line-is-expandible-as-struct() + (let* ((php-electric-expandible-as-struct-real-re + (concat php-electric-expandible-as-struct-re "[ ]*$")) + (php-electric-expandible-as-struct-with-bracket-re + (concat php-electric-expandible-as-struct-re "($"))) + (save-excursion + (backward-word 1) + (or (looking-at php-electric-expandible-as-struct-real-re) + (looking-at php-electric-expandible-as-struct-with-bracket-re))))) + +;; checks if the current line expandible with the name(){} construction +(defun php-electric-line-is-expandible-as-func() + (let* ((php-electric-expandible-as-func-real-re + (concat php-electric-expandible-as-func-re "\\s-$"))) + (save-excursion + (backward-word 1) + (looking-at php-electric-expandible-as-func-real-re)))) + +;; checks if the current line expandible with the name{} construction +(defun php-electric-line-is-expandible-as-class() + (let* ((php-electric-expandible-as-class-real-re + (concat php-electric-expandible-as-class-re "\\s-$"))) + (save-excursion + (backward-word 1) + (looking-at php-electric-expandible-as-class-real-re)))) + +;; "shortcut" to insert \n} construction +(defun php-electric-insert-new-line-and-statement-end() + (newline-and-indent)(set-register 99 (point-marker)) + (insert "\n}")(indent-according-to-mode) + (jump-to-register 99)(set-register 99 nil)) + + +(provide 'php-electric) + +;; end of the file \ No newline at end of file diff --git a/emacs/elisp/shuffle-lines.el b/emacs/elisp/shuffle-lines.el new file mode 100644 index 00000000..be0a98f9 --- /dev/null +++ b/emacs/elisp/shuffle-lines.el @@ -0,0 +1,20 @@ +;;;###autoload +(defun move-line-down () + (interactive) + (let ((col (current-column))) + (save-excursion + (forward-line) + (transpose-lines 1)) + (forward-line) + (move-to-column col))) + +;;;###autoload +(defun move-line-up () + (interactive) + (let ((col (current-column))) + (save-excursion + (forward-line) + (transpose-lines -1)) + (move-to-column col))) + +(provide 'shuffle-lines) diff --git a/emacs/elisp/web-vcs.el b/emacs/elisp/web-vcs.el new file mode 100644 index 00000000..1e2c3226 --- /dev/null +++ b/emacs/elisp/web-vcs.el @@ -0,0 +1,2342 @@ +;;; web-vcs.el --- Download file trees from VCS web pages +;; +;; Author: Lennart Borgman (lennart O borgman A gmail O com) +;; Created: 2009-11-26 Thu +(defconst web-vcs:version "0.62") ;; Version: +;; Last-Updated: 2011-03-12 Sat +;; URL: +;; Keywords: +;; Compatibility: +;; +;; Features that might be required by this library: +;; +;; `advice', `advice-preload', `backquote', `bytecomp', `cus-edit', +;; `cus-face', `cus-load', `cus-start', `help-fns', `ietf-drums', +;; `mail-parse', `mail-prsvr', `mm-bodies', `mm-decode', +;; `mm-encode', `mm-util', `rfc2045', `rfc2047', `rfc2231', +;; `timer', `web-autoload', `wid-edit'. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: +;; +;; Update file trees within Emacs from VCS systems using information +;; on their web pages. +;; +;; Available download commands are currently: +;; +;; `web-vcs-nxhtml' +;; +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Change log: +;; +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 3, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth +;; Floor, Boston, MA 02110-1301, USA. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Code: + +(eval-when-compile (require 'cl)) +(eval-when-compile (require 'compile)) +(eval-and-compile (require 'cus-edit)) +(eval-and-compile (require 'mm-decode)) +(eval-when-compile (require 'url-http)) + +(require 'advice) +(require 'web-autoload nil t) +;; (require 'url-util) +;; (require 'url) +;;(require 'url-parse) + +(defvar web-vcs-comp-dir nil) + +(defgroup web-vcs nil + "Customization group for web-vcs." + :group 'nxhtml) + +(defcustom web-vcs-links-regexp + `( + (lp-1-10 ;; Id + ;; Comment: + "http://www.launchpad.com/ uses this 2009-11-29 with Loggerhead 1.10 (generic?)" + ;; Files URL regexp: + ;; + ;; Extend this format to catch date/time too. + ;; + ;; ((patt (rx ...)) + ;; ;; use subexp numbers + ;; (url 1) + ;; (time 2) + ;; (rev 3)) + + ((time 1) + (url 2) + (patt ,(rx-to-string '(and "" + (submatch (regexp "[^<]*")) + "" + (0+ space) + "" + (regexp ".+") + "" + (*? (regexp ".\\|\n")) + "href=\"" + (submatch (regexp ".*/download/[^\"]*")) + "\"")))) + ;; Dirs URL regexp: + ,(rx-to-string '(and "href=\"" + (group (regexp ".*%3A/[^\"]*/")) + "\"")) + ;; File name URL part regexp: + "\\([^\/]*\\)$" + ;; Page revision regexp: + ,(rx-to-string '(and "for revision" + (+ whitespace) + "" + (submatch (+ digit)) + "")) + ;; Release revision regexp: + ,(rx-to-string '(and "/" + (submatch (+ digit)) + "\"" (+ (not (any ">"))) ">" + (optional "Release ") + (+ digit) "." (+ digit) "<")) + ) + (lp ;; Id + ;; Comment: + "http://www.launchpad.com/ uses this 2010-06-26 with Loggerhead 1.17 (generic?)" + ;; Files URL regexp: + ;; + ;; Extend this format to catch date/time too. + ;; + ;; ((patt (rx ...)) + ;; ;; use subexp numbers + ;; (url 1) + ;; (time 2) + ;; (rev 3)) + ((time 1) + (url 2) + (patt ,(rx-to-string '(and "" + (submatch + (*\? + (not (any "<")))) + "" + (*? anything) + "") + ;;(and "href=\"" (group (regexp ".*%3A/[^\"]*/")) "\"") + ) + ;; File name URL part regexp: + "\\([^\/]*\\)$" + ;; Page revision regexp: + ,(rx-to-string '(and "for revision" + (+ whitespace) + "" + (submatch (+ digit)) + "")) + ;; Release revision regexp: + ,(rx-to-string '(and "/" + (submatch (+ digit)) + "\"" (+ (not (any ">"))) ">" + (optional "Release ") + (+ digit) "." (+ digit) "<")) + ) + ) + "Regexp patterns for matching links on a VCS web page. +The patterns are grouped by VCS web system type. + +\\ +To make a new pattern you can do like this: + +- Open the file in Firefox. +- View the buffer source in Emacs in some way. +- Turn on `mozadd-mirror-mode'. +- Use the command `mozadd-init-href-patten'. +- Then start `re-builder' to refine the pattern. + (Or, use isearch if you prefer that.) +- Use `ourcomments-copy-target-region-to-reb' for + easy copying from target buffer to re-builder. +- To see what you patterns matches in the web page + use `M-x mozadd-update-mozilla'. +- If the page looks terrible then add a + tag by doing `M-x mozadd-add-href-base'. + +*Note: It is always sub match 1 from these patterns that are + used." + :type '(repeat + (list + (symbol :tag "VCS web system type specifier") + (string :tag "Description") + (set (list (const time) integer) + (list (const url) integer) + (list (const patt) regexp)) + ;;(regexp :tag "Files URL regexp") + (regexp :tag "Dirs URL regexp") + (regexp :tag "File name URL part regexp") + (regexp :tag "Page revision regexp") + (regexp :tag "Release revision regexp") + )) + :group 'web-vcs) + +(defface web-vcs-mode-line + '((t (:foreground "black" :background "OrangeRed"))) + "Mode line face during download." + :group 'web-vcs) + +(defface web-vcs-mode-line-inactive + '((t (:foreground "black" :background "Orange"))) + "Mode line face during download." + :group 'web-vcs) + +(defface web-vcs-gold + '((t (:foreground "black" :background "gold"))) + "Face for web-vcs messages." + :group 'web-vcs) + +(defface web-vcs-red + '((t (:foreground "black" :background "#f86"))) + "Face for web-vcs messages." + :group 'web-vcs) + +(defface web-vcs-green + '((t (:foreground "black" :background "#8f6"))) + "Face for web-vcs messages." + :group 'web-vcs) + +(defface web-vcs-yellow + '((t (:foreground "black" :background "yellow"))) + "Face for web-vcs messages." + :group 'web-vcs) + +(defface web-vcs-pink + '((t (:foreground "black" :background "pink"))) + "Face for web-vcs messages." + :group 'web-vcs) + +(defcustom web-vcs-default-download-directory + "~/.emacs.d/" + "Default download directory." + :type '(choice (const :tag "~/.emacs.d/" "~/.emacs.d/") + (const :tag "Fist site-lisp in `load-path'" site-lisp-dir) + (const :tag "Directory where `site-run-file' lives" site-run-dir) + (string :tag "Specify directory")) + :group 'web-vcs) + +;;(web-vcs-default-download-directory) +;;;###autoload +(defun web-vcs-default-download-directory () + "Try to find a suitable place. +Use the choice in `web-vcs-default-download-directory'. +If this does not fit fall back to \"~/.emacs.d/\"." + (let* ((site-run-dir (when site-run-file + (let ((lib (locate-library site-run-file))) + (when lib + (file-name-directory lib))))) + (site-lisp-dir (catch 'first-site-lisp + (dolist (d load-path) + (let ((dir (file-name-nondirectory (directory-file-name d)))) + (when (string= dir "site-lisp") + (throw 'first-site-lisp (file-name-as-directory d))))))) + (dummy (message "site-run-dir=%S site-lisp-dir=%S" site-run-dir site-lisp-dir)) + (dir (or (case web-vcs-default-download-directory + ;;('~/.emacs.d/ "~/.emacs.d/") + ('site-lisp-dir site-lisp-dir) + ('site-run-dir site-run-dir)) + web-vcs-default-download-directory))) + (or dir "~/.emacs.d/"))) + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Logging + +(defcustom web-vcs-log-file "~/.emacs.d/web-vcs-log.org" + "Log file for web-vcs." + :type 'file + :group 'web-vcs) + +;;;###autoload +(defun web-vcs-log-edit () + "Open log file." + (interactive) + (find-file web-vcs-log-file)) + +(defvar web-vcs-log-save-timer nil) + +(defun web-vcs-log-save-when-idle () + (when (timerp web-vcs-log-save-timer) (cancel-timer web-vcs-log-save-timer)) + (run-with-idle-timer 0 nil 'web-vcs-log-save)) + +(defun web-vcs-log-save () + (let ((log-buf (find-buffer-visiting web-vcs-log-file))) + (when (and log-buf (buffer-modified-p log-buf)) + (with-current-buffer log-buf + (basic-save-buffer))) + log-buf)) + +(defun web-vcs-log-close () + (let ((log-buf (web-vcs-log-save))) + (when log-buf + (kill-buffer log-buf)))) + +;; Fix-me: Add some package descriptor to log +(defun web-vcs-log (url dl-file msg) + (unless (file-exists-p web-vcs-log-file) + (let ((dir (file-name-directory web-vcs-log-file))) + (unless (file-directory-p dir) + (make-directory dir)))) + (with-current-buffer (find-file-noselect web-vcs-log-file) + (setq buffer-save-without-query t) + (web-vcs-log-save-when-idle) + (save-restriction + (widen) + (let ((today-entries (format-time-string "* %Y-%m-%d")) + (now (format-time-string "%H:%M:%S GMT" nil t))) + (goto-char (point-max)) + (unless (re-search-backward (concat "^" today-entries) nil t) + (goto-char (point-max)) + (insert "\n" today-entries "\n")) + (goto-char (point-max)) + (when url + (insert "** Downloading file " now "\n" + (format " file [[file:%s][%s]]\n from %s\n" dl-file dl-file url) + )) + (cond + ((stringp msg) + (goto-char (point-max)) + (insert msg "\n")) + (msg (basic-save-buffer))))))) + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Finding and downloading files + +;;;###autoload +(defun web-vcs-get-files-from-root (web-vcs full-url dl-dir) + "Download a file tree from VCS system using the web interface. +Use WEB-VCS entry in variable `web-vcs-links-regexp' to download +files via http from FULL-URL to directory DL-DIR. + +Show FULL-URL first and offer to visit the page. That page will +give you information about version control system \(VCS) system +used etc." + (unless (web-vcs-contains-moved-files dl-dir) + (let ((resize-mini-windows (or resize-mini-windows t))) + (when (if (not (y-or-n-p (concat "Download files from \"" full-url "\".\n" + "You can see on that page which files will be downloaded.\n\n" + "Visit that page before downloading? "))) + t + (browse-url full-url) + (if (y-or-n-p "Start downloading? ") + t + (message "Aborted") + nil)) + (message "") + (web-vcs-get-files-on-page web-vcs full-url t (file-name-as-directory dl-dir) nil) + t)))) + +(defun web-vcs-get-files-on-page (web-vcs page-url recursive dl-dir test) + "Download files listed by WEB-VCS on web page PAGE-URL. +WEB-VCS is a specifier in `web-vcs-links-regexp'. + +If RECURSIVE go into sub folders on the web page and download +files from them too. + +Place the files under DL-DIR. + +Before downloading check if the downloaded revision already is +the same as the one on the web page. This is stored in the file +web-vcs-revision.txt. After downloading update this file. + +If TEST is non-nil then do not download, just list the files." + (unless (string= dl-dir (file-name-as-directory (expand-file-name dl-dir))) + (error "Download dir dl-dir=%S must be a full directory path" dl-dir)) + (catch 'command-level + (when (web-vcs-contains-moved-files dl-dir) + (throw 'command-level nil)) + (let ((vcs-rec (or (assq web-vcs web-vcs-links-regexp) + (error "Does not know web-cvs %S" web-vcs))) + (start-time (current-time))) + (unless (file-directory-p dl-dir) + (if (yes-or-no-p (format "Directory %S does not exist, create it? " + (file-name-as-directory + (expand-file-name dl-dir)))) + (make-directory dl-dir t) + (message "Can't download then") + (throw 'command-level nil))) + ;; (let ((old-win (selected-window))) + ;; (unless (eq (get-buffer "*Messages*") (window-buffer old-win)) + ;; (switch-to-buffer-other-window "*Messages*")) + ;; (goto-char (point-max)) + ;; (insert "\n") + ;; (insert (propertize (format "\n\nWeb-Vcs Download: %S\n" page-url) 'face 'web-vcs-gold)) + ;; (insert "\n") + ;; (redisplay t) + ;; (set-window-point (selected-window) (point-max)) + ;; (select-window old-win)) + (web-vcs-message-with-face 'web-vcs-gold "\n\nWeb-Vcs Download: %S\n" page-url) + (web-vcs-display-messages nil) + (let* ((rev-file (expand-file-name "web-vcs-revision.txt" dl-dir)) + (rev-buf (find-file-noselect rev-file)) + ;; Fix-me: Per web vcs speficier. + (old-rev-range (with-current-buffer rev-buf + (widen) + (goto-char (point-min)) + (when (re-search-forward (format "%s:\\(.*\\)\n" web-vcs) nil t) + ;;(buffer-substring-no-properties (point-min) (line-end-position)) + ;;(match-string 1) + (cons (match-beginning 1) (match-end 1)) + ))) + (old-revision (when old-rev-range + (with-current-buffer rev-buf + (buffer-substring-no-properties (car old-rev-range) + (cdr old-rev-range))))) + (dl-revision (web-vcs-get-revision-on-page vcs-rec page-url)) + ret + moved) + (when (and old-revision (string= old-revision dl-revision)) + (when (y-or-n-p (format "You already have revision %s. Quit? " dl-revision)) + (message "Aborted") + (kill-buffer rev-buf) + (throw 'command-level nil))) + ;; We do not have a revision number once we start download. + (with-current-buffer rev-buf + (when old-rev-range + (delete-region (car old-rev-range) (cdr old-rev-range)) + (basic-save-buffer))) + (setq ret (web-vcs-get-files-on-page-1 + vcs-rec page-url + dl-dir + "" + nil + (if recursive 0 nil) + dl-revision + test + 0)) + (setq moved (nth 1 ret)) + ;; Now we have a revision number again. + (with-current-buffer rev-buf + (when (= 0 (buffer-size)) + (insert "WEB VCS Revisions\n\n")) + (goto-char (point-max)) + (unless (eolp) (insert "\n")) + (insert (format "%s:%s\n" web-vcs dl-revision)) + (basic-save-buffer) + (kill-buffer)) + (message "-----------------") + (web-vcs-message-with-face 'web-vcs-gold "Web-Vcs Download Ready: %S" page-url) + (web-vcs-message-with-face 'web-vcs-gold " Time elapsed: %S" + (web-vcs-nice-elapsed start-time (current-time))) + (when (> moved 0) + (web-vcs-message-with-face 'web-vcs-yellow + " %i files updated (old versions renamed to *.moved)" + moved)))))) + +(defun web-vcs-get-files-on-page-1 (vcs-rec page-url dl-root dl-relative file-mask recursive dl-revision test num-files) + "Download files listed by VCS-REC on web page page-URL. +VCS-REC should be an entry like the entries in the list +`web-vcs-links-regexp'. + +If FILE-MASK is non-nil then it is used to match a file relative +path. Only matching files will be downloaded. FILE-MASK can +have two forms, a regular expression or a function. + +If FILE-MASK is a regular expression then each part of the path +may be a regular expresion \(not containing /). + +If FILE-MASK is a function then this function is called in each +directory under DL-ROOT. The function is called with the +directory as a parameter and should return a cons. The first +element of the cons should be a regular expression matching file +names in that directory that should be downloaded. The cdr +should be t if subdirectories should be visited. + +If RECURSIVE go into sub folders on the web page and download +files from them too. + +Place the files under DL-DIR. + +The revision on the page page-URL should match DL-REVISION if this is non-nil. + +If TEST is non-nil then do not download, just list the files" + ;;(web-vcs-message-with-face 'font-lock-comment-face "web-vcs-get-files-on-page-1 %S %S %S %S" page-url dl-root dl-relative file-mask) + (let* ((files-matcher (nth 2 vcs-rec)) + (dirs-href-regexp (nth 3 vcs-rec)) + (revision-regexp (nth 5 vcs-rec)) + ;; (setq x (url-generic-parse-url "http://somewhere.com/file/path.el")) + ;; (setq x (url-generic-parse-url "http://somewhere.com")) + ;; (setq x (url-generic-parse-url "/somewhere.com")) + ;; (url-type x) + ;; (url-host x) + ;; (url-filename x) + ;; (url-fullness x) + ;; (url-port x) + ;; (setq y (url-expand-file-name "/suburl/other.el" x)) + ;; (setq y (url-expand-file-name "http://other.com/suburl/other.el" x)) + ;;(page-urlobj (url-generic-parse-url page-url)) + ;;(page-url-fullness (or (url-fullness page-urlobj) (error "Incomplete URL: %S" page-url))) + ;;(page-url-host (url-host page-urlobj)) + ;;(page-url-type (url-type page-urlobj)) + ;;(page-url-file (url-filename page-urlobj)) + ;;(page-host-url (concat page-url-type "://" page-url-host)) + (dl-dir (file-name-as-directory (expand-file-name dl-relative dl-root))) + (lst-dl-relative (web-vcs-file-name-as-list dl-relative)) + (lst-file-mask (when (stringp file-mask) (web-vcs-file-name-as-list file-mask))) + ;;(url-buf (url-retrieve-synchronously page-url)) + this-page-revision + files + suburls + (moved 0) + (temp-file-base (expand-file-name "web-vcs-temp-list.tmp" dl-dir)) + temp-list-file + temp-list-buf + folder-res + http-sts) + ;; Fix-me: It looks like there is maybe a bug in url-copy-file so + ;; that it runs synchronously. Try to workaround the problem by + ;; making a new file temp file name. + (web-vcs-display-messages nil) + (unless (file-directory-p dl-dir) (make-directory dl-dir t)) + ;;(message "TRACE: dl-dir=%S" dl-dir) + (setq temp-list-file (make-temp-name temp-file-base)) + (setq temp-list-buf (web-vcs-ass-folder-cache page-url)) + (unless temp-list-buf + ;;(setq temp-list-buf (generate-new-buffer "web-wcs-folder")) + ;;(web-vcs-url-copy-file-and-check page-url temp-list-file nil) + (let ((ready nil)) + (while (not ready) + (setq folder-res (web-vcs-url-retrieve-synch page-url)) + ;; (with-current-buffer temp-list-buf + ;; (insert-file-contents temp-list-file)) + (if (memq (cdr folder-res) '(200 201)) + (setq ready t) + (web-vcs-message-with-face 'web-vcs-red "Could not get %S" page-url) + (web-vcs-display-messages t) + (when (y-or-n-p (format "Could not get %S, visit page to see what is wrong? " page-url)) + (browse-url page-url)) + (unless (y-or-n-p "Try again? (It is safe to break here and try again later.) ") + (throw 'command-level nil)))))) + ;;(with-current-buffer temp-list-buf + (with-current-buffer (car folder-res) + ;;(delete-file temp-list-file) + ;;(find-file-noselect temp-list-file) + (when dl-revision + (setq this-page-revision (web-vcs-get-revision-from-url-buf vcs-rec (current-buffer) page-url))) + (when dl-revision + (unless (string= dl-revision this-page-revision) + (web-vcs-message-with-face 'web-vcs-red "Revision on %S is %S, but should be %S" + page-url this-page-revision dl-revision) + (web-vcs-display-messages t) + (throw 'command-level nil))) + ;; Find files + (goto-char (point-min)) + (let ((files-href-regexp (nth 1 (assq 'patt files-matcher))) + (url-num (nth 1 (assq 'url files-matcher))) + (time-num (nth 1 (assq 'time files-matcher)))) + (while (re-search-forward files-href-regexp nil t) + ;; Fix-me: What happened to full url??? + (let* ((file (match-string url-num)) + (time (match-string time-num)) + (full-file (url-expand-file-name file page-url))) + (add-to-list 'files (list full-file time))))) + (when (< (length files) num-files) + (message "files-on-page-1: found %d files, expected %d" (length files) num-files)) + ;; Find subdirs + (when recursive + (goto-char (point-min)) + (while (re-search-forward dirs-href-regexp nil t) + (let* ((suburl (match-string 1)) + (lenurl (length page-url)) + (full-suburl (url-expand-file-name suburl page-url))) + ;;(message "suburl=%S" suburl) + (when (and (> (length full-suburl) lenurl) + (string= (substring full-suburl 0 lenurl) page-url)) + ;;(message "...added") + (add-to-list 'suburls full-suburl))))) + (kill-buffer)) + ;; Download files + ;;(message "TRACE: files=%S" files) + (web-vcs-download-files vcs-rec files dl-dir dl-root) + ;; Download subdirs + (when suburls + (dolist (suburl (reverse suburls)) + (let* ((dl-sub-dir (substring suburl (length page-url))) + (full-dl-sub-dir (file-name-as-directory + (expand-file-name dl-sub-dir dl-dir))) + (rel-dl-sub-dir (file-relative-name full-dl-sub-dir dl-root))) + ;;(message "web-vcs-get-revision-from-url-buf dir: %S %S" file-mask rel-dl-sub-dir) + (when (or (not file-mask) + (not (stringp file-mask)) + (= 1 (length (web-vcs-file-name-as-list file-mask))) + (web-vcs-match-folderwise file-mask rel-dl-sub-dir)) + ;;(message "matched dir %S" rel-dl-sub-dir) + (unless (web-vcs-contains-file dl-dir full-dl-sub-dir) + (error "Subdir %S not in %S" dl-sub-dir dl-dir)) + (let* ((ret (web-vcs-get-files-on-page-1 vcs-rec + suburl + dl-root + rel-dl-sub-dir + file-mask + (1+ recursive) + this-page-revision + test + 0))) + (setq moved (+ moved (nth 1 ret)))))))) + (list this-page-revision moved))) + +(defun web-vcs-get-missing-matching-files (web-vcs url dl-dir file-mask num-files) + "Download missing files from VCS system using the web interface. +Use WEB-VCS entry in variable `web-vcs-links-regexp' to download +files via http from URL to directory DL-DIR. + +FILE-MASK is used to match files that should be downloaded. See +`web-vcs-get-files-on-page-1' for more information. + +Before downloading offer to visit the page from which the +downloading will be made. +" + (unless file-mask (error "file-mask is nil")) + (let ((vcs-rec (or (assq web-vcs web-vcs-links-regexp) + (error "Does not know web-cvs %S" web-vcs)))) + (web-vcs-get-files-on-page-1 vcs-rec url dl-dir "" file-mask 0 nil nil num-files))) + + +;; (web-vcs-get-files-on-page 'lp "http://bazaar.launchpad.net/%7Enxhtml/nxhtml/main/files/head%3A/" t "c:/test/temp13/" t) + +(defvar web-vcs-folder-cache nil) ;; dyn var +(defun web-vcs-add-folder-cache (url buf) + (add-to-list 'web-vcs-folder-cache (list url buf))) +(defun web-vcs-ass-folder-cache (url) + (assoc url web-vcs-folder-cache)) +(defun web-vcs-clear-folder-cache () + (while web-vcs-folder-cache + (let ((ub (car web-vcs-folder-cache))) + (setq web-vcs-folder-cache (cdr web-vcs-folder-cache)) + (kill-buffer (nth 1 ub))))) + +(defun web-vcs-url-copy-file-and-check (file-url dl-file dest-file) + "Copy FILE-URL to DL-FILE. +Log what happened. Use DEST-FILE in the log, not DL-FILE which is +a temporary file." + (let ((http-sts nil) + (file-nonempty nil) + (fail-reason nil)) + (when dest-file (web-vcs-log file-url dest-file nil)) + (web-vcs-display-messages nil) + ;;(message "before url-copy-file %S" dl-file) + (setq http-sts (web-vcs-url-copy-file file-url dl-file nil t)) ;; don't overwrite, keep time + ;;(message "after url-copy-file %S" dl-file) + (if (and (file-exists-p dl-file) + (setq file-nonempty (< 0 (nth 7 (file-attributes dl-file)))) ;; file size 0 + (memq http-sts '(200 201))) + (when dest-file + (web-vcs-log nil nil " Done.\n")) + (setq fail-reason + (cond + (http-sts (format "HTTP %s" http-sts)) + (file-nonempty "File looks bad") + (t "Server did not respond"))) + (unless dest-file (web-vcs-log file-url dl-file "TEMP FILE")) + (web-vcs-log nil nil (format " *Failed:* %s\n" fail-reason)) + ;; Requires user attention and intervention + (web-vcs-message-with-face 'web-vcs-red "Download failed: %s, %S" fail-reason file-url) + (web-vcs-display-messages t) + (when (y-or-n-p (format "Vist page %S to see what is wrong? " file-url)) + (browse-url file-url)) + (message "\n") + (web-vcs-message-with-face 'web-vcs-yellow "Please retry what you did before!\n") + (throw 'command-level nil)))) + +(defvar web-autoload-temp-file-prefix "TEMPORARY-WEB-AUTO-LOAD-") +(defvar web-autoload-active-file-sub-url) ;; Dyn var, active during file download check +(defun web-autoload-acvtive () + (and (boundp 'web-autoload-active-file-sub-url) + web-autoload-active-file-sub-url)) + +(defun web-vcs-download-files (vcs-rec files dl-dir dl-root) + (dolist (file (reverse files)) + (let* ((url-file (nth 0 file)) + (url-file-time-str (nth 1 file)) + ;; date-to-time assumes GMT so this is ok: + (url-file-time (when url-file-time-str (date-to-time url-file-time-str))) + (url-file-name-regexp (nth 4 vcs-rec)) + (url-file-rel-name (progn + (when (string-match url-file-name-regexp url-file) + (match-string 1 url-file)))) + (dl-file-name (expand-file-name url-file-rel-name dl-dir)) + (dl-file-time (nth 5 (file-attributes dl-file-name))) + (file-rel-name (file-relative-name dl-file-name dl-root)) + (file-name (file-name-nondirectory dl-file-name)) + (temp-file (expand-file-name (concat web-autoload-temp-file-prefix file-name) dl-dir)) + temp-buf) + (cond + ;;((and file-mask (not (web-vcs-match-folderwise file-mask file-rel-name)))) + ((and dl-file-time + url-file-time + (progn + ;;(message "dl-file-time =%s" (when dl-file-time (current-time-string dl-file-time))) + ;;(message "url-file-time=%s" (when url-file-time (current-time-string url-file-time))) + ;;(message "url-file-tstr=%s" (when url-file-time url-file-time-str)) + t) + (time-less-p url-file-time + (time-add dl-file-time (seconds-to-time 1)))) + (web-vcs-message-with-face 'web-vcs-green "Local file %s is newer or same age" file-rel-name)) + ;;(test (progn (message "TEST url-file=%S" url-file) (message "TEST url-file-rel-name=%S" url-file-rel-name) (message "TEST dl-file-name=%S" dl-file-name) )) + (t + ;; Avoid trouble with temp file + (while (setq temp-buf (find-buffer-visiting temp-file)) + (set-buffer-modified-p nil) (kill-buffer temp-buf)) + (when (file-exists-p temp-file) (delete-file temp-file)) + ;;(web-vcs-message-with-face 'font-lock-comment-face "Starting url-copy-file %S %S t t" url-file temp-file) + (web-vcs-url-copy-file-and-check url-file temp-file dl-file-name) + ;;(web-vcs-message-with-face 'font-lock-comment-face "Finished url-copy-file %S %S t t" url-file temp-file) + (let* ((time-after-url-copy (current-time)) + (old-buf-open (find-buffer-visiting dl-file-name))) + (when (and old-buf-open (buffer-modified-p old-buf-open)) + (save-excursion + (switch-to-buffer old-buf-open) + (when (y-or-n-p (format "Buffer %S is modified, save to make a backup? " dl-file-name)) + (save-buffer)))) + (if (and dl-file-time (web-vcs-equal-files dl-file-name temp-file)) + (progn + (delete-file temp-file) + (when url-file-time (set-file-times dl-file-name url-file-time)) + (web-vcs-message-with-face 'web-vcs-green "File %S was ok" dl-file-name)) + (when dl-file-time + (let ((backup (concat dl-file-name ".moved"))) + (rename-file dl-file-name backup t))) + ;; Be paranoid and let user check here. I actually + ;; believe that is a very good thing here. + (web-vcs-be-paranoid temp-file dl-file-name file-rel-name) + (rename-file temp-file dl-file-name) + (when url-file-time (set-file-times dl-file-name url-file-time)) + ;; (let ((buf (find-buffer-visiting dl-file-name))) + ;; (when buf + ;; (with-current-buffer buf + ;; (message "before revert-buffer") + ;; (revert-buffer nil t t) + ;; (message "after revert-buffer") + ;; ))) + (if dl-file-time + (web-vcs-message-with-face 'web-vcs-yellow "Updated %S" dl-file-name) + (web-vcs-message-with-face 'web-vcs-green "Downloaded %S" dl-file-name)) + (when old-buf-open + (with-current-buffer old-buf-open + (set-buffer-modified-p nil) + (revert-buffer nil t t))) + (with-current-buffer (find-file-noselect dl-file-name) + (setq header-line-format + (propertize (format-time-string "This file was downloaded %Y-%m-%d %H:%M") + 'face 'web-vcs-green)))) + (web-vcs-display-messages nil) + ;; This is both for user and remote server load. Do not remove this. + (redisplay t) (sit-for (- 1.0 (float-time (time-subtract (current-time) time-after-url-copy)))) + ;; (unless old-buf-open + ;; (when old-buf + ;; (kill-buffer old-buf))) + ))) + (redisplay t)))) + +(defun web-vcs-get-revision-on-page (vcs-rec url) + "Get revision number using VCS-REC on page URL. +VCS-REC should be an entry like the entries in the list +`web-vcs-links-regexp'." + ;; url-insert-file-contents + (let ((url-buf (url-retrieve-synchronously url))) + (web-vcs-get-revision-from-url-buf vcs-rec url-buf url))) + +(defun web-vcs-get-revision-from-url-buf (vcs-rec url-buf rev-page-url) + "Get revision number using VCS-REC. +VCS-REC should be an entry in the list `web-vcs-links-regexp'. +The buffer URL-BUF should contain the content on page +REV-PAGE-URL." + (let ((revision-regexp (nth 5 vcs-rec))) + ;; Get revision number + (with-current-buffer url-buf + (goto-char (point-min)) + (if (not (re-search-forward revision-regexp nil t)) + (progn + (web-vcs-message-with-face 'web-vcs-red "Can't find revision number on %S" rev-page-url) + (web-vcs-display-messages t) + (when (y-or-n-p (format "Coult not find rev no on %S, visit page to see what is wrong? " rev-page-url)) + (browse-url rev-page-url)) + (throw 'command-level nil)) + (match-string 1))))) + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Auto Download + + +;; fix-me: To emulation-mode-map +;; Fix-me: put this on better keys +(defvar web-vcs-paranoid-state-mode-map + (let ((map (make-sparse-keymap))) + (define-key map [(control ?c)(control ?c)] 'exit-recursive-edit) + (define-key map [(control ?c)(control ?n)] 'web-autoload-continue-no-stop) + (define-key map [(control ?c)(control ?r)] 'web-vcs-investigate-elisp-file) + (define-key map [(control ?c)(control ?q)] 'web-vcs-quit-auto-download) + map)) + +(defun web-vcs-quit-auto-download () + "Quit download process. +This stops the current web autoload processing." + (interactive) + ;; Fix-me. + (when (y-or-n-p "Stop web autoload processing? You can resume it later. ") + (web-vcs-message-with-face 'web-vcs-red + "Stopped autoloading in process. It will be resumed when necessary again.") + (web-vcs-log nil nil "User stopped autoloading") + (throw 'top-level 'web-autoload-stop))) + +(define-minor-mode web-vcs-paranoid-state-mode + "Mode used temporarily during user check of downloaded file. +Do not turn on this yourself." + :lighter (concat " " (propertize "Download file check" 'face 'font-lock-warning-face)) + :global t + :group 'web-vcs + (or (not web-vcs-paranoid-state-mode) + (web-autoload-acvtive) + (error "This mode can't be used when not downloading"))) + +(defcustom web-autoload-paranoid t + "Be paranoid and break to check each file after download." + :type 'boolean + :group 'web-vcs) + +(defun web-autoload-continue-no-stop () + "Continue web auto download. +This is used after inspecting downloaded elisp files. Set +`web-autoload-paranoid' to nil before contiuning to avoid further +breaks to check downloaded files." + (interactive) + (setq web-autoload-paranoid nil) + (web-autoload-continue)) + +(defun web-autoload-continue () + "Continue web auto download. +This is used after inspecting downloaded elisp files." + (interactive) + (if (< 0 (recursion-depth)) + (exit-recursive-edit) + (web-autoload-byte-compile-queue))) + +(defun web-vcs-be-paranoid (temp-file file-dl-name file-sub-url) + "Be paranoid and check FILE-DL-NAME." + (when (or (not (boundp 'web-autoload-paranoid)) + web-autoload-paranoid) + (save-window-excursion + (let* ((comp-buf (get-buffer "*Compilation*")) + (comp-win (and comp-buf + (get-buffer-window comp-buf))) + (msg-win (web-vcs-display-messages nil)) + temp-buf + (kf-desc (lambda (fun) + (let* ((key (where-is-internal fun nil t)) + (k-desc (when key (key-description key))) + (fmt-kf "\n %s (or %s)") + (fmt-f "\n %s")) + (if key + (format fmt-kf k-desc fun) + (format fmt-f fun) + ))))) + (if comp-win + (progn + (select-window comp-win) + (find-file file-dl-name)) + (select-window msg-win) + (find-file-other-window temp-file)) + (setq temp-buf (current-buffer)) + (web-vcs-log-save) + (message "-") + (message "") + (with-selected-window msg-win + (goto-char (point-max))) + (let ((proceed nil) + (web-autoload-active-file-sub-url file-sub-url) ;; Dyn var, active during file download check + (ws (with-current-buffer "*Messages*" (point-marker)))) + (web-vcs-paranoid-state-mode 1) + (web-vcs-message-with-face + 'secondary-selection + (concat "Please check the downloaded file and then continue by doing" + (funcall kf-desc 'exit-recursive-edit) + (if (fboundp 'web-autoload-continue-no-stop) + (concat + "\n\nOr, for no more breaks to check files do" + (funcall kf-desc 'web-autoload-continue-no-stop)) + "") + "\n\nTo stop the web autoloading process for now do" + (funcall kf-desc 'web-autoload-quit-download) + "\n\nTo see the log file you can do" + (funcall kf-desc 'web-vcs-log-edit) + "\n")) + (message "") + (let ((msg-win (car (get-buffer-window-list "*Messages*" nil nil)))) + (when msg-win (set-window-start msg-win ws))) + (while (not proceed) + (condition-case err + (when (eq 'web-autoload-stop + (catch 'top-level + ;; Fix-me: review file before rename! + (setq header-line-format + (propertize + (format "Review for downloading. Continue: C-c C-c%s. Destination: %S" + (if (string= "el" (file-name-extension file-dl-name)) + ", Check: C-c C-r" + "") + file-dl-name) + 'face 'web-vcs-red)) + (unwind-protect + (progn + (recursive-edit)) + (web-vcs-paranoid-state-mode -1)) + (with-current-buffer temp-buf + (set-buffer-modified-p nil) + (kill-buffer temp-buf)) + (setq proceed t))) + (throw 'top-level t)) + (error (message "%s" (error-message-string err)))))) + (web-vcs-display-messages t) + )))) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Auto Download Compile Queue +;; +;; Downloaded elisp files are placed in a compile queue. They are not +;; compiled until all required elisp files are downloaded (and +;; optionally compiled). +;; +;; This mechanism works through +;; - reading (eval-when-compile ...) etc in the files +;; - a defadviced require that is the driver of the process + +(defvar web-autoload-compile-queue nil) + +(defvar web-autoload-byte-compile-queue-active nil) ;; Dyn var + +(defun web-autoload-byte-compile-file (file load comp-fun) + (if nil ;;(file-exists-p file) + (byte-compile-file file load) + (let ((added-entry (list file load comp-fun nil))) + (if (member added-entry web-autoload-compile-queue) + (setq added-entry nil) + (web-vcs-message-with-face 'web-vcs-gold "Add to compile queue (%S %s)" file load) + (setq web-autoload-compile-queue (cons added-entry + web-autoload-compile-queue))) + (when added-entry + (if web-autoload-byte-compile-queue-active + (throw 'web-autoload-comp-restart t) + (web-autoload-byte-compile-queue)))))) + +;;(web-autoload-byte-compile-queue) +(defun web-autoload-byte-compile-queue () + (let ((top-entry) + (web-autoload-byte-compile-queue-active t)) + (while (and web-autoload-compile-queue + (not (equal top-entry + (car web-autoload-compile-queue)))) + (setq top-entry (car web-autoload-compile-queue)) + (catch 'web-autoload-comp-restart + (web-autoload-byte-compile-first) + (setq web-autoload-compile-queue (cdr web-autoload-compile-queue)))))) + +(defun web-autoload-byte-compile-first () + "Compile first file on compile queue and maybe load it. +Compile the car of `web-autoload-compile-queue' and load if this +entry says so." + (let* ((compiled-it nil) + (first-entry (car web-autoload-compile-queue)) + (el-file (nth 0 first-entry)) + (load (nth 1 first-entry)) + (comp-fun (nth 2 first-entry)) + (req-done (nth 3 first-entry)) + (elc-file (byte-compile-dest-file el-file)) + (need-compile (or (not (file-exists-p elc-file)) + (file-newer-than-file-p el-file elc-file)))) + (if (not need-compile) + nil ;;(when load (load elc-file)) + (unless req-done + (web-autoload-do-eval-requires el-file) + (setcar (nthcdr 3 first-entry) t)) + (when (catch 'web-autoload-comp-restart + (condition-case err + (progn + (web-vcs-message-with-face 'font-lock-comment-face "Start byte compiling %S" el-file) + (web-vcs-message-with-face 'web-vcs-pink "Compiling QUEUE: %S" web-autoload-compile-queue) + (let ((web-autoload-skip-require-advice t)) (funcall comp-fun el-file load)) + (web-vcs-message-with-face 'font-lock-comment-face "Ready byte compiling %S" el-file) + ;; Return nil to tell there are no known problems + (if (file-exists-p elc-file) + nil + (web-vcs-message-with-face + 'web-vcs-red "Error: byte compiling did not produce %S" elc-file) + (web-vcs-display-messages nil) + ;; Clean up before restart + (web-autoload-try-cleanup-after-failed-compile first-entry) + t)) + (error + (web-vcs-message-with-face + 'web-vcs-red "Error in byte compiling %S: %s" el-file (error-message-string err)) + (web-vcs-display-messages nil) + ;; Clean up before restart + (web-autoload-try-cleanup-after-failed-compile first-entry) + t ;; error + ))) + (throw 'web-autoload-comp-restart t) + )))) + +(defun web-autoload-do-eval-requires (el-file) + "Do eval-when-compile and eval-and-compile." + ;;(message "web-autoload-do-eval-requires %S" el-file) + (let ((old-buf (find-buffer-visiting el-file))) + (with-current-buffer (or old-buf (find-file-noselect el-file)) + (let ((here (point)) + (web-autoload-require-skip-noerror-entries t)) + (save-restriction + (widen) + (goto-char (point-min)) + ;;(message "web-autoload-do-eval-requires cb=%s" (current-buffer)) + (while (progn + (while (progn (skip-chars-forward " \t\n\^l") + (looking-at ";")) + (forward-line 1)) + (not (eobp))) + (let ((form (read (current-buffer)))) + (when (memq (car form) '(eval-when-compile eval-and-compile)) + (web-vcs-message-with-face 'web-vcs-gold " eval %S" form) + (eval form)) + ))) + (if old-buf (kill-buffer) (goto-char here)))))) + + +;; Fix-me: protect against deep nesting +(defun web-autoload-do-require (feature filename noerror) + (let* ((feat-name (symbol-name feature)) + (lib (or filename feat-name))) + (if (load lib noerror t) + (progn + (unless (featurep feature) + (error "web-autoload: Required feature `%s' was not provided" feature)) + feature) + nil + ))) + +(defvar web-autoload-require-skip-noerror-entries nil) + +(defadvice require (around + web-autoload-ad-require) + (let ((feature (ad-get-arg 0)) + (filename (ad-get-arg 1)) + (noerror (ad-get-arg 2))) + (if (featurep feature) + feature + (if (or filename + (and noerror + (or (not (boundp 'web-autoload-skip-require-advice)) + web-autoload-skip-require-advice))) + (progn + (message "Doing nearly original require %s, because skipping" (ad-get-arg 0)) + ;; Can't ad-do-it because defadviced functions in load + ;;(web-autoload-do-require feature filename noerror) + ;; + ;; Fix-me: Implement lazy loading here? Could it be done with while-no-input? + ;; + ;;(when (assq feature web-autoload-require-list) ) + ad-do-it) + (unless (and noerror + web-autoload-require-skip-noerror-entries) + (let* ((auto-rec (assq feature web-autoload-require-list)) + (web-vcs (nth 1 auto-rec)) + (base-url (nth 2 auto-rec)) + (relative-url (nth 3 auto-rec)) + (base-dir (nth 4 auto-rec)) + (comp-fun (nth 5 auto-rec))) + (if (not auto-rec) + ad-do-it + (let* ((full-el (concat (expand-file-name relative-url base-dir) ".el")) + (full-elc (byte-compile-dest-file full-el)) + (our-buffer (current-buffer)) ;; Need to come back here + (our-wcfg (current-window-configuration)) + (mode-line-old (web-vcs-redefine-face 'mode-line 'web-vcs-mode-line)) + (mode-line-inactive-old (web-vcs-redefine-face 'mode-line-inactive 'web-vcs-mode-line-inactive)) + (header-line-format-old (with-current-buffer "*Messages*" + (prog1 + header-line-format + (setq header-line-format + (propertize "Downloading needed files..." + 'face 'web-vcs-mode-line + ;;'face '(:height 1.5) ;; does not work + )))))) + ;; Fix-me: can't update while accessing the menus + ;;(message "trying (redisplay t) ;; mode line") + ;;(sit-for 1) (redisplay t) ;; mode line + (unwind-protect + (progn + (web-vcs-message-with-face 'web-vcs-gold "Doing the really adviced require for %s" feature) + ;; Check if already downloaded first + (unless (file-exists-p full-el) + (setq base-url (eval base-url)) + ;; Download and try again + (setq relative-url (concat relative-url ".el")) + (web-vcs-message-with-face 'web-vcs-green "Need to download feature '%s" feature) + (catch 'web-autoload-comp-restart + (web-vcs-get-missing-matching-files web-vcs base-url base-dir relative-url))) + (set-buffer our-buffer) ;; Before we load.. + (when web-autoload-autocompile + (unless (file-exists-p full-elc) + ;; Byte compile the downloaded file + (web-autoload-byte-compile-file full-el t comp-fun))) + (web-vcs-message-with-face 'web-vcs-gold "Doing finally require for %s" feature) + (set-buffer our-buffer) ;; ... and after we load + (set-window-configuration our-wcfg)) + (with-current-buffer "*Messages*" (setq header-line-format header-line-format-old)) + (web-vcs-redefine-face 'mode-line mode-line-old) + (web-vcs-redefine-face 'mode-line-inactive mode-line-inactive-old))) + ad-do-it))))))) + +;; (setq x (web-vcs-redefine-face 'mode-line (setq z (face-all-attributes 'web-vcs-mode-line (selected-frame))))) +;; (setq x (web-vcs-redefine-face 'mode-line 'web-vcs-mode-line)) +;; (setq y (web-vcs-redefine-face 'mode-line x)) +;; (describe-face 'web-vcs-mode-line) +(defun web-vcs-redefine-face (face as-new) + "Redefine FACE to use the attributes in AS-NEW. +AS-NEW may be either a face or a list returned by `face-all-attributes'. +Return an alist with old attributes." + (let ((ret (face-all-attributes face (selected-frame))) + (new-face-att (if (facep as-new) + (face-all-attributes as-new (selected-frame)) + as-new)) + new-at-prop-list + ) + (dolist (at new-face-att) + (let ((sym (car at)) + (val (cdr at))) + (unless (eq val 'unspecified) + (setq new-at-prop-list (cons sym + (cons val + new-at-prop-list))) + ;;(message "new=%S" new-at-prop-list) + ))) + (apply 'set-face-attribute face (selected-frame) new-at-prop-list) + ret + )) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Web Autoload Define + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Helpers + +;;(web-vcs-file-name-as-list "/a/b/c.el") +;;(web-vcs-file-name-as-list "a/b/c.el") +;;(web-vcs-file-name-as-list "c:/a/b/c.el") +;;(web-vcs-file-name-as-list ".*/a/c/") +;;(web-vcs-file-name-as-list "[^/]*/a/c/") ;; Just avoid this. +;;(web-vcs-file-name-as-list "\\(?:\\.\\.?\\|README\\.txt\\(?:\\.moved\\)?\\|a\\(?:lts\\|utostart\\(?:\\.elc?\\|22\\.elc?\\)\\)\\|e\\(?:macs22\\.cmd\\|tc\\)\\|nxhtml\\(?:-\\(?:base\\.elc?\\|loaddefs\\.el\\(?:\\.moved\\|c\\)?\\|web-vcs\\.el\\(?:\\.moved\\|c\\)?\\)\\|maint\\.elc?\\)?\\|related\\|tests\\|util\\|web-\\(?:autoload\\.elc?\\|vcs\\.el\\(?:\\.moved\\|c\\)?\\)\\)") + +(defun web-vcs-file-name-as-list (filename) + "Split file name FILENAME into a list with file names." + ;; We can't use the primitives since they converts \ to / and + ;; therefore damages the reg exps. Just use our knowledge of the + ;; internal file name representation instead. + (split-string filename "/")) +;; (let ((lst-name nil) +;; (head filename) +;; (old-head "")) +;; (while (and (not (string= old-head head)) +;; (> (length head) 0)) +;; (let* ((file-head (directory-file-name head)) +;; (tail (file-name-nondirectory (directory-file-name head)))) +;; (setq old-head head) +;; (setq head (file-name-directory file-head)) +;; ;; For an abs path the final tail is "", use root instead: +;; (when (= 0 (length tail)) +;; (setq tail head)) +;; (setq lst-name (cons tail lst-name)))) +;; lst-name)) + +;;(web-vcs-match-folderwise ".*/util/mum.el" "top/util/mum.el") +;;(web-vcs-match-folderwise ".*/util/mu.el" "top/util/mum.el") +;;(web-vcs-match-folderwise ".*/ut/mum.el" "top/util/mum.el") +;;(web-vcs-match-folderwise ".*/ut../mum.el" "top/util/mum.el") +;;(web-vcs-match-folderwise ".*/ut../mum.el" "top/util") +;;(web-vcs-match-folderwise ".*/ut../mum.el" "top") +;;(web-vcs-match-folderwise "top/ut../mum.el" "top") +(defun web-vcs-match-folderwise (regex file) + "Split REGEXP as a file path and match against FILE parts." + ;;(message "folderwise %S %S" regex file) + (let ((lst-regex (web-vcs-file-name-as-list regex)) + (lst-file (web-vcs-file-name-as-list file))) + ;; Called from web-vcs-download-files for tree? + (when (= 1 (length lst-regex)) + (setq lst-file (last lst-file)) + (message "lst-file => %S" lst-file) + ) + (when (>= (length lst-regex) (length lst-file)) + (catch 'match + (while lst-file + (let ((head-file (car lst-file)) + (head-regex (car lst-regex))) + (unless (or (= 0 (length head-file)) ;; Last /, if present, gives "" + (string-match-p (concat "^" head-regex "$") head-file)) + (throw 'match nil))) + (setq lst-file (cdr lst-file)) + (setq lst-regex (cdr lst-regex))) + t)))) + +(defun web-vcs-contains-file (dir file) + "Return t if DIR contain FILE." + (assert (string= dir (file-name-as-directory (expand-file-name dir))) t) + (assert (or (string= file (file-name-as-directory (expand-file-name file))) + (string= file (expand-file-name file))) t) + (let ((dir-len (length dir))) + (assert (string= "/" (substring dir (1- dir-len)))) + (when (> (length file) dir-len) + (string= dir (substring file 0 dir-len))))) + +(defun web-vcs-nice-elapsed (start-time end-time) + "Format elapsed time between START-TIME and END-TIME nicely. +Those times should have the same format as time returned by +`current-time'." + (format-seconds "%h h %m m %z%s s" (float-time (time-subtract end-time start-time)))) + +;; (web-vcs-equal-files "web-vcs.el" "temp.tmp") +;; (web-vcs-equal-files "../.nosearch" "temp.tmp") +(defun web-vcs-equal-files (file-a file-b) + "Return t if files FILE-A and FILE-B are equal." + (let* ((cmd (if (eq system-type 'windows-nt) + (list "fc" nil nil nil + "/B" "/OFF" + (convert-standard-filename file-a) + (convert-standard-filename file-b)) + (list diff-command nil nil nil + "--binary" "-q" file-a file-b))) + (ret (apply 'call-process cmd))) + ;;(message "ret=%s, cmd=%S" ret cmd) (sit-for 2) + (cond + ((= 1 ret) + nil) + ((= 0 ret) + t) + (t + (error "%S returned %d" cmd ret))))) + +(defun web-vcs-display-messages (select) + "Display *Messages* buffer. Select its window if SELECT." + (let ((msg-win (display-buffer "*Messages*"))) + (with-selected-window msg-win (goto-char (point-max))) + (when select (select-window msg-win)) + msg-win)) + +;; (web-vcs-message-with-face 'secondary-selection "I am saying: %s and %s" "Hi" "Farwell!") +;;;###autoload +(defun web-vcs-message-with-face (face format-string &rest args) + "Display a colored message at the bottom of the string. +FACE is the face to use for the message. +FORMAT-STRING and ARGS are the same as for `message'. + +Also put FACE on the message in *Messages* buffer." + (with-current-buffer "*Messages*" + (save-restriction + (widen) + (let* ((start (let ((here (point))) + (goto-char (point-max)) + (prog1 + (copy-marker + (if (bolp) (point-max) + (1+ (point-max)))) + (goto-char here)))) + (msg-with-face (propertize (apply 'format format-string args) + 'face face))) + ;; This is for the echo area: + (message "%s" msg-with-face) + ;; This is for the buffer: + (when (< 0 (length msg-with-face)) + (goto-char (1- (point-max))) + ;;(backward-char) + ;;(unless (eolp) (goto-char (line-end-position))) + (put-text-property start (point) + 'face face)))))) + +(defun web-vcs-num-moved (root) + "Return nof files matching *.moved inside directory ROOT." + (let* ((file-regexp ".*\\.moved$") + (files (directory-files root t file-regexp)) + (subdirs (directory-files root t))) + (dolist (subdir subdirs) + (when (and (file-directory-p subdir) + (not (or (string= "/." (substring subdir -2)) + (string= "/.." (substring subdir -3))))) + (setq files (append files (web-vcs-rdir-get-files subdir file-regexp) nil)))) + (length files))) + +;; Copy of rdir-get-files in ourcomment-util.el +(defun web-vcs-rdir-get-files (root file-regexp) + (let ((files (directory-files root t file-regexp)) + (subdirs (directory-files root t))) + (dolist (subdir subdirs) + (when (and (file-directory-p subdir) + (not (or (string= "/." (substring subdir -2)) + (string= "/.." (substring subdir -3))))) + (setq files (append files (web-vcs-rdir-get-files subdir file-regexp) nil)))) + files)) + +(defun web-vcs-contains-moved-files (dl-dir) + "Return t if there are *.moved files in DL-DIR." + (let ((num-moved (web-vcs-num-moved dl-dir))) + (when (> num-moved 0) + (web-vcs-message-with-face 'font-lock-warning-face + (concat "There are %d *.moved files (probably from prev download)\n" + "in %S.\nPlease delete them first.") + num-moved dl-dir) + t))) + + +(defun web-vcs-set&save-option (symbol value) + (customize-set-variable symbol value) + (customize-set-value symbol value) + (when (condition-case nil (custom-file) (error nil)) + (customize-mark-to-save symbol) + (custom-save-all) + (message "web-vcs: Saved option %s with value %s" symbol value))) + +(defvar web-vcs-el-this (or load-file-name + (when (boundp 'bytecomp-filename) bytecomp-filename) + buffer-file-name)) + + +(require 'bytecomp) +(defun web-vcs-byte-compile-newer-file (el-file load) + (let ((elc-file (byte-compile-dest-file el-file))) + (when (or (not (file-exists-p elc-file)) + (file-newer-than-file-p el-file elc-file)) + (byte-compile-file el-file load)))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Compiling + +;;;###autoload +(defun web-vcs-byte-compile-file (file &optional load extra-load-path comp-dir) + "Byte compile FILE in a new Emacs sub process. +EXTRA-LOAD-PATH is added to the front of `load-path' during +compilation. + +FILE is set to `buffer-file-name' when called interactively. +If LOAD" + (interactive (list (buffer-file-name) + t)) + (when (with-no-warnings (called-interactively-p)) + (unless (eq major-mode 'emacs-lisp-mode) + (error "Must be in emacs-lisp-mode"))) + (let* ((old-env-load-path (getenv "EMACSLOADPATH")) + (sub-env-load-path (or old-env-load-path + ;;(mapconcat 'identity load-path ";"))) + (mapconcat 'identity load-path path-separator))) + ;; Fix-me: name of compile log buffer. When should it be + ;; deleted? How do I bind it to byte-compile-file? Or do I? + (file-buf (find-buffer-visiting file)) + (old-out-buf (get-buffer "*Compile-Log*")) + (default-directory (or (when old-out-buf + (with-current-buffer old-out-buf + default-directory)) + comp-dir + (and (boundp 'nxhtml-install-dir) nxhtml-install-dir) + default-directory)) + (out-buf (or old-out-buf (get-buffer-create "*Compile-Log*"))) + (elc-file (byte-compile-dest-file file)) + (this-emacs-exe (locate-file invocation-name + (list invocation-directory) + exec-suffixes)) + (debug-on-error t) + start) + ;; (when (and file-buf + ;; (buffer-modified-p file-buf)) + ;; (switch-to-buffer file-buf) + ;; (error "Buffer must be saved first: %S" file-buf)) + (dolist (full-p extra-load-path) + ;;(setq sub-env-load-path (concat full-p ";" sub-env-load-path))) + (setq sub-env-load-path (concat full-p path-separator sub-env-load-path))) + (unless (get-buffer-window out-buf (selected-frame)) + (if (string= file (buffer-file-name)) + (display-buffer out-buf) + (unless (eq (current-buffer) out-buf) + (switch-to-buffer out-buf)))) + (with-selected-window (get-buffer-window out-buf) + (with-current-buffer out-buf + (unless (local-variable-p 'web-vcs-comp-dir) + (set (make-local-variable 'web-vcs-comp-dir) (or comp-dir default-directory))) + (setq default-directory web-vcs-comp-dir) + (widen) + (goto-char (point-max)) + (when (or (= 0 (buffer-size)) + (not (derived-mode-p 'compilation-mode))) + (insert (propertize "\nWeb VCS compilation output" 'font-lock-face 'font-lock-comment-face)) + (compilation-mode) + (setq font-lock-verbose nil) + (font-lock-add-keywords nil + '(("\\" . 'compilation-info)))) + (let ((inhibit-read-only t) + (rel-file (file-relative-name file))) + (insert "\n\n") + (insert "** Compile " rel-file "\n")) + (setq start (point)) + (when (file-exists-p elc-file) (delete-file elc-file)) + (if (or (not window-system) + (< emacs-major-version 23)) + (byte-compile-file file) + ;;(message "web-vcs-byte-compile-file:sub-env-load-path=%s" sub-env-load-path) + (unless (file-exists-p this-emacs-exe) + (error "Can't find this-emacs-exe=%s" this-emacs-exe)) + (unless (stringp sub-env-load-path) (error "I did it again, sub-env-load-path=%S" sub-env-load-path)) + (setenv "EMACSLOADPATH" sub-env-load-path) + ;; Fix-me: status + (let* ((inhibit-read-only t) + (ret (apply 'call-process this-emacs-exe nil out-buf t + "-Q" "--batch" + "--eval" "(setq debug-on-error t)" + "--eval" "(remove-hook 'find-file-hook 'vc-find-file-hook)" + "--file" file + "-f" "emacs-lisp-byte-compile" + nil))) + ;;(insert (format "call-process returned: %s\n" ret)) + ) + (setenv "EMACSLOADPATH" old-env-load-path)) + (goto-char start) + (while (re-search-forward "^\\([a-zA-Z0-9/\._-]+\\):[0-9]+:[0-9]+:" nil t) + (let ((rel-file (file-relative-name file)) + (inhibit-read-only t)) + (replace-match rel-file nil nil nil 1))) + (goto-char (point-max)))) + (when (file-exists-p elc-file) + (when (and load window-system) (load elc-file)) + t))) + + +;;;;;;;;;;;;;;;;;;;;;;;; +;;; Temporary helpers, possibly included in Emacs + +;; Fix-me: Doing (require 'url-http) in the functions below led to +;; that url-show-status is void. So I require it here instead. +;;(require 'url-http) + +;; (setq x (web-vcs-url-retrieve-synch "http://emacswiki.org/")) +;;;###autoload +(defun web-vcs-url-retrieve-synch (url) + "Retrieve URL, return cons with buffer and http status." + (require 'url-http) + (let* ((url-show-status nil) ;; just annoying showing status here + (buffer (url-retrieve-synchronously url)) + (handle nil) + (http-status nil)) + (if (not buffer) + (error "Retrieving url %s gave no buffer" url)) + (with-current-buffer buffer + (if (= 0 (buffer-size)) + (progn + (kill-buffer) + nil) + (setq http-status (url-http-parse-response)) + (if (memq http-status '(200 201)) + (progn + (goto-char (point-min)) + (unless (search-forward "\n\n" nil t) + (error "Could not find header end in buffer for %s" url)) + (delete-region (point-min) (point)) + (set-buffer-modified-p nil) + (goto-char (point-min))) + (kill-buffer buffer) + (setq buffer nil)))) + (cons buffer http-status))) + +;; Modified just to return http status +;;;###autoload +(defun web-vcs-url-copy-file (url newname &optional ok-if-already-exists + keep-time preserve-uid-gid) + "Copy URL to NEWNAME. Both args must be strings. +Signals a `file-already-exists' error if file NEWNAME already exists, +unless a third argument OK-IF-ALREADY-EXISTS is supplied and non-nil. +A number as third arg means request confirmation if NEWNAME already exists. +This is what happens in interactive use with M-x. +Fourth arg KEEP-TIME non-nil means give the new file the same +last-modified time as the old one. (This works on only some systems.) +Fifth arg PRESERVE-UID-GID is ignored. +A prefix arg makes KEEP-TIME non-nil." + (if (and (file-exists-p newname) + (not ok-if-already-exists)) + (error "Opening output file: File already exists, %s" newname)) + (require 'url-http) + (let ((buffer (url-retrieve-synchronously url)) + (handle nil) + (ret nil)) + (if (not buffer) + (error "Retrieving url %s gave no buffer" url)) + (with-current-buffer buffer + (if (= 0 (buffer-size)) + (progn + (kill-buffer) + nil) + (setq ret (url-http-parse-response)) + (setq handle (mm-dissect-buffer t)) + (mm-save-part-to-file handle newname) + (kill-buffer buffer) + (mm-destroy-parts handle))) + ret)) + +(defun web-vcs-read-and-accept-key (prompt accepted &optional reject-message help-function) + (let ((key nil) + rejected + (resize-mini-windows (or resize-mini-windows t))) + (while (not (member key accepted)) + (if (and help-function + (or (member key help-event-list) + (eq key ??))) + (funcall help-function) + (unless rejected + (setq rejected t) + (setq prompt (concat (or reject-message "Please answer with one of the alternatives.") + "\n\n" + prompt)) + (setq key (web-vcs-read-key prompt))))) + key)) + +(defconst web-vcs-read-key-empty-map (make-sparse-keymap)) + +(defvar web-vcs-read-key-delay 0.01) ;Fast enough for 100Hz repeat rate, hopefully. + +(defun web-vcs-read-key (&optional prompt) + "Read a key from the keyboard. +Contrary to `read-event' this will not return a raw event but instead will +obey the input decoding and translations usually done by `read-key-sequence'. +So escape sequences and keyboard encoding are taken into account. +When there's an ambiguity because the key looks like the prefix of +some sort of escape sequence, the ambiguity is resolved via `web-vcs-read-key-delay'." + (let ((overriding-terminal-local-map web-vcs-read-key-empty-map) + (overriding-local-map nil) + (old-global-map (current-global-map)) + (timer (run-with-idle-timer + ;; Wait long enough that Emacs has the time to receive and + ;; process all the raw events associated with the single-key. + ;; But don't wait too long, or the user may find the delay + ;; annoying (or keep hitting more keys which may then get + ;; lost or misinterpreted). + ;; This is only relevant for keys which Emacs perceives as + ;; "prefixes", such as C-x (because of the C-x 8 map in + ;; key-translate-table and the C-x @ map in function-key-map) + ;; or ESC (because of terminal escape sequences in + ;; input-decode-map). + web-vcs-read-key-delay t + (lambda () + (let ((keys (this-command-keys-vector))) + (unless (zerop (length keys)) + ;; `keys' is non-empty, so the user has hit at least + ;; one key; there's no point waiting any longer, even + ;; though read-key-sequence thinks we should wait + ;; for more input to decide how to interpret the + ;; current input. + (throw 'read-key keys))))))) + (unwind-protect + (progn + (use-global-map web-vcs-read-key-empty-map) + (message (concat (apply 'propertize prompt (member 'face minibuffer-prompt-properties)) + (propertize " " 'face 'cursor))) + (aref (catch 'read-key (read-key-sequence-vector nil nil t)) 0)) + (cancel-timer timer) + (use-global-map old-global-map)))) + +;; End temp helpers +;;;;;;;;;;;;;;;;;;;;;;;; + +;;(web-vcs-existing-files-matcher default-directory) +(defun web-vcs-existing-files-matcher (dir) + (let ((files-and-dirs (directory-files dir nil "[^#~]$")) + files + (default-directory dir)) + (dolist (df files-and-dirs) + (unless (file-directory-p df) + (setq files (cons df files)))) + (cons (regexp-opt files) t))) + +(defun web-vcs-update-existing-files (vcs base-url dl-dir this-dir) + (let ((files-and-dirs (directory-files this-dir nil "\\(?:\\.elc\\|\\.moved\\|[^#~]\\)$")) + files + dirs + (this-rel (file-relative-name this-dir dl-dir)) + file-mask) + (when (string= "./" this-rel) (setq this-rel "")) + (dolist (df files-and-dirs) + (if (and (file-directory-p df) + (not (member df '("." "..")))) + (setq dirs (cons df dirs)) + (setq files (cons df files)))) + ;;(web-vcs-message-with-face 'hi-blue "this-rel=%S %S %S" this-rel dl-dir this-dir) + (setq file-mask (concat this-rel (regexp-opt files))) + ;;(web-vcs-message-with-face 'hi-blue "r=%S" file-mask) + (web-vcs-get-missing-matching-files vcs base-url dl-dir file-mask (length files)) + (dolist (d dirs) + (web-vcs-update-existing-files vcs base-url dl-dir + (file-name-as-directory + (expand-file-name d this-dir)))))) + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Some small bits for security and just overview. + +(defun web-vcs-fontify-as-ps-print() + (save-restriction + (widen) + (let ((start (point-min)) + (end (point-max))) + (cond ((and (boundp 'jit-lock-mode) (symbol-value 'jit-lock-mode)) + (jit-lock-fontify-now start end)) + ;; ((and (boundp 'lazy-lock-mode) (symbol-value 'lazy-lock-mode)) + ;; (lazy-lock-fontify-region start end)) + )))) + + +;;(web-vcs-get-fun-details 'describe-function) +;;(web-vcs-get-fun-details 'require) +;;(describe-function 'describe-function) +(defun web-vcs-get-fun-details (function) + (unless (symbolp function) (error "Not a symbol: %s" function)) + (unless (functionp function) (error "Not a function: %s" function)) + ;; Do as in `describe-function': + (let* ((advised (and (symbolp function) (featurep 'advice) + (ad-get-advice-info function))) + ;; If the function is advised, use the symbol that has the + ;; real definition, if that symbol is already set up. + (real-function + (or (and advised + (let ((origname (cdr (assq 'origname advised)))) + (and (fboundp origname) origname))) + function)) + ;; Get the real definition. + (def (if (symbolp real-function) + (symbol-function real-function) + function)) + errtype file-name (beg "") string) + ;; Just keep this as it is to more easily compare with `describe-function-1'. + (setq string + (cond ((or (stringp def) + (vectorp def)) + "a keyboard macro") + ((subrp def) + (if (eq 'unevalled (cdr (subr-arity def))) + (concat beg "special form") + (concat beg "built-in function"))) + ((byte-code-function-p def) + (concat beg "compiled Lisp function")) + ((symbolp def) + (while (and (fboundp def) + (symbolp (symbol-function def))) + (setq def (symbol-function def))) + ;; Handle (defalias 'foo 'bar), where bar is undefined. + (or (fboundp def) (setq errtype 'alias)) + (format "an alias for `%s'" def)) + ((eq (car-safe def) 'lambda) + (concat beg "Lisp function")) + ((eq (car-safe def) 'macro) + "a Lisp macro") + ((eq (car-safe def) 'autoload) + ;;(setq file-name-auto (nth 1 def)) + ;;(setq file-name-auto (find-lisp-object-file-name function def)) + ;;(setq file-auto-noext (file-name-sans-extension file-name-auto)) + (format "%s autoloaded %s" + (if (commandp def) "an interactive" "an") + (if (eq (nth 4 def) 'keymap) "keymap" + (if (nth 4 def) "Lisp macro" "Lisp function")))) + ((keymapp def) + (let ((is-full nil) + (elts (cdr-safe def))) + (while elts + (if (char-table-p (car-safe elts)) + (setq is-full t + elts nil)) + (setq elts (cdr-safe elts))) + (if is-full + "a full keymap" + "a sparse keymap"))) + (t ""))) + (setq file-name (find-lisp-object-file-name function def)) + (list errtype advised file-name string) + )) + +;; (setq next-error-function 'web-vcs-investigate-next-error) +;; fix-me: +;; (defvar web-vcs-investigate-header-str "Found these possible problems when reading the file:\n") +;; (defun web-vcs-investigate-next-error (argp reset) +;; (interactive "p") +;; ;; Search from within the investigate output buffer +;; (with-current-buffer +;; ;; Choose the buffer and make it current. +;; (if (next-error-buffer-p (current-buffer)) +;; (current-buffer) +;; (next-error-find-buffer nil nil +;; (lambda () +;; (let ((here (point))) +;; (save-restriction +;; (widen) +;; (goto-char (point-min)) +;; (string= (buffer-substring-no-properties +;; 0 (length web-vcs-investigate-header-str)) +;; web-vcs-investigate-header-str)))))) + +;; (goto-char (cond (reset (point-min)) +;; ((< argp 0) (line-beginning-position)) +;; ((> argp 0) (line-end-position)) +;; ((point)))) +;; (occur-find-match +;; (abs argp) +;; (if (> 0 argp) +;; #'previous-single-property-change +;; #'next-single-property-change) +;; "No more matches") +;; ;; In case the *Occur* buffer is visible in a nonselected window. +;; (let ((win (get-buffer-window (current-buffer) t))) +;; (if win (set-window-point win (point)))) +;; (occur-mode-goto-occurrence))) + +;;(web-vcs-investigate-read "c:/emacsw32/nxhtml/nxhtml/nxhtml-autoload.el" "*Messages*") +(defun web-vcs-investigate-read (elisp out-buf) + "Check forms in buffer by reading it." + (let* ((here (point)) + unsafe-eval re-fun re-var + elisp-el-file + (is-same-file (lambda (file) + (when file + (setq file (concat (file-name-sans-extension file) ".el")) + (string= (file-truename file) elisp-el-file))))) + (with-current-buffer elisp + (setq elisp-el-file (when (buffer-file-name) + (file-truename (buffer-file-name)))) + (save-restriction + (widen) + (web-vcs-fontify-as-ps-print) + (goto-char (point-min)) + (while (progn + (while (progn (skip-chars-forward " \t\n\^l") + (looking-at ";")) + (forward-line 1)) + (not (eobp))) + (let* ((pos (point)) + (form (read (current-buffer))) + (def (nth 0 form)) + (sym (and (listp form) + (symbolp (nth 1 form)) + (nth 1 form))) + (form-fun (and sym + (functionp sym) + (symbol-function sym))) + (form-var (boundp sym)) + (safe-forms '( declare-function + defun defmacro defsubst + define-minor-mode define-globalized-minor-mode + defvar defconst + defcustom + defface defgroup + ;; fix-me: check if these do re-fun too: + define-derived-mode + define-global-minor-mode + define-globalized-minor-mode + + make-local-variable make-variable-buffer-local + provide + require + message)) + (safe-eval (or (memq def safe-forms) + (and (memq def '( eval-when-compile eval-and-compile)) + (or (not (consp (nth 1 form))) + (memq (car (nth 1 form)) safe-forms))))) + ) + (cond + ((not safe-eval) + (setq unsafe-eval + (cons (list form (copy-marker pos) (buffer-substring pos (point))) + unsafe-eval))) + ((and form-fun + (memq def '( defun defmacro define-minor-mode define-globalized-minor-mode))) + (setq re-fun (cons (cons sym pos) re-fun))) + ((and form-var + (memq def '( defvar defconst defcustom)) + (or (not (eq sym 'defvar)) + (< 2 (length form)))) + (setq re-var (cons sym re-var))))))) + (goto-char here)) + (with-current-buffer out-buf + (save-restriction + (widen) + (goto-char (point-max)) + (unless (bobp) (insert "\n\n")) + (insert (propertize "Found these possible problems when reading the file:\n" + 'font-lock-face '(:height 1.5))) + (or unsafe-eval + re-fun + (insert "\n" + "Found no problems (but there may still be)" + "\n")) + + ;; Fix-me: Link + (when unsafe-eval + (insert "\n" + (propertize + (format "* Forms that are executed when loading the file (found %s):" + (length unsafe-eval)) + 'font-lock-face '(:background "yellow" :height 1.2)) + "\n\n") + (dolist (u (reverse unsafe-eval)) + (insert (format "Line %s\n" + (with-current-buffer elisp + (line-number-at-pos (marker-position (nth 1 u)))))) + ;; (insert-text-button (format "Go to form below, line %s" (marker-position (nth 1 u))) + ;; 'font-lock-face '(compilation-info underline) + ;; 'action + ;; `(lambda (button) + ;; (let* ((marker ,(nth 1 u)) + ;; (buf (marker-buffer marker))) + ;; (switch-to-buffer-other-window buf) + ;; (unless (and (< marker (point-max)) + ;; (> marker (point-min))) + ;; (widen)) + ;; (goto-char marker)))) + (insert (nth 2 u) "\n\n")) + (insert "\n")) + (when re-fun + (insert (propertize + (format "\n* The file perhaps redefines these functions that are defined now (%s):\n" + (length re-fun)) + 'font-lock-face '(:background "yellow" :height 1.2))) + (setq re-fun (sort re-fun (lambda (a b) (string< (symbol-name (car a)) (symbol-name (car b)))))) + (let ((row 0) + (re-fun-with-info (mapcar (lambda (fun) + (cons fun (web-vcs-get-fun-details (car fun)))) + re-fun)) + re-fun-other-files + (n-same 0) + (n-web-auto 0)) + ;; Check same file + (dolist (info re-fun-with-info) + (let* ((file-name (nth 3 info)) + (fun (car (nth 0 info))) + (web-auto (get fun 'web-autoload))) + (cond ((funcall is-same-file file-name) + (setq n-same (1+ n-same))) + (web-auto + (setq n-web-auto (1+ n-web-auto)) + (setq re-fun-other-files (cons info re-fun-other-files))) + (t + (setq re-fun-other-files (cons info re-fun-other-files)))))) + + (when (< 0 n-same) + (insert "\n " + (propertize (format "%s functions alreay defined by this file (which seems ok)" n-same) + 'font-lock-face 'web-vcs-green) + "\n")) + + (dolist (info re-fun-other-files) + (let* ((fun-rec (nth 0 info)) + (errtype (nth 1 info)) + (advised (nth 2 info)) + (file-name (nth 3 info)) + (string (nth 4 info)) + (fun (car fun-rec)) + (fun-pos (cdr fun-rec)) + (fun-web-auto (get fun 'web-autoload)) + ) + (when (= 0 (% row 5)) (insert "\n")) + (setq row (1+ row)) + (insert " `") + (insert-text-button (format "%s" fun) + 'action + `(lambda (button) + (describe-function ',fun))) + (insert "'") + (insert " (" string) + (when fun-web-auto + (insert " autoloaded from web, ") + (insert-text-button "info" + 'action + `(lambda (button) + ;; Fix-me: maybe a bit more informative ... ;-) + (message "%S" ',fun-web-auto)))) + (insert ")") + (when advised (insert ", " (propertize "adviced" 'font-lock-face 'font-lock-warning-face))) + (insert ", " + (cond + ((funcall is-same-file file-name) + (propertize "defined in this file" 'font-lock-face 'web-vcs-green) + ) + (fun-web-auto + (if (not (web-autoload-acvtive)) + (propertize "web download not active" 'font-lock-face 'web-vcs-yellow) + ;; See if file matches + (let ((active-sub-url web-autoload-active-file-sub-url) + (fun-sub-url (nth 2 fun-web-auto))) + (setq active-sub-url (file-name-sans-extension active-sub-url)) + (if (string-match-p fun-sub-url active-sub-url) + (propertize "web download, matches" 'font-lock-face 'web-vcs-yellow) + (propertize "web download, doesn't matches" 'font-lock-face 'web-vcs-red) + )))) + (t + (propertize "defined in other file" 'font-lock-face 'web-vcs-red)))) + (unless (funcall is-same-file file-name) + (insert " (") + (insert-text-button "go to new definition" + 'action + `(lambda (button) + (interactive) + (let ((m-pos ,(with-current-buffer elisp + (copy-marker fun-pos)))) + (switch-to-buffer-other-window (marker-buffer m-pos)) + (goto-char m-pos)))) + (insert ")")) + (insert "\n") + ))))) + (web-vcs-investigate-output-mode) + ))) + +(defvar web-vcs-investigate-current-file nil) +(make-variable-buffer-local 'web-vcs-investigate-current-file) +(put 'web-vcs-investigate-current-file 'permanent-local t) + +(defun web-vcs-investigate-current-file () + `(,web-vcs-investigate-current-file)) + +;; (defun web-vcs-investigate-fontification-fun (bound) +;; ;;(compilation-error-properties (file line end-line col end-col type fmt) +;; (while (re-search-forward "^Line \\([0-9]+\\)$" bound t) +;; (put-text-property (match-beginning 1) (match-end 1) +;; 'face 'highlight) +;; (let ((line (string-to-number (match-string-no-properties 1)))) +;; (compilation-error-properties 'web-vcs-investigate-current-file line line nil nil nil nil)) +;; ) +;; nil) + + +;; (defvar web-vcs-investigate-output-font-lock-keywords +;; ;; '(("^\\*\\*\\* \\(.+\\.el\\): \\([^ \n]+\\)" +;; ;; '(("^\\*\\*\\* \\(.+\\.el\\): \\([^ \n]+\\)" +;; ;; (1 font-lock-function-name-face) +;; ;; (2 font-lock-comment-face))) +;; ;; "Keywords used to highlight a checkdoc diagnostic buffer.") +;; nil) +;; ;;'(("^\\(Line\\) \\([0-9]+\\)$" 1 2))) +;; ;;'(web-vcs-investigate-fontification-fun)) + +(defvar web-vcs-investigate-output-error-regex-alist + '( + ("^Line \\([0-9]+\\)$" web-vcs-investigate-current-file 1 + ;; column type + nil 1) + ;; Fix-me: This is just a terrible hack making the hit into a + ;; compilation error point with # as the link and the rest as the + ;; action for that line. And it even does not work... - Only the + ;; first line becomes an error line. No idea why at the moment. + ("\\(#\\)Eval the file with all" web-vcs-investigate-current-file nil nil nil 1) + ("\\(#\\)Eval the file with just" web-vcs-investigate-current-file nil nil nil 1) + ("\\(#\\)Eval the file with no" web-vcs-investigate-current-file nil nil nil 1) + )) + +;; (defvar checkdoc-pending-errors nil +;; "Non-nil when there are errors that have not been displayed yet.") + +(define-compilation-mode web-vcs-investigate-output-mode "Investigate Elisp" + "Set up the major mode for the buffer containing the list of errors." + (set (make-local-variable 'compilation-error-regexp-alist) + web-vcs-investigate-output-error-regex-alist) + ;;(set (make-local-variable 'compilation-error-face) grep-hit-face) + ;; (set (make-local-variable 'compilation-mode-font-lock-keywords) + ;; web-vcs-investigate-output-font-lock-keywords) + ) + +;; I am quite tired of doing this over and over again. Why is this not +;; in Emacs? +(defvar web-vcs-button-mode-map + (let ((map (make-sparse-keymap))) + (define-key map [tab] 'forward-button) + (define-key map [(shift tab)] 'backward-button) + map)) +(define-minor-mode web-vcs-button-mode + "Just to bind `forward-button' etc" + :lighter nil) + +(defvar web-vcs-eval-output-start nil) +(make-variable-buffer-local 'web-vcs-eval-output-start) +(defvar web-vcs-eval-output-end nil) +(make-variable-buffer-local 'web-vcs-eval-output-end) + +;;(web-vcs-investigate-elisp-file) +;;;###autoload +(defun web-vcs-investigate-elisp-file (file-or-buffer) + (interactive (list + (if (derived-mode-p 'emacs-lisp-mode) + (current-buffer) + (read-file-name "Elisp file to check: ")))) + (let* ((elisp (if (bufferp file-or-buffer) + file-or-buffer + (find-file-noselect file-or-buffer))) + (elisp-file (with-current-buffer elisp (buffer-file-name))) + (out-buf-name "Web VCS Sec Inv") + (out-buf (let ((old-buf (get-buffer out-buf-name))) + (when old-buf (kill-buffer old-buf)) + (get-buffer-create out-buf-name)))) + (if (not (with-current-buffer elisp (derived-mode-p 'emacs-lisp-mode))) + (progn + (unless (eq (current-buffer) elisp) + (display-buffer elisp)) + (message "Buffer %s is not in emacs-lisp-mode" (buffer-name elisp))) + (switch-to-buffer-other-window out-buf) + (setq web-vcs-investigate-current-file elisp-file) + (let ((inhibit-read-only t)) + (erase-buffer) + (setq buffer-read-only t) + (web-vcs-button-mode 1) + (insert (propertize "A quick look for problems" 'font-lock-face '(:height 1.5))) + (let ((here (point))) + (insert + "\n" + (propertize + (concat "Note that this is just a quick look at the file." + " You have to investigate the file more carefully yourself" + " (or be sure someone else has done it for you)." + " The following are checked for here:" + "\n") + 'font-lock-face font-lock-comment-face)) + (fill-region here (point))) + (insert + (propertize + (concat + "- Top level forms that might be executed when loading the file.\n" + "- Redefinition of functions.\n") + 'font-lock-face font-lock-comment-face)) + + (insert "\n") + (if elisp-file + (progn + (insert "File ") + (insert-text-button elisp-file + 'action + `(lambda (button) + (interactive) + (find-file-other-window ,elisp-file)))) + (insert "Buffer ") + (insert-text-button (buffer-name elisp) + 'action + `(lambda (button) + (interactive) + (switch-to-buffer-other-window ,elisp)))) + + (web-vcs-investigate-read elisp out-buf) + (when elisp-file + (insert "\n\n\n") + (insert (propertize "* Investigate what the file loads and redefines\n" + 'font-lock-face '(:background "yellow" :height 1.2))) + (let ((here (point))) + (insert "\nIf you want to see what will actually be added to `load-history'" + " and which functions will be defined you can" + " load the file in a batch Emacs session" + " and show the result here." + " (`load-path' will be set to your current value for the loading.)" + "\n" + ) + (fill-region here (point)) + + (setq here (point)) + (insert "\nYour current Emacs will not be affected by the loading," + " but please be aware that this does not mean your computer can not be." + "\n" + ) + (fill-region here (point)) + + (insert (propertize "\n Note: Click the part after #.\n" 'font-lock-face 'italic)) + (when t ;init-file-user + (insert " ") + (insert-text-button "#Load the file with all your current init files" + 'action `(lambda (button) (interactive) + (web-vcs-investigate-eval ,elisp-file ,out-buf "--debug-init"))) + (insert "\n")) + (when t ;(and site-run-file (not init-file-user)) + (insert " ") + (insert-text-button "#Load the file with just your site init file (i.e. -q)" + 'action `(lambda (button) (interactive) + (web-vcs-investigate-eval ,elisp-file ,out-buf "-q"))) + (insert "\n")) + (when t ;(not site-run-file) + (insert " ") + (insert-text-button "#Load the file with no init file (i.e. -Q)" + 'action `(lambda (button) (interactive) + (web-vcs-investigate-eval ,elisp-file ,out-buf "-Q"))) + (insert "\n")) + + (setq web-vcs-eval-output-start (point)) + (setq web-vcs-eval-output-end (point-max)) + )) + (set-buffer-modified-p nil) + (goto-char (point-min)))))) + + +;;(web-vcs-investigate-eval "c:/emacsw32/nxhtml/nxhtml/nxhtml-autoload.el" "*Messages*") +;;(web-vcs-investigate-eval "c:/emacsw32/nxhtml/autostart.el" "*Messages*") +(defun web-vcs-investigate-eval (elisp-file out-buf init) + "Get compile loads when evaling buffer. +Eval the buffer in a fresh Emacs and return the resulting +load-history entries with comments about what is new etc." + (let* ((emacs-exe (locate-file invocation-name + (list invocation-directory) + exec-suffixes)) + ;; see custom-load-symbol + (get-lhe '(let ((lhe (or (assoc buffer-file-name load-history) + (assoc (concat (file-name-sans-extension buffer-file-name) ".elc") + load-history)))) + (prin1 "STARTHERE\n") + (prin1 lhe))) + (elisp-file-name (file-name-sans-extension (file-name-nondirectory elisp-file))) + (elisp-el-file (file-truename (concat (file-name-sans-extension elisp-file) ".el"))) + (temp-prefix web-autoload-temp-file-prefix) + (temp-prefix-len (length temp-prefix)) + (is-downloading (and (boundp 'web-autoload-paranoid) + web-autoload-paranoid)) + (is-temp-file (and is-downloading + (< (length temp-prefix) (length elisp-file-name)) + (string= temp-prefix + (substring elisp-file-name 0 temp-prefix-len)))) + (elisp-feature-name (if is-temp-file + (substring elisp-file-name temp-prefix-len) + elisp-file-name)) + (is-same-file (lambda (file) + (when file ;; self protecting + (setq file (concat (file-name-sans-extension file) ".el")) + (string= (file-truename file) elisp-el-file)))) + (active-sub-url (when (web-autoload-acvtive) + (file-name-sans-extension web-autoload-active-file-sub-url))) + whole-result + batch-error + result) + (with-current-buffer out-buf + (when web-vcs-eval-output-start + (let ((here (point)) + (inhibit-read-only t)) + (save-restriction + (widen) + ;;(goto-char web-vcs-eval-output-start) + (delete-region web-vcs-eval-output-start web-vcs-eval-output-end)) + (goto-char here)))) + ;; Fix-me: do not use temp buffer so we can check errors + (with-temp-buffer + (let ((old-loadpath (getenv "EMACSLOADPATH")) + ;;(new-loadpath (mapconcat 'identity load-path ";")) + (new-loadpath (mapconcat 'identity load-path path-separator)) + ret-val) + (setenv new-loadpath) + (message "Loading file in batch Emacs...") + (setq ret-val + (call-process emacs-exe nil + (current-buffer) + t "--batch" + ;; fix-me: "-Q" - should be run in the users current environment. + ;; init-file-user nil => -Q + ;; site-run-file nil => -q + + ;; (cond + ;; ((not init-file-user) "-Q") + ;; ((not site-run-file) "-q") + ;; (t "--debug-init")) ;; have to have something here... + init + + "-eval" (format "(setq load-path '%S)" load-path) + "-l" elisp-file + elisp-file + "-eval" (format "%S" get-lhe))) + (message "Loading file in batch Emacs... done, returned %S" ret-val) + (setenv old-loadpath)) + ;; Fix-me: how do you check the exit status on different platforms? + (setq whole-result (buffer-substring-no-properties (point-min) (point-max))) + (condition-case err + (progn + (goto-char (point-min)) + (search-forward "STARTHERE") + (search-forward "(") + (backward-char) + (setq result (read (current-buffer)))) + (error (message "") + ;; Process should probably have failed if we are here, + ;; but anyway... ;-) + (setq batch-error + (concat "Sorry, batch Emacs failed. It returned this message:\n\n" + whole-result + (if is-downloading + (concat + "\n--------\n" + "The error may depend on that not all needed files are yet downloaded.\n") + "\n"))) + ))) + (with-current-buffer out-buf + (let ((here (point)) + (inhibit-read-only t)) + (save-restriction + (widen) + ;;(goto-char (point-max)) + (goto-char web-vcs-eval-output-start) + (if batch-error + (progn + (insert "\n\n") + (insert (propertize batch-error 'font-lock-face 'web-vcs-red))) + (insert (propertize (format "\n\nLoading file (%s) added to `load-history':\n\n" init) + 'font-lock-face '(:height 1.5))) + (insert " (\"" (car result) "\"\n") + (dolist (e (cdr result)) + (insert (format " %S" e)) + (cond ((stringp e)) ;; Should not happen... + ;; Variables + ((symbolp e) + (insert " - ") + (insert (if (not (boundp e)) + (propertize "New" 'font-lock-face 'web-vcs-yellow) + (let ((e-file (symbol-file e))) + (if (funcall is-same-file e-file) + (propertize "Same file now" 'font-lock-face 'web-vcs-green) + (let* ((fun-web-auto (get e 'web-autoload)) + (fun-sub-url (nth 2 fun-web-auto))) + (if (and fun-sub-url + (string= fun-sub-url active-sub-url)) + (propertize "Web download, matches current download" + 'font-lock-face 'web-vcs-yellow) + (propertize (format "Loaded from %S now" e-file) + 'font-lock-face 'web-vcs-red)))))))) + ;; provide + ((eq (car e) 'provide) + (insert " - ") + (let* ((feat (car e)) + (feat-name (symbol-name feat))) + (insert (cond + ((not (featurep feat)) + (if (or (string= elisp-feature-name + (symbol-name (cdr e)))) + (propertize "Web download, matches file name" 'font-lock-face 'web-vcs-green) + (propertize "Does not match file name" 'font-lock-face 'web-vcs-red))) + (t + ;; symbol-file will be where it is loaded + ;; so check load-path instead. + (let ((file (locate-library feat-name))) + (if (funcall is-same-file file) + (propertize "Probably loaded from same file now" 'font-lock-face 'web-vcs-yellow) + (propertize (format "Probably loaded from %S now" file) + 'font-lock-face 'web-vcs-yellow)))))))) + ;; require + ((eq (car e) 'require) + (if (featurep (cdr e)) + (insert " - " (propertize "Loaded now" 'font-lock-face 'web-vcs-green)) + (insert " - " (propertize "Not loaded now" 'font-lock-face 'web-vcs-yellow)))) + ;; Functions + ((memq (car e) '( defun macro)) + (insert " - ") + (let ((fun (cdr e))) + (insert (if (functionp fun) + (let ((e-file (symbol-file e))) + (if (funcall is-same-file e-file) + (propertize "Same file now" 'font-lock-face 'web-vcs-green) + (let* ((fun-web-auto (get fun 'web-autoload)) + (fun-sub-url (nth 2 fun-web-auto))) + ;; Fix-me: check for temp download file. + (if (string= fun-sub-url active-sub-url) + (propertize "Web download, matches current download" + 'font-lock-face 'web-vcs-yellow) + (propertize (format "Loaded from %S now" e-file) + 'font-lock-face 'web-vcs-yellow))))) + ;; Note that web autoloaded functions are already defined. + (propertize "New" 'font-lock-face 'web-vcs-yellow)))))) + (insert "\n")) + (insert " )\n") + (setq web-vcs-eval-output-end (point-max)) + (goto-char here)))) + (set-buffer-modified-p nil)))) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Specific for nXhtml + +;;(defvar nxhtml-web-vcs-base-url "http://bazaar.launchpad.net/%7Enxhtml/nxhtml/main/") +(defvar nxhtml-web-vcs-base-url "http://bazaar.launchpad.net/~nxhtml/nxhtml/main/") + +;; Fix-me: make gen for 'lp etc +(defun nxhtml-download-root-url (revision) + (let* ((base-url nxhtml-web-vcs-base-url) + (files-url (concat base-url "files/")) + (rev-part (if revision (number-to-string revision) + ;; "head%3A/" + "head:/" + ))) + (concat files-url rev-part))) + +(defun web-vcs-nxhtml () + "Install nXhtml. +Download and install nXhtml." + (interactive) + (catch 'command-level + (setq debug-on-error t) + (let* ((this-dir (file-name-directory web-vcs-el-this)) + (root-url (nxhtml-download-root-url nil)) + ;;(files '("nxhtml-web-vcs.el" "nxhtml-base.el")) + (files '("nxhtml-web-vcs.el")) + (files2 (mapcar (lambda (file) + (cons file (expand-file-name file this-dir))) + files)) + need-dl) + (dolist (file files2) + (unless (file-exists-p (cdr file)) + (setq need-dl t))) + (when need-dl + (let ((prompt + (concat "Welcome to install nXhtml." + "\nFirst the nXhtml specific web install file must be downloaded." + "\nYou will get a chance to review it before it is used." + "\n\nDo you want to continue? ")) + (resize-mini-windows (or resize-mini-windows t))) + (unless (y-or-n-p prompt) + (message "Aborted") + (throw 'command-level nil)))) + (message nil) + (unless (get-buffer-window "*Messages*") + (web-vcs-display-messages t) + (delete-other-windows)) + (dolist (file files2) + (unless (file-exists-p (cdr file)) + (web-vcs-get-missing-matching-files 'lp root-url this-dir (car file) 0))) + (load (cdr (car files2)))) + (call-interactively 'nxhtml-setup-install))) + + +(provide 'web-vcs) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; web-vcs.el ends here diff --git a/emacs/elisp/xrdb-mode.el b/emacs/elisp/xrdb-mode.el new file mode 100644 index 00000000..712f0cbf --- /dev/null +++ b/emacs/elisp/xrdb-mode.el @@ -0,0 +1,544 @@ +;;; xrdb-mode.el --- mode for editing X resource database files + +;; Copyright (C) 1998,1999,2000 Free Software Foundation, Inc. + +;; Author: 1994-2003 Barry A. Warsaw +;; Maintainer: barry@python.org +;; Created: May 1994 +;; Keywords: data languages + +(defconst xrdb-version "2.31" + "`xrdb-mode' version number.") + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License +;; as published by the Free Software Foundation; either version 2 +;; of the License, or (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, write to the Free Software +;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +;;; Commentary: +;; +;; This file provides a major mode for editing X resource database +;; files. It includes font-lock definitions and commands for +;; controlling indentation, re-indenting by subdivisions, and loading +;; and merging into the the resource database. +;; +;; To use, put the following in your .emacs: +;; +;; (autoload 'xrdb-mode "xrdb-mode" "Mode for editing X resource files" t) +;; +;; You may also want something like: +;; +;; (setq auto-mode-alist +;; (append '(("\\.Xdefaults$" . xrdb-mode) +;; ("\\.Xenvironment$" . xrdb-mode) +;; ("\\.Xresources$" . xrdb-mode) +;; ("*.\\.ad$" . xrdb-mode) +;; ) +;; auto-mode-alist)) + +;;; Credits: +;; +;; The database merge feature was inspired by Joel N. Weber II. +;; +;; The canonical Web site for xrdb-mode is +;; + +;;; Code: +(require 'custom) + + + +(defgroup xrdb nil + "Support for editing X resource database files" + :group 'languages) + +(defcustom xrdb-mode-hook nil + "*Hook to be run when `xrdb-mode' is entered." + :type 'hook + :group 'xrdb) + +(defcustom xrdb-subdivide-by 'paragraph + "*Default alignment subdivision when re-indenting a region or buffer. +This variable controls how much of the buffer is searched to find a +goal column on which to align. Every non-comment line in the region +defined by this variable is scanned for the first `:' character on the +line, and this character's column is the line's goal column. The +rightmost line goal column in the region is taken as the region's goal +column. + +This variable can take one of the following symbol values: + + `buffer' - All lines in the buffer are scanned. This is the + slowest option. + + `paragraph' - All lines in the paragraph are scanned. Paragraphs + are delimited by blank lines, comment lines, and page + delimiters. + + `page' - All lines in the page are scanned. Pages are delimited + with `page-delimiter', usually ^L (control-L). + + `line' - Only the previous non-comment line is scanned. This is + the fastest method. + +This variable is used by the various indentation commands, and can be +overridden in those commands by using \\[universal-argument]." + :type '(radio (const :tag "Do not subdivide buffer" buffer) + (const :tag "Subdivide by paragraphs" paragraph) + (const :tag "Subdivide by pages" page) + (const :tag "Each line is independent" line)) + :group 'xrdb) + +(defcustom xrdb-compress-whitespace nil + "*Collapse all whitespace to a single space after insertion of `:'." + :type 'boolean + :group 'xrdb) + +(defcustom xrdb-program "xrdb" + "*Program to run to load or merge resources in the X resource database." + :type 'string + :group 'xrdb) + +(defcustom xrdb-program-args '("-merge") + "*List of string arguments to pass to `xrdb-program'." + :type '(repeat string) + :group 'xrdb) + +(defvar xrdb-master-file nil + "If non-nil, merge in the named file instead of the buffer's file. +The intent is to allow you to set this variable in the file's local +variable section, e.g.: + + ! Local Variables: + ! xrdb-master-file: \"Xdefaults\" + ! End: + +so that typing \\[xrdb-database-merge-buffer-or-region] in that buffer +merges the named master file instead of the buffer's file. Note that +if the file name has a relative path, the `default-directory' for the +buffer is prepended to come up with a file name. + +You may also want to set `xrdb-program-args' in the local variables +section as well.") +(make-variable-buffer-local 'xrdb-master-file) + + +;; Non-user customizable +(defconst xrdb-comment-re "^[ \t]*[!]" + "Regular expression describing the beginning of a comment line.") + + + +;; utilities +(defun xrdb-point (position) + ;; Returns the value of point at certain commonly referenced POSITIONs. + ;; POSITION can be one of the following symbols: + ;; + ;; bol -- beginning of line + ;; eol -- end of line + ;; bod -- beginning of defun + ;; boi -- back to indentation + ;; ionl -- indentation of next line + ;; iopl -- indentation of previous line + ;; bonl -- beginning of next line + ;; bopl -- beginning of previous line + ;; bop -- beginning of paragraph + ;; eop -- end of paragraph + ;; bopg -- beginning of page + ;; eopg -- end of page + ;; + ;; This function does not modify point or mark. + (let ((here (point))) + (cond + ((eq position 'bod) (beginning-of-defun)) + ((eq position 'bol) (beginning-of-line)) + ((eq position 'eol) (end-of-line)) + ((eq position 'boi) (back-to-indentation)) + ((eq position 'bonl) (forward-line 1)) + ((eq position 'bopl) (forward-line -1)) + ((eq position 'bop) (forward-paragraph -1)) + ((eq position 'eop) (forward-paragraph 1)) + ((eq position 'bopg) (forward-page -1)) + ((eq position 'eopg) (forward-page 1)) + (t + (error "unknown buffer position requested: %s" position))) + (prog1 + (point) + (goto-char here)) + )) + +(defmacro xrdb-safe (&rest body) + ;; safely execute BODY, return nil if an error occurred + `( (condition-case nil + (progn (,@ body)) + (error nil)))) + +(defsubst xrdb-skip-to-separator () + ;; skip forward from the beginning of the line to the separator + ;; character as given by xrdb-separator-char. Returns t if the + ;; char was found, otherwise, nil. + (beginning-of-line) + (skip-chars-forward "^:" (xrdb-point 'eol)) + (and (eq (char-after) ?:) + (current-column))) + +(defsubst xrdb-in-comment-p (&optional lim) + (let* ((lim (or lim (xrdb-point 'bod))) + (state (parse-partial-sexp lim (point)))) + (nth 4 state))) + +(defsubst xrdb-boi-col () + (let ((here (point))) + (goto-char (xrdb-point 'boi)) + (prog1 + (current-column) + (goto-char here)))) + +(defvar xrdb-prompt-history nil) + +(defun xrdb-prompt-for-subdivision () + (let ((options '(("buffer" . buffer) + ("paragraphs" . paragraph) + ("pages" . page) + ("lines" . line))) + (completion-ignore-case t)) + (cdr (assoc + (completing-read "Subdivide alignment by? " options nil t + (cons (format "%s" xrdb-subdivide-by) 0) + 'xrdb-prompt-history) + options)))) + + +;; commands +(defun xrdb-electric-separator (arg) + "Insert a colon, and possibly indent line. +Numeric argument inserts that many separators. If the numeric +argument is not given, or is 1, and the separator is not inserted in a +comment, then the line is indented according to `xrdb-subdivide-by'." + (interactive "P") + (self-insert-command (prefix-numeric-value arg)) + ;; only do electric behavior if arg is not given + (or arg + (xrdb-in-comment-p) + (xrdb-indent-line)) + ;; compress whitespace + (and xrdb-compress-whitespace + (just-one-space))) + +(defun xrdb-electric-bang (arg) + "Insert an exclamation point to start a comment. +Numeric argument inserts that many exclamation characters. If the +numeric argument is not given, or is 1, and the bang character is the +first character on a line, the line is indented to column zero." + (interactive "P") + (let ((how-many (prefix-numeric-value arg))) + (self-insert-command how-many) + (save-excursion + (if (and (= how-many 1) + (xrdb-in-comment-p) + (memq (char-before (xrdb-point 'boi)) '(?\n nil))) + (indent-line-to 0))) + )) + + +(defun xrdb-indent-line (&optional arg) + "Align the current line according to `xrdb-subdivide-by'. +With optional \\[universal-argument], prompt for subdivision." + (interactive "P") + (xrdb-align-to-column + (xrdb-guess-goal-column (if arg + (xrdb-prompt-for-subdivision) + xrdb-subdivide-by)) + (xrdb-point 'bol) + (xrdb-point 'bonl))) + +(defun xrdb-indent-region (start end &optional arg) + "Indent all lines in the region according to `xrdb-subdivide-by'. +With optional \\[universal-argument], prompt for subdivision." + (interactive "r\nP") + (xrdb-align-to-column + (xrdb-guess-goal-column (if arg + (xrdb-prompt-for-subdivision) + xrdb-subdivide-by)) + start end)) + +(defun xrdb-indent-page (&optional arg) + "Indent all lines in the page according to `xrdb-subdivide-by'. +With optional \\[universal-argument], prompt for subdivision." + (interactive "P") + (xrdb-align-to-column + (xrdb-guess-goal-column (if arg + (xrdb-prompt-for-subdivision) + xrdb-subdivide-by)) + (xrdb-point 'bopg) + (xrdb-point 'eopg))) + +(defun xrdb-indent-paragraph (&optional arg) + "Indent all lines in the paragraph according to `xrdb-subdivide-by'. +With optional \\[universal-argument], prompt for subdivision." + (interactive "P") + (xrdb-align-to-column + (xrdb-guess-goal-column (if arg + (xrdb-prompt-for-subdivision) + xrdb-subdivide-by)) + (xrdb-point 'bop) + (xrdb-point 'eop))) + +(defun xrdb-indent-buffer (&optional arg) + "Indent all lines in the buffer according to `xrdb-subdivide-by'. +With optional \\[universal-argument], prompt for subdivision." + (interactive "P") + (let ((subdivide-by (if arg + (xrdb-prompt-for-subdivision) + xrdb-subdivide-by))) + (save-excursion + (beginning-of-buffer) + (if (eq subdivide-by 'buffer) + (xrdb-align-to-column (xrdb-guess-goal-column 'buffer) + (point-min) (point-max)) + (let (mvfwdfunc indentfunc) + (cond + ((eq subdivide-by 'paragraph) + (setq mvfwdfunc 'forward-paragraph + indentfunc 'xrdb-indent-paragraph)) + ((eq subdivide-by 'page) + (setq mvfwdfunc 'forward-page + indentfunc 'xrdb-indent-page)) + ((eq subdivide-by 'line) + (setq mvfwdfunc 'forward-line + indentfunc 'xrdb-indent-page)) + (t (error "Illegal alignment subdivision: %s" subdivide-by)) + ) + (while (< (point) (point-max)) + (funcall indentfunc) + (funcall mvfwdfunc 1)) + ))))) + + +;; internal alignment functions +(defun xrdb-align-to-column (goalcol &optional start end) + (let ((start (or start (xrdb-point 'bol))) + (end (or end (xrdb-point 'bonl)))) + (save-excursion + (save-restriction + (narrow-to-region start end) + (beginning-of-buffer) + (while (< (point) (point-max)) + (if (and (not (looking-at xrdb-comment-re)) + (xrdb-skip-to-separator)) + (indent-line-to (max 0 (+ goalcol + (- (current-column)) + (xrdb-boi-col)) + ))) + (forward-line 1)) + )))) + +(defun xrdb-guess-goal-column (subdivide-by) + ;; Returns the goal column of the current line based on SUBDIVIDE-BY, + ;; which can be any value allowed by `xrdb-subdivide-by'. + (let ((here (point)) + (goalcol 0)) + (save-restriction + (cond + ((eq subdivide-by 'line) + (while (and (zerop (forward-line -1)) + (or (looking-at xrdb-comment-re) + (not (xrdb-skip-to-separator))))) + ;; maybe we didn't find one + (if (not (xrdb-skip-to-separator)) + (goto-char here)) + (narrow-to-region (xrdb-point 'bol) (xrdb-point 'bonl))) + ((eq subdivide-by 'page) + (narrow-to-page)) + ((eq subdivide-by 'paragraph) + (narrow-to-region (xrdb-point 'bop) (xrdb-point 'eop))) + ((eq subdivide-by 'buffer)) + (t (error "Illegal alignment subdivision: %s" subdivide-by))) + (goto-char (point-min)) + (while (< (point) (point-max)) + (if (and (not (looking-at xrdb-comment-re)) + (xrdb-skip-to-separator)) + (setq goalcol (max goalcol (- (current-column) (xrdb-boi-col))))) + (forward-line 1))) + (goto-char here) + goalcol)) + + + +;; major-mode stuff +(defvar xrdb-mode-abbrev-table nil + "Abbreviation table used in `xrdb-mode' buffers.") +(define-abbrev-table 'xrdb-mode-abbrev-table ()) + + +(defvar xrdb-mode-syntax-table nil + "Syntax table used in `xrdb-mode' buffers.") +(if xrdb-mode-syntax-table + nil + (setq xrdb-mode-syntax-table (make-syntax-table)) + (modify-syntax-entry ?! "<" xrdb-mode-syntax-table) + (modify-syntax-entry ?\\ "\\" xrdb-mode-syntax-table) + (modify-syntax-entry ?\n ">" xrdb-mode-syntax-table) + (modify-syntax-entry ?/ ". 14" xrdb-mode-syntax-table) + (modify-syntax-entry ?* "_ 23" xrdb-mode-syntax-table) + (modify-syntax-entry ?. "_" xrdb-mode-syntax-table) + (modify-syntax-entry ?# "_" xrdb-mode-syntax-table) + (modify-syntax-entry ?? "_" xrdb-mode-syntax-table) + (modify-syntax-entry ?< "(" xrdb-mode-syntax-table) + (modify-syntax-entry ?> ")" xrdb-mode-syntax-table) + ) + + +(defvar xrdb-mode-map () + "Keymap used in `xrdb-mode' buffers.") +(if xrdb-mode-map + () + (setq xrdb-mode-map (make-sparse-keymap)) + ;; make the separator key electric + (define-key xrdb-mode-map ":" 'xrdb-electric-separator) + (define-key xrdb-mode-map "!" 'xrdb-electric-bang) + (define-key xrdb-mode-map "\t" 'xrdb-indent-line) + (define-key xrdb-mode-map "\C-c\C-a" 'xrdb-indent-buffer) + (define-key xrdb-mode-map "\C-c\C-b" 'xrdb-submit-bug-report) + (define-key xrdb-mode-map "\C-c\C-c" 'xrdb-database-merge-buffer-or-region) + (define-key xrdb-mode-map "\C-c\C-p" 'xrdb-indent-paragraph) + (define-key xrdb-mode-map "\C-c\[" 'xrdb-indent-page) + (define-key xrdb-mode-map "\C-c\C-r" 'xrdb-indent-region) + ) + +;;;###autoload +(defun xrdb-mode () + "Major mode for editing xrdb config files" + (interactive) + (kill-all-local-variables) + (set-syntax-table xrdb-mode-syntax-table) + (setq major-mode 'xrdb-mode + mode-name "xrdb" + local-abbrev-table xrdb-mode-abbrev-table) + (use-local-map xrdb-mode-map) + (setq font-lock-defaults '(xrdb-font-lock-keywords)) + ;; local variables + (make-local-variable 'parse-sexp-ignore-comments) + (make-local-variable 'comment-start-skip) + (make-local-variable 'comment-start) + (make-local-variable 'comment-end) + (make-local-variable 'paragraph-start) + (make-local-variable 'paragraph-separate) + (make-local-variable 'paragraph-ignore-fill-prefix) + (make-local-variable 'indent-region-function) + ;; now set their values + (setq parse-sexp-ignore-comments t + comment-start-skip "![ \t]*" + comment-start "! " + comment-end "") + (setq indent-region-function 'xrdb-indent-region + paragraph-ignore-fill-prefix t + paragraph-start (concat "^[ \t]*$\\|^[ \t]*[!]\\|" page-delimiter) + paragraph-separate paragraph-start) + (run-hooks 'xrdb-mode-hook)) + + + +;; faces and font-locking +(defvar xrdb-option-name-face 'xrdb-option-name-face + "Face for option name on a line in an X resource db file") + +(defvar xrdb-option-value-face 'xrdb-option-value-face + "Face for option value on a line in an X resource db file") + +(make-face 'xrdb-option-name-face) +(make-face 'xrdb-option-value-face) + +(defun xrdb-font-lock-mode-hook () + (or (face-differs-from-default-p 'xrdb-option-name-face) + (copy-face 'font-lock-keyword-face 'xrdb-option-name-face)) + (or (face-differs-from-default-p 'xrdb-option-value-face) + (copy-face 'font-lock-string-face 'xrdb-option-value-face)) + (remove-hook 'font-lock-mode-hook 'xrdb-font-lock-mode-hook)) +(add-hook 'font-lock-mode-hook 'xrdb-font-lock-mode-hook) + +(defvar xrdb-font-lock-keywords + (list '("^[ \t]*\\([^\n:]*:\\)[ \t]*\\(.*\\)$" + (1 xrdb-option-name-face) + (2 xrdb-option-value-face))) + "Additional expressions to highlight in X resource db mode.") +(put 'xrdb-mode 'font-lock-defaults '(xrdb-font-lock-keywords)) + + + +;; merging and manipulating the X resource database +(defun xrdb-database-merge-buffer-or-region (start end) + "Merge the current buffer's resources into the X resource database. + +`xrdb-program' is the program to actually call, with the arguments +specified in `xrdb-program-args'. This latter can be set to do either +a merge or a load, etc. Also, if the file local variable +`xrdb-master-file' is non-nil, then it is merged instead of the +buffer's file. + +If the current region is active, it is merged instead of the buffer, +and this overrides any use of `xrdb-master-file'." + (interactive + ;; the idea here is that if the region is inactive, start and end + ;; will be nil, if not passed in programmatically + (list (xrdb-safe (and (mark) (region-beginning))) + (xrdb-safe (and (mark) (region-end))))) + (message "Merging with args: %s..." xrdb-program-args) + (let ((outbuf (get-buffer-create "*Shell Command Output*"))) + ;; I prefer the XEmacs way of doing this, but this is the easiest + ;; way to work in both XEmacs and Emacs. + (with-current-buffer outbuf (erase-buffer)) + (cond + ((and start end) + (apply 'call-process-region start end xrdb-program nil outbuf t + xrdb-program-args)) + (xrdb-master-file + (apply 'call-process xrdb-program xrdb-master-file outbuf t + xrdb-program-args)) + (t + (apply 'call-process-region (point-min) (point-max) xrdb-program + nil outbuf t xrdb-program-args))) + (if (not (zerop (with-current-buffer outbuf (buffer-size)))) + (pop-to-buffer outbuf))) + (message "Merging... done")) + + + +;; submitting bug reports + +(defconst xrdb-mode-help-address "tools-help@python.org" + "Address for xrdb-mode bug reports.") + +(defun xrdb-submit-bug-report () + "Submit via mail a bug report on xrdb-mode." + (interactive) + ;; load in reporter + (require 'reporter) + (let ((reporter-prompt-for-summary-p t) + (varlist '(xrdb-subdivide-by + xrdb-mode-hook + xrdb-compress-whitespace + ))) + (and (if (y-or-n-p "Do you want to submit a report on xrdb-mode? ") + t + (message "") + nil) + (require 'reporter) + (reporter-submit-bug-report + xrdb-mode-help-address + (format "xrdb-mode %s" xrdb-version) + varlist nil nil "Dear Barry,") + ))) + + +(provide 'xrdb-mode) +;;; xrdb-mode.el ends here diff --git a/emacs/init.el b/emacs/init.el new file mode 100644 index 00000000..d011945f --- /dev/null +++ b/emacs/init.el @@ -0,0 +1,1035 @@ +;;;; Startup +;; Do not merge echo-area-message sexp +(setq inhibit-startup-echo-area-message "alan") +(setq inhibit-startup-screen t + initial-scratch-message "" + initial-major-mode 'text-mode + user-mail-address "alan@alanpearce.co.uk" + user-full-name "Alan Pearce") +(setq custom-file "~/.emacs.d/custom.el") + +;;;; Package Management +(setq *el-get-dir* (expand-file-name "el-get/" user-emacs-directory) + *elisp-dir* (expand-file-name "elisp/" user-emacs-directory) + *custom-dir* (expand-file-name "custom/" user-emacs-directory) + el-get-github-default-url-type "git" + el-get-emacswiki-base-url "http://raw.github.com/emacsmirror/emacswiki.org/master/" + package-archives '(("ELPA" . "http://tromey.com/elpa/") + ("gnu" . "http://elpa.gnu.org/packages/") + ("marmalade" . "http://marmalade-repo.org/packages/") + ("melpa" . "http://melpa.milkbox.net/packages/"))) + +(defun add-subdirs-to-load-path (path) + (unless (member path load-path) + (mapc (lambda (file) + (let ((full-path (concat path file))) + (if (and (not (string-prefix-p "." file)) + (file-directory-p full-path)) + (add-to-list 'load-path full-path)))) + (directory-files *el-get-dir*)))) + +(if (file-exists-p (concat *el-get-dir* "el-get")) + (add-subdirs-to-load-path *el-get-dir*) + (unless (require 'el-get nil t) + (with-current-buffer + (url-retrieve-synchronously + "https://raw.github.com/dimitri/el-get/master/el-get-install.el") + (make-local-variable 'el-get-master-branch) + (goto-char (point-max)) + (eval-print-last-sexp) + (load (concat *elisp-dir* "el-get-setup"))))) + +(add-to-list 'load-path *elisp-dir*) + +(require 'use-package) + +(eval-when-compile + (unless (fboundp 'diminish) + (require 'diminish nil t))) + +(use-package el-get + :commands (el-get-init + el-get-install + el-get-reinstall + el-get-remove + el-get-update + el-get-self-update + el-get-describe)) + +;;;; Style + +(use-package linum + :commands (linum-mode) + :config (setq linum-format " %4d ")) + +(use-package highlight-symbol + :disabled t + :config (setq highlight-symbol-idle-delay 0.2)) + +(use-package whitespace + :defer t + :config (setq whitespace-style + '(face + space + tabs + trailing + newline + empty + space-after-tab + tab-mark + space-before-tab + indentation + indentation::space + indentation::tabs + ))) + +(global-font-lock-mode t) +;; Allow font-lock-mode to do background parsing +(setq jit-lock-stealth-time 1 + jit-lock-stealth-load 5 + jit-lock-defer-time 0.1) + +(use-package solarized-theme + :config (load-theme 'solarized-light t)) + +(use-package color-theme-solarized + :disabled t + :commands (color-theme-solarized-light) + :depends color-theme + :init (color-theme-solarized-light)) + +(when (or (display-graphic-p) + (daemonp)) + (use-package fringe + :defer t + :config (fringe-mode '(0 . 0))) + + (defun use-variable-fonts () + (interactive) + (variable-pitch-mode) + (setq cursor-type 'bar)) + + (add-hook 'org-mode-hook #'use-variable-fonts) + + (if (eq window-system 'w32) + (let* ((font-size 10) + (mono-face (cond + ((member "Liberation Mono" (font-family-list)) + "Liberation Mono") + ((member "Liberation Sans Mono" (font-family-list)) + "Liberation Sans Mono") + ((member "Consolas" (font-family-list)) + "Consolas") + )) + (variable-face "Segoe UI") + (default-font (concat mono-face "-" (number-to-string font-size)))) + (when mono-face + (set-face-font 'default default-font) + (set-face-font 'fixed-pitch default-font)) + (when variable-face + (set-face-font 'variable-pitch (concat variable-face "-" + (number-to-string (1+ font-size)))))))) + +(with-elapsed-timer "Setting up font styles" + (let* ((font-height (face-attribute 'default :height)) + (small-font-height (max 1 (floor (* .917 font-height))))) + (mapc (lambda (item) + (put (car item) 'customized-face (cadr item)) + (face-spec-set (car item) (cadr item))) + `((linum + ((t (:height ,small-font-height + :foreground unspecified + :inherit fringe + :overline nil + :slant normal)))) + (vertical-border + ((t (:foreground unspecified + :background unspecified + :inherit file-name-shadow)))) + (font-lock-comment-face + ((t (:slant normal)))) + (font-lock-doc-face + ((t (:slant normal)))) + (popup-face + ((t (:background unspecified + :foreground unspecified + :inherit linum + :height ,font-height)))) + (popup-scroll-bar-foreground-face + ((t (:background unspecified + :inherit region)))) + (popup-scroll-bar-background-face + ((t (:background unspecified + :inherit popup-face)))) + (ac-completion-face + ((t (:background unspecified + :foreground unspecified + :inherit popup-face)))) + (ac-candidate-face + ((t (:background unspecified + :foreground unspecified + :inherit linum + :height ,font-height)))) + (ac-selection-face + ((t (:background unspecified + :foreground unspecified + :inherit font-lock-variable-name-face + :inverse-video t)))) + (ac-candidate-mouse-face + ((t (:background unspecified + :foreground unspecified + :inherit region)))) + (ac-dabbrev-menu-face + ((t (:background unspecified + :foreground unspecified + :inherit popup-face)))) + (ac-dabbrev-selection-face + ((t (:background unspecified + :foreground unspecified + :inherit ac-selection-face)))) + (flymake-warnline + ((t (:background unspecified + :foreground unspecified + :inherit font-lock-preprocessor-face)))) + (org-table ((t (:inherit 'fixed-pitch)))) + (org-formula ((t (:foreground "Firebrick" + :inherit 'fixed-pitch)))) + (org-done ((t (:weight normal + :strike-through t)))) + (org-headline-done ((t (:strike-through t)))) + )))) + +;;;; Autosaves & Backups +(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)) + auto-save-file-name-transforms `((".*" ,temporary-file-directory t)) + backup-by-copying-when-linked t + backup-by-copying-when-mismatch t)) + +;;;; Buffers + +(use-package ibuffer + :disabled t + :commands (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))))) + +(use-package uniquify + :defer t + :idle (require 'uniquify) + :config (progn + (setq uniquify-buffer-name-style 'reverse + uniquify-separator "/" + uniquify-after-kill-buffer-p t + uniquify-ignore-buffers-re "^\\*"))) + +;;;; Communication + +(use-package erc + :defer t + :config (progn + (setq erc-user-full-name "Alan Pearce" + erc-email-userid "alan@alanpearce.co.uk" + erc-echo-notice-in-minibuffer t + erc-keywords '("alanpearce" "lethalrocks") + erc-autojoin-channels-alist + '(("freenode.net" "#emacs" "##freebsd" "#bufferbloat" "#openwrt" "#lojban" "#zfs" "#introverts") + ("what.cd" "#what.cd") + ("beusergroup.co.uk" "#be") + )) + (add-to-list 'erc-modules 'scrolltobottom) + (add-to-list 'erc-modules 'autojoin) + (add-to-list 'erc-modules 'match))) + +;;;; Completion + +(setq completion-styles '(basic initials partial-completion substring) + completion-ignore-case t) + +(use-package smart-tab + :commands (global-smart-tab-mode) + :idle (global-smart-tab-mode) + :config (progn + (nconc smart-tab-completion-functions-alist '((php-mode . php-complete-function))) + (diminish 'smart-tab-mode ""))) + +;;;; Directory browsing +(use-package dired + :defer t + :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-bind-jump nil) + (put 'dired-find-alternate-file 'disabled nil))) + +(use-package dired+ + :defer t + :config (diredp-toggle-find-file-reuse-dir 1)) + +;;;; Documentation + +(add-to-list 'Info-default-directory-list + (concat user-emacs-directory + "info")) + +(use-package eldoc + :commands (turn-on-eldoc-mode + eldoc-add-command)) + +(use-package eldoc-context + :depends eldoc + :bind (("C-c h" . rgr/toggle-context-help))) + +(use-package help+ + :bind (("" . help-on-click/key))) + +(use-package which-func + :defer t + :idle (which-function-mode) + :init (setq which-func-modes t)) + +;;;; Files + +(prefer-coding-system 'utf-8-auto-unix) +(set-default-coding-systems 'utf-8-auto-unix) +(setq-default buffer-file-coding-system 'utf-8-auto-unix) +(use-package autorevert + :defer t + :idle (global-auto-revert-mode 1)) + +(add-hook 'before-save-hook #'delete-trailing-whitespace) + +(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) + (rename-file filename new-name 1) + (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)) + (buffer (current-buffer)) + (name (buffer-name))) + (if (not (and filename (file-exists-p filename))) + (ido-kill-buffer) + (when (yes-or-no-p "Are you sure you want to remove this file? ") + (delete-file filename) + (kill-buffer buffer) + (message "File '%s' successfully removed" filename))))) + +(use-package saveplace + :defer t + :idle (require 'saveplace) + :config (progn (setq-default save-place t) + (setq save-place-file (expand-file-name ".saveplace" user-emacs-directory)) + )) + +(use-package tramp + :defer t + :config (progn + (setq tramp-default-method (if (eq system-type 'windows-nt) "plinkx" "ssh") + tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root") (nil nil "alan")) + 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 '("router" nil nil)))) + +(use-package tramp-sh + :defer t + :config (progn + (add-to-list 'tramp-remote-path "/usr/local/sbin") + (add-to-list 'tramp-remote-path "~/bin"))) + +;;;; Indentation + +(setq-default tab-width 4 + indent-tabs-mode t) +(setq tab-stop-list + ;; (mapcar (lambda (x) + ;; (* 4 x)) + ;; (number-sequence 1 (/ 120 4))) + '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120) + tab-always-indent 'complete) + +(use-package auto-indent-mode + :defer t + :commands (auto-indent-minor-mode + 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 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-global-mode))) + +(use-package smart-tabs-mode + :commands (smart-tabs-mode + smart-tabs-mode-enable + smart-tabs-advice) + :config (progn + (smart-tabs-insinuate 'c 'javascript 'cperl 'python 'ruby) + (add-hook 'php-mode-hook #'smart-tabs-mode-enable) + )) + +;;;; Keybindings + +(unbind-key "") +(bind-key "" #'compile) +(bind-key "" #'kmacro-start-macro-or-insert-counter) +(bind-key "" #'kmacro-end-or-call-macro) + +(bind-key "" #'execute-extended-command) + +(if (display-graphic-p) + (unbind-key "C-z")) +(bind-key "C-" #'other-window) + +(bind-key "C-x C-r" #'revert-buffer) +(bind-key "C-x C-j" #'delete-indentation) +(unbind-key "C-x C-c") + +(bind-key "C-c i" #'ucs-insert) + +;; Enable narrowing functions C-x n +(put 'narrow-to-defun 'disabled nil) +(put 'narrow-to-page 'disabled nil) +(put 'narrow-to-region 'disabled nil) + +;;;; Minibuffer + +(setq enable-recursive-minibuffers t) +(use-package mb-depth + :defer t + :idle (minibuffer-depth-indicate-mode t)) + +(defalias 'exit-emacs 'save-buffers-kill-emacs) + +(use-package lacarte + :bind (("M-`" . lacarte-execute-menu-command))) + +(use-package helm-config + :bind (("C-x i" . helm-imenu) + ("C-x C-b" . helm-mini))) + +(use-package ido + :commands (ido-mode + ido-find-file) + :init (bind-key* "C-x C-f" #'ido-find-file) + :bind (("C-x b" . ido-switch-buffer)) + :config (progn + (ido-mode) + (setq ido-decorations (quote ("\n›" "" "\n " "\n …" "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]"))) + (setq ido-auto-merge-delay-time 99999 + ido-enable-flex-matching t) + (ido-init-completion-maps) + (defun ido-manual-merge () + (interactive) + (ido-initiate-auto-merge (current-buffer))) + (bind-key "C-c C-s" #'ido-manual-merge ido-file-dir-completion-map))) + +(use-package smex + :bind (("M-x" . smex) + ("" . smex) + ("" . smex) + ("M-X" . smex-major-mode-commands) + ("C-c M-x" . execute-extended-command)) + :config (progn + (setq smex-history-length 100 + smex-save-file (concat user-emacs-directory + "smex-items")) + (smex-initialize) + (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))) + +;;;; Modeline + +(column-number-mode t) +(size-indication-mode t) + +;;;; Modes + +;;;; systemd files +(add-to-list 'auto-mode-alist '("\\.service\\'" . conf-mode)) +(add-to-list 'auto-mode-alist '("\\.target\\'" . conf-mode)) +(add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-mode)) + +(use-package xrdb-mode + :mode (("\\.Xdefaults\\'" . xrdb-mode) + ("\\.Xresources\\'" . xrdb-mode))) + +(use-package haskell-mode + :mode (("\\.hs\\'" . haskell-mode) + ("xmobarrc\\'" . haskell-mode))) + +;;;; Planning + +(use-package calendar + :defer t + :config (progn + (setq calendar-week-start-day 1) + (calendar-set-date-style 'iso))) + +(use-package org-mode + :bind (("C-c C-a" . org-agenda-list) + ("C-c a" . org-agenda) + ("C-c l" . org-store-list) + ("C-c r" . org-remember) + ("C-c b" . org-iswitchb)) + :config (progn + (setq org-directory "~/org") + (setq org-agenda-files `(,org-directory) + + org-default-notes-file (concat org-directory "/notes") + + ;; Fewer asterisks, doesn't change indentation + org-hide-leading-stars t + + org-startup-indented nil + + ;; ‘Remember’: new items at top + org-reverse-note-order t + + org-modules '(org-habit + org-checklist) + + ;; Add time done to ‘done’ tasks + org-log-done 'time + + ;; Allow refiling into any org file + org-refile-targets '((org-agenda-files :maxlevel . 3)) + + org-alphabetical-lists t + + org-pretty-entities t + + org-table-duration-custom-format 'seconds + + org-export-have-math t + + org-blank-before-new-entry '((heading . t) + (plain-list-item . auto)) + org-fontify-done-headline t)) + :init (setq org-replace-disputed-keys t + org-todo-keywords '((sequence "TODO" "STARTED" "|" "DONE") + (sequence "TOLEARN" "LEARNING" "LEARNED" "|" "MASTERED") + (sequence "|" "CANCELLED")))) + +;;;; Programming + +(use-package cedet + :defer t + :config (progn + (semantic-load-enable-code-helpers) + (global-semantic-idle-completions-mode t) + (global-semantic-highlight-func-mode t) + (global-semantic-show-unmatched-syntax-mode t) + (global-semantic-decoration-mode t))) + +;;;; Projects + +(use-package projectile + :bind (("C-c C-f" . projectile-find-file)) + :commands (projectile-global-mode)) + +(use-package project-persist + :commands (project-persist-mode) + :bind (("C-c P d" . project-persist-delete) + ("C-c P f" . project-persist-find) + ("C-c P k" . project-persist-close) + ("C-c P n" . project-persist-create) + ("C-c P s" . project-persist-save)) + :load-path "el-get/project-persist/lib/" + :config (progn + (project-persist-mode t) + + (setq project-persist-auto-save-global t) + + (add-hook 'project-persist-before-load-hook #'kill-all-buffers) + + (defun emacs-process-p (pid) + "If pid is the process ID of an emacs process, return t, else nil. +Also returns nil if pid is nil." + (when pid + (let ((attributes (process-attributes pid)) (cmd)) + (dolist (attr attributes) + (if (string= "comm" (car attr)) + (setq cmd (cdr attr)))) + (if (and cmd (or (string= "emacs" cmd) (string= "emacs.exe" cmd))) t)))) + + (defadvice desktop-owner (after pry-from-cold-dead-hands activate) + "Don't allow dead emacsen to own the desktop file." + (when (not (emacs-process-p ad-return-value)) + (setq ad-return-value nil))) + + (defun load-project-desktop () + "Load the project's desktop if available" + (ignore-errors + (let ((default-directory project-persist-current-project-settings-dir)) + (desktop-read)))) + + (defun kill-all-buffers () + "Kill all file-based buffers." + (interactive) + (mapc (lambda (buf) + (when (buffer-file-name buf) + (when (and (buffer-modified-p buf) + (y-or-n-p (format "Buffer %s is modified - save it?" (buffer-name buf)))) + (save-some-buffers nil buf)) + (set-buffer-modified-p nil) + (kill-buffer buf))) + (buffer-list))) + + (add-hook 'project-persist-after-close-hook + (lambda () + (kill-all-buffers) + (projectile-global-mode -1))) + + (add-hook 'project-persist-after-load-hook + (lambda () + (setq default-directory (pp/settings-get 'root-dir)) + (load-project-desktop) + (projectile-global-mode 1))) + + (add-hook 'project-persist-after-save-hook + (lambda () + (message (format "Saving project desktop (%s)" project-persist-current-project-settings-dir)) + (desktop-save project-persist-current-project-settings-dir))) + + )) + +(use-package vc + :config (progn + (setq vc-follow-symlinks t))) + +(use-package magit + :commands (magit-status) + :bind (("C-x g" . magit-status))) + +;;;; Spelling +(setq ispell-program-name "aspell" + ispell-dictionary "british") +;; (setq ispell-process-directory (expand-file-name "~/")) +;; If aspell is too slow +;; If it is still too slow, use ‘ultra’ instead of ‘fast’ +;; (setq ispell-extra-args '(" --sug-mode=fast")) +(use-package ispell + :bind (("" . ispell-word))) + +;;;; Scripting + +(add-hook 'after-save-hook + #'executable-make-buffer-file-executable-if-script-p) + +(use-package sh-script + :defer t + :config (setq sh-shell-file "/usr/bin/env zsh")) + +(use-package ntcmd + :mode (("\\`.cmd\\'" . ntcmd-mode) + ("\\`.bat\\'" . ntcmd-mode))) + +;;;; Shells & REPLs + +(use-package eshell + :defer t + :config (setq eshell-directory-name "~/.emacs.d/eshell")) + +(use-package shell + :defer t + :config (define-key shell-mode-map + (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) + +(use-package multi-term + :if (not (eq system-type 'windows-nt)) + :bind ("C-`" . multi-term-dedicated-toggle)) + +(defun comint-delchar-or-eof-or-kill-buffer (arg) + (interactive "p") + (if (null (get-buffer-process (current-buffer))) + (kill-buffer) + (comint-delchar-or-maybe-eof arg))) + +;;;; Text editing + +;; Enable upcase and downcase-region +(put 'upcase-region 'disabled nil) +(put 'downcase-region 'disabled nil) +(setq sentence-end-double-space nil + line-move-visual nil) + +;; replace highlighted text rather than just inserting at point +(delete-selection-mode t) + +(use-package subword + :init (global-subword-mode t)) + +(use-package misc + :bind (("M-z" . zap-up-to-char) + ("M-Z" . zap-to-char))) + +(use-package ap-functions + :commands (ap/remove-extra-cr + ap/byte-compile-get-dest) + :bind (("C-x r M-w" . copy-rectangle) + ("M-!" . shell-execute))) + +(when (boundp 'x-select-request-type) + (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))) + +(use-package ace-jump-mode + :bind (("C-c SPC" . ace-jump-mode)) + :config (progn + (ace-jump-mode-enable-mark-sync) + (setq ace-jump-word-mode-use-query-char nil + ace-jump-mode-scope 'window))) + +(use-package autopair + :commands (autopair-mode) + :init (progn + (add-hook 'prog-mode-hook #'autopair-mode) + (setq autopair-blink nil + autopair-skip-whitespace nil))) + +(use-package electric-return + :bind (("RET" . electrify-return-if-match))) + +(use-package expand-region + :bind ("C-M-SPC" . er/expand-region)) + +(use-package goto-chg + :bind ("C-x C-SPC" . goto-last-change)) + +(use-package multiple-cursors + :bind (("C-." . mc/mark-next-like-this) + ("C-," . mc/mark-previous-like-this) + ("M-" . mc/mark-all-like-this-dwim) + ("C-" . mc/mark-more-like-this-extended) + ("C-S-L" . mc/edit-lines))) + +(use-package paredit + :commands (paredit-mode) + :init (progn + (put #'paredit-forward-delete 'delete-selection 'supersede) + (put #'paredit-backward-delete 'delete-selection 'supersede) + (add-hook 'minibuffer-setup-hook #'conditionally-enable-paredit-mode) + (defun conditionally-enable-paredit-mode () + "enable paredit-mode during eval-expression" + (if (eq this-command 'eval-expression) + (paredit-mode 1))))) + +(use-package shuffle-lines + :bind (("C-S-" . move-line-up) + ("C-S-" . move-line-down))) + +(use-package smart-forward + :bind (("C-M-u" . smart-up) + ("C-M-d" . smart-down) + ("C-M-p" . smart-backward) + ("C-M-n" . smart-forward))) + +(use-package undo-tree + :idle (require 'undo-tree) + :defer t + :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))) + :diminish undo-tree-mode) + +;;;; Lisps + +(defun ap/lisp-setup () + (if (featurep 'autopair) + (autopair-mode -1)) + (paredit-mode +1) + (eldoc-add-command 'paredit-backward-delete 'paredit-close-round) + + (if (featurep 'auto-indent-mode) + (progn (auto-indent-mode -1) + (setq lisp-body-indent 2))) + + (show-paren-mode t) + (setq indent-tabs-mode nil) + + (local-set-key (kbd "RET") 'electrify-return-if-match) + (local-set-key (kbd "C-j") 'electrify-return-if-match)) + +(add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup) +(add-hook 'emacs-lisp-mode-hook #'turn-on-eldoc-mode) + +(add-hook 'scheme-mode-hook #'ap/lisp-setup) + +(use-package bytecomp + :defer t + :config (setq byte-compile-dest-file-function #'ap/byte-compile-get-dest)) + +(use-package elisp-slime-nav + :commands elisp-slime-nav-mode + :diminish elisp-slime-nav-mode) + +(use-package geiser + :defer t + :commands (geiser-mode + geiser + run-geiser + run-racket) + :load-path "el-get/geiser/elisp") + +(use-package geiser-base + :defer t + :config (use-package quack)) + +(use-package slime + :commands (slime) + :config (progn + (setq inferior-lisp-program (executable-find "sbcl")) + (slime-setup))) + +(defun imenu-elisp-sections () + (setq imenu-prev-index-position-function nil) + (add-to-list 'imenu-generic-expression '("Sections" "^;;;; \\(.+\\)$" 1) t)) + +(defun init-narrow-to-section () + (interactive) + (save-excursion + (beginning-of-line) + (unless (looking-at "^;;;;") + (re-search-backward "^;;;;" nil t)) + (push-mark) + (forward-line) + (re-search-forward "^;;;;" nil t) + (forward-line -1) + (narrow-to-region (region-beginning) (region-end)))) + +(defun init-imenu (p) + (interactive "P") + (find-file-existing "~/dotfiles/emacs/init.el") + (widen) + (helm-imenu) + (if p (init-narrow-to-section))) + +(add-hook 'emacs-lisp-mode-hook 'imenu-elisp-sections) + +;;;; Programming + +(use-package auto-compile + :commands (auto-compile-on-save-mode) + :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) + +(use-package cc-mode + :defer t + :init (progn + (add-hook 'c-mode-common-hook (lambda () + ;; (use-package mic-paren + ;; :init (paren-toggle-open-paren-context 1)) + (electric-indent-mode 1)))) + :config (progn + (setq c-default-style '((java-mode . "java") + (awk-mode . "awk") + (other . "k&r")) + c-basic-offset 4) + (c-set-offset 'case-label '+) + (c-set-offset 'arglist-cont-nonempty #'ap/c-lineup-arglist) + (defun ap/c-lineup-arglist (langelem) + "Line up the current argument line under the first argument. + +As a special case, if the indented line is inside a brace block +construct, the indentation is 0 only. This is intended +as a \"DWIM\" measure in cases like macros that contains statement +blocks, e.g: + +A_VERY_LONG_MACRO_NAME ({ + some (code, with + long, lines * in[it]); +}); +<--> c-basic-offset + +Works with: arglist-cont-nonempty, arglist-close." + (save-excursion + (let ((indent-pos (point))) + + (if (c-block-in-arglist-dwim (c-langelem-2nd-pos c-syntactic-element)) + 0 + + ;; Normal case. Indent to the token after the arglist open paren. + (goto-char (c-langelem-2nd-pos c-syntactic-element)) + (if (and c-special-brace-lists + (c-looking-at-special-brace-list)) + ;; Skip a special brace list opener like "({". + (progn (c-forward-token-2) + (forward-char)) + (forward-char)) + + (let ((arglist-content-start (point))) + (c-forward-syntactic-ws) + (when (< (point) indent-pos) + (goto-char arglist-content-start) + (skip-chars-forward " \t")) + (vector (if (or (looking-at ",") + (looking-at ")")) + (- (current-column) 2) + (current-column) + ))))))))) + +;;;; Web Development + +(use-package moz + :load-path "moz-repl" + :commands (moz-firefox-reload + moz-reload-on-save-mode + moz-minor-mode) + :config (progn + (define-minor-mode moz-reload-on-save-mode + "Moz Reload On Save Minor Mode" + nil " Reload" nil + (if moz-reload-on-save-mode + ;; Edit hook buffer-locally. + (add-hook 'after-save-hook 'moz-firefox-reload nil t) + (remove-hook 'after-save-hook 'moz-firefox-reload t))) + + (defun moz-firefox-reload () + "Reload Firefox" + (interactive) + (comint-send-string (inferior-moz-process) + "BrowserReload();")))) + +(use-package js3 + :mode ("\\.js\\'" . js3-mode) + :config (progn + (defun ap/javascript-setup () + (moz-minor-mode t) + (autopair-mode -1) + (auto-indent-mode -t)) + (add-hook 'js3-mode-hook #'ap/javascript-setup) + (setq js3-indent-level 4 + js3-expr-indent-offset 4 + js3-paren-indent-offset 4 + js3-square-indent-offset 4 + js3-curly-indent-offset 4))) + +(use-package mustache-mode + :mode (("\\.mustache" . mustache-mode) + ("\\.mt\\'" . mustache-mode) + ("\\.template\\'" . mustache-mode))) + +(use-package nxhtml-mode + :defer t + :mode (("\\.php\\'" . html-mumamo-mode)) + :idle (load (expand-file-name "nxhtml/autostart" *el-get-dir*)) + :config (progn + (setq mumamo-chunk-coloring 4 + nxhtml-skip-welcome t + nxhtml-autoload-web nil) + (nxhtml-menu-mode 0))) + +(use-package php-mode + :mode ("\\.php\\'" . php-mode) + :config (progn + (bind-key "C-h C-f" #'php-search-documentation php-mode-map) + (unbind-key "C-c C-f" php-mode-map) + (unbind-key "C-." php-mode-map) + (if (member system-name '("PREFECT" "prefect")) + (setq php-manual-url "http://docs.home/manual/en/")) + (add-hook 'php-mode-hook (lambda () + (set (make-local-variable 'eldoc-documentation-function) #'my-php-eldoc-function))) + (use-package eldoc-php + :config (turn-on-eldoc-mode)))) + +(use-package sgml-mode + :defer t + :config (setq sgml-basic-offset 4)) + +;;;; Windows & Frames + +(setq frame-title-format + '("" + (:eval (capitalize invocation-name)) ": " + (:eval (if (buffer-file-name) + (abbreviate-file-name (buffer-file-name)) + "%b")))) + +(setq scroll-conservatively 100 ; Keep the cursor position when scrolling + scroll-preserve-screen-position nil) + +(when menu-bar-mode + (menu-bar-mode -1)) +(when scroll-bar-mode + (scroll-bar-mode -1) + (tooltip-mode -1) + (tool-bar-mode -1)) + +(use-package winner + :bind (("C-c " . winner-undo) + ("C-c " . winner-redo))) + +(use-package windmove + :bind (("S-" . windmove-left) + ("S-" . windmove-right) + ("S-" . windmove-up) + ("S-" . windmove-down))) diff --git a/hgrc b/hgrc new file mode 100644 index 00000000..2f16f27e --- /dev/null +++ b/hgrc @@ -0,0 +1,9 @@ +[ui] +username = Alan Pearce + +[extensions] +purge = +progress = +color = +eol = +record = \ No newline at end of file diff --git a/install b/install new file mode 100755 index 00000000..80dc2993 --- /dev/null +++ b/install @@ -0,0 +1,44 @@ +#!/usr/bin/env zsh + +pushd $HOME + +setopt EXTENDED_GLOB + +if [[ ! -d dotfiles && ${(L)host} =~ prefect ]] +then + hg clone ssh://alan@home.alanpearce.co.uk:22222/dotfiles +fi + +install-dot () { + local absolute + if [[ ${1[-1]} == "/" ]] + then + absolute=$PWD/ + + if [[ ! -d $1 ]] + then + mkdir $1 + fi + + else + absolute="" + fi + + for f in $@[2,-1] + do + if [[ ! -e $1$f:t ]] + then + ln -sf $absolute$f $1$f:t + fi + done +} + +install-dot .emacs.d/ dotfiles/emacs/* +install-dot . dotfiles/^install(.) dotfiles/zsh/zshrc +install-dot .ssh/ dotfiles/ssh/* +if [[ -d dwm ]] +then + install-dot dwm/ dotfiles/dwm/* +fi + +popd diff --git a/minttyrc b/minttyrc new file mode 100644 index 00000000..37dae2b7 --- /dev/null +++ b/minttyrc @@ -0,0 +1,33 @@ +BoldAsFont=no +Font=Liberation Mono +FontHeight=10 +FontSmoothing=default +Locale=en_GB +Charset=UTF-8 +Columns=100 +Rows=36 +Scrollbar=none +Transparency=off +OpaqueWhenFocused=no +CursorType=block +CursorBlinks=no +RightClickAction=extend +BoldBlack=0,43,54 +Black=7,54,66 +BoldGreen=88,110,117 +BoldYellow=101,123,131 +BoldBlue=131,148,150 +BoldCyan=147,161,161 +White=238,232,213 +BoldWhite=253,246,227 +Yellow=181,137,0 +BoldRed=203,75,22 +Red=220,50,47 +Magenta=211,54,130 +BoldMagenta=108,113,196 +Blue=38,139,210 +Cyan=42,161,152 +Green=133,153,0 +ForegroundColour=101,123,117 +BackgroundColour=253,246,227 +CursorColour=112,129,131 diff --git a/ssh/rc b/ssh/rc new file mode 100644 index 00000000..7b6da3a8 --- /dev/null +++ b/ssh/rc @@ -0,0 +1,5 @@ +#!/bin/sh +if [ "$SSH_AUTH_SOCK" ] +then + ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock +fi diff --git a/tmux.conf b/tmux.conf new file mode 100644 index 00000000..697e1238 --- /dev/null +++ b/tmux.conf @@ -0,0 +1,19 @@ +#setw -g xterm-keys on +#set -g terminal-overrides "xterm*:kLFT5=\eOD:kRIT5=\eOC:kUP5=\eOA:kDN5=\eOB:smkx@:rmkx@" + +set-window-option -g utf8 on +set-option -g status-utf8 on +set-option -g prefix C-z + +bind C-n send-prefix +unbind-key C-b + +set -g default-terminal "screen-256color" + +# Colemak style +bind-key C-i next-window + +set -g base-index 1 + +set -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_GIT SSH_CONNECTION WINDOWID XAUTHORITY" +set-environment -g 'SSH_AUTH_SOCK' '/home/alan/.ssh/ssh_auth_sock' \ No newline at end of file diff --git a/xbindkeysrc.scm b/xbindkeysrc.scm new file mode 100644 index 00000000..99e78cb6 --- /dev/null +++ b/xbindkeysrc.scm @@ -0,0 +1,60 @@ +;; To specify a key, you can use 'xbindkeys --key' or +;; 'xbindkeys --multikey' and put one of the two lines in this file. + +;; A list of keys is in /usr/include/X11/keysym.h and in +;; /usr/include/X11/keysymdef.h +;; The XK_ is not needed. + +;; List of modifier: +;; Release, Control, Shift, Mod1 (Alt), Mod2 (NumLock), +;; Mod3 (CapsLock), Mod4, Mod5 (Scroll). + + +;; The release modifier is not a standard X modifier, but you can +;; use it if you want to catch release instead of press events + +;; By defaults, xbindkeys does not pay attention to modifiers +;; NumLock, CapsLock and ScrollLock. +;; Uncomment the lines below if you want to use them. +;; To dissable them, call the functions with #f + + +;;;;EXTRA FUNCTIONS: Enable numlock, scrolllock or capslock usage +;;(set-numlock! #t) +;;(set-scrolllock! #t) +;;(set-capslock! #t) + +;;;;; Scheme API reference +;;;; +;; Optional modifier state: +;; (set-numlock! #f or #t) +;; (set-scrolllock! #f or #t) +;; (set-capslock! #f or #t) +;; +;; Shell command key: +;; (xbindkey key "foo-bar-command [args]") +;; (xbindkey '(modifier* key) "foo-bar-command [args]") +;; +;; Scheme function key: +;; (xbindkey-function key function-name-or-lambda-function) +;; (xbindkey-function '(modifier* key) function-name-or-lambda-function) +;; +;; Other functions: +;; (remove-xbindkey key) +;; (run-command "foo-bar-command [args]") +;; (grab-all-keys) +;; (ungrab-all-keys) +;; (remove-all-keys) +;; (debug) + + +(xbindkey '(control shift q) "xbindkeys_show") + +(xbindkey '(mod4 F9) "mpc toggle") +(xbindkey '(mod4 F10) "mpc prev") +(xbindkey '(mod4 F11) "mpc next") +(xbindkey '(mod4 F12) "mpc stop") + +(xbindkey '(mod4 p) "dmenu_run -fn '-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*' -nb '#002b36' -nf '#fdf6e3' -sb '#586e75' -sf '#fdf6e3'") +(xbindkey '(mod4 shift T) "urxvtc") +(xbindkey '(mod4 shift E) "emacsclient -c") diff --git a/xmobarrc b/xmobarrc new file mode 100644 index 00000000..7dfcef22 --- /dev/null +++ b/xmobarrc @@ -0,0 +1,40 @@ +Config { font = "-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*" + , borderColor = "#657b83" + , border = TopB + , bgColor = "#002b36" + , fgColor = "#fdf6e3" + , position = Bottom + , lowerOnStart = False + , hideOnStart = False + , persistent = True + , commands = [ Run Weather "EGNX" ["-t", "ºC" + ,"-L", "12" + ,"-H", "18" + ,"--low", "lightblue" + ,"--normal", "green" + ,"--high", "red" + ] 36000 + , Run DynNetwork ["-t", "Net: ¦KB" + ,"-L", "512" + ,"-H", "10240" + ,"--low", "green" + ,"--normal", "yellow" + ,"--high", "red" + ,"-m", "5" + ] 5 + , Run Cpu ["-p", "3" + ,"-L", "3" + ,"-H", "50" + ,"--normal", "green" + ,"--high", "red" + ] 5 + , Run Memory ["-p", "3" + ,"-t", "Mem: %" + ] 20 + , Run Date "%a %b %_d %Y %H:%M:%S" "date" 10 + , Run MPD ["-t", ": - "] 10 + ] + , sepChar = "%" + , alignSep = "}{" + , template = "%cpu% | %memory% | %dynnetwork% | %mpd% }{ %EGNX% | %date%" + } diff --git a/xresources/main b/xresources/main new file mode 100644 index 00000000..d1b787dc --- /dev/null +++ b/xresources/main @@ -0,0 +1,32 @@ +#include "solarized-light" + +Xcursor.theme: Neutral +Xcursor.size: 22 + +URxvt.fading: 0 +URxvt.geometry: 100x40 +URxvt.urgentOnBell: true + +URxvt.scrollBar: false +URxvt.scrollstyle: plain +URxvt.scrollTtyOutput: false +URxvt.scrollWithBuffer: true +URxvt.scrollTtyKeypress: true +URxvt.saveLines: 16384 +URxvt.secondaryScroll: false + +URxvt.font: -xos4-terminus-medium-r-normal--14-140-72-72-c-80-*-* +URxvt.boldFont: -xos4-terminus-bold-r-normal--14-140-72-72-c-80-*-* + +URxvt.pointerBlank: true +URxvt.pointerBlankDelay: 987654321 +URxvt.letterSpace: 0 + +Emacs.ToolBar: off +Emacs.MenuBar: off +Emacs.ScrollBars: off +Emacs.CursorBlink: off + +Emacs.Font: -*-liberation mono-medium-*-*-*-*-110-*-*-*-*-*-* +Emacs.fixed-pitch.attributeFont: -*-liberation mono-medium-*-*-*-*-110-*-*-*-*-*-* +Emacs.variable-pitch.attributeFont: -*-liberation sans-medium-*-*-*-*-130-*-*-*-*-*-* diff --git a/xresources/prefect b/xresources/prefect new file mode 100644 index 00000000..c4c6a78c --- /dev/null +++ b/xresources/prefect @@ -0,0 +1 @@ +#include "main" diff --git a/xresources/solarized-light b/xresources/solarized-light new file mode 100644 index 00000000..0e59748d --- /dev/null +++ b/xresources/solarized-light @@ -0,0 +1,70 @@ +! Solarized color scheme for the X Window System +! +! http://ethanschoonover.com/solarized + + +! Common + +#define S_yellow #b58900 +#define S_orange #cb4b16 +#define S_red #dc322f +#define S_magenta #d33682 +#define S_violet #6c71c4 +#define S_blue #268bd2 +#define S_cyan #2aa198 +#define S_green #859900 + + +! Dark + +! #define S_base03 #002b36 +! #define S_base02 #073642 +! #define S_base01 #586e75 +! #define S_base00 #657b83 +! #define S_base0 #839496 +! #define S_base1 #93a1a1 +! #define S_base2 #eee8d5 +! #define S_base3 #fdf6e3 + + +! Light + +#define S_base03 #fdf6e3 +#define S_base02 #eee8d5 +#define S_base01 #93a1a1 +#define S_base00 #839496 +#define S_base0 #657b83 +#define S_base1 #586e75 +#define S_base2 #073642 +#define S_base3 #002b36 + + +! To only apply colors to your terminal, for example, prefix +! the color assignment statement with its name. Example: +! +! URxvt*background: S_base03 + +*background: S_base03 +*foreground: S_base0 +*fading: 40 +*fadeColor: S_base03 +*cursorColor: S_base1 +*pointerColorBackground: S_base01 +*pointerColorForeground: S_base1 + +*color0: S_base02 +*color1: S_red +*color2: S_green +*color3: S_yellow +*color4: S_blue +*color5: S_magenta +*color6: S_cyan +*color7: S_base2 +*color9: S_orange +*color8: S_base03 +*color10: S_base01 +*color11: S_base00 +*color12: S_base0 +*color13: S_violet +*color14: S_base1 +*color15: S_base3 diff --git a/zsh/completion/_tmux_pane_words b/zsh/completion/_tmux_pane_words new file mode 100644 index 00000000..6ff9ce18 --- /dev/null +++ b/zsh/completion/_tmux_pane_words @@ -0,0 +1,10 @@ +local expl +local -a w + +if [[ -z "$TMUX_PANE" ]]; then + _message "not running inside tmux!" + return 1 +fi + +w=( ${(u)=$(tmux capture-pane \; show-buffer \; delete-buffer)} ) +_wanted values expl 'words from current tmux pane' compadd -a w diff --git a/zsh/fasd.zsh b/zsh/fasd.zsh new file mode 100644 index 00000000..64dbf7b0 --- /dev/null +++ b/zsh/fasd.zsh @@ -0,0 +1,85 @@ +alias a='fasd -a' +alias s='fasd -si' +alias sd='fasd -sid' +alias sf='fasd -sif' +alias d='fasd -d' +alias f='fasd -f' +# function to execute built-in cd +fasd_cd() { + if [ $# -le 1 ]; then + fasd "$@" + else + local _fasd_ret="$(fasd -e 'printf %s' "$@")" + [ -z "$_fasd_ret" ] && return + [ -d "$_fasd_ret" ] && cd "$_fasd_ret" || printf %s\n "$_fasd_ret" + fi +} +alias z='fasd_cd -d' +alias zz='fasd_cd -d -i' + +# add zsh hook +_fasd_preexec() { + { eval "fasd --proc $(fasd --sanitize $1)"; } >> "/dev/null" 2>&1 +} +autoload -Uz add-zsh-hook +add-zsh-hook preexec _fasd_preexec + +# zsh command mode completion +_fasd_zsh_cmd_complete() { + local compl + read -c compl + (( $+compstate )) && compstate[insert]=menu # no expand if compsys loaded + reply=(${(f)"$(fasd --complete "$compl")"}) +} + +# enbale command mode completion +compctl -U -K _fasd_zsh_cmd_complete -V fasd -x 'C[-1,-*e],s[-]n[1,e]' -c - \ + 'c[-1,-A][-1,-D]' -f -- fasd fasd_cd + +(( $+functions[compdef] )) && { + # zsh word mode completion + _fasd_zsh_word_complete() { + [ "$2" ] && local _fasd_cur="$2" + [ -z "$_fasd_cur" ] && local _fasd_cur="${words[CURRENT]}" + local fnd="${_fasd_cur//,/ }" + local typ=${1:-e} + fasd --query $typ "$fnd" 2>> "/dev/null" | \ + sort -nr | sed 's/^[^ ]*[ ]*//' | while read -r line; do + compadd -U -V fasd "$line" + done + compstate[insert]=menu # no expand + } + _fasd_zsh_word_complete_f() { _fasd_zsh_word_complete f ; } + _fasd_zsh_word_complete_d() { _fasd_zsh_word_complete d ; } + _fasd_zsh_word_complete_trigger() { + local _fasd_cur="${words[CURRENT]}" + eval $(fasd --word-complete-trigger _fasd_zsh_word_complete $_fasd_cur) + } + # define zle widgets + zle -C fasd-complete complete-word _generic + zstyle ':completion:fasd-complete:*' completer _fasd_zsh_word_complete + zstyle ':completion:fasd-complete:*' menu-select + + zle -C fasd-complete-f complete-word _generic + zstyle ':completion:fasd-complete-f:*' completer _fasd_zsh_word_complete_f + zstyle ':completion:fasd-complete-f:*' menu-select + + zle -C fasd-complete-d complete-word _generic + zstyle ':completion:fasd-complete-d:*' completer _fasd_zsh_word_complete_d + zstyle ':completion:fasd-complete-d:*' menu-select +} + +(( $+functions[compdef] )) && { + # enable word mode completion + orig_comp="$(zstyle -L ':completion:\*' completer 2>> "/dev/null")" + if [ "$orig_comp" ]; then + case $orig_comp in + *_fasd_zsh_word_complete_trigger*);; + *) eval "$orig_comp _fasd_zsh_word_complete_trigger";; + esac + else + zstyle ':completion:*' completer _complete _fasd_zsh_word_complete_trigger + fi + unset orig_comp +} + diff --git a/zsh/fasdrc b/zsh/fasdrc new file mode 100644 index 00000000..efe6e0a3 --- /dev/null +++ b/zsh/fasdrc @@ -0,0 +1,9 @@ +# -*- mode: sh; -*- +current () { + for path in *; do + printf "./%s|1\\n" "$path" + done +} + +# If you want to have this behavior for all fasd queries +_FASD_BACKENDS="native current" diff --git a/zsh/functions/fasd/fasd b/zsh/functions/fasd/fasd new file mode 100644 index 00000000..b1e64f41 --- /dev/null +++ b/zsh/functions/fasd/fasd @@ -0,0 +1,624 @@ +#!/usr/bin/env sh + +# Fasd (this file) can be sourced or executed by any POSIX compatible shell. + +# Fasd is originally written based on code from z (https://github.com/rupa/z) +# by rupa deadwyler under the WTFPL license. Most if not all of the code has +# been rewritten. + +# Copyright (C) 2011, 2012 by Wei Dai. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +fasd() { + + # make zsh do word splitting inside this function + [ "$ZSH_VERSION" ] && emulate sh && setopt localoptions + + case $1 in + --init) shift + while [ "$1" ]; do + case $1 in + env) + { # source rc files if present + [ -s "/etc/fasdrc" ] && . "/etc/fasdrc" + [ -s "$HOME/.fasdrc" ] && . "$HOME/.fasdrc" + + # set default options + [ -z "$_FASD_DATA" ] && _FASD_DATA="$HOME/.fasd" + [ -z "$_FASD_BLACKLIST" ] && _FASD_BLACKLIST="--help" + [ -z "$_FASD_SHIFT" ] && _FASD_SHIFT="sudo busybox" + [ -z "$_FASD_IGNORE" ] && _FASD_IGNORE="fasd ls echo" + [ -z "$_FASD_SINK" ] && _FASD_SINK=/dev/null + [ -z "$_FASD_TRACK_PWD" ] && _FASD_TRACK_PWD=1 + [ -z "$_FASD_MAX" ] && _FASD_MAX=2000 + [ -z "$_FASD_BACKENDS" ] && _FASD_BACKENDS=native + [ -z "$_FASD_FUZZY" ] && _FASD_FUZZY=2 + [ -z "$_FASD_VIMINFO" ] && _FASD_VIMINFO="$HOME/.viminfo" + [ -z "$_FASD_RECENTLY_USED_XBEL" ] && \ + _FASD_RECENTLY_USED_XBEL="$HOME/.local/share/recently-used.xbel" + + if [ -z "$_FASD_AWK" ]; then + # awk preferences + local awk; for awk in mawk gawk original-awk nawk awk; do + $awk "" && _FASD_AWK=$awk && break + done + fi + } >> "${_FASD_SINK:-/dev/null}" 2>&1 + ;; + + auto) cat <> "$_FASD_SINK" 2>&1 + +EOS + ;; + + posix-alias) cat <& /dev/null || fasd -d'; +EOS + ;; + + zsh-hook) cat <> "$_FASD_SINK" 2>&1 +} +autoload -Uz add-zsh-hook +add-zsh-hook preexec _fasd_preexec + +EOS + ;; + + bash-hook) cat <> "$_FASD_SINK" 2>&1 +} + +# add bash hook +case \$PROMPT_COMMAND in + *_fasd_prompt_func*) ;; + *) PROMPT_COMMAND="_fasd_prompt_func;\$PROMPT_COMMAND";; +esac + +EOS + ;; + + posix-hook) cat <> "$_FASD_SINK" 2>&1 +} +case \$PS1 in + *_fasd_ps1_func*) ;; + *) export PS1="\\\$(_fasd_ps1_func)\$PS1";; +esac + +EOS + ;; + + tcsh-hook) cat <& /dev/null'; +EOS + + ;; + + zsh-ccomp) cat <> "$_FASD_SINK" | \\ + sort -nr | sed 's/^[^ ]*[ ]*//' | while read -r line; do + compadd -U -V fasd "\$line" + done + compstate[insert]=menu # no expand + } + _fasd_zsh_word_complete_f() { _fasd_zsh_word_complete f ; } + _fasd_zsh_word_complete_d() { _fasd_zsh_word_complete d ; } + _fasd_zsh_word_complete_trigger() { + local _fasd_cur="\${words[CURRENT]}" + eval \$(fasd --word-complete-trigger _fasd_zsh_word_complete \$_fasd_cur) + } + # define zle widgets + zle -C fasd-complete complete-word _generic + zstyle ':completion:fasd-complete:*' completer _fasd_zsh_word_complete + zstyle ':completion:fasd-complete:*' menu-select + + zle -C fasd-complete-f complete-word _generic + zstyle ':completion:fasd-complete-f:*' completer _fasd_zsh_word_complete_f + zstyle ':completion:fasd-complete-f:*' menu-select + + zle -C fasd-complete-d complete-word _generic + zstyle ':completion:fasd-complete-d:*' completer _fasd_zsh_word_complete_d + zstyle ':completion:fasd-complete-d:*' menu-select +} + +EOS + ;; + + zsh-ccomp-install) cat <> "$_FASD_SINK" | sed -n "\\\$s/^.*'\\\\(.*\\\\)'/\\\\1/p") + \${COMP_LINE#* }" | while read -r line; do + quote_readline "\$line" 2>/dev/null || \\ + printf %q "\$line" 2>/dev/null && \\ + printf \\\\n + done) + local IFS=\$'\\n'; COMPREPLY=( \$RESULT ) +} +_fasd_bash_hook_cmd_complete() { + for cmd in \$*; do + complete -F _fasd_bash_cmd_complete \$cmd + done +} + +EOS + ;; + + bash-ccomp-install) cat <$`{}]\{1,\}/\1 /g' + ;; + + --proc) shift # process commands + # stop if we don't own $_FASD_DATA or $_FASD_RO is set + [ -f "$_FASD_DATA" -a ! -O "$_FASD_DATA" ] || [ "$_FASD_RO" ] && return + + # blacklists + local each; for each in $_FASD_BLACKLIST; do + case " $* " in *\ $each\ *) return;; esac + done + + # shifts + while true; do + case " $_FASD_SHIFT " in + *\ $1\ *) shift;; + *) break;; + esac + done + + # ignores + case " $_FASD_IGNORE " in + *\ $1\ *) return;; + esac + + shift; fasd --add "$@" # add all arguments except command + ;; + + --add|-A) shift # add entries + # stop if we don't own $_FASD_DATA or $_FASD_RO is set + [ -f "$_FASD_DATA" -a ! -O "$_FASD_DATA" ] || [ "$_FASD_RO" ] && return + + # find all valid path arguments, convert them to simplest absolute form + local paths="$(while [ "$1" ]; do + [ -e "$1" ] && printf %s\\n "$1"; shift + done | sed '/^[^/]/s@^@'"$PWD"'/@ + s@/\.\.$@/../@;s@/\(\./\)\{1,\}@/@g;:0 + s@[^/][^/]*//*\.\./@/@;t 0 + s@^/*\.\./@/@;s@//*@/@g;s@/\.\{0,1\}$@@;s@^$@/@' 2>> "$_FASD_SINK" \ + | tr '\n' '|')" + + # add current pwd if the option is set + [ "$_FASD_TRACK_PWD" = "1" -a "$PWD" != "$HOME" ] && paths="$paths|$PWD" + + [ -z "${paths##\|}" ] && return # stop if we have nothing to add + + # maintain the file + local tempfile + tempfile="$(mktemp "$_FASD_DATA".XXXXXX)" || return + $_FASD_AWK -v list="$paths" -v now="$(date +%s)" -v max="$_FASD_MAX" -F"|" ' + BEGIN { + split(list, files, "|") + for(i in files) { + path = files[i] + if(path == "") continue + paths[path] = path # array for checking + rank[path] = 1 + time[path] = now + } + } + $2 >= 1 { + if($1 in paths) { + rank[$1] = $2 + 1 / $2 + time[$1] = now + } else { + rank[$1] = $2 + time[$1] = $3 + } + count += $2 + } + END { + if(count > max) + for(i in rank) print i "|" 0.9*rank[i] "|" time[i] # aging + else + for(i in rank) print i "|" rank[i] "|" time[i] + }' "$_FASD_DATA" 2>> "$_FASD_SINK" >| "$tempfile" + if [ $? -ne 0 -a -f "$_FASD_DATA" ]; then + env rm -f "$tempfile" + else + env mv -f "$tempfile" "$_FASD_DATA" + fi + ;; + + --delete|-D) shift # delete entries + # stop if we don't own $_FASD_DATA or $_FASD_RO is set + [ -f "$_FASD_DATA" -a ! -O "$_FASD_DATA" ] || [ "$_FASD_RO" ] && return + + # turn valid arguments into entry-deleting sed commands + local sed_cmd="$(while [ "$1" ]; do printf %s\\n "$1"; shift; done | \ + sed '/^[^/]/s@^@'"$PWD"'/@;s@/\.\.$@/../@;s@/\(\./\)\{1,\}@/@g;:0 + s@[^/][^/]*//*\.\./@/@;t 0 + s@^/*\.\./@/@;s@//*@/@g;s@/\.\{0,1\}$@@ + s@^$@/@;s@\([.[\/*^$]\)@\\\1@g;s@^\(.*\)$@/^\1|/d@' 2>> "$_FASD_SINK")" + + # maintain the file + local tempfile + tempfile="$(mktemp "$_FASD_DATA".XXXXXX)" || return + + sed "$sed_cmd" "$_FASD_DATA" 2>> "$_FASD_SINK" >| "$tempfile" + + if [ $? -ne 0 -a -f "$_FASD_DATA" ]; then + env rm -f "$tempfile" + else + env mv -f "$tempfile" "$_FASD_DATA" + fi + ;; + + --query) shift # query the db, --query [$typ ["$fnd" [$mode]]] + [ -f "$_FASD_DATA" ] || return # no db yet + [ "$1" ] && local typ="$1" + [ "$2" ] && local fnd="$2" + [ "$3" ] && local mode="$3" + + # cat all backends + local each _fasd_data; for each in $_FASD_BACKENDS; do + _fasd_data="$_fasd_data +$(fasd --backend $each)" + done + [ "$_fasd_data" ] || _fasd_data="$(cat "$_FASD_DATA")" + + # set mode specific code for calculating the prior + case $mode in + rank) local prior='times[i]';; + recent) local prior='sqrt(100000/(1+t-la[i]))';; + *) local prior='times[i] * frecent(la[i])';; + esac + + if [ "$fnd" ]; then # dafault matching + local bre="$(printf %s\\n "$fnd" | sed 's/\([*\.\\\[]\)/\\\1/g + s@ @[^|]*@g;s/\$$/|/')" + bre='^[^|]*'"$bre"'[^|/]*|' + local _ret="$(printf %s\\n "$_fasd_data" | grep "$bre")" + [ "$_ret" ] && _ret="$(printf %s\\n "$_ret" | while read -r line; do + [ -${typ:-e} "${line%%\|*}" ] && printf %s\\n "$line" + done)" + if [ "$_ret" ]; then + _fasd_data="$_ret" + else # no case mathcing + _ret="$(printf %s\\n "$_fasd_data" | grep -i "$bre")" + [ "$_ret" ] && _ret="$(printf %s\\n "$_ret" | while read -r line; do + [ -${typ:-e} "${line%%\|*}" ] && printf %s\\n "$line" + done)" + if [ "$_ret" ]; then + _fasd_data="$_ret" + elif [ "${_FASD_FUZZY:-0}" -gt 0 ]; then # fuzzy matching + local fuzzy_bre="$(printf %s\\n "$fnd" | \ + sed 's/\([*\.\\\[]\)/\\\1/g;s/\$$/|/ + s@\(\\\{0,1\}[^ ]\)@\1[^|/]\\{0,'"$_FASD_FUZZY"'\\}@g + s@ @[^|]*@g')" + fuzzy_bre='^[^|]*'"$fuzzy_bre"'[^|/]*|' + _ret="$(printf %s\\n "$_fasd_data" | grep -i "$fuzzy_bre")" + [ "$_ret" ] && _ret="$(printf %s\\n "$_ret" | while read -r line; do + [ -${typ:-e} "${line%%\|*}" ] && printf %s\\n "$line" + done)" + [ "$_ret" ] && _fasd_data="$_ret" || _fasd_data= + fi + fi + else # no query arugments + _fasd_data="$(printf %s\\n "$_fasd_data" | while read -r line; do + [ -${typ:-e} "${line%%\|*}" ] && printf %s\\n "$line" + done)" + fi + + # query the database + [ "$_fasd_data" ] && printf %s\\n "$_fasd_data" | \ + $_FASD_AWK -v t="$(date +%s)" -F"|" ' + function frecent(time) { + dx = t-time + if( dx < 3600 ) return 6 + if( dx < 86400 ) return 4 + if( dx < 604800 ) return 2 + return 1 + } + { + if(!paths[$1]) { + times[$1] = $2 + la[$1] = $3 + paths[$1] = 1 + } else { + times[$1] += $2 + if($3 > la[$1]) la[$1] = $3 + } + } + END { + for(i in paths) printf "%-10s %s\n", '"$prior"', i + }' - 2>> "$_FASD_SINK" + ;; + + --backend) + case $2 in + native) cat "$_FASD_DATA";; + viminfo) + < "$_FASD_VIMINFO" sed -n '/^>/{s@~@'"$HOME"'@ + s/^..// + p + }' | $_FASD_AWK -v t="$(date +%s)" '{ + t -= 60 + print $0 "|1|" t + }' + ;; + recently-used) + local nl="$(printf '\\\nX')"; nl="${nl%X}" # slash newline for sed + tr -d '\n' < "$_FASD_RECENTLY_USED_XBEL" | \ + sed 's@file:/@'"$nl"'@g;s@count="@'"$nl"'@g' | sed '1d;s/".*$//' | \ + tr '\n' '|' | sed 's@|/@'"$nl"'@g' | $_FASD_AWK -F'|' '{ + sum = 0 + for( i=2; i<=NF; i++ ) sum += $i + print $1 "|" sum + }' + ;; + *) eval "$2";; + esac + ;; + + *) # parsing logic and processing + local fnd= last= _FASD_BACKENDS="$_FASD_BACKENDS" _fasd_data= comp= exec= + while [ "$1" ]; do case $1 in + --complete) [ "$2" = "--" ] && shift; set -- $2; local lst=1 r=r comp=1;; + --query|--add|--delete|-A|-D) fasd "$@"; return $?;; + --version) [ -z "$comp" ] && echo "1.0.1" && return;; + --) while [ "$2" ]; do shift; fnd="$fnd $1"; last="$1"; done;; + -*) local o="${1#-}"; while [ "$o" ]; do case $o in + s*) local show=1;; + l*) local lst=1;; + i*) [ -z "$comp" ] && local interactive=1 show=1;; + r*) local mode=rank;; + t*) local mode=recent;; + e*) o="${o#?}"; if [ "$o" ]; then # there are characters after "-e" + local exec="$o" # anything after "-e" + else # use the next argument + local exec="${2:?"-e: Argument needed "}" + shift + fi; break;; + b*) o="${o#?}"; if [ "$o" ]; then + _FASD_BACKENDS="$o" + else + _FASD_BACKENDS="${2:?"-b: Argument needed"}" + shift + fi; break;; + B*) o="${o#?}"; if [ "$o" ]; then + _FASD_BACKENDS="$_FASD_BACKENDS $o" + else + _FASD_BACKENDS="$_FASD_BACKENDS ${2:?"-B: Argument needed"}" + shift + fi; break;; + a*) local typ=e;; + d*) local typ=d;; + f*) local typ=f;; + R*) local r=r;; + [0-9]*) local _fasd_i="$o"; break;; + h*) [ -z "$comp" ] && echo "fasd [options] [query ...] +[f|a|s|d|z] [options] [query ...] + options: + -s list paths with scores + -l list paths without scores + -i interactive mode + -e set command to execute on the result file + -b only use backend + -B add additional backend + -a match files and directories + -d match directories only + -f match files only + -r match by rank only + -t match by recent access only + -R reverse listing order + -h show a brief help message + -[0-9] select the nth entry + +fasd [-A|-D] [paths ...] + -A add paths + -D delete paths" >&2 && return;; + esac; o="${o#?}"; done;; + *) fnd="$fnd $1"; last="$1";; + esac; shift; done + + # guess whether the last query is selected from tab completion + case $last in + /?*) if [ -z "$show$lst" -a -${typ:-e} "$last" -a "$exec" ]; then + $exec "$last" + return + fi;; + esac + + local R; [ -z "$r" ] && R=r || R= # let $R be the opposite of $r + fnd="${fnd# }" + + local res + res="$(fasd --query 2>> "$_FASD_SINK")" # query the database + [ $? -gt 0 ] && return + if [ 0 -lt ${_fasd_i:-0} ] 2>> "$_FASD_SINK"; then + res="$(printf %s\\n "$res" | sort -n${R} | \ + sed -n "$_fasd_i"'s/^[^ ]*[ ]*//p')" + elif [ "$interactive" ] || [ "$exec" -a -z "$fnd$lst$show" -a -t 1 ]; then + if [ "$(printf %s "$res" | sed -n '$=')" -gt 1 ]; then + res="$(printf %s\\n "$res" | sort -n${R})" + printf %s\\n "$res" | sed = | sed 'N;s/\n/ /' | sort -nr >&2 + printf "> " >&2 + local i; read i; [ 0 -lt "${i:-0}" ] 2>> "$_FASD_SINK" || return 1 + fi + res="$(printf %s\\n "$res" | sed -n "${i:-1}"'s/^[^ ]*[ ]*//p')" + elif [ "$lst" ]; then + [ "$res" ] && printf %s\\n "$res" | sort -n${r} | sed 's/^[^ ]*[ ]*//' + return + elif [ "$show" ]; then + [ "$res" ] && printf %s\\n "$res" | sort -n${r} + return + elif [ "$fnd" ] && [ "$exec" -o ! -t 1 ]; then # exec or subshell + res="$(printf %s\\n "$res" | sort -n | sed -n '$s/^[^ ]*[ ]*//p')" + else # no args, show + [ "$res" ] && printf %s\\n "$res" | sort -n${r} + return + fi + if [ "$res" ]; then + fasd --add "$res" + [ -z "$exec" ] && exec='printf %s\n' + $exec "$res" + fi + ;; + esac +} + +fasd --init env + +case $- in + *i*) ;; # assume being sourced, do nothing + *) # assume being executed as an executable + if [ -x "$_FASD_SHELL" -a -z "$_FASD_SET" ]; then + _FASD_SET=1 exec $_FASD_SHELL "$0" "$@" + else + fasd "$@" + fi;; +esac + diff --git a/zsh/functions/runit/_sv b/zsh/functions/runit/_sv new file mode 100644 index 00000000..bf98b3ea --- /dev/null +++ b/zsh/functions/runit/_sv @@ -0,0 +1,7 @@ +#compdef sv + +_arguments -A -S -s \ + '-v[wait up to 7 seconds for the command to take effect. (up|down|term|once|cont|exit)]' \ + '-w+[wait for %n seconds]: :_guard "[0-9]#" "numeric value"' \ + '1:command:(status up down once pause cont hup alarm interrupt quit 1 2 term kill exit start stop restart shutdown force-stop force-reload force-restart force-shutdown check)' \ + '*:installed service:_files -W ${SVDIR:-/service}' diff --git a/zsh/functions/runit/getservicedir b/zsh/functions/runit/getservicedir new file mode 100644 index 00000000..2e5d961c --- /dev/null +++ b/zsh/functions/runit/getservicedir @@ -0,0 +1,2 @@ +#!/usr/bin/env zsh +print ${$(readlink ${SVDIR:-/service}/$1):h} \ No newline at end of file diff --git a/zsh/functions/runit/linksv b/zsh/functions/runit/linksv new file mode 100644 index 00000000..7ee71094 --- /dev/null +++ b/zsh/functions/runit/linksv @@ -0,0 +1,16 @@ +#!/usr/bin/env zsh + +if [[ -z $1 ]]; then + echo "No service specified" + return 64 +fi + + +if [[ ! -x $1 ]]; then + echo "Service does not exist in current directory" + return 1 +fi + +mv $1{,.old} +ln -s =sv $1 +chmod -h a-w $1 diff --git a/zsh/functions/runit/renamesv b/zsh/functions/runit/renamesv new file mode 100644 index 00000000..dba1098d --- /dev/null +++ b/zsh/functions/runit/renamesv @@ -0,0 +1,36 @@ +#!/usr/bin/env zsh +local svdir=${SVDIR:-/service} +if [[ -z $1 || -z $2 ]]; then + echo "Usage: $0 source target" + return 64 +fi + +if [[ ! -h $svdir/$1 ]]; then + echo $svdir/$1 does not exist + return 2 +fi + +if [[ -e $svdir/$2 ]]; then + echo $svdir/$2 already exists + return 3 +fi + +local servicedir=`getservicedir` + +if [[ ! ( -w $svdir && -w $servicedir ) ]]; then + echo $svdir or $servicedir is not writeable +fi + +# The service doesn't have to be stopped as removing the link will do that +# However, running the same service twice isn't a great idea, so wait here +sv stop $1 + +rm -f $svdir/$1 || return + +mv $servicedir/{$1,$2} || return + +ln -s {$servicedir,$svdir}/$2 || return + +sv start $2 + +return diff --git a/zsh/zshrc b/zsh/zshrc new file mode 100755 index 00000000..7d8915bb --- /dev/null +++ b/zsh/zshrc @@ -0,0 +1,367 @@ +#!/usr/bin/env zsh +# +# System variables +# + +if [[ $defpath == "" && -d ~/bin ]] +then + defpath=($path) + path=( + $defpath + ~/bin + ) +fi + +if [[ ! -d ~/.zsh/cache ]] +then + mkdir -p ~/.zsh/cache +fi + +myfuncs=( ~alan/dotfiles/zsh/functions/*(/) ) +fpath=( + $myfuncs + ~alan/dotfiles/zsh/completion/ + $fpath +) + +export PATH +export PAGER="less" +export CLICOLOR=true + +# +# zsh variables +# +HISTFILE=~/.zsh/history +HISTSIZE=4000 +SAVEHIST=3000 + +WORDCHARS='*?_-[]~=.&;!#$%^(){}<>' + +#If a command takes more than 5 seconds, give statistics +REPORTTIME=5 +TIMEFMT="%U user %S system %P cpu %*Es total" + +#Check for user logins +watch=notme +WATCHFMT="%n has %a %l from %M at %t" + +hosts=( + server + prefect + alanpearce.co.uk + home.alanpearce.co.uk + lethalrocks.uk.to + alphapulsar.uk.to + st.alphapulsar.uk.to + a.st.alphapulsar.uk.to + st +) + +users=(alan root toor) + +function linkAuthSock () { + local linkSock=~/.ssh/ssh_auth_sock + ln -sf $1 ~/.ssh/ssh_auth_sock + export SSH_AUTH_SOCK=$linkSock +} + +if [[ "$SSH_AUTH_SOCK" != "" ]] +then + if [[ -e ~/.ssh/ssh_auth_sock && ! -L ~/.ssh/ssh_auth_sock ]] + then + linkAuthSock $SSH_AUTH_SOCK + fi +fi + +if [[ "$OSTYPE" == *gnu* ]] +then + eval `dircolors -b` #exports LSCOLORS + ls_options="-v --group-directories-first --color=auto" + ls_isodate="--time-style=long-iso" +elif [[ "$OSTYPE" == freebsd* ]] +then + freebsd=1 + ls_options="-p" + ls_isodate="-D '%F %k:%M'" +fi + +#Ignore suffixes in completion +fignore=( + svbin +) + +# +# Modules +# +autoload -Uz compinit bashcompinit +autoload -U colors complist zrecompile zmv zargs zed +autoload -Uz vcs_info +autoload insert-files +zle -N insert-files +zmodload -i zsh/complist +colors +compinit -d .zsh/cache/compdump +bashcompinit + +zstyle :compinstall filename '/home/alan/.zshrc' + +autoload -Uz _tmux_pane_words +zle -C tmux-pane-words-prefix complete-word _generic +zle -C tmux-pane-words-anywhere complete-word _generic +zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' completer _tmux_pane_words +zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' ignore-line current +zstyle ':completion:tmux-pane-words-anywhere:*' matcher-list 'b:=* m:{A-Za-z}={a-zA-Z}' + +# Speed up completion by not going further than a full match +zstyle ':completion:*' accept-exact '*(N)' + +zstyle ':completion:*:default' use-cache on +zstyle ':completion:*:default' cache-path ~/.zsh/cache/compcache + +zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' '+m:{A-Z}={a-z}' +zstyle ':completion:*' completer _oldlist _expand _force_rehash _complete _match + +zstyle ':completion:*' verbose yes +zstyle ':completion:*:messages' format '%d' +zstyle ':completion:*:warnings' format 'No matches for: %d' +zstyle ':completion:*:descriptions' format '%U%B%d%b%u' +zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b' +zstyle ':completion:*' group-name '' + +# Complete all user processes +zstyle ':completion:*:processes' command 'ps -au$USER' +# Add colour to process lists +zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' +zstyle ':completion:*:*:kill:*' menu yes select +zstyle ':completion:*:kill:*' force-list always +zstyle ':completion:*:*:killall:*' menu yes select +zstyle ':completion:*:killall:*' force-list always + +# Complete unreadable log filenames +#zstyle ':completion::complete:(most|tail)::' fake-files '/var/log/*:current' + +# Group manpages by section +zstyle ':completion:*' separate-sections true + +# Users +#zstyle '*' users $users + +zstyle '*' hosts $hosts + +zstyle ':completion:*:functions' ignored-patterns '_*' +zstyle ':completion:*:cd:*' ignore-parents parent pwd + +#This works, but isn't the same as ls +#zstyle ':completion:*:default' list-colors '' +zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} + +zstyle ':vcs_info:*' enable git hg + +# Filename suffixes to ignore during completion (except after rm command) +zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' '*?.old' '*?.pro' + +## Prompt +if [[ $term = "putty" ]];then + prompt_char="›" +else + prompt_char=">" +fi + +PS1="%B%~%(!.%{$fg[red]%}.%{$fg[green]%})$prompt_char%f%b " + +# Options + +# Changing directories +setopt auto_cd + +# Completion +setopt auto_list # List multiple choices on first tab +unsetopt list_ambiguous # List ambiguous choices rather than completing common prefixes +unsetopt list_beep # Don't try to beep here +setopt list_types # Indicate file types + +# Expansion and globbing +setopt extended_glob # Use #~^ as part of filename patterns +unsetopt nomatch + +# History +unsetopt hist_beep +setopt hist_expire_dups_first +setopt hist_fcntl_lock # Use standard locking on histfile +setopt hist_find_no_dups +setopt hist_ignore_space +setopt hist_reduce_blanks +setopt hist_verify +setopt inc_append_history + +# Input/Output +unsetopt clobber +unsetopt flow_control +setopt path_dirs # Search PATH even with slashes +setopt print_exit_value + +# Job Control +setopt auto_continue +unsetopt nohup +setopt long_list_jobs +unsetopt notify + +# Scripts and functions +unsetopt multi_func_def +setopt multios + +# Zle +unsetopt beep + +############ +# Keybinds # +############ +#KiTTY +bindkey "OD" backward-word +bindkey "OC" forward-word + +#General +bindkey "[1~" beginning-of-line +bindkey "[4~" end-of-line +bindkey "[5~" beginning-of-history +bindkey "[6~" end-of-history +bindkey "[2~" quoted-insert +bindkey "[3~" delete-char + +bindkey '' backward-delete-char + +bindkey '^I' expand-or-complete-prefix +bindkey '' reverse-menu-complete +bindkey '' up-line-or-search +bindkey '' down-line-or-search + +#urxvt +bindkey '[3;5~' delete-word +bindkey '' backward-word +bindkey '' forward-word + +bindkey 'f' insert-files +bindkey 'd' describe-key-briefly + +bindkey '\' tmux-pane-words-prefix +bindkey '|' tmux-pane-words-anywhere + +# Aliases before functions +alias getcflags='gcc -\#\#\# -march=native -E /usr/include/stdlib.h 2>&1 | grep "/usr/libexec/gcc/.*cc1"' +alias grep='grep --color=auto' +alias df='df -h' +alias du='du -h' +alias md='mkdir -p' +alias rd='rmdir' +alias .='source' + +alias l="\ls ${ls_options} -Bp" +alias l1="\ls ${ls_options} -1" +alias ls="\ls ${ls_options} -hF" +alias la="\ls ${ls_options} -hA" +alias ll="\ls ${ls_options} ${ls_isodate} -hl" +alias lal="ll -A" +alias lla="lal" +alias llr="ll -t" +alias gpp='g++' +alias lsr="ls -tld *(m-2)" # mtime < -2days + +alias trans="transmission-remote transmission.home" +alias bitcoin="bitcoind" +alias namecoin="~alan/applications/namecoin/src/namecoind" +alias e="$EDITOR" +alias E="SUDO_EDITOR=\emacsclient -c -a emacs\" sudoedit" +alias aticonfig="DISPLAY=:0 \aticonfig" +alias wprop="xprop | egrep WM_(CLASS|NAME|WINDOW_ROLE|TYPE)" + +alias -g ...='../..' + +#Suffix aliases +alias -s log=less + +if [[ -e =hub ]]; then + alias git="hub" +fi + +# Functions + +precmd () { + [[ -t 1 ]] || return + case $TERM in + *xterm*|rxvt|putty|(dt|k|E)term|screen*) print -Pn "\e]2;%~\a" + ;; + esac +} + +pid () { + local i + for i in /proc/<->/stat + [[ "$(< $i)" = *\((${(j:|:)~@})\)* ]] && echo $i:h:t + return 0 +} + +_force_rehash() { + (( CURRENT == 1 )) && rehash + return 1 # Because we didn't really complete anything +} + +portgrep() { + sudo lsof -i :$1 -nP | egrep '(LISTEN|UDP|COMMAND)' +} + +ipgrep() { + sudo lsof -i @$1 -nP +} + +smart_sudo () { + if [[ -n $1 ]]; then + \sudo $argv + else + #if no parameters were given, then assume we want a root shell + \sudo -i -u toor + fi +} + +compdef _sudo smart_sudo + +smart_compile () { + local zcompargs + if [[ $1 = *zshrc* ]]; then + zcompargs="-R" + fi + + if [[ $EUID -ne 0 || $1 != *alan* ]]; then + zrecompile -q -p $zcompargs $1 + fi + if [[ -n $2 ]]; then + . $1 + fi +} + +host=${HOST%%.*} +if [[ -e ~alan/dotfiles/zsh/zshrc_$host ]]; then + # Don't recompile as toor|root + smart_compile ~alan/dotfiles/zsh/zshrc_$host 1 +fi +if [[ -e /usr/bin/emerge ]]; then + smart_compile ~alan/dotfiles/zsh/zshrc_gentoo 1 +elif [[ $freebsd -eq 1 ]]; then + smart_compile ~alan/dotfiles/zsh/zshrc_freebsd 1 +fi + +for fp in $myfuncs; do + zrecompile -p $fp $fp/* +done + +_FASD_DATA="$HOME/.zsh/fasd-data" +fasd_cache="$HOME/.zsh/cache/fasd-init-zsh" +autoload -U fasd +if [[ ! -s "$fasd_cache" || ~alan/dotfiles/zsh/functions/fasd -nt "$fasd_cache" ]]; then + fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache" +fi +smart_compile "$fasd_cache" 1 +unset fasd_cache +alias e="f -e $EDITOR" + +smart_compile ~/.zshrc +alias s="smart_sudo " diff --git a/zsh/zshrc_freebsd b/zsh/zshrc_freebsd new file mode 100755 index 00000000..62612611 --- /dev/null +++ b/zsh/zshrc_freebsd @@ -0,0 +1,8 @@ +#!/usr/bin/env zsh +function update-check () { + sudo portsnap update + sudo portmaster -L --index-only | awk '/ [Nn]ew / { print substr($0,9,9999) }' + sudo portaudit -Fa -X 1 + pkg_updating -d $( ls -ltr -D '%Y%m%d' /var/db/pkg | awk 'END{print $6}' ) +} +alias iotop="top -m io -o total" diff --git a/zsh/zshrc_gentoo b/zsh/zshrc_gentoo new file mode 100644 index 00000000..7af53466 --- /dev/null +++ b/zsh/zshrc_gentoo @@ -0,0 +1,4 @@ +#Distributed merge +dmerge () { + MAKEOPTS='-j10' FEATURES='ccache distcc' emerge "$@" +} \ No newline at end of file diff --git a/zsh/zshrc_prefect b/zsh/zshrc_prefect new file mode 100644 index 00000000..e86b955b --- /dev/null +++ b/zsh/zshrc_prefect @@ -0,0 +1,8 @@ +EDITOR="emacs" +VISUAL="emacs" + +if [[ ! -S $SSH_AUTH_SOCK ]] +then + eval `ssh-agent | sed -e '/^echo/d'` + linkAuthSock $SSH_AUTH_SOCK +fi diff --git a/zsh/zshrc_server b/zsh/zshrc_server new file mode 100644 index 00000000..d9d74219 --- /dev/null +++ b/zsh/zshrc_server @@ -0,0 +1,20 @@ +# -*- shell-script -*- + +export SVDIR=/service +if [[ "$EUID" == "0" ]] || [[ "$USER" == "root" ]] +then + export EDITOR="emacs -nw" +else + export ALTERNATE_EDITOR="emacs" + export EDITOR="emacsclient" +fi + +mailpath= + +# Folder aliases +hash -d music=/tank/media/Music + +zstyle ':completion:*' local server /tank/www/internal '' +zstyle ':completion:*' local external /tank/www/external +zstyle ':completion:*' local alphapulsar.uk.to /tank/www/gaming +zstyle ':completion:*' local home.alanpearce.co.uk /tank/www/external diff --git a/zsh/zshrc_sheldon b/zsh/zshrc_sheldon new file mode 100644 index 00000000..6168baee --- /dev/null +++ b/zsh/zshrc_sheldon @@ -0,0 +1,5 @@ +if [[ ! -S $SSH_AUTH_SOCK ]] +then + eval `ssh-agent | sed -e '/^echo/d'` + linkAuthSock $SSH_AUTH_SOCK +fi diff --git a/zsh/zshrc_st b/zsh/zshrc_st new file mode 100644 index 00000000..a449ef92 --- /dev/null +++ b/zsh/zshrc_st @@ -0,0 +1,2 @@ +hash -d tf=/opt/steam/orangebox/tf +hash -d sv=/etc/sv/tf2 \ No newline at end of file -- cgit 1.4.1 From 492a97cbdd163f26678c85fd693835a27e0a0b4f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 29 Apr 2013 12:05:47 +0100 Subject: Emacs: Add el-get-dir to load-path --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index d011945f..b3553c32 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -29,6 +29,7 @@ (directory-files *el-get-dir*)))) (if (file-exists-p (concat *el-get-dir* "el-get")) + (add-to-list 'load-path *el-get-dir*) (add-subdirs-to-load-path *el-get-dir*) (unless (require 'el-get nil t) (with-current-buffer -- cgit 1.4.1 From 013d5edee83289778828c39a1efd43b19843bde6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 29 Apr 2013 13:30:03 +0100 Subject: Emacs: workaround mumamo buffer-local-vars warnings --- emacs/init.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index b3553c32..577791d7 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -989,6 +989,13 @@ Works with: arglist-cont-nonempty, arglist-close." nxhtml-autoload-web nil) (nxhtml-menu-mode 0))) +(when (and (equal emacs-major-version 24) + (equal emacs-minor-version 2)) + (use-package "mumamo" + :defer t + :config (progn (setq mumamo-per-buffer-local-vars + (delq 'buffer-file-name mumamo-per-buffer-local-vars))))) + (use-package php-mode :mode ("\\.php\\'" . php-mode) :config (progn -- cgit 1.4.1 From 9499ba6479c2327f9dd5934d4363b7208d448e3d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 29 Apr 2013 15:12:52 +0100 Subject: Emacs: choose magit extensions based upon git configuration --- emacs/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 577791d7..2953cdff 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -662,7 +662,8 @@ Also returns nil if pid is nil." (use-package magit :commands (magit-status) - :bind (("C-x g" . magit-status))) + :bind (("C-x g" . magit-status)) + :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) ;;;; Spelling (setq ispell-program-name "aspell" -- cgit 1.4.1 From 3d6840199625a81cd5c86ed815909f48dd928d87 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 29 Apr 2013 19:17:34 +0100 Subject: Git: initial configuration --- gitconfig | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 gitconfig diff --git a/gitconfig b/gitconfig new file mode 100644 index 00000000..7e6c1783 --- /dev/null +++ b/gitconfig @@ -0,0 +1,21 @@ +[user] + email = alan@alanpearce.co.uk +[color] + branch = auto + diff = auto + status = auto + ui = true +[push] + default = simple +[alias] + st = status -sb + ci = commit + br = branch + co = checkout + ready = rebase -i @{u} + lg = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' + standup = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --since yesterday --author alan + purr = pull --rebase + ignored = ls-files --others -i --exclude-standard +[github] + user = alan@alanpearce.co.uk \ No newline at end of file -- cgit 1.4.1 From fe0c6cc671c9f8f2489f268856fbe98e2d759427 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 29 Apr 2013 22:13:23 +0100 Subject: Emacs: setup mu4e --- emacs/init.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 2953cdff..7f6c8731 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -271,6 +271,17 @@ (add-to-list 'erc-modules 'autojoin) (add-to-list 'erc-modules 'match))) +(setq message-send-mail-function 'smtpmail-send-it) +(setq smtpmail-smtp-server "external.home") + +(use-package mu4e + :load-path "/usr/share/emacs/site-lisp/mu4e" + :config (progn + (setq mu4e-get-mail-command "true" + mu4e-sent-folder "/alanpearce/Sent" + mu4e-drafts-folder "/alanpearce/Drafts" + mu4e-refile-folder "/alanpearce/Archive"))) + ;;;; Completion (setq completion-styles '(basic initials partial-completion substring) -- cgit 1.4.1 From 353a43e2df0b68b37415167ccd2b1b0af369ea11 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 2 May 2013 09:05:57 +0100 Subject: zsh: New version of wprop alias to make class and instance names clearer --- zsh/zshrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zsh/zshrc b/zsh/zshrc index 7d8915bb..5aba1abf 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -272,7 +272,9 @@ alias namecoin="~alan/applications/namecoin/src/namecoind" alias e="$EDITOR" alias E="SUDO_EDITOR=\emacsclient -c -a emacs\" sudoedit" alias aticonfig="DISPLAY=:0 \aticonfig" -alias wprop="xprop | egrep WM_(CLASS|NAME|WINDOW_ROLE|TYPE)" +alias wprop='xprop |awk '\'' + /^WM_CLASS/{sub(/.* =/, "instance:"); sub(/,/, "\nclass:"); print} + /^WM_NAME/{sub(/.* =/, "title:"); print}'\''' alias -g ...='../..' -- cgit 1.4.1 From 15c8da711e990317782d4e29a66c4f8c3a8e401c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 2 May 2013 09:08:16 +0100 Subject: Git: Add my name. --- gitconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/gitconfig b/gitconfig index 7e6c1783..90115291 100644 --- a/gitconfig +++ b/gitconfig @@ -1,5 +1,6 @@ [user] email = alan@alanpearce.co.uk + name = Alan Pearce [color] branch = auto diff = auto -- cgit 1.4.1 From d45621219fb0a77122e374af69855b0068f2c45d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 2 May 2013 09:08:50 +0100 Subject: Git: remove purr alias; rebasing is confusing --- gitconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/gitconfig b/gitconfig index 90115291..74d13ecb 100644 --- a/gitconfig +++ b/gitconfig @@ -16,7 +16,6 @@ ready = rebase -i @{u} lg = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' standup = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --since yesterday --author alan - purr = pull --rebase ignored = ls-files --others -i --exclude-standard [github] user = alan@alanpearce.co.uk \ No newline at end of file -- cgit 1.4.1 From 72e2c1dfc5d880f65eb6935133880f122dbca9fd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 3 May 2013 09:04:33 +0100 Subject: Emacs: fix logic error in setting up load-path --- emacs/init.el | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 7f6c8731..f3277b13 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -26,11 +26,11 @@ (if (and (not (string-prefix-p "." file)) (file-directory-p full-path)) (add-to-list 'load-path full-path)))) - (directory-files *el-get-dir*)))) + (directory-files path)))) (if (file-exists-p (concat *el-get-dir* "el-get")) - (add-to-list 'load-path *el-get-dir*) - (add-subdirs-to-load-path *el-get-dir*) + (progn (add-subdirs-to-load-path *el-get-dir*) + (add-to-list 'load-path *el-get-dir*)) (unless (require 'el-get nil t) (with-current-buffer (url-retrieve-synchronously @@ -578,7 +578,16 @@ org-blank-before-new-entry '((heading . t) (plain-list-item . auto)) - org-fontify-done-headline t)) + org-fontify-done-headline 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")))))) :init (setq org-replace-disputed-keys t org-todo-keywords '((sequence "TODO" "STARTED" "|" "DONE") (sequence "TOLEARN" "LEARNING" "LEARNED" "|" "MASTERED") -- cgit 1.4.1 From cada3ecec27c61cb00de0b9e218a29abecf4544c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 3 May 2013 09:07:16 +0100 Subject: Emacs: only setup mu4e on prefect, where mail is in the expected directories --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index f3277b13..261609db 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -275,6 +275,7 @@ (setq smtpmail-smtp-server "external.home") (use-package mu4e + :if (string= system-name "prefect") :load-path "/usr/share/emacs/site-lisp/mu4e" :config (progn (setq mu4e-get-mail-command "true" -- cgit 1.4.1 From 10b7c70ce924c634e2620b5afec5c21e1da3dc3c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 3 May 2013 19:13:37 +0100 Subject: Emacs: Improve add-subdirs-to-load-path by adding the directory itself to load path --- emacs/init.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 261609db..5acf0bc2 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -26,11 +26,11 @@ (if (and (not (string-prefix-p "." file)) (file-directory-p full-path)) (add-to-list 'load-path full-path)))) - (directory-files path)))) + (directory-files path))) + (add-to-list 'load-path path)) (if (file-exists-p (concat *el-get-dir* "el-get")) - (progn (add-subdirs-to-load-path *el-get-dir*) - (add-to-list 'load-path *el-get-dir*)) + (add-subdirs-to-load-path *el-get-dir*) (unless (require 'el-get nil t) (with-current-buffer (url-retrieve-synchronously -- cgit 1.4.1 From 2e008b02c690b0e1c6cfb815218cb09c02c81da3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 3 May 2013 19:16:40 +0100 Subject: Emacs: add full host-name for comparison when determining whether to load mu4e configuration --- emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 5acf0bc2..c1407ace 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -275,7 +275,7 @@ (setq smtpmail-smtp-server "external.home") (use-package mu4e - :if (string= system-name "prefect") + :if (string= system-name "prefect.home.alanpearce.co.uk") :load-path "/usr/share/emacs/site-lisp/mu4e" :config (progn (setq mu4e-get-mail-command "true" -- cgit 1.4.1 From 7715d133347319dc8585601ac783faf2ee566f9d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 4 May 2013 09:12:04 +0100 Subject: Emacs: rename-current-buffer-file should use vc-rename-file when appropriate --- emacs/init.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index c1407ace..41f98214 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -354,12 +354,14 @@ (let ((new-name (read-file-name "New name: " filename))) (if (get-buffer new-name) (error "A buffer named '%s' already exists!" new-name) - (rename-file filename new-name 1) - (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))))))) + (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." -- cgit 1.4.1 From b22564bae8b4d7b62ff314456d55bbabfcdbed48 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 4 May 2013 09:14:04 +0100 Subject: Emacs: delete-current-buffer-file should use vc-delete-file when appropriate --- emacs/init.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 41f98214..e543b2aa 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -372,9 +372,11 @@ (if (not (and filename (file-exists-p filename))) (ido-kill-buffer) (when (yes-or-no-p "Are you sure you want to remove this file? ") - (delete-file filename) - (kill-buffer buffer) - (message "File '%s' successfully removed" filename))))) + (if (vc-backend filename) + (vc-delete-file filename) + (delete-file filename) + (kill-buffer buffer) + (message "File '%s' successfully removed" filename)))))) (use-package saveplace :defer t -- cgit 1.4.1 From 66854cbd86c31ec95af9b22b12608fee67671671 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 5 May 2013 15:13:44 +0100 Subject: Emacs: Add lua-mode initial configuration --- emacs/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index e543b2aa..ec9df21b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -536,6 +536,9 @@ :mode (("\\.hs\\'" . haskell-mode) ("xmobarrc\\'" . haskell-mode))) +(use-package lua-mode + :mode (("\\.lua\\'" . lua-mode))) + ;;;; Planning (use-package calendar -- cgit 1.4.1 From 83d57aa680c785d705b54a0e918a07de9cd7c78b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 5 May 2013 15:43:24 +0100 Subject: Install: move dwm target directory under projects/ --- install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install b/install index 80dc2993..d7e89c0f 100755 --- a/install +++ b/install @@ -36,9 +36,9 @@ install-dot () { install-dot .emacs.d/ dotfiles/emacs/* install-dot . dotfiles/^install(.) dotfiles/zsh/zshrc install-dot .ssh/ dotfiles/ssh/* -if [[ -d dwm ]] +if [[ -d projects/dwm ]] then - install-dot dwm/ dotfiles/dwm/* + install-dot projects/dwm/ dotfiles/dwm/* fi popd -- cgit 1.4.1 From d90cea435305ada6f3f09505feba7221c38f3ced Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 6 May 2013 20:33:27 +0100 Subject: zsh: remove compinit warnings for root --- zsh/zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/zshrc b/zsh/zshrc index 5aba1abf..e47adaf3 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -100,7 +100,7 @@ autoload insert-files zle -N insert-files zmodload -i zsh/complist colors -compinit -d .zsh/cache/compdump +compinit -u -d .zsh/cache/compdump bashcompinit zstyle :compinstall filename '/home/alan/.zshrc' -- cgit 1.4.1 From 7b4a89e95876cea8c283f018b079d72e4d8ed2c0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 3 May 2013 09:15:18 +0100 Subject: Emacs: fix typo in mumamo workaround --- emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index ec9df21b..6b4fda20 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1020,7 +1020,7 @@ Works with: arglist-cont-nonempty, arglist-close." (when (and (equal emacs-major-version 24) (equal emacs-minor-version 2)) - (use-package "mumamo" + (use-package mumamo :defer t :config (progn (setq mumamo-per-buffer-local-vars (delq 'buffer-file-name mumamo-per-buffer-local-vars))))) -- cgit 1.4.1 From da8aa0c8213e47e4d4327ea9e3bdf0c97769961b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 8 May 2013 11:29:34 +0100 Subject: Emacs: move mumamo workaround into nxhtml's use-package form --- emacs/init.el | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 6b4fda20..76a7ad76 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1013,18 +1013,15 @@ Works with: arglist-cont-nonempty, arglist-close." :mode (("\\.php\\'" . html-mumamo-mode)) :idle (load (expand-file-name "nxhtml/autostart" *el-get-dir*)) :config (progn + (when (and (equal emacs-major-version 24) + (> emacs-minor-version 1)) + (setq mumamo-per-buffer-local-vars + (delq 'buffer-file-name mumamo-per-buffer-local-vars))) (setq mumamo-chunk-coloring 4 nxhtml-skip-welcome t nxhtml-autoload-web nil) (nxhtml-menu-mode 0))) -(when (and (equal emacs-major-version 24) - (equal emacs-minor-version 2)) - (use-package mumamo - :defer t - :config (progn (setq mumamo-per-buffer-local-vars - (delq 'buffer-file-name mumamo-per-buffer-local-vars))))) - (use-package php-mode :mode ("\\.php\\'" . php-mode) :config (progn -- cgit 1.4.1 From 41362cc6a6fef233ca5e237276f6286fa5071585 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 May 2013 11:35:26 +0100 Subject: Emacs: add SMTP submission port --- emacs/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 76a7ad76..e674c10f 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -272,7 +272,8 @@ (add-to-list 'erc-modules 'match))) (setq message-send-mail-function 'smtpmail-send-it) -(setq smtpmail-smtp-server "external.home") +(setq smtpmail-smtp-server "external.home" + smtpmail-smtp-service 587) (use-package mu4e :if (string= system-name "prefect.home.alanpearce.co.uk") -- cgit 1.4.1 From 680aa78bed42c3f74e759b5402bd3287696e185d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 May 2013 11:36:42 +0100 Subject: Xresources: Fix colour ordering in solarized-light --- xresources/solarized-light | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xresources/solarized-light b/xresources/solarized-light index 0e59748d..3906b7b0 100644 --- a/xresources/solarized-light +++ b/xresources/solarized-light @@ -60,8 +60,8 @@ *color5: S_magenta *color6: S_cyan *color7: S_base2 -*color9: S_orange *color8: S_base03 +*color9: S_orange *color10: S_base01 *color11: S_base00 *color12: S_base0 -- cgit 1.4.1 From f06a560f3305aa3f0eefa7c4663f3ec448d84a01 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 May 2013 11:37:04 +0100 Subject: XResources: use ChromeOS fonts --- xresources/main | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xresources/main b/xresources/main index d1b787dc..94f005a2 100644 --- a/xresources/main +++ b/xresources/main @@ -27,6 +27,6 @@ Emacs.MenuBar: off Emacs.ScrollBars: off Emacs.CursorBlink: off -Emacs.Font: -*-liberation mono-medium-*-*-*-*-110-*-*-*-*-*-* -Emacs.fixed-pitch.attributeFont: -*-liberation mono-medium-*-*-*-*-110-*-*-*-*-*-* -Emacs.variable-pitch.attributeFont: -*-liberation sans-medium-*-*-*-*-130-*-*-*-*-*-* +Emacs.Font: -*-Cousine-medium-*-*-*-*-110-*-*-*-*-*-* +Emacs.fixed-pitch.attributeFont: -*-Cousine-medium-*-*-*-*-110-*-*-*-*-*-* +Emacs.variable-pitch.attributeFont: -*-Arimo-medium-*-*-*-*-130-*-*-*-*-*-* -- cgit 1.4.1 From a943a2b3b4460c4857524c830c8d23d70d8141f1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 May 2013 11:48:39 +0100 Subject: Emacs: install and use company-mode --- emacs/elisp/el-get-setup.el | 1 + emacs/init.el | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/emacs/elisp/el-get-setup.el b/emacs/elisp/el-get-setup.el index 2d93e441..bd880dbc 100644 --- a/emacs/elisp/el-get-setup.el +++ b/emacs/elisp/el-get-setup.el @@ -22,6 +22,7 @@ auto-indent-mode autopair ace-jump-mode + company dired+ diminish expand-region diff --git a/emacs/init.el b/emacs/init.el index e674c10f..b4f55139 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -296,6 +296,12 @@ (nconc smart-tab-completion-functions-alist '((php-mode . php-complete-function))) (diminish 'smart-tab-mode ""))) +(use-package company + :commands (company-mode) + :bind (("C-" . company-complete)) + :init (progn + (add-hook 'prog-mode-hook #'company-mode))) + ;;;; Directory browsing (use-package dired :defer t -- cgit 1.4.1 From 441d091d6e0492f97b99bd36fa2f52d4ad192ba6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 May 2013 14:55:54 +0100 Subject: Emacs: use lexical binding --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index b4f55139..3433771e 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1,3 +1,4 @@ +;; -*- lexical-binding: t; -*- ;;;; Startup ;; Do not merge echo-area-message sexp (setq inhibit-startup-echo-area-message "alan") -- cgit 1.4.1 From 81734b1d3053064673e6f4995af280f80cb5051d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 May 2013 14:57:03 +0100 Subject: Emacs: remove unused variable --- emacs/init.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 3433771e..ab3fc528 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -375,8 +375,7 @@ "Removes file connected to current buffer and kills buffer." (interactive) (let ((filename (buffer-file-name)) - (buffer (current-buffer)) - (name (buffer-name))) + (buffer (current-buffer))) (if (not (and filename (file-exists-p filename))) (ido-kill-buffer) (when (yes-or-no-p "Are you sure you want to remove this file? ") -- cgit 1.4.1 From f55e24f8679d9862cab4f8cb84772781b900e792 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 14 May 2013 14:37:35 +0100 Subject: Emacs: switch org-mode font back to fixed-pitch --- emacs/init.el | 2 -- 1 file changed, 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index ab3fc528..dc594fd1 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -111,8 +111,6 @@ (variable-pitch-mode) (setq cursor-type 'bar)) - (add-hook 'org-mode-hook #'use-variable-fonts) - (if (eq window-system 'w32) (let* ((font-size 10) (mono-face (cond -- cgit 1.4.1 From ca36b49592990ec69413050dd4cc085256fa6ad2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 14 May 2013 16:20:12 +0100 Subject: Emacs: Remove el-get in favour of package.el --- emacs/elisp/el-get-setup.el | 29 +---------------------------- emacs/init.el | 35 ++--------------------------------- 2 files changed, 3 insertions(+), 61 deletions(-) diff --git a/emacs/elisp/el-get-setup.el b/emacs/elisp/el-get-setup.el index bd880dbc..53f3a462 100644 --- a/emacs/elisp/el-get-setup.el +++ b/emacs/elisp/el-get-setup.el @@ -1,27 +1,11 @@ -(package-initialize) - (setq - el-get-sources '( - (:name use-package - :type github - :pkgname "jwiegley/use-package") - (:name packed - :type github - :pkgname "tarsius/packed") - (:name auto-compile - :type github - :depends packed - :pkgname "tarsius/auto-compile") - (:name project-persist - :type github - :pkgname "rdallasgray/project-persist")) - eg:basic-packages '( auto-compile auto-indent-mode autopair ace-jump-mode + bind-key company dired+ diminish @@ -54,14 +38,3 @@ eg:cygwin-packages '(windows-path)) - -(el-get-elpa-build-local-recipes) - -(el-get 'sync eg:basic-packages) - -(cond ((eq system-type 'cygwin) - (el-get 'sync eg:cygwin-packages) - (el-get 'sync eg:windows-packages)) - - ((eq system-type 'windows-nt) - (el-get 'sync eg:windows-packages))) diff --git a/emacs/init.el b/emacs/init.el index dc594fd1..4716c595 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -10,36 +10,14 @@ (setq custom-file "~/.emacs.d/custom.el") ;;;; Package Management -(setq *el-get-dir* (expand-file-name "el-get/" user-emacs-directory) - *elisp-dir* (expand-file-name "elisp/" user-emacs-directory) +(setq *elisp-dir* (expand-file-name "elisp/" user-emacs-directory) *custom-dir* (expand-file-name "custom/" user-emacs-directory) - el-get-github-default-url-type "git" - el-get-emacswiki-base-url "http://raw.github.com/emacsmirror/emacswiki.org/master/" package-archives '(("ELPA" . "http://tromey.com/elpa/") ("gnu" . "http://elpa.gnu.org/packages/") ("marmalade" . "http://marmalade-repo.org/packages/") ("melpa" . "http://melpa.milkbox.net/packages/"))) -(defun add-subdirs-to-load-path (path) - (unless (member path load-path) - (mapc (lambda (file) - (let ((full-path (concat path file))) - (if (and (not (string-prefix-p "." file)) - (file-directory-p full-path)) - (add-to-list 'load-path full-path)))) - (directory-files path))) - (add-to-list 'load-path path)) - -(if (file-exists-p (concat *el-get-dir* "el-get")) - (add-subdirs-to-load-path *el-get-dir*) - (unless (require 'el-get nil t) - (with-current-buffer - (url-retrieve-synchronously - "https://raw.github.com/dimitri/el-get/master/el-get-install.el") - (make-local-variable 'el-get-master-branch) - (goto-char (point-max)) - (eval-print-last-sexp) - (load (concat *elisp-dir* "el-get-setup"))))) +(package-initialize) (add-to-list 'load-path *elisp-dir*) @@ -49,15 +27,6 @@ (unless (fboundp 'diminish) (require 'diminish nil t))) -(use-package el-get - :commands (el-get-init - el-get-install - el-get-reinstall - el-get-remove - el-get-update - el-get-self-update - el-get-describe)) - ;;;; Style (use-package linum -- cgit 1.4.1 From f047eb6cc310df64ef90def60644087925e762cd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 14 May 2013 16:51:38 +0100 Subject: Emacs: Check basic-packages list and install any missing packages --- emacs/elisp/el-get-setup.el | 40 ---------------------------------------- emacs/init.el | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 40 deletions(-) delete mode 100644 emacs/elisp/el-get-setup.el diff --git a/emacs/elisp/el-get-setup.el b/emacs/elisp/el-get-setup.el deleted file mode 100644 index 53f3a462..00000000 --- a/emacs/elisp/el-get-setup.el +++ /dev/null @@ -1,40 +0,0 @@ -(setq - eg:basic-packages - '( - auto-compile - auto-indent-mode - autopair - ace-jump-mode - bind-key - company - dired+ - diminish - expand-region - helm - help+ - help-fns+ - help-macro+ - help-mode+ - mic-paren - misc-cmds - multiple-cursors - projectile - project-persist - paredit - solarized-theme - smart-tab - smarttabs - smex - undo-tree - use-package - ) - - eg:windows-packages - '(ntcmd - w32-browser - ;; powershell - ;; powershell-mode - ) - - eg:cygwin-packages - '(windows-path)) diff --git a/emacs/init.el b/emacs/init.el index 4716c595..dbce9d9b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -21,6 +21,34 @@ (add-to-list 'load-path *elisp-dir*) +(mapc (lambda (package-name) + (unless (package-installed-p package-name) + (package-install package-name))) + '(auto-compile + auto-indent-mode + autopair + ace-jump-mode + bind-key + company + dired+ + diminish + expand-region + helm + nginx-mode + mic-paren + multiple-cursors + mustache-mode + projectile + project-persist + paredit + solarized-theme + smart-tab + smart-tabs-mode + smex + undo-tree + use-package + )) + (require 'use-package) (eval-when-compile -- cgit 1.4.1 From f1af12c8e936aa7665f71a880b0f16ab2d468006 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 14 May 2013 19:58:40 +0100 Subject: Emacs: load nxhtml from .emacs.d --- emacs/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index dbce9d9b..fca5eec0 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1013,7 +1013,8 @@ Works with: arglist-cont-nonempty, arglist-close." (use-package nxhtml-mode :defer t :mode (("\\.php\\'" . html-mumamo-mode)) - :idle (load (expand-file-name "nxhtml/autostart" *el-get-dir*)) + :load-path "nxhtml" + :idle (load (expand-file-name "autostart" (expand-file-name "nxhtml" user-emacs-directory)) t) :config (progn (when (and (equal emacs-major-version 24) (> emacs-minor-version 1)) -- cgit 1.4.1 From f447bb9c95d2b40047f57fea19c70d061c19eeac Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 14 May 2013 19:59:55 +0100 Subject: Emacs: Remove load-path hints which point to el-get --- emacs/init.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index fca5eec0..c90f20a9 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -627,7 +627,6 @@ ("C-c P k" . project-persist-close) ("C-c P n" . project-persist-create) ("C-c P s" . project-persist-save)) - :load-path "el-get/project-persist/lib/" :config (progn (project-persist-mode t) @@ -871,8 +870,7 @@ Also returns nil if pid is nil." :commands (geiser-mode geiser run-geiser - run-racket) - :load-path "el-get/geiser/elisp") + run-racket)) (use-package geiser-base :defer t -- cgit 1.4.1 From 5b2b7b4b2edf7b882947017afca376c0b9e7a2f5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 15 May 2013 10:54:32 +0100 Subject: Emacs: fix org-mode package reference --- emacs/init.el | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index c90f20a9..93a8d55b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -549,15 +549,15 @@ (setq calendar-week-start-day 1) (calendar-set-date-style 'iso))) -(use-package org-mode +(use-package org :bind (("C-c C-a" . org-agenda-list) ("C-c a" . org-agenda) ("C-c l" . org-store-list) ("C-c r" . org-remember) ("C-c b" . org-iswitchb)) :config (progn - (setq org-directory "~/org") - (setq org-agenda-files `(,org-directory) + (setq org-directory "~/org" + org-agenda-files `(,org-directory) org-default-notes-file (concat org-directory "/notes") @@ -588,8 +588,12 @@ org-blank-before-new-entry '((heading . t) (plain-list-item . auto)) - org-fontify-done-headline t) + org-fontify-done-headline t + org-replace-disputed-keys t + org-todo-keywords '((sequence "TODO" "STARTED" "|" "DONE") + (sequence "TOLEARN" "LEARNING" "LEARNED" "|" "MASTERED") + (sequence "|" "CANCELLED"))) (defadvice org-clock-in (after wicked activate) "Mark STARTED when clocked in" (save-excursion @@ -597,11 +601,7 @@ (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")))))) - :init (setq org-replace-disputed-keys t - org-todo-keywords '((sequence "TODO" "STARTED" "|" "DONE") - (sequence "TOLEARN" "LEARNING" "LEARNED" "|" "MASTERED") - (sequence "|" "CANCELLED")))) + (org-todo "STARTED"))))))) ;;;; Programming -- cgit 1.4.1 From 26e8fbe83f4aab919c5b863bd9b690e89b671476 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 15 May 2013 10:56:57 +0100 Subject: Emacs: set org-mode to indent headings --- emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 93a8d55b..496e1099 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -564,7 +564,7 @@ ;; Fewer asterisks, doesn't change indentation org-hide-leading-stars t - org-startup-indented nil + org-startup-indented t ;; ‘Remember’: new items at top org-reverse-note-order t -- cgit 1.4.1 From 872acf50016451c8b3cf6fffcb85755e48f24dfc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 15 May 2013 11:01:20 +0100 Subject: Emacs: fix typo in org-mode bindings --- emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 496e1099..cc9f9318 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -552,7 +552,7 @@ (use-package org :bind (("C-c C-a" . org-agenda-list) ("C-c a" . org-agenda) - ("C-c l" . org-store-list) + ("C-c l" . org-store-link) ("C-c r" . org-remember) ("C-c b" . org-iswitchb)) :config (progn -- cgit 1.4.1 From a16f8e7fd2c498b66c72e0b3cc3595de2e00ded4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 15 May 2013 11:21:08 +0100 Subject: Emacs: disable nxhtml-menu-mode properly --- emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index cc9f9318..be2cb5a4 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1021,7 +1021,7 @@ Works with: arglist-cont-nonempty, arglist-close." (setq mumamo-chunk-coloring 4 nxhtml-skip-welcome t nxhtml-autoload-web nil) - (nxhtml-menu-mode 0))) + (nxhtml-menu-mode -1))) (use-package php-mode :mode ("\\.php\\'" . php-mode) -- cgit 1.4.1 From 40f76781aa679b3fe928a29670d6af072e4c9800 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 15 May 2013 11:24:15 +0100 Subject: Emacs: only run nxhtml at work --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index be2cb5a4..1b369163 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1010,6 +1010,7 @@ Works with: arglist-cont-nonempty, arglist-close." (use-package nxhtml-mode :defer t + :if (boundp '*work*) :mode (("\\.php\\'" . html-mumamo-mode)) :load-path "nxhtml" :idle (load (expand-file-name "autostart" (expand-file-name "nxhtml" user-emacs-directory)) t) -- cgit 1.4.1 From 8f2752f1d619bcbee7ea5960336ba775f09e7a95 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 15 May 2013 12:24:09 +0100 Subject: Emacs: create systems for getting system location (i.e. work/home) and type (laptop/desktop/server) --- emacs/init.el | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 1b369163..fe051a4d 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -9,6 +9,38 @@ user-full-name "Alan Pearce") (setq custom-file "~/.emacs.d/custom.el") +;;;; Environment & Location + +(defun env/get-location () + "Return the physical location of the system, or `nil' if unknown" + (if (executable-find "netctl") + (catch 'found + (mapc (lambda (line) + (cond + ((string-prefix-p "* home" line) (throw 'found 'home)) + ((string-prefix-p "* work" line) (throw 'found 'work)))) + (process-lines "netctl" "list")) + nil))) + +(defun env/get-system-type () + "Return the type of computer that is running" + (cond + ((string-prefix-p "prefect" system-name) 'desktop) + ((string-prefix-p "server" system-name) 'server) + ((string-prefix-p "sheldon" system-name) 'laptop))) + +(defvar env/location (env/get-location) + "The type of location the system is located +Values: `work', `home'") + +(defvar env/system-type (env/get-system-type) + "The type of computer Emacs is running on +Values: `desktop', `server', `laptop'") + +(defun env/recheck-location () + (interactive) + (setq env/location (env/get-location))) + ;;;; Package Management (setq *elisp-dir* (expand-file-name "elisp/" user-emacs-directory) *custom-dir* (expand-file-name "custom/" user-emacs-directory) @@ -1010,7 +1042,7 @@ Works with: arglist-cont-nonempty, arglist-close." (use-package nxhtml-mode :defer t - :if (boundp '*work*) + :if (eq env/location 'work) :mode (("\\.php\\'" . html-mumamo-mode)) :load-path "nxhtml" :idle (load (expand-file-name "autostart" (expand-file-name "nxhtml" user-emacs-directory)) t) -- cgit 1.4.1 From 6b100e353fed694a0c3a23ab973bf132126bfac0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 15 May 2013 12:24:53 +0100 Subject: Emacs: whitespace fixes --- emacs/init.el | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index fe051a4d..9ab8db48 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -14,13 +14,13 @@ (defun env/get-location () "Return the physical location of the system, or `nil' if unknown" (if (executable-find "netctl") - (catch 'found - (mapc (lambda (line) - (cond - ((string-prefix-p "* home" line) (throw 'found 'home)) - ((string-prefix-p "* work" line) (throw 'found 'work)))) - (process-lines "netctl" "list")) - nil))) + (catch 'found + (mapc (lambda (line) + (cond + ((string-prefix-p "* home" line) (throw 'found 'home)) + ((string-prefix-p "* work" line) (throw 'found 'work)))) + (process-lines "netctl" "list")) + nil))) (defun env/get-system-type () "Return the type of computer that is running" @@ -151,13 +151,13 @@ Values: `desktop', `server', `laptop'") "Consolas") )) (variable-face "Segoe UI") - (default-font (concat mono-face "-" (number-to-string font-size)))) - (when mono-face - (set-face-font 'default default-font) - (set-face-font 'fixed-pitch default-font)) - (when variable-face - (set-face-font 'variable-pitch (concat variable-face "-" - (number-to-string (1+ font-size)))))))) + (default-font (concat mono-face "-" (number-to-string font-size)))) + (when mono-face + (set-face-font 'default default-font) + (set-face-font 'fixed-pitch default-font)) + (when variable-face + (set-face-font 'variable-pitch (concat variable-face "-" + (number-to-string (1+ font-size)))))))) (with-elapsed-timer "Setting up font styles" (let* ((font-height (face-attribute 'default :height)) @@ -921,14 +921,14 @@ Also returns nil if pid is nil." (defun init-narrow-to-section () (interactive) (save-excursion - (beginning-of-line) - (unless (looking-at "^;;;;") - (re-search-backward "^;;;;" nil t)) - (push-mark) - (forward-line) - (re-search-forward "^;;;;" nil t) - (forward-line -1) - (narrow-to-region (region-beginning) (region-end)))) + (beginning-of-line) + (unless (looking-at "^;;;;") + (re-search-backward "^;;;;" nil t)) + (push-mark) + (forward-line) + (re-search-forward "^;;;;" nil t) + (forward-line -1) + (narrow-to-region (region-beginning) (region-end)))) (defun init-imenu (p) (interactive "P") -- cgit 1.4.1 From 4e7864b913987677974880ca8d29ea370f60b58f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 15 May 2013 15:29:56 +0100 Subject: Emacs: merge `setq` forms --- emacs/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 9ab8db48..ddb388e8 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -6,8 +6,8 @@ initial-scratch-message "" initial-major-mode 'text-mode user-mail-address "alan@alanpearce.co.uk" - user-full-name "Alan Pearce") -(setq custom-file "~/.emacs.d/custom.el") + user-full-name "Alan Pearce" + custom-file "~/.emacs.d/custom.el") ;;;; Environment & Location -- cgit 1.4.1 From 65833544cb900b40e3603926b0e8c76b9fe0b952 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 15 May 2013 15:30:37 +0100 Subject: Emacs: fix typo in docstring --- emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index ddb388e8..8e07f5a3 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -30,7 +30,7 @@ ((string-prefix-p "sheldon" system-name) 'laptop))) (defvar env/location (env/get-location) - "The type of location the system is located + "The type of location the system is located in Values: `work', `home'") (defvar env/system-type (env/get-system-type) -- cgit 1.4.1 From a42d2f72ad3c613109f9c862d065bc09e2eed262 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 15 May 2013 15:31:46 +0100 Subject: Emacs: remove unused variable --- emacs/init.el | 1 - 1 file changed, 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 8e07f5a3..e5b215f2 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -43,7 +43,6 @@ Values: `desktop', `server', `laptop'") ;;;; Package Management (setq *elisp-dir* (expand-file-name "elisp/" user-emacs-directory) - *custom-dir* (expand-file-name "custom/" user-emacs-directory) package-archives '(("ELPA" . "http://tromey.com/elpa/") ("gnu" . "http://elpa.gnu.org/packages/") ("marmalade" . "http://marmalade-repo.org/packages/") -- cgit 1.4.1 From fea9356eac2faf5812d4e136121739f152724878 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 15 May 2013 15:32:27 +0100 Subject: Emacs: remove setup of unused package color-theme-solarized --- emacs/init.el | 6 ------ 1 file changed, 6 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index e5b215f2..ebd477e8 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -122,12 +122,6 @@ Values: `desktop', `server', `laptop'") (use-package solarized-theme :config (load-theme 'solarized-light t)) -(use-package color-theme-solarized - :disabled t - :commands (color-theme-solarized-light) - :depends color-theme - :init (color-theme-solarized-light)) - (when (or (display-graphic-p) (daemonp)) (use-package fringe -- cgit 1.4.1 From 885066458f2c92f1d5d301d318194ba4d307744d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 15 May 2013 15:34:48 +0100 Subject: Emacs: correctly start winner-mode --- emacs/init.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index ebd477e8..3822f549 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1085,9 +1085,7 @@ Works with: arglist-cont-nonempty, arglist-close." (tooltip-mode -1) (tool-bar-mode -1)) -(use-package winner - :bind (("C-c " . winner-undo) - ("C-c " . winner-redo))) +(winner-mode 1) (use-package windmove :bind (("S-" . windmove-left) -- cgit 1.4.1 From 3b317aac2eb86fd1480ce3fc9654605fac1ce0c3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 15 May 2013 15:47:29 +0100 Subject: Emacs: remove unnecessary :commands --- emacs/init.el | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 3822f549..7c99e21e 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -89,7 +89,7 @@ Values: `desktop', `server', `laptop'") ;;;; Style (use-package linum - :commands (linum-mode) + :defer t :config (setq linum-format " %4d ")) (use-package highlight-symbol @@ -234,7 +234,6 @@ Values: `desktop', `server', `laptop'") (use-package ibuffer :disabled t - :commands (ibuffer) :config (progn (setq ibuffer-saved-filter-groups (quote (("default" @@ -311,8 +310,7 @@ Values: `desktop', `server', `laptop'") completion-ignore-case t) (use-package smart-tab - :commands (global-smart-tab-mode) - :idle (global-smart-tab-mode) + :init (global-smart-tab-mode) :config (progn (nconc smart-tab-completion-functions-alist '((php-mode . php-complete-function))) (diminish 'smart-tab-mode ""))) @@ -345,12 +343,7 @@ Values: `desktop', `server', `laptop'") (concat user-emacs-directory "info")) -(use-package eldoc - :commands (turn-on-eldoc-mode - eldoc-add-command)) - (use-package eldoc-context - :depends eldoc :bind (("C-c h" . rgr/toggle-context-help))) (use-package help+ @@ -510,8 +503,6 @@ Values: `desktop', `server', `laptop'") ("C-x C-b" . helm-mini))) (use-package ido - :commands (ido-mode - ido-find-file) :init (bind-key* "C-x C-f" #'ido-find-file) :bind (("C-x b" . ido-switch-buffer)) :config (progn -- cgit 1.4.1 From 976f79bda5a450a4f16ee556849649428bbad5f4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 15 May 2013 15:51:27 +0100 Subject: Emacs: whitespace fixes --- emacs/init.el | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 7c99e21e..ebae773b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -77,8 +77,7 @@ Values: `desktop', `server', `laptop'") smart-tabs-mode smex undo-tree - use-package - )) + use-package)) (require 'use-package) @@ -110,8 +109,7 @@ Values: `desktop', `server', `laptop'") space-before-tab indentation indentation::space - indentation::tabs - ))) + indentation::tabs))) (global-font-lock-mode t) ;; Allow font-lock-mode to do background parsing @@ -141,8 +139,7 @@ Values: `desktop', `server', `laptop'") ((member "Liberation Sans Mono" (font-family-list)) "Liberation Sans Mono") ((member "Consolas" (font-family-list)) - "Consolas") - )) + "Consolas"))) (variable-face "Segoe UI") (default-font (concat mono-face "-" (number-to-string font-size)))) (when mono-face @@ -218,8 +215,7 @@ Values: `desktop', `server', `laptop'") :inherit 'fixed-pitch)))) (org-done ((t (:weight normal :strike-through t)))) - (org-headline-done ((t (:strike-through t)))) - )))) + (org-headline-done ((t (:strike-through t)))))))) ;;;; Autosaves & Backups (let ((backup-dir (expand-file-name "~/.emacs.d/backups/"))) @@ -240,8 +236,7 @@ Values: `desktop', `server', `laptop'") ("org" (mode . org-mode)) ("emacs" (mode . emacs-lisp-mode)) ("zsh" (filename . "/zsh")) - ("server" (filename . "/su:root@server")) - )))) + ("server" (filename . "/su:root@server")))))) ;; Human-readable base-2 size column (define-ibuffer-column size-h @@ -285,8 +280,7 @@ Values: `desktop', `server', `laptop'") erc-autojoin-channels-alist '(("freenode.net" "#emacs" "##freebsd" "#bufferbloat" "#openwrt" "#lojban" "#zfs" "#introverts") ("what.cd" "#what.cd") - ("beusergroup.co.uk" "#be") - )) + ("beusergroup.co.uk" "#be"))) (add-to-list 'erc-modules 'scrolltobottom) (add-to-list 'erc-modules 'autojoin) (add-to-list 'erc-modules 'match))) @@ -402,8 +396,7 @@ Values: `desktop', `server', `laptop'") :defer t :idle (require 'saveplace) :config (progn (setq-default save-place t) - (setq save-place-file (expand-file-name ".saveplace" user-emacs-directory)) - )) + (setq save-place-file (expand-file-name ".saveplace" user-emacs-directory)))) (use-package tramp :defer t @@ -449,8 +442,7 @@ Values: `desktop', `server', `laptop'") 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-mode-untabify-on-yank-or-paste nil) (auto-indent-global-mode))) (use-package smart-tabs-mode @@ -459,8 +451,7 @@ Values: `desktop', `server', `laptop'") smart-tabs-advice) :config (progn (smart-tabs-insinuate 'c 'javascript 'cperl 'python 'ruby) - (add-hook 'php-mode-hook #'smart-tabs-mode-enable) - )) + (add-hook 'php-mode-hook #'smart-tabs-mode-enable))) ;;;; Keybindings @@ -698,8 +689,7 @@ Also returns nil if pid is nil." (lambda () (message (format "Saving project desktop (%s)" project-persist-current-project-settings-dir)) (desktop-save project-persist-current-project-settings-dir))) - - )) +)) (use-package vc :config (progn @@ -980,8 +970,7 @@ Works with: arglist-cont-nonempty, arglist-close." (vector (if (or (looking-at ",") (looking-at ")")) (- (current-column) 2) - (current-column) - ))))))))) + (current-column)))))))))) ;;;; Web Development -- cgit 1.4.1 From 6c1c601792b1bea7fe0a62a0f22a783991e0d8c1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 15 May 2013 18:25:34 +0100 Subject: Emacs: replace string-matches on system name with env/* comparisons --- emacs/init.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index ebae773b..3fa525bc 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -290,7 +290,8 @@ Values: `desktop', `server', `laptop'") smtpmail-smtp-service 587) (use-package mu4e - :if (string= system-name "prefect.home.alanpearce.co.uk") + :if (and (eq env/location 'home) + (eq env/system-type 'desktop)) :load-path "/usr/share/emacs/site-lisp/mu4e" :config (progn (setq mu4e-get-mail-command "true" @@ -1035,7 +1036,7 @@ Works with: arglist-cont-nonempty, arglist-close." (bind-key "C-h C-f" #'php-search-documentation php-mode-map) (unbind-key "C-c C-f" php-mode-map) (unbind-key "C-." php-mode-map) - (if (member system-name '("PREFECT" "prefect")) + (if (eq env/location 'home) (setq php-manual-url "http://docs.home/manual/en/")) (add-hook 'php-mode-hook (lambda () (set (make-local-variable 'eldoc-documentation-function) #'my-php-eldoc-function))) -- cgit 1.4.1 From 96ca17c02cfac807419d153c6c87fc84af142a17 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 16 May 2013 08:58:19 +0100 Subject: DWM: make ediff windows float --- dwm/config.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dwm/config.h b/dwm/config.h index e9920707..ae1d8bb3 100644 --- a/dwm/config.h +++ b/dwm/config.h @@ -20,9 +20,10 @@ static const Rule rules[] = { /* class instance title tags mask isfloating monitor */ { "Firefox", NULL, NULL, 1 << 2, False, -1 }, { "URxvt", NULL, NULL, 1 << 0, False, -1 }, - { "Emacs", NULL, NULL, 1 << 1, False, -1 }, + { "Emacs", "emacs", NULL, 1 << 1, False, -1 }, { "KeePass2", NULL, NULL, 1 << 3, False, -1 }, { "deadbeef", NULL, NULL, 1 << 3, False, -1 }, + { "Emacs", "Ediff", NULL, 0, True, -1 }, }; /* layout(s) */ -- cgit 1.4.1 From 7aaaea54ed327dc2c40a2799484df302f0598892 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 16 May 2013 12:21:58 +0100 Subject: Emacs: enable nxhtml on laptop rather than at work --- emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 3fa525bc..0a5e68c0 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1016,7 +1016,7 @@ Works with: arglist-cont-nonempty, arglist-close." (use-package nxhtml-mode :defer t - :if (eq env/location 'work) + :if (eq env/system-type 'laptop) :mode (("\\.php\\'" . html-mumamo-mode)) :load-path "nxhtml" :idle (load (expand-file-name "autostart" (expand-file-name "nxhtml" user-emacs-directory)) t) -- cgit 1.4.1 From 883b3a15157eca87580006c4a004a8e46b075e2c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 16 May 2013 14:12:45 +0100 Subject: Emacs: disable nxhtml-mode --- emacs/init.el | 2 -- 1 file changed, 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 0a5e68c0..b0fefcf7 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1017,9 +1017,7 @@ Works with: arglist-cont-nonempty, arglist-close." (use-package nxhtml-mode :defer t :if (eq env/system-type 'laptop) - :mode (("\\.php\\'" . html-mumamo-mode)) :load-path "nxhtml" - :idle (load (expand-file-name "autostart" (expand-file-name "nxhtml" user-emacs-directory)) t) :config (progn (when (and (equal emacs-major-version 24) (> emacs-minor-version 1)) -- cgit 1.4.1 From 011f317d2faf190cfdd4074e1ada771acab4c975 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 11:55:06 +0100 Subject: Emacs: Remove electrify-return-if-match and replace with paredit keybindings in lisp-modes --- emacs/elisp/electric-return.el | 16 ---------------- emacs/init.el | 7 +------ 2 files changed, 1 insertion(+), 22 deletions(-) delete mode 100644 emacs/elisp/electric-return.el diff --git a/emacs/elisp/electric-return.el b/emacs/elisp/electric-return.el deleted file mode 100644 index fcbebb3c..00000000 --- a/emacs/elisp/electric-return.el +++ /dev/null @@ -1,16 +0,0 @@ -(defvar electrify-return-match - "[\]}\)\"]" - "If this regexp matches the text after the cursor, do an \"electric\" - return.") -(defun electrify-return-if-match (arg) - "If the text after the cursor matches `electrify-return-match' then - open and indent an empty line between the cursor and the text. Move the - cursor to the new line." - (interactive "P") - (let ((case-fold-search nil)) - (if (looking-at electrify-return-match) - (save-excursion (newline-and-indent))) - (newline arg) - (indent-according-to-mode))) -;; Using local-set-key in a mode-hook is a better idea. -;(global-set-key (kbd "RET") 'electrify-return-if-match) \ No newline at end of file diff --git a/emacs/init.el b/emacs/init.el index b0fefcf7..af79db76 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -786,9 +786,6 @@ Also returns nil if pid is nil." (setq autopair-blink nil autopair-skip-whitespace nil))) -(use-package electric-return - :bind (("RET" . electrify-return-if-match))) - (use-package expand-region :bind ("C-M-SPC" . er/expand-region)) @@ -855,9 +852,7 @@ Also returns nil if pid is nil." (show-paren-mode t) (setq indent-tabs-mode nil) - - (local-set-key (kbd "RET") 'electrify-return-if-match) - (local-set-key (kbd "C-j") 'electrify-return-if-match)) + (local-set-key (kbd "RET") #'paredit-newline)) (add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup) (add-hook 'emacs-lisp-mode-hook #'turn-on-eldoc-mode) -- cgit 1.4.1 From f27172b3edc6f00ab319d82dcbb2bf99014398e2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 12:02:35 +0100 Subject: Emacs: set mu4e to update its index every 5 minutes --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index af79db76..df6f18a3 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -295,6 +295,7 @@ Values: `desktop', `server', `laptop'") :load-path "/usr/share/emacs/site-lisp/mu4e" :config (progn (setq mu4e-get-mail-command "true" + mu4e-update-interval 300 mu4e-sent-folder "/alanpearce/Sent" mu4e-drafts-folder "/alanpearce/Drafts" mu4e-refile-folder "/alanpearce/Archive"))) -- cgit 1.4.1 From 0c6a787848903894cc6ba692c2e93fad83eb4851 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 12:14:13 +0100 Subject: Emacs: bind q in mu4e's main window to bury the buffer rather than quitting --- emacs/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index df6f18a3..790c07fc 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -298,7 +298,8 @@ Values: `desktop', `server', `laptop'") mu4e-update-interval 300 mu4e-sent-folder "/alanpearce/Sent" mu4e-drafts-folder "/alanpearce/Drafts" - mu4e-refile-folder "/alanpearce/Archive"))) + mu4e-refile-folder "/alanpearce/Archive") + (define-key mu4e-main-mode-map "q" #'bury-buffer))) ;;;; Completion -- cgit 1.4.1 From c174606193cfead00e88c39f6b96ea8f09fda1ab Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 12:35:20 +0100 Subject: Emacs: use :ensure to download packages when needed --- emacs/init.el | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 790c07fc..c298d872 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -55,28 +55,8 @@ Values: `desktop', `server', `laptop'") (mapc (lambda (package-name) (unless (package-installed-p package-name) (package-install package-name))) - '(auto-compile - auto-indent-mode - autopair - ace-jump-mode - bind-key - company - dired+ + '(bind-key diminish - expand-region - helm - nginx-mode - mic-paren - multiple-cursors - mustache-mode - projectile - project-persist - paredit - solarized-theme - smart-tab - smart-tabs-mode - smex - undo-tree use-package)) (require 'use-package) @@ -118,6 +98,7 @@ Values: `desktop', `server', `laptop'") jit-lock-defer-time 0.1) (use-package solarized-theme + :ensure t :config (load-theme 'solarized-light t)) (when (or (display-graphic-p) @@ -307,12 +288,14 @@ Values: `desktop', `server', `laptop'") completion-ignore-case t) (use-package smart-tab + :ensure t :init (global-smart-tab-mode) :config (progn (nconc smart-tab-completion-functions-alist '((php-mode . php-complete-function))) (diminish 'smart-tab-mode ""))) (use-package company + :ensure t :commands (company-mode) :bind (("C-" . company-complete)) :init (progn @@ -332,6 +315,7 @@ Values: `desktop', `server', `laptop'") (use-package dired+ :defer t + :ensure t :config (diredp-toggle-find-file-reuse-dir 1)) ;;;; Documentation @@ -436,6 +420,7 @@ Values: `desktop', `server', `laptop'") (use-package auto-indent-mode :defer t + :ensure t :commands (auto-indent-minor-mode auto-indent-mode) :config (progn @@ -449,6 +434,7 @@ Values: `desktop', `server', `laptop'") (auto-indent-global-mode))) (use-package smart-tabs-mode + :ensure t :commands (smart-tabs-mode smart-tabs-mode-enable smart-tabs-advice) @@ -493,6 +479,7 @@ Values: `desktop', `server', `laptop'") :bind (("M-`" . lacarte-execute-menu-command))) (use-package helm-config + :ensure helm :bind (("C-x i" . helm-imenu) ("C-x C-b" . helm-mini))) @@ -511,6 +498,7 @@ Values: `desktop', `server', `laptop'") (bind-key "C-c C-s" #'ido-manual-merge ido-file-dir-completion-map))) (use-package smex + :ensure t :bind (("M-x" . smex) ("" . smex) ("" . smex) @@ -627,10 +615,12 @@ Values: `desktop', `server', `laptop'") ;;;; Projects (use-package projectile + :ensure t :bind (("C-c C-f" . projectile-find-file)) :commands (projectile-global-mode)) (use-package project-persist + :ensure t :commands (project-persist-mode) :bind (("C-c P d" . project-persist-delete) ("C-c P f" . project-persist-find) @@ -775,6 +765,7 @@ Also returns nil if pid is nil." (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))) (use-package ace-jump-mode + :ensure t :bind (("C-c SPC" . ace-jump-mode)) :config (progn (ace-jump-mode-enable-mark-sync) @@ -782,6 +773,7 @@ Also returns nil if pid is nil." ace-jump-mode-scope 'window))) (use-package autopair + :ensure t :commands (autopair-mode) :init (progn (add-hook 'prog-mode-hook #'autopair-mode) @@ -789,12 +781,14 @@ Also returns nil if pid is nil." autopair-skip-whitespace nil))) (use-package expand-region + :ensure t :bind ("C-M-SPC" . er/expand-region)) (use-package goto-chg :bind ("C-x C-SPC" . goto-last-change)) (use-package multiple-cursors + :ensure t :bind (("C-." . mc/mark-next-like-this) ("C-," . mc/mark-previous-like-this) ("M-" . mc/mark-all-like-this-dwim) @@ -802,6 +796,7 @@ Also returns nil if pid is nil." ("C-S-L" . mc/edit-lines))) (use-package paredit + :ensure t :commands (paredit-mode) :init (progn (put #'paredit-forward-delete 'delete-selection 'supersede) @@ -823,6 +818,7 @@ Also returns nil if pid is nil." ("C-M-n" . smart-forward))) (use-package undo-tree + :ensure t :idle (require 'undo-tree) :defer t :config (progn @@ -914,6 +910,7 @@ Also returns nil if pid is nil." ;;;; Programming (use-package auto-compile + :ensure t :commands (auto-compile-on-save-mode) :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) @@ -1007,6 +1004,7 @@ Works with: arglist-cont-nonempty, arglist-close." js3-curly-indent-offset 4))) (use-package mustache-mode + :ensure t :mode (("\\.mustache" . mustache-mode) ("\\.mt\\'" . mustache-mode) ("\\.template\\'" . mustache-mode))) -- cgit 1.4.1 From 03dfff9f189205bb21b5d521b255f96b11a826ff Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 12:40:51 +0100 Subject: Emacs: show fringes --- emacs/init.el | 3 --- 1 file changed, 3 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index c298d872..dbe5f5e0 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -103,9 +103,6 @@ Values: `desktop', `server', `laptop'") (when (or (display-graphic-p) (daemonp)) - (use-package fringe - :defer t - :config (fringe-mode '(0 . 0))) (defun use-variable-fonts () (interactive) -- cgit 1.4.1 From 222b741e5ed8893f870efa91bb89b7b219e8d80f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 12:42:06 +0100 Subject: Emacs: remove help+ --- emacs/init.el | 3 --- 1 file changed, 3 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index dbe5f5e0..6056b7d0 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -324,9 +324,6 @@ Values: `desktop', `server', `laptop'") (use-package eldoc-context :bind (("C-c h" . rgr/toggle-context-help))) -(use-package help+ - :bind (("" . help-on-click/key))) - (use-package which-func :defer t :idle (which-function-mode) -- cgit 1.4.1 From 185c5978fe924b157214975b21042bb1bf94fa51 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 12:47:22 +0100 Subject: Emacs: add setup for nginx-mode --- emacs/init.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 6056b7d0..6e34426b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -530,6 +530,10 @@ Values: `desktop', `server', `laptop'") :mode (("\\.hs\\'" . haskell-mode) ("xmobarrc\\'" . haskell-mode))) +(use-package nginx-mode + :ensure t + :mode (("nginx.conf" . nginx-mode))) + (use-package lua-mode :mode (("\\.lua\\'" . lua-mode))) -- cgit 1.4.1 From 821fca1da57005f24e2395a07f484ba4e35320c8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 12:49:49 +0100 Subject: Emacs: ensure that lua-mode and haskell-mode are installed before use --- emacs/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 6e34426b..c19ad14c 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -527,6 +527,7 @@ Values: `desktop', `server', `laptop'") ("\\.Xresources\\'" . xrdb-mode))) (use-package haskell-mode + :ensure t :mode (("\\.hs\\'" . haskell-mode) ("xmobarrc\\'" . haskell-mode))) @@ -535,6 +536,7 @@ Values: `desktop', `server', `laptop'") :mode (("nginx.conf" . nginx-mode))) (use-package lua-mode + :ensure t :mode (("\\.lua\\'" . lua-mode))) ;;;; Planning -- cgit 1.4.1 From af49c8fc39c05846a144e4ecd58704c8e7079db5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 12:53:05 +0100 Subject: Emacs: only delete a frame when calling exit-emacs in a daemon --- emacs/init.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index c19ad14c..09b62313 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -467,7 +467,9 @@ Values: `desktop', `server', `laptop'") :defer t :idle (minibuffer-depth-indicate-mode t)) -(defalias 'exit-emacs 'save-buffers-kill-emacs) +(if (daemonp) + (defalias 'exit-emacs #'delete-frame) + (defalias 'exit-emacs #'save-buffers-kill-emacs)) (use-package lacarte :bind (("M-`" . lacarte-execute-menu-command))) -- cgit 1.4.1 From 43fe8ed5db5744133870ea28854de8de9b555a04 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 12:58:59 +0100 Subject: Emacs: remove unnecessary :idle forms --- emacs/init.el | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 09b62313..8bc85e8c 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -238,8 +238,6 @@ Values: `desktop', `server', `laptop'") filename-and-process))))) (use-package uniquify - :defer t - :idle (require 'uniquify) :config (progn (setq uniquify-buffer-name-style 'reverse uniquify-separator "/" @@ -325,18 +323,15 @@ Values: `desktop', `server', `laptop'") :bind (("C-c h" . rgr/toggle-context-help))) (use-package which-func - :defer t - :idle (which-function-mode) - :init (setq which-func-modes t)) + :init (which-function-mode) + :config (setq which-func-modes t)) ;;;; Files (prefer-coding-system 'utf-8-auto-unix) (set-default-coding-systems 'utf-8-auto-unix) (setq-default buffer-file-coding-system 'utf-8-auto-unix) -(use-package autorevert - :defer t - :idle (global-auto-revert-mode 1)) +(global-auto-revert-mode 1) (add-hook 'before-save-hook #'delete-trailing-whitespace) @@ -374,8 +369,6 @@ Values: `desktop', `server', `laptop'") (message "File '%s' successfully removed" filename)))))) (use-package saveplace - :defer t - :idle (require 'saveplace) :config (progn (setq-default save-place t) (setq save-place-file (expand-file-name ".saveplace" user-emacs-directory)))) @@ -463,9 +456,7 @@ Values: `desktop', `server', `laptop'") ;;;; Minibuffer (setq enable-recursive-minibuffers t) -(use-package mb-depth - :defer t - :idle (minibuffer-depth-indicate-mode t)) +(minibuffer-depth-indicate-mode t) (if (daemonp) (defalias 'exit-emacs #'delete-frame) @@ -821,8 +812,6 @@ Also returns nil if pid is nil." (use-package undo-tree :ensure t - :idle (require 'undo-tree) - :defer t :config (progn (global-undo-tree-mode) ;; Keep region when undoing in region -- cgit 1.4.1 From 623ecd835c7fe2500c5ecc8f4c1c5e67568524fc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 13:00:15 +0100 Subject: Emacs: add autoload for mu4e --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index 8bc85e8c..842c6259 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -269,6 +269,7 @@ Values: `desktop', `server', `laptop'") :if (and (eq env/location 'home) (eq env/system-type 'desktop)) :load-path "/usr/share/emacs/site-lisp/mu4e" + :commands (mu4e) :config (progn (setq mu4e-get-mail-command "true" mu4e-update-interval 300 -- cgit 1.4.1 From 99601454e1ec5a7675987a1f0dea69aa96108b49 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 13:56:24 +0100 Subject: Emacs: install quickrun-mode --- emacs/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 842c6259..28f52df2 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -959,6 +959,9 @@ Works with: arglist-cont-nonempty, arglist-close." (- (current-column) 2) (current-column)))))))))) +(use-package quickrun + :ensure t) + ;;;; Web Development (use-package moz -- cgit 1.4.1 From f309dcf76f145ab84ac1fc624d0bd49ce942073d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 15:36:17 +0100 Subject: zsh: use 32-bit wine by default --- zsh/zshrc_prefect | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zsh/zshrc_prefect b/zsh/zshrc_prefect index e86b955b..997ba391 100644 --- a/zsh/zshrc_prefect +++ b/zsh/zshrc_prefect @@ -6,3 +6,5 @@ then eval `ssh-agent | sed -e '/^echo/d'` linkAuthSock $SSH_AUTH_SOCK fi + +export WINEARCH="win32" \ No newline at end of file -- cgit 1.4.1 From 7c20d9e6e237b1c1e9cb1ac7f1e7174a6fda5a1f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 15:36:59 +0100 Subject: Xbindkeys: Remove binding for xbindkeys_show --- xbindkeysrc.scm | 3 --- 1 file changed, 3 deletions(-) diff --git a/xbindkeysrc.scm b/xbindkeysrc.scm index 99e78cb6..e44500f1 100644 --- a/xbindkeysrc.scm +++ b/xbindkeysrc.scm @@ -47,9 +47,6 @@ ;; (remove-all-keys) ;; (debug) - -(xbindkey '(control shift q) "xbindkeys_show") - (xbindkey '(mod4 F9) "mpc toggle") (xbindkey '(mod4 F10) "mpc prev") (xbindkey '(mod4 F11) "mpc next") -- cgit 1.4.1 From 28fc7ea231b5a5c28186000c535380e7f086881c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 15:48:07 +0100 Subject: Emacs: remove unmaintained tromey ELPA repository --- emacs/init.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 28f52df2..6957818c 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -43,8 +43,7 @@ Values: `desktop', `server', `laptop'") ;;;; Package Management (setq *elisp-dir* (expand-file-name "elisp/" user-emacs-directory) - package-archives '(("ELPA" . "http://tromey.com/elpa/") - ("gnu" . "http://elpa.gnu.org/packages/") + package-archives '(("gnu" . "http://elpa.gnu.org/packages/") ("marmalade" . "http://marmalade-repo.org/packages/") ("melpa" . "http://melpa.milkbox.net/packages/"))) -- cgit 1.4.1 From 928c7723f2375c6c39107113986c74f936519439 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 16:00:06 +0100 Subject: Emacs: add official org-mode package repository --- emacs/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 6957818c..d96b25ad 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -45,7 +45,8 @@ Values: `desktop', `server', `laptop'") (setq *elisp-dir* (expand-file-name "elisp/" user-emacs-directory) package-archives '(("gnu" . "http://elpa.gnu.org/packages/") ("marmalade" . "http://marmalade-repo.org/packages/") - ("melpa" . "http://melpa.milkbox.net/packages/"))) + ("melpa" . "http://melpa.milkbox.net/packages/") + ("org" . "http://orgmode.org/elpa/"))) (package-initialize) -- cgit 1.4.1 From dedb10c3319ae3dc67e75126c9c610c7af2cdaf5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 16:01:30 +0100 Subject: Emacs: remove workaround for compile errors from diminish --- emacs/init.el | 4 ---- 1 file changed, 4 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index d96b25ad..3f00d346 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -61,10 +61,6 @@ Values: `desktop', `server', `laptop'") (require 'use-package) -(eval-when-compile - (unless (fboundp 'diminish) - (require 'diminish nil t))) - ;;;; Style (use-package linum -- cgit 1.4.1 From 0237a514e03c62b32680c7b9f5a4571f37b6b125 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 16:06:40 +0100 Subject: Emacs: remove eldoc-context --- emacs/elisp/eldoc-context.el | 40 ---------------------------------------- emacs/init.el | 3 --- 2 files changed, 43 deletions(-) delete mode 100644 emacs/elisp/eldoc-context.el diff --git a/emacs/elisp/eldoc-context.el b/emacs/elisp/eldoc-context.el deleted file mode 100644 index df8797f2..00000000 --- a/emacs/elisp/eldoc-context.el +++ /dev/null @@ -1,40 +0,0 @@ -(provide 'eldoc-context) - -(defun rgr/toggle-context-help () - "Turn on or off the context help. -Note that if ON and you hide the help buffer then you need to -manually reshow it. A double toggle will make it reappear" - (interactive) - (with-current-buffer (help-buffer) - (unless (local-variable-p 'context-help) - (set (make-local-variable 'context-help) t)) - (if (setq context-help (not context-help)) - (progn - (if (not (get-buffer-window (help-buffer))) - (display-buffer (help-buffer))))) - (message "Context help %s" (if context-help "ON" "OFF")))) - -(defun rgr/context-help () - "Display function or variable at point in *Help* buffer if visible. -Default behaviour can be turned off by setting the buffer local -context-help to false" - (interactive) - (let ((rgr-symbol (symbol-at-point))) ; symbol-at-point http://www.emacswiki.org/cgi-bin/wiki/thingatpt%2B.el - (with-current-buffer (help-buffer) - (unless (local-variable-p 'context-help) - (set (make-local-variable 'context-help) t)) - (if (and context-help (get-buffer-window (help-buffer)) - rgr-symbol) - (if (fboundp rgr-symbol) - (describe-function rgr-symbol) - (if (boundp rgr-symbol) (describe-variable rgr-symbol))))))) - -(defadvice eldoc-print-current-symbol-info - (around eldoc-show-c-tag activate) - (cond - ((eq major-mode 'emacs-lisp-mode) (rgr/context-help) ad-do-it) - ((eq major-mode 'lisp-interaction-mode) (rgr/context-help) ad-do-it) - ((eq major-mode 'apropos-mode) (rgr/context-help) ad-do-it) - (t ad-do-it))) - -(global-set-key (kbd "C-c h") 'rgr/toggle-context-help) \ No newline at end of file diff --git a/emacs/init.el b/emacs/init.el index 3f00d346..face66d6 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -316,9 +316,6 @@ Values: `desktop', `server', `laptop'") (concat user-emacs-directory "info")) -(use-package eldoc-context - :bind (("C-c h" . rgr/toggle-context-help))) - (use-package which-func :init (which-function-mode) :config (setq which-func-modes t)) -- cgit 1.4.1 From 95830ed17e5e64e4eb4fcdd755eb05677eb580b8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 16:21:51 +0100 Subject: Emacs: make JIT fontification faster --- emacs/init.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index face66d6..3ab0700f 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -90,8 +90,9 @@ Values: `desktop', `server', `laptop'") (global-font-lock-mode t) ;; Allow font-lock-mode to do background parsing (setq jit-lock-stealth-time 1 - jit-lock-stealth-load 5 - jit-lock-defer-time 0.1) + jit-lock-stealth-load 100 + jit-lock-chunk-size 1000 + jit-lock-defer-time 0.01) (use-package solarized-theme :ensure t -- cgit 1.4.1 From 41d5123ac903f11518ee8dfbda79a69750ba1698 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 17:26:47 +0100 Subject: Emacs: enable init.el to be batch byte-compiled --- emacs/init.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 3ab0700f..08a793f7 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -48,7 +48,8 @@ Values: `desktop', `server', `laptop'") ("melpa" . "http://melpa.milkbox.net/packages/") ("org" . "http://orgmode.org/elpa/"))) -(package-initialize) +(eval-and-compile + (package-initialize)) (add-to-list 'load-path *elisp-dir*) @@ -59,7 +60,8 @@ Values: `desktop', `server', `laptop'") diminish use-package)) -(require 'use-package) +(eval-and-compile + (require 'use-package)) ;;;; Style -- cgit 1.4.1 From 9c6faab4adf09bd93e3ae84174df220538fa9a0b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 17:48:48 +0100 Subject: Add git hooks to recompile emacs init file and elisp directory --- git-hooks/post-checkout | 6 ++++++ install | 1 + 2 files changed, 7 insertions(+) create mode 100755 git-hooks/post-checkout diff --git a/git-hooks/post-checkout b/git-hooks/post-checkout new file mode 100755 index 00000000..dfceaee2 --- /dev/null +++ b/git-hooks/post-checkout @@ -0,0 +1,6 @@ +#!/usr/bin/env zsh +if [[ -x =emacs ]] +then + emacs --batch -f batch-byte-compile ~/.emacs.d/init.el + emacs --batch -f batch-byte-compile ~/.emacs.d/elisp/*.el +fi diff --git a/install b/install index d7e89c0f..0596b3e4 100755 --- a/install +++ b/install @@ -33,6 +33,7 @@ install-dot () { done } +install-dot dotfiles/.git/hooks/ dotfiles/git-hooks/* install-dot .emacs.d/ dotfiles/emacs/* install-dot . dotfiles/^install(.) dotfiles/zsh/zshrc install-dot .ssh/ dotfiles/ssh/* -- cgit 1.4.1 From 5649afdf7e4ab16bbbe8f9fb9c487125efa76b5f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 21:00:12 +0100 Subject: Migrate zsh file compilation to post-checkout hook --- git-hooks/post-checkout | 26 ++++++++++++++++++++++++++ zsh/zshrc | 23 +---------------------- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/git-hooks/post-checkout b/git-hooks/post-checkout index dfceaee2..910716f7 100755 --- a/git-hooks/post-checkout +++ b/git-hooks/post-checkout @@ -4,3 +4,29 @@ then emacs --batch -f batch-byte-compile ~/.emacs.d/init.el emacs --batch -f batch-byte-compile ~/.emacs.d/elisp/*.el fi + +fasd_cache=~/.zsh/cache/fasd-init-zsh +if [[ ! -s "$fasd_cache" || zsh/functions/fasd -nt "$fasd_cache" ]]; then + zsh/functions/fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache" +fi + +autoload -U zrecompile +local -a zfiles +zfiles=( + zsh/functions/fasd/fasd + $fasd_cache + zsh/zshrc + zsh/zshrc_${HOST%%.*} +) +if [[ -e /usr/bin/emerge ]]; then + zfiles+=zsh/zshrc_gentoo +fi +if [[ $OSTYPE == freebsd ]]; then + zfiles+=zsh/zshrc_freebsd +fi + +zrecompile -p -R ~/.zshrc.zwc $zfiles + +for fp in zsh/functions/*(/); do + zrecompile -p $fp $fp/* +done diff --git a/zsh/zshrc b/zsh/zshrc index e47adaf3..9437fcc8 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -340,30 +340,9 @@ smart_compile () { fi } -host=${HOST%%.*} -if [[ -e ~alan/dotfiles/zsh/zshrc_$host ]]; then - # Don't recompile as toor|root - smart_compile ~alan/dotfiles/zsh/zshrc_$host 1 -fi -if [[ -e /usr/bin/emerge ]]; then - smart_compile ~alan/dotfiles/zsh/zshrc_gentoo 1 -elif [[ $freebsd -eq 1 ]]; then - smart_compile ~alan/dotfiles/zsh/zshrc_freebsd 1 -fi - -for fp in $myfuncs; do - zrecompile -p $fp $fp/* -done - _FASD_DATA="$HOME/.zsh/fasd-data" -fasd_cache="$HOME/.zsh/cache/fasd-init-zsh" autoload -U fasd -if [[ ! -s "$fasd_cache" || ~alan/dotfiles/zsh/functions/fasd -nt "$fasd_cache" ]]; then - fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache" -fi -smart_compile "$fasd_cache" 1 -unset fasd_cache +source ~/.zsh/cache/fasd-init-zsh alias e="f -e $EDITOR" -smart_compile ~/.zshrc alias s="smart_sudo " -- cgit 1.4.1 From 40d623657794a009617ca0b28634649914870d02 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 21:16:52 +0100 Subject: Migrate post-checkout hook code to install and run install from post-checkout hook --- git-hooks/post-checkout | 32 +------------------------------- install | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/git-hooks/post-checkout b/git-hooks/post-checkout index 910716f7..96f22007 100755 --- a/git-hooks/post-checkout +++ b/git-hooks/post-checkout @@ -1,32 +1,2 @@ #!/usr/bin/env zsh -if [[ -x =emacs ]] -then - emacs --batch -f batch-byte-compile ~/.emacs.d/init.el - emacs --batch -f batch-byte-compile ~/.emacs.d/elisp/*.el -fi - -fasd_cache=~/.zsh/cache/fasd-init-zsh -if [[ ! -s "$fasd_cache" || zsh/functions/fasd -nt "$fasd_cache" ]]; then - zsh/functions/fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache" -fi - -autoload -U zrecompile -local -a zfiles -zfiles=( - zsh/functions/fasd/fasd - $fasd_cache - zsh/zshrc - zsh/zshrc_${HOST%%.*} -) -if [[ -e /usr/bin/emerge ]]; then - zfiles+=zsh/zshrc_gentoo -fi -if [[ $OSTYPE == freebsd ]]; then - zfiles+=zsh/zshrc_freebsd -fi - -zrecompile -p -R ~/.zshrc.zwc $zfiles - -for fp in zsh/functions/*(/); do - zrecompile -p $fp $fp/* -done +exec "$GIT_DIR/../install" diff --git a/install b/install index 0596b3e4..96ea4410 100755 --- a/install +++ b/install @@ -43,3 +43,35 @@ then fi popd + +if [[ -x =emacs ]] +then + emacs --batch -f batch-byte-compile ~/.emacs.d/init.el + emacs --batch -f batch-byte-compile ~/.emacs.d/elisp/*.el +fi + +fasd_cache=~/.zsh/cache/fasd-init-zsh +if [[ ! -s "$fasd_cache" || zsh/functions/fasd -nt "$fasd_cache" ]]; then + zsh/functions/fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache" +fi + +autoload -U zrecompile +local -a zfiles +zfiles=( + zsh/functions/fasd/fasd + $fasd_cache + zsh/zshrc + zsh/zshrc_${HOST%%.*} +) +if [[ -e /usr/bin/emerge ]]; then + zfiles+=zsh/zshrc_gentoo +fi +if [[ $OSTYPE == freebsd ]]; then + zfiles+=zsh/zshrc_freebsd +fi + +zrecompile -p -R ~/.zshrc.zwc $zfiles + +for fp in zsh/functions/*(/); do + zrecompile -p $fp $fp/* +done -- cgit 1.4.1 From 929b15f975cba6515e44abe35c0ff2e807bc7be1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 21:21:56 +0100 Subject: Use post-merge hook instead of post-checkout --- git-hooks/post-checkout | 2 -- git-hooks/post-merge | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100755 git-hooks/post-checkout create mode 100755 git-hooks/post-merge diff --git a/git-hooks/post-checkout b/git-hooks/post-checkout deleted file mode 100755 index 96f22007..00000000 --- a/git-hooks/post-checkout +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env zsh -exec "$GIT_DIR/../install" diff --git a/git-hooks/post-merge b/git-hooks/post-merge new file mode 100755 index 00000000..96f22007 --- /dev/null +++ b/git-hooks/post-merge @@ -0,0 +1,2 @@ +#!/usr/bin/env zsh +exec "$GIT_DIR/../install" -- cgit 1.4.1 From f863fa4ec320235719957b4309ca0e94d63b6d9d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 21:31:25 +0100 Subject: Emacs: download package lists if nonexistant to ease bootstrapping --- emacs/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 08a793f7..c64a6ce3 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -51,6 +51,9 @@ Values: `desktop', `server', `laptop'") (eval-and-compile (package-initialize)) +(when (not package-archive-contents) + (package-refresh-contents)) + (add-to-list 'load-path *elisp-dir*) (mapc (lambda (package-name) -- cgit 1.4.1 From 3c1096586c0469e025d3e2559589559b1dae3945 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 21:33:43 +0100 Subject: Fix typo in install --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index 96ea4410..efc03cb9 100755 --- a/install +++ b/install @@ -52,7 +52,7 @@ fi fasd_cache=~/.zsh/cache/fasd-init-zsh if [[ ! -s "$fasd_cache" || zsh/functions/fasd -nt "$fasd_cache" ]]; then - zsh/functions/fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache" + zsh/functions/fasd/fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache" fi autoload -U zrecompile -- cgit 1.4.1 From 2815b63c2be710ebf9d77104e2a0ae1a9f1f925d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 21:35:18 +0100 Subject: Make fasd function executable --- zsh/functions/fasd/fasd | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 zsh/functions/fasd/fasd diff --git a/zsh/functions/fasd/fasd b/zsh/functions/fasd/fasd old mode 100644 new mode 100755 -- cgit 1.4.1 From 98500a2e5f73f72d4b120ef98cab40f8a225d212 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 21:38:21 +0100 Subject: Emacs: set package-archives whilst compiling for bootstrapping awesomeness --- emacs/init.el | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index c64a6ce3..46ecbdec 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -42,19 +42,17 @@ Values: `desktop', `server', `laptop'") (setq env/location (env/get-location))) ;;;; Package Management -(setq *elisp-dir* (expand-file-name "elisp/" user-emacs-directory) - package-archives '(("gnu" . "http://elpa.gnu.org/packages/") - ("marmalade" . "http://marmalade-repo.org/packages/") - ("melpa" . "http://melpa.milkbox.net/packages/") - ("org" . "http://orgmode.org/elpa/"))) - (eval-and-compile + (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") + ("marmalade" . "http://marmalade-repo.org/packages/") + ("melpa" . "http://melpa.milkbox.net/packages/") + ("org" . "http://orgmode.org/elpa/"))) (package-initialize)) (when (not package-archive-contents) (package-refresh-contents)) -(add-to-list 'load-path *elisp-dir*) +(add-to-list 'load-path (expand-file-name "elisp/" user-emacs-directory)) (mapc (lambda (package-name) (unless (package-installed-p package-name) -- cgit 1.4.1 From d67bf2ed02d312a943caa11c13a65cd20ca9aba3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 21:39:31 +0100 Subject: Emacs: remove unused web-vcs --- emacs/elisp/web-vcs.el | 2342 ------------------------------------------------ 1 file changed, 2342 deletions(-) delete mode 100644 emacs/elisp/web-vcs.el diff --git a/emacs/elisp/web-vcs.el b/emacs/elisp/web-vcs.el deleted file mode 100644 index 1e2c3226..00000000 --- a/emacs/elisp/web-vcs.el +++ /dev/null @@ -1,2342 +0,0 @@ -;;; web-vcs.el --- Download file trees from VCS web pages -;; -;; Author: Lennart Borgman (lennart O borgman A gmail O com) -;; Created: 2009-11-26 Thu -(defconst web-vcs:version "0.62") ;; Version: -;; Last-Updated: 2011-03-12 Sat -;; URL: -;; Keywords: -;; Compatibility: -;; -;; Features that might be required by this library: -;; -;; `advice', `advice-preload', `backquote', `bytecomp', `cus-edit', -;; `cus-face', `cus-load', `cus-start', `help-fns', `ietf-drums', -;; `mail-parse', `mail-prsvr', `mm-bodies', `mm-decode', -;; `mm-encode', `mm-util', `rfc2045', `rfc2047', `rfc2231', -;; `timer', `web-autoload', `wid-edit'. -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Commentary: -;; -;; Update file trees within Emacs from VCS systems using information -;; on their web pages. -;; -;; Available download commands are currently: -;; -;; `web-vcs-nxhtml' -;; -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Change log: -;; -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation; either version 3, or -;; (at your option) any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this program; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth -;; Floor, Boston, MA 02110-1301, USA. -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Code: - -(eval-when-compile (require 'cl)) -(eval-when-compile (require 'compile)) -(eval-and-compile (require 'cus-edit)) -(eval-and-compile (require 'mm-decode)) -(eval-when-compile (require 'url-http)) - -(require 'advice) -(require 'web-autoload nil t) -;; (require 'url-util) -;; (require 'url) -;;(require 'url-parse) - -(defvar web-vcs-comp-dir nil) - -(defgroup web-vcs nil - "Customization group for web-vcs." - :group 'nxhtml) - -(defcustom web-vcs-links-regexp - `( - (lp-1-10 ;; Id - ;; Comment: - "http://www.launchpad.com/ uses this 2009-11-29 with Loggerhead 1.10 (generic?)" - ;; Files URL regexp: - ;; - ;; Extend this format to catch date/time too. - ;; - ;; ((patt (rx ...)) - ;; ;; use subexp numbers - ;; (url 1) - ;; (time 2) - ;; (rev 3)) - - ((time 1) - (url 2) - (patt ,(rx-to-string '(and "" - (submatch (regexp "[^<]*")) - "" - (0+ space) - "" - (regexp ".+") - "" - (*? (regexp ".\\|\n")) - "href=\"" - (submatch (regexp ".*/download/[^\"]*")) - "\"")))) - ;; Dirs URL regexp: - ,(rx-to-string '(and "href=\"" - (group (regexp ".*%3A/[^\"]*/")) - "\"")) - ;; File name URL part regexp: - "\\([^\/]*\\)$" - ;; Page revision regexp: - ,(rx-to-string '(and "for revision" - (+ whitespace) - "" - (submatch (+ digit)) - "")) - ;; Release revision regexp: - ,(rx-to-string '(and "/" - (submatch (+ digit)) - "\"" (+ (not (any ">"))) ">" - (optional "Release ") - (+ digit) "." (+ digit) "<")) - ) - (lp ;; Id - ;; Comment: - "http://www.launchpad.com/ uses this 2010-06-26 with Loggerhead 1.17 (generic?)" - ;; Files URL regexp: - ;; - ;; Extend this format to catch date/time too. - ;; - ;; ((patt (rx ...)) - ;; ;; use subexp numbers - ;; (url 1) - ;; (time 2) - ;; (rev 3)) - ((time 1) - (url 2) - (patt ,(rx-to-string '(and "" - (submatch - (*\? - (not (any "<")))) - "" - (*? anything) - "") - ;;(and "href=\"" (group (regexp ".*%3A/[^\"]*/")) "\"") - ) - ;; File name URL part regexp: - "\\([^\/]*\\)$" - ;; Page revision regexp: - ,(rx-to-string '(and "for revision" - (+ whitespace) - "" - (submatch (+ digit)) - "")) - ;; Release revision regexp: - ,(rx-to-string '(and "/" - (submatch (+ digit)) - "\"" (+ (not (any ">"))) ">" - (optional "Release ") - (+ digit) "." (+ digit) "<")) - ) - ) - "Regexp patterns for matching links on a VCS web page. -The patterns are grouped by VCS web system type. - -\\ -To make a new pattern you can do like this: - -- Open the file in Firefox. -- View the buffer source in Emacs in some way. -- Turn on `mozadd-mirror-mode'. -- Use the command `mozadd-init-href-patten'. -- Then start `re-builder' to refine the pattern. - (Or, use isearch if you prefer that.) -- Use `ourcomments-copy-target-region-to-reb' for - easy copying from target buffer to re-builder. -- To see what you patterns matches in the web page - use `M-x mozadd-update-mozilla'. -- If the page looks terrible then add a - tag by doing `M-x mozadd-add-href-base'. - -*Note: It is always sub match 1 from these patterns that are - used." - :type '(repeat - (list - (symbol :tag "VCS web system type specifier") - (string :tag "Description") - (set (list (const time) integer) - (list (const url) integer) - (list (const patt) regexp)) - ;;(regexp :tag "Files URL regexp") - (regexp :tag "Dirs URL regexp") - (regexp :tag "File name URL part regexp") - (regexp :tag "Page revision regexp") - (regexp :tag "Release revision regexp") - )) - :group 'web-vcs) - -(defface web-vcs-mode-line - '((t (:foreground "black" :background "OrangeRed"))) - "Mode line face during download." - :group 'web-vcs) - -(defface web-vcs-mode-line-inactive - '((t (:foreground "black" :background "Orange"))) - "Mode line face during download." - :group 'web-vcs) - -(defface web-vcs-gold - '((t (:foreground "black" :background "gold"))) - "Face for web-vcs messages." - :group 'web-vcs) - -(defface web-vcs-red - '((t (:foreground "black" :background "#f86"))) - "Face for web-vcs messages." - :group 'web-vcs) - -(defface web-vcs-green - '((t (:foreground "black" :background "#8f6"))) - "Face for web-vcs messages." - :group 'web-vcs) - -(defface web-vcs-yellow - '((t (:foreground "black" :background "yellow"))) - "Face for web-vcs messages." - :group 'web-vcs) - -(defface web-vcs-pink - '((t (:foreground "black" :background "pink"))) - "Face for web-vcs messages." - :group 'web-vcs) - -(defcustom web-vcs-default-download-directory - "~/.emacs.d/" - "Default download directory." - :type '(choice (const :tag "~/.emacs.d/" "~/.emacs.d/") - (const :tag "Fist site-lisp in `load-path'" site-lisp-dir) - (const :tag "Directory where `site-run-file' lives" site-run-dir) - (string :tag "Specify directory")) - :group 'web-vcs) - -;;(web-vcs-default-download-directory) -;;;###autoload -(defun web-vcs-default-download-directory () - "Try to find a suitable place. -Use the choice in `web-vcs-default-download-directory'. -If this does not fit fall back to \"~/.emacs.d/\"." - (let* ((site-run-dir (when site-run-file - (let ((lib (locate-library site-run-file))) - (when lib - (file-name-directory lib))))) - (site-lisp-dir (catch 'first-site-lisp - (dolist (d load-path) - (let ((dir (file-name-nondirectory (directory-file-name d)))) - (when (string= dir "site-lisp") - (throw 'first-site-lisp (file-name-as-directory d))))))) - (dummy (message "site-run-dir=%S site-lisp-dir=%S" site-run-dir site-lisp-dir)) - (dir (or (case web-vcs-default-download-directory - ;;('~/.emacs.d/ "~/.emacs.d/") - ('site-lisp-dir site-lisp-dir) - ('site-run-dir site-run-dir)) - web-vcs-default-download-directory))) - (or dir "~/.emacs.d/"))) - - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Logging - -(defcustom web-vcs-log-file "~/.emacs.d/web-vcs-log.org" - "Log file for web-vcs." - :type 'file - :group 'web-vcs) - -;;;###autoload -(defun web-vcs-log-edit () - "Open log file." - (interactive) - (find-file web-vcs-log-file)) - -(defvar web-vcs-log-save-timer nil) - -(defun web-vcs-log-save-when-idle () - (when (timerp web-vcs-log-save-timer) (cancel-timer web-vcs-log-save-timer)) - (run-with-idle-timer 0 nil 'web-vcs-log-save)) - -(defun web-vcs-log-save () - (let ((log-buf (find-buffer-visiting web-vcs-log-file))) - (when (and log-buf (buffer-modified-p log-buf)) - (with-current-buffer log-buf - (basic-save-buffer))) - log-buf)) - -(defun web-vcs-log-close () - (let ((log-buf (web-vcs-log-save))) - (when log-buf - (kill-buffer log-buf)))) - -;; Fix-me: Add some package descriptor to log -(defun web-vcs-log (url dl-file msg) - (unless (file-exists-p web-vcs-log-file) - (let ((dir (file-name-directory web-vcs-log-file))) - (unless (file-directory-p dir) - (make-directory dir)))) - (with-current-buffer (find-file-noselect web-vcs-log-file) - (setq buffer-save-without-query t) - (web-vcs-log-save-when-idle) - (save-restriction - (widen) - (let ((today-entries (format-time-string "* %Y-%m-%d")) - (now (format-time-string "%H:%M:%S GMT" nil t))) - (goto-char (point-max)) - (unless (re-search-backward (concat "^" today-entries) nil t) - (goto-char (point-max)) - (insert "\n" today-entries "\n")) - (goto-char (point-max)) - (when url - (insert "** Downloading file " now "\n" - (format " file [[file:%s][%s]]\n from %s\n" dl-file dl-file url) - )) - (cond - ((stringp msg) - (goto-char (point-max)) - (insert msg "\n")) - (msg (basic-save-buffer))))))) - - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Finding and downloading files - -;;;###autoload -(defun web-vcs-get-files-from-root (web-vcs full-url dl-dir) - "Download a file tree from VCS system using the web interface. -Use WEB-VCS entry in variable `web-vcs-links-regexp' to download -files via http from FULL-URL to directory DL-DIR. - -Show FULL-URL first and offer to visit the page. That page will -give you information about version control system \(VCS) system -used etc." - (unless (web-vcs-contains-moved-files dl-dir) - (let ((resize-mini-windows (or resize-mini-windows t))) - (when (if (not (y-or-n-p (concat "Download files from \"" full-url "\".\n" - "You can see on that page which files will be downloaded.\n\n" - "Visit that page before downloading? "))) - t - (browse-url full-url) - (if (y-or-n-p "Start downloading? ") - t - (message "Aborted") - nil)) - (message "") - (web-vcs-get-files-on-page web-vcs full-url t (file-name-as-directory dl-dir) nil) - t)))) - -(defun web-vcs-get-files-on-page (web-vcs page-url recursive dl-dir test) - "Download files listed by WEB-VCS on web page PAGE-URL. -WEB-VCS is a specifier in `web-vcs-links-regexp'. - -If RECURSIVE go into sub folders on the web page and download -files from them too. - -Place the files under DL-DIR. - -Before downloading check if the downloaded revision already is -the same as the one on the web page. This is stored in the file -web-vcs-revision.txt. After downloading update this file. - -If TEST is non-nil then do not download, just list the files." - (unless (string= dl-dir (file-name-as-directory (expand-file-name dl-dir))) - (error "Download dir dl-dir=%S must be a full directory path" dl-dir)) - (catch 'command-level - (when (web-vcs-contains-moved-files dl-dir) - (throw 'command-level nil)) - (let ((vcs-rec (or (assq web-vcs web-vcs-links-regexp) - (error "Does not know web-cvs %S" web-vcs))) - (start-time (current-time))) - (unless (file-directory-p dl-dir) - (if (yes-or-no-p (format "Directory %S does not exist, create it? " - (file-name-as-directory - (expand-file-name dl-dir)))) - (make-directory dl-dir t) - (message "Can't download then") - (throw 'command-level nil))) - ;; (let ((old-win (selected-window))) - ;; (unless (eq (get-buffer "*Messages*") (window-buffer old-win)) - ;; (switch-to-buffer-other-window "*Messages*")) - ;; (goto-char (point-max)) - ;; (insert "\n") - ;; (insert (propertize (format "\n\nWeb-Vcs Download: %S\n" page-url) 'face 'web-vcs-gold)) - ;; (insert "\n") - ;; (redisplay t) - ;; (set-window-point (selected-window) (point-max)) - ;; (select-window old-win)) - (web-vcs-message-with-face 'web-vcs-gold "\n\nWeb-Vcs Download: %S\n" page-url) - (web-vcs-display-messages nil) - (let* ((rev-file (expand-file-name "web-vcs-revision.txt" dl-dir)) - (rev-buf (find-file-noselect rev-file)) - ;; Fix-me: Per web vcs speficier. - (old-rev-range (with-current-buffer rev-buf - (widen) - (goto-char (point-min)) - (when (re-search-forward (format "%s:\\(.*\\)\n" web-vcs) nil t) - ;;(buffer-substring-no-properties (point-min) (line-end-position)) - ;;(match-string 1) - (cons (match-beginning 1) (match-end 1)) - ))) - (old-revision (when old-rev-range - (with-current-buffer rev-buf - (buffer-substring-no-properties (car old-rev-range) - (cdr old-rev-range))))) - (dl-revision (web-vcs-get-revision-on-page vcs-rec page-url)) - ret - moved) - (when (and old-revision (string= old-revision dl-revision)) - (when (y-or-n-p (format "You already have revision %s. Quit? " dl-revision)) - (message "Aborted") - (kill-buffer rev-buf) - (throw 'command-level nil))) - ;; We do not have a revision number once we start download. - (with-current-buffer rev-buf - (when old-rev-range - (delete-region (car old-rev-range) (cdr old-rev-range)) - (basic-save-buffer))) - (setq ret (web-vcs-get-files-on-page-1 - vcs-rec page-url - dl-dir - "" - nil - (if recursive 0 nil) - dl-revision - test - 0)) - (setq moved (nth 1 ret)) - ;; Now we have a revision number again. - (with-current-buffer rev-buf - (when (= 0 (buffer-size)) - (insert "WEB VCS Revisions\n\n")) - (goto-char (point-max)) - (unless (eolp) (insert "\n")) - (insert (format "%s:%s\n" web-vcs dl-revision)) - (basic-save-buffer) - (kill-buffer)) - (message "-----------------") - (web-vcs-message-with-face 'web-vcs-gold "Web-Vcs Download Ready: %S" page-url) - (web-vcs-message-with-face 'web-vcs-gold " Time elapsed: %S" - (web-vcs-nice-elapsed start-time (current-time))) - (when (> moved 0) - (web-vcs-message-with-face 'web-vcs-yellow - " %i files updated (old versions renamed to *.moved)" - moved)))))) - -(defun web-vcs-get-files-on-page-1 (vcs-rec page-url dl-root dl-relative file-mask recursive dl-revision test num-files) - "Download files listed by VCS-REC on web page page-URL. -VCS-REC should be an entry like the entries in the list -`web-vcs-links-regexp'. - -If FILE-MASK is non-nil then it is used to match a file relative -path. Only matching files will be downloaded. FILE-MASK can -have two forms, a regular expression or a function. - -If FILE-MASK is a regular expression then each part of the path -may be a regular expresion \(not containing /). - -If FILE-MASK is a function then this function is called in each -directory under DL-ROOT. The function is called with the -directory as a parameter and should return a cons. The first -element of the cons should be a regular expression matching file -names in that directory that should be downloaded. The cdr -should be t if subdirectories should be visited. - -If RECURSIVE go into sub folders on the web page and download -files from them too. - -Place the files under DL-DIR. - -The revision on the page page-URL should match DL-REVISION if this is non-nil. - -If TEST is non-nil then do not download, just list the files" - ;;(web-vcs-message-with-face 'font-lock-comment-face "web-vcs-get-files-on-page-1 %S %S %S %S" page-url dl-root dl-relative file-mask) - (let* ((files-matcher (nth 2 vcs-rec)) - (dirs-href-regexp (nth 3 vcs-rec)) - (revision-regexp (nth 5 vcs-rec)) - ;; (setq x (url-generic-parse-url "http://somewhere.com/file/path.el")) - ;; (setq x (url-generic-parse-url "http://somewhere.com")) - ;; (setq x (url-generic-parse-url "/somewhere.com")) - ;; (url-type x) - ;; (url-host x) - ;; (url-filename x) - ;; (url-fullness x) - ;; (url-port x) - ;; (setq y (url-expand-file-name "/suburl/other.el" x)) - ;; (setq y (url-expand-file-name "http://other.com/suburl/other.el" x)) - ;;(page-urlobj (url-generic-parse-url page-url)) - ;;(page-url-fullness (or (url-fullness page-urlobj) (error "Incomplete URL: %S" page-url))) - ;;(page-url-host (url-host page-urlobj)) - ;;(page-url-type (url-type page-urlobj)) - ;;(page-url-file (url-filename page-urlobj)) - ;;(page-host-url (concat page-url-type "://" page-url-host)) - (dl-dir (file-name-as-directory (expand-file-name dl-relative dl-root))) - (lst-dl-relative (web-vcs-file-name-as-list dl-relative)) - (lst-file-mask (when (stringp file-mask) (web-vcs-file-name-as-list file-mask))) - ;;(url-buf (url-retrieve-synchronously page-url)) - this-page-revision - files - suburls - (moved 0) - (temp-file-base (expand-file-name "web-vcs-temp-list.tmp" dl-dir)) - temp-list-file - temp-list-buf - folder-res - http-sts) - ;; Fix-me: It looks like there is maybe a bug in url-copy-file so - ;; that it runs synchronously. Try to workaround the problem by - ;; making a new file temp file name. - (web-vcs-display-messages nil) - (unless (file-directory-p dl-dir) (make-directory dl-dir t)) - ;;(message "TRACE: dl-dir=%S" dl-dir) - (setq temp-list-file (make-temp-name temp-file-base)) - (setq temp-list-buf (web-vcs-ass-folder-cache page-url)) - (unless temp-list-buf - ;;(setq temp-list-buf (generate-new-buffer "web-wcs-folder")) - ;;(web-vcs-url-copy-file-and-check page-url temp-list-file nil) - (let ((ready nil)) - (while (not ready) - (setq folder-res (web-vcs-url-retrieve-synch page-url)) - ;; (with-current-buffer temp-list-buf - ;; (insert-file-contents temp-list-file)) - (if (memq (cdr folder-res) '(200 201)) - (setq ready t) - (web-vcs-message-with-face 'web-vcs-red "Could not get %S" page-url) - (web-vcs-display-messages t) - (when (y-or-n-p (format "Could not get %S, visit page to see what is wrong? " page-url)) - (browse-url page-url)) - (unless (y-or-n-p "Try again? (It is safe to break here and try again later.) ") - (throw 'command-level nil)))))) - ;;(with-current-buffer temp-list-buf - (with-current-buffer (car folder-res) - ;;(delete-file temp-list-file) - ;;(find-file-noselect temp-list-file) - (when dl-revision - (setq this-page-revision (web-vcs-get-revision-from-url-buf vcs-rec (current-buffer) page-url))) - (when dl-revision - (unless (string= dl-revision this-page-revision) - (web-vcs-message-with-face 'web-vcs-red "Revision on %S is %S, but should be %S" - page-url this-page-revision dl-revision) - (web-vcs-display-messages t) - (throw 'command-level nil))) - ;; Find files - (goto-char (point-min)) - (let ((files-href-regexp (nth 1 (assq 'patt files-matcher))) - (url-num (nth 1 (assq 'url files-matcher))) - (time-num (nth 1 (assq 'time files-matcher)))) - (while (re-search-forward files-href-regexp nil t) - ;; Fix-me: What happened to full url??? - (let* ((file (match-string url-num)) - (time (match-string time-num)) - (full-file (url-expand-file-name file page-url))) - (add-to-list 'files (list full-file time))))) - (when (< (length files) num-files) - (message "files-on-page-1: found %d files, expected %d" (length files) num-files)) - ;; Find subdirs - (when recursive - (goto-char (point-min)) - (while (re-search-forward dirs-href-regexp nil t) - (let* ((suburl (match-string 1)) - (lenurl (length page-url)) - (full-suburl (url-expand-file-name suburl page-url))) - ;;(message "suburl=%S" suburl) - (when (and (> (length full-suburl) lenurl) - (string= (substring full-suburl 0 lenurl) page-url)) - ;;(message "...added") - (add-to-list 'suburls full-suburl))))) - (kill-buffer)) - ;; Download files - ;;(message "TRACE: files=%S" files) - (web-vcs-download-files vcs-rec files dl-dir dl-root) - ;; Download subdirs - (when suburls - (dolist (suburl (reverse suburls)) - (let* ((dl-sub-dir (substring suburl (length page-url))) - (full-dl-sub-dir (file-name-as-directory - (expand-file-name dl-sub-dir dl-dir))) - (rel-dl-sub-dir (file-relative-name full-dl-sub-dir dl-root))) - ;;(message "web-vcs-get-revision-from-url-buf dir: %S %S" file-mask rel-dl-sub-dir) - (when (or (not file-mask) - (not (stringp file-mask)) - (= 1 (length (web-vcs-file-name-as-list file-mask))) - (web-vcs-match-folderwise file-mask rel-dl-sub-dir)) - ;;(message "matched dir %S" rel-dl-sub-dir) - (unless (web-vcs-contains-file dl-dir full-dl-sub-dir) - (error "Subdir %S not in %S" dl-sub-dir dl-dir)) - (let* ((ret (web-vcs-get-files-on-page-1 vcs-rec - suburl - dl-root - rel-dl-sub-dir - file-mask - (1+ recursive) - this-page-revision - test - 0))) - (setq moved (+ moved (nth 1 ret)))))))) - (list this-page-revision moved))) - -(defun web-vcs-get-missing-matching-files (web-vcs url dl-dir file-mask num-files) - "Download missing files from VCS system using the web interface. -Use WEB-VCS entry in variable `web-vcs-links-regexp' to download -files via http from URL to directory DL-DIR. - -FILE-MASK is used to match files that should be downloaded. See -`web-vcs-get-files-on-page-1' for more information. - -Before downloading offer to visit the page from which the -downloading will be made. -" - (unless file-mask (error "file-mask is nil")) - (let ((vcs-rec (or (assq web-vcs web-vcs-links-regexp) - (error "Does not know web-cvs %S" web-vcs)))) - (web-vcs-get-files-on-page-1 vcs-rec url dl-dir "" file-mask 0 nil nil num-files))) - - -;; (web-vcs-get-files-on-page 'lp "http://bazaar.launchpad.net/%7Enxhtml/nxhtml/main/files/head%3A/" t "c:/test/temp13/" t) - -(defvar web-vcs-folder-cache nil) ;; dyn var -(defun web-vcs-add-folder-cache (url buf) - (add-to-list 'web-vcs-folder-cache (list url buf))) -(defun web-vcs-ass-folder-cache (url) - (assoc url web-vcs-folder-cache)) -(defun web-vcs-clear-folder-cache () - (while web-vcs-folder-cache - (let ((ub (car web-vcs-folder-cache))) - (setq web-vcs-folder-cache (cdr web-vcs-folder-cache)) - (kill-buffer (nth 1 ub))))) - -(defun web-vcs-url-copy-file-and-check (file-url dl-file dest-file) - "Copy FILE-URL to DL-FILE. -Log what happened. Use DEST-FILE in the log, not DL-FILE which is -a temporary file." - (let ((http-sts nil) - (file-nonempty nil) - (fail-reason nil)) - (when dest-file (web-vcs-log file-url dest-file nil)) - (web-vcs-display-messages nil) - ;;(message "before url-copy-file %S" dl-file) - (setq http-sts (web-vcs-url-copy-file file-url dl-file nil t)) ;; don't overwrite, keep time - ;;(message "after url-copy-file %S" dl-file) - (if (and (file-exists-p dl-file) - (setq file-nonempty (< 0 (nth 7 (file-attributes dl-file)))) ;; file size 0 - (memq http-sts '(200 201))) - (when dest-file - (web-vcs-log nil nil " Done.\n")) - (setq fail-reason - (cond - (http-sts (format "HTTP %s" http-sts)) - (file-nonempty "File looks bad") - (t "Server did not respond"))) - (unless dest-file (web-vcs-log file-url dl-file "TEMP FILE")) - (web-vcs-log nil nil (format " *Failed:* %s\n" fail-reason)) - ;; Requires user attention and intervention - (web-vcs-message-with-face 'web-vcs-red "Download failed: %s, %S" fail-reason file-url) - (web-vcs-display-messages t) - (when (y-or-n-p (format "Vist page %S to see what is wrong? " file-url)) - (browse-url file-url)) - (message "\n") - (web-vcs-message-with-face 'web-vcs-yellow "Please retry what you did before!\n") - (throw 'command-level nil)))) - -(defvar web-autoload-temp-file-prefix "TEMPORARY-WEB-AUTO-LOAD-") -(defvar web-autoload-active-file-sub-url) ;; Dyn var, active during file download check -(defun web-autoload-acvtive () - (and (boundp 'web-autoload-active-file-sub-url) - web-autoload-active-file-sub-url)) - -(defun web-vcs-download-files (vcs-rec files dl-dir dl-root) - (dolist (file (reverse files)) - (let* ((url-file (nth 0 file)) - (url-file-time-str (nth 1 file)) - ;; date-to-time assumes GMT so this is ok: - (url-file-time (when url-file-time-str (date-to-time url-file-time-str))) - (url-file-name-regexp (nth 4 vcs-rec)) - (url-file-rel-name (progn - (when (string-match url-file-name-regexp url-file) - (match-string 1 url-file)))) - (dl-file-name (expand-file-name url-file-rel-name dl-dir)) - (dl-file-time (nth 5 (file-attributes dl-file-name))) - (file-rel-name (file-relative-name dl-file-name dl-root)) - (file-name (file-name-nondirectory dl-file-name)) - (temp-file (expand-file-name (concat web-autoload-temp-file-prefix file-name) dl-dir)) - temp-buf) - (cond - ;;((and file-mask (not (web-vcs-match-folderwise file-mask file-rel-name)))) - ((and dl-file-time - url-file-time - (progn - ;;(message "dl-file-time =%s" (when dl-file-time (current-time-string dl-file-time))) - ;;(message "url-file-time=%s" (when url-file-time (current-time-string url-file-time))) - ;;(message "url-file-tstr=%s" (when url-file-time url-file-time-str)) - t) - (time-less-p url-file-time - (time-add dl-file-time (seconds-to-time 1)))) - (web-vcs-message-with-face 'web-vcs-green "Local file %s is newer or same age" file-rel-name)) - ;;(test (progn (message "TEST url-file=%S" url-file) (message "TEST url-file-rel-name=%S" url-file-rel-name) (message "TEST dl-file-name=%S" dl-file-name) )) - (t - ;; Avoid trouble with temp file - (while (setq temp-buf (find-buffer-visiting temp-file)) - (set-buffer-modified-p nil) (kill-buffer temp-buf)) - (when (file-exists-p temp-file) (delete-file temp-file)) - ;;(web-vcs-message-with-face 'font-lock-comment-face "Starting url-copy-file %S %S t t" url-file temp-file) - (web-vcs-url-copy-file-and-check url-file temp-file dl-file-name) - ;;(web-vcs-message-with-face 'font-lock-comment-face "Finished url-copy-file %S %S t t" url-file temp-file) - (let* ((time-after-url-copy (current-time)) - (old-buf-open (find-buffer-visiting dl-file-name))) - (when (and old-buf-open (buffer-modified-p old-buf-open)) - (save-excursion - (switch-to-buffer old-buf-open) - (when (y-or-n-p (format "Buffer %S is modified, save to make a backup? " dl-file-name)) - (save-buffer)))) - (if (and dl-file-time (web-vcs-equal-files dl-file-name temp-file)) - (progn - (delete-file temp-file) - (when url-file-time (set-file-times dl-file-name url-file-time)) - (web-vcs-message-with-face 'web-vcs-green "File %S was ok" dl-file-name)) - (when dl-file-time - (let ((backup (concat dl-file-name ".moved"))) - (rename-file dl-file-name backup t))) - ;; Be paranoid and let user check here. I actually - ;; believe that is a very good thing here. - (web-vcs-be-paranoid temp-file dl-file-name file-rel-name) - (rename-file temp-file dl-file-name) - (when url-file-time (set-file-times dl-file-name url-file-time)) - ;; (let ((buf (find-buffer-visiting dl-file-name))) - ;; (when buf - ;; (with-current-buffer buf - ;; (message "before revert-buffer") - ;; (revert-buffer nil t t) - ;; (message "after revert-buffer") - ;; ))) - (if dl-file-time - (web-vcs-message-with-face 'web-vcs-yellow "Updated %S" dl-file-name) - (web-vcs-message-with-face 'web-vcs-green "Downloaded %S" dl-file-name)) - (when old-buf-open - (with-current-buffer old-buf-open - (set-buffer-modified-p nil) - (revert-buffer nil t t))) - (with-current-buffer (find-file-noselect dl-file-name) - (setq header-line-format - (propertize (format-time-string "This file was downloaded %Y-%m-%d %H:%M") - 'face 'web-vcs-green)))) - (web-vcs-display-messages nil) - ;; This is both for user and remote server load. Do not remove this. - (redisplay t) (sit-for (- 1.0 (float-time (time-subtract (current-time) time-after-url-copy)))) - ;; (unless old-buf-open - ;; (when old-buf - ;; (kill-buffer old-buf))) - ))) - (redisplay t)))) - -(defun web-vcs-get-revision-on-page (vcs-rec url) - "Get revision number using VCS-REC on page URL. -VCS-REC should be an entry like the entries in the list -`web-vcs-links-regexp'." - ;; url-insert-file-contents - (let ((url-buf (url-retrieve-synchronously url))) - (web-vcs-get-revision-from-url-buf vcs-rec url-buf url))) - -(defun web-vcs-get-revision-from-url-buf (vcs-rec url-buf rev-page-url) - "Get revision number using VCS-REC. -VCS-REC should be an entry in the list `web-vcs-links-regexp'. -The buffer URL-BUF should contain the content on page -REV-PAGE-URL." - (let ((revision-regexp (nth 5 vcs-rec))) - ;; Get revision number - (with-current-buffer url-buf - (goto-char (point-min)) - (if (not (re-search-forward revision-regexp nil t)) - (progn - (web-vcs-message-with-face 'web-vcs-red "Can't find revision number on %S" rev-page-url) - (web-vcs-display-messages t) - (when (y-or-n-p (format "Coult not find rev no on %S, visit page to see what is wrong? " rev-page-url)) - (browse-url rev-page-url)) - (throw 'command-level nil)) - (match-string 1))))) - - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Auto Download - - -;; fix-me: To emulation-mode-map -;; Fix-me: put this on better keys -(defvar web-vcs-paranoid-state-mode-map - (let ((map (make-sparse-keymap))) - (define-key map [(control ?c)(control ?c)] 'exit-recursive-edit) - (define-key map [(control ?c)(control ?n)] 'web-autoload-continue-no-stop) - (define-key map [(control ?c)(control ?r)] 'web-vcs-investigate-elisp-file) - (define-key map [(control ?c)(control ?q)] 'web-vcs-quit-auto-download) - map)) - -(defun web-vcs-quit-auto-download () - "Quit download process. -This stops the current web autoload processing." - (interactive) - ;; Fix-me. - (when (y-or-n-p "Stop web autoload processing? You can resume it later. ") - (web-vcs-message-with-face 'web-vcs-red - "Stopped autoloading in process. It will be resumed when necessary again.") - (web-vcs-log nil nil "User stopped autoloading") - (throw 'top-level 'web-autoload-stop))) - -(define-minor-mode web-vcs-paranoid-state-mode - "Mode used temporarily during user check of downloaded file. -Do not turn on this yourself." - :lighter (concat " " (propertize "Download file check" 'face 'font-lock-warning-face)) - :global t - :group 'web-vcs - (or (not web-vcs-paranoid-state-mode) - (web-autoload-acvtive) - (error "This mode can't be used when not downloading"))) - -(defcustom web-autoload-paranoid t - "Be paranoid and break to check each file after download." - :type 'boolean - :group 'web-vcs) - -(defun web-autoload-continue-no-stop () - "Continue web auto download. -This is used after inspecting downloaded elisp files. Set -`web-autoload-paranoid' to nil before contiuning to avoid further -breaks to check downloaded files." - (interactive) - (setq web-autoload-paranoid nil) - (web-autoload-continue)) - -(defun web-autoload-continue () - "Continue web auto download. -This is used after inspecting downloaded elisp files." - (interactive) - (if (< 0 (recursion-depth)) - (exit-recursive-edit) - (web-autoload-byte-compile-queue))) - -(defun web-vcs-be-paranoid (temp-file file-dl-name file-sub-url) - "Be paranoid and check FILE-DL-NAME." - (when (or (not (boundp 'web-autoload-paranoid)) - web-autoload-paranoid) - (save-window-excursion - (let* ((comp-buf (get-buffer "*Compilation*")) - (comp-win (and comp-buf - (get-buffer-window comp-buf))) - (msg-win (web-vcs-display-messages nil)) - temp-buf - (kf-desc (lambda (fun) - (let* ((key (where-is-internal fun nil t)) - (k-desc (when key (key-description key))) - (fmt-kf "\n %s (or %s)") - (fmt-f "\n %s")) - (if key - (format fmt-kf k-desc fun) - (format fmt-f fun) - ))))) - (if comp-win - (progn - (select-window comp-win) - (find-file file-dl-name)) - (select-window msg-win) - (find-file-other-window temp-file)) - (setq temp-buf (current-buffer)) - (web-vcs-log-save) - (message "-") - (message "") - (with-selected-window msg-win - (goto-char (point-max))) - (let ((proceed nil) - (web-autoload-active-file-sub-url file-sub-url) ;; Dyn var, active during file download check - (ws (with-current-buffer "*Messages*" (point-marker)))) - (web-vcs-paranoid-state-mode 1) - (web-vcs-message-with-face - 'secondary-selection - (concat "Please check the downloaded file and then continue by doing" - (funcall kf-desc 'exit-recursive-edit) - (if (fboundp 'web-autoload-continue-no-stop) - (concat - "\n\nOr, for no more breaks to check files do" - (funcall kf-desc 'web-autoload-continue-no-stop)) - "") - "\n\nTo stop the web autoloading process for now do" - (funcall kf-desc 'web-autoload-quit-download) - "\n\nTo see the log file you can do" - (funcall kf-desc 'web-vcs-log-edit) - "\n")) - (message "") - (let ((msg-win (car (get-buffer-window-list "*Messages*" nil nil)))) - (when msg-win (set-window-start msg-win ws))) - (while (not proceed) - (condition-case err - (when (eq 'web-autoload-stop - (catch 'top-level - ;; Fix-me: review file before rename! - (setq header-line-format - (propertize - (format "Review for downloading. Continue: C-c C-c%s. Destination: %S" - (if (string= "el" (file-name-extension file-dl-name)) - ", Check: C-c C-r" - "") - file-dl-name) - 'face 'web-vcs-red)) - (unwind-protect - (progn - (recursive-edit)) - (web-vcs-paranoid-state-mode -1)) - (with-current-buffer temp-buf - (set-buffer-modified-p nil) - (kill-buffer temp-buf)) - (setq proceed t))) - (throw 'top-level t)) - (error (message "%s" (error-message-string err)))))) - (web-vcs-display-messages t) - )))) - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Auto Download Compile Queue -;; -;; Downloaded elisp files are placed in a compile queue. They are not -;; compiled until all required elisp files are downloaded (and -;; optionally compiled). -;; -;; This mechanism works through -;; - reading (eval-when-compile ...) etc in the files -;; - a defadviced require that is the driver of the process - -(defvar web-autoload-compile-queue nil) - -(defvar web-autoload-byte-compile-queue-active nil) ;; Dyn var - -(defun web-autoload-byte-compile-file (file load comp-fun) - (if nil ;;(file-exists-p file) - (byte-compile-file file load) - (let ((added-entry (list file load comp-fun nil))) - (if (member added-entry web-autoload-compile-queue) - (setq added-entry nil) - (web-vcs-message-with-face 'web-vcs-gold "Add to compile queue (%S %s)" file load) - (setq web-autoload-compile-queue (cons added-entry - web-autoload-compile-queue))) - (when added-entry - (if web-autoload-byte-compile-queue-active - (throw 'web-autoload-comp-restart t) - (web-autoload-byte-compile-queue)))))) - -;;(web-autoload-byte-compile-queue) -(defun web-autoload-byte-compile-queue () - (let ((top-entry) - (web-autoload-byte-compile-queue-active t)) - (while (and web-autoload-compile-queue - (not (equal top-entry - (car web-autoload-compile-queue)))) - (setq top-entry (car web-autoload-compile-queue)) - (catch 'web-autoload-comp-restart - (web-autoload-byte-compile-first) - (setq web-autoload-compile-queue (cdr web-autoload-compile-queue)))))) - -(defun web-autoload-byte-compile-first () - "Compile first file on compile queue and maybe load it. -Compile the car of `web-autoload-compile-queue' and load if this -entry says so." - (let* ((compiled-it nil) - (first-entry (car web-autoload-compile-queue)) - (el-file (nth 0 first-entry)) - (load (nth 1 first-entry)) - (comp-fun (nth 2 first-entry)) - (req-done (nth 3 first-entry)) - (elc-file (byte-compile-dest-file el-file)) - (need-compile (or (not (file-exists-p elc-file)) - (file-newer-than-file-p el-file elc-file)))) - (if (not need-compile) - nil ;;(when load (load elc-file)) - (unless req-done - (web-autoload-do-eval-requires el-file) - (setcar (nthcdr 3 first-entry) t)) - (when (catch 'web-autoload-comp-restart - (condition-case err - (progn - (web-vcs-message-with-face 'font-lock-comment-face "Start byte compiling %S" el-file) - (web-vcs-message-with-face 'web-vcs-pink "Compiling QUEUE: %S" web-autoload-compile-queue) - (let ((web-autoload-skip-require-advice t)) (funcall comp-fun el-file load)) - (web-vcs-message-with-face 'font-lock-comment-face "Ready byte compiling %S" el-file) - ;; Return nil to tell there are no known problems - (if (file-exists-p elc-file) - nil - (web-vcs-message-with-face - 'web-vcs-red "Error: byte compiling did not produce %S" elc-file) - (web-vcs-display-messages nil) - ;; Clean up before restart - (web-autoload-try-cleanup-after-failed-compile first-entry) - t)) - (error - (web-vcs-message-with-face - 'web-vcs-red "Error in byte compiling %S: %s" el-file (error-message-string err)) - (web-vcs-display-messages nil) - ;; Clean up before restart - (web-autoload-try-cleanup-after-failed-compile first-entry) - t ;; error - ))) - (throw 'web-autoload-comp-restart t) - )))) - -(defun web-autoload-do-eval-requires (el-file) - "Do eval-when-compile and eval-and-compile." - ;;(message "web-autoload-do-eval-requires %S" el-file) - (let ((old-buf (find-buffer-visiting el-file))) - (with-current-buffer (or old-buf (find-file-noselect el-file)) - (let ((here (point)) - (web-autoload-require-skip-noerror-entries t)) - (save-restriction - (widen) - (goto-char (point-min)) - ;;(message "web-autoload-do-eval-requires cb=%s" (current-buffer)) - (while (progn - (while (progn (skip-chars-forward " \t\n\^l") - (looking-at ";")) - (forward-line 1)) - (not (eobp))) - (let ((form (read (current-buffer)))) - (when (memq (car form) '(eval-when-compile eval-and-compile)) - (web-vcs-message-with-face 'web-vcs-gold " eval %S" form) - (eval form)) - ))) - (if old-buf (kill-buffer) (goto-char here)))))) - - -;; Fix-me: protect against deep nesting -(defun web-autoload-do-require (feature filename noerror) - (let* ((feat-name (symbol-name feature)) - (lib (or filename feat-name))) - (if (load lib noerror t) - (progn - (unless (featurep feature) - (error "web-autoload: Required feature `%s' was not provided" feature)) - feature) - nil - ))) - -(defvar web-autoload-require-skip-noerror-entries nil) - -(defadvice require (around - web-autoload-ad-require) - (let ((feature (ad-get-arg 0)) - (filename (ad-get-arg 1)) - (noerror (ad-get-arg 2))) - (if (featurep feature) - feature - (if (or filename - (and noerror - (or (not (boundp 'web-autoload-skip-require-advice)) - web-autoload-skip-require-advice))) - (progn - (message "Doing nearly original require %s, because skipping" (ad-get-arg 0)) - ;; Can't ad-do-it because defadviced functions in load - ;;(web-autoload-do-require feature filename noerror) - ;; - ;; Fix-me: Implement lazy loading here? Could it be done with while-no-input? - ;; - ;;(when (assq feature web-autoload-require-list) ) - ad-do-it) - (unless (and noerror - web-autoload-require-skip-noerror-entries) - (let* ((auto-rec (assq feature web-autoload-require-list)) - (web-vcs (nth 1 auto-rec)) - (base-url (nth 2 auto-rec)) - (relative-url (nth 3 auto-rec)) - (base-dir (nth 4 auto-rec)) - (comp-fun (nth 5 auto-rec))) - (if (not auto-rec) - ad-do-it - (let* ((full-el (concat (expand-file-name relative-url base-dir) ".el")) - (full-elc (byte-compile-dest-file full-el)) - (our-buffer (current-buffer)) ;; Need to come back here - (our-wcfg (current-window-configuration)) - (mode-line-old (web-vcs-redefine-face 'mode-line 'web-vcs-mode-line)) - (mode-line-inactive-old (web-vcs-redefine-face 'mode-line-inactive 'web-vcs-mode-line-inactive)) - (header-line-format-old (with-current-buffer "*Messages*" - (prog1 - header-line-format - (setq header-line-format - (propertize "Downloading needed files..." - 'face 'web-vcs-mode-line - ;;'face '(:height 1.5) ;; does not work - )))))) - ;; Fix-me: can't update while accessing the menus - ;;(message "trying (redisplay t) ;; mode line") - ;;(sit-for 1) (redisplay t) ;; mode line - (unwind-protect - (progn - (web-vcs-message-with-face 'web-vcs-gold "Doing the really adviced require for %s" feature) - ;; Check if already downloaded first - (unless (file-exists-p full-el) - (setq base-url (eval base-url)) - ;; Download and try again - (setq relative-url (concat relative-url ".el")) - (web-vcs-message-with-face 'web-vcs-green "Need to download feature '%s" feature) - (catch 'web-autoload-comp-restart - (web-vcs-get-missing-matching-files web-vcs base-url base-dir relative-url))) - (set-buffer our-buffer) ;; Before we load.. - (when web-autoload-autocompile - (unless (file-exists-p full-elc) - ;; Byte compile the downloaded file - (web-autoload-byte-compile-file full-el t comp-fun))) - (web-vcs-message-with-face 'web-vcs-gold "Doing finally require for %s" feature) - (set-buffer our-buffer) ;; ... and after we load - (set-window-configuration our-wcfg)) - (with-current-buffer "*Messages*" (setq header-line-format header-line-format-old)) - (web-vcs-redefine-face 'mode-line mode-line-old) - (web-vcs-redefine-face 'mode-line-inactive mode-line-inactive-old))) - ad-do-it))))))) - -;; (setq x (web-vcs-redefine-face 'mode-line (setq z (face-all-attributes 'web-vcs-mode-line (selected-frame))))) -;; (setq x (web-vcs-redefine-face 'mode-line 'web-vcs-mode-line)) -;; (setq y (web-vcs-redefine-face 'mode-line x)) -;; (describe-face 'web-vcs-mode-line) -(defun web-vcs-redefine-face (face as-new) - "Redefine FACE to use the attributes in AS-NEW. -AS-NEW may be either a face or a list returned by `face-all-attributes'. -Return an alist with old attributes." - (let ((ret (face-all-attributes face (selected-frame))) - (new-face-att (if (facep as-new) - (face-all-attributes as-new (selected-frame)) - as-new)) - new-at-prop-list - ) - (dolist (at new-face-att) - (let ((sym (car at)) - (val (cdr at))) - (unless (eq val 'unspecified) - (setq new-at-prop-list (cons sym - (cons val - new-at-prop-list))) - ;;(message "new=%S" new-at-prop-list) - ))) - (apply 'set-face-attribute face (selected-frame) new-at-prop-list) - ret - )) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Web Autoload Define - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Helpers - -;;(web-vcs-file-name-as-list "/a/b/c.el") -;;(web-vcs-file-name-as-list "a/b/c.el") -;;(web-vcs-file-name-as-list "c:/a/b/c.el") -;;(web-vcs-file-name-as-list ".*/a/c/") -;;(web-vcs-file-name-as-list "[^/]*/a/c/") ;; Just avoid this. -;;(web-vcs-file-name-as-list "\\(?:\\.\\.?\\|README\\.txt\\(?:\\.moved\\)?\\|a\\(?:lts\\|utostart\\(?:\\.elc?\\|22\\.elc?\\)\\)\\|e\\(?:macs22\\.cmd\\|tc\\)\\|nxhtml\\(?:-\\(?:base\\.elc?\\|loaddefs\\.el\\(?:\\.moved\\|c\\)?\\|web-vcs\\.el\\(?:\\.moved\\|c\\)?\\)\\|maint\\.elc?\\)?\\|related\\|tests\\|util\\|web-\\(?:autoload\\.elc?\\|vcs\\.el\\(?:\\.moved\\|c\\)?\\)\\)") - -(defun web-vcs-file-name-as-list (filename) - "Split file name FILENAME into a list with file names." - ;; We can't use the primitives since they converts \ to / and - ;; therefore damages the reg exps. Just use our knowledge of the - ;; internal file name representation instead. - (split-string filename "/")) -;; (let ((lst-name nil) -;; (head filename) -;; (old-head "")) -;; (while (and (not (string= old-head head)) -;; (> (length head) 0)) -;; (let* ((file-head (directory-file-name head)) -;; (tail (file-name-nondirectory (directory-file-name head)))) -;; (setq old-head head) -;; (setq head (file-name-directory file-head)) -;; ;; For an abs path the final tail is "", use root instead: -;; (when (= 0 (length tail)) -;; (setq tail head)) -;; (setq lst-name (cons tail lst-name)))) -;; lst-name)) - -;;(web-vcs-match-folderwise ".*/util/mum.el" "top/util/mum.el") -;;(web-vcs-match-folderwise ".*/util/mu.el" "top/util/mum.el") -;;(web-vcs-match-folderwise ".*/ut/mum.el" "top/util/mum.el") -;;(web-vcs-match-folderwise ".*/ut../mum.el" "top/util/mum.el") -;;(web-vcs-match-folderwise ".*/ut../mum.el" "top/util") -;;(web-vcs-match-folderwise ".*/ut../mum.el" "top") -;;(web-vcs-match-folderwise "top/ut../mum.el" "top") -(defun web-vcs-match-folderwise (regex file) - "Split REGEXP as a file path and match against FILE parts." - ;;(message "folderwise %S %S" regex file) - (let ((lst-regex (web-vcs-file-name-as-list regex)) - (lst-file (web-vcs-file-name-as-list file))) - ;; Called from web-vcs-download-files for tree? - (when (= 1 (length lst-regex)) - (setq lst-file (last lst-file)) - (message "lst-file => %S" lst-file) - ) - (when (>= (length lst-regex) (length lst-file)) - (catch 'match - (while lst-file - (let ((head-file (car lst-file)) - (head-regex (car lst-regex))) - (unless (or (= 0 (length head-file)) ;; Last /, if present, gives "" - (string-match-p (concat "^" head-regex "$") head-file)) - (throw 'match nil))) - (setq lst-file (cdr lst-file)) - (setq lst-regex (cdr lst-regex))) - t)))) - -(defun web-vcs-contains-file (dir file) - "Return t if DIR contain FILE." - (assert (string= dir (file-name-as-directory (expand-file-name dir))) t) - (assert (or (string= file (file-name-as-directory (expand-file-name file))) - (string= file (expand-file-name file))) t) - (let ((dir-len (length dir))) - (assert (string= "/" (substring dir (1- dir-len)))) - (when (> (length file) dir-len) - (string= dir (substring file 0 dir-len))))) - -(defun web-vcs-nice-elapsed (start-time end-time) - "Format elapsed time between START-TIME and END-TIME nicely. -Those times should have the same format as time returned by -`current-time'." - (format-seconds "%h h %m m %z%s s" (float-time (time-subtract end-time start-time)))) - -;; (web-vcs-equal-files "web-vcs.el" "temp.tmp") -;; (web-vcs-equal-files "../.nosearch" "temp.tmp") -(defun web-vcs-equal-files (file-a file-b) - "Return t if files FILE-A and FILE-B are equal." - (let* ((cmd (if (eq system-type 'windows-nt) - (list "fc" nil nil nil - "/B" "/OFF" - (convert-standard-filename file-a) - (convert-standard-filename file-b)) - (list diff-command nil nil nil - "--binary" "-q" file-a file-b))) - (ret (apply 'call-process cmd))) - ;;(message "ret=%s, cmd=%S" ret cmd) (sit-for 2) - (cond - ((= 1 ret) - nil) - ((= 0 ret) - t) - (t - (error "%S returned %d" cmd ret))))) - -(defun web-vcs-display-messages (select) - "Display *Messages* buffer. Select its window if SELECT." - (let ((msg-win (display-buffer "*Messages*"))) - (with-selected-window msg-win (goto-char (point-max))) - (when select (select-window msg-win)) - msg-win)) - -;; (web-vcs-message-with-face 'secondary-selection "I am saying: %s and %s" "Hi" "Farwell!") -;;;###autoload -(defun web-vcs-message-with-face (face format-string &rest args) - "Display a colored message at the bottom of the string. -FACE is the face to use for the message. -FORMAT-STRING and ARGS are the same as for `message'. - -Also put FACE on the message in *Messages* buffer." - (with-current-buffer "*Messages*" - (save-restriction - (widen) - (let* ((start (let ((here (point))) - (goto-char (point-max)) - (prog1 - (copy-marker - (if (bolp) (point-max) - (1+ (point-max)))) - (goto-char here)))) - (msg-with-face (propertize (apply 'format format-string args) - 'face face))) - ;; This is for the echo area: - (message "%s" msg-with-face) - ;; This is for the buffer: - (when (< 0 (length msg-with-face)) - (goto-char (1- (point-max))) - ;;(backward-char) - ;;(unless (eolp) (goto-char (line-end-position))) - (put-text-property start (point) - 'face face)))))) - -(defun web-vcs-num-moved (root) - "Return nof files matching *.moved inside directory ROOT." - (let* ((file-regexp ".*\\.moved$") - (files (directory-files root t file-regexp)) - (subdirs (directory-files root t))) - (dolist (subdir subdirs) - (when (and (file-directory-p subdir) - (not (or (string= "/." (substring subdir -2)) - (string= "/.." (substring subdir -3))))) - (setq files (append files (web-vcs-rdir-get-files subdir file-regexp) nil)))) - (length files))) - -;; Copy of rdir-get-files in ourcomment-util.el -(defun web-vcs-rdir-get-files (root file-regexp) - (let ((files (directory-files root t file-regexp)) - (subdirs (directory-files root t))) - (dolist (subdir subdirs) - (when (and (file-directory-p subdir) - (not (or (string= "/." (substring subdir -2)) - (string= "/.." (substring subdir -3))))) - (setq files (append files (web-vcs-rdir-get-files subdir file-regexp) nil)))) - files)) - -(defun web-vcs-contains-moved-files (dl-dir) - "Return t if there are *.moved files in DL-DIR." - (let ((num-moved (web-vcs-num-moved dl-dir))) - (when (> num-moved 0) - (web-vcs-message-with-face 'font-lock-warning-face - (concat "There are %d *.moved files (probably from prev download)\n" - "in %S.\nPlease delete them first.") - num-moved dl-dir) - t))) - - -(defun web-vcs-set&save-option (symbol value) - (customize-set-variable symbol value) - (customize-set-value symbol value) - (when (condition-case nil (custom-file) (error nil)) - (customize-mark-to-save symbol) - (custom-save-all) - (message "web-vcs: Saved option %s with value %s" symbol value))) - -(defvar web-vcs-el-this (or load-file-name - (when (boundp 'bytecomp-filename) bytecomp-filename) - buffer-file-name)) - - -(require 'bytecomp) -(defun web-vcs-byte-compile-newer-file (el-file load) - (let ((elc-file (byte-compile-dest-file el-file))) - (when (or (not (file-exists-p elc-file)) - (file-newer-than-file-p el-file elc-file)) - (byte-compile-file el-file load)))) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Compiling - -;;;###autoload -(defun web-vcs-byte-compile-file (file &optional load extra-load-path comp-dir) - "Byte compile FILE in a new Emacs sub process. -EXTRA-LOAD-PATH is added to the front of `load-path' during -compilation. - -FILE is set to `buffer-file-name' when called interactively. -If LOAD" - (interactive (list (buffer-file-name) - t)) - (when (with-no-warnings (called-interactively-p)) - (unless (eq major-mode 'emacs-lisp-mode) - (error "Must be in emacs-lisp-mode"))) - (let* ((old-env-load-path (getenv "EMACSLOADPATH")) - (sub-env-load-path (or old-env-load-path - ;;(mapconcat 'identity load-path ";"))) - (mapconcat 'identity load-path path-separator))) - ;; Fix-me: name of compile log buffer. When should it be - ;; deleted? How do I bind it to byte-compile-file? Or do I? - (file-buf (find-buffer-visiting file)) - (old-out-buf (get-buffer "*Compile-Log*")) - (default-directory (or (when old-out-buf - (with-current-buffer old-out-buf - default-directory)) - comp-dir - (and (boundp 'nxhtml-install-dir) nxhtml-install-dir) - default-directory)) - (out-buf (or old-out-buf (get-buffer-create "*Compile-Log*"))) - (elc-file (byte-compile-dest-file file)) - (this-emacs-exe (locate-file invocation-name - (list invocation-directory) - exec-suffixes)) - (debug-on-error t) - start) - ;; (when (and file-buf - ;; (buffer-modified-p file-buf)) - ;; (switch-to-buffer file-buf) - ;; (error "Buffer must be saved first: %S" file-buf)) - (dolist (full-p extra-load-path) - ;;(setq sub-env-load-path (concat full-p ";" sub-env-load-path))) - (setq sub-env-load-path (concat full-p path-separator sub-env-load-path))) - (unless (get-buffer-window out-buf (selected-frame)) - (if (string= file (buffer-file-name)) - (display-buffer out-buf) - (unless (eq (current-buffer) out-buf) - (switch-to-buffer out-buf)))) - (with-selected-window (get-buffer-window out-buf) - (with-current-buffer out-buf - (unless (local-variable-p 'web-vcs-comp-dir) - (set (make-local-variable 'web-vcs-comp-dir) (or comp-dir default-directory))) - (setq default-directory web-vcs-comp-dir) - (widen) - (goto-char (point-max)) - (when (or (= 0 (buffer-size)) - (not (derived-mode-p 'compilation-mode))) - (insert (propertize "\nWeb VCS compilation output" 'font-lock-face 'font-lock-comment-face)) - (compilation-mode) - (setq font-lock-verbose nil) - (font-lock-add-keywords nil - '(("\\" . 'compilation-info)))) - (let ((inhibit-read-only t) - (rel-file (file-relative-name file))) - (insert "\n\n") - (insert "** Compile " rel-file "\n")) - (setq start (point)) - (when (file-exists-p elc-file) (delete-file elc-file)) - (if (or (not window-system) - (< emacs-major-version 23)) - (byte-compile-file file) - ;;(message "web-vcs-byte-compile-file:sub-env-load-path=%s" sub-env-load-path) - (unless (file-exists-p this-emacs-exe) - (error "Can't find this-emacs-exe=%s" this-emacs-exe)) - (unless (stringp sub-env-load-path) (error "I did it again, sub-env-load-path=%S" sub-env-load-path)) - (setenv "EMACSLOADPATH" sub-env-load-path) - ;; Fix-me: status - (let* ((inhibit-read-only t) - (ret (apply 'call-process this-emacs-exe nil out-buf t - "-Q" "--batch" - "--eval" "(setq debug-on-error t)" - "--eval" "(remove-hook 'find-file-hook 'vc-find-file-hook)" - "--file" file - "-f" "emacs-lisp-byte-compile" - nil))) - ;;(insert (format "call-process returned: %s\n" ret)) - ) - (setenv "EMACSLOADPATH" old-env-load-path)) - (goto-char start) - (while (re-search-forward "^\\([a-zA-Z0-9/\._-]+\\):[0-9]+:[0-9]+:" nil t) - (let ((rel-file (file-relative-name file)) - (inhibit-read-only t)) - (replace-match rel-file nil nil nil 1))) - (goto-char (point-max)))) - (when (file-exists-p elc-file) - (when (and load window-system) (load elc-file)) - t))) - - -;;;;;;;;;;;;;;;;;;;;;;;; -;;; Temporary helpers, possibly included in Emacs - -;; Fix-me: Doing (require 'url-http) in the functions below led to -;; that url-show-status is void. So I require it here instead. -;;(require 'url-http) - -;; (setq x (web-vcs-url-retrieve-synch "http://emacswiki.org/")) -;;;###autoload -(defun web-vcs-url-retrieve-synch (url) - "Retrieve URL, return cons with buffer and http status." - (require 'url-http) - (let* ((url-show-status nil) ;; just annoying showing status here - (buffer (url-retrieve-synchronously url)) - (handle nil) - (http-status nil)) - (if (not buffer) - (error "Retrieving url %s gave no buffer" url)) - (with-current-buffer buffer - (if (= 0 (buffer-size)) - (progn - (kill-buffer) - nil) - (setq http-status (url-http-parse-response)) - (if (memq http-status '(200 201)) - (progn - (goto-char (point-min)) - (unless (search-forward "\n\n" nil t) - (error "Could not find header end in buffer for %s" url)) - (delete-region (point-min) (point)) - (set-buffer-modified-p nil) - (goto-char (point-min))) - (kill-buffer buffer) - (setq buffer nil)))) - (cons buffer http-status))) - -;; Modified just to return http status -;;;###autoload -(defun web-vcs-url-copy-file (url newname &optional ok-if-already-exists - keep-time preserve-uid-gid) - "Copy URL to NEWNAME. Both args must be strings. -Signals a `file-already-exists' error if file NEWNAME already exists, -unless a third argument OK-IF-ALREADY-EXISTS is supplied and non-nil. -A number as third arg means request confirmation if NEWNAME already exists. -This is what happens in interactive use with M-x. -Fourth arg KEEP-TIME non-nil means give the new file the same -last-modified time as the old one. (This works on only some systems.) -Fifth arg PRESERVE-UID-GID is ignored. -A prefix arg makes KEEP-TIME non-nil." - (if (and (file-exists-p newname) - (not ok-if-already-exists)) - (error "Opening output file: File already exists, %s" newname)) - (require 'url-http) - (let ((buffer (url-retrieve-synchronously url)) - (handle nil) - (ret nil)) - (if (not buffer) - (error "Retrieving url %s gave no buffer" url)) - (with-current-buffer buffer - (if (= 0 (buffer-size)) - (progn - (kill-buffer) - nil) - (setq ret (url-http-parse-response)) - (setq handle (mm-dissect-buffer t)) - (mm-save-part-to-file handle newname) - (kill-buffer buffer) - (mm-destroy-parts handle))) - ret)) - -(defun web-vcs-read-and-accept-key (prompt accepted &optional reject-message help-function) - (let ((key nil) - rejected - (resize-mini-windows (or resize-mini-windows t))) - (while (not (member key accepted)) - (if (and help-function - (or (member key help-event-list) - (eq key ??))) - (funcall help-function) - (unless rejected - (setq rejected t) - (setq prompt (concat (or reject-message "Please answer with one of the alternatives.") - "\n\n" - prompt)) - (setq key (web-vcs-read-key prompt))))) - key)) - -(defconst web-vcs-read-key-empty-map (make-sparse-keymap)) - -(defvar web-vcs-read-key-delay 0.01) ;Fast enough for 100Hz repeat rate, hopefully. - -(defun web-vcs-read-key (&optional prompt) - "Read a key from the keyboard. -Contrary to `read-event' this will not return a raw event but instead will -obey the input decoding and translations usually done by `read-key-sequence'. -So escape sequences and keyboard encoding are taken into account. -When there's an ambiguity because the key looks like the prefix of -some sort of escape sequence, the ambiguity is resolved via `web-vcs-read-key-delay'." - (let ((overriding-terminal-local-map web-vcs-read-key-empty-map) - (overriding-local-map nil) - (old-global-map (current-global-map)) - (timer (run-with-idle-timer - ;; Wait long enough that Emacs has the time to receive and - ;; process all the raw events associated with the single-key. - ;; But don't wait too long, or the user may find the delay - ;; annoying (or keep hitting more keys which may then get - ;; lost or misinterpreted). - ;; This is only relevant for keys which Emacs perceives as - ;; "prefixes", such as C-x (because of the C-x 8 map in - ;; key-translate-table and the C-x @ map in function-key-map) - ;; or ESC (because of terminal escape sequences in - ;; input-decode-map). - web-vcs-read-key-delay t - (lambda () - (let ((keys (this-command-keys-vector))) - (unless (zerop (length keys)) - ;; `keys' is non-empty, so the user has hit at least - ;; one key; there's no point waiting any longer, even - ;; though read-key-sequence thinks we should wait - ;; for more input to decide how to interpret the - ;; current input. - (throw 'read-key keys))))))) - (unwind-protect - (progn - (use-global-map web-vcs-read-key-empty-map) - (message (concat (apply 'propertize prompt (member 'face minibuffer-prompt-properties)) - (propertize " " 'face 'cursor))) - (aref (catch 'read-key (read-key-sequence-vector nil nil t)) 0)) - (cancel-timer timer) - (use-global-map old-global-map)))) - -;; End temp helpers -;;;;;;;;;;;;;;;;;;;;;;;; - -;;(web-vcs-existing-files-matcher default-directory) -(defun web-vcs-existing-files-matcher (dir) - (let ((files-and-dirs (directory-files dir nil "[^#~]$")) - files - (default-directory dir)) - (dolist (df files-and-dirs) - (unless (file-directory-p df) - (setq files (cons df files)))) - (cons (regexp-opt files) t))) - -(defun web-vcs-update-existing-files (vcs base-url dl-dir this-dir) - (let ((files-and-dirs (directory-files this-dir nil "\\(?:\\.elc\\|\\.moved\\|[^#~]\\)$")) - files - dirs - (this-rel (file-relative-name this-dir dl-dir)) - file-mask) - (when (string= "./" this-rel) (setq this-rel "")) - (dolist (df files-and-dirs) - (if (and (file-directory-p df) - (not (member df '("." "..")))) - (setq dirs (cons df dirs)) - (setq files (cons df files)))) - ;;(web-vcs-message-with-face 'hi-blue "this-rel=%S %S %S" this-rel dl-dir this-dir) - (setq file-mask (concat this-rel (regexp-opt files))) - ;;(web-vcs-message-with-face 'hi-blue "r=%S" file-mask) - (web-vcs-get-missing-matching-files vcs base-url dl-dir file-mask (length files)) - (dolist (d dirs) - (web-vcs-update-existing-files vcs base-url dl-dir - (file-name-as-directory - (expand-file-name d this-dir)))))) - - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Some small bits for security and just overview. - -(defun web-vcs-fontify-as-ps-print() - (save-restriction - (widen) - (let ((start (point-min)) - (end (point-max))) - (cond ((and (boundp 'jit-lock-mode) (symbol-value 'jit-lock-mode)) - (jit-lock-fontify-now start end)) - ;; ((and (boundp 'lazy-lock-mode) (symbol-value 'lazy-lock-mode)) - ;; (lazy-lock-fontify-region start end)) - )))) - - -;;(web-vcs-get-fun-details 'describe-function) -;;(web-vcs-get-fun-details 'require) -;;(describe-function 'describe-function) -(defun web-vcs-get-fun-details (function) - (unless (symbolp function) (error "Not a symbol: %s" function)) - (unless (functionp function) (error "Not a function: %s" function)) - ;; Do as in `describe-function': - (let* ((advised (and (symbolp function) (featurep 'advice) - (ad-get-advice-info function))) - ;; If the function is advised, use the symbol that has the - ;; real definition, if that symbol is already set up. - (real-function - (or (and advised - (let ((origname (cdr (assq 'origname advised)))) - (and (fboundp origname) origname))) - function)) - ;; Get the real definition. - (def (if (symbolp real-function) - (symbol-function real-function) - function)) - errtype file-name (beg "") string) - ;; Just keep this as it is to more easily compare with `describe-function-1'. - (setq string - (cond ((or (stringp def) - (vectorp def)) - "a keyboard macro") - ((subrp def) - (if (eq 'unevalled (cdr (subr-arity def))) - (concat beg "special form") - (concat beg "built-in function"))) - ((byte-code-function-p def) - (concat beg "compiled Lisp function")) - ((symbolp def) - (while (and (fboundp def) - (symbolp (symbol-function def))) - (setq def (symbol-function def))) - ;; Handle (defalias 'foo 'bar), where bar is undefined. - (or (fboundp def) (setq errtype 'alias)) - (format "an alias for `%s'" def)) - ((eq (car-safe def) 'lambda) - (concat beg "Lisp function")) - ((eq (car-safe def) 'macro) - "a Lisp macro") - ((eq (car-safe def) 'autoload) - ;;(setq file-name-auto (nth 1 def)) - ;;(setq file-name-auto (find-lisp-object-file-name function def)) - ;;(setq file-auto-noext (file-name-sans-extension file-name-auto)) - (format "%s autoloaded %s" - (if (commandp def) "an interactive" "an") - (if (eq (nth 4 def) 'keymap) "keymap" - (if (nth 4 def) "Lisp macro" "Lisp function")))) - ((keymapp def) - (let ((is-full nil) - (elts (cdr-safe def))) - (while elts - (if (char-table-p (car-safe elts)) - (setq is-full t - elts nil)) - (setq elts (cdr-safe elts))) - (if is-full - "a full keymap" - "a sparse keymap"))) - (t ""))) - (setq file-name (find-lisp-object-file-name function def)) - (list errtype advised file-name string) - )) - -;; (setq next-error-function 'web-vcs-investigate-next-error) -;; fix-me: -;; (defvar web-vcs-investigate-header-str "Found these possible problems when reading the file:\n") -;; (defun web-vcs-investigate-next-error (argp reset) -;; (interactive "p") -;; ;; Search from within the investigate output buffer -;; (with-current-buffer -;; ;; Choose the buffer and make it current. -;; (if (next-error-buffer-p (current-buffer)) -;; (current-buffer) -;; (next-error-find-buffer nil nil -;; (lambda () -;; (let ((here (point))) -;; (save-restriction -;; (widen) -;; (goto-char (point-min)) -;; (string= (buffer-substring-no-properties -;; 0 (length web-vcs-investigate-header-str)) -;; web-vcs-investigate-header-str)))))) - -;; (goto-char (cond (reset (point-min)) -;; ((< argp 0) (line-beginning-position)) -;; ((> argp 0) (line-end-position)) -;; ((point)))) -;; (occur-find-match -;; (abs argp) -;; (if (> 0 argp) -;; #'previous-single-property-change -;; #'next-single-property-change) -;; "No more matches") -;; ;; In case the *Occur* buffer is visible in a nonselected window. -;; (let ((win (get-buffer-window (current-buffer) t))) -;; (if win (set-window-point win (point)))) -;; (occur-mode-goto-occurrence))) - -;;(web-vcs-investigate-read "c:/emacsw32/nxhtml/nxhtml/nxhtml-autoload.el" "*Messages*") -(defun web-vcs-investigate-read (elisp out-buf) - "Check forms in buffer by reading it." - (let* ((here (point)) - unsafe-eval re-fun re-var - elisp-el-file - (is-same-file (lambda (file) - (when file - (setq file (concat (file-name-sans-extension file) ".el")) - (string= (file-truename file) elisp-el-file))))) - (with-current-buffer elisp - (setq elisp-el-file (when (buffer-file-name) - (file-truename (buffer-file-name)))) - (save-restriction - (widen) - (web-vcs-fontify-as-ps-print) - (goto-char (point-min)) - (while (progn - (while (progn (skip-chars-forward " \t\n\^l") - (looking-at ";")) - (forward-line 1)) - (not (eobp))) - (let* ((pos (point)) - (form (read (current-buffer))) - (def (nth 0 form)) - (sym (and (listp form) - (symbolp (nth 1 form)) - (nth 1 form))) - (form-fun (and sym - (functionp sym) - (symbol-function sym))) - (form-var (boundp sym)) - (safe-forms '( declare-function - defun defmacro defsubst - define-minor-mode define-globalized-minor-mode - defvar defconst - defcustom - defface defgroup - ;; fix-me: check if these do re-fun too: - define-derived-mode - define-global-minor-mode - define-globalized-minor-mode - - make-local-variable make-variable-buffer-local - provide - require - message)) - (safe-eval (or (memq def safe-forms) - (and (memq def '( eval-when-compile eval-and-compile)) - (or (not (consp (nth 1 form))) - (memq (car (nth 1 form)) safe-forms))))) - ) - (cond - ((not safe-eval) - (setq unsafe-eval - (cons (list form (copy-marker pos) (buffer-substring pos (point))) - unsafe-eval))) - ((and form-fun - (memq def '( defun defmacro define-minor-mode define-globalized-minor-mode))) - (setq re-fun (cons (cons sym pos) re-fun))) - ((and form-var - (memq def '( defvar defconst defcustom)) - (or (not (eq sym 'defvar)) - (< 2 (length form)))) - (setq re-var (cons sym re-var))))))) - (goto-char here)) - (with-current-buffer out-buf - (save-restriction - (widen) - (goto-char (point-max)) - (unless (bobp) (insert "\n\n")) - (insert (propertize "Found these possible problems when reading the file:\n" - 'font-lock-face '(:height 1.5))) - (or unsafe-eval - re-fun - (insert "\n" - "Found no problems (but there may still be)" - "\n")) - - ;; Fix-me: Link - (when unsafe-eval - (insert "\n" - (propertize - (format "* Forms that are executed when loading the file (found %s):" - (length unsafe-eval)) - 'font-lock-face '(:background "yellow" :height 1.2)) - "\n\n") - (dolist (u (reverse unsafe-eval)) - (insert (format "Line %s\n" - (with-current-buffer elisp - (line-number-at-pos (marker-position (nth 1 u)))))) - ;; (insert-text-button (format "Go to form below, line %s" (marker-position (nth 1 u))) - ;; 'font-lock-face '(compilation-info underline) - ;; 'action - ;; `(lambda (button) - ;; (let* ((marker ,(nth 1 u)) - ;; (buf (marker-buffer marker))) - ;; (switch-to-buffer-other-window buf) - ;; (unless (and (< marker (point-max)) - ;; (> marker (point-min))) - ;; (widen)) - ;; (goto-char marker)))) - (insert (nth 2 u) "\n\n")) - (insert "\n")) - (when re-fun - (insert (propertize - (format "\n* The file perhaps redefines these functions that are defined now (%s):\n" - (length re-fun)) - 'font-lock-face '(:background "yellow" :height 1.2))) - (setq re-fun (sort re-fun (lambda (a b) (string< (symbol-name (car a)) (symbol-name (car b)))))) - (let ((row 0) - (re-fun-with-info (mapcar (lambda (fun) - (cons fun (web-vcs-get-fun-details (car fun)))) - re-fun)) - re-fun-other-files - (n-same 0) - (n-web-auto 0)) - ;; Check same file - (dolist (info re-fun-with-info) - (let* ((file-name (nth 3 info)) - (fun (car (nth 0 info))) - (web-auto (get fun 'web-autoload))) - (cond ((funcall is-same-file file-name) - (setq n-same (1+ n-same))) - (web-auto - (setq n-web-auto (1+ n-web-auto)) - (setq re-fun-other-files (cons info re-fun-other-files))) - (t - (setq re-fun-other-files (cons info re-fun-other-files)))))) - - (when (< 0 n-same) - (insert "\n " - (propertize (format "%s functions alreay defined by this file (which seems ok)" n-same) - 'font-lock-face 'web-vcs-green) - "\n")) - - (dolist (info re-fun-other-files) - (let* ((fun-rec (nth 0 info)) - (errtype (nth 1 info)) - (advised (nth 2 info)) - (file-name (nth 3 info)) - (string (nth 4 info)) - (fun (car fun-rec)) - (fun-pos (cdr fun-rec)) - (fun-web-auto (get fun 'web-autoload)) - ) - (when (= 0 (% row 5)) (insert "\n")) - (setq row (1+ row)) - (insert " `") - (insert-text-button (format "%s" fun) - 'action - `(lambda (button) - (describe-function ',fun))) - (insert "'") - (insert " (" string) - (when fun-web-auto - (insert " autoloaded from web, ") - (insert-text-button "info" - 'action - `(lambda (button) - ;; Fix-me: maybe a bit more informative ... ;-) - (message "%S" ',fun-web-auto)))) - (insert ")") - (when advised (insert ", " (propertize "adviced" 'font-lock-face 'font-lock-warning-face))) - (insert ", " - (cond - ((funcall is-same-file file-name) - (propertize "defined in this file" 'font-lock-face 'web-vcs-green) - ) - (fun-web-auto - (if (not (web-autoload-acvtive)) - (propertize "web download not active" 'font-lock-face 'web-vcs-yellow) - ;; See if file matches - (let ((active-sub-url web-autoload-active-file-sub-url) - (fun-sub-url (nth 2 fun-web-auto))) - (setq active-sub-url (file-name-sans-extension active-sub-url)) - (if (string-match-p fun-sub-url active-sub-url) - (propertize "web download, matches" 'font-lock-face 'web-vcs-yellow) - (propertize "web download, doesn't matches" 'font-lock-face 'web-vcs-red) - )))) - (t - (propertize "defined in other file" 'font-lock-face 'web-vcs-red)))) - (unless (funcall is-same-file file-name) - (insert " (") - (insert-text-button "go to new definition" - 'action - `(lambda (button) - (interactive) - (let ((m-pos ,(with-current-buffer elisp - (copy-marker fun-pos)))) - (switch-to-buffer-other-window (marker-buffer m-pos)) - (goto-char m-pos)))) - (insert ")")) - (insert "\n") - ))))) - (web-vcs-investigate-output-mode) - ))) - -(defvar web-vcs-investigate-current-file nil) -(make-variable-buffer-local 'web-vcs-investigate-current-file) -(put 'web-vcs-investigate-current-file 'permanent-local t) - -(defun web-vcs-investigate-current-file () - `(,web-vcs-investigate-current-file)) - -;; (defun web-vcs-investigate-fontification-fun (bound) -;; ;;(compilation-error-properties (file line end-line col end-col type fmt) -;; (while (re-search-forward "^Line \\([0-9]+\\)$" bound t) -;; (put-text-property (match-beginning 1) (match-end 1) -;; 'face 'highlight) -;; (let ((line (string-to-number (match-string-no-properties 1)))) -;; (compilation-error-properties 'web-vcs-investigate-current-file line line nil nil nil nil)) -;; ) -;; nil) - - -;; (defvar web-vcs-investigate-output-font-lock-keywords -;; ;; '(("^\\*\\*\\* \\(.+\\.el\\): \\([^ \n]+\\)" -;; ;; '(("^\\*\\*\\* \\(.+\\.el\\): \\([^ \n]+\\)" -;; ;; (1 font-lock-function-name-face) -;; ;; (2 font-lock-comment-face))) -;; ;; "Keywords used to highlight a checkdoc diagnostic buffer.") -;; nil) -;; ;;'(("^\\(Line\\) \\([0-9]+\\)$" 1 2))) -;; ;;'(web-vcs-investigate-fontification-fun)) - -(defvar web-vcs-investigate-output-error-regex-alist - '( - ("^Line \\([0-9]+\\)$" web-vcs-investigate-current-file 1 - ;; column type - nil 1) - ;; Fix-me: This is just a terrible hack making the hit into a - ;; compilation error point with # as the link and the rest as the - ;; action for that line. And it even does not work... - Only the - ;; first line becomes an error line. No idea why at the moment. - ("\\(#\\)Eval the file with all" web-vcs-investigate-current-file nil nil nil 1) - ("\\(#\\)Eval the file with just" web-vcs-investigate-current-file nil nil nil 1) - ("\\(#\\)Eval the file with no" web-vcs-investigate-current-file nil nil nil 1) - )) - -;; (defvar checkdoc-pending-errors nil -;; "Non-nil when there are errors that have not been displayed yet.") - -(define-compilation-mode web-vcs-investigate-output-mode "Investigate Elisp" - "Set up the major mode for the buffer containing the list of errors." - (set (make-local-variable 'compilation-error-regexp-alist) - web-vcs-investigate-output-error-regex-alist) - ;;(set (make-local-variable 'compilation-error-face) grep-hit-face) - ;; (set (make-local-variable 'compilation-mode-font-lock-keywords) - ;; web-vcs-investigate-output-font-lock-keywords) - ) - -;; I am quite tired of doing this over and over again. Why is this not -;; in Emacs? -(defvar web-vcs-button-mode-map - (let ((map (make-sparse-keymap))) - (define-key map [tab] 'forward-button) - (define-key map [(shift tab)] 'backward-button) - map)) -(define-minor-mode web-vcs-button-mode - "Just to bind `forward-button' etc" - :lighter nil) - -(defvar web-vcs-eval-output-start nil) -(make-variable-buffer-local 'web-vcs-eval-output-start) -(defvar web-vcs-eval-output-end nil) -(make-variable-buffer-local 'web-vcs-eval-output-end) - -;;(web-vcs-investigate-elisp-file) -;;;###autoload -(defun web-vcs-investigate-elisp-file (file-or-buffer) - (interactive (list - (if (derived-mode-p 'emacs-lisp-mode) - (current-buffer) - (read-file-name "Elisp file to check: ")))) - (let* ((elisp (if (bufferp file-or-buffer) - file-or-buffer - (find-file-noselect file-or-buffer))) - (elisp-file (with-current-buffer elisp (buffer-file-name))) - (out-buf-name "Web VCS Sec Inv") - (out-buf (let ((old-buf (get-buffer out-buf-name))) - (when old-buf (kill-buffer old-buf)) - (get-buffer-create out-buf-name)))) - (if (not (with-current-buffer elisp (derived-mode-p 'emacs-lisp-mode))) - (progn - (unless (eq (current-buffer) elisp) - (display-buffer elisp)) - (message "Buffer %s is not in emacs-lisp-mode" (buffer-name elisp))) - (switch-to-buffer-other-window out-buf) - (setq web-vcs-investigate-current-file elisp-file) - (let ((inhibit-read-only t)) - (erase-buffer) - (setq buffer-read-only t) - (web-vcs-button-mode 1) - (insert (propertize "A quick look for problems" 'font-lock-face '(:height 1.5))) - (let ((here (point))) - (insert - "\n" - (propertize - (concat "Note that this is just a quick look at the file." - " You have to investigate the file more carefully yourself" - " (or be sure someone else has done it for you)." - " The following are checked for here:" - "\n") - 'font-lock-face font-lock-comment-face)) - (fill-region here (point))) - (insert - (propertize - (concat - "- Top level forms that might be executed when loading the file.\n" - "- Redefinition of functions.\n") - 'font-lock-face font-lock-comment-face)) - - (insert "\n") - (if elisp-file - (progn - (insert "File ") - (insert-text-button elisp-file - 'action - `(lambda (button) - (interactive) - (find-file-other-window ,elisp-file)))) - (insert "Buffer ") - (insert-text-button (buffer-name elisp) - 'action - `(lambda (button) - (interactive) - (switch-to-buffer-other-window ,elisp)))) - - (web-vcs-investigate-read elisp out-buf) - (when elisp-file - (insert "\n\n\n") - (insert (propertize "* Investigate what the file loads and redefines\n" - 'font-lock-face '(:background "yellow" :height 1.2))) - (let ((here (point))) - (insert "\nIf you want to see what will actually be added to `load-history'" - " and which functions will be defined you can" - " load the file in a batch Emacs session" - " and show the result here." - " (`load-path' will be set to your current value for the loading.)" - "\n" - ) - (fill-region here (point)) - - (setq here (point)) - (insert "\nYour current Emacs will not be affected by the loading," - " but please be aware that this does not mean your computer can not be." - "\n" - ) - (fill-region here (point)) - - (insert (propertize "\n Note: Click the part after #.\n" 'font-lock-face 'italic)) - (when t ;init-file-user - (insert " ") - (insert-text-button "#Load the file with all your current init files" - 'action `(lambda (button) (interactive) - (web-vcs-investigate-eval ,elisp-file ,out-buf "--debug-init"))) - (insert "\n")) - (when t ;(and site-run-file (not init-file-user)) - (insert " ") - (insert-text-button "#Load the file with just your site init file (i.e. -q)" - 'action `(lambda (button) (interactive) - (web-vcs-investigate-eval ,elisp-file ,out-buf "-q"))) - (insert "\n")) - (when t ;(not site-run-file) - (insert " ") - (insert-text-button "#Load the file with no init file (i.e. -Q)" - 'action `(lambda (button) (interactive) - (web-vcs-investigate-eval ,elisp-file ,out-buf "-Q"))) - (insert "\n")) - - (setq web-vcs-eval-output-start (point)) - (setq web-vcs-eval-output-end (point-max)) - )) - (set-buffer-modified-p nil) - (goto-char (point-min)))))) - - -;;(web-vcs-investigate-eval "c:/emacsw32/nxhtml/nxhtml/nxhtml-autoload.el" "*Messages*") -;;(web-vcs-investigate-eval "c:/emacsw32/nxhtml/autostart.el" "*Messages*") -(defun web-vcs-investigate-eval (elisp-file out-buf init) - "Get compile loads when evaling buffer. -Eval the buffer in a fresh Emacs and return the resulting -load-history entries with comments about what is new etc." - (let* ((emacs-exe (locate-file invocation-name - (list invocation-directory) - exec-suffixes)) - ;; see custom-load-symbol - (get-lhe '(let ((lhe (or (assoc buffer-file-name load-history) - (assoc (concat (file-name-sans-extension buffer-file-name) ".elc") - load-history)))) - (prin1 "STARTHERE\n") - (prin1 lhe))) - (elisp-file-name (file-name-sans-extension (file-name-nondirectory elisp-file))) - (elisp-el-file (file-truename (concat (file-name-sans-extension elisp-file) ".el"))) - (temp-prefix web-autoload-temp-file-prefix) - (temp-prefix-len (length temp-prefix)) - (is-downloading (and (boundp 'web-autoload-paranoid) - web-autoload-paranoid)) - (is-temp-file (and is-downloading - (< (length temp-prefix) (length elisp-file-name)) - (string= temp-prefix - (substring elisp-file-name 0 temp-prefix-len)))) - (elisp-feature-name (if is-temp-file - (substring elisp-file-name temp-prefix-len) - elisp-file-name)) - (is-same-file (lambda (file) - (when file ;; self protecting - (setq file (concat (file-name-sans-extension file) ".el")) - (string= (file-truename file) elisp-el-file)))) - (active-sub-url (when (web-autoload-acvtive) - (file-name-sans-extension web-autoload-active-file-sub-url))) - whole-result - batch-error - result) - (with-current-buffer out-buf - (when web-vcs-eval-output-start - (let ((here (point)) - (inhibit-read-only t)) - (save-restriction - (widen) - ;;(goto-char web-vcs-eval-output-start) - (delete-region web-vcs-eval-output-start web-vcs-eval-output-end)) - (goto-char here)))) - ;; Fix-me: do not use temp buffer so we can check errors - (with-temp-buffer - (let ((old-loadpath (getenv "EMACSLOADPATH")) - ;;(new-loadpath (mapconcat 'identity load-path ";")) - (new-loadpath (mapconcat 'identity load-path path-separator)) - ret-val) - (setenv new-loadpath) - (message "Loading file in batch Emacs...") - (setq ret-val - (call-process emacs-exe nil - (current-buffer) - t "--batch" - ;; fix-me: "-Q" - should be run in the users current environment. - ;; init-file-user nil => -Q - ;; site-run-file nil => -q - - ;; (cond - ;; ((not init-file-user) "-Q") - ;; ((not site-run-file) "-q") - ;; (t "--debug-init")) ;; have to have something here... - init - - "-eval" (format "(setq load-path '%S)" load-path) - "-l" elisp-file - elisp-file - "-eval" (format "%S" get-lhe))) - (message "Loading file in batch Emacs... done, returned %S" ret-val) - (setenv old-loadpath)) - ;; Fix-me: how do you check the exit status on different platforms? - (setq whole-result (buffer-substring-no-properties (point-min) (point-max))) - (condition-case err - (progn - (goto-char (point-min)) - (search-forward "STARTHERE") - (search-forward "(") - (backward-char) - (setq result (read (current-buffer)))) - (error (message "") - ;; Process should probably have failed if we are here, - ;; but anyway... ;-) - (setq batch-error - (concat "Sorry, batch Emacs failed. It returned this message:\n\n" - whole-result - (if is-downloading - (concat - "\n--------\n" - "The error may depend on that not all needed files are yet downloaded.\n") - "\n"))) - ))) - (with-current-buffer out-buf - (let ((here (point)) - (inhibit-read-only t)) - (save-restriction - (widen) - ;;(goto-char (point-max)) - (goto-char web-vcs-eval-output-start) - (if batch-error - (progn - (insert "\n\n") - (insert (propertize batch-error 'font-lock-face 'web-vcs-red))) - (insert (propertize (format "\n\nLoading file (%s) added to `load-history':\n\n" init) - 'font-lock-face '(:height 1.5))) - (insert " (\"" (car result) "\"\n") - (dolist (e (cdr result)) - (insert (format " %S" e)) - (cond ((stringp e)) ;; Should not happen... - ;; Variables - ((symbolp e) - (insert " - ") - (insert (if (not (boundp e)) - (propertize "New" 'font-lock-face 'web-vcs-yellow) - (let ((e-file (symbol-file e))) - (if (funcall is-same-file e-file) - (propertize "Same file now" 'font-lock-face 'web-vcs-green) - (let* ((fun-web-auto (get e 'web-autoload)) - (fun-sub-url (nth 2 fun-web-auto))) - (if (and fun-sub-url - (string= fun-sub-url active-sub-url)) - (propertize "Web download, matches current download" - 'font-lock-face 'web-vcs-yellow) - (propertize (format "Loaded from %S now" e-file) - 'font-lock-face 'web-vcs-red)))))))) - ;; provide - ((eq (car e) 'provide) - (insert " - ") - (let* ((feat (car e)) - (feat-name (symbol-name feat))) - (insert (cond - ((not (featurep feat)) - (if (or (string= elisp-feature-name - (symbol-name (cdr e)))) - (propertize "Web download, matches file name" 'font-lock-face 'web-vcs-green) - (propertize "Does not match file name" 'font-lock-face 'web-vcs-red))) - (t - ;; symbol-file will be where it is loaded - ;; so check load-path instead. - (let ((file (locate-library feat-name))) - (if (funcall is-same-file file) - (propertize "Probably loaded from same file now" 'font-lock-face 'web-vcs-yellow) - (propertize (format "Probably loaded from %S now" file) - 'font-lock-face 'web-vcs-yellow)))))))) - ;; require - ((eq (car e) 'require) - (if (featurep (cdr e)) - (insert " - " (propertize "Loaded now" 'font-lock-face 'web-vcs-green)) - (insert " - " (propertize "Not loaded now" 'font-lock-face 'web-vcs-yellow)))) - ;; Functions - ((memq (car e) '( defun macro)) - (insert " - ") - (let ((fun (cdr e))) - (insert (if (functionp fun) - (let ((e-file (symbol-file e))) - (if (funcall is-same-file e-file) - (propertize "Same file now" 'font-lock-face 'web-vcs-green) - (let* ((fun-web-auto (get fun 'web-autoload)) - (fun-sub-url (nth 2 fun-web-auto))) - ;; Fix-me: check for temp download file. - (if (string= fun-sub-url active-sub-url) - (propertize "Web download, matches current download" - 'font-lock-face 'web-vcs-yellow) - (propertize (format "Loaded from %S now" e-file) - 'font-lock-face 'web-vcs-yellow))))) - ;; Note that web autoloaded functions are already defined. - (propertize "New" 'font-lock-face 'web-vcs-yellow)))))) - (insert "\n")) - (insert " )\n") - (setq web-vcs-eval-output-end (point-max)) - (goto-char here)))) - (set-buffer-modified-p nil)))) - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Specific for nXhtml - -;;(defvar nxhtml-web-vcs-base-url "http://bazaar.launchpad.net/%7Enxhtml/nxhtml/main/") -(defvar nxhtml-web-vcs-base-url "http://bazaar.launchpad.net/~nxhtml/nxhtml/main/") - -;; Fix-me: make gen for 'lp etc -(defun nxhtml-download-root-url (revision) - (let* ((base-url nxhtml-web-vcs-base-url) - (files-url (concat base-url "files/")) - (rev-part (if revision (number-to-string revision) - ;; "head%3A/" - "head:/" - ))) - (concat files-url rev-part))) - -(defun web-vcs-nxhtml () - "Install nXhtml. -Download and install nXhtml." - (interactive) - (catch 'command-level - (setq debug-on-error t) - (let* ((this-dir (file-name-directory web-vcs-el-this)) - (root-url (nxhtml-download-root-url nil)) - ;;(files '("nxhtml-web-vcs.el" "nxhtml-base.el")) - (files '("nxhtml-web-vcs.el")) - (files2 (mapcar (lambda (file) - (cons file (expand-file-name file this-dir))) - files)) - need-dl) - (dolist (file files2) - (unless (file-exists-p (cdr file)) - (setq need-dl t))) - (when need-dl - (let ((prompt - (concat "Welcome to install nXhtml." - "\nFirst the nXhtml specific web install file must be downloaded." - "\nYou will get a chance to review it before it is used." - "\n\nDo you want to continue? ")) - (resize-mini-windows (or resize-mini-windows t))) - (unless (y-or-n-p prompt) - (message "Aborted") - (throw 'command-level nil)))) - (message nil) - (unless (get-buffer-window "*Messages*") - (web-vcs-display-messages t) - (delete-other-windows)) - (dolist (file files2) - (unless (file-exists-p (cdr file)) - (web-vcs-get-missing-matching-files 'lp root-url this-dir (car file) 0))) - (load (cdr (car files2)))) - (call-interactively 'nxhtml-setup-install))) - - -(provide 'web-vcs) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; web-vcs.el ends here -- cgit 1.4.1 From 6c6d76608301c24973a948bb693940a003f2a747 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 21:53:26 +0100 Subject: Emacs: add redshank-mode and install into lisp hooks --- emacs/init.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 46ecbdec..877e5fd3 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -831,6 +831,7 @@ Also returns nil if pid is nil." (if (featurep 'autopair) (autopair-mode -1)) (paredit-mode +1) + (redshank-mode +1) (eldoc-add-command 'paredit-backward-delete 'paredit-close-round) (if (featurep 'auto-indent-mode) @@ -861,6 +862,9 @@ Also returns nil if pid is nil." run-geiser run-racket)) +(use-package redshank + :ensure t) + (use-package geiser-base :defer t :config (use-package quack)) -- cgit 1.4.1 From 5f93ac74f283ed752b66de9c7fc61815654ba5d6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 21:57:01 +0100 Subject: Emacs: delete obsolete package-install.el --- emacs/elisp/package-install.el | 129 ----------------------------------------- 1 file changed, 129 deletions(-) delete mode 100644 emacs/elisp/package-install.el diff --git a/emacs/elisp/package-install.el b/emacs/elisp/package-install.el deleted file mode 100644 index f4ac9768..00000000 --- a/emacs/elisp/package-install.el +++ /dev/null @@ -1,129 +0,0 @@ -;;; package-install.el --- auto-installer for package.el - -;; Copyright (C) 2007, 2008 Tom Tromey - -;; This file is not (yet) part of GNU Emacs. -;; However, it is distributed under the same license. - -;; GNU Emacs is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. - -;; Code: - -;;; We don't want to define anything global here, so no defuns or -;;; defvars. - -;; Some values we need, copied from package.el, but with different -;; names. -(let ((my-archive-base "http://tromey.com/elpa/") - (my-user-dir (expand-file-name "~/.emacs.d/elpa"))) - - (require 'pp) - (let ((download - (lambda (url) - (if (fboundp 'url-retrieve-synchronously) - ;; Use URL to download. - (let ((buffer (url-retrieve-synchronously url))) - (save-excursion - (set-buffer buffer) - (goto-char (point-min)) - (re-search-forward "^$" nil 'move) - (forward-char) - (delete-region (point-min) (point)) - buffer)) - ;; Use wget to download. - (save-excursion - (with-current-buffer - (get-buffer-create - (generate-new-buffer-name " *Download*")) - (shell-command (concat "wget -q -O- " url) - (current-buffer)) - (goto-char (point-min)) - (current-buffer))))))) - - ;; Make the ELPA directory. - (make-directory my-user-dir t) - - ;; Download package.el and put it in the user dir. - (let ((pkg-buffer (funcall download (concat my-archive-base "package.el")))) - (save-excursion - (set-buffer pkg-buffer) - (setq buffer-file-name - (concat (file-name-as-directory my-user-dir) - "package.el")) - (save-buffer) - (kill-buffer pkg-buffer))) - - ;; Load package.el. - (load (expand-file-name "~/.emacs.d/elpa/package.el")) - - ;; Download URL package if we need it. - (unless (fboundp 'url-retrieve-synchronously) - ;; Note that we don't name the symbol "url-version", as that - ;; will cause us not to define the real url-version when - ;; url-vars is loaded, which in turn will cause errors later. - ;; Thanks to Tom Breton for this subtlety. - (let* ((the-version "1.15") - (pkg-buffer (funcall download (concat my-archive-base - "url-" the-version ".tar")))) - (save-excursion - (set-buffer pkg-buffer) - (package-unpack 'url the-version) - (kill-buffer pkg-buffer)))) - - ;; Arrange to load package.el at startup. - ;; Partly copied from custom-save-all. - - - (let ((filename (or user-init-file - (and (yes-or-no-p "You have no user-init-file, probably because Emacs was started with -q. Use ~/.emacs? ") - (convert-standard-filename "~/.emacs")))) - (magic (pp-to-string - '(when (load (expand-file-name "~/.emacs.d/elpa/package.el")) - (package-initialize))))) - (if (not filename) - (warn (concat "Cannot automatically activate package.el after reboot.\n" - "Please append the following code to your .emacs manually:\n" - "%s") magic) - (let ((old-buffer (find-buffer-visiting filename))) - (with-current-buffer (let ((find-file-visit-truename t)) - (or old-buffer (find-file-noselect filename))) - (unless (eq major-mode 'emacs-lisp-mode) - (emacs-lisp-mode)) - (let ((inhibit-read-only t)) - (save-excursion - (goto-char (point-max)) - (newline (if (bolp) 2 1)) - (insert ";;; This was installed by package-install.el.\n") - (insert ";;; This provides support for the package system and\n") - (insert ";;; interfacing with ELPA, the package archive.\n") - (insert ";;; Move this code earlier if you want to reference\n") - (insert ";;; packages in your .emacs.\n") - (insert magic))) - (let ((file-precious-flag t)) - (save-buffer)) - (unless old-buffer - (kill-buffer (current-buffer))))))) - - ;; Start the package manager. - (package-initialize) - - ;; Read package archive to give the user a nice initial - ;; experience. FIXME: this doesn't work, at least squid gave a - ;; weird error when I tried it :( - ;; (package-refresh-contents) - )) - -;;; package-install.el ends here -- cgit 1.4.1 From 0e2e827dd3103c3cd354048de1475f79b5ea5335 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 22:00:15 +0100 Subject: Byte-compile all the emacs files --- install | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/install b/install index efc03cb9..dfb8d5ff 100755 --- a/install +++ b/install @@ -46,8 +46,7 @@ popd if [[ -x =emacs ]] then - emacs --batch -f batch-byte-compile ~/.emacs.d/init.el - emacs --batch -f batch-byte-compile ~/.emacs.d/elisp/*.el + emacs --batch --eval '(batch-byte-recompile-directory 0)' ~/.emacs.d/ fi fasd_cache=~/.zsh/cache/fasd-init-zsh -- cgit 1.4.1 From 29f84991f8dadd33ef61b4a902db5620f76b81e3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 May 2013 23:21:13 +0100 Subject: zsh: move smart_sudo alias from s to su to allow fasd to use s --- zsh/zshrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/zsh/zshrc b/zsh/zshrc index 9437fcc8..938dcbd9 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -269,6 +269,7 @@ alias lsr="ls -tld *(m-2)" # mtime < -2days alias trans="transmission-remote transmission.home" alias bitcoin="bitcoind" alias namecoin="~alan/applications/namecoin/src/namecoind" +alias su="smart_sudo " alias e="$EDITOR" alias E="SUDO_EDITOR=\emacsclient -c -a emacs\" sudoedit" alias aticonfig="DISPLAY=:0 \aticonfig" @@ -344,5 +345,3 @@ _FASD_DATA="$HOME/.zsh/fasd-data" autoload -U fasd source ~/.zsh/cache/fasd-init-zsh alias e="f -e $EDITOR" - -alias s="smart_sudo " -- cgit 1.4.1 From a0b0e04d9f47729697eba4bb491b647bfd8d81f9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 20 May 2013 12:44:49 +0100 Subject: Emacs: Don't call redshank-mode if redshank is not loaded --- emacs/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 877e5fd3..9c17e403 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -831,7 +831,8 @@ Also returns nil if pid is nil." (if (featurep 'autopair) (autopair-mode -1)) (paredit-mode +1) - (redshank-mode +1) + (if (featurep 'redshank) + (redshank-mode +1)) (eldoc-add-command 'paredit-backward-delete 'paredit-close-round) (if (featurep 'auto-indent-mode) -- cgit 1.4.1 From 71c88bc14e9d0c9ebbaa7f119206e71f66cd7a45 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 22 May 2013 19:30:03 +0100 Subject: Emacs: Add localhost to the list of TRAMP remotes which should not be proxied --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index 9c17e403..9d097395 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -384,6 +384,7 @@ Values: `desktop', `server', `laptop'") 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 -- cgit 1.4.1 From 7dc707c8c32b972ed505f16a3bb1f865766003b5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 22 May 2013 19:30:56 +0100 Subject: Emacs: bind d in mu4e headers to mark for delete instead of for trash --- emacs/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 9d097395..d5c9cb1b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -276,7 +276,8 @@ Values: `desktop', `server', `laptop'") mu4e-sent-folder "/alanpearce/Sent" mu4e-drafts-folder "/alanpearce/Drafts" mu4e-refile-folder "/alanpearce/Archive") - (define-key mu4e-main-mode-map "q" #'bury-buffer))) + (bind-key "q" #'bury-buffer mu4e-main-mode-map) + (bind-key "d" #'mu4e-headers-mark-for-delete mu4e-headers-mode-map))) ;;;; Completion -- cgit 1.4.1 From f3f77f580bd9d0ebcf49fb471e1913a26ac2f7e8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 24 May 2013 10:51:42 +0100 Subject: Emacs: only enable moz-minor-mode in javascript if loaded --- emacs/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index d5c9cb1b..77f12c2a 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -992,7 +992,8 @@ Works with: arglist-cont-nonempty, arglist-close." :mode ("\\.js\\'" . js3-mode) :config (progn (defun ap/javascript-setup () - (moz-minor-mode t) + (if (featurep 'moz) + (moz-minor-mode t)) (autopair-mode -1) (auto-indent-mode -t)) (add-hook 'js3-mode-hook #'ap/javascript-setup) -- cgit 1.4.1 From 7d03c01ed268d7dccd5dc74fa62ab44cb74b133d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 24 May 2013 10:52:06 +0100 Subject: Emacs: fix typo in javascript setup --- emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 77f12c2a..e9e3d38a 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -995,7 +995,7 @@ Works with: arglist-cont-nonempty, arglist-close." (if (featurep 'moz) (moz-minor-mode t)) (autopair-mode -1) - (auto-indent-mode -t)) + (auto-indent-mode -1)) (add-hook 'js3-mode-hook #'ap/javascript-setup) (setq js3-indent-level 4 js3-expr-indent-offset 4 -- cgit 1.4.1 From 7a7f3c1caab84d65b051b593a69b349ea4442a9b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 24 May 2013 10:52:24 +0100 Subject: Emacs: setup javascript indentation rules --- emacs/init.el | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index e9e3d38a..d17031b4 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -998,10 +998,8 @@ Works with: arglist-cont-nonempty, arglist-close." (auto-indent-mode -1)) (add-hook 'js3-mode-hook #'ap/javascript-setup) (setq js3-indent-level 4 - js3-expr-indent-offset 4 - js3-paren-indent-offset 4 - js3-square-indent-offset 4 - js3-curly-indent-offset 4))) + js3-indent-tabs-mode t + js3-global-externs '("$")))) (use-package mustache-mode :ensure t -- cgit 1.4.1 From b19e6b7177b67fdd15fd306a47754a313068a6df Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 25 May 2013 17:26:36 +0100 Subject: Emacs: turn on ido-mode instead of toggling --- emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index d17031b4..b6e20b31 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -474,7 +474,7 @@ Values: `desktop', `server', `laptop'") :init (bind-key* "C-x C-f" #'ido-find-file) :bind (("C-x b" . ido-switch-buffer)) :config (progn - (ido-mode) + (ido-mode 1) (setq ido-decorations (quote ("\n›" "" "\n " "\n …" "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]"))) (setq ido-auto-merge-delay-time 99999 ido-enable-flex-matching t) -- cgit 1.4.1 From 298e9d8b43006588d3a4f1ecbcfaf48d9df42af0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 27 May 2013 14:32:08 +0100 Subject: Emacs: add use-package declarations to Imenu when in elisp --- emacs/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index b6e20b31..7dc6e42f 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -880,7 +880,8 @@ Also returns nil if pid is nil." (defun imenu-elisp-sections () (setq imenu-prev-index-position-function nil) - (add-to-list 'imenu-generic-expression '("Sections" "^;;;; \\(.+\\)$" 1) t)) + (add-to-list 'imenu-generic-expression '("Sections" "^;;;; \\(.+\\)$" 1) t) + (add-to-list 'imenu-generic-expression '("Packages" "^(use-package\\s-+\\(\\(\\sw\\|\\s_\\)+\\)$" 1) t)) (defun init-narrow-to-section () (interactive) -- cgit 1.4.1 From d46e831026aeff0f6577edab0a3accfbecc68d0b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 27 May 2013 14:32:28 +0100 Subject: Emacs: always disable C-z --- emacs/init.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 7dc6e42f..033ab4ed 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -438,8 +438,7 @@ Values: `desktop', `server', `laptop'") (bind-key "" #'execute-extended-command) -(if (display-graphic-p) - (unbind-key "C-z")) +(unbind-key "C-z") (bind-key "C-" #'other-window) (bind-key "C-x C-r" #'revert-buffer) -- cgit 1.4.1 From 83923895305252c639019ffa2e0270f5cc54f614 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 28 May 2013 19:09:11 +0100 Subject: Emacs: make shell-execute work when buffer is not visiting a file --- emacs/elisp/ap-functions.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs/elisp/ap-functions.el b/emacs/elisp/ap-functions.el index d9278fa0..b6994643 100644 --- a/emacs/elisp/ap-functions.el +++ b/emacs/elisp/ap-functions.el @@ -39,6 +39,8 @@ ;;;###autoload (defun shell-execute () (interactive) - (let ((file-buffer (or (file-name-nondirectory (buffer-file-name)) "")) + (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)))) -- cgit 1.4.1 From 833cdbc654cc90cb9c922fe80a9d9dcfb635e6e2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 28 May 2013 19:44:06 +0100 Subject: Emacs: use em-smart package to return to previous command in eshell sessions --- emacs/init.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 033ab4ed..502a1ec2 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -712,7 +712,14 @@ Also returns nil if pid is nil." (use-package eshell :defer t - :config (setq eshell-directory-name "~/.emacs.d/eshell")) + :config (progn + (setq eshell-directory-name "~/.emacs.d/eshell") + (use-package em-smart + :init (progn + (setq eshell-where-to-jump 'begin + eshell-review-quick-commands nil + eshell-smart-space-goes-to-end t) + (eshell-smart-initialize))))) (use-package shell :defer t -- cgit 1.4.1 From 018c54df934153322f82b1c1c500dce00c83979f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 28 May 2013 21:01:30 +0100 Subject: Emacs: move calendar setup to new ‘Dates & Times’ section --- emacs/init.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 502a1ec2..30b4e6b6 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -298,6 +298,14 @@ Values: `desktop', `server', `laptop'") :init (progn (add-hook 'prog-mode-hook #'company-mode))) +;;;; Dates & Times + +(use-package calendar + :defer t + :config (progn + (setq calendar-week-start-day 1) + (calendar-set-date-style 'iso))) + ;;;; Directory browsing (use-package dired :defer t @@ -533,12 +541,6 @@ Values: `desktop', `server', `laptop'") ;;;; Planning -(use-package calendar - :defer t - :config (progn - (setq calendar-week-start-day 1) - (calendar-set-date-style 'iso))) - (use-package org :bind (("C-c C-a" . org-agenda-list) ("C-c a" . org-agenda) -- cgit 1.4.1 From ea157ffc4382057bd3f2e924e80866ebd2fd33d7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 28 May 2013 21:05:51 +0100 Subject: Emacs: add command to insert a formatted date --- emacs/init.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 30b4e6b6..4941e36b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -306,6 +306,16 @@ Values: `desktop', `server', `laptop'") (setq calendar-week-start-day 1) (calendar-set-date-style 'iso))) +(defun insert-date (prefix) + "Insert the current date. With prefix-argument, use British format. With + 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)))) + ;;;; Directory browsing (use-package dired :defer t -- cgit 1.4.1 From f59f31505c64291c7f247fcfded0ba8ff3c513b5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 28 May 2013 21:21:04 +0100 Subject: Emacs: add register bindings for emacs init file and organiser.org --- emacs/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 4941e36b..13833c27 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -465,6 +465,8 @@ Values: `desktop', `server', `laptop'") (bind-key "C-c i" #'ucs-insert) +(set-register ?e `(file . ,user-init-file)) + ;; Enable narrowing functions C-x n (put 'narrow-to-defun 'disabled nil) (put 'narrow-to-page 'disabled nil) @@ -596,6 +598,7 @@ Values: `desktop', `server', `laptop'") org-todo-keywords '((sequence "TODO" "STARTED" "|" "DONE") (sequence "TOLEARN" "LEARNING" "LEARNED" "|" "MASTERED") (sequence "|" "CANCELLED"))) + (set-register ?o `(file . ,(expand-file-name "organiser.org" org-directory))) (defadvice org-clock-in (after wicked activate) "Mark STARTED when clocked in" (save-excursion -- cgit 1.4.1 From f40ae73f2968e4b5343741839fe5af7b10f903a0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 28 May 2013 21:21:55 +0100 Subject: Emacs: change goto-last-change binding to C-x to avoid conflicting with pop-global-mark --- emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 13833c27..95363eba 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -799,7 +799,7 @@ Also returns nil if pid is nil." :bind ("C-M-SPC" . er/expand-region)) (use-package goto-chg - :bind ("C-x C-SPC" . goto-last-change)) + :bind ("C-x SPC" . goto-last-change)) (use-package multiple-cursors :ensure t -- cgit 1.4.1 From adcfe2752fa9a229953256c32c68f67d28f0aaf2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 30 May 2013 15:07:41 +0100 Subject: Emacs: replace js3-mode with js2-mode --- emacs/init.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 95363eba..0fafe5fb 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1010,18 +1010,18 @@ Works with: arglist-cont-nonempty, arglist-close." (comint-send-string (inferior-moz-process) "BrowserReload();")))) -(use-package js3 - :mode ("\\.js\\'" . js3-mode) +(use-package js2 + :ensure t + :mode ("\\.js\\'" . js2-mode) :config (progn (defun ap/javascript-setup () (if (featurep 'moz) (moz-minor-mode t)) (autopair-mode -1) (auto-indent-mode -1)) - (add-hook 'js3-mode-hook #'ap/javascript-setup) - (setq js3-indent-level 4 - js3-indent-tabs-mode t - js3-global-externs '("$")))) + (add-hook 'js2-mode-hook #'ap/javascript-setup) + (setq js2-basic-offset 4 + js2-global-externs '("$")))) (use-package mustache-mode :ensure t -- cgit 1.4.1 From fa74d8eea2244394882fe05f0add8874a44ae5ba Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 30 May 2013 15:10:25 +0100 Subject: Emacs: install and skewer-mode and hook into js2-mode --- emacs/init.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 0fafe5fb..1b43f143 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1008,6 +1008,8 @@ Works with: arglist-cont-nonempty, arglist-close." "Reload Firefox" (interactive) (comint-send-string (inferior-moz-process) +(use-package skewer-mode + :ensure t) "BrowserReload();")))) (use-package js2 @@ -1016,6 +1018,8 @@ Works with: arglist-cont-nonempty, arglist-close." :config (progn (defun ap/javascript-setup () (if (featurep 'moz) + (if (featurep 'skewer-mode) + (skewer-mode +1)) (moz-minor-mode t)) (autopair-mode -1) (auto-indent-mode -1)) -- cgit 1.4.1 From 0189acaf9bb17d8c70c4187ae3c700a7d491d4e1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 30 May 2013 15:21:12 +0100 Subject: Emacs: fix bad diff --- emacs/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 1b43f143..491a570f 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1007,10 +1007,10 @@ Works with: arglist-cont-nonempty, arglist-close." (defun moz-firefox-reload () "Reload Firefox" (interactive) - (comint-send-string (inferior-moz-process) + (comint-send-string (inferior-moz-process) "BrowserReload();")))) + (use-package skewer-mode :ensure t) - "BrowserReload();")))) (use-package js2 :ensure t -- cgit 1.4.1 From 333dd7930ef9e79fd76e8b6ec9157b9d0c5bd52d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 30 May 2013 15:21:28 +0100 Subject: Emacs: fix incorrect package name for js2-mode --- emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 491a570f..fdd288ad 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1012,7 +1012,7 @@ Works with: arglist-cont-nonempty, arglist-close." (use-package skewer-mode :ensure t) -(use-package js2 +(use-package js2-mode :ensure t :mode ("\\.js\\'" . js2-mode) :config (progn -- cgit 1.4.1 From 693a2104ef68de2146d074fc47691c4ffdb8dd38 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 30 May 2013 15:23:42 +0100 Subject: Emacs: fix bad diff again --- emacs/init.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index fdd288ad..5c1f4969 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1017,10 +1017,10 @@ Works with: arglist-cont-nonempty, arglist-close." :mode ("\\.js\\'" . js2-mode) :config (progn (defun ap/javascript-setup () - (if (featurep 'moz) - (if (featurep 'skewer-mode) + (if (featurep 'moz) + (moz-minor-mode)) + (if (featurep 'skewer-mode) (skewer-mode +1)) - (moz-minor-mode t)) (autopair-mode -1) (auto-indent-mode -1)) (add-hook 'js2-mode-hook #'ap/javascript-setup) -- cgit 1.4.1 From 2b5aca224fcdc119e5fe0f8b7c5c277aecd3daab Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 31 May 2013 19:43:00 +0100 Subject: Emacs: rename deprecated org-alphabetical-lists variable --- emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 5c1f4969..7eb05bec 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -582,7 +582,7 @@ Values: `desktop', `server', `laptop'") ;; Allow refiling into any org file org-refile-targets '((org-agenda-files :maxlevel . 3)) - org-alphabetical-lists t + org-list-allow-alphabetical t org-pretty-entities t -- cgit 1.4.1 From e328a3a136377f0ccf5d56ee5ddfbc259f999f92 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 1 Jun 2013 14:30:22 +0100 Subject: Installer: Fix directory stack popping too early --- install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install b/install index dfb8d5ff..fef5b4e9 100755 --- a/install +++ b/install @@ -42,8 +42,6 @@ then install-dot projects/dwm/ dotfiles/dwm/* fi -popd - if [[ -x =emacs ]] then emacs --batch --eval '(batch-byte-recompile-directory 0)' ~/.emacs.d/ @@ -74,3 +72,5 @@ zrecompile -p -R ~/.zshrc.zwc $zfiles for fp in zsh/functions/*(/); do zrecompile -p $fp $fp/* done + +popd -- cgit 1.4.1 From 10353603cc72f37034b86071f9c495d866dafeaf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 1 Jun 2013 14:36:15 +0100 Subject: Installer: Fix FreeBSD detection --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index fef5b4e9..8d6ae180 100755 --- a/install +++ b/install @@ -63,7 +63,7 @@ zfiles=( if [[ -e /usr/bin/emerge ]]; then zfiles+=zsh/zshrc_gentoo fi -if [[ $OSTYPE == freebsd ]]; then +if [[ $OSTYPE == freebsd* ]]; then zfiles+=zsh/zshrc_freebsd fi -- cgit 1.4.1 From d87f35f675e774bcab14db580795ebbc9c86d5d4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 1 Jun 2013 14:39:28 +0100 Subject: Installer: Fix relative paths --- install | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/install b/install index 8d6ae180..0fa5859e 100755 --- a/install +++ b/install @@ -48,28 +48,28 @@ then fi fasd_cache=~/.zsh/cache/fasd-init-zsh -if [[ ! -s "$fasd_cache" || zsh/functions/fasd -nt "$fasd_cache" ]]; then - zsh/functions/fasd/fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache" +if [[ ! -s "$fasd_cache" || dotfiles/zsh/functions/fasd -nt "$fasd_cache" ]]; then + dotfiles/zsh/functions/fasd/fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache" fi autoload -U zrecompile local -a zfiles zfiles=( - zsh/functions/fasd/fasd + dotfiles/zsh/functions/fasd/fasd $fasd_cache - zsh/zshrc - zsh/zshrc_${HOST%%.*} + dotfiles/zsh/zshrc + dotfiles/zsh/zshrc_${HOST%%.*} ) if [[ -e /usr/bin/emerge ]]; then - zfiles+=zsh/zshrc_gentoo + zfiles+=dotfiles/zsh/zshrc_gentoo fi if [[ $OSTYPE == freebsd* ]]; then - zfiles+=zsh/zshrc_freebsd + zfiles+=dotfiles/zsh/zshrc_freebsd fi zrecompile -p -R ~/.zshrc.zwc $zfiles -for fp in zsh/functions/*(/); do +for fp in dotfiles/zsh/functions/*(/); do zrecompile -p $fp $fp/* done -- cgit 1.4.1 From 70a4bc8fb2620ed7cec9ab21626733dfaf952272 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 1 Jun 2013 16:08:12 +0100 Subject: Emacs: make company overlay display more quickly --- emacs/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 7eb05bec..1c224b43 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -296,7 +296,8 @@ Values: `desktop', `server', `laptop'") :commands (company-mode) :bind (("C-" . company-complete)) :init (progn - (add-hook 'prog-mode-hook #'company-mode))) + (add-hook 'prog-mode-hook #'company-mode) + (setq company-idle-delay .3))) ;;;; Dates & Times -- cgit 1.4.1 From e89e6343160ae694fdf51feaac7e2531c83de5c2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 2 Jun 2013 10:50:05 +0100 Subject: Emacs: use *init-file* to track the location of init.el through symlinks --- emacs/init.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 1c224b43..f880cb3b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -41,6 +41,9 @@ Values: `desktop', `server', `laptop'") (interactive) (setq env/location (env/get-location))) +(defvar *init-file* (expand-file-name "init.el" (file-name-directory (file-truename user-init-file))) + "Where the emacs init file really is, passing through symlinks.") + ;;;; Package Management (eval-and-compile (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") @@ -466,7 +469,7 @@ Values: `desktop', `server', `laptop'") (bind-key "C-c i" #'ucs-insert) -(set-register ?e `(file . ,user-init-file)) +(set-register ?e `(file . ,*init-file*)) ;; Enable narrowing functions C-x n (put 'narrow-to-defun 'disabled nil) @@ -919,7 +922,7 @@ Also returns nil if pid is nil." (defun init-imenu (p) (interactive "P") - (find-file-existing "~/dotfiles/emacs/init.el") + (find-file-existing *init-file*) (widen) (helm-imenu) (if p (init-narrow-to-section))) -- cgit 1.4.1 From f9e008b9fa277dad7e412f74b563951187f7f003 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 2 Jun 2013 11:05:02 +0100 Subject: Emacs: enable auto-indent-mode in lisps and set its indent level to 2 --- emacs/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index f880cb3b..0df2b1f1 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -863,8 +863,8 @@ Also returns nil if pid is nil." (eldoc-add-command 'paredit-backward-delete 'paredit-close-round) (if (featurep 'auto-indent-mode) - (progn (auto-indent-mode -1) - (setq lisp-body-indent 2))) + (progn (set (make-local-variable 'auto-indent-assign-indent-level) 2) + (auto-indent-mode +1))) (show-paren-mode t) (setq indent-tabs-mode nil) -- cgit 1.4.1 From c9f6f4efd9963a5037253e5f51be59f67ac096dd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 2 Jun 2013 11:09:54 +0100 Subject: Emacs: install multi-term if it is not available --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index 0df2b1f1..6c972190 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -746,6 +746,7 @@ Also returns nil if pid is nil." (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) (use-package multi-term + :ensure t :if (not (eq system-type 'windows-nt)) :bind ("C-`" . multi-term-dedicated-toggle)) -- cgit 1.4.1 From 9e7d9adf4d10dc9437f30eb7bd49f21bb904a05b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 2 Jun 2013 12:28:31 +0100 Subject: Emacs: make helm update the candidate selection window more quickly --- emacs/init.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 6c972190..b00aac48 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -491,7 +491,9 @@ Values: `desktop', `server', `laptop'") (use-package helm-config :ensure helm :bind (("C-x i" . helm-imenu) - ("C-x C-b" . helm-mini))) + ("C-x C-b" . helm-mini)) + :config (setq helm-idle-delay .1 + helm-input-idle-delay .1)) (use-package ido :init (bind-key* "C-x C-f" #'ido-find-file) -- cgit 1.4.1 From 954a691139a1756af64e2db7091c6ea66cb92fe9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 2 Jun 2013 20:19:34 +0100 Subject: Emacs: add keyboard binding for switching to eshell --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index b00aac48..e88c9233 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -732,6 +732,7 @@ Also returns nil if pid is nil." ;;;; Shells & REPLs (use-package eshell + :bind ("C-c s" . eshell) :defer t :config (progn (setq eshell-directory-name "~/.emacs.d/eshell") -- cgit 1.4.1 From 6ce4aa99a7ea9a7996b971e38c83a56e4bab82af Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 2 Jun 2013 20:20:17 +0100 Subject: Emacs: add function and keybinding for opening eshell in the current directory --- emacs/init.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index e88c9233..96d105e5 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -743,6 +743,13 @@ Also returns nil if pid is nil." eshell-smart-space-goes-to-end t) (eshell-smart-initialize))))) +(defun eshell-goto-current-dir (&optional arg) + (interactive "P") + (let ((dir default-directory)) + (eshell arg) + (eshell/cd dir))) +(bind-key "C-c S" #'eshell-goto-current-dir) + (use-package shell :defer t :config (define-key shell-mode-map -- cgit 1.4.1 From 089fc46ad23ad12b9be83705b10121750c325f08 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 2 Jun 2013 20:21:43 +0100 Subject: Emacs: Improve X11 clipboard interoperability --- emacs/init.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 96d105e5..973b94a2 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -774,6 +774,10 @@ Also returns nil if pid is nil." (setq sentence-end-double-space nil line-move-visual nil) +(setq x-select-enable-clipboard t) +(if (functionp 'x-cut-buffer-or-selection-value) + (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)) + ;; replace highlighted text rather than just inserting at point (delete-selection-mode t) -- cgit 1.4.1 From 95ccf32f4ab3f8bc42582093d711a61f8c988f3d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 2 Jun 2013 20:24:13 +0100 Subject: Emacs: Bind shift+space to set the mark --- emacs/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 973b94a2..5a93632d 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -781,6 +781,8 @@ Also returns nil if pid is nil." ;; replace highlighted text rather than just inserting at point (delete-selection-mode t) +(bind-key "S-SPC" #'set-mark-command) + (use-package subword :init (global-subword-mode t)) -- cgit 1.4.1 From e4760e1c9358c48887ff47f5a4b28ebc30328471 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 3 Jun 2013 21:37:01 +0100 Subject: Emacs: disable CEDET configuration until I figure out how to update it again --- emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 5a93632d..65a2501e 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -617,7 +617,7 @@ Values: `desktop', `server', `laptop'") ;;;; Programming (use-package cedet - :defer t + :disabled t :config (progn (semantic-load-enable-code-helpers) (global-semantic-idle-completions-mode t) -- cgit 1.4.1 From 840c6f683c5fa5f41b95d254e3a87aa245630160 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 8 Jun 2013 13:34:44 +0100 Subject: Emacs: add lisp-common-mode-hook to allow cleaner setup of Lisp modes --- emacs/init.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 65a2501e..6a370309 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -9,6 +9,12 @@ user-full-name "Alan Pearce" custom-file "~/.emacs.d/custom.el") +;;; Allow lisps to use a common setup. I don't know why they don't have some lispy mode as their parent, but this is close enough +(defcustom lisp-common-mode-hook nil + "Hook run when entering any Lisp mode." + :type 'hook + :group 'lisp) + ;;;; Environment & Location (defun env/get-location () -- cgit 1.4.1 From c69634f046284580989ae7c7cd6705bbd0f2b243 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 8 Jun 2013 13:46:11 +0100 Subject: Emacs: migrate expressions from ap/lisp-setup to lisp-common-mode-hook where possible --- emacs/init.el | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 6a370309..641cdc29 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -446,7 +446,10 @@ Values: `desktop', `server', `laptop'") 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-global-mode))) + (auto-indent-global-mode) + (defun lisp-auto-indent-mode () + (set (make-local-variable 'auto-indent-assign-indent-level) 2)) + (add-hook 'lisp-common-mode-hook #'lisp-auto-indent-mode))) (use-package smart-tabs-mode :ensure t @@ -815,9 +818,13 @@ Also returns nil if pid is nil." (use-package autopair :ensure t - :commands (autopair-mode) + :commands (autopair-mode + autopair-on) :init (progn - (add-hook 'prog-mode-hook #'autopair-mode) + (add-hook 'prog-mode-hook #'autopair-on) + (defun autopair-off () + (autopair-mode -1)) + (add-hook 'lisp-common-mode-hook #'autopair-off) (setq autopair-blink nil autopair-skip-whitespace nil))) @@ -836,10 +843,16 @@ Also returns nil if pid is nil." ("C-" . mc/mark-more-like-this-extended) ("C-S-L" . mc/edit-lines))) +(use-package eldoc + :defuns (eldoc-add-command) + :config (progn + (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) + (use-package paredit :ensure t :commands (paredit-mode) :init (progn + (add-hook 'lisp-common-mode-hook #'enable-paredit-mode) (put #'paredit-forward-delete 'delete-selection 'supersede) (put #'paredit-backward-delete 'delete-selection 'supersede) (add-hook 'minibuffer-setup-hook #'conditionally-enable-paredit-mode) @@ -878,17 +891,7 @@ Also returns nil if pid is nil." ;;;; Lisps (defun ap/lisp-setup () - (if (featurep 'autopair) - (autopair-mode -1)) - (paredit-mode +1) - (if (featurep 'redshank) - (redshank-mode +1)) - (eldoc-add-command 'paredit-backward-delete 'paredit-close-round) - - (if (featurep 'auto-indent-mode) - (progn (set (make-local-variable 'auto-indent-assign-indent-level) 2) - (auto-indent-mode +1))) - + (run-hooks 'lisp-common-mode-hook) (show-paren-mode t) (setq indent-tabs-mode nil) (local-set-key (kbd "RET") #'paredit-newline)) @@ -914,7 +917,9 @@ Also returns nil if pid is nil." run-racket)) (use-package redshank - :ensure t) + :ensure t + :init (progn + (add-hook 'lisp-common-mode-hook #'turn-on-redshank-mode))) (use-package geiser-base :defer t -- cgit 1.4.1 From 34bb5369da5ed09c712131e9b076db949f208e7e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 8 Jun 2013 13:54:04 +0100 Subject: Emacs: globally highlight matching parentheses --- emacs/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 641cdc29..1b335436 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -790,6 +790,8 @@ Also returns nil if pid is nil." ;; replace highlighted text rather than just inserting at point (delete-selection-mode t) +(show-paren-mode t) + (bind-key "S-SPC" #'set-mark-command) (use-package subword @@ -892,7 +894,6 @@ Also returns nil if pid is nil." (defun ap/lisp-setup () (run-hooks 'lisp-common-mode-hook) - (show-paren-mode t) (setq indent-tabs-mode nil) (local-set-key (kbd "RET") #'paredit-newline)) -- cgit 1.4.1 From 67c1c83f61eaf206ccbb0bd939a81dfa54ac109e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 8 Jun 2013 13:54:32 +0100 Subject: Emacs: remove redundant :defer specifications --- emacs/init.el | 2 -- 1 file changed, 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 1b335436..c3a7743b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -434,7 +434,6 @@ Values: `desktop', `server', `laptop'") tab-always-indent 'complete) (use-package auto-indent-mode - :defer t :ensure t :commands (auto-indent-minor-mode auto-indent-mode) @@ -911,7 +910,6 @@ Also returns nil if pid is nil." :diminish elisp-slime-nav-mode) (use-package geiser - :defer t :commands (geiser-mode geiser run-geiser -- cgit 1.4.1 From 1684ef963ebee889ed76dede11807882b588bba6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 8 Jun 2013 14:04:41 +0100 Subject: Emacs: delay loading skewer until needed --- emacs/init.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index c3a7743b..141ad58a 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1041,7 +1041,12 @@ Works with: arglist-cont-nonempty, arglist-close." (comint-send-string (inferior-moz-process) "BrowserReload();")))) (use-package skewer-mode - :ensure t) + :ensure t + :defer t + :init (progn + (add-hook 'js2-mode-hook #'skewer-mode) + (add-hook 'html-mode-hook #'skewer-html-mode) + (add-hook 'css-mode-hook #'skewer-css-mode))) (use-package js2-mode :ensure t @@ -1050,8 +1055,6 @@ Works with: arglist-cont-nonempty, arglist-close." (defun ap/javascript-setup () (if (featurep 'moz) (moz-minor-mode)) - (if (featurep 'skewer-mode) - (skewer-mode +1)) (autopair-mode -1) (auto-indent-mode -1)) (add-hook 'js2-mode-hook #'ap/javascript-setup) -- cgit 1.4.1 From 82e8081c4c9f04a8f1e65b0d410becee6982c17f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 8 Jun 2013 14:04:57 +0100 Subject: Emacs: delay loading quickrun until needed --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index 141ad58a..747bfa0a 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1017,6 +1017,7 @@ Works with: arglist-cont-nonempty, arglist-close." (current-column)))))))))) (use-package quickrun + :defer t :ensure t) ;;;; Web Development -- cgit 1.4.1 From 8b00c6e89dfc49c1d8f1016b28c0199b40d8b75a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 8 Jun 2013 14:06:41 +0100 Subject: Emacs: delay loading eldoc until needed --- emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 747bfa0a..0a68bc3b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -845,7 +845,7 @@ Also returns nil if pid is nil." ("C-S-L" . mc/edit-lines))) (use-package eldoc - :defuns (eldoc-add-command) + :defer t :config (progn (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) -- cgit 1.4.1 From cd607bf68816e6322f56c89b11c04aa77058db30 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 8 Jun 2013 14:07:53 +0100 Subject: Emacs: delay loading redshank until needed --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index 0a68bc3b..001dbb64 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -917,6 +917,7 @@ Also returns nil if pid is nil." (use-package redshank :ensure t + :defer t :init (progn (add-hook 'lisp-common-mode-hook #'turn-on-redshank-mode))) -- cgit 1.4.1 From e08c19b54fe61fe787d2129cc97d469e0d36962a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 11 Jun 2013 21:31:35 +0100 Subject: Emacs: setup slime with the quicklisp-slime-helper --- emacs/init.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 001dbb64..330ad5a0 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -926,10 +926,14 @@ Also returns nil if pid is nil." :config (use-package quack)) (use-package slime + :ensure t :commands (slime) :config (progn - (setq inferior-lisp-program (executable-find "sbcl")) - (slime-setup))) + (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")))) (defun imenu-elisp-sections () (setq imenu-prev-index-position-function nil) -- cgit 1.4.1 From 904e18d318ce25bc5a7ab589bd64fa42c404d68c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 11 Jun 2013 21:31:53 +0100 Subject: Emacs: install and configure org-journal --- emacs/init.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 330ad5a0..5f323a6f 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -622,6 +622,10 @@ Values: `desktop', `server', `laptop'") (if (looking-at (concat " +" org-todo-regexp "\\( +\\|[ \t]*$\\)")) (org-todo "STARTED"))))))) +(use-package org-journal + :config (progn + (setq org-journal-date-format "%A, %d %B %Y"))) + ;;;; Programming (use-package cedet -- cgit 1.4.1 From 3b77cea165c47d617035c3fb622aaa9cfcc3bcaa Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 22 Jun 2013 09:05:40 +0100 Subject: Emacs: setup jinja2-mode --- emacs/init.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 5f323a6f..b9b29e16 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1077,6 +1077,10 @@ Works with: arglist-cont-nonempty, arglist-close." ("\\.mt\\'" . mustache-mode) ("\\.template\\'" . mustache-mode))) +(use-package jinja2-mode + :ensure t + :mode (("\\.j2\\'" . jinja2-mode))) + (use-package nxhtml-mode :defer t :if (eq env/system-type 'laptop) -- cgit 1.4.1 From bd70cf69863edb293f2cf4a14275327ea411fdcf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 22 Jun 2013 10:04:20 +0100 Subject: Emacs: don't initialise *init-file* when user-init-file is not set --- emacs/init.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index b9b29e16..6ab12fe4 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -47,7 +47,10 @@ Values: `desktop', `server', `laptop'") (interactive) (setq env/location (env/get-location))) -(defvar *init-file* (expand-file-name "init.el" (file-name-directory (file-truename user-init-file))) +(defvar *init-file* + (when user-init-file + (expand-file-name "init.el" + (file-name-directory (file-truename user-init-file)))) "Where the emacs init file really is, passing through symlinks.") ;;;; Package Management -- cgit 1.4.1 From 189f41ba7afb45813b810810472793f5c9f0c7fa Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 22 Jun 2013 10:04:31 +0100 Subject: Emacs: load custom file --- emacs/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 6ab12fe4..f65b1386 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -9,6 +9,8 @@ user-full-name "Alan Pearce" custom-file "~/.emacs.d/custom.el") +(load custom-file :noerror) + ;;; Allow lisps to use a common setup. I don't know why they don't have some lispy mode as their parent, but this is close enough (defcustom lisp-common-mode-hook nil "Hook run when entering any Lisp mode." -- cgit 1.4.1 From eeb7399103580db187077cbb2aa406348e3a6b6c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 22 Jun 2013 10:04:57 +0100 Subject: Emacs: fix compilation warning regarding eshell/cd --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index f65b1386..9d658ab1 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -760,6 +760,7 @@ Also returns nil if pid is nil." eshell-smart-space-goes-to-end t) (eshell-smart-initialize))))) +(autoload #'eshell/cd "em-dirs") (defun eshell-goto-current-dir (&optional arg) (interactive "P") (let ((dir default-directory)) -- cgit 1.4.1 From 47587e317708996e6966adf23859e39194869fba Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 30 Jun 2013 12:08:49 +0100 Subject: Emacs: ensure org-mode package with contrib/ is installed --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index 9d658ab1..43a1314b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -573,6 +573,7 @@ Values: `desktop', `server', `laptop'") ;;;; Planning (use-package org + :ensure org-plus-contrib :bind (("C-c C-a" . org-agenda-list) ("C-c a" . org-agenda) ("C-c l" . org-store-link) -- cgit 1.4.1 From 5905ec6debb6dcf9df9843b8f166305c849f0e61 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 17 Jul 2013 13:57:05 +0100 Subject: Make shell-execute work with a universal prefix argument --- emacs/elisp/ap-functions.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/emacs/elisp/ap-functions.el b/emacs/elisp/ap-functions.el index b6994643..104b4449 100644 --- a/emacs/elisp/ap-functions.el +++ b/emacs/elisp/ap-functions.el @@ -37,10 +37,10 @@ (byte-compile-dest-file filename)))))) ;;;###autoload -(defun shell-execute () - (interactive) +(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)))) + (shell-command (replace-regexp-in-string "%" file-buffer command) to-current-buffer))) -- cgit 1.4.1 From f26545a8cb75a4aeb0773ac309d8145aeb087d1d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 29 Jul 2013 14:08:04 +0100 Subject: zshrc: add X11 window role to wprop alias --- zsh/zshrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zsh/zshrc b/zsh/zshrc index 938dcbd9..c017029f 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -275,7 +275,8 @@ alias E="SUDO_EDITOR=\emacsclient -c -a emacs\" sudoedit" alias aticonfig="DISPLAY=:0 \aticonfig" alias wprop='xprop |awk '\'' /^WM_CLASS/{sub(/.* =/, "instance:"); sub(/,/, "\nclass:"); print} - /^WM_NAME/{sub(/.* =/, "title:"); print}'\''' + /^WM_NAME/{sub(/.* =/, "title:"); print} + /^WM_WINDOW_ROLE/{sub(/.* =/, "role:"); print}'\''' alias -g ...='../..' -- cgit 1.4.1 From 72aa9219773cb0717c4f27a28056c4fef5ce2e6a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 29 Jul 2013 14:08:53 +0100 Subject: Emacs: add eval-and-replace and bind to C-c e --- emacs/init.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 43a1314b..26defe92 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -972,6 +972,18 @@ Also returns nil if pid is nil." (add-hook 'emacs-lisp-mode-hook 'imenu-elisp-sections) +(defun eval-and-replace () + "Replace the preceding sexp with its value." + (interactive) + (backward-kill-sexp) + (condition-case nil + (prin1 (eval (read (current-kill 0))) + (current-buffer)) + (error (message "Invalid expression") + (insert (current-kill 0))))) + +(bind-key "C-c e" #'eval-and-replace) + ;;;; Programming (use-package auto-compile -- cgit 1.4.1 From b17e1928f120ba559929754a26e77b0c04d0aeb9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 29 Jul 2013 14:10:02 +0100 Subject: Emacs: improve configuration of common-lisp mode --- emacs/init.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 26defe92..1278c556 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -907,10 +907,16 @@ Also returns nil if pid is nil." (setq indent-tabs-mode nil) (local-set-key (kbd "RET") #'paredit-newline)) +(defun set-common-lisp-indentation () + (set (make-local-variable 'lisp-indent-function) + #'common-lisp-indent-function)) + (add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup) (add-hook 'emacs-lisp-mode-hook #'turn-on-eldoc-mode) (add-hook 'scheme-mode-hook #'ap/lisp-setup) +(add-hook 'lisp-mode-hook #'ap/lisp-setup) +(add-hook 'lisp-mode-hook #'set-common-lisp-indentation) (use-package bytecomp :defer t -- cgit 1.4.1 From 1ba96a0584267853ff15e255bfae7afb39bceb7c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 29 Jul 2013 15:42:44 +0100 Subject: zsh: check for gem directory and add bin folder to path if found --- zsh/zshrc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zsh/zshrc b/zsh/zshrc index c017029f..3bf6e3b9 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -10,6 +10,13 @@ then $defpath ~/bin ) + if [[ -d ~/.gem/ruby ]] + then + path=( + $path + ~/.gem/ruby/*/bin + ) + fi fi if [[ ! -d ~/.zsh/cache ]] -- cgit 1.4.1 From 496df6c119046e450f4e047bbb6cf0428c7168b9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 1 Aug 2013 13:23:44 +0100 Subject: Emacs: switch control and command keys --- emacs/init.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 5f323a6f..34fab378 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -461,6 +461,11 @@ Values: `desktop', `server', `laptop'") ;;;; Keybindings +(when (eq system-type 'darwin) + (setq mac-option-modifier 'meta + mac-control-modifier 'command + mac-command-modifier 'control)) + (unbind-key "") (bind-key "" #'compile) (bind-key "" #'kmacro-start-macro-or-insert-counter) -- cgit 1.4.1 From ae1b7c3d17f24726bfdf1f59a95c6bf0b32824f7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 1 Aug 2013 13:29:45 +0100 Subject: Emacs: make right modifier keys consistent with their left counterparts on OS X --- emacs/init.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 34fab378..2a383eda 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -464,7 +464,9 @@ Values: `desktop', `server', `laptop'") (when (eq system-type 'darwin) (setq mac-option-modifier 'meta mac-control-modifier 'command - mac-command-modifier 'control)) + mac-right-control-modifier 'command + mac-command-modifier 'control + mac-right-command-modifier 'control)) (unbind-key "") (bind-key "" #'compile) -- cgit 1.4.1 From 1e5ba0b55f289e00d9c78683b79aefc9fd55f4e2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 1 Aug 2013 13:30:40 +0100 Subject: Emacs: allow the option key to be used without inputting special characters --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index 2a383eda..71c2ffbc 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -462,6 +462,7 @@ Values: `desktop', `server', `laptop'") ;;;; Keybindings (when (eq system-type 'darwin) + (set-keyboard-coding-system nil) (setq mac-option-modifier 'meta mac-control-modifier 'command mac-right-control-modifier 'command -- cgit 1.4.1 From 07a7dedaed8646445c2d8b213186c89833c30e59 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 2 Aug 2013 10:35:02 +0100 Subject: Ignore .DS_Store system files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fa943767..76e98f5e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ *.elc *.zwc *.zwc.old +.DS_Store -- cgit 1.4.1 From 19c2511ca46d792cbd348dd68f9f6db1a4d75dfe Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 2 Aug 2013 10:52:10 +0100 Subject: Installer: check for host-specific zshrc before trying to compile --- install | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/install b/install index 0fa5859e..40c134f8 100755 --- a/install +++ b/install @@ -58,8 +58,10 @@ zfiles=( dotfiles/zsh/functions/fasd/fasd $fasd_cache dotfiles/zsh/zshrc - dotfiles/zsh/zshrc_${HOST%%.*} ) +if [[ -f dotfiles/zsh/zshrc_${HOST%%.*} ]]; then + zfiles+=dotfiles/zsh/zshrc_${HOST%%.*} +fi if [[ -e /usr/bin/emerge ]]; then zfiles+=dotfiles/zsh/zshrc_gentoo fi -- cgit 1.4.1 From 4716b456014f52e847a63f2fc4a72b85c4b00a60 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 14 Aug 2013 14:16:30 +0100 Subject: Emacs: setup puppet-mode --- emacs/init.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 1092e9bd..225e0198 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -578,6 +578,11 @@ Values: `desktop', `server', `laptop'") :ensure t :mode (("\\.lua\\'" . lua-mode))) +(use-package puppet-mode + :mode (("\\.pp\\'" . puppet-mode)) + :config (progn + (add-hook 'puppet-mode-hook #'autopair-mode))) + ;;;; Planning (use-package org -- cgit 1.4.1 From 1f18bfaaf03f2696d53535d433478a5671fcb97f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 14 Aug 2013 14:17:20 +0100 Subject: Emacs: make right modifier keys on Mac inherit the configuration of their left counterparts --- emacs/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 225e0198..0f05bc0c 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -470,9 +470,9 @@ Values: `desktop', `server', `laptop'") (set-keyboard-coding-system nil) (setq mac-option-modifier 'meta mac-control-modifier 'command - mac-right-control-modifier 'command + mac-right-control-modifier 'left mac-command-modifier 'control - mac-right-command-modifier 'control)) + mac-right-command-modifier 'left)) (unbind-key "") (bind-key "" #'compile) -- cgit 1.4.1 From 4eb69405683c90659e7f2a9c3a2fd947dd027ed0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 17 Aug 2013 15:21:01 +0100 Subject: Emacs: Provide ap-functions in ap-functions.el --- emacs/elisp/ap-functions.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/elisp/ap-functions.el b/emacs/elisp/ap-functions.el index 104b4449..4c300015 100644 --- a/emacs/elisp/ap-functions.el +++ b/emacs/elisp/ap-functions.el @@ -44,3 +44,5 @@ "")) (command (read-shell-command "Shell command: " nil nil nil))) (shell-command (replace-regexp-in-string "%" file-buffer command) to-current-buffer))) + +(provide 'ap-functions) -- cgit 1.4.1 From 7af9f474a725c084931594ca52c775ec060daf81 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 17 Aug 2013 15:22:37 +0100 Subject: Setup ediff configuration --- emacs/init.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 0f05bc0c..d142da47 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -427,6 +427,12 @@ Values: `desktop', `server', `laptop'") (add-to-list 'tramp-remote-path "/usr/local/sbin") (add-to-list 'tramp-remote-path "~/bin"))) +(use-package ediff + :defer t + :config (progn + (setq ediff-split-window-function 'split-window-horizontally + ediff-window-setup-function 'ediff-setup-windows-plain))) + ;;;; Indentation (setq-default tab-width 4 -- cgit 1.4.1 From 314c9708d77bf367b775bf71be374faa690bcb1f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 17 Aug 2013 15:23:10 +0100 Subject: Git: use the patience diff algorithm --- gitconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gitconfig b/gitconfig index 74d13ecb..0e4d5afe 100644 --- a/gitconfig +++ b/gitconfig @@ -18,4 +18,6 @@ standup = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --since yesterday --author alan ignored = ls-files --others -i --exclude-standard [github] - user = alan@alanpearce.co.uk \ No newline at end of file + user = alan@alanpearce.co.uk +[diff] + algorithm = patience -- cgit 1.4.1 From 94ab675f400ca76e1c45376393bcf974579caacb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 25 Aug 2013 19:32:23 +0100 Subject: Emacs: save ido state file in emacs directory --- emacs/init.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index d142da47..f15386fe 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -529,7 +529,9 @@ Values: `desktop', `server', `laptop'") (ido-mode 1) (setq ido-decorations (quote ("\n›" "" "\n " "\n …" "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]"))) (setq ido-auto-merge-delay-time 99999 - ido-enable-flex-matching t) + ido-enable-flex-matching t + ido-save-directory-list-file (expand-file-name user-emacs-directory + "ido-state")) (ido-init-completion-maps) (defun ido-manual-merge () (interactive) -- cgit 1.4.1 From 15dd3bf7481143411a0598770ce0eabc7dd02213 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 27 Aug 2013 13:07:22 +0100 Subject: Emacs: Fix control key issue on OSX --- emacs/init.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 0f05bc0c..41daa4a5 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -469,10 +469,12 @@ Values: `desktop', `server', `laptop'") (when (eq system-type 'darwin) (set-keyboard-coding-system nil) (setq mac-option-modifier 'meta - mac-control-modifier 'command + mac-right-option-modifier 'left + mac-control-modifier 'super mac-right-control-modifier 'left mac-command-modifier 'control - mac-right-command-modifier 'left)) + mac-right-command-modifier 'left + mac-function-modifier 'hyper)) (unbind-key "") (bind-key "" #'compile) -- cgit 1.4.1 From 5ac5ba3ba8e7b78736ff0e12a065713658579063 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 27 Aug 2013 13:08:22 +0100 Subject: Emacs: unbind unhelpful s-n key --- emacs/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 41daa4a5..499636f9 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -492,6 +492,8 @@ Values: `desktop', `server', `laptop'") (bind-key "C-c i" #'ucs-insert) +(unbind-key "s-n") + (set-register ?e `(file . ,*init-file*)) ;; Enable narrowing functions C-x n -- cgit 1.4.1 From 114df7733b3534738c23e170b563cb7abd29da43 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 27 Aug 2013 13:09:35 +0100 Subject: Emacs: add extra keybinding for projectile-find-file --- emacs/init.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 499636f9..e7e080ce 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -494,6 +494,8 @@ Values: `desktop', `server', `laptop'") (unbind-key "s-n") +(bind-key "s-x" (define-prefix-command 'super-x-map)) + (set-register ?e `(file . ,*init-file*)) ;; Enable narrowing functions C-x n @@ -664,7 +666,8 @@ Values: `desktop', `server', `laptop'") (use-package projectile :ensure t - :bind (("C-c C-f" . projectile-find-file)) + :bind (("C-c C-f" . projectile-find-file) + ("s-x s-f" . projectile-find-file)) :commands (projectile-global-mode)) (use-package project-persist -- cgit 1.4.1 From b064712dfa6f4a3e727ad18568fc9f852c3e2c0d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 28 Aug 2013 09:00:11 +0100 Subject: Emacs: Switch control and command on OSX --- emacs/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index e7e080ce..916cc420 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -470,9 +470,9 @@ Values: `desktop', `server', `laptop'") (set-keyboard-coding-system nil) (setq mac-option-modifier 'meta mac-right-option-modifier 'left - mac-control-modifier 'super + mac-control-modifier 'control mac-right-control-modifier 'left - mac-command-modifier 'control + mac-command-modifier 'super mac-right-command-modifier 'left mac-function-modifier 'hyper)) -- cgit 1.4.1 From 6741fa31da1ac4d2e14114fdf2a3d6d841ac6962 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 28 Aug 2013 16:33:18 +0100 Subject: Emacs: Unbind more unhelpful Mac keybindings --- emacs/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 1b7b4950..b445c1e4 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -498,7 +498,10 @@ Values: `desktop', `server', `laptop'") (bind-key "C-c i" #'ucs-insert) +(unbind-key "s-h") (unbind-key "s-n") +(unbind-key "s-p") +(unbind-key "s-w") (bind-key "s-x" (define-prefix-command 'super-x-map)) -- cgit 1.4.1 From 2e6468f9225fbb9ef889271cdb48248f3d345d52 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 28 Aug 2013 16:33:57 +0100 Subject: Emacs: add s-G magit keybinding like s-D --- emacs/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index b445c1e4..ab1d3c2b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -750,7 +750,8 @@ Also returns nil if pid is nil." (use-package magit :commands (magit-status) - :bind (("C-x g" . magit-status)) + :bind (("C-x g" . magit-status) + ("s-G" . magit-status)) :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) ;;;; Spelling -- cgit 1.4.1 From a4fd9c1ab8fd8a7e1dc2695876ede8c83f5eaff4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 28 Aug 2013 17:07:31 +0100 Subject: Emacs: unbind s-m --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index ab1d3c2b..4eab004e 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -502,6 +502,7 @@ Values: `desktop', `server', `laptop'") (unbind-key "s-n") (unbind-key "s-p") (unbind-key "s-w") +(unbind-key "s-m") (bind-key "s-x" (define-prefix-command 'super-x-map)) -- cgit 1.4.1 From 4995c1c2200c7ca5c20a1de0aad3f8a465fb911d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 1 Sep 2013 13:01:49 +0100 Subject: Xbindkeys: run dmenu with cache settings --- xbindkeysrc.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xbindkeysrc.scm b/xbindkeysrc.scm index e44500f1..7b00c38d 100644 --- a/xbindkeysrc.scm +++ b/xbindkeysrc.scm @@ -52,6 +52,6 @@ (xbindkey '(mod4 F11) "mpc next") (xbindkey '(mod4 F12) "mpc stop") -(xbindkey '(mod4 p) "dmenu_run -fn '-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*' -nb '#002b36' -nf '#fdf6e3' -sb '#586e75' -sf '#fdf6e3'") +(xbindkey '(mod4 p) "dmenu_run -fn '-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*' -nb '#002b36' -nf '#fdf6e3' -sb '#586e75' -sf '#fdf6e3' -hist '/home/alan/.cache/dmenu_run_history'") (xbindkey '(mod4 shift T) "urxvtc") (xbindkey '(mod4 shift E) "emacsclient -c") -- cgit 1.4.1 From 8214342af8a51b9ed63d9bea27cbf7b8051f0b4b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 2 Sep 2013 09:29:29 +0100 Subject: Emacs: setup web-mode --- emacs/init.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index c26d1428..2d80bc81 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1170,6 +1170,14 @@ Works with: arglist-cont-nonempty, arglist-close." :defer t :config (setq sgml-basic-offset 4)) +(use-package web-mode + :defer t + :mode (("/views/.*\\.php\\'" . web-mode) + ("/templates/.*\\.php\\'" . web-mode)) + :config (setq web-mode-code-indent-offset 4 + web-mode-css-indent-offset 4 + web-mode-markup-indent-offset 4)) + ;;;; Windows & Frames (setq frame-title-format -- cgit 1.4.1 From c0b1db9dd382dfa75980888433936645ac17bf97 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 2 Sep 2013 09:32:58 +0100 Subject: Emacs: initialise smex on startup for faster usage --- emacs/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 2d80bc81..337d6630 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -559,13 +559,13 @@ Values: `desktop', `server', `laptop'") (setq smex-history-length 100 smex-save-file (concat user-emacs-directory "smex-items")) - (smex-initialize) (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))) + (add-hook 'after-load-functions 'smex-update-after-load)) + :init (smex-initialize)) ;;;; Modeline -- cgit 1.4.1 From 13ddd4cb0f91cb6c78f94eb5fa8bbee1b5b83920 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 2 Sep 2013 13:32:47 +0100 Subject: Add global gitignore file --- gitconfig | 2 ++ global.gitignore | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 global.gitignore diff --git a/gitconfig b/gitconfig index 0e4d5afe..9d616709 100644 --- a/gitconfig +++ b/gitconfig @@ -21,3 +21,5 @@ user = alan@alanpearce.co.uk [diff] algorithm = patience +[core] + excludesfile = /Users/alan/dotfiles/global.gitignore diff --git a/global.gitignore b/global.gitignore new file mode 100644 index 00000000..02b15bfa --- /dev/null +++ b/global.gitignore @@ -0,0 +1,23 @@ +.DS_Store +.AppleDouble +.LSOverride +Icon +Desktop.ini + +# Thumbnails +._* +Thumbs.db + +# Emacs +*~ +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +.elc +auto-save-list +tramp +.\#* + +# Org-mode +.org-id-locations +*_archive \ No newline at end of file -- cgit 1.4.1 From f2badf30beb5fd8a758574cddd3a2f7cc7159080 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 27 Aug 2013 13:07:22 +0100 Subject: Emacs: Fix control key issue on OSX --- emacs/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 337d6630..0a220735 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -476,9 +476,9 @@ Values: `desktop', `server', `laptop'") (set-keyboard-coding-system nil) (setq mac-option-modifier 'meta mac-right-option-modifier 'left - mac-control-modifier 'control + mac-control-modifier 'super mac-right-control-modifier 'left - mac-command-modifier 'super + mac-command-modifier 'control mac-right-command-modifier 'left mac-function-modifier 'hyper)) -- cgit 1.4.1 From 9719bca673b354a1dbd495afb55c5dec74482a51 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 27 Aug 2013 13:08:22 +0100 Subject: Emacs: unbind unhelpful s-n key --- emacs/init.el | 6 ------ 1 file changed, 6 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 0a220735..e07ef0bc 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -498,13 +498,7 @@ Values: `desktop', `server', `laptop'") (bind-key "C-c i" #'ucs-insert) -(unbind-key "s-h") (unbind-key "s-n") -(unbind-key "s-p") -(unbind-key "s-w") -(unbind-key "s-m") - -(bind-key "s-x" (define-prefix-command 'super-x-map)) (set-register ?e `(file . ,*init-file*)) -- cgit 1.4.1 From 6e26c674b93629c3d1cfeb79d6c6f2268510a420 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 27 Aug 2013 13:09:35 +0100 Subject: Emacs: add extra keybinding for projectile-find-file --- emacs/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index e07ef0bc..dd73f19c 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -500,6 +500,8 @@ Values: `desktop', `server', `laptop'") (unbind-key "s-n") +(bind-key "s-x" (define-prefix-command 'super-x-map)) + (set-register ?e `(file . ,*init-file*)) ;; Enable narrowing functions C-x n -- cgit 1.4.1 From 17147f0bb602a34f7b1cb669718813339fa21400 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 28 Aug 2013 09:00:11 +0100 Subject: Emacs: Switch control and command on OSX --- emacs/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index dd73f19c..b70f90ba 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -476,9 +476,9 @@ Values: `desktop', `server', `laptop'") (set-keyboard-coding-system nil) (setq mac-option-modifier 'meta mac-right-option-modifier 'left - mac-control-modifier 'super + mac-control-modifier 'control mac-right-control-modifier 'left - mac-command-modifier 'control + mac-command-modifier 'super mac-right-command-modifier 'left mac-function-modifier 'hyper)) -- cgit 1.4.1 From 07522b7ea7a158949cb24ecce2ebcf3084fe5b67 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 28 Aug 2013 16:33:18 +0100 Subject: Emacs: Unbind more unhelpful Mac keybindings --- emacs/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index b70f90ba..b9597020 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -498,7 +498,10 @@ Values: `desktop', `server', `laptop'") (bind-key "C-c i" #'ucs-insert) +(unbind-key "s-h") (unbind-key "s-n") +(unbind-key "s-p") +(unbind-key "s-w") (bind-key "s-x" (define-prefix-command 'super-x-map)) -- cgit 1.4.1 -- cgit 1.4.1 From c12b575f04d653d12edfc9188a70f709607a30c3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 9 Sep 2013 13:46:37 +0100 Subject: Emacs: set company completion to only happen after inserting text --- emacs/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index b9597020..620c5b30 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -311,7 +311,8 @@ Values: `desktop', `server', `laptop'") :bind (("C-" . company-complete)) :init (progn (add-hook 'prog-mode-hook #'company-mode) - (setq company-idle-delay .3))) + (setq company-idle-delay .3 + company-begin-commands '(self-insert-command)))) ;;;; Dates & Times -- cgit 1.4.1 From ff9984e5698068e56a38cd3193231adc8d296e37 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 9 Sep 2013 13:49:21 +0100 Subject: Emacs: rebind M-/ to hippie-expand --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index 620c5b30..191545c5 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -498,6 +498,7 @@ Values: `desktop', `server', `laptop'") (unbind-key "C-x C-c") (bind-key "C-c i" #'ucs-insert) +(bind-key "M-/" #'hippie-expand) (unbind-key "s-h") (unbind-key "s-n") -- cgit 1.4.1 From 8be7aa09302953dd74aff58b6a9ca141efa8b693 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 9 Sep 2013 14:13:28 +0100 Subject: Emacs: Remove configuration for nxhtml mode --- emacs/init.el | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 191545c5..c26f3e24 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1140,20 +1140,6 @@ Works with: arglist-cont-nonempty, arglist-close." :ensure t :mode (("\\.j2\\'" . jinja2-mode))) -(use-package nxhtml-mode - :defer t - :if (eq env/system-type 'laptop) - :load-path "nxhtml" - :config (progn - (when (and (equal emacs-major-version 24) - (> emacs-minor-version 1)) - (setq mumamo-per-buffer-local-vars - (delq 'buffer-file-name mumamo-per-buffer-local-vars))) - (setq mumamo-chunk-coloring 4 - nxhtml-skip-welcome t - nxhtml-autoload-web nil) - (nxhtml-menu-mode -1))) - (use-package php-mode :mode ("\\.php\\'" . php-mode) :config (progn -- cgit 1.4.1 From 270a82dbed30eb256736b11c0af54aa7d175f56a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 13 Sep 2013 13:05:06 +0100 Subject: Make installer create .zsh and .zsh/cache, if necessary --- install | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/install b/install index 40c134f8..16d30c58 100755 --- a/install +++ b/install @@ -47,6 +47,11 @@ then emacs --batch --eval '(batch-byte-recompile-directory 0)' ~/.emacs.d/ fi +if [[ ! -d ~/.zsh/cache ]] +then + mkdir -p ~/.zsh/cache +fi + fasd_cache=~/.zsh/cache/fasd-init-zsh if [[ ! -s "$fasd_cache" || dotfiles/zsh/functions/fasd -nt "$fasd_cache" ]]; then dotfiles/zsh/functions/fasd/fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache" -- cgit 1.4.1 From 6cc5e9856fd0875f767f17a6494eb4a174538ebd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 15 Sep 2013 16:47:18 +0100 Subject: zsh: Install and use the pure prompt --- zsh/functions/pure/prompt_pure_setup | 78 ++++++++++++++++++++++++++++++++++++ zsh/zshrc | 9 ++--- 2 files changed, 81 insertions(+), 6 deletions(-) create mode 100644 zsh/functions/pure/prompt_pure_setup diff --git a/zsh/functions/pure/prompt_pure_setup b/zsh/functions/pure/prompt_pure_setup new file mode 100644 index 00000000..9c2a7520 --- /dev/null +++ b/zsh/functions/pure/prompt_pure_setup @@ -0,0 +1,78 @@ +# Pure +# by Sindre Sorhus +# https://github.com/sindresorhus/pure +# MIT License + +# For my own and others sanity +# git: +# %b => current branch +# %a => current action (rebase/merge) +# prompt: +# %F => color dict +# %f => reset color +# %~ => current path +# %* => time +# %n => username +# %m => shortname host +# %(?..) => prompt conditional - %(condition.true.false) + +# fastest possible way to check if repo is dirty +prompt_pure_git_dirty() { + # check if we're in a git repo + command git rev-parse --is-inside-work-tree &>/dev/null || return + # check if it's dirty + command git diff --quiet --ignore-submodules HEAD &>/dev/null + + (($? == 1)) && echo '*' +} + +# displays the exec time of the last command if set threshold was exceeded +prompt_pure_cmd_exec_time() { + local stop=`date +%s` + local start=${cmd_timestamp:-$stop} + integer elapsed=$stop-$start + (($elapsed > ${PURE_CMD_MAX_EXEC_TIME:=5})) && echo ${elapsed}s +} + +prompt_pure_preexec() { + cmd_timestamp=`date +%s` + + # shows the current dir and executed command in the title when a process is active + print -Pn "\e]0;$PWD:t: $2\a" +} + +prompt_pure_precmd() { + # shows the full path in the title + print -Pn '\e]0;%~\a' + + # git info + vcs_info + + print -P '\n%F{blue}%~%F{8}$vcs_info_msg_0_`prompt_pure_git_dirty` $prompt_pure_username%f %F{yellow}`prompt_pure_cmd_exec_time`%f' + + # reset value since `preexec` isn't always triggered + unset cmd_timestamp +} + + +prompt_pure_setup() { + prompt_opts=(cr subst percent) + + autoload -Uz add-zsh-hook + autoload -Uz vcs_info + + add-zsh-hook precmd prompt_pure_precmd + add-zsh-hook preexec prompt_pure_preexec + + zstyle ':vcs_info:*' enable git + zstyle ':vcs_info:git*' formats ' %b' + zstyle ':vcs_info:git*' actionformats ' %b|%a' + + # show username@host if logged in through SSH + [[ "$SSH_CONNECTION" != '' ]] && prompt_pure_username='%n@%m ' + + # prompt turns red if the previous command didn't exit with 0 + PROMPT='%(?.%F{magenta}.%F{red})❯%f ' +} + +prompt_pure_setup "$@" diff --git a/zsh/zshrc b/zsh/zshrc index 3bf6e3b9..18cc118e 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -168,13 +168,10 @@ zstyle ':vcs_info:*' enable git hg zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' '*?.old' '*?.pro' ## Prompt -if [[ $term = "putty" ]];then - prompt_char="›" -else - prompt_char=">" -fi +autoload -U promptinit +promptinit -PS1="%B%~%(!.%{$fg[red]%}.%{$fg[green]%})$prompt_char%f%b " +prompt pure # Options -- cgit 1.4.1 From 090d543a3b7429e4a3bb071018b827dce4775dee Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 15 Sep 2013 17:11:27 +0100 Subject: zsh: Add solarized dircolors (ansi-universal) --- zsh/zshrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zsh/zshrc b/zsh/zshrc index 18cc118e..0442f015 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -92,6 +92,8 @@ then ls_isodate="-D '%F %k:%M'" fi +LS_COLORS='no=00:fi=00:di=36:ln=35:pi=30;44:so=35;44:do=35;44:bd=33;44:cd=37;44:or=05;37;41:mi=05;37;41:ex=01;31:*.cmd=01;31:*.exe=01;31:*.com=01;31:*.bat=01;31:*.reg=01;31:*.app=01;31:*.txt=32:*.org=32:*.md=32:*.mkd=32:*.h=32:*.c=32:*.C=32:*.cc=32:*.cpp=32:*.cxx=32:*.objc=32:*.sh=32:*.csh=32:*.zsh=32:*.el=32:*.vim=32:*.java=32:*.pl=32:*.pm=32:*.py=32:*.rb=32:*.hs=32:*.php=32:*.htm=32:*.html=32:*.shtml=32:*.erb=32:*.haml=32:*.xml=32:*.rdf=32:*.css=32:*.sass=32:*.scss=32:*.less=32:*.js=32:*.coffee=32:*.man=32:*.0=32:*.1=32:*.2=32:*.3=32:*.4=32:*.5=32:*.6=32:*.7=32:*.8=32:*.9=32:*.l=32:*.n=32:*.p=32:*.pod=32:*.tex=32:*.bmp=33:*.cgm=33:*.dl=33:*.dvi=33:*.emf=33:*.eps=33:*.gif=33:*.jpeg=33:*.jpg=33:*.JPG=33:*.mng=33:*.pbm=33:*.pcx=33:*.pdf=33:*.pgm=33:*.png=33:*.ppm=33:*.pps=33:*.ppsx=33:*.ps=33:*.svg=33:*.svgz=33:*.tga=33:*.tif=33:*.tiff=33:*.xbm=33:*.xcf=33:*.xpm=33:*.xwd=33:*.xwd=33:*.yuv=33:*.aac=33:*.au=33:*.flac=33:*.mid=33:*.midi=33:*.mka=33:*.mp3=33:*.mpa=33:*.mpeg=33:*.mpg=33:*.ogg=33:*.ra=33:*.wav=33:*.anx=33:*.asf=33:*.avi=33:*.axv=33:*.flc=33:*.fli=33:*.flv=33:*.gl=33:*.m2v=33:*.m4v=33:*.mkv=33:*.mov=33:*.mp4=33:*.mp4v=33:*.mpeg=33:*.mpg=33:*.nuv=33:*.ogm=33:*.ogv=33:*.ogx=33:*.qt=33:*.rm=33:*.rmvb=33:*.swf=33:*.vob=33:*.wmv=33:*.doc=31:*.docx=31:*.rtf=31:*.dot=31:*.dotx=31:*.xls=31:*.xlsx=31:*.ppt=31:*.pptx=31:*.fla=31:*.psd=31:*.7z=1;35:*.apk=1;35:*.arj=1;35:*.bin=1;35:*.bz=1;35:*.bz2=1;35:*.cab=1;35:*.deb=1;35:*.dmg=1;35:*.gem=1;35:*.gz=1;35:*.iso=1;35:*.jar=1;35:*.msi=1;35:*.rar=1;35:*.rpm=1;35:*.tar=1;35:*.tbz=1;35:*.tbz2=1;35:*.tgz=1;35:*.tx=1;35:*.war=1;35:*.xpi=1;35:*.xz=1;35:*.z=1;35:*.Z=1;35:*.zip=1;35:*.ANSI-30-black=30:*.ANSI-01;30-brblack=01;30:*.ANSI-31-red=31:*.ANSI-01;31-brred=01;31:*.ANSI-32-green=32:*.ANSI-01;32-brgreen=01;32:*.ANSI-33-yellow=33:*.ANSI-01;33-bryellow=01;33:*.ANSI-34-blue=34:*.ANSI-01;34-brblue=01;34:*.ANSI-35-magenta=35:*.ANSI-01;35-brmagenta=01;35:*.ANSI-36-cyan=36:*.ANSI-01;36-brcyan=01;36:*.ANSI-37-white=37:*.ANSI-01;37-brwhite=01;37:*.log=01;34:*~=01;34:*#=01;34:*.bak=01;36:*.BAK=01;36:*.old=01;36:*.OLD=01;36:*.org_archive=01;36:*.off=01;36:*.OFF=01;36:*.dist=01;36:*.DIST=01;36:*.orig=01;36:*.ORIG=01;36:*.swp=01;36:*.swo=01;36:*,v=01;36:*.gpg=34:*.gpg=34:*.pgp=34:*.asc=34:*.3des=34:*.aes=34:*.enc=34:' + #Ignore suffixes in completion fignore=( svbin -- cgit 1.4.1 From f5035c449c73b3712078a43f044298f2498af405 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 15 Sep 2013 17:12:09 +0100 Subject: Urxvt: use bright colours without bold fonts --- xresources/main | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xresources/main b/xresources/main index 94f005a2..0af5db9b 100644 --- a/xresources/main +++ b/xresources/main @@ -16,7 +16,8 @@ URxvt.saveLines: 16384 URxvt.secondaryScroll: false URxvt.font: -xos4-terminus-medium-r-normal--14-140-72-72-c-80-*-* -URxvt.boldFont: -xos4-terminus-bold-r-normal--14-140-72-72-c-80-*-* +URxvt.boldFont: +URxvt.intensityStyles: true URxvt.pointerBlank: true URxvt.pointerBlankDelay: 987654321 -- cgit 1.4.1 From b0c124161c2df4e5762b918dfcbf142d61ea9a77 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 15 Sep 2013 17:12:51 +0100 Subject: zsh: Optimise pure prompt git checking --- zsh/functions/pure/prompt_pure_setup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zsh/functions/pure/prompt_pure_setup b/zsh/functions/pure/prompt_pure_setup index 9c2a7520..2cf91013 100644 --- a/zsh/functions/pure/prompt_pure_setup +++ b/zsh/functions/pure/prompt_pure_setup @@ -18,8 +18,8 @@ # fastest possible way to check if repo is dirty prompt_pure_git_dirty() { - # check if we're in a git repo - command git rev-parse --is-inside-work-tree &>/dev/null || return + # check if we're at the top level of a git repo + [[ -d .git ]] || return # check if it's dirty command git diff --quiet --ignore-submodules HEAD &>/dev/null -- cgit 1.4.1 From 3b12b4c63a9e988de466828fc78bf865988465ad Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 15 Sep 2013 17:17:34 +0100 Subject: zsh: Make git branch name visible in pure prompt --- zsh/functions/pure/prompt_pure_setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/functions/pure/prompt_pure_setup b/zsh/functions/pure/prompt_pure_setup index 2cf91013..138a4b5a 100644 --- a/zsh/functions/pure/prompt_pure_setup +++ b/zsh/functions/pure/prompt_pure_setup @@ -48,7 +48,7 @@ prompt_pure_precmd() { # git info vcs_info - print -P '\n%F{blue}%~%F{8}$vcs_info_msg_0_`prompt_pure_git_dirty` $prompt_pure_username%f %F{yellow}`prompt_pure_cmd_exec_time`%f' + print -P '\n%F{blue}%~%F{11}$vcs_info_msg_0_`prompt_pure_git_dirty` $prompt_pure_username%f %F{yellow}`prompt_pure_cmd_exec_time`%f' # reset value since `preexec` isn't always triggered unset cmd_timestamp -- cgit 1.4.1 From e42f1774217ea88916344261c56b737ed2a1fade Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 15 Sep 2013 17:17:59 +0100 Subject: zsh: Add more contrast between success and failure prompt colours --- zsh/functions/pure/prompt_pure_setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/functions/pure/prompt_pure_setup b/zsh/functions/pure/prompt_pure_setup index 138a4b5a..3dd6820e 100644 --- a/zsh/functions/pure/prompt_pure_setup +++ b/zsh/functions/pure/prompt_pure_setup @@ -72,7 +72,7 @@ prompt_pure_setup() { [[ "$SSH_CONNECTION" != '' ]] && prompt_pure_username='%n@%m ' # prompt turns red if the previous command didn't exit with 0 - PROMPT='%(?.%F{magenta}.%F{red})❯%f ' + PROMPT='%(?.%F{14}.%F{magenta})❯%f ' } prompt_pure_setup "$@" -- cgit 1.4.1 From 3e8b0b63104acfd5a845ac56dc56d6284b7e16a9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 15 Sep 2013 17:34:41 +0100 Subject: zsh: Remove extra newline from pure prompt --- zsh/functions/pure/prompt_pure_setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/functions/pure/prompt_pure_setup b/zsh/functions/pure/prompt_pure_setup index 3dd6820e..1bbe2673 100644 --- a/zsh/functions/pure/prompt_pure_setup +++ b/zsh/functions/pure/prompt_pure_setup @@ -48,7 +48,7 @@ prompt_pure_precmd() { # git info vcs_info - print -P '\n%F{blue}%~%F{11}$vcs_info_msg_0_`prompt_pure_git_dirty` $prompt_pure_username%f %F{yellow}`prompt_pure_cmd_exec_time`%f' + print -P '%F{blue}%~%F{11}$vcs_info_msg_0_`prompt_pure_git_dirty` $prompt_pure_username%f %F{yellow}`prompt_pure_cmd_exec_time`%f' # reset value since `preexec` isn't always triggered unset cmd_timestamp -- cgit 1.4.1 From e0d700c3ecff62f434ffebff34b3a08cd4ce75ff Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 15 Sep 2013 17:46:22 +0100 Subject: zsh: Remove unused namecoin alias --- zsh/zshrc | 1 - 1 file changed, 1 deletion(-) diff --git a/zsh/zshrc b/zsh/zshrc index 0442f015..ffb01ada 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -274,7 +274,6 @@ alias lsr="ls -tld *(m-2)" # mtime < -2days alias trans="transmission-remote transmission.home" alias bitcoin="bitcoind" -alias namecoin="~alan/applications/namecoin/src/namecoind" alias su="smart_sudo " alias e="$EDITOR" alias E="SUDO_EDITOR=\emacsclient -c -a emacs\" sudoedit" -- cgit 1.4.1 From 75cb3c23b9bc89f9743be6454164c7fe28102bbb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 15 Sep 2013 17:49:26 +0100 Subject: zsh: Refactor OS check and include OSX --- zsh/zshrc | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/zsh/zshrc b/zsh/zshrc index ffb01ada..64222622 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -80,17 +80,20 @@ then fi fi -if [[ "$OSTYPE" == *gnu* ]] -then - eval `dircolors -b` #exports LSCOLORS - ls_options="-v --group-directories-first --color=auto" - ls_isodate="--time-style=long-iso" -elif [[ "$OSTYPE" == freebsd* ]] -then - freebsd=1 - ls_options="-p" - ls_isodate="-D '%F %k:%M'" -fi +case $OSTYPE in + *gnu*) + eval `dircolors -b` #exports LSCOLORS + ls_options="-v --group-directories-first --color=auto" + ls_isodate="--time-style=long-iso" + ;; + freebsd*) + freebsd=1 + ls_options="-p" + ls_isodate="-D '%F %k:%M'" + ;; + darwin*) + osx=1 +esac LS_COLORS='no=00:fi=00:di=36:ln=35:pi=30;44:so=35;44:do=35;44:bd=33;44:cd=37;44:or=05;37;41:mi=05;37;41:ex=01;31:*.cmd=01;31:*.exe=01;31:*.com=01;31:*.bat=01;31:*.reg=01;31:*.app=01;31:*.txt=32:*.org=32:*.md=32:*.mkd=32:*.h=32:*.c=32:*.C=32:*.cc=32:*.cpp=32:*.cxx=32:*.objc=32:*.sh=32:*.csh=32:*.zsh=32:*.el=32:*.vim=32:*.java=32:*.pl=32:*.pm=32:*.py=32:*.rb=32:*.hs=32:*.php=32:*.htm=32:*.html=32:*.shtml=32:*.erb=32:*.haml=32:*.xml=32:*.rdf=32:*.css=32:*.sass=32:*.scss=32:*.less=32:*.js=32:*.coffee=32:*.man=32:*.0=32:*.1=32:*.2=32:*.3=32:*.4=32:*.5=32:*.6=32:*.7=32:*.8=32:*.9=32:*.l=32:*.n=32:*.p=32:*.pod=32:*.tex=32:*.bmp=33:*.cgm=33:*.dl=33:*.dvi=33:*.emf=33:*.eps=33:*.gif=33:*.jpeg=33:*.jpg=33:*.JPG=33:*.mng=33:*.pbm=33:*.pcx=33:*.pdf=33:*.pgm=33:*.png=33:*.ppm=33:*.pps=33:*.ppsx=33:*.ps=33:*.svg=33:*.svgz=33:*.tga=33:*.tif=33:*.tiff=33:*.xbm=33:*.xcf=33:*.xpm=33:*.xwd=33:*.xwd=33:*.yuv=33:*.aac=33:*.au=33:*.flac=33:*.mid=33:*.midi=33:*.mka=33:*.mp3=33:*.mpa=33:*.mpeg=33:*.mpg=33:*.ogg=33:*.ra=33:*.wav=33:*.anx=33:*.asf=33:*.avi=33:*.axv=33:*.flc=33:*.fli=33:*.flv=33:*.gl=33:*.m2v=33:*.m4v=33:*.mkv=33:*.mov=33:*.mp4=33:*.mp4v=33:*.mpeg=33:*.mpg=33:*.nuv=33:*.ogm=33:*.ogv=33:*.ogx=33:*.qt=33:*.rm=33:*.rmvb=33:*.swf=33:*.vob=33:*.wmv=33:*.doc=31:*.docx=31:*.rtf=31:*.dot=31:*.dotx=31:*.xls=31:*.xlsx=31:*.ppt=31:*.pptx=31:*.fla=31:*.psd=31:*.7z=1;35:*.apk=1;35:*.arj=1;35:*.bin=1;35:*.bz=1;35:*.bz2=1;35:*.cab=1;35:*.deb=1;35:*.dmg=1;35:*.gem=1;35:*.gz=1;35:*.iso=1;35:*.jar=1;35:*.msi=1;35:*.rar=1;35:*.rpm=1;35:*.tar=1;35:*.tbz=1;35:*.tbz2=1;35:*.tgz=1;35:*.tx=1;35:*.war=1;35:*.xpi=1;35:*.xz=1;35:*.z=1;35:*.Z=1;35:*.zip=1;35:*.ANSI-30-black=30:*.ANSI-01;30-brblack=01;30:*.ANSI-31-red=31:*.ANSI-01;31-brred=01;31:*.ANSI-32-green=32:*.ANSI-01;32-brgreen=01;32:*.ANSI-33-yellow=33:*.ANSI-01;33-bryellow=01;33:*.ANSI-34-blue=34:*.ANSI-01;34-brblue=01;34:*.ANSI-35-magenta=35:*.ANSI-01;35-brmagenta=01;35:*.ANSI-36-cyan=36:*.ANSI-01;36-brcyan=01;36:*.ANSI-37-white=37:*.ANSI-01;37-brwhite=01;37:*.log=01;34:*~=01;34:*#=01;34:*.bak=01;36:*.BAK=01;36:*.old=01;36:*.OLD=01;36:*.org_archive=01;36:*.off=01;36:*.OFF=01;36:*.dist=01;36:*.DIST=01;36:*.orig=01;36:*.ORIG=01;36:*.swp=01;36:*.swo=01;36:*,v=01;36:*.gpg=34:*.gpg=34:*.pgp=34:*.asc=34:*.3des=34:*.aes=34:*.enc=34:' -- cgit 1.4.1 From 52cb39f3cc213cb652e7a22a33614244dbfc25b0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 15 Sep 2013 17:51:13 +0100 Subject: zsh: Use gls instead of ls if available --- zsh/zshrc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/zsh/zshrc b/zsh/zshrc index 64222622..cefe87f5 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -264,16 +264,22 @@ alias md='mkdir -p' alias rd='rmdir' alias .='source' -alias l="\ls ${ls_options} -Bp" -alias l1="\ls ${ls_options} -1" -alias ls="\ls ${ls_options} -hF" -alias la="\ls ${ls_options} -hA" -alias ll="\ls ${ls_options} ${ls_isodate} -hl" +if [[ -n $osx && -n $commands[gls] ]] +then + ls='\gls' +else + ls='\ls' +fi +alias l="${ls} ${ls_options} -Bp" +alias l1="${ls} ${ls_options} -1" +alias ls="${ls} ${ls_options} -hF" +alias la="${ls} ${ls_options} -hA" +alias ll="${ls} ${ls_options} ${ls_isodate} -hl" alias lal="ll -A" alias lla="lal" alias llr="ll -t" alias gpp='g++' -alias lsr="ls -tld *(m-2)" # mtime < -2days +alias lsr="${ls} -tld *(m-2)" # mtime < -2days alias trans="transmission-remote transmission.home" alias bitcoin="bitcoind" -- cgit 1.4.1 From 458b42a257357c968f491328abb3fcbc7c7d4b10 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 15 Sep 2013 17:55:54 +0100 Subject: zsh: Remove gnu-only dircolors assignment --- zsh/zshrc | 1 - 1 file changed, 1 deletion(-) diff --git a/zsh/zshrc b/zsh/zshrc index cefe87f5..db94294c 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -82,7 +82,6 @@ fi case $OSTYPE in *gnu*) - eval `dircolors -b` #exports LSCOLORS ls_options="-v --group-directories-first --color=auto" ls_isodate="--time-style=long-iso" ;; -- cgit 1.4.1 From 273902cebbd5a2ded8905ab117341fca05627657 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 15 Sep 2013 17:58:47 +0100 Subject: zsh: Refactor OS checking to use just one variable --- zsh/zshrc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/zsh/zshrc b/zsh/zshrc index db94294c..d6ae52ea 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -82,16 +82,17 @@ fi case $OSTYPE in *gnu*) + os=gnu ls_options="-v --group-directories-first --color=auto" ls_isodate="--time-style=long-iso" ;; freebsd*) - freebsd=1 + os=freebsd ls_options="-p" ls_isodate="-D '%F %k:%M'" ;; darwin*) - osx=1 + os=osx esac LS_COLORS='no=00:fi=00:di=36:ln=35:pi=30;44:so=35;44:do=35;44:bd=33;44:cd=37;44:or=05;37;41:mi=05;37;41:ex=01;31:*.cmd=01;31:*.exe=01;31:*.com=01;31:*.bat=01;31:*.reg=01;31:*.app=01;31:*.txt=32:*.org=32:*.md=32:*.mkd=32:*.h=32:*.c=32:*.C=32:*.cc=32:*.cpp=32:*.cxx=32:*.objc=32:*.sh=32:*.csh=32:*.zsh=32:*.el=32:*.vim=32:*.java=32:*.pl=32:*.pm=32:*.py=32:*.rb=32:*.hs=32:*.php=32:*.htm=32:*.html=32:*.shtml=32:*.erb=32:*.haml=32:*.xml=32:*.rdf=32:*.css=32:*.sass=32:*.scss=32:*.less=32:*.js=32:*.coffee=32:*.man=32:*.0=32:*.1=32:*.2=32:*.3=32:*.4=32:*.5=32:*.6=32:*.7=32:*.8=32:*.9=32:*.l=32:*.n=32:*.p=32:*.pod=32:*.tex=32:*.bmp=33:*.cgm=33:*.dl=33:*.dvi=33:*.emf=33:*.eps=33:*.gif=33:*.jpeg=33:*.jpg=33:*.JPG=33:*.mng=33:*.pbm=33:*.pcx=33:*.pdf=33:*.pgm=33:*.png=33:*.ppm=33:*.pps=33:*.ppsx=33:*.ps=33:*.svg=33:*.svgz=33:*.tga=33:*.tif=33:*.tiff=33:*.xbm=33:*.xcf=33:*.xpm=33:*.xwd=33:*.xwd=33:*.yuv=33:*.aac=33:*.au=33:*.flac=33:*.mid=33:*.midi=33:*.mka=33:*.mp3=33:*.mpa=33:*.mpeg=33:*.mpg=33:*.ogg=33:*.ra=33:*.wav=33:*.anx=33:*.asf=33:*.avi=33:*.axv=33:*.flc=33:*.fli=33:*.flv=33:*.gl=33:*.m2v=33:*.m4v=33:*.mkv=33:*.mov=33:*.mp4=33:*.mp4v=33:*.mpeg=33:*.mpg=33:*.nuv=33:*.ogm=33:*.ogv=33:*.ogx=33:*.qt=33:*.rm=33:*.rmvb=33:*.swf=33:*.vob=33:*.wmv=33:*.doc=31:*.docx=31:*.rtf=31:*.dot=31:*.dotx=31:*.xls=31:*.xlsx=31:*.ppt=31:*.pptx=31:*.fla=31:*.psd=31:*.7z=1;35:*.apk=1;35:*.arj=1;35:*.bin=1;35:*.bz=1;35:*.bz2=1;35:*.cab=1;35:*.deb=1;35:*.dmg=1;35:*.gem=1;35:*.gz=1;35:*.iso=1;35:*.jar=1;35:*.msi=1;35:*.rar=1;35:*.rpm=1;35:*.tar=1;35:*.tbz=1;35:*.tbz2=1;35:*.tgz=1;35:*.tx=1;35:*.war=1;35:*.xpi=1;35:*.xz=1;35:*.z=1;35:*.Z=1;35:*.zip=1;35:*.ANSI-30-black=30:*.ANSI-01;30-brblack=01;30:*.ANSI-31-red=31:*.ANSI-01;31-brred=01;31:*.ANSI-32-green=32:*.ANSI-01;32-brgreen=01;32:*.ANSI-33-yellow=33:*.ANSI-01;33-bryellow=01;33:*.ANSI-34-blue=34:*.ANSI-01;34-brblue=01;34:*.ANSI-35-magenta=35:*.ANSI-01;35-brmagenta=01;35:*.ANSI-36-cyan=36:*.ANSI-01;36-brcyan=01;36:*.ANSI-37-white=37:*.ANSI-01;37-brwhite=01;37:*.log=01;34:*~=01;34:*#=01;34:*.bak=01;36:*.BAK=01;36:*.old=01;36:*.OLD=01;36:*.org_archive=01;36:*.off=01;36:*.OFF=01;36:*.dist=01;36:*.DIST=01;36:*.orig=01;36:*.ORIG=01;36:*.swp=01;36:*.swo=01;36:*,v=01;36:*.gpg=34:*.gpg=34:*.pgp=34:*.asc=34:*.3des=34:*.aes=34:*.enc=34:' @@ -263,7 +264,7 @@ alias md='mkdir -p' alias rd='rmdir' alias .='source' -if [[ -n $osx && -n $commands[gls] ]] +if [[ $os == osx ]] then ls='\gls' else -- cgit 1.4.1 From 4315126ae683a32d3310f565629309c98cd11f97 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 15 Sep 2013 18:04:02 +0100 Subject: zsh: Refactor and improve cross-platform handling of ls options --- zsh/zshrc | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/zsh/zshrc b/zsh/zshrc index d6ae52ea..bbfa9301 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -83,13 +83,9 @@ fi case $OSTYPE in *gnu*) os=gnu - ls_options="-v --group-directories-first --color=auto" - ls_isodate="--time-style=long-iso" ;; freebsd*) os=freebsd - ls_options="-p" - ls_isodate="-D '%F %k:%M'" ;; darwin*) os=osx @@ -264,12 +260,33 @@ alias md='mkdir -p' alias rd='rmdir' alias .='source' -if [[ $os == osx ]] -then - ls='\gls' -else - ls='\ls' -fi +ls='\ls' +gnu_ls_options="-v --group-directories-first --color=auto" +gnu_ls_isodate="--time-style=long-iso" +bsd_ls_options="-p" +bsd_ls_isodate="-D '%F %k:%M'" + +case $os in + osx) + 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 + ;; + gnu) + ls_options=$gnu_ls_options + ls_isodate=$gnu_ls_isodate + ;; +esac alias l="${ls} ${ls_options} -Bp" alias l1="${ls} ${ls_options} -1" alias ls="${ls} ${ls_options} -hF" -- cgit 1.4.1 From f5456c0c3cf3e889b5995e711223f3d9f07cd96f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 15 Sep 2013 18:15:11 +0100 Subject: zsh: Remove unused aticonfig alias --- zsh/zshrc | 1 - 1 file changed, 1 deletion(-) diff --git a/zsh/zshrc b/zsh/zshrc index bbfa9301..4cfd638e 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -303,7 +303,6 @@ alias bitcoin="bitcoind" alias su="smart_sudo " alias e="$EDITOR" alias E="SUDO_EDITOR=\emacsclient -c -a emacs\" sudoedit" -alias aticonfig="DISPLAY=:0 \aticonfig" alias wprop='xprop |awk '\'' /^WM_CLASS/{sub(/.* =/, "instance:"); sub(/,/, "\nclass:"); print} /^WM_NAME/{sub(/.* =/, "title:"); print} -- cgit 1.4.1 From 1c7da5933ebaa92846b44df74e04c6ea77c8b6e3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 18 Sep 2013 17:07:56 +0100 Subject: Set the editor to emacsclient by default --- zsh/zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/zsh/zshrc b/zsh/zshrc index 4cfd638e..ecfec59b 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -33,6 +33,7 @@ fpath=( export PATH export PAGER="less" +export EDITOR="emacsclient" export CLICOLOR=true # -- cgit 1.4.1 From 4732920bd3fb38db009639ad55f76cdea26d1735 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 18 Sep 2013 17:26:11 +0100 Subject: Add font configuration for OSX --- emacs/init.el | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index c26f3e24..d9ce462e 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -123,23 +123,36 @@ Values: `desktop', `server', `laptop'") (variable-pitch-mode) (setq cursor-type 'bar)) - (if (eq window-system 'w32) - (let* ((font-size 10) - (mono-face (cond - ((member "Liberation Mono" (font-family-list)) - "Liberation Mono") - ((member "Liberation Sans Mono" (font-family-list)) - "Liberation Sans Mono") - ((member "Consolas" (font-family-list)) - "Consolas"))) - (variable-face "Segoe UI") - (default-font (concat mono-face "-" (number-to-string font-size)))) - (when mono-face - (set-face-font 'default default-font) - (set-face-font 'fixed-pitch default-font)) - (when variable-face - (set-face-font 'variable-pitch (concat variable-face "-" - (number-to-string (1+ font-size)))))))) + (cond + ((eq window-system 'w32) + (let* ((font-size 10) + (font-list (font-family-list)) + (mono-face (cond + ((member "Liberation Mono" font-list) + "Liberation Mono") + ((member "Liberation Sans Mono" font-list) + "Liberation Sans Mono") + ((member "Consolas" font-list) + "Consolas"))) + (variable-face "Segoe UI") + (default-font (concat mono-face "-" (number-to-string font-size)))) + (when mono-face + (set-face-font 'default default-font) + (set-face-font 'fixed-pitch default-font)) + (when variable-face + (set-face-font 'variable-pitch (concat variable-face "-" + (number-to-string (1+ font-size))))))) + ((eq window-system 'ns) + (let* ((font-size 14) + (font-list (font-family-list)) + (mono-face (cond + ((member "Droid Sans Mono" font-list) + "Droid Sans Mono"))) + (variable-face "Helvetica Neue") + (default-font (concat mono-face "-" (number-to-string font-size)))) + (when mono-face + (set-face-font 'default default-font) + (set-face-font 'fixed-pitch default-font)))))) (with-elapsed-timer "Setting up font styles" (let* ((font-height (face-attribute 'default :height)) -- cgit 1.4.1 From e25275c1cfc454671597c6f71901ca2e57758e99 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 19 Sep 2013 19:32:54 +0100 Subject: Change Emacs font rendering on X11 --- xresources/main | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xresources/main b/xresources/main index 0af5db9b..77c21ce3 100644 --- a/xresources/main +++ b/xresources/main @@ -28,6 +28,6 @@ Emacs.MenuBar: off Emacs.ScrollBars: off Emacs.CursorBlink: off -Emacs.Font: -*-Cousine-medium-*-*-*-*-110-*-*-*-*-*-* -Emacs.fixed-pitch.attributeFont: -*-Cousine-medium-*-*-*-*-110-*-*-*-*-*-* -Emacs.variable-pitch.attributeFont: -*-Arimo-medium-*-*-*-*-130-*-*-*-*-*-* +Emacs.Font: -*-Droid Sans Mono-medium-*-*-*-*-140-*-*-*-*-*-* +Emacs.fixed-pitch.attributeFont: -*-Droid Sans Mono-medium-*-*-*-*-140-*-*-*-*-*-* +Emacs.variable-pitch.attributeFont: -*-Arimo-medium-*-*-*-*-160-*-*-*-*-*-* -- cgit 1.4.1 From c087c244eec20ae4b76430b5b74fa7c6f32f4cd3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 22 Sep 2013 19:47:14 +0100 Subject: zsh: Fix prompt issues with TRAMP --- zsh/zshrc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/zsh/zshrc b/zsh/zshrc index ecfec59b..b2005cbc 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -170,10 +170,12 @@ zstyle ':vcs_info:*' enable git hg zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' '*?.old' '*?.pro' ## Prompt -autoload -U promptinit -promptinit - -prompt pure +if [[ $TERM != 'dumb' ]] +then + autoload -U promptinit + promptinit + prompt pure +fi # Options -- cgit 1.4.1 From 3ac726df65fda1d27446a53d633a3ae3f4fabe00 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 22 Sep 2013 18:48:49 +0000 Subject: zsh: Fix error when no gem-based programs are installed --- zsh/zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/zshrc b/zsh/zshrc index b2005cbc..c129e0c6 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -10,7 +10,7 @@ then $defpath ~/bin ) - if [[ -d ~/.gem/ruby ]] + if [[ -d ~/.gem/ruby/*/bin ]] then path=( $path -- cgit 1.4.1 From 6f9adfef6febe5450550f845019b6522c530bb29 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 26 Sep 2013 13:47:22 +0100 Subject: Add GNU Global tags files to global gitignore --- global.gitignore | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/global.gitignore b/global.gitignore index 02b15bfa..78d8d163 100644 --- a/global.gitignore +++ b/global.gitignore @@ -20,4 +20,8 @@ tramp # Org-mode .org-id-locations -*_archive \ No newline at end of file +*_archive + +GPATH +GRTAGS +GTAGS \ No newline at end of file -- cgit 1.4.1 From 46d307ed8bb790f35d5944ac4b93e1f77e1fc2f6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 26 Sep 2013 13:50:27 +0100 Subject: Emacs: Setup file associations for ruby mode --- emacs/init.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index d9ce462e..19296aa8 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -615,6 +615,10 @@ Values: `desktop', `server', `laptop'") :config (progn (add-hook 'puppet-mode-hook #'autopair-mode))) +(use-package ruby-mode + :mode (("\\.rb\\'" . ruby-mode) + ("\\.cap\\'" . ruby-mode))) + ;;;; Planning (use-package org -- cgit 1.4.1 From 1066cf861b650ac1a40e834dc08f48137fc3936a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 27 Sep 2013 16:34:55 +0100 Subject: Setup emmet-mode --- emacs/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 19296aa8..c179c278 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1174,6 +1174,9 @@ Works with: arglist-cont-nonempty, arglist-close." :defer t :config (setq sgml-basic-offset 4)) +(use-package emmet-mode + :ensure t) + (use-package web-mode :defer t :mode (("/views/.*\\.php\\'" . web-mode) -- cgit 1.4.1 From a7d64a6e05aa450dda63f9b8b68e637471b223c5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 28 Sep 2013 17:06:47 +0100 Subject: Replace auto-compile-mode with auto-async-byte-compile --- emacs/init.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index c179c278..a36ae20b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1043,10 +1043,9 @@ Also returns nil if pid is nil." ;;;; Programming -(use-package auto-compile +(use-package auto-async-byte-compile :ensure t - :commands (auto-compile-on-save-mode) - :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) + :init (add-hook 'emacs-lisp-mode-hook #'auto-async-byte-compile-mode)) (use-package cc-mode :defer t -- cgit 1.4.1 From 466163baf6e62fd2bbb8b5fd44de2b5c702c9268 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 28 Sep 2013 17:34:02 +0100 Subject: Emacs: Remove unnecessary eval-and-compile --- emacs/init.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index a36ae20b..111252da 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -75,8 +75,7 @@ Values: `desktop', `server', `laptop'") diminish use-package)) -(eval-and-compile - (require 'use-package)) +(require 'use-package) ;;;; Style -- cgit 1.4.1 From f690932f87c905c52ff0fbd90101fb35d17031cb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 29 Sep 2013 14:05:11 +0100 Subject: Emacs: add emmet-mode to web-mode-hook --- emacs/init.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index c179c278..6695f869 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1175,7 +1175,10 @@ Works with: arglist-cont-nonempty, arglist-close." :config (setq sgml-basic-offset 4)) (use-package emmet-mode - :ensure t) + :ensure t + :config (progn + (if (functionp 'web-mode) + (add-hook 'web-mode-hook #'emmet-mode)))) (use-package web-mode :defer t -- cgit 1.4.1 From 141a4f481e4a9cce21b59b3c45a3fa3b361d008c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 29 Sep 2013 18:26:08 +0100 Subject: MinTTY: Switch fonts --- minttyrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/minttyrc b/minttyrc index 37dae2b7..2e7f2d86 100644 --- a/minttyrc +++ b/minttyrc @@ -1,6 +1,6 @@ BoldAsFont=no -Font=Liberation Mono -FontHeight=10 +Font=Cousine +FontHeight=12 FontSmoothing=default Locale=en_GB Charset=UTF-8 -- cgit 1.4.1 From 873e1723a54845b58aae7feb1d48efce5f6d1fc8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 29 Sep 2013 20:15:50 +0100 Subject: Emacs: Set smex variables before calling smex-initialize --- emacs/init.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index b1362005..8141a2ff 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -569,16 +569,17 @@ Values: `desktop', `server', `laptop'") ("M-X" . smex-major-mode-commands) ("C-c M-x" . execute-extended-command)) :config (progn - (setq smex-history-length 100 - smex-save-file (concat user-emacs-directory - "smex-items")) (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 (smex-initialize)) + :init (progn + (setq smex-history-length 100 + smex-save-file (concat user-emacs-directory + "smex-items")) + (smex-initialize))) ;;;; Modeline -- cgit 1.4.1 From f9209f77714a65d29c9c3d7bad610de6360c8a13 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 29 Sep 2013 20:21:54 +0100 Subject: Emacs: setup recentf-mode --- emacs/init.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 8141a2ff..67167ec3 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -413,6 +413,11 @@ Values: `desktop', `server', `laptop'") (kill-buffer buffer) (message "File '%s' successfully removed" filename)))))) +(use-package recentf + :init (progn (setq recentf-auto-cleanup 'never + recentf-save-file (expand-file-name "recentf" user-emacs-directory)) + (recentf-mode 1))) + (use-package saveplace :config (progn (setq-default save-place t) (setq save-place-file (expand-file-name ".saveplace" user-emacs-directory)))) -- cgit 1.4.1 From 02eb79afe189b0ea9a72b149657c2e3d7daaee8f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 29 Sep 2013 20:22:27 +0100 Subject: Emacs: set ido-mode to add recent files to the buffer list --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index 67167ec3..1aae1d15 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -558,6 +558,7 @@ Values: `desktop', `server', `laptop'") (setq ido-decorations (quote ("\n›" "" "\n " "\n …" "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]"))) (setq ido-auto-merge-delay-time 99999 ido-enable-flex-matching t + ido-use-virtual-buffers t ido-save-directory-list-file (expand-file-name user-emacs-directory "ido-state")) (ido-init-completion-maps) -- cgit 1.4.1 From 42d7e04731c514c4abc9aa2867a4718d327a72d2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 29 Sep 2013 21:07:44 +0100 Subject: Emacs: switch from helm-ibuffer to ibuffer --- emacs/init.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 1aae1d15..146066a7 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -233,7 +233,7 @@ Values: `desktop', `server', `laptop'") ;;;; Buffers (use-package ibuffer - :disabled t + :bind (("C-x C-b" . ibuffer)) :config (progn (setq ibuffer-saved-filter-groups (quote (("default" @@ -545,8 +545,7 @@ Values: `desktop', `server', `laptop'") (use-package helm-config :ensure helm - :bind (("C-x i" . helm-imenu) - ("C-x C-b" . helm-mini)) + :bind (("C-x i" . helm-imenu)) :config (setq helm-idle-delay .1 helm-input-idle-delay .1)) -- cgit 1.4.1 From a4c0bc93085ff47092115fdf8c9cc1ac7dc70eab Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 29 Sep 2013 21:08:15 +0100 Subject: Emacs: fix ido initialisation --- emacs/init.el | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 146066a7..769c703b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -550,16 +550,17 @@ Values: `desktop', `server', `laptop'") helm-input-idle-delay .1)) (use-package ido - :init (bind-key* "C-x C-f" #'ido-find-file) :bind (("C-x b" . ido-switch-buffer)) + :init (progn + (setq ido-save-directory-list-file (expand-file-name "ido-state" user-emacs-directory)) + (bind-key* "C-x C-f" #'ido-find-file) + (ido-mode 1)) :config (progn - (ido-mode 1) - (setq ido-decorations (quote ("\n›" "" "\n " "\n …" "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]"))) - (setq ido-auto-merge-delay-time 99999 + (setq ido-decorations (quote ("\n›" "" "\n " "\n …" "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]")) + ido-auto-merge-delay-time 99999 ido-enable-flex-matching t - ido-use-virtual-buffers t - ido-save-directory-list-file (expand-file-name user-emacs-directory - "ido-state")) + ido-use-virtual-buffers t) + (ido-init-completion-maps) (defun ido-manual-merge () (interactive) -- cgit 1.4.1 From 6a418f791a153951437596103c7695edae2474e9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 29 Sep 2013 21:20:50 +0100 Subject: Emacs: install and enable diff-hl-mode --- emacs/init.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 769c703b..618e718b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -775,6 +775,10 @@ Also returns nil if pid is nil." :config (progn (setq vc-follow-symlinks t))) +(use-package diff-hl + :ensure t + :init (global-diff-hl-mode)) + (use-package magit :commands (magit-status) :bind (("C-x g" . magit-status) -- cgit 1.4.1 From 02dbcc8ffbdfe73d7e1923d8be8e68cfe44aa1ed Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 2 Oct 2013 07:52:17 +0100 Subject: Emacs: Load multiple-cursors eagerly --- emacs/init.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 618e718b..546d494c 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -910,11 +910,12 @@ Also returns nil if pid is nil." (use-package multiple-cursors :ensure t - :bind (("C-." . mc/mark-next-like-this) - ("C-," . mc/mark-previous-like-this) - ("M-" . mc/mark-all-like-this-dwim) - ("C-" . mc/mark-more-like-this-extended) - ("C-S-L" . mc/edit-lines))) + :config (progn + (bind-key "C-." #'mc/mark-next-like-this) + (bind-key "C-," #'mc/mark-previous-like-this) + (bind-key "M-" #'mc/mark-all-like-this-dwim) + (bind-key "C-" #'mc/mark-more-like-this-extended) + (bind-key "C-S-L" #'mc/edit-lines))) (use-package eldoc :defer t -- cgit 1.4.1 From f7bc7d5d4978f57126f6e298cc917388bd6442f5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 2 Oct 2013 07:54:02 +0100 Subject: Emacs: don't insure that SLIME is installed --- emacs/init.el | 1 - 1 file changed, 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 546d494c..925ff8ee 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1005,7 +1005,6 @@ Also returns nil if pid is nil." :config (use-package quack)) (use-package slime - :ensure t :commands (slime) :config (progn (let ((ql-slime-helper (expand-file-name "~/quicklisp/slime-helper.el"))) -- cgit 1.4.1 From dd63c2cfabdffb0b9c8acf780e81e1562fe6e0e9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 2 Oct 2013 08:01:37 +0100 Subject: Revert "Replace auto-compile-mode with auto-async-byte-compile" This reverts commit a7d64a6e05aa450dda63f9b8b68e637471b223c5. --- emacs/init.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 925ff8ee..a8526340 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1053,9 +1053,10 @@ Also returns nil if pid is nil." ;;;; Programming -(use-package auto-async-byte-compile +(use-package auto-compile :ensure t - :init (add-hook 'emacs-lisp-mode-hook #'auto-async-byte-compile-mode)) + :commands (auto-compile-on-save-mode) + :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) (use-package cc-mode :defer t -- cgit 1.4.1 From cf9e2160505c1346ff15f6c9f71741c9b715e385 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 5 Oct 2013 11:50:26 +0100 Subject: Emacs: Switch back to auto-compile from auto-async-byte-compile --- emacs/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 618e718b..65f79fc3 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1053,9 +1053,9 @@ Also returns nil if pid is nil." ;;;; Programming -(use-package auto-async-byte-compile +(use-package auto-compile :ensure t - :init (add-hook 'emacs-lisp-mode-hook #'auto-async-byte-compile-mode)) + :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) (use-package cc-mode :defer t -- cgit 1.4.1 From 5390d0cd5e5f3fa7fc47c07e7889d9f5ccb6104b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 5 Oct 2013 11:50:55 +0100 Subject: Emacs: Enable flx in ido --- emacs/init.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 65f79fc3..7866db6d 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -567,6 +567,11 @@ Values: `desktop', `server', `laptop'") (ido-initiate-auto-merge (current-buffer))) (bind-key "C-c C-s" #'ido-manual-merge ido-file-dir-completion-map))) +(use-package flx-ido + :ensure t + :init (progn + (flx-ido-mode 1))) + (use-package smex :ensure t :bind (("M-x" . smex) -- cgit 1.4.1 From 679f2843746576f48e4ffd106a21753346fc4bcb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 5 Oct 2013 13:13:17 +0100 Subject: Emacs: disable ido-virtual-buffers due to issues with flx-ido --- emacs/init.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 7866db6d..af453490 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -558,8 +558,7 @@ Values: `desktop', `server', `laptop'") :config (progn (setq ido-decorations (quote ("\n›" "" "\n " "\n …" "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]")) ido-auto-merge-delay-time 99999 - ido-enable-flex-matching t - ido-use-virtual-buffers t) + ido-enable-flex-matching t) (ido-init-completion-maps) (defun ido-manual-merge () -- cgit 1.4.1 From 375a9800c1ef5cfcaf55361479f19b8e96ef767e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 7 Oct 2013 07:50:55 +0100 Subject: zsh: remove e alias; duplicate of fasd --- zsh/zshrc | 1 - 1 file changed, 1 deletion(-) diff --git a/zsh/zshrc b/zsh/zshrc index c129e0c6..bc336e56 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -304,7 +304,6 @@ alias lsr="${ls} -tld *(m-2)" # mtime < -2days alias trans="transmission-remote transmission.home" alias bitcoin="bitcoind" alias su="smart_sudo " -alias e="$EDITOR" alias E="SUDO_EDITOR=\emacsclient -c -a emacs\" sudoedit" alias wprop='xprop |awk '\'' /^WM_CLASS/{sub(/.* =/, "instance:"); sub(/,/, "\nclass:"); print} -- cgit 1.4.1 From 66e32f4a0246c67bde50cd737a3f33f7bc9feb22 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 7 Oct 2013 07:55:17 +0100 Subject: zsh: Enable current path lookup in fasd only when using the e alias --- zsh/fasdrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/zsh/fasdrc b/zsh/fasdrc index efe6e0a3..22259d72 100644 --- a/zsh/fasdrc +++ b/zsh/fasdrc @@ -5,5 +5,4 @@ current () { done } -# If you want to have this behavior for all fasd queries -_FASD_BACKENDS="native current" +alias e="f -t -e $EDITOR -B current" -- cgit 1.4.1 From 16b840b18e4d71f916b37ec3de7e3e2dd963449d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 7 Oct 2013 07:57:33 +0100 Subject: Installer: ensure that the fasdrc is symlinked correctly --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index 16d30c58..c3e2feb3 100755 --- a/install +++ b/install @@ -35,7 +35,7 @@ install-dot () { install-dot dotfiles/.git/hooks/ dotfiles/git-hooks/* install-dot .emacs.d/ dotfiles/emacs/* -install-dot . dotfiles/^install(.) dotfiles/zsh/zshrc +install-dot . dotfiles/^install(.) dotfiles/zsh/zshrc dotfiles/zsh/fasdrc install-dot .ssh/ dotfiles/ssh/* if [[ -d projects/dwm ]] then -- cgit 1.4.1 From caa651f5da454e83d35df086bd40883d6acaab54 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 7 Oct 2013 08:00:38 +0100 Subject: Use git instead of mercurial for cloning dotfiles on new installations --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index c3e2feb3..6eb45912 100755 --- a/install +++ b/install @@ -6,7 +6,7 @@ setopt EXTENDED_GLOB if [[ ! -d dotfiles && ${(L)host} =~ prefect ]] then - hg clone ssh://alan@home.alanpearce.co.uk:22222/dotfiles + git clone ssh://alan@home.alanpearce.co.uk:22222/~/dotfiles.git fi install-dot () { -- cgit 1.4.1 From b9575ac8de66afd3a74665751760fa2edbda6061 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 7 Oct 2013 08:16:53 +0100 Subject: Move dotfiles under ~/projects --- install | 31 ++++++++++++++++--------------- zsh/zshrc | 4 ++-- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/install b/install index 6eb45912..41d82902 100755 --- a/install +++ b/install @@ -1,10 +1,11 @@ #!/usr/bin/env zsh +target=~/projects/dotfiles pushd $HOME setopt EXTENDED_GLOB -if [[ ! -d dotfiles && ${(L)host} =~ prefect ]] +if [[ ! -d $target && ${(L)host} =~ prefect ]] then git clone ssh://alan@home.alanpearce.co.uk:22222/~/dotfiles.git fi @@ -33,13 +34,13 @@ install-dot () { done } -install-dot dotfiles/.git/hooks/ dotfiles/git-hooks/* -install-dot .emacs.d/ dotfiles/emacs/* -install-dot . dotfiles/^install(.) dotfiles/zsh/zshrc dotfiles/zsh/fasdrc -install-dot .ssh/ dotfiles/ssh/* +install-dot $target/.git/hooks/ $target/git-hooks/* +install-dot .emacs.d/ $target/emacs/* +install-dot . $target/^install(.) $target/zsh/zshrc $target/zsh/fasdrc +install-dot .ssh/ $target/ssh/* if [[ -d projects/dwm ]] then - install-dot projects/dwm/ dotfiles/dwm/* + install-dot projects/dwm/ $target/dwm/* fi if [[ -x =emacs ]] @@ -53,30 +54,30 @@ then fi fasd_cache=~/.zsh/cache/fasd-init-zsh -if [[ ! -s "$fasd_cache" || dotfiles/zsh/functions/fasd -nt "$fasd_cache" ]]; then - dotfiles/zsh/functions/fasd/fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache" +if [[ ! -s "$fasd_cache" || $target/zsh/functions/fasd -nt "$fasd_cache" ]]; then + $target/zsh/functions/fasd/fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache" fi autoload -U zrecompile local -a zfiles zfiles=( - dotfiles/zsh/functions/fasd/fasd + $target/zsh/functions/fasd/fasd $fasd_cache - dotfiles/zsh/zshrc + $target/zsh/zshrc ) -if [[ -f dotfiles/zsh/zshrc_${HOST%%.*} ]]; then - zfiles+=dotfiles/zsh/zshrc_${HOST%%.*} +if [[ -f $target/zsh/zshrc_${HOST%%.*} ]]; then + zfiles+=$target/zsh/zshrc_${HOST%%.*} fi if [[ -e /usr/bin/emerge ]]; then - zfiles+=dotfiles/zsh/zshrc_gentoo + zfiles+=$target/zsh/zshrc_gentoo fi if [[ $OSTYPE == freebsd* ]]; then - zfiles+=dotfiles/zsh/zshrc_freebsd + zfiles+=$target/zsh/zshrc_freebsd fi zrecompile -p -R ~/.zshrc.zwc $zfiles -for fp in dotfiles/zsh/functions/*(/); do +for fp in $target/zsh/functions/*(/); do zrecompile -p $fp $fp/* done diff --git a/zsh/zshrc b/zsh/zshrc index bc336e56..672ed7ce 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -24,10 +24,10 @@ then mkdir -p ~/.zsh/cache fi -myfuncs=( ~alan/dotfiles/zsh/functions/*(/) ) +myfuncs=( ~alan/projects/dotfiles/zsh/functions/*(/) ) fpath=( $myfuncs - ~alan/dotfiles/zsh/completion/ + ~alan/projects/dotfiles/zsh/completion/ $fpath ) -- cgit 1.4.1 From cd3947fad742a604cb5be03cc1378d803cd032c5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 7 Oct 2013 08:30:02 +0100 Subject: Remove unneeded canonicalisation from installer --- install | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/install b/install index 41d82902..b3dd84a3 100755 --- a/install +++ b/install @@ -11,25 +11,11 @@ then fi install-dot () { - local absolute - if [[ ${1[-1]} == "/" ]] - then - absolute=$PWD/ - - if [[ ! -d $1 ]] - then - mkdir $1 - fi - - else - absolute="" - fi - for f in $@[2,-1] do if [[ ! -e $1$f:t ]] then - ln -sf $absolute$f $1$f:t + ln -sf $f $1$f:t fi done } -- cgit 1.4.1 From 78847369196226167bdfc8dd04615fbf7ac41f9b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 7 Oct 2013 13:01:10 +0100 Subject: Emacs: switch to the Wordpress coding style in php-mode-hook --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index 0b92b4e8..fd54684b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1178,6 +1178,7 @@ Works with: arglist-cont-nonempty, arglist-close." (unbind-key "C-." php-mode-map) (if (eq env/location 'home) (setq php-manual-url "http://docs.home/manual/en/")) + (add-hook 'php-mode-hook #'php-enable-wordpress-coding-style) (add-hook 'php-mode-hook (lambda () (set (make-local-variable 'eldoc-documentation-function) #'my-php-eldoc-function))) (use-package eldoc-php -- cgit 1.4.1 From 41eefb4a28f5aae4ab78e73cbcb925117b1076ea Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 7 Oct 2013 13:02:35 +0100 Subject: Git: fix path to global gitignore file --- gitconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitconfig b/gitconfig index 9d616709..a31439e2 100644 --- a/gitconfig +++ b/gitconfig @@ -22,4 +22,4 @@ [diff] algorithm = patience [core] - excludesfile = /Users/alan/dotfiles/global.gitignore + excludesfile = ~/projects/dotfiles/global.gitignore -- cgit 1.4.1 From cb812e671e45bea0c33a7361f1bd7262f020c46c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 7 Oct 2013 13:10:18 +0100 Subject: Emacs: remove customisation of byte-compile-dest-file for init.el Instead, rely on installer creating a symlink to ~/projects/dotfiles/init.elc --- emacs/elisp/ap-functions.el | 11 ----------- emacs/init.el | 7 +------ install | 2 +- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/emacs/elisp/ap-functions.el b/emacs/elisp/ap-functions.el index 4c300015..19f63320 100644 --- a/emacs/elisp/ap-functions.el +++ b/emacs/elisp/ap-functions.el @@ -25,17 +25,6 @@ (error (message "Invalid expression") (insert (current-kill 0))))) -;;;###autoload -(defun ap/byte-compile-get-dest (filename) - (let ((basename (file-name-nondirectory filename)) - (dirname (file-name-directory filename))) - (cond - ((string-equal basename "init.el") - (if (file-exists-p (concat user-emacs-directory "init.el")) - (concat user-emacs-directory "init.elc"))) - (t (let (byte-compile-dest-file-function) - (byte-compile-dest-file filename)))))) - ;;;###autoload (defun shell-execute (to-current-buffer) (interactive "P") diff --git a/emacs/init.el b/emacs/init.el index fd54684b..76a6ac90 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -877,8 +877,7 @@ Also returns nil if pid is nil." ("M-Z" . zap-to-char))) (use-package ap-functions - :commands (ap/remove-extra-cr - ap/byte-compile-get-dest) + :commands (ap/remove-extra-cr) :bind (("C-x r M-w" . copy-rectangle) ("M-!" . shell-execute))) @@ -984,10 +983,6 @@ Also returns nil if pid is nil." (add-hook 'lisp-mode-hook #'ap/lisp-setup) (add-hook 'lisp-mode-hook #'set-common-lisp-indentation) -(use-package bytecomp - :defer t - :config (setq byte-compile-dest-file-function #'ap/byte-compile-get-dest)) - (use-package elisp-slime-nav :commands elisp-slime-nav-mode :diminish elisp-slime-nav-mode) diff --git a/install b/install index b3dd84a3..13ee6cca 100755 --- a/install +++ b/install @@ -21,7 +21,7 @@ install-dot () { } install-dot $target/.git/hooks/ $target/git-hooks/* -install-dot .emacs.d/ $target/emacs/* +install-dot .emacs.d/ $target/emacs/{init.el{,c},elisp} install-dot . $target/^install(.) $target/zsh/zshrc $target/zsh/fasdrc install-dot .ssh/ $target/ssh/* if [[ -d projects/dwm ]] -- cgit 1.4.1 From c0633cd67a4a6bfd40cf3eea146cbdc5679916d3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 7 Oct 2013 13:12:23 +0100 Subject: Emacs: improve font-setting on OSX when running as a daemon --- emacs/init.el | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 76a6ac90..da2ec6c9 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -135,23 +135,19 @@ Values: `desktop', `server', `laptop'") "Consolas"))) (variable-face "Segoe UI") (default-font (concat mono-face "-" (number-to-string font-size)))) - (when mono-face - (set-face-font 'default default-font) - (set-face-font 'fixed-pitch default-font)) - (when variable-face - (set-face-font 'variable-pitch (concat variable-face "-" - (number-to-string (1+ font-size))))))) - ((eq window-system 'ns) + (when mono-face + (add-to-list 'default-frame-alist `(font . ,default-font)) + (set-face-font 'fixed-pitch default-font)) + (when variable-face + (set-face-font 'variable-pitch (concat variable-face "-" + (number-to-string (1+ font-size))))))) + ((eq system-type 'darwin) (let* ((font-size 14) - (font-list (font-family-list)) - (mono-face (cond - ((member "Droid Sans Mono" font-list) - "Droid Sans Mono"))) + (mono-face "Droid Sans Mono") (variable-face "Helvetica Neue") (default-font (concat mono-face "-" (number-to-string font-size)))) - (when mono-face - (set-face-font 'default default-font) - (set-face-font 'fixed-pitch default-font)))))) + (when mono-face + (add-to-list 'default-frame-alist `(font . ,default-font))))))) (with-elapsed-timer "Setting up font styles" (let* ((font-height (face-attribute 'default :height)) -- cgit 1.4.1 From 4cac4e8b64f52a05837f1f40af9fba355370d5ee Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 8 Oct 2013 17:07:23 +0100 Subject: Add ec and et commands to launch emacsclient in a terminal and GUI respectively --- zsh/zshrc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/zsh/zshrc b/zsh/zshrc index 672ed7ce..6fd0362b 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -310,6 +310,8 @@ alias wprop='xprop |awk '\'' /^WM_NAME/{sub(/.* =/, "title:"); print} /^WM_WINDOW_ROLE/{sub(/.* =/, "role:"); print}'\''' +alias et="emacsclient -t" + alias -g ...='../..' #Suffix aliases @@ -374,6 +376,28 @@ smart_compile () { fi } +emacs_change_focus () { + emacsclient -n -e "(select-frame-set-input-focus (selected-frame))" > /dev/null +} + +ec () { + local visibleFrames + visibleFrames=`emacsclient -e '(length (visible-frame-list))'` + if [[ $? -ne 0 ]]; then + print "Daemon not running" + return 1 + fi + + if [[ $visibleFrames -eq 1 ]]; then + emacsclient -n -c "$@" && emacs_change_focus + else + emacs_change_focus + if [[ $# -gt 0 ]]; then + emacsclient -n "$@" + fi + fi +} + _FASD_DATA="$HOME/.zsh/fasd-data" autoload -U fasd source ~/.zsh/cache/fasd-init-zsh -- cgit 1.4.1 From 6c2e4f6c0b289fd187fb86f07ac18669d447c07a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 8 Oct 2013 17:10:27 +0100 Subject: Add alias to launch magit in GUI emacs --- zsh/zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/zsh/zshrc b/zsh/zshrc index 6fd0362b..93f24d04 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -311,6 +311,7 @@ alias wprop='xprop |awk '\'' /^WM_WINDOW_ROLE/{sub(/.* =/, "role:"); print}'\''' alias et="emacsclient -t" +alias magit='ec -e "(magit-status \"$PWD\")"' alias -g ...='../..' -- cgit 1.4.1 From dbb5119d03819bc73cb2fde72705d1bd40547030 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 8 Oct 2013 21:10:42 +0100 Subject: Emacs: remove moz-repl mode --- emacs/init.el | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index da2ec6c9..332a8914 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1111,25 +1111,6 @@ Works with: arglist-cont-nonempty, arglist-close." ;;;; Web Development -(use-package moz - :load-path "moz-repl" - :commands (moz-firefox-reload - moz-reload-on-save-mode - moz-minor-mode) - :config (progn - (define-minor-mode moz-reload-on-save-mode - "Moz Reload On Save Minor Mode" - nil " Reload" nil - (if moz-reload-on-save-mode - ;; Edit hook buffer-locally. - (add-hook 'after-save-hook 'moz-firefox-reload nil t) - (remove-hook 'after-save-hook 'moz-firefox-reload t))) - - (defun moz-firefox-reload () - "Reload Firefox" - (interactive) - (comint-send-string (inferior-moz-process) "BrowserReload();")))) - (use-package skewer-mode :ensure t :defer t -- cgit 1.4.1 From e215529e42c466ae3f3513832af4025cd7b5a92b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 8 Oct 2013 21:15:20 +0100 Subject: Emacs: fix warning in project-persist configuration --- emacs/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 332a8914..03834a1e 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -714,6 +714,8 @@ Values: `desktop', `server', `laptop'") ("C-c P k" . project-persist-close) ("C-c P n" . project-persist-create) ("C-c P s" . project-persist-save)) + :init (eval-when-compile + (autoload #'pp/settings-get "project-persist")) :config (progn (project-persist-mode t) -- cgit 1.4.1 From f59f8736b8601fa96fd96ec643f1ee510653bf5f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 8 Oct 2013 21:18:14 +0100 Subject: Emacs: ensure that org-journal is installed --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index 03834a1e..0c934fdb 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -684,6 +684,7 @@ Values: `desktop', `server', `laptop'") (org-todo "STARTED"))))))) (use-package org-journal + :ensure t :config (progn (setq org-journal-date-format "%A, %d %B %Y"))) -- cgit 1.4.1 From 2cb9ae76a13edbeed2240647633bc9bd13136e69 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 8 Oct 2013 21:22:57 +0100 Subject: Emacs: remove old-style indentation function --- emacs/init.el | 41 +---------------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 0c934fdb..b62c3085 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1067,46 +1067,7 @@ Also returns nil if pid is nil." (awk-mode . "awk") (other . "k&r")) c-basic-offset 4) - (c-set-offset 'case-label '+) - (c-set-offset 'arglist-cont-nonempty #'ap/c-lineup-arglist) - (defun ap/c-lineup-arglist (langelem) - "Line up the current argument line under the first argument. - -As a special case, if the indented line is inside a brace block -construct, the indentation is 0 only. This is intended -as a \"DWIM\" measure in cases like macros that contains statement -blocks, e.g: - -A_VERY_LONG_MACRO_NAME ({ - some (code, with + long, lines * in[it]); -}); -<--> c-basic-offset - -Works with: arglist-cont-nonempty, arglist-close." - (save-excursion - (let ((indent-pos (point))) - - (if (c-block-in-arglist-dwim (c-langelem-2nd-pos c-syntactic-element)) - 0 - - ;; Normal case. Indent to the token after the arglist open paren. - (goto-char (c-langelem-2nd-pos c-syntactic-element)) - (if (and c-special-brace-lists - (c-looking-at-special-brace-list)) - ;; Skip a special brace list opener like "({". - (progn (c-forward-token-2) - (forward-char)) - (forward-char)) - - (let ((arglist-content-start (point))) - (c-forward-syntactic-ws) - (when (< (point) indent-pos) - (goto-char arglist-content-start) - (skip-chars-forward " \t")) - (vector (if (or (looking-at ",") - (looking-at ")")) - (- (current-column) 2) - (current-column)))))))))) + (c-set-offset 'case-label '+))) (use-package quickrun :defer t -- cgit 1.4.1 From bd5457d65b55bb66485090b81d0ea0f13473fdbe Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 8 Oct 2013 21:25:01 +0100 Subject: Emacs: remove commented-out code --- emacs/init.el | 2 -- 1 file changed, 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index b62c3085..2182f38b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1059,8 +1059,6 @@ Also returns nil if pid is nil." :defer t :init (progn (add-hook 'c-mode-common-hook (lambda () - ;; (use-package mic-paren - ;; :init (paren-toggle-open-paren-context 1)) (electric-indent-mode 1)))) :config (progn (setq c-default-style '((java-mode . "java") -- cgit 1.4.1 From 1848881661a8271891e6806af061764fb0fb7a12 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 8 Oct 2013 21:25:44 +0100 Subject: Emacs: remove unnecessary lambda function --- emacs/init.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 2182f38b..6d2dafe1 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1058,8 +1058,7 @@ Also returns nil if pid is nil." (use-package cc-mode :defer t :init (progn - (add-hook 'c-mode-common-hook (lambda () - (electric-indent-mode 1)))) + (add-hook 'c-mode-common-hook #'electric-indent-mode)) :config (progn (setq c-default-style '((java-mode . "java") (awk-mode . "awk") -- cgit 1.4.1 From e3acf5d644cb1137db38e66cddbdfa87e6aa7f88 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 8 Oct 2013 21:32:48 +0100 Subject: Emacs: silence compiler warning about unused variable --- emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 6d2dafe1..6844502a 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -577,7 +577,7 @@ Values: `desktop', `server', `laptop'") :config (progn (setq smex-key-advice-ignore-menu-bar t smex-auto-update nil) - (defun smex-update-after-load (unused) + (defun smex-update-after-load (_unused) (if (boundp 'smex-cache) (smex-update))) (add-hook 'after-load-functions 'smex-update-after-load)) -- cgit 1.4.1 From d0f58576663d1005503cb148fc63c3cdaf620501 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 8 Oct 2013 21:34:00 +0100 Subject: Emacs: set a variable pitch font under darwin --- emacs/init.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 6844502a..12a5f53d 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -147,7 +147,10 @@ Values: `desktop', `server', `laptop'") (variable-face "Helvetica Neue") (default-font (concat mono-face "-" (number-to-string font-size)))) (when mono-face - (add-to-list 'default-frame-alist `(font . ,default-font))))))) + (add-to-list 'default-frame-alist `(font . ,default-font))) + (when variable-face + (set-face-font 'variable-pitch (concat variable-face "-" + (number-to-string (1+ font-size))))))))) (with-elapsed-timer "Setting up font styles" (let* ((font-height (face-attribute 'default :height)) -- cgit 1.4.1 From 27aefd3262ab94a65b1dbaf093ee57e7153eeb57 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 8 Oct 2013 21:46:00 +0100 Subject: Emacs: fix reference to missing font on OSX --- emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 12a5f53d..f2d8f90b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -144,7 +144,7 @@ Values: `desktop', `server', `laptop'") ((eq system-type 'darwin) (let* ((font-size 14) (mono-face "Droid Sans Mono") - (variable-face "Helvetica Neue") + (variable-face "Helvetica_Neue") (default-font (concat mono-face "-" (number-to-string font-size)))) (when mono-face (add-to-list 'default-frame-alist `(font . ,default-font))) -- cgit 1.4.1 From cb96fbeff86f259cabefd4926a97d770e0201efd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 8 Oct 2013 21:48:57 +0100 Subject: Emacs: remove call to moz-minor-mode --- emacs/init.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index f2d8f90b..60a35fd9 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1088,9 +1088,7 @@ Also returns nil if pid is nil." :mode ("\\.js\\'" . js2-mode) :config (progn (defun ap/javascript-setup () - (if (featurep 'moz) - (moz-minor-mode)) - (autopair-mode -1) + (autopair-mode -1) (auto-indent-mode -1)) (add-hook 'js2-mode-hook #'ap/javascript-setup) (setq js2-basic-offset 4 -- cgit 1.4.1 From b8fa55df0cee0d976d69dd188fcc64e179d04c97 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 9 Oct 2013 07:43:39 +0100 Subject: zsh: Remove duplicate fasd e alias --- zsh/zshrc | 1 - 1 file changed, 1 deletion(-) diff --git a/zsh/zshrc b/zsh/zshrc index 93f24d04..b60e3d81 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -402,4 +402,3 @@ ec () { _FASD_DATA="$HOME/.zsh/fasd-data" autoload -U fasd source ~/.zsh/cache/fasd-init-zsh -alias e="f -e $EDITOR" -- cgit 1.4.1 From 692c8fdc954ebe282f96ca63dcfe04e8fc651116 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Oct 2013 17:09:23 +0100 Subject: Emacs: add register for zshrc --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index 60a35fd9..96a2cf64 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -524,6 +524,7 @@ Values: `desktop', `server', `laptop'") (bind-key "s-x" (define-prefix-command 'super-x-map)) (set-register ?e `(file . ,*init-file*)) +(set-register ?z `(file . ,(expand-file-name ".zshrc" "~"))) ;; Enable narrowing functions C-x n (put 'narrow-to-defun 'disabled nil) -- cgit 1.4.1 From bed8fd45eda6788e315b5ee47e09fa9e7291b63c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Oct 2013 17:10:33 +0100 Subject: zsh: Add alias to open the current directory in Emacs' dired --- zsh/zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/zsh/zshrc b/zsh/zshrc index b60e3d81..c3b41372 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -312,6 +312,7 @@ alias wprop='xprop |awk '\'' alias et="emacsclient -t" alias magit='ec -e "(magit-status \"$PWD\")"' +alias dired='ec -e "(dired \"$PWD\")"' alias -g ...='../..' -- cgit 1.4.1 From ff17a94532bbd44709db6b71d6d9f67de39e8a89 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Oct 2013 15:12:17 +0100 Subject: Emacs: workaround issue setting variable-pitch fonts on OSX --- emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 96a2cf64..6b8a253d 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -148,7 +148,7 @@ Values: `desktop', `server', `laptop'") (default-font (concat mono-face "-" (number-to-string font-size)))) (when mono-face (add-to-list 'default-frame-alist `(font . ,default-font))) - (when variable-face + (when (and variable-face (display-graphic-p)) (set-face-font 'variable-pitch (concat variable-face "-" (number-to-string (1+ font-size))))))))) -- cgit 1.4.1 From 9200045481dd98c9fd3fba601c53cd9040035266 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Oct 2013 16:50:53 +0100 Subject: Emacs: bind s-, to open emacs init file from register --- emacs/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 6b8a253d..ad8fd754 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -523,6 +523,9 @@ Values: `desktop', `server', `laptop'") (bind-key "s-x" (define-prefix-command 'super-x-map)) +(bind-key "s-," (lambda () + (interactive) + (jump-to-register ?e))) (set-register ?e `(file . ,*init-file*)) (set-register ?z `(file . ,(expand-file-name ".zshrc" "~"))) -- cgit 1.4.1 From 935f48e57f591495e345b976933c32dd83bfed6d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Oct 2013 17:33:11 +0100 Subject: zsh: Disable globbing for the salt command --- zsh/zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/zsh/zshrc b/zsh/zshrc index c3b41372..9224464a 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -301,6 +301,7 @@ alias llr="ll -t" alias gpp='g++' alias lsr="${ls} -tld *(m-2)" # mtime < -2days +alias salt="noglob salt" alias trans="transmission-remote transmission.home" alias bitcoin="bitcoind" alias su="smart_sudo " -- cgit 1.4.1 From a9410aefcbeb39343a4cb11311d9bea14e99d931 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Oct 2013 21:40:03 +0100 Subject: Emacs: Disable smart-tabs-mode in ruby-mode --- emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index ad8fd754..2c475fb6 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -484,7 +484,7 @@ Values: `desktop', `server', `laptop'") smart-tabs-mode-enable smart-tabs-advice) :config (progn - (smart-tabs-insinuate 'c 'javascript 'cperl 'python 'ruby) + (smart-tabs-insinuate 'c 'javascript 'cperl 'python) (add-hook 'php-mode-hook #'smart-tabs-mode-enable))) ;;;; Keybindings -- cgit 1.4.1 From 5437177559b02eab5348f19b716bf425bff9848c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 19 Oct 2013 14:06:06 +0100 Subject: zsh: Add alias for prettyping.sh --- zsh/zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/zsh/zshrc b/zsh/zshrc index 9224464a..6fe27db7 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -302,6 +302,7 @@ alias gpp='g++' alias lsr="${ls} -tld *(m-2)" # mtime < -2days alias salt="noglob salt" +alias pping="prettyping.sh" alias trans="transmission-remote transmission.home" alias bitcoin="bitcoind" alias su="smart_sudo " -- cgit 1.4.1 From d5bde98df481dbbd7407e8d968f985da32220c64 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 19 Oct 2013 17:41:01 +0100 Subject: Update pure prompt --- zsh/functions/pure/prompt_pure_setup | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/zsh/functions/pure/prompt_pure_setup b/zsh/functions/pure/prompt_pure_setup index 1bbe2673..275224ad 100644 --- a/zsh/functions/pure/prompt_pure_setup +++ b/zsh/functions/pure/prompt_pure_setup @@ -18,8 +18,8 @@ # fastest possible way to check if repo is dirty prompt_pure_git_dirty() { - # check if we're at the top level of a git repo - [[ -d .git ]] || return + # check if we're in a git repo + command git rev-parse --is-inside-work-tree &>/dev/null || return # check if it's dirty command git diff --quiet --ignore-submodules HEAD &>/dev/null @@ -28,17 +28,24 @@ prompt_pure_git_dirty() { # displays the exec time of the last command if set threshold was exceeded prompt_pure_cmd_exec_time() { - local stop=`date +%s` + local stop=$(date +%s) local start=${cmd_timestamp:-$stop} integer elapsed=$stop-$start (($elapsed > ${PURE_CMD_MAX_EXEC_TIME:=5})) && echo ${elapsed}s } prompt_pure_preexec() { - cmd_timestamp=`date +%s` + cmd_timestamp=$(date +%s) # shows the current dir and executed command in the title when a process is active - print -Pn "\e]0;$PWD:t: $2\a" + print -Pn "\e]0;" + echo -nE "$PWD:t: $2" + print -Pn "\a" +} + +# string length ignoring ansi escapes +prompt_pure_string_length() { + echo ${#${(S%%)1//(\%([KF1]|)\{*\}|\%[Bbkf])}} } prompt_pure_precmd() { @@ -48,7 +55,21 @@ prompt_pure_precmd() { # git info vcs_info - print -P '%F{blue}%~%F{11}$vcs_info_msg_0_`prompt_pure_git_dirty` $prompt_pure_username%f %F{yellow}`prompt_pure_cmd_exec_time`%f' + local prompt_pure_preprompt='\n%F{blue}%~%F{242}$vcs_info_msg_0_`prompt_pure_git_dirty` $prompt_pure_username%f %F{yellow}`prompt_pure_cmd_exec_time`%f' + print -P $prompt_pure_preprompt + + # check async if there is anything to pull + { + # check if we're in a git repo + command git rev-parse --is-inside-work-tree &>/dev/null && + # check check if there is anything to pull + command git fetch &>/dev/null && + # check if there is an upstream configured for this branch + command git rev-parse --abbrev-ref @'{u}' &>/dev/null && + (( $(command git rev-list --count HEAD...@'{u}' 2>/dev/null) > 0 )) && + # some crazy ansi magic to inject the symbol into the previous line + print -Pn "\e7\e[A\e[1G\e[`prompt_pure_string_length $prompt_pure_preprompt`C%F{cyan}⇣%f\e8" + } &! # reset value since `preexec` isn't always triggered unset cmd_timestamp @@ -72,7 +93,7 @@ prompt_pure_setup() { [[ "$SSH_CONNECTION" != '' ]] && prompt_pure_username='%n@%m ' # prompt turns red if the previous command didn't exit with 0 - PROMPT='%(?.%F{14}.%F{magenta})❯%f ' + PROMPT='%(?.%F{magenta}.%F{red})❯%f ' } prompt_pure_setup "$@" -- cgit 1.4.1 From 7155b75d6f9e33c5a5c83aacfc25421139b0c5ec Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 20 Oct 2013 09:44:52 +0100 Subject: zsh: increase contrast of pure prompt character --- zsh/functions/pure/prompt_pure_setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/functions/pure/prompt_pure_setup b/zsh/functions/pure/prompt_pure_setup index 275224ad..a263e67d 100644 --- a/zsh/functions/pure/prompt_pure_setup +++ b/zsh/functions/pure/prompt_pure_setup @@ -93,7 +93,7 @@ prompt_pure_setup() { [[ "$SSH_CONNECTION" != '' ]] && prompt_pure_username='%n@%m ' # prompt turns red if the previous command didn't exit with 0 - PROMPT='%(?.%F{magenta}.%F{red})❯%f ' + PROMPT='%(?.%F{cyan}.%F{red})❯%f ' } prompt_pure_setup "$@" -- cgit 1.4.1 From ec791b21441395aab300552142378ff87aa2579d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 20 Oct 2013 09:45:14 +0100 Subject: zsh: Fix pure pull indicator showing when ahead of upstream --- zsh/functions/pure/prompt_pure_setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/functions/pure/prompt_pure_setup b/zsh/functions/pure/prompt_pure_setup index a263e67d..dae1fbb6 100644 --- a/zsh/functions/pure/prompt_pure_setup +++ b/zsh/functions/pure/prompt_pure_setup @@ -66,7 +66,7 @@ prompt_pure_precmd() { command git fetch &>/dev/null && # check if there is an upstream configured for this branch command git rev-parse --abbrev-ref @'{u}' &>/dev/null && - (( $(command git rev-list --count HEAD...@'{u}' 2>/dev/null) > 0 )) && + (( $(command git rev-list --right-only --count HEAD...@'{u}' 2>/dev/null) > 0 )) && # some crazy ansi magic to inject the symbol into the previous line print -Pn "\e7\e[A\e[1G\e[`prompt_pure_string_length $prompt_pure_preprompt`C%F{cyan}⇣%f\e8" } &! -- cgit 1.4.1 From a9e7dbba3ee826f807546e8c94df2b17e5da6518 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 21 Oct 2013 07:55:55 +0100 Subject: Emacs: eagerly load dired and dired+ --- emacs/init.el | 2 -- 1 file changed, 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 2c475fb6..7704546b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -345,7 +345,6 @@ Values: `desktop', `server', `laptop'") ;;;; Directory browsing (use-package dired - :defer t :config (progn (bind-key "" #'dired-find-file dired-mode-map) (bind-key "^" (lambda () (interactive) (find-alternate-file "..")) dired-mode-map) @@ -356,7 +355,6 @@ Values: `desktop', `server', `laptop'") (put 'dired-find-alternate-file 'disabled nil))) (use-package dired+ - :defer t :ensure t :config (diredp-toggle-find-file-reuse-dir 1)) -- cgit 1.4.1 From 333c045fd15b0b06d76a905269a24fd8a54df7ef Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 21 Oct 2013 07:56:51 +0100 Subject: Emacs: load tramp on startup --- emacs/init.el | 1 - 1 file changed, 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 7704546b..e6b1b0e3 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -420,7 +420,6 @@ Values: `desktop', `server', `laptop'") (setq save-place-file (expand-file-name ".saveplace" user-emacs-directory)))) (use-package tramp - :defer t :config (progn (setq tramp-default-method (if (eq system-type 'windows-nt) "plinkx" "ssh") tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root") (nil nil "alan")) -- cgit 1.4.1 From ae9ebe7419131e020ad39b67dd595cd2d64eed27 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 21 Oct 2013 07:57:48 +0100 Subject: Emacs: load cc-mode on startup --- emacs/init.el | 1 - 1 file changed, 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index e6b1b0e3..c56c142a 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1060,7 +1060,6 @@ Also returns nil if pid is nil." :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) (use-package cc-mode - :defer t :init (progn (add-hook 'c-mode-common-hook #'electric-indent-mode)) :config (progn -- cgit 1.4.1 From 63df4b48d2e8017c98c9af35a8a8d31ff7cac78b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 22 Oct 2013 15:20:51 +0100 Subject: Emacs: use current frame when handling OSX open-file event --- emacs/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index c56c142a..174438a9 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1162,3 +1162,6 @@ Also returns nil if pid is nil." ("S-" . windmove-right) ("S-" . windmove-up) ("S-" . windmove-down))) + +(if (eq system-type 'darwin) + (setq ns-pop-up-frames nil)) -- cgit 1.4.1 From ac2ffde265b616d60a56b7b806fef85368bd3d25 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 31 Oct 2013 21:50:49 +0000 Subject: Emacs: run diff-hl-update when magit refreshes a buffer --- emacs/init.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 174438a9..6a4a121d 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -784,7 +784,9 @@ Also returns nil if pid is nil." (use-package diff-hl :ensure t - :init (global-diff-hl-mode)) + :init (progn + (global-diff-hl-mode) + (add-hook 'magit-refresh-file-buffer-hook #'diff-hl-update))) (use-package magit :commands (magit-status) -- cgit 1.4.1 From 6d996c60ff93d5c9ff01015e89b5932eb190eafc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 31 Oct 2013 21:50:15 +0000 Subject: zsh: Add zsh-completions to fpath --- zsh/zshrc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zsh/zshrc b/zsh/zshrc index 6fe27db7..c30c4635 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -30,6 +30,10 @@ fpath=( ~alan/projects/dotfiles/zsh/completion/ $fpath ) +if [[ -d /usr/local/share/zsh-completions ]] +then + fpath=(/usr/local/share/zsh-completions $fpath) +fi export PATH export PAGER="less" -- cgit 1.4.1 From 7d8493f63daf93beb4c82d0c9602fc21974daca7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Nov 2013 07:49:20 +0000 Subject: zsh: rename auxillary files with extension --- install | 8 ++++---- zsh/freebsd.zsh | 8 ++++++++ zsh/gentoo.zsh | 4 ++++ zsh/prefect.zsh | 10 ++++++++++ zsh/server.zsh | 20 ++++++++++++++++++++ zsh/sheldon.zsh | 5 +++++ zsh/st.zsh | 2 ++ zsh/zshrc_freebsd | 8 -------- zsh/zshrc_gentoo | 4 ---- zsh/zshrc_prefect | 10 ---------- zsh/zshrc_server | 20 -------------------- zsh/zshrc_sheldon | 5 ----- zsh/zshrc_st | 2 -- 13 files changed, 53 insertions(+), 53 deletions(-) create mode 100755 zsh/freebsd.zsh create mode 100644 zsh/gentoo.zsh create mode 100644 zsh/prefect.zsh create mode 100644 zsh/server.zsh create mode 100644 zsh/sheldon.zsh create mode 100644 zsh/st.zsh delete mode 100755 zsh/zshrc_freebsd delete mode 100644 zsh/zshrc_gentoo delete mode 100644 zsh/zshrc_prefect delete mode 100644 zsh/zshrc_server delete mode 100644 zsh/zshrc_sheldon delete mode 100644 zsh/zshrc_st diff --git a/install b/install index 13ee6cca..74cf8c43 100755 --- a/install +++ b/install @@ -51,14 +51,14 @@ zfiles=( $fasd_cache $target/zsh/zshrc ) -if [[ -f $target/zsh/zshrc_${HOST%%.*} ]]; then - zfiles+=$target/zsh/zshrc_${HOST%%.*} +if [[ -f $target/zsh/${HOST%%.*}.zsh ]]; then + zfiles+=$target/zsh/${HOST%%.*}.zsh fi if [[ -e /usr/bin/emerge ]]; then - zfiles+=$target/zsh/zshrc_gentoo + zfiles+=$target/zsh/gentoo.zsh fi if [[ $OSTYPE == freebsd* ]]; then - zfiles+=$target/zsh/zshrc_freebsd + zfiles+=$target/zsh/freebsd.zsh fi zrecompile -p -R ~/.zshrc.zwc $zfiles diff --git a/zsh/freebsd.zsh b/zsh/freebsd.zsh new file mode 100755 index 00000000..62612611 --- /dev/null +++ b/zsh/freebsd.zsh @@ -0,0 +1,8 @@ +#!/usr/bin/env zsh +function update-check () { + sudo portsnap update + sudo portmaster -L --index-only | awk '/ [Nn]ew / { print substr($0,9,9999) }' + sudo portaudit -Fa -X 1 + pkg_updating -d $( ls -ltr -D '%Y%m%d' /var/db/pkg | awk 'END{print $6}' ) +} +alias iotop="top -m io -o total" diff --git a/zsh/gentoo.zsh b/zsh/gentoo.zsh new file mode 100644 index 00000000..7af53466 --- /dev/null +++ b/zsh/gentoo.zsh @@ -0,0 +1,4 @@ +#Distributed merge +dmerge () { + MAKEOPTS='-j10' FEATURES='ccache distcc' emerge "$@" +} \ No newline at end of file diff --git a/zsh/prefect.zsh b/zsh/prefect.zsh new file mode 100644 index 00000000..997ba391 --- /dev/null +++ b/zsh/prefect.zsh @@ -0,0 +1,10 @@ +EDITOR="emacs" +VISUAL="emacs" + +if [[ ! -S $SSH_AUTH_SOCK ]] +then + eval `ssh-agent | sed -e '/^echo/d'` + linkAuthSock $SSH_AUTH_SOCK +fi + +export WINEARCH="win32" \ No newline at end of file diff --git a/zsh/server.zsh b/zsh/server.zsh new file mode 100644 index 00000000..d9d74219 --- /dev/null +++ b/zsh/server.zsh @@ -0,0 +1,20 @@ +# -*- shell-script -*- + +export SVDIR=/service +if [[ "$EUID" == "0" ]] || [[ "$USER" == "root" ]] +then + export EDITOR="emacs -nw" +else + export ALTERNATE_EDITOR="emacs" + export EDITOR="emacsclient" +fi + +mailpath= + +# Folder aliases +hash -d music=/tank/media/Music + +zstyle ':completion:*' local server /tank/www/internal '' +zstyle ':completion:*' local external /tank/www/external +zstyle ':completion:*' local alphapulsar.uk.to /tank/www/gaming +zstyle ':completion:*' local home.alanpearce.co.uk /tank/www/external diff --git a/zsh/sheldon.zsh b/zsh/sheldon.zsh new file mode 100644 index 00000000..6168baee --- /dev/null +++ b/zsh/sheldon.zsh @@ -0,0 +1,5 @@ +if [[ ! -S $SSH_AUTH_SOCK ]] +then + eval `ssh-agent | sed -e '/^echo/d'` + linkAuthSock $SSH_AUTH_SOCK +fi diff --git a/zsh/st.zsh b/zsh/st.zsh new file mode 100644 index 00000000..a449ef92 --- /dev/null +++ b/zsh/st.zsh @@ -0,0 +1,2 @@ +hash -d tf=/opt/steam/orangebox/tf +hash -d sv=/etc/sv/tf2 \ No newline at end of file diff --git a/zsh/zshrc_freebsd b/zsh/zshrc_freebsd deleted file mode 100755 index 62612611..00000000 --- a/zsh/zshrc_freebsd +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env zsh -function update-check () { - sudo portsnap update - sudo portmaster -L --index-only | awk '/ [Nn]ew / { print substr($0,9,9999) }' - sudo portaudit -Fa -X 1 - pkg_updating -d $( ls -ltr -D '%Y%m%d' /var/db/pkg | awk 'END{print $6}' ) -} -alias iotop="top -m io -o total" diff --git a/zsh/zshrc_gentoo b/zsh/zshrc_gentoo deleted file mode 100644 index 7af53466..00000000 --- a/zsh/zshrc_gentoo +++ /dev/null @@ -1,4 +0,0 @@ -#Distributed merge -dmerge () { - MAKEOPTS='-j10' FEATURES='ccache distcc' emerge "$@" -} \ No newline at end of file diff --git a/zsh/zshrc_prefect b/zsh/zshrc_prefect deleted file mode 100644 index 997ba391..00000000 --- a/zsh/zshrc_prefect +++ /dev/null @@ -1,10 +0,0 @@ -EDITOR="emacs" -VISUAL="emacs" - -if [[ ! -S $SSH_AUTH_SOCK ]] -then - eval `ssh-agent | sed -e '/^echo/d'` - linkAuthSock $SSH_AUTH_SOCK -fi - -export WINEARCH="win32" \ No newline at end of file diff --git a/zsh/zshrc_server b/zsh/zshrc_server deleted file mode 100644 index d9d74219..00000000 --- a/zsh/zshrc_server +++ /dev/null @@ -1,20 +0,0 @@ -# -*- shell-script -*- - -export SVDIR=/service -if [[ "$EUID" == "0" ]] || [[ "$USER" == "root" ]] -then - export EDITOR="emacs -nw" -else - export ALTERNATE_EDITOR="emacs" - export EDITOR="emacsclient" -fi - -mailpath= - -# Folder aliases -hash -d music=/tank/media/Music - -zstyle ':completion:*' local server /tank/www/internal '' -zstyle ':completion:*' local external /tank/www/external -zstyle ':completion:*' local alphapulsar.uk.to /tank/www/gaming -zstyle ':completion:*' local home.alanpearce.co.uk /tank/www/external diff --git a/zsh/zshrc_sheldon b/zsh/zshrc_sheldon deleted file mode 100644 index 6168baee..00000000 --- a/zsh/zshrc_sheldon +++ /dev/null @@ -1,5 +0,0 @@ -if [[ ! -S $SSH_AUTH_SOCK ]] -then - eval `ssh-agent | sed -e '/^echo/d'` - linkAuthSock $SSH_AUTH_SOCK -fi diff --git a/zsh/zshrc_st b/zsh/zshrc_st deleted file mode 100644 index a449ef92..00000000 --- a/zsh/zshrc_st +++ /dev/null @@ -1,2 +0,0 @@ -hash -d tf=/opt/steam/orangebox/tf -hash -d sv=/etc/sv/tf2 \ No newline at end of file -- cgit 1.4.1 From ee2a411d3eb0fd2025b24a9b48aa47c9269bf728 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Nov 2013 08:06:50 +0000 Subject: zsh: Recompile compdump file in dotfiles installer --- install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install b/install index 74cf8c43..d78200fd 100755 --- a/install +++ b/install @@ -61,7 +61,8 @@ if [[ $OSTYPE == freebsd* ]]; then zfiles+=$target/zsh/freebsd.zsh fi -zrecompile -p -R ~/.zshrc.zwc $zfiles +zrecompile -p -R ~/.zshrc.zwc $zfiles -- \ + -M .zsh/cache/compdump for fp in $target/zsh/functions/*(/); do zrecompile -p $fp $fp/* -- cgit 1.4.1 From f1a0100b3beca48b17601156da733d69027a0c4d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Nov 2013 18:05:59 +0000 Subject: zsh: Remove check for cache directory; it's created by the installer --- zsh/zshrc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/zsh/zshrc b/zsh/zshrc index c30c4635..be73b30a 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -19,11 +19,6 @@ then fi fi -if [[ ! -d ~/.zsh/cache ]] -then - mkdir -p ~/.zsh/cache -fi - myfuncs=( ~alan/projects/dotfiles/zsh/functions/*(/) ) fpath=( $myfuncs -- cgit 1.4.1 From 3f38a0e5aa2dc0f22491cde5f2432275f811ed90 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Nov 2013 18:13:27 +0000 Subject: zsh: Remove title-changing precmd function --- zsh/zshrc | 8 -------- 1 file changed, 8 deletions(-) diff --git a/zsh/zshrc b/zsh/zshrc index be73b30a..a08cee03 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -326,14 +326,6 @@ fi # Functions -precmd () { - [[ -t 1 ]] || return - case $TERM in - *xterm*|rxvt|putty|(dt|k|E)term|screen*) print -Pn "\e]2;%~\a" - ;; - esac -} - pid () { local i for i in /proc/<->/stat -- cgit 1.4.1 From fe9f97e2738ba591b8fc2d70f59067d5bd152fe3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Nov 2013 18:17:31 +0000 Subject: zsh: Refactor magit and dired into functions --- zsh/zshrc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/zsh/zshrc b/zsh/zshrc index a08cee03..28356be5 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -312,8 +312,6 @@ alias wprop='xprop |awk '\'' /^WM_WINDOW_ROLE/{sub(/.* =/, "role:"); print}'\''' alias et="emacsclient -t" -alias magit='ec -e "(magit-status \"$PWD\")"' -alias dired='ec -e "(dired \"$PWD\")"' alias -g ...='../..' @@ -326,6 +324,14 @@ fi # Functions +magit () { + emacsclient -e "(magit-status \"$PWD\")" +} + +dired () { + emacsclient -e "(dired \"$PWD\")" +} + pid () { local i for i in /proc/<->/stat -- cgit 1.4.1 From 604b55aac4676abb5be423b56c3964d9b4967119 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Nov 2013 18:23:22 +0000 Subject: Emacs: Add a margin to ensure the next/previous line is always visible --- emacs/init.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 6a4a121d..bb701b58 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1009,7 +1009,7 @@ Also returns nil if pid is nil." :config (use-package quack)) (use-package slime - :commands (slime) + :commands (slime) :config (progn (let ((ql-slime-helper (expand-file-name "~/quicklisp/slime-helper.el"))) (if (file-exists-p ql-slime-helper) @@ -1065,7 +1065,7 @@ Also returns nil if pid is nil." :init (progn (add-hook 'c-mode-common-hook #'electric-indent-mode)) :config (progn - (setq c-default-style '((java-mode . "java") + (setq c-default-style '((java-mode . "java") (awk-mode . "awk") (other . "k&r")) c-basic-offset 4) @@ -1148,6 +1148,7 @@ Also returns nil if pid is nil." "%b")))) (setq scroll-conservatively 100 ; Keep the cursor position when scrolling + scroll-margin 1 scroll-preserve-screen-position nil) (when menu-bar-mode -- cgit 1.4.1 From 2bba1f9db56179f50a1c8b026353b057b5772bd0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Nov 2013 18:24:52 +0000 Subject: Emacs: Improve mouse/trackpad scrolling by only scrolling one line at a time --- emacs/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index bb701b58..a254dd86 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1149,7 +1149,8 @@ Also returns nil if pid is nil." (setq scroll-conservatively 100 ; Keep the cursor position when scrolling scroll-margin 1 - scroll-preserve-screen-position nil) + scroll-preserve-screen-position nil + mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control)))) (when menu-bar-mode (menu-bar-mode -1)) -- cgit 1.4.1 From e6902435ee1abeb474960dcd49ee395116f5c2d8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 2 Nov 2013 14:22:54 +0000 Subject: zsh: Remove file for gentoo --- zsh/gentoo.zsh | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 zsh/gentoo.zsh diff --git a/zsh/gentoo.zsh b/zsh/gentoo.zsh deleted file mode 100644 index 7af53466..00000000 --- a/zsh/gentoo.zsh +++ /dev/null @@ -1,4 +0,0 @@ -#Distributed merge -dmerge () { - MAKEOPTS='-j10' FEATURES='ccache distcc' emerge "$@" -} \ No newline at end of file -- cgit 1.4.1 From 66c2254349db463d91d6335dfe4a25ac1329515c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 2 Nov 2013 14:23:42 +0000 Subject: zsh: Remove file for old work laptop --- zsh/sheldon.zsh | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 zsh/sheldon.zsh diff --git a/zsh/sheldon.zsh b/zsh/sheldon.zsh deleted file mode 100644 index 6168baee..00000000 --- a/zsh/sheldon.zsh +++ /dev/null @@ -1,5 +0,0 @@ -if [[ ! -S $SSH_AUTH_SOCK ]] -then - eval `ssh-agent | sed -e '/^echo/d'` - linkAuthSock $SSH_AUTH_SOCK -fi -- cgit 1.4.1 From ccc0aad757be54208e0cb90131ab5851ce2d30b8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 2 Nov 2013 14:24:26 +0000 Subject: zsh: Remove unused file --- zsh/st.zsh | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 zsh/st.zsh diff --git a/zsh/st.zsh b/zsh/st.zsh deleted file mode 100644 index a449ef92..00000000 --- a/zsh/st.zsh +++ /dev/null @@ -1,2 +0,0 @@ -hash -d tf=/opt/steam/orangebox/tf -hash -d sv=/etc/sv/tf2 \ No newline at end of file -- cgit 1.4.1 From 1fbe0bfe24f527974285342a9cf80d245b469bc9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 2 Nov 2013 15:15:28 +0000 Subject: zsh: Remove reference to gentoo configuration from installer --- install | 3 --- 1 file changed, 3 deletions(-) diff --git a/install b/install index d78200fd..4923193f 100755 --- a/install +++ b/install @@ -54,9 +54,6 @@ zfiles=( if [[ -f $target/zsh/${HOST%%.*}.zsh ]]; then zfiles+=$target/zsh/${HOST%%.*}.zsh fi -if [[ -e /usr/bin/emerge ]]; then - zfiles+=$target/zsh/gentoo.zsh -fi if [[ $OSTYPE == freebsd* ]]; then zfiles+=$target/zsh/freebsd.zsh fi -- cgit 1.4.1 From 78a76cff334aba875f54fdb5582276e4a9f66807 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 2 Nov 2013 16:01:06 +0000 Subject: zsh: Separate startup files for different startup methods --- install | 8 +- zsh/environment.zsh | 43 ++++++ zsh/interactive.zsh | 360 ++++++++++++++++++++++++++++++++++++++++++++++ zsh/login.zsh | 0 zsh/logout.zsh | 0 zsh/zshrc | 404 ---------------------------------------------------- 6 files changed, 410 insertions(+), 405 deletions(-) create mode 100755 zsh/environment.zsh create mode 100755 zsh/interactive.zsh create mode 100755 zsh/login.zsh create mode 100755 zsh/logout.zsh delete mode 100755 zsh/zshrc diff --git a/install b/install index 4923193f..44581a1f 100755 --- a/install +++ b/install @@ -22,8 +22,14 @@ install-dot () { install-dot $target/.git/hooks/ $target/git-hooks/* install-dot .emacs.d/ $target/emacs/{init.el{,c},elisp} -install-dot . $target/^install(.) $target/zsh/zshrc $target/zsh/fasdrc +install-dot . $target/^install(.) $target/zsh/fasdrc install-dot .ssh/ $target/ssh/* + +ln -sf $target/zsh/environment.zsh .zshenv +ln -sf $target/zsh/interactive.zsh .zshrc +ln -sf $target/zsh/login.zsh .zlogin +ln -sf $target/zsh/logout.zsh .zlogout + if [[ -d projects/dwm ]] then install-dot projects/dwm/ $target/dwm/* diff --git a/zsh/environment.zsh b/zsh/environment.zsh new file mode 100755 index 00000000..080e2344 --- /dev/null +++ b/zsh/environment.zsh @@ -0,0 +1,43 @@ +if [[ $defpath == "" && -d ~/bin ]] +then + defpath=($path) + path=( + $defpath + ~/bin + ) + if [[ -d ~/.gem/ruby/*/bin ]] + then + path=( + $path + ~/.gem/ruby/*/bin + ) + fi +fi + +export PATH + +myfuncs=( ~alan/projects/dotfiles/zsh/functions/*(/) ) +fpath=( + $myfuncs + ~alan/projects/dotfiles/zsh/completion/ + $fpath +) +if [[ -d /usr/local/share/zsh-completions ]] +then + fpath=(/usr/local/share/zsh-completions $fpath) +fi + +export FPATH + +case $OSTYPE in + *gnu*) + os=gnu + ;; + freebsd*) + os=freebsd + ;; + darwin*) + os=osx +esac + +export os diff --git a/zsh/interactive.zsh b/zsh/interactive.zsh new file mode 100755 index 00000000..800d97d2 --- /dev/null +++ b/zsh/interactive.zsh @@ -0,0 +1,360 @@ +export PAGER="less" +export EDITOR="emacsclient" +export CLICOLOR=true + +# +# zsh variables +# +HISTFILE=~/.zsh/history +HISTSIZE=4000 +SAVEHIST=3000 + +WORDCHARS='*?_-[]~=.&;!#$%^(){}<>' + +#If a command takes more than 5 seconds, give statistics +REPORTTIME=5 +TIMEFMT="%U user %S system %P cpu %*Es total" + +#Check for user logins +watch=notme +WATCHFMT="%n has %a %l from %M at %t" + +hosts=( + server + prefect + alanpearce.co.uk + home.alanpearce.co.uk + lethalrocks.uk.to + alphapulsar.uk.to + st.alphapulsar.uk.to + a.st.alphapulsar.uk.to + st +) + +users=(alan root toor) + +function linkAuthSock () { + local linkSock=~/.ssh/ssh_auth_sock + ln -sf $1 ~/.ssh/ssh_auth_sock + export SSH_AUTH_SOCK=$linkSock +} + +if [[ "$SSH_AUTH_SOCK" != "" ]] +then + if [[ -e ~/.ssh/ssh_auth_sock && ! -L ~/.ssh/ssh_auth_sock ]] + then + linkAuthSock $SSH_AUTH_SOCK + fi +fi + +LS_COLORS='no=00:fi=00:di=36:ln=35:pi=30;44:so=35;44:do=35;44:bd=33;44:cd=37;44:or=05;37;41:mi=05;37;41:ex=01;31:*.cmd=01;31:*.exe=01;31:*.com=01;31:*.bat=01;31:*.reg=01;31:*.app=01;31:*.txt=32:*.org=32:*.md=32:*.mkd=32:*.h=32:*.c=32:*.C=32:*.cc=32:*.cpp=32:*.cxx=32:*.objc=32:*.sh=32:*.csh=32:*.zsh=32:*.el=32:*.vim=32:*.java=32:*.pl=32:*.pm=32:*.py=32:*.rb=32:*.hs=32:*.php=32:*.htm=32:*.html=32:*.shtml=32:*.erb=32:*.haml=32:*.xml=32:*.rdf=32:*.css=32:*.sass=32:*.scss=32:*.less=32:*.js=32:*.coffee=32:*.man=32:*.0=32:*.1=32:*.2=32:*.3=32:*.4=32:*.5=32:*.6=32:*.7=32:*.8=32:*.9=32:*.l=32:*.n=32:*.p=32:*.pod=32:*.tex=32:*.bmp=33:*.cgm=33:*.dl=33:*.dvi=33:*.emf=33:*.eps=33:*.gif=33:*.jpeg=33:*.jpg=33:*.JPG=33:*.mng=33:*.pbm=33:*.pcx=33:*.pdf=33:*.pgm=33:*.png=33:*.ppm=33:*.pps=33:*.ppsx=33:*.ps=33:*.svg=33:*.svgz=33:*.tga=33:*.tif=33:*.tiff=33:*.xbm=33:*.xcf=33:*.xpm=33:*.xwd=33:*.xwd=33:*.yuv=33:*.aac=33:*.au=33:*.flac=33:*.mid=33:*.midi=33:*.mka=33:*.mp3=33:*.mpa=33:*.mpeg=33:*.mpg=33:*.ogg=33:*.ra=33:*.wav=33:*.anx=33:*.asf=33:*.avi=33:*.axv=33:*.flc=33:*.fli=33:*.flv=33:*.gl=33:*.m2v=33:*.m4v=33:*.mkv=33:*.mov=33:*.mp4=33:*.mp4v=33:*.mpeg=33:*.mpg=33:*.nuv=33:*.ogm=33:*.ogv=33:*.ogx=33:*.qt=33:*.rm=33:*.rmvb=33:*.swf=33:*.vob=33:*.wmv=33:*.doc=31:*.docx=31:*.rtf=31:*.dot=31:*.dotx=31:*.xls=31:*.xlsx=31:*.ppt=31:*.pptx=31:*.fla=31:*.psd=31:*.7z=1;35:*.apk=1;35:*.arj=1;35:*.bin=1;35:*.bz=1;35:*.bz2=1;35:*.cab=1;35:*.deb=1;35:*.dmg=1;35:*.gem=1;35:*.gz=1;35:*.iso=1;35:*.jar=1;35:*.msi=1;35:*.rar=1;35:*.rpm=1;35:*.tar=1;35:*.tbz=1;35:*.tbz2=1;35:*.tgz=1;35:*.tx=1;35:*.war=1;35:*.xpi=1;35:*.xz=1;35:*.z=1;35:*.Z=1;35:*.zip=1;35:*.ANSI-30-black=30:*.ANSI-01;30-brblack=01;30:*.ANSI-31-red=31:*.ANSI-01;31-brred=01;31:*.ANSI-32-green=32:*.ANSI-01;32-brgreen=01;32:*.ANSI-33-yellow=33:*.ANSI-01;33-bryellow=01;33:*.ANSI-34-blue=34:*.ANSI-01;34-brblue=01;34:*.ANSI-35-magenta=35:*.ANSI-01;35-brmagenta=01;35:*.ANSI-36-cyan=36:*.ANSI-01;36-brcyan=01;36:*.ANSI-37-white=37:*.ANSI-01;37-brwhite=01;37:*.log=01;34:*~=01;34:*#=01;34:*.bak=01;36:*.BAK=01;36:*.old=01;36:*.OLD=01;36:*.org_archive=01;36:*.off=01;36:*.OFF=01;36:*.dist=01;36:*.DIST=01;36:*.orig=01;36:*.ORIG=01;36:*.swp=01;36:*.swo=01;36:*,v=01;36:*.gpg=34:*.gpg=34:*.pgp=34:*.asc=34:*.3des=34:*.aes=34:*.enc=34:' + +#Ignore suffixes in completion +fignore=( + svbin +) + +# +# Modules +# +autoload -Uz compinit bashcompinit +autoload -U colors complist zrecompile zmv zargs zed +autoload -Uz vcs_info +autoload insert-files +zle -N insert-files +zmodload -i zsh/complist +colors +compinit -u -d .zsh/cache/compdump +bashcompinit + +zstyle :compinstall filename '/home/alan/.zshrc' + +autoload -Uz _tmux_pane_words +zle -C tmux-pane-words-prefix complete-word _generic +zle -C tmux-pane-words-anywhere complete-word _generic +zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' completer _tmux_pane_words +zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' ignore-line current +zstyle ':completion:tmux-pane-words-anywhere:*' matcher-list 'b:=* m:{A-Za-z}={a-zA-Z}' + +# Speed up completion by not going further than a full match +zstyle ':completion:*' accept-exact '*(N)' + +zstyle ':completion:*:default' use-cache on +zstyle ':completion:*:default' cache-path ~/.zsh/cache/compcache + +zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' '+m:{A-Z}={a-z}' +zstyle ':completion:*' completer _oldlist _expand _force_rehash _complete _match + +zstyle ':completion:*' verbose yes +zstyle ':completion:*:messages' format '%d' +zstyle ':completion:*:warnings' format 'No matches for: %d' +zstyle ':completion:*:descriptions' format '%U%B%d%b%u' +zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b' +zstyle ':completion:*' group-name '' + +# Complete all user processes +zstyle ':completion:*:processes' command 'ps -au$USER' +# Add colour to process lists +zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' +zstyle ':completion:*:*:kill:*' menu yes select +zstyle ':completion:*:kill:*' force-list always +zstyle ':completion:*:*:killall:*' menu yes select +zstyle ':completion:*:killall:*' force-list always + +# Complete unreadable log filenames +#zstyle ':completion::complete:(most|tail)::' fake-files '/var/log/*:current' + +# Group manpages by section +zstyle ':completion:*' separate-sections true + +# Users +#zstyle '*' users $users + +zstyle '*' hosts $hosts + +zstyle ':completion:*:functions' ignored-patterns '_*' +zstyle ':completion:*:cd:*' ignore-parents parent pwd + +#This works, but isn't the same as ls +#zstyle ':completion:*:default' list-colors '' +zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} + +zstyle ':vcs_info:*' enable git hg + +# Filename suffixes to ignore during completion (except after rm command) +zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' '*?.old' '*?.pro' + +## Prompt +if [[ $TERM != 'dumb' ]] +then + autoload -U promptinit + promptinit + prompt pure +fi + +# Options + +# Changing directories +setopt auto_cd + +# Completion +setopt auto_list # List multiple choices on first tab +unsetopt list_ambiguous # List ambiguous choices rather than completing common prefixes +unsetopt list_beep # Don't try to beep here +setopt list_types # Indicate file types + +# Expansion and globbing +setopt extended_glob # Use #~^ as part of filename patterns +unsetopt nomatch + +# History +unsetopt hist_beep +setopt hist_expire_dups_first +setopt hist_fcntl_lock # Use standard locking on histfile +setopt hist_find_no_dups +setopt hist_ignore_space +setopt hist_reduce_blanks +setopt hist_verify +setopt inc_append_history + +# Input/Output +unsetopt clobber +unsetopt flow_control +setopt path_dirs # Search PATH even with slashes +setopt print_exit_value + +# Job Control +setopt auto_continue +unsetopt nohup +setopt long_list_jobs +unsetopt notify + +# Scripts and functions +unsetopt multi_func_def +setopt multios + +# Zle +unsetopt beep + +############ +# Keybinds # +############ +#KiTTY +bindkey "OD" backward-word +bindkey "OC" forward-word + +#General +bindkey "[1~" beginning-of-line +bindkey "[4~" end-of-line +bindkey "[5~" beginning-of-history +bindkey "[6~" end-of-history +bindkey "[2~" quoted-insert +bindkey "[3~" delete-char + +bindkey '' backward-delete-char + +bindkey '^I' expand-or-complete-prefix +bindkey '' reverse-menu-complete +bindkey '' up-line-or-search +bindkey '' down-line-or-search + +#urxvt +bindkey '[3;5~' delete-word +bindkey '' backward-word +bindkey '' forward-word + +bindkey 'f' insert-files +bindkey 'd' describe-key-briefly + +bindkey '\' tmux-pane-words-prefix +bindkey '|' tmux-pane-words-anywhere + +# Aliases before functions +alias getcflags='gcc -\#\#\# -march=native -E /usr/include/stdlib.h 2>&1 | grep "/usr/libexec/gcc/.*cc1"' +alias grep='grep --color=auto' +alias df='df -h' +alias du='du -h' +alias md='mkdir -p' +alias rd='rmdir' +alias .='source' + +ls='\ls' +gnu_ls_options="-v --group-directories-first --color=auto" +gnu_ls_isodate="--time-style=long-iso" +bsd_ls_options="-p" +bsd_ls_isodate="-D '%F %k:%M'" + +case $os in + osx) + 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 + ;; + gnu) + ls_options=$gnu_ls_options + ls_isodate=$gnu_ls_isodate + ;; +esac +alias l="${ls} ${ls_options} -Bp" +alias l1="${ls} ${ls_options} -1" +alias ls="${ls} ${ls_options} -hF" +alias la="${ls} ${ls_options} -hA" +alias ll="${ls} ${ls_options} ${ls_isodate} -hl" +alias lal="ll -A" +alias lla="lal" +alias llr="ll -t" +alias gpp='g++' +alias lsr="${ls} -tld *(m-2)" # mtime < -2days + +alias salt="noglob salt" +alias pping="prettyping.sh" +alias trans="transmission-remote transmission.home" +alias bitcoin="bitcoind" +alias su="smart_sudo " +alias E="SUDO_EDITOR=\emacsclient -c -a emacs\" sudoedit" +alias wprop='xprop |awk '\'' + /^WM_CLASS/{sub(/.* =/, "instance:"); sub(/,/, "\nclass:"); print} + /^WM_NAME/{sub(/.* =/, "title:"); print} + /^WM_WINDOW_ROLE/{sub(/.* =/, "role:"); print}'\''' + +alias et="emacsclient -t" + +alias -g ...='../..' + +#Suffix aliases +alias -s log=less + +if [[ -e =hub ]]; then + alias git="hub" +fi + +# Functions + +magit () { + emacsclient -e "(magit-status \"$PWD\")" +} + +dired () { + emacsclient -e "(dired \"$PWD\")" +} + +pid () { + local i + for i in /proc/<->/stat + [[ "$(< $i)" = *\((${(j:|:)~@})\)* ]] && echo $i:h:t + return 0 +} + +_force_rehash() { + (( CURRENT == 1 )) && rehash + return 1 # Because we didn't really complete anything +} + +portgrep() { + sudo lsof -i :$1 -nP | egrep '(LISTEN|UDP|COMMAND)' +} + +ipgrep() { + sudo lsof -i @$1 -nP +} + +smart_sudo () { + if [[ -n $1 ]]; then + \sudo $argv + else + #if no parameters were given, then assume we want a root shell + \sudo -i -u toor + fi +} + +compdef _sudo smart_sudo + +smart_compile () { + local zcompargs + if [[ $1 = *zshrc* ]]; then + zcompargs="-R" + fi + + if [[ $EUID -ne 0 || $1 != *alan* ]]; then + zrecompile -q -p $zcompargs $1 + fi + if [[ -n $2 ]]; then + . $1 + fi +} + +emacs_change_focus () { + emacsclient -n -e "(select-frame-set-input-focus (selected-frame))" > /dev/null +} + +ec () { + local visibleFrames + visibleFrames=`emacsclient -e '(length (visible-frame-list))'` + if [[ $? -ne 0 ]]; then + print "Daemon not running" + return 1 + fi + + if [[ $visibleFrames -eq 1 ]]; then + emacsclient -n -c "$@" && emacs_change_focus + else + emacs_change_focus + if [[ $# -gt 0 ]]; then + emacsclient -n "$@" + fi + fi +} + +_FASD_DATA="$HOME/.zsh/fasd-data" +autoload -U fasd +source ~/.zsh/cache/fasd-init-zsh diff --git a/zsh/login.zsh b/zsh/login.zsh new file mode 100755 index 00000000..e69de29b diff --git a/zsh/logout.zsh b/zsh/logout.zsh new file mode 100755 index 00000000..e69de29b diff --git a/zsh/zshrc b/zsh/zshrc deleted file mode 100755 index 28356be5..00000000 --- a/zsh/zshrc +++ /dev/null @@ -1,404 +0,0 @@ -#!/usr/bin/env zsh -# -# System variables -# - -if [[ $defpath == "" && -d ~/bin ]] -then - defpath=($path) - path=( - $defpath - ~/bin - ) - if [[ -d ~/.gem/ruby/*/bin ]] - then - path=( - $path - ~/.gem/ruby/*/bin - ) - fi -fi - -myfuncs=( ~alan/projects/dotfiles/zsh/functions/*(/) ) -fpath=( - $myfuncs - ~alan/projects/dotfiles/zsh/completion/ - $fpath -) -if [[ -d /usr/local/share/zsh-completions ]] -then - fpath=(/usr/local/share/zsh-completions $fpath) -fi - -export PATH -export PAGER="less" -export EDITOR="emacsclient" -export CLICOLOR=true - -# -# zsh variables -# -HISTFILE=~/.zsh/history -HISTSIZE=4000 -SAVEHIST=3000 - -WORDCHARS='*?_-[]~=.&;!#$%^(){}<>' - -#If a command takes more than 5 seconds, give statistics -REPORTTIME=5 -TIMEFMT="%U user %S system %P cpu %*Es total" - -#Check for user logins -watch=notme -WATCHFMT="%n has %a %l from %M at %t" - -hosts=( - server - prefect - alanpearce.co.uk - home.alanpearce.co.uk - lethalrocks.uk.to - alphapulsar.uk.to - st.alphapulsar.uk.to - a.st.alphapulsar.uk.to - st -) - -users=(alan root toor) - -function linkAuthSock () { - local linkSock=~/.ssh/ssh_auth_sock - ln -sf $1 ~/.ssh/ssh_auth_sock - export SSH_AUTH_SOCK=$linkSock -} - -if [[ "$SSH_AUTH_SOCK" != "" ]] -then - if [[ -e ~/.ssh/ssh_auth_sock && ! -L ~/.ssh/ssh_auth_sock ]] - then - linkAuthSock $SSH_AUTH_SOCK - fi -fi - -case $OSTYPE in - *gnu*) - os=gnu - ;; - freebsd*) - os=freebsd - ;; - darwin*) - os=osx -esac - -LS_COLORS='no=00:fi=00:di=36:ln=35:pi=30;44:so=35;44:do=35;44:bd=33;44:cd=37;44:or=05;37;41:mi=05;37;41:ex=01;31:*.cmd=01;31:*.exe=01;31:*.com=01;31:*.bat=01;31:*.reg=01;31:*.app=01;31:*.txt=32:*.org=32:*.md=32:*.mkd=32:*.h=32:*.c=32:*.C=32:*.cc=32:*.cpp=32:*.cxx=32:*.objc=32:*.sh=32:*.csh=32:*.zsh=32:*.el=32:*.vim=32:*.java=32:*.pl=32:*.pm=32:*.py=32:*.rb=32:*.hs=32:*.php=32:*.htm=32:*.html=32:*.shtml=32:*.erb=32:*.haml=32:*.xml=32:*.rdf=32:*.css=32:*.sass=32:*.scss=32:*.less=32:*.js=32:*.coffee=32:*.man=32:*.0=32:*.1=32:*.2=32:*.3=32:*.4=32:*.5=32:*.6=32:*.7=32:*.8=32:*.9=32:*.l=32:*.n=32:*.p=32:*.pod=32:*.tex=32:*.bmp=33:*.cgm=33:*.dl=33:*.dvi=33:*.emf=33:*.eps=33:*.gif=33:*.jpeg=33:*.jpg=33:*.JPG=33:*.mng=33:*.pbm=33:*.pcx=33:*.pdf=33:*.pgm=33:*.png=33:*.ppm=33:*.pps=33:*.ppsx=33:*.ps=33:*.svg=33:*.svgz=33:*.tga=33:*.tif=33:*.tiff=33:*.xbm=33:*.xcf=33:*.xpm=33:*.xwd=33:*.xwd=33:*.yuv=33:*.aac=33:*.au=33:*.flac=33:*.mid=33:*.midi=33:*.mka=33:*.mp3=33:*.mpa=33:*.mpeg=33:*.mpg=33:*.ogg=33:*.ra=33:*.wav=33:*.anx=33:*.asf=33:*.avi=33:*.axv=33:*.flc=33:*.fli=33:*.flv=33:*.gl=33:*.m2v=33:*.m4v=33:*.mkv=33:*.mov=33:*.mp4=33:*.mp4v=33:*.mpeg=33:*.mpg=33:*.nuv=33:*.ogm=33:*.ogv=33:*.ogx=33:*.qt=33:*.rm=33:*.rmvb=33:*.swf=33:*.vob=33:*.wmv=33:*.doc=31:*.docx=31:*.rtf=31:*.dot=31:*.dotx=31:*.xls=31:*.xlsx=31:*.ppt=31:*.pptx=31:*.fla=31:*.psd=31:*.7z=1;35:*.apk=1;35:*.arj=1;35:*.bin=1;35:*.bz=1;35:*.bz2=1;35:*.cab=1;35:*.deb=1;35:*.dmg=1;35:*.gem=1;35:*.gz=1;35:*.iso=1;35:*.jar=1;35:*.msi=1;35:*.rar=1;35:*.rpm=1;35:*.tar=1;35:*.tbz=1;35:*.tbz2=1;35:*.tgz=1;35:*.tx=1;35:*.war=1;35:*.xpi=1;35:*.xz=1;35:*.z=1;35:*.Z=1;35:*.zip=1;35:*.ANSI-30-black=30:*.ANSI-01;30-brblack=01;30:*.ANSI-31-red=31:*.ANSI-01;31-brred=01;31:*.ANSI-32-green=32:*.ANSI-01;32-brgreen=01;32:*.ANSI-33-yellow=33:*.ANSI-01;33-bryellow=01;33:*.ANSI-34-blue=34:*.ANSI-01;34-brblue=01;34:*.ANSI-35-magenta=35:*.ANSI-01;35-brmagenta=01;35:*.ANSI-36-cyan=36:*.ANSI-01;36-brcyan=01;36:*.ANSI-37-white=37:*.ANSI-01;37-brwhite=01;37:*.log=01;34:*~=01;34:*#=01;34:*.bak=01;36:*.BAK=01;36:*.old=01;36:*.OLD=01;36:*.org_archive=01;36:*.off=01;36:*.OFF=01;36:*.dist=01;36:*.DIST=01;36:*.orig=01;36:*.ORIG=01;36:*.swp=01;36:*.swo=01;36:*,v=01;36:*.gpg=34:*.gpg=34:*.pgp=34:*.asc=34:*.3des=34:*.aes=34:*.enc=34:' - -#Ignore suffixes in completion -fignore=( - svbin -) - -# -# Modules -# -autoload -Uz compinit bashcompinit -autoload -U colors complist zrecompile zmv zargs zed -autoload -Uz vcs_info -autoload insert-files -zle -N insert-files -zmodload -i zsh/complist -colors -compinit -u -d .zsh/cache/compdump -bashcompinit - -zstyle :compinstall filename '/home/alan/.zshrc' - -autoload -Uz _tmux_pane_words -zle -C tmux-pane-words-prefix complete-word _generic -zle -C tmux-pane-words-anywhere complete-word _generic -zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' completer _tmux_pane_words -zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' ignore-line current -zstyle ':completion:tmux-pane-words-anywhere:*' matcher-list 'b:=* m:{A-Za-z}={a-zA-Z}' - -# Speed up completion by not going further than a full match -zstyle ':completion:*' accept-exact '*(N)' - -zstyle ':completion:*:default' use-cache on -zstyle ':completion:*:default' cache-path ~/.zsh/cache/compcache - -zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' '+m:{A-Z}={a-z}' -zstyle ':completion:*' completer _oldlist _expand _force_rehash _complete _match - -zstyle ':completion:*' verbose yes -zstyle ':completion:*:messages' format '%d' -zstyle ':completion:*:warnings' format 'No matches for: %d' -zstyle ':completion:*:descriptions' format '%U%B%d%b%u' -zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b' -zstyle ':completion:*' group-name '' - -# Complete all user processes -zstyle ':completion:*:processes' command 'ps -au$USER' -# Add colour to process lists -zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' -zstyle ':completion:*:*:kill:*' menu yes select -zstyle ':completion:*:kill:*' force-list always -zstyle ':completion:*:*:killall:*' menu yes select -zstyle ':completion:*:killall:*' force-list always - -# Complete unreadable log filenames -#zstyle ':completion::complete:(most|tail)::' fake-files '/var/log/*:current' - -# Group manpages by section -zstyle ':completion:*' separate-sections true - -# Users -#zstyle '*' users $users - -zstyle '*' hosts $hosts - -zstyle ':completion:*:functions' ignored-patterns '_*' -zstyle ':completion:*:cd:*' ignore-parents parent pwd - -#This works, but isn't the same as ls -#zstyle ':completion:*:default' list-colors '' -zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} - -zstyle ':vcs_info:*' enable git hg - -# Filename suffixes to ignore during completion (except after rm command) -zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' '*?.old' '*?.pro' - -## Prompt -if [[ $TERM != 'dumb' ]] -then - autoload -U promptinit - promptinit - prompt pure -fi - -# Options - -# Changing directories -setopt auto_cd - -# Completion -setopt auto_list # List multiple choices on first tab -unsetopt list_ambiguous # List ambiguous choices rather than completing common prefixes -unsetopt list_beep # Don't try to beep here -setopt list_types # Indicate file types - -# Expansion and globbing -setopt extended_glob # Use #~^ as part of filename patterns -unsetopt nomatch - -# History -unsetopt hist_beep -setopt hist_expire_dups_first -setopt hist_fcntl_lock # Use standard locking on histfile -setopt hist_find_no_dups -setopt hist_ignore_space -setopt hist_reduce_blanks -setopt hist_verify -setopt inc_append_history - -# Input/Output -unsetopt clobber -unsetopt flow_control -setopt path_dirs # Search PATH even with slashes -setopt print_exit_value - -# Job Control -setopt auto_continue -unsetopt nohup -setopt long_list_jobs -unsetopt notify - -# Scripts and functions -unsetopt multi_func_def -setopt multios - -# Zle -unsetopt beep - -############ -# Keybinds # -############ -#KiTTY -bindkey "OD" backward-word -bindkey "OC" forward-word - -#General -bindkey "[1~" beginning-of-line -bindkey "[4~" end-of-line -bindkey "[5~" beginning-of-history -bindkey "[6~" end-of-history -bindkey "[2~" quoted-insert -bindkey "[3~" delete-char - -bindkey '' backward-delete-char - -bindkey '^I' expand-or-complete-prefix -bindkey '' reverse-menu-complete -bindkey '' up-line-or-search -bindkey '' down-line-or-search - -#urxvt -bindkey '[3;5~' delete-word -bindkey '' backward-word -bindkey '' forward-word - -bindkey 'f' insert-files -bindkey 'd' describe-key-briefly - -bindkey '\' tmux-pane-words-prefix -bindkey '|' tmux-pane-words-anywhere - -# Aliases before functions -alias getcflags='gcc -\#\#\# -march=native -E /usr/include/stdlib.h 2>&1 | grep "/usr/libexec/gcc/.*cc1"' -alias grep='grep --color=auto' -alias df='df -h' -alias du='du -h' -alias md='mkdir -p' -alias rd='rmdir' -alias .='source' - -ls='\ls' -gnu_ls_options="-v --group-directories-first --color=auto" -gnu_ls_isodate="--time-style=long-iso" -bsd_ls_options="-p" -bsd_ls_isodate="-D '%F %k:%M'" - -case $os in - osx) - 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 - ;; - gnu) - ls_options=$gnu_ls_options - ls_isodate=$gnu_ls_isodate - ;; -esac -alias l="${ls} ${ls_options} -Bp" -alias l1="${ls} ${ls_options} -1" -alias ls="${ls} ${ls_options} -hF" -alias la="${ls} ${ls_options} -hA" -alias ll="${ls} ${ls_options} ${ls_isodate} -hl" -alias lal="ll -A" -alias lla="lal" -alias llr="ll -t" -alias gpp='g++' -alias lsr="${ls} -tld *(m-2)" # mtime < -2days - -alias salt="noglob salt" -alias pping="prettyping.sh" -alias trans="transmission-remote transmission.home" -alias bitcoin="bitcoind" -alias su="smart_sudo " -alias E="SUDO_EDITOR=\emacsclient -c -a emacs\" sudoedit" -alias wprop='xprop |awk '\'' - /^WM_CLASS/{sub(/.* =/, "instance:"); sub(/,/, "\nclass:"); print} - /^WM_NAME/{sub(/.* =/, "title:"); print} - /^WM_WINDOW_ROLE/{sub(/.* =/, "role:"); print}'\''' - -alias et="emacsclient -t" - -alias -g ...='../..' - -#Suffix aliases -alias -s log=less - -if [[ -e =hub ]]; then - alias git="hub" -fi - -# Functions - -magit () { - emacsclient -e "(magit-status \"$PWD\")" -} - -dired () { - emacsclient -e "(dired \"$PWD\")" -} - -pid () { - local i - for i in /proc/<->/stat - [[ "$(< $i)" = *\((${(j:|:)~@})\)* ]] && echo $i:h:t - return 0 -} - -_force_rehash() { - (( CURRENT == 1 )) && rehash - return 1 # Because we didn't really complete anything -} - -portgrep() { - sudo lsof -i :$1 -nP | egrep '(LISTEN|UDP|COMMAND)' -} - -ipgrep() { - sudo lsof -i @$1 -nP -} - -smart_sudo () { - if [[ -n $1 ]]; then - \sudo $argv - else - #if no parameters were given, then assume we want a root shell - \sudo -i -u toor - fi -} - -compdef _sudo smart_sudo - -smart_compile () { - local zcompargs - if [[ $1 = *zshrc* ]]; then - zcompargs="-R" - fi - - if [[ $EUID -ne 0 || $1 != *alan* ]]; then - zrecompile -q -p $zcompargs $1 - fi - if [[ -n $2 ]]; then - . $1 - fi -} - -emacs_change_focus () { - emacsclient -n -e "(select-frame-set-input-focus (selected-frame))" > /dev/null -} - -ec () { - local visibleFrames - visibleFrames=`emacsclient -e '(length (visible-frame-list))'` - if [[ $? -ne 0 ]]; then - print "Daemon not running" - return 1 - fi - - if [[ $visibleFrames -eq 1 ]]; then - emacsclient -n -c "$@" && emacs_change_focus - else - emacs_change_focus - if [[ $# -gt 0 ]]; then - emacsclient -n "$@" - fi - fi -} - -_FASD_DATA="$HOME/.zsh/fasd-data" -autoload -U fasd -source ~/.zsh/cache/fasd-init-zsh -- cgit 1.4.1 From 0f7651cd3428226a454461de8dd883e4735d8d9a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 2 Nov 2013 16:04:49 +0000 Subject: zsh: Rename dangling reference to zshrc in installer --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index 44581a1f..f57f587d 100755 --- a/install +++ b/install @@ -55,7 +55,7 @@ local -a zfiles zfiles=( $target/zsh/functions/fasd/fasd $fasd_cache - $target/zsh/zshrc + $target/zsh/interactive.zsh ) if [[ -f $target/zsh/${HOST%%.*}.zsh ]]; then zfiles+=$target/zsh/${HOST%%.*}.zsh -- cgit 1.4.1 From d658978cd6d004369edef823ec6a6b0d1b2e444a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 3 Nov 2013 12:34:02 +0000 Subject: Emacs: enable yaml-mode for ansible (group|host)_vars files --- emacs/init.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index a254dd86..3bed12a5 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -629,6 +629,10 @@ Values: `desktop', `server', `laptop'") :mode (("\\.rb\\'" . ruby-mode) ("\\.cap\\'" . ruby-mode))) +(use-package yaml-mode + :mode (("/group_vars/.*" . yaml-mode) + ("/host_vars/.*" . yaml-mode))) + ;;;; Planning (use-package org -- cgit 1.4.1 From 7a8e863372414120e2a25ee4f11ddc7b60e8c03d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 3 Nov 2013 12:35:20 +0000 Subject: Emacs: enable autopair-mode in yaml-mode --- emacs/init.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 3bed12a5..7912f7a2 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -631,7 +631,9 @@ Values: `desktop', `server', `laptop'") (use-package yaml-mode :mode (("/group_vars/.*" . yaml-mode) - ("/host_vars/.*" . yaml-mode))) + ("/host_vars/.*" . yaml-mode)) + :config (progn + (add-hook 'yaml-mode-hook #'autopair-mode))) ;;;; Planning -- cgit 1.4.1 From 7db736a3fa3e2656b8173ce53265d3648bff16b5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Nov 2013 10:43:24 +0000 Subject: zsh: Add site-functions under /usr/local to fpath, if exists --- zsh/environment.zsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zsh/environment.zsh b/zsh/environment.zsh index 080e2344..65000fb8 100755 --- a/zsh/environment.zsh +++ b/zsh/environment.zsh @@ -27,6 +27,11 @@ then fpath=(/usr/local/share/zsh-completions $fpath) fi +if [[ -d /usr/local/share/zsh/site-functions ]] +then + fpath=(/usr/local/share/zsh/site-functions $fpath) +fi + export FPATH case $OSTYPE in -- cgit 1.4.1 From eb56977552cce9ade5f215ae78a700e74da67341 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Nov 2013 11:03:45 +0000 Subject: Emacs: Ensure .zsh files are opened as shell scripts --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index 7912f7a2..41c66c8d 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -817,6 +817,7 @@ Also returns nil if pid is nil." (use-package sh-script :defer t + :mode (("\\`.zsh\\'" . shell-mode)) :config (setq sh-shell-file "/usr/bin/env zsh")) (use-package ntcmd -- cgit 1.4.1 From 047826207bfdde0d530b608186410cf48c780155 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Nov 2013 12:46:07 +0000 Subject: zsh: Fix FreeBSD pkg UPDATING check --- zsh/freebsd.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/freebsd.zsh b/zsh/freebsd.zsh index 62612611..63f6b8b5 100755 --- a/zsh/freebsd.zsh +++ b/zsh/freebsd.zsh @@ -3,6 +3,6 @@ function update-check () { sudo portsnap update sudo portmaster -L --index-only | awk '/ [Nn]ew / { print substr($0,9,9999) }' sudo portaudit -Fa -X 1 - pkg_updating -d $( ls -ltr -D '%Y%m%d' /var/db/pkg | awk 'END{print $6}' ) + pkg updating -d $( ls -ltr -D '%Y%m%d' /var/db/pkg | awk 'END{print $6}' ) } alias iotop="top -m io -o total" -- cgit 1.4.1 From 673536be4358e9db7d683f7a1653470ba3bffe0b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Nov 2013 12:47:39 +0000 Subject: zsh: Don't fetch audit list when running update-check --- zsh/freebsd.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/freebsd.zsh b/zsh/freebsd.zsh index 63f6b8b5..9b1e6a28 100755 --- a/zsh/freebsd.zsh +++ b/zsh/freebsd.zsh @@ -2,7 +2,7 @@ function update-check () { sudo portsnap update sudo portmaster -L --index-only | awk '/ [Nn]ew / { print substr($0,9,9999) }' - sudo portaudit -Fa -X 1 + sudo portaudit -a -X 1 pkg updating -d $( ls -ltr -D '%Y%m%d' /var/db/pkg | awk 'END{print $6}' ) } alias iotop="top -m io -o total" -- cgit 1.4.1 From f9e7890f37abf62885b7990af732e59c981876e6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Nov 2013 13:28:42 +0000 Subject: Emacs: Fix mode specification for .zsh files --- emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 41c66c8d..30a8181c 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -817,7 +817,7 @@ Also returns nil if pid is nil." (use-package sh-script :defer t - :mode (("\\`.zsh\\'" . shell-mode)) + :mode (("\\.zsh\\'" . shell-script-mode)) :config (setq sh-shell-file "/usr/bin/env zsh")) (use-package ntcmd -- cgit 1.4.1 From dd20ed50f8b9d88a87f3ef25384dcb5594b99226 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Nov 2013 14:15:46 +0000 Subject: Emacs: remove defer keyword from all packages --- emacs/init.el | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 30a8181c..35e538a5 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -80,7 +80,6 @@ Values: `desktop', `server', `laptop'") ;;;; Style (use-package linum - :defer t :config (setq linum-format " %4d ")) (use-package highlight-symbol @@ -88,7 +87,6 @@ Values: `desktop', `server', `laptop'") :config (setq highlight-symbol-idle-delay 0.2)) (use-package whitespace - :defer t :config (setq whitespace-style '(face space @@ -272,7 +270,6 @@ Values: `desktop', `server', `laptop'") ;;;; Communication (use-package erc - :defer t :config (progn (setq erc-user-full-name "Alan Pearce" erc-email-userid "alan@alanpearce.co.uk" @@ -328,7 +325,6 @@ Values: `desktop', `server', `laptop'") ;;;; Dates & Times (use-package calendar - :defer t :config (progn (setq calendar-week-start-day 1) (calendar-set-date-style 'iso))) @@ -436,13 +432,11 @@ Values: `desktop', `server', `laptop'") (add-to-list 'tramp-default-proxies-alist '("router" nil nil)))) (use-package tramp-sh - :defer t :config (progn (add-to-list 'tramp-remote-path "/usr/local/sbin") (add-to-list 'tramp-remote-path "~/bin"))) (use-package ediff - :defer t :config (progn (setq ediff-split-window-function 'split-window-horizontally ediff-window-setup-function 'ediff-setup-windows-plain))) @@ -816,7 +810,6 @@ Also returns nil if pid is nil." #'executable-make-buffer-file-executable-if-script-p) (use-package sh-script - :defer t :mode (("\\.zsh\\'" . shell-script-mode)) :config (setq sh-shell-file "/usr/bin/env zsh")) @@ -828,7 +821,6 @@ Also returns nil if pid is nil." (use-package eshell :bind ("C-c s" . eshell) - :defer t :config (progn (setq eshell-directory-name "~/.emacs.d/eshell") (use-package em-smart @@ -847,7 +839,6 @@ Also returns nil if pid is nil." (bind-key "C-c S" #'eshell-goto-current-dir) (use-package shell - :defer t :config (define-key shell-mode-map (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) @@ -933,7 +924,6 @@ Also returns nil if pid is nil." (bind-key "C-S-L" #'mc/edit-lines))) (use-package eldoc - :defer t :config (progn (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) @@ -1007,12 +997,10 @@ Also returns nil if pid is nil." (use-package redshank :ensure t - :defer t :init (progn (add-hook 'lisp-common-mode-hook #'turn-on-redshank-mode))) (use-package geiser-base - :defer t :config (use-package quack)) (use-package slime @@ -1079,14 +1067,12 @@ Also returns nil if pid is nil." (c-set-offset 'case-label '+))) (use-package quickrun - :defer t :ensure t) ;;;; Web Development (use-package skewer-mode :ensure t - :defer t :init (progn (add-hook 'js2-mode-hook #'skewer-mode) (add-hook 'html-mode-hook #'skewer-html-mode) @@ -1128,7 +1114,6 @@ Also returns nil if pid is nil." :config (turn-on-eldoc-mode)))) (use-package sgml-mode - :defer t :config (setq sgml-basic-offset 4)) (use-package emmet-mode @@ -1138,7 +1123,6 @@ Also returns nil if pid is nil." (add-hook 'web-mode-hook #'emmet-mode)))) (use-package web-mode - :defer t :mode (("/views/.*\\.php\\'" . web-mode) ("/templates/.*\\.php\\'" . web-mode)) :config (setq web-mode-code-indent-offset 4 -- cgit 1.4.1 From 7da8a6c8fac8eea7f2812d6c4f90bdd838d655bd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Nov 2013 16:12:36 +0000 Subject: Add OSX LaunchAgent installation --- install | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/install b/install index f57f587d..85dd7a7b 100755 --- a/install +++ b/install @@ -5,6 +5,11 @@ pushd $HOME setopt EXTENDED_GLOB +if [[ -d ~/Library/LaunchAgents ]] +then + ln -sf $target/launchagents/* ~/Library/LaunchAgents +fi + if [[ ! -d $target && ${(L)host} =~ prefect ]] then git clone ssh://alan@home.alanpearce.co.uk:22222/~/dotfiles.git -- cgit 1.4.1 From 5b1633a64223e19e1018c30f87761dc21fc196c4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Nov 2013 16:12:58 +0000 Subject: Add Emacs daemon LaunchAgent file --- launchagents/gnu.emacs.daemon.plist | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 launchagents/gnu.emacs.daemon.plist diff --git a/launchagents/gnu.emacs.daemon.plist b/launchagents/gnu.emacs.daemon.plist new file mode 100644 index 00000000..ecce7db7 --- /dev/null +++ b/launchagents/gnu.emacs.daemon.plist @@ -0,0 +1,19 @@ + + + + + ServiceDescription + Gnu Emacs Daemon + ProgramArguments + + /Applications/Emacs.app/Contents/MacOS/Emacs + --daemon + + RunAtLoad + + WorkingDirectory + /Users/alan + Label + gnu.emacs.daemon + + -- cgit 1.4.1 From 85b0392ae7797220f1a75cbe59a3232d275e736e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Nov 2013 16:36:44 +0000 Subject: zsh: Ensure FreeBSD sources its own zsh configuration --- zsh/interactive.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zsh/interactive.zsh b/zsh/interactive.zsh index 800d97d2..bc864b3d 100755 --- a/zsh/interactive.zsh +++ b/zsh/interactive.zsh @@ -358,3 +358,7 @@ ec () { _FASD_DATA="$HOME/.zsh/fasd-data" autoload -U fasd source ~/.zsh/cache/fasd-init-zsh + +if [[ $OSTYPE == freebsd* ]]; then + source zsh/freebsd.zsh +fi -- cgit 1.4.1 From 5371244cb59e37cb4b7aee20dbf9c6592c84f42d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 14 Nov 2013 13:47:37 +0000 Subject: Emacs: disable automatic-pairing in web-mode --- emacs/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 35e538a5..94326801 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1127,7 +1127,8 @@ Also returns nil if pid is nil." ("/templates/.*\\.php\\'" . web-mode)) :config (setq web-mode-code-indent-offset 4 web-mode-css-indent-offset 4 - web-mode-markup-indent-offset 4)) + web-mode-markup-indent-offset 4 + web-mode-disable-auto-pairing t)) ;;;; Windows & Frames -- cgit 1.4.1 From cec2d2a6e071c33cdd08b04bcd7ee27ea46e696c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 1 Dec 2013 17:39:28 +0000 Subject: zsh: Fix completion for git/hub --- zsh/interactive.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zsh/interactive.zsh b/zsh/interactive.zsh index bc864b3d..10a58366 100755 --- a/zsh/interactive.zsh +++ b/zsh/interactive.zsh @@ -276,6 +276,8 @@ alias -s log=less if [[ -e =hub ]]; then alias git="hub" + autoload -U _hub + compdef _hub hub fi # Functions -- cgit 1.4.1 From 8dbb37333590bf1719728de3931c248e83c03fd5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 4 Dec 2013 10:02:49 +0000 Subject: Emacs: Remove initial indentation of code inside script+style tags --- emacs/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 94326801..590bfb3e 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1128,6 +1128,8 @@ Also returns nil if pid is nil." :config (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-disable-auto-pairing t)) ;;;; Windows & Frames -- cgit 1.4.1 From d3f52ca93be8e3e45e14d1ab388e93f148793206 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 4 Dec 2013 10:03:30 +0000 Subject: Emacs: use server-side comments inside HTML --- emacs/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/init.el b/emacs/init.el index 590bfb3e..f0d31d3e 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1130,6 +1130,7 @@ Also returns nil if pid is nil." web-mode-markup-indent-offset 4 web-mode-style-padding 0 web-mode-script-padding 0 + web-mode-comment-style 2 web-mode-disable-auto-pairing t)) ;;;; Windows & Frames -- cgit 1.4.1 From f3542e5059d9f86e813997d97eed03c47d4ff3d4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 6 Dec 2013 14:32:05 +0000 Subject: Emacs: use coreutils' gls on OSX --- emacs/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index f0d31d3e..72f1e4db 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -348,6 +348,8 @@ Values: `desktop', `server', `laptop'") dired-recursive-copies 'top dired-recursive-deletes 'top dired-bind-jump nil) + (when (eq system-type 'darwin) + (setq insert-directory-program "/usr/local/bin/gls")) (put 'dired-find-alternate-file 'disabled nil))) (use-package dired+ -- cgit 1.4.1 From da3a02f228071083fc953f8e4de9c211feb72ead Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 6 Dec 2013 17:25:02 +0000 Subject: zsh: Share history between terminal windows --- zsh/interactive.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/zsh/interactive.zsh b/zsh/interactive.zsh index 10a58366..f0a17031 100755 --- a/zsh/interactive.zsh +++ b/zsh/interactive.zsh @@ -155,6 +155,7 @@ setopt hist_find_no_dups setopt hist_ignore_space setopt hist_reduce_blanks setopt hist_verify +setopt share_history setopt inc_append_history # Input/Output -- cgit 1.4.1 From e57133d03169210ebd324ece3ff3eca89e3d2a15 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 6 Dec 2013 17:29:20 +0000 Subject: Emacs: Enable and configure dired-omit-mode --- emacs/init.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 72f1e4db..9a4ddb3f 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -354,7 +354,10 @@ Values: `desktop', `server', `laptop'") (use-package dired+ :ensure t - :config (diredp-toggle-find-file-reuse-dir 1)) + :config (progn + (diredp-toggle-find-file-reuse-dir 1) + (dired-omit-mode 1) + (setq dired-omit-files "#\\|\\.$"))) ;;;; Documentation -- cgit 1.4.1 From 11b28667fd2c59a7c8e4a81a255756c0de8cdd57 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 9 Dec 2013 13:24:34 +0000 Subject: Change git push default tracking for backwards compatibility --- gitconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitconfig b/gitconfig index a31439e2..38dc9a3a 100644 --- a/gitconfig +++ b/gitconfig @@ -7,7 +7,7 @@ status = auto ui = true [push] - default = simple + default = tracking [alias] st = status -sb ci = commit -- cgit 1.4.1 From 308390a148448798f0a7a2145ab568fe2473e9d1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 Jan 2014 16:55:45 +0000 Subject: Emacs: Simplify geiser-racket interaction --- emacs/init.el | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 9a4ddb3f..70882c25 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -998,16 +998,14 @@ Also returns nil if pid is nil." :commands (geiser-mode geiser run-geiser - run-racket)) + run-racket) + :config (use-package quack)) (use-package redshank :ensure t :init (progn (add-hook 'lisp-common-mode-hook #'turn-on-redshank-mode))) -(use-package geiser-base - :config (use-package quack)) - (use-package slime :commands (slime) :config (progn -- cgit 1.4.1 From 5a5b0c4a566792c0bd8f793c4a49a1f1467b1d96 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 Jan 2014 16:57:01 +0000 Subject: Emacs: remove with-elapsed-timer call --- emacs/init.el | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 70882c25..f78839eb 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -150,12 +150,11 @@ Values: `desktop', `server', `laptop'") (set-face-font 'variable-pitch (concat variable-face "-" (number-to-string (1+ font-size))))))))) -(with-elapsed-timer "Setting up font styles" - (let* ((font-height (face-attribute 'default :height)) - (small-font-height (max 1 (floor (* .917 font-height))))) +(let* ((font-height (face-attribute 'default :height)) + (small-font-height (max 1 (floor (* .917 font-height))))) (mapc (lambda (item) - (put (car item) 'customized-face (cadr item)) - (face-spec-set (car item) (cadr item))) + (put (car item) 'customized-face (cadr item)) + (face-spec-set (car item) (cadr item))) `((linum ((t (:height ,small-font-height :foreground unspecified @@ -216,7 +215,7 @@ Values: `desktop', `server', `laptop'") :inherit 'fixed-pitch)))) (org-done ((t (:weight normal :strike-through t)))) - (org-headline-done ((t (:strike-through t)))))))) + (org-headline-done ((t (:strike-through t))))))) ;;;; Autosaves & Backups (let ((backup-dir (expand-file-name "~/.emacs.d/backups/"))) -- cgit 1.4.1 From 7b3bdc4b0be79e6d2f50e0e9ed45c1b3e430010c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 25 Jan 2014 12:40:18 +0000 Subject: Replace ido customisations for vertical candidate display with ido-vertical-mode --- emacs/init.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index f78839eb..72264820 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -554,8 +554,7 @@ Values: `desktop', `server', `laptop'") (bind-key* "C-x C-f" #'ido-find-file) (ido-mode 1)) :config (progn - (setq ido-decorations (quote ("\n›" "" "\n " "\n …" "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]")) - ido-auto-merge-delay-time 99999 + (setq ido-auto-merge-delay-time 99999 ido-enable-flex-matching t) (ido-init-completion-maps) @@ -564,6 +563,10 @@ Values: `desktop', `server', `laptop'") (ido-initiate-auto-merge (current-buffer))) (bind-key "C-c C-s" #'ido-manual-merge ido-file-dir-completion-map))) +(use-package ido-vertical-mode + :ensure t + :config (ido-vertical-mode 1)) + (use-package flx-ido :ensure t :init (progn -- cgit 1.4.1 From 0ecbf23895e730a8061f162d192e63cbc0922c80 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 25 Jan 2014 13:54:02 +0000 Subject: Update FreeBSD update-check: portaudit -> pkg audit --- zsh/freebsd.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/freebsd.zsh b/zsh/freebsd.zsh index 9b1e6a28..6ca0f8d6 100755 --- a/zsh/freebsd.zsh +++ b/zsh/freebsd.zsh @@ -2,7 +2,7 @@ function update-check () { sudo portsnap update sudo portmaster -L --index-only | awk '/ [Nn]ew / { print substr($0,9,9999) }' - sudo portaudit -a -X 1 + sudo pkg audit pkg updating -d $( ls -ltr -D '%Y%m%d' /var/db/pkg | awk 'END{print $6}' ) } alias iotop="top -m io -o total" -- cgit 1.4.1 From e31d0dbcfe860fc71e1f8917ed67c893297ae930 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 4 Feb 2014 17:25:15 +0000 Subject: Update pure prompt --- zsh/functions/pure/prompt_pure_setup | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/zsh/functions/pure/prompt_pure_setup b/zsh/functions/pure/prompt_pure_setup index dae1fbb6..5c635037 100644 --- a/zsh/functions/pure/prompt_pure_setup +++ b/zsh/functions/pure/prompt_pure_setup @@ -16,6 +16,21 @@ # %m => shortname host # %(?..) => prompt conditional - %(condition.true.false) + +# turns seconds into human readable time +# 165392 => 1d 21h 56m 32s +prompt_pure_human_time() { + local tmp=$1 + local days=$(( tmp / 60 / 60 / 24 )) + local hours=$(( tmp / 60 / 60 % 24 )) + local minutes=$(( tmp / 60 % 60 )) + local seconds=$(( tmp % 60 )) + (( $days > 0 )) && echo -n "${days}d " + (( $hours > 0 )) && echo -n "${hours}h " + (( $minutes > 0 )) && echo -n "${minutes}m " + echo "${seconds}s" +} + # fastest possible way to check if repo is dirty prompt_pure_git_dirty() { # check if we're in a git repo @@ -31,7 +46,7 @@ prompt_pure_cmd_exec_time() { local stop=$(date +%s) local start=${cmd_timestamp:-$stop} integer elapsed=$stop-$start - (($elapsed > ${PURE_CMD_MAX_EXEC_TIME:=5})) && echo ${elapsed}s + (($elapsed > ${PURE_CMD_MAX_EXEC_TIME:=5})) && prompt_pure_human_time $elapsed } prompt_pure_preexec() { @@ -59,7 +74,7 @@ prompt_pure_precmd() { print -P $prompt_pure_preprompt # check async if there is anything to pull - { + (( ${PURE_GIT_PULL:-1} )) && { # check if we're in a git repo command git rev-parse --is-inside-work-tree &>/dev/null && # check check if there is anything to pull @@ -77,6 +92,10 @@ prompt_pure_precmd() { prompt_pure_setup() { + # prevent percentage showing up + # if output doesn't end with a newline + export PROMPT_EOL_MARK='' + prompt_opts=(cr subst percent) autoload -Uz add-zsh-hook @@ -93,7 +112,7 @@ prompt_pure_setup() { [[ "$SSH_CONNECTION" != '' ]] && prompt_pure_username='%n@%m ' # prompt turns red if the previous command didn't exit with 0 - PROMPT='%(?.%F{cyan}.%F{red})❯%f ' + PROMPT='%(?.%F{magenta}.%F{red})❯%f ' } prompt_pure_setup "$@" -- cgit 1.4.1 From 6f4c1e62e76d861f672d270348c5ef4f2cfec8e0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 8 Feb 2014 20:36:09 +0000 Subject: Installer: Create ~/projects/dotfiles if missing --- install | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/install b/install index 85dd7a7b..da30f8cb 100755 --- a/install +++ b/install @@ -5,6 +5,11 @@ pushd $HOME setopt EXTENDED_GLOB +if [[ ! -d $target ]] +then + mkdir -pv $target +fi + if [[ -d ~/Library/LaunchAgents ]] then ln -sf $target/launchagents/* ~/Library/LaunchAgents -- cgit 1.4.1 From 21b6f0cd68028c1e64c97e1ab7143fed4151c35d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 5 Mar 2014 12:19:22 +0000 Subject: Emacs: check and use cask, if installed --- emacs/Cask | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ emacs/init.el | 38 ++++++++++++++++++------------- 2 files changed, 95 insertions(+), 16 deletions(-) create mode 100644 emacs/Cask diff --git a/emacs/Cask b/emacs/Cask new file mode 100644 index 00000000..8d913817 --- /dev/null +++ b/emacs/Cask @@ -0,0 +1,73 @@ +(source org) +(source melpa) +(source marmalade) +(source gnu) + +(depends-on "ace-jump-mode") +(depends-on "ag") +(depends-on "auto-compile") +(depends-on "auto-indent-mode") +(depends-on "autopair") +(depends-on "bind-key") +(depends-on "cask") +(depends-on "cdnjs") +(depends-on "company") +(depends-on "confluence") +(depends-on "control-mode") +(depends-on "dash") +(depends-on "dash-at-point") +(depends-on "deferred") +(depends-on "diff-hl") +(depends-on "diminish") +(depends-on "dired+") +(depends-on "discover") +(depends-on "emmet-mode") +(depends-on "epl") +(depends-on "expand-region") +(depends-on "f") +(depends-on "flx") +(depends-on "flx-ido") +(depends-on "framemove") +(depends-on "geiser") +(depends-on "ggtags") +(depends-on "git-commit-mode") +(depends-on "git-rebase-mode") +(depends-on "god-mode") +(depends-on "haskell-mode") +(depends-on "helm") +(depends-on "ido-vertical-mode") +(depends-on "jinja2-mode") +(depends-on "js2-mode") +(depends-on "lua-mode") +(depends-on "magit") +(depends-on "makey") +(depends-on "multi-term") +(depends-on "multiple-cursors") +(depends-on "mustache-mode") +(depends-on "nginx-mode") +(depends-on "org-jira") +(depends-on "org-journal") +(depends-on "org-plus-contrib") +(depends-on "packed") +(depends-on "pallet") +(depends-on "paredit") +(depends-on "php-mode") +(depends-on "pkg-info") +(depends-on "project-persist") +(depends-on "projectile") +(depends-on "puppet-mode") +(depends-on "quickrun") +(depends-on "redshank") +(depends-on "s") +(depends-on "simple-httpd") +(depends-on "skewer-mode") +(depends-on "smart-tab") +(depends-on "smart-tabs-mode") +(depends-on "smex") +(depends-on "solarized-theme") +(depends-on "tup-mode") +(depends-on "undo-tree") +(depends-on "use-package") +(depends-on "web-mode") +(depends-on "xml-rpc") +(depends-on "yaml-mode") \ No newline at end of file diff --git a/emacs/init.el b/emacs/init.el index 72264820..770b5dc8 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -56,24 +56,30 @@ Values: `desktop', `server', `laptop'") "Where the emacs init file really is, passing through symlinks.") ;;;; Package Management -(eval-and-compile - (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") - ("marmalade" . "http://marmalade-repo.org/packages/") - ("melpa" . "http://melpa.milkbox.net/packages/") - ("org" . "http://orgmode.org/elpa/"))) - (package-initialize)) - -(when (not package-archive-contents) - (package-refresh-contents)) - (add-to-list 'load-path (expand-file-name "elisp/" user-emacs-directory)) -(mapc (lambda (package-name) - (unless (package-installed-p package-name) - (package-install package-name))) - '(bind-key - diminish - use-package)) +(let ((cask-file (expand-file-name "cask.el" user-emacs-directory))) + (if (file-exists-p cask-file) + (progn + (add-to-list 'load-path (file-name-directory (file-truename cask-file))) + (require 'cask) + (cask-initialize)) + (eval-and-compile + (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") + ("marmalade" . "http://marmalade-repo.org/packages/") + ("melpa" . "http://melpa.milkbox.net/packages/") + ("org" . "http://orgmode.org/elpa/"))) + (package-initialize)) + + (when (not package-archive-contents) + (package-refresh-contents)) + + (mapc (lambda (package-name) + (unless (package-installed-p package-name) + (package-install package-name))) + '(bind-key + diminish + use-package)))) (require 'use-package) -- cgit 1.4.1 From 9094360d8c4f42f8f0a6a0475051877dc2c38fe5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 5 Mar 2014 14:48:38 +0000 Subject: zsh: Fix path to FreeBSD configuration --- zsh/interactive.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/interactive.zsh b/zsh/interactive.zsh index f0a17031..d2a72e4e 100755 --- a/zsh/interactive.zsh +++ b/zsh/interactive.zsh @@ -363,5 +363,5 @@ autoload -U fasd source ~/.zsh/cache/fasd-init-zsh if [[ $OSTYPE == freebsd* ]]; then - source zsh/freebsd.zsh + source ~/projects/dotfiles/zsh/freebsd.zsh fi -- cgit 1.4.1 From d121a8e2253541e1f9606c31d27807d349409e3a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 9 Mar 2014 15:58:14 +0000 Subject: Installer: create directories if not present --- install | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/install b/install index da30f8cb..a433631a 100755 --- a/install +++ b/install @@ -21,6 +21,11 @@ then fi install-dot () { + if [[ ! -d $1 ]] + then + mkdir $1 + fi + for f in $@[2,-1] do if [[ ! -e $1$f:t ]] -- cgit 1.4.1 From 325426abd41894fad8e1264d72593f03d4e5cc8c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 9 Mar 2014 15:58:29 +0000 Subject: Emacs: fix cask loading to follow official usage --- emacs/init.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 770b5dc8..6b1f80f8 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -58,10 +58,10 @@ Values: `desktop', `server', `laptop'") ;;;; Package Management (add-to-list 'load-path (expand-file-name "elisp/" user-emacs-directory)) -(let ((cask-file (expand-file-name "cask.el" user-emacs-directory))) - (if (file-exists-p cask-file) +(let ((cask-dir (expand-file-name "~/.cask"))) + (if (file-exists-p cask-dir) (progn - (add-to-list 'load-path (file-name-directory (file-truename cask-file))) + (add-to-list 'load-path cask-dir) (require 'cask) (cask-initialize)) (eval-and-compile -- cgit 1.4.1 From 7954d517f70f79ea3f916d5453b5d2fed47e1cad Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 15 Mar 2014 11:24:53 +0000 Subject: Installer: create directories for links if needed --- install | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/install b/install index da30f8cb..32a4f26f 100755 --- a/install +++ b/install @@ -21,6 +21,11 @@ then fi install-dot () { + if [[ "$1" != . && ! -d $1 ]] + then + mkdir $1 + fi + for f in $@[2,-1] do if [[ ! -e $1$f:t ]] -- cgit 1.4.1 From acbbc71c239dccf5aeb595a12fec1b829cbce752 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 15 Mar 2014 11:29:24 +0000 Subject: Emacs: remove use-package ensure directives in favour of cask --- emacs/init.el | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 770b5dc8..670fc763 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -115,7 +115,6 @@ Values: `desktop', `server', `laptop'") jit-lock-defer-time 0.01) (use-package solarized-theme - :ensure t :config (load-theme 'solarized-light t)) (when (or (display-graphic-p) @@ -312,14 +311,12 @@ Values: `desktop', `server', `laptop'") completion-ignore-case t) (use-package smart-tab - :ensure t :init (global-smart-tab-mode) :config (progn (nconc smart-tab-completion-functions-alist '((php-mode . php-complete-function))) (diminish 'smart-tab-mode ""))) (use-package company - :ensure t :commands (company-mode) :bind (("C-" . company-complete)) :init (progn @@ -358,7 +355,6 @@ Values: `desktop', `server', `laptop'") (put 'dired-find-alternate-file 'disabled nil))) (use-package dired+ - :ensure t :config (progn (diredp-toggle-find-file-reuse-dir 1) (dired-omit-mode 1) @@ -463,7 +459,6 @@ Values: `desktop', `server', `laptop'") tab-always-indent 'complete) (use-package auto-indent-mode - :ensure t :commands (auto-indent-minor-mode auto-indent-mode) :config (progn @@ -480,7 +475,6 @@ Values: `desktop', `server', `laptop'") (add-hook 'lisp-common-mode-hook #'lisp-auto-indent-mode))) (use-package smart-tabs-mode - :ensure t :commands (smart-tabs-mode smart-tabs-mode-enable smart-tabs-advice) @@ -548,7 +542,6 @@ Values: `desktop', `server', `laptop'") :bind (("M-`" . lacarte-execute-menu-command))) (use-package helm-config - :ensure helm :bind (("C-x i" . helm-imenu)) :config (setq helm-idle-delay .1 helm-input-idle-delay .1)) @@ -570,16 +563,13 @@ Values: `desktop', `server', `laptop'") (bind-key "C-c C-s" #'ido-manual-merge ido-file-dir-completion-map))) (use-package ido-vertical-mode - :ensure t :config (ido-vertical-mode 1)) (use-package flx-ido - :ensure t :init (progn (flx-ido-mode 1))) (use-package smex - :ensure t :bind (("M-x" . smex) ("" . smex) ("" . smex) @@ -615,16 +605,13 @@ Values: `desktop', `server', `laptop'") ("\\.Xresources\\'" . xrdb-mode))) (use-package haskell-mode - :ensure t :mode (("\\.hs\\'" . haskell-mode) ("xmobarrc\\'" . haskell-mode))) (use-package nginx-mode - :ensure t :mode (("nginx.conf" . nginx-mode))) (use-package lua-mode - :ensure t :mode (("\\.lua\\'" . lua-mode))) (use-package puppet-mode @@ -645,7 +632,6 @@ Values: `desktop', `server', `laptop'") ;;;; Planning (use-package org - :ensure org-plus-contrib :bind (("C-c C-a" . org-agenda-list) ("C-c a" . org-agenda) ("C-c l" . org-store-link) @@ -701,7 +687,6 @@ Values: `desktop', `server', `laptop'") (org-todo "STARTED"))))))) (use-package org-journal - :ensure t :config (progn (setq org-journal-date-format "%A, %d %B %Y"))) @@ -719,13 +704,11 @@ Values: `desktop', `server', `laptop'") ;;;; Projects (use-package projectile - :ensure t :bind (("C-c C-f" . projectile-find-file) ("s-x s-f" . projectile-find-file)) :commands (projectile-global-mode)) (use-package project-persist - :ensure t :commands (project-persist-mode) :bind (("C-c P d" . project-persist-delete) ("C-c P f" . project-persist-find) @@ -796,7 +779,6 @@ Also returns nil if pid is nil." (setq vc-follow-symlinks t))) (use-package diff-hl - :ensure t :init (progn (global-diff-hl-mode) (add-hook 'magit-refresh-file-buffer-hook #'diff-hl-update))) @@ -856,7 +838,6 @@ Also returns nil if pid is nil." (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) (use-package multi-term - :ensure t :if (not (eq system-type 'windows-nt)) :bind ("C-`" . multi-term-dedicated-toggle)) @@ -901,7 +882,6 @@ Also returns nil if pid is nil." (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))) (use-package ace-jump-mode - :ensure t :bind (("C-c SPC" . ace-jump-mode)) :config (progn (ace-jump-mode-enable-mark-sync) @@ -909,7 +889,6 @@ Also returns nil if pid is nil." ace-jump-mode-scope 'window))) (use-package autopair - :ensure t :commands (autopair-mode autopair-on) :init (progn @@ -921,14 +900,12 @@ Also returns nil if pid is nil." autopair-skip-whitespace nil))) (use-package expand-region - :ensure t :bind ("C-M-SPC" . er/expand-region)) (use-package goto-chg :bind ("C-x SPC" . goto-last-change)) (use-package multiple-cursors - :ensure t :config (progn (bind-key "C-." #'mc/mark-next-like-this) (bind-key "C-," #'mc/mark-previous-like-this) @@ -941,7 +918,6 @@ Also returns nil if pid is nil." (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) (use-package paredit - :ensure t :commands (paredit-mode) :init (progn (add-hook 'lisp-common-mode-hook #'enable-paredit-mode) @@ -964,7 +940,6 @@ Also returns nil if pid is nil." ("C-M-n" . smart-forward))) (use-package undo-tree - :ensure t :config (progn (global-undo-tree-mode) ;; Keep region when undoing in region @@ -1010,7 +985,6 @@ Also returns nil if pid is nil." :config (use-package quack)) (use-package redshank - :ensure t :init (progn (add-hook 'lisp-common-mode-hook #'turn-on-redshank-mode))) @@ -1064,7 +1038,6 @@ Also returns nil if pid is nil." ;;;; Programming (use-package auto-compile - :ensure t :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) (use-package cc-mode @@ -1077,20 +1050,17 @@ Also returns nil if pid is nil." c-basic-offset 4) (c-set-offset 'case-label '+))) -(use-package quickrun - :ensure t) +(use-package quickrun) ;;;; Web Development (use-package skewer-mode - :ensure t :init (progn (add-hook 'js2-mode-hook #'skewer-mode) (add-hook 'html-mode-hook #'skewer-html-mode) (add-hook 'css-mode-hook #'skewer-css-mode))) (use-package js2-mode - :ensure t :mode ("\\.js\\'" . js2-mode) :config (progn (defun ap/javascript-setup () @@ -1101,13 +1071,11 @@ Also returns nil if pid is nil." js2-global-externs '("$")))) (use-package mustache-mode - :ensure t :mode (("\\.mustache" . mustache-mode) ("\\.mt\\'" . mustache-mode) ("\\.template\\'" . mustache-mode))) (use-package jinja2-mode - :ensure t :mode (("\\.j2\\'" . jinja2-mode))) (use-package php-mode @@ -1128,7 +1096,6 @@ Also returns nil if pid is nil." :config (setq sgml-basic-offset 4)) (use-package emmet-mode - :ensure t :config (progn (if (functionp 'web-mode) (add-hook 'web-mode-hook #'emmet-mode)))) -- cgit 1.4.1 From 141afbe008591928e92c2f11287b2a1d11c49b9b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 24 Mar 2014 14:34:19 +0000 Subject: Add Brewfile with basic tools --- Brewfile | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Brewfile diff --git a/Brewfile b/Brewfile new file mode 100644 index 00000000..d5359ad6 --- /dev/null +++ b/Brewfile @@ -0,0 +1,8 @@ +install emacs --cocoa --srgb --with-gnutls +install fasd +install git +install htop +install hub +install mobile-shell +install ssh-copy-id +install zsh \ No newline at end of file -- cgit 1.4.1 From d9605e6ecc873a9362b1e8a875d544a69346d02d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 24 Mar 2014 14:45:24 +0000 Subject: Add direnv --- Brewfile | 1 + zsh/environment.zsh | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Brewfile b/Brewfile index d5359ad6..ae3e09dc 100644 --- a/Brewfile +++ b/Brewfile @@ -1,3 +1,4 @@ +install direnv install emacs --cocoa --srgb --with-gnutls install fasd install git diff --git a/zsh/environment.zsh b/zsh/environment.zsh index 65000fb8..02cdb178 100755 --- a/zsh/environment.zsh +++ b/zsh/environment.zsh @@ -46,3 +46,5 @@ case $OSTYPE in esac export os + +eval "$(direnv hook zsh)" -- cgit 1.4.1 From ac598b584f7f712414835388f7083d9d5d03fd41 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 24 Mar 2014 14:47:46 +0000 Subject: Add envrc files to global gitignore --- global.gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/global.gitignore b/global.gitignore index 78d8d163..7e23dcab 100644 --- a/global.gitignore +++ b/global.gitignore @@ -18,6 +18,8 @@ auto-save-list tramp .\#* +.envrc + # Org-mode .org-id-locations *_archive -- cgit 1.4.1 From 01790538eeb0bbd0a5be4716fa6187e6350a9e89 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 1 Apr 2014 14:51:59 +0100 Subject: Switch default push tracking mode to current --- gitconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitconfig b/gitconfig index 38dc9a3a..0915a234 100644 --- a/gitconfig +++ b/gitconfig @@ -7,7 +7,7 @@ status = auto ui = true [push] - default = tracking + default = current [alias] st = status -sb ci = commit -- cgit 1.4.1 From 4f58f906a49721af4b5e834db1f6ba5b4db2839a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 1 Apr 2014 21:58:28 +0100 Subject: Emacs: Replace buggy eldoc-php with php-extras --- emacs/Cask | 1 + emacs/elisp/eldoc-php.el | 48 ------------------------------------------------ emacs/init.el | 5 +---- 3 files changed, 2 insertions(+), 52 deletions(-) delete mode 100644 emacs/elisp/eldoc-php.el diff --git a/emacs/Cask b/emacs/Cask index 8d913817..8742df0f 100644 --- a/emacs/Cask +++ b/emacs/Cask @@ -51,6 +51,7 @@ (depends-on "packed") (depends-on "pallet") (depends-on "paredit") +(depends-on "php-extras") (depends-on "php-mode") (depends-on "pkg-info") (depends-on "project-persist") diff --git a/emacs/elisp/eldoc-php.el b/emacs/elisp/eldoc-php.el deleted file mode 100644 index 8101fea0..00000000 --- a/emacs/elisp/eldoc-php.el +++ /dev/null @@ -1,48 +0,0 @@ -(require 'xml) -(provide 'eldoc-php) - -(setq my-php-function-doc-hash (make-hash-table :test 'equal)) - - -(defun my-php-fetch-function-doc (function) - (let ((doc (gethash function my-php-function-doc-hash 'nope))) - (when (eq doc 'nope) - (setq doc nil) - - (let ((buf (url-retrieve-synchronously (concat "http://uk3.php.net/manual-lookup.php?pattern=" function)))) - (with-current-buffer buf - (goto-char (point-min)) - (let (desc) - (when (re-search-forward "
\\(\\(.\\|\n\\)*?\\)
" nil t) - (setq desc - (replace-regexp-in-string - " +" " " - (replace-regexp-in-string - "\n" "" - (replace-regexp-in-string "<.*?>" "" (match-string-no-properties 1))))) - ;; Don't show the function description - ;; (when (re-search-forward "

\\(\\(.\\|\n\\)*?\\)

" nil t) - ;; (setq desc - ;; (concat desc "\n\n" - ;; (replace-regexp-in-string - ;; " +" " " - ;; (replace-regexp-in-string - ;; "\n" "" - ;; (replace-regexp-in-string "<.*?>" "" (match-string-no-properties 1))))))) - ) - - (if desc - (setq doc (xml-substitute-special desc))))) - - (kill-buffer buf)) - - (puthash function doc my-php-function-doc-hash)) - - doc)) - - -(defun my-php-eldoc-function () - (let ((symbol (thing-at-point 'symbol))) - (if (and symbol - (not (eq (elt symbol 0) ?$))) - (my-php-fetch-function-doc symbol)))) diff --git a/emacs/init.el b/emacs/init.el index 0ac222bd..71a64754 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1087,10 +1087,7 @@ Also returns nil if pid is nil." (if (eq env/location 'home) (setq php-manual-url "http://docs.home/manual/en/")) (add-hook 'php-mode-hook #'php-enable-wordpress-coding-style) - (add-hook 'php-mode-hook (lambda () - (set (make-local-variable 'eldoc-documentation-function) #'my-php-eldoc-function))) - (use-package eldoc-php - :config (turn-on-eldoc-mode)))) + (add-hook 'php-mode-hook #'turn-on-eldoc-mode))) (use-package sgml-mode :config (setq sgml-basic-offset 4)) -- cgit 1.4.1 From bb173ad85c097327de13517d84eb142b053443cf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 2 Apr 2014 09:09:52 +0100 Subject: Zsh: remove hardcoded references to user alan --- zsh/environment.zsh | 2 +- zsh/interactive.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zsh/environment.zsh b/zsh/environment.zsh index 02cdb178..dffd11f6 100755 --- a/zsh/environment.zsh +++ b/zsh/environment.zsh @@ -16,7 +16,7 @@ fi export PATH -myfuncs=( ~alan/projects/dotfiles/zsh/functions/*(/) ) +myfuncs=( ~/projects/dotfiles/zsh/functions/*(/) ) fpath=( $myfuncs ~alan/projects/dotfiles/zsh/completion/ diff --git a/zsh/interactive.zsh b/zsh/interactive.zsh index d2a72e4e..f047f215 100755 --- a/zsh/interactive.zsh +++ b/zsh/interactive.zsh @@ -67,7 +67,7 @@ colors compinit -u -d .zsh/cache/compdump bashcompinit -zstyle :compinstall filename '/home/alan/.zshrc' +zstyle :compinstall filename '~/.zshrc' autoload -Uz _tmux_pane_words zle -C tmux-pane-words-prefix complete-word _generic -- cgit 1.4.1 From 462a47f1846382df6e20f1dbd662c7849d4dc7d3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 8 Apr 2014 13:52:20 +0100 Subject: Emacs: create DWIM function for switching buffers Uses projectile inside a project and ido outside. Bound to C-c b --- emacs/init.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 71a64754..e724cfc4 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -562,6 +562,14 @@ Values: `desktop', `server', `laptop'") (ido-initiate-auto-merge (current-buffer))) (bind-key "C-c C-s" #'ido-manual-merge ido-file-dir-completion-map))) +(defun ap/ido-projectile-switch-buffer-dwim (force-ido) + (interactive "p") + (if (and (projectile-project-p) (eq force-ido 1)) + (call-interactively #'projectile-switch-to-buffer) + (call-interactively #'ido-switch-buffer))) + +(bind-key "C-c b" #'ap/ido-projectile-switch-buffer-dwim) + (use-package ido-vertical-mode :config (ido-vertical-mode 1)) @@ -635,8 +643,7 @@ Values: `desktop', `server', `laptop'") :bind (("C-c C-a" . org-agenda-list) ("C-c a" . org-agenda) ("C-c l" . org-store-link) - ("C-c r" . org-remember) - ("C-c b" . org-iswitchb)) + ("C-c r" . org-remember)) :config (progn (setq org-directory "~/org" org-agenda-files `(,org-directory) -- cgit 1.4.1 From f9966bf4f77afc79567cbeebc89d7d43105636f3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 8 Apr 2014 14:03:52 +0100 Subject: Improve keybindings for magic buffer switching --- emacs/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index e724cfc4..0cb6bfff 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -568,7 +568,8 @@ Values: `desktop', `server', `laptop'") (call-interactively #'projectile-switch-to-buffer) (call-interactively #'ido-switch-buffer))) -(bind-key "C-c b" #'ap/ido-projectile-switch-buffer-dwim) +(bind-key "s-x b" #'ap/ido-projectile-switch-buffer-dwim) +(bind-key "s-x s-b" #'ap/ido-projectile-switch-buffer-dwim) (use-package ido-vertical-mode :config (ido-vertical-mode 1)) -- cgit 1.4.1 From 53017f8e998b30e67ec8a4e2aecf5d5d551e7a4d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Apr 2014 14:09:23 +0100 Subject: zsh: Remove reference to home folder --- zsh/environment.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/environment.zsh b/zsh/environment.zsh index dffd11f6..0183f728 100755 --- a/zsh/environment.zsh +++ b/zsh/environment.zsh @@ -19,7 +19,7 @@ export PATH myfuncs=( ~/projects/dotfiles/zsh/functions/*(/) ) fpath=( $myfuncs - ~alan/projects/dotfiles/zsh/completion/ + ~/projects/dotfiles/zsh/completion/ $fpath ) if [[ -d /usr/local/share/zsh-completions ]] -- cgit 1.4.1 From b35c0c6354e54c61e14d6e8b184517bdf47a99cf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Apr 2014 19:25:52 +0100 Subject: Emacs: use custom style for PHP indentation --- emacs/init.el | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/emacs/init.el b/emacs/init.el index 0cb6bfff..b826a0a6 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1094,7 +1094,27 @@ Also returns nil if pid is nil." (unbind-key "C-." php-mode-map) (if (eq env/location 'home) (setq php-manual-url "http://docs.home/manual/en/")) - (add-hook 'php-mode-hook #'php-enable-wordpress-coding-style) + (c-add-style "ap" + '((c-basic-offset . 4) + (c-offsets-alist . ((arglist-cont . php-lineup-arglist) + (arglist-intro . php-lineup-arglist-intro) + (arglist-close . php-lineup-arglist-close) + (topmost-intro-cont . (first c-lineup-cascaded-calls + php-lineup-arglist-intro)) + (brace-list-intro . +) + (brace-list-entry . c-lineup-cascaded-calls) + (case-label . 4) + (statement-case-intro . 4) + (defun-close . 0) + (defun-block-intro . +) + (knr-argdecl . [0]) + (arglist-cont-nonempty . c-lineup-cascaded-calls) + (statement-cont . php-lineup-hanging-semicolon))))) + (defun ap/php-style () + (setq indent-tabs-mode t + c-indent-comments-syntactically-p t) + (c-set-style "ap")) + (add-hook 'php-mode-hook #'ap/php-style) (add-hook 'php-mode-hook #'turn-on-eldoc-mode))) (use-package sgml-mode -- cgit 1.4.1 From f942db6269c28f7aab01fe7a50d15c0f9798747f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Apr 2014 19:26:17 +0100 Subject: Emacs: remove PHP manual URL assignment --- emacs/init.el | 2 -- 1 file changed, 2 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index b826a0a6..6c4d390c 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1092,8 +1092,6 @@ Also returns nil if pid is nil." (bind-key "C-h C-f" #'php-search-documentation php-mode-map) (unbind-key "C-c C-f" php-mode-map) (unbind-key "C-." php-mode-map) - (if (eq env/location 'home) - (setq php-manual-url "http://docs.home/manual/en/")) (c-add-style "ap" '((c-basic-offset . 4) (c-offsets-alist . ((arglist-cont . php-lineup-arglist) -- cgit 1.4.1 From 55b9f757183ff0e603482f7a085bab75a1a8643d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Apr 2014 19:32:18 +0100 Subject: Emacs: add narrow-to-function-indirect function --- emacs/elisp/ap-functions.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/emacs/elisp/ap-functions.el b/emacs/elisp/ap-functions.el index 19f63320..37b8863d 100644 --- a/emacs/elisp/ap-functions.el +++ b/emacs/elisp/ap-functions.el @@ -34,4 +34,14 @@ (command (read-shell-command "Shell command: " nil nil nil))) (shell-command (replace-regexp-in-string "%" file-buffer command) to-current-buffer))) +;;;###autoload +(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))) + (provide 'ap-functions) -- cgit 1.4.1 From d5e878314c0579cbd80df63beb7df7b416bb33a8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Apr 2014 19:33:37 +0100 Subject: Emacs: remove Windows line endings --- emacs/elisp/ap-functions.el | 94 ++++++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/emacs/elisp/ap-functions.el b/emacs/elisp/ap-functions.el index 37b8863d..bdc7faef 100644 --- a/emacs/elisp/ap-functions.el +++ b/emacs/elisp/ap-functions.el @@ -1,47 +1,47 @@ -;;;###autoload -(defun ap/remove-extra-cr () - "Remove extraneous CR codes from a file" - (interactive) - (save-excursion - (goto-char (point-min)) - (while (search-forward " -" nil t) - (replace-match "")))) - -;;;###autoload -(defun copy-rectangle (start end) - "Copy the region-rectangle." - (interactive "r") - (setq killed-rectangle (extract-rectangle start end))) - -;;;###autoload -(defun eval-and-replace () - "Replace the preceding sexp with its value." - (interactive) - (backward-kill-sexp) - (condition-case nil - (prin1 (eval (read (current-kill 0))) - (current-buffer)) - (error (message "Invalid expression") - (insert (current-kill 0))))) - -;;;###autoload -(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))) - -;;;###autoload -(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))) - -(provide 'ap-functions) +;;;###autoload +(defun ap/remove-extra-cr () + "Remove extraneous CR codes from a file" + (interactive) + (save-excursion + (goto-char (point-min)) + (while (search-forward " +" nil t) + (replace-match "")))) + +;;;###autoload +(defun copy-rectangle (start end) + "Copy the region-rectangle." + (interactive "r") + (setq killed-rectangle (extract-rectangle start end))) + +;;;###autoload +(defun eval-and-replace () + "Replace the preceding sexp with its value." + (interactive) + (backward-kill-sexp) + (condition-case nil + (prin1 (eval (read (current-kill 0))) + (current-buffer)) + (error (message "Invalid expression") + (insert (current-kill 0))))) + +;;;###autoload +(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))) + +;;;###autoload +(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))) + +(provide 'ap-functions) -- cgit 1.4.1 From d36c31e50e28d2b244344d983dfc5c3fd834adb7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Apr 2014 19:36:32 +0100 Subject: Emacs: add fancy-narrow function --- emacs/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/emacs/init.el b/emacs/init.el index 6c4d390c..76505ad5 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -271,6 +271,9 @@ Values: `desktop', `server', `laptop'") uniquify-after-kill-buffer-p t uniquify-ignore-buffers-re "^\\*"))) +(use-package fancy-narrow + :config (fancy-narrow-mode 1)) + ;;;; Communication (use-package erc -- cgit 1.4.1 From 33ee27f011374d07f8c5f6508dc1d08d8e9a188e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Apr 2014 19:49:31 +0100 Subject: Installer: fix emacs detection --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index 32a4f26f..9da73847 100755 --- a/install +++ b/install @@ -50,7 +50,7 @@ then install-dot projects/dwm/ $target/dwm/* fi -if [[ -x =emacs ]] +if [[ -z $commands[emacs] ]] then emacs --batch --eval '(batch-byte-recompile-directory 0)' ~/.emacs.d/ fi -- cgit 1.4.1 From 689758ee3e8aae72163f6ffb6cdceb16edd3b0fe Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Apr 2014 19:50:18 +0100 Subject: Installer: switch URL to github --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index 9da73847..e31b00cd 100755 --- a/install +++ b/install @@ -17,7 +17,7 @@ fi if [[ ! -d $target && ${(L)host} =~ prefect ]] then - git clone ssh://alan@home.alanpearce.co.uk:22222/~/dotfiles.git + git clone git://github.com/alanpearce/dotfiles.git fi install-dot () { -- cgit 1.4.1 From 04cc33e57f39991c645580d85a82c7246998190d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Apr 2014 19:51:31 +0100 Subject: Install: clone to target directory --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index e31b00cd..530e7a3e 100755 --- a/install +++ b/install @@ -17,7 +17,7 @@ fi if [[ ! -d $target && ${(L)host} =~ prefect ]] then - git clone git://github.com/alanpearce/dotfiles.git + git clone git://github.com/alanpearce/dotfiles.git $target fi install-dot () { -- cgit 1.4.1 From 4cd3145a5447154c2836580a004f374a0af3600f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Apr 2014 19:51:54 +0100 Subject: Install: clone repository before linking --- install | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/install b/install index 530e7a3e..d3eaf06a 100755 --- a/install +++ b/install @@ -10,14 +10,14 @@ then mkdir -pv $target fi -if [[ -d ~/Library/LaunchAgents ]] +if [[ ! -d $target && ${(L)host} =~ prefect ]] then - ln -sf $target/launchagents/* ~/Library/LaunchAgents + git clone git://github.com/alanpearce/dotfiles.git $target fi -if [[ ! -d $target && ${(L)host} =~ prefect ]] +if [[ -d ~/Library/LaunchAgents ]] then - git clone git://github.com/alanpearce/dotfiles.git $target + ln -sf $target/launchagents/* ~/Library/LaunchAgents fi install-dot () { -- cgit 1.4.1 From 8c278ce7d7f22486fcbb3d9eed826c49b690b895 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Apr 2014 19:52:53 +0100 Subject: Install: simplify launchagent installation --- install | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/install b/install index d3eaf06a..20e72e5a 100755 --- a/install +++ b/install @@ -15,11 +15,6 @@ then git clone git://github.com/alanpearce/dotfiles.git $target fi -if [[ -d ~/Library/LaunchAgents ]] -then - ln -sf $target/launchagents/* ~/Library/LaunchAgents -fi - install-dot () { if [[ "$1" != . && ! -d $1 ]] then @@ -39,6 +34,10 @@ install-dot $target/.git/hooks/ $target/git-hooks/* install-dot .emacs.d/ $target/emacs/{init.el{,c},elisp} install-dot . $target/^install(.) $target/zsh/fasdrc install-dot .ssh/ $target/ssh/* +if [[ -d ~/Library/LaunchAgents ]] +then + install-dot ~/Library/LaunchAgents $target/launchagents/* +fi ln -sf $target/zsh/environment.zsh .zshenv ln -sf $target/zsh/interactive.zsh .zshrc -- cgit 1.4.1 From 6a4ee1656eba28db17bafb7e998d86b1353db95d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Apr 2014 20:07:42 +0100 Subject: zsh: Only run direnv when installed --- zsh/environment.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zsh/environment.zsh b/zsh/environment.zsh index 0183f728..6279c1fd 100755 --- a/zsh/environment.zsh +++ b/zsh/environment.zsh @@ -47,4 +47,6 @@ esac export os -eval "$(direnv hook zsh)" +if [[ $commands[direnv] ]] + eval "$(direnv hook zsh)" +fi -- cgit 1.4.1 From db9f688ce7596d8a25a85599a7eaa6911c60aff4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Apr 2014 20:08:36 +0100 Subject: zsh: Fix typo in previous commit --- zsh/environment.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/environment.zsh b/zsh/environment.zsh index 6279c1fd..1519419a 100755 --- a/zsh/environment.zsh +++ b/zsh/environment.zsh @@ -47,6 +47,6 @@ esac export os -if [[ $commands[direnv] ]] +if [[ -z $commands[direnv] ]] eval "$(direnv hook zsh)" fi -- cgit 1.4.1 From 70dbdab03afdd27279c300bf3c3ff4b90e183bc6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Apr 2014 20:10:05 +0100 Subject: Use correct switch for testing commands --- install | 2 +- zsh/environment.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/install b/install index 20e72e5a..9176902c 100755 --- a/install +++ b/install @@ -49,7 +49,7 @@ then install-dot projects/dwm/ $target/dwm/* fi -if [[ -z $commands[emacs] ]] +if [[ -s $commands[emacs] ]] then emacs --batch --eval '(batch-byte-recompile-directory 0)' ~/.emacs.d/ fi diff --git a/zsh/environment.zsh b/zsh/environment.zsh index 1519419a..49e9b213 100755 --- a/zsh/environment.zsh +++ b/zsh/environment.zsh @@ -47,6 +47,6 @@ esac export os -if [[ -z $commands[direnv] ]] +if [[ -s $commands[direnv] ]] eval "$(direnv hook zsh)" fi -- cgit 1.4.1 From dd8e8706a3e350b9109cb3801b0bbaf640182fdd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Apr 2014 20:11:08 +0100 Subject: zsh: Add missing 'then' --- zsh/environment.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/zsh/environment.zsh b/zsh/environment.zsh index 49e9b213..11932e6e 100755 --- a/zsh/environment.zsh +++ b/zsh/environment.zsh @@ -48,5 +48,6 @@ esac export os if [[ -s $commands[direnv] ]] +then eval "$(direnv hook zsh)" fi -- cgit 1.4.1 From cb1f29d5616c9d35555114bc39d92167b92c0b88 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Apr 2014 09:55:55 +0100 Subject: zsh: Remove old hosts from completion array --- zsh/interactive.zsh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/zsh/interactive.zsh b/zsh/interactive.zsh index f047f215..365214c9 100755 --- a/zsh/interactive.zsh +++ b/zsh/interactive.zsh @@ -24,11 +24,6 @@ hosts=( prefect alanpearce.co.uk home.alanpearce.co.uk - lethalrocks.uk.to - alphapulsar.uk.to - st.alphapulsar.uk.to - a.st.alphapulsar.uk.to - st ) users=(alan root toor) -- cgit 1.4.1 From 9af328c35585b40c418191772da083650e5be18d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Apr 2014 09:56:16 +0100 Subject: Xresources: add emacs font config on Prefect --- xresources/prefect | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xresources/prefect b/xresources/prefect index c4c6a78c..b8cb7f0b 100644 --- a/xresources/prefect +++ b/xresources/prefect @@ -1 +1,4 @@ #include "main" + +Emacs.Font: -*-Droid Sans Mono-medium-*-*-*-*-120-*-*-*-*-*-* +Emacs.fixed-pitch.attributeFont: -*-Droid Sans Mono-medium-*-*-*-*-120-*-*-*-*-*-* -- cgit 1.4.1 From 9dd9b2972c4c526109f4fb57f936b67290ace003 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Apr 2014 09:56:37 +0100 Subject: Rename gitignore for better linking --- gitconfig | 2 +- gitignore | 29 +++++++++++++++++++++++++++++ global.gitignore | 29 ----------------------------- 3 files changed, 30 insertions(+), 30 deletions(-) create mode 100644 gitignore delete mode 100644 global.gitignore diff --git a/gitconfig b/gitconfig index 0915a234..7c21d74f 100644 --- a/gitconfig +++ b/gitconfig @@ -22,4 +22,4 @@ [diff] algorithm = patience [core] - excludesfile = ~/projects/dotfiles/global.gitignore + excludesfile = ~/.gitignore diff --git a/gitignore b/gitignore new file mode 100644 index 00000000..7e23dcab --- /dev/null +++ b/gitignore @@ -0,0 +1,29 @@ +.DS_Store +.AppleDouble +.LSOverride +Icon +Desktop.ini + +# Thumbnails +._* +Thumbs.db + +# Emacs +*~ +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +.elc +auto-save-list +tramp +.\#* + +.envrc + +# Org-mode +.org-id-locations +*_archive + +GPATH +GRTAGS +GTAGS \ No newline at end of file diff --git a/global.gitignore b/global.gitignore deleted file mode 100644 index 7e23dcab..00000000 --- a/global.gitignore +++ /dev/null @@ -1,29 +0,0 @@ -.DS_Store -.AppleDouble -.LSOverride -Icon -Desktop.ini - -# Thumbnails -._* -Thumbs.db - -# Emacs -*~ -\#*\# -/.emacs.desktop -/.emacs.desktop.lock -.elc -auto-save-list -tramp -.\#* - -.envrc - -# Org-mode -.org-id-locations -*_archive - -GPATH -GRTAGS -GTAGS \ No newline at end of file -- cgit 1.4.1 From 81c8016d1e296ed91af69f2d5bf435d7d657af04 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Apr 2014 13:15:53 +0100 Subject: Restructure everything to use rcm https://github.com/thoughtbot/rcm --- atoprc | 2 - dwm/config.h | 106 -- emacs/Cask | 74 -- emacs/elisp/ap-functions.el | 47 - emacs/elisp/php-electric.el | 218 ---- emacs/elisp/shuffle-lines.el | 20 - emacs/elisp/xrdb-mode.el | 544 --------- emacs/init.el | 1170 -------------------- git-hooks/post-merge | 2 - gitconfig | 25 - gitignore | 29 - hgrc | 9 - host-prefect/Xresources | 4 + minttyrc | 33 - ssh/rc | 5 - tag-atop/atoprc | 2 + tag-dwm/dwm/config.h | 106 ++ tag-emacs/emacs.d/Cask | 74 ++ tag-emacs/emacs.d/elisp/ap-functions.el | 47 + tag-emacs/emacs.d/elisp/php-electric.el | 218 ++++ tag-emacs/emacs.d/elisp/shuffle-lines.el | 20 + tag-emacs/emacs.d/elisp/xrdb-mode.el | 544 +++++++++ tag-emacs/emacs.d/init.el | 1170 ++++++++++++++++++++ tag-git/config/git/config | 25 + tag-git/config/git/ignore | 29 + tag-hg/hgrc | 9 + tag-minttyrc/minttyrc | 33 + tag-ssh/ssh/rc | 5 + tag-tmux/tmux.conf | 19 + tag-xbindkeys/xbindkeysrc.scm | 57 + tag-xmobar/xmobarrc | 40 + tag-xresources/xresources/main | 33 + tag-xresources/xresources/solarized-light | 70 ++ tag-zsh/config/zsh/completion/_tmux_pane_words | 10 + tag-zsh/config/zsh/fasd.zsh | 85 ++ tag-zsh/config/zsh/freebsd.zsh | 8 + tag-zsh/config/zsh/functions/fasd/fasd | 624 +++++++++++ .../config/zsh/functions/pure/prompt_pure_setup | 118 ++ tag-zsh/config/zsh/functions/runit/_sv | 7 + tag-zsh/config/zsh/functions/runit/getservicedir | 2 + tag-zsh/config/zsh/functions/runit/linksv | 16 + tag-zsh/config/zsh/functions/runit/renamesv | 36 + tag-zsh/config/zsh/prefect.zsh | 10 + tag-zsh/config/zsh/server.zsh | 20 + tag-zsh/config/zsh/zlogin | 0 tag-zsh/config/zsh/zlogout | 0 tag-zsh/config/zsh/zshenv | 53 + tag-zsh/config/zsh/zshrc | 362 ++++++ tag-zsh/fasdrc | 8 + tag-zsh/zshenv | 3 + tmux.conf | 19 - xbindkeysrc.scm | 57 - xmobarrc | 40 - xresources/main | 33 - xresources/prefect | 4 - xresources/solarized-light | 70 -- zsh/completion/_tmux_pane_words | 10 - zsh/environment.zsh | 53 - zsh/fasd.zsh | 85 -- zsh/fasdrc | 8 - zsh/freebsd.zsh | 8 - zsh/functions/fasd/fasd | 624 ----------- zsh/functions/pure/prompt_pure_setup | 118 -- zsh/functions/runit/_sv | 7 - zsh/functions/runit/getservicedir | 2 - zsh/functions/runit/linksv | 16 - zsh/functions/runit/renamesv | 36 - zsh/interactive.zsh | 362 ------ zsh/login.zsh | 0 zsh/logout.zsh | 0 zsh/prefect.zsh | 10 - zsh/server.zsh | 20 - 72 files changed, 3867 insertions(+), 3866 deletions(-) delete mode 100644 atoprc delete mode 100644 dwm/config.h delete mode 100644 emacs/Cask delete mode 100644 emacs/elisp/ap-functions.el delete mode 100644 emacs/elisp/php-electric.el delete mode 100644 emacs/elisp/shuffle-lines.el delete mode 100644 emacs/elisp/xrdb-mode.el delete mode 100644 emacs/init.el delete mode 100755 git-hooks/post-merge delete mode 100644 gitconfig delete mode 100644 gitignore delete mode 100644 hgrc create mode 100644 host-prefect/Xresources delete mode 100644 minttyrc delete mode 100644 ssh/rc create mode 100644 tag-atop/atoprc create mode 100644 tag-dwm/dwm/config.h create mode 100644 tag-emacs/emacs.d/Cask create mode 100644 tag-emacs/emacs.d/elisp/ap-functions.el create mode 100644 tag-emacs/emacs.d/elisp/php-electric.el create mode 100644 tag-emacs/emacs.d/elisp/shuffle-lines.el create mode 100644 tag-emacs/emacs.d/elisp/xrdb-mode.el create mode 100644 tag-emacs/emacs.d/init.el create mode 100644 tag-git/config/git/config create mode 100644 tag-git/config/git/ignore create mode 100644 tag-hg/hgrc create mode 100644 tag-minttyrc/minttyrc create mode 100644 tag-ssh/ssh/rc create mode 100644 tag-tmux/tmux.conf create mode 100644 tag-xbindkeys/xbindkeysrc.scm create mode 100644 tag-xmobar/xmobarrc create mode 100644 tag-xresources/xresources/main create mode 100644 tag-xresources/xresources/solarized-light create mode 100644 tag-zsh/config/zsh/completion/_tmux_pane_words create mode 100644 tag-zsh/config/zsh/fasd.zsh create mode 100755 tag-zsh/config/zsh/freebsd.zsh create mode 100755 tag-zsh/config/zsh/functions/fasd/fasd create mode 100644 tag-zsh/config/zsh/functions/pure/prompt_pure_setup create mode 100644 tag-zsh/config/zsh/functions/runit/_sv create mode 100644 tag-zsh/config/zsh/functions/runit/getservicedir create mode 100644 tag-zsh/config/zsh/functions/runit/linksv create mode 100644 tag-zsh/config/zsh/functions/runit/renamesv create mode 100644 tag-zsh/config/zsh/prefect.zsh create mode 100644 tag-zsh/config/zsh/server.zsh create mode 100755 tag-zsh/config/zsh/zlogin create mode 100755 tag-zsh/config/zsh/zlogout create mode 100755 tag-zsh/config/zsh/zshenv create mode 100755 tag-zsh/config/zsh/zshrc create mode 100644 tag-zsh/fasdrc create mode 100644 tag-zsh/zshenv delete mode 100644 tmux.conf delete mode 100644 xbindkeysrc.scm delete mode 100644 xmobarrc delete mode 100644 xresources/main delete mode 100644 xresources/prefect delete mode 100644 xresources/solarized-light delete mode 100644 zsh/completion/_tmux_pane_words delete mode 100755 zsh/environment.zsh delete mode 100644 zsh/fasd.zsh delete mode 100644 zsh/fasdrc delete mode 100755 zsh/freebsd.zsh delete mode 100755 zsh/functions/fasd/fasd delete mode 100644 zsh/functions/pure/prompt_pure_setup delete mode 100644 zsh/functions/runit/_sv delete mode 100644 zsh/functions/runit/getservicedir delete mode 100644 zsh/functions/runit/linksv delete mode 100644 zsh/functions/runit/renamesv delete mode 100755 zsh/interactive.zsh delete mode 100755 zsh/login.zsh delete mode 100755 zsh/logout.zsh delete mode 100644 zsh/prefect.zsh delete mode 100644 zsh/server.zsh diff --git a/atoprc b/atoprc deleted file mode 100644 index d03319ea..00000000 --- a/atoprc +++ /dev/null @@ -1,2 +0,0 @@ -flags Aa -maxlinecpu 0 \ No newline at end of file diff --git a/dwm/config.h b/dwm/config.h deleted file mode 100644 index ae1d8bb3..00000000 --- a/dwm/config.h +++ /dev/null @@ -1,106 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -/* appearance */ -static const char font[] = "-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*"; -static const char normbordercolor[] = "#657b83"; -static const char normbgcolor[] = "#002b36"; -static const char normfgcolor[] = "#fdf6e3"; -static const char selbordercolor[] = "#859900"; -static const char selbgcolor[] = "#586e75"; -static const char selfgcolor[] = "#fdf6e3"; -static const unsigned int borderpx = 1; /* border pixel of windows */ -static const unsigned int snap = 32; /* snap pixel */ -static const Bool showbar = True; /* False means no bar */ -static const Bool topbar = True; /* False means bottom bar */ - -/* tagging */ -static const char *tags[] = { "shell", "code", "web", "misc" }; - -static const Rule rules[] = { - /* class instance title tags mask isfloating monitor */ - { "Firefox", NULL, NULL, 1 << 2, False, -1 }, - { "URxvt", NULL, NULL, 1 << 0, False, -1 }, - { "Emacs", "emacs", NULL, 1 << 1, False, -1 }, - { "KeePass2", NULL, NULL, 1 << 3, False, -1 }, - { "deadbeef", NULL, NULL, 1 << 3, False, -1 }, - { "Emacs", "Ediff", NULL, 0, True, -1 }, -}; - -/* layout(s) */ -static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ -static const int nmaster = 1; /* number of clients in master area */ -static const Bool resizehints = True; /* True means respect size hints in tiled resizals */ - -static const Layout layouts[] = { - /* symbol arrange function */ - { "[]=", tile }, /* first entry is default */ - { "><>", NULL }, /* no layout function means floating behavior */ - { "[M]", monocle }, -}; - -/* key definitions */ -#define MODKEY Mod4Mask -#define TAGKEYS(KEY,TAG) \ - { MODKEY, KEY, toggleview, {.ui = 1 << TAG} }, \ - { MODKEY|ControlMask, KEY, view, {.ui = 1 << TAG} }, \ - { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ - { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, - -/* helper for spawning shell commands in the pre dwm-5.0 fashion */ -#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } - -/* commands */ -static const char *termcmd[] = { "urxvt", NULL }; - -static Key keys[] = { - /* modifier key function argument */ - { MODKEY|ShiftMask, XK_b, togglebar, {0} }, - { MODKEY, XK_e, focusstack, {.i = +1 } }, - { MODKEY, XK_i, focusstack, {.i = -1 } }, - { MODKEY, XK_s, incnmaster, {.i = +1 } }, - { MODKEY, XK_r, incnmaster, {.i = -1 } }, - { MODKEY, XK_n, setmfact, {.f = -0.05} }, - { MODKEY, XK_o, setmfact, {.f = +0.05} }, - { MODKEY, XK_Return, zoom, {0} }, - { MODKEY, XK_Tab, view, {0} }, - { MODKEY|ShiftMask, XK_c, killclient, {0} }, - { MODKEY, XK_g, setlayout, {.v = &layouts[0]} }, - { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, - { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, - { MODKEY, XK_space, setlayout, {0} }, - { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, - { MODKEY, XK_0, view, {.ui = ~0 } }, - { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, - { MODKEY, XK_comma, focusmon, {.i = -1 } }, - { MODKEY, XK_period, focusmon, {.i = +1 } }, - { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, - { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, - TAGKEYS( XK_1, 0) - TAGKEYS( XK_2, 1) - TAGKEYS( XK_3, 2) - TAGKEYS( XK_4, 3) - TAGKEYS( XK_5, 4) - TAGKEYS( XK_6, 5) - TAGKEYS( XK_7, 6) - TAGKEYS( XK_8, 7) - TAGKEYS( XK_9, 8) - { MODKEY|ShiftMask, XK_q, quit, {0} }, - { MODKEY|ShiftMask, XK_r, quit, { .i = 5 } }, -}; - -/* button definitions */ -/* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ -static Button buttons[] = { - /* click event mask button function argument */ - { ClkLtSymbol, 0, Button1, setlayout, {0} }, - { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, - { ClkWinTitle, 0, Button2, zoom, {0} }, - { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, - { ClkClientWin, MODKEY, Button1, movemouse, {0} }, - { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, - { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, - { ClkTagBar, 0, Button1, toggleview, {0} }, - { ClkTagBar, 0, Button3, view, {0} }, - { ClkTagBar, MODKEY, Button1, tag, {0} }, - { ClkTagBar, MODKEY, Button3, toggletag, {0} }, -}; diff --git a/emacs/Cask b/emacs/Cask deleted file mode 100644 index 8742df0f..00000000 --- a/emacs/Cask +++ /dev/null @@ -1,74 +0,0 @@ -(source org) -(source melpa) -(source marmalade) -(source gnu) - -(depends-on "ace-jump-mode") -(depends-on "ag") -(depends-on "auto-compile") -(depends-on "auto-indent-mode") -(depends-on "autopair") -(depends-on "bind-key") -(depends-on "cask") -(depends-on "cdnjs") -(depends-on "company") -(depends-on "confluence") -(depends-on "control-mode") -(depends-on "dash") -(depends-on "dash-at-point") -(depends-on "deferred") -(depends-on "diff-hl") -(depends-on "diminish") -(depends-on "dired+") -(depends-on "discover") -(depends-on "emmet-mode") -(depends-on "epl") -(depends-on "expand-region") -(depends-on "f") -(depends-on "flx") -(depends-on "flx-ido") -(depends-on "framemove") -(depends-on "geiser") -(depends-on "ggtags") -(depends-on "git-commit-mode") -(depends-on "git-rebase-mode") -(depends-on "god-mode") -(depends-on "haskell-mode") -(depends-on "helm") -(depends-on "ido-vertical-mode") -(depends-on "jinja2-mode") -(depends-on "js2-mode") -(depends-on "lua-mode") -(depends-on "magit") -(depends-on "makey") -(depends-on "multi-term") -(depends-on "multiple-cursors") -(depends-on "mustache-mode") -(depends-on "nginx-mode") -(depends-on "org-jira") -(depends-on "org-journal") -(depends-on "org-plus-contrib") -(depends-on "packed") -(depends-on "pallet") -(depends-on "paredit") -(depends-on "php-extras") -(depends-on "php-mode") -(depends-on "pkg-info") -(depends-on "project-persist") -(depends-on "projectile") -(depends-on "puppet-mode") -(depends-on "quickrun") -(depends-on "redshank") -(depends-on "s") -(depends-on "simple-httpd") -(depends-on "skewer-mode") -(depends-on "smart-tab") -(depends-on "smart-tabs-mode") -(depends-on "smex") -(depends-on "solarized-theme") -(depends-on "tup-mode") -(depends-on "undo-tree") -(depends-on "use-package") -(depends-on "web-mode") -(depends-on "xml-rpc") -(depends-on "yaml-mode") \ No newline at end of file diff --git a/emacs/elisp/ap-functions.el b/emacs/elisp/ap-functions.el deleted file mode 100644 index bdc7faef..00000000 --- a/emacs/elisp/ap-functions.el +++ /dev/null @@ -1,47 +0,0 @@ -;;;###autoload -(defun ap/remove-extra-cr () - "Remove extraneous CR codes from a file" - (interactive) - (save-excursion - (goto-char (point-min)) - (while (search-forward " -" nil t) - (replace-match "")))) - -;;;###autoload -(defun copy-rectangle (start end) - "Copy the region-rectangle." - (interactive "r") - (setq killed-rectangle (extract-rectangle start end))) - -;;;###autoload -(defun eval-and-replace () - "Replace the preceding sexp with its value." - (interactive) - (backward-kill-sexp) - (condition-case nil - (prin1 (eval (read (current-kill 0))) - (current-buffer)) - (error (message "Invalid expression") - (insert (current-kill 0))))) - -;;;###autoload -(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))) - -;;;###autoload -(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))) - -(provide 'ap-functions) diff --git a/emacs/elisp/php-electric.el b/emacs/elisp/php-electric.el deleted file mode 100644 index 599b2b1d..00000000 --- a/emacs/elisp/php-electric.el +++ /dev/null @@ -1,218 +0,0 @@ -;; -*- Emacs-Lisp -*- -;; -;; php-electric.el --- electric submode for the php-mode -;; -;; Version: 1.0 -;; Release-Date: Sunday 04 March 2007 -;; -;; Copyright (C) 2007 -;; by Nikolay V. Nemshilov aka St. -;; -;; -;; License -;; -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License -;; as published by the Free Software Foundation; either version 2 -;; of the License, or (at your option) any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this program; if not, write to the Free Software -;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -;; -;; -;; Features: -;; * autocompletion of the language contructions -;; such as if, for, foreach, etc blocks, -;; -;; * autocompletion of classes, interfaces and functions -;; definitions -;; -;; * autocompletion of the paired symbols, like [], (), "",'' -;; -;; -;; Usage: -;; Nothing magical, just place the file in a directory where -;; Emacs can find it, and write -;; -;; (require 'php-electric) -;; -;; in your configuration files ~/.emacs or wherever you keep it. -;; Then you can switch on/off the mode by the following command -;; -;; M-x php-electric-mode -;; -;; If you like to have it switched on automatically, you should -;; put the command in your php-mode hook or create new one, -;; like that -;; -;; (add-hook 'php-mode-hook '(lambda () (php-electric-mode))) -;; -;; That's it. -;; -;; -;; Changelog: -;; Sunday 04 March 2007 -;; The first version 1.0 has been came out. -;; - -(defgroup php-electric nil - "Minor php-electric mode" - :group 'php) - -;; list of keywords which expandible by the {} pair -(defconst php-electric-expandible-simple-re - "\\(try\\|else\\|do\\)") - -;; list of keywords which expandible with the (){} construction -(defconst php-electric-expandible-as-struct-re - "\\(while\\|for\\|foreach\\|if\\|elseif\\|catch\\)") - -;; list of keywords which expandible with the name(){} construction -(defconst php-electric-expandible-as-func-re - "\\(function\\)") - -;; list of keywords which expandible with the name{} construction -(defconst php-electric-expandible-as-class-re - "\\(class\\|interface\\)") - -;; list of the paired chars -(defvar php-electric-matching-delimeter-alist - '((?\[ . ?\]) - (?\( . ?\)) - (?\" . ?\") - (?\' . ?\'))) - -;; the minor-mode definition -(define-minor-mode php-electric-mode - "Minor electric-mode for the php-mode" - nil - "-El" - php-mode-map - (php-electric-keymap)) - -;; list of accessible keys -(defun php-electric-keymap() - (define-key php-mode-map " " 'php-electric-space) - (define-key php-mode-map "{" 'php-electric-curlies) - (define-key php-mode-map "(" 'php-electric-brackets) - (define-key php-mode-map "[" 'php-electric-matching-char) - (define-key php-mode-map "\"" 'php-electric-matching-char) - (define-key php-mode-map "\'" 'php-electric-matching-char)) - -;; handler for the spaces insertions -(defun php-electric-space(arg) - (interactive "P") - (self-insert-command (prefix-numeric-value arg)) - (if (php-electric-is-code-at-point-p) - (if (php-electric-line-is-simple-expandible) - ;; inserting just a pair of curleis - (progn - (insert "{")(php-electric-insert-new-line-and-statement-end)) - (if (php-electric-line-is-expandible-as-struct) - ;; inserting a structure definition - (progn - (if (not (char-equal ?\( (preceding-char))) - ;; cmd () { - style construction - (progn - (insert "(")(set-register 98 (point-marker))(insert ") {")) - - ;; cmd( ){ - style construction - (progn - (insert " ")(set-register 98 (point-marker))(insert " ){"))) - (php-electric-insert-new-line-and-statement-end) - (jump-to-register 98)(set-register 98 nil)) - (if (php-electric-line-is-expandible-as-func) - ;; inserting the function expanding - (save-excursion - (insert "(){")(php-electric-insert-new-line-and-statement-end)) - (if (php-electric-line-is-expandible-as-class) - ;; inserting the class expanding - (save-excursion - (insert "{")(php-electric-insert-new-line-and-statement-end)))))))) - -;; handler for the { chars -(defun php-electric-curlies(arg) - (interactive "P") - (self-insert-command (prefix-numeric-value arg)) - (if (php-electric-is-code-at-point-p) - (progn - (php-electric-insert-new-line-and-statement-end)))) - -;; handler for the ( chars -(defun php-electric-brackets(arg) - (interactive "P") - - (if (php-electric-is-code-at-point-p) - ;; checking if it's a statement - (if (php-electric-line-is-expandible-as-struct) - (progn (php-electric-space arg)) - (progn (php-electric-matching-char arg))) - (self-insert-command (prefix-numeric-value arg)))) - -;; handler for the paired chars, [], (), "", '' -(defun php-electric-matching-char(arg) - (interactive "P") - (self-insert-command (prefix-numeric-value arg)) - (if (php-electric-is-code-at-point-p) - (save-excursion - (insert (cdr (assoc last-command-char - php-electric-matching-delimeter-alist)))))) - -;; checks if the current pointer situated in a piece of code -(defun php-electric-is-code-at-point-p() - (and php-electric-mode - (let* ((properties (text-properties-at (point)))) - (and (null (memq 'font-lock-string-face properties)) - (null (memq 'font-lock-comment-face properties)))))) - -;; checks if the current line expandible with a simple {} construction -(defun php-electric-line-is-simple-expandible() - (let* ((php-electric-expandible-simple-real-re - (concat php-electric-expandible-simple-re "\\s-$"))) - (save-excursion - (backward-word 1) - (looking-at php-electric-expandible-simple-real-re)))) - -;; checks if the current line expandible with the (){} construction -(defun php-electric-line-is-expandible-as-struct() - (let* ((php-electric-expandible-as-struct-real-re - (concat php-electric-expandible-as-struct-re "[ ]*$")) - (php-electric-expandible-as-struct-with-bracket-re - (concat php-electric-expandible-as-struct-re "($"))) - (save-excursion - (backward-word 1) - (or (looking-at php-electric-expandible-as-struct-real-re) - (looking-at php-electric-expandible-as-struct-with-bracket-re))))) - -;; checks if the current line expandible with the name(){} construction -(defun php-electric-line-is-expandible-as-func() - (let* ((php-electric-expandible-as-func-real-re - (concat php-electric-expandible-as-func-re "\\s-$"))) - (save-excursion - (backward-word 1) - (looking-at php-electric-expandible-as-func-real-re)))) - -;; checks if the current line expandible with the name{} construction -(defun php-electric-line-is-expandible-as-class() - (let* ((php-electric-expandible-as-class-real-re - (concat php-electric-expandible-as-class-re "\\s-$"))) - (save-excursion - (backward-word 1) - (looking-at php-electric-expandible-as-class-real-re)))) - -;; "shortcut" to insert \n} construction -(defun php-electric-insert-new-line-and-statement-end() - (newline-and-indent)(set-register 99 (point-marker)) - (insert "\n}")(indent-according-to-mode) - (jump-to-register 99)(set-register 99 nil)) - - -(provide 'php-electric) - -;; end of the file \ No newline at end of file diff --git a/emacs/elisp/shuffle-lines.el b/emacs/elisp/shuffle-lines.el deleted file mode 100644 index be0a98f9..00000000 --- a/emacs/elisp/shuffle-lines.el +++ /dev/null @@ -1,20 +0,0 @@ -;;;###autoload -(defun move-line-down () - (interactive) - (let ((col (current-column))) - (save-excursion - (forward-line) - (transpose-lines 1)) - (forward-line) - (move-to-column col))) - -;;;###autoload -(defun move-line-up () - (interactive) - (let ((col (current-column))) - (save-excursion - (forward-line) - (transpose-lines -1)) - (move-to-column col))) - -(provide 'shuffle-lines) diff --git a/emacs/elisp/xrdb-mode.el b/emacs/elisp/xrdb-mode.el deleted file mode 100644 index 712f0cbf..00000000 --- a/emacs/elisp/xrdb-mode.el +++ /dev/null @@ -1,544 +0,0 @@ -;;; xrdb-mode.el --- mode for editing X resource database files - -;; Copyright (C) 1998,1999,2000 Free Software Foundation, Inc. - -;; Author: 1994-2003 Barry A. Warsaw -;; Maintainer: barry@python.org -;; Created: May 1994 -;; Keywords: data languages - -(defconst xrdb-version "2.31" - "`xrdb-mode' version number.") - -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License -;; as published by the Free Software Foundation; either version 2 -;; of the License, or (at your option) any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this program; if not, write to the Free Software -;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -;;; Commentary: -;; -;; This file provides a major mode for editing X resource database -;; files. It includes font-lock definitions and commands for -;; controlling indentation, re-indenting by subdivisions, and loading -;; and merging into the the resource database. -;; -;; To use, put the following in your .emacs: -;; -;; (autoload 'xrdb-mode "xrdb-mode" "Mode for editing X resource files" t) -;; -;; You may also want something like: -;; -;; (setq auto-mode-alist -;; (append '(("\\.Xdefaults$" . xrdb-mode) -;; ("\\.Xenvironment$" . xrdb-mode) -;; ("\\.Xresources$" . xrdb-mode) -;; ("*.\\.ad$" . xrdb-mode) -;; ) -;; auto-mode-alist)) - -;;; Credits: -;; -;; The database merge feature was inspired by Joel N. Weber II. -;; -;; The canonical Web site for xrdb-mode is -;; - -;;; Code: -(require 'custom) - - - -(defgroup xrdb nil - "Support for editing X resource database files" - :group 'languages) - -(defcustom xrdb-mode-hook nil - "*Hook to be run when `xrdb-mode' is entered." - :type 'hook - :group 'xrdb) - -(defcustom xrdb-subdivide-by 'paragraph - "*Default alignment subdivision when re-indenting a region or buffer. -This variable controls how much of the buffer is searched to find a -goal column on which to align. Every non-comment line in the region -defined by this variable is scanned for the first `:' character on the -line, and this character's column is the line's goal column. The -rightmost line goal column in the region is taken as the region's goal -column. - -This variable can take one of the following symbol values: - - `buffer' - All lines in the buffer are scanned. This is the - slowest option. - - `paragraph' - All lines in the paragraph are scanned. Paragraphs - are delimited by blank lines, comment lines, and page - delimiters. - - `page' - All lines in the page are scanned. Pages are delimited - with `page-delimiter', usually ^L (control-L). - - `line' - Only the previous non-comment line is scanned. This is - the fastest method. - -This variable is used by the various indentation commands, and can be -overridden in those commands by using \\[universal-argument]." - :type '(radio (const :tag "Do not subdivide buffer" buffer) - (const :tag "Subdivide by paragraphs" paragraph) - (const :tag "Subdivide by pages" page) - (const :tag "Each line is independent" line)) - :group 'xrdb) - -(defcustom xrdb-compress-whitespace nil - "*Collapse all whitespace to a single space after insertion of `:'." - :type 'boolean - :group 'xrdb) - -(defcustom xrdb-program "xrdb" - "*Program to run to load or merge resources in the X resource database." - :type 'string - :group 'xrdb) - -(defcustom xrdb-program-args '("-merge") - "*List of string arguments to pass to `xrdb-program'." - :type '(repeat string) - :group 'xrdb) - -(defvar xrdb-master-file nil - "If non-nil, merge in the named file instead of the buffer's file. -The intent is to allow you to set this variable in the file's local -variable section, e.g.: - - ! Local Variables: - ! xrdb-master-file: \"Xdefaults\" - ! End: - -so that typing \\[xrdb-database-merge-buffer-or-region] in that buffer -merges the named master file instead of the buffer's file. Note that -if the file name has a relative path, the `default-directory' for the -buffer is prepended to come up with a file name. - -You may also want to set `xrdb-program-args' in the local variables -section as well.") -(make-variable-buffer-local 'xrdb-master-file) - - -;; Non-user customizable -(defconst xrdb-comment-re "^[ \t]*[!]" - "Regular expression describing the beginning of a comment line.") - - - -;; utilities -(defun xrdb-point (position) - ;; Returns the value of point at certain commonly referenced POSITIONs. - ;; POSITION can be one of the following symbols: - ;; - ;; bol -- beginning of line - ;; eol -- end of line - ;; bod -- beginning of defun - ;; boi -- back to indentation - ;; ionl -- indentation of next line - ;; iopl -- indentation of previous line - ;; bonl -- beginning of next line - ;; bopl -- beginning of previous line - ;; bop -- beginning of paragraph - ;; eop -- end of paragraph - ;; bopg -- beginning of page - ;; eopg -- end of page - ;; - ;; This function does not modify point or mark. - (let ((here (point))) - (cond - ((eq position 'bod) (beginning-of-defun)) - ((eq position 'bol) (beginning-of-line)) - ((eq position 'eol) (end-of-line)) - ((eq position 'boi) (back-to-indentation)) - ((eq position 'bonl) (forward-line 1)) - ((eq position 'bopl) (forward-line -1)) - ((eq position 'bop) (forward-paragraph -1)) - ((eq position 'eop) (forward-paragraph 1)) - ((eq position 'bopg) (forward-page -1)) - ((eq position 'eopg) (forward-page 1)) - (t - (error "unknown buffer position requested: %s" position))) - (prog1 - (point) - (goto-char here)) - )) - -(defmacro xrdb-safe (&rest body) - ;; safely execute BODY, return nil if an error occurred - `( (condition-case nil - (progn (,@ body)) - (error nil)))) - -(defsubst xrdb-skip-to-separator () - ;; skip forward from the beginning of the line to the separator - ;; character as given by xrdb-separator-char. Returns t if the - ;; char was found, otherwise, nil. - (beginning-of-line) - (skip-chars-forward "^:" (xrdb-point 'eol)) - (and (eq (char-after) ?:) - (current-column))) - -(defsubst xrdb-in-comment-p (&optional lim) - (let* ((lim (or lim (xrdb-point 'bod))) - (state (parse-partial-sexp lim (point)))) - (nth 4 state))) - -(defsubst xrdb-boi-col () - (let ((here (point))) - (goto-char (xrdb-point 'boi)) - (prog1 - (current-column) - (goto-char here)))) - -(defvar xrdb-prompt-history nil) - -(defun xrdb-prompt-for-subdivision () - (let ((options '(("buffer" . buffer) - ("paragraphs" . paragraph) - ("pages" . page) - ("lines" . line))) - (completion-ignore-case t)) - (cdr (assoc - (completing-read "Subdivide alignment by? " options nil t - (cons (format "%s" xrdb-subdivide-by) 0) - 'xrdb-prompt-history) - options)))) - - -;; commands -(defun xrdb-electric-separator (arg) - "Insert a colon, and possibly indent line. -Numeric argument inserts that many separators. If the numeric -argument is not given, or is 1, and the separator is not inserted in a -comment, then the line is indented according to `xrdb-subdivide-by'." - (interactive "P") - (self-insert-command (prefix-numeric-value arg)) - ;; only do electric behavior if arg is not given - (or arg - (xrdb-in-comment-p) - (xrdb-indent-line)) - ;; compress whitespace - (and xrdb-compress-whitespace - (just-one-space))) - -(defun xrdb-electric-bang (arg) - "Insert an exclamation point to start a comment. -Numeric argument inserts that many exclamation characters. If the -numeric argument is not given, or is 1, and the bang character is the -first character on a line, the line is indented to column zero." - (interactive "P") - (let ((how-many (prefix-numeric-value arg))) - (self-insert-command how-many) - (save-excursion - (if (and (= how-many 1) - (xrdb-in-comment-p) - (memq (char-before (xrdb-point 'boi)) '(?\n nil))) - (indent-line-to 0))) - )) - - -(defun xrdb-indent-line (&optional arg) - "Align the current line according to `xrdb-subdivide-by'. -With optional \\[universal-argument], prompt for subdivision." - (interactive "P") - (xrdb-align-to-column - (xrdb-guess-goal-column (if arg - (xrdb-prompt-for-subdivision) - xrdb-subdivide-by)) - (xrdb-point 'bol) - (xrdb-point 'bonl))) - -(defun xrdb-indent-region (start end &optional arg) - "Indent all lines in the region according to `xrdb-subdivide-by'. -With optional \\[universal-argument], prompt for subdivision." - (interactive "r\nP") - (xrdb-align-to-column - (xrdb-guess-goal-column (if arg - (xrdb-prompt-for-subdivision) - xrdb-subdivide-by)) - start end)) - -(defun xrdb-indent-page (&optional arg) - "Indent all lines in the page according to `xrdb-subdivide-by'. -With optional \\[universal-argument], prompt for subdivision." - (interactive "P") - (xrdb-align-to-column - (xrdb-guess-goal-column (if arg - (xrdb-prompt-for-subdivision) - xrdb-subdivide-by)) - (xrdb-point 'bopg) - (xrdb-point 'eopg))) - -(defun xrdb-indent-paragraph (&optional arg) - "Indent all lines in the paragraph according to `xrdb-subdivide-by'. -With optional \\[universal-argument], prompt for subdivision." - (interactive "P") - (xrdb-align-to-column - (xrdb-guess-goal-column (if arg - (xrdb-prompt-for-subdivision) - xrdb-subdivide-by)) - (xrdb-point 'bop) - (xrdb-point 'eop))) - -(defun xrdb-indent-buffer (&optional arg) - "Indent all lines in the buffer according to `xrdb-subdivide-by'. -With optional \\[universal-argument], prompt for subdivision." - (interactive "P") - (let ((subdivide-by (if arg - (xrdb-prompt-for-subdivision) - xrdb-subdivide-by))) - (save-excursion - (beginning-of-buffer) - (if (eq subdivide-by 'buffer) - (xrdb-align-to-column (xrdb-guess-goal-column 'buffer) - (point-min) (point-max)) - (let (mvfwdfunc indentfunc) - (cond - ((eq subdivide-by 'paragraph) - (setq mvfwdfunc 'forward-paragraph - indentfunc 'xrdb-indent-paragraph)) - ((eq subdivide-by 'page) - (setq mvfwdfunc 'forward-page - indentfunc 'xrdb-indent-page)) - ((eq subdivide-by 'line) - (setq mvfwdfunc 'forward-line - indentfunc 'xrdb-indent-page)) - (t (error "Illegal alignment subdivision: %s" subdivide-by)) - ) - (while (< (point) (point-max)) - (funcall indentfunc) - (funcall mvfwdfunc 1)) - ))))) - - -;; internal alignment functions -(defun xrdb-align-to-column (goalcol &optional start end) - (let ((start (or start (xrdb-point 'bol))) - (end (or end (xrdb-point 'bonl)))) - (save-excursion - (save-restriction - (narrow-to-region start end) - (beginning-of-buffer) - (while (< (point) (point-max)) - (if (and (not (looking-at xrdb-comment-re)) - (xrdb-skip-to-separator)) - (indent-line-to (max 0 (+ goalcol - (- (current-column)) - (xrdb-boi-col)) - ))) - (forward-line 1)) - )))) - -(defun xrdb-guess-goal-column (subdivide-by) - ;; Returns the goal column of the current line based on SUBDIVIDE-BY, - ;; which can be any value allowed by `xrdb-subdivide-by'. - (let ((here (point)) - (goalcol 0)) - (save-restriction - (cond - ((eq subdivide-by 'line) - (while (and (zerop (forward-line -1)) - (or (looking-at xrdb-comment-re) - (not (xrdb-skip-to-separator))))) - ;; maybe we didn't find one - (if (not (xrdb-skip-to-separator)) - (goto-char here)) - (narrow-to-region (xrdb-point 'bol) (xrdb-point 'bonl))) - ((eq subdivide-by 'page) - (narrow-to-page)) - ((eq subdivide-by 'paragraph) - (narrow-to-region (xrdb-point 'bop) (xrdb-point 'eop))) - ((eq subdivide-by 'buffer)) - (t (error "Illegal alignment subdivision: %s" subdivide-by))) - (goto-char (point-min)) - (while (< (point) (point-max)) - (if (and (not (looking-at xrdb-comment-re)) - (xrdb-skip-to-separator)) - (setq goalcol (max goalcol (- (current-column) (xrdb-boi-col))))) - (forward-line 1))) - (goto-char here) - goalcol)) - - - -;; major-mode stuff -(defvar xrdb-mode-abbrev-table nil - "Abbreviation table used in `xrdb-mode' buffers.") -(define-abbrev-table 'xrdb-mode-abbrev-table ()) - - -(defvar xrdb-mode-syntax-table nil - "Syntax table used in `xrdb-mode' buffers.") -(if xrdb-mode-syntax-table - nil - (setq xrdb-mode-syntax-table (make-syntax-table)) - (modify-syntax-entry ?! "<" xrdb-mode-syntax-table) - (modify-syntax-entry ?\\ "\\" xrdb-mode-syntax-table) - (modify-syntax-entry ?\n ">" xrdb-mode-syntax-table) - (modify-syntax-entry ?/ ". 14" xrdb-mode-syntax-table) - (modify-syntax-entry ?* "_ 23" xrdb-mode-syntax-table) - (modify-syntax-entry ?. "_" xrdb-mode-syntax-table) - (modify-syntax-entry ?# "_" xrdb-mode-syntax-table) - (modify-syntax-entry ?? "_" xrdb-mode-syntax-table) - (modify-syntax-entry ?< "(" xrdb-mode-syntax-table) - (modify-syntax-entry ?> ")" xrdb-mode-syntax-table) - ) - - -(defvar xrdb-mode-map () - "Keymap used in `xrdb-mode' buffers.") -(if xrdb-mode-map - () - (setq xrdb-mode-map (make-sparse-keymap)) - ;; make the separator key electric - (define-key xrdb-mode-map ":" 'xrdb-electric-separator) - (define-key xrdb-mode-map "!" 'xrdb-electric-bang) - (define-key xrdb-mode-map "\t" 'xrdb-indent-line) - (define-key xrdb-mode-map "\C-c\C-a" 'xrdb-indent-buffer) - (define-key xrdb-mode-map "\C-c\C-b" 'xrdb-submit-bug-report) - (define-key xrdb-mode-map "\C-c\C-c" 'xrdb-database-merge-buffer-or-region) - (define-key xrdb-mode-map "\C-c\C-p" 'xrdb-indent-paragraph) - (define-key xrdb-mode-map "\C-c\[" 'xrdb-indent-page) - (define-key xrdb-mode-map "\C-c\C-r" 'xrdb-indent-region) - ) - -;;;###autoload -(defun xrdb-mode () - "Major mode for editing xrdb config files" - (interactive) - (kill-all-local-variables) - (set-syntax-table xrdb-mode-syntax-table) - (setq major-mode 'xrdb-mode - mode-name "xrdb" - local-abbrev-table xrdb-mode-abbrev-table) - (use-local-map xrdb-mode-map) - (setq font-lock-defaults '(xrdb-font-lock-keywords)) - ;; local variables - (make-local-variable 'parse-sexp-ignore-comments) - (make-local-variable 'comment-start-skip) - (make-local-variable 'comment-start) - (make-local-variable 'comment-end) - (make-local-variable 'paragraph-start) - (make-local-variable 'paragraph-separate) - (make-local-variable 'paragraph-ignore-fill-prefix) - (make-local-variable 'indent-region-function) - ;; now set their values - (setq parse-sexp-ignore-comments t - comment-start-skip "![ \t]*" - comment-start "! " - comment-end "") - (setq indent-region-function 'xrdb-indent-region - paragraph-ignore-fill-prefix t - paragraph-start (concat "^[ \t]*$\\|^[ \t]*[!]\\|" page-delimiter) - paragraph-separate paragraph-start) - (run-hooks 'xrdb-mode-hook)) - - - -;; faces and font-locking -(defvar xrdb-option-name-face 'xrdb-option-name-face - "Face for option name on a line in an X resource db file") - -(defvar xrdb-option-value-face 'xrdb-option-value-face - "Face for option value on a line in an X resource db file") - -(make-face 'xrdb-option-name-face) -(make-face 'xrdb-option-value-face) - -(defun xrdb-font-lock-mode-hook () - (or (face-differs-from-default-p 'xrdb-option-name-face) - (copy-face 'font-lock-keyword-face 'xrdb-option-name-face)) - (or (face-differs-from-default-p 'xrdb-option-value-face) - (copy-face 'font-lock-string-face 'xrdb-option-value-face)) - (remove-hook 'font-lock-mode-hook 'xrdb-font-lock-mode-hook)) -(add-hook 'font-lock-mode-hook 'xrdb-font-lock-mode-hook) - -(defvar xrdb-font-lock-keywords - (list '("^[ \t]*\\([^\n:]*:\\)[ \t]*\\(.*\\)$" - (1 xrdb-option-name-face) - (2 xrdb-option-value-face))) - "Additional expressions to highlight in X resource db mode.") -(put 'xrdb-mode 'font-lock-defaults '(xrdb-font-lock-keywords)) - - - -;; merging and manipulating the X resource database -(defun xrdb-database-merge-buffer-or-region (start end) - "Merge the current buffer's resources into the X resource database. - -`xrdb-program' is the program to actually call, with the arguments -specified in `xrdb-program-args'. This latter can be set to do either -a merge or a load, etc. Also, if the file local variable -`xrdb-master-file' is non-nil, then it is merged instead of the -buffer's file. - -If the current region is active, it is merged instead of the buffer, -and this overrides any use of `xrdb-master-file'." - (interactive - ;; the idea here is that if the region is inactive, start and end - ;; will be nil, if not passed in programmatically - (list (xrdb-safe (and (mark) (region-beginning))) - (xrdb-safe (and (mark) (region-end))))) - (message "Merging with args: %s..." xrdb-program-args) - (let ((outbuf (get-buffer-create "*Shell Command Output*"))) - ;; I prefer the XEmacs way of doing this, but this is the easiest - ;; way to work in both XEmacs and Emacs. - (with-current-buffer outbuf (erase-buffer)) - (cond - ((and start end) - (apply 'call-process-region start end xrdb-program nil outbuf t - xrdb-program-args)) - (xrdb-master-file - (apply 'call-process xrdb-program xrdb-master-file outbuf t - xrdb-program-args)) - (t - (apply 'call-process-region (point-min) (point-max) xrdb-program - nil outbuf t xrdb-program-args))) - (if (not (zerop (with-current-buffer outbuf (buffer-size)))) - (pop-to-buffer outbuf))) - (message "Merging... done")) - - - -;; submitting bug reports - -(defconst xrdb-mode-help-address "tools-help@python.org" - "Address for xrdb-mode bug reports.") - -(defun xrdb-submit-bug-report () - "Submit via mail a bug report on xrdb-mode." - (interactive) - ;; load in reporter - (require 'reporter) - (let ((reporter-prompt-for-summary-p t) - (varlist '(xrdb-subdivide-by - xrdb-mode-hook - xrdb-compress-whitespace - ))) - (and (if (y-or-n-p "Do you want to submit a report on xrdb-mode? ") - t - (message "") - nil) - (require 'reporter) - (reporter-submit-bug-report - xrdb-mode-help-address - (format "xrdb-mode %s" xrdb-version) - varlist nil nil "Dear Barry,") - ))) - - -(provide 'xrdb-mode) -;;; xrdb-mode.el ends here diff --git a/emacs/init.el b/emacs/init.el deleted file mode 100644 index 76505ad5..00000000 --- a/emacs/init.el +++ /dev/null @@ -1,1170 +0,0 @@ -;; -*- lexical-binding: t; -*- -;;;; Startup -;; Do not merge echo-area-message sexp -(setq inhibit-startup-echo-area-message "alan") -(setq inhibit-startup-screen t - initial-scratch-message "" - initial-major-mode 'text-mode - user-mail-address "alan@alanpearce.co.uk" - user-full-name "Alan Pearce" - custom-file "~/.emacs.d/custom.el") - -(load custom-file :noerror) - -;;; Allow lisps to use a common setup. I don't know why they don't have some lispy mode as their parent, but this is close enough -(defcustom lisp-common-mode-hook nil - "Hook run when entering any Lisp mode." - :type 'hook - :group 'lisp) - -;;;; Environment & Location - -(defun env/get-location () - "Return the physical location of the system, or `nil' if unknown" - (if (executable-find "netctl") - (catch 'found - (mapc (lambda (line) - (cond - ((string-prefix-p "* home" line) (throw 'found 'home)) - ((string-prefix-p "* work" line) (throw 'found 'work)))) - (process-lines "netctl" "list")) - nil))) - -(defun env/get-system-type () - "Return the type of computer that is running" - (cond - ((string-prefix-p "prefect" system-name) 'desktop) - ((string-prefix-p "server" system-name) 'server) - ((string-prefix-p "sheldon" system-name) 'laptop))) - -(defvar env/location (env/get-location) - "The type of location the system is located in -Values: `work', `home'") - -(defvar env/system-type (env/get-system-type) - "The type of computer Emacs is running on -Values: `desktop', `server', `laptop'") - -(defun env/recheck-location () - (interactive) - (setq env/location (env/get-location))) - -(defvar *init-file* - (when user-init-file - (expand-file-name "init.el" - (file-name-directory (file-truename user-init-file)))) - "Where the emacs init file really is, passing through symlinks.") - -;;;; Package Management -(add-to-list 'load-path (expand-file-name "elisp/" user-emacs-directory)) - -(let ((cask-dir (expand-file-name "~/.cask"))) - (if (file-exists-p cask-dir) - (progn - (add-to-list 'load-path cask-dir) - (require 'cask) - (cask-initialize)) - (eval-and-compile - (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") - ("marmalade" . "http://marmalade-repo.org/packages/") - ("melpa" . "http://melpa.milkbox.net/packages/") - ("org" . "http://orgmode.org/elpa/"))) - (package-initialize)) - - (when (not package-archive-contents) - (package-refresh-contents)) - - (mapc (lambda (package-name) - (unless (package-installed-p package-name) - (package-install package-name))) - '(bind-key - diminish - use-package)))) - -(require 'use-package) - -;;;; Style - -(use-package linum - :config (setq linum-format " %4d ")) - -(use-package highlight-symbol - :disabled t - :config (setq highlight-symbol-idle-delay 0.2)) - -(use-package whitespace - :config (setq whitespace-style - '(face - space - tabs - trailing - newline - empty - space-after-tab - tab-mark - space-before-tab - indentation - indentation::space - indentation::tabs))) - -(global-font-lock-mode t) -;; Allow font-lock-mode to do background parsing -(setq jit-lock-stealth-time 1 - jit-lock-stealth-load 100 - jit-lock-chunk-size 1000 - jit-lock-defer-time 0.01) - -(use-package solarized-theme - :config (load-theme 'solarized-light t)) - -(when (or (display-graphic-p) - (daemonp)) - - (defun use-variable-fonts () - (interactive) - (variable-pitch-mode) - (setq cursor-type 'bar)) - - (cond - ((eq window-system 'w32) - (let* ((font-size 10) - (font-list (font-family-list)) - (mono-face (cond - ((member "Liberation Mono" font-list) - "Liberation Mono") - ((member "Liberation Sans Mono" font-list) - "Liberation Sans Mono") - ((member "Consolas" font-list) - "Consolas"))) - (variable-face "Segoe UI") - (default-font (concat mono-face "-" (number-to-string font-size)))) - (when mono-face - (add-to-list 'default-frame-alist `(font . ,default-font)) - (set-face-font 'fixed-pitch default-font)) - (when variable-face - (set-face-font 'variable-pitch (concat variable-face "-" - (number-to-string (1+ font-size))))))) - ((eq system-type 'darwin) - (let* ((font-size 14) - (mono-face "Droid Sans Mono") - (variable-face "Helvetica_Neue") - (default-font (concat mono-face "-" (number-to-string font-size)))) - (when mono-face - (add-to-list 'default-frame-alist `(font . ,default-font))) - (when (and variable-face (display-graphic-p)) - (set-face-font 'variable-pitch (concat variable-face "-" - (number-to-string (1+ font-size))))))))) - -(let* ((font-height (face-attribute 'default :height)) - (small-font-height (max 1 (floor (* .917 font-height))))) - (mapc (lambda (item) - (put (car item) 'customized-face (cadr item)) - (face-spec-set (car item) (cadr item))) - `((linum - ((t (:height ,small-font-height - :foreground unspecified - :inherit fringe - :overline nil - :slant normal)))) - (vertical-border - ((t (:foreground unspecified - :background unspecified - :inherit file-name-shadow)))) - (font-lock-comment-face - ((t (:slant normal)))) - (font-lock-doc-face - ((t (:slant normal)))) - (popup-face - ((t (:background unspecified - :foreground unspecified - :inherit linum - :height ,font-height)))) - (popup-scroll-bar-foreground-face - ((t (:background unspecified - :inherit region)))) - (popup-scroll-bar-background-face - ((t (:background unspecified - :inherit popup-face)))) - (ac-completion-face - ((t (:background unspecified - :foreground unspecified - :inherit popup-face)))) - (ac-candidate-face - ((t (:background unspecified - :foreground unspecified - :inherit linum - :height ,font-height)))) - (ac-selection-face - ((t (:background unspecified - :foreground unspecified - :inherit font-lock-variable-name-face - :inverse-video t)))) - (ac-candidate-mouse-face - ((t (:background unspecified - :foreground unspecified - :inherit region)))) - (ac-dabbrev-menu-face - ((t (:background unspecified - :foreground unspecified - :inherit popup-face)))) - (ac-dabbrev-selection-face - ((t (:background unspecified - :foreground unspecified - :inherit ac-selection-face)))) - (flymake-warnline - ((t (:background unspecified - :foreground unspecified - :inherit font-lock-preprocessor-face)))) - (org-table ((t (:inherit 'fixed-pitch)))) - (org-formula ((t (:foreground "Firebrick" - :inherit 'fixed-pitch)))) - (org-done ((t (:weight normal - :strike-through t)))) - (org-headline-done ((t (:strike-through t))))))) - -;;;; Autosaves & Backups -(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)) - auto-save-file-name-transforms `((".*" ,temporary-file-directory t)) - backup-by-copying-when-linked t - backup-by-copying-when-mismatch t)) - -;;;; Buffers - -(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))))) - -(use-package uniquify - :config (progn - (setq uniquify-buffer-name-style 'reverse - uniquify-separator "/" - uniquify-after-kill-buffer-p t - uniquify-ignore-buffers-re "^\\*"))) - -(use-package fancy-narrow - :config (fancy-narrow-mode 1)) - -;;;; Communication - -(use-package erc - :config (progn - (setq erc-user-full-name "Alan Pearce" - erc-email-userid "alan@alanpearce.co.uk" - erc-echo-notice-in-minibuffer t - erc-keywords '("alanpearce" "lethalrocks") - erc-autojoin-channels-alist - '(("freenode.net" "#emacs" "##freebsd" "#bufferbloat" "#openwrt" "#lojban" "#zfs" "#introverts") - ("what.cd" "#what.cd") - ("beusergroup.co.uk" "#be"))) - (add-to-list 'erc-modules 'scrolltobottom) - (add-to-list 'erc-modules 'autojoin) - (add-to-list 'erc-modules 'match))) - -(setq message-send-mail-function 'smtpmail-send-it) -(setq smtpmail-smtp-server "external.home" - smtpmail-smtp-service 587) - -(use-package mu4e - :if (and (eq env/location 'home) - (eq env/system-type 'desktop)) - :load-path "/usr/share/emacs/site-lisp/mu4e" - :commands (mu4e) - :config (progn - (setq mu4e-get-mail-command "true" - mu4e-update-interval 300 - mu4e-sent-folder "/alanpearce/Sent" - mu4e-drafts-folder "/alanpearce/Drafts" - mu4e-refile-folder "/alanpearce/Archive") - (bind-key "q" #'bury-buffer mu4e-main-mode-map) - (bind-key "d" #'mu4e-headers-mark-for-delete mu4e-headers-mode-map))) - -;;;; Completion - -(setq completion-styles '(basic initials partial-completion substring) - completion-ignore-case t) - -(use-package smart-tab - :init (global-smart-tab-mode) - :config (progn - (nconc smart-tab-completion-functions-alist '((php-mode . php-complete-function))) - (diminish 'smart-tab-mode ""))) - -(use-package company - :commands (company-mode) - :bind (("C-" . company-complete)) - :init (progn - (add-hook 'prog-mode-hook #'company-mode) - (setq company-idle-delay .3 - company-begin-commands '(self-insert-command)))) - -;;;; Dates & Times - -(use-package calendar - :config (progn - (setq calendar-week-start-day 1) - (calendar-set-date-style 'iso))) - -(defun insert-date (prefix) - "Insert the current date. With prefix-argument, use British format. With - 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)))) - -;;;; Directory browsing -(use-package dired - :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-bind-jump nil) - (when (eq system-type 'darwin) - (setq insert-directory-program "/usr/local/bin/gls")) - (put 'dired-find-alternate-file 'disabled nil))) - -(use-package dired+ - :config (progn - (diredp-toggle-find-file-reuse-dir 1) - (dired-omit-mode 1) - (setq dired-omit-files "#\\|\\.$"))) - -;;;; Documentation - -(add-to-list 'Info-default-directory-list - (concat user-emacs-directory - "info")) - -(use-package which-func - :init (which-function-mode) - :config (setq which-func-modes t)) - -;;;; Files - -(prefer-coding-system 'utf-8-auto-unix) -(set-default-coding-systems 'utf-8-auto-unix) -(setq-default buffer-file-coding-system 'utf-8-auto-unix) -(global-auto-revert-mode 1) - -(add-hook 'before-save-hook #'delete-trailing-whitespace) - -(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))))))))) - -(defun delete-current-buffer-file () - "Removes file connected to current buffer and kills buffer." - (interactive) - (let ((filename (buffer-file-name)) - (buffer (current-buffer))) - (if (not (and filename (file-exists-p filename))) - (ido-kill-buffer) - (when (yes-or-no-p "Are you sure you want to remove this file? ") - (if (vc-backend filename) - (vc-delete-file filename) - (delete-file filename) - (kill-buffer buffer) - (message "File '%s' successfully removed" filename)))))) - -(use-package recentf - :init (progn (setq recentf-auto-cleanup 'never - recentf-save-file (expand-file-name "recentf" user-emacs-directory)) - (recentf-mode 1))) - -(use-package saveplace - :config (progn (setq-default save-place t) - (setq save-place-file (expand-file-name ".saveplace" user-emacs-directory)))) - -(use-package tramp - :config (progn - (setq tramp-default-method (if (eq system-type 'windows-nt) "plinkx" "ssh") - tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root") (nil nil "alan")) - 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 - :config (progn - (add-to-list 'tramp-remote-path "/usr/local/sbin") - (add-to-list 'tramp-remote-path "~/bin"))) - -(use-package ediff - :config (progn - (setq ediff-split-window-function 'split-window-horizontally - ediff-window-setup-function 'ediff-setup-windows-plain))) - -;;;; Indentation - -(setq-default tab-width 4 - indent-tabs-mode t) -(setq tab-stop-list - ;; (mapcar (lambda (x) - ;; (* 4 x)) - ;; (number-sequence 1 (/ 120 4))) - '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120) - tab-always-indent 'complete) - -(use-package auto-indent-mode - :commands (auto-indent-minor-mode - 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 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-global-mode) - (defun lisp-auto-indent-mode () - (set (make-local-variable 'auto-indent-assign-indent-level) 2)) - (add-hook 'lisp-common-mode-hook #'lisp-auto-indent-mode))) - -(use-package smart-tabs-mode - :commands (smart-tabs-mode - smart-tabs-mode-enable - smart-tabs-advice) - :config (progn - (smart-tabs-insinuate 'c 'javascript 'cperl 'python) - (add-hook 'php-mode-hook #'smart-tabs-mode-enable))) - -;;;; Keybindings - -(when (eq system-type 'darwin) - (set-keyboard-coding-system nil) - (setq mac-option-modifier 'meta - mac-right-option-modifier 'left - mac-control-modifier 'control - mac-right-control-modifier 'left - mac-command-modifier 'super - mac-right-command-modifier 'left - mac-function-modifier 'hyper)) - -(unbind-key "") -(bind-key "" #'compile) -(bind-key "" #'kmacro-start-macro-or-insert-counter) -(bind-key "" #'kmacro-end-or-call-macro) - -(bind-key "" #'execute-extended-command) - -(unbind-key "C-z") -(bind-key "C-" #'other-window) - -(bind-key "C-x C-r" #'revert-buffer) -(bind-key "C-x C-j" #'delete-indentation) -(unbind-key "C-x C-c") - -(bind-key "C-c i" #'ucs-insert) -(bind-key "M-/" #'hippie-expand) - -(unbind-key "s-h") -(unbind-key "s-n") -(unbind-key "s-p") -(unbind-key "s-w") - -(bind-key "s-x" (define-prefix-command 'super-x-map)) - -(bind-key "s-," (lambda () - (interactive) - (jump-to-register ?e))) -(set-register ?e `(file . ,*init-file*)) -(set-register ?z `(file . ,(expand-file-name ".zshrc" "~"))) - -;; Enable narrowing functions C-x n -(put 'narrow-to-defun 'disabled nil) -(put 'narrow-to-page 'disabled nil) -(put 'narrow-to-region 'disabled nil) - -;;;; Minibuffer - -(setq enable-recursive-minibuffers t) -(minibuffer-depth-indicate-mode t) - -(if (daemonp) - (defalias 'exit-emacs #'delete-frame) - (defalias 'exit-emacs #'save-buffers-kill-emacs)) - -(use-package lacarte - :bind (("M-`" . lacarte-execute-menu-command))) - -(use-package helm-config - :bind (("C-x i" . helm-imenu)) - :config (setq helm-idle-delay .1 - helm-input-idle-delay .1)) - -(use-package ido - :bind (("C-x b" . ido-switch-buffer)) - :init (progn - (setq ido-save-directory-list-file (expand-file-name "ido-state" user-emacs-directory)) - (bind-key* "C-x C-f" #'ido-find-file) - (ido-mode 1)) - :config (progn - (setq ido-auto-merge-delay-time 99999 - ido-enable-flex-matching t) - - (ido-init-completion-maps) - (defun ido-manual-merge () - (interactive) - (ido-initiate-auto-merge (current-buffer))) - (bind-key "C-c C-s" #'ido-manual-merge ido-file-dir-completion-map))) - -(defun ap/ido-projectile-switch-buffer-dwim (force-ido) - (interactive "p") - (if (and (projectile-project-p) (eq force-ido 1)) - (call-interactively #'projectile-switch-to-buffer) - (call-interactively #'ido-switch-buffer))) - -(bind-key "s-x b" #'ap/ido-projectile-switch-buffer-dwim) -(bind-key "s-x s-b" #'ap/ido-projectile-switch-buffer-dwim) - -(use-package ido-vertical-mode - :config (ido-vertical-mode 1)) - -(use-package flx-ido - :init (progn - (flx-ido-mode 1))) - -(use-package smex - :bind (("M-x" . smex) - ("" . smex) - ("" . smex) - ("M-X" . smex-major-mode-commands) - ("C-c M-x" . execute-extended-command)) - :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")) - (smex-initialize))) - -;;;; Modeline - -(column-number-mode t) -(size-indication-mode t) - -;;;; Modes - -;;;; systemd files -(add-to-list 'auto-mode-alist '("\\.service\\'" . conf-mode)) -(add-to-list 'auto-mode-alist '("\\.target\\'" . conf-mode)) -(add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-mode)) - -(use-package xrdb-mode - :mode (("\\.Xdefaults\\'" . xrdb-mode) - ("\\.Xresources\\'" . xrdb-mode))) - -(use-package haskell-mode - :mode (("\\.hs\\'" . haskell-mode) - ("xmobarrc\\'" . haskell-mode))) - -(use-package nginx-mode - :mode (("nginx.conf" . nginx-mode))) - -(use-package lua-mode - :mode (("\\.lua\\'" . lua-mode))) - -(use-package puppet-mode - :mode (("\\.pp\\'" . puppet-mode)) - :config (progn - (add-hook 'puppet-mode-hook #'autopair-mode))) - -(use-package ruby-mode - :mode (("\\.rb\\'" . ruby-mode) - ("\\.cap\\'" . ruby-mode))) - -(use-package yaml-mode - :mode (("/group_vars/.*" . yaml-mode) - ("/host_vars/.*" . yaml-mode)) - :config (progn - (add-hook 'yaml-mode-hook #'autopair-mode))) - -;;;; Planning - -(use-package org - :bind (("C-c C-a" . org-agenda-list) - ("C-c a" . org-agenda) - ("C-c l" . org-store-link) - ("C-c r" . org-remember)) - :config (progn - (setq org-directory "~/org" - org-agenda-files `(,org-directory) - - org-default-notes-file (concat org-directory "/notes") - - ;; Fewer asterisks, doesn't change indentation - org-hide-leading-stars t - - org-startup-indented t - - ;; ‘Remember’: new items at top - org-reverse-note-order t - - org-modules '(org-habit - org-checklist) - - ;; Add time done to ‘done’ tasks - org-log-done 'time - - ;; Allow refiling into any org file - org-refile-targets '((org-agenda-files :maxlevel . 3)) - - org-list-allow-alphabetical t - - org-pretty-entities t - - org-table-duration-custom-format 'seconds - - org-export-have-math t - - org-blank-before-new-entry '((heading . t) - (plain-list-item . auto)) - org-fontify-done-headline t - - org-replace-disputed-keys t - org-todo-keywords '((sequence "TODO" "STARTED" "|" "DONE") - (sequence "TOLEARN" "LEARNING" "LEARNED" "|" "MASTERED") - (sequence "|" "CANCELLED"))) - (set-register ?o `(file . ,(expand-file-name "organiser.org" org-directory))) - (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"))))))) - -(use-package org-journal - :config (progn - (setq org-journal-date-format "%A, %d %B %Y"))) - -;;;; Programming - -(use-package cedet - :disabled t - :config (progn - (semantic-load-enable-code-helpers) - (global-semantic-idle-completions-mode t) - (global-semantic-highlight-func-mode t) - (global-semantic-show-unmatched-syntax-mode t) - (global-semantic-decoration-mode t))) - -;;;; Projects - -(use-package projectile - :bind (("C-c C-f" . projectile-find-file) - ("s-x s-f" . projectile-find-file)) - :commands (projectile-global-mode)) - -(use-package project-persist - :commands (project-persist-mode) - :bind (("C-c P d" . project-persist-delete) - ("C-c P f" . project-persist-find) - ("C-c P k" . project-persist-close) - ("C-c P n" . project-persist-create) - ("C-c P s" . project-persist-save)) - :init (eval-when-compile - (autoload #'pp/settings-get "project-persist")) - :config (progn - (project-persist-mode t) - - (setq project-persist-auto-save-global t) - - (add-hook 'project-persist-before-load-hook #'kill-all-buffers) - - (defun emacs-process-p (pid) - "If pid is the process ID of an emacs process, return t, else nil. -Also returns nil if pid is nil." - (when pid - (let ((attributes (process-attributes pid)) (cmd)) - (dolist (attr attributes) - (if (string= "comm" (car attr)) - (setq cmd (cdr attr)))) - (if (and cmd (or (string= "emacs" cmd) (string= "emacs.exe" cmd))) t)))) - - (defadvice desktop-owner (after pry-from-cold-dead-hands activate) - "Don't allow dead emacsen to own the desktop file." - (when (not (emacs-process-p ad-return-value)) - (setq ad-return-value nil))) - - (defun load-project-desktop () - "Load the project's desktop if available" - (ignore-errors - (let ((default-directory project-persist-current-project-settings-dir)) - (desktop-read)))) - - (defun kill-all-buffers () - "Kill all file-based buffers." - (interactive) - (mapc (lambda (buf) - (when (buffer-file-name buf) - (when (and (buffer-modified-p buf) - (y-or-n-p (format "Buffer %s is modified - save it?" (buffer-name buf)))) - (save-some-buffers nil buf)) - (set-buffer-modified-p nil) - (kill-buffer buf))) - (buffer-list))) - - (add-hook 'project-persist-after-close-hook - (lambda () - (kill-all-buffers) - (projectile-global-mode -1))) - - (add-hook 'project-persist-after-load-hook - (lambda () - (setq default-directory (pp/settings-get 'root-dir)) - (load-project-desktop) - (projectile-global-mode 1))) - - (add-hook 'project-persist-after-save-hook - (lambda () - (message (format "Saving project desktop (%s)" project-persist-current-project-settings-dir)) - (desktop-save project-persist-current-project-settings-dir))) -)) - -(use-package vc - :config (progn - (setq vc-follow-symlinks t))) - -(use-package diff-hl - :init (progn - (global-diff-hl-mode) - (add-hook 'magit-refresh-file-buffer-hook #'diff-hl-update))) - -(use-package magit - :commands (magit-status) - :bind (("C-x g" . magit-status) - ("s-G" . magit-status)) - :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) - -;;;; Spelling -(setq ispell-program-name "aspell" - ispell-dictionary "british") -;; (setq ispell-process-directory (expand-file-name "~/")) -;; If aspell is too slow -;; If it is still too slow, use ‘ultra’ instead of ‘fast’ -;; (setq ispell-extra-args '(" --sug-mode=fast")) -(use-package ispell - :bind (("" . ispell-word))) - -;;;; Scripting - -(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 ntcmd - :mode (("\\`.cmd\\'" . ntcmd-mode) - ("\\`.bat\\'" . ntcmd-mode))) - -;;;; Shells & REPLs - -(use-package eshell - :bind ("C-c s" . eshell) - :config (progn - (setq eshell-directory-name "~/.emacs.d/eshell") - (use-package em-smart - :init (progn - (setq eshell-where-to-jump 'begin - eshell-review-quick-commands nil - eshell-smart-space-goes-to-end t) - (eshell-smart-initialize))))) - -(autoload #'eshell/cd "em-dirs") -(defun eshell-goto-current-dir (&optional arg) - (interactive "P") - (let ((dir default-directory)) - (eshell arg) - (eshell/cd dir))) -(bind-key "C-c S" #'eshell-goto-current-dir) - -(use-package shell - :config (define-key shell-mode-map - (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) - -(use-package multi-term - :if (not (eq system-type 'windows-nt)) - :bind ("C-`" . multi-term-dedicated-toggle)) - -(defun comint-delchar-or-eof-or-kill-buffer (arg) - (interactive "p") - (if (null (get-buffer-process (current-buffer))) - (kill-buffer) - (comint-delchar-or-maybe-eof arg))) - -;;;; Text editing - -;; Enable upcase and downcase-region -(put 'upcase-region 'disabled nil) -(put 'downcase-region 'disabled nil) -(setq sentence-end-double-space nil - line-move-visual nil) - -(setq x-select-enable-clipboard t) -(if (functionp 'x-cut-buffer-or-selection-value) - (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)) - -;; replace highlighted text rather than just inserting at point -(delete-selection-mode t) - -(show-paren-mode t) - -(bind-key "S-SPC" #'set-mark-command) - -(use-package subword - :init (global-subword-mode t)) - -(use-package misc - :bind (("M-z" . zap-up-to-char) - ("M-Z" . zap-to-char))) - -(use-package ap-functions - :commands (ap/remove-extra-cr) - :bind (("C-x r M-w" . copy-rectangle) - ("M-!" . shell-execute))) - -(when (boundp 'x-select-request-type) - (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))) - -(use-package ace-jump-mode - :bind (("C-c SPC" . ace-jump-mode)) - :config (progn - (ace-jump-mode-enable-mark-sync) - (setq ace-jump-word-mode-use-query-char nil - ace-jump-mode-scope 'window))) - -(use-package autopair - :commands (autopair-mode - autopair-on) - :init (progn - (add-hook 'prog-mode-hook #'autopair-on) - (defun autopair-off () - (autopair-mode -1)) - (add-hook 'lisp-common-mode-hook #'autopair-off) - (setq autopair-blink nil - autopair-skip-whitespace nil))) - -(use-package expand-region - :bind ("C-M-SPC" . er/expand-region)) - -(use-package goto-chg - :bind ("C-x SPC" . goto-last-change)) - -(use-package multiple-cursors - :config (progn - (bind-key "C-." #'mc/mark-next-like-this) - (bind-key "C-," #'mc/mark-previous-like-this) - (bind-key "M-" #'mc/mark-all-like-this-dwim) - (bind-key "C-" #'mc/mark-more-like-this-extended) - (bind-key "C-S-L" #'mc/edit-lines))) - -(use-package eldoc - :config (progn - (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) - -(use-package paredit - :commands (paredit-mode) - :init (progn - (add-hook 'lisp-common-mode-hook #'enable-paredit-mode) - (put #'paredit-forward-delete 'delete-selection 'supersede) - (put #'paredit-backward-delete 'delete-selection 'supersede) - (add-hook 'minibuffer-setup-hook #'conditionally-enable-paredit-mode) - (defun conditionally-enable-paredit-mode () - "enable paredit-mode during eval-expression" - (if (eq this-command 'eval-expression) - (paredit-mode 1))))) - -(use-package shuffle-lines - :bind (("C-S-" . move-line-up) - ("C-S-" . move-line-down))) - -(use-package smart-forward - :bind (("C-M-u" . smart-up) - ("C-M-d" . smart-down) - ("C-M-p" . smart-backward) - ("C-M-n" . smart-forward))) - -(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))) - :diminish undo-tree-mode) - -;;;; Lisps - -(defun ap/lisp-setup () - (run-hooks 'lisp-common-mode-hook) - (setq indent-tabs-mode nil) - (local-set-key (kbd "RET") #'paredit-newline)) - -(defun set-common-lisp-indentation () - (set (make-local-variable 'lisp-indent-function) - #'common-lisp-indent-function)) - -(add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup) -(add-hook 'emacs-lisp-mode-hook #'turn-on-eldoc-mode) - -(add-hook 'scheme-mode-hook #'ap/lisp-setup) -(add-hook 'lisp-mode-hook #'ap/lisp-setup) -(add-hook 'lisp-mode-hook #'set-common-lisp-indentation) - -(use-package elisp-slime-nav - :commands elisp-slime-nav-mode - :diminish elisp-slime-nav-mode) - -(use-package geiser - :commands (geiser-mode - geiser - run-geiser - run-racket) - :config (use-package quack)) - -(use-package redshank - :init (progn - (add-hook 'lisp-common-mode-hook #'turn-on-redshank-mode))) - -(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")))) - -(defun imenu-elisp-sections () - (setq imenu-prev-index-position-function nil) - (add-to-list 'imenu-generic-expression '("Sections" "^;;;; \\(.+\\)$" 1) t) - (add-to-list 'imenu-generic-expression '("Packages" "^(use-package\\s-+\\(\\(\\sw\\|\\s_\\)+\\)$" 1) t)) - -(defun init-narrow-to-section () - (interactive) - (save-excursion - (beginning-of-line) - (unless (looking-at "^;;;;") - (re-search-backward "^;;;;" nil t)) - (push-mark) - (forward-line) - (re-search-forward "^;;;;" nil t) - (forward-line -1) - (narrow-to-region (region-beginning) (region-end)))) - -(defun init-imenu (p) - (interactive "P") - (find-file-existing *init-file*) - (widen) - (helm-imenu) - (if p (init-narrow-to-section))) - -(add-hook 'emacs-lisp-mode-hook 'imenu-elisp-sections) - -(defun eval-and-replace () - "Replace the preceding sexp with its value." - (interactive) - (backward-kill-sexp) - (condition-case nil - (prin1 (eval (read (current-kill 0))) - (current-buffer)) - (error (message "Invalid expression") - (insert (current-kill 0))))) - -(bind-key "C-c e" #'eval-and-replace) - -;;;; Programming - -(use-package auto-compile - :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) - -(use-package cc-mode - :init (progn - (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 '+))) - -(use-package quickrun) - -;;;; Web Development - -(use-package skewer-mode - :init (progn - (add-hook 'js2-mode-hook #'skewer-mode) - (add-hook 'html-mode-hook #'skewer-html-mode) - (add-hook 'css-mode-hook #'skewer-css-mode))) - -(use-package js2-mode - :mode ("\\.js\\'" . js2-mode) - :config (progn - (defun ap/javascript-setup () - (autopair-mode -1) - (auto-indent-mode -1)) - (add-hook 'js2-mode-hook #'ap/javascript-setup) - (setq js2-basic-offset 4 - js2-global-externs '("$")))) - -(use-package mustache-mode - :mode (("\\.mustache" . mustache-mode) - ("\\.mt\\'" . mustache-mode) - ("\\.template\\'" . mustache-mode))) - -(use-package jinja2-mode - :mode (("\\.j2\\'" . jinja2-mode))) - -(use-package php-mode - :mode ("\\.php\\'" . php-mode) - :config (progn - (bind-key "C-h C-f" #'php-search-documentation php-mode-map) - (unbind-key "C-c C-f" php-mode-map) - (unbind-key "C-." php-mode-map) - (c-add-style "ap" - '((c-basic-offset . 4) - (c-offsets-alist . ((arglist-cont . php-lineup-arglist) - (arglist-intro . php-lineup-arglist-intro) - (arglist-close . php-lineup-arglist-close) - (topmost-intro-cont . (first c-lineup-cascaded-calls - php-lineup-arglist-intro)) - (brace-list-intro . +) - (brace-list-entry . c-lineup-cascaded-calls) - (case-label . 4) - (statement-case-intro . 4) - (defun-close . 0) - (defun-block-intro . +) - (knr-argdecl . [0]) - (arglist-cont-nonempty . c-lineup-cascaded-calls) - (statement-cont . php-lineup-hanging-semicolon))))) - (defun ap/php-style () - (setq indent-tabs-mode t - c-indent-comments-syntactically-p t) - (c-set-style "ap")) - (add-hook 'php-mode-hook #'ap/php-style) - (add-hook 'php-mode-hook #'turn-on-eldoc-mode))) - -(use-package sgml-mode - :config (setq sgml-basic-offset 4)) - -(use-package emmet-mode - :config (progn - (if (functionp 'web-mode) - (add-hook 'web-mode-hook #'emmet-mode)))) - -(use-package web-mode - :mode (("/views/.*\\.php\\'" . web-mode) - ("/templates/.*\\.php\\'" . web-mode)) - :config (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-disable-auto-pairing t)) - -;;;; Windows & Frames - -(setq frame-title-format - '("" - (:eval (capitalize invocation-name)) ": " - (:eval (if (buffer-file-name) - (abbreviate-file-name (buffer-file-name)) - "%b")))) - -(setq scroll-conservatively 100 ; Keep the cursor position when scrolling - scroll-margin 1 - scroll-preserve-screen-position nil - mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control)))) - -(when menu-bar-mode - (menu-bar-mode -1)) -(when scroll-bar-mode - (scroll-bar-mode -1) - (tooltip-mode -1) - (tool-bar-mode -1)) - -(winner-mode 1) - -(use-package windmove - :bind (("S-" . windmove-left) - ("S-" . windmove-right) - ("S-" . windmove-up) - ("S-" . windmove-down))) - -(if (eq system-type 'darwin) - (setq ns-pop-up-frames nil)) diff --git a/git-hooks/post-merge b/git-hooks/post-merge deleted file mode 100755 index 96f22007..00000000 --- a/git-hooks/post-merge +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env zsh -exec "$GIT_DIR/../install" diff --git a/gitconfig b/gitconfig deleted file mode 100644 index 7c21d74f..00000000 --- a/gitconfig +++ /dev/null @@ -1,25 +0,0 @@ -[user] - email = alan@alanpearce.co.uk - name = Alan Pearce -[color] - branch = auto - diff = auto - status = auto - ui = true -[push] - default = current -[alias] - st = status -sb - ci = commit - br = branch - co = checkout - ready = rebase -i @{u} - lg = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' - standup = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --since yesterday --author alan - ignored = ls-files --others -i --exclude-standard -[github] - user = alan@alanpearce.co.uk -[diff] - algorithm = patience -[core] - excludesfile = ~/.gitignore diff --git a/gitignore b/gitignore deleted file mode 100644 index 7e23dcab..00000000 --- a/gitignore +++ /dev/null @@ -1,29 +0,0 @@ -.DS_Store -.AppleDouble -.LSOverride -Icon -Desktop.ini - -# Thumbnails -._* -Thumbs.db - -# Emacs -*~ -\#*\# -/.emacs.desktop -/.emacs.desktop.lock -.elc -auto-save-list -tramp -.\#* - -.envrc - -# Org-mode -.org-id-locations -*_archive - -GPATH -GRTAGS -GTAGS \ No newline at end of file diff --git a/hgrc b/hgrc deleted file mode 100644 index 2f16f27e..00000000 --- a/hgrc +++ /dev/null @@ -1,9 +0,0 @@ -[ui] -username = Alan Pearce - -[extensions] -purge = -progress = -color = -eol = -record = \ No newline at end of file diff --git a/host-prefect/Xresources b/host-prefect/Xresources new file mode 100644 index 00000000..eb45787c --- /dev/null +++ b/host-prefect/Xresources @@ -0,0 +1,4 @@ +#include ".xresources/main" + +Emacs.Font: -*-Droid Sans Mono-medium-*-*-*-*-120-*-*-*-*-*-* +Emacs.fixed-pitch.attributeFont: -*-Droid Sans Mono-medium-*-*-*-*-120-*-*-*-*-*-* diff --git a/minttyrc b/minttyrc deleted file mode 100644 index 2e7f2d86..00000000 --- a/minttyrc +++ /dev/null @@ -1,33 +0,0 @@ -BoldAsFont=no -Font=Cousine -FontHeight=12 -FontSmoothing=default -Locale=en_GB -Charset=UTF-8 -Columns=100 -Rows=36 -Scrollbar=none -Transparency=off -OpaqueWhenFocused=no -CursorType=block -CursorBlinks=no -RightClickAction=extend -BoldBlack=0,43,54 -Black=7,54,66 -BoldGreen=88,110,117 -BoldYellow=101,123,131 -BoldBlue=131,148,150 -BoldCyan=147,161,161 -White=238,232,213 -BoldWhite=253,246,227 -Yellow=181,137,0 -BoldRed=203,75,22 -Red=220,50,47 -Magenta=211,54,130 -BoldMagenta=108,113,196 -Blue=38,139,210 -Cyan=42,161,152 -Green=133,153,0 -ForegroundColour=101,123,117 -BackgroundColour=253,246,227 -CursorColour=112,129,131 diff --git a/ssh/rc b/ssh/rc deleted file mode 100644 index 7b6da3a8..00000000 --- a/ssh/rc +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -if [ "$SSH_AUTH_SOCK" ] -then - ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock -fi diff --git a/tag-atop/atoprc b/tag-atop/atoprc new file mode 100644 index 00000000..d03319ea --- /dev/null +++ b/tag-atop/atoprc @@ -0,0 +1,2 @@ +flags Aa +maxlinecpu 0 \ No newline at end of file diff --git a/tag-dwm/dwm/config.h b/tag-dwm/dwm/config.h new file mode 100644 index 00000000..ae1d8bb3 --- /dev/null +++ b/tag-dwm/dwm/config.h @@ -0,0 +1,106 @@ +/* See LICENSE file for copyright and license details. */ + +/* appearance */ +static const char font[] = "-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*"; +static const char normbordercolor[] = "#657b83"; +static const char normbgcolor[] = "#002b36"; +static const char normfgcolor[] = "#fdf6e3"; +static const char selbordercolor[] = "#859900"; +static const char selbgcolor[] = "#586e75"; +static const char selfgcolor[] = "#fdf6e3"; +static const unsigned int borderpx = 1; /* border pixel of windows */ +static const unsigned int snap = 32; /* snap pixel */ +static const Bool showbar = True; /* False means no bar */ +static const Bool topbar = True; /* False means bottom bar */ + +/* tagging */ +static const char *tags[] = { "shell", "code", "web", "misc" }; + +static const Rule rules[] = { + /* class instance title tags mask isfloating monitor */ + { "Firefox", NULL, NULL, 1 << 2, False, -1 }, + { "URxvt", NULL, NULL, 1 << 0, False, -1 }, + { "Emacs", "emacs", NULL, 1 << 1, False, -1 }, + { "KeePass2", NULL, NULL, 1 << 3, False, -1 }, + { "deadbeef", NULL, NULL, 1 << 3, False, -1 }, + { "Emacs", "Ediff", NULL, 0, True, -1 }, +}; + +/* layout(s) */ +static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ +static const int nmaster = 1; /* number of clients in master area */ +static const Bool resizehints = True; /* True means respect size hints in tiled resizals */ + +static const Layout layouts[] = { + /* symbol arrange function */ + { "[]=", tile }, /* first entry is default */ + { "><>", NULL }, /* no layout function means floating behavior */ + { "[M]", monocle }, +}; + +/* key definitions */ +#define MODKEY Mod4Mask +#define TAGKEYS(KEY,TAG) \ + { MODKEY, KEY, toggleview, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask, KEY, view, {.ui = 1 << TAG} }, \ + { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, + +/* helper for spawning shell commands in the pre dwm-5.0 fashion */ +#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } + +/* commands */ +static const char *termcmd[] = { "urxvt", NULL }; + +static Key keys[] = { + /* modifier key function argument */ + { MODKEY|ShiftMask, XK_b, togglebar, {0} }, + { MODKEY, XK_e, focusstack, {.i = +1 } }, + { MODKEY, XK_i, focusstack, {.i = -1 } }, + { MODKEY, XK_s, incnmaster, {.i = +1 } }, + { MODKEY, XK_r, incnmaster, {.i = -1 } }, + { MODKEY, XK_n, setmfact, {.f = -0.05} }, + { MODKEY, XK_o, setmfact, {.f = +0.05} }, + { MODKEY, XK_Return, zoom, {0} }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY|ShiftMask, XK_c, killclient, {0} }, + { MODKEY, XK_g, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { MODKEY, XK_comma, focusmon, {.i = -1 } }, + { MODKEY, XK_period, focusmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + TAGKEYS( XK_1, 0) + TAGKEYS( XK_2, 1) + TAGKEYS( XK_3, 2) + TAGKEYS( XK_4, 3) + TAGKEYS( XK_5, 4) + TAGKEYS( XK_6, 5) + TAGKEYS( XK_7, 6) + TAGKEYS( XK_8, 7) + TAGKEYS( XK_9, 8) + { MODKEY|ShiftMask, XK_q, quit, {0} }, + { MODKEY|ShiftMask, XK_r, quit, { .i = 5 } }, +}; + +/* button definitions */ +/* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ +static Button buttons[] = { + /* click event mask button function argument */ + { ClkLtSymbol, 0, Button1, setlayout, {0} }, + { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, + { ClkWinTitle, 0, Button2, zoom, {0} }, + { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, + { ClkClientWin, MODKEY, Button1, movemouse, {0} }, + { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, + { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, + { ClkTagBar, 0, Button1, toggleview, {0} }, + { ClkTagBar, 0, Button3, view, {0} }, + { ClkTagBar, MODKEY, Button1, tag, {0} }, + { ClkTagBar, MODKEY, Button3, toggletag, {0} }, +}; diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask new file mode 100644 index 00000000..8742df0f --- /dev/null +++ b/tag-emacs/emacs.d/Cask @@ -0,0 +1,74 @@ +(source org) +(source melpa) +(source marmalade) +(source gnu) + +(depends-on "ace-jump-mode") +(depends-on "ag") +(depends-on "auto-compile") +(depends-on "auto-indent-mode") +(depends-on "autopair") +(depends-on "bind-key") +(depends-on "cask") +(depends-on "cdnjs") +(depends-on "company") +(depends-on "confluence") +(depends-on "control-mode") +(depends-on "dash") +(depends-on "dash-at-point") +(depends-on "deferred") +(depends-on "diff-hl") +(depends-on "diminish") +(depends-on "dired+") +(depends-on "discover") +(depends-on "emmet-mode") +(depends-on "epl") +(depends-on "expand-region") +(depends-on "f") +(depends-on "flx") +(depends-on "flx-ido") +(depends-on "framemove") +(depends-on "geiser") +(depends-on "ggtags") +(depends-on "git-commit-mode") +(depends-on "git-rebase-mode") +(depends-on "god-mode") +(depends-on "haskell-mode") +(depends-on "helm") +(depends-on "ido-vertical-mode") +(depends-on "jinja2-mode") +(depends-on "js2-mode") +(depends-on "lua-mode") +(depends-on "magit") +(depends-on "makey") +(depends-on "multi-term") +(depends-on "multiple-cursors") +(depends-on "mustache-mode") +(depends-on "nginx-mode") +(depends-on "org-jira") +(depends-on "org-journal") +(depends-on "org-plus-contrib") +(depends-on "packed") +(depends-on "pallet") +(depends-on "paredit") +(depends-on "php-extras") +(depends-on "php-mode") +(depends-on "pkg-info") +(depends-on "project-persist") +(depends-on "projectile") +(depends-on "puppet-mode") +(depends-on "quickrun") +(depends-on "redshank") +(depends-on "s") +(depends-on "simple-httpd") +(depends-on "skewer-mode") +(depends-on "smart-tab") +(depends-on "smart-tabs-mode") +(depends-on "smex") +(depends-on "solarized-theme") +(depends-on "tup-mode") +(depends-on "undo-tree") +(depends-on "use-package") +(depends-on "web-mode") +(depends-on "xml-rpc") +(depends-on "yaml-mode") \ No newline at end of file diff --git a/tag-emacs/emacs.d/elisp/ap-functions.el b/tag-emacs/emacs.d/elisp/ap-functions.el new file mode 100644 index 00000000..bdc7faef --- /dev/null +++ b/tag-emacs/emacs.d/elisp/ap-functions.el @@ -0,0 +1,47 @@ +;;;###autoload +(defun ap/remove-extra-cr () + "Remove extraneous CR codes from a file" + (interactive) + (save-excursion + (goto-char (point-min)) + (while (search-forward " +" nil t) + (replace-match "")))) + +;;;###autoload +(defun copy-rectangle (start end) + "Copy the region-rectangle." + (interactive "r") + (setq killed-rectangle (extract-rectangle start end))) + +;;;###autoload +(defun eval-and-replace () + "Replace the preceding sexp with its value." + (interactive) + (backward-kill-sexp) + (condition-case nil + (prin1 (eval (read (current-kill 0))) + (current-buffer)) + (error (message "Invalid expression") + (insert (current-kill 0))))) + +;;;###autoload +(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))) + +;;;###autoload +(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))) + +(provide 'ap-functions) diff --git a/tag-emacs/emacs.d/elisp/php-electric.el b/tag-emacs/emacs.d/elisp/php-electric.el new file mode 100644 index 00000000..599b2b1d --- /dev/null +++ b/tag-emacs/emacs.d/elisp/php-electric.el @@ -0,0 +1,218 @@ +;; -*- Emacs-Lisp -*- +;; +;; php-electric.el --- electric submode for the php-mode +;; +;; Version: 1.0 +;; Release-Date: Sunday 04 March 2007 +;; +;; Copyright (C) 2007 +;; by Nikolay V. Nemshilov aka St. +;; +;; +;; License +;; +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License +;; as published by the Free Software Foundation; either version 2 +;; of the License, or (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, write to the Free Software +;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +;; +;; +;; Features: +;; * autocompletion of the language contructions +;; such as if, for, foreach, etc blocks, +;; +;; * autocompletion of classes, interfaces and functions +;; definitions +;; +;; * autocompletion of the paired symbols, like [], (), "",'' +;; +;; +;; Usage: +;; Nothing magical, just place the file in a directory where +;; Emacs can find it, and write +;; +;; (require 'php-electric) +;; +;; in your configuration files ~/.emacs or wherever you keep it. +;; Then you can switch on/off the mode by the following command +;; +;; M-x php-electric-mode +;; +;; If you like to have it switched on automatically, you should +;; put the command in your php-mode hook or create new one, +;; like that +;; +;; (add-hook 'php-mode-hook '(lambda () (php-electric-mode))) +;; +;; That's it. +;; +;; +;; Changelog: +;; Sunday 04 March 2007 +;; The first version 1.0 has been came out. +;; + +(defgroup php-electric nil + "Minor php-electric mode" + :group 'php) + +;; list of keywords which expandible by the {} pair +(defconst php-electric-expandible-simple-re + "\\(try\\|else\\|do\\)") + +;; list of keywords which expandible with the (){} construction +(defconst php-electric-expandible-as-struct-re + "\\(while\\|for\\|foreach\\|if\\|elseif\\|catch\\)") + +;; list of keywords which expandible with the name(){} construction +(defconst php-electric-expandible-as-func-re + "\\(function\\)") + +;; list of keywords which expandible with the name{} construction +(defconst php-electric-expandible-as-class-re + "\\(class\\|interface\\)") + +;; list of the paired chars +(defvar php-electric-matching-delimeter-alist + '((?\[ . ?\]) + (?\( . ?\)) + (?\" . ?\") + (?\' . ?\'))) + +;; the minor-mode definition +(define-minor-mode php-electric-mode + "Minor electric-mode for the php-mode" + nil + "-El" + php-mode-map + (php-electric-keymap)) + +;; list of accessible keys +(defun php-electric-keymap() + (define-key php-mode-map " " 'php-electric-space) + (define-key php-mode-map "{" 'php-electric-curlies) + (define-key php-mode-map "(" 'php-electric-brackets) + (define-key php-mode-map "[" 'php-electric-matching-char) + (define-key php-mode-map "\"" 'php-electric-matching-char) + (define-key php-mode-map "\'" 'php-electric-matching-char)) + +;; handler for the spaces insertions +(defun php-electric-space(arg) + (interactive "P") + (self-insert-command (prefix-numeric-value arg)) + (if (php-electric-is-code-at-point-p) + (if (php-electric-line-is-simple-expandible) + ;; inserting just a pair of curleis + (progn + (insert "{")(php-electric-insert-new-line-and-statement-end)) + (if (php-electric-line-is-expandible-as-struct) + ;; inserting a structure definition + (progn + (if (not (char-equal ?\( (preceding-char))) + ;; cmd () { - style construction + (progn + (insert "(")(set-register 98 (point-marker))(insert ") {")) + + ;; cmd( ){ - style construction + (progn + (insert " ")(set-register 98 (point-marker))(insert " ){"))) + (php-electric-insert-new-line-and-statement-end) + (jump-to-register 98)(set-register 98 nil)) + (if (php-electric-line-is-expandible-as-func) + ;; inserting the function expanding + (save-excursion + (insert "(){")(php-electric-insert-new-line-and-statement-end)) + (if (php-electric-line-is-expandible-as-class) + ;; inserting the class expanding + (save-excursion + (insert "{")(php-electric-insert-new-line-and-statement-end)))))))) + +;; handler for the { chars +(defun php-electric-curlies(arg) + (interactive "P") + (self-insert-command (prefix-numeric-value arg)) + (if (php-electric-is-code-at-point-p) + (progn + (php-electric-insert-new-line-and-statement-end)))) + +;; handler for the ( chars +(defun php-electric-brackets(arg) + (interactive "P") + + (if (php-electric-is-code-at-point-p) + ;; checking if it's a statement + (if (php-electric-line-is-expandible-as-struct) + (progn (php-electric-space arg)) + (progn (php-electric-matching-char arg))) + (self-insert-command (prefix-numeric-value arg)))) + +;; handler for the paired chars, [], (), "", '' +(defun php-electric-matching-char(arg) + (interactive "P") + (self-insert-command (prefix-numeric-value arg)) + (if (php-electric-is-code-at-point-p) + (save-excursion + (insert (cdr (assoc last-command-char + php-electric-matching-delimeter-alist)))))) + +;; checks if the current pointer situated in a piece of code +(defun php-electric-is-code-at-point-p() + (and php-electric-mode + (let* ((properties (text-properties-at (point)))) + (and (null (memq 'font-lock-string-face properties)) + (null (memq 'font-lock-comment-face properties)))))) + +;; checks if the current line expandible with a simple {} construction +(defun php-electric-line-is-simple-expandible() + (let* ((php-electric-expandible-simple-real-re + (concat php-electric-expandible-simple-re "\\s-$"))) + (save-excursion + (backward-word 1) + (looking-at php-electric-expandible-simple-real-re)))) + +;; checks if the current line expandible with the (){} construction +(defun php-electric-line-is-expandible-as-struct() + (let* ((php-electric-expandible-as-struct-real-re + (concat php-electric-expandible-as-struct-re "[ ]*$")) + (php-electric-expandible-as-struct-with-bracket-re + (concat php-electric-expandible-as-struct-re "($"))) + (save-excursion + (backward-word 1) + (or (looking-at php-electric-expandible-as-struct-real-re) + (looking-at php-electric-expandible-as-struct-with-bracket-re))))) + +;; checks if the current line expandible with the name(){} construction +(defun php-electric-line-is-expandible-as-func() + (let* ((php-electric-expandible-as-func-real-re + (concat php-electric-expandible-as-func-re "\\s-$"))) + (save-excursion + (backward-word 1) + (looking-at php-electric-expandible-as-func-real-re)))) + +;; checks if the current line expandible with the name{} construction +(defun php-electric-line-is-expandible-as-class() + (let* ((php-electric-expandible-as-class-real-re + (concat php-electric-expandible-as-class-re "\\s-$"))) + (save-excursion + (backward-word 1) + (looking-at php-electric-expandible-as-class-real-re)))) + +;; "shortcut" to insert \n} construction +(defun php-electric-insert-new-line-and-statement-end() + (newline-and-indent)(set-register 99 (point-marker)) + (insert "\n}")(indent-according-to-mode) + (jump-to-register 99)(set-register 99 nil)) + + +(provide 'php-electric) + +;; end of the file \ No newline at end of file diff --git a/tag-emacs/emacs.d/elisp/shuffle-lines.el b/tag-emacs/emacs.d/elisp/shuffle-lines.el new file mode 100644 index 00000000..be0a98f9 --- /dev/null +++ b/tag-emacs/emacs.d/elisp/shuffle-lines.el @@ -0,0 +1,20 @@ +;;;###autoload +(defun move-line-down () + (interactive) + (let ((col (current-column))) + (save-excursion + (forward-line) + (transpose-lines 1)) + (forward-line) + (move-to-column col))) + +;;;###autoload +(defun move-line-up () + (interactive) + (let ((col (current-column))) + (save-excursion + (forward-line) + (transpose-lines -1)) + (move-to-column col))) + +(provide 'shuffle-lines) diff --git a/tag-emacs/emacs.d/elisp/xrdb-mode.el b/tag-emacs/emacs.d/elisp/xrdb-mode.el new file mode 100644 index 00000000..712f0cbf --- /dev/null +++ b/tag-emacs/emacs.d/elisp/xrdb-mode.el @@ -0,0 +1,544 @@ +;;; xrdb-mode.el --- mode for editing X resource database files + +;; Copyright (C) 1998,1999,2000 Free Software Foundation, Inc. + +;; Author: 1994-2003 Barry A. Warsaw +;; Maintainer: barry@python.org +;; Created: May 1994 +;; Keywords: data languages + +(defconst xrdb-version "2.31" + "`xrdb-mode' version number.") + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License +;; as published by the Free Software Foundation; either version 2 +;; of the License, or (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, write to the Free Software +;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +;;; Commentary: +;; +;; This file provides a major mode for editing X resource database +;; files. It includes font-lock definitions and commands for +;; controlling indentation, re-indenting by subdivisions, and loading +;; and merging into the the resource database. +;; +;; To use, put the following in your .emacs: +;; +;; (autoload 'xrdb-mode "xrdb-mode" "Mode for editing X resource files" t) +;; +;; You may also want something like: +;; +;; (setq auto-mode-alist +;; (append '(("\\.Xdefaults$" . xrdb-mode) +;; ("\\.Xenvironment$" . xrdb-mode) +;; ("\\.Xresources$" . xrdb-mode) +;; ("*.\\.ad$" . xrdb-mode) +;; ) +;; auto-mode-alist)) + +;;; Credits: +;; +;; The database merge feature was inspired by Joel N. Weber II. +;; +;; The canonical Web site for xrdb-mode is +;; + +;;; Code: +(require 'custom) + + + +(defgroup xrdb nil + "Support for editing X resource database files" + :group 'languages) + +(defcustom xrdb-mode-hook nil + "*Hook to be run when `xrdb-mode' is entered." + :type 'hook + :group 'xrdb) + +(defcustom xrdb-subdivide-by 'paragraph + "*Default alignment subdivision when re-indenting a region or buffer. +This variable controls how much of the buffer is searched to find a +goal column on which to align. Every non-comment line in the region +defined by this variable is scanned for the first `:' character on the +line, and this character's column is the line's goal column. The +rightmost line goal column in the region is taken as the region's goal +column. + +This variable can take one of the following symbol values: + + `buffer' - All lines in the buffer are scanned. This is the + slowest option. + + `paragraph' - All lines in the paragraph are scanned. Paragraphs + are delimited by blank lines, comment lines, and page + delimiters. + + `page' - All lines in the page are scanned. Pages are delimited + with `page-delimiter', usually ^L (control-L). + + `line' - Only the previous non-comment line is scanned. This is + the fastest method. + +This variable is used by the various indentation commands, and can be +overridden in those commands by using \\[universal-argument]." + :type '(radio (const :tag "Do not subdivide buffer" buffer) + (const :tag "Subdivide by paragraphs" paragraph) + (const :tag "Subdivide by pages" page) + (const :tag "Each line is independent" line)) + :group 'xrdb) + +(defcustom xrdb-compress-whitespace nil + "*Collapse all whitespace to a single space after insertion of `:'." + :type 'boolean + :group 'xrdb) + +(defcustom xrdb-program "xrdb" + "*Program to run to load or merge resources in the X resource database." + :type 'string + :group 'xrdb) + +(defcustom xrdb-program-args '("-merge") + "*List of string arguments to pass to `xrdb-program'." + :type '(repeat string) + :group 'xrdb) + +(defvar xrdb-master-file nil + "If non-nil, merge in the named file instead of the buffer's file. +The intent is to allow you to set this variable in the file's local +variable section, e.g.: + + ! Local Variables: + ! xrdb-master-file: \"Xdefaults\" + ! End: + +so that typing \\[xrdb-database-merge-buffer-or-region] in that buffer +merges the named master file instead of the buffer's file. Note that +if the file name has a relative path, the `default-directory' for the +buffer is prepended to come up with a file name. + +You may also want to set `xrdb-program-args' in the local variables +section as well.") +(make-variable-buffer-local 'xrdb-master-file) + + +;; Non-user customizable +(defconst xrdb-comment-re "^[ \t]*[!]" + "Regular expression describing the beginning of a comment line.") + + + +;; utilities +(defun xrdb-point (position) + ;; Returns the value of point at certain commonly referenced POSITIONs. + ;; POSITION can be one of the following symbols: + ;; + ;; bol -- beginning of line + ;; eol -- end of line + ;; bod -- beginning of defun + ;; boi -- back to indentation + ;; ionl -- indentation of next line + ;; iopl -- indentation of previous line + ;; bonl -- beginning of next line + ;; bopl -- beginning of previous line + ;; bop -- beginning of paragraph + ;; eop -- end of paragraph + ;; bopg -- beginning of page + ;; eopg -- end of page + ;; + ;; This function does not modify point or mark. + (let ((here (point))) + (cond + ((eq position 'bod) (beginning-of-defun)) + ((eq position 'bol) (beginning-of-line)) + ((eq position 'eol) (end-of-line)) + ((eq position 'boi) (back-to-indentation)) + ((eq position 'bonl) (forward-line 1)) + ((eq position 'bopl) (forward-line -1)) + ((eq position 'bop) (forward-paragraph -1)) + ((eq position 'eop) (forward-paragraph 1)) + ((eq position 'bopg) (forward-page -1)) + ((eq position 'eopg) (forward-page 1)) + (t + (error "unknown buffer position requested: %s" position))) + (prog1 + (point) + (goto-char here)) + )) + +(defmacro xrdb-safe (&rest body) + ;; safely execute BODY, return nil if an error occurred + `( (condition-case nil + (progn (,@ body)) + (error nil)))) + +(defsubst xrdb-skip-to-separator () + ;; skip forward from the beginning of the line to the separator + ;; character as given by xrdb-separator-char. Returns t if the + ;; char was found, otherwise, nil. + (beginning-of-line) + (skip-chars-forward "^:" (xrdb-point 'eol)) + (and (eq (char-after) ?:) + (current-column))) + +(defsubst xrdb-in-comment-p (&optional lim) + (let* ((lim (or lim (xrdb-point 'bod))) + (state (parse-partial-sexp lim (point)))) + (nth 4 state))) + +(defsubst xrdb-boi-col () + (let ((here (point))) + (goto-char (xrdb-point 'boi)) + (prog1 + (current-column) + (goto-char here)))) + +(defvar xrdb-prompt-history nil) + +(defun xrdb-prompt-for-subdivision () + (let ((options '(("buffer" . buffer) + ("paragraphs" . paragraph) + ("pages" . page) + ("lines" . line))) + (completion-ignore-case t)) + (cdr (assoc + (completing-read "Subdivide alignment by? " options nil t + (cons (format "%s" xrdb-subdivide-by) 0) + 'xrdb-prompt-history) + options)))) + + +;; commands +(defun xrdb-electric-separator (arg) + "Insert a colon, and possibly indent line. +Numeric argument inserts that many separators. If the numeric +argument is not given, or is 1, and the separator is not inserted in a +comment, then the line is indented according to `xrdb-subdivide-by'." + (interactive "P") + (self-insert-command (prefix-numeric-value arg)) + ;; only do electric behavior if arg is not given + (or arg + (xrdb-in-comment-p) + (xrdb-indent-line)) + ;; compress whitespace + (and xrdb-compress-whitespace + (just-one-space))) + +(defun xrdb-electric-bang (arg) + "Insert an exclamation point to start a comment. +Numeric argument inserts that many exclamation characters. If the +numeric argument is not given, or is 1, and the bang character is the +first character on a line, the line is indented to column zero." + (interactive "P") + (let ((how-many (prefix-numeric-value arg))) + (self-insert-command how-many) + (save-excursion + (if (and (= how-many 1) + (xrdb-in-comment-p) + (memq (char-before (xrdb-point 'boi)) '(?\n nil))) + (indent-line-to 0))) + )) + + +(defun xrdb-indent-line (&optional arg) + "Align the current line according to `xrdb-subdivide-by'. +With optional \\[universal-argument], prompt for subdivision." + (interactive "P") + (xrdb-align-to-column + (xrdb-guess-goal-column (if arg + (xrdb-prompt-for-subdivision) + xrdb-subdivide-by)) + (xrdb-point 'bol) + (xrdb-point 'bonl))) + +(defun xrdb-indent-region (start end &optional arg) + "Indent all lines in the region according to `xrdb-subdivide-by'. +With optional \\[universal-argument], prompt for subdivision." + (interactive "r\nP") + (xrdb-align-to-column + (xrdb-guess-goal-column (if arg + (xrdb-prompt-for-subdivision) + xrdb-subdivide-by)) + start end)) + +(defun xrdb-indent-page (&optional arg) + "Indent all lines in the page according to `xrdb-subdivide-by'. +With optional \\[universal-argument], prompt for subdivision." + (interactive "P") + (xrdb-align-to-column + (xrdb-guess-goal-column (if arg + (xrdb-prompt-for-subdivision) + xrdb-subdivide-by)) + (xrdb-point 'bopg) + (xrdb-point 'eopg))) + +(defun xrdb-indent-paragraph (&optional arg) + "Indent all lines in the paragraph according to `xrdb-subdivide-by'. +With optional \\[universal-argument], prompt for subdivision." + (interactive "P") + (xrdb-align-to-column + (xrdb-guess-goal-column (if arg + (xrdb-prompt-for-subdivision) + xrdb-subdivide-by)) + (xrdb-point 'bop) + (xrdb-point 'eop))) + +(defun xrdb-indent-buffer (&optional arg) + "Indent all lines in the buffer according to `xrdb-subdivide-by'. +With optional \\[universal-argument], prompt for subdivision." + (interactive "P") + (let ((subdivide-by (if arg + (xrdb-prompt-for-subdivision) + xrdb-subdivide-by))) + (save-excursion + (beginning-of-buffer) + (if (eq subdivide-by 'buffer) + (xrdb-align-to-column (xrdb-guess-goal-column 'buffer) + (point-min) (point-max)) + (let (mvfwdfunc indentfunc) + (cond + ((eq subdivide-by 'paragraph) + (setq mvfwdfunc 'forward-paragraph + indentfunc 'xrdb-indent-paragraph)) + ((eq subdivide-by 'page) + (setq mvfwdfunc 'forward-page + indentfunc 'xrdb-indent-page)) + ((eq subdivide-by 'line) + (setq mvfwdfunc 'forward-line + indentfunc 'xrdb-indent-page)) + (t (error "Illegal alignment subdivision: %s" subdivide-by)) + ) + (while (< (point) (point-max)) + (funcall indentfunc) + (funcall mvfwdfunc 1)) + ))))) + + +;; internal alignment functions +(defun xrdb-align-to-column (goalcol &optional start end) + (let ((start (or start (xrdb-point 'bol))) + (end (or end (xrdb-point 'bonl)))) + (save-excursion + (save-restriction + (narrow-to-region start end) + (beginning-of-buffer) + (while (< (point) (point-max)) + (if (and (not (looking-at xrdb-comment-re)) + (xrdb-skip-to-separator)) + (indent-line-to (max 0 (+ goalcol + (- (current-column)) + (xrdb-boi-col)) + ))) + (forward-line 1)) + )))) + +(defun xrdb-guess-goal-column (subdivide-by) + ;; Returns the goal column of the current line based on SUBDIVIDE-BY, + ;; which can be any value allowed by `xrdb-subdivide-by'. + (let ((here (point)) + (goalcol 0)) + (save-restriction + (cond + ((eq subdivide-by 'line) + (while (and (zerop (forward-line -1)) + (or (looking-at xrdb-comment-re) + (not (xrdb-skip-to-separator))))) + ;; maybe we didn't find one + (if (not (xrdb-skip-to-separator)) + (goto-char here)) + (narrow-to-region (xrdb-point 'bol) (xrdb-point 'bonl))) + ((eq subdivide-by 'page) + (narrow-to-page)) + ((eq subdivide-by 'paragraph) + (narrow-to-region (xrdb-point 'bop) (xrdb-point 'eop))) + ((eq subdivide-by 'buffer)) + (t (error "Illegal alignment subdivision: %s" subdivide-by))) + (goto-char (point-min)) + (while (< (point) (point-max)) + (if (and (not (looking-at xrdb-comment-re)) + (xrdb-skip-to-separator)) + (setq goalcol (max goalcol (- (current-column) (xrdb-boi-col))))) + (forward-line 1))) + (goto-char here) + goalcol)) + + + +;; major-mode stuff +(defvar xrdb-mode-abbrev-table nil + "Abbreviation table used in `xrdb-mode' buffers.") +(define-abbrev-table 'xrdb-mode-abbrev-table ()) + + +(defvar xrdb-mode-syntax-table nil + "Syntax table used in `xrdb-mode' buffers.") +(if xrdb-mode-syntax-table + nil + (setq xrdb-mode-syntax-table (make-syntax-table)) + (modify-syntax-entry ?! "<" xrdb-mode-syntax-table) + (modify-syntax-entry ?\\ "\\" xrdb-mode-syntax-table) + (modify-syntax-entry ?\n ">" xrdb-mode-syntax-table) + (modify-syntax-entry ?/ ". 14" xrdb-mode-syntax-table) + (modify-syntax-entry ?* "_ 23" xrdb-mode-syntax-table) + (modify-syntax-entry ?. "_" xrdb-mode-syntax-table) + (modify-syntax-entry ?# "_" xrdb-mode-syntax-table) + (modify-syntax-entry ?? "_" xrdb-mode-syntax-table) + (modify-syntax-entry ?< "(" xrdb-mode-syntax-table) + (modify-syntax-entry ?> ")" xrdb-mode-syntax-table) + ) + + +(defvar xrdb-mode-map () + "Keymap used in `xrdb-mode' buffers.") +(if xrdb-mode-map + () + (setq xrdb-mode-map (make-sparse-keymap)) + ;; make the separator key electric + (define-key xrdb-mode-map ":" 'xrdb-electric-separator) + (define-key xrdb-mode-map "!" 'xrdb-electric-bang) + (define-key xrdb-mode-map "\t" 'xrdb-indent-line) + (define-key xrdb-mode-map "\C-c\C-a" 'xrdb-indent-buffer) + (define-key xrdb-mode-map "\C-c\C-b" 'xrdb-submit-bug-report) + (define-key xrdb-mode-map "\C-c\C-c" 'xrdb-database-merge-buffer-or-region) + (define-key xrdb-mode-map "\C-c\C-p" 'xrdb-indent-paragraph) + (define-key xrdb-mode-map "\C-c\[" 'xrdb-indent-page) + (define-key xrdb-mode-map "\C-c\C-r" 'xrdb-indent-region) + ) + +;;;###autoload +(defun xrdb-mode () + "Major mode for editing xrdb config files" + (interactive) + (kill-all-local-variables) + (set-syntax-table xrdb-mode-syntax-table) + (setq major-mode 'xrdb-mode + mode-name "xrdb" + local-abbrev-table xrdb-mode-abbrev-table) + (use-local-map xrdb-mode-map) + (setq font-lock-defaults '(xrdb-font-lock-keywords)) + ;; local variables + (make-local-variable 'parse-sexp-ignore-comments) + (make-local-variable 'comment-start-skip) + (make-local-variable 'comment-start) + (make-local-variable 'comment-end) + (make-local-variable 'paragraph-start) + (make-local-variable 'paragraph-separate) + (make-local-variable 'paragraph-ignore-fill-prefix) + (make-local-variable 'indent-region-function) + ;; now set their values + (setq parse-sexp-ignore-comments t + comment-start-skip "![ \t]*" + comment-start "! " + comment-end "") + (setq indent-region-function 'xrdb-indent-region + paragraph-ignore-fill-prefix t + paragraph-start (concat "^[ \t]*$\\|^[ \t]*[!]\\|" page-delimiter) + paragraph-separate paragraph-start) + (run-hooks 'xrdb-mode-hook)) + + + +;; faces and font-locking +(defvar xrdb-option-name-face 'xrdb-option-name-face + "Face for option name on a line in an X resource db file") + +(defvar xrdb-option-value-face 'xrdb-option-value-face + "Face for option value on a line in an X resource db file") + +(make-face 'xrdb-option-name-face) +(make-face 'xrdb-option-value-face) + +(defun xrdb-font-lock-mode-hook () + (or (face-differs-from-default-p 'xrdb-option-name-face) + (copy-face 'font-lock-keyword-face 'xrdb-option-name-face)) + (or (face-differs-from-default-p 'xrdb-option-value-face) + (copy-face 'font-lock-string-face 'xrdb-option-value-face)) + (remove-hook 'font-lock-mode-hook 'xrdb-font-lock-mode-hook)) +(add-hook 'font-lock-mode-hook 'xrdb-font-lock-mode-hook) + +(defvar xrdb-font-lock-keywords + (list '("^[ \t]*\\([^\n:]*:\\)[ \t]*\\(.*\\)$" + (1 xrdb-option-name-face) + (2 xrdb-option-value-face))) + "Additional expressions to highlight in X resource db mode.") +(put 'xrdb-mode 'font-lock-defaults '(xrdb-font-lock-keywords)) + + + +;; merging and manipulating the X resource database +(defun xrdb-database-merge-buffer-or-region (start end) + "Merge the current buffer's resources into the X resource database. + +`xrdb-program' is the program to actually call, with the arguments +specified in `xrdb-program-args'. This latter can be set to do either +a merge or a load, etc. Also, if the file local variable +`xrdb-master-file' is non-nil, then it is merged instead of the +buffer's file. + +If the current region is active, it is merged instead of the buffer, +and this overrides any use of `xrdb-master-file'." + (interactive + ;; the idea here is that if the region is inactive, start and end + ;; will be nil, if not passed in programmatically + (list (xrdb-safe (and (mark) (region-beginning))) + (xrdb-safe (and (mark) (region-end))))) + (message "Merging with args: %s..." xrdb-program-args) + (let ((outbuf (get-buffer-create "*Shell Command Output*"))) + ;; I prefer the XEmacs way of doing this, but this is the easiest + ;; way to work in both XEmacs and Emacs. + (with-current-buffer outbuf (erase-buffer)) + (cond + ((and start end) + (apply 'call-process-region start end xrdb-program nil outbuf t + xrdb-program-args)) + (xrdb-master-file + (apply 'call-process xrdb-program xrdb-master-file outbuf t + xrdb-program-args)) + (t + (apply 'call-process-region (point-min) (point-max) xrdb-program + nil outbuf t xrdb-program-args))) + (if (not (zerop (with-current-buffer outbuf (buffer-size)))) + (pop-to-buffer outbuf))) + (message "Merging... done")) + + + +;; submitting bug reports + +(defconst xrdb-mode-help-address "tools-help@python.org" + "Address for xrdb-mode bug reports.") + +(defun xrdb-submit-bug-report () + "Submit via mail a bug report on xrdb-mode." + (interactive) + ;; load in reporter + (require 'reporter) + (let ((reporter-prompt-for-summary-p t) + (varlist '(xrdb-subdivide-by + xrdb-mode-hook + xrdb-compress-whitespace + ))) + (and (if (y-or-n-p "Do you want to submit a report on xrdb-mode? ") + t + (message "") + nil) + (require 'reporter) + (reporter-submit-bug-report + xrdb-mode-help-address + (format "xrdb-mode %s" xrdb-version) + varlist nil nil "Dear Barry,") + ))) + + +(provide 'xrdb-mode) +;;; xrdb-mode.el ends here diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el new file mode 100644 index 00000000..76505ad5 --- /dev/null +++ b/tag-emacs/emacs.d/init.el @@ -0,0 +1,1170 @@ +;; -*- lexical-binding: t; -*- +;;;; Startup +;; Do not merge echo-area-message sexp +(setq inhibit-startup-echo-area-message "alan") +(setq inhibit-startup-screen t + initial-scratch-message "" + initial-major-mode 'text-mode + user-mail-address "alan@alanpearce.co.uk" + user-full-name "Alan Pearce" + custom-file "~/.emacs.d/custom.el") + +(load custom-file :noerror) + +;;; Allow lisps to use a common setup. I don't know why they don't have some lispy mode as their parent, but this is close enough +(defcustom lisp-common-mode-hook nil + "Hook run when entering any Lisp mode." + :type 'hook + :group 'lisp) + +;;;; Environment & Location + +(defun env/get-location () + "Return the physical location of the system, or `nil' if unknown" + (if (executable-find "netctl") + (catch 'found + (mapc (lambda (line) + (cond + ((string-prefix-p "* home" line) (throw 'found 'home)) + ((string-prefix-p "* work" line) (throw 'found 'work)))) + (process-lines "netctl" "list")) + nil))) + +(defun env/get-system-type () + "Return the type of computer that is running" + (cond + ((string-prefix-p "prefect" system-name) 'desktop) + ((string-prefix-p "server" system-name) 'server) + ((string-prefix-p "sheldon" system-name) 'laptop))) + +(defvar env/location (env/get-location) + "The type of location the system is located in +Values: `work', `home'") + +(defvar env/system-type (env/get-system-type) + "The type of computer Emacs is running on +Values: `desktop', `server', `laptop'") + +(defun env/recheck-location () + (interactive) + (setq env/location (env/get-location))) + +(defvar *init-file* + (when user-init-file + (expand-file-name "init.el" + (file-name-directory (file-truename user-init-file)))) + "Where the emacs init file really is, passing through symlinks.") + +;;;; Package Management +(add-to-list 'load-path (expand-file-name "elisp/" user-emacs-directory)) + +(let ((cask-dir (expand-file-name "~/.cask"))) + (if (file-exists-p cask-dir) + (progn + (add-to-list 'load-path cask-dir) + (require 'cask) + (cask-initialize)) + (eval-and-compile + (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") + ("marmalade" . "http://marmalade-repo.org/packages/") + ("melpa" . "http://melpa.milkbox.net/packages/") + ("org" . "http://orgmode.org/elpa/"))) + (package-initialize)) + + (when (not package-archive-contents) + (package-refresh-contents)) + + (mapc (lambda (package-name) + (unless (package-installed-p package-name) + (package-install package-name))) + '(bind-key + diminish + use-package)))) + +(require 'use-package) + +;;;; Style + +(use-package linum + :config (setq linum-format " %4d ")) + +(use-package highlight-symbol + :disabled t + :config (setq highlight-symbol-idle-delay 0.2)) + +(use-package whitespace + :config (setq whitespace-style + '(face + space + tabs + trailing + newline + empty + space-after-tab + tab-mark + space-before-tab + indentation + indentation::space + indentation::tabs))) + +(global-font-lock-mode t) +;; Allow font-lock-mode to do background parsing +(setq jit-lock-stealth-time 1 + jit-lock-stealth-load 100 + jit-lock-chunk-size 1000 + jit-lock-defer-time 0.01) + +(use-package solarized-theme + :config (load-theme 'solarized-light t)) + +(when (or (display-graphic-p) + (daemonp)) + + (defun use-variable-fonts () + (interactive) + (variable-pitch-mode) + (setq cursor-type 'bar)) + + (cond + ((eq window-system 'w32) + (let* ((font-size 10) + (font-list (font-family-list)) + (mono-face (cond + ((member "Liberation Mono" font-list) + "Liberation Mono") + ((member "Liberation Sans Mono" font-list) + "Liberation Sans Mono") + ((member "Consolas" font-list) + "Consolas"))) + (variable-face "Segoe UI") + (default-font (concat mono-face "-" (number-to-string font-size)))) + (when mono-face + (add-to-list 'default-frame-alist `(font . ,default-font)) + (set-face-font 'fixed-pitch default-font)) + (when variable-face + (set-face-font 'variable-pitch (concat variable-face "-" + (number-to-string (1+ font-size))))))) + ((eq system-type 'darwin) + (let* ((font-size 14) + (mono-face "Droid Sans Mono") + (variable-face "Helvetica_Neue") + (default-font (concat mono-face "-" (number-to-string font-size)))) + (when mono-face + (add-to-list 'default-frame-alist `(font . ,default-font))) + (when (and variable-face (display-graphic-p)) + (set-face-font 'variable-pitch (concat variable-face "-" + (number-to-string (1+ font-size))))))))) + +(let* ((font-height (face-attribute 'default :height)) + (small-font-height (max 1 (floor (* .917 font-height))))) + (mapc (lambda (item) + (put (car item) 'customized-face (cadr item)) + (face-spec-set (car item) (cadr item))) + `((linum + ((t (:height ,small-font-height + :foreground unspecified + :inherit fringe + :overline nil + :slant normal)))) + (vertical-border + ((t (:foreground unspecified + :background unspecified + :inherit file-name-shadow)))) + (font-lock-comment-face + ((t (:slant normal)))) + (font-lock-doc-face + ((t (:slant normal)))) + (popup-face + ((t (:background unspecified + :foreground unspecified + :inherit linum + :height ,font-height)))) + (popup-scroll-bar-foreground-face + ((t (:background unspecified + :inherit region)))) + (popup-scroll-bar-background-face + ((t (:background unspecified + :inherit popup-face)))) + (ac-completion-face + ((t (:background unspecified + :foreground unspecified + :inherit popup-face)))) + (ac-candidate-face + ((t (:background unspecified + :foreground unspecified + :inherit linum + :height ,font-height)))) + (ac-selection-face + ((t (:background unspecified + :foreground unspecified + :inherit font-lock-variable-name-face + :inverse-video t)))) + (ac-candidate-mouse-face + ((t (:background unspecified + :foreground unspecified + :inherit region)))) + (ac-dabbrev-menu-face + ((t (:background unspecified + :foreground unspecified + :inherit popup-face)))) + (ac-dabbrev-selection-face + ((t (:background unspecified + :foreground unspecified + :inherit ac-selection-face)))) + (flymake-warnline + ((t (:background unspecified + :foreground unspecified + :inherit font-lock-preprocessor-face)))) + (org-table ((t (:inherit 'fixed-pitch)))) + (org-formula ((t (:foreground "Firebrick" + :inherit 'fixed-pitch)))) + (org-done ((t (:weight normal + :strike-through t)))) + (org-headline-done ((t (:strike-through t))))))) + +;;;; Autosaves & Backups +(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)) + auto-save-file-name-transforms `((".*" ,temporary-file-directory t)) + backup-by-copying-when-linked t + backup-by-copying-when-mismatch t)) + +;;;; Buffers + +(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))))) + +(use-package uniquify + :config (progn + (setq uniquify-buffer-name-style 'reverse + uniquify-separator "/" + uniquify-after-kill-buffer-p t + uniquify-ignore-buffers-re "^\\*"))) + +(use-package fancy-narrow + :config (fancy-narrow-mode 1)) + +;;;; Communication + +(use-package erc + :config (progn + (setq erc-user-full-name "Alan Pearce" + erc-email-userid "alan@alanpearce.co.uk" + erc-echo-notice-in-minibuffer t + erc-keywords '("alanpearce" "lethalrocks") + erc-autojoin-channels-alist + '(("freenode.net" "#emacs" "##freebsd" "#bufferbloat" "#openwrt" "#lojban" "#zfs" "#introverts") + ("what.cd" "#what.cd") + ("beusergroup.co.uk" "#be"))) + (add-to-list 'erc-modules 'scrolltobottom) + (add-to-list 'erc-modules 'autojoin) + (add-to-list 'erc-modules 'match))) + +(setq message-send-mail-function 'smtpmail-send-it) +(setq smtpmail-smtp-server "external.home" + smtpmail-smtp-service 587) + +(use-package mu4e + :if (and (eq env/location 'home) + (eq env/system-type 'desktop)) + :load-path "/usr/share/emacs/site-lisp/mu4e" + :commands (mu4e) + :config (progn + (setq mu4e-get-mail-command "true" + mu4e-update-interval 300 + mu4e-sent-folder "/alanpearce/Sent" + mu4e-drafts-folder "/alanpearce/Drafts" + mu4e-refile-folder "/alanpearce/Archive") + (bind-key "q" #'bury-buffer mu4e-main-mode-map) + (bind-key "d" #'mu4e-headers-mark-for-delete mu4e-headers-mode-map))) + +;;;; Completion + +(setq completion-styles '(basic initials partial-completion substring) + completion-ignore-case t) + +(use-package smart-tab + :init (global-smart-tab-mode) + :config (progn + (nconc smart-tab-completion-functions-alist '((php-mode . php-complete-function))) + (diminish 'smart-tab-mode ""))) + +(use-package company + :commands (company-mode) + :bind (("C-" . company-complete)) + :init (progn + (add-hook 'prog-mode-hook #'company-mode) + (setq company-idle-delay .3 + company-begin-commands '(self-insert-command)))) + +;;;; Dates & Times + +(use-package calendar + :config (progn + (setq calendar-week-start-day 1) + (calendar-set-date-style 'iso))) + +(defun insert-date (prefix) + "Insert the current date. With prefix-argument, use British format. With + 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)))) + +;;;; Directory browsing +(use-package dired + :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-bind-jump nil) + (when (eq system-type 'darwin) + (setq insert-directory-program "/usr/local/bin/gls")) + (put 'dired-find-alternate-file 'disabled nil))) + +(use-package dired+ + :config (progn + (diredp-toggle-find-file-reuse-dir 1) + (dired-omit-mode 1) + (setq dired-omit-files "#\\|\\.$"))) + +;;;; Documentation + +(add-to-list 'Info-default-directory-list + (concat user-emacs-directory + "info")) + +(use-package which-func + :init (which-function-mode) + :config (setq which-func-modes t)) + +;;;; Files + +(prefer-coding-system 'utf-8-auto-unix) +(set-default-coding-systems 'utf-8-auto-unix) +(setq-default buffer-file-coding-system 'utf-8-auto-unix) +(global-auto-revert-mode 1) + +(add-hook 'before-save-hook #'delete-trailing-whitespace) + +(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))))))))) + +(defun delete-current-buffer-file () + "Removes file connected to current buffer and kills buffer." + (interactive) + (let ((filename (buffer-file-name)) + (buffer (current-buffer))) + (if (not (and filename (file-exists-p filename))) + (ido-kill-buffer) + (when (yes-or-no-p "Are you sure you want to remove this file? ") + (if (vc-backend filename) + (vc-delete-file filename) + (delete-file filename) + (kill-buffer buffer) + (message "File '%s' successfully removed" filename)))))) + +(use-package recentf + :init (progn (setq recentf-auto-cleanup 'never + recentf-save-file (expand-file-name "recentf" user-emacs-directory)) + (recentf-mode 1))) + +(use-package saveplace + :config (progn (setq-default save-place t) + (setq save-place-file (expand-file-name ".saveplace" user-emacs-directory)))) + +(use-package tramp + :config (progn + (setq tramp-default-method (if (eq system-type 'windows-nt) "plinkx" "ssh") + tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root") (nil nil "alan")) + 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 + :config (progn + (add-to-list 'tramp-remote-path "/usr/local/sbin") + (add-to-list 'tramp-remote-path "~/bin"))) + +(use-package ediff + :config (progn + (setq ediff-split-window-function 'split-window-horizontally + ediff-window-setup-function 'ediff-setup-windows-plain))) + +;;;; Indentation + +(setq-default tab-width 4 + indent-tabs-mode t) +(setq tab-stop-list + ;; (mapcar (lambda (x) + ;; (* 4 x)) + ;; (number-sequence 1 (/ 120 4))) + '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120) + tab-always-indent 'complete) + +(use-package auto-indent-mode + :commands (auto-indent-minor-mode + 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 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-global-mode) + (defun lisp-auto-indent-mode () + (set (make-local-variable 'auto-indent-assign-indent-level) 2)) + (add-hook 'lisp-common-mode-hook #'lisp-auto-indent-mode))) + +(use-package smart-tabs-mode + :commands (smart-tabs-mode + smart-tabs-mode-enable + smart-tabs-advice) + :config (progn + (smart-tabs-insinuate 'c 'javascript 'cperl 'python) + (add-hook 'php-mode-hook #'smart-tabs-mode-enable))) + +;;;; Keybindings + +(when (eq system-type 'darwin) + (set-keyboard-coding-system nil) + (setq mac-option-modifier 'meta + mac-right-option-modifier 'left + mac-control-modifier 'control + mac-right-control-modifier 'left + mac-command-modifier 'super + mac-right-command-modifier 'left + mac-function-modifier 'hyper)) + +(unbind-key "") +(bind-key "" #'compile) +(bind-key "" #'kmacro-start-macro-or-insert-counter) +(bind-key "" #'kmacro-end-or-call-macro) + +(bind-key "" #'execute-extended-command) + +(unbind-key "C-z") +(bind-key "C-" #'other-window) + +(bind-key "C-x C-r" #'revert-buffer) +(bind-key "C-x C-j" #'delete-indentation) +(unbind-key "C-x C-c") + +(bind-key "C-c i" #'ucs-insert) +(bind-key "M-/" #'hippie-expand) + +(unbind-key "s-h") +(unbind-key "s-n") +(unbind-key "s-p") +(unbind-key "s-w") + +(bind-key "s-x" (define-prefix-command 'super-x-map)) + +(bind-key "s-," (lambda () + (interactive) + (jump-to-register ?e))) +(set-register ?e `(file . ,*init-file*)) +(set-register ?z `(file . ,(expand-file-name ".zshrc" "~"))) + +;; Enable narrowing functions C-x n +(put 'narrow-to-defun 'disabled nil) +(put 'narrow-to-page 'disabled nil) +(put 'narrow-to-region 'disabled nil) + +;;;; Minibuffer + +(setq enable-recursive-minibuffers t) +(minibuffer-depth-indicate-mode t) + +(if (daemonp) + (defalias 'exit-emacs #'delete-frame) + (defalias 'exit-emacs #'save-buffers-kill-emacs)) + +(use-package lacarte + :bind (("M-`" . lacarte-execute-menu-command))) + +(use-package helm-config + :bind (("C-x i" . helm-imenu)) + :config (setq helm-idle-delay .1 + helm-input-idle-delay .1)) + +(use-package ido + :bind (("C-x b" . ido-switch-buffer)) + :init (progn + (setq ido-save-directory-list-file (expand-file-name "ido-state" user-emacs-directory)) + (bind-key* "C-x C-f" #'ido-find-file) + (ido-mode 1)) + :config (progn + (setq ido-auto-merge-delay-time 99999 + ido-enable-flex-matching t) + + (ido-init-completion-maps) + (defun ido-manual-merge () + (interactive) + (ido-initiate-auto-merge (current-buffer))) + (bind-key "C-c C-s" #'ido-manual-merge ido-file-dir-completion-map))) + +(defun ap/ido-projectile-switch-buffer-dwim (force-ido) + (interactive "p") + (if (and (projectile-project-p) (eq force-ido 1)) + (call-interactively #'projectile-switch-to-buffer) + (call-interactively #'ido-switch-buffer))) + +(bind-key "s-x b" #'ap/ido-projectile-switch-buffer-dwim) +(bind-key "s-x s-b" #'ap/ido-projectile-switch-buffer-dwim) + +(use-package ido-vertical-mode + :config (ido-vertical-mode 1)) + +(use-package flx-ido + :init (progn + (flx-ido-mode 1))) + +(use-package smex + :bind (("M-x" . smex) + ("" . smex) + ("" . smex) + ("M-X" . smex-major-mode-commands) + ("C-c M-x" . execute-extended-command)) + :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")) + (smex-initialize))) + +;;;; Modeline + +(column-number-mode t) +(size-indication-mode t) + +;;;; Modes + +;;;; systemd files +(add-to-list 'auto-mode-alist '("\\.service\\'" . conf-mode)) +(add-to-list 'auto-mode-alist '("\\.target\\'" . conf-mode)) +(add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-mode)) + +(use-package xrdb-mode + :mode (("\\.Xdefaults\\'" . xrdb-mode) + ("\\.Xresources\\'" . xrdb-mode))) + +(use-package haskell-mode + :mode (("\\.hs\\'" . haskell-mode) + ("xmobarrc\\'" . haskell-mode))) + +(use-package nginx-mode + :mode (("nginx.conf" . nginx-mode))) + +(use-package lua-mode + :mode (("\\.lua\\'" . lua-mode))) + +(use-package puppet-mode + :mode (("\\.pp\\'" . puppet-mode)) + :config (progn + (add-hook 'puppet-mode-hook #'autopair-mode))) + +(use-package ruby-mode + :mode (("\\.rb\\'" . ruby-mode) + ("\\.cap\\'" . ruby-mode))) + +(use-package yaml-mode + :mode (("/group_vars/.*" . yaml-mode) + ("/host_vars/.*" . yaml-mode)) + :config (progn + (add-hook 'yaml-mode-hook #'autopair-mode))) + +;;;; Planning + +(use-package org + :bind (("C-c C-a" . org-agenda-list) + ("C-c a" . org-agenda) + ("C-c l" . org-store-link) + ("C-c r" . org-remember)) + :config (progn + (setq org-directory "~/org" + org-agenda-files `(,org-directory) + + org-default-notes-file (concat org-directory "/notes") + + ;; Fewer asterisks, doesn't change indentation + org-hide-leading-stars t + + org-startup-indented t + + ;; ‘Remember’: new items at top + org-reverse-note-order t + + org-modules '(org-habit + org-checklist) + + ;; Add time done to ‘done’ tasks + org-log-done 'time + + ;; Allow refiling into any org file + org-refile-targets '((org-agenda-files :maxlevel . 3)) + + org-list-allow-alphabetical t + + org-pretty-entities t + + org-table-duration-custom-format 'seconds + + org-export-have-math t + + org-blank-before-new-entry '((heading . t) + (plain-list-item . auto)) + org-fontify-done-headline t + + org-replace-disputed-keys t + org-todo-keywords '((sequence "TODO" "STARTED" "|" "DONE") + (sequence "TOLEARN" "LEARNING" "LEARNED" "|" "MASTERED") + (sequence "|" "CANCELLED"))) + (set-register ?o `(file . ,(expand-file-name "organiser.org" org-directory))) + (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"))))))) + +(use-package org-journal + :config (progn + (setq org-journal-date-format "%A, %d %B %Y"))) + +;;;; Programming + +(use-package cedet + :disabled t + :config (progn + (semantic-load-enable-code-helpers) + (global-semantic-idle-completions-mode t) + (global-semantic-highlight-func-mode t) + (global-semantic-show-unmatched-syntax-mode t) + (global-semantic-decoration-mode t))) + +;;;; Projects + +(use-package projectile + :bind (("C-c C-f" . projectile-find-file) + ("s-x s-f" . projectile-find-file)) + :commands (projectile-global-mode)) + +(use-package project-persist + :commands (project-persist-mode) + :bind (("C-c P d" . project-persist-delete) + ("C-c P f" . project-persist-find) + ("C-c P k" . project-persist-close) + ("C-c P n" . project-persist-create) + ("C-c P s" . project-persist-save)) + :init (eval-when-compile + (autoload #'pp/settings-get "project-persist")) + :config (progn + (project-persist-mode t) + + (setq project-persist-auto-save-global t) + + (add-hook 'project-persist-before-load-hook #'kill-all-buffers) + + (defun emacs-process-p (pid) + "If pid is the process ID of an emacs process, return t, else nil. +Also returns nil if pid is nil." + (when pid + (let ((attributes (process-attributes pid)) (cmd)) + (dolist (attr attributes) + (if (string= "comm" (car attr)) + (setq cmd (cdr attr)))) + (if (and cmd (or (string= "emacs" cmd) (string= "emacs.exe" cmd))) t)))) + + (defadvice desktop-owner (after pry-from-cold-dead-hands activate) + "Don't allow dead emacsen to own the desktop file." + (when (not (emacs-process-p ad-return-value)) + (setq ad-return-value nil))) + + (defun load-project-desktop () + "Load the project's desktop if available" + (ignore-errors + (let ((default-directory project-persist-current-project-settings-dir)) + (desktop-read)))) + + (defun kill-all-buffers () + "Kill all file-based buffers." + (interactive) + (mapc (lambda (buf) + (when (buffer-file-name buf) + (when (and (buffer-modified-p buf) + (y-or-n-p (format "Buffer %s is modified - save it?" (buffer-name buf)))) + (save-some-buffers nil buf)) + (set-buffer-modified-p nil) + (kill-buffer buf))) + (buffer-list))) + + (add-hook 'project-persist-after-close-hook + (lambda () + (kill-all-buffers) + (projectile-global-mode -1))) + + (add-hook 'project-persist-after-load-hook + (lambda () + (setq default-directory (pp/settings-get 'root-dir)) + (load-project-desktop) + (projectile-global-mode 1))) + + (add-hook 'project-persist-after-save-hook + (lambda () + (message (format "Saving project desktop (%s)" project-persist-current-project-settings-dir)) + (desktop-save project-persist-current-project-settings-dir))) +)) + +(use-package vc + :config (progn + (setq vc-follow-symlinks t))) + +(use-package diff-hl + :init (progn + (global-diff-hl-mode) + (add-hook 'magit-refresh-file-buffer-hook #'diff-hl-update))) + +(use-package magit + :commands (magit-status) + :bind (("C-x g" . magit-status) + ("s-G" . magit-status)) + :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) + +;;;; Spelling +(setq ispell-program-name "aspell" + ispell-dictionary "british") +;; (setq ispell-process-directory (expand-file-name "~/")) +;; If aspell is too slow +;; If it is still too slow, use ‘ultra’ instead of ‘fast’ +;; (setq ispell-extra-args '(" --sug-mode=fast")) +(use-package ispell + :bind (("" . ispell-word))) + +;;;; Scripting + +(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 ntcmd + :mode (("\\`.cmd\\'" . ntcmd-mode) + ("\\`.bat\\'" . ntcmd-mode))) + +;;;; Shells & REPLs + +(use-package eshell + :bind ("C-c s" . eshell) + :config (progn + (setq eshell-directory-name "~/.emacs.d/eshell") + (use-package em-smart + :init (progn + (setq eshell-where-to-jump 'begin + eshell-review-quick-commands nil + eshell-smart-space-goes-to-end t) + (eshell-smart-initialize))))) + +(autoload #'eshell/cd "em-dirs") +(defun eshell-goto-current-dir (&optional arg) + (interactive "P") + (let ((dir default-directory)) + (eshell arg) + (eshell/cd dir))) +(bind-key "C-c S" #'eshell-goto-current-dir) + +(use-package shell + :config (define-key shell-mode-map + (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) + +(use-package multi-term + :if (not (eq system-type 'windows-nt)) + :bind ("C-`" . multi-term-dedicated-toggle)) + +(defun comint-delchar-or-eof-or-kill-buffer (arg) + (interactive "p") + (if (null (get-buffer-process (current-buffer))) + (kill-buffer) + (comint-delchar-or-maybe-eof arg))) + +;;;; Text editing + +;; Enable upcase and downcase-region +(put 'upcase-region 'disabled nil) +(put 'downcase-region 'disabled nil) +(setq sentence-end-double-space nil + line-move-visual nil) + +(setq x-select-enable-clipboard t) +(if (functionp 'x-cut-buffer-or-selection-value) + (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)) + +;; replace highlighted text rather than just inserting at point +(delete-selection-mode t) + +(show-paren-mode t) + +(bind-key "S-SPC" #'set-mark-command) + +(use-package subword + :init (global-subword-mode t)) + +(use-package misc + :bind (("M-z" . zap-up-to-char) + ("M-Z" . zap-to-char))) + +(use-package ap-functions + :commands (ap/remove-extra-cr) + :bind (("C-x r M-w" . copy-rectangle) + ("M-!" . shell-execute))) + +(when (boundp 'x-select-request-type) + (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))) + +(use-package ace-jump-mode + :bind (("C-c SPC" . ace-jump-mode)) + :config (progn + (ace-jump-mode-enable-mark-sync) + (setq ace-jump-word-mode-use-query-char nil + ace-jump-mode-scope 'window))) + +(use-package autopair + :commands (autopair-mode + autopair-on) + :init (progn + (add-hook 'prog-mode-hook #'autopair-on) + (defun autopair-off () + (autopair-mode -1)) + (add-hook 'lisp-common-mode-hook #'autopair-off) + (setq autopair-blink nil + autopair-skip-whitespace nil))) + +(use-package expand-region + :bind ("C-M-SPC" . er/expand-region)) + +(use-package goto-chg + :bind ("C-x SPC" . goto-last-change)) + +(use-package multiple-cursors + :config (progn + (bind-key "C-." #'mc/mark-next-like-this) + (bind-key "C-," #'mc/mark-previous-like-this) + (bind-key "M-" #'mc/mark-all-like-this-dwim) + (bind-key "C-" #'mc/mark-more-like-this-extended) + (bind-key "C-S-L" #'mc/edit-lines))) + +(use-package eldoc + :config (progn + (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) + +(use-package paredit + :commands (paredit-mode) + :init (progn + (add-hook 'lisp-common-mode-hook #'enable-paredit-mode) + (put #'paredit-forward-delete 'delete-selection 'supersede) + (put #'paredit-backward-delete 'delete-selection 'supersede) + (add-hook 'minibuffer-setup-hook #'conditionally-enable-paredit-mode) + (defun conditionally-enable-paredit-mode () + "enable paredit-mode during eval-expression" + (if (eq this-command 'eval-expression) + (paredit-mode 1))))) + +(use-package shuffle-lines + :bind (("C-S-" . move-line-up) + ("C-S-" . move-line-down))) + +(use-package smart-forward + :bind (("C-M-u" . smart-up) + ("C-M-d" . smart-down) + ("C-M-p" . smart-backward) + ("C-M-n" . smart-forward))) + +(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))) + :diminish undo-tree-mode) + +;;;; Lisps + +(defun ap/lisp-setup () + (run-hooks 'lisp-common-mode-hook) + (setq indent-tabs-mode nil) + (local-set-key (kbd "RET") #'paredit-newline)) + +(defun set-common-lisp-indentation () + (set (make-local-variable 'lisp-indent-function) + #'common-lisp-indent-function)) + +(add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup) +(add-hook 'emacs-lisp-mode-hook #'turn-on-eldoc-mode) + +(add-hook 'scheme-mode-hook #'ap/lisp-setup) +(add-hook 'lisp-mode-hook #'ap/lisp-setup) +(add-hook 'lisp-mode-hook #'set-common-lisp-indentation) + +(use-package elisp-slime-nav + :commands elisp-slime-nav-mode + :diminish elisp-slime-nav-mode) + +(use-package geiser + :commands (geiser-mode + geiser + run-geiser + run-racket) + :config (use-package quack)) + +(use-package redshank + :init (progn + (add-hook 'lisp-common-mode-hook #'turn-on-redshank-mode))) + +(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")))) + +(defun imenu-elisp-sections () + (setq imenu-prev-index-position-function nil) + (add-to-list 'imenu-generic-expression '("Sections" "^;;;; \\(.+\\)$" 1) t) + (add-to-list 'imenu-generic-expression '("Packages" "^(use-package\\s-+\\(\\(\\sw\\|\\s_\\)+\\)$" 1) t)) + +(defun init-narrow-to-section () + (interactive) + (save-excursion + (beginning-of-line) + (unless (looking-at "^;;;;") + (re-search-backward "^;;;;" nil t)) + (push-mark) + (forward-line) + (re-search-forward "^;;;;" nil t) + (forward-line -1) + (narrow-to-region (region-beginning) (region-end)))) + +(defun init-imenu (p) + (interactive "P") + (find-file-existing *init-file*) + (widen) + (helm-imenu) + (if p (init-narrow-to-section))) + +(add-hook 'emacs-lisp-mode-hook 'imenu-elisp-sections) + +(defun eval-and-replace () + "Replace the preceding sexp with its value." + (interactive) + (backward-kill-sexp) + (condition-case nil + (prin1 (eval (read (current-kill 0))) + (current-buffer)) + (error (message "Invalid expression") + (insert (current-kill 0))))) + +(bind-key "C-c e" #'eval-and-replace) + +;;;; Programming + +(use-package auto-compile + :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) + +(use-package cc-mode + :init (progn + (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 '+))) + +(use-package quickrun) + +;;;; Web Development + +(use-package skewer-mode + :init (progn + (add-hook 'js2-mode-hook #'skewer-mode) + (add-hook 'html-mode-hook #'skewer-html-mode) + (add-hook 'css-mode-hook #'skewer-css-mode))) + +(use-package js2-mode + :mode ("\\.js\\'" . js2-mode) + :config (progn + (defun ap/javascript-setup () + (autopair-mode -1) + (auto-indent-mode -1)) + (add-hook 'js2-mode-hook #'ap/javascript-setup) + (setq js2-basic-offset 4 + js2-global-externs '("$")))) + +(use-package mustache-mode + :mode (("\\.mustache" . mustache-mode) + ("\\.mt\\'" . mustache-mode) + ("\\.template\\'" . mustache-mode))) + +(use-package jinja2-mode + :mode (("\\.j2\\'" . jinja2-mode))) + +(use-package php-mode + :mode ("\\.php\\'" . php-mode) + :config (progn + (bind-key "C-h C-f" #'php-search-documentation php-mode-map) + (unbind-key "C-c C-f" php-mode-map) + (unbind-key "C-." php-mode-map) + (c-add-style "ap" + '((c-basic-offset . 4) + (c-offsets-alist . ((arglist-cont . php-lineup-arglist) + (arglist-intro . php-lineup-arglist-intro) + (arglist-close . php-lineup-arglist-close) + (topmost-intro-cont . (first c-lineup-cascaded-calls + php-lineup-arglist-intro)) + (brace-list-intro . +) + (brace-list-entry . c-lineup-cascaded-calls) + (case-label . 4) + (statement-case-intro . 4) + (defun-close . 0) + (defun-block-intro . +) + (knr-argdecl . [0]) + (arglist-cont-nonempty . c-lineup-cascaded-calls) + (statement-cont . php-lineup-hanging-semicolon))))) + (defun ap/php-style () + (setq indent-tabs-mode t + c-indent-comments-syntactically-p t) + (c-set-style "ap")) + (add-hook 'php-mode-hook #'ap/php-style) + (add-hook 'php-mode-hook #'turn-on-eldoc-mode))) + +(use-package sgml-mode + :config (setq sgml-basic-offset 4)) + +(use-package emmet-mode + :config (progn + (if (functionp 'web-mode) + (add-hook 'web-mode-hook #'emmet-mode)))) + +(use-package web-mode + :mode (("/views/.*\\.php\\'" . web-mode) + ("/templates/.*\\.php\\'" . web-mode)) + :config (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-disable-auto-pairing t)) + +;;;; Windows & Frames + +(setq frame-title-format + '("" + (:eval (capitalize invocation-name)) ": " + (:eval (if (buffer-file-name) + (abbreviate-file-name (buffer-file-name)) + "%b")))) + +(setq scroll-conservatively 100 ; Keep the cursor position when scrolling + scroll-margin 1 + scroll-preserve-screen-position nil + mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control)))) + +(when menu-bar-mode + (menu-bar-mode -1)) +(when scroll-bar-mode + (scroll-bar-mode -1) + (tooltip-mode -1) + (tool-bar-mode -1)) + +(winner-mode 1) + +(use-package windmove + :bind (("S-" . windmove-left) + ("S-" . windmove-right) + ("S-" . windmove-up) + ("S-" . windmove-down))) + +(if (eq system-type 'darwin) + (setq ns-pop-up-frames nil)) diff --git a/tag-git/config/git/config b/tag-git/config/git/config new file mode 100644 index 00000000..fb728fff --- /dev/null +++ b/tag-git/config/git/config @@ -0,0 +1,25 @@ +[user] + email = alan@alanpearce.co.uk + name = Alan Pearce +[color] + branch = auto + diff = auto + status = auto + ui = true +[push] + default = current +[alias] + st = status -sb + ci = commit + br = branch + co = checkout + ready = rebase -i @{u} + lg = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' + standup = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --since yesterday --author alan + ignored = ls-files --others -i --exclude-standard +[github] + user = alan@alanpearce.co.uk +[diff] + algorithm = patience +[core] + excludesfile = ~/.config/git/global.gitignore diff --git a/tag-git/config/git/ignore b/tag-git/config/git/ignore new file mode 100644 index 00000000..7e23dcab --- /dev/null +++ b/tag-git/config/git/ignore @@ -0,0 +1,29 @@ +.DS_Store +.AppleDouble +.LSOverride +Icon +Desktop.ini + +# Thumbnails +._* +Thumbs.db + +# Emacs +*~ +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +.elc +auto-save-list +tramp +.\#* + +.envrc + +# Org-mode +.org-id-locations +*_archive + +GPATH +GRTAGS +GTAGS \ No newline at end of file diff --git a/tag-hg/hgrc b/tag-hg/hgrc new file mode 100644 index 00000000..2f16f27e --- /dev/null +++ b/tag-hg/hgrc @@ -0,0 +1,9 @@ +[ui] +username = Alan Pearce + +[extensions] +purge = +progress = +color = +eol = +record = \ No newline at end of file diff --git a/tag-minttyrc/minttyrc b/tag-minttyrc/minttyrc new file mode 100644 index 00000000..2e7f2d86 --- /dev/null +++ b/tag-minttyrc/minttyrc @@ -0,0 +1,33 @@ +BoldAsFont=no +Font=Cousine +FontHeight=12 +FontSmoothing=default +Locale=en_GB +Charset=UTF-8 +Columns=100 +Rows=36 +Scrollbar=none +Transparency=off +OpaqueWhenFocused=no +CursorType=block +CursorBlinks=no +RightClickAction=extend +BoldBlack=0,43,54 +Black=7,54,66 +BoldGreen=88,110,117 +BoldYellow=101,123,131 +BoldBlue=131,148,150 +BoldCyan=147,161,161 +White=238,232,213 +BoldWhite=253,246,227 +Yellow=181,137,0 +BoldRed=203,75,22 +Red=220,50,47 +Magenta=211,54,130 +BoldMagenta=108,113,196 +Blue=38,139,210 +Cyan=42,161,152 +Green=133,153,0 +ForegroundColour=101,123,117 +BackgroundColour=253,246,227 +CursorColour=112,129,131 diff --git a/tag-ssh/ssh/rc b/tag-ssh/ssh/rc new file mode 100644 index 00000000..7b6da3a8 --- /dev/null +++ b/tag-ssh/ssh/rc @@ -0,0 +1,5 @@ +#!/bin/sh +if [ "$SSH_AUTH_SOCK" ] +then + ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock +fi diff --git a/tag-tmux/tmux.conf b/tag-tmux/tmux.conf new file mode 100644 index 00000000..697e1238 --- /dev/null +++ b/tag-tmux/tmux.conf @@ -0,0 +1,19 @@ +#setw -g xterm-keys on +#set -g terminal-overrides "xterm*:kLFT5=\eOD:kRIT5=\eOC:kUP5=\eOA:kDN5=\eOB:smkx@:rmkx@" + +set-window-option -g utf8 on +set-option -g status-utf8 on +set-option -g prefix C-z + +bind C-n send-prefix +unbind-key C-b + +set -g default-terminal "screen-256color" + +# Colemak style +bind-key C-i next-window + +set -g base-index 1 + +set -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_GIT SSH_CONNECTION WINDOWID XAUTHORITY" +set-environment -g 'SSH_AUTH_SOCK' '/home/alan/.ssh/ssh_auth_sock' \ No newline at end of file diff --git a/tag-xbindkeys/xbindkeysrc.scm b/tag-xbindkeys/xbindkeysrc.scm new file mode 100644 index 00000000..7b00c38d --- /dev/null +++ b/tag-xbindkeys/xbindkeysrc.scm @@ -0,0 +1,57 @@ +;; To specify a key, you can use 'xbindkeys --key' or +;; 'xbindkeys --multikey' and put one of the two lines in this file. + +;; A list of keys is in /usr/include/X11/keysym.h and in +;; /usr/include/X11/keysymdef.h +;; The XK_ is not needed. + +;; List of modifier: +;; Release, Control, Shift, Mod1 (Alt), Mod2 (NumLock), +;; Mod3 (CapsLock), Mod4, Mod5 (Scroll). + + +;; The release modifier is not a standard X modifier, but you can +;; use it if you want to catch release instead of press events + +;; By defaults, xbindkeys does not pay attention to modifiers +;; NumLock, CapsLock and ScrollLock. +;; Uncomment the lines below if you want to use them. +;; To dissable them, call the functions with #f + + +;;;;EXTRA FUNCTIONS: Enable numlock, scrolllock or capslock usage +;;(set-numlock! #t) +;;(set-scrolllock! #t) +;;(set-capslock! #t) + +;;;;; Scheme API reference +;;;; +;; Optional modifier state: +;; (set-numlock! #f or #t) +;; (set-scrolllock! #f or #t) +;; (set-capslock! #f or #t) +;; +;; Shell command key: +;; (xbindkey key "foo-bar-command [args]") +;; (xbindkey '(modifier* key) "foo-bar-command [args]") +;; +;; Scheme function key: +;; (xbindkey-function key function-name-or-lambda-function) +;; (xbindkey-function '(modifier* key) function-name-or-lambda-function) +;; +;; Other functions: +;; (remove-xbindkey key) +;; (run-command "foo-bar-command [args]") +;; (grab-all-keys) +;; (ungrab-all-keys) +;; (remove-all-keys) +;; (debug) + +(xbindkey '(mod4 F9) "mpc toggle") +(xbindkey '(mod4 F10) "mpc prev") +(xbindkey '(mod4 F11) "mpc next") +(xbindkey '(mod4 F12) "mpc stop") + +(xbindkey '(mod4 p) "dmenu_run -fn '-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*' -nb '#002b36' -nf '#fdf6e3' -sb '#586e75' -sf '#fdf6e3' -hist '/home/alan/.cache/dmenu_run_history'") +(xbindkey '(mod4 shift T) "urxvtc") +(xbindkey '(mod4 shift E) "emacsclient -c") diff --git a/tag-xmobar/xmobarrc b/tag-xmobar/xmobarrc new file mode 100644 index 00000000..7dfcef22 --- /dev/null +++ b/tag-xmobar/xmobarrc @@ -0,0 +1,40 @@ +Config { font = "-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*" + , borderColor = "#657b83" + , border = TopB + , bgColor = "#002b36" + , fgColor = "#fdf6e3" + , position = Bottom + , lowerOnStart = False + , hideOnStart = False + , persistent = True + , commands = [ Run Weather "EGNX" ["-t", "ºC" + ,"-L", "12" + ,"-H", "18" + ,"--low", "lightblue" + ,"--normal", "green" + ,"--high", "red" + ] 36000 + , Run DynNetwork ["-t", "Net: ¦KB" + ,"-L", "512" + ,"-H", "10240" + ,"--low", "green" + ,"--normal", "yellow" + ,"--high", "red" + ,"-m", "5" + ] 5 + , Run Cpu ["-p", "3" + ,"-L", "3" + ,"-H", "50" + ,"--normal", "green" + ,"--high", "red" + ] 5 + , Run Memory ["-p", "3" + ,"-t", "Mem: %" + ] 20 + , Run Date "%a %b %_d %Y %H:%M:%S" "date" 10 + , Run MPD ["-t", ": - "] 10 + ] + , sepChar = "%" + , alignSep = "}{" + , template = "%cpu% | %memory% | %dynnetwork% | %mpd% }{ %EGNX% | %date%" + } diff --git a/tag-xresources/xresources/main b/tag-xresources/xresources/main new file mode 100644 index 00000000..77c21ce3 --- /dev/null +++ b/tag-xresources/xresources/main @@ -0,0 +1,33 @@ +#include "solarized-light" + +Xcursor.theme: Neutral +Xcursor.size: 22 + +URxvt.fading: 0 +URxvt.geometry: 100x40 +URxvt.urgentOnBell: true + +URxvt.scrollBar: false +URxvt.scrollstyle: plain +URxvt.scrollTtyOutput: false +URxvt.scrollWithBuffer: true +URxvt.scrollTtyKeypress: true +URxvt.saveLines: 16384 +URxvt.secondaryScroll: false + +URxvt.font: -xos4-terminus-medium-r-normal--14-140-72-72-c-80-*-* +URxvt.boldFont: +URxvt.intensityStyles: true + +URxvt.pointerBlank: true +URxvt.pointerBlankDelay: 987654321 +URxvt.letterSpace: 0 + +Emacs.ToolBar: off +Emacs.MenuBar: off +Emacs.ScrollBars: off +Emacs.CursorBlink: off + +Emacs.Font: -*-Droid Sans Mono-medium-*-*-*-*-140-*-*-*-*-*-* +Emacs.fixed-pitch.attributeFont: -*-Droid Sans Mono-medium-*-*-*-*-140-*-*-*-*-*-* +Emacs.variable-pitch.attributeFont: -*-Arimo-medium-*-*-*-*-160-*-*-*-*-*-* diff --git a/tag-xresources/xresources/solarized-light b/tag-xresources/xresources/solarized-light new file mode 100644 index 00000000..3906b7b0 --- /dev/null +++ b/tag-xresources/xresources/solarized-light @@ -0,0 +1,70 @@ +! Solarized color scheme for the X Window System +! +! http://ethanschoonover.com/solarized + + +! Common + +#define S_yellow #b58900 +#define S_orange #cb4b16 +#define S_red #dc322f +#define S_magenta #d33682 +#define S_violet #6c71c4 +#define S_blue #268bd2 +#define S_cyan #2aa198 +#define S_green #859900 + + +! Dark + +! #define S_base03 #002b36 +! #define S_base02 #073642 +! #define S_base01 #586e75 +! #define S_base00 #657b83 +! #define S_base0 #839496 +! #define S_base1 #93a1a1 +! #define S_base2 #eee8d5 +! #define S_base3 #fdf6e3 + + +! Light + +#define S_base03 #fdf6e3 +#define S_base02 #eee8d5 +#define S_base01 #93a1a1 +#define S_base00 #839496 +#define S_base0 #657b83 +#define S_base1 #586e75 +#define S_base2 #073642 +#define S_base3 #002b36 + + +! To only apply colors to your terminal, for example, prefix +! the color assignment statement with its name. Example: +! +! URxvt*background: S_base03 + +*background: S_base03 +*foreground: S_base0 +*fading: 40 +*fadeColor: S_base03 +*cursorColor: S_base1 +*pointerColorBackground: S_base01 +*pointerColorForeground: S_base1 + +*color0: S_base02 +*color1: S_red +*color2: S_green +*color3: S_yellow +*color4: S_blue +*color5: S_magenta +*color6: S_cyan +*color7: S_base2 +*color8: S_base03 +*color9: S_orange +*color10: S_base01 +*color11: S_base00 +*color12: S_base0 +*color13: S_violet +*color14: S_base1 +*color15: S_base3 diff --git a/tag-zsh/config/zsh/completion/_tmux_pane_words b/tag-zsh/config/zsh/completion/_tmux_pane_words new file mode 100644 index 00000000..6ff9ce18 --- /dev/null +++ b/tag-zsh/config/zsh/completion/_tmux_pane_words @@ -0,0 +1,10 @@ +local expl +local -a w + +if [[ -z "$TMUX_PANE" ]]; then + _message "not running inside tmux!" + return 1 +fi + +w=( ${(u)=$(tmux capture-pane \; show-buffer \; delete-buffer)} ) +_wanted values expl 'words from current tmux pane' compadd -a w diff --git a/tag-zsh/config/zsh/fasd.zsh b/tag-zsh/config/zsh/fasd.zsh new file mode 100644 index 00000000..64dbf7b0 --- /dev/null +++ b/tag-zsh/config/zsh/fasd.zsh @@ -0,0 +1,85 @@ +alias a='fasd -a' +alias s='fasd -si' +alias sd='fasd -sid' +alias sf='fasd -sif' +alias d='fasd -d' +alias f='fasd -f' +# function to execute built-in cd +fasd_cd() { + if [ $# -le 1 ]; then + fasd "$@" + else + local _fasd_ret="$(fasd -e 'printf %s' "$@")" + [ -z "$_fasd_ret" ] && return + [ -d "$_fasd_ret" ] && cd "$_fasd_ret" || printf %s\n "$_fasd_ret" + fi +} +alias z='fasd_cd -d' +alias zz='fasd_cd -d -i' + +# add zsh hook +_fasd_preexec() { + { eval "fasd --proc $(fasd --sanitize $1)"; } >> "/dev/null" 2>&1 +} +autoload -Uz add-zsh-hook +add-zsh-hook preexec _fasd_preexec + +# zsh command mode completion +_fasd_zsh_cmd_complete() { + local compl + read -c compl + (( $+compstate )) && compstate[insert]=menu # no expand if compsys loaded + reply=(${(f)"$(fasd --complete "$compl")"}) +} + +# enbale command mode completion +compctl -U -K _fasd_zsh_cmd_complete -V fasd -x 'C[-1,-*e],s[-]n[1,e]' -c - \ + 'c[-1,-A][-1,-D]' -f -- fasd fasd_cd + +(( $+functions[compdef] )) && { + # zsh word mode completion + _fasd_zsh_word_complete() { + [ "$2" ] && local _fasd_cur="$2" + [ -z "$_fasd_cur" ] && local _fasd_cur="${words[CURRENT]}" + local fnd="${_fasd_cur//,/ }" + local typ=${1:-e} + fasd --query $typ "$fnd" 2>> "/dev/null" | \ + sort -nr | sed 's/^[^ ]*[ ]*//' | while read -r line; do + compadd -U -V fasd "$line" + done + compstate[insert]=menu # no expand + } + _fasd_zsh_word_complete_f() { _fasd_zsh_word_complete f ; } + _fasd_zsh_word_complete_d() { _fasd_zsh_word_complete d ; } + _fasd_zsh_word_complete_trigger() { + local _fasd_cur="${words[CURRENT]}" + eval $(fasd --word-complete-trigger _fasd_zsh_word_complete $_fasd_cur) + } + # define zle widgets + zle -C fasd-complete complete-word _generic + zstyle ':completion:fasd-complete:*' completer _fasd_zsh_word_complete + zstyle ':completion:fasd-complete:*' menu-select + + zle -C fasd-complete-f complete-word _generic + zstyle ':completion:fasd-complete-f:*' completer _fasd_zsh_word_complete_f + zstyle ':completion:fasd-complete-f:*' menu-select + + zle -C fasd-complete-d complete-word _generic + zstyle ':completion:fasd-complete-d:*' completer _fasd_zsh_word_complete_d + zstyle ':completion:fasd-complete-d:*' menu-select +} + +(( $+functions[compdef] )) && { + # enable word mode completion + orig_comp="$(zstyle -L ':completion:\*' completer 2>> "/dev/null")" + if [ "$orig_comp" ]; then + case $orig_comp in + *_fasd_zsh_word_complete_trigger*);; + *) eval "$orig_comp _fasd_zsh_word_complete_trigger";; + esac + else + zstyle ':completion:*' completer _complete _fasd_zsh_word_complete_trigger + fi + unset orig_comp +} + diff --git a/tag-zsh/config/zsh/freebsd.zsh b/tag-zsh/config/zsh/freebsd.zsh new file mode 100755 index 00000000..6ca0f8d6 --- /dev/null +++ b/tag-zsh/config/zsh/freebsd.zsh @@ -0,0 +1,8 @@ +#!/usr/bin/env zsh +function update-check () { + sudo portsnap update + sudo portmaster -L --index-only | awk '/ [Nn]ew / { print substr($0,9,9999) }' + sudo pkg audit + pkg updating -d $( ls -ltr -D '%Y%m%d' /var/db/pkg | awk 'END{print $6}' ) +} +alias iotop="top -m io -o total" diff --git a/tag-zsh/config/zsh/functions/fasd/fasd b/tag-zsh/config/zsh/functions/fasd/fasd new file mode 100755 index 00000000..b1e64f41 --- /dev/null +++ b/tag-zsh/config/zsh/functions/fasd/fasd @@ -0,0 +1,624 @@ +#!/usr/bin/env sh + +# Fasd (this file) can be sourced or executed by any POSIX compatible shell. + +# Fasd is originally written based on code from z (https://github.com/rupa/z) +# by rupa deadwyler under the WTFPL license. Most if not all of the code has +# been rewritten. + +# Copyright (C) 2011, 2012 by Wei Dai. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +fasd() { + + # make zsh do word splitting inside this function + [ "$ZSH_VERSION" ] && emulate sh && setopt localoptions + + case $1 in + --init) shift + while [ "$1" ]; do + case $1 in + env) + { # source rc files if present + [ -s "/etc/fasdrc" ] && . "/etc/fasdrc" + [ -s "$HOME/.fasdrc" ] && . "$HOME/.fasdrc" + + # set default options + [ -z "$_FASD_DATA" ] && _FASD_DATA="$HOME/.fasd" + [ -z "$_FASD_BLACKLIST" ] && _FASD_BLACKLIST="--help" + [ -z "$_FASD_SHIFT" ] && _FASD_SHIFT="sudo busybox" + [ -z "$_FASD_IGNORE" ] && _FASD_IGNORE="fasd ls echo" + [ -z "$_FASD_SINK" ] && _FASD_SINK=/dev/null + [ -z "$_FASD_TRACK_PWD" ] && _FASD_TRACK_PWD=1 + [ -z "$_FASD_MAX" ] && _FASD_MAX=2000 + [ -z "$_FASD_BACKENDS" ] && _FASD_BACKENDS=native + [ -z "$_FASD_FUZZY" ] && _FASD_FUZZY=2 + [ -z "$_FASD_VIMINFO" ] && _FASD_VIMINFO="$HOME/.viminfo" + [ -z "$_FASD_RECENTLY_USED_XBEL" ] && \ + _FASD_RECENTLY_USED_XBEL="$HOME/.local/share/recently-used.xbel" + + if [ -z "$_FASD_AWK" ]; then + # awk preferences + local awk; for awk in mawk gawk original-awk nawk awk; do + $awk "" && _FASD_AWK=$awk && break + done + fi + } >> "${_FASD_SINK:-/dev/null}" 2>&1 + ;; + + auto) cat <> "$_FASD_SINK" 2>&1 + +EOS + ;; + + posix-alias) cat <& /dev/null || fasd -d'; +EOS + ;; + + zsh-hook) cat <> "$_FASD_SINK" 2>&1 +} +autoload -Uz add-zsh-hook +add-zsh-hook preexec _fasd_preexec + +EOS + ;; + + bash-hook) cat <> "$_FASD_SINK" 2>&1 +} + +# add bash hook +case \$PROMPT_COMMAND in + *_fasd_prompt_func*) ;; + *) PROMPT_COMMAND="_fasd_prompt_func;\$PROMPT_COMMAND";; +esac + +EOS + ;; + + posix-hook) cat <> "$_FASD_SINK" 2>&1 +} +case \$PS1 in + *_fasd_ps1_func*) ;; + *) export PS1="\\\$(_fasd_ps1_func)\$PS1";; +esac + +EOS + ;; + + tcsh-hook) cat <& /dev/null'; +EOS + + ;; + + zsh-ccomp) cat <> "$_FASD_SINK" | \\ + sort -nr | sed 's/^[^ ]*[ ]*//' | while read -r line; do + compadd -U -V fasd "\$line" + done + compstate[insert]=menu # no expand + } + _fasd_zsh_word_complete_f() { _fasd_zsh_word_complete f ; } + _fasd_zsh_word_complete_d() { _fasd_zsh_word_complete d ; } + _fasd_zsh_word_complete_trigger() { + local _fasd_cur="\${words[CURRENT]}" + eval \$(fasd --word-complete-trigger _fasd_zsh_word_complete \$_fasd_cur) + } + # define zle widgets + zle -C fasd-complete complete-word _generic + zstyle ':completion:fasd-complete:*' completer _fasd_zsh_word_complete + zstyle ':completion:fasd-complete:*' menu-select + + zle -C fasd-complete-f complete-word _generic + zstyle ':completion:fasd-complete-f:*' completer _fasd_zsh_word_complete_f + zstyle ':completion:fasd-complete-f:*' menu-select + + zle -C fasd-complete-d complete-word _generic + zstyle ':completion:fasd-complete-d:*' completer _fasd_zsh_word_complete_d + zstyle ':completion:fasd-complete-d:*' menu-select +} + +EOS + ;; + + zsh-ccomp-install) cat <> "$_FASD_SINK" | sed -n "\\\$s/^.*'\\\\(.*\\\\)'/\\\\1/p") + \${COMP_LINE#* }" | while read -r line; do + quote_readline "\$line" 2>/dev/null || \\ + printf %q "\$line" 2>/dev/null && \\ + printf \\\\n + done) + local IFS=\$'\\n'; COMPREPLY=( \$RESULT ) +} +_fasd_bash_hook_cmd_complete() { + for cmd in \$*; do + complete -F _fasd_bash_cmd_complete \$cmd + done +} + +EOS + ;; + + bash-ccomp-install) cat <$`{}]\{1,\}/\1 /g' + ;; + + --proc) shift # process commands + # stop if we don't own $_FASD_DATA or $_FASD_RO is set + [ -f "$_FASD_DATA" -a ! -O "$_FASD_DATA" ] || [ "$_FASD_RO" ] && return + + # blacklists + local each; for each in $_FASD_BLACKLIST; do + case " $* " in *\ $each\ *) return;; esac + done + + # shifts + while true; do + case " $_FASD_SHIFT " in + *\ $1\ *) shift;; + *) break;; + esac + done + + # ignores + case " $_FASD_IGNORE " in + *\ $1\ *) return;; + esac + + shift; fasd --add "$@" # add all arguments except command + ;; + + --add|-A) shift # add entries + # stop if we don't own $_FASD_DATA or $_FASD_RO is set + [ -f "$_FASD_DATA" -a ! -O "$_FASD_DATA" ] || [ "$_FASD_RO" ] && return + + # find all valid path arguments, convert them to simplest absolute form + local paths="$(while [ "$1" ]; do + [ -e "$1" ] && printf %s\\n "$1"; shift + done | sed '/^[^/]/s@^@'"$PWD"'/@ + s@/\.\.$@/../@;s@/\(\./\)\{1,\}@/@g;:0 + s@[^/][^/]*//*\.\./@/@;t 0 + s@^/*\.\./@/@;s@//*@/@g;s@/\.\{0,1\}$@@;s@^$@/@' 2>> "$_FASD_SINK" \ + | tr '\n' '|')" + + # add current pwd if the option is set + [ "$_FASD_TRACK_PWD" = "1" -a "$PWD" != "$HOME" ] && paths="$paths|$PWD" + + [ -z "${paths##\|}" ] && return # stop if we have nothing to add + + # maintain the file + local tempfile + tempfile="$(mktemp "$_FASD_DATA".XXXXXX)" || return + $_FASD_AWK -v list="$paths" -v now="$(date +%s)" -v max="$_FASD_MAX" -F"|" ' + BEGIN { + split(list, files, "|") + for(i in files) { + path = files[i] + if(path == "") continue + paths[path] = path # array for checking + rank[path] = 1 + time[path] = now + } + } + $2 >= 1 { + if($1 in paths) { + rank[$1] = $2 + 1 / $2 + time[$1] = now + } else { + rank[$1] = $2 + time[$1] = $3 + } + count += $2 + } + END { + if(count > max) + for(i in rank) print i "|" 0.9*rank[i] "|" time[i] # aging + else + for(i in rank) print i "|" rank[i] "|" time[i] + }' "$_FASD_DATA" 2>> "$_FASD_SINK" >| "$tempfile" + if [ $? -ne 0 -a -f "$_FASD_DATA" ]; then + env rm -f "$tempfile" + else + env mv -f "$tempfile" "$_FASD_DATA" + fi + ;; + + --delete|-D) shift # delete entries + # stop if we don't own $_FASD_DATA or $_FASD_RO is set + [ -f "$_FASD_DATA" -a ! -O "$_FASD_DATA" ] || [ "$_FASD_RO" ] && return + + # turn valid arguments into entry-deleting sed commands + local sed_cmd="$(while [ "$1" ]; do printf %s\\n "$1"; shift; done | \ + sed '/^[^/]/s@^@'"$PWD"'/@;s@/\.\.$@/../@;s@/\(\./\)\{1,\}@/@g;:0 + s@[^/][^/]*//*\.\./@/@;t 0 + s@^/*\.\./@/@;s@//*@/@g;s@/\.\{0,1\}$@@ + s@^$@/@;s@\([.[\/*^$]\)@\\\1@g;s@^\(.*\)$@/^\1|/d@' 2>> "$_FASD_SINK")" + + # maintain the file + local tempfile + tempfile="$(mktemp "$_FASD_DATA".XXXXXX)" || return + + sed "$sed_cmd" "$_FASD_DATA" 2>> "$_FASD_SINK" >| "$tempfile" + + if [ $? -ne 0 -a -f "$_FASD_DATA" ]; then + env rm -f "$tempfile" + else + env mv -f "$tempfile" "$_FASD_DATA" + fi + ;; + + --query) shift # query the db, --query [$typ ["$fnd" [$mode]]] + [ -f "$_FASD_DATA" ] || return # no db yet + [ "$1" ] && local typ="$1" + [ "$2" ] && local fnd="$2" + [ "$3" ] && local mode="$3" + + # cat all backends + local each _fasd_data; for each in $_FASD_BACKENDS; do + _fasd_data="$_fasd_data +$(fasd --backend $each)" + done + [ "$_fasd_data" ] || _fasd_data="$(cat "$_FASD_DATA")" + + # set mode specific code for calculating the prior + case $mode in + rank) local prior='times[i]';; + recent) local prior='sqrt(100000/(1+t-la[i]))';; + *) local prior='times[i] * frecent(la[i])';; + esac + + if [ "$fnd" ]; then # dafault matching + local bre="$(printf %s\\n "$fnd" | sed 's/\([*\.\\\[]\)/\\\1/g + s@ @[^|]*@g;s/\$$/|/')" + bre='^[^|]*'"$bre"'[^|/]*|' + local _ret="$(printf %s\\n "$_fasd_data" | grep "$bre")" + [ "$_ret" ] && _ret="$(printf %s\\n "$_ret" | while read -r line; do + [ -${typ:-e} "${line%%\|*}" ] && printf %s\\n "$line" + done)" + if [ "$_ret" ]; then + _fasd_data="$_ret" + else # no case mathcing + _ret="$(printf %s\\n "$_fasd_data" | grep -i "$bre")" + [ "$_ret" ] && _ret="$(printf %s\\n "$_ret" | while read -r line; do + [ -${typ:-e} "${line%%\|*}" ] && printf %s\\n "$line" + done)" + if [ "$_ret" ]; then + _fasd_data="$_ret" + elif [ "${_FASD_FUZZY:-0}" -gt 0 ]; then # fuzzy matching + local fuzzy_bre="$(printf %s\\n "$fnd" | \ + sed 's/\([*\.\\\[]\)/\\\1/g;s/\$$/|/ + s@\(\\\{0,1\}[^ ]\)@\1[^|/]\\{0,'"$_FASD_FUZZY"'\\}@g + s@ @[^|]*@g')" + fuzzy_bre='^[^|]*'"$fuzzy_bre"'[^|/]*|' + _ret="$(printf %s\\n "$_fasd_data" | grep -i "$fuzzy_bre")" + [ "$_ret" ] && _ret="$(printf %s\\n "$_ret" | while read -r line; do + [ -${typ:-e} "${line%%\|*}" ] && printf %s\\n "$line" + done)" + [ "$_ret" ] && _fasd_data="$_ret" || _fasd_data= + fi + fi + else # no query arugments + _fasd_data="$(printf %s\\n "$_fasd_data" | while read -r line; do + [ -${typ:-e} "${line%%\|*}" ] && printf %s\\n "$line" + done)" + fi + + # query the database + [ "$_fasd_data" ] && printf %s\\n "$_fasd_data" | \ + $_FASD_AWK -v t="$(date +%s)" -F"|" ' + function frecent(time) { + dx = t-time + if( dx < 3600 ) return 6 + if( dx < 86400 ) return 4 + if( dx < 604800 ) return 2 + return 1 + } + { + if(!paths[$1]) { + times[$1] = $2 + la[$1] = $3 + paths[$1] = 1 + } else { + times[$1] += $2 + if($3 > la[$1]) la[$1] = $3 + } + } + END { + for(i in paths) printf "%-10s %s\n", '"$prior"', i + }' - 2>> "$_FASD_SINK" + ;; + + --backend) + case $2 in + native) cat "$_FASD_DATA";; + viminfo) + < "$_FASD_VIMINFO" sed -n '/^>/{s@~@'"$HOME"'@ + s/^..// + p + }' | $_FASD_AWK -v t="$(date +%s)" '{ + t -= 60 + print $0 "|1|" t + }' + ;; + recently-used) + local nl="$(printf '\\\nX')"; nl="${nl%X}" # slash newline for sed + tr -d '\n' < "$_FASD_RECENTLY_USED_XBEL" | \ + sed 's@file:/@'"$nl"'@g;s@count="@'"$nl"'@g' | sed '1d;s/".*$//' | \ + tr '\n' '|' | sed 's@|/@'"$nl"'@g' | $_FASD_AWK -F'|' '{ + sum = 0 + for( i=2; i<=NF; i++ ) sum += $i + print $1 "|" sum + }' + ;; + *) eval "$2";; + esac + ;; + + *) # parsing logic and processing + local fnd= last= _FASD_BACKENDS="$_FASD_BACKENDS" _fasd_data= comp= exec= + while [ "$1" ]; do case $1 in + --complete) [ "$2" = "--" ] && shift; set -- $2; local lst=1 r=r comp=1;; + --query|--add|--delete|-A|-D) fasd "$@"; return $?;; + --version) [ -z "$comp" ] && echo "1.0.1" && return;; + --) while [ "$2" ]; do shift; fnd="$fnd $1"; last="$1"; done;; + -*) local o="${1#-}"; while [ "$o" ]; do case $o in + s*) local show=1;; + l*) local lst=1;; + i*) [ -z "$comp" ] && local interactive=1 show=1;; + r*) local mode=rank;; + t*) local mode=recent;; + e*) o="${o#?}"; if [ "$o" ]; then # there are characters after "-e" + local exec="$o" # anything after "-e" + else # use the next argument + local exec="${2:?"-e: Argument needed "}" + shift + fi; break;; + b*) o="${o#?}"; if [ "$o" ]; then + _FASD_BACKENDS="$o" + else + _FASD_BACKENDS="${2:?"-b: Argument needed"}" + shift + fi; break;; + B*) o="${o#?}"; if [ "$o" ]; then + _FASD_BACKENDS="$_FASD_BACKENDS $o" + else + _FASD_BACKENDS="$_FASD_BACKENDS ${2:?"-B: Argument needed"}" + shift + fi; break;; + a*) local typ=e;; + d*) local typ=d;; + f*) local typ=f;; + R*) local r=r;; + [0-9]*) local _fasd_i="$o"; break;; + h*) [ -z "$comp" ] && echo "fasd [options] [query ...] +[f|a|s|d|z] [options] [query ...] + options: + -s list paths with scores + -l list paths without scores + -i interactive mode + -e set command to execute on the result file + -b only use backend + -B add additional backend + -a match files and directories + -d match directories only + -f match files only + -r match by rank only + -t match by recent access only + -R reverse listing order + -h show a brief help message + -[0-9] select the nth entry + +fasd [-A|-D] [paths ...] + -A add paths + -D delete paths" >&2 && return;; + esac; o="${o#?}"; done;; + *) fnd="$fnd $1"; last="$1";; + esac; shift; done + + # guess whether the last query is selected from tab completion + case $last in + /?*) if [ -z "$show$lst" -a -${typ:-e} "$last" -a "$exec" ]; then + $exec "$last" + return + fi;; + esac + + local R; [ -z "$r" ] && R=r || R= # let $R be the opposite of $r + fnd="${fnd# }" + + local res + res="$(fasd --query 2>> "$_FASD_SINK")" # query the database + [ $? -gt 0 ] && return + if [ 0 -lt ${_fasd_i:-0} ] 2>> "$_FASD_SINK"; then + res="$(printf %s\\n "$res" | sort -n${R} | \ + sed -n "$_fasd_i"'s/^[^ ]*[ ]*//p')" + elif [ "$interactive" ] || [ "$exec" -a -z "$fnd$lst$show" -a -t 1 ]; then + if [ "$(printf %s "$res" | sed -n '$=')" -gt 1 ]; then + res="$(printf %s\\n "$res" | sort -n${R})" + printf %s\\n "$res" | sed = | sed 'N;s/\n/ /' | sort -nr >&2 + printf "> " >&2 + local i; read i; [ 0 -lt "${i:-0}" ] 2>> "$_FASD_SINK" || return 1 + fi + res="$(printf %s\\n "$res" | sed -n "${i:-1}"'s/^[^ ]*[ ]*//p')" + elif [ "$lst" ]; then + [ "$res" ] && printf %s\\n "$res" | sort -n${r} | sed 's/^[^ ]*[ ]*//' + return + elif [ "$show" ]; then + [ "$res" ] && printf %s\\n "$res" | sort -n${r} + return + elif [ "$fnd" ] && [ "$exec" -o ! -t 1 ]; then # exec or subshell + res="$(printf %s\\n "$res" | sort -n | sed -n '$s/^[^ ]*[ ]*//p')" + else # no args, show + [ "$res" ] && printf %s\\n "$res" | sort -n${r} + return + fi + if [ "$res" ]; then + fasd --add "$res" + [ -z "$exec" ] && exec='printf %s\n' + $exec "$res" + fi + ;; + esac +} + +fasd --init env + +case $- in + *i*) ;; # assume being sourced, do nothing + *) # assume being executed as an executable + if [ -x "$_FASD_SHELL" -a -z "$_FASD_SET" ]; then + _FASD_SET=1 exec $_FASD_SHELL "$0" "$@" + else + fasd "$@" + fi;; +esac + diff --git a/tag-zsh/config/zsh/functions/pure/prompt_pure_setup b/tag-zsh/config/zsh/functions/pure/prompt_pure_setup new file mode 100644 index 00000000..5c635037 --- /dev/null +++ b/tag-zsh/config/zsh/functions/pure/prompt_pure_setup @@ -0,0 +1,118 @@ +# Pure +# by Sindre Sorhus +# https://github.com/sindresorhus/pure +# MIT License + +# For my own and others sanity +# git: +# %b => current branch +# %a => current action (rebase/merge) +# prompt: +# %F => color dict +# %f => reset color +# %~ => current path +# %* => time +# %n => username +# %m => shortname host +# %(?..) => prompt conditional - %(condition.true.false) + + +# turns seconds into human readable time +# 165392 => 1d 21h 56m 32s +prompt_pure_human_time() { + local tmp=$1 + local days=$(( tmp / 60 / 60 / 24 )) + local hours=$(( tmp / 60 / 60 % 24 )) + local minutes=$(( tmp / 60 % 60 )) + local seconds=$(( tmp % 60 )) + (( $days > 0 )) && echo -n "${days}d " + (( $hours > 0 )) && echo -n "${hours}h " + (( $minutes > 0 )) && echo -n "${minutes}m " + echo "${seconds}s" +} + +# fastest possible way to check if repo is dirty +prompt_pure_git_dirty() { + # check if we're in a git repo + command git rev-parse --is-inside-work-tree &>/dev/null || return + # check if it's dirty + command git diff --quiet --ignore-submodules HEAD &>/dev/null + + (($? == 1)) && echo '*' +} + +# displays the exec time of the last command if set threshold was exceeded +prompt_pure_cmd_exec_time() { + local stop=$(date +%s) + local start=${cmd_timestamp:-$stop} + integer elapsed=$stop-$start + (($elapsed > ${PURE_CMD_MAX_EXEC_TIME:=5})) && prompt_pure_human_time $elapsed +} + +prompt_pure_preexec() { + cmd_timestamp=$(date +%s) + + # shows the current dir and executed command in the title when a process is active + print -Pn "\e]0;" + echo -nE "$PWD:t: $2" + print -Pn "\a" +} + +# string length ignoring ansi escapes +prompt_pure_string_length() { + echo ${#${(S%%)1//(\%([KF1]|)\{*\}|\%[Bbkf])}} +} + +prompt_pure_precmd() { + # shows the full path in the title + print -Pn '\e]0;%~\a' + + # git info + vcs_info + + local prompt_pure_preprompt='\n%F{blue}%~%F{242}$vcs_info_msg_0_`prompt_pure_git_dirty` $prompt_pure_username%f %F{yellow}`prompt_pure_cmd_exec_time`%f' + print -P $prompt_pure_preprompt + + # check async if there is anything to pull + (( ${PURE_GIT_PULL:-1} )) && { + # check if we're in a git repo + command git rev-parse --is-inside-work-tree &>/dev/null && + # check check if there is anything to pull + command git fetch &>/dev/null && + # check if there is an upstream configured for this branch + command git rev-parse --abbrev-ref @'{u}' &>/dev/null && + (( $(command git rev-list --right-only --count HEAD...@'{u}' 2>/dev/null) > 0 )) && + # some crazy ansi magic to inject the symbol into the previous line + print -Pn "\e7\e[A\e[1G\e[`prompt_pure_string_length $prompt_pure_preprompt`C%F{cyan}⇣%f\e8" + } &! + + # reset value since `preexec` isn't always triggered + unset cmd_timestamp +} + + +prompt_pure_setup() { + # prevent percentage showing up + # if output doesn't end with a newline + export PROMPT_EOL_MARK='' + + prompt_opts=(cr subst percent) + + autoload -Uz add-zsh-hook + autoload -Uz vcs_info + + add-zsh-hook precmd prompt_pure_precmd + add-zsh-hook preexec prompt_pure_preexec + + zstyle ':vcs_info:*' enable git + zstyle ':vcs_info:git*' formats ' %b' + zstyle ':vcs_info:git*' actionformats ' %b|%a' + + # show username@host if logged in through SSH + [[ "$SSH_CONNECTION" != '' ]] && prompt_pure_username='%n@%m ' + + # prompt turns red if the previous command didn't exit with 0 + PROMPT='%(?.%F{magenta}.%F{red})❯%f ' +} + +prompt_pure_setup "$@" diff --git a/tag-zsh/config/zsh/functions/runit/_sv b/tag-zsh/config/zsh/functions/runit/_sv new file mode 100644 index 00000000..bf98b3ea --- /dev/null +++ b/tag-zsh/config/zsh/functions/runit/_sv @@ -0,0 +1,7 @@ +#compdef sv + +_arguments -A -S -s \ + '-v[wait up to 7 seconds for the command to take effect. (up|down|term|once|cont|exit)]' \ + '-w+[wait for %n seconds]: :_guard "[0-9]#" "numeric value"' \ + '1:command:(status up down once pause cont hup alarm interrupt quit 1 2 term kill exit start stop restart shutdown force-stop force-reload force-restart force-shutdown check)' \ + '*:installed service:_files -W ${SVDIR:-/service}' diff --git a/tag-zsh/config/zsh/functions/runit/getservicedir b/tag-zsh/config/zsh/functions/runit/getservicedir new file mode 100644 index 00000000..2e5d961c --- /dev/null +++ b/tag-zsh/config/zsh/functions/runit/getservicedir @@ -0,0 +1,2 @@ +#!/usr/bin/env zsh +print ${$(readlink ${SVDIR:-/service}/$1):h} \ No newline at end of file diff --git a/tag-zsh/config/zsh/functions/runit/linksv b/tag-zsh/config/zsh/functions/runit/linksv new file mode 100644 index 00000000..7ee71094 --- /dev/null +++ b/tag-zsh/config/zsh/functions/runit/linksv @@ -0,0 +1,16 @@ +#!/usr/bin/env zsh + +if [[ -z $1 ]]; then + echo "No service specified" + return 64 +fi + + +if [[ ! -x $1 ]]; then + echo "Service does not exist in current directory" + return 1 +fi + +mv $1{,.old} +ln -s =sv $1 +chmod -h a-w $1 diff --git a/tag-zsh/config/zsh/functions/runit/renamesv b/tag-zsh/config/zsh/functions/runit/renamesv new file mode 100644 index 00000000..dba1098d --- /dev/null +++ b/tag-zsh/config/zsh/functions/runit/renamesv @@ -0,0 +1,36 @@ +#!/usr/bin/env zsh +local svdir=${SVDIR:-/service} +if [[ -z $1 || -z $2 ]]; then + echo "Usage: $0 source target" + return 64 +fi + +if [[ ! -h $svdir/$1 ]]; then + echo $svdir/$1 does not exist + return 2 +fi + +if [[ -e $svdir/$2 ]]; then + echo $svdir/$2 already exists + return 3 +fi + +local servicedir=`getservicedir` + +if [[ ! ( -w $svdir && -w $servicedir ) ]]; then + echo $svdir or $servicedir is not writeable +fi + +# The service doesn't have to be stopped as removing the link will do that +# However, running the same service twice isn't a great idea, so wait here +sv stop $1 + +rm -f $svdir/$1 || return + +mv $servicedir/{$1,$2} || return + +ln -s {$servicedir,$svdir}/$2 || return + +sv start $2 + +return diff --git a/tag-zsh/config/zsh/prefect.zsh b/tag-zsh/config/zsh/prefect.zsh new file mode 100644 index 00000000..997ba391 --- /dev/null +++ b/tag-zsh/config/zsh/prefect.zsh @@ -0,0 +1,10 @@ +EDITOR="emacs" +VISUAL="emacs" + +if [[ ! -S $SSH_AUTH_SOCK ]] +then + eval `ssh-agent | sed -e '/^echo/d'` + linkAuthSock $SSH_AUTH_SOCK +fi + +export WINEARCH="win32" \ No newline at end of file diff --git a/tag-zsh/config/zsh/server.zsh b/tag-zsh/config/zsh/server.zsh new file mode 100644 index 00000000..d9d74219 --- /dev/null +++ b/tag-zsh/config/zsh/server.zsh @@ -0,0 +1,20 @@ +# -*- shell-script -*- + +export SVDIR=/service +if [[ "$EUID" == "0" ]] || [[ "$USER" == "root" ]] +then + export EDITOR="emacs -nw" +else + export ALTERNATE_EDITOR="emacs" + export EDITOR="emacsclient" +fi + +mailpath= + +# Folder aliases +hash -d music=/tank/media/Music + +zstyle ':completion:*' local server /tank/www/internal '' +zstyle ':completion:*' local external /tank/www/external +zstyle ':completion:*' local alphapulsar.uk.to /tank/www/gaming +zstyle ':completion:*' local home.alanpearce.co.uk /tank/www/external diff --git a/tag-zsh/config/zsh/zlogin b/tag-zsh/config/zsh/zlogin new file mode 100755 index 00000000..e69de29b diff --git a/tag-zsh/config/zsh/zlogout b/tag-zsh/config/zsh/zlogout new file mode 100755 index 00000000..e69de29b diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv new file mode 100755 index 00000000..11932e6e --- /dev/null +++ b/tag-zsh/config/zsh/zshenv @@ -0,0 +1,53 @@ +if [[ $defpath == "" && -d ~/bin ]] +then + defpath=($path) + path=( + $defpath + ~/bin + ) + if [[ -d ~/.gem/ruby/*/bin ]] + then + path=( + $path + ~/.gem/ruby/*/bin + ) + fi +fi + +export PATH + +myfuncs=( ~/projects/dotfiles/zsh/functions/*(/) ) +fpath=( + $myfuncs + ~/projects/dotfiles/zsh/completion/ + $fpath +) +if [[ -d /usr/local/share/zsh-completions ]] +then + fpath=(/usr/local/share/zsh-completions $fpath) +fi + +if [[ -d /usr/local/share/zsh/site-functions ]] +then + fpath=(/usr/local/share/zsh/site-functions $fpath) +fi + +export FPATH + +case $OSTYPE in + *gnu*) + os=gnu + ;; + freebsd*) + os=freebsd + ;; + darwin*) + os=osx +esac + +export os + +if [[ -s $commands[direnv] ]] +then + eval "$(direnv hook zsh)" +fi diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc new file mode 100755 index 00000000..365214c9 --- /dev/null +++ b/tag-zsh/config/zsh/zshrc @@ -0,0 +1,362 @@ +export PAGER="less" +export EDITOR="emacsclient" +export CLICOLOR=true + +# +# zsh variables +# +HISTFILE=~/.zsh/history +HISTSIZE=4000 +SAVEHIST=3000 + +WORDCHARS='*?_-[]~=.&;!#$%^(){}<>' + +#If a command takes more than 5 seconds, give statistics +REPORTTIME=5 +TIMEFMT="%U user %S system %P cpu %*Es total" + +#Check for user logins +watch=notme +WATCHFMT="%n has %a %l from %M at %t" + +hosts=( + server + prefect + alanpearce.co.uk + home.alanpearce.co.uk +) + +users=(alan root toor) + +function linkAuthSock () { + local linkSock=~/.ssh/ssh_auth_sock + ln -sf $1 ~/.ssh/ssh_auth_sock + export SSH_AUTH_SOCK=$linkSock +} + +if [[ "$SSH_AUTH_SOCK" != "" ]] +then + if [[ -e ~/.ssh/ssh_auth_sock && ! -L ~/.ssh/ssh_auth_sock ]] + then + linkAuthSock $SSH_AUTH_SOCK + fi +fi + +LS_COLORS='no=00:fi=00:di=36:ln=35:pi=30;44:so=35;44:do=35;44:bd=33;44:cd=37;44:or=05;37;41:mi=05;37;41:ex=01;31:*.cmd=01;31:*.exe=01;31:*.com=01;31:*.bat=01;31:*.reg=01;31:*.app=01;31:*.txt=32:*.org=32:*.md=32:*.mkd=32:*.h=32:*.c=32:*.C=32:*.cc=32:*.cpp=32:*.cxx=32:*.objc=32:*.sh=32:*.csh=32:*.zsh=32:*.el=32:*.vim=32:*.java=32:*.pl=32:*.pm=32:*.py=32:*.rb=32:*.hs=32:*.php=32:*.htm=32:*.html=32:*.shtml=32:*.erb=32:*.haml=32:*.xml=32:*.rdf=32:*.css=32:*.sass=32:*.scss=32:*.less=32:*.js=32:*.coffee=32:*.man=32:*.0=32:*.1=32:*.2=32:*.3=32:*.4=32:*.5=32:*.6=32:*.7=32:*.8=32:*.9=32:*.l=32:*.n=32:*.p=32:*.pod=32:*.tex=32:*.bmp=33:*.cgm=33:*.dl=33:*.dvi=33:*.emf=33:*.eps=33:*.gif=33:*.jpeg=33:*.jpg=33:*.JPG=33:*.mng=33:*.pbm=33:*.pcx=33:*.pdf=33:*.pgm=33:*.png=33:*.ppm=33:*.pps=33:*.ppsx=33:*.ps=33:*.svg=33:*.svgz=33:*.tga=33:*.tif=33:*.tiff=33:*.xbm=33:*.xcf=33:*.xpm=33:*.xwd=33:*.xwd=33:*.yuv=33:*.aac=33:*.au=33:*.flac=33:*.mid=33:*.midi=33:*.mka=33:*.mp3=33:*.mpa=33:*.mpeg=33:*.mpg=33:*.ogg=33:*.ra=33:*.wav=33:*.anx=33:*.asf=33:*.avi=33:*.axv=33:*.flc=33:*.fli=33:*.flv=33:*.gl=33:*.m2v=33:*.m4v=33:*.mkv=33:*.mov=33:*.mp4=33:*.mp4v=33:*.mpeg=33:*.mpg=33:*.nuv=33:*.ogm=33:*.ogv=33:*.ogx=33:*.qt=33:*.rm=33:*.rmvb=33:*.swf=33:*.vob=33:*.wmv=33:*.doc=31:*.docx=31:*.rtf=31:*.dot=31:*.dotx=31:*.xls=31:*.xlsx=31:*.ppt=31:*.pptx=31:*.fla=31:*.psd=31:*.7z=1;35:*.apk=1;35:*.arj=1;35:*.bin=1;35:*.bz=1;35:*.bz2=1;35:*.cab=1;35:*.deb=1;35:*.dmg=1;35:*.gem=1;35:*.gz=1;35:*.iso=1;35:*.jar=1;35:*.msi=1;35:*.rar=1;35:*.rpm=1;35:*.tar=1;35:*.tbz=1;35:*.tbz2=1;35:*.tgz=1;35:*.tx=1;35:*.war=1;35:*.xpi=1;35:*.xz=1;35:*.z=1;35:*.Z=1;35:*.zip=1;35:*.ANSI-30-black=30:*.ANSI-01;30-brblack=01;30:*.ANSI-31-red=31:*.ANSI-01;31-brred=01;31:*.ANSI-32-green=32:*.ANSI-01;32-brgreen=01;32:*.ANSI-33-yellow=33:*.ANSI-01;33-bryellow=01;33:*.ANSI-34-blue=34:*.ANSI-01;34-brblue=01;34:*.ANSI-35-magenta=35:*.ANSI-01;35-brmagenta=01;35:*.ANSI-36-cyan=36:*.ANSI-01;36-brcyan=01;36:*.ANSI-37-white=37:*.ANSI-01;37-brwhite=01;37:*.log=01;34:*~=01;34:*#=01;34:*.bak=01;36:*.BAK=01;36:*.old=01;36:*.OLD=01;36:*.org_archive=01;36:*.off=01;36:*.OFF=01;36:*.dist=01;36:*.DIST=01;36:*.orig=01;36:*.ORIG=01;36:*.swp=01;36:*.swo=01;36:*,v=01;36:*.gpg=34:*.gpg=34:*.pgp=34:*.asc=34:*.3des=34:*.aes=34:*.enc=34:' + +#Ignore suffixes in completion +fignore=( + svbin +) + +# +# Modules +# +autoload -Uz compinit bashcompinit +autoload -U colors complist zrecompile zmv zargs zed +autoload -Uz vcs_info +autoload insert-files +zle -N insert-files +zmodload -i zsh/complist +colors +compinit -u -d .zsh/cache/compdump +bashcompinit + +zstyle :compinstall filename '~/.zshrc' + +autoload -Uz _tmux_pane_words +zle -C tmux-pane-words-prefix complete-word _generic +zle -C tmux-pane-words-anywhere complete-word _generic +zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' completer _tmux_pane_words +zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' ignore-line current +zstyle ':completion:tmux-pane-words-anywhere:*' matcher-list 'b:=* m:{A-Za-z}={a-zA-Z}' + +# Speed up completion by not going further than a full match +zstyle ':completion:*' accept-exact '*(N)' + +zstyle ':completion:*:default' use-cache on +zstyle ':completion:*:default' cache-path ~/.zsh/cache/compcache + +zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' '+m:{A-Z}={a-z}' +zstyle ':completion:*' completer _oldlist _expand _force_rehash _complete _match + +zstyle ':completion:*' verbose yes +zstyle ':completion:*:messages' format '%d' +zstyle ':completion:*:warnings' format 'No matches for: %d' +zstyle ':completion:*:descriptions' format '%U%B%d%b%u' +zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b' +zstyle ':completion:*' group-name '' + +# Complete all user processes +zstyle ':completion:*:processes' command 'ps -au$USER' +# Add colour to process lists +zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' +zstyle ':completion:*:*:kill:*' menu yes select +zstyle ':completion:*:kill:*' force-list always +zstyle ':completion:*:*:killall:*' menu yes select +zstyle ':completion:*:killall:*' force-list always + +# Complete unreadable log filenames +#zstyle ':completion::complete:(most|tail)::' fake-files '/var/log/*:current' + +# Group manpages by section +zstyle ':completion:*' separate-sections true + +# Users +#zstyle '*' users $users + +zstyle '*' hosts $hosts + +zstyle ':completion:*:functions' ignored-patterns '_*' +zstyle ':completion:*:cd:*' ignore-parents parent pwd + +#This works, but isn't the same as ls +#zstyle ':completion:*:default' list-colors '' +zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} + +zstyle ':vcs_info:*' enable git hg + +# Filename suffixes to ignore during completion (except after rm command) +zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' '*?.old' '*?.pro' + +## Prompt +if [[ $TERM != 'dumb' ]] +then + autoload -U promptinit + promptinit + prompt pure +fi + +# Options + +# Changing directories +setopt auto_cd + +# Completion +setopt auto_list # List multiple choices on first tab +unsetopt list_ambiguous # List ambiguous choices rather than completing common prefixes +unsetopt list_beep # Don't try to beep here +setopt list_types # Indicate file types + +# Expansion and globbing +setopt extended_glob # Use #~^ as part of filename patterns +unsetopt nomatch + +# History +unsetopt hist_beep +setopt hist_expire_dups_first +setopt hist_fcntl_lock # Use standard locking on histfile +setopt hist_find_no_dups +setopt hist_ignore_space +setopt hist_reduce_blanks +setopt hist_verify +setopt share_history +setopt inc_append_history + +# Input/Output +unsetopt clobber +unsetopt flow_control +setopt path_dirs # Search PATH even with slashes +setopt print_exit_value + +# Job Control +setopt auto_continue +unsetopt nohup +setopt long_list_jobs +unsetopt notify + +# Scripts and functions +unsetopt multi_func_def +setopt multios + +# Zle +unsetopt beep + +############ +# Keybinds # +############ +#KiTTY +bindkey "OD" backward-word +bindkey "OC" forward-word + +#General +bindkey "[1~" beginning-of-line +bindkey "[4~" end-of-line +bindkey "[5~" beginning-of-history +bindkey "[6~" end-of-history +bindkey "[2~" quoted-insert +bindkey "[3~" delete-char + +bindkey '' backward-delete-char + +bindkey '^I' expand-or-complete-prefix +bindkey '' reverse-menu-complete +bindkey '' up-line-or-search +bindkey '' down-line-or-search + +#urxvt +bindkey '[3;5~' delete-word +bindkey '' backward-word +bindkey '' forward-word + +bindkey 'f' insert-files +bindkey 'd' describe-key-briefly + +bindkey '\' tmux-pane-words-prefix +bindkey '|' tmux-pane-words-anywhere + +# Aliases before functions +alias getcflags='gcc -\#\#\# -march=native -E /usr/include/stdlib.h 2>&1 | grep "/usr/libexec/gcc/.*cc1"' +alias grep='grep --color=auto' +alias df='df -h' +alias du='du -h' +alias md='mkdir -p' +alias rd='rmdir' +alias .='source' + +ls='\ls' +gnu_ls_options="-v --group-directories-first --color=auto" +gnu_ls_isodate="--time-style=long-iso" +bsd_ls_options="-p" +bsd_ls_isodate="-D '%F %k:%M'" + +case $os in + osx) + 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 + ;; + gnu) + ls_options=$gnu_ls_options + ls_isodate=$gnu_ls_isodate + ;; +esac +alias l="${ls} ${ls_options} -Bp" +alias l1="${ls} ${ls_options} -1" +alias ls="${ls} ${ls_options} -hF" +alias la="${ls} ${ls_options} -hA" +alias ll="${ls} ${ls_options} ${ls_isodate} -hl" +alias lal="ll -A" +alias lla="lal" +alias llr="ll -t" +alias gpp='g++' +alias lsr="${ls} -tld *(m-2)" # mtime < -2days + +alias salt="noglob salt" +alias pping="prettyping.sh" +alias trans="transmission-remote transmission.home" +alias bitcoin="bitcoind" +alias su="smart_sudo " +alias E="SUDO_EDITOR=\emacsclient -c -a emacs\" sudoedit" +alias wprop='xprop |awk '\'' + /^WM_CLASS/{sub(/.* =/, "instance:"); sub(/,/, "\nclass:"); print} + /^WM_NAME/{sub(/.* =/, "title:"); print} + /^WM_WINDOW_ROLE/{sub(/.* =/, "role:"); print}'\''' + +alias et="emacsclient -t" + +alias -g ...='../..' + +#Suffix aliases +alias -s log=less + +if [[ -e =hub ]]; then + alias git="hub" + autoload -U _hub + compdef _hub hub +fi + +# Functions + +magit () { + emacsclient -e "(magit-status \"$PWD\")" +} + +dired () { + emacsclient -e "(dired \"$PWD\")" +} + +pid () { + local i + for i in /proc/<->/stat + [[ "$(< $i)" = *\((${(j:|:)~@})\)* ]] && echo $i:h:t + return 0 +} + +_force_rehash() { + (( CURRENT == 1 )) && rehash + return 1 # Because we didn't really complete anything +} + +portgrep() { + sudo lsof -i :$1 -nP | egrep '(LISTEN|UDP|COMMAND)' +} + +ipgrep() { + sudo lsof -i @$1 -nP +} + +smart_sudo () { + if [[ -n $1 ]]; then + \sudo $argv + else + #if no parameters were given, then assume we want a root shell + \sudo -i -u toor + fi +} + +compdef _sudo smart_sudo + +smart_compile () { + local zcompargs + if [[ $1 = *zshrc* ]]; then + zcompargs="-R" + fi + + if [[ $EUID -ne 0 || $1 != *alan* ]]; then + zrecompile -q -p $zcompargs $1 + fi + if [[ -n $2 ]]; then + . $1 + fi +} + +emacs_change_focus () { + emacsclient -n -e "(select-frame-set-input-focus (selected-frame))" > /dev/null +} + +ec () { + local visibleFrames + visibleFrames=`emacsclient -e '(length (visible-frame-list))'` + if [[ $? -ne 0 ]]; then + print "Daemon not running" + return 1 + fi + + if [[ $visibleFrames -eq 1 ]]; then + emacsclient -n -c "$@" && emacs_change_focus + else + emacs_change_focus + if [[ $# -gt 0 ]]; then + emacsclient -n "$@" + fi + fi +} + +_FASD_DATA="$HOME/.zsh/fasd-data" +autoload -U fasd +source ~/.zsh/cache/fasd-init-zsh + +if [[ $OSTYPE == freebsd* ]]; then + source ~/projects/dotfiles/zsh/freebsd.zsh +fi diff --git a/tag-zsh/fasdrc b/tag-zsh/fasdrc new file mode 100644 index 00000000..22259d72 --- /dev/null +++ b/tag-zsh/fasdrc @@ -0,0 +1,8 @@ +# -*- mode: sh; -*- +current () { + for path in *; do + printf "./%s|1\\n" "$path" + done +} + +alias e="f -t -e $EDITOR -B current" diff --git a/tag-zsh/zshenv b/tag-zsh/zshenv new file mode 100644 index 00000000..48b93e17 --- /dev/null +++ b/tag-zsh/zshenv @@ -0,0 +1,3 @@ +ZDOTDIR="$HOME/.config/zsh" + +source "$ZDOTDIR"/.zshenv diff --git a/tmux.conf b/tmux.conf deleted file mode 100644 index 697e1238..00000000 --- a/tmux.conf +++ /dev/null @@ -1,19 +0,0 @@ -#setw -g xterm-keys on -#set -g terminal-overrides "xterm*:kLFT5=\eOD:kRIT5=\eOC:kUP5=\eOA:kDN5=\eOB:smkx@:rmkx@" - -set-window-option -g utf8 on -set-option -g status-utf8 on -set-option -g prefix C-z - -bind C-n send-prefix -unbind-key C-b - -set -g default-terminal "screen-256color" - -# Colemak style -bind-key C-i next-window - -set -g base-index 1 - -set -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_GIT SSH_CONNECTION WINDOWID XAUTHORITY" -set-environment -g 'SSH_AUTH_SOCK' '/home/alan/.ssh/ssh_auth_sock' \ No newline at end of file diff --git a/xbindkeysrc.scm b/xbindkeysrc.scm deleted file mode 100644 index 7b00c38d..00000000 --- a/xbindkeysrc.scm +++ /dev/null @@ -1,57 +0,0 @@ -;; To specify a key, you can use 'xbindkeys --key' or -;; 'xbindkeys --multikey' and put one of the two lines in this file. - -;; A list of keys is in /usr/include/X11/keysym.h and in -;; /usr/include/X11/keysymdef.h -;; The XK_ is not needed. - -;; List of modifier: -;; Release, Control, Shift, Mod1 (Alt), Mod2 (NumLock), -;; Mod3 (CapsLock), Mod4, Mod5 (Scroll). - - -;; The release modifier is not a standard X modifier, but you can -;; use it if you want to catch release instead of press events - -;; By defaults, xbindkeys does not pay attention to modifiers -;; NumLock, CapsLock and ScrollLock. -;; Uncomment the lines below if you want to use them. -;; To dissable them, call the functions with #f - - -;;;;EXTRA FUNCTIONS: Enable numlock, scrolllock or capslock usage -;;(set-numlock! #t) -;;(set-scrolllock! #t) -;;(set-capslock! #t) - -;;;;; Scheme API reference -;;;; -;; Optional modifier state: -;; (set-numlock! #f or #t) -;; (set-scrolllock! #f or #t) -;; (set-capslock! #f or #t) -;; -;; Shell command key: -;; (xbindkey key "foo-bar-command [args]") -;; (xbindkey '(modifier* key) "foo-bar-command [args]") -;; -;; Scheme function key: -;; (xbindkey-function key function-name-or-lambda-function) -;; (xbindkey-function '(modifier* key) function-name-or-lambda-function) -;; -;; Other functions: -;; (remove-xbindkey key) -;; (run-command "foo-bar-command [args]") -;; (grab-all-keys) -;; (ungrab-all-keys) -;; (remove-all-keys) -;; (debug) - -(xbindkey '(mod4 F9) "mpc toggle") -(xbindkey '(mod4 F10) "mpc prev") -(xbindkey '(mod4 F11) "mpc next") -(xbindkey '(mod4 F12) "mpc stop") - -(xbindkey '(mod4 p) "dmenu_run -fn '-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*' -nb '#002b36' -nf '#fdf6e3' -sb '#586e75' -sf '#fdf6e3' -hist '/home/alan/.cache/dmenu_run_history'") -(xbindkey '(mod4 shift T) "urxvtc") -(xbindkey '(mod4 shift E) "emacsclient -c") diff --git a/xmobarrc b/xmobarrc deleted file mode 100644 index 7dfcef22..00000000 --- a/xmobarrc +++ /dev/null @@ -1,40 +0,0 @@ -Config { font = "-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*" - , borderColor = "#657b83" - , border = TopB - , bgColor = "#002b36" - , fgColor = "#fdf6e3" - , position = Bottom - , lowerOnStart = False - , hideOnStart = False - , persistent = True - , commands = [ Run Weather "EGNX" ["-t", "ºC" - ,"-L", "12" - ,"-H", "18" - ,"--low", "lightblue" - ,"--normal", "green" - ,"--high", "red" - ] 36000 - , Run DynNetwork ["-t", "Net: ¦KB" - ,"-L", "512" - ,"-H", "10240" - ,"--low", "green" - ,"--normal", "yellow" - ,"--high", "red" - ,"-m", "5" - ] 5 - , Run Cpu ["-p", "3" - ,"-L", "3" - ,"-H", "50" - ,"--normal", "green" - ,"--high", "red" - ] 5 - , Run Memory ["-p", "3" - ,"-t", "Mem: %" - ] 20 - , Run Date "%a %b %_d %Y %H:%M:%S" "date" 10 - , Run MPD ["-t", ": - "] 10 - ] - , sepChar = "%" - , alignSep = "}{" - , template = "%cpu% | %memory% | %dynnetwork% | %mpd% }{ %EGNX% | %date%" - } diff --git a/xresources/main b/xresources/main deleted file mode 100644 index 77c21ce3..00000000 --- a/xresources/main +++ /dev/null @@ -1,33 +0,0 @@ -#include "solarized-light" - -Xcursor.theme: Neutral -Xcursor.size: 22 - -URxvt.fading: 0 -URxvt.geometry: 100x40 -URxvt.urgentOnBell: true - -URxvt.scrollBar: false -URxvt.scrollstyle: plain -URxvt.scrollTtyOutput: false -URxvt.scrollWithBuffer: true -URxvt.scrollTtyKeypress: true -URxvt.saveLines: 16384 -URxvt.secondaryScroll: false - -URxvt.font: -xos4-terminus-medium-r-normal--14-140-72-72-c-80-*-* -URxvt.boldFont: -URxvt.intensityStyles: true - -URxvt.pointerBlank: true -URxvt.pointerBlankDelay: 987654321 -URxvt.letterSpace: 0 - -Emacs.ToolBar: off -Emacs.MenuBar: off -Emacs.ScrollBars: off -Emacs.CursorBlink: off - -Emacs.Font: -*-Droid Sans Mono-medium-*-*-*-*-140-*-*-*-*-*-* -Emacs.fixed-pitch.attributeFont: -*-Droid Sans Mono-medium-*-*-*-*-140-*-*-*-*-*-* -Emacs.variable-pitch.attributeFont: -*-Arimo-medium-*-*-*-*-160-*-*-*-*-*-* diff --git a/xresources/prefect b/xresources/prefect deleted file mode 100644 index b8cb7f0b..00000000 --- a/xresources/prefect +++ /dev/null @@ -1,4 +0,0 @@ -#include "main" - -Emacs.Font: -*-Droid Sans Mono-medium-*-*-*-*-120-*-*-*-*-*-* -Emacs.fixed-pitch.attributeFont: -*-Droid Sans Mono-medium-*-*-*-*-120-*-*-*-*-*-* diff --git a/xresources/solarized-light b/xresources/solarized-light deleted file mode 100644 index 3906b7b0..00000000 --- a/xresources/solarized-light +++ /dev/null @@ -1,70 +0,0 @@ -! Solarized color scheme for the X Window System -! -! http://ethanschoonover.com/solarized - - -! Common - -#define S_yellow #b58900 -#define S_orange #cb4b16 -#define S_red #dc322f -#define S_magenta #d33682 -#define S_violet #6c71c4 -#define S_blue #268bd2 -#define S_cyan #2aa198 -#define S_green #859900 - - -! Dark - -! #define S_base03 #002b36 -! #define S_base02 #073642 -! #define S_base01 #586e75 -! #define S_base00 #657b83 -! #define S_base0 #839496 -! #define S_base1 #93a1a1 -! #define S_base2 #eee8d5 -! #define S_base3 #fdf6e3 - - -! Light - -#define S_base03 #fdf6e3 -#define S_base02 #eee8d5 -#define S_base01 #93a1a1 -#define S_base00 #839496 -#define S_base0 #657b83 -#define S_base1 #586e75 -#define S_base2 #073642 -#define S_base3 #002b36 - - -! To only apply colors to your terminal, for example, prefix -! the color assignment statement with its name. Example: -! -! URxvt*background: S_base03 - -*background: S_base03 -*foreground: S_base0 -*fading: 40 -*fadeColor: S_base03 -*cursorColor: S_base1 -*pointerColorBackground: S_base01 -*pointerColorForeground: S_base1 - -*color0: S_base02 -*color1: S_red -*color2: S_green -*color3: S_yellow -*color4: S_blue -*color5: S_magenta -*color6: S_cyan -*color7: S_base2 -*color8: S_base03 -*color9: S_orange -*color10: S_base01 -*color11: S_base00 -*color12: S_base0 -*color13: S_violet -*color14: S_base1 -*color15: S_base3 diff --git a/zsh/completion/_tmux_pane_words b/zsh/completion/_tmux_pane_words deleted file mode 100644 index 6ff9ce18..00000000 --- a/zsh/completion/_tmux_pane_words +++ /dev/null @@ -1,10 +0,0 @@ -local expl -local -a w - -if [[ -z "$TMUX_PANE" ]]; then - _message "not running inside tmux!" - return 1 -fi - -w=( ${(u)=$(tmux capture-pane \; show-buffer \; delete-buffer)} ) -_wanted values expl 'words from current tmux pane' compadd -a w diff --git a/zsh/environment.zsh b/zsh/environment.zsh deleted file mode 100755 index 11932e6e..00000000 --- a/zsh/environment.zsh +++ /dev/null @@ -1,53 +0,0 @@ -if [[ $defpath == "" && -d ~/bin ]] -then - defpath=($path) - path=( - $defpath - ~/bin - ) - if [[ -d ~/.gem/ruby/*/bin ]] - then - path=( - $path - ~/.gem/ruby/*/bin - ) - fi -fi - -export PATH - -myfuncs=( ~/projects/dotfiles/zsh/functions/*(/) ) -fpath=( - $myfuncs - ~/projects/dotfiles/zsh/completion/ - $fpath -) -if [[ -d /usr/local/share/zsh-completions ]] -then - fpath=(/usr/local/share/zsh-completions $fpath) -fi - -if [[ -d /usr/local/share/zsh/site-functions ]] -then - fpath=(/usr/local/share/zsh/site-functions $fpath) -fi - -export FPATH - -case $OSTYPE in - *gnu*) - os=gnu - ;; - freebsd*) - os=freebsd - ;; - darwin*) - os=osx -esac - -export os - -if [[ -s $commands[direnv] ]] -then - eval "$(direnv hook zsh)" -fi diff --git a/zsh/fasd.zsh b/zsh/fasd.zsh deleted file mode 100644 index 64dbf7b0..00000000 --- a/zsh/fasd.zsh +++ /dev/null @@ -1,85 +0,0 @@ -alias a='fasd -a' -alias s='fasd -si' -alias sd='fasd -sid' -alias sf='fasd -sif' -alias d='fasd -d' -alias f='fasd -f' -# function to execute built-in cd -fasd_cd() { - if [ $# -le 1 ]; then - fasd "$@" - else - local _fasd_ret="$(fasd -e 'printf %s' "$@")" - [ -z "$_fasd_ret" ] && return - [ -d "$_fasd_ret" ] && cd "$_fasd_ret" || printf %s\n "$_fasd_ret" - fi -} -alias z='fasd_cd -d' -alias zz='fasd_cd -d -i' - -# add zsh hook -_fasd_preexec() { - { eval "fasd --proc $(fasd --sanitize $1)"; } >> "/dev/null" 2>&1 -} -autoload -Uz add-zsh-hook -add-zsh-hook preexec _fasd_preexec - -# zsh command mode completion -_fasd_zsh_cmd_complete() { - local compl - read -c compl - (( $+compstate )) && compstate[insert]=menu # no expand if compsys loaded - reply=(${(f)"$(fasd --complete "$compl")"}) -} - -# enbale command mode completion -compctl -U -K _fasd_zsh_cmd_complete -V fasd -x 'C[-1,-*e],s[-]n[1,e]' -c - \ - 'c[-1,-A][-1,-D]' -f -- fasd fasd_cd - -(( $+functions[compdef] )) && { - # zsh word mode completion - _fasd_zsh_word_complete() { - [ "$2" ] && local _fasd_cur="$2" - [ -z "$_fasd_cur" ] && local _fasd_cur="${words[CURRENT]}" - local fnd="${_fasd_cur//,/ }" - local typ=${1:-e} - fasd --query $typ "$fnd" 2>> "/dev/null" | \ - sort -nr | sed 's/^[^ ]*[ ]*//' | while read -r line; do - compadd -U -V fasd "$line" - done - compstate[insert]=menu # no expand - } - _fasd_zsh_word_complete_f() { _fasd_zsh_word_complete f ; } - _fasd_zsh_word_complete_d() { _fasd_zsh_word_complete d ; } - _fasd_zsh_word_complete_trigger() { - local _fasd_cur="${words[CURRENT]}" - eval $(fasd --word-complete-trigger _fasd_zsh_word_complete $_fasd_cur) - } - # define zle widgets - zle -C fasd-complete complete-word _generic - zstyle ':completion:fasd-complete:*' completer _fasd_zsh_word_complete - zstyle ':completion:fasd-complete:*' menu-select - - zle -C fasd-complete-f complete-word _generic - zstyle ':completion:fasd-complete-f:*' completer _fasd_zsh_word_complete_f - zstyle ':completion:fasd-complete-f:*' menu-select - - zle -C fasd-complete-d complete-word _generic - zstyle ':completion:fasd-complete-d:*' completer _fasd_zsh_word_complete_d - zstyle ':completion:fasd-complete-d:*' menu-select -} - -(( $+functions[compdef] )) && { - # enable word mode completion - orig_comp="$(zstyle -L ':completion:\*' completer 2>> "/dev/null")" - if [ "$orig_comp" ]; then - case $orig_comp in - *_fasd_zsh_word_complete_trigger*);; - *) eval "$orig_comp _fasd_zsh_word_complete_trigger";; - esac - else - zstyle ':completion:*' completer _complete _fasd_zsh_word_complete_trigger - fi - unset orig_comp -} - diff --git a/zsh/fasdrc b/zsh/fasdrc deleted file mode 100644 index 22259d72..00000000 --- a/zsh/fasdrc +++ /dev/null @@ -1,8 +0,0 @@ -# -*- mode: sh; -*- -current () { - for path in *; do - printf "./%s|1\\n" "$path" - done -} - -alias e="f -t -e $EDITOR -B current" diff --git a/zsh/freebsd.zsh b/zsh/freebsd.zsh deleted file mode 100755 index 6ca0f8d6..00000000 --- a/zsh/freebsd.zsh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env zsh -function update-check () { - sudo portsnap update - sudo portmaster -L --index-only | awk '/ [Nn]ew / { print substr($0,9,9999) }' - sudo pkg audit - pkg updating -d $( ls -ltr -D '%Y%m%d' /var/db/pkg | awk 'END{print $6}' ) -} -alias iotop="top -m io -o total" diff --git a/zsh/functions/fasd/fasd b/zsh/functions/fasd/fasd deleted file mode 100755 index b1e64f41..00000000 --- a/zsh/functions/fasd/fasd +++ /dev/null @@ -1,624 +0,0 @@ -#!/usr/bin/env sh - -# Fasd (this file) can be sourced or executed by any POSIX compatible shell. - -# Fasd is originally written based on code from z (https://github.com/rupa/z) -# by rupa deadwyler under the WTFPL license. Most if not all of the code has -# been rewritten. - -# Copyright (C) 2011, 2012 by Wei Dai. All rights reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -fasd() { - - # make zsh do word splitting inside this function - [ "$ZSH_VERSION" ] && emulate sh && setopt localoptions - - case $1 in - --init) shift - while [ "$1" ]; do - case $1 in - env) - { # source rc files if present - [ -s "/etc/fasdrc" ] && . "/etc/fasdrc" - [ -s "$HOME/.fasdrc" ] && . "$HOME/.fasdrc" - - # set default options - [ -z "$_FASD_DATA" ] && _FASD_DATA="$HOME/.fasd" - [ -z "$_FASD_BLACKLIST" ] && _FASD_BLACKLIST="--help" - [ -z "$_FASD_SHIFT" ] && _FASD_SHIFT="sudo busybox" - [ -z "$_FASD_IGNORE" ] && _FASD_IGNORE="fasd ls echo" - [ -z "$_FASD_SINK" ] && _FASD_SINK=/dev/null - [ -z "$_FASD_TRACK_PWD" ] && _FASD_TRACK_PWD=1 - [ -z "$_FASD_MAX" ] && _FASD_MAX=2000 - [ -z "$_FASD_BACKENDS" ] && _FASD_BACKENDS=native - [ -z "$_FASD_FUZZY" ] && _FASD_FUZZY=2 - [ -z "$_FASD_VIMINFO" ] && _FASD_VIMINFO="$HOME/.viminfo" - [ -z "$_FASD_RECENTLY_USED_XBEL" ] && \ - _FASD_RECENTLY_USED_XBEL="$HOME/.local/share/recently-used.xbel" - - if [ -z "$_FASD_AWK" ]; then - # awk preferences - local awk; for awk in mawk gawk original-awk nawk awk; do - $awk "" && _FASD_AWK=$awk && break - done - fi - } >> "${_FASD_SINK:-/dev/null}" 2>&1 - ;; - - auto) cat <> "$_FASD_SINK" 2>&1 - -EOS - ;; - - posix-alias) cat <& /dev/null || fasd -d'; -EOS - ;; - - zsh-hook) cat <> "$_FASD_SINK" 2>&1 -} -autoload -Uz add-zsh-hook -add-zsh-hook preexec _fasd_preexec - -EOS - ;; - - bash-hook) cat <> "$_FASD_SINK" 2>&1 -} - -# add bash hook -case \$PROMPT_COMMAND in - *_fasd_prompt_func*) ;; - *) PROMPT_COMMAND="_fasd_prompt_func;\$PROMPT_COMMAND";; -esac - -EOS - ;; - - posix-hook) cat <> "$_FASD_SINK" 2>&1 -} -case \$PS1 in - *_fasd_ps1_func*) ;; - *) export PS1="\\\$(_fasd_ps1_func)\$PS1";; -esac - -EOS - ;; - - tcsh-hook) cat <& /dev/null'; -EOS - - ;; - - zsh-ccomp) cat <> "$_FASD_SINK" | \\ - sort -nr | sed 's/^[^ ]*[ ]*//' | while read -r line; do - compadd -U -V fasd "\$line" - done - compstate[insert]=menu # no expand - } - _fasd_zsh_word_complete_f() { _fasd_zsh_word_complete f ; } - _fasd_zsh_word_complete_d() { _fasd_zsh_word_complete d ; } - _fasd_zsh_word_complete_trigger() { - local _fasd_cur="\${words[CURRENT]}" - eval \$(fasd --word-complete-trigger _fasd_zsh_word_complete \$_fasd_cur) - } - # define zle widgets - zle -C fasd-complete complete-word _generic - zstyle ':completion:fasd-complete:*' completer _fasd_zsh_word_complete - zstyle ':completion:fasd-complete:*' menu-select - - zle -C fasd-complete-f complete-word _generic - zstyle ':completion:fasd-complete-f:*' completer _fasd_zsh_word_complete_f - zstyle ':completion:fasd-complete-f:*' menu-select - - zle -C fasd-complete-d complete-word _generic - zstyle ':completion:fasd-complete-d:*' completer _fasd_zsh_word_complete_d - zstyle ':completion:fasd-complete-d:*' menu-select -} - -EOS - ;; - - zsh-ccomp-install) cat <> "$_FASD_SINK" | sed -n "\\\$s/^.*'\\\\(.*\\\\)'/\\\\1/p") - \${COMP_LINE#* }" | while read -r line; do - quote_readline "\$line" 2>/dev/null || \\ - printf %q "\$line" 2>/dev/null && \\ - printf \\\\n - done) - local IFS=\$'\\n'; COMPREPLY=( \$RESULT ) -} -_fasd_bash_hook_cmd_complete() { - for cmd in \$*; do - complete -F _fasd_bash_cmd_complete \$cmd - done -} - -EOS - ;; - - bash-ccomp-install) cat <$`{}]\{1,\}/\1 /g' - ;; - - --proc) shift # process commands - # stop if we don't own $_FASD_DATA or $_FASD_RO is set - [ -f "$_FASD_DATA" -a ! -O "$_FASD_DATA" ] || [ "$_FASD_RO" ] && return - - # blacklists - local each; for each in $_FASD_BLACKLIST; do - case " $* " in *\ $each\ *) return;; esac - done - - # shifts - while true; do - case " $_FASD_SHIFT " in - *\ $1\ *) shift;; - *) break;; - esac - done - - # ignores - case " $_FASD_IGNORE " in - *\ $1\ *) return;; - esac - - shift; fasd --add "$@" # add all arguments except command - ;; - - --add|-A) shift # add entries - # stop if we don't own $_FASD_DATA or $_FASD_RO is set - [ -f "$_FASD_DATA" -a ! -O "$_FASD_DATA" ] || [ "$_FASD_RO" ] && return - - # find all valid path arguments, convert them to simplest absolute form - local paths="$(while [ "$1" ]; do - [ -e "$1" ] && printf %s\\n "$1"; shift - done | sed '/^[^/]/s@^@'"$PWD"'/@ - s@/\.\.$@/../@;s@/\(\./\)\{1,\}@/@g;:0 - s@[^/][^/]*//*\.\./@/@;t 0 - s@^/*\.\./@/@;s@//*@/@g;s@/\.\{0,1\}$@@;s@^$@/@' 2>> "$_FASD_SINK" \ - | tr '\n' '|')" - - # add current pwd if the option is set - [ "$_FASD_TRACK_PWD" = "1" -a "$PWD" != "$HOME" ] && paths="$paths|$PWD" - - [ -z "${paths##\|}" ] && return # stop if we have nothing to add - - # maintain the file - local tempfile - tempfile="$(mktemp "$_FASD_DATA".XXXXXX)" || return - $_FASD_AWK -v list="$paths" -v now="$(date +%s)" -v max="$_FASD_MAX" -F"|" ' - BEGIN { - split(list, files, "|") - for(i in files) { - path = files[i] - if(path == "") continue - paths[path] = path # array for checking - rank[path] = 1 - time[path] = now - } - } - $2 >= 1 { - if($1 in paths) { - rank[$1] = $2 + 1 / $2 - time[$1] = now - } else { - rank[$1] = $2 - time[$1] = $3 - } - count += $2 - } - END { - if(count > max) - for(i in rank) print i "|" 0.9*rank[i] "|" time[i] # aging - else - for(i in rank) print i "|" rank[i] "|" time[i] - }' "$_FASD_DATA" 2>> "$_FASD_SINK" >| "$tempfile" - if [ $? -ne 0 -a -f "$_FASD_DATA" ]; then - env rm -f "$tempfile" - else - env mv -f "$tempfile" "$_FASD_DATA" - fi - ;; - - --delete|-D) shift # delete entries - # stop if we don't own $_FASD_DATA or $_FASD_RO is set - [ -f "$_FASD_DATA" -a ! -O "$_FASD_DATA" ] || [ "$_FASD_RO" ] && return - - # turn valid arguments into entry-deleting sed commands - local sed_cmd="$(while [ "$1" ]; do printf %s\\n "$1"; shift; done | \ - sed '/^[^/]/s@^@'"$PWD"'/@;s@/\.\.$@/../@;s@/\(\./\)\{1,\}@/@g;:0 - s@[^/][^/]*//*\.\./@/@;t 0 - s@^/*\.\./@/@;s@//*@/@g;s@/\.\{0,1\}$@@ - s@^$@/@;s@\([.[\/*^$]\)@\\\1@g;s@^\(.*\)$@/^\1|/d@' 2>> "$_FASD_SINK")" - - # maintain the file - local tempfile - tempfile="$(mktemp "$_FASD_DATA".XXXXXX)" || return - - sed "$sed_cmd" "$_FASD_DATA" 2>> "$_FASD_SINK" >| "$tempfile" - - if [ $? -ne 0 -a -f "$_FASD_DATA" ]; then - env rm -f "$tempfile" - else - env mv -f "$tempfile" "$_FASD_DATA" - fi - ;; - - --query) shift # query the db, --query [$typ ["$fnd" [$mode]]] - [ -f "$_FASD_DATA" ] || return # no db yet - [ "$1" ] && local typ="$1" - [ "$2" ] && local fnd="$2" - [ "$3" ] && local mode="$3" - - # cat all backends - local each _fasd_data; for each in $_FASD_BACKENDS; do - _fasd_data="$_fasd_data -$(fasd --backend $each)" - done - [ "$_fasd_data" ] || _fasd_data="$(cat "$_FASD_DATA")" - - # set mode specific code for calculating the prior - case $mode in - rank) local prior='times[i]';; - recent) local prior='sqrt(100000/(1+t-la[i]))';; - *) local prior='times[i] * frecent(la[i])';; - esac - - if [ "$fnd" ]; then # dafault matching - local bre="$(printf %s\\n "$fnd" | sed 's/\([*\.\\\[]\)/\\\1/g - s@ @[^|]*@g;s/\$$/|/')" - bre='^[^|]*'"$bre"'[^|/]*|' - local _ret="$(printf %s\\n "$_fasd_data" | grep "$bre")" - [ "$_ret" ] && _ret="$(printf %s\\n "$_ret" | while read -r line; do - [ -${typ:-e} "${line%%\|*}" ] && printf %s\\n "$line" - done)" - if [ "$_ret" ]; then - _fasd_data="$_ret" - else # no case mathcing - _ret="$(printf %s\\n "$_fasd_data" | grep -i "$bre")" - [ "$_ret" ] && _ret="$(printf %s\\n "$_ret" | while read -r line; do - [ -${typ:-e} "${line%%\|*}" ] && printf %s\\n "$line" - done)" - if [ "$_ret" ]; then - _fasd_data="$_ret" - elif [ "${_FASD_FUZZY:-0}" -gt 0 ]; then # fuzzy matching - local fuzzy_bre="$(printf %s\\n "$fnd" | \ - sed 's/\([*\.\\\[]\)/\\\1/g;s/\$$/|/ - s@\(\\\{0,1\}[^ ]\)@\1[^|/]\\{0,'"$_FASD_FUZZY"'\\}@g - s@ @[^|]*@g')" - fuzzy_bre='^[^|]*'"$fuzzy_bre"'[^|/]*|' - _ret="$(printf %s\\n "$_fasd_data" | grep -i "$fuzzy_bre")" - [ "$_ret" ] && _ret="$(printf %s\\n "$_ret" | while read -r line; do - [ -${typ:-e} "${line%%\|*}" ] && printf %s\\n "$line" - done)" - [ "$_ret" ] && _fasd_data="$_ret" || _fasd_data= - fi - fi - else # no query arugments - _fasd_data="$(printf %s\\n "$_fasd_data" | while read -r line; do - [ -${typ:-e} "${line%%\|*}" ] && printf %s\\n "$line" - done)" - fi - - # query the database - [ "$_fasd_data" ] && printf %s\\n "$_fasd_data" | \ - $_FASD_AWK -v t="$(date +%s)" -F"|" ' - function frecent(time) { - dx = t-time - if( dx < 3600 ) return 6 - if( dx < 86400 ) return 4 - if( dx < 604800 ) return 2 - return 1 - } - { - if(!paths[$1]) { - times[$1] = $2 - la[$1] = $3 - paths[$1] = 1 - } else { - times[$1] += $2 - if($3 > la[$1]) la[$1] = $3 - } - } - END { - for(i in paths) printf "%-10s %s\n", '"$prior"', i - }' - 2>> "$_FASD_SINK" - ;; - - --backend) - case $2 in - native) cat "$_FASD_DATA";; - viminfo) - < "$_FASD_VIMINFO" sed -n '/^>/{s@~@'"$HOME"'@ - s/^..// - p - }' | $_FASD_AWK -v t="$(date +%s)" '{ - t -= 60 - print $0 "|1|" t - }' - ;; - recently-used) - local nl="$(printf '\\\nX')"; nl="${nl%X}" # slash newline for sed - tr -d '\n' < "$_FASD_RECENTLY_USED_XBEL" | \ - sed 's@file:/@'"$nl"'@g;s@count="@'"$nl"'@g' | sed '1d;s/".*$//' | \ - tr '\n' '|' | sed 's@|/@'"$nl"'@g' | $_FASD_AWK -F'|' '{ - sum = 0 - for( i=2; i<=NF; i++ ) sum += $i - print $1 "|" sum - }' - ;; - *) eval "$2";; - esac - ;; - - *) # parsing logic and processing - local fnd= last= _FASD_BACKENDS="$_FASD_BACKENDS" _fasd_data= comp= exec= - while [ "$1" ]; do case $1 in - --complete) [ "$2" = "--" ] && shift; set -- $2; local lst=1 r=r comp=1;; - --query|--add|--delete|-A|-D) fasd "$@"; return $?;; - --version) [ -z "$comp" ] && echo "1.0.1" && return;; - --) while [ "$2" ]; do shift; fnd="$fnd $1"; last="$1"; done;; - -*) local o="${1#-}"; while [ "$o" ]; do case $o in - s*) local show=1;; - l*) local lst=1;; - i*) [ -z "$comp" ] && local interactive=1 show=1;; - r*) local mode=rank;; - t*) local mode=recent;; - e*) o="${o#?}"; if [ "$o" ]; then # there are characters after "-e" - local exec="$o" # anything after "-e" - else # use the next argument - local exec="${2:?"-e: Argument needed "}" - shift - fi; break;; - b*) o="${o#?}"; if [ "$o" ]; then - _FASD_BACKENDS="$o" - else - _FASD_BACKENDS="${2:?"-b: Argument needed"}" - shift - fi; break;; - B*) o="${o#?}"; if [ "$o" ]; then - _FASD_BACKENDS="$_FASD_BACKENDS $o" - else - _FASD_BACKENDS="$_FASD_BACKENDS ${2:?"-B: Argument needed"}" - shift - fi; break;; - a*) local typ=e;; - d*) local typ=d;; - f*) local typ=f;; - R*) local r=r;; - [0-9]*) local _fasd_i="$o"; break;; - h*) [ -z "$comp" ] && echo "fasd [options] [query ...] -[f|a|s|d|z] [options] [query ...] - options: - -s list paths with scores - -l list paths without scores - -i interactive mode - -e set command to execute on the result file - -b only use backend - -B add additional backend - -a match files and directories - -d match directories only - -f match files only - -r match by rank only - -t match by recent access only - -R reverse listing order - -h show a brief help message - -[0-9] select the nth entry - -fasd [-A|-D] [paths ...] - -A add paths - -D delete paths" >&2 && return;; - esac; o="${o#?}"; done;; - *) fnd="$fnd $1"; last="$1";; - esac; shift; done - - # guess whether the last query is selected from tab completion - case $last in - /?*) if [ -z "$show$lst" -a -${typ:-e} "$last" -a "$exec" ]; then - $exec "$last" - return - fi;; - esac - - local R; [ -z "$r" ] && R=r || R= # let $R be the opposite of $r - fnd="${fnd# }" - - local res - res="$(fasd --query 2>> "$_FASD_SINK")" # query the database - [ $? -gt 0 ] && return - if [ 0 -lt ${_fasd_i:-0} ] 2>> "$_FASD_SINK"; then - res="$(printf %s\\n "$res" | sort -n${R} | \ - sed -n "$_fasd_i"'s/^[^ ]*[ ]*//p')" - elif [ "$interactive" ] || [ "$exec" -a -z "$fnd$lst$show" -a -t 1 ]; then - if [ "$(printf %s "$res" | sed -n '$=')" -gt 1 ]; then - res="$(printf %s\\n "$res" | sort -n${R})" - printf %s\\n "$res" | sed = | sed 'N;s/\n/ /' | sort -nr >&2 - printf "> " >&2 - local i; read i; [ 0 -lt "${i:-0}" ] 2>> "$_FASD_SINK" || return 1 - fi - res="$(printf %s\\n "$res" | sed -n "${i:-1}"'s/^[^ ]*[ ]*//p')" - elif [ "$lst" ]; then - [ "$res" ] && printf %s\\n "$res" | sort -n${r} | sed 's/^[^ ]*[ ]*//' - return - elif [ "$show" ]; then - [ "$res" ] && printf %s\\n "$res" | sort -n${r} - return - elif [ "$fnd" ] && [ "$exec" -o ! -t 1 ]; then # exec or subshell - res="$(printf %s\\n "$res" | sort -n | sed -n '$s/^[^ ]*[ ]*//p')" - else # no args, show - [ "$res" ] && printf %s\\n "$res" | sort -n${r} - return - fi - if [ "$res" ]; then - fasd --add "$res" - [ -z "$exec" ] && exec='printf %s\n' - $exec "$res" - fi - ;; - esac -} - -fasd --init env - -case $- in - *i*) ;; # assume being sourced, do nothing - *) # assume being executed as an executable - if [ -x "$_FASD_SHELL" -a -z "$_FASD_SET" ]; then - _FASD_SET=1 exec $_FASD_SHELL "$0" "$@" - else - fasd "$@" - fi;; -esac - diff --git a/zsh/functions/pure/prompt_pure_setup b/zsh/functions/pure/prompt_pure_setup deleted file mode 100644 index 5c635037..00000000 --- a/zsh/functions/pure/prompt_pure_setup +++ /dev/null @@ -1,118 +0,0 @@ -# Pure -# by Sindre Sorhus -# https://github.com/sindresorhus/pure -# MIT License - -# For my own and others sanity -# git: -# %b => current branch -# %a => current action (rebase/merge) -# prompt: -# %F => color dict -# %f => reset color -# %~ => current path -# %* => time -# %n => username -# %m => shortname host -# %(?..) => prompt conditional - %(condition.true.false) - - -# turns seconds into human readable time -# 165392 => 1d 21h 56m 32s -prompt_pure_human_time() { - local tmp=$1 - local days=$(( tmp / 60 / 60 / 24 )) - local hours=$(( tmp / 60 / 60 % 24 )) - local minutes=$(( tmp / 60 % 60 )) - local seconds=$(( tmp % 60 )) - (( $days > 0 )) && echo -n "${days}d " - (( $hours > 0 )) && echo -n "${hours}h " - (( $minutes > 0 )) && echo -n "${minutes}m " - echo "${seconds}s" -} - -# fastest possible way to check if repo is dirty -prompt_pure_git_dirty() { - # check if we're in a git repo - command git rev-parse --is-inside-work-tree &>/dev/null || return - # check if it's dirty - command git diff --quiet --ignore-submodules HEAD &>/dev/null - - (($? == 1)) && echo '*' -} - -# displays the exec time of the last command if set threshold was exceeded -prompt_pure_cmd_exec_time() { - local stop=$(date +%s) - local start=${cmd_timestamp:-$stop} - integer elapsed=$stop-$start - (($elapsed > ${PURE_CMD_MAX_EXEC_TIME:=5})) && prompt_pure_human_time $elapsed -} - -prompt_pure_preexec() { - cmd_timestamp=$(date +%s) - - # shows the current dir and executed command in the title when a process is active - print -Pn "\e]0;" - echo -nE "$PWD:t: $2" - print -Pn "\a" -} - -# string length ignoring ansi escapes -prompt_pure_string_length() { - echo ${#${(S%%)1//(\%([KF1]|)\{*\}|\%[Bbkf])}} -} - -prompt_pure_precmd() { - # shows the full path in the title - print -Pn '\e]0;%~\a' - - # git info - vcs_info - - local prompt_pure_preprompt='\n%F{blue}%~%F{242}$vcs_info_msg_0_`prompt_pure_git_dirty` $prompt_pure_username%f %F{yellow}`prompt_pure_cmd_exec_time`%f' - print -P $prompt_pure_preprompt - - # check async if there is anything to pull - (( ${PURE_GIT_PULL:-1} )) && { - # check if we're in a git repo - command git rev-parse --is-inside-work-tree &>/dev/null && - # check check if there is anything to pull - command git fetch &>/dev/null && - # check if there is an upstream configured for this branch - command git rev-parse --abbrev-ref @'{u}' &>/dev/null && - (( $(command git rev-list --right-only --count HEAD...@'{u}' 2>/dev/null) > 0 )) && - # some crazy ansi magic to inject the symbol into the previous line - print -Pn "\e7\e[A\e[1G\e[`prompt_pure_string_length $prompt_pure_preprompt`C%F{cyan}⇣%f\e8" - } &! - - # reset value since `preexec` isn't always triggered - unset cmd_timestamp -} - - -prompt_pure_setup() { - # prevent percentage showing up - # if output doesn't end with a newline - export PROMPT_EOL_MARK='' - - prompt_opts=(cr subst percent) - - autoload -Uz add-zsh-hook - autoload -Uz vcs_info - - add-zsh-hook precmd prompt_pure_precmd - add-zsh-hook preexec prompt_pure_preexec - - zstyle ':vcs_info:*' enable git - zstyle ':vcs_info:git*' formats ' %b' - zstyle ':vcs_info:git*' actionformats ' %b|%a' - - # show username@host if logged in through SSH - [[ "$SSH_CONNECTION" != '' ]] && prompt_pure_username='%n@%m ' - - # prompt turns red if the previous command didn't exit with 0 - PROMPT='%(?.%F{magenta}.%F{red})❯%f ' -} - -prompt_pure_setup "$@" diff --git a/zsh/functions/runit/_sv b/zsh/functions/runit/_sv deleted file mode 100644 index bf98b3ea..00000000 --- a/zsh/functions/runit/_sv +++ /dev/null @@ -1,7 +0,0 @@ -#compdef sv - -_arguments -A -S -s \ - '-v[wait up to 7 seconds for the command to take effect. (up|down|term|once|cont|exit)]' \ - '-w+[wait for %n seconds]: :_guard "[0-9]#" "numeric value"' \ - '1:command:(status up down once pause cont hup alarm interrupt quit 1 2 term kill exit start stop restart shutdown force-stop force-reload force-restart force-shutdown check)' \ - '*:installed service:_files -W ${SVDIR:-/service}' diff --git a/zsh/functions/runit/getservicedir b/zsh/functions/runit/getservicedir deleted file mode 100644 index 2e5d961c..00000000 --- a/zsh/functions/runit/getservicedir +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env zsh -print ${$(readlink ${SVDIR:-/service}/$1):h} \ No newline at end of file diff --git a/zsh/functions/runit/linksv b/zsh/functions/runit/linksv deleted file mode 100644 index 7ee71094..00000000 --- a/zsh/functions/runit/linksv +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env zsh - -if [[ -z $1 ]]; then - echo "No service specified" - return 64 -fi - - -if [[ ! -x $1 ]]; then - echo "Service does not exist in current directory" - return 1 -fi - -mv $1{,.old} -ln -s =sv $1 -chmod -h a-w $1 diff --git a/zsh/functions/runit/renamesv b/zsh/functions/runit/renamesv deleted file mode 100644 index dba1098d..00000000 --- a/zsh/functions/runit/renamesv +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env zsh -local svdir=${SVDIR:-/service} -if [[ -z $1 || -z $2 ]]; then - echo "Usage: $0 source target" - return 64 -fi - -if [[ ! -h $svdir/$1 ]]; then - echo $svdir/$1 does not exist - return 2 -fi - -if [[ -e $svdir/$2 ]]; then - echo $svdir/$2 already exists - return 3 -fi - -local servicedir=`getservicedir` - -if [[ ! ( -w $svdir && -w $servicedir ) ]]; then - echo $svdir or $servicedir is not writeable -fi - -# The service doesn't have to be stopped as removing the link will do that -# However, running the same service twice isn't a great idea, so wait here -sv stop $1 - -rm -f $svdir/$1 || return - -mv $servicedir/{$1,$2} || return - -ln -s {$servicedir,$svdir}/$2 || return - -sv start $2 - -return diff --git a/zsh/interactive.zsh b/zsh/interactive.zsh deleted file mode 100755 index 365214c9..00000000 --- a/zsh/interactive.zsh +++ /dev/null @@ -1,362 +0,0 @@ -export PAGER="less" -export EDITOR="emacsclient" -export CLICOLOR=true - -# -# zsh variables -# -HISTFILE=~/.zsh/history -HISTSIZE=4000 -SAVEHIST=3000 - -WORDCHARS='*?_-[]~=.&;!#$%^(){}<>' - -#If a command takes more than 5 seconds, give statistics -REPORTTIME=5 -TIMEFMT="%U user %S system %P cpu %*Es total" - -#Check for user logins -watch=notme -WATCHFMT="%n has %a %l from %M at %t" - -hosts=( - server - prefect - alanpearce.co.uk - home.alanpearce.co.uk -) - -users=(alan root toor) - -function linkAuthSock () { - local linkSock=~/.ssh/ssh_auth_sock - ln -sf $1 ~/.ssh/ssh_auth_sock - export SSH_AUTH_SOCK=$linkSock -} - -if [[ "$SSH_AUTH_SOCK" != "" ]] -then - if [[ -e ~/.ssh/ssh_auth_sock && ! -L ~/.ssh/ssh_auth_sock ]] - then - linkAuthSock $SSH_AUTH_SOCK - fi -fi - -LS_COLORS='no=00:fi=00:di=36:ln=35:pi=30;44:so=35;44:do=35;44:bd=33;44:cd=37;44:or=05;37;41:mi=05;37;41:ex=01;31:*.cmd=01;31:*.exe=01;31:*.com=01;31:*.bat=01;31:*.reg=01;31:*.app=01;31:*.txt=32:*.org=32:*.md=32:*.mkd=32:*.h=32:*.c=32:*.C=32:*.cc=32:*.cpp=32:*.cxx=32:*.objc=32:*.sh=32:*.csh=32:*.zsh=32:*.el=32:*.vim=32:*.java=32:*.pl=32:*.pm=32:*.py=32:*.rb=32:*.hs=32:*.php=32:*.htm=32:*.html=32:*.shtml=32:*.erb=32:*.haml=32:*.xml=32:*.rdf=32:*.css=32:*.sass=32:*.scss=32:*.less=32:*.js=32:*.coffee=32:*.man=32:*.0=32:*.1=32:*.2=32:*.3=32:*.4=32:*.5=32:*.6=32:*.7=32:*.8=32:*.9=32:*.l=32:*.n=32:*.p=32:*.pod=32:*.tex=32:*.bmp=33:*.cgm=33:*.dl=33:*.dvi=33:*.emf=33:*.eps=33:*.gif=33:*.jpeg=33:*.jpg=33:*.JPG=33:*.mng=33:*.pbm=33:*.pcx=33:*.pdf=33:*.pgm=33:*.png=33:*.ppm=33:*.pps=33:*.ppsx=33:*.ps=33:*.svg=33:*.svgz=33:*.tga=33:*.tif=33:*.tiff=33:*.xbm=33:*.xcf=33:*.xpm=33:*.xwd=33:*.xwd=33:*.yuv=33:*.aac=33:*.au=33:*.flac=33:*.mid=33:*.midi=33:*.mka=33:*.mp3=33:*.mpa=33:*.mpeg=33:*.mpg=33:*.ogg=33:*.ra=33:*.wav=33:*.anx=33:*.asf=33:*.avi=33:*.axv=33:*.flc=33:*.fli=33:*.flv=33:*.gl=33:*.m2v=33:*.m4v=33:*.mkv=33:*.mov=33:*.mp4=33:*.mp4v=33:*.mpeg=33:*.mpg=33:*.nuv=33:*.ogm=33:*.ogv=33:*.ogx=33:*.qt=33:*.rm=33:*.rmvb=33:*.swf=33:*.vob=33:*.wmv=33:*.doc=31:*.docx=31:*.rtf=31:*.dot=31:*.dotx=31:*.xls=31:*.xlsx=31:*.ppt=31:*.pptx=31:*.fla=31:*.psd=31:*.7z=1;35:*.apk=1;35:*.arj=1;35:*.bin=1;35:*.bz=1;35:*.bz2=1;35:*.cab=1;35:*.deb=1;35:*.dmg=1;35:*.gem=1;35:*.gz=1;35:*.iso=1;35:*.jar=1;35:*.msi=1;35:*.rar=1;35:*.rpm=1;35:*.tar=1;35:*.tbz=1;35:*.tbz2=1;35:*.tgz=1;35:*.tx=1;35:*.war=1;35:*.xpi=1;35:*.xz=1;35:*.z=1;35:*.Z=1;35:*.zip=1;35:*.ANSI-30-black=30:*.ANSI-01;30-brblack=01;30:*.ANSI-31-red=31:*.ANSI-01;31-brred=01;31:*.ANSI-32-green=32:*.ANSI-01;32-brgreen=01;32:*.ANSI-33-yellow=33:*.ANSI-01;33-bryellow=01;33:*.ANSI-34-blue=34:*.ANSI-01;34-brblue=01;34:*.ANSI-35-magenta=35:*.ANSI-01;35-brmagenta=01;35:*.ANSI-36-cyan=36:*.ANSI-01;36-brcyan=01;36:*.ANSI-37-white=37:*.ANSI-01;37-brwhite=01;37:*.log=01;34:*~=01;34:*#=01;34:*.bak=01;36:*.BAK=01;36:*.old=01;36:*.OLD=01;36:*.org_archive=01;36:*.off=01;36:*.OFF=01;36:*.dist=01;36:*.DIST=01;36:*.orig=01;36:*.ORIG=01;36:*.swp=01;36:*.swo=01;36:*,v=01;36:*.gpg=34:*.gpg=34:*.pgp=34:*.asc=34:*.3des=34:*.aes=34:*.enc=34:' - -#Ignore suffixes in completion -fignore=( - svbin -) - -# -# Modules -# -autoload -Uz compinit bashcompinit -autoload -U colors complist zrecompile zmv zargs zed -autoload -Uz vcs_info -autoload insert-files -zle -N insert-files -zmodload -i zsh/complist -colors -compinit -u -d .zsh/cache/compdump -bashcompinit - -zstyle :compinstall filename '~/.zshrc' - -autoload -Uz _tmux_pane_words -zle -C tmux-pane-words-prefix complete-word _generic -zle -C tmux-pane-words-anywhere complete-word _generic -zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' completer _tmux_pane_words -zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' ignore-line current -zstyle ':completion:tmux-pane-words-anywhere:*' matcher-list 'b:=* m:{A-Za-z}={a-zA-Z}' - -# Speed up completion by not going further than a full match -zstyle ':completion:*' accept-exact '*(N)' - -zstyle ':completion:*:default' use-cache on -zstyle ':completion:*:default' cache-path ~/.zsh/cache/compcache - -zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' '+m:{A-Z}={a-z}' -zstyle ':completion:*' completer _oldlist _expand _force_rehash _complete _match - -zstyle ':completion:*' verbose yes -zstyle ':completion:*:messages' format '%d' -zstyle ':completion:*:warnings' format 'No matches for: %d' -zstyle ':completion:*:descriptions' format '%U%B%d%b%u' -zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b' -zstyle ':completion:*' group-name '' - -# Complete all user processes -zstyle ':completion:*:processes' command 'ps -au$USER' -# Add colour to process lists -zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' -zstyle ':completion:*:*:kill:*' menu yes select -zstyle ':completion:*:kill:*' force-list always -zstyle ':completion:*:*:killall:*' menu yes select -zstyle ':completion:*:killall:*' force-list always - -# Complete unreadable log filenames -#zstyle ':completion::complete:(most|tail)::' fake-files '/var/log/*:current' - -# Group manpages by section -zstyle ':completion:*' separate-sections true - -# Users -#zstyle '*' users $users - -zstyle '*' hosts $hosts - -zstyle ':completion:*:functions' ignored-patterns '_*' -zstyle ':completion:*:cd:*' ignore-parents parent pwd - -#This works, but isn't the same as ls -#zstyle ':completion:*:default' list-colors '' -zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} - -zstyle ':vcs_info:*' enable git hg - -# Filename suffixes to ignore during completion (except after rm command) -zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' '*?.old' '*?.pro' - -## Prompt -if [[ $TERM != 'dumb' ]] -then - autoload -U promptinit - promptinit - prompt pure -fi - -# Options - -# Changing directories -setopt auto_cd - -# Completion -setopt auto_list # List multiple choices on first tab -unsetopt list_ambiguous # List ambiguous choices rather than completing common prefixes -unsetopt list_beep # Don't try to beep here -setopt list_types # Indicate file types - -# Expansion and globbing -setopt extended_glob # Use #~^ as part of filename patterns -unsetopt nomatch - -# History -unsetopt hist_beep -setopt hist_expire_dups_first -setopt hist_fcntl_lock # Use standard locking on histfile -setopt hist_find_no_dups -setopt hist_ignore_space -setopt hist_reduce_blanks -setopt hist_verify -setopt share_history -setopt inc_append_history - -# Input/Output -unsetopt clobber -unsetopt flow_control -setopt path_dirs # Search PATH even with slashes -setopt print_exit_value - -# Job Control -setopt auto_continue -unsetopt nohup -setopt long_list_jobs -unsetopt notify - -# Scripts and functions -unsetopt multi_func_def -setopt multios - -# Zle -unsetopt beep - -############ -# Keybinds # -############ -#KiTTY -bindkey "OD" backward-word -bindkey "OC" forward-word - -#General -bindkey "[1~" beginning-of-line -bindkey "[4~" end-of-line -bindkey "[5~" beginning-of-history -bindkey "[6~" end-of-history -bindkey "[2~" quoted-insert -bindkey "[3~" delete-char - -bindkey '' backward-delete-char - -bindkey '^I' expand-or-complete-prefix -bindkey '' reverse-menu-complete -bindkey '' up-line-or-search -bindkey '' down-line-or-search - -#urxvt -bindkey '[3;5~' delete-word -bindkey '' backward-word -bindkey '' forward-word - -bindkey 'f' insert-files -bindkey 'd' describe-key-briefly - -bindkey '\' tmux-pane-words-prefix -bindkey '|' tmux-pane-words-anywhere - -# Aliases before functions -alias getcflags='gcc -\#\#\# -march=native -E /usr/include/stdlib.h 2>&1 | grep "/usr/libexec/gcc/.*cc1"' -alias grep='grep --color=auto' -alias df='df -h' -alias du='du -h' -alias md='mkdir -p' -alias rd='rmdir' -alias .='source' - -ls='\ls' -gnu_ls_options="-v --group-directories-first --color=auto" -gnu_ls_isodate="--time-style=long-iso" -bsd_ls_options="-p" -bsd_ls_isodate="-D '%F %k:%M'" - -case $os in - osx) - 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 - ;; - gnu) - ls_options=$gnu_ls_options - ls_isodate=$gnu_ls_isodate - ;; -esac -alias l="${ls} ${ls_options} -Bp" -alias l1="${ls} ${ls_options} -1" -alias ls="${ls} ${ls_options} -hF" -alias la="${ls} ${ls_options} -hA" -alias ll="${ls} ${ls_options} ${ls_isodate} -hl" -alias lal="ll -A" -alias lla="lal" -alias llr="ll -t" -alias gpp='g++' -alias lsr="${ls} -tld *(m-2)" # mtime < -2days - -alias salt="noglob salt" -alias pping="prettyping.sh" -alias trans="transmission-remote transmission.home" -alias bitcoin="bitcoind" -alias su="smart_sudo " -alias E="SUDO_EDITOR=\emacsclient -c -a emacs\" sudoedit" -alias wprop='xprop |awk '\'' - /^WM_CLASS/{sub(/.* =/, "instance:"); sub(/,/, "\nclass:"); print} - /^WM_NAME/{sub(/.* =/, "title:"); print} - /^WM_WINDOW_ROLE/{sub(/.* =/, "role:"); print}'\''' - -alias et="emacsclient -t" - -alias -g ...='../..' - -#Suffix aliases -alias -s log=less - -if [[ -e =hub ]]; then - alias git="hub" - autoload -U _hub - compdef _hub hub -fi - -# Functions - -magit () { - emacsclient -e "(magit-status \"$PWD\")" -} - -dired () { - emacsclient -e "(dired \"$PWD\")" -} - -pid () { - local i - for i in /proc/<->/stat - [[ "$(< $i)" = *\((${(j:|:)~@})\)* ]] && echo $i:h:t - return 0 -} - -_force_rehash() { - (( CURRENT == 1 )) && rehash - return 1 # Because we didn't really complete anything -} - -portgrep() { - sudo lsof -i :$1 -nP | egrep '(LISTEN|UDP|COMMAND)' -} - -ipgrep() { - sudo lsof -i @$1 -nP -} - -smart_sudo () { - if [[ -n $1 ]]; then - \sudo $argv - else - #if no parameters were given, then assume we want a root shell - \sudo -i -u toor - fi -} - -compdef _sudo smart_sudo - -smart_compile () { - local zcompargs - if [[ $1 = *zshrc* ]]; then - zcompargs="-R" - fi - - if [[ $EUID -ne 0 || $1 != *alan* ]]; then - zrecompile -q -p $zcompargs $1 - fi - if [[ -n $2 ]]; then - . $1 - fi -} - -emacs_change_focus () { - emacsclient -n -e "(select-frame-set-input-focus (selected-frame))" > /dev/null -} - -ec () { - local visibleFrames - visibleFrames=`emacsclient -e '(length (visible-frame-list))'` - if [[ $? -ne 0 ]]; then - print "Daemon not running" - return 1 - fi - - if [[ $visibleFrames -eq 1 ]]; then - emacsclient -n -c "$@" && emacs_change_focus - else - emacs_change_focus - if [[ $# -gt 0 ]]; then - emacsclient -n "$@" - fi - fi -} - -_FASD_DATA="$HOME/.zsh/fasd-data" -autoload -U fasd -source ~/.zsh/cache/fasd-init-zsh - -if [[ $OSTYPE == freebsd* ]]; then - source ~/projects/dotfiles/zsh/freebsd.zsh -fi diff --git a/zsh/login.zsh b/zsh/login.zsh deleted file mode 100755 index e69de29b..00000000 diff --git a/zsh/logout.zsh b/zsh/logout.zsh deleted file mode 100755 index e69de29b..00000000 diff --git a/zsh/prefect.zsh b/zsh/prefect.zsh deleted file mode 100644 index 997ba391..00000000 --- a/zsh/prefect.zsh +++ /dev/null @@ -1,10 +0,0 @@ -EDITOR="emacs" -VISUAL="emacs" - -if [[ ! -S $SSH_AUTH_SOCK ]] -then - eval `ssh-agent | sed -e '/^echo/d'` - linkAuthSock $SSH_AUTH_SOCK -fi - -export WINEARCH="win32" \ No newline at end of file diff --git a/zsh/server.zsh b/zsh/server.zsh deleted file mode 100644 index d9d74219..00000000 --- a/zsh/server.zsh +++ /dev/null @@ -1,20 +0,0 @@ -# -*- shell-script -*- - -export SVDIR=/service -if [[ "$EUID" == "0" ]] || [[ "$USER" == "root" ]] -then - export EDITOR="emacs -nw" -else - export ALTERNATE_EDITOR="emacs" - export EDITOR="emacsclient" -fi - -mailpath= - -# Folder aliases -hash -d music=/tank/media/Music - -zstyle ':completion:*' local server /tank/www/internal '' -zstyle ':completion:*' local external /tank/www/external -zstyle ':completion:*' local alphapulsar.uk.to /tank/www/gaming -zstyle ':completion:*' local home.alanpearce.co.uk /tank/www/external -- cgit 1.4.1 From 65f9082920ad3d3d92929d68a125986a8c70cd0b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Apr 2014 18:17:23 +0100 Subject: Move install functionality to rcm hooks --- hooks/post-up/emacs | 6 ++++ hooks/post-up/zsh | 34 +++++++++++++++++++++ install | 88 ----------------------------------------------------- 3 files changed, 40 insertions(+), 88 deletions(-) create mode 100755 hooks/post-up/emacs create mode 100755 hooks/post-up/zsh delete mode 100755 install diff --git a/hooks/post-up/emacs b/hooks/post-up/emacs new file mode 100755 index 00000000..f6071b7d --- /dev/null +++ b/hooks/post-up/emacs @@ -0,0 +1,6 @@ +#!/usr/bin/env zsh + +if [[ -s $commands[emacs] ]] +then + emacs --batch --eval '(batch-byte-recompile-directory 0)' ~/.emacs.d/ +fi diff --git a/hooks/post-up/zsh b/hooks/post-up/zsh new file mode 100755 index 00000000..f964e2bd --- /dev/null +++ b/hooks/post-up/zsh @@ -0,0 +1,34 @@ +#!/usr/bin/env zsh +ZDOTDIR="${XDG_CONFIG_HOME:~/.config}/zsh" + +if [[ ! -d ~/.zsh/cache ]] +then + mkdir -p ~/.zsh/cache +fi + +fasd_cache=~/.zsh/cache/fasd-init-zsh +if [[ ! -s "$fasd_cache" || $ZDOTDIR/functions/fasd/fasd -nt "$fasd_cache" ]]; then + $ZDOTDIR/functions/fasd/fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache" +fi + +autoload -U zrecompile +local -a zfiles +zfiles=( + $ZDOTDIR/functions/fasd/fasd + $fasd_cache + $ZDOTDIR/zshrc +) + +if [[ -f $ZDOTDIR/${HOST%%.*}.zsh ]]; then + zfiles+=$ZDOTDIR/${HOST%%.*}.zsh +fi +if [[ $OSTYPE == freebsd* ]]; then + zfiles+=$ZDOTDIR/freebsd.zsh +fi + +zrecompile -p -R $ZDOTDIR/.zshrc.zwc $zfiles -- \ + -M .zsh/cache/compdump + +for fp in $ZDOTDIR/functions/*(/); do + zrecompile -p $fp $fp/* +done diff --git a/install b/install deleted file mode 100755 index 9176902c..00000000 --- a/install +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env zsh - -target=~/projects/dotfiles -pushd $HOME - -setopt EXTENDED_GLOB - -if [[ ! -d $target ]] -then - mkdir -pv $target -fi - -if [[ ! -d $target && ${(L)host} =~ prefect ]] -then - git clone git://github.com/alanpearce/dotfiles.git $target -fi - -install-dot () { - if [[ "$1" != . && ! -d $1 ]] - then - mkdir $1 - fi - - for f in $@[2,-1] - do - if [[ ! -e $1$f:t ]] - then - ln -sf $f $1$f:t - fi - done -} - -install-dot $target/.git/hooks/ $target/git-hooks/* -install-dot .emacs.d/ $target/emacs/{init.el{,c},elisp} -install-dot . $target/^install(.) $target/zsh/fasdrc -install-dot .ssh/ $target/ssh/* -if [[ -d ~/Library/LaunchAgents ]] -then - install-dot ~/Library/LaunchAgents $target/launchagents/* -fi - -ln -sf $target/zsh/environment.zsh .zshenv -ln -sf $target/zsh/interactive.zsh .zshrc -ln -sf $target/zsh/login.zsh .zlogin -ln -sf $target/zsh/logout.zsh .zlogout - -if [[ -d projects/dwm ]] -then - install-dot projects/dwm/ $target/dwm/* -fi - -if [[ -s $commands[emacs] ]] -then - emacs --batch --eval '(batch-byte-recompile-directory 0)' ~/.emacs.d/ -fi - -if [[ ! -d ~/.zsh/cache ]] -then - mkdir -p ~/.zsh/cache -fi - -fasd_cache=~/.zsh/cache/fasd-init-zsh -if [[ ! -s "$fasd_cache" || $target/zsh/functions/fasd -nt "$fasd_cache" ]]; then - $target/zsh/functions/fasd/fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache" -fi - -autoload -U zrecompile -local -a zfiles -zfiles=( - $target/zsh/functions/fasd/fasd - $fasd_cache - $target/zsh/interactive.zsh -) -if [[ -f $target/zsh/${HOST%%.*}.zsh ]]; then - zfiles+=$target/zsh/${HOST%%.*}.zsh -fi -if [[ $OSTYPE == freebsd* ]]; then - zfiles+=$target/zsh/freebsd.zsh -fi - -zrecompile -p -R ~/.zshrc.zwc $zfiles -- \ - -M .zsh/cache/compdump - -for fp in $target/zsh/functions/*(/); do - zrecompile -p $fp $fp/* -done - -popd -- cgit 1.4.1 From abaa898a029505446c6f8cbf3a45d17f9e15a571 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Apr 2014 18:18:00 +0100 Subject: zsh: use .cache/zsh instead of .zsh/cache --- hooks/post-up/zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hooks/post-up/zsh b/hooks/post-up/zsh index f964e2bd..78eb093b 100755 --- a/hooks/post-up/zsh +++ b/hooks/post-up/zsh @@ -1,12 +1,12 @@ #!/usr/bin/env zsh ZDOTDIR="${XDG_CONFIG_HOME:~/.config}/zsh" -if [[ ! -d ~/.zsh/cache ]] +if [[ ! -d ~/.cache/zsh ]] then - mkdir -p ~/.zsh/cache + mkdir -p ~/.cache/zsh fi -fasd_cache=~/.zsh/cache/fasd-init-zsh +fasd_cache=~/.cache/zsh/fasd-init-zsh if [[ ! -s "$fasd_cache" || $ZDOTDIR/functions/fasd/fasd -nt "$fasd_cache" ]]; then $ZDOTDIR/functions/fasd/fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache" fi @@ -27,7 +27,7 @@ if [[ $OSTYPE == freebsd* ]]; then fi zrecompile -p -R $ZDOTDIR/.zshrc.zwc $zfiles -- \ - -M .zsh/cache/compdump + -M .cache/zsh/compdump for fp in $ZDOTDIR/functions/*(/); do zrecompile -p $fp $fp/* -- cgit 1.4.1 From 34d2b95ffd8137abf714d5996efaa1ae1b550ca0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Apr 2014 18:21:27 +0100 Subject: zsh: Use system version of fasd --- hooks/post-up/zsh | 5 +- tag-zsh/config/zsh/functions/fasd/fasd | 624 --------------------------------- 2 files changed, 2 insertions(+), 627 deletions(-) delete mode 100755 tag-zsh/config/zsh/functions/fasd/fasd diff --git a/hooks/post-up/zsh b/hooks/post-up/zsh index 78eb093b..b31a8cb4 100755 --- a/hooks/post-up/zsh +++ b/hooks/post-up/zsh @@ -7,14 +7,13 @@ then fi fasd_cache=~/.cache/zsh/fasd-init-zsh -if [[ ! -s "$fasd_cache" || $ZDOTDIR/functions/fasd/fasd -nt "$fasd_cache" ]]; then - $ZDOTDIR/functions/fasd/fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache" +if [[ -s $commands[fasd] && (! -s "$fasd_cache" || $commands[fasd] -nt "$fasd_cache") ]]; then + fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache" fi autoload -U zrecompile local -a zfiles zfiles=( - $ZDOTDIR/functions/fasd/fasd $fasd_cache $ZDOTDIR/zshrc ) diff --git a/tag-zsh/config/zsh/functions/fasd/fasd b/tag-zsh/config/zsh/functions/fasd/fasd deleted file mode 100755 index b1e64f41..00000000 --- a/tag-zsh/config/zsh/functions/fasd/fasd +++ /dev/null @@ -1,624 +0,0 @@ -#!/usr/bin/env sh - -# Fasd (this file) can be sourced or executed by any POSIX compatible shell. - -# Fasd is originally written based on code from z (https://github.com/rupa/z) -# by rupa deadwyler under the WTFPL license. Most if not all of the code has -# been rewritten. - -# Copyright (C) 2011, 2012 by Wei Dai. All rights reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -fasd() { - - # make zsh do word splitting inside this function - [ "$ZSH_VERSION" ] && emulate sh && setopt localoptions - - case $1 in - --init) shift - while [ "$1" ]; do - case $1 in - env) - { # source rc files if present - [ -s "/etc/fasdrc" ] && . "/etc/fasdrc" - [ -s "$HOME/.fasdrc" ] && . "$HOME/.fasdrc" - - # set default options - [ -z "$_FASD_DATA" ] && _FASD_DATA="$HOME/.fasd" - [ -z "$_FASD_BLACKLIST" ] && _FASD_BLACKLIST="--help" - [ -z "$_FASD_SHIFT" ] && _FASD_SHIFT="sudo busybox" - [ -z "$_FASD_IGNORE" ] && _FASD_IGNORE="fasd ls echo" - [ -z "$_FASD_SINK" ] && _FASD_SINK=/dev/null - [ -z "$_FASD_TRACK_PWD" ] && _FASD_TRACK_PWD=1 - [ -z "$_FASD_MAX" ] && _FASD_MAX=2000 - [ -z "$_FASD_BACKENDS" ] && _FASD_BACKENDS=native - [ -z "$_FASD_FUZZY" ] && _FASD_FUZZY=2 - [ -z "$_FASD_VIMINFO" ] && _FASD_VIMINFO="$HOME/.viminfo" - [ -z "$_FASD_RECENTLY_USED_XBEL" ] && \ - _FASD_RECENTLY_USED_XBEL="$HOME/.local/share/recently-used.xbel" - - if [ -z "$_FASD_AWK" ]; then - # awk preferences - local awk; for awk in mawk gawk original-awk nawk awk; do - $awk "" && _FASD_AWK=$awk && break - done - fi - } >> "${_FASD_SINK:-/dev/null}" 2>&1 - ;; - - auto) cat <> "$_FASD_SINK" 2>&1 - -EOS - ;; - - posix-alias) cat <& /dev/null || fasd -d'; -EOS - ;; - - zsh-hook) cat <> "$_FASD_SINK" 2>&1 -} -autoload -Uz add-zsh-hook -add-zsh-hook preexec _fasd_preexec - -EOS - ;; - - bash-hook) cat <> "$_FASD_SINK" 2>&1 -} - -# add bash hook -case \$PROMPT_COMMAND in - *_fasd_prompt_func*) ;; - *) PROMPT_COMMAND="_fasd_prompt_func;\$PROMPT_COMMAND";; -esac - -EOS - ;; - - posix-hook) cat <> "$_FASD_SINK" 2>&1 -} -case \$PS1 in - *_fasd_ps1_func*) ;; - *) export PS1="\\\$(_fasd_ps1_func)\$PS1";; -esac - -EOS - ;; - - tcsh-hook) cat <& /dev/null'; -EOS - - ;; - - zsh-ccomp) cat <> "$_FASD_SINK" | \\ - sort -nr | sed 's/^[^ ]*[ ]*//' | while read -r line; do - compadd -U -V fasd "\$line" - done - compstate[insert]=menu # no expand - } - _fasd_zsh_word_complete_f() { _fasd_zsh_word_complete f ; } - _fasd_zsh_word_complete_d() { _fasd_zsh_word_complete d ; } - _fasd_zsh_word_complete_trigger() { - local _fasd_cur="\${words[CURRENT]}" - eval \$(fasd --word-complete-trigger _fasd_zsh_word_complete \$_fasd_cur) - } - # define zle widgets - zle -C fasd-complete complete-word _generic - zstyle ':completion:fasd-complete:*' completer _fasd_zsh_word_complete - zstyle ':completion:fasd-complete:*' menu-select - - zle -C fasd-complete-f complete-word _generic - zstyle ':completion:fasd-complete-f:*' completer _fasd_zsh_word_complete_f - zstyle ':completion:fasd-complete-f:*' menu-select - - zle -C fasd-complete-d complete-word _generic - zstyle ':completion:fasd-complete-d:*' completer _fasd_zsh_word_complete_d - zstyle ':completion:fasd-complete-d:*' menu-select -} - -EOS - ;; - - zsh-ccomp-install) cat <> "$_FASD_SINK" | sed -n "\\\$s/^.*'\\\\(.*\\\\)'/\\\\1/p") - \${COMP_LINE#* }" | while read -r line; do - quote_readline "\$line" 2>/dev/null || \\ - printf %q "\$line" 2>/dev/null && \\ - printf \\\\n - done) - local IFS=\$'\\n'; COMPREPLY=( \$RESULT ) -} -_fasd_bash_hook_cmd_complete() { - for cmd in \$*; do - complete -F _fasd_bash_cmd_complete \$cmd - done -} - -EOS - ;; - - bash-ccomp-install) cat <$`{}]\{1,\}/\1 /g' - ;; - - --proc) shift # process commands - # stop if we don't own $_FASD_DATA or $_FASD_RO is set - [ -f "$_FASD_DATA" -a ! -O "$_FASD_DATA" ] || [ "$_FASD_RO" ] && return - - # blacklists - local each; for each in $_FASD_BLACKLIST; do - case " $* " in *\ $each\ *) return;; esac - done - - # shifts - while true; do - case " $_FASD_SHIFT " in - *\ $1\ *) shift;; - *) break;; - esac - done - - # ignores - case " $_FASD_IGNORE " in - *\ $1\ *) return;; - esac - - shift; fasd --add "$@" # add all arguments except command - ;; - - --add|-A) shift # add entries - # stop if we don't own $_FASD_DATA or $_FASD_RO is set - [ -f "$_FASD_DATA" -a ! -O "$_FASD_DATA" ] || [ "$_FASD_RO" ] && return - - # find all valid path arguments, convert them to simplest absolute form - local paths="$(while [ "$1" ]; do - [ -e "$1" ] && printf %s\\n "$1"; shift - done | sed '/^[^/]/s@^@'"$PWD"'/@ - s@/\.\.$@/../@;s@/\(\./\)\{1,\}@/@g;:0 - s@[^/][^/]*//*\.\./@/@;t 0 - s@^/*\.\./@/@;s@//*@/@g;s@/\.\{0,1\}$@@;s@^$@/@' 2>> "$_FASD_SINK" \ - | tr '\n' '|')" - - # add current pwd if the option is set - [ "$_FASD_TRACK_PWD" = "1" -a "$PWD" != "$HOME" ] && paths="$paths|$PWD" - - [ -z "${paths##\|}" ] && return # stop if we have nothing to add - - # maintain the file - local tempfile - tempfile="$(mktemp "$_FASD_DATA".XXXXXX)" || return - $_FASD_AWK -v list="$paths" -v now="$(date +%s)" -v max="$_FASD_MAX" -F"|" ' - BEGIN { - split(list, files, "|") - for(i in files) { - path = files[i] - if(path == "") continue - paths[path] = path # array for checking - rank[path] = 1 - time[path] = now - } - } - $2 >= 1 { - if($1 in paths) { - rank[$1] = $2 + 1 / $2 - time[$1] = now - } else { - rank[$1] = $2 - time[$1] = $3 - } - count += $2 - } - END { - if(count > max) - for(i in rank) print i "|" 0.9*rank[i] "|" time[i] # aging - else - for(i in rank) print i "|" rank[i] "|" time[i] - }' "$_FASD_DATA" 2>> "$_FASD_SINK" >| "$tempfile" - if [ $? -ne 0 -a -f "$_FASD_DATA" ]; then - env rm -f "$tempfile" - else - env mv -f "$tempfile" "$_FASD_DATA" - fi - ;; - - --delete|-D) shift # delete entries - # stop if we don't own $_FASD_DATA or $_FASD_RO is set - [ -f "$_FASD_DATA" -a ! -O "$_FASD_DATA" ] || [ "$_FASD_RO" ] && return - - # turn valid arguments into entry-deleting sed commands - local sed_cmd="$(while [ "$1" ]; do printf %s\\n "$1"; shift; done | \ - sed '/^[^/]/s@^@'"$PWD"'/@;s@/\.\.$@/../@;s@/\(\./\)\{1,\}@/@g;:0 - s@[^/][^/]*//*\.\./@/@;t 0 - s@^/*\.\./@/@;s@//*@/@g;s@/\.\{0,1\}$@@ - s@^$@/@;s@\([.[\/*^$]\)@\\\1@g;s@^\(.*\)$@/^\1|/d@' 2>> "$_FASD_SINK")" - - # maintain the file - local tempfile - tempfile="$(mktemp "$_FASD_DATA".XXXXXX)" || return - - sed "$sed_cmd" "$_FASD_DATA" 2>> "$_FASD_SINK" >| "$tempfile" - - if [ $? -ne 0 -a -f "$_FASD_DATA" ]; then - env rm -f "$tempfile" - else - env mv -f "$tempfile" "$_FASD_DATA" - fi - ;; - - --query) shift # query the db, --query [$typ ["$fnd" [$mode]]] - [ -f "$_FASD_DATA" ] || return # no db yet - [ "$1" ] && local typ="$1" - [ "$2" ] && local fnd="$2" - [ "$3" ] && local mode="$3" - - # cat all backends - local each _fasd_data; for each in $_FASD_BACKENDS; do - _fasd_data="$_fasd_data -$(fasd --backend $each)" - done - [ "$_fasd_data" ] || _fasd_data="$(cat "$_FASD_DATA")" - - # set mode specific code for calculating the prior - case $mode in - rank) local prior='times[i]';; - recent) local prior='sqrt(100000/(1+t-la[i]))';; - *) local prior='times[i] * frecent(la[i])';; - esac - - if [ "$fnd" ]; then # dafault matching - local bre="$(printf %s\\n "$fnd" | sed 's/\([*\.\\\[]\)/\\\1/g - s@ @[^|]*@g;s/\$$/|/')" - bre='^[^|]*'"$bre"'[^|/]*|' - local _ret="$(printf %s\\n "$_fasd_data" | grep "$bre")" - [ "$_ret" ] && _ret="$(printf %s\\n "$_ret" | while read -r line; do - [ -${typ:-e} "${line%%\|*}" ] && printf %s\\n "$line" - done)" - if [ "$_ret" ]; then - _fasd_data="$_ret" - else # no case mathcing - _ret="$(printf %s\\n "$_fasd_data" | grep -i "$bre")" - [ "$_ret" ] && _ret="$(printf %s\\n "$_ret" | while read -r line; do - [ -${typ:-e} "${line%%\|*}" ] && printf %s\\n "$line" - done)" - if [ "$_ret" ]; then - _fasd_data="$_ret" - elif [ "${_FASD_FUZZY:-0}" -gt 0 ]; then # fuzzy matching - local fuzzy_bre="$(printf %s\\n "$fnd" | \ - sed 's/\([*\.\\\[]\)/\\\1/g;s/\$$/|/ - s@\(\\\{0,1\}[^ ]\)@\1[^|/]\\{0,'"$_FASD_FUZZY"'\\}@g - s@ @[^|]*@g')" - fuzzy_bre='^[^|]*'"$fuzzy_bre"'[^|/]*|' - _ret="$(printf %s\\n "$_fasd_data" | grep -i "$fuzzy_bre")" - [ "$_ret" ] && _ret="$(printf %s\\n "$_ret" | while read -r line; do - [ -${typ:-e} "${line%%\|*}" ] && printf %s\\n "$line" - done)" - [ "$_ret" ] && _fasd_data="$_ret" || _fasd_data= - fi - fi - else # no query arugments - _fasd_data="$(printf %s\\n "$_fasd_data" | while read -r line; do - [ -${typ:-e} "${line%%\|*}" ] && printf %s\\n "$line" - done)" - fi - - # query the database - [ "$_fasd_data" ] && printf %s\\n "$_fasd_data" | \ - $_FASD_AWK -v t="$(date +%s)" -F"|" ' - function frecent(time) { - dx = t-time - if( dx < 3600 ) return 6 - if( dx < 86400 ) return 4 - if( dx < 604800 ) return 2 - return 1 - } - { - if(!paths[$1]) { - times[$1] = $2 - la[$1] = $3 - paths[$1] = 1 - } else { - times[$1] += $2 - if($3 > la[$1]) la[$1] = $3 - } - } - END { - for(i in paths) printf "%-10s %s\n", '"$prior"', i - }' - 2>> "$_FASD_SINK" - ;; - - --backend) - case $2 in - native) cat "$_FASD_DATA";; - viminfo) - < "$_FASD_VIMINFO" sed -n '/^>/{s@~@'"$HOME"'@ - s/^..// - p - }' | $_FASD_AWK -v t="$(date +%s)" '{ - t -= 60 - print $0 "|1|" t - }' - ;; - recently-used) - local nl="$(printf '\\\nX')"; nl="${nl%X}" # slash newline for sed - tr -d '\n' < "$_FASD_RECENTLY_USED_XBEL" | \ - sed 's@file:/@'"$nl"'@g;s@count="@'"$nl"'@g' | sed '1d;s/".*$//' | \ - tr '\n' '|' | sed 's@|/@'"$nl"'@g' | $_FASD_AWK -F'|' '{ - sum = 0 - for( i=2; i<=NF; i++ ) sum += $i - print $1 "|" sum - }' - ;; - *) eval "$2";; - esac - ;; - - *) # parsing logic and processing - local fnd= last= _FASD_BACKENDS="$_FASD_BACKENDS" _fasd_data= comp= exec= - while [ "$1" ]; do case $1 in - --complete) [ "$2" = "--" ] && shift; set -- $2; local lst=1 r=r comp=1;; - --query|--add|--delete|-A|-D) fasd "$@"; return $?;; - --version) [ -z "$comp" ] && echo "1.0.1" && return;; - --) while [ "$2" ]; do shift; fnd="$fnd $1"; last="$1"; done;; - -*) local o="${1#-}"; while [ "$o" ]; do case $o in - s*) local show=1;; - l*) local lst=1;; - i*) [ -z "$comp" ] && local interactive=1 show=1;; - r*) local mode=rank;; - t*) local mode=recent;; - e*) o="${o#?}"; if [ "$o" ]; then # there are characters after "-e" - local exec="$o" # anything after "-e" - else # use the next argument - local exec="${2:?"-e: Argument needed "}" - shift - fi; break;; - b*) o="${o#?}"; if [ "$o" ]; then - _FASD_BACKENDS="$o" - else - _FASD_BACKENDS="${2:?"-b: Argument needed"}" - shift - fi; break;; - B*) o="${o#?}"; if [ "$o" ]; then - _FASD_BACKENDS="$_FASD_BACKENDS $o" - else - _FASD_BACKENDS="$_FASD_BACKENDS ${2:?"-B: Argument needed"}" - shift - fi; break;; - a*) local typ=e;; - d*) local typ=d;; - f*) local typ=f;; - R*) local r=r;; - [0-9]*) local _fasd_i="$o"; break;; - h*) [ -z "$comp" ] && echo "fasd [options] [query ...] -[f|a|s|d|z] [options] [query ...] - options: - -s list paths with scores - -l list paths without scores - -i interactive mode - -e set command to execute on the result file - -b only use backend - -B add additional backend - -a match files and directories - -d match directories only - -f match files only - -r match by rank only - -t match by recent access only - -R reverse listing order - -h show a brief help message - -[0-9] select the nth entry - -fasd [-A|-D] [paths ...] - -A add paths - -D delete paths" >&2 && return;; - esac; o="${o#?}"; done;; - *) fnd="$fnd $1"; last="$1";; - esac; shift; done - - # guess whether the last query is selected from tab completion - case $last in - /?*) if [ -z "$show$lst" -a -${typ:-e} "$last" -a "$exec" ]; then - $exec "$last" - return - fi;; - esac - - local R; [ -z "$r" ] && R=r || R= # let $R be the opposite of $r - fnd="${fnd# }" - - local res - res="$(fasd --query 2>> "$_FASD_SINK")" # query the database - [ $? -gt 0 ] && return - if [ 0 -lt ${_fasd_i:-0} ] 2>> "$_FASD_SINK"; then - res="$(printf %s\\n "$res" | sort -n${R} | \ - sed -n "$_fasd_i"'s/^[^ ]*[ ]*//p')" - elif [ "$interactive" ] || [ "$exec" -a -z "$fnd$lst$show" -a -t 1 ]; then - if [ "$(printf %s "$res" | sed -n '$=')" -gt 1 ]; then - res="$(printf %s\\n "$res" | sort -n${R})" - printf %s\\n "$res" | sed = | sed 'N;s/\n/ /' | sort -nr >&2 - printf "> " >&2 - local i; read i; [ 0 -lt "${i:-0}" ] 2>> "$_FASD_SINK" || return 1 - fi - res="$(printf %s\\n "$res" | sed -n "${i:-1}"'s/^[^ ]*[ ]*//p')" - elif [ "$lst" ]; then - [ "$res" ] && printf %s\\n "$res" | sort -n${r} | sed 's/^[^ ]*[ ]*//' - return - elif [ "$show" ]; then - [ "$res" ] && printf %s\\n "$res" | sort -n${r} - return - elif [ "$fnd" ] && [ "$exec" -o ! -t 1 ]; then # exec or subshell - res="$(printf %s\\n "$res" | sort -n | sed -n '$s/^[^ ]*[ ]*//p')" - else # no args, show - [ "$res" ] && printf %s\\n "$res" | sort -n${r} - return - fi - if [ "$res" ]; then - fasd --add "$res" - [ -z "$exec" ] && exec='printf %s\n' - $exec "$res" - fi - ;; - esac -} - -fasd --init env - -case $- in - *i*) ;; # assume being sourced, do nothing - *) # assume being executed as an executable - if [ -x "$_FASD_SHELL" -a -z "$_FASD_SET" ]; then - _FASD_SET=1 exec $_FASD_SHELL "$0" "$@" - else - fasd "$@" - fi;; -esac - -- cgit 1.4.1 From 2f341cd1fad7d855a2b6d4faa9025e0aaf08314c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Apr 2014 18:21:50 +0100 Subject: zsh: Create dotfile links under $ZDOTDIR For some reason, zsh expects files under $ZDOTDIR to be dotfiles, unlike many other programs. --- hooks/post-up/zsh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hooks/post-up/zsh b/hooks/post-up/zsh index b31a8cb4..7ed08de4 100755 --- a/hooks/post-up/zsh +++ b/hooks/post-up/zsh @@ -1,6 +1,13 @@ #!/usr/bin/env zsh ZDOTDIR="${XDG_CONFIG_HOME:~/.config}/zsh" +pushd $ZDOTDIR +for f in z*(-.) +do + [[ -e .$f ]] || ln $f .$f +done +popd + if [[ ! -d ~/.cache/zsh ]] then mkdir -p ~/.cache/zsh -- cgit 1.4.1 From d822d1211c7b6beb4b29277a28d47fade2825c94 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Apr 2014 18:25:11 +0100 Subject: zsh: Use (and set) XDG_CONFIG_HOME for $ZDOTDIR --- tag-zsh/zshenv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zsh/zshenv b/tag-zsh/zshenv index 48b93e17..354c54da 100644 --- a/tag-zsh/zshenv +++ b/tag-zsh/zshenv @@ -1,3 +1,3 @@ -ZDOTDIR="$HOME/.config/zsh" +ZDOTDIR="${XDG_CONFIG_HOME:=$HOME/.config}/zsh" source "$ZDOTDIR"/.zshenv -- cgit 1.4.1 From 88343c9a362f491f60adbb2e731c9cc0e6995940 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Apr 2014 18:27:16 +0100 Subject: zsh: Use $ZDOTDIR instead of hardcoded path --- tag-zsh/config/zsh/zshenv | 4 ++-- tag-zsh/config/zsh/zshrc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index 11932e6e..c4b3b9c6 100755 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -16,10 +16,10 @@ fi export PATH -myfuncs=( ~/projects/dotfiles/zsh/functions/*(/) ) +myfuncs=( $ZDOTDIR/functions/*(/) ) fpath=( $myfuncs - ~/projects/dotfiles/zsh/completion/ + $ZDOTDIR/completion/ $fpath ) if [[ -d /usr/local/share/zsh-completions ]] diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 365214c9..d183baa2 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -358,5 +358,5 @@ autoload -U fasd source ~/.zsh/cache/fasd-init-zsh if [[ $OSTYPE == freebsd* ]]; then - source ~/projects/dotfiles/zsh/freebsd.zsh + source $ZDOTDIR/freebsd.zsh fi -- cgit 1.4.1 From 9860aaeff1ca330d2c4e375c8da5f246a82aa80e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Apr 2014 18:28:53 +0100 Subject: Rename launchagents folder --- LaunchAgents/gnu.emacs.daemon.plist | 19 +++++++++++++++++++ launchagents/gnu.emacs.daemon.plist | 19 ------------------- 2 files changed, 19 insertions(+), 19 deletions(-) create mode 100644 LaunchAgents/gnu.emacs.daemon.plist delete mode 100644 launchagents/gnu.emacs.daemon.plist diff --git a/LaunchAgents/gnu.emacs.daemon.plist b/LaunchAgents/gnu.emacs.daemon.plist new file mode 100644 index 00000000..ecce7db7 --- /dev/null +++ b/LaunchAgents/gnu.emacs.daemon.plist @@ -0,0 +1,19 @@ + + + + + ServiceDescription + Gnu Emacs Daemon + ProgramArguments + + /Applications/Emacs.app/Contents/MacOS/Emacs + --daemon + + RunAtLoad + + WorkingDirectory + /Users/alan + Label + gnu.emacs.daemon + + diff --git a/launchagents/gnu.emacs.daemon.plist b/launchagents/gnu.emacs.daemon.plist deleted file mode 100644 index ecce7db7..00000000 --- a/launchagents/gnu.emacs.daemon.plist +++ /dev/null @@ -1,19 +0,0 @@ - - - - - ServiceDescription - Gnu Emacs Daemon - ProgramArguments - - /Applications/Emacs.app/Contents/MacOS/Emacs - --daemon - - RunAtLoad - - WorkingDirectory - /Users/alan - Label - gnu.emacs.daemon - - -- cgit 1.4.1 From ef5f08a26dc2fa6dcac05ea5d1cd420d85dec6a7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Apr 2014 18:29:28 +0100 Subject: Add rcrc file for excludes --- rcrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 rcrc diff --git a/rcrc b/rcrc new file mode 100644 index 00000000..11fbf1c2 --- /dev/null +++ b/rcrc @@ -0,0 +1 @@ +EXCLUDES="Brewfile LaunchAgents" -- cgit 1.4.1 From ca0e9f1650c255885009aaeb7a9bbd2c08b93965 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Apr 2014 18:29:39 +0100 Subject: rcrc: test and source rcrc.local --- rcrc | 1 + 1 file changed, 1 insertion(+) diff --git a/rcrc b/rcrc index 11fbf1c2..ffcf3a07 100644 --- a/rcrc +++ b/rcrc @@ -1 +1,2 @@ EXCLUDES="Brewfile LaunchAgents" +[[ -e ~/.rcrc.local ]] && source ~/.rcrc.local \ No newline at end of file -- cgit 1.4.1 From 365bf38e9a14b612c3d0e1429aa3fde96f4f62f8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Apr 2014 18:51:20 +0100 Subject: zsh: Remove unused parts of server host config --- tag-zsh/config/zsh/server.zsh | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/tag-zsh/config/zsh/server.zsh b/tag-zsh/config/zsh/server.zsh index d9d74219..f9274c71 100644 --- a/tag-zsh/config/zsh/server.zsh +++ b/tag-zsh/config/zsh/server.zsh @@ -1,20 +1,5 @@ # -*- shell-script -*- -export SVDIR=/service -if [[ "$EUID" == "0" ]] || [[ "$USER" == "root" ]] -then - export EDITOR="emacs -nw" -else - export ALTERNATE_EDITOR="emacs" - export EDITOR="emacsclient" -fi - -mailpath= - -# Folder aliases -hash -d music=/tank/media/Music - zstyle ':completion:*' local server /tank/www/internal '' zstyle ':completion:*' local external /tank/www/external -zstyle ':completion:*' local alphapulsar.uk.to /tank/www/gaming zstyle ':completion:*' local home.alanpearce.co.uk /tank/www/external -- cgit 1.4.1 From 57508b50ff7760eb3afbc18e30324c3bde508dc3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Apr 2014 18:52:25 +0100 Subject: zsh: Remove host configuration for prefect --- tag-zsh/config/zsh/prefect.zsh | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 tag-zsh/config/zsh/prefect.zsh diff --git a/tag-zsh/config/zsh/prefect.zsh b/tag-zsh/config/zsh/prefect.zsh deleted file mode 100644 index 997ba391..00000000 --- a/tag-zsh/config/zsh/prefect.zsh +++ /dev/null @@ -1,10 +0,0 @@ -EDITOR="emacs" -VISUAL="emacs" - -if [[ ! -S $SSH_AUTH_SOCK ]] -then - eval `ssh-agent | sed -e '/^echo/d'` - linkAuthSock $SSH_AUTH_SOCK -fi - -export WINEARCH="win32" \ No newline at end of file -- cgit 1.4.1 From 867aa46e6bd6110b0b5934fe7735ddefd1fa8d12 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Apr 2014 18:58:43 +0100 Subject: Add modelines for zsh files --- tag-zsh/config/zsh/zshenv | 1 + tag-zsh/config/zsh/zshrc | 1 + 2 files changed, 2 insertions(+) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index c4b3b9c6..0cc65be4 100755 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -1,3 +1,4 @@ +# -*- mode: sh; -*- if [[ $defpath == "" && -d ~/bin ]] then defpath=($path) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index d183baa2..97d31bef 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -1,3 +1,4 @@ +# -*- mode: sh; -*- export PAGER="less" export EDITOR="emacsclient" export CLICOLOR=true -- cgit 1.4.1 From 6d74184bf553bcedc554c37410e5f8c0bf76510e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Apr 2014 19:36:45 +0100 Subject: Add readme --- README.org | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 README.org diff --git a/README.org b/README.org new file mode 100644 index 00000000..b6c5c092 --- /dev/null +++ b/README.org @@ -0,0 +1,8 @@ +* Dotfiles + +I've organised this repository with [[https://github.com/thoughtbot/rcm][rcm]], using tag- and +host-specific directories. It focuses on zsh and emacs, with some +functions to go from zsh to emacs (and directly to dired and magit). +It doesn't use any configuration frameworks. + +Most likely to work on Linux, OSX and FreeBSD. -- cgit 1.4.1 From 84a8dcddbb59c66b1f9d6c68f0612f41a034618d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Apr 2014 19:38:14 +0100 Subject: rcm: Exclude readme --- rcrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rcrc b/rcrc index ffcf3a07..6401329a 100644 --- a/rcrc +++ b/rcrc @@ -1,2 +1,2 @@ -EXCLUDES="Brewfile LaunchAgents" +EXCLUDES="Brewfile LaunchAgents README.org" [[ -e ~/.rcrc.local ]] && source ~/.rcrc.local \ No newline at end of file -- cgit 1.4.1 From 92192895ef1305f17cfd8206539f3662b4340944 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 13 Apr 2014 09:27:36 +0100 Subject: Fix syntax error in zsh post-up hook --- hooks/post-up/zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/post-up/zsh b/hooks/post-up/zsh index 7ed08de4..085240df 100755 --- a/hooks/post-up/zsh +++ b/hooks/post-up/zsh @@ -1,5 +1,5 @@ #!/usr/bin/env zsh -ZDOTDIR="${XDG_CONFIG_HOME:~/.config}/zsh" +ZDOTDIR="${XDG_CONFIG_HOME:=~/.config}/zsh" pushd $ZDOTDIR for f in z*(-.) -- cgit 1.4.1 From beee827fe22e139b7ce0df571483cbac4000d06a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 13 Apr 2014 09:28:28 +0100 Subject: zsh: Change cache directory for zcompdump --- tag-zsh/config/zsh/zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 97d31bef..25bc5afd 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -60,7 +60,7 @@ autoload insert-files zle -N insert-files zmodload -i zsh/complist colors -compinit -u -d .zsh/cache/compdump +compinit -u -d .cache/zsh/compdump bashcompinit zstyle :compinstall filename '~/.zshrc' -- cgit 1.4.1 From 5c295825a01ad0d2286d28619fc763668e3caee2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 13 Apr 2014 09:29:51 +0100 Subject: zsh: Remove fasd autoload --- tag-zsh/config/zsh/zshrc | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 25bc5afd..cd92d245 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -355,7 +355,6 @@ ec () { } _FASD_DATA="$HOME/.zsh/fasd-data" -autoload -U fasd source ~/.zsh/cache/fasd-init-zsh if [[ $OSTYPE == freebsd* ]]; then -- cgit 1.4.1 From b4f919d6b8969113181955cacb3c2e7bf14af67d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 13 Apr 2014 09:38:07 +0100 Subject: zsh: Update fasd init file location --- tag-zsh/config/zsh/zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index cd92d245..6535e0f2 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -355,7 +355,7 @@ ec () { } _FASD_DATA="$HOME/.zsh/fasd-data" -source ~/.zsh/cache/fasd-init-zsh +source ~/.cache/zsh/fasd-init-zsh if [[ $OSTYPE == freebsd* ]]; then source $ZDOTDIR/freebsd.zsh -- cgit 1.4.1 From 414852c9e8fb99bb5ae79401f0e746aacbb3c11c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 13 Apr 2014 09:38:30 +0100 Subject: Update and migrate fasd data file location --- hooks/post-up/zsh | 2 ++ tag-zsh/config/zsh/zshrc | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hooks/post-up/zsh b/hooks/post-up/zsh index 085240df..e69362b4 100755 --- a/hooks/post-up/zsh +++ b/hooks/post-up/zsh @@ -38,3 +38,5 @@ zrecompile -p -R $ZDOTDIR/.zshrc.zwc $zfiles -- \ for fp in $ZDOTDIR/functions/*(/); do zrecompile -p $fp $fp/* done + +[[ -f ~/.zsh/fasd-data ]] && mv ~/.zsh/fasd-data ~/.cache/zsh/fasd-data diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 6535e0f2..eff40399 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -354,7 +354,7 @@ ec () { fi } -_FASD_DATA="$HOME/.zsh/fasd-data" +_FASD_DATA="$HOME/.cache/zsh/fasd-data" source ~/.cache/zsh/fasd-init-zsh if [[ $OSTYPE == freebsd* ]]; then -- cgit 1.4.1 From ee6d56fdaba008f2b16afdbd400021afa6231b36 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 13 Apr 2014 09:39:33 +0100 Subject: Sakura: initial configuration --- tag-sakura/config/sakura/sakura.conf | 54 ++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 tag-sakura/config/sakura/sakura.conf diff --git a/tag-sakura/config/sakura/sakura.conf b/tag-sakura/config/sakura/sakura.conf new file mode 100644 index 00000000..6f1c643e --- /dev/null +++ b/tag-sakura/config/sakura/sakura.conf @@ -0,0 +1,54 @@ +[sakura] +colorset1_fore=rgb(88,110,117) +colorset1_back=rgb(253,246,227) +colorset1_key=F1 +colorset2_fore=rgb(192,192,192) +colorset2_back=rgb(0,0,0) +colorset2_key=F2 +colorset3_fore=rgb(192,192,192) +colorset3_back=rgb(0,0,0) +colorset3_key=F3 +colorset4_fore=rgb(192,192,192) +colorset4_back=rgb(0,0,0) +colorset4_key=F4 +colorset5_fore=rgb(192,192,192) +colorset5_back=rgb(0,0,0) +colorset5_key=F5 +colorset6_fore=rgb(192,192,192) +colorset6_back=rgb(0,0,0) +colorset6_key=F6 +last_colorset=1 +background=none +font=Cousine 11 +show_always_first_tab=No +scrollbar=false +resize_grip=false +closebutton=true +tabs_on_bottom=false +less_questions=false +audible_bell=Yes +visible_bell=No +blinking_cursor=No +cursor_type=VTE_CURSOR_SHAPE_BLOCK +word_chars=-A-Za-z0-9,./?%&#_~ +palette=solarized_light +add_tab_accelerator=5 +del_tab_accelerator=5 +switch_tab_accelerator=4 +move_tab_accelerator=5 +copy_accelerator=5 +scrollbar_accelerator=5 +open_url_accelerator=5 +font_size_accelerator=4 +set_tab_name_accelerator=5 +add_tab_key=T +del_tab_key=W +prev_tab_key=Left +next_tab_key=Right +copy_key=C +paste_key=V +scrollbar_key=S +set_tab_name_key=N +fullscreen_key=F11 +set_colorset_accelerator=5 +icon_file=terminal-tango.svg -- cgit 1.4.1 From 53861212825c8cf6096a30e1d047931286e85846 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 13 Apr 2014 09:50:36 +0100 Subject: zsh: Compile fasd and use as a function. --- hooks/post-up/zsh | 10 ++++++++++ tag-zsh/config/zsh/zshrc | 1 + 2 files changed, 11 insertions(+) diff --git a/hooks/post-up/zsh b/hooks/post-up/zsh index e69362b4..05a72378 100755 --- a/hooks/post-up/zsh +++ b/hooks/post-up/zsh @@ -39,4 +39,14 @@ for fp in $ZDOTDIR/functions/*(/); do zrecompile -p $fp $fp/* done +if [[ -s $commands[fasd] ]]; then + if [[ ! -d $ZDOTDIR/functions/fasd ]]; then + mkdir $ZDOTDIR/functions/fasd + fi + if [[ ! -h $ZDOTDIR/functions/fasd/fasd ]]; then + ln -s =fasd $ZDOTDIR/functions/fasd/fasd + fi + zrecompile -p $ZDOTDIR/functions/fasd $ZDOTDIR/functions/fasd/fasd +fi + [[ -f ~/.zsh/fasd-data ]] && mv ~/.zsh/fasd-data ~/.cache/zsh/fasd-data diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index eff40399..40af65cf 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -355,6 +355,7 @@ ec () { } _FASD_DATA="$HOME/.cache/zsh/fasd-data" +autoload -U fasd source ~/.cache/zsh/fasd-init-zsh if [[ $OSTYPE == freebsd* ]]; then -- cgit 1.4.1 From 606c29d286a3da41da310faaa008d1a0280decd7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 13 Apr 2014 09:54:37 +0100 Subject: zsh: Simplify fasd compilation --- hooks/post-up/zsh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hooks/post-up/zsh b/hooks/post-up/zsh index 05a72378..1db24bfa 100755 --- a/hooks/post-up/zsh +++ b/hooks/post-up/zsh @@ -35,10 +35,6 @@ fi zrecompile -p -R $ZDOTDIR/.zshrc.zwc $zfiles -- \ -M .cache/zsh/compdump -for fp in $ZDOTDIR/functions/*(/); do - zrecompile -p $fp $fp/* -done - if [[ -s $commands[fasd] ]]; then if [[ ! -d $ZDOTDIR/functions/fasd ]]; then mkdir $ZDOTDIR/functions/fasd @@ -46,7 +42,10 @@ if [[ -s $commands[fasd] ]]; then if [[ ! -h $ZDOTDIR/functions/fasd/fasd ]]; then ln -s =fasd $ZDOTDIR/functions/fasd/fasd fi - zrecompile -p $ZDOTDIR/functions/fasd $ZDOTDIR/functions/fasd/fasd fi +for fp in $ZDOTDIR/functions/*(/); do + zrecompile -p $fp $fp/* +done + [[ -f ~/.zsh/fasd-data ]] && mv ~/.zsh/fasd-data ~/.cache/zsh/fasd-data -- cgit 1.4.1 From ad529fd05f192d37299a5e8d009baa5d16da30bb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 13 Apr 2014 10:04:03 +0100 Subject: Update and migrate zsh history file location --- hooks/post-up/zsh | 1 + tag-zsh/config/zsh/zshrc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hooks/post-up/zsh b/hooks/post-up/zsh index 1db24bfa..2d94d49a 100755 --- a/hooks/post-up/zsh +++ b/hooks/post-up/zsh @@ -49,3 +49,4 @@ for fp in $ZDOTDIR/functions/*(/); do done [[ -f ~/.zsh/fasd-data ]] && mv ~/.zsh/fasd-data ~/.cache/zsh/fasd-data +[[ -f ~/.zsh/history ]] && mv ~/.zsh/history ~/.cache/zsh/history diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 40af65cf..ce4b91f8 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -6,7 +6,7 @@ export CLICOLOR=true # # zsh variables # -HISTFILE=~/.zsh/history +HISTFILE=~/.cache/zsh/history HISTSIZE=4000 SAVEHIST=3000 -- cgit 1.4.1 From 44cfeceab6b1dde2d1e2887131a747e7ae6e30a2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 13 Apr 2014 12:00:37 +0100 Subject: zsh: Create compdump file before compiling it --- hooks/post-up/zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hooks/post-up/zsh b/hooks/post-up/zsh index 2d94d49a..e3c733ad 100755 --- a/hooks/post-up/zsh +++ b/hooks/post-up/zsh @@ -32,6 +32,8 @@ if [[ $OSTYPE == freebsd* ]]; then zfiles+=$ZDOTDIR/freebsd.zsh fi +autoload -Uz compinit +compinit -u -d .cache/zsh/compdump zrecompile -p -R $ZDOTDIR/.zshrc.zwc $zfiles -- \ -M .cache/zsh/compdump -- cgit 1.4.1 From 4b7fe9e0ad192e3959a9fccb4c5be45123259bea Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 13 Apr 2014 12:06:08 +0100 Subject: Create emacs pre-hook to remove old elisp symlink --- hooks/pre-up/emacs | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 hooks/pre-up/emacs diff --git a/hooks/pre-up/emacs b/hooks/pre-up/emacs new file mode 100755 index 00000000..01ca2793 --- /dev/null +++ b/hooks/pre-up/emacs @@ -0,0 +1,8 @@ +#!/usr/bin/env zsh + +# Remove broken elisp symlink from old versions +elisp="$HOME/.emacs.d/elisp" +if [[ -L "$elisp" && ! -e "$elisp" ]] +then + rm $elisp +fi -- cgit 1.4.1 From 456401f28bb595617eb462e9d1c6d71d28f1f038 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 13 Apr 2014 20:32:47 +0100 Subject: Emacs: Cleanup cask file --- tag-emacs/emacs.d/Cask | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 8742df0f..0c0865be 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -12,9 +12,6 @@ (depends-on "cask") (depends-on "cdnjs") (depends-on "company") -(depends-on "confluence") -(depends-on "control-mode") -(depends-on "dash") (depends-on "dash-at-point") (depends-on "deferred") (depends-on "diff-hl") @@ -22,17 +19,11 @@ (depends-on "dired+") (depends-on "discover") (depends-on "emmet-mode") -(depends-on "epl") (depends-on "expand-region") -(depends-on "f") -(depends-on "flx") (depends-on "flx-ido") (depends-on "framemove") (depends-on "geiser") (depends-on "ggtags") -(depends-on "git-commit-mode") -(depends-on "git-rebase-mode") -(depends-on "god-mode") (depends-on "haskell-mode") (depends-on "helm") (depends-on "ido-vertical-mode") @@ -40,27 +31,22 @@ (depends-on "js2-mode") (depends-on "lua-mode") (depends-on "magit") -(depends-on "makey") (depends-on "multi-term") (depends-on "multiple-cursors") (depends-on "mustache-mode") (depends-on "nginx-mode") -(depends-on "org-jira") (depends-on "org-journal") (depends-on "org-plus-contrib") -(depends-on "packed") (depends-on "pallet") (depends-on "paredit") (depends-on "php-extras") (depends-on "php-mode") -(depends-on "pkg-info") (depends-on "project-persist") (depends-on "projectile") (depends-on "puppet-mode") (depends-on "quickrun") (depends-on "redshank") (depends-on "s") -(depends-on "simple-httpd") (depends-on "skewer-mode") (depends-on "smart-tab") (depends-on "smart-tabs-mode") @@ -70,5 +56,4 @@ (depends-on "undo-tree") (depends-on "use-package") (depends-on "web-mode") -(depends-on "xml-rpc") (depends-on "yaml-mode") \ No newline at end of file -- cgit 1.4.1 From 30ba7c1a959052bdf6258fde2c401acd50bd14ac Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 13 Apr 2014 20:34:10 +0100 Subject: Emacs: Install visual-regexp. Move C-c r from org-mode, since I don't really use it. --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 0c0865be..425a6843 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -55,5 +55,6 @@ (depends-on "tup-mode") (depends-on "undo-tree") (depends-on "use-package") +(depends-on "visual-regexp") (depends-on "web-mode") (depends-on "yaml-mode") \ No newline at end of file diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 76505ad5..bee5c6ce 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -646,8 +646,7 @@ Values: `desktop', `server', `laptop'") (use-package org :bind (("C-c C-a" . org-agenda-list) ("C-c a" . org-agenda) - ("C-c l" . org-store-link) - ("C-c r" . org-remember)) + ("C-c l" . org-store-link)) :config (progn (setq org-directory "~/org" org-agenda-files `(,org-directory) @@ -966,6 +965,11 @@ Also returns nil if pid is nil." ad-do-it))) :diminish undo-tree-mode) +(use-package visual-regexp + :bind (("C-c r" . vr/replace) + ("C-c q" . vr/query-replace) + ("C-c m" . vc/mc-mark))) + ;;;; Lisps (defun ap/lisp-setup () -- cgit 1.4.1 From a60928ab0efec0995f6b0fe4774e59c160b555d4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 13 Apr 2014 20:37:54 +0100 Subject: Emacs: ensure that pallet is loaded on init --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index bee5c6ce..655cc595 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -82,6 +82,7 @@ Values: `desktop', `server', `laptop'") use-package)))) (require 'use-package) +(use-package pallet) ;;;; Style -- cgit 1.4.1 From 3c256c0655666bbbcda6f495f0c348312efa79b0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 13 Apr 2014 20:43:43 +0100 Subject: Emacs: use discover-mode for keybind popups --- tag-emacs/emacs.d/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 655cc595..2cc80318 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -528,6 +528,9 @@ Values: `desktop', `server', `laptop'") (set-register ?e `(file . ,*init-file*)) (set-register ?z `(file . ,(expand-file-name ".zshrc" "~"))) +(use-package discover + :config (global-discover-mode)) + ;; Enable narrowing functions C-x n (put 'narrow-to-defun 'disabled nil) (put 'narrow-to-page 'disabled nil) -- cgit 1.4.1 From a6b25f53ecb085efa679e15f620f4c212402480b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 13 Apr 2014 20:55:50 +0100 Subject: Emacs: init projectile-mode on startup --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 2cc80318..1c59589b 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -720,7 +720,7 @@ Values: `desktop', `server', `laptop'") (use-package projectile :bind (("C-c C-f" . projectile-find-file) ("s-x s-f" . projectile-find-file)) - :commands (projectile-global-mode)) + :init (projectile-global-mode) (use-package project-persist :commands (project-persist-mode) -- cgit 1.4.1 From 5e1656ec57ef7dbbd69d060fd6fb78d174a170e0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 13 Apr 2014 20:56:09 +0100 Subject: Emacs: add projectile switch-project config --- tag-emacs/emacs.d/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 1c59589b..961c7099 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -721,6 +721,9 @@ Values: `desktop', `server', `laptop'") :bind (("C-c C-f" . projectile-find-file) ("s-x s-f" . projectile-find-file)) :init (projectile-global-mode) + :config (progn + (setq projectile-switch-project-action #'projectile-dired + projectile-remember-window-configs t))) (use-package project-persist :commands (project-persist-mode) -- cgit 1.4.1 From 560868dbb5e7d19d166bab4da1d0221adba887bb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 13 Apr 2014 21:08:20 +0100 Subject: Emacs: remove project-persist mode I didn't use it, and projectile can switch projects on its own now. --- tag-emacs/emacs.d/Cask | 1 - tag-emacs/emacs.d/init.el | 66 ----------------------------------------------- 2 files changed, 67 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 425a6843..78bdeb29 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -41,7 +41,6 @@ (depends-on "paredit") (depends-on "php-extras") (depends-on "php-mode") -(depends-on "project-persist") (depends-on "projectile") (depends-on "puppet-mode") (depends-on "quickrun") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 961c7099..cf8fb513 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -725,72 +725,6 @@ Values: `desktop', `server', `laptop'") (setq projectile-switch-project-action #'projectile-dired projectile-remember-window-configs t))) -(use-package project-persist - :commands (project-persist-mode) - :bind (("C-c P d" . project-persist-delete) - ("C-c P f" . project-persist-find) - ("C-c P k" . project-persist-close) - ("C-c P n" . project-persist-create) - ("C-c P s" . project-persist-save)) - :init (eval-when-compile - (autoload #'pp/settings-get "project-persist")) - :config (progn - (project-persist-mode t) - - (setq project-persist-auto-save-global t) - - (add-hook 'project-persist-before-load-hook #'kill-all-buffers) - - (defun emacs-process-p (pid) - "If pid is the process ID of an emacs process, return t, else nil. -Also returns nil if pid is nil." - (when pid - (let ((attributes (process-attributes pid)) (cmd)) - (dolist (attr attributes) - (if (string= "comm" (car attr)) - (setq cmd (cdr attr)))) - (if (and cmd (or (string= "emacs" cmd) (string= "emacs.exe" cmd))) t)))) - - (defadvice desktop-owner (after pry-from-cold-dead-hands activate) - "Don't allow dead emacsen to own the desktop file." - (when (not (emacs-process-p ad-return-value)) - (setq ad-return-value nil))) - - (defun load-project-desktop () - "Load the project's desktop if available" - (ignore-errors - (let ((default-directory project-persist-current-project-settings-dir)) - (desktop-read)))) - - (defun kill-all-buffers () - "Kill all file-based buffers." - (interactive) - (mapc (lambda (buf) - (when (buffer-file-name buf) - (when (and (buffer-modified-p buf) - (y-or-n-p (format "Buffer %s is modified - save it?" (buffer-name buf)))) - (save-some-buffers nil buf)) - (set-buffer-modified-p nil) - (kill-buffer buf))) - (buffer-list))) - - (add-hook 'project-persist-after-close-hook - (lambda () - (kill-all-buffers) - (projectile-global-mode -1))) - - (add-hook 'project-persist-after-load-hook - (lambda () - (setq default-directory (pp/settings-get 'root-dir)) - (load-project-desktop) - (projectile-global-mode 1))) - - (add-hook 'project-persist-after-save-hook - (lambda () - (message (format "Saving project desktop (%s)" project-persist-current-project-settings-dir)) - (desktop-save project-persist-current-project-settings-dir))) -)) - (use-package vc :config (progn (setq vc-follow-symlinks t))) -- cgit 1.4.1 From 31511a9c2284f7394b60e56bbf4389a69bce535c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 13 Apr 2014 21:28:02 +0100 Subject: rcm: Run `cask install` for emacs, if installed --- hooks/post-up/emacs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hooks/post-up/emacs b/hooks/post-up/emacs index f6071b7d..6b04ae06 100755 --- a/hooks/post-up/emacs +++ b/hooks/post-up/emacs @@ -2,5 +2,11 @@ if [[ -s $commands[emacs] ]] then + if [[ -s $commands[cask] ]] + then + pushd ~/.emacs.d + cask install + popd + fi emacs --batch --eval '(batch-byte-recompile-directory 0)' ~/.emacs.d/ fi -- cgit 1.4.1 From 57ea988a47ecb93fed90dd15a938d29255639af2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 13 Apr 2014 21:42:39 +0100 Subject: Emacs: sort cask sources --- tag-emacs/emacs.d/Cask | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 78bdeb29..e3e132cb 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -1,7 +1,7 @@ -(source org) -(source melpa) -(source marmalade) (source gnu) +(source marmalade) +(source melpa) +(source org) (depends-on "ace-jump-mode") (depends-on "ag") -- cgit 1.4.1 From 86f656ea85b7e1e94c9a82ec1da669f5fad8ba65 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 13 Apr 2014 21:46:43 +0100 Subject: Emacs: install and configure flycheck --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 3 +++ 2 files changed, 4 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index e3e132cb..9718e2dd 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -21,6 +21,7 @@ (depends-on "emmet-mode") (depends-on "expand-region") (depends-on "flx-ido") +(depends-on "flycheck") (depends-on "framemove") (depends-on "geiser") (depends-on "ggtags") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index cf8fb513..5094a606 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -715,6 +715,9 @@ Values: `desktop', `server', `laptop'") (global-semantic-show-unmatched-syntax-mode t) (global-semantic-decoration-mode t))) +(use-package flycheck + :init (global-flycheck-mode)) + ;;;; Projects (use-package projectile -- cgit 1.4.1 From 85e52fb2ea3dbf0f8ee7f86027ed5bf0854905be Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 14 Apr 2014 07:52:58 +0100 Subject: Use correct path for zsh compdump in post-up hook --- hooks/post-up/zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hooks/post-up/zsh b/hooks/post-up/zsh index e3c733ad..dda5ec9b 100755 --- a/hooks/post-up/zsh +++ b/hooks/post-up/zsh @@ -33,9 +33,9 @@ if [[ $OSTYPE == freebsd* ]]; then fi autoload -Uz compinit -compinit -u -d .cache/zsh/compdump +compinit -u -d ~/.cache/zsh/compdump zrecompile -p -R $ZDOTDIR/.zshrc.zwc $zfiles -- \ - -M .cache/zsh/compdump + -M ~/.cache/zsh/compdump if [[ -s $commands[fasd] ]]; then if [[ ! -d $ZDOTDIR/functions/fasd ]]; then -- cgit 1.4.1 From 4709b9a1d642553278301801784b72c086e513c5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 14 Apr 2014 11:20:21 +0100 Subject: Git: fix global ignore path --- tag-git/config/git/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-git/config/git/config b/tag-git/config/git/config index fb728fff..2807b142 100644 --- a/tag-git/config/git/config +++ b/tag-git/config/git/config @@ -22,4 +22,4 @@ [diff] algorithm = patience [core] - excludesfile = ~/.config/git/global.gitignore + excludesfile = ~/.config/git/ignore -- cgit 1.4.1 From 57a8f58c4a2eb790eb5f37f059f27ce04a8a228d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 14 Apr 2014 12:42:06 +0100 Subject: Git: add local configuration include --- tag-git/config/git/config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-git/config/git/config b/tag-git/config/git/config index 2807b142..58255433 100644 --- a/tag-git/config/git/config +++ b/tag-git/config/git/config @@ -21,5 +21,7 @@ user = alan@alanpearce.co.uk [diff] algorithm = patience +[include] + path = config.local [core] excludesfile = ~/.config/git/ignore -- cgit 1.4.1 From dd6d8842f8cf99c01d8751e61c213c7d29709175 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 18 Apr 2014 12:37:22 +0100 Subject: Emacs: Use yaml-mode for sls files --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 5094a606..e87b1b17 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -641,7 +641,8 @@ Values: `desktop', `server', `laptop'") (use-package yaml-mode :mode (("/group_vars/.*" . yaml-mode) - ("/host_vars/.*" . yaml-mode)) + ("/host_vars/.*" . yaml-mode) + ("\\.sls\\'" . yaml-mode)) :config (progn (add-hook 'yaml-mode-hook #'autopair-mode))) -- cgit 1.4.1 From 96d7a8b9fe24e1e17b5a0f076458c5e30b59ad00 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 18 Apr 2014 12:39:11 +0100 Subject: Emacs: remove unused lacarte configuration --- tag-emacs/emacs.d/init.el | 3 --- 1 file changed, 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index e87b1b17..fb56f10a 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -545,9 +545,6 @@ Values: `desktop', `server', `laptop'") (defalias 'exit-emacs #'delete-frame) (defalias 'exit-emacs #'save-buffers-kill-emacs)) -(use-package lacarte - :bind (("M-`" . lacarte-execute-menu-command))) - (use-package helm-config :bind (("C-x i" . helm-imenu)) :config (setq helm-idle-delay .1 -- cgit 1.4.1 From 74d8e462f6c0e5d82511795322e993b54560788d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 18 Apr 2014 12:39:52 +0100 Subject: Emacs: use dired-x inside dired --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index fb56f10a..d2aedd92 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -348,6 +348,7 @@ Values: `desktop', `server', `laptop'") ;;;; Directory browsing (use-package dired :config (progn + (use-package dired-x) (bind-key "" #'dired-find-file dired-mode-map) (bind-key "^" (lambda () (interactive) (find-alternate-file "..")) dired-mode-map) (setq dired-dwim-target t -- cgit 1.4.1 From 0bfd80ce7ad7fffeca7c0c6fbde6cd66f6fd6539 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 18 Apr 2014 14:09:12 +0100 Subject: Emacs: Disable auto-indent-mode in jinja2-mode --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index d2aedd92..b1382910 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -474,6 +474,7 @@ Values: `desktop', `server', `laptop'") 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) + (add-to-list 'auto-indent-disabled-modes-list 'jinja2-mode) (auto-indent-global-mode) (defun lisp-auto-indent-mode () (set (make-local-variable 'auto-indent-assign-indent-level) 2)) -- cgit 1.4.1 From 13785c1eb7c0b85f171e6eb89b6b7bb4f47c6ade Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 18 Apr 2014 21:38:28 +0100 Subject: Emacs: Remove non-cask package initialisation --- tag-emacs/emacs.d/init.el | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index b1382910..5bf49ff0 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -58,28 +58,9 @@ Values: `desktop', `server', `laptop'") ;;;; Package Management (add-to-list 'load-path (expand-file-name "elisp/" user-emacs-directory)) -(let ((cask-dir (expand-file-name "~/.cask"))) - (if (file-exists-p cask-dir) - (progn - (add-to-list 'load-path cask-dir) - (require 'cask) - (cask-initialize)) - (eval-and-compile - (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") - ("marmalade" . "http://marmalade-repo.org/packages/") - ("melpa" . "http://melpa.milkbox.net/packages/") - ("org" . "http://orgmode.org/elpa/"))) - (package-initialize)) - - (when (not package-archive-contents) - (package-refresh-contents)) - - (mapc (lambda (package-name) - (unless (package-installed-p package-name) - (package-install package-name))) - '(bind-key - diminish - use-package)))) +(add-to-list 'load-path (expand-file-name "~/.cask")) +(require 'cask) +(cask-initialize) (require 'use-package) (use-package pallet) -- cgit 1.4.1 From f501f4d4998d6791382a3590a5423cb037c6494f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 18 Apr 2014 21:44:27 +0100 Subject: Emacs: delete-current-buffer-file: remove vc check --- tag-emacs/emacs.d/init.el | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 5bf49ff0..543e2047 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -392,11 +392,9 @@ Values: `desktop', `server', `laptop'") (if (not (and filename (file-exists-p filename))) (ido-kill-buffer) (when (yes-or-no-p "Are you sure you want to remove this file? ") - (if (vc-backend filename) - (vc-delete-file filename) - (delete-file filename) - (kill-buffer buffer) - (message "File '%s' successfully removed" filename)))))) + (delete-file filename) + (kill-buffer buffer) + (message "File '%s' successfully removed" filename))))) (use-package recentf :init (progn (setq recentf-auto-cleanup 'never -- cgit 1.4.1 From d1e8149cc3af36cd790b0d9e9029d477e9f4d1a2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 19 Apr 2014 08:16:04 +0100 Subject: Emacs: Remove non-existing info directory I think it was from when I used el-get --- tag-emacs/emacs.d/init.el | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 543e2047..0b9f0c52 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -348,10 +348,6 @@ Values: `desktop', `server', `laptop'") ;;;; Documentation -(add-to-list 'Info-default-directory-list - (concat user-emacs-directory - "info")) - (use-package which-func :init (which-function-mode) :config (setq which-func-modes t)) -- cgit 1.4.1 From 0a42ff72d0288fe23e1751924a036649669f1ded Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 19 Apr 2014 08:41:20 +0100 Subject: Emacs: Disable autopair in yaml-mode It seems that the annoying indent-on-return behaviour can't easily be disabled. --- tag-emacs/emacs.d/init.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 0b9f0c52..6af268a2 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -616,9 +616,7 @@ Values: `desktop', `server', `laptop'") (use-package yaml-mode :mode (("/group_vars/.*" . yaml-mode) ("/host_vars/.*" . yaml-mode) - ("\\.sls\\'" . yaml-mode)) - :config (progn - (add-hook 'yaml-mode-hook #'autopair-mode))) + ("\\.sls\\'" . yaml-mode))) ;;;; Planning -- cgit 1.4.1 From 7a8cdb1b0f6a3500a9b49307876f422d093c6419 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 19 Apr 2014 10:44:40 +0100 Subject: Emacs: install markdown-mode --- tag-emacs/emacs.d/Cask | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 9718e2dd..1d458ef1 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -32,6 +32,7 @@ (depends-on "js2-mode") (depends-on "lua-mode") (depends-on "magit") +(depends-on "markdown-mode") (depends-on "multi-term") (depends-on "multiple-cursors") (depends-on "mustache-mode") -- cgit 1.4.1 From 1b545e7b0b4875d4df64317daee9dbd6d518e488 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 20 Apr 2014 13:17:01 +0100 Subject: Add rcrc.local for Bulb laptop --- host-ap-bulbbook/rcrc.local | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 host-ap-bulbbook/rcrc.local diff --git a/host-ap-bulbbook/rcrc.local b/host-ap-bulbbook/rcrc.local new file mode 100644 index 00000000..6329d62c --- /dev/null +++ b/host-ap-bulbbook/rcrc.local @@ -0,0 +1,2 @@ +DOTFILES_DIRS="$HOME/projects/dotfiles" +TAGS="emacs git hg ssh tmux zsh" \ No newline at end of file -- cgit 1.4.1 From 6a301b4bfd55f17f1b6d06029f80d68ce4666165 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 21 Apr 2014 19:29:27 +0100 Subject: Emacs: Remove unused highlight-symbol config --- tag-emacs/emacs.d/init.el | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 6af268a2..d5ae3deb 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -70,10 +70,6 @@ Values: `desktop', `server', `laptop'") (use-package linum :config (setq linum-format " %4d ")) -(use-package highlight-symbol - :disabled t - :config (setq highlight-symbol-idle-delay 0.2)) - (use-package whitespace :config (setq whitespace-style '(face -- cgit 1.4.1 From e3cc393606efc8b82b9979e72a69b2ab1e743188 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 21 Apr 2014 19:30:29 +0100 Subject: Add initial rcrc.local for Prefect --- host-prefect/rcrc.local | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 host-prefect/rcrc.local diff --git a/host-prefect/rcrc.local b/host-prefect/rcrc.local new file mode 100644 index 00000000..1ac7ca1f --- /dev/null +++ b/host-prefect/rcrc.local @@ -0,0 +1,2 @@ +DOTFILES_DIRS="~/projects/dotfiles" +TAGS="emacs git hg sakura ssh tmux xresources zsh" -- cgit 1.4.1 From cf67810969ec397d34c60fecbf1070f8cfc44163 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 21 Apr 2014 19:31:20 +0100 Subject: Emacs: remove unused mu4e configuration --- tag-emacs/emacs.d/init.el | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index d5ae3deb..ce0727e5 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -272,20 +272,6 @@ Values: `desktop', `server', `laptop'") (setq smtpmail-smtp-server "external.home" smtpmail-smtp-service 587) -(use-package mu4e - :if (and (eq env/location 'home) - (eq env/system-type 'desktop)) - :load-path "/usr/share/emacs/site-lisp/mu4e" - :commands (mu4e) - :config (progn - (setq mu4e-get-mail-command "true" - mu4e-update-interval 300 - mu4e-sent-folder "/alanpearce/Sent" - mu4e-drafts-folder "/alanpearce/Drafts" - mu4e-refile-folder "/alanpearce/Archive") - (bind-key "q" #'bury-buffer mu4e-main-mode-map) - (bind-key "d" #'mu4e-headers-mark-for-delete mu4e-headers-mode-map))) - ;;;; Completion (setq completion-styles '(basic initials partial-completion substring) -- cgit 1.4.1 From 1eff3e67ebf51045e13220e4685e9b691d267a7c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 21 Apr 2014 19:32:02 +0100 Subject: Emacs: remove "env/" function set --- tag-emacs/emacs.d/init.el | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index ce0727e5..21835eb3 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -19,36 +19,6 @@ ;;;; Environment & Location -(defun env/get-location () - "Return the physical location of the system, or `nil' if unknown" - (if (executable-find "netctl") - (catch 'found - (mapc (lambda (line) - (cond - ((string-prefix-p "* home" line) (throw 'found 'home)) - ((string-prefix-p "* work" line) (throw 'found 'work)))) - (process-lines "netctl" "list")) - nil))) - -(defun env/get-system-type () - "Return the type of computer that is running" - (cond - ((string-prefix-p "prefect" system-name) 'desktop) - ((string-prefix-p "server" system-name) 'server) - ((string-prefix-p "sheldon" system-name) 'laptop))) - -(defvar env/location (env/get-location) - "The type of location the system is located in -Values: `work', `home'") - -(defvar env/system-type (env/get-system-type) - "The type of computer Emacs is running on -Values: `desktop', `server', `laptop'") - -(defun env/recheck-location () - (interactive) - (setq env/location (env/get-location))) - (defvar *init-file* (when user-init-file (expand-file-name "init.el" -- cgit 1.4.1 From 74471682ce902d49a44a507801be9c04dc38cda0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 21 Apr 2014 19:37:27 +0100 Subject: Emacs: configure winner-mode after initialising --- tag-emacs/emacs.d/init.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 21835eb3..484dff86 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1031,7 +1031,10 @@ (tooltip-mode -1) (tool-bar-mode -1)) -(winner-mode 1) +(use-package winner + :init (progn + (winner-mode 1) + (setq winner-boring-buffers '("*Completions*" "*Help*" "*Apropos*" "*Buffer List*" "*info*" "*Compile-Log*")))) (use-package windmove :bind (("S-" . windmove-left) -- cgit 1.4.1 From 166ae52efa43e3af5226db918c473cfd94d911ce Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 22 Apr 2014 14:51:25 +0100 Subject: Emacs: use req-package on top of use-package --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 180 ++++++++++++++++++++++++---------------------- 2 files changed, 96 insertions(+), 85 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 1d458ef1..5df9a3d7 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -47,6 +47,7 @@ (depends-on "puppet-mode") (depends-on "quickrun") (depends-on "redshank") +(depends-on "req-package") (depends-on "s") (depends-on "skewer-mode") (depends-on "smart-tab") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 484dff86..e1c9c265 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -32,15 +32,15 @@ (require 'cask) (cask-initialize) -(require 'use-package) -(use-package pallet) +(require 'req-package) +(req-package pallet) ;;;; Style -(use-package linum +(req-package linum :config (setq linum-format " %4d ")) -(use-package whitespace +(req-package whitespace :config (setq whitespace-style '(face space @@ -62,7 +62,7 @@ jit-lock-chunk-size 1000 jit-lock-defer-time 0.01) -(use-package solarized-theme +(req-package solarized-theme :config (load-theme 'solarized-light t)) (when (or (display-graphic-p) @@ -181,7 +181,7 @@ ;;;; Buffers -(use-package ibuffer +(req-package ibuffer :bind (("C-x C-b" . ibuffer)) :config (progn (setq ibuffer-saved-filter-groups @@ -212,19 +212,19 @@ " " filename-and-process))))) -(use-package uniquify +(req-package uniquify :config (progn (setq uniquify-buffer-name-style 'reverse uniquify-separator "/" uniquify-after-kill-buffer-p t uniquify-ignore-buffers-re "^\\*"))) -(use-package fancy-narrow +(req-package fancy-narrow :config (fancy-narrow-mode 1)) ;;;; Communication -(use-package erc +(req-package erc :config (progn (setq erc-user-full-name "Alan Pearce" erc-email-userid "alan@alanpearce.co.uk" @@ -247,13 +247,13 @@ (setq completion-styles '(basic initials partial-completion substring) completion-ignore-case t) -(use-package smart-tab +(req-package smart-tab :init (global-smart-tab-mode) :config (progn (nconc smart-tab-completion-functions-alist '((php-mode . php-complete-function))) (diminish 'smart-tab-mode ""))) -(use-package company +(req-package company :commands (company-mode) :bind (("C-" . company-complete)) :init (progn @@ -263,7 +263,7 @@ ;;;; Dates & Times -(use-package calendar +(req-package calendar :config (progn (setq calendar-week-start-day 1) (calendar-set-date-style 'iso))) @@ -279,9 +279,8 @@ (insert (format-time-string format)))) ;;;; Directory browsing -(use-package dired +(req-package dired :config (progn - (use-package dired-x) (bind-key "" #'dired-find-file dired-mode-map) (bind-key "^" (lambda () (interactive) (find-alternate-file "..")) dired-mode-map) (setq dired-dwim-target t @@ -292,7 +291,11 @@ (setq insert-directory-program "/usr/local/bin/gls")) (put 'dired-find-alternate-file 'disabled nil))) -(use-package dired+ +(req-package dired-x + :require dired) + +(req-package dired+ + :require dired :config (progn (diredp-toggle-find-file-reuse-dir 1) (dired-omit-mode 1) @@ -300,7 +303,7 @@ ;;;; Documentation -(use-package which-func +(req-package which-func :init (which-function-mode) :config (setq which-func-modes t)) @@ -344,16 +347,16 @@ (kill-buffer buffer) (message "File '%s' successfully removed" filename))))) -(use-package recentf +(req-package recentf :init (progn (setq recentf-auto-cleanup 'never recentf-save-file (expand-file-name "recentf" user-emacs-directory)) (recentf-mode 1))) -(use-package saveplace +(req-package saveplace :config (progn (setq-default save-place t) (setq save-place-file (expand-file-name ".saveplace" user-emacs-directory)))) -(use-package tramp +(req-package tramp :config (progn (setq tramp-default-method (if (eq system-type 'windows-nt) "plinkx" "ssh") tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root") (nil nil "alan")) @@ -369,12 +372,13 @@ (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil)) (add-to-list 'tramp-default-proxies-alist '("router" nil nil)))) -(use-package tramp-sh +(req-package tramp-sh + :require tramp :config (progn (add-to-list 'tramp-remote-path "/usr/local/sbin") (add-to-list 'tramp-remote-path "~/bin"))) -(use-package ediff +(req-package ediff :config (progn (setq ediff-split-window-function 'split-window-horizontally ediff-window-setup-function 'ediff-setup-windows-plain))) @@ -390,7 +394,7 @@ '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120) tab-always-indent 'complete) -(use-package auto-indent-mode +(req-package auto-indent-mode :commands (auto-indent-minor-mode auto-indent-mode) :config (progn @@ -407,7 +411,7 @@ (set (make-local-variable 'auto-indent-assign-indent-level) 2)) (add-hook 'lisp-common-mode-hook #'lisp-auto-indent-mode))) -(use-package smart-tabs-mode +(req-package smart-tabs-mode :commands (smart-tabs-mode smart-tabs-mode-enable smart-tabs-advice) @@ -457,7 +461,7 @@ (set-register ?e `(file . ,*init-file*)) (set-register ?z `(file . ,(expand-file-name ".zshrc" "~"))) -(use-package discover +(req-package discover :config (global-discover-mode)) ;; Enable narrowing functions C-x n @@ -474,12 +478,12 @@ (defalias 'exit-emacs #'delete-frame) (defalias 'exit-emacs #'save-buffers-kill-emacs)) -(use-package helm-config +(req-package helm-config :bind (("C-x i" . helm-imenu)) :config (setq helm-idle-delay .1 helm-input-idle-delay .1)) -(use-package ido +(req-package ido :bind (("C-x b" . ido-switch-buffer)) :init (progn (setq ido-save-directory-list-file (expand-file-name "ido-state" user-emacs-directory)) @@ -504,14 +508,17 @@ (bind-key "s-x b" #'ap/ido-projectile-switch-buffer-dwim) (bind-key "s-x s-b" #'ap/ido-projectile-switch-buffer-dwim) -(use-package ido-vertical-mode +(req-package ido-vertical-mode + :require ido :config (ido-vertical-mode 1)) -(use-package flx-ido +(req-package flx-ido + :require ido :init (progn (flx-ido-mode 1))) -(use-package smex +(req-package smex + :require ido :bind (("M-x" . smex) ("" . smex) ("" . smex) @@ -542,37 +549,37 @@ (add-to-list 'auto-mode-alist '("\\.target\\'" . conf-mode)) (add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-mode)) -(use-package xrdb-mode +(req-package xrdb-mode :mode (("\\.Xdefaults\\'" . xrdb-mode) ("\\.Xresources\\'" . xrdb-mode))) -(use-package haskell-mode +(req-package haskell-mode :mode (("\\.hs\\'" . haskell-mode) ("xmobarrc\\'" . haskell-mode))) -(use-package nginx-mode +(req-package nginx-mode :mode (("nginx.conf" . nginx-mode))) -(use-package lua-mode +(req-package lua-mode :mode (("\\.lua\\'" . lua-mode))) -(use-package puppet-mode +(req-package puppet-mode :mode (("\\.pp\\'" . puppet-mode)) :config (progn (add-hook 'puppet-mode-hook #'autopair-mode))) -(use-package ruby-mode +(req-package ruby-mode :mode (("\\.rb\\'" . ruby-mode) ("\\.cap\\'" . ruby-mode))) -(use-package yaml-mode +(req-package yaml-mode :mode (("/group_vars/.*" . yaml-mode) ("/host_vars/.*" . yaml-mode) ("\\.sls\\'" . yaml-mode))) ;;;; Planning -(use-package org +(req-package org :bind (("C-c C-a" . org-agenda-list) ("C-c a" . org-agenda) ("C-c l" . org-store-link)) @@ -625,13 +632,14 @@ (if (looking-at (concat " +" org-todo-regexp "\\( +\\|[ \t]*$\\)")) (org-todo "STARTED"))))))) -(use-package org-journal +(req-package org-journal + :require org :config (progn (setq org-journal-date-format "%A, %d %B %Y"))) ;;;; Programming -(use-package cedet +(req-package cedet :disabled t :config (progn (semantic-load-enable-code-helpers) @@ -640,12 +648,12 @@ (global-semantic-show-unmatched-syntax-mode t) (global-semantic-decoration-mode t))) -(use-package flycheck +(req-package flycheck :init (global-flycheck-mode)) ;;;; Projects -(use-package projectile +(req-package projectile :bind (("C-c C-f" . projectile-find-file) ("s-x s-f" . projectile-find-file)) :init (projectile-global-mode) @@ -653,16 +661,16 @@ (setq projectile-switch-project-action #'projectile-dired projectile-remember-window-configs t))) -(use-package vc +(req-package vc :config (progn (setq vc-follow-symlinks t))) -(use-package diff-hl +(req-package diff-hl :init (progn (global-diff-hl-mode) (add-hook 'magit-refresh-file-buffer-hook #'diff-hl-update))) -(use-package magit +(req-package magit :commands (magit-status) :bind (("C-x g" . magit-status) ("s-G" . magit-status)) @@ -675,7 +683,7 @@ ;; If aspell is too slow ;; If it is still too slow, use ‘ultra’ instead of ‘fast’ ;; (setq ispell-extra-args '(" --sug-mode=fast")) -(use-package ispell +(req-package ispell :bind (("" . ispell-word))) ;;;; Scripting @@ -683,21 +691,21 @@ (add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) -(use-package sh-script +(req-package sh-script :mode (("\\.zsh\\'" . shell-script-mode)) :config (setq sh-shell-file "/usr/bin/env zsh")) -(use-package ntcmd +(req-package ntcmd :mode (("\\`.cmd\\'" . ntcmd-mode) ("\\`.bat\\'" . ntcmd-mode))) ;;;; Shells & REPLs -(use-package eshell +(req-package eshell :bind ("C-c s" . eshell) :config (progn (setq eshell-directory-name "~/.emacs.d/eshell") - (use-package em-smart + (req-package em-smart :init (progn (setq eshell-where-to-jump 'begin eshell-review-quick-commands nil @@ -712,11 +720,11 @@ (eshell/cd dir))) (bind-key "C-c S" #'eshell-goto-current-dir) -(use-package shell +(req-package shell :config (define-key shell-mode-map (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) -(use-package multi-term +(req-package multi-term :if (not (eq system-type 'windows-nt)) :bind ("C-`" . multi-term-dedicated-toggle)) @@ -745,14 +753,14 @@ (bind-key "S-SPC" #'set-mark-command) -(use-package subword +(req-package subword :init (global-subword-mode t)) -(use-package misc +(req-package misc :bind (("M-z" . zap-up-to-char) ("M-Z" . zap-to-char))) -(use-package ap-functions +(req-package ap-functions :commands (ap/remove-extra-cr) :bind (("C-x r M-w" . copy-rectangle) ("M-!" . shell-execute))) @@ -760,14 +768,14 @@ (when (boundp 'x-select-request-type) (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))) -(use-package ace-jump-mode +(req-package ace-jump-mode :bind (("C-c SPC" . ace-jump-mode)) :config (progn (ace-jump-mode-enable-mark-sync) (setq ace-jump-word-mode-use-query-char nil ace-jump-mode-scope 'window))) -(use-package autopair +(req-package autopair :commands (autopair-mode autopair-on) :init (progn @@ -778,13 +786,13 @@ (setq autopair-blink nil autopair-skip-whitespace nil))) -(use-package expand-region +(req-package expand-region :bind ("C-M-SPC" . er/expand-region)) -(use-package goto-chg +(req-package goto-chg :bind ("C-x SPC" . goto-last-change)) -(use-package multiple-cursors +(req-package multiple-cursors :config (progn (bind-key "C-." #'mc/mark-next-like-this) (bind-key "C-," #'mc/mark-previous-like-this) @@ -792,11 +800,11 @@ (bind-key "C-" #'mc/mark-more-like-this-extended) (bind-key "C-S-L" #'mc/edit-lines))) -(use-package eldoc +(req-package eldoc :config (progn (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) -(use-package paredit +(req-package paredit :commands (paredit-mode) :init (progn (add-hook 'lisp-common-mode-hook #'enable-paredit-mode) @@ -808,17 +816,17 @@ (if (eq this-command 'eval-expression) (paredit-mode 1))))) -(use-package shuffle-lines +(req-package shuffle-lines :bind (("C-S-" . move-line-up) ("C-S-" . move-line-down))) -(use-package smart-forward +(req-package smart-forward :bind (("C-M-u" . smart-up) ("C-M-d" . smart-down) ("C-M-p" . smart-backward) ("C-M-n" . smart-forward))) -(use-package undo-tree +(req-package undo-tree :config (progn (global-undo-tree-mode) ;; Keep region when undoing in region @@ -834,7 +842,7 @@ ad-do-it))) :diminish undo-tree-mode) -(use-package visual-regexp +(req-package visual-regexp :bind (("C-c r" . vr/replace) ("C-c q" . vr/query-replace) ("C-c m" . vc/mc-mark))) @@ -857,22 +865,22 @@ (add-hook 'lisp-mode-hook #'ap/lisp-setup) (add-hook 'lisp-mode-hook #'set-common-lisp-indentation) -(use-package elisp-slime-nav +(req-package elisp-slime-nav :commands elisp-slime-nav-mode :diminish elisp-slime-nav-mode) -(use-package geiser +(req-package geiser + :require quack :commands (geiser-mode geiser run-geiser - run-racket) - :config (use-package quack)) + run-racket)) -(use-package redshank +(req-package redshank :init (progn (add-hook 'lisp-common-mode-hook #'turn-on-redshank-mode))) -(use-package slime +(req-package slime :commands (slime) :config (progn (let ((ql-slime-helper (expand-file-name "~/quicklisp/slime-helper.el"))) @@ -884,7 +892,7 @@ (defun imenu-elisp-sections () (setq imenu-prev-index-position-function nil) (add-to-list 'imenu-generic-expression '("Sections" "^;;;; \\(.+\\)$" 1) t) - (add-to-list 'imenu-generic-expression '("Packages" "^(use-package\\s-+\\(\\(\\sw\\|\\s_\\)+\\)$" 1) t)) + (add-to-list 'imenu-generic-expression '("Packages" "^(req-package\\s-+\\(\\(\\sw\\|\\s_\\)+\\)$" 1) t)) (defun init-narrow-to-section () (interactive) @@ -921,10 +929,10 @@ ;;;; Programming -(use-package auto-compile +(req-package auto-compile :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) -(use-package cc-mode +(req-package cc-mode :init (progn (add-hook 'c-mode-common-hook #'electric-indent-mode)) :config (progn @@ -934,17 +942,17 @@ c-basic-offset 4) (c-set-offset 'case-label '+))) -(use-package quickrun) +(req-package quickrun) ;;;; Web Development -(use-package skewer-mode +(req-package skewer-mode :init (progn (add-hook 'js2-mode-hook #'skewer-mode) (add-hook 'html-mode-hook #'skewer-html-mode) (add-hook 'css-mode-hook #'skewer-css-mode))) -(use-package js2-mode +(req-package js2-mode :mode ("\\.js\\'" . js2-mode) :config (progn (defun ap/javascript-setup () @@ -954,15 +962,15 @@ (setq js2-basic-offset 4 js2-global-externs '("$")))) -(use-package mustache-mode +(req-package mustache-mode :mode (("\\.mustache" . mustache-mode) ("\\.mt\\'" . mustache-mode) ("\\.template\\'" . mustache-mode))) -(use-package jinja2-mode +(req-package jinja2-mode :mode (("\\.j2\\'" . jinja2-mode))) -(use-package php-mode +(req-package php-mode :mode ("\\.php\\'" . php-mode) :config (progn (bind-key "C-h C-f" #'php-search-documentation php-mode-map) @@ -991,15 +999,15 @@ (add-hook 'php-mode-hook #'ap/php-style) (add-hook 'php-mode-hook #'turn-on-eldoc-mode))) -(use-package sgml-mode +(req-package sgml-mode :config (setq sgml-basic-offset 4)) -(use-package emmet-mode +(req-package emmet-mode :config (progn (if (functionp 'web-mode) (add-hook 'web-mode-hook #'emmet-mode)))) -(use-package web-mode +(req-package web-mode :mode (("/views/.*\\.php\\'" . web-mode) ("/templates/.*\\.php\\'" . web-mode)) :config (setq web-mode-code-indent-offset 4 @@ -1031,12 +1039,12 @@ (tooltip-mode -1) (tool-bar-mode -1)) -(use-package winner +(req-package winner :init (progn (winner-mode 1) (setq winner-boring-buffers '("*Completions*" "*Help*" "*Apropos*" "*Buffer List*" "*info*" "*Compile-Log*")))) -(use-package windmove +(req-package windmove :bind (("S-" . windmove-left) ("S-" . windmove-right) ("S-" . windmove-up) @@ -1044,3 +1052,5 @@ (if (eq system-type 'darwin) (setq ns-pop-up-frames nil)) + +(req-package-finish) -- cgit 1.4.1 From 1caca4478a9a9e7fb2f546a36de19c40f39e19a8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 22 Apr 2014 14:56:49 +0100 Subject: Emacs: Whitespace cleanup --- tag-emacs/emacs.d/init.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index e1c9c265..77ffccd1 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -87,10 +87,10 @@ (variable-face "Segoe UI") (default-font (concat mono-face "-" (number-to-string font-size)))) (when mono-face - (add-to-list 'default-frame-alist `(font . ,default-font)) - (set-face-font 'fixed-pitch default-font)) + (add-to-list 'default-frame-alist `(font . ,default-font)) + (set-face-font 'fixed-pitch default-font)) (when variable-face - (set-face-font 'variable-pitch (concat variable-face "-" + (set-face-font 'variable-pitch (concat variable-face "-" (number-to-string (1+ font-size))))))) ((eq system-type 'darwin) (let* ((font-size 14) @@ -104,10 +104,10 @@ (number-to-string (1+ font-size))))))))) (let* ((font-height (face-attribute 'default :height)) - (small-font-height (max 1 (floor (* .917 font-height))))) + (small-font-height (max 1 (floor (* .917 font-height))))) (mapc (lambda (item) - (put (car item) 'customized-face (cadr item)) - (face-spec-set (car item) (cadr item))) + (put (car item) 'customized-face (cadr item)) + (face-spec-set (car item) (cadr item))) `((linum ((t (:height ,small-font-height :foreground unspecified @@ -881,7 +881,7 @@ (add-hook 'lisp-common-mode-hook #'turn-on-redshank-mode))) (req-package slime - :commands (slime) + :commands (slime) :config (progn (let ((ql-slime-helper (expand-file-name "~/quicklisp/slime-helper.el"))) (if (file-exists-p ql-slime-helper) @@ -956,7 +956,7 @@ :mode ("\\.js\\'" . js2-mode) :config (progn (defun ap/javascript-setup () - (autopair-mode -1) + (autopair-mode -1) (auto-indent-mode -1)) (add-hook 'js2-mode-hook #'ap/javascript-setup) (setq js2-basic-offset 4 -- cgit 1.4.1 From fc3143e3756beb78f65d5b70252da3b8e74da9e6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 22 Apr 2014 15:07:09 +0100 Subject: Emacs: don't mark spaces after tabs --- tag-emacs/emacs.d/init.el | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 77ffccd1..510cd8d0 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -48,7 +48,6 @@ trailing newline empty - space-after-tab tab-mark space-before-tab indentation -- cgit 1.4.1 From e454ed728cc9dd5b1ec9d678e47846f9a4950c29 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 25 Apr 2014 20:08:41 +0100 Subject: Emacs: add fallback for init-file when ignored --- tag-emacs/emacs.d/init.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 510cd8d0..6ee1f1ec 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -20,9 +20,10 @@ ;;;; Environment & Location (defvar *init-file* - (when user-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 user-init-file)))) + (file-name-directory (file-truename init-file)))) "Where the emacs init file really is, passing through symlinks.") ;;;; Package Management -- cgit 1.4.1 From feb382a1d0d978a4edce9da10a3db9939d570dc2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 25 Apr 2014 20:09:23 +0100 Subject: Emacs: Remove quack dependency from geiser --- tag-emacs/emacs.d/init.el | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 6ee1f1ec..765d332d 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -870,7 +870,6 @@ :diminish elisp-slime-nav-mode) (req-package geiser - :require quack :commands (geiser-mode geiser run-geiser -- cgit 1.4.1 From e267f364f810dceae50a6728890468f815363778 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 26 Apr 2014 12:32:10 +0100 Subject: Emacs: install and configure smart-mode-line Diminish projectile-mode as sml reads from it anyway --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 5df9a3d7..b4ce4e37 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -50,6 +50,7 @@ (depends-on "req-package") (depends-on "s") (depends-on "skewer-mode") +(depends-on "smart-mode-line") (depends-on "smart-tab") (depends-on "smart-tabs-mode") (depends-on "smex") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 765d332d..6710a680 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -542,6 +542,11 @@ (column-number-mode t) (size-indication-mode t) +(req-package smart-mode-line + :init (progn + (setq sml/theme 'respectful) + (sml/setup))) + ;;;; Modes ;;;; systemd files @@ -657,6 +662,7 @@ :bind (("C-c C-f" . projectile-find-file) ("s-x s-f" . projectile-find-file)) :init (projectile-global-mode) + :diminish projectile-mode :config (progn (setq projectile-switch-project-action #'projectile-dired projectile-remember-window-configs t))) -- cgit 1.4.1 From 0014950d1c61751c1184228cd92a09809948af55 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 26 Apr 2014 12:46:32 +0100 Subject: Emacs: diminish fancy-narrow-mode --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 6710a680..97280579 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -220,6 +220,7 @@ uniquify-ignore-buffers-re "^\\*"))) (req-package fancy-narrow + :diminish fancy-narrow-mode :config (fancy-narrow-mode 1)) ;;;; Communication -- cgit 1.4.1 From 384cc3e80cd25156335cb4fa6f51507688a0b27b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 26 Apr 2014 12:46:44 +0100 Subject: Emacs: diminish magit-auto-revert-mode --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 97280579..ad86cb29 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -678,6 +678,7 @@ (add-hook 'magit-refresh-file-buffer-hook #'diff-hl-update))) (req-package magit + :diminish magit-auto-revert-mode :commands (magit-status) :bind (("C-x g" . magit-status) ("s-G" . magit-status)) -- cgit 1.4.1 From d7a6317804a6445846ea15d886161b593d7da94a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 26 Apr 2014 12:47:23 +0100 Subject: Emacs: use unicode tick for flycheck-mode --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index ad86cb29..c693a47b 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -655,6 +655,7 @@ (global-semantic-decoration-mode t))) (req-package flycheck + :diminish (global-flycheck-mode . " ✓") :init (global-flycheck-mode)) ;;;; Projects -- cgit 1.4.1 From a5126cbcea58fd3d424605a8256490a1ea263e50 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 26 Apr 2014 13:00:58 +0100 Subject: Emacs: add helper macro for renaming major modes --- tag-emacs/emacs.d/init.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index c693a47b..c0134ee4 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -11,6 +11,12 @@ (load custom-file :noerror) +;;;; Helper Macros +(defmacro rename-modeline (package-name mode new-name) + `(eval-after-load ,package-name + '(defadvice ,mode (after rename-modeline activate) + (setq mode-name ,new-name)))) + ;;; Allow lisps to use a common setup. I don't know why they don't have some lispy mode as their parent, but this is close enough (defcustom lisp-common-mode-hook nil "Hook run when entering any Lisp mode." -- cgit 1.4.1 From 85448cdf0f4b74e2d626b581176988301b9e30e0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 26 Apr 2014 13:01:10 +0100 Subject: Emacs: shorten emacs-lisp-mode in modeline to El --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index c0134ee4..f87aaa2d 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -873,6 +873,7 @@ (set (make-local-variable 'lisp-indent-function) #'common-lisp-indent-function)) +(rename-modeline "lisp-mode" emacs-lisp-mode "El") (add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup) (add-hook 'emacs-lisp-mode-hook #'turn-on-eldoc-mode) -- cgit 1.4.1 From 95e42eebe8269027ececb70a7dc89ee5e13a5164 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 26 Apr 2014 13:14:45 +0100 Subject: Emacs: install and configure paradox-mode --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index b4ce4e37..ce67a9aa 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -40,6 +40,7 @@ (depends-on "org-journal") (depends-on "org-plus-contrib") (depends-on "pallet") +(depends-on "paradox") (depends-on "paredit") (depends-on "php-extras") (depends-on "php-mode") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index f87aaa2d..580b5fdc 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -42,6 +42,11 @@ (require 'req-package) (req-package pallet) +(req-package paradox + :init (progn + (when paradox-github-token + (paradox-enable)))) + ;;;; Style (req-package linum -- cgit 1.4.1 From 22bcda566ad643c23581fd4c0405e1729e127f60 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 26 Apr 2014 13:38:17 +0100 Subject: Emacs: add melpa-stable source to Cask --- tag-emacs/emacs.d/Cask | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index ce67a9aa..459c4477 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -1,6 +1,7 @@ (source gnu) (source marmalade) (source melpa) +(source melpa-stable) (source org) (depends-on "ace-jump-mode") -- cgit 1.4.1 From 97ca6f8ceb4e332b8aeca45ce29b9c5f745ad4c9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 26 Apr 2014 13:38:30 +0100 Subject: Emacs: Fix flycheck error in cask initialisation --- tag-emacs/emacs.d/init.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 580b5fdc..b0375c42 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -35,8 +35,9 @@ ;;;; Package Management (add-to-list 'load-path (expand-file-name "elisp/" user-emacs-directory)) -(add-to-list 'load-path (expand-file-name "~/.cask")) -(require 'cask) +(eval-and-compile + (add-to-list 'load-path (expand-file-name "~/.cask")) + (require 'cask)) (cask-initialize) (require 'req-package) -- cgit 1.4.1 From 6ca36a22d26631dbd1900e42211ce8e1997a74d1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 26 Apr 2014 13:44:20 +0100 Subject: Emacs: prettify emacs-lisp modeline indicator --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index b0375c42..1bcb1113 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -879,7 +879,7 @@ (set (make-local-variable 'lisp-indent-function) #'common-lisp-indent-function)) -(rename-modeline "lisp-mode" emacs-lisp-mode "El") +(rename-modeline "lisp-mode" emacs-lisp-mode "ξ") (add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup) (add-hook 'emacs-lisp-mode-hook #'turn-on-eldoc-mode) -- cgit 1.4.1 From 2e2dbab1f6359b7c5bb4f5fa2939dffa0a0e5f5f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 26 Apr 2014 13:45:35 +0100 Subject: Emacs: Disable detection of html in php-mode --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 1bcb1113..4bd4497a 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -994,6 +994,7 @@ (req-package php-mode :mode ("\\.php\\'" . php-mode) :config (progn + (setq php-template-compatibility nil) (bind-key "C-h C-f" #'php-search-documentation php-mode-map) (unbind-key "C-c C-f" php-mode-map) (unbind-key "C-." php-mode-map) -- cgit 1.4.1 From ea72f9d6febff70d7c6042c979f4271ba2f17dc1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 26 Apr 2014 13:48:43 +0100 Subject: Emacs: star github packages automatically --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 4bd4497a..7ee336d1 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -46,7 +46,8 @@ (req-package paradox :init (progn (when paradox-github-token - (paradox-enable)))) + (paradox-enable)) + (setq paradox-automatically-star t))) ;;;; Style -- cgit 1.4.1 From bdf40c97b2fdb48aa509c76ba1ad3f5d86839fb6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 27 Apr 2014 12:25:53 +0100 Subject: rcm: Update DOTFILES_DIRS to please lsrc --- host-prefect/rcrc.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host-prefect/rcrc.local b/host-prefect/rcrc.local index 1ac7ca1f..32430a3e 100644 --- a/host-prefect/rcrc.local +++ b/host-prefect/rcrc.local @@ -1,2 +1,2 @@ -DOTFILES_DIRS="~/projects/dotfiles" +DOTFILES_DIRS="$HOME/projects/dotfiles" TAGS="emacs git hg sakura ssh tmux xresources zsh" -- cgit 1.4.1 From fa4613b16d19a7389d056f9ad10c2d9590ef1097 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 27 Apr 2014 12:28:08 +0100 Subject: rcm: Install Cask for Emacs if it isn't already --- hooks/post-up/emacs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/hooks/post-up/emacs b/hooks/post-up/emacs index 6b04ae06..8bd76096 100755 --- a/hooks/post-up/emacs +++ b/hooks/post-up/emacs @@ -2,11 +2,17 @@ if [[ -s $commands[emacs] ]] then - if [[ -s $commands[cask] ]] + if [[ -z $commands[cask] ]] then - pushd ~/.emacs.d - cask install - popd + git clone git://github.com/cask/cask ~/.cask + if [[ ! -d ~/bin ]] + then + mkdir ~/bin + fi + ln -s ~/.cask/bin/cask ~/bin/cask fi + pushd ~/.emacs.d + cask install + popd emacs --batch --eval '(batch-byte-recompile-directory 0)' ~/.emacs.d/ fi -- cgit 1.4.1 From 8fbaf0ef1db53650cc391f26519bce3710a6aa77 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 27 Apr 2014 12:30:14 +0100 Subject: rcm: Only byte-compile files in elisp directory --- hooks/post-up/emacs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/post-up/emacs b/hooks/post-up/emacs index 8bd76096..2e907f7c 100755 --- a/hooks/post-up/emacs +++ b/hooks/post-up/emacs @@ -14,5 +14,5 @@ then pushd ~/.emacs.d cask install popd - emacs --batch --eval '(batch-byte-recompile-directory 0)' ~/.emacs.d/ + emacs --batch --eval '(batch-byte-recompile-directory 0)' ~/.emacs.d/elisp fi -- cgit 1.4.1 From b712ec045dd12d913ea08d4be08a31b3d162c4e3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 27 Apr 2014 12:37:46 +0100 Subject: Emacs: add missing dependencies to cask --- tag-emacs/emacs.d/Cask | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 459c4477..3affae47 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -20,12 +20,16 @@ (depends-on "dired+") (depends-on "discover") (depends-on "emmet-mode") +(depends-on "elisp-slime-nav") (depends-on "expand-region") +(depends-on "fancy-narrow") +(depends-on "flx") (depends-on "flx-ido") (depends-on "flycheck") (depends-on "framemove") (depends-on "geiser") (depends-on "ggtags") +(depends-on "goto-chg") (depends-on "haskell-mode") (depends-on "helm") (depends-on "ido-vertical-mode") @@ -38,6 +42,7 @@ (depends-on "multiple-cursors") (depends-on "mustache-mode") (depends-on "nginx-mode") +(depends-on "ntcmd") (depends-on "org-journal") (depends-on "org-plus-contrib") (depends-on "pallet") @@ -52,6 +57,8 @@ (depends-on "req-package") (depends-on "s") (depends-on "skewer-mode") +(depends-on "slime") +(depends-on "smart-forward") (depends-on "smart-mode-line") (depends-on "smart-tab") (depends-on "smart-tabs-mode") -- cgit 1.4.1 From 0da5abaf2490fc2d77750393a0ada37811d21636 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 27 Apr 2014 13:22:08 +0100 Subject: Emacs: Refactor and simplify font settings --- tag-emacs/emacs.d/init.el | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 7ee336d1..1eed32ee 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -86,35 +86,20 @@ (variable-pitch-mode) (setq cursor-type 'bar)) + (defun ap/set-fonts (mono-face variable-face font-size) + (when mono-face + (let ((default-font (concat mono-face "-" (number-to-string font-size)))) + (add-to-list 'default-frame-alist `(font . ,default-font)) + (set-face-font 'fixed-pitch default-font))) + (when variable-face + (set-face-font 'variable-pitch (concat variable-face "-" + (number-to-string (1+ font-size)))))) + (cond ((eq window-system 'w32) - (let* ((font-size 10) - (font-list (font-family-list)) - (mono-face (cond - ((member "Liberation Mono" font-list) - "Liberation Mono") - ((member "Liberation Sans Mono" font-list) - "Liberation Sans Mono") - ((member "Consolas" font-list) - "Consolas"))) - (variable-face "Segoe UI") - (default-font (concat mono-face "-" (number-to-string font-size)))) - (when mono-face - (add-to-list 'default-frame-alist `(font . ,default-font)) - (set-face-font 'fixed-pitch default-font)) - (when variable-face - (set-face-font 'variable-pitch (concat variable-face "-" - (number-to-string (1+ font-size))))))) + (ap/set-fonts "Consolas" "Segoe UI" 10)) ((eq system-type 'darwin) - (let* ((font-size 14) - (mono-face "Droid Sans Mono") - (variable-face "Helvetica_Neue") - (default-font (concat mono-face "-" (number-to-string font-size)))) - (when mono-face - (add-to-list 'default-frame-alist `(font . ,default-font))) - (when (and variable-face (display-graphic-p)) - (set-face-font 'variable-pitch (concat variable-face "-" - (number-to-string (1+ font-size))))))))) + (ap/set-fonts "Droid Sans Mono" "Helvetica_Neue" 14)))) (let* ((font-height (face-attribute 'default :height)) (small-font-height (max 1 (floor (* .917 font-height))))) -- cgit 1.4.1 From 82cdaec62c42664f01c4210165c55629dc6a3250 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 27 Apr 2014 19:15:58 +0100 Subject: Emacs: use correct flycheck mode for diminishing --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 1eed32ee..ddfd34d6 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -653,7 +653,7 @@ (global-semantic-decoration-mode t))) (req-package flycheck - :diminish (global-flycheck-mode . " ✓") + :diminish (flycheck-mode . " ✓") :init (global-flycheck-mode)) ;;;; Projects -- cgit 1.4.1 From 7612c636129aadff382d87ddafc3c840b518b56b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 30 Apr 2014 12:14:50 +0100 Subject: Emacs: Remove custom font-face configurations I actually think they were for the other version of solarized. --- tag-emacs/emacs.d/init.el | 67 ----------------------------------------------- 1 file changed, 67 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index ddfd34d6..15be03b1 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -101,73 +101,6 @@ ((eq system-type 'darwin) (ap/set-fonts "Droid Sans Mono" "Helvetica_Neue" 14)))) -(let* ((font-height (face-attribute 'default :height)) - (small-font-height (max 1 (floor (* .917 font-height))))) - (mapc (lambda (item) - (put (car item) 'customized-face (cadr item)) - (face-spec-set (car item) (cadr item))) - `((linum - ((t (:height ,small-font-height - :foreground unspecified - :inherit fringe - :overline nil - :slant normal)))) - (vertical-border - ((t (:foreground unspecified - :background unspecified - :inherit file-name-shadow)))) - (font-lock-comment-face - ((t (:slant normal)))) - (font-lock-doc-face - ((t (:slant normal)))) - (popup-face - ((t (:background unspecified - :foreground unspecified - :inherit linum - :height ,font-height)))) - (popup-scroll-bar-foreground-face - ((t (:background unspecified - :inherit region)))) - (popup-scroll-bar-background-face - ((t (:background unspecified - :inherit popup-face)))) - (ac-completion-face - ((t (:background unspecified - :foreground unspecified - :inherit popup-face)))) - (ac-candidate-face - ((t (:background unspecified - :foreground unspecified - :inherit linum - :height ,font-height)))) - (ac-selection-face - ((t (:background unspecified - :foreground unspecified - :inherit font-lock-variable-name-face - :inverse-video t)))) - (ac-candidate-mouse-face - ((t (:background unspecified - :foreground unspecified - :inherit region)))) - (ac-dabbrev-menu-face - ((t (:background unspecified - :foreground unspecified - :inherit popup-face)))) - (ac-dabbrev-selection-face - ((t (:background unspecified - :foreground unspecified - :inherit ac-selection-face)))) - (flymake-warnline - ((t (:background unspecified - :foreground unspecified - :inherit font-lock-preprocessor-face)))) - (org-table ((t (:inherit 'fixed-pitch)))) - (org-formula ((t (:foreground "Firebrick" - :inherit 'fixed-pitch)))) - (org-done ((t (:weight normal - :strike-through t)))) - (org-headline-done ((t (:strike-through t))))))) - ;;;; Autosaves & Backups (let ((backup-dir (expand-file-name "~/.emacs.d/backups/"))) (unless (file-directory-p backup-dir) -- cgit 1.4.1 From 6ff45924c8e408668e0851fb5058700822c77e93 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 30 Apr 2014 12:16:41 +0100 Subject: Emacs: fix incorrect smart-mode-line colors Load solarized-theme first so that 'respectful uses the correct theme colours. --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 15be03b1..4cd5d9da 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -475,6 +475,7 @@ (size-indication-mode t) (req-package smart-mode-line + :require solarized-theme :init (progn (setq sml/theme 'respectful) (sml/setup))) -- cgit 1.4.1 From 8d688e54a1d68b2f02b397a193a05c5762e691d7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 2 May 2014 19:16:50 +0100 Subject: Add vagrant configuration with ansible provisioning --- tag-vagrant/vagrant.d/Vagrantfile | 7 +++++++ tag-vagrant/vagrant.d/ansible/centos.yml | 31 +++++++++++++++++++++++++++++++ tag-vagrant/vagrant.d/ansible/debian.yml | 15 +++++++++++++++ tag-vagrant/vagrant.d/ansible/site.yml | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 tag-vagrant/vagrant.d/Vagrantfile create mode 100644 tag-vagrant/vagrant.d/ansible/centos.yml create mode 100644 tag-vagrant/vagrant.d/ansible/debian.yml create mode 100644 tag-vagrant/vagrant.d/ansible/site.yml diff --git a/tag-vagrant/vagrant.d/Vagrantfile b/tag-vagrant/vagrant.d/Vagrantfile new file mode 100644 index 00000000..4c69c88e --- /dev/null +++ b/tag-vagrant/vagrant.d/Vagrantfile @@ -0,0 +1,7 @@ +# -*- mode: ruby -*- +Vagrant.configure(2) do |config| + config.vm.provision "ansible" do |ansible| + ansible.playbook = "#{File.dirname(__FILE__)}/ansible/site.yml" + ansible.limit = "all" + end +end diff --git a/tag-vagrant/vagrant.d/ansible/centos.yml b/tag-vagrant/vagrant.d/ansible/centos.yml new file mode 100644 index 00000000..1a6759a6 --- /dev/null +++ b/tag-vagrant/vagrant.d/ansible/centos.yml @@ -0,0 +1,31 @@ +- name: Ensure EPEL repository package is present + register: centos_repos + get_url: + url: "{{ item.url }}" + dest: "/root/{{ item.dest }}" + with_items: + - url: http://lon.mirror.rackspace.com/ius/stable/CentOS/6/x86_64/epel-release-6-5.noarch.rpm + dest: epel-repo.rpm + - url: http://lon.mirror.rackspace.com/ius/stable/CentOS/6/x86_64/ius-release-1.0-11.ius.centos6.noarch.rpm + dest: ius-repo.rpm + +- name: Fetch utilities repo + get_url: + url: http://download.opensuse.org/repositories/utilities/CentOS_6/utilities.repo + dest: /etc/yum.repos.d/utilities.repo + +- name: Ensure IUS and EPEL repositories are installed + when: centos_repos.changed + yum: + name: "{{ item }}" + state: installed + with_items: + - /root/epel-repo.rpm + - /root/ius-repo.rpm + + +- name: Ensure that tools are installed + with_items: packages + yum: + name: "{{ item }}" + state: present diff --git a/tag-vagrant/vagrant.d/ansible/debian.yml b/tag-vagrant/vagrant.d/ansible/debian.yml new file mode 100644 index 00000000..9e06af69 --- /dev/null +++ b/tag-vagrant/vagrant.d/ansible/debian.yml @@ -0,0 +1,15 @@ +- get_url: + url: https://thoughtbot.github.io/rcm/debs/rcm_1.2.2-2_all.deb + dest: /tmp/rcm.deb + +- command: dpkg --skip-same-version -i /tmp/rcm.deb + register: dpkg + changed_when: "dpkg.stdout.startswith('Selecting')" + +- name: Ensure that tools are installed + with_items: packages + apt: + pkg: "{{ item }}" + state: present + cache_valid_time: 86400 + update_cache: yes \ No newline at end of file diff --git a/tag-vagrant/vagrant.d/ansible/site.yml b/tag-vagrant/vagrant.d/ansible/site.yml new file mode 100644 index 00000000..13384550 --- /dev/null +++ b/tag-vagrant/vagrant.d/ansible/site.yml @@ -0,0 +1,32 @@ +--- +- hosts: all + sudo: yes + vars: + packages: + - zsh + - htop + - lsof + - git + - rcm + tasks: + - include: centos.yml + when: ansible_distribution == "CentOS" + + - include: debian.yml + when: ansible_distribution == "Debian" + + - name: Ensure that dotfiles are checked out + sudo: no + git: + repo: git://github.com/alanpearce/dotfiles + dest: ~/dotfiles + update: yes + + - name: Change shell to zsh + user: + name: vagrant + shell: /bin/zsh + + - name: Install dotfiles + sudo: no + command: /usr/bin/rcup -d dotfiles -t zsh -t git -x README.org -x Brewfile -x LaunchAgents chdir=/home/vagrant \ No newline at end of file -- cgit 1.4.1 From 260cd39d8665cb11f7429a1a65a5eca1209b96b6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 8 May 2014 17:35:27 +0100 Subject: Emacs: update path to zshrc --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 4cd5d9da..220627f2 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -391,7 +391,7 @@ (interactive) (jump-to-register ?e))) (set-register ?e `(file . ,*init-file*)) -(set-register ?z `(file . ,(expand-file-name ".zshrc" "~"))) +(set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) (req-package discover :config (global-discover-mode)) -- cgit 1.4.1 From 1530babebc6bef08bf379dac15613cb2f5c50949 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 8 May 2014 17:37:24 +0100 Subject: Fix xresources include xrdb should be now run as `xrdb -I$HOME/.xresources -merge ~/.Xresources` --- host-prefect/Xresources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host-prefect/Xresources b/host-prefect/Xresources index eb45787c..b8cb7f0b 100644 --- a/host-prefect/Xresources +++ b/host-prefect/Xresources @@ -1,4 +1,4 @@ -#include ".xresources/main" +#include "main" Emacs.Font: -*-Droid Sans Mono-medium-*-*-*-*-120-*-*-*-*-*-* Emacs.fixed-pitch.attributeFont: -*-Droid Sans Mono-medium-*-*-*-*-120-*-*-*-*-*-* -- cgit 1.4.1 From 2acf45b2de0a89fa6a322343a510fc9dc2c34b35 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 8 May 2014 17:40:35 +0100 Subject: zsh: Hide output of magit and dired commands --- tag-zsh/config/zsh/zshrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index ce4b91f8..26819621 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -280,11 +280,11 @@ fi # Functions magit () { - emacsclient -e "(magit-status \"$PWD\")" + emacsclient -e "(magit-status \"$PWD\")" > /dev/null } dired () { - emacsclient -e "(dired \"$PWD\")" + emacsclient -e "(dired \"$PWD\")" > /dev/null } pid () { -- cgit 1.4.1 From f3a6e7e632200ec12c18a8fe82bbe06466d3d988 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 8 May 2014 18:08:07 +0100 Subject: rcm: Add vagrant tag to prefect --- host-prefect/rcrc.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host-prefect/rcrc.local b/host-prefect/rcrc.local index 32430a3e..de3dcb98 100644 --- a/host-prefect/rcrc.local +++ b/host-prefect/rcrc.local @@ -1,2 +1,2 @@ DOTFILES_DIRS="$HOME/projects/dotfiles" -TAGS="emacs git hg sakura ssh tmux xresources zsh" +TAGS="emacs git hg sakura ssh tmux vagrant xresources zsh" -- cgit 1.4.1 From 2b1bb067356b3750841ae4389cbc90d44321a4de Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 9 May 2014 08:09:54 +0100 Subject: Emacs: set org-replace-disputed-keys at the right time --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 220627f2..7edf942d 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -521,6 +521,7 @@ :bind (("C-c C-a" . org-agenda-list) ("C-c a" . org-agenda) ("C-c l" . org-store-link)) + :init (setq org-replace-disputed-keys t) :config (progn (setq org-directory "~/org" org-agenda-files `(,org-directory) @@ -556,7 +557,6 @@ (plain-list-item . auto)) org-fontify-done-headline t - org-replace-disputed-keys t org-todo-keywords '((sequence "TODO" "STARTED" "|" "DONE") (sequence "TOLEARN" "LEARNING" "LEARNED" "|" "MASTERED") (sequence "|" "CANCELLED"))) -- cgit 1.4.1 From 3fc8e2a13aae782204a2e29e84f02b5e84336723 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 13 May 2014 12:01:22 +0100 Subject: Workaround smart-mode-line init issue --- tag-emacs/emacs.d/init.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 7edf942d..14da0089 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -474,11 +474,12 @@ (column-number-mode t) (size-indication-mode t) -(req-package smart-mode-line - :require solarized-theme - :init (progn - (setq sml/theme 'respectful) - (sml/setup))) +(add-to-list + 'after-make-frame-functions + (lambda (&optional x) + (require 'smart-mode-line) + (sml/setup) + (sml/apply-theme 'respectful))) ;;;; Modes -- cgit 1.4.1 From 26c5a8a3fb827310d09019a0002fe87cd821ec88 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 15 May 2014 18:51:38 +0100 Subject: Emacs: switch from shuffle-lines to move-text --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 3affae47..c58f5549 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -38,6 +38,7 @@ (depends-on "lua-mode") (depends-on "magit") (depends-on "markdown-mode") +(depends-on "move-text") (depends-on "multi-term") (depends-on "multiple-cursors") (depends-on "mustache-mode") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 14da0089..b9051e5e 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -758,9 +758,8 @@ (if (eq this-command 'eval-expression) (paredit-mode 1))))) -(req-package shuffle-lines - :bind (("C-S-" . move-line-up) - ("C-S-" . move-line-down))) +(req-package move-text + :config (move-text-default-bindings)) (req-package smart-forward :bind (("C-M-u" . smart-up) -- cgit 1.4.1 From fa2854f23faba51da732d07977362b7034e5d034 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 15 May 2014 18:57:07 +0100 Subject: Emacs: remove old shuffle-lines library --- tag-emacs/emacs.d/elisp/shuffle-lines.el | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 tag-emacs/emacs.d/elisp/shuffle-lines.el diff --git a/tag-emacs/emacs.d/elisp/shuffle-lines.el b/tag-emacs/emacs.d/elisp/shuffle-lines.el deleted file mode 100644 index be0a98f9..00000000 --- a/tag-emacs/emacs.d/elisp/shuffle-lines.el +++ /dev/null @@ -1,20 +0,0 @@ -;;;###autoload -(defun move-line-down () - (interactive) - (let ((col (current-column))) - (save-excursion - (forward-line) - (transpose-lines 1)) - (forward-line) - (move-to-column col))) - -;;;###autoload -(defun move-line-up () - (interactive) - (let ((col (current-column))) - (save-excursion - (forward-line) - (transpose-lines -1)) - (move-to-column col))) - -(provide 'shuffle-lines) -- cgit 1.4.1 From 9fcd243e3b4c2fb9a540b7d0651c730fd2ac31d1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 15 May 2014 19:05:28 +0100 Subject: Emacs: merge programming sections --- tag-emacs/emacs.d/init.el | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index b9051e5e..62bd000f 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -591,6 +591,21 @@ :diminish (flycheck-mode . " ✓") :init (global-flycheck-mode)) +(req-package auto-compile + :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) + +(req-package cc-mode + :init (progn + (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 '+))) + +(req-package quickrun) + ;;;; Projects (req-package projectile @@ -868,23 +883,6 @@ (bind-key "C-c e" #'eval-and-replace) -;;;; Programming - -(req-package auto-compile - :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) - -(req-package cc-mode - :init (progn - (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 '+))) - -(req-package quickrun) - ;;;; Web Development (req-package skewer-mode -- cgit 1.4.1 From a4362450e204edc50f2c9b3bd5d28da2a54fbff5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 15 May 2014 19:49:40 +0100 Subject: Emacs: Add and configure Go packages --- tag-emacs/emacs.d/Cask | 3 +++ tag-emacs/emacs.d/init.el | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index c58f5549..693e443d 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -13,6 +13,7 @@ (depends-on "cask") (depends-on "cdnjs") (depends-on "company") +(depends-on "company-go") (depends-on "dash-at-point") (depends-on "deferred") (depends-on "diff-hl") @@ -29,6 +30,8 @@ (depends-on "framemove") (depends-on "geiser") (depends-on "ggtags") +(depends-on "go-eldoc") +(depends-on "go-mode") (depends-on "goto-chg") (depends-on "haskell-mode") (depends-on "helm") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 62bd000f..5b5feef3 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -591,6 +591,20 @@ :diminish (flycheck-mode . " ✓") :init (global-flycheck-mode)) +(req-package company-go + :require go-mode + :config (progn + (setq company-go-show-annotation t) + (defun ap/company-go-setup () + (set (make-local-variable 'company-backends) + '(company-go))) + (add-hook 'go-mode-hook #'ap/company-go-setup))) + +(req-package go-eldoc + :require go-mode + :config (progn + (add-hook 'go-mode-hook #'go-eldoc-setup))) + (req-package auto-compile :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) -- cgit 1.4.1 From 11689c4a06e1e4170da789d755be508c456e3217 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 15 May 2014 19:49:57 +0100 Subject: Emacs: Parens trigger eldoc in autopair-mode --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 5b5feef3..548c80bd 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -773,7 +773,7 @@ (req-package eldoc :config (progn - (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) + (eldoc-add-command 'paredit-backward-delete 'paredit-close-round 'autopair-insert-opening))) (req-package paredit :commands (paredit-mode) -- cgit 1.4.1 From 2eb99efd81931f9fcd1d0da2f93a366edc11408b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 15 May 2014 19:50:11 +0100 Subject: Emacs: reduce eldoc delay to 0.1s --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 548c80bd..a3877866 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -773,7 +773,8 @@ (req-package eldoc :config (progn - (eldoc-add-command 'paredit-backward-delete 'paredit-close-round 'autopair-insert-opening))) + (eldoc-add-command 'paredit-backward-delete 'paredit-close-round 'autopair-insert-opening) + (setq eldoc-idle-delay 0.1))) (req-package paredit :commands (paredit-mode) -- cgit 1.4.1 From c03f96261438cf5c3f021f581e3f8d5f8c2aad51 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 15 May 2014 20:07:39 +0100 Subject: zsh: set GOPATH and add bin folder to PATH --- tag-zsh/config/zsh/zshenv | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index 0cc65be4..5aeb0e7e 100755 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -1,10 +1,13 @@ # -*- mode: sh; -*- +export GOPATH="$HOME/projects/go" + if [[ $defpath == "" && -d ~/bin ]] then defpath=($path) path=( $defpath ~/bin + $GOPATH/bin ) if [[ -d ~/.gem/ruby/*/bin ]] then -- cgit 1.4.1 From 26fdc8f943e8cc2549dcaf4bd7126b0911c375c2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 15 May 2014 20:08:04 +0100 Subject: zsh: Remove existance check for ~/bin --- tag-zsh/config/zsh/zshenv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index 5aeb0e7e..e4507446 100755 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -1,7 +1,7 @@ # -*- mode: sh; -*- export GOPATH="$HOME/projects/go" -if [[ $defpath == "" && -d ~/bin ]] +if [[ $defpath == "" ]] then defpath=($path) path=( -- cgit 1.4.1 From 5e989b594d96ddf0d72b117b874c96badca96658 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 15 May 2014 20:09:00 +0100 Subject: Emacs: Sort Cask --- tag-emacs/emacs.d/Cask | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 693e443d..1486ba6a 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -20,8 +20,8 @@ (depends-on "diminish") (depends-on "dired+") (depends-on "discover") -(depends-on "emmet-mode") (depends-on "elisp-slime-nav") +(depends-on "emmet-mode") (depends-on "expand-region") (depends-on "fancy-narrow") (depends-on "flx") -- cgit 1.4.1 From 8b2c247dba335dbf63a9e386d453e95d2b568e5a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 22 May 2014 10:40:55 +0100 Subject: Emacs: add popwin-mode for better window handling --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 1486ba6a..556da4e3 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -54,6 +54,7 @@ (depends-on "paredit") (depends-on "php-extras") (depends-on "php-mode") +(depends-on "popwin") (depends-on "projectile") (depends-on "puppet-mode") (depends-on "quickrun") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index a3877866..565def90 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -994,6 +994,10 @@ (tooltip-mode -1) (tool-bar-mode -1)) +(req-package popwin + :config (progn + (popwin-mode 1))) + (req-package winner :init (progn (winner-mode 1) -- cgit 1.4.1 From 0704610461bf24463b4f6fcea268b60cb3236ef1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 22 May 2014 10:42:12 +0100 Subject: Emacs: Add toggle-window-dedicated command Tells Emacs not to replace the buffer in a window. --- tag-emacs/emacs.d/init.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 565def90..f403d1ee 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -994,6 +994,17 @@ (tooltip-mode -1) (tool-bar-mode -1)) +(defun toggle-window-dedicated () + "Toggle whether the current active window is dedicated or not" + (interactive) + (message + (if (let (window (get-buffer-window (current-buffer))) + (set-window-dedicated-p window + (not (window-dedicated-p window)))) + "Window '%s' is dedicated" + "Window '%s' is normal") + (current-buffer))) + (req-package popwin :config (progn (popwin-mode 1))) -- cgit 1.4.1 From 194dac8613273ce6a7dd8cea784507d5677fe162 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 24 May 2014 19:33:38 +0100 Subject: Emacs: diminish eldoc-mode --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index f403d1ee..0afd5b2e 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -772,6 +772,7 @@ (bind-key "C-S-L" #'mc/edit-lines))) (req-package eldoc + :diminish eldoc-mode :config (progn (eldoc-add-command 'paredit-backward-delete 'paredit-close-round 'autopair-insert-opening) (setq eldoc-idle-delay 0.1))) -- cgit 1.4.1 From ebd29a72ca0d8cc6d543c88f3503fcd690d511c9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 24 May 2014 20:51:48 +0100 Subject: Emacs: add go-projectile for go-based projects --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 556da4e3..38d220d0 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -32,6 +32,7 @@ (depends-on "ggtags") (depends-on "go-eldoc") (depends-on "go-mode") +(depends-on "go-projectile") (depends-on "goto-chg") (depends-on "haskell-mode") (depends-on "helm") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 0afd5b2e..f9a098bd 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -605,6 +605,11 @@ :config (progn (add-hook 'go-mode-hook #'go-eldoc-setup))) +(req-package go-projectile + :require (go-mode go-eldoc projectile) + :config (progn + (setq go-projectile-switch-gopath 'maybe))) + (req-package auto-compile :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) -- cgit 1.4.1 From 486fd3e770609985b16503b531b6ab10cfa1ff40 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 24 May 2014 21:04:54 +0100 Subject: Emacs: switch back to loading sml with req-package --- tag-emacs/emacs.d/init.el | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index f9a098bd..a0efc916 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -474,13 +474,11 @@ (column-number-mode t) (size-indication-mode t) -(add-to-list - 'after-make-frame-functions - (lambda (&optional x) - (require 'smart-mode-line) - (sml/setup) - (sml/apply-theme 'respectful))) - +(req-package smart-mode-line + :require solarized-theme + :config (progn + (setq sml/theme 'respectful) + (sml/setup))) ;;;; Modes ;;;; systemd files -- cgit 1.4.1 From 08aea4ba64f3a076b51c9da88be619aa96fa90a4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 31 May 2014 17:44:45 +0100 Subject: Emacs: Only use GNU ls on OSX when found --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index a0efc916..cfa417e8 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -219,7 +219,7 @@ dired-recursive-copies 'top dired-recursive-deletes 'top dired-bind-jump nil) - (when (eq system-type 'darwin) + (when (and (eq system-type 'darwin) (executable-find "gls")) (setq insert-directory-program "/usr/local/bin/gls")) (put 'dired-find-alternate-file 'disabled nil))) -- cgit 1.4.1 From fbf0bb2fb22697ea5135542837dcb12181817321 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 31 May 2014 17:45:05 +0100 Subject: Emacs: fix tramp proxy for local machine Incorrect quoting form --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index cfa417e8..cc1048f9 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -300,7 +300,7 @@ (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 `(,(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)))) -- cgit 1.4.1 From 39cf1dc66cd86152b3f61ea39e32238c91709ff7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 31 May 2014 17:45:54 +0100 Subject: Emacs: Use fonts from the system on OSX --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index cc1048f9..e357e992 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -99,7 +99,7 @@ ((eq window-system 'w32) (ap/set-fonts "Consolas" "Segoe UI" 10)) ((eq system-type 'darwin) - (ap/set-fonts "Droid Sans Mono" "Helvetica_Neue" 14)))) + (ap/set-fonts "Menlo" "Helvetica" 14)))) ;;;; Autosaves & Backups (let ((backup-dir (expand-file-name "~/.emacs.d/backups/"))) -- cgit 1.4.1 From ef6d2fe05de4c244ac880c849383dcb0c5d3919e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 31 May 2014 23:01:42 +0100 Subject: Emacs: add keybind for quickrun --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index e357e992..a30d6c05 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -621,7 +621,8 @@ c-basic-offset 4) (c-set-offset 'case-label '+))) -(req-package quickrun) +(req-package quickrun + :bind (("C-c C-e" . quickrun))) ;;;; Projects -- cgit 1.4.1 From 60e708caf5749afa62b513a4eb6f1b44a81c6352 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 1 Jun 2014 09:46:22 +0100 Subject: Emacs: Bind s-k to kill-this-buffer --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index a30d6c05..38bc34ee 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -384,6 +384,7 @@ (unbind-key "s-n") (unbind-key "s-p") (unbind-key "s-w") +(bind-key "s-k" #'kill-this-buffer) (bind-key "s-x" (define-prefix-command 'super-x-map)) -- cgit 1.4.1 From 8fc6d71a515a7023b3f9368242d624b60ba14159 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 1 Jun 2014 09:46:42 +0100 Subject: Emacs: Make fonts smaller on OSX. HiDPI displays! --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 38bc34ee..ab5be02f 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -99,7 +99,7 @@ ((eq window-system 'w32) (ap/set-fonts "Consolas" "Segoe UI" 10)) ((eq system-type 'darwin) - (ap/set-fonts "Menlo" "Helvetica" 14)))) + (ap/set-fonts "Menlo" "Helvetica" 12)))) ;;;; Autosaves & Backups (let ((backup-dir (expand-file-name "~/.emacs.d/backups/"))) -- cgit 1.4.1 From 3d9fbb2a793e60a503692e000cae19d7ef96fa54 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 1 Jun 2014 14:21:06 +0100 Subject: Zsh: hide error when fasd init file missing Now show a warning instead --- tag-zsh/config/zsh/zshrc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 26819621..067c517d 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -356,7 +356,12 @@ ec () { _FASD_DATA="$HOME/.cache/zsh/fasd-data" autoload -U fasd -source ~/.cache/zsh/fasd-init-zsh +if [[ -e ~/.cache/zsh/fasd-init-zsh ]] +then + source ~/.cache/zsh/fasd-init-zsh +else + echo "fasd init file is missing." +fi if [[ $OSTYPE == freebsd* ]]; then source $ZDOTDIR/freebsd.zsh -- cgit 1.4.1 From 8c73db305410b15b1a3f85df8f8add61fadcdd55 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 1 Jun 2014 14:26:02 +0100 Subject: Add rcrc.local for Studio-40 laptop --- host-ap-s40.local/rcrc.local | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 host-ap-s40.local/rcrc.local diff --git a/host-ap-s40.local/rcrc.local b/host-ap-s40.local/rcrc.local new file mode 100644 index 00000000..0cecf5d1 --- /dev/null +++ b/host-ap-s40.local/rcrc.local @@ -0,0 +1,2 @@ +DOTFILES_DIRS="$HOME/projects/dotfiles" +TAGS="emacs git hg tmux vagrant zsh" \ No newline at end of file -- cgit 1.4.1 From 895d35abcddd3c16241964f077595f09de2d08df Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 1 Jun 2014 14:26:55 +0100 Subject: zsh: use gh instead of hub --- tag-zsh/config/zsh/zshrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 067c517d..9f1f66fe 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -271,10 +271,10 @@ alias -g ...='../..' #Suffix aliases alias -s log=less -if [[ -e =hub ]]; then - alias git="hub" +if [[ -e =gh ]]; then + alias git="gh" autoload -U _hub - compdef _hub hub + compdef _hub gh fi # Functions -- cgit 1.4.1 From a21fc6720e4353777073b51f18a4fb76ce530f78 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 1 Jun 2014 15:05:05 +0100 Subject: Emacs: show package load times --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index ab5be02f..93948c30 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -40,6 +40,7 @@ (require 'cask)) (cask-initialize) +(setq use-package-verbose t) (require 'req-package) (req-package pallet) -- cgit 1.4.1 From 2ab61a13e5a9eb78756d330b99ec4e8fa9c764b6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 1 Jun 2014 15:08:31 +0100 Subject: Emacs: ensure blink-cursor-mode is off --- tag-emacs/emacs.d/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 93948c30..7c25e79e 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -76,6 +76,9 @@ jit-lock-chunk-size 1000 jit-lock-defer-time 0.01) +(when (fboundp #'blink-cursor-mode) + (blink-cursor-mode -1)) + (req-package solarized-theme :config (load-theme 'solarized-light t)) -- cgit 1.4.1 From 754a1cb21cdc2150d0bef4b88ec247af9be5e04f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 2 Jun 2014 09:56:22 +0100 Subject: Emacs: Make GNU ls detection path-specific --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 7c25e79e..635733fd 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -224,7 +224,7 @@ dired-recursive-deletes 'top dired-bind-jump nil) (when (and (eq system-type 'darwin) (executable-find "gls")) - (setq insert-directory-program "/usr/local/bin/gls")) + (setq insert-directory-program (executable-find "gls"))) (put 'dired-find-alternate-file 'disabled nil))) (req-package dired-x -- cgit 1.4.1 From 63eb0e567afa15801f5f60ddf6e04a78bb565822 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 4 Jun 2014 13:52:50 +0100 Subject: zsh: Alias composer to composer.phar if missing --- 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 9f1f66fe..5c6b32ab 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -277,6 +277,10 @@ if [[ -e =gh ]]; then compdef _hub gh fi +if [[ -n $commands[composer.phar] && ! -n $commands[composer] ]]; then + alias composer="composer.phar" +fi + # Functions magit () { -- cgit 1.4.1 From 54140d630b30b65ec656ddc848ce56dd87f64ad8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 4 Jun 2014 16:41:47 +0100 Subject: Emacs: don't force ssh usernames --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 635733fd..cd798bff 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -295,7 +295,7 @@ (req-package tramp :config (progn (setq tramp-default-method (if (eq system-type 'windows-nt) "plinkx" "ssh") - tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root") (nil nil "alan")) + 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) -- cgit 1.4.1 From d8002787cc9d6862b5c3700a60e1f5181d775208 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 4 Jun 2014 16:42:02 +0100 Subject: Emacs: ring the bell a bit less often --- tag-emacs/emacs.d/init.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index cd798bff..b4b5a92b 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -79,6 +79,12 @@ (when (fboundp #'blink-cursor-mode) (blink-cursor-mode -1)) +(setq ring-bell-function + (lambda () + (unless (memq this-command + '(isearch-abort abort-recursive-edit exit-minibuffer keyboard-quit undo-tree-undo)) + (ding)))) + (req-package solarized-theme :config (load-theme 'solarized-light t)) -- cgit 1.4.1 From 5854d164cf1462795073dabc061a1d530b3620fe Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 5 Jun 2014 17:52:06 +0100 Subject: Emacs: switch PHP to Symfony style :( --- tag-emacs/emacs.d/init.el | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index b4b5a92b..45d06ff8 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -947,27 +947,7 @@ (bind-key "C-h C-f" #'php-search-documentation php-mode-map) (unbind-key "C-c C-f" php-mode-map) (unbind-key "C-." php-mode-map) - (c-add-style "ap" - '((c-basic-offset . 4) - (c-offsets-alist . ((arglist-cont . php-lineup-arglist) - (arglist-intro . php-lineup-arglist-intro) - (arglist-close . php-lineup-arglist-close) - (topmost-intro-cont . (first c-lineup-cascaded-calls - php-lineup-arglist-intro)) - (brace-list-intro . +) - (brace-list-entry . c-lineup-cascaded-calls) - (case-label . 4) - (statement-case-intro . 4) - (defun-close . 0) - (defun-block-intro . +) - (knr-argdecl . [0]) - (arglist-cont-nonempty . c-lineup-cascaded-calls) - (statement-cont . php-lineup-hanging-semicolon))))) - (defun ap/php-style () - (setq indent-tabs-mode t - c-indent-comments-syntactically-p t) - (c-set-style "ap")) - (add-hook 'php-mode-hook #'ap/php-style) + (setq php-mode-coding-style "Symfony2") (add-hook 'php-mode-hook #'turn-on-eldoc-mode))) (req-package sgml-mode -- cgit 1.4.1 From d7e339ebccbc364046373e01c660527fa781ca79 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 5 Jun 2014 17:55:43 +0100 Subject: Emacs: setup org-mobile, syncing via Dropbox --- tag-emacs/emacs.d/init.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 45d06ff8..e8f8fb25 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -585,6 +585,11 @@ :config (progn (setq org-journal-date-format "%A, %d %B %Y"))) +(req-package org-mobile + :require org + :config (progn + (setq org-mobile-directory "~/Dropbox/MobileOrg"))) + ;;;; Programming (req-package cedet -- cgit 1.4.1 From 04ecc495b78f33adf37967198e7b030d50f2b869 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 6 Jun 2014 15:46:16 +0100 Subject: Emacs: open twig files in web-mode --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index e8f8fb25..39710324 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -965,6 +965,7 @@ (req-package web-mode :mode (("/views/.*\\.php\\'" . web-mode) + ("\\.html\\.twig\\'" . web-mode) ("/templates/.*\\.php\\'" . web-mode)) :config (setq web-mode-code-indent-offset 4 web-mode-css-indent-offset 4 -- cgit 1.4.1 From ba3a8cc428cfa2a5fd95919070018aee26cdb972 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 6 Jun 2014 19:39:20 +0100 Subject: Emacs: install toml-mode --- tag-emacs/emacs.d/Cask | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 38d220d0..b2fcdd64 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -70,6 +70,7 @@ (depends-on "smart-tabs-mode") (depends-on "smex") (depends-on "solarized-theme") +(depends-on "toml-mode") (depends-on "tup-mode") (depends-on "undo-tree") (depends-on "use-package") -- cgit 1.4.1 From 3608af91ffe95569272d655b5fc111de60e446c6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 8 Jun 2014 15:01:36 +0100 Subject: Emacs: Set sentences to end with two spaces --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 39710324..176d6ee8 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -730,7 +730,7 @@ ;; Enable upcase and downcase-region (put 'upcase-region 'disabled nil) (put 'downcase-region 'disabled nil) -(setq sentence-end-double-space nil +(setq sentence-end-double-space t line-move-visual nil) (setq x-select-enable-clipboard t) -- cgit 1.4.1 From e84d46099500cc08c2accc8228a24062da680867 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 8 Jun 2014 15:01:49 +0100 Subject: Emacs: Add command to insert date and time --- tag-emacs/emacs.d/init.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 176d6ee8..5babb056 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -220,6 +220,14 @@ ((equal prefix '(16)) "%A, %d %B %Y")))) (insert (format-time-string format)))) +(defun insert-datetime (prefix) + "Insert the currrent 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)))) + ;;;; Directory browsing (req-package dired :config (progn -- cgit 1.4.1 From 2ef5062c3047585928f40493eb76e08cd66ba389 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 8 Jun 2014 15:02:03 +0100 Subject: zsh: Complete gh commands with _gh, not _hub --- tag-zsh/config/zsh/zshrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 5c6b32ab..39ae5ec6 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -273,8 +273,7 @@ alias -s log=less if [[ -e =gh ]]; then alias git="gh" - autoload -U _hub - compdef _hub gh + compdef _gh gh fi if [[ -n $commands[composer.phar] && ! -n $commands[composer] ]]; then -- cgit 1.4.1 From 1c36c5113627e526acf00f97418c1624f0982003 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 9 Jun 2014 11:13:32 +0100 Subject: Emacs: Disable autopair in web-mode --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 5babb056..fcb62303 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -781,6 +781,7 @@ (add-hook 'prog-mode-hook #'autopair-on) (defun autopair-off () (autopair-mode -1)) + (add-hook 'web-mode-hook #'autopair-off) (add-hook 'lisp-common-mode-hook #'autopair-off) (setq autopair-blink nil autopair-skip-whitespace nil))) -- cgit 1.4.1 From 109a3239c2f2832aeb062c08c40063149b5f1eb3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 9 Jun 2014 15:07:25 +0100 Subject: Emacs: Disable smart-tabs in php-mode I do not like PSR-1. Ah well. --- tag-emacs/emacs.d/init.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index fcb62303..404f1aa7 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -366,8 +366,7 @@ smart-tabs-mode-enable smart-tabs-advice) :config (progn - (smart-tabs-insinuate 'c 'javascript 'cperl 'python) - (add-hook 'php-mode-hook #'smart-tabs-mode-enable))) + (smart-tabs-insinuate 'c 'javascript 'cperl 'python))) ;;;; Keybindings -- cgit 1.4.1 From afeab94a90c3c42d115e1986752ac1e8ca66f39c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 10 Jun 2014 19:29:45 +0100 Subject: Emacs: enable web-mode in hugo theme layouts --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 404f1aa7..b1c1b7a6 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -974,6 +974,7 @@ (req-package web-mode :mode (("/views/.*\\.php\\'" . web-mode) ("\\.html\\.twig\\'" . web-mode) + ("/layouts/.*\\.html" . web-mode) ("/templates/.*\\.php\\'" . web-mode)) :config (setq web-mode-code-indent-offset 4 web-mode-css-indent-offset 4 -- cgit 1.4.1 From 2236fa83756d3f66110593b8d917ca06cec7d869 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 10 Jun 2014 19:35:28 +0100 Subject: Emacs: Set smart-tabs-mode from indent-tabs-mode --- tag-emacs/emacs.d/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index b1c1b7a6..438db55b 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -366,6 +366,8 @@ smart-tabs-mode-enable smart-tabs-advice) :config (progn + (add-hook 'php-mode-hook (lambda () + (smart-tabs-mode indent-tabs-mode))) (smart-tabs-insinuate 'c 'javascript 'cperl 'python))) ;;;; Keybindings -- cgit 1.4.1 From 002f879a2184ddc39a07363a0384c5bcdc01d7ff Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 10 Jun 2014 19:37:02 +0100 Subject: Emacs: Rebind s-, to edit init.el via imenu --- tag-emacs/emacs.d/init.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 438db55b..aa2acb5a 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -407,9 +407,7 @@ (bind-key "s-x" (define-prefix-command 'super-x-map)) -(bind-key "s-," (lambda () - (interactive) - (jump-to-register ?e))) +(bind-key "s-," #'init-imenu) (set-register ?e `(file . ,*init-file*)) (set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) -- cgit 1.4.1 From 50cb6462e21486acae48109fb0cb6bf87573f060 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 11 Jun 2014 14:03:37 +0100 Subject: Emacs: add gist package --- tag-emacs/emacs.d/Cask | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index b2fcdd64..ba2d1aa8 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -30,6 +30,7 @@ (depends-on "framemove") (depends-on "geiser") (depends-on "ggtags") +(depends-on "gist") (depends-on "go-eldoc") (depends-on "go-mode") (depends-on "go-projectile") -- cgit 1.4.1 From fe1d933805b550e8f4c77d978b5503b2238243e8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 11 Jun 2014 19:19:14 +0100 Subject: Emacs: Install tools for Platinum Searcher --- tag-emacs/emacs.d/Cask | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index b2fcdd64..5be05319 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -57,6 +57,7 @@ (depends-on "php-mode") (depends-on "popwin") (depends-on "projectile") +(depends-on "pt") (depends-on "puppet-mode") (depends-on "quickrun") (depends-on "redshank") @@ -76,4 +77,5 @@ (depends-on "use-package") (depends-on "visual-regexp") (depends-on "web-mode") +(depends-on "wgrep-pt") (depends-on "yaml-mode") \ No newline at end of file -- cgit 1.4.1 From b8b93e58c61c173503450105314edbce9b5bfd8b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 12 Jun 2014 21:51:34 +0100 Subject: Emacs: diminish redshank and paredit --- tag-emacs/emacs.d/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index aa2acb5a..5b8dc7ae 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -806,6 +806,7 @@ (setq eldoc-idle-delay 0.1))) (req-package paredit + :diminish "()" :commands (paredit-mode) :init (progn (add-hook 'lisp-common-mode-hook #'enable-paredit-mode) @@ -877,6 +878,7 @@ run-racket)) (req-package redshank + :diminish " Λ" :init (progn (add-hook 'lisp-common-mode-hook #'turn-on-redshank-mode))) -- cgit 1.4.1 From c5115c431e9bcd04cc2753e109a6fae7b97d439c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 12 Jun 2014 21:52:10 +0100 Subject: Emacs: simplify flycheck diminish call --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 5b8dc7ae..82b7187d 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -609,7 +609,7 @@ (global-semantic-decoration-mode t))) (req-package flycheck - :diminish (flycheck-mode . " ✓") + :diminish " ✓" :init (global-flycheck-mode)) (req-package company-go -- cgit 1.4.1 From 89e7a9363975172443cfdcd87cc525076d11d64c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 12 Jun 2014 21:55:03 +0100 Subject: Emacs: bind magit-status keys to projectile-vc More general, and won't have to find the .git folder every time as projectile will already know the project root. --- tag-emacs/emacs.d/init.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 82b7187d..f7b8d471 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -651,7 +651,9 @@ (req-package projectile :bind (("C-c C-f" . projectile-find-file) - ("s-x s-f" . projectile-find-file)) + ("s-x s-f" . projectile-find-file) + ("C-x g" . projectile-vc) + ("s-G" . projectile-vc)) :init (projectile-global-mode) :diminish projectile-mode :config (progn @@ -670,8 +672,6 @@ (req-package magit :diminish magit-auto-revert-mode :commands (magit-status) - :bind (("C-x g" . magit-status) - ("s-G" . magit-status)) :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) ;;;; Spelling -- cgit 1.4.1 From d03c4dcd2afc75d6b906c780a009a3ea4e306c7d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 14 Jun 2014 19:11:05 +0100 Subject: Emacs: enable tabs in nginx configuration --- tag-emacs/emacs.d/init.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index f7b8d471..ebf40232 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -513,7 +513,9 @@ ("xmobarrc\\'" . haskell-mode))) (req-package nginx-mode - :mode (("nginx.conf" . nginx-mode))) + :mode (("nginx.conf" . nginx-mode)) + :config (progn + (setq nginx-indent-tabs-mode t))) (req-package lua-mode :mode (("\\.lua\\'" . lua-mode))) -- cgit 1.4.1 From 7a98af7e942ea7260dbe72abf104f9aef20c4f20 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 14 Jun 2014 19:11:16 +0100 Subject: Emacs: enable autopair in yaml and text modes --- tag-emacs/emacs.d/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index ebf40232..3a170586 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -780,6 +780,8 @@ autopair-on) :init (progn (add-hook 'prog-mode-hook #'autopair-on) + (add-hook 'text-mode-hook #'autopair-on) + (add-hook 'yaml-mode-hook #'autopair-on) (defun autopair-off () (autopair-mode -1)) (add-hook 'web-mode-hook #'autopair-off) -- cgit 1.4.1 From 0f98e883199c4a0fe4d70e5f5f13620574c72440 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 15 Jun 2014 14:44:58 +0100 Subject: Emacs: install perspective and persp-projectile --- tag-emacs/emacs.d/Cask | 2 ++ tag-emacs/emacs.d/init.el | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 107e0241..26e8bae5 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -54,6 +54,8 @@ (depends-on "pallet") (depends-on "paradox") (depends-on "paredit") +(depends-on "persp-projectile") +(depends-on "perspective") (depends-on "php-extras") (depends-on "php-mode") (depends-on "popwin") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 3a170586..ce3b7b1e 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -662,6 +662,12 @@ (setq projectile-switch-project-action #'projectile-dired projectile-remember-window-configs t))) +(req-package perspective + :config (persp-mode)) + +(req-package persp-projectile + :require (projectile perspective)) + (req-package vc :config (progn (setq vc-follow-symlinks t))) -- cgit 1.4.1 From a6a88661b160dea1f2b59396f2dbdd2a5a843230 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 21 Jun 2014 19:54:05 +0100 Subject: Emacs: Defer loading of go-mode --- tag-emacs/emacs.d/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index ce3b7b1e..dc508780 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -614,6 +614,9 @@ :diminish " ✓" :init (global-flycheck-mode)) +(req-package go-mode + :mode (("\\.go\\'" . go-mode))) + (req-package company-go :require go-mode :config (progn -- cgit 1.4.1 From dc03c852e4195b20a25d333690f40f04b6190519 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 21 Jun 2014 22:37:18 +0100 Subject: Emacs: defer package loading for faster init --- tag-emacs/emacs.d/init.el | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index dc508780..fbbef023 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -45,10 +45,9 @@ (req-package pallet) (req-package paradox - :init (progn - (when paradox-github-token - (paradox-enable)) - (setq paradox-automatically-star t))) + :defer t + :config (progn + (setq paradox-automatically-star t))) ;;;; Style @@ -167,6 +166,7 @@ ;;;; Communication (req-package erc + :defer t :config (progn (setq erc-user-full-name "Alan Pearce" erc-email-userid "alan@alanpearce.co.uk" @@ -206,6 +206,7 @@ ;;;; Dates & Times (req-package calendar + :defer t :config (progn (setq calendar-week-start-day 1) (calendar-set-date-style 'iso))) @@ -230,6 +231,7 @@ ;;;; Directory browsing (req-package dired + :defer t :config (progn (bind-key "" #'dired-find-file dired-mode-map) (bind-key "^" (lambda () (interactive) (find-alternate-file "..")) dired-mode-map) @@ -307,6 +309,7 @@ (setq save-place-file (expand-file-name ".saveplace" user-emacs-directory)))) (req-package tramp + :defer t :config (progn (setq tramp-default-method (if (eq system-type 'windows-nt) "plinkx" "ssh") tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root")) @@ -324,11 +327,13 @@ (req-package tramp-sh :require tramp + :defer t :config (progn (add-to-list 'tramp-remote-path "/usr/local/sbin") (add-to-list 'tramp-remote-path "~/bin"))) (req-package ediff + :defer t :config (progn (setq ediff-split-window-function 'split-window-horizontally ediff-window-setup-function 'ediff-setup-windows-plain))) @@ -640,6 +645,7 @@ :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) (req-package cc-mode + :defer t :init (progn (add-hook 'c-mode-common-hook #'electric-indent-mode)) :config (progn @@ -892,6 +898,7 @@ (req-package redshank :diminish " Λ" + :defer t :init (progn (add-hook 'lisp-common-mode-hook #'turn-on-redshank-mode))) @@ -945,6 +952,9 @@ ;;;; Web Development (req-package skewer-mode + :commands (skewer-mode + skewer-html-mode + skewer-css-mode) :init (progn (add-hook 'js2-mode-hook #'skewer-mode) (add-hook 'html-mode-hook #'skewer-html-mode) @@ -979,12 +989,14 @@ (add-hook 'php-mode-hook #'turn-on-eldoc-mode))) (req-package sgml-mode + :defer t :config (setq sgml-basic-offset 4)) (req-package emmet-mode - :config (progn - (if (functionp 'web-mode) - (add-hook 'web-mode-hook #'emmet-mode)))) + :commands (emmet-mode) + :init (progn + (if (functionp 'web-mode) + (add-hook 'web-mode-hook #'emmet-mode)))) (req-package web-mode :mode (("/views/.*\\.php\\'" . web-mode) -- cgit 1.4.1 From fdead2d11316c1acb06027765d01a81071bcf34d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 21 Jun 2014 22:49:21 +0100 Subject: Emacs: remove ERC configuration --- tag-emacs/emacs.d/init.el | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index fbbef023..8caf1c76 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -165,21 +165,6 @@ ;;;; Communication -(req-package erc - :defer t - :config (progn - (setq erc-user-full-name "Alan Pearce" - erc-email-userid "alan@alanpearce.co.uk" - erc-echo-notice-in-minibuffer t - erc-keywords '("alanpearce" "lethalrocks") - erc-autojoin-channels-alist - '(("freenode.net" "#emacs" "##freebsd" "#bufferbloat" "#openwrt" "#lojban" "#zfs" "#introverts") - ("what.cd" "#what.cd") - ("beusergroup.co.uk" "#be"))) - (add-to-list 'erc-modules 'scrolltobottom) - (add-to-list 'erc-modules 'autojoin) - (add-to-list 'erc-modules 'match))) - (setq message-send-mail-function 'smtpmail-send-it) (setq smtpmail-smtp-server "external.home" smtpmail-smtp-service 587) -- cgit 1.4.1 From 562154e68c8ff3f1a02b53c92689e15632475d13 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 21 Jun 2014 22:55:13 +0100 Subject: Emacs: defer loading of more modes --- tag-emacs/emacs.d/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 8caf1c76..2c0cd72b 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -55,6 +55,7 @@ :config (setq linum-format " %4d ")) (req-package whitespace + :defer t :config (setq whitespace-style '(face space @@ -721,6 +722,7 @@ (bind-key "C-c S" #'eshell-goto-current-dir) (req-package shell + :defer t :config (define-key shell-mode-map (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) @@ -804,6 +806,7 @@ (bind-key "C-S-L" #'mc/edit-lines))) (req-package eldoc + :commands (eldoc-mode) :diminish eldoc-mode :config (progn (eldoc-add-command 'paredit-backward-delete 'paredit-close-round 'autopair-insert-opening) -- cgit 1.4.1 From f4eb0fcd6a9e2d4a035ff71533c96a806ef15304 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 22 Jun 2014 08:53:58 +0100 Subject: Emacs: ido-completing read all the things! --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 2c0cd72b..2b2059ef 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -429,7 +429,8 @@ :init (progn (setq ido-save-directory-list-file (expand-file-name "ido-state" user-emacs-directory)) (bind-key* "C-x C-f" #'ido-find-file) - (ido-mode 1)) + (ido-mode 1) + (ido-everywhere 1)) :config (progn (setq ido-auto-merge-delay-time 99999 ido-enable-flex-matching t) -- cgit 1.4.1 From a8f44b320cdbfb7921f78c03833fcba41df0be49 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 22 Jun 2014 09:02:15 +0100 Subject: Emacs: use dired-x-find-file over ido-find-file Gains find-file-at-point functionality. With ido-everywhere, still uses ido. --- tag-emacs/emacs.d/init.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 2b2059ef..7bf5ab63 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -230,7 +230,9 @@ (put 'dired-find-alternate-file 'disabled nil))) (req-package dired-x - :require dired) + :require dired + :init (progn + (setq dired-x-hands-off-my-keys nil))) (req-package dired+ :require dired @@ -428,8 +430,7 @@ :bind (("C-x b" . ido-switch-buffer)) :init (progn (setq ido-save-directory-list-file (expand-file-name "ido-state" user-emacs-directory)) - (bind-key* "C-x C-f" #'ido-find-file) - (ido-mode 1) + (ido-mode 'buffers) (ido-everywhere 1)) :config (progn (setq ido-auto-merge-delay-time 99999 -- cgit 1.4.1 From 2761798d6612725e9e00b984b4f01102e66820ab Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 22 Jun 2014 09:10:17 +0100 Subject: Emacs: re-use directories in dired --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 7bf5ab63..e007c37f 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -239,7 +239,8 @@ :config (progn (diredp-toggle-find-file-reuse-dir 1) (dired-omit-mode 1) - (setq dired-omit-files "#\\|\\.$"))) + (setq dired-omit-files "#\\|\\.$" + dired-find-subdir t))) ;;;; Documentation -- cgit 1.4.1 From bcfbebf031f419cfbaf116a0a3de874884a9402f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 22 Jun 2014 10:19:21 +0100 Subject: Emacs: fix error when byte-compiling --- tag-emacs/emacs.d/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index e007c37f..04c5f594 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -37,8 +37,8 @@ (eval-and-compile (add-to-list 'load-path (expand-file-name "~/.cask")) - (require 'cask)) -(cask-initialize) + (require 'cask) + (cask-initialize)) (setq use-package-verbose t) (require 'req-package) -- cgit 1.4.1 From 06b83d00a72d13eb536585a0c270cea0621b84b8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 24 Jun 2014 16:22:18 +0100 Subject: Emacs: use ws-butler instead of crude hook Now I'm not changing all the whitespace all the time! --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 26e8bae5..4edb855f 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -81,4 +81,5 @@ (depends-on "visual-regexp") (depends-on "web-mode") (depends-on "wgrep-pt") +(depends-on "ws-butler") (depends-on "yaml-mode") \ No newline at end of file diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 04c5f594..49b6e8c1 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -255,8 +255,6 @@ (setq-default buffer-file-coding-system 'utf-8-auto-unix) (global-auto-revert-mode 1) -(add-hook 'before-save-hook #'delete-trailing-whitespace) - (defun rename-current-buffer-file () "Renames current buffer and file it is visiting." (interactive) @@ -288,6 +286,9 @@ (kill-buffer buffer) (message "File '%s' successfully removed" filename))))) +(req-package ws-butler + :config (ws-butler-global-mode 1)) + (req-package recentf :init (progn (setq recentf-auto-cleanup 'never recentf-save-file (expand-file-name "recentf" user-emacs-directory)) -- cgit 1.4.1 From 71e881f267b87df52fa2ea70e132f3317ced441f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 24 Jun 2014 18:34:39 +0100 Subject: zsh: Don't add .gem/ruby/*/bin to $PATH In most cases, setting up .gemrc is better --- tag-zsh/config/zsh/zshenv | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index e4507446..37f65787 100755 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -9,13 +9,6 @@ then ~/bin $GOPATH/bin ) - if [[ -d ~/.gem/ruby/*/bin ]] - then - path=( - $path - ~/.gem/ruby/*/bin - ) - fi fi export PATH -- cgit 1.4.1 From c671bc4d964ce45cf3daa26a989fe00cd9ae4829 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 24 Jun 2014 18:37:01 +0100 Subject: zsh: Add .cabal/bin to $PATH --- tag-zsh/config/zsh/zshenv | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index 37f65787..072e6f73 100755 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -8,6 +8,7 @@ then $defpath ~/bin $GOPATH/bin + ~/.cabal/bin ) fi -- cgit 1.4.1 From 49eafcd2b0ae0e6d9d812f61dffcf6563ad086b7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 24 Jun 2014 18:39:31 +0100 Subject: Emacs: Disable 'reverting buffer…' message --- tag-emacs/emacs.d/init.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 49b6e8c1..1cd34d28 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -253,7 +253,10 @@ (prefer-coding-system 'utf-8-auto-unix) (set-default-coding-systems 'utf-8-auto-unix) (setq-default buffer-file-coding-system 'utf-8-auto-unix) -(global-auto-revert-mode 1) +(req-package autorevert + :init (progn + (global-auto-revert-mode 1) + (setq auto-revert-verbose nil))) (defun rename-current-buffer-file () "Renames current buffer and file it is visiting." -- cgit 1.4.1 From 544384c1882892edc0dc7643e07fe8729b564de8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 24 Jun 2014 18:43:47 +0100 Subject: zsh: Alias 1 to head -n1 --- tag-zsh/config/zsh/zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 39ae5ec6..9d2da84e 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -213,6 +213,7 @@ alias df='df -h' alias du='du -h' alias md='mkdir -p' alias rd='rmdir' +alias 1='head -n1' alias .='source' ls='\ls' -- cgit 1.4.1 From ddcfb1818b220367de3705176e66b6a501512dae Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 25 Jun 2014 09:31:31 +0100 Subject: Emacs: set default font in current and new frames --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 1cd34d28..5c8fdcf4 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -100,7 +100,8 @@ (when mono-face (let ((default-font (concat mono-face "-" (number-to-string font-size)))) (add-to-list 'default-frame-alist `(font . ,default-font)) - (set-face-font 'fixed-pitch default-font))) + (set-face-font 'fixed-pitch default-font) + (set-frame-font default-font t t))) (when variable-face (set-face-font 'variable-pitch (concat variable-face "-" (number-to-string (1+ font-size)))))) -- cgit 1.4.1 From 16f7ed19544f4a6e25bd314bd7adbaa0cab174f8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 25 Jun 2014 09:33:44 +0100 Subject: Emacs: set OSX font to Monaco --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 5c8fdcf4..dc345edf 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -110,7 +110,7 @@ ((eq window-system 'w32) (ap/set-fonts "Consolas" "Segoe UI" 10)) ((eq system-type 'darwin) - (ap/set-fonts "Menlo" "Helvetica" 12)))) + (ap/set-fonts "Monaco" "Helvetica" 12)))) ;;;; Autosaves & Backups (let ((backup-dir (expand-file-name "~/.emacs.d/backups/"))) -- cgit 1.4.1 From 27c017fe0991a28f6a326cf32bdf1e8b11a539a8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 25 Jun 2014 10:51:43 +0100 Subject: zsh: Generalise ec function to work outside daemon --- tag-zsh/config/zsh/zshrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 9d2da84e..451f2121 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -341,14 +341,14 @@ emacs_change_focus () { } ec () { - local visibleFrames - visibleFrames=`emacsclient -e '(length (visible-frame-list))'` + local frameNeeded + frameNeeded=`emacsclient -e '(>= (if (daemonp) 2 1) (length (visible-frame-list)))'` if [[ $? -ne 0 ]]; then print "Daemon not running" return 1 fi - if [[ $visibleFrames -eq 1 ]]; then + if [[ $frameNeeded == 't' ]]; then emacsclient -n -c "$@" && emacs_change_focus else emacs_change_focus -- cgit 1.4.1 From e2f45f697ae4f1efc40ecb234679b33a7d99dc68 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 25 Jun 2014 10:54:55 +0100 Subject: Emacs: remove puppet-mode --- tag-emacs/emacs.d/Cask | 1 - tag-emacs/emacs.d/init.el | 5 ----- 2 files changed, 6 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 4edb855f..9c87513e 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -61,7 +61,6 @@ (depends-on "popwin") (depends-on "projectile") (depends-on "pt") -(depends-on "puppet-mode") (depends-on "quickrun") (depends-on "redshank") (depends-on "req-package") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index dc345edf..bfe11657 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -519,11 +519,6 @@ (req-package lua-mode :mode (("\\.lua\\'" . lua-mode))) -(req-package puppet-mode - :mode (("\\.pp\\'" . puppet-mode)) - :config (progn - (add-hook 'puppet-mode-hook #'autopair-mode))) - (req-package ruby-mode :mode (("\\.rb\\'" . ruby-mode) ("\\.cap\\'" . ruby-mode))) -- cgit 1.4.1 From 7172c6e38f35d6e076dff3af84094c141f2203da Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 25 Jun 2014 14:25:19 +0100 Subject: zsh: dired: take an optional dir argument --- tag-zsh/config/zsh/zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 451f2121..c78f92b9 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -288,7 +288,7 @@ magit () { } dired () { - emacsclient -e "(dired \"$PWD\")" > /dev/null + emacsclient -e "(dired \"${1:-$PWD}\")" > /dev/null } pid () { -- cgit 1.4.1 From 574dcaaf978438e5823bd5422b79d351b4ba73be Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 25 Jun 2014 14:28:47 +0100 Subject: Emacs: add and configure scss-mode --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 9c87513e..8f125c70 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -65,6 +65,7 @@ (depends-on "redshank") (depends-on "req-package") (depends-on "s") +(depends-on "scss-mode") (depends-on "skewer-mode") (depends-on "slime") (depends-on "smart-forward") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index bfe11657..3e241471 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -961,6 +961,11 @@ (setq js2-basic-offset 4 js2-global-externs '("$")))) +(req-package scss-mode + :defer t + :config (progn + (setq scss-compile-at-save nil))) + (req-package mustache-mode :mode (("\\.mustache" . mustache-mode) ("\\.mt\\'" . mustache-mode) -- cgit 1.4.1 From d91dfe6c7766b4b82e886183fc8e50ed9e4cb0bf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 25 Jun 2014 19:25:25 +0100 Subject: Emacs: Add commands to open a work or home project Given that the projects are folders under (work|home)-project-directory which match projectile's own predicates, switch to them with projectile, even if they're not 'known' to it. --- tag-emacs/emacs.d/init.el | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 3e241471..00d595f2 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -32,6 +32,9 @@ (file-name-directory (file-truename init-file)))) "Where the emacs init file really is, passing through symlinks.") +(defvar work-project-directory "~/work") +(defvar home-project-directory "~/projects") + ;;;; Package Management (add-to-list 'load-path (expand-file-name "elisp/" user-emacs-directory)) @@ -657,6 +660,34 @@ :init (projectile-global-mode) :diminish projectile-mode :config (progn + (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/-add-known-subfolder-projects (dir) + (-map #'projectile-add-known-project (ap/subfolder-projects dir))) + + (defun ap/add-known-subfolder-projects () + (interactive) + (ap/-add-known-subfolder-projects (ido-read-directory-name "Add projects under: "))) + + (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))) -- cgit 1.4.1 From da007352106856ff40e74fdd8338ad962d033aaa Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 25 Jun 2014 21:26:28 +0100 Subject: Revert "Emacs: use dired-x-find-file over ido-find-file" This reverts commit a8f44b320cdbfb7921f78c03833fcba41df0be49. --- tag-emacs/emacs.d/init.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 00d595f2..88a56aa7 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -234,9 +234,7 @@ (put 'dired-find-alternate-file 'disabled nil))) (req-package dired-x - :require dired - :init (progn - (setq dired-x-hands-off-my-keys nil))) + :require dired) (req-package dired+ :require dired @@ -439,7 +437,8 @@ :bind (("C-x b" . ido-switch-buffer)) :init (progn (setq ido-save-directory-list-file (expand-file-name "ido-state" user-emacs-directory)) - (ido-mode 'buffers) + (bind-key* "C-x C-f" #'ido-find-file) + (ido-mode 1) (ido-everywhere 1)) :config (progn (setq ido-auto-merge-delay-time 99999 -- cgit 1.4.1 From 91dfffa76ff0d7c03a2c65c72e955b7409578697 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 25 Jun 2014 21:28:10 +0100 Subject: Emacs: use unicode ido-vertical-decorations --- tag-emacs/emacs.d/init.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 88a56aa7..ca684a5f 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -461,6 +461,21 @@ (req-package ido-vertical-mode :require ido + :init (progn + (setq ido-vertical-decorations '("\n❯ " + "" + "\n " + "\n …" + "[" + "]" + " [No match]" + " [Matched]" + " [Not readable]" + " [Too big]" + " [Confirm]" + "\n❯ " + "" + ))) :config (ido-vertical-mode 1)) (req-package flx-ido -- cgit 1.4.1 From 22db368a72cf34fc7a0a326afe2f38efd42ed171 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 25 Jun 2014 22:13:04 +0100 Subject: zsh: Generalise '1' alias to 1‒5 and -1‒-5 (tail) --- tag-zsh/config/zsh/zshrc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index c78f92b9..b7688921 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -213,7 +213,11 @@ alias df='df -h' alias du='du -h' alias md='mkdir -p' alias rd='rmdir' -alias 1='head -n1' +for ((i = 1; i <= 5; i++)) +do + alias $i="head -n$i" + alias -$i="tail -n$i" +done alias .='source' ls='\ls' -- cgit 1.4.1 From e2f91f42974029f7d6f08b78573c0ab5079fb484 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 25 Jun 2014 22:19:54 +0100 Subject: rcm: Fix zsh compilation error when missing fasd --- hooks/post-up/zsh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hooks/post-up/zsh b/hooks/post-up/zsh index dda5ec9b..f4720813 100755 --- a/hooks/post-up/zsh +++ b/hooks/post-up/zsh @@ -13,17 +13,16 @@ then mkdir -p ~/.cache/zsh fi +local -a zfiles +zfiles=($ZDOTDIR/zshrc) + fasd_cache=~/.cache/zsh/fasd-init-zsh if [[ -s $commands[fasd] && (! -s "$fasd_cache" || $commands[fasd] -nt "$fasd_cache") ]]; then fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache" + zfiles=($fasd_cache $zfiles) fi autoload -U zrecompile -local -a zfiles -zfiles=( - $fasd_cache - $ZDOTDIR/zshrc -) if [[ -f $ZDOTDIR/${HOST%%.*}.zsh ]]; then zfiles+=$ZDOTDIR/${HOST%%.*}.zsh -- cgit 1.4.1 From 5e2fa4e77e3f6af0707336b3f0b7e72f7d2c9335 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 26 Jun 2014 09:21:20 +0100 Subject: Emacs: fix relative paths with subfolder-projects --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index ca684a5f..3166878d 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -682,7 +682,7 @@ (-filter #'file-directory-p (directory-files dir t "\\<"))))) (defun ap/-add-known-subfolder-projects (dir) - (-map #'projectile-add-known-project (ap/subfolder-projects dir))) + (-map #'projectile-add-known-project (--map (concat (file-name-as-directory dir) it) (ap/subfolder-projects dir)))) (defun ap/add-known-subfolder-projects () (interactive) -- cgit 1.4.1 From bd365b200052448d0df1e53cc4949c3923710ecc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 26 Jun 2014 11:42:59 +0100 Subject: Emacs: show completions from multiple backends Now gtags candidates can be shown alongside native php candidates, for example. --- tag-emacs/emacs.d/init.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 3166878d..5da868ef 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -190,7 +190,9 @@ :bind (("C-" . company-complete)) :init (progn (add-hook 'prog-mode-hook #'company-mode) - (setq company-idle-delay .3 + (setq company-backends '((php-extras-company company-elisp company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-ropemacs company-cmake company-capf company-gtags company-dabbrev-code company-etags company-keywords) + company-oddmuse company-files company-dabbrev) + company-idle-delay .3 company-begin-commands '(self-insert-command)))) ;;;; Dates & Times -- cgit 1.4.1 From f8e76c71df04bec1831d8a50566b383d83c8640a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 26 Jun 2014 15:18:07 +0100 Subject: Emacs: Fix company completion double-paren issue --- tag-emacs/emacs.d/init.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 5da868ef..64915ff5 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -193,7 +193,9 @@ (setq company-backends '((php-extras-company company-elisp company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-ropemacs company-cmake company-capf company-gtags company-dabbrev-code company-etags company-keywords) company-oddmuse company-files company-dabbrev) company-idle-delay .3 - company-begin-commands '(self-insert-command)))) + company-begin-commands '(self-insert-command) + company-auto-complete t + company-auto-complete-chars '(?\ ?\( ?\) ?.)))) ;;;; Dates & Times -- cgit 1.4.1 From cdc03d8503d482e037aa3d359c12daeb5420f472 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 26 Jun 2014 19:01:14 +0100 Subject: Add gemrc file for user-installs to common bin folder --- gemrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 gemrc diff --git a/gemrc b/gemrc new file mode 100644 index 00000000..aaa70a93 --- /dev/null +++ b/gemrc @@ -0,0 +1 @@ +gem: --user-install -n~/bin \ No newline at end of file -- cgit 1.4.1 From 7e4e4c85c4be50e9ae118dae80cee2c2da7a13ef Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 26 Jun 2014 20:59:08 +0100 Subject: Emacs: Start server unless running as daemon --- tag-emacs/emacs.d/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 64915ff5..f90a7af9 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1107,3 +1107,6 @@ (setq ns-pop-up-frames nil)) (req-package-finish) + +(unless (daemonp) + (server-start)) -- cgit 1.4.1 From 633fbba491437afd5bfffb02320edc4bfb98766f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 26 Jun 2014 21:03:17 +0100 Subject: Emacs: more deferred loading --- tag-emacs/emacs.d/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index f90a7af9..b5e58118 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -652,6 +652,7 @@ (setq go-projectile-switch-gopath 'maybe))) (req-package auto-compile + :defer t :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) (req-package cc-mode @@ -716,6 +717,7 @@ :require (projectile perspective)) (req-package vc + :defer t :config (progn (setq vc-follow-symlinks t))) -- cgit 1.4.1 From 30758cdbf16a316de460309e98a1a8c6e0da9b29 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 27 Jun 2014 08:50:05 +0100 Subject: Emacs: Only complete when explicitly requested --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index b5e58118..659b3b12 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -194,7 +194,7 @@ company-oddmuse company-files company-dabbrev) company-idle-delay .3 company-begin-commands '(self-insert-command) - company-auto-complete t + company-auto-complete #'company-explicit-action-p company-auto-complete-chars '(?\ ?\( ?\) ?.)))) ;;;; Dates & Times -- cgit 1.4.1 From 85578a9249a33072430e4f191f157013f180bb66 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 27 Jun 2014 08:50:29 +0100 Subject: Emacs: Add litable --- tag-emacs/emacs.d/Cask | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 8f125c70..9c562f48 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -40,6 +40,7 @@ (depends-on "ido-vertical-mode") (depends-on "jinja2-mode") (depends-on "js2-mode") +(depends-on "litable") (depends-on "lua-mode") (depends-on "magit") (depends-on "markdown-mode") -- cgit 1.4.1 From 7b4a011475e80ba795ccfa4c7ea7491831dbe5c7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 27 Jun 2014 09:45:29 +0100 Subject: Emacs: Make auto-indent-mode start at init --- tag-emacs/emacs.d/init.el | 2 -- 1 file changed, 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 659b3b12..34931140 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -349,8 +349,6 @@ tab-always-indent 'complete) (req-package auto-indent-mode - :commands (auto-indent-minor-mode - 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 "" -- cgit 1.4.1 From e033815cdd9c5a35496438411b6e04adeb424ac6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 28 Jun 2014 11:07:04 +0100 Subject: Emacs: Increase vertical window split threshold --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 34931140..3522fa2d 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1068,7 +1068,8 @@ (setq scroll-conservatively 100 ; Keep the cursor position when scrolling scroll-margin 1 scroll-preserve-screen-position nil - mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control)))) + mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control))) + split-height-threshold 100) (when menu-bar-mode (menu-bar-mode -1)) -- cgit 1.4.1 From 9c4486c64daf09ca2d70557ca0d7d924ff99c543 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 29 Jun 2014 22:20:57 +0100 Subject: Emacs: Fix skewer autoloading issue --- tag-emacs/emacs.d/init.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 3522fa2d..2200ad1f 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -992,9 +992,7 @@ ;;;; Web Development (req-package skewer-mode - :commands (skewer-mode - skewer-html-mode - skewer-css-mode) + :defer t :init (progn (add-hook 'js2-mode-hook #'skewer-mode) (add-hook 'html-mode-hook #'skewer-html-mode) -- cgit 1.4.1 From 257caac8bf1d776ef64b9f28229bf3641524af02 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 29 Jun 2014 22:26:55 +0100 Subject: Emacs: check if server is already running --- tag-emacs/emacs.d/init.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 2200ad1f..e389aed5 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1108,4 +1108,7 @@ (req-package-finish) (unless (daemonp) - (server-start)) + (require 'server) + (if (server-running-p server-name) + (message "Server already appears to be running") + (server-start))) -- cgit 1.4.1 From cb8f445e6671043318e13243571ae5d3cca94220 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 30 Jun 2014 10:20:22 +0100 Subject: zsh: Fix emacsclient 'frameNeeded' logic --- tag-zsh/config/zsh/zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index b7688921..4375ceb9 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -346,7 +346,7 @@ emacs_change_focus () { ec () { local frameNeeded - frameNeeded=`emacsclient -e '(>= (if (daemonp) 2 1) (length (visible-frame-list)))'` + frameNeeded=`emacsclient -e '(> (if (daemonp) 2 1) (length (visible-frame-list)))'` if [[ $? -ne 0 ]]; then print "Daemon not running" return 1 -- cgit 1.4.1 From d3153b6ab5345002e270bde86857ce17a75c2a93 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 30 Jun 2014 10:21:28 +0100 Subject: zsh: Use clearer process substitution syntax --- tag-zsh/config/zsh/zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 4375ceb9..37e20f8e 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -346,7 +346,7 @@ emacs_change_focus () { ec () { local frameNeeded - frameNeeded=`emacsclient -e '(> (if (daemonp) 2 1) (length (visible-frame-list)))'` + frameNeeded=$(emacsclient -e '(> (if (daemonp) 2 1) (length (visible-frame-list)))') if [[ $? -ne 0 ]]; then print "Daemon not running" return 1 -- cgit 1.4.1 From f5f255488534a49fd6bc3c8e91763270a21b7326 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 30 Jun 2014 22:11:10 +0100 Subject: Emacs: disable lock file creation --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index e389aed5..d0fab113 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -259,6 +259,7 @@ (prefer-coding-system 'utf-8-auto-unix) (set-default-coding-systems 'utf-8-auto-unix) (setq-default buffer-file-coding-system 'utf-8-auto-unix) +(setq create-lockfiles nil) (req-package autorevert :init (progn (global-auto-revert-mode 1) -- cgit 1.4.1 From 8a5b48b06158e946adee6afbe8873b6cfc09853b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 1 Jul 2014 11:59:24 +0100 Subject: Emacs: Configure popwin to tame helm windows --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index d0fab113..de3db295 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1090,7 +1090,8 @@ (req-package popwin :config (progn - (popwin-mode 1))) + (popwin-mode 1) + (add-to-list 'popwin:special-display-config '(("^*helm.+*$" :regexp t :height 20))))) (req-package winner :init (progn -- cgit 1.4.1 From 25eaf8983b6c567087fda3b55b8bcaa1ddb071d2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 1 Jul 2014 12:24:19 +0100 Subject: Emacs: Stop company-dabbrev from lowercasing --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index de3db295..ca3842fe 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -195,7 +195,8 @@ company-idle-delay .3 company-begin-commands '(self-insert-command) company-auto-complete #'company-explicit-action-p - company-auto-complete-chars '(?\ ?\( ?\) ?.)))) + company-auto-complete-chars '(?\ ?\( ?\) ?.) + company-dabbrev-downcase nil))) ;;;; Dates & Times -- cgit 1.4.1 From 42b9a19452cd8ed458d77fdaebad91d290cc4e65 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 1 Jul 2014 16:46:28 +0100 Subject: Emacs: fix typo in popwin configuration --- tag-emacs/emacs.d/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index ca3842fe..3417cce6 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1091,8 +1091,8 @@ (req-package popwin :config (progn - (popwin-mode 1) - (add-to-list 'popwin:special-display-config '(("^*helm.+*$" :regexp t :height 20))))) + (popwin-mode -1) + (add-to-list 'popwin:special-display-config '("^*helm.+*$" :regexp t :height 20)))) (req-package winner :init (progn -- cgit 1.4.1 From 2829eaf03303d970e01560ffe05e21ea233cb2e1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 1 Jul 2014 16:46:40 +0100 Subject: zsh: Update pure prompt --- tag-zsh/config/zsh/functions/pure/prompt_pure_setup | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tag-zsh/config/zsh/functions/pure/prompt_pure_setup b/tag-zsh/config/zsh/functions/pure/prompt_pure_setup index 5c635037..5b92ee5c 100644 --- a/tag-zsh/config/zsh/functions/pure/prompt_pure_setup +++ b/tag-zsh/config/zsh/functions/pure/prompt_pure_setup @@ -43,14 +43,14 @@ prompt_pure_git_dirty() { # displays the exec time of the last command if set threshold was exceeded prompt_pure_cmd_exec_time() { - local stop=$(date +%s) + local stop=$EPOCHSECONDS local start=${cmd_timestamp:-$stop} integer elapsed=$stop-$start (($elapsed > ${PURE_CMD_MAX_EXEC_TIME:=5})) && prompt_pure_human_time $elapsed } prompt_pure_preexec() { - cmd_timestamp=$(date +%s) + cmd_timestamp=$EPOCHSECONDS # shows the current dir and executed command in the title when a process is active print -Pn "\e]0;" @@ -70,7 +70,7 @@ prompt_pure_precmd() { # git info vcs_info - local prompt_pure_preprompt='\n%F{blue}%~%F{242}$vcs_info_msg_0_`prompt_pure_git_dirty` $prompt_pure_username%f %F{yellow}`prompt_pure_cmd_exec_time`%f' + local prompt_pure_preprompt="\n%F{blue}%~%F{242}$vcs_info_msg_0_`prompt_pure_git_dirty` $prompt_pure_username%f %F{yellow}`prompt_pure_cmd_exec_time`%f" print -P $prompt_pure_preprompt # check async if there is anything to pull @@ -80,10 +80,12 @@ prompt_pure_precmd() { # check check if there is anything to pull command git fetch &>/dev/null && # check if there is an upstream configured for this branch - command git rev-parse --abbrev-ref @'{u}' &>/dev/null && - (( $(command git rev-list --right-only --count HEAD...@'{u}' 2>/dev/null) > 0 )) && - # some crazy ansi magic to inject the symbol into the previous line - print -Pn "\e7\e[A\e[1G\e[`prompt_pure_string_length $prompt_pure_preprompt`C%F{cyan}⇣%f\e8" + command git rev-parse --abbrev-ref @'{u}' &>/dev/null && { + local arrows='' + (( $(command git rev-list --right-only --count HEAD...@'{u}' 2>/dev/null) > 0 )) && arrows='⇣' + (( $(command git rev-list --left-only --count HEAD...@'{u}' 2>/dev/null) > 0 )) && arrows+='⇡' + print -Pn "\e7\e[A\e[1G\e[`prompt_pure_string_length $prompt_pure_preprompt`C%F{cyan}${arrows}%f\e8" + } } &! # reset value since `preexec` isn't always triggered @@ -98,6 +100,7 @@ prompt_pure_setup() { prompt_opts=(cr subst percent) + zmodload zsh/datetime autoload -Uz add-zsh-hook autoload -Uz vcs_info -- cgit 1.4.1 From 14bae0b43c4c1c9ba34e360c291a6a3f1a103096 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 1 Jul 2014 21:15:42 +0100 Subject: zsh: Remove noglob salt alias --- tag-zsh/config/zsh/zshrc | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 37e20f8e..350327c9 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -258,7 +258,6 @@ alias llr="ll -t" alias gpp='g++' alias lsr="${ls} -tld *(m-2)" # mtime < -2days -alias salt="noglob salt" alias pping="prettyping.sh" alias trans="transmission-remote transmission.home" alias bitcoin="bitcoind" -- cgit 1.4.1 From b518f6cf914ad77290cf1907886c94faebae6c53 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 1 Jul 2014 22:46:41 +0100 Subject: Emacs: reduce flx-ido max entries to 1000 --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 3417cce6..f2b6c051 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -485,7 +485,8 @@ (req-package flx-ido :require ido :init (progn - (flx-ido-mode 1))) + (flx-ido-mode 1) + (setq flx-ido-threshhold 1000))) (req-package smex :require ido -- cgit 1.4.1 From ed3393f638f72b010d46115131467229f9ba18cf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 1 Jul 2014 22:48:45 +0100 Subject: Emacs: configure timeclock-mode --- tag-emacs/emacs.d/init.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index f2b6c051..7906a49d 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -224,6 +224,11 @@ ((equal prefix '(4)) "%Y-%m-%dT%H:%M:%SZ")))) (insert (format-time-string format)))) +(use-package timeclock + :defer t + :config (progn + (setq timeclock-workday (* 7.5 60 60)))) + ;;;; Directory browsing (req-package dired :defer t -- cgit 1.4.1 From a00a77caa56811e41c2d0a0fc190cb1978312544 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 2 Jul 2014 18:09:26 +0100 Subject: Whitespace fixup --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 7906a49d..976f8c93 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1120,4 +1120,4 @@ (require 'server) (if (server-running-p server-name) (message "Server already appears to be running") - (server-start))) + (server-start))) -- cgit 1.4.1 From 50aeb46604892d696cba76e0c28ec532bac92361 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 2 Jul 2014 18:09:35 +0100 Subject: Emacs: re-enable popwin --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 976f8c93..5f5d92a2 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1097,7 +1097,7 @@ (req-package popwin :config (progn - (popwin-mode -1) + (popwin-mode 1) (add-to-list 'popwin:special-display-config '("^*helm.+*$" :regexp t :height 20)))) (req-package winner -- cgit 1.4.1 From 5256360f3e1cab6435c7a4f3d7c73358b098465b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 2 Jul 2014 18:38:06 +0100 Subject: Emacs: Fix incorrect lisp auto-indentation --- tag-emacs/emacs.d/init.el | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 5f5d92a2..5c717556 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -363,12 +363,11 @@ 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-mode-untabify-on-yank-or-paste 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) - (auto-indent-global-mode) - (defun lisp-auto-indent-mode () - (set (make-local-variable 'auto-indent-assign-indent-level) 2)) - (add-hook 'lisp-common-mode-hook #'lisp-auto-indent-mode))) + (auto-indent-global-mode))) (req-package smart-tabs-mode :commands (smart-tabs-mode -- cgit 1.4.1 From 4d3b697aa70e7b212484397d0ccfa50ee77fd5c0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 2 Jul 2014 18:47:53 +0100 Subject: Emacs: make helm instant --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 5c717556..22aff30e 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -439,7 +439,7 @@ (req-package helm-config :bind (("C-x i" . helm-imenu)) :config (setq helm-idle-delay .1 - helm-input-idle-delay .1)) + helm-input-idle-delay 0)) (req-package ido :bind (("C-x b" . ido-switch-buffer)) -- cgit 1.4.1 From 6392967447e1d2d34de0b7960793748329ee775e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 2 Jul 2014 19:45:13 +0100 Subject: Emacs: Switch from to helm Almost everything! --- tag-emacs/emacs.d/Cask | 5 +-- tag-emacs/emacs.d/init.el | 83 +++++------------------------------------------ 2 files changed, 9 insertions(+), 79 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 9c562f48..7f924f4d 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -24,8 +24,6 @@ (depends-on "emmet-mode") (depends-on "expand-region") (depends-on "fancy-narrow") -(depends-on "flx") -(depends-on "flx-ido") (depends-on "flycheck") (depends-on "framemove") (depends-on "geiser") @@ -37,7 +35,7 @@ (depends-on "goto-chg") (depends-on "haskell-mode") (depends-on "helm") -(depends-on "ido-vertical-mode") +(depends-on "helm-projectile") (depends-on "jinja2-mode") (depends-on "js2-mode") (depends-on "litable") @@ -73,7 +71,6 @@ (depends-on "smart-mode-line") (depends-on "smart-tab") (depends-on "smart-tabs-mode") -(depends-on "smex") (depends-on "solarized-theme") (depends-on "toml-mode") (depends-on "tup-mode") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 22aff30e..3f5d29f2 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -437,80 +437,13 @@ (defalias 'exit-emacs #'save-buffers-kill-emacs)) (req-package helm-config - :bind (("C-x i" . helm-imenu)) - :config (setq helm-idle-delay .1 - helm-input-idle-delay 0)) - -(req-package ido - :bind (("C-x b" . ido-switch-buffer)) - :init (progn - (setq ido-save-directory-list-file (expand-file-name "ido-state" user-emacs-directory)) - (bind-key* "C-x C-f" #'ido-find-file) - (ido-mode 1) - (ido-everywhere 1)) - :config (progn - (setq ido-auto-merge-delay-time 99999 - ido-enable-flex-matching t) - - (ido-init-completion-maps) - (defun ido-manual-merge () - (interactive) - (ido-initiate-auto-merge (current-buffer))) - (bind-key "C-c C-s" #'ido-manual-merge ido-file-dir-completion-map))) - -(defun ap/ido-projectile-switch-buffer-dwim (force-ido) - (interactive "p") - (if (and (projectile-project-p) (eq force-ido 1)) - (call-interactively #'projectile-switch-to-buffer) - (call-interactively #'ido-switch-buffer))) - -(bind-key "s-x b" #'ap/ido-projectile-switch-buffer-dwim) -(bind-key "s-x s-b" #'ap/ido-projectile-switch-buffer-dwim) - -(req-package ido-vertical-mode - :require ido - :init (progn - (setq ido-vertical-decorations '("\n❯ " - "" - "\n " - "\n …" - "[" - "]" - " [No match]" - " [Matched]" - " [Not readable]" - " [Too big]" - " [Confirm]" - "\n❯ " - "" - ))) - :config (ido-vertical-mode 1)) - -(req-package flx-ido - :require ido - :init (progn - (flx-ido-mode 1) - (setq flx-ido-threshhold 1000))) - -(req-package smex - :require ido - :bind (("M-x" . smex) - ("" . smex) - ("" . smex) - ("M-X" . smex-major-mode-commands) - ("C-c M-x" . execute-extended-command)) + :bind (("C-x i". helm-imenu) + ("M-x" . helm-M-x) + ("C-x C-b" . helm-mini)) :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")) - (smex-initialize))) + (setq helm-idle-delay .1 + helm-input-idle-delay 0) + (helm-mode 1))) ;;;; Modeline @@ -699,8 +632,8 @@ (ap/-add-known-subfolder-projects (ido-read-directory-name "Add projects under: "))) (defun ap/open-subfolder-project (from-dir &optional arg) - (let ((project-dir (projectile-completing-read "Open project: " - (ap/subfolder-projects from-dir)))) + (let ((project-dir (helm-comp-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) -- cgit 1.4.1 From cc585460a4549937d2b64680c11bdb96e67c8b4b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 2 Jul 2014 22:39:02 +0100 Subject: Emacs: Switch tab and C-z in helm-find-files --- tag-emacs/emacs.d/init.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 3f5d29f2..712a3113 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -443,6 +443,10 @@ :config (progn (setq helm-idle-delay .1 helm-input-idle-delay 0) + (define-key helm-read-file-map (kbd "") #'helm-execute-persistent-action) + (define-key helm-read-file-map (kbd "TAB") #'helm-execute-persistent-action) + (define-key helm-read-file-map (kbd "C-i") #'helm-execute-persistent-action) + (define-key helm-read-file-map (kbd "C-z") #'helm-select-action) (helm-mode 1))) ;;;; Modeline -- cgit 1.4.1 From 95ac229d595e81e2f3ed1e1504ab7873d72a1f8f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 3 Jul 2014 11:25:31 +0100 Subject: Emacs: fix helm keymap errors --- tag-emacs/emacs.d/init.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 712a3113..bd617fa9 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -443,11 +443,15 @@ :config (progn (setq helm-idle-delay .1 helm-input-idle-delay 0) + (helm-mode 1))) + +(req-package helm-files + :defer t + :config (progn (define-key helm-read-file-map (kbd "") #'helm-execute-persistent-action) (define-key helm-read-file-map (kbd "TAB") #'helm-execute-persistent-action) (define-key helm-read-file-map (kbd "C-i") #'helm-execute-persistent-action) - (define-key helm-read-file-map (kbd "C-z") #'helm-select-action) - (helm-mode 1))) + (define-key helm-read-file-map (kbd "C-z") #'helm-select-action))) ;;;; Modeline -- cgit 1.4.1 From 4c534ec12b614acc3317f21d42193839074f4a23 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 3 Jul 2014 11:25:41 +0100 Subject: Emacs: rebind C-x i to helm-semantic-or-imenu --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index bd617fa9..442c1b26 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -437,7 +437,7 @@ (defalias 'exit-emacs #'save-buffers-kill-emacs)) (req-package helm-config - :bind (("C-x i". helm-imenu) + :bind (("C-x i". helm-semantic-or-imenu) ("M-x" . helm-M-x) ("C-x C-b" . helm-mini)) :config (progn -- cgit 1.4.1 From 1b2ac613e3ee291ddf37b16f01d82343906e5d39 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 3 Jul 2014 11:35:43 +0100 Subject: Emacs: add kill-this-buffer-dwim for server edits --- tag-emacs/emacs.d/init.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 442c1b26..43056250 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -126,6 +126,12 @@ ;;;; Buffers +(defun kill-this-buffer-dwim () + (interactive) + (if server-buffer-clients + (server-edit) + (kill-this-buffer))) + (req-package ibuffer :bind (("C-x C-b" . ibuffer)) :config (progn @@ -411,7 +417,7 @@ (unbind-key "s-n") (unbind-key "s-p") (unbind-key "s-w") -(bind-key "s-k" #'kill-this-buffer) +(bind-key "s-k" #'kill-this-buffer-dwim) (bind-key "s-x" (define-prefix-command 'super-x-map)) -- cgit 1.4.1 From 75df2061a259258d85de7663d9f5e1dbc71a0ca8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 3 Jul 2014 19:56:30 +0100 Subject: Fix zsh dotfile installation --- hooks/post-up/zsh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hooks/post-up/zsh b/hooks/post-up/zsh index f4720813..938701fe 100755 --- a/hooks/post-up/zsh +++ b/hooks/post-up/zsh @@ -4,7 +4,15 @@ ZDOTDIR="${XDG_CONFIG_HOME:=~/.config}/zsh" pushd $ZDOTDIR for f in z*(-.) do - [[ -e .$f ]] || ln $f .$f + 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 -- cgit 1.4.1 From bdeabfbb3bb204b641e38c9ce59e7bfa6374945d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 4 Jul 2014 21:06:50 +0100 Subject: Emacs: Add configuration for ggtags-mode --- tag-emacs/emacs.d/init.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 43056250..041f553a 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -603,6 +603,15 @@ :config (progn (setq go-projectile-switch-gopath 'maybe))) +(req-package ggtags + :config (progn + (bind-key "q" #'ggtags-navigation-mode-abort)) + :init (progn + (defun turn-on-ggtags-mode () + (interactive) + (ggtags-mode 1)) + (add-hook 'c-mode-common-hook #'turn-on-ggtags-mode))) + (req-package auto-compile :defer t :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) -- cgit 1.4.1 From 864f5981c34cddd73fdbf6162be0a813b9c81cf6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 4 Jul 2014 22:36:37 +0100 Subject: Emacs: Make open-subfolder-project require match --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 041f553a..02b238eb 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -656,7 +656,8 @@ (defun ap/open-subfolder-project (from-dir &optional arg) (let ((project-dir (helm-comp-read "Open project: " - (ap/subfolder-projects from-dir)))) + (ap/subfolder-projects from-dir) + :must-match t))) (projectile-switch-project-by-name (expand-file-name project-dir from-dir) arg))) (defun ap/open-work-project (&optional arg) -- cgit 1.4.1 From aeb44902a7d67feffc70e69e68d087e7a4b224d6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 5 Jul 2014 09:51:49 +0100 Subject: Emacs: Fix q ggtags-navigation-mode-abort binding --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 02b238eb..8635ac00 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -605,7 +605,7 @@ (req-package ggtags :config (progn - (bind-key "q" #'ggtags-navigation-mode-abort)) + (bind-key "q" #'ggtags-navigation-mode-abort ggtags-navigation-mode-map)) :init (progn (defun turn-on-ggtags-mode () (interactive) -- cgit 1.4.1 From d69d493c16f6539a8bbc1e256fb625ee73f0c0de Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 5 Jul 2014 11:04:28 +0100 Subject: Emacs: add discover-my-major mode --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 3 +++ 2 files changed, 4 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 7f924f4d..95950a7a 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -20,6 +20,7 @@ (depends-on "diminish") (depends-on "dired+") (depends-on "discover") +(depends-on "discover-my-major") (depends-on "elisp-slime-nav") (depends-on "emmet-mode") (depends-on "expand-region") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 8635ac00..37ceb53b 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -266,6 +266,9 @@ :init (which-function-mode) :config (setq which-func-modes t)) +(req-package discover-my-major + :bind ("C-h C-m" . discover-my-major)) + ;;;; Files (prefer-coding-system 'utf-8-auto-unix) -- cgit 1.4.1 From a9ad4c630cc4563f4bff0d03f47430e9aa3408cd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 5 Jul 2014 11:11:18 +0100 Subject: Emacs: add and configure fasd-mode --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 95950a7a..880449ab 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -25,6 +25,7 @@ (depends-on "emmet-mode") (depends-on "expand-region") (depends-on "fancy-narrow") +(depends-on "fasd") (depends-on "flycheck") (depends-on "framemove") (depends-on "geiser") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 37ceb53b..448d1438 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -314,6 +314,11 @@ (req-package ws-butler :config (ws-butler-global-mode 1)) +(req-package fasd + :bind ("C-x C-/" . fasd-find-file) + :init (progn + (global-fasd-mode 1))) + (req-package recentf :init (progn (setq recentf-auto-cleanup 'never recentf-save-file (expand-file-name "recentf" user-emacs-directory)) -- cgit 1.4.1 From 915d006a6711e4576c687a0f01832a8ac64838e5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 5 Jul 2014 22:18:20 +0100 Subject: Emacs: Switch projectile completion system to helm --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 448d1438..66a4c06f 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -678,7 +678,8 @@ (setq projectile-switch-project-action #'projectile-dired - projectile-remember-window-configs t))) + projectile-remember-window-configs t + projectile-completion-system 'helm))) (req-package perspective :config (persp-mode)) -- cgit 1.4.1 From 046dfb9cf1e1690487d20091ae4545f158141fa6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 6 Jul 2014 11:54:24 +0100 Subject: Emacs: install and configure dired-subtree --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 880449ab..78b286c2 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -19,6 +19,7 @@ (depends-on "diff-hl") (depends-on "diminish") (depends-on "dired+") +(depends-on "dired-subtree") (depends-on "discover") (depends-on "discover-my-major") (depends-on "elisp-slime-nav") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 66a4c06f..6b13290a 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -260,6 +260,22 @@ (setq dired-omit-files "#\\|\\.$" dired-find-subdir t))) +(req-package dired-subtree + :defer t + :config (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)) + :init (progn + (bind-key "i" #'dired-subtree-insert dired-mode-map))) + ;;;; Documentation (req-package which-func -- cgit 1.4.1 From 4493b4bd771964bc228562ad47c68b07a348332c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 6 Jul 2014 11:55:48 +0100 Subject: Emacs: install and configure go-oracle --- tag-emacs/emacs.d/init.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 6b13290a..55dd992a 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -608,6 +608,11 @@ (req-package go-mode :mode (("\\.go\\'" . go-mode))) +(req-package oracle + :load-path ,(expand-file-name "src/code.google.com/p/go.tools/cmd/oracle/oracle.el" (getenv "GOPATH")) + :init (progn + (add-hook 'go-mode-hook #'go-oracle-mode))) + (req-package company-go :require go-mode :config (progn -- cgit 1.4.1 From 778c6addbea42d251d90618084c7c535927dc15c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 6 Jul 2014 12:08:43 +0100 Subject: zsh: Add and configure per-directory-history --- .gitmodules | 3 +++ tag-zsh/config/zsh/per-directory-history | 1 + tag-zsh/config/zsh/zshrc | 7 +++++++ 3 files changed, 11 insertions(+) create mode 100644 .gitmodules create mode 160000 tag-zsh/config/zsh/per-directory-history diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..babccc4d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "tag-zsh/config/zsh/per-directory-history"] + path = tag-zsh/config/zsh/per-directory-history + url = git://github.com/jimhester/per-directory-history.git diff --git a/tag-zsh/config/zsh/per-directory-history b/tag-zsh/config/zsh/per-directory-history new file mode 160000 index 00000000..f6978694 --- /dev/null +++ b/tag-zsh/config/zsh/per-directory-history @@ -0,0 +1 @@ +Subproject commit f69786943ec77fea2315b647d4fae86f4e5af5a8 diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 350327c9..11c92847 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -361,6 +361,13 @@ ec () { fi } +if [[ -e $ZDOTDIR/per-directory-history/per-directory-history.zsh ]] +then + source $ZDOTDIR/per-directory-history/per-directory-history.zsh +else + echo "per-directory-history is missing" +fi + _FASD_DATA="$HOME/.cache/zsh/fasd-data" autoload -U fasd if [[ -e ~/.cache/zsh/fasd-init-zsh ]] -- cgit 1.4.1 From e117c36fa22f2d59ae034745b992ebd669fe11ba Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 6 Jul 2014 12:25:43 +0100 Subject: rcm: Add hook to ensure submodules are correct --- hooks/pre-up/submodules | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 hooks/pre-up/submodules diff --git a/hooks/pre-up/submodules b/hooks/pre-up/submodules new file mode 100755 index 00000000..ae4f42fd --- /dev/null +++ b/hooks/pre-up/submodules @@ -0,0 +1,5 @@ +#!/usr/bin/env zsh +echo $0:h:h:h +pushd $0:h:h:h +git submodule update --init +popd \ No newline at end of file -- cgit 1.4.1 From 4865dcc52eea524868e9a32dd22105848e8f484e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 6 Jul 2014 13:29:59 +0100 Subject: zsh: Store per-directory history in .cache --- tag-zsh/config/zsh/zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 11c92847..0d65ccd9 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -363,6 +363,7 @@ ec () { if [[ -e $ZDOTDIR/per-directory-history/per-directory-history.zsh ]] then + HISTORY_BASE=~/.cache/zsh/dirhist source $ZDOTDIR/per-directory-history/per-directory-history.zsh else echo "per-directory-history is missing" -- cgit 1.4.1 From 0d017a702eaad796ac1b6a0ccd4cf201a657139d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 6 Jul 2014 13:59:41 +0100 Subject: zsh: Re-assert default key-binding for history Filed jimhester/per-directory-history#6 to see if this can be changed --- tag-zsh/config/zsh/zshrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 0d65ccd9..a2ac5034 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -365,6 +365,8 @@ if [[ -e $ZDOTDIR/per-directory-history/per-directory-history.zsh ]] then HISTORY_BASE=~/.cache/zsh/dirhist source $ZDOTDIR/per-directory-history/per-directory-history.zsh + bindkey '^G' send-break + bindkey '^[^G' per-directory-history-toggle-history else echo "per-directory-history is missing" fi -- cgit 1.4.1 From 354bdc7bcd7d73e543fe4b4480d2d32274358fc6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 7 Jul 2014 18:25:42 +0100 Subject: Emacs: diminish emmet-mode --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 55dd992a..1b2f4e87 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1031,6 +1031,7 @@ (req-package emmet-mode :commands (emmet-mode) + :diminish " >" :init (progn (if (functionp 'web-mode) (add-hook 'web-mode-hook #'emmet-mode)))) -- cgit 1.4.1 From d85d7428102c7a120ded1fcbcb27a21ae54a7928 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 7 Jul 2014 08:16:26 +0100 Subject: Emacs: fix dired-subtree load order --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 1b2f4e87..7717ea05 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -262,6 +262,7 @@ (req-package dired-subtree :defer t + :require dired :config (progn (setq dired-subtree-use-backgrounds nil) (defun dired-subtree-maybe-up () -- cgit 1.4.1 From dde2a12817ff113573196e6e0c877a529843aec7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 8 Jul 2014 16:24:51 +0100 Subject: Emacs: diminish helm-mode --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 7717ea05..aa6df290 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -474,6 +474,7 @@ :config (progn (setq helm-idle-delay .1 helm-input-idle-delay 0) + (diminish #'helm-mode " ⎈") (helm-mode 1))) (req-package helm-files -- cgit 1.4.1 From a020f994e3093d03ff779c55378b7b0be8093fb1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 8 Jul 2014 16:25:04 +0100 Subject: Emacs: workaround popwin/smart-mode-line errors Disable smart-mode-line for now --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index aa6df290..b10802aa 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -492,6 +492,7 @@ (req-package smart-mode-line :require solarized-theme + :disabled t :config (progn (setq sml/theme 'respectful) (sml/setup))) -- cgit 1.4.1 From 13fb303bd972396d81a169500409551d7d5e0c24 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 9 Jul 2014 18:28:31 +0100 Subject: Emacs: fully diminish helm-mode --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index b10802aa..aa78e335 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -468,13 +468,13 @@ (defalias 'exit-emacs #'save-buffers-kill-emacs)) (req-package helm-config + :diminish helm-mode :bind (("C-x i". helm-semantic-or-imenu) ("M-x" . helm-M-x) ("C-x C-b" . helm-mini)) :config (progn (setq helm-idle-delay .1 helm-input-idle-delay 0) - (diminish #'helm-mode " ⎈") (helm-mode 1))) (req-package helm-files -- cgit 1.4.1 From 9db5a1e01f69bbbbe8243a2c81107cab4b3551a7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 9 Jul 2014 18:31:00 +0100 Subject: zsh: Only set gh completion when _gh is defined --- tag-zsh/config/zsh/zshrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index a2ac5034..8005b526 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -277,7 +277,9 @@ alias -s log=less if [[ -e =gh ]]; then alias git="gh" - compdef _gh gh + if [[ -n $functions[_gh] ]];then + compdef _gh gh + fi fi if [[ -n $commands[composer.phar] && ! -n $commands[composer] ]]; then -- cgit 1.4.1 From 024576a09aec23f96807df26b88db6f090e9c220 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Jul 2014 19:20:32 +0100 Subject: Emacs: workaround ws-butler daemon issue lewang/ws-butler#4 --- tag-emacs/emacs.d/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index aa78e335..228adeb1 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -329,7 +329,10 @@ (message "File '%s' successfully removed" filename))))) (req-package ws-butler + :if window-system :config (ws-butler-global-mode 1)) +(if (daemonp) + (add-hook #'before-make-frame-hook (lambda () (ws-butler-global-mode 1)))) (req-package fasd :bind ("C-x C-/" . fasd-find-file) -- cgit 1.4.1 From 446baed9e00fc3c88c2884355a34c836f46d7072 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Jul 2014 19:22:33 +0100 Subject: Emacs: Load helm on startup --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 228adeb1..16734d77 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -471,6 +471,7 @@ (defalias 'exit-emacs #'save-buffers-kill-emacs)) (req-package helm-config + :demand :diminish helm-mode :bind (("C-x i". helm-semantic-or-imenu) ("M-x" . helm-M-x) -- cgit 1.4.1 From 3479cc5e532413ef4b51eda45ecc8782af43281a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Jul 2014 19:22:45 +0100 Subject: Emacs: Use ido 'ghost' buffers feature in helm --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 16734d77..e81b313d 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -478,7 +478,8 @@ ("C-x C-b" . helm-mini)) :config (progn (setq helm-idle-delay .1 - helm-input-idle-delay 0) + helm-input-idle-delay 0 + ido-use-virtual-buffers t) (helm-mode 1))) (req-package helm-files -- cgit 1.4.1 From 1c79164ecdab46c284def04ad374fcae94116b0d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Jul 2014 20:36:17 +0100 Subject: Emacs: Simplify delete-current-buffer-file --- tag-emacs/emacs.d/init.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index e81b313d..3b36f8a5 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -319,13 +319,12 @@ (defun delete-current-buffer-file () "Removes file connected to current buffer and kills buffer." (interactive) - (let ((filename (buffer-file-name)) - (buffer (current-buffer))) + (let ((filename (buffer-file-name))) (if (not (and filename (file-exists-p filename))) - (ido-kill-buffer) + (kill-this-buffer) (when (yes-or-no-p "Are you sure you want to remove this file? ") (delete-file filename) - (kill-buffer buffer) + (kill-this-buffer) (message "File '%s' successfully removed" filename))))) (req-package ws-butler -- cgit 1.4.1 From ed18ff39c95c842e8ea465610f5d06e3c5f700be Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Jul 2014 20:38:57 +0100 Subject: Emacs: Extend kill-this-buffer-dwim to delete file Deletes current-buffer's file if called with universal prefix argument. --- tag-emacs/emacs.d/init.el | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 3b36f8a5..a5649fb4 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -126,12 +126,6 @@ ;;;; Buffers -(defun kill-this-buffer-dwim () - (interactive) - (if server-buffer-clients - (server-edit) - (kill-this-buffer))) - (req-package ibuffer :bind (("C-x C-b" . ibuffer)) :config (progn @@ -327,6 +321,16 @@ (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") + (message "%s" arg) + (if (equal arg '(4)) + (delete-current-buffer-file) + (if server-buffer-clients + (server-edit) + (kill-this-buffer)))) + (req-package ws-butler :if window-system :config (ws-butler-global-mode 1)) @@ -444,7 +448,7 @@ (unbind-key "s-n") (unbind-key "s-p") (unbind-key "s-w") -(bind-key "s-k" #'kill-this-buffer-dwim) +(bind-key "s-k" #'kill-or-delete-this-buffer-dwim) (bind-key "s-x" (define-prefix-command 'super-x-map)) -- cgit 1.4.1 From 8c6c7cdc4c5397d9704b168e93021248f57fdf77 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Jul 2014 20:40:56 +0100 Subject: Emacs: Use system trash on OSX --- tag-emacs/emacs.d/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index a5649fb4..35d63f9b 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -286,6 +286,9 @@ (set-default-coding-systems 'utf-8-auto-unix) (setq-default buffer-file-coding-system 'utf-8-auto-unix) (setq create-lockfiles nil) +(if (eq system-type 'darwin) + (setq delete-by-moving-to-trash t)) + (req-package autorevert :init (progn (global-auto-revert-mode 1) -- cgit 1.4.1 From 3e15bd32d236180ba5fa5ce5da083d538791a608 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Jul 2014 22:05:45 +0100 Subject: Emacs: Add mmm-mode for SQL inside PHP …assuming I got the regex right. --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 78b286c2..f3a1dc9b 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -45,6 +45,7 @@ (depends-on "lua-mode") (depends-on "magit") (depends-on "markdown-mode") +(depends-on "mmm-mode") (depends-on "move-text") (depends-on "multi-term") (depends-on "multiple-cursors") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 35d63f9b..fab42b21 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1063,6 +1063,24 @@ web-mode-comment-style 2 web-mode-disable-auto-pairing t)) +(req-package mmm-auto + :config (progn + (defvar php-sql-mmm-submode-enabled nil) + (defun php-sql-mmm-submode () + "Provides a very minimal embedding of SQL in PHP, via mmm-mode." + (interactive) + (when (not php-sql-mmm-submode-enabled) + (set-face-background 'mmm-default-submode-face nil) + (mmm-add-classes + '((php-sql + :submode sql-mode + :front "\\($\\(sql\\|query\\)\\s-*=\\s-*[\"']\\|<<= emacs-major-version 24) + (> emacs-minor-version 3)) :config (progn (popwin-mode 1) (add-to-list 'popwin:special-display-config '("^*helm.+*$" :regexp t :height 20)))) -- cgit 1.4.1 From 71addd8478d03ba9e363b1b04e0b785872554291 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Jul 2014 17:17:59 +0100 Subject: Xmobar: whitespace cleanup --- tag-xmobar/xmobarrc | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/tag-xmobar/xmobarrc b/tag-xmobar/xmobarrc index 7dfcef22..6a04fd15 100644 --- a/tag-xmobar/xmobarrc +++ b/tag-xmobar/xmobarrc @@ -8,32 +8,32 @@ Config { font = "-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*" , hideOnStart = False , persistent = True , commands = [ Run Weather "EGNX" ["-t", "ºC" - ,"-L", "12" - ,"-H", "18" - ,"--low", "lightblue" - ,"--normal", "green" - ,"--high", "red" - ] 36000 - , Run DynNetwork ["-t", "Net: ¦KB" - ,"-L", "512" - ,"-H", "10240" - ,"--low", "green" - ,"--normal", "yellow" - ,"--high", "red" - ,"-m", "5" - ] 5 - , Run Cpu ["-p", "3" - ,"-L", "3" - ,"-H", "50" - ,"--normal", "green" - ,"--high", "red" - ] 5 - , Run Memory ["-p", "3" - ,"-t", "Mem: %" - ] 20 - , Run Date "%a %b %_d %Y %H:%M:%S" "date" 10 - , Run MPD ["-t", ": - "] 10 - ] + ,"-L", "12" + ,"-H", "18" + ,"--low", "lightblue" + ,"--normal", "green" + ,"--high", "red" + ] 36000 + , Run DynNetwork ["-t", "Net: ¦KB" + ,"-L", "512" + ,"-H", "10240" + ,"--low", "green" + ,"--normal", "yellow" + ,"--high", "red" + ,"-m", "5" + ] 5 + , Run Cpu ["-p", "3" + ,"-L", "3" + ,"-H", "50" + ,"--normal", "green" + ,"--high", "red" + ] 5 + , Run Memory ["-p", "3" + ,"-t", "Mem: %" + ] 20 + , Run Date "%a %b %_d %Y %H:%M:%S" "date" 10 + , Run MPD ["-t", ": - "] 10 + ] , sepChar = "%" , alignSep = "}{" , template = "%cpu% | %memory% | %dynnetwork% | %mpd% }{ %EGNX% | %date%" -- cgit 1.4.1 From cf3ad2a066cbe9272cd7b8e6a60813be1073a424 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Jul 2014 17:18:37 +0100 Subject: Xmobar: increase 'high' weather temperature --- tag-xmobar/xmobarrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-xmobar/xmobarrc b/tag-xmobar/xmobarrc index 6a04fd15..2d5f8cbc 100644 --- a/tag-xmobar/xmobarrc +++ b/tag-xmobar/xmobarrc @@ -9,7 +9,7 @@ Config { font = "-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*" , persistent = True , commands = [ Run Weather "EGNX" ["-t", "ºC" ,"-L", "12" - ,"-H", "18" + ,"-H", "22" ,"--low", "lightblue" ,"--normal", "green" ,"--high", "red" -- cgit 1.4.1 From e85983ad8677a514428e7e80128bc0eb1196e2bb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Jul 2014 17:19:06 +0100 Subject: Xmobar: remove MPD --- tag-xmobar/xmobarrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tag-xmobar/xmobarrc b/tag-xmobar/xmobarrc index 2d5f8cbc..e27250c5 100644 --- a/tag-xmobar/xmobarrc +++ b/tag-xmobar/xmobarrc @@ -32,9 +32,8 @@ Config { font = "-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*" ,"-t", "Mem: %" ] 20 , Run Date "%a %b %_d %Y %H:%M:%S" "date" 10 - , Run MPD ["-t", ": - "] 10 ] , sepChar = "%" , alignSep = "}{" - , template = "%cpu% | %memory% | %dynnetwork% | %mpd% }{ %EGNX% | %date%" + , template = "%cpu% | %memory% | %dynnetwork% }{ %EGNX% | %date%" } -- cgit 1.4.1 From 727e957d19f542ca35902eb1f456682188a33446 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Jul 2014 17:20:33 +0100 Subject: Xmobar: reduce update frequency of CPU and RAM monitors --- tag-xmobar/xmobarrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-xmobar/xmobarrc b/tag-xmobar/xmobarrc index e27250c5..8b786cc6 100644 --- a/tag-xmobar/xmobarrc +++ b/tag-xmobar/xmobarrc @@ -21,13 +21,13 @@ Config { font = "-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*" ,"--normal", "yellow" ,"--high", "red" ,"-m", "5" - ] 5 + ] 10 , Run Cpu ["-p", "3" ,"-L", "3" ,"-H", "50" ,"--normal", "green" ,"--high", "red" - ] 5 + ] 10 , Run Memory ["-p", "3" ,"-t", "Mem: %" ] 20 -- cgit 1.4.1 From 7bed9db52eb33e3deed6a5298c1196574e9f89bf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Jul 2014 17:21:22 +0100 Subject: Xmobar: Hide seconds from date --- tag-xmobar/xmobarrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-xmobar/xmobarrc b/tag-xmobar/xmobarrc index 8b786cc6..5f455ec3 100644 --- a/tag-xmobar/xmobarrc +++ b/tag-xmobar/xmobarrc @@ -31,7 +31,7 @@ Config { font = "-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*" , Run Memory ["-p", "3" ,"-t", "Mem: %" ] 20 - , Run Date "%a %b %_d %Y %H:%M:%S" "date" 10 + , Run Date "%a %b %_d %Y %H:%M" "date" 100 ] , sepChar = "%" , alignSep = "}{" -- cgit 1.4.1 From fac5dc322f8860308e4c9991e501b292f34dc92c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Jul 2014 22:44:12 +0100 Subject: Emacs: Remove linum configuration --- tag-emacs/emacs.d/init.el | 3 --- 1 file changed, 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 896ad348..4c96f57b 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -87,9 +87,6 @@ ;;;; Style -(req-package linum - :config (setq linum-format " %4d ")) - (req-package whitespace :defer t :config (setq whitespace-style -- cgit 1.4.1 From 1ddedd165d9342866f7592a4d46fa8c3c48c150c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Jul 2014 22:44:28 +0100 Subject: Emacs: Use MMM for toml in markdown front matter --- tag-emacs/emacs.d/init.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 4c96f57b..bc131f59 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1110,7 +1110,14 @@ :back "\\([\"']\\|SQL\\);?" :face mmm-code-submode-face))) (mmm-add-mode-ext-class 'php-mode "\\.php$" 'php-sql) - (setq php-sql-mmm-submode-enabled t)))) + (setq php-sql-mmm-submode-enabled t))) + (mmm-add-classes + '((markdown-toml + :submode toml-mode + :face mmm-declaration-submode-face + :front "\\`+++[\n\r]+" + :back "^+++$"))) + (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-toml)) :init (setq mmm-global-mode 'maybe)) ;;;; Windows & Frames -- cgit 1.4.1 From e9200d1baa6a6c86503028c7d15696f6dddf45b7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 12 Jul 2014 22:49:18 +0100 Subject: Emacs: Simplify PHP-SQL MMM configuration --- tag-emacs/emacs.d/init.el | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index bc131f59..8fd1b20a 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1097,20 +1097,13 @@ (req-package mmm-auto :config (progn - (defvar php-sql-mmm-submode-enabled nil) - (defun php-sql-mmm-submode () - "Provides a very minimal embedding of SQL in PHP, via mmm-mode." - (interactive) - (when (not php-sql-mmm-submode-enabled) - (set-face-background 'mmm-default-submode-face nil) - (mmm-add-classes - '((php-sql - :submode sql-mode - :front "\\($\\(sql\\|query\\)\\s-*=\\s-*[\"']\\|<<= emacs-major-version 24) -- cgit 1.4.1 From e60c944f4ed7a577c7ae21c02ea6eb1a08b3f4d5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 14 Jul 2014 20:16:23 +0100 Subject: Emacs: diminish highlight-changes mode --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 7681d603..d62fffe8 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -366,6 +366,7 @@ (req-package ws-butler :if window-system + :diminish highlight-changes-mode :config (ws-butler-global-mode 1)) (if (daemonp) (add-hook #'before-make-frame-hook (lambda () (ws-butler-global-mode 1)))) -- cgit 1.4.1 From e9fc2f322272ba56a2a5cf0129194908bbea5bc4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 14 Jul 2014 20:23:21 +0100 Subject: Emacs: diminish company mode --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index d62fffe8..88309928 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -217,6 +217,7 @@ (req-package company :commands (company-mode) + :diminish "Cmpl" :bind (("C-" . company-complete)) :init (progn (add-hook 'prog-mode-hook #'company-mode) -- cgit 1.4.1 From 8fd7aee3073cd8baa50767a9c948d47d539b5c71 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 14 Jul 2014 20:44:15 +0100 Subject: Emacs: fix typo in docstring --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 88309928..1ff713bc 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -248,7 +248,7 @@ (insert (format-time-string format)))) (defun insert-datetime (prefix) - "Insert the currrent date and time." + "Insert the current date and time." (interactive "P") (let ((format (cond ((not prefix) "%Y-%m-%d %H:%M:%S") -- cgit 1.4.1 From b1a405303f7f8783b411c45ceef23eaadf7541ed Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 14 Jul 2014 20:45:39 +0100 Subject: Emacs: refactor rename-modeline --- tag-emacs/emacs.d/init.el | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 1ff713bc..2ae8a961 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -12,10 +12,9 @@ (load custom-file :noerror) ;;;; Helper Macros -(defmacro rename-modeline (package-name mode new-name) - `(eval-after-load ,package-name - '(defadvice ,mode (after rename-modeline activate) - (setq mode-name ,new-name)))) +(defmacro rename-modeline (mode new-name) + `(defadvice ,mode (after rename-modeline activate) + (setq mode-name ,new-name))) ;;; Allow lisps to use a common setup. I don't know why they don't have some lispy mode as their parent, but this is close enough (defcustom lisp-common-mode-hook nil @@ -973,7 +972,7 @@ (set (make-local-variable 'lisp-indent-function) #'common-lisp-indent-function)) -(rename-modeline "lisp-mode" emacs-lisp-mode "ξ") +(rename-modeline emacs-lisp-mode "ξ") (add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup) (add-hook 'emacs-lisp-mode-hook #'turn-on-eldoc-mode) -- cgit 1.4.1 From 8e8ee807a7d8c9519de97697000044a43cc0e3a8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 14 Jul 2014 20:46:03 +0100 Subject: Emacs: Diminish magit to a branch ideograph --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 2ae8a961..b19588d8 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -785,6 +785,7 @@ (req-package magit :diminish magit-auto-revert-mode :commands (magit-status) + :config (rename-modeline magit-status-mode "⺦") :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) ;;;; Spelling -- cgit 1.4.1 From 09d20bc7afc9291ed47a253a1775a89108697bd4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 15 Jul 2014 20:50:44 +0100 Subject: Emacs: disable auto-starring packages on github --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index b19588d8..4b8f45d8 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -52,7 +52,7 @@ (req-package paradox :defer t :config (progn - (setq paradox-automatically-star t))) + (setq paradox-automatically-star nil))) (defun package-list-installed () (loop for pkg in package-activated-list -- cgit 1.4.1 From 80f13cdc3b95b664af1afa6e4fa33b27626a40ab Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 15 Jul 2014 20:51:04 +0100 Subject: Emacs: Simplify php-sql to work with heredocs only --- tag-emacs/emacs.d/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 4b8f45d8..97927e62 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1115,8 +1115,8 @@ (mmm-add-classes '((php-sql :submode sql-mode - :front "\\($\\(sql\\|query\\)\\s-*=\\s-*[\"']\\|<< manageHook defaultConfig, + layoutHook = avoidStruts $ layoutHook defaultConfig, + logHook = dynamicLogWithPP xmobarPP { + ppOutput = hPutStrLn xmproc, + ppTitle = xmobarColor "green" "" . shorten 50 + }, + terminal = "urxvt", + modMask = mod4Mask + } -- cgit 1.4.1 From 75f064acac3c5b8d3ff84e15f70bd60e0422a975 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 18 Jul 2014 20:33:20 +0100 Subject: Add xmonad and xmobar tags to host "prefect" --- host-prefect/rcrc.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host-prefect/rcrc.local b/host-prefect/rcrc.local index de3dcb98..ef1a437d 100644 --- a/host-prefect/rcrc.local +++ b/host-prefect/rcrc.local @@ -1,2 +1,2 @@ DOTFILES_DIRS="$HOME/projects/dotfiles" -TAGS="emacs git hg sakura ssh tmux vagrant xresources zsh" +TAGS="emacs git hg sakura ssh tmux vagrant xresources xmonad xmobar zsh" -- cgit 1.4.1 From 40133c84069510bc09ff2b460d0bf0f3da36097a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 19 Jul 2014 13:13:08 +0100 Subject: Emacs: Fix package archive functions' for 24.3 --- tag-emacs/emacs.d/init.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index b92b1fab..47fa705a 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -60,7 +60,7 @@ (defun package-list-installed () (loop for pkg in package-activated-list - collect (cdr (assq pkg package-archive-contents)))) + collect (assq pkg package-archive-contents))) (defun package-archive-stats () (let ((archives (makehash)) @@ -70,15 +70,15 @@ (maphash (lambda (k v) (setq assoc (cons (cons k v) assoc))) (dolist (pkg (-filter #'identity (package-list-installed)) archives) - (let ((pkg-arc (package-desc-archive pkg))) + (let ((pkg-arc (package-desc-archive (cdr pkg)))) (incf (gethash pkg-arc archives))))) assoc)) (defun package-show-installed-from-archive (archive) (interactive (list (helm-comp-read "Archive: " (mapcar #'car package-archives) :must-match t))) - (let ((from-arc (mapcar #'package-desc-name - (--filter (equalp (package-desc-archive it) archive) + (let ((from-arc (mapcar #'car + (--filter (equalp (package-desc-archive (cdr it)) archive) (package-list-installed))))) (if (called-interactively-p) (message "%s" from-arc) -- cgit 1.4.1 From b07c260e62bf809b6b60c12c83515335c0da0c5e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 19 Jul 2014 19:51:42 +0100 Subject: zsh: Don't run envoy when SSH_AUTH_SOCK is defined --- tag-zsh/config/zsh/zshenv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index 24dca14a..25476653 100755 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -50,7 +50,7 @@ then eval "$(direnv hook zsh)" fi -if [[ $os == gnu && -s $commands[envoy] ]] +if [[ $os == gnu && -z $SSH_AUTH_SOCK && -s $commands[envoy] ]] then envoy -t gpg-agent eval $(envoy -p) -- cgit 1.4.1 From ea81adff7d45801de3ea5e7b014494fb185d8934 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 20 Jul 2014 07:58:07 +0100 Subject: Xmobar: fix freezing in Xmonad --- tag-xmobar/xmobarrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-xmobar/xmobarrc b/tag-xmobar/xmobarrc index 5f455ec3..665ee3a7 100644 --- a/tag-xmobar/xmobarrc +++ b/tag-xmobar/xmobarrc @@ -31,9 +31,10 @@ Config { font = "-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*" , Run Memory ["-p", "3" ,"-t", "Mem: %" ] 20 + , Run StdinReader , Run Date "%a %b %_d %Y %H:%M" "date" 100 ] , sepChar = "%" , alignSep = "}{" - , template = "%cpu% | %memory% | %dynnetwork% }{ %EGNX% | %date%" + , template = "%cpu% | %memory% | %dynnetwork% | %StdinReader% }{ %EGNX% | %date%" } -- cgit 1.4.1 From 1dba95bca7fd7564f260a82c32a8d63f168da892 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 20 Jul 2014 08:04:52 +0100 Subject: Xmobar: Reorder items --- tag-xmobar/xmobarrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-xmobar/xmobarrc b/tag-xmobar/xmobarrc index 665ee3a7..ad2686d7 100644 --- a/tag-xmobar/xmobarrc +++ b/tag-xmobar/xmobarrc @@ -36,5 +36,5 @@ Config { font = "-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*" ] , sepChar = "%" , alignSep = "}{" - , template = "%cpu% | %memory% | %dynnetwork% | %StdinReader% }{ %EGNX% | %date%" + , template = "%StdinReader% }{ %cpu% | %memory% | %dynnetwork% | %EGNX% | %date%" } -- cgit 1.4.1 From fdb0d0b207a2f769def97986055f2b26e1505ff7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 20 Jul 2014 08:05:36 +0100 Subject: Xmonad: Increase length of xmobar window titles --- tag-xmonad/xmonad/xmonad.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-xmonad/xmonad/xmonad.hs b/tag-xmonad/xmonad/xmonad.hs index fda328c0..93a6edf4 100644 --- a/tag-xmonad/xmonad/xmonad.hs +++ b/tag-xmonad/xmonad/xmonad.hs @@ -12,7 +12,7 @@ main = do layoutHook = avoidStruts $ layoutHook defaultConfig, logHook = dynamicLogWithPP xmobarPP { ppOutput = hPutStrLn xmproc, - ppTitle = xmobarColor "green" "" . shorten 50 + ppTitle = xmobarColor "green" "" . shorten 200 }, terminal = "urxvt", modMask = mod4Mask -- cgit 1.4.1 From d937e36f99214675f4ba45a579db290f8e1ce525 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 20 Jul 2014 08:13:19 +0100 Subject: Xmobar: Reduce width to 90% --- tag-xmobar/xmobarrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-xmobar/xmobarrc b/tag-xmobar/xmobarrc index ad2686d7..843efab8 100644 --- a/tag-xmobar/xmobarrc +++ b/tag-xmobar/xmobarrc @@ -3,7 +3,7 @@ Config { font = "-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*" , border = TopB , bgColor = "#002b36" , fgColor = "#fdf6e3" - , position = Bottom + , position = BottomW L 90 , lowerOnStart = False , hideOnStart = False , persistent = True -- cgit 1.4.1 From 472136ff4daaef2b7535b18cef4d8d56511cb0a8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 20 Jul 2014 08:28:58 +0100 Subject: zsh: Check SSH_AUTH_SOCK more precisely --- tag-zsh/config/zsh/zshenv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index 25476653..3572571f 100755 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -50,7 +50,7 @@ then eval "$(direnv hook zsh)" fi -if [[ $os == gnu && -z $SSH_AUTH_SOCK && -s $commands[envoy] ]] +if [[ $os == gnu && ! -S $SSH_AUTH_SOCK && -s $commands[envoy] ]] then envoy -t gpg-agent eval $(envoy -p) -- cgit 1.4.1 From 41094953cf1c751ace460f7814dc2b10fb9f9ea1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 20 Jul 2014 10:35:28 +0100 Subject: Xmobar: use terminus font --- tag-xmobar/xmobarrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-xmobar/xmobarrc b/tag-xmobar/xmobarrc index 843efab8..ae7c7112 100644 --- a/tag-xmobar/xmobarrc +++ b/tag-xmobar/xmobarrc @@ -1,4 +1,4 @@ -Config { font = "-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*" +Config { font = "-*-terminus-medium-r-*-*-12-*-*-*-*-*-*-*" , borderColor = "#657b83" , border = TopB , bgColor = "#002b36" -- cgit 1.4.1 From 3449206c06d060ed0f120af28ee8ab20eae52bf4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 20 Jul 2014 10:35:36 +0100 Subject: Xmobar: use solarized-light colours --- tag-xmobar/xmobarrc | 22 +++++++++++----------- tag-xmonad/xmonad/xmonad.hs | 5 ++++- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/tag-xmobar/xmobarrc b/tag-xmobar/xmobarrc index ae7c7112..dd54a928 100644 --- a/tag-xmobar/xmobarrc +++ b/tag-xmobar/xmobarrc @@ -1,8 +1,8 @@ Config { font = "-*-terminus-medium-r-*-*-12-*-*-*-*-*-*-*" , borderColor = "#657b83" , border = TopB - , bgColor = "#002b36" - , fgColor = "#fdf6e3" + , bgColor = "#fdf6e3" + , fgColor = "#657b83" , position = BottomW L 90 , lowerOnStart = False , hideOnStart = False @@ -10,23 +10,23 @@ Config { font = "-*-terminus-medium-r-*-*-12-*-*-*-*-*-*-*" , commands = [ Run Weather "EGNX" ["-t", "ºC" ,"-L", "12" ,"-H", "22" - ,"--low", "lightblue" - ,"--normal", "green" - ,"--high", "red" + ,"--low", "#268bd2" + ,"--normal", "#859900" + ,"--high", "#dc322f" ] 36000 , Run DynNetwork ["-t", "Net: ¦KB" ,"-L", "512" ,"-H", "10240" - ,"--low", "green" - ,"--normal", "yellow" - ,"--high", "red" + ,"--low", "#859900" + ,"--normal", "#b58900" + ,"--high", "#dc322f" ,"-m", "5" ] 10 , Run Cpu ["-p", "3" ,"-L", "3" ,"-H", "50" - ,"--normal", "green" - ,"--high", "red" + ,"--normal", "#859900" + ,"--high", "#dc322f" ] 10 , Run Memory ["-p", "3" ,"-t", "Mem: %" @@ -36,5 +36,5 @@ Config { font = "-*-terminus-medium-r-*-*-12-*-*-*-*-*-*-*" ] , sepChar = "%" , alignSep = "}{" - , template = "%StdinReader% }{ %cpu% | %memory% | %dynnetwork% | %EGNX% | %date%" + , template = "%StdinReader% }{ %cpu% | %memory% | %dynnetwork% | %EGNX% | %date%" } diff --git a/tag-xmonad/xmonad/xmonad.hs b/tag-xmonad/xmonad/xmonad.hs index 93a6edf4..93670ad5 100644 --- a/tag-xmonad/xmonad/xmonad.hs +++ b/tag-xmonad/xmonad/xmonad.hs @@ -12,7 +12,10 @@ main = do layoutHook = avoidStruts $ layoutHook defaultConfig, logHook = dynamicLogWithPP xmobarPP { ppOutput = hPutStrLn xmproc, - ppTitle = xmobarColor "green" "" . shorten 200 + ppTitle = xmobarColor "#859900" "" . shorten 200, + ppCurrent = xmobarColor "#b58900" "". wrap "[" "]", + ppHiddenNoWindows = xmobarColor "#93a1a1" "", + ppUrgent = xmobarColor "#dc322f" "#b58900" }, terminal = "urxvt", modMask = mod4Mask -- cgit 1.4.1 From 40c5e1810ccee06598a7d97ac2d6930c357c95a6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 20 Jul 2014 11:57:00 +0100 Subject: Xmonad: fix fullscreen --- tag-xmonad/xmonad/xmonad.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-xmonad/xmonad/xmonad.hs b/tag-xmonad/xmonad/xmonad.hs index 93670ad5..ffb6cdd1 100644 --- a/tag-xmonad/xmonad/xmonad.hs +++ b/tag-xmonad/xmonad/xmonad.hs @@ -1,6 +1,7 @@ import XMonad import XMonad.Hooks.DynamicLog import XMonad.Hooks.ManageDocks +import XMonad.Hooks.ManageHelpers import XMonad.Util.Run(spawnPipe) import XMonad.Util.EZConfig(additionalKeys) import System.IO @@ -8,7 +9,7 @@ import System.IO main = do xmproc <-spawnPipe "/usr/bin/xmobar /home/alan/.xmobarrc" xmonad $ defaultConfig { - manageHook = manageDocks <+> manageHook defaultConfig, + manageHook = manageDocks <+> (isFullscreen --> doFullFloat) <+> manageHook defaultConfig, layoutHook = avoidStruts $ layoutHook defaultConfig, logHook = dynamicLogWithPP xmobarPP { ppOutput = hPutStrLn xmproc, -- cgit 1.4.1 From 5240a37475f4da52740ce4d1286f9acf05adfeb0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 20 Jul 2014 12:07:46 +0100 Subject: Xmonad: Remove borders from fullscreen windows --- tag-xmonad/xmonad/xmonad.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-xmonad/xmonad/xmonad.hs b/tag-xmonad/xmonad/xmonad.hs index ffb6cdd1..cb845efd 100644 --- a/tag-xmonad/xmonad/xmonad.hs +++ b/tag-xmonad/xmonad/xmonad.hs @@ -2,6 +2,7 @@ import XMonad import XMonad.Hooks.DynamicLog import XMonad.Hooks.ManageDocks import XMonad.Hooks.ManageHelpers +import XMonad.Layout.NoBorders import XMonad.Util.Run(spawnPipe) import XMonad.Util.EZConfig(additionalKeys) import System.IO @@ -10,7 +11,7 @@ main = do xmproc <-spawnPipe "/usr/bin/xmobar /home/alan/.xmobarrc" xmonad $ defaultConfig { manageHook = manageDocks <+> (isFullscreen --> doFullFloat) <+> manageHook defaultConfig, - layoutHook = avoidStruts $ layoutHook defaultConfig, + layoutHook = smartBorders . avoidStruts $ layoutHook defaultConfig, logHook = dynamicLogWithPP xmobarPP { ppOutput = hPutStrLn xmproc, ppTitle = xmobarColor "#859900" "" . shorten 200, -- cgit 1.4.1 From ec54e2e7f6f60b5caffda6e7754f75f855eef8b6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 20 Jul 2014 12:28:56 +0100 Subject: Emacs: Bind s-s to switching between perspectives --- tag-emacs/emacs.d/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 47fa705a..3a755fd5 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -781,6 +781,8 @@ :defer t) (req-package perspective + :demand t + :bind (("s-s" . persp-switch)) :config (persp-mode)) (req-package persp-projectile -- cgit 1.4.1 From d4d7dd23a4894888bece2896cbfe17d614da6b3a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 21 Jul 2014 19:35:37 +0100 Subject: Emacs: Add binding for ace-jump-line-mode --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 3a755fd5..4cd7faa5 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -894,7 +894,8 @@ (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))) (req-package ace-jump-mode - :bind (("C-c SPC" . ace-jump-mode)) + :bind (("C-c SPC" . ace-jump-mode) + ("C-|" . ace-jump-line-mode)) :config (progn (ace-jump-mode-enable-mark-sync) (setq ace-jump-word-mode-use-query-char nil -- cgit 1.4.1 From 6637004739ad85b7580b6dfc52ef8ec18fa8b6ac Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 21 Jul 2014 21:43:53 +0100 Subject: Add initial xprofile --- tag-xprofile/xprofile | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 tag-xprofile/xprofile diff --git a/tag-xprofile/xprofile b/tag-xprofile/xprofile new file mode 100755 index 00000000..f0a05239 --- /dev/null +++ b/tag-xprofile/xprofile @@ -0,0 +1,9 @@ +#!/bin/sh +envoy -t gpg-agent +eval $(envoy -p) +xrdb -I$HOME/.xresources .Xresources +xsetroot -cursor_name left_ptr +redshift-gtk & +dropboxd & +trayer --edge bottom --align right --SetDockType true --SetPartialStrut true --expand true --width 10 --transparent true --alpha 0 --tint 0xfdf6e3 --height 12 & +emacsclient --alternate-editor="" --eval '"Starting Emacs"' & -- cgit 1.4.1 From 5afd59fb605b592385ea48c347a9ecd6fa144431 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 22 Jul 2014 17:51:32 +0100 Subject: Emacs: Install git-timemachine --- tag-emacs/emacs.d/Cask | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 16d80310..df58102b 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -29,6 +29,7 @@ (depends-on "geiser") (depends-on "ggtags") (depends-on "gist") +(depends-on "git-timemachine") (depends-on "go-eldoc") (depends-on "go-mode") (depends-on "go-projectile") -- cgit 1.4.1 From 656d10b19d09c72b4cc14e96c7639e92493ee853 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 22 Jul 2014 21:42:44 +0100 Subject: Xmonad: fix compiler warnings --- tag-xmonad/xmonad/xmonad.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-xmonad/xmonad/xmonad.hs b/tag-xmonad/xmonad/xmonad.hs index cb845efd..c3f4a23e 100644 --- a/tag-xmonad/xmonad/xmonad.hs +++ b/tag-xmonad/xmonad/xmonad.hs @@ -4,9 +4,9 @@ import XMonad.Hooks.ManageDocks import XMonad.Hooks.ManageHelpers import XMonad.Layout.NoBorders import XMonad.Util.Run(spawnPipe) -import XMonad.Util.EZConfig(additionalKeys) import System.IO +main :: IO () main = do xmproc <-spawnPipe "/usr/bin/xmobar /home/alan/.xmobarrc" xmonad $ defaultConfig { -- cgit 1.4.1 From 3670531f404f2f17327676c46f9487ca60e50547 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 23 Jul 2014 17:57:57 +0100 Subject: Emacs: Enable rainbow-mode for xmonad-type files Create a derived mode to enable specific mode hooks for such files Add hook to new mode for enabling rainbow-mode --- tag-emacs/emacs.d/init.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 4cd7faa5..f33c9544 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -148,6 +148,12 @@ ((eq system-type 'darwin) (ap/set-fonts "Monaco" "Helvetica" 12)))) +(req-package rainbow-mode + :commands (rainbow-turn-on + rainbow-turn-off) + :config (progn + (add-hook 'xmonad-mode-hook #'rainbow-turn-on))) + ;;;; Autosaves & Backups (let ((backup-dir (expand-file-name "~/.emacs.d/backups/"))) (unless (file-directory-p backup-dir) @@ -578,8 +584,11 @@ ("\\.Xresources\\'" . xrdb-mode))) (req-package haskell-mode - :mode (("\\.hs\\'" . haskell-mode) - ("xmobarrc\\'" . haskell-mode))) + :mode (("\\.hs\\'" . haskell-mode))) + +(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)) (req-package nginx-mode :mode (("nginx.conf" . nginx-mode)) -- cgit 1.4.1 From 4df97a86f16884e30590f9c60ba4a358cdcf16aa Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 24 Jul 2014 19:29:28 +0100 Subject: Xmonad: Improve fullscreen support --- tag-xmonad/xmonad/xmonad.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tag-xmonad/xmonad/xmonad.hs b/tag-xmonad/xmonad/xmonad.hs index c3f4a23e..8c1fb86c 100644 --- a/tag-xmonad/xmonad/xmonad.hs +++ b/tag-xmonad/xmonad/xmonad.hs @@ -1,5 +1,6 @@ import XMonad import XMonad.Hooks.DynamicLog +import XMonad.Hooks.EwmhDesktops import XMonad.Hooks.ManageDocks import XMonad.Hooks.ManageHelpers import XMonad.Layout.NoBorders @@ -20,5 +21,6 @@ main = do ppUrgent = xmobarColor "#dc322f" "#b58900" }, terminal = "urxvt", - modMask = mod4Mask + modMask = mod4Mask, + handleEventHook = fullscreenEventHook } -- cgit 1.4.1 From fbe89264aba6aac51531183290beb1d218602d6c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 24 Jul 2014 19:29:38 +0100 Subject: Xmonad: Force mpv to fullscreen --- tag-xmonad/xmonad/xmonad.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tag-xmonad/xmonad/xmonad.hs b/tag-xmonad/xmonad/xmonad.hs index 8c1fb86c..56c2b00e 100644 --- a/tag-xmonad/xmonad/xmonad.hs +++ b/tag-xmonad/xmonad/xmonad.hs @@ -6,12 +6,16 @@ import XMonad.Hooks.ManageHelpers import XMonad.Layout.NoBorders import XMonad.Util.Run(spawnPipe) import System.IO +import Data.List(isPrefixOf) main :: IO () main = do xmproc <-spawnPipe "/usr/bin/xmobar /home/alan/.xmobarrc" xmonad $ defaultConfig { - manageHook = manageDocks <+> (isFullscreen --> doFullFloat) <+> manageHook defaultConfig, + manageHook = composeOne [ + isFullscreen -?> doFullFloat, + fmap ("mpv" `isPrefixOf`) title -?> doFullFloat + ] <+> manageDocks <+> manageHook defaultConfig, layoutHook = smartBorders . avoidStruts $ layoutHook defaultConfig, logHook = dynamicLogWithPP xmobarPP { ppOutput = hPutStrLn xmproc, -- cgit 1.4.1 From 593b2f866a5557a1978e3352d311829e57952b25 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 24 Jul 2014 19:30:24 +0100 Subject: Xprofile: De-duplicate envoy setup --- tag-xprofile/xprofile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tag-xprofile/xprofile b/tag-xprofile/xprofile index f0a05239..67f927af 100755 --- a/tag-xprofile/xprofile +++ b/tag-xprofile/xprofile @@ -1,6 +1,4 @@ -#!/bin/sh -envoy -t gpg-agent -eval $(envoy -p) +#!/usr/bin/env zsh xrdb -I$HOME/.xresources .Xresources xsetroot -cursor_name left_ptr redshift-gtk & -- cgit 1.4.1 From 0c03d0bd46e1222d5eae80c8760d4458f9bac030 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 24 Jul 2014 20:09:19 +0100 Subject: Emacs: Pick a displayable branch char for magit --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index f33c9544..f58580c5 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -810,7 +810,8 @@ (req-package magit :diminish magit-auto-revert-mode :commands (magit-status) - :config (rename-modeline magit-status-mode "⺦") + :config (let ((chars '(11942 5848 177))) + (rename-modeline magit-status-mode (char-to-string (-find #'char-displayable-p chars)))) :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) ;;;; Spelling -- cgit 1.4.1 From 13f5d9ab105369742f70b7a6d5d6d53b9df129cc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 25 Jul 2014 22:05:43 +0100 Subject: Emacs: Remove commented-out code --- tag-emacs/emacs.d/init.el | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index f58580c5..e4ed9e3a 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -817,10 +817,6 @@ ;;;; Spelling (setq ispell-program-name "aspell" ispell-dictionary "british") -;; (setq ispell-process-directory (expand-file-name "~/")) -;; If aspell is too slow -;; If it is still too slow, use ‘ultra’ instead of ‘fast’ -;; (setq ispell-extra-args '(" --sug-mode=fast")) (req-package ispell :bind (("" . ispell-word))) -- cgit 1.4.1 From f486895467215f531cfb08005f7782a73be2c142 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 25 Jul 2014 22:06:32 +0100 Subject: Xresources: Set Emacs font to Terminus --- host-prefect/Xresources | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/host-prefect/Xresources b/host-prefect/Xresources index b8cb7f0b..c89d4863 100644 --- a/host-prefect/Xresources +++ b/host-prefect/Xresources @@ -1,4 +1,4 @@ #include "main" -Emacs.Font: -*-Droid Sans Mono-medium-*-*-*-*-120-*-*-*-*-*-* -Emacs.fixed-pitch.attributeFont: -*-Droid Sans Mono-medium-*-*-*-*-120-*-*-*-*-*-* +Emacs.Font: -xos4-Terminus-normal-normal-normal-*-14-*-*-*-*-*-*-* +Emacs.fixed-pitch.attributeFont: -xos4-Terminus-normal-normal-normal-*-14-*-*-*-*-*-*-* -- cgit 1.4.1 From 1438a338da1177242ca0cb4cc80dbe7edd3cc034 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 26 Jul 2014 22:10:36 +0100 Subject: Emacs: Configure cedit --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index df58102b..f81e0115 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -10,6 +10,7 @@ (depends-on "autopair") (depends-on "bind-key") (depends-on "cask") +(depends-on "cedit") (depends-on "company") (depends-on "company-go") (depends-on "deferred") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index e4ed9e3a..3f2464f5 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -942,6 +942,22 @@ (eldoc-add-command 'paredit-backward-delete 'paredit-close-round 'autopair-insert-opening) (setq eldoc-idle-delay 0.1))) +(defvar cedit-mode-map (make-sparse-keymap) + "Keymap for the cedit minor mode.") +(req-package cedit + :diminish "{}" + :config (progn + (bind-key "C-M-b" #'cedit-beginning-of-statement cedit-mode-map) + (bind-key "C-M-f" #'cedit-end-of-statement cedit-mode-map) + (bind-key "C-M-d" #'cedit-down-block cedit-mode-map) + (bind-key "C-M-u" #'cedit-up-block-backward cedit-mode-map) + (bind-key "C-M-n" #'cedit-up-block-forward cedit-mode-map) + (bind-key "M-{" #'cedit-wrap-brace cedit-mode-map) + (bind-key "C-)" #'cedit-or-paredit-slurp cedit-mode-map) + (bind-key "C-}" #'cedit-or-paredit-barf cedit-mode-map) + (bind-key "M-" #'cedit-or-paredit-splice-killing-backward cedit-mode-map) + (bind-key "M-r" #'cedit-or-paredit-raise cedit-mode-map))) + (req-package paredit :diminish "()" :commands (paredit-mode) -- cgit 1.4.1 From 866a5c2f8bd10b8284d16fb8853078906a0fa5c0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 26 Jul 2014 22:14:58 +0100 Subject: Emacs: Define minor mode for cedit --- tag-emacs/emacs.d/init.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 3f2464f5..0e8b8497 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -944,6 +944,12 @@ (defvar cedit-mode-map (make-sparse-keymap) "Keymap for the cedit minor mode.") +(define-minor-mode cedit-mode + "Minor mode for paredit-style editing in c-style modes." + :lighter " Cedit") +(defun turn-on-cedit-mode () + (cedit-mode 1)) + (req-package cedit :diminish "{}" :config (progn -- cgit 1.4.1 From 55cf5ba5579f50c6ab021daad8a9808deaf49ac5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 26 Jul 2014 22:15:49 +0100 Subject: Emacs: Enable cedit in c-style modes --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 0e8b8497..87a10253 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -730,7 +730,8 @@ (req-package cc-mode :defer t :init (progn - (add-hook 'c-mode-common-hook #'electric-indent-mode)) + (add-hook 'c-mode-common-hook #'electric-indent-mode) + (add-hook 'c-mode-common-hook #'turn-on-cedit-mode)) :config (progn (setq c-default-style '((java-mode . "java") (awk-mode . "awk") -- cgit 1.4.1 From 0188037674cc96038af7d1c5167322b22e5470ab Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 27 Jul 2014 09:13:46 +0100 Subject: Emacs: Move cedit mode into cedit :init block --- tag-emacs/emacs.d/init.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 87a10253..de34b156 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -943,16 +943,16 @@ (eldoc-add-command 'paredit-backward-delete 'paredit-close-round 'autopair-insert-opening) (setq eldoc-idle-delay 0.1))) -(defvar cedit-mode-map (make-sparse-keymap) - "Keymap for the cedit minor mode.") -(define-minor-mode cedit-mode - "Minor mode for paredit-style editing in c-style modes." - :lighter " Cedit") -(defun turn-on-cedit-mode () - (cedit-mode 1)) - (req-package cedit :diminish "{}" + :init (progn + (defvar cedit-mode-map (make-sparse-keymap) + "Keymap for the cedit minor mode.") + (define-minor-mode cedit-mode + "Minor mode for paredit-style editing in c-style modes." + :lighter " Cedit") + (defun turn-on-cedit-mode () + (cedit-mode 1))) :config (progn (bind-key "C-M-b" #'cedit-beginning-of-statement cedit-mode-map) (bind-key "C-M-f" #'cedit-end-of-statement cedit-mode-map) -- cgit 1.4.1 From 435bc6797ea984d73ccde1a7c41fd4367db3d05f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 27 Jul 2014 13:50:17 +0100 Subject: Emacs: Rebind beg/end-of-statement to M-a/e Allows C-M-f and C-M-b to be used for smaller movements. --- tag-emacs/emacs.d/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index de34b156..6dfaa87a 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -954,8 +954,8 @@ (defun turn-on-cedit-mode () (cedit-mode 1))) :config (progn - (bind-key "C-M-b" #'cedit-beginning-of-statement cedit-mode-map) - (bind-key "C-M-f" #'cedit-end-of-statement cedit-mode-map) + (bind-key "M-a" #'cedit-beginning-of-statement cedit-mode-map) + (bind-key "M-e" #'cedit-end-of-statement cedit-mode-map) (bind-key "C-M-d" #'cedit-down-block cedit-mode-map) (bind-key "C-M-u" #'cedit-up-block-backward cedit-mode-map) (bind-key "C-M-n" #'cedit-up-block-forward cedit-mode-map) -- cgit 1.4.1 From e88eb66d9a6789c550537fa1ceb51f956f2d3d65 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 27 Jul 2014 16:41:30 +0100 Subject: Emacs: Enable paredit-mode with cedit-mode --- tag-emacs/emacs.d/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 6dfaa87a..58cc8cf5 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -945,6 +945,7 @@ (req-package cedit :diminish "{}" + :require paredit :init (progn (defvar cedit-mode-map (make-sparse-keymap) "Keymap for the cedit minor mode.") @@ -952,6 +953,7 @@ "Minor mode for paredit-style editing in c-style modes." :lighter " Cedit") (defun turn-on-cedit-mode () + (enable-paredit-mode) (cedit-mode 1))) :config (progn (bind-key "M-a" #'cedit-beginning-of-statement cedit-mode-map) -- cgit 1.4.1 From c9994d8bda08e4a9f582c07808122a8362431370 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 27 Jul 2014 16:47:02 +0100 Subject: Emacs: Move cedit's c-mode hook to cedit init --- tag-emacs/emacs.d/init.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 58cc8cf5..0ea80fb1 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -730,8 +730,7 @@ (req-package cc-mode :defer t :init (progn - (add-hook 'c-mode-common-hook #'electric-indent-mode) - (add-hook 'c-mode-common-hook #'turn-on-cedit-mode)) + (add-hook 'c-mode-common-hook #'electric-indent-mode)) :config (progn (setq c-default-style '((java-mode . "java") (awk-mode . "awk") @@ -954,7 +953,8 @@ :lighter " Cedit") (defun turn-on-cedit-mode () (enable-paredit-mode) - (cedit-mode 1))) + (cedit-mode 1)) + (add-hook #'c-mode-common-hook #'turn-on-cedit-mode)) :config (progn (bind-key "M-a" #'cedit-beginning-of-statement cedit-mode-map) (bind-key "M-e" #'cedit-end-of-statement cedit-mode-map) -- cgit 1.4.1 From 6c8782b1bbd6200a3dcde9219bf0330090dd8b3e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 27 Jul 2014 16:48:00 +0100 Subject: Emacs: Rename lisp-common-mode-hook Make it the same style as c-mode-common-hook --- tag-emacs/emacs.d/init.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 0ea80fb1..b447b565 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -17,7 +17,7 @@ (setq mode-name ,new-name))) ;;; Allow lisps to use a common setup. I don't know why they don't have some lispy mode as their parent, but this is close enough -(defcustom lisp-common-mode-hook nil +(defcustom lisp-mode-common-hook nil "Hook run when entering any Lisp mode." :type 'hook :group 'lisp) @@ -917,7 +917,7 @@ (defun autopair-off () (autopair-mode -1)) (add-hook 'web-mode-hook #'autopair-off) - (add-hook 'lisp-common-mode-hook #'autopair-off) + (add-hook 'lisp-mode-common-hook #'autopair-off) (setq autopair-blink nil autopair-skip-whitespace nil))) @@ -971,7 +971,7 @@ :diminish "()" :commands (paredit-mode) :init (progn - (add-hook 'lisp-common-mode-hook #'enable-paredit-mode) + (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 'minibuffer-setup-hook #'conditionally-enable-paredit-mode) @@ -1013,7 +1013,7 @@ ;;;; Lisps (defun ap/lisp-setup () - (run-hooks 'lisp-common-mode-hook) + (run-hooks 'lisp-mode-common-hook) (setq indent-tabs-mode nil) (local-set-key (kbd "RET") #'paredit-newline)) @@ -1043,13 +1043,13 @@ :diminish " Λ" :defer t :init (progn - (add-hook 'lisp-common-mode-hook #'turn-on-redshank-mode))) + (add-hook 'lisp-mode-common-hook #'turn-on-redshank-mode))) (req-package ielm :defer t :config (progn (add-hook 'ielm-mode-hook (lambda () - (run-hooks 'lisp-common-mode-hook))))) + (run-hooks 'lisp-mode-common-hook))))) (req-package slime :commands (slime) -- cgit 1.4.1 From 7dd052f897b8cc1ef85c78a9570f6ba2cc82148e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 27 Jul 2014 16:55:43 +0100 Subject: Emacs: Disable autopair in c-mode-common-hook Superfluous with cedit --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index b447b565..89487b17 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -918,6 +918,7 @@ (autopair-mode -1)) (add-hook 'web-mode-hook #'autopair-off) (add-hook 'lisp-mode-common-hook #'autopair-off) + (add-hook 'c-mode-common-hook #'autopair-off) (setq autopair-blink nil autopair-skip-whitespace nil))) -- cgit 1.4.1 From 4da97ef8d9b413a2c68b77ec9a7128da674bff03 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 29 Jul 2014 18:57:01 +0100 Subject: zsh: Create sf alias to `app/console` --- tag-zsh/config/zsh/zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 8005b526..ce15330a 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -284,6 +284,7 @@ fi if [[ -n $commands[composer.phar] && ! -n $commands[composer] ]]; then alias composer="composer.phar" + alias sf="app/console" fi # Functions -- cgit 1.4.1 From 8dd05341d726e577547750ca5e5a274c1e384ac5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 29 Jul 2014 19:02:39 +0100 Subject: Add globalrc --- tag-global/globalrc | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 tag-global/globalrc diff --git a/tag-global/globalrc b/tag-global/globalrc new file mode 100644 index 00000000..7fd1a0bb --- /dev/null +++ b/tag-global/globalrc @@ -0,0 +1,6 @@ +default:\ + :tc=symfony_global: + +symfony_global:\ + :suffixes=php,yml,yaml,html,twig,xml:\ + :skip=/app/cache,node_modules,bin,/app/logs,GPATH,GTAGS,GRTAGS,GSYMS,HTML/,HTML.pub/,html/,tags,TAGS,ID,y.tab.c,y.tab.h,.notfunction,cscope.out,cscope.po.out,cscope.in.out,.gdbinit,SCCS/,RCS/,CVS/,CVSROOT/,{arch}/,.svn/,.git/,.cvsrc,.cvsignore,.gitignore,.cvspass,.cvswrappers,.deps/,autom4te.cache/,.snprj/: -- cgit 1.4.1 From ade976ee7c67c62d4f209d4bdef7682191f3bb3b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 29 Jul 2014 19:13:25 +0100 Subject: Git: Add gitk config --- tag-git/config/git/gitk | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 tag-git/config/git/gitk diff --git a/tag-git/config/git/gitk b/tag-git/config/git/gitk new file mode 100644 index 00000000..6be35d1a --- /dev/null +++ b/tag-git/config/git/gitk @@ -0,0 +1,61 @@ +set mainfont {{Lucida Grande} 9} +set textfont {Monaco 9} +set uifont {{Lucida Grande} 9 bold} +set tabstop 8 +set findmergefiles 0 +set maxgraphpct 50 +set maxwidth 16 +set cmitmode patch +set wrapcomment none +set autoselect 1 +set autosellen 40 +set showneartags 1 +set maxrefs 20 +set hideremotes 0 +set showlocalchanges 1 +set datetimeformat {%Y-%m-%d %H:%M:%S} +set limitdiffs 1 +set uicolor grey85 +set want_ttk 1 +set bgcolor white +set fgcolor black +set uifgcolor black +set uifgdisabledcolor #999 +set colors {green red blue magenta darkgrey brown orange} +set diffcolors {red "#00a000" blue} +set mergecolors {red blue green purple brown "#009090" magenta "#808000" "#009000" "#ff0080" cyan "#b07070" "#70b0f0" "#70f0b0" "#f0b070" "#ff70b0"} +set markbgcolor #e0e0ff +set diffcontext 3 +set selectbgcolor gray85 +set foundbgcolor yellow +set currentsearchhitbgcolor orange +set extdifftool opendiff +set perfile_attrs 0 +set headbgcolor green +set headfgcolor black +set headoutlinecolor black +set remotebgcolor #ffddaa +set tagbgcolor yellow +set tagfgcolor black +set tagoutlinecolor black +set reflinecolor black +set filesepbgcolor #aaaaaa +set filesepfgcolor black +set linehoverbgcolor #ffff80 +set linehoverfgcolor black +set linehoveroutlinecolor black +set mainheadcirclecolor yellow +set workingfilescirclecolor red +set indexcirclecolor green +set circlecolors {white blue gray blue blue} +set linkfgcolor blue +set circleoutlinecolor black +set geometry(main) 1477x845+26+50 +set geometry(state) normal +set geometry(topwidth) 1477 +set geometry(topheight) 165 +set geometry(pwsash0) "378 1" +set geometry(pwsash1) "569 1" +set geometry(botwidth) 473 +set geometry(botheight) 675 +set permviews {} -- cgit 1.4.1 From c1f07439bed52dfacae1c88772c85c4509905cd8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 29 Jul 2014 19:13:44 +0100 Subject: Gitk: Set tabstops --- tag-git/config/git/gitk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-git/config/git/gitk b/tag-git/config/git/gitk index 6be35d1a..52efdc97 100644 --- a/tag-git/config/git/gitk +++ b/tag-git/config/git/gitk @@ -1,7 +1,7 @@ set mainfont {{Lucida Grande} 9} set textfont {Monaco 9} set uifont {{Lucida Grande} 9 bold} -set tabstop 8 +set tabstop 4 set findmergefiles 0 set maxgraphpct 50 set maxwidth 16 -- cgit 1.4.1 From 0f10c8bbb70030dace8386e514b8cd7881dc2044 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 29 Jul 2014 19:15:35 +0100 Subject: Gitk: Configure better fonts --- tag-git/config/git/gitk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tag-git/config/git/gitk b/tag-git/config/git/gitk index 52efdc97..9c1a96a4 100644 --- a/tag-git/config/git/gitk +++ b/tag-git/config/git/gitk @@ -1,6 +1,6 @@ -set mainfont {{Lucida Grande} 9} -set textfont {Monaco 9} -set uifont {{Lucida Grande} 9 bold} +set mainfont {{Lucida Grande} 12} +set textfont {Monaco 12} +set uifont {{Lucida Grande} 12 bold} set tabstop 4 set findmergefiles 0 set maxgraphpct 50 -- cgit 1.4.1 From 907e65e369e87f82e08d4b642fbd2201bdef0737 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 29 Jul 2014 19:23:12 +0100 Subject: Gitk: Increase height of log window --- tag-git/config/git/gitk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-git/config/git/gitk b/tag-git/config/git/gitk index 9c1a96a4..0eb9a033 100644 --- a/tag-git/config/git/gitk +++ b/tag-git/config/git/gitk @@ -53,7 +53,7 @@ set circleoutlinecolor black set geometry(main) 1477x845+26+50 set geometry(state) normal set geometry(topwidth) 1477 -set geometry(topheight) 165 +set geometry(topheight) 300 set geometry(pwsash0) "378 1" set geometry(pwsash1) "569 1" set geometry(botwidth) 473 -- cgit 1.4.1 From 5e96669ee94ea6c58faa95f858a3b80ea9a25416 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 30 Jul 2014 09:55:30 +0100 Subject: Emacs: Fix error when opening magit --- tag-emacs/emacs.d/init.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 89487b17..a284eefc 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -810,8 +810,7 @@ (req-package magit :diminish magit-auto-revert-mode :commands (magit-status) - :config (let ((chars '(11942 5848 177))) - (rename-modeline magit-status-mode (char-to-string (-find #'char-displayable-p chars)))) + :config (rename-modeline magit-status-mode (char-to-string (-find #'char-displayable-p '(11942 5848 177)))) :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) ;;;; Spelling -- cgit 1.4.1 From baf91c5e7e9e4f217967352d59ac7fcefa6f3c59 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 31 Jul 2014 18:22:36 +0100 Subject: Revert "Xprofile: De-duplicate envoy setup" This reverts commit 593b2f866a5557a1978e3352d311829e57952b25. --- tag-xprofile/xprofile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tag-xprofile/xprofile b/tag-xprofile/xprofile index 67f927af..f0a05239 100755 --- a/tag-xprofile/xprofile +++ b/tag-xprofile/xprofile @@ -1,4 +1,6 @@ -#!/usr/bin/env zsh +#!/bin/sh +envoy -t gpg-agent +eval $(envoy -p) xrdb -I$HOME/.xresources .Xresources xsetroot -cursor_name left_ptr redshift-gtk & -- cgit 1.4.1 From 01c866e881f21315cb24466e10648b5a25cb0532 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 31 Jul 2014 18:41:58 +0100 Subject: zsh: Remove fasd 'sf' alias --- tag-zsh/config/zsh/fasd.zsh | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-zsh/config/zsh/fasd.zsh b/tag-zsh/config/zsh/fasd.zsh index 64dbf7b0..7143ac7d 100644 --- a/tag-zsh/config/zsh/fasd.zsh +++ b/tag-zsh/config/zsh/fasd.zsh @@ -1,7 +1,6 @@ alias a='fasd -a' alias s='fasd -si' alias sd='fasd -sid' -alias sf='fasd -sif' alias d='fasd -d' alias f='fasd -f' # function to execute built-in cd -- cgit 1.4.1 From 7be6383e4cec5a4162c495a90b326d3be47ad354 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Aug 2014 17:21:17 +0100 Subject: Emacs: Bind C-x v C to vc-resolve-conflicts --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index a284eefc..617f61ae 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -799,6 +799,7 @@ (req-package vc :defer t + :bind (("C-x v C" . vc-resolve-conflicts)) :config (progn (setq vc-follow-symlinks t))) -- cgit 1.4.1 From f76a7ccbeb66c372eec14bb26b4f5c7c727427c1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Aug 2014 17:36:17 +0100 Subject: Emacs: Move vc and misc info back to mode line --- tag-emacs/emacs.d/init.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 617f61ae..571223e7 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -564,14 +564,14 @@ '("" (sml/buffer-identification sml/buffer-identification (:eval - (sml/generate-buffer-identification))) + (sml/generate-buffer-identification)))) + mode-line-format + '("%e" mode-line-front-space mode-line-mule-info mode-line-client mode-line-modified mode-line-auto-compile mode-line-remote mode-line-frame-identification sml/pos-id-separator mode-line-position + sml/pre-modes-separator mode-line-modes mode-line-end-spaces (vc-mode vc-mode) " " sml/pos-id-separator - mode-line-misc-info) - mode-line-format - '("%e" mode-line-front-space mode-line-mule-info mode-line-client mode-line-modified mode-line-auto-compile mode-line-remote mode-line-frame-identification sml/pos-id-separator mode-line-position - sml/pre-modes-separator mode-line-modes mode-line-end-spaces)))) + mode-line-misc-info)))) ;;;; Modes ;;;; systemd files -- cgit 1.4.1 From 235939fd09edd28086a8eb6f7c980ab4da2df78f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Aug 2014 19:52:55 +0100 Subject: Emacs: Switch to Leuven theme --- tag-emacs/emacs.d/Cask | 3 +-- tag-emacs/emacs.d/init.el | 22 ++-------------------- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index f81e0115..9fa10c64 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -42,6 +42,7 @@ (depends-on "help-fns+") (depends-on "jinja2-mode") (depends-on "js2-mode") +(depends-on "leuven-theme") (depends-on "litable") (depends-on "lua-mode") (depends-on "magit") @@ -72,10 +73,8 @@ (depends-on "skewer-mode") (depends-on "slime") (depends-on "smart-forward") -(depends-on "smart-mode-line") (depends-on "smart-tab") (depends-on "smart-tabs-mode") -(depends-on "solarized-theme") (depends-on "toml-mode") (depends-on "tup-mode") (depends-on "undo-tree") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 571223e7..fdf25747 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -121,8 +121,8 @@ '(isearch-abort abort-recursive-edit exit-minibuffer keyboard-quit undo-tree-undo)) (ding)))) -(req-package solarized-theme - :config (load-theme 'solarized-light t)) +(req-package leuven-theme + :config (load-theme 'leuven t)) (when (or (display-graphic-p) (daemonp)) @@ -554,24 +554,6 @@ (column-number-mode t) (size-indication-mode t) -(req-package smart-mode-line - :require solarized-theme - :config (progn - (setq sml/theme 'respectful) - (sml/setup) - (setq-default - header-line-format - '("" - (sml/buffer-identification sml/buffer-identification - (:eval - (sml/generate-buffer-identification)))) - mode-line-format - '("%e" mode-line-front-space mode-line-mule-info mode-line-client mode-line-modified mode-line-auto-compile mode-line-remote mode-line-frame-identification sml/pos-id-separator mode-line-position - sml/pre-modes-separator mode-line-modes mode-line-end-spaces - (vc-mode vc-mode) - " " - sml/pos-id-separator - mode-line-misc-info)))) ;;;; Modes ;;;; systemd files -- cgit 1.4.1 From 0ef099b442c8437cee44a2b54503c2c2029815a7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Aug 2014 19:53:38 +0100 Subject: Emacs: add dependency on rainbow-mode --- tag-emacs/emacs.d/Cask | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 9fa10c64..332ebeef 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -1,3 +1,4 @@ +(source gnu) (source marmalade) (source melpa) (source melpa-stable) @@ -66,6 +67,7 @@ (depends-on "projectile") (depends-on "pt") (depends-on "quickrun") +(depends-on "rainbow-mode") (depends-on "redshank") (depends-on "req-package") (depends-on "s") -- cgit 1.4.1 From 90676d96644c8d4f6f172d7658f00d597fec4194 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Aug 2014 20:55:27 +0100 Subject: Emacs: Recreate header-line setup --- tag-emacs/emacs.d/init.el | 91 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 90 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index fdf25747..3891d664 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -122,7 +122,12 @@ (ding)))) (req-package leuven-theme - :config (load-theme 'leuven t)) + :config (progn + (load-theme 'leuven t) + (setq face-remapping-alist + '((header-line (:box nil) mode-line-inactive) + (mode-line-buffer-id (:weight bold :foreground "#EEF5FE")))) +)) (when (or (display-graphic-p) (daemonp)) @@ -554,6 +559,90 @@ (column-number-mode t) (size-indication-mode t) +(defun fill-line-format (line-format) + (max 0 + (- (window-width) + (length (format-mode-line line-format))))) + +(defvar mode-line-size + `((size-indication-mode + ((-3 ,(propertize + "%p" + 'local-map mode-line-column-line-number-mode-map + 'mouse-face 'mode-line-highlight + ;; XXX needs better description + 'help-echo "Size indication mode\n\ +mouse-1: Display Line and Column Mode Menu")) + " " + (-4 "%I"))))) + +(setq-default + mode-line-modes (let ((recursive-edit-help-echo "Recursive edit, type C-M-c to get out")) + (list (propertize "%[" 'help-echo recursive-edit-help-echo) + `(:propertize ("" mode-name) + help-echo "Major mode\n\ +mouse-1: Display major mode menu\n\ +mouse-2: Show help for major mode\n\ +mouse-3: Toggle minor modes" + mouse-face mode-line-highlight + local-map ,mode-line-major-mode-keymap) + '("" mode-line-process) + `(:propertize ("" minor-mode-alist) + mouse-face mode-line-highlight + help-echo "Minor mode\n\ +mouse-1: Display minor mode menu\n\ +mouse-2: Show help for minor mode\n\ +mouse-3: Toggle minor modes" + local-map ,mode-line-minor-mode-keymap) + (propertize "%n" 'help-echo "mouse-2: Remove narrowing from buffer" + 'mouse-face 'mode-line-highlight + 'local-map (make-mode-line-mouse-map + 'mouse-2 #'mode-line-widen)) + (propertize "%]" 'help-echo recursive-edit-help-echo) + " ")) + mode-line-buffer-identification (list (propertize "%b" + 'face 'mode-line-buffer-id)) + + mode-line-position `((line-number-mode + ((column-number-mode + ,(propertize + "%l:%c" + 'local-map mode-line-column-line-number-mode-map + 'mouse-face 'mode-line-highlight + 'help-echo "Line number and Column number\n\ +mouse-1: Display Line and Column Mode Menu") + (6 ,(propertize + "L%l" + 'local-map mode-line-column-line-number-mode-map + 'mouse-face 'mode-line-highlight + 'help-echo "Line Number\n\ +mouse-1: Display Line and Column Mode Menu")))) + ((column-number-mode + (5 ,(propertize + "C%c" + 'local-map mode-line-column-line-number-mode-map + 'mouse-face 'mode-line-highlight + 'help-echo "Column number\n\ +mouse-1: Display Line and Column Mode Menu")))))) + mode-line-format `("%e" + " " + mode-line-modes + mode-line-misc-info + (vc-mode vc-mode) + mode-line-end-spaces) + header-line-format `("%e" + mode-line-front-space + mode-line-mule-info + mode-line-client + mode-line-modified + mode-line-auto-compile + mode-line-remote " " + mode-line-position " " + mode-line-size + " ⎸ " + mode-line-buffer-identification + )) + ;;;; Modes ;;;; systemd files -- cgit 1.4.1 From 648a40e503df5cd27e04b84502e4aad5c493b782 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Aug 2014 21:58:41 +0100 Subject: Git: Alias up to merge in FETCH_HEAD This means I can leave the fetching to the pure prompt background task and merge in the result after I see an indicator --- tag-git/config/git/config | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-git/config/git/config b/tag-git/config/git/config index 58255433..886112cc 100644 --- a/tag-git/config/git/config +++ b/tag-git/config/git/config @@ -9,6 +9,7 @@ [push] default = current [alias] + up = merge FETCH_HEAD st = status -sb ci = commit br = branch -- cgit 1.4.1 From 68e96902e27c7ee15ccc892a597b1843b1419eb7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 3 Aug 2014 14:55:55 +0100 Subject: Zsh: Add netmount function for OSX --- tag-zsh/config/zsh/osx.zsh | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tag-zsh/config/zsh/osx.zsh diff --git a/tag-zsh/config/zsh/osx.zsh b/tag-zsh/config/zsh/osx.zsh new file mode 100644 index 00000000..d99019ba --- /dev/null +++ b/tag-zsh/config/zsh/osx.zsh @@ -0,0 +1,3 @@ +function netmount () { + osascript -e "try" -e "mount volume \"$1\"" -e "end try" +} -- cgit 1.4.1 From 5ffab52aad168298339a05b5d72fd3affa7a9366 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 3 Aug 2014 14:56:09 +0100 Subject: ZSH: Source osx-specific configuration --- tag-zsh/config/zsh/zshrc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index ce15330a..af56db65 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -383,6 +383,11 @@ else echo "fasd init file is missing." fi -if [[ $OSTYPE == freebsd* ]]; then - source $ZDOTDIR/freebsd.zsh -fi +case $os in + freebsd) + source $ZDOTDIR/freebsd.zsh + ;; + osx) + source $ZDOTDIR/osx.zsh + ;; +esac -- cgit 1.4.1 From 747547ebf0f597cdd63d814418278079c75c6560 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 3 Aug 2014 20:55:52 +0100 Subject: Emacs: Add leuven face for perspective --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 3891d664..274a0cf9 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -126,6 +126,7 @@ (load-theme 'leuven t) (setq face-remapping-alist '((header-line (:box nil) mode-line-inactive) + (persp-selected-face (:foreground "#EEF5FE")) (mode-line-buffer-id (:weight bold :foreground "#EEF5FE")))) )) -- cgit 1.4.1 From 4080f27b143dd8db2e4e45e14ba5b742d71060d2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 3 Aug 2014 20:57:18 +0100 Subject: Emacs: Fix trailing parens --- tag-emacs/emacs.d/init.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 274a0cf9..75a373fa 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -127,8 +127,7 @@ (setq face-remapping-alist '((header-line (:box nil) mode-line-inactive) (persp-selected-face (:foreground "#EEF5FE")) - (mode-line-buffer-id (:weight bold :foreground "#EEF5FE")))) -)) + (mode-line-buffer-id (:weight bold :foreground "#EEF5FE")))))) (when (or (display-graphic-p) (daemonp)) -- cgit 1.4.1 From 6dd0c929aac847aab92bee26fd93d67e8b8620a3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 3 Aug 2014 20:58:20 +0100 Subject: Emacs: Require presence of hemisu-theme --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 2 ++ 2 files changed, 3 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 332ebeef..69e053c9 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -41,6 +41,7 @@ (depends-on "helm-dash") (depends-on "helm-projectile") (depends-on "help-fns+") +(depends-on "hemisu-theme") (depends-on "jinja2-mode") (depends-on "js2-mode") (depends-on "leuven-theme") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 75a373fa..0e8f1e3b 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -129,6 +129,8 @@ (persp-selected-face (:foreground "#EEF5FE")) (mode-line-buffer-id (:weight bold :foreground "#EEF5FE")))))) +(req-package hemisu-theme) + (when (or (display-graphic-p) (daemonp)) -- cgit 1.4.1 From 7942162da58d88216323006e99c1aab49f1e004c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 4 Aug 2014 20:02:49 +0100 Subject: Emacs: Remove paredit spaces when cedit enabled --- tag-emacs/emacs.d/init.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 0e8f1e3b..4f80ec4a 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1048,6 +1048,10 @@ mouse-1: Display Line and Column Mode Menu")))))) (add-hook 'lisp-mode-common-hook #'enable-paredit-mode) (put #'paredit-forward-delete 'delete-selection 'supersede) (put #'paredit-backward-delete 'delete-selection 'supersede) + (defun ap/cedit-space-delimiter-p (endp delimiter) + "Don't insert a space before delimiters in c-style modes" + (not cedit-mode)) + (add-to-list 'paredit-space-for-delimiter-predicates #'ap/cedit-space-delimiter-p) (add-hook 'minibuffer-setup-hook #'conditionally-enable-paredit-mode) (defun conditionally-enable-paredit-mode () "enable paredit-mode during eval-expression" -- cgit 1.4.1 From 1bebc85ea521154eafc7c392d5e11de623edb1dc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 5 Aug 2014 17:09:20 +0100 Subject: Emacs: Fix init error with paredit+cedit paredit-space-for-delimiter-predicates isn't declared until paredit is loaded properly, so add to it after it's been loaded --- tag-emacs/emacs.d/init.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 4f80ec4a..2c619cae 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1044,14 +1044,15 @@ mouse-1: Display Line and Column Mode Menu")))))) (req-package paredit :diminish "()" :commands (paredit-mode) + :config (progn + (defun ap/cedit-space-delimiter-p (endp delimiter) + "Don't insert a space before delimiters in c-style modes" + (not cedit-mode)) + (add-to-list 'paredit-space-for-delimiter-predicates #'ap/cedit-space-delimiter-p)) :init (progn (add-hook 'lisp-mode-common-hook #'enable-paredit-mode) (put #'paredit-forward-delete 'delete-selection 'supersede) (put #'paredit-backward-delete 'delete-selection 'supersede) - (defun ap/cedit-space-delimiter-p (endp delimiter) - "Don't insert a space before delimiters in c-style modes" - (not cedit-mode)) - (add-to-list 'paredit-space-for-delimiter-predicates #'ap/cedit-space-delimiter-p) (add-hook 'minibuffer-setup-hook #'conditionally-enable-paredit-mode) (defun conditionally-enable-paredit-mode () "enable paredit-mode during eval-expression" -- cgit 1.4.1 From 7931b7e3816cf4307a69737aeb1ea8c3727c3f62 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 7 Aug 2014 19:50:25 +0100 Subject: Emacs: Add function for per-mode helm-dash-docsets Use a function generator to avoid repetition --- tag-emacs/emacs.d/init.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 2c619cae..e00506f0 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -327,6 +327,14 @@ ;;;; Documentation +(req-package helm-dash + :defer t + :config (progn + (defun ap/create-helm-dash-hook (docsets) + (lambda () + (when (require 'helm-dash nil :noerror) + (setq-local helm-dash-docsets (if (listp docsets) docsets (list docsets)))))))) + (req-package which-func :init (which-function-mode) :config (setq which-func-modes t)) -- cgit 1.4.1 From 19e0b7925af4551e71a5664d23b72efd7c6a3d53 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 7 Aug 2014 19:52:21 +0100 Subject: Emacs: Create basic ansible major mode --- tag-emacs/emacs.d/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index e00506f0..4e9a9199 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -688,6 +688,9 @@ mouse-1: Display Line and Column Mode Menu")))))) ("/host_vars/.*" . yaml-mode) ("\\.sls\\'" . yaml-mode))) +(define-derived-mode ansible-mode yaml-mode "Ansible") +(add-to-list 'auto-mode-alist '("\\(?:ansible.+\\|roles/.+/\\(?:tasks\\|handlers\\)\\)/.+\\.yml\\'" . ansible-mode)) + ;;;; Planning (req-package org -- cgit 1.4.1 From 538e19d1c47a34e80a343ea1fde70e1908955333 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 7 Aug 2014 19:52:31 +0100 Subject: Emacs: Use ansible dash docset for ansible-mode --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 4e9a9199..8b64dc68 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -333,7 +333,8 @@ (defun ap/create-helm-dash-hook (docsets) (lambda () (when (require 'helm-dash nil :noerror) - (setq-local helm-dash-docsets (if (listp docsets) docsets (list docsets)))))))) + (setq-local helm-dash-docsets (if (listp docsets) docsets (list docsets)))))) + (add-hook 'ansible-mode-hook (ap/create-helm-dash-hook "Ansible")))) (req-package which-func :init (which-function-mode) -- cgit 1.4.1 From d6de014751ceb9ec4460cd84a293199348c5e6b7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 7 Aug 2014 20:03:31 +0100 Subject: Emacs: Configure helm-dash-docsets for PHP & Twig --- tag-emacs/emacs.d/init.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 8b64dc68..d2bfab19 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -334,7 +334,9 @@ (lambda () (when (require 'helm-dash nil :noerror) (setq-local helm-dash-docsets (if (listp docsets) docsets (list docsets)))))) - (add-hook 'ansible-mode-hook (ap/create-helm-dash-hook "Ansible")))) + (add-hook 'ansible-mode-hook (ap/create-helm-dash-hook "Ansible")) + (add-hook 'php-mode-hook (ap/create-helm-dash-hook '("PHP" "Symfony"))) + (add-hook 'twig-mode-hook (ap/create-helm-dash-hook '("Twig"))))) (req-package which-func :init (which-function-mode) @@ -1244,7 +1246,6 @@ mouse-1: Display Line and Column Mode Menu")))))) (req-package web-mode :mode (("/views/.*\\.php\\'" . web-mode) - ("\\.html\\.twig\\'" . web-mode) ("/layouts/.*\\.html" . web-mode) ("/templates/.*\\.php\\'" . web-mode)) :config (setq web-mode-code-indent-offset 4 @@ -1255,6 +1256,9 @@ mouse-1: Display Line and Column Mode Menu")))))) web-mode-comment-style 2 web-mode-disable-auto-pairing t)) +(define-derived-mode twig-mode web-mode "Twig") +(add-to-list 'auto-mode-alist '("\\.html\\.twig\\'" . twig-mode)) + (req-package mmm-auto :config (progn (mmm-add-classes -- cgit 1.4.1 From 869b183e24448e9753bb635a5b1358be0df79ceb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 7 Aug 2014 20:06:32 +0100 Subject: Emacs: Remove unused mustache-mode --- tag-emacs/emacs.d/Cask | 1 - tag-emacs/emacs.d/init.el | 11 +++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 69e053c9..92c010ae 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -53,7 +53,6 @@ (depends-on "move-text") (depends-on "multi-term") (depends-on "multiple-cursors") -(depends-on "mustache-mode") (depends-on "nginx-mode") (depends-on "org-journal") (depends-on "org-plus-contrib") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index d2bfab19..bb0dc9fe 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -675,12 +675,12 @@ mouse-1: Display Line and Column Mode Menu")))))) (add-to-list 'auto-mode-alist '("xmonad.hs\\'" . xmonad-mode)) (req-package nginx-mode - :mode (("nginx.conf" . nginx-mode)) + :defer t :config (progn (setq nginx-indent-tabs-mode t))) (req-package lua-mode - :mode (("\\.lua\\'" . lua-mode))) + :defer t) (req-package ruby-mode :mode (("\\.rb\\'" . ruby-mode) @@ -1215,11 +1215,6 @@ mouse-1: Display Line and Column Mode Menu")))))) :config (progn (setq scss-compile-at-save nil))) -(req-package mustache-mode - :mode (("\\.mustache" . mustache-mode) - ("\\.mt\\'" . mustache-mode) - ("\\.template\\'" . mustache-mode))) - (req-package jinja2-mode :mode (("\\.j2\\'" . jinja2-mode))) @@ -1246,7 +1241,7 @@ mouse-1: Display Line and Column Mode Menu")))))) (req-package web-mode :mode (("/views/.*\\.php\\'" . web-mode) - ("/layouts/.*\\.html" . web-mode) + ("/layouts/.*\\.html\\'" . web-mode) ("/templates/.*\\.php\\'" . web-mode)) :config (setq web-mode-code-indent-offset 4 web-mode-css-indent-offset 4 -- cgit 1.4.1 From 04fc37a53277730a68b8f3af7c8597ae9c1e6ab8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 7 Aug 2014 21:12:20 +0100 Subject: Emacs: Load Cask file in emacs-lisp-mode --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index bb0dc9fe..363c7c0e 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1115,6 +1115,7 @@ mouse-1: Display Line and Column Mode Menu")))))) #'common-lisp-indent-function)) (rename-modeline emacs-lisp-mode "ξ") +(add-to-list 'auto-mode-alist '("/Cask\\'" . emacs-lisp-mode)) (add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup) (add-hook 'emacs-lisp-mode-hook #'turn-on-eldoc-mode) -- cgit 1.4.1 From fbd4633b01cfd64590ecb339f18f3b4ac59c4ddf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 8 Aug 2014 11:38:27 +0100 Subject: Emacs: Create mode for Salt to use with helm-dash --- tag-emacs/emacs.d/init.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 363c7c0e..f0872786 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -336,7 +336,8 @@ (setq-local helm-dash-docsets (if (listp docsets) docsets (list docsets)))))) (add-hook 'ansible-mode-hook (ap/create-helm-dash-hook "Ansible")) (add-hook 'php-mode-hook (ap/create-helm-dash-hook '("PHP" "Symfony"))) - (add-hook 'twig-mode-hook (ap/create-helm-dash-hook '("Twig"))))) + (add-hook 'twig-mode-hook (ap/create-helm-dash-hook '("Twig"))) + (add-hook 'saltstack-mode-hook (ap/create-helm-dash-hook '("SaltStack"))))) (req-package which-func :init (which-function-mode) @@ -694,6 +695,9 @@ mouse-1: Display Line and Column Mode Menu")))))) (define-derived-mode ansible-mode yaml-mode "Ansible") (add-to-list 'auto-mode-alist '("\\(?:ansible.+\\|roles/.+/\\(?:tasks\\|handlers\\)\\)/.+\\.yml\\'" . ansible-mode)) +(define-derived-mode saltstack-mode yaml-mode "Salt") +(add-to-list 'auto-mode-alist '("\\.sls\\'" . saltstack-mode)) + ;;;; Planning (req-package org -- cgit 1.4.1 From d670075375f7bee13b6a8e7b0fe601ef8eed9f86 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 8 Aug 2014 12:35:07 +0100 Subject: rcm: Fix logic error in zsh post-up hook --- hooks/post-up/zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hooks/post-up/zsh b/hooks/post-up/zsh index 938701fe..13f0a018 100755 --- a/hooks/post-up/zsh +++ b/hooks/post-up/zsh @@ -4,11 +4,11 @@ ZDOTDIR="${XDG_CONFIG_HOME:=~/.config}/zsh" pushd $ZDOTDIR for f in z*(-.) do - if [[ -e $f ]] + if [[ -e .$f ]] then if [[ ! -h .$f ]] then - echo "$f already exists as a regular file, ignoring" + echo ".$f already exists as a regular file, ignoring" fi else ln -s $f .$f -- cgit 1.4.1 From 7f9658c3a1d698bb69c7683dbfcebbcde3f89717 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 8 Aug 2014 13:32:48 +0100 Subject: Emacs: Open .jinja files in jinja2-mode --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index f0872786..2f52c09c 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1221,7 +1221,8 @@ mouse-1: Display Line and Column Mode Menu")))))) (setq scss-compile-at-save nil))) (req-package jinja2-mode - :mode (("\\.j2\\'" . jinja2-mode))) + :mode (("\\.j2\\'" . jinja2-mode) + ("\\.jinja\\'" . jinja2-mode))) (req-package php-mode :mode ("\\.php\\'" . php-mode) -- cgit 1.4.1 From efe359272804acb9ad3fc65062393861dd787e7b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Aug 2014 11:22:29 +0100 Subject: Emacs: Add shell script submode to markdown --- tag-emacs/emacs.d/init.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 2f52c09c..43593552 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1279,9 +1279,15 @@ mouse-1: Display Line and Column Mode Menu")))))) :submode common-lisp-mode :face mmm-code-submode-face :front "^{{% highlight cl %}}[\r\n]+" + :back "^{{% /highlight %}}$") + (markdown-shell + :submode shell-script-mode + :face mmm-code-submode-face + :front "^{{% highlight sh %}}[\r\n]+" :back "^{{% /highlight %}}$"))) (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-toml) - (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-lisp)) + (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-lisp) + (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-shell)) :init (setq mmm-global-mode 'maybe)) ;;;; Windows & Frames -- cgit 1.4.1 From c67dcb9f108fae48d0e37d0d51db09d5fe1424bd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 Aug 2014 15:52:04 +0100 Subject: zsh: Move sf=app/console alias definition --- tag-zsh/config/zsh/zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index af56db65..5a8b97f1 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -257,6 +257,7 @@ alias lla="lal" alias llr="ll -t" alias gpp='g++' alias lsr="${ls} -tld *(m-2)" # mtime < -2days +alias sf="app/console" alias pping="prettyping.sh" alias trans="transmission-remote transmission.home" @@ -284,7 +285,6 @@ fi if [[ -n $commands[composer.phar] && ! -n $commands[composer] ]]; then alias composer="composer.phar" - alias sf="app/console" fi # Functions -- cgit 1.4.1 From ab2b5173c4dee51d9888d6e2eb882ea082f4aede Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 Aug 2014 15:52:23 +0100 Subject: zsh: Use version-controlled zsh file Makes configuration a lot easier. --- tag-zsh/config/zsh/zshrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 5a8b97f1..f8a35311 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -376,9 +376,9 @@ fi _FASD_DATA="$HOME/.cache/zsh/fasd-data" autoload -U fasd -if [[ -e ~/.cache/zsh/fasd-init-zsh ]] +if [[ -e ~/.config/zsh/fasd.zsh ]] then - source ~/.cache/zsh/fasd-init-zsh + source ~/.config/zsh/fasd.zsh else echo "fasd init file is missing." fi -- cgit 1.4.1 From 79c9b2271359610fd6918ce7a6f5544bfd34a221 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 Aug 2014 15:53:52 +0100 Subject: rcm: Remove fasd-cache from zsh init hook --- hooks/post-up/zsh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/hooks/post-up/zsh b/hooks/post-up/zsh index 13f0a018..15b6a2f0 100755 --- a/hooks/post-up/zsh +++ b/hooks/post-up/zsh @@ -24,12 +24,6 @@ fi local -a zfiles zfiles=($ZDOTDIR/zshrc) -fasd_cache=~/.cache/zsh/fasd-init-zsh -if [[ -s $commands[fasd] && (! -s "$fasd_cache" || $commands[fasd] -nt "$fasd_cache") ]]; then - fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache" - zfiles=($fasd_cache $zfiles) -fi - autoload -U zrecompile if [[ -f $ZDOTDIR/${HOST%%.*}.zsh ]]; then -- cgit 1.4.1 From d5001338c9ad9d5cf54941a39254597cec4f7801 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 Aug 2014 19:33:09 +0100 Subject: Emacs: Associate Markdown mode and dash docset --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 43593552..4cc5fdd3 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -337,6 +337,7 @@ (add-hook 'ansible-mode-hook (ap/create-helm-dash-hook "Ansible")) (add-hook 'php-mode-hook (ap/create-helm-dash-hook '("PHP" "Symfony"))) (add-hook 'twig-mode-hook (ap/create-helm-dash-hook '("Twig"))) + (add-hook 'markdown-mode-hook (ap/create-helm-dash-hook '("Markdown"))) (add-hook 'saltstack-mode-hook (ap/create-helm-dash-hook '("SaltStack"))))) (req-package which-func -- cgit 1.4.1 From d09f8ce923755a57bdf5aa8b65204202be49c517 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 Aug 2014 19:35:39 +0100 Subject: Emacs: Rebind C-M-[ae] to be useful in text modes --- tag-emacs/emacs.d/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 4cc5fdd3..37c79240 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -959,6 +959,9 @@ mouse-1: Display Line and Column Mode Menu")))))) ;;;; Text editing +(bind-key "C-M-a" #'backward-paragraph text-mode-map) +(bind-key "C-M-e" #'forward-paragraph text-mode-map) + ;; Enable upcase and downcase-region (put 'upcase-region 'disabled nil) (put 'downcase-region 'disabled nil) -- cgit 1.4.1 From 29135a8f93d789dbb2b1511e3d1ea0d6c55c1744 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 14 Aug 2014 19:53:44 +0100 Subject: Emacs: Enable auto-fill-mode in markdown-mode --- tag-emacs/emacs.d/init.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 37c79240..febe4423 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -994,6 +994,11 @@ mouse-1: Display Line and Column Mode Menu")))))) (when (boundp 'x-select-request-type) (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))) +(req-package markdown-mode + :defer t + :config (progn + (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) + (req-package ace-jump-mode :bind (("C-c SPC" . ace-jump-mode) ("C-|" . ace-jump-line-mode)) -- cgit 1.4.1 From 20337e48126635041453c187adfe602dca230c12 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 16 Aug 2014 09:59:23 +0100 Subject: Emacs: Eager-load helm-dash configuration --- tag-emacs/emacs.d/init.el | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index febe4423..1877358c 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -329,16 +329,16 @@ (req-package helm-dash :defer t - :config (progn - (defun ap/create-helm-dash-hook (docsets) - (lambda () - (when (require 'helm-dash nil :noerror) - (setq-local helm-dash-docsets (if (listp docsets) docsets (list docsets)))))) - (add-hook 'ansible-mode-hook (ap/create-helm-dash-hook "Ansible")) - (add-hook 'php-mode-hook (ap/create-helm-dash-hook '("PHP" "Symfony"))) - (add-hook 'twig-mode-hook (ap/create-helm-dash-hook '("Twig"))) - (add-hook 'markdown-mode-hook (ap/create-helm-dash-hook '("Markdown"))) - (add-hook 'saltstack-mode-hook (ap/create-helm-dash-hook '("SaltStack"))))) + :init (progn + (defun ap/create-helm-dash-hook (docsets) + (lambda () + (when (require 'helm-dash nil :noerror) + (setq-local helm-dash-docsets docsets)))) + (add-hook 'ansible-mode-hook (ap/create-helm-dash-hook '("Ansible"))) + (add-hook 'php-mode-hook (ap/create-helm-dash-hook '("PHP" "Symfony"))) + (add-hook 'twig-mode-hook (ap/create-helm-dash-hook '("Twig"))) + (add-hook 'markdown-mode-hook (ap/create-helm-dash-hook '("Markdown"))) + (add-hook 'saltstack-mode-hook (ap/create-helm-dash-hook '("SaltStack"))))) (req-package which-func :init (which-function-mode) -- cgit 1.4.1 From 5f8b835a1bb7793431a525e213fc7c482f59a791 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 17 Aug 2014 15:49:29 +0100 Subject: XMonad: Auto-move common windows to workspaces --- tag-xmonad/xmonad/xmonad.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tag-xmonad/xmonad/xmonad.hs b/tag-xmonad/xmonad/xmonad.hs index 56c2b00e..4b67cb48 100644 --- a/tag-xmonad/xmonad/xmonad.hs +++ b/tag-xmonad/xmonad/xmonad.hs @@ -13,6 +13,10 @@ main = do xmproc <-spawnPipe "/usr/bin/xmobar /home/alan/.xmobarrc" xmonad $ defaultConfig { manageHook = composeOne [ + className =? "Firefox" -?> doShift "2", + className =? "Pidgin" -?> doShift "3", + className =? "nuvolaplayer" -?> doShift "8", + className =? "Transmission-gtk" -?> doShift "9", isFullscreen -?> doFullFloat, fmap ("mpv" `isPrefixOf`) title -?> doFullFloat ] <+> manageDocks <+> manageHook defaultConfig, -- cgit 1.4.1 From 9ddcdea56a49c1933ba7194c0aa87eb3589cf7ff Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 17 Aug 2014 16:16:53 +0100 Subject: XMonad: Reformat and refactor Follow comma-first style. Extract manage hook --- tag-xmonad/xmonad/xmonad.hs | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/tag-xmonad/xmonad/xmonad.hs b/tag-xmonad/xmonad/xmonad.hs index 4b67cb48..9e1fa77f 100644 --- a/tag-xmonad/xmonad/xmonad.hs +++ b/tag-xmonad/xmonad/xmonad.hs @@ -4,31 +4,35 @@ import XMonad.Hooks.EwmhDesktops import XMonad.Hooks.ManageDocks import XMonad.Hooks.ManageHelpers import XMonad.Layout.NoBorders +import XMonad.Util.EZConfig import XMonad.Util.Run(spawnPipe) import System.IO import Data.List(isPrefixOf) +myManageHook :: ManageHook +myManageHook = composeOne + [ className =? "Firefox" -?> doShift "2" + , className =? "Pidgin" -?> doShift "3" + , className =? "nuvolaplayer" -?> doShift "8" + , className =? "Transmission-gtk" -?> doShift "9" + , isFullscreen -?> doFullFloat + , fmap ("mpv" `isPrefixOf`) title -?> doFullFloat + ] + main :: IO () main = do xmproc <-spawnPipe "/usr/bin/xmobar /home/alan/.xmobarrc" - xmonad $ defaultConfig { - manageHook = composeOne [ - className =? "Firefox" -?> doShift "2", - className =? "Pidgin" -?> doShift "3", - className =? "nuvolaplayer" -?> doShift "8", - className =? "Transmission-gtk" -?> doShift "9", - isFullscreen -?> doFullFloat, - fmap ("mpv" `isPrefixOf`) title -?> doFullFloat - ] <+> manageDocks <+> manageHook defaultConfig, - layoutHook = smartBorders . avoidStruts $ layoutHook defaultConfig, - logHook = dynamicLogWithPP xmobarPP { - ppOutput = hPutStrLn xmproc, - ppTitle = xmobarColor "#859900" "" . shorten 200, - ppCurrent = xmobarColor "#b58900" "". wrap "[" "]", - ppHiddenNoWindows = xmobarColor "#93a1a1" "", - ppUrgent = xmobarColor "#dc322f" "#b58900" - }, - terminal = "urxvt", - modMask = mod4Mask, - handleEventHook = fullscreenEventHook + xmonad $ defaultConfig + { manageHook = myManageHook <+> manageDocks <+> manageHook defaultConfig + , layoutHook = smartBorders . avoidStruts $ layoutHook defaultConfig + , logHook = dynamicLogWithPP xmobarPP + { ppOutput = hPutStrLn xmproc + , ppTitle = xmobarColor "#859900" "" . shorten 200 + , ppCurrent = xmobarColor "#b58900" "". wrap "[" "]" + , ppHiddenNoWindows = xmobarColor "#93a1a1" "" + , ppUrgent = xmobarColor "#dc322f" "#b58900" + } + , terminal = "urxvt" + , modMask = mod4Mask + , handleEventHook = fullscreenEventHook } -- cgit 1.4.1 From f438dd7973528c7ad204a7955257da0766571e97 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 17 Aug 2014 17:27:59 +0100 Subject: XMonad: Make keybindings more Emacs-like --- tag-xmonad/xmonad/xmonad.hs | 53 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tag-xmonad/xmonad/xmonad.hs b/tag-xmonad/xmonad/xmonad.hs index 9e1fa77f..c3748442 100644 --- a/tag-xmonad/xmonad/xmonad.hs +++ b/tag-xmonad/xmonad/xmonad.hs @@ -1,11 +1,14 @@ import XMonad +import qualified XMonad.StackSet as W import XMonad.Hooks.DynamicLog import XMonad.Hooks.EwmhDesktops import XMonad.Hooks.ManageDocks import XMonad.Hooks.ManageHelpers import XMonad.Layout.NoBorders +import XMonad.Layout.WindowNavigation import XMonad.Util.EZConfig import XMonad.Util.Run(spawnPipe) +import System.Exit import System.IO import Data.List(isPrefixOf) @@ -19,6 +22,55 @@ myManageHook = composeOne , fmap ("mpv" `isPrefixOf`) title -?> doFullFloat ] +myKeys c = mkKeymap c $ + [ ("M-S-", spawn $ XMonad.terminal c) + , ("M-k", kill) + + , ("M-x M-e", spawn "emacsclient -c") + + , ("M-t", withFocused $ windows . W.sink) + , ("M-m", windows W.focusMaster) + , ("M-S-m", windows W.swapMaster) + + , ("M-", sendMessage $ Go R) + , ("M-", sendMessage $ Go L) + , ("M-", sendMessage $ Go U) + , ("M-", sendMessage $ Go D) + , ("M-M1-", sendMessage $ Swap R) + , ("M-M1-", sendMessage $ Swap L) + , ("M-M1-", sendMessage $ Swap U) + , ("M-M1-", sendMessage $ Swap D) + , ("M-C-", sendMessage $ Move R) + , ("M-C-", sendMessage $ Move L) + , ("M-C-", sendMessage $ Move U) + , ("M-C-", sendMessage $ Move D) + + , ("M-n", windows W.focusDown) + , ("M-p", windows W.focusUp) + , ("M-S-n", windows W.swapDown) + , ("M-S-p", windows W.swapUp) + + , ("M-,", sendMessage (IncMasterN 1)) + , ("M-.", sendMessage (IncMasterN (-1))) + + , ("M-\\", sendMessage NextLayout) + , ("M-S-\\", setLayout $ XMonad.layoutHook c) + + , ("M-+", sendMessage Shrink) + , ("M--", sendMessage Expand) + + , ("M-q", broadcastMessage ReleaseResources + >> restart "xmonad" True) + , ("C-M-q", io (exitWith ExitSuccess)) + ] ++ + + -- mod-[1..9], Switch to workspace N + -- mod-shift-[1..9], Move client to workspace N + [(m ++ k, windows $ f w) + | (w, k) <- zip (XMonad.workspaces c) (map show [1..9]) + , (m, f) <- [("M-",W.greedyView), ("M-S-",W.shift)]] + + main :: IO () main = do xmproc <-spawnPipe "/usr/bin/xmobar /home/alan/.xmobarrc" @@ -35,4 +87,5 @@ main = do , terminal = "urxvt" , modMask = mod4Mask , handleEventHook = fullscreenEventHook + , keys = myKeys } -- cgit 1.4.1 From 101145372f6245e036652a8e9642d67a3eee356b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 17 Aug 2014 22:22:55 +0100 Subject: Git: Fix `standup` alias --- tag-git/config/git/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-git/config/git/config b/tag-git/config/git/config index 886112cc..92e501c3 100644 --- a/tag-git/config/git/config +++ b/tag-git/config/git/config @@ -16,7 +16,7 @@ co = checkout ready = rebase -i @{u} lg = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' - standup = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --since yesterday --author alan + standup = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --since yesterday --author Alan ignored = ls-files --others -i --exclude-standard [github] user = alan@alanpearce.co.uk -- cgit 1.4.1 From 1a828301e51f27aaa5855eff5d7d13740bd4cad8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 17 Aug 2014 22:23:12 +0100 Subject: Emacs: Add nginx helm-dash documentation hook --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 1877358c..7350a7c5 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -334,6 +334,7 @@ (lambda () (when (require 'helm-dash nil :noerror) (setq-local helm-dash-docsets docsets)))) + (add-hook 'nginx-mode-hook (ap/create-helm-dash-hook '("Nginx"))) (add-hook 'ansible-mode-hook (ap/create-helm-dash-hook '("Ansible"))) (add-hook 'php-mode-hook (ap/create-helm-dash-hook '("PHP" "Symfony"))) (add-hook 'twig-mode-hook (ap/create-helm-dash-hook '("Twig"))) -- cgit 1.4.1 From 623e348e8f34cec5a91553094ff55f36504fe3df Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 20 Aug 2014 22:04:12 +0100 Subject: Emacs: Enable fontification of dash keywords --- tag-emacs/emacs.d/init.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 7350a7c5..5fff78c1 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -836,6 +836,11 @@ mouse-1: Display Line and Column Mode Menu")))))) ;;;; Projects +(req-package dash + :init (setq dash-enable-fontlock t) + :config (progn + (dash--enable-fontlock 'dash-enable-font-lock t))) + (req-package projectile :bind (("C-c C-f" . projectile-find-file) ("s-x s-f" . projectile-find-file) -- cgit 1.4.1 From 127518ed0855ee81de67f6f3c03bff7e1958d82e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 20 Aug 2014 22:06:05 +0100 Subject: Emacs: Remove salt files from yaml-mode --- tag-emacs/emacs.d/init.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 5fff78c1..c01d8c08 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -691,8 +691,7 @@ mouse-1: Display Line and Column Mode Menu")))))) (req-package yaml-mode :mode (("/group_vars/.*" . yaml-mode) - ("/host_vars/.*" . yaml-mode) - ("\\.sls\\'" . 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)) -- cgit 1.4.1 From 3b5ad129172cff59234c4d0d75606142d29cf3b4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 21 Aug 2014 18:26:27 +0100 Subject: Emacs: Fix dash hook creation --- tag-emacs/emacs.d/init.el | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index c01d8c08..3f1860ee 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -330,16 +330,24 @@ (req-package helm-dash :defer t :init (progn - (defun ap/create-helm-dash-hook (docsets) - (lambda () - (when (require 'helm-dash nil :noerror) - (setq-local helm-dash-docsets docsets)))) - (add-hook 'nginx-mode-hook (ap/create-helm-dash-hook '("Nginx"))) - (add-hook 'ansible-mode-hook (ap/create-helm-dash-hook '("Ansible"))) - (add-hook 'php-mode-hook (ap/create-helm-dash-hook '("PHP" "Symfony"))) - (add-hook 'twig-mode-hook (ap/create-helm-dash-hook '("Twig"))) - (add-hook 'markdown-mode-hook (ap/create-helm-dash-hook '("Markdown"))) - (add-hook 'saltstack-mode-hook (ap/create-helm-dash-hook '("SaltStack"))))) + (defmacro ap/create-helm-dash-hook (mode docsets) + (let* ((mode-s (symbol-name mode)) + (fun (intern (concat "helm-dash-hook-" mode-s))) + (hook (intern (concat mode-s "-mode-hook")))) + `(progn + (defun ,fun () + (when (require 'helm-dash nil :noerror) + (-each (-difference ',docsets + (helm-dash-installed-docsets)) + #'helm-dash-install-docset) + (setq-local helm-dash-docsets ',docsets))) + (add-hook (quote ,hook) (function ,fun))))) + (ap/create-helm-dash-hook nginx ("Nginx")) + (ap/create-helm-dash-hook ansible ("Ansible")) + (ap/create-helm-dash-hook php ("PHP" "Symfony")) + (ap/create-helm-dash-hook twig ("Twig")) + (ap/create-helm-dash-hook markdown ("Markdown")) + (ap/create-helm-dash-hook saltstack ("SaltStack")))) (req-package which-func :init (which-function-mode) -- cgit 1.4.1 From 0022a91d26c4e585d212b9df1ac77a2a94532622 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 21 Aug 2014 18:48:32 +0100 Subject: XMonad: Add dmenu_path shortcut --- tag-xmonad/xmonad/xmonad.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-xmonad/xmonad/xmonad.hs b/tag-xmonad/xmonad/xmonad.hs index c3748442..21e197d2 100644 --- a/tag-xmonad/xmonad/xmonad.hs +++ b/tag-xmonad/xmonad/xmonad.hs @@ -26,6 +26,7 @@ myKeys c = mkKeymap c $ [ ("M-S-", spawn $ XMonad.terminal c) , ("M-k", kill) + , ("M-", spawn "exec $(dmenu_path | dmenu)") , ("M-x M-e", spawn "emacsclient -c") , ("M-t", withFocused $ windows . W.sink) -- cgit 1.4.1 From c9506b38b3985c95a661dc791e4c56a7b575e598 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 23 Aug 2014 12:59:22 +0100 Subject: Emacs: Update MobileOrg sync location --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 3f1860ee..4024fe97 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -770,7 +770,7 @@ mouse-1: Display Line and Column Mode Menu")))))) (req-package org-mobile :require org :config (progn - (setq org-mobile-directory "~/Dropbox/MobileOrg"))) + (setq org-mobile-directory "~/Mobile/Org"))) ;;;; Programming -- cgit 1.4.1 From 5fc318b45c456fa51d02860f6ddcf9535684199e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 23 Aug 2014 12:59:50 +0100 Subject: Emacs: Defer org submodule initialisation --- tag-emacs/emacs.d/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 4024fe97..2ed049b5 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -764,11 +764,13 @@ mouse-1: Display Line and Column Mode Menu")))))) (req-package org-journal :require org + :defer t :config (progn (setq org-journal-date-format "%A, %d %B %Y"))) (req-package org-mobile :require org + :defer t :config (progn (setq org-mobile-directory "~/Mobile/Org"))) -- cgit 1.4.1 From 428f237fd9aa27e271fededeb52a5a7891f257c3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 23 Aug 2014 13:00:11 +0100 Subject: Add syncthing plist --- LaunchAgents/se.nym.syncthing.plist | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LaunchAgents/se.nym.syncthing.plist diff --git a/LaunchAgents/se.nym.syncthing.plist b/LaunchAgents/se.nym.syncthing.plist new file mode 100644 index 00000000..0884e4a4 --- /dev/null +++ b/LaunchAgents/se.nym.syncthing.plist @@ -0,0 +1,21 @@ + + + + + Label + se.nym.syncthing + ProgramArguments + + /Users/apearce/bin/syncthing + + EnvironmentVariables + + HOME + /Users/apearce + STNORESTART + 1 + + KeepAlive + + + -- cgit 1.4.1 From 3764370f77fa32c2c9c793331ef35ac9d913b4d7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 23 Aug 2014 13:02:45 +0100 Subject: Emacs: Fix frame-title-format error when loading --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 2ed049b5..3f8d75ec 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1318,7 +1318,8 @@ mouse-1: Display Line and Column Mode Menu")))))) (setq frame-title-format '((:eval (capitalize invocation-name)) ": " - (:eval (if (projectile-project-p) + (:eval (if (and (fboundp #'project-project-p) + (projectile-project-p)) (projectile-project-name) (if (buffer-file-name) (abbreviate-file-name (buffer-file-name)) -- cgit 1.4.1 From 75ff4072d69f2a331d065d0f15770b8632cc42db Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 30 Aug 2014 12:22:53 +0100 Subject: Emacs: Install and configure helm-swoop --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 92c010ae..f8ed11fb 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -40,6 +40,7 @@ (depends-on "helm") (depends-on "helm-dash") (depends-on "helm-projectile") +(depends-on "helm-swoop") (depends-on "help-fns+") (depends-on "hemisu-theme") (depends-on "jinja2-mode") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 3f8d75ec..e7d63545 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1043,6 +1043,13 @@ mouse-1: Display Line and Column Mode Menu")))))) (req-package goto-chg :bind ("C-x SPC" . goto-last-change)) +(req-package helm-swoop + :bind (("C-=" . helm-swoop) + ("C-c C-=" . helm-multi-swoop)) + :init (progn + (bind-key "C-=" #'helm-swoop isearch-mode-map) + (bind-key "C-=" #'helm-multi-swoop-all-from-helm-swoop))) + (req-package multiple-cursors :config (progn (bind-key "C-." #'mc/mark-next-like-this) -- cgit 1.4.1 From 9d426dc2384cbc622b458bc4bb343db9247298ef Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 30 Aug 2014 12:28:01 +0100 Subject: Emacs: Install jquery-doc --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index f8ed11fb..d4b9c525 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -44,6 +44,7 @@ (depends-on "help-fns+") (depends-on "hemisu-theme") (depends-on "jinja2-mode") +(depends-on "jquery-doc") (depends-on "js2-mode") (depends-on "leuven-theme") (depends-on "litable") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index e7d63545..8e2d0127 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1246,6 +1246,11 @@ mouse-1: Display Line and Column Mode Menu")))))) (setq js2-basic-offset 4 js2-global-externs '("$")))) +(req-package jquery-doc + :defer t + :init (progn + (add-hook 'js2-mode-hook #'jquery-doc-setup))) + (req-package scss-mode :defer t :config (progn -- cgit 1.4.1 From 888dc9c2c1ea5a700ed0d8cca3ec1ad8d67db8cd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 30 Aug 2014 12:43:06 +0100 Subject: Git: Add template dir from git_template project --- .gitmodules | 3 +++ tag-git/config/git/config | 2 ++ tag-git/config/git/template | 1 + 3 files changed, 6 insertions(+) create mode 160000 tag-git/config/git/template diff --git a/.gitmodules b/.gitmodules index babccc4d..af62d6e4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "tag-zsh/config/zsh/per-directory-history"] path = tag-zsh/config/zsh/per-directory-history url = git://github.com/jimhester/per-directory-history.git +[submodule "tag-git/config/git/template"] + path = tag-git/config/git/template + url = git@github.com:alanpearce/git_template.git diff --git a/tag-git/config/git/config b/tag-git/config/git/config index 92e501c3..87a492f1 100644 --- a/tag-git/config/git/config +++ b/tag-git/config/git/config @@ -26,3 +26,5 @@ path = config.local [core] excludesfile = ~/.config/git/ignore +[init] + templatedir = /Users/apearce/.config/git/template diff --git a/tag-git/config/git/template b/tag-git/config/git/template new file mode 160000 index 00000000..4bf171c8 --- /dev/null +++ b/tag-git/config/git/template @@ -0,0 +1 @@ +Subproject commit 4bf171c8706570efc3a44e79e7130da480841d20 -- cgit 1.4.1 From 7a9efc6c9276733b0496725725448445e4420f82 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 6 Sep 2014 12:54:07 +0100 Subject: Emacs: Fix startup error from comint keybind --- tag-emacs/emacs.d/init.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 8e2d0127..e679f74d 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -962,6 +962,10 @@ mouse-1: Display Line and Column Mode Menu")))))) :config (define-key shell-mode-map (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) +(req-package comint + :defer t + :config (bind-key "C-c C-l" #'helm-comint-input-ring comint-mode-map)) + (req-package multi-term :if (not (eq system-type 'windows-nt)) :bind ("C-`" . multi-term-dedicated-toggle)) -- cgit 1.4.1 From 026c476e282515694ab475954488ae28ce661d47 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 6 Sep 2014 12:54:29 +0100 Subject: Emacs: Fix startup error from eshell keybind Really weird that I needed to bind the key inside a hook, anything else seemed to get evaluated before eshell was loaded --- tag-emacs/emacs.d/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index e679f74d..4fc9a70a 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -942,6 +942,8 @@ mouse-1: Display Line and Column Mode Menu")))))) :bind ("C-c s" . eshell) :config (progn (setq eshell-directory-name "~/.emacs.d/eshell") + (add-hook 'eshell-load-hook (lambda () + (bind-key "C-c C-l" #'helm-eshell-history eshell-mode-map))) (req-package em-smart :init (progn (setq eshell-where-to-jump 'begin -- cgit 1.4.1 From bb978fb0233367f0fa62e2d0d15790ec96abdece Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 6 Sep 2014 12:55:19 +0100 Subject: Emacs: Install feature-mode --- tag-emacs/emacs.d/Cask | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index d4b9c525..d0c5df48 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -26,6 +26,7 @@ (depends-on "expand-region") (depends-on "fancy-narrow") (depends-on "fasd") +(depends-on "feature-mode") (depends-on "flycheck") (depends-on "framemove") (depends-on "geiser") -- cgit 1.4.1 From 80c7244e269f464b7fff2f1cfe501c4810d192f6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 9 Sep 2014 20:25:18 +0100 Subject: Emacs: Set up clojure-mode and cider --- tag-emacs/emacs.d/Cask | 2 ++ tag-emacs/emacs.d/init.el | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index d0c5df48..6504e366 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -12,6 +12,8 @@ (depends-on "bind-key") (depends-on "cask") (depends-on "cedit") +(depends-on "cider") +(depends-on "clojure-mode") (depends-on "company") (depends-on "company-go") (depends-on "deferred") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 4fc9a70a..a51e7c71 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1174,6 +1174,20 @@ mouse-1: Display Line and Column Mode Menu")))))) run-geiser run-racket)) +(req-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))) + +(req-package cider + :require clojure-mode + :defer t + :config (progn + (setq nrepl-hide-special-buffers t) + (add-hook 'cider-mode-hook #'cider-turn-on-eldoc-mode) + (add-hook 'cider-repl-mode-hook #'paredit-mode))) + (req-package redshank :diminish " Λ" :defer t -- cgit 1.4.1 From 5470cbe9357324f078f0ff3a786f3944edde93f0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 9 Sep 2014 20:25:48 +0100 Subject: zsh: Source gibo completion file if present --- tag-zsh/config/zsh/zshrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index f8a35311..f82d9b75 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -383,6 +383,11 @@ else echo "fasd init file is missing." fi +if [[ -e /etc/gibo/gibo-completion.zsh ]] +then + source /etc/gibo/gibo-completion.zsh +fi + case $os in freebsd) source $ZDOTDIR/freebsd.zsh -- cgit 1.4.1 From 68a75fb9c2cfaea9c5f5fb889e687b3b0784db86 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 14 Sep 2014 11:14:28 +0100 Subject: Emacs: Remove cider-mode-map C-c C-f binding --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index a51e7c71..b873d8b4 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1185,6 +1185,7 @@ mouse-1: Display Line and Column Mode Menu")))))) :defer t :config (progn (setq nrepl-hide-special-buffers t) + (unbind-key "C-c C-f" cider-mode-map) (add-hook 'cider-mode-hook #'cider-turn-on-eldoc-mode) (add-hook 'cider-repl-mode-hook #'paredit-mode))) -- cgit 1.4.1 From e241ad6d6bb4431f71ed903a3449720cdcea2c9b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 14 Sep 2014 11:15:12 +0100 Subject: Emacs: Use Clojure dash documentation --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index b873d8b4..9b43ba48 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -347,7 +347,8 @@ (ap/create-helm-dash-hook php ("PHP" "Symfony")) (ap/create-helm-dash-hook twig ("Twig")) (ap/create-helm-dash-hook markdown ("Markdown")) - (ap/create-helm-dash-hook saltstack ("SaltStack")))) + (ap/create-helm-dash-hook saltstack ("SaltStack")) + (ap/create-helm-dash-hook clojure ("Clojure")))) (req-package which-func :init (which-function-mode) -- cgit 1.4.1 From cd1a3326276e5229e458714dcfed493ad2ff81df Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 14 Sep 2014 11:15:31 +0100 Subject: Emacs: Install clj-refactor-mode --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 6504e366..45032b8c 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -13,6 +13,7 @@ (depends-on "cask") (depends-on "cedit") (depends-on "cider") +(depends-on "clj-refactor") (depends-on "clojure-mode") (depends-on "company") (depends-on "company-go") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 9b43ba48..10bdea93 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1181,6 +1181,16 @@ mouse-1: Display Line and Column Mode Menu")))))) (add-hook 'cider-repl-mode-hook (lambda () (highlight-changes-mode -1))) (add-hook 'clojure-mode-hook #'ap/lisp-setup))) +(req-package clj-refactor + :defer t + :require clojure-mode + :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))) + (req-package cider :require clojure-mode :defer t -- cgit 1.4.1 From db0a14cddc21eba4b312a47f3af39de4b9a85053 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 18 Sep 2014 22:03:21 +0100 Subject: File ending cleanup --- tag-emacs/emacs.d/Cask | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 45032b8c..ed03f3a3 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -91,4 +91,4 @@ (depends-on "web-mode") (depends-on "wgrep-pt") (depends-on "ws-butler") -(depends-on "yaml-mode") \ No newline at end of file +(depends-on "yaml-mode") -- cgit 1.4.1 From bc1a9ab08614e8c2bc2ae7e20909abba1497a17e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 18 Sep 2014 22:07:58 +0100 Subject: Emacs: Use smartparens to replace 4 other modes Paredit, autopair, cedit and smart-forward. Should work nicely in HTML modes, too! --- tag-emacs/emacs.d/Cask | 5 +-- tag-emacs/emacs.d/init.el | 92 ++++++++++++----------------------------------- 2 files changed, 24 insertions(+), 73 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index ed03f3a3..9374e0c8 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -8,10 +8,8 @@ (depends-on "ag") (depends-on "auto-compile") (depends-on "auto-indent-mode") -(depends-on "autopair") (depends-on "bind-key") (depends-on "cask") -(depends-on "cedit") (depends-on "cider") (depends-on "clj-refactor") (depends-on "clojure-mode") @@ -64,7 +62,6 @@ (depends-on "org-plus-contrib") (depends-on "pallet") (depends-on "paradox") -(depends-on "paredit") (depends-on "persp-projectile") (depends-on "perspective") (depends-on "php-extras") @@ -80,9 +77,9 @@ (depends-on "scss-mode") (depends-on "skewer-mode") (depends-on "slime") -(depends-on "smart-forward") (depends-on "smart-tab") (depends-on "smart-tabs-mode") +(depends-on "smartparens") (depends-on "toml-mode") (depends-on "tup-mode") (depends-on "undo-tree") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 10bdea93..d5b693dd 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -997,8 +997,6 @@ mouse-1: Display Line and Column Mode Menu")))))) ;; replace highlighted text rather than just inserting at point (delete-selection-mode t) -(show-paren-mode t) - (bind-key "S-SPC" #'set-mark-command) (req-package subword @@ -1029,21 +1027,6 @@ mouse-1: Display Line and Column Mode Menu")))))) (setq ace-jump-word-mode-use-query-char nil ace-jump-mode-scope 'window))) -(req-package autopair - :commands (autopair-mode - autopair-on) - :init (progn - (add-hook 'prog-mode-hook #'autopair-on) - (add-hook 'text-mode-hook #'autopair-on) - (add-hook 'yaml-mode-hook #'autopair-on) - (defun autopair-off () - (autopair-mode -1)) - (add-hook 'web-mode-hook #'autopair-off) - (add-hook 'lisp-mode-common-hook #'autopair-off) - (add-hook 'c-mode-common-hook #'autopair-off) - (setq autopair-blink nil - autopair-skip-whitespace nil))) - (req-package expand-region :bind ("C-M-SPC" . er/expand-region)) @@ -1069,61 +1052,34 @@ mouse-1: Display Line and Column Mode Menu")))))) :commands (eldoc-mode) :diminish eldoc-mode :config (progn - (eldoc-add-command 'paredit-backward-delete 'paredit-close-round 'autopair-insert-opening) (setq eldoc-idle-delay 0.1))) -(req-package cedit - :diminish "{}" - :require paredit - :init (progn - (defvar cedit-mode-map (make-sparse-keymap) - "Keymap for the cedit minor mode.") - (define-minor-mode cedit-mode - "Minor mode for paredit-style editing in c-style modes." - :lighter " Cedit") - (defun turn-on-cedit-mode () - (enable-paredit-mode) - (cedit-mode 1)) - (add-hook #'c-mode-common-hook #'turn-on-cedit-mode)) - :config (progn - (bind-key "M-a" #'cedit-beginning-of-statement cedit-mode-map) - (bind-key "M-e" #'cedit-end-of-statement cedit-mode-map) - (bind-key "C-M-d" #'cedit-down-block cedit-mode-map) - (bind-key "C-M-u" #'cedit-up-block-backward cedit-mode-map) - (bind-key "C-M-n" #'cedit-up-block-forward cedit-mode-map) - (bind-key "M-{" #'cedit-wrap-brace cedit-mode-map) - (bind-key "C-)" #'cedit-or-paredit-slurp cedit-mode-map) - (bind-key "C-}" #'cedit-or-paredit-barf cedit-mode-map) - (bind-key "M-" #'cedit-or-paredit-splice-killing-backward cedit-mode-map) - (bind-key "M-r" #'cedit-or-paredit-raise cedit-mode-map))) - -(req-package paredit - :diminish "()" - :commands (paredit-mode) +(req-package smartparens + :defer t :config (progn - (defun ap/cedit-space-delimiter-p (endp delimiter) - "Don't insert a space before delimiters in c-style modes" - (not cedit-mode)) - (add-to-list 'paredit-space-for-delimiter-predicates #'ap/cedit-space-delimiter-p)) - :init (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 'minibuffer-setup-hook #'conditionally-enable-paredit-mode) - (defun conditionally-enable-paredit-mode () - "enable paredit-mode during eval-expression" - (if (eq this-command 'eval-expression) - (paredit-mode 1))))) + (sp-use-smartparens-bindings) + (fset 'wrap-with-paren "\C-](") ;; `sp-select-next-thing-exchange' + (bind-key "C-(" #'wrap-with-paren sp-keymap) + (bind-key "C-)" #'sp-forward-slurp-sexp sp-keymap) + (bind-key "M-" #'backwarp-kill-word sp-keymap) + (bind-key "M-?" #'sp-convolute-sexp sp-keymap sp-keymap) + (bind-key "M-t" #'sp-transpose-sexp sp-keymap sp-keymap) + (bind-key "M-r" #'sp-raise-sexp sp-keymap) + (bind-key "M-s" #'sp-splice-sexp sp-keymap) + (bind-key "M-S" #'sp-split-sexp sp-keymap) + (bind-key "M-J" #'sp-join-sexp sp-keymap) + (bind-key "M-" #'sp-splice-sexp-killing-backward sp-keymap) + (bind-key "M-" #'sp-splice-sexp-killing-forward sp-keymap) + (show-smartparens-global-mode t) + (smartparens-global-strict-mode t))) + +(req-package smartparens-config + :require smartparens + :defer t) (req-package move-text :config (move-text-default-bindings)) -(req-package smart-forward - :bind (("C-M-u" . smart-up) - ("C-M-d" . smart-down) - ("C-M-p" . smart-backward) - ("C-M-n" . smart-forward))) - (req-package undo-tree :config (progn (global-undo-tree-mode) @@ -1149,8 +1105,7 @@ mouse-1: Display Line and Column Mode Menu")))))) (defun ap/lisp-setup () (run-hooks 'lisp-mode-common-hook) - (setq indent-tabs-mode nil) - (local-set-key (kbd "RET") #'paredit-newline)) + (setq indent-tabs-mode nil)) (defun set-common-lisp-indentation () (set (make-local-variable 'lisp-indent-function) @@ -1197,8 +1152,7 @@ mouse-1: Display Line and Column Mode Menu")))))) :config (progn (setq nrepl-hide-special-buffers t) (unbind-key "C-c C-f" cider-mode-map) - (add-hook 'cider-mode-hook #'cider-turn-on-eldoc-mode) - (add-hook 'cider-repl-mode-hook #'paredit-mode))) + (add-hook 'cider-mode-hook #'cider-turn-on-eldoc-mode))) (req-package redshank :diminish " Λ" -- cgit 1.4.1 From 3b04c6e3a0a5c8c18e6edf620b4a0af8055f168d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 19 Sep 2014 19:56:21 +0100 Subject: Emacs: Fix smartparens load issues --- tag-emacs/emacs.d/init.el | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index d5b693dd..33bd9b3c 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1054,16 +1054,15 @@ mouse-1: Display Line and Column Mode Menu")))))) :config (progn (setq eldoc-idle-delay 0.1))) -(req-package smartparens - :defer t +(req-package smartparens-config :config (progn (sp-use-smartparens-bindings) (fset 'wrap-with-paren "\C-](") ;; `sp-select-next-thing-exchange' (bind-key "C-(" #'wrap-with-paren sp-keymap) (bind-key "C-)" #'sp-forward-slurp-sexp sp-keymap) - (bind-key "M-" #'backwarp-kill-word sp-keymap) - (bind-key "M-?" #'sp-convolute-sexp sp-keymap sp-keymap) - (bind-key "M-t" #'sp-transpose-sexp sp-keymap sp-keymap) + (bind-key "M-" #'backward-kill-word sp-keymap) + (bind-key "M-?" #'sp-convolute-sexp sp-keymap) + (bind-key "M-t" #'sp-transpose-sexp sp-keymap) (bind-key "M-r" #'sp-raise-sexp sp-keymap) (bind-key "M-s" #'sp-splice-sexp sp-keymap) (bind-key "M-S" #'sp-split-sexp sp-keymap) @@ -1073,10 +1072,6 @@ mouse-1: Display Line and Column Mode Menu")))))) (show-smartparens-global-mode t) (smartparens-global-strict-mode t))) -(req-package smartparens-config - :require smartparens - :defer t) - (req-package move-text :config (move-text-default-bindings)) -- cgit 1.4.1 From 0815ddf3d6690814a9248eb94ae163b0fcd6e1ed Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 19 Sep 2014 19:56:32 +0100 Subject: Emacs: Disable web-mode auto-pairing --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 33bd9b3c..e905ae8a 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1272,7 +1272,7 @@ mouse-1: Display Line and Column Mode Menu")))))) web-mode-style-padding 0 web-mode-script-padding 0 web-mode-comment-style 2 - web-mode-disable-auto-pairing t)) + web-mode-enable-auto-pairing nil)) (define-derived-mode twig-mode web-mode "Twig") (add-to-list 'auto-mode-alist '("\\.html\\.twig\\'" . twig-mode)) -- cgit 1.4.1 From 95317da4289cc9b334e837d69bd878877d587817 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 19 Sep 2014 19:57:36 +0100 Subject: Emacs: Add highlight-stages mode --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 9374e0c8..5dc6020c 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -45,6 +45,7 @@ (depends-on "helm-swoop") (depends-on "help-fns+") (depends-on "hemisu-theme") +(depends-on "highlight-stages") (depends-on "jinja2-mode") (depends-on "jquery-doc") (depends-on "js2-mode") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index e905ae8a..3b9ece3f 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -161,6 +161,11 @@ :config (progn (add-hook 'xmonad-mode-hook #'rainbow-turn-on))) +(req-package highlight-stages + :defer t + :init (progn + (add-hook 'lisp-mode-common-hook #'highlight-stages-mode))) + ;;;; Autosaves & Backups (let ((backup-dir (expand-file-name "~/.emacs.d/backups/"))) (unless (file-directory-p backup-dir) -- cgit 1.4.1 From 94ede4a78c4ca64078a4bd291b17b4b70ddf62f3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 20 Sep 2014 16:36:33 +0100 Subject: Add Leiningen profiles to new Clojure tag --- tag-clojure/lein/profiles.clj | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 tag-clojure/lein/profiles.clj diff --git a/tag-clojure/lein/profiles.clj b/tag-clojure/lein/profiles.clj new file mode 100644 index 00000000..355802b0 --- /dev/null +++ b/tag-clojure/lein/profiles.clj @@ -0,0 +1,4 @@ +{:user {:plugins [[cider/cider-nrepl "0.8.0-20140906.032134-10"] + [org.clojure/tools.namespace "0.2.6"] + [lein-autoexpect "1.2.2"]] + :dependencies [[org.clojure/tools.trace "0.7.8"]]}} -- cgit 1.4.1 From c51a18b60d66ab08e16c72748636d6f758187382 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 20 Sep 2014 16:43:41 +0100 Subject: Add clojure tag to relevant boxen --- host-ap-s40.local/rcrc.local | 2 +- host-prefect/rcrc.local | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/host-ap-s40.local/rcrc.local b/host-ap-s40.local/rcrc.local index 0cecf5d1..5eb93482 100644 --- a/host-ap-s40.local/rcrc.local +++ b/host-ap-s40.local/rcrc.local @@ -1,2 +1,2 @@ DOTFILES_DIRS="$HOME/projects/dotfiles" -TAGS="emacs git hg tmux vagrant zsh" \ No newline at end of file +TAGS="emacs git hg tmux vagrant zsh clojure" \ No newline at end of file diff --git a/host-prefect/rcrc.local b/host-prefect/rcrc.local index ef1a437d..060c7001 100644 --- a/host-prefect/rcrc.local +++ b/host-prefect/rcrc.local @@ -1,2 +1,2 @@ DOTFILES_DIRS="$HOME/projects/dotfiles" -TAGS="emacs git hg sakura ssh tmux vagrant xresources xmonad xmobar zsh" +TAGS="emacs git hg clojure sakura ssh tmux vagrant xresources xmonad xmobar zsh" -- cgit 1.4.1 From 564b9f0c06c542bc6dd0a4e22448fd181685532c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 1 Oct 2014 19:44:33 +0100 Subject: Emacs: Add wgrep-ag package for editing ag results --- tag-emacs/emacs.d/Cask | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 5dc6020c..1a65cc3d 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -87,6 +87,7 @@ (depends-on "use-package") (depends-on "visual-regexp") (depends-on "web-mode") +(depends-on "wgrep-ag") (depends-on "wgrep-pt") (depends-on "ws-butler") (depends-on "yaml-mode") -- cgit 1.4.1 From 0959519eaa0ad9c4f0098e562da60f3bcdf01b74 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 1 Oct 2014 19:45:03 +0100 Subject: Emacs: Bind smartparens hybrid commands --- tag-emacs/emacs.d/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 3b9ece3f..051d2987 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1074,6 +1074,8 @@ mouse-1: Display Line and Column Mode Menu")))))) (bind-key "M-J" #'sp-join-sexp sp-keymap) (bind-key "M-" #'sp-splice-sexp-killing-backward sp-keymap) (bind-key "M-" #'sp-splice-sexp-killing-forward sp-keymap) + (bind-key "C-M-S-k" #'sp-kill-hybrid-sexp sp-keymap) + (bind-key "C-S-" #'sp-slurp-hybrid-sexp sp-keymap) (show-smartparens-global-mode t) (smartparens-global-strict-mode t))) -- cgit 1.4.1 From 2fd077caef472d4e610acf66ff0a548cf0ead686 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 Oct 2014 18:23:06 +0100 Subject: Emacs: Revert to paredit for lisp modes. Smartparens is nice, but isn't as nice as paredit in lispy languages, even in strict mode. --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 24 ++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 1a65cc3d..4809547d 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -63,6 +63,7 @@ (depends-on "org-plus-contrib") (depends-on "pallet") (depends-on "paradox") +(depends-on "paredit") (depends-on "persp-projectile") (depends-on "perspective") (depends-on "php-extras") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 051d2987..120c85b2 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1057,7 +1057,26 @@ mouse-1: Display Line and Column Mode Menu")))))) :commands (eldoc-mode) :diminish eldoc-mode :config (progn - (setq eldoc-idle-delay 0.1))) + (setq eldoc-idle-delay 0.1) + (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) + +(req-package paredit + :diminish "()" + :commands (paredit-mode) + :config (progn + (defun ap/cedit-space-delimiter-p (endp delimiter) + "Don't insert a space before delimiters in c-style modes" + (not cedit-mode)) + (add-to-list 'paredit-space-for-delimiter-predicates #'ap/cedit-space-delimiter-p)) + :init (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 'minibuffer-setup-hook #'conditionally-enable-paredit-mode) + (defun conditionally-enable-paredit-mode () + "enable paredit-mode during eval-expression" + (if (eq this-command 'eval-expression) + (paredit-mode 1))))) (req-package smartparens-config :config (progn @@ -1077,7 +1096,8 @@ mouse-1: Display Line and Column Mode Menu")))))) (bind-key "C-M-S-k" #'sp-kill-hybrid-sexp sp-keymap) (bind-key "C-S-" #'sp-slurp-hybrid-sexp sp-keymap) (show-smartparens-global-mode t) - (smartparens-global-strict-mode t))) + (smartparens-global-strict-mode t) + (add-hook 'lisp-mode-common-hook #'turn-off-smartparens-mode))) (req-package move-text :config (move-text-default-bindings)) -- cgit 1.4.1 From 99a6b8f91e1c71d14a29ff19213958e321ad3b7f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 16 Oct 2014 19:32:50 +0100 Subject: Clojure: Add lein-ancient to user plugins --- tag-clojure/lein/profiles.clj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-clojure/lein/profiles.clj b/tag-clojure/lein/profiles.clj index 355802b0..51cc10c5 100644 --- a/tag-clojure/lein/profiles.clj +++ b/tag-clojure/lein/profiles.clj @@ -1,4 +1,5 @@ {:user {:plugins [[cider/cider-nrepl "0.8.0-20140906.032134-10"] [org.clojure/tools.namespace "0.2.6"] - [lein-autoexpect "1.2.2"]] + [lein-autoexpect "1.2.2"] + [lein-ancient "0.5.5"]] :dependencies [[org.clojure/tools.trace "0.7.8"]]}} -- cgit 1.4.1 From 3503c771b792143ba74d97db8100d88e341615dd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 16 Oct 2014 19:33:44 +0100 Subject: Clojure: Update user plugins --- tag-clojure/lein/profiles.clj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tag-clojure/lein/profiles.clj b/tag-clojure/lein/profiles.clj index 51cc10c5..284f67cb 100644 --- a/tag-clojure/lein/profiles.clj +++ b/tag-clojure/lein/profiles.clj @@ -1,5 +1,5 @@ -{:user {:plugins [[cider/cider-nrepl "0.8.0-20140906.032134-10"] - [org.clojure/tools.namespace "0.2.6"] - [lein-autoexpect "1.2.2"] +{:user {:plugins [[cider/cider-nrepl "0.8.0-SNAPSHOT"] + [org.clojure/tools.namespace "0.2.7"] + [lein-autoexpect "1.4.0"] [lein-ancient "0.5.5"]] :dependencies [[org.clojure/tools.trace "0.7.8"]]}} -- cgit 1.4.1 From 4d2d0a9511159eca3a3c8945d13fe36821c5e7e6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 8 Nov 2014 17:33:07 +0000 Subject: Emacs: Open composer.lock files in js-mode --- tag-emacs/emacs.d/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 120c85b2..3187d090 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1254,6 +1254,8 @@ mouse-1: Display Line and Column Mode Menu")))))) (setq js2-basic-offset 4 js2-global-externs '("$")))) +(add-to-list 'auto-mode-alist '("composer\\.lock" . js-mode)) + (req-package jquery-doc :defer t :init (progn -- cgit 1.4.1 From 4c079513c4cd3aef6b28514125a57e03f7fccbf5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 11 Nov 2014 09:55:00 +0000 Subject: Emacs: Try boon mode --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 4809547d..633f4535 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -9,6 +9,7 @@ (depends-on "auto-compile") (depends-on "auto-indent-mode") (depends-on "bind-key") +(depends-on "boon") (depends-on "cask") (depends-on "cider") (depends-on "clj-refactor") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 3187d090..01f8fb6a 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -503,6 +503,15 @@ ;;;; Keybindings +(req-package boon-colemak + :ensure boon + :config (progn + (boon-mode) + (bind-key "f" #'find-file boon-x-map))) + +(req-package boon-extras + :ensure boon) + (when (eq system-type 'darwin) (set-keyboard-coding-system nil) (setq mac-option-modifier 'meta -- cgit 1.4.1 From 098899923bc730dfbab3070f953161b69e77af67 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 17 Dec 2014 20:08:17 +0000 Subject: fixup! Emacs: Try boon mode --- tag-emacs/emacs.d/Cask | 1 - tag-emacs/emacs.d/init.el | 9 --------- 2 files changed, 10 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 633f4535..4809547d 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -9,7 +9,6 @@ (depends-on "auto-compile") (depends-on "auto-indent-mode") (depends-on "bind-key") -(depends-on "boon") (depends-on "cask") (depends-on "cider") (depends-on "clj-refactor") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 01f8fb6a..3187d090 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -503,15 +503,6 @@ ;;;; Keybindings -(req-package boon-colemak - :ensure boon - :config (progn - (boon-mode) - (bind-key "f" #'find-file boon-x-map))) - -(req-package boon-extras - :ensure boon) - (when (eq system-type 'darwin) (set-keyboard-coding-system nil) (setq mac-option-modifier 'meta -- cgit 1.4.1 From 7a417e261d3cee8c0aaa91ee18cfe366aad37d27 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 17 Dec 2014 20:08:25 +0000 Subject: zsh: Add composer bin dir to path --- tag-zsh/config/zsh/zshenv | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index 3572571f..ae5f1cde 100755 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -9,6 +9,7 @@ then ~/bin $GOPATH/bin ~/.cabal/bin + ~/.composer/vendor/bin ) fi -- cgit 1.4.1 From 2a3a3b4caf2b881ece4c83b4a7e02047f3735555 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 17 Dec 2014 20:08:44 +0000 Subject: OSX: Update Syncthing launch agent --- LaunchAgents/net.syncthing.syncthing.plist | 30 ++++++++++++++++++++++++++++++ LaunchAgents/se.nym.syncthing.plist | 21 --------------------- 2 files changed, 30 insertions(+), 21 deletions(-) create mode 100644 LaunchAgents/net.syncthing.syncthing.plist delete mode 100644 LaunchAgents/se.nym.syncthing.plist diff --git a/LaunchAgents/net.syncthing.syncthing.plist b/LaunchAgents/net.syncthing.syncthing.plist new file mode 100644 index 00000000..1fcd1281 --- /dev/null +++ b/LaunchAgents/net.syncthing.syncthing.plist @@ -0,0 +1,30 @@ + + + + + Label + net.syncthing.syncthing + + ProgramArguments + + /Users/apearce/bin/syncthing + + + EnvironmentVariables + + HOME + /Users/apearce + STNORESTART + 1 + + + KeepAlive + + + LowPriorityIO + + + ProcessType + Background + + diff --git a/LaunchAgents/se.nym.syncthing.plist b/LaunchAgents/se.nym.syncthing.plist deleted file mode 100644 index 0884e4a4..00000000 --- a/LaunchAgents/se.nym.syncthing.plist +++ /dev/null @@ -1,21 +0,0 @@ - - - - - Label - se.nym.syncthing - ProgramArguments - - /Users/apearce/bin/syncthing - - EnvironmentVariables - - HOME - /Users/apearce - STNORESTART - 1 - - KeepAlive - - - -- cgit 1.4.1 From 6dca0437a33666f1f2b11c1812d1eae03097bc6e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 17 Dec 2014 20:09:20 +0000 Subject: Emacs: Offer to create missing directories --- tag-emacs/emacs.d/init.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 3187d090..a43ffe4d 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -406,6 +406,13 @@ (kill-this-buffer) (message "File '%s' successfully removed" filename))))) +(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)))) +(add-to-list 'find-file-not-found-functions #'my-create-non-existent-directory) + (defun kill-or-delete-this-buffer-dwim (&optional arg) "Kills current buffer. With prefix arg, delete it." (interactive "P") -- cgit 1.4.1 From 274df7b08b6b3e47a608bb0de8d35f8aa663b736 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 17 Dec 2014 20:09:44 +0000 Subject: Git: Don't ignore .envrc --- tag-git/config/git/ignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/tag-git/config/git/ignore b/tag-git/config/git/ignore index 7e23dcab..78d8d163 100644 --- a/tag-git/config/git/ignore +++ b/tag-git/config/git/ignore @@ -18,8 +18,6 @@ auto-save-list tramp .\#* -.envrc - # Org-mode .org-id-locations *_archive -- cgit 1.4.1 From 417b7c2eac667d49fbb49ddc7804ad6c90bacf4d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 17 Dec 2014 20:10:22 +0000 Subject: Git: Remove template --- tag-git/config/git/config | 2 -- tag-git/config/git/template | 1 - 2 files changed, 3 deletions(-) delete mode 160000 tag-git/config/git/template diff --git a/tag-git/config/git/config b/tag-git/config/git/config index 87a492f1..92e501c3 100644 --- a/tag-git/config/git/config +++ b/tag-git/config/git/config @@ -26,5 +26,3 @@ path = config.local [core] excludesfile = ~/.config/git/ignore -[init] - templatedir = /Users/apearce/.config/git/template diff --git a/tag-git/config/git/template b/tag-git/config/git/template deleted file mode 160000 index 4bf171c8..00000000 --- a/tag-git/config/git/template +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4bf171c8706570efc3a44e79e7130da480841d20 -- cgit 1.4.1 From 187efed82e62484867a16119fa76c2988a271fc8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 17 Dec 2014 20:10:49 +0000 Subject: Emacs: Use symfony style in PHP --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index a43ffe4d..2069325b 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1285,7 +1285,8 @@ mouse-1: Display Line and Column Mode Menu")))))) (unbind-key "C-c C-f" php-mode-map) (unbind-key "C-." php-mode-map) (setq php-mode-coding-style "Symfony2") - (add-hook 'php-mode-hook #'turn-on-eldoc-mode))) + (add-hook 'php-mode-hook #'turn-on-eldoc-mode) + (add-hook 'php-mode-hook #'php-enable-symfony2-coding-style))) (req-package sgml-mode :defer t -- cgit 1.4.1 From 083f8933424fc276a1575029a266223ef44f63bf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 17 Dec 2014 20:14:50 +0000 Subject: Emacs: Add typo mode for nice “quotes” --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 4809547d..22b55806 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -84,6 +84,7 @@ (depends-on "smartparens") (depends-on "toml-mode") (depends-on "tup-mode") +(depends-on "typo") (depends-on "undo-tree") (depends-on "use-package") (depends-on "visual-regexp") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 2069325b..a407e67c 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1018,6 +1018,11 @@ mouse-1: Display Line and Column Mode Menu")))))) :bind (("M-z" . zap-up-to-char) ("M-Z" . zap-to-char))) +(req-package typo + :init (progn + (typo-global-mode t) + (add-hook 'text-mode-hook 'typo-mode))) + (req-package ap-functions :commands (ap/remove-extra-cr) :bind (("C-x r M-w" . copy-rectangle) -- cgit 1.4.1 From ed02bd17f9efa86b1f3ec525b079f0597efc923a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 17 Dec 2014 20:15:59 +0000 Subject: Emacs: Add and bind isearch-yank-symbol --- tag-emacs/emacs.d/init.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index a407e67c..b7ebbefc 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1011,6 +1011,21 @@ mouse-1: Display Line and Column Mode Menu")))))) (bind-key "S-SPC" #'set-mark-command) +(defun fc/isearch-yank-symbol () + "Yank the symbol at point into the isearch minibuffer. + +C-w does something similar in isearch, but it only looks for +the rest of the word. I want to look for the whole string. And +symbol, not word, as I need this for programming the most." + (interactive) + (isearch-yank-string + (save-excursion + (when (and (not isearch-forward) + isearch-other-end) + (goto-char isearch-other-end)) + (thing-at-point 'symbol)))) +(bind-key "C-d" #'fc/isearch-yank-symbol isearch-mode-map) + (req-package subword :init (global-subword-mode t)) -- cgit 1.4.1 From ecb5a69b89c6357fecee4401f8a3ae9d9e07b51d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 24 Dec 2014 16:35:15 +0000 Subject: Emacs: Configure twig tag pairs --- tag-emacs/emacs.d/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index b7ebbefc..16bfb9f2 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1122,6 +1122,9 @@ symbol, not word, as I need this for programming the most." (bind-key "M-" #'sp-splice-sexp-killing-forward sp-keymap) (bind-key "C-M-S-k" #'sp-kill-hybrid-sexp sp-keymap) (bind-key "C-S-" #'sp-slurp-hybrid-sexp sp-keymap) + (sp-with-modes '(web-mode 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))) -- cgit 1.4.1 From 20798ab71a19b73f7e1d178bc2a3a5059e3be7f3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 25 Dec 2014 11:51:04 +0000 Subject: Emacs: Setup dired-k --- tag-emacs/emacs.d/init.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 16bfb9f2..32f273f2 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -296,6 +296,13 @@ (setq insert-directory-program (executable-find "gls"))) (put 'dired-find-alternate-file 'disabled nil))) +(req-package dired-k + :init (progn + (defun ap/dired-k-if-vc () + (when (projectile-project-root) + (dired-k))) + (add-hook 'dired-initial-position-hook #'ap/dired-k-if-vc))) + (req-package dired-x :require dired) -- cgit 1.4.1 From 35bc57878c8dff67bdd17ddf207a2ba3d5076d3a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 3 Jan 2015 10:16:36 +0000 Subject: Emacs: Install flycheck-pos-tip --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 22b55806..5680246b 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -29,6 +29,7 @@ (depends-on "fasd") (depends-on "feature-mode") (depends-on "flycheck") +(depends-on "flycheck-pos-tip") (depends-on "framemove") (depends-on "geiser") (depends-on "ggtags") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 32f273f2..0bc3897f 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -809,6 +809,11 @@ mouse-1: Display Line and Column Mode Menu")))))) :diminish " ✓" :init (global-flycheck-mode)) +(req-package flycheck-pos-tip + :require flycheck + :init (progn + (setq flycheck-display-errors-function #'flycheck-pos-tip-error-messages))) + (req-package go-mode :mode (("\\.go\\'" . go-mode))) -- cgit 1.4.1 From 28ca9a6c5b2f33e0c54fede6319111ad91392a78 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 7 Jan 2015 10:28:52 +0000 Subject: Revert "Emacs: Install flycheck-pos-tip" This reverts commit 35bc57878c8dff67bdd17ddf207a2ba3d5076d3a. --- tag-emacs/emacs.d/Cask | 1 - tag-emacs/emacs.d/init.el | 5 ----- 2 files changed, 6 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 5680246b..22b55806 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -29,7 +29,6 @@ (depends-on "fasd") (depends-on "feature-mode") (depends-on "flycheck") -(depends-on "flycheck-pos-tip") (depends-on "framemove") (depends-on "geiser") (depends-on "ggtags") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 0bc3897f..32f273f2 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -809,11 +809,6 @@ mouse-1: Display Line and Column Mode Menu")))))) :diminish " ✓" :init (global-flycheck-mode)) -(req-package flycheck-pos-tip - :require flycheck - :init (progn - (setq flycheck-display-errors-function #'flycheck-pos-tip-error-messages))) - (req-package go-mode :mode (("\\.go\\'" . go-mode))) -- cgit 1.4.1 From ecbb7cf5919191f149e9934fb05c49eeb468ffa6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 31 Jan 2015 12:50:02 +0000 Subject: Emacs: Disable auto-indent in yaml/salt modes --- tag-emacs/emacs.d/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 32f273f2..49eb5f68 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -504,6 +504,8 @@ 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) (auto-indent-global-mode))) (req-package smart-tabs-mode -- cgit 1.4.1 From 09dce86b4c67ff14a68d50c75a1f8ec9a4b1a78e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 31 Jan 2015 12:50:22 +0000 Subject: ZSH: Set LESSGLOBAL to view global tags in less --- tag-zsh/config/zsh/zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index f82d9b75..4e5f1e37 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -2,6 +2,7 @@ export PAGER="less" export EDITOR="emacsclient" export CLICOLOR=true +export LESSGLOBALTAGS=global # # zsh variables -- cgit 1.4.1 From d1f0ae7ed8ebc43d4971f3e9c16858177bada0f6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 31 Jan 2015 12:52:26 +0000 Subject: Emacs: Remove unused hemisu theme --- tag-emacs/emacs.d/init.el | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 49eb5f68..416ed828 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -129,7 +129,6 @@ (persp-selected-face (:foreground "#EEF5FE")) (mode-line-buffer-id (:weight bold :foreground "#EEF5FE")))))) -(req-package hemisu-theme) (when (or (display-graphic-p) (daemonp)) -- cgit 1.4.1 From 4d2a49b17917e438d36a6e500e55d9a5b6d257e7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 31 Jan 2015 12:56:33 +0000 Subject: Emacs: Switch from leuven back to solarized-light --- tag-emacs/emacs.d/Cask | 2 +- tag-emacs/emacs.d/init.el | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 22b55806..40ed34a3 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -49,7 +49,6 @@ (depends-on "jinja2-mode") (depends-on "jquery-doc") (depends-on "js2-mode") -(depends-on "leuven-theme") (depends-on "litable") (depends-on "lua-mode") (depends-on "magit") @@ -79,6 +78,7 @@ (depends-on "scss-mode") (depends-on "skewer-mode") (depends-on "slime") +(depends-on "solarized-theme") (depends-on "smart-tab") (depends-on "smart-tabs-mode") (depends-on "smartparens") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 416ed828..91c253a5 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -121,14 +121,9 @@ '(isearch-abort abort-recursive-edit exit-minibuffer keyboard-quit undo-tree-undo)) (ding)))) -(req-package leuven-theme +(req-package solarized-theme :config (progn - (load-theme 'leuven t) - (setq face-remapping-alist - '((header-line (:box nil) mode-line-inactive) - (persp-selected-face (:foreground "#EEF5FE")) - (mode-line-buffer-id (:weight bold :foreground "#EEF5FE")))))) - + (load-theme 'solarized-light t))) (when (or (display-graphic-p) (daemonp)) -- cgit 1.4.1 From 7fd51e7fb45fd6feff0a8f530b354c848fe2858a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 31 Jan 2015 12:57:18 +0000 Subject: Emacs: Move underline, improve mode-line rendering --- tag-emacs/emacs.d/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 91c253a5..eadd68b8 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -115,6 +115,8 @@ (when (fboundp #'blink-cursor-mode) (blink-cursor-mode -1)) +(setq x-underline-at-descent-line t) + (setq ring-bell-function (lambda () (unless (memq this-command -- cgit 1.4.1 From d9e52eb75846f61694de8a32ecd179c1fbe23606 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 3 Feb 2015 14:33:23 +0000 Subject: Emacs: Reinstall ido and related packages --- tag-emacs/emacs.d/Cask | 4 +++ tag-emacs/emacs.d/init.el | 82 +++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 79 insertions(+), 7 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 40ed34a3..49cc0116 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -28,6 +28,8 @@ (depends-on "fancy-narrow") (depends-on "fasd") (depends-on "feature-mode") +(depends-on "flx") +(depends-on "flx-ido") (depends-on "flycheck") (depends-on "framemove") (depends-on "geiser") @@ -46,6 +48,7 @@ (depends-on "help-fns+") (depends-on "hemisu-theme") (depends-on "highlight-stages") +(depends-on "ido-vertical-mode") (depends-on "jinja2-mode") (depends-on "jquery-doc") (depends-on "js2-mode") @@ -82,6 +85,7 @@ (depends-on "smart-tab") (depends-on "smart-tabs-mode") (depends-on "smartparens") +(depends-on "smex") (depends-on "toml-mode") (depends-on "tup-mode") (depends-on "typo") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index eadd68b8..39f7b539 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -578,9 +578,7 @@ :demand t :diminish helm-mode :ensure helm - :bind (("C-x i". helm-semantic-or-imenu) - ("M-x" . helm-M-x) - ("C-x C-b" . helm-mini)) + :bind (("C-x i" . helm-semantic-or-imenu)) :config (progn (setq helm-idle-delay .1 helm-input-idle-delay 0 @@ -596,6 +594,77 @@ (define-key helm-read-file-map (kbd "C-i") #'helm-execute-persistent-action) (define-key helm-read-file-map (kbd "C-z") #'helm-select-action))) +(req-package ido + :bind (("C-x b" . ido-switch-buffer)) + :init (progn + (setq ido-save-directory-list-file (expand-file-name "ido-state" user-emacs-directory)) + (bind-key* "C-x C-f" #'ido-find-file) + (ido-mode 1) + (ido-everywhere 1)) + :config (progn + (setq ido-auto-merge-delay-time 99999 + ido-enable-flex-matching t) + + (ido-init-completion-maps) + (defun ido-manual-merge () + (interactive) + (ido-initiate-auto-merge (current-buffer))) + (bind-key "C-c C-s" #'ido-manual-merge ido-file-dir-completion-map))) + +(defun ap/ido-projectile-switch-buffer-dwim (force-ido) + (interactive "p") + (if (and (projectile-project-p) (eq force-ido 1)) + (call-interactively #'projectile-switch-to-buffer) + (call-interactively #'ido-switch-buffer))) + +(bind-key "s-x b" #'ap/ido-projectile-switch-buffer-dwim) +(bind-key "s-x s-b" #'ap/ido-projectile-switch-buffer-dwim) + +(req-package ido-vertical-mode + :require ido + :init (progn + (setq ido-vertical-decorations '("\n❯ " + "" + "\n " + "\n …" + "[" + "]" + " [No match]" + " [Matched]" + " [Not readable]" + " [Too big]" + " [Confirm]" + "\n❯ " + "" + ))) + :config (ido-vertical-mode 1)) + +(req-package flx-ido + :require ido + :init (progn + (flx-ido-mode 1) + (setq flx-ido-threshhold 1000))) + +(req-package smex + :require ido + :bind (("M-x" . smex) + ("" . smex) + ("" . smex) + ("M-X" . smex-major-mode-commands) + ("C-c M-x" . execute-extended-command)) + :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")) + (smex-initialize))) + ;;;; Modeline (column-number-mode t) @@ -891,9 +960,8 @@ mouse-1: Display Line and Column Mode Menu")))))) (ap/-add-known-subfolder-projects (ido-read-directory-name "Add projects under: "))) (defun ap/open-subfolder-project (from-dir &optional arg) - (let ((project-dir (helm-comp-read "Open project: " - (ap/subfolder-projects from-dir) - :must-match t))) + (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) @@ -907,7 +975,7 @@ mouse-1: Display Line and Column Mode Menu")))))) (setq projectile-switch-project-action #'projectile-dired projectile-remember-window-configs t - projectile-completion-system 'helm))) + projectile-completion-system 'ido))) (req-package helm-projectile :ensure projectile -- cgit 1.4.1 From 03f8973d2c839dad617868338fe918ffc3f34ecb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 27 Mar 2015 14:09:49 +0000 Subject: Zsh: Fix arrows in Xfce Terminal --- tag-zsh/config/zsh/zshrc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 4e5f1e37..fbb2cce4 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -177,10 +177,6 @@ unsetopt beep ############ # Keybinds # ############ -#KiTTY -bindkey "OD" backward-word -bindkey "OC" forward-word - #General bindkey "[1~" beginning-of-line bindkey "[4~" end-of-line -- cgit 1.4.1 From fcc0e0ed5dfe88cb84a5c56d786a062f64b1d78f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 27 Mar 2015 14:10:19 +0000 Subject: Emacs: Check before loading oracle-mode --- tag-emacs/emacs.d/init.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 39f7b539..355e6a01 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -879,10 +879,11 @@ mouse-1: Display Line and Column Mode Menu")))))) (req-package go-mode :mode (("\\.go\\'" . go-mode))) -(req-package oracle - :load-path ,(expand-file-name "src/code.google.com/p/go.tools/cmd/oracle/oracle.el" (getenv "GOPATH")) - :init (progn - (add-hook 'go-mode-hook #'go-oracle-mode))) +(when (file-exists-p "src/code.google.com/p/go.tools/cmd/oracle/oracle.el") + (req-package oracle + :load-path ,(expand-file-name "src/code.google.com/p/go.tools/cmd/oracle/oracle.el" (getenv "GOPATH")) + :init (progn + (add-hook 'go-mode-hook #'go-oracle-mode)))) (req-package company-go :require go-mode -- cgit 1.4.1 From 05c7485315107a70e4d7ad333f66954d08c5ceb8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 27 Mar 2015 14:10:34 +0000 Subject: Emacs: Autoload global-smart-tab-mode --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 355e6a01..37b110e2 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -228,6 +228,7 @@ completion-ignore-case t) (req-package smart-tab + :commands (global-smart-tab-mode) :init (global-smart-tab-mode) :config (progn (nconc smart-tab-completion-functions-alist '((php-mode . php-complete-function))) -- cgit 1.4.1 From 4b46b6cf7c314f724c6d2e77d3fa492e14da428c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 27 Mar 2015 14:11:00 +0000 Subject: Emacs: Fix eshell init --- tag-emacs/emacs.d/init.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 37b110e2..62581784 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1033,11 +1033,11 @@ mouse-1: Display Line and Column Mode Menu")))))) (add-hook 'eshell-load-hook (lambda () (bind-key "C-c C-l" #'helm-eshell-history eshell-mode-map))) (req-package em-smart - :init (progn - (setq eshell-where-to-jump 'begin - eshell-review-quick-commands nil - eshell-smart-space-goes-to-end t) - (eshell-smart-initialize))))) + :config (progn + (setq eshell-where-to-jump 'begin + eshell-review-quick-commands nil + eshell-smart-space-goes-to-end t) + (eshell-smart-initialize))))) (autoload #'eshell/cd "em-dirs") (defun eshell-goto-current-dir (&optional arg) -- cgit 1.4.1 From f8025d37533262930738d89121fe8bc34f75eb8d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 27 Mar 2015 14:11:43 +0000 Subject: Emacs: Remove unneeded diminish line --- tag-emacs/emacs.d/init.el | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 62581784..10de52e5 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -429,7 +429,6 @@ (req-package ws-butler :if window-system - :diminish highlight-changes-mode :config (ws-butler-global-mode 1)) (if (daemonp) (add-hook #'before-make-frame-hook (lambda () (ws-butler-global-mode 1)))) -- cgit 1.4.1 From 477ee903f470f7538e4ab3ffbff73ed31c24a1b5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 28 Mar 2015 10:00:08 +0000 Subject: Zsh: Remove fasd autoload --- tag-zsh/config/zsh/zshrc | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index fbb2cce4..3e4c7e8f 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -372,7 +372,6 @@ else fi _FASD_DATA="$HOME/.cache/zsh/fasd-data" -autoload -U fasd if [[ -e ~/.config/zsh/fasd.zsh ]] then source ~/.config/zsh/fasd.zsh -- cgit 1.4.1 From 2bda6f9985d68b5e5b988e0d717812c15aff1a2d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 30 Mar 2015 10:06:08 +0100 Subject: Emacs: add dash hook for SQL flavours --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 39f7b539..e1752044 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -356,7 +356,8 @@ (ap/create-helm-dash-hook twig ("Twig")) (ap/create-helm-dash-hook markdown ("Markdown")) (ap/create-helm-dash-hook saltstack ("SaltStack")) - (ap/create-helm-dash-hook clojure ("Clojure")))) + (ap/create-helm-dash-hook clojure ("Clojure")) + (ap/create-helm-dash-hook sql ("PostgreSQL" "MySQL")))) (req-package which-func :init (which-function-mode) -- cgit 1.4.1 From f50ed955d8beca2f86a0ab09cc0661db96fd2002 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 3 Apr 2015 16:03:14 +0100 Subject: Emacs: Disable auto-indent in nix-mode --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 10de52e5..b7a16ae9 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -502,6 +502,7 @@ (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) (auto-indent-global-mode))) (req-package smart-tabs-mode -- cgit 1.4.1 From 4f018fb03b873f649eafeed16186fd791b55a1a8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 3 Apr 2015 16:19:47 +0100 Subject: Emacs: Open files via sudo if needed --- tag-emacs/emacs.d/init.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index b7a16ae9..c1b2c412 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -607,6 +607,11 @@ ido-enable-flex-matching t) (ido-init-completion-maps) + (defadvice ido-find-file (after find-file-sudo activate) + "Find file as root if necessary." + (unless (and buffer-file-name + (file-writable-p buffer-file-name)) + (find-alternate-file (concat "/sudo::" buffer-file-name)))) (defun ido-manual-merge () (interactive) (ido-initiate-auto-merge (current-buffer))) -- cgit 1.4.1 From e4a2085354718f94c483e6d87c5fc2261287a8ee Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 3 Apr 2015 16:21:25 +0100 Subject: zsh: Fix E alias --- tag-zsh/config/zsh/zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 3e4c7e8f..fa2a2beb 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -260,7 +260,7 @@ alias pping="prettyping.sh" alias trans="transmission-remote transmission.home" alias bitcoin="bitcoind" alias su="smart_sudo " -alias E="SUDO_EDITOR=\emacsclient -c -a emacs\" sudoedit" +alias E="SUDO_EDITOR=\"emacsclient -c -a emacs\" sudoedit" alias wprop='xprop |awk '\'' /^WM_CLASS/{sub(/.* =/, "instance:"); sub(/,/, "\nclass:"); print} /^WM_NAME/{sub(/.* =/, "title:"); print} -- cgit 1.4.1 From 983c17466c18209282e63472ba922f93ea0acaf2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 7 Apr 2015 22:57:10 +0100 Subject: Emacs: Add nix-mode configuration --- tag-emacs/emacs.d/init.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index c1b2c412..fe553d49 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -774,6 +774,11 @@ mouse-1: Display Line and Column Mode Menu")))))) (req-package haskell-mode :mode (("\\.hs\\'" . haskell-mode))) +(req-package nix-mode + :mode (("\\.nix\\'" . nix-mode)) + :config (progn + (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)) -- cgit 1.4.1 From c1f68b429dfd508b536e3115c18b58ba9065970e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 7 Apr 2015 22:58:52 +0100 Subject: Add xmodmaprc for Marvin the ThinkPad --- host-marvin/xmodmaprc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 host-marvin/xmodmaprc diff --git a/host-marvin/xmodmaprc b/host-marvin/xmodmaprc new file mode 100644 index 00000000..60ae5b76 --- /dev/null +++ b/host-marvin/xmodmaprc @@ -0,0 +1,20 @@ +keycode 37 = Super_L NoSymbol Super_L +keycode 133 = Alt_L Meta_L Alt_L Meta_L +keycode 64 = Control_L NoSymbol Control_L + +! Thinkpad has PrtSc next to Alt_R +keycode 108 = Control_R NoSymbol Control_R +keycode 107 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift +keycode 105 = Super_R NoSymbol Super_R +! For external keyboards +keycode 134 = Super_R NoSymbol Super_R + +clear Control +clear Mod1 +clear Mod3 +clear Mod4 + +add Control = Control_L Control_R +add Mod1 = Alt_L Meta_L +add Mod4 = Super_L Super_R Super_L Hyper_L +add Mod5 = ISO_Level3_Shift Mode_switch \ No newline at end of file -- cgit 1.4.1 From ea5a661aa5249364c6f58fc3f66dcb35104c933e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 9 Apr 2015 13:12:30 +0100 Subject: Emacs: Install and configure ledger-mode --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 49cc0116..0d5b5984 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -53,6 +53,7 @@ (depends-on "jquery-doc") (depends-on "js2-mode") (depends-on "litable") +(depends-on "ledger-mode") (depends-on "lua-mode") (depends-on "magit") (depends-on "markdown-mode") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 735993af..40f59b2f 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -231,7 +231,8 @@ :commands (global-smart-tab-mode) :init (global-smart-tab-mode) :config (progn - (nconc smart-tab-completion-functions-alist '((php-mode . php-complete-function))) + (nconc smart-tab-completion-functions-alist '((php-mode . php-complete-function) + (ledger-mode . ledger-pcomplete))) (diminish 'smart-tab-mode ""))) (req-package company @@ -792,6 +793,15 @@ mouse-1: Display Line and Column Mode Menu")))))) (req-package lua-mode :defer t) +(req-package ledger-mode + :mode ("\\.ledger\\'" . ledger-mode) + :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 'ido))) + (req-package ruby-mode :mode (("\\.rb\\'" . ruby-mode) ("\\.cap\\'" . ruby-mode))) -- cgit 1.4.1 From 257c8502f0c584f42467a72cded8617e23e53a79 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 9 Apr 2015 21:57:01 +0100 Subject: Emacs: Improve ledger reconciliation --- tag-emacs/emacs.d/init.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 40f59b2f..50a6ed77 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -800,7 +800,10 @@ mouse-1: Display Line and Column Mode Menu")))))) (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 'ido))) + ledger-post-use-completion-engine 'ido + ledger-reconcile-default-commodity "£" + ledger-clear-whole-transactions t + ledger-narrow-on-reconcile t))) (req-package ruby-mode :mode (("\\.rb\\'" . ruby-mode) -- cgit 1.4.1 From 8a0e78e04e42f23cfb09ac6029d45167c00149d4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 9 Apr 2015 21:57:13 +0100 Subject: Emacs: Enable ledger weaving with org-babel --- tag-emacs/emacs.d/init.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 50a6ed77..b3b505e5 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -874,6 +874,13 @@ mouse-1: Display Line and Column Mode Menu")))))) (if (looking-at (concat " +" org-todo-regexp "\\( +\\|[ \t]*$\\)")) (org-todo "STARTED"))))))) +(req-package org-babel + :require org + :defer t + :config (org-babel-do-load-languages + 'org-babel-load-languages + '((ledger . t)))) + (req-package org-journal :require org :defer t -- cgit 1.4.1 From 2f69ec896b7d5d1941efcaa12690655d808e29b6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 13 Apr 2015 09:31:43 +0100 Subject: Xmodmap: Fix Alt mapping for external keyboards --- host-marvin/xmodmaprc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host-marvin/xmodmaprc b/host-marvin/xmodmaprc index 60ae5b76..82a8674f 100644 --- a/host-marvin/xmodmaprc +++ b/host-marvin/xmodmaprc @@ -7,7 +7,7 @@ keycode 108 = Control_R NoSymbol Control_R keycode 107 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift keycode 105 = Super_R NoSymbol Super_R ! For external keyboards -keycode 134 = Super_R NoSymbol Super_R +keycode 134 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift clear Control clear Mod1 -- cgit 1.4.1 From 9f235978081a1a85dce936d11dae943fde466ad3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 13 Apr 2015 14:04:45 +0100 Subject: Zsh: Ensure RPROMPT is unset when setting prompt --- tag-zsh/config/zsh/zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index fa2a2beb..e057f0ba 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -127,6 +127,7 @@ then autoload -U promptinit promptinit prompt pure + RPROMPT= fi # Options -- cgit 1.4.1 From ccf62a3d3124a4c340e0a8ebe49eaed0326e410c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 13 Apr 2015 14:05:37 +0100 Subject: Emacs: Fix ledger date formatting --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index b3b505e5..668ceb72 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -803,7 +803,8 @@ mouse-1: Display Line and Column Mode Menu")))))) ledger-post-use-completion-engine 'ido ledger-reconcile-default-commodity "£" ledger-clear-whole-transactions t - ledger-narrow-on-reconcile t))) + ledger-narrow-on-reconcile t + ledger-default-date-format "%Y-%m-%d"))) (req-package ruby-mode :mode (("\\.rb\\'" . ruby-mode) -- cgit 1.4.1 From 5fb9137c727ba15eb1eab11206fc3c8fb1c100df Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 13 Apr 2015 16:08:59 +0100 Subject: Emacs: Avoid prompt in minibuffer --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 668ceb72..bcbbe05b 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -571,6 +571,7 @@ ;;;; Minibuffer (setq enable-recursive-minibuffers t) +(setq minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)) (minibuffer-depth-indicate-mode t) (if (daemonp) -- cgit 1.4.1 From c93ab4ad4f63f8c93326650094cbb21802bbc0d7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 22 Apr 2015 19:17:36 +0100 Subject: Emacs: Improve functionality in ledger --- tag-emacs/emacs.d/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index bcbbe05b..a8c28102 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -231,8 +231,7 @@ :commands (global-smart-tab-mode) :init (global-smart-tab-mode) :config (progn - (nconc smart-tab-completion-functions-alist '((php-mode . php-complete-function) - (ledger-mode . ledger-pcomplete))) + (nconc smart-tab-completion-functions-alist '((php-mode . php-complete-function))) (diminish 'smart-tab-mode ""))) (req-package company @@ -800,6 +799,7 @@ mouse-1: Display Line and Column Mode Menu")))))) (defun setup-ledger-mode () (setq-local indent-tabs-mode nil)) (add-hook 'ledger-mode-hook #'setup-ledger-mode) + (add-to-list 'smart-tab-disabled-major-modes 'ledger-mode) (setq ledger-use-iso-dates t ledger-post-use-completion-engine 'ido ledger-reconcile-default-commodity "£" -- cgit 1.4.1 From d3699c0f0c67af6cc46cac4ab7feed166d485f8f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 3 May 2015 18:34:40 +0200 Subject: Emacs: Change ledger-mode default commodity to EUR --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index a8c28102..c23ae8c0 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -802,7 +802,7 @@ mouse-1: Display Line and Column Mode Menu")))))) (add-to-list 'smart-tab-disabled-major-modes 'ledger-mode) (setq ledger-use-iso-dates t ledger-post-use-completion-engine 'ido - ledger-reconcile-default-commodity "£" + ledger-reconcile-default-commodity "€" ledger-clear-whole-transactions t ledger-narrow-on-reconcile t ledger-default-date-format "%Y-%m-%d"))) -- cgit 1.4.1 From 44a2213952d1537e06df45ec9fd9bcb02ba1b910 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 6 May 2015 09:23:55 +0200 Subject: rcm: Add host configuration for SpotCap machine --- host-ap-spotcap.local/rcrc.local | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 host-ap-spotcap.local/rcrc.local diff --git a/host-ap-spotcap.local/rcrc.local b/host-ap-spotcap.local/rcrc.local new file mode 100644 index 00000000..4639c9e2 --- /dev/null +++ b/host-ap-spotcap.local/rcrc.local @@ -0,0 +1,2 @@ +DOTFILES_DIRS="$HOME/projects/dotfiles" +TAGS="emacs git global tmux zsh" \ No newline at end of file -- cgit 1.4.1 From 3f874826223174b6ab04f3c1176a6ba6205d1686 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 6 May 2015 09:24:32 +0200 Subject: zsh: Source zshenv.{local,private} if extant --- tag-zsh/config/zsh/zshenv | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index ae5f1cde..df793cfc 100755 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -56,3 +56,13 @@ then envoy -t gpg-agent eval $(envoy -p) fi + +if [[ -f $ZDOTDIR/zshenv.local ]] +then + . $ZDOTDIR/zshenv.local +fi + +if [[ -f $ZDOTDIR/zshenv.private ]] +then + . $ZDOTDIR/zshenv.private +fi -- cgit 1.4.1 From b9687258cc40db2c5960a6a9a93bf791fae25c78 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 6 May 2015 09:25:45 +0200 Subject: zsh: Use hub instead of gh for git alias --- tag-zsh/config/zsh/zshrc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index e057f0ba..361110a9 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -274,10 +274,10 @@ alias -g ...='../..' #Suffix aliases alias -s log=less -if [[ -e =gh ]]; then - alias git="gh" - if [[ -n $functions[_gh] ]];then - compdef _gh gh +if [[ -e =hub ]]; then + alias git="hub" + if [[ -n $functions[_hub] ]];then + compdef _hub hub fi fi -- cgit 1.4.1 From 10850b49fbc31af28c977d2d42cf8f22811963ea Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 6 May 2015 09:25:59 +0200 Subject: zsh: Alias gh to hub --- tag-zsh/config/zsh/zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 361110a9..22b44783 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -279,6 +279,7 @@ if [[ -e =hub ]]; then if [[ -n $functions[_hub] ]];then compdef _hub hub fi + alias gh="hub" fi if [[ -n $commands[composer.phar] && ! -n $commands[composer] ]]; then -- cgit 1.4.1 From e906e0210759b473a4aa097fbf749442f3f68f1c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 6 May 2015 09:26:18 +0200 Subject: Emacs: Remove jquery-doc package --- tag-emacs/emacs.d/init.el | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index c23ae8c0..50ee6a1c 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1394,11 +1394,6 @@ symbol, not word, as I need this for programming the most." (add-to-list 'auto-mode-alist '("composer\\.lock" . js-mode)) -(req-package jquery-doc - :defer t - :init (progn - (add-hook 'js2-mode-hook #'jquery-doc-setup))) - (req-package scss-mode :defer t :config (progn -- cgit 1.4.1 From e364a183f35cfe88d07b169f5cef08e4fbcfc0fb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 6 May 2015 09:27:14 +0200 Subject: Whitespace cleanup --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 50ee6a1c..802ec12c 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1386,7 +1386,7 @@ symbol, not word, as I need this for programming the most." :mode ("\\.js\\'" . js2-mode) :config (progn (defun ap/javascript-setup () - (autopair-mode -1) + (autopair-mode -1) (auto-indent-mode -1)) (add-hook 'js2-mode-hook #'ap/javascript-setup) (setq js2-basic-offset 4 -- cgit 1.4.1 From b809de14280337dc6cdcf696b66469540cfab325 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 6 May 2015 09:28:04 +0200 Subject: Emacs: Install and configure tern package --- tag-emacs/emacs.d/init.el | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 802ec12c..15fe482b 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -240,7 +240,7 @@ :bind (("C-" . company-complete)) :init (progn (add-hook 'prog-mode-hook #'company-mode) - (setq company-backends '((php-extras-company company-elisp company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-ropemacs company-cmake company-capf company-gtags company-dabbrev-code company-etags company-keywords) + (setq company-backends '(company-tern (php-extras-company company-elisp company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-ropemacs company-cmake company-capf company-gtags company-dabbrev-code company-etags company-keywords) company-oddmuse company-files company-dabbrev) company-idle-delay .3 company-begin-commands '(self-insert-command) @@ -1392,6 +1392,16 @@ symbol, not word, as I need this for programming the most." (setq js2-basic-offset 4 js2-global-externs '("$")))) +(req-package tern + :config (progn + (setq tern-command (list (executable-find "tern"))) + (defun ap/enable-tern () + (tern-mode 1)) + (add-hook 'js2-mode-hook #'ap/enable-tern))) + +(req-package tern-company + :require (tern company)) + (add-to-list 'auto-mode-alist '("composer\\.lock" . js-mode)) (req-package scss-mode -- cgit 1.4.1 From a27f79fd42c10cc8fe47e0344669f1f79a125434 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 6 May 2015 09:34:45 +0200 Subject: Emacs: Re-generate cask file --- tag-emacs/emacs.d/Cask | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 0d5b5984..3bfbf8a9 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -6,8 +6,10 @@ (depends-on "ace-jump-mode") (depends-on "ag") +(depends-on "async") (depends-on "auto-compile") (depends-on "auto-indent-mode") +(depends-on "autopair") (depends-on "bind-key") (depends-on "cask") (depends-on "cider") @@ -15,16 +17,23 @@ (depends-on "clojure-mode") (depends-on "company") (depends-on "company-go") +(depends-on "company-tern") +(depends-on "dash") +(depends-on "dash-functional") (depends-on "deferred") (depends-on "diff-hl") (depends-on "diminish") (depends-on "dired+") +(depends-on "dired-hacks-utils") +(depends-on "dired-k") (depends-on "dired-subtree") (depends-on "discover") (depends-on "discover-my-major") (depends-on "elisp-slime-nav") (depends-on "emmet-mode") +(depends-on "epl") (depends-on "expand-region") +(depends-on "f") (depends-on "fancy-narrow") (depends-on "fasd") (depends-on "feature-mode") @@ -34,12 +43,16 @@ (depends-on "framemove") (depends-on "geiser") (depends-on "ggtags") +(depends-on "gh") (depends-on "gist") +(depends-on "git-commit-mode") +(depends-on "git-rebase-mode") (depends-on "git-timemachine") (depends-on "go-eldoc") (depends-on "go-mode") (depends-on "go-projectile") (depends-on "goto-chg") +(depends-on "grizzl") (depends-on "haskell-mode") (depends-on "helm") (depends-on "helm-dash") @@ -52,41 +65,57 @@ (depends-on "jinja2-mode") (depends-on "jquery-doc") (depends-on "js2-mode") -(depends-on "litable") (depends-on "ledger-mode") +(depends-on "let-alist") +(depends-on "litable") +(depends-on "log4e") +(depends-on "logito") (depends-on "lua-mode") (depends-on "magit") +(depends-on "makey") (depends-on "markdown-mode") (depends-on "mmm-mode") (depends-on "move-text") (depends-on "multi-term") (depends-on "multiple-cursors") (depends-on "nginx-mode") +(depends-on "nix-mode") +(depends-on "nodejs-repl") (depends-on "org-journal") (depends-on "org-plus-contrib") +(depends-on "package-build") +(depends-on "packed") (depends-on "pallet") (depends-on "paradox") (depends-on "paredit") +(depends-on "pcache") (depends-on "persp-projectile") (depends-on "perspective") (depends-on "php-extras") (depends-on "php-mode") +(depends-on "pkg-info") (depends-on "popwin") (depends-on "projectile") (depends-on "pt") +(depends-on "queue") (depends-on "quickrun") (depends-on "rainbow-mode") (depends-on "redshank") (depends-on "req-package") (depends-on "s") (depends-on "scss-mode") +(depends-on "shut-up") +(depends-on "simple-httpd") (depends-on "skewer-mode") (depends-on "slime") -(depends-on "solarized-theme") +(depends-on "slime-repl") (depends-on "smart-tab") (depends-on "smart-tabs-mode") (depends-on "smartparens") (depends-on "smex") +(depends-on "solarized-theme") +(depends-on "spinner") +(depends-on "tern") (depends-on "toml-mode") (depends-on "tup-mode") (depends-on "typo") @@ -94,7 +123,9 @@ (depends-on "use-package") (depends-on "visual-regexp") (depends-on "web-mode") +(depends-on "wgrep") (depends-on "wgrep-ag") (depends-on "wgrep-pt") (depends-on "ws-butler") (depends-on "yaml-mode") +(depends-on "yasnippet") -- cgit 1.4.1 From 92ad3ee5c18fc15a63ef3cec41731ba23c63b3ab Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 6 May 2015 09:35:14 +0200 Subject: zsh: Setup nix on SpotCap machine --- host-ap-spotcap.local/config/zsh/zshenv.local | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 host-ap-spotcap.local/config/zsh/zshenv.local diff --git a/host-ap-spotcap.local/config/zsh/zshenv.local b/host-ap-spotcap.local/config/zsh/zshenv.local new file mode 100644 index 00000000..9ce3bef6 --- /dev/null +++ b/host-ap-spotcap.local/config/zsh/zshenv.local @@ -0,0 +1,3 @@ +# -*- mode: sh; -*- +export NIX_PATH=nixpkgs=/Users/alan/projects/nixpkgs +. /Users/alan/.nix-profile/etc/profile.d/nix.sh -- cgit 1.4.1 From 33c0e9699951140bddb9f408bd9a2a7b5deacf7f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 6 May 2015 09:35:51 +0200 Subject: Emacs: Improve company popup layout --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 15fe482b..271c257c 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -246,6 +246,7 @@ 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))) ;;;; Dates & Times -- cgit 1.4.1 From a4b690f924e3f064bf472f22368cabb1b2d54963 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 6 May 2015 16:29:27 +0200 Subject: Emacs: Configure js2-mode to work with node --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 271c257c..aa1876fc 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1391,7 +1391,7 @@ symbol, not word, as I need this for programming the most." (auto-indent-mode -1)) (add-hook 'js2-mode-hook #'ap/javascript-setup) (setq js2-basic-offset 4 - js2-global-externs '("$")))) + js2-global-externs '("require" "module")))) (req-package tern :config (progn -- cgit 1.4.1 From 6e6e4682fd28c6298548d4c4fc6346c0109c49bf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 7 May 2015 17:09:45 +0200 Subject: Emacs: Fix diminishing of emmet-mode --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index aa1876fc..b1e001c1 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1431,7 +1431,7 @@ symbol, not word, as I need this for programming the most." (req-package emmet-mode :commands (emmet-mode) - :diminish " >" + :diminish (emmet-mode . " >") :init (progn (if (functionp 'web-mode) (add-hook 'web-mode-hook #'emmet-mode)))) -- cgit 1.4.1 From dd979779a06bc766590e686d5f57692bb096afc6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 7 May 2015 17:10:01 +0200 Subject: Emacs: Remove missing company-ropmacs backend --- tag-emacs/emacs.d/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index b1e001c1..7b946f17 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -240,8 +240,8 @@ :bind (("C-" . company-complete)) :init (progn (add-hook 'prog-mode-hook #'company-mode) - (setq company-backends '(company-tern (php-extras-company company-elisp company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-ropemacs company-cmake company-capf company-gtags company-dabbrev-code company-etags company-keywords) - company-oddmuse company-files company-dabbrev) + (setq company-backends '(company-tern (php-extras-company company-elisp company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-cmake company-capf company-gtags company-dabbrev-code company-etags company-keywords) + company-oddmuse company-files company-dabbrev) company-idle-delay .3 company-begin-commands '(self-insert-command) company-auto-complete #'company-explicit-action-p -- cgit 1.4.1 From f605e559c20a2ba6afd60e45ef549b1daaa949fe Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 8 May 2015 09:58:55 +0200 Subject: zsh: Add pass completion to fpath when extant --- tag-zsh/config/zsh/zshenv | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index df793cfc..8e1fd025 100755 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -31,6 +31,11 @@ then fpath=(/usr/local/share/zsh/site-functions $fpath) fi +if [[ -d /usr/local/opt/pass/share/zsh/site-functions ]] +then + fpath=($fpath /usr/local/opt/pass/share/zsh/site-functions) +fi + export FPATH case $OSTYPE in -- cgit 1.4.1 From c8f84ed394e4773d8bc6d499368708db0ad1570a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 11 May 2015 16:55:29 +0200 Subject: Emacs: Install and configure password-store --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 3bfbf8a9..f470f30b 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -88,6 +88,7 @@ (depends-on "pallet") (depends-on "paradox") (depends-on "paredit") +(depends-on "password-store") (depends-on "pcache") (depends-on "persp-projectile") (depends-on "perspective") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 7b946f17..7275e85f 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -445,6 +445,10 @@ recentf-save-file (expand-file-name "recentf" user-emacs-directory)) (recentf-mode 1))) +(req-package password-store + :config (progn + (setq password-store-password-length 16))) + (req-package saveplace :config (progn (setq-default save-place t) (setq save-place-file (expand-file-name ".saveplace" user-emacs-directory)))) -- cgit 1.4.1 From ba072244ef31334ba07db9d4f646f8149a660fcc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 11 May 2015 16:55:43 +0200 Subject: Emacs: Open .ejs files in web-mode --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 7275e85f..cdb8500c 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1443,7 +1443,8 @@ symbol, not word, as I need this for programming the most." (req-package web-mode :mode (("/views/.*\\.php\\'" . web-mode) ("/layouts/.*\\.html\\'" . web-mode) - ("/templates/.*\\.php\\'" . web-mode)) + ("/templates/.*\\.php\\'" . web-mode) + ("\\.ejs\\'" . web-mode)) :config (setq web-mode-code-indent-offset 4 web-mode-css-indent-offset 4 web-mode-markup-indent-offset 4 -- cgit 1.4.1 From 95b6c1dc702d55f4e5a86e134270e7efea7bda70 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 11 May 2015 16:55:56 +0200 Subject: Emacs: Use node externs in js2-mode --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index cdb8500c..f2cc3c31 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1395,7 +1395,7 @@ symbol, not word, as I need this for programming the most." (auto-indent-mode -1)) (add-hook 'js2-mode-hook #'ap/javascript-setup) (setq js2-basic-offset 4 - js2-global-externs '("require" "module")))) + js2-include-node-externs t))) (req-package tern :config (progn -- cgit 1.4.1 From 3a91d166e451552cd93a9394effc893ba5de022c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 11 May 2015 17:01:44 +0200 Subject: Setup editorconfig package --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 2 ++ 2 files changed, 3 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index f470f30b..eb15bd94 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -29,6 +29,7 @@ (depends-on "dired-subtree") (depends-on "discover") (depends-on "discover-my-major") +(depends-on "editorconfig") (depends-on "elisp-slime-nav") (depends-on "emmet-mode") (depends-on "epl") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index f2cc3c31..728047f5 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1022,6 +1022,8 @@ mouse-1: Display Line and Column Mode Menu")))))) :require projectile :defer t) +(req-package editorconfig) + (req-package perspective :demand t :bind (("s-s" . persp-switch)) -- cgit 1.4.1 From 14500c0e2f90e9151a3c28fa26049a821abd2256 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 12 May 2015 09:44:45 +0200 Subject: Emacs: Fix “g” removing “k” info in dired buffers --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 728047f5..cf1ce9b9 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -299,7 +299,8 @@ (defun ap/dired-k-if-vc () (when (projectile-project-root) (dired-k))) - (add-hook 'dired-initial-position-hook #'ap/dired-k-if-vc))) + (add-hook 'dired-initial-position-hook #'ap/dired-k-if-vc) + (bind-key "g" #'dired-k dired-mode-map))) (req-package dired-x :require dired) -- cgit 1.4.1 From e4b09a2eedfa5af5b6f75e0a87723547d334a706 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 12 May 2015 09:45:46 +0200 Subject: Emacs: Remove timeclock configuration --- tag-emacs/emacs.d/init.el | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index cf1ce9b9..34a3d305 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -275,11 +275,6 @@ ((equal prefix '(4)) "%Y-%m-%dT%H:%M:%SZ")))) (insert (format-time-string format)))) -(use-package timeclock - :defer t - :config (progn - (setq timeclock-workday (* 7.5 60 60)))) - ;;;; Directory browsing (req-package dired :defer t -- cgit 1.4.1 From 5e43b9cb4b60e14a33599be2a7a73ba094dc7a6b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 12 May 2015 09:56:48 +0200 Subject: Emacs: Use dired-k outside projects, too --- tag-emacs/emacs.d/init.el | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 34a3d305..a51682b9 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -291,10 +291,7 @@ (req-package dired-k :init (progn - (defun ap/dired-k-if-vc () - (when (projectile-project-root) - (dired-k))) - (add-hook 'dired-initial-position-hook #'ap/dired-k-if-vc) + (add-hook 'dired-initial-position-hook #'dired-k) (bind-key "g" #'dired-k dired-mode-map))) (req-package dired-x -- cgit 1.4.1 From 8d1bcef139287cce1ac35a7a8672d671aec8f9db Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 May 2015 17:21:56 +0200 Subject: Emacs: Use helm inside projectile --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index a51682b9..3022c969 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1008,7 +1008,7 @@ mouse-1: Display Line and Column Mode Menu")))))) (setq projectile-switch-project-action #'projectile-dired projectile-remember-window-configs t - projectile-completion-system 'ido))) + projectile-completion-system 'helm))) (req-package helm-projectile :ensure projectile -- cgit 1.4.1 From 310a79c57e10aa167f112769417b24d77e2a905f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 May 2015 17:22:08 +0200 Subject: Emacs: Use human-readable file sizes in dired --- tag-emacs/emacs.d/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 3022c969..0c3f60ad 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -284,6 +284,7 @@ (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"))) @@ -292,6 +293,7 @@ (req-package dired-k :init (progn (add-hook 'dired-initial-position-hook #'dired-k) + (setq dired-k-human-readable t) (bind-key "g" #'dired-k dired-mode-map))) (req-package dired-x -- cgit 1.4.1 From a150cf5b6a865eb1e8762cac4c3d4aa3b51039bd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 May 2015 17:26:12 +0200 Subject: Emacs: Diminish highlight-stages --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 0c3f60ad..a55d817f 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -159,6 +159,7 @@ (req-package highlight-stages :defer t + :diminish t :init (progn (add-hook 'lisp-mode-common-hook #'highlight-stages-mode))) -- cgit 1.4.1 From 524921e83da6b5b914e1de80e9b504efc4987ebd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 May 2015 17:27:05 +0200 Subject: Emacs: Fix dired-k initialisation --- tag-emacs/emacs.d/init.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index a55d817f..0fdec48b 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -293,9 +293,10 @@ (req-package dired-k :init (progn - (add-hook 'dired-initial-position-hook #'dired-k) - (setq dired-k-human-readable t) - (bind-key "g" #'dired-k dired-mode-map))) + (add-hook 'dired-initial-position-hook #'dired-k)) + :config (progn + (setq dired-k-human-readable t) + (bind-key "g" #'dired-k dired-mode-map))) (req-package dired-x :require dired) -- cgit 1.4.1 From e739c34930d9b7b02832f206851842ffa46c3484 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 May 2015 17:28:43 +0200 Subject: Emacs: Replace deprecated ucs-insert call --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 0fdec48b..3a9d6d96 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -543,7 +543,7 @@ (bind-key "C-x C-j" #'delete-indentation) (unbind-key "C-x C-c") -(bind-key "C-c i" #'ucs-insert) +(bind-key "C-c i" #'insert-char) (bind-key "M-/" #'hippie-expand) (unbind-key "s-h") -- cgit 1.4.1 From 8b19276716ade2749a6496d31bf82da0ddf0c944 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 May 2015 17:32:49 +0200 Subject: Emacs: Fix warnings --- tag-emacs/emacs.d/init.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 3a9d6d96..8fc17f3e 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -80,7 +80,7 @@ (let ((from-arc (mapcar #'car (--filter (equalp (package-desc-archive (cdr it)) archive) (package-list-installed))))) - (if (called-interactively-p) + (if (called-interactively-p 'any) (message "%s" from-arc) from-arc))) @@ -1047,10 +1047,11 @@ mouse-1: Display Line and Column Mode Menu")))))) :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) ;;;; Spelling -(setq ispell-program-name "aspell" - ispell-dictionary "british") (req-package ispell - :bind (("" . ispell-word))) + :bind (("" . ispell-word)) + :config (progn + (setq ispell-program-name "aspell" + ispell-dictionary "british"))) ;;;; Scripting @@ -1278,7 +1279,7 @@ symbol, not word, as I need this for programming the most." (rename-modeline emacs-lisp-mode "ξ") (add-to-list 'auto-mode-alist '("/Cask\\'" . emacs-lisp-mode)) (add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup) -(add-hook 'emacs-lisp-mode-hook #'turn-on-eldoc-mode) +(add-hook 'emacs-lisp-mode-hook #'eldoc-mode) (add-hook 'scheme-mode-hook #'ap/lisp-setup) (add-hook 'lisp-mode-hook #'ap/lisp-setup) -- cgit 1.4.1 From d6b8c7598e13cab1854f91f4530696ad79d02da0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 May 2015 17:33:04 +0200 Subject: Emacs: Remove incorrect sendmail configuration --- tag-emacs/emacs.d/init.el | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 8fc17f3e..f58c9cb6 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -63,7 +63,7 @@ collect (assq pkg package-archive-contents))) (defun package-archive-stats () - (let ((archives (makehash)) + (let ((archives (make-hash-table)) (assoc '())) (dolist (arc package-archives) (puthash (car arc) 0 archives)) @@ -218,9 +218,6 @@ ;;;; Communication -(setq message-send-mail-function 'smtpmail-send-it) -(setq smtpmail-smtp-server "external.home" - smtpmail-smtp-service 587) (setq gnutls-min-prime-bits nil) ;;;; Completion -- cgit 1.4.1 From 3b9103ab703a03808e6a79b2047eec316514e9a0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 May 2015 17:41:38 +0200 Subject: Emacs: Don’t enable helm-mode --- tag-emacs/emacs.d/init.el | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index f58c9cb6..5de9f297 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -585,7 +585,6 @@ (setq helm-idle-delay .1 helm-input-idle-delay 0 ido-use-virtual-buffers t) - (helm-mode 1) (helm-adaptive-mode 1))) (req-package helm-files -- cgit 1.4.1 From cb773bd92390dea1ba5b79717873f5f740be24f4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 May 2015 17:50:37 +0200 Subject: Emacs: Remove old Bulb laptop configuration --- host-ap-bulbbook/rcrc.local | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 host-ap-bulbbook/rcrc.local diff --git a/host-ap-bulbbook/rcrc.local b/host-ap-bulbbook/rcrc.local deleted file mode 100644 index 6329d62c..00000000 --- a/host-ap-bulbbook/rcrc.local +++ /dev/null @@ -1,2 +0,0 @@ -DOTFILES_DIRS="$HOME/projects/dotfiles" -TAGS="emacs git hg ssh tmux zsh" \ No newline at end of file -- cgit 1.4.1 From 89baff639394a218266dff3ba39471f28d03ed4d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 18 May 2015 09:43:38 +0200 Subject: Emacs: Fix helm startup errors --- tag-emacs/emacs.d/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 5de9f297..d8c09c3b 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -578,14 +578,14 @@ (req-package helm-config :demand t - :diminish helm-mode :ensure helm :bind (("C-x i" . helm-semantic-or-imenu)) :config (progn (setq helm-idle-delay .1 helm-input-idle-delay 0 ido-use-virtual-buffers t) - (helm-adaptive-mode 1))) + (when (fboundp #'helm-adaptive-mode) + (helm-adaptive-mode 1)))) (req-package helm-files :defer t -- cgit 1.4.1 From 735f35c413ec3a133125a3266655a06134485858 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 18 May 2015 12:47:32 +0200 Subject: WS cleanup --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index d8c09c3b..27cff90c 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -579,7 +579,7 @@ (req-package helm-config :demand t :ensure helm - :bind (("C-x i" . helm-semantic-or-imenu)) + :bind (("C-x i" . helm-semantic-or-imenu)) :config (progn (setq helm-idle-delay .1 helm-input-idle-delay 0 -- cgit 1.4.1 From 455eaec31cdbb827aa4111d59f37d34a021edb1d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 20 May 2015 11:57:02 +0200 Subject: Emacs: Fix error in highlight-stages config --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 27cff90c..03e2abcd 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -159,7 +159,7 @@ (req-package highlight-stages :defer t - :diminish t + :diminish highlight-stages-mode :init (progn (add-hook 'lisp-mode-common-hook #'highlight-stages-mode))) -- cgit 1.4.1 From 01d31a2f4d73263dcab1478c1a35e756e1e3fbd4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 20 May 2015 12:09:07 +0200 Subject: Emacs: Replace ace-jump-mode with avy --- tag-emacs/emacs.d/Cask | 2 +- tag-emacs/emacs.d/init.el | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index eb15bd94..580361d9 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -4,7 +4,7 @@ (source melpa-stable) (source org) -(depends-on "ace-jump-mode") +(depends-on "avy") (depends-on "ag") (depends-on "async") (depends-on "auto-compile") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 03e2abcd..55efdbe8 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1160,13 +1160,13 @@ symbol, not word, as I need this for programming the most." :config (progn (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) -(req-package ace-jump-mode - :bind (("C-c SPC" . ace-jump-mode) - ("C-|" . ace-jump-line-mode)) +(req-package avy + :bind (("M-g g" . avy-goto-line) + ("M-g M-g" . avy-goto-line) + ("C-c SPC" . avy-goto-char)) :config (progn - (ace-jump-mode-enable-mark-sync) - (setq ace-jump-word-mode-use-query-char nil - ace-jump-mode-scope 'window))) + (avy-setup-default) + (setq avy-all-windows nil))) (req-package expand-region :bind ("C-M-SPC" . er/expand-region)) -- cgit 1.4.1 From 61ecf571affd1d4ed334157718415229c8bbbf49 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 20 May 2015 12:09:19 +0200 Subject: zsh: Treat = as a word splitter --- tag-zsh/config/zsh/zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 22b44783..9c9f36aa 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -11,7 +11,7 @@ HISTFILE=~/.cache/zsh/history HISTSIZE=4000 SAVEHIST=3000 -WORDCHARS='*?_-[]~=.&;!#$%^(){}<>' +WORDCHARS='*?_-[]~.&;!#$%^(){}<>' #If a command takes more than 5 seconds, give statistics REPORTTIME=5 -- cgit 1.4.1 From 8f86a9d18705be2fa2257ea5e38a05f497e2ddd6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 20 May 2015 12:12:05 +0200 Subject: Emacs: Move persp-switch key to s-p --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 55efdbe8..c7fa0a82 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1019,7 +1019,7 @@ mouse-1: Display Line and Column Mode Menu")))))) (req-package perspective :demand t - :bind (("s-s" . persp-switch)) + :bind (("s-p" . persp-switch)) :config (persp-mode)) (req-package persp-projectile -- cgit 1.4.1 From 84b6bbad2e6fb741b8941fc932c17d00f1bf5da3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 20 May 2015 16:30:25 +0200 Subject: Emacs: Add alignment rules for Javascript objects --- tag-emacs/emacs.d/init.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index c7fa0a82..28e9a183 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1111,6 +1111,13 @@ mouse-1: Display Line and Column Mode Menu")))))) (setq sentence-end-double-space t line-move-visual nil) +(req-package align + :config (progn + (add-to-list 'align-rules-list + '(colon-key-value + (regexp . ":\\(\\s-*\\)") + (modes . '(js2-mode)))))) + (setq x-select-enable-clipboard t) (if (functionp 'x-cut-buffer-or-selection-value) (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)) -- cgit 1.4.1 From a773861e0682ee3d0204560840dccf302c4cdfb8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 20 May 2015 16:36:13 +0200 Subject: Emacs: Install and configure ace-window-mode --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 580361d9..9f03ef14 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -4,6 +4,7 @@ (source melpa-stable) (source org) +(depends-on "ace-window") (depends-on "avy") (depends-on "ag") (depends-on "async") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 28e9a183..0862130a 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1175,6 +1175,19 @@ symbol, not word, as I need this for programming the most." (avy-setup-default) (setq avy-all-windows nil))) +(req-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") + (?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)) + aw-keys '(?a ?r ?s ?t ?n ?e ?i ?o)))) + (req-package expand-region :bind ("C-M-SPC" . er/expand-region)) -- cgit 1.4.1 From 1dfecc3c3e2f72d22ca2bc1429c883609d0a08a7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 20 May 2015 18:02:59 +0200 Subject: Emacs: Auto-start pallet-mode --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 0862130a..64b0a624 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -47,7 +47,8 @@ (package-install 'req-package)) (require 'req-package) (setq use-package-verbose t) -(req-package pallet) +(req-package pallet + :config (pallet-mode 1)) (req-package paradox :defer t -- cgit 1.4.1 From 409e833300a6b7172a441bd2f7c3cc1ed8c810e3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 20 May 2015 18:03:10 +0200 Subject: Emacs: Add ace-window key to kill current window --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 64b0a624..8bb16516 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1181,6 +1181,7 @@ symbol, not word, as I need this for programming the most." :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") -- cgit 1.4.1 From e6d7513cc93c24cdcb839384bba3e9714c1e8601 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 21 May 2015 14:09:32 +0200 Subject: Emacs: Bind C-| to avy-go-to-line --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 8bb16516..92525d83 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1170,7 +1170,8 @@ symbol, not word, as I need this for programming the most." (req-package avy :bind (("M-g g" . avy-goto-line) - ("M-g M-g" . avy-goto-line) + ("M-g M-g" . avy-goto-line) + ("C-|" . avy-goto-line) ("C-c SPC" . avy-goto-char)) :config (progn (avy-setup-default) -- cgit 1.4.1 From 72955df98c117aa5d86dbd44ce196d213e56810f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 22 May 2015 16:49:37 +0200 Subject: Emacs: Open .envrc files with sh-mode --- tag-emacs/emacs.d/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 92525d83..694e9842 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -768,6 +768,8 @@ mouse-1: Display Line and Column Mode Menu")))))) (add-to-list 'auto-mode-alist '("\\.target\\'" . conf-mode)) (add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-mode)) +(add-to-list 'auto-mode-alist '("\\.envrc\\'" . sh-mode)) + (req-package xrdb-mode :mode (("\\.Xdefaults\\'" . xrdb-mode) ("\\.Xresources\\'" . xrdb-mode))) -- cgit 1.4.1 From 7be9eeb3b614256a2c7492d0a8dd9cf5db784083 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 25 May 2015 09:25:10 +0200 Subject: Emacs: Add winner shortcuts to ace-window --- tag-emacs/emacs.d/init.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 694e9842..a548f78a 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1190,7 +1190,9 @@ symbol, not word, as I need this for programming the most." (?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)) + (?l delete-other-windows) + (?, winner-undo) + (?. winner-redo)) aw-keys '(?a ?r ?s ?t ?n ?e ?i ?o)))) (req-package expand-region -- cgit 1.4.1 From 8393b057ec882f148bc1d116a15cfe57fdb229d1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 25 May 2015 15:57:42 +0200 Subject: zsh: Run direnv hook after sourcing custom env --- tag-zsh/config/zsh/zshenv | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index 8e1fd025..c23be400 100755 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -51,23 +51,23 @@ esac export os -if [[ -s $commands[direnv] ]] +if [[ -f $ZDOTDIR/zshenv.local ]] then - eval "$(direnv hook zsh)" + . $ZDOTDIR/zshenv.local fi -if [[ $os == gnu && ! -S $SSH_AUTH_SOCK && -s $commands[envoy] ]] +if [[ -f $ZDOTDIR/zshenv.private ]] then - envoy -t gpg-agent - eval $(envoy -p) + . $ZDOTDIR/zshenv.private fi -if [[ -f $ZDOTDIR/zshenv.local ]] +if [[ -s $commands[direnv] ]] then - . $ZDOTDIR/zshenv.local + eval "$(direnv hook zsh)" fi -if [[ -f $ZDOTDIR/zshenv.private ]] +if [[ $os == gnu && ! -S $SSH_AUTH_SOCK && -s $commands[envoy] ]] then - . $ZDOTDIR/zshenv.private + envoy -t gpg-agent + eval $(envoy -p) fi -- cgit 1.4.1 From b912fe69c30626d2297f72f9bd3a2f1c407992bc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 25 May 2015 16:44:21 +0200 Subject: Whitespace cleanup --- tag-emacs/emacs.d/init.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index a548f78a..38493be5 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -586,7 +586,7 @@ helm-input-idle-delay 0 ido-use-virtual-buffers t) (when (fboundp #'helm-adaptive-mode) - (helm-adaptive-mode 1)))) + (helm-adaptive-mode 1)))) (req-package helm-files :defer t @@ -1174,10 +1174,10 @@ symbol, not word, as I need this for programming the most." :bind (("M-g g" . avy-goto-line) ("M-g M-g" . avy-goto-line) ("C-|" . avy-goto-line) - ("C-c SPC" . avy-goto-char)) + ("C-c SPC" . avy-goto-char)) :config (progn - (avy-setup-default) - (setq avy-all-windows nil))) + (avy-setup-default) + (setq avy-all-windows nil))) (req-package ace-window :bind (("s-s" . ace-window)) -- cgit 1.4.1 From 058aa1d204595ba75b8d12e97b64fbcb273addfb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 25 May 2015 16:44:37 +0200 Subject: Emacs: Create helm-dash hook for js2-mode --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 38493be5..2d7569af 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -351,6 +351,7 @@ (ap/create-helm-dash-hook ansible ("Ansible")) (ap/create-helm-dash-hook php ("PHP" "Symfony")) (ap/create-helm-dash-hook twig ("Twig")) + (ap/create-helm-dash-hook js2 ("JavaScript" "NodeJS" "jQuery" "Express")) (ap/create-helm-dash-hook markdown ("Markdown")) (ap/create-helm-dash-hook saltstack ("SaltStack")) (ap/create-helm-dash-hook clojure ("Clojure")) -- cgit 1.4.1 From cbe7177bed489fed71de7a97332bfae9c10663ed Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 25 May 2015 16:58:44 +0200 Subject: Emacs: Make C-v/M-v scrolling reversible --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 2d7569af..811a112c 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1523,7 +1523,7 @@ symbol, not word, as I need this for programming the most." (setq scroll-conservatively 100 ; Keep the cursor position when scrolling scroll-margin 1 - scroll-preserve-screen-position nil + scroll-preserve-screen-position t mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control))) split-height-threshold 100) -- cgit 1.4.1 From 54926861002591eb27506e1d61feb1b81fa65160 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 26 May 2015 15:55:42 +0200 Subject: Git: Ignore .tern-port files globally --- tag-git/config/git/ignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tag-git/config/git/ignore b/tag-git/config/git/ignore index 78d8d163..d7189dc5 100644 --- a/tag-git/config/git/ignore +++ b/tag-git/config/git/ignore @@ -24,4 +24,6 @@ tramp GPATH GRTAGS -GTAGS \ No newline at end of file +GTAGS + +.tern-port \ No newline at end of file -- cgit 1.4.1 From 1e8ce4132e6f4b7dd1e3cc9363f675af1ce65d5c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 3 Jun 2015 10:10:13 +0200 Subject: Emacs: Ensure avy keybinds are respected --- tag-emacs/emacs.d/init.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 811a112c..8e3cb32a 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1172,10 +1172,10 @@ symbol, not word, as I need this for programming the most." (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) (req-package avy - :bind (("M-g g" . avy-goto-line) - ("M-g M-g" . avy-goto-line) - ("C-|" . avy-goto-line) - ("C-c SPC" . avy-goto-char)) + :bind* (("M-g g" . avy-goto-line) + ("M-g M-g" . avy-goto-line) + ("C-|" . avy-goto-line) + ("C-c SPC" . avy-goto-char)) :config (progn (avy-setup-default) (setq avy-all-windows nil))) -- cgit 1.4.1 From 7412c7db219c2c85091afb04452dd223c03a223b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 3 Jun 2015 12:33:33 +0200 Subject: Emacs: Install json-mode --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 3 +++ 2 files changed, 4 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 9f03ef14..4a1c18bb 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -67,6 +67,7 @@ (depends-on "jinja2-mode") (depends-on "jquery-doc") (depends-on "js2-mode") +(depends-on "json-mode") (depends-on "ledger-mode") (depends-on "let-alist") (depends-on "litable") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 8e3cb32a..51a9d1fc 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1421,6 +1421,9 @@ symbol, not word, as I need this for programming the most." (setq js2-basic-offset 4 js2-include-node-externs t))) +(req-package json-mode + :mode ("\\.json\\'" . json-mode)) + (req-package tern :config (progn (setq tern-command (list (executable-find "tern"))) -- cgit 1.4.1 From 260c8db3b89626b0afa24ad1d206e1c0541010e9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 3 Jun 2015 12:54:03 +0200 Subject: Emacs: Install restclient-mode --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 2 ++ 2 files changed, 3 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 4a1c18bb..65438a8e 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -106,6 +106,7 @@ (depends-on "rainbow-mode") (depends-on "redshank") (depends-on "req-package") +(depends-on "restclient") (depends-on "s") (depends-on "scss-mode") (depends-on "shut-up") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 51a9d1fc..a3f57b97 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1424,6 +1424,8 @@ symbol, not word, as I need this for programming the most." (req-package json-mode :mode ("\\.json\\'" . json-mode)) +(req-package restclient) + (req-package tern :config (progn (setq tern-command (list (executable-find "tern"))) -- cgit 1.4.1 From 662c91f506ad3afb199eaadd213fe5eb27567c38 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 3 Jun 2015 14:40:07 +0200 Subject: Emacs: Remove debug message call --- tag-emacs/emacs.d/init.el | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index a3f57b97..6a6b1567 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -418,7 +418,6 @@ (defun kill-or-delete-this-buffer-dwim (&optional arg) "Kills current buffer. With prefix arg, delete it." (interactive "P") - (message "%s" arg) (if (equal arg '(4)) (delete-current-buffer-file) (if server-buffer-clients -- cgit 1.4.1 From e010d8654a3efc800cf8e8061778149ddbe9fcfa Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 3 Jun 2015 14:44:56 +0200 Subject: Emacs: Switch window when killing REST buffer --- tag-emacs/emacs.d/init.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 6a6b1567..36c08506 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -422,7 +422,10 @@ (delete-current-buffer-file) (if server-buffer-clients (server-edit) - (kill-this-buffer)))) + (let ((buf (buffer-name))) + (when (equalp buf "*HTTP Response*") + (other-window 1)) + (kill-buffer buf))))) (req-package ws-butler :if window-system -- cgit 1.4.1 From 1c905d30c3f13c55a65802d8d23c5a4639a04883 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 8 Jun 2015 09:14:09 +0200 Subject: Emacs: Sort caskfile --- tag-emacs/emacs.d/Cask | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 65438a8e..d873ba40 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -5,12 +5,12 @@ (source org) (depends-on "ace-window") -(depends-on "avy") (depends-on "ag") (depends-on "async") (depends-on "auto-compile") (depends-on "auto-indent-mode") (depends-on "autopair") +(depends-on "avy") (depends-on "bind-key") (depends-on "cask") (depends-on "cider") -- cgit 1.4.1 From 0676e96d53ae296c4215f3f064d467aff6953d8d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 8 Jun 2015 09:20:28 +0200 Subject: Emacs: Configure restclient-mode --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 36c08506..5b16f4b1 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1426,7 +1426,8 @@ symbol, not word, as I need this for programming the most." (req-package json-mode :mode ("\\.json\\'" . json-mode)) -(req-package restclient) +(req-package restclient + :mode ("\\.api\\'" . restclient-mode)) (req-package tern :config (progn -- cgit 1.4.1 From 75576d97543b788576275ac9d4a24cee3ee66f55 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 8 Jun 2015 09:20:50 +0200 Subject: Emacs: Install sass-mode --- tag-emacs/emacs.d/Cask | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index d873ba40..4a242fa7 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -108,6 +108,7 @@ (depends-on "req-package") (depends-on "restclient") (depends-on "s") +(depends-on "sass-mode") (depends-on "scss-mode") (depends-on "shut-up") (depends-on "simple-httpd") -- cgit 1.4.1 From 4347a8f3168dbb4a99475126f0fec97f1c22cfcd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 8 Jun 2015 09:40:30 +0200 Subject: Emacs: Install projector-mode --- tag-emacs/emacs.d/init.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 5b16f4b1..59fff87a 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1021,6 +1021,10 @@ mouse-1: Display Line and Column Mode Menu")))))) :require projectile :defer t) +(req-package projector + :require projectile + :bind (("s-z" . projector-open-project-shell))) + (req-package editorconfig) (req-package perspective -- cgit 1.4.1 From 4afb07470aa58c32b1bed0f44c0fd3fc4caa70b1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 8 Jun 2015 09:46:58 +0200 Subject: Emacs: Install and configure ace-jump-buffer --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.el | 3 +++ 2 files changed, 4 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 4a242fa7..83315c08 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -5,6 +5,7 @@ (source org) (depends-on "ace-window") +(depends-on "ace-jump-buffer") (depends-on "ag") (depends-on "async") (depends-on "auto-compile") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 59fff87a..dfb9d5a5 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1186,6 +1186,9 @@ symbol, not word, as I need this for programming the most." (avy-setup-default) (setq avy-all-windows nil))) +(use-package ace-jump-buffer + :bind ("s-b" . ace-jump-buffer)) + (req-package ace-window :bind (("s-s" . ace-window)) :config (progn -- cgit 1.4.1 From d2b814b8465d9801ad3beac76abe377ae92ee205 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 8 Jun 2015 10:07:36 +0200 Subject: Emacs: Open nginx included files in nginx-mode --- tag-emacs/emacs.d/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index dfb9d5a5..933ac21c 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -791,6 +791,8 @@ mouse-1: Display Line and Column Mode Menu")))))) (req-package nginx-mode :defer t + :mode (("/nginx/servers/" . nginx-mode) + ("/nginx/.*\\.d/" . nginx-mode)) :config (progn (setq nginx-indent-tabs-mode t))) -- cgit 1.4.1 From 5db8dd53007f8d008c6ad1884c5349b3ad69f898 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 11 Jun 2015 15:38:41 +0200 Subject: Emacs: Use js2 error movement in js2-mode --- tag-emacs/emacs.d/init.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 933ac21c..3c2cb605 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1428,6 +1428,11 @@ symbol, not word, as I need this for programming the most." (defun ap/javascript-setup () (autopair-mode -1) (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))) -- cgit 1.4.1 From 13290f1c8f69cf45f6c0b621f4bec96df8fd7301 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 11 Jun 2015 15:38:59 +0200 Subject: Emacs: Add imenu navigation for restclient files --- tag-emacs/emacs.d/init.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 3c2cb605..49b0f079 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1441,7 +1441,13 @@ symbol, not word, as I need this for programming the most." :mode ("\\.json\\'" . json-mode)) (req-package restclient - :mode ("\\.api\\'" . restclient-mode)) + :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))) (req-package tern :config (progn -- cgit 1.4.1 From e3a948891e3a30081a045f83cf7beb151075c1b5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 11 Jun 2015 15:39:18 +0200 Subject: Emacs: Move sp-transpose to classic C-M-t --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 49b0f079..f097b270 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1261,7 +1261,7 @@ symbol, not word, as I need this for programming the most." (bind-key "C-)" #'sp-forward-slurp-sexp sp-keymap) (bind-key "M-" #'backward-kill-word sp-keymap) (bind-key "M-?" #'sp-convolute-sexp sp-keymap) - (bind-key "M-t" #'sp-transpose-sexp sp-keymap) + (bind-key "C-M-t" #'sp-transpose-sexp sp-keymap) (bind-key "M-r" #'sp-raise-sexp sp-keymap) (bind-key "M-s" #'sp-splice-sexp sp-keymap) (bind-key "M-S" #'sp-split-sexp sp-keymap) -- cgit 1.4.1 From 36c541555849f5c8d60824c929847e5ba6841a78 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 11 Jun 2015 17:37:41 +0200 Subject: Emacs: Update frame-title-format --- tag-emacs/emacs.d/init.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index f097b270..7d16a8cc 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1541,13 +1541,13 @@ symbol, not word, as I need this for programming the most." ;;;; Windows & Frames (setq frame-title-format - '((:eval (capitalize invocation-name)) ": " - (:eval (if (and (fboundp #'project-project-p) + '((:eval (if (and (fboundp #'projectile-project-p) (projectile-project-p)) - (projectile-project-name) - (if (buffer-file-name) - (abbreviate-file-name (buffer-file-name)) - "%b"))))) + (projectile-project-name))) + ": " + (:eval (if (buffer-file-name) + (buffer-name) + "%b")))) (setq scroll-conservatively 100 ; Keep the cursor position when scrolling scroll-margin 1 -- cgit 1.4.1 From d4b0fd75e2025156375f4535aa802447a375d504 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 12 Jun 2015 14:42:17 +0200 Subject: Emacs: Sort cask file --- tag-emacs/emacs.d/Cask | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 83315c08..beea0cf9 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -4,8 +4,8 @@ (source melpa-stable) (source org) -(depends-on "ace-window") (depends-on "ace-jump-buffer") +(depends-on "ace-window") (depends-on "ag") (depends-on "async") (depends-on "auto-compile") -- cgit 1.4.1 From 0f6186dfd2369dd8df402736ea2e53f88961c24c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 14 Jun 2015 13:04:37 +0200 Subject: zsh: Alias gpg when gpg2 is installed --- tag-zsh/config/zsh/zshrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 9c9f36aa..22c5458c 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -258,6 +258,11 @@ alias lsr="${ls} -tld *(m-2)" # mtime < -2days alias sf="app/console" alias pping="prettyping.sh" +if [[ -z $commands[gpg] && -s $commands[gpg2] ]] +then + alias gpg=gpg2 +fi + alias trans="transmission-remote transmission.home" alias bitcoin="bitcoind" alias su="smart_sudo " -- cgit 1.4.1 From 65cfbdd4ad7792e8b62c60158c9d498c309be909 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 16 Jun 2015 12:45:48 +0200 Subject: Git: Always auto-squash with rebase --- tag-git/config/git/config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-git/config/git/config b/tag-git/config/git/config index 92e501c3..5fb9f1b5 100644 --- a/tag-git/config/git/config +++ b/tag-git/config/git/config @@ -26,3 +26,5 @@ path = config.local [core] excludesfile = ~/.config/git/ignore +[rebase] + autosquash = true -- cgit 1.4.1 From b739f3f4f0a51f0656519a58c52c18909f73e46a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 17 Jun 2015 12:05:01 +0200 Subject: Emacs: Update magit configuration for 1.4.0 --- tag-emacs/emacs.d/init.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 7d16a8cc..73500620 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1051,7 +1051,9 @@ mouse-1: Display Line and Column Mode Menu")))))) (req-package magit :diminish magit-auto-revert-mode :commands (magit-status) - :config (rename-modeline magit-status-mode (char-to-string (-find #'char-displayable-p '(11942 5848 177)))) + :config (rename-modeline magit-status-mode (char-to-string (-find #'char-displayable-p '(11942 5848 177))) + (setq magit-last-seen-setup-instructions "1.4.0" + magit-auto-revert-mode t)) :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) ;;;; Spelling -- cgit 1.4.1 From e02cc4654d04b7efd5232c23c26a96aff2997b0c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 21 Jun 2015 11:28:53 +0200 Subject: zsh: Use gpg-agent instead of envoy --- tag-zsh/config/zsh/zshenv | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index c23be400..95377c1a 100755 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -66,8 +66,14 @@ then eval "$(direnv hook zsh)" fi -if [[ $os == gnu && ! -S $SSH_AUTH_SOCK && -s $commands[envoy] ]] +if [[ -s $commands[gpg-agent ]]] then - envoy -t gpg-agent - eval $(envoy -p) + envfile="$HOME/.gnupg/gpg-agent.env" + if [[ -e "$envfile" ]] && kill -0 $(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2) 2>/dev/null; then + eval "$(cat "$envfile")" + else + eval "$(gpg-agent --daemon --enable-ssh-support --write-env-file "$envfile")" + fi + export GPG_AGENT_INFO # the env file does not contain the export statement + export SSH_AUTH_SOCK # enable gpg-agent for ssh fi -- cgit 1.4.1 From 99e2d7be633ce4b6ef3517b9aded303b3b71c07f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 21 Jun 2015 13:07:53 +0200 Subject: Emacs: Optimise startup --- tag-emacs/emacs.d/init.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 73500620..90bc8117 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -48,6 +48,7 @@ (require 'req-package) (setq use-package-verbose t) (req-package pallet + :defer 5 :config (pallet-mode 1)) (req-package paradox @@ -290,6 +291,7 @@ (put 'dired-find-alternate-file 'disabled nil))) (req-package dired-k + :require dired :init (progn (add-hook 'dired-initial-position-hook #'dired-k)) :config (progn @@ -945,6 +947,7 @@ mouse-1: Display Line and Column Mode Menu")))))) (setq go-projectile-switch-gopath 'maybe))) (req-package ggtags + :commands turn-on-ggtags-mode :config (progn (bind-key "q" #'ggtags-navigation-mode-abort ggtags-navigation-mode-map)) :init (progn @@ -974,6 +977,7 @@ mouse-1: Display Line and Column Mode Menu")))))) ;;;; Projects (req-package dash + :demand t :init (setq dash-enable-fontlock t) :config (progn (dash--enable-fontlock 'dash-enable-font-lock t))) @@ -1030,9 +1034,9 @@ mouse-1: Display Line and Column Mode Menu")))))) (req-package editorconfig) (req-package perspective - :demand t :bind (("s-p" . persp-switch)) - :config (persp-mode)) + :init (progn + (add-hook 'projectile-switch-project-hook #'persp-mode))) (req-package persp-projectile :require (projectile perspective)) @@ -1223,6 +1227,7 @@ symbol, not word, as I need this for programming the most." (bind-key "C-=" #'helm-multi-swoop-all-from-helm-swoop))) (req-package multiple-cursors + :defer 1 :config (progn (bind-key "C-." #'mc/mark-next-like-this) (bind-key "C-," #'mc/mark-previous-like-this) @@ -1452,6 +1457,7 @@ symbol, not word, as I need this for programming the most." (add-hook restclient-mode-hook #'imenu-restclient-sections))) (req-package tern + :commands ap/enable-tern :config (progn (setq tern-command (list (executable-find "tern"))) (defun ap/enable-tern () -- cgit 1.4.1 From a0a5bbc8783e4895b7afc60d141ff8e2644cd612 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 23 Jun 2015 16:19:11 +0200 Subject: zsh: Fix syntax error --- tag-zsh/config/zsh/zshenv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index 95377c1a..1558855c 100755 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -66,7 +66,7 @@ then eval "$(direnv hook zsh)" fi -if [[ -s $commands[gpg-agent ]]] +if [[ -s $commands[gpg-agent] ]] then envfile="$HOME/.gnupg/gpg-agent.env" if [[ -e "$envfile" ]] && kill -0 $(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2) 2>/dev/null; then -- cgit 1.4.1 From fb9985390e05c26d9e456b75d7b9996663101a2f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 23 Jun 2015 16:19:24 +0200 Subject: Don’t try to run gpg-agent on OSX GPGTools handles this for us, without a warning --- tag-zsh/config/zsh/zshenv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index 1558855c..c48707ab 100755 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -66,7 +66,7 @@ then eval "$(direnv hook zsh)" fi -if [[ -s $commands[gpg-agent] ]] +if [[ -s $commands[gpg-agent] && $os != "osx" ]] then envfile="$HOME/.gnupg/gpg-agent.env" if [[ -e "$envfile" ]] && kill -0 $(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2) 2>/dev/null; then -- cgit 1.4.1 From ff50e98f80c2fc861ad3968f2cc40397b902dc66 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 1 Jul 2015 12:20:07 +0200 Subject: Emacs: Fix missing perspectives --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 90bc8117..d1e71651 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1036,7 +1036,7 @@ mouse-1: Display Line and Column Mode Menu")))))) (req-package perspective :bind (("s-p" . persp-switch)) :init (progn - (add-hook 'projectile-switch-project-hook #'persp-mode))) + (persp-mode))) (req-package persp-projectile :require (projectile perspective)) -- cgit 1.4.1 From 02847eb44ff921efe2a62a20b478822075bee951 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 2 Jul 2015 09:00:51 +0200 Subject: Emacs: Set ido-vertical keybinds --- tag-emacs/emacs.d/init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index d1e71651..ba4ce1d3 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -647,8 +647,8 @@ " [Too big]" " [Confirm]" "\n❯ " - "" - ))) + "") + ido-vertical-define-keys 'C-n-C-p-up-down-left-right)) :config (ido-vertical-mode 1)) (req-package flx-ido -- cgit 1.4.1 From 331196b3821f5d5a240ba300478c24119bdb1b53 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 2 Jul 2015 09:02:53 +0200 Subject: Emacs: Use ido in magit --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index ba4ce1d3..f94e3e28 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1057,7 +1057,8 @@ mouse-1: Display Line and Column Mode Menu")))))) :commands (magit-status) :config (rename-modeline magit-status-mode (char-to-string (-find #'char-displayable-p '(11942 5848 177))) (setq magit-last-seen-setup-instructions "1.4.0" - magit-auto-revert-mode t)) + magit-auto-revert-mode t + magit-completing-read-function #'magit-ido-completing-read)) :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) ;;;; Spelling -- cgit 1.4.1 From 90fac9da73f254af75379ee3e56a01bce49a83a5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 3 Jul 2015 18:21:57 +0200 Subject: Update magit --- tag-emacs/emacs.d/Cask | 2 -- tag-emacs/emacs.d/init.el | 8 +++----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index beea0cf9..02d9b3f5 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -48,8 +48,6 @@ (depends-on "ggtags") (depends-on "gh") (depends-on "gist") -(depends-on "git-commit-mode") -(depends-on "git-rebase-mode") (depends-on "git-timemachine") (depends-on "go-eldoc") (depends-on "go-mode") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index f94e3e28..2d036bb4 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1053,12 +1053,10 @@ mouse-1: Display Line and Column Mode Menu")))))) (add-hook 'magit-refresh-file-buffer-hook #'diff-hl-update))) (req-package magit - :diminish magit-auto-revert-mode :commands (magit-status) - :config (rename-modeline magit-status-mode (char-to-string (-find #'char-displayable-p '(11942 5848 177))) - (setq magit-last-seen-setup-instructions "1.4.0" - magit-auto-revert-mode t - magit-completing-read-function #'magit-ido-completing-read)) + :config (progn (rename-modeline magit-status-mode (char-to-string (-find #'char-displayable-p '(11942 5848 177)))) + (setq magit-last-seen-setup-instructions "1.4.0" + magit-completing-read-function #'magit-ido-completing-read)) :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) ;;;; Spelling -- cgit 1.4.1 From 39bdfb8c26403446137c2dfcad0d78f06d4f388a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 3 Jul 2015 21:57:24 +0200 Subject: Emacs: Remove editorconfig --- tag-emacs/emacs.d/Cask | 1 - tag-emacs/emacs.d/init.el | 2 -- 2 files changed, 3 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index beea0cf9..65f05b98 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -31,7 +31,6 @@ (depends-on "dired-subtree") (depends-on "discover") (depends-on "discover-my-major") -(depends-on "editorconfig") (depends-on "elisp-slime-nav") (depends-on "emmet-mode") (depends-on "epl") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 90bc8117..d5fd6af1 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1031,8 +1031,6 @@ mouse-1: Display Line and Column Mode Menu")))))) :require projectile :bind (("s-z" . projector-open-project-shell))) -(req-package editorconfig) - (req-package perspective :bind (("s-p" . persp-switch)) :init (progn -- cgit 1.4.1 From db8d9d7dd9b8f5ade683527347cb71719c8a5d15 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 8 Jul 2015 12:36:37 +0200 Subject: Emacs: Remove unused virtual-buffers setting --- tag-emacs/emacs.d/init.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 2d036bb4..1a1acbb7 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -588,8 +588,7 @@ :bind (("C-x i" . helm-semantic-or-imenu)) :config (progn (setq helm-idle-delay .1 - helm-input-idle-delay 0 - ido-use-virtual-buffers t) + helm-input-idle-delay 0) (when (fboundp #'helm-adaptive-mode) (helm-adaptive-mode 1)))) -- cgit 1.4.1 From 95988279938369fa3bcb5f81ad7af40424c54b08 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 8 Jul 2015 12:36:54 +0200 Subject: Emacs: Install ido-completing-read+ for magit --- tag-emacs/emacs.d/Cask | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 02d9b3f5..958ac99c 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -62,6 +62,7 @@ (depends-on "help-fns+") (depends-on "hemisu-theme") (depends-on "highlight-stages") +(depends-on "ido-completing-read+") (depends-on "ido-vertical-mode") (depends-on "jinja2-mode") (depends-on "jquery-doc") -- cgit 1.4.1 From 7470476450164f188dbac5823506b28c519b6cd3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 8 Jul 2015 12:37:11 +0200 Subject: Emacs: Install csv-mode --- tag-emacs/emacs.d/Cask | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 958ac99c..38c6f70e 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -20,6 +20,7 @@ (depends-on "company") (depends-on "company-go") (depends-on "company-tern") +(depends-on "csv-mode") (depends-on "dash") (depends-on "dash-functional") (depends-on "deferred") -- cgit 1.4.1 From 390c49918d250d87b61f4d9dd9d7d48c9b3871af Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 8 Jul 2015 12:41:19 +0200 Subject: Emacs: Configure fallback for ido-completing-read+ --- tag-emacs/emacs.d/init.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 1a1acbb7..ba682367 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -622,6 +622,12 @@ (ido-initiate-auto-merge (current-buffer))) (bind-key "C-c C-s" #'ido-manual-merge ido-file-dir-completion-map))) +(req-package ido-completing-read+ + :require ido + :config (progn + (setq ido-cr+-fallback-function #'helm-completing-read + ido-cr+-max-items 2000))) + (defun ap/ido-projectile-switch-buffer-dwim (force-ido) (interactive "p") (if (and (projectile-project-p) (eq force-ido 1)) -- cgit 1.4.1 From b043a43951bdf78ab5bd0fd866ead33ca73ad711 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 8 Jul 2015 14:28:13 +0200 Subject: Replace typo-mode with typopunct-mode Typopunct-mode works better with multiple-cursors. --- tag-emacs/emacs.d/Cask | 2 +- tag-emacs/emacs.d/init.el | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 38c6f70e..f4bb273d 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -125,7 +125,7 @@ (depends-on "tern") (depends-on "toml-mode") (depends-on "tup-mode") -(depends-on "typo") +(depends-on "typopunct") (depends-on "undo-tree") (depends-on "use-package") (depends-on "visual-regexp") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index ba682367..da0786ed 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1171,10 +1171,10 @@ symbol, not word, as I need this for programming the most." :bind (("M-z" . zap-up-to-char) ("M-Z" . zap-to-char))) -(req-package typo +(req-package typopunct :init (progn - (typo-global-mode t) - (add-hook 'text-mode-hook 'typo-mode))) + (typopunct-change-language 'english t) + (add-hook 'text-mode-hook #'typopunct-mode))) (req-package ap-functions :commands (ap/remove-extra-cr) -- cgit 1.4.1 From f666adee888c628261dbf0c54dd1d7b4b27b3940 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 8 Jul 2015 14:30:50 +0200 Subject: Remove obsolete paredit-cedit patch --- tag-emacs/emacs.d/init.el | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index da0786ed..0f7c8862 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1249,11 +1249,6 @@ symbol, not word, as I need this for programming the most." (req-package paredit :diminish "()" :commands (paredit-mode) - :config (progn - (defun ap/cedit-space-delimiter-p (endp delimiter) - "Don't insert a space before delimiters in c-style modes" - (not cedit-mode)) - (add-to-list 'paredit-space-for-delimiter-predicates #'ap/cedit-space-delimiter-p)) :init (progn (add-hook 'lisp-mode-common-hook #'enable-paredit-mode) (put #'paredit-forward-delete 'delete-selection 'supersede) -- cgit 1.4.1 From 40719220d3258928c2fb6e742c9facb318d4d09d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 8 Jul 2015 14:39:52 +0200 Subject: Emacs: Add extra configuration for typopunct-mode --- tag-emacs/emacs.d/init.el | 68 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 0f7c8862..a407ecc3 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1172,6 +1172,74 @@ symbol, not word, as I need this for programming the most." ("M-Z" . zap-to-char))) (req-package typopunct + :config (progn + (defconst typopunct-minus (decode-char 'ucs #x2212)) + (defadvice typopunct-insert-typographical-dashes + (around minus-or-pm activate) + (cond + ((or (eq (char-before) typopunct-em-dash) + (looking-back "\\([[:blank:]]\\|^\\)\\^")) + (delete-char -1) + (insert typopunct-minus)) + ((looking-back "[^[:blank:]]\\^") + (insert typopunct-minus)) + (t ad-do-it))) + (define-key typopunct-map "+" 'typopunct-insert-mp) + + (defconst typopunct-ellipsis (decode-char 'ucs #x2026)) + (defconst typopunct-middot (decode-char 'ucs #xB7)) ; or 2219 + (defun typopunct-insert-ellipsis-or-middot (arg) + "Change three consecutive dots to a typographical ellipsis mark." + (interactive "p") + (cond + ((and (= 1 arg) + (eq (char-before) ?^)) + (delete-char -1) + (insert typopunct-middot)) + ((and (= 1 arg) + (eq this-command last-command) + (looking-back "\\.\\.")) + (replace-match "") + (insert typopunct-ellipsis)) + (t + (self-insert-command arg)))) + (define-key typopunct-map "." 'typopunct-insert-ellipsis-or-middot) + + (defconst typopunct-times (decode-char 'ucs #xD7)) + (defun typopunct-insert-times (arg) + (interactive "p") + (if (and (= 1 arg) (looking-back "\\([[:blank:]]\\|^\\)\\^")) + (progn (delete-char -1) + (insert typopunct-times)) + (self-insert-command arg))) + (define-key typopunct-map "x" 'typopunct-insert-times) + + (defadvice typopunct-insert-quotation-mark (around wrap-region activate) + (let* ((lang (or (get-text-property (point) 'typopunct-language) + typopunct-buffer-language)) + (omark (if single + (typopunct-opening-single-quotation-mark lang) + (typopunct-opening-quotation-mark lang))) + (qmark (if single + (typopunct-closing-single-quotation-mark lang) + (typopunct-closing-quotation-mark lang)))) + (cond + (mark-active + (let ((skeleton-end-newline nil) + (singleo (typopunct-opening-single-quotation-mark lang)) + (singleq (typopunct-closing-single-quotation-mark lang))) + (if (> (point) (mark)) + (exchange-point-and-mark)) + (save-excursion + (while (re-search-forward (regexp-quote (string omark)) (mark) t) + (replace-match (regexp-quote (string singleo)) nil nil))) + (save-excursion + (while (re-search-forward (regexp-quote (string qmark)) (mark) t) + (replace-match (regexp-quote (string singleq)) nil nil))) + (skeleton-insert (list nil omark '_ qmark) -1))) + ((looking-at (regexp-opt (list (string omark) (string qmark)))) + (forward-char 1)) + (t ad-do-it))))) :init (progn (typopunct-change-language 'english t) (add-hook 'text-mode-hook #'typopunct-mode))) -- cgit 1.4.1 From 707417bafeb518ffd2fa3e107bff6db1340e8365 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 Jul 2015 09:11:51 +0200 Subject: Emacs: Change typopunct language after loading --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index d5231076..f8bed307 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1171,6 +1171,7 @@ symbol, not word, as I need this for programming the most." (req-package typopunct :config (progn + (typopunct-change-language 'english t) (defconst typopunct-minus (decode-char 'ucs #x2212)) (defadvice typopunct-insert-typographical-dashes (around minus-or-pm activate) @@ -1239,7 +1240,6 @@ symbol, not word, as I need this for programming the most." (forward-char 1)) (t ad-do-it))))) :init (progn - (typopunct-change-language 'english t) (add-hook 'text-mode-hook #'typopunct-mode))) (req-package ap-functions -- cgit 1.4.1 From 5ea84bf40ef65e73dfdb58442f79ebc1990b0ccd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 Jul 2015 09:13:34 +0200 Subject: Emacs: Remove unused php-electric.el --- tag-emacs/emacs.d/elisp/php-electric.el | 218 -------------------------------- 1 file changed, 218 deletions(-) delete mode 100644 tag-emacs/emacs.d/elisp/php-electric.el diff --git a/tag-emacs/emacs.d/elisp/php-electric.el b/tag-emacs/emacs.d/elisp/php-electric.el deleted file mode 100644 index 599b2b1d..00000000 --- a/tag-emacs/emacs.d/elisp/php-electric.el +++ /dev/null @@ -1,218 +0,0 @@ -;; -*- Emacs-Lisp -*- -;; -;; php-electric.el --- electric submode for the php-mode -;; -;; Version: 1.0 -;; Release-Date: Sunday 04 March 2007 -;; -;; Copyright (C) 2007 -;; by Nikolay V. Nemshilov aka St. -;; -;; -;; License -;; -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License -;; as published by the Free Software Foundation; either version 2 -;; of the License, or (at your option) any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this program; if not, write to the Free Software -;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -;; -;; -;; Features: -;; * autocompletion of the language contructions -;; such as if, for, foreach, etc blocks, -;; -;; * autocompletion of classes, interfaces and functions -;; definitions -;; -;; * autocompletion of the paired symbols, like [], (), "",'' -;; -;; -;; Usage: -;; Nothing magical, just place the file in a directory where -;; Emacs can find it, and write -;; -;; (require 'php-electric) -;; -;; in your configuration files ~/.emacs or wherever you keep it. -;; Then you can switch on/off the mode by the following command -;; -;; M-x php-electric-mode -;; -;; If you like to have it switched on automatically, you should -;; put the command in your php-mode hook or create new one, -;; like that -;; -;; (add-hook 'php-mode-hook '(lambda () (php-electric-mode))) -;; -;; That's it. -;; -;; -;; Changelog: -;; Sunday 04 March 2007 -;; The first version 1.0 has been came out. -;; - -(defgroup php-electric nil - "Minor php-electric mode" - :group 'php) - -;; list of keywords which expandible by the {} pair -(defconst php-electric-expandible-simple-re - "\\(try\\|else\\|do\\)") - -;; list of keywords which expandible with the (){} construction -(defconst php-electric-expandible-as-struct-re - "\\(while\\|for\\|foreach\\|if\\|elseif\\|catch\\)") - -;; list of keywords which expandible with the name(){} construction -(defconst php-electric-expandible-as-func-re - "\\(function\\)") - -;; list of keywords which expandible with the name{} construction -(defconst php-electric-expandible-as-class-re - "\\(class\\|interface\\)") - -;; list of the paired chars -(defvar php-electric-matching-delimeter-alist - '((?\[ . ?\]) - (?\( . ?\)) - (?\" . ?\") - (?\' . ?\'))) - -;; the minor-mode definition -(define-minor-mode php-electric-mode - "Minor electric-mode for the php-mode" - nil - "-El" - php-mode-map - (php-electric-keymap)) - -;; list of accessible keys -(defun php-electric-keymap() - (define-key php-mode-map " " 'php-electric-space) - (define-key php-mode-map "{" 'php-electric-curlies) - (define-key php-mode-map "(" 'php-electric-brackets) - (define-key php-mode-map "[" 'php-electric-matching-char) - (define-key php-mode-map "\"" 'php-electric-matching-char) - (define-key php-mode-map "\'" 'php-electric-matching-char)) - -;; handler for the spaces insertions -(defun php-electric-space(arg) - (interactive "P") - (self-insert-command (prefix-numeric-value arg)) - (if (php-electric-is-code-at-point-p) - (if (php-electric-line-is-simple-expandible) - ;; inserting just a pair of curleis - (progn - (insert "{")(php-electric-insert-new-line-and-statement-end)) - (if (php-electric-line-is-expandible-as-struct) - ;; inserting a structure definition - (progn - (if (not (char-equal ?\( (preceding-char))) - ;; cmd () { - style construction - (progn - (insert "(")(set-register 98 (point-marker))(insert ") {")) - - ;; cmd( ){ - style construction - (progn - (insert " ")(set-register 98 (point-marker))(insert " ){"))) - (php-electric-insert-new-line-and-statement-end) - (jump-to-register 98)(set-register 98 nil)) - (if (php-electric-line-is-expandible-as-func) - ;; inserting the function expanding - (save-excursion - (insert "(){")(php-electric-insert-new-line-and-statement-end)) - (if (php-electric-line-is-expandible-as-class) - ;; inserting the class expanding - (save-excursion - (insert "{")(php-electric-insert-new-line-and-statement-end)))))))) - -;; handler for the { chars -(defun php-electric-curlies(arg) - (interactive "P") - (self-insert-command (prefix-numeric-value arg)) - (if (php-electric-is-code-at-point-p) - (progn - (php-electric-insert-new-line-and-statement-end)))) - -;; handler for the ( chars -(defun php-electric-brackets(arg) - (interactive "P") - - (if (php-electric-is-code-at-point-p) - ;; checking if it's a statement - (if (php-electric-line-is-expandible-as-struct) - (progn (php-electric-space arg)) - (progn (php-electric-matching-char arg))) - (self-insert-command (prefix-numeric-value arg)))) - -;; handler for the paired chars, [], (), "", '' -(defun php-electric-matching-char(arg) - (interactive "P") - (self-insert-command (prefix-numeric-value arg)) - (if (php-electric-is-code-at-point-p) - (save-excursion - (insert (cdr (assoc last-command-char - php-electric-matching-delimeter-alist)))))) - -;; checks if the current pointer situated in a piece of code -(defun php-electric-is-code-at-point-p() - (and php-electric-mode - (let* ((properties (text-properties-at (point)))) - (and (null (memq 'font-lock-string-face properties)) - (null (memq 'font-lock-comment-face properties)))))) - -;; checks if the current line expandible with a simple {} construction -(defun php-electric-line-is-simple-expandible() - (let* ((php-electric-expandible-simple-real-re - (concat php-electric-expandible-simple-re "\\s-$"))) - (save-excursion - (backward-word 1) - (looking-at php-electric-expandible-simple-real-re)))) - -;; checks if the current line expandible with the (){} construction -(defun php-electric-line-is-expandible-as-struct() - (let* ((php-electric-expandible-as-struct-real-re - (concat php-electric-expandible-as-struct-re "[ ]*$")) - (php-electric-expandible-as-struct-with-bracket-re - (concat php-electric-expandible-as-struct-re "($"))) - (save-excursion - (backward-word 1) - (or (looking-at php-electric-expandible-as-struct-real-re) - (looking-at php-electric-expandible-as-struct-with-bracket-re))))) - -;; checks if the current line expandible with the name(){} construction -(defun php-electric-line-is-expandible-as-func() - (let* ((php-electric-expandible-as-func-real-re - (concat php-electric-expandible-as-func-re "\\s-$"))) - (save-excursion - (backward-word 1) - (looking-at php-electric-expandible-as-func-real-re)))) - -;; checks if the current line expandible with the name{} construction -(defun php-electric-line-is-expandible-as-class() - (let* ((php-electric-expandible-as-class-real-re - (concat php-electric-expandible-as-class-re "\\s-$"))) - (save-excursion - (backward-word 1) - (looking-at php-electric-expandible-as-class-real-re)))) - -;; "shortcut" to insert \n} construction -(defun php-electric-insert-new-line-and-statement-end() - (newline-and-indent)(set-register 99 (point-marker)) - (insert "\n}")(indent-according-to-mode) - (jump-to-register 99)(set-register 99 nil)) - - -(provide 'php-electric) - -;; end of the file \ No newline at end of file -- cgit 1.4.1 From 7483dc612cd62d2dcd1b59128a42bee449b542e0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 Jul 2015 09:21:46 +0200 Subject: Emacs: Remove bind to missing function --- tag-emacs/emacs.d/init.el | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index f8bed307..7ab491e6 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -1183,7 +1183,6 @@ symbol, not word, as I need this for programming the most." ((looking-back "[^[:blank:]]\\^") (insert typopunct-minus)) (t ad-do-it))) - (define-key typopunct-map "+" 'typopunct-insert-mp) (defconst typopunct-ellipsis (decode-char 'ucs #x2026)) (defconst typopunct-middot (decode-char 'ucs #xB7)) ; or 2219 -- cgit 1.4.1 From 5d76f0e8fdbe8447ca0078d7438a79090bd89430 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 Jul 2015 11:26:50 +0200 Subject: Emacs: Enable auto-fill-mode in org --- tag-emacs/emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 7ab491e6..d51638dc 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -880,6 +880,7 @@ mouse-1: Display Line and Column Mode Menu")))))) (sequence "TOLEARN" "LEARNING" "LEARNED" "|" "MASTERED") (sequence "|" "CANCELLED"))) (set-register ?o `(file . ,(expand-file-name "organiser.org" org-directory))) + (add-hook 'org-mode-hook #'turn-on-auto-fill) (defadvice org-clock-in (after wicked activate) "Mark STARTED when clocked in" (save-excursion -- cgit 1.4.1 From 40029783e5f8ad0edf4dc07803a4fd56660d6dc1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 Jul 2015 11:27:02 +0200 Subject: Emacs: Fontify src blocks in org-mode --- tag-emacs/emacs.d/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index d51638dc..1f8651ae 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -870,6 +870,8 @@ mouse-1: Display Line and Column Mode Menu")))))) org-table-duration-custom-format 'seconds + org-src-fontify-natively t + org-export-have-math t org-blank-before-new-entry '((heading . t) -- cgit 1.4.1 From 47772f8899bee6bd96273c12008a45f9d0fa672b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 Jul 2015 15:43:34 +0200 Subject: Emacs: Improve org-mode startup time --- tag-emacs/emacs.d/init.el | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 1f8651ae..8d56497c 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -847,11 +847,6 @@ mouse-1: Display Line and Column Mode Menu")))))) org-default-notes-file (concat org-directory "/notes") - ;; Fewer asterisks, doesn't change indentation - org-hide-leading-stars t - - org-startup-indented t - ;; ‘Remember’: new items at top org-reverse-note-order t -- cgit 1.4.1 From fd343aa3591c09e54b9212c91d81a84dd6ab6981 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 Jul 2015 15:43:45 +0200 Subject: Emacs: Enable sh blocks in org-babel --- tag-emacs/emacs.d/init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 8d56497c..a2c8c605 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -892,7 +892,8 @@ mouse-1: Display Line and Column Mode Menu")))))) :defer t :config (org-babel-do-load-languages 'org-babel-load-languages - '((ledger . t)))) + '((ledger . t) + (sh . t)))) (req-package org-journal :require org -- cgit 1.4.1 From e6b57d1131f4734871429b7ffdaab77b424a3252 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 Jul 2015 16:00:28 +0200 Subject: Emacs: Remove paradox --- tag-emacs/emacs.d/Cask | 1 - tag-emacs/emacs.d/init.el | 5 ----- 2 files changed, 6 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 398b412d..ad31376d 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -89,7 +89,6 @@ (depends-on "package-build") (depends-on "packed") (depends-on "pallet") -(depends-on "paradox") (depends-on "paredit") (depends-on "password-store") (depends-on "pcache") diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index a2c8c605..5c881b7e 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -51,11 +51,6 @@ :defer 5 :config (pallet-mode 1)) -(req-package paradox - :defer t - :config (progn - (setq paradox-automatically-star nil))) - (if (not (fboundp #'package-desc-archive)) (defsubst package-desc-archive (desc) (aref desc (1- (length desc))))) -- cgit 1.4.1 From ecb9eb5b91727b0222069bdf250ada64ea6e644d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 Jul 2015 16:02:33 +0200 Subject: Emacs: Remove package stats functions I don’t really care about these any more --- tag-emacs/emacs.d/init.el | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index 5c881b7e..f11336aa 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -51,40 +51,6 @@ :defer 5 :config (pallet-mode 1)) -(if (not (fboundp #'package-desc-archive)) - (defsubst package-desc-archive (desc) - (aref desc (1- (length desc))))) - -(defun package-list-installed () - (loop for pkg in package-activated-list - collect (assq pkg package-archive-contents))) - -(defun package-archive-stats () - (let ((archives (make-hash-table)) - (assoc '())) - (dolist (arc package-archives) - (puthash (car arc) 0 archives)) - (maphash (lambda (k v) - (setq assoc (cons (cons k v) assoc))) - (dolist (pkg (-filter #'identity (package-list-installed)) archives) - (let ((pkg-arc (package-desc-archive (cdr pkg)))) - (incf (gethash pkg-arc archives))))) - assoc)) - -(defun package-show-installed-from-archive (archive) - (interactive (list (helm-comp-read "Archive: " (mapcar #'car package-archives) - :must-match t))) - (let ((from-arc (mapcar #'car - (--filter (equalp (package-desc-archive (cdr it)) archive) - (package-list-installed))))) - (if (called-interactively-p 'any) - (message "%s" from-arc) - from-arc))) - -(defun package-show-archive-stats () - (interactive) - (message "%s" (package-archive-stats))) - ;;;; Style (req-package whitespace -- cgit 1.4.1 From 5cdf7c8622b18e5ed82686770d6af5611b486b12 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 Jul 2015 16:56:36 +0200 Subject: Emacs: Use cask to install xrdb-mode --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/elisp/xrdb-mode.el | 544 ----------------------------------- 2 files changed, 1 insertion(+), 544 deletions(-) delete mode 100644 tag-emacs/emacs.d/elisp/xrdb-mode.el diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index ad31376d..3eb510bf 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -132,5 +132,6 @@ (depends-on "wgrep-ag") (depends-on "wgrep-pt") (depends-on "ws-butler") +(depends-on "xrdb-mode" :git "git://github.com/emacsmirror/xrdb-mode") (depends-on "yaml-mode") (depends-on "yasnippet") diff --git a/tag-emacs/emacs.d/elisp/xrdb-mode.el b/tag-emacs/emacs.d/elisp/xrdb-mode.el deleted file mode 100644 index 712f0cbf..00000000 --- a/tag-emacs/emacs.d/elisp/xrdb-mode.el +++ /dev/null @@ -1,544 +0,0 @@ -;;; xrdb-mode.el --- mode for editing X resource database files - -;; Copyright (C) 1998,1999,2000 Free Software Foundation, Inc. - -;; Author: 1994-2003 Barry A. Warsaw -;; Maintainer: barry@python.org -;; Created: May 1994 -;; Keywords: data languages - -(defconst xrdb-version "2.31" - "`xrdb-mode' version number.") - -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License -;; as published by the Free Software Foundation; either version 2 -;; of the License, or (at your option) any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this program; if not, write to the Free Software -;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -;;; Commentary: -;; -;; This file provides a major mode for editing X resource database -;; files. It includes font-lock definitions and commands for -;; controlling indentation, re-indenting by subdivisions, and loading -;; and merging into the the resource database. -;; -;; To use, put the following in your .emacs: -;; -;; (autoload 'xrdb-mode "xrdb-mode" "Mode for editing X resource files" t) -;; -;; You may also want something like: -;; -;; (setq auto-mode-alist -;; (append '(("\\.Xdefaults$" . xrdb-mode) -;; ("\\.Xenvironment$" . xrdb-mode) -;; ("\\.Xresources$" . xrdb-mode) -;; ("*.\\.ad$" . xrdb-mode) -;; ) -;; auto-mode-alist)) - -;;; Credits: -;; -;; The database merge feature was inspired by Joel N. Weber II. -;; -;; The canonical Web site for xrdb-mode is -;; - -;;; Code: -(require 'custom) - - - -(defgroup xrdb nil - "Support for editing X resource database files" - :group 'languages) - -(defcustom xrdb-mode-hook nil - "*Hook to be run when `xrdb-mode' is entered." - :type 'hook - :group 'xrdb) - -(defcustom xrdb-subdivide-by 'paragraph - "*Default alignment subdivision when re-indenting a region or buffer. -This variable controls how much of the buffer is searched to find a -goal column on which to align. Every non-comment line in the region -defined by this variable is scanned for the first `:' character on the -line, and this character's column is the line's goal column. The -rightmost line goal column in the region is taken as the region's goal -column. - -This variable can take one of the following symbol values: - - `buffer' - All lines in the buffer are scanned. This is the - slowest option. - - `paragraph' - All lines in the paragraph are scanned. Paragraphs - are delimited by blank lines, comment lines, and page - delimiters. - - `page' - All lines in the page are scanned. Pages are delimited - with `page-delimiter', usually ^L (control-L). - - `line' - Only the previous non-comment line is scanned. This is - the fastest method. - -This variable is used by the various indentation commands, and can be -overridden in those commands by using \\[universal-argument]." - :type '(radio (const :tag "Do not subdivide buffer" buffer) - (const :tag "Subdivide by paragraphs" paragraph) - (const :tag "Subdivide by pages" page) - (const :tag "Each line is independent" line)) - :group 'xrdb) - -(defcustom xrdb-compress-whitespace nil - "*Collapse all whitespace to a single space after insertion of `:'." - :type 'boolean - :group 'xrdb) - -(defcustom xrdb-program "xrdb" - "*Program to run to load or merge resources in the X resource database." - :type 'string - :group 'xrdb) - -(defcustom xrdb-program-args '("-merge") - "*List of string arguments to pass to `xrdb-program'." - :type '(repeat string) - :group 'xrdb) - -(defvar xrdb-master-file nil - "If non-nil, merge in the named file instead of the buffer's file. -The intent is to allow you to set this variable in the file's local -variable section, e.g.: - - ! Local Variables: - ! xrdb-master-file: \"Xdefaults\" - ! End: - -so that typing \\[xrdb-database-merge-buffer-or-region] in that buffer -merges the named master file instead of the buffer's file. Note that -if the file name has a relative path, the `default-directory' for the -buffer is prepended to come up with a file name. - -You may also want to set `xrdb-program-args' in the local variables -section as well.") -(make-variable-buffer-local 'xrdb-master-file) - - -;; Non-user customizable -(defconst xrdb-comment-re "^[ \t]*[!]" - "Regular expression describing the beginning of a comment line.") - - - -;; utilities -(defun xrdb-point (position) - ;; Returns the value of point at certain commonly referenced POSITIONs. - ;; POSITION can be one of the following symbols: - ;; - ;; bol -- beginning of line - ;; eol -- end of line - ;; bod -- beginning of defun - ;; boi -- back to indentation - ;; ionl -- indentation of next line - ;; iopl -- indentation of previous line - ;; bonl -- beginning of next line - ;; bopl -- beginning of previous line - ;; bop -- beginning of paragraph - ;; eop -- end of paragraph - ;; bopg -- beginning of page - ;; eopg -- end of page - ;; - ;; This function does not modify point or mark. - (let ((here (point))) - (cond - ((eq position 'bod) (beginning-of-defun)) - ((eq position 'bol) (beginning-of-line)) - ((eq position 'eol) (end-of-line)) - ((eq position 'boi) (back-to-indentation)) - ((eq position 'bonl) (forward-line 1)) - ((eq position 'bopl) (forward-line -1)) - ((eq position 'bop) (forward-paragraph -1)) - ((eq position 'eop) (forward-paragraph 1)) - ((eq position 'bopg) (forward-page -1)) - ((eq position 'eopg) (forward-page 1)) - (t - (error "unknown buffer position requested: %s" position))) - (prog1 - (point) - (goto-char here)) - )) - -(defmacro xrdb-safe (&rest body) - ;; safely execute BODY, return nil if an error occurred - `( (condition-case nil - (progn (,@ body)) - (error nil)))) - -(defsubst xrdb-skip-to-separator () - ;; skip forward from the beginning of the line to the separator - ;; character as given by xrdb-separator-char. Returns t if the - ;; char was found, otherwise, nil. - (beginning-of-line) - (skip-chars-forward "^:" (xrdb-point 'eol)) - (and (eq (char-after) ?:) - (current-column))) - -(defsubst xrdb-in-comment-p (&optional lim) - (let* ((lim (or lim (xrdb-point 'bod))) - (state (parse-partial-sexp lim (point)))) - (nth 4 state))) - -(defsubst xrdb-boi-col () - (let ((here (point))) - (goto-char (xrdb-point 'boi)) - (prog1 - (current-column) - (goto-char here)))) - -(defvar xrdb-prompt-history nil) - -(defun xrdb-prompt-for-subdivision () - (let ((options '(("buffer" . buffer) - ("paragraphs" . paragraph) - ("pages" . page) - ("lines" . line))) - (completion-ignore-case t)) - (cdr (assoc - (completing-read "Subdivide alignment by? " options nil t - (cons (format "%s" xrdb-subdivide-by) 0) - 'xrdb-prompt-history) - options)))) - - -;; commands -(defun xrdb-electric-separator (arg) - "Insert a colon, and possibly indent line. -Numeric argument inserts that many separators. If the numeric -argument is not given, or is 1, and the separator is not inserted in a -comment, then the line is indented according to `xrdb-subdivide-by'." - (interactive "P") - (self-insert-command (prefix-numeric-value arg)) - ;; only do electric behavior if arg is not given - (or arg - (xrdb-in-comment-p) - (xrdb-indent-line)) - ;; compress whitespace - (and xrdb-compress-whitespace - (just-one-space))) - -(defun xrdb-electric-bang (arg) - "Insert an exclamation point to start a comment. -Numeric argument inserts that many exclamation characters. If the -numeric argument is not given, or is 1, and the bang character is the -first character on a line, the line is indented to column zero." - (interactive "P") - (let ((how-many (prefix-numeric-value arg))) - (self-insert-command how-many) - (save-excursion - (if (and (= how-many 1) - (xrdb-in-comment-p) - (memq (char-before (xrdb-point 'boi)) '(?\n nil))) - (indent-line-to 0))) - )) - - -(defun xrdb-indent-line (&optional arg) - "Align the current line according to `xrdb-subdivide-by'. -With optional \\[universal-argument], prompt for subdivision." - (interactive "P") - (xrdb-align-to-column - (xrdb-guess-goal-column (if arg - (xrdb-prompt-for-subdivision) - xrdb-subdivide-by)) - (xrdb-point 'bol) - (xrdb-point 'bonl))) - -(defun xrdb-indent-region (start end &optional arg) - "Indent all lines in the region according to `xrdb-subdivide-by'. -With optional \\[universal-argument], prompt for subdivision." - (interactive "r\nP") - (xrdb-align-to-column - (xrdb-guess-goal-column (if arg - (xrdb-prompt-for-subdivision) - xrdb-subdivide-by)) - start end)) - -(defun xrdb-indent-page (&optional arg) - "Indent all lines in the page according to `xrdb-subdivide-by'. -With optional \\[universal-argument], prompt for subdivision." - (interactive "P") - (xrdb-align-to-column - (xrdb-guess-goal-column (if arg - (xrdb-prompt-for-subdivision) - xrdb-subdivide-by)) - (xrdb-point 'bopg) - (xrdb-point 'eopg))) - -(defun xrdb-indent-paragraph (&optional arg) - "Indent all lines in the paragraph according to `xrdb-subdivide-by'. -With optional \\[universal-argument], prompt for subdivision." - (interactive "P") - (xrdb-align-to-column - (xrdb-guess-goal-column (if arg - (xrdb-prompt-for-subdivision) - xrdb-subdivide-by)) - (xrdb-point 'bop) - (xrdb-point 'eop))) - -(defun xrdb-indent-buffer (&optional arg) - "Indent all lines in the buffer according to `xrdb-subdivide-by'. -With optional \\[universal-argument], prompt for subdivision." - (interactive "P") - (let ((subdivide-by (if arg - (xrdb-prompt-for-subdivision) - xrdb-subdivide-by))) - (save-excursion - (beginning-of-buffer) - (if (eq subdivide-by 'buffer) - (xrdb-align-to-column (xrdb-guess-goal-column 'buffer) - (point-min) (point-max)) - (let (mvfwdfunc indentfunc) - (cond - ((eq subdivide-by 'paragraph) - (setq mvfwdfunc 'forward-paragraph - indentfunc 'xrdb-indent-paragraph)) - ((eq subdivide-by 'page) - (setq mvfwdfunc 'forward-page - indentfunc 'xrdb-indent-page)) - ((eq subdivide-by 'line) - (setq mvfwdfunc 'forward-line - indentfunc 'xrdb-indent-page)) - (t (error "Illegal alignment subdivision: %s" subdivide-by)) - ) - (while (< (point) (point-max)) - (funcall indentfunc) - (funcall mvfwdfunc 1)) - ))))) - - -;; internal alignment functions -(defun xrdb-align-to-column (goalcol &optional start end) - (let ((start (or start (xrdb-point 'bol))) - (end (or end (xrdb-point 'bonl)))) - (save-excursion - (save-restriction - (narrow-to-region start end) - (beginning-of-buffer) - (while (< (point) (point-max)) - (if (and (not (looking-at xrdb-comment-re)) - (xrdb-skip-to-separator)) - (indent-line-to (max 0 (+ goalcol - (- (current-column)) - (xrdb-boi-col)) - ))) - (forward-line 1)) - )))) - -(defun xrdb-guess-goal-column (subdivide-by) - ;; Returns the goal column of the current line based on SUBDIVIDE-BY, - ;; which can be any value allowed by `xrdb-subdivide-by'. - (let ((here (point)) - (goalcol 0)) - (save-restriction - (cond - ((eq subdivide-by 'line) - (while (and (zerop (forward-line -1)) - (or (looking-at xrdb-comment-re) - (not (xrdb-skip-to-separator))))) - ;; maybe we didn't find one - (if (not (xrdb-skip-to-separator)) - (goto-char here)) - (narrow-to-region (xrdb-point 'bol) (xrdb-point 'bonl))) - ((eq subdivide-by 'page) - (narrow-to-page)) - ((eq subdivide-by 'paragraph) - (narrow-to-region (xrdb-point 'bop) (xrdb-point 'eop))) - ((eq subdivide-by 'buffer)) - (t (error "Illegal alignment subdivision: %s" subdivide-by))) - (goto-char (point-min)) - (while (< (point) (point-max)) - (if (and (not (looking-at xrdb-comment-re)) - (xrdb-skip-to-separator)) - (setq goalcol (max goalcol (- (current-column) (xrdb-boi-col))))) - (forward-line 1))) - (goto-char here) - goalcol)) - - - -;; major-mode stuff -(defvar xrdb-mode-abbrev-table nil - "Abbreviation table used in `xrdb-mode' buffers.") -(define-abbrev-table 'xrdb-mode-abbrev-table ()) - - -(defvar xrdb-mode-syntax-table nil - "Syntax table used in `xrdb-mode' buffers.") -(if xrdb-mode-syntax-table - nil - (setq xrdb-mode-syntax-table (make-syntax-table)) - (modify-syntax-entry ?! "<" xrdb-mode-syntax-table) - (modify-syntax-entry ?\\ "\\" xrdb-mode-syntax-table) - (modify-syntax-entry ?\n ">" xrdb-mode-syntax-table) - (modify-syntax-entry ?/ ". 14" xrdb-mode-syntax-table) - (modify-syntax-entry ?* "_ 23" xrdb-mode-syntax-table) - (modify-syntax-entry ?. "_" xrdb-mode-syntax-table) - (modify-syntax-entry ?# "_" xrdb-mode-syntax-table) - (modify-syntax-entry ?? "_" xrdb-mode-syntax-table) - (modify-syntax-entry ?< "(" xrdb-mode-syntax-table) - (modify-syntax-entry ?> ")" xrdb-mode-syntax-table) - ) - - -(defvar xrdb-mode-map () - "Keymap used in `xrdb-mode' buffers.") -(if xrdb-mode-map - () - (setq xrdb-mode-map (make-sparse-keymap)) - ;; make the separator key electric - (define-key xrdb-mode-map ":" 'xrdb-electric-separator) - (define-key xrdb-mode-map "!" 'xrdb-electric-bang) - (define-key xrdb-mode-map "\t" 'xrdb-indent-line) - (define-key xrdb-mode-map "\C-c\C-a" 'xrdb-indent-buffer) - (define-key xrdb-mode-map "\C-c\C-b" 'xrdb-submit-bug-report) - (define-key xrdb-mode-map "\C-c\C-c" 'xrdb-database-merge-buffer-or-region) - (define-key xrdb-mode-map "\C-c\C-p" 'xrdb-indent-paragraph) - (define-key xrdb-mode-map "\C-c\[" 'xrdb-indent-page) - (define-key xrdb-mode-map "\C-c\C-r" 'xrdb-indent-region) - ) - -;;;###autoload -(defun xrdb-mode () - "Major mode for editing xrdb config files" - (interactive) - (kill-all-local-variables) - (set-syntax-table xrdb-mode-syntax-table) - (setq major-mode 'xrdb-mode - mode-name "xrdb" - local-abbrev-table xrdb-mode-abbrev-table) - (use-local-map xrdb-mode-map) - (setq font-lock-defaults '(xrdb-font-lock-keywords)) - ;; local variables - (make-local-variable 'parse-sexp-ignore-comments) - (make-local-variable 'comment-start-skip) - (make-local-variable 'comment-start) - (make-local-variable 'comment-end) - (make-local-variable 'paragraph-start) - (make-local-variable 'paragraph-separate) - (make-local-variable 'paragraph-ignore-fill-prefix) - (make-local-variable 'indent-region-function) - ;; now set their values - (setq parse-sexp-ignore-comments t - comment-start-skip "![ \t]*" - comment-start "! " - comment-end "") - (setq indent-region-function 'xrdb-indent-region - paragraph-ignore-fill-prefix t - paragraph-start (concat "^[ \t]*$\\|^[ \t]*[!]\\|" page-delimiter) - paragraph-separate paragraph-start) - (run-hooks 'xrdb-mode-hook)) - - - -;; faces and font-locking -(defvar xrdb-option-name-face 'xrdb-option-name-face - "Face for option name on a line in an X resource db file") - -(defvar xrdb-option-value-face 'xrdb-option-value-face - "Face for option value on a line in an X resource db file") - -(make-face 'xrdb-option-name-face) -(make-face 'xrdb-option-value-face) - -(defun xrdb-font-lock-mode-hook () - (or (face-differs-from-default-p 'xrdb-option-name-face) - (copy-face 'font-lock-keyword-face 'xrdb-option-name-face)) - (or (face-differs-from-default-p 'xrdb-option-value-face) - (copy-face 'font-lock-string-face 'xrdb-option-value-face)) - (remove-hook 'font-lock-mode-hook 'xrdb-font-lock-mode-hook)) -(add-hook 'font-lock-mode-hook 'xrdb-font-lock-mode-hook) - -(defvar xrdb-font-lock-keywords - (list '("^[ \t]*\\([^\n:]*:\\)[ \t]*\\(.*\\)$" - (1 xrdb-option-name-face) - (2 xrdb-option-value-face))) - "Additional expressions to highlight in X resource db mode.") -(put 'xrdb-mode 'font-lock-defaults '(xrdb-font-lock-keywords)) - - - -;; merging and manipulating the X resource database -(defun xrdb-database-merge-buffer-or-region (start end) - "Merge the current buffer's resources into the X resource database. - -`xrdb-program' is the program to actually call, with the arguments -specified in `xrdb-program-args'. This latter can be set to do either -a merge or a load, etc. Also, if the file local variable -`xrdb-master-file' is non-nil, then it is merged instead of the -buffer's file. - -If the current region is active, it is merged instead of the buffer, -and this overrides any use of `xrdb-master-file'." - (interactive - ;; the idea here is that if the region is inactive, start and end - ;; will be nil, if not passed in programmatically - (list (xrdb-safe (and (mark) (region-beginning))) - (xrdb-safe (and (mark) (region-end))))) - (message "Merging with args: %s..." xrdb-program-args) - (let ((outbuf (get-buffer-create "*Shell Command Output*"))) - ;; I prefer the XEmacs way of doing this, but this is the easiest - ;; way to work in both XEmacs and Emacs. - (with-current-buffer outbuf (erase-buffer)) - (cond - ((and start end) - (apply 'call-process-region start end xrdb-program nil outbuf t - xrdb-program-args)) - (xrdb-master-file - (apply 'call-process xrdb-program xrdb-master-file outbuf t - xrdb-program-args)) - (t - (apply 'call-process-region (point-min) (point-max) xrdb-program - nil outbuf t xrdb-program-args))) - (if (not (zerop (with-current-buffer outbuf (buffer-size)))) - (pop-to-buffer outbuf))) - (message "Merging... done")) - - - -;; submitting bug reports - -(defconst xrdb-mode-help-address "tools-help@python.org" - "Address for xrdb-mode bug reports.") - -(defun xrdb-submit-bug-report () - "Submit via mail a bug report on xrdb-mode." - (interactive) - ;; load in reporter - (require 'reporter) - (let ((reporter-prompt-for-summary-p t) - (varlist '(xrdb-subdivide-by - xrdb-mode-hook - xrdb-compress-whitespace - ))) - (and (if (y-or-n-p "Do you want to submit a report on xrdb-mode? ") - t - (message "") - nil) - (require 'reporter) - (reporter-submit-bug-report - xrdb-mode-help-address - (format "xrdb-mode %s" xrdb-version) - varlist nil nil "Dear Barry,") - ))) - - -(provide 'xrdb-mode) -;;; xrdb-mode.el ends here -- cgit 1.4.1 From 996dd62da33cb0a2eea78ba344672d5d6c34b755 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 Jul 2015 16:56:56 +0200 Subject: zsh: Disable GPG SSH support --- tag-zsh/config/zsh/zshenv | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index c48707ab..1084ede7 100755 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -72,8 +72,7 @@ then if [[ -e "$envfile" ]] && kill -0 $(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2) 2>/dev/null; then eval "$(cat "$envfile")" else - eval "$(gpg-agent --daemon --enable-ssh-support --write-env-file "$envfile")" + eval "$(gpg-agent --daemon --write-env-file "$envfile")" fi export GPG_AGENT_INFO # the env file does not contain the export statement - export SSH_AUTH_SOCK # enable gpg-agent for ssh fi -- cgit 1.4.1 From b49f46726c6ce2bedd81e7b8fe1a92fe1cc3df51 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 Jul 2015 17:04:48 +0200 Subject: Remove system configuration for S40 --- host-ap-s40.local/rcrc.local | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 host-ap-s40.local/rcrc.local diff --git a/host-ap-s40.local/rcrc.local b/host-ap-s40.local/rcrc.local deleted file mode 100644 index 5eb93482..00000000 --- a/host-ap-s40.local/rcrc.local +++ /dev/null @@ -1,2 +0,0 @@ -DOTFILES_DIRS="$HOME/projects/dotfiles" -TAGS="emacs git hg tmux vagrant zsh clojure" \ No newline at end of file -- cgit 1.4.1 From 049963daaf973aebb526fbac83ebf8ec70d0595d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 Jul 2015 17:05:09 +0200 Subject: Emacs: Use dired-subtree more intelligently --- tag-emacs/emacs.d/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el index f11336aa..df3c8215 100644 --- a/tag-emacs/emacs.d/init.el +++ b/tag-emacs/emacs.d/init.el @@ -291,7 +291,7 @@ (dired-up-directory)))) (bind-key "^" #'dired-subtree-maybe-up dired-mode-map)) :init (progn - (bind-key "i" #'dired-subtree-insert dired-mode-map))) + (bind-key "i" #'dired-subtree-toggle dired-mode-map))) ;;;; Documentation -- cgit 1.4.1 From 5d343fb5f08129137c69ef56c97ff1a6e0e886bf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 14 Jul 2015 14:21:28 +0200 Subject: Move emacs configuration to org-babel --- tag-emacs/emacs.d/init.el | 1636 ----------------------------- tag-emacs/emacs.d/init.org | 2506 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 2506 insertions(+), 1636 deletions(-) delete mode 100644 tag-emacs/emacs.d/init.el create mode 100644 tag-emacs/emacs.d/init.org diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el deleted file mode 100644 index df3c8215..00000000 --- a/tag-emacs/emacs.d/init.el +++ /dev/null @@ -1,1636 +0,0 @@ -;; -*- lexical-binding: t; -*- -;;;; Startup -;; Do not merge echo-area-message sexp -(setq inhibit-startup-echo-area-message "alan") -(setq inhibit-startup-screen t - initial-scratch-message "" - initial-major-mode 'text-mode - user-mail-address "alan@alanpearce.co.uk" - user-full-name "Alan Pearce" - custom-file "~/.emacs.d/custom.el") - -(load custom-file :noerror) - -;;;; Helper Macros -(defmacro rename-modeline (mode new-name) - `(defadvice ,mode (after rename-modeline activate) - (setq mode-name ,new-name))) - -;;; Allow lisps to use a common setup. I don't know why they don't have some lispy mode as their parent, but this is close enough -(defcustom lisp-mode-common-hook nil - "Hook run when entering any Lisp mode." - :type 'hook - :group 'lisp) - -;;;; Environment & Location - -(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.") - -(defvar work-project-directory "~/work") -(defvar home-project-directory "~/projects") - -;;;; Package Management -(add-to-list 'load-path (expand-file-name "elisp/" user-emacs-directory)) - -(eval-and-compile - (add-to-list 'load-path (expand-file-name "~/.cask")) - (require 'cask) - (cask-initialize)) - -(unless (package-installed-p 'req-package) - (package-refresh-contents) - (package-install 'req-package)) -(require 'req-package) -(setq use-package-verbose t) -(req-package pallet - :defer 5 - :config (pallet-mode 1)) - -;;;; Style - -(req-package whitespace - :defer t - :config (setq whitespace-style - '(face - space - tabs - trailing - newline - empty - tab-mark - space-before-tab - indentation - indentation::space - indentation::tabs))) - -(global-font-lock-mode t) -;; Allow font-lock-mode to do background parsing -(setq jit-lock-stealth-time 1 - jit-lock-stealth-load 100 - jit-lock-chunk-size 1000 - jit-lock-defer-time 0.01) - -(when (fboundp #'blink-cursor-mode) - (blink-cursor-mode -1)) - -(setq x-underline-at-descent-line t) - -(setq ring-bell-function - (lambda () - (unless (memq this-command - '(isearch-abort abort-recursive-edit exit-minibuffer keyboard-quit undo-tree-undo)) - (ding)))) - -(req-package solarized-theme - :config (progn - (load-theme 'solarized-light t))) - -(when (or (display-graphic-p) - (daemonp)) - - (defun use-variable-fonts () - (interactive) - (variable-pitch-mode) - (setq cursor-type 'bar)) - - (defun ap/set-fonts (mono-face variable-face font-size) - (when mono-face - (let ((default-font (concat mono-face "-" (number-to-string 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 (concat variable-face "-" - (number-to-string (1+ font-size)))))) - - (cond - ((eq window-system 'w32) - (ap/set-fonts "Consolas" "Segoe UI" 10)) - ((eq system-type 'darwin) - (ap/set-fonts "Monaco" "Helvetica" 12)))) - -(req-package rainbow-mode - :commands (rainbow-turn-on - rainbow-turn-off) - :config (progn - (add-hook 'xmonad-mode-hook #'rainbow-turn-on))) - -(req-package highlight-stages - :defer t - :diminish highlight-stages-mode - :init (progn - (add-hook 'lisp-mode-common-hook #'highlight-stages-mode))) - -;;;; Autosaves & Backups -(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)) - auto-save-file-name-transforms `((".*" ,temporary-file-directory t)) - backup-by-copying-when-linked t - backup-by-copying-when-mismatch t)) - -;;;; Buffers - -(req-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))))) - -(req-package uniquify - :config (progn - (setq uniquify-buffer-name-style 'reverse - uniquify-separator "/" - uniquify-after-kill-buffer-p t - uniquify-ignore-buffers-re "^\\*"))) - -(req-package fancy-narrow - :diminish fancy-narrow-mode - :config (fancy-narrow-mode 1)) - -;;;; Communication - -(setq gnutls-min-prime-bits nil) - -;;;; Completion - -(setq completion-styles '(basic initials partial-completion substring) - completion-ignore-case t) - -(req-package smart-tab - :commands (global-smart-tab-mode) - :init (global-smart-tab-mode) - :config (progn - (nconc smart-tab-completion-functions-alist '((php-mode . php-complete-function))) - (diminish 'smart-tab-mode ""))) - -(req-package company - :commands (company-mode) - :diminish "Cmpl" - :bind (("C-" . company-complete)) - :init (progn - (add-hook 'prog-mode-hook #'company-mode) - (setq company-backends '(company-tern (php-extras-company company-elisp company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-cmake company-capf company-gtags company-dabbrev-code company-etags company-keywords) - company-oddmuse company-files 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))) - -;;;; Dates & Times - -(req-package calendar - :defer t - :config (progn - (setq calendar-week-start-day 1) - (calendar-set-date-style 'iso))) - -(defun insert-date (prefix) - "Insert the current date. With prefix-argument, use British format. With - 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)))) - -(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)))) - -;;;; Directory browsing -(req-package dired - :defer t - :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))) - -(req-package dired-k - :require dired - :init (progn - (add-hook 'dired-initial-position-hook #'dired-k)) - :config (progn - (setq dired-k-human-readable t) - (bind-key "g" #'dired-k dired-mode-map))) - -(req-package dired-x - :require dired) - -(req-package dired+ - :require dired - :config (progn - (diredp-toggle-find-file-reuse-dir 1) - (unbind-key "C-h C-m" dired-mode-map) - (bind-key "." #'diredp-describe-file dired-mode-map) - (defun turn-on-dired-omit-mode () - (interactive) - (dired-omit-mode 1)) - (add-hook 'dired-mode-hook #'turn-on-dired-omit-mode) - (setq dired-omit-files "#\\|\\.$" - dired-omit-verbose nil - dired-find-subdir t))) - -(req-package dired-subtree - :defer t - :require dired - :config (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)) - :init (progn - (bind-key "i" #'dired-subtree-toggle dired-mode-map))) - -;;;; Documentation - -(req-package helm-dash - :defer t - :init (progn - (defmacro ap/create-helm-dash-hook (mode docsets) - (let* ((mode-s (symbol-name mode)) - (fun (intern (concat "helm-dash-hook-" mode-s))) - (hook (intern (concat mode-s "-mode-hook")))) - `(progn - (defun ,fun () - (when (require 'helm-dash nil :noerror) - (-each (-difference ',docsets - (helm-dash-installed-docsets)) - #'helm-dash-install-docset) - (setq-local helm-dash-docsets ',docsets))) - (add-hook (quote ,hook) (function ,fun))))) - (ap/create-helm-dash-hook nginx ("Nginx")) - (ap/create-helm-dash-hook ansible ("Ansible")) - (ap/create-helm-dash-hook php ("PHP" "Symfony")) - (ap/create-helm-dash-hook twig ("Twig")) - (ap/create-helm-dash-hook js2 ("JavaScript" "NodeJS" "jQuery" "Express")) - (ap/create-helm-dash-hook markdown ("Markdown")) - (ap/create-helm-dash-hook saltstack ("SaltStack")) - (ap/create-helm-dash-hook clojure ("Clojure")) - (ap/create-helm-dash-hook sql ("PostgreSQL" "MySQL")))) - -(req-package which-func - :init (which-function-mode) - :config (setq which-func-modes t)) - -(req-package discover-my-major - :bind ("C-h C-m" . discover-my-major)) - -;;;; Files - -(prefer-coding-system 'utf-8-auto-unix) -(set-default-coding-systems 'utf-8-auto-unix) -(setq-default buffer-file-coding-system 'utf-8-auto-unix) -(setq create-lockfiles nil) -(if (eq system-type 'darwin) - (setq delete-by-moving-to-trash t)) - -(req-package autorevert - :init (progn - (global-auto-revert-mode 1) - (setq auto-revert-verbose nil))) - -(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))))))))) - -(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))))) - -(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)))) -(add-to-list 'find-file-not-found-functions #'my-create-non-existent-directory) - -(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 (equalp buf "*HTTP Response*") - (other-window 1)) - (kill-buffer buf))))) - -(req-package ws-butler - :if window-system - :config (ws-butler-global-mode 1)) -(if (daemonp) - (add-hook #'before-make-frame-hook (lambda () (ws-butler-global-mode 1)))) - -(req-package fasd - :bind ("C-x C-/" . fasd-find-file) - :init (progn - (global-fasd-mode 1))) - -(req-package recentf - :init (progn (setq recentf-auto-cleanup 'never - recentf-save-file (expand-file-name "recentf" user-emacs-directory)) - (recentf-mode 1))) - -(req-package password-store - :config (progn - (setq password-store-password-length 16))) - -(req-package saveplace - :config (progn (setq-default save-place t) - (setq save-place-file (expand-file-name ".saveplace" user-emacs-directory)))) - -(req-package tramp - :defer t - :config (progn - (setq tramp-default-method (if (eq system-type 'windows-nt) "plinkx" "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)))) - -(req-package tramp-sh - :require tramp - :defer t - :config (progn - (add-to-list 'tramp-remote-path "/usr/local/sbin") - (add-to-list 'tramp-remote-path "~/bin"))) - -(req-package ediff - :defer t - :config (progn - (setq ediff-split-window-function 'split-window-horizontally - ediff-window-setup-function 'ediff-setup-windows-plain))) - -;;;; Indentation - -(setq-default tab-width 4 - indent-tabs-mode t) -(setq tab-stop-list - ;; (mapcar (lambda (x) - ;; (* 4 x)) - ;; (number-sequence 1 (/ 120 4))) - '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120) - tab-always-indent 'complete) - -(req-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 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-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) - (auto-indent-global-mode))) - -(req-package smart-tabs-mode - :commands (smart-tabs-mode - smart-tabs-mode-enable - smart-tabs-advice) - :config (progn - (add-hook 'php-mode-hook (lambda () - (smart-tabs-mode indent-tabs-mode))) - (smart-tabs-insinuate 'c 'javascript 'cperl 'python))) - -;;;; Keybindings - -(when (eq system-type 'darwin) - (set-keyboard-coding-system nil) - (setq mac-option-modifier 'meta - mac-right-option-modifier 'left - mac-control-modifier 'control - mac-right-control-modifier 'left - mac-command-modifier 'super - mac-right-command-modifier 'left - mac-function-modifier 'hyper)) - -(unbind-key "") -(bind-key "" #'compile) -(bind-key "" #'kmacro-start-macro-or-insert-counter) -(bind-key "" #'kmacro-end-or-call-macro) - -(bind-key "" #'execute-extended-command) - -(unbind-key "C-z") -(bind-key "C-" #'other-window) - -(bind-key "C-x C-r" #'revert-buffer) -(bind-key "C-x C-j" #'delete-indentation) -(unbind-key "C-x C-c") - -(bind-key "C-c i" #'insert-char) -(bind-key "M-/" #'hippie-expand) - -(unbind-key "s-h") -(unbind-key "s-n") -(unbind-key "s-p") -(unbind-key "s-w") -(bind-key "s-k" #'kill-or-delete-this-buffer-dwim) - -(bind-key "s-x" (define-prefix-command 'super-x-map)) - -(defun switch-to-dotfiles () - (interactive) - (projectile-persp-switch-project (expand-file-name "dotfiles" home-project-directory))) -(bind-key "s-," #'switch-to-dotfiles) -(set-register ?e `(file . ,*init-file*)) -(set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) - -(req-package discover - :config (global-discover-mode)) - -;; Enable narrowing functions C-x n -(put 'narrow-to-defun 'disabled nil) -(put 'narrow-to-page 'disabled nil) -(put 'narrow-to-region 'disabled nil) - -;;;; Minibuffer - -(setq enable-recursive-minibuffers t) -(setq minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)) -(minibuffer-depth-indicate-mode t) - -(if (daemonp) - (defalias 'exit-emacs #'delete-frame) - (defalias 'exit-emacs #'save-buffers-kill-emacs)) - -(req-package helm-config - :demand t - :ensure helm - :bind (("C-x i" . helm-semantic-or-imenu)) - :config (progn - (setq helm-idle-delay .1 - helm-input-idle-delay 0) - (when (fboundp #'helm-adaptive-mode) - (helm-adaptive-mode 1)))) - -(req-package helm-files - :defer t - :config (progn - (define-key helm-read-file-map (kbd "") #'helm-execute-persistent-action) - (define-key helm-read-file-map (kbd "TAB") #'helm-execute-persistent-action) - (define-key helm-read-file-map (kbd "C-i") #'helm-execute-persistent-action) - (define-key helm-read-file-map (kbd "C-z") #'helm-select-action))) - -(req-package ido - :bind (("C-x b" . ido-switch-buffer)) - :init (progn - (setq ido-save-directory-list-file (expand-file-name "ido-state" user-emacs-directory)) - (bind-key* "C-x C-f" #'ido-find-file) - (ido-mode 1) - (ido-everywhere 1)) - :config (progn - (setq ido-auto-merge-delay-time 99999 - ido-enable-flex-matching t) - - (ido-init-completion-maps) - (defadvice ido-find-file (after find-file-sudo activate) - "Find file as root if necessary." - (unless (and buffer-file-name - (file-writable-p buffer-file-name)) - (find-alternate-file (concat "/sudo::" buffer-file-name)))) - (defun ido-manual-merge () - (interactive) - (ido-initiate-auto-merge (current-buffer))) - (bind-key "C-c C-s" #'ido-manual-merge ido-file-dir-completion-map))) - -(req-package ido-completing-read+ - :require ido - :config (progn - (setq ido-cr+-fallback-function #'helm-completing-read - ido-cr+-max-items 2000))) - -(defun ap/ido-projectile-switch-buffer-dwim (force-ido) - (interactive "p") - (if (and (projectile-project-p) (eq force-ido 1)) - (call-interactively #'projectile-switch-to-buffer) - (call-interactively #'ido-switch-buffer))) - -(bind-key "s-x b" #'ap/ido-projectile-switch-buffer-dwim) -(bind-key "s-x s-b" #'ap/ido-projectile-switch-buffer-dwim) - -(req-package ido-vertical-mode - :require ido - :init (progn - (setq ido-vertical-decorations '("\n❯ " - "" - "\n " - "\n …" - "[" - "]" - " [No match]" - " [Matched]" - " [Not readable]" - " [Too big]" - " [Confirm]" - "\n❯ " - "") - ido-vertical-define-keys 'C-n-C-p-up-down-left-right)) - :config (ido-vertical-mode 1)) - -(req-package flx-ido - :require ido - :init (progn - (flx-ido-mode 1) - (setq flx-ido-threshhold 1000))) - -(req-package smex - :require ido - :bind (("M-x" . smex) - ("" . smex) - ("" . smex) - ("M-X" . smex-major-mode-commands) - ("C-c M-x" . execute-extended-command)) - :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")) - (smex-initialize))) - -;;;; Modeline - -(column-number-mode t) -(size-indication-mode t) - -(defun fill-line-format (line-format) - (max 0 - (- (window-width) - (length (format-mode-line line-format))))) - -(defvar mode-line-size - `((size-indication-mode - ((-3 ,(propertize - "%p" - 'local-map mode-line-column-line-number-mode-map - 'mouse-face 'mode-line-highlight - ;; XXX needs better description - 'help-echo "Size indication mode\n\ -mouse-1: Display Line and Column Mode Menu")) - " " - (-4 "%I"))))) - -(setq-default - mode-line-modes (let ((recursive-edit-help-echo "Recursive edit, type C-M-c to get out")) - (list (propertize "%[" 'help-echo recursive-edit-help-echo) - `(:propertize ("" mode-name) - help-echo "Major mode\n\ -mouse-1: Display major mode menu\n\ -mouse-2: Show help for major mode\n\ -mouse-3: Toggle minor modes" - mouse-face mode-line-highlight - local-map ,mode-line-major-mode-keymap) - '("" mode-line-process) - `(:propertize ("" minor-mode-alist) - mouse-face mode-line-highlight - help-echo "Minor mode\n\ -mouse-1: Display minor mode menu\n\ -mouse-2: Show help for minor mode\n\ -mouse-3: Toggle minor modes" - local-map ,mode-line-minor-mode-keymap) - (propertize "%n" 'help-echo "mouse-2: Remove narrowing from buffer" - 'mouse-face 'mode-line-highlight - 'local-map (make-mode-line-mouse-map - 'mouse-2 #'mode-line-widen)) - (propertize "%]" 'help-echo recursive-edit-help-echo) - " ")) - mode-line-buffer-identification (list (propertize "%b" - 'face 'mode-line-buffer-id)) - - mode-line-position `((line-number-mode - ((column-number-mode - ,(propertize - "%l:%c" - 'local-map mode-line-column-line-number-mode-map - 'mouse-face 'mode-line-highlight - 'help-echo "Line number and Column number\n\ -mouse-1: Display Line and Column Mode Menu") - (6 ,(propertize - "L%l" - 'local-map mode-line-column-line-number-mode-map - 'mouse-face 'mode-line-highlight - 'help-echo "Line Number\n\ -mouse-1: Display Line and Column Mode Menu")))) - ((column-number-mode - (5 ,(propertize - "C%c" - 'local-map mode-line-column-line-number-mode-map - 'mouse-face 'mode-line-highlight - 'help-echo "Column number\n\ -mouse-1: Display Line and Column Mode Menu")))))) - mode-line-format `("%e" - " " - mode-line-modes - mode-line-misc-info - (vc-mode vc-mode) - mode-line-end-spaces) - header-line-format `("%e" - mode-line-front-space - mode-line-mule-info - mode-line-client - mode-line-modified - mode-line-auto-compile - mode-line-remote " " - mode-line-position " " - mode-line-size - " ⎸ " - mode-line-buffer-identification - )) - -;;;; Modes - -;;;; systemd files -(add-to-list 'auto-mode-alist '("\\.service\\'" . conf-mode)) -(add-to-list 'auto-mode-alist '("\\.target\\'" . conf-mode)) -(add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-mode)) - -(add-to-list 'auto-mode-alist '("\\.envrc\\'" . sh-mode)) - -(req-package xrdb-mode - :mode (("\\.Xdefaults\\'" . xrdb-mode) - ("\\.Xresources\\'" . xrdb-mode))) - -(req-package haskell-mode - :mode (("\\.hs\\'" . haskell-mode))) - -(req-package nix-mode - :mode (("\\.nix\\'" . nix-mode)) - :config (progn - (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)) - -(req-package nginx-mode - :defer t - :mode (("/nginx/servers/" . nginx-mode) - ("/nginx/.*\\.d/" . nginx-mode)) - :config (progn - (setq nginx-indent-tabs-mode t))) - -(req-package lua-mode - :defer t) - -(req-package ledger-mode - :mode ("\\.ledger\\'" . ledger-mode) - :config (progn - (defun setup-ledger-mode () - (setq-local indent-tabs-mode nil)) - (add-hook 'ledger-mode-hook #'setup-ledger-mode) - (add-to-list 'smart-tab-disabled-major-modes 'ledger-mode) - (setq ledger-use-iso-dates t - ledger-post-use-completion-engine 'ido - ledger-reconcile-default-commodity "€" - ledger-clear-whole-transactions t - ledger-narrow-on-reconcile t - ledger-default-date-format "%Y-%m-%d"))) - -(req-package ruby-mode - :mode (("\\.rb\\'" . ruby-mode) - ("\\.cap\\'" . ruby-mode))) - -(req-package 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)) - -(define-derived-mode saltstack-mode yaml-mode "Salt") -(add-to-list 'auto-mode-alist '("\\.sls\\'" . saltstack-mode)) - -;;;; Planning - -(req-package org - :bind (("C-c C-a" . org-agenda-list) - ("C-c a" . org-agenda) - ("C-c l" . org-store-link)) - :init (setq org-replace-disputed-keys t) - :config (progn - (setq org-directory "~/org" - org-agenda-files `(,org-directory) - - org-default-notes-file (concat org-directory "/notes") - - ;; ‘Remember’: new items at top - org-reverse-note-order t - - org-modules '(org-habit - org-checklist) - - ;; Add time done to ‘done’ tasks - org-log-done 'time - - ;; Allow refiling into any org file - org-refile-targets '((org-agenda-files :maxlevel . 3)) - - org-list-allow-alphabetical t - - org-pretty-entities t - - org-table-duration-custom-format 'seconds - - org-src-fontify-natively t - - org-export-have-math t - - org-blank-before-new-entry '((heading . t) - (plain-list-item . auto)) - org-fontify-done-headline t - - org-todo-keywords '((sequence "TODO" "STARTED" "|" "DONE") - (sequence "TOLEARN" "LEARNING" "LEARNED" "|" "MASTERED") - (sequence "|" "CANCELLED"))) - (set-register ?o `(file . ,(expand-file-name "organiser.org" org-directory))) - (add-hook 'org-mode-hook #'turn-on-auto-fill) - (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"))))))) - -(req-package org-babel - :require org - :defer t - :config (org-babel-do-load-languages - 'org-babel-load-languages - '((ledger . t) - (sh . t)))) - -(req-package org-journal - :require org - :defer t - :config (progn - (setq org-journal-date-format "%A, %d %B %Y"))) - -(req-package org-mobile - :require org - :defer t - :config (progn - (setq org-mobile-directory "~/Mobile/Org"))) - -;;;; Programming - -(req-package cedet - :disabled t - :config (progn - (semantic-load-enable-code-helpers) - (global-semantic-idle-completions-mode t) - (global-semantic-highlight-func-mode t) - (global-semantic-show-unmatched-syntax-mode t) - (global-semantic-decoration-mode t))) - -(req-package flycheck - :diminish " ✓" - :init (global-flycheck-mode)) - -(req-package go-mode - :mode (("\\.go\\'" . go-mode))) - -(when (file-exists-p "src/code.google.com/p/go.tools/cmd/oracle/oracle.el") - (req-package oracle - :load-path ,(expand-file-name "src/code.google.com/p/go.tools/cmd/oracle/oracle.el" (getenv "GOPATH")) - :init (progn - (add-hook 'go-mode-hook #'go-oracle-mode)))) - -(req-package company-go - :require go-mode - :config (progn - (setq company-go-show-annotation t) - (defun ap/company-go-setup () - (set (make-local-variable 'company-backends) - '(company-go))) - (add-hook 'go-mode-hook #'ap/company-go-setup))) - -(req-package go-eldoc - :require go-mode - :config (progn - (add-hook 'go-mode-hook #'go-eldoc-setup))) - -(req-package go-projectile - :require (go-mode go-eldoc projectile) - :config (progn - (setq go-projectile-switch-gopath 'maybe))) - -(req-package ggtags - :commands turn-on-ggtags-mode - :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))) - -(req-package auto-compile - :defer t - :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) - -(req-package cc-mode - :defer t - :init (progn - (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 '+))) - -(req-package quickrun - :bind (("C-c C-e" . quickrun))) - -;;;; Projects - -(req-package dash - :demand t - :init (setq dash-enable-fontlock t) - :config (progn - (dash--enable-fontlock 'dash-enable-font-lock t))) - -(req-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)) - :init (projectile-global-mode) - :diminish projectile-mode - :config (progn - (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/-add-known-subfolder-projects (dir) - (-map #'projectile-add-known-project (--map (concat (file-name-as-directory dir) it) (ap/subfolder-projects dir)))) - - (defun ap/add-known-subfolder-projects () - (interactive) - (ap/-add-known-subfolder-projects (ido-read-directory-name "Add projects under: "))) - - (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 'helm))) - -(req-package helm-projectile - :ensure projectile - :require projectile - :defer t) - -(req-package projector - :require projectile - :bind (("s-z" . projector-open-project-shell))) - -(req-package perspective - :bind (("s-p" . persp-switch)) - :init (progn - (persp-mode))) - -(req-package persp-projectile - :require (projectile perspective)) - -(req-package vc - :defer t - :bind (("C-x v C" . vc-resolve-conflicts)) - :config (progn - (setq vc-follow-symlinks t))) - -(req-package diff-hl - :init (progn - (global-diff-hl-mode) - (add-hook 'magit-refresh-file-buffer-hook #'diff-hl-update))) - -(req-package magit - :commands (magit-status) - :config (progn (rename-modeline magit-status-mode (char-to-string (-find #'char-displayable-p '(11942 5848 177)))) - (setq magit-last-seen-setup-instructions "1.4.0" - magit-completing-read-function #'magit-ido-completing-read)) - :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) - -;;;; Spelling -(req-package ispell - :bind (("" . ispell-word)) - :config (progn - (setq ispell-program-name "aspell" - ispell-dictionary "british"))) - -;;;; Scripting - -(add-hook 'after-save-hook - #'executable-make-buffer-file-executable-if-script-p) - -(req-package sh-script - :mode (("\\.zsh\\'" . shell-script-mode)) - :config (setq sh-shell-file "/usr/bin/env zsh")) - -;;;; Shells & REPLs - -(req-package eshell - :bind ("C-c s" . eshell) - :config (progn - (setq eshell-directory-name "~/.emacs.d/eshell") - (add-hook 'eshell-load-hook (lambda () - (bind-key "C-c C-l" #'helm-eshell-history eshell-mode-map))) - (req-package em-smart - :config (progn - (setq eshell-where-to-jump 'begin - eshell-review-quick-commands nil - eshell-smart-space-goes-to-end t) - (eshell-smart-initialize))))) - -(autoload #'eshell/cd "em-dirs") -(defun eshell-goto-current-dir (&optional arg) - (interactive "P") - (let ((dir default-directory)) - (eshell arg) - (eshell/cd dir))) -(bind-key "C-c S" #'eshell-goto-current-dir) - -(req-package shell - :defer t - :config (define-key shell-mode-map - (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) - -(req-package comint - :defer t - :config (bind-key "C-c C-l" #'helm-comint-input-ring comint-mode-map)) - -(req-package multi-term - :if (not (eq system-type 'windows-nt)) - :bind ("C-`" . multi-term-dedicated-toggle)) - -(defun comint-delchar-or-eof-or-kill-buffer (arg) - (interactive "p") - (if (null (get-buffer-process (current-buffer))) - (kill-buffer) - (comint-delchar-or-maybe-eof arg))) - -;;;; Text editing - -(bind-key "C-M-a" #'backward-paragraph text-mode-map) -(bind-key "C-M-e" #'forward-paragraph text-mode-map) - -;; Enable upcase and downcase-region -(put 'upcase-region 'disabled nil) -(put 'downcase-region 'disabled nil) -(setq sentence-end-double-space t - line-move-visual nil) - -(req-package align - :config (progn - (add-to-list 'align-rules-list - '(colon-key-value - (regexp . ":\\(\\s-*\\)") - (modes . '(js2-mode)))))) - -(setq x-select-enable-clipboard t) -(if (functionp 'x-cut-buffer-or-selection-value) - (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)) - -;; replace highlighted text rather than just inserting at point -(delete-selection-mode t) - -(bind-key "S-SPC" #'set-mark-command) - -(defun fc/isearch-yank-symbol () - "Yank the symbol at point into the isearch minibuffer. - -C-w does something similar in isearch, but it only looks for -the rest of the word. I want to look for the whole string. And -symbol, not word, as I need this for programming the most." - (interactive) - (isearch-yank-string - (save-excursion - (when (and (not isearch-forward) - isearch-other-end) - (goto-char isearch-other-end)) - (thing-at-point 'symbol)))) -(bind-key "C-d" #'fc/isearch-yank-symbol isearch-mode-map) - -(req-package subword - :init (global-subword-mode t)) - -(req-package misc - :bind (("M-z" . zap-up-to-char) - ("M-Z" . zap-to-char))) - -(req-package typopunct - :config (progn - (typopunct-change-language 'english t) - (defconst typopunct-minus (decode-char 'ucs #x2212)) - (defadvice typopunct-insert-typographical-dashes - (around minus-or-pm activate) - (cond - ((or (eq (char-before) typopunct-em-dash) - (looking-back "\\([[:blank:]]\\|^\\)\\^")) - (delete-char -1) - (insert typopunct-minus)) - ((looking-back "[^[:blank:]]\\^") - (insert typopunct-minus)) - (t ad-do-it))) - - (defconst typopunct-ellipsis (decode-char 'ucs #x2026)) - (defconst typopunct-middot (decode-char 'ucs #xB7)) ; or 2219 - (defun typopunct-insert-ellipsis-or-middot (arg) - "Change three consecutive dots to a typographical ellipsis mark." - (interactive "p") - (cond - ((and (= 1 arg) - (eq (char-before) ?^)) - (delete-char -1) - (insert typopunct-middot)) - ((and (= 1 arg) - (eq this-command last-command) - (looking-back "\\.\\.")) - (replace-match "") - (insert typopunct-ellipsis)) - (t - (self-insert-command arg)))) - (define-key typopunct-map "." 'typopunct-insert-ellipsis-or-middot) - - (defconst typopunct-times (decode-char 'ucs #xD7)) - (defun typopunct-insert-times (arg) - (interactive "p") - (if (and (= 1 arg) (looking-back "\\([[:blank:]]\\|^\\)\\^")) - (progn (delete-char -1) - (insert typopunct-times)) - (self-insert-command arg))) - (define-key typopunct-map "x" 'typopunct-insert-times) - - (defadvice typopunct-insert-quotation-mark (around wrap-region activate) - (let* ((lang (or (get-text-property (point) 'typopunct-language) - typopunct-buffer-language)) - (omark (if single - (typopunct-opening-single-quotation-mark lang) - (typopunct-opening-quotation-mark lang))) - (qmark (if single - (typopunct-closing-single-quotation-mark lang) - (typopunct-closing-quotation-mark lang)))) - (cond - (mark-active - (let ((skeleton-end-newline nil) - (singleo (typopunct-opening-single-quotation-mark lang)) - (singleq (typopunct-closing-single-quotation-mark lang))) - (if (> (point) (mark)) - (exchange-point-and-mark)) - (save-excursion - (while (re-search-forward (regexp-quote (string omark)) (mark) t) - (replace-match (regexp-quote (string singleo)) nil nil))) - (save-excursion - (while (re-search-forward (regexp-quote (string qmark)) (mark) t) - (replace-match (regexp-quote (string singleq)) nil nil))) - (skeleton-insert (list nil omark '_ qmark) -1))) - ((looking-at (regexp-opt (list (string omark) (string qmark)))) - (forward-char 1)) - (t ad-do-it))))) - :init (progn - (add-hook 'text-mode-hook #'typopunct-mode))) - -(req-package ap-functions - :commands (ap/remove-extra-cr) - :bind (("C-x r M-w" . copy-rectangle) - ("M-!" . shell-execute))) - -(when (boundp 'x-select-request-type) - (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))) - -(req-package markdown-mode - :defer t - :config (progn - (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) - -(req-package avy - :bind* (("M-g g" . avy-goto-line) - ("M-g M-g" . avy-goto-line) - ("C-|" . avy-goto-line) - ("C-c SPC" . avy-goto-char)) - :config (progn - (avy-setup-default) - (setq avy-all-windows nil))) - -(use-package ace-jump-buffer - :bind ("s-b" . ace-jump-buffer)) - -(req-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)))) - -(req-package expand-region - :bind ("C-M-SPC" . er/expand-region)) - -(req-package goto-chg - :bind ("C-x SPC" . goto-last-change)) - -(req-package helm-swoop - :bind (("C-=" . helm-swoop) - ("C-c C-=" . helm-multi-swoop)) - :init (progn - (bind-key "C-=" #'helm-swoop isearch-mode-map) - (bind-key "C-=" #'helm-multi-swoop-all-from-helm-swoop))) - -(req-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-" #'mc/mark-all-like-this-dwim) - (bind-key "C-" #'mc/mark-more-like-this-extended) - (bind-key "C-S-L" #'mc/edit-lines))) - -(req-package eldoc - :commands (eldoc-mode) - :diminish eldoc-mode - :config (progn - (setq eldoc-idle-delay 0.1) - (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) - -(req-package paredit - :diminish "()" - :commands (paredit-mode) - :init (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 'minibuffer-setup-hook #'conditionally-enable-paredit-mode) - (defun conditionally-enable-paredit-mode () - "enable paredit-mode during eval-expression" - (if (eq this-command 'eval-expression) - (paredit-mode 1))))) - -(req-package smartparens-config - :config (progn - (sp-use-smartparens-bindings) - (fset 'wrap-with-paren "\C-](") ;; `sp-select-next-thing-exchange' - (bind-key "C-(" #'wrap-with-paren sp-keymap) - (bind-key "C-)" #'sp-forward-slurp-sexp sp-keymap) - (bind-key "M-" #'backward-kill-word sp-keymap) - (bind-key "M-?" #'sp-convolute-sexp sp-keymap) - (bind-key "C-M-t" #'sp-transpose-sexp sp-keymap) - (bind-key "M-r" #'sp-raise-sexp sp-keymap) - (bind-key "M-s" #'sp-splice-sexp sp-keymap) - (bind-key "M-S" #'sp-split-sexp sp-keymap) - (bind-key "M-J" #'sp-join-sexp sp-keymap) - (bind-key "M-" #'sp-splice-sexp-killing-backward sp-keymap) - (bind-key "M-" #'sp-splice-sexp-killing-forward sp-keymap) - (bind-key "C-M-S-k" #'sp-kill-hybrid-sexp sp-keymap) - (bind-key "C-S-" #'sp-slurp-hybrid-sexp sp-keymap) - (sp-with-modes '(web-mode 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))) - -(req-package move-text - :config (move-text-default-bindings)) - -(req-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))) - :diminish undo-tree-mode) - -(req-package visual-regexp - :bind (("C-c r" . vr/replace) - ("C-c q" . vr/query-replace) - ("C-c m" . vc/mc-mark))) - -;;;; Lisps - -(defun ap/lisp-setup () - (run-hooks 'lisp-mode-common-hook) - (setq indent-tabs-mode nil)) - -(defun set-common-lisp-indentation () - (set (make-local-variable 'lisp-indent-function) - #'common-lisp-indent-function)) - -(rename-modeline emacs-lisp-mode "ξ") -(add-to-list 'auto-mode-alist '("/Cask\\'" . emacs-lisp-mode)) -(add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup) -(add-hook 'emacs-lisp-mode-hook #'eldoc-mode) - -(add-hook 'scheme-mode-hook #'ap/lisp-setup) -(add-hook 'lisp-mode-hook #'ap/lisp-setup) -(add-hook 'lisp-mode-hook #'set-common-lisp-indentation) - -(req-package elisp-slime-nav - :commands elisp-slime-nav-mode - :diminish elisp-slime-nav-mode) - -(req-package geiser - :commands (geiser-mode - geiser - run-geiser - run-racket)) - -(req-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))) - -(req-package clj-refactor - :defer t - :require clojure-mode - :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))) - -(req-package cider - :require clojure-mode - :defer t - :config (progn - (setq nrepl-hide-special-buffers t) - (unbind-key "C-c C-f" cider-mode-map) - (add-hook 'cider-mode-hook #'cider-turn-on-eldoc-mode))) - -(req-package redshank - :diminish " Λ" - :defer t - :init (progn - (add-hook 'lisp-mode-common-hook #'turn-on-redshank-mode))) - -(req-package ielm - :defer t - :config (progn - (add-hook 'ielm-mode-hook (lambda () - (run-hooks 'lisp-mode-common-hook))))) - -(req-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")))) - -(defun imenu-elisp-sections () - (setq imenu-prev-index-position-function nil) - (add-to-list 'imenu-generic-expression '("Sections" "^;;;; \\(.+\\)$" 1) t) - (add-to-list 'imenu-generic-expression '("Packages" "^(req-package\\s-+\\(\\(\\sw\\|\\s_\\)+\\)$" 1) t)) - -(defun init-narrow-to-section () - (interactive) - (save-excursion - (beginning-of-line) - (unless (looking-at "^;;;;") - (re-search-backward "^;;;;" nil t)) - (push-mark) - (forward-line) - (re-search-forward "^;;;;" nil t) - (forward-line -1) - (narrow-to-region (region-beginning) (region-end)))) - -(defun init-imenu (p) - (interactive "P") - (find-file-existing *init-file*) - (widen) - (helm-imenu) - (if p (init-narrow-to-section))) - -(add-hook 'emacs-lisp-mode-hook 'imenu-elisp-sections) - -(defun eval-and-replace () - "Replace the preceding sexp with its value." - (interactive) - (backward-kill-sexp) - (condition-case nil - (prin1 (eval (read (current-kill 0))) - (current-buffer)) - (error (message "Invalid expression") - (insert (current-kill 0))))) - -(bind-key "C-c e" #'eval-and-replace) - -;;;; Web Development - -(req-package skewer-mode - :defer t - :init (progn - (add-hook 'js2-mode-hook #'skewer-mode) - (add-hook 'html-mode-hook #'skewer-html-mode) - (add-hook 'css-mode-hook #'skewer-css-mode))) - -(req-package js2-mode - :mode ("\\.js\\'" . js2-mode) - :config (progn - (defun ap/javascript-setup () - (autopair-mode -1) - (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))) - -(req-package json-mode - :mode ("\\.json\\'" . json-mode)) - -(req-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))) - -(req-package tern - :commands ap/enable-tern - :config (progn - (setq tern-command (list (executable-find "tern"))) - (defun ap/enable-tern () - (tern-mode 1)) - (add-hook 'js2-mode-hook #'ap/enable-tern))) - -(req-package tern-company - :require (tern company)) - -(add-to-list 'auto-mode-alist '("composer\\.lock" . js-mode)) - -(req-package scss-mode - :defer t - :config (progn - (setq scss-compile-at-save nil))) - -(req-package jinja2-mode - :mode (("\\.j2\\'" . jinja2-mode) - ("\\.jinja\\'" . jinja2-mode))) - -(req-package php-mode - :mode ("\\.php\\'" . php-mode) - :config (progn - (setq php-template-compatibility nil) - (bind-key "C-h C-f" #'php-search-documentation php-mode-map) - (unbind-key "C-c C-f" php-mode-map) - (unbind-key "C-." php-mode-map) - (setq php-mode-coding-style "Symfony2") - (add-hook 'php-mode-hook #'turn-on-eldoc-mode) - (add-hook 'php-mode-hook #'php-enable-symfony2-coding-style))) - -(req-package sgml-mode - :defer t - :config (setq sgml-basic-offset 4)) - -(req-package emmet-mode - :commands (emmet-mode) - :diminish (emmet-mode . " >") - :init (progn - (if (functionp 'web-mode) - (add-hook 'web-mode-hook #'emmet-mode)))) - -(req-package web-mode - :mode (("/views/.*\\.php\\'" . web-mode) - ("/layouts/.*\\.html\\'" . web-mode) - ("/templates/.*\\.php\\'" . web-mode) - ("\\.ejs\\'" . web-mode)) - :config (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)) - -(define-derived-mode twig-mode web-mode "Twig") -(add-to-list 'auto-mode-alist '("\\.html\\.twig\\'" . twig-mode)) - -(req-package mmm-auto - :config (progn - (mmm-add-classes - '((php-sql - :submode sql-mode - :front "<<= emacs-major-version 24) - (> emacs-minor-version 3)) - :config (progn - (popwin-mode 1) - (add-to-list 'popwin:special-display-config '("^*helm.+*$" :regexp t :height 20)))) - -(req-package winner - :init (progn - (winner-mode 1) - (setq winner-boring-buffers '("*Completions*" "*Help*" "*Apropos*" "*Buffer List*" "*info*" "*Compile-Log*")))) - -(req-package windmove - :bind (("S-" . windmove-left) - ("S-" . windmove-right) - ("S-" . windmove-up) - ("S-" . windmove-down))) - -(if (eq system-type 'darwin) - (setq ns-pop-up-frames nil)) - -(req-package-finish) - -(unless (daemonp) - (require 'server) - (if (server-running-p server-name) - (message "Server already appears to be running") - (server-start))) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org new file mode 100644 index 00000000..8cfb1c9b --- /dev/null +++ b/tag-emacs/emacs.d/init.org @@ -0,0 +1,2506 @@ +#+STARTUP: noindent showstars content +#+TITLE: Emacs Configuration for Alan Pearce +#+PROPERTY: results silent +#+PROPERTY: eval no-export +#+PROPERTY: header-args :tangle yes :comments link +* Introduction +This is a living document, detailing my Emacs configuration using org-mode +* Emacs Configuration + +** Basics +*** Startup +Open Emacs with just a plain window. No graphics or messages, please! +#+BEGIN_SRC emacs-lisp + (setq inhibit-startup-echo-area-message "alan") + (setq inhibit-startup-screen t) +#+END_SRC + +*** Scratch buffers +I usually use scratch buffers for any sort of text. If I need a +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) +#+END_SRC + +*** Personal Information +#+BEGIN_SRC emacs-lisp + (setq user-mail-address "alan@alanpearce.co.uk" + user-full-name "Alan Pearce") +#+end_src + +*** Customize +I don’t really like using customize for normal configuration. +Instead, I use it for things that get saved automatically. That’s why +I use a different file, which is ignored by the VCS. It also means +that it’s not important whether the file exists or not, which is why I +pass =:noerror= to =load= + +#+BEGIN_SRC emacs-lisp + (setq custom-file "~/.emacs.d/custom.el") + (load custom-file :noerror :nomessage) +#+END_SRC + + +** Packaging + +I still use a couple of [[file:elisp/][elisp files]] that don’t appear to be in any package +archives. +#+BEGIN_SRC emacs-lisp +(add-to-list 'load-path (expand-file-name "elisp/" user-emacs-directory)) +#+END_SRC + +*** TODO Move [[file:elisp/ap-functions.el][=ap-functions=]] into this file and delete above + +*** Cask + +For most packages, I use [[https://github.com/cask/cask][cask]] +#+BEGIN_SRC emacs-lisp + (add-to-list 'load-path (expand-file-name "~/.cask")) + (require 'cask) + (cask-initialize) +#+END_SRC + +**** Cask commands + +Installing +#+BEGIN_SRC sh :tangle no +curl -fsSL https://raw.githubusercontent.com/cask/cask/master/go | python +#+END_SRC + +Install all packages specified in the Caskfile +#+BEGIN_SRC sh :tangle no :dir ~/.emacs.d/ +cask install +#+END_SRC + +List packages with new versions +#+BEGIN_SRC sh :tangle no :dir ~/.emacs.d/ :results output +cask outdated +#+END_SRC + +Update old packages +#+BEGIN_SRC sh :tangle no :dir ~/.emacs.d/ +cask update +#+END_SRC + +*** Req-package + +#+BEGIN_SRC emacs-lisp + (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") + ("marmalade" . "http://marmalade-repo.org/packages/") + ("melpa" . "http://melpa.org/packages/") + ("melpa-stable" . "http://stable.melpa.org/packages/") + ("org" . "http://orgmode.org/elpa/"))) + (package-initialize) + (unless (package-installed-p 'req-package) + (package-refresh-contents) + (package-install 'req-package)) + (require 'req-package) + (setq use-package-verbose t) +#+END_SRC + +*** Pallet + +I use [[https://github.com/rdallasgray/pallet][pallet]] to keep my [[file:Cask][Caskfile]] up-to-date with packages installed +from inside Emacs. I don’t need it on startup, so I tell +=req-package= to initialise it when Emacs is idle. + +#+BEGIN_SRC emacs-lisp +(req-package pallet + :defer 5 + :config (pallet-mode 1)) +#+END_SRC + + +** Helpers + I like to rename modeline lighters. This macro works for major modes. +#+BEGIN_SRC emacs-lisp +(defmacro rename-modeline (mode new-name) + `(defadvice ,mode (after rename-modeline activate) + (setq mode-name ,new-name))) +#+END_SRC + +** Projects + + #+BEGIN_SRC emacs-lisp + (defvar work-project-directory "~/work") + (defvar home-project-directory "~/projects") + #+END_SRC + +#+BEGIN_SRC emacs-lisp +(defun switch-to-dotfiles () + (interactive) + (projectile-persp-switch-project (expand-file-name "dotfiles" home-project-directory))) +#+END_SRC + +*** Projectile + +Projectile is awesome for working in projects, especially VCS-backed +ones. I added a couple of functions to allow me to open new projects +based upon some folder conventions I use. + +#+BEGIN_SRC emacs-lisp +(req-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)) + :init (projectile-global-mode) + :diminish projectile-mode + :config (progn + (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/-add-known-subfolder-projects (dir) + (-map #'projectile-add-known-project (--map (concat (file-name-as-directory dir) it) (ap/subfolder-projects dir)))) + + (defun ap/add-known-subfolder-projects () + (interactive) + (ap/-add-known-subfolder-projects (ido-read-directory-name "Add projects under: "))) + + (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 'helm))) +#+END_SRC + +*** projector + +Project-based shell buffers sounds like a good idea, but for some +reason I haven’t found a use for it. + +#+BEGIN_SRC emacs-lisp +(req-package projector + :require projectile + :bind (("s-z" . projector-open-project-shell))) +#+END_SRC + +*** perspective + +This package makes buffer-switching inside of projects make sense, by +filtering the candidates to those within the project. For it to work, +it needs hooking into projectile and a key bound to switch between projects. + +#+BEGIN_SRC emacs-lisp + (req-package perspective + :bind (("s-p" . persp-switch)) + :init (progn + (persp-mode))) + + (req-package persp-projectile + :require (projectile perspective)) +#+END_SRC + +*** vc + +This is nice for some things that magit doesn’t do, and for those rare +occasions that I’m working with something other than git. + +#+BEGIN_SRC emacs-lisp +(req-package vc + :defer t + :bind (("C-x v C" . vc-resolve-conflicts)) + :config (progn + (setq vc-follow-symlinks t))) +#+END_SRC + +*** diff-hl + +It’s nice to be able to see at a glance which lines of a file have +changed. This package colours the fringe + +#+BEGIN_SRC emacs-lisp +(req-package diff-hl + :init (progn + (global-diff-hl-mode) + (add-hook 'magit-refresh-file-buffer-hook #'diff-hl-update))) +#+END_SRC + +*** magit + +Magit is my favourite way to use git. I use selective staging all the +time. Make sure to set it up with a nice =completing-read-function= + +#+BEGIN_SRC emacs-lisp +(req-package magit + :commands (magit-status) + :config (progn (rename-modeline magit-status-mode (char-to-string (-find #'char-displayable-p '(11942 5848 177)))) + (setq magit-last-seen-setup-instructions "1.4.0" + magit-completing-read-function #'magit-ido-completing-read)) + :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) +#+END_SRC + +** Styles + +I prefer an always-visible cursor. Feels less distracting. +#+BEGIN_SRC emacs-lisp +(when (fboundp #'blink-cursor-mode) + (blink-cursor-mode -1)) +#+END_SRC + +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)) + (when scroll-bar-mode + (scroll-bar-mode -1) + (tooltip-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)))) +#+END_SRC + +When I’m using dash in emacs lisp, it’s nice to have proper font +locking for it. +#+BEGIN_SRC emacs-lisp +(req-package dash + :demand t + :init (setq dash-enable-fontlock t) + :config (progn + (dash--enable-fontlock 'dash-enable-font-lock t))) +#+END_SRC + +*** Colours + +I quite like solarized. I don’t think it’s perfect, but it supports a +lot of modes. +#+BEGIN_SRC emacs-lisp + (req-package solarized-theme + :config (progn + (load-theme 'solarized-light t))) +#+END_SRC + +Colourise colour names in certain types of buffer. I don’t use this +in modes for webdev because [[web-mode]] includes that functionality. +#+BEGIN_SRC emacs-lisp +(req-package rainbow-mode + :commands (rainbow-turn-on + rainbow-turn-off) + :config (progn + (add-hook 'xmonad-mode-hook #'rainbow-turn-on))) +#+END_SRC + +Highlighting quasi-quoted expressions in lisps is quite useful. +#+BEGIN_SRC emacs-lisp +(req-package highlight-stages + :defer t + :diminish highlight-stages-mode + :init (progn + (add-hook 'lisp-mode-common-hook #'highlight-stages-mode))) +#+END_SRC + +*** Fonts + +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 variable-face font-size) + (when mono-face + (let ((default-font (concat mono-face "-" (number-to-string 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 (concat variable-face "-" + (number-to-string (1+ font-size)))))) + + (cond + ((eq window-system 'w32) + (ap/set-fonts "Consolas" "Segoe UI" 10)) + ((eq system-type 'darwin) + (ap/set-fonts "Monaco" "Helvetica" 12)))) +#+END_SRC + +Allow font-lock-mode to do background parsing. I’m not really sure if +these settings are particularly useful +#+BEGIN_SRC emacs-lisp +(setq jit-lock-stealth-time 1 + jit-lock-stealth-load 100 + jit-lock-chunk-size 1000 + jit-lock-defer-time 0.01) +#+END_SRC + +** Files + +*** Auto-saving + +Auto-save everything to a temporary directory, instead of cluttering +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) +#+END_SRC +*** Backups + +I like to keep my backups out of regular folders. I tell emacs to use +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)) + (if (eq system-type 'darwin) + (setq delete-by-moving-to-trash t)) +#+END_SRC + +*** autorevert + +#+BEGIN_SRC emacs-lisp +(req-package autorevert + :init (progn + (global-auto-revert-mode 1) + (setq auto-revert-verbose nil))) +#+END_SRC + +*** Encoding + +#+BEGIN_SRC emacs-lisp +(prefer-coding-system 'utf-8-auto-unix) +(set-default-coding-systems 'utf-8-auto-unix) +(setq-default buffer-file-coding-system 'utf-8-auto-unix) +#+END_SRC + +*** Buffer-file management + +Ask if I want to create a directory when it doesn’t exist. This is +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)))) +(add-to-list 'find-file-not-found-functions #'my-create-non-existent-directory) +#+END_SRC + +I often want to rename or delete the file that I’m currently visiting +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))))))))) + + (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))))) + + (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 (equalp buf "*HTTP Response*") + (other-window 1)) + (kill-buffer buf))))) +#+END_SRC + +*** Whitespace Butler + +I don’t like it when editors change an entire file’s layout when I +open it. Whitespace butler fixes whitespace only for lines that I’m editing. + +#+BEGIN_SRC emacs-lisp +(req-package ws-butler + :if window-system + :config (ws-butler-global-mode 1)) +(if (daemonp) + (add-hook #'before-make-frame-hook (lambda () (ws-butler-global-mode 1)))) +#+END_SRC + +*** fasd + +Fasd is a nice shell plugin that remembers file and folder arguments, +making it easy to re-visit them later. This package hooks into that. +I don’t seem to use it much though. + +#+BEGIN_SRC emacs-lisp +(req-package fasd + :bind ("C-x C-/" . fasd-find-file) + :init (progn + (global-fasd-mode 1))) +#+END_SRC + +*** recentf + +I only use this occasionally, but it’s nice for files outside of projects. + +#+BEGIN_SRC emacs-lisp +(req-package recentf + :init (progn (setq recentf-auto-cleanup 'never + recentf-save-file (expand-file-name "recentf" user-emacs-directory)) + (recentf-mode 1))) +#+END_SRC + +*** saveplace + +It.. saves the position I visited a file at last. Might try turning +it off to see if I notice it. + +#+BEGIN_SRC emacs-lisp +(req-package saveplace + :config (progn (setq-default save-place t) + (setq save-place-file (expand-file-name ".saveplace" user-emacs-directory)))) +#+END_SRC + +*** Tramp + +Tramp is awesome. It makes SSH feel Unix-y. The proxy setup is so +that I can sudo on remote machines + +#+BEGIN_SRC emacs-lisp + (req-package tramp + :defer t + :config (progn + (setq tramp-default-method (if (eq system-type 'windows-nt) "plinkx" "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)))) + + (req-package tramp-sh + :require tramp + :defer t + :config (progn + (add-to-list 'tramp-remote-path "/usr/local/sbin") + (add-to-list 'tramp-remote-path "~/bin"))) +#+END_SRC + +*** ediff + +I like a horizonal diff setup, with everything in one frame. + +#+BEGIN_SRC emacs-lisp +(req-package ediff + :defer t + :config (progn + (setq ediff-split-window-function 'split-window-horizontally + ediff-window-setup-function 'ediff-setup-windows-plain))) +#+END_SRC + +** 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! + +#+BEGIN_SRC emacs-lisp +(setq-default tab-width 4 + indent-tabs-mode t) +(setq tab-stop-list + ;; (mapcar (lambda (x) + ;; (* 4 x)) + ;; (number-sequence 1 (/ 120 4))) + '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120)) +#+END_SRC + +*** auto-indent-mode + +Don’t make me think, just indent it! Unless it’s a +whitespace-sensitive language, of course. + +#+BEGIN_SRC emacs-lisp +(req-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 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-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) + (auto-indent-global-mode))) +#+END_SRC + +**** TODO Check for auto-indentation of whitespace-sensitive languages. + +*** smart-tabs-mode + +Not related to [[smart-tab][=smart-tab=]], this mode indents with tabs and aligns +with spaces. Perfect! + +#+BEGIN_SRC emacs-lisp +(req-package smart-tabs-mode + :commands (smart-tabs-mode + smart-tabs-mode-enable + smart-tabs-advice) + :config (progn + (add-hook 'php-mode-hook (lambda () + (smart-tabs-mode indent-tabs-mode))) + (smart-tabs-insinuate 'c 'javascript 'cperl 'python))) +#+END_SRC + +** Security + +*** password-store + +This is a frontend to the GPG-powered =pass= program. +#+BEGIN_SRC emacs-lisp +(req-package password-store + :config (progn + (setq password-store-password-length 16))) +#+END_SRC +** Buffers + +*** Ibuffer +Ibuffer is quite nice for listing all buffers. I don’t use it very +often though, as it doesn’t really work with perspectives. + +#+BEGIN_SRC emacs-lisp +(req-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))))) +#+END_SRC + +*** Uniqify + +Sometimes projects have files with the same name. This gives them +unique names, by adding enough path elements to make them unambiguous. + +#+BEGIN_SRC emacs-lisp +(req-package uniquify + :config (progn + (setq uniquify-buffer-name-style 'forward + uniquify-separator "/" + uniquify-after-kill-buffer-p t + uniquify-ignore-buffers-re "^\\*"))) +#+END_SRC + +*** Narrowing + +Enable it without prompting + +#+BEGIN_SRC emacs-lisp +(put 'narrow-to-defun 'disabled nil) +(put 'narrow-to-page 'disabled nil) +(put 'narrow-to-region 'disabled nil) +#+END_SRC + +*** Fancy Narrow + +Sometimes I like to be able to focus on one block of code at a time. +Normally narrowing hides everything else completely, which I don’t +like. This package just makes everything else lower-contrast. +#+BEGIN_SRC emacs-lisp +(req-package fancy-narrow + :diminish fancy-narrow-mode + :config (fancy-narrow-mode 1)) +#+END_SRC + +*** ace-jump-buffer + +#+BEGIN_SRC emacs-lisp +(use-package ace-jump-buffer + :bind ("s-b" . ace-jump-buffer)) +#+END_SRC + +*** ace-window + +I don’t often have many windows open at once, but when I do, +=ace-window= is really nice to jump around them in the same way that +=ace-jump= or =avy= work. +#+BEGIN_SRC emacs-lisp +(req-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)))) +#+END_SRC + +** Windows + +Scrolling is tricky. I use this setup to help me keep track of the +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 100) +(if (eq system-type 'darwin) + (setq ns-pop-up-frames nil)) +#+END_SRC + +A dedicated window always keeps the same buffer in view. + +#+BEGIN_SRC emacs-lisp +(defun toggle-window-dedicated () + "Toggle whether the current active window is dedicated or not" + (interactive) + (message + "Window '%s' is %s" + (current-buffer) + (if (let ((window (get-buffer-window (current-buffer)))) + (set-window-dedicated-p window + (not (window-dedicated-p window)))) + "dedicated" + "normal"))) +#+END_SRC + +*** popwin + +This works really nicely wiht helm. I should think about whether it +might be useful elsewhere + +#+BEGIN_SRC emacs-lisp +(req-package popwin + :if (and (>= emacs-major-version 24) + (> emacs-minor-version 3)) + :config (progn + (popwin-mode 1) + (add-to-list 'popwin:special-display-config '("^*helm.+*$" :regexp t :height 20)))) +#+END_SRC + +*** winner + +Undo, for window-based commands. + +#+BEGIN_SRC emacs-lisp +(req-package winner + :init (progn + (winner-mode 1) + (setq winner-boring-buffers '("*Completions*" "*Help*" "*Apropos*" "*Buffer List*" "*info*" "*Compile-Log*")))) +#+END_SRC + +*** windmove + +Directional window movement + +#+BEGIN_SRC emacs-lisp +(req-package windmove + :bind (("S-" . windmove-left) + ("S-" . windmove-right) + ("S-" . windmove-up) + ("S-" . windmove-down))) +#+END_SRC +** Completion + +Make built-in completion a bit more intelligent, by adding substring +and initial-based completion and ignoring case. + +** TODO With =tab-always-indent=, do I need smart-tab anymore? + +#+BEGIN_SRC emacs-lisp + (setq completion-styles '(basic initials partial-completion substring) + completion-ignore-case t + tab-always-indent 'complete) +#+END_SRC + +*** Smart-tab + +Most editors use tab for both completion and indentation. Smart-tab +tries to do the right thing depending on the location of the point and +the line’s current indentation. + +#+BEGIN_SRC emacs-lisp +(req-package smart-tab + :commands (global-smart-tab-mode) + :init (global-smart-tab-mode) + :diminish smart-tab-mode + :config (progn + (nconc smart-tab-completion-functions-alist '((php-mode . php-complete-function))) + (diminish 'smart-tab-mode ""))) +#+END_SRC + +*** Company + +The main choices for automatic completion in Emacs are company and +auto-complete-mode. I’ve not tried auto-complete-mode as company +seems to work perfectly well for me. + +#+BEGIN_SRC emacs-lisp +(req-package company + :commands (company-mode) + :diminish "Cmpl" + :bind (("C-" . company-complete)) + :init (progn + (add-hook 'prog-mode-hook #'company-mode) + (setq company-backends '(company-tern (php-extras-company company-elisp company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-cmake company-capf company-gtags company-dabbrev-code company-etags company-keywords) + company-oddmuse company-files 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 + +** Dates & Times + +*** Calendar + +Weeks start on Monday for me and I prefer ISO-style dates. +#+BEGIN_SRC emacs-lisp +(req-package calendar + :defer t + :config (progn + (setq calendar-week-start-day 1) + (calendar-set-date-style 'iso))) +#+END_SRC + +Sometimes I want to insert a date or time into a buffer. +#+BEGIN_SRC emacs-lisp +(defun insert-date (prefix) + "Insert the current date. With prefix-argument, use British format. With + 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)))) + +(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)))) +#+END_SRC + +** Directories + +Dired works quite nicely, but not always in the way I want. I don’t +like having so many prompts for recursive operations. Also, when I +have two dired windows open, assume that I’m going to be +copying/moving files between them. + +#+BEGIN_SRC emacs-lisp +(req-package dired + :defer t + :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))) +#+END_SRC + +I work with a lot of git projects. Dired-k adds colours based upon +the file’s git status. +#+BEGIN_SRC emacs-lisp +(req-package dired-k + :require dired + :init (progn + (add-hook 'dired-initial-position-hook #'dired-k)) + :config (progn + (setq dired-k-human-readable t) + (bind-key "g" #'dired-k dired-mode-map))) +#+END_SRC + + +Don’t show uninteresting files in dired listings. + +#+BEGIN_SRC emacs-lisp + (req-package dired-x + :require dired + :config (progn + (defun turn-on-dired-omit-mode () + (interactive) + (dired-omit-mode 1)) + (add-hook 'dired-mode-hook #'turn-on-dired-omit-mode) + (setq dired-omit-files "#\\|\\.$" + dired-omit-verbose nil + dired-find-subdir t))) +#+END_SRC + +#+BEGIN_SRC emacs-lisp + (req-package dired+ + :require dired + :config (progn + (diredp-toggle-find-file-reuse-dir 1) + (unbind-key "C-h C-m" dired-mode-map) + (bind-key "." #'diredp-describe-file dired-mode-map))) +#+END_SRC + +Expand subfolders like a tree inside the parent + +#+BEGIN_SRC emacs-lisp +(req-package dired-subtree + :defer t + :require dired + :config (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)) + :init (progn + (bind-key "i" #'dired-subtree-toggle dired-mode-map))) +#+END_SRC + +** Documentation + +*** helm-dash + +Emacs’ documentation is great to read from inside Emacs. Helm-dash +helps to make documentation for other languages easier to access + +#+BEGIN_SRC emacs-lisp +(req-package helm-dash + :defer t + :init (progn + (defmacro ap/create-helm-dash-hook (mode docsets) + (let* ((mode-s (symbol-name mode)) + (fun (intern (concat "helm-dash-hook-" mode-s))) + (hook (intern (concat mode-s "-mode-hook")))) + `(progn + (defun ,fun () + (when (require 'helm-dash nil :noerror) + (-each (-difference ',docsets + (helm-dash-installed-docsets)) + #'helm-dash-install-docset) + (setq-local helm-dash-docsets ',docsets))) + (add-hook (quote ,hook) (function ,fun))))) + (ap/create-helm-dash-hook nginx ("Nginx")) + (ap/create-helm-dash-hook ansible ("Ansible")) + (ap/create-helm-dash-hook php ("PHP" "Symfony")) + (ap/create-helm-dash-hook twig ("Twig")) + (ap/create-helm-dash-hook js2 ("JavaScript" "NodeJS" "jQuery" "Express")) + (ap/create-helm-dash-hook markdown ("Markdown")) + (ap/create-helm-dash-hook saltstack ("SaltStack")) + (ap/create-helm-dash-hook clojure ("Clojure")) + (ap/create-helm-dash-hook sql ("PostgreSQL" "MySQL")))) +#+END_SRC + +*** which-func + +Use the modeline to show which function definition the point is in. + +#+BEGIN_SRC emacs-lisp +(req-package which-func + :init (which-function-mode) + :config (setq which-func-modes t)) +#+END_SRC + +*** discover-my-major + +A nicer way to browse keybindings for major modes. + +#+BEGIN_SRC emacs-lisp +(req-package discover-my-major + :bind ("C-h C-m" . discover-my-major)) +#+END_SRC + +*** discover + +Makes some context menus for dired and other things, similarly to the +way magit’s popups work. + +#+BEGIN_SRC emacs-lisp +(req-package discover + :config (global-discover-mode)) +#+END_SRC + +*** eldoc + +Documentation in the echo-area (where the minibuffer is displayed) is +rather useful. + +#+BEGIN_SRC emacs-lisp +(req-package eldoc + :commands (eldoc-mode) + :diminish eldoc-mode + :config (progn + (setq eldoc-idle-delay 0.1) + (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) +#+END_SRC +** Keybindings + +I think =set-keyboard-coding-system= stops OS X from doing something +annoying to add accents. The modifier setup is to match my +re-arrangement of modifiers on OSX: Cmd on the outside, then +Option/alt, then Control. + +#+BEGIN_SRC emacs-lisp +(when (eq system-type 'darwin) + (set-keyboard-coding-system nil) + (setq mac-option-modifier 'meta + mac-right-option-modifier 'left + mac-control-modifier 'control + mac-right-control-modifier 'left + mac-command-modifier 'super + mac-right-command-modifier 'left + mac-function-modifier 'hyper)) +#+END_SRC + +#+BEGIN_SRC emacs-lisp + (unbind-key "") + (bind-key "" #'compile) + (bind-key "" #'kmacro-start-macro-or-insert-counter) + (bind-key "" #'kmacro-end-or-call-macro) + + (bind-key "" #'execute-extended-command) + + (unbind-key "C-z") + (bind-key "C-" #'other-window) + + (bind-key "C-x C-r" #'revert-buffer) + (bind-key "C-x C-j" #'delete-indentation) + (unbind-key "C-x C-c") + + (bind-key "C-c i" #'insert-char) + (bind-key "M-/" #'hippie-expand) + + (unbind-key "s-h") + (unbind-key "s-n") + (unbind-key "s-p") + (unbind-key "s-w") + (bind-key "s-k" #'kill-or-delete-this-buffer-dwim) + + (bind-key "C-M-a" #'backward-paragraph text-mode-map) + (bind-key "C-M-e" #'forward-paragraph text-mode-map) + + (bind-key "s-x" (define-prefix-command 'super-x-map)) + (bind-key "s-," #'switch-to-dotfiles) + (set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) +#+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.") + (set-register ?e `(file . ,*init-file*)) + + (req-package whitespace + :defer t + :config (setq whitespace-style + '(face + space + tabs + trailing + newline + empty + tab-mark + space-before-tab + indentation + indentation::space + indentation::tabs))) + + (req-package ap-functions + :commands (ap/remove-extra-cr) + :bind (("C-x r M-w" . copy-rectangle) + ("M-!" . shell-execute))) +#+END_SRC + +Some stuff for getting around my =init.el=. Now that I’m using +=org-mode=, I’ll probably need to write something else, or fiddle with +org’s navigation commands. + +#+BEGIN_SRC emacs-lisp +(defun imenu-elisp-sections () + (setq imenu-prev-index-position-function nil) + (add-to-list 'imenu-generic-expression '("Sections" "^;;;; \\(.+\\)$" 1) t) + (add-to-list 'imenu-generic-expression '("Packages" "^(req-package\\s-+\\(\\(\\sw\\|\\s_\\)+\\)$" 1) t)) + +(defun init-narrow-to-section () + (interactive) + (save-excursion + (beginning-of-line) + (unless (looking-at "^;;;;") + (re-search-backward "^;;;;" nil t)) + (push-mark) + (forward-line) + (re-search-forward "^;;;;" nil t) + (forward-line -1) + (narrow-to-region (region-beginning) (region-end)))) + +(defun init-imenu (p) + (interactive "P") + (find-file-existing *init-file*) + (widen) + (helm-imenu) + (if p (init-narrow-to-section))) + +(add-hook 'emacs-lisp-mode-hook 'imenu-elisp-sections) +#+END_SRC + +** Minibuffer + +Sometimes I want to use the minibuffer, but I’m already inside it. +Fortunately, this is possible. Of course, I need to know how many +minibuffers there are on the stack. + +#+BEGIN_SRC emacs-lisp + (setq enable-recursive-minibuffers t) + (minibuffer-depth-indicate-mode t) +#+END_SRC + +This avoids some issue with the minibuffer and the point being behind +the prompt. I don’t remember what exactly. +#+BEGIN_SRC emacs-lisp +(setq minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)) +#+END_SRC + +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)) +#+END_SRC + +*** helm + +I like to use =helm= for some completions, especially when there are +lots of candidates. + +#+BEGIN_SRC emacs-lisp + (req-package helm-config + :demand t + :ensure helm + :bind (("C-x i" . helm-semantic-or-imenu)) + :config (progn + (setq helm-idle-delay .1 + helm-input-idle-delay 0) + (when (fboundp #'helm-adaptive-mode) + (helm-adaptive-mode 1)))) + + (req-package helm-files + :defer t + :config (progn + (define-key helm-read-file-map (kbd "") #'helm-execute-persistent-action) + (define-key helm-read-file-map (kbd "TAB") #'helm-execute-persistent-action) + (define-key helm-read-file-map (kbd "C-i") #'helm-execute-persistent-action) + (define-key helm-read-file-map (kbd "C-z") #'helm-select-action))) +#+END_SRC + +*** ido + +I really like ido. It’s part of emacs, it does flex matching nicely +and it’s pretty configurable. + +#+BEGIN_SRC emacs-lisp +(req-package ido + :bind (("C-x b" . ido-switch-buffer)) + :init (progn + (setq ido-save-directory-list-file (expand-file-name "ido-state" user-emacs-directory)) + (bind-key* "C-x C-f" #'ido-find-file) + (ido-mode 1) + (ido-everywhere 1)) + :config (progn + (setq ido-auto-merge-delay-time 99999 + ido-enable-flex-matching t) + + (ido-init-completion-maps) + (defadvice ido-find-file (after find-file-sudo activate) + "Find file as root if necessary." + (unless (and buffer-file-name + (file-writable-p buffer-file-name)) + (find-alternate-file (concat "/sudo::" buffer-file-name)))) + (defun ido-manual-merge () + (interactive) + (ido-initiate-auto-merge (current-buffer))) + (bind-key "C-c C-s" #'ido-manual-merge ido-file-dir-completion-map))) +#+END_SRC + +**** TODO Figure out whether the merge stuff is useful. + +**** ido-completing-read+ + +This is mostly a dependency of =magit=. +#+BEGIN_SRC emacs-lisp +(req-package ido-completing-read+ + :require ido + :config (progn + (setq ido-cr+-fallback-function #'helm-completing-read + ido-cr+-max-items 2000))) +#+END_SRC + +***** TODO See if I can use ido-completing-read+ in ido places +This would be good for finding files in projects. + +***** Buffer switching within projects + +#+BEGIN_SRC emacs-lisp +(defun ap/ido-projectile-switch-buffer-dwim (force-ido) + (interactive "p") + (if (and (projectile-project-p) (eq force-ido 1)) + (call-interactively #'projectile-switch-to-buffer) + (call-interactively #'ido-switch-buffer))) + +(bind-key "s-x b" #'ap/ido-projectile-switch-buffer-dwim) +(bind-key "s-x s-b" #'ap/ido-projectile-switch-buffer-dwim) +#+END_SRC + +**** ido-vertical-mode + +I find ido’s default horizonal presentation of completion candidates +to be a little difficult to follow. Of course, there’s always a +package for that. + +#+BEGIN_SRC emacs-lisp +(req-package ido-vertical-mode + :require ido + :init (progn + (setq ido-vertical-decorations '("\n❯ " + "" + "\n " + "\n …" + "[" + "]" + " [No match]" + " [Matched]" + " [Not readable]" + " [Too big]" + " [Confirm]" + "\n❯ " + "") + ido-vertical-define-keys 'C-n-C-p-up-down-left-right)) + :config (ido-vertical-mode 1)) +#+END_SRC + +**** flx-ido + +I think ido’s flex matching could be a bit better, so I use =flx-ido= +for that. It can be slow on large collectinos, but fortunately it can +disable itself at that point + +#+BEGIN_SRC emacs-lisp +(req-package flx-ido + :require ido + :init (progn + (flx-ido-mode 1) + (setq flx-ido-threshold 1000))) +#+END_SRC + +*** smex + +Smex is my favourite way to use =M-x=. I might try setting up =helm= +again, to see whether it’s any better or not. + +#+BEGIN_SRC emacs-lisp +(req-package smex + :require ido + :bind (("M-x" . smex) + ("" . smex) + ("" . smex) + ("M-X" . smex-major-mode-commands) + ("C-c M-x" . execute-extended-command)) + :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")) + (smex-initialize))) +#+END_SRC + +** Modeline + +I modified the mode-line format to show me less information. Instead, +I put some of it in the frame-line at the top. + +#+BEGIN_SRC emacs-lisp + (column-number-mode t) + (size-indication-mode t) + + (defun fill-line-format (line-format) + (max 0 + (- (window-width) + (length (format-mode-line line-format))))) + + (defvar mode-line-size + `((size-indication-mode + ((-3 ,(propertize + "%p" + 'local-map mode-line-column-line-number-mode-map + 'mouse-face 'mode-line-highlight + ;; XXX needs better description + 'help-echo "Size indication mode\n\ + mouse-1: Display Line and Column Mode Menu")) + " " + (-4 "%I"))))) + + (setq-default + mode-line-modes (let ((recursive-edit-help-echo "Recursive edit, type C-M-c to get out")) + (list (propertize "%[" 'help-echo recursive-edit-help-echo) + `(:propertize ("" mode-name) + help-echo "Major mode\n\ + mouse-1: Display major mode menu\n\ + mouse-2: Show help for major mode\n\ + mouse-3: Toggle minor modes" + mouse-face mode-line-highlight + local-map ,mode-line-major-mode-keymap) + '("" mode-line-process) + `(:propertize ("" minor-mode-alist) + mouse-face mode-line-highlight + help-echo "Minor mode\n\ + mouse-1: Display minor mode menu\n\ + mouse-2: Show help for minor mode\n\ + mouse-3: Toggle minor modes" + local-map ,mode-line-minor-mode-keymap) + (propertize "%n" 'help-echo "mouse-2: Remove narrowing from buffer" + 'mouse-face 'mode-line-highlight + 'local-map (make-mode-line-mouse-map + 'mouse-2 #'mode-line-widen)) + (propertize "%]" 'help-echo recursive-edit-help-echo) + " ")) + mode-line-buffer-identification (list (propertize "%b" + 'face 'mode-line-buffer-id)) + + mode-line-position `((line-number-mode + ((column-number-mode + ,(propertize + "%l:%c" + 'local-map mode-line-column-line-number-mode-map + 'mouse-face 'mode-line-highlight + 'help-echo "Line number and Column number\n\ + mouse-1: Display Line and Column Mode Menu") + (6 ,(propertize + "L%l" + 'local-map mode-line-column-line-number-mode-map + 'mouse-face 'mode-line-highlight + 'help-echo "Line Number\n\ + mouse-1: Display Line and Column Mode Menu")))) + ((column-number-mode + (5 ,(propertize + "C%c" + 'local-map mode-line-column-line-number-mode-map + 'mouse-face 'mode-line-highlight + 'help-echo "Column number\n\ + mouse-1: Display Line and Column Mode Menu")))))) + mode-line-format `("%e" + " " + mode-line-modes + mode-line-misc-info + (vc-mode vc-mode) + mode-line-end-spaces) + header-line-format `("%e" + mode-line-front-space + mode-line-mule-info + mode-line-client + mode-line-modified + mode-line-auto-compile + mode-line-remote " " + mode-line-position " " + mode-line-size + " ⎸ " + mode-line-buffer-identification + )) + + (setq frame-title-format + '((:eval (if (and (fboundp #'projectile-project-p) + (projectile-project-p)) + (projectile-project-name))) + ": " + (:eval (if (buffer-file-name) + (buffer-name) + "%b")))) +#+END_SRC + +*** Modes + +Setup some modes for systemd files +#+BEGIN_SRC emacs-lisp +(add-to-list 'auto-mode-alist '("\\.service\\'" . conf-mode)) +(add-to-list 'auto-mode-alist '("\\.target\\'" . conf-mode)) +(add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-mode)) +#+END_SRC + +=direnv=’s files are basically shell scripts, it’s a nice way to +set environment variables for projects. +#+BEGIN_SRC emacs-lisp +(add-to-list 'auto-mode-alist '("\\.envrc\\'" . sh-mode)) +#+END_SRC + +Some modes that I don’t really customise much, mostly for +configuration files. +#+BEGIN_SRC emacs-lisp + (req-package xrdb-mode + :mode (("\\.Xdefaults\\'" . xrdb-mode) + ("\\.Xresources\\'" . xrdb-mode))) + + (req-package haskell-mode + :mode (("\\.hs\\'" . haskell-mode))) + + (req-package nix-mode + :mode (("\\.nix\\'" . nix-mode)) + :config (progn + (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)) + + (req-package nginx-mode + :defer t + :mode (("/nginx/servers/" . nginx-mode) + ("/nginx/.*\\.d/" . nginx-mode)) + :config (progn + (setq nginx-indent-tabs-mode t))) + + (req-package lua-mode + :defer t) + + (req-package ruby-mode + :mode (("\\.rb\\'" . ruby-mode) + ("\\.cap\\'" . ruby-mode))) + + (req-package go-mode + :mode (("\\.go\\'" . go-mode))) + + (req-package jinja2-mode + :mode (("\\.j2\\'" . jinja2-mode) + ("\\.jinja\\'" . jinja2-mode))) + + (req-package scss-mode + :defer t + :config (progn + (setq scss-compile-at-save nil))) + + (req-package 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)) + + (define-derived-mode saltstack-mode yaml-mode "Salt") + (add-to-list 'auto-mode-alist '("\\.sls\\'" . saltstack-mode)) +#+END_SRC + +**** ledger + +I use [[http://ledger-cli.org/][=ledger=]] to manage my finances. It has an Emacs mode, which +works really nicely. + +#+BEGIN_SRC emacs-lisp +(req-package ledger-mode + :mode ("\\.ledger\\'" . ledger-mode) + :config (progn + (defun setup-ledger-mode () + (setq-local indent-tabs-mode nil)) + (add-hook 'ledger-mode-hook #'setup-ledger-mode) + (add-to-list 'smart-tab-disabled-major-modes 'ledger-mode) + (setq ledger-use-iso-dates t + ledger-post-use-completion-engine 'ido + ledger-reconcile-default-commodity "€" + ledger-clear-whole-transactions t + ledger-narrow-on-reconcile t + ledger-default-date-format "%Y-%m-%d"))) +#+END_SRC + +**** Markdown + +#+BEGIN_SRC emacs-lisp +(req-package markdown-mode + :defer t + :config (progn + (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) +#+END_SRC + +*** Org + +Org is wünderbar. + +**** TODO Check whether all this configuration is necessary or helpful. + +#+BEGIN_SRC emacs-lisp +(req-package org + :bind (("C-c C-a" . org-agenda-list) + ("C-c a" . org-agenda) + ("C-c l" . org-store-link)) + :init (setq org-replace-disputed-keys t) + :config (progn + (setq org-directory "~/org" + org-agenda-files `(,org-directory) + + org-default-notes-file (concat org-directory "/notes") + + ;; ‘Remember’: new items at top + org-reverse-note-order t + + org-modules '(org-habit + org-checklist) + + ;; Add time done to ‘done’ tasks + org-log-done 'time + + ;; Allow refiling into any org file + org-refile-targets '((org-agenda-files :maxlevel . 3)) + + org-list-allow-alphabetical t + + org-pretty-entities t + + org-table-duration-custom-format 'seconds + + org-src-fontify-natively t + + org-export-have-math t + + org-blank-before-new-entry '((heading . t) + (plain-list-item . auto)) + org-fontify-done-headline t + + org-todo-keywords '((sequence "TODO" "STARTED" "|" "DONE") + (sequence "TOLEARN" "LEARNING" "LEARNED" "|" "MASTERED") + (sequence "|" "CANCELLED"))) + (set-register ?o `(file . ,(expand-file-name "organiser.org" org-directory))) + (add-hook 'org-mode-hook #'turn-on-auto-fill) + (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 + +Org’s babel feature is really nice. I use it for this file, and I can +use it to communicate between programming languages. Sometime I hope +to have my =ledger= setup in an org file with some graph processing +with R or something. + +#+BEGIN_SRC emacs-lisp +(req-package org-babel + :require org + :defer t + :config (org-babel-do-load-languages + 'org-babel-load-languages + '((ledger . t) + (sh . t)))) +#+END_SRC + +***** org-journal + +I can use this to keep a journal. I should use it. + +#+BEGIN_SRC emacs-lisp +(req-package org-journal + :require org + :defer t + :config (progn + (setq org-journal-date-format "%A, %d %B %Y"))) +#+END_SRC + +***** org-mobile + +****** TODO Setup org-mobile +#+BEGIN_SRC emacs-lisp +(req-package org-mobile + :require org + :defer t + :config (progn + (setq org-mobile-directory "~/Mobile/Org"))) +#+END_SRC + +** Programming +*** cedet + +**** TODO Setup cedet and see whether it’s useful + +#+BEGIN_SRC emacs-lisp +(req-package cedet + :disabled t + :config (progn + (semantic-load-enable-code-helpers) + (global-semantic-idle-completions-mode t) + (global-semantic-highlight-func-mode t) + (global-semantic-show-unmatched-syntax-mode t) + (global-semantic-decoration-mode t))) +#+END_SRC + +*** flycheck + +On-the-fly error checking in programming modes? Yes please. + +#+BEGIN_SRC emacs-lisp +(req-package flycheck + :diminish " ✓" + :init (global-flycheck-mode)) +#+END_SRC + +*** golang + +Go has a few packages to inter-operate with other emacs packages. + +#+BEGIN_SRC emacs-lisp +(when (file-exists-p "src/code.google.com/p/go.tools/cmd/oracle/oracle.el") + (req-package oracle + :load-path ,(expand-file-name "src/code.google.com/p/go.tools/cmd/oracle/oracle.el" (getenv "GOPATH")) + :init (progn + (add-hook 'go-mode-hook #'go-oracle-mode)))) + +(req-package company-go + :require go-mode + :config (progn + (setq company-go-show-annotation t) + (defun ap/company-go-setup () + (set (make-local-variable 'company-backends) + '(company-go))) + (add-hook 'go-mode-hook #'ap/company-go-setup))) + +(req-package go-eldoc + :require go-mode + :config (progn + (add-hook 'go-mode-hook #'go-eldoc-setup))) + +(req-package go-projectile + :require (go-mode go-eldoc projectile) + :config (progn + (setq go-projectile-switch-gopath 'maybe))) + + +#+END_SRC + +*** ggtags + +A nice completion backend for programming modes. + +#+BEGIN_SRC emacs-lisp +(req-package ggtags + :commands turn-on-ggtags-mode + :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 + +**** 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. + +#+BEGIN_SRC emacs-lisp + (defcustom lisp-mode-common-hook nil + "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)) +#+END_SRC + +***** Redshank + +Lisp syntax allows for really easy refactoring. Redshank gives some +operations that aren’t part of paredit, like extracting variables into +let bindings. +#+BEGIN_SRC emacs-lisp +(req-package redshank + :diminish " Λ" + :defer t + :init (progn + (add-hook 'lisp-mode-common-hook #'turn-on-redshank-mode))) +#+END_SRC + +**** Emacs Lisp + +Customise the modeline-display of =emacs-lisp-mode=. Then make sure +it runs the common lisp hooks. + +#+BEGIN_SRC emacs-lisp +(rename-modeline emacs-lisp-mode "ξ") +(add-to-list 'auto-mode-alist '("/Cask\\'" . emacs-lisp-mode)) +(add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup) +(add-hook 'emacs-lisp-mode-hook #'eldoc-mode) +#+END_SRC + +Go-to function for elisp. Except it works through the entire Emacs ecosystem. + +#+BEGIN_SRC emacs-lisp + (req-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))) +#+END_SRC + +Interactive elisp + +#+BEGIN_SRC emacs-lisp +(req-package ielm + :defer t + :config (progn + (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 +buffers too: it’s faster than quickrun and the parens mean that I +don’t have to worry about a selection. + +#+BEGIN_SRC emacs-lisp +(defun eval-and-replace () + "Replace the preceding sexp with its value." + (interactive) + (backward-kill-sexp) + (condition-case nil + (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 + +**** Scheme & Lisp + +I don’t work with these as often as I would like + +#+BEGIN_SRC emacs-lisp + (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)) + (add-hook 'lisp-mode-hook #'set-common-lisp-indentation) +#+END_SRC + +***** geiser + +A REPL thing for Scheme. Hopefully I’ll get to use it more in the +future. + +#+BEGIN_SRC emacs-lisp +(req-package geiser + :commands (geiser-mode + geiser + run-geiser + run-racket)) +#+END_SRC + +***** slime + +A REPL thing (and more) for Lisp. + +#+BEGIN_SRC emacs-lisp +(req-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")))) +#+END_SRC + +**** Clojure + +#+BEGIN_SRC emacs-lisp +(req-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))) + +(req-package clj-refactor + :defer t + :require clojure-mode + :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 + +A REPL thing for Clojure + +#+BEGIN_SRC emacs-lisp +(req-package cider + :require clojure-mode + :defer t + :config (progn + (setq nrepl-hide-special-buffers t) + (unbind-key "C-c C-f" cider-mode-map) + (add-hook 'cider-mode-hook #'cider-turn-on-eldoc-mode))) +#+END_SRC + +*** Auto-compile + +Auto-compile emacs lisp when saving. +#+BEGIN_SRC emacs-lisp +(req-package auto-compile + :defer t + :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) +#+END_SRC + +*** cc-mode + +Although I don’t use C or C++, setting up the mode is helpful because +quite a few other modes are derived from it. + +#+BEGIN_SRC emacs-lisp +(req-package cc-mode + :defer t + :init (progn + (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 '+))) +#+END_SRC + +*** quickrun + +It’s nice to be able to quickly evaluate some code. Although I don’t +really seem to use it. +#+BEGIN_SRC emacs-lisp +(req-package quickrun + :bind (("C-c C-e" . quickrun))) +#+END_SRC + +*** Web development + +**** skewer-mode + +I don’t use this as often as I probably should. I should figure out +why that is. +#+BEGIN_SRC emacs-lisp +(req-package skewer-mode + :defer t + :init (progn + (add-hook 'js2-mode-hook #'skewer-mode) + (add-hook 'html-mode-hook #'skewer-html-mode) + (add-hook 'css-mode-hook #'skewer-css-mode))) +#+END_SRC + +**** js2-mode + +This mode is really great for editing Javascript. It turns code into +an AST internally, so it can work with it almost like a lisp. I don’t +think there’s anything as good as paredit/redshank for refactoring in +it though + +#+BEGIN_SRC emacs-lisp + (req-package js2-mode + :mode ("\\.js\\'" . js2-mode) + :config (progn + (defun ap/javascript-setup () + (autopair-mode -1) + (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))) + + (add-to-list 'auto-mode-alist '("composer\\.lock" . js-mode)) +#+END_SRC + +**** tern + +Tern understands javascript. It adds really clever documented +completions, besides other IDE-like things. + +#+BEGIN_SRC emacs-lisp + (req-package tern + :commands ap/enable-tern + :config (progn + (setq tern-command (list (executable-find "tern"))) + (defun ap/enable-tern () + (tern-mode 1)) + (add-hook 'js2-mode-hook #'ap/enable-tern))) + + (req-package tern-company + :require (tern company)) +#+END_SRC + +**** json-mode + +#+BEGIN_SRC emacs-lisp +(req-package json-mode + :mode ("\\.json\\'" . json-mode)) +#+END_SRC + +**** restclient + +Restclient is really nice. It’s like a scratchpad for HTTP api +calls. Feels a bit like using =org-babel=. I wonder if there’s an +integration between the two yet. + +#+BEGIN_SRC emacs-lisp +(req-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))) +#+END_SRC + +**** sgml-mode + +This is for HTML, since old versions of HTML were derived from SGML. +#+BEGIN_SRC emacs-lisp +(req-package sgml-mode + :defer t + :config (setq sgml-basic-offset 4)) +#+END_SRC + +**** emmet-mode + +Emmet is really nice to write HTML quickly. Especially with +frameworks that require multiple nested elements to do anything useful. +#+BEGIN_SRC emacs-lisp +(req-package emmet-mode + :commands (emmet-mode) + :diminish (emmet-mode . " >") + :init (progn + (if (functionp 'web-mode) + (add-hook 'web-mode-hook #'emmet-mode)))) +#+END_SRC + +**** web-mode + +This mode handles just about every templating language out ther, which +is really nice, because it handles the HTML part the same way in all +of them as well. + +#+BEGIN_SRC emacs-lisp +(req-package web-mode + :mode (("/views/.*\\.php\\'" . web-mode) + ("/layouts/.*\\.html\\'" . web-mode) + ("/templates/.*\\.php\\'" . web-mode) + ("\\.ejs\\'" . web-mode)) + :config (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)) +#+END_SRC + +I derived a mode for twig, in order to use its =mode-hook=. + +#+BEGIN_SRC emacs-lisp +(define-derived-mode twig-mode web-mode "Twig") +(add-to-list 'auto-mode-alist '("\\.html\\.twig\\'" . twig-mode)) +#+END_SRC + +**** mmm-mode + +With =web-mode= being so good, I don’t really use this much. It’s +good for embedded SQL though. + +#+BEGIN_SRC emacs-lisp +(req-package mmm-auto + :config (progn + (mmm-add-classes + '((php-sql + :submode sql-mode + :front "<<" . ispell-word)) + :config (progn + (setq ispell-program-name "aspell" + ispell-dictionary "british"))) +#+END_SRC + +**** TODO Set up some functions to switch between en-GB and de-DE + +** Scripting + +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) + +(req-package sh-script + :mode (("\\.zsh\\'" . shell-script-mode)) + :config (setq sh-shell-file "/usr/bin/env zsh")) +#+END_SRC + +*** eshell + +I should try to get into the habit of using this more. It’s really +nice, when I remember to use it. + +#+BEGIN_SRC emacs-lisp +(req-package eshell + :bind ("C-c s" . eshell) + :config (progn + (setq eshell-directory-name "~/.emacs.d/eshell") + (add-hook 'eshell-load-hook (lambda () + (bind-key "C-c C-l" #'helm-eshell-history eshell-mode-map))) + (req-package em-smart + :config (progn + (setq eshell-where-to-jump 'begin + eshell-review-quick-commands nil + eshell-smart-space-goes-to-end t) + (eshell-smart-initialize))))) + +(autoload #'eshell/cd "em-dirs") +(defun eshell-goto-current-dir (&optional arg) + (interactive "P") + (let ((dir default-directory)) + (eshell arg) + (eshell/cd dir))) +(bind-key "C-c S" #'eshell-goto-current-dir) +#+END_SRC + +**** Shells + +#+BEGIN_SRC emacs-lisp +(req-package shell + :defer t + :config (define-key shell-mode-map + (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) + +(req-package comint + :defer t + :config (bind-key "C-c C-l" #'helm-comint-input-ring comint-mode-map)) + +(req-package multi-term + :if (not (eq system-type 'windows-nt)) + :bind ("C-`" . multi-term-dedicated-toggle)) + +(defun comint-delchar-or-eof-or-kill-buffer (arg) + (interactive "p") + (if (null (get-buffer-process (current-buffer))) + (kill-buffer) + (comint-delchar-or-maybe-eof arg))) +#+END_SRC + +**** TODO Do I need multi-term? + +** Text editing + +Emacs has an editor within. + +#+BEGIN_SRC emacs-lisp + (put 'upcase-region 'disabled nil) + (put 'downcase-region 'disabled nil) + (setq sentence-end-double-space t + line-move-visual nil) +#+END_SRC + +*** align + +=Align= is a useful command to line things up, once given some rules. +The most important one for me is JSON property alignment. + +#+BEGIN_SRC emacs-lisp +(req-package align + :config (progn + (add-to-list 'align-rules-list + '(colon-key-value + (regexp . ":\\(\\s-*\\)") + (modes . '(js2-mode)))))) +#+END_SRC + +*** Clipboard + +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)) +(when (boundp 'x-select-request-type) + (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))) +#+END_SRC + +*** Selection + +I’m quite used to deleting text by selecting it and typing. Emacs has +a mode for that. + +#+BEGIN_SRC emacs-lisp + (delete-selection-mode t) +#+END_SRC + +Isearch has a keybind for searching for the currently-selected word. + I often want to use a symbol though, so this comes in handy. [[http://blog.jorgenschaefer.de/2012/11/emacs-search-for-symbol-at-point.html][Source]] + +#+BEGIN_SRC emacs-lisp +(defun fc/isearch-yank-symbol () + "Yank the symbol at point into the isearch minibuffer. + +C-w does something similar in isearch, but it only looks for +the rest of the word. I want to look for the whole string. And +symbol, not word, as I need this for programming the most." + (interactive) + (isearch-yank-string + (save-excursion + (when (and (not isearch-forward) + isearch-other-end) + (goto-char isearch-other-end)) + (thing-at-point 'symbol)))) +(bind-key "C-d" #'fc/isearch-yank-symbol isearch-mode-map) +#+END_SRC + +Sub-word movement is really nice for camel- and Pascal-case + +#+BEGIN_SRC emacs-lisp +(req-package subword + :init (global-subword-mode t)) +#+END_SRC + +I find that =zap-up-to-char= normally makes more sense to me than +=zap-to-char=. + +#+BEGIN_SRC emacs-lisp +(req-package misc + :bind (("M-z" . zap-up-to-char) + ("M-Z" . zap-to-char))) +#+END_SRC + +Expanding the region by semantic units was something I quite liked +from Sublime Text. As always, there’s a mode for that. + +#+BEGIN_SRC emacs-lisp +(req-package expand-region + :bind ("C-M-SPC" . er/expand-region)) +#+END_SRC + +*** Typography + +I like using typographic symbols, but I don’t always remember (how) to +type them. + +#+BEGIN_SRC emacs-lisp +(req-package typopunct + :config (progn + (typopunct-change-language 'english t) + (defconst typopunct-minus (decode-char 'ucs #x2212)) + (defadvice typopunct-insert-typographical-dashes + (around minus-or-pm activate) + (cond + ((or (eq (char-before) typopunct-em-dash) + (looking-back "\\([[:blank:]]\\|^\\)\\^")) + (delete-char -1) + (insert typopunct-minus)) + ((looking-back "[^[:blank:]]\\^") + (insert typopunct-minus)) + (t ad-do-it))) + + (defconst typopunct-ellipsis (decode-char 'ucs #x2026)) + (defconst typopunct-middot (decode-char 'ucs #xB7)) ; or 2219 + (defun typopunct-insert-ellipsis-or-middot (arg) + "Change three consecutive dots to a typographical ellipsis mark." + (interactive "p") + (cond + ((and (= 1 arg) + (eq (char-before) ?^)) + (delete-char -1) + (insert typopunct-middot)) + ((and (= 1 arg) + (eq this-command last-command) + (looking-back "\\.\\.")) + (replace-match "") + (insert typopunct-ellipsis)) + (t + (self-insert-command arg)))) + (define-key typopunct-map "." 'typopunct-insert-ellipsis-or-middot) + + (defconst typopunct-times (decode-char 'ucs #xD7)) + (defun typopunct-insert-times (arg) + (interactive "p") + (if (and (= 1 arg) (looking-back "\\([[:blank:]]\\|^\\)\\^")) + (progn (delete-char -1) + (insert typopunct-times)) + (self-insert-command arg))) + (define-key typopunct-map "x" 'typopunct-insert-times) + + (defadvice typopunct-insert-quotation-mark (around wrap-region activate) + (let* ((lang (or (get-text-property (point) 'typopunct-language) + typopunct-buffer-language)) + (omark (if single + (typopunct-opening-single-quotation-mark lang) + (typopunct-opening-quotation-mark lang))) + (qmark (if single + (typopunct-closing-single-quotation-mark lang) + (typopunct-closing-quotation-mark lang)))) + (cond + (mark-active + (let ((skeleton-end-newline nil) + (singleo (typopunct-opening-single-quotation-mark lang)) + (singleq (typopunct-closing-single-quotation-mark lang))) + (if (> (point) (mark)) + (exchange-point-and-mark)) + (save-excursion + (while (re-search-forward (regexp-quote (string omark)) (mark) t) + (replace-match (regexp-quote (string singleo)) nil nil))) + (save-excursion + (while (re-search-forward (regexp-quote (string qmark)) (mark) t) + (replace-match (regexp-quote (string singleq)) nil nil))) + (skeleton-insert (list nil omark '_ qmark) -1))) + ((looking-at (regexp-opt (list (string omark) (string qmark)))) + (forward-char 1)) + (t ad-do-it))))) + :init (progn + (add-hook 'text-mode-hook #'typopunct-mode))) +#+END_SRC + +*** avy + +Avy is a really nice way to move around files, like ace-jump-mode, but +somehow I prefer it. + +#+BEGIN_SRC emacs-lisp +(req-package avy + :bind* (("M-g g" . avy-goto-line) + ("M-g M-g" . avy-goto-line) + ("C-|" . avy-goto-line) + ("C-c SPC" . avy-goto-char)) + :config (progn + (avy-setup-default) + (setq avy-all-windows nil))) +#+END_SRC + +*** goto-chg + +This is like popping the mark, only it filters to only change areas +and doesn’t go back to the same place more than once. + +#+BEGIN_SRC emacs-lisp +(req-package goto-chg + :bind ("C-x SPC" . goto-last-change)) +#+END_SRC + +*** helm-swoop + +This fits somewhere between isearch and grep. For me, I didn’t +realise how useful it was until I actually tried it. + +#+BEGIN_SRC emacs-lisp +(req-package helm-swoop + :bind (("C-=" . helm-swoop) + ("C-c C-=" . helm-multi-swoop)) + :init (progn + (bind-key "C-=" #'helm-swoop isearch-mode-map) + (bind-key "C-=" #'helm-multi-swoop-all-from-helm-swoop))) +#+END_SRC + +*** multiple-cursors + +I mentioned before that I’d used Sublime Text before. Multiple +cursors was one of my favourite features, so I was really happy when I +saw that multiple-cursors was released for Emacs. + +#+BEGIN_SRC emacs-lisp +(req-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-" #'mc/mark-all-like-this-dwim) + (bind-key "C-" #'mc/mark-more-like-this-extended) + (bind-key "C-S-L" #'mc/edit-lines))) +#+END_SRC + +*** paredit + +Balanced parentheses in lisps are nice, but all the refactoring and +movement commands are much more interesting. + +#+BEGIN_SRC emacs-lisp +(req-package paredit + :diminish "()" + :commands (paredit-mode) + :init (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 'minibuffer-setup-hook #'conditionally-enable-paredit-mode) + (defun conditionally-enable-paredit-mode () + "enable paredit-mode during eval-expression" + (if (eq this-command 'eval-expression) + (paredit-mode 1))))) +#+END_SRC + +*** smartparens + +I like to use smartparens where paredit isn’t already useful. Somehow +I didn’t find smartparens’ implementation of paredit style to be as +nice as the real version + +#+BEGIN_SRC emacs-lisp +(req-package smartparens-config + :config (progn + (sp-use-smartparens-bindings) + (fset 'wrap-with-paren "\C-](") ;; `sp-select-next-thing-exchange' + (bind-key "C-(" #'wrap-with-paren sp-keymap) + (bind-key "C-)" #'sp-forward-slurp-sexp sp-keymap) + (bind-key "M-" #'backward-kill-word sp-keymap) + (bind-key "M-?" #'sp-convolute-sexp sp-keymap) + (bind-key "C-M-t" #'sp-transpose-sexp sp-keymap) + (bind-key "M-r" #'sp-raise-sexp sp-keymap) + (bind-key "M-s" #'sp-splice-sexp sp-keymap) + (bind-key "M-S" #'sp-split-sexp sp-keymap) + (bind-key "M-J" #'sp-join-sexp sp-keymap) + (bind-key "M-" #'sp-splice-sexp-killing-backward sp-keymap) + (bind-key "M-" #'sp-splice-sexp-killing-forward sp-keymap) + (bind-key "C-M-S-k" #'sp-kill-hybrid-sexp sp-keymap) + (bind-key "C-S-" #'sp-slurp-hybrid-sexp sp-keymap) + (sp-with-modes '(web-mode 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))) +#+END_SRC + +*** move-text + +Transposing lines, made easier. + +#+BEGIN_SRC emacs-lisp +(req-package move-text + :config (move-text-default-bindings)) +#+END_SRC + +*** undo-tree + +Emacs’ default handling of undo is a bit confusing. Undo-tree makes +it much clearer. It’s especially helpful for protoyping and refactoring. + +#+BEGIN_SRC emacs-lisp +(req-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))) + :diminish undo-tree-mode) +#+END_SRC + +*** visual-regexp + +I don’t always remember exactly how Emacs’ regular expressions work, +so this package is pretty useful because it highlights everything in +the buffer for me. + +#+BEGIN_SRC emacs-lisp +(req-package visual-regexp + :bind (("C-c r" . vr/replace) + ("C-c q" . vr/query-replace) + ("C-c m" . vc/mc-mark))) +#+END_SRC +* Tangling + +Taken from [[https://github.com/larstvei/dot-emacs/blob/master/init.org][larstvei/dot-emacs]]. I changed it so that it would work with +my current dotfiles repository structure. + +We can use =C-c C-v t= to run =org-babel-tangle=, which extracts the +code blocks from the current file into a source-specific file (in this +case a =.el=-file). + +To avoid doing this each time a change is made we can add a function +to the =after-save-hook= ensuring to always tangle and byte-compile +the =org=-document after changes. + +#+BEGIN_SRC emacs-lisp + (defun tangle-init () + "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)) + ;; Avoid running hooks when tangling. + (let ((prog-mode-hook nil)) + (org-babel-tangle) + (byte-compile-file (concat user-emacs-directory "init.el"))))) +#+END_SRC + +# Local Variables: +# eval: (when (fboundp #'tangle-init) (add-hook 'after-save-hook #'tangle-init)) +# End: +* End + +#+BEGIN_SRC emacs-lisp +(req-package-finish) +#+END_SRC + +Start a server if possible. A daemon is already a server. +#+BEGIN_SRC emacs-lisp +(unless (daemonp) + (require 'server) + (if (server-running-p server-name) + (message "Server already appears to be running") + (server-start))) +#+END_SRC -- cgit 1.4.1 From 524b053281cf63a0c6df0340ed9237c2866bf309 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 Jul 2015 10:48:24 +0200 Subject: Emacs: Use magit popups in the default way --- tag-emacs/emacs.d/init.org | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 8cfb1c9b..2a473271 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -240,12 +240,13 @@ Magit is my favourite way to use git. I use selective staging all the time. Make sure to set it up with a nice =completing-read-function= #+BEGIN_SRC emacs-lisp -(req-package magit - :commands (magit-status) - :config (progn (rename-modeline magit-status-mode (char-to-string (-find #'char-displayable-p '(11942 5848 177)))) - (setq magit-last-seen-setup-instructions "1.4.0" - magit-completing-read-function #'magit-ido-completing-read)) - :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) + (req-package magit + :commands (magit-status) + :config (progn (rename-modeline magit-status-mode (char-to-string (-find #'char-displayable-p '(11942 5848 177)))) + (setq magit-last-seen-setup-instructions "1.4.0" + magit-completing-read-function #'magit-ido-completing-read + magit-popup-use-prefix-argument 'default)) + :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) #+END_SRC ** Styles -- cgit 1.4.1 From db3233c23678ec4884ee19386e95e1dcb90c04cb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 Jul 2015 11:10:25 +0200 Subject: Emacs: Remove file startup options --- tag-emacs/emacs.d/init.org | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 2a473271..683dea74 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1,4 +1,3 @@ -#+STARTUP: noindent showstars content #+TITLE: Emacs Configuration for Alan Pearce #+PROPERTY: results silent #+PROPERTY: eval no-export -- cgit 1.4.1 From 2c71fa04740e3c400bd042983a55a3bd03d68599 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 Jul 2015 11:13:12 +0200 Subject: Whitespace fixes --- tag-emacs/emacs.d/init.org | 116 ++++++++++++++++++++++----------------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 683dea74..4507e5ff 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -348,10 +348,10 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource Allow font-lock-mode to do background parsing. I’m not really sure if these settings are particularly useful #+BEGIN_SRC emacs-lisp -(setq jit-lock-stealth-time 1 - jit-lock-stealth-load 100 - jit-lock-chunk-size 1000 - jit-lock-defer-time 0.01) + (setq jit-lock-stealth-time 1 + jit-lock-stealth-load 100 + jit-lock-chunk-size 1000 + jit-lock-defer-time 0.01) #+END_SRC ** Files @@ -571,22 +571,22 @@ Don’t make me think, just indent it! Unless it’s a whitespace-sensitive language, of course. #+BEGIN_SRC emacs-lisp -(req-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 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-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) - (auto-indent-global-mode))) + (req-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 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-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) + (auto-indent-global-mode))) #+END_SRC **** TODO Check for auto-indentation of whitespace-sensitive languages. @@ -1531,56 +1531,56 @@ Org is wünderbar. **** TODO Check whether all this configuration is necessary or helpful. #+BEGIN_SRC emacs-lisp -(req-package org - :bind (("C-c C-a" . org-agenda-list) - ("C-c a" . org-agenda) - ("C-c l" . org-store-link)) - :init (setq org-replace-disputed-keys t) - :config (progn - (setq org-directory "~/org" - org-agenda-files `(,org-directory) + (req-package org + :bind (("C-c C-a" . org-agenda-list) + ("C-c a" . org-agenda) + ("C-c l" . org-store-link)) + :init (setq org-replace-disputed-keys t) + :config (progn + (setq org-directory "~/org" + org-agenda-files `(,org-directory) - 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-checklist) + org-modules '(org-habit + org-checklist) - ;; 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-pretty-entities t + org-pretty-entities t - org-table-duration-custom-format 'seconds + org-table-duration-custom-format 'seconds - org-src-fontify-natively t + org-src-fontify-natively t - 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 "TODO" "STARTED" "|" "DONE") - (sequence "TOLEARN" "LEARNING" "LEARNED" "|" "MASTERED") - (sequence "|" "CANCELLED"))) - (set-register ?o `(file . ,(expand-file-name "organiser.org" org-directory))) - (add-hook 'org-mode-hook #'turn-on-auto-fill) - (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 "TODO" "STARTED" "|" "DONE") + (sequence "TOLEARN" "LEARNING" "LEARNED" "|" "MASTERED") + (sequence "|" "CANCELLED"))) + (set-register ?o `(file . ,(expand-file-name "organiser.org" org-directory))) + (add-hook 'org-mode-hook #'turn-on-auto-fill) + (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 -- cgit 1.4.1 From 6dc5aac9a76f06c2ad6876b043f09fbff6c0bd78 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 Jul 2015 11:13:22 +0200 Subject: Emacs: Don’t force-enable org-indent-mode --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 4507e5ff..deaa0330 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -580,6 +580,7 @@ whitespace-sensitive language, of course. 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) -- cgit 1.4.1 From cf097a882af4b7b3510c68c70858dd88a8a52cff Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 Jul 2015 11:36:56 +0200 Subject: Dedent Emacs configuration --- tag-emacs/emacs.d/init.org | 266 ++++++++++++++++++++++----------------------- 1 file changed, 132 insertions(+), 134 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index deaa0330..18a6f97e 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -4,17 +4,15 @@ #+PROPERTY: header-args :tangle yes :comments link * Introduction This is a living document, detailing my Emacs configuration using org-mode -* Emacs Configuration - -** Basics -*** Startup +* Basics +** Startup Open Emacs with just a plain window. No graphics or messages, please! #+BEGIN_SRC emacs-lisp (setq inhibit-startup-echo-area-message "alan") (setq inhibit-startup-screen t) #+END_SRC -*** Scratch buffers +** Scratch buffers I usually use scratch buffers for any sort of text. If I need a programming mode in one, then I’ll just call it manually. I also like the buffer to be empty. @@ -23,13 +21,13 @@ the buffer to be empty. initial-major-mode 'text-mode) #+END_SRC -*** Personal Information +** Personal Information #+BEGIN_SRC emacs-lisp (setq user-mail-address "alan@alanpearce.co.uk" user-full-name "Alan Pearce") #+end_src -*** Customize +** Customize I don’t really like using customize for normal configuration. Instead, I use it for things that get saved automatically. That’s why I use a different file, which is ignored by the VCS. It also means @@ -42,7 +40,7 @@ pass =:noerror= to =load= #+END_SRC -** Packaging +* Packaging I still use a couple of [[file:elisp/][elisp files]] that don’t appear to be in any package archives. @@ -50,9 +48,9 @@ archives. (add-to-list 'load-path (expand-file-name "elisp/" user-emacs-directory)) #+END_SRC -*** TODO Move [[file:elisp/ap-functions.el][=ap-functions=]] into this file and delete above +** TODO Move [[file:elisp/ap-functions.el][=ap-functions=]] into this file and delete above -*** Cask +** Cask For most packages, I use [[https://github.com/cask/cask][cask]] #+BEGIN_SRC emacs-lisp @@ -61,7 +59,7 @@ For most packages, I use [[https://github.com/cask/cask][cask]] (cask-initialize) #+END_SRC -**** Cask commands +*** Cask commands Installing #+BEGIN_SRC sh :tangle no @@ -83,7 +81,7 @@ Update old packages cask update #+END_SRC -*** Req-package +** Req-package #+BEGIN_SRC emacs-lisp (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") @@ -99,7 +97,7 @@ cask update (setq use-package-verbose t) #+END_SRC -*** Pallet +** Pallet I use [[https://github.com/rdallasgray/pallet][pallet]] to keep my [[file:Cask][Caskfile]] up-to-date with packages installed from inside Emacs. I don’t need it on startup, so I tell @@ -112,7 +110,7 @@ from inside Emacs. I don’t need it on startup, so I tell #+END_SRC -** Helpers +* Helpers I like to rename modeline lighters. This macro works for major modes. #+BEGIN_SRC emacs-lisp (defmacro rename-modeline (mode new-name) @@ -120,7 +118,7 @@ from inside Emacs. I don’t need it on startup, so I tell (setq mode-name ,new-name))) #+END_SRC -** Projects +* Projects #+BEGIN_SRC emacs-lisp (defvar work-project-directory "~/work") @@ -133,7 +131,7 @@ from inside Emacs. I don’t need it on startup, so I tell (projectile-persp-switch-project (expand-file-name "dotfiles" home-project-directory))) #+END_SRC -*** Projectile +** Projectile Projectile is awesome for working in projects, especially VCS-backed ones. I added a couple of functions to allow me to open new projects @@ -181,7 +179,7 @@ based upon some folder conventions I use. projectile-completion-system 'helm))) #+END_SRC -*** projector +** projector Project-based shell buffers sounds like a good idea, but for some reason I haven’t found a use for it. @@ -192,7 +190,7 @@ reason I haven’t found a use for it. :bind (("s-z" . projector-open-project-shell))) #+END_SRC -*** perspective +** perspective This package makes buffer-switching inside of projects make sense, by filtering the candidates to those within the project. For it to work, @@ -208,7 +206,7 @@ it needs hooking into projectile and a key bound to switch between projects. :require (projectile perspective)) #+END_SRC -*** vc +** vc This is nice for some things that magit doesn’t do, and for those rare occasions that I’m working with something other than git. @@ -221,7 +219,7 @@ occasions that I’m working with something other than git. (setq vc-follow-symlinks t))) #+END_SRC -*** diff-hl +** diff-hl It’s nice to be able to see at a glance which lines of a file have changed. This package colours the fringe @@ -233,7 +231,7 @@ changed. This package colours the fringe (add-hook 'magit-refresh-file-buffer-hook #'diff-hl-update))) #+END_SRC -*** magit +** magit Magit is my favourite way to use git. I use selective staging all the time. Make sure to set it up with a nice =completing-read-function= @@ -248,7 +246,7 @@ time. Make sure to set it up with a nice =completing-read-function= :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) #+END_SRC -** Styles +* Styles I prefer an always-visible cursor. Feels less distracting. #+BEGIN_SRC emacs-lisp @@ -286,7 +284,7 @@ locking for it. (dash--enable-fontlock 'dash-enable-font-lock t))) #+END_SRC -*** Colours +** Colours I quite like solarized. I don’t think it’s perfect, but it supports a lot of modes. @@ -315,7 +313,7 @@ Highlighting quasi-quoted expressions in lisps is quite useful. (add-hook 'lisp-mode-common-hook #'highlight-stages-mode))) #+END_SRC -*** Fonts +** Fonts 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]]. @@ -354,9 +352,9 @@ these settings are particularly useful jit-lock-defer-time 0.01) #+END_SRC -** Files +* Files -*** Auto-saving +** Auto-saving Auto-save everything to a temporary directory, instead of cluttering the filesystem. I don’t want emacs-specific lockfiles, either. @@ -365,7 +363,7 @@ the filesystem. I don’t want emacs-specific lockfiles, either. (setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t)) create-lockfiles nil) #+END_SRC -*** Backups +** Backups I like to keep my backups out of regular folders. I tell emacs to use a subfolder of its configuration directory for that. Also, use the @@ -381,7 +379,7 @@ trash for deleting on OS X. (setq delete-by-moving-to-trash t)) #+END_SRC -*** autorevert +** autorevert #+BEGIN_SRC emacs-lisp (req-package autorevert @@ -390,7 +388,7 @@ trash for deleting on OS X. (setq auto-revert-verbose nil))) #+END_SRC -*** Encoding +** Encoding #+BEGIN_SRC emacs-lisp (prefer-coding-system 'utf-8-auto-unix) @@ -398,7 +396,7 @@ trash for deleting on OS X. (setq-default buffer-file-coding-system 'utf-8-auto-unix) #+END_SRC -*** Buffer-file management +** Buffer-file management Ask if I want to create a directory when it doesn’t exist. This is especially nice when starting new projects. @@ -459,7 +457,7 @@ with a buffer. (kill-buffer buf))))) #+END_SRC -*** Whitespace Butler +** Whitespace Butler I don’t like it when editors change an entire file’s layout when I open it. Whitespace butler fixes whitespace only for lines that I’m editing. @@ -472,7 +470,7 @@ open it. Whitespace butler fixes whitespace only for lines that I’m editing. (add-hook #'before-make-frame-hook (lambda () (ws-butler-global-mode 1)))) #+END_SRC -*** fasd +** fasd Fasd is a nice shell plugin that remembers file and folder arguments, making it easy to re-visit them later. This package hooks into that. @@ -485,7 +483,7 @@ I don’t seem to use it much though. (global-fasd-mode 1))) #+END_SRC -*** recentf +** recentf I only use this occasionally, but it’s nice for files outside of projects. @@ -496,7 +494,7 @@ I only use this occasionally, but it’s nice for files outside of projects. (recentf-mode 1))) #+END_SRC -*** saveplace +** saveplace It.. saves the position I visited a file at last. Might try turning it off to see if I notice it. @@ -507,7 +505,7 @@ it off to see if I notice it. (setq save-place-file (expand-file-name ".saveplace" user-emacs-directory)))) #+END_SRC -*** Tramp +** Tramp Tramp is awesome. It makes SSH feel Unix-y. The proxy setup is so that I can sudo on remote machines @@ -538,7 +536,7 @@ that I can sudo on remote machines (add-to-list 'tramp-remote-path "~/bin"))) #+END_SRC -*** ediff +** ediff I like a horizonal diff setup, with everything in one frame. @@ -550,7 +548,7 @@ I like a horizonal diff setup, with everything in one frame. ediff-window-setup-function 'ediff-setup-windows-plain))) #+END_SRC -** Indentation +* 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! @@ -565,7 +563,7 @@ tabstops. Until then, I want 4-wide tabs, and make them real tabs! '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120)) #+END_SRC -*** auto-indent-mode +** auto-indent-mode Don’t make me think, just indent it! Unless it’s a whitespace-sensitive language, of course. @@ -590,9 +588,9 @@ whitespace-sensitive language, of course. (auto-indent-global-mode))) #+END_SRC -**** TODO Check for auto-indentation of whitespace-sensitive languages. +*** TODO Check for auto-indentation of whitespace-sensitive languages. -*** smart-tabs-mode +** smart-tabs-mode Not related to [[smart-tab][=smart-tab=]], this mode indents with tabs and aligns with spaces. Perfect! @@ -608,9 +606,9 @@ with spaces. Perfect! (smart-tabs-insinuate 'c 'javascript 'cperl 'python))) #+END_SRC -** Security +* Security -*** password-store +** password-store This is a frontend to the GPG-powered =pass= program. #+BEGIN_SRC emacs-lisp @@ -618,9 +616,9 @@ This is a frontend to the GPG-powered =pass= program. :config (progn (setq password-store-password-length 16))) #+END_SRC -** Buffers +* Buffers -*** Ibuffer +** Ibuffer Ibuffer is quite nice for listing all buffers. I don’t use it very often though, as it doesn’t really work with perspectives. @@ -657,7 +655,7 @@ often though, as it doesn’t really work with perspectives. filename-and-process))))) #+END_SRC -*** Uniqify +** Uniqify Sometimes projects have files with the same name. This gives them unique names, by adding enough path elements to make them unambiguous. @@ -671,7 +669,7 @@ unique names, by adding enough path elements to make them unambiguous. uniquify-ignore-buffers-re "^\\*"))) #+END_SRC -*** Narrowing +** Narrowing Enable it without prompting @@ -681,7 +679,7 @@ Enable it without prompting (put 'narrow-to-region 'disabled nil) #+END_SRC -*** Fancy Narrow +** Fancy Narrow Sometimes I like to be able to focus on one block of code at a time. Normally narrowing hides everything else completely, which I don’t @@ -692,14 +690,14 @@ like. This package just makes everything else lower-contrast. :config (fancy-narrow-mode 1)) #+END_SRC -*** ace-jump-buffer +** ace-jump-buffer #+BEGIN_SRC emacs-lisp (use-package ace-jump-buffer :bind ("s-b" . ace-jump-buffer)) #+END_SRC -*** ace-window +** ace-window I don’t often have many windows open at once, but when I do, =ace-window= is really nice to jump around them in the same way that @@ -722,7 +720,7 @@ I don’t often have many windows open at once, but when I do, aw-keys '(?a ?r ?s ?t ?n ?e ?i ?o)))) #+END_SRC -** Windows +* Windows Scrolling is tricky. I use this setup to help me keep track of the point whilst I’m moving about. @@ -753,7 +751,7 @@ A dedicated window always keeps the same buffer in view. "normal"))) #+END_SRC -*** popwin +** popwin This works really nicely wiht helm. I should think about whether it might be useful elsewhere @@ -767,7 +765,7 @@ might be useful elsewhere (add-to-list 'popwin:special-display-config '("^*helm.+*$" :regexp t :height 20)))) #+END_SRC -*** winner +** winner Undo, for window-based commands. @@ -778,7 +776,7 @@ Undo, for window-based commands. (setq winner-boring-buffers '("*Completions*" "*Help*" "*Apropos*" "*Buffer List*" "*info*" "*Compile-Log*")))) #+END_SRC -*** windmove +** windmove Directional window movement @@ -789,7 +787,7 @@ Directional window movement ("S-" . windmove-up) ("S-" . windmove-down))) #+END_SRC -** Completion +* Completion Make built-in completion a bit more intelligent, by adding substring and initial-based completion and ignoring case. @@ -841,9 +839,9 @@ seems to work perfectly well for me. company-dabbrev-downcase nil))) #+END_SRC -** Dates & Times +* Dates & Times -*** Calendar +** Calendar Weeks start on Monday for me and I prefer ISO-style dates. #+BEGIN_SRC emacs-lisp @@ -875,7 +873,7 @@ Sometimes I want to insert a date or time into a buffer. (insert (format-time-string format)))) #+END_SRC -** Directories +* Directories Dired works quite nicely, but not always in the way I want. I don’t like having so many prompts for recursive operations. Also, when I @@ -956,9 +954,9 @@ Expand subfolders like a tree inside the parent (bind-key "i" #'dired-subtree-toggle dired-mode-map))) #+END_SRC -** Documentation +* Documentation -*** helm-dash +** helm-dash Emacs’ documentation is great to read from inside Emacs. Helm-dash helps to make documentation for other languages easier to access @@ -990,7 +988,7 @@ helps to make documentation for other languages easier to access (ap/create-helm-dash-hook sql ("PostgreSQL" "MySQL")))) #+END_SRC -*** which-func +** which-func Use the modeline to show which function definition the point is in. @@ -1000,7 +998,7 @@ Use the modeline to show which function definition the point is in. :config (setq which-func-modes t)) #+END_SRC -*** discover-my-major +** discover-my-major A nicer way to browse keybindings for major modes. @@ -1009,7 +1007,7 @@ A nicer way to browse keybindings for major modes. :bind ("C-h C-m" . discover-my-major)) #+END_SRC -*** discover +** discover Makes some context menus for dired and other things, similarly to the way magit’s popups work. @@ -1019,7 +1017,7 @@ way magit’s popups work. :config (global-discover-mode)) #+END_SRC -*** eldoc +** eldoc Documentation in the echo-area (where the minibuffer is displayed) is rather useful. @@ -1032,7 +1030,7 @@ rather useful. (setq eldoc-idle-delay 0.1) (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) #+END_SRC -** Keybindings +* Keybindings I think =set-keyboard-coding-system= stops OS X from doing something annoying to add accents. The modifier setup is to match my @@ -1082,7 +1080,7 @@ Option/alt, then Control. (bind-key "s-," #'switch-to-dotfiles) (set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) #+END_SRC -** Misc +* Misc #+BEGIN_SRC emacs-lisp (defvar *init-file* @@ -1146,7 +1144,7 @@ org’s navigation commands. (add-hook 'emacs-lisp-mode-hook 'imenu-elisp-sections) #+END_SRC -** Minibuffer +* Minibuffer Sometimes I want to use the minibuffer, but I’m already inside it. Fortunately, this is possible. Of course, I need to know how many @@ -1170,7 +1168,7 @@ Occasionally, I exit emacs. I should probably reduce the frequency of this. (defalias 'exit-emacs #'save-buffers-kill-emacs)) #+END_SRC -*** helm +** helm I like to use =helm= for some completions, especially when there are lots of candidates. @@ -1195,7 +1193,7 @@ lots of candidates. (define-key helm-read-file-map (kbd "C-z") #'helm-select-action))) #+END_SRC -*** ido +** ido I really like ido. It’s part of emacs, it does flex matching nicely and it’s pretty configurable. @@ -1224,9 +1222,9 @@ and it’s pretty configurable. (bind-key "C-c C-s" #'ido-manual-merge ido-file-dir-completion-map))) #+END_SRC -**** TODO Figure out whether the merge stuff is useful. +*** TODO Figure out whether the merge stuff is useful. -**** ido-completing-read+ +*** ido-completing-read+ This is mostly a dependency of =magit=. #+BEGIN_SRC emacs-lisp @@ -1237,10 +1235,10 @@ This is mostly a dependency of =magit=. ido-cr+-max-items 2000))) #+END_SRC -***** TODO See if I can use ido-completing-read+ in ido places +**** TODO See if I can use ido-completing-read+ in ido places This would be good for finding files in projects. -***** Buffer switching within projects +**** Buffer switching within projects #+BEGIN_SRC emacs-lisp (defun ap/ido-projectile-switch-buffer-dwim (force-ido) @@ -1253,7 +1251,7 @@ This would be good for finding files in projects. (bind-key "s-x s-b" #'ap/ido-projectile-switch-buffer-dwim) #+END_SRC -**** ido-vertical-mode +*** ido-vertical-mode I find ido’s default horizonal presentation of completion candidates to be a little difficult to follow. Of course, there’s always a @@ -1280,7 +1278,7 @@ package for that. :config (ido-vertical-mode 1)) #+END_SRC -**** flx-ido +*** flx-ido I think ido’s flex matching could be a bit better, so I use =flx-ido= for that. It can be slow on large collectinos, but fortunately it can @@ -1294,7 +1292,7 @@ disable itself at that point (setq flx-ido-threshold 1000))) #+END_SRC -*** smex +** smex Smex is my favourite way to use =M-x=. I might try setting up =helm= again, to see whether it’s any better or not. @@ -1321,7 +1319,7 @@ again, to see whether it’s any better or not. (smex-initialize))) #+END_SRC -** Modeline +* Modeline I modified the mode-line format to show me less information. Instead, I put some of it in the frame-line at the top. @@ -1424,7 +1422,7 @@ I put some of it in the frame-line at the top. "%b")))) #+END_SRC -*** Modes +* Modes Setup some modes for systemd files #+BEGIN_SRC emacs-lisp @@ -1495,7 +1493,7 @@ configuration files. (add-to-list 'auto-mode-alist '("\\.sls\\'" . saltstack-mode)) #+END_SRC -**** ledger +** ledger I use [[http://ledger-cli.org/][=ledger=]] to manage my finances. It has an Emacs mode, which works really nicely. @@ -1516,7 +1514,7 @@ works really nicely. ledger-default-date-format "%Y-%m-%d"))) #+END_SRC -**** Markdown +** Markdown #+BEGIN_SRC emacs-lisp (req-package markdown-mode @@ -1525,11 +1523,11 @@ works really nicely. (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) #+END_SRC -*** Org +** Org Org is wünderbar. -**** TODO Check whether all this configuration is necessary or helpful. +*** TODO Check whether all this configuration is necessary or helpful. #+BEGIN_SRC emacs-lisp (req-package org @@ -1584,7 +1582,7 @@ Org is wünderbar. (org-todo "STARTED"))))))) #+END_SRC -***** org-babel +**** org-babel Org’s babel feature is really nice. I use it for this file, and I can use it to communicate between programming languages. Sometime I hope @@ -1601,7 +1599,7 @@ with R or something. (sh . t)))) #+END_SRC -***** org-journal +**** org-journal I can use this to keep a journal. I should use it. @@ -1613,9 +1611,9 @@ I can use this to keep a journal. I should use it. (setq org-journal-date-format "%A, %d %B %Y"))) #+END_SRC -***** org-mobile +**** org-mobile -****** TODO Setup org-mobile +***** TODO Setup org-mobile #+BEGIN_SRC emacs-lisp (req-package org-mobile :require org @@ -1624,10 +1622,10 @@ I can use this to keep a journal. I should use it. (setq org-mobile-directory "~/Mobile/Org"))) #+END_SRC -** Programming -*** cedet +* Programming +** cedet -**** TODO Setup cedet and see whether it’s useful +*** TODO Setup cedet and see whether it’s useful #+BEGIN_SRC emacs-lisp (req-package cedet @@ -1640,7 +1638,7 @@ I can use this to keep a journal. I should use it. (global-semantic-decoration-mode t))) #+END_SRC -*** flycheck +** flycheck On-the-fly error checking in programming modes? Yes please. @@ -1650,7 +1648,7 @@ On-the-fly error checking in programming modes? Yes please. :init (global-flycheck-mode)) #+END_SRC -*** golang +** golang Go has a few packages to inter-operate with other emacs packages. @@ -1683,7 +1681,7 @@ Go has a few packages to inter-operate with other emacs packages. #+END_SRC -*** ggtags +** ggtags A nice completion backend for programming modes. @@ -1699,9 +1697,9 @@ A nice completion backend for programming modes. (add-hook 'c-mode-common-hook #'turn-on-ggtags-mode))) #+END_SRC -*** Lisps +** Lisps -**** All +*** 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 @@ -1718,7 +1716,7 @@ lisps. Even I understand that. (setq indent-tabs-mode nil)) #+END_SRC -***** Redshank +**** Redshank Lisp syntax allows for really easy refactoring. Redshank gives some operations that aren’t part of paredit, like extracting variables into @@ -1731,7 +1729,7 @@ let bindings. (add-hook 'lisp-mode-common-hook #'turn-on-redshank-mode))) #+END_SRC -**** Emacs Lisp +*** Emacs Lisp Customise the modeline-display of =emacs-lisp-mode=. Then make sure it runs the common lisp hooks. @@ -1781,7 +1779,7 @@ don’t have to worry about a selection. (bind-key "C-c e" #'eval-and-replace) #+END_SRC -**** Scheme & Lisp +*** Scheme & Lisp I don’t work with these as often as I would like @@ -1794,7 +1792,7 @@ I don’t work with these as often as I would like (add-hook 'lisp-mode-hook #'set-common-lisp-indentation) #+END_SRC -***** geiser +**** geiser A REPL thing for Scheme. Hopefully I’ll get to use it more in the future. @@ -1807,7 +1805,7 @@ future. run-racket)) #+END_SRC -***** slime +**** slime A REPL thing (and more) for Lisp. @@ -1822,7 +1820,7 @@ A REPL thing (and more) for Lisp. (setq inferior-lisp-program (executable-find "sbcl")))) #+END_SRC -**** Clojure +*** Clojure #+BEGIN_SRC emacs-lisp (req-package clojure-mode @@ -1842,7 +1840,7 @@ A REPL thing (and more) for Lisp. (add-hook 'clojure-mode-hook #'turn-on-clj-refactor-mode))) #+END_SRC -***** cider +**** cider A REPL thing for Clojure @@ -1856,7 +1854,7 @@ A REPL thing for Clojure (add-hook 'cider-mode-hook #'cider-turn-on-eldoc-mode))) #+END_SRC -*** Auto-compile +** Auto-compile Auto-compile emacs lisp when saving. #+BEGIN_SRC emacs-lisp @@ -1865,7 +1863,7 @@ Auto-compile emacs lisp when saving. :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) #+END_SRC -*** cc-mode +** cc-mode Although I don’t use C or C++, setting up the mode is helpful because quite a few other modes are derived from it. @@ -1883,7 +1881,7 @@ quite a few other modes are derived from it. (c-set-offset 'case-label '+))) #+END_SRC -*** quickrun +** quickrun It’s nice to be able to quickly evaluate some code. Although I don’t really seem to use it. @@ -1892,9 +1890,9 @@ really seem to use it. :bind (("C-c C-e" . quickrun))) #+END_SRC -*** Web development +** Web development -**** skewer-mode +*** skewer-mode I don’t use this as often as I probably should. I should figure out why that is. @@ -1907,7 +1905,7 @@ why that is. (add-hook 'css-mode-hook #'skewer-css-mode))) #+END_SRC -**** js2-mode +*** js2-mode This mode is really great for editing Javascript. It turns code into an AST internally, so it can work with it almost like a lisp. I don’t @@ -1933,7 +1931,7 @@ it though (add-to-list 'auto-mode-alist '("composer\\.lock" . js-mode)) #+END_SRC -**** tern +*** tern Tern understands javascript. It adds really clever documented completions, besides other IDE-like things. @@ -1951,14 +1949,14 @@ completions, besides other IDE-like things. :require (tern company)) #+END_SRC -**** json-mode +*** json-mode #+BEGIN_SRC emacs-lisp (req-package json-mode :mode ("\\.json\\'" . json-mode)) #+END_SRC -**** restclient +*** restclient Restclient is really nice. It’s like a scratchpad for HTTP api calls. Feels a bit like using =org-babel=. I wonder if there’s an @@ -1975,7 +1973,7 @@ integration between the two yet. (add-hook restclient-mode-hook #'imenu-restclient-sections))) #+END_SRC -**** sgml-mode +*** sgml-mode This is for HTML, since old versions of HTML were derived from SGML. #+BEGIN_SRC emacs-lisp @@ -1984,7 +1982,7 @@ This is for HTML, since old versions of HTML were derived from SGML. :config (setq sgml-basic-offset 4)) #+END_SRC -**** emmet-mode +*** emmet-mode Emmet is really nice to write HTML quickly. Especially with frameworks that require multiple nested elements to do anything useful. @@ -1997,7 +1995,7 @@ frameworks that require multiple nested elements to do anything useful. (add-hook 'web-mode-hook #'emmet-mode)))) #+END_SRC -**** web-mode +*** web-mode This mode handles just about every templating language out ther, which is really nice, because it handles the HTML part the same way in all @@ -2025,7 +2023,7 @@ I derived a mode for twig, in order to use its =mode-hook=. (add-to-list 'auto-mode-alist '("\\.html\\.twig\\'" . twig-mode)) #+END_SRC -**** mmm-mode +*** mmm-mode With =web-mode= being so good, I don’t really use this much. It’s good for embedded SQL though. @@ -2062,8 +2060,8 @@ good for embedded SQL though. :init (setq mmm-global-mode 'maybe)) #+END_SRC -***** TODO Setup for javascript + SQL -** Spelling +**** TODO Setup for javascript + SQL +* Spelling #+BEGIN_SRC emacs-lisp (req-package ispell @@ -2073,9 +2071,9 @@ good for embedded SQL though. ispell-dictionary "british"))) #+END_SRC -**** TODO Set up some functions to switch between en-GB and de-DE +*** TODO Set up some functions to switch between en-GB and de-DE -** Scripting +* Scripting Make a shell-script buffer executable after saving it, if it has a shebang. @@ -2088,7 +2086,7 @@ Make a shell-script buffer executable after saving it, if it has a shebang. :config (setq sh-shell-file "/usr/bin/env zsh")) #+END_SRC -*** eshell +** eshell I should try to get into the habit of using this more. It’s really nice, when I remember to use it. @@ -2116,7 +2114,7 @@ nice, when I remember to use it. (bind-key "C-c S" #'eshell-goto-current-dir) #+END_SRC -**** Shells +*** Shells #+BEGIN_SRC emacs-lisp (req-package shell @@ -2139,9 +2137,9 @@ nice, when I remember to use it. (comint-delchar-or-maybe-eof arg))) #+END_SRC -**** TODO Do I need multi-term? +*** TODO Do I need multi-term? -** Text editing +* Text editing Emacs has an editor within. @@ -2152,7 +2150,7 @@ Emacs has an editor within. line-move-visual nil) #+END_SRC -*** align +** align =Align= is a useful command to line things up, once given some rules. The most important one for me is JSON property alignment. @@ -2166,7 +2164,7 @@ The most important one for me is JSON property alignment. (modes . '(js2-mode)))))) #+END_SRC -*** Clipboard +** Clipboard I like to use the clipboard more than the primary selection in X11. @@ -2178,7 +2176,7 @@ I like to use the clipboard more than the primary selection in X11. (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))) #+END_SRC -*** Selection +** Selection I’m quite used to deleting text by selecting it and typing. Emacs has a mode for that. @@ -2231,7 +2229,7 @@ from Sublime Text. As always, there’s a mode for that. :bind ("C-M-SPC" . er/expand-region)) #+END_SRC -*** Typography +** Typography I like using typographic symbols, but I don’t always remember (how) to type them. @@ -2310,7 +2308,7 @@ type them. (add-hook 'text-mode-hook #'typopunct-mode))) #+END_SRC -*** avy +** avy Avy is a really nice way to move around files, like ace-jump-mode, but somehow I prefer it. @@ -2326,7 +2324,7 @@ somehow I prefer it. (setq avy-all-windows nil))) #+END_SRC -*** goto-chg +** goto-chg This is like popping the mark, only it filters to only change areas and doesn’t go back to the same place more than once. @@ -2336,7 +2334,7 @@ and doesn’t go back to the same place more than once. :bind ("C-x SPC" . goto-last-change)) #+END_SRC -*** helm-swoop +** helm-swoop This fits somewhere between isearch and grep. For me, I didn’t realise how useful it was until I actually tried it. @@ -2350,7 +2348,7 @@ realise how useful it was until I actually tried it. (bind-key "C-=" #'helm-multi-swoop-all-from-helm-swoop))) #+END_SRC -*** multiple-cursors +** multiple-cursors I mentioned before that I’d used Sublime Text before. Multiple cursors was one of my favourite features, so I was really happy when I @@ -2367,7 +2365,7 @@ saw that multiple-cursors was released for Emacs. (bind-key "C-S-L" #'mc/edit-lines))) #+END_SRC -*** paredit +** paredit Balanced parentheses in lisps are nice, but all the refactoring and movement commands are much more interesting. @@ -2387,7 +2385,7 @@ movement commands are much more interesting. (paredit-mode 1))))) #+END_SRC -*** smartparens +** smartparens I like to use smartparens where paredit isn’t already useful. Somehow I didn’t find smartparens’ implementation of paredit style to be as @@ -2419,7 +2417,7 @@ nice as the real version (add-hook 'lisp-mode-common-hook #'turn-off-smartparens-mode))) #+END_SRC -*** move-text +** move-text Transposing lines, made easier. @@ -2428,7 +2426,7 @@ Transposing lines, made easier. :config (move-text-default-bindings)) #+END_SRC -*** undo-tree +** undo-tree Emacs’ default handling of undo is a bit confusing. Undo-tree makes it much clearer. It’s especially helpful for protoyping and refactoring. @@ -2451,7 +2449,7 @@ it much clearer. It’s especially helpful for protoyping and refactoring. :diminish undo-tree-mode) #+END_SRC -*** visual-regexp +** visual-regexp I don’t always remember exactly how Emacs’ regular expressions work, so this package is pretty useful because it highlights everything in -- cgit 1.4.1 From fd72b1680ad33c4976c588471b03144655b62911 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 Jul 2015 12:04:38 +0200 Subject: Emacs: Tangle init file asynchronously --- tag-emacs/emacs.d/init.org | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 18a6f97e..1f0dd1ee 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1,7 +1,7 @@ #+TITLE: Emacs Configuration for Alan Pearce #+PROPERTY: results silent #+PROPERTY: eval no-export -#+PROPERTY: header-args :tangle yes :comments link +#+PROPERTY: header-args :comments link * Introduction This is a living document, detailing my Emacs configuration using org-mode * Basics @@ -2464,7 +2464,8 @@ the buffer for me. * Tangling Taken from [[https://github.com/larstvei/dot-emacs/blob/master/init.org][larstvei/dot-emacs]]. I changed it so that it would work with -my current dotfiles repository structure. +my current dotfiles repository structure and work asynchronously, +thanks to [[https://github.com/jwiegley/emacs-async][jwiegley/emacs-async]]. We can use =C-c C-v t= to run =org-babel-tangle=, which extracts the code blocks from the current file into a source-specific file (in this @@ -2475,15 +2476,25 @@ to the =after-save-hook= ensuring to always tangle and byte-compile the =org=-document after changes. #+BEGIN_SRC emacs-lisp + (req-package async) + (defun tangle-init () "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)) - ;; Avoid running hooks when tangling. - (let ((prog-mode-hook nil)) - (org-babel-tangle) - (byte-compile-file (concat user-emacs-directory "init.el"))))) + (async-start + `(lambda () + ;; Avoid running hooks when tangling. + (let ((prog-mode-hook nil) + (dest (concat user-emacs-directory "init.el"))) + (find-file ,(buffer-file-name)) + (require 'ob-tangle) + (org-babel-tangle nil dest) + (byte-compile-file dest) + dest)) + (lambda (result) + (message "Init tangling completed: %s" result))))) #+END_SRC # Local Variables: -- cgit 1.4.1 From 676c0b09332ae0159106c79d1f88fd8c706b4ed0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 Jul 2015 17:12:59 +0200 Subject: RCM: Tangle Emacs init file on install --- hooks/post-up/emacs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hooks/post-up/emacs b/hooks/post-up/emacs index 2e907f7c..0bd4d567 100755 --- a/hooks/post-up/emacs +++ b/hooks/post-up/emacs @@ -13,6 +13,11 @@ then fi pushd ~/.emacs.d cask install + emacs --batch --eval "(progn +(find-file \"init.org\") +(require 'ob-tangle) +(org-babel-tangle nil \"init.el\") +(byte-compile-file \"init.el\") +)" popd - emacs --batch --eval '(batch-byte-recompile-directory 0)' ~/.emacs.d/elisp fi -- cgit 1.4.1 From 9bea36e7f26f7cd34d20855ad309c84519ad9067 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 Jul 2015 21:34:24 +0200 Subject: Leiningen: Add lein-droid --- tag-clojure/lein/profiles.clj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-clojure/lein/profiles.clj b/tag-clojure/lein/profiles.clj index 284f67cb..8cab9f82 100644 --- a/tag-clojure/lein/profiles.clj +++ b/tag-clojure/lein/profiles.clj @@ -1,5 +1,6 @@ {:user {:plugins [[cider/cider-nrepl "0.8.0-SNAPSHOT"] [org.clojure/tools.namespace "0.2.7"] [lein-autoexpect "1.4.0"] - [lein-ancient "0.5.5"]] + [lein-ancient "0.5.5"] + [lein-droid "0.4.0-alpha4"]] :dependencies [[org.clojure/tools.trace "0.7.8"]]}} -- cgit 1.4.1 From e989bb41e34eeba711047a0263cbfb224bb4beee Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 Jul 2015 21:38:22 +0200 Subject: Upgrade leiningen plugins --- tag-clojure/lein/profiles.clj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tag-clojure/lein/profiles.clj b/tag-clojure/lein/profiles.clj index 8cab9f82..46a0ee81 100644 --- a/tag-clojure/lein/profiles.clj +++ b/tag-clojure/lein/profiles.clj @@ -1,6 +1,6 @@ -{:user {:plugins [[cider/cider-nrepl "0.8.0-SNAPSHOT"] - [org.clojure/tools.namespace "0.2.7"] - [lein-autoexpect "1.4.0"] - [lein-ancient "0.5.5"] +{:user {:plugins [[cider/cider-nrepl "0.9.1"] + [org.clojure/tools.namespace "0.2.10"] + [lein-autoexpect "1.6.0"] + [lein-ancient "0.6.7"] [lein-droid "0.4.0-alpha4"]] :dependencies [[org.clojure/tools.trace "0.7.8"]]}} -- cgit 1.4.1 From 2e96e919e9cff6c70564908ebe2d8fa887680fae Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 18 Jul 2015 21:38:39 +0200 Subject: RCM: Detect Emacs Cask by folder existance --- hooks/post-up/emacs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/post-up/emacs b/hooks/post-up/emacs index 0bd4d567..b8a8edc7 100755 --- a/hooks/post-up/emacs +++ b/hooks/post-up/emacs @@ -2,7 +2,7 @@ if [[ -s $commands[emacs] ]] then - if [[ -z $commands[cask] ]] + if [[ ! -d ~/cask ]] then git clone git://github.com/cask/cask ~/.cask if [[ ! -d ~/bin ]] -- cgit 1.4.1 From b94deb3d607d5e8ad92adfd606e1eb16daf2ada4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 25 Jul 2015 14:12:27 +0200 Subject: Emacs: Fix mobile-org setup --- tag-emacs/emacs.d/init.org | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 1f0dd1ee..a253bb72 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1536,7 +1536,7 @@ Org is wünderbar. ("C-c l" . org-store-link)) :init (setq org-replace-disputed-keys t) :config (progn - (setq org-directory "~/org" + (setq org-directory "~/Sync/org" org-agenda-files `(,org-directory) org-default-notes-file (concat org-directory "/notes") @@ -1615,11 +1615,12 @@ I can use this to keep a journal. I should use it. ***** TODO Setup org-mobile #+BEGIN_SRC emacs-lisp -(req-package org-mobile - :require org - :defer t - :config (progn - (setq org-mobile-directory "~/Mobile/Org"))) + (req-package org-mobile + :require org + :defer t + :config (progn + (setq org-mobile-directory "~/Mobile/Org" + org-mobile-inbox-for-pull "~/Mobile/Org/from-mobile.org"))) #+END_SRC * Programming -- cgit 1.4.1 From 3156b8216c426f55fded3c993b80bcf348a197ba Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 26 Jul 2015 16:39:02 +0200 Subject: Emacs: Improve org TODO state handling --- tag-emacs/emacs.d/init.org | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index a253bb72..1ee23b95 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1567,9 +1567,10 @@ Org is wünderbar. (plain-list-item . auto)) org-fontify-done-headline t - org-todo-keywords '((sequence "TODO" "STARTED" "|" "DONE") + org-todo-keywords '((sequence "TODO(t)" "WAIT(w@/!)" "STARTED(s!)" "|" "DONE(d!)") (sequence "TOLEARN" "LEARNING" "LEARNED" "|" "MASTERED") - (sequence "|" "CANCELLED"))) + (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) (defadvice org-clock-in (after wicked activate) -- cgit 1.4.1 From b0784e8a8bf42215897696762f39905b5a392ef0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 26 Jul 2015 16:41:27 +0200 Subject: Emacs: Autoload smart-tabs mode better --- tag-emacs/emacs.d/init.org | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 1ee23b95..14fda85f 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -596,14 +596,17 @@ Not related to [[smart-tab][=smart-tab=]], this mode indents with tabs and align with spaces. Perfect! #+BEGIN_SRC emacs-lisp -(req-package smart-tabs-mode - :commands (smart-tabs-mode - smart-tabs-mode-enable - smart-tabs-advice) - :config (progn + (req-package smart-tabs-mode + :commands (smart-tabs-mode + smart-tabs-mode-enable + smart-tabs-advice) + :config (progn + (smart-tabs-insinuate 'c 'javascript 'cperl 'python)) + :init (progn (add-hook 'php-mode-hook (lambda () (smart-tabs-mode indent-tabs-mode))) - (smart-tabs-insinuate 'c 'javascript 'cperl 'python))) + (add-hook 'js2-mode-hook (lambda () + (smart-tabs-mode indent-tabs-mode))))) #+END_SRC * Security -- cgit 1.4.1 From 9ebbf3bbb386ca69ecb266fe50cec3dc914a1beb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 26 Jul 2015 16:42:44 +0200 Subject: Emacs: Use Magit’s WIP functionality --- tag-emacs/emacs.d/init.org | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 14fda85f..12b4cab5 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -242,7 +242,10 @@ time. Make sure to set it up with a nice =completing-read-function= :config (progn (rename-modeline magit-status-mode (char-to-string (-find #'char-displayable-p '(11942 5848 177)))) (setq magit-last-seen-setup-instructions "1.4.0" magit-completing-read-function #'magit-ido-completing-read - magit-popup-use-prefix-argument 'default)) + magit-wip-after-save-mode t + magit-wip-after-apply-mode t + magit-popup-use-prefix-argument 'default) + (add-to-list 'magit-no-confirm 'safe-with-wip)) :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) #+END_SRC -- cgit 1.4.1 From a6de0dbd99b1158afbef81e679fe7fc2419a6214 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 1 Aug 2015 21:46:55 +0200 Subject: Emacs: Install eshell buffer stack package --- tag-emacs/emacs.d/init.org | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 12b4cab5..d86e5222 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2122,6 +2122,15 @@ nice, when I remember to use it. (bind-key "C-c S" #'eshell-goto-current-dir) #+END_SRC +#+BEGIN_SRC emacs-lisp + (req-package esh-buf-stack + :require eshell + :config (progn + (bind-key "M-q" #'eshell-push-command eshell-mode-map)) + :init (progn + (setup-eshell-buf-stack))) +#+END_SRC + *** Shells #+BEGIN_SRC emacs-lisp -- cgit 1.4.1 From 9bc83aae9988f3229cf1dd1e50d33e4b5df8596d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 7 Aug 2015 20:24:07 +0200 Subject: Emacs: Remove learning keywords from org config --- 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 d86e5222..476872df 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1573,8 +1573,7 @@ Org is wünderbar. (plain-list-item . auto)) org-fontify-done-headline t - org-todo-keywords '((sequence "TODO(t)" "WAIT(w@/!)" "STARTED(s!)" "|" "DONE(d!)") - (sequence "TOLEARN" "LEARNING" "LEARNED" "|" "MASTERED") + 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))) -- cgit 1.4.1 From 7ab1d790109e523392be25f23d0aaa8bb3e9a2e8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 7 Aug 2015 20:24:31 +0200 Subject: Emacs: Fix eshell configuration --- tag-emacs/emacs.d/init.org | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 476872df..7522d1fa 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2099,26 +2099,31 @@ I should try to get into the habit of using this more. It’s really nice, when I remember to use it. #+BEGIN_SRC emacs-lisp -(req-package eshell - :bind ("C-c s" . eshell) - :config (progn - (setq eshell-directory-name "~/.emacs.d/eshell") - (add-hook 'eshell-load-hook (lambda () - (bind-key "C-c C-l" #'helm-eshell-history eshell-mode-map))) - (req-package em-smart - :config (progn - (setq eshell-where-to-jump 'begin - eshell-review-quick-commands nil - eshell-smart-space-goes-to-end t) - (eshell-smart-initialize))))) - -(autoload #'eshell/cd "em-dirs") -(defun eshell-goto-current-dir (&optional arg) - (interactive "P") - (let ((dir default-directory)) - (eshell arg) - (eshell/cd dir))) -(bind-key "C-c S" #'eshell-goto-current-dir) + (req-package eshell + :bind ("C-c s" . eshell) + :config (progn + (setq eshell-directory-name "~/.emacs.d/eshell") + (add-hook 'eshell-load-hook (lambda () + (bind-key "C-c C-l" #'helm-eshell-history eshell-mode-map))))) + + (req-package em-smart + :require eshell + :init (progn + (add-hook 'eshell-load-hook #'eshell-smart-initialize)) + :config (progn + (setq eshell-where-to-jump 'begin + eshell-review-quick-commands nil + eshell-smart-space-goes-to-end t))) + + (autoload #'eshell/cd "em-dirs") + (defun eshell-goto-current-dir (&optional arg) + (interactive "P") + (let ((dir default-directory)) + (eshell arg) + (eshell/cd dir))) + (bind-key "C-c S" #'eshell-goto-current-dir) + + #+END_SRC #+BEGIN_SRC emacs-lisp -- cgit 1.4.1 From 79a11eaa2dacd7724e19e3d2b17e0b73093d6e09 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 10 Aug 2015 10:43:13 +0200 Subject: Emacs: Fix nix-mode initialisation --- 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 7522d1fa..e34a0e8e 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1456,7 +1456,8 @@ configuration files. (req-package nix-mode :mode (("\\.nix\\'" . nix-mode)) :config (progn - (setq-local indent-tabs-mode nil))) + (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)) -- cgit 1.4.1 From e2c1b3b5f76850f91e2bb3e39a135969255d6b2a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 10 Aug 2015 10:43:36 +0200 Subject: Emacs: Defer magit and org init --- tag-emacs/emacs.d/init.org | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index e34a0e8e..e74511a9 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -238,6 +238,7 @@ time. Make sure to set it up with a nice =completing-read-function= #+BEGIN_SRC emacs-lisp (req-package magit + :defer 5 :commands (magit-status) :config (progn (rename-modeline magit-status-mode (char-to-string (-find #'char-displayable-p '(11942 5848 177)))) (setq magit-last-seen-setup-instructions "1.4.0" @@ -1541,6 +1542,7 @@ Org is wünderbar. :bind (("C-c C-a" . org-agenda-list) ("C-c a" . org-agenda) ("C-c l" . org-store-link)) + :defer 10 :init (setq org-replace-disputed-keys t) :config (progn (setq org-directory "~/Sync/org" -- cgit 1.4.1 From 29c18056ff285ac44850cf7bbfc56c7572e37d3d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 13 Aug 2015 22:35:56 +0200 Subject: Emacs: Switch to swiper/ivy for completion --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.org | 172 +++++++++++---------------------------------- 2 files changed, 43 insertions(+), 130 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 3eb510bf..e7aec17f 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -20,6 +20,7 @@ (depends-on "company") (depends-on "company-go") (depends-on "company-tern") +(depends-on "counsel") (depends-on "csv-mode") (depends-on "dash") (depends-on "dash-functional") diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index e74511a9..4fe61651 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -158,7 +158,7 @@ based upon some folder conventions I use. (defun ap/add-known-subfolder-projects () (interactive) - (ap/-add-known-subfolder-projects (ido-read-directory-name "Add projects under: "))) + (ap/-add-known-subfolder-projects (read-directory-name "Add projects under: "))) (defun ap/open-subfolder-project (from-dir &optional arg) (let ((project-dir (projectile-completing-read "Open project: " @@ -176,7 +176,7 @@ based upon some folder conventions I use. (setq projectile-switch-project-action #'projectile-dired projectile-remember-window-configs t - projectile-completion-system 'helm))) + projectile-completion-system 'ivy))) #+END_SRC ** projector @@ -242,7 +242,7 @@ time. Make sure to set it up with a nice =completing-read-function= :commands (magit-status) :config (progn (rename-modeline magit-status-mode (char-to-string (-find #'char-displayable-p '(11942 5848 177)))) (setq magit-last-seen-setup-instructions "1.4.0" - magit-completing-read-function #'magit-ido-completing-read + magit-completing-read-function #'magit-builtin-completing-read magit-wip-after-save-mode t magit-wip-after-apply-mode t magit-popup-use-prefix-argument 'default) @@ -1184,7 +1184,6 @@ lots of candidates. (req-package helm-config :demand t :ensure helm - :bind (("C-x i" . helm-semantic-or-imenu)) :config (progn (setq helm-idle-delay .1 helm-input-idle-delay 0) @@ -1200,130 +1199,57 @@ lots of candidates. (define-key helm-read-file-map (kbd "C-z") #'helm-select-action))) #+END_SRC -** ido +** swiper/ivy -I really like ido. It’s part of emacs, it does flex matching nicely -and it’s pretty configurable. +Ivy is the new kid on the completion block. I wonder if it can +replace helm and ido. #+BEGIN_SRC emacs-lisp -(req-package ido - :bind (("C-x b" . ido-switch-buffer)) - :init (progn - (setq ido-save-directory-list-file (expand-file-name "ido-state" user-emacs-directory)) - (bind-key* "C-x C-f" #'ido-find-file) - (ido-mode 1) - (ido-everywhere 1)) - :config (progn - (setq ido-auto-merge-delay-time 99999 - ido-enable-flex-matching t) - - (ido-init-completion-maps) - (defadvice ido-find-file (after find-file-sudo activate) - "Find file as root if necessary." - (unless (and buffer-file-name - (file-writable-p buffer-file-name)) - (find-alternate-file (concat "/sudo::" buffer-file-name)))) - (defun ido-manual-merge () - (interactive) - (ido-initiate-auto-merge (current-buffer))) - (bind-key "C-c C-s" #'ido-manual-merge ido-file-dir-completion-map))) -#+END_SRC - -*** TODO Figure out whether the merge stuff is useful. - -*** ido-completing-read+ - -This is mostly a dependency of =magit=. -#+BEGIN_SRC emacs-lisp -(req-package ido-completing-read+ - :require ido - :config (progn - (setq ido-cr+-fallback-function #'helm-completing-read - ido-cr+-max-items 2000))) + (req-package swiper + :bind (("C-s" . swiper) + ("C-r" . swiper) + ("C-c C-r" . ivy-resume) + ("C-x i" . imenu) + ("C-=" . swiper)) + :config (progn + (setq ivy-use-virtual-buffers t + ivy-re-builders-alist '((internal-complete-buffer . ivy--regex-fuzzy) + (t . ivy--regex-plus)))) + :init (progn + (ivy-mode 1))) #+END_SRC -**** TODO See if I can use ido-completing-read+ in ido places -This would be good for finding files in projects. - -**** Buffer switching within projects - #+BEGIN_SRC emacs-lisp -(defun ap/ido-projectile-switch-buffer-dwim (force-ido) - (interactive "p") - (if (and (projectile-project-p) (eq force-ido 1)) - (call-interactively #'projectile-switch-to-buffer) - (call-interactively #'ido-switch-buffer))) - -(bind-key "s-x b" #'ap/ido-projectile-switch-buffer-dwim) -(bind-key "s-x s-b" #'ap/ido-projectile-switch-buffer-dwim) + (req-package counsel + :bind (("M-x" . counsel-M-x) + ("" . counsel-M-x) + ("" . counsel-M-x) + ("C-c M-x" . execute-extended-command) + ("C-x C-f" . counsel-find-file))) #+END_SRC -*** ido-vertical-mode - -I find ido’s default horizonal presentation of completion candidates -to be a little difficult to follow. Of course, there’s always a -package for that. - -#+BEGIN_SRC emacs-lisp -(req-package ido-vertical-mode - :require ido - :init (progn - (setq ido-vertical-decorations '("\n❯ " - "" - "\n " - "\n …" - "[" - "]" - " [No match]" - " [Matched]" - " [Not readable]" - " [Too big]" - " [Confirm]" - "\n❯ " - "") - ido-vertical-define-keys 'C-n-C-p-up-down-left-right)) - :config (ido-vertical-mode 1)) -#+END_SRC - -*** flx-ido - -I think ido’s flex matching could be a bit better, so I use =flx-ido= -for that. It can be slow on large collectinos, but fortunately it can -disable itself at that point - -#+BEGIN_SRC emacs-lisp -(req-package flx-ido - :require ido - :init (progn - (flx-ido-mode 1) - (setq flx-ido-threshold 1000))) -#+END_SRC ** smex -Smex is my favourite way to use =M-x=. I might try setting up =helm= -again, to see whether it’s any better or not. +Smex is my favourite way to use =M-x=. Counsel’s =counsel-M-x= +function uses it internally, so I’m keeping it around, even though I +don’t use it directly. #+BEGIN_SRC emacs-lisp -(req-package smex - :require ido - :bind (("M-x" . smex) - ("" . smex) - ("" . smex) - ("M-X" . smex-major-mode-commands) - ("C-c M-x" . execute-extended-command)) - :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")) - (smex-initialize))) + (req-package smex + :require ido + :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")) + (smex-initialize))) #+END_SRC * Modeline @@ -1515,7 +1441,7 @@ works really nicely. (add-hook 'ledger-mode-hook #'setup-ledger-mode) (add-to-list 'smart-tab-disabled-major-modes 'ledger-mode) (setq ledger-use-iso-dates t - ledger-post-use-completion-engine 'ido + ledger-post-use-completion-engine :built-in ledger-reconcile-default-commodity "€" ledger-clear-whole-transactions t ledger-narrow-on-reconcile t @@ -2358,20 +2284,6 @@ and doesn’t go back to the same place more than once. :bind ("C-x SPC" . goto-last-change)) #+END_SRC -** helm-swoop - -This fits somewhere between isearch and grep. For me, I didn’t -realise how useful it was until I actually tried it. - -#+BEGIN_SRC emacs-lisp -(req-package helm-swoop - :bind (("C-=" . helm-swoop) - ("C-c C-=" . helm-multi-swoop)) - :init (progn - (bind-key "C-=" #'helm-swoop isearch-mode-map) - (bind-key "C-=" #'helm-multi-swoop-all-from-helm-swoop))) -#+END_SRC - ** multiple-cursors I mentioned before that I’d used Sublime Text before. Multiple -- cgit 1.4.1 From 08f6ecdbeda886afef83cb87ddd3f447a0359927 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 13 Aug 2015 22:40:08 +0200 Subject: Emacs: Remove old imenu-init jump functions --- tag-emacs/emacs.d/init.org | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 4fe61651..cd3ec4d9 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1119,36 +1119,6 @@ Option/alt, then Control. ("M-!" . shell-execute))) #+END_SRC -Some stuff for getting around my =init.el=. Now that I’m using -=org-mode=, I’ll probably need to write something else, or fiddle with -org’s navigation commands. - -#+BEGIN_SRC emacs-lisp -(defun imenu-elisp-sections () - (setq imenu-prev-index-position-function nil) - (add-to-list 'imenu-generic-expression '("Sections" "^;;;; \\(.+\\)$" 1) t) - (add-to-list 'imenu-generic-expression '("Packages" "^(req-package\\s-+\\(\\(\\sw\\|\\s_\\)+\\)$" 1) t)) - -(defun init-narrow-to-section () - (interactive) - (save-excursion - (beginning-of-line) - (unless (looking-at "^;;;;") - (re-search-backward "^;;;;" nil t)) - (push-mark) - (forward-line) - (re-search-forward "^;;;;" nil t) - (forward-line -1) - (narrow-to-region (region-beginning) (region-end)))) - -(defun init-imenu (p) - (interactive "P") - (find-file-existing *init-file*) - (widen) - (helm-imenu) - (if p (init-narrow-to-section))) - -(add-hook 'emacs-lisp-mode-hook 'imenu-elisp-sections) #+END_SRC * Minibuffer -- cgit 1.4.1 From e3dbc96fa26da0a80d27a4884ae5cb86b15d96d8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 14 Aug 2015 07:52:18 +0200 Subject: zsh: Don’t try to init GPG agent --- tag-zsh/config/zsh/zshenv | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index 1084ede7..ab063a16 100755 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -65,14 +65,3 @@ if [[ -s $commands[direnv] ]] then eval "$(direnv hook zsh)" fi - -if [[ -s $commands[gpg-agent] && $os != "osx" ]] -then - envfile="$HOME/.gnupg/gpg-agent.env" - if [[ -e "$envfile" ]] && kill -0 $(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2) 2>/dev/null; then - eval "$(cat "$envfile")" - else - eval "$(gpg-agent --daemon --write-env-file "$envfile")" - fi - export GPG_AGENT_INFO # the env file does not contain the export statement -fi -- cgit 1.4.1 From c33752f85ceda2332ad74375c48a7d38f72a9719 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 14 Aug 2015 09:19:34 +0200 Subject: Emacs: Add missing gntp package to Caskfile --- tag-emacs/emacs.d/Cask | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index e7aec17f..d6dbad28 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -50,6 +50,7 @@ (depends-on "gh") (depends-on "gist") (depends-on "git-timemachine") +(depends-on "gntp") (depends-on "go-eldoc") (depends-on "go-mode") (depends-on "go-projectile") -- cgit 1.4.1 From c88ffba7b36f9dde833aac62ed0712cb90db0849 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 14 Aug 2015 09:22:08 +0200 Subject: Emacs: Stop Magit nagging on push --- 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 cd3ec4d9..7d8bc0df 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -245,7 +245,8 @@ time. Make sure to set it up with a nice =completing-read-function= magit-completing-read-function #'magit-builtin-completing-read magit-wip-after-save-mode t magit-wip-after-apply-mode t - magit-popup-use-prefix-argument 'default) + magit-popup-use-prefix-argument 'default + magit-push-always-verify nil) (add-to-list 'magit-no-confirm 'safe-with-wip)) :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) #+END_SRC -- cgit 1.4.1 From 75bd2030f4fea161a0cf936c22f266d51d9cefc0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 14 Aug 2015 21:06:14 +0200 Subject: Emacs: Give counsel a heading --- tag-emacs/emacs.d/init.org | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 7d8bc0df..6ee66a75 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1190,6 +1190,8 @@ replace helm and ido. (ivy-mode 1))) #+END_SRC +** counsel + #+BEGIN_SRC emacs-lisp (req-package counsel :bind (("M-x" . counsel-M-x) -- cgit 1.4.1 From 4fa45cd1054b526056a0118d324b818eeac7d80e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 14 Aug 2015 21:06:32 +0200 Subject: Fix indentation --- tag-emacs/emacs.d/init.org | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 6ee66a75..392f76e0 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1194,11 +1194,11 @@ replace helm and ido. #+BEGIN_SRC emacs-lisp (req-package counsel - :bind (("M-x" . counsel-M-x) - ("" . counsel-M-x) - ("" . counsel-M-x) - ("C-c M-x" . execute-extended-command) - ("C-x C-f" . counsel-find-file))) + :bind (("M-x" . counsel-M-x) + ("" . counsel-M-x) + ("" . counsel-M-x) + ("C-c M-x" . execute-extended-command) + ("C-x C-f" . counsel-find-file))) #+END_SRC -- cgit 1.4.1 From 46fcf6ca390af119f649a942cba4fe3721928f96 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 14 Aug 2015 21:43:53 +0200 Subject: Emacs: Better project buffer switching with ivy --- tag-emacs/emacs.d/init.org | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 392f76e0..991af461 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1198,7 +1198,16 @@ replace helm and ido. ("" . counsel-M-x) ("" . counsel-M-x) ("C-c M-x" . execute-extended-command) - ("C-x C-f" . counsel-find-file))) + ("C-x C-f" . counsel-find-file) + ("C-x b" . counsel-switch-to-projectile-buffer)) + :config (progn + (defun counsel-switch-to-projectile-buffer (arg) + "Forward to `projectile-switch-to-buffer'." + (ivy-read (format "Switch to buffer [%s]: " (projectile-project-name)) + (projectile-project-buffer-names) + :preselect (buffer-name (other-buffer (current-buffer))) + :action #'ivy--switch-buffer-action + :keymap ivy-switch-buffer-map)))) #+END_SRC -- cgit 1.4.1 From 8708c364ce3ab538307369885709ac67f1f9a2bb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 14 Aug 2015 21:55:50 +0200 Subject: Emacs: Add ivy-switch-buffer action to kill buffer --- tag-emacs/emacs.d/init.org | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 991af461..ffb1f310 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1185,7 +1185,11 @@ replace helm and ido. :config (progn (setq ivy-use-virtual-buffers t ivy-re-builders-alist '((internal-complete-buffer . ivy--regex-fuzzy) - (t . ivy--regex-plus)))) + (t . ivy--regex-plus))) + (ivy-set-actions 'ivy-switch-buffer '(("k" (lambda (x) + (kill-buffer x) + (ivy--reset-state ivy-last)) + "kill")))) :init (progn (ivy-mode 1))) #+END_SRC -- cgit 1.4.1 From 664e4c099d653fed46c0970328a70fdcaf89e581 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 14 Aug 2015 23:31:35 +0200 Subject: Emacs: Remove overzealous font-locking from dired --- 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 ffb1f310..8eae5336 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -354,7 +354,9 @@ these settings are particularly useful (setq jit-lock-stealth-time 1 jit-lock-stealth-load 100 jit-lock-chunk-size 1000 - jit-lock-defer-time 0.01) + jit-lock-defer-time 0.01 + font-lock-maximum-decoration '((dired-mode . 1) + (t . t))) #+END_SRC * Files -- cgit 1.4.1 From d3981bdfb3ccd4603a1ea7f5d130a3b2e24ec714 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 16 Aug 2015 13:29:45 +0200 Subject: Emacs: Fix counsel-switch-to-projectile-buffer Fallback to `ivy-switch-buffer` if not in a project --- tag-emacs/emacs.d/init.org | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 8eae5336..32fa1963 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1209,11 +1209,14 @@ replace helm and ido. :config (progn (defun counsel-switch-to-projectile-buffer (arg) "Forward to `projectile-switch-to-buffer'." - (ivy-read (format "Switch to buffer [%s]: " (projectile-project-name)) - (projectile-project-buffer-names) - :preselect (buffer-name (other-buffer (current-buffer))) - :action #'ivy--switch-buffer-action - :keymap ivy-switch-buffer-map)))) + (interactive "P") + (if (projectile-project-p) + (ivy-read (format "Switch to buffer [%s]: " (projectile-project-name)) + (projectile-project-buffer-names) + :preselect (buffer-name (other-buffer (current-buffer))) + :action #'ivy--switch-buffer-action + :keymap ivy-switch-buffer-map) + (call-interactively #'ivy-switch-buffer))))) #+END_SRC -- cgit 1.4.1 From be6667e171f077384482c4806d851a75bb625085 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 16 Aug 2015 13:30:57 +0200 Subject: Emacs: Add org-mobile timer setup --- tag-emacs/emacs.d/init.org | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 32fa1963..b4264286 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1505,7 +1505,47 @@ Org is wünderbar. (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 "STARTED"))))) + + (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 + + (defun install-monitor (file secs) + (run-with-timer + 0 secs + (lambda (f p) + (unless (< p (second (time-since (elt (file-attributes f) 5)))) + (org-mobile-pull))) + file secs)) + + (install-monitor (file-truename + (concat + (file-name-as-directory org-mobile-directory) + org-mobile-capture-file)) + 5) + + ;; Do a pull every 5 minutes to circumvent problems with timestamping + ;; (ie. dropbox bugs) + (run-with-timer 0 (* 5 60) 'org-mobile-pull))) #+END_SRC **** org-babel -- cgit 1.4.1 From 5ada0acd052d84bf46746244f3d34167c84f7ce5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 16 Aug 2015 15:28:06 +0200 Subject: Emacs: Move org-directory to subfolder --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index b4264286..8533c21b 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1463,7 +1463,7 @@ Org is wünderbar. :init (setq org-replace-disputed-keys t) :config (progn (setq org-directory "~/Sync/org" - org-agenda-files `(,org-directory) + org-agenda-files `(,(concat org-directory "/agenda")) org-default-notes-file (concat org-directory "/notes") -- cgit 1.4.1 From c423f425561d09ed312b0382d712109706905ade Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 17 Aug 2015 11:30:45 +0200 Subject: Emacs: Revert git buffers with magit --- 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 8533c21b..d31eca59 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -246,7 +246,8 @@ time. Make sure to set it up with a nice =completing-read-function= magit-wip-after-save-mode t magit-wip-after-apply-mode t magit-popup-use-prefix-argument 'default - magit-push-always-verify nil) + magit-push-always-verify nil + magit-revert-buffers t) (add-to-list 'magit-no-confirm 'safe-with-wip)) :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) #+END_SRC -- cgit 1.4.1 From ab9a540e35dfea6518f40e110f2f47f57e73dcc4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 17 Aug 2015 16:29:38 +0200 Subject: Git: Add pr -> pull-request alias --- tag-git/config/git/config | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-git/config/git/config b/tag-git/config/git/config index 5fb9f1b5..79be22e7 100644 --- a/tag-git/config/git/config +++ b/tag-git/config/git/config @@ -18,6 +18,7 @@ lg = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' standup = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --since yesterday --author Alan ignored = ls-files --others -i --exclude-standard + pr = pull-request [github] user = alan@alanpearce.co.uk [diff] -- cgit 1.4.1 From 9642a038b4c08f953913521f87b8a7d97fd320f7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 17 Aug 2015 17:06:50 +0200 Subject: Git add delete-merged command --- tag-git/config/git/config | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-git/config/git/config b/tag-git/config/git/config index 79be22e7..c005d2a1 100644 --- a/tag-git/config/git/config +++ b/tag-git/config/git/config @@ -19,6 +19,7 @@ standup = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --since yesterday --author Alan ignored = ls-files --others -i --exclude-standard pr = pull-request + delete-merged = '!sh git branch --merged | grep -v "\\*" | grep -v master | grep -v dev | xargs -n 1 git branch -d' [github] user = alan@alanpearce.co.uk [diff] -- cgit 1.4.1 From 7fa88df55a147c6283ba336b3d45a5fdd3d55801 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 18 Aug 2015 16:28:03 +0200 Subject: Emacs: Fix smart-tabs in js2-mode --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index d31eca59..75c642d4 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -609,6 +609,7 @@ with spaces. Perfect! smart-tabs-mode-enable smart-tabs-advice) :config (progn + (smart-tabs-advice js2-indent-line js2-indent-offset) (smart-tabs-insinuate 'c 'javascript 'cperl 'python)) :init (progn (add-hook 'php-mode-hook (lambda () -- cgit 1.4.1 From c5c3885174ae941511592906dc75d5b139f92577 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Aug 2015 16:55:31 +0200 Subject: Emacs: Remove redundant smart-tabs setup for js2 --- tag-emacs/emacs.d/init.org | 3 --- 1 file changed, 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 75c642d4..cd4b36d3 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -609,12 +609,9 @@ with spaces. Perfect! smart-tabs-mode-enable smart-tabs-advice) :config (progn - (smart-tabs-advice js2-indent-line js2-indent-offset) (smart-tabs-insinuate 'c 'javascript 'cperl 'python)) :init (progn (add-hook 'php-mode-hook (lambda () - (smart-tabs-mode indent-tabs-mode))) - (add-hook 'js2-mode-hook (lambda () (smart-tabs-mode indent-tabs-mode))))) #+END_SRC -- cgit 1.4.1 From b5d24a676866ad93be7ea6175cd29bf155c85ca4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Aug 2015 16:56:05 +0200 Subject: Emacs: Install and use dtrt-indent-mode --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.org | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index d6dbad28..b55830c8 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -33,6 +33,7 @@ (depends-on "dired-subtree") (depends-on "discover") (depends-on "discover-my-major") +(depends-on "dtrt-indent") (depends-on "elisp-slime-nav") (depends-on "emmet-mode") (depends-on "epl") diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index cd4b36d3..8b2bc8b7 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -615,6 +615,20 @@ with spaces. Perfect! (smart-tabs-mode indent-tabs-mode))))) #+END_SRC +** dtrt-indent-mode + +Sometimes people use different indentation settings. [[https://github.com/jscheid/dtrt-indent][dtrt-indent]] +guesses the correct settings for me. + +#+BEGIN_SRC emacs-lisp + (req-package dtrt-indent + :init (dtrt-indent-mode 1) + :config (progn + (defadvice dtrt-indent-try-set-offset (after toggle-smart-tabs activate) + (message "setting smart-tabs-mode") + (smart-tabs-mode (or indent-tabs-mode -1))))) +#+END_SRC + * Security ** password-store -- cgit 1.4.1 From 03165f6cd7fdd3963d715ae90038ae2d8131f710 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 26 Aug 2015 10:08:34 +0200 Subject: Git: Fix delete-merged alias --- tag-git/config/git/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-git/config/git/config b/tag-git/config/git/config index c005d2a1..29222857 100644 --- a/tag-git/config/git/config +++ b/tag-git/config/git/config @@ -19,7 +19,7 @@ standup = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --since yesterday --author Alan ignored = ls-files --others -i --exclude-standard pr = pull-request - delete-merged = '!sh git branch --merged | grep -v "\\*" | grep -v master | grep -v dev | xargs -n 1 git branch -d' + delete-merged = "!sh -c 'git branch --merged | grep -v "\\*" | grep -v master | grep -v dev | xargs -n 1 git branch -d'" [github] user = alan@alanpearce.co.uk [diff] -- cgit 1.4.1 From d93fa21de8e85d8a7ca47c22ad8b46395299def6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 26 Aug 2015 10:13:51 +0200 Subject: Emacs: Set Counsel’s M-x to search from anywhere --- 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 8b2bc8b7..07d64c6f 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1204,7 +1204,8 @@ replace helm and ido. (ivy-set-actions 'ivy-switch-buffer '(("k" (lambda (x) (kill-buffer x) (ivy--reset-state ivy-last)) - "kill")))) + "kill"))) + (add-to-list 'ivy-initial-inputs-alist '(counsel-M-x . ""))) :init (progn (ivy-mode 1))) #+END_SRC -- cgit 1.4.1 From c3d1083887130c7cad1764ca7738880de559906b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 27 Aug 2015 08:54:38 +0200 Subject: Emacs: Use Menlo on Darwin --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 07d64c6f..f6d64809 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -346,7 +346,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource ((eq window-system 'w32) (ap/set-fonts "Consolas" "Segoe UI" 10)) ((eq system-type 'darwin) - (ap/set-fonts "Monaco" "Helvetica" 12)))) + (ap/set-fonts "Menlo" "Helvetica" 12)))) #+END_SRC Allow font-lock-mode to do background parsing. I’m not really sure if -- cgit 1.4.1 From 86ff9bac8178ab3adaf7c94676b00e69c2d39d5a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 27 Aug 2015 08:54:57 +0200 Subject: Emacs: Install shrink-whitespace --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.org | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index b55830c8..bc48c31e 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -112,6 +112,7 @@ (depends-on "s") (depends-on "sass-mode") (depends-on "scss-mode") +(depends-on "shrink-whitespace") (depends-on "shut-up") (depends-on "simple-httpd") (depends-on "skewer-mode") diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index f6d64809..291c802a 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -478,6 +478,16 @@ open it. Whitespace butler fixes whitespace only for lines that I’m editing. (add-hook #'before-make-frame-hook (lambda () (ws-butler-global-mode 1)))) #+END_SRC +** shrink-whitespace + +DWIM whitespace removal. So I don’t need =M-SPC=, =M-\= and =C-x o= +for similar things any more. + +#+BEGIN_SRC emacs-lisp + (req-package shrink-whitespace + :bind ("M-SPC" . shrink-whitespace)) +#+END_SRC + ** fasd Fasd is a nice shell plugin that remembers file and folder arguments, -- cgit 1.4.1 From 401e4791ec7e666af4b9f219ab5055bb1027fdbf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 27 Aug 2015 20:58:36 +0200 Subject: Emacs: Move org-mobile config to right section --- tag-emacs/emacs.d/init.org | 81 +++++++++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 291c802a..658acaf1 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1530,46 +1530,6 @@ Org is wünderbar. (if (looking-at org-outline-regexp) (goto-char (1- (match-end 0)))) (if (looking-at (concat " +" org-todo-regexp "\\( +\\|[ \t]*$\\)")) (org-todo "STARTED"))))) - - (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 - - (defun install-monitor (file secs) - (run-with-timer - 0 secs - (lambda (f p) - (unless (< p (second (time-since (elt (file-attributes f) 5)))) - (org-mobile-pull))) - file secs)) - - (install-monitor (file-truename - (concat - (file-name-as-directory org-mobile-directory) - org-mobile-capture-file)) - 5) - - ;; Do a pull every 5 minutes to circumvent problems with timestamping - ;; (ie. dropbox bugs) - (run-with-timer 0 (* 5 60) 'org-mobile-pull))) #+END_SRC **** org-babel @@ -1610,7 +1570,46 @@ I can use this to keep a journal. I should use it. :defer t :config (progn (setq org-mobile-directory "~/Mobile/Org" - org-mobile-inbox-for-pull "~/Mobile/Org/from-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 + + (defun install-monitor (file secs) + (run-with-timer + 0 secs + (lambda (f p) + (unless (< p (second (time-since (elt (file-attributes f) 5)))) + (org-mobile-pull))) + file secs)) + + (install-monitor (file-truename + (concat + (file-name-as-directory org-mobile-directory) + org-mobile-capture-file)) + 5) + + ;; Do a pull every 5 minutes to circumvent problems with timestamping + ;; (ie. dropbox bugs) + (run-with-timer 0 (* 5 60) 'org-mobile-pull))))) #+END_SRC * Programming -- cgit 1.4.1 From 5c3bbde2d1bed275bb1687198e712838bb9cddd7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 28 Aug 2015 14:32:06 +0200 Subject: Emacs: Remove extra message call --- tag-emacs/emacs.d/init.org | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 291c802a..96c35312 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -635,7 +635,6 @@ guesses the correct settings for me. :init (dtrt-indent-mode 1) :config (progn (defadvice dtrt-indent-try-set-offset (after toggle-smart-tabs activate) - (message "setting smart-tabs-mode") (smart-tabs-mode (or indent-tabs-mode -1))))) #+END_SRC -- cgit 1.4.1 From 6d37b1638766cf1720194a0e7045ed1802b19b62 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 31 Aug 2015 09:39:53 +0200 Subject: Emacs: Initialise Customize after package config --- tag-emacs/emacs.d/init.org | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index f6c4cf7d..f97f2680 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -27,19 +27,6 @@ the buffer to be empty. user-full-name "Alan Pearce") #+end_src -** Customize -I don’t really like using customize for normal configuration. -Instead, I use it for things that get saved automatically. That’s why -I use a different file, which is ignored by the VCS. It also means -that it’s not important whether the file exists or not, which is why I -pass =:noerror= to =load= - -#+BEGIN_SRC emacs-lisp - (setq custom-file "~/.emacs.d/custom.el") - (load custom-file :noerror :nomessage) -#+END_SRC - - * Packaging I still use a couple of [[file:elisp/][elisp files]] that don’t appear to be in any package @@ -110,6 +97,18 @@ from inside Emacs. I don’t need it on startup, so I tell #+END_SRC +* Customize +I don’t really like using customize for normal configuration. +Instead, I use it for things that get saved automatically. That’s why +I use a different file, which is ignored by the VCS. It also means +that it’s not important whether the file exists or not, which is why I +pass =:noerror= to =load= + +#+BEGIN_SRC emacs-lisp + (setq custom-file "~/.emacs.d/custom.el") + (load custom-file :noerror :nomessage) +#+END_SRC + * Helpers I like to rename modeline lighters. This macro works for major modes. #+BEGIN_SRC emacs-lisp -- cgit 1.4.1 From 978b10831437e0217d2c770ac88272ba1a1c4dc4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 31 Aug 2015 09:44:17 +0200 Subject: Emacs: Check for byte-compiliation errors --- tag-emacs/emacs.d/init.org | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index f97f2680..023de0ac 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2479,8 +2479,9 @@ the =org=-document after changes. (find-file ,(buffer-file-name)) (require 'ob-tangle) (org-babel-tangle nil dest) - (byte-compile-file dest) - dest)) + (if (byte-compile-file dest) + dest + "Errors occurred"))) (lambda (result) (message "Init tangling completed: %s" result))))) #+END_SRC -- cgit 1.4.1 From 4d21cdf99136d0280cb2af57613295255f20a910 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 31 Aug 2015 10:17:47 +0200 Subject: Emacs: Fix smart-tabs-mode by brute force Not really sure what’s wrong with the initialisation, but now it works. --- tag-emacs/emacs.d/init.org | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 023de0ac..1498f250 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -614,12 +614,28 @@ with spaces. Perfect! #+BEGIN_SRC emacs-lisp (req-package smart-tabs-mode - :commands (smart-tabs-mode - smart-tabs-mode-enable - smart-tabs-advice) + :defer 1 :config (progn - (smart-tabs-insinuate 'c 'javascript 'cperl 'python)) + (smart-tabs-mode/no-tabs-mode-advice align) + (smart-tabs-mode/no-tabs-mode-advice align-regexp) + (smart-tabs-mode/no-tabs-mode-advice indent-relative) + (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)))) :init (progn + (smart-tabs-insinuate 'c 'cperl 'javascript 'python) (add-hook 'php-mode-hook (lambda () (smart-tabs-mode indent-tabs-mode))))) #+END_SRC -- cgit 1.4.1 From bb6744eb3e79fdcd8be16d36d3cd149f6d4db76a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 3 Sep 2015 19:32:54 +0200 Subject: Emacs: Improve async byte-compile error handling --- 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 1498f250..48b76392 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2497,7 +2497,8 @@ the =org=-document after changes. (org-babel-tangle nil dest) (if (byte-compile-file dest) dest - "Errors occurred"))) + (with-current-buffer byte-compile-log-buffer + (buffer-string))))) (lambda (result) (message "Init tangling completed: %s" result))))) #+END_SRC -- cgit 1.4.1 From ec66ac0081b68df0220ab6f5fc0290b611bf9a6f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 3 Sep 2015 19:34:36 +0200 Subject: Emacs: Ensure cask & pallet are required --- tag-emacs/emacs.d/init.org | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 48b76392..9085c4a5 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -41,7 +41,8 @@ archives. For most packages, I use [[https://github.com/cask/cask][cask]] #+BEGIN_SRC emacs-lisp - (add-to-list 'load-path (expand-file-name "~/.cask")) + (eval-and-compile + (add-to-list 'load-path (expand-file-name "~/.cask"))) (require 'cask) (cask-initialize) #+END_SRC @@ -71,16 +72,17 @@ cask update ** Req-package #+BEGIN_SRC emacs-lisp - (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") - ("marmalade" . "http://marmalade-repo.org/packages/") - ("melpa" . "http://melpa.org/packages/") - ("melpa-stable" . "http://stable.melpa.org/packages/") - ("org" . "http://orgmode.org/elpa/"))) - (package-initialize) - (unless (package-installed-p 'req-package) - (package-refresh-contents) - (package-install 'req-package)) - (require 'req-package) + (eval-and-compile + (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") + ("marmalade" . "http://marmalade-repo.org/packages/") + ("melpa" . "http://melpa.org/packages/") + ("melpa-stable" . "http://stable.melpa.org/packages/") + ("org" . "http://orgmode.org/elpa/"))) + (package-initialize) + (unless (package-installed-p 'req-package) + (package-refresh-contents) + (package-install 'req-package)) + (require 'req-package)) (setq use-package-verbose t) #+END_SRC -- cgit 1.4.1 From af351fc049176b48f6e484d927c3293b1077b6e1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 3 Sep 2015 19:58:05 +0200 Subject: Emacs: Defer loading of async until tangling --- 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 9085c4a5..a088d40e 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2482,13 +2482,12 @@ to the =after-save-hook= ensuring to always tangle and byte-compile the =org=-document after changes. #+BEGIN_SRC emacs-lisp - (req-package async) - (defun tangle-init () "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)) + (require 'async) (async-start `(lambda () ;; Avoid running hooks when tangling. -- cgit 1.4.1 From 58a58f8176ac169c71ea30d18b093ef0f7f765d1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 7 Sep 2015 08:39:37 +0200 Subject: Emacs: Switch OSX font to Hack --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index a088d40e..9485ceae 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -347,7 +347,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource ((eq window-system 'w32) (ap/set-fonts "Consolas" "Segoe UI" 10)) ((eq system-type 'darwin) - (ap/set-fonts "Menlo" "Helvetica" 12)))) + (ap/set-fonts "Hack" "Helvetica" 12)))) #+END_SRC Allow font-lock-mode to do background parsing. I’m not really sure if -- cgit 1.4.1 From 89fe72cd67e94faf6e9a665fafcf6962ecccb663 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 7 Sep 2015 08:39:51 +0200 Subject: Emacs: Resize frames pixelwise --- tag-emacs/emacs.d/init.org | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 9485ceae..dda82272 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -779,9 +779,10 @@ point whilst I’m moving about. scroll-margin 1 scroll-preserve-screen-position t mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control))) - split-height-threshold 100) -(if (eq system-type 'darwin) - (setq ns-pop-up-frames nil)) + split-height-threshold 100 + frame-resize-pixelwise t) + (if (eq system-type 'darwin) + (setq ns-pop-up-frames nil)) #+END_SRC A dedicated window always keeps the same buffer in view. -- cgit 1.4.1 From 0264ff400bc6c275aea047e3c717d6f936628b7d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 7 Sep 2015 09:06:25 +0200 Subject: Emacs: Open sailsrc files in json-mode --- tag-emacs/emacs.d/init.org | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index dda82272..90287f9c 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1959,8 +1959,9 @@ completions, besides other IDE-like things. *** json-mode #+BEGIN_SRC emacs-lisp -(req-package json-mode - :mode ("\\.json\\'" . json-mode)) + (req-package json-mode + :mode (("\\.json\\'" . json-mode) + ("\\.sailsrc\\'" . json-mode))) #+END_SRC *** restclient -- cgit 1.4.1 From ebf6a8b80f7c3a6493b84629350052432fd5b688 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 7 Sep 2015 10:37:56 +0200 Subject: Emacs: Fix tangling, again --- 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 90287f9c..c78c62a8 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2484,12 +2484,14 @@ to the =after-save-hook= ensuring to always tangle and byte-compile the =org=-document after changes. #+BEGIN_SRC emacs-lisp + (req-package async + :defer 2) + (defun tangle-init () "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)) - (require 'async) (async-start `(lambda () ;; Avoid running hooks when tangling. -- cgit 1.4.1 From 4ff71fca31604a53a0e7384b624fc85e0ca66ebb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 7 Sep 2015 16:42:42 +0200 Subject: Emacs: Replace Uniquify with relative-buffers --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.org | 15 ++++----------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index bc48c31e..f1e204d5 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -107,6 +107,7 @@ (depends-on "quickrun") (depends-on "rainbow-mode") (depends-on "redshank") +(depends-on "relative-buffers") (depends-on "req-package") (depends-on "restclient") (depends-on "s") diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index c78c62a8..75ef27db 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -704,20 +704,13 @@ often though, as it doesn’t really work with perspectives. filename-and-process))))) #+END_SRC -** Uniqify - -Sometimes projects have files with the same name. This gives them -unique names, by adding enough path elements to make them unambiguous. +** Relative Buffer names #+BEGIN_SRC emacs-lisp -(req-package uniquify - :config (progn - (setq uniquify-buffer-name-style 'forward - uniquify-separator "/" - uniquify-after-kill-buffer-p t - uniquify-ignore-buffers-re "^\\*"))) + (req-package relative-buffers + :init (progn + (global-relative-buffers-mode))) #+END_SRC - ** Narrowing Enable it without prompting -- cgit 1.4.1 From 087c2ce7a4d5d9c71862f6869c9202f592c6c351 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 9 Sep 2015 14:47:10 +0200 Subject: Emacs: Remove ace-jump-buffer --- tag-emacs/emacs.d/Cask | 1 - tag-emacs/emacs.d/init.org | 6 ------ 2 files changed, 7 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index f1e204d5..1ef60adb 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -4,7 +4,6 @@ (source melpa-stable) (source org) -(depends-on "ace-jump-buffer") (depends-on "ace-window") (depends-on "ag") (depends-on "async") diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 75ef27db..ee06ec87 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -732,12 +732,6 @@ like. This package just makes everything else lower-contrast. :config (fancy-narrow-mode 1)) #+END_SRC -** ace-jump-buffer - -#+BEGIN_SRC emacs-lisp -(use-package ace-jump-buffer - :bind ("s-b" . ace-jump-buffer)) -#+END_SRC ** ace-window -- cgit 1.4.1 From 9896758b40392d1e3de20f598248382a161ac2eb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 16 Sep 2015 13:09:32 +0200 Subject: Emacs: Install page-break-lines mode --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.org | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 1ef60adb..3e24870c 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -90,6 +90,7 @@ (depends-on "org-plus-contrib") (depends-on "package-build") (depends-on "packed") +(depends-on "page-break-lines") (depends-on "pallet") (depends-on "paredit") (depends-on "password-store") diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index ee06ec87..ccbfb361 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -361,6 +361,16 @@ these settings are particularly useful (t . t))) #+END_SRC +** Page Breaks + +By default, Emacs displays page breaks as ^L. Lines look much nicer. + +#+BEGIN_SRC emacs-lisp + (req-package page-break-lines + :defer 5 + :config (global-page-break-lines-mode)) +#+END_SRC + * Files ** Auto-saving -- cgit 1.4.1 From 415e99e9e0d5cbc5d31b8c7d1bf44081574008ba Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 16 Sep 2015 13:12:33 +0200 Subject: Emacs: Regenerate cask file --- tag-emacs/emacs.d/Cask | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 3e24870c..8f04e0be 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -16,6 +16,7 @@ (depends-on "cider") (depends-on "clj-refactor") (depends-on "clojure-mode") +(depends-on "coffee-mode") (depends-on "company") (depends-on "company-go") (depends-on "company-tern") @@ -33,6 +34,7 @@ (depends-on "discover") (depends-on "discover-my-major") (depends-on "dtrt-indent") +(depends-on "editorconfig") (depends-on "elisp-slime-nav") (depends-on "emmet-mode") (depends-on "epl") @@ -49,6 +51,7 @@ (depends-on "ggtags") (depends-on "gh") (depends-on "gist") +(depends-on "git-commit") (depends-on "git-timemachine") (depends-on "gntp") (depends-on "go-eldoc") @@ -70,6 +73,7 @@ (depends-on "jquery-doc") (depends-on "js2-mode") (depends-on "json-mode") +(depends-on "json-reformat") (depends-on "ledger-mode") (depends-on "let-alist") (depends-on "litable") @@ -125,6 +129,7 @@ (depends-on "smex") (depends-on "solarized-theme") (depends-on "spinner") +(depends-on "swiper") (depends-on "tern") (depends-on "toml-mode") (depends-on "tup-mode") -- cgit 1.4.1 From 7175d1e6b248a6011a1847d7f7f041d7409a4dd9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 1 Oct 2015 09:58:15 +0200 Subject: Emacs: Use correct package name for company-tern --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index ccbfb361..39bedb64 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1949,7 +1949,7 @@ completions, besides other IDE-like things. (tern-mode 1)) (add-hook 'js2-mode-hook #'ap/enable-tern))) - (req-package tern-company + (req-package company-tern :require (tern company)) #+END_SRC -- cgit 1.4.1 From adc5820c63ebcfd39ae16b3625e374a75e51eb8c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 5 Oct 2015 09:25:12 +0200 Subject: Use Cyphejor to rename major mode lighters --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.org | 33 ++++++++++++++++++++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 8f04e0be..ba75ee8a 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -22,6 +22,7 @@ (depends-on "company-tern") (depends-on "counsel") (depends-on "csv-mode") +(depends-on "cyphejor") (depends-on "dash") (depends-on "dash-functional") (depends-on "deferred") diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 39bedb64..4482f8cf 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -111,14 +111,6 @@ pass =:noerror= to =load= (load custom-file :noerror :nomessage) #+END_SRC -* Helpers - I like to rename modeline lighters. This macro works for major modes. -#+BEGIN_SRC emacs-lisp -(defmacro rename-modeline (mode new-name) - `(defadvice ,mode (after rename-modeline activate) - (setq mode-name ,new-name))) -#+END_SRC - * Projects #+BEGIN_SRC emacs-lisp @@ -241,8 +233,7 @@ time. Make sure to set it up with a nice =completing-read-function= (req-package magit :defer 5 :commands (magit-status) - :config (progn (rename-modeline magit-status-mode (char-to-string (-find #'char-displayable-p '(11942 5848 177)))) - (setq magit-last-seen-setup-instructions "1.4.0" + :config (progn (setq magit-last-seen-setup-instructions "1.4.0" magit-completing-read-function #'magit-builtin-completing-read magit-wip-after-save-mode t magit-wip-after-apply-mode t @@ -1384,6 +1375,27 @@ I put some of it in the frame-line at the top. "%b")))) #+END_SRC +** Renaming major modes + +Diminishing major modes does not happen in the same manner as minor +modes. + +#+BEGIN_SRC emacs-lisp + (req-package cyphejor + :init (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) + ("mode" "") + ("shell" "sh" :postfix))) + (cyphejor-mode 1))) +#+END_SRC + * Modes Setup some modes for systemd files @@ -1739,7 +1751,6 @@ Customise the modeline-display of =emacs-lisp-mode=. Then make sure it runs the common lisp hooks. #+BEGIN_SRC emacs-lisp -(rename-modeline emacs-lisp-mode "ξ") (add-to-list 'auto-mode-alist '("/Cask\\'" . emacs-lisp-mode)) (add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup) (add-hook 'emacs-lisp-mode-hook #'eldoc-mode) -- cgit 1.4.1 From 0f5ee55c871c91f6f74ddc6a7eec24992e124525 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 5 Oct 2015 09:26:10 +0200 Subject: Emacs: Use avy-goto-char-timer, better at DWIM --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 4482f8cf..677358e9 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2348,7 +2348,7 @@ somehow I prefer it. :bind* (("M-g g" . avy-goto-line) ("M-g M-g" . avy-goto-line) ("C-|" . avy-goto-line) - ("C-c SPC" . avy-goto-char)) + ("C-c SPC" . avy-goto-char-timer)) :config (progn (avy-setup-default) (setq avy-all-windows nil))) -- cgit 1.4.1 From 88b381faace9ac226e340cc4db8fba6dd329b9a7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 16 Oct 2015 11:24:37 +0200 Subject: Emacs: Configure spotlight on OS X --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.org | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index ba75ee8a..ead4a523 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -130,6 +130,7 @@ (depends-on "smex") (depends-on "solarized-theme") (depends-on "spinner") +(depends-on "spotlight") (depends-on "swiper") (depends-on "tern") (depends-on "toml-mode") diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 677358e9..008b5b16 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -514,6 +514,16 @@ I only use this occasionally, but it’s nice for files outside of projects. (recentf-mode 1))) #+END_SRC +** spotlight + +An awesome way to open files on OS X. + +#+BEGIN_SRC emacs-lisp + (req-package spotlight + :if (eq system-type 'darwin) + :config (setq spotlight-tmp-file "/tmp/.emacs-spotlight-tmp-file")) +#+END_SRC + ** saveplace It.. saves the position I visited a file at last. Might try turning -- cgit 1.4.1 From 4eb68236f9bd69752e609789bd22564a573683b3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 16 Oct 2015 11:25:11 +0200 Subject: Emacs: Re-add find-file-as-root advice for counsel --- tag-emacs/emacs.d/init.org | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 008b5b16..dd19554a 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1246,6 +1246,11 @@ replace helm and ido. ("C-x C-f" . counsel-find-file) ("C-x b" . counsel-switch-to-projectile-buffer)) :config (progn + (defadvice counsel-find-file (after find-file-sudo activate) + "Find file as root if necessary." + (unless (and buffer-file-name + (file-writable-p buffer-file-name)) + (find-alternate-file (concat "/sudo::" buffer-file-name)))) (defun counsel-switch-to-projectile-buffer (arg) "Forward to `projectile-switch-to-buffer'." (interactive "P") -- cgit 1.4.1 From 9b0ce6c53ae53474ef80eb8be8857cd45825a227 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 18 Oct 2015 17:10:20 +0200 Subject: Emacs: Defer more packages --- tag-emacs/emacs.d/init.org | 101 ++++++++++++++++++++++++--------------------- 1 file changed, 53 insertions(+), 48 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 677358e9..1f6b7333 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -218,10 +218,11 @@ It’s nice to be able to see at a glance which lines of a file have changed. This package colours the fringe #+BEGIN_SRC emacs-lisp -(req-package diff-hl - :init (progn - (global-diff-hl-mode) - (add-hook 'magit-refresh-file-buffer-hook #'diff-hl-update))) + (req-package diff-hl + :defer 2 + :init (progn + (global-diff-hl-mode 1) + (add-hook 'magit-refresh-file-buffer-hook #'diff-hl-update))) #+END_SRC ** magit @@ -275,11 +276,10 @@ Ring the bell sometimes, but not so often When I’m using dash in emacs lisp, it’s nice to have proper font locking for it. #+BEGIN_SRC emacs-lisp -(req-package dash - :demand t - :init (setq dash-enable-fontlock t) - :config (progn - (dash--enable-fontlock 'dash-enable-font-lock t))) + (req-package dash + :commands (dash-enable-font-lock) + :init (progn + (add-hook 'emacs-lisp-mode-hook #'dash-enable-font-lock))) #+END_SRC ** Colours @@ -532,7 +532,7 @@ that I can sudo on remote machines #+BEGIN_SRC emacs-lisp (req-package tramp - :defer t + :defer 7 :config (progn (setq tramp-default-method (if (eq system-type 'windows-nt) "plinkx" "ssh") tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root")) @@ -662,9 +662,10 @@ guesses the correct settings for me. This is a frontend to the GPG-powered =pass= program. #+BEGIN_SRC emacs-lisp -(req-package password-store - :config (progn - (setq password-store-password-length 16))) + (req-package password-store + :defer 15 + :config (progn + (setq password-store-password-length 16))) #+END_SRC * Buffers @@ -728,9 +729,10 @@ Sometimes I like to be able to focus on one block of code at a time. Normally narrowing hides everything else completely, which I don’t like. This package just makes everything else lower-contrast. #+BEGIN_SRC emacs-lisp -(req-package fancy-narrow - :diminish fancy-narrow-mode - :config (fancy-narrow-mode 1)) + (req-package fancy-narrow + :defer 15 + :diminish fancy-narrow-mode + :config (fancy-narrow-mode 1)) #+END_SRC @@ -884,7 +886,7 @@ seems to work perfectly well for me. Weeks start on Monday for me and I prefer ISO-style dates. #+BEGIN_SRC emacs-lisp (req-package calendar - :defer t + :defer 1 :config (progn (setq calendar-week-start-day 1) (calendar-set-date-style 'iso))) @@ -920,7 +922,7 @@ copying/moving files between them. #+BEGIN_SRC emacs-lisp (req-package dired - :defer t + :defer 3 :config (progn (bind-key "" #'dired-find-file dired-mode-map) (bind-key "^" (lambda () (interactive) (find-alternate-file "..")) dired-mode-map) @@ -937,13 +939,14 @@ copying/moving files between them. I work with a lot of git projects. Dired-k adds colours based upon the file’s git status. #+BEGIN_SRC emacs-lisp -(req-package dired-k - :require dired - :init (progn - (add-hook 'dired-initial-position-hook #'dired-k)) - :config (progn - (setq dired-k-human-readable t) - (bind-key "g" #'dired-k dired-mode-map))) + (req-package dired-k + :require dired + :defer 5 + :init (progn + (add-hook 'dired-initial-position-hook #'dired-k)) + :config (progn + (setq dired-k-human-readable t) + (bind-key "g" #'dired-k dired-mode-map))) #+END_SRC @@ -951,15 +954,17 @@ Don’t show uninteresting files in dired listings. #+BEGIN_SRC emacs-lisp (req-package dired-x - :require dired + :commands (dired-omit-mode + dired-expunge) :config (progn + (setq dired-omit-files "#\\|\\.$" + dired-omit-verbose nil + dired-find-subdir t)) + :init (progn (defun turn-on-dired-omit-mode () (interactive) (dired-omit-mode 1)) - (add-hook 'dired-mode-hook #'turn-on-dired-omit-mode) - (setq dired-omit-files "#\\|\\.$" - dired-omit-verbose nil - dired-find-subdir t))) + (add-hook 'dired-mode-hook #'turn-on-dired-omit-mode))) #+END_SRC #+BEGIN_SRC emacs-lisp @@ -974,22 +979,22 @@ Don’t show uninteresting files in dired listings. Expand subfolders like a tree inside the parent #+BEGIN_SRC emacs-lisp -(req-package dired-subtree - :defer t - :require dired - :config (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)) - :init (progn - (bind-key "i" #'dired-subtree-toggle dired-mode-map))) + (req-package dired-subtree + :defer t + :require dired + :config (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)) + :init (progn + (bind-key "i" #'dired-subtree-toggle dired-mode-map))) #+END_SRC * Documentation @@ -1001,7 +1006,7 @@ helps to make documentation for other languages easier to access #+BEGIN_SRC emacs-lisp (req-package helm-dash - :defer t + :defer 20 :init (progn (defmacro ap/create-helm-dash-hook (mode docsets) (let* ((mode-s (symbol-name mode)) @@ -1509,7 +1514,7 @@ Org is wünderbar. :bind (("C-c C-a" . org-agenda-list) ("C-c a" . org-agenda) ("C-c l" . org-store-link)) - :defer 10 + :defer 8 :init (setq org-replace-disputed-keys t) :config (progn (setq org-directory "~/Sync/org" -- cgit 1.4.1 From 2dcf288b2f664bef01cc291d18336129cba3c393 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 18 Oct 2015 17:10:45 +0200 Subject: Emacs: Enable colours in comint mode --- tag-emacs/emacs.d/init.org | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 1f6b7333..d2cd2eec 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2107,6 +2107,10 @@ Make a shell-script buffer executable after saving it, if it has a shebang. :config (setq sh-shell-file "/usr/bin/env zsh")) #+END_SRC +#+BEGIN_SRC emacs-lisp + (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) +#+END_SRC + ** eshell I should try to get into the habit of using this more. It’s really -- cgit 1.4.1 From ccc46ff3e24cd3f2bd0ede361d40c75cce6ba97a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 18 Oct 2015 17:10:55 +0200 Subject: Emacs: Remove helm-files configuration --- tag-emacs/emacs.d/init.org | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index d2cd2eec..ba3b610e 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1195,14 +1195,6 @@ lots of candidates. helm-input-idle-delay 0) (when (fboundp #'helm-adaptive-mode) (helm-adaptive-mode 1)))) - - (req-package helm-files - :defer t - :config (progn - (define-key helm-read-file-map (kbd "") #'helm-execute-persistent-action) - (define-key helm-read-file-map (kbd "TAB") #'helm-execute-persistent-action) - (define-key helm-read-file-map (kbd "C-i") #'helm-execute-persistent-action) - (define-key helm-read-file-map (kbd "C-z") #'helm-select-action))) #+END_SRC ** swiper/ivy -- cgit 1.4.1 From e93de1a93d44d4abc2618f5b4aa3a24fd189bb9e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 18 Oct 2015 17:11:09 +0200 Subject: Xresources: Use Hack and Fira sans in Emacs --- tag-xresources/xresources/main | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tag-xresources/xresources/main b/tag-xresources/xresources/main index 77c21ce3..82a58a5d 100644 --- a/tag-xresources/xresources/main +++ b/tag-xresources/xresources/main @@ -28,6 +28,6 @@ Emacs.MenuBar: off Emacs.ScrollBars: off Emacs.CursorBlink: off -Emacs.Font: -*-Droid Sans Mono-medium-*-*-*-*-140-*-*-*-*-*-* -Emacs.fixed-pitch.attributeFont: -*-Droid Sans Mono-medium-*-*-*-*-140-*-*-*-*-*-* -Emacs.variable-pitch.attributeFont: -*-Arimo-medium-*-*-*-*-160-*-*-*-*-*-* +Emacs.Font: -*-Hack-normal-*-*-*-16-*-*-*-*-*-*-* +Emacs.fixed-pitch.attributeFont: -*-Hack-normal-*-*-*-16-*-*-*-*-*-*-* +Emacs.variable-pitch.attributeFont: -*-Fira Sans-medium-r-*-*-16-*-*-*-*-*-*-* -- cgit 1.4.1 From f804daba11b49414eb90d361c97fc54cf018bcb2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 18 Oct 2015 17:11:30 +0200 Subject: Leiningen: Add javadoc configuration --- tag-clojure/lein/profiles.clj | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tag-clojure/lein/profiles.clj b/tag-clojure/lein/profiles.clj index 46a0ee81..44007f7b 100644 --- a/tag-clojure/lein/profiles.clj +++ b/tag-clojure/lein/profiles.clj @@ -3,4 +3,9 @@ [lein-autoexpect "1.6.0"] [lein-ancient "0.6.7"] [lein-droid "0.4.0-alpha4"]] - :dependencies [[org.clojure/tools.trace "0.7.8"]]}} + :dependencies [[org.clojure/tools.trace "0.7.8"]] + :repl-options {:init + (do + (require '[clojure.java.javadoc :refer [javadoc]]) + (clojure.java.javadoc/add-local-javadoc + "/usr/share/doc/java8-openjdk/api/"))}}} -- cgit 1.4.1 From d5a131a8c0c669476f125a2bca434d0d3f79f315 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 20 Oct 2015 13:31:39 +0200 Subject: Emacs: Use Input fonts on OS X --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index dd19554a..cc2dbdf3 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -338,7 +338,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource ((eq window-system 'w32) (ap/set-fonts "Consolas" "Segoe UI" 10)) ((eq system-type 'darwin) - (ap/set-fonts "Hack" "Helvetica" 12)))) + (ap/set-fonts "Input Mono Narrow" "Input Sans Condensed" 12)))) #+END_SRC Allow font-lock-mode to do background parsing. I’m not really sure if -- cgit 1.4.1 From d194d8ed593decd6f1b65e434cfb40374c218861 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 20 Oct 2015 13:35:58 +0200 Subject: Emacs: Force-bind my keys --- tag-emacs/emacs.d/init.org | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index cc2dbdf3..06d6f7c5 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1099,33 +1099,33 @@ Option/alt, then Control. #+BEGIN_SRC emacs-lisp (unbind-key "") - (bind-key "" #'compile) - (bind-key "" #'kmacro-start-macro-or-insert-counter) - (bind-key "" #'kmacro-end-or-call-macro) + (bind-key* "" #'compile) + (bind-key* "" #'kmacro-start-macro-or-insert-counter) + (bind-key* "" #'kmacro-end-or-call-macro) - (bind-key "" #'execute-extended-command) + (bind-key* "" #'execute-extended-command) (unbind-key "C-z") - (bind-key "C-" #'other-window) + (bind-key* "C-" #'other-window) - (bind-key "C-x C-r" #'revert-buffer) - (bind-key "C-x C-j" #'delete-indentation) + (bind-key* "C-x C-r" #'revert-buffer) + (bind-key* "C-x C-j" #'delete-indentation) (unbind-key "C-x C-c") - (bind-key "C-c i" #'insert-char) - (bind-key "M-/" #'hippie-expand) + (bind-key* "C-c i" #'insert-char) + (bind-key* "M-/" #'hippie-expand) (unbind-key "s-h") (unbind-key "s-n") (unbind-key "s-p") (unbind-key "s-w") - (bind-key "s-k" #'kill-or-delete-this-buffer-dwim) + (bind-key* "s-k" #'kill-or-delete-this-buffer-dwim) - (bind-key "C-M-a" #'backward-paragraph text-mode-map) - (bind-key "C-M-e" #'forward-paragraph text-mode-map) + (bind-key* "C-M-a" #'backward-paragraph text-mode-map) + (bind-key* "C-M-e" #'forward-paragraph text-mode-map) - (bind-key "s-x" (define-prefix-command 'super-x-map)) - (bind-key "s-," #'switch-to-dotfiles) + (bind-key* "s-x" (define-prefix-command 'super-x-map)) + (bind-key* "s-," #'switch-to-dotfiles) (set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) #+END_SRC * Misc -- cgit 1.4.1 From 132b7176873af3cdbd1a261c903fa9b6b9f140c8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 29 Oct 2015 08:56:17 +0100 Subject: Emacs: Fix preferred encoding style --- tag-emacs/emacs.d/init.org | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index eea2e00f..97689d77 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -400,8 +400,11 @@ trash for deleting on OS X. ** Encoding +UTF-8 is usually appropriate. Note that =prefer-coding-system= expects +only a coding system, not a coding system and line ending combination. + #+BEGIN_SRC emacs-lisp -(prefer-coding-system 'utf-8-auto-unix) +(prefer-coding-system 'utf-8) (set-default-coding-systems 'utf-8-auto-unix) (setq-default buffer-file-coding-system 'utf-8-auto-unix) #+END_SRC -- cgit 1.4.1 From 2221a56ad4b2b61abeba346454779c8456930380 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 29 Oct 2015 08:58:49 +0100 Subject: Emacs: Remove errors & warnings --- tag-emacs/emacs.d/init.org | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 97689d77..3e16c80c 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -465,7 +465,7 @@ with a buffer. (if server-buffer-clients (server-edit) (let ((buf (buffer-name))) - (when (equalp buf "*HTTP Response*") + (when (equal buf "*HTTP Response*") (other-window 1)) (kill-buffer buf))))) #+END_SRC @@ -480,7 +480,7 @@ open it. Whitespace butler fixes whitespace only for lines that I’m editing. :if window-system :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 @@ -1129,8 +1129,8 @@ Option/alt, then Control. (unbind-key "s-w") (bind-key* "s-k" #'kill-or-delete-this-buffer-dwim) - (bind-key* "C-M-a" #'backward-paragraph text-mode-map) - (bind-key* "C-M-e" #'forward-paragraph text-mode-map) + (bind-key "C-M-a" #'backward-paragraph text-mode-map) + (bind-key "C-M-e" #'forward-paragraph text-mode-map) (bind-key* "s-x" (define-prefix-command 'super-x-map)) (bind-key* "s-," #'switch-to-dotfiles) -- cgit 1.4.1 From 1bcd96beb5ee6656552c25318eac6b612bfd31ae Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 30 Oct 2015 15:05:37 +0100 Subject: Emacs: Remove call to uninstalled package --- tag-emacs/emacs.d/init.org | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 3e16c80c..981e914c 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1947,7 +1947,6 @@ it though :mode ("\\.js\\'" . js2-mode) :config (progn (defun ap/javascript-setup () - (autopair-mode -1) (auto-indent-mode -1)) (defun ap/js2-prev-error () (interactive) -- cgit 1.4.1 From 1c9822dfbc9d0e855f99235c627d645ba46484d7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 30 Oct 2015 15:06:11 +0100 Subject: zsh: Remove Nix setup --- host-ap-spotcap.local/config/zsh/zshenv.local | 2 -- 1 file changed, 2 deletions(-) diff --git a/host-ap-spotcap.local/config/zsh/zshenv.local b/host-ap-spotcap.local/config/zsh/zshenv.local index 9ce3bef6..f2d54677 100644 --- a/host-ap-spotcap.local/config/zsh/zshenv.local +++ b/host-ap-spotcap.local/config/zsh/zshenv.local @@ -1,3 +1 @@ # -*- mode: sh; -*- -export NIX_PATH=nixpkgs=/Users/alan/projects/nixpkgs -. /Users/alan/.nix-profile/etc/profile.d/nix.sh -- cgit 1.4.1 From a8316761c256035026fcdb7968453aa78c3a264f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 30 Oct 2015 15:17:38 +0100 Subject: Emacs: Require correct package for smartparens --- tag-emacs/emacs.d/init.org | 47 +++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 981e914c..8d82022d 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2426,29 +2426,30 @@ I didn’t find smartparens’ implementation of paredit style to be as nice as the real version #+BEGIN_SRC emacs-lisp -(req-package smartparens-config - :config (progn - (sp-use-smartparens-bindings) - (fset 'wrap-with-paren "\C-](") ;; `sp-select-next-thing-exchange' - (bind-key "C-(" #'wrap-with-paren sp-keymap) - (bind-key "C-)" #'sp-forward-slurp-sexp sp-keymap) - (bind-key "M-" #'backward-kill-word sp-keymap) - (bind-key "M-?" #'sp-convolute-sexp sp-keymap) - (bind-key "C-M-t" #'sp-transpose-sexp sp-keymap) - (bind-key "M-r" #'sp-raise-sexp sp-keymap) - (bind-key "M-s" #'sp-splice-sexp sp-keymap) - (bind-key "M-S" #'sp-split-sexp sp-keymap) - (bind-key "M-J" #'sp-join-sexp sp-keymap) - (bind-key "M-" #'sp-splice-sexp-killing-backward sp-keymap) - (bind-key "M-" #'sp-splice-sexp-killing-forward sp-keymap) - (bind-key "C-M-S-k" #'sp-kill-hybrid-sexp sp-keymap) - (bind-key "C-S-" #'sp-slurp-hybrid-sexp sp-keymap) - (sp-with-modes '(web-mode 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))) + (req-package smartparens-config + :ensure smartparens + :config (progn + (sp-use-smartparens-bindings) + (fset 'wrap-with-paren "\C-](") ;; `sp-select-next-thing-exchange' + (bind-key "C-(" #'wrap-with-paren sp-keymap) + (bind-key "C-)" #'sp-forward-slurp-sexp sp-keymap) + (bind-key "M-" #'backward-kill-word sp-keymap) + (bind-key "M-?" #'sp-convolute-sexp sp-keymap) + (bind-key "C-M-t" #'sp-transpose-sexp sp-keymap) + (bind-key "M-r" #'sp-raise-sexp sp-keymap) + (bind-key "M-s" #'sp-splice-sexp sp-keymap) + (bind-key "M-S" #'sp-split-sexp sp-keymap) + (bind-key "M-J" #'sp-join-sexp sp-keymap) + (bind-key "M-" #'sp-splice-sexp-killing-backward sp-keymap) + (bind-key "M-" #'sp-splice-sexp-killing-forward sp-keymap) + (bind-key "C-M-S-k" #'sp-kill-hybrid-sexp sp-keymap) + (bind-key "C-S-" #'sp-slurp-hybrid-sexp sp-keymap) + (sp-with-modes '(web-mode 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))) #+END_SRC ** move-text -- cgit 1.4.1 From 2bb8756607edcc0ad7ee0e5b2f0e47d9b30a764f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 2 Nov 2015 17:32:45 +0100 Subject: Emacs: Install dockerfile-mode --- tag-emacs/emacs.d/Cask | 1 + tag-emacs/emacs.d/init.org | 3 +++ 2 files changed, 4 insertions(+) diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index ead4a523..096b8024 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -34,6 +34,7 @@ (depends-on "dired-subtree") (depends-on "discover") (depends-on "discover-my-major") +(depends-on "dockerfile-mode") (depends-on "dtrt-indent") (depends-on "editorconfig") (depends-on "elisp-slime-nav") diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 8d82022d..42332b8a 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1436,6 +1436,9 @@ configuration files. (req-package haskell-mode :mode (("\\.hs\\'" . haskell-mode))) + (req-package dockerfile-mode + :mode (("Dockerfile\\'" . dockerfile-mode))) + (req-package nix-mode :mode (("\\.nix\\'" . nix-mode)) :config (progn -- cgit 1.4.1 From 0f36ecdade396e397c19b13309c7d9743bd0cedd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 3 Nov 2015 17:17:39 +0100 Subject: Emacs: Install and configure coffee-mode --- tag-emacs/emacs.d/init.org | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 42332b8a..e36d3a51 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1963,6 +1963,13 @@ it though (add-to-list 'auto-mode-alist '("composer\\.lock" . js-mode)) #+END_SRC +*** coffee-mode + +#+BEGIN_SRC emacs-lisp + (req-package coffee-mode + :mode ("\\.coffee\\'" . coffee-mode)) +#+END_SRC + *** tern Tern understands javascript. It adds really clever documented -- cgit 1.4.1 From 8dd85354ccc40bfbb43bf0051074e17ec3d58f94 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 5 Nov 2015 09:16:59 +0100 Subject: Emacs: Background-load cc-mode --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index e36d3a51..464b0cb9 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1903,7 +1903,7 @@ quite a few other modes are derived from it. #+BEGIN_SRC emacs-lisp (req-package cc-mode - :defer t + :defer 5 :init (progn (add-hook 'c-mode-common-hook #'electric-indent-mode)) :config (progn -- cgit 1.4.1 From e52aef3c88ff8487605ab8773959a493a5734616 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 9 Nov 2015 09:16:22 +0100 Subject: Emacs: Load skewer in web-mode --- tag-emacs/emacs.d/init.org | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 464b0cb9..94d2bf89 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1930,12 +1930,13 @@ really seem to use it. I don’t use this as often as I probably should. I should figure out why that is. #+BEGIN_SRC emacs-lisp -(req-package skewer-mode - :defer t - :init (progn - (add-hook 'js2-mode-hook #'skewer-mode) - (add-hook 'html-mode-hook #'skewer-html-mode) - (add-hook 'css-mode-hook #'skewer-css-mode))) + (req-package skewer-mode + :defer t + :init (progn + (add-hook 'js2-mode-hook #'skewer-mode) + (add-hook 'html-mode-hook #'skewer-html-mode) + (add-hook 'web-mode-hook #'skewer-html-mode) + (add-hook 'css-mode-hook #'skewer-css-mode))) #+END_SRC *** js2-mode -- cgit 1.4.1 From 0ad05722d21d6d8dcb953fd9fa9297f1ce49bf60 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 9 Nov 2015 09:16:44 +0100 Subject: Emacs: Load modules on startup --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 94d2bf89..4f5133ee 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1566,6 +1566,7 @@ Org is wünderbar. 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 -- cgit 1.4.1 From c416be67dfc497c1ae7b771e9cce94a5697cbea6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 10 Nov 2015 15:21:10 +0100 Subject: Emacs: Improve tangling usability Show a message when tangling and make the function a command --- tag-emacs/emacs.d/init.org | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 4f5133ee..f2766588 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2530,7 +2530,9 @@ the =org=-document after changes. "If the current buffer is 'init.org' the code-blocks are tangled, and the tangled file is compiled." + (interactive) (when (string-suffix-p "init.org" (buffer-file-name)) + (message "Tangling init") (async-start `(lambda () ;; Avoid running hooks when tangling. -- cgit 1.4.1 From c51f934a0102cd2f684e18333a4e53eebf5bd8d7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 10 Nov 2015 15:28:58 +0100 Subject: Emacs: Remove php-extras company backend --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index f2766588..9dd213db 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -882,7 +882,7 @@ seems to work perfectly well for me. :bind (("C-" . company-complete)) :init (progn (add-hook 'prog-mode-hook #'company-mode) - (setq company-backends '(company-tern (php-extras-company company-elisp company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-cmake company-capf company-gtags company-dabbrev-code company-etags company-keywords) + (setq company-backends '(company-tern (company-elisp company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-cmake company-capf company-gtags company-dabbrev-code company-etags company-keywords) company-oddmuse company-files company-dabbrev) company-idle-delay .3 company-begin-commands '(self-insert-command) -- cgit 1.4.1 From 095a891232b8742584855dc449335f69089d8286 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 10 Nov 2015 15:37:03 +0100 Subject: Emacs: Fix M-q binding --- tag-emacs/emacs.d/init.org | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 9dd213db..319ca7b3 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2169,9 +2169,9 @@ nice, when I remember to use it. (req-package esh-buf-stack :require eshell :config (progn - (bind-key "M-q" #'eshell-push-command eshell-mode-map)) - :init (progn - (setup-eshell-buf-stack))) + (setup-eshell-buf-stack) + (add-hook 'eshell-load-hook (lambda () + (bind-key "M-q" #'eshell-push-command eshell-mode-map))))) #+END_SRC *** Shells -- cgit 1.4.1 From 20e56f1995e9bbf01c099d3d80e852aebe6aff8b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 11 Nov 2015 14:52:25 +0100 Subject: Emacs: Move ap-functions into init file --- tag-emacs/emacs.d/elisp/ap-functions.el | 47 ------------------------------ tag-emacs/emacs.d/init.org | 51 ++++++++++++++++++++++++--------- 2 files changed, 37 insertions(+), 61 deletions(-) delete mode 100644 tag-emacs/emacs.d/elisp/ap-functions.el diff --git a/tag-emacs/emacs.d/elisp/ap-functions.el b/tag-emacs/emacs.d/elisp/ap-functions.el deleted file mode 100644 index bdc7faef..00000000 --- a/tag-emacs/emacs.d/elisp/ap-functions.el +++ /dev/null @@ -1,47 +0,0 @@ -;;;###autoload -(defun ap/remove-extra-cr () - "Remove extraneous CR codes from a file" - (interactive) - (save-excursion - (goto-char (point-min)) - (while (search-forward " -" nil t) - (replace-match "")))) - -;;;###autoload -(defun copy-rectangle (start end) - "Copy the region-rectangle." - (interactive "r") - (setq killed-rectangle (extract-rectangle start end))) - -;;;###autoload -(defun eval-and-replace () - "Replace the preceding sexp with its value." - (interactive) - (backward-kill-sexp) - (condition-case nil - (prin1 (eval (read (current-kill 0))) - (current-buffer)) - (error (message "Invalid expression") - (insert (current-kill 0))))) - -;;;###autoload -(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))) - -;;;###autoload -(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))) - -(provide 'ap-functions) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 319ca7b3..ce1a1f66 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -29,14 +29,6 @@ the buffer to be empty. * Packaging -I still use a couple of [[file:elisp/][elisp files]] that don’t appear to be in any package -archives. -#+BEGIN_SRC emacs-lisp -(add-to-list 'load-path (expand-file-name "elisp/" user-emacs-directory)) -#+END_SRC - -** TODO Move [[file:elisp/ap-functions.el][=ap-functions=]] into this file and delete above - ** Cask For most packages, I use [[https://github.com/cask/cask][cask]] @@ -338,7 +330,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource ((eq window-system 'w32) (ap/set-fonts "Consolas" "Segoe UI" 10)) ((eq system-type 'darwin) - (ap/set-fonts "Input Mono Narrow" "Input Sans Condensed" 12)))) + (ap/set-fonts "Input Mono" "Input Sans Condensed" 13)))) #+END_SRC Allow font-lock-mode to do background parsing. I’m not really sure if @@ -1162,10 +1154,40 @@ Option/alt, then Control. indentation::space indentation::tabs))) - (req-package ap-functions - :commands (ap/remove-extra-cr) - :bind (("C-x r M-w" . copy-rectangle) - ("M-!" . shell-execute))) + (defun ap/remove-extra-cr () + "Remove extraneous CR codes from a file" + (interactive) + (save-excursion + (goto-char (point-min)) + (while (search-forward " + " nil t) + (replace-match "")))) + + (req-package rect + :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))) + + (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))) + + (bind-key* "M-!" #'shell-execute) + (bind-key* "C-x r M-w" #'copy-rectangle) #+END_SRC #+END_SRC @@ -1539,7 +1561,8 @@ Org is wünderbar. org-reverse-note-order t org-modules '(org-habit - org-checklist) + org-checklist + org-protocol) ;; Add time done to ‘done’ tasks org-log-done 'time -- cgit 1.4.1 From 8b897dd81058f7a3e3cfff6a02b8f06aa86370ea Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 11 Nov 2015 15:34:27 +0100 Subject: zsh: Setup nix on Spotcap laptop --- host-ap-spotcap.local/config/zsh/zshenv.local | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/host-ap-spotcap.local/config/zsh/zshenv.local b/host-ap-spotcap.local/config/zsh/zshenv.local index f2d54677..f6881be2 100644 --- a/host-ap-spotcap.local/config/zsh/zshenv.local +++ b/host-ap-spotcap.local/config/zsh/zshenv.local @@ -1 +1,5 @@ # -*- mode: sh; -*- +if [[ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]] +then + . $HOME/.nix-profile/etc/profile.d/nix.sh; +fi -- cgit 1.4.1 From 47dd9149961f48bc1e1dc66916a9225db81d7845 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 12 Nov 2015 12:45:07 +0100 Subject: Emacs: Remove apparently-unused packages --- tag-emacs/emacs.d/init.org | 143 +++++---------------------------------------- 1 file changed, 13 insertions(+), 130 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index ce1a1f66..ef9e4912 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -164,17 +164,6 @@ based upon some folder conventions I use. projectile-completion-system 'ivy))) #+END_SRC -** projector - -Project-based shell buffers sounds like a good idea, but for some -reason I haven’t found a use for it. - -#+BEGIN_SRC emacs-lisp -(req-package projector - :require projectile - :bind (("s-z" . projector-open-project-shell))) -#+END_SRC - ** perspective This package makes buffer-switching inside of projects make sense, by @@ -485,19 +474,6 @@ for similar things any more. :bind ("M-SPC" . shrink-whitespace)) #+END_SRC -** fasd - -Fasd is a nice shell plugin that remembers file and folder arguments, -making it easy to re-visit them later. This package hooks into that. -I don’t seem to use it much though. - -#+BEGIN_SRC emacs-lisp -(req-package fasd - :bind ("C-x C-/" . fasd-find-file) - :init (progn - (global-fasd-mode 1))) -#+END_SRC - ** recentf I only use this occasionally, but it’s nice for files outside of projects. @@ -526,7 +502,7 @@ it off to see if I notice it. #+BEGIN_SRC emacs-lisp (req-package saveplace - :config (progn (setq-default save-place t) + :config (progn (setq-default save-place nil) (setq save-place-file (expand-file-name ".saveplace" user-emacs-directory)))) #+END_SRC @@ -728,19 +704,6 @@ Enable it without prompting (put 'narrow-to-region 'disabled nil) #+END_SRC -** Fancy Narrow - -Sometimes I like to be able to focus on one block of code at a time. -Normally narrowing hides everything else completely, which I don’t -like. This package just makes everything else lower-contrast. -#+BEGIN_SRC emacs-lisp - (req-package fancy-narrow - :defer 15 - :diminish fancy-narrow-mode - :config (fancy-narrow-mode 1)) -#+END_SRC - - ** ace-window I don’t often have many windows open at once, but when I do, @@ -796,20 +759,6 @@ A dedicated window always keeps the same buffer in view. "normal"))) #+END_SRC -** popwin - -This works really nicely wiht helm. I should think about whether it -might be useful elsewhere - -#+BEGIN_SRC emacs-lisp -(req-package popwin - :if (and (>= emacs-major-version 24) - (> emacs-minor-version 3)) - :config (progn - (popwin-mode 1) - (add-to-list 'popwin:special-display-config '("^*helm.+*$" :regexp t :height 20)))) -#+END_SRC - ** winner Undo, for window-based commands. @@ -1139,21 +1088,6 @@ Option/alt, then Control. "Where the emacs init file really is, passing through symlinks.") (set-register ?e `(file . ,*init-file*)) - (req-package whitespace - :defer t - :config (setq whitespace-style - '(face - space - tabs - trailing - newline - empty - tab-mark - space-before-tab - indentation - indentation::space - indentation::tabs))) - (defun ap/remove-extra-cr () "Remove extraneous CR codes from a file" (interactive) @@ -1216,22 +1150,6 @@ Occasionally, I exit emacs. I should probably reduce the frequency of this. (defalias 'exit-emacs #'save-buffers-kill-emacs)) #+END_SRC -** helm - -I like to use =helm= for some completions, especially when there are -lots of candidates. - -#+BEGIN_SRC emacs-lisp - (req-package helm-config - :demand t - :ensure helm - :config (progn - (setq helm-idle-delay .1 - helm-input-idle-delay 0) - (when (fboundp #'helm-adaptive-mode) - (helm-adaptive-mode 1)))) -#+END_SRC - ** swiper/ivy Ivy is the new kid on the completion block. I wonder if it can @@ -1681,21 +1599,6 @@ I can use this to keep a journal. I should use it. #+END_SRC * Programming -** cedet - -*** TODO Setup cedet and see whether it’s useful - -#+BEGIN_SRC emacs-lisp -(req-package cedet - :disabled t - :config (progn - (semantic-load-enable-code-helpers) - (global-semantic-idle-completions-mode t) - (global-semantic-highlight-func-mode t) - (global-semantic-show-unmatched-syntax-mode t) - (global-semantic-decoration-mode t))) -#+END_SRC - ** flycheck On-the-fly error checking in programming modes? Yes please. @@ -1949,20 +1852,6 @@ really seem to use it. ** Web development -*** skewer-mode - -I don’t use this as often as I probably should. I should figure out -why that is. -#+BEGIN_SRC emacs-lisp - (req-package skewer-mode - :defer t - :init (progn - (add-hook 'js2-mode-hook #'skewer-mode) - (add-hook 'html-mode-hook #'skewer-html-mode) - (add-hook 'web-mode-hook #'skewer-html-mode) - (add-hook 'css-mode-hook #'skewer-css-mode))) -#+END_SRC - *** js2-mode This mode is really great for editing Javascript. It turns code into @@ -2200,28 +2089,22 @@ nice, when I remember to use it. *** Shells #+BEGIN_SRC emacs-lisp -(req-package shell - :defer t - :config (define-key shell-mode-map - (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) - -(req-package comint - :defer t - :config (bind-key "C-c C-l" #'helm-comint-input-ring comint-mode-map)) + (req-package shell + :defer t + :config (define-key shell-mode-map + (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) -(req-package multi-term - :if (not (eq system-type 'windows-nt)) - :bind ("C-`" . multi-term-dedicated-toggle)) + (req-package comint + :defer t + :config (bind-key "C-c C-l" #'helm-comint-input-ring comint-mode-map)) -(defun comint-delchar-or-eof-or-kill-buffer (arg) - (interactive "p") - (if (null (get-buffer-process (current-buffer))) - (kill-buffer) - (comint-delchar-or-maybe-eof arg))) + (defun comint-delchar-or-eof-or-kill-buffer (arg) + (interactive "p") + (if (null (get-buffer-process (current-buffer))) + (kill-buffer) + (comint-delchar-or-maybe-eof arg))) #+END_SRC -*** TODO Do I need multi-term? - * Text editing Emacs has an editor within. -- cgit 1.4.1 From 43d0e86610038d4b73a1675deabe02498b093e17 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 13 Nov 2015 09:00:53 +0100 Subject: Emacs: Use only secure package archives --- tag-emacs/emacs.d/init.org | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index ef9e4912..26730028 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -65,11 +65,10 @@ cask update #+BEGIN_SRC emacs-lisp (eval-and-compile - (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") - ("marmalade" . "http://marmalade-repo.org/packages/") - ("melpa" . "http://melpa.org/packages/") - ("melpa-stable" . "http://stable.melpa.org/packages/") - ("org" . "http://orgmode.org/elpa/"))) + (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") + ("marmalade" . "https://marmalade-repo.org/packages/") + ("melpa" . "https://melpa.org/packages/") + ("melpa-stable" . "https://stable.melpa.org/packages/"))) (package-initialize) (unless (package-installed-p 'req-package) (package-refresh-contents) -- cgit 1.4.1 From fd9734e7eaac3749a2a0ae3f7e47f34515070866 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 13 Nov 2015 10:02:41 +0100 Subject: Emacs: Improve TLS security --- tag-emacs/emacs.d/init.org | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 26730028..ab2a0873 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -64,6 +64,19 @@ cask update ** Req-package #+BEGIN_SRC emacs-lisp + (let ((trustfile + (replace-regexp-in-string + "\\\\" "/" + (replace-regexp-in-string + "\n" "" + (shell-command-to-string "python -m certifi"))))) + (setq tls-checktrust t + tls-program + (list + (format "gnutls-cli%s --x509cafile %s -p %%p %%h" + (if (eq window-system 'w32) ".exe" "") trustfile))) + (setq gnutls-verify-error t) + (setq gnutls-trustfiles (list trustfile))) (eval-and-compile (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") ("marmalade" . "https://marmalade-repo.org/packages/") -- cgit 1.4.1 From dc6b681b05468122c7602c24847b770d1402d2c8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 13 Nov 2015 15:35:32 +0100 Subject: Emacs: Use a proper ellipsis for elisions --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index ab2a0873..6d319e5e 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1483,6 +1483,7 @@ Org is wünderbar. :init (setq org-replace-disputed-keys t) :config (progn (setq org-directory "~/Sync/org" + org-ellipsis "…" org-agenda-files `(,(concat org-directory "/agenda")) org-default-notes-file (concat org-directory "/notes") -- cgit 1.4.1 From dbb5e71d90cbe3833df166cf7183d7b07c090bd5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 15 Nov 2015 13:56:32 +0100 Subject: Emacs: Fix ledger report auto-refresh --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 8d82022d..793a454b 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1406,6 +1406,7 @@ modes. ("interaction" "i" :prefix) ("interactive" "i" :prefix) ("menu" "▤" :postfix) + ("ledger" "Ledger") ("mode" "") ("shell" "sh" :postfix))) (cyphejor-mode 1))) -- cgit 1.4.1 From e2fd5162a7e0018c911865f85b2d5dbf73020ed3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 16 Nov 2015 09:56:33 +0100 Subject: Emacs: Fix slowness/hanging with TRAMP --- tag-emacs/emacs.d/init.org | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 6d319e5e..d23d2398 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1333,13 +1333,8 @@ I put some of it in the frame-line at the top. )) (setq frame-title-format - '((:eval (if (and (fboundp #'projectile-project-p) - (projectile-project-p)) - (projectile-project-name))) - ": " - (:eval (if (buffer-file-name) - (buffer-name) - "%b")))) + '(multiple-frames "%b" + ("" "%F"))) #+END_SRC ** Renaming major modes -- cgit 1.4.1 From 512cd43b1ae36c6f39569b81958d9e94053c40f6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 16 Nov 2015 09:57:27 +0100 Subject: Emacs: More defer --- tag-emacs/emacs.d/init.org | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index d23d2398..5f308ac7 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -503,6 +503,7 @@ An awesome way to open files on OS X. #+BEGIN_SRC emacs-lisp (req-package spotlight + :defer 10 :if (eq system-type 'darwin) :config (setq spotlight-tmp-file "/tmp/.emacs-spotlight-tmp-file")) #+END_SRC @@ -935,6 +936,7 @@ Don’t show uninteresting files in dired listings. #+BEGIN_SRC emacs-lisp (req-package dired+ + :defer 5 :require dired :config (progn (diredp-toggle-find-file-reuse-dir 1) @@ -1561,7 +1563,7 @@ I can use this to keep a journal. I should use it. #+BEGIN_SRC emacs-lisp (req-package org-mobile :require org - :defer t + :defer 30 :config (progn (setq org-mobile-directory "~/Mobile/Org" org-mobile-inbox-for-pull "~/Mobile/Org/from-mobile.org") @@ -1900,6 +1902,7 @@ completions, besides other IDE-like things. #+BEGIN_SRC emacs-lisp (req-package tern :commands ap/enable-tern + :defer 5 :config (progn (setq tern-command (list (executable-find "tern"))) (defun ap/enable-tern () @@ -1907,6 +1910,7 @@ completions, besides other IDE-like things. (add-hook 'js2-mode-hook #'ap/enable-tern))) (req-package company-tern + :defer 5 :require (tern company)) #+END_SRC @@ -2130,12 +2134,13 @@ Emacs has an editor within. The most important one for me is JSON property alignment. #+BEGIN_SRC emacs-lisp -(req-package align - :config (progn - (add-to-list 'align-rules-list - '(colon-key-value - (regexp . ":\\(\\s-*\\)") - (modes . '(js2-mode)))))) + (req-package align + :defer 10 + :config (progn + (add-to-list 'align-rules-list + '(colon-key-value + (regexp . ":\\(\\s-*\\)") + (modes . '(js2-mode)))))) #+END_SRC ** Clipboard -- cgit 1.4.1 From d7f84de5c5ea6e2904bf5efcb9ab72ec65fc50ac Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 16 Nov 2015 09:58:27 +0100 Subject: Emacs: Disable unused magit features --- 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 5f308ac7..0db6ab27 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -229,10 +229,9 @@ time. Make sure to set it up with a nice =completing-read-function= :commands (magit-status) :config (progn (setq magit-last-seen-setup-instructions "1.4.0" magit-completing-read-function #'magit-builtin-completing-read - magit-wip-after-save-mode t - magit-wip-after-apply-mode t magit-popup-use-prefix-argument 'default magit-push-always-verify nil + global-magit-file-mode nil magit-revert-buffers t) (add-to-list 'magit-no-confirm 'safe-with-wip)) :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) -- cgit 1.4.1 From 60872a8c3737b285e0281454e8c44b057bd92a0c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 16 Nov 2015 09:58:38 +0100 Subject: Emacs: Fix org-ellipsis setting --- tag-emacs/emacs.d/init.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 0db6ab27..e17eaa79 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1476,10 +1476,10 @@ Org is wünderbar. ("C-c a" . org-agenda) ("C-c l" . org-store-link)) :defer 8 - :init (setq org-replace-disputed-keys t) + :init (setq org-replace-disputed-keys t + org-ellipsis "…") :config (progn (setq org-directory "~/Sync/org" - org-ellipsis "…" org-agenda-files `(,(concat org-directory "/agenda")) org-default-notes-file (concat org-directory "/notes") -- cgit 1.4.1 From 038456def8db8c79d36a0332a13e88b2366a2860 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 16 Nov 2015 09:59:00 +0100 Subject: Emacs: Add org-journal binding --- tag-emacs/emacs.d/init.org | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index e17eaa79..75811afb 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1549,11 +1549,12 @@ with R or something. I can use this to keep a journal. I should use it. #+BEGIN_SRC emacs-lisp -(req-package org-journal - :require org - :defer t - :config (progn - (setq org-journal-date-format "%A, %d %B %Y"))) + (req-package org-journal + :require org + :bind ("s-j" . org-journal-new-entry) + :defer 20 + :config (progn + (setq org-journal-date-format "%A, %d %B %Y"))) #+END_SRC **** org-mobile -- cgit 1.4.1 From 0e0d0fbd9a9926739c014b83f268fe06e113bfe4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 16 Nov 2015 09:59:27 +0100 Subject: Fix indentation --- tag-emacs/emacs.d/init.org | 200 +++++++++++++++++++++++---------------------- 1 file changed, 101 insertions(+), 99 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 75811afb..ed21bd12 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1995,35 +1995,36 @@ With =web-mode= being so good, I don’t really use this much. It’s good for embedded SQL though. #+BEGIN_SRC emacs-lisp -(req-package mmm-auto - :config (progn - (mmm-add-classes - '((php-sql - :submode sql-mode - :front "<< (point) (mark)) - (exchange-point-and-mark)) - (save-excursion - (while (re-search-forward (regexp-quote (string omark)) (mark) t) - (replace-match (regexp-quote (string singleo)) nil nil))) - (save-excursion - (while (re-search-forward (regexp-quote (string qmark)) (mark) t) - (replace-match (regexp-quote (string singleq)) nil nil))) - (skeleton-insert (list nil omark '_ qmark) -1))) - ((looking-at (regexp-opt (list (string omark) (string qmark)))) - (forward-char 1)) - (t ad-do-it))))) - :init (progn - (add-hook 'text-mode-hook #'typopunct-mode))) + ((or (eq (char-before) typopunct-em-dash) + (looking-back "\\([[:blank:]]\\|^\\)\\^")) + (delete-char -1) + (insert typopunct-minus)) + ((looking-back "[^[:blank:]]\\^") + (insert typopunct-minus)) + (t ad-do-it))) + + (defconst typopunct-ellipsis (decode-char 'ucs #x2026)) + (defconst typopunct-middot (decode-char 'ucs #xB7)) ; or 2219 + (defun typopunct-insert-ellipsis-or-middot (arg) + "Change three consecutive dots to a typographical ellipsis mark." + (interactive "p") + (cond + ((and (= 1 arg) + (eq (char-before) ?^)) + (delete-char -1) + (insert typopunct-middot)) + ((and (= 1 arg) + (eq this-command last-command) + (looking-back "\\.\\.")) + (replace-match "") + (insert typopunct-ellipsis)) + (t + (self-insert-command arg)))) + (define-key typopunct-map "." 'typopunct-insert-ellipsis-or-middot) + + (defconst typopunct-times (decode-char 'ucs #xD7)) + (defun typopunct-insert-times (arg) + (interactive "p") + (if (and (= 1 arg) (looking-back "\\([[:blank:]]\\|^\\)\\^")) + (progn (delete-char -1) + (insert typopunct-times)) + (self-insert-command arg))) + (define-key typopunct-map "x" 'typopunct-insert-times) + + (defadvice typopunct-insert-quotation-mark (around wrap-region activate) + (let* ((lang (or (get-text-property (point) 'typopunct-language) + typopunct-buffer-language)) + (omark (if single + (typopunct-opening-single-quotation-mark lang) + (typopunct-opening-quotation-mark lang))) + (qmark (if single + (typopunct-closing-single-quotation-mark lang) + (typopunct-closing-quotation-mark lang)))) + (cond + (mark-active + (let ((skeleton-end-newline nil) + (singleo (typopunct-opening-single-quotation-mark lang)) + (singleq (typopunct-closing-single-quotation-mark lang))) + (if (> (point) (mark)) + (exchange-point-and-mark)) + (save-excursion + (while (re-search-forward (regexp-quote (string omark)) (mark) t) + (replace-match (regexp-quote (string singleo)) nil nil))) + (save-excursion + (while (re-search-forward (regexp-quote (string qmark)) (mark) t) + (replace-match (regexp-quote (string singleq)) nil nil))) + (skeleton-insert (list nil omark '_ qmark) -1))) + ((looking-at (regexp-opt (list (string omark) (string qmark)))) + (forward-char 1)) + (t ad-do-it))))) + :init (progn + (add-hook 'text-mode-hook #'typopunct-mode))) #+END_SRC ** avy -- cgit 1.4.1 From eaad53be0b89234332b67f6c4d980c4cd8efcf8c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 16 Nov 2015 15:37:17 +0100 Subject: Emacs: Remove cask and pallet Instead, use a package-directory based upon the emacs version, which was the main feature about cask, for me. --- hooks/post-up/emacs | 11 +--- tag-emacs/emacs.d/Cask | 150 --------------------------------------------- tag-emacs/emacs.d/init.org | 49 +-------------- 3 files changed, 3 insertions(+), 207 deletions(-) delete mode 100644 tag-emacs/emacs.d/Cask diff --git a/hooks/post-up/emacs b/hooks/post-up/emacs index b8a8edc7..1cc19f9f 100755 --- a/hooks/post-up/emacs +++ b/hooks/post-up/emacs @@ -2,22 +2,13 @@ if [[ -s $commands[emacs] ]] then - if [[ ! -d ~/cask ]] - then - git clone git://github.com/cask/cask ~/.cask - if [[ ! -d ~/bin ]] - then - mkdir ~/bin - fi - ln -s ~/.cask/bin/cask ~/bin/cask - fi pushd ~/.emacs.d - cask install emacs --batch --eval "(progn (find-file \"init.org\") (require 'ob-tangle) (org-babel-tangle nil \"init.el\") (byte-compile-file \"init.el\") +(load-file \"init.el\") )" popd fi diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask deleted file mode 100644 index 096b8024..00000000 --- a/tag-emacs/emacs.d/Cask +++ /dev/null @@ -1,150 +0,0 @@ -(source gnu) -(source marmalade) -(source melpa) -(source melpa-stable) -(source org) - -(depends-on "ace-window") -(depends-on "ag") -(depends-on "async") -(depends-on "auto-compile") -(depends-on "auto-indent-mode") -(depends-on "autopair") -(depends-on "avy") -(depends-on "bind-key") -(depends-on "cask") -(depends-on "cider") -(depends-on "clj-refactor") -(depends-on "clojure-mode") -(depends-on "coffee-mode") -(depends-on "company") -(depends-on "company-go") -(depends-on "company-tern") -(depends-on "counsel") -(depends-on "csv-mode") -(depends-on "cyphejor") -(depends-on "dash") -(depends-on "dash-functional") -(depends-on "deferred") -(depends-on "diff-hl") -(depends-on "diminish") -(depends-on "dired+") -(depends-on "dired-hacks-utils") -(depends-on "dired-k") -(depends-on "dired-subtree") -(depends-on "discover") -(depends-on "discover-my-major") -(depends-on "dockerfile-mode") -(depends-on "dtrt-indent") -(depends-on "editorconfig") -(depends-on "elisp-slime-nav") -(depends-on "emmet-mode") -(depends-on "epl") -(depends-on "expand-region") -(depends-on "f") -(depends-on "fancy-narrow") -(depends-on "fasd") -(depends-on "feature-mode") -(depends-on "flx") -(depends-on "flx-ido") -(depends-on "flycheck") -(depends-on "framemove") -(depends-on "geiser") -(depends-on "ggtags") -(depends-on "gh") -(depends-on "gist") -(depends-on "git-commit") -(depends-on "git-timemachine") -(depends-on "gntp") -(depends-on "go-eldoc") -(depends-on "go-mode") -(depends-on "go-projectile") -(depends-on "goto-chg") -(depends-on "grizzl") -(depends-on "haskell-mode") -(depends-on "helm") -(depends-on "helm-dash") -(depends-on "helm-projectile") -(depends-on "helm-swoop") -(depends-on "help-fns+") -(depends-on "hemisu-theme") -(depends-on "highlight-stages") -(depends-on "ido-completing-read+") -(depends-on "ido-vertical-mode") -(depends-on "jinja2-mode") -(depends-on "jquery-doc") -(depends-on "js2-mode") -(depends-on "json-mode") -(depends-on "json-reformat") -(depends-on "ledger-mode") -(depends-on "let-alist") -(depends-on "litable") -(depends-on "log4e") -(depends-on "logito") -(depends-on "lua-mode") -(depends-on "magit") -(depends-on "makey") -(depends-on "markdown-mode") -(depends-on "mmm-mode") -(depends-on "move-text") -(depends-on "multi-term") -(depends-on "multiple-cursors") -(depends-on "nginx-mode") -(depends-on "nix-mode") -(depends-on "nodejs-repl") -(depends-on "org-journal") -(depends-on "org-plus-contrib") -(depends-on "package-build") -(depends-on "packed") -(depends-on "page-break-lines") -(depends-on "pallet") -(depends-on "paredit") -(depends-on "password-store") -(depends-on "pcache") -(depends-on "persp-projectile") -(depends-on "perspective") -(depends-on "php-extras") -(depends-on "php-mode") -(depends-on "pkg-info") -(depends-on "popwin") -(depends-on "projectile") -(depends-on "pt") -(depends-on "queue") -(depends-on "quickrun") -(depends-on "rainbow-mode") -(depends-on "redshank") -(depends-on "relative-buffers") -(depends-on "req-package") -(depends-on "restclient") -(depends-on "s") -(depends-on "sass-mode") -(depends-on "scss-mode") -(depends-on "shrink-whitespace") -(depends-on "shut-up") -(depends-on "simple-httpd") -(depends-on "skewer-mode") -(depends-on "slime") -(depends-on "slime-repl") -(depends-on "smart-tab") -(depends-on "smart-tabs-mode") -(depends-on "smartparens") -(depends-on "smex") -(depends-on "solarized-theme") -(depends-on "spinner") -(depends-on "spotlight") -(depends-on "swiper") -(depends-on "tern") -(depends-on "toml-mode") -(depends-on "tup-mode") -(depends-on "typopunct") -(depends-on "undo-tree") -(depends-on "use-package") -(depends-on "visual-regexp") -(depends-on "web-mode") -(depends-on "wgrep") -(depends-on "wgrep-ag") -(depends-on "wgrep-pt") -(depends-on "ws-butler") -(depends-on "xrdb-mode" :git "git://github.com/emacsmirror/xrdb-mode") -(depends-on "yaml-mode") -(depends-on "yasnippet") diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index ed21bd12..720f14df 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -29,38 +29,6 @@ the buffer to be empty. * Packaging -** Cask - -For most packages, I use [[https://github.com/cask/cask][cask]] -#+BEGIN_SRC emacs-lisp - (eval-and-compile - (add-to-list 'load-path (expand-file-name "~/.cask"))) - (require 'cask) - (cask-initialize) -#+END_SRC - -*** Cask commands - -Installing -#+BEGIN_SRC sh :tangle no -curl -fsSL https://raw.githubusercontent.com/cask/cask/master/go | python -#+END_SRC - -Install all packages specified in the Caskfile -#+BEGIN_SRC sh :tangle no :dir ~/.emacs.d/ -cask install -#+END_SRC - -List packages with new versions -#+BEGIN_SRC sh :tangle no :dir ~/.emacs.d/ :results output -cask outdated -#+END_SRC - -Update old packages -#+BEGIN_SRC sh :tangle no :dir ~/.emacs.d/ -cask update -#+END_SRC - ** Req-package #+BEGIN_SRC emacs-lisp @@ -81,7 +49,8 @@ cask update (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") ("marmalade" . "https://marmalade-repo.org/packages/") ("melpa" . "https://melpa.org/packages/") - ("melpa-stable" . "https://stable.melpa.org/packages/"))) + ("melpa-stable" . "https://stable.melpa.org/packages/")) + package-user-dir (concat "~/.emacs.d/packages/" emacs-version "/elpa")) (package-initialize) (unless (package-installed-p 'req-package) (package-refresh-contents) @@ -90,19 +59,6 @@ cask update (setq use-package-verbose t) #+END_SRC -** Pallet - -I use [[https://github.com/rdallasgray/pallet][pallet]] to keep my [[file:Cask][Caskfile]] up-to-date with packages installed -from inside Emacs. I don’t need it on startup, so I tell -=req-package= to initialise it when Emacs is idle. - -#+BEGIN_SRC emacs-lisp -(req-package pallet - :defer 5 - :config (pallet-mode 1)) -#+END_SRC - - * Customize I don’t really like using customize for normal configuration. Instead, I use it for things that get saved automatically. That’s why @@ -1706,7 +1662,6 @@ Customise the modeline-display of =emacs-lisp-mode=. Then make sure it runs the common lisp hooks. #+BEGIN_SRC emacs-lisp -(add-to-list 'auto-mode-alist '("/Cask\\'" . emacs-lisp-mode)) (add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup) (add-hook 'emacs-lisp-mode-hook #'eldoc-mode) #+END_SRC -- cgit 1.4.1 From a48acf4d16a03bc2b2945f37a697925f810296c1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 16 Nov 2015 15:38:19 +0100 Subject: Emacs: Replace typopunct-mode with typo-mode --- tag-emacs/emacs.d/init.org | 73 ++-------------------------------------------- 1 file changed, 3 insertions(+), 70 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 720f14df..ed0139f3 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2170,78 +2170,11 @@ I like using typographic symbols, but I don’t always remember (how) to type them. #+BEGIN_SRC emacs-lisp - (req-package typopunct - :commands (typopunct-mode) + (req-package typo :config (progn - (typopunct-change-language 'english t) - (defconst typopunct-minus (decode-char 'ucs #x2212)) - (defadvice typopunct-insert-typographical-dashes - (around minus-or-pm activate) - (cond - ((or (eq (char-before) typopunct-em-dash) - (looking-back "\\([[:blank:]]\\|^\\)\\^")) - (delete-char -1) - (insert typopunct-minus)) - ((looking-back "[^[:blank:]]\\^") - (insert typopunct-minus)) - (t ad-do-it))) - - (defconst typopunct-ellipsis (decode-char 'ucs #x2026)) - (defconst typopunct-middot (decode-char 'ucs #xB7)) ; or 2219 - (defun typopunct-insert-ellipsis-or-middot (arg) - "Change three consecutive dots to a typographical ellipsis mark." - (interactive "p") - (cond - ((and (= 1 arg) - (eq (char-before) ?^)) - (delete-char -1) - (insert typopunct-middot)) - ((and (= 1 arg) - (eq this-command last-command) - (looking-back "\\.\\.")) - (replace-match "") - (insert typopunct-ellipsis)) - (t - (self-insert-command arg)))) - (define-key typopunct-map "." 'typopunct-insert-ellipsis-or-middot) - - (defconst typopunct-times (decode-char 'ucs #xD7)) - (defun typopunct-insert-times (arg) - (interactive "p") - (if (and (= 1 arg) (looking-back "\\([[:blank:]]\\|^\\)\\^")) - (progn (delete-char -1) - (insert typopunct-times)) - (self-insert-command arg))) - (define-key typopunct-map "x" 'typopunct-insert-times) - - (defadvice typopunct-insert-quotation-mark (around wrap-region activate) - (let* ((lang (or (get-text-property (point) 'typopunct-language) - typopunct-buffer-language)) - (omark (if single - (typopunct-opening-single-quotation-mark lang) - (typopunct-opening-quotation-mark lang))) - (qmark (if single - (typopunct-closing-single-quotation-mark lang) - (typopunct-closing-quotation-mark lang)))) - (cond - (mark-active - (let ((skeleton-end-newline nil) - (singleo (typopunct-opening-single-quotation-mark lang)) - (singleq (typopunct-closing-single-quotation-mark lang))) - (if (> (point) (mark)) - (exchange-point-and-mark)) - (save-excursion - (while (re-search-forward (regexp-quote (string omark)) (mark) t) - (replace-match (regexp-quote (string singleo)) nil nil))) - (save-excursion - (while (re-search-forward (regexp-quote (string qmark)) (mark) t) - (replace-match (regexp-quote (string singleq)) nil nil))) - (skeleton-insert (list nil omark '_ qmark) -1))) - ((looking-at (regexp-opt (list (string omark) (string qmark)))) - (forward-char 1)) - (t ad-do-it))))) + (typo-global-mode 1)) :init (progn - (add-hook 'text-mode-hook #'typopunct-mode))) + (add-hook 'text-mode-hook #'typo-mode))) #+END_SRC ** avy -- cgit 1.4.1 From b1dd16c2b12ed760658db3f7f47aab3c7234c43e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 16 Nov 2015 16:01:08 +0100 Subject: Emacs: Set a nicer frame-title-format --- 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 3f2b7243..943a5a65 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1290,8 +1290,7 @@ I put some of it in the frame-line at the top. )) (setq frame-title-format - '(multiple-frames "%b" - ("" "%F"))) + '("%f" (dired-directory dired-directory))) #+END_SRC ** Renaming major modes -- cgit 1.4.1 From 818df9fc3af1a0f6deb903d262065256938e5676 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 16 Nov 2015 16:33:45 +0100 Subject: Emacs: Set latitude and longitude to Berlin --- tag-emacs/emacs.d/init.org | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 943a5a65..af96248e 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -807,11 +807,13 @@ seems to work perfectly well for me. Weeks start on Monday for me and I prefer ISO-style dates. #+BEGIN_SRC emacs-lisp -(req-package calendar - :defer 1 - :config (progn - (setq calendar-week-start-day 1) - (calendar-set-date-style 'iso))) + (req-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))) #+END_SRC Sometimes I want to insert a date or time into a buffer. -- cgit 1.4.1 From f6c607e6a350eea8d5b7cfe20f9fe47317d03aee Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 16 Nov 2015 16:38:20 +0100 Subject: Emacs: Change themes based on sunlight --- tag-emacs/emacs.d/init.org | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index af96248e..4dcbe057 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -237,7 +237,8 @@ lot of modes. #+BEGIN_SRC emacs-lisp (req-package solarized-theme :config (progn - (load-theme 'solarized-light t))) + (load-theme 'solarized-light t t) + (load-theme 'solarized-dark t t))) #+END_SRC Colourise colour names in certain types of buffer. I don’t use this @@ -837,6 +838,34 @@ Sometimes I want to insert a date or time into a buffer. (insert (format-time-string format)))) #+END_SRC +** Time of Day + +#+BEGIN_SRC emacs-lisp + (req-package rase + :config (progn + (defun switch-themes (sun-event &optional first-run) + "Switch themes on sunrise and sunset." + (if first-run ; set theme on initialization + (cond ((memq sun-event '(sunrise midday)) + (disable-theme 'solarized-dark) + (enable-theme 'solarized-light)) + ((memq sun-event '(sunset midnight)) + (disable-theme 'solarized-light) + (enable-theme 'solarized-dark))) + (cond ((eq sun-event 'sunrise) ; after initialization deal only + (disable-theme 'solarized-dark) ; with sunrise and sunset + (enable-theme 'solarized-light)) + ((eq sun-event 'sunset) + (disable-theme 'solarized-light) + (enable-theme 'solarized-dark))))) + + ;; sign this function to be invoked on sun events + (add-hook 'rase-functions 'switch-themes) + + ;; start the run-at-sun-event daemon, invoking hooks immediately + (rase-start t))) +#+END_SRC + * Directories Dired works quite nicely, but not always in the way I want. I don’t -- cgit 1.4.1 From a6486abd8b4f7e47884bf324ac7fcb7b76d4e260 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 16 Nov 2015 16:42:04 +0100 Subject: Emacs: Monitor location and set lat/long (OSX) --- tag-emacs/emacs.d/init.org | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 4dcbe057..b832b037 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -840,6 +840,19 @@ Sometimes I want to insert a date or time into a buffer. ** Time of Day +#+BEGIN_SRC emacs-lisp + (req-package osx-location + :if (eq system-type 'darwin) + :config (progn + (add-hook 'osx-location-changed-hook + (lambda () + (setq calendar-latitude osx-location-latitude + calendar-longitude osx-location-longitude + calendar-location-name (format "%s, %s" osx-location-latitude osx-location-longitude)) + (rase-start))) + (osx-location-watch))) +#+END_SRC + #+BEGIN_SRC emacs-lisp (req-package rase :config (progn -- cgit 1.4.1 From 4f8474bb4397513c51f3b997aab94855200f29bf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 16 Nov 2015 17:19:08 +0100 Subject: Emacs: Ensure ag package is available --- tag-emacs/emacs.d/init.org | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index b832b037..8c90cbae 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -84,6 +84,14 @@ pass =:noerror= to =load= (projectile-persp-switch-project (expand-file-name "dotfiles" home-project-directory))) #+END_SRC +** The Silver Searcher + +#+BEGIN_SRC emacs-lisp + (req-package ag + :defer 30 + :config (setq ag-project-root-function #'projectile-project-root)) +#+END_SRC + ** Projectile Projectile is awesome for working in projects, especially VCS-backed -- cgit 1.4.1 From 69413c7d25dff2a08568aa1c27bd976b233a0371 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 17 Nov 2015 09:35:24 +0100 Subject: Emacs: Add function to read yesterday’s journal --- tag-emacs/emacs.d/init.org | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 8c90cbae..7a6ee4be 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -846,6 +846,12 @@ Sometimes I want to insert a date or time into a buffer. (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)) +#+END_SRC + ** Time of Day #+BEGIN_SRC emacs-lisp @@ -1562,7 +1568,11 @@ I can use this to keep a journal. I should use it. :bind ("s-j" . org-journal-new-entry) :defer 20 :config (progn - (setq org-journal-date-format "%A, %d %B %Y"))) + (setq org-journal-date-format "%A, %d %B %Y") + (defun org-journal-display-entry-yesterday () + "Show org-journal entry for yesterday" + (interactive "P") + (org-journal-read-or-display-entry (yesterday-time))))) #+END_SRC **** org-mobile -- cgit 1.4.1 From 350b5dfb2ff48b1b7a98d385535353ac83d04ead Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 17 Nov 2015 10:56:11 +0100 Subject: Emacs: Fix org-journal-display-entry-yesterday --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 7a6ee4be..1492499f 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1571,7 +1571,7 @@ I can use this to keep a journal. I should use it. (setq org-journal-date-format "%A, %d %B %Y") (defun org-journal-display-entry-yesterday () "Show org-journal entry for yesterday" - (interactive "P") + (interactive) (org-journal-read-or-display-entry (yesterday-time))))) #+END_SRC -- cgit 1.4.1 From 6e6fde5b1fcc32253ee82a6bfb0480b8831cfc1b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 17 Nov 2015 15:42:00 +0100 Subject: Emacs: Install git-timemachine --- tag-emacs/emacs.d/init.org | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 1492499f..dce9a2f3 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -201,6 +201,17 @@ time. Make sure to set it up with a nice =completing-read-function= :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) #+END_SRC +** git-timemachine + +This package allow me to go through a file’s history with just a few +keys. It makes it very easy to figure what what exactly was in a file +in the past. I often find it useful when I remember writing something +a particular way, but it changed later. + +#+BEGIN_SRC emacs-lisp + (req-package git-timemachine) +#+END_SRC + * Styles I prefer an always-visible cursor. Feels less distracting. -- cgit 1.4.1 From 00f9e8884182f62c69cc7b6b7103ba7412ce5910 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 18 Nov 2015 15:57:27 +0100 Subject: Clojure: Don’t load cider unless using a REPL --- tag-clojure/lein/profiles.clj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tag-clojure/lein/profiles.clj b/tag-clojure/lein/profiles.clj index 44007f7b..99c0de2d 100644 --- a/tag-clojure/lein/profiles.clj +++ b/tag-clojure/lein/profiles.clj @@ -1,5 +1,4 @@ -{:user {:plugins [[cider/cider-nrepl "0.9.1"] - [org.clojure/tools.namespace "0.2.10"] +{:user {:plugins [[org.clojure/tools.namespace "0.2.10"] [lein-autoexpect "1.6.0"] [lein-ancient "0.6.7"] [lein-droid "0.4.0-alpha4"]] @@ -8,4 +7,5 @@ (do (require '[clojure.java.javadoc :refer [javadoc]]) (clojure.java.javadoc/add-local-javadoc - "/usr/share/doc/java8-openjdk/api/"))}}} + "/usr/share/doc/java8-openjdk/api/"))}} + :repl {:plugins [cider/cider-nrepl "0.9.1"]}} -- cgit 1.4.1 From 0f72aa972bc33304093fb595666c7070ec09a2b0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 19 Nov 2015 15:59:43 +0100 Subject: zsh: Remove per-directory-history --- tag-zsh/config/zsh/per-directory-history | 1 - tag-zsh/config/zsh/zshrc | 10 ---------- 2 files changed, 11 deletions(-) delete mode 160000 tag-zsh/config/zsh/per-directory-history diff --git a/tag-zsh/config/zsh/per-directory-history b/tag-zsh/config/zsh/per-directory-history deleted file mode 160000 index f6978694..00000000 --- a/tag-zsh/config/zsh/per-directory-history +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f69786943ec77fea2315b647d4fae86f4e5af5a8 diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 22c5458c..5d7aed63 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -368,16 +368,6 @@ ec () { fi } -if [[ -e $ZDOTDIR/per-directory-history/per-directory-history.zsh ]] -then - HISTORY_BASE=~/.cache/zsh/dirhist - source $ZDOTDIR/per-directory-history/per-directory-history.zsh - bindkey '^G' send-break - bindkey '^[^G' per-directory-history-toggle-history -else - echo "per-directory-history is missing" -fi - _FASD_DATA="$HOME/.cache/zsh/fasd-data" if [[ -e ~/.config/zsh/fasd.zsh ]] then -- cgit 1.4.1 From d24955325ef6d6a60e12ce1361c827e72a52e896 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 19 Nov 2015 16:01:20 +0100 Subject: zsh: Remove dead sections --- tag-zsh/config/zsh/zshrc | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 5d7aed63..f414bb74 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -287,10 +287,6 @@ if [[ -e =hub ]]; then alias gh="hub" fi -if [[ -n $commands[composer.phar] && ! -n $commands[composer] ]]; then - alias composer="composer.phar" -fi - # Functions magit () { @@ -376,11 +372,6 @@ else echo "fasd init file is missing." fi -if [[ -e /etc/gibo/gibo-completion.zsh ]] -then - source /etc/gibo/gibo-completion.zsh -fi - case $os in freebsd) source $ZDOTDIR/freebsd.zsh -- cgit 1.4.1 From 4c4ae9fbc209ce7c3b681f00b52cd24ed9407efa Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 24 Nov 2015 17:25:28 +0100 Subject: Emacs: Fix spurious sudo prompts --- tag-emacs/emacs.d/init.org | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index dce9a2f3..5623b994 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1226,8 +1226,9 @@ replace helm and ido. :config (progn (defadvice counsel-find-file (after find-file-sudo activate) "Find file as root if necessary." - (unless (and buffer-file-name - (file-writable-p buffer-file-name)) + (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-projectile-buffer (arg) "Forward to `projectile-switch-to-buffer'." -- cgit 1.4.1 From 4a4e6b10b6bd4ca58f0d2b039e3211d404c20c24 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 28 Nov 2015 15:36:38 +0100 Subject: Emacs: Fix smartparens keymap warnings --- tag-emacs/emacs.d/init.org | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 5623b994..8750d254 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2326,19 +2326,19 @@ nice as the real version :config (progn (sp-use-smartparens-bindings) (fset 'wrap-with-paren "\C-](") ;; `sp-select-next-thing-exchange' - (bind-key "C-(" #'wrap-with-paren sp-keymap) - (bind-key "C-)" #'sp-forward-slurp-sexp sp-keymap) - (bind-key "M-" #'backward-kill-word sp-keymap) - (bind-key "M-?" #'sp-convolute-sexp sp-keymap) - (bind-key "C-M-t" #'sp-transpose-sexp sp-keymap) - (bind-key "M-r" #'sp-raise-sexp sp-keymap) - (bind-key "M-s" #'sp-splice-sexp sp-keymap) - (bind-key "M-S" #'sp-split-sexp sp-keymap) - (bind-key "M-J" #'sp-join-sexp sp-keymap) - (bind-key "M-" #'sp-splice-sexp-killing-backward sp-keymap) - (bind-key "M-" #'sp-splice-sexp-killing-forward sp-keymap) - (bind-key "C-M-S-k" #'sp-kill-hybrid-sexp sp-keymap) - (bind-key "C-S-" #'sp-slurp-hybrid-sexp sp-keymap) + (bind-key "C-(" #'wrap-with-paren smartparens-mode-map) + (bind-key "C-)" #'sp-forward-slurp-sexp smartparens-mode-map) + (bind-key "M-" #'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 "M-S" #'sp-split-sexp smartparens-mode-map) + (bind-key "M-J" #'sp-join-sexp smartparens-mode-map) + (bind-key "M-" #'sp-splice-sexp-killing-backward smartparens-mode-map) + (bind-key "M-" #'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-" #'sp-slurp-hybrid-sexp smartparens-mode-map) (sp-with-modes '(web-mode twig-mode) (sp-local-pair "{%" "%}") (sp-local-pair "{{" "}}")) -- cgit 1.4.1 From f72f1ebfbe607a140e47fa834fb6fb9377854c6f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 28 Nov 2015 15:38:03 +0100 Subject: Emacs: Remove rase package --- tag-emacs/emacs.d/init.org | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 8750d254..80cb06db 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -256,8 +256,7 @@ lot of modes. #+BEGIN_SRC emacs-lisp (req-package solarized-theme :config (progn - (load-theme 'solarized-light t t) - (load-theme 'solarized-dark t t))) + (load-theme 'solarized-light t))) #+END_SRC Colourise colour names in certain types of buffer. I don’t use this @@ -873,37 +872,10 @@ Sometimes I want to insert a date or time into a buffer. (lambda () (setq calendar-latitude osx-location-latitude calendar-longitude osx-location-longitude - calendar-location-name (format "%s, %s" osx-location-latitude osx-location-longitude)) - (rase-start))) + calendar-location-name (format "%s, %s" osx-location-latitude osx-location-longitude)))) (osx-location-watch))) #+END_SRC -#+BEGIN_SRC emacs-lisp - (req-package rase - :config (progn - (defun switch-themes (sun-event &optional first-run) - "Switch themes on sunrise and sunset." - (if first-run ; set theme on initialization - (cond ((memq sun-event '(sunrise midday)) - (disable-theme 'solarized-dark) - (enable-theme 'solarized-light)) - ((memq sun-event '(sunset midnight)) - (disable-theme 'solarized-light) - (enable-theme 'solarized-dark))) - (cond ((eq sun-event 'sunrise) ; after initialization deal only - (disable-theme 'solarized-dark) ; with sunrise and sunset - (enable-theme 'solarized-light)) - ((eq sun-event 'sunset) - (disable-theme 'solarized-light) - (enable-theme 'solarized-dark))))) - - ;; sign this function to be invoked on sun events - (add-hook 'rase-functions 'switch-themes) - - ;; start the run-at-sun-event daemon, invoking hooks immediately - (rase-start t))) -#+END_SRC - * Directories Dired works quite nicely, but not always in the way I want. I don’t -- cgit 1.4.1 From 0da5f6bf47647bf30613192e780c3934b95d4bb5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 28 Nov 2015 17:56:07 +0100 Subject: Emacs: Fix byte-compilation warnings --- tag-emacs/emacs.d/init.org | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 80cb06db..7aa864fb 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -726,7 +726,7 @@ point whilst I’m moving about. mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control))) split-height-threshold 100 frame-resize-pixelwise t) - (if (eq system-type 'darwin) + (if (boundp 'ns-pop-up-frames) (setq ns-pop-up-frames nil)) #+END_SRC @@ -871,8 +871,9 @@ Sometimes I want to insert a date or time into a buffer. (add-hook 'osx-location-changed-hook (lambda () (setq calendar-latitude osx-location-latitude - calendar-longitude osx-location-longitude - calendar-location-name (format "%s, %s" osx-location-latitude osx-location-longitude)))) + calendar-longitude osx-location-longitude) + (when (featurep 'solar) + calendar-location-name (format "%s, %s" osx-location-latitude osx-location-longitude)))) (osx-location-watch))) #+END_SRC @@ -1045,15 +1046,16 @@ re-arrangement of modifiers on OSX: Cmd on the outside, then Option/alt, then Control. #+BEGIN_SRC emacs-lisp -(when (eq system-type 'darwin) - (set-keyboard-coding-system nil) - (setq mac-option-modifier 'meta - mac-right-option-modifier 'left - mac-control-modifier 'control - mac-right-control-modifier 'left - mac-command-modifier 'super - mac-right-command-modifier 'left - mac-function-modifier 'hyper)) + (when (eq system-type 'darwin) + (set-keyboard-coding-system nil) + (custom-set-variables + '(mac-option-modifier 'meta) + '(mac-right-option-modifier 'left) + '(mac-control-modifier 'control) + '(mac-right-control-modifier 'left) + '(mac-command-modifier 'super) + '(mac-right-command-modifier 'left) + '(mac-function-modifier 'hyper))) #+END_SRC #+BEGIN_SRC emacs-lisp @@ -1822,7 +1824,7 @@ A REPL thing for Clojure :config (progn (setq nrepl-hide-special-buffers t) (unbind-key "C-c C-f" cider-mode-map) - (add-hook 'cider-mode-hook #'cider-turn-on-eldoc-mode))) + (add-hook 'cider-mode-hook #'eldoc-mode))) #+END_SRC ** Auto-compile @@ -1873,6 +1875,7 @@ it though #+BEGIN_SRC emacs-lisp (req-package js2-mode :mode ("\\.js\\'" . js2-mode) + :functions js2-next-error :config (progn (defun ap/javascript-setup () (auto-indent-mode -1)) @@ -2379,6 +2382,7 @@ the =org=-document after changes. #+BEGIN_SRC emacs-lisp (req-package async + :commands (async-start) :defer 2) (defun tangle-init () -- cgit 1.4.1 From 02bdf698cbcad8213937730031a686a611dc43a6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 28 Nov 2015 23:31:06 +0100 Subject: Emacs: Switch from req-package to use-package --- tag-emacs/emacs.d/init.org | 392 ++++++++++++++++++++++----------------------- 1 file changed, 189 insertions(+), 203 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 7aa864fb..1629bdd1 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -29,7 +29,7 @@ the buffer to be empty. * Packaging -** Req-package +** Use-package #+BEGIN_SRC emacs-lisp (let ((trustfile @@ -52,11 +52,12 @@ the buffer to be empty. ("melpa-stable" . "https://stable.melpa.org/packages/")) package-user-dir (concat "~/.emacs.d/packages/" emacs-version "/elpa")) (package-initialize) - (unless (package-installed-p 'req-package) + (unless (package-installed-p 'use-package) (package-refresh-contents) - (package-install 'req-package)) - (require 'req-package)) - (setq use-package-verbose t) + (package-install 'use-package)) + (require 'use-package)) + (setq use-package-verbose t + use-package-ensure-always-ensure t) #+END_SRC * Customize @@ -87,7 +88,7 @@ pass =:noerror= to =load= ** The Silver Searcher #+BEGIN_SRC emacs-lisp - (req-package ag + (use-package ag :defer 30 :config (setq ag-project-root-function #'projectile-project-root)) #+END_SRC @@ -99,7 +100,7 @@ ones. I added a couple of functions to allow me to open new projects based upon some folder conventions I use. #+BEGIN_SRC emacs-lisp -(req-package projectile +(use-package projectile :bind (("C-c C-f" . projectile-find-file) ("s-x s-f" . projectile-find-file) ("C-x g" . projectile-vc) @@ -147,13 +148,12 @@ filtering the candidates to those within the project. For it to work, it needs hooking into projectile and a key bound to switch between projects. #+BEGIN_SRC emacs-lisp - (req-package perspective + (use-package perspective :bind (("s-p" . persp-switch)) :init (progn (persp-mode))) - (req-package persp-projectile - :require (projectile perspective)) + (use-package persp-projectile) #+END_SRC ** vc @@ -162,7 +162,7 @@ This is nice for some things that magit doesn’t do, and for those rare occasions that I’m working with something other than git. #+BEGIN_SRC emacs-lisp -(req-package vc +(use-package vc :defer t :bind (("C-x v C" . vc-resolve-conflicts)) :config (progn @@ -175,7 +175,7 @@ It’s nice to be able to see at a glance which lines of a file have changed. This package colours the fringe #+BEGIN_SRC emacs-lisp - (req-package diff-hl + (use-package diff-hl :defer 2 :init (progn (global-diff-hl-mode 1) @@ -188,7 +188,7 @@ Magit is my favourite way to use git. I use selective staging all the time. Make sure to set it up with a nice =completing-read-function= #+BEGIN_SRC emacs-lisp - (req-package magit + (use-package magit :defer 5 :commands (magit-status) :config (progn (setq magit-last-seen-setup-instructions "1.4.0" @@ -209,7 +209,7 @@ in the past. I often find it useful when I remember writing something a particular way, but it changed later. #+BEGIN_SRC emacs-lisp - (req-package git-timemachine) + (use-package git-timemachine) #+END_SRC * Styles @@ -243,7 +243,7 @@ Ring the bell sometimes, but not so often When I’m using dash in emacs lisp, it’s nice to have proper font locking for it. #+BEGIN_SRC emacs-lisp - (req-package dash + (use-package dash :commands (dash-enable-font-lock) :init (progn (add-hook 'emacs-lisp-mode-hook #'dash-enable-font-lock))) @@ -254,7 +254,7 @@ locking for it. I quite like solarized. I don’t think it’s perfect, but it supports a lot of modes. #+BEGIN_SRC emacs-lisp - (req-package solarized-theme + (use-package solarized-theme :config (progn (load-theme 'solarized-light t))) #+END_SRC @@ -262,7 +262,7 @@ lot of modes. Colourise colour names in certain types of buffer. I don’t use this in modes for webdev because [[web-mode]] includes that functionality. #+BEGIN_SRC emacs-lisp -(req-package rainbow-mode +(use-package rainbow-mode :commands (rainbow-turn-on rainbow-turn-off) :config (progn @@ -271,7 +271,7 @@ in modes for webdev because [[web-mode]] includes that functionality. Highlighting quasi-quoted expressions in lisps is quite useful. #+BEGIN_SRC emacs-lisp -(req-package highlight-stages +(use-package highlight-stages :defer t :diminish highlight-stages-mode :init (progn @@ -324,7 +324,7 @@ these settings are particularly useful By default, Emacs displays page breaks as ^L. Lines look much nicer. #+BEGIN_SRC emacs-lisp - (req-package page-break-lines + (use-package page-break-lines :defer 5 :config (global-page-break-lines-mode)) #+END_SRC @@ -359,7 +359,7 @@ trash for deleting on OS X. ** autorevert #+BEGIN_SRC emacs-lisp -(req-package autorevert +(use-package autorevert :init (progn (global-auto-revert-mode 1) (setq auto-revert-verbose nil))) @@ -443,7 +443,7 @@ I don’t like it when editors change an entire file’s layout when I open it. Whitespace butler fixes whitespace only for lines that I’m editing. #+BEGIN_SRC emacs-lisp -(req-package ws-butler +(use-package ws-butler :if window-system :config (ws-butler-global-mode 1)) (if (daemonp) @@ -456,7 +456,7 @@ DWIM whitespace removal. So I don’t need =M-SPC=, =M-\= and =C-x o= for similar things any more. #+BEGIN_SRC emacs-lisp - (req-package shrink-whitespace + (use-package shrink-whitespace :bind ("M-SPC" . shrink-whitespace)) #+END_SRC @@ -465,7 +465,7 @@ for similar things any more. I only use this occasionally, but it’s nice for files outside of projects. #+BEGIN_SRC emacs-lisp -(req-package recentf +(use-package recentf :init (progn (setq recentf-auto-cleanup 'never recentf-save-file (expand-file-name "recentf" user-emacs-directory)) (recentf-mode 1))) @@ -476,7 +476,7 @@ I only use this occasionally, but it’s nice for files outside of projects. An awesome way to open files on OS X. #+BEGIN_SRC emacs-lisp - (req-package spotlight + (use-package spotlight :defer 10 :if (eq system-type 'darwin) :config (setq spotlight-tmp-file "/tmp/.emacs-spotlight-tmp-file")) @@ -488,7 +488,7 @@ It.. saves the position I visited a file at last. Might try turning it off to see if I notice it. #+BEGIN_SRC emacs-lisp -(req-package saveplace +(use-package saveplace :config (progn (setq-default save-place nil) (setq save-place-file (expand-file-name ".saveplace" user-emacs-directory)))) #+END_SRC @@ -499,7 +499,7 @@ Tramp is awesome. It makes SSH feel Unix-y. The proxy setup is so that I can sudo on remote machines #+BEGIN_SRC emacs-lisp - (req-package tramp + (use-package tramp :defer 7 :config (progn (setq tramp-default-method (if (eq system-type 'windows-nt) "plinkx" "ssh") @@ -516,8 +516,7 @@ that I can sudo on remote machines (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil)) (add-to-list 'tramp-default-proxies-alist '("router" nil nil)))) - (req-package tramp-sh - :require tramp + (use-package tramp-sh :defer t :config (progn (add-to-list 'tramp-remote-path "/usr/local/sbin") @@ -529,7 +528,7 @@ that I can sudo on remote machines I like a horizonal diff setup, with everything in one frame. #+BEGIN_SRC emacs-lisp -(req-package ediff +(use-package ediff :defer t :config (progn (setq ediff-split-window-function 'split-window-horizontally @@ -557,7 +556,7 @@ Don’t make me think, just indent it! Unless it’s a whitespace-sensitive language, of course. #+BEGIN_SRC emacs-lisp - (req-package auto-indent-mode + (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 "" @@ -584,15 +583,18 @@ Not related to [[smart-tab][=smart-tab=]], this mode indents with tabs and align with spaces. Perfect! #+BEGIN_SRC emacs-lisp - (req-package smart-tabs-mode + (use-package smart-tabs-mode :defer 1 :config (progn - (smart-tabs-mode/no-tabs-mode-advice align) - (smart-tabs-mode/no-tabs-mode-advice align-regexp) - (smart-tabs-mode/no-tabs-mode-advice indent-relative) - (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) + (with-eval-after-load 'align + (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) @@ -617,7 +619,7 @@ Sometimes people use different indentation settings. [[https://github.com/jschei guesses the correct settings for me. #+BEGIN_SRC emacs-lisp - (req-package dtrt-indent + (use-package dtrt-indent :init (dtrt-indent-mode 1) :config (progn (defadvice dtrt-indent-try-set-offset (after toggle-smart-tabs activate) @@ -630,7 +632,7 @@ guesses the correct settings for me. This is a frontend to the GPG-powered =pass= program. #+BEGIN_SRC emacs-lisp - (req-package password-store + (use-package password-store :defer 15 :config (progn (setq password-store-password-length 16))) @@ -642,7 +644,7 @@ Ibuffer is quite nice for listing all buffers. I don’t use it very often though, as it doesn’t really work with perspectives. #+BEGIN_SRC emacs-lisp -(req-package ibuffer +(use-package ibuffer :bind (("C-x C-b" . ibuffer)) :config (progn (setq ibuffer-saved-filter-groups @@ -677,7 +679,7 @@ often though, as it doesn’t really work with perspectives. ** Relative Buffer names #+BEGIN_SRC emacs-lisp - (req-package relative-buffers + (use-package relative-buffers :init (progn (global-relative-buffers-mode))) #+END_SRC @@ -697,7 +699,7 @@ I don’t often have many windows open at once, but when I do, =ace-window= is really nice to jump around them in the same way that =ace-jump= or =avy= work. #+BEGIN_SRC emacs-lisp -(req-package ace-window +(use-package ace-window :bind (("s-s" . ace-window)) :config (progn (setq aw-dispatch-always t @@ -751,7 +753,7 @@ A dedicated window always keeps the same buffer in view. Undo, for window-based commands. #+BEGIN_SRC emacs-lisp -(req-package winner +(use-package winner :init (progn (winner-mode 1) (setq winner-boring-buffers '("*Completions*" "*Help*" "*Apropos*" "*Buffer List*" "*info*" "*Compile-Log*")))) @@ -762,7 +764,7 @@ Undo, for window-based commands. Directional window movement #+BEGIN_SRC emacs-lisp -(req-package windmove +(use-package windmove :bind (("S-" . windmove-left) ("S-" . windmove-right) ("S-" . windmove-up) @@ -788,7 +790,7 @@ tries to do the right thing depending on the location of the point and the line’s current indentation. #+BEGIN_SRC emacs-lisp -(req-package smart-tab +(use-package smart-tab :commands (global-smart-tab-mode) :init (global-smart-tab-mode) :diminish smart-tab-mode @@ -804,7 +806,7 @@ auto-complete-mode. I’ve not tried auto-complete-mode as company seems to work perfectly well for me. #+BEGIN_SRC emacs-lisp -(req-package company +(use-package company :commands (company-mode) :diminish "Cmpl" :bind (("C-" . company-complete)) @@ -826,7 +828,7 @@ seems to work perfectly well for me. Weeks start on Monday for me and I prefer ISO-style dates. #+BEGIN_SRC emacs-lisp - (req-package calendar + (use-package calendar :defer 1 :config (progn (setq calendar-week-start-day 1) @@ -865,14 +867,14 @@ Sometimes I want to insert a date or time into a buffer. ** Time of Day #+BEGIN_SRC emacs-lisp - (req-package osx-location + (use-package osx-location :if (eq system-type 'darwin) :config (progn (add-hook 'osx-location-changed-hook (lambda () (setq calendar-latitude osx-location-latitude calendar-longitude osx-location-longitude) - (when (featurep 'solar) + (when (boundp 'calendar-location-name) calendar-location-name (format "%s, %s" osx-location-latitude osx-location-longitude)))) (osx-location-watch))) #+END_SRC @@ -885,7 +887,7 @@ have two dired windows open, assume that I’m going to be copying/moving files between them. #+BEGIN_SRC emacs-lisp -(req-package dired +(use-package dired :defer 3 :config (progn (bind-key "" #'dired-find-file dired-mode-map) @@ -903,8 +905,7 @@ copying/moving files between them. I work with a lot of git projects. Dired-k adds colours based upon the file’s git status. #+BEGIN_SRC emacs-lisp - (req-package dired-k - :require dired + (use-package dired-k :defer 5 :init (progn (add-hook 'dired-initial-position-hook #'dired-k)) @@ -917,7 +918,11 @@ the file’s git status. Don’t show uninteresting files in dired listings. #+BEGIN_SRC emacs-lisp - (req-package dired-x + (defun turn-on-dired-omit-mode () + (interactive) + (dired-omit-mode 1)) + + (use-package dired-x :commands (dired-omit-mode dired-expunge) :config (progn @@ -925,16 +930,12 @@ Don’t show uninteresting files in dired listings. dired-omit-verbose nil dired-find-subdir t)) :init (progn - (defun turn-on-dired-omit-mode () - (interactive) - (dired-omit-mode 1)) (add-hook 'dired-mode-hook #'turn-on-dired-omit-mode))) #+END_SRC #+BEGIN_SRC emacs-lisp - (req-package dired+ + (use-package dired+ :defer 5 - :require dired :config (progn (diredp-toggle-find-file-reuse-dir 1) (unbind-key "C-h C-m" dired-mode-map) @@ -944,10 +945,11 @@ Don’t show uninteresting files in dired listings. Expand subfolders like a tree inside the parent #+BEGIN_SRC emacs-lisp - (req-package dired-subtree - :defer t - :require dired - :config (progn + (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" @@ -957,9 +959,8 @@ Expand subfolders like a tree inside the parent (progn (goto-char (overlay-start ov)) (dired-previous-line 1)) (dired-up-directory)))) - (bind-key "^" #'dired-subtree-maybe-up dired-mode-map)) - :init (progn - (bind-key "i" #'dired-subtree-toggle dired-mode-map))) + (bind-key "^" #'dired-subtree-maybe-up dired-mode-map) + (bind-key "i" #'dired-subtree-toggle dired-mode-map)))) #+END_SRC * Documentation @@ -970,30 +971,32 @@ Emacs’ documentation is great to read from inside Emacs. Helm-dash helps to make documentation for other languages easier to access #+BEGIN_SRC emacs-lisp -(req-package helm-dash - :defer 20 - :init (progn - (defmacro ap/create-helm-dash-hook (mode docsets) - (let* ((mode-s (symbol-name mode)) - (fun (intern (concat "helm-dash-hook-" mode-s))) - (hook (intern (concat mode-s "-mode-hook")))) - `(progn - (defun ,fun () - (when (require 'helm-dash nil :noerror) - (-each (-difference ',docsets - (helm-dash-installed-docsets)) - #'helm-dash-install-docset) - (setq-local helm-dash-docsets ',docsets))) - (add-hook (quote ,hook) (function ,fun))))) - (ap/create-helm-dash-hook nginx ("Nginx")) - (ap/create-helm-dash-hook ansible ("Ansible")) - (ap/create-helm-dash-hook php ("PHP" "Symfony")) - (ap/create-helm-dash-hook twig ("Twig")) - (ap/create-helm-dash-hook js2 ("JavaScript" "NodeJS" "jQuery" "Express")) - (ap/create-helm-dash-hook markdown ("Markdown")) - (ap/create-helm-dash-hook saltstack ("SaltStack")) - (ap/create-helm-dash-hook clojure ("Clojure")) - (ap/create-helm-dash-hook sql ("PostgreSQL" "MySQL")))) + (defmacro ap/create-helm-dash-hook (mode docsets) + (let* ((mode-s (symbol-name mode)) + (fun (intern (concat "helm-dash-hook-" mode-s))) + (hook (intern (concat mode-s "-mode-hook")))) + `(progn + (defun ,fun () + (when (require 'helm-dash nil :noerror) + (-each (-difference ',docsets + (helm-dash-installed-docsets)) + #'helm-dash-install-docset) + (setq-local helm-dash-docsets ',docsets))) + (add-hook (quote ,hook) (function ,fun))))) + + (use-package helm-dash + :defer 20 + :defines helm-dash-docsets + :config (progn + (ap/create-helm-dash-hook nginx ("Nginx")) + (ap/create-helm-dash-hook ansible ("Ansible")) + (ap/create-helm-dash-hook php ("PHP" "Symfony")) + (ap/create-helm-dash-hook twig ("Twig")) + (ap/create-helm-dash-hook js2 ("JavaScript" "NodeJS" "jQuery" "Express")) + (ap/create-helm-dash-hook markdown ("Markdown")) + (ap/create-helm-dash-hook saltstack ("SaltStack")) + (ap/create-helm-dash-hook clojure ("Clojure")) + (ap/create-helm-dash-hook sql ("PostgreSQL" "MySQL")))) #+END_SRC ** which-func @@ -1001,7 +1004,7 @@ helps to make documentation for other languages easier to access Use the modeline to show which function definition the point is in. #+BEGIN_SRC emacs-lisp -(req-package which-func +(use-package which-func :init (which-function-mode) :config (setq which-func-modes t)) #+END_SRC @@ -1011,7 +1014,7 @@ Use the modeline to show which function definition the point is in. A nicer way to browse keybindings for major modes. #+BEGIN_SRC emacs-lisp -(req-package discover-my-major +(use-package discover-my-major :bind ("C-h C-m" . discover-my-major)) #+END_SRC @@ -1021,7 +1024,7 @@ Makes some context menus for dired and other things, similarly to the way magit’s popups work. #+BEGIN_SRC emacs-lisp -(req-package discover +(use-package discover :config (global-discover-mode)) #+END_SRC @@ -1031,7 +1034,7 @@ Documentation in the echo-area (where the minibuffer is displayed) is rather useful. #+BEGIN_SRC emacs-lisp -(req-package eldoc +(use-package eldoc :commands (eldoc-mode) :diminish eldoc-mode :config (progn @@ -1109,7 +1112,7 @@ Option/alt, then Control. " nil t) (replace-match "")))) - (req-package rect + (use-package rect :init (defun copy-rectangle (start end) "Copy the region-rectangle." (interactive "r") @@ -1168,7 +1171,7 @@ Ivy is the new kid on the completion block. I wonder if it can replace helm and ido. #+BEGIN_SRC emacs-lisp - (req-package swiper + (use-package swiper :bind (("C-s" . swiper) ("C-r" . swiper) ("C-c C-r" . ivy-resume) @@ -1190,7 +1193,7 @@ replace helm and ido. ** counsel #+BEGIN_SRC emacs-lisp - (req-package counsel + (use-package counsel :bind (("M-x" . counsel-M-x) ("" . counsel-M-x) ("" . counsel-M-x) @@ -1224,8 +1227,7 @@ function uses it internally, so I’m keeping it around, even though I don’t use it directly. #+BEGIN_SRC emacs-lisp - (req-package smex - :require ido + (use-package smex :config (progn (setq smex-key-advice-ignore-menu-bar t smex-auto-update nil) @@ -1343,7 +1345,7 @@ Diminishing major modes does not happen in the same manner as minor modes. #+BEGIN_SRC emacs-lisp - (req-package cyphejor + (use-package cyphejor :init (progn (setq cyphejor-rules `(("emacs" "ε") ("diff" "Δ") @@ -1377,17 +1379,17 @@ set environment variables for projects. Some modes that I don’t really customise much, mostly for configuration files. #+BEGIN_SRC emacs-lisp - (req-package xrdb-mode + (use-package xrdb-mode :mode (("\\.Xdefaults\\'" . xrdb-mode) ("\\.Xresources\\'" . xrdb-mode))) - (req-package haskell-mode + (use-package haskell-mode :mode (("\\.hs\\'" . haskell-mode))) - (req-package dockerfile-mode + (use-package dockerfile-mode :mode (("Dockerfile\\'" . dockerfile-mode))) - (req-package nix-mode + (use-package nix-mode :mode (("\\.nix\\'" . nix-mode)) :config (progn (add-hook 'nix-mode-hook (lambda () @@ -1397,33 +1399,33 @@ configuration files. (add-to-list 'auto-mode-alist '("xmobarrc\\'" . xmonad-mode)) (add-to-list 'auto-mode-alist '("xmonad.hs\\'" . xmonad-mode)) - (req-package nginx-mode + (use-package nginx-mode :defer t :mode (("/nginx/servers/" . nginx-mode) ("/nginx/.*\\.d/" . nginx-mode)) :config (progn (setq nginx-indent-tabs-mode t))) - (req-package lua-mode + (use-package lua-mode :defer t) - (req-package ruby-mode + (use-package ruby-mode :mode (("\\.rb\\'" . ruby-mode) ("\\.cap\\'" . ruby-mode))) - (req-package go-mode + (use-package go-mode :mode (("\\.go\\'" . go-mode))) - (req-package jinja2-mode + (use-package jinja2-mode :mode (("\\.j2\\'" . jinja2-mode) ("\\.jinja\\'" . jinja2-mode))) - (req-package scss-mode + (use-package scss-mode :defer t :config (progn (setq scss-compile-at-save nil))) - (req-package yaml-mode + (use-package yaml-mode :mode (("/group_vars/.*" . yaml-mode) ("/host_vars/.*" . yaml-mode))) @@ -1440,7 +1442,7 @@ I use [[http://ledger-cli.org/][=ledger=]] to manage my finances. It has an Ema works really nicely. #+BEGIN_SRC emacs-lisp -(req-package ledger-mode +(use-package ledger-mode :mode ("\\.ledger\\'" . ledger-mode) :config (progn (defun setup-ledger-mode () @@ -1458,7 +1460,7 @@ works really nicely. ** Markdown #+BEGIN_SRC emacs-lisp -(req-package markdown-mode +(use-package markdown-mode :defer t :config (progn (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) @@ -1471,7 +1473,7 @@ Org is wünderbar. *** TODO Check whether all this configuration is necessary or helpful. #+BEGIN_SRC emacs-lisp - (req-package org + (use-package org :bind (("C-c C-a" . org-agenda-list) ("C-c a" . org-agenda) ("C-c l" . org-store-link)) @@ -1535,8 +1537,7 @@ to have my =ledger= setup in an org file with some graph processing with R or something. #+BEGIN_SRC emacs-lisp -(req-package org-babel - :require org +(use-package org-babel :defer t :config (org-babel-do-load-languages 'org-babel-load-languages @@ -1549,8 +1550,7 @@ with R or something. I can use this to keep a journal. I should use it. #+BEGIN_SRC emacs-lisp - (req-package org-journal - :require org + (use-package org-journal :bind ("s-j" . org-journal-new-entry) :defer 20 :config (progn @@ -1565,8 +1565,7 @@ I can use this to keep a journal. I should use it. ***** TODO Setup org-mobile #+BEGIN_SRC emacs-lisp - (req-package org-mobile - :require org + (use-package org-mobile :defer 30 :config (progn (setq org-mobile-directory "~/Mobile/Org" @@ -1618,7 +1617,7 @@ I can use this to keep a journal. I should use it. On-the-fly error checking in programming modes? Yes please. #+BEGIN_SRC emacs-lisp -(req-package flycheck +(use-package flycheck :diminish " ✓" :init (global-flycheck-mode)) #+END_SRC @@ -1628,30 +1627,23 @@ On-the-fly error checking in programming modes? Yes please. Go has a few packages to inter-operate with other emacs packages. #+BEGIN_SRC emacs-lisp -(when (file-exists-p "src/code.google.com/p/go.tools/cmd/oracle/oracle.el") - (req-package oracle - :load-path ,(expand-file-name "src/code.google.com/p/go.tools/cmd/oracle/oracle.el" (getenv "GOPATH")) + (use-package company-go + :config (progn + (setq company-go-show-annotation t)) :init (progn - (add-hook 'go-mode-hook #'go-oracle-mode)))) - -(req-package company-go - :require go-mode - :config (progn - (setq company-go-show-annotation t) (defun ap/company-go-setup () (set (make-local-variable 'company-backends) '(company-go))) (add-hook 'go-mode-hook #'ap/company-go-setup))) -(req-package go-eldoc - :require go-mode - :config (progn + (use-package go-eldoc + :init (progn (add-hook 'go-mode-hook #'go-eldoc-setup))) -(req-package go-projectile - :require (go-mode go-eldoc projectile) - :config (progn - (setq go-projectile-switch-gopath 'maybe))) + (use-package go-projectile + :defer t + :config (progn + (setq go-projectile-switch-gopath 'maybe))) #+END_SRC @@ -1661,7 +1653,7 @@ Go has a few packages to inter-operate with other emacs packages. A nice completion backend for programming modes. #+BEGIN_SRC emacs-lisp -(req-package ggtags +(use-package ggtags :commands turn-on-ggtags-mode :config (progn (bind-key "q" #'ggtags-navigation-mode-abort ggtags-navigation-mode-map)) @@ -1697,7 +1689,7 @@ Lisp syntax allows for really easy refactoring. Redshank gives some operations that aren’t part of paredit, like extracting variables into let bindings. #+BEGIN_SRC emacs-lisp -(req-package redshank +(use-package redshank :diminish " Λ" :defer t :init (progn @@ -1717,7 +1709,7 @@ it runs the common lisp hooks. Go-to function for elisp. Except it works through the entire Emacs ecosystem. #+BEGIN_SRC emacs-lisp - (req-package elisp-slime-nav + (use-package elisp-slime-nav :commands elisp-slime-nav-mode :diminish elisp-slime-nav-mode :init (progn @@ -1727,7 +1719,7 @@ Go-to function for elisp. Except it works through the entire Emacs ecosystem. Interactive elisp #+BEGIN_SRC emacs-lisp -(req-package ielm +(use-package ielm :defer t :config (progn (add-hook 'ielm-mode-hook (lambda () @@ -1771,7 +1763,7 @@ A REPL thing for Scheme. Hopefully I’ll get to use it more in the future. #+BEGIN_SRC emacs-lisp -(req-package geiser +(use-package geiser :commands (geiser-mode geiser run-geiser @@ -1783,7 +1775,7 @@ future. A REPL thing (and more) for Lisp. #+BEGIN_SRC emacs-lisp -(req-package slime +(use-package slime :commands (slime) :config (progn (let ((ql-slime-helper (expand-file-name "~/quicklisp/slime-helper.el"))) @@ -1796,21 +1788,20 @@ A REPL thing (and more) for Lisp. *** Clojure #+BEGIN_SRC emacs-lisp -(req-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))) + (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))) -(req-package clj-refactor - :defer t - :require clojure-mode - :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))) + (use-package clj-refactor + :defer t + :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 @@ -1818,8 +1809,7 @@ A REPL thing (and more) for Lisp. A REPL thing for Clojure #+BEGIN_SRC emacs-lisp -(req-package cider - :require clojure-mode +(use-package cider :defer t :config (progn (setq nrepl-hide-special-buffers t) @@ -1831,7 +1821,7 @@ A REPL thing for Clojure Auto-compile emacs lisp when saving. #+BEGIN_SRC emacs-lisp -(req-package auto-compile +(use-package auto-compile :defer t :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) #+END_SRC @@ -1842,7 +1832,7 @@ Although I don’t use C or C++, setting up the mode is helpful because quite a few other modes are derived from it. #+BEGIN_SRC emacs-lisp -(req-package cc-mode +(use-package cc-mode :defer 5 :init (progn (add-hook 'c-mode-common-hook #'electric-indent-mode)) @@ -1859,7 +1849,7 @@ quite a few other modes are derived from it. It’s nice to be able to quickly evaluate some code. Although I don’t really seem to use it. #+BEGIN_SRC emacs-lisp -(req-package quickrun +(use-package quickrun :bind (("C-c C-e" . quickrun))) #+END_SRC @@ -1873,7 +1863,7 @@ think there’s anything as good as paredit/redshank for refactoring in it though #+BEGIN_SRC emacs-lisp - (req-package js2-mode + (use-package js2-mode :mode ("\\.js\\'" . js2-mode) :functions js2-next-error :config (progn @@ -1894,7 +1884,7 @@ it though *** coffee-mode #+BEGIN_SRC emacs-lisp - (req-package coffee-mode + (use-package coffee-mode :mode ("\\.coffee\\'" . coffee-mode)) #+END_SRC @@ -1904,7 +1894,7 @@ Tern understands javascript. It adds really clever documented completions, besides other IDE-like things. #+BEGIN_SRC emacs-lisp - (req-package tern + (use-package tern :commands ap/enable-tern :defer 5 :config (progn @@ -1913,15 +1903,14 @@ completions, besides other IDE-like things. (tern-mode 1)) (add-hook 'js2-mode-hook #'ap/enable-tern))) - (req-package company-tern - :defer 5 - :require (tern company)) + (with-eval-after-load 'tern + (use-package company-tern)) #+END_SRC *** json-mode #+BEGIN_SRC emacs-lisp - (req-package json-mode + (use-package json-mode :mode (("\\.json\\'" . json-mode) ("\\.sailsrc\\'" . json-mode))) #+END_SRC @@ -1933,7 +1922,7 @@ calls. Feels a bit like using =org-babel=. I wonder if there’s an integration between the two yet. #+BEGIN_SRC emacs-lisp -(req-package restclient +(use-package restclient :mode ("\\.api\\'" . restclient-mode) :config (progn (defun imenu-restclient-sections () @@ -1947,7 +1936,7 @@ integration between the two yet. This is for HTML, since old versions of HTML were derived from SGML. #+BEGIN_SRC emacs-lisp -(req-package sgml-mode +(use-package sgml-mode :defer t :config (setq sgml-basic-offset 4)) #+END_SRC @@ -1957,7 +1946,7 @@ This is for HTML, since old versions of HTML were derived from SGML. Emmet is really nice to write HTML quickly. Especially with frameworks that require multiple nested elements to do anything useful. #+BEGIN_SRC emacs-lisp -(req-package emmet-mode +(use-package emmet-mode :commands (emmet-mode) :diminish (emmet-mode . " >") :init (progn @@ -1972,7 +1961,7 @@ is really nice, because it handles the HTML part the same way in all of them as well. #+BEGIN_SRC emacs-lisp -(req-package web-mode +(use-package web-mode :mode (("/views/.*\\.php\\'" . web-mode) ("/layouts/.*\\.html\\'" . web-mode) ("/templates/.*\\.php\\'" . web-mode) @@ -1999,7 +1988,7 @@ With =web-mode= being so good, I don’t really use this much. It’s good for embedded SQL though. #+BEGIN_SRC emacs-lisp - (req-package mmm-auto + (use-package mmm-auto :ensure mmm-mode :config (progn (mmm-add-classes @@ -2035,7 +2024,7 @@ good for embedded SQL though. * Spelling #+BEGIN_SRC emacs-lisp -(req-package ispell +(use-package ispell :bind (("" . ispell-word)) :config (progn (setq ispell-program-name "aspell" @@ -2052,7 +2041,7 @@ Make a shell-script buffer executable after saving it, if it has a shebang. (add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) -(req-package sh-script +(use-package sh-script :mode (("\\.zsh\\'" . shell-script-mode)) :config (setq sh-shell-file "/usr/bin/env zsh")) #+END_SRC @@ -2067,15 +2056,15 @@ I should try to get into the habit of using this more. It’s really nice, when I remember to use it. #+BEGIN_SRC emacs-lisp - (req-package eshell + (use-package eshell :bind ("C-c s" . eshell) :config (progn (setq eshell-directory-name "~/.emacs.d/eshell") (add-hook 'eshell-load-hook (lambda () (bind-key "C-c C-l" #'helm-eshell-history eshell-mode-map))))) - (req-package em-smart - :require eshell + (use-package em-smart + :commands eshell-smart-initialize :init (progn (add-hook 'eshell-load-hook #'eshell-smart-initialize)) :config (progn @@ -2095,23 +2084,23 @@ nice, when I remember to use it. #+END_SRC #+BEGIN_SRC emacs-lisp - (req-package esh-buf-stack - :require eshell - :config (progn - (setup-eshell-buf-stack) + (with-eval-after-load 'eshell + (use-package esh-buf-stack + :init (progn (add-hook 'eshell-load-hook (lambda () - (bind-key "M-q" #'eshell-push-command eshell-mode-map))))) + (setup-eshell-buf-stack) + (bind-key "M-q" #'eshell-push-command eshell-mode-map)))))) #+END_SRC *** Shells #+BEGIN_SRC emacs-lisp - (req-package shell + (use-package shell :defer t :config (define-key shell-mode-map (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) - (req-package comint + (use-package comint :defer t :config (bind-key "C-c C-l" #'helm-comint-input-ring comint-mode-map)) @@ -2139,7 +2128,7 @@ Emacs has an editor within. The most important one for me is JSON property alignment. #+BEGIN_SRC emacs-lisp - (req-package align + (use-package align :defer 10 :config (progn (add-to-list 'align-rules-list @@ -2192,7 +2181,7 @@ symbol, not word, as I need this for programming the most." Sub-word movement is really nice for camel- and Pascal-case #+BEGIN_SRC emacs-lisp -(req-package subword +(use-package subword :init (global-subword-mode t)) #+END_SRC @@ -2200,7 +2189,7 @@ I find that =zap-up-to-char= normally makes more sense to me than =zap-to-char=. #+BEGIN_SRC emacs-lisp -(req-package misc +(use-package misc :bind (("M-z" . zap-up-to-char) ("M-Z" . zap-to-char))) #+END_SRC @@ -2209,7 +2198,7 @@ Expanding the region by semantic units was something I quite liked from Sublime Text. As always, there’s a mode for that. #+BEGIN_SRC emacs-lisp -(req-package expand-region +(use-package expand-region :bind ("C-M-SPC" . er/expand-region)) #+END_SRC @@ -2219,7 +2208,7 @@ I like using typographic symbols, but I don’t always remember (how) to type them. #+BEGIN_SRC emacs-lisp - (req-package typo + (use-package typo :config (progn (typo-global-mode 1)) :init (progn @@ -2232,7 +2221,7 @@ Avy is a really nice way to move around files, like ace-jump-mode, but somehow I prefer it. #+BEGIN_SRC emacs-lisp -(req-package avy +(use-package avy :bind* (("M-g g" . avy-goto-line) ("M-g M-g" . avy-goto-line) ("C-|" . avy-goto-line) @@ -2248,7 +2237,7 @@ This is like popping the mark, only it filters to only change areas and doesn’t go back to the same place more than once. #+BEGIN_SRC emacs-lisp -(req-package goto-chg +(use-package goto-chg :bind ("C-x SPC" . goto-last-change)) #+END_SRC @@ -2259,7 +2248,7 @@ cursors was one of my favourite features, so I was really happy when I saw that multiple-cursors was released for Emacs. #+BEGIN_SRC emacs-lisp -(req-package multiple-cursors +(use-package multiple-cursors :defer 1 :config (progn (bind-key "C-." #'mc/mark-next-like-this) @@ -2275,7 +2264,7 @@ Balanced parentheses in lisps are nice, but all the refactoring and movement commands are much more interesting. #+BEGIN_SRC emacs-lisp -(req-package paredit +(use-package paredit :diminish "()" :commands (paredit-mode) :init (progn @@ -2296,7 +2285,8 @@ I didn’t find smartparens’ implementation of paredit style to be as nice as the real version #+BEGIN_SRC emacs-lisp - (req-package smartparens-config + (eval-when-compile (require 'smartparens)) + (use-package smartparens-config :ensure smartparens :config (progn (sp-use-smartparens-bindings) @@ -2327,7 +2317,7 @@ nice as the real version Transposing lines, made easier. #+BEGIN_SRC emacs-lisp -(req-package move-text +(use-package move-text :config (move-text-default-bindings)) #+END_SRC @@ -2337,7 +2327,7 @@ Emacs’ default handling of undo is a bit confusing. Undo-tree makes it much clearer. It’s especially helpful for protoyping and refactoring. #+BEGIN_SRC emacs-lisp -(req-package undo-tree +(use-package undo-tree :config (progn (global-undo-tree-mode) ;; Keep region when undoing in region @@ -2361,7 +2351,7 @@ so this package is pretty useful because it highlights everything in the buffer for me. #+BEGIN_SRC emacs-lisp -(req-package visual-regexp +(use-package visual-regexp :bind (("C-c r" . vr/replace) ("C-c q" . vr/query-replace) ("C-c m" . vc/mc-mark))) @@ -2381,7 +2371,7 @@ to the =after-save-hook= ensuring to always tangle and byte-compile the =org=-document after changes. #+BEGIN_SRC emacs-lisp - (req-package async + (use-package async :commands (async-start) :defer 2) @@ -2413,10 +2403,6 @@ the =org=-document after changes. # End: * End -#+BEGIN_SRC emacs-lisp -(req-package-finish) -#+END_SRC - Start a server if possible. A daemon is already a server. #+BEGIN_SRC emacs-lisp (unless (daemonp) -- cgit 1.4.1 From 9e3298f5a746407b2461159d54be486ad0337864 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 28 Nov 2015 23:31:24 +0100 Subject: Emacs: Remove unnecessary smex-init call --- 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 1629bdd1..eed4b390 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1238,8 +1238,7 @@ don’t use it directly. :init (progn (setq smex-history-length 100 smex-save-file (concat user-emacs-directory - "smex-items")) - (smex-initialize))) + "smex-items")))) #+END_SRC * Modeline -- cgit 1.4.1 From 7459e5ee09bc094fc47c0d03ec031fe2268825b9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 28 Nov 2015 23:36:02 +0100 Subject: Emacs: Improve coffee-mode configuration --- tag-emacs/emacs.d/init.org | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index eed4b390..c68dd8c6 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -572,6 +572,7 @@ whitespace-sensitive language, of course. (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) (auto-indent-global-mode))) #+END_SRC @@ -1884,7 +1885,9 @@ it though #+BEGIN_SRC emacs-lisp (use-package coffee-mode - :mode ("\\.coffee\\'" . coffee-mode)) + :mode ("\\.coffee\\'" . coffee-mode) + :config (progn + (setq coffee-indent-like-python-mode t))) #+END_SRC *** tern @@ -2308,7 +2311,8 @@ nice as the real version (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 'lisp-mode-common-hook #'turn-off-smartparens-mode) + (add-hook 'coffee-mode-hook #'turn-off-smartparens-mode))) #+END_SRC ** move-text -- cgit 1.4.1 From b8b160a427b785514c0e016155194bcc86976d62 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 28 Nov 2015 23:36:38 +0100 Subject: Emacs: Specify variable font size in set-fonts --- tag-emacs/emacs.d/init.org | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index c68dd8c6..f1076672 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -283,29 +283,29 @@ Highlighting quasi-quoted expressions in lisps is quite useful. 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 variable-face font-size) - (when mono-face - (let ((default-font (concat mono-face "-" (number-to-string 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 (concat variable-face "-" - (number-to-string (1+ font-size)))))) - - (cond - ((eq window-system 'w32) - (ap/set-fonts "Consolas" "Segoe UI" 10)) - ((eq system-type 'darwin) - (ap/set-fonts "Input Mono" "Input Sans Condensed" 13)))) + (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 (concat mono-face "-" (number-to-string 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 (concat variable-face "-" + (number-to-string variable-font-size))))) + + (cond + ((eq window-system 'w32) + (ap/set-fonts "Consolas" 10 "Segoe UI" 11)) + ((eq system-type 'darwin) + (ap/set-fonts "Hack" 14 "Avenir" 14)))) #+END_SRC Allow font-lock-mode to do background parsing. I’m not really sure if -- cgit 1.4.1 From 69559a006c28f295602d89e54c36e8463807861a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 29 Nov 2015 16:47:11 +0100 Subject: Emacs: Revert to http package fetching Marmalade’s TLS certificate doesn’t seem to be trusted, so I can’t use it. --- tag-emacs/emacs.d/init.org | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index eed4b390..8e8db1c6 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -32,24 +32,11 @@ the buffer to be empty. ** Use-package #+BEGIN_SRC emacs-lisp - (let ((trustfile - (replace-regexp-in-string - "\\\\" "/" - (replace-regexp-in-string - "\n" "" - (shell-command-to-string "python -m certifi"))))) - (setq tls-checktrust t - tls-program - (list - (format "gnutls-cli%s --x509cafile %s -p %%p %%h" - (if (eq window-system 'w32) ".exe" "") trustfile))) - (setq gnutls-verify-error t) - (setq gnutls-trustfiles (list trustfile))) (eval-and-compile - (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") - ("marmalade" . "https://marmalade-repo.org/packages/") - ("melpa" . "https://melpa.org/packages/") - ("melpa-stable" . "https://stable.melpa.org/packages/")) + (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-initialize) (unless (package-installed-p 'use-package) -- cgit 1.4.1 From c3ffd21fdc6a4e51c7f05d796cd93aa3bcb351aa Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 29 Nov 2015 16:49:31 +0100 Subject: Emacs: Add init benchmarking --- tag-emacs/emacs.d/init.org | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 8e8db1c6..62c43fc3 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -44,7 +44,9 @@ the buffer to be empty. (package-install 'use-package)) (require 'use-package)) (setq use-package-verbose t - use-package-ensure-always-ensure t) + use-package-always-ensure t) + (use-package benchmark-init + :config (benchmark-init/activate)) #+END_SRC * Customize @@ -2391,9 +2393,10 @@ the =org=-document after changes. Start a server if possible. A daemon is already a server. #+BEGIN_SRC emacs-lisp -(unless (daemonp) - (require 'server) - (if (server-running-p server-name) - (message "Server already appears to be running") - (server-start))) + (unless (daemonp) + (require 'server) + (if (server-running-p server-name) + (message "Server already appears to be running") + (server-start))) + (benchmark-init/deactivate) #+END_SRC -- cgit 1.4.1 From f6c7ab84e4b275c7f9f920e29714963783c19b7f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 29 Nov 2015 16:49:58 +0100 Subject: Emacs: Optimise init --- tag-emacs/emacs.d/init.org | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 62c43fc3..fe3fed41 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -198,7 +198,8 @@ in the past. I often find it useful when I remember writing something a particular way, but it changed later. #+BEGIN_SRC emacs-lisp - (use-package git-timemachine) + (use-package git-timemachine + :commands git-timemachine) #+END_SRC * Styles @@ -1217,6 +1218,9 @@ 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) @@ -1616,6 +1620,7 @@ 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 @@ -1625,6 +1630,7 @@ Go has a few packages to inter-operate with other emacs packages. (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))) @@ -1978,6 +1984,7 @@ good for embedded SQL though. #+BEGIN_SRC emacs-lisp (use-package mmm-auto :ensure mmm-mode + :defer 20 :config (progn (mmm-add-classes '((php-sql -- cgit 1.4.1 From 99794c9d0f3bceeb4c8e5ffc6ded49051bc0c999 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 29 Nov 2015 21:00:46 +0100 Subject: Emacs: Fix :ensure-ing of non-packages --- tag-emacs/emacs.d/init.org | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 777b6f95..feeb55d7 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -41,8 +41,11 @@ the buffer to be empty. (package-initialize) (unless (package-installed-p 'use-package) (package-refresh-contents) - (package-install 'use-package)) - (require 'use-package)) + (package-install 'use-package))) + (eval-when-compile (require 'use-package)) + (unless (featurep 'use-package) + (require 'diminish) + (require 'bind-key)) (setq use-package-verbose t use-package-always-ensure t) (use-package benchmark-init @@ -507,6 +510,7 @@ that I can sudo on remote machines (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") @@ -880,6 +884,7 @@ copying/moving files between them. #+BEGIN_SRC emacs-lisp (use-package dired :defer 3 + :ensure nil :config (progn (bind-key "" #'dired-find-file dired-mode-map) (bind-key "^" (lambda () (interactive) (find-alternate-file "..")) dired-mode-map) @@ -916,6 +921,7 @@ Don’t show uninteresting files in dired listings. (use-package dired-x :commands (dired-omit-mode dired-expunge) + :ensure nil :config (progn (setq dired-omit-files "#\\|\\.$" dired-omit-verbose nil @@ -1104,6 +1110,7 @@ Option/alt, then Control. (replace-match "")))) (use-package rect + :ensure nil :init (defun copy-rectangle (start end) "Copy the region-rectangle." (interactive "r") @@ -1373,6 +1380,7 @@ 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))) @@ -1532,6 +1540,7 @@ with R or something. #+BEGIN_SRC emacs-lisp (use-package org-babel :defer t + :ensure nil :config (org-babel-do-load-languages 'org-babel-load-languages '((ledger . t) @@ -1560,6 +1569,7 @@ I can use this to keep a journal. I should use it. #+BEGIN_SRC emacs-lisp (use-package org-mobile :defer 30 + :ensure nil :config (progn (setq org-mobile-directory "~/Mobile/Org" org-mobile-inbox-for-pull "~/Mobile/Org/from-mobile.org") @@ -1716,6 +1726,7 @@ Interactive elisp #+BEGIN_SRC emacs-lisp (use-package ielm :defer t + :ensure nil :config (progn (add-hook 'ielm-mode-hook (lambda () (run-hooks 'lisp-mode-common-hook))))) @@ -2062,6 +2073,7 @@ nice, when I remember to use it. (bind-key "C-c C-l" #'helm-eshell-history eshell-mode-map))))) (use-package em-smart + :ensure nil :commands eshell-smart-initialize :init (progn (add-hook 'eshell-load-hook #'eshell-smart-initialize)) @@ -2095,11 +2107,13 @@ nice, when I remember to use it. #+BEGIN_SRC emacs-lisp (use-package shell :defer t + :ensure nil :config (define-key shell-mode-map (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) (use-package comint :defer t + :ensure nil :config (bind-key "C-c C-l" #'helm-comint-input-ring comint-mode-map)) (defun comint-delchar-or-eof-or-kill-buffer (arg) @@ -2128,6 +2142,7 @@ 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 @@ -2188,6 +2203,7 @@ I find that =zap-up-to-char= normally makes more sense to me than #+BEGIN_SRC emacs-lisp (use-package misc + :ensure nil :bind (("M-z" . zap-up-to-char) ("M-Z" . zap-to-char))) #+END_SRC -- cgit 1.4.1 From 2384e5742f8cd0935c41c32560dbabd5b39e0462 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 30 Nov 2015 14:57:02 +0100 Subject: Emacs: Replace discover with which-key --- tag-emacs/emacs.d/init.org | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index feeb55d7..58088074 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1015,14 +1015,15 @@ A nicer way to browse keybindings for major modes. :bind ("C-h C-m" . discover-my-major)) #+END_SRC -** discover +** which-key -Makes some context menus for dired and other things, similarly to the -way magit’s popups work. +Popup keybindings following a prefix automatically. #+BEGIN_SRC emacs-lisp -(use-package discover - :config (global-discover-mode)) + (use-package which-key + :config (progn + (which-key-mode) + (which-key-setup-side-window-right-bottom))) #+END_SRC ** eldoc @@ -1658,15 +1659,16 @@ Go has a few packages to inter-operate with other emacs packages. A nice completion backend for programming modes. #+BEGIN_SRC emacs-lisp -(use-package ggtags - :commands turn-on-ggtags-mode - :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))) + (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))) #+END_SRC ** Lisps -- cgit 1.4.1 From e3e404e78b5692857410feaf6479ab4a6407bd54 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 1 Dec 2015 10:26:25 +0100 Subject: Emacs: Setup which-key properly --- 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 58088074..1c84c79d 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1021,8 +1021,9 @@ Popup keybindings following a prefix automatically. #+BEGIN_SRC emacs-lisp (use-package which-key + :diminish which-key-mode :config (progn - (which-key-mode) + (which-key-mode 1) (which-key-setup-side-window-right-bottom))) #+END_SRC -- cgit 1.4.1 From ae5ba58dfb2fcd2343328b12b36d30c6e35ae8ab Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 2 Dec 2015 20:40:12 +0100 Subject: Emacs: Fix binding of persp-switch key --- tag-emacs/emacs.d/init.org | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 58088074..a4729baf 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -141,11 +141,12 @@ it needs hooking into projectile and a key bound to switch between projects. #+BEGIN_SRC emacs-lisp (use-package perspective - :bind (("s-p" . persp-switch)) + :bind* ("s-p" . persp-switch) :init (progn (persp-mode))) - (use-package persp-projectile) + (use-package persp-projectile + :ensure nil) #+END_SRC ** vc -- cgit 1.4.1 From 4021164d17057e5f195f886972873705dc0aa50c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 2 Dec 2015 20:40:43 +0100 Subject: Emacs: Improve contrast of window chrome --- tag-emacs/emacs.d/init.org | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index a4729baf..4cf15664 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -250,6 +250,8 @@ lot of modes. #+BEGIN_SRC emacs-lisp (use-package solarized-theme :config (progn + (setq solarized-distinct-fringe-background t) + (setq solarized-high-contrast-mode-line t) (load-theme 'solarized-light t))) #+END_SRC -- cgit 1.4.1 From d575c29219d71338be4575bacb5711383455c2ed Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 4 Dec 2015 10:58:57 +0100 Subject: Emacs: Open helm-dash docsets in eww --- tag-emacs/emacs.d/init.org | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 1c84c79d..c4749599 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -985,15 +985,16 @@ helps to make documentation for other languages easier to access :defer 20 :defines helm-dash-docsets :config (progn - (ap/create-helm-dash-hook nginx ("Nginx")) - (ap/create-helm-dash-hook ansible ("Ansible")) - (ap/create-helm-dash-hook php ("PHP" "Symfony")) - (ap/create-helm-dash-hook twig ("Twig")) - (ap/create-helm-dash-hook js2 ("JavaScript" "NodeJS" "jQuery" "Express")) - (ap/create-helm-dash-hook markdown ("Markdown")) - (ap/create-helm-dash-hook saltstack ("SaltStack")) - (ap/create-helm-dash-hook clojure ("Clojure")) - (ap/create-helm-dash-hook sql ("PostgreSQL" "MySQL")))) + (setq helm-dash-browser-func #'eww) + (ap/create-helm-dash-hook nginx ("Nginx")) + (ap/create-helm-dash-hook ansible ("Ansible")) + (ap/create-helm-dash-hook php ("PHP" "Symfony")) + (ap/create-helm-dash-hook twig ("Twig")) + (ap/create-helm-dash-hook js2 ("JavaScript" "NodeJS" "jQuery" "Express" "SailsJS" "Lo-Dash")) + (ap/create-helm-dash-hook markdown ("Markdown")) + (ap/create-helm-dash-hook saltstack ("SaltStack")) + (ap/create-helm-dash-hook clojure ("Clojure")) + (ap/create-helm-dash-hook sql ("PostgreSQL" "MySQL")))) #+END_SRC ** which-func -- cgit 1.4.1 From 82f7865da9de7e591cfe773801604fe6b10a9eed Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 4 Dec 2015 17:54:10 +0100 Subject: XResources: Change Emacs font to Fira Mono --- tag-xresources/xresources/main | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-xresources/xresources/main b/tag-xresources/xresources/main index 82a58a5d..7c805bd4 100644 --- a/tag-xresources/xresources/main +++ b/tag-xresources/xresources/main @@ -28,6 +28,6 @@ Emacs.MenuBar: off Emacs.ScrollBars: off Emacs.CursorBlink: off -Emacs.Font: -*-Hack-normal-*-*-*-16-*-*-*-*-*-*-* -Emacs.fixed-pitch.attributeFont: -*-Hack-normal-*-*-*-16-*-*-*-*-*-*-* +Emacs.Font: -*-Fira Mono-normal-*-*-*-16-*-*-*-*-*-*-* +Emacs.fixed-pitch.attributeFont: -*-Fira Mono-normal-*-*-*-16-*-*-*-*-*-*-* Emacs.variable-pitch.attributeFont: -*-Fira Sans-medium-r-*-*-16-*-*-*-*-*-*-* -- cgit 1.4.1 From 1efcbaeba314c7c737881499a0c21126928b29e6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 4 Dec 2015 17:54:38 +0100 Subject: Emacs: Tinker with font-locking settings --- tag-emacs/emacs.d/init.org | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 4cf15664..2e8f88bb 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -307,10 +307,10 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource Allow font-lock-mode to do background parsing. I’m not really sure if these settings are particularly useful #+BEGIN_SRC emacs-lisp - (setq jit-lock-stealth-time 1 + (setq jit-lock-stealth-time nil jit-lock-stealth-load 100 - jit-lock-chunk-size 1000 - jit-lock-defer-time 0.01 + jit-lock-chunk-size 300 + jit-lock-defer-time nil font-lock-maximum-decoration '((dired-mode . 1) (t . t))) #+END_SRC -- cgit 1.4.1 From fd9d7a3ec850d44fbefe9c45922c1caa112343e4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 9 Dec 2015 16:59:49 +0100 Subject: Emacs: Reduce GC usage at startup --- tag-emacs/emacs.d/init.org | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 00f06f53..1b7a03e9 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -10,6 +10,7 @@ Open Emacs with just a plain window. No graphics or messages, please! #+BEGIN_SRC emacs-lisp (setq inhibit-startup-echo-area-message "alan") (setq inhibit-startup-screen t) + (setq gc-cons-threshold 100000000) #+END_SRC ** Scratch buffers @@ -2433,4 +2434,5 @@ Start a server if possible. A daemon is already a server. (message "Server already appears to be running") (server-start))) (benchmark-init/deactivate) + (setq gc-cons-threshold 800000) #+END_SRC -- cgit 1.4.1 From 86e1b50e0491b1047e3c0484ef7aad7a02019b67 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 9 Dec 2015 17:00:19 +0100 Subject: Emacs: Start server when idle --- tag-emacs/emacs.d/init.org | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 1b7a03e9..0e062f56 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2428,11 +2428,12 @@ the =org=-document after changes. Start a server if possible. A daemon is already a server. #+BEGIN_SRC emacs-lisp - (unless (daemonp) - (require 'server) - (if (server-running-p server-name) - (message "Server already appears to be running") - (server-start))) + (run-with-idle-timer 2 nil (lambda () + (unless (daemonp) + (require 'server) + (if (server-running-p server-name) + (message "Server already appears to be running") + (server-start))))) (benchmark-init/deactivate) (setq gc-cons-threshold 800000) #+END_SRC -- cgit 1.4.1 From b51f0140be39ee5efb670e5a38fb35226d57fb2f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 9 Dec 2015 17:00:38 +0100 Subject: Emacs: Fix error after loading align --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 0e062f56..afe2681f 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -585,7 +585,7 @@ with spaces. Perfect! (use-package smart-tabs-mode :defer 1 :config (progn - (with-eval-after-load 'align + (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" -- cgit 1.4.1 From 260fad2ed071931265d3919faa3d429e06103e2c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 9 Dec 2015 17:01:29 +0100 Subject: Emacs: Disable magic filename handling on startup --- tag-emacs/emacs.d/init.org | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index afe2681f..39ae5142 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -11,6 +11,7 @@ Open Emacs with just a plain window. No graphics or messages, please! (setq inhibit-startup-echo-area-message "alan") (setq inhibit-startup-screen t) (setq gc-cons-threshold 100000000) + (setq file-name-handler-alist nil) #+END_SRC ** Scratch buffers @@ -2435,5 +2436,10 @@ Start a server if possible. A daemon is already a server. (message "Server already appears to be running") (server-start))))) (benchmark-init/deactivate) - (setq gc-cons-threshold 800000) + (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))) #+END_SRC -- cgit 1.4.1 From 861b202f45a455ae9fbef720aa7bfcb52402a5b3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 9 Dec 2015 17:01:53 +0100 Subject: Emacs: Delay init of cyphejor-mode --- tag-emacs/emacs.d/init.org | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 39ae5142..af86837d 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1354,19 +1354,20 @@ modes. #+BEGIN_SRC emacs-lisp (use-package cyphejor - :init (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 * Modes -- cgit 1.4.1 From 00b0182d5c08e67c7a9e154c4be77adc2e6a9eb3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Dec 2015 11:16:50 +0100 Subject: Emacs: Remove benchmark-init --- tag-emacs/emacs.d/init.org | 3 --- 1 file changed, 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index af86837d..1af7b82e 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -50,8 +50,6 @@ the buffer to be empty. (require 'bind-key)) (setq use-package-verbose t use-package-always-ensure t) - (use-package benchmark-init - :config (benchmark-init/activate)) #+END_SRC * Customize @@ -2436,7 +2434,6 @@ Start a server if possible. A daemon is already a server. (if (server-running-p server-name) (message "Server already appears to be running") (server-start))))) - (benchmark-init/deactivate) (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) -- cgit 1.4.1 From 2a8867b7a4184e443ef24ed6c02a46248500cf36 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Dec 2015 11:18:27 +0100 Subject: Emacs: More startup optimisation --- tag-emacs/emacs.d/init.org | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 1af7b82e..6c3e35c7 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -170,9 +170,9 @@ changed. This package colours the fringe #+BEGIN_SRC emacs-lisp (use-package diff-hl :defer 2 - :init (progn - (global-diff-hl-mode 1) - (add-hook 'magit-refresh-file-buffer-hook #'diff-hl-update))) + :config (progn + (global-diff-hl-mode 1) + (add-hook 'magit-refresh-file-buffer-hook #'diff-hl-update))) #+END_SRC ** magit @@ -219,9 +219,11 @@ 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)) - (when scroll-bar-mode - (scroll-bar-mode -1) - (tooltip-mode -1) + (with-eval-after-load 'scroll-bar + (set-scroll-bar-mode nil)) + (with-eval-after-load 'tooltip + (tooltip-mode -1)) + (with-eval-after-load 'tool-bar (tool-bar-mode -1)) #+END_SRC @@ -678,8 +680,9 @@ often though, as it doesn’t really work with perspectives. #+BEGIN_SRC emacs-lisp (use-package relative-buffers - :init (progn - (global-relative-buffers-mode))) + :defer 15 + :config (progn + (global-relative-buffers-mode))) #+END_SRC ** Narrowing @@ -1627,9 +1630,10 @@ I can use this to keep a journal. I should use it. On-the-fly error checking in programming modes? Yes please. #+BEGIN_SRC emacs-lisp -(use-package flycheck - :diminish " ✓" - :init (global-flycheck-mode)) + (use-package flycheck + :diminish " ✓" + :defer 5 + :config (global-flycheck-mode)) #+END_SRC ** golang -- cgit 1.4.1 From 8857d80bb0e1fddc8c21b8f2adbf3c270aa9429e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Dec 2015 11:24:51 +0100 Subject: Emacs: Run style customisations first --- tag-emacs/emacs.d/init.org | 241 ++++++++++++++++++++++----------------------- 1 file changed, 120 insertions(+), 121 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 6c3e35c7..b28107fb 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -64,6 +64,126 @@ pass =:noerror= to =load= (load custom-file :noerror :nomessage) #+END_SRC +* Styles + +I prefer an always-visible cursor. Feels less distracting. +#+BEGIN_SRC emacs-lisp +(when (fboundp #'blink-cursor-mode) + (blink-cursor-mode -1)) +#+END_SRC + +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)) + (with-eval-after-load 'scroll-bar + (set-scroll-bar-mode nil)) + (with-eval-after-load 'tooltip + (tooltip-mode -1)) + (with-eval-after-load 'tool-bar + (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)))) +#+END_SRC + +When I’m using dash in emacs lisp, it’s nice to have proper font +locking for it. +#+BEGIN_SRC emacs-lisp + (use-package dash + :commands (dash-enable-font-lock) + :init (progn + (add-hook 'emacs-lisp-mode-hook #'dash-enable-font-lock))) +#+END_SRC + +** Colours + +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 + :config (progn + (setq solarized-distinct-fringe-background t) + (setq solarized-high-contrast-mode-line t) + (load-theme 'solarized-light t))) +#+END_SRC + +Colourise colour names in certain types of buffer. I don’t use this +in modes for webdev because [[web-mode]] includes that functionality. +#+BEGIN_SRC emacs-lisp +(use-package rainbow-mode + :commands (rainbow-turn-on + rainbow-turn-off) + :config (progn + (add-hook 'xmonad-mode-hook #'rainbow-turn-on))) +#+END_SRC + +Highlighting quasi-quoted expressions in lisps is quite useful. +#+BEGIN_SRC emacs-lisp +(use-package highlight-stages + :defer t + :diminish highlight-stages-mode + :init (progn + (add-hook 'lisp-mode-common-hook #'highlight-stages-mode))) +#+END_SRC + +** Fonts + +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 (concat mono-face "-" (number-to-string 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 (concat variable-face "-" + (number-to-string variable-font-size))))) + + (cond + ((eq window-system 'w32) + (ap/set-fonts "Consolas" 10 "Segoe UI" 11)) + ((eq system-type 'darwin) + (ap/set-fonts "Hack" 14 "Avenir" 14)))) +#+END_SRC + +Allow font-lock-mode to do background parsing. I’m not really sure if +these settings are particularly useful +#+BEGIN_SRC emacs-lisp + (setq jit-lock-stealth-time nil + jit-lock-stealth-load 100 + jit-lock-chunk-size 300 + jit-lock-defer-time nil + font-lock-maximum-decoration '((dired-mode . 1) + (t . t))) +#+END_SRC + +** Page Breaks + +By default, Emacs displays page breaks as ^L. Lines look much nicer. + +#+BEGIN_SRC emacs-lisp + (use-package page-break-lines + :defer 5 + :config (global-page-break-lines-mode)) +#+END_SRC * Projects #+BEGIN_SRC emacs-lisp @@ -206,127 +326,6 @@ a particular way, but it changed later. :commands git-timemachine) #+END_SRC -* Styles - -I prefer an always-visible cursor. Feels less distracting. -#+BEGIN_SRC emacs-lisp -(when (fboundp #'blink-cursor-mode) - (blink-cursor-mode -1)) -#+END_SRC - -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)) - (with-eval-after-load 'scroll-bar - (set-scroll-bar-mode nil)) - (with-eval-after-load 'tooltip - (tooltip-mode -1)) - (with-eval-after-load 'tool-bar - (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)))) -#+END_SRC - -When I’m using dash in emacs lisp, it’s nice to have proper font -locking for it. -#+BEGIN_SRC emacs-lisp - (use-package dash - :commands (dash-enable-font-lock) - :init (progn - (add-hook 'emacs-lisp-mode-hook #'dash-enable-font-lock))) -#+END_SRC - -** Colours - -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 - :config (progn - (setq solarized-distinct-fringe-background t) - (setq solarized-high-contrast-mode-line t) - (load-theme 'solarized-light t))) -#+END_SRC - -Colourise colour names in certain types of buffer. I don’t use this -in modes for webdev because [[web-mode]] includes that functionality. -#+BEGIN_SRC emacs-lisp -(use-package rainbow-mode - :commands (rainbow-turn-on - rainbow-turn-off) - :config (progn - (add-hook 'xmonad-mode-hook #'rainbow-turn-on))) -#+END_SRC - -Highlighting quasi-quoted expressions in lisps is quite useful. -#+BEGIN_SRC emacs-lisp -(use-package highlight-stages - :defer t - :diminish highlight-stages-mode - :init (progn - (add-hook 'lisp-mode-common-hook #'highlight-stages-mode))) -#+END_SRC - -** Fonts - -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 (concat mono-face "-" (number-to-string 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 (concat variable-face "-" - (number-to-string variable-font-size))))) - - (cond - ((eq window-system 'w32) - (ap/set-fonts "Consolas" 10 "Segoe UI" 11)) - ((eq system-type 'darwin) - (ap/set-fonts "Hack" 14 "Avenir" 14)))) -#+END_SRC - -Allow font-lock-mode to do background parsing. I’m not really sure if -these settings are particularly useful -#+BEGIN_SRC emacs-lisp - (setq jit-lock-stealth-time nil - jit-lock-stealth-load 100 - jit-lock-chunk-size 300 - jit-lock-defer-time nil - font-lock-maximum-decoration '((dired-mode . 1) - (t . t))) -#+END_SRC - -** Page Breaks - -By default, Emacs displays page breaks as ^L. Lines look much nicer. - -#+BEGIN_SRC emacs-lisp - (use-package page-break-lines - :defer 5 - :config (global-page-break-lines-mode)) -#+END_SRC - * Files ** Auto-saving -- cgit 1.4.1 From 45e3307f95a1aa8d4be2383e0cc6b4d05547acc7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 10 Dec 2015 16:11:59 +0100 Subject: Emacs: Replace smart-tab with a simple binding --- tag-emacs/emacs.d/init.org | 47 +++++++++++++++------------------------------- 1 file changed, 15 insertions(+), 32 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index b28107fb..24888f97 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -775,30 +775,12 @@ Directional window movement Make built-in completion a bit more intelligent, by adding substring and initial-based completion and ignoring case. -** TODO With =tab-always-indent=, do I need smart-tab anymore? - #+BEGIN_SRC emacs-lisp (setq completion-styles '(basic initials partial-completion substring) completion-ignore-case t tab-always-indent 'complete) #+END_SRC -*** Smart-tab - -Most editors use tab for both completion and indentation. Smart-tab -tries to do the right thing depending on the location of the point and -the line’s current indentation. - -#+BEGIN_SRC emacs-lisp -(use-package smart-tab - :commands (global-smart-tab-mode) - :init (global-smart-tab-mode) - :diminish smart-tab-mode - :config (progn - (nconc smart-tab-completion-functions-alist '((php-mode . php-complete-function))) - (diminish 'smart-tab-mode ""))) -#+END_SRC - *** Company The main choices for automatic completion in Emacs are company and @@ -806,20 +788,21 @@ auto-complete-mode. I’ve not tried auto-complete-mode as company seems to work perfectly well for me. #+BEGIN_SRC emacs-lisp -(use-package company - :commands (company-mode) - :diminish "Cmpl" - :bind (("C-" . company-complete)) - :init (progn - (add-hook 'prog-mode-hook #'company-mode) - (setq company-backends '(company-tern (company-elisp company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-cmake company-capf company-gtags company-dabbrev-code company-etags company-keywords) - company-oddmuse company-files 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))) + (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-tern (company-elisp company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-cmake company-capf company-gtags company-dabbrev-code company-etags company-keywords) + company-oddmuse company-files 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 * Dates & Times -- cgit 1.4.1 From 2982d13a5bb1b149fda39fd1af7638aa437d3f43 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 15 Dec 2015 17:17:09 +0100 Subject: Emacs: Don’t show server running message --- 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 24888f97..2cfb32f7 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2417,8 +2417,7 @@ Start a server if possible. A daemon is already a server. (run-with-idle-timer 2 nil (lambda () (unless (daemonp) (require 'server) - (if (server-running-p server-name) - (message "Server already appears to be running") + (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) -- cgit 1.4.1 From eac4c6007a802ba7d430283888aa3a03d4844751 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 15 Dec 2015 17:22:15 +0100 Subject: Emacs: Add fallback execute-extended-command bind --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 2cfb32f7..a25c6155 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1078,6 +1078,7 @@ Option/alt, then Control. (bind-key* "s-x" (define-prefix-command 'super-x-map)) (bind-key* "s-," #'switch-to-dotfiles) + (bind-key* "C-M-x" #'execute-extended-command) (set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) #+END_SRC * Misc -- cgit 1.4.1 From 6b061a843c2599c8b657e9a8767d180ddf259a77 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 16 Dec 2015 19:58:45 +0100 Subject: zsh: Set SSH_AUTH_SOCK to known location --- tag-zsh/config/zsh/zshrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index f414bb74..1dd1cc2f 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -44,6 +44,11 @@ then fi fi +if [[ $os == "gnu" ]] +then + export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" +fi + LS_COLORS='no=00:fi=00:di=36:ln=35:pi=30;44:so=35;44:do=35;44:bd=33;44:cd=37;44:or=05;37;41:mi=05;37;41:ex=01;31:*.cmd=01;31:*.exe=01;31:*.com=01;31:*.bat=01;31:*.reg=01;31:*.app=01;31:*.txt=32:*.org=32:*.md=32:*.mkd=32:*.h=32:*.c=32:*.C=32:*.cc=32:*.cpp=32:*.cxx=32:*.objc=32:*.sh=32:*.csh=32:*.zsh=32:*.el=32:*.vim=32:*.java=32:*.pl=32:*.pm=32:*.py=32:*.rb=32:*.hs=32:*.php=32:*.htm=32:*.html=32:*.shtml=32:*.erb=32:*.haml=32:*.xml=32:*.rdf=32:*.css=32:*.sass=32:*.scss=32:*.less=32:*.js=32:*.coffee=32:*.man=32:*.0=32:*.1=32:*.2=32:*.3=32:*.4=32:*.5=32:*.6=32:*.7=32:*.8=32:*.9=32:*.l=32:*.n=32:*.p=32:*.pod=32:*.tex=32:*.bmp=33:*.cgm=33:*.dl=33:*.dvi=33:*.emf=33:*.eps=33:*.gif=33:*.jpeg=33:*.jpg=33:*.JPG=33:*.mng=33:*.pbm=33:*.pcx=33:*.pdf=33:*.pgm=33:*.png=33:*.ppm=33:*.pps=33:*.ppsx=33:*.ps=33:*.svg=33:*.svgz=33:*.tga=33:*.tif=33:*.tiff=33:*.xbm=33:*.xcf=33:*.xpm=33:*.xwd=33:*.xwd=33:*.yuv=33:*.aac=33:*.au=33:*.flac=33:*.mid=33:*.midi=33:*.mka=33:*.mp3=33:*.mpa=33:*.mpeg=33:*.mpg=33:*.ogg=33:*.ra=33:*.wav=33:*.anx=33:*.asf=33:*.avi=33:*.axv=33:*.flc=33:*.fli=33:*.flv=33:*.gl=33:*.m2v=33:*.m4v=33:*.mkv=33:*.mov=33:*.mp4=33:*.mp4v=33:*.mpeg=33:*.mpg=33:*.nuv=33:*.ogm=33:*.ogv=33:*.ogx=33:*.qt=33:*.rm=33:*.rmvb=33:*.swf=33:*.vob=33:*.wmv=33:*.doc=31:*.docx=31:*.rtf=31:*.dot=31:*.dotx=31:*.xls=31:*.xlsx=31:*.ppt=31:*.pptx=31:*.fla=31:*.psd=31:*.7z=1;35:*.apk=1;35:*.arj=1;35:*.bin=1;35:*.bz=1;35:*.bz2=1;35:*.cab=1;35:*.deb=1;35:*.dmg=1;35:*.gem=1;35:*.gz=1;35:*.iso=1;35:*.jar=1;35:*.msi=1;35:*.rar=1;35:*.rpm=1;35:*.tar=1;35:*.tbz=1;35:*.tbz2=1;35:*.tgz=1;35:*.tx=1;35:*.war=1;35:*.xpi=1;35:*.xz=1;35:*.z=1;35:*.Z=1;35:*.zip=1;35:*.ANSI-30-black=30:*.ANSI-01;30-brblack=01;30:*.ANSI-31-red=31:*.ANSI-01;31-brred=01;31:*.ANSI-32-green=32:*.ANSI-01;32-brgreen=01;32:*.ANSI-33-yellow=33:*.ANSI-01;33-bryellow=01;33:*.ANSI-34-blue=34:*.ANSI-01;34-brblue=01;34:*.ANSI-35-magenta=35:*.ANSI-01;35-brmagenta=01;35:*.ANSI-36-cyan=36:*.ANSI-01;36-brcyan=01;36:*.ANSI-37-white=37:*.ANSI-01;37-brwhite=01;37:*.log=01;34:*~=01;34:*#=01;34:*.bak=01;36:*.BAK=01;36:*.old=01;36:*.OLD=01;36:*.org_archive=01;36:*.off=01;36:*.OFF=01;36:*.dist=01;36:*.DIST=01;36:*.orig=01;36:*.ORIG=01;36:*.swp=01;36:*.swo=01;36:*,v=01;36:*.gpg=34:*.gpg=34:*.pgp=34:*.asc=34:*.3des=34:*.aes=34:*.enc=34:' #Ignore suffixes in completion -- cgit 1.4.1 From ad6c3514fb2c2de0c1916a168ff770ad3260c483 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 16 Dec 2015 19:59:15 +0100 Subject: Emacs: Disable org adaptive indentation --- tag-emacs/emacs.d/init.org | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 6c3e35c7..6d9733c4 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1512,6 +1512,8 @@ Org is wünderbar. org-list-allow-alphabetical t + org-adapt-indentation nil + org-pretty-entities t org-table-duration-custom-format 'seconds -- cgit 1.4.1 From 72303ddc158dc7aa26fe041e9be646bca857babd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 17 Dec 2015 09:03:36 +0100 Subject: Git: Remember merge conflict resolutions --- tag-git/config/git/config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-git/config/git/config b/tag-git/config/git/config index 29222857..3d6b82a2 100644 --- a/tag-git/config/git/config +++ b/tag-git/config/git/config @@ -30,3 +30,5 @@ excludesfile = ~/.config/git/ignore [rebase] autosquash = true +[rerere] + enabled = true -- cgit 1.4.1 From d26b9612b863553148562ea72398a472fe04adf9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 22 Dec 2015 16:45:20 +0100 Subject: Override imenu with nested version --- tag-emacs/emacs.d/init.org | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index a25c6155..6c3b9a3e 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1165,12 +1165,34 @@ replace helm and ido. :bind (("C-s" . swiper) ("C-r" . swiper) ("C-c C-r" . ivy-resume) - ("C-x i" . imenu) + ("C-x i" . ivy-imenu-goto) ("C-=" . swiper)) :config (progn (setq ivy-use-virtual-buffers t 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)) -- cgit 1.4.1 From 4ca6509128fee2d37aa01e34e3ef653f79279729 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 23 Dec 2015 10:28:24 +0100 Subject: Emacs: Fix error on loading ledger-mode --- tag-emacs/emacs.d/init.org | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index b8f8f47b..a5226283 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1464,7 +1464,6 @@ works really nicely. (defun setup-ledger-mode () (setq-local indent-tabs-mode nil)) (add-hook 'ledger-mode-hook #'setup-ledger-mode) - (add-to-list 'smart-tab-disabled-major-modes 'ledger-mode) (setq ledger-use-iso-dates t ledger-post-use-completion-engine :built-in ledger-reconcile-default-commodity "€" -- cgit 1.4.1 From 2d0a04dd67f6b6b67c80e4991b19bb96a074c02e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 23 Dec 2015 10:38:34 +0100 Subject: Emacs: fix whitespace --- tag-emacs/emacs.d/init.org | 65 +++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index a5226283..a41c341e 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -212,45 +212,44 @@ ones. I added a couple of functions to allow me to open new projects 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)) - :init (projectile-global-mode) - :diminish projectile-mode - :config (progn - (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/-add-known-subfolder-projects (dir) - (-map #'projectile-add-known-project (--map (concat (file-name-as-directory dir) it) (ap/subfolder-projects dir)))) + (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)) + :init (projectile-global-mode) + :diminish projectile-mode + :config (progn + (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/add-known-subfolder-projects () - (interactive) - (ap/-add-known-subfolder-projects (read-directory-name "Add projects under: "))) + (defun ap/-add-known-subfolder-projects (dir) + (-map #'projectile-add-known-project (--map (concat (file-name-as-directory dir) it) (ap/subfolder-projects dir)))) - (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/add-known-subfolder-projects () + (interactive) + (ap/-add-known-subfolder-projects (read-directory-name "Add projects under: "))) - (defun ap/open-work-project (&optional arg) - (interactive "P") - (ap/open-subfolder-project work-project-directory arg)) + (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-home-project (&optional arg) - (interactive "P") - (ap/open-subfolder-project home-project-directory 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))) + (setq projectile-switch-project-action #'projectile-dired + projectile-remember-window-configs t + projectile-completion-system 'ivy))) #+END_SRC ** perspective -- cgit 1.4.1 From 5cb0ce04c8d1b3633a26b103ab3c0ee962b2f4c2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 23 Dec 2015 11:00:29 +0100 Subject: Emacs: Add `pt` with projectile search override --- tag-emacs/emacs.d/init.org | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index a41c341e..b0babcc5 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -205,6 +205,57 @@ By default, Emacs displays page breaks as ^L. Lines look much nicer. :config (setq ag-project-root-function #'projectile-project-root)) #+END_SRC +** The Platinum Searcher + +[[https://github.com/monochromegane/the_platinum_searcher][The Platinum Searcher]] is a code search tool similar to ack and +the_silver_searcher(ag). It supports multi platforms and multi +encodings. + +#+BEGIN_SRC sh :tangle no +brew install pt +#+END_SRC + +#+BEGIN_SRC emacs-lisp + (use-package pt + :pin melpa-stable + :bind* ("C-c p s" . ap/projectile-pt) + :config (progn + (defun pt (string directory &optional args) + (interactive (list (read-from-minibuffer "Pt search for: " (thing-at-point 'symbol)) + (read-directory-name "Directory: "))) + (let ((default-directory directory)) + (compilation-start + (mapconcat 'identity + (append (list pt-executable) + pt-arguments + args + '("--nogroup" "--nocolor" "--") + (list (shell-quote-argument string) ".")) " ")))) + + (defun ap/projectile-pt (search-term &optional arg) + "Run a pt search with SEARCH-TERM in the project. + + With an optional prefix argument ARG SEARCH-TERM is interpreted as a + regular expression." + (interactive + (list (read-from-minibuffer + (projectile-prepend-project-name (format "Pt %ssearch for: " (if current-prefix-arg "regexp " ""))) + (projectile-symbol-or-selection-at-point)) + current-prefix-arg)) + (if (require 'pt nil 'noerror) + (let ((pt-command (if arg 'pt-regexp 'pt)) + (ignore-list (-map #'shell-quote-argument + (ag/format-ignore + (-union ag-ignore-list + (append + (projectile-ignored-files-rel) (projectile-ignored-directories-rel) + grep-find-ignored-files grep-find-ignored-directories))))) + ;; reset the prefix arg, otherwise it will affect the pt-command + (current-prefix-arg nil)) + (funcall pt-command search-term (projectile-project-root) ignore-list)) + (error "Package 'pt' is not available"))))) +#+END_SRC + ** Projectile Projectile is awesome for working in projects, especially VCS-backed -- cgit 1.4.1 From 7da19e0e1c018b6965702c2a6b0242d0315e61a7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 23 Dec 2015 11:01:24 +0100 Subject: Fix sub/super-script in init.org --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index b0babcc5..d3fcba5e 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1,4 +1,5 @@ #+TITLE: Emacs Configuration for Alan Pearce +#+OPTIONS: ^:nil #+PROPERTY: results silent #+PROPERTY: eval no-export #+PROPERTY: header-args :comments link -- cgit 1.4.1 From 4c98cfe9ac363948087307020b2d337920ee5a8a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 23 Dec 2015 14:49:45 +0100 Subject: Emacs: Don’t use find-file in tangle-init --- 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 d3fcba5e..138d1f03 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2471,9 +2471,8 @@ the =org=-document after changes. ;; Avoid running hooks when tangling. (let ((prog-mode-hook nil) (dest (concat user-emacs-directory "init.el"))) - (find-file ,(buffer-file-name)) (require 'ob-tangle) - (org-babel-tangle nil dest) + (org-babel-tangle-file ,(buffer-file-name) dest) (if (byte-compile-file dest) dest (with-current-buffer byte-compile-log-buffer -- cgit 1.4.1 From 17574627e50f0f8456a8b9c528826a6eddfce81c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 23 Dec 2015 15:55:58 +0100 Subject: Emacs: Fix projectile-pt keybind --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 138d1f03..63a09a78 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -219,7 +219,7 @@ brew install pt #+BEGIN_SRC emacs-lisp (use-package pt :pin melpa-stable - :bind* ("C-c p s" . ap/projectile-pt) + :bind* ("C-c p s s" . ap/projectile-pt) :config (progn (defun pt (string directory &optional args) (interactive (list (read-from-minibuffer "Pt search for: " (thing-at-point 'symbol)) -- cgit 1.4.1 From d7974bc08c0f2264f142e120b570967e17c20455 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 23 Dec 2015 16:48:04 +0100 Subject: Emacs: Move Modeline settings under Style --- tag-emacs/emacs.d/init.org | 241 +++++++++++++++++++++++---------------------- 1 file changed, 121 insertions(+), 120 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 63a09a78..53b8f0cb 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -185,6 +185,127 @@ By default, Emacs displays page breaks as ^L. Lines look much nicer. :defer 5 :config (global-page-break-lines-mode)) #+END_SRC +** Modeline + +I modified the mode-line format to show me less information. Instead, +I put some of it in the frame-line at the top. + +#+BEGIN_SRC emacs-lisp + (column-number-mode t) + (size-indication-mode t) + + (defun fill-line-format (line-format) + (max 0 + (- (window-width) + (length (format-mode-line line-format))))) + + (defvar mode-line-size + `((size-indication-mode + ((-3 ,(propertize + "%p" + 'local-map mode-line-column-line-number-mode-map + 'mouse-face 'mode-line-highlight + ;; XXX needs better description + 'help-echo "Size indication mode\n\ + mouse-1: Display Line and Column Mode Menu")) + " " + (-4 "%I"))))) + + (setq-default + mode-line-modes (let ((recursive-edit-help-echo "Recursive edit, type C-M-c to get out")) + (list (propertize "%[" 'help-echo recursive-edit-help-echo) + `(:propertize ("" mode-name) + help-echo "Major mode\n\ + mouse-1: Display major mode menu\n\ + mouse-2: Show help for major mode\n\ + mouse-3: Toggle minor modes" + mouse-face mode-line-highlight + local-map ,mode-line-major-mode-keymap) + '("" mode-line-process) + `(:propertize ("" minor-mode-alist) + mouse-face mode-line-highlight + help-echo "Minor mode\n\ + mouse-1: Display minor mode menu\n\ + mouse-2: Show help for minor mode\n\ + mouse-3: Toggle minor modes" + local-map ,mode-line-minor-mode-keymap) + (propertize "%n" 'help-echo "mouse-2: Remove narrowing from buffer" + 'mouse-face 'mode-line-highlight + 'local-map (make-mode-line-mouse-map + 'mouse-2 #'mode-line-widen)) + (propertize "%]" 'help-echo recursive-edit-help-echo) + " ")) + mode-line-buffer-identification (list (propertize "%b" + 'face 'mode-line-buffer-id)) + + mode-line-position `((line-number-mode + ((column-number-mode + ,(propertize + "%l:%c" + 'local-map mode-line-column-line-number-mode-map + 'mouse-face 'mode-line-highlight + 'help-echo "Line number and Column number\n\ + mouse-1: Display Line and Column Mode Menu") + (6 ,(propertize + "L%l" + 'local-map mode-line-column-line-number-mode-map + 'mouse-face 'mode-line-highlight + 'help-echo "Line Number\n\ + mouse-1: Display Line and Column Mode Menu")))) + ((column-number-mode + (5 ,(propertize + "C%c" + 'local-map mode-line-column-line-number-mode-map + 'mouse-face 'mode-line-highlight + 'help-echo "Column number\n\ + mouse-1: Display Line and Column Mode Menu")))))) + mode-line-format `("%e" + " " + mode-line-modes + mode-line-misc-info + (vc-mode vc-mode) + mode-line-end-spaces) + header-line-format `("%e" + mode-line-front-space + mode-line-mule-info + mode-line-client + mode-line-modified + mode-line-auto-compile + mode-line-remote " " + mode-line-position " " + mode-line-size + " ⎸ " + mode-line-buffer-identification + )) + + (setq frame-title-format + '("%f" (dired-directory dired-directory))) +#+END_SRC + +** Renaming major modes + +Diminishing major modes does not happen in the same manner as minor +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))) +#+END_SRC + + * Projects #+BEGIN_SRC emacs-lisp @@ -1307,126 +1428,6 @@ don’t use it directly. "smex-items")))) #+END_SRC -* Modeline - -I modified the mode-line format to show me less information. Instead, -I put some of it in the frame-line at the top. - -#+BEGIN_SRC emacs-lisp - (column-number-mode t) - (size-indication-mode t) - - (defun fill-line-format (line-format) - (max 0 - (- (window-width) - (length (format-mode-line line-format))))) - - (defvar mode-line-size - `((size-indication-mode - ((-3 ,(propertize - "%p" - 'local-map mode-line-column-line-number-mode-map - 'mouse-face 'mode-line-highlight - ;; XXX needs better description - 'help-echo "Size indication mode\n\ - mouse-1: Display Line and Column Mode Menu")) - " " - (-4 "%I"))))) - - (setq-default - mode-line-modes (let ((recursive-edit-help-echo "Recursive edit, type C-M-c to get out")) - (list (propertize "%[" 'help-echo recursive-edit-help-echo) - `(:propertize ("" mode-name) - help-echo "Major mode\n\ - mouse-1: Display major mode menu\n\ - mouse-2: Show help for major mode\n\ - mouse-3: Toggle minor modes" - mouse-face mode-line-highlight - local-map ,mode-line-major-mode-keymap) - '("" mode-line-process) - `(:propertize ("" minor-mode-alist) - mouse-face mode-line-highlight - help-echo "Minor mode\n\ - mouse-1: Display minor mode menu\n\ - mouse-2: Show help for minor mode\n\ - mouse-3: Toggle minor modes" - local-map ,mode-line-minor-mode-keymap) - (propertize "%n" 'help-echo "mouse-2: Remove narrowing from buffer" - 'mouse-face 'mode-line-highlight - 'local-map (make-mode-line-mouse-map - 'mouse-2 #'mode-line-widen)) - (propertize "%]" 'help-echo recursive-edit-help-echo) - " ")) - mode-line-buffer-identification (list (propertize "%b" - 'face 'mode-line-buffer-id)) - - mode-line-position `((line-number-mode - ((column-number-mode - ,(propertize - "%l:%c" - 'local-map mode-line-column-line-number-mode-map - 'mouse-face 'mode-line-highlight - 'help-echo "Line number and Column number\n\ - mouse-1: Display Line and Column Mode Menu") - (6 ,(propertize - "L%l" - 'local-map mode-line-column-line-number-mode-map - 'mouse-face 'mode-line-highlight - 'help-echo "Line Number\n\ - mouse-1: Display Line and Column Mode Menu")))) - ((column-number-mode - (5 ,(propertize - "C%c" - 'local-map mode-line-column-line-number-mode-map - 'mouse-face 'mode-line-highlight - 'help-echo "Column number\n\ - mouse-1: Display Line and Column Mode Menu")))))) - mode-line-format `("%e" - " " - mode-line-modes - mode-line-misc-info - (vc-mode vc-mode) - mode-line-end-spaces) - header-line-format `("%e" - mode-line-front-space - mode-line-mule-info - mode-line-client - mode-line-modified - mode-line-auto-compile - mode-line-remote " " - mode-line-position " " - mode-line-size - " ⎸ " - mode-line-buffer-identification - )) - - (setq frame-title-format - '("%f" (dired-directory dired-directory))) -#+END_SRC - -** Renaming major modes - -Diminishing major modes does not happen in the same manner as minor -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))) -#+END_SRC - * Modes Setup some modes for systemd files -- cgit 1.4.1 From 96d4876b695747286f931355c16da4d145bd31cc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 23 Dec 2015 16:49:43 +0100 Subject: Emacs: Switch buffers from persp, not projectile --- tag-emacs/emacs.d/init.org | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 53b8f0cb..c6f638d3 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1383,7 +1383,7 @@ replace helm and ido. ("" . counsel-M-x) ("C-c M-x" . execute-extended-command) ("C-x C-f" . counsel-find-file) - ("C-x b" . counsel-switch-to-projectile-buffer)) + ("C-x b" . counsel-switch-to-persp-buffer)) :config (progn (defadvice counsel-find-file (after find-file-sudo activate) "Find file as root if necessary." @@ -1391,16 +1391,14 @@ replace helm and ido. (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-projectile-buffer (arg) - "Forward to `projectile-switch-to-buffer'." + (defun counsel-switch-to-persp-buffer (arg) + "Forward to `persp-switch-to-buffer'." (interactive "P") - (if (projectile-project-p) - (ivy-read (format "Switch to buffer [%s]: " (projectile-project-name)) - (projectile-project-buffer-names) - :preselect (buffer-name (other-buffer (current-buffer))) - :action #'ivy--switch-buffer-action - :keymap ivy-switch-buffer-map) - (call-interactively #'ivy-switch-buffer))))) + (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 -- cgit 1.4.1 From b830b6829b0447e71ce30954679b4af0697103cf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 23 Dec 2015 16:52:27 +0100 Subject: Emacs: Show perspective modestring in header --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index c6f638d3..dc541ded 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -435,6 +435,7 @@ it needs hooking into projectile and a key bound to switch between projects. (use-package perspective :bind* ("s-p" . persp-switch) :init (progn + (setq persp-show-modestring 'header) (persp-mode))) (use-package persp-projectile -- cgit 1.4.1 From d9d0d88b351356a24a96005551d5868cf5ae35be Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 24 Dec 2015 10:57:06 +0100 Subject: Emacs: Use Input fonts on OS X --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index dc541ded..8142fcbd 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -162,7 +162,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource ((eq window-system 'w32) (ap/set-fonts "Consolas" 10 "Segoe UI" 11)) ((eq system-type 'darwin) - (ap/set-fonts "Hack" 14 "Avenir" 14)))) + (ap/set-fonts "Input Mono" 14 "Input Sans" 14)))) #+END_SRC Allow font-lock-mode to do background parsing. I’m not really sure if -- cgit 1.4.1 From 58470726b86ca10892ffb91b48a571afc0cf8439 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 24 Dec 2015 19:56:35 +0000 Subject: ZSH: Remove old unused linkAuthSock setup --- tag-zsh/config/zsh/zshrc | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 1dd1cc2f..496a9756 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -30,20 +30,6 @@ hosts=( users=(alan root toor) -function linkAuthSock () { - local linkSock=~/.ssh/ssh_auth_sock - ln -sf $1 ~/.ssh/ssh_auth_sock - export SSH_AUTH_SOCK=$linkSock -} - -if [[ "$SSH_AUTH_SOCK" != "" ]] -then - if [[ -e ~/.ssh/ssh_auth_sock && ! -L ~/.ssh/ssh_auth_sock ]] - then - linkAuthSock $SSH_AUTH_SOCK - fi -fi - if [[ $os == "gnu" ]] then export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" -- cgit 1.4.1 From 4e27638ec46cee2fdf7c7d838a5375b66c00939d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 27 Dec 2015 14:45:01 +0000 Subject: Emacs: Use faster method to hide startup message --- 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 8142fcbd..a35e5989 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -9,7 +9,8 @@ This is a living document, detailing my Emacs configuration using org-mode ** Startup Open Emacs with just a plain window. No graphics or messages, please! #+BEGIN_SRC emacs-lisp - (setq inhibit-startup-echo-area-message "alan") + (put 'inhibit-startup-echo-area-message 'saved-value + (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) -- cgit 1.4.1 From 053df601845b618847d56f837b9e33c4b52fcdca Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 4 Jan 2016 14:35:31 +0100 Subject: Emacs: Use web-mode for jsx files --- tag-emacs/emacs.d/init.org | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index a35e5989..0a4a3ec3 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2039,18 +2039,19 @@ is really nice, because it handles the HTML part the same way in all 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 (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)) + (use-package web-mode + :mode (("/views/.*\\.php\\'" . web-mode) + ("/layouts/.*\\.html\\'" . web-mode) + ("/templates/.*\\.php\\'" . web-mode) + ("\\.ejs\\'" . web-mode) + ("\\.jsx\\'" . web-mode)) + :config (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)) #+END_SRC I derived a mode for twig, in order to use its =mode-hook=. -- cgit 1.4.1 From 47434ec5414615851d09019b4d94abd536765026 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 4 Jan 2016 15:34:01 +0100 Subject: Emacs: Fix compile error in restclient config --- tag-emacs/emacs.d/init.org | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 0a4a3ec3..c65d5eb1 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2000,14 +2000,14 @@ calls. Feels a bit like using =org-babel=. I wonder if there’s an 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))) + (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))) #+END_SRC *** sgml-mode -- cgit 1.4.1 From 069922e569c9f3729b2a6f48d414608e98e3344b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 4 Jan 2016 15:58:42 +0100 Subject: Emacs: Configure avy keys for colemak --- tag-emacs/emacs.d/init.org | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index c65d5eb1..02be584e 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2306,14 +2306,15 @@ Avy is a really nice way to move around files, like ace-jump-mode, but 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) - ("C-c SPC" . avy-goto-char-timer)) - :config (progn - (avy-setup-default) - (setq avy-all-windows nil))) + (use-package avy + :bind* (("M-g g" . avy-goto-line) + ("M-g M-g" . avy-goto-line) + ("C-|" . avy-goto-line) + ("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 -- cgit 1.4.1 From 45dbe94151c505458720329e61b7241f27a6e1d3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 5 Jan 2016 12:34:33 +0100 Subject: zsh: Remove unused paths --- tag-zsh/config/zsh/zshenv | 2 -- 1 file changed, 2 deletions(-) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index ab063a16..5d206c98 100755 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -8,8 +8,6 @@ then $defpath ~/bin $GOPATH/bin - ~/.cabal/bin - ~/.composer/vendor/bin ) fi -- cgit 1.4.1 From a1385303f99a383252e18d9affa0d40f12aa2bd7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Jan 2016 17:45:42 +0100 Subject: Emacs: Fix tramp prompt hanging on certain prompts --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 02be584e..410a18b1 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -681,7 +681,7 @@ that I can sudo on remote machines (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] *\\)*") + 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)) -- cgit 1.4.1 From e3c5528891c42d23849d299fd5255f352d821b93 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Jan 2016 17:46:05 +0100 Subject: Xresources: Use Input fonts in Emacs --- tag-xresources/xresources/main | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tag-xresources/xresources/main b/tag-xresources/xresources/main index 7c805bd4..53e9676f 100644 --- a/tag-xresources/xresources/main +++ b/tag-xresources/xresources/main @@ -28,6 +28,6 @@ Emacs.MenuBar: off Emacs.ScrollBars: off Emacs.CursorBlink: off -Emacs.Font: -*-Fira Mono-normal-*-*-*-16-*-*-*-*-*-*-* -Emacs.fixed-pitch.attributeFont: -*-Fira Mono-normal-*-*-*-16-*-*-*-*-*-*-* -Emacs.variable-pitch.attributeFont: -*-Fira Sans-medium-r-*-*-16-*-*-*-*-*-*-* +Emacs.Font: -*-Input Mono Narrow-normal-*-*-*-16-*-*-*-*-*-*-* +Emacs.fixed-pitch.attributeFont: -*-Input Mono Narrow-normal-*-*-*-16-*-*-*-*-*-*-* +Emacs.variable-pitch.attributeFont: -*-Input Sans-medium-r-*-*-16-*-*-*-*-*-*-* -- cgit 1.4.1 From 10f81ec220477c7b8c7ea637639f78e90c7a4c3e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Jan 2016 17:46:23 +0100 Subject: Emacs: Add sync version of tangle-init --- tag-emacs/emacs.d/init.org | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 410a18b1..2c861433 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2462,6 +2462,20 @@ the =org=-document after changes. :commands (async-start) :defer 2) + (defun tangle-init-sync () + (interactive) + (when (string-suffix-p "init.org" (buffer-file-name)) + (message "Tangling init") + ;; Avoid running hooks when tangling. + (let ((prog-mode-hook nil) + (dest (concat user-emacs-directory "init.el"))) + (require 'ob-tangle) + (org-babel-tangle-file (buffer-file-name) dest) + (if (byte-compile-file dest) + dest + (with-current-buffer byte-compile-log-buffer + (buffer-string)))))) + (defun tangle-init () "If the current buffer is 'init.org' the code-blocks are tangled, and the tangled file is compiled." -- cgit 1.4.1 From 01a45781e74297d2b526bac96b6e15181e5fc1c3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 12 Jan 2016 16:08:23 +0100 Subject: Remove fixed TODO --- tag-emacs/emacs.d/init.org | 2 -- 1 file changed, 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 2c861433..8ff9f387 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -748,8 +748,6 @@ whitespace-sensitive language, of course. (auto-indent-global-mode))) #+END_SRC -*** TODO Check for auto-indentation of whitespace-sensitive languages. - ** smart-tabs-mode Not related to [[smart-tab][=smart-tab=]], this mode indents with tabs and aligns -- cgit 1.4.1 From 41615696cbfaf17c21ff16d86b6ff534a1baea37 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 14 Jan 2016 17:12:47 +0100 Subject: Emacs: Ensure package-initialize is called once --- 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 8ff9f387..f44d3d52 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -51,7 +51,8 @@ the buffer to be empty. (require 'diminish) (require 'bind-key)) (setq use-package-verbose t - use-package-always-ensure t) + use-package-always-ensure t + package-enable-at-startup nil) #+END_SRC * Customize -- cgit 1.4.1 From 9c688f368aa5bcb92e1532c6e96b50a8adac7a55 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 14 Jan 2016 17:13:46 +0100 Subject: Emacs: Install use-package from melpa-stable --- tag-emacs/emacs.d/init.org | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index f44d3d52..69c86d24 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -41,7 +41,10 @@ the buffer to be empty. ("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-user-dir (concat "~/.emacs.d/packages/" emacs-version "/elpa") + package-pinned-packages '(("use-package" . melpa-stable) + ("diminish" . melpa-stable) + ("bind-key" . melpa-stable))) (package-initialize) (unless (package-installed-p 'use-package) (package-refresh-contents) -- cgit 1.4.1 From 142e29561966e9a991145947b52a763f9906658c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 14 Jan 2016 19:26:51 +0100 Subject: Emacs: Use js2-mode for jsx files --- tag-emacs/emacs.d/init.org | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 2c861433..7eff008b 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1940,7 +1940,8 @@ it though #+BEGIN_SRC emacs-lisp (use-package js2-mode - :mode ("\\.js\\'" . js2-mode) + :mode (("\\.js\\'" . js2-mode) + ("\\.jsx\\'" . js2-jsx-mode)) :functions js2-next-error :config (progn (defun ap/javascript-setup () @@ -2043,8 +2044,7 @@ of them as well. :mode (("/views/.*\\.php\\'" . web-mode) ("/layouts/.*\\.html\\'" . web-mode) ("/templates/.*\\.php\\'" . web-mode) - ("\\.ejs\\'" . web-mode) - ("\\.jsx\\'" . web-mode)) + ("\\.ejs\\'" . web-mode)) :config (setq web-mode-code-indent-offset 4 web-mode-css-indent-offset 4 web-mode-markup-indent-offset 4 -- cgit 1.4.1 From 3477d9f8e72164366e7c222515082f47b6d9a962 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 14 Jan 2016 19:38:17 +0100 Subject: Emacs: Open composer.lock files with json-mode --- tag-emacs/emacs.d/init.org | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 01cae195..cf2b362a 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1956,8 +1956,6 @@ it though (add-hook 'js2-mode-hook #'ap/javascript-setup) (setq js2-basic-offset 4 js2-include-node-externs t))) - - (add-to-list 'auto-mode-alist '("composer\\.lock" . js-mode)) #+END_SRC *** coffee-mode @@ -1993,7 +1991,8 @@ completions, besides other IDE-like things. #+BEGIN_SRC emacs-lisp (use-package json-mode :mode (("\\.json\\'" . json-mode) - ("\\.sailsrc\\'" . json-mode))) + ("\\.sailsrc\\'" . json-mode) + ("composer\\.lock\\'" . json-mode))) #+END_SRC *** restclient -- cgit 1.4.1 From 839dd59b474a365419f921600ed5aaea8add628b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 14 Jan 2016 19:41:46 +0100 Subject: Formatting --- 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 cf2b362a..1bdfac09 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1659,8 +1659,7 @@ I can use this to keep a journal. I should use it. (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))) - ))) + (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 -- cgit 1.4.1 From b49b2c6b5057689e3d2b22c7f8deb4a68e834e97 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 14 Jan 2016 19:42:10 +0100 Subject: Emacs: Remove */5 minute org-mobile pull --- tag-emacs/emacs.d/init.org | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 1bdfac09..012c4da7 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1676,11 +1676,7 @@ I can use this to keep a journal. I should use it. (concat (file-name-as-directory org-mobile-directory) org-mobile-capture-file)) - 5) - - ;; Do a pull every 5 minutes to circumvent problems with timestamping - ;; (ie. dropbox bugs) - (run-with-timer 0 (* 5 60) 'org-mobile-pull))))) + 5))))) #+END_SRC * Programming -- cgit 1.4.1 From c8d119ca0f83776fd27574c25fd0b4c2ce890605 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 14 Jan 2016 19:45:01 +0100 Subject: Emacs: Fix bad window-splitting on laptop --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 012c4da7..b67cb29b 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -903,6 +903,7 @@ point whilst I’m moving about. scroll-preserve-screen-position t mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control))) split-height-threshold 100 + split-width-threshold 70 frame-resize-pixelwise t) (if (boundp 'ns-pop-up-frames) (setq ns-pop-up-frames nil)) -- cgit 1.4.1 From 68b37c9d2090f0d21d90c92182e6797183150bd7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 18 Jan 2016 10:42:25 +0100 Subject: Emacs: Remove magit-revert-buffers setting It’s redundant with auto-revert-mode and deprecated --- 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 69c86d24..cc0ba799 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -486,8 +486,7 @@ time. Make sure to set it up with a nice =completing-read-function= magit-completing-read-function #'magit-builtin-completing-read magit-popup-use-prefix-argument 'default magit-push-always-verify nil - global-magit-file-mode nil - magit-revert-buffers t) + 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 -- cgit 1.4.1 From 51437d154eba80d159cd8485c110f6c778fab75e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 18 Jan 2016 13:12:03 +0100 Subject: Emacs: Disable notify-based file watching on Darwin --- tag-emacs/emacs.d/init.org | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index cc0ba799..dfbcd2ab 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -533,10 +533,11 @@ trash for deleting on OS X. ** autorevert #+BEGIN_SRC emacs-lisp -(use-package autorevert - :init (progn - (global-auto-revert-mode 1) - (setq auto-revert-verbose nil))) + (use-package autorevert + :init (progn + (global-auto-revert-mode 1) + (setq auto-revert-verbose nil + auto-revert-use-notify (not (eq system-type 'darwin))))) #+END_SRC ** Encoding -- cgit 1.4.1 From f76ee457eed29f39f9db4521ac881389d45f3706 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 19 Jan 2016 09:48:46 +0100 Subject: Emacs: Use builtin ehelp mode --- tag-emacs/emacs.d/init.org | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index dfbcd2ab..abb64c31 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1126,6 +1126,15 @@ Expand subfolders like a tree inside the parent * Documentation +** ehelp + +ehelp is a less well-known package that’s part of Emacs and slightly +improves the normal help commands, mostly by making quitting them easier. + +#+BEGIN_SRC emacs-lisp + (use-package ehelp + :bind ("C-h" . ehelp-command)) +#+END_SRC ** helm-dash Emacs’ documentation is great to read from inside Emacs. Helm-dash -- cgit 1.4.1 From fe82a01623f5bcc3f16b2dc70a7b62bc6de43369 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 20 Jan 2016 11:47:54 +0100 Subject: Emacs: Bind ehelp correctly --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 558d516e..4ac121dc 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1134,7 +1134,7 @@ improves the normal help commands, mostly by making quitting them easier. #+BEGIN_SRC emacs-lisp (use-package ehelp - :bind ("C-h" . ehelp-command)) + :bind-keymap ("C-h" . ehelp-map)) #+END_SRC ** helm-dash -- cgit 1.4.1 From e6707113ab902773822c1762ea00a39bdf5c15e9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 20 Jan 2016 11:48:07 +0100 Subject: Emacs: Move discover-my-major bind --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 4ac121dc..e1973a13 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1187,7 +1187,7 @@ A nicer way to browse keybindings for major modes. #+BEGIN_SRC emacs-lisp (use-package discover-my-major - :bind ("C-h C-m" . discover-my-major)) + :bind ("" . discover-my-major)) #+END_SRC ** which-key -- cgit 1.4.1 From e1baa8f48effd39398ab5051a71d67a1d9b40335 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 20 Jan 2016 13:01:07 +0100 Subject: Emacs: Lazy-load use-package --- tag-emacs/emacs.d/init.org | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index e1973a13..40fa1731 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -52,7 +52,10 @@ the buffer to be empty. (eval-when-compile (require 'use-package)) (unless (featurep 'use-package) (require 'diminish) - (require 'bind-key)) + (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) -- cgit 1.4.1 From 64efe505036594a9ec439fee0e6385ac5e3995ec Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 20 Jan 2016 15:02:44 +0100 Subject: Emacs: Add reports to ledger-mode configuration --- tag-emacs/emacs.d/init.org | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 40fa1731..c7ba94bc 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1525,18 +1525,28 @@ I use [[http://ledger-cli.org/][=ledger=]] to manage my finances. It has an Ema works really nicely. #+BEGIN_SRC emacs-lisp -(use-package ledger-mode - :mode ("\\.ledger\\'" . ledger-mode) - :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"))) + (use-package ledger-mode + :mode ("\\.ledger\\'" . ledger-mode) + :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 -l \"commodity == '€'\"") + ("Forecast:Next Month" "ledger -f %(ledger-file) bal --forecast 'format_date(d, \"%Y%m%d\")<(to_string(to_int(format_date(now, \"%Y%m01\"))+100))' --limit 'format_date(date, \"%Y%m%d\")>(to_string(to_int(format_date(now, \"%Y%m01\"))+200))' ^Expenses: ^Funds:") + ("Expenses:This Month" "ledger -f %(ledger-file) bal ^Expenses -p \"this month\"") + ("Asset & Liability Balances" "ledger -f %(ledger-file) bal --current -R :Budget: Assets:Receivable Liabilities:Personal") + ("Budget" "ledger -f %(ledger-file) bal ^Funds") + ("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 -- cgit 1.4.1 From b509ca45959eb00a3e5affc9b22fbf029d06cde6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 20 Jan 2016 15:27:46 +0100 Subject: Emacs: Reset split-width-threshold Seems I misunderstood how it works. It’s the minimal width at which a window will be considered for splitting, not the minimum width of a window after splitting --- tag-emacs/emacs.d/init.org | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index c7ba94bc..7bc91d7d 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -906,7 +906,6 @@ point whilst I’m moving about. scroll-preserve-screen-position t mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control))) split-height-threshold 100 - split-width-threshold 70 frame-resize-pixelwise t) (if (boundp 'ns-pop-up-frames) (setq ns-pop-up-frames nil)) -- cgit 1.4.1 From 3ec45150a940f762f60583c95c52a37dc1286cf7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 20 Jan 2016 20:58:13 +0100 Subject: Emacs: Use correct package name for babel --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index b67cb29b..21e30d07 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1609,7 +1609,7 @@ to have my =ledger= setup in an org file with some graph processing with R or something. #+BEGIN_SRC emacs-lisp -(use-package org-babel +(use-package ob-core :defer t :ensure nil :config (org-babel-do-load-languages -- cgit 1.4.1 From 8e55a6102e2ed60d40555ef7d130081b5b415a2e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 20 Jan 2016 21:01:25 +0100 Subject: Emacs: Use file-notify for org-mobile --- tag-emacs/emacs.d/init.org | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 21e30d07..2fce27a1 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1665,19 +1665,15 @@ I can use this to keep a journal. I should use it. (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 - (defun install-monitor (file secs) - (run-with-timer - 0 secs - (lambda (f p) - (unless (< p (second (time-since (elt (file-attributes f) 5)))) - (org-mobile-pull))) - file secs)) - - (install-monitor (file-truename - (concat - (file-name-as-directory org-mobile-directory) - org-mobile-capture-file)) - 5))))) + (defvar org-mobile-watcher nil) + (let ((org-file (expand-file-name + (concat + (file-name-as-directory org-mobile-directory) + org-mobile-capture-file)))) + (defun ap/org-mobile-pull () + (org-mobile-pull)) + (setq org-mobile-watcher + (file-notify-add-watch org-file '(change) #'ap/org-mobile-pull))))))) #+END_SRC * Programming -- cgit 1.4.1 From 7d194e3da6e9c9121c09ebd96c3b83f2ac12a8ff Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 21 Jan 2016 12:51:22 +0100 Subject: Emacs: Check for file-notify support --- tag-emacs/emacs.d/init.org | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index eb432cf9..193796a1 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1687,14 +1687,15 @@ I can use this to keep a journal. I should use it. (org-mobile-pull) ;; run org-mobile-pull at startup (defvar org-mobile-watcher nil) - (let ((org-file (expand-file-name - (concat - (file-name-as-directory org-mobile-directory) - org-mobile-capture-file)))) - (defun ap/org-mobile-pull () - (org-mobile-pull)) - (setq org-mobile-watcher - (file-notify-add-watch org-file '(change) #'ap/org-mobile-pull))))))) + (when file-notify--library + (let ((org-file (expand-file-name + (concat + (file-name-as-directory org-mobile-directory) + org-mobile-capture-file)))) + (defun ap/org-mobile-pull () + (org-mobile-pull)) + (setq org-mobile-watcher + (file-notify-add-watch org-file '(change) #'ap/org-mobile-pull)))))))) #+END_SRC * Programming -- cgit 1.4.1 From b97e9583c07f4f247ab896540ad63157e1f6504d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 22 Jan 2016 14:17:18 +0100 Subject: Remove old ’todo’ for org-mobile --- tag-emacs/emacs.d/init.org | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 193796a1..73f7f942 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1657,7 +1657,6 @@ I can use this to keep a journal. I should use it. **** org-mobile -***** TODO Setup org-mobile #+BEGIN_SRC emacs-lisp (use-package org-mobile :defer 30 -- cgit 1.4.1 From e743a4e8d3949bd1e64907485bec741cfb00a08b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 22 Jan 2016 16:18:13 +0100 Subject: Emacs: Remove which-func-mode --- tag-emacs/emacs.d/init.org | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 73f7f942..f234042a 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1173,16 +1173,6 @@ helps to make documentation for other languages easier to access (ap/create-helm-dash-hook sql ("PostgreSQL" "MySQL")))) #+END_SRC -** which-func - -Use the modeline to show which function definition the point is in. - -#+BEGIN_SRC emacs-lisp -(use-package which-func - :init (which-function-mode) - :config (setq which-func-modes t)) -#+END_SRC - ** discover-my-major A nicer way to browse keybindings for major modes. -- cgit 1.4.1 From 64aad8e0919a1519e8f5bb78d714cb4aa55f736f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 29 Jan 2016 19:07:54 +0100 Subject: zsh: Don’t run fasd if not installed --- tag-zsh/config/zsh/zshrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 496a9756..98fcd5e1 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -355,12 +355,12 @@ ec () { fi } -_FASD_DATA="$HOME/.cache/zsh/fasd-data" -if [[ -e ~/.config/zsh/fasd.zsh ]] +if [[ -n $commands[fasd] && -e ~/.config/zsh/fasd.zsh ]] then + _FASD_DATA="$HOME/.cache/zsh/fasd-data" source ~/.config/zsh/fasd.zsh else - echo "fasd init file is missing." + echo "fasd not enabled." fi case $os in -- cgit 1.4.1 From c8710ae46712b0b600d38d6c2f12ddf84b34d071 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 29 Jan 2016 19:08:23 +0100 Subject: Emacs: Don’t auto-indent in yaml-mode --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 73f7f942..e7cd732a 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -752,6 +752,7 @@ whitespace-sensitive language, of course. (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) (auto-indent-global-mode))) #+END_SRC -- cgit 1.4.1 From 53bc9ff3cf20191ad7b07f482ffb6418404e7dfd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 1 Feb 2016 19:40:10 +0100 Subject: Emacs: Disable auto-indent in ansible-mode --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index e7cd732a..ab234c95 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -753,6 +753,7 @@ whitespace-sensitive language, of course. (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 -- cgit 1.4.1 From 867e97a7c1bae699c5d043be26b44aff45fc68a0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 1 Feb 2016 19:40:32 +0100 Subject: Emacs: Disable typo-mode in yaml and jinja modes --- tag-emacs/emacs.d/init.org | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index ab234c95..0451fe79 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2313,7 +2313,11 @@ type them. :config (progn (typo-global-mode 1)) :init (progn - (add-hook 'text-mode-hook #'typo-mode))) + (add-hook 'text-mode-hook #'typo-mode) + (defun typo-mode-turn-off () + (typo-mode -1)) + (add-hook 'yaml-mode-hook #'turn-off-typo-mode) + (add-hook 'jinja2-mode-hook #'turn-off-typo-mode))) #+END_SRC ** avy -- cgit 1.4.1 From 4a0710cba5943f961fd89385008e23984b0492e5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 3 Feb 2016 19:34:18 +0100 Subject: zsh: Don’t export ssh socket via SSH --- tag-zsh/config/zsh/zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 98fcd5e1..73dad6df 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -30,7 +30,7 @@ hosts=( users=(alan root toor) -if [[ $os == "gnu" ]] +if [[ $os == "gnu" && -z $SSH_CLIENT ]] then export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" fi -- cgit 1.4.1 From d16f4df11a799ae990c07629f60a11d5ad8d22ba Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 3 Feb 2016 19:34:37 +0100 Subject: Emacs: Set SSH_AUTH_SOCK --- tag-emacs/emacs.d/init.org | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 0451fe79..2536223a 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -680,6 +680,8 @@ that I can sudo on remote machines (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 (if (eq system-type 'windows-nt) "plinkx" "ssh") tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root")) tramp-backup-directory-alist backup-directory-alist -- cgit 1.4.1 From ed0669abc63b735fbbb482c63e8ccb9373a18ab1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 5 Feb 2016 17:31:07 +0100 Subject: Emacs: Update ledger-mode reports --- tag-emacs/emacs.d/init.org | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 2536223a..2fc1fe6a 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1540,11 +1540,12 @@ works really nicely. 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 -l \"commodity == '€'\"") - ("Forecast:Next Month" "ledger -f %(ledger-file) bal --forecast 'format_date(d, \"%Y%m%d\")<(to_string(to_int(format_date(now, \"%Y%m01\"))+100))' --limit 'format_date(date, \"%Y%m%d\")>(to_string(to_int(format_date(now, \"%Y%m01\"))+200))' ^Expenses: ^Funds:") - ("Expenses:This Month" "ledger -f %(ledger-file) bal ^Expenses -p \"this month\"") - ("Asset & Liability Balances" "ledger -f %(ledger-file) bal --current -R :Budget: Assets:Receivable Liabilities:Personal") - ("Budget" "ledger -f %(ledger-file) bal ^Funds") + 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 (Current Month)" "ledger -f %(ledger-file) bal --current \\^Funds") + ("Budget (All)" "ledger -f %(ledger-file) bal \\^Funds") ("bal" "ledger -f %(ledger-file) bal") ("reg" "ledger -f %(ledger-file) reg") ("equity" "ledger -f %(ledger-file) equity") -- cgit 1.4.1 From 4f7e34a4c173b92db13e33bb660a189268d99554 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 5 Feb 2016 17:31:19 +0100 Subject: Emacs: Fix org-mobile file-watch warning --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 2fc1fe6a..32984539 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1696,7 +1696,7 @@ I can use this to keep a journal. I should use it. (concat (file-name-as-directory org-mobile-directory) org-mobile-capture-file)))) - (defun ap/org-mobile-pull () + (defun ap/org-mobile-pull (descriptor action file) (org-mobile-pull)) (setq org-mobile-watcher (file-notify-add-watch org-file '(change) #'ap/org-mobile-pull)))))))) -- cgit 1.4.1 From 42559922c6686ba73a7998d78a2c407c45b753ca Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 5 Feb 2016 18:19:59 +0100 Subject: Emacs: Ensure diff indicators are updated by magit --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 32984539..4c197219 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -473,7 +473,7 @@ changed. This package colours the fringe :defer 2 :config (progn (global-diff-hl-mode 1) - (add-hook 'magit-refresh-file-buffer-hook #'diff-hl-update))) + (add-hook 'magit-post-refresh-hook #'diff-hl-magit-post-refresh))) #+END_SRC ** magit -- cgit 1.4.1 From 5357fa8e66c973a6958ae14bd4bfa30d6fd4c9b1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 5 Feb 2016 18:30:58 +0100 Subject: Emacs: Use diff-hl-dired instead of dired-k --- tag-emacs/emacs.d/init.org | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 4c197219..a1417bb8 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -473,6 +473,8 @@ changed. This package colours the fringe :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 @@ -1069,19 +1071,6 @@ copying/moving files between them. (put 'dired-find-alternate-file 'disabled nil))) #+END_SRC -I work with a lot of git projects. Dired-k adds colours based upon -the file’s git status. -#+BEGIN_SRC emacs-lisp - (use-package dired-k - :defer 5 - :init (progn - (add-hook 'dired-initial-position-hook #'dired-k)) - :config (progn - (setq dired-k-human-readable t) - (bind-key "g" #'dired-k dired-mode-map))) -#+END_SRC - - Don’t show uninteresting files in dired listings. #+BEGIN_SRC emacs-lisp -- cgit 1.4.1 From 6ed795a7d9302fd37a0099fa14d0690c513cef75 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 5 Feb 2016 20:08:23 +0100 Subject: Emacs: Set typo-mode language to English --- 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 a1417bb8..09ffb127 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2303,7 +2303,8 @@ type them. #+BEGIN_SRC emacs-lisp (use-package typo :config (progn - (typo-global-mode 1)) + (typo-global-mode 1) + (typo-change-language "English")) :init (progn (add-hook 'text-mode-hook #'typo-mode) (defun typo-mode-turn-off () -- cgit 1.4.1 From 082804f6f1d5f51b7d25b97819151ab30073a742 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 6 Feb 2016 17:01:50 +0100 Subject: Emacs: Remove platinum configuration --- tag-emacs/emacs.d/init.org | 51 ---------------------------------------------- 1 file changed, 51 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 09ffb127..48880722 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -335,57 +335,6 @@ modes. :config (setq ag-project-root-function #'projectile-project-root)) #+END_SRC -** The Platinum Searcher - -[[https://github.com/monochromegane/the_platinum_searcher][The Platinum Searcher]] is a code search tool similar to ack and -the_silver_searcher(ag). It supports multi platforms and multi -encodings. - -#+BEGIN_SRC sh :tangle no -brew install pt -#+END_SRC - -#+BEGIN_SRC emacs-lisp - (use-package pt - :pin melpa-stable - :bind* ("C-c p s s" . ap/projectile-pt) - :config (progn - (defun pt (string directory &optional args) - (interactive (list (read-from-minibuffer "Pt search for: " (thing-at-point 'symbol)) - (read-directory-name "Directory: "))) - (let ((default-directory directory)) - (compilation-start - (mapconcat 'identity - (append (list pt-executable) - pt-arguments - args - '("--nogroup" "--nocolor" "--") - (list (shell-quote-argument string) ".")) " ")))) - - (defun ap/projectile-pt (search-term &optional arg) - "Run a pt search with SEARCH-TERM in the project. - - With an optional prefix argument ARG SEARCH-TERM is interpreted as a - regular expression." - (interactive - (list (read-from-minibuffer - (projectile-prepend-project-name (format "Pt %ssearch for: " (if current-prefix-arg "regexp " ""))) - (projectile-symbol-or-selection-at-point)) - current-prefix-arg)) - (if (require 'pt nil 'noerror) - (let ((pt-command (if arg 'pt-regexp 'pt)) - (ignore-list (-map #'shell-quote-argument - (ag/format-ignore - (-union ag-ignore-list - (append - (projectile-ignored-files-rel) (projectile-ignored-directories-rel) - grep-find-ignored-files grep-find-ignored-directories))))) - ;; reset the prefix arg, otherwise it will affect the pt-command - (current-prefix-arg nil)) - (funcall pt-command search-term (projectile-project-root) ignore-list)) - (error "Package 'pt' is not available"))))) -#+END_SRC - ** Projectile Projectile is awesome for working in projects, especially VCS-backed -- cgit 1.4.1 From 7dd4cee66e185dd45021c157cfef2d2ba57b16c8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 6 Feb 2016 18:51:28 +0100 Subject: Emacs: Switch theme to spacemacs-light --- tag-emacs/emacs.d/init.org | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 48880722..a8675cfd 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -118,12 +118,22 @@ 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))) #+END_SRC +Let’s try spacemacs-light for a while. + +#+BEGIN_SRC emacs-lisp + (use-package spacemacs-theme + :config (progn + (setq spacemacs-theme-org-highlight t) + (load-theme 'spacemacs-light t))) +#+END_SRC + Colourise colour names in certain types of buffer. I don’t use this in modes for webdev because [[web-mode]] includes that functionality. #+BEGIN_SRC emacs-lisp -- cgit 1.4.1 From 90aaf93d952a5f56755379d50f6a8999322e37c4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 6 Feb 2016 20:56:47 +0100 Subject: Emacs: Fix init of spacemacs-theme --- 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 a8675cfd..dccf62df 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -128,7 +128,8 @@ lot of modes. Let’s try spacemacs-light for a while. #+BEGIN_SRC emacs-lisp - (use-package spacemacs-theme + (use-package spacemacs-common + :ensure spacemacs-theme :config (progn (setq spacemacs-theme-org-highlight t) (load-theme 'spacemacs-light t))) -- cgit 1.4.1 From 5b6d3558c4eda8e757e60321fa83c8c99a5604ee Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 16 Feb 2016 13:40:33 +0100 Subject: Emacs: Improve special character input on OS X --- tag-emacs/emacs.d/init.org | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 28bd5396..4abdfc5f 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1172,12 +1172,13 @@ Option/alt, then Control. (set-keyboard-coding-system nil) (custom-set-variables '(mac-option-modifier 'meta) - '(mac-right-option-modifier 'left) + '(mac-right-option-modifier 'alt) '(mac-control-modifier 'control) '(mac-right-control-modifier 'left) '(mac-command-modifier 'super) '(mac-right-command-modifier 'left) - '(mac-function-modifier 'hyper))) + '(mac-function-modifier 'hyper)) + (bind-key "A-@" "€")) #+END_SRC #+BEGIN_SRC emacs-lisp -- cgit 1.4.1 From 321e46792fd1aed34793b12574550272e77523cb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 16 Feb 2016 14:44:42 +0100 Subject: Emacs: Fix option key usage generically --- tag-emacs/emacs.d/init.org | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 4abdfc5f..182bf8f8 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1172,13 +1172,12 @@ Option/alt, then Control. (set-keyboard-coding-system nil) (custom-set-variables '(mac-option-modifier 'meta) - '(mac-right-option-modifier 'alt) + '(mac-right-option-modifier '(:function 'alt :mouse 'alt)) '(mac-control-modifier 'control) '(mac-right-control-modifier 'left) '(mac-command-modifier 'super) '(mac-right-command-modifier 'left) - '(mac-function-modifier 'hyper)) - (bind-key "A-@" "€")) + '(mac-function-modifier 'hyper))) #+END_SRC #+BEGIN_SRC emacs-lisp -- cgit 1.4.1 From 48fa52879053991c9d59a70d243bcd470b2196c7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 16 Feb 2016 14:55:24 +0100 Subject: Emacs: Show compiled file path after tangling --- tag-emacs/emacs.d/init.org | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 182bf8f8..90af12aa 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2431,11 +2431,11 @@ the =org=-document after changes. (message "Tangling init") ;; Avoid running hooks when tangling. (let ((prog-mode-hook nil) - (dest (concat user-emacs-directory "init.el"))) + (dest (expand-file-name "init.el" user-emacs-directory))) (require 'ob-tangle) (org-babel-tangle-file (buffer-file-name) dest) (if (byte-compile-file dest) - dest + (byte-compile-dest-file dest) (with-current-buffer byte-compile-log-buffer (buffer-string)))))) @@ -2450,11 +2450,11 @@ the =org=-document after changes. `(lambda () ;; Avoid running hooks when tangling. (let ((prog-mode-hook nil) - (dest (concat user-emacs-directory "init.el"))) + (dest (expand-file-name "init.el" user-emacs-directory))) (require 'ob-tangle) (org-babel-tangle-file ,(buffer-file-name) dest) (if (byte-compile-file dest) - dest + (byte-compile-dest-file dest) (with-current-buffer byte-compile-log-buffer (buffer-string))))) (lambda (result) -- cgit 1.4.1 From 8356b1cb97e88b90ee90ea3499bd25378bca2404 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 16 Feb 2016 16:57:23 +0100 Subject: Emacs: Remove extra setting of coding system --- tag-emacs/emacs.d/init.org | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 90af12aa..cd890115 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -512,7 +512,6 @@ only a coding system, not a coding system and line ending combination. #+BEGIN_SRC emacs-lisp (prefer-coding-system 'utf-8) -(set-default-coding-systems 'utf-8-auto-unix) (setq-default buffer-file-coding-system 'utf-8-auto-unix) #+END_SRC -- cgit 1.4.1 From dce855ceb87d1c353987449bc07b26dc0c1ab1aa Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 16 Feb 2016 16:57:43 +0100 Subject: Emacs: Configure org-caldav --- tag-emacs/emacs.d/init.org | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index cd890115..4c643c5a 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1640,6 +1640,26 @@ I can use this to keep a journal. I should use it. (file-notify-add-watch org-file '(change) #'ap/org-mobile-pull)))))))) #+END_SRC +**** org-caldav + +I’ve setup CalDAV on my server, it would be nice to use it directly +from org-mode. Previously I had to wait for org-mobile to sync and +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-start) + org-icalendar-alarm-time 60))) +#+END_SRC + * Programming ** flycheck -- cgit 1.4.1 From ef8d1f6a691227522eb2b69a19b6fba02c955b02 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 19 Feb 2016 11:04:09 +0100 Subject: Emacs: Remove checklist from org-modules It just throws an error --- tag-emacs/emacs.d/init.org | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 4c643c5a..af93a0bd 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1524,7 +1524,6 @@ Org is wünderbar. org-reverse-note-order t org-modules '(org-habit - org-checklist org-protocol) ;; Add time done to ‘done’ tasks -- cgit 1.4.1 From b2ba1b73df5044b461055e078e17378eccf1b25f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 4 Mar 2016 10:31:32 +0100 Subject: Emacs: Fix typo in org-calendar configuration --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index af93a0bd..701a9cbf 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1655,7 +1655,7 @@ write to the Android calendar, and then for DAVDroid to sync with the server. 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-start) + org-icalendar-use-deadline '(event-if-todo event-if-not-todo todo-due) org-icalendar-alarm-time 60))) #+END_SRC -- cgit 1.4.1 From 6ed46d62249d7ada3f1203a6f03d7fa8bc58ae0c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 4 Mar 2016 10:35:32 +0100 Subject: Emacs: Install and configure dired-narrow --- tag-emacs/emacs.d/init.org | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 701a9cbf..280dfa37 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1079,6 +1079,19 @@ Expand subfolders like a tree inside the parent (bind-key "i" #'dired-subtree-toggle dired-mode-map)))) #+END_SRC +** Dired-narrow +One can already use dired with wildcards to browse a filtered +directory listing, but it opens a new buffer. Dired-narrow is a +slightly nicer interface: with a currently-open dired buffer, use =/= +to start filtering, =RET= to complete the filter and =g= to refresh +the buffer, removing the filter. + +#+BEGIN_SRC emacs-lisp + (use-package dired-narrow + :bind (:map dired-mode-map + ("/" . dired-narrow))) +#+END_SRC + * Documentation ** ehelp -- cgit 1.4.1 From 54057e2086a7d7686ebb1343c11f7ee0e7436a15 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 6 Mar 2016 18:23:03 +0100 Subject: Emacs: Load dired-narrow after dired --- tag-emacs/emacs.d/init.org | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 280dfa37..50d35baf 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1087,9 +1087,10 @@ to start filtering, =RET= to complete the filter and =g= to refresh the buffer, removing the filter. #+BEGIN_SRC emacs-lisp - (use-package dired-narrow - :bind (:map dired-mode-map - ("/" . dired-narrow))) + (with-eval-after-load 'dired + (use-package dired-narrow + :bind (:map dired-mode-map + ("/" . dired-narrow)))) #+END_SRC * Documentation -- cgit 1.4.1 From d8a2cd6ba309aaeae238b36c59b61f8968c70333 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 6 Mar 2016 18:23:16 +0100 Subject: Emacs: Ignore .stversions folders in projectile --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 50d35baf..bf1edaf6 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -361,6 +361,7 @@ based upon some folder conventions I use. :init (projectile-global-mode) :diminish projectile-mode :config (progn + (add-to-list 'projectile-globally-ignored-directories ".stversions") (defun ap/subfolder-projects (dir) (--map (file-relative-name it dir) (-filter (lambda (subdir) -- cgit 1.4.1 From 771cb159d960965603c6f0d44e34cb76f611d7d4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 11 Mar 2016 11:27:41 +0100 Subject: Emacs: Fix s-x map on OS X --- tag-emacs/emacs.d/init.org | 105 +++++++++++++++++++++++---------------------- 1 file changed, 53 insertions(+), 52 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 280dfa37..83157690 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -325,6 +325,59 @@ modes. #+END_SRC +* Keybindings + +I think =set-keyboard-coding-system= stops OS X from doing something +annoying to add accents. The modifier setup is to match my +re-arrangement of modifiers on OSX: Cmd on the outside, then +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 '(:function 'alt :mouse 'alt)) + '(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 + (unbind-key "") + (bind-key* "" #'compile) + (bind-key* "" #'kmacro-start-macro-or-insert-counter) + (bind-key* "" #'kmacro-end-or-call-macro) + + (bind-key* "" #'execute-extended-command) + + (unbind-key "C-z") + (bind-key* "C-" #'other-window) + + (bind-key* "C-x C-r" #'revert-buffer) + (bind-key* "C-x C-j" #'delete-indentation) + (unbind-key "C-x C-c") + + (bind-key* "C-c i" #'insert-char) + (bind-key* "M-/" #'hippie-expand) + + (unbind-key "s-h") + (unbind-key "s-n") + (unbind-key "s-p") + (unbind-key "s-w") + (bind-key* "s-k" #'kill-or-delete-this-buffer-dwim) + + (bind-key "C-M-a" #'backward-paragraph text-mode-map) + (bind-key "C-M-e" #'forward-paragraph text-mode-map) + + (bind-key* "s-x" (define-prefix-command 'super-x-map)) + (bind-key* "s-," #'switch-to-dotfiles) + (bind-key* "C-M-x" #'execute-extended-command) + (set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) +#+END_SRC * Projects #+BEGIN_SRC emacs-lisp @@ -1172,58 +1225,6 @@ rather useful. (setq eldoc-idle-delay 0.1) (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) #+END_SRC -* Keybindings - -I think =set-keyboard-coding-system= stops OS X from doing something -annoying to add accents. The modifier setup is to match my -re-arrangement of modifiers on OSX: Cmd on the outside, then -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 '(:function 'alt :mouse 'alt)) - '(mac-control-modifier 'control) - '(mac-right-control-modifier 'left) - '(mac-command-modifier 'super) - '(mac-right-command-modifier 'left) - '(mac-function-modifier 'hyper))) -#+END_SRC - -#+BEGIN_SRC emacs-lisp - (unbind-key "") - (bind-key* "" #'compile) - (bind-key* "" #'kmacro-start-macro-or-insert-counter) - (bind-key* "" #'kmacro-end-or-call-macro) - - (bind-key* "" #'execute-extended-command) - - (unbind-key "C-z") - (bind-key* "C-" #'other-window) - - (bind-key* "C-x C-r" #'revert-buffer) - (bind-key* "C-x C-j" #'delete-indentation) - (unbind-key "C-x C-c") - - (bind-key* "C-c i" #'insert-char) - (bind-key* "M-/" #'hippie-expand) - - (unbind-key "s-h") - (unbind-key "s-n") - (unbind-key "s-p") - (unbind-key "s-w") - (bind-key* "s-k" #'kill-or-delete-this-buffer-dwim) - - (bind-key "C-M-a" #'backward-paragraph text-mode-map) - (bind-key "C-M-e" #'forward-paragraph text-mode-map) - - (bind-key* "s-x" (define-prefix-command 'super-x-map)) - (bind-key* "s-," #'switch-to-dotfiles) - (bind-key* "C-M-x" #'execute-extended-command) - (set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) -#+END_SRC * Misc #+BEGIN_SRC emacs-lisp -- cgit 1.4.1 From 74a696ac9835cd802628a49fbfc4f8cf333432ea Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 11 Mar 2016 11:28:05 +0100 Subject: Emacs: Fix dired-narrow load error --- tag-emacs/emacs.d/init.org | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 83157690..4bbac2de 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1140,9 +1140,10 @@ to start filtering, =RET= to complete the filter and =g= to refresh the buffer, removing the filter. #+BEGIN_SRC emacs-lisp - (use-package dired-narrow - :bind (:map dired-mode-map - ("/" . dired-narrow))) + (with-eval-after-load 'dired + (use-package dired-narrow + :bind (:map dired-mode-map + ("/" . dired-narrow)))) #+END_SRC * Documentation -- cgit 1.4.1 From 2d5404163d81e49255bc6f9b713440021c1cf872 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 14 Mar 2016 16:23:50 +0100 Subject: Emacs: Switch font to Source Code Pro --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index b9ae3ec1..036bfb26 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -181,7 +181,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource ((eq window-system 'w32) (ap/set-fonts "Consolas" 10 "Segoe UI" 11)) ((eq system-type 'darwin) - (ap/set-fonts "Input Mono" 14 "Input Sans" 14)))) + (ap/set-fonts "Source Code Pro" 14 "Input Sans" 14)))) #+END_SRC Allow font-lock-mode to do background parsing. I’m not really sure if -- cgit 1.4.1 From e84a3c8f9b949a4a19944d17b9d18980906849bb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 14 Mar 2016 16:24:06 +0100 Subject: Emacs: Install projectile-direnv --- tag-emacs/emacs.d/init.org | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 036bfb26..a87a2ddc 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -447,6 +447,14 @@ based upon some folder conventions I use. projectile-completion-system 'ivy))) #+END_SRC +I use [[https://github.com/direnv/direnv][direnv]] to automatically assign environment variables in project +directories. Now I can have them set inside emacs too. + +#+BEGIN_SRC emacs-lisp + (use-package projectile-direnv + :config (add-hook 'projectile-mode-hook #'projectile-direnv-export-variables)) +#+END_SRC + ** perspective This package makes buffer-switching inside of projects make sense, by -- cgit 1.4.1 From f18d9e1910b925eea3e67466ccd519bfce8e9936 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 16 Mar 2016 10:45:40 +0100 Subject: Emacs: Disable smartparens pair overlays They seem quite buggy, especially with multiple cursors and aren’t really necessary --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index a87a2ddc..2ce7be0f 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2381,6 +2381,7 @@ nice as the real version :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) -- cgit 1.4.1 From 351c19a861ce2c80bde77b851db56697083a5c1b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 16 Mar 2016 14:35:20 +0100 Subject: Emacs: Try minimal-theme --- tag-emacs/emacs.d/init.org | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 2ce7be0f..585adec7 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -125,14 +125,12 @@ lot of modes. (load-theme 'solarized-light t))) #+END_SRC -Let’s try spacemacs-light for a while. +Let’s try a more minimal theme. #+BEGIN_SRC emacs-lisp - (use-package spacemacs-common - :ensure spacemacs-theme + (use-package minimal-theme :config (progn - (setq spacemacs-theme-org-highlight t) - (load-theme 'spacemacs-light t))) + (load-theme 'minimal-light t))) #+END_SRC Colourise colour names in certain types of buffer. I don’t use this -- cgit 1.4.1 From 17f740e722b2f4fff978fc4937ded87fb2bc57a1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 16 Mar 2016 16:28:17 +0100 Subject: Emacs: Reduce font locking --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 585adec7..18c1270c 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -190,7 +190,7 @@ these settings are particularly useful jit-lock-chunk-size 300 jit-lock-defer-time nil font-lock-maximum-decoration '((dired-mode . 1) - (t . t))) + (t . 1))) #+END_SRC ** Page Breaks -- cgit 1.4.1 From 148e754c3ea0ade3a7fb8a507ef4c5089986ed26 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 16 Mar 2016 16:28:40 +0100 Subject: Emacs: Re-enable jit locking --- tag-emacs/emacs.d/init.org | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 18c1270c..5655e63a 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -185,10 +185,10 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource Allow font-lock-mode to do background parsing. I’m not really sure if these settings are particularly useful #+BEGIN_SRC emacs-lisp - (setq jit-lock-stealth-time nil + (setq jit-lock-stealth-time 2 jit-lock-stealth-load 100 - jit-lock-chunk-size 300 - jit-lock-defer-time nil + jit-lock-chunk-size 1000 + jit-lock-defer-time 1 font-lock-maximum-decoration '((dired-mode . 1) (t . 1))) #+END_SRC -- cgit 1.4.1 From 425113d5ee191c851d96117a03553407a3dbdd55 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 16 Mar 2016 19:20:39 +0100 Subject: Emacs: Remove header line --- tag-emacs/emacs.d/init.org | 89 +--------------------------------------------- 1 file changed, 1 insertion(+), 88 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 5655e63a..466fc7c8 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -204,97 +204,10 @@ By default, Emacs displays page breaks as ^L. Lines look much nicer. #+END_SRC ** Modeline -I modified the mode-line format to show me less information. Instead, -I put some of it in the frame-line at the top. - #+BEGIN_SRC emacs-lisp (column-number-mode t) (size-indication-mode t) - (defun fill-line-format (line-format) - (max 0 - (- (window-width) - (length (format-mode-line line-format))))) - - (defvar mode-line-size - `((size-indication-mode - ((-3 ,(propertize - "%p" - 'local-map mode-line-column-line-number-mode-map - 'mouse-face 'mode-line-highlight - ;; XXX needs better description - 'help-echo "Size indication mode\n\ - mouse-1: Display Line and Column Mode Menu")) - " " - (-4 "%I"))))) - - (setq-default - mode-line-modes (let ((recursive-edit-help-echo "Recursive edit, type C-M-c to get out")) - (list (propertize "%[" 'help-echo recursive-edit-help-echo) - `(:propertize ("" mode-name) - help-echo "Major mode\n\ - mouse-1: Display major mode menu\n\ - mouse-2: Show help for major mode\n\ - mouse-3: Toggle minor modes" - mouse-face mode-line-highlight - local-map ,mode-line-major-mode-keymap) - '("" mode-line-process) - `(:propertize ("" minor-mode-alist) - mouse-face mode-line-highlight - help-echo "Minor mode\n\ - mouse-1: Display minor mode menu\n\ - mouse-2: Show help for minor mode\n\ - mouse-3: Toggle minor modes" - local-map ,mode-line-minor-mode-keymap) - (propertize "%n" 'help-echo "mouse-2: Remove narrowing from buffer" - 'mouse-face 'mode-line-highlight - 'local-map (make-mode-line-mouse-map - 'mouse-2 #'mode-line-widen)) - (propertize "%]" 'help-echo recursive-edit-help-echo) - " ")) - mode-line-buffer-identification (list (propertize "%b" - 'face 'mode-line-buffer-id)) - - mode-line-position `((line-number-mode - ((column-number-mode - ,(propertize - "%l:%c" - 'local-map mode-line-column-line-number-mode-map - 'mouse-face 'mode-line-highlight - 'help-echo "Line number and Column number\n\ - mouse-1: Display Line and Column Mode Menu") - (6 ,(propertize - "L%l" - 'local-map mode-line-column-line-number-mode-map - 'mouse-face 'mode-line-highlight - 'help-echo "Line Number\n\ - mouse-1: Display Line and Column Mode Menu")))) - ((column-number-mode - (5 ,(propertize - "C%c" - 'local-map mode-line-column-line-number-mode-map - 'mouse-face 'mode-line-highlight - 'help-echo "Column number\n\ - mouse-1: Display Line and Column Mode Menu")))))) - mode-line-format `("%e" - " " - mode-line-modes - mode-line-misc-info - (vc-mode vc-mode) - mode-line-end-spaces) - header-line-format `("%e" - mode-line-front-space - mode-line-mule-info - mode-line-client - mode-line-modified - mode-line-auto-compile - mode-line-remote " " - mode-line-position " " - mode-line-size - " ⎸ " - mode-line-buffer-identification - )) - (setq frame-title-format '("%f" (dired-directory dired-directory))) #+END_SRC @@ -463,7 +376,7 @@ it needs hooking into projectile and a key bound to switch between projects. (use-package perspective :bind* ("s-p" . persp-switch) :init (progn - (setq persp-show-modestring 'header) + (setq persp-show-modestring t) (persp-mode))) (use-package persp-projectile -- cgit 1.4.1 From 85d697bae86ac530ef197e9987465aeba89e0708 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 16 Mar 2016 22:16:13 +0100 Subject: Emacs: Reduce modeline noise --- tag-emacs/emacs.d/init.org | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 466fc7c8..f87bcc8f 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -200,6 +200,7 @@ By default, Emacs displays page breaks as ^L. Lines look much nicer. #+BEGIN_SRC emacs-lisp (use-package page-break-lines :defer 5 + :diminish page-break-lines-mode :config (global-page-break-lines-mode)) #+END_SRC ** Modeline @@ -472,6 +473,7 @@ trash for deleting on OS X. #+BEGIN_SRC emacs-lisp (use-package autorevert + :diminish auto-revert-mode :init (progn (global-auto-revert-mode 1) (setq auto-revert-verbose nil @@ -555,11 +557,12 @@ I don’t like it when editors change an entire file’s layout when I open it. Whitespace butler fixes whitespace only for lines that I’m editing. #+BEGIN_SRC emacs-lisp -(use-package ws-butler - :if window-system - :config (ws-butler-global-mode 1)) -(if (daemonp) - (add-hook 'before-make-frame-hook (lambda () (ws-butler-global-mode 1)))) + (use-package ws-butler + :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)))) #+END_SRC ** shrink-whitespace @@ -1232,6 +1235,7 @@ replace helm and ido. ("C-c C-r" . ivy-resume) ("C-x i" . ivy-imenu-goto) ("C-=" . swiper)) + :diminish ivy-mode :config (progn (setq ivy-use-virtual-buffers t ivy-re-builders-alist '((internal-complete-buffer . ivy--regex-fuzzy) @@ -2176,8 +2180,9 @@ symbol, not word, as I need this for programming the most." Sub-word movement is really nice for camel- and Pascal-case #+BEGIN_SRC emacs-lisp -(use-package subword - :init (global-subword-mode t)) + (use-package subword + :diminish subword-mode + :init (global-subword-mode t)) #+END_SRC I find that =zap-up-to-char= normally makes more sense to me than -- cgit 1.4.1 From b8d9a1b41445af20d2f5c6d8d5db04f040de3a77 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 17 Mar 2016 12:16:45 +0100 Subject: Emacs: Remove osx-location. I probably won’t be travelling with my Macbook often… --- tag-emacs/emacs.d/init.org | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 466fc7c8..10d80c12 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -964,21 +964,6 @@ Sometimes I want to insert a date or time into a buffer. (timer-relative-time (current-time) -86400)) #+END_SRC -** Time of Day - -#+BEGIN_SRC emacs-lisp - (use-package osx-location - :if (eq system-type 'darwin) - :config (progn - (add-hook 'osx-location-changed-hook - (lambda () - (setq calendar-latitude osx-location-latitude - calendar-longitude osx-location-longitude) - (when (boundp 'calendar-location-name) - calendar-location-name (format "%s, %s" osx-location-latitude osx-location-longitude)))) - (osx-location-watch))) -#+END_SRC - * Directories Dired works quite nicely, but not always in the way I want. I don’t -- cgit 1.4.1 From 4e89ea1bbfdd8d9d0d4c55e8439c20e0d19d4415 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 17 Mar 2016 14:16:08 +0100 Subject: Emacs: Improve tangling --- tag-emacs/emacs.d/init.org | 54 +++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index fb6eec6c..ccf726a5 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2369,44 +2369,40 @@ the =org=-document after changes. :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." + + (when (string-suffix-p "init.org" (buffer-file-name)) + (tangle-init))) + (defun tangle-init-sync () (interactive) - (when (string-suffix-p "init.org" (buffer-file-name)) - (message "Tangling init") - ;; Avoid running hooks when tangling. - (let ((prog-mode-hook nil) - (dest (expand-file-name "init.el" user-emacs-directory))) - (require 'ob-tangle) - (org-babel-tangle-file (buffer-file-name) dest) - (if (byte-compile-file dest) - (byte-compile-dest-file dest) - (with-current-buffer byte-compile-log-buffer - (buffer-string)))))) + (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 () - "If the current buffer is 'init.org' the code-blocks are - tangled, and the tangled file is compiled." + "Tangle init.org asynchronously." (interactive) - (when (string-suffix-p "init.org" (buffer-file-name)) - (message "Tangling init") - (async-start - `(lambda () - ;; Avoid running hooks when tangling. - (let ((prog-mode-hook nil) - (dest (expand-file-name "init.el" user-emacs-directory))) - (require 'ob-tangle) - (org-babel-tangle-file ,(buffer-file-name) dest) - (if (byte-compile-file dest) - (byte-compile-dest-file dest) - (with-current-buffer byte-compile-log-buffer - (buffer-string))))) - (lambda (result) - (message "Init tangling completed: %s" result))))) + (message "Tangling init") + (async-start + (symbol-function #'tangle-init-sync) + (lambda (result) + (message "Init tangling completed: %s" result)))) #+END_SRC # Local Variables: -# eval: (when (fboundp #'tangle-init) (add-hook 'after-save-hook #'tangle-init)) +# eval: (when (fboundp #'tangle-if-init) (add-hook 'after-save-hook #'tangle-if-init)) # End: * End -- cgit 1.4.1 From 5b5f0d195a04289301848a8ff454185b80b5948b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 17 Mar 2016 14:25:30 +0100 Subject: Emacs: Remove isearch configuration --- tag-emacs/emacs.d/init.org | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index ccf726a5..aa4cb293 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2142,26 +2142,6 @@ a mode for that. (delete-selection-mode t) #+END_SRC -Isearch has a keybind for searching for the currently-selected word. - I often want to use a symbol though, so this comes in handy. [[http://blog.jorgenschaefer.de/2012/11/emacs-search-for-symbol-at-point.html][Source]] - -#+BEGIN_SRC emacs-lisp -(defun fc/isearch-yank-symbol () - "Yank the symbol at point into the isearch minibuffer. - -C-w does something similar in isearch, but it only looks for -the rest of the word. I want to look for the whole string. And -symbol, not word, as I need this for programming the most." - (interactive) - (isearch-yank-string - (save-excursion - (when (and (not isearch-forward) - isearch-other-end) - (goto-char isearch-other-end)) - (thing-at-point 'symbol)))) -(bind-key "C-d" #'fc/isearch-yank-symbol isearch-mode-map) -#+END_SRC - Sub-word movement is really nice for camel- and Pascal-case #+BEGIN_SRC emacs-lisp -- cgit 1.4.1 From f26e3f7432eda8b1f1fb3f2830015a735aeea6eb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 18 Mar 2016 11:20:30 +0100 Subject: Emacs: Remove dash font-locking --- tag-emacs/emacs.d/init.org | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index aa4cb293..98f747d4 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -103,13 +103,8 @@ Ring the bell sometimes, but not so often (ding)))) #+END_SRC -When I’m using dash in emacs lisp, it’s nice to have proper font -locking for it. #+BEGIN_SRC emacs-lisp - (use-package dash - :commands (dash-enable-font-lock) - :init (progn - (add-hook 'emacs-lisp-mode-hook #'dash-enable-font-lock))) + (use-package dash) #+END_SRC ** Colours -- cgit 1.4.1 From e5432252a661b33deaa7715bfdac26bb2d36592a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 24 Mar 2016 14:20:53 +0100 Subject: Emacs: Don’t fontify org-src blocks --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 98f747d4..48698f8f 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1459,7 +1459,7 @@ Org is wünderbar. org-table-duration-custom-format 'seconds - org-src-fontify-natively t + org-src-fontify-natively nil org-export-have-math t -- cgit 1.4.1 From f351ba6a97f5940af2b4de48f17f31c008d7c911 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 24 Mar 2016 14:21:09 +0100 Subject: Emacs: Make current budget show amount budgeted --- tag-emacs/emacs.d/init.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 48698f8f..e30291c0 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1401,8 +1401,8 @@ works really nicely. ("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 (Current Month)" "ledger -f %(ledger-file) bal --current \\^Funds") - ("Budget (All)" "ledger -f %(ledger-file) bal \\^Funds") + ("Budget Values (Current Month)" "ledger -f %(ledger-file) bal -p \"this month\" --limit \"payee=~/budget/\"") + ("Budget (Cumulative)" "ledger -f %(ledger-file) bal \\^Funds") ("bal" "ledger -f %(ledger-file) bal") ("reg" "ledger -f %(ledger-file) reg") ("equity" "ledger -f %(ledger-file) equity") -- cgit 1.4.1 From 3af4144817cde07e4eff1e9c1ba1bbf89cb071e6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 24 Mar 2016 23:09:41 +0100 Subject: Emacs: Improve small screen window-splitting --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index e30291c0..5f5b2958 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -842,6 +842,7 @@ point whilst I’m moving about. scroll-preserve-screen-position t mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control))) split-height-threshold 100 + split-width-threshold 120 frame-resize-pixelwise t) (if (boundp 'ns-pop-up-frames) (setq ns-pop-up-frames nil)) -- cgit 1.4.1 From 94fa9d4f837d1363bf4aaa0f2afb5fbc9a91b81f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 24 Mar 2016 23:10:13 +0100 Subject: Emacs: Remove toggle-window-dedicated I don’t think I ever used it --- tag-emacs/emacs.d/init.org | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 5f5b2958..a38eede0 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -848,22 +848,6 @@ point whilst I’m moving about. (setq ns-pop-up-frames nil)) #+END_SRC -A dedicated window always keeps the same buffer in view. - -#+BEGIN_SRC emacs-lisp -(defun toggle-window-dedicated () - "Toggle whether the current active window is dedicated or not" - (interactive) - (message - "Window '%s' is %s" - (current-buffer) - (if (let ((window (get-buffer-window (current-buffer)))) - (set-window-dedicated-p window - (not (window-dedicated-p window)))) - "dedicated" - "normal"))) -#+END_SRC - ** winner Undo, for window-based commands. -- cgit 1.4.1 From ce50593b3cc4898915c260aaf356adf533868e67 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 24 Mar 2016 23:11:44 +0100 Subject: Emacs: Simplify paredit eval-expression setup --- tag-emacs/emacs.d/init.org | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index a38eede0..395ff53d 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2216,18 +2216,14 @@ Balanced parentheses in lisps are nice, but all the refactoring and movement commands are much more interesting. #+BEGIN_SRC emacs-lisp -(use-package paredit - :diminish "()" - :commands (paredit-mode) - :init (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 'minibuffer-setup-hook #'conditionally-enable-paredit-mode) - (defun conditionally-enable-paredit-mode () - "enable paredit-mode during eval-expression" - (if (eq this-command 'eval-expression) - (paredit-mode 1))))) + (use-package paredit + :diminish "()" + :commands (paredit-mode) + :init (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 -- cgit 1.4.1 From d94444b4f684589b8388cfb451b879bb5df1d55a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 29 Mar 2016 14:25:15 +0200 Subject: Emacs: Add Budget Allocation ledger report --- tag-emacs/emacs.d/init.org | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index e30291c0..b27c54a0 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1401,8 +1401,12 @@ works really nicely. ("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/\"") + ("Budget Values (Current Month)" "ledger -f %(ledger-file) bal -p \"this month\" --limit \"payee=~/budget/\" \\^Funds") ("Budget (Cumulative)" "ledger -f %(ledger-file) bal \\^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") -- cgit 1.4.1 From eee6d1262257bab149a43a06e43ce2abd059d4ce Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 30 Mar 2016 11:00:47 +0200 Subject: Emacs: Fix first startup errors --- tag-emacs/emacs.d/init.org | 82 ++++++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 6716c577..c617d400 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -318,9 +318,10 @@ based upon some folder conventions I use. ("s-x s-f" . projectile-find-file) ("C-x g" . projectile-vc) ("s-G" . projectile-vc)) - :init (projectile-global-mode) + :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) @@ -371,12 +372,13 @@ it needs hooking into projectile and a key bound to switch between projects. #+BEGIN_SRC emacs-lisp (use-package perspective :bind* ("s-p" . persp-switch) - :init (progn - (setq persp-show-modestring t) - (persp-mode))) + :demand t + :config (progn + (setq persp-show-modestring t) + (persp-mode))) (use-package persp-projectile - :ensure nil) + :ensure t) #+END_SRC ** vc @@ -404,7 +406,10 @@ changed. This package colours the fringe (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))) + (add-hook 'magit-post-refresh-hook #'diff-hl-magit-post-refresh) + (add-hook 'magit-refresh-buffer-hook (lambda () + (message "test: %s" (buffer-file-name)) + (buffer-file-name))))) #+END_SRC ** magit @@ -700,6 +705,9 @@ with spaces. Perfect! (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)) @@ -720,11 +728,7 @@ with spaces. Perfect! indent-relative-maybe)) (setq indent-tabs-mode nil)) ad-do-it) - ad-do-it)))) - :init (progn - (smart-tabs-insinuate 'c 'cperl 'javascript 'python) - (add-hook 'php-mode-hook (lambda () - (smart-tabs-mode indent-tabs-mode))))) + ad-do-it))))) #+END_SRC ** dtrt-indent-mode @@ -734,8 +738,8 @@ guesses the correct settings for me. #+BEGIN_SRC emacs-lisp (use-package dtrt-indent - :init (dtrt-indent-mode 1) :config (progn + (dtrt-indent-mode 1) (defadvice dtrt-indent-try-set-offset (after toggle-smart-tabs activate) (smart-tabs-mode (or indent-tabs-mode -1))))) #+END_SRC @@ -1201,7 +1205,9 @@ replace helm and ido. ("C-x i" . ivy-imenu-goto) ("C-=" . swiper)) :diminish ivy-mode + :demand t :config (progn + (ivy-mode 1) (setq ivy-use-virtual-buffers t ivy-re-builders-alist '((internal-complete-buffer . ivy--regex-fuzzy) (t . ivy--regex-plus))) @@ -1231,22 +1237,20 @@ replace helm and ido. (kill-buffer x) (ivy--reset-state ivy-last)) "kill"))) - (add-to-list 'ivy-initial-inputs-alist '(counsel-M-x . ""))) - :init (progn - (ivy-mode 1))) + (add-to-list 'ivy-initial-inputs-alist '(counsel-M-x . "")))) #+END_SRC ** counsel #+BEGIN_SRC emacs-lisp (use-package counsel - :bind (("M-x" . counsel-M-x) - ("" . counsel-M-x) - ("" . counsel-M-x) - ("C-c M-x" . execute-extended-command) - ("C-x C-f" . counsel-find-file) - ("C-x b" . counsel-switch-to-persp-buffer)) :config (progn + (bind-key "M-x" #'counsel-M-x) + (bind-key "" #'counsel-M-x) + (bind-key "" #'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 @@ -1649,11 +1653,11 @@ Lisp syntax allows for really easy refactoring. Redshank gives some operations that aren’t part of paredit, like extracting variables into let bindings. #+BEGIN_SRC emacs-lisp -(use-package redshank - :diminish " Λ" - :defer t - :init (progn - (add-hook 'lisp-mode-common-hook #'turn-on-redshank-mode))) + (use-package redshank + :diminish " Λ" + :after (paredit) + :config (progn + (add-hook 'lisp-mode-common-hook #'turn-on-redshank-mode))) #+END_SRC *** Emacs Lisp @@ -2161,13 +2165,12 @@ type them. (use-package typo :config (progn (typo-global-mode 1) - (typo-change-language "English")) - :init (progn - (add-hook 'text-mode-hook #'typo-mode) - (defun typo-mode-turn-off () - (typo-mode -1)) - (add-hook 'yaml-mode-hook #'turn-off-typo-mode) - (add-hook 'jinja2-mode-hook #'turn-off-typo-mode))) + (typo-change-language "English") + (add-hook 'text-mode-hook #'typo-mode) + (defun typo-mode-turn-off () + (typo-mode -1)) + (add-hook 'yaml-mode-hook #'turn-off-typo-mode) + (add-hook 'jinja2-mode-hook #'turn-off-typo-mode))) #+END_SRC ** avy @@ -2222,12 +2225,11 @@ movement commands are much more interesting. #+BEGIN_SRC emacs-lisp (use-package paredit :diminish "()" - :commands (paredit-mode) - :init (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))) + :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 @@ -2237,7 +2239,7 @@ I didn’t find smartparens’ implementation of paredit style to be as nice as the real version #+BEGIN_SRC emacs-lisp - (eval-when-compile (require 'smartparens)) + (eval-when-compile (require 'smartparens nil :noerror)) (use-package smartparens-config :ensure smartparens :config (progn -- cgit 1.4.1 From dd9125cec6325d814cd94c0362873dc173e4d6ac Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 17 Apr 2016 17:26:56 +0200 Subject: Remove deferred and stealth fontification --- tag-emacs/emacs.d/init.org | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 6716c577..a8fa691a 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -177,14 +177,10 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (ap/set-fonts "Source Code Pro" 14 "Input Sans" 14)))) #+END_SRC -Allow font-lock-mode to do background parsing. I’m not really sure if -these settings are particularly useful -#+BEGIN_SRC emacs-lisp - (setq jit-lock-stealth-time 2 - jit-lock-stealth-load 100 - jit-lock-chunk-size 1000 - jit-lock-defer-time 1 - font-lock-maximum-decoration '((dired-mode . 1) +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))) #+END_SRC -- cgit 1.4.1 From c7956638db01c5e1fcd2530637ac6ab28dada54d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 26 Apr 2016 13:04:14 +0200 Subject: Emacs: Use :config more --- tag-emacs/emacs.d/init.org | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index a8fa691a..739180b6 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -140,11 +140,10 @@ in modes for webdev because [[web-mode]] includes that functionality. Highlighting quasi-quoted expressions in lisps is quite useful. #+BEGIN_SRC emacs-lisp -(use-package highlight-stages - :defer t - :diminish highlight-stages-mode - :init (progn - (add-hook 'lisp-mode-common-hook #'highlight-stages-mode))) + (use-package highlight-stages + :diminish highlight-stages-mode + :config (progn + (add-hook 'lisp-mode-common-hook #'highlight-stages-mode))) #+END_SRC ** Fonts @@ -314,9 +313,9 @@ based upon some folder conventions I use. ("s-x s-f" . projectile-find-file) ("C-x g" . projectile-vc) ("s-G" . projectile-vc)) - :init (projectile-global-mode) :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) @@ -2218,12 +2217,11 @@ movement commands are much more interesting. #+BEGIN_SRC emacs-lisp (use-package paredit :diminish "()" - :commands (paredit-mode) - :init (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))) + :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 -- cgit 1.4.1 From 441224ff2e7e10c8e6e393b0d0cf2c9b76b660bf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 29 Apr 2016 11:01:54 +0200 Subject: Emacs: Add avy-goto-word binding --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index c617d400..1059b688 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2183,6 +2183,7 @@ somehow I prefer it. :bind* (("M-g g" . avy-goto-line) ("M-g M-g" . avy-goto-line) ("C-|" . avy-goto-line) + ("M-s" . avy-goto-word-1) ("C-c SPC" . avy-goto-char-timer)) :config (progn (avy-setup-default) -- cgit 1.4.1 From ca551892f1491f46de7fca055b97fcce90aa5bfa Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 29 Apr 2016 11:02:16 +0200 Subject: Emacs: Remove JIT/deferred font-locking --- tag-emacs/emacs.d/init.org | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 1059b688..4c0f22e4 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -177,14 +177,10 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (ap/set-fonts "Source Code Pro" 14 "Input Sans" 14)))) #+END_SRC -Allow font-lock-mode to do background parsing. I’m not really sure if -these settings are particularly useful -#+BEGIN_SRC emacs-lisp - (setq jit-lock-stealth-time 2 - jit-lock-stealth-load 100 - jit-lock-chunk-size 1000 - jit-lock-defer-time 1 - font-lock-maximum-decoration '((dired-mode . 1) +Reduce font locking in dired mode in particular. I might want to +re-increase it in other places, but in dired the maximum is too high +#+BEGIN_SRC emacs-lisp + (setq font-lock-maximum-decoration '((dired-mode . 1) (t . 1))) #+END_SRC -- cgit 1.4.1 From 162e80938621369086d6691bc5a4bd35024433a1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 29 Apr 2016 11:02:31 +0200 Subject: Emacs: Setup editorconfig again --- tag-emacs/emacs.d/init.org | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 4c0f22e4..8e12d7c0 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -727,6 +727,13 @@ with spaces. Perfect! ad-do-it))))) #+END_SRC +** editorconfig + +#+BEGIN_SRC emacs-lisp + (use-package editorconfig + :config (editorconfig-mode 1)) +#+END_SRC + ** dtrt-indent-mode Sometimes people use different indentation settings. [[https://github.com/jscheid/dtrt-indent][dtrt-indent]] -- cgit 1.4.1 From c10711346f2fd2625a367e46d6818d9979420d63 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 29 Apr 2016 14:50:21 +0200 Subject: Remove useless hook --- tag-emacs/emacs.d/init.org | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 452a7347..320c6015 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -401,10 +401,7 @@ changed. This package colours the fringe (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) - (add-hook 'magit-refresh-buffer-hook (lambda () - (message "test: %s" (buffer-file-name)) - (buffer-file-name))))) + (add-hook 'magit-post-refresh-hook #'diff-hl-magit-post-refresh))) #+END_SRC ** magit -- cgit 1.4.1 From e2bdfce5385f6c4fecb4a705064cae344df7c248 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 29 Apr 2016 15:37:37 +0200 Subject: Emacs: Don’t configure save-place --- tag-emacs/emacs.d/init.org | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 320c6015..ba176300 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -589,17 +589,6 @@ An awesome way to open files on OS X. :config (setq spotlight-tmp-file "/tmp/.emacs-spotlight-tmp-file")) #+END_SRC -** saveplace - -It.. saves the position I visited a file at last. Might try turning -it off to see if I notice it. - -#+BEGIN_SRC emacs-lisp -(use-package saveplace - :config (progn (setq-default save-place nil) - (setq save-place-file (expand-file-name ".saveplace" user-emacs-directory)))) -#+END_SRC - ** Tramp Tramp is awesome. It makes SSH feel Unix-y. The proxy setup is so -- cgit 1.4.1 From 664350b7ac450e80d58507b6a178231047896de2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 29 Apr 2016 15:56:17 +0200 Subject: Emacs: Don’t guess indentation with editorconfig --- tag-emacs/emacs.d/init.org | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index ba176300..9e6b3189 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -728,6 +728,8 @@ guesses the correct settings for me. (use-package dtrt-indent :config (progn (dtrt-indent-mode 1) + (add-hook 'editorconfig-custom-hooks (lambda () + (dtrt-indent-undo))) (defadvice dtrt-indent-try-set-offset (after toggle-smart-tabs activate) (smart-tabs-mode (or indent-tabs-mode -1))))) #+END_SRC -- cgit 1.4.1 From c7a09150f06f60ee8be583437a145dff25ee48c2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 3 May 2016 15:51:14 +0200 Subject: Emacs: Open scripts with node shebang in js2-mode --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 9e6b3189..79036576 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1821,6 +1821,7 @@ it though (use-package js2-mode :mode (("\\.js\\'" . js2-mode) ("\\.jsx\\'" . js2-jsx-mode)) + :interpreter ("node" . js2-mode) :functions js2-next-error :config (progn (defun ap/javascript-setup () -- cgit 1.4.1 From 124df1cd0d339ae3e8fb164e5b7b0450b5b3a6d4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 3 May 2016 15:58:18 +0200 Subject: Emacs: Skip shebangs in js2-mode --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 79036576..e933719f 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1824,6 +1824,7 @@ it though :interpreter ("node" . js2-mode) :functions js2-next-error :config (progn + (setq js2-skip-preprocessor-directives t) (defun ap/javascript-setup () (auto-indent-mode -1)) (defun ap/js2-prev-error () -- cgit 1.4.1 From 8145d2218634ccb212fadb2fe00be11795b25a72 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 4 May 2016 11:51:25 +0200 Subject: Emacs: Enable tern in web-mode --- 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 e933719f..695fef92 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1859,7 +1859,8 @@ completions, besides other IDE-like things. (setq tern-command (list (executable-find "tern"))) (defun ap/enable-tern () (tern-mode 1)) - (add-hook 'js2-mode-hook #'ap/enable-tern))) + (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)) -- cgit 1.4.1 From 2ae305459c747e70e39b23af4f92e9faf398126d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 6 May 2016 12:51:34 +0200 Subject: Install volatile-highlights-mode --- tag-emacs/emacs.d/init.org | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 695fef92..b9518d34 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -203,6 +203,17 @@ By default, Emacs displays page breaks as ^L. Lines look much nicer. '("%f" (dired-directory dired-directory))) #+END_SRC +** Highlight Changes + +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))) +#+END_SRC + ** Renaming major modes Diminishing major modes does not happen in the same manner as minor -- cgit 1.4.1 From daeb01f134721b5a6b75c5578ed7cf5309727d02 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 6 May 2016 12:51:50 +0200 Subject: Emacs: Make dtrt and editorconfig play together --- tag-emacs/emacs.d/init.org | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index b9518d34..65a1c437 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -738,9 +738,12 @@ guesses the correct settings for me. #+BEGIN_SRC emacs-lisp (use-package dtrt-indent :config (progn - (dtrt-indent-mode 1) - (add-hook 'editorconfig-custom-hooks (lambda () - (dtrt-indent-undo))) + (defun ap/dtrt-adapt-if-needed () + (unless editorconfig-mode + (dtrt-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 -- cgit 1.4.1 From 2641165a32b4fb77257e9e8e37c1bd44e1ad919f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 9 May 2016 14:27:12 +0200 Subject: Emacs: Remove projectile-direnv --- tag-emacs/emacs.d/init.org | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 65a1c437..85a7df38 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -361,14 +361,6 @@ based upon some folder conventions I use. projectile-completion-system 'ivy))) #+END_SRC -I use [[https://github.com/direnv/direnv][direnv]] to automatically assign environment variables in project -directories. Now I can have them set inside emacs too. - -#+BEGIN_SRC emacs-lisp - (use-package projectile-direnv - :config (add-hook 'projectile-mode-hook #'projectile-direnv-export-variables)) -#+END_SRC - ** perspective This package makes buffer-switching inside of projects make sense, by -- cgit 1.4.1 From e63cfd0ddf6ada99bec0aca50c9d5be84a69f23b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 9 May 2016 14:28:49 +0200 Subject: Emacs: Remove unused functions --- tag-emacs/emacs.d/init.org | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 85a7df38..14e700ec 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -336,14 +336,7 @@ based upon some folder conventions I use. projectile-project-root-files-functions)) (-filter #'file-directory-p (directory-files dir t "\\<"))))) - (defun ap/-add-known-subfolder-projects (dir) - (-map #'projectile-add-known-project (--map (concat (file-name-as-directory dir) it) (ap/subfolder-projects dir)))) - - (defun ap/add-known-subfolder-projects () - (interactive) - (ap/-add-known-subfolder-projects (read-directory-name "Add projects under: "))) - - (defun ap/open-subfolder-project (from-dir &optional arg) + (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))) -- cgit 1.4.1 From c870a66b1b9f6ea4c4c933e36367ebc31fe86196 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 9 May 2016 14:31:01 +0200 Subject: Emacs: Remove todos --- tag-emacs/emacs.d/init.org | 3 --- 1 file changed, 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 14e700ec..08145111 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1980,7 +1980,6 @@ good for embedded SQL though. :init (setq mmm-global-mode 'maybe)) #+END_SRC -**** TODO Setup for javascript + SQL * Spelling #+BEGIN_SRC emacs-lisp @@ -1991,8 +1990,6 @@ good for embedded SQL though. ispell-dictionary "british"))) #+END_SRC -*** TODO Set up some functions to switch between en-GB and de-DE - * Scripting Make a shell-script buffer executable after saving it, if it has a shebang. -- cgit 1.4.1 From c093c25d34a12f2f41dd5aa08435475c0451225b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 9 May 2016 14:31:26 +0200 Subject: Emacs: Remove mmm-mode --- tag-emacs/emacs.d/init.org | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 08145111..09de07d5 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1941,45 +1941,6 @@ I derived a mode for twig, in order to use its =mode-hook=. (add-to-list 'auto-mode-alist '("\\.html\\.twig\\'" . twig-mode)) #+END_SRC -*** mmm-mode - -With =web-mode= being so good, I don’t really use this much. It’s -good for embedded SQL though. - -#+BEGIN_SRC emacs-lisp - (use-package mmm-auto - :ensure mmm-mode - :defer 20 - :config (progn - (mmm-add-classes - '((php-sql - :submode sql-mode - :front "<<") :init (progn - (if (functionp 'web-mode) - (add-hook 'web-mode-hook #'emmet-mode)))) + (add-hook 'web-mode-hook #'emmet-mode))) #+END_SRC *** web-mode -- cgit 1.4.1 From 9e5c9b5d4a768679640c85f7b3a05f61a912b3fb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 9 May 2016 14:33:19 +0200 Subject: Emacs: Open tern-project files in json-mode --- 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 d539b8a0..88eb9d23 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1871,7 +1871,8 @@ completions, besides other IDE-like things. (use-package json-mode :mode (("\\.json\\'" . json-mode) ("\\.sailsrc\\'" . json-mode) - ("composer\\.lock\\'" . json-mode))) + ("composer\\.lock\\'" . json-mode) + ("\\.tern-project\\'" . json-mode))) #+END_SRC *** restclient -- cgit 1.4.1 From edc8c93b6a569a39ed159117814e14c5da514ab3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 11 May 2016 15:40:46 +0200 Subject: Emacs: Remove keybind for undefined function --- 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 88eb9d23..dcb4f4e9 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -988,8 +988,7 @@ Don’t show uninteresting files in dired listings. :defer 5 :config (progn (diredp-toggle-find-file-reuse-dir 1) - (unbind-key "C-h C-m" dired-mode-map) - (bind-key "." #'diredp-describe-file dired-mode-map))) + (unbind-key "C-h C-m" dired-mode-map))) #+END_SRC Expand subfolders like a tree inside the parent -- cgit 1.4.1 From a6a79446121d2ac54d1ce462383998222e92e40d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 11 May 2016 15:41:13 +0200 Subject: Emacs: Fix byte-compiler warnings --- tag-emacs/emacs.d/init.org | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index dcb4f4e9..5426feb0 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1500,6 +1500,8 @@ I can use this to keep a journal. I should use it. **** org-mobile #+BEGIN_SRC emacs-lisp + (defun ap/org-mobile-pull (descriptor action file) + (org-mobile-pull)) (use-package org-mobile :defer 30 :ensure nil @@ -1533,8 +1535,6 @@ I can use this to keep a journal. I should use it. (concat (file-name-as-directory org-mobile-directory) org-mobile-capture-file)))) - (defun ap/org-mobile-pull (descriptor action file) - (org-mobile-pull)) (setq org-mobile-watcher (file-notify-add-watch org-file '(change) #'ap/org-mobile-pull)))))))) #+END_SRC @@ -1749,6 +1749,7 @@ A REPL thing (and more) for Lisp. (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 -- cgit 1.4.1 From 2807e16d1726f203dc9a9d9f7eb5bcf3accdc9d3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 11 May 2016 15:41:33 +0200 Subject: Emacs: Fix typo in function name --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 5426feb0..a1561fc8 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -725,7 +725,7 @@ guesses the correct settings for me. :config (progn (defun ap/dtrt-adapt-if-needed () (unless editorconfig-mode - (dtrt-adapt))) + (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)) -- cgit 1.4.1 From 8e381df2b74ec9f854ef4a52ac6f87513212f545 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 11 May 2016 15:41:58 +0200 Subject: Emacs: Disable org-mobile --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index a1561fc8..0fe83fd4 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1505,6 +1505,7 @@ I can use this to keep a journal. I should use it. (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") -- cgit 1.4.1 From aceb35a7305b36a7be4b5f10bdd15e21d079b948 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 11 May 2016 15:42:09 +0200 Subject: Emacs: Fix typo in function name --- tag-emacs/emacs.d/init.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 0fe83fd4..23d07543 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2120,8 +2120,8 @@ type them. (add-hook 'text-mode-hook #'typo-mode) (defun typo-mode-turn-off () (typo-mode -1)) - (add-hook 'yaml-mode-hook #'turn-off-typo-mode) - (add-hook 'jinja2-mode-hook #'turn-off-typo-mode))) + (add-hook 'yaml-mode-hook #'typo-mode-turn-off) + (add-hook 'jinja2-mode-hook #'typo-mode-turn-off))) #+END_SRC ** avy -- cgit 1.4.1 From 1b00e6986da83a489c211b7f128fb335dd218ee7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 19 May 2016 20:26:30 +0200 Subject: Emacs: Use Source Code Pro on X11 as well --- 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 695fef92..d11798ad 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -173,7 +173,9 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource ((eq window-system 'w32) (ap/set-fonts "Consolas" 10 "Segoe UI" 11)) ((eq system-type 'darwin) - (ap/set-fonts "Source Code Pro" 14 "Input Sans" 14)))) + (ap/set-fonts "Source Code Pro" 14 "Input Sans" 14)) + ((eq window-system 'x) + (ap/set-fonts "Source Code Pro" 10 "Input Sans" 10)))) #+END_SRC Reduce font decoration. I’m trying to see whether this helps me focus -- cgit 1.4.1 From 662299dfb2ff04b933a29aa8ecacfde8ae14530d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 30 May 2016 16:52:34 +0200 Subject: Emacs: Workaround OSX keyboard specialchar crash --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 23d07543..315fef71 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -250,7 +250,7 @@ Option/alt, then Control. (set-keyboard-coding-system nil) (custom-set-variables '(mac-option-modifier 'meta) - '(mac-right-option-modifier '(:function 'alt :mouse 'alt)) + '(mac-right-option-modifier 'none) '(mac-control-modifier 'control) '(mac-right-control-modifier 'left) '(mac-command-modifier 'super) -- cgit 1.4.1 From a9584465c231f8cd7506135793f64d9afcfb9033 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 8 Jun 2016 11:08:05 +0200 Subject: Emacs: Pair <% %> in web-mode --- tag-emacs/emacs.d/init.org | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index aa3fb1dd..24e3e289 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1934,7 +1934,10 @@ of them as well. 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-pairing nil + (with-eval-after-load 'smartparens + (sp-with-modes sp--html-modes + (sp-local-pair "<%" "%>"))))) #+END_SRC I derived a mode for twig, in order to use its =mode-hook=. -- cgit 1.4.1 From da937772fb32858f6a0b3d894178482a4a8bb65c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 8 Jun 2016 11:08:22 +0200 Subject: Emacs: Try some non-AA fonts in OS X It’s one way to get around OS X’s weird font rendering… --- 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 24e3e289..f7cf9f60 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -173,7 +173,8 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource ((eq window-system 'w32) (ap/set-fonts "Consolas" 10 "Segoe UI" 11)) ((eq system-type 'darwin) - (ap/set-fonts "Source Code Pro" 14 "Input Sans" 14)) + (setq ns-antialias-text nil) + (ap/set-fonts "Anonymous Pro" 11 "Lucida Grande" 12)) ((eq window-system 'x) (ap/set-fonts "Source Code Pro" 10 "Input Sans" 10)))) #+END_SRC -- cgit 1.4.1 From be5831f02f366fef49f0460be6723f9761f37a20 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 8 Jun 2016 11:09:01 +0200 Subject: Emacs: Ensure typo-mode starts in English --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index f7cf9f60..cf479b31 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2122,7 +2122,7 @@ type them. (use-package typo :config (progn (typo-global-mode 1) - (typo-change-language "English") + (setq-default typo-language "English") (add-hook 'text-mode-hook #'typo-mode) (defun typo-mode-turn-off () (typo-mode -1)) -- cgit 1.4.1 From 09992912e66431fa3a5bbaf110d7996ab9964d68 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 8 Jun 2016 11:09:16 +0200 Subject: Emacs: Resize frames (OS windows) by characters --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index cf479b31..86f36353 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -839,7 +839,7 @@ point whilst I’m moving about. mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control))) split-height-threshold 100 split-width-threshold 120 - frame-resize-pixelwise t) + frame-resize-pixelwise nil) (if (boundp 'ns-pop-up-frames) (setq ns-pop-up-frames nil)) #+END_SRC -- cgit 1.4.1 From 2b3922676b4fca8f1f6c42f27a18856876256f77 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 10 Jun 2016 17:33:50 +0200 Subject: Emacs: Change s-p to show all recent projects --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 86f36353..03a14671 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -365,7 +365,7 @@ it needs hooking into projectile and a key bound to switch between projects. #+BEGIN_SRC emacs-lisp (use-package perspective - :bind* ("s-p" . persp-switch) + :bind* ("s-p" . projectile-persp-switch-project) :demand t :config (progn (setq persp-show-modestring t) -- cgit 1.4.1 From f1b4cb4c26738b60892e44654cb1667ac006a5e7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 10 Jun 2016 18:15:50 +0200 Subject: Emacs: Fix incorrect nesting --- tag-emacs/emacs.d/init.org | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 03a14671..87893720 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1929,16 +1929,17 @@ of them as well. ("/layouts/.*\\.html\\'" . web-mode) ("/templates/.*\\.php\\'" . web-mode) ("\\.ejs\\'" . web-mode)) - :config (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 - (with-eval-after-load 'smartparens - (sp-with-modes sp--html-modes - (sp-local-pair "<%" "%>"))))) + :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) + (with-eval-after-load 'smartparens + (sp-with-modes sp--html-modes + (sp-local-pair "<%" "%>"))))) #+END_SRC I derived a mode for twig, in order to use its =mode-hook=. -- cgit 1.4.1 From c48b283fcc5fbbc083de41b8f15728b93a68f9af Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 13 Jun 2016 10:39:18 +0200 Subject: Emacs: Set OS X differently depending on displays --- tag-emacs/emacs.d/init.org | 57 ++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 87893720..af891617 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -152,31 +152,38 @@ 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 (concat mono-face "-" (number-to-string 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 (concat variable-face "-" - (number-to-string variable-font-size))))) - - (cond - ((eq window-system 'w32) - (ap/set-fonts "Consolas" 10 "Segoe UI" 11)) - ((eq system-type 'darwin) - (setq ns-antialias-text nil) - (ap/set-fonts "Anonymous Pro" 11 "Lucida Grande" 12)) - ((eq window-system 'x) - (ap/set-fonts "Source Code Pro" 10 "Input Sans" 10)))) + (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 antialias) + (when mono-face + (let ((default-font (concat mono-face "-" (number-to-string 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 (concat variable-face "-" + (number-to-string variable-font-size)))) + (when (boundp 'ns-antialias-text) + (setq ns-antialias-text antialias))) + + (defun ap/set-fonts-according-to-system () + (cond + ((eq window-system 'w32) + (ap/set-fonts "Consolas" 10 "Segoe UI" 11)) + ((eq system-type 'darwin) + (let ((displays (string-to-number (shell-command-to-string "system_profiler SPDisplaysDataType | grep \"Online: Yes\" | wc -l")))) + (if (eq displays 1) + (ap/set-fonts "PT Mono" 12 "Lucide Grande" 12 t) + (ap/set-fonts "Anonymous Pro" 11 "Lucida Grande" 12 nil)))) + ((eq window-system 'x) + (ap/set-fonts "Source Code Pro" 10 "Input Sans" 10)))) + + (ap/set-fonts-according-to-system)) #+END_SRC Reduce font decoration. I’m trying to see whether this helps me focus -- cgit 1.4.1 From dd078ae0c57ff1ba84060568864ed23ec420672e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 13 Jun 2016 11:04:37 +0200 Subject: Emacs: Use `window-system` for all font checks --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index af891617..f084cc22 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -175,7 +175,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (cond ((eq window-system 'w32) (ap/set-fonts "Consolas" 10 "Segoe UI" 11)) - ((eq system-type 'darwin) + ((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 "PT Mono" 12 "Lucide Grande" 12 t) -- cgit 1.4.1 From 75205cb2610e25e0cb9157407b4e823ae82eea34 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 17 Jun 2016 17:35:50 +0200 Subject: Emacs: Make font-setting function interactive --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index f084cc22..6cd83be0 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -172,6 +172,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (setq ns-antialias-text antialias))) (defun ap/set-fonts-according-to-system () + (interactive) (cond ((eq window-system 'w32) (ap/set-fonts "Consolas" 10 "Segoe UI" 11)) -- cgit 1.4.1 From 19d04e26542182cd1cf6e69c3a5c7336071bd28f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 17 Jun 2016 17:36:07 +0200 Subject: Emacs: Add company-web and re-work backends list --- tag-emacs/emacs.d/init.org | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 6cd83be0..58c28c66 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -899,8 +899,11 @@ seems to work perfectly well for me. ("TAB" . company-indent-or-complete-common)) :init (progn (add-hook 'prog-mode-hook #'company-mode) - (setq company-backends '(company-tern (company-elisp company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-cmake company-capf company-gtags company-dabbrev-code company-etags company-keywords) - company-oddmuse company-files company-dabbrev) + (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 @@ -909,6 +912,11 @@ seems to work perfectly well for me. company-dabbrev-downcase nil))) #+END_SRC +#+BEGIN_SRC emacs-lisp + (use-package company-web + :after company) +#+END_SRC + * Dates & Times ** Calendar -- cgit 1.4.1 From bf686376216a65f8b4e3468e96610f46b181aff7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 17 Jun 2016 17:36:26 +0200 Subject: Fix outline --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 58c28c66..a1761f94 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -885,7 +885,7 @@ and initial-based completion and ignoring case. tab-always-indent 'complete) #+END_SRC -*** Company +** Company The main choices for automatic completion in Emacs are company and auto-complete-mode. I’ve not tried auto-complete-mode as company -- cgit 1.4.1 From 591082cf71574089c7753b182b7b72d4778b333b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 17 Jun 2016 17:36:37 +0200 Subject: Emacs: Don’t auto-quote web-mode attrs --- 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 a1761f94..33950290 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1952,7 +1952,8 @@ of them as well. 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-pairing nil + web-mode-enable-auto-quoting nil) (with-eval-after-load 'smartparens (sp-with-modes sp--html-modes (sp-local-pair "<%" "%>"))))) -- cgit 1.4.1 From e5fd4b92bca4b75c622351d1147ade8777cb3ee7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 24 Jun 2016 16:48:45 +0200 Subject: Add dotfiles directory to default rcrc It can always be overridden… --- rcrc | 1 + 1 file changed, 1 insertion(+) diff --git a/rcrc b/rcrc index 6401329a..9d469dcb 100644 --- a/rcrc +++ b/rcrc @@ -1,2 +1,3 @@ EXCLUDES="Brewfile LaunchAgents README.org" +DOTFILES_DIRS="$HOME/projects/dotfiles" [[ -e ~/.rcrc.local ]] && source ~/.rcrc.local \ No newline at end of file -- cgit 1.4.1 From 8c19ef6bcfba51c562b3c979db8f9d6cd6ae9919 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 24 Jun 2016 16:57:00 +0200 Subject: Load plugins via zplug --- tag-zplug/config/zsh/zshenv | 0 tag-zplug/config/zsh/zshrc | 64 +++++++++++++++++++++++++++++++++++++++++++++ tag-zplug/zshenv | 3 +++ 3 files changed, 67 insertions(+) create mode 100644 tag-zplug/config/zsh/zshenv create mode 100644 tag-zplug/config/zsh/zshrc create mode 100644 tag-zplug/zshenv diff --git a/tag-zplug/config/zsh/zshenv b/tag-zplug/config/zsh/zshenv new file mode 100644 index 00000000..e69de29b diff --git a/tag-zplug/config/zsh/zshrc b/tag-zplug/config/zsh/zshrc new file mode 100644 index 00000000..dc55d6d5 --- /dev/null +++ b/tag-zplug/config/zsh/zshrc @@ -0,0 +1,64 @@ +# -*- mode: sh; -*- +export ZPLUG_HOME=/usr/local/opt/zplug +source $ZPLUG_HOME/init.zsh + +zplug "zsh-users/zsh-completions" +zplug "mafredri/zsh-async" +zplug "sindresorhus/pure" +zplug "Tarrasch/zsh-autoenv", as:plugin +zplug "clvv/fasd", hook-build:"make install" +zplug "tymm/zsh-directory-history", as:command, use:"dir{hist,log}" +zplug "tymm/zsh-directory-history", as:plugin + +if zplug check Tarrasch/zsh-autoenv +then + AUTOENV_FILE_ENTER=.envrc + AUTOENV_HANDLE_LEAVE=0 + AUTOENV_LOOK_UPWARDS=1 +fi + +# Then, source plugins and add commands to $PATH +zplug load + +# General configuration +setopt auto_cd # Change directories without `cd` + +if zplug check zsh-users/zsh-completions +then + autoload -U compinit && compinit +fi + +if zplug check sindresorhus/pure +then + PURE_GIT_PULL=0 + autoload -Uz promptinit && promptinit + prompt pure &> /dev/null +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 +fi + +if zplug check tymm/zsh-directory-history +then + unsetopt flow_control # Let me use ^S and ^Q + # bindkey '\e[A' directory-history-search-backward + # bindkey '\e[B' directory-history-search-forward + + bindkey -M emacs '^R' history-substring-search-up + bindkey -M emacs '^S' history-substring-search-down +fi diff --git a/tag-zplug/zshenv b/tag-zplug/zshenv new file mode 100644 index 00000000..354c54da --- /dev/null +++ b/tag-zplug/zshenv @@ -0,0 +1,3 @@ +ZDOTDIR="${XDG_CONFIG_HOME:=$HOME/.config}/zsh" + +source "$ZDOTDIR"/.zshenv -- cgit 1.4.1 From 665d0c79f6c3167ca125666cedd85e8c29a47bdc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 24 Jun 2016 16:57:11 +0200 Subject: Load plugins via antibody --- tag-antibody/config/zsh/plugins.txt | 7 +++++++ tag-antibody/config/zsh/zshenv | 0 tag-antibody/config/zsh/zshrc | 42 +++++++++++++++++++++++++++++++++++++ tag-antibody/zshenv | 3 +++ 4 files changed, 52 insertions(+) create mode 100644 tag-antibody/config/zsh/plugins.txt create mode 100644 tag-antibody/config/zsh/zshenv create mode 100644 tag-antibody/config/zsh/zshrc create mode 100644 tag-antibody/zshenv diff --git a/tag-antibody/config/zsh/plugins.txt b/tag-antibody/config/zsh/plugins.txt new file mode 100644 index 00000000..361bad38 --- /dev/null +++ b/tag-antibody/config/zsh/plugins.txt @@ -0,0 +1,7 @@ +zsh-users/zsh-completions +mafredri/zsh-async +Tarrasch/zsh-autoenv +caarlos0/zsh-git-sync +caarlos0/zsh-open-pr +sindresorhus/pure +clvv/fasd diff --git a/tag-antibody/config/zsh/zshenv b/tag-antibody/config/zsh/zshenv new file mode 100644 index 00000000..e69de29b diff --git a/tag-antibody/config/zsh/zshrc b/tag-antibody/config/zsh/zshrc new file mode 100644 index 00000000..3a9722c2 --- /dev/null +++ b/tag-antibody/config/zsh/zshrc @@ -0,0 +1,42 @@ +source <(antibody init) + +AUTOENV_FILE_ENTER=.envrc +AUTOENV_HANDLE_LEAVE=0 +AUTOENV_LOOK_UPWARDS=1 + +PURE_GIT_PULL=0 + +source $ZDOTDIR/load-plugins.zsh + +function update_antibody () { + antibody bundle < .config/zsh/plugins.txt| xargs -I {} echo "source {}" >> .config/zsh/load-plugins.zsh +} + + +# General configuration +setopt auto_cd # Change directories without `cd` + +autoload -U compinit && compinit +autoload -Uz promptinit && promptinit + +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 + +unsetopt flow_control # Let me use ^S and ^Q +# bindkey '\e[A' directory-history-search-backward +# bindkey '\e[B' directory-history-search-forward + +# bindkey -M emacs '^R' history-substring-search-up +# bindkey -M emacs '^S' history-substring-search-down diff --git a/tag-antibody/zshenv b/tag-antibody/zshenv new file mode 100644 index 00000000..354c54da --- /dev/null +++ b/tag-antibody/zshenv @@ -0,0 +1,3 @@ +ZDOTDIR="${XDG_CONFIG_HOME:=$HOME/.config}/zsh" + +source "$ZDOTDIR"/.zshenv -- cgit 1.4.1 From 6445538807f6a08316eed74fbee4c1daca188b49 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 25 Jun 2016 22:51:13 +0200 Subject: Emacs: Fix ap/set-fonts argument errors --- tag-emacs/emacs.d/init.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 33950290..18bf622c 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -175,14 +175,14 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (interactive) (cond ((eq window-system 'w32) - (ap/set-fonts "Consolas" 10 "Segoe UI" 11)) + (ap/set-fonts "Consolas" 10 "Segoe UI" 11 t)) ((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 "PT Mono" 12 "Lucide Grande" 12 t) (ap/set-fonts "Anonymous Pro" 11 "Lucida Grande" 12 nil)))) ((eq window-system 'x) - (ap/set-fonts "Source Code Pro" 10 "Input Sans" 10)))) + (ap/set-fonts "Source Code Pro" 10 "Input Sans" 10 t)))) (ap/set-fonts-according-to-system)) #+END_SRC -- cgit 1.4.1 From 32c46b315483ec2f58f14acd5cc3d9145c65c65c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 25 Jun 2016 22:51:26 +0200 Subject: Emacs: add command to open budget --- tag-emacs/emacs.d/init.org | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 18bf622c..054fe673 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1387,6 +1387,11 @@ works really nicely. (defun setup-ledger-mode () (setq-local indent-tabs-mode nil)) (add-hook 'ledger-mode-hook #'setup-ledger-mode) + (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)) (setq ledger-use-iso-dates t ledger-post-use-completion-engine :built-in ledger-reconcile-default-commodity "€" -- cgit 1.4.1 From f766b7ba9ee98fe81a0b17581177314c57443818 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 26 Jun 2016 16:34:09 +0200 Subject: Zplug: Allow installing into $HOME --- host-ap-spotcap.local/config/zsh/zshenv.local | 1 + tag-zplug/config/zsh/zshenv | 6 ++++++ tag-zplug/config/zsh/zshrc | 5 ++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/host-ap-spotcap.local/config/zsh/zshenv.local b/host-ap-spotcap.local/config/zsh/zshenv.local index f6881be2..35fe7a37 100644 --- a/host-ap-spotcap.local/config/zsh/zshenv.local +++ b/host-ap-spotcap.local/config/zsh/zshenv.local @@ -3,3 +3,4 @@ if [[ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]] then . $HOME/.nix-profile/etc/profile.d/nix.sh; fi +export ZPLUG_HOME=/usr/local/opt/zplug diff --git a/tag-zplug/config/zsh/zshenv b/tag-zplug/config/zsh/zshenv index e69de29b..d5ef76a1 100644 --- a/tag-zplug/config/zsh/zshenv +++ b/tag-zplug/config/zsh/zshenv @@ -0,0 +1,6 @@ +if [[ -f $ZDOTDIR/zshenv.local ]] +then + . $ZDOTDIR/zshenv.local +fi + +ZPLUG_HOME=${ZPLUG_HOME:-~/projects/zplug} \ No newline at end of file diff --git a/tag-zplug/config/zsh/zshrc b/tag-zplug/config/zsh/zshrc index dc55d6d5..5fd52db3 100644 --- a/tag-zplug/config/zsh/zshrc +++ b/tag-zplug/config/zsh/zshrc @@ -1,12 +1,11 @@ # -*- mode: sh; -*- -export ZPLUG_HOME=/usr/local/opt/zplug -source $ZPLUG_HOME/init.zsh +source ${ZPLUG_HOME:-~/projects/zplug}/init.zsh zplug "zsh-users/zsh-completions" zplug "mafredri/zsh-async" zplug "sindresorhus/pure" zplug "Tarrasch/zsh-autoenv", as:plugin -zplug "clvv/fasd", hook-build:"make install" +zplug "clvv/fasd", hook-build:"PREFIX=$HOME make install" zplug "tymm/zsh-directory-history", as:command, use:"dir{hist,log}" zplug "tymm/zsh-directory-history", as:plugin -- cgit 1.4.1 From dd4e62c2ea197c6cf63b65a7b5160fb19dbd5939 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 26 Jun 2016 16:35:38 +0200 Subject: Delete unused tmux stuff --- tag-zsh/config/zsh/completion/_tmux_pane_words | 10 ---------- tag-zsh/config/zsh/zshrc | 10 ---------- 2 files changed, 20 deletions(-) delete mode 100644 tag-zsh/config/zsh/completion/_tmux_pane_words diff --git a/tag-zsh/config/zsh/completion/_tmux_pane_words b/tag-zsh/config/zsh/completion/_tmux_pane_words deleted file mode 100644 index 6ff9ce18..00000000 --- a/tag-zsh/config/zsh/completion/_tmux_pane_words +++ /dev/null @@ -1,10 +0,0 @@ -local expl -local -a w - -if [[ -z "$TMUX_PANE" ]]; then - _message "not running inside tmux!" - return 1 -fi - -w=( ${(u)=$(tmux capture-pane \; show-buffer \; delete-buffer)} ) -_wanted values expl 'words from current tmux pane' compadd -a w diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 73dad6df..38d4a7ac 100755 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -57,13 +57,6 @@ bashcompinit zstyle :compinstall filename '~/.zshrc' -autoload -Uz _tmux_pane_words -zle -C tmux-pane-words-prefix complete-word _generic -zle -C tmux-pane-words-anywhere complete-word _generic -zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' completer _tmux_pane_words -zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' ignore-line current -zstyle ':completion:tmux-pane-words-anywhere:*' matcher-list 'b:=* m:{A-Za-z}={a-zA-Z}' - # Speed up completion by not going further than a full match zstyle ':completion:*' accept-exact '*(N)' @@ -192,9 +185,6 @@ bindkey '' forward-word bindkey 'f' insert-files bindkey 'd' describe-key-briefly -bindkey '\' tmux-pane-words-prefix -bindkey '|' tmux-pane-words-anywhere - # Aliases before functions alias getcflags='gcc -\#\#\# -march=native -E /usr/include/stdlib.h 2>&1 | grep "/usr/libexec/gcc/.*cc1"' alias grep='grep --color=auto' -- cgit 1.4.1 From 3ec45a3b60b4d4ae0a778ed1d0e417c3a20c4d57 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 26 Jun 2016 16:41:04 +0200 Subject: Set zsh plugin dependencies --- tag-zplug/config/zsh/zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zplug/config/zsh/zshrc b/tag-zplug/config/zsh/zshrc index 5fd52db3..c57bf944 100644 --- a/tag-zplug/config/zsh/zshrc +++ b/tag-zplug/config/zsh/zshrc @@ -3,7 +3,7 @@ source ${ZPLUG_HOME:-~/projects/zplug}/init.zsh zplug "zsh-users/zsh-completions" zplug "mafredri/zsh-async" -zplug "sindresorhus/pure" +zplug "sindresorhus/pure", on:"mafredri/zsh-async" zplug "Tarrasch/zsh-autoenv", as:plugin zplug "clvv/fasd", hook-build:"PREFIX=$HOME make install" zplug "tymm/zsh-directory-history", as:command, use:"dir{hist,log}" -- cgit 1.4.1 From 1f77e2ab95dac41dc40d6d449f92654b607f4b45 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 26 Jun 2016 16:42:21 +0200 Subject: Setup zplug in post-zsh hook --- hooks/post-up/zsh | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/hooks/post-up/zsh b/hooks/post-up/zsh index 15b6a2f0..b7a7d4a2 100755 --- a/hooks/post-up/zsh +++ b/hooks/post-up/zsh @@ -21,35 +21,9 @@ then mkdir -p ~/.cache/zsh fi -local -a zfiles -zfiles=($ZDOTDIR/zshrc) - -autoload -U zrecompile - -if [[ -f $ZDOTDIR/${HOST%%.*}.zsh ]]; then - zfiles+=$ZDOTDIR/${HOST%%.*}.zsh -fi -if [[ $OSTYPE == freebsd* ]]; then - zfiles+=$ZDOTDIR/freebsd.zsh -fi - -autoload -Uz compinit -compinit -u -d ~/.cache/zsh/compdump -zrecompile -p -R $ZDOTDIR/.zshrc.zwc $zfiles -- \ - -M ~/.cache/zsh/compdump - -if [[ -s $commands[fasd] ]]; then - if [[ ! -d $ZDOTDIR/functions/fasd ]]; then - mkdir $ZDOTDIR/functions/fasd - fi - if [[ ! -h $ZDOTDIR/functions/fasd/fasd ]]; then - ln -s =fasd $ZDOTDIR/functions/fasd/fasd - fi +if [[ -z $commands[zplug] && ! -d ~/projects/zplug/ ]] +then + git clone git://github.com/zplug/zplug ~/projects/zplug/ fi -for fp in $ZDOTDIR/functions/*(/); do - zrecompile -p $fp $fp/* -done - -[[ -f ~/.zsh/fasd-data ]] && mv ~/.zsh/fasd-data ~/.cache/zsh/fasd-data -[[ -f ~/.zsh/history ]] && mv ~/.zsh/history ~/.cache/zsh/history +zsh -ic "zplug install" -- cgit 1.4.1 From 097663cb10d0e8c244063af28295cff6d686f1bb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 26 Jun 2016 16:48:06 +0200 Subject: Port WORDCHARS config from zsh --- tag-zplug/config/zsh/zshrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-zplug/config/zsh/zshrc b/tag-zplug/config/zsh/zshrc index c57bf944..71722dc5 100644 --- a/tag-zplug/config/zsh/zshrc +++ b/tag-zplug/config/zsh/zshrc @@ -9,6 +9,8 @@ zplug "clvv/fasd", hook-build:"PREFIX=$HOME make install" zplug "tymm/zsh-directory-history", as:command, use:"dir{hist,log}" zplug "tymm/zsh-directory-history", as:plugin +WORDCHARS='*?_-[]~.&;!#$%^(){}<>' + if zplug check Tarrasch/zsh-autoenv then AUTOENV_FILE_ENTER=.envrc -- cgit 1.4.1 From 4317e763fbf1844079f3d533901be0d04c752df7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 30 Jun 2016 16:59:23 +0200 Subject: Emacs: Use Proggy font on macOS (normal DPI) --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 054fe673..f071731f 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -180,7 +180,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (let ((displays (string-to-number (shell-command-to-string "system_profiler SPDisplaysDataType | grep \"Online: Yes\" | wc -l")))) (if (eq displays 1) (ap/set-fonts "PT Mono" 12 "Lucide Grande" 12 t) - (ap/set-fonts "Anonymous Pro" 11 "Lucida Grande" 12 nil)))) + (ap/set-fonts "ProggyOptiS" 11 "Lucida Grande" 12 nil)))) ((eq window-system 'x) (ap/set-fonts "Source Code Pro" 10 "Input Sans" 10 t)))) -- cgit 1.4.1 From 56533b7ddf4ecbef67110a56d38d8df16fc20c6f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 30 Jun 2016 17:04:43 +0200 Subject: Replace deprecated Brewfile with shell script --- Brewfile | 9 --------- brew.sh | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 9 deletions(-) delete mode 100644 Brewfile create mode 100644 brew.sh diff --git a/Brewfile b/Brewfile deleted file mode 100644 index ae3e09dc..00000000 --- a/Brewfile +++ /dev/null @@ -1,9 +0,0 @@ -install direnv -install emacs --cocoa --srgb --with-gnutls -install fasd -install git -install htop -install hub -install mobile-shell -install ssh-copy-id -install zsh \ No newline at end of file diff --git a/brew.sh b/brew.sh new file mode 100644 index 00000000..75988ec4 --- /dev/null +++ b/brew.sh @@ -0,0 +1,18 @@ +brew install android-platform-tools +brew install ansible +brew install gitup +brew install h2o +brew install launchdns +brew install mackup +brew install mariadb --with-archive-storage-engine --with-local-infile +brew tap homebrew/versions +brew install homebrew/versions/node4-lts --with-debug +brew install postgresql +brew install redis +brew install ssh-copy-id +brew install syncthing +brew install syncthing-inotify +brew install trash +brew install xhyve +brew install zplug +brew install zsh-completions -- cgit 1.4.1 From b0cc9b365bfdb34f488e031b84482148aeb6d28a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 3 Jul 2016 20:55:11 +0200 Subject: Update github user --- tag-git/config/git/config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-git/config/git/config b/tag-git/config/git/config index 3d6b82a2..6228a08b 100644 --- a/tag-git/config/git/config +++ b/tag-git/config/git/config @@ -1,5 +1,5 @@ [user] - email = alan@alanpearce.co.uk + email = alan@alanpearce.uk name = Alan Pearce [color] branch = auto @@ -21,7 +21,7 @@ pr = pull-request delete-merged = "!sh -c 'git branch --merged | grep -v "\\*" | grep -v master | grep -v dev | xargs -n 1 git branch -d'" [github] - user = alan@alanpearce.co.uk + user = alan@alanpearce.uk [diff] algorithm = patience [include] -- cgit 1.4.1 From 4777da182dd0ccbb36051e162e5265a8687144c0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 3 Jul 2016 20:55:37 +0200 Subject: Fix open-budget command --- tag-emacs/emacs.d/init.org | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 054fe673..1718b8af 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1383,15 +1383,16 @@ 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) - (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)) (setq ledger-use-iso-dates t ledger-post-use-completion-engine :built-in ledger-reconcile-default-commodity "€" -- cgit 1.4.1 From f0643fdce54e5172a369e29d00356cb9bc4f6c8b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 4 Jul 2016 08:17:30 +0200 Subject: Emacs: Fix smartparens in web-mode --- tag-emacs/emacs.d/init.org | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index c13011c7..d89022e7 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1960,9 +1960,8 @@ of them as well. web-mode-comment-style 2 web-mode-enable-auto-pairing nil web-mode-enable-auto-quoting nil) - (with-eval-after-load 'smartparens - (sp-with-modes sp--html-modes - (sp-local-pair "<%" "%>"))))) + (sp-with-modes sp--html-modes + (sp-local-pair "<%" "%>")))) #+END_SRC I derived a mode for twig, in order to use its =mode-hook=. @@ -2241,7 +2240,7 @@ nice as the real version (bind-key "M-" #'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-" #'sp-slurp-hybrid-sexp smartparens-mode-map) - (sp-with-modes '(web-mode twig-mode) + (sp-with-modes '(twig-mode) (sp-local-pair "{%" "%}") (sp-local-pair "{{" "}}")) (show-smartparens-global-mode t) -- cgit 1.4.1 From 7b7ea853f81e5574a187e2dab975795b28a8f402 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 4 Jul 2016 08:47:40 +0200 Subject: Emacs: Fix error when starting web-mode --- 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 d89022e7..12e07726 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1960,8 +1960,7 @@ of them as well. web-mode-comment-style 2 web-mode-enable-auto-pairing nil web-mode-enable-auto-quoting nil) - (sp-with-modes sp--html-modes - (sp-local-pair "<%" "%>")))) + (sp-local-pair '(web-mode) "<%" "%>"))) #+END_SRC I derived a mode for twig, in order to use its =mode-hook=. -- cgit 1.4.1 From 30cbc184e6908c77de8982041238db3a5f6e86d4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 4 Jul 2016 08:47:53 +0200 Subject: Remove unused pre-up hooks --- hooks/pre-up/emacs | 8 -------- hooks/pre-up/submodules | 5 ----- 2 files changed, 13 deletions(-) delete mode 100755 hooks/pre-up/emacs delete mode 100755 hooks/pre-up/submodules diff --git a/hooks/pre-up/emacs b/hooks/pre-up/emacs deleted file mode 100755 index 01ca2793..00000000 --- a/hooks/pre-up/emacs +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env zsh - -# Remove broken elisp symlink from old versions -elisp="$HOME/.emacs.d/elisp" -if [[ -L "$elisp" && ! -e "$elisp" ]] -then - rm $elisp -fi diff --git a/hooks/pre-up/submodules b/hooks/pre-up/submodules deleted file mode 100755 index ae4f42fd..00000000 --- a/hooks/pre-up/submodules +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env zsh -echo $0:h:h:h -pushd $0:h:h:h -git submodule update --init -popd \ No newline at end of file -- cgit 1.4.1 From 7f6535f0e3fa7beda5d740f900e1b8908c00a67a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 4 Jul 2016 08:48:31 +0200 Subject: Ignore tangled Emacs init --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 76e98f5e..7372891b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ *.zwc *.zwc.old .DS_Store +/tag-emacs/emacs.d/init.el* -- cgit 1.4.1 From bc564613c5244d86ae94b3ffb88563fe211bc8ca Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 4 Jul 2016 09:48:20 +0200 Subject: Emacs: Move smartparens’ keys out of swiper’s way --- tag-emacs/emacs.d/init.org | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 12e07726..146bce00 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2231,9 +2231,9 @@ nice as the real version (bind-key "M-" #'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 "M-S" #'sp-split-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-" #'sp-splice-sexp-killing-backward smartparens-mode-map) (bind-key "M-" #'sp-splice-sexp-killing-forward smartparens-mode-map) -- cgit 1.4.1 From 0f87ea4e81cfd480310f109f892ae51b919b265c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 4 Jul 2016 14:36:59 +0200 Subject: zsh: Add $HOME/bin to path --- tag-zsh/config/zsh/zshrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 237b94a0..160257e4 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -11,6 +11,11 @@ zplug "tymm/zsh-directory-history", as:plugin WORDCHARS='*?_-[]~.&;!#$%^(){}<>' +if [[ ${path[(I)$HOME/bin ]} ]] +then + path+=($HOME/bin) +fi + ls='\ls' gnu_ls_options="-v --group-directories-first --color=auto" gnu_ls_isodate="--time-style=long-iso" -- cgit 1.4.1 From 975ba5926cd11f1ebe48cf04f13d8ac77ee2fa08 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 4 Jul 2016 16:45:46 +0200 Subject: Emacs: Reset window-splitting thresholds --- tag-emacs/emacs.d/init.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 146bce00..51145ae7 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -845,8 +845,8 @@ point whilst I’m moving about. scroll-margin 1 scroll-preserve-screen-position t mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control))) - split-height-threshold 100 - split-width-threshold 120 + split-height-threshold 80 + split-width-threshold 160 frame-resize-pixelwise nil) (if (boundp 'ns-pop-up-frames) (setq ns-pop-up-frames nil)) -- cgit 1.4.1 From 9626966fb05cd3c309316f12ecc1a0ea49ef9434 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 4 Jul 2016 16:46:53 +0200 Subject: Emacs: Remove extra Javascript menu --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 51145ae7..5382bdce 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1849,6 +1849,7 @@ it though :interpreter ("node" . js2-mode) :functions js2-next-error :config (progn + (unbind-key [menu-bar javascript] js2-mode-map) (setq js2-skip-preprocessor-directives t) (defun ap/javascript-setup () (auto-indent-mode -1)) -- cgit 1.4.1 From 5e4dc87f6dd7c81cde6fbddfcc85644905fb25e3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 5 Jul 2016 11:17:33 +0200 Subject: Emacs: Disable “fast” keys for expand-region --- tag-emacs/emacs.d/init.org | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 5382bdce..905b46e6 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2132,8 +2132,9 @@ Expanding the region by semantic units was something I quite liked 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)) + (use-package expand-region + :bind ("C-M-SPC" . er/expand-region) + :config (setq expand-region-fast-keys-enabled nil)) #+END_SRC ** Typography -- cgit 1.4.1 From 35a473727d348d4777487c1590a322f60bf99329 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 5 Jul 2016 11:30:17 +0200 Subject: Emacs: M-x repunctuate-sentences --- tag-emacs/emacs.d/init.org | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 905b46e6..f632f97f 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -7,7 +7,7 @@ This is a living document, detailing my Emacs configuration using org-mode * Basics ** Startup -Open Emacs with just a plain window. No graphics or messages, please! +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))) @@ -63,7 +63,7 @@ the buffer to be empty. * Customize I don’t really like using customize for normal configuration. -Instead, I use it for things that get saved automatically. That’s why +Instead, I use it for things that get saved automatically. That’s why I use a different file, which is ignored by the VCS. It also means that it’s not important whether the file exists or not, which is why I pass =:noerror= to =load= @@ -481,7 +481,7 @@ trash for deleting on OS X. ** Encoding -UTF-8 is usually appropriate. Note that =prefer-coding-system= expects +UTF-8 is usually appropriate. Note that =prefer-coding-system= expects only a coding system, not a coding system and line ending combination. #+BEGIN_SRC emacs-lisp @@ -491,14 +491,14 @@ only a coding system, not a coding system and line ending combination. ** Buffer-file management -Ask if I want to create a directory when it doesn’t exist. This is +Ask if I want to create a directory when it doesn’t exist. This is 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))) + (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 @@ -538,7 +538,7 @@ with a buffer. (message "File '%s' successfully removed" filename))))) (defun kill-or-delete-this-buffer-dwim (&optional arg) - "Kills current buffer. With prefix arg, delete it." + "Kills current buffer. With prefix arg, delete it." (interactive "P") (if (equal arg '(4)) (delete-current-buffer-file) @@ -566,7 +566,7 @@ open it. Whitespace butler fixes whitespace only for lines that I’m editing. ** shrink-whitespace -DWIM whitespace removal. So I don’t need =M-SPC=, =M-\= and =C-x o= +DWIM whitespace removal. So I don’t need =M-SPC=, =M-\= and =C-x o= for similar things any more. #+BEGIN_SRC emacs-lisp @@ -728,7 +728,7 @@ with spaces. Perfect! ** dtrt-indent-mode -Sometimes people use different indentation settings. [[https://github.com/jscheid/dtrt-indent][dtrt-indent]] +Sometimes people use different indentation settings. [[https://github.com/jscheid/dtrt-indent][dtrt-indent]] guesses the correct settings for me. #+BEGIN_SRC emacs-lisp @@ -935,7 +935,7 @@ Weeks start on Monday for me and I prefer ISO-style dates. Sometimes I want to insert a date or time into a buffer. #+BEGIN_SRC emacs-lisp (defun insert-date (prefix) - "Insert the current date. With prefix-argument, use British format. With + "Insert the current date. With prefix-argument, use British format. With two prefix arguments, write out the day and month name." (interactive "P") (let ((format (cond @@ -1058,7 +1058,7 @@ improves the normal help commands, mostly by making quitting them easier. #+END_SRC ** helm-dash -Emacs’ documentation is great to read from inside Emacs. Helm-dash +Emacs’ documentation is great to read from inside Emacs. Helm-dash helps to make documentation for other languages easier to access #+BEGIN_SRC emacs-lisp @@ -1277,7 +1277,7 @@ replace helm and ido. ** smex -Smex is my favourite way to use =M-x=. Counsel’s =counsel-M-x= +Smex is my favourite way to use =M-x=. Counsel’s =counsel-M-x= function uses it internally, so I’m keeping it around, even though I don’t use it directly. @@ -1676,7 +1676,7 @@ let bindings. *** Emacs Lisp -Customise the modeline-display of =emacs-lisp-mode=. Then make sure +Customise the modeline-display of =emacs-lisp-mode=. Then make sure it runs the common lisp hooks. #+BEGIN_SRC emacs-lisp @@ -1684,7 +1684,7 @@ it runs the common lisp hooks. (add-hook 'emacs-lisp-mode-hook #'eldoc-mode) #+END_SRC -Go-to function for elisp. Except it works through the entire Emacs ecosystem. +Go-to function for elisp. Except it works through the entire Emacs ecosystem. #+BEGIN_SRC emacs-lisp (use-package elisp-slime-nav @@ -2005,7 +2005,7 @@ nice, when I remember to use it. #+BEGIN_SRC emacs-lisp (use-package eshell - :bind ("C-c s" . eshell) + :bind ("C-c s" . eshell) :config (progn (setq eshell-directory-name "~/.emacs.d/eshell") (add-hook 'eshell-load-hook (lambda () @@ -2296,7 +2296,7 @@ the buffer for me. #+END_SRC * Tangling -Taken from [[https://github.com/larstvei/dot-emacs/blob/master/init.org][larstvei/dot-emacs]]. I changed it so that it would work with +Taken from [[https://github.com/larstvei/dot-emacs/blob/master/init.org][larstvei/dot-emacs]]. I changed it so that it would work with my current dotfiles repository structure and work asynchronously, thanks to [[https://github.com/jwiegley/emacs-async][jwiegley/emacs-async]]. -- cgit 1.4.1 From 57e501079210490b061a684ee4dcceb1ee8c9daf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 5 Jul 2016 11:30:30 +0200 Subject: Emacs: Switch OSX bitmap font Makes smart quotes look like quotes, not guillemots --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index f632f97f..6d71f3d3 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -180,7 +180,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (let ((displays (string-to-number (shell-command-to-string "system_profiler SPDisplaysDataType | grep \"Online: Yes\" | wc -l")))) (if (eq displays 1) (ap/set-fonts "PT Mono" 12 "Lucide Grande" 12 t) - (ap/set-fonts "ProggyOptiS" 11 "Lucida Grande" 12 nil)))) + (ap/set-fonts "ProggyTiny" 11 "Lucida Grande" 12 nil)))) ((eq window-system 'x) (ap/set-fonts "Source Code Pro" 10 "Input Sans" 10 t)))) -- cgit 1.4.1 From 105edf82830b6ac02cb7c2b7d22126687a4291bc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 5 Jul 2016 14:11:30 +0200 Subject: zsh: Bind OS X delete key --- tag-zsh/config/zsh/zshrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 160257e4..7a2688f4 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -52,6 +52,8 @@ alias lal="ll -A" alias lla="lal" alias llr="ll -t" +bindkey '\e[3~' delete-char + if zplug check Tarrasch/zsh-autoenv then AUTOENV_FILE_ENTER=.envrc -- cgit 1.4.1 From d1d7ffb9b0c9409774ffd937db5d46300e9ffde7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 5 Jul 2016 14:13:56 +0200 Subject: zsh: Remove extra chars from WORDCHARS --- tag-zsh/config/zsh/zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 7a2688f4..6adb5481 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -9,7 +9,7 @@ zplug "clvv/fasd", hook-build:"PREFIX=$HOME make install" zplug "tymm/zsh-directory-history", as:command, use:"dir{hist,log}" zplug "tymm/zsh-directory-history", as:plugin -WORDCHARS='*?_-[]~.&;!#$%^(){}<>' +WORDCHARS='*?_[]~&;!#$%^(){}<>' if [[ ${path[(I)$HOME/bin ]} ]] then -- cgit 1.4.1 From 60229d799d3656ce3b1dbe3a931788a8f5ca37b6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 5 Jul 2016 14:14:39 +0200 Subject: zsh: Change WORDCHARS in a more elegant way --- tag-zsh/config/zsh/zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 6adb5481..7d57417a 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -9,7 +9,7 @@ zplug "clvv/fasd", hook-build:"PREFIX=$HOME make install" zplug "tymm/zsh-directory-history", as:command, use:"dir{hist,log}" zplug "tymm/zsh-directory-history", as:plugin -WORDCHARS='*?_[]~&;!#$%^(){}<>' +WORDCHARS=${${WORDCHARS//[-.]}//[\/]} if [[ ${path[(I)$HOME/bin ]} ]] then -- cgit 1.4.1 From 062be5c143463bd6ddc32933549c5a0782727df3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 5 Jul 2016 16:54:16 +0200 Subject: Emacs: Show zero values in cumulative budget --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 6d71f3d3..545b82aa 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1404,7 +1404,7 @@ works really nicely. ("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 \\^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)))\\ -- cgit 1.4.1 From 0b6acd37d6d60a624ce6a469ae552b30d65dce31 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 7 Jul 2016 13:23:34 +0200 Subject: Emacs: Remove correct javascript menu --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 545b82aa..5c3a14c6 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1849,7 +1849,7 @@ it though :interpreter ("node" . js2-mode) :functions js2-next-error :config (progn - (unbind-key [menu-bar javascript] js2-mode-map) + (define-key js2-mode-map [menu-bar Javascript] nil) (setq js2-skip-preprocessor-directives t) (defun ap/javascript-setup () (auto-indent-mode -1)) -- cgit 1.4.1 From ea6f0d0b28a6a4a31954e463077715580fc53145 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 7 Jul 2016 13:23:50 +0200 Subject: Emacs: Remove js2 imenu menu --- tag-emacs/emacs.d/init.org | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 5c3a14c6..6217e9ae 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1850,6 +1850,11 @@ it though :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" + (unless (string-equal name "IM-Javascript-IDE") + (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)) -- cgit 1.4.1 From eaff8a793480afc2e3f9f27d1c0c6280091c9fdb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 7 Jul 2016 16:23:16 +0200 Subject: Fix init.el being generated in dotfiles --- hooks/post-up/emacs | 1 + 1 file changed, 1 insertion(+) diff --git a/hooks/post-up/emacs b/hooks/post-up/emacs index 1cc19f9f..aad74be7 100755 --- a/hooks/post-up/emacs +++ b/hooks/post-up/emacs @@ -4,6 +4,7 @@ if [[ -s $commands[emacs] ]] then pushd ~/.emacs.d emacs --batch --eval "(progn +(setq vc-follow-symlinks nil) (find-file \"init.org\") (require 'ob-tangle) (org-babel-tangle nil \"init.el\") -- cgit 1.4.1 From bce550f39714f5581540413b9fa0e6f8f21fa35b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 7 Jul 2016 16:23:40 +0200 Subject: Remove now-unnecessary gitignore rules --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index 7372891b..ea33edfb 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,6 @@ .#* # Byte-compiled files -*.elc *.zwc *.zwc.old .DS_Store -/tag-emacs/emacs.d/init.el* -- cgit 1.4.1 From 94489bb8ce88f65c6a440f4f0953ad00248a1ab9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 7 Jul 2016 16:23:55 +0200 Subject: Remove unused packages --- tag-emacs/emacs.d/init.org | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 6217e9ae..45d2ae72 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -585,17 +585,6 @@ I only use this occasionally, but it’s nice for files outside of projects. (recentf-mode 1))) #+END_SRC -** spotlight - -An awesome way to open files on OS X. - -#+BEGIN_SRC emacs-lisp - (use-package spotlight - :defer 10 - :if (eq system-type 'darwin) - :config (setq spotlight-tmp-file "/tmp/.emacs-spotlight-tmp-file")) -#+END_SRC - ** Tramp Tramp is awesome. It makes SSH feel Unix-y. The proxy setup is so @@ -2037,15 +2026,6 @@ nice, when I remember to use it. #+END_SRC -#+BEGIN_SRC emacs-lisp - (with-eval-after-load 'eshell - (use-package esh-buf-stack - :init (progn - (add-hook 'eshell-load-hook (lambda () - (setup-eshell-buf-stack) - (bind-key "M-q" #'eshell-push-command eshell-mode-map)))))) -#+END_SRC - *** Shells #+BEGIN_SRC emacs-lisp -- cgit 1.4.1 From 6afa8022aa833d2452cf16b4161f5258276b4688 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 7 Jul 2016 16:24:11 +0200 Subject: Emacs: Avoid using MELPA for packages Create a whitelist of desired packages that are not (at the current time) available elsewhere --- tag-emacs/emacs.d/init.org | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 45d2ae72..4c0e2593 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -36,6 +36,51 @@ the buffer to be empty. ** Use-package #+BEGIN_SRC emacs-lisp + (defvar melpa-include-packages '(minimal-theme + highlight-stages + relative-buffers + dired+ + dired-subtree + dired-hacks-utils + dired-narrow + org-caldav + go-projectile + go-rename + go-guru + redshank + restclient + visual-regexp) + "Don't install any MELPA packages except these packages") + + (defvar package-filter-function nil + "Optional predicate function used to internally filter packages used by package.el. + + The function is called with the arguments PACKAGE VERSION ARCHIVE, where + PACKAGE is a symbol, VERSION is a vector as produced by `version-to-list', and + ARCHIVE is the string name of the package archive.") + + ;; Don't take MELPA versions of certain packages + (setq package-filter-function + (lambda (package version archive) + (or (not (string-equal archive "melpa")) + ;; install package in whitelist + (memq package melpa-include-packages) + ;; use all color themes + (string-match (format "%s" package) "-theme")))) + + (defadvice package--add-to-archive-contents + (around filter-packages (package archive) activate) + "Add filtering of available packages using `package-filter-function', if non-nil." + (when (or (null package-filter-function) + (funcall package-filter-function + (car package) + (funcall (if (fboundp 'package-desc-version) + 'package--ac-desc-version + 'package-desc-vers) + (cdr package)) + archive)) + ad-do-it)) + (eval-and-compile (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") ("marmalade" . "http://marmalade-repo.org/packages/") -- cgit 1.4.1 From e27ebd733b0b7b18967beb732734db5d88afdf25 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 7 Jul 2016 20:30:28 +0200 Subject: Add very basic fish config --- tag-fish/config/fish/config.fish | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 tag-fish/config/fish/config.fish diff --git a/tag-fish/config/fish/config.fish b/tag-fish/config/fish/config.fish new file mode 100755 index 00000000..34cd22ec --- /dev/null +++ b/tag-fish/config/fish/config.fish @@ -0,0 +1,2 @@ +set PATH $PATH /home/alan/bin +setenv SSH_AUTH_SOCK $XDG_RUNTIME_DIR/ssh-agent.socket -- cgit 1.4.1 From a7d0f41f8f9b676b7a9be4fe8cf760db8ed8ad47 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 7 Jul 2016 20:34:42 +0200 Subject: zsh: Export SSH_AUTH_SOCK if needed --- tag-zsh/config/zsh/zshenv | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index d5ef76a1..3e8d1da8 100644 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -3,4 +3,9 @@ then . $ZDOTDIR/zshenv.local fi -ZPLUG_HOME=${ZPLUG_HOME:-~/projects/zplug} \ No newline at end of file +ZPLUG_HOME=${ZPLUG_HOME:-~/projects/zplug} + +if [[ -z $SSH_AUTH_SOCK ]] +then + export SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/ssh-agent.socket +fi -- cgit 1.4.1 From feff88339a38ab185e29c0b99ebe6033bdc6241c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Jul 2016 22:07:02 +0200 Subject: zsh: Fix pure startup --- tag-zsh/config/zsh/zshrc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 7d57417a..0004ec76 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -61,6 +61,11 @@ then AUTOENV_LOOK_UPWARDS=1 fi +if zplug check sindresorhus/pure +then + PURE_GIT_PULL=0 +fi + # Then, source plugins and add commands to $PATH zplug load @@ -74,7 +79,6 @@ fi if zplug check sindresorhus/pure then - PURE_GIT_PULL=0 autoload -Uz promptinit && promptinit prompt pure &> /dev/null fi -- cgit 1.4.1 From b6f4a9d1c20c0edb7d028aede13e27bf10f08637 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Jul 2016 22:14:30 +0200 Subject: zsh: Limit loaded files in async/pure --- tag-zsh/config/zsh/zshrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 0004ec76..25bccf93 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -2,8 +2,8 @@ source ${ZPLUG_HOME:-~/projects/zplug}/init.zsh zplug "zsh-users/zsh-completions" -zplug "mafredri/zsh-async" -zplug "sindresorhus/pure", on:"mafredri/zsh-async" +zplug "mafredri/zsh-async", use:async.zsh +zplug "sindresorhus/pure", on:"mafredri/zsh-async", as:plugin, use:pure.zsh zplug "Tarrasch/zsh-autoenv", as:plugin zplug "clvv/fasd", hook-build:"PREFIX=$HOME make install" zplug "tymm/zsh-directory-history", as:command, use:"dir{hist,log}" -- cgit 1.4.1 From bd926ad8948477431162e45e02fd4490466142be Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Jul 2016 22:15:09 +0200 Subject: Update rcrc tags --- host-prefect/rcrc.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host-prefect/rcrc.local b/host-prefect/rcrc.local index 060c7001..3b80dd6e 100644 --- a/host-prefect/rcrc.local +++ b/host-prefect/rcrc.local @@ -1,2 +1,2 @@ DOTFILES_DIRS="$HOME/projects/dotfiles" -TAGS="emacs git hg clojure sakura ssh tmux vagrant xresources xmonad xmobar zsh" +TAGS="emacs git hg clojure ssh zsh" -- cgit 1.4.1 From ae2081e978e64153d64409b03f63c37cf453c1bc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Jul 2016 22:15:22 +0200 Subject: Simplify pure prompt symbol on Windows --- host-prefect/config/zsh/zshenv.local | 1 + 1 file changed, 1 insertion(+) create mode 100644 host-prefect/config/zsh/zshenv.local diff --git a/host-prefect/config/zsh/zshenv.local b/host-prefect/config/zsh/zshenv.local new file mode 100644 index 00000000..8ed2dc3d --- /dev/null +++ b/host-prefect/config/zsh/zshenv.local @@ -0,0 +1 @@ +PURE_PROMPT_SYMBOL='>' -- cgit 1.4.1 From 21aabc84a4e10509cf1a5ce94142684ab991c47a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Jul 2016 22:53:27 +0200 Subject: Emacs: Use Liberation Mono on Windows --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 4c0e2593..8427a77b 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -220,7 +220,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (interactive) (cond ((eq window-system 'w32) - (ap/set-fonts "Consolas" 10 "Segoe UI" 11 t)) + (ap/set-fonts "Liberation Mono" 11 "Segoe UI" 11 t)) ((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) -- cgit 1.4.1 From ba995d986b533881c949ba4035e35fe36fe4eeb8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Jul 2016 22:54:01 +0200 Subject: Emacs: Fix display of page break lines adaptively --- tag-emacs/emacs.d/init.org | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 8427a77b..13f42bfb 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -242,12 +242,20 @@ on the right things. ** Page Breaks By default, Emacs displays page breaks as ^L. Lines look much nicer. +On Windows, Emacs incorrectly detects that U+2500 (Box Drawings Light +Horizontal) can only be displayed with a different font, which is not +correct, at least for Liberation Mono. #+BEGIN_SRC emacs-lisp (use-package page-break-lines :defer 5 :diminish page-break-lines-mode - :config (global-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 -- cgit 1.4.1 From c7882b51fa2bf967d7a357690ecc14e1958a162d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 11 Jul 2016 11:46:00 +0200 Subject: Emacs: Don’t flycheck whilst idle --- 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 13f42bfb..5efc3d83 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1636,7 +1636,9 @@ On-the-fly error checking in programming modes? Yes please. (use-package flycheck :diminish " ✓" :defer 5 - :config (global-flycheck-mode)) + :config (progn + (global-flycheck-mode) + (setq flycheck-check-syntax-automatically '(save new-line mode-enabled)))) #+END_SRC ** golang -- cgit 1.4.1 From 7f310bdc9950bd5b0ae18bba6967990a0d699c1c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 Jul 2016 14:07:51 +0200 Subject: zsh: Only build environment in top-level shell --- tag-zsh/config/zsh/zshenv | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index 3e8d1da8..98050a0d 100644 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -1,11 +1,14 @@ -if [[ -f $ZDOTDIR/zshenv.local ]] +if [[ $SHLVL = 1 ]] then - . $ZDOTDIR/zshenv.local -fi + if [[ -f $ZDOTDIR/zshenv.local ]] + then + . $ZDOTDIR/zshenv.local + 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 + if [[ -z $SSH_AUTH_SOCK ]] + then + export SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/ssh-agent.socket + fi fi -- cgit 1.4.1 From e11731541fa845777aae3a3f5a666c88f1f7218d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 Jul 2016 14:12:05 +0200 Subject: zsh: Configure completion --- tag-zsh/config/zsh/zshrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 25bccf93..99a14d35 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -54,6 +54,9 @@ alias llr="ll -t" bindkey '\e[3~' delete-char +zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' '+m:{A-Z}={a-z}' +zstyle ':completion:*' completer _expand _complete _match + if zplug check Tarrasch/zsh-autoenv then AUTOENV_FILE_ENTER=.envrc -- cgit 1.4.1 From ae6a3d4cde4cada53967c752c6acd348ac2a50cd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 14 Jul 2016 10:13:38 +0200 Subject: zsh: Switch to my fork of directory-history --- tag-zsh/config/zsh/zshrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 99a14d35..a14104e2 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -6,8 +6,8 @@ zplug "mafredri/zsh-async", use:async.zsh zplug "sindresorhus/pure", on:"mafredri/zsh-async", as:plugin, use:pure.zsh zplug "Tarrasch/zsh-autoenv", as:plugin zplug "clvv/fasd", hook-build:"PREFIX=$HOME make install" -zplug "tymm/zsh-directory-history", as:command, use:"dir{hist,log}" -zplug "tymm/zsh-directory-history", as:plugin +zplug "alanpearce/zsh-directory-history", at:"dirlog-as-zsh-function", as:command, use:"dirhist" +zplug "alanpearce/zsh-directory-history", at:"dirlog-as-zsh-function", as:plugin WORDCHARS=${${WORDCHARS//[-.]}//[\/]} @@ -104,7 +104,7 @@ then fi fi -if zplug check tymm/zsh-directory-history +if zplug check alanpearce/zsh-directory-history then unsetopt flow_control # Let me use ^S and ^Q # bindkey '\e[A' directory-history-search-backward -- cgit 1.4.1 From b6464ffdea4578828c9abdf3b3d2dd2799676f85 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 14 Jul 2016 10:36:21 +0200 Subject: zsh: Install open-pr plugin --- tag-zsh/config/zsh/zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index a14104e2..9a85643d 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -8,6 +8,7 @@ zplug "Tarrasch/zsh-autoenv", as:plugin zplug "clvv/fasd", hook-build:"PREFIX=$HOME make install" zplug "alanpearce/zsh-directory-history", at:"dirlog-as-zsh-function", as:command, use:"dirhist" zplug "alanpearce/zsh-directory-history", at:"dirlog-as-zsh-function", as:plugin +zplug "caarlos0/zsh-open-pr", as:plugin WORDCHARS=${${WORDCHARS//[-.]}//[\/]} -- cgit 1.4.1 From d373f6e27091bde2553466a83766fc096982be9e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 14 Jul 2016 10:49:36 +0200 Subject: zsh: Add argument-wise word commands --- tag-zsh/config/zsh/zshrc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 9a85643d..6e034e9e 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -55,6 +55,29 @@ alias llr="ll -t" bindkey '\e[3~' delete-char +backward-argument () { + local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\"" + zle backward-word +} + +forward-argument () { + local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\"" + zle forward-word +} + +kill-argument () { + local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\"" + zle backward-argument + zle kill-word +} + +zle -N backward-argument +zle -N forward-argument +zle -N kill-argument +bindkey '\e^b' backward-argument +bindkey '\e^f' forward-argument +bindkey '\e^k' kill-argument + zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' '+m:{A-Z}={a-z}' zstyle ':completion:*' completer _expand _complete _match -- cgit 1.4.1 From d572253f235621e4575d9328232d76eefce20a0f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 14 Jul 2016 10:53:46 +0200 Subject: zsh: Add historic word completion to M-Tab --- 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 6e034e9e..3879f6a0 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -78,6 +78,10 @@ bindkey '\e^b' backward-argument bindkey '\e^f' forward-argument bindkey '\e^k' kill-argument +zle -C hist-complete complete-word _generic +zstyle ':completion:hist-complete:*' completer _history +bindkey '\e ' hist-complete + zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' '+m:{A-Z}={a-z}' zstyle ':completion:*' completer _expand _complete _match -- cgit 1.4.1 From a8dec38180ea0fc6f9b509b32c1963a220c829c1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 14 Jul 2016 18:17:18 +0200 Subject: zsh: Fix zsh envvars in X11 terminals --- tag-zsh/config/zsh/zshenv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index 98050a0d..6c3721f8 100644 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -1,4 +1,4 @@ -if [[ $SHLVL = 1 ]] +if [[ $SHLVL -eq 1 || (-n $DISPLAY && $SHLVL -lt 3) ]] then if [[ -f $ZDOTDIR/zshenv.local ]] then -- cgit 1.4.1 From 7d1dff7136362abe33f9ff6f80efa431013e9c26 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 14 Jul 2016 18:20:50 +0200 Subject: zsh: Set ZPLUG_HOME once --- tag-zsh/config/zsh/zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 3879f6a0..6cb21c94 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -1,5 +1,5 @@ # -*- mode: sh; -*- -source ${ZPLUG_HOME:-~/projects/zplug}/init.zsh +source $ZPLUG_HOME/init.zsh zplug "zsh-users/zsh-completions" zplug "mafredri/zsh-async", use:async.zsh -- cgit 1.4.1 From 4d832b9e85bc291cb82e0675fd121799aa639e16 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 15 Jul 2016 09:19:20 +0200 Subject: zsh: Install Jira plugin --- tag-zsh/config/zsh/zshrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 6cb21c94..33ebe665 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -9,6 +9,10 @@ zplug "clvv/fasd", hook-build:"PREFIX=$HOME make install" zplug "alanpearce/zsh-directory-history", at:"dirlog-as-zsh-function", as:command, use:"dirhist" zplug "alanpearce/zsh-directory-history", at:"dirlog-as-zsh-function", as:plugin zplug "caarlos0/zsh-open-pr", as:plugin +if [[ ${(SN)HOST%spotcap} ]] +then + zplug "gerges/oh-my-zsh-jira-plus", as:plugin +fi WORDCHARS=${${WORDCHARS//[-.]}//[\/]} @@ -97,6 +101,11 @@ then PURE_GIT_PULL=0 fi +if zplug check gerges/oh-my-zsh-jira-plus +then + JIRA_RAPID_BOARD=true +fi + # Then, source plugins and add commands to $PATH zplug load -- cgit 1.4.1 From a87c297556fb2367fd8e751955b92bc36371752d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 15 Jul 2016 09:32:53 +0200 Subject: zsh: Install autopair plugin --- tag-zsh/config/zsh/zshrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 33ebe665..cb18bea7 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -14,6 +14,8 @@ then zplug "gerges/oh-my-zsh-jira-plus", as:plugin fi +zplug "hlissner/zsh-autopair", nice:10 + WORDCHARS=${${WORDCHARS//[-.]}//[\/]} if [[ ${path[(I)$HOME/bin ]} ]] -- cgit 1.4.1 From ac1097615a7a2b427f6242443c57945df75eedf2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 15 Jul 2016 09:41:41 +0200 Subject: zsh: Install nix completions plugin --- tag-zsh/config/zsh/zshrc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index cb18bea7..633d70d7 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -9,6 +9,12 @@ zplug "clvv/fasd", hook-build:"PREFIX=$HOME make install" zplug "alanpearce/zsh-directory-history", at:"dirlog-as-zsh-function", as:command, use:"dirhist" zplug "alanpearce/zsh-directory-history", at:"dirlog-as-zsh-function", as:plugin 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) +fi + if [[ ${(SN)HOST%spotcap} ]] then zplug "gerges/oh-my-zsh-jira-plus", as:plugin -- cgit 1.4.1 From 9a5995c3f342052340702dcd18fab2bcba40da57 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 15 Jul 2016 09:44:29 +0200 Subject: Inline zplug conditional --- tag-zsh/config/zsh/zshrc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 633d70d7..2fc024c7 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -15,11 +15,7 @@ then fpath=($fpath $ZPLUG_REPOS/spwhitt/nix-zsh-completions) fi -if [[ ${(SN)HOST%spotcap} ]] -then - zplug "gerges/oh-my-zsh-jira-plus", as:plugin -fi - +zplug "gerges/oh-my-zsh-jira-plus", as:plugin, if:"[[ ${(SN)HOST%spotcap} ]]" zplug "hlissner/zsh-autopair", nice:10 WORDCHARS=${${WORDCHARS//[-.]}//[\/]} -- cgit 1.4.1 From 2b2c9cf8c419be69dfa97bea4cc364ee99e9f006 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 15 Jul 2016 09:57:55 +0200 Subject: zsh: Install better npm completion --- tag-zsh/config/zsh/zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 2fc024c7..9a57bcff 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -9,6 +9,7 @@ zplug "clvv/fasd", hook-build:"PREFIX=$HOME make install" zplug "alanpearce/zsh-directory-history", at:"dirlog-as-zsh-function", as:command, use:"dirhist" zplug "alanpearce/zsh-directory-history", at:"dirlog-as-zsh-function", as:plugin zplug "caarlos0/zsh-open-pr", as:plugin +zplug "lukechilds/zsh-better-npm-completion", if:"[[ -n $commands[npm] ]]" if [[ -n $commands[nix-env] ]] then zplug "spwhitt/nix-zsh-completions", as:plugin -- cgit 1.4.1 From 4e44f51adb63fdf0284dfdf605fbd3231f62e1e0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 15 Jul 2016 12:34:43 +0200 Subject: zsh: Load npm completion after compinit --- tag-zsh/config/zsh/zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 9a57bcff..f51ed45c 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -9,7 +9,6 @@ zplug "clvv/fasd", hook-build:"PREFIX=$HOME make install" zplug "alanpearce/zsh-directory-history", at:"dirlog-as-zsh-function", as:command, use:"dirhist" zplug "alanpearce/zsh-directory-history", at:"dirlog-as-zsh-function", as:plugin zplug "caarlos0/zsh-open-pr", as:plugin -zplug "lukechilds/zsh-better-npm-completion", if:"[[ -n $commands[npm] ]]" if [[ -n $commands[nix-env] ]] then zplug "spwhitt/nix-zsh-completions", as:plugin @@ -17,6 +16,7 @@ then fi 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 WORDCHARS=${${WORDCHARS//[-.]}//[\/]} -- cgit 1.4.1 From 71f71ef2c6bd56f8847f907be708327d660ef094 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 16 Jul 2016 13:48:17 +0200 Subject: rcm: Make rcrc work on FreeBSD --- rcrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rcrc b/rcrc index 9d469dcb..65a384ba 100644 --- a/rcrc +++ b/rcrc @@ -1,3 +1,3 @@ EXCLUDES="Brewfile LaunchAgents README.org" DOTFILES_DIRS="$HOME/projects/dotfiles" -[[ -e ~/.rcrc.local ]] && source ~/.rcrc.local \ No newline at end of file +[ -e ~/.rcrc.local ] && source ~/.rcrc.local \ No newline at end of file -- cgit 1.4.1 From 0488ac0c84c0cb52e12c8168d700de15d6b0cda9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 16 Jul 2016 13:49:29 +0200 Subject: rcm: Make rcrc work better on FreeBSD --- rcrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rcrc b/rcrc index 65a384ba..112aae61 100644 --- a/rcrc +++ b/rcrc @@ -1,3 +1,3 @@ EXCLUDES="Brewfile LaunchAgents README.org" DOTFILES_DIRS="$HOME/projects/dotfiles" -[ -e ~/.rcrc.local ] && source ~/.rcrc.local \ No newline at end of file +[ -e ~/.rcrc.local ] && . ~/.rcrc.local \ No newline at end of file -- cgit 1.4.1 From ce35b894a65435cbb64c7a807c67429957563ee8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 18 Jul 2016 09:57:23 +0200 Subject: zsh: Add describe-key-briefly keybind --- tag-zsh/config/zsh/zshrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index f51ed45c..3e568cd4 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -64,6 +64,8 @@ alias llr="ll -t" bindkey '\e[3~' delete-char +bindkey '\C-hd' describe-key-briefly + backward-argument () { local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\"" zle backward-word -- cgit 1.4.1 From a58e033e366f7a5776e6d53ac45b44a426aadbd2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 19 Jul 2016 12:47:01 +0200 Subject: zsh: Setup SSH auth sock if empty --- tag-zsh/config/zsh/zshrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 3e568cd4..7fcacd3a 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -96,6 +96,11 @@ 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) +fi + if zplug check Tarrasch/zsh-autoenv then AUTOENV_FILE_ENTER=.envrc -- cgit 1.4.1 From 0f756df9afe3476cd4bef8fac54a5cbdb93080e8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 19 Jul 2016 12:55:36 +0200 Subject: zsh: Improve use of pure prompt - Don’t initialise it in a dumb terminal - Fallback to a “light” version if it’s not installed --- tag-zsh/config/zsh/zshrc | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 7fcacd3a..ddcdfbd7 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -2,8 +2,8 @@ source $ZPLUG_HOME/init.zsh zplug "zsh-users/zsh-completions" -zplug "mafredri/zsh-async", use:async.zsh -zplug "sindresorhus/pure", on:"mafredri/zsh-async", as:plugin, use:pure.zsh +zplug "mafredri/zsh-async", use:async.zsh, if:"[[ $TERM != \"dumb\" ]]" +zplug "sindresorhus/pure", on:"mafredri/zsh-async", as:plugin, use:pure.zsh, if:"[[ $TERM != \"dumb\" ]]" zplug "Tarrasch/zsh-autoenv", as:plugin zplug "clvv/fasd", hook-build:"PREFIX=$HOME make install" zplug "alanpearce/zsh-directory-history", at:"dirlog-as-zsh-function", as:command, use:"dirhist" @@ -129,10 +129,37 @@ then autoload -U compinit && compinit fi -if zplug check sindresorhus/pure +if [[ $TERM == "dumb" ]] then - autoload -Uz promptinit && promptinit - prompt pure &> /dev/null + PROMPT="> " +else + if zplug check sindresorhus/pure + then + autoload -Uz promptinit && promptinit + prompt pure &> /dev/null + else + autoload -Uz vcs_info + + zstyle ':vcs_info:*' enable git + zstyle ':vcs_info:*' use-simple true + # only export two msg variables from vcs_info + zstyle ':vcs_info:*' max-exports 2 + # vcs_info_msg_0_ = ' %b' (for branch) + # vcs_info_msg_1_ = 'x%R' git top level (%R), x-prefix prevents creation of a named path (AUTO_NAME_DIRS) + zstyle ':vcs_info:git*' formats ' %b' 'x%R' + zstyle ':vcs_info:git*' actionformats ' %b|%a' 'x%R' + + # 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' + + setopt prompt_subst + setopt prompt_cr + PROMPT='%F{blue}%~%f%F{242}${vcs_info_msg_0_}%f${prompt_pure_username} +%(?.%F{magenta}.%F{red})>%f ' + fi fi if zplug check clvv/fasd -- cgit 1.4.1 From 84e5cb9fcc9faa1c846e12ec7234e24c18f1fab7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 22 Jul 2016 14:40:22 +0200 Subject: zsh: Bind directory-history search keys --- tag-zsh/config/zsh/zshrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index ddcdfbd7..63384f55 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -183,8 +183,8 @@ fi if zplug check alanpearce/zsh-directory-history then unsetopt flow_control # Let me use ^S and ^Q - # bindkey '\e[A' directory-history-search-backward - # bindkey '\e[B' directory-history-search-forward + bindkey '\e[B' directory-history-search-backward + bindkey '\e[A' directory-history-search-forward bindkey -M emacs '^R' history-substring-search-up bindkey -M emacs '^S' history-substring-search-down -- cgit 1.4.1 From 11b2efdab5fad273d0dc98c92ae226d7fdb2388a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 23 Jul 2016 11:59:58 +0200 Subject: Emacs: Split windows horizontally more --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 5efc3d83..40317634 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -888,7 +888,7 @@ point whilst I’m moving about. scroll-preserve-screen-position t mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control))) split-height-threshold 80 - split-width-threshold 160 + split-width-threshold 130 frame-resize-pixelwise nil) (if (boundp 'ns-pop-up-frames) (setq ns-pop-up-frames nil)) -- cgit 1.4.1 From 7c34e2c2a2315b1d4a59b5f20809b17a738c1674 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 25 Jul 2016 16:22:31 +0200 Subject: Remove old gitmodules file --- .gitmodules | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index af62d6e4..00000000 --- a/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "tag-zsh/config/zsh/per-directory-history"] - path = tag-zsh/config/zsh/per-directory-history - url = git://github.com/jimhester/per-directory-history.git -[submodule "tag-git/config/git/template"] - path = tag-git/config/git/template - url = git@github.com:alanpearce/git_template.git -- cgit 1.4.1 From 242e87a0eb6c5e452f5132e0aad08f7f3cec204f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 31 Jul 2016 18:27:12 +0200 Subject: Bind directory history keys more portably --- tag-zsh/config/zsh/zshrc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 63384f55..da63e647 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -62,6 +62,8 @@ alias lal="ll -A" alias lla="lal" alias llr="ll -t" +zmodload zsh/terminfo + bindkey '\e[3~' delete-char bindkey '\C-hd' describe-key-briefly @@ -183,8 +185,8 @@ fi if zplug check alanpearce/zsh-directory-history then unsetopt flow_control # Let me use ^S and ^Q - bindkey '\e[B' directory-history-search-backward - bindkey '\e[A' directory-history-search-forward + bindkey "$terminfo[kcuu1]" directory-history-search-backward + bindkey "$terminfo[kcud1]" directory-history-search-forward bindkey -M emacs '^R' history-substring-search-up bindkey -M emacs '^S' history-substring-search-down -- cgit 1.4.1 From d5c79a6dfb57d24523ce0aaeb2e17b26cf07d963 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 31 Jul 2016 18:28:26 +0200 Subject: zsh: Add extra newline to dumb pure prompt --- tag-zsh/config/zsh/zshrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index da63e647..d7da3dab 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -159,7 +159,8 @@ else setopt prompt_subst setopt prompt_cr - PROMPT='%F{blue}%~%f%F{242}${vcs_info_msg_0_}%f${prompt_pure_username} + PROMPT=' +%F{blue}%~%f%F{242}${vcs_info_msg_0_}%f${prompt_pure_username} %(?.%F{magenta}.%F{red})>%f ' fi fi -- cgit 1.4.1 From 89a9b4c1ee8ec9fd76e3ee559da6bc81c2bb315e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 12 Aug 2016 15:55:04 +0200 Subject: Emacs: Delete to trash correctly on OSX --- tag-emacs/emacs.d/init.org | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 40317634..a89a4c5d 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -518,7 +518,12 @@ trash for deleting on OS X. backup-by-copying-when-linked t backup-by-copying-when-mismatch t)) (if (eq system-type 'darwin) - (setq delete-by-moving-to-trash t)) + (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 -- cgit 1.4.1 From 187e5e28a32e4e55b26142eae5400af19a854fbf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 12 Aug 2016 15:55:21 +0200 Subject: Emacs: Setup scala environment --- tag-emacs/emacs.d/init.org | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index a89a4c5d..87cd664f 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1882,6 +1882,22 @@ really seem to use it. :bind (("C-c C-e" . quickrun))) #+END_SRC +** Scala + +Let’s try using Scala. + +#+BEGIN_SRC emacs-lisp + (use-package scala-mode + :pin melpa-stable) +#+END_SRC + +And add ensime, an IDE-style environment. + +#+BEGIN_SRC emacs-lisp + (use-package ensime + :pin melpa-stable) +#+END_SRC + ** Web development *** js2-mode -- cgit 1.4.1 From 62a8fbc7892d53ee81caaa8361ca6407976245f0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 2 Sep 2016 14:37:44 +0200 Subject: Emacs: Workaround strange menu error --- 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 87cd664f..21228f41 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1917,7 +1917,8 @@ it though (define-key js2-mode-map [menu-bar Javascript] nil) (defun js2--imenu-around (do-it name) "Don't create a menu from js2-mode" - (unless (string-equal name "IM-Javascript-IDE") + (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) -- cgit 1.4.1 From 1333da407a8ab2a898d006411384d8e08c8e3481 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 9 Sep 2016 16:06:46 +0200 Subject: Emacs: Always antialias (vector) fonts on OSX I don’t need to disable anti-aliasing for fonts on OSX when using a bitmap font. This way, it’s easier if I want to switch fonts. --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 21228f41..98314470 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -225,7 +225,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (let ((displays (string-to-number (shell-command-to-string "system_profiler SPDisplaysDataType | grep \"Online: Yes\" | wc -l")))) (if (eq displays 1) (ap/set-fonts "PT Mono" 12 "Lucide Grande" 12 t) - (ap/set-fonts "ProggyTiny" 11 "Lucida Grande" 12 nil)))) + (ap/set-fonts "ProggyTiny" 11 "Lucida Grande" 12 t)))) ((eq window-system 'x) (ap/set-fonts "Source Code Pro" 10 "Input Sans" 10 t)))) -- cgit 1.4.1 From 00a42716df66a66ab6e58fbf57ab6621b774c7d2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 9 Sep 2016 16:07:47 +0200 Subject: Emacs: Use Monoid as single-screen font --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 98314470..824fa085 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -224,7 +224,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource ((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 "PT Mono" 12 "Lucide Grande" 12 t) + (ap/set-fonts "Monoid" 12 "Lucide Grande" 12 t) (ap/set-fonts "ProggyTiny" 11 "Lucida Grande" 12 t)))) ((eq window-system 'x) (ap/set-fonts "Source Code Pro" 10 "Input Sans" 10 t)))) -- cgit 1.4.1 From 207f441b23c51eb33f4c26fde7208e1a6e6fed72 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 9 Sep 2016 16:13:16 +0200 Subject: zsh: Simplify prompt Remove pure and git information --- tag-zsh/config/zsh/zshrc | 44 ++++++++++---------------------------------- 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index d7da3dab..00915ea7 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -2,8 +2,6 @@ source $ZPLUG_HOME/init.zsh zplug "zsh-users/zsh-completions" -zplug "mafredri/zsh-async", use:async.zsh, if:"[[ $TERM != \"dumb\" ]]" -zplug "sindresorhus/pure", on:"mafredri/zsh-async", as:plugin, use:pure.zsh, if:"[[ $TERM != \"dumb\" ]]" zplug "Tarrasch/zsh-autoenv", as:plugin zplug "clvv/fasd", hook-build:"PREFIX=$HOME make install" zplug "alanpearce/zsh-directory-history", at:"dirlog-as-zsh-function", as:command, use:"dirhist" @@ -110,11 +108,6 @@ then AUTOENV_LOOK_UPWARDS=1 fi -if zplug check sindresorhus/pure -then - PURE_GIT_PULL=0 -fi - if zplug check gerges/oh-my-zsh-jira-plus then JIRA_RAPID_BOARD=true @@ -135,34 +128,17 @@ if [[ $TERM == "dumb" ]] then PROMPT="> " else - if zplug check sindresorhus/pure - then - autoload -Uz promptinit && promptinit - prompt pure &> /dev/null - else - autoload -Uz vcs_info - - zstyle ':vcs_info:*' enable git - zstyle ':vcs_info:*' use-simple true - # only export two msg variables from vcs_info - zstyle ':vcs_info:*' max-exports 2 - # vcs_info_msg_0_ = ' %b' (for branch) - # vcs_info_msg_1_ = 'x%R' git top level (%R), x-prefix prevents creation of a named path (AUTO_NAME_DIRS) - zstyle ':vcs_info:git*' formats ' %b' 'x%R' - zstyle ':vcs_info:git*' actionformats ' %b|%a' 'x%R' - - # 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' - - setopt prompt_subst - setopt prompt_cr - PROMPT=' -%F{blue}%~%f%F{242}${vcs_info_msg_0_}%f${prompt_pure_username} + # 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' + + setopt prompt_subst + setopt prompt_cr + PROMPT=' +%F{blue}%~%f${prompt_pure_username} %(?.%F{magenta}.%F{red})>%f ' - fi fi if zplug check clvv/fasd -- cgit 1.4.1 From 67cab027564f0e932d93e73d4997e3a09f208482 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 10 Sep 2016 12:47:31 +0200 Subject: Emacs: Use ssh for tramp connections --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 824fa085..40509d15 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -654,7 +654,7 @@ that I can sudo on remote machines :config (progn (unless (getenv "SSH_AUTH_SOCK") (setenv "SSH_AUTH_SOCK" "/run/user/1000/ssh-agent.socket")) - (setq tramp-default-method (if (eq system-type 'windows-nt) "plinkx" "ssh") + (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) -- cgit 1.4.1 From 3400906be525fc17b24e17cb6389528129eb3385 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 10 Sep 2016 14:36:10 +0200 Subject: zsh: Remove newline before prompt --- tag-zsh/config/zsh/zshrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 00915ea7..f01625ae 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -136,8 +136,7 @@ else setopt prompt_subst setopt prompt_cr - PROMPT=' -%F{blue}%~%f${prompt_pure_username} + PROMPT='%F{blue}%~%f${prompt_pure_username} %(?.%F{magenta}.%F{red})>%f ' fi -- cgit 1.4.1 From c90a72740bffa5cd8ac24c01a795fa3e61207d8b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 16 Sep 2016 09:06:28 +0200 Subject: Add slate file --- host-ap-spotcap.local/slate | 55 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 host-ap-spotcap.local/slate diff --git a/host-ap-spotcap.local/slate b/host-ap-spotcap.local/slate new file mode 100644 index 00000000..05a50858 --- /dev/null +++ b/host-ap-spotcap.local/slate @@ -0,0 +1,55 @@ +config keyboardLayout colemak + +config defaultToCurrentScreen true +config nudgePercentOf screenSize +config resizePercentOf screenSize + +config windowHintsSpread true + +alias mon-laptop 1680x1050 +alias mon-work 1920x1200 +alias mon-home 2560x1440 + +alias 1-full throw 0 resize +alias 1-left push left bar-resize:screenSizeX/2 0 +alias 1-right push right bar-resize:screenSizeX/2 0 +alias 2-left push left bar-resize:screenSizeX/2 1 +alias 2-right push right bar-resize:screenSizeX/2 1 + +layout workLayout "Safari":REPEAT ${1-left} +layout workLayout "Emacs" ${1-right} +layout workLayout "Terminal" ${2-left} +layout workLayout "HipChat" ${2-right} + +layout portable "Emacs" ${1-full} + +default workLayout resolutions:${mon-laptop};${mon-work} +default portable resolutions:${mon-laptop} + +# Push Bindings +bind right:alt;cmd push right bar-resize:screenSizeX/2 +bind left:alt;cmd push left bar-resize:screenSizeX/2 +bind up:alt;cmd push up bar-resize:screenSizeY/2 +bind down:alt;cmd push down bar-resize:screenSizeY/2 + +# Throw Bindings +bind 1:ctrl;alt throw 0 resize +bind 2:ctrl;alt throw 1 resize +bind 3:ctrl;alt throw 2 resize +bind right:ctrl;alt;cmd throw right resize +bind left:ctrl;alt;cmd throw left resize +bind up:ctrl;alt;cmd throw up resize +bind down:ctrl;alt;cmd throw down resize + +bind f:cmd;shift move screenOriginX;screenOriginY screenSizeX;screenSizeY + +# Focus Bindings +bind right:cmd focus right +bind left:cmd focus left +bind up:cmd focus up +bind down:cmd focus down +bind up:cmd;shift focus behind +bind down:cmd;shift focus behind + +# Window Hints +bind esc:cmd hint setnriao -- cgit 1.4.1 From 73407ed6716d3edcf2c3431b345b3bfcd4cf3d4b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 19 Sep 2016 16:26:09 +0200 Subject: Emacs: Remove rainbow-mode --- tag-emacs/emacs.d/init.org | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 40509d15..1ce0473f 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -173,16 +173,6 @@ Let’s try a more minimal theme. (load-theme 'minimal-light t))) #+END_SRC -Colourise colour names in certain types of buffer. I don’t use this -in modes for webdev because [[web-mode]] includes that functionality. -#+BEGIN_SRC emacs-lisp -(use-package rainbow-mode - :commands (rainbow-turn-on - rainbow-turn-off) - :config (progn - (add-hook 'xmonad-mode-hook #'rainbow-turn-on))) -#+END_SRC - Highlighting quasi-quoted expressions in lisps is quite useful. #+BEGIN_SRC emacs-lisp (use-package highlight-stages -- cgit 1.4.1 From 37fe9b98b9ae0b1163a547cb17134caf051ebd0c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 19 Sep 2016 16:26:30 +0200 Subject: Emacs: Fix fonts in 25.1 --- tag-emacs/emacs.d/init.org | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 1ce0473f..0c9ac305 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -194,30 +194,30 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (variable-pitch-mode) (setq cursor-type 'bar)) - (defun ap/set-fonts (mono-face mono-font-size variable-face variable-font-size antialias) + (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 (concat mono-face "-" (number-to-string mono-font-size)))) + (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 (concat variable-face "-" - (number-to-string variable-font-size)))) - (when (boundp 'ns-antialias-text) - (setq ns-antialias-text antialias))) + (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 t)) + (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 "Lucide Grande" 12 t) - (ap/set-fonts "ProggyTiny" 11 "Lucida Grande" 12 t)))) + (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" 10 "Input Sans" 10 t)))) + (ap/set-fonts "Source Code Pro" 10 "Input Sans" 10)))) (ap/set-fonts-according-to-system)) #+END_SRC -- cgit 1.4.1 From 66228313f2f8389da0aa8395bce96e297b0ba87e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 19 Sep 2016 16:26:43 +0200 Subject: Emacs: Update package archive filtering (25.1) --- tag-emacs/emacs.d/init.org | 88 +++++++++++++--------------------------------- 1 file changed, 24 insertions(+), 64 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 0c9ac305..c66b7672 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -36,74 +36,34 @@ the buffer to be empty. ** Use-package #+BEGIN_SRC emacs-lisp - (defvar melpa-include-packages '(minimal-theme - highlight-stages - relative-buffers - dired+ - dired-subtree - dired-hacks-utils - dired-narrow - org-caldav - go-projectile - go-rename - go-guru - redshank - restclient - visual-regexp) - "Don't install any MELPA packages except these packages") - - (defvar package-filter-function nil - "Optional predicate function used to internally filter packages used by package.el. - - The function is called with the arguments PACKAGE VERSION ARCHIVE, where - PACKAGE is a symbol, VERSION is a vector as produced by `version-to-list', and - ARCHIVE is the string name of the package archive.") - - ;; Don't take MELPA versions of certain packages - (setq package-filter-function - (lambda (package version archive) - (or (not (string-equal archive "melpa")) - ;; install package in whitelist - (memq package melpa-include-packages) - ;; use all color themes - (string-match (format "%s" package) "-theme")))) - - (defadvice package--add-to-archive-contents - (around filter-packages (package archive) activate) - "Add filtering of available packages using `package-filter-function', if non-nil." - (when (or (null package-filter-function) - (funcall package-filter-function - (car package) - (funcall (if (fboundp 'package-desc-version) - 'package--ac-desc-version - 'package-desc-vers) - (cdr package)) - archive)) - ad-do-it)) - (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-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-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 -- cgit 1.4.1 From 253bd653edd2e6fa49b80277dc91dff26bf18d75 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 20 Sep 2016 07:37:02 +0200 Subject: Fix package-archive-priorities --- tag-emacs/emacs.d/init.org | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index c66b7672..25274308 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -45,10 +45,10 @@ the buffer to be empty. 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-archive-priorities '(("melpa-stable" . 10) + ("gnu" . 10) + ("marmalade" . 5) + ("melpa" . 0)) package-menu-hide-low-priority t) (package-initialize) (unless (package-installed-p 'use-package) -- cgit 1.4.1 From de2b3f63d42df53215727a8032b81887c1ea01bc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 20 Sep 2016 08:22:32 +0200 Subject: Emacs: Replace helm-dash with counsel-dash --- tag-emacs/emacs.d/init.org | 58 +++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 25274308..f1011e89 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1053,39 +1053,39 @@ improves the normal help commands, mostly by making quitting them easier. (use-package ehelp :bind-keymap ("C-h" . ehelp-map)) #+END_SRC -** helm-dash +** counsel-dash -Emacs’ documentation is great to read from inside Emacs. Helm-dash +Emacs’ documentation is great to read from inside Emacs. Counsel-dash helps to make documentation for other languages easier to access #+BEGIN_SRC emacs-lisp - (defmacro ap/create-helm-dash-hook (mode docsets) - (let* ((mode-s (symbol-name mode)) - (fun (intern (concat "helm-dash-hook-" mode-s))) - (hook (intern (concat mode-s "-mode-hook")))) - `(progn - (defun ,fun () - (when (require 'helm-dash nil :noerror) - (-each (-difference ',docsets - (helm-dash-installed-docsets)) - #'helm-dash-install-docset) - (setq-local helm-dash-docsets ',docsets))) - (add-hook (quote ,hook) (function ,fun))))) - - (use-package helm-dash - :defer 20 - :defines helm-dash-docsets - :config (progn - (setq helm-dash-browser-func #'eww) - (ap/create-helm-dash-hook nginx ("Nginx")) - (ap/create-helm-dash-hook ansible ("Ansible")) - (ap/create-helm-dash-hook php ("PHP" "Symfony")) - (ap/create-helm-dash-hook twig ("Twig")) - (ap/create-helm-dash-hook js2 ("JavaScript" "NodeJS" "jQuery" "Express" "SailsJS" "Lo-Dash")) - (ap/create-helm-dash-hook markdown ("Markdown")) - (ap/create-helm-dash-hook saltstack ("SaltStack")) - (ap/create-helm-dash-hook clojure ("Clojure")) - (ap/create-helm-dash-hook sql ("PostgreSQL" "MySQL")))) + (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))))) + + (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")))) #+END_SRC ** discover-my-major -- cgit 1.4.1 From 6f17aaee8d4e88db54d27ff8d59ab6c9a5935f78 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 20 Sep 2016 08:26:06 +0200 Subject: Emacs: Replace helm history commands with counsel --- tag-emacs/emacs.d/init.org | 60 +++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index f1011e89..76743a63 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1198,8 +1198,8 @@ Occasionally, I exit emacs. I should probably reduce the frequency of this. ** swiper/ivy -Ivy is the new kid on the completion block. I wonder if it can -replace helm and ido. +Ivy is the new kid on the completion block. It seems to be a strong +replacement for helm so far. #+BEGIN_SRC emacs-lisp (use-package swiper @@ -2026,28 +2026,28 @@ nice, when I remember to use it. #+BEGIN_SRC emacs-lisp (use-package eshell - :bind ("C-c s" . eshell) - :config (progn - (setq eshell-directory-name "~/.emacs.d/eshell") - (add-hook 'eshell-load-hook (lambda () - (bind-key "C-c C-l" #'helm-eshell-history eshell-mode-map))))) + :bind ("C-c s" . eshell) + :config (progn + (setq eshell-directory-name "~/.emacs.d/eshell") + (add-hook 'eshell-load-hook (lambda () + (bind-key "C-c C-l" #'counsel-esh-history eshell-mode-map))))) (use-package em-smart - :ensure nil - :commands eshell-smart-initialize - :init (progn - (add-hook 'eshell-load-hook #'eshell-smart-initialize)) - :config (progn - (setq eshell-where-to-jump 'begin - eshell-review-quick-commands nil - eshell-smart-space-goes-to-end t))) + :ensure nil + :commands eshell-smart-initialize + :init (progn + (add-hook 'eshell-load-hook #'eshell-smart-initialize)) + :config (progn + (setq eshell-where-to-jump 'begin + eshell-review-quick-commands nil + eshell-smart-space-goes-to-end t))) (autoload #'eshell/cd "em-dirs") (defun eshell-goto-current-dir (&optional arg) - (interactive "P") - (let ((dir default-directory)) - (eshell arg) - (eshell/cd dir))) + (interactive "P") + (let ((dir default-directory)) + (eshell arg) + (eshell/cd dir))) (bind-key "C-c S" #'eshell-goto-current-dir) @@ -2057,21 +2057,21 @@ nice, when I remember to use it. #+BEGIN_SRC emacs-lisp (use-package shell - :defer t - :ensure nil - :config (define-key shell-mode-map - (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) + :defer t + :ensure nil + :config (define-key shell-mode-map + (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) (use-package comint - :defer t - :ensure nil - :config (bind-key "C-c C-l" #'helm-comint-input-ring comint-mode-map)) + :defer t + :ensure nil + :config (bind-key "C-c C-l" #'counsel-shell-history comint-mode-map)) (defun comint-delchar-or-eof-or-kill-buffer (arg) - (interactive "p") - (if (null (get-buffer-process (current-buffer))) - (kill-buffer) - (comint-delchar-or-maybe-eof arg))) + (interactive "p") + (if (null (get-buffer-process (current-buffer))) + (kill-buffer) + (comint-delchar-or-maybe-eof arg))) #+END_SRC * Text editing -- cgit 1.4.1 From f4eaf9ac5632a6351969cc7e320c07faf05ede51 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 20 Sep 2016 08:29:00 +0200 Subject: Emacs: Remove recentf and virtual ivy buffers --- tag-emacs/emacs.d/init.org | 88 ++++++++++++++++++++-------------------------- 1 file changed, 38 insertions(+), 50 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 76743a63..6049bc39 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -582,17 +582,6 @@ for similar things any more. :bind ("M-SPC" . shrink-whitespace)) #+END_SRC -** recentf - -I only use this occasionally, but it’s nice for files outside of projects. - -#+BEGIN_SRC emacs-lisp -(use-package recentf - :init (progn (setq recentf-auto-cleanup 'never - recentf-save-file (expand-file-name "recentf" user-emacs-directory)) - (recentf-mode 1))) -#+END_SRC - ** Tramp Tramp is awesome. It makes SSH feel Unix-y. The proxy setup is so @@ -1203,45 +1192,44 @@ 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-use-virtual-buffers t - 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 -- cgit 1.4.1 From a3ce3fd20465c32c2469930527535b818d193cd4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 20 Sep 2016 08:41:20 +0200 Subject: Emacs: Setting tab-stop-list seems unnecessary --- tag-emacs/emacs.d/init.org | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 6049bc39..e3a60799 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -633,13 +633,8 @@ 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! #+BEGIN_SRC emacs-lisp -(setq-default tab-width 4 - indent-tabs-mode t) -(setq tab-stop-list - ;; (mapcar (lambda (x) - ;; (* 4 x)) - ;; (number-sequence 1 (/ 120 4))) - '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120)) + (setq-default tab-width 4 + indent-tabs-mode t) #+END_SRC ** auto-indent-mode -- cgit 1.4.1 From 0740f4cc679161eb80c519478839ce5333b16ca4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 20 Sep 2016 15:04:12 +0200 Subject: Emacs: Move goto-last-change binding C-x SPC is the default for rectangle-mark-mode, which is now more useful and intuitive in Emacs 25 --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index e3a60799..47020f5d 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2174,7 +2174,7 @@ and doesn’t go back to the same place more than once. #+BEGIN_SRC emacs-lisp (use-package goto-chg - :bind ("C-x SPC" . goto-last-change)) + :bind ("C-c C-SPC" . goto-last-change)) #+END_SRC ** multiple-cursors -- cgit 1.4.1 From 5954f807e873ca6c20287e726f6353dd5b795eee Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 20 Sep 2016 20:17:46 +0200 Subject: Emacs: Replace typo-mode with electric-quote-mode --- tag-emacs/emacs.d/init.org | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 47020f5d..14ec4a13 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2134,19 +2134,11 @@ from Sublime Text. As always, there’s a mode for that. ** Typography -I like using typographic symbols, but I don’t always remember (how) to -type them. +I like using typographic quotes, but they’re complicated to insert manually. +them. #+BEGIN_SRC emacs-lisp - (use-package typo - :config (progn - (typo-global-mode 1) - (setq-default typo-language "English") - (add-hook 'text-mode-hook #'typo-mode) - (defun typo-mode-turn-off () - (typo-mode -1)) - (add-hook 'yaml-mode-hook #'typo-mode-turn-off) - (add-hook 'jinja2-mode-hook #'typo-mode-turn-off))) + (electric-quote-mode) #+END_SRC ** avy -- cgit 1.4.1 From 2587fbbdc3fde08ee4d1ae2e5c82b832524c7808 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 20 Sep 2016 20:24:50 +0200 Subject: Emacs: Use async operations for package.el --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 14ec4a13..f8a23e64 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -49,6 +49,7 @@ the buffer to be empty. ("gnu" . 10) ("marmalade" . 5) ("melpa" . 0)) + package-menu-async t package-menu-hide-low-priority t) (package-initialize) (unless (package-installed-p 'use-package) -- cgit 1.4.1 From b9b86fcefd2bd47d8b42a7f48af4f4c1ea9f72d9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 21 Sep 2016 13:22:30 +0200 Subject: Emacs: Move avy-goto-word keybinding It was shadowing some useful keybinds, like M-s M-w (eww-search-words) --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index f8a23e64..19646d8a 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2152,7 +2152,7 @@ somehow I prefer it. :bind* (("M-g g" . avy-goto-line) ("M-g M-g" . avy-goto-line) ("C-|" . avy-goto-line) - ("M-s" . avy-goto-word-1) + ("M-r" . avy-goto-word-1) ("C-c SPC" . avy-goto-char-timer)) :config (progn (avy-setup-default) -- cgit 1.4.1 From d7dba4cfd5b335ae9b55c5abd58298ca6ef7af97 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 21 Sep 2016 13:31:32 +0200 Subject: Emacs: Resize fonts on linux Changing the specification of the font size caused the size to change somehow. This makes the fonts the same real size as before. --- tag-emacs/emacs.d/init.org | 66 +++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 19646d8a..99498749 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -148,39 +148,39 @@ 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" 10 "Input Sans" 10)))) - - (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" 12 "Lucida Grande" 12) + (ap/set-fonts "ProggyTiny" 11 "Lucida Grande" 12)))) + ((eq window-system 'x) + (ap/set-fonts "Source Code Pro" 13 "Input Sans" 13)))) + + (ap/set-fonts-according-to-system)) #+END_SRC Reduce font decoration. I’m trying to see whether this helps me focus -- cgit 1.4.1 From 73c3dc3c77b69da6444bfa198b77b60dd1edc874 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 23 Sep 2016 13:46:52 +0200 Subject: zsh: Add lunchy completion if installed --- tag-zsh/config/zsh/zshrc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index f01625ae..612908e3 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="> " -- cgit 1.4.1 From 3c4370e2d8f7cd4095df4a233cba9af84c77c8b1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 23 Sep 2016 13:47:37 +0200 Subject: Emacs: Use Monoid HalfTight on Retina display --- tag-emacs/emacs.d/init.org | 66 +++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 19646d8a..bf41b6a1 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -148,39 +148,39 @@ 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" 10 "Input Sans" 10)))) - - (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" 10 "Input Sans" 10)))) + + (ap/set-fonts-according-to-system)) #+END_SRC Reduce font decoration. I’m trying to see whether this helps me focus -- cgit 1.4.1 From 82f36d04b56cef52c5eaf652f7e787da49841931 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 23 Sep 2016 15:22:00 +0200 Subject: Don’t auto-update homebrew --- host-ap-spotcap.local/config/zsh/zshenv.local | 2 ++ 1 file changed, 2 insertions(+) diff --git a/host-ap-spotcap.local/config/zsh/zshenv.local b/host-ap-spotcap.local/config/zsh/zshenv.local index 35fe7a37..a5ec0b44 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 -- cgit 1.4.1 From 7a94af80a25376f7a0aafda9bdee2c6484fbcb6c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 23 Sep 2016 16:12:40 +0200 Subject: Emacs: Add mpc setup --- tag-emacs/emacs.d/init.org | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 20aaa397..1f5442da 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1566,6 +1566,15 @@ write to the Android calendar, and then for DAVDroid to sync with the server. 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 -- cgit 1.4.1 From 52a4a70473b7d229c2610e2df0c0332cd32a9152 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 24 Sep 2016 17:25:26 +0200 Subject: zsh: Hide right prompt --- tag-zsh/config/zsh/zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index f01625ae..0e57228e 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -128,6 +128,7 @@ if [[ $TERM == "dumb" ]] then PROMPT="> " else + unset RPROMPT # show username@host if logged in through SSH [[ "$SSH_CONNECTION" != '' ]] && prompt_pure_username=' %F{242}%n@%m%f' -- cgit 1.4.1 From 7839dae2e82b6c87019171903656decc344ab28f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 24 Sep 2016 17:25:41 +0200 Subject: Emacs: Use Liberation Sans on linux It’s more likely to be available --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 99498749..1f74f26b 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -178,7 +178,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (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 "Input Sans" 13)))) + (ap/set-fonts "Source Code Pro" 13 "Liberation Sans" 13)))) (ap/set-fonts-according-to-system)) #+END_SRC -- cgit 1.4.1 From 2a62d9d4607673c120a7014f70189140b020cdc1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 24 Sep 2016 19:03:49 +0200 Subject: Remove zsh-directory-history It was slow and I kept having issues --- tag-zsh/config/zsh/zshrc | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index cf28f446..08ba28c2 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -4,8 +4,6 @@ source $ZPLUG_HOME/init.zsh zplug "zsh-users/zsh-completions" zplug "Tarrasch/zsh-autoenv", as:plugin zplug "clvv/fasd", hook-build:"PREFIX=$HOME make install" -zplug "alanpearce/zsh-directory-history", at:"dirlog-as-zsh-function", as:command, use:"dirhist" -zplug "alanpearce/zsh-directory-history", at:"dirlog-as-zsh-function", as:plugin zplug "caarlos0/zsh-open-pr", as:plugin if [[ -n $commands[nix-env] ]] then @@ -167,12 +165,4 @@ then fi fi -if zplug check alanpearce/zsh-directory-history -then - unsetopt flow_control # Let me use ^S and ^Q - bindkey "$terminfo[kcuu1]" directory-history-search-backward - bindkey "$terminfo[kcud1]" directory-history-search-forward - - bindkey -M emacs '^R' history-substring-search-up - bindkey -M emacs '^S' history-substring-search-down -fi +unsetopt flow_control # Let me use ^S and ^Q -- cgit 1.4.1 From 33a879120f966608107829cd94daa16aaf53eee4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 25 Sep 2016 13:58:33 +0200 Subject: Emacs: Try smaller, unsmoothed fonts on X11 --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index ce1e6354..2b087eee 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -178,7 +178,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (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 "Terminus" 10 "Lucida" 10)))) (ap/set-fonts-according-to-system)) #+END_SRC -- cgit 1.4.1 From ea425580408e9a01b0b05e98acb1177e7176b750 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 25 Sep 2016 14:04:20 +0200 Subject: zsh: Add ds (directory size) function Shows size of subfolders, largest at the bottom. Easy to explore with. --- 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 08ba28c2..b4db1f42 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -87,6 +87,10 @@ bindkey '\e^b' backward-argument bindkey '\e^f' forward-argument bindkey '\e^k' kill-argument +ds () { + du -hd1 $1 | sort -h +} + zle -C hist-complete complete-word _generic zstyle ':completion:hist-complete:*' completer _history bindkey '\e ' hist-complete -- cgit 1.4.1 From 475b71a0822d9b6b4dac646949851d3ee49e6887 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 26 Sep 2016 09:38:36 +0200 Subject: Add Karabiner Elements configuration --- .../karabiner.d/configuration/karabiner.json | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tag-karabiner/karabiner.d/configuration/karabiner.json diff --git a/tag-karabiner/karabiner.d/configuration/karabiner.json b/tag-karabiner/karabiner.d/configuration/karabiner.json new file mode 100644 index 00000000..582da0ce --- /dev/null +++ b/tag-karabiner/karabiner.d/configuration/karabiner.json @@ -0,0 +1,26 @@ +{ + "profiles": [{ + "name": "Default Profile", + "selected": true, + "simple_modifications": { + "caps_lock": "delete_or_backspace", + "left_control": "left_command", + "left_command": "left_option", + "left_option": "left_control", + + "right_option": "right_control", + "right_command": "right_option", + "right_control": "right_command" + } + }, { + "name": "Macbook keyboard", + "simple_modifications": { + "caps_lock": "delete_or_backspace", + "non_us_backslash": "grave_accent_and_tilde", + "grave_accent_and_tilde": "non_us_backslash", + + "left_command": "left_control", + "right_command": "right_control" + } + }] +} -- cgit 1.4.1 From fe5a7815a298734860c375452d747cc7644f492b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 26 Sep 2016 17:11:17 +0200 Subject: Emacs: Add smartscan-mode Go to next/previous instance of symbol at point with M-n and M-p. M-' to replace all instances of symbol --- tag-emacs/emacs.d/init.org | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 2b087eee..54e049ed 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2247,6 +2247,16 @@ nice as the real version (add-hook 'coffee-mode-hook #'turn-off-smartparens-mode))) #+END_SRC +** smart-scan + +Move between instances of a symbol + +#+BEGIN_SRC emacs-lisp + (use-package smartscan + :config (progn + (smartscan-mode 1))) +#+END_SRC + ** move-text Transposing lines, made easier. -- cgit 1.4.1 From 896752d299eb1a8376215e540a753564976b2961 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 26 Sep 2016 17:12:05 +0200 Subject: Slate: Add keybind to set work layout --- host-ap-spotcap.local/slate | 2 ++ 1 file changed, 2 insertions(+) diff --git a/host-ap-spotcap.local/slate b/host-ap-spotcap.local/slate index 05a50858..72cfb022 100644 --- a/host-ap-spotcap.local/slate +++ b/host-ap-spotcap.local/slate @@ -26,6 +26,8 @@ layout portable "Emacs" ${1-full} default workLayout resolutions:${mon-laptop};${mon-work} default portable resolutions:${mon-laptop} +bind enter:ctrl layout workLayout + # Push Bindings bind right:alt;cmd push right bar-resize:screenSizeX/2 bind left:alt;cmd push left bar-resize:screenSizeX/2 -- cgit 1.4.1 From eaf4dd76604baa6b831b95035d76c5432adc1123 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 27 Sep 2016 08:09:29 +0200 Subject: Slate: Fix incorrect keybinding --- host-ap-spotcap.local/slate | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host-ap-spotcap.local/slate b/host-ap-spotcap.local/slate index 72cfb022..51169c19 100644 --- a/host-ap-spotcap.local/slate +++ b/host-ap-spotcap.local/slate @@ -26,7 +26,7 @@ layout portable "Emacs" ${1-full} default workLayout resolutions:${mon-laptop};${mon-work} default portable resolutions:${mon-laptop} -bind enter:ctrl layout workLayout +bind return:ctrl layout workLayout # Push Bindings bind right:alt;cmd push right bar-resize:screenSizeX/2 -- cgit 1.4.1 From 1accc02d12e064f454a9acadf1d5c1af62e65458 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 27 Sep 2016 14:17:08 +0200 Subject: Emacs: Use SF Mono font on macOS --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 54e049ed..ea69dad5 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -175,7 +175,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource ((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 "SF Mono" 12 "Lucida Grande" 12) (ap/set-fonts "ProggyTiny" 11 "Lucida Grande" 12)))) ((eq window-system 'x) (ap/set-fonts "Terminus" 10 "Lucida" 10)))) -- cgit 1.4.1 From 5fd2b8a8f56d43b4723040be3fa1eece9db30bac Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 28 Sep 2016 09:37:11 +0200 Subject: zsh: Source private zshenv if exists --- tag-zsh/config/zsh/zshenv | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index 6c3721f8..93893530 100644 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -5,6 +5,11 @@ then . $ZDOTDIR/zshenv.local fi + if [[ -f $ZDOTDIR/zshenv.private ]] + then + . $ZDOTDIR/zshenv.private + fi + ZPLUG_HOME=${ZPLUG_HOME:-~/projects/zplug} if [[ -z $SSH_AUTH_SOCK ]] -- cgit 1.4.1 From ac14b9229f990fe31f36ebba864708b23965a598 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 28 Sep 2016 15:52:31 +0200 Subject: Slate: Move focus keybindings cmd-arrows are often used in macOS itself, for finder and browsers --- host-ap-spotcap.local/slate | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/host-ap-spotcap.local/slate b/host-ap-spotcap.local/slate index 51169c19..da60e6f0 100644 --- a/host-ap-spotcap.local/slate +++ b/host-ap-spotcap.local/slate @@ -46,10 +46,10 @@ bind down:ctrl;alt;cmd throw down resize bind f:cmd;shift move screenOriginX;screenOriginY screenSizeX;screenSizeY # Focus Bindings -bind right:cmd focus right -bind left:cmd focus left -bind up:cmd focus up -bind down:cmd focus down +bind right:cmd;shift focus right +bind left:cmd;shift focus left +# bind up:cmd;shift focus up +# bind down:cmd;shift focus down bind up:cmd;shift focus behind bind down:cmd;shift focus behind -- cgit 1.4.1 From f80b7751d79ba8c641022e55f2992dbde9407c71 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 28 Sep 2016 16:52:39 +0200 Subject: zsh: Add ec alias --- tag-zsh/config/zsh/zshrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index b4db1f42..0dc62110 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -22,6 +22,8 @@ then path+=($HOME/bin) fi +alias ec=emacsclient + ls='\ls' gnu_ls_options="-v --group-directories-first --color=auto" gnu_ls_isodate="--time-style=long-iso" -- cgit 1.4.1 From ebdd9dd556f590a0f2d6e645555292d05d5533ee Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 28 Sep 2016 16:53:31 +0200 Subject: zsh: Set $EDITOR --- tag-zsh/config/zsh/zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 0dc62110..a816879d 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -22,6 +22,7 @@ then path+=($HOME/bin) fi +export EDITOR=emacsclient alias ec=emacsclient ls='\ls' -- cgit 1.4.1 From 1a8e7c9478f9d5f7190cf59458193f3303650b11 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 28 Sep 2016 17:02:43 +0200 Subject: zsh: Add function to open project from PWD or arg --- tag-zsh/config/zsh/zshrc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index a816879d..a133a7da 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -24,6 +24,13 @@ fi export EDITOR=emacsclient alias ec=emacsclient +alias open-project=projectile +_emacs_function () { + emacsclient -e "($1 \"$2\")" > /dev/null +} +projectile () { + _emacs_function projectile-switch-project-by-name ${1:-$PWD} +} ls='\ls' gnu_ls_options="-v --group-directories-first --color=auto" -- cgit 1.4.1 From de873fa7862854058e1c6ba85fdfc5e5457d34a2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 28 Sep 2016 19:47:07 +0200 Subject: Emacs: Install and configure nixos completions --- tag-emacs/emacs.d/init.org | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index ea69dad5..5d170656 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -899,6 +899,13 @@ seems to work perfectly well for me. :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))) +#+END_SRC + * Dates & Times ** Calendar -- cgit 1.4.1 From 987c7b55294c59c289b2440ba4d4c33a8126402f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 28 Sep 2016 19:47:34 +0200 Subject: Emacs: Show Assets:Budget in budget report --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 5d170656..405ef131 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1392,7 +1392,7 @@ works really nicely. ("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 (Cumulative)" "ledger -f %(ledger-file) bal -E \\^Funds \\^Assets:Budget$") ("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)))\\ -- cgit 1.4.1 From 77e71f8020c4dcbe29b0d1c7425e1ae5faa2a6a0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 29 Sep 2016 09:32:46 +0200 Subject: zsh: Add "hub" aliases again --- tag-zsh/config/zsh/zshrc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index a133a7da..2a37b508 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -136,6 +136,13 @@ then autoload -U compinit && compinit fi +if [[ -n $commands[hub] ]] +then + compdef _hub hub + alias git=hub + alias gh=hub +fi + if [[ -n $commands[lunchy] ]] then LUNCHY_DIR=$(dirname $(gem which lunchy))/../extras -- cgit 1.4.1 From 779a06009887201ca50ade43feda540fbaa690b5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 2 Oct 2016 18:22:06 +0200 Subject: Emacs: Use builtin function to create font-spec --- tag-emacs/emacs.d/init.org | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 405ef131..562d275b 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -155,17 +155,14 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (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))) + (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 (format-font variable-face "normal" variable-font-size)))) + (set-face-font 'variable-pitch (font-spec :name variable-face :size variable-font-size)))) (defun ap/set-fonts-according-to-system () (interactive) @@ -178,7 +175,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (ap/set-fonts "SF Mono" 12 "Lucida Grande" 12) (ap/set-fonts "ProggyTiny" 11 "Lucida Grande" 12)))) ((eq window-system 'x) - (ap/set-fonts "Terminus" 10 "Lucida" 10)))) + (ap/set-fonts "Terminus" 12 "Lucida" 10)))) (ap/set-fonts-according-to-system)) #+END_SRC -- cgit 1.4.1 From 43781516414d2b4fdfca49025da9832ccfc57686 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 2 Oct 2016 18:22:34 +0200 Subject: Emacs: Fix oversized euro sign on X11 Set fallback font as Terminus --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 562d275b..4401ef08 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -175,6 +175,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (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)) -- cgit 1.4.1 From b732c0c1071e9b05fda2e5206e5c70b8ffdf1891 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 4 Oct 2016 19:26:22 +0200 Subject: Emacs: Fix tramp prompt regexp for FreeBSD hosts --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 4401ef08..4c4603d0 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -600,7 +600,7 @@ that I can sudo on remote machines (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] *\\)*") + 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)) -- cgit 1.4.1 From 9f5adf96d04f246e4f6a081aba2c53c1c8eb47f1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 11 Oct 2016 21:03:46 +0200 Subject: Emacs: Replace simple functions with crux.el --- tag-emacs/emacs.d/init.org | 70 +++++++++++++++------------------------------- 1 file changed, 22 insertions(+), 48 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 405ef131..b1c69e76 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -306,6 +306,28 @@ Option/alt, then Control. (bind-key* "C-M-x" #'execute-extended-command) (set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) #+END_SRC + +** Crux + +I can replace most of the simple helper/wrapper functions in my +configuration with crux.el + +#+BEGIN_SRC emacs-lisp + (use-package crux + :bind (("C-o" . crux-smart-open-line-above) + ("M-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 @@ -516,36 +538,6 @@ I often want to rename or delete the file that I’m currently visiting 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))))))))) - - (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))))) - (defun kill-or-delete-this-buffer-dwim (&optional arg) "Kills current buffer. With prefix arg, delete it." (interactive "P") @@ -1704,24 +1696,6 @@ Interactive elisp (run-hooks 'lisp-mode-common-hook))))) #+END_SRC -I don’t only use this in elisp. It’s nice to do calculations in other -buffers too: it’s faster than quickrun and the parens mean that I -don’t have to worry about a selection. - -#+BEGIN_SRC emacs-lisp -(defun eval-and-replace () - "Replace the preceding sexp with its value." - (interactive) - (backward-kill-sexp) - (condition-case nil - (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 - *** Scheme & Lisp I don’t work with these as often as I would like -- cgit 1.4.1 From c1f33c842d6728b7c7f35faf04c07497fc0817eb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 14 Oct 2016 14:09:34 +0200 Subject: Emacs: Swap crux open-line keybinds --- tag-emacs/emacs.d/init.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 0c384ee5..2c330f40 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -312,8 +312,8 @@ configuration with crux.el #+BEGIN_SRC emacs-lisp (use-package crux - :bind (("C-o" . crux-smart-open-line-above) - ("M-o" . crux-smart-open-line) + :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) -- cgit 1.4.1 From e9dee8c3176c491b63bd498a52c67145cadf9551 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 14 Oct 2016 20:51:28 +0200 Subject: Use web-mode for normal html files --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 2c330f40..725f7ae7 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1942,7 +1942,7 @@ of them as well. #+BEGIN_SRC emacs-lisp (use-package web-mode :mode (("/views/.*\\.php\\'" . web-mode) - ("/layouts/.*\\.html\\'" . web-mode) + ("\\.html\\'" . web-mode) ("/templates/.*\\.php\\'" . web-mode) ("\\.ejs\\'" . web-mode)) :config (progn -- cgit 1.4.1 From ba25d60dc705901b1cd11db4ba1ab9220a12a3aa Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 14 Oct 2016 20:52:27 +0200 Subject: Don’t load tern.el if executable missing --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 725f7ae7..821d5af3 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1873,6 +1873,7 @@ completions, besides other IDE-like things. #+BEGIN_SRC emacs-lisp (use-package tern :commands ap/enable-tern + :if (executable-find "tern") :defer 5 :config (progn (setq tern-command (list (executable-find "tern"))) -- cgit 1.4.1 From 9a73df4dda6d8c8b835d1bbe76c9f23e5d8bceeb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 17 Oct 2016 15:30:55 +0200 Subject: Update karabiner.json --- .../karabiner.d/configuration/karabiner.json | 65 +++++++++++++--------- 1 file changed, 40 insertions(+), 25 deletions(-) diff --git a/tag-karabiner/karabiner.d/configuration/karabiner.json b/tag-karabiner/karabiner.d/configuration/karabiner.json index 582da0ce..4f78bb69 100644 --- a/tag-karabiner/karabiner.d/configuration/karabiner.json +++ b/tag-karabiner/karabiner.d/configuration/karabiner.json @@ -1,26 +1,41 @@ { - "profiles": [{ - "name": "Default Profile", - "selected": true, - "simple_modifications": { - "caps_lock": "delete_or_backspace", - "left_control": "left_command", - "left_command": "left_option", - "left_option": "left_control", - - "right_option": "right_control", - "right_command": "right_option", - "right_control": "right_command" - } - }, { - "name": "Macbook keyboard", - "simple_modifications": { - "caps_lock": "delete_or_backspace", - "non_us_backslash": "grave_accent_and_tilde", - "grave_accent_and_tilde": "non_us_backslash", - - "left_command": "left_control", - "right_command": "right_control" - } - }] -} + "profiles" : [ + { + "fn_function_keys" : { + "f12" : "volume_up", + "f9" : "vk_consumer_next", + "f5" : "vk_consumer_illumination_down", + "f10" : "mute", + "f1" : "vk_consumer_brightness_down", + "f6" : "vk_consumer_illumination_up", + "f2" : "vk_consumer_brightness_up", + "f7" : "vk_consumer_previous", + "f11" : "volume_down", + "f3" : "vk_mission_control", + "f8" : "vk_consumer_play", + "f4" : "vk_launchpad" + }, + "name" : "Default Profile", + "selected" : true, + "simple_modifications" : { + "left_control" : "left_command", + "right_control" : "right_command", + "left_option" : "left_control", + "caps_lock" : "delete_or_backspace", + "right_command" : "right_option", + "left_command" : "left_option", + "right_option" : "right_control" + } + }, + { + "name" : "Macbook keyboard", + "simple_modifications" : { + "left_command" : "left_control", + "caps_lock" : "delete_or_backspace", + "grave_accent_and_tilde" : "non_us_backslash", + "non_us_backslash" : "grave_accent_and_tilde", + "right_command" : "right_control" + } + } + ] +} \ No newline at end of file -- cgit 1.4.1 From 6ebfc7c5c6585836a0de12412a65b1419401301a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Oct 2016 12:09:54 +0200 Subject: Remove brew stuff --- brew.sh | 18 ------------------ host-ap-spotcap.local/config/zsh/zshenv.local | 3 --- 2 files changed, 21 deletions(-) delete mode 100644 brew.sh diff --git a/brew.sh b/brew.sh deleted file mode 100644 index 75988ec4..00000000 --- a/brew.sh +++ /dev/null @@ -1,18 +0,0 @@ -brew install android-platform-tools -brew install ansible -brew install gitup -brew install h2o -brew install launchdns -brew install mackup -brew install mariadb --with-archive-storage-engine --with-local-infile -brew tap homebrew/versions -brew install homebrew/versions/node4-lts --with-debug -brew install postgresql -brew install redis -brew install ssh-copy-id -brew install syncthing -brew install syncthing-inotify -brew install trash -brew install xhyve -brew install zplug -brew install zsh-completions diff --git a/host-ap-spotcap.local/config/zsh/zshenv.local b/host-ap-spotcap.local/config/zsh/zshenv.local index a5ec0b44..f6881be2 100644 --- a/host-ap-spotcap.local/config/zsh/zshenv.local +++ b/host-ap-spotcap.local/config/zsh/zshenv.local @@ -3,6 +3,3 @@ if [[ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]] then . $HOME/.nix-profile/etc/profile.d/nix.sh; fi -export ZPLUG_HOME=/usr/local/opt/zplug - -export HOMEBREW_NO_AUTO_UPDATE=1 -- cgit 1.4.1 From c9a5e8b8a412daa6160e0d6d64c40bd978a7259b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Oct 2016 22:22:25 +0200 Subject: Emacs: Fix error when connecting to daemon --- 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 821d5af3..a0d3ba92 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -560,7 +560,9 @@ open it. Whitespace butler fixes whitespace only for lines that I’m editing. :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 () + (use-package ws-butler + :config (ws-butler-global-mode 1))))) #+END_SRC ** shrink-whitespace -- cgit 1.4.1 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 "" #'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 "" #'counsel-M-x) + (bind-key "" #'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 @@ -1262,85 +1260,85 @@ 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 Setup some modes for systemd files #+BEGIN_SRC emacs-lisp -(add-to-list 'auto-mode-alist '("\\.service\\'" . conf-mode)) -(add-to-list 'auto-mode-alist '("\\.target\\'" . conf-mode)) -(add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-mode)) + (add-to-list 'auto-mode-alist '("\\.service\\'" . conf-mode)) + (add-to-list 'auto-mode-alist '("\\.target\\'" . conf-mode)) + (add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-mode)) #+END_SRC =direnv=’s files are basically shell scripts, it’s a nice way to set environment variables for projects. #+BEGIN_SRC emacs-lisp -(add-to-list 'auto-mode-alist '("\\.envrc\\'" . sh-mode)) + (add-to-list 'auto-mode-alist '("\\.envrc\\'" . sh-mode)) #+END_SRC 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))) + :mode (("\\.nix\\'" . nix-mode))) (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))) + :defer t + :mode (("/nginx/servers/" . nginx-mode) + ("/nginx/.*\\.d/" . nginx-mode))) (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)) @@ -1356,44 +1354,44 @@ 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 - (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 \\^Assets:Budget$") - ("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 + (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 \\^Assets:Budget$") + ("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 #+BEGIN_SRC emacs-lisp -(use-package markdown-mode - :defer t - :config (progn - (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) + (use-package markdown-mode + :defer t + :config (progn + (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) #+END_SRC ** Org @@ -1404,60 +1402,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 @@ -1468,13 +1466,13 @@ to have my =ledger= setup in an org file with some graph processing with R or something. #+BEGIN_SRC emacs-lisp -(use-package ob-core - :defer t - :ensure nil - :config (org-babel-do-load-languages - 'org-babel-load-languages - '((ledger . t) - (sh . t)))) + (use-package ob-core + :defer t + :ensure nil + :config (org-babel-do-load-languages + 'org-babel-load-languages + '((ledger . t) + (sh . t)))) #+END_SRC **** org-journal @@ -1483,57 +1481,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 @@ -1544,16 +1542,16 @@ 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 **** org-page @@ -1575,9 +1573,9 @@ 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)))) + :defer t + :config (progn + (setq mpc-browser-tags '(Genre Albumartist|Composer|Performer Album|Playlist)))) #+END_SRC * Programming ** flycheck @@ -1586,11 +1584,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 @@ -1599,24 +1597,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 @@ -1627,15 +1625,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 @@ -1647,12 +1645,12 @@ hook which I trigger in every lispy-mode. #+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)) + (run-hooks 'lisp-mode-common-hook)) #+END_SRC **** Redshank @@ -1662,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 @@ -1674,29 +1672,29 @@ Customise the modeline-display of =emacs-lisp-mode=. Then make sure it runs the common lisp hooks. #+BEGIN_SRC emacs-lisp -(add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup) -(add-hook 'emacs-lisp-mode-hook #'eldoc-mode) + (add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup) + (add-hook 'emacs-lisp-mode-hook #'eldoc-mode) #+END_SRC 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 #+BEGIN_SRC emacs-lisp -(use-package ielm - :defer t - :ensure nil - :config (progn - (add-hook 'ielm-mode-hook (lambda () - (run-hooks 'lisp-mode-common-hook))))) + (use-package ielm + :defer t + :ensure nil + :config (progn + (add-hook 'ielm-mode-hook (lambda () + (run-hooks 'lisp-mode-common-hook))))) #+END_SRC *** Scheme & Lisp @@ -1707,8 +1705,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 @@ -1718,11 +1716,11 @@ A REPL thing for Scheme. Hopefully I’ll get to use it more in the future. #+BEGIN_SRC emacs-lisp -(use-package geiser - :commands (geiser-mode - geiser - run-geiser - run-racket)) + (use-package geiser + :commands (geiser-mode + geiser + run-geiser + run-racket)) #+END_SRC **** slime @@ -1730,34 +1728,34 @@ future. A REPL thing (and more) for Lisp. #+BEGIN_SRC emacs-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")))) + (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")))) #+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 @@ -1765,21 +1763,21 @@ A REPL thing (and more) for Lisp. A REPL thing for Clojure #+BEGIN_SRC emacs-lisp -(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))) + (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))) #+END_SRC ** Auto-compile Auto-compile emacs lisp when saving. #+BEGIN_SRC emacs-lisp -(use-package auto-compile - :defer t - :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) + (use-package auto-compile + :defer t + :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) #+END_SRC ** cc-mode @@ -1788,16 +1786,16 @@ Although I don’t use C or C++, setting up the mode is helpful because quite a few other modes are derived from it. #+BEGIN_SRC emacs-lisp -(use-package cc-mode - :defer 5 - :init (progn - (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 '+))) + (use-package cc-mode + :defer 5 + :init (progn + (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 '+))) #+END_SRC ** quickrun @@ -1805,8 +1803,8 @@ quite a few other modes are derived from it. It’s nice to be able to quickly evaluate some code. Although I don’t really seem to use it. #+BEGIN_SRC emacs-lisp -(use-package quickrun - :bind (("C-c C-e" . quickrun))) + (use-package quickrun + :bind (("C-c C-e" . quickrun))) #+END_SRC ** Scala @@ -1815,14 +1813,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 @@ -1836,37 +1834,37 @@ 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) - (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 2 - 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) + (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 2 + 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 @@ -1876,28 +1874,28 @@ completions, besides other IDE-like things. #+BEGIN_SRC emacs-lisp (use-package tern - :commands ap/enable-tern - :if (executable-find "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 + :if (executable-find "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 @@ -1908,22 +1906,22 @@ 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 This is for HTML, since old versions of HTML were derived from SGML. #+BEGIN_SRC emacs-lisp -(use-package sgml-mode - :defer t - :config (setq sgml-basic-offset 4)) + (use-package sgml-mode + :defer t + :config (setq sgml-basic-offset 4)) #+END_SRC *** emmet-mode @@ -1935,7 +1933,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 @@ -1946,27 +1944,27 @@ of them as well. #+BEGIN_SRC emacs-lisp (use-package web-mode - :mode (("/views/.*\\.php\\'" . web-mode) - ("\\.html\\'" . web-mode) - ("/templates/.*\\.php\\'" . web-mode) - ("\\.ejs\\'" . web-mode)) - :config (progn - (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 - web-mode-enable-auto-pairing nil - web-mode-enable-auto-quoting nil) - (sp-local-pair '(web-mode) "<%" "%>"))) + :mode (("/views/.*\\.php\\'" . web-mode) + ("\\.html\\'" . web-mode) + ("/templates/.*\\.php\\'" . web-mode) + ("\\.ejs\\'" . web-mode)) + :config (progn + (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 + 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=. #+BEGIN_SRC emacs-lisp -(define-derived-mode twig-mode web-mode "Twig") -(add-to-list 'auto-mode-alist '("\\.html\\.twig\\'" . twig-mode)) + (define-derived-mode twig-mode web-mode "Twig") + (add-to-list 'auto-mode-alist '("\\.html\\.twig\\'" . twig-mode)) #+END_SRC * Spelling @@ -1975,8 +1973,8 @@ I derived a mode for twig, in order to use its =mode-hook=. (use-package ispell :bind (("" . ispell-word)) :config (progn - (setq ispell-program-name "aspell" - ispell-dictionary "british"))) + (setq ispell-program-name "aspell" + ispell-dictionary "british"))) #+END_SRC * Scripting @@ -2007,28 +2005,28 @@ nice, when I remember to use it. #+BEGIN_SRC emacs-lisp (use-package eshell - :bind ("C-c s" . eshell) - :config (progn - (setq eshell-directory-name "~/.emacs.d/eshell") - (add-hook 'eshell-load-hook (lambda () - (bind-key "C-c C-l" #'counsel-esh-history eshell-mode-map))))) + :bind ("C-c s" . eshell) + :config (progn + (setq eshell-directory-name "~/.emacs.d/eshell") + (add-hook 'eshell-load-hook (lambda () + (bind-key "C-c C-l" #'counsel-esh-history eshell-mode-map))))) (use-package em-smart - :ensure nil - :commands eshell-smart-initialize - :init (progn - (add-hook 'eshell-load-hook #'eshell-smart-initialize)) - :config (progn - (setq eshell-where-to-jump 'begin - eshell-review-quick-commands nil - eshell-smart-space-goes-to-end t))) + :ensure nil + :commands eshell-smart-initialize + :init (progn + (add-hook 'eshell-load-hook #'eshell-smart-initialize)) + :config (progn + (setq eshell-where-to-jump 'begin + eshell-review-quick-commands nil + eshell-smart-space-goes-to-end t))) (autoload #'eshell/cd "em-dirs") (defun eshell-goto-current-dir (&optional arg) - (interactive "P") - (let ((dir default-directory)) - (eshell arg) - (eshell/cd dir))) + (interactive "P") + (let ((dir default-directory)) + (eshell arg) + (eshell/cd dir))) (bind-key "C-c S" #'eshell-goto-current-dir) @@ -2038,21 +2036,21 @@ nice, when I remember to use it. #+BEGIN_SRC emacs-lisp (use-package shell - :defer t - :ensure nil - :config (define-key shell-mode-map - (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) + :defer t + :ensure nil + :config (define-key shell-mode-map + (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) (use-package comint - :defer t - :ensure nil - :config (bind-key "C-c C-l" #'counsel-shell-history comint-mode-map)) + :defer t + :ensure nil + :config (bind-key "C-c C-l" #'counsel-shell-history comint-mode-map)) (defun comint-delchar-or-eof-or-kill-buffer (arg) - (interactive "p") - (if (null (get-buffer-process (current-buffer))) - (kill-buffer) - (comint-delchar-or-maybe-eof arg))) + (interactive "p") + (if (null (get-buffer-process (current-buffer))) + (kill-buffer) + (comint-delchar-or-maybe-eof arg))) #+END_SRC * Text editing @@ -2063,7 +2061,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 @@ -2073,13 +2071,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 @@ -2087,11 +2085,11 @@ The most important one for me is JSON property alignment. 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)) -(when (boundp 'x-select-request-type) - (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))) + (setq x-select-enable-clipboard t) + (if (functionp '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 ** Selection @@ -2107,8 +2105,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 @@ -2118,7 +2116,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 @@ -2126,8 +2124,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 @@ -2146,15 +2144,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) - ("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 ?\;)))) + :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 ?\;)))) #+END_SRC ** goto-chg @@ -2174,14 +2172,14 @@ cursors was one of my favourite features, so I was really happy when I saw that multiple-cursors was released for Emacs. #+BEGIN_SRC emacs-lisp -(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-" #'mc/mark-all-like-this-dwim) - (bind-key "C-" #'mc/mark-more-like-this-extended) - (bind-key "C-S-L" #'mc/edit-lines))) + (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-" #'mc/mark-all-like-this-dwim) + (bind-key "C-" #'mc/mark-more-like-this-extended) + (bind-key "C-S-L" #'mc/edit-lines))) #+END_SRC ** paredit @@ -2191,12 +2189,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 @@ -2208,31 +2206,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-" #'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-" #'sp-splice-sexp-killing-backward smartparens-mode-map) - (bind-key "M-" #'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-" #'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-" #'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-" #'sp-splice-sexp-killing-backward smartparens-mode-map) + (bind-key "M-" #'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-" #'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 ** smart-scan @@ -2241,8 +2239,8 @@ Move between instances of a symbol #+BEGIN_SRC emacs-lisp (use-package smartscan - :config (progn - (smartscan-mode 1))) + :config (progn + (smartscan-mode 1))) #+END_SRC ** move-text @@ -2250,8 +2248,8 @@ Move between instances of a symbol Transposing lines, made easier. #+BEGIN_SRC emacs-lisp -(use-package move-text - :config (move-text-default-bindings)) + (use-package move-text + :config (move-text-default-bindings)) #+END_SRC ** undo-tree @@ -2260,21 +2258,21 @@ Emacs’ default handling of undo is a bit confusing. Undo-tree makes 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))) - :diminish undo-tree-mode) + (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))) + :diminish undo-tree-mode) #+END_SRC ** visual-regexp @@ -2284,10 +2282,10 @@ so this package is pretty useful because it highlights everything in 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))) + (use-package visual-regexp + :bind (("C-c r" . vr/replace) + ("C-c q" . vr/query-replace) + ("C-c m" . vc/mc-mark))) #+END_SRC * Tangling @@ -2305,39 +2303,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: @@ -2348,14 +2346,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 -- cgit 1.4.1 From 0b8ddf67f44e5c2ed994e1605db0482a1aa82193 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 31 Oct 2016 14:58:07 +0100 Subject: Emacs: Set sgml (html) offset to 2 --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index db31c419..5166a032 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1921,7 +1921,7 @@ This is for HTML, since old versions of HTML were derived from SGML. #+BEGIN_SRC emacs-lisp (use-package sgml-mode :defer t - :config (setq sgml-basic-offset 4)) + :config (setq sgml-basic-offset 2)) #+END_SRC *** emmet-mode -- cgit 1.4.1 From 63731f4cb2e0c5ea4fb1f34ee03f6b510faf4866 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 4 Nov 2016 11:37:47 +0100 Subject: Emacs: Cleanup org-mode configuration --- tag-emacs/emacs.d/init.org | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 5166a032..2a7eaf53 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1398,8 +1398,6 @@ works really nicely. Org is wünderbar. -*** TODO Check whether all this configuration is necessary or helpful. - #+BEGIN_SRC emacs-lisp (use-package org :bind (("C-c C-a" . org-agenda-list) @@ -1417,15 +1415,11 @@ Org is wünderbar. ;; ‘Remember’: new items at top org-reverse-note-order t - org-modules '(org-habit - org-protocol) + org-modules '(org-protocol) ;; Add time done to ‘done’ tasks org-log-done 'time - ;; Allow refiling into any org file - org-refile-targets '((org-agenda-files :maxlevel . 3)) - org-list-allow-alphabetical t org-adapt-indentation nil @@ -1447,15 +1441,7 @@ Org is wünderbar. 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-load-modules-maybe t))) #+END_SRC **** org-babel @@ -1531,7 +1517,7 @@ I can use this to keep a journal. I should use it. (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)))))))) + (file-notify-add-watch org-file '(change) #'ap/org-mobile-pull)))))) #+END_SRC **** org-caldav -- cgit 1.4.1 From 0da4f600c2b1b422b7f234b1a80ca238d1c25604 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 4 Nov 2016 11:38:02 +0100 Subject: Emacs: Don't split width-wise so much --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 2a7eaf53..4a50fa9e 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -817,7 +817,7 @@ point whilst I’m moving about. scroll-preserve-screen-position t mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control))) split-height-threshold 80 - split-width-threshold 130 + split-width-threshold 160 frame-resize-pixelwise nil) (if (boundp 'ns-pop-up-frames) (setq ns-pop-up-frames nil)) -- cgit 1.4.1 From 6272f22915c3901ab8174cfb964da46f6aa06594 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 4 Nov 2016 11:39:57 +0100 Subject: Regenerate karabiner.json according to app --- .../karabiner.d/configuration/karabiner.json | 81 +++++++++++----------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/tag-karabiner/karabiner.d/configuration/karabiner.json b/tag-karabiner/karabiner.d/configuration/karabiner.json index 4f78bb69..23a4d2ff 100644 --- a/tag-karabiner/karabiner.d/configuration/karabiner.json +++ b/tag-karabiner/karabiner.d/configuration/karabiner.json @@ -1,41 +1,42 @@ { - "profiles" : [ - { - "fn_function_keys" : { - "f12" : "volume_up", - "f9" : "vk_consumer_next", - "f5" : "vk_consumer_illumination_down", - "f10" : "mute", - "f1" : "vk_consumer_brightness_down", - "f6" : "vk_consumer_illumination_up", - "f2" : "vk_consumer_brightness_up", - "f7" : "vk_consumer_previous", - "f11" : "volume_down", - "f3" : "vk_mission_control", - "f8" : "vk_consumer_play", - "f4" : "vk_launchpad" - }, - "name" : "Default Profile", - "selected" : true, - "simple_modifications" : { - "left_control" : "left_command", - "right_control" : "right_command", - "left_option" : "left_control", - "caps_lock" : "delete_or_backspace", - "right_command" : "right_option", - "left_command" : "left_option", - "right_option" : "right_control" - } - }, - { - "name" : "Macbook keyboard", - "simple_modifications" : { - "left_command" : "left_control", - "caps_lock" : "delete_or_backspace", - "grave_accent_and_tilde" : "non_us_backslash", - "non_us_backslash" : "grave_accent_and_tilde", - "right_command" : "right_control" - } - } - ] -} \ No newline at end of file + "profiles": [ + { + "devices": [], + "fn_function_keys": { + "f1": "vk_consumer_brightness_down", + "f10": "mute", + "f11": "volume_down", + "f12": "volume_up", + "f2": "vk_consumer_brightness_up", + "f3": "vk_mission_control", + "f4": "vk_launchpad", + "f5": "vk_consumer_illumination_down", + "f6": "vk_consumer_illumination_up", + "f7": "vk_consumer_previous", + "f8": "vk_consumer_play", + "f9": "vk_consumer_next" + }, + "name": "Default Profile", + "selected": true, + "simple_modifications": { + "caps_lock": "delete_or_backspace", + "left_command": "left_option", + "left_control": "left_command", + "left_option": "left_control", + "right_command": "right_option", + "right_control": "right_command", + "right_option": "right_control" + } + }, + { + "name": "Macbook keyboard", + "simple_modifications": { + "caps_lock": "delete_or_backspace", + "grave_accent_and_tilde": "non_us_backslash", + "left_command": "left_control", + "non_us_backslash": "grave_accent_and_tilde", + "right_command": "right_control" + } + } + ] +} -- cgit 1.4.1 From d18942af3be0ee634695630e2e0b17a3f12fd815 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 4 Nov 2016 11:41:17 +0100 Subject: Karabiner: Configure keyboards --- .../karabiner.d/configuration/karabiner.json | 23 +++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tag-karabiner/karabiner.d/configuration/karabiner.json b/tag-karabiner/karabiner.d/configuration/karabiner.json index 23a4d2ff..0e866a63 100644 --- a/tag-karabiner/karabiner.d/configuration/karabiner.json +++ b/tag-karabiner/karabiner.d/configuration/karabiner.json @@ -1,7 +1,28 @@ { "profiles": [ { - "devices": [], + "devices": [ + { + "identifiers": { + "is_keyboard": true, + "is_pointing_device": false, + "product_id": 602, + "vendor_id": 1452 + }, + "ignore": true, + "keyboard_type": 41 + }, + { + "identifiers": { + "is_keyboard": true, + "is_pointing_device": false, + "product_id": 8209, + "vendor_id": 1241 + }, + "ignore": false, + "keyboard_type": 40 + } + ], "fn_function_keys": { "f1": "vk_consumer_brightness_down", "f10": "mute", -- cgit 1.4.1 From 45fcb8ae271a4d01ca59a4181431d94ace7b12dc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 6 Nov 2016 13:28:02 +0100 Subject: Emacs: Configure ispell checker dynamically --- tag-emacs/emacs.d/init.org | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 4a50fa9e..a01fa1fa 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1956,11 +1956,17 @@ I derived a mode for twig, in order to use its =mode-hook=. * Spelling #+BEGIN_SRC emacs-lisp -(use-package ispell - :bind (("" . ispell-word)) - :config (progn - (setq ispell-program-name "aspell" - ispell-dictionary "british"))) + (use-package ispell + :bind (("" . ispell-word)) + :config (progn + (cond + ((executable-find "aspell") (setq ispell-program-name "aspell" + ispell-dictionary "british" + ispell-really-aspell t + ispell-really-hunspell nil)) + ((executable-find "hunspell") (setq ispell-program-name "hunspell" + ispell-really-aspell nil + ispell-really-hunspell t))))) #+END_SRC * Scripting -- cgit 1.4.1 From 069890cb59a48e2fc6d9772805f4ca314bc33d57 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 6 Nov 2016 13:35:49 +0100 Subject: Emacs: Install cmd-to-echo --- tag-emacs/emacs.d/init.org | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index a01fa1fa..b26451d7 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1276,6 +1276,16 @@ don’t use it directly. "smex-items")))) #+END_SRC +** cmd-to-echo + +I’ve been looking for some way to run programming projects (mostly +node.js) inside emacs. =cmd-to-echo= seems great for this, as new +output pops up in the echo area. + +#+BEGIN_SRC emacs-lisp + (use-package cmd-to-echo + :commands (cmd-to-echo)) +#+END_SRC * Modes Setup some modes for systemd files -- cgit 1.4.1 From a519dc191d2c1aca3b68159f52bd5c5604f9f5c9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 8 Nov 2016 16:57:49 +0100 Subject: Emacs: Save system clipboard in kill ring --- tag-emacs/emacs.d/init.org | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 25867046..5a8445cc 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2089,11 +2089,12 @@ The most important one for me is JSON property alignment. I like to use the clipboard more than the primary selection in X11. #+BEGIN_SRC emacs-lisp - (setq x-select-enable-clipboard t) + (setq x-select-enable-clipboard t + save-interprogram-paste-before-kill 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))) + (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))) #+END_SRC ** Selection -- cgit 1.4.1 From b24f0ce9764dc646d62fbb91b2c202f499c2e9e5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 9 Nov 2016 19:05:09 +0100 Subject: Emacs: Change magit window display confugration --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 5a8445cc..ddf5ea68 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -446,6 +446,7 @@ time. Make sure to set it up with a nice =completing-read-function= magit-completing-read-function #'magit-builtin-completing-read magit-popup-use-prefix-argument 'default magit-push-always-verify nil + magit-display-buffer-function #'magit-display-buffer-fullcolumn-most-v1 global-magit-file-mode nil) (add-to-list 'magit-no-confirm 'safe-with-wip)) :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) -- cgit 1.4.1 From a4dc91965e3ad4a33683a9859e83067a2441365d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 11 Nov 2016 16:34:51 +0100 Subject: zsh: Have autoenv unset variables on leaving dir --- tag-zsh/config/zsh/zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index f5327507..7b1439db 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -128,7 +128,7 @@ fi if zplug check Tarrasch/zsh-autoenv then AUTOENV_FILE_ENTER=.envrc - AUTOENV_HANDLE_LEAVE=0 + AUTOENV_HANDLE_LEAVE=1 AUTOENV_LOOK_UPWARDS=1 fi -- cgit 1.4.1 From 384e602dfb942d2d6a4871f6449181d44bd0c26b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 11 Nov 2016 17:27:49 +0100 Subject: Emacs: Setup git autofetch --- tag-emacs/emacs.d/init.org | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index ddf5ea68..5e6b9953 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -387,6 +387,17 @@ based upon some folder conventions I use. projectile-completion-system 'ivy))) #+END_SRC +*** projectile-git-autofetch + +Automatically fetch repositories I’m working on. + +#+BEGIN_SRC emacs-lisp + (use-package projectile-git-autofetch + :config (progn + (setq projectile-git-autofetch-projects 'open) + (projectile-git-autofetch-mode 1))) +#+END_SRC + ** perspective This package makes buffer-switching inside of projects make sense, by -- cgit 1.4.1 From 4f3fcb5fb8ec10f47339175a8550166e6036f00f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 14 Nov 2016 09:59:57 +0100 Subject: Emacs: Add counsel-yank-pop binding --- tag-emacs/emacs.d/init.org | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 5e6b9953..afce66b4 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1242,27 +1242,29 @@ replacement for helm so far. #+BEGIN_SRC emacs-lisp (use-package counsel - :config (progn - (bind-key "M-x" #'counsel-M-x) - (bind-key "" #'counsel-M-x) - (bind-key "" #'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 "" #'counsel-M-x) + (bind-key "" #'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) + (bind-key "M-y" #'counsel-yank-pop) + (bind-key "M-y" #'ivy-next-line ivy-minibuffer-map) + (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 -- cgit 1.4.1 From 40025a02c7fab87868aa05bb780d7757d8d89079 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 17 Nov 2016 15:23:21 +0100 Subject: zsh: Configure JIRA locally on work machine --- host-ap-spotcap.local/config/zsh/zshenv.local | 3 +++ tag-zsh/config/zsh/zshrc | 5 ----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/host-ap-spotcap.local/config/zsh/zshenv.local b/host-ap-spotcap.local/config/zsh/zshenv.local index 55a6031d..6341c476 100644 --- a/host-ap-spotcap.local/config/zsh/zshenv.local +++ b/host-ap-spotcap.local/config/zsh/zshenv.local @@ -3,3 +3,6 @@ if [[ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]] then . $HOME/.nix-profile/etc/profile.d/nix.sh; fi + +JIRA_RAPID_BOARD=true +JIRA_URL=https://spotcap.atlassian.net diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 7b1439db..b4251ce9 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -132,11 +132,6 @@ then AUTOENV_LOOK_UPWARDS=1 fi -if zplug check gerges/oh-my-zsh-jira-plus -then - JIRA_RAPID_BOARD=true -fi - # Then, source plugins and add commands to $PATH zplug load -- cgit 1.4.1 From 1aa802999dc54ca0c34764f3950635685cdc5fc5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 23 Nov 2016 15:24:29 +0100 Subject: Emacs: Fix font setting for new frames --- tag-emacs/emacs.d/init.org | 63 +++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index afce66b4..d5a6a21a 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -148,37 +148,38 @@ 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 + (font-spec :family "ProggyTiny" :size 11) + (let ((default-font (font-spec :family mono-face :size mono-font-size))) + (add-to-list 'default-frame-alist `(font . ,(format "%s %s" mono-face mono-font-size))) + (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 -- cgit 1.4.1 From 56328035acc6d62e1e0d5e94959d0e4d0ee8ec3d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 25 Nov 2016 14:20:25 +0100 Subject: Emacs: Configure JS IDE features --- tag-emacs/emacs.d/init.org | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index d5a6a21a..089f9866 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1871,6 +1871,21 @@ it though js2-include-node-externs t))) #+END_SRC +**** jade (not pug) + +Javascript with an inferior node.js process and a debugger? Awesome. + +To debug with node, use version 6.9.1 or later of node and run it with +~--inspect~ and, to break on the first line, ~--debug-brk~. + +For Chrom*, it needs to be launched with ~--remote-debugging-port=9222~ + +#+BEGIN_SRC emacs-lisp + (use-package jade + :config (progn + (add-hook 'js2-mode-hook #'jade-interaction-mode))) +#+END_SRC + *** coffee-mode #+BEGIN_SRC emacs-lisp -- cgit 1.4.1 From af303d93fb0a2e38e8667eb942948d092c2c61b8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 28 Nov 2016 11:09:11 +0100 Subject: Add Spotcap email to environment --- host-ap-spotcap.local/config/zsh/zshenv.local | 1 + 1 file changed, 1 insertion(+) diff --git a/host-ap-spotcap.local/config/zsh/zshenv.local b/host-ap-spotcap.local/config/zsh/zshenv.local index 6341c476..af63e1ba 100644 --- a/host-ap-spotcap.local/config/zsh/zshenv.local +++ b/host-ap-spotcap.local/config/zsh/zshenv.local @@ -6,3 +6,4 @@ fi JIRA_RAPID_BOARD=true JIRA_URL=https://spotcap.atlassian.net +EMAIL=alan.pearce@spotcap.com -- cgit 1.4.1 From bf772489b2fd233f587d56ad3f66e78d2aa28936 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 28 Nov 2016 11:09:54 +0100 Subject: Emacs: Show cmd-to-echo output in process buffers --- 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 089f9866..3b97d22c 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1301,7 +1301,8 @@ output pops up in the echo area. #+BEGIN_SRC emacs-lisp (use-package cmd-to-echo - :commands (cmd-to-echo)) + :commands (cmd-to-echo) + :config (setq cmd-to-echo-add-output-to-process-buffers t)) #+END_SRC * Modes -- cgit 1.4.1 From ab734d2ac9b3f6c89810a882426fef71bfc27ae3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 29 Nov 2016 15:30:09 +0100 Subject: Emacs: Configure ripgrep --- tag-emacs/emacs.d/init.org | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 3b97d22c..b25f7d2c 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -346,6 +346,19 @@ configuration with crux.el :config (setq ag-project-root-function #'projectile-project-root)) #+END_SRC +** Ripgrep + +Step over Silver Search, here comes a new challenger. + +#+BEGIN_SRC emacs-lisp + (use-package ripgrep + :if (executable-find "rg")) + + (use-package projectile-ripgrep + :bind (("C-c p s r" . projectile-ripgrep)) + :ensure nil) +#+END_SRC + ** Projectile Projectile is awesome for working in projects, especially VCS-backed -- cgit 1.4.1 From 7ac31a866b7698826817e742d1db5126fcf57ae0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 4 Dec 2016 17:08:38 +0100 Subject: Emacs: Remove erroneous line --- tag-emacs/emacs.d/init.org | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index b25f7d2c..00f8b31d 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -157,7 +157,6 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (defun ap/set-fonts (mono-face mono-font-size variable-face variable-font-size) (when mono-face - (font-spec :family "ProggyTiny" :size 11) (let ((default-font (font-spec :family mono-face :size mono-font-size))) (add-to-list 'default-frame-alist `(font . ,(format "%s %s" mono-face mono-font-size))) (set-face-font 'fixed-pitch default-font) -- cgit 1.4.1 From c15bd0732c9530d739d05b77ca80979ffd33494d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 5 Dec 2016 12:54:16 +0100 Subject: Emacs: Reformat code in init file --- tag-emacs/emacs.d/init.org | 2054 ++++++++++++++++++++++---------------------- 1 file changed, 1027 insertions(+), 1027 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 00f8b31d..4dd7c06d 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -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 @@ -83,30 +83,30 @@ pass =:noerror= to =load= I prefer an always-visible cursor. Feels less distracting. #+BEGIN_SRC emacs-lisp -(when (fboundp #'blink-cursor-mode) - (blink-cursor-mode -1)) + (when (fboundp #'blink-cursor-mode) + (blink-cursor-mode -1)) #+END_SRC 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)))) + (setq ring-bell-function + (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 @@ -185,7 +185,7 @@ 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 @@ -212,8 +212,7 @@ correct, at least for Liberation Mono. (column-number-mode t) (size-indication-mode t) - (setq frame-title-format - '("%f" (dired-directory dired-directory))) + (setq frame-title-format '("%f" (dired-directory dired-directory))) #+END_SRC ** Highlight Changes @@ -222,9 +221,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 +233,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 +259,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,37 +311,37 @@ 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) + :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))) + ("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") - #+END_SRC +#+BEGIN_SRC emacs-lisp + (defvar work-project-directory "~/work") + (defvar home-project-directory "~/projects") +#+END_SRC #+BEGIN_SRC emacs-lisp -(defun switch-to-dotfiles () - (interactive) - (projectile-persp-switch-project (expand-file-name "dotfiles" home-project-directory))) + (defun switch-to-dotfiles () + (interactive) + (projectile-persp-switch-project (expand-file-name "dotfiles" home-project-directory))) #+END_SRC ** The Silver Searcher #+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 ** Ripgrep @@ -366,38 +365,39 @@ 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 *** projectile-git-autofetch @@ -419,14 +419,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 @@ -435,11 +435,11 @@ This is nice for some things that magit doesn’t do, and for those rare occasions that I’m working with something other than git. #+BEGIN_SRC emacs-lisp -(use-package vc - :defer t - :bind (("C-x v C" . vc-resolve-conflicts)) - :config (progn - (setq vc-follow-symlinks t))) + (use-package vc + :defer t + :bind (("C-x v C" . vc-resolve-conflicts)) + :config (progn + (setq vc-follow-symlinks t))) #+END_SRC ** diff-hl @@ -449,12 +449,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 @@ -464,16 +464,16 @@ 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 - magit-display-buffer-function #'magit-display-buffer-fullcolumn-most-v1 - 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 + magit-display-buffer-function #'magit-display-buffer-fullcolumn-most-v1 + 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 @@ -485,7 +485,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 @@ -497,7 +497,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 @@ -506,29 +506,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 @@ -537,8 +537,8 @@ UTF-8 is usually appropriate. Note that =prefer-coding-system= expects only a coding system, not a coding system and line ending combination. #+BEGIN_SRC emacs-lisp -(prefer-coding-system 'utf-8) -(setq-default buffer-file-coding-system 'utf-8-auto-unix) + (prefer-coding-system 'utf-8) + (setq-default buffer-file-coding-system 'utf-8-auto-unix) #+END_SRC ** Buffer-file management @@ -547,12 +547,12 @@ Ask if I want to create a directory when it doesn’t exist. This is 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)))) -(add-to-list 'find-file-not-found-functions #'my-create-non-existent-directory) + (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)))) + (add-to-list 'find-file-not-found-functions #'my-create-non-existent-directory) #+END_SRC I often want to rename or delete the file that I’m currently visiting @@ -560,16 +560,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 @@ -579,13 +579,13 @@ 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 () - (use-package ws-butler - :config (ws-butler-global-mode 1))))) + (add-hook 'before-make-frame-hook (lambda () + (use-package ws-butler + :config (ws-butler-global-mode 1))))) #+END_SRC ** shrink-whitespace @@ -595,7 +595,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 @@ -605,30 +605,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 @@ -636,11 +636,11 @@ that I can sudo on remote machines I like a horizonal diff setup, with everything in one frame. #+BEGIN_SRC emacs-lisp -(use-package ediff - :defer t - :config (progn - (setq ediff-split-window-function 'split-window-horizontally - ediff-window-setup-function 'ediff-setup-windows-plain))) + (use-package ediff + :defer t + :config (progn + (setq ediff-split-window-function 'split-window-horizontally + ediff-window-setup-function 'ediff-setup-windows-plain))) #+END_SRC * Indentation @@ -651,7 +651,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 @@ -661,25 +661,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 @@ -689,39 +689,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 @@ -731,15 +731,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 @@ -749,9 +749,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 @@ -760,54 +760,54 @@ Ibuffer is quite nice for listing all buffers. I don’t use it very often though, as it doesn’t really work with perspectives. #+BEGIN_SRC emacs-lisp -(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))))) + (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))))) #+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 Enable it without prompting #+BEGIN_SRC emacs-lisp -(put 'narrow-to-defun 'disabled nil) -(put 'narrow-to-page 'disabled nil) -(put 'narrow-to-region 'disabled nil) + (put 'narrow-to-defun 'disabled nil) + (put 'narrow-to-page 'disabled nil) + (put 'narrow-to-region 'disabled nil) #+END_SRC ** ace-window @@ -816,21 +816,21 @@ I don’t often have many windows open at once, but when I do, =ace-window= is really nice to jump around them in the same way that =ace-jump= or =avy= work. #+BEGIN_SRC emacs-lisp -(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)))) + (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)))) #+END_SRC * Windows @@ -840,14 +840,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 160 - 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 160 + 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 @@ -855,10 +855,10 @@ point whilst I’m moving about. 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*")))) + (use-package winner + :init (progn + (winner-mode 1) + (setq winner-boring-buffers '("*Completions*" "*Help*" "*Apropos*" "*Buffer List*" "*info*" "*Compile-Log*")))) #+END_SRC ** windmove @@ -866,11 +866,11 @@ Undo, for window-based commands. Directional window movement #+BEGIN_SRC emacs-lisp -(use-package windmove - :bind (("S-" . windmove-left) - ("S-" . windmove-right) - ("S-" . windmove-up) - ("S-" . windmove-down))) + (use-package windmove + :bind (("S-" . windmove-left) + ("S-" . windmove-right) + ("S-" . windmove-up) + ("S-" . windmove-down))) #+END_SRC * Completion @@ -879,8 +879,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 @@ -891,35 +891,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 @@ -929,39 +929,39 @@ 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. #+BEGIN_SRC emacs-lisp -(defun insert-date (prefix) - "Insert the current date. With prefix-argument, use British format. With - 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)))) + (defun insert-date (prefix) + "Insert the current date. With prefix-argument, use British format. With + 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)))) -(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)))) + (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)))) #+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 @@ -972,68 +972,68 @@ have two dired windows open, assume that I’m going to be copying/moving files between them. #+BEGIN_SRC emacs-lisp -(use-package dired - :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))) + (use-package dired + :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))) #+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 @@ -1045,9 +1045,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 @@ -1059,7 +1059,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 @@ -1068,32 +1068,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 @@ -1102,7 +1102,7 @@ A nicer way to browse keybindings for major modes. #+BEGIN_SRC emacs-lisp (use-package discover-my-major - :bind ("" . discover-my-major)) + :bind ("" . discover-my-major)) #+END_SRC ** which-key @@ -1111,10 +1111,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 @@ -1123,56 +1123,56 @@ Documentation in the echo-area (where the minibuffer is displayed) is rather useful. #+BEGIN_SRC emacs-lisp -(use-package eldoc - :commands (eldoc-mode) - :diminish eldoc-mode - :config (progn - (setq eldoc-idle-delay 0.1) - (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) + (use-package eldoc + :commands (eldoc-mode) + :diminish eldoc-mode + :config (progn + (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) @@ -1194,14 +1194,14 @@ minibuffers there are on the stack. This avoids some issue with the minibuffer and the point being behind the prompt. I don’t remember what exactly. #+BEGIN_SRC emacs-lisp -(setq minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)) + (setq minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)) #+END_SRC 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)) + (defalias 'exit-emacs #'delete-frame) + (defalias 'exit-emacs #'save-buffers-kill-emacs)) #+END_SRC ** swiper/ivy @@ -1211,44 +1211,44 @@ 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 @@ -1289,20 +1289,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 ** cmd-to-echo @@ -1335,50 +1335,50 @@ 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))) + :mode (("\\.nix\\'" . nix-mode))) (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))) + :defer t + :mode (("/nginx/servers/" . nginx-mode) + ("/nginx/.*\\.d/" . nginx-mode))) (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)) @@ -1394,44 +1394,44 @@ 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 - (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 \\^Assets:Budget$") - ("Budget Allocation" "ledger -f %(ledger-file) bal -p \"this month\" --limit \"payee=~/budget/\" \\^Funds --format \"\\ + :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 + (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 \\^Assets:Budget$") + ("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)"))))) + ("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 #+BEGIN_SRC emacs-lisp (use-package markdown-mode - :defer t - :config (progn - (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) + :defer t + :config (progn + (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) #+END_SRC ** Org @@ -1440,48 +1440,48 @@ 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-protocol) + org-modules '(org-protocol) - ;; Add time done to ‘done’ tasks - org-log-done 'time + ;; Add time done to ‘done’ tasks + org-log-done 'time - 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))) + 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))) #+END_SRC **** org-babel @@ -1493,12 +1493,12 @@ with R or something. #+BEGIN_SRC emacs-lisp (use-package ob-core - :defer t - :ensure nil - :config (org-babel-do-load-languages - 'org-babel-load-languages - '((ledger . t) - (sh . t)))) + :defer t + :ensure nil + :config (org-babel-do-load-languages + 'org-babel-load-languages + '((ledger . t) + (sh . t)))) #+END_SRC **** org-journal @@ -1507,57 +1507,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 @@ -1568,16 +1568,16 @@ 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 **** org-page @@ -1588,10 +1588,10 @@ 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"))) + :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 @@ -1599,9 +1599,9 @@ 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)))) + :defer t + :config (progn + (setq mpc-browser-tags '(Genre Albumartist|Composer|Performer Album|Playlist)))) #+END_SRC * Programming ** flycheck @@ -1610,11 +1610,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 @@ -1623,24 +1623,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 @@ -1651,15 +1651,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 @@ -1671,12 +1671,12 @@ hook which I trigger in every lispy-mode. #+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)) + (run-hooks 'lisp-mode-common-hook)) #+END_SRC **** Redshank @@ -1686,10 +1686,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 @@ -1706,21 +1706,21 @@ 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 #+BEGIN_SRC emacs-lisp (use-package ielm - :defer t - :ensure nil - :config (progn - (add-hook 'ielm-mode-hook (lambda () - (run-hooks 'lisp-mode-common-hook))))) + :defer t + :ensure nil + :config (progn + (add-hook 'ielm-mode-hook (lambda () + (run-hooks 'lisp-mode-common-hook))))) #+END_SRC *** Scheme & Lisp @@ -1732,7 +1732,7 @@ I don’t work with these as often as I would like (add-hook 'lisp-mode-hook #'ap/lisp-setup) (defun set-common-lisp-indentation () (set (make-local-variable 'lisp-indent-function) - #'common-lisp-indent-function)) + #'common-lisp-indent-function)) (add-hook 'lisp-mode-hook #'set-common-lisp-indentation) #+END_SRC @@ -1743,10 +1743,10 @@ future. #+BEGIN_SRC emacs-lisp (use-package geiser - :commands (geiser-mode - geiser - run-geiser - run-racket)) + :commands (geiser-mode + geiser + run-geiser + run-racket)) #+END_SRC **** slime @@ -1755,33 +1755,33 @@ A REPL thing (and more) for Lisp. #+BEGIN_SRC emacs-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")))) + :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")))) #+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 @@ -1790,11 +1790,11 @@ A REPL thing for Clojure #+BEGIN_SRC emacs-lisp (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))) + :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))) #+END_SRC ** Auto-compile @@ -1802,8 +1802,8 @@ A REPL thing for Clojure Auto-compile emacs lisp when saving. #+BEGIN_SRC emacs-lisp (use-package auto-compile - :defer t - :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) + :defer t + :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) #+END_SRC ** cc-mode @@ -1813,15 +1813,15 @@ quite a few other modes are derived from it. #+BEGIN_SRC emacs-lisp (use-package cc-mode - :defer 5 - :init (progn - (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 '+))) + :defer 5 + :init (progn + (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 '+))) #+END_SRC ** quickrun @@ -1830,7 +1830,7 @@ It’s nice to be able to quickly evaluate some code. Although I don’t really seem to use it. #+BEGIN_SRC emacs-lisp (use-package quickrun - :bind (("C-c C-e" . quickrun))) + :bind (("C-c C-e" . quickrun))) #+END_SRC ** Scala @@ -1839,14 +1839,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 @@ -1860,28 +1860,28 @@ 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) - (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 2 - 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) + (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 2 + js2-include-node-externs t))) #+END_SRC **** jade (not pug) @@ -1903,9 +1903,9 @@ For Chrom*, it needs to be launched with ~--remote-debugging-port=9222~ #+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 @@ -1915,28 +1915,28 @@ completions, besides other IDE-like things. #+BEGIN_SRC emacs-lisp (use-package tern - :commands ap/enable-tern - :if (executable-find "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 + :if (executable-find "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 @@ -1947,13 +1947,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 @@ -1961,8 +1961,8 @@ integration between the two yet. This is for HTML, since old versions of HTML were derived from SGML. #+BEGIN_SRC emacs-lisp (use-package sgml-mode - :defer t - :config (setq sgml-basic-offset 2)) + :defer t + :config (setq sgml-basic-offset 2)) #+END_SRC *** emmet-mode @@ -1970,11 +1970,11 @@ This is for HTML, since old versions of HTML were derived from SGML. Emmet is really nice to write HTML quickly. Especially with frameworks that require multiple nested elements to do anything useful. #+BEGIN_SRC emacs-lisp -(use-package emmet-mode - :commands (emmet-mode) - :diminish (emmet-mode . " >") - :init (progn - (add-hook 'web-mode-hook #'emmet-mode))) + (use-package emmet-mode + :commands (emmet-mode) + :diminish (emmet-mode . " >") + :init (progn + (add-hook 'web-mode-hook #'emmet-mode))) #+END_SRC *** web-mode @@ -1985,20 +1985,20 @@ of them as well. #+BEGIN_SRC emacs-lisp (use-package web-mode - :mode (("/views/.*\\.php\\'" . web-mode) - ("\\.html\\'" . web-mode) - ("/templates/.*\\.php\\'" . web-mode) - ("\\.ejs\\'" . web-mode)) - :config (progn - (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 - web-mode-enable-auto-pairing nil - web-mode-enable-auto-quoting nil) - (sp-local-pair '(web-mode) "<%" "%>"))) + :mode (("/views/.*\\.php\\'" . web-mode) + ("\\.html\\'" . web-mode) + ("/templates/.*\\.php\\'" . web-mode) + ("\\.ejs\\'" . web-mode)) + :config (progn + (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 + 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=. @@ -2030,15 +2030,15 @@ 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) - ("zshenv\\'" . shell-script-mode) - ("zshrc\\'" . shell-script-mode)) - :config (setq sh-shell-file "/usr/bin/env zsh" - sh-indentation 2 - sh-basic-offset 2)) + :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)) #+END_SRC #+BEGIN_SRC emacs-lisp @@ -2052,28 +2052,28 @@ nice, when I remember to use it. #+BEGIN_SRC emacs-lisp (use-package eshell - :bind ("C-c s" . eshell) - :config (progn - (setq eshell-directory-name "~/.emacs.d/eshell") - (add-hook 'eshell-load-hook (lambda () - (bind-key "C-c C-l" #'counsel-esh-history eshell-mode-map))))) + :bind ("C-c s" . eshell) + :config (progn + (setq eshell-directory-name "~/.emacs.d/eshell") + (add-hook 'eshell-load-hook (lambda () + (bind-key "C-c C-l" #'counsel-esh-history eshell-mode-map))))) (use-package em-smart - :ensure nil - :commands eshell-smart-initialize - :init (progn - (add-hook 'eshell-load-hook #'eshell-smart-initialize)) - :config (progn - (setq eshell-where-to-jump 'begin - eshell-review-quick-commands nil - eshell-smart-space-goes-to-end t))) + :ensure nil + :commands eshell-smart-initialize + :init (progn + (add-hook 'eshell-load-hook #'eshell-smart-initialize)) + :config (progn + (setq eshell-where-to-jump 'begin + eshell-review-quick-commands nil + eshell-smart-space-goes-to-end t))) (autoload #'eshell/cd "em-dirs") (defun eshell-goto-current-dir (&optional arg) - (interactive "P") - (let ((dir default-directory)) - (eshell arg) - (eshell/cd dir))) + (interactive "P") + (let ((dir default-directory)) + (eshell arg) + (eshell/cd dir))) (bind-key "C-c S" #'eshell-goto-current-dir) @@ -2083,21 +2083,21 @@ nice, when I remember to use it. #+BEGIN_SRC emacs-lisp (use-package shell - :defer t - :ensure nil - :config (define-key shell-mode-map - (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) + :defer t + :ensure nil + :config (define-key shell-mode-map + (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) (use-package comint - :defer t - :ensure nil - :config (bind-key "C-c C-l" #'counsel-shell-history comint-mode-map)) + :defer t + :ensure nil + :config (bind-key "C-c C-l" #'counsel-shell-history comint-mode-map)) (defun comint-delchar-or-eof-or-kill-buffer (arg) - (interactive "p") - (if (null (get-buffer-process (current-buffer))) - (kill-buffer) - (comint-delchar-or-maybe-eof arg))) + (interactive "p") + (if (null (get-buffer-process (current-buffer))) + (kill-buffer) + (comint-delchar-or-maybe-eof arg))) #+END_SRC * Text editing @@ -2108,7 +2108,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 @@ -2118,13 +2118,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 @@ -2153,18 +2153,18 @@ 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 =zap-to-char=. #+BEGIN_SRC emacs-lisp -(use-package misc - :ensure nil - :bind (("M-z" . zap-up-to-char) - ("M-Z" . zap-to-char))) + (use-package misc + :ensure nil + :bind (("M-z" . zap-up-to-char) + ("M-Z" . zap-to-char))) #+END_SRC Expanding the region by semantic units was something I quite liked @@ -2172,8 +2172,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 @@ -2192,15 +2192,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) - ("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 ?\;)))) + :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 ?\;)))) #+END_SRC ** goto-chg @@ -2209,8 +2209,8 @@ This is like popping the mark, only it filters to only change areas and doesn’t go back to the same place more than once. #+BEGIN_SRC emacs-lisp -(use-package goto-chg - :bind ("C-c C-SPC" . goto-last-change)) + (use-package goto-chg + :bind ("C-c C-SPC" . goto-last-change)) #+END_SRC ** multiple-cursors @@ -2221,13 +2221,13 @@ saw that multiple-cursors was released for Emacs. #+BEGIN_SRC emacs-lisp (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-" #'mc/mark-all-like-this-dwim) - (bind-key "C-" #'mc/mark-more-like-this-extended) - (bind-key "C-S-L" #'mc/edit-lines))) + :defer 1 + :config (progn + (bind-key "C-." #'mc/mark-next-like-this) + (bind-key "C-," #'mc/mark-previous-like-this) + (bind-key "M-" #'mc/mark-all-like-this-dwim) + (bind-key "C-" #'mc/mark-more-like-this-extended) + (bind-key "C-S-L" #'mc/edit-lines))) #+END_SRC ** paredit @@ -2237,12 +2237,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 @@ -2254,31 +2254,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-" #'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-" #'sp-splice-sexp-killing-backward smartparens-mode-map) - (bind-key "M-" #'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-" #'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-" #'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-" #'sp-splice-sexp-killing-backward smartparens-mode-map) + (bind-key "M-" #'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-" #'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 ** smart-scan @@ -2287,8 +2287,8 @@ Move between instances of a symbol #+BEGIN_SRC emacs-lisp (use-package smartscan - :config (progn - (smartscan-mode 1))) + :config (progn + (smartscan-mode 1))) #+END_SRC ** move-text @@ -2297,7 +2297,7 @@ Transposing lines, made easier. #+BEGIN_SRC emacs-lisp (use-package move-text - :config (move-text-default-bindings)) + :config (move-text-default-bindings)) #+END_SRC ** undo-tree @@ -2307,20 +2307,20 @@ 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))) - :diminish undo-tree-mode) + :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))) + :diminish undo-tree-mode) #+END_SRC ** visual-regexp @@ -2331,9 +2331,9 @@ 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))) + :bind (("C-c r" . vr/replace) + ("C-c q" . vr/query-replace) + ("C-c m" . vc/mc-mark))) #+END_SRC * Tangling @@ -2351,39 +2351,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 + "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: @@ -2394,14 +2394,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 -- cgit 1.4.1 From ac7721bd3c6574d275e38b9211fec63ae6bd36b4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 5 Dec 2016 12:54:28 +0100 Subject: Emacs: Add yarn-install command --- tag-emacs/emacs.d/init.org | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 4dd7c06d..8e628f0b 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -386,6 +386,10 @@ based upon some folder conventions I use. (ap/subfolder-projects from-dir)))) (projectile-switch-project-by-name (expand-file-name project-dir from-dir) arg))) + (defun yarn-install (&optional arg) + (interactive "P") + (projectile-with-default-dir (projectile-project-root) + (cmd-to-echo "yarn" "install"))) (defun ap/open-work-project (&optional arg) (interactive "P") -- cgit 1.4.1 From 0b710a178ba1ecf7bb3491f47ef8845d37754e7c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 6 Dec 2016 13:40:08 +0100 Subject: Emacs: Switch to ProggyClean at work --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 8e628f0b..6f385fa8 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -173,7 +173,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (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)))) + (ap/set-fonts "ProggyClean" 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)))) -- cgit 1.4.1 From a9c83c6d0a04425fbda8735d91edef7d34f24d79 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 6 Dec 2016 13:43:06 +0100 Subject: Emacs: Try basic-theme instead of minimal-light --- tag-emacs/emacs.d/init.org | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 6f385fa8..82a2c0ee 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -130,10 +130,35 @@ Let’s try a more minimal theme. #+BEGIN_SRC emacs-lisp (use-package minimal-theme + :disabled t :config (progn (load-theme 'minimal-light t))) #+END_SRC +Let’s try a basic theme. + +#+BEGIN_SRC emacs-lisp + (use-package basic-theme + :config (progn + (load-theme 'basic t) + (defun mode-line-visual-toggle () + (interactive) + (let ((faces-to-toggle '(mode-line mode-line-inactive)) + (invisible-color "#e8e8e8") + (visible-color "#a1b56c")) + (cond ((string= visible-color (face-attribute 'mode-line :background)) + (mapcar (lambda (face) + (set-face-background face invisible-color) + (set-face-attribute face nil :height 20)) + faces-to-toggle)) + (t + (mapcar (lambda (face) + (set-face-background face visible-color) + (set-face-attribute face nil :height (face-attribute 'default :height))) + faces-to-toggle))))) + (mode-line-visual-toggle))) +#+END_SRC + Highlighting quasi-quoted expressions in lisps is quite useful. #+BEGIN_SRC emacs-lisp (use-package highlight-stages -- cgit 1.4.1 From d047b1d407b0db0d15645e36464fc1bd1b5ea771 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 6 Dec 2016 14:06:39 +0100 Subject: Load macports zsh-functions --- tag-zsh/config/zsh/zshrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index b4251ce9..dd92a0c6 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -31,6 +31,11 @@ then path+=($HOME/.local/bin) fi +if [[ -d /opt/local/share/zsh/site-functions ]] +then + fpath+=(/opt/local/share/zsh/site-functions) +fi + export EDITOR=emacsclient alias ec=emacsclient alias open-project=projectile -- cgit 1.4.1 From a9f8643e5436256c9abb8506eb78af95b6a379fc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 6 Dec 2016 14:06:53 +0100 Subject: Remove hub compdef --- tag-zsh/config/zsh/zshrc | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index dd92a0c6..d66b5914 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -150,7 +150,6 @@ fi if [[ -n $commands[hub] ]] then - compdef _hub hub alias git=hub alias gh=hub fi -- cgit 1.4.1 From cfd231c8243c5f90182c78afc7acdc40cf4355dd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 7 Dec 2016 09:28:25 +0100 Subject: Emacs: Remove projectile-git-autofetch Has problems with waking from sleep --- tag-emacs/emacs.d/init.org | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 82a2c0ee..bdea6d63 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -429,17 +429,6 @@ based upon some folder conventions I use. projectile-completion-system 'ivy))) #+END_SRC -*** projectile-git-autofetch - -Automatically fetch repositories I’m working on. - -#+BEGIN_SRC emacs-lisp - (use-package projectile-git-autofetch - :config (progn - (setq projectile-git-autofetch-projects 'open) - (projectile-git-autofetch-mode 1))) -#+END_SRC - ** perspective This package makes buffer-switching inside of projects make sense, by -- cgit 1.4.1 From e67e9b5e221d9b64330a148cbedaf0eef3217df4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 7 Dec 2016 09:29:06 +0100 Subject: Replace diff-hl with git-gutter-fringe --- tag-emacs/emacs.d/init.org | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index bdea6d63..ab747283 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -460,19 +460,19 @@ occasions that I’m working with something other than git. (setq vc-follow-symlinks t))) #+END_SRC -** diff-hl +** git-gutter-fringe It’s nice to be able to see at a glance which lines of a file have -changed. This package colours the fringe +changed. This package colours the fringe. I have it set to the right +fringe so it doesn’t interfere with flycheck. #+BEGIN_SRC emacs-lisp - (use-package diff-hl + (use-package git-gutter-fringe :defer 2 + :diminish git-gutter-mode :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))) + (global-git-gutter-mode) + (setq git-gutter-fr:side 'right-fringe))) #+END_SRC ** magit -- cgit 1.4.1 From a914a8e9c912aa19dad85d307234bbe5eea1754d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 7 Dec 2016 16:17:26 +0100 Subject: Emacs: Toggle clutter --- tag-emacs/emacs.d/init.org | 53 +++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index ab747283..36907eb5 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -141,22 +141,44 @@ Let’s try a basic theme. (use-package basic-theme :config (progn (load-theme 'basic t) + (defun show-mode-line () + (interactive) + (let ((faces-to-toggle '(mode-line mode-line-inactive))) + (mapcar (lambda (face) + (set-face-background face "#a1b56c") + (set-face-attribute face nil :height (face-attribute 'default :height))) + faces-to-toggle))) + (defun hide-mode-line () + (interactive) + (let ((faces-to-toggle '(mode-line mode-line-inactive))) + (mapcar (lambda (face) + (set-face-background face "#e8e8e8") + (set-face-attribute face nil :height 20)) + faces-to-toggle))) (defun mode-line-visual-toggle () (interactive) - (let ((faces-to-toggle '(mode-line mode-line-inactive)) - (invisible-color "#e8e8e8") - (visible-color "#a1b56c")) - (cond ((string= visible-color (face-attribute 'mode-line :background)) - (mapcar (lambda (face) - (set-face-background face invisible-color) - (set-face-attribute face nil :height 20)) - faces-to-toggle)) - (t - (mapcar (lambda (face) - (set-face-background face visible-color) - (set-face-attribute face nil :height (face-attribute 'default :height))) - faces-to-toggle))))) - (mode-line-visual-toggle))) + (cond ((string= "#a1b56c" (face-attribute 'mode-line :background)) + (hide-mode-line)) + (t + (show-mode-line)))) + + (defun full-git-gutter-fringe-markers () + ) + + (defun hide-clutter () + (interactive) + (setq default-cursor-type 'bar + default-cursor-in-non-selected-windows nil) + (fringe-mode '(0 . 4)) + (hide-mode-line)) + + (defun show-clutter () + (interactive) + (setq default-cursor-type 'box + default-cursor-in-non-selected-windows 'hollow) + (fringe-mode '(8 . 4)) + (show-mode-line)) + (hide-clutter))) #+END_SRC Highlighting quasi-quoted expressions in lisps is quite useful. @@ -471,7 +493,8 @@ fringe so it doesn’t interfere with flycheck. :defer 2 :diminish git-gutter-mode :config (progn - (global-git-gutter-mode) + (global-git-gutter-mode 1) + (set-face-foreground 'git-gutter:modified "grey") (setq git-gutter-fr:side 'right-fringe))) #+END_SRC -- cgit 1.4.1 From a47ed6767b4b44326833ca655a6565236837b874 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 8 Dec 2016 11:31:20 +0100 Subject: Emacs: Fix init.org indentation forever --- tag-emacs/emacs.d/init.org | 2745 ++++++++++++++++++++++---------------------- 1 file changed, 1374 insertions(+), 1371 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 36907eb5..92f84f3c 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -9,11 +9,11 @@ This is a living document, detailing my Emacs configuration using org-mode ** Startup Open Emacs with just a plain window. No graphics or messages, please! #+BEGIN_SRC emacs-lisp - (put 'inhibit-startup-echo-area-message 'saved-value +(put 'inhibit-startup-echo-area-message 'saved-value (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) +(setq inhibit-startup-screen t) +(setq gc-cons-threshold 100000000) +(setq file-name-handler-alist nil) #+END_SRC ** Scratch buffers @@ -21,14 +21,14 @@ I usually use scratch buffers for any sort of text. If I need a 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) +(setq initial-scratch-message "" + 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") +(setq user-mail-address "alan@alanpearce.co.uk" + user-full-name "Alan Pearce") #+end_src * Packaging @@ -36,35 +36,35 @@ the buffer to be empty. ** Use-package #+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))) - (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)) - (setq use-package-verbose t - use-package-always-ensure t - package-enable-at-startup nil) +(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))) +(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)) +(setq use-package-verbose t + use-package-always-ensure t + package-enable-at-startup nil) #+END_SRC * Customize @@ -75,42 +75,42 @@ that it’s not important whether the file exists or not, which is why I pass =:noerror= to =load= #+BEGIN_SRC emacs-lisp - (setq custom-file "~/.emacs.d/custom.el") - (load custom-file :noerror :nomessage) +(setq custom-file "~/.emacs.d/custom.el") +(load custom-file :noerror :nomessage) #+END_SRC * Styles I prefer an always-visible cursor. Feels less distracting. #+BEGIN_SRC emacs-lisp - (when (fboundp #'blink-cursor-mode) - (blink-cursor-mode -1)) +(when (fboundp #'blink-cursor-mode) + (blink-cursor-mode -1)) #+END_SRC 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)) - (with-eval-after-load 'scroll-bar - (set-scroll-bar-mode nil)) - (with-eval-after-load 'tooltip - (tooltip-mode -1)) - (with-eval-after-load 'tool-bar - (tool-bar-mode -1)) +(when (and menu-bar-mode (not (eq window-system 'ns))) + (menu-bar-mode -1)) +(with-eval-after-load 'scroll-bar + (set-scroll-bar-mode nil)) +(with-eval-after-load 'tooltip + (tooltip-mode -1)) +(with-eval-after-load 'tool-bar + (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)))) +(setq ring-bell-function + (lambda () + (unless (memq this-command + '(isearch-abort abort-recursive-edit exit-minibuffer keyboard-quit undo-tree-undo)) + (ding)))) #+END_SRC #+BEGIN_SRC emacs-lisp - (use-package dash) +(use-package dash) #+END_SRC ** Colours @@ -118,75 +118,75 @@ Ring the bell sometimes, but not so often 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))) +(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))) #+END_SRC Let’s try a more minimal theme. #+BEGIN_SRC emacs-lisp - (use-package minimal-theme - :disabled t - :config (progn - (load-theme 'minimal-light t))) +(use-package minimal-theme + :disabled t + :config (progn + (load-theme 'minimal-light t))) #+END_SRC Let’s try a basic theme. #+BEGIN_SRC emacs-lisp - (use-package basic-theme - :config (progn - (load-theme 'basic t) - (defun show-mode-line () - (interactive) - (let ((faces-to-toggle '(mode-line mode-line-inactive))) - (mapcar (lambda (face) - (set-face-background face "#a1b56c") - (set-face-attribute face nil :height (face-attribute 'default :height))) - faces-to-toggle))) - (defun hide-mode-line () - (interactive) - (let ((faces-to-toggle '(mode-line mode-line-inactive))) - (mapcar (lambda (face) - (set-face-background face "#e8e8e8") - (set-face-attribute face nil :height 20)) - faces-to-toggle))) - (defun mode-line-visual-toggle () - (interactive) - (cond ((string= "#a1b56c" (face-attribute 'mode-line :background)) - (hide-mode-line)) - (t - (show-mode-line)))) - - (defun full-git-gutter-fringe-markers () - ) - - (defun hide-clutter () - (interactive) - (setq default-cursor-type 'bar - default-cursor-in-non-selected-windows nil) - (fringe-mode '(0 . 4)) - (hide-mode-line)) - - (defun show-clutter () - (interactive) - (setq default-cursor-type 'box - default-cursor-in-non-selected-windows 'hollow) - (fringe-mode '(8 . 4)) - (show-mode-line)) - (hide-clutter))) +(use-package basic-theme + :config (progn + (load-theme 'basic t) + (defun show-mode-line () + (interactive) + (let ((faces-to-toggle '(mode-line mode-line-inactive))) + (mapcar (lambda (face) + (set-face-background face "#a1b56c") + (set-face-attribute face nil :height (face-attribute 'default :height))) + faces-to-toggle))) + (defun hide-mode-line () + (interactive) + (let ((faces-to-toggle '(mode-line mode-line-inactive))) + (mapcar (lambda (face) + (set-face-background face "#e8e8e8") + (set-face-attribute face nil :height 20)) + faces-to-toggle))) + (defun mode-line-visual-toggle () + (interactive) + (cond ((string= "#a1b56c" (face-attribute 'mode-line :background)) + (hide-mode-line)) + (t + (show-mode-line)))) + + (defun full-git-gutter-fringe-markers () + ) + + (defun hide-clutter () + (interactive) + (setq default-cursor-type 'bar + default-cursor-in-non-selected-windows nil) + (fringe-mode '(0 . 4)) + (hide-mode-line)) + + (defun show-clutter () + (interactive) + (setq default-cursor-type 'box + default-cursor-in-non-selected-windows 'hollow) + (fringe-mode '(8 . 4)) + (show-mode-line)) + (hide-clutter))) #+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))) +(use-package highlight-stages + :diminish highlight-stages-mode + :config (progn + (add-hook 'lisp-mode-common-hook #'highlight-stages-mode))) #+END_SRC ** Fonts @@ -194,45 +194,45 @@ Highlighting quasi-quoted expressions in lisps is quite useful. 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 :family mono-face :size mono-font-size))) - (add-to-list 'default-frame-alist `(font . ,(format "%s %s" mono-face mono-font-size))) - (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 "ProggyClean" 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)) +(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 :family mono-face :size mono-font-size))) + (add-to-list 'default-frame-alist `(font . ,(format "%s %s" mono-face mono-font-size))) + (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 "ProggyClean" 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))) +(setq font-lock-maximum-decoration '((dired-mode . 1) + (t . 1))) #+END_SRC ** Page Breaks @@ -243,23 +243,23 @@ Horizontal) can only be displayed with a different font, which is not 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))))) +(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))))) #+END_SRC ** Modeline #+BEGIN_SRC emacs-lisp - (column-number-mode t) - (size-indication-mode t) +(column-number-mode t) +(size-indication-mode t) - (setq frame-title-format '("%f" (dired-directory dired-directory))) +(setq frame-title-format '("%f" (dired-directory dired-directory))) #+END_SRC ** Highlight Changes @@ -267,10 +267,10 @@ correct, at least for Liberation Mono. 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))) +(use-package volatile-highlights + :diminish volatile-highlights-mode + :config (progn + (volatile-highlights-mode t))) #+END_SRC ** Renaming major modes @@ -279,21 +279,21 @@ Diminishing major modes does not happen in the same manner as minor 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))) +(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))) #+END_SRC @@ -305,50 +305,50 @@ re-arrangement of modifiers on OSX: Cmd on the outside, then 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")) +(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")) #+END_SRC #+BEGIN_SRC emacs-lisp - (unbind-key "") - (bind-key* "" #'compile) - (bind-key* "" #'kmacro-start-macro-or-insert-counter) - (bind-key* "" #'kmacro-end-or-call-macro) +(unbind-key "") +(bind-key* "" #'compile) +(bind-key* "" #'kmacro-start-macro-or-insert-counter) +(bind-key* "" #'kmacro-end-or-call-macro) - (bind-key* "" #'execute-extended-command) +(bind-key* "" #'execute-extended-command) - (unbind-key "C-z") - (bind-key* "C-" #'other-window) +(unbind-key "C-z") +(bind-key* "C-" #'other-window) - (bind-key* "C-x C-r" #'revert-buffer) - (bind-key* "C-x C-j" #'delete-indentation) - (unbind-key "C-x C-c") +(bind-key* "C-x C-r" #'revert-buffer) +(bind-key* "C-x C-j" #'delete-indentation) +(unbind-key "C-x C-c") - (bind-key* "C-c i" #'insert-char) - (bind-key* "M-/" #'hippie-expand) +(bind-key* "C-c i" #'insert-char) +(bind-key* "M-/" #'hippie-expand) - (unbind-key "s-h") - (unbind-key "s-n") - (unbind-key "s-p") - (unbind-key "s-w") - (bind-key* "s-k" #'kill-or-delete-this-buffer-dwim) +(unbind-key "s-h") +(unbind-key "s-n") +(unbind-key "s-p") +(unbind-key "s-w") +(bind-key* "s-k" #'kill-or-delete-this-buffer-dwim) - (bind-key "C-M-a" #'backward-paragraph text-mode-map) - (bind-key "C-M-e" #'forward-paragraph text-mode-map) +(bind-key "C-M-a" #'backward-paragraph text-mode-map) +(bind-key "C-M-e" #'forward-paragraph text-mode-map) - (bind-key* "s-x" (define-prefix-command 'super-x-map)) - (bind-key* "s-," #'switch-to-dotfiles) - (bind-key* "C-M-x" #'execute-extended-command) - (set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) +(bind-key* "s-x" (define-prefix-command 'super-x-map)) +(bind-key* "s-," #'switch-to-dotfiles) +(bind-key* "C-M-x" #'execute-extended-command) +(set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) #+END_SRC ** Crux @@ -357,38 +357,38 @@ I can replace most of the simple helper/wrapper functions in my 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) +(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))) + ("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 - (defun switch-to-dotfiles () - (interactive) - (projectile-persp-switch-project (expand-file-name "dotfiles" home-project-directory))) +(defun switch-to-dotfiles () + (interactive) + (projectile-persp-switch-project (expand-file-name "dotfiles" home-project-directory))) #+END_SRC ** The Silver Searcher #+BEGIN_SRC emacs-lisp - (use-package ag - :defer 30 - :config (setq ag-project-root-function #'projectile-project-root)) +(use-package ag + :defer 30 + :config (setq ag-project-root-function #'projectile-project-root)) #+END_SRC ** Ripgrep @@ -396,12 +396,12 @@ configuration with crux.el Step over Silver Search, here comes a new challenger. #+BEGIN_SRC emacs-lisp - (use-package ripgrep - :if (executable-find "rg")) +(use-package ripgrep + :if (executable-find "rg")) - (use-package projectile-ripgrep - :bind (("C-c p s r" . projectile-ripgrep)) - :ensure nil) +(use-package projectile-ripgrep + :bind (("C-c p s r" . projectile-ripgrep)) + :ensure nil) #+END_SRC ** Projectile @@ -411,44 +411,44 @@ ones. I added a couple of functions to allow me to open new projects 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 yarn-install (&optional arg) - (interactive "P") - (projectile-with-default-dir (projectile-project-root) - (cmd-to-echo "yarn" "install"))) - - (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))) +(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 yarn-install (&optional arg) + (interactive "P") + (projectile-with-default-dir (projectile-project-root) + (cmd-to-echo "yarn" "install"))) + + (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 @@ -458,15 +458,15 @@ filtering the candidates to those within the project. For it to work, 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))) +(use-package perspective + :bind* ("s-p" . projectile-persp-switch-project) + :demand t + :config (progn + (setq persp-show-modestring t) + (persp-mode))) - (use-package persp-projectile - :ensure t) +(use-package persp-projectile + :ensure t) #+END_SRC ** vc @@ -475,11 +475,11 @@ This is nice for some things that magit doesn’t do, and for those rare occasions that I’m working with something other than git. #+BEGIN_SRC emacs-lisp - (use-package vc - :defer t - :bind (("C-x v C" . vc-resolve-conflicts)) - :config (progn - (setq vc-follow-symlinks t))) +(use-package vc + :defer t + :bind (("C-x v C" . vc-resolve-conflicts)) + :config (progn + (setq vc-follow-symlinks t))) #+END_SRC ** git-gutter-fringe @@ -489,13 +489,13 @@ changed. This package colours the fringe. I have it set to the right fringe so it doesn’t interfere with flycheck. #+BEGIN_SRC emacs-lisp - (use-package git-gutter-fringe - :defer 2 - :diminish git-gutter-mode - :config (progn - (global-git-gutter-mode 1) - (set-face-foreground 'git-gutter:modified "grey") - (setq git-gutter-fr:side 'right-fringe))) +(use-package git-gutter-fringe + :defer 2 + :diminish git-gutter-mode + :config (progn + (global-git-gutter-mode 1) + (set-face-foreground 'git-gutter:modified "grey") + (setq git-gutter-fr:side 'right-fringe))) #+END_SRC ** magit @@ -504,17 +504,17 @@ Magit is my favourite way to use git. I use selective staging all the 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 - magit-display-buffer-function #'magit-display-buffer-fullcolumn-most-v1 - global-magit-file-mode nil) - (add-to-list 'magit-no-confirm 'safe-with-wip)) - :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) +(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 + magit-display-buffer-function #'magit-display-buffer-fullcolumn-most-v1 + 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 @@ -525,8 +525,8 @@ in the past. I often find it useful when I remember writing something a particular way, but it changed later. #+BEGIN_SRC emacs-lisp - (use-package git-timemachine - :commands git-timemachine) +(use-package git-timemachine + :commands git-timemachine) #+END_SRC * Files @@ -537,8 +537,8 @@ Auto-save everything to a temporary directory, instead of cluttering 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) +(setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t)) + create-lockfiles nil) #+END_SRC ** Backups @@ -546,30 +546,30 @@ I like to keep my backups out of regular folders. I tell emacs to use 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)) - (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)))) +(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)) +(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)))) #+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))))) +(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))))) #+END_SRC ** Encoding @@ -578,8 +578,8 @@ UTF-8 is usually appropriate. Note that =prefer-coding-system= expects only a coding system, not a coding system and line ending combination. #+BEGIN_SRC emacs-lisp - (prefer-coding-system 'utf-8) - (setq-default buffer-file-coding-system 'utf-8-auto-unix) +(prefer-coding-system 'utf-8) +(setq-default buffer-file-coding-system 'utf-8-auto-unix) #+END_SRC ** Buffer-file management @@ -588,29 +588,29 @@ Ask if I want to create a directory when it doesn’t exist. This is 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)))) - (add-to-list 'find-file-not-found-functions #'my-create-non-existent-directory) +(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)))) +(add-to-list 'find-file-not-found-functions #'my-create-non-existent-directory) #+END_SRC I often want to rename or delete the file that I’m currently visiting 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))))) +(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))))) #+END_SRC ** Whitespace Butler @@ -619,14 +619,14 @@ I don’t like it when editors change an entire file’s layout when I 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 (daemonp) - (add-hook 'before-make-frame-hook (lambda () - (use-package ws-butler - :config (ws-butler-global-mode 1))))) +(use-package ws-butler + :if window-system + :diminish ws-butler-mode + :config (ws-butler-global-mode 1)) +(if (daemonp) + (add-hook 'before-make-frame-hook (lambda () + (use-package ws-butler + :config (ws-butler-global-mode 1))))) #+END_SRC ** shrink-whitespace @@ -635,8 +635,8 @@ DWIM whitespace removal. So I don’t need =M-SPC=, =M-\= and =C-x o= for similar things any more. #+BEGIN_SRC emacs-lisp - (use-package shrink-whitespace - :bind ("M-SPC" . shrink-whitespace)) +(use-package shrink-whitespace + :bind ("M-SPC" . shrink-whitespace)) #+END_SRC ** Tramp @@ -645,31 +645,31 @@ Tramp is awesome. It makes SSH feel Unix-y. The proxy setup is so 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)))) - - (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"))) +(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)))) + +(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"))) #+END_SRC ** ediff @@ -677,11 +677,11 @@ that I can sudo on remote machines I like a horizonal diff setup, with everything in one frame. #+BEGIN_SRC emacs-lisp - (use-package ediff - :defer t - :config (progn - (setq ediff-split-window-function 'split-window-horizontally - ediff-window-setup-function 'ediff-setup-windows-plain))) +(use-package ediff + :defer t + :config (progn + (setq ediff-split-window-function 'split-window-horizontally + ediff-window-setup-function 'ediff-setup-windows-plain))) #+END_SRC * Indentation @@ -691,8 +691,8 @@ 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 2 - indent-tabs-mode nil) +(setq-default tab-width 2 + indent-tabs-mode nil) #+END_SRC ** auto-indent-mode @@ -701,26 +701,26 @@ Don’t make me think, just indent it! Unless it’s a 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))) +(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))) #+END_SRC ** smart-tabs-mode @@ -729,40 +729,40 @@ Not related to [[smart-tab][=smart-tab=]], this mode indents with tabs and align 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))))) +(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))))) #+END_SRC ** editorconfig #+BEGIN_SRC emacs-lisp - (use-package editorconfig - :config (editorconfig-mode 1)) +(use-package editorconfig + :config (editorconfig-mode 1)) #+END_SRC ** dtrt-indent-mode @@ -771,16 +771,16 @@ Sometimes people use different indentation settings. [[https://github.com/jsche 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))))) +(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))))) #+END_SRC * Security @@ -789,10 +789,10 @@ 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))) +(use-package password-store + :defer 15 + :config (progn + (setq password-store-password-length 16))) #+END_SRC * Buffers @@ -801,54 +801,54 @@ Ibuffer is quite nice for listing all buffers. I don’t use it very often though, as it doesn’t really work with perspectives. #+BEGIN_SRC emacs-lisp - (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))))) +(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))))) #+END_SRC ** Relative Buffer names #+BEGIN_SRC emacs-lisp - (use-package relative-buffers - :defer 15 - :config (progn - (global-relative-buffers-mode))) +(use-package relative-buffers + :defer 15 + :config (progn + (global-relative-buffers-mode))) #+END_SRC ** Narrowing Enable it without prompting #+BEGIN_SRC emacs-lisp - (put 'narrow-to-defun 'disabled nil) - (put 'narrow-to-page 'disabled nil) - (put 'narrow-to-region 'disabled nil) +(put 'narrow-to-defun 'disabled nil) +(put 'narrow-to-page 'disabled nil) +(put 'narrow-to-region 'disabled nil) #+END_SRC ** ace-window @@ -857,21 +857,21 @@ I don’t often have many windows open at once, but when I do, =ace-window= is really nice to jump around them in the same way that =ace-jump= or =avy= work. #+BEGIN_SRC emacs-lisp - (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)))) +(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)))) #+END_SRC * Windows @@ -880,15 +880,15 @@ Scrolling is tricky. I use this setup to help me keep track of the 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 160 - frame-resize-pixelwise nil) - (if (boundp 'ns-pop-up-frames) - (setq ns-pop-up-frames nil)) +(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 160 + frame-resize-pixelwise nil) +(if (boundp 'ns-pop-up-frames) + (setq ns-pop-up-frames nil)) #+END_SRC ** winner @@ -896,10 +896,10 @@ point whilst I’m moving about. 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*")))) +(use-package winner + :init (progn + (winner-mode 1) + (setq winner-boring-buffers '("*Completions*" "*Help*" "*Apropos*" "*Buffer List*" "*info*" "*Compile-Log*")))) #+END_SRC ** windmove @@ -907,11 +907,11 @@ Undo, for window-based commands. Directional window movement #+BEGIN_SRC emacs-lisp - (use-package windmove - :bind (("S-" . windmove-left) - ("S-" . windmove-right) - ("S-" . windmove-up) - ("S-" . windmove-down))) +(use-package windmove + :bind (("S-" . windmove-left) + ("S-" . windmove-right) + ("S-" . windmove-up) + ("S-" . windmove-down))) #+END_SRC * Completion @@ -919,9 +919,9 @@ Make built-in completion a bit more intelligent, by adding substring 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) +(setq completion-styles '(basic initials partial-completion substring) + completion-ignore-case t + tab-always-indent 'complete) #+END_SRC ** Company @@ -931,36 +931,36 @@ auto-complete-mode. I’ve not tried auto-complete-mode as company 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))) +(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))) #+END_SRC #+BEGIN_SRC emacs-lisp - (use-package company-web - :after company) +(use-package company-web + :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))) +(use-package company-nixos-options + :if (eq system-type 'gnu/linux) + :config (progn + (add-to-list 'company-backends 'company-nixos-options))) #+END_SRC * Dates & Times @@ -969,40 +969,40 @@ 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))) +(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))) #+END_SRC Sometimes I want to insert a date or time into a buffer. #+BEGIN_SRC emacs-lisp - (defun insert-date (prefix) - "Insert the current date. With prefix-argument, use British format. With +(defun insert-date (prefix) + "Insert the current date. With prefix-argument, use British format. With 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)))) + (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)))) - (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)))) +(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)))) #+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)) +(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)) #+END_SRC * Directories @@ -1013,68 +1013,68 @@ have two dired windows open, assume that I’m going to be copying/moving files between them. #+BEGIN_SRC emacs-lisp - (use-package dired - :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))) +(use-package dired + :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))) #+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)) - - (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))) +(defun turn-on-dired-omit-mode () + (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))) #+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))) +(use-package dired+ + :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)))) +(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)))) #+END_SRC ** Dired-narrow @@ -1085,10 +1085,10 @@ to start filtering, =RET= to complete the filter and =g= to refresh 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)))) +(with-eval-after-load 'dired + (use-package dired-narrow + :bind (:map dired-mode-map + ("/" . dired-narrow)))) #+END_SRC * Documentation @@ -1099,8 +1099,8 @@ ehelp is a less well-known package that’s part of Emacs and slightly improves the normal help commands, mostly by making quitting them easier. #+BEGIN_SRC emacs-lisp - (use-package ehelp - :bind-keymap ("C-h" . ehelp-map)) +(use-package ehelp + :bind-keymap ("C-h" . ehelp-map)) #+END_SRC ** counsel-dash @@ -1108,33 +1108,33 @@ Emacs’ documentation is great to read from inside Emacs. Counsel-dash 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))))) - - (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")))) +(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))))) + +(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")))) #+END_SRC ** discover-my-major @@ -1142,8 +1142,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 @@ -1151,11 +1151,11 @@ A nicer way to browse keybindings for major modes. 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))) +(use-package which-key + :diminish which-key-mode + :config (progn + (which-key-mode 1) + (which-key-setup-side-window-right-bottom))) #+END_SRC ** eldoc @@ -1164,59 +1164,59 @@ Documentation in the echo-area (where the minibuffer is displayed) is rather useful. #+BEGIN_SRC emacs-lisp - (use-package eldoc - :commands (eldoc-mode) - :diminish eldoc-mode - :config (progn - (setq eldoc-idle-delay 0.1) - (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) +(use-package eldoc + :commands (eldoc-mode) + :diminish eldoc-mode + :config (progn + (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.") - (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 " +(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.") +(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 " " 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)))) +(use-package rect + :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))) +(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))) - (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))) +(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))) - (bind-key* "M-!" #'shell-execute) - (bind-key* "C-x r M-w" #'copy-rectangle) +(bind-key* "M-!" #'shell-execute) +(bind-key* "C-x r M-w" #'copy-rectangle) #+END_SRC #+END_SRC @@ -1228,21 +1228,21 @@ Fortunately, this is possible. Of course, I need to know how many minibuffers there are on the stack. #+BEGIN_SRC emacs-lisp - (setq enable-recursive-minibuffers t) - (minibuffer-depth-indicate-mode t) +(setq enable-recursive-minibuffers t) +(minibuffer-depth-indicate-mode t) #+END_SRC This avoids some issue with the minibuffer and the point being behind the prompt. I don’t remember what exactly. #+BEGIN_SRC emacs-lisp - (setq minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)) +(setq minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)) #+END_SRC 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 @@ -1251,74 +1251,74 @@ Ivy is the new kid on the completion block. It seems to be a strong 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 . "")))) +(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 . "")))) #+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 "" #'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) - (bind-key "M-y" #'counsel-yank-pop) - (bind-key "M-y" #'ivy-next-line ivy-minibuffer-map) - (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)))) +(use-package counsel + :config (progn + (bind-key "M-x" #'counsel-M-x) + (bind-key "" #'counsel-M-x) + (bind-key "" #'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) + (bind-key "M-y" #'counsel-yank-pop) + (bind-key "M-y" #'ivy-next-line ivy-minibuffer-map) + (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 @@ -1329,21 +1329,21 @@ function uses it internally, so I’m keeping it around, even though I 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")))) +(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")))) #+END_SRC ** cmd-to-echo @@ -1353,79 +1353,79 @@ node.js) inside emacs. =cmd-to-echo= seems great for this, as new output pops up in the echo area. #+BEGIN_SRC emacs-lisp - (use-package cmd-to-echo - :commands (cmd-to-echo) - :config (setq cmd-to-echo-add-output-to-process-buffers t)) +(use-package cmd-to-echo + :commands (cmd-to-echo) + :config (setq cmd-to-echo-add-output-to-process-buffers t)) #+END_SRC * Modes Setup some modes for systemd files #+BEGIN_SRC emacs-lisp - (add-to-list 'auto-mode-alist '("\\.service\\'" . conf-mode)) - (add-to-list 'auto-mode-alist '("\\.target\\'" . conf-mode)) - (add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-mode)) +(add-to-list 'auto-mode-alist '("\\.service\\'" . conf-mode)) +(add-to-list 'auto-mode-alist '("\\.target\\'" . conf-mode)) +(add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-mode)) #+END_SRC =direnv=’s files are basically shell scripts, it’s a nice way to set environment variables for projects. #+BEGIN_SRC emacs-lisp - (add-to-list 'auto-mode-alist '("\\.envrc\\'" . sh-mode)) +(add-to-list 'auto-mode-alist '("\\.envrc\\'" . sh-mode)) #+END_SRC 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))) +(use-package xrdb-mode + :ensure nil + :mode (("\\.Xdefaults\\'" . xrdb-mode) + ("\\.Xresources\\'" . xrdb-mode))) - (use-package haskell-mode - :mode (("\\.hs\\'" . haskell-mode))) +(use-package haskell-mode + :mode (("\\.hs\\'" . haskell-mode))) - (use-package dockerfile-mode - :mode (("Dockerfile\\'" . dockerfile-mode))) +(use-package dockerfile-mode + :mode (("Dockerfile\\'" . dockerfile-mode))) - (use-package nix-mode - :mode (("\\.nix\\'" . nix-mode))) +(use-package nix-mode + :mode (("\\.nix\\'" . nix-mode))) - (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)) +(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))) +(use-package nginx-mode + :defer t + :mode (("/nginx/servers/" . nginx-mode) + ("/nginx/.*\\.d/" . nginx-mode))) - (use-package lua-mode - :defer t) +(use-package lua-mode + :defer t) - (use-package ruby-mode - :mode (("\\.rb\\'" . ruby-mode) - ("\\.cap\\'" . ruby-mode))) +(use-package ruby-mode + :mode (("\\.rb\\'" . ruby-mode) + ("\\.cap\\'" . ruby-mode))) - (use-package go-mode - :mode (("\\.go\\'" . go-mode))) +(use-package go-mode + :mode (("\\.go\\'" . go-mode))) - (use-package jinja2-mode - :mode (("\\.j2\\'" . jinja2-mode) - ("\\.jinja\\'" . jinja2-mode))) +(use-package jinja2-mode + :mode (("\\.j2\\'" . jinja2-mode) + ("\\.jinja\\'" . jinja2-mode))) - (use-package scss-mode - :defer t - :config (progn - (setq scss-compile-at-save nil))) +(use-package scss-mode + :defer t + :config (progn + (setq scss-compile-at-save nil))) - (use-package yaml-mode - :mode (("/group_vars/.*" . yaml-mode) - ("/host_vars/.*" . yaml-mode))) +(use-package 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)) +(define-derived-mode ansible-mode yaml-mode "Ansible") +(add-to-list 'auto-mode-alist '("\\(?:ansible.+\\|roles/.+/\\(?:tasks\\|handlers\\)\\)/.+\\.yml\\'" . ansible-mode)) - (define-derived-mode saltstack-mode yaml-mode "Salt") - (add-to-list 'auto-mode-alist '("\\.sls\\'" . saltstack-mode)) +(define-derived-mode saltstack-mode yaml-mode "Salt") +(add-to-list 'auto-mode-alist '("\\.sls\\'" . saltstack-mode)) #+END_SRC ** ledger @@ -1434,45 +1434,45 @@ I use [[http://ledger-cli.org/][=ledger=]] to manage my finances. It has an Ema 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 - (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 \\^Assets:Budget$") - ("Budget Allocation" "ledger -f %(ledger-file) bal -p \"this month\" --limit \"payee=~/budget/\" \\^Funds --format \"\\ +(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 + (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 \\^Assets:Budget$") + ("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)"))))) + ("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 #+BEGIN_SRC emacs-lisp - (use-package markdown-mode - :defer t - :config (progn - (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) +(use-package markdown-mode + :defer t + :config (progn + (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) #+END_SRC ** Org @@ -1480,49 +1480,49 @@ works really nicely. 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")) +(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")) - 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-protocol) + org-modules '(org-protocol) - ;; Add time done to ‘done’ tasks - org-log-done 'time + ;; Add time done to ‘done’ tasks + org-log-done 'time - 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))) + 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))) #+END_SRC **** org-babel @@ -1533,13 +1533,16 @@ to have my =ledger= setup in an org file with some graph processing with R or something. #+BEGIN_SRC emacs-lisp - (use-package ob-core - :defer t - :ensure nil - :config (org-babel-do-load-languages - 'org-babel-load-languages - '((ledger . t) - (sh . t)))) +(use-package ob-core + :defer t + :ensure nil + :config (progn + (org-babel-do-load-languages 'org-babel-load-languages + '((ledger . t) + (sh . t))) + (setq org-src-tab-acts-natively t + org-edit-src-content-indentation 0 + org-src-preserve-indentation t))) #+END_SRC **** org-journal @@ -1547,58 +1550,58 @@ with R or something. 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))))) +(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))))) #+END_SRC **** org-mobile #+BEGIN_SRC emacs-lisp - (defun ap/org-mobile-pull (descriptor action file) - (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)))))) +(defun ap/org-mobile-pull (descriptor action file) + (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)))))) #+END_SRC **** org-caldav @@ -1608,17 +1611,17 @@ from org-mode. Previously I had to wait for org-mobile to sync and 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))) +(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))) #+END_SRC **** org-page @@ -1628,21 +1631,21 @@ 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"))) +(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. #+BEGIN_SRC emacs-lisp - (use-package mpc - :defer t - :config (progn - (setq mpc-browser-tags '(Genre Albumartist|Composer|Performer Album|Playlist)))) +(use-package mpc + :defer t + :config (progn + (setq mpc-browser-tags '(Genre Albumartist|Composer|Performer Album|Playlist)))) #+END_SRC * Programming ** flycheck @@ -1650,12 +1653,12 @@ Emacs actually supports playing music via mpd. 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)))) +(use-package flycheck + :diminish " ✓" + :defer 5 + :config (progn + (global-flycheck-mode) + (setq flycheck-check-syntax-automatically '(save new-line mode-enabled)))) #+END_SRC ** golang @@ -1663,25 +1666,25 @@ On-the-fly error checking in programming modes? Yes please. 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))) +(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))) - (use-package go-eldoc - :commands go-eldoc-setup - :init (progn - (add-hook 'go-mode-hook #'go-eldoc-setup))) +(use-package go-eldoc + :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))) +(use-package go-projectile + :defer t + :config (progn + (setq go-projectile-switch-gopath 'maybe))) #+END_SRC @@ -1691,16 +1694,16 @@ Go has a few packages to inter-operate with other emacs packages. 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))) +(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))) #+END_SRC ** Lisps @@ -1711,13 +1714,13 @@ Lisp modes don’t seem to have a common ancestor. So I made a custom hook which I trigger in every lispy-mode. #+BEGIN_SRC emacs-lisp - (defcustom lisp-mode-common-hook nil - "Hook run when entering any Lisp mode." - :type 'hook - :group 'lisp) +(defcustom lisp-mode-common-hook nil + "Hook run when entering any Lisp mode." + :type 'hook + :group 'lisp) - (defun ap/lisp-setup () - (run-hooks 'lisp-mode-common-hook)) +(defun ap/lisp-setup () + (run-hooks 'lisp-mode-common-hook)) #+END_SRC **** Redshank @@ -1726,11 +1729,11 @@ Lisp syntax allows for really easy refactoring. Redshank gives some 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))) +(use-package redshank + :diminish " Λ" + :after (paredit) + :config (progn + (add-hook 'lisp-mode-common-hook #'turn-on-redshank-mode))) #+END_SRC *** Emacs Lisp @@ -1739,29 +1742,29 @@ Customise the modeline-display of =emacs-lisp-mode=. Then make sure it runs the common lisp hooks. #+BEGIN_SRC emacs-lisp - (add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup) - (add-hook 'emacs-lisp-mode-hook #'eldoc-mode) +(add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup) +(add-hook 'emacs-lisp-mode-hook #'eldoc-mode) #+END_SRC 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))) +(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))) #+END_SRC Interactive elisp #+BEGIN_SRC emacs-lisp - (use-package ielm - :defer t - :ensure nil - :config (progn - (add-hook 'ielm-mode-hook (lambda () - (run-hooks 'lisp-mode-common-hook))))) +(use-package ielm + :defer t + :ensure nil + :config (progn + (add-hook 'ielm-mode-hook (lambda () + (run-hooks 'lisp-mode-common-hook))))) #+END_SRC *** Scheme & Lisp @@ -1769,12 +1772,12 @@ Interactive elisp I don’t work with these as often as I would like #+BEGIN_SRC emacs-lisp - (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)) - (add-hook 'lisp-mode-hook #'set-common-lisp-indentation) +(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)) +(add-hook 'lisp-mode-hook #'set-common-lisp-indentation) #+END_SRC **** geiser @@ -1783,11 +1786,11 @@ A REPL thing for Scheme. Hopefully I’ll get to use it more in the future. #+BEGIN_SRC emacs-lisp - (use-package geiser - :commands (geiser-mode - geiser - run-geiser - run-racket)) +(use-package geiser + :commands (geiser-mode + geiser + run-geiser + run-racket)) #+END_SRC **** slime @@ -1795,34 +1798,34 @@ future. A REPL thing (and more) for Lisp. #+BEGIN_SRC emacs-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")))) +(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")))) #+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))) - - (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))) +(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))) + +(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))) #+END_SRC **** cider @@ -1830,21 +1833,21 @@ A REPL thing (and more) for Lisp. A REPL thing for Clojure #+BEGIN_SRC emacs-lisp - (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))) +(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))) #+END_SRC ** Auto-compile Auto-compile emacs lisp when saving. #+BEGIN_SRC emacs-lisp - (use-package auto-compile - :defer t - :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) +(use-package auto-compile + :defer t + :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) #+END_SRC ** cc-mode @@ -1853,16 +1856,16 @@ Although I don’t use C or C++, setting up the mode is helpful because quite a few other modes are derived from it. #+BEGIN_SRC emacs-lisp - (use-package cc-mode - :defer 5 - :init (progn - (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 '+))) +(use-package cc-mode + :defer 5 + :init (progn + (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 '+))) #+END_SRC ** quickrun @@ -1870,8 +1873,8 @@ quite a few other modes are derived from it. It’s nice to be able to quickly evaluate some code. Although I don’t really seem to use it. #+BEGIN_SRC emacs-lisp - (use-package quickrun - :bind (("C-c C-e" . quickrun))) +(use-package quickrun + :bind (("C-c C-e" . quickrun))) #+END_SRC ** Scala @@ -1879,15 +1882,15 @@ really seem to use it. Let’s try using Scala. #+BEGIN_SRC emacs-lisp - (use-package scala-mode - :pin melpa-stable) +(use-package scala-mode + :pin melpa-stable) #+END_SRC And add ensime, an IDE-style environment. #+BEGIN_SRC emacs-lisp - (use-package ensime - :pin melpa-stable) +(use-package ensime + :pin melpa-stable) #+END_SRC ** Web development @@ -1900,29 +1903,29 @@ think there’s anything as good as paredit/redshank for refactoring in 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) - (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 2 - js2-include-node-externs t))) +(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) + (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 2 + js2-include-node-externs t))) #+END_SRC **** jade (not pug) @@ -1935,18 +1938,18 @@ To debug with node, use version 6.9.1 or later of node and run it with For Chrom*, it needs to be launched with ~--remote-debugging-port=9222~ #+BEGIN_SRC emacs-lisp - (use-package jade - :config (progn - (add-hook 'js2-mode-hook #'jade-interaction-mode))) +(use-package jade + :config (progn + (add-hook 'js2-mode-hook #'jade-interaction-mode))) #+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))) +(use-package coffee-mode + :mode ("\\.coffee\\'" . coffee-mode) + :config (progn + (setq coffee-indent-like-python-mode t))) #+END_SRC *** tern @@ -1955,29 +1958,29 @@ Tern understands javascript. It adds really clever documented completions, besides other IDE-like things. #+BEGIN_SRC emacs-lisp - (use-package tern - :commands ap/enable-tern - :if (executable-find "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))) +(use-package tern + :commands ap/enable-tern + :if (executable-find "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)) +(with-eval-after-load '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))) +(use-package json-mode + :mode (("\\.json\\'" . json-mode) + ("\\.sailsrc\\'" . json-mode) + ("composer\\.lock\\'" . json-mode) + ("\\.tern-project\\'" . json-mode))) #+END_SRC *** restclient @@ -1987,23 +1990,23 @@ calls. Feels a bit like using =org-babel=. I wonder if there’s an 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))) +(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))) #+END_SRC *** sgml-mode This is for HTML, since old versions of HTML were derived from SGML. #+BEGIN_SRC emacs-lisp - (use-package sgml-mode - :defer t - :config (setq sgml-basic-offset 2)) +(use-package sgml-mode + :defer t + :config (setq sgml-basic-offset 2)) #+END_SRC *** emmet-mode @@ -2011,11 +2014,11 @@ This is for HTML, since old versions of HTML were derived from SGML. Emmet is really nice to write HTML quickly. Especially with frameworks that require multiple nested elements to do anything useful. #+BEGIN_SRC emacs-lisp - (use-package emmet-mode - :commands (emmet-mode) - :diminish (emmet-mode . " >") - :init (progn - (add-hook 'web-mode-hook #'emmet-mode))) +(use-package emmet-mode + :commands (emmet-mode) + :diminish (emmet-mode . " >") + :init (progn + (add-hook 'web-mode-hook #'emmet-mode))) #+END_SRC *** web-mode @@ -2025,44 +2028,44 @@ is really nice, because it handles the HTML part the same way in all of them as well. #+BEGIN_SRC emacs-lisp - (use-package web-mode - :mode (("/views/.*\\.php\\'" . web-mode) - ("\\.html\\'" . web-mode) - ("/templates/.*\\.php\\'" . web-mode) - ("\\.ejs\\'" . web-mode)) - :config (progn - (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 - web-mode-enable-auto-pairing nil - web-mode-enable-auto-quoting nil) - (sp-local-pair '(web-mode) "<%" "%>"))) +(use-package web-mode + :mode (("/views/.*\\.php\\'" . web-mode) + ("\\.html\\'" . web-mode) + ("/templates/.*\\.php\\'" . web-mode) + ("\\.ejs\\'" . web-mode)) + :config (progn + (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 + 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=. #+BEGIN_SRC emacs-lisp - (define-derived-mode twig-mode web-mode "Twig") - (add-to-list 'auto-mode-alist '("\\.html\\.twig\\'" . twig-mode)) +(define-derived-mode twig-mode web-mode "Twig") +(add-to-list 'auto-mode-alist '("\\.html\\.twig\\'" . twig-mode)) #+END_SRC * Spelling #+BEGIN_SRC emacs-lisp - (use-package ispell - :bind (("" . ispell-word)) - :config (progn - (cond - ((executable-find "aspell") (setq ispell-program-name "aspell" - ispell-dictionary "british" - ispell-really-aspell t - ispell-really-hunspell nil)) - ((executable-find "hunspell") (setq ispell-program-name "hunspell" - ispell-really-aspell nil - ispell-really-hunspell t))))) +(use-package ispell + :bind (("" . ispell-word)) + :config (progn + (cond + ((executable-find "aspell") (setq ispell-program-name "aspell" + ispell-dictionary "british" + ispell-really-aspell t + ispell-really-hunspell nil)) + ((executable-find "hunspell") (setq ispell-program-name "hunspell" + ispell-really-aspell nil + ispell-really-hunspell t))))) #+END_SRC * Scripting @@ -2070,20 +2073,20 @@ 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) - ("zshenv\\'" . shell-script-mode) - ("zshrc\\'" . shell-script-mode)) - :config (setq sh-shell-file "/usr/bin/env zsh" - sh-indentation 2 - sh-basic-offset 2)) +(use-package sh-script + :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)) #+END_SRC #+BEGIN_SRC emacs-lisp - (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) +(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) #+END_SRC ** eshell @@ -2092,30 +2095,30 @@ I should try to get into the habit of using this more. It’s really nice, when I remember to use it. #+BEGIN_SRC emacs-lisp - (use-package eshell - :bind ("C-c s" . eshell) - :config (progn - (setq eshell-directory-name "~/.emacs.d/eshell") - (add-hook 'eshell-load-hook (lambda () - (bind-key "C-c C-l" #'counsel-esh-history eshell-mode-map))))) +(use-package eshell + :bind ("C-c s" . eshell) + :config (progn + (setq eshell-directory-name "~/.emacs.d/eshell") + (add-hook 'eshell-load-hook (lambda () + (bind-key "C-c C-l" #'counsel-esh-history eshell-mode-map))))) - (use-package em-smart - :ensure nil - :commands eshell-smart-initialize - :init (progn - (add-hook 'eshell-load-hook #'eshell-smart-initialize)) - :config (progn - (setq eshell-where-to-jump 'begin - eshell-review-quick-commands nil - eshell-smart-space-goes-to-end t))) +(use-package em-smart + :ensure nil + :commands eshell-smart-initialize + :init (progn + (add-hook 'eshell-load-hook #'eshell-smart-initialize)) + :config (progn + (setq eshell-where-to-jump 'begin + eshell-review-quick-commands nil + eshell-smart-space-goes-to-end t))) - (autoload #'eshell/cd "em-dirs") - (defun eshell-goto-current-dir (&optional arg) - (interactive "P") - (let ((dir default-directory)) - (eshell arg) - (eshell/cd dir))) - (bind-key "C-c S" #'eshell-goto-current-dir) +(autoload #'eshell/cd "em-dirs") +(defun eshell-goto-current-dir (&optional arg) + (interactive "P") + (let ((dir default-directory)) + (eshell arg) + (eshell/cd dir))) +(bind-key "C-c S" #'eshell-goto-current-dir) #+END_SRC @@ -2123,22 +2126,22 @@ nice, when I remember to use it. *** Shells #+BEGIN_SRC emacs-lisp - (use-package shell - :defer t - :ensure nil - :config (define-key shell-mode-map - (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) +(use-package shell + :defer t + :ensure nil + :config (define-key shell-mode-map + (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) - (use-package comint - :defer t - :ensure nil - :config (bind-key "C-c C-l" #'counsel-shell-history comint-mode-map)) +(use-package comint + :defer t + :ensure nil + :config (bind-key "C-c C-l" #'counsel-shell-history comint-mode-map)) - (defun comint-delchar-or-eof-or-kill-buffer (arg) - (interactive "p") - (if (null (get-buffer-process (current-buffer))) - (kill-buffer) - (comint-delchar-or-maybe-eof arg))) +(defun comint-delchar-or-eof-or-kill-buffer (arg) + (interactive "p") + (if (null (get-buffer-process (current-buffer))) + (kill-buffer) + (comint-delchar-or-maybe-eof arg))) #+END_SRC * Text editing @@ -2146,10 +2149,10 @@ nice, when I remember to use it. Emacs has an editor within. #+BEGIN_SRC emacs-lisp - (put 'upcase-region 'disabled nil) - (put 'downcase-region 'disabled nil) - (setq sentence-end-double-space t - line-move-visual nil) +(put 'upcase-region 'disabled nil) +(put 'downcase-region 'disabled nil) +(setq sentence-end-double-space t + line-move-visual nil) #+END_SRC ** align @@ -2158,14 +2161,14 @@ Emacs has an editor within. 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)))))) +(use-package align + :defer 10 + :ensure nil + :config (progn + (add-to-list 'align-rules-list + '(colon-key-value + (regexp . ":\\(\\s-*\\)") + (modes . '(js2-mode)))))) #+END_SRC ** Clipboard @@ -2173,12 +2176,12 @@ The most important one for me is JSON property alignment. I like to use the clipboard more than the primary selection in X11. #+BEGIN_SRC emacs-lisp - (setq x-select-enable-clipboard t - save-interprogram-paste-before-kill t) - (if (functionp '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))) +(setq x-select-enable-clipboard t + save-interprogram-paste-before-kill t) +(if (functionp '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 ** Selection @@ -2187,34 +2190,34 @@ I’m quite used to deleting text by selecting it and typing. Emacs has a mode for that. #+BEGIN_SRC emacs-lisp - (delete-selection-mode t) +(delete-selection-mode t) #+END_SRC 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)) +(use-package subword + :diminish subword-mode + :init (global-subword-mode t)) #+END_SRC I find that =zap-up-to-char= normally makes more sense to me than =zap-to-char=. #+BEGIN_SRC emacs-lisp - (use-package misc - :ensure nil - :bind (("M-z" . zap-up-to-char) - ("M-Z" . zap-to-char))) +(use-package misc + :ensure nil + :bind (("M-z" . zap-up-to-char) + ("M-Z" . zap-to-char))) #+END_SRC Expanding the region by semantic units was something I quite liked 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)) +(use-package expand-region + :bind ("C-M-SPC" . er/expand-region) + :config (setq expand-region-fast-keys-enabled nil)) #+END_SRC ** Typography @@ -2223,7 +2226,7 @@ I like using typographic quotes, but they’re complicated to insert manually. them. #+BEGIN_SRC emacs-lisp - (electric-quote-mode) +(electric-quote-mode) #+END_SRC ** avy @@ -2232,16 +2235,16 @@ Avy is a really nice way to move around files, like ace-jump-mode, but 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) - ("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 ?\;)))) +(use-package avy + :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 ?\;)))) #+END_SRC ** goto-chg @@ -2250,8 +2253,8 @@ This is like popping the mark, only it filters to only change areas and doesn’t go back to the same place more than once. #+BEGIN_SRC emacs-lisp - (use-package goto-chg - :bind ("C-c C-SPC" . goto-last-change)) +(use-package goto-chg + :bind ("C-c C-SPC" . goto-last-change)) #+END_SRC ** multiple-cursors @@ -2261,14 +2264,14 @@ cursors was one of my favourite features, so I was really happy when I saw that multiple-cursors was released for Emacs. #+BEGIN_SRC emacs-lisp - (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-" #'mc/mark-all-like-this-dwim) - (bind-key "C-" #'mc/mark-more-like-this-extended) - (bind-key "C-S-L" #'mc/edit-lines))) +(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-" #'mc/mark-all-like-this-dwim) + (bind-key "C-" #'mc/mark-more-like-this-extended) + (bind-key "C-S-L" #'mc/edit-lines))) #+END_SRC ** paredit @@ -2277,13 +2280,13 @@ Balanced parentheses in lisps are nice, but all the refactoring and 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))) +(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))) #+END_SRC ** smartparens @@ -2293,33 +2296,33 @@ I didn’t find smartparens’ implementation of paredit style to be as 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-" #'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-" #'sp-splice-sexp-killing-backward smartparens-mode-map) - (bind-key "M-" #'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-" #'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))) +(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-" #'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-" #'sp-splice-sexp-killing-backward smartparens-mode-map) + (bind-key "M-" #'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-" #'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 ** smart-scan @@ -2327,9 +2330,9 @@ nice as the real version Move between instances of a symbol #+BEGIN_SRC emacs-lisp - (use-package smartscan - :config (progn - (smartscan-mode 1))) +(use-package smartscan + :config (progn + (smartscan-mode 1))) #+END_SRC ** move-text @@ -2337,8 +2340,8 @@ Move between instances of a symbol Transposing lines, made easier. #+BEGIN_SRC emacs-lisp - (use-package move-text - :config (move-text-default-bindings)) +(use-package move-text + :config (move-text-default-bindings)) #+END_SRC ** undo-tree @@ -2347,21 +2350,21 @@ Emacs’ default handling of undo is a bit confusing. Undo-tree makes 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))) - :diminish undo-tree-mode) +(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))) + :diminish undo-tree-mode) #+END_SRC ** visual-regexp @@ -2371,10 +2374,10 @@ so this package is pretty useful because it highlights everything in 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))) +(use-package visual-regexp + :bind (("C-c r" . vr/replace) + ("C-c q" . vr/query-replace) + ("C-c m" . vc/mc-mark))) #+END_SRC * Tangling @@ -2391,40 +2394,40 @@ to the =after-save-hook= ensuring to always tangle and byte-compile the =org=-document after changes. #+BEGIN_SRC emacs-lisp - (use-package async - :commands (async-start) - :defer 2) +(use-package async + :commands (async-start) + :defer 2) - (defun tangle-if-init () - "If the current buffer is 'init.org' the code-blocks are +(defun tangle-if-init () + "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))) - - (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))))) - - (defun tangle-init () - "Tangle init.org asynchronously." - - (interactive) - (message "Tangling init") - (async-start - (symbol-function #'tangle-init-sync) - (lambda (result) - (message "Init tangling completed: %s" result)))) + (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))))) + +(defun tangle-init () + "Tangle init.org asynchronously." + + (interactive) + (message "Tangling init") + (async-start + (symbol-function #'tangle-init-sync) + (lambda (result) + (message "Init tangling completed: %s" result)))) #+END_SRC # Local Variables: @@ -2434,15 +2437,15 @@ 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))))) - (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))) +(run-with-idle-timer 2 nil (lambda () + (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))) #+END_SRC -- cgit 1.4.1 From f6f869d01cb7b9ccc87cedc8a93fe87cb7dd8ed9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 8 Dec 2016 12:18:27 +0100 Subject: Emacs: remove empty function --- tag-emacs/emacs.d/init.org | 3 --- 1 file changed, 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 92f84f3c..3b86248a 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -162,9 +162,6 @@ Let’s try a basic theme. (t (show-mode-line)))) - (defun full-git-gutter-fringe-markers () - ) - (defun hide-clutter () (interactive) (setq default-cursor-type 'bar -- cgit 1.4.1 From b03264235e8f01c5662c8181c6ea85ca3be8c4f2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 14 Dec 2016 10:59:16 +0100 Subject: Emacs: Set emmet indentation --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 3b86248a..a572362b 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2015,6 +2015,7 @@ frameworks that require multiple nested elements to do anything useful. :commands (emmet-mode) :diminish (emmet-mode . " >") :init (progn + (setq emmet-indentation 2) (add-hook 'web-mode-hook #'emmet-mode))) #+END_SRC -- cgit 1.4.1 From e14f629e9171461d24058c0d0f893932e66c665e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 14 Dec 2016 10:59:31 +0100 Subject: Emacs: Configure copy-as-format --- tag-emacs/emacs.d/init.org | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index a572362b..b0a03c8d 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2182,6 +2182,24 @@ I like to use the clipboard more than the primary selection in X11. (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))) #+END_SRC +*** Copy formatted code + +#+BEGIN_SRC emacs-lisp +(bind-key* "C-c w" (define-prefix-command 'copy-as-map)) +(use-package copy-as-format + :bind (("C-c C-w" . copy-as-format) + :map copy-as-map + ("b" . copy-as-format-bitbucket) + ("g" . copy-as-format-github) + ("h" . copy-as-format-hipchat) + ("w" . copy-as-format-html) + ("j" . copy-as-format-jira) + ("m" . copy-as-format-markdown) + ("s" . copy-as-format-slack))) +#+END_SRC + +** + ** Selection I’m quite used to deleting text by selecting it and typing. Emacs has -- cgit 1.4.1 From ecfac5177a2277cae3e0239378121fd4b589fcc7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 14 Dec 2016 10:59:47 +0100 Subject: Fix use of deprecated cursor variables --- tag-emacs/emacs.d/init.org | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index b0a03c8d..c54ef2e0 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -164,15 +164,15 @@ Let’s try a basic theme. (defun hide-clutter () (interactive) - (setq default-cursor-type 'bar - default-cursor-in-non-selected-windows nil) + (setq-default cursor-type 'bar) + (setq-default cursor-in-non-selected-windows nil) (fringe-mode '(0 . 4)) (hide-mode-line)) (defun show-clutter () (interactive) - (setq default-cursor-type 'box - default-cursor-in-non-selected-windows 'hollow) + (setq-default cursor-type 'box) + (setq-default cursor-in-non-selected-windows 'hollow) (fringe-mode '(8 . 4)) (show-mode-line)) (hide-clutter))) -- cgit 1.4.1 From 5891adae96f220ae730c2258beb4460717c5e20f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 14 Dec 2016 11:00:05 +0100 Subject: Emacs: Remove old tramp proxy listing --- 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 c54ef2e0..6398e10a 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -658,8 +658,7 @@ that I can sudo on remote machines 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)))) + (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil)))) (use-package tramp-sh :ensure nil -- cgit 1.4.1 From 4d67c3a9251ed35fa8a00a589ad688644dd9c6b8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 15 Dec 2016 16:43:31 +0100 Subject: Emacs: Always use bar cursor --- tag-emacs/emacs.d/init.org | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 6398e10a..352f6ef2 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -162,17 +162,16 @@ Let’s try a basic theme. (t (show-mode-line)))) + (setq-default cursor-type 'bar) + (setq-default cursor-in-non-selected-windows nil) + (defun hide-clutter () (interactive) - (setq-default cursor-type 'bar) - (setq-default cursor-in-non-selected-windows nil) (fringe-mode '(0 . 4)) (hide-mode-line)) (defun show-clutter () (interactive) - (setq-default cursor-type 'box) - (setq-default cursor-in-non-selected-windows 'hollow) (fringe-mode '(8 . 4)) (show-mode-line)) (hide-clutter))) -- cgit 1.4.1 From 10c8548d14e2349ff9bdcf0aa2f26b2e8eadd012 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 15 Dec 2016 16:45:01 +0100 Subject: zsh: Update macOS Terminal icon with cwd --- tag-zsh/config/zsh/zshrc | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index d66b5914..7b3d332f 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -177,6 +177,46 @@ else setopt prompt_cr PROMPT='%F{blue}%~%f${prompt_pure_username} %(?.%F{magenta}.%F{red})>%f ' + + ## From https://github.com/robbyrussell/oh-my-zsh/blob/71deb74552d54630d99ae1db3647ebed7b3bc735/lib/termsupport.zsh + + # Keep Apple Terminal.app's current working directory updated + # Based on this answer: http://superuser.com/a/315029 + # With extra fixes to handle multibyte chars and non-UTF-8 locales + + if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then + # Emits the control sequence to notify Terminal.app of the cwd + # Identifies the directory using a file: URI scheme, including + # the host name to disambiguate local vs. remote paths. + function update_terminalapp_cwd() { + emulate -L zsh + + # Percent-encode the pathname. + # Percent-encode the pathname. + local URL_PATH='' + { + # Use LC_CTYPE=C to process text byte-by-byte. + local i ch hexch LC_CTYPE=C + for ((i = 1; i <= ${#PWD}; ++i)); do + ch="$PWD[i]" + if [[ "$ch" =~ [/._~A-Za-z0-9-] ]]; then + URL_PATH+="$ch" + else + hexch=$(printf "%02X" "'$ch") + URL_PATH+="%$hexch" + fi + done + } + [[ $? != 0 ]] && return 1 + + printf '\e]7;%s\a' "file://$HOST$URL_PATH" + } + + # Use a precmd hook instead of a chpwd hook to avoid contaminating output + precmd_functions+=(update_terminalapp_cwd) + # Run once to get initial cwd set + update_terminalapp_cwd + fi fi if zplug check clvv/fasd -- cgit 1.4.1 From e2d85d381b0a3e827e9bf37dd6c527d6b08044d6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 15 Dec 2016 16:45:27 +0100 Subject: zsh: Set or unset window title according to host --- tag-zsh/config/zsh/zshrc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 7b3d332f..e1f5555f 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -217,6 +217,18 @@ else # Run once to get initial cwd set update_terminalapp_cwd fi + + function set_window_title { printf '\e]2;%s\a' "$1" } + + function update_window_title { + if [[ -n "$SSH_CONNECTION" || $UID -eq 0 ]] + then + set_window_title "$USER@$HOST" + else + set_window_title "" + fi + } + precmd_functions+=(update_window_title) fi if zplug check clvv/fasd -- cgit 1.4.1 From af6db3aab7323722c11be334afcac0c9fd6c93f9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 21 Dec 2016 12:39:11 +0000 Subject: Emacs: Ignore TRAMP directories for VC --- tag-emacs/emacs.d/init.org | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 352f6ef2..45f3e81b 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -475,7 +475,10 @@ 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) + (setq vs-ignore-dir-regexp (format "\\(%s\\)\\|\\(%s\\)" + vc-ignore-dir-regexp + tramp-file-name-regexp)))) #+END_SRC ** git-gutter-fringe -- cgit 1.4.1 From 9b90996f566efeae7e0d87656701930f10edcaa3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 21 Dec 2016 12:41:44 +0000 Subject: zsh: Disable line editor for dumb terminal --- tag-zsh/config/zsh/zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index e1f5555f..5cd2f5a2 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -164,6 +164,7 @@ fi if [[ $TERM == "dumb" ]] then + unsetopt zle PROMPT="> " else unset RPROMPT -- cgit 1.4.1 From 93576941f22fa40567543f069a814e095212c289 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 21 Dec 2016 12:43:00 +0000 Subject: Tramp: Increase cache time for remote directory completion --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 45f3e81b..96a94b8a 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -652,6 +652,7 @@ that I can sudo on remote machines (setq tramp-default-method "ssh" tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root")) tramp-backup-directory-alist backup-directory-alist + tramp-completion-reread-directory-timeout 60 backup-enable-predicate (lambda (name) (and (normal-backup-enable-predicate name) (not (let ((method (file-remote-p name 'method))) -- cgit 1.4.1 From 58c0c710ea6f2184f53f3b1849f0691e23b79d22 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 22 Dec 2016 16:24:31 +0000 Subject: Emacs: Use ssh-managed controlmaster options --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 96a94b8a..e12cd6f7 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -653,6 +653,7 @@ that I can sudo on remote machines tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root")) tramp-backup-directory-alist backup-directory-alist tramp-completion-reread-directory-timeout 60 + tramp-ssh-controlmaster-options nil backup-enable-predicate (lambda (name) (and (normal-backup-enable-predicate name) (not (let ((method (file-remote-p name 'method))) -- cgit 1.4.1 From b65e808182fcd34a9a2adaf0c5444613d54c911c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 23 Dec 2016 09:19:25 +0000 Subject: zsh: Follow zplug updates --- tag-zsh/config/zsh/zshrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 5cd2f5a2..269d5e53 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -12,8 +12,8 @@ then fi 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 +zplug "lukechilds/zsh-better-npm-completion", if:"[[ -n $commands[npm] ]]", defer:2 +zplug "hlissner/zsh-autopair", defer:2 HISTSIZE=3000 SAVEHIST=10000 -- cgit 1.4.1 From 1678fdfee0357c6ef6fcb9094390826686cb0a93 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 3 Jan 2017 11:25:37 +0100 Subject: Karabiner: Move config file to .config --- tag-karabiner/config/karabiner/karabiner.json | 63 ++++++++++++++++++++++ .../karabiner.d/configuration/karabiner.json | 63 ---------------------- 2 files changed, 63 insertions(+), 63 deletions(-) create mode 100644 tag-karabiner/config/karabiner/karabiner.json delete mode 100644 tag-karabiner/karabiner.d/configuration/karabiner.json diff --git a/tag-karabiner/config/karabiner/karabiner.json b/tag-karabiner/config/karabiner/karabiner.json new file mode 100644 index 00000000..0e866a63 --- /dev/null +++ b/tag-karabiner/config/karabiner/karabiner.json @@ -0,0 +1,63 @@ +{ + "profiles": [ + { + "devices": [ + { + "identifiers": { + "is_keyboard": true, + "is_pointing_device": false, + "product_id": 602, + "vendor_id": 1452 + }, + "ignore": true, + "keyboard_type": 41 + }, + { + "identifiers": { + "is_keyboard": true, + "is_pointing_device": false, + "product_id": 8209, + "vendor_id": 1241 + }, + "ignore": false, + "keyboard_type": 40 + } + ], + "fn_function_keys": { + "f1": "vk_consumer_brightness_down", + "f10": "mute", + "f11": "volume_down", + "f12": "volume_up", + "f2": "vk_consumer_brightness_up", + "f3": "vk_mission_control", + "f4": "vk_launchpad", + "f5": "vk_consumer_illumination_down", + "f6": "vk_consumer_illumination_up", + "f7": "vk_consumer_previous", + "f8": "vk_consumer_play", + "f9": "vk_consumer_next" + }, + "name": "Default Profile", + "selected": true, + "simple_modifications": { + "caps_lock": "delete_or_backspace", + "left_command": "left_option", + "left_control": "left_command", + "left_option": "left_control", + "right_command": "right_option", + "right_control": "right_command", + "right_option": "right_control" + } + }, + { + "name": "Macbook keyboard", + "simple_modifications": { + "caps_lock": "delete_or_backspace", + "grave_accent_and_tilde": "non_us_backslash", + "left_command": "left_control", + "non_us_backslash": "grave_accent_and_tilde", + "right_command": "right_control" + } + } + ] +} diff --git a/tag-karabiner/karabiner.d/configuration/karabiner.json b/tag-karabiner/karabiner.d/configuration/karabiner.json deleted file mode 100644 index 0e866a63..00000000 --- a/tag-karabiner/karabiner.d/configuration/karabiner.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "profiles": [ - { - "devices": [ - { - "identifiers": { - "is_keyboard": true, - "is_pointing_device": false, - "product_id": 602, - "vendor_id": 1452 - }, - "ignore": true, - "keyboard_type": 41 - }, - { - "identifiers": { - "is_keyboard": true, - "is_pointing_device": false, - "product_id": 8209, - "vendor_id": 1241 - }, - "ignore": false, - "keyboard_type": 40 - } - ], - "fn_function_keys": { - "f1": "vk_consumer_brightness_down", - "f10": "mute", - "f11": "volume_down", - "f12": "volume_up", - "f2": "vk_consumer_brightness_up", - "f3": "vk_mission_control", - "f4": "vk_launchpad", - "f5": "vk_consumer_illumination_down", - "f6": "vk_consumer_illumination_up", - "f7": "vk_consumer_previous", - "f8": "vk_consumer_play", - "f9": "vk_consumer_next" - }, - "name": "Default Profile", - "selected": true, - "simple_modifications": { - "caps_lock": "delete_or_backspace", - "left_command": "left_option", - "left_control": "left_command", - "left_option": "left_control", - "right_command": "right_option", - "right_control": "right_command", - "right_option": "right_control" - } - }, - { - "name": "Macbook keyboard", - "simple_modifications": { - "caps_lock": "delete_or_backspace", - "grave_accent_and_tilde": "non_us_backslash", - "left_command": "left_control", - "non_us_backslash": "grave_accent_and_tilde", - "right_command": "right_control" - } - } - ] -} -- cgit 1.4.1 From ab8adeaa5ac297d2d46375c1a4cb483d45560597 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 3 Jan 2017 11:47:52 +0100 Subject: Add mpv configuration on osx --- host-ap-spotcap.local/config/mpv/config | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 host-ap-spotcap.local/config/mpv/config diff --git a/host-ap-spotcap.local/config/mpv/config b/host-ap-spotcap.local/config/mpv/config new file mode 100644 index 00000000..56c6d996 --- /dev/null +++ b/host-ap-spotcap.local/config/mpv/config @@ -0,0 +1,11 @@ +[default] + +vo=opengl-hq:backend=cocoa +ao=coreaudio + +hwdec=videotoolbox + +alang=en,eng,de,ger + +ytdl +ytdl-format=best -- cgit 1.4.1 From 60966619f991659c804c8f8c82224e82dd7a8dd7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 16 Jan 2017 11:59:31 +0100 Subject: Show modeline when using minibuffer --- tag-emacs/emacs.d/init.org | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index e12cd6f7..3a34b84a 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -174,7 +174,10 @@ Let’s try a basic theme. (interactive) (fringe-mode '(8 . 4)) (show-mode-line)) - (hide-clutter))) + (hide-clutter) + + (add-hook 'minibuffer-setup-hook #'show-mode-line) + (add-hook 'minibuffer-exit-hook #'hide-mode-line))) #+END_SRC Highlighting quasi-quoted expressions in lisps is quite useful. -- cgit 1.4.1 From 4f655369e8e87b73e2a932091b5db84c81e7736a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 17 Jan 2017 11:38:48 +0100 Subject: zsh: Set os/arch in zshenv --- tag-zsh/config/zsh/zshenv | 24 ++++++++++++++++++++++++ tag-zsh/config/zsh/zshrc | 8 ++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index 86efc02d..e62dca5c 100644 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -16,4 +16,28 @@ then then export SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/ssh-agent.socket fi + + case $OSTYPE in + darwin*) + os=darwin + ;; + linux-gnu) + os=linux + ;; + freebsd*) + os=freebsd + ;; + *) + os=unknown + ;; + esac + + case $MACHTYPE in + *64) + arch=amd64 + ;; + *) + arch=386 + ;; + esac fi diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 269d5e53..1d37e8ea 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -55,8 +55,8 @@ gnu_ls_isodate="--time-style=long-iso" bsd_ls_options="-p" bsd_ls_isodate="-D '%F %k:%M'" -case $OSTYPE in - darwin*) +case $os in + darwin) if [[ -n $commands[gls] ]] then ls='\gls' @@ -67,11 +67,11 @@ case $OSTYPE in ls_isodate=$bsd_ls_isodate fi ;; - freebsd*) + freebsd) ls_options=$bsd_ls_options ls_isodate=$bsd_ls_isodate ;; - linux-gnu) + linux) ls_options=$gnu_ls_options ls_isodate=$gnu_ls_isodate ;; -- cgit 1.4.1 From 173f06c9e467bd332754a73299c589b6fa17f664 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 17 Jan 2017 11:39:17 +0100 Subject: Emacs: Use non-AA Monaco font on macOS --- tag-emacs/emacs.d/init.org | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 3a34b84a..2207ebb2 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -201,7 +201,9 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (variable-pitch-mode) (setq cursor-type 'bar)) - (defun ap/set-fonts (mono-face mono-font-size variable-face variable-font-size) + (defun ap/set-fonts (mono-face mono-font-size variable-face variable-font-size antialias) + (if boundp 'ns-antialias-text + (setq ns-antialias-text antialias)) (when mono-face (let ((default-font (font-spec :family mono-face :size mono-font-size))) (add-to-list 'default-frame-alist `(font . ,(format "%s %s" mono-face mono-font-size))) @@ -214,15 +216,15 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (interactive) (cond ((eq window-system 'w32) - (ap/set-fonts "Liberation Mono" 11 "Segoe UI" 11)) + (ap/set-fonts "Liberation Mono" 11 "Segoe UI" 11 t)) ((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 "ProggyClean" 11 "Lucida Grande" 12)))) + (ap/set-fonts "SF Mono" 12 "Lucida Grande" 12 t) + (ap/set-fonts "Monaco" 10 "Lucida Grande" 12 nil)))) ((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 "Terminus" 12 "Lucida" 10 nil)))) (ap/set-fonts-according-to-system)) #+END_SRC -- cgit 1.4.1 From deab2de981f236450b9c397c5eef7ed665eb6744 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 17 Jan 2017 12:01:56 +0100 Subject: zsh: Don’t run compinit as zplug handles it --- tag-zsh/config/zsh/zshrc | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 1d37e8ea..6ca27689 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -1,7 +1,7 @@ # -*- mode: sh; -*- source $ZPLUG_HOME/init.zsh -zplug "zsh-users/zsh-completions" +zplug "zsh-users/zsh-completions", depth:1, defer:0 zplug "Tarrasch/zsh-autoenv", as:plugin zplug "clvv/fasd", hook-build:"PREFIX=$HOME make install" zplug "caarlos0/zsh-open-pr", as:plugin @@ -143,11 +143,6 @@ zplug load # General configuration setopt auto_cd # Change directories without `cd` -if zplug check zsh-users/zsh-completions -then - autoload -U compinit && compinit -fi - if [[ -n $commands[hub] ]] then alias git=hub -- cgit 1.4.1 From 84516d9ffe8a2b066aa57e376a9f5411ee5c4c1e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 17 Jan 2017 12:03:55 +0100 Subject: zsh: Use OMZ yarn completion --- tag-zsh/config/zsh/zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 6ca27689..2b8e7dc3 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -12,6 +12,7 @@ then fi zplug "gerges/oh-my-zsh-jira-plus", as:plugin, if:"[[ ${(SN)HOST%spotcap} ]]" +zplug "plugins/yarn", from:oh-my-zsh, defer:2, if:"[[ -n $commands[yarn] ]]", defer:2 zplug "lukechilds/zsh-better-npm-completion", if:"[[ -n $commands[npm] ]]", defer:2 zplug "hlissner/zsh-autopair", defer:2 -- cgit 1.4.1 From 966c4b9ab78499f82ff467a4e330d0966feb6784 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 17 Jan 2017 15:20:12 +0100 Subject: zsh: Install fzf --- tag-zsh/config/zsh/zshrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 2b8e7dc3..80068eb5 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -4,6 +4,9 @@ source $ZPLUG_HOME/init.zsh zplug "zsh-users/zsh-completions", depth:1, defer:0 zplug "Tarrasch/zsh-autoenv", as:plugin zplug "clvv/fasd", hook-build:"PREFIX=$HOME make install" +zplug "junegunn/fzf-bin", from:gh-r, as:command, rename-to:fzf +zplug "junegunn/fzf", as:plugin, use:"shell/*.zsh" +zplug "junegunn/fzf", as:command, use:"bin/*" zplug "caarlos0/zsh-open-pr", as:plugin if [[ -n $commands[nix-env] ]] then -- cgit 1.4.1 From b08f6fb6ee6592db030f3f72d97ef291d1ce2d4c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 17 Jan 2017 15:42:02 +0100 Subject: Fix fzf completion --- tag-zsh/config/zsh/zshrc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 80068eb5..86f1b54d 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -5,7 +5,7 @@ zplug "zsh-users/zsh-completions", depth:1, defer:0 zplug "Tarrasch/zsh-autoenv", as:plugin zplug "clvv/fasd", hook-build:"PREFIX=$HOME make install" zplug "junegunn/fzf-bin", from:gh-r, as:command, rename-to:fzf -zplug "junegunn/fzf", as:plugin, use:"shell/*.zsh" +zplug "junegunn/fzf", as:plugin, use:"shell/*.zsh", defer:2 zplug "junegunn/fzf", as:command, use:"bin/*" zplug "caarlos0/zsh-open-pr", as:plugin if [[ -n $commands[nix-env] ]] @@ -231,6 +231,23 @@ else precmd_functions+=(update_window_title) fi +if zplug check junegunn/fzf +then + _fzf_compgen_path() { + echo "$1" + command find -L "$1" \ + -name .git -prune -o -name .svn -prune -o \( -type d -o -type f -o -type l \) \ + -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@' + } + + _fzf_compgen_dir() { + command find -L "$1" \ + -name .git -prune -o -name .svn -prune -o -type d \ + -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@' + } +fi + + if zplug check clvv/fasd then if [[ -n $commands[fasd] ]] -- cgit 1.4.1 From a7bd2163fabfb0caa3fbe723fd26c10cab3b8520 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 18 Jan 2017 17:10:11 +0100 Subject: Fix syntax error --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 2207ebb2..25d90032 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -202,7 +202,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (setq cursor-type 'bar)) (defun ap/set-fonts (mono-face mono-font-size variable-face variable-font-size antialias) - (if boundp 'ns-antialias-text + (if (boundp 'ns-antialias-text) (setq ns-antialias-text antialias)) (when mono-face (let ((default-font (font-spec :family mono-face :size mono-font-size))) -- cgit 1.4.1 From 6cdeb6638fa7bb15e026dbe67146e193bd2edcb7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 20 Jan 2017 11:14:13 +0100 Subject: zsh: Install tumult on macOS --- tag-zsh/config/zsh/zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 86f1b54d..762c2ca9 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -8,6 +8,7 @@ zplug "junegunn/fzf-bin", from:gh-r, as:command, rename-to:fzf zplug "junegunn/fzf", as:plugin, use:"shell/*.zsh", defer:2 zplug "junegunn/fzf", as:command, use:"bin/*" zplug "caarlos0/zsh-open-pr", as:plugin +zplug "unixorn/tumult.plugin.zsh", as:plugin, if:"[[ $os -eq darwin ]]" if [[ -n $commands[nix-env] ]] then zplug "spwhitt/nix-zsh-completions", as:plugin -- cgit 1.4.1 From 17041cb7fdc04c0bc99b6ab2c6a9b4eb6585a32b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 20 Jan 2017 11:14:53 +0100 Subject: zsh: Remove fasd --- tag-zsh/config/zsh/zshrc | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 762c2ca9..fb9a36a7 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -3,7 +3,6 @@ source $ZPLUG_HOME/init.zsh zplug "zsh-users/zsh-completions", depth:1, defer:0 zplug "Tarrasch/zsh-autoenv", as:plugin -zplug "clvv/fasd", hook-build:"PREFIX=$HOME make install" zplug "junegunn/fzf-bin", from:gh-r, as:command, rename-to:fzf zplug "junegunn/fzf", as:plugin, use:"shell/*.zsh", defer:2 zplug "junegunn/fzf", as:command, use:"bin/*" @@ -248,23 +247,4 @@ then } 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 -fi - unsetopt flow_control # Let me use ^S and ^Q -- cgit 1.4.1 From 2c7164682e333c10649b17791af7be87cecfdb38 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 20 Jan 2017 11:15:02 +0100 Subject: slate: s/Safari/Google Chrome/ --- host-ap-spotcap.local/slate | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host-ap-spotcap.local/slate b/host-ap-spotcap.local/slate index da60e6f0..43462889 100644 --- a/host-ap-spotcap.local/slate +++ b/host-ap-spotcap.local/slate @@ -16,7 +16,7 @@ alias 1-right push right bar-resize:screenSizeX/2 0 alias 2-left push left bar-resize:screenSizeX/2 1 alias 2-right push right bar-resize:screenSizeX/2 1 -layout workLayout "Safari":REPEAT ${1-left} +layout workLayout "Google Chrome":REPEAT ${1-left} layout workLayout "Emacs" ${1-right} layout workLayout "Terminal" ${2-left} layout workLayout "HipChat" ${2-right} -- cgit 1.4.1 From ce2b07080b9a2f12af6311cde3e049fed63c24a8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 24 Jan 2017 17:02:13 +0100 Subject: Disable unused ggtags mode --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 25d90032..71e70e74 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1700,6 +1700,7 @@ A nice completion backend for programming modes. #+BEGIN_SRC emacs-lisp (use-package ggtags + :disabled t :commands turn-on-ggtags-mode :functions (ggtags-navigation-mode-abort) :config (progn -- cgit 1.4.1 From c090565b332d5ec6a90ef1a35f953979edd09f32 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 26 Jan 2017 16:31:03 +0100 Subject: Emacs: Tell magit to use ivy directly --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 71e70e74..cbe5d911 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -512,7 +512,7 @@ time. Make sure to set it up with a nice =completing-read-function= :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-completing-read-function #'ivy-completing-read magit-popup-use-prefix-argument 'default magit-push-always-verify nil magit-display-buffer-function #'magit-display-buffer-fullcolumn-most-v1 -- cgit 1.4.1 From 8c8d10f5f0529d0b650b0b2006855972a8fa2acc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 27 Jan 2017 16:02:51 +0100 Subject: Emacs: Add commands for yarn add {,--dev} --- tag-emacs/emacs.d/init.org | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index cbe5d911..ba739581 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -439,6 +439,16 @@ based upon some folder conventions I use. (projectile-with-default-dir (projectile-project-root) (cmd-to-echo "yarn" "install"))) + (defun yarn-add-dev (package) + (interactive "spackage: ") + (projectile-with-default-dir (projectile-project-root) + (cmd-to-echo "yarn" (concat "add --dev " package)))) + + (defun yarn-add (package) + (interactive "spackage: ") + (projectile-with-default-dir (projectile-project-root) + (cmd-to-echo "yarn" (concat "add " package)))) + (defun ap/open-work-project (&optional arg) (interactive "P") (ap/open-subfolder-project work-project-directory arg)) -- cgit 1.4.1 From 904e37311218a1ab484aca9a25af85ff3a75cd92 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 31 Jan 2017 13:56:33 +0100 Subject: Emacs: Remove spurious END_SRC marker --- tag-emacs/emacs.d/init.org | 2 -- 1 file changed, 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index ba739581..a982840f 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1234,8 +1234,6 @@ rather useful. (bind-key* "C-x r M-w" #'copy-rectangle) #+END_SRC -#+END_SRC - * Minibuffer Sometimes I want to use the minibuffer, but I’m already inside it. -- cgit 1.4.1 From 4023678dd3408f5623b1a52155a447b31deb54ac Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 31 Jan 2017 14:29:17 +0100 Subject: Emacs: Use exec-path-from-shell on macOS --- tag-emacs/emacs.d/init.org | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index a982840f..75d62e2e 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -31,6 +31,19 @@ the buffer to be empty. user-full-name "Alan Pearce") #+end_src +** Environment Variables + +MacOS doesn’t have a reasonable way to set environment variables and +read them automatically any more. So, let’s use the +[[https://github.com/purcell/exec-path-from-shell][exec-path-from-shell]] package to set up ~exec-path~ and similar +variables from whatever my shell configuration is. + +#+BEGIN_SRC emacs-lisp +(use-package exec-path-from-shell + :if (eq system-type 'darwin) + :init (exec-path-from-shell-initialize)) +#+END_SRC + * Packaging ** Use-package -- cgit 1.4.1 From 7c5d4880ec9eb293405284a4650b0ff0a237cc2e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 1 Feb 2017 16:45:33 +0100 Subject: Emacs: Move environment variable configuration --- tag-emacs/emacs.d/init.org | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 75d62e2e..95f1cd17 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -31,19 +31,6 @@ the buffer to be empty. user-full-name "Alan Pearce") #+end_src -** Environment Variables - -MacOS doesn’t have a reasonable way to set environment variables and -read them automatically any more. So, let’s use the -[[https://github.com/purcell/exec-path-from-shell][exec-path-from-shell]] package to set up ~exec-path~ and similar -variables from whatever my shell configuration is. - -#+BEGIN_SRC emacs-lisp -(use-package exec-path-from-shell - :if (eq system-type 'darwin) - :init (exec-path-from-shell-initialize)) -#+END_SRC - * Packaging ** Use-package @@ -311,6 +298,19 @@ modes. #+END_SRC +* Environment Variables + +MacOS doesn’t have a reasonable way to set environment variables and +read them automatically any more. So, let’s use the +[[https://github.com/purcell/exec-path-from-shell][exec-path-from-shell]] package to set up ~exec-path~ and similar +variables from whatever my shell configuration is. + +#+BEGIN_SRC emacs-lisp +(use-package exec-path-from-shell + :if (eq system-type 'darwin) + :init (exec-path-from-shell-initialize)) +#+END_SRC + * Keybindings I think =set-keyboard-coding-system= stops OS X from doing something -- cgit 1.4.1 From e4e278906803759063a61a285fc74e331e142e9f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 1 Feb 2017 16:46:09 +0100 Subject: Emacs: Install and configure company-restclient --- tag-emacs/emacs.d/init.org | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 95f1cd17..08817cf8 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2025,6 +2025,10 @@ integration between the two yet. (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))) + +(use-package company-restclient + :after (company restclient) + :init (add-to-list 'company-backends #'company-restclient t)) #+END_SRC *** sgml-mode -- cgit 1.4.1 From e3837db14daef7e40111c555d818e1cdcc73abd9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 1 Feb 2017 16:46:55 +0100 Subject: Emacs: Don’t use dabbrev in company --- tag-emacs/emacs.d/init.org | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 08817cf8..987ed2e6 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -968,9 +968,8 @@ seems to work perfectly well for me. (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-files (company-gtags + company-etags company-keywords) company-oddmuse) company-idle-delay .3 company-begin-commands '(self-insert-command) company-auto-complete #'company-explicit-action-p -- cgit 1.4.1 From adbaf0a4651c8b38f14628736d92a3c4dd2e7cb1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 1 Feb 2017 16:47:54 +0100 Subject: Emacs: Always show first completion candidate inline --- tag-emacs/emacs.d/init.org | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 987ed2e6..cb47fe61 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -970,6 +970,9 @@ seems to work perfectly well for me. company-clang company-xcode company-cmake company-capf company-files (company-gtags company-etags company-keywords) company-oddmuse) + company-frontends '(company-pseudo-tooltip-unless-just-one-frontend + company-preview-frontend + company-echo-metadata-frontend) company-idle-delay .3 company-begin-commands '(self-insert-command) company-auto-complete #'company-explicit-action-p -- cgit 1.4.1 From 53ff73eef1b992c31f885b3c62b1eedd05e752fd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 1 Feb 2017 16:48:59 +0100 Subject: Slate: Move layout shortcut to cmd-ctrl-enter --- host-ap-spotcap.local/slate | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host-ap-spotcap.local/slate b/host-ap-spotcap.local/slate index 43462889..05a689a7 100644 --- a/host-ap-spotcap.local/slate +++ b/host-ap-spotcap.local/slate @@ -26,7 +26,7 @@ layout portable "Emacs" ${1-full} default workLayout resolutions:${mon-laptop};${mon-work} default portable resolutions:${mon-laptop} -bind return:ctrl layout workLayout +bind return:ctrl;cmd layout workLayout # Push Bindings bind right:alt;cmd push right bar-resize:screenSizeX/2 -- cgit 1.4.1 From a0219037c6eff35b09b0ec4352efff3606b5d140 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 1 Feb 2017 16:49:17 +0100 Subject: Slate: Work with Safari Tech Preview as default browser --- host-ap-spotcap.local/slate | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host-ap-spotcap.local/slate b/host-ap-spotcap.local/slate index 05a689a7..d002b5a4 100644 --- a/host-ap-spotcap.local/slate +++ b/host-ap-spotcap.local/slate @@ -16,7 +16,7 @@ alias 1-right push right bar-resize:screenSizeX/2 0 alias 2-left push left bar-resize:screenSizeX/2 1 alias 2-right push right bar-resize:screenSizeX/2 1 -layout workLayout "Google Chrome":REPEAT ${1-left} +layout workLayout "Safari Technology Preview":REPEAT ${1-left} layout workLayout "Emacs" ${1-right} layout workLayout "Terminal" ${2-left} layout workLayout "HipChat" ${2-right} -- cgit 1.4.1 From 614ecb408d28794985bd96459689be97ecdf87aa Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 5 Feb 2017 10:14:54 +0100 Subject: zsh: Don’t check SHLVL under X It seems to be too inconsistent --- tag-zsh/config/zsh/zshenv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index e62dca5c..e75704ca 100644 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -1,4 +1,4 @@ -if [[ $SHLVL -eq 1 || (-n $DISPLAY && $SHLVL -lt 3) ]] +if [[ $SHLVL -eq 1 || -n $DISPLAY ]] then if [[ -f $ZDOTDIR/zshenv.local ]] then -- cgit 1.4.1 From bd8cffa2c4d377935bd70b4780235bbec92dc9f7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 5 Feb 2017 10:15:19 +0100 Subject: Emacs: Fix Emacs font-size --- tag-emacs/emacs.d/init.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index cb47fe61..ac4d4e2c 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -223,8 +223,8 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (ap/set-fonts "SF Mono" 12 "Lucida Grande" 12 t) (ap/set-fonts "Monaco" 10 "Lucida Grande" 12 nil)))) ((eq window-system 'x) - (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 12)) - (ap/set-fonts "Terminus" 12 "Lucida" 10 nil)))) + (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 10)) + (ap/set-fonts "Terminus" 10 "Lucida" 10 nil)))) (ap/set-fonts-according-to-system)) #+END_SRC -- cgit 1.4.1 From 57d40296cdb4ad759b857b0ea4c396d2ade94b80 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 6 Feb 2017 08:50:15 +0100 Subject: Emacs: Improve hide/show mode line functions --- tag-emacs/emacs.d/init.org | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index cb47fe61..ad025d5d 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -141,26 +141,25 @@ Let’s try a basic theme. (use-package basic-theme :config (progn (load-theme 'basic t) + + (set-face-background 'mode-line "#a1b56c") + + (defvar mode-line-default-format mode-line-format) + (defcustom mode-line-default-hidden t + "Whether to hide the mode line by default") + (defun show-mode-line () (interactive) - (let ((faces-to-toggle '(mode-line mode-line-inactive))) - (mapcar (lambda (face) - (set-face-background face "#a1b56c") - (set-face-attribute face nil :height (face-attribute 'default :height))) - faces-to-toggle))) + (setq mode-line-format mode-line-default-format) + (when (called-interactively-p) + (setq-default mode-line-format mode-line-default-format) + (setq mode-line-default-hidden nil))) (defun hide-mode-line () (interactive) - (let ((faces-to-toggle '(mode-line mode-line-inactive))) - (mapcar (lambda (face) - (set-face-background face "#e8e8e8") - (set-face-attribute face nil :height 20)) - faces-to-toggle))) - (defun mode-line-visual-toggle () - (interactive) - (cond ((string= "#a1b56c" (face-attribute 'mode-line :background)) - (hide-mode-line)) - (t - (show-mode-line)))) + (setq mode-line-format nil) + (when (called-interactively-p) + (setq-default mode-line-format nil) + (setq mode-line-default-hidden t))) (setq-default cursor-type 'bar) (setq-default cursor-in-non-selected-windows nil) @@ -176,6 +175,16 @@ Let’s try a basic theme. (show-mode-line)) (hide-clutter) + (when mode-line-default-hidden + (call-interactively #'hide-mode-line)) + + (defun hide-mode-line-if-default-hidden () + (if mode-line-default-hidden + (hide-mode-line) + (show-mode-line))) + + (add-hook 'after-change-major-mode-hook #'hide-mode-line-if-default-hidden) + (add-hook 'minibuffer-setup-hook #'show-mode-line) (add-hook 'minibuffer-exit-hook #'hide-mode-line))) #+END_SRC -- cgit 1.4.1 From 2087353c177eb3eddffc6b7746ff533e374b9b3a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 7 Feb 2017 12:07:12 +0100 Subject: Emacs: Make bar cursor thinner --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index d2fd8139..a38cc75c 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -161,7 +161,7 @@ Let’s try a basic theme. (setq-default mode-line-format nil) (setq mode-line-default-hidden t))) - (setq-default cursor-type 'bar) + (setq-default cursor-type '(bar . 1)) (setq-default cursor-in-non-selected-windows nil) (defun hide-clutter () -- cgit 1.4.1 From 53128ff702dc1e3d90f2f5eecca505d9eb360230 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 7 Feb 2017 12:07:27 +0100 Subject: Emacs: Show modeline by default At least, until I can figure out how to show a divider --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index a38cc75c..bb9486ee 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -145,7 +145,7 @@ Let’s try a basic theme. (set-face-background 'mode-line "#a1b56c") (defvar mode-line-default-format mode-line-format) - (defcustom mode-line-default-hidden t + (defcustom mode-line-default-hidden nil "Whether to hide the mode line by default") (defun show-mode-line () -- cgit 1.4.1 From fd0c985d2c2b1f653956dfe8d8633f5165f661ad Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 7 Feb 2017 15:40:32 +0100 Subject: Emacs: Fix called-interactively-p warnings --- tag-emacs/emacs.d/init.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index bb9486ee..502c7cda 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -151,13 +151,13 @@ Let’s try a basic theme. (defun show-mode-line () (interactive) (setq mode-line-format mode-line-default-format) - (when (called-interactively-p) + (when (called-interactively-p 'interactive) (setq-default mode-line-format mode-line-default-format) (setq mode-line-default-hidden nil))) (defun hide-mode-line () (interactive) (setq mode-line-format nil) - (when (called-interactively-p) + (when (called-interactively-p 'interactive) (setq-default mode-line-format nil) (setq mode-line-default-hidden t))) -- cgit 1.4.1 From 8da664ea9c7dfcb55ed89099c050e40c640556c2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 7 Feb 2017 15:40:45 +0100 Subject: Emacs: Fix exec-path-from-shell-initialize error --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 502c7cda..685d9f85 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -317,7 +317,7 @@ variables from whatever my shell configuration is. #+BEGIN_SRC emacs-lisp (use-package exec-path-from-shell :if (eq system-type 'darwin) - :init (exec-path-from-shell-initialize)) + :config (exec-path-from-shell-initialize)) #+END_SRC * Keybindings -- cgit 1.4.1 From 98a40f3e1c7081e876026a642b101bc446310a82 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 11 Feb 2017 18:16:28 +0100 Subject: Emacs: Remove disable solarized theme setup --- tag-emacs/emacs.d/init.org | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index bb9486ee..1a5ed530 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -115,17 +115,6 @@ Ring the bell sometimes, but not so often ** Colours -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))) -#+END_SRC - Let’s try a more minimal theme. #+BEGIN_SRC emacs-lisp -- cgit 1.4.1 From d4831b52d94a87578f05985630688b123c564c03 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 19 Feb 2017 13:38:08 +0100 Subject: Emacs: Remove perspective It seemed to slow things down a lot, particularly on macOS. I seem to be able to get on fine without it, as well. --- tag-emacs/emacs.d/init.org | 40 +++++++--------------------------------- 1 file changed, 7 insertions(+), 33 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 685d9f85..8408f0a1 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -403,7 +403,7 @@ configuration with crux.el #+BEGIN_SRC emacs-lisp (defun switch-to-dotfiles () (interactive) - (projectile-persp-switch-project (expand-file-name "dotfiles" home-project-directory))) + (projectile-switch-project-by-name (expand-file-name "dotfiles" home-project-directory))) #+END_SRC ** The Silver Searcher @@ -435,7 +435,9 @@ based upon some folder conventions I use. #+BEGIN_SRC emacs-lisp (use-package projectile - :bind (("C-c C-f" . projectile-find-file) + :bind (("s-p" . projectile-switch-project) + ("C-x b" . projectile-switch-to-buffer) + ("C-c C-f" . projectile-find-file) ("s-x s-f" . projectile-find-file) ("C-x g" . projectile-vc) ("s-G" . projectile-vc)) @@ -484,24 +486,6 @@ based upon some folder conventions I use. projectile-completion-system 'ivy))) #+END_SRC -** perspective - -This package makes buffer-switching inside of projects make sense, by -filtering the candidates to those within the project. For it to work, -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))) - -(use-package persp-projectile - :ensure t) -#+END_SRC - ** vc This is nice for some things that magit doesn’t do, and for those rare @@ -834,8 +818,7 @@ This is a frontend to the GPG-powered =pass= program. * Buffers ** Ibuffer -Ibuffer is quite nice for listing all buffers. I don’t use it very -often though, as it doesn’t really work with perspectives. +Ibuffer is quite nice for listing all buffers. #+BEGIN_SRC emacs-lisp (use-package ibuffer @@ -1339,7 +1322,6 @@ replacement for helm so far. (bind-key "" #'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) (bind-key "M-y" #'counsel-yank-pop) (bind-key "M-y" #'ivy-next-line ivy-minibuffer-map) (defadvice counsel-find-file (after find-file-sudo activate) @@ -1347,15 +1329,7 @@ replacement for helm so far. (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)))) + (find-alternate-file (concat "/sudo::" buffer-file-name)))))) #+END_SRC @@ -1476,7 +1450,7 @@ works really nicely. :init (progn (defun open-budget () (interactive) - (projectile-persp-switch-project "~/Sync") + (projectile-switch-project-by-name "~/Sync/Default") (find-file (expand-file-name "ledger/my.ledger" (projectile-project-root))) (ledger-report "Budget (Cumulative)" nil))) :config (progn -- cgit 1.4.1 From 3f2d03c57aa3237acfb799e39dda1b63da52cc53 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 21 Feb 2017 16:44:21 +0100 Subject: Emacs: Use Roboto Mono on Retina --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 8408f0a1..aaef5e4f 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -229,7 +229,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource ((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 t) + (ap/set-fonts "Roboto Mono" 13 "Lucida Grande" 13 t) (ap/set-fonts "Monaco" 10 "Lucida Grande" 12 nil)))) ((eq window-system 'x) (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 10)) -- cgit 1.4.1 From 3eef5fb45506f504728fdfbe33423d17c54b6254 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 21 Feb 2017 17:09:08 +0100 Subject: Emacs: Configure borders and window dividers --- tag-emacs/emacs.d/init.org | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index aaef5e4f..62d1c398 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -143,6 +143,12 @@ Let’s try a basic theme. (load-theme 'basic t) (set-face-background 'mode-line "#a1b56c") + (set-face-background 'border "#a1b56c") + (set-face-foreground 'border "#a1b56c") + (set-face-background 'vertical-border "#a1b56c") + (set-face-foreground 'vertical-border "#a1b56c") + (set-face-background 'window-divider "#a1b56c") + (set-face-foreground 'window-divider "#a1b56c") (defvar mode-line-default-format mode-line-format) (defcustom mode-line-default-hidden nil @@ -183,6 +189,12 @@ Let’s try a basic theme. (hide-mode-line) (show-mode-line))) + (add-to-list 'default-frame-alist '(border-width . 0)) + (add-to-list 'default-frame-alist '(internal-border-width . 0)) + (setq window-divider-default-bottom-width 6 + window-divider-default-places t) + (window-divider-mode +1) + (add-hook 'after-change-major-mode-hook #'hide-mode-line-if-default-hidden) (add-hook 'minibuffer-setup-hook #'show-mode-line) -- cgit 1.4.1 From df714aba617f7c229e9d7cc169a0c988d5a44339 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 21 Feb 2017 17:09:22 +0100 Subject: Emacs: Install magithub --- tag-emacs/emacs.d/init.org | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 62d1c398..dd0ef727 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -547,6 +547,11 @@ time. Make sure to set it up with a nice =completing-read-function= global-magit-file-mode nil) (add-to-list 'magit-no-confirm 'safe-with-wip)) :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) + +(use-package magithub + :after magit + :pin melpa + :config (magithub-feature-autoinject t)) #+END_SRC ** git-timemachine -- cgit 1.4.1 From 24ec8ea3b03d84b22b25ebd895abc0e9ef07dfa5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 22 Feb 2017 10:28:08 +0100 Subject: Emacs: Add process-exit-code command --- tag-emacs/emacs.d/init.org | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 68f2c7ea..cf71075e 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1234,6 +1234,10 @@ rather useful. (command (read-shell-command "Shell command: " nil nil nil))) (shell-command (replace-regexp-in-string "%" file-buffer command) to-current-buffer))) +(defun process-exit-code (program &rest args) + "Run PROGRAM with ARGS and return the exit code" + (apply 'call-process program nil nil nil args)) + (defun narrow-to-region-indirect (start end) "Restrict editing in this buffer to the current region, indirectly." (interactive "r") -- cgit 1.4.1 From 8ea44e87da66487793cd8cf886d1ded87d124d1f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 22 Feb 2017 10:28:31 +0100 Subject: Add system for loading extra encrypted configuration --- tag-emacs/emacs.d/init.org | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index cf71075e..9a8c298e 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1251,6 +1251,59 @@ rather useful. (bind-key* "C-x r M-w" #'copy-rectangle) #+END_SRC +** Auxillary Configuration + +#+BEGIN_SRC emacs-lisp +;; (require 'pinentry) +;; (require 'epa) + +(defvar have-private-key + (file-exists-p (expand-file-name "secring.gpg" "~/.gnupg/"))) + +(defvar gpg-agent-ssh-sock + (or (getenv "GPG_AGENT_INFO") + (concat "/run/user/" (number-to-string (user-uid)) "/gnupg/S.gpg-agent.ssh"))) + +(defun read-gpg-file (file) + (let ((file-to-decrypt (expand-file-name file user-emacs-directory)) + (ctx (epg-make-context epa-protocol))) + (if (file-exists-p file-to-decrypt) + (epg-decrypt-file ctx file-to-decrypt nil) + (message "Decrypting %s...failed" file-to-decrypt) + (error "File %s does not exist" file-to-decrypt)))) + +(defun load-gpg (file) + (if have-private-key + (load file) + (message "WARNING: Couldn't load %s (No gpg key found)" file))) + +; load this in a post-frame hook because gpg-agent asks for a password on first +; startup and caches it. Don't want emacs daemon to hang because of gpg-agent. +(defun load-private-data () + (interactive) + (if (not have-private-key) + (message "ERROR: Private GPG key not found") + (unless (getenv "GPG_AGENT_INFO") + (start-process "gpg-agent" nil "gpg-agent" "--daemon") + (setenv "SSH_AUTH_SOCK" gpg-agent-ssh-sock)) + (setq password-cache-expiry nil + pinentry--socket-dir temporary-file-directory) + (unless (file-exists-p (concat pinentry--socket-dir "pinentry")) + (pinentry-start) + (add-hook 'kill-emacs-hook 'pinentry-stop)) + (add-to-list 'load-suffixes ".el.gpg") + (load-gpg "private") + (kill-buffer "*Pinentry*"))) + +(defun first-frame-hook (frame) + (remove-hook 'after-make-frame-functions 'first-frame-hook) + (run-at-time nil nil 'load-private-data)) + +(add-hook 'after-make-frame-functions 'first-frame-hook) +#+END_SRC + + + * Minibuffer Sometimes I want to use the minibuffer, but I’m already inside it. -- cgit 1.4.1 From dbb463c35e132c609f53047b0de4a661d344f21a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 22 Feb 2017 10:29:58 +0100 Subject: Emacs: Update private Spotcap configuration --- host-ap-spotcap.local/emacs.d/private.el.gpg | Bin 0 -> 797 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 host-ap-spotcap.local/emacs.d/private.el.gpg diff --git a/host-ap-spotcap.local/emacs.d/private.el.gpg b/host-ap-spotcap.local/emacs.d/private.el.gpg new file mode 100644 index 00000000..3a9a092d Binary files /dev/null and b/host-ap-spotcap.local/emacs.d/private.el.gpg differ -- cgit 1.4.1 From 88a7c8f35fc9528aa655ad12bf1fe85a5571b5c3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 22 Feb 2017 11:19:43 +0100 Subject: rcup: Use `Emacs` command for building configuration if exists `emacs` calls /usr/bin/emacs, which is too old. This relies on an Emacs application being added to $PATH --- hooks/post-up/emacs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hooks/post-up/emacs b/hooks/post-up/emacs index cb9c0916..53de6dad 100755 --- a/hooks/post-up/emacs +++ b/hooks/post-up/emacs @@ -1,6 +1,8 @@ -#!/usr/bin/env zsh +#!/bin/sh -if [[ -s $commands[emacs] ]] +EMACS_COMMAND=$(which Emacs || which emacs) + +if [[ -s $EMACS_COMMAND ]] then pushd ~/.emacs.d emacs --batch --eval "(progn -- cgit 1.4.1 From 55a326314b2e8eb718a2eb201cb484a184e68da0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 22 Feb 2017 11:41:45 +0100 Subject: Emacs: Remove projectile-switch-to-buffer binding --- tag-emacs/emacs.d/init.org | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 9a8c298e..426f4a89 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -437,7 +437,6 @@ based upon some folder conventions I use. #+BEGIN_SRC emacs-lisp (use-package projectile :bind (("s-p" . projectile-switch-project) - ("C-x b" . projectile-switch-to-buffer) ("C-c C-f" . projectile-find-file) ("s-x s-f" . projectile-find-file) ("C-x g" . projectile-vc) -- cgit 1.4.1 From 20a401b8d2b7ee5185e1a75530b273d2e98fe8af Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 22 Feb 2017 11:42:11 +0100 Subject: Emacs: Cache GitHub calls for longer --- 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 426f4a89..ea48d277 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -539,7 +539,9 @@ time. Make sure to set it up with a nice =completing-read-function= (use-package magithub :after magit :pin melpa - :config (magithub-feature-autoinject t)) + :config (progn + (magithub-feature-autoinject t) + (setq magithub-cache-refresh-seconds-plist '(:issues 600 :ci-status 180 t 120)))) #+END_SRC ** git-timemachine -- cgit 1.4.1 From 321bf7276b55ed9b26037514bda69b68fcd264e4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 22 Feb 2017 11:42:29 +0100 Subject: Emacs: Use secure package archives --- tag-emacs/emacs.d/init.org | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index ea48d277..0873f31b 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -37,10 +37,11 @@ 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/")) + (setq tls-checktrust t + gnutls-verify-error t + package-archives '(("gnu" . "https://elpa.gnu.org/packages/") + ("melpa-stable" . "https://stable.melpa.org/packages/") + ("melpa" . "https://melpa.org/packages/")) package-user-dir (concat "~/.emacs.d/packages/" emacs-version "/elpa") package-pinned-packages '(("use-package" . melpa-stable) ("diminish" . melpa-stable) -- cgit 1.4.1 From 26c9e755f3189f873b811225869b2627e52592fd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 22 Feb 2017 11:43:01 +0100 Subject: Emacs: Use eslint_d for flycheck, if installed --- 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 0873f31b..3a8e08d8 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1734,7 +1734,9 @@ On-the-fly error checking in programming modes? Yes please. :defer 5 :config (progn (global-flycheck-mode) - (setq flycheck-check-syntax-automatically '(save new-line mode-enabled)))) + (setq flycheck-check-syntax-automatically '(save new-line mode-enabled)) + (if (executable-find "eslint_d") + (setq flycheck-javascript-eslint-executable (executable-find "eslint_d"))))) #+END_SRC ** golang -- cgit 1.4.1 From 21d5403fe6d5d0c6d51cda1d6080a62496e9b243 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 25 Feb 2017 17:41:42 +0100 Subject: Emacs: Reconfigure fonts on X11 --- tag-emacs/emacs.d/init.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 3a8e08d8..916bb61f 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -234,8 +234,8 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (ap/set-fonts "Roboto Mono" 13 "Lucida Grande" 13 t) (ap/set-fonts "Monaco" 10 "Lucida Grande" 12 nil)))) ((eq window-system 'x) - (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 10)) - (ap/set-fonts "Terminus" 10 "Lucida" 10 nil)))) + (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 8)) + (ap/set-fonts "Terminus" 8 "Lucida" 8 nil)))) (ap/set-fonts-according-to-system)) #+END_SRC -- cgit 1.4.1 From 50d31d2cc613601e650ee5ac743b24bcd5441a0b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 25 Feb 2017 17:48:44 +0100 Subject: Emacs: Use projectile-find-file when switching projects --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 3a8e08d8..4dac973a 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -482,7 +482,7 @@ based upon some folder conventions I use. (interactive "P") (ap/open-subfolder-project home-project-directory arg)) - (setq projectile-switch-project-action #'projectile-dired + (setq projectile-switch-project-action #'projectile-find-file projectile-remember-window-configs t projectile-completion-system 'ivy))) #+END_SRC -- cgit 1.4.1 From 49a5ac56ccf6bea186dcf0bfccb32bb82b05a772 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 28 Feb 2017 14:58:09 +0100 Subject: Fix setting SSH_AUTH_SOCK --- tag-emacs/emacs.d/init.org | 2 +- tag-zsh/config/zsh/zshenv | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 916bb61f..d019e16d 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -677,7 +677,7 @@ that I can sudo on remote machines :defer 7 :config (progn (unless (getenv "SSH_AUTH_SOCK") - (setenv "SSH_AUTH_SOCK" "/run/user/1000/ssh-agent.socket")) + (setenv "SSH_AUTH_SOCK" (format "/run/user/%s/ssh-agent" (user-uid)))) (setq tramp-default-method "ssh" tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root")) tramp-backup-directory-alist backup-directory-alist diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index e75704ca..f1cad02f 100644 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -14,7 +14,7 @@ then if [[ -z $SSH_AUTH_SOCK ]] then - export SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/ssh-agent.socket + export SSH_AUTH_SOCK=${XDG_RUNTIME_DIR:-/run/user/$UID}/ssh-agent fi case $OSTYPE in -- cgit 1.4.1 From 6a46db0b3784824437219cce0077ae1b600cb35a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 28 Feb 2017 14:58:45 +0100 Subject: XResources: Remove rxvt-unicode configuration --- tag-xresources/xresources/main | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/tag-xresources/xresources/main b/tag-xresources/xresources/main index 53e9676f..73f8096d 100644 --- a/tag-xresources/xresources/main +++ b/tag-xresources/xresources/main @@ -3,26 +3,6 @@ Xcursor.theme: Neutral Xcursor.size: 22 -URxvt.fading: 0 -URxvt.geometry: 100x40 -URxvt.urgentOnBell: true - -URxvt.scrollBar: false -URxvt.scrollstyle: plain -URxvt.scrollTtyOutput: false -URxvt.scrollWithBuffer: true -URxvt.scrollTtyKeypress: true -URxvt.saveLines: 16384 -URxvt.secondaryScroll: false - -URxvt.font: -xos4-terminus-medium-r-normal--14-140-72-72-c-80-*-* -URxvt.boldFont: -URxvt.intensityStyles: true - -URxvt.pointerBlank: true -URxvt.pointerBlankDelay: 987654321 -URxvt.letterSpace: 0 - Emacs.ToolBar: off Emacs.MenuBar: off Emacs.ScrollBars: off -- cgit 1.4.1 From c71291af427449c0a1b00c5b824136163ab70195 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 28 Feb 2017 15:12:20 +0100 Subject: Emacs: Configure window-dividers in X11 environments --- tag-emacs/emacs.d/init.org | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 24efdb6a..fb279f27 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -181,9 +181,12 @@ Let’s try a basic theme. (add-to-list 'default-frame-alist '(border-width . 0)) (add-to-list 'default-frame-alist '(internal-border-width . 0)) - (setq window-divider-default-bottom-width 6 - window-divider-default-places t) - (window-divider-mode +1) + (when (eq window-system 'x) + (setq window-divider-default-bottom-width 1 + window-divider-default-right-width 1 + window-divider-default-places t) + (setq mode-line-default-hidden t) + (window-divider-mode +1)) (add-hook 'after-change-major-mode-hook #'hide-mode-line-if-default-hidden) -- cgit 1.4.1 From f8d667341977a445fd701a07112b97896b0ce1f9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 5 Mar 2017 16:39:02 +0100 Subject: Emacs: Configure multi-line eshell prompt --- tag-emacs/emacs.d/init.org | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index fb279f27..77c46741 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2185,7 +2185,11 @@ nice, when I remember to use it. (use-package eshell :bind ("C-c s" . eshell) :config (progn - (setq eshell-directory-name "~/.emacs.d/eshell") + (setq eshell-directory-name "~/.emacs.d/eshell" + eshell-prompt-function (lambda () + (concat + (eshell/pwd) + "\n$ "))) (add-hook 'eshell-load-hook (lambda () (bind-key "C-c C-l" #'counsel-esh-history eshell-mode-map))))) -- cgit 1.4.1 From 9e441262fb1a7beebbcec8b4eb58535ff36b1ece Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 6 Mar 2017 09:42:43 +0100 Subject: Emacs: Store file-name-handler-alist into variable --- tag-emacs/emacs.d/init.org | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 77c46741..efb51a19 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -13,7 +13,9 @@ Open Emacs with just a plain window. No graphics or messages, please! (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) +(setq file-name-handler-alist-backup file-name-handler-alist + file-name-handler-alist nil) +(remove-hook 'find-file-hooks #'vc-find-file-hook) #+END_SRC ** Scratch buffers @@ -2552,9 +2554,5 @@ Start a server if possible. A daemon is already a 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 file-name-handler-alist-backup) #+END_SRC -- cgit 1.4.1 From f0f628fc2c99ee387dc729c09ebde77dc6ec9644 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 6 Mar 2017 19:12:56 +0100 Subject: which -> command -v http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script/677212#677212 TL;DR `command` is a POSIX-specified builtin. `which` is unreliable. --- hooks/post-up/emacs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/post-up/emacs b/hooks/post-up/emacs index 53de6dad..05a5c9d1 100755 --- a/hooks/post-up/emacs +++ b/hooks/post-up/emacs @@ -1,6 +1,6 @@ #!/bin/sh -EMACS_COMMAND=$(which Emacs || which emacs) +EMACS_COMMAND=$(command -v Emacs || command -v emacs) if [[ -s $EMACS_COMMAND ]] then -- cgit 1.4.1 From a7eccf169416ca6a9e166cbe90cddf02ac9dd3f6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 7 Mar 2017 16:26:10 +0100 Subject: Emacs: Remove ivy-resume binding I’ve never intentionally used it --- tag-emacs/emacs.d/init.org | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index efb51a19..9486835f 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1344,7 +1344,6 @@ replacement for helm so far. (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 -- cgit 1.4.1 From 3eb1cb331f686b37d752bdfbb690631eae2df4db Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 7 Mar 2017 16:30:07 +0100 Subject: Emacs: Use projectile-commander when switching projects --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 9486835f..d0bc2994 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -487,7 +487,7 @@ based upon some folder conventions I use. (interactive "P") (ap/open-subfolder-project home-project-directory arg)) - (setq projectile-switch-project-action #'projectile-find-file + (setq projectile-switch-project-action #'projectile-commander projectile-remember-window-configs t projectile-completion-system 'ivy))) #+END_SRC -- cgit 1.4.1 From d1bf36ed1e8dc1a3ec5d2a99aa6d335dd3381246 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 7 Mar 2017 16:30:48 +0100 Subject: Emacs: Fix loading private elisp --- tag-emacs/emacs.d/init.org | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index d0bc2994..e8557f35 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1261,8 +1261,7 @@ rather useful. ** Auxillary Configuration #+BEGIN_SRC emacs-lisp -;; (require 'pinentry) -;; (require 'epa) +(require 'pinentry) (defvar have-private-key (file-exists-p (expand-file-name "secring.gpg" "~/.gnupg/"))) @@ -1293,24 +1292,22 @@ rather useful. (unless (getenv "GPG_AGENT_INFO") (start-process "gpg-agent" nil "gpg-agent" "--daemon") (setenv "SSH_AUTH_SOCK" gpg-agent-ssh-sock)) - (setq password-cache-expiry nil - pinentry--socket-dir temporary-file-directory) + (setq password-cache-expiry nil) (unless (file-exists-p (concat pinentry--socket-dir "pinentry")) (pinentry-start) (add-hook 'kill-emacs-hook 'pinentry-stop)) (add-to-list 'load-suffixes ".el.gpg") - (load-gpg "private") - (kill-buffer "*Pinentry*"))) + (load-gpg (expand-file-name "private" user-emacs-directory)))) (defun first-frame-hook (frame) - (remove-hook 'after-make-frame-functions 'first-frame-hook) + (remove-hook 'after-make-frame-functions #'first-frame-hook) (run-at-time nil nil 'load-private-data)) -(add-hook 'after-make-frame-functions 'first-frame-hook) +(if (eq 1 (length (frame-list))) + (add-hook 'after-init-hook #'load-private-data) + (add-hook 'after-make-frame-functions #'first-frame-hook)) #+END_SRC - - * Minibuffer Sometimes I want to use the minibuffer, but I’m already inside it. -- cgit 1.4.1 From c75e0f981df4f438cf9da37f9c3a9b91df76f84a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 7 Mar 2017 16:31:03 +0100 Subject: Emacs: Add ace-link --- tag-emacs/emacs.d/init.org | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index e8557f35..df5069cf 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2354,6 +2354,20 @@ somehow I prefer it. avy-keys '(?a ?r ?s ?t ?d ?h ?n ?e ?i ?\;)))) #+END_SRC +*** ace-link + +Visit any link. Despite the name, this works with avy. + +#+BEGIN_SRC emacs-lisp +(use-package ace-link + :after avy + :config (progn + (ace-link-setup-default) + (with-eval-after-load "gnus" + (bind-key "M-o" #'ace-link-gnus gnus-summary-mode-map) + (bind-key "M-o" #'ace-link-gnus gnus-article-mode-map)))) +#+END_SRC + ** goto-chg This is like popping the mark, only it filters to only change areas -- cgit 1.4.1 From f4209abd072fe4a28ddc5656ae96d93b81f58057 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 7 Mar 2017 16:31:43 +0100 Subject: Update private elisp --- host-ap-spotcap.local/emacs.d/private.el.gpg | Bin 797 -> 2258 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/host-ap-spotcap.local/emacs.d/private.el.gpg b/host-ap-spotcap.local/emacs.d/private.el.gpg index 3a9a092d..aae4f977 100644 Binary files a/host-ap-spotcap.local/emacs.d/private.el.gpg and b/host-ap-spotcap.local/emacs.d/private.el.gpg differ -- cgit 1.4.1 From 99e39b728189d9c7069de92c4cd84be1576dd377 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 10 Mar 2017 13:08:29 +0100 Subject: Emacs: Check for SSH environment before starting gpg-agent --- 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 df5069cf..ca111aff 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1289,7 +1289,8 @@ rather useful. (interactive) (if (not have-private-key) (message "ERROR: Private GPG key not found") - (unless (getenv "GPG_AGENT_INFO") + (unless (or (getenv "GPG_AGENT_INFO") + (getenv "SSH_AUTH_SOCK")) (start-process "gpg-agent" nil "gpg-agent" "--daemon") (setenv "SSH_AUTH_SOCK" gpg-agent-ssh-sock)) (setq password-cache-expiry nil) -- cgit 1.4.1 From 71dd803accf032c521296a0dd3b7f0ed4aab0637 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 13 Mar 2017 01:03:48 +0100 Subject: Emacs: Check for display system before setting theme --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index ca111aff..9bf9d344 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -131,6 +131,7 @@ Let’s try a basic theme. #+BEGIN_SRC emacs-lisp (use-package basic-theme + :if (display-graphic-p) :config (progn (load-theme 'basic t) -- cgit 1.4.1 From 650d81226e5bedd32cbc64ae64768868ac3573b2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 13 Mar 2017 01:04:07 +0100 Subject: Emacs: Use "Fixed" font on X11 --- tag-emacs/emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 9bf9d344..2e24f306 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -241,7 +241,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (ap/set-fonts "Monaco" 10 "Lucida Grande" 12 nil)))) ((eq window-system 'x) (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 8)) - (ap/set-fonts "Terminus" 8 "Lucida" 8 nil)))) + (ap/set-fonts "Fixed" 8 "Lucida" 8 nil)))) (ap/set-fonts-according-to-system)) #+END_SRC -- cgit 1.4.1 From a04c0775a9e9a46fabe24957e46f57ef021c6c92 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 13 Mar 2017 11:14:10 +0100 Subject: Emacs: Install beacon-mode --- tag-emacs/emacs.d/init.org | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 2e24f306..2f38aef1 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -291,6 +291,17 @@ Highlight what just changed when I undo, yank, and so on. (volatile-highlights-mode t))) #+END_SRC +** Beacon + +I was against the idea of having flashy animations inside Emacs, but +this one is useful. It highlights the cursor when scrolling or +switching windows. + +#+BEGIN_SRC emacs-lisp +(use-package beacon + :config (beacon-mode +1)) +#+END_SRC + ** Renaming major modes Diminishing major modes does not happen in the same manner as minor -- cgit 1.4.1 From 2ec907b93e9b65bc174e99d7c5bb7fa9a291dc43 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 13 Mar 2017 14:15:47 +0100 Subject: Diminish beacon-mode --- tag-emacs/emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 2f38aef1..6f35f026 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -299,6 +299,7 @@ switching windows. #+BEGIN_SRC emacs-lisp (use-package beacon + :diminish beacon-mode :config (beacon-mode +1)) #+END_SRC -- cgit 1.4.1 From e1dfd1dce911a06284d81eb07120de1ad32aa0ac Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 13 Mar 2017 14:29:26 +0100 Subject: Emacs: Remove auto-indent-mode Not necessary with electric-indent-mode, which I’ve already set up in c-mode-hook. It was responsible for all the `looking-back` errors when compiling or executing init.el --- tag-emacs/emacs.d/init.org | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 6f35f026..7b205ccd 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -742,33 +742,6 @@ tabstops is probably never going to happen. indent-tabs-mode nil) #+END_SRC -** auto-indent-mode - -Don’t make me think, just indent it! Unless it’s a -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))) -#+END_SRC ** smart-tabs-mode @@ -2010,14 +1983,11 @@ it though (fboundp #'do-it)) (do-it name))) (advice-add 'imenu-add-to-menubar :around #'js2--imenu-around) - (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 2 js2-include-node-externs t))) #+END_SRC -- cgit 1.4.1 From c55e2f4bbe11490780c468ea7eec94a2e9a0710d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 13 Mar 2017 14:34:03 +0100 Subject: Emacs: Don't enable electric-quote-mode It pairs "``" with "'", which isn't what I wanted, and doesn't seem to be configurable --- tag-emacs/emacs.d/init.org | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 7b205ccd..7ae0092e 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2311,15 +2311,6 @@ from Sublime Text. As always, there’s a mode for that. :config (setq expand-region-fast-keys-enabled nil)) #+END_SRC -** Typography - -I like using typographic quotes, but they’re complicated to insert manually. -them. - -#+BEGIN_SRC emacs-lisp -(electric-quote-mode) -#+END_SRC - ** avy Avy is a really nice way to move around files, like ace-jump-mode, but -- cgit 1.4.1 From bd9f4a8c57f0618e6de37d31cb3817dfb7a291dc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 13 Mar 2017 15:08:25 +0100 Subject: Slate: Remove layouts I'm trying out using just one window per screen. --- host-ap-spotcap.local/slate | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/host-ap-spotcap.local/slate b/host-ap-spotcap.local/slate index d002b5a4..e8c675d0 100644 --- a/host-ap-spotcap.local/slate +++ b/host-ap-spotcap.local/slate @@ -16,18 +16,6 @@ alias 1-right push right bar-resize:screenSizeX/2 0 alias 2-left push left bar-resize:screenSizeX/2 1 alias 2-right push right bar-resize:screenSizeX/2 1 -layout workLayout "Safari Technology Preview":REPEAT ${1-left} -layout workLayout "Emacs" ${1-right} -layout workLayout "Terminal" ${2-left} -layout workLayout "HipChat" ${2-right} - -layout portable "Emacs" ${1-full} - -default workLayout resolutions:${mon-laptop};${mon-work} -default portable resolutions:${mon-laptop} - -bind return:ctrl;cmd layout workLayout - # Push Bindings bind right:alt;cmd push right bar-resize:screenSizeX/2 bind left:alt;cmd push left bar-resize:screenSizeX/2 -- cgit 1.4.1 From 45be6875af2faa73f447f7f1cffcaf6cd8ad2abe Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 13 Mar 2017 15:09:11 +0100 Subject: Update private Emacs configuration --- host-ap-spotcap.local/emacs.d/private.el.gpg | Bin 2258 -> 2288 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/host-ap-spotcap.local/emacs.d/private.el.gpg b/host-ap-spotcap.local/emacs.d/private.el.gpg index aae4f977..784a023b 100644 Binary files a/host-ap-spotcap.local/emacs.d/private.el.gpg and b/host-ap-spotcap.local/emacs.d/private.el.gpg differ -- cgit 1.4.1 From 60dee6cff223ed034e831e4a436d1c23e1414250 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 13 Mar 2017 16:47:21 +0100 Subject: Emacs: Remove magithub --- tag-emacs/emacs.d/init.org | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 7ae0092e..f7de8888 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -554,13 +554,6 @@ time. Make sure to set it up with a nice =completing-read-function= global-magit-file-mode nil) (add-to-list 'magit-no-confirm 'safe-with-wip)) :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) - -(use-package magithub - :after magit - :pin melpa - :config (progn - (magithub-feature-autoinject t) - (setq magithub-cache-refresh-seconds-plist '(:issues 600 :ci-status 180 t 120)))) #+END_SRC ** git-timemachine -- cgit 1.4.1 From 9a0f3dae0a5113b04d6c40088e7e582f4ac0d7a1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 14 Mar 2017 22:41:45 +0100 Subject: Emacs: Remove unnecessary smart-tabs code --- tag-emacs/emacs.d/init.org | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index f7de8888..114b2b66 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -748,18 +748,8 @@ with spaces. Perfect! (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) + + (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)) -- cgit 1.4.1 From 6e6ba4ad2f37ff70989a7ed8d30b2f75fe67f619 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 14 Mar 2017 22:42:11 +0100 Subject: Emacs: Fix free variable warning: company-dabbrev-downcase The default is `case-replace`, so use that instead --- tag-emacs/emacs.d/init.org | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 114b2b66..9c65d9f0 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -951,8 +951,7 @@ seems to work perfectly well for me. 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))) + company-tooltip-align-annotations t))) #+END_SRC #+BEGIN_SRC emacs-lisp @@ -2446,6 +2445,15 @@ it much clearer. It’s especially helpful for protoyping and refactoring. :diminish undo-tree-mode) #+END_SRC +** replace + +#+BEGIN_SRC emacs-lisp +(use-package replace + :defer t + :config (progn + (setq case-replace nil))) +#+END_SRC + ** visual-regexp I don’t always remember exactly how Emacs’ regular expressions work, -- cgit 1.4.1 From 485783b9ef84739ab93780bd7ed115c9b75f7136 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 14 Mar 2017 22:46:44 +0100 Subject: Emacs: Fix byte-compilation warnings --- tag-emacs/emacs.d/init.org | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 9c65d9f0..b658107a 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -13,9 +13,9 @@ Open Emacs with just a plain window. No graphics or messages, please! (setq inhibit-startup-echo-area-message (user-login-name))) (setq inhibit-startup-screen t) (setq gc-cons-threshold 100000000) -(setq file-name-handler-alist-backup file-name-handler-alist - file-name-handler-alist nil) -(remove-hook 'find-file-hooks #'vc-find-file-hook) +(defvar file-name-handler-alist-backup file-name-handler-alist) +(setq file-name-handler-alist nil) +(remove-hook 'find-file-hooks #'vc-refresh-state) #+END_SRC ** Scratch buffers @@ -144,7 +144,7 @@ Let’s try a basic theme. (set-face-foreground 'window-divider "#a1b56c") (defvar mode-line-default-format mode-line-format) - (defcustom mode-line-default-hidden nil + (defvar mode-line-default-hidden nil "Whether to hide the mode line by default") (defun show-mode-line () @@ -501,7 +501,6 @@ based upon some folder conventions I use. (ap/open-subfolder-project home-project-directory arg)) (setq projectile-switch-project-action #'projectile-commander - projectile-remember-window-configs t projectile-completion-system 'ivy))) #+END_SRC @@ -516,7 +515,7 @@ occasions that I’m working with something other than git. :bind (("C-x v C" . vc-resolve-conflicts)) :config (progn (setq vc-follow-symlinks t) - (setq vs-ignore-dir-regexp (format "\\(%s\\)\\|\\(%s\\)" + (setq vc-ignore-dir-regexp (format "\\(%s\\)\\|\\(%s\\)" vc-ignore-dir-regexp tramp-file-name-regexp)))) #+END_SRC @@ -546,10 +545,8 @@ time. Make sure to set it up with a nice =completing-read-function= (use-package magit :defer 5 :commands (magit-status) - :config (progn (setq magit-last-seen-setup-instructions "1.4.0" - magit-completing-read-function #'ivy-completing-read + :config (progn (setq magit-completing-read-function #'ivy-completing-read magit-popup-use-prefix-argument 'default - magit-push-always-verify nil magit-display-buffer-function #'magit-display-buffer-fullcolumn-most-v1 global-magit-file-mode nil) (add-to-list 'magit-no-confirm 'safe-with-wip)) @@ -899,9 +896,9 @@ Undo, for window-based commands. #+BEGIN_SRC emacs-lisp (use-package winner + :config (setq winner-boring-buffers '("*Completions*" "*Help*" "*Apropos*" "*Buffer List*" "*info*" "*Compile-Log*")) :init (progn - (winner-mode 1) - (setq winner-boring-buffers '("*Completions*" "*Help*" "*Apropos*" "*Buffer List*" "*info*" "*Compile-Log*")))) + (winner-mode 1))) #+END_SRC ** windmove @@ -976,9 +973,7 @@ Weeks start on Monday for me and I prefer ISO-style dates. :defer 1 :config (progn (setq calendar-week-start-day 1) - (calendar-set-date-style 'iso) - (setq calendar-latitude 52.52 - calendar-longitude 13.40))) + (calendar-set-date-style 'iso))) #+END_SRC Sometimes I want to insert a date or time into a buffer. @@ -1025,8 +1020,7 @@ copying/moving files between them. (setq dired-dwim-target t dired-recursive-copies 'top dired-recursive-deletes 'top - dired-listing-switches "-alh" - dired-bind-jump nil) + dired-listing-switches "-alh") (when (and (eq system-type 'darwin) (executable-find "gls")) (setq insert-directory-program (executable-find "gls"))) (put 'dired-find-alternate-file 'disabled nil))) @@ -1046,7 +1040,8 @@ Don’t show uninteresting files in dired listings. :config (progn (setq dired-omit-files "#\\|\\.$" dired-omit-verbose nil - dired-find-subdir t)) + dired-find-subdir t + dired-bind-jump nil)) :init (progn (add-hook 'dired-mode-hook #'turn-on-dired-omit-mode))) #+END_SRC -- cgit 1.4.1 From 4aee601eb64abd8bf9f8945ed579267e3861867f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 15 Mar 2017 16:00:19 +0100 Subject: Emacs: Ensure wgrep-ag is installed --- tag-emacs/emacs.d/init.org | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index b658107a..e5950f7b 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -432,6 +432,9 @@ configuration with crux.el (use-package ag :defer 30 :config (setq ag-project-root-function #'projectile-project-root)) + +(use-package wgrep-ag + :after ag) #+END_SRC ** Ripgrep -- cgit 1.4.1 From 5a338791c3bea28a7c11bea126650e95878b3141 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 16 Mar 2017 15:35:36 +0100 Subject: Emacs: Remove smart-tabs library code --- tag-emacs/emacs.d/init.org | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index e5950f7b..0027cb8d 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -747,18 +747,7 @@ with spaces. Perfect! :config (progn (smart-tabs-insinuate 'c 'cperl 'python) (add-hook 'php-mode-hook (lambda () - (smart-tabs-mode indent-tabs-mode))) - - (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))))) + (smart-tabs-mode indent-tabs-mode))))) #+END_SRC ** editorconfig -- cgit 1.4.1 From f79b34c0fe68175454606309f074340d2457ab0d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 16 Mar 2017 15:37:52 +0100 Subject: Emacs: Don't auto-enable highlight-stages mode --- tag-emacs/emacs.d/init.org | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 0027cb8d..82e17555 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -197,12 +197,12 @@ Let’s try a basic theme. (add-hook 'minibuffer-exit-hook #'hide-mode-line))) #+END_SRC -Highlighting quasi-quoted expressions in lisps is quite useful. +Highlighting quasi-quoted expressions in lisps is quite useful, but I +don't need it all the time. I'll keep it around for a while so that I +can enable it if needed. #+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) #+END_SRC ** Fonts -- cgit 1.4.1 From 317f0d9fc8eb33bd8d1443bd7c0926f3376b9ce8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 16 Mar 2017 16:30:01 +0100 Subject: Gems: Install to .local/bin alongside other package managers --- gemrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gemrc b/gemrc index aaa70a93..ab4f7840 100644 --- a/gemrc +++ b/gemrc @@ -1 +1 @@ -gem: --user-install -n~/bin \ No newline at end of file +gem: --user-install -n~/.local/bin \ No newline at end of file -- cgit 1.4.1 From e8d81ffd8e87977317d8120e0735e44b550fa302 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 16 Mar 2017 16:30:30 +0100 Subject: zsh: Remove autoenv --- tag-zsh/config/zsh/zshrc | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index fb9a36a7..4b867179 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -2,7 +2,6 @@ source $ZPLUG_HOME/init.zsh zplug "zsh-users/zsh-completions", depth:1, defer:0 -zplug "Tarrasch/zsh-autoenv", as:plugin zplug "junegunn/fzf-bin", from:gh-r, as:command, rename-to:fzf zplug "junegunn/fzf", as:plugin, use:"shell/*.zsh", defer:2 zplug "junegunn/fzf", as:command, use:"bin/*" @@ -134,13 +133,6 @@ then eval $(ssh-agent) fi -if zplug check Tarrasch/zsh-autoenv -then - AUTOENV_FILE_ENTER=.envrc - AUTOENV_HANDLE_LEAVE=1 - AUTOENV_LOOK_UPWARDS=1 -fi - # Then, source plugins and add commands to $PATH zplug load -- cgit 1.4.1 From 5c124af7c747b6eec279109bd61950c58514e6a5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 16 Mar 2017 16:30:40 +0100 Subject: zsh: Unset auto_cd --- tag-zsh/config/zsh/zshrc | 1 - 1 file changed, 1 deletion(-) diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc index 4b867179..f2102b34 100644 --- a/tag-zsh/config/zsh/zshrc +++ b/tag-zsh/config/zsh/zshrc @@ -137,7 +137,6 @@ fi zplug load # General configuration -setopt auto_cd # Change directories without `cd` if [[ -n $commands[hub] ]] then -- cgit 1.4.1 From db6903e6fab9cff359a530ca2eee6ba3c7e44525 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 16 Mar 2017 16:32:58 +0100 Subject: Emacs: Install projectile-ripgrep correctly It used to be bundled with ripgrep.el, now it seems to be separate --- tag-emacs/emacs.d/init.org | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 82e17555..151efbf4 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -446,8 +446,9 @@ Step over Silver Search, here comes a new challenger. :if (executable-find "rg")) (use-package projectile-ripgrep - :bind (("C-c p s r" . projectile-ripgrep)) - :ensure nil) + :after (ripgrep projectile) + :if (executable-find "rg") + :bind (("C-c p s r" . projectile-ripgrep))) #+END_SRC ** Projectile -- cgit 1.4.1 From 397ce671bb028802d528faf8811101e08557e527 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 17 Mar 2017 09:48:24 +0100 Subject: Re-structure tags to GNU stow format --- atop/.atoprc | 2 + clojure/.lein/profiles.clj | 11 + dwm/dwm/config.h | 106 ++ emacs/.emacs.d/init.org | 2522 +++++++++++++++++++++++++ fish/.config/fish/config.fish | 2 + git/.config/git/config | 34 + git/.config/git/gitk | 61 + git/.config/git/ignore | 29 + global/.globalrc | 6 + hg/.hgrc | 9 + karabiner/.config/karabiner/karabiner.json | 63 + minttyrc/minttyrc | 33 + rcrc | 3 - ssh/.ssh/rc | 5 + tag-atop/atoprc | 2 - tag-clojure/lein/profiles.clj | 11 - tag-dwm/dwm/config.h | 106 -- tag-emacs/emacs.d/init.org | 2522 ------------------------- tag-fish/config/fish/config.fish | 2 - tag-git/config/git/config | 34 - tag-git/config/git/gitk | 61 - tag-git/config/git/ignore | 29 - tag-global/globalrc | 6 - tag-hg/hgrc | 9 - tag-karabiner/config/karabiner/karabiner.json | 63 - tag-minttyrc/minttyrc | 33 - tag-ssh/ssh/rc | 5 - tag-tmux/tmux.conf | 19 - tag-vagrant/vagrant.d/Vagrantfile | 7 - tag-vagrant/vagrant.d/ansible/centos.yml | 31 - tag-vagrant/vagrant.d/ansible/debian.yml | 15 - tag-vagrant/vagrant.d/ansible/site.yml | 32 - tag-xbindkeys/xbindkeysrc.scm | 57 - tag-xmobar/xmobarrc | 40 - tag-xmonad/xmonad/xmonad.hs | 92 - tag-xprofile/xprofile | 9 - tag-xresources/xresources/main | 13 - tag-xresources/xresources/solarized-light | 70 - tag-zsh/config/zsh/zshenv | 43 - tag-zsh/config/zsh/zshrc | 241 --- tag-zsh/zshenv | 3 - tmux/.tmux.conf | 19 + vagrant/.vagrant.d/Vagrantfile | 7 + vagrant/.vagrant.d/ansible/centos.yml | 31 + vagrant/.vagrant.d/ansible/debian.yml | 15 + vagrant/.vagrant.d/ansible/site.yml | 32 + xbindkeys/xbindkeysrc.scm | 57 + xmobar/.xmobarrc | 40 + xmonad/xmonad/xmonad.hs | 92 + xprofile/.xprofile | 9 + xresources/.xresources/main | 13 + xresources/.xresources/solarized-light | 70 + zsh/.config/zsh/.zshenv | 43 + zsh/.config/zsh/.zshrc | 241 +++ zsh/.zshenv | 3 + 55 files changed, 3555 insertions(+), 3558 deletions(-) create mode 100644 atop/.atoprc create mode 100644 clojure/.lein/profiles.clj create mode 100644 dwm/dwm/config.h create mode 100644 emacs/.emacs.d/init.org create mode 100755 fish/.config/fish/config.fish create mode 100644 git/.config/git/config create mode 100644 git/.config/git/gitk create mode 100644 git/.config/git/ignore create mode 100644 global/.globalrc create mode 100644 hg/.hgrc create mode 100644 karabiner/.config/karabiner/karabiner.json create mode 100644 minttyrc/minttyrc delete mode 100644 rcrc create mode 100755 ssh/.ssh/rc delete mode 100644 tag-atop/atoprc delete mode 100644 tag-clojure/lein/profiles.clj delete mode 100644 tag-dwm/dwm/config.h delete mode 100644 tag-emacs/emacs.d/init.org delete mode 100755 tag-fish/config/fish/config.fish delete mode 100644 tag-git/config/git/config delete mode 100644 tag-git/config/git/gitk delete mode 100644 tag-git/config/git/ignore delete mode 100644 tag-global/globalrc delete mode 100644 tag-hg/hgrc delete mode 100644 tag-karabiner/config/karabiner/karabiner.json delete mode 100644 tag-minttyrc/minttyrc delete mode 100755 tag-ssh/ssh/rc delete mode 100644 tag-tmux/tmux.conf delete mode 100644 tag-vagrant/vagrant.d/Vagrantfile delete mode 100644 tag-vagrant/vagrant.d/ansible/centos.yml delete mode 100644 tag-vagrant/vagrant.d/ansible/debian.yml delete mode 100644 tag-vagrant/vagrant.d/ansible/site.yml delete mode 100644 tag-xbindkeys/xbindkeysrc.scm delete mode 100644 tag-xmobar/xmobarrc delete mode 100644 tag-xmonad/xmonad/xmonad.hs delete mode 100755 tag-xprofile/xprofile delete mode 100644 tag-xresources/xresources/main delete mode 100644 tag-xresources/xresources/solarized-light delete mode 100644 tag-zsh/config/zsh/zshenv delete mode 100644 tag-zsh/config/zsh/zshrc delete mode 100644 tag-zsh/zshenv create mode 100644 tmux/.tmux.conf create mode 100644 vagrant/.vagrant.d/Vagrantfile create mode 100644 vagrant/.vagrant.d/ansible/centos.yml create mode 100644 vagrant/.vagrant.d/ansible/debian.yml create mode 100644 vagrant/.vagrant.d/ansible/site.yml create mode 100644 xbindkeys/xbindkeysrc.scm create mode 100644 xmobar/.xmobarrc create mode 100644 xmonad/xmonad/xmonad.hs create mode 100755 xprofile/.xprofile create mode 100644 xresources/.xresources/main create mode 100644 xresources/.xresources/solarized-light create mode 100644 zsh/.config/zsh/.zshenv create mode 100644 zsh/.config/zsh/.zshrc create mode 100644 zsh/.zshenv diff --git a/atop/.atoprc b/atop/.atoprc new file mode 100644 index 00000000..d03319ea --- /dev/null +++ b/atop/.atoprc @@ -0,0 +1,2 @@ +flags Aa +maxlinecpu 0 \ No newline at end of file diff --git a/clojure/.lein/profiles.clj b/clojure/.lein/profiles.clj new file mode 100644 index 00000000..99c0de2d --- /dev/null +++ b/clojure/.lein/profiles.clj @@ -0,0 +1,11 @@ +{:user {:plugins [[org.clojure/tools.namespace "0.2.10"] + [lein-autoexpect "1.6.0"] + [lein-ancient "0.6.7"] + [lein-droid "0.4.0-alpha4"]] + :dependencies [[org.clojure/tools.trace "0.7.8"]] + :repl-options {:init + (do + (require '[clojure.java.javadoc :refer [javadoc]]) + (clojure.java.javadoc/add-local-javadoc + "/usr/share/doc/java8-openjdk/api/"))}} + :repl {:plugins [cider/cider-nrepl "0.9.1"]}} diff --git a/dwm/dwm/config.h b/dwm/dwm/config.h new file mode 100644 index 00000000..ae1d8bb3 --- /dev/null +++ b/dwm/dwm/config.h @@ -0,0 +1,106 @@ +/* See LICENSE file for copyright and license details. */ + +/* appearance */ +static const char font[] = "-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*"; +static const char normbordercolor[] = "#657b83"; +static const char normbgcolor[] = "#002b36"; +static const char normfgcolor[] = "#fdf6e3"; +static const char selbordercolor[] = "#859900"; +static const char selbgcolor[] = "#586e75"; +static const char selfgcolor[] = "#fdf6e3"; +static const unsigned int borderpx = 1; /* border pixel of windows */ +static const unsigned int snap = 32; /* snap pixel */ +static const Bool showbar = True; /* False means no bar */ +static const Bool topbar = True; /* False means bottom bar */ + +/* tagging */ +static const char *tags[] = { "shell", "code", "web", "misc" }; + +static const Rule rules[] = { + /* class instance title tags mask isfloating monitor */ + { "Firefox", NULL, NULL, 1 << 2, False, -1 }, + { "URxvt", NULL, NULL, 1 << 0, False, -1 }, + { "Emacs", "emacs", NULL, 1 << 1, False, -1 }, + { "KeePass2", NULL, NULL, 1 << 3, False, -1 }, + { "deadbeef", NULL, NULL, 1 << 3, False, -1 }, + { "Emacs", "Ediff", NULL, 0, True, -1 }, +}; + +/* layout(s) */ +static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ +static const int nmaster = 1; /* number of clients in master area */ +static const Bool resizehints = True; /* True means respect size hints in tiled resizals */ + +static const Layout layouts[] = { + /* symbol arrange function */ + { "[]=", tile }, /* first entry is default */ + { "><>", NULL }, /* no layout function means floating behavior */ + { "[M]", monocle }, +}; + +/* key definitions */ +#define MODKEY Mod4Mask +#define TAGKEYS(KEY,TAG) \ + { MODKEY, KEY, toggleview, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask, KEY, view, {.ui = 1 << TAG} }, \ + { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, + +/* helper for spawning shell commands in the pre dwm-5.0 fashion */ +#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } + +/* commands */ +static const char *termcmd[] = { "urxvt", NULL }; + +static Key keys[] = { + /* modifier key function argument */ + { MODKEY|ShiftMask, XK_b, togglebar, {0} }, + { MODKEY, XK_e, focusstack, {.i = +1 } }, + { MODKEY, XK_i, focusstack, {.i = -1 } }, + { MODKEY, XK_s, incnmaster, {.i = +1 } }, + { MODKEY, XK_r, incnmaster, {.i = -1 } }, + { MODKEY, XK_n, setmfact, {.f = -0.05} }, + { MODKEY, XK_o, setmfact, {.f = +0.05} }, + { MODKEY, XK_Return, zoom, {0} }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY|ShiftMask, XK_c, killclient, {0} }, + { MODKEY, XK_g, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { MODKEY, XK_comma, focusmon, {.i = -1 } }, + { MODKEY, XK_period, focusmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + TAGKEYS( XK_1, 0) + TAGKEYS( XK_2, 1) + TAGKEYS( XK_3, 2) + TAGKEYS( XK_4, 3) + TAGKEYS( XK_5, 4) + TAGKEYS( XK_6, 5) + TAGKEYS( XK_7, 6) + TAGKEYS( XK_8, 7) + TAGKEYS( XK_9, 8) + { MODKEY|ShiftMask, XK_q, quit, {0} }, + { MODKEY|ShiftMask, XK_r, quit, { .i = 5 } }, +}; + +/* button definitions */ +/* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ +static Button buttons[] = { + /* click event mask button function argument */ + { ClkLtSymbol, 0, Button1, setlayout, {0} }, + { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, + { ClkWinTitle, 0, Button2, zoom, {0} }, + { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, + { ClkClientWin, MODKEY, Button1, movemouse, {0} }, + { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, + { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, + { ClkTagBar, 0, Button1, toggleview, {0} }, + { ClkTagBar, 0, Button3, view, {0} }, + { ClkTagBar, MODKEY, Button1, tag, {0} }, + { ClkTagBar, MODKEY, Button3, toggletag, {0} }, +}; diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org new file mode 100644 index 00000000..151efbf4 --- /dev/null +++ b/emacs/.emacs.d/init.org @@ -0,0 +1,2522 @@ +#+TITLE: Emacs Configuration for Alan Pearce +#+OPTIONS: ^:nil +#+PROPERTY: results silent +#+PROPERTY: eval no-export +#+PROPERTY: header-args :comments link +* Introduction +This is a living document, detailing my Emacs configuration using org-mode +* Basics +** Startup +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-screen t) +(setq gc-cons-threshold 100000000) +(defvar file-name-handler-alist-backup file-name-handler-alist) +(setq file-name-handler-alist nil) +(remove-hook 'find-file-hooks #'vc-refresh-state) +#+END_SRC + +** Scratch buffers +I usually use scratch buffers for any sort of text. If I need a +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) +#+END_SRC + +** Personal Information +#+BEGIN_SRC emacs-lisp +(setq user-mail-address "alan@alanpearce.co.uk" + user-full-name "Alan Pearce") +#+end_src + +* Packaging + +** Use-package + +#+BEGIN_SRC emacs-lisp +(eval-and-compile + (setq tls-checktrust t + gnutls-verify-error t + package-archives '(("gnu" . "https://elpa.gnu.org/packages/") + ("melpa-stable" . "https://stable.melpa.org/packages/") + ("melpa" . "https://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)) +(setq use-package-verbose t + use-package-always-ensure t + package-enable-at-startup nil) +#+END_SRC + +* Customize +I don’t really like using customize for normal configuration. +Instead, I use it for things that get saved automatically. That’s why +I use a different file, which is ignored by the VCS. It also means +that it’s not important whether the file exists or not, which is why I +pass =:noerror= to =load= + +#+BEGIN_SRC emacs-lisp +(setq custom-file "~/.emacs.d/custom.el") +(load custom-file :noerror :nomessage) +#+END_SRC + +* Styles + +I prefer an always-visible cursor. Feels less distracting. +#+BEGIN_SRC emacs-lisp +(when (fboundp #'blink-cursor-mode) + (blink-cursor-mode -1)) +#+END_SRC + +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)) +(with-eval-after-load 'scroll-bar + (set-scroll-bar-mode nil)) +(with-eval-after-load 'tooltip + (tooltip-mode -1)) +(with-eval-after-load 'tool-bar + (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)))) +#+END_SRC + +#+BEGIN_SRC emacs-lisp +(use-package dash) +#+END_SRC + +** Colours + +Let’s try a more minimal theme. + +#+BEGIN_SRC emacs-lisp +(use-package minimal-theme + :disabled t + :config (progn + (load-theme 'minimal-light t))) +#+END_SRC + +Let’s try a basic theme. + +#+BEGIN_SRC emacs-lisp +(use-package basic-theme + :if (display-graphic-p) + :config (progn + (load-theme 'basic t) + + (set-face-background 'mode-line "#a1b56c") + (set-face-background 'border "#a1b56c") + (set-face-foreground 'border "#a1b56c") + (set-face-background 'vertical-border "#a1b56c") + (set-face-foreground 'vertical-border "#a1b56c") + (set-face-background 'window-divider "#a1b56c") + (set-face-foreground 'window-divider "#a1b56c") + + (defvar mode-line-default-format mode-line-format) + (defvar mode-line-default-hidden nil + "Whether to hide the mode line by default") + + (defun show-mode-line () + (interactive) + (setq mode-line-format mode-line-default-format) + (when (called-interactively-p 'interactive) + (setq-default mode-line-format mode-line-default-format) + (setq mode-line-default-hidden nil))) + (defun hide-mode-line () + (interactive) + (setq mode-line-format nil) + (when (called-interactively-p 'interactive) + (setq-default mode-line-format nil) + (setq mode-line-default-hidden t))) + + (setq-default cursor-type '(bar . 1)) + (setq-default cursor-in-non-selected-windows nil) + + (defun hide-clutter () + (interactive) + (fringe-mode '(0 . 4)) + (hide-mode-line)) + + (defun show-clutter () + (interactive) + (fringe-mode '(8 . 4)) + (show-mode-line)) + (hide-clutter) + + (when mode-line-default-hidden + (call-interactively #'hide-mode-line)) + + (defun hide-mode-line-if-default-hidden () + (if mode-line-default-hidden + (hide-mode-line) + (show-mode-line))) + + (add-to-list 'default-frame-alist '(border-width . 0)) + (add-to-list 'default-frame-alist '(internal-border-width . 0)) + (when (eq window-system 'x) + (setq window-divider-default-bottom-width 1 + window-divider-default-right-width 1 + window-divider-default-places t) + (setq mode-line-default-hidden t) + (window-divider-mode +1)) + + (add-hook 'after-change-major-mode-hook #'hide-mode-line-if-default-hidden) + + (add-hook 'minibuffer-setup-hook #'show-mode-line) + (add-hook 'minibuffer-exit-hook #'hide-mode-line))) +#+END_SRC + +Highlighting quasi-quoted expressions in lisps is quite useful, but I +don't need it all the time. I'll keep it around for a while so that I +can enable it if needed. +#+BEGIN_SRC emacs-lisp +(use-package highlight-stages + :diminish highlight-stages-mode) +#+END_SRC + +** Fonts + +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 antialias) + (if (boundp 'ns-antialias-text) + (setq ns-antialias-text antialias)) + (when mono-face + (let ((default-font (font-spec :family mono-face :size mono-font-size))) + (add-to-list 'default-frame-alist `(font . ,(format "%s %s" mono-face mono-font-size))) + (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 t)) + ((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 "Roboto Mono" 13 "Lucida Grande" 13 t) + (ap/set-fonts "Monaco" 10 "Lucida Grande" 12 nil)))) + ((eq window-system 'x) + (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 8)) + (ap/set-fonts "Fixed" 8 "Lucida" 8 nil)))) + + (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))) +#+END_SRC + +** Page Breaks + +By default, Emacs displays page breaks as ^L. Lines look much nicer. +On Windows, Emacs incorrectly detects that U+2500 (Box Drawings Light +Horizontal) can only be displayed with a different font, which is not +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))))) +#+END_SRC +** Modeline + +#+BEGIN_SRC emacs-lisp +(column-number-mode t) +(size-indication-mode t) + +(setq frame-title-format '("%f" (dired-directory dired-directory))) +#+END_SRC + +** Highlight Changes + +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))) +#+END_SRC + +** Beacon + +I was against the idea of having flashy animations inside Emacs, but +this one is useful. It highlights the cursor when scrolling or +switching windows. + +#+BEGIN_SRC emacs-lisp +(use-package beacon + :diminish beacon-mode + :config (beacon-mode +1)) +#+END_SRC + +** Renaming major modes + +Diminishing major modes does not happen in the same manner as minor +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))) +#+END_SRC + + +* Environment Variables + +MacOS doesn’t have a reasonable way to set environment variables and +read them automatically any more. So, let’s use the +[[https://github.com/purcell/exec-path-from-shell][exec-path-from-shell]] package to set up ~exec-path~ and similar +variables from whatever my shell configuration is. + +#+BEGIN_SRC emacs-lisp +(use-package exec-path-from-shell + :if (eq system-type 'darwin) + :config (exec-path-from-shell-initialize)) +#+END_SRC + +* Keybindings + +I think =set-keyboard-coding-system= stops OS X from doing something +annoying to add accents. The modifier setup is to match my +re-arrangement of modifiers on OSX: Cmd on the outside, then +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")) +#+END_SRC + +#+BEGIN_SRC emacs-lisp +(unbind-key "") +(bind-key* "" #'compile) +(bind-key* "" #'kmacro-start-macro-or-insert-counter) +(bind-key* "" #'kmacro-end-or-call-macro) + +(bind-key* "" #'execute-extended-command) + +(unbind-key "C-z") +(bind-key* "C-" #'other-window) + +(bind-key* "C-x C-r" #'revert-buffer) +(bind-key* "C-x C-j" #'delete-indentation) +(unbind-key "C-x C-c") + +(bind-key* "C-c i" #'insert-char) +(bind-key* "M-/" #'hippie-expand) + +(unbind-key "s-h") +(unbind-key "s-n") +(unbind-key "s-p") +(unbind-key "s-w") +(bind-key* "s-k" #'kill-or-delete-this-buffer-dwim) + +(bind-key "C-M-a" #'backward-paragraph text-mode-map) +(bind-key "C-M-e" #'forward-paragraph text-mode-map) + +(bind-key* "s-x" (define-prefix-command 'super-x-map)) +(bind-key* "s-," #'switch-to-dotfiles) +(bind-key* "C-M-x" #'execute-extended-command) +(set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) +#+END_SRC + +** Crux + +I can replace most of the simple helper/wrapper functions in my +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))) +#+END_SRC + +* Projects + +#+BEGIN_SRC emacs-lisp +(defvar work-project-directory "~/work") +(defvar home-project-directory "~/projects") +#+END_SRC + +#+BEGIN_SRC emacs-lisp +(defun switch-to-dotfiles () + (interactive) + (projectile-switch-project-by-name (expand-file-name "dotfiles" home-project-directory))) +#+END_SRC + +** The Silver Searcher + +#+BEGIN_SRC emacs-lisp +(use-package ag + :defer 30 + :config (setq ag-project-root-function #'projectile-project-root)) + +(use-package wgrep-ag + :after ag) +#+END_SRC + +** Ripgrep + +Step over Silver Search, here comes a new challenger. + +#+BEGIN_SRC emacs-lisp +(use-package ripgrep + :if (executable-find "rg")) + +(use-package projectile-ripgrep + :after (ripgrep projectile) + :if (executable-find "rg") + :bind (("C-c p s r" . projectile-ripgrep))) +#+END_SRC + +** Projectile + +Projectile is awesome for working in projects, especially VCS-backed +ones. I added a couple of functions to allow me to open new projects +based upon some folder conventions I use. + +#+BEGIN_SRC emacs-lisp +(use-package projectile + :bind (("s-p" . projectile-switch-project) + ("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 yarn-install (&optional arg) + (interactive "P") + (projectile-with-default-dir (projectile-project-root) + (cmd-to-echo "yarn" "install"))) + + (defun yarn-add-dev (package) + (interactive "spackage: ") + (projectile-with-default-dir (projectile-project-root) + (cmd-to-echo "yarn" (concat "add --dev " package)))) + + (defun yarn-add (package) + (interactive "spackage: ") + (projectile-with-default-dir (projectile-project-root) + (cmd-to-echo "yarn" (concat "add " package)))) + + (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-commander + projectile-completion-system 'ivy))) +#+END_SRC + +** vc + +This is nice for some things that magit doesn’t do, and for those rare +occasions that I’m working with something other than git. + +#+BEGIN_SRC emacs-lisp +(use-package vc + :defer t + :bind (("C-x v C" . vc-resolve-conflicts)) + :config (progn + (setq vc-follow-symlinks t) + (setq vc-ignore-dir-regexp (format "\\(%s\\)\\|\\(%s\\)" + vc-ignore-dir-regexp + tramp-file-name-regexp)))) +#+END_SRC + +** git-gutter-fringe + +It’s nice to be able to see at a glance which lines of a file have +changed. This package colours the fringe. I have it set to the right +fringe so it doesn’t interfere with flycheck. + +#+BEGIN_SRC emacs-lisp +(use-package git-gutter-fringe + :defer 2 + :diminish git-gutter-mode + :config (progn + (global-git-gutter-mode 1) + (set-face-foreground 'git-gutter:modified "grey") + (setq git-gutter-fr:side 'right-fringe))) +#+END_SRC + +** magit + +Magit is my favourite way to use git. I use selective staging all the +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-completing-read-function #'ivy-completing-read + magit-popup-use-prefix-argument 'default + magit-display-buffer-function #'magit-display-buffer-fullcolumn-most-v1 + 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 + +This package allow me to go through a file’s history with just a few +keys. It makes it very easy to figure what what exactly was in a file +in the past. I often find it useful when I remember writing something +a particular way, but it changed later. + +#+BEGIN_SRC emacs-lisp +(use-package git-timemachine + :commands git-timemachine) +#+END_SRC + +* Files + +** Auto-saving + +Auto-save everything to a temporary directory, instead of cluttering +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) +#+END_SRC +** Backups + +I like to keep my backups out of regular folders. I tell emacs to use +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)) +(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)))) +#+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))))) +#+END_SRC + +** Encoding + +UTF-8 is usually appropriate. Note that =prefer-coding-system= expects +only a coding system, not a coding system and line ending combination. + +#+BEGIN_SRC emacs-lisp +(prefer-coding-system 'utf-8) +(setq-default buffer-file-coding-system 'utf-8-auto-unix) +#+END_SRC + +** Buffer-file management + +Ask if I want to create a directory when it doesn’t exist. This is +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)))) +(add-to-list 'find-file-not-found-functions #'my-create-non-existent-directory) +#+END_SRC + +I often want to rename or delete the file that I’m currently visiting +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))))) +#+END_SRC + +** Whitespace Butler + +I don’t like it when editors change an entire file’s layout when I +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 (daemonp) + (add-hook 'before-make-frame-hook (lambda () + (use-package ws-butler + :config (ws-butler-global-mode 1))))) +#+END_SRC + +** shrink-whitespace + +DWIM whitespace removal. So I don’t need =M-SPC=, =M-\= and =C-x o= +for similar things any more. + +#+BEGIN_SRC emacs-lisp +(use-package shrink-whitespace + :bind ("M-SPC" . shrink-whitespace)) +#+END_SRC + +** Tramp + +Tramp is awesome. It makes SSH feel Unix-y. The proxy setup is so +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" (format "/run/user/%s/ssh-agent" (user-uid)))) + (setq tramp-default-method "ssh" + tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root")) + tramp-backup-directory-alist backup-directory-alist + tramp-completion-reread-directory-timeout 60 + tramp-ssh-controlmaster-options nil + 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)))) + +(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"))) +#+END_SRC + +** ediff + +I like a horizonal diff setup, with everything in one frame. + +#+BEGIN_SRC emacs-lisp +(use-package ediff + :defer t + :config (progn + (setq ediff-split-window-function 'split-window-horizontally + ediff-window-setup-function 'ediff-setup-windows-plain))) +#+END_SRC + +* Indentation + +Ah, a complicated topic. One day we’ll all be using elastic +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 2 + indent-tabs-mode nil) +#+END_SRC + + +** smart-tabs-mode + +Not related to [[smart-tab][=smart-tab=]], this mode indents with tabs and aligns +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))))) +#+END_SRC + +** editorconfig + +#+BEGIN_SRC emacs-lisp +(use-package editorconfig + :config (editorconfig-mode 1)) +#+END_SRC + +** dtrt-indent-mode + +Sometimes people use different indentation settings. [[https://github.com/jscheid/dtrt-indent][dtrt-indent]] +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))))) +#+END_SRC + +* Security + +** password-store + +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))) +#+END_SRC +* Buffers + +** Ibuffer +Ibuffer is quite nice for listing all buffers. + +#+BEGIN_SRC emacs-lisp +(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))))) +#+END_SRC + +** Relative Buffer names + +#+BEGIN_SRC emacs-lisp +(use-package relative-buffers + :defer 15 + :config (progn + (global-relative-buffers-mode))) +#+END_SRC +** Narrowing + +Enable it without prompting + +#+BEGIN_SRC emacs-lisp +(put 'narrow-to-defun 'disabled nil) +(put 'narrow-to-page 'disabled nil) +(put 'narrow-to-region 'disabled nil) +#+END_SRC + +** ace-window + +I don’t often have many windows open at once, but when I do, +=ace-window= is really nice to jump around them in the same way that +=ace-jump= or =avy= work. +#+BEGIN_SRC emacs-lisp +(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)))) +#+END_SRC + +* Windows + +Scrolling is tricky. I use this setup to help me keep track of the +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 160 + frame-resize-pixelwise nil) +(if (boundp 'ns-pop-up-frames) + (setq ns-pop-up-frames nil)) +#+END_SRC + +** winner + +Undo, for window-based commands. + +#+BEGIN_SRC emacs-lisp +(use-package winner + :config (setq winner-boring-buffers '("*Completions*" "*Help*" "*Apropos*" "*Buffer List*" "*info*" "*Compile-Log*")) + :init (progn + (winner-mode 1))) +#+END_SRC + +** windmove + +Directional window movement + +#+BEGIN_SRC emacs-lisp +(use-package windmove + :bind (("S-" . windmove-left) + ("S-" . windmove-right) + ("S-" . windmove-up) + ("S-" . windmove-down))) +#+END_SRC +* Completion + +Make built-in completion a bit more intelligent, by adding substring +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) +#+END_SRC + +** Company + +The main choices for automatic completion in Emacs are company and +auto-complete-mode. I’ve not tried auto-complete-mode as company +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-gtags + company-etags company-keywords) company-oddmuse) + company-frontends '(company-pseudo-tooltip-unless-just-one-frontend + company-preview-frontend + company-echo-metadata-frontend) + 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))) +#+END_SRC + +#+BEGIN_SRC emacs-lisp +(use-package company-web + :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))) +#+END_SRC + +* Dates & Times + +** Calendar + +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))) +#+END_SRC + +Sometimes I want to insert a date or time into a buffer. +#+BEGIN_SRC emacs-lisp +(defun insert-date (prefix) + "Insert the current date. With prefix-argument, use British format. With + 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)))) + +(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)))) +#+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)) +#+END_SRC + +* Directories + +Dired works quite nicely, but not always in the way I want. I don’t +like having so many prompts for recursive operations. Also, when I +have two dired windows open, assume that I’m going to be +copying/moving files between them. + +#+BEGIN_SRC emacs-lisp +(use-package dired + :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") + (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)) + +(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 + dired-bind-jump nil)) + :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))) +#+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)))) +#+END_SRC + +** Dired-narrow +One can already use dired with wildcards to browse a filtered +directory listing, but it opens a new buffer. Dired-narrow is a +slightly nicer interface: with a currently-open dired buffer, use =/= +to start filtering, =RET= to complete the filter and =g= to refresh +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)))) +#+END_SRC + +* Documentation + +** ehelp + +ehelp is a less well-known package that’s part of Emacs and slightly +improves the normal help commands, mostly by making quitting them easier. + +#+BEGIN_SRC emacs-lisp +(use-package ehelp + :bind-keymap ("C-h" . ehelp-map)) +#+END_SRC +** counsel-dash + +Emacs’ documentation is great to read from inside Emacs. Counsel-dash +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))))) + +(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")))) +#+END_SRC + +** discover-my-major + +A nicer way to browse keybindings for major modes. + +#+BEGIN_SRC emacs-lisp +(use-package discover-my-major + :bind ("" . discover-my-major)) +#+END_SRC + +** which-key + +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))) +#+END_SRC + +** eldoc + +Documentation in the echo-area (where the minibuffer is displayed) is +rather useful. + +#+BEGIN_SRC emacs-lisp +(use-package eldoc + :commands (eldoc-mode) + :diminish eldoc-mode + :config (progn + (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.") +(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 " + " nil t) + (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)))) + +(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))) + +(defun process-exit-code (program &rest args) + "Run PROGRAM with ARGS and return the exit code" + (apply 'call-process program nil nil nil args)) + +(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))) + +(bind-key* "M-!" #'shell-execute) +(bind-key* "C-x r M-w" #'copy-rectangle) +#+END_SRC + +** Auxillary Configuration + +#+BEGIN_SRC emacs-lisp +(require 'pinentry) + +(defvar have-private-key + (file-exists-p (expand-file-name "secring.gpg" "~/.gnupg/"))) + +(defvar gpg-agent-ssh-sock + (or (getenv "GPG_AGENT_INFO") + (concat "/run/user/" (number-to-string (user-uid)) "/gnupg/S.gpg-agent.ssh"))) + +(defun read-gpg-file (file) + (let ((file-to-decrypt (expand-file-name file user-emacs-directory)) + (ctx (epg-make-context epa-protocol))) + (if (file-exists-p file-to-decrypt) + (epg-decrypt-file ctx file-to-decrypt nil) + (message "Decrypting %s...failed" file-to-decrypt) + (error "File %s does not exist" file-to-decrypt)))) + +(defun load-gpg (file) + (if have-private-key + (load file) + (message "WARNING: Couldn't load %s (No gpg key found)" file))) + +; load this in a post-frame hook because gpg-agent asks for a password on first +; startup and caches it. Don't want emacs daemon to hang because of gpg-agent. +(defun load-private-data () + (interactive) + (if (not have-private-key) + (message "ERROR: Private GPG key not found") + (unless (or (getenv "GPG_AGENT_INFO") + (getenv "SSH_AUTH_SOCK")) + (start-process "gpg-agent" nil "gpg-agent" "--daemon") + (setenv "SSH_AUTH_SOCK" gpg-agent-ssh-sock)) + (setq password-cache-expiry nil) + (unless (file-exists-p (concat pinentry--socket-dir "pinentry")) + (pinentry-start) + (add-hook 'kill-emacs-hook 'pinentry-stop)) + (add-to-list 'load-suffixes ".el.gpg") + (load-gpg (expand-file-name "private" user-emacs-directory)))) + +(defun first-frame-hook (frame) + (remove-hook 'after-make-frame-functions #'first-frame-hook) + (run-at-time nil nil 'load-private-data)) + +(if (eq 1 (length (frame-list))) + (add-hook 'after-init-hook #'load-private-data) + (add-hook 'after-make-frame-functions #'first-frame-hook)) +#+END_SRC + +* Minibuffer + +Sometimes I want to use the minibuffer, but I’m already inside it. +Fortunately, this is possible. Of course, I need to know how many +minibuffers there are on the stack. + +#+BEGIN_SRC emacs-lisp +(setq enable-recursive-minibuffers t) +(minibuffer-depth-indicate-mode t) +#+END_SRC + +This avoids some issue with the minibuffer and the point being behind +the prompt. I don’t remember what exactly. +#+BEGIN_SRC emacs-lisp +(setq minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)) +#+END_SRC + +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)) +#+END_SRC + +** swiper/ivy + +Ivy is the new kid on the completion block. It seems to be a strong +replacement for helm so far. + +#+BEGIN_SRC emacs-lisp +(use-package swiper + :bind (("C-s" . swiper) + ("C-r" . swiper) + ("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 "" #'counsel-M-x) + (bind-key "C-c M-x" #'execute-extended-command) + (bind-key "C-x C-f" #'counsel-find-file) + (bind-key "M-y" #'counsel-yank-pop) + (bind-key "M-y" #'ivy-next-line ivy-minibuffer-map) + (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)))))) +#+END_SRC + + +** smex + +Smex is my favourite way to use =M-x=. Counsel’s =counsel-M-x= +function uses it internally, so I’m keeping it around, even though I +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")))) +#+END_SRC + +** cmd-to-echo + +I’ve been looking for some way to run programming projects (mostly +node.js) inside emacs. =cmd-to-echo= seems great for this, as new +output pops up in the echo area. + +#+BEGIN_SRC emacs-lisp +(use-package cmd-to-echo + :commands (cmd-to-echo) + :config (setq cmd-to-echo-add-output-to-process-buffers t)) +#+END_SRC +* Modes + +Setup some modes for systemd files +#+BEGIN_SRC emacs-lisp +(add-to-list 'auto-mode-alist '("\\.service\\'" . conf-mode)) +(add-to-list 'auto-mode-alist '("\\.target\\'" . conf-mode)) +(add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-mode)) +#+END_SRC + +=direnv=’s files are basically shell scripts, it’s a nice way to +set environment variables for projects. +#+BEGIN_SRC emacs-lisp +(add-to-list 'auto-mode-alist '("\\.envrc\\'" . sh-mode)) +#+END_SRC + +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))) + +(use-package haskell-mode + :mode (("\\.hs\\'" . haskell-mode))) + +(use-package dockerfile-mode + :mode (("Dockerfile\\'" . dockerfile-mode))) + +(use-package nix-mode + :mode (("\\.nix\\'" . nix-mode))) + +(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))) + +(use-package lua-mode + :defer t) + +(use-package ruby-mode + :mode (("\\.rb\\'" . ruby-mode) + ("\\.cap\\'" . ruby-mode))) + +(use-package go-mode + :mode (("\\.go\\'" . go-mode))) + +(use-package jinja2-mode + :mode (("\\.j2\\'" . jinja2-mode) + ("\\.jinja\\'" . jinja2-mode))) + +(use-package scss-mode + :defer t + :config (progn + (setq scss-compile-at-save nil))) + +(use-package 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)) + +(define-derived-mode saltstack-mode yaml-mode "Salt") +(add-to-list 'auto-mode-alist '("\\.sls\\'" . saltstack-mode)) +#+END_SRC + +** ledger + +I use [[http://ledger-cli.org/][=ledger=]] to manage my finances. It has an Emacs mode, which +works really nicely. + +#+BEGIN_SRC emacs-lisp +(use-package ledger-mode + :mode ("\\.ledger\\'" . ledger-mode) + :init (progn + (defun open-budget () + (interactive) + (projectile-switch-project-by-name "~/Sync/Default") + (find-file (expand-file-name "ledger/my.ledger" (projectile-project-root))) + (ledger-report "Budget (Cumulative)" nil))) + :config (progn + (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 \\^Assets:Budget$") + ("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 + +#+BEGIN_SRC emacs-lisp +(use-package markdown-mode + :defer t + :config (progn + (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) +#+END_SRC + +** Org + +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")) + + org-default-notes-file (concat org-directory "/notes") + + ;; ‘Remember’: new items at top + org-reverse-note-order t + + org-modules '(org-protocol) + + ;; Add time done to ‘done’ tasks + org-log-done 'time + + org-list-allow-alphabetical t + + org-adapt-indentation nil + + org-pretty-entities t + + org-table-duration-custom-format 'seconds + + org-src-fontify-natively nil + + org-export-have-math 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))) +#+END_SRC + +**** org-babel + +Org’s babel feature is really nice. I use it for this file, and I can +use it to communicate between programming languages. Sometime I hope +to have my =ledger= setup in an org file with some graph processing +with R or something. + +#+BEGIN_SRC emacs-lisp +(use-package ob-core + :defer t + :ensure nil + :config (progn + (org-babel-do-load-languages 'org-babel-load-languages + '((ledger . t) + (sh . t))) + (setq org-src-tab-acts-natively t + org-edit-src-content-indentation 0 + org-src-preserve-indentation t))) +#+END_SRC + +**** org-journal + +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))))) +#+END_SRC + +**** org-mobile + +#+BEGIN_SRC emacs-lisp +(defun ap/org-mobile-pull (descriptor action file) + (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)))))) +#+END_SRC + +**** org-caldav + +I’ve setup CalDAV on my server, it would be nice to use it directly +from org-mode. Previously I had to wait for org-mobile to sync and +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))) +#+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. + +#+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 + +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)) + (if (executable-find "eslint_d") + (setq flycheck-javascript-eslint-executable (executable-find "eslint_d"))))) +#+END_SRC + +** golang + +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))) + +(use-package go-eldoc + :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))) + + +#+END_SRC + +** ggtags + +A nice completion backend for programming modes. + +#+BEGIN_SRC emacs-lisp +(use-package ggtags + :disabled t + :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 + +*** All + +Lisp modes don’t seem to have a common ancestor. So I made a custom +hook which I trigger in every lispy-mode. + +#+BEGIN_SRC emacs-lisp +(defcustom lisp-mode-common-hook nil + "Hook run when entering any Lisp mode." + :type 'hook + :group 'lisp) + +(defun ap/lisp-setup () + (run-hooks 'lisp-mode-common-hook)) +#+END_SRC + +**** Redshank + +Lisp syntax allows for really easy refactoring. Redshank gives some +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))) +#+END_SRC + +*** Emacs Lisp + +Customise the modeline-display of =emacs-lisp-mode=. Then make sure +it runs the common lisp hooks. + +#+BEGIN_SRC emacs-lisp +(add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup) +(add-hook 'emacs-lisp-mode-hook #'eldoc-mode) +#+END_SRC + +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))) +#+END_SRC + +Interactive elisp + +#+BEGIN_SRC emacs-lisp +(use-package ielm + :defer t + :ensure nil + :config (progn + (add-hook 'ielm-mode-hook (lambda () + (run-hooks 'lisp-mode-common-hook))))) +#+END_SRC + +*** Scheme & Lisp + +I don’t work with these as often as I would like + +#+BEGIN_SRC emacs-lisp +(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)) +(add-hook 'lisp-mode-hook #'set-common-lisp-indentation) +#+END_SRC + +**** geiser + +A REPL thing for Scheme. Hopefully I’ll get to use it more in the +future. + +#+BEGIN_SRC emacs-lisp +(use-package geiser + :commands (geiser-mode + geiser + run-geiser + run-racket)) +#+END_SRC + +**** slime + +A REPL thing (and more) for Lisp. + +#+BEGIN_SRC emacs-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")))) +#+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))) + +(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))) +#+END_SRC + +**** cider + +A REPL thing for Clojure + +#+BEGIN_SRC emacs-lisp +(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))) +#+END_SRC + +** Auto-compile + +Auto-compile emacs lisp when saving. +#+BEGIN_SRC emacs-lisp +(use-package auto-compile + :defer t + :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) +#+END_SRC + +** cc-mode + +Although I don’t use C or C++, setting up the mode is helpful because +quite a few other modes are derived from it. + +#+BEGIN_SRC emacs-lisp +(use-package cc-mode + :defer 5 + :init (progn + (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 '+))) +#+END_SRC + +** quickrun + +It’s nice to be able to quickly evaluate some code. Although I don’t +really seem to use it. +#+BEGIN_SRC emacs-lisp +(use-package quickrun + :bind (("C-c C-e" . quickrun))) +#+END_SRC + +** Scala + +Let’s try using Scala. + +#+BEGIN_SRC emacs-lisp +(use-package scala-mode + :pin melpa-stable) +#+END_SRC + +And add ensime, an IDE-style environment. + +#+BEGIN_SRC emacs-lisp +(use-package ensime + :pin melpa-stable) +#+END_SRC + +** Web development + +*** js2-mode + +This mode is really great for editing Javascript. It turns code into +an AST internally, so it can work with it almost like a lisp. I don’t +think there’s anything as good as paredit/redshank for refactoring in +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) + (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) + (setq js2-basic-offset 2 + js2-include-node-externs t))) +#+END_SRC + +**** jade (not pug) + +Javascript with an inferior node.js process and a debugger? Awesome. + +To debug with node, use version 6.9.1 or later of node and run it with +~--inspect~ and, to break on the first line, ~--debug-brk~. + +For Chrom*, it needs to be launched with ~--remote-debugging-port=9222~ + +#+BEGIN_SRC emacs-lisp +(use-package jade + :config (progn + (add-hook 'js2-mode-hook #'jade-interaction-mode))) +#+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))) +#+END_SRC + +*** tern + +Tern understands javascript. It adds really clever documented +completions, besides other IDE-like things. + +#+BEGIN_SRC emacs-lisp +(use-package tern + :commands ap/enable-tern + :if (executable-find "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)) +#+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))) +#+END_SRC + +*** restclient + +Restclient is really nice. It’s like a scratchpad for HTTP api +calls. Feels a bit like using =org-babel=. I wonder if there’s an +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))) + +(use-package company-restclient + :after (company restclient) + :init (add-to-list 'company-backends #'company-restclient t)) +#+END_SRC + +*** sgml-mode + +This is for HTML, since old versions of HTML were derived from SGML. +#+BEGIN_SRC emacs-lisp +(use-package sgml-mode + :defer t + :config (setq sgml-basic-offset 2)) +#+END_SRC + +*** emmet-mode + +Emmet is really nice to write HTML quickly. Especially with +frameworks that require multiple nested elements to do anything useful. +#+BEGIN_SRC emacs-lisp +(use-package emmet-mode + :commands (emmet-mode) + :diminish (emmet-mode . " >") + :init (progn + (setq emmet-indentation 2) + (add-hook 'web-mode-hook #'emmet-mode))) +#+END_SRC + +*** web-mode + +This mode handles just about every templating language out ther, which +is really nice, because it handles the HTML part the same way in all +of them as well. + +#+BEGIN_SRC emacs-lisp +(use-package web-mode + :mode (("/views/.*\\.php\\'" . web-mode) + ("\\.html\\'" . web-mode) + ("/templates/.*\\.php\\'" . web-mode) + ("\\.ejs\\'" . web-mode)) + :config (progn + (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 + 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=. + +#+BEGIN_SRC emacs-lisp +(define-derived-mode twig-mode web-mode "Twig") +(add-to-list 'auto-mode-alist '("\\.html\\.twig\\'" . twig-mode)) +#+END_SRC + +* Spelling + +#+BEGIN_SRC emacs-lisp +(use-package ispell + :bind (("" . ispell-word)) + :config (progn + (cond + ((executable-find "aspell") (setq ispell-program-name "aspell" + ispell-dictionary "british" + ispell-really-aspell t + ispell-really-hunspell nil)) + ((executable-find "hunspell") (setq ispell-program-name "hunspell" + ispell-really-aspell nil + ispell-really-hunspell t))))) +#+END_SRC + +* Scripting + +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) + +(use-package sh-script + :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)) +#+END_SRC + +#+BEGIN_SRC emacs-lisp +(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) +#+END_SRC + +** eshell + +I should try to get into the habit of using this more. It’s really +nice, when I remember to use it. + +#+BEGIN_SRC emacs-lisp +(use-package eshell + :bind ("C-c s" . eshell) + :config (progn + (setq eshell-directory-name "~/.emacs.d/eshell" + eshell-prompt-function (lambda () + (concat + (eshell/pwd) + "\n$ "))) + (add-hook 'eshell-load-hook (lambda () + (bind-key "C-c C-l" #'counsel-esh-history eshell-mode-map))))) + +(use-package em-smart + :ensure nil + :commands eshell-smart-initialize + :init (progn + (add-hook 'eshell-load-hook #'eshell-smart-initialize)) + :config (progn + (setq eshell-where-to-jump 'begin + eshell-review-quick-commands nil + eshell-smart-space-goes-to-end t))) + +(autoload #'eshell/cd "em-dirs") +(defun eshell-goto-current-dir (&optional arg) + (interactive "P") + (let ((dir default-directory)) + (eshell arg) + (eshell/cd dir))) +(bind-key "C-c S" #'eshell-goto-current-dir) + + +#+END_SRC + +*** Shells + +#+BEGIN_SRC emacs-lisp +(use-package shell + :defer t + :ensure nil + :config (define-key shell-mode-map + (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) + +(use-package comint + :defer t + :ensure nil + :config (bind-key "C-c C-l" #'counsel-shell-history comint-mode-map)) + +(defun comint-delchar-or-eof-or-kill-buffer (arg) + (interactive "p") + (if (null (get-buffer-process (current-buffer))) + (kill-buffer) + (comint-delchar-or-maybe-eof arg))) +#+END_SRC + +* Text editing + +Emacs has an editor within. + +#+BEGIN_SRC emacs-lisp +(put 'upcase-region 'disabled nil) +(put 'downcase-region 'disabled nil) +(setq sentence-end-double-space t + line-move-visual nil) +#+END_SRC + +** align + +=Align= is a useful command to line things up, once given some rules. +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)))))) +#+END_SRC + +** Clipboard + +I like to use the clipboard more than the primary selection in X11. + +#+BEGIN_SRC emacs-lisp +(setq x-select-enable-clipboard t + save-interprogram-paste-before-kill t) +(if (functionp '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 + +*** Copy formatted code + +#+BEGIN_SRC emacs-lisp +(bind-key* "C-c w" (define-prefix-command 'copy-as-map)) +(use-package copy-as-format + :bind (("C-c C-w" . copy-as-format) + :map copy-as-map + ("b" . copy-as-format-bitbucket) + ("g" . copy-as-format-github) + ("h" . copy-as-format-hipchat) + ("w" . copy-as-format-html) + ("j" . copy-as-format-jira) + ("m" . copy-as-format-markdown) + ("s" . copy-as-format-slack))) +#+END_SRC + +** + +** Selection + +I’m quite used to deleting text by selecting it and typing. Emacs has +a mode for that. + +#+BEGIN_SRC emacs-lisp +(delete-selection-mode t) +#+END_SRC + +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)) +#+END_SRC + +I find that =zap-up-to-char= normally makes more sense to me than +=zap-to-char=. + +#+BEGIN_SRC emacs-lisp +(use-package misc + :ensure nil + :bind (("M-z" . zap-up-to-char) + ("M-Z" . zap-to-char))) +#+END_SRC + +Expanding the region by semantic units was something I quite liked +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)) +#+END_SRC + +** avy + +Avy is a really nice way to move around files, like ace-jump-mode, but +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) + ("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 ?\;)))) +#+END_SRC + +*** ace-link + +Visit any link. Despite the name, this works with avy. + +#+BEGIN_SRC emacs-lisp +(use-package ace-link + :after avy + :config (progn + (ace-link-setup-default) + (with-eval-after-load "gnus" + (bind-key "M-o" #'ace-link-gnus gnus-summary-mode-map) + (bind-key "M-o" #'ace-link-gnus gnus-article-mode-map)))) +#+END_SRC + +** goto-chg + +This is like popping the mark, only it filters to only change areas +and doesn’t go back to the same place more than once. + +#+BEGIN_SRC emacs-lisp +(use-package goto-chg + :bind ("C-c C-SPC" . goto-last-change)) +#+END_SRC + +** multiple-cursors + +I mentioned before that I’d used Sublime Text before. Multiple +cursors was one of my favourite features, so I was really happy when I +saw that multiple-cursors was released for Emacs. + +#+BEGIN_SRC emacs-lisp +(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-" #'mc/mark-all-like-this-dwim) + (bind-key "C-" #'mc/mark-more-like-this-extended) + (bind-key "C-S-L" #'mc/edit-lines))) +#+END_SRC + +** paredit + +Balanced parentheses in lisps are nice, but all the refactoring and +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))) +#+END_SRC + +** smartparens + +I like to use smartparens where paredit isn’t already useful. Somehow +I didn’t find smartparens’ implementation of paredit style to be as +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-" #'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-" #'sp-splice-sexp-killing-backward smartparens-mode-map) + (bind-key "M-" #'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-" #'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 + +** smart-scan + +Move between instances of a symbol + +#+BEGIN_SRC emacs-lisp +(use-package smartscan + :config (progn + (smartscan-mode 1))) +#+END_SRC + +** move-text + +Transposing lines, made easier. + +#+BEGIN_SRC emacs-lisp +(use-package move-text + :config (move-text-default-bindings)) +#+END_SRC + +** undo-tree + +Emacs’ default handling of undo is a bit confusing. Undo-tree makes +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))) + :diminish undo-tree-mode) +#+END_SRC + +** replace + +#+BEGIN_SRC emacs-lisp +(use-package replace + :defer t + :config (progn + (setq case-replace nil))) +#+END_SRC + +** visual-regexp + +I don’t always remember exactly how Emacs’ regular expressions work, +so this package is pretty useful because it highlights everything in +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))) +#+END_SRC +* Tangling + +Taken from [[https://github.com/larstvei/dot-emacs/blob/master/init.org][larstvei/dot-emacs]]. I changed it so that it would work with +my current dotfiles repository structure and work asynchronously, +thanks to [[https://github.com/jwiegley/emacs-async][jwiegley/emacs-async]]. + +We can use =C-c C-v t= to run =org-babel-tangle=, which extracts the +code blocks from the current file into a source-specific file (in this +case a =.el=-file). + +To avoid doing this each time a change is made we can add a function +to the =after-save-hook= ensuring to always tangle and byte-compile +the =org=-document after changes. + +#+BEGIN_SRC emacs-lisp +(use-package async + :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." + + (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))))) + +(defun tangle-init () + "Tangle init.org asynchronously." + + (interactive) + (message "Tangling init") + (async-start + (symbol-function #'tangle-init-sync) + (lambda (result) + (message "Init tangling completed: %s" result)))) +#+END_SRC + +# Local Variables: +# eval: (when (fboundp #'tangle-if-init) (add-hook 'after-save-hook #'tangle-if-init)) +# End: +* End + +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))))) +(setq gc-cons-threshold 800000 + file-name-handler-alist file-name-handler-alist-backup) +#+END_SRC diff --git a/fish/.config/fish/config.fish b/fish/.config/fish/config.fish new file mode 100755 index 00000000..34cd22ec --- /dev/null +++ b/fish/.config/fish/config.fish @@ -0,0 +1,2 @@ +set PATH $PATH /home/alan/bin +setenv SSH_AUTH_SOCK $XDG_RUNTIME_DIR/ssh-agent.socket diff --git a/git/.config/git/config b/git/.config/git/config new file mode 100644 index 00000000..6228a08b --- /dev/null +++ b/git/.config/git/config @@ -0,0 +1,34 @@ +[user] + email = alan@alanpearce.uk + name = Alan Pearce +[color] + branch = auto + diff = auto + status = auto + ui = true +[push] + default = current +[alias] + up = merge FETCH_HEAD + st = status -sb + ci = commit + br = branch + co = checkout + ready = rebase -i @{u} + lg = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' + standup = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --since yesterday --author Alan + ignored = ls-files --others -i --exclude-standard + pr = pull-request + delete-merged = "!sh -c 'git branch --merged | grep -v "\\*" | grep -v master | grep -v dev | xargs -n 1 git branch -d'" +[github] + user = alan@alanpearce.uk +[diff] + algorithm = patience +[include] + path = config.local +[core] + excludesfile = ~/.config/git/ignore +[rebase] + autosquash = true +[rerere] + enabled = true diff --git a/git/.config/git/gitk b/git/.config/git/gitk new file mode 100644 index 00000000..0eb9a033 --- /dev/null +++ b/git/.config/git/gitk @@ -0,0 +1,61 @@ +set mainfont {{Lucida Grande} 12} +set textfont {Monaco 12} +set uifont {{Lucida Grande} 12 bold} +set tabstop 4 +set findmergefiles 0 +set maxgraphpct 50 +set maxwidth 16 +set cmitmode patch +set wrapcomment none +set autoselect 1 +set autosellen 40 +set showneartags 1 +set maxrefs 20 +set hideremotes 0 +set showlocalchanges 1 +set datetimeformat {%Y-%m-%d %H:%M:%S} +set limitdiffs 1 +set uicolor grey85 +set want_ttk 1 +set bgcolor white +set fgcolor black +set uifgcolor black +set uifgdisabledcolor #999 +set colors {green red blue magenta darkgrey brown orange} +set diffcolors {red "#00a000" blue} +set mergecolors {red blue green purple brown "#009090" magenta "#808000" "#009000" "#ff0080" cyan "#b07070" "#70b0f0" "#70f0b0" "#f0b070" "#ff70b0"} +set markbgcolor #e0e0ff +set diffcontext 3 +set selectbgcolor gray85 +set foundbgcolor yellow +set currentsearchhitbgcolor orange +set extdifftool opendiff +set perfile_attrs 0 +set headbgcolor green +set headfgcolor black +set headoutlinecolor black +set remotebgcolor #ffddaa +set tagbgcolor yellow +set tagfgcolor black +set tagoutlinecolor black +set reflinecolor black +set filesepbgcolor #aaaaaa +set filesepfgcolor black +set linehoverbgcolor #ffff80 +set linehoverfgcolor black +set linehoveroutlinecolor black +set mainheadcirclecolor yellow +set workingfilescirclecolor red +set indexcirclecolor green +set circlecolors {white blue gray blue blue} +set linkfgcolor blue +set circleoutlinecolor black +set geometry(main) 1477x845+26+50 +set geometry(state) normal +set geometry(topwidth) 1477 +set geometry(topheight) 300 +set geometry(pwsash0) "378 1" +set geometry(pwsash1) "569 1" +set geometry(botwidth) 473 +set geometry(botheight) 675 +set permviews {} diff --git a/git/.config/git/ignore b/git/.config/git/ignore new file mode 100644 index 00000000..d7189dc5 --- /dev/null +++ b/git/.config/git/ignore @@ -0,0 +1,29 @@ +.DS_Store +.AppleDouble +.LSOverride +Icon +Desktop.ini + +# Thumbnails +._* +Thumbs.db + +# Emacs +*~ +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +.elc +auto-save-list +tramp +.\#* + +# Org-mode +.org-id-locations +*_archive + +GPATH +GRTAGS +GTAGS + +.tern-port \ No newline at end of file diff --git a/global/.globalrc b/global/.globalrc new file mode 100644 index 00000000..7fd1a0bb --- /dev/null +++ b/global/.globalrc @@ -0,0 +1,6 @@ +default:\ + :tc=symfony_global: + +symfony_global:\ + :suffixes=php,yml,yaml,html,twig,xml:\ + :skip=/app/cache,node_modules,bin,/app/logs,GPATH,GTAGS,GRTAGS,GSYMS,HTML/,HTML.pub/,html/,tags,TAGS,ID,y.tab.c,y.tab.h,.notfunction,cscope.out,cscope.po.out,cscope.in.out,.gdbinit,SCCS/,RCS/,CVS/,CVSROOT/,{arch}/,.svn/,.git/,.cvsrc,.cvsignore,.gitignore,.cvspass,.cvswrappers,.deps/,autom4te.cache/,.snprj/: diff --git a/hg/.hgrc b/hg/.hgrc new file mode 100644 index 00000000..2f16f27e --- /dev/null +++ b/hg/.hgrc @@ -0,0 +1,9 @@ +[ui] +username = Alan Pearce + +[extensions] +purge = +progress = +color = +eol = +record = \ No newline at end of file diff --git a/karabiner/.config/karabiner/karabiner.json b/karabiner/.config/karabiner/karabiner.json new file mode 100644 index 00000000..0e866a63 --- /dev/null +++ b/karabiner/.config/karabiner/karabiner.json @@ -0,0 +1,63 @@ +{ + "profiles": [ + { + "devices": [ + { + "identifiers": { + "is_keyboard": true, + "is_pointing_device": false, + "product_id": 602, + "vendor_id": 1452 + }, + "ignore": true, + "keyboard_type": 41 + }, + { + "identifiers": { + "is_keyboard": true, + "is_pointing_device": false, + "product_id": 8209, + "vendor_id": 1241 + }, + "ignore": false, + "keyboard_type": 40 + } + ], + "fn_function_keys": { + "f1": "vk_consumer_brightness_down", + "f10": "mute", + "f11": "volume_down", + "f12": "volume_up", + "f2": "vk_consumer_brightness_up", + "f3": "vk_mission_control", + "f4": "vk_launchpad", + "f5": "vk_consumer_illumination_down", + "f6": "vk_consumer_illumination_up", + "f7": "vk_consumer_previous", + "f8": "vk_consumer_play", + "f9": "vk_consumer_next" + }, + "name": "Default Profile", + "selected": true, + "simple_modifications": { + "caps_lock": "delete_or_backspace", + "left_command": "left_option", + "left_control": "left_command", + "left_option": "left_control", + "right_command": "right_option", + "right_control": "right_command", + "right_option": "right_control" + } + }, + { + "name": "Macbook keyboard", + "simple_modifications": { + "caps_lock": "delete_or_backspace", + "grave_accent_and_tilde": "non_us_backslash", + "left_command": "left_control", + "non_us_backslash": "grave_accent_and_tilde", + "right_command": "right_control" + } + } + ] +} diff --git a/minttyrc/minttyrc b/minttyrc/minttyrc new file mode 100644 index 00000000..2e7f2d86 --- /dev/null +++ b/minttyrc/minttyrc @@ -0,0 +1,33 @@ +BoldAsFont=no +Font=Cousine +FontHeight=12 +FontSmoothing=default +Locale=en_GB +Charset=UTF-8 +Columns=100 +Rows=36 +Scrollbar=none +Transparency=off +OpaqueWhenFocused=no +CursorType=block +CursorBlinks=no +RightClickAction=extend +BoldBlack=0,43,54 +Black=7,54,66 +BoldGreen=88,110,117 +BoldYellow=101,123,131 +BoldBlue=131,148,150 +BoldCyan=147,161,161 +White=238,232,213 +BoldWhite=253,246,227 +Yellow=181,137,0 +BoldRed=203,75,22 +Red=220,50,47 +Magenta=211,54,130 +BoldMagenta=108,113,196 +Blue=38,139,210 +Cyan=42,161,152 +Green=133,153,0 +ForegroundColour=101,123,117 +BackgroundColour=253,246,227 +CursorColour=112,129,131 diff --git a/rcrc b/rcrc deleted file mode 100644 index 112aae61..00000000 --- a/rcrc +++ /dev/null @@ -1,3 +0,0 @@ -EXCLUDES="Brewfile LaunchAgents README.org" -DOTFILES_DIRS="$HOME/projects/dotfiles" -[ -e ~/.rcrc.local ] && . ~/.rcrc.local \ No newline at end of file diff --git a/ssh/.ssh/rc b/ssh/.ssh/rc new file mode 100755 index 00000000..59e4cfd1 --- /dev/null +++ b/ssh/.ssh/rc @@ -0,0 +1,5 @@ +#!/bin/sh +if [ "$SSH_AUTH_SOCK" ] +then + ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock +fi diff --git a/tag-atop/atoprc b/tag-atop/atoprc deleted file mode 100644 index d03319ea..00000000 --- a/tag-atop/atoprc +++ /dev/null @@ -1,2 +0,0 @@ -flags Aa -maxlinecpu 0 \ No newline at end of file diff --git a/tag-clojure/lein/profiles.clj b/tag-clojure/lein/profiles.clj deleted file mode 100644 index 99c0de2d..00000000 --- a/tag-clojure/lein/profiles.clj +++ /dev/null @@ -1,11 +0,0 @@ -{:user {:plugins [[org.clojure/tools.namespace "0.2.10"] - [lein-autoexpect "1.6.0"] - [lein-ancient "0.6.7"] - [lein-droid "0.4.0-alpha4"]] - :dependencies [[org.clojure/tools.trace "0.7.8"]] - :repl-options {:init - (do - (require '[clojure.java.javadoc :refer [javadoc]]) - (clojure.java.javadoc/add-local-javadoc - "/usr/share/doc/java8-openjdk/api/"))}} - :repl {:plugins [cider/cider-nrepl "0.9.1"]}} diff --git a/tag-dwm/dwm/config.h b/tag-dwm/dwm/config.h deleted file mode 100644 index ae1d8bb3..00000000 --- a/tag-dwm/dwm/config.h +++ /dev/null @@ -1,106 +0,0 @@ -/* See LICENSE file for copyright and license details. */ - -/* appearance */ -static const char font[] = "-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*"; -static const char normbordercolor[] = "#657b83"; -static const char normbgcolor[] = "#002b36"; -static const char normfgcolor[] = "#fdf6e3"; -static const char selbordercolor[] = "#859900"; -static const char selbgcolor[] = "#586e75"; -static const char selfgcolor[] = "#fdf6e3"; -static const unsigned int borderpx = 1; /* border pixel of windows */ -static const unsigned int snap = 32; /* snap pixel */ -static const Bool showbar = True; /* False means no bar */ -static const Bool topbar = True; /* False means bottom bar */ - -/* tagging */ -static const char *tags[] = { "shell", "code", "web", "misc" }; - -static const Rule rules[] = { - /* class instance title tags mask isfloating monitor */ - { "Firefox", NULL, NULL, 1 << 2, False, -1 }, - { "URxvt", NULL, NULL, 1 << 0, False, -1 }, - { "Emacs", "emacs", NULL, 1 << 1, False, -1 }, - { "KeePass2", NULL, NULL, 1 << 3, False, -1 }, - { "deadbeef", NULL, NULL, 1 << 3, False, -1 }, - { "Emacs", "Ediff", NULL, 0, True, -1 }, -}; - -/* layout(s) */ -static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ -static const int nmaster = 1; /* number of clients in master area */ -static const Bool resizehints = True; /* True means respect size hints in tiled resizals */ - -static const Layout layouts[] = { - /* symbol arrange function */ - { "[]=", tile }, /* first entry is default */ - { "><>", NULL }, /* no layout function means floating behavior */ - { "[M]", monocle }, -}; - -/* key definitions */ -#define MODKEY Mod4Mask -#define TAGKEYS(KEY,TAG) \ - { MODKEY, KEY, toggleview, {.ui = 1 << TAG} }, \ - { MODKEY|ControlMask, KEY, view, {.ui = 1 << TAG} }, \ - { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ - { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, - -/* helper for spawning shell commands in the pre dwm-5.0 fashion */ -#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } - -/* commands */ -static const char *termcmd[] = { "urxvt", NULL }; - -static Key keys[] = { - /* modifier key function argument */ - { MODKEY|ShiftMask, XK_b, togglebar, {0} }, - { MODKEY, XK_e, focusstack, {.i = +1 } }, - { MODKEY, XK_i, focusstack, {.i = -1 } }, - { MODKEY, XK_s, incnmaster, {.i = +1 } }, - { MODKEY, XK_r, incnmaster, {.i = -1 } }, - { MODKEY, XK_n, setmfact, {.f = -0.05} }, - { MODKEY, XK_o, setmfact, {.f = +0.05} }, - { MODKEY, XK_Return, zoom, {0} }, - { MODKEY, XK_Tab, view, {0} }, - { MODKEY|ShiftMask, XK_c, killclient, {0} }, - { MODKEY, XK_g, setlayout, {.v = &layouts[0]} }, - { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, - { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, - { MODKEY, XK_space, setlayout, {0} }, - { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, - { MODKEY, XK_0, view, {.ui = ~0 } }, - { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, - { MODKEY, XK_comma, focusmon, {.i = -1 } }, - { MODKEY, XK_period, focusmon, {.i = +1 } }, - { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, - { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, - TAGKEYS( XK_1, 0) - TAGKEYS( XK_2, 1) - TAGKEYS( XK_3, 2) - TAGKEYS( XK_4, 3) - TAGKEYS( XK_5, 4) - TAGKEYS( XK_6, 5) - TAGKEYS( XK_7, 6) - TAGKEYS( XK_8, 7) - TAGKEYS( XK_9, 8) - { MODKEY|ShiftMask, XK_q, quit, {0} }, - { MODKEY|ShiftMask, XK_r, quit, { .i = 5 } }, -}; - -/* button definitions */ -/* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ -static Button buttons[] = { - /* click event mask button function argument */ - { ClkLtSymbol, 0, Button1, setlayout, {0} }, - { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, - { ClkWinTitle, 0, Button2, zoom, {0} }, - { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, - { ClkClientWin, MODKEY, Button1, movemouse, {0} }, - { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, - { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, - { ClkTagBar, 0, Button1, toggleview, {0} }, - { ClkTagBar, 0, Button3, view, {0} }, - { ClkTagBar, MODKEY, Button1, tag, {0} }, - { ClkTagBar, MODKEY, Button3, toggletag, {0} }, -}; diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org deleted file mode 100644 index 151efbf4..00000000 --- a/tag-emacs/emacs.d/init.org +++ /dev/null @@ -1,2522 +0,0 @@ -#+TITLE: Emacs Configuration for Alan Pearce -#+OPTIONS: ^:nil -#+PROPERTY: results silent -#+PROPERTY: eval no-export -#+PROPERTY: header-args :comments link -* Introduction -This is a living document, detailing my Emacs configuration using org-mode -* Basics -** Startup -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-screen t) -(setq gc-cons-threshold 100000000) -(defvar file-name-handler-alist-backup file-name-handler-alist) -(setq file-name-handler-alist nil) -(remove-hook 'find-file-hooks #'vc-refresh-state) -#+END_SRC - -** Scratch buffers -I usually use scratch buffers for any sort of text. If I need a -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) -#+END_SRC - -** Personal Information -#+BEGIN_SRC emacs-lisp -(setq user-mail-address "alan@alanpearce.co.uk" - user-full-name "Alan Pearce") -#+end_src - -* Packaging - -** Use-package - -#+BEGIN_SRC emacs-lisp -(eval-and-compile - (setq tls-checktrust t - gnutls-verify-error t - package-archives '(("gnu" . "https://elpa.gnu.org/packages/") - ("melpa-stable" . "https://stable.melpa.org/packages/") - ("melpa" . "https://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)) -(setq use-package-verbose t - use-package-always-ensure t - package-enable-at-startup nil) -#+END_SRC - -* Customize -I don’t really like using customize for normal configuration. -Instead, I use it for things that get saved automatically. That’s why -I use a different file, which is ignored by the VCS. It also means -that it’s not important whether the file exists or not, which is why I -pass =:noerror= to =load= - -#+BEGIN_SRC emacs-lisp -(setq custom-file "~/.emacs.d/custom.el") -(load custom-file :noerror :nomessage) -#+END_SRC - -* Styles - -I prefer an always-visible cursor. Feels less distracting. -#+BEGIN_SRC emacs-lisp -(when (fboundp #'blink-cursor-mode) - (blink-cursor-mode -1)) -#+END_SRC - -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)) -(with-eval-after-load 'scroll-bar - (set-scroll-bar-mode nil)) -(with-eval-after-load 'tooltip - (tooltip-mode -1)) -(with-eval-after-load 'tool-bar - (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)))) -#+END_SRC - -#+BEGIN_SRC emacs-lisp -(use-package dash) -#+END_SRC - -** Colours - -Let’s try a more minimal theme. - -#+BEGIN_SRC emacs-lisp -(use-package minimal-theme - :disabled t - :config (progn - (load-theme 'minimal-light t))) -#+END_SRC - -Let’s try a basic theme. - -#+BEGIN_SRC emacs-lisp -(use-package basic-theme - :if (display-graphic-p) - :config (progn - (load-theme 'basic t) - - (set-face-background 'mode-line "#a1b56c") - (set-face-background 'border "#a1b56c") - (set-face-foreground 'border "#a1b56c") - (set-face-background 'vertical-border "#a1b56c") - (set-face-foreground 'vertical-border "#a1b56c") - (set-face-background 'window-divider "#a1b56c") - (set-face-foreground 'window-divider "#a1b56c") - - (defvar mode-line-default-format mode-line-format) - (defvar mode-line-default-hidden nil - "Whether to hide the mode line by default") - - (defun show-mode-line () - (interactive) - (setq mode-line-format mode-line-default-format) - (when (called-interactively-p 'interactive) - (setq-default mode-line-format mode-line-default-format) - (setq mode-line-default-hidden nil))) - (defun hide-mode-line () - (interactive) - (setq mode-line-format nil) - (when (called-interactively-p 'interactive) - (setq-default mode-line-format nil) - (setq mode-line-default-hidden t))) - - (setq-default cursor-type '(bar . 1)) - (setq-default cursor-in-non-selected-windows nil) - - (defun hide-clutter () - (interactive) - (fringe-mode '(0 . 4)) - (hide-mode-line)) - - (defun show-clutter () - (interactive) - (fringe-mode '(8 . 4)) - (show-mode-line)) - (hide-clutter) - - (when mode-line-default-hidden - (call-interactively #'hide-mode-line)) - - (defun hide-mode-line-if-default-hidden () - (if mode-line-default-hidden - (hide-mode-line) - (show-mode-line))) - - (add-to-list 'default-frame-alist '(border-width . 0)) - (add-to-list 'default-frame-alist '(internal-border-width . 0)) - (when (eq window-system 'x) - (setq window-divider-default-bottom-width 1 - window-divider-default-right-width 1 - window-divider-default-places t) - (setq mode-line-default-hidden t) - (window-divider-mode +1)) - - (add-hook 'after-change-major-mode-hook #'hide-mode-line-if-default-hidden) - - (add-hook 'minibuffer-setup-hook #'show-mode-line) - (add-hook 'minibuffer-exit-hook #'hide-mode-line))) -#+END_SRC - -Highlighting quasi-quoted expressions in lisps is quite useful, but I -don't need it all the time. I'll keep it around for a while so that I -can enable it if needed. -#+BEGIN_SRC emacs-lisp -(use-package highlight-stages - :diminish highlight-stages-mode) -#+END_SRC - -** Fonts - -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 antialias) - (if (boundp 'ns-antialias-text) - (setq ns-antialias-text antialias)) - (when mono-face - (let ((default-font (font-spec :family mono-face :size mono-font-size))) - (add-to-list 'default-frame-alist `(font . ,(format "%s %s" mono-face mono-font-size))) - (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 t)) - ((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 "Roboto Mono" 13 "Lucida Grande" 13 t) - (ap/set-fonts "Monaco" 10 "Lucida Grande" 12 nil)))) - ((eq window-system 'x) - (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 8)) - (ap/set-fonts "Fixed" 8 "Lucida" 8 nil)))) - - (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))) -#+END_SRC - -** Page Breaks - -By default, Emacs displays page breaks as ^L. Lines look much nicer. -On Windows, Emacs incorrectly detects that U+2500 (Box Drawings Light -Horizontal) can only be displayed with a different font, which is not -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))))) -#+END_SRC -** Modeline - -#+BEGIN_SRC emacs-lisp -(column-number-mode t) -(size-indication-mode t) - -(setq frame-title-format '("%f" (dired-directory dired-directory))) -#+END_SRC - -** Highlight Changes - -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))) -#+END_SRC - -** Beacon - -I was against the idea of having flashy animations inside Emacs, but -this one is useful. It highlights the cursor when scrolling or -switching windows. - -#+BEGIN_SRC emacs-lisp -(use-package beacon - :diminish beacon-mode - :config (beacon-mode +1)) -#+END_SRC - -** Renaming major modes - -Diminishing major modes does not happen in the same manner as minor -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))) -#+END_SRC - - -* Environment Variables - -MacOS doesn’t have a reasonable way to set environment variables and -read them automatically any more. So, let’s use the -[[https://github.com/purcell/exec-path-from-shell][exec-path-from-shell]] package to set up ~exec-path~ and similar -variables from whatever my shell configuration is. - -#+BEGIN_SRC emacs-lisp -(use-package exec-path-from-shell - :if (eq system-type 'darwin) - :config (exec-path-from-shell-initialize)) -#+END_SRC - -* Keybindings - -I think =set-keyboard-coding-system= stops OS X from doing something -annoying to add accents. The modifier setup is to match my -re-arrangement of modifiers on OSX: Cmd on the outside, then -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")) -#+END_SRC - -#+BEGIN_SRC emacs-lisp -(unbind-key "") -(bind-key* "" #'compile) -(bind-key* "" #'kmacro-start-macro-or-insert-counter) -(bind-key* "" #'kmacro-end-or-call-macro) - -(bind-key* "" #'execute-extended-command) - -(unbind-key "C-z") -(bind-key* "C-" #'other-window) - -(bind-key* "C-x C-r" #'revert-buffer) -(bind-key* "C-x C-j" #'delete-indentation) -(unbind-key "C-x C-c") - -(bind-key* "C-c i" #'insert-char) -(bind-key* "M-/" #'hippie-expand) - -(unbind-key "s-h") -(unbind-key "s-n") -(unbind-key "s-p") -(unbind-key "s-w") -(bind-key* "s-k" #'kill-or-delete-this-buffer-dwim) - -(bind-key "C-M-a" #'backward-paragraph text-mode-map) -(bind-key "C-M-e" #'forward-paragraph text-mode-map) - -(bind-key* "s-x" (define-prefix-command 'super-x-map)) -(bind-key* "s-," #'switch-to-dotfiles) -(bind-key* "C-M-x" #'execute-extended-command) -(set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) -#+END_SRC - -** Crux - -I can replace most of the simple helper/wrapper functions in my -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))) -#+END_SRC - -* Projects - -#+BEGIN_SRC emacs-lisp -(defvar work-project-directory "~/work") -(defvar home-project-directory "~/projects") -#+END_SRC - -#+BEGIN_SRC emacs-lisp -(defun switch-to-dotfiles () - (interactive) - (projectile-switch-project-by-name (expand-file-name "dotfiles" home-project-directory))) -#+END_SRC - -** The Silver Searcher - -#+BEGIN_SRC emacs-lisp -(use-package ag - :defer 30 - :config (setq ag-project-root-function #'projectile-project-root)) - -(use-package wgrep-ag - :after ag) -#+END_SRC - -** Ripgrep - -Step over Silver Search, here comes a new challenger. - -#+BEGIN_SRC emacs-lisp -(use-package ripgrep - :if (executable-find "rg")) - -(use-package projectile-ripgrep - :after (ripgrep projectile) - :if (executable-find "rg") - :bind (("C-c p s r" . projectile-ripgrep))) -#+END_SRC - -** Projectile - -Projectile is awesome for working in projects, especially VCS-backed -ones. I added a couple of functions to allow me to open new projects -based upon some folder conventions I use. - -#+BEGIN_SRC emacs-lisp -(use-package projectile - :bind (("s-p" . projectile-switch-project) - ("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 yarn-install (&optional arg) - (interactive "P") - (projectile-with-default-dir (projectile-project-root) - (cmd-to-echo "yarn" "install"))) - - (defun yarn-add-dev (package) - (interactive "spackage: ") - (projectile-with-default-dir (projectile-project-root) - (cmd-to-echo "yarn" (concat "add --dev " package)))) - - (defun yarn-add (package) - (interactive "spackage: ") - (projectile-with-default-dir (projectile-project-root) - (cmd-to-echo "yarn" (concat "add " package)))) - - (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-commander - projectile-completion-system 'ivy))) -#+END_SRC - -** vc - -This is nice for some things that magit doesn’t do, and for those rare -occasions that I’m working with something other than git. - -#+BEGIN_SRC emacs-lisp -(use-package vc - :defer t - :bind (("C-x v C" . vc-resolve-conflicts)) - :config (progn - (setq vc-follow-symlinks t) - (setq vc-ignore-dir-regexp (format "\\(%s\\)\\|\\(%s\\)" - vc-ignore-dir-regexp - tramp-file-name-regexp)))) -#+END_SRC - -** git-gutter-fringe - -It’s nice to be able to see at a glance which lines of a file have -changed. This package colours the fringe. I have it set to the right -fringe so it doesn’t interfere with flycheck. - -#+BEGIN_SRC emacs-lisp -(use-package git-gutter-fringe - :defer 2 - :diminish git-gutter-mode - :config (progn - (global-git-gutter-mode 1) - (set-face-foreground 'git-gutter:modified "grey") - (setq git-gutter-fr:side 'right-fringe))) -#+END_SRC - -** magit - -Magit is my favourite way to use git. I use selective staging all the -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-completing-read-function #'ivy-completing-read - magit-popup-use-prefix-argument 'default - magit-display-buffer-function #'magit-display-buffer-fullcolumn-most-v1 - 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 - -This package allow me to go through a file’s history with just a few -keys. It makes it very easy to figure what what exactly was in a file -in the past. I often find it useful when I remember writing something -a particular way, but it changed later. - -#+BEGIN_SRC emacs-lisp -(use-package git-timemachine - :commands git-timemachine) -#+END_SRC - -* Files - -** Auto-saving - -Auto-save everything to a temporary directory, instead of cluttering -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) -#+END_SRC -** Backups - -I like to keep my backups out of regular folders. I tell emacs to use -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)) -(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)))) -#+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))))) -#+END_SRC - -** Encoding - -UTF-8 is usually appropriate. Note that =prefer-coding-system= expects -only a coding system, not a coding system and line ending combination. - -#+BEGIN_SRC emacs-lisp -(prefer-coding-system 'utf-8) -(setq-default buffer-file-coding-system 'utf-8-auto-unix) -#+END_SRC - -** Buffer-file management - -Ask if I want to create a directory when it doesn’t exist. This is -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)))) -(add-to-list 'find-file-not-found-functions #'my-create-non-existent-directory) -#+END_SRC - -I often want to rename or delete the file that I’m currently visiting -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))))) -#+END_SRC - -** Whitespace Butler - -I don’t like it when editors change an entire file’s layout when I -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 (daemonp) - (add-hook 'before-make-frame-hook (lambda () - (use-package ws-butler - :config (ws-butler-global-mode 1))))) -#+END_SRC - -** shrink-whitespace - -DWIM whitespace removal. So I don’t need =M-SPC=, =M-\= and =C-x o= -for similar things any more. - -#+BEGIN_SRC emacs-lisp -(use-package shrink-whitespace - :bind ("M-SPC" . shrink-whitespace)) -#+END_SRC - -** Tramp - -Tramp is awesome. It makes SSH feel Unix-y. The proxy setup is so -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" (format "/run/user/%s/ssh-agent" (user-uid)))) - (setq tramp-default-method "ssh" - tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root")) - tramp-backup-directory-alist backup-directory-alist - tramp-completion-reread-directory-timeout 60 - tramp-ssh-controlmaster-options nil - 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)))) - -(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"))) -#+END_SRC - -** ediff - -I like a horizonal diff setup, with everything in one frame. - -#+BEGIN_SRC emacs-lisp -(use-package ediff - :defer t - :config (progn - (setq ediff-split-window-function 'split-window-horizontally - ediff-window-setup-function 'ediff-setup-windows-plain))) -#+END_SRC - -* Indentation - -Ah, a complicated topic. One day we’ll all be using elastic -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 2 - indent-tabs-mode nil) -#+END_SRC - - -** smart-tabs-mode - -Not related to [[smart-tab][=smart-tab=]], this mode indents with tabs and aligns -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))))) -#+END_SRC - -** editorconfig - -#+BEGIN_SRC emacs-lisp -(use-package editorconfig - :config (editorconfig-mode 1)) -#+END_SRC - -** dtrt-indent-mode - -Sometimes people use different indentation settings. [[https://github.com/jscheid/dtrt-indent][dtrt-indent]] -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))))) -#+END_SRC - -* Security - -** password-store - -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))) -#+END_SRC -* Buffers - -** Ibuffer -Ibuffer is quite nice for listing all buffers. - -#+BEGIN_SRC emacs-lisp -(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))))) -#+END_SRC - -** Relative Buffer names - -#+BEGIN_SRC emacs-lisp -(use-package relative-buffers - :defer 15 - :config (progn - (global-relative-buffers-mode))) -#+END_SRC -** Narrowing - -Enable it without prompting - -#+BEGIN_SRC emacs-lisp -(put 'narrow-to-defun 'disabled nil) -(put 'narrow-to-page 'disabled nil) -(put 'narrow-to-region 'disabled nil) -#+END_SRC - -** ace-window - -I don’t often have many windows open at once, but when I do, -=ace-window= is really nice to jump around them in the same way that -=ace-jump= or =avy= work. -#+BEGIN_SRC emacs-lisp -(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)))) -#+END_SRC - -* Windows - -Scrolling is tricky. I use this setup to help me keep track of the -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 160 - frame-resize-pixelwise nil) -(if (boundp 'ns-pop-up-frames) - (setq ns-pop-up-frames nil)) -#+END_SRC - -** winner - -Undo, for window-based commands. - -#+BEGIN_SRC emacs-lisp -(use-package winner - :config (setq winner-boring-buffers '("*Completions*" "*Help*" "*Apropos*" "*Buffer List*" "*info*" "*Compile-Log*")) - :init (progn - (winner-mode 1))) -#+END_SRC - -** windmove - -Directional window movement - -#+BEGIN_SRC emacs-lisp -(use-package windmove - :bind (("S-" . windmove-left) - ("S-" . windmove-right) - ("S-" . windmove-up) - ("S-" . windmove-down))) -#+END_SRC -* Completion - -Make built-in completion a bit more intelligent, by adding substring -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) -#+END_SRC - -** Company - -The main choices for automatic completion in Emacs are company and -auto-complete-mode. I’ve not tried auto-complete-mode as company -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-gtags - company-etags company-keywords) company-oddmuse) - company-frontends '(company-pseudo-tooltip-unless-just-one-frontend - company-preview-frontend - company-echo-metadata-frontend) - 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))) -#+END_SRC - -#+BEGIN_SRC emacs-lisp -(use-package company-web - :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))) -#+END_SRC - -* Dates & Times - -** Calendar - -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))) -#+END_SRC - -Sometimes I want to insert a date or time into a buffer. -#+BEGIN_SRC emacs-lisp -(defun insert-date (prefix) - "Insert the current date. With prefix-argument, use British format. With - 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)))) - -(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)))) -#+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)) -#+END_SRC - -* Directories - -Dired works quite nicely, but not always in the way I want. I don’t -like having so many prompts for recursive operations. Also, when I -have two dired windows open, assume that I’m going to be -copying/moving files between them. - -#+BEGIN_SRC emacs-lisp -(use-package dired - :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") - (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)) - -(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 - dired-bind-jump nil)) - :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))) -#+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)))) -#+END_SRC - -** Dired-narrow -One can already use dired with wildcards to browse a filtered -directory listing, but it opens a new buffer. Dired-narrow is a -slightly nicer interface: with a currently-open dired buffer, use =/= -to start filtering, =RET= to complete the filter and =g= to refresh -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)))) -#+END_SRC - -* Documentation - -** ehelp - -ehelp is a less well-known package that’s part of Emacs and slightly -improves the normal help commands, mostly by making quitting them easier. - -#+BEGIN_SRC emacs-lisp -(use-package ehelp - :bind-keymap ("C-h" . ehelp-map)) -#+END_SRC -** counsel-dash - -Emacs’ documentation is great to read from inside Emacs. Counsel-dash -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))))) - -(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")))) -#+END_SRC - -** discover-my-major - -A nicer way to browse keybindings for major modes. - -#+BEGIN_SRC emacs-lisp -(use-package discover-my-major - :bind ("" . discover-my-major)) -#+END_SRC - -** which-key - -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))) -#+END_SRC - -** eldoc - -Documentation in the echo-area (where the minibuffer is displayed) is -rather useful. - -#+BEGIN_SRC emacs-lisp -(use-package eldoc - :commands (eldoc-mode) - :diminish eldoc-mode - :config (progn - (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.") -(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 " - " nil t) - (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)))) - -(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))) - -(defun process-exit-code (program &rest args) - "Run PROGRAM with ARGS and return the exit code" - (apply 'call-process program nil nil nil args)) - -(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))) - -(bind-key* "M-!" #'shell-execute) -(bind-key* "C-x r M-w" #'copy-rectangle) -#+END_SRC - -** Auxillary Configuration - -#+BEGIN_SRC emacs-lisp -(require 'pinentry) - -(defvar have-private-key - (file-exists-p (expand-file-name "secring.gpg" "~/.gnupg/"))) - -(defvar gpg-agent-ssh-sock - (or (getenv "GPG_AGENT_INFO") - (concat "/run/user/" (number-to-string (user-uid)) "/gnupg/S.gpg-agent.ssh"))) - -(defun read-gpg-file (file) - (let ((file-to-decrypt (expand-file-name file user-emacs-directory)) - (ctx (epg-make-context epa-protocol))) - (if (file-exists-p file-to-decrypt) - (epg-decrypt-file ctx file-to-decrypt nil) - (message "Decrypting %s...failed" file-to-decrypt) - (error "File %s does not exist" file-to-decrypt)))) - -(defun load-gpg (file) - (if have-private-key - (load file) - (message "WARNING: Couldn't load %s (No gpg key found)" file))) - -; load this in a post-frame hook because gpg-agent asks for a password on first -; startup and caches it. Don't want emacs daemon to hang because of gpg-agent. -(defun load-private-data () - (interactive) - (if (not have-private-key) - (message "ERROR: Private GPG key not found") - (unless (or (getenv "GPG_AGENT_INFO") - (getenv "SSH_AUTH_SOCK")) - (start-process "gpg-agent" nil "gpg-agent" "--daemon") - (setenv "SSH_AUTH_SOCK" gpg-agent-ssh-sock)) - (setq password-cache-expiry nil) - (unless (file-exists-p (concat pinentry--socket-dir "pinentry")) - (pinentry-start) - (add-hook 'kill-emacs-hook 'pinentry-stop)) - (add-to-list 'load-suffixes ".el.gpg") - (load-gpg (expand-file-name "private" user-emacs-directory)))) - -(defun first-frame-hook (frame) - (remove-hook 'after-make-frame-functions #'first-frame-hook) - (run-at-time nil nil 'load-private-data)) - -(if (eq 1 (length (frame-list))) - (add-hook 'after-init-hook #'load-private-data) - (add-hook 'after-make-frame-functions #'first-frame-hook)) -#+END_SRC - -* Minibuffer - -Sometimes I want to use the minibuffer, but I’m already inside it. -Fortunately, this is possible. Of course, I need to know how many -minibuffers there are on the stack. - -#+BEGIN_SRC emacs-lisp -(setq enable-recursive-minibuffers t) -(minibuffer-depth-indicate-mode t) -#+END_SRC - -This avoids some issue with the minibuffer and the point being behind -the prompt. I don’t remember what exactly. -#+BEGIN_SRC emacs-lisp -(setq minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)) -#+END_SRC - -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)) -#+END_SRC - -** swiper/ivy - -Ivy is the new kid on the completion block. It seems to be a strong -replacement for helm so far. - -#+BEGIN_SRC emacs-lisp -(use-package swiper - :bind (("C-s" . swiper) - ("C-r" . swiper) - ("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 "" #'counsel-M-x) - (bind-key "C-c M-x" #'execute-extended-command) - (bind-key "C-x C-f" #'counsel-find-file) - (bind-key "M-y" #'counsel-yank-pop) - (bind-key "M-y" #'ivy-next-line ivy-minibuffer-map) - (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)))))) -#+END_SRC - - -** smex - -Smex is my favourite way to use =M-x=. Counsel’s =counsel-M-x= -function uses it internally, so I’m keeping it around, even though I -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")))) -#+END_SRC - -** cmd-to-echo - -I’ve been looking for some way to run programming projects (mostly -node.js) inside emacs. =cmd-to-echo= seems great for this, as new -output pops up in the echo area. - -#+BEGIN_SRC emacs-lisp -(use-package cmd-to-echo - :commands (cmd-to-echo) - :config (setq cmd-to-echo-add-output-to-process-buffers t)) -#+END_SRC -* Modes - -Setup some modes for systemd files -#+BEGIN_SRC emacs-lisp -(add-to-list 'auto-mode-alist '("\\.service\\'" . conf-mode)) -(add-to-list 'auto-mode-alist '("\\.target\\'" . conf-mode)) -(add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-mode)) -#+END_SRC - -=direnv=’s files are basically shell scripts, it’s a nice way to -set environment variables for projects. -#+BEGIN_SRC emacs-lisp -(add-to-list 'auto-mode-alist '("\\.envrc\\'" . sh-mode)) -#+END_SRC - -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))) - -(use-package haskell-mode - :mode (("\\.hs\\'" . haskell-mode))) - -(use-package dockerfile-mode - :mode (("Dockerfile\\'" . dockerfile-mode))) - -(use-package nix-mode - :mode (("\\.nix\\'" . nix-mode))) - -(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))) - -(use-package lua-mode - :defer t) - -(use-package ruby-mode - :mode (("\\.rb\\'" . ruby-mode) - ("\\.cap\\'" . ruby-mode))) - -(use-package go-mode - :mode (("\\.go\\'" . go-mode))) - -(use-package jinja2-mode - :mode (("\\.j2\\'" . jinja2-mode) - ("\\.jinja\\'" . jinja2-mode))) - -(use-package scss-mode - :defer t - :config (progn - (setq scss-compile-at-save nil))) - -(use-package 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)) - -(define-derived-mode saltstack-mode yaml-mode "Salt") -(add-to-list 'auto-mode-alist '("\\.sls\\'" . saltstack-mode)) -#+END_SRC - -** ledger - -I use [[http://ledger-cli.org/][=ledger=]] to manage my finances. It has an Emacs mode, which -works really nicely. - -#+BEGIN_SRC emacs-lisp -(use-package ledger-mode - :mode ("\\.ledger\\'" . ledger-mode) - :init (progn - (defun open-budget () - (interactive) - (projectile-switch-project-by-name "~/Sync/Default") - (find-file (expand-file-name "ledger/my.ledger" (projectile-project-root))) - (ledger-report "Budget (Cumulative)" nil))) - :config (progn - (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 \\^Assets:Budget$") - ("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 - -#+BEGIN_SRC emacs-lisp -(use-package markdown-mode - :defer t - :config (progn - (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) -#+END_SRC - -** Org - -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")) - - org-default-notes-file (concat org-directory "/notes") - - ;; ‘Remember’: new items at top - org-reverse-note-order t - - org-modules '(org-protocol) - - ;; Add time done to ‘done’ tasks - org-log-done 'time - - org-list-allow-alphabetical t - - org-adapt-indentation nil - - org-pretty-entities t - - org-table-duration-custom-format 'seconds - - org-src-fontify-natively nil - - org-export-have-math 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))) -#+END_SRC - -**** org-babel - -Org’s babel feature is really nice. I use it for this file, and I can -use it to communicate between programming languages. Sometime I hope -to have my =ledger= setup in an org file with some graph processing -with R or something. - -#+BEGIN_SRC emacs-lisp -(use-package ob-core - :defer t - :ensure nil - :config (progn - (org-babel-do-load-languages 'org-babel-load-languages - '((ledger . t) - (sh . t))) - (setq org-src-tab-acts-natively t - org-edit-src-content-indentation 0 - org-src-preserve-indentation t))) -#+END_SRC - -**** org-journal - -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))))) -#+END_SRC - -**** org-mobile - -#+BEGIN_SRC emacs-lisp -(defun ap/org-mobile-pull (descriptor action file) - (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)))))) -#+END_SRC - -**** org-caldav - -I’ve setup CalDAV on my server, it would be nice to use it directly -from org-mode. Previously I had to wait for org-mobile to sync and -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))) -#+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. - -#+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 - -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)) - (if (executable-find "eslint_d") - (setq flycheck-javascript-eslint-executable (executable-find "eslint_d"))))) -#+END_SRC - -** golang - -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))) - -(use-package go-eldoc - :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))) - - -#+END_SRC - -** ggtags - -A nice completion backend for programming modes. - -#+BEGIN_SRC emacs-lisp -(use-package ggtags - :disabled t - :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 - -*** All - -Lisp modes don’t seem to have a common ancestor. So I made a custom -hook which I trigger in every lispy-mode. - -#+BEGIN_SRC emacs-lisp -(defcustom lisp-mode-common-hook nil - "Hook run when entering any Lisp mode." - :type 'hook - :group 'lisp) - -(defun ap/lisp-setup () - (run-hooks 'lisp-mode-common-hook)) -#+END_SRC - -**** Redshank - -Lisp syntax allows for really easy refactoring. Redshank gives some -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))) -#+END_SRC - -*** Emacs Lisp - -Customise the modeline-display of =emacs-lisp-mode=. Then make sure -it runs the common lisp hooks. - -#+BEGIN_SRC emacs-lisp -(add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup) -(add-hook 'emacs-lisp-mode-hook #'eldoc-mode) -#+END_SRC - -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))) -#+END_SRC - -Interactive elisp - -#+BEGIN_SRC emacs-lisp -(use-package ielm - :defer t - :ensure nil - :config (progn - (add-hook 'ielm-mode-hook (lambda () - (run-hooks 'lisp-mode-common-hook))))) -#+END_SRC - -*** Scheme & Lisp - -I don’t work with these as often as I would like - -#+BEGIN_SRC emacs-lisp -(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)) -(add-hook 'lisp-mode-hook #'set-common-lisp-indentation) -#+END_SRC - -**** geiser - -A REPL thing for Scheme. Hopefully I’ll get to use it more in the -future. - -#+BEGIN_SRC emacs-lisp -(use-package geiser - :commands (geiser-mode - geiser - run-geiser - run-racket)) -#+END_SRC - -**** slime - -A REPL thing (and more) for Lisp. - -#+BEGIN_SRC emacs-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")))) -#+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))) - -(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))) -#+END_SRC - -**** cider - -A REPL thing for Clojure - -#+BEGIN_SRC emacs-lisp -(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))) -#+END_SRC - -** Auto-compile - -Auto-compile emacs lisp when saving. -#+BEGIN_SRC emacs-lisp -(use-package auto-compile - :defer t - :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) -#+END_SRC - -** cc-mode - -Although I don’t use C or C++, setting up the mode is helpful because -quite a few other modes are derived from it. - -#+BEGIN_SRC emacs-lisp -(use-package cc-mode - :defer 5 - :init (progn - (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 '+))) -#+END_SRC - -** quickrun - -It’s nice to be able to quickly evaluate some code. Although I don’t -really seem to use it. -#+BEGIN_SRC emacs-lisp -(use-package quickrun - :bind (("C-c C-e" . quickrun))) -#+END_SRC - -** Scala - -Let’s try using Scala. - -#+BEGIN_SRC emacs-lisp -(use-package scala-mode - :pin melpa-stable) -#+END_SRC - -And add ensime, an IDE-style environment. - -#+BEGIN_SRC emacs-lisp -(use-package ensime - :pin melpa-stable) -#+END_SRC - -** Web development - -*** js2-mode - -This mode is really great for editing Javascript. It turns code into -an AST internally, so it can work with it almost like a lisp. I don’t -think there’s anything as good as paredit/redshank for refactoring in -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) - (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) - (setq js2-basic-offset 2 - js2-include-node-externs t))) -#+END_SRC - -**** jade (not pug) - -Javascript with an inferior node.js process and a debugger? Awesome. - -To debug with node, use version 6.9.1 or later of node and run it with -~--inspect~ and, to break on the first line, ~--debug-brk~. - -For Chrom*, it needs to be launched with ~--remote-debugging-port=9222~ - -#+BEGIN_SRC emacs-lisp -(use-package jade - :config (progn - (add-hook 'js2-mode-hook #'jade-interaction-mode))) -#+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))) -#+END_SRC - -*** tern - -Tern understands javascript. It adds really clever documented -completions, besides other IDE-like things. - -#+BEGIN_SRC emacs-lisp -(use-package tern - :commands ap/enable-tern - :if (executable-find "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)) -#+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))) -#+END_SRC - -*** restclient - -Restclient is really nice. It’s like a scratchpad for HTTP api -calls. Feels a bit like using =org-babel=. I wonder if there’s an -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))) - -(use-package company-restclient - :after (company restclient) - :init (add-to-list 'company-backends #'company-restclient t)) -#+END_SRC - -*** sgml-mode - -This is for HTML, since old versions of HTML were derived from SGML. -#+BEGIN_SRC emacs-lisp -(use-package sgml-mode - :defer t - :config (setq sgml-basic-offset 2)) -#+END_SRC - -*** emmet-mode - -Emmet is really nice to write HTML quickly. Especially with -frameworks that require multiple nested elements to do anything useful. -#+BEGIN_SRC emacs-lisp -(use-package emmet-mode - :commands (emmet-mode) - :diminish (emmet-mode . " >") - :init (progn - (setq emmet-indentation 2) - (add-hook 'web-mode-hook #'emmet-mode))) -#+END_SRC - -*** web-mode - -This mode handles just about every templating language out ther, which -is really nice, because it handles the HTML part the same way in all -of them as well. - -#+BEGIN_SRC emacs-lisp -(use-package web-mode - :mode (("/views/.*\\.php\\'" . web-mode) - ("\\.html\\'" . web-mode) - ("/templates/.*\\.php\\'" . web-mode) - ("\\.ejs\\'" . web-mode)) - :config (progn - (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 - 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=. - -#+BEGIN_SRC emacs-lisp -(define-derived-mode twig-mode web-mode "Twig") -(add-to-list 'auto-mode-alist '("\\.html\\.twig\\'" . twig-mode)) -#+END_SRC - -* Spelling - -#+BEGIN_SRC emacs-lisp -(use-package ispell - :bind (("" . ispell-word)) - :config (progn - (cond - ((executable-find "aspell") (setq ispell-program-name "aspell" - ispell-dictionary "british" - ispell-really-aspell t - ispell-really-hunspell nil)) - ((executable-find "hunspell") (setq ispell-program-name "hunspell" - ispell-really-aspell nil - ispell-really-hunspell t))))) -#+END_SRC - -* Scripting - -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) - -(use-package sh-script - :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)) -#+END_SRC - -#+BEGIN_SRC emacs-lisp -(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) -#+END_SRC - -** eshell - -I should try to get into the habit of using this more. It’s really -nice, when I remember to use it. - -#+BEGIN_SRC emacs-lisp -(use-package eshell - :bind ("C-c s" . eshell) - :config (progn - (setq eshell-directory-name "~/.emacs.d/eshell" - eshell-prompt-function (lambda () - (concat - (eshell/pwd) - "\n$ "))) - (add-hook 'eshell-load-hook (lambda () - (bind-key "C-c C-l" #'counsel-esh-history eshell-mode-map))))) - -(use-package em-smart - :ensure nil - :commands eshell-smart-initialize - :init (progn - (add-hook 'eshell-load-hook #'eshell-smart-initialize)) - :config (progn - (setq eshell-where-to-jump 'begin - eshell-review-quick-commands nil - eshell-smart-space-goes-to-end t))) - -(autoload #'eshell/cd "em-dirs") -(defun eshell-goto-current-dir (&optional arg) - (interactive "P") - (let ((dir default-directory)) - (eshell arg) - (eshell/cd dir))) -(bind-key "C-c S" #'eshell-goto-current-dir) - - -#+END_SRC - -*** Shells - -#+BEGIN_SRC emacs-lisp -(use-package shell - :defer t - :ensure nil - :config (define-key shell-mode-map - (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) - -(use-package comint - :defer t - :ensure nil - :config (bind-key "C-c C-l" #'counsel-shell-history comint-mode-map)) - -(defun comint-delchar-or-eof-or-kill-buffer (arg) - (interactive "p") - (if (null (get-buffer-process (current-buffer))) - (kill-buffer) - (comint-delchar-or-maybe-eof arg))) -#+END_SRC - -* Text editing - -Emacs has an editor within. - -#+BEGIN_SRC emacs-lisp -(put 'upcase-region 'disabled nil) -(put 'downcase-region 'disabled nil) -(setq sentence-end-double-space t - line-move-visual nil) -#+END_SRC - -** align - -=Align= is a useful command to line things up, once given some rules. -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)))))) -#+END_SRC - -** Clipboard - -I like to use the clipboard more than the primary selection in X11. - -#+BEGIN_SRC emacs-lisp -(setq x-select-enable-clipboard t - save-interprogram-paste-before-kill t) -(if (functionp '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 - -*** Copy formatted code - -#+BEGIN_SRC emacs-lisp -(bind-key* "C-c w" (define-prefix-command 'copy-as-map)) -(use-package copy-as-format - :bind (("C-c C-w" . copy-as-format) - :map copy-as-map - ("b" . copy-as-format-bitbucket) - ("g" . copy-as-format-github) - ("h" . copy-as-format-hipchat) - ("w" . copy-as-format-html) - ("j" . copy-as-format-jira) - ("m" . copy-as-format-markdown) - ("s" . copy-as-format-slack))) -#+END_SRC - -** - -** Selection - -I’m quite used to deleting text by selecting it and typing. Emacs has -a mode for that. - -#+BEGIN_SRC emacs-lisp -(delete-selection-mode t) -#+END_SRC - -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)) -#+END_SRC - -I find that =zap-up-to-char= normally makes more sense to me than -=zap-to-char=. - -#+BEGIN_SRC emacs-lisp -(use-package misc - :ensure nil - :bind (("M-z" . zap-up-to-char) - ("M-Z" . zap-to-char))) -#+END_SRC - -Expanding the region by semantic units was something I quite liked -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)) -#+END_SRC - -** avy - -Avy is a really nice way to move around files, like ace-jump-mode, but -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) - ("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 ?\;)))) -#+END_SRC - -*** ace-link - -Visit any link. Despite the name, this works with avy. - -#+BEGIN_SRC emacs-lisp -(use-package ace-link - :after avy - :config (progn - (ace-link-setup-default) - (with-eval-after-load "gnus" - (bind-key "M-o" #'ace-link-gnus gnus-summary-mode-map) - (bind-key "M-o" #'ace-link-gnus gnus-article-mode-map)))) -#+END_SRC - -** goto-chg - -This is like popping the mark, only it filters to only change areas -and doesn’t go back to the same place more than once. - -#+BEGIN_SRC emacs-lisp -(use-package goto-chg - :bind ("C-c C-SPC" . goto-last-change)) -#+END_SRC - -** multiple-cursors - -I mentioned before that I’d used Sublime Text before. Multiple -cursors was one of my favourite features, so I was really happy when I -saw that multiple-cursors was released for Emacs. - -#+BEGIN_SRC emacs-lisp -(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-" #'mc/mark-all-like-this-dwim) - (bind-key "C-" #'mc/mark-more-like-this-extended) - (bind-key "C-S-L" #'mc/edit-lines))) -#+END_SRC - -** paredit - -Balanced parentheses in lisps are nice, but all the refactoring and -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))) -#+END_SRC - -** smartparens - -I like to use smartparens where paredit isn’t already useful. Somehow -I didn’t find smartparens’ implementation of paredit style to be as -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-" #'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-" #'sp-splice-sexp-killing-backward smartparens-mode-map) - (bind-key "M-" #'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-" #'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 - -** smart-scan - -Move between instances of a symbol - -#+BEGIN_SRC emacs-lisp -(use-package smartscan - :config (progn - (smartscan-mode 1))) -#+END_SRC - -** move-text - -Transposing lines, made easier. - -#+BEGIN_SRC emacs-lisp -(use-package move-text - :config (move-text-default-bindings)) -#+END_SRC - -** undo-tree - -Emacs’ default handling of undo is a bit confusing. Undo-tree makes -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))) - :diminish undo-tree-mode) -#+END_SRC - -** replace - -#+BEGIN_SRC emacs-lisp -(use-package replace - :defer t - :config (progn - (setq case-replace nil))) -#+END_SRC - -** visual-regexp - -I don’t always remember exactly how Emacs’ regular expressions work, -so this package is pretty useful because it highlights everything in -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))) -#+END_SRC -* Tangling - -Taken from [[https://github.com/larstvei/dot-emacs/blob/master/init.org][larstvei/dot-emacs]]. I changed it so that it would work with -my current dotfiles repository structure and work asynchronously, -thanks to [[https://github.com/jwiegley/emacs-async][jwiegley/emacs-async]]. - -We can use =C-c C-v t= to run =org-babel-tangle=, which extracts the -code blocks from the current file into a source-specific file (in this -case a =.el=-file). - -To avoid doing this each time a change is made we can add a function -to the =after-save-hook= ensuring to always tangle and byte-compile -the =org=-document after changes. - -#+BEGIN_SRC emacs-lisp -(use-package async - :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." - - (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))))) - -(defun tangle-init () - "Tangle init.org asynchronously." - - (interactive) - (message "Tangling init") - (async-start - (symbol-function #'tangle-init-sync) - (lambda (result) - (message "Init tangling completed: %s" result)))) -#+END_SRC - -# Local Variables: -# eval: (when (fboundp #'tangle-if-init) (add-hook 'after-save-hook #'tangle-if-init)) -# End: -* End - -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))))) -(setq gc-cons-threshold 800000 - file-name-handler-alist file-name-handler-alist-backup) -#+END_SRC diff --git a/tag-fish/config/fish/config.fish b/tag-fish/config/fish/config.fish deleted file mode 100755 index 34cd22ec..00000000 --- a/tag-fish/config/fish/config.fish +++ /dev/null @@ -1,2 +0,0 @@ -set PATH $PATH /home/alan/bin -setenv SSH_AUTH_SOCK $XDG_RUNTIME_DIR/ssh-agent.socket diff --git a/tag-git/config/git/config b/tag-git/config/git/config deleted file mode 100644 index 6228a08b..00000000 --- a/tag-git/config/git/config +++ /dev/null @@ -1,34 +0,0 @@ -[user] - email = alan@alanpearce.uk - name = Alan Pearce -[color] - branch = auto - diff = auto - status = auto - ui = true -[push] - default = current -[alias] - up = merge FETCH_HEAD - st = status -sb - ci = commit - br = branch - co = checkout - ready = rebase -i @{u} - lg = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' - standup = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --since yesterday --author Alan - ignored = ls-files --others -i --exclude-standard - pr = pull-request - delete-merged = "!sh -c 'git branch --merged | grep -v "\\*" | grep -v master | grep -v dev | xargs -n 1 git branch -d'" -[github] - user = alan@alanpearce.uk -[diff] - algorithm = patience -[include] - path = config.local -[core] - excludesfile = ~/.config/git/ignore -[rebase] - autosquash = true -[rerere] - enabled = true diff --git a/tag-git/config/git/gitk b/tag-git/config/git/gitk deleted file mode 100644 index 0eb9a033..00000000 --- a/tag-git/config/git/gitk +++ /dev/null @@ -1,61 +0,0 @@ -set mainfont {{Lucida Grande} 12} -set textfont {Monaco 12} -set uifont {{Lucida Grande} 12 bold} -set tabstop 4 -set findmergefiles 0 -set maxgraphpct 50 -set maxwidth 16 -set cmitmode patch -set wrapcomment none -set autoselect 1 -set autosellen 40 -set showneartags 1 -set maxrefs 20 -set hideremotes 0 -set showlocalchanges 1 -set datetimeformat {%Y-%m-%d %H:%M:%S} -set limitdiffs 1 -set uicolor grey85 -set want_ttk 1 -set bgcolor white -set fgcolor black -set uifgcolor black -set uifgdisabledcolor #999 -set colors {green red blue magenta darkgrey brown orange} -set diffcolors {red "#00a000" blue} -set mergecolors {red blue green purple brown "#009090" magenta "#808000" "#009000" "#ff0080" cyan "#b07070" "#70b0f0" "#70f0b0" "#f0b070" "#ff70b0"} -set markbgcolor #e0e0ff -set diffcontext 3 -set selectbgcolor gray85 -set foundbgcolor yellow -set currentsearchhitbgcolor orange -set extdifftool opendiff -set perfile_attrs 0 -set headbgcolor green -set headfgcolor black -set headoutlinecolor black -set remotebgcolor #ffddaa -set tagbgcolor yellow -set tagfgcolor black -set tagoutlinecolor black -set reflinecolor black -set filesepbgcolor #aaaaaa -set filesepfgcolor black -set linehoverbgcolor #ffff80 -set linehoverfgcolor black -set linehoveroutlinecolor black -set mainheadcirclecolor yellow -set workingfilescirclecolor red -set indexcirclecolor green -set circlecolors {white blue gray blue blue} -set linkfgcolor blue -set circleoutlinecolor black -set geometry(main) 1477x845+26+50 -set geometry(state) normal -set geometry(topwidth) 1477 -set geometry(topheight) 300 -set geometry(pwsash0) "378 1" -set geometry(pwsash1) "569 1" -set geometry(botwidth) 473 -set geometry(botheight) 675 -set permviews {} diff --git a/tag-git/config/git/ignore b/tag-git/config/git/ignore deleted file mode 100644 index d7189dc5..00000000 --- a/tag-git/config/git/ignore +++ /dev/null @@ -1,29 +0,0 @@ -.DS_Store -.AppleDouble -.LSOverride -Icon -Desktop.ini - -# Thumbnails -._* -Thumbs.db - -# Emacs -*~ -\#*\# -/.emacs.desktop -/.emacs.desktop.lock -.elc -auto-save-list -tramp -.\#* - -# Org-mode -.org-id-locations -*_archive - -GPATH -GRTAGS -GTAGS - -.tern-port \ No newline at end of file diff --git a/tag-global/globalrc b/tag-global/globalrc deleted file mode 100644 index 7fd1a0bb..00000000 --- a/tag-global/globalrc +++ /dev/null @@ -1,6 +0,0 @@ -default:\ - :tc=symfony_global: - -symfony_global:\ - :suffixes=php,yml,yaml,html,twig,xml:\ - :skip=/app/cache,node_modules,bin,/app/logs,GPATH,GTAGS,GRTAGS,GSYMS,HTML/,HTML.pub/,html/,tags,TAGS,ID,y.tab.c,y.tab.h,.notfunction,cscope.out,cscope.po.out,cscope.in.out,.gdbinit,SCCS/,RCS/,CVS/,CVSROOT/,{arch}/,.svn/,.git/,.cvsrc,.cvsignore,.gitignore,.cvspass,.cvswrappers,.deps/,autom4te.cache/,.snprj/: diff --git a/tag-hg/hgrc b/tag-hg/hgrc deleted file mode 100644 index 2f16f27e..00000000 --- a/tag-hg/hgrc +++ /dev/null @@ -1,9 +0,0 @@ -[ui] -username = Alan Pearce - -[extensions] -purge = -progress = -color = -eol = -record = \ No newline at end of file diff --git a/tag-karabiner/config/karabiner/karabiner.json b/tag-karabiner/config/karabiner/karabiner.json deleted file mode 100644 index 0e866a63..00000000 --- a/tag-karabiner/config/karabiner/karabiner.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "profiles": [ - { - "devices": [ - { - "identifiers": { - "is_keyboard": true, - "is_pointing_device": false, - "product_id": 602, - "vendor_id": 1452 - }, - "ignore": true, - "keyboard_type": 41 - }, - { - "identifiers": { - "is_keyboard": true, - "is_pointing_device": false, - "product_id": 8209, - "vendor_id": 1241 - }, - "ignore": false, - "keyboard_type": 40 - } - ], - "fn_function_keys": { - "f1": "vk_consumer_brightness_down", - "f10": "mute", - "f11": "volume_down", - "f12": "volume_up", - "f2": "vk_consumer_brightness_up", - "f3": "vk_mission_control", - "f4": "vk_launchpad", - "f5": "vk_consumer_illumination_down", - "f6": "vk_consumer_illumination_up", - "f7": "vk_consumer_previous", - "f8": "vk_consumer_play", - "f9": "vk_consumer_next" - }, - "name": "Default Profile", - "selected": true, - "simple_modifications": { - "caps_lock": "delete_or_backspace", - "left_command": "left_option", - "left_control": "left_command", - "left_option": "left_control", - "right_command": "right_option", - "right_control": "right_command", - "right_option": "right_control" - } - }, - { - "name": "Macbook keyboard", - "simple_modifications": { - "caps_lock": "delete_or_backspace", - "grave_accent_and_tilde": "non_us_backslash", - "left_command": "left_control", - "non_us_backslash": "grave_accent_and_tilde", - "right_command": "right_control" - } - } - ] -} diff --git a/tag-minttyrc/minttyrc b/tag-minttyrc/minttyrc deleted file mode 100644 index 2e7f2d86..00000000 --- a/tag-minttyrc/minttyrc +++ /dev/null @@ -1,33 +0,0 @@ -BoldAsFont=no -Font=Cousine -FontHeight=12 -FontSmoothing=default -Locale=en_GB -Charset=UTF-8 -Columns=100 -Rows=36 -Scrollbar=none -Transparency=off -OpaqueWhenFocused=no -CursorType=block -CursorBlinks=no -RightClickAction=extend -BoldBlack=0,43,54 -Black=7,54,66 -BoldGreen=88,110,117 -BoldYellow=101,123,131 -BoldBlue=131,148,150 -BoldCyan=147,161,161 -White=238,232,213 -BoldWhite=253,246,227 -Yellow=181,137,0 -BoldRed=203,75,22 -Red=220,50,47 -Magenta=211,54,130 -BoldMagenta=108,113,196 -Blue=38,139,210 -Cyan=42,161,152 -Green=133,153,0 -ForegroundColour=101,123,117 -BackgroundColour=253,246,227 -CursorColour=112,129,131 diff --git a/tag-ssh/ssh/rc b/tag-ssh/ssh/rc deleted file mode 100755 index 59e4cfd1..00000000 --- a/tag-ssh/ssh/rc +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -if [ "$SSH_AUTH_SOCK" ] -then - ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock -fi diff --git a/tag-tmux/tmux.conf b/tag-tmux/tmux.conf deleted file mode 100644 index 697e1238..00000000 --- a/tag-tmux/tmux.conf +++ /dev/null @@ -1,19 +0,0 @@ -#setw -g xterm-keys on -#set -g terminal-overrides "xterm*:kLFT5=\eOD:kRIT5=\eOC:kUP5=\eOA:kDN5=\eOB:smkx@:rmkx@" - -set-window-option -g utf8 on -set-option -g status-utf8 on -set-option -g prefix C-z - -bind C-n send-prefix -unbind-key C-b - -set -g default-terminal "screen-256color" - -# Colemak style -bind-key C-i next-window - -set -g base-index 1 - -set -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_GIT SSH_CONNECTION WINDOWID XAUTHORITY" -set-environment -g 'SSH_AUTH_SOCK' '/home/alan/.ssh/ssh_auth_sock' \ No newline at end of file diff --git a/tag-vagrant/vagrant.d/Vagrantfile b/tag-vagrant/vagrant.d/Vagrantfile deleted file mode 100644 index 4c69c88e..00000000 --- a/tag-vagrant/vagrant.d/Vagrantfile +++ /dev/null @@ -1,7 +0,0 @@ -# -*- mode: ruby -*- -Vagrant.configure(2) do |config| - config.vm.provision "ansible" do |ansible| - ansible.playbook = "#{File.dirname(__FILE__)}/ansible/site.yml" - ansible.limit = "all" - end -end diff --git a/tag-vagrant/vagrant.d/ansible/centos.yml b/tag-vagrant/vagrant.d/ansible/centos.yml deleted file mode 100644 index 1a6759a6..00000000 --- a/tag-vagrant/vagrant.d/ansible/centos.yml +++ /dev/null @@ -1,31 +0,0 @@ -- name: Ensure EPEL repository package is present - register: centos_repos - get_url: - url: "{{ item.url }}" - dest: "/root/{{ item.dest }}" - with_items: - - url: http://lon.mirror.rackspace.com/ius/stable/CentOS/6/x86_64/epel-release-6-5.noarch.rpm - dest: epel-repo.rpm - - url: http://lon.mirror.rackspace.com/ius/stable/CentOS/6/x86_64/ius-release-1.0-11.ius.centos6.noarch.rpm - dest: ius-repo.rpm - -- name: Fetch utilities repo - get_url: - url: http://download.opensuse.org/repositories/utilities/CentOS_6/utilities.repo - dest: /etc/yum.repos.d/utilities.repo - -- name: Ensure IUS and EPEL repositories are installed - when: centos_repos.changed - yum: - name: "{{ item }}" - state: installed - with_items: - - /root/epel-repo.rpm - - /root/ius-repo.rpm - - -- name: Ensure that tools are installed - with_items: packages - yum: - name: "{{ item }}" - state: present diff --git a/tag-vagrant/vagrant.d/ansible/debian.yml b/tag-vagrant/vagrant.d/ansible/debian.yml deleted file mode 100644 index 9e06af69..00000000 --- a/tag-vagrant/vagrant.d/ansible/debian.yml +++ /dev/null @@ -1,15 +0,0 @@ -- get_url: - url: https://thoughtbot.github.io/rcm/debs/rcm_1.2.2-2_all.deb - dest: /tmp/rcm.deb - -- command: dpkg --skip-same-version -i /tmp/rcm.deb - register: dpkg - changed_when: "dpkg.stdout.startswith('Selecting')" - -- name: Ensure that tools are installed - with_items: packages - apt: - pkg: "{{ item }}" - state: present - cache_valid_time: 86400 - update_cache: yes \ No newline at end of file diff --git a/tag-vagrant/vagrant.d/ansible/site.yml b/tag-vagrant/vagrant.d/ansible/site.yml deleted file mode 100644 index 13384550..00000000 --- a/tag-vagrant/vagrant.d/ansible/site.yml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- hosts: all - sudo: yes - vars: - packages: - - zsh - - htop - - lsof - - git - - rcm - tasks: - - include: centos.yml - when: ansible_distribution == "CentOS" - - - include: debian.yml - when: ansible_distribution == "Debian" - - - name: Ensure that dotfiles are checked out - sudo: no - git: - repo: git://github.com/alanpearce/dotfiles - dest: ~/dotfiles - update: yes - - - name: Change shell to zsh - user: - name: vagrant - shell: /bin/zsh - - - name: Install dotfiles - sudo: no - command: /usr/bin/rcup -d dotfiles -t zsh -t git -x README.org -x Brewfile -x LaunchAgents chdir=/home/vagrant \ No newline at end of file diff --git a/tag-xbindkeys/xbindkeysrc.scm b/tag-xbindkeys/xbindkeysrc.scm deleted file mode 100644 index 7b00c38d..00000000 --- a/tag-xbindkeys/xbindkeysrc.scm +++ /dev/null @@ -1,57 +0,0 @@ -;; To specify a key, you can use 'xbindkeys --key' or -;; 'xbindkeys --multikey' and put one of the two lines in this file. - -;; A list of keys is in /usr/include/X11/keysym.h and in -;; /usr/include/X11/keysymdef.h -;; The XK_ is not needed. - -;; List of modifier: -;; Release, Control, Shift, Mod1 (Alt), Mod2 (NumLock), -;; Mod3 (CapsLock), Mod4, Mod5 (Scroll). - - -;; The release modifier is not a standard X modifier, but you can -;; use it if you want to catch release instead of press events - -;; By defaults, xbindkeys does not pay attention to modifiers -;; NumLock, CapsLock and ScrollLock. -;; Uncomment the lines below if you want to use them. -;; To dissable them, call the functions with #f - - -;;;;EXTRA FUNCTIONS: Enable numlock, scrolllock or capslock usage -;;(set-numlock! #t) -;;(set-scrolllock! #t) -;;(set-capslock! #t) - -;;;;; Scheme API reference -;;;; -;; Optional modifier state: -;; (set-numlock! #f or #t) -;; (set-scrolllock! #f or #t) -;; (set-capslock! #f or #t) -;; -;; Shell command key: -;; (xbindkey key "foo-bar-command [args]") -;; (xbindkey '(modifier* key) "foo-bar-command [args]") -;; -;; Scheme function key: -;; (xbindkey-function key function-name-or-lambda-function) -;; (xbindkey-function '(modifier* key) function-name-or-lambda-function) -;; -;; Other functions: -;; (remove-xbindkey key) -;; (run-command "foo-bar-command [args]") -;; (grab-all-keys) -;; (ungrab-all-keys) -;; (remove-all-keys) -;; (debug) - -(xbindkey '(mod4 F9) "mpc toggle") -(xbindkey '(mod4 F10) "mpc prev") -(xbindkey '(mod4 F11) "mpc next") -(xbindkey '(mod4 F12) "mpc stop") - -(xbindkey '(mod4 p) "dmenu_run -fn '-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*' -nb '#002b36' -nf '#fdf6e3' -sb '#586e75' -sf '#fdf6e3' -hist '/home/alan/.cache/dmenu_run_history'") -(xbindkey '(mod4 shift T) "urxvtc") -(xbindkey '(mod4 shift E) "emacsclient -c") diff --git a/tag-xmobar/xmobarrc b/tag-xmobar/xmobarrc deleted file mode 100644 index dd54a928..00000000 --- a/tag-xmobar/xmobarrc +++ /dev/null @@ -1,40 +0,0 @@ -Config { font = "-*-terminus-medium-r-*-*-12-*-*-*-*-*-*-*" - , borderColor = "#657b83" - , border = TopB - , bgColor = "#fdf6e3" - , fgColor = "#657b83" - , position = BottomW L 90 - , lowerOnStart = False - , hideOnStart = False - , persistent = True - , commands = [ Run Weather "EGNX" ["-t", "ºC" - ,"-L", "12" - ,"-H", "22" - ,"--low", "#268bd2" - ,"--normal", "#859900" - ,"--high", "#dc322f" - ] 36000 - , Run DynNetwork ["-t", "Net: ¦KB" - ,"-L", "512" - ,"-H", "10240" - ,"--low", "#859900" - ,"--normal", "#b58900" - ,"--high", "#dc322f" - ,"-m", "5" - ] 10 - , Run Cpu ["-p", "3" - ,"-L", "3" - ,"-H", "50" - ,"--normal", "#859900" - ,"--high", "#dc322f" - ] 10 - , Run Memory ["-p", "3" - ,"-t", "Mem: %" - ] 20 - , Run StdinReader - , Run Date "%a %b %_d %Y %H:%M" "date" 100 - ] - , sepChar = "%" - , alignSep = "}{" - , template = "%StdinReader% }{ %cpu% | %memory% | %dynnetwork% | %EGNX% | %date%" - } diff --git a/tag-xmonad/xmonad/xmonad.hs b/tag-xmonad/xmonad/xmonad.hs deleted file mode 100644 index 21e197d2..00000000 --- a/tag-xmonad/xmonad/xmonad.hs +++ /dev/null @@ -1,92 +0,0 @@ -import XMonad -import qualified XMonad.StackSet as W -import XMonad.Hooks.DynamicLog -import XMonad.Hooks.EwmhDesktops -import XMonad.Hooks.ManageDocks -import XMonad.Hooks.ManageHelpers -import XMonad.Layout.NoBorders -import XMonad.Layout.WindowNavigation -import XMonad.Util.EZConfig -import XMonad.Util.Run(spawnPipe) -import System.Exit -import System.IO -import Data.List(isPrefixOf) - -myManageHook :: ManageHook -myManageHook = composeOne - [ className =? "Firefox" -?> doShift "2" - , className =? "Pidgin" -?> doShift "3" - , className =? "nuvolaplayer" -?> doShift "8" - , className =? "Transmission-gtk" -?> doShift "9" - , isFullscreen -?> doFullFloat - , fmap ("mpv" `isPrefixOf`) title -?> doFullFloat - ] - -myKeys c = mkKeymap c $ - [ ("M-S-", spawn $ XMonad.terminal c) - , ("M-k", kill) - - , ("M-", spawn "exec $(dmenu_path | dmenu)") - , ("M-x M-e", spawn "emacsclient -c") - - , ("M-t", withFocused $ windows . W.sink) - , ("M-m", windows W.focusMaster) - , ("M-S-m", windows W.swapMaster) - - , ("M-", sendMessage $ Go R) - , ("M-", sendMessage $ Go L) - , ("M-", sendMessage $ Go U) - , ("M-", sendMessage $ Go D) - , ("M-M1-", sendMessage $ Swap R) - , ("M-M1-", sendMessage $ Swap L) - , ("M-M1-", sendMessage $ Swap U) - , ("M-M1-", sendMessage $ Swap D) - , ("M-C-", sendMessage $ Move R) - , ("M-C-", sendMessage $ Move L) - , ("M-C-", sendMessage $ Move U) - , ("M-C-", sendMessage $ Move D) - - , ("M-n", windows W.focusDown) - , ("M-p", windows W.focusUp) - , ("M-S-n", windows W.swapDown) - , ("M-S-p", windows W.swapUp) - - , ("M-,", sendMessage (IncMasterN 1)) - , ("M-.", sendMessage (IncMasterN (-1))) - - , ("M-\\", sendMessage NextLayout) - , ("M-S-\\", setLayout $ XMonad.layoutHook c) - - , ("M-+", sendMessage Shrink) - , ("M--", sendMessage Expand) - - , ("M-q", broadcastMessage ReleaseResources - >> restart "xmonad" True) - , ("C-M-q", io (exitWith ExitSuccess)) - ] ++ - - -- mod-[1..9], Switch to workspace N - -- mod-shift-[1..9], Move client to workspace N - [(m ++ k, windows $ f w) - | (w, k) <- zip (XMonad.workspaces c) (map show [1..9]) - , (m, f) <- [("M-",W.greedyView), ("M-S-",W.shift)]] - - -main :: IO () -main = do - xmproc <-spawnPipe "/usr/bin/xmobar /home/alan/.xmobarrc" - xmonad $ defaultConfig - { manageHook = myManageHook <+> manageDocks <+> manageHook defaultConfig - , layoutHook = smartBorders . avoidStruts $ layoutHook defaultConfig - , logHook = dynamicLogWithPP xmobarPP - { ppOutput = hPutStrLn xmproc - , ppTitle = xmobarColor "#859900" "" . shorten 200 - , ppCurrent = xmobarColor "#b58900" "". wrap "[" "]" - , ppHiddenNoWindows = xmobarColor "#93a1a1" "" - , ppUrgent = xmobarColor "#dc322f" "#b58900" - } - , terminal = "urxvt" - , modMask = mod4Mask - , handleEventHook = fullscreenEventHook - , keys = myKeys - } diff --git a/tag-xprofile/xprofile b/tag-xprofile/xprofile deleted file mode 100755 index f0a05239..00000000 --- a/tag-xprofile/xprofile +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -envoy -t gpg-agent -eval $(envoy -p) -xrdb -I$HOME/.xresources .Xresources -xsetroot -cursor_name left_ptr -redshift-gtk & -dropboxd & -trayer --edge bottom --align right --SetDockType true --SetPartialStrut true --expand true --width 10 --transparent true --alpha 0 --tint 0xfdf6e3 --height 12 & -emacsclient --alternate-editor="" --eval '"Starting Emacs"' & diff --git a/tag-xresources/xresources/main b/tag-xresources/xresources/main deleted file mode 100644 index 73f8096d..00000000 --- a/tag-xresources/xresources/main +++ /dev/null @@ -1,13 +0,0 @@ -#include "solarized-light" - -Xcursor.theme: Neutral -Xcursor.size: 22 - -Emacs.ToolBar: off -Emacs.MenuBar: off -Emacs.ScrollBars: off -Emacs.CursorBlink: off - -Emacs.Font: -*-Input Mono Narrow-normal-*-*-*-16-*-*-*-*-*-*-* -Emacs.fixed-pitch.attributeFont: -*-Input Mono Narrow-normal-*-*-*-16-*-*-*-*-*-*-* -Emacs.variable-pitch.attributeFont: -*-Input Sans-medium-r-*-*-16-*-*-*-*-*-*-* diff --git a/tag-xresources/xresources/solarized-light b/tag-xresources/xresources/solarized-light deleted file mode 100644 index 3906b7b0..00000000 --- a/tag-xresources/xresources/solarized-light +++ /dev/null @@ -1,70 +0,0 @@ -! Solarized color scheme for the X Window System -! -! http://ethanschoonover.com/solarized - - -! Common - -#define S_yellow #b58900 -#define S_orange #cb4b16 -#define S_red #dc322f -#define S_magenta #d33682 -#define S_violet #6c71c4 -#define S_blue #268bd2 -#define S_cyan #2aa198 -#define S_green #859900 - - -! Dark - -! #define S_base03 #002b36 -! #define S_base02 #073642 -! #define S_base01 #586e75 -! #define S_base00 #657b83 -! #define S_base0 #839496 -! #define S_base1 #93a1a1 -! #define S_base2 #eee8d5 -! #define S_base3 #fdf6e3 - - -! Light - -#define S_base03 #fdf6e3 -#define S_base02 #eee8d5 -#define S_base01 #93a1a1 -#define S_base00 #839496 -#define S_base0 #657b83 -#define S_base1 #586e75 -#define S_base2 #073642 -#define S_base3 #002b36 - - -! To only apply colors to your terminal, for example, prefix -! the color assignment statement with its name. Example: -! -! URxvt*background: S_base03 - -*background: S_base03 -*foreground: S_base0 -*fading: 40 -*fadeColor: S_base03 -*cursorColor: S_base1 -*pointerColorBackground: S_base01 -*pointerColorForeground: S_base1 - -*color0: S_base02 -*color1: S_red -*color2: S_green -*color3: S_yellow -*color4: S_blue -*color5: S_magenta -*color6: S_cyan -*color7: S_base2 -*color8: S_base03 -*color9: S_orange -*color10: S_base01 -*color11: S_base00 -*color12: S_base0 -*color13: S_violet -*color14: S_base1 -*color15: S_base3 diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv deleted file mode 100644 index f1cad02f..00000000 --- a/tag-zsh/config/zsh/zshenv +++ /dev/null @@ -1,43 +0,0 @@ -if [[ $SHLVL -eq 1 || -n $DISPLAY ]] -then - if [[ -f $ZDOTDIR/zshenv.local ]] - then - . $ZDOTDIR/zshenv.local - fi - - if [[ -f $ZDOTDIR/zshenv.private ]] - then - . $ZDOTDIR/zshenv.private - fi - - ZPLUG_HOME=${ZPLUG_HOME:-~/projects/zplug} - - if [[ -z $SSH_AUTH_SOCK ]] - then - export SSH_AUTH_SOCK=${XDG_RUNTIME_DIR:-/run/user/$UID}/ssh-agent - fi - - case $OSTYPE in - darwin*) - os=darwin - ;; - linux-gnu) - os=linux - ;; - freebsd*) - os=freebsd - ;; - *) - os=unknown - ;; - esac - - case $MACHTYPE in - *64) - arch=amd64 - ;; - *) - arch=386 - ;; - esac -fi diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc deleted file mode 100644 index f2102b34..00000000 --- a/tag-zsh/config/zsh/zshrc +++ /dev/null @@ -1,241 +0,0 @@ -# -*- mode: sh; -*- -source $ZPLUG_HOME/init.zsh - -zplug "zsh-users/zsh-completions", depth:1, defer:0 -zplug "junegunn/fzf-bin", from:gh-r, as:command, rename-to:fzf -zplug "junegunn/fzf", as:plugin, use:"shell/*.zsh", defer:2 -zplug "junegunn/fzf", as:command, use:"bin/*" -zplug "caarlos0/zsh-open-pr", as:plugin -zplug "unixorn/tumult.plugin.zsh", as:plugin, if:"[[ $os -eq darwin ]]" -if [[ -n $commands[nix-env] ]] -then - 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} ]]" -zplug "plugins/yarn", from:oh-my-zsh, defer:2, if:"[[ -n $commands[yarn] ]]", defer:2 -zplug "lukechilds/zsh-better-npm-completion", if:"[[ -n $commands[npm] ]]", defer:2 -zplug "hlissner/zsh-autopair", defer:2 - -HISTSIZE=3000 -SAVEHIST=10000 -HISTFILE=${XDG_CACHE_HOME:=$HOME/.cache}/zsh/history - -WORDCHARS=${${WORDCHARS//[-.]}//[\/]} - -if [[ ${path[(I)$HOME/bin ]} ]] -then - path+=($HOME/bin) -fi - -if [[ ${path[(I)$HOME/.local/bin ]} ]] -then - path+=($HOME/.local/bin) -fi - -if [[ -d /opt/local/share/zsh/site-functions ]] -then - fpath+=(/opt/local/share/zsh/site-functions) -fi - -export EDITOR=emacsclient -alias ec=emacsclient -alias open-project=projectile -_emacs_function () { - emacsclient -e "($1 \"$2\")" > /dev/null -} -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" -gnu_ls_isodate="--time-style=long-iso" -bsd_ls_options="-p" -bsd_ls_isodate="-D '%F %k:%M'" - -case $os 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) - ls_options=$gnu_ls_options - ls_isodate=$gnu_ls_isodate - ;; -esac -alias l="${ls} ${ls_options} -Bp" -alias l1="${ls} ${ls_options} -1" -alias ls="${ls} ${ls_options} -hF" -alias la="${ls} ${ls_options} -hA" -alias ll="${ls} ${ls_options} ${ls_isodate} -hl" -alias lal="ll -A" -alias lla="lal" -alias llr="ll -t" - -zmodload zsh/terminfo - -bindkey '\e[3~' delete-char - -bindkey '\C-hd' describe-key-briefly - -backward-argument () { - local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\"" - zle backward-word -} - -forward-argument () { - local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\"" - zle forward-word -} - -kill-argument () { - local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\"" - zle backward-argument - zle kill-word -} - -zle -N backward-argument -zle -N forward-argument -zle -N kill-argument -bindkey '\e^b' backward-argument -bindkey '\e^f' forward-argument -bindkey '\e^k' kill-argument - -ds () { - du -hd1 $1 | sort -h -} - -zle -C hist-complete complete-word _generic -zstyle ':completion:hist-complete:*' completer _history -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) -fi - -# Then, source plugins and add commands to $PATH -zplug load - -# General configuration - -if [[ -n $commands[hub] ]] -then - 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 -fi - -if [[ $TERM == "dumb" ]] -then - unsetopt zle - PROMPT="> " -else - 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' - - setopt prompt_subst - setopt prompt_cr - PROMPT='%F{blue}%~%f${prompt_pure_username} -%(?.%F{magenta}.%F{red})>%f ' - - ## From https://github.com/robbyrussell/oh-my-zsh/blob/71deb74552d54630d99ae1db3647ebed7b3bc735/lib/termsupport.zsh - - # Keep Apple Terminal.app's current working directory updated - # Based on this answer: http://superuser.com/a/315029 - # With extra fixes to handle multibyte chars and non-UTF-8 locales - - if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then - # Emits the control sequence to notify Terminal.app of the cwd - # Identifies the directory using a file: URI scheme, including - # the host name to disambiguate local vs. remote paths. - function update_terminalapp_cwd() { - emulate -L zsh - - # Percent-encode the pathname. - # Percent-encode the pathname. - local URL_PATH='' - { - # Use LC_CTYPE=C to process text byte-by-byte. - local i ch hexch LC_CTYPE=C - for ((i = 1; i <= ${#PWD}; ++i)); do - ch="$PWD[i]" - if [[ "$ch" =~ [/._~A-Za-z0-9-] ]]; then - URL_PATH+="$ch" - else - hexch=$(printf "%02X" "'$ch") - URL_PATH+="%$hexch" - fi - done - } - [[ $? != 0 ]] && return 1 - - printf '\e]7;%s\a' "file://$HOST$URL_PATH" - } - - # Use a precmd hook instead of a chpwd hook to avoid contaminating output - precmd_functions+=(update_terminalapp_cwd) - # Run once to get initial cwd set - update_terminalapp_cwd - fi - - function set_window_title { printf '\e]2;%s\a' "$1" } - - function update_window_title { - if [[ -n "$SSH_CONNECTION" || $UID -eq 0 ]] - then - set_window_title "$USER@$HOST" - else - set_window_title "" - fi - } - precmd_functions+=(update_window_title) -fi - -if zplug check junegunn/fzf -then - _fzf_compgen_path() { - echo "$1" - command find -L "$1" \ - -name .git -prune -o -name .svn -prune -o \( -type d -o -type f -o -type l \) \ - -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@' - } - - _fzf_compgen_dir() { - command find -L "$1" \ - -name .git -prune -o -name .svn -prune -o -type d \ - -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@' - } -fi - -unsetopt flow_control # Let me use ^S and ^Q diff --git a/tag-zsh/zshenv b/tag-zsh/zshenv deleted file mode 100644 index 354c54da..00000000 --- a/tag-zsh/zshenv +++ /dev/null @@ -1,3 +0,0 @@ -ZDOTDIR="${XDG_CONFIG_HOME:=$HOME/.config}/zsh" - -source "$ZDOTDIR"/.zshenv diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf new file mode 100644 index 00000000..697e1238 --- /dev/null +++ b/tmux/.tmux.conf @@ -0,0 +1,19 @@ +#setw -g xterm-keys on +#set -g terminal-overrides "xterm*:kLFT5=\eOD:kRIT5=\eOC:kUP5=\eOA:kDN5=\eOB:smkx@:rmkx@" + +set-window-option -g utf8 on +set-option -g status-utf8 on +set-option -g prefix C-z + +bind C-n send-prefix +unbind-key C-b + +set -g default-terminal "screen-256color" + +# Colemak style +bind-key C-i next-window + +set -g base-index 1 + +set -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_GIT SSH_CONNECTION WINDOWID XAUTHORITY" +set-environment -g 'SSH_AUTH_SOCK' '/home/alan/.ssh/ssh_auth_sock' \ No newline at end of file diff --git a/vagrant/.vagrant.d/Vagrantfile b/vagrant/.vagrant.d/Vagrantfile new file mode 100644 index 00000000..4c69c88e --- /dev/null +++ b/vagrant/.vagrant.d/Vagrantfile @@ -0,0 +1,7 @@ +# -*- mode: ruby -*- +Vagrant.configure(2) do |config| + config.vm.provision "ansible" do |ansible| + ansible.playbook = "#{File.dirname(__FILE__)}/ansible/site.yml" + ansible.limit = "all" + end +end diff --git a/vagrant/.vagrant.d/ansible/centos.yml b/vagrant/.vagrant.d/ansible/centos.yml new file mode 100644 index 00000000..1a6759a6 --- /dev/null +++ b/vagrant/.vagrant.d/ansible/centos.yml @@ -0,0 +1,31 @@ +- name: Ensure EPEL repository package is present + register: centos_repos + get_url: + url: "{{ item.url }}" + dest: "/root/{{ item.dest }}" + with_items: + - url: http://lon.mirror.rackspace.com/ius/stable/CentOS/6/x86_64/epel-release-6-5.noarch.rpm + dest: epel-repo.rpm + - url: http://lon.mirror.rackspace.com/ius/stable/CentOS/6/x86_64/ius-release-1.0-11.ius.centos6.noarch.rpm + dest: ius-repo.rpm + +- name: Fetch utilities repo + get_url: + url: http://download.opensuse.org/repositories/utilities/CentOS_6/utilities.repo + dest: /etc/yum.repos.d/utilities.repo + +- name: Ensure IUS and EPEL repositories are installed + when: centos_repos.changed + yum: + name: "{{ item }}" + state: installed + with_items: + - /root/epel-repo.rpm + - /root/ius-repo.rpm + + +- name: Ensure that tools are installed + with_items: packages + yum: + name: "{{ item }}" + state: present diff --git a/vagrant/.vagrant.d/ansible/debian.yml b/vagrant/.vagrant.d/ansible/debian.yml new file mode 100644 index 00000000..9e06af69 --- /dev/null +++ b/vagrant/.vagrant.d/ansible/debian.yml @@ -0,0 +1,15 @@ +- get_url: + url: https://thoughtbot.github.io/rcm/debs/rcm_1.2.2-2_all.deb + dest: /tmp/rcm.deb + +- command: dpkg --skip-same-version -i /tmp/rcm.deb + register: dpkg + changed_when: "dpkg.stdout.startswith('Selecting')" + +- name: Ensure that tools are installed + with_items: packages + apt: + pkg: "{{ item }}" + state: present + cache_valid_time: 86400 + update_cache: yes \ No newline at end of file diff --git a/vagrant/.vagrant.d/ansible/site.yml b/vagrant/.vagrant.d/ansible/site.yml new file mode 100644 index 00000000..13384550 --- /dev/null +++ b/vagrant/.vagrant.d/ansible/site.yml @@ -0,0 +1,32 @@ +--- +- hosts: all + sudo: yes + vars: + packages: + - zsh + - htop + - lsof + - git + - rcm + tasks: + - include: centos.yml + when: ansible_distribution == "CentOS" + + - include: debian.yml + when: ansible_distribution == "Debian" + + - name: Ensure that dotfiles are checked out + sudo: no + git: + repo: git://github.com/alanpearce/dotfiles + dest: ~/dotfiles + update: yes + + - name: Change shell to zsh + user: + name: vagrant + shell: /bin/zsh + + - name: Install dotfiles + sudo: no + command: /usr/bin/rcup -d dotfiles -t zsh -t git -x README.org -x Brewfile -x LaunchAgents chdir=/home/vagrant \ No newline at end of file diff --git a/xbindkeys/xbindkeysrc.scm b/xbindkeys/xbindkeysrc.scm new file mode 100644 index 00000000..7b00c38d --- /dev/null +++ b/xbindkeys/xbindkeysrc.scm @@ -0,0 +1,57 @@ +;; To specify a key, you can use 'xbindkeys --key' or +;; 'xbindkeys --multikey' and put one of the two lines in this file. + +;; A list of keys is in /usr/include/X11/keysym.h and in +;; /usr/include/X11/keysymdef.h +;; The XK_ is not needed. + +;; List of modifier: +;; Release, Control, Shift, Mod1 (Alt), Mod2 (NumLock), +;; Mod3 (CapsLock), Mod4, Mod5 (Scroll). + + +;; The release modifier is not a standard X modifier, but you can +;; use it if you want to catch release instead of press events + +;; By defaults, xbindkeys does not pay attention to modifiers +;; NumLock, CapsLock and ScrollLock. +;; Uncomment the lines below if you want to use them. +;; To dissable them, call the functions with #f + + +;;;;EXTRA FUNCTIONS: Enable numlock, scrolllock or capslock usage +;;(set-numlock! #t) +;;(set-scrolllock! #t) +;;(set-capslock! #t) + +;;;;; Scheme API reference +;;;; +;; Optional modifier state: +;; (set-numlock! #f or #t) +;; (set-scrolllock! #f or #t) +;; (set-capslock! #f or #t) +;; +;; Shell command key: +;; (xbindkey key "foo-bar-command [args]") +;; (xbindkey '(modifier* key) "foo-bar-command [args]") +;; +;; Scheme function key: +;; (xbindkey-function key function-name-or-lambda-function) +;; (xbindkey-function '(modifier* key) function-name-or-lambda-function) +;; +;; Other functions: +;; (remove-xbindkey key) +;; (run-command "foo-bar-command [args]") +;; (grab-all-keys) +;; (ungrab-all-keys) +;; (remove-all-keys) +;; (debug) + +(xbindkey '(mod4 F9) "mpc toggle") +(xbindkey '(mod4 F10) "mpc prev") +(xbindkey '(mod4 F11) "mpc next") +(xbindkey '(mod4 F12) "mpc stop") + +(xbindkey '(mod4 p) "dmenu_run -fn '-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*' -nb '#002b36' -nf '#fdf6e3' -sb '#586e75' -sf '#fdf6e3' -hist '/home/alan/.cache/dmenu_run_history'") +(xbindkey '(mod4 shift T) "urxvtc") +(xbindkey '(mod4 shift E) "emacsclient -c") diff --git a/xmobar/.xmobarrc b/xmobar/.xmobarrc new file mode 100644 index 00000000..dd54a928 --- /dev/null +++ b/xmobar/.xmobarrc @@ -0,0 +1,40 @@ +Config { font = "-*-terminus-medium-r-*-*-12-*-*-*-*-*-*-*" + , borderColor = "#657b83" + , border = TopB + , bgColor = "#fdf6e3" + , fgColor = "#657b83" + , position = BottomW L 90 + , lowerOnStart = False + , hideOnStart = False + , persistent = True + , commands = [ Run Weather "EGNX" ["-t", "ºC" + ,"-L", "12" + ,"-H", "22" + ,"--low", "#268bd2" + ,"--normal", "#859900" + ,"--high", "#dc322f" + ] 36000 + , Run DynNetwork ["-t", "Net: ¦KB" + ,"-L", "512" + ,"-H", "10240" + ,"--low", "#859900" + ,"--normal", "#b58900" + ,"--high", "#dc322f" + ,"-m", "5" + ] 10 + , Run Cpu ["-p", "3" + ,"-L", "3" + ,"-H", "50" + ,"--normal", "#859900" + ,"--high", "#dc322f" + ] 10 + , Run Memory ["-p", "3" + ,"-t", "Mem: %" + ] 20 + , Run StdinReader + , Run Date "%a %b %_d %Y %H:%M" "date" 100 + ] + , sepChar = "%" + , alignSep = "}{" + , template = "%StdinReader% }{ %cpu% | %memory% | %dynnetwork% | %EGNX% | %date%" + } diff --git a/xmonad/xmonad/xmonad.hs b/xmonad/xmonad/xmonad.hs new file mode 100644 index 00000000..21e197d2 --- /dev/null +++ b/xmonad/xmonad/xmonad.hs @@ -0,0 +1,92 @@ +import XMonad +import qualified XMonad.StackSet as W +import XMonad.Hooks.DynamicLog +import XMonad.Hooks.EwmhDesktops +import XMonad.Hooks.ManageDocks +import XMonad.Hooks.ManageHelpers +import XMonad.Layout.NoBorders +import XMonad.Layout.WindowNavigation +import XMonad.Util.EZConfig +import XMonad.Util.Run(spawnPipe) +import System.Exit +import System.IO +import Data.List(isPrefixOf) + +myManageHook :: ManageHook +myManageHook = composeOne + [ className =? "Firefox" -?> doShift "2" + , className =? "Pidgin" -?> doShift "3" + , className =? "nuvolaplayer" -?> doShift "8" + , className =? "Transmission-gtk" -?> doShift "9" + , isFullscreen -?> doFullFloat + , fmap ("mpv" `isPrefixOf`) title -?> doFullFloat + ] + +myKeys c = mkKeymap c $ + [ ("M-S-", spawn $ XMonad.terminal c) + , ("M-k", kill) + + , ("M-", spawn "exec $(dmenu_path | dmenu)") + , ("M-x M-e", spawn "emacsclient -c") + + , ("M-t", withFocused $ windows . W.sink) + , ("M-m", windows W.focusMaster) + , ("M-S-m", windows W.swapMaster) + + , ("M-", sendMessage $ Go R) + , ("M-", sendMessage $ Go L) + , ("M-", sendMessage $ Go U) + , ("M-", sendMessage $ Go D) + , ("M-M1-", sendMessage $ Swap R) + , ("M-M1-", sendMessage $ Swap L) + , ("M-M1-", sendMessage $ Swap U) + , ("M-M1-", sendMessage $ Swap D) + , ("M-C-", sendMessage $ Move R) + , ("M-C-", sendMessage $ Move L) + , ("M-C-", sendMessage $ Move U) + , ("M-C-", sendMessage $ Move D) + + , ("M-n", windows W.focusDown) + , ("M-p", windows W.focusUp) + , ("M-S-n", windows W.swapDown) + , ("M-S-p", windows W.swapUp) + + , ("M-,", sendMessage (IncMasterN 1)) + , ("M-.", sendMessage (IncMasterN (-1))) + + , ("M-\\", sendMessage NextLayout) + , ("M-S-\\", setLayout $ XMonad.layoutHook c) + + , ("M-+", sendMessage Shrink) + , ("M--", sendMessage Expand) + + , ("M-q", broadcastMessage ReleaseResources + >> restart "xmonad" True) + , ("C-M-q", io (exitWith ExitSuccess)) + ] ++ + + -- mod-[1..9], Switch to workspace N + -- mod-shift-[1..9], Move client to workspace N + [(m ++ k, windows $ f w) + | (w, k) <- zip (XMonad.workspaces c) (map show [1..9]) + , (m, f) <- [("M-",W.greedyView), ("M-S-",W.shift)]] + + +main :: IO () +main = do + xmproc <-spawnPipe "/usr/bin/xmobar /home/alan/.xmobarrc" + xmonad $ defaultConfig + { manageHook = myManageHook <+> manageDocks <+> manageHook defaultConfig + , layoutHook = smartBorders . avoidStruts $ layoutHook defaultConfig + , logHook = dynamicLogWithPP xmobarPP + { ppOutput = hPutStrLn xmproc + , ppTitle = xmobarColor "#859900" "" . shorten 200 + , ppCurrent = xmobarColor "#b58900" "". wrap "[" "]" + , ppHiddenNoWindows = xmobarColor "#93a1a1" "" + , ppUrgent = xmobarColor "#dc322f" "#b58900" + } + , terminal = "urxvt" + , modMask = mod4Mask + , handleEventHook = fullscreenEventHook + , keys = myKeys + } diff --git a/xprofile/.xprofile b/xprofile/.xprofile new file mode 100755 index 00000000..f0a05239 --- /dev/null +++ b/xprofile/.xprofile @@ -0,0 +1,9 @@ +#!/bin/sh +envoy -t gpg-agent +eval $(envoy -p) +xrdb -I$HOME/.xresources .Xresources +xsetroot -cursor_name left_ptr +redshift-gtk & +dropboxd & +trayer --edge bottom --align right --SetDockType true --SetPartialStrut true --expand true --width 10 --transparent true --alpha 0 --tint 0xfdf6e3 --height 12 & +emacsclient --alternate-editor="" --eval '"Starting Emacs"' & diff --git a/xresources/.xresources/main b/xresources/.xresources/main new file mode 100644 index 00000000..73f8096d --- /dev/null +++ b/xresources/.xresources/main @@ -0,0 +1,13 @@ +#include "solarized-light" + +Xcursor.theme: Neutral +Xcursor.size: 22 + +Emacs.ToolBar: off +Emacs.MenuBar: off +Emacs.ScrollBars: off +Emacs.CursorBlink: off + +Emacs.Font: -*-Input Mono Narrow-normal-*-*-*-16-*-*-*-*-*-*-* +Emacs.fixed-pitch.attributeFont: -*-Input Mono Narrow-normal-*-*-*-16-*-*-*-*-*-*-* +Emacs.variable-pitch.attributeFont: -*-Input Sans-medium-r-*-*-16-*-*-*-*-*-*-* diff --git a/xresources/.xresources/solarized-light b/xresources/.xresources/solarized-light new file mode 100644 index 00000000..3906b7b0 --- /dev/null +++ b/xresources/.xresources/solarized-light @@ -0,0 +1,70 @@ +! Solarized color scheme for the X Window System +! +! http://ethanschoonover.com/solarized + + +! Common + +#define S_yellow #b58900 +#define S_orange #cb4b16 +#define S_red #dc322f +#define S_magenta #d33682 +#define S_violet #6c71c4 +#define S_blue #268bd2 +#define S_cyan #2aa198 +#define S_green #859900 + + +! Dark + +! #define S_base03 #002b36 +! #define S_base02 #073642 +! #define S_base01 #586e75 +! #define S_base00 #657b83 +! #define S_base0 #839496 +! #define S_base1 #93a1a1 +! #define S_base2 #eee8d5 +! #define S_base3 #fdf6e3 + + +! Light + +#define S_base03 #fdf6e3 +#define S_base02 #eee8d5 +#define S_base01 #93a1a1 +#define S_base00 #839496 +#define S_base0 #657b83 +#define S_base1 #586e75 +#define S_base2 #073642 +#define S_base3 #002b36 + + +! To only apply colors to your terminal, for example, prefix +! the color assignment statement with its name. Example: +! +! URxvt*background: S_base03 + +*background: S_base03 +*foreground: S_base0 +*fading: 40 +*fadeColor: S_base03 +*cursorColor: S_base1 +*pointerColorBackground: S_base01 +*pointerColorForeground: S_base1 + +*color0: S_base02 +*color1: S_red +*color2: S_green +*color3: S_yellow +*color4: S_blue +*color5: S_magenta +*color6: S_cyan +*color7: S_base2 +*color8: S_base03 +*color9: S_orange +*color10: S_base01 +*color11: S_base00 +*color12: S_base0 +*color13: S_violet +*color14: S_base1 +*color15: S_base3 diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv new file mode 100644 index 00000000..f1cad02f --- /dev/null +++ b/zsh/.config/zsh/.zshenv @@ -0,0 +1,43 @@ +if [[ $SHLVL -eq 1 || -n $DISPLAY ]] +then + if [[ -f $ZDOTDIR/zshenv.local ]] + then + . $ZDOTDIR/zshenv.local + fi + + if [[ -f $ZDOTDIR/zshenv.private ]] + then + . $ZDOTDIR/zshenv.private + fi + + ZPLUG_HOME=${ZPLUG_HOME:-~/projects/zplug} + + if [[ -z $SSH_AUTH_SOCK ]] + then + export SSH_AUTH_SOCK=${XDG_RUNTIME_DIR:-/run/user/$UID}/ssh-agent + fi + + case $OSTYPE in + darwin*) + os=darwin + ;; + linux-gnu) + os=linux + ;; + freebsd*) + os=freebsd + ;; + *) + os=unknown + ;; + esac + + case $MACHTYPE in + *64) + arch=amd64 + ;; + *) + arch=386 + ;; + esac +fi diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc new file mode 100644 index 00000000..f2102b34 --- /dev/null +++ b/zsh/.config/zsh/.zshrc @@ -0,0 +1,241 @@ +# -*- mode: sh; -*- +source $ZPLUG_HOME/init.zsh + +zplug "zsh-users/zsh-completions", depth:1, defer:0 +zplug "junegunn/fzf-bin", from:gh-r, as:command, rename-to:fzf +zplug "junegunn/fzf", as:plugin, use:"shell/*.zsh", defer:2 +zplug "junegunn/fzf", as:command, use:"bin/*" +zplug "caarlos0/zsh-open-pr", as:plugin +zplug "unixorn/tumult.plugin.zsh", as:plugin, if:"[[ $os -eq darwin ]]" +if [[ -n $commands[nix-env] ]] +then + 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} ]]" +zplug "plugins/yarn", from:oh-my-zsh, defer:2, if:"[[ -n $commands[yarn] ]]", defer:2 +zplug "lukechilds/zsh-better-npm-completion", if:"[[ -n $commands[npm] ]]", defer:2 +zplug "hlissner/zsh-autopair", defer:2 + +HISTSIZE=3000 +SAVEHIST=10000 +HISTFILE=${XDG_CACHE_HOME:=$HOME/.cache}/zsh/history + +WORDCHARS=${${WORDCHARS//[-.]}//[\/]} + +if [[ ${path[(I)$HOME/bin ]} ]] +then + path+=($HOME/bin) +fi + +if [[ ${path[(I)$HOME/.local/bin ]} ]] +then + path+=($HOME/.local/bin) +fi + +if [[ -d /opt/local/share/zsh/site-functions ]] +then + fpath+=(/opt/local/share/zsh/site-functions) +fi + +export EDITOR=emacsclient +alias ec=emacsclient +alias open-project=projectile +_emacs_function () { + emacsclient -e "($1 \"$2\")" > /dev/null +} +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" +gnu_ls_isodate="--time-style=long-iso" +bsd_ls_options="-p" +bsd_ls_isodate="-D '%F %k:%M'" + +case $os 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) + ls_options=$gnu_ls_options + ls_isodate=$gnu_ls_isodate + ;; +esac +alias l="${ls} ${ls_options} -Bp" +alias l1="${ls} ${ls_options} -1" +alias ls="${ls} ${ls_options} -hF" +alias la="${ls} ${ls_options} -hA" +alias ll="${ls} ${ls_options} ${ls_isodate} -hl" +alias lal="ll -A" +alias lla="lal" +alias llr="ll -t" + +zmodload zsh/terminfo + +bindkey '\e[3~' delete-char + +bindkey '\C-hd' describe-key-briefly + +backward-argument () { + local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\"" + zle backward-word +} + +forward-argument () { + local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\"" + zle forward-word +} + +kill-argument () { + local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\"" + zle backward-argument + zle kill-word +} + +zle -N backward-argument +zle -N forward-argument +zle -N kill-argument +bindkey '\e^b' backward-argument +bindkey '\e^f' forward-argument +bindkey '\e^k' kill-argument + +ds () { + du -hd1 $1 | sort -h +} + +zle -C hist-complete complete-word _generic +zstyle ':completion:hist-complete:*' completer _history +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) +fi + +# Then, source plugins and add commands to $PATH +zplug load + +# General configuration + +if [[ -n $commands[hub] ]] +then + 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 +fi + +if [[ $TERM == "dumb" ]] +then + unsetopt zle + PROMPT="> " +else + 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' + + setopt prompt_subst + setopt prompt_cr + PROMPT='%F{blue}%~%f${prompt_pure_username} +%(?.%F{magenta}.%F{red})>%f ' + + ## From https://github.com/robbyrussell/oh-my-zsh/blob/71deb74552d54630d99ae1db3647ebed7b3bc735/lib/termsupport.zsh + + # Keep Apple Terminal.app's current working directory updated + # Based on this answer: http://superuser.com/a/315029 + # With extra fixes to handle multibyte chars and non-UTF-8 locales + + if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then + # Emits the control sequence to notify Terminal.app of the cwd + # Identifies the directory using a file: URI scheme, including + # the host name to disambiguate local vs. remote paths. + function update_terminalapp_cwd() { + emulate -L zsh + + # Percent-encode the pathname. + # Percent-encode the pathname. + local URL_PATH='' + { + # Use LC_CTYPE=C to process text byte-by-byte. + local i ch hexch LC_CTYPE=C + for ((i = 1; i <= ${#PWD}; ++i)); do + ch="$PWD[i]" + if [[ "$ch" =~ [/._~A-Za-z0-9-] ]]; then + URL_PATH+="$ch" + else + hexch=$(printf "%02X" "'$ch") + URL_PATH+="%$hexch" + fi + done + } + [[ $? != 0 ]] && return 1 + + printf '\e]7;%s\a' "file://$HOST$URL_PATH" + } + + # Use a precmd hook instead of a chpwd hook to avoid contaminating output + precmd_functions+=(update_terminalapp_cwd) + # Run once to get initial cwd set + update_terminalapp_cwd + fi + + function set_window_title { printf '\e]2;%s\a' "$1" } + + function update_window_title { + if [[ -n "$SSH_CONNECTION" || $UID -eq 0 ]] + then + set_window_title "$USER@$HOST" + else + set_window_title "" + fi + } + precmd_functions+=(update_window_title) +fi + +if zplug check junegunn/fzf +then + _fzf_compgen_path() { + echo "$1" + command find -L "$1" \ + -name .git -prune -o -name .svn -prune -o \( -type d -o -type f -o -type l \) \ + -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@' + } + + _fzf_compgen_dir() { + command find -L "$1" \ + -name .git -prune -o -name .svn -prune -o -type d \ + -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@' + } +fi + +unsetopt flow_control # Let me use ^S and ^Q diff --git a/zsh/.zshenv b/zsh/.zshenv new file mode 100644 index 00000000..354c54da --- /dev/null +++ b/zsh/.zshenv @@ -0,0 +1,3 @@ +ZDOTDIR="${XDG_CONFIG_HOME:=$HOME/.config}/zsh" + +source "$ZDOTDIR"/.zshenv -- cgit 1.4.1 From 9fee193c12d92ab503f1ba334345f7e56c10f217 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 17 Mar 2017 10:01:23 +0100 Subject: Merge host-specific configuration to tags --- emacs/.emacs.d/private.el.gpg | Bin 0 -> 2288 bytes host-ap-spotcap.local/config/mpv/config | 11 ------- host-ap-spotcap.local/config/zsh/zshenv.local | 9 ------ host-ap-spotcap.local/emacs.d/private.el.gpg | Bin 2288 -> 0 bytes host-ap-spotcap.local/rcrc.local | 2 -- host-ap-spotcap.local/slate | 45 -------------------------- host-marvin/xmodmaprc | 20 ------------ host-prefect/Xresources | 4 --- host-prefect/rcrc.local | 2 -- mpv/.config/config | 11 +++++++ slate/.slate | 45 ++++++++++++++++++++++++++ xmodmap/xmodmaprc | 20 ++++++++++++ zsh/.config/zsh/.zshenv | 5 +++ zsh/.config/zsh/.zshrc | 6 ++++ 14 files changed, 87 insertions(+), 93 deletions(-) create mode 100644 emacs/.emacs.d/private.el.gpg delete mode 100644 host-ap-spotcap.local/config/mpv/config delete mode 100644 host-ap-spotcap.local/config/zsh/zshenv.local delete mode 100644 host-ap-spotcap.local/emacs.d/private.el.gpg delete mode 100644 host-ap-spotcap.local/rcrc.local delete mode 100644 host-ap-spotcap.local/slate delete mode 100644 host-marvin/xmodmaprc delete mode 100644 host-prefect/Xresources delete mode 100644 host-prefect/rcrc.local create mode 100644 mpv/.config/config create mode 100644 slate/.slate create mode 100644 xmodmap/xmodmaprc diff --git a/emacs/.emacs.d/private.el.gpg b/emacs/.emacs.d/private.el.gpg new file mode 100644 index 00000000..784a023b Binary files /dev/null and b/emacs/.emacs.d/private.el.gpg differ diff --git a/host-ap-spotcap.local/config/mpv/config b/host-ap-spotcap.local/config/mpv/config deleted file mode 100644 index 56c6d996..00000000 --- a/host-ap-spotcap.local/config/mpv/config +++ /dev/null @@ -1,11 +0,0 @@ -[default] - -vo=opengl-hq:backend=cocoa -ao=coreaudio - -hwdec=videotoolbox - -alang=en,eng,de,ger - -ytdl -ytdl-format=best diff --git a/host-ap-spotcap.local/config/zsh/zshenv.local b/host-ap-spotcap.local/config/zsh/zshenv.local deleted file mode 100644 index af63e1ba..00000000 --- a/host-ap-spotcap.local/config/zsh/zshenv.local +++ /dev/null @@ -1,9 +0,0 @@ -# -*- mode: sh; -*- -if [[ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]] -then - . $HOME/.nix-profile/etc/profile.d/nix.sh; -fi - -JIRA_RAPID_BOARD=true -JIRA_URL=https://spotcap.atlassian.net -EMAIL=alan.pearce@spotcap.com diff --git a/host-ap-spotcap.local/emacs.d/private.el.gpg b/host-ap-spotcap.local/emacs.d/private.el.gpg deleted file mode 100644 index 784a023b..00000000 Binary files a/host-ap-spotcap.local/emacs.d/private.el.gpg and /dev/null differ diff --git a/host-ap-spotcap.local/rcrc.local b/host-ap-spotcap.local/rcrc.local deleted file mode 100644 index 4639c9e2..00000000 --- a/host-ap-spotcap.local/rcrc.local +++ /dev/null @@ -1,2 +0,0 @@ -DOTFILES_DIRS="$HOME/projects/dotfiles" -TAGS="emacs git global tmux zsh" \ No newline at end of file diff --git a/host-ap-spotcap.local/slate b/host-ap-spotcap.local/slate deleted file mode 100644 index e8c675d0..00000000 --- a/host-ap-spotcap.local/slate +++ /dev/null @@ -1,45 +0,0 @@ -config keyboardLayout colemak - -config defaultToCurrentScreen true -config nudgePercentOf screenSize -config resizePercentOf screenSize - -config windowHintsSpread true - -alias mon-laptop 1680x1050 -alias mon-work 1920x1200 -alias mon-home 2560x1440 - -alias 1-full throw 0 resize -alias 1-left push left bar-resize:screenSizeX/2 0 -alias 1-right push right bar-resize:screenSizeX/2 0 -alias 2-left push left bar-resize:screenSizeX/2 1 -alias 2-right push right bar-resize:screenSizeX/2 1 - -# Push Bindings -bind right:alt;cmd push right bar-resize:screenSizeX/2 -bind left:alt;cmd push left bar-resize:screenSizeX/2 -bind up:alt;cmd push up bar-resize:screenSizeY/2 -bind down:alt;cmd push down bar-resize:screenSizeY/2 - -# Throw Bindings -bind 1:ctrl;alt throw 0 resize -bind 2:ctrl;alt throw 1 resize -bind 3:ctrl;alt throw 2 resize -bind right:ctrl;alt;cmd throw right resize -bind left:ctrl;alt;cmd throw left resize -bind up:ctrl;alt;cmd throw up resize -bind down:ctrl;alt;cmd throw down resize - -bind f:cmd;shift move screenOriginX;screenOriginY screenSizeX;screenSizeY - -# Focus Bindings -bind right:cmd;shift focus right -bind left:cmd;shift focus left -# bind up:cmd;shift focus up -# bind down:cmd;shift focus down -bind up:cmd;shift focus behind -bind down:cmd;shift focus behind - -# Window Hints -bind esc:cmd hint setnriao diff --git a/host-marvin/xmodmaprc b/host-marvin/xmodmaprc deleted file mode 100644 index 82a8674f..00000000 --- a/host-marvin/xmodmaprc +++ /dev/null @@ -1,20 +0,0 @@ -keycode 37 = Super_L NoSymbol Super_L -keycode 133 = Alt_L Meta_L Alt_L Meta_L -keycode 64 = Control_L NoSymbol Control_L - -! Thinkpad has PrtSc next to Alt_R -keycode 108 = Control_R NoSymbol Control_R -keycode 107 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift -keycode 105 = Super_R NoSymbol Super_R -! For external keyboards -keycode 134 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift - -clear Control -clear Mod1 -clear Mod3 -clear Mod4 - -add Control = Control_L Control_R -add Mod1 = Alt_L Meta_L -add Mod4 = Super_L Super_R Super_L Hyper_L -add Mod5 = ISO_Level3_Shift Mode_switch \ No newline at end of file diff --git a/host-prefect/Xresources b/host-prefect/Xresources deleted file mode 100644 index c89d4863..00000000 --- a/host-prefect/Xresources +++ /dev/null @@ -1,4 +0,0 @@ -#include "main" - -Emacs.Font: -xos4-Terminus-normal-normal-normal-*-14-*-*-*-*-*-*-* -Emacs.fixed-pitch.attributeFont: -xos4-Terminus-normal-normal-normal-*-14-*-*-*-*-*-*-* diff --git a/host-prefect/rcrc.local b/host-prefect/rcrc.local deleted file mode 100644 index 3b80dd6e..00000000 --- a/host-prefect/rcrc.local +++ /dev/null @@ -1,2 +0,0 @@ -DOTFILES_DIRS="$HOME/projects/dotfiles" -TAGS="emacs git hg clojure ssh zsh" diff --git a/mpv/.config/config b/mpv/.config/config new file mode 100644 index 00000000..56c6d996 --- /dev/null +++ b/mpv/.config/config @@ -0,0 +1,11 @@ +[default] + +vo=opengl-hq:backend=cocoa +ao=coreaudio + +hwdec=videotoolbox + +alang=en,eng,de,ger + +ytdl +ytdl-format=best diff --git a/slate/.slate b/slate/.slate new file mode 100644 index 00000000..e8c675d0 --- /dev/null +++ b/slate/.slate @@ -0,0 +1,45 @@ +config keyboardLayout colemak + +config defaultToCurrentScreen true +config nudgePercentOf screenSize +config resizePercentOf screenSize + +config windowHintsSpread true + +alias mon-laptop 1680x1050 +alias mon-work 1920x1200 +alias mon-home 2560x1440 + +alias 1-full throw 0 resize +alias 1-left push left bar-resize:screenSizeX/2 0 +alias 1-right push right bar-resize:screenSizeX/2 0 +alias 2-left push left bar-resize:screenSizeX/2 1 +alias 2-right push right bar-resize:screenSizeX/2 1 + +# Push Bindings +bind right:alt;cmd push right bar-resize:screenSizeX/2 +bind left:alt;cmd push left bar-resize:screenSizeX/2 +bind up:alt;cmd push up bar-resize:screenSizeY/2 +bind down:alt;cmd push down bar-resize:screenSizeY/2 + +# Throw Bindings +bind 1:ctrl;alt throw 0 resize +bind 2:ctrl;alt throw 1 resize +bind 3:ctrl;alt throw 2 resize +bind right:ctrl;alt;cmd throw right resize +bind left:ctrl;alt;cmd throw left resize +bind up:ctrl;alt;cmd throw up resize +bind down:ctrl;alt;cmd throw down resize + +bind f:cmd;shift move screenOriginX;screenOriginY screenSizeX;screenSizeY + +# Focus Bindings +bind right:cmd;shift focus right +bind left:cmd;shift focus left +# bind up:cmd;shift focus up +# bind down:cmd;shift focus down +bind up:cmd;shift focus behind +bind down:cmd;shift focus behind + +# Window Hints +bind esc:cmd hint setnriao diff --git a/xmodmap/xmodmaprc b/xmodmap/xmodmaprc new file mode 100644 index 00000000..82a8674f --- /dev/null +++ b/xmodmap/xmodmaprc @@ -0,0 +1,20 @@ +keycode 37 = Super_L NoSymbol Super_L +keycode 133 = Alt_L Meta_L Alt_L Meta_L +keycode 64 = Control_L NoSymbol Control_L + +! Thinkpad has PrtSc next to Alt_R +keycode 108 = Control_R NoSymbol Control_R +keycode 107 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift +keycode 105 = Super_R NoSymbol Super_R +! For external keyboards +keycode 134 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift + +clear Control +clear Mod1 +clear Mod3 +clear Mod4 + +add Control = Control_L Control_R +add Mod1 = Alt_L Meta_L +add Mod4 = Super_L Super_R Super_L Hyper_L +add Mod5 = ISO_Level3_Shift Mode_switch \ No newline at end of file diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index f1cad02f..0be5a7a6 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -17,6 +17,11 @@ then export SSH_AUTH_SOCK=${XDG_RUNTIME_DIR:-/run/user/$UID}/ssh-agent fi + if [[ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]] + then + . $HOME/.nix-profile/etc/profile.d/nix.sh; + fi + case $OSTYPE in darwin*) os=darwin diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index f2102b34..8a9c8063 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -133,6 +133,12 @@ then eval $(ssh-agent) fi +if zplug check gerges/oh-my-zsh-jira-plus +then + JIRA_RAPID_BOARD=true + JIRA_URL=https://spotcap.atlassian.net +fi + # Then, source plugins and add commands to $PATH zplug load -- cgit 1.4.1 From 9595844538a4bcf53bec628874605f8c49d589c5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 17 Mar 2017 10:04:07 +0100 Subject: Move top-level dotfiles to tags --- gemrc | 1 - javascript/.npmrc | 1 + npmrc | 1 - ruby/.gemrc | 1 + 4 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 gemrc create mode 100644 javascript/.npmrc delete mode 100644 npmrc create mode 100644 ruby/.gemrc diff --git a/gemrc b/gemrc deleted file mode 100644 index ab4f7840..00000000 --- a/gemrc +++ /dev/null @@ -1 +0,0 @@ -gem: --user-install -n~/.local/bin \ No newline at end of file diff --git a/javascript/.npmrc b/javascript/.npmrc new file mode 100644 index 00000000..6804f657 --- /dev/null +++ b/javascript/.npmrc @@ -0,0 +1 @@ +prefix = ${HOME}/.local/ \ No newline at end of file diff --git a/npmrc b/npmrc deleted file mode 100644 index 6804f657..00000000 --- a/npmrc +++ /dev/null @@ -1 +0,0 @@ -prefix = ${HOME}/.local/ \ No newline at end of file diff --git a/ruby/.gemrc b/ruby/.gemrc new file mode 100644 index 00000000..ab4f7840 --- /dev/null +++ b/ruby/.gemrc @@ -0,0 +1 @@ +gem: --user-install -n~/.local/bin \ No newline at end of file -- cgit 1.4.1 From e23229baf851e14630889b21d956e23f13aae870 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 17 Mar 2017 10:39:59 +0100 Subject: Replace emacs hook with makefile --- emacs/.emacs.d/Makefile | 19 +++++++++++++++++++ hooks/post-up/emacs | 17 ----------------- 2 files changed, 19 insertions(+), 17 deletions(-) create mode 100644 emacs/.emacs.d/Makefile delete mode 100755 hooks/post-up/emacs diff --git a/emacs/.emacs.d/Makefile b/emacs/.emacs.d/Makefile new file mode 100644 index 00000000..fd51e397 --- /dev/null +++ b/emacs/.emacs.d/Makefile @@ -0,0 +1,19 @@ +define EMACS_TANGLE +(progn\ + (setq vc-follow-symlinks nil)\ + (find-file \"init.org\")\ + (require 'ob-tangle)\ + (org-babel-tangle nil \"init.el\")) +endef + +all: init.elc +.PHONY: all + +init.el: + @emacs --batch --no-init-file --eval "$(EMACS_TANGLE)" --kill + +init.elc: init.el + @emacs --batch --no-init-file --funcall batch-byte-compile init.el + +clean: + rm init.el init.elc diff --git a/hooks/post-up/emacs b/hooks/post-up/emacs deleted file mode 100755 index 05a5c9d1..00000000 --- a/hooks/post-up/emacs +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -EMACS_COMMAND=$(command -v Emacs || command -v emacs) - -if [[ -s $EMACS_COMMAND ]] -then - pushd ~/.emacs.d - emacs --batch --eval "(progn -(setq vc-follow-symlinks nil) -(find-file \"init.org\") -(require 'ob-tangle) -(org-babel-tangle nil \"init.el\") -(byte-compile-file \"init.el\") -(load-file \"init.el\") -)" - popd -fi -- cgit 1.4.1 From 0c4343e413bbc922954b417a639c60dfa007a0da Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 17 Mar 2017 22:01:10 +0100 Subject: Emacs: Fix replace error --- tag-emacs/emacs.d/init.org | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 82e17555..e8a7c3b6 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -2435,10 +2435,8 @@ it much clearer. It’s especially helpful for protoyping and refactoring. ** replace #+BEGIN_SRC emacs-lisp -(use-package replace - :defer t - :config (progn - (setq case-replace nil))) +(with-eval-after-load "replace.el" + (setq case-replace nil)) #+END_SRC ** visual-regexp -- cgit 1.4.1 From 612bf6ce1be2b10ec47f7ac14460059e5b791160 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 17 Mar 2017 22:03:09 +0100 Subject: Emacs: Fix replace load issue --- emacs/.emacs.d/init.org | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 151efbf4..4d9e5fa7 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2436,10 +2436,8 @@ it much clearer. It’s especially helpful for protoyping and refactoring. ** replace #+BEGIN_SRC emacs-lisp -(use-package replace - :defer t - :config (progn - (setq case-replace nil))) +(with-eval-after-load "replace.el" + (setq case-replace nil)) #+END_SRC ** visual-regexp -- cgit 1.4.1 From d8c083931789acd8cdb7f952f5915c84a9a4e78f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 20 Mar 2017 08:46:04 +0100 Subject: Emacs: Point switch-to-dotfiles to new dotfiles folder --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 151efbf4..dd67357a 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -423,7 +423,7 @@ configuration with crux.el #+BEGIN_SRC emacs-lisp (defun switch-to-dotfiles () (interactive) - (projectile-switch-project-by-name (expand-file-name "dotfiles" home-project-directory))) + (projectile-switch-project-by-name (expand-file-name "~/dotfiles"))) #+END_SRC ** The Silver Searcher -- cgit 1.4.1 From 4e43d4e467c1163789e2dc7ce61774bd8771c869 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 20 Mar 2017 08:58:52 +0100 Subject: Update README --- README.org | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/README.org b/README.org index b6c5c092..e1fb43b3 100644 --- a/README.org +++ b/README.org @@ -1,8 +1,14 @@ * Dotfiles -I've organised this repository with [[https://github.com/thoughtbot/rcm][rcm]], using tag- and -host-specific directories. It focuses on zsh and emacs, with some -functions to go from zsh to emacs (and directly to dired and magit). -It doesn't use any configuration frameworks. +I've organised this repository with [[https://www.gnu.org/software/stow/][GNU Stow]]. It focuses on [[http://zsh.sourceforge.net][Z Shell]] and +[[http://emacs.sexy][Emacs]]. -Most likely to work on Linux, OSX and FreeBSD. +It doesn't use any configuration frameworks, just packages installed +via package managers. For Z shell I use [[https://zplug.sh/][zplug]] and for Emacs I use the +built-in package.el via [[https://github.com/jwiegley/use-package][use-package]]. + +It should work on: +- Linux +- OSX +- FreeBSD +- Windows/Ubuntu -- cgit 1.4.1 From 47f9ac570ddfac0700237c66e4d96fa6fa2cb4aa Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 20 Mar 2017 12:23:04 +0100 Subject: Emacs: Update private configuration --- emacs/.emacs.d/private.el.gpg | Bin 2288 -> 2339 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/emacs/.emacs.d/private.el.gpg b/emacs/.emacs.d/private.el.gpg index 784a023b..04290b73 100644 Binary files a/emacs/.emacs.d/private.el.gpg and b/emacs/.emacs.d/private.el.gpg differ -- cgit 1.4.1 From d8364fdf028b6578ee3136d8cc17a36a4c0fbf3d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 20 Mar 2017 12:23:13 +0100 Subject: Emacs: Reconfigure beacon-mode --- emacs/.emacs.d/init.org | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 54b1de68..369da204 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -300,7 +300,12 @@ switching windows. #+BEGIN_SRC emacs-lisp (use-package beacon :diminish beacon-mode - :config (beacon-mode +1)) + :config (progn + (beacon-mode +1) + (setq beacon-blink-delay 0.25 + beacon-blink-duration 0.25 + beacon-size 20 + beacon-color "#a1b56c"))) #+END_SRC ** Renaming major modes -- cgit 1.4.1 From f8ec71a117760f22e2573f1a6d072547d6410f21 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 20 Mar 2017 12:38:16 +0100 Subject: Add installation section to readme --- README.org | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.org b/README.org index e1fb43b3..b22c80b1 100644 --- a/README.org +++ b/README.org @@ -12,3 +12,18 @@ It should work on: - OSX - FreeBSD - Windows/Ubuntu + +** Installation + +Installing a set of dotfiles with stow is simple. For example, with +Emacs: + +#+BEGIN_SRC sh :exports code +stow -S emacs +#+END_SRC + +And then to uninstall + +#+BEGIN_SRC sh :exports code +stow -D emacs +#+END_SRC -- cgit 1.4.1 From 061b7a0149c62f53a75f7f0e8ad63836acf4e334 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 20 Mar 2017 12:42:46 +0100 Subject: Move zsh install commands to readme --- README.org | 17 +++++++++++++++++ hooks/post-up/zsh | 29 ----------------------------- 2 files changed, 17 insertions(+), 29 deletions(-) delete mode 100755 hooks/post-up/zsh diff --git a/README.org b/README.org index b22c80b1..68aaef49 100644 --- a/README.org +++ b/README.org @@ -27,3 +27,20 @@ And then to uninstall #+BEGIN_SRC sh :exports code stow -D emacs #+END_SRC + +*** Z Shell + +My zsh configuration uses [[https://zplug.sh/][zplug]], so that will need to be installed: + +#+BEGIN_SRC sh :exports code +git clone git://github.com/zplug/zplug ~/projects/zplug/ +#+END_SRC + +To install the packages: + +#+BEGIN_SRC sh :exports code +zsh -ic "zplug install" +#+END_SRC + +Note that this will log some errors about a pipe, but that's okay. +zplug is meant to be used in a real interactive shell. diff --git a/hooks/post-up/zsh b/hooks/post-up/zsh deleted file mode 100755 index 3eef6e51..00000000 --- a/hooks/post-up/zsh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env zsh -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 -done -popd - -if [[ ! -d ~/.cache/zsh ]] -then - mkdir -p ~/.cache/zsh -fi - -if [[ -z $commands[zplug] && ! -d ~/projects/zplug/ ]] -then - git clone git://github.com/zplug/zplug ~/projects/zplug/ -fi - -zsh -ic "zplug install" -- cgit 1.4.1 From ea6dafe072ff4f2c2d2483f2906780889e272811 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 20 Mar 2017 14:18:32 +0100 Subject: Add comments to Makefile --- emacs/.emacs.d/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/Makefile b/emacs/.emacs.d/Makefile index fd51e397..3d965e44 100644 --- a/emacs/.emacs.d/Makefile +++ b/emacs/.emacs.d/Makefile @@ -6,8 +6,11 @@ define EMACS_TANGLE (org-babel-tangle nil \"init.el\")) endef +# The first target is the default. `all` is typically defined here. all: init.elc -.PHONY: all + +# These targets don't pertain to files +.PHONY: all clean init.el: @emacs --batch --no-init-file --eval "$(EMACS_TANGLE)" --kill -- cgit 1.4.1 From 05f574baa9e43499a13460bdfbb5140fcf957d6d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 20 Mar 2017 14:19:04 +0100 Subject: Add Emacs section to readme --- README.org | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.org b/README.org index 68aaef49..7333ed34 100644 --- a/README.org +++ b/README.org @@ -44,3 +44,13 @@ zsh -ic "zplug install" Note that this will log some errors about a pipe, but that's okay. zplug is meant to be used in a real interactive shell. + +*** Emacs + +I use org-mode for my Emacs init file. To simplify setup, I created a +[[file:emacs/.emacs.d/Makefile][Makefile]]. + +#+BEGIN_SRC sh :exports code +cd ~/.emacs.d/ +make +#+END_SRC -- cgit 1.4.1 From 3936dc527affdf9dfc6a3089f5e8c2dd57385a65 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 20 Mar 2017 15:10:43 +0100 Subject: Emacs: Install dumb-jump for simple goto-definition --- emacs/.emacs.d/init.org | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 369da204..880e4bc6 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1748,6 +1748,21 @@ A nice completion backend for programming modes. (add-hook 'c-mode-common-hook #'turn-on-ggtags-mode))) #+END_SRC +** dumb-jump + +A "clever" way of implementing go-to-definition across languages: use +a project-wide text search and apply heuristics to the results to +guess a definition. + +#+BEGIN_SRC emacs-lisp +(use-package dumb-jump + :bind (("M-g o" . dumb-jump-go-other-window) + ("M-g j" . dumb-jump-go) + ("M-g x" . dumb-jump-go-prefer-external) + ("M-g z" . dumb-jump-go-prefer-external-other-window)) + :config (setq dumb-jump-selector 'ivy)) +#+END_SRC + ** Lisps *** All -- cgit 1.4.1 From 53f50286e177abb9d1ac4a7c239dcbcc3fed63b7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 20 Mar 2017 15:11:06 +0100 Subject: Emacs/zsh: Enable GNU Global if available --- emacs/.emacs.d/init.org | 2 +- zsh/.config/zsh/.zshenv | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 880e4bc6..7578c72a 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1736,7 +1736,7 @@ A nice completion backend for programming modes. #+BEGIN_SRC emacs-lisp (use-package ggtags - :disabled t + :if (executable-find "gtags") :commands turn-on-ggtags-mode :functions (ggtags-navigation-mode-abort) :config (progn diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index 0be5a7a6..512dc56e 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -45,4 +45,7 @@ then arch=386 ;; esac + + export GTAGSCONF=~/.globalrc + export GTAGSLABEL=ctags fi -- cgit 1.4.1 From cbad111eb644ac7cbbf6bacdf20221497dfeeb17 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 7 Apr 2017 16:29:38 +0200 Subject: Emacs: Add a 1px padding to windows --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 7578c72a..cc6bc2ba 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -183,7 +183,7 @@ Let’s try a basic theme. (show-mode-line))) (add-to-list 'default-frame-alist '(border-width . 0)) - (add-to-list 'default-frame-alist '(internal-border-width . 0)) + (add-to-list 'default-frame-alist '(internal-border-width . 1)) (when (eq window-system 'x) (setq window-divider-default-bottom-width 1 window-divider-default-right-width 1 -- cgit 1.4.1 From 9b322b93fc2e0319010bc6595e2142b3db7d8882 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 7 Apr 2017 16:30:05 +0200 Subject: Emacs: Configure smartscan-mode properly --- emacs/.emacs.d/init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index cc6bc2ba..0b65c44c 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2418,7 +2418,8 @@ Move between instances of a symbol #+BEGIN_SRC emacs-lisp (use-package smartscan :config (progn - (smartscan-mode 1))) + (global-smartscan-mode 1) + (setq smartscan-symbol-selector "symbol"))) #+END_SRC ** move-text -- cgit 1.4.1 From 665f6f9a3b862e2b18d4c6c7ab3a4264e973e54d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 7 Apr 2017 16:30:58 +0200 Subject: Karabiner: Update configuration --- karabiner/.config/karabiner/karabiner.json | 33 +++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/karabiner/.config/karabiner/karabiner.json b/karabiner/.config/karabiner/karabiner.json index 0e866a63..5c488a37 100644 --- a/karabiner/.config/karabiner/karabiner.json +++ b/karabiner/.config/karabiner/karabiner.json @@ -1,8 +1,14 @@ { + "global": { + "check_for_updates_on_startup": true, + "show_in_menu_bar": true, + "show_profile_name_in_menu_bar": false + }, "profiles": [ { "devices": [ { + "disable_built_in_keyboard_if_exists": false, "identifiers": { "is_keyboard": true, "is_pointing_device": false, @@ -13,6 +19,7 @@ "keyboard_type": 41 }, { + "disable_built_in_keyboard_if_exists": false, "identifiers": { "is_keyboard": true, "is_pointing_device": false, @@ -43,20 +50,44 @@ "caps_lock": "delete_or_backspace", "left_command": "left_option", "left_control": "left_command", - "left_option": "left_control", + "left_option": "right_control", "right_command": "right_option", "right_control": "right_command", "right_option": "right_control" + }, + "virtual_hid_keyboard": { + "caps_lock_delay_milliseconds": 0, + "keyboard_type": "ansi" } }, { + "devices": [], + "fn_function_keys": { + "f1": "display_brightness_decrement", + "f10": "mute", + "f11": "volume_decrement", + "f12": "volume_increment", + "f2": "display_brightness_increment", + "f3": "mission_control", + "f4": "launchpad", + "f5": "illumination_decrement", + "f6": "illumination_increment", + "f7": "rewind", + "f8": "play_or_pause", + "f9": "fastforward" + }, "name": "Macbook keyboard", + "selected": false, "simple_modifications": { "caps_lock": "delete_or_backspace", "grave_accent_and_tilde": "non_us_backslash", "left_command": "left_control", "non_us_backslash": "grave_accent_and_tilde", "right_command": "right_control" + }, + "virtual_hid_keyboard": { + "caps_lock_delay_milliseconds": 0, + "keyboard_type": "ansi" } } ] -- cgit 1.4.1 From c892adc7666a9d54f204c6bda1ab4cd688dc1bc5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 7 Apr 2017 16:31:22 +0200 Subject: Emacs: Update private configuration --- emacs/.emacs.d/private.el.gpg | Bin 2339 -> 2438 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/emacs/.emacs.d/private.el.gpg b/emacs/.emacs.d/private.el.gpg index 04290b73..37ce02ae 100644 Binary files a/emacs/.emacs.d/private.el.gpg and b/emacs/.emacs.d/private.el.gpg differ -- cgit 1.4.1 From da106a2392ebebb3cefb425d3f3ba9285a5e647d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 7 Apr 2017 16:41:24 +0200 Subject: Emacs: Make encrypted configuration system-specific --- emacs/.emacs.d/ap-spotcap.local.el.gpg | Bin 0 -> 2438 bytes emacs/.emacs.d/init.org | 26 ++++++++++++++------------ emacs/.emacs.d/private.el.gpg | Bin 2438 -> 0 bytes 3 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 emacs/.emacs.d/ap-spotcap.local.el.gpg delete mode 100644 emacs/.emacs.d/private.el.gpg diff --git a/emacs/.emacs.d/ap-spotcap.local.el.gpg b/emacs/.emacs.d/ap-spotcap.local.el.gpg new file mode 100644 index 00000000..37ce02ae Binary files /dev/null and b/emacs/.emacs.d/ap-spotcap.local.el.gpg differ diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 0b65c44c..6290bb45 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1248,18 +1248,20 @@ rather useful. ; startup and caches it. Don't want emacs daemon to hang because of gpg-agent. (defun load-private-data () (interactive) - (if (not have-private-key) - (message "ERROR: Private GPG key not found") - (unless (or (getenv "GPG_AGENT_INFO") - (getenv "SSH_AUTH_SOCK")) - (start-process "gpg-agent" nil "gpg-agent" "--daemon") - (setenv "SSH_AUTH_SOCK" gpg-agent-ssh-sock)) - (setq password-cache-expiry nil) - (unless (file-exists-p (concat pinentry--socket-dir "pinentry")) - (pinentry-start) - (add-hook 'kill-emacs-hook 'pinentry-stop)) - (add-to-list 'load-suffixes ".el.gpg") - (load-gpg (expand-file-name "private" user-emacs-directory)))) + (if (not (file-exists-p (expand-file-name (concat system-name ".el.gpg") user-emacs-directory))) + (message "No encrypted configuration matches system name `%s'" system-name) + (if (not have-private-key) + (message "ERROR: Private GPG key not found") + (unless (or (getenv "GPG_AGENT_INFO") + (getenv "SSH_AUTH_SOCK")) + (start-process "gpg-agent" nil "gpg-agent" "--daemon") + (setenv "SSH_AUTH_SOCK" gpg-agent-ssh-sock)) + (setq password-cache-expiry nil) + (unless (file-exists-p (concat pinentry--socket-dir "pinentry")) + (pinentry-start) + (add-hook 'kill-emacs-hook 'pinentry-stop)) + (add-to-list 'load-suffixes ".el.gpg") + (load-gpg (expand-file-name system-name user-emacs-directory))))) (defun first-frame-hook (frame) (remove-hook 'after-make-frame-functions #'first-frame-hook) diff --git a/emacs/.emacs.d/private.el.gpg b/emacs/.emacs.d/private.el.gpg deleted file mode 100644 index 37ce02ae..00000000 Binary files a/emacs/.emacs.d/private.el.gpg and /dev/null differ -- cgit 1.4.1 From 5b20693bf72a419d1b526dcf53f8610fba7a39e0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 9 Apr 2017 10:31:55 +0200 Subject: Emacs: Add with-eval-after-load fallback implementation --- emacs/.emacs.d/init.org | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 6290bb45..a3a30a4b 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -18,6 +18,14 @@ Open Emacs with just a plain window. No graphics or messages, please! (remove-hook 'find-file-hooks #'vc-refresh-state) #+END_SRC +** Compatibility + +#+BEGIN_SRC emacs-lisp +(if (version< emacs-version "25.0") + (defmacro with-eval-after-load (file &rest body) + `(eval-after-load ,file (lambda () ,@body)))) +#+END_SRC + ** Scratch buffers I usually use scratch buffers for any sort of text. If I need a programming mode in one, then I’ll just call it manually. I also like -- cgit 1.4.1 From cf641adb86b549bcbdd2c696923dd853309c2930 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 9 Apr 2017 10:43:27 +0200 Subject: Emacs: Don't try to setup cyphejor on old Emacsen --- emacs/.emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index a3a30a4b..cf6ce167 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -324,6 +324,7 @@ modes. #+BEGIN_SRC emacs-lisp (use-package cyphejor :defer 2 + :if (not (version<= emacs-version "24.4")) :config (progn (setq cyphejor-rules `(("emacs" "ε") ("diff" "Δ") -- cgit 1.4.1 From c1b163f6790521a80be588a2bc2b8f0cf790061f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 9 Apr 2017 11:46:01 +0200 Subject: Emacs: Don't try to setup cyphejor on old Emacsen (v2) --- emacs/.emacs.d/init.org | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index cf6ce167..27f45155 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -322,22 +322,22 @@ Diminishing major modes does not happen in the same manner as minor modes. #+BEGIN_SRC emacs-lisp -(use-package cyphejor - :defer 2 - :if (not (version<= emacs-version "24.4")) - :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))) +(unless (version<= emacs-version "24.4") + (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)))) #+END_SRC -- cgit 1.4.1 From 15cee80b0f179ed08fffe0b41976a2749cab363a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 10 Apr 2017 09:20:32 +0200 Subject: Git: add "difftool" command (requires icdiff) --- git/.config/git/config | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/git/.config/git/config b/git/.config/git/config index 6228a08b..ed5fc67a 100644 --- a/git/.config/git/config +++ b/git/.config/git/config @@ -32,3 +32,9 @@ autosquash = true [rerere] enabled = true +[diff] + tool = icdiff +[difftool] + prompt = false +[difftool "icdiff"] + cmd = icdiff --line-numbers $LOCAL $REMOTE \ No newline at end of file -- cgit 1.4.1 From 34d481438d7fb8d1a54d841f7cf3b0a7ecbf1c96 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 12 Apr 2017 14:44:35 +0200 Subject: Add stow wrapper Allows me the freedom to clone the repository anywhere --- stow | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 stow diff --git a/stow b/stow new file mode 100755 index 00000000..c708e49f --- /dev/null +++ b/stow @@ -0,0 +1,2 @@ +#!/bin/sh +stow --target="$HOME" "$@" \ No newline at end of file -- cgit 1.4.1 From f937bfc0e4b8f4946efb0bf65ea20742321f8c79 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 12 Apr 2017 14:45:28 +0200 Subject: Update karabiner configuration --- karabiner/.config/karabiner/karabiner.json | 1 + 1 file changed, 1 insertion(+) diff --git a/karabiner/.config/karabiner/karabiner.json b/karabiner/.config/karabiner/karabiner.json index 5c488a37..d9639e26 100644 --- a/karabiner/.config/karabiner/karabiner.json +++ b/karabiner/.config/karabiner/karabiner.json @@ -82,6 +82,7 @@ "caps_lock": "delete_or_backspace", "grave_accent_and_tilde": "non_us_backslash", "left_command": "left_control", + "left_control": "left_command", "non_us_backslash": "grave_accent_and_tilde", "right_command": "right_control" }, -- cgit 1.4.1 From cbe302dac081990bb5fe9e84545d022659ef5599 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 12 Apr 2017 14:45:40 +0200 Subject: Emacs: Don't force-bind M-g bindings Gnus binds something to M-g that I might want to use --- emacs/.emacs.d/init.org | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 27f45155..44b0a3c7 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2319,11 +2319,11 @@ 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) - ("M-r" . avy-goto-word-1) - ("C-c SPC" . avy-goto-char-timer)) + :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 -- cgit 1.4.1 From 986c9b5b1d7cfa1f6633211a1526322f43cd8e6a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 12 Apr 2017 17:35:41 +0200 Subject: Update private configuration --- emacs/.emacs.d/ap-spotcap.local.el.gpg | Bin 2438 -> 2447 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/emacs/.emacs.d/ap-spotcap.local.el.gpg b/emacs/.emacs.d/ap-spotcap.local.el.gpg index 37ce02ae..c17384c3 100644 Binary files a/emacs/.emacs.d/ap-spotcap.local.el.gpg and b/emacs/.emacs.d/ap-spotcap.local.el.gpg differ -- cgit 1.4.1 From 59de8ca45f6a624663154dbc08fd2808ea30934c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 20 Apr 2017 15:53:16 +0200 Subject: zsh: Rebind C-t --- zsh/.config/zsh/.zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 8a9c8063..e4c9239f 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -230,6 +230,7 @@ fi if zplug check junegunn/fzf then + bindkey '^T' transpose-chars _fzf_compgen_path() { echo "$1" command find -L "$1" \ -- cgit 1.4.1 From 42f48126a24dfadd1a46575c62dd13d4f4d7cc93 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Apr 2017 11:23:21 +0200 Subject: Emacs: Configure flyspell --- emacs/.emacs.d/init.org | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 44b0a3c7..bd7ee3f2 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2138,6 +2138,13 @@ I derived a mode for twig, in order to use its =mode-hook=. ispell-really-hunspell t))))) #+END_SRC +#+BEGIN_SRC emacs-lisp +(use-package flyspell + :config (progn + (add-hook 'text-mode-hook (lambda () (flyspell-mode +1))) + (add-hook 'prog-mode-hook (lambda () (flyspell-prog-mode +1))))) +#+END_SRC + * Scripting Make a shell-script buffer executable after saving it, if it has a shebang. -- cgit 1.4.1 From d3e3f4ce1edce7fb26dd8c359f4f47caf3458d7c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Apr 2017 11:23:30 +0200 Subject: Emacs: Add yarn-run command --- emacs/.emacs.d/init.org | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index bd7ee3f2..aa7add49 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -510,6 +510,11 @@ based upon some folder conventions I use. (projectile-with-default-dir (projectile-project-root) (cmd-to-echo "yarn" (concat "add " package)))) + (defun yarn-run (cmd) + (interactive "scommand: ") + (projectile-with-default-dir (projectile-project-root) + (cmd-to-echo "yarn" (concat "run " cmd)))) + (defun ap/open-work-project (&optional arg) (interactive "P") (ap/open-subfolder-project work-project-directory arg)) -- cgit 1.4.1 From bb3bc1ebb361f41febc7542b153ba1e92a88aa80 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Apr 2017 12:52:11 +0200 Subject: Emacs: Update private configuration --- emacs/.emacs.d/ap-spotcap.local.el.gpg | Bin 2447 -> 2468 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/emacs/.emacs.d/ap-spotcap.local.el.gpg b/emacs/.emacs.d/ap-spotcap.local.el.gpg index c17384c3..f29f0d06 100644 Binary files a/emacs/.emacs.d/ap-spotcap.local.el.gpg and b/emacs/.emacs.d/ap-spotcap.local.el.gpg differ -- cgit 1.4.1 From c7548f30622665198145067d32e44c2348ff7fbc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Apr 2017 14:45:53 +0200 Subject: Emacs: Move insensitive email configuration to init.org --- emacs/.emacs.d/ap-spotcap.local.el.gpg | Bin 2468 -> 2136 bytes emacs/.emacs.d/init.org | 46 +++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/emacs/.emacs.d/ap-spotcap.local.el.gpg b/emacs/.emacs.d/ap-spotcap.local.el.gpg index f29f0d06..e8c75901 100644 Binary files a/emacs/.emacs.d/ap-spotcap.local.el.gpg and b/emacs/.emacs.d/ap-spotcap.local.el.gpg differ diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index aa7add49..43a861df 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1181,6 +1181,52 @@ rather useful. (setq eldoc-idle-delay 0.1) (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) #+END_SRC +* Mail + +** Gnus + +At work, I use gnus for email. Some of the setup is specific to my +workplace, so I keep it in a host-specific, GPG-encrypted file. + +#+BEGIN_SRC emacs-lisp +(use-package gnus + :config (progn + (setq gnus-gcc-mark-as-read t + mml-secure-openpgp-encrypt-to-self t + send-mail-function #'smtpmail-send-it + message-send-mail-function #'smtpmail-send-it))) + +(with-eval-after-load 'gnus-mime + (define-key gnus-mime-button-map " " #'gnus-mime-view-part-externally)) + +(with-eval-after-load "mailcap" + (when (eq system-type 'darwin) + (mailcap-add-mailcap-entry "application" "pdf" '((viewer . "/usr/bin/qlmanage -p %s") (type . "application/pdf"))))) + +(with-eval-after-load "mm-decode" + (add-to-list 'mm-discouraged-alternatives "text/html") + (add-to-list 'mm-discouraged-alternatives "text/richtext")) +#+END_SRC + +** BBDB + +As I'm using Emacs for email, it makes sense to have contact +information here as well. + +#+BEGIN_SRC emacs-lisp +(use-package bbdb + :config (progn + (bbdb-initialize 'gnus 'mail 'message 'pgp) + (bbdb-mua-auto-update-init 'gnus 'message) + (setq bbdb-send-mail-style 'gnus + bbdb-complete-mail-allow-cycling t + bbdb-mua-auto-update t + bbdb-mua-update-interactive-p '(query . create) + bbdb-message-all-addresses t + bbdb-offer-save t + bbdb-offer-to-create 1))) +#+END_SRC + * Misc #+BEGIN_SRC emacs-lisp -- cgit 1.4.1 From c5eb5cf892785852c5bfe2ac672263f7e6696160 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Apr 2017 16:53:14 +0200 Subject: zsh: Move path modification to zshenv --- zsh/.config/zsh/.zshenv | 10 ++++++++++ zsh/.config/zsh/.zshrc | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index 512dc56e..7569f527 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -46,6 +46,16 @@ then ;; esac + if [[ ${path[(I)$HOME/bin ]} ]] + then + path+=($HOME/bin) + fi + + if [[ ${path[(I)$HOME/.local/bin ]} ]] + then + path+=($HOME/.local/bin) + fi + export GTAGSCONF=~/.globalrc export GTAGSLABEL=ctags fi diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index e4c9239f..db32627a 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -24,16 +24,6 @@ HISTFILE=${XDG_CACHE_HOME:=$HOME/.cache}/zsh/history WORDCHARS=${${WORDCHARS//[-.]}//[\/]} -if [[ ${path[(I)$HOME/bin ]} ]] -then - path+=($HOME/bin) -fi - -if [[ ${path[(I)$HOME/.local/bin ]} ]] -then - path+=($HOME/.local/bin) -fi - if [[ -d /opt/local/share/zsh/site-functions ]] then fpath+=(/opt/local/share/zsh/site-functions) -- cgit 1.4.1 From e8ad75cc4b353fce74463c718bf75777562052d6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Apr 2017 16:53:30 +0200 Subject: zsh: Add go/bin to PATH --- zsh/.config/zsh/.zshenv | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index 7569f527..cc647ff7 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -56,6 +56,11 @@ then path+=($HOME/.local/bin) fi + if [[ ${path[(I)$HOME/go/bin ]} ]] + then + path+=($HOME/go/bin) + fi + export GTAGSCONF=~/.globalrc export GTAGSLABEL=ctags fi -- cgit 1.4.1 From 060ce17305dd47a01e5c4f5f45cdbab80b4db7ae Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Apr 2017 20:34:25 +0200 Subject: zsh: Set ghq root --- zsh/.config/zsh/.zshenv | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index cc647ff7..758975f2 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -63,4 +63,6 @@ then export GTAGSCONF=~/.globalrc export GTAGSLABEL=ctags + + export GHQ_ROOT="$HOME/projects:$HOME/go/src" fi -- cgit 1.4.1 From 236bcfdf73cbd7277fbfd3fda2045143819c01bd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Apr 2017 20:34:43 +0200 Subject: zsh: Move zplug to ghq folder --- zsh/.config/zsh/.zshenv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index 758975f2..b026d9a1 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -10,7 +10,7 @@ then . $ZDOTDIR/zshenv.private fi - ZPLUG_HOME=${ZPLUG_HOME:-~/projects/zplug} + ZPLUG_HOME=${ZPLUG_HOME:-~/projects/github.com/zplug/zplug/} if [[ -z $SSH_AUTH_SOCK ]] then -- cgit 1.4.1 From 967dc8a329804a7b3517a34a4b6c35f11ed9edc4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Apr 2017 20:35:24 +0200 Subject: Emacs: Use one projects directory --- emacs/.emacs.d/init.org | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 43a861df..e7cbedc7 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -430,14 +430,13 @@ configuration with crux.el * Projects #+BEGIN_SRC emacs-lisp -(defvar work-project-directory "~/work") -(defvar home-project-directory "~/projects") +(defvar projects-root-directory "~/projects") #+END_SRC #+BEGIN_SRC emacs-lisp (defun switch-to-dotfiles () (interactive) - (projectile-switch-project-by-name (expand-file-name "~/dotfiles"))) + (projectile-switch-project-by-name (expand-file-name "~/projects/git.alanpearce.uk/alan/dotfiles/"))) #+END_SRC ** The Silver Searcher @@ -515,13 +514,9 @@ based upon some folder conventions I use. (projectile-with-default-dir (projectile-project-root) (cmd-to-echo "yarn" (concat "run " cmd)))) - (defun ap/open-work-project (&optional arg) + (defun ap/open-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)) + (ap/open-subfolder-project projects-root-directory arg)) (setq projectile-switch-project-action #'projectile-commander projectile-completion-system 'ivy))) -- cgit 1.4.1 From 0c35d3d3e99aa95c07ad76dac62c002500115b9b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Apr 2017 20:35:52 +0200 Subject: Emacs: Re-implement project-directory functions --- emacs/.emacs.d/init.org | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index e7cbedc7..0f43c846 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -482,16 +482,21 @@ based upon some folder conventions I use. :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 directory-directories (dir) + (seq-filter #'file-directory-p + (directory-files dir t (rx string-start + (char alnum))))) + + (defun project-directories (start-dir) + (seq-map (lambda (x) (file-relative-name x start-dir)) + (seq-mapcat #'directory-directories + (seq-mapcat #'directory-directories + (directory-directories start-dir))))) (defun ap/open-subfolder-project (from-dir &optional arg) (let ((project-dir (projectile-completing-read "Open project: " - (ap/subfolder-projects from-dir)))) + (project-directories from-dir)))) (projectile-switch-project-by-name (expand-file-name project-dir from-dir) arg))) (defun yarn-install (&optional arg) -- cgit 1.4.1 From 2d2bcaa101b46d8c139c1f679e4f679b6ab5af04 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 21 Apr 2017 20:38:39 +0200 Subject: Emacs: Remove dash library usage Emacs lisp already includes seq- functions which work as expected --- emacs/.emacs.d/init.org | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 0f43c846..4a1d757f 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -120,10 +120,6 @@ Ring the bell sometimes, but not so often (ding)))) #+END_SRC -#+BEGIN_SRC emacs-lisp -(use-package dash) -#+END_SRC - ** Colours Let’s try a more minimal theme. @@ -329,7 +325,7 @@ modes. (setq cyphejor-rules `(("emacs" "ε") ("diff" "Δ") ("js2" "js") - ("magit-status" ,(char-to-string (-find #'char-displayable-p '(11942 5848 177)))) + ("magit-status" ,(char-to-string (seq-find #'char-displayable-p '(11942 5848 177)))) ("inferior" "i" :prefix) ("interaction" "i" :prefix) ("interactive" "i" :prefix) @@ -1125,9 +1121,9 @@ helps to make documentation for other languages easier to access `(progn (defun ,fun () (when (require 'counsel-dash nil :noerror) - (-each (-difference ',docsets - (helm-dash-installed-docsets)) - #'counsel-dash-install-docset) + (seq-map #'counsel-dash-install-docset + (seq-difference ',docsets + (helm-dash-installed-docsets))) (setq-local counsel-dash-docsets ',docsets))) (add-hook (quote ,hook) (function ,fun))))) -- cgit 1.4.1 From 7e21e4ccc85a2a119d4ad090031071caa08fa5bc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 22 Apr 2017 16:21:24 +0200 Subject: Emacs: Use ccl for a lisp, if available --- emacs/.emacs.d/init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 4a1d757f..2003d9de 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1920,7 +1920,8 @@ A REPL thing (and more) for Lisp. (if (file-exists-p ql-slime-helper) (load ql-slime-helper)) (slime-setup)) - (setq inferior-lisp-program (executable-find "sbcl")))) + (setq inferior-lisp-program (or (executable-find "sbcl") + (executable-find "ccl64"))))) #+END_SRC *** Clojure -- cgit 1.4.1 From 9f656fdbcdcbc155864b8bebe474ed29af39ff76 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 22 Apr 2017 16:21:40 +0200 Subject: Emacs: Fix error initialising flyspell-prog-mode --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 2003d9de..a15a0c03 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2190,7 +2190,7 @@ I derived a mode for twig, in order to use its =mode-hook=. (use-package flyspell :config (progn (add-hook 'text-mode-hook (lambda () (flyspell-mode +1))) - (add-hook 'prog-mode-hook (lambda () (flyspell-prog-mode +1))))) + (add-hook 'prog-mode-hook #'flyspell-prog-mode))) #+END_SRC * Scripting -- cgit 1.4.1 From 26f20345f819eb8da49ecc6e1eee28a617d2d90a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 23 Apr 2017 21:30:59 +0200 Subject: Emacs: Configure ghq --- emacs/.emacs.d/init.org | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index a15a0c03..f37a8183 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -584,6 +584,17 @@ a particular way, but it changed later. :commands git-timemachine) #+END_SRC +** ghq + +[[https://github.com/motemen/ghq][=ghq=]] clones VCS-backed projects to a common directory. It should +seem familiar to anyone who's used =go get= before. [[https://github.com/rcoedo/emacs-ghq][=emacs-ghq=]] is a +simple wrapper for it. + +#+BEGIN_SRC emacs-lisp +(use-package ghq + :if (executable-find "ghq")) +#+END_SRC + * Files ** Auto-saving -- cgit 1.4.1 From 5e7a227e8090b32949e0e8468f5401475f7fabd1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 23 Apr 2017 21:31:09 +0200 Subject: Emacs: Install and configure hyperspec --- emacs/.emacs.d/init.org | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index f37a8183..6419d281 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1906,6 +1906,14 @@ I don’t work with these as often as I would like (add-hook 'lisp-mode-hook #'set-common-lisp-indentation) #+END_SRC +**** hyperspec + +#+BEGIN_SRC emacs-lisp +(use-package hyperspec + :config (progn + (setq common-lisp-hyperspec-root "file://opt/local/share/doc/lisp/HyperSpec-7-0/"))) +#+END_SRC + **** geiser A REPL thing for Scheme. Hopefully I’ll get to use it more in the -- cgit 1.4.1 From 688f26cd969fbad37721b2522bea2fb8c702c62b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 23 Apr 2017 21:31:23 +0200 Subject: Emacs: Setup slime-asdf plugin --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 6419d281..120b4a32 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1938,7 +1938,7 @@ A REPL thing (and more) for Lisp. (let ((ql-slime-helper (expand-file-name "~/quicklisp/slime-helper.el"))) (if (file-exists-p ql-slime-helper) (load ql-slime-helper)) - (slime-setup)) + (slime-setup '(slime-fancy slime-asdf))) (setq inferior-lisp-program (or (executable-find "sbcl") (executable-find "ccl64"))))) #+END_SRC -- cgit 1.4.1 From 5483239c6f3057ecb66a7be7687ed6118df6f362 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 24 Apr 2017 15:16:14 +0200 Subject: Add ledgerrc --- ledger/.ledgerrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 ledger/.ledgerrc diff --git a/ledger/.ledgerrc b/ledger/.ledgerrc new file mode 100644 index 00000000..db10d148 --- /dev/null +++ b/ledger/.ledgerrc @@ -0,0 +1 @@ +--date-format %Y-%m-%d \ No newline at end of file -- cgit 1.4.1 From ebf4da622c7c25ea7768de7b94925db7c4a1e8c4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 24 Apr 2017 15:29:53 +0200 Subject: Emacs: Bind multiple-cursors keys via override keymap --- emacs/.emacs.d/init.org | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 120b4a32..a2a664a8 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2437,12 +2437,11 @@ saw that multiple-cursors was released for Emacs. #+BEGIN_SRC emacs-lisp (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-" #'mc/mark-all-like-this-dwim) - (bind-key "C-" #'mc/mark-more-like-this-extended) - (bind-key "C-S-L" #'mc/edit-lines))) + :bind* (("C-." . mc/mark-next-like-this) + ("C-," . mc/mark-previous-like-this) + ("M-" . mc/mark-all-like-this-dwim) + ("C-" . mc/mark-more-like-this-extended) + ("C-S-L" . mc/edit-lines))) #+END_SRC ** paredit -- cgit 1.4.1 From dda94cd1c0e1b3ec5f7c7d6002c75b4ce90a2c68 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 24 Apr 2017 15:44:07 +0200 Subject: Emacs: Spell-check camelCased words correctly Configure "run-together" for aspell --- emacs/.emacs.d/init.org | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index a2a664a8..8d25e6cf 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2208,7 +2208,47 @@ I derived a mode for twig, in order to use its =mode-hook=. #+BEGIN_SRC emacs-lisp (use-package flyspell :config (progn - (add-hook 'text-mode-hook (lambda () (flyspell-mode +1))) + (defun flyspell-detect-ispell-args (&optional run-together) + "If RUN-TOGETHER is true, spell check the CamelCase words. + Please note RUN-TOGETHER will make aspell less capable. So it should only be used in prog-mode-hook." + (let (args) + (when ispell-program-name + (cond + ((string-match "aspell$" ispell-program-name) + (setq args (list "--sug-mode=ultra")) + (if run-together + (setq args (append args '("--run-together" "--run-together-limit=16" "--run-together-min=2"))))) + ((string-match "hunspell$" ispell-program-name) + (setq args nil)))) + args)) + ;; `ispell-extra-args' is *always* used when start CLI aspell process + (setq-default ispell-extra-args (flyspell-detect-ispell-args t)) + ;; (setq ispell-cmd-args (flyspell-detect-ispell-args)) + (defadvice ispell-word (around my-ispell-word activate) + (let ((old-ispell-extra-args ispell-extra-args)) + (ispell-kill-ispell t) + ;; use emacs original arguments + (setq ispell-extra-args (flyspell-detect-ispell-args)) + ad-do-it + ;; restore our own ispell arguments + (setq ispell-extra-args old-ispell-extra-args) + (ispell-kill-ispell t))) + + (defadvice flyspell-auto-correct-word (around my-flyspell-auto-correct-word activate) + (let* ((old-ispell-extra-args ispell-extra-args)) + (ispell-kill-ispell t) + ;; use emacs original arguments + (setq ispell-extra-args (flyspell-detect-ispell-args)) + ad-do-it + ;; restore our own ispell arguments + (setq ispell-extra-args old-ispell-extra-args) + (ispell-kill-ispell t))) + (setq flyspell-issue-message-flag nil) + + (defun fly-text-mode-hook-setup () + ;; Turn off RUN-TOGETHER option when spell check text-mode + (setq-local ispell-extra-args (flyspell-detect-ispell-args))) + (add-hook 'text-mode-hook 'fly-text-mode-hook-setup) (add-hook 'prog-mode-hook #'flyspell-prog-mode))) #+END_SRC -- cgit 1.4.1 From 8bec2093fa057e99b3a87b18935bca131045fbfa Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 24 Apr 2017 16:14:28 +0200 Subject: Remove empty section --- emacs/.emacs.d/init.org | 2 -- 1 file changed, 2 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 8d25e6cf..307e0a51 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2388,8 +2388,6 @@ I like to use the clipboard more than the primary selection in X11. ("s" . copy-as-format-slack))) #+END_SRC -** - ** Selection I’m quite used to deleting text by selecting it and typing. Emacs has -- cgit 1.4.1 From 493ca6247b8fad2d6c20221e6baec59334e784ec Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 24 Apr 2017 16:17:08 +0200 Subject: Emacs: Don't change tramp-remote-path I don't think this is necessary any more --- emacs/.emacs.d/init.org | 7 ------- 1 file changed, 7 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 307e0a51..da2a0f07 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -730,13 +730,6 @@ that I can sudo on remote machines (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)))) - -(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"))) #+END_SRC ** ediff -- cgit 1.4.1 From cc70e91eeeefc70bced1e1e126e3b0a2875e7899 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 24 Apr 2017 16:25:55 +0200 Subject: Emacs: Use ghq to get dotfiles directory --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index da2a0f07..f5737ebd 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -432,7 +432,7 @@ configuration with crux.el #+BEGIN_SRC emacs-lisp (defun switch-to-dotfiles () (interactive) - (projectile-switch-project-by-name (expand-file-name "~/projects/git.alanpearce.uk/alan/dotfiles/"))) + (projectile-switch-project-by-name (split-string (shell-command-to-string "ghq list --full-path dotfiles")))) #+END_SRC ** The Silver Searcher -- cgit 1.4.1 From 7f7087d808a6e441e6c3aa36aa8328e93f63d256 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 24 Apr 2017 19:24:44 +0200 Subject: Emacs: Fix switch-to-dotfiles issue --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index f5737ebd..58300552 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -432,7 +432,7 @@ configuration with crux.el #+BEGIN_SRC emacs-lisp (defun switch-to-dotfiles () (interactive) - (projectile-switch-project-by-name (split-string (shell-command-to-string "ghq list --full-path dotfiles")))) + (projectile-switch-project-by-name (car (split-string (shell-command-to-string "ghq list --full-path dotfiles"))))) #+END_SRC ** The Silver Searcher -- cgit 1.4.1 From 819d7f6ea51d9b1b52b3f283e6b9193dcd5f46e6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 24 Apr 2017 19:34:02 +0200 Subject: Emacs: Simplify project opening logic Use ghq to do the heavy lifting --- emacs/.emacs.d/init.org | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 58300552..84609ac2 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -479,22 +479,6 @@ based upon some folder conventions I use. (projectile-global-mode) (add-to-list 'projectile-globally-ignored-directories ".stversions") - (defun directory-directories (dir) - (seq-filter #'file-directory-p - (directory-files dir t (rx string-start - (char alnum))))) - - (defun project-directories (start-dir) - (seq-map (lambda (x) (file-relative-name x start-dir)) - (seq-mapcat #'directory-directories - (seq-mapcat #'directory-directories - (directory-directories start-dir))))) - - (defun ap/open-subfolder-project (from-dir &optional arg) - (let ((project-dir (projectile-completing-read "Open project: " - (project-directories from-dir)))) - (projectile-switch-project-by-name (expand-file-name project-dir from-dir) arg))) - (defun yarn-install (&optional arg) (interactive "P") (projectile-with-default-dir (projectile-project-root) @@ -517,7 +501,11 @@ based upon some folder conventions I use. (defun ap/open-project (&optional arg) (interactive "P") - (ap/open-subfolder-project projects-root-directory arg)) + (let ((project-dir (projectile-completing-read + "Open project: " + (ghq--find-projects)))) + (projectile-switch-project-by-name + (expand-file-name project-dir (ghq--find-root)) arg))) (setq projectile-switch-project-action #'projectile-commander projectile-completion-system 'ivy))) -- cgit 1.4.1 From a90d2adc0804fda23f86a5a444abe7cfaa0e311e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 24 Apr 2017 19:37:18 +0200 Subject: Emacs: Remove unused var --- emacs/.emacs.d/init.org | 4 ---- 1 file changed, 4 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 84609ac2..6ecd9061 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -425,10 +425,6 @@ configuration with crux.el * Projects -#+BEGIN_SRC emacs-lisp -(defvar projects-root-directory "~/projects") -#+END_SRC - #+BEGIN_SRC emacs-lisp (defun switch-to-dotfiles () (interactive) -- cgit 1.4.1 From 3a676d464339bac6f2f3a00ddc9866726da1a014 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 24 Apr 2017 19:42:15 +0200 Subject: Emacs: Setup company-nixos-options on all OSes --- emacs/.emacs.d/init.org | 1 - 1 file changed, 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 6ecd9061..6d0b4e24 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -954,7 +954,6 @@ seems to work perfectly well for me. #+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))) #+END_SRC -- cgit 1.4.1 From d018f3c8491f92de09b12ede0186b5fc8c0d2716 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 10:36:44 +0200 Subject: Emacs: Remove ivy completion inconsistency --- emacs/.emacs.d/init.org | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 6d0b4e24..e464b12a 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1354,8 +1354,7 @@ replacement for helm so far. :demand t :config (progn (ivy-mode 1) - (setq ivy-re-builders-alist '((internal-complete-buffer . ivy--regex-fuzzy) - (t . ivy--regex-plus))) + (setq ivy-re-builders-alist '((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) -- cgit 1.4.1 From 605640f02a13c311fa6a1726f93cb5be52472ff0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 10:37:00 +0200 Subject: Emacs: Install and configure counsel-projectile --- emacs/.emacs.d/init.org | 3 +++ 1 file changed, 3 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index e464b12a..2d7e3f90 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -505,6 +505,9 @@ based upon some folder conventions I use. (setq projectile-switch-project-action #'projectile-commander projectile-completion-system 'ivy))) + +(use-package counsel-projectile + :config (counsel-projectile-on)) #+END_SRC ** vc -- cgit 1.4.1 From cf8274074e6eb6b8f35003a92fae1d90d8e1981d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 10:39:08 +0200 Subject: Emacs: Remove ./ and ../ from ivy file completions --- emacs/.emacs.d/init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 2d7e3f90..0446397b 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1357,7 +1357,8 @@ replacement for helm so far. :demand t :config (progn (ivy-mode 1) - (setq ivy-re-builders-alist '((t . ivy--regex-plus))) + (setq ivy-re-builders-alist '((t . ivy--regex-plus)) + ivy-extra-directories '()) (defun ivy-imenu-get-candidates-from (alist &optional prefix) (cl-loop for elm in alist nconc (if (imenu--subalist-p elm) -- cgit 1.4.1 From 7aa006027e6a4d267bdfde0d5a3cf9a3a0377221 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 12:43:58 +0200 Subject: zsh: Install ghq completion --- zsh/.config/zsh/.zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index db32627a..62feedc2 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -17,6 +17,7 @@ zplug "gerges/oh-my-zsh-jira-plus", as:plugin, if:"[[ ${(SN)HOST%spotcap} ]]" zplug "plugins/yarn", from:oh-my-zsh, defer:2, if:"[[ -n $commands[yarn] ]]", defer:2 zplug "lukechilds/zsh-better-npm-completion", if:"[[ -n $commands[npm] ]]", defer:2 zplug "hlissner/zsh-autopair", defer:2 +zplug "${GOPATH:=$HOME/go}/src/github.com/motemen/ghq/zsh/", from:local, if:"[[ -n $commands[ghq] ]]", defer:2 HISTSIZE=3000 SAVEHIST=10000 -- cgit 1.4.1 From e9d22a78a393d2c2e8d4c92c6d39dad8352f49fa Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 12:44:13 +0200 Subject: zsh: Create function & widget to cd into ghq projects --- zsh/.config/zsh/.zshrc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 62feedc2..d72307da 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -234,6 +234,26 @@ then -name .git -prune -o -name .svn -prune -o -type d \ -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@' } + + fp () { + ghq look $(ghq list | fzf +m) + } + cd-project-widget () { + local cmd="ghq list" + setopt localoptions pipefail 2> /dev/null + local dir="$(eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS" fzf +m)" + if [[ -z "$dir" ]]; then + zle redisplay + return 0 + fi + cd $(ghq list --full-path | grep "$dir") + local ret=$? + zle reset-prompt + typeset -f zle-line-init >/dev/null && zle zle-line-init + return $ret + } + zle -N cd-project-widget + bindkey '\es' cd-project-widget fi unsetopt flow_control # Let me use ^S and ^Q -- cgit 1.4.1 From 509bad987a184c1baa2600a2b1285b84c3977e72 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 12:54:28 +0200 Subject: zsh: Setup fast syntax highlighting --- zsh/.config/zsh/.zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index d72307da..1ef6a7ae 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -6,6 +6,7 @@ zplug "junegunn/fzf-bin", from:gh-r, as:command, rename-to:fzf zplug "junegunn/fzf", as:plugin, use:"shell/*.zsh", defer:2 zplug "junegunn/fzf", as:command, use:"bin/*" zplug "caarlos0/zsh-open-pr", as:plugin +zplug "zdharma/fast-syntax-highlighting", as:plugin zplug "unixorn/tumult.plugin.zsh", as:plugin, if:"[[ $os -eq darwin ]]" if [[ -n $commands[nix-env] ]] then -- cgit 1.4.1 From 791213e75647812be5fa1e4ba9ee3a751cf9ab2e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 14:25:41 +0200 Subject: zsh: Remove oh-my-zsh-jira-plus --- zsh/.config/zsh/.zshrc | 7 ------- 1 file changed, 7 deletions(-) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 1ef6a7ae..c8db8f66 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -14,7 +14,6 @@ then fpath=($fpath $ZPLUG_REPOS/spwhitt/nix-zsh-completions) fi -zplug "gerges/oh-my-zsh-jira-plus", as:plugin, if:"[[ ${(SN)HOST%spotcap} ]]" zplug "plugins/yarn", from:oh-my-zsh, defer:2, if:"[[ -n $commands[yarn] ]]", defer:2 zplug "lukechilds/zsh-better-npm-completion", if:"[[ -n $commands[npm] ]]", defer:2 zplug "hlissner/zsh-autopair", defer:2 @@ -125,12 +124,6 @@ then eval $(ssh-agent) fi -if zplug check gerges/oh-my-zsh-jira-plus -then - JIRA_RAPID_BOARD=true - JIRA_URL=https://spotcap.atlassian.net -fi - # Then, source plugins and add commands to $PATH zplug load -- cgit 1.4.1 From 864aee5a0e4f7574b160e68a9767df9687ffcaa2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 15:01:20 +0200 Subject: zsh: Add eb-active-environment function --- zsh/.config/zsh/.zshrc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index c8db8f66..21a52b15 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -250,4 +250,8 @@ then bindkey '\es' cd-project-widget fi +function function eb-active-environment () { + aws elasticbeanstalk describe-environments | grep $(dig +short $1 CNAME) | cut -f10 +} + unsetopt flow_control # Let me use ^S and ^Q -- cgit 1.4.1 From c25428de28d56b9d0c7c271380d6cfc1cc84fcf8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 15:01:34 +0200 Subject: zsh: Make matching fuzzier It will now complete from the right, if there are no leftward completions, and then from both sides if necessary --- zsh/.config/zsh/.zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 21a52b15..207bff79 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -116,7 +116,7 @@ zle -C hist-complete complete-word _generic zstyle ':completion:hist-complete:*' completer _history bindkey '\e ' hist-complete -zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' '+m:{A-Z}={a-z}' +zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*' zstyle ':completion:*' completer _expand _complete _match if [[ -z $SSH_AUTH_SOCK && $commands[ssh-agent] ]] -- cgit 1.4.1 From 183364854a7c61eb2d46c5536926b707ec2cf2c1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 15:31:26 +0200 Subject: zsh: Add hashed directories for GHQ_ROOT and GOPATH --- zsh/.config/zsh/.zshrc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 207bff79..23f852e1 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -112,6 +112,10 @@ ds () { du -hd1 $1 | sort -h } +# returns the first ghq root, whereas $GHQ_ROOT returns all +hash -d p=$(ghq root) +hash -d go=${GOPATH:-$HOME/go} + zle -C hist-complete complete-word _generic zstyle ':completion:hist-complete:*' completer _history bindkey '\e ' hist-complete -- cgit 1.4.1 From 42e6eb4f62d10a09c24299a61cfe1f4ff354dd09 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 15:35:05 +0200 Subject: Emacs: Re-add . to ivy directory lists --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 0446397b..63111960 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1358,7 +1358,7 @@ replacement for helm so far. :config (progn (ivy-mode 1) (setq ivy-re-builders-alist '((t . ivy--regex-plus)) - ivy-extra-directories '()) + ivy-extra-directories '("./")) (defun ivy-imenu-get-candidates-from (alist &optional prefix) (cl-loop for elm in alist nconc (if (imenu--subalist-p elm) -- cgit 1.4.1 From f81a1a87a6e62912e55b7e1c369acc565afa93cd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 16:07:58 +0200 Subject: Update readme --- README.org | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/README.org b/README.org index 7333ed34..2ed06332 100644 --- a/README.org +++ b/README.org @@ -7,6 +7,11 @@ It doesn't use any configuration frameworks, just packages installed via package managers. For Z shell I use [[https://zplug.sh/][zplug]] and for Emacs I use the built-in package.el via [[https://github.com/jwiegley/use-package][use-package]]. +I've included a wrapper script for =stow= which sets the target +directory to =$HOME=, instead of =../=. This allows the repository to +be cloned anywhere, instead of following the =stow= convention of +being one level below the target directory. + It should work on: - Linux - OSX @@ -15,17 +20,30 @@ It should work on: ** Installation -Installing a set of dotfiles with stow is simple. For example, with +Clone the project anywhere, e.g. with =[[https://github.com/motemen/ghq][ghq]]= + +#+BEGIN_SRC sh :exports code +ghq get git://git.alanpearce.eu/dotfiles +ghq look git.alanpearce.eu/dotfiles +#+END_SRC + +Or just with normal git + +#+BEGIN_SRC sh :exports code +git clone git://git.alanpearce.eu/dotfiles ~/projects/alanpearce-dotfiles +#+END_SRC + +Installing a set of dotfiles with =stow= is simple. For example, with Emacs: #+BEGIN_SRC sh :exports code -stow -S emacs +./stow -S emacs #+END_SRC And then to uninstall #+BEGIN_SRC sh :exports code -stow -D emacs +./stow -D emacs #+END_SRC *** Z Shell -- cgit 1.4.1 From 10c4a6b68627c5d77636dba0224b7be81f046f6c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 17:10:18 +0200 Subject: Ledger: update date format --- ledger/.ledgerrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger/.ledgerrc b/ledger/.ledgerrc index db10d148..e2499f38 100644 --- a/ledger/.ledgerrc +++ b/ledger/.ledgerrc @@ -1 +1 @@ ---date-format %Y-%m-%d \ No newline at end of file +--date-format %F -- cgit 1.4.1 From dfbb1bb931161ee1fdb8a8fdf14fb5e15c810787 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 25 Apr 2017 17:10:30 +0200 Subject: ghq: Assume git as the VCS for my domain --- git/.config/git/config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/git/.config/git/config b/git/.config/git/config index ed5fc67a..b0d56061 100644 --- a/git/.config/git/config +++ b/git/.config/git/config @@ -22,6 +22,8 @@ delete-merged = "!sh -c 'git branch --merged | grep -v "\\*" | grep -v master | grep -v dev | xargs -n 1 git branch -d'" [github] user = alan@alanpearce.uk +[ghq "ssh://alanpearce.eu/"] + vcs = git [diff] algorithm = patience [include] -- cgit 1.4.1 From 803c99c5f1205f82e3f2e2ed7eda77a84450184b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 26 Apr 2017 12:28:32 +0200 Subject: Emacs: change font size to follow DPI --- emacs/.emacs.d/init.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 44b0a3c7..305787e2 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -248,8 +248,8 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (ap/set-fonts "Roboto Mono" 13 "Lucida Grande" 13 t) (ap/set-fonts "Monaco" 10 "Lucida Grande" 12 nil)))) ((eq window-system 'x) - (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 8)) - (ap/set-fonts "Fixed" 8 "Lucida" 8 nil)))) + (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 14)) + (ap/set-fonts "Fixed" 14 "Lucida" 14 nil)))) (ap/set-fonts-according-to-system)) #+END_SRC -- cgit 1.4.1 From b86646d0dd1be04afbfb96f4f2c0d5c2cceaa3c0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 26 Apr 2017 17:02:48 +0200 Subject: zsh: Use gsort in place of sort, if necessary --- zsh/.config/zsh/.zshrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 23f852e1..6b62934e 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -108,8 +108,10 @@ bindkey '\e^b' backward-argument bindkey '\e^f' forward-argument bindkey '\e^k' kill-argument +sort=${commands[gsort]:-$commands[sort]} + ds () { - du -hd1 $1 | sort -h + du -hd1 $1 | $sort -h } # returns the first ghq root, whereas $GHQ_ROOT returns all -- cgit 1.4.1 From 9b369edd4389881ef2010b97c201c1262fb97158 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 27 Apr 2017 09:11:04 +0200 Subject: Emacs: Make sure to use the system CA certificate store --- emacs/.emacs.d/init.org | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 034ac0b2..eaa6b292 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -62,6 +62,8 @@ the buffer to be empty. ("melpa" . 0)) package-menu-async t package-menu-hide-low-priority t) + (when (eq system-type 'darwin) + (add-to-list 'gnutls-trustfiles "/etc/ssl/cert.pem")) (package-initialize) (unless (package-installed-p 'use-package) (package-refresh-contents) -- cgit 1.4.1 From cff2e1af757994b2b992752245cb505e33775cbe Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 27 Apr 2017 10:59:59 +0200 Subject: Emacs: Enable next/previous wrap-around in company popups --- emacs/.emacs.d/init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index eaa6b292..066ed154 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -949,7 +949,8 @@ seems to work perfectly well for me. company-begin-commands '(self-insert-command) company-auto-complete #'company-explicit-action-p company-auto-complete-chars '(?\ ?\( ?\) ?.) - company-tooltip-align-annotations t))) + company-tooltip-align-annotations t + company-selection-wrap-around t))) #+END_SRC #+BEGIN_SRC emacs-lisp -- cgit 1.4.1 From 1ac542cf9b0276d5c833658442baaa46502a1585 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 27 Apr 2017 11:00:31 +0200 Subject: Reduce JS highlighting --- emacs/.emacs.d/init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 066ed154..e2e06a6d 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2039,7 +2039,8 @@ 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) (setq js2-basic-offset 2 - js2-include-node-externs t))) + js2-include-node-externs t + js2-highlight-level 1))) #+END_SRC **** jade (not pug) -- cgit 1.4.1 From 6cf0843ec6ad3674d6d76b2709282bae0e69fd75 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 27 Apr 2017 11:00:45 +0200 Subject: Emacs: Don't ask about dired deletes when using trash --- emacs/.emacs.d/init.org | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index e2e06a6d..5bb1c2ac 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1020,7 +1020,9 @@ copying/moving files between them. (bind-key "^" (lambda () (interactive) (find-alternate-file "..")) dired-mode-map) (setq dired-dwim-target t dired-recursive-copies 'top - dired-recursive-deletes 'top + dired-recursive-deletes (if delete-by-moving-to-trash + 'always + 'top) dired-listing-switches "-alh") (when (and (eq system-type 'darwin) (executable-find "gls")) (setq insert-directory-program (executable-find "gls"))) -- cgit 1.4.1 From bb46cf8f8ff70e89514f30a07b0619df23b6f09d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 27 Apr 2017 11:01:02 +0200 Subject: Emacs: Add macOS TLS CA cert to trustfiles --- emacs/.emacs.d/init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 5bb1c2ac..c99e9578 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -63,7 +63,8 @@ the buffer to be empty. package-menu-async t package-menu-hide-low-priority t) (when (eq system-type 'darwin) - (add-to-list 'gnutls-trustfiles "/etc/ssl/cert.pem")) + (with-eval-after-load "gnutls" + (add-to-list 'gnutls-trustfiles "/etc/ssl/cert.pem"))) (package-initialize) (unless (package-installed-p 'use-package) (package-refresh-contents) -- cgit 1.4.1 From 8a2b251810f31e6fe4caf1217d3647a32fceb905 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 27 Apr 2017 11:58:39 +0200 Subject: Emacs: Use built-in trailing whitespace instead of ws-butler --- emacs/.emacs.d/init.org | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index c99e9578..a0441214 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -669,20 +669,20 @@ with a buffer. (kill-buffer buf))))) #+END_SRC -** Whitespace Butler +** Whitespace -I don’t like it when editors change an entire file’s layout when I -open it. Whitespace butler fixes whitespace only for lines that I’m editing. +Show bad whitespace, so that I can fix it. #+BEGIN_SRC emacs-lisp -(use-package ws-butler - :if window-system - :diminish ws-butler-mode - :config (ws-butler-global-mode 1)) -(if (daemonp) - (add-hook 'before-make-frame-hook (lambda () - (use-package ws-butler - :config (ws-butler-global-mode 1))))) +(defun show-trailing-whitespace-on () + (interactive) + (setq-local show-trailing-whitespace t)) +(defun show-trailing-whitespace-off () + (interactive) + (setq-local show-trailing-whitespace nil)) +(add-hook 'prog-mode-hook #'show-trailing-whitespace-on) +(add-hook 'text-mode-hook #'show-trailing-whitespace-on) +(setq-default show-trailing-whitespace t) #+END_SRC ** shrink-whitespace -- cgit 1.4.1 From 5b4b3300af62aacba527949fbaa5d6e04ce2ced8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 27 Apr 2017 19:02:40 +0200 Subject: Emacs: Show fringe instead of border --- emacs/.emacs.d/init.org | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index a0441214..02199b55 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -172,25 +172,27 @@ Let’s try a basic theme. (defun hide-clutter () (interactive) - (fringe-mode '(0 . 4)) + (fringe-mode '(4 . 8)) (hide-mode-line)) (defun show-clutter () (interactive) - (fringe-mode '(8 . 4)) + (fringe-mode '(8 . 8)) (show-mode-line)) (hide-clutter) (when mode-line-default-hidden (call-interactively #'hide-mode-line)) + (setq-default indicate-buffer-boundaries 'left) + (defun hide-mode-line-if-default-hidden () (if mode-line-default-hidden (hide-mode-line) (show-mode-line))) (add-to-list 'default-frame-alist '(border-width . 0)) - (add-to-list 'default-frame-alist '(internal-border-width . 1)) + (add-to-list 'default-frame-alist '(internal-border-width . 0)) (when (eq window-system 'x) (setq window-divider-default-bottom-width 1 window-divider-default-right-width 1 -- cgit 1.4.1 From 9cd649a0d92b7ba595d22089b16a9b7715f7c80f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 27 Apr 2017 19:03:07 +0200 Subject: Emacs: Let's try a different (HiDPI) font setup --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 02199b55..4a6c292a 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -246,7 +246,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource ((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 "Roboto Mono" 13 "Lucida Grande" 13 t) + (ap/set-fonts "Lekton" 20 "Lucida Grande" 16 t) (ap/set-fonts "Monaco" 10 "Lucida Grande" 12 nil)))) ((eq window-system 'x) (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 14)) -- cgit 1.4.1 From 0979ef5aa493053686876261bf9e3b01b055af6a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 28 Apr 2017 09:29:24 +0200 Subject: zsh: Fix plugin load order --- zsh/.config/zsh/.zshrc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 6b62934e..52907de9 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -3,10 +3,10 @@ source $ZPLUG_HOME/init.zsh zplug "zsh-users/zsh-completions", depth:1, defer:0 zplug "junegunn/fzf-bin", from:gh-r, as:command, rename-to:fzf -zplug "junegunn/fzf", as:plugin, use:"shell/*.zsh", defer:2 +zplug "junegunn/fzf", as:plugin, use:"shell/*.zsh" zplug "junegunn/fzf", as:command, use:"bin/*" zplug "caarlos0/zsh-open-pr", as:plugin -zplug "zdharma/fast-syntax-highlighting", as:plugin +zplug "zdharma/fast-syntax-highlighting", as:plugin, defer:2 zplug "unixorn/tumult.plugin.zsh", as:plugin, if:"[[ $os -eq darwin ]]" if [[ -n $commands[nix-env] ]] then @@ -14,10 +14,10 @@ then fpath=($fpath $ZPLUG_REPOS/spwhitt/nix-zsh-completions) fi -zplug "plugins/yarn", from:oh-my-zsh, defer:2, if:"[[ -n $commands[yarn] ]]", defer:2 -zplug "lukechilds/zsh-better-npm-completion", if:"[[ -n $commands[npm] ]]", defer:2 -zplug "hlissner/zsh-autopair", defer:2 -zplug "${GOPATH:=$HOME/go}/src/github.com/motemen/ghq/zsh/", from:local, if:"[[ -n $commands[ghq] ]]", defer:2 +zplug "plugins/yarn", from:oh-my-zsh, if:"[[ -n $commands[yarn] ]]" +zplug "lukechilds/zsh-better-npm-completion", if:"[[ -n $commands[npm] ]]" +zplug "hlissner/zsh-autopair" +zplug "${GOPATH:=$HOME/go}/src/github.com/motemen/ghq/zsh/", from:local, if:"[[ -n $commands[ghq] ]]" HISTSIZE=3000 SAVEHIST=10000 -- cgit 1.4.1 From e305d934ff13af38caebfa7c8b69591e09a07ae7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 28 Apr 2017 10:43:50 +0200 Subject: Emacs: Enrich imenu in js2-mode --- emacs/.emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 4a6c292a..1bbfa680 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2037,6 +2037,7 @@ it though (if (and (not (string-equal name "IM-Javascript-IDE")) (fboundp #'do-it)) (do-it name))) + (add-hook 'js2-mode-hook #'js2-imenu-extras-mode) (advice-add 'imenu-add-to-menubar :around #'js2--imenu-around) (defun ap/js2-prev-error () (interactive) -- cgit 1.4.1 From 8922442a7409bba0fcc4a8948bafee961f40dcda Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 28 Apr 2017 10:44:05 +0200 Subject: Emacs: Setup js2-refactor-mode --- emacs/.emacs.d/init.org | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 1bbfa680..38d572b3 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2020,9 +2020,7 @@ And add ensime, an IDE-style environment. *** js2-mode This mode is really great for editing Javascript. It turns code into -an AST internally, so it can work with it almost like a lisp. I don’t -think there’s anything as good as paredit/redshank for refactoring in -it though +an AST internally, so it can work with it almost like a lisp. #+BEGIN_SRC emacs-lisp (use-package js2-mode @@ -2049,6 +2047,18 @@ it though js2-highlight-level 1))) #+END_SRC +**** js2-refactor + +Thanks to the AST provided by js2-mode, refactoring is possible. This +library implements some refactorings. + +#+BEGIN_SRC emacs-lisp +(use-package js2-refactor + :config (progn + (add-hook 'js2-mode-hook #'js2-refactor-mode) + (js2r-add-keybindings-with-prefix "C-c C-m"))) +#+END_SRC + **** jade (not pug) Javascript with an inferior node.js process and a debugger? Awesome. -- cgit 1.4.1 From d5bcbda581756736950ffcc37c400ce00b18fe42 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 28 Apr 2017 11:46:45 +0200 Subject: Emacs: remove org-mobile setup --- emacs/.emacs.d/init.org | 43 ------------------------------------------- 1 file changed, 43 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 38d572b3..9f3f3097 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1656,49 +1656,6 @@ I can use this to keep a journal. I should use it. (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)) -(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)))))) -#+END_SRC - **** org-caldav I’ve setup CalDAV on my server, it would be nice to use it directly -- cgit 1.4.1 From b421447256c3acaa911b2a4ef9b3cd810f42a68f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 28 Apr 2017 11:47:11 +0200 Subject: Emacs: Remove org-caldav --- emacs/.emacs.d/init.org | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 9f3f3097..419f38ab 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1656,26 +1656,6 @@ I can use this to keep a journal. I should use it. (org-journal-read-or-display-entry (yesterday-time))))) #+END_SRC -**** org-caldav - -I’ve setup CalDAV on my server, it would be nice to use it directly -from org-mode. Previously I had to wait for org-mobile to sync and -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))) -#+END_SRC - **** org-page I would like to convert my website from using hugo to something else -- cgit 1.4.1 From 6c55e4a29ea01f62af3d8ec73709b3273d4511e1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 28 Apr 2017 12:27:26 +0200 Subject: Emacs: Move hyperspec setup to correct place --- emacs/.emacs.d/init.org | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 419f38ab..f79362e9 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1830,14 +1830,6 @@ I don’t work with these as often as I would like (add-hook 'lisp-mode-hook #'set-common-lisp-indentation) #+END_SRC -**** hyperspec - -#+BEGIN_SRC emacs-lisp -(use-package hyperspec - :config (progn - (setq common-lisp-hyperspec-root "file://opt/local/share/doc/lisp/HyperSpec-7-0/"))) -#+END_SRC - **** geiser A REPL thing for Scheme. Hopefully I’ll get to use it more in the @@ -1863,7 +1855,8 @@ A REPL thing (and more) for Lisp. (if (file-exists-p ql-slime-helper) (load ql-slime-helper)) (slime-setup '(slime-fancy slime-asdf))) - (setq inferior-lisp-program (or (executable-find "sbcl") + (setq common-lisp-hyperspec-root "file://opt/local/share/doc/lisp/HyperSpec-7-0/" + inferior-lisp-program (or (executable-find "sbcl") (executable-find "ccl64"))))) #+END_SRC -- cgit 1.4.1 From 5f247227ca6cce1f24b432df2f98fed5b603cb1c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 28 Apr 2017 14:17:58 +0200 Subject: Emacs: Use use-package for more builtins --- emacs/.emacs.d/init.org | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index f79362e9..098883f0 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2323,7 +2323,8 @@ I’m quite used to deleting text by selecting it and typing. Emacs has a mode for that. #+BEGIN_SRC emacs-lisp -(delete-selection-mode t) +(use-package delsel + :config (delete-selection-mode t)) #+END_SRC Sub-word movement is really nice for camel- and Pascal-case @@ -2582,11 +2583,11 @@ 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))))) +(use-package server + :defer 2 + :if (not (or (daemonp) + (server-running-p server-name))) + :config (server-start)) (setq gc-cons-threshold 800000 file-name-handler-alist file-name-handler-alist-backup) #+END_SRC -- cgit 1.4.1 From 3a159e032814643afcb2068d9f38d2baa4eb4e0c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 28 Apr 2017 14:18:13 +0200 Subject: Emacs: Remove JIRA stuff from work configuration It didn't work anyway. https://github.com/tagoro9/fotingo seems to be the way to go --- emacs/.emacs.d/ap-spotcap.local.el.gpg | Bin 2136 -> 1477 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/emacs/.emacs.d/ap-spotcap.local.el.gpg b/emacs/.emacs.d/ap-spotcap.local.el.gpg index e8c75901..4007dcd8 100644 Binary files a/emacs/.emacs.d/ap-spotcap.local.el.gpg and b/emacs/.emacs.d/ap-spotcap.local.el.gpg differ -- cgit 1.4.1 From d82a74c3da50200a7868022c86e11080235e3272 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 28 Apr 2017 14:25:04 +0200 Subject: Emacs: Improve hook setup with hook-helpers --- emacs/.emacs.d/init.org | 66 +++++++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 098883f0..9b39b279 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -81,6 +81,18 @@ the buffer to be empty. package-enable-at-startup nil) #+END_SRC +** Helpers + +*** Hook Helpers + +An improvement over add-hook with lamda functions that allows +modification and removal, without the boilerplate of an extra function +definition. + +#+BEGIN_SRC emacs-lisp +(use-package hook-helpers) +#+END_SRC + * Customize I don’t really like using customize for normal configuration. Instead, I use it for things that get saved automatically. That’s why @@ -758,8 +770,8 @@ with spaces. Perfect! :defer 1 :config (progn (smart-tabs-insinuate 'c 'cperl 'python) - (add-hook 'php-mode-hook (lambda () - (smart-tabs-mode indent-tabs-mode))))) + (define-hook-helper php-mode () + (smart-tabs-mode indent-tabs-mode)))) #+END_SRC ** editorconfig @@ -777,12 +789,10 @@ 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 + (define-hook-helper after-change-major-mode () + (unless (and (fboundp editorconfig-mode) + 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 @@ -940,7 +950,7 @@ seems to work perfectly well for me. :bind (("C-" . company-complete) ("TAB" . company-indent-or-complete-common)) :init (progn - (add-hook 'prog-mode-hook #'company-mode) + (add-hook 'prog-mode-hook #'company-mode-on) (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-gtags @@ -1705,10 +1715,9 @@ Go has a few packages to inter-operate with other emacs packages. :config (progn (setq company-go-show-annotation t)) :init (progn - (defun ap/company-go-setup () + (define-hook-helper go-mode () (set (make-local-variable 'company-backends) - '(company-go))) - (add-hook 'go-mode-hook #'ap/company-go-setup))) + '(company-go))))) (use-package go-eldoc :commands go-eldoc-setup @@ -1769,7 +1778,11 @@ hook which I trigger in every lispy-mode. :type 'hook :group 'lisp) -(defun ap/lisp-setup () +(create-hook-helper lisp-mode-setup () + :hooks (emacs-lisp-mode-hook + scheme-mode-hook + lisp-mode-hook + clojure-mode-hook) (run-hooks 'lisp-mode-common-hook)) #+END_SRC @@ -1792,7 +1805,6 @@ Customise the modeline-display of =emacs-lisp-mode=. Then make sure it runs the common lisp hooks. #+BEGIN_SRC emacs-lisp -(add-hook 'emacs-lisp-mode-hook #'ap/lisp-setup) (add-hook 'emacs-lisp-mode-hook #'eldoc-mode) #+END_SRC @@ -1813,8 +1825,8 @@ Interactive elisp :defer t :ensure nil :config (progn - (add-hook 'ielm-mode-hook (lambda () - (run-hooks 'lisp-mode-common-hook))))) + (define-hook-helper ielm-mode () + (run-hooks 'lisp-mode-common-hook)))) #+END_SRC *** Scheme & Lisp @@ -1822,12 +1834,9 @@ Interactive elisp I don’t work with these as often as I would like #+BEGIN_SRC emacs-lisp -(add-hook 'scheme-mode-hook #'ap/lisp-setup) -(add-hook 'lisp-mode-hook #'ap/lisp-setup) -(defun set-common-lisp-indentation () +(define-hook-helper lisp-mode () (set (make-local-variable 'lisp-indent-function) #'common-lisp-indent-function)) -(add-hook 'lisp-mode-hook #'set-common-lisp-indentation) #+END_SRC **** geiser @@ -1866,8 +1875,8 @@ A REPL thing (and more) for 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))) + (define-hook-helper cider-repl-mode () + (highlight-changes-mode -1)))) (use-package clj-refactor :defer t @@ -1875,9 +1884,8 @@ A REPL thing (and more) for Lisp. :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))) + (define-hook-helper clojure-mode () + (clj-refactor-mode 1)))) #+END_SRC **** cider @@ -2025,10 +2033,8 @@ completions, besides other IDE-like things. :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))) + (add-hook 'js2-mode-hook #'tern-mode-enable) + (add-hook 'web-mode-hook #'tern-mode-enable))) (with-eval-after-load 'tern (use-package company-tern)) @@ -2216,8 +2222,8 @@ nice, when I remember to use it. (concat (eshell/pwd) "\n$ "))) - (add-hook 'eshell-load-hook (lambda () - (bind-key "C-c C-l" #'counsel-esh-history eshell-mode-map))))) + (define-hook-helper eshell-load () + (bind-key "C-c C-l" #'counsel-esh-history eshell-mode-map)))) (use-package em-smart :ensure nil -- cgit 1.4.1 From d0a0a298e07beeb36c9d8959b6f8a9eabcd02d38 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 28 Apr 2017 14:25:19 +0200 Subject: Emacs: bind js2-refactor's kill command --- emacs/.emacs.d/init.org | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 9b39b279..cd705243 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1992,7 +1992,9 @@ library implements some refactorings. #+BEGIN_SRC emacs-lisp (use-package js2-refactor + :after js2-mode :config (progn + (bind-key "C-k" #'js2r-kill js2-mode-map) (add-hook 'js2-mode-hook #'js2-refactor-mode) (js2r-add-keybindings-with-prefix "C-c C-m"))) #+END_SRC -- cgit 1.4.1 From f9568b1426b41ac68b4839987ceb863296647374 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 28 Apr 2017 14:25:50 +0200 Subject: Emacs: Fix server test --- emacs/.emacs.d/init.org | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index cd705243..35123dfe 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2593,9 +2593,9 @@ Start a server if possible. A daemon is already a server. #+BEGIN_SRC emacs-lisp (use-package server :defer 2 - :if (not (or (daemonp) - (server-running-p server-name))) - :config (server-start)) + :if (not (daemonp)) + :config (unless (server-running-p server-name) + (server-start))) (setq gc-cons-threshold 800000 file-name-handler-alist file-name-handler-alist-backup) #+END_SRC -- cgit 1.4.1 From e2f1b8d344cd2a851663bd90db26bb1036424957 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 28 Apr 2017 15:09:23 +0200 Subject: Emacs: Disable show-trailing-whitespace by default This should avoid it being enabled in "special" buffers. As it's already turned on in prog-mode-hook and text-mode-hook, this should work nicely. --- emacs/.emacs.d/init.org | 1 - 1 file changed, 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 35123dfe..e83f048b 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -696,7 +696,6 @@ Show bad whitespace, so that I can fix it. (setq-local show-trailing-whitespace nil)) (add-hook 'prog-mode-hook #'show-trailing-whitespace-on) (add-hook 'text-mode-hook #'show-trailing-whitespace-on) -(setq-default show-trailing-whitespace t) #+END_SRC ** shrink-whitespace -- cgit 1.4.1 From 7d5c681af4ac7a571e2bd8ff45b020562b5b3611 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 28 Apr 2017 17:05:03 +0200 Subject: Emacs: Include line-spacing in font definition --- emacs/.emacs.d/init.org | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index e83f048b..af8b5a6c 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -239,9 +239,11 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (variable-pitch-mode) (setq cursor-type 'bar)) - (defun ap/set-fonts (mono-face mono-font-size variable-face variable-font-size antialias) + (defun ap/set-fonts (mono-face mono-font-size variable-face variable-font-size antialias &optional new-line-spacing) (if (boundp 'ns-antialias-text) - (setq ns-antialias-text antialias)) + (setq ns-antialias-text antialias)) + (if (boundp 'new-line-spacing) + (setq line-spacing new-line-spacing)) (when mono-face (let ((default-font (font-spec :family mono-face :size mono-font-size))) (add-to-list 'default-frame-alist `(font . ,(format "%s %s" mono-face mono-font-size))) @@ -259,7 +261,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (let ((displays (string-to-number (shell-command-to-string "system_profiler SPDisplaysDataType | grep \"Online: Yes\" | wc -l")))) (if (eq displays 1) (ap/set-fonts "Lekton" 20 "Lucida Grande" 16 t) - (ap/set-fonts "Monaco" 10 "Lucida Grande" 12 nil)))) + (ap/set-fonts "Monaco" 10 "Lucida Grande" 12 nil 0.1)))) ((eq window-system 'x) (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 14)) (ap/set-fonts "Fixed" 14 "Lucida" 14 nil)))) -- cgit 1.4.1 From 9cbe4dc1877a9ad431a5b989710b2e0cff8f3f13 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 1 May 2017 19:26:42 +0200 Subject: Emacs: Fix hook-helper startup error --- emacs/.emacs.d/init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index af8b5a6c..7ac459d2 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -90,7 +90,8 @@ modification and removal, without the boilerplate of an extra function definition. #+BEGIN_SRC emacs-lisp -(use-package hook-helpers) +(eval-and-compile + (use-package hook-helpers)) #+END_SRC * Customize -- cgit 1.4.1 From 6b7459d44bb7a162b1439c761d6c5ace197555e4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 1 May 2017 19:26:56 +0200 Subject: Emacs: Replace deprecated system-name var with fun --- emacs/.emacs.d/init.org | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 7ac459d2..2b12d720 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1314,8 +1314,8 @@ information here as well. ; startup and caches it. Don't want emacs daemon to hang because of gpg-agent. (defun load-private-data () (interactive) - (if (not (file-exists-p (expand-file-name (concat system-name ".el.gpg") user-emacs-directory))) - (message "No encrypted configuration matches system name `%s'" system-name) + (if (not (file-exists-p (expand-file-name (concat (system-name) ".el.gpg") user-emacs-directory))) + (message "No encrypted configuration matches system name `%s'" (system-name)) (if (not have-private-key) (message "ERROR: Private GPG key not found") (unless (or (getenv "GPG_AGENT_INFO") @@ -1327,7 +1327,7 @@ information here as well. (pinentry-start) (add-hook 'kill-emacs-hook 'pinentry-stop)) (add-to-list 'load-suffixes ".el.gpg") - (load-gpg (expand-file-name system-name user-emacs-directory))))) + (load-gpg (expand-file-name (system-name) user-emacs-directory))))) (defun first-frame-hook (frame) (remove-hook 'after-make-frame-functions #'first-frame-hook) -- cgit 1.4.1 From 0b84cca0848b1de1bbe63841df3cc2b83260d690 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 1 May 2017 19:27:30 +0200 Subject: Ledger: Configure weekdays --- ledger/.ledgerrc | 1 + 1 file changed, 1 insertion(+) diff --git a/ledger/.ledgerrc b/ledger/.ledgerrc index e2499f38..319a2029 100644 --- a/ledger/.ledgerrc +++ b/ledger/.ledgerrc @@ -1 +1,2 @@ --date-format %F +--start-of-week 1 -- cgit 1.4.1 From 755ccce37c2e1e72e3934fd66009d1f510b9c456 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 4 May 2017 10:40:12 +0200 Subject: Emacs: Use counsel instead of ivy for imenu --- emacs/.emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 2b12d720..0f33162f 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1419,6 +1419,7 @@ replacement for helm so far. (bind-key "C-c M-x" #'execute-extended-command) (bind-key "C-x C-f" #'counsel-find-file) (bind-key "M-y" #'counsel-yank-pop) + (bind-key "C-x i" #'counsel-imenu) (bind-key "M-y" #'ivy-next-line ivy-minibuffer-map) (defadvice counsel-find-file (after find-file-sudo activate) "Find file as root if necessary." -- cgit 1.4.1 From e4afa65a2fa90ba330b03f34e21cafa0b12b877b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 4 May 2017 11:23:43 +0200 Subject: Emacs: Use counsel-imenu --- emacs/.emacs.d/init.org | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 0f33162f..72db3f1f 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1371,7 +1371,6 @@ replacement for helm so far. (use-package swiper :bind (("C-s" . swiper) ("C-r" . swiper) - ("C-x i" . ivy-imenu-goto) ("C-=" . swiper)) :diminish ivy-mode :demand t @@ -1379,28 +1378,6 @@ replacement for helm so far. (ivy-mode 1) (setq ivy-re-builders-alist '((t . ivy--regex-plus)) ivy-extra-directories '("./")) - (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)) -- cgit 1.4.1 From a25863baab734e3ec7e9957823196158fc944281 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 4 May 2017 13:20:01 +0200 Subject: Emacs: Install and configure eyebrowse --- emacs/.emacs.d/init.org | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 72db3f1f..786411bc 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -906,6 +906,27 @@ point whilst I’m moving about. (setq ns-pop-up-frames nil)) #+END_SRC +** eyebrowse + +Workspaces, a bit like dwm. + +#+BEGIN_SRC emacs-lisp +(use-package eyebrowse + :bind (("s-0" . eyebrowse-switch-to-window-config-0) + ("s-1" . eyebrowse-switch-to-window-config-1) + ("s-2" . eyebrowse-switch-to-window-config-2) + ("s-3" . eyebrowse-switch-to-window-config-3) + ("s-4" . eyebrowse-switch-to-window-config-4) + ("s-5" . eyebrowse-switch-to-window-config-5) + ("s-6" . eyebrowse-switch-to-window-config-6) + ("s-7" . eyebrowse-switch-to-window-config-7) + ("s-8" . eyebrowse-switch-to-window-config-8) + ("s-9" . eyebrowse-switch-to-window-config-9)) + :config (progn + (setq eyebrowse-new-workspace t) + (eyebrowse-mode +1))) +#+END_SRC + ** winner Undo, for window-based commands. -- cgit 1.4.1 From 9934d6381e2b8fcf313f67986adae9de97e89fc8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 5 May 2017 14:56:45 +0200 Subject: Emacs: Unset cursor type A new version of multiple-cursors tries to mimic a bar cursor, but it uses a taller character in the Monaco-10 font, so the lines jump around. --- emacs/.emacs.d/init.org | 1 - 1 file changed, 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 786411bc..aad14dc0 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -180,7 +180,6 @@ Let’s try a basic theme. (setq-default mode-line-format nil) (setq mode-line-default-hidden t))) - (setq-default cursor-type '(bar . 1)) (setq-default cursor-in-non-selected-windows nil) (defun hide-clutter () -- cgit 1.4.1 From e4300ae832559cf882db393e3ca9348ff9bf7864 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 5 May 2017 14:58:56 +0200 Subject: Emacs: Auto-add node_modules bin folders to path --- emacs/.emacs.d/init.org | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index aad14dc0..b9dbfe06 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1999,6 +1999,17 @@ library implements some refactorings. (js2r-add-keybindings-with-prefix "C-c C-m"))) #+END_SRC +**** add-node-modules-path + +Inside a javascript project, it's common to install tools locally to +the project. This will allows emacs to find their executables. + +#+BEGIN_SRC emacs-lisp +(use-package add-node-modules-path + :config (progn + (add-hook 'js2-mode-hook #'add-node-modules-path))) +#+END_SRC + **** jade (not pug) Javascript with an inferior node.js process and a debugger? Awesome. -- cgit 1.4.1 From 52efa35ec7babf988fc81048d89d367005ceee24 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 5 May 2017 21:23:00 +0200 Subject: Emacs: Re-enable melpa I keep reading that melpa-stable isn't really supposed to be used. I'm not sure what it's purpose is, therefore. I liked the idea of having only versioned plugins as it had a reduced chance of breaking things. --- emacs/.emacs.d/init.org | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index b9dbfe06..1ff42a23 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -56,10 +56,10 @@ the buffer to be empty. package-pinned-packages '(("use-package" . melpa-stable) ("diminish" . melpa-stable) ("bind-key" . melpa-stable)) - package-archive-priorities '(("melpa-stable" . 10) + package-archive-priorities '(("melpa" . 10) ("gnu" . 10) - ("marmalade" . 5) - ("melpa" . 0)) + ("melpa-stable" . 5) + ("marmalade" . 0)) package-menu-async t package-menu-hide-low-priority t) (when (eq system-type 'darwin) -- cgit 1.4.1 From b4aa77214316958742e5e45b03a443e5b39d877d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 8 May 2017 14:02:19 +0200 Subject: Emacs: Remove org-page setup It doesn't seem suitable for me. It includes javascript, in particular for code snippet rendering and doesn't allow templates to be defined. --- emacs/.emacs.d/init.org | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 1ff42a23..67c842f9 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1666,19 +1666,6 @@ I can use this to keep a journal. I should use it. (org-journal-read-or-display-entry (yesterday-time))))) #+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. -- cgit 1.4.1 From c84f0d2d15bb70946ef071f6def5f44e0f2656cf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 8 May 2017 14:07:40 +0200 Subject: Emacs: Move window chrome configuration to own block It's not really related to a specific theme. --- emacs/.emacs.d/init.org | 116 +++++++++++++++++++++++++----------------------- 1 file changed, 61 insertions(+), 55 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 67c842f9..668fdb4b 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -161,61 +161,7 @@ Let’s try a basic theme. (set-face-background 'vertical-border "#a1b56c") (set-face-foreground 'vertical-border "#a1b56c") (set-face-background 'window-divider "#a1b56c") - (set-face-foreground 'window-divider "#a1b56c") - - (defvar mode-line-default-format mode-line-format) - (defvar mode-line-default-hidden nil - "Whether to hide the mode line by default") - - (defun show-mode-line () - (interactive) - (setq mode-line-format mode-line-default-format) - (when (called-interactively-p 'interactive) - (setq-default mode-line-format mode-line-default-format) - (setq mode-line-default-hidden nil))) - (defun hide-mode-line () - (interactive) - (setq mode-line-format nil) - (when (called-interactively-p 'interactive) - (setq-default mode-line-format nil) - (setq mode-line-default-hidden t))) - - (setq-default cursor-in-non-selected-windows nil) - - (defun hide-clutter () - (interactive) - (fringe-mode '(4 . 8)) - (hide-mode-line)) - - (defun show-clutter () - (interactive) - (fringe-mode '(8 . 8)) - (show-mode-line)) - (hide-clutter) - - (when mode-line-default-hidden - (call-interactively #'hide-mode-line)) - - (setq-default indicate-buffer-boundaries 'left) - - (defun hide-mode-line-if-default-hidden () - (if mode-line-default-hidden - (hide-mode-line) - (show-mode-line))) - - (add-to-list 'default-frame-alist '(border-width . 0)) - (add-to-list 'default-frame-alist '(internal-border-width . 0)) - (when (eq window-system 'x) - (setq window-divider-default-bottom-width 1 - window-divider-default-right-width 1 - window-divider-default-places t) - (setq mode-line-default-hidden t) - (window-divider-mode +1)) - - (add-hook 'after-change-major-mode-hook #'hide-mode-line-if-default-hidden) - - (add-hook 'minibuffer-setup-hook #'show-mode-line) - (add-hook 'minibuffer-exit-hook #'hide-mode-line))) + (set-face-foreground 'window-divider "#a1b56c"))) #+END_SRC Highlighting quasi-quoted expressions in lisps is quite useful, but I @@ -303,6 +249,66 @@ correct, at least for Liberation Mono. (setq frame-title-format '("%f" (dired-directory dired-directory))) #+END_SRC +** Chrome + +Sometimes I like to hide clutter. Other times, it's useful. + +#+BEGIN_SRC emacs-lisp +(defvar mode-line-default-format mode-line-format) +(defvar mode-line-default-hidden nil + "Whether to hide the mode line by default") + +(defun show-mode-line () + (interactive) + (setq mode-line-format mode-line-default-format) + (when (called-interactively-p 'interactive) + (setq-default mode-line-format mode-line-default-format) + (setq mode-line-default-hidden nil))) +(defun hide-mode-line () + (interactive) + (setq mode-line-format nil) + (when (called-interactively-p 'interactive) + (setq-default mode-line-format nil) + (setq mode-line-default-hidden t))) + +(setq-default cursor-in-non-selected-windows nil) + +(defun hide-clutter () + (interactive) + (fringe-mode '(4 . 8)) + (hide-mode-line)) + +(defun show-clutter () + (interactive) + (fringe-mode '(8 . 8)) + (show-mode-line)) +(hide-clutter) + +(when mode-line-default-hidden + (call-interactively #'hide-mode-line)) + +(setq-default indicate-buffer-boundaries 'left) + +(defun hide-mode-line-if-default-hidden () + (if mode-line-default-hidden + (hide-mode-line) + (show-mode-line))) + +(add-to-list 'default-frame-alist '(border-width . 0)) +(add-to-list 'default-frame-alist '(internal-border-width . 0)) +(when (eq window-system 'x) + (setq window-divider-default-bottom-width 1 + window-divider-default-right-width 1 + window-divider-default-places t) + (setq mode-line-default-hidden t) + (window-divider-mode +1)) + +(add-hook 'after-change-major-mode-hook #'hide-mode-line-if-default-hidden) + +(add-hook 'minibuffer-setup-hook #'show-mode-line) +(add-hook 'minibuffer-exit-hook #'hide-mode-line) +#+END_SRC + ** Highlight Changes Highlight what just changed when I undo, yank, and so on. -- cgit 1.4.1 From bb0338c94a1ce73394a3e9f4eb418110a8a29821 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 8 May 2017 14:08:19 +0200 Subject: Emacs: Increase font size I started working in a new office, with the screen further away. I don't think Monaco 10 will be comfortable for long periods of work --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 668fdb4b..07ce03a5 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -207,7 +207,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (let ((displays (string-to-number (shell-command-to-string "system_profiler SPDisplaysDataType | grep \"Online: Yes\" | wc -l")))) (if (eq displays 1) (ap/set-fonts "Lekton" 20 "Lucida Grande" 16 t) - (ap/set-fonts "Monaco" 10 "Lucida Grande" 12 nil 0.1)))) + (ap/set-fonts "Monaco" 14 "Lucida Grande" 12 nil 0.1)))) ((eq window-system 'x) (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 14)) (ap/set-fonts "Fixed" 14 "Lucida" 14 nil)))) -- cgit 1.4.1 From e71d8e38157f7952f6c70f1c43110d67799b3fe5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 8 May 2017 15:25:03 +0200 Subject: Emacs: Remove missing packages - xrdb-mode - smart-scan --- emacs/.emacs.d/init.org | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 07ce03a5..eb5bd2bd 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1486,11 +1486,6 @@ set environment variables for projects. 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))) - (use-package haskell-mode :mode (("\\.hs\\'" . haskell-mode))) @@ -2475,16 +2470,6 @@ nice as the real version (add-hook 'coffee-mode-hook #'turn-off-smartparens-mode))) #+END_SRC -** smart-scan - -Move between instances of a symbol - -#+BEGIN_SRC emacs-lisp -(use-package smartscan - :config (progn - (global-smartscan-mode 1) - (setq smartscan-symbol-selector "symbol"))) -#+END_SRC ** move-text -- cgit 1.4.1 From 72551a93b109857bc9c2c044e253156ce90a75db Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 8 May 2017 17:07:53 +0200 Subject: Emacs: Try eziam-light-theme --- emacs/.emacs.d/init.org | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index eb5bd2bd..e82c40e4 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -152,6 +152,7 @@ Let’s try a basic theme. #+BEGIN_SRC emacs-lisp (use-package basic-theme :if (display-graphic-p) + :disabled t :config (progn (load-theme 'basic t) @@ -164,6 +165,17 @@ Let’s try a basic theme. (set-face-foreground 'window-divider "#a1b56c"))) #+END_SRC +Eziam looks nice, too + +#+BEGIN_SRC emacs-lisp +(use-package eziam-light-theme + :ensure eziam-theme + :defines (eziam-scale-headings) + :config (progn + (setq eziam-scale-headings nil) + (load-theme 'eziam-light t))) +#+END_SRC + Highlighting quasi-quoted expressions in lisps is quite useful, but I don't need it all the time. I'll keep it around for a while so that I can enable it if needed. -- cgit 1.4.1 From 1e375acc1cb7d23775fd39df71c0206fc66392ac Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 8 May 2017 17:08:06 +0200 Subject: Emacs: Make macOS variable-pitch font size consistent --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index e82c40e4..5d115d93 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -219,7 +219,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (let ((displays (string-to-number (shell-command-to-string "system_profiler SPDisplaysDataType | grep \"Online: Yes\" | wc -l")))) (if (eq displays 1) (ap/set-fonts "Lekton" 20 "Lucida Grande" 16 t) - (ap/set-fonts "Monaco" 14 "Lucida Grande" 12 nil 0.1)))) + (ap/set-fonts "Monaco" 14 "Lucida Grande" 14 nil 0.1)))) ((eq window-system 'x) (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 14)) (ap/set-fonts "Fixed" 14 "Lucida" 14 nil)))) -- cgit 1.4.1 From 4bdc613a8980602dd35ec0ead87c6411ae4590de Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 10 May 2017 10:45:03 +0200 Subject: Emacs: replace Jade (JS IDE) with Indium Jade was renamed due to trademark issues. --- emacs/.emacs.d/init.org | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 5d115d93..129ac66f 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2010,19 +2010,28 @@ the project. This will allows emacs to find their executables. (add-hook 'js2-mode-hook #'add-node-modules-path))) #+END_SRC -**** jade (not pug) +**** Indium Javascript with an inferior node.js process and a debugger? Awesome. To debug with node, use version 6.9.1 or later of node and run it with ~--inspect~ and, to break on the first line, ~--debug-brk~. -For Chrom*, it needs to be launched with ~--remote-debugging-port=9222~ +For Chrom*, it needs to be launched with +~--remote-debugging-port=9222~ + +Node will tell you to open an URL in Chrome: + +~chrome-devtools://inspector.html?...&ws=127.0.0.1:PORT/PATH~ + +Instead, do this: + +~M-x indium-connect-to-nodejs RET 127.0.0.1 RET PORT RET~ #+BEGIN_SRC emacs-lisp -(use-package jade +(use-package indium :config (progn - (add-hook 'js2-mode-hook #'jade-interaction-mode))) + (add-hook 'js2-mode-hook #'indium-interaction-mode))) #+END_SRC *** coffee-mode -- cgit 1.4.1 From 36cfb5b801d13bf3ff102a31512613366a296edc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 10 May 2017 14:47:04 +0200 Subject: Emacs: Re-bind execute-extended-command Move it away from eval-defun, as C-u C-M-x is useful for debugging elisp --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 129ac66f..6f6b7531 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -437,7 +437,7 @@ Option/alt, then Control. (bind-key* "s-x" (define-prefix-command 'super-x-map)) (bind-key* "s-," #'switch-to-dotfiles) -(bind-key* "C-M-x" #'execute-extended-command) +(bind-key* "C-x M-x" #'execute-extended-command) (set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) #+END_SRC -- cgit 1.4.1 From c586ed0ec710bfd03dfa5e51333e5494ec247f12 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 10 May 2017 14:47:57 +0200 Subject: Git: Add configuration for spotcap repositories --- git/.config/git/config | 4 ++++ git/.config/git/config-spotcap | 2 ++ 2 files changed, 6 insertions(+) create mode 100644 git/.config/git/config-spotcap diff --git a/git/.config/git/config b/git/.config/git/config index b0d56061..579c2269 100644 --- a/git/.config/git/config +++ b/git/.config/git/config @@ -24,6 +24,10 @@ user = alan@alanpearce.uk [ghq "ssh://alanpearce.eu/"] vcs = git +[includeIf "gitdir:github.com/Spotcap/"] + path = config-spotcap +[includeIf "gitdir:bitbucket.org/spotcap-engineering/"] + path = config-spotcap [diff] algorithm = patience [include] diff --git a/git/.config/git/config-spotcap b/git/.config/git/config-spotcap new file mode 100644 index 00000000..a340c2ed --- /dev/null +++ b/git/.config/git/config-spotcap @@ -0,0 +1,2 @@ +[user] +email = alan.pearce@spotcap.com \ No newline at end of file -- cgit 1.4.1 From 56b360cb19bb36c4be4b7d3b4013e519f1f0b9c3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 10 May 2017 15:00:32 +0200 Subject: Update email addresses --- emacs/.emacs.d/init.org | 2 +- git/.config/git/config | 4 ++-- hg/.hgrc | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 6f6b7531..7cdf2090 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -37,7 +37,7 @@ the buffer to be empty. ** Personal Information #+BEGIN_SRC emacs-lisp -(setq user-mail-address "alan@alanpearce.co.uk" +(setq user-mail-address "alan@alanpearce.eu" user-full-name "Alan Pearce") #+end_src diff --git a/git/.config/git/config b/git/.config/git/config index 579c2269..f3a62f67 100644 --- a/git/.config/git/config +++ b/git/.config/git/config @@ -1,5 +1,5 @@ [user] - email = alan@alanpearce.uk + email = alan@alanpearce.eu name = Alan Pearce [color] branch = auto @@ -21,7 +21,7 @@ pr = pull-request delete-merged = "!sh -c 'git branch --merged | grep -v "\\*" | grep -v master | grep -v dev | xargs -n 1 git branch -d'" [github] - user = alan@alanpearce.uk + user = alan@alanpearce.eu [ghq "ssh://alanpearce.eu/"] vcs = git [includeIf "gitdir:github.com/Spotcap/"] diff --git a/hg/.hgrc b/hg/.hgrc index 2f16f27e..9cd03157 100644 --- a/hg/.hgrc +++ b/hg/.hgrc @@ -1,5 +1,5 @@ [ui] -username = Alan Pearce +username = Alan Pearce [extensions] purge = -- cgit 1.4.1 From 7c3d8b535caa65ac6c861fd281af0147f0307855 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 10 May 2017 15:00:53 +0200 Subject: Recode hgrc to use unix EOL --- hg/.hgrc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hg/.hgrc b/hg/.hgrc index 9cd03157..97687430 100644 --- a/hg/.hgrc +++ b/hg/.hgrc @@ -1,9 +1,9 @@ -[ui] -username = Alan Pearce - -[extensions] -purge = -progress = -color = -eol = +[ui] +username = Alan Pearce + +[extensions] +purge = +progress = +color = +eol = record = \ No newline at end of file -- cgit 1.4.1 From b53d38cfcd688467a7133d6077d62467946522ee Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 10 May 2017 16:10:53 +0200 Subject: Emacs: Configure desktop mode Auto-save Emacs' state if a desktop file exists. This is probably as DWIM as I need. --- emacs/.emacs.d/init.org | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 7cdf2090..96b3fe92 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -944,6 +944,27 @@ Workspaces, a bit like dwm. (eyebrowse-mode +1))) #+END_SRC +* Sessions + +** Desktop +Save my Emacs session and restore it on startup. + +#+BEGIN_SRC emacs-lisp +(use-package desktop + :ensure nil + :config (progn + (setq desktop-dirname (expand-file-name "desktop/" user-emacs-directory) + desktop-base-file-name "emacs.desktop" + desktop-base-lock-name "lock" + desktop-path (list desktop-dirname) + desktop-save 'if-exists + desktop-files-not-to-save "^$" + desktop-load-locked-desktop nil) + (unless (file-directory-p desktop-dirname) + (make-directory desktop-dirname)) + (desktop-save-mode 1))) +#+END_SRC + ** winner Undo, for window-based commands. -- cgit 1.4.1 From 3559998106d1fddaf20022509a003f3721026253 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 11 May 2017 11:58:28 +0200 Subject: Emacs: Improve org-mode navigation --- emacs/.emacs.d/init.org | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 96b3fe92..afa594e9 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1656,6 +1656,10 @@ Org is wünderbar. (plain-list-item . auto)) org-fontify-done-headline t + org-goto-interface 'outline-path-completion + + org-outline-path-complete-in-steps nil + org-todo-keywords '((sequence "BACKLOG(b)" "TODO(t)" "WAIT(w@/!)" "STARTED(s!)" "|" "DONE(d!)") (sequence "|" "CANCELLED(c@)")) org-log-into-drawer "LOGBOOK") -- cgit 1.4.1 From d072b85a000e9f81ff6685fb39422825ceb218c8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 11 May 2017 11:58:45 +0200 Subject: Emacs: Setup beginend mode --- emacs/.emacs.d/init.org | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index afa594e9..d9a9ab04 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2449,6 +2449,17 @@ and doesn’t go back to the same place more than once. :bind ("C-c C-SPC" . goto-last-change)) #+END_SRC +** beginend + +In special buffers, I would rather have =M->= and =M-<= goto the +logical beginning/end rather than the physical ones. + +#+BEGIN_SRC emacs-lisp +(use-package beginend + :config (progn + (beginend-setup-all))) +#+END_SRC + ** multiple-cursors I mentioned before that I’d used Sublime Text before. Multiple -- cgit 1.4.1 From 26ab88d706e7de3a10310ab0b50cea62b8b0f23a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 12 May 2017 14:47:56 +0200 Subject: Emacs: Fix initialisation of tern-mode --- emacs/.emacs.d/init.org | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index d9a9ab04..d55445bd 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2080,8 +2080,10 @@ completions, besides other IDE-like things. :defer 5 :config (progn (setq tern-command (list (executable-find "tern"))) - (add-hook 'js2-mode-hook #'tern-mode-enable) - (add-hook 'web-mode-hook #'tern-mode-enable))) + (create-hook-helper tern-mode-on () + :hooks (web-mode-hook + js2-mode-hook) + (tern-mode +1)))) (with-eval-after-load 'tern (use-package company-tern)) -- cgit 1.4.1 From e708bfa96dbeb11778ed4badee18e7c3cb06b73d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 12 May 2017 14:48:21 +0200 Subject: Update Karabiner configuration --- karabiner/.config/karabiner/karabiner.json | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/karabiner/.config/karabiner/karabiner.json b/karabiner/.config/karabiner/karabiner.json index d9639e26..2488e95a 100644 --- a/karabiner/.config/karabiner/karabiner.json +++ b/karabiner/.config/karabiner/karabiner.json @@ -15,7 +15,7 @@ "product_id": 602, "vendor_id": 1452 }, - "ignore": true, + "ignore": false, "keyboard_type": 41 }, { @@ -51,6 +51,7 @@ "left_command": "left_option", "left_control": "left_command", "left_option": "right_control", + "menu": "fn", "right_command": "right_option", "right_control": "right_command", "right_option": "right_control" @@ -61,7 +62,28 @@ } }, { - "devices": [], + "devices": [ + { + "disable_built_in_keyboard_if_exists": false, + "identifiers": { + "is_keyboard": true, + "is_pointing_device": false, + "product_id": 602, + "vendor_id": 1452 + }, + "ignore": false + }, + { + "disable_built_in_keyboard_if_exists": false, + "identifiers": { + "is_keyboard": true, + "is_pointing_device": false, + "product_id": 33290, + "vendor_id": 1452 + }, + "ignore": true + } + ], "fn_function_keys": { "f1": "display_brightness_decrement", "f10": "mute", -- cgit 1.4.1 From 0aaf9b4337cee8847a1732b56224a15e7b9c4dc6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 12 May 2017 15:50:52 +0200 Subject: Emacs: Use any eslint_d instead of global With the package add-node-modules-path, this allows using a local version of eslint_d --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index d55445bd..f87f7c40 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1727,7 +1727,7 @@ On-the-fly error checking in programming modes? Yes please. (global-flycheck-mode) (setq flycheck-check-syntax-automatically '(save new-line mode-enabled)) (if (executable-find "eslint_d") - (setq flycheck-javascript-eslint-executable (executable-find "eslint_d"))))) + (setq flycheck-javascript-eslint-executable "eslint_d")))) #+END_SRC ** golang -- cgit 1.4.1 From 3b8e49259080ac24eb4015d9a8ce94aba753e123 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 12 May 2017 15:51:30 +0200 Subject: Emacs: Setup flycheck-flow --- emacs/.emacs.d/init.org | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index f87f7c40..628c90ec 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1730,6 +1730,14 @@ On-the-fly error checking in programming modes? Yes please. (setq flycheck-javascript-eslint-executable "eslint_d")))) #+END_SRC +*** flycheck-flow + +#+BEGIN_SRC emacs-lisp +(use-package flycheck-flow + :config (progn + (flycheck-add-next-checker 'javascript-eslint 'javascript-flow))) +#+END_SRC + ** golang Go has a few packages to inter-operate with other emacs packages. -- cgit 1.4.1 From f28fe7ef1170a5049f294974b57a6dc7292986b0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 1 May 2017 13:51:15 +0200 Subject: zsh: Add check for Windows Subsystem for Linux --- zsh/.config/zsh/.zshenv | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index b026d9a1..114e5ce9 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -37,6 +37,15 @@ then ;; esac + if [[ $os == "linux" ]] + then + read osrelease < /proc/sys/kernel/osrelease + if [[ $osrelease =~ Microsoft$ ]] + then + windows=1 + fi + fi + case $MACHTYPE in *64) arch=amd64 -- cgit 1.4.1 From e29baf020212cff526820efef6582c671b1e01f5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 15 May 2017 14:26:25 +0200 Subject: Emacs: Set switch/case indentation to follow most styles --- emacs/.emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 628c90ec..0de6a180 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2014,6 +2014,7 @@ an AST internally, so it can work with it almost like a lisp. (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) (setq js2-basic-offset 2 + js-switch-indent-offset 2 js2-include-node-externs t js2-highlight-level 1))) #+END_SRC -- cgit 1.4.1 From d9619a25b276c5aff47b70c15cf2942fa2b9313b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 15 May 2017 14:26:54 +0200 Subject: Emacs: Change macOS fonts across emacs-mac and normal emacs --- emacs/.emacs.d/init.org | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 0de6a180..373ab26c 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -215,11 +215,12 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (cond ((eq window-system 'w32) (ap/set-fonts "Liberation Mono" 11 "Segoe UI" 11 t)) - ((eq window-system 'ns) + ((or (eq window-system 'mac) + (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 "Lekton" 20 "Lucida Grande" 16 t) - (ap/set-fonts "Monaco" 14 "Lucida Grande" 14 nil 0.1)))) + (ap/set-fonts "Monaco" 16 "Lucida Grande" 16 t 0.2) + (ap/set-fonts "Monoid" 12 "Helvetica Neue" 12 t 0.1)))) ((eq window-system 'x) (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 14)) (ap/set-fonts "Fixed" 14 "Lucida" 14 nil)))) -- cgit 1.4.1 From 89c2e4af81f14a9037d73f6e025ed8a290f961d6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 15 May 2017 14:32:38 +0200 Subject: Emacs: Add "live coding" command --- emacs/.emacs.d/init.org | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 373ab26c..79aa7c59 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2183,6 +2183,33 @@ I derived a mode for twig, in order to use its =mode-hook=. (add-to-list 'auto-mode-alist '("\\.html\\.twig\\'" . twig-mode)) #+END_SRC +** Live coding + +Sometimes I might want to show off my emacs usage. + +#+BEGIN_SRC emacs-lisp +(defun live-coding () + (interactive) + (ap/set-fonts "SF Mono" 18 nil nil t 0.1) + (global-command-log-mode 1)) + +(defun live-coding-stop () + (interactive) + (ap/set-fonts-according-to-system) + (global-command-log-mode -1)) +#+END_SRC + +*** command-log-mode + +#+BEGIN_SRC emacs-lisp +(use-package command-log-mode + :defines command-log-mode-key-binding-open-log + :init (progn + (setq command-log-mode-key-binding-open-log nil + command-log-mode-auto-show t + command-log-mode-is-global t))) +#+END_SRC + * Spelling #+BEGIN_SRC emacs-lisp -- cgit 1.4.1 From 14250a90251baa9ef9e343a740fd0f34a804b0d1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 16 May 2017 12:49:30 +0200 Subject: yarn: Add yarn configuration --- yarn/.yarnrc | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 yarn/.yarnrc diff --git a/yarn/.yarnrc b/yarn/.yarnrc new file mode 100644 index 00000000..95e833e4 --- /dev/null +++ b/yarn/.yarnrc @@ -0,0 +1,2 @@ +disable-self-update-check true +yarn-offline-mirror-pruning true -- cgit 1.4.1 From 9d60ad2e8270e95549bd4bcecd56aa158fbc4629 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 18 May 2017 14:24:54 +0200 Subject: zsh: Use zplugin in place of zplug (except fzf) zplugin seems cleaner than zplug, but it doesn't support github releases, so keep zplug around for now, to load fzf --- zsh/.config/zsh/.zshrc | 56 +++++++++++++++++++++++++++++++++++------------- zsh/.config/zsh/setup.sh | 7 ++++++ 2 files changed, 48 insertions(+), 15 deletions(-) create mode 100755 zsh/.config/zsh/setup.sh diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 52907de9..c8139f1b 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -1,23 +1,10 @@ # -*- mode: sh; -*- source $ZPLUG_HOME/init.zsh +source $HOME/.zplugin/bin/zplugin.zsh -zplug "zsh-users/zsh-completions", depth:1, defer:0 zplug "junegunn/fzf-bin", from:gh-r, as:command, rename-to:fzf zplug "junegunn/fzf", as:plugin, use:"shell/*.zsh" zplug "junegunn/fzf", as:command, use:"bin/*" -zplug "caarlos0/zsh-open-pr", as:plugin -zplug "zdharma/fast-syntax-highlighting", as:plugin, defer:2 -zplug "unixorn/tumult.plugin.zsh", as:plugin, if:"[[ $os -eq darwin ]]" -if [[ -n $commands[nix-env] ]] -then - zplug "spwhitt/nix-zsh-completions", as:plugin - fpath=($fpath $ZPLUG_REPOS/spwhitt/nix-zsh-completions) -fi - -zplug "plugins/yarn", from:oh-my-zsh, if:"[[ -n $commands[yarn] ]]" -zplug "lukechilds/zsh-better-npm-completion", if:"[[ -n $commands[npm] ]]" -zplug "hlissner/zsh-autopair" -zplug "${GOPATH:=$HOME/go}/src/github.com/motemen/ghq/zsh/", from:local, if:"[[ -n $commands[ghq] ]]" HISTSIZE=3000 SAVEHIST=10000 @@ -130,9 +117,47 @@ then eval $(ssh-agent) fi -# Then, source plugins and add commands to $PATH +# Plugins + zplug load +zplugin ice blockf +zplugin load "zsh-users/zsh-completions" +zplugin load "hlissner/zsh-autopair" +zplugin load "zdharma/fast-syntax-highlighting" +zplugin load "caarlos0/zsh-open-pr" + + +if [[ $os -eq darwin ]] +then + zplugin load "unixorn/tumult.plugin.zsh" +fi + +if [[ -n $commands[npm] ]] +then + zplugin load "lukechilds/zsh-better-npm-completion" +fi + +if [[ -n $commands[yarn] ]] +then + zplugin snippet "https://github.com/robbyrussell/oh-my-zsh/raw/master/plugins/yarn/yarn.plugin.zsh" +fi + +if [[ -n $commands[nix-env] ]] +then + zplugin load "spwhitt/nix-zsh-completions" +fi + +if [[ -n $commands[ghq] ]] +then + fpath+=("${GOPATH:=$HOME/go}/src/github.com/motemen/ghq/zsh/") +fi + +autoload -Uz compinit +compinit + +zplugin cdreplay -q + # General configuration if [[ -n $commands[hub] ]] @@ -261,3 +286,4 @@ function function eb-active-environment () { } unsetopt flow_control # Let me use ^S and ^Q + diff --git a/zsh/.config/zsh/setup.sh b/zsh/.config/zsh/setup.sh new file mode 100755 index 00000000..61b54417 --- /dev/null +++ b/zsh/.config/zsh/setup.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env zsh + +mkdir $HOME/.zplugin +git clone https://github.com/psprint/zplugin.git $HOME/.zplugin/bin + +zcompile $HOME/.zplugin/bin/zplugin.zsh + -- cgit 1.4.1 From 36b4f758048497cc79ab6855b05f3fd6f1ce6c17 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 18 May 2017 16:02:35 +0200 Subject: zsh: Use anyframe as a fzf wrapper Works around the problem of not being able to use the fzf shell code with zplugin --- zsh/.config/zsh/.zshrc | 45 ++++++++++----------------------------------- 1 file changed, 10 insertions(+), 35 deletions(-) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index c8139f1b..16380e4c 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -2,9 +2,8 @@ source $ZPLUG_HOME/init.zsh source $HOME/.zplugin/bin/zplugin.zsh -zplug "junegunn/fzf-bin", from:gh-r, as:command, rename-to:fzf -zplug "junegunn/fzf", as:plugin, use:"shell/*.zsh" -zplug "junegunn/fzf", as:command, use:"bin/*" +# zplug "junegunn/fzf", as:plugin, use:"shell/*.zsh" +# zplug "junegunn/fzf", as:command, use:"bin/*" HISTSIZE=3000 SAVEHIST=10000 @@ -126,7 +125,7 @@ zplugin load "zsh-users/zsh-completions" zplugin load "hlissner/zsh-autopair" zplugin load "zdharma/fast-syntax-highlighting" zplugin load "caarlos0/zsh-open-pr" - +zplugin load "mollifier/anyframe" if [[ $os -eq darwin ]] then @@ -244,41 +243,17 @@ else precmd_functions+=(update_window_title) fi -if zplug check junegunn/fzf +if [[ -n $commands[fzf] ]] then - bindkey '^T' transpose-chars - _fzf_compgen_path() { - echo "$1" - command find -L "$1" \ - -name .git -prune -o -name .svn -prune -o \( -type d -o -type f -o -type l \) \ - -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@' - } - - _fzf_compgen_dir() { - command find -L "$1" \ - -name .git -prune -o -name .svn -prune -o -type d \ - -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@' - } - fp () { ghq look $(ghq list | fzf +m) } - cd-project-widget () { - local cmd="ghq list" - setopt localoptions pipefail 2> /dev/null - local dir="$(eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS" fzf +m)" - if [[ -z "$dir" ]]; then - zle redisplay - return 0 - fi - cd $(ghq list --full-path | grep "$dir") - local ret=$? - zle reset-prompt - typeset -f zle-line-init >/dev/null && zle zle-line-init - return $ret - } - zle -N cd-project-widget - bindkey '\es' cd-project-widget + + zstyle ":anyframe:selector:fzf:" command "fzf --height 40%" + + bindkey '\es' anyframe-widget-cd-ghq-repository + bindkey '^x^k' anyframe-widget-kill + bindkey '^r' anyframe-widget-put-history fi function function eb-active-environment () { -- cgit 1.4.1 From 7dd1f8511650e690b8b7e7afa5eb473655ce7b18 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 18 May 2017 16:06:52 +0200 Subject: zsh: Remove zplug --- README.org | 15 +++------------ zsh/.config/zsh/.zshenv | 2 -- zsh/.config/zsh/.zshrc | 6 ------ 3 files changed, 3 insertions(+), 20 deletions(-) diff --git a/README.org b/README.org index 2ed06332..3acd8b22 100644 --- a/README.org +++ b/README.org @@ -4,7 +4,7 @@ I've organised this repository with [[https://www.gnu.org/software/stow/][GNU St [[http://emacs.sexy][Emacs]]. It doesn't use any configuration frameworks, just packages installed -via package managers. For Z shell I use [[https://zplug.sh/][zplug]] and for Emacs I use the +via package managers. For Z shell I use [[https://github.com/zdharma/zplugin][zplugin]] and for Emacs I use the built-in package.el via [[https://github.com/jwiegley/use-package][use-package]]. I've included a wrapper script for =stow= which sets the target @@ -48,21 +48,12 @@ And then to uninstall *** Z Shell -My zsh configuration uses [[https://zplug.sh/][zplug]], so that will need to be installed: +My zsh configuration uses [[https://github.com/zdharma/zplugin][zplugin]]. I've included a setup script: #+BEGIN_SRC sh :exports code -git clone git://github.com/zplug/zplug ~/projects/zplug/ +./zsh/config/zsh/setup.sh #+END_SRC -To install the packages: - -#+BEGIN_SRC sh :exports code -zsh -ic "zplug install" -#+END_SRC - -Note that this will log some errors about a pipe, but that's okay. -zplug is meant to be used in a real interactive shell. - *** Emacs I use org-mode for my Emacs init file. To simplify setup, I created a diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index 114e5ce9..87276bd0 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -10,8 +10,6 @@ then . $ZDOTDIR/zshenv.private fi - ZPLUG_HOME=${ZPLUG_HOME:-~/projects/github.com/zplug/zplug/} - if [[ -z $SSH_AUTH_SOCK ]] then export SSH_AUTH_SOCK=${XDG_RUNTIME_DIR:-/run/user/$UID}/ssh-agent diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 16380e4c..6f112a96 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -1,10 +1,6 @@ # -*- mode: sh; -*- -source $ZPLUG_HOME/init.zsh source $HOME/.zplugin/bin/zplugin.zsh -# zplug "junegunn/fzf", as:plugin, use:"shell/*.zsh" -# zplug "junegunn/fzf", as:command, use:"bin/*" - HISTSIZE=3000 SAVEHIST=10000 HISTFILE=${XDG_CACHE_HOME:=$HOME/.cache}/zsh/history @@ -118,8 +114,6 @@ fi # Plugins -zplug load - zplugin ice blockf zplugin load "zsh-users/zsh-completions" zplugin load "hlissner/zsh-autopair" -- cgit 1.4.1 From 733ed131bb624a41551e738dceb28549b63b491a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 18 May 2017 16:11:27 +0200 Subject: zsh: Load fzf key-bindings as zplugin snippet --- zsh/.config/zsh/.zshrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 6f112a96..409bab92 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -243,11 +243,14 @@ then ghq look $(ghq list | fzf +m) } + zplugin snippet "https://github.com/junegunn/fzf/raw/master/shell/key-bindings.zsh" + + bindkey '^t' transpose-chars + zstyle ":anyframe:selector:fzf:" command "fzf --height 40%" bindkey '\es' anyframe-widget-cd-ghq-repository bindkey '^x^k' anyframe-widget-kill - bindkey '^r' anyframe-widget-put-history fi function function eb-active-environment () { -- cgit 1.4.1 From 66eb1c5711c23b3562d202d87eccc0ee15ca5b80 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 18 May 2017 16:15:18 +0200 Subject: git: Add global ignore pattern for compiled zsh code --- git/.config/git/ignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/git/.config/git/ignore b/git/.config/git/ignore index d7189dc5..66c652a9 100644 --- a/git/.config/git/ignore +++ b/git/.config/git/ignore @@ -18,6 +18,9 @@ auto-save-list tramp .\#* +# zsh +*.zwc + # Org-mode .org-id-locations *_archive -- cgit 1.4.1 From 71fb2e58a36faba318009596a59e517cd95465fc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 18 May 2017 16:15:39 +0200 Subject: git: Remove default excludesfile setting The value I had set is the default, so it's unnecessary --- git/.config/git/config | 2 -- 1 file changed, 2 deletions(-) diff --git a/git/.config/git/config b/git/.config/git/config index f3a62f67..c82c149f 100644 --- a/git/.config/git/config +++ b/git/.config/git/config @@ -32,8 +32,6 @@ algorithm = patience [include] path = config.local -[core] - excludesfile = ~/.config/git/ignore [rebase] autosquash = true [rerere] -- cgit 1.4.1 From 49aafb7531cd3d6a5885859b1a56509d45f5e990 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 18 May 2017 16:23:57 +0200 Subject: zsh: Stop anyframe from adding to fpath --- zsh/.config/zsh/.zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 409bab92..a0340e18 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -119,6 +119,7 @@ zplugin load "zsh-users/zsh-completions" zplugin load "hlissner/zsh-autopair" zplugin load "zdharma/fast-syntax-highlighting" zplugin load "caarlos0/zsh-open-pr" +zplugin ice blockf zplugin load "mollifier/anyframe" if [[ $os -eq darwin ]] -- cgit 1.4.1 From d0ce60d5743b4d90e154960ab884a486607a4ec6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 18 May 2017 16:25:21 +0200 Subject: zsh: Fix incorrect function declaration I'm surprised this wasn't a syntax error --- zsh/.config/zsh/.zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index a0340e18..1d827a27 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -254,7 +254,7 @@ then bindkey '^x^k' anyframe-widget-kill fi -function function eb-active-environment () { +function eb-active-environment () { aws elasticbeanstalk describe-environments | grep $(dig +short $1 CNAME) | cut -f10 } -- cgit 1.4.1 From 336063f13d39c122fa17ab325117b904b5ed4d82 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 18 May 2017 16:35:35 +0200 Subject: zsh: Load terminal title function from omz directly --- zsh/.config/zsh/.zshrc | 57 ++++---------------------------------------------- 1 file changed, 4 insertions(+), 53 deletions(-) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 1d827a27..da25b3dc 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -122,6 +122,9 @@ zplugin load "caarlos0/zsh-open-pr" zplugin ice blockf zplugin load "mollifier/anyframe" +zplugin snippet "https://github.com/robbyrussell/oh-my-zsh/blob/master/lib/functions.zsh" +zplugin snippet "https://github.com/robbyrussell/oh-my-zsh/blob/master/lib/termsupport.zsh" + if [[ $os -eq darwin ]] then zplugin load "unixorn/tumult.plugin.zsh" @@ -183,59 +186,7 @@ else setopt prompt_subst setopt prompt_cr PROMPT='%F{blue}%~%f${prompt_pure_username} -%(?.%F{magenta}.%F{red})>%f ' - - ## From https://github.com/robbyrussell/oh-my-zsh/blob/71deb74552d54630d99ae1db3647ebed7b3bc735/lib/termsupport.zsh - - # Keep Apple Terminal.app's current working directory updated - # Based on this answer: http://superuser.com/a/315029 - # With extra fixes to handle multibyte chars and non-UTF-8 locales - - if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then - # Emits the control sequence to notify Terminal.app of the cwd - # Identifies the directory using a file: URI scheme, including - # the host name to disambiguate local vs. remote paths. - function update_terminalapp_cwd() { - emulate -L zsh - - # Percent-encode the pathname. - # Percent-encode the pathname. - local URL_PATH='' - { - # Use LC_CTYPE=C to process text byte-by-byte. - local i ch hexch LC_CTYPE=C - for ((i = 1; i <= ${#PWD}; ++i)); do - ch="$PWD[i]" - if [[ "$ch" =~ [/._~A-Za-z0-9-] ]]; then - URL_PATH+="$ch" - else - hexch=$(printf "%02X" "'$ch") - URL_PATH+="%$hexch" - fi - done - } - [[ $? != 0 ]] && return 1 - - printf '\e]7;%s\a' "file://$HOST$URL_PATH" - } - - # Use a precmd hook instead of a chpwd hook to avoid contaminating output - precmd_functions+=(update_terminalapp_cwd) - # Run once to get initial cwd set - update_terminalapp_cwd - fi - - function set_window_title { printf '\e]2;%s\a' "$1" } - - function update_window_title { - if [[ -n "$SSH_CONNECTION" || $UID -eq 0 ]] - then - set_window_title "$USER@$HOST" - else - set_window_title "" - fi - } - precmd_functions+=(update_window_title) +%(?.%F{magenta}.%F{red})>%f ' fi if [[ -n $commands[fzf] ]] -- cgit 1.4.1 From b503983d06fb1cdc1577f5abe59988471ea2cc86 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 18 May 2017 16:36:33 +0200 Subject: Remove trailing whitespace --- zsh/.config/zsh/.zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index da25b3dc..05970131 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -186,7 +186,7 @@ else setopt prompt_subst setopt prompt_cr PROMPT='%F{blue}%~%f${prompt_pure_username} -%(?.%F{magenta}.%F{red})>%f ' +%(?.%F{magenta}.%F{red})>%f ' fi if [[ -n $commands[fzf] ]] -- cgit 1.4.1 From 1b9f08e7bbbeca3dfec7bcb6b8b118dbd6ffdcae Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 19 May 2017 10:06:04 +0200 Subject: zsh: Simplify title in Terminal.app --- zsh/.config/zsh/.zshrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 05970131..c8f951bf 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -183,6 +183,9 @@ else # show username@host if root, with username in white [[ $UID -eq 0 ]] && prompt_pure_username=' %F{white}%n%f%F{242}@%m%f' + ZSH_THEME_TERM_TAB_TITLE_IDLE="" + ZSH_THEME_TERM_TITLE_IDLE="" + setopt prompt_subst setopt prompt_cr PROMPT='%F{blue}%~%f${prompt_pure_username} -- cgit 1.4.1 From 80ff771431d668bff8c73461c606c8f1517752dd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 19 May 2017 14:41:19 +0200 Subject: Emacs: Remove music setup --- emacs/.emacs.d/init.org | 9 --------- 1 file changed, 9 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 79aa7c59..989c282b 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1706,15 +1706,6 @@ I can use this to keep a journal. I should use it. #+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 -- cgit 1.4.1 From 48e3f32497d16a3c39596194a1928679eb9a6ad0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 19 May 2017 14:42:56 +0200 Subject: zsh: Remove $HOME/bin from path --- zsh/.config/zsh/.zshenv | 5 ----- 1 file changed, 5 deletions(-) diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index 87276bd0..51323f10 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -53,11 +53,6 @@ then ;; esac - if [[ ${path[(I)$HOME/bin ]} ]] - then - path+=($HOME/bin) - fi - if [[ ${path[(I)$HOME/.local/bin ]} ]] then path+=($HOME/.local/bin) -- cgit 1.4.1 From 5216f41ddf542f3cebb530730b56bfb4acb9e7a8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 21 May 2017 11:07:50 +0200 Subject: Emacs: Don't set Linux fonts on Windows/WSL/X11 --- emacs/.emacs.d/init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 628c90ec..78c51e58 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -220,7 +220,8 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (if (eq displays 1) (ap/set-fonts "Lekton" 20 "Lucida Grande" 16 t) (ap/set-fonts "Monaco" 14 "Lucida Grande" 14 nil 0.1)))) - ((eq window-system 'x) + ((and (eq window-system 'x) + (not (getenv "windows"))) (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 14)) (ap/set-fonts "Fixed" 14 "Lucida" 14 nil)))) -- cgit 1.4.1 From 8cb99ca85533e3252289e0ccb5ebe1dc8c98fa15 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 21 May 2017 11:08:17 +0200 Subject: zsh: Set umask manually on Windows/WSL Previously, I ran the WSL environment as root, calling `login` to ensure all the right login stuff happens (mostly the setting of umask). Unfortunately, this complicated running commands from outside the environment and was a bit slower. --- zsh/.config/zsh/.zshenv | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index 114e5ce9..d1ea38e4 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -42,7 +42,8 @@ then read osrelease < /proc/sys/kernel/osrelease if [[ $osrelease =~ Microsoft$ ]] then - windows=1 + export windows=1 + umask 002 fi fi -- cgit 1.4.1 From 0ccf53c11af68097cc869c2418b5bc432f317c78 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 21 May 2017 13:52:48 +0200 Subject: Emacs: Ensure package archives are up-to-date before installing --- emacs/.emacs.d/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/Makefile b/emacs/.emacs.d/Makefile index 3d965e44..7741ef3e 100644 --- a/emacs/.emacs.d/Makefile +++ b/emacs/.emacs.d/Makefile @@ -1,5 +1,6 @@ define EMACS_TANGLE (progn\ + (package-refresh-contents nil)\ (setq vc-follow-symlinks nil)\ (find-file \"init.org\")\ (require 'ob-tangle)\ -- cgit 1.4.1 From a066f5988f86347bc208b4169ec34688f3a9a350 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 21 May 2017 13:53:21 +0200 Subject: Emacs: Change X font size following DPI change --- emacs/.emacs.d/init.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 989c282b..fe3c6435 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -222,8 +222,8 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (ap/set-fonts "Monaco" 16 "Lucida Grande" 16 t 0.2) (ap/set-fonts "Monoid" 12 "Helvetica Neue" 12 t 0.1)))) ((eq window-system 'x) - (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 14)) - (ap/set-fonts "Fixed" 14 "Lucida" 14 nil)))) + (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 18)) + (ap/set-fonts "Terminus" 18 "Lucida" 14 nil)))) (ap/set-fonts-according-to-system)) #+END_SRC -- cgit 1.4.1 From 256624894ef9a1c23ae7dc5464029542398ca7ca Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 22 May 2017 12:40:18 +0200 Subject: Fix display of readme on GitHub --- README.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.org b/README.org index 3acd8b22..6c85344c 100644 --- a/README.org +++ b/README.org @@ -20,7 +20,7 @@ It should work on: ** Installation -Clone the project anywhere, e.g. with =[[https://github.com/motemen/ghq][ghq]]= +Clone the project anywhere, e.g. with [[https://github.com/motemen/ghq][ghq]] #+BEGIN_SRC sh :exports code ghq get git://git.alanpearce.eu/dotfiles -- cgit 1.4.1 From 0e56fb4d2f283fa5548e205dcd6e0e924f98c91c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 22 May 2017 12:40:42 +0200 Subject: Emacs: Load company-nixos-options later --- emacs/.emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index fe3c6435..c4022517 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1035,6 +1035,7 @@ seems to work perfectly well for me. #+BEGIN_SRC emacs-lisp (use-package company-nixos-options + :defer 30 :config (progn (add-to-list 'company-backends 'company-nixos-options))) #+END_SRC -- cgit 1.4.1 From a4598d8f46876743549f31c3582e3209da8991ec Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 22 May 2017 15:29:21 +0200 Subject: Emacs: Install imenu-anywhere --- emacs/.emacs.d/init.org | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index c4022517..c7935c19 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1791,6 +1791,15 @@ guess a definition. :config (setq dumb-jump-selector 'ivy)) #+END_SRC +** imenu-anywhere + +This is like imenu, but shows functions (or similar top-level +entities) across buffers in the same project. Neat! + +#+BEGIN_SRC emacs-lisp +(use-package imenu-anywhere + :bind ("C-x C-." . ivy-imenu-anywhere)) +#+END_SRC ** Lisps *** All -- cgit 1.4.1 From 7235841ea4cd6477ffe414a9065bf4e99bd05c1d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 22 May 2017 15:29:35 +0200 Subject: Emacs: Load flycheck-flow after js2-mode --- emacs/.emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index c7935c19..90aef783 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1727,6 +1727,7 @@ On-the-fly error checking in programming modes? Yes please. #+BEGIN_SRC emacs-lisp (use-package flycheck-flow + :after js2-mode :config (progn (flycheck-add-next-checker 'javascript-eslint 'javascript-flow))) #+END_SRC -- cgit 1.4.1 From 1ddfc50b1e25f757f6e40602d204b3a5ca7db91e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 22 May 2017 15:29:49 +0200 Subject: Emacs: Install flow-minor-mode --- emacs/.emacs.d/init.org | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 90aef783..451806da 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2047,6 +2047,15 @@ the project. This will allows emacs to find their executables. (add-hook 'js2-mode-hook #'add-node-modules-path))) #+END_SRC +**** Flow + +#+BEGIN_SRC emacs-lisp +(use-package flow-minor-mode + :after js2-mode + :config (progn + (add-hook 'js2-mode-hook #'flow-minor-enable-automatically))) +#+END_SRC + **** Indium Javascript with an inferior node.js process and a debugger? Awesome. -- cgit 1.4.1 From b64fafdae9c71648ffd0ac01446f1bcc7aa2c2e6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 22 May 2017 16:48:45 +0200 Subject: Emacs: Don't flycheck on new-lines This slows down the editor --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 451806da..9974cb85 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1718,7 +1718,7 @@ On-the-fly error checking in programming modes? Yes please. :defer 5 :config (progn (global-flycheck-mode) - (setq flycheck-check-syntax-automatically '(save new-line mode-enabled)) + (setq flycheck-check-syntax-automatically '(save mode-enabled)) (if (executable-find "eslint_d") (setq flycheck-javascript-eslint-executable "eslint_d")))) #+END_SRC -- cgit 1.4.1 From 6ae56a3dd7686a6b6d2f815e4478b4abd3f4b114 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 22 May 2017 16:49:02 +0200 Subject: Emacs: Show flycheck messages as tooltips --- emacs/.emacs.d/init.org | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 9974cb85..a9344a7f 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1723,6 +1723,18 @@ On-the-fly error checking in programming modes? Yes please. (setq flycheck-javascript-eslint-executable "eslint_d")))) #+END_SRC +*** flycheck-pos-tip + +Show flycheck errors in a little popup, so I don't lose my place + +#+BEGIN_SRC emacs-lisp +(use-package flycheck-pos-tip + :after flycheck + :config (progn + (setq flycheck-display-errors-delay 0.5) + (flycheck-pos-tip-mode 1))) +#+END_SRC + *** flycheck-flow #+BEGIN_SRC emacs-lisp -- cgit 1.4.1 From 7846fd944c13a09578316924a1365a5b369a96b7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 22 May 2017 16:49:13 +0200 Subject: Emacs: Remove useless call to use-package-verbose --- emacs/.emacs.d/init.org | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index a9344a7f..85697fe3 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -76,8 +76,7 @@ the buffer to be empty. (use-package use-package :commands (use-package-autoload-keymap) :defer 5)) -(setq use-package-verbose t - use-package-always-ensure t +(setq use-package-always-ensure t package-enable-at-startup nil) #+END_SRC -- cgit 1.4.1 From bbf952dce8bfa1e6c6fffb576d93f5fad7bb24b4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 22 May 2017 16:51:47 +0200 Subject: Emacs: Make git-gutter look nicer --- emacs/.emacs.d/init.org | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 85697fe3..4b2303a5 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -172,7 +172,10 @@ Eziam looks nice, too :defines (eziam-scale-headings) :config (progn (setq eziam-scale-headings nil) - (load-theme 'eziam-light t))) + (load-theme 'eziam-light t) + (set-face-foreground 'git-gutter-fr:added "#96a4ab") + (set-face-foreground 'git-gutter-fr:modified "#96a4ab") + (set-face-foreground 'git-gutter-fr:deleted "#96a4ab"))) #+END_SRC Highlighting quasi-quoted expressions in lisps is quite useful, but I @@ -575,8 +578,19 @@ fringe so it doesn’t interfere with flycheck. :diminish git-gutter-mode :config (progn (global-git-gutter-mode 1) - (set-face-foreground 'git-gutter:modified "grey") - (setq git-gutter-fr:side 'right-fringe))) + ;; places the git gutter outside the margins. + (setq-default fringes-outside-margins t) + ;; thin fringe bitmaps + (fringe-helper-define 'git-gutter-fr:added '(center repeated) + "XXX.....") + (fringe-helper-define 'git-gutter-fr:modified '(center repeated) + "XXX.....") + (fringe-helper-define 'git-gutter-fr:deleted 'bottom + "X......." + "XX......" + "XXX....." + "XXXX....") + (setq git-gutter-fr:side 'left-fringe))) #+END_SRC ** magit -- cgit 1.4.1 From f44fe9318f27659a278af650d11f7e87e211fd6d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 22 May 2017 17:09:43 +0200 Subject: Emacs: Improve flycheck fringe indication Show a flat block of colour on the right fringe --- emacs/.emacs.d/init.org | 3 +++ 1 file changed, 3 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 4b2303a5..7cc2c99e 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1732,6 +1732,9 @@ On-the-fly error checking in programming modes? Yes please. :config (progn (global-flycheck-mode) (setq flycheck-check-syntax-automatically '(save mode-enabled)) + (setq flycheck-indication-mode 'right-fringe) + (fringe-helper-define 'flycheck-fringe-bitmap-double-arrow '(center repeated) + ".XXXXXXX") (if (executable-find "eslint_d") (setq flycheck-javascript-eslint-executable "eslint_d")))) #+END_SRC -- cgit 1.4.1 From 0932ad09f394290acf40c3dfffbcd1f61821b16b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 23 May 2017 10:27:07 +0200 Subject: Emacs: Simplify code display in eziam --- emacs/.emacs.d/init.org | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 7cc2c99e..2163361f 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -173,6 +173,8 @@ Eziam looks nice, too :config (progn (setq eziam-scale-headings nil) (load-theme 'eziam-light t) + (set-face-underline 'js2-function-call nil) + (set-face-bold 'font-lock-keyword-face nil) (set-face-foreground 'git-gutter-fr:added "#96a4ab") (set-face-foreground 'git-gutter-fr:modified "#96a4ab") (set-face-foreground 'git-gutter-fr:deleted "#96a4ab"))) -- cgit 1.4.1 From 0b7675b33faefe7463ca61048e7e4ebd35e54157 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 23 May 2017 10:27:29 +0200 Subject: Emacs: Truncate lines instead of wrapping --- emacs/.emacs.d/init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 2163361f..a8f9dc05 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2402,7 +2402,8 @@ 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 + truncate-lines t) #+END_SRC ** align -- cgit 1.4.1 From 7414f92ac921f40e4a5d785f31f79a436b62d3e6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 23 May 2017 15:47:28 +0200 Subject: Emacs: Install flycheck-vale, to check my English --- emacs/.emacs.d/init.org | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index a8f9dc05..3ed0e72b 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2314,6 +2314,17 @@ Sometimes I might want to show off my emacs usage. (add-hook 'prog-mode-hook #'flyspell-prog-mode))) #+END_SRC +** Style checking + +[[https://github.com/ValeLint/vale][Vale]] is a linter, but for prose. Neat idea! Salesman is a bad term. + +#+BEGIN_SRC emacs-lisp +(use-package flycheck-vale + :config (progn + (add-to-list 'flycheck-vale-modes 'org-mode) + (flycheck-vale-setup))) +#+END_SRC + * Scripting Make a shell-script buffer executable after saving it, if it has a shebang. -- cgit 1.4.1 From 1a8e5fd41a563b996745b0f66bfd5b9f86e7208f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 23 May 2017 15:47:42 +0200 Subject: Emacs: Set truncate-lines correctly --- emacs/.emacs.d/init.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 3ed0e72b..8391ff73 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2413,8 +2413,8 @@ 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 - truncate-lines t) + line-move-visual nil) +(setq-default truncate-lines t) #+END_SRC ** align -- cgit 1.4.1 From 32ff2aca5ff86a2a024948dcb135ae946f9eba17 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 23 May 2017 15:49:15 +0200 Subject: Emacs: Make the fringe smaller --- emacs/.emacs.d/init.org | 2 -- 1 file changed, 2 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 8391ff73..9e4a0552 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -292,12 +292,10 @@ Sometimes I like to hide clutter. Other times, it's useful. (defun hide-clutter () (interactive) - (fringe-mode '(4 . 8)) (hide-mode-line)) (defun show-clutter () (interactive) - (fringe-mode '(8 . 8)) (show-mode-line)) (hide-clutter) -- cgit 1.4.1 From bebf6f939455755b24528b64c171ce453c3a3e03 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 23 May 2017 15:49:26 +0200 Subject: Emacs: Configure window-divider-mode on macOS It didn't work on previous releases using the NextStep window system, but with a new version of emacs-mac-port, it's good. Fortunately, Emacs knows the difference: window-system is either `ns` or `mac` --- emacs/.emacs.d/init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 9e4a0552..d63803ba 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -311,7 +311,8 @@ Sometimes I like to hide clutter. Other times, it's useful. (add-to-list 'default-frame-alist '(border-width . 0)) (add-to-list 'default-frame-alist '(internal-border-width . 0)) -(when (eq window-system 'x) +(when (or (eq window-system 'x) + (eq window-system 'mac)) (setq window-divider-default-bottom-width 1 window-divider-default-right-width 1 window-divider-default-places t) -- cgit 1.4.1 From 02b31add360e8ecb529683f0c476b6627eae933f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 23 May 2017 15:50:50 +0200 Subject: Emacs: Don't run hide-clutter by default --- emacs/.emacs.d/init.org | 1 - 1 file changed, 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index d63803ba..b28a06de 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -297,7 +297,6 @@ Sometimes I like to hide clutter. Other times, it's useful. (defun show-clutter () (interactive) (show-mode-line)) -(hide-clutter) (when mode-line-default-hidden (call-interactively #'hide-mode-line)) -- cgit 1.4.1 From 8830fc2affb29bdc47252ee9ef7a80b35b59344a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 24 May 2017 10:56:43 +0200 Subject: Emacs: Fix error customising faces --- emacs/.emacs.d/init.org | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index b28a06de..ac42949e 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -173,11 +173,12 @@ Eziam looks nice, too :config (progn (setq eziam-scale-headings nil) (load-theme 'eziam-light t) - (set-face-underline 'js2-function-call nil) - (set-face-bold 'font-lock-keyword-face nil) - (set-face-foreground 'git-gutter-fr:added "#96a4ab") - (set-face-foreground 'git-gutter-fr:modified "#96a4ab") - (set-face-foreground 'git-gutter-fr:deleted "#96a4ab"))) + (custom-theme-set-faces 'user + '(js2-function-call ((t (:underline nil)))) + '(font-lock-keyword-face ((t (:weight normal)))) + '(git-gutter-fr:added ((t (:foreground "#96a4ab")))) + '(git-gutter-fr:modified ((t (:foreground "#96a4ab")))) + '(git-gutter-fr:deleted ((t (:foreground "#96a4ab"))))))) #+END_SRC Highlighting quasi-quoted expressions in lisps is quite useful, but I -- cgit 1.4.1 From 65072b5fb67e2f7e6a1761b12e799f68404f9cdb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 24 May 2017 10:57:10 +0200 Subject: Emacs: Fix byte-compile errors/warnings --- emacs/.emacs.d/init.org | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index ac42949e..764b950c 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -513,7 +513,7 @@ based upon some folder conventions I use. :demand t :diminish projectile-mode :config (progn - (projectile-global-mode) + (projectile-mode 1) (add-to-list 'projectile-globally-ignored-directories ".stversions") (defun yarn-install (&optional arg) @@ -1277,7 +1277,7 @@ workplace, so I keep it in a host-specific, GPG-encrypted file. send-mail-function #'smtpmail-send-it message-send-mail-function #'smtpmail-send-it))) -(with-eval-after-load 'gnus-mime +(with-eval-after-load "gnus-mime" (define-key gnus-mime-button-map " " #'gnus-mime-view-part-externally)) (with-eval-after-load "mailcap" @@ -1734,8 +1734,9 @@ On-the-fly error checking in programming modes? Yes please. (global-flycheck-mode) (setq flycheck-check-syntax-automatically '(save mode-enabled)) (setq flycheck-indication-mode 'right-fringe) - (fringe-helper-define 'flycheck-fringe-bitmap-double-arrow '(center repeated) - ".XXXXXXX") + (with-eval-after-load 'git-gutter-fringe + (fringe-helper-define 'flycheck-fringe-bitmap-double-arrow '(center repeated) + ".XXXXXXX")) (if (executable-find "eslint_d") (setq flycheck-javascript-eslint-executable "eslint_d")))) #+END_SRC @@ -2353,6 +2354,7 @@ nice, when I remember to use it. #+BEGIN_SRC emacs-lisp (use-package eshell :bind ("C-c s" . eshell) + :functions (eshell/pwd) :config (progn (setq eshell-directory-name "~/.emacs.d/eshell" eshell-prompt-function (lambda () @@ -2437,7 +2439,7 @@ The most important one for me is JSON property alignment. I like to use the clipboard more than the primary selection in X11. #+BEGIN_SRC emacs-lisp -(setq x-select-enable-clipboard t +(setq select-enable-clipboard t save-interprogram-paste-before-kill t) (if (functionp 'x-cut-buffer-or-selection-value) (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)) -- cgit 1.4.1 From 444586dc3d9433659aa7aea40c665f7c088746ec Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 24 May 2017 10:57:26 +0200 Subject: Emacs: Don't hide mode-line --- emacs/.emacs.d/init.org | 1 - 1 file changed, 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 764b950c..6ab2fa9c 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -316,7 +316,6 @@ Sometimes I like to hide clutter. Other times, it's useful. (setq window-divider-default-bottom-width 1 window-divider-default-right-width 1 window-divider-default-places t) - (setq mode-line-default-hidden t) (window-divider-mode +1)) (add-hook 'after-change-major-mode-hook #'hide-mode-line-if-default-hidden) -- cgit 1.4.1 From 3dbb464cc6c70bcc43caf53c4460c253801f687a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 24 May 2017 10:57:41 +0200 Subject: Emacs: Auto-load eshell when idle --- emacs/.emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 6ab2fa9c..f4d1b6e8 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2353,6 +2353,7 @@ nice, when I remember to use it. #+BEGIN_SRC emacs-lisp (use-package eshell :bind ("C-c s" . eshell) + :defer 10 :functions (eshell/pwd) :config (progn (setq eshell-directory-name "~/.emacs.d/eshell" -- cgit 1.4.1 From eae9dacbdb09ca1b0274a23d0ebe97a5a3235db7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 24 May 2017 15:10:51 +0200 Subject: Emacs: Fix exec-path warning --- emacs/.emacs.d/init.org | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index f4d1b6e8..6392f5cf 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -387,7 +387,9 @@ variables from whatever my shell configuration is. #+BEGIN_SRC emacs-lisp (use-package exec-path-from-shell :if (eq system-type 'darwin) - :config (exec-path-from-shell-initialize)) + :config (progn + (setq exec-path-from-shell-arguments '("-l")) + (exec-path-from-shell-initialize))) #+END_SRC * Keybindings -- cgit 1.4.1 From 43bca738588a0e1b3cc2719fde3203561f9aaabd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 24 May 2017 15:11:05 +0200 Subject: Emacs: Fix undefined fringe-helper error --- emacs/.emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 6392f5cf..b13f4e71 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -575,6 +575,7 @@ changed. This package colours the fringe. I have it set to the right fringe so it doesn’t interfere with flycheck. #+BEGIN_SRC emacs-lisp +(eval-when-compile (require 'fringe-helper)) (use-package git-gutter-fringe :defer 2 :diminish git-gutter-mode -- cgit 1.4.1 From 00bc25dbebf035f003e73f64c6a856cd0acf09a1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 30 May 2017 11:46:21 +0200 Subject: Emacs: Remove copy-as-format --- emacs/.emacs.d/init.org | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index b13f4e71..99978c3d 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2450,22 +2450,6 @@ I like to use the clipboard more than the primary selection in X11. (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))) #+END_SRC -*** Copy formatted code - -#+BEGIN_SRC emacs-lisp -(bind-key* "C-c w" (define-prefix-command 'copy-as-map)) -(use-package copy-as-format - :bind (("C-c C-w" . copy-as-format) - :map copy-as-map - ("b" . copy-as-format-bitbucket) - ("g" . copy-as-format-github) - ("h" . copy-as-format-hipchat) - ("w" . copy-as-format-html) - ("j" . copy-as-format-jira) - ("m" . copy-as-format-markdown) - ("s" . copy-as-format-slack))) -#+END_SRC - ** Selection I’m quite used to deleting text by selecting it and typing. Emacs has -- cgit 1.4.1 From c82f34646cba655b49d2bc2a2247efb46e01d518 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 30 May 2017 11:46:38 +0200 Subject: Emacs: Use rg instead of ag for counsel-projectile --- emacs/.emacs.d/init.org | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 99978c3d..1bac4eff 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -549,7 +549,9 @@ based upon some folder conventions I use. projectile-completion-system 'ivy))) (use-package counsel-projectile - :config (counsel-projectile-on)) + :config (progn + (counsel-projectile-on) + (define-key projectile-mode-map [remap counsel-projectile-ag] #'counsel-projectile-rg))) #+END_SRC ** vc -- cgit 1.4.1 From e9049339b060d464e60374c22b918ba94fd78b69 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 30 May 2017 11:47:06 +0200 Subject: Emacs: Tweak the fringe --- emacs/.emacs.d/init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 1bac4eff..8d8f8441 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -302,7 +302,8 @@ Sometimes I like to hide clutter. Other times, it's useful. (when mode-line-default-hidden (call-interactively #'hide-mode-line)) -(setq-default indicate-buffer-boundaries 'left) +(setq-default indicate-buffer-boundaries nil) +(fringe-mode '(4 . 4)) (defun hide-mode-line-if-default-hidden () (if mode-line-default-hidden -- cgit 1.4.1 From d355dc10d2ff85f4bd07bf55d773d135832ef07d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 30 May 2017 11:47:22 +0200 Subject: Emacs: Only load theme if it makes sense --- emacs/.emacs.d/init.org | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 8d8f8441..25a399a2 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -169,6 +169,8 @@ Eziam looks nice, too #+BEGIN_SRC emacs-lisp (use-package eziam-light-theme :ensure eziam-theme + :if (or window-system + server-name) :defines (eziam-scale-headings) :config (progn (setq eziam-scale-headings nil) -- cgit 1.4.1 From fc3d5ed0d20890cbb4350a7b774cd49269f91ebd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 30 May 2017 11:47:39 +0200 Subject: Emacs: Always make the background white --- emacs/.emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 25a399a2..6a904362 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -176,6 +176,7 @@ Eziam looks nice, too (setq eziam-scale-headings nil) (load-theme 'eziam-light t) (custom-theme-set-faces 'user + '(default ((t (:background "#ffffff")))) '(js2-function-call ((t (:underline nil)))) '(font-lock-keyword-face ((t (:weight normal)))) '(git-gutter-fr:added ((t (:foreground "#96a4ab")))) -- cgit 1.4.1 From e2cd7e8101cab293469deb21eb6758ba6b48a9dc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 1 Jun 2017 17:37:50 +0200 Subject: Emacs: Set fonts on Windows --- emacs/.emacs.d/init.org | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index dbe38d64..a6aecc5a 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -229,7 +229,10 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource ((and (eq window-system 'x) (not (getenv "windows"))) (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 18)) - (ap/set-fonts "Terminus" 18 "Lucida" 14 nil)))) + (ap/set-fonts "Terminus" 18 "Lucida" 14 nil)) + ((and (eq window-system 'x) + (getenv "windows")) + (ap/set-fonts "Noto Mono" 15 "Sans" 15 nil)))) (ap/set-fonts-according-to-system)) #+END_SRC -- cgit 1.4.1 From d2347ab4129a975b226aaab0d1d3aba806c5a766 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 1 Jun 2017 17:52:17 +0200 Subject: Emacs: Detect Windows even outside of zsh environment --- emacs/.emacs.d/init.org | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index a6aecc5a..0719ad8c 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -18,6 +18,13 @@ Open Emacs with just a plain window. No graphics or messages, please! (remove-hook 'find-file-hooks #'vc-refresh-state) #+END_SRC +Are we running on Windows via the WSL? + +#+BEGIN_SRC emacs-lisp +(when (string-match "Microsoft$" (file-to-string "/proc/sys/kernel/osrelease")) + (setq system-type 'gnu/linux/windows)) +#+END_SRC + ** Compatibility #+BEGIN_SRC emacs-lisp @@ -227,12 +234,12 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (ap/set-fonts "Monaco" 16 "Lucida Grande" 16 t 0.2) (ap/set-fonts "Monoid" 12 "Helvetica Neue" 12 t 0.1)))) ((and (eq window-system 'x) - (not (getenv "windows"))) + (not (eq system-type 'gnu/linux/windows))) (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 18)) (ap/set-fonts "Terminus" 18 "Lucida" 14 nil)) ((and (eq window-system 'x) - (getenv "windows")) - (ap/set-fonts "Noto Mono" 15 "Sans" 15 nil)))) + (eq system-type 'gnu/linux/windows)) + (ap/set-fonts "Noto Mono" 15 "Sans" 15 nil))) (ap/set-fonts-according-to-system)) #+END_SRC -- cgit 1.4.1 From f2f351569ffac639d5773d52f7482e77528eeb2c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 1 Jun 2017 17:53:52 +0200 Subject: Emacs: Add missing paren --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 0719ad8c..070f48c2 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -239,7 +239,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (ap/set-fonts "Terminus" 18 "Lucida" 14 nil)) ((and (eq window-system 'x) (eq system-type 'gnu/linux/windows)) - (ap/set-fonts "Noto Mono" 15 "Sans" 15 nil))) + (ap/set-fonts "Noto Mono" 15 "Sans" 15 nil)))) (ap/set-fonts-according-to-system)) #+END_SRC -- cgit 1.4.1 From 3ee51fe5f1110072b345638b1fc8d91af92c8c85 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 1 Jun 2017 21:32:18 +0200 Subject: Emacs: Swap fringes used by git-gutter/flycheck --- emacs/.emacs.d/init.org | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 6a904362..b9cbef9b 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -591,15 +591,15 @@ fringe so it doesn’t interfere with flycheck. (setq-default fringes-outside-margins t) ;; thin fringe bitmaps (fringe-helper-define 'git-gutter-fr:added '(center repeated) - "XXX.....") + ".XXX....") (fringe-helper-define 'git-gutter-fr:modified '(center repeated) - "XXX.....") + ".XXX....") (fringe-helper-define 'git-gutter-fr:deleted 'bottom - "X......." - "XX......" - "XXX....." - "XXXX....") - (setq git-gutter-fr:side 'left-fringe))) + ".......X" + "......XX" + ".....XXX" + "....XXXX") + (setq git-gutter-fr:side 'right-fringe))) #+END_SRC ** magit @@ -619,6 +619,17 @@ time. Make sure to set it up with a nice =completing-read-function= :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) #+END_SRC +** git-messenger + +Popup the last commit that changed the line at point. + +#+BEGIN_SRC emacs-lisp +(use-package git-messenger + :bind* (("C-x v p" . git-messenger:popup-message)) + :config (progn + (setq git-messenger:use-magit-popup t))) +#+END_SRC + ** git-timemachine This package allow me to go through a file’s history with just a few @@ -1305,7 +1316,7 @@ information here as well. #+BEGIN_SRC emacs-lisp (use-package bbdb :config (progn - (bbdb-initialize 'gnus 'mail 'message 'pgp) + (bbdb-initialize 'gnus 'message 'pgp) (bbdb-mua-auto-update-init 'gnus 'message) (setq bbdb-send-mail-style 'gnus bbdb-complete-mail-allow-cycling t @@ -1607,13 +1618,15 @@ works really nicely. (ledger-report "Budget (Cumulative)" nil))) :config (progn (setq ledger-use-iso-dates t - ledger-post-use-completion-engine :built-in + ledger-post-use-completion-engine :ido 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\"") + ledger-reports `(("Monthly Expenses" "ledger -f %(ledger-file) reg -M \\^Flex --real -X EUR -l \"payee != 'Opening Balances'\"") + ("Average Monthly Expenses (Past 12 Months)" ,(concat "ledger -f %(ledger-file) -b " + (format-time-string "%Y-%m" (time-add (current-time) (days-to-time -365))) + " --monthly --average balance ^Flex")) + ("Expenses:This Month" "ledger -f %(ledger-file) bal \\^Flex -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") @@ -1646,7 +1659,9 @@ Org is wünderbar. (use-package org :bind (("C-c C-a" . org-agenda-list) ("C-c a" . org-agenda) - ("C-c l" . org-store-link)) + ("C-c l" . org-store-link) + :map org-src-mode-map + ("C-x C-s" . org-edit-src-exit)) :defer 8 :init (setq org-replace-disputed-keys t org-ellipsis "…") @@ -1741,10 +1756,10 @@ On-the-fly error checking in programming modes? Yes please. :config (progn (global-flycheck-mode) (setq flycheck-check-syntax-automatically '(save mode-enabled)) - (setq flycheck-indication-mode 'right-fringe) + (setq flycheck-indication-mode 'left-fringe) (with-eval-after-load 'git-gutter-fringe (fringe-helper-define 'flycheck-fringe-bitmap-double-arrow '(center repeated) - ".XXXXXXX")) + ".XXX....")) (if (executable-find "eslint_d") (setq flycheck-javascript-eslint-executable "eslint_d")))) #+END_SRC -- cgit 1.4.1 From 3a26b26766454af43ea39018a0ba1890bec99630 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 1 Jun 2017 21:53:40 +0200 Subject: Emacs: Fix windows check file-to-string isn't actually a built-in function, even though it's named like one. --- emacs/.emacs.d/init.org | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 070f48c2..da476582 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -21,8 +21,11 @@ Open Emacs with just a plain window. No graphics or messages, please! Are we running on Windows via the WSL? #+BEGIN_SRC emacs-lisp -(when (string-match "Microsoft$" (file-to-string "/proc/sys/kernel/osrelease")) - (setq system-type 'gnu/linux/windows)) +(with-temp-buffer + (insert-file-contents-literally "/proc/sys/kernel/osrelease") + (decode-coding-region (point-min) (point-max) 'utf-8 t) + (when (string-match "Microsoft$" (buffer-string)) + (setq system-type 'gnu/linux/windows))) #+END_SRC ** Compatibility -- cgit 1.4.1 From 6ab6e58ab30e3e96210099151ae365fa79477b56 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 1 Jun 2017 21:54:07 +0200 Subject: Emacs: Use exec-path-from-shell on gnu/windows --- emacs/.emacs.d/init.org | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index da476582..8ccca9a4 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -398,9 +398,13 @@ read them automatically any more. So, let’s use the [[https://github.com/purcell/exec-path-from-shell][exec-path-from-shell]] package to set up ~exec-path~ and similar variables from whatever my shell configuration is. +On Windows, I like to run Emacs from the system tray menu of VcXsrv. +It starts up without an environment in this case as well. + #+BEGIN_SRC emacs-lisp (use-package exec-path-from-shell - :if (eq system-type 'darwin) + :if (or (eq system-type 'darwin) + (eq system-type 'gnu/linux/windows)) :config (progn (setq exec-path-from-shell-arguments '("-l")) (exec-path-from-shell-initialize))) -- cgit 1.4.1 From 0086666d6d5f43ef8042a2efcf34c6405681406d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 1 Jun 2017 22:27:52 +0200 Subject: Emacs: Tweak gnu/windows font sizes --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 8ccca9a4..0bcacb1e 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -242,7 +242,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (ap/set-fonts "Terminus" 18 "Lucida" 14 nil)) ((and (eq window-system 'x) (eq system-type 'gnu/linux/windows)) - (ap/set-fonts "Noto Mono" 15 "Sans" 15 nil)))) + (ap/set-fonts "Noto Mono" 12 "Sans" 12 nil)))) (ap/set-fonts-according-to-system)) #+END_SRC -- cgit 1.4.1 From fee42496ab1efd7267578d40f844c55014f6c260 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 2 Jun 2017 09:58:09 +0200 Subject: Emacs: Setup dired-du-mode --- emacs/.emacs.d/init.org | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 9b814ecf..4917c4bd 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1198,6 +1198,17 @@ Expand subfolders like a tree inside the parent (bind-key "i" #'dired-subtree-toggle dired-mode-map)))) #+END_SRC +** Disk usage + +Combine dired and du (disk usage). + +#+BEGIN_SRC emacs-lisp +(use-package dired-du + :after dired + :config (progn + (setq dired-du-size-format t))) +#+END_SRC + ** Dired-narrow One can already use dired with wildcards to browse a filtered directory listing, but it opens a new buffer. Dired-narrow is a -- cgit 1.4.1 From c215cfcd4d857aba68b70fbf5c8f3131d2763911 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 3 Jun 2017 19:58:46 +0200 Subject: Emacs: Ensure osrelease file exists before reading --- emacs/.emacs.d/init.org | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 1529a6d2..5675f56c 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -21,11 +21,12 @@ Open Emacs with just a plain window. No graphics or messages, please! Are we running on Windows via the WSL? #+BEGIN_SRC emacs-lisp -(with-temp-buffer - (insert-file-contents-literally "/proc/sys/kernel/osrelease") - (decode-coding-region (point-min) (point-max) 'utf-8 t) - (when (string-match "Microsoft$" (buffer-string)) - (setq system-type 'gnu/linux/windows))) +(when (file-exists-p "/proc/sys/kernel/osrelease") + (with-temp-buffer + (insert-file-contents-literally "/proc/sys/kernel/osrelease") + (decode-coding-region (point-min) (point-max) 'utf-8 t) + (when (string-match "Microsoft$" (buffer-string)) + (setq system-type 'gnu/linux/windows)))) #+END_SRC ** Compatibility -- cgit 1.4.1 From 8eeadd7d1930abb31a330f14f2735a10584998da Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 4 Jun 2017 14:46:40 +0200 Subject: Emacs: Configure easy-hugo --- emacs/.emacs.d/init.org | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 5675f56c..34f24c42 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1040,6 +1040,17 @@ Directional window movement ("S-" . windmove-up) ("S-" . windmove-down))) #+END_SRC +* Blogging + +I have a [[https://alanpearce.uk][blog]] that I publish with hugo. + +#+BEGIN_SRC emacs-lisp +(use-package easy-hugo + :config (setq easy-hugo-basedir (car (split-string (shell-command-to-string "ghq list --full-path alanpearce.uk"))) + easy-hugo-url "https://alanpearce.uk" + easy-hugo-default-ext ".md")) +#+END_SRC + * Completion Make built-in completion a bit more intelligent, by adding substring -- cgit 1.4.1 From 6eaab8ee32bae08831da5040d1f0bf13e815ce65 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 4 Jun 2017 15:52:23 +0200 Subject: Emacs: Fix org-src keymap init --- emacs/.emacs.d/init.org | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 34f24c42..c6a59340 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1700,9 +1700,7 @@ Org is wünderbar. (use-package org :bind (("C-c C-a" . org-agenda-list) ("C-c a" . org-agenda) - ("C-c l" . org-store-link) - :map org-src-mode-map - ("C-x C-s" . org-edit-src-exit)) + ("C-c l" . org-store-link)) :defer 8 :init (setq org-replace-disputed-keys t org-ellipsis "…") @@ -1746,6 +1744,12 @@ Org is wünderbar. (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))) + +(use-package org-src + :ensure nil + :after org + :config (progn + (bind-key "C-x C-s" #'org-edit-src-exit org-src-mode-map))) #+END_SRC **** org-babel -- cgit 1.4.1 From 7cbe8257a61d6bedb942d0fd15ad7aa018447012 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 4 Jun 2017 15:52:46 +0200 Subject: Emacs: Load flycheck-vale only if vale is executable --- emacs/.emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index c6a59340..b3458c13 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2388,6 +2388,7 @@ Sometimes I might want to show off my emacs usage. #+BEGIN_SRC emacs-lisp (use-package flycheck-vale + :if (executable-find "vale") :config (progn (add-to-list 'flycheck-vale-modes 'org-mode) (flycheck-vale-setup))) -- cgit 1.4.1 From 6fba65d173fd9372b7580ef3f8c213fb969a8c11 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 5 Jun 2017 12:50:20 +0200 Subject: Emacs: Use AA fonts on X11 --- emacs/.emacs.d/init.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index fe3c6435..45b2a449 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -222,8 +222,8 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (ap/set-fonts "Monaco" 16 "Lucida Grande" 16 t 0.2) (ap/set-fonts "Monoid" 12 "Helvetica Neue" 12 t 0.1)))) ((eq window-system 'x) - (set-fontset-font "fontset-default" 'unicode (font-spec :name "Terminus" :size 18)) - (ap/set-fonts "Terminus" 18 "Lucida" 14 nil)))) + (set-fontset-font "fontset-default" 'unicode (font-spec :name "Iosevka" :size 14)) + (ap/set-fonts "Iosevka" 16 "Noto Sans" 14 nil)))) (ap/set-fonts-according-to-system)) #+END_SRC -- cgit 1.4.1 From 9d5b7f2a1412167e390a6e4f4c3c9401840ae147 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 6 Jun 2017 10:35:47 +0200 Subject: Emacs: Load counsel-projectile after counsel and projectile --- emacs/.emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index a34f148d..028efcd9 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -572,6 +572,7 @@ based upon some folder conventions I use. projectile-completion-system 'ivy))) (use-package counsel-projectile + :after (counsel projectile) :config (progn (counsel-projectile-on) (define-key projectile-mode-map [remap counsel-projectile-ag] #'counsel-projectile-rg))) -- cgit 1.4.1 From ae050e529e4b08bcf025e1c4e77a3da5a6c0ef80 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 6 Jun 2017 11:40:44 +0200 Subject: nix: Add Emacs build with packages Install with `nix-env -iA nixpkgs.myEmacs` (depending on nix namespace) --- nix/.config/nixpkgs/config.nix | 9 +++ nix/.config/nixpkgs/emacs.nix | 156 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 165 insertions(+) create mode 100644 nix/.config/nixpkgs/config.nix create mode 100644 nix/.config/nixpkgs/emacs.nix diff --git a/nix/.config/nixpkgs/config.nix b/nix/.config/nixpkgs/config.nix new file mode 100644 index 00000000..3b506937 --- /dev/null +++ b/nix/.config/nixpkgs/config.nix @@ -0,0 +1,9 @@ +{ pkgs }: { + packageOverrides = super: let + self = super.pkgs; + in with self; rec { + myEmacs = super.callPackage ./emacs.nix {}; + }; + + allowUnfree = true; +} diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix new file mode 100644 index 00000000..84b1831f --- /dev/null +++ b/nix/.config/nixpkgs/emacs.nix @@ -0,0 +1,156 @@ +{ pkgs ? import {}, stdenv }: + +let + myEmacs = if stdenv.isDarwin then pkgs.emacs25Macport else pkgs.emacs; + emacsWithPackages = (pkgs.emacsPackagesNgGen myEmacs).emacsWithPackages; + + elpaBuild = import { + inherit (pkgs) fetchurl lib stdenv texinfo; + emacs = myEmacs; + }; + + hook-helpers = pkgs.callPackage ({ elpaBuild, fetchurl, lib }: elpaBuild { + pname = "hook-helpers"; + version = "1.1"; + src = fetchurl { + url = "http://elpa.gnu.org/packages/hook-helpers-1.1.tar"; + sha256 = "0xvabl0lfc0ijr98clsyh0bqk2fdi1ncl0knn58j2p30gn9958i5"; + }; + packageRequires = []; + meta = { + homepage = https://savannah.nongnu.org/projects/hook-helpers-el/; + license = lib.licenses.free; + }; + }) { + inherit elpaBuild; + inherit (pkgs) fetchurl lib; + }; + + dired-du = pkgs.callPackage ({ elpaBuild, fetchurl, lib }: elpaBuild { + pname = "dired-du"; + version = "0.5"; + src = fetchurl { + url = "http://elpa.gnu.org/packages/dired-du-0.5.tar"; + sha256 = "09yj37p2fa5f81fqrzwghjkyy2ydsf4rbkfwpn2yyvzd5nd97bpl"; + }; + packageRequires = []; + meta = { + homepage = https://github.com/calancha/dired-du; + license = lib.licenses.free; + }; + }) { + inherit elpaBuild; + inherit (pkgs) fetchurl lib; + }; +in + emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [ + diminish + bind-key + use-package + ]) ++ (with epkgs.melpaPackages; [ + ace-link + ace-window + add-node-modules-path + ag + async + auto-compile + avy + bbdb + beginend + cider + clj-refactor + clojure-mode + cmd-to-echo + coffee-mode + command-log-mode + company + company-go + company-nixos-options + company-restclient + company-tern + company-web + counsel + counsel-projectile + crux + cyphejor + dired-du + dired-narrow + dired-plus + dired-subtree + discover-my-major + dockerfile-mode + dtrt-indent + dumb-jump + easy-hugo + editorconfig + elisp-slime-nav + emmet-mode + ensime + exec-path-from-shell + expand-region + eyebrowse + eziam-theme + flow-minor-mode + flycheck + flycheck-flow + flycheck-pos-tip + flycheck-vale + geiser + ggtags + ghq + git-gutter-fringe + git-messenger + git-timemachine + go-eldoc + go-mode + go-projectile + goto-chg + haskell-mode + highlight-stages + imenu-anywhere + indium + jinja2-mode + js2-mode + js2-refactor + json-mode + ledger-mode + lua-mode + magit + markdown-mode + move-text + multiple-cursors + nginx-mode + nix-mode + org-journal + page-break-lines + paredit + password-store + projectile + projectile-ripgrep + quickrun + redshank + relative-buffers + restclient + ripgrep + scala-mode + scss-mode + shrink-whitespace + slime + smart-tabs-mode + smartparens + smex + swiper + tern + undo-tree + visual-regexp + volatile-highlights + web-mode + wgrep-ag + which-key + yaml-mode + ]) ++ (with epkgs.elpaPackages; [ + beacon + ]) ++ [ + hook-helpers # defined above + # From main packages set + ]) -- cgit 1.4.1 From 8fc83608b84e7f7d36dcce00e4a43db20f9ca69e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 6 Jun 2017 11:42:30 +0200 Subject: Emacs: Run with pure packages if installed via nix This is not a perfect method of detection, but if I install emacs via nix I'm almost certainly going to use my custom derivation. Checking the equality of system-name and emacs-build-system makes it more likely to be correct, as a normal nix emacs build would probably installed from a pre-built hydra package. --- emacs/.emacs.d/init.org | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 028efcd9..0958b5bd 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -58,28 +58,35 @@ the buffer to be empty. #+BEGIN_SRC emacs-lisp (eval-and-compile + (defvar nix-emacs (and (string-match "^/nix/store" invocation-directory) + (string-equal emacs-build-system system-name))) + (setq tls-checktrust t gnutls-verify-error t - package-archives '(("gnu" . "https://elpa.gnu.org/packages/") - ("melpa-stable" . "https://stable.melpa.org/packages/") - ("melpa" . "https://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" . 10) - ("gnu" . 10) - ("melpa-stable" . 5) - ("marmalade" . 0)) package-menu-async t + package-user-dir (concat "~/.emacs.d/packages/" emacs-version "/elpa") package-menu-hide-low-priority t) + (if nix-emacs + (progn (setq package-archives nil) + (package-initialize)) + (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") + ("melpa-stable" . "https://stable.melpa.org/packages/") + ("melpa" . "https://melpa.org/packages/")) + package-pinned-packages '(("use-package" . melpa-stable) + ("diminish" . melpa-stable) + ("bind-key" . melpa-stable)) + package-archive-priorities '(("melpa" . 10) + ("gnu" . 10) + ("melpa-stable" . 5) + ("marmalade" . 0)))) (when (eq system-type 'darwin) (with-eval-after-load "gnutls" (add-to-list 'gnutls-trustfiles "/etc/ssl/cert.pem"))) - (package-initialize) - (unless (package-installed-p 'use-package) - (package-refresh-contents) - (package-install 'use-package))) + (unless nix-emacs + (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) @@ -87,7 +94,7 @@ the buffer to be empty. (use-package use-package :commands (use-package-autoload-keymap) :defer 5)) -(setq use-package-always-ensure t +(setq use-package-always-ensure (not nix-emacs) package-enable-at-startup nil) #+END_SRC @@ -2077,15 +2084,13 @@ really seem to use it. Let’s try using Scala. #+BEGIN_SRC emacs-lisp -(use-package scala-mode - :pin melpa-stable) +(use-package scala-mode) #+END_SRC And add ensime, an IDE-style environment. #+BEGIN_SRC emacs-lisp -(use-package ensime - :pin melpa-stable) +(use-package ensime) #+END_SRC ** Web development -- cgit 1.4.1 From 985c401c749292bf0990b8dcf59d8bf5afc05dc3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 6 Jun 2017 11:47:23 +0200 Subject: Emacs: Load packages at startup if daemon --- emacs/.emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 0958b5bd..7dc4362e 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -95,6 +95,7 @@ the buffer to be empty. :commands (use-package-autoload-keymap) :defer 5)) (setq use-package-always-ensure (not nix-emacs) + use-package-always-demand (daemonp) package-enable-at-startup nil) #+END_SRC -- cgit 1.4.1 From 53be938b03a2d1cfcf34221f0e659b20f3426664 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 6 Jun 2017 11:49:31 +0200 Subject: nix: Fix mis-organised dired-du package --- nix/.config/nixpkgs/emacs.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix index 84b1831f..87e7bba8 100644 --- a/nix/.config/nixpkgs/emacs.nix +++ b/nix/.config/nixpkgs/emacs.nix @@ -73,7 +73,6 @@ in counsel-projectile crux cyphejor - dired-du dired-narrow dired-plus dired-subtree @@ -151,6 +150,8 @@ in ]) ++ (with epkgs.elpaPackages; [ beacon ]) ++ [ - hook-helpers # defined above + # defined above + hook-helpers + dired-du # From main packages set ]) -- cgit 1.4.1 From a67a49386bcbef7ad83706e41dc8842c4b0bac58 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 6 Jun 2017 13:46:37 +0200 Subject: Emacs: Fix undefined server-name error --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 7dc4362e..ff3ca5e3 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -189,7 +189,7 @@ Eziam looks nice, too (use-package eziam-light-theme :ensure eziam-theme :if (or window-system - server-name) + (daemonp)) :defines (eziam-scale-headings) :config (progn (setq eziam-scale-headings nil) -- cgit 1.4.1 From eab92f65759d4f95c43b3ec9efd93df72f3a29d1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 6 Jun 2017 15:15:08 +0200 Subject: Emacs: Add completion for yarn-run command --- emacs/.emacs.d/init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index ff3ca5e3..acc92fc2 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -564,7 +564,8 @@ based upon some folder conventions I use. (cmd-to-echo "yarn" (concat "add " package)))) (defun yarn-run (cmd) - (interactive "scommand: ") + (interactive (list + (projectile-completing-read "command: " (alist-get 'scripts (json-read-file (expand-file-name "package.json" (projectile-project-root))))))) (projectile-with-default-dir (projectile-project-root) (cmd-to-echo "yarn" (concat "run " cmd)))) -- cgit 1.4.1 From 96a78bc25bf55e8f55d113b09e8de59b5b94e8b3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 6 Jun 2017 15:15:27 +0200 Subject: Emacs: Be explicitly positive when enabling projectile-mode --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index acc92fc2..456b99f8 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -545,7 +545,7 @@ based upon some folder conventions I use. :demand t :diminish projectile-mode :config (progn - (projectile-mode 1) + (projectile-mode +1) (add-to-list 'projectile-globally-ignored-directories ".stversions") (defun yarn-install (&optional arg) -- cgit 1.4.1 From 092cf6177b2214d9cd3df63a8398366f6ac7a531 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 6 Jun 2017 15:15:43 +0200 Subject: Emacs: Update projectile commentary --- emacs/.emacs.d/init.org | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 456b99f8..124fa15a 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -532,8 +532,7 @@ Step over Silver Search, here comes a new challenger. ** Projectile Projectile is awesome for working in projects, especially VCS-backed -ones. I added a couple of functions to allow me to open new projects -based upon some folder conventions I use. +ones. #+BEGIN_SRC emacs-lisp (use-package projectile -- cgit 1.4.1 From 272f3c8e6e368ac5abccc4a54ddbfc6b1de85f89 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 7 Jun 2017 17:16:12 +0200 Subject: Emacs: Fix projectile initialisation projectile-mode does not enable projectile in all buffers. projectile-global-mode is deprecated as a _command_. It is necessary to use the function for the global behaviour. --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 124fa15a..745bba8a 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -544,7 +544,7 @@ ones. :demand t :diminish projectile-mode :config (progn - (projectile-mode +1) + (projectile-global-mode +1) (add-to-list 'projectile-globally-ignored-directories ".stversions") (defun yarn-install (&optional arg) -- cgit 1.4.1 From 02a125e944e62ce9c4fe8a0b34e7d973a6ca46f9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 8 Jun 2017 12:12:36 +0200 Subject: stow: Disable tree-folding Create new directories as directories when installing a package set, rather than "optimising" by linking the parent directory. e.g. .emacs.d on a new system. It should always be a directory, as emacs stores files there that are not for the consideration of stow. --- stow | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stow b/stow index c708e49f..761a5b5d 100755 --- a/stow +++ b/stow @@ -1,2 +1,2 @@ #!/bin/sh -stow --target="$HOME" "$@" \ No newline at end of file +stow --target="$HOME" --no-folding "$@" -- cgit 1.4.1 From f659263a26f84c8f4540e3ede0b7eba6cad00e2a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 9 Jun 2017 22:08:43 +0200 Subject: zsh: Add function to set emacs' SSH agent socket --- zsh/.config/zsh/.zshrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index c8f951bf..e671e225 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -21,6 +21,9 @@ _emacs_function () { projectile () { _emacs_function projectile-switch-project-by-name ${1:-$PWD} } +set-emacs-ssh-agent () { + emacsclient -e "(setenv \"SSH_AUTH_SOCK\" \"$SSH_AUTH_SOCK\")" +} yarn () { PREFIX=$HOME/.local command yarn "$@" } -- cgit 1.4.1 From 91316116c23af923dcdb828c03daad7eac3c8f9e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 9 Jun 2017 22:09:24 +0200 Subject: nix: Parametrise use of macport --- nix/.config/nixpkgs/emacs.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix index 87e7bba8..cb879a5d 100644 --- a/nix/.config/nixpkgs/emacs.nix +++ b/nix/.config/nixpkgs/emacs.nix @@ -1,7 +1,11 @@ -{ pkgs ? import {}, stdenv }: +{ + pkgs ? import {}, + stdenv, + withMacPort ? stdenv.isDarwin +}: let - myEmacs = if stdenv.isDarwin then pkgs.emacs25Macport else pkgs.emacs; + myEmacs = if withMacPort then pkgs.emacs25Macport else pkgs.emacs; emacsWithPackages = (pkgs.emacsPackagesNgGen myEmacs).emacsWithPackages; elpaBuild = import { -- cgit 1.4.1 From 66d9186ccf874950d6f1267791ad86d61d0af7e6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 12 Jun 2017 14:56:20 +0200 Subject: Emacs: Don't slant JS object property keywords It doesn't work well with computed properties and smartparens. I'm not too concerned about why right now, so just work around it. --- emacs/.emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 745bba8a..b4d7c87b 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -197,6 +197,7 @@ Eziam looks nice, too (custom-theme-set-faces 'user '(default ((t (:background "#ffffff")))) '(js2-function-call ((t (:underline nil)))) + '(js2-object-property ((t (:slant normal)))) '(font-lock-keyword-face ((t (:weight normal)))) '(git-gutter-fr:added ((t (:foreground "#96a4ab")))) '(git-gutter-fr:modified ((t (:foreground "#96a4ab")))) -- cgit 1.4.1 From 60abb4d802d2bf55b8aac25e69d34c06096ad761 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 12 Jun 2017 18:57:11 +0200 Subject: Emacs: Remove dired-+ I don't think I use it --- emacs/.emacs.d/init.org | 8 -------- nix/.config/nixpkgs/emacs.nix | 1 - 2 files changed, 9 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 745bba8a..f0812896 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1197,14 +1197,6 @@ Don’t show uninteresting files in dired listings. (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))) -#+END_SRC - Expand subfolders like a tree inside the parent #+BEGIN_SRC emacs-lisp diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix index cb879a5d..96617362 100644 --- a/nix/.config/nixpkgs/emacs.nix +++ b/nix/.config/nixpkgs/emacs.nix @@ -78,7 +78,6 @@ in crux cyphejor dired-narrow - dired-plus dired-subtree discover-my-major dockerfile-mode -- cgit 1.4.1 From c1685df0853bcdb136ddb3216256937087441b60 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 12 Jun 2017 19:11:11 +0200 Subject: nix: Allow emacs package to be specified --- nix/.config/nixpkgs/emacs.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix index 96617362..1e439b6d 100644 --- a/nix/.config/nixpkgs/emacs.nix +++ b/nix/.config/nixpkgs/emacs.nix @@ -1,11 +1,11 @@ { pkgs ? import {}, + emacs ? pkgs.emacs, stdenv, - withMacPort ? stdenv.isDarwin }: let - myEmacs = if withMacPort then pkgs.emacs25Macport else pkgs.emacs; + myEmacs = emacs; emacsWithPackages = (pkgs.emacsPackagesNgGen myEmacs).emacsWithPackages; elpaBuild = import { -- cgit 1.4.1 From e3192dc1da4c77966653bca8d8e9437c90640527 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 12 Jun 2017 19:11:27 +0200 Subject: Emacs: Setup org-journal again Let's see if I use it more often now --- emacs/.emacs.d/init.org | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index f0812896..49ce47f1 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1782,7 +1782,8 @@ I can use this to keep a journal. I should use it. :bind ("s-j" . org-journal-new-entry) :defer 20 :config (progn - (setq org-journal-date-format "%A, %d %B %Y") + (setq org-journal-date-format "%A, %d %B %Y" + org-journal-dir "~/Sync/Default/Documents/journal") (defun org-journal-display-entry-yesterday () "Show org-journal entry for yesterday" (interactive) @@ -2390,6 +2391,7 @@ Sometimes I might want to show off my emacs usage. :if (executable-find "vale") :config (progn (add-to-list 'flycheck-vale-modes 'org-mode) + (add-to-list 'flycheck-vale-modes 'org-journal-mode) (flycheck-vale-setup))) #+END_SRC -- cgit 1.4.1 From de9b9c137bb1cb3d8ed3f4c4ab4a98e9fb150b5c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 13 Jun 2017 10:10:54 +0200 Subject: zsh: Don't hardcode zpath to macports site-functions --- zsh/.config/zsh/.zshrc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index e671e225..edd26451 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -7,11 +7,6 @@ HISTFILE=${XDG_CACHE_HOME:=$HOME/.cache}/zsh/history WORDCHARS=${${WORDCHARS//[-.]}//[\/]} -if [[ -d /opt/local/share/zsh/site-functions ]] -then - fpath+=(/opt/local/share/zsh/site-functions) -fi - export EDITOR=emacsclient alias ec=emacsclient alias open-project=projectile -- cgit 1.4.1 From 867f8a4c5eefcce37933a20c06f5f82585561f43 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 13 Jun 2017 10:11:13 +0200 Subject: zsh: Load ghq's zsh integration via zplugin --- zsh/.config/zsh/.zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index edd26451..e1ff1dd3 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -145,7 +145,7 @@ fi if [[ -n $commands[ghq] ]] then - fpath+=("${GOPATH:=$HOME/go}/src/github.com/motemen/ghq/zsh/") + zplugin load "${GOPATH:=$HOME/go}/src/github.com/motemen/ghq/zsh/" fi autoload -Uz compinit -- cgit 1.4.1 From 606dd4aebd11b0e483ec812aa2bca9a87ee869d7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 13 Jun 2017 12:09:20 +0200 Subject: zsh: Ensure ghq completion is installed --- zsh/.config/zsh/.zshrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index e1ff1dd3..c83aa234 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -153,6 +153,11 @@ compinit zplugin cdreplay -q +if [[ -n $commands[ghq] && -z $functions[_ghq] ]] +then + zplugin creinstall "${GOPATH:=$HOME/go}/src/github.com/motemen/ghq/zsh/" +fi + # General configuration if [[ -n $commands[hub] ]] -- cgit 1.4.1 From 09c2fc0d1d5cb73008278f90c5638da78f141e4c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 16 Jun 2017 21:12:04 +0200 Subject: Emacs: Remove unused theme declarations --- emacs/.emacs.d/init.org | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 841fa9d8..ba411058 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -156,34 +156,8 @@ Ring the bell sometimes, but not so often ** Colours -Let’s try a more minimal theme. - -#+BEGIN_SRC emacs-lisp -(use-package minimal-theme - :disabled t - :config (progn - (load-theme 'minimal-light t))) -#+END_SRC - -Let’s try a basic theme. - -#+BEGIN_SRC emacs-lisp -(use-package basic-theme - :if (display-graphic-p) - :disabled t - :config (progn - (load-theme 'basic t) - - (set-face-background 'mode-line "#a1b56c") - (set-face-background 'border "#a1b56c") - (set-face-foreground 'border "#a1b56c") - (set-face-background 'vertical-border "#a1b56c") - (set-face-foreground 'vertical-border "#a1b56c") - (set-face-background 'window-divider "#a1b56c") - (set-face-foreground 'window-divider "#a1b56c"))) -#+END_SRC - -Eziam looks nice, too +Eziam looks nice, too, except for the non-white background. I prefer +white because most other application backgrounds are that colour. #+BEGIN_SRC emacs-lisp (use-package eziam-light-theme -- cgit 1.4.1 From 32f0ff25f19c4dd2fae22f4fcb01286beb098808 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 18 Jun 2017 22:52:10 +0200 Subject: Emacs: Improve nix-emacs check --- emacs/.emacs.d/init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index ba411058..287502b0 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -58,8 +58,9 @@ the buffer to be empty. #+BEGIN_SRC emacs-lisp (eval-and-compile + (require 'seq) (defvar nix-emacs (and (string-match "^/nix/store" invocation-directory) - (string-equal emacs-build-system system-name))) + (not (null (seq-some (lambda (dir) (string-match "^/nix/store" dir)) load-path))))) (setq tls-checktrust t gnutls-verify-error t -- cgit 1.4.1 From 625b5d8aaec0f366b88a265cc4bd4e823bf7bb85 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 18 Jun 2017 22:52:34 +0200 Subject: Emacs: Try white-theme --- emacs/.emacs.d/init.org | 15 +++++++++++++++ nix/.config/nixpkgs/emacs.nix | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 287502b0..ee56d8f4 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -163,6 +163,7 @@ white because most other application backgrounds are that colour. #+BEGIN_SRC emacs-lisp (use-package eziam-light-theme :ensure eziam-theme + :disabled t :if (or window-system (daemonp)) :defines (eziam-scale-headings) @@ -179,6 +180,20 @@ white because most other application backgrounds are that colour. '(git-gutter-fr:deleted ((t (:foreground "#96a4ab"))))))) #+END_SRC +White-theme. Sounds like a good idea. + +#+BEGIN_SRC emacs-lisp +(use-package white-theme + :if (or window-system + (daemonp)) + :config (progn + (load-theme 'white-theme t) + (custom-theme-set-faces 'user + '(git-gutter-fr:added ((t (:foreground "#96a4ab")))) + '(git-gutter-fr:modified ((t (:foreground "#96a4ab")))) + '(git-gutter-fr:deleted ((t (:foreground "#96a4ab"))))))) +#+END_SRC + Highlighting quasi-quoted expressions in lisps is quite useful, but I don't need it all the time. I'll keep it around for a while so that I can enable it if needed. diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix index 1e439b6d..6740719f 100644 --- a/nix/.config/nixpkgs/emacs.nix +++ b/nix/.config/nixpkgs/emacs.nix @@ -91,7 +91,6 @@ in exec-path-from-shell expand-region eyebrowse - eziam-theme flow-minor-mode flycheck flycheck-flow @@ -147,6 +146,7 @@ in visual-regexp volatile-highlights web-mode + white-theme wgrep-ag which-key yaml-mode -- cgit 1.4.1 From 410d44b81165a38e59924ad93a3bfab030db6f36 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 18 Jun 2017 22:53:01 +0200 Subject: Emacs: use exec-path-from-shell on Linux daemons As it's usually run via systemd, there isn't much of an environment --- emacs/.emacs.d/init.org | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index ee56d8f4..645bdcd6 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -408,7 +408,9 @@ It starts up without an environment in this case as well. #+BEGIN_SRC emacs-lisp (use-package exec-path-from-shell :if (or (eq system-type 'darwin) - (eq system-type 'gnu/linux/windows)) + (eq system-type 'gnu/linux/windows) + (and (eq system-type 'gnu/linux) + (daemonp))) :config (progn (setq exec-path-from-shell-arguments '("-l")) (exec-path-from-shell-initialize))) -- cgit 1.4.1 From 7040490859f5c771c45bcf147d9e2b57f0117d9e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 18 Jun 2017 22:53:42 +0200 Subject: Emacs: Support nodeJS projects in projectile --- emacs/.emacs.d/init.org | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 645bdcd6..81cba44e 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -570,7 +570,17 @@ ones. (expand-file-name project-dir (ghq--find-root)) arg))) (setq projectile-switch-project-action #'projectile-commander - projectile-completion-system 'ivy))) + projectile-completion-system 'ivy + projectile-create-missing-test-files t) + + (defun ap/projectile-test-suffix (project-type) + (cond + ((member project-type '(node-yarn node-npm)) ".test") + (t (projectile-test-suffix project-type)))) + (setq projectile-test-suffix-function #'ap/projectile-test-suffix) + + (projectile-register-project-type 'node-yarn '("yarn.lock") "yarn start" "yarn test") + (projectile-register-project-type 'node '("package.json") "npm start" "npm test"))) (use-package counsel-projectile :after (counsel projectile) -- cgit 1.4.1 From 904e91bab4fa9e27dc444cec1b23b93732f4db62 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 18 Jun 2017 22:54:12 +0200 Subject: Emacs: Disable js missing semicolon warning --- emacs/.emacs.d/init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 81cba44e..66793e78 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2120,7 +2120,8 @@ an AST internally, so it can work with it almost like a lisp. (setq js2-basic-offset 2 js-switch-indent-offset 2 js2-include-node-externs t - js2-highlight-level 1))) + js2-highlight-level 1 + js2-strict-missing-semi-warning nil))) #+END_SRC **** js2-refactor -- cgit 1.4.1 From be734c82225941ee0a89c39807ab26148b793a36 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 18 Jun 2017 22:54:33 +0200 Subject: Emacs: Use web-mode for nunjucks.njk templates --- emacs/.emacs.d/init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 66793e78..7aeb2163 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2276,7 +2276,8 @@ of them as well. :mode (("/views/.*\\.php\\'" . web-mode) ("\\.html\\'" . web-mode) ("/templates/.*\\.php\\'" . web-mode) - ("\\.ejs\\'" . web-mode)) + ("\\.ejs\\'" . web-mode) + ("\\.njk\\'" . web-mode)) :config (progn (setq web-mode-code-indent-offset 2 web-mode-css-indent-offset 2 -- cgit 1.4.1 From 6a3adcad704b8a3c06fc397b5a32a3247dfb36f4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 18 Jun 2017 22:54:57 +0200 Subject: Emacs: Tweak Linux/X11 fonts --- emacs/.emacs.d/init.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 7aeb2163..5c44022e 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -241,8 +241,8 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (ap/set-fonts "Monoid" 12 "Helvetica Neue" 12 t 0.1)))) ((and (eq window-system 'x) (not (eq system-type 'gnu/linux/windows))) - (set-fontset-font "fontset-default" 'unicode (font-spec :name "Iosevka" :size 14)) - (ap/set-fonts "Iosevka" 16 "Noto Sans" 14 nil)) + (set-fontset-font "fontset-default" 'unicode (font-spec :name "PT Mono" :size 17)) + (ap/set-fonts "PT Mono" 17 "Noto Sans" 14 nil)) ((and (eq window-system 'x) (eq system-type 'gnu/linux/windows)) (ap/set-fonts "Noto Mono" 12 "Sans" 12 nil)))) -- cgit 1.4.1 From 405ba466460f9d987d331e64fe28eaba481b9c62 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 19 Jun 2017 10:25:31 +0200 Subject: Emacs: Install rjsx-mode for React component files --- emacs/.emacs.d/init.org | 12 ++++++++++-- nix/.config/nixpkgs/emacs.nix | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 5c44022e..15702067 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2099,8 +2099,7 @@ an AST internally, so it can work with it almost like a lisp. #+BEGIN_SRC emacs-lisp (use-package js2-mode - :mode (("\\.js\\'" . js2-mode) - ("\\.jsx\\'" . js2-jsx-mode)) + :mode (("\\.js\\'" . js2-mode)) :interpreter ("node" . js2-mode) :functions js2-next-error :config (progn @@ -2124,6 +2123,15 @@ an AST internally, so it can work with it almost like a lisp. js2-strict-missing-semi-warning nil))) #+END_SRC +**** rjsx-mode + +A set of advice for js2-jsx-mode to work better with React. + +#+BEGIN_SRC emacs-lisp +(use-package rjsx-mode + :mode (("\\.jsx\\'" . rjsx-mode))) +#+END_SRC + **** js2-refactor Thanks to the AST provided by js2-mode, refactoring is possible. This diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix index 6740719f..86cf3b5f 100644 --- a/nix/.config/nixpkgs/emacs.nix +++ b/nix/.config/nixpkgs/emacs.nix @@ -133,6 +133,7 @@ in relative-buffers restclient ripgrep + rjsx-mode scala-mode scss-mode shrink-whitespace -- cgit 1.4.1 From 5ff134598c2c94cede4e30a902494747d67d6358 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 19 Jun 2017 10:26:10 +0200 Subject: Emacs: Setup toml-mode --- emacs/.emacs.d/init.org | 3 +++ nix/.config/nixpkgs/emacs.nix | 1 + 2 files changed, 4 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 15702067..3e551078 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1636,6 +1636,9 @@ configuration files. :config (progn (setq scss-compile-at-save nil))) +(use-package toml-mode + :mode ("\\.toml\\'" . toml-mode)) + (use-package yaml-mode :mode (("/group_vars/.*" . yaml-mode) ("/host_vars/.*" . yaml-mode))) diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix index 86cf3b5f..6ced3fd5 100644 --- a/nix/.config/nixpkgs/emacs.nix +++ b/nix/.config/nixpkgs/emacs.nix @@ -143,6 +143,7 @@ in smex swiper tern + toml-mode undo-tree visual-regexp volatile-highlights -- cgit 1.4.1 From c8b91e75cb3692b438d9c728080b15112b4e9989 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 19 Jun 2017 10:27:34 +0200 Subject: Emacs: Fix invocation of white-theme --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 3e551078..87d70394 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -187,7 +187,7 @@ White-theme. Sounds like a good idea. :if (or window-system (daemonp)) :config (progn - (load-theme 'white-theme t) + (load-theme 'white t) (custom-theme-set-faces 'user '(git-gutter-fr:added ((t (:foreground "#96a4ab")))) '(git-gutter-fr:modified ((t (:foreground "#96a4ab")))) -- cgit 1.4.1 From f82a7e7fcc485555f07cb5c9ca5e99e06ee04876 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 19 Jun 2017 12:30:21 +0200 Subject: Emacs: Don't italicise font-lock strings in white-theme --- emacs/.emacs.d/init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 87d70394..b26e5286 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -191,7 +191,8 @@ White-theme. Sounds like a good idea. (custom-theme-set-faces 'user '(git-gutter-fr:added ((t (:foreground "#96a4ab")))) '(git-gutter-fr:modified ((t (:foreground "#96a4ab")))) - '(git-gutter-fr:deleted ((t (:foreground "#96a4ab"))))))) + '(git-gutter-fr:deleted ((t (:foreground "#96a4ab")))) + '(font-lock-string-face ((t (:slant normal))))))) #+END_SRC Highlighting quasi-quoted expressions in lisps is quite useful, but I -- cgit 1.4.1 From 238eda758c6b399a1f74a6eba3d32a802acc358a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 19 Jun 2017 12:30:38 +0200 Subject: Emacs: Install rainbow-mode for manual usage --- nix/.config/nixpkgs/emacs.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix index 6ced3fd5..4d25a865 100644 --- a/nix/.config/nixpkgs/emacs.nix +++ b/nix/.config/nixpkgs/emacs.nix @@ -154,6 +154,7 @@ in yaml-mode ]) ++ (with epkgs.elpaPackages; [ beacon + rainbow-mode ]) ++ [ # defined above hook-helpers -- cgit 1.4.1 From 46b488feae34f6f21a17ddc0d8645e49b5d5e9ba Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 22 Jun 2017 13:46:43 +0200 Subject: Emacs: Install nix-sandbox --- emacs/.emacs.d/init.org | 16 ++++++++++++++++ nix/.config/nixpkgs/emacs.nix | 1 + 2 files changed, 17 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index b26e5286..69163f59 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -417,6 +417,22 @@ It starts up without an environment in this case as well. (exec-path-from-shell-initialize))) #+END_SRC +** NixOS sandboxes + +I'm currently exploring using nix to create sandboxes for +development. This package allows using tools from inside sandboxes, +and some convenience commands for building packages and launching shells. + +#+BEGIN_SRC emacs-lisp +(use-package nix-sandbox + :config (progn + (with-eval-after-load 'flycheck + (setq flycheck-command-wrapper-function + (lambda (command) (apply 'nix-shell-command (nix-current-sandbox) command)) + flycheck-executable-find + (lambda (cmd) (nix-executable-find (nix-current-sandbox) cmd)))))) +#+END_SRC + * Keybindings I think =set-keyboard-coding-system= stops OS X from doing something diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix index 4d25a865..afa84a46 100644 --- a/nix/.config/nixpkgs/emacs.nix +++ b/nix/.config/nixpkgs/emacs.nix @@ -122,6 +122,7 @@ in multiple-cursors nginx-mode nix-mode + nix-sandbox org-journal page-break-lines paredit -- cgit 1.4.1 From 5ff313b3ea8508574a9e3aea84850d246a696876 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 23 Jun 2017 14:58:08 +0200 Subject: Emacs: Change git-gutter colours to match white-theme --- emacs/.emacs.d/init.org | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 69163f59..e86948b1 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -189,9 +189,9 @@ White-theme. Sounds like a good idea. :config (progn (load-theme 'white t) (custom-theme-set-faces 'user - '(git-gutter-fr:added ((t (:foreground "#96a4ab")))) - '(git-gutter-fr:modified ((t (:foreground "#96a4ab")))) - '(git-gutter-fr:deleted ((t (:foreground "#96a4ab")))) + '(git-gutter-fr:added ((t (:foreground "#b8b8b8")))) + '(git-gutter-fr:modified ((t (:foreground "#b8b8b8")))) + '(git-gutter-fr:deleted ((t (:foreground "#b8b8b8")))) '(font-lock-string-face ((t (:slant normal))))))) #+END_SRC -- cgit 1.4.1 From ddc67cf42b0d0a7053dc23cded37a4ed54e8f605 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 23 Jun 2017 16:49:21 +0200 Subject: Emacs: Only enable flycheck-flow when executable found --- emacs/.emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index e86948b1..4b568fe9 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1851,6 +1851,7 @@ Show flycheck errors in a little popup, so I don't lose my place #+BEGIN_SRC emacs-lisp (use-package flycheck-flow :after js2-mode + :if (executable-find "flow") :config (progn (flycheck-add-next-checker 'javascript-eslint 'javascript-flow))) #+END_SRC -- cgit 1.4.1 From 25ee213cb3c97ef29431619951596e22e06fe192 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 23 Jun 2017 16:52:01 +0200 Subject: Emacs: Setup Emmet in CSS mode --- emacs/.emacs.d/init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 4b568fe9..8cc0a7c3 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2291,7 +2291,8 @@ frameworks that require multiple nested elements to do anything useful. :diminish (emmet-mode . " >") :init (progn (setq emmet-indentation 2) - (add-hook 'web-mode-hook #'emmet-mode))) + (add-hook 'web-mode-hook #'emmet-mode) + (add-hook 'css-mode-hook #'emmet-mode))) #+END_SRC *** web-mode -- cgit 1.4.1 From f25836751e28eb56bf9df6e6b3cc5b08a6e1215b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 25 Jun 2017 21:10:04 +0200 Subject: Emacs: Make org-journal mode nicer to work in --- emacs/.emacs.d/init.org | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 8cc0a7c3..301e18ad 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -214,7 +214,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (defun use-variable-fonts () (interactive) (variable-pitch-mode) - (setq cursor-type 'bar)) + (setq cursor-type '(bar . 1))) (defun ap/set-fonts (mono-face mono-font-size variable-face variable-font-size antialias &optional new-line-spacing) (if (boundp 'ns-antialias-text) @@ -1807,6 +1807,14 @@ I can use this to keep a journal. I should use it. :config (progn (setq org-journal-date-format "%A, %d %B %Y" org-journal-dir "~/Sync/Default/Documents/journal") + + (define-hook-helper org-journal-mode () + (use-variable-fonts) + (text-scale-adjust 4) + (if smartparens-strict-mode + (smartparens-strict-mode -1)) + (if show-smartparens-mode + (show-smartparens-mode -1))) (defun org-journal-display-entry-yesterday () "Show org-journal entry for yesterday" (interactive) -- cgit 1.4.1 From 61953fab3d89f33468a854d512a4a8e3c36e258d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 26 Jun 2017 08:56:37 +0200 Subject: Emacs: Improve emmet-mode setup --- emacs/.emacs.d/init.org | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 8cc0a7c3..3d3cb5e0 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2290,8 +2290,9 @@ frameworks that require multiple nested elements to do anything useful. :commands (emmet-mode) :diminish (emmet-mode . " >") :init (progn - (setq emmet-indentation 2) - (add-hook 'web-mode-hook #'emmet-mode) + (setq emmet-indentation 2 + emmet-self-closing-tag-style " /") + (add-hook 'sgml-mode-hook #'emmet-mode) (add-hook 'css-mode-hook #'emmet-mode))) #+END_SRC -- cgit 1.4.1 From 681ed8c8324205d69ad2c083737f72409c3df162 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 26 Jun 2017 14:40:04 +0200 Subject: Emacs: use nix wrappers for flycheck iff sandbox detected --- emacs/.emacs.d/init.org | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index aa2ea28d..30046891 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -428,9 +428,15 @@ and some convenience commands for building packages and launching shells. :config (progn (with-eval-after-load 'flycheck (setq flycheck-command-wrapper-function - (lambda (command) (apply 'nix-shell-command (nix-current-sandbox) command)) + (lambda (command) + (if (nix-current-sandbox) + (apply 'nix-shell-command (nix-current-sandbox) command) + command)) flycheck-executable-find - (lambda (cmd) (nix-executable-find (nix-current-sandbox) cmd)))))) + (lambda (cmd) + (if (nix-current-sandbox) + (nix-executable-find (nix-current-sandbox) cmd) + (executable-find cmd))))))) #+END_SRC * Keybindings -- cgit 1.4.1 From 5194cca4d336e136caa5a0009c3f6e25e75b2a48 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 26 Jun 2017 14:40:33 +0200 Subject: Emacs: Use electric-indent everywhere; not just in C-like modes --- emacs/.emacs.d/init.org | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 30046891..2082f884 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -864,6 +864,7 @@ tabstops is probably never going to happen. #+BEGIN_SRC emacs-lisp (setq-default tab-width 2 indent-tabs-mode nil) +(electric-indent-mode +1) #+END_SRC @@ -2092,8 +2093,6 @@ quite a few other modes are derived from it. #+BEGIN_SRC emacs-lisp (use-package cc-mode :defer 5 - :init (progn - (add-hook 'c-mode-common-hook #'electric-indent-mode)) :config (progn (setq c-default-style '((java-mode . "java") (awk-mode . "awk") -- cgit 1.4.1 From 764f93497bea2058ae51466863a9659e7f4e2c8f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 27 Jun 2017 16:51:29 +0200 Subject: Emacs: Enable prettify-symbols-mode --- emacs/.emacs.d/init.org | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 2082f884..87ac27ba 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -258,6 +258,13 @@ on the right things. (t . 1))) #+END_SRC +Make symbols prettier. Turns out, in many cases, this is already +configured, just not enabled. + +#+BEGIN_SRC emacs-lisp +(global-prettify-symbols-mode +1) +#+END_SRC + ** Page Breaks By default, Emacs displays page breaks as ^L. Lines look much nicer. -- cgit 1.4.1 From 92bdf0b68575dea2a7c5335c76611c5e66508b29 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 29 Jun 2017 00:23:15 +0200 Subject: Emacs: Fix incorrectly detection of editorconfig-mode --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 87ac27ba..a6474799 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -905,7 +905,7 @@ guesses the correct settings for me. (use-package dtrt-indent :config (progn (define-hook-helper after-change-major-mode () - (unless (and (fboundp editorconfig-mode) + (unless (and (boundp editorconfig-mode) editorconfig-mode) (dtrt-indent-adapt))) (defadvice dtrt-indent-try-set-offset (after toggle-smart-tabs activate) -- cgit 1.4.1 From 1b5b806cc3ed758ff53e38ff0695b824e84d84c3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 4 Jul 2017 09:57:55 +0200 Subject: Emacs: Remove column and line number from modeline --- emacs/.emacs.d/init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index a6474799..406c15f3 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -286,7 +286,8 @@ correct, at least for Liberation Mono. ** Modeline #+BEGIN_SRC emacs-lisp -(column-number-mode t) +(column-number-mode -1) +(line-number-mode -1) (size-indication-mode t) (setq frame-title-format '("%f" (dired-directory dired-directory))) -- cgit 1.4.1 From 46d1b3c01050695d04055490242427e845da4354 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 4 Jul 2017 09:58:42 +0200 Subject: Emacs: Diminish editorconfig mode --- emacs/.emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 406c15f3..a3bd64fa 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -894,6 +894,7 @@ with spaces. Perfect! #+BEGIN_SRC emacs-lisp (use-package editorconfig + :diminish "EC" :config (editorconfig-mode 1)) #+END_SRC -- cgit 1.4.1 From 67259c20e4abc05c4df23afeab021358f0ef1566 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 4 Jul 2017 10:04:17 +0200 Subject: Emacs: Diminish flyspell mode --- emacs/.emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index a3bd64fa..db0469f0 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2395,6 +2395,7 @@ Sometimes I might want to show off my emacs usage. #+BEGIN_SRC emacs-lisp (use-package flyspell + :diminish "﹏" :config (progn (defun flyspell-detect-ispell-args (&optional run-together) "If RUN-TOGETHER is true, spell check the CamelCase words. -- cgit 1.4.1 From ad4197f2e45fe1706d6ef0ccd3518244f545617c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 5 Jul 2017 13:33:58 +0200 Subject: nix: Use node 8 for node packages --- nix/.config/nixpkgs/config.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nix/.config/nixpkgs/config.nix b/nix/.config/nixpkgs/config.nix index 3b506937..dc4e40a2 100644 --- a/nix/.config/nixpkgs/config.nix +++ b/nix/.config/nixpkgs/config.nix @@ -2,7 +2,10 @@ packageOverrides = super: let self = super.pkgs; in with self; rec { - myEmacs = super.callPackage ./emacs.nix {}; + myEmacs = super.callPackage ./emacs.nix { + emacs = if stdenv.isDarwin then emacs25Macport else emacs; + }; + nodejs = pkgs.nodejs-8_x; }; allowUnfree = true; -- cgit 1.4.1 From d6ec7cc74977961c10f459e12324c574f658a3a7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 5 Jul 2017 13:34:30 +0200 Subject: Karabiner: Swap ~ <-> § --- karabiner/.config/karabiner/karabiner.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/karabiner/.config/karabiner/karabiner.json b/karabiner/.config/karabiner/karabiner.json index 2488e95a..8faf2cca 100644 --- a/karabiner/.config/karabiner/karabiner.json +++ b/karabiner/.config/karabiner/karabiner.json @@ -6,6 +6,12 @@ }, "profiles": [ { + "complex_modifications": { + "parameters": { + "basic.to_if_alone_timeout_milliseconds": 1000 + }, + "rules": [] + }, "devices": [ { "disable_built_in_keyboard_if_exists": false, @@ -52,6 +58,7 @@ "left_control": "left_command", "left_option": "right_control", "menu": "fn", + "non_us_backslash": "grave_accent_and_tilde", "right_command": "right_option", "right_control": "right_command", "right_option": "right_control" @@ -62,6 +69,12 @@ } }, { + "complex_modifications": { + "parameters": { + "basic.to_if_alone_timeout_milliseconds": 1000 + }, + "rules": [] + }, "devices": [ { "disable_built_in_keyboard_if_exists": false, -- cgit 1.4.1 From 4d72527ee9f7ba3a5b9ee5b978987e13189a4b8f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 5 Jul 2017 13:35:07 +0200 Subject: Emacs: Remove company-nixos-options It keeps breaking completion, which is annoying. --- emacs/.emacs.d/init.org | 7 ------- 1 file changed, 7 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index db0469f0..0441db4c 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1141,13 +1141,6 @@ seems to work perfectly well for me. :after company) #+END_SRC -#+BEGIN_SRC emacs-lisp -(use-package company-nixos-options - :defer 30 - :config (progn - (add-to-list 'company-backends 'company-nixos-options))) -#+END_SRC - * Dates & Times ** Calendar -- cgit 1.4.1 From 967d4abeb9be21ed2d9f7dcb4025cc8f0dc61a82 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 5 Jul 2017 13:35:41 +0200 Subject: Emacs: Use mac-auto-operator-composition-mode on mac-port --- emacs/.emacs.d/init.org | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 0441db4c..97ddebc9 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -259,10 +259,13 @@ on the right things. #+END_SRC Make symbols prettier. Turns out, in many cases, this is already -configured, just not enabled. +configured, just not enabled. If using the mac-port version of Emacs, +it has it's own, more extensive version. #+BEGIN_SRC emacs-lisp -(global-prettify-symbols-mode +1) +(if (eq window-system 'mac) + (mac-auto-operator-composition-mode +1) + (global-prettify-symbols-mode +1)) #+END_SRC ** Page Breaks -- cgit 1.4.1 From 205ff22d5088491657d81c68942775f9b90d5ee0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 5 Jul 2017 13:36:01 +0200 Subject: Emacs: Diminish some Javascript minor modes --- emacs/.emacs.d/init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 97ddebc9..7833ac50 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2225,6 +2225,7 @@ Instead, do this: #+BEGIN_SRC emacs-lisp (use-package indium + :diminish (indium-interaction-mode . "In") :config (progn (add-hook 'js2-mode-hook #'indium-interaction-mode))) #+END_SRC @@ -2245,7 +2246,7 @@ completions, besides other IDE-like things. #+BEGIN_SRC emacs-lisp (use-package tern - :commands ap/enable-tern + :diminish tern-mode :if (executable-find "tern") :defer 5 :config (progn -- cgit 1.4.1 From 2e755628ac5c22bf5ce799a41c7bc5f9acbd0e44 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 5 Jul 2017 13:36:17 +0200 Subject: Emacs: Load avy on idle --- emacs/.emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 7833ac50..61c7e0d8 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2618,6 +2618,7 @@ somehow I prefer it. #+BEGIN_SRC emacs-lisp (use-package avy + :defer 5 :bind (("M-g g" . avy-goto-line) ("M-g M-g" . avy-goto-line) ("C-|" . avy-goto-line) -- cgit 1.4.1 From 93f2165cb0a1ecaff5ca40784d5c88d18a3657b4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 5 Jul 2017 19:08:52 +0200 Subject: Emacs: Enable emmet-mode in web-mode --- emacs/.emacs.d/init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index a6474799..07c11159 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -2313,6 +2313,7 @@ frameworks that require multiple nested elements to do anything useful. (setq emmet-indentation 2 emmet-self-closing-tag-style " /") (add-hook 'sgml-mode-hook #'emmet-mode) + (add-hook 'web-mode-hook #'emmet-mode) (add-hook 'css-mode-hook #'emmet-mode))) #+END_SRC -- cgit 1.4.1 From 899f3d958cd55c81dc26bf431f272c4a5d7c2f0a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 6 Jul 2017 12:25:23 +0200 Subject: Karabiner: Ignore builtin keyboard It seems to work better when I'm disconnecting and reconnecting the external keyboard --- karabiner/.config/karabiner/karabiner.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/karabiner/.config/karabiner/karabiner.json b/karabiner/.config/karabiner/karabiner.json index 8faf2cca..15ee8f14 100644 --- a/karabiner/.config/karabiner/karabiner.json +++ b/karabiner/.config/karabiner/karabiner.json @@ -21,7 +21,7 @@ "product_id": 602, "vendor_id": 1452 }, - "ignore": false, + "ignore": true, "keyboard_type": 41 }, { -- cgit 1.4.1 From 98746fdaec9f4272619c2ceeadbbcfa7ec387ea4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 6 Jul 2017 13:39:26 +0200 Subject: Nix: Create package for zr --- nix/.config/nixpkgs/config.nix | 2 ++ nix/.config/nixpkgs/zr.nix | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 nix/.config/nixpkgs/zr.nix diff --git a/nix/.config/nixpkgs/config.nix b/nix/.config/nixpkgs/config.nix index dc4e40a2..aa0112ec 100644 --- a/nix/.config/nixpkgs/config.nix +++ b/nix/.config/nixpkgs/config.nix @@ -6,6 +6,8 @@ emacs = if stdenv.isDarwin then emacs25Macport else emacs; }; nodejs = pkgs.nodejs-8_x; + + zr = super.callPackage ./zr.nix {}; }; allowUnfree = true; diff --git a/nix/.config/nixpkgs/zr.nix b/nix/.config/nixpkgs/zr.nix new file mode 100644 index 00000000..1ef3e328 --- /dev/null +++ b/nix/.config/nixpkgs/zr.nix @@ -0,0 +1,42 @@ +{ + fetchFromGitHub, + darwin, + stdenv, + rustPlatform, + cmake, + curl, + libiconv, + openssl, + zlib +}: +with rustPlatform; + +buildRustPackage rec { + name = "zr-${version}"; + version = "0.4.8"; + + src = fetchFromGitHub { + owner = "jedahan"; + repo = "zr"; + rev = "${version}"; + sha256 = "07kb8bk2zri1087dp3pk2zpqjy8rd40nw931z6nnm230ygq481zm"; + }; + + buildInputs = [ cmake curl openssl zlib libiconv ] ++ stdenv.lib.optionals stdenv.isDarwin + (with darwin.apple_sdk.frameworks; [ Security ]); + + cargoDepsHook = stdenv.lib.optionals stdenv.isDarwin '' + export OPENSSL_DIR=${openssl} + export OPENSSL_LIB_DIR=${openssl.out}/lib + export OPENSSL_INCLUDE_DIR=${openssl.dev}/include + ''; + + depsSha256 = "0cjnqilsb9la28b65j1w1n8gdr49b1d9m3z7wsl4q2w3qc42ad52"; + + meta = with stdenv.lib; { + description = "zsh plugin manager written in rust"; + homepage = https://github.com/jedahan/zr; + license = with licenses; [ unfree ]; + platforms = platforms.all; + }; +} -- cgit 1.4.1 From 07bf98c10dd5acbc70f54ba17fa0904995312310 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 8 Jul 2017 19:14:25 +0200 Subject: Emacs: Remove company-nixos-options from installation --- nix/.config/nixpkgs/emacs.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix index afa84a46..1ae25348 100644 --- a/nix/.config/nixpkgs/emacs.nix +++ b/nix/.config/nixpkgs/emacs.nix @@ -69,7 +69,6 @@ in command-log-mode company company-go - company-nixos-options company-restclient company-tern company-web -- cgit 1.4.1 From b8c5076a55617afa69abaee532948666b0c849b8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 8 Jul 2017 19:14:44 +0200 Subject: Nix: Use nixos-unstable for nodejs on Linux My Laptop uses the stable channel for the system by default, but also has the unstable channel available for when I need it. NodeJS 8 isn't available on the stable channel, so manually import nixos-unstable. Other machines shouldn't be affected, as they're using nixpkgs unstable on other OSes. --- nix/.config/nixpkgs/config.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nix/.config/nixpkgs/config.nix b/nix/.config/nixpkgs/config.nix index dc4e40a2..11d704a9 100644 --- a/nix/.config/nixpkgs/config.nix +++ b/nix/.config/nixpkgs/config.nix @@ -1,11 +1,15 @@ { pkgs }: { packageOverrides = super: let self = super.pkgs; + pkgsUnstable = if super.pkgs.stdenv.isLinux + then import {} + else super.pkgs; + in with self; rec { myEmacs = super.callPackage ./emacs.nix { emacs = if stdenv.isDarwin then emacs25Macport else emacs; }; - nodejs = pkgs.nodejs-8_x; + nodejs = pkgsUnstable.nodejs-8_x; }; allowUnfree = true; -- cgit 1.4.1 From d5f8c3b5d49cb5f95f8db903ae9ce718a542fc21 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 10 Jul 2017 14:10:45 +0200 Subject: Emacs: Add nix generation info to title if built via nix --- emacs/.emacs.d/init.org | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 99d5899c..59bf5d4d 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -293,7 +293,25 @@ correct, at least for Liberation Mono. (line-number-mode -1) (size-indication-mode t) -(setq frame-title-format '("%f" (dired-directory dired-directory))) + +(require 'f) +(if (f-ancestor-of? "/nix/store" invocation-directory) + (setq frame-title-format (list "Emacs (Nix Generation " + (cadr + (split-string (f-base + (car + (last (split-string + (s-chomp (shell-command-to-string (concat "nix-store -q --roots " invocation-directory))) + "\n")))) + "-")) + " " + (s-left 6 (nth 3 (f-split invocation-directory))) + "..." + (s-right 6 (car (split-string (nth 3 (f-split invocation-directory)) "-"))) + ")" + " — %f" + '(dired-directory dired-directory))) + (setq frame-title-format '("Emacs — %f" (dired-directory dired-directory)))) #+END_SRC ** Chrome -- cgit 1.4.1 From 5d20eb1a6996f0ec2cf025669bf9b9c2e58de14c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 10 Jul 2017 14:11:13 +0200 Subject: Emacs: Install suggest --- nix/.config/nixpkgs/emacs.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix index 1ae25348..6e53368b 100644 --- a/nix/.config/nixpkgs/emacs.nix +++ b/nix/.config/nixpkgs/emacs.nix @@ -141,6 +141,7 @@ in smart-tabs-mode smartparens smex + suggest swiper tern toml-mode -- cgit 1.4.1 From 9bc57e8f0124b1a0e553aff2384beb70f35113c1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 10 Jul 2017 14:22:39 +0200 Subject: Emacs: Remove extra space in title --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 59bf5d4d..4839beb6 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -309,7 +309,7 @@ correct, at least for Liberation Mono. "..." (s-right 6 (car (split-string (nth 3 (f-split invocation-directory)) "-"))) ")" - " — %f" + " — %f" '(dired-directory dired-directory))) (setq frame-title-format '("Emacs — %f" (dired-directory dired-directory)))) #+END_SRC -- cgit 1.4.1 From 1063325b18ed6d7eaa277f720dedde4690461984 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 11 Jul 2017 17:10:07 +0200 Subject: Emacs: Simplify nix title generation --- emacs/.emacs.d/init.org | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 4839beb6..304abc46 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -295,23 +295,23 @@ correct, at least for Liberation Mono. (require 'f) -(if (f-ancestor-of? "/nix/store" invocation-directory) - (setq frame-title-format (list "Emacs (Nix Generation " - (cadr - (split-string (f-base - (car - (last (split-string - (s-chomp (shell-command-to-string (concat "nix-store -q --roots " invocation-directory))) - "\n")))) - "-")) - " " - (s-left 6 (nth 3 (f-split invocation-directory))) - "..." - (s-right 6 (car (split-string (nth 3 (f-split invocation-directory)) "-"))) - ")" - " — %f" - '(dired-directory dired-directory))) - (setq frame-title-format '("Emacs — %f" (dired-directory dired-directory)))) +(setq frame-title-format (list "Emacs" + (if (f-ancestor-of? "/nix/store" invocation-directory) + (list " (Nix Generation " + (cadr + (split-string (f-base + (car + (last (split-string + (s-chomp (shell-command-to-string (concat "nix-store -q --roots " invocation-directory))) + "\n")))) + "-")) + " " + (s-left 6 (nth 3 (f-split invocation-directory))) + "..." + (s-right 6 (car (split-string (nth 3 (f-split invocation-directory)) "-"))) + ")")) + '(buffer-file-name " — %f") + '(dired-directory (" — " dired-directory)))) #+END_SRC ** Chrome -- cgit 1.4.1 From 267aab78cbb12589a80afae7ec7cb851e1750895 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 11 Jul 2017 17:10:20 +0200 Subject: Emacs: Don't ignore hidden files with ripgrep --- emacs/.emacs.d/init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 304abc46..98fb06ff 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1589,7 +1589,8 @@ replacement for helm so far. (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)))))) + (find-alternate-file (concat "/sudo::" buffer-file-name)))) + (setq counsel-rg-base-command "rg -i --no-heading --line-number --hidden %s ."))) #+END_SRC -- cgit 1.4.1 From 9aac52ad89c7fa8e6cb0ad00a7bb2c81291099d2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 11 Jul 2017 17:10:38 +0200 Subject: Emacs: Use ripgrep for projectile-commander "A" binding --- emacs/.emacs.d/init.org | 3 +++ 1 file changed, 3 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 98fb06ff..8d7ef0e1 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -638,6 +638,9 @@ ones. :after (counsel projectile) :config (progn (counsel-projectile-on) + (def-projectile-commander-method ?A + "Find rg on project." + (call-interactively #'counsel-projectile-rg)) (define-key projectile-mode-map [remap counsel-projectile-ag] #'counsel-projectile-rg))) #+END_SRC -- cgit 1.4.1 From 4478189a54426c3956f7b2a5243c2bc9828edaf9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 15 Jul 2017 15:07:59 +0200 Subject: Emacs: Use common var to detect nixified emacs --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 8d7ef0e1..ebdeba3f 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -296,7 +296,7 @@ correct, at least for Liberation Mono. (require 'f) (setq frame-title-format (list "Emacs" - (if (f-ancestor-of? "/nix/store" invocation-directory) + (if nix-emacs (list " (Nix Generation " (cadr (split-string (f-base -- cgit 1.4.1 From 1f1c107cd2469048a6f407fbe442a32f4f98e2bf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 15 Jul 2017 15:08:25 +0200 Subject: Emacs: Show numerical nix generation even for system profiles --- emacs/.emacs.d/init.org | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index ebdeba3f..7af73220 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -301,9 +301,11 @@ correct, at least for Liberation Mono. (cadr (split-string (f-base (car - (last (split-string - (s-chomp (shell-command-to-string (concat "nix-store -q --roots " invocation-directory))) - "\n")))) + (last (seq-take-while + (lambda (s) (s-contains? "profile" s)) + (split-string + (s-chomp (shell-command-to-string (concat "nix-store -q --roots " invocation-directory))) + "\n"))))) "-")) " " (s-left 6 (nth 3 (f-split invocation-directory))) @@ -311,7 +313,7 @@ correct, at least for Liberation Mono. (s-right 6 (car (split-string (nth 3 (f-split invocation-directory)) "-"))) ")")) '(buffer-file-name " — %f") - '(dired-directory (" — " dired-directory)))) + '(dired-directory (" — " dired-directory)))) #+END_SRC ** Chrome -- cgit 1.4.1 From 2ab7a9bfa48fce515ebda9febf13142731e1e600 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 15 Jul 2017 15:08:47 +0200 Subject: fix location of xmodmaprc --- xmodmap/.xmodmaprc | 20 ++++++++++++++++++++ xmodmap/xmodmaprc | 20 -------------------- 2 files changed, 20 insertions(+), 20 deletions(-) create mode 100644 xmodmap/.xmodmaprc delete mode 100644 xmodmap/xmodmaprc diff --git a/xmodmap/.xmodmaprc b/xmodmap/.xmodmaprc new file mode 100644 index 00000000..82a8674f --- /dev/null +++ b/xmodmap/.xmodmaprc @@ -0,0 +1,20 @@ +keycode 37 = Super_L NoSymbol Super_L +keycode 133 = Alt_L Meta_L Alt_L Meta_L +keycode 64 = Control_L NoSymbol Control_L + +! Thinkpad has PrtSc next to Alt_R +keycode 108 = Control_R NoSymbol Control_R +keycode 107 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift +keycode 105 = Super_R NoSymbol Super_R +! For external keyboards +keycode 134 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift + +clear Control +clear Mod1 +clear Mod3 +clear Mod4 + +add Control = Control_L Control_R +add Mod1 = Alt_L Meta_L +add Mod4 = Super_L Super_R Super_L Hyper_L +add Mod5 = ISO_Level3_Shift Mode_switch \ No newline at end of file diff --git a/xmodmap/xmodmaprc b/xmodmap/xmodmaprc deleted file mode 100644 index 82a8674f..00000000 --- a/xmodmap/xmodmaprc +++ /dev/null @@ -1,20 +0,0 @@ -keycode 37 = Super_L NoSymbol Super_L -keycode 133 = Alt_L Meta_L Alt_L Meta_L -keycode 64 = Control_L NoSymbol Control_L - -! Thinkpad has PrtSc next to Alt_R -keycode 108 = Control_R NoSymbol Control_R -keycode 107 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift -keycode 105 = Super_R NoSymbol Super_R -! For external keyboards -keycode 134 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift - -clear Control -clear Mod1 -clear Mod3 -clear Mod4 - -add Control = Control_L Control_R -add Mod1 = Alt_L Meta_L -add Mod4 = Super_L Super_R Super_L Hyper_L -add Mod5 = ISO_Level3_Shift Mode_switch \ No newline at end of file -- cgit 1.4.1 From c0c0b1dd9d2524b4f868db5ee65cd9b6e4470d1c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 15 Jul 2017 15:55:27 +0200 Subject: Emacs: Enable crux-reopen-as-root-mode --- emacs/.emacs.d/init.org | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 7af73220..bc6cb69e 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -538,6 +538,8 @@ configuration with crux.el ("C-c e" . crux-eval-and-replace) ("C-c D" . crux-delete-file-and-buffer) ("C-c R" . crux-rename-file-and-buffer)) + :config (progn + (crux-reopen-as-root-mode +1)) :init (progn (defalias 'delete-current-buffer-file #'crux-delete-file-and-buffer) (defalias 'rename-current-buffer-file #'crux-rename-file-and-buffer))) -- cgit 1.4.1 From 7b67188b59125f580579d7d62a27448337c760d7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 16 Jul 2017 12:50:58 +0200 Subject: zsh: Fix keybinds in st --- zsh/.config/zsh/.zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index c83aa234..818cdf5f 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -61,6 +61,7 @@ alias llr="ll -t" zmodload zsh/terminfo +bindkey -e bindkey '\e[3~' delete-char bindkey '\C-hd' describe-key-briefly -- cgit 1.4.1 From ceeb734d82fda4bd7430f9c263a33ebd89162d39 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 16 Jul 2017 12:51:17 +0200 Subject: Emacs: Install base16 theme package --- emacs/.emacs.d/init.org | 11 +++++++++++ nix/.config/nixpkgs/emacs.nix | 1 + 2 files changed, 12 insertions(+) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index bc6cb69e..8a383fc2 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -195,6 +195,17 @@ White-theme. Sounds like a good idea. '(font-lock-string-face ((t (:slant normal))))))) #+END_SRC +Base16 theming allows me have a consistent style between applications +quite easily. + +#+BEGIN_SRC emacs-lisp +(use-package base16-theme + :if (or window-system + (daemon-p)) + :config (progn + (load-theme 'base16-mexico-light t))) +#+END_SRC + Highlighting quasi-quoted expressions in lisps is quite useful, but I don't need it all the time. I'll keep it around for a while so that I can enable it if needed. diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix index 6e53368b..02b74964 100644 --- a/nix/.config/nixpkgs/emacs.nix +++ b/nix/.config/nixpkgs/emacs.nix @@ -59,6 +59,7 @@ in async auto-compile avy + base16-theme bbdb beginend cider -- cgit 1.4.1 From 7e506b89b0332b5590644bac4e60a176f36e5fab Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 16 Jul 2017 12:51:37 +0200 Subject: Xresources: Use base16-mexico-light theme --- xresources/.xresources/base16-mexico-light-256 | 54 ++++++++++++++++++++++++++ xresources/.xresources/main | 2 +- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 xresources/.xresources/base16-mexico-light-256 diff --git a/xresources/.xresources/base16-mexico-light-256 b/xresources/.xresources/base16-mexico-light-256 new file mode 100644 index 00000000..34194f8e --- /dev/null +++ b/xresources/.xresources/base16-mexico-light-256 @@ -0,0 +1,54 @@ +! Base16 Mexico Light +! Scheme: Sheldon Johnson + +#define base00 #f8f8f8 +#define base01 #e8e8e8 +#define base02 #d8d8d8 +#define base03 #b8b8b8 +#define base04 #585858 +#define base05 #383838 +#define base06 #282828 +#define base07 #181818 +#define base08 #ab4642 +#define base09 #dc9656 +#define base0A #f79a0e +#define base0B #538947 +#define base0C #4b8093 +#define base0D #7cafc2 +#define base0E #96609e +#define base0F #a16946 + +*.foreground: base05 +#ifdef background_opacity +*.background: [background_opacity]base00 +#else +*.background: base00 +#endif +*.cursorColor: base05 + +*.color0: base00 +*.color1: base08 +*.color2: base0B +*.color3: base0A +*.color4: base0D +*.color5: base0E +*.color6: base0C +*.color7: base05 + +*.color8: base03 +*.color9: base08 +*.color10: base0B +*.color11: base0A +*.color12: base0D +*.color13: base0E +*.color14: base0C +*.color15: base07 + +! Note: colors beyond 15 might not be loaded (e.g., xterm, urxvt), +! use 'shell' template to set these if necessary +*.color16: base09 +*.color17: base0F +*.color18: base01 +*.color19: base02 +*.color20: base04 +*.color21: base06 diff --git a/xresources/.xresources/main b/xresources/.xresources/main index 73f8096d..c13ba19f 100644 --- a/xresources/.xresources/main +++ b/xresources/.xresources/main @@ -1,4 +1,4 @@ -#include "solarized-light" +#include "base16-mexico-light-256" Xcursor.theme: Neutral Xcursor.size: 22 -- cgit 1.4.1 From 7c98a8f79a3f24a0ab23c6d8f1283c5488557ec3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 16 Jul 2017 12:51:49 +0200 Subject: Emacs: Update fonts in XResources --- xresources/.xresources/main | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xresources/.xresources/main b/xresources/.xresources/main index c13ba19f..7c84fb86 100644 --- a/xresources/.xresources/main +++ b/xresources/.xresources/main @@ -8,6 +8,6 @@ Emacs.MenuBar: off Emacs.ScrollBars: off Emacs.CursorBlink: off -Emacs.Font: -*-Input Mono Narrow-normal-*-*-*-16-*-*-*-*-*-*-* -Emacs.fixed-pitch.attributeFont: -*-Input Mono Narrow-normal-*-*-*-16-*-*-*-*-*-*-* -Emacs.variable-pitch.attributeFont: -*-Input Sans-medium-r-*-*-16-*-*-*-*-*-*-* +Emacs.Font: -Misc-Fixed-normal-normal-normal-*-14-*-*-*-c-70-iso10646-1 +Emacs.fixed-pitch.attributeFont: -Misc-Fixed-normal-normal-normal-*-14-*-*-*-c-70-iso10646-1 +Emacs.variable-pitch.attributeFont: -*-PT Sans-medium-r-*-*-14-*-*-*-*-*-*-* -- cgit 1.4.1 From e5d6dc30263fcf833713b6f227fd6d131b902ec1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 16 Jul 2017 14:15:56 +0200 Subject: Add shell script to adopt dotfiles into repo --- adopt | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 adopt diff --git a/adopt b/adopt new file mode 100755 index 00000000..94509c3d --- /dev/null +++ b/adopt @@ -0,0 +1,28 @@ +#!/bin/sh +DOTFILES_DIR=$(dirname $(readlink -f $0)) + +if [ "$#" -lt 2 ] +then + echo "usage: $(basename $0) tag file-to-adopt" + exit 1 +fi + +if [ -d $2 ] +then + TARGET="$DOTFILES_DIR/$1/$2" + if ! [ -d $TARGET ] + then + mkdir -p $TARGET + fi + mv $2/* $TARGET + ln -s $TARGET/* "$2" +elif [ -f $2 ] +then + TARGET="$DOTFILES_DIR/$1/$(dirname $2)" + if ! [ -d $TARGET ] + then + mkdir -p $TARGET + fi + mv $2 $TARGET + ln -s $TARGET/$(basename $2) +fi -- cgit 1.4.1 From c23813f5776c30b55e76181ac20b39d81b2caf91 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 16 Jul 2017 14:16:31 +0200 Subject: sxhkd: Adopt configuration --- sxhkd/.config/sxhkd/sxhkdrc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 sxhkd/.config/sxhkd/sxhkdrc diff --git a/sxhkd/.config/sxhkd/sxhkdrc b/sxhkd/.config/sxhkd/sxhkdrc new file mode 100644 index 00000000..a8a96eb1 --- /dev/null +++ b/sxhkd/.config/sxhkd/sxhkdrc @@ -0,0 +1,18 @@ +XF86AudioMute + pamixer --toggle-mute + +XF86Audio{Lower,Raise}Volume + pamixer --{decrease,increase} 1 + +@XF86AudioMicMute + pamixer --source 2 --toggle-mute + +XF86MonBrightness{Down,Up} + light -{U,A} 0.5% + +# XF86Display +# XF86WLAN +# XF86Tools +# XF86Search +# XF86LaunchA +# XF86Explorer \ No newline at end of file -- cgit 1.4.1 From 2f181736df8d01968a7d4e4a46ad1e868e76968b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 16 Jul 2017 14:16:45 +0200 Subject: xprofile: re-create according to current config --- xprofile/.xprofile | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/xprofile/.xprofile b/xprofile/.xprofile index f0a05239..d397c3c2 100755 --- a/xprofile/.xprofile +++ b/xprofile/.xprofile @@ -1,9 +1,5 @@ #!/bin/sh -envoy -t gpg-agent -eval $(envoy -p) -xrdb -I$HOME/.xresources .Xresources -xsetroot -cursor_name left_ptr -redshift-gtk & -dropboxd & -trayer --edge bottom --align right --SetDockType true --SetPartialStrut true --expand true --width 10 --transparent true --alpha 0 --tint 0xfdf6e3 --height 12 & -emacsclient --alternate-editor="" --eval '"Starting Emacs"' & +sh -c 'sleep 1 && xsetroot -cursor_name left_ptr' & +xmodmap .xmodmaprc +xrdb -I$HOME/.xresources .xresources/main +sxhkd & -- cgit 1.4.1 From 74bcb7ff0177eaa48fdb246eff4171ed2e8520fc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 17 Jul 2017 16:48:43 +0200 Subject: Emacs: Don't load base16-mexico-theme Keep base16-theme around so that I can experiment with it, though --- emacs/.emacs.d/init.org | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 8a383fc2..3d5a0036 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -201,9 +201,7 @@ quite easily. #+BEGIN_SRC emacs-lisp (use-package base16-theme :if (or window-system - (daemon-p)) - :config (progn - (load-theme 'base16-mexico-light t))) + (daemon-p))) #+END_SRC Highlighting quasi-quoted expressions in lisps is quite useful, but I -- cgit 1.4.1 From b3389fa7dcfeb4fbb79c424a7b434cafe96663e0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 17 Jul 2017 16:49:08 +0200 Subject: Emacs: Use Fira Code on macOS (Macbook display) --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 3d5a0036..344914dd 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -247,7 +247,7 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (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 "Monaco" 16 "Lucida Grande" 16 t 0.2) + (ap/set-fonts "Fira Code" 14 "Lucida Grande" 14 t nil) (ap/set-fonts "Monoid" 12 "Helvetica Neue" 12 t 0.1)))) ((and (eq window-system 'x) (not (eq system-type 'gnu/linux/windows))) -- cgit 1.4.1 From 4755e97a606b237ab98b7f066ddc32b31c990b3d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 17 Jul 2017 21:09:42 +0200 Subject: sxhkd: Configure WLAN with Fn+F9 (settings key) --- sxhkd/.config/sxhkd/sxhkdrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sxhkd/.config/sxhkd/sxhkdrc b/sxhkd/.config/sxhkd/sxhkdrc index a8a96eb1..c1c3eed8 100644 --- a/sxhkd/.config/sxhkd/sxhkdrc +++ b/sxhkd/.config/sxhkd/sxhkdrc @@ -12,7 +12,10 @@ XF86MonBrightness{Down,Up} # XF86Display # XF86WLAN -# XF86Tools + +XF86Tools + connman_dmenu + # XF86Search # XF86LaunchA # XF86Explorer \ No newline at end of file -- cgit 1.4.1 From c64b531ae29243fffdb45beb5525be1206a19d9f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 17 Jul 2017 21:12:56 +0200 Subject: dunst: Add initial configuration --- dunst/.config/dunst/dunstrc | 245 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 245 insertions(+) create mode 100644 dunst/.config/dunst/dunstrc diff --git a/dunst/.config/dunst/dunstrc b/dunst/.config/dunst/dunstrc new file mode 100644 index 00000000..69b9a9da --- /dev/null +++ b/dunst/.config/dunst/dunstrc @@ -0,0 +1,245 @@ +[global] + font = Monospace 13 + + # Allow a small subset of html markup: + # bold + # italic + # strikethrough + # underline + # + # For a complete reference see + # . + # If markup is not allowed, those tags will be stripped out of the + # message. + allow_markup = yes + + # The format of the message. Possible variables are: + # %a appname + # %s summary + # %b body + # %i iconname (including its path) + # %I iconname (without its path) + # %p progress value if set ([ 0%] to [100%]) or nothing + # Markup is allowed + format = "%s\n%b" + + # Sort messages by urgency. + sort = yes + + # Show how many messages are currently hidden (because of geometry). + indicate_hidden = yes + + # Alignment of message text. + # Possible values are "left", "center" and "right". + alignment = left + + # The frequency with wich text that is longer than the notification + # window allows bounces back and forth. + # This option conflicts with "word_wrap". + # Set to 0 to disable. + bounce_freq = 0 + + # Show age of message if message is older than show_age_threshold + # seconds. + # Set to -1 to disable. + show_age_threshold = 60 + + # Split notifications into multiple lines if they don't fit into + # geometry. + word_wrap = yes + + # Ignore newlines '\n' in notifications. + ignore_newline = no + + + # The geometry of the window: + # [{width}]x{height}[+/-{x}+/-{y}] + # The geometry of the message window. + # The height is measured in number of notifications everything else + # in pixels. If the width is omitted but the height is given + # ("-geometry x2"), the message window expands over the whole screen + # (dmenu-like). If width is 0, the window expands to the longest + # message displayed. A positive x is measured from the left, a + # negative from the right side of the screen. Y is measured from + # the top and down respectevly. + # The width can be negative. In this case the actual width is the + # screen width minus the width defined in within the geometry option. + geometry = "300x10-10+30" + + # Shrink window if it's smaller than the width. Will be ignored if + # width is 0. + shrink = no + + # The transparency of the window. Range: [0; 100]. + # This option will only work if a compositing windowmanager is + # present (e.g. xcompmgr, compiz, etc.). + transparency = 0 + + # Don't remove messages, if the user is idle (no mouse or keyboard input) + # for longer than idle_threshold seconds. + # Set to 0 to disable. + idle_threshold = 120 + + # Which monitor should the notifications be displayed on. + monitor = 0 + + # Display notification on focused monitor. Possible modes are: + # mouse: follow mouse pointer + # keyboard: follow window with keyboard focus + # none: don't follow anything + # + # "keyboard" needs a windowmanager that exports the + # _NET_ACTIVE_WINDOW property. + # This should be the case for almost all modern windowmanagers. + # + # If this option is set to mouse or keyboard, the monitor option + # will be ignored. + follow = mouse + + # Should a notification popped up from history be sticky or timeout + # as if it would normally do. + sticky_history = yes + + # Maximum amount of notifications kept in history + history_length = 20 + + # Display indicators for URLs (U) and actions (A). + show_indicators = yes + + # The height of a single line. If the height is smaller than the + # font height, it will get raised to the font height. + # This adds empty space above and under the text. + line_height = 0 + + # Draw a line of "separatpr_height" pixel height between two + # notifications. + # Set to 0 to disable. + separator_height = 2 + + # Padding between text and separator. + padding = 8 + + # Horizontal padding. + horizontal_padding = 8 + + # Define a color for the separator. + # possible values are: + # * auto: dunst tries to find a color fitting to the background; + # * foreground: use the same color as the foreground; + # * frame: use the same color as the frame; + # * anything else will be interpreted as a X color. + separator_color = frame + + # Print a notification on startup. + # This is mainly for error detection, since dbus (re-)starts dunst + # automatically after a crash. + startup_notification = false + + # dmenu path. + dmenu = /usr/bin/env dmenu -p dunst: + + # Browser for opening urls in context menu. + browser = /usr/bin/env firefox -new-tab + + # Align icons left/right/off + icon_position = off + + # Paths to default icons. + icon_folders = /usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/ + +[frame] + width = 1 + color = "#383838" + +[shortcuts] + + # Shortcuts are specified as [modifier+][modifier+]...key + # Available modifiers are "ctrl", "mod1" (the alt-key), "mod2", + # "mod3" and "mod4" (windows-key). + # Xev might be helpful to find names for keys. + + # Close notification. + close = ctrl+space + + # Close all notifications. + close_all = ctrl+shift+space + + # Redisplay last message(s). + # On the US keyboard layout "grave" is normally above TAB and left + # of "1". + history = ctrl+grave + + # Context menu. + context = ctrl+shift+period + +[urgency_low] + # IMPORTANT: colors have to be defined in quotation marks. + # Otherwise the "#" and following would be interpreted as a comment. + background = "#b8b8b8" + foreground = "#f8f8f8" + timeout = 10 + +[urgency_normal] + background = "#7cafc2" + foreground = "#f8f8f8" + timeout = 10 + +[urgency_critical] + background = "#ab4642" + foreground = "#f8f8f8" + timeout = 0 + + +# Every section that isn't one of the above is interpreted as a rules to +# override settings for certain messages. +# Messages can be matched by "appname", "summary", "body", "icon", "category", +# "msg_urgency" and you can override the "timeout", "urgency", "foreground", +# "background", "new_icon" and "format". +# Shell-like globbing will get expanded. +# +# SCRIPTING +# You can specify a script that gets run when the rule matches by +# setting the "script" option. +# The script will be called as follows: +# script appname summary body icon urgency +# where urgency can be "LOW", "NORMAL" or "CRITICAL". +# +# NOTE: if you don't want a notification to be displayed, set the format +# to "". +# NOTE: It might be helpful to run dunst -print in a terminal in order +# to find fitting options for rules. + +#[espeak] +# summary = "*" +# script = dunst_espeak.sh + +#[script-test] +# summary = "*script*" +# script = dunst_test.sh + +#[ignore] +# # This notification will not be displayed +# summary = "foobar" +# format = "" + +#[signed_on] +# appname = Pidgin +# summary = "*signed on*" +# urgency = low +# +#[signed_off] +# appname = Pidgin +# summary = *signed off* +# urgency = low +# +#[says] +# appname = Pidgin +# summary = *says* +# urgency = critical +# +#[twitter] +# appname = Pidgin +# summary = *twitter.com* +# urgency = normal +# +# vim: ft=cfg -- cgit 1.4.1 From d4637e2b2616ef9975f144f4fb77d2a8758ef075 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 17 Jul 2017 21:15:04 +0200 Subject: adopt: Use stow to create backlinks --- adopt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adopt b/adopt index 94509c3d..a0a210fa 100755 --- a/adopt +++ b/adopt @@ -15,7 +15,7 @@ then mkdir -p $TARGET fi mv $2/* $TARGET - ln -s $TARGET/* "$2" + ./stow $1 elif [ -f $2 ] then TARGET="$DOTFILES_DIR/$1/$(dirname $2)" @@ -24,5 +24,5 @@ then mkdir -p $TARGET fi mv $2 $TARGET - ln -s $TARGET/$(basename $2) + ./stow $1 fi -- cgit 1.4.1 From b8965b3644797a3ff8d8382c89a25130f10855f8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 17 Jul 2017 21:15:21 +0200 Subject: i3: Add initial configuration --- i3/.config/i3/config | 218 +++++++++++++++++++++++++++++++++++++++++++++ i3/.config/i3status/config | 107 ++++++++++++++++++++++ 2 files changed, 325 insertions(+) create mode 100644 i3/.config/i3/config create mode 100644 i3/.config/i3status/config diff --git a/i3/.config/i3/config b/i3/.config/i3/config new file mode 100644 index 00000000..39a48f3e --- /dev/null +++ b/i3/.config/i3/config @@ -0,0 +1,218 @@ +# This file has been auto-generated by i3-config-wizard(1). +# It will not be overwritten, so edit it as you like. +# +# Should you change your keyboard layout some time, delete +# this file and re-run i3-config-wizard(1). +# + +# i3 config file (v4) +# +# Please see http://i3wm.org/docs/userguide.html for a complete reference! + +set $mod Mod4 + +# Base16 colours: https://github.com/khamer/base16-i3 + +# set $base00 #f8f8f8 +# set $base01 #e8e8e8 +# set $base02 #d8d8d8 +# set $base03 #b8b8b8 +# set $base04 #585858 +# set $base05 #383838 +# set $base06 #282828 +# set $base07 #181818 +# set $base08 #ab4642 +# set $base09 #dc9656 +# set $base0A #f79a0e +# set $base0B #538947 +# set $base0C #4b8093 +# set $base0D #7cafc2 +# set $base0E #96609e +# set $base0F #a16946 + +set_from_resource $base00 i3wm.color00 #f8f8f8 +set_from_resource $base01 i3wm.color01 #e8e8e8 +set_from_resource $base02 i3wm.color02 #d8d8d8 +set_from_resource $base03 i3wm.color03 #b8b8b8 +set_from_resource $base04 i3wm.color04 #585858 +set_from_resource $base05 i3wm.color05 #383838 +set_from_resource $base06 i3wm.color06 #282828 +set_from_resource $base07 i3wm.color07 #181818 +set_from_resource $base08 i3wm.color08 #ab4642 +set_from_resource $base09 i3wm.color09 #dc9656 +set_from_resource $base0A i3wm.color0A #f79a0e +set_from_resource $base0B i3wm.color0B #538947 +set_from_resource $base0C i3wm.color0C #4b8093 +set_from_resource $base0D i3wm.color0D #7cafc2 +set_from_resource $base0E i3wm.color0E #96609e +set_from_resource $base0F i3wm.color0F #a16946 + + +# Font for window titles. Will also be used by the bar unless a different font +# is used in the bar {} block below. +# font pango:monospace 8 + +# This font is widely installed, provides lots of unicode glyphs, right-to-left +# text rendering and scalability on retina/hidpi displays (thanks to pango). +#font pango:DejaVu Sans Mono 8 + +# Before i3 v4.8, we used to recommend this one as the default: +font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 +# The font above is very space-efficient, that is, it looks good, sharp and +# clear in small sizes. However, its unicode glyph coverage is limited, the old +# X core fonts rendering does not support right-to-left and this being a bitmap +# font, it doesn’t scale on retina/hidpi displays. + +# Use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod + +# start a terminal +bindsym $mod+Return exec st + +# kill focused window +bindsym $mod+Shift+w kill + +# start dmenu (a program launcher) +bindsym $mod+p exec dmenu_run +# There also is the (new) i3-dmenu-desktop which only displays applications +# shipping a .desktop file. It is a wrapper around dmenu, so you need that +# installed. +bindsym $mod+space exec --no-startup-id i3-dmenu-desktop + +# change focus +bindsym $mod+n focus left +bindsym $mod+e focus down +bindsym $mod+i focus up +bindsym $mod+o focus right + +# alternatively, you can use the cursor keys: +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# move focused window +bindsym $mod+Shift+n move left +bindsym $mod+Shift+e move down +bindsym $mod+Shift+i move up +bindsym $mod+Shift+o move right + +# alternatively, you can use the cursor keys: +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# split in horizontal orientation +bindsym $mod+h split h + +# split in vertical orientation +bindsym $mod+v split v + +# enter fullscreen mode for the focused container +bindsym $mod+F11 fullscreen toggle + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+t layout tabbed +bindsym $mod+d layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+f floating toggle + +# change focus between tiling / floating windows +bindsym $mod+f focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# focus the child container +#bindsym $mod+d focus child + +# switch to workspace +bindsym $mod+1 workspace 1 +bindsym $mod+2 workspace 2 +bindsym $mod+3 workspace 3 +bindsym $mod+4 workspace 4 +bindsym $mod+5 workspace 5 +bindsym $mod+6 workspace 6 +bindsym $mod+7 workspace 7 +bindsym $mod+8 workspace 8 +bindsym $mod+9 workspace 9 +bindsym $mod+0 workspace 10 + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace 1 +bindsym $mod+Shift+2 move container to workspace 2 +bindsym $mod+Shift+3 move container to workspace 3 +bindsym $mod+Shift+4 move container to workspace 4 +bindsym $mod+Shift+5 move container to workspace 5 +bindsym $mod+Shift+6 move container to workspace 6 +bindsym $mod+Shift+7 move container to workspace 7 +bindsym $mod+Shift+8 move container to workspace 8 +bindsym $mod+Shift+9 move container to workspace 9 +bindsym $mod+Shift+0 move container to workspace 10 + +# reload the configuration file +bindsym $mod+Shift+c reload +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+p restart +# exit i3 (logs you out of your X session) +bindsym $mod+Shift+q exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" + +# resize window (you can also use the mouse for that) +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + + # Pressing left will shrink the window’s width. + # Pressing right will grow the window’s width. + # Pressing up will shrink the window’s height. + # Pressing down will grow the window’s height. + bindsym n resize shrink width 10 px or 10 ppt + bindsym e resize grow height 10 px or 10 ppt + bindsym i resize shrink height 10 px or 10 ppt + bindsym o resize grow width 10 px or 10 ppt + + # same bindings, but for the arrow keys + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + + # back to normal: Enter or Escape + bindsym Return mode "default" + bindsym Escape mode "default" +} + +bindsym $mod+r mode "resize" + +# Start i3bar to display a workspace bar (plus the system information i3status +# finds out, if available) +bar { + position top + status_command /nix/store/3pwsp50dpzhs4myp1jm21w9gqw5wi8la-i3status-2.11/bin/i3status -c ~/.config/i3status/config + colors { + background $base00 + separator $base03 + statusline $base04 + + # State Border BG Text + focused_workspace $base05 $base0D $base00 + active_workspace $base05 $base03 $base00 + inactive_workspace $base03 $base01 $base05 + urgent_workspace $base08 $base08 $base00 + binding_mode $base00 $base0A $base00 + } +} + +# Basic color configuration using the Base16 variables for windows and borders. +# Property Name Border BG Text Indicator Child Border +client.focused $base05 $base0D $base00 $base0D $base0D +client.focused_inactive $base01 $base01 $base05 $base03 $base01 +client.unfocused $base01 $base00 $base05 $base01 $base01 +client.urgent $base08 $base08 $base00 $base08 $base08 +client.placeholder $base00 $base00 $base05 $base00 $base00 +client.background $base07 + +hide_edge_borders both +workspace_auto_back_and_forth yes diff --git a/i3/.config/i3status/config b/i3/.config/i3status/config new file mode 100644 index 00000000..be0a2561 --- /dev/null +++ b/i3/.config/i3status/config @@ -0,0 +1,107 @@ +# i3status configuration file. +# see "man i3status" for documentation. + +# It is important that this file is edited as UTF-8. +# The following line should contain a sharp s: +# ß +# If the above line is not correctly displayed, fix your editor first! + +general { + colors = true + interval = 10 + + color_good = "#538947" + color_degraded = "#f79a0e" + color_bad = "#ab4642" +} + +order += "disk /" +order += "disk /home" +order += "wireless _first_" +order += "ethernet _first_" +order += "ipv6" +order += "battery all" +order += "battery 0" +order += "battery 1" +order += "load" +order += "cpu_temperature 0" +order += "volume master" +order += "tztime local" + +ipv6 { + format_up = "6" + format_down = "4" +} + +wireless _first_ { + format_up = "W: %quality (%essid)" + format_down = "W" +} + +ethernet _first_ { + # if you use %speed, i3status requires root privileges + format_up = "E: (%speed)" + format_down = "E" +} + +battery 0 { + integer_battery_capacity = true + + status_chr = "C" + status_bat = "D" + status_unk = "U" + status_full = "F" + + separator = false + + format = "%status %percentage" +} + +battery 1 { + integer_battery_capacity = true + + status_chr = "C" + status_bat = "D" + status_unk = "U" + status_full = "F" + + format = "%status %percentage" +} + +battery all { + integer_battery_capacity = false + hide_seconds = true + + separator = false + + format = "%status %remaining (%emptytime %consumption)" +} + +volume master { + device = "pulse" + format = "♪: %volume" + format_muted = "♪: 0%%" +} + +tztime local { + format = "%Y-%m-%d %H:%M" +} + +load { + format = "%1min" +} + +cpu_temperature 0 { + format = "T: %degrees ºC" +} + +disk "/" { + prefix_type = "custom" + format = "/ %avail" + separator = false +} + +disk "/home" { + prefix_type = "custom" + format = "/h %avail" +} -- cgit 1.4.1 From 0c16d408cb07bb375c219ebf2c488730b2531b6e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 18 Jul 2017 21:28:04 +0200 Subject: Emacs: Move eyebrowse bindings from under WM keybinds --- emacs/.emacs.d/init.org | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 344914dd..df092aa4 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1060,22 +1060,38 @@ point whilst I’m moving about. ** eyebrowse -Workspaces, a bit like dwm. +Workspaces, a bit like dwm. On Windows and Linux (at least the WMs +I'm likely to use), super+{0-9} are taken from the OS, so use meta +instead. On macOS, super makes a lot of sense, as it's used by most +programs to switch between program windows or views. #+BEGIN_SRC emacs-lisp (use-package eyebrowse - :bind (("s-0" . eyebrowse-switch-to-window-config-0) - ("s-1" . eyebrowse-switch-to-window-config-1) - ("s-2" . eyebrowse-switch-to-window-config-2) - ("s-3" . eyebrowse-switch-to-window-config-3) - ("s-4" . eyebrowse-switch-to-window-config-4) - ("s-5" . eyebrowse-switch-to-window-config-5) - ("s-6" . eyebrowse-switch-to-window-config-6) - ("s-7" . eyebrowse-switch-to-window-config-7) - ("s-8" . eyebrowse-switch-to-window-config-8) - ("s-9" . eyebrowse-switch-to-window-config-9)) :config (progn (setq eyebrowse-new-workspace t) + (when (eq system-type 'darwin) + (bind-keys + ("s-0" . eyebrowse-switch-to-window-config-0) + ("s-1" . eyebrowse-switch-to-window-config-1) + ("s-2" . eyebrowse-switch-to-window-config-2) + ("s-3" . eyebrowse-switch-to-window-config-3) + ("s-4" . eyebrowse-switch-to-window-config-4) + ("s-5" . eyebrowse-switch-to-window-config-5) + ("s-6" . eyebrowse-switch-to-window-config-6) + ("s-7" . eyebrowse-switch-to-window-config-7) + ("s-8" . eyebrowse-switch-to-window-config-8) + ("s-9" . eyebrowse-switch-to-window-config-9))) + (bind-keys* + ("M-0" . eyebrowse-switch-to-window-config-0) + ("M-1" . eyebrowse-switch-to-window-config-1) + ("M-2" . eyebrowse-switch-to-window-config-2) + ("M-3" . eyebrowse-switch-to-window-config-3) + ("M-4" . eyebrowse-switch-to-window-config-4) + ("M-5" . eyebrowse-switch-to-window-config-5) + ("M-6" . eyebrowse-switch-to-window-config-6) + ("M-7" . eyebrowse-switch-to-window-config-7) + ("M-8" . eyebrowse-switch-to-window-config-8) + ("M-9" . eyebrowse-switch-to-window-config-9)) (eyebrowse-mode +1))) #+END_SRC -- cgit 1.4.1 From d28ed1fbfedd689e87ad26baafdc63354139891a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 19 Jul 2017 22:50:25 +0200 Subject: i3: Don't toggle workspaces --- i3/.config/i3/config | 1 - 1 file changed, 1 deletion(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 39a48f3e..54f308d4 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -215,4 +215,3 @@ client.placeholder $base00 $base00 $base05 $base00 $base00 client.background $base07 hide_edge_borders both -workspace_auto_back_and_forth yes -- cgit 1.4.1 From 5a39500b2d95e5e9b9f780b436e88be20cc2a30e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 20 Jul 2017 18:01:12 +0200 Subject: Emacs: Fix typo in base16-theme init --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index df092aa4..75ed92bf 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -201,7 +201,7 @@ quite easily. #+BEGIN_SRC emacs-lisp (use-package base16-theme :if (or window-system - (daemon-p))) + (daemonp))) #+END_SRC Highlighting quasi-quoted expressions in lisps is quite useful, but I -- cgit 1.4.1 From 10f31b8f1a5d3e04ce1d6e3f4bb6f7add53fe8bb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 31 Jul 2017 20:21:19 +0200 Subject: Emacs: Guard against startup errors from frame-title setting --- emacs/.emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 75ed92bf..d15dcd65 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -305,7 +305,7 @@ correct, at least for Liberation Mono. (require 'f) (setq frame-title-format (list "Emacs" - (if nix-emacs + (if (and nix-emacs invocation-directory) (list " (Nix Generation " (cadr (split-string (f-base -- cgit 1.4.1 From 91ddb83cbe0dfe03e9d2d3ea3984fc824407e5f9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 2 Aug 2017 10:21:30 +0200 Subject: Emacs: Use smartparens from melpa-stable Recommended by author: https://github.com/Fuco1/smartparens/issues/775#issuecomment-315853084 --- nix/.config/nixpkgs/emacs.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix index 02b74964..cf697c7c 100644 --- a/nix/.config/nixpkgs/emacs.nix +++ b/nix/.config/nixpkgs/emacs.nix @@ -51,6 +51,7 @@ in diminish bind-key use-package + smartparens ]) ++ (with epkgs.melpaPackages; [ ace-link ace-window @@ -140,7 +141,6 @@ in shrink-whitespace slime smart-tabs-mode - smartparens smex suggest swiper -- cgit 1.4.1 From efa975ed49a33accf3d8c0d674320f26c9ec1cca Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 3 Aug 2017 11:37:31 +0200 Subject: Emacs: Fix building emacs config files on macOS --- emacs/.emacs.d/Makefile | 7 +++++-- zsh/.config/zsh/.zshenv | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/emacs/.emacs.d/Makefile b/emacs/.emacs.d/Makefile index 7741ef3e..9f086ffd 100644 --- a/emacs/.emacs.d/Makefile +++ b/emacs/.emacs.d/Makefile @@ -1,5 +1,6 @@ define EMACS_TANGLE (progn\ + (require 'package)\ (package-refresh-contents nil)\ (setq vc-follow-symlinks nil)\ (find-file \"init.org\")\ @@ -7,6 +8,8 @@ define EMACS_TANGLE (org-babel-tangle nil \"init.el\")) endef +EMACS := ${NIX_LINK}/bin/emacs + # The first target is the default. `all` is typically defined here. all: init.elc @@ -14,10 +17,10 @@ all: init.elc .PHONY: all clean init.el: - @emacs --batch --no-init-file --eval "$(EMACS_TANGLE)" --kill + $(EMACS) --batch --no-init-file --eval "$(EMACS_TANGLE)" --kill init.elc: init.el - @emacs --batch --no-init-file --funcall batch-byte-compile init.el + $(EMACS) --batch --no-init-file --funcall batch-byte-compile init.el clean: rm init.el init.elc diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index 87dda38c..f82d0a26 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -18,6 +18,7 @@ then if [[ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]] then . $HOME/.nix-profile/etc/profile.d/nix.sh; + export NIX_LINK fi case $OSTYPE in -- cgit 1.4.1 From 8c97e999adee892e046ecfaa611193b47497d6fc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 3 Aug 2017 12:08:01 +0200 Subject: Emacs: Switch from org-babel to lentic-mode --- emacs/.emacs.d/init.el | 2869 +++++++++++++++++++++++++++++++++++++++++ emacs/.emacs.d/init.org | 369 +++--- nix/.config/nixpkgs/emacs.nix | 2 +- 3 files changed, 3037 insertions(+), 203 deletions(-) create mode 100644 emacs/.emacs.d/init.el diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el new file mode 100644 index 00000000..902e5b52 --- /dev/null +++ b/emacs/.emacs.d/init.el @@ -0,0 +1,2869 @@ +;;; emacs-config --- Summary +;; #+TITLE: Emacs Configuration for Alan Pearce +;; #+OPTIONS: ^:nil +;; #+PROPERTY: results silent +;; #+PROPERTY: eval no-export +;; #+PROPERTY: header-args :comments link +;;; Header: +;; This is a living document, detailing my Emacs configuration using org-mode +;;; Code: +;; ** Basics +;; *** Startup +;; 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-screen t) +(setq gc-cons-threshold 100000000) +(defvar file-name-handler-alist-backup file-name-handler-alist) +(setq file-name-handler-alist nil) +(remove-hook 'find-file-hooks #'vc-refresh-state) +;; #+END_SRC + +;; Are we running on Windows via the WSL? + +;; #+BEGIN_SRC emacs-lisp +(when (file-exists-p "/proc/sys/kernel/osrelease") + (with-temp-buffer + (insert-file-contents-literally "/proc/sys/kernel/osrelease") + (decode-coding-region (point-min) (point-max) 'utf-8 t) + (when (string-match "Microsoft$" (buffer-string)) + (setq system-type 'gnu/linux/windows)))) +;; #+END_SRC + +;; *** Compatibility + +;; #+BEGIN_SRC emacs-lisp +(if (version< emacs-version "25.0") + (defmacro with-eval-after-load (file &rest body) + `(eval-after-load ,file (lambda () ,@body)))) +;; #+END_SRC + +;; *** Scratch buffers +;; I usually use scratch buffers for any sort of text. If I need a +;; 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) +;; #+END_SRC + +;; *** Personal Information +;; #+BEGIN_SRC emacs-lisp +(setq user-mail-address "alan@alanpearce.eu" + user-full-name "Alan Pearce") +;; #+end_src + +;; ** Packaging + +;; *** Use-package + +;; #+BEGIN_SRC emacs-lisp +(eval-and-compile + (require 'seq) + (defvar nix-emacs (and (string-match "^/nix/store" invocation-directory) + (not (null (seq-some (lambda (dir) (string-match "^/nix/store" dir)) load-path))))) + + (setq tls-checktrust t + gnutls-verify-error t + package-menu-async t + package-user-dir (concat "~/.emacs.d/packages/" emacs-version "/elpa") + package-menu-hide-low-priority t) + (if nix-emacs + (progn (setq package-archives nil) + (package-initialize)) + (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") + ("melpa-stable" . "https://stable.melpa.org/packages/") + ("melpa" . "https://melpa.org/packages/")) + package-pinned-packages '(("use-package" . melpa-stable) + ("diminish" . melpa-stable) + ("bind-key" . melpa-stable)) + package-archive-priorities '(("melpa" . 10) + ("gnu" . 10) + ("melpa-stable" . 5) + ("marmalade" . 0)))) + (when (eq system-type 'darwin) + (with-eval-after-load "gnutls" + (add-to-list 'gnutls-trustfiles "/etc/ssl/cert.pem"))) + (unless nix-emacs + (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)) +(setq use-package-always-ensure (not nix-emacs) + use-package-always-demand (daemonp) + package-enable-at-startup nil) +;; #+END_SRC + +;; *** Helpers + +;; **** Hook Helpers + +;; An improvement over add-hook with lamda functions that allows +;; modification and removal, without the boilerplate of an extra function +;; definition. + +;; #+BEGIN_SRC emacs-lisp +(eval-and-compile + (use-package hook-helpers)) +;; #+END_SRC + +;; ** Customize +;; I don’t really like using customize for normal configuration. +;; Instead, I use it for things that get saved automatically. That’s why +;; I use a different file, which is ignored by the VCS. It also means +;; that it’s not important whether the file exists or not, which is why I +;; pass =:noerror= to =load= + +;; #+BEGIN_SRC emacs-lisp +(setq custom-file "~/.emacs.d/custom.el") +(load custom-file :noerror :nomessage) +;; #+END_SRC + +;; ** Styles + +;; I prefer an always-visible cursor. Feels less distracting. +;; #+BEGIN_SRC emacs-lisp +(when (fboundp #'blink-cursor-mode) + (blink-cursor-mode -1)) +;; #+END_SRC + +;; 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)) +(with-eval-after-load 'scroll-bar + (set-scroll-bar-mode nil)) +(with-eval-after-load 'tooltip + (tooltip-mode -1)) +(with-eval-after-load 'tool-bar + (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)))) +;; #+END_SRC + +;; *** Colours + +;; Eziam looks nice, too, except for the non-white background. I prefer +;; white because most other application backgrounds are that colour. + +;; #+BEGIN_SRC emacs-lisp +(use-package eziam-light-theme + :ensure eziam-theme + :disabled t + :if (or window-system + (daemonp)) + :defines (eziam-scale-headings) + :config (progn + (setq eziam-scale-headings nil) + (load-theme 'eziam-light t) + (custom-theme-set-faces 'user + '(default ((t (:background "#ffffff")))) + '(js2-function-call ((t (:underline nil)))) + '(js2-object-property ((t (:slant normal)))) + '(font-lock-keyword-face ((t (:weight normal)))) + '(git-gutter-fr:added ((t (:foreground "#96a4ab")))) + '(git-gutter-fr:modified ((t (:foreground "#96a4ab")))) + '(git-gutter-fr:deleted ((t (:foreground "#96a4ab"))))))) +;; #+END_SRC + +;; White-theme. Sounds like a good idea. + +;; #+BEGIN_SRC emacs-lisp +(use-package white-theme + :if (or window-system + (daemonp)) + :config (progn + (load-theme 'white t) + (custom-theme-set-faces 'user + '(git-gutter-fr:added ((t (:foreground "#b8b8b8")))) + '(git-gutter-fr:modified ((t (:foreground "#b8b8b8")))) + '(git-gutter-fr:deleted ((t (:foreground "#b8b8b8")))) + '(font-lock-string-face ((t (:slant normal))))))) +;; #+END_SRC + +;; Base16 theming allows me have a consistent style between applications +;; quite easily. + +;; #+BEGIN_SRC emacs-lisp +(use-package base16-theme + :if (or window-system + (daemonp))) +;; #+END_SRC + +;; Highlighting quasi-quoted expressions in lisps is quite useful, but I +;; don't need it all the time. I'll keep it around for a while so that I +;; can enable it if needed. +;; #+BEGIN_SRC emacs-lisp +(use-package highlight-stages + :diminish highlight-stages-mode) +;; #+END_SRC + +;; *** Fonts + +;; 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 . 1))) + + (defun ap/set-fonts (mono-face mono-font-size variable-face variable-font-size antialias &optional new-line-spacing) + (if (boundp 'ns-antialias-text) + (setq ns-antialias-text antialias)) + (if (boundp 'new-line-spacing) + (setq line-spacing new-line-spacing)) + (when mono-face + (let ((default-font (font-spec :family mono-face :size mono-font-size))) + (add-to-list 'default-frame-alist `(font . ,(format "%s %s" mono-face mono-font-size))) + (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 t)) + ((or (eq window-system 'mac) + (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 "Fira Code" 14 "Lucida Grande" 14 t nil) + (ap/set-fonts "Monoid" 12 "Helvetica Neue" 12 t 0.1)))) + ((and (eq window-system 'x) + (not (eq system-type 'gnu/linux/windows))) + (set-fontset-font "fontset-default" 'unicode (font-spec :name "PT Mono" :size 17)) + (ap/set-fonts "PT Mono" 17 "Noto Sans" 14 nil)) + ((and (eq window-system 'x) + (eq system-type 'gnu/linux/windows)) + (ap/set-fonts "Noto Mono" 12 "Sans" 12 nil)))) + + (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))) +;; #+END_SRC + +;; Make symbols prettier. Turns out, in many cases, this is already +;; configured, just not enabled. If using the mac-port version of Emacs, +;; it has it's own, more extensive version. + +;; #+BEGIN_SRC emacs-lisp +(if (eq window-system 'mac) + (mac-auto-operator-composition-mode +1) + (global-prettify-symbols-mode +1)) +;; #+END_SRC + +;; *** Page Breaks + +;; By default, Emacs displays page breaks as ^L. Lines look much nicer. +;; On Windows, Emacs incorrectly detects that U+2500 (Box Drawings Light +;; Horizontal) can only be displayed with a different font, which is not +;; 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))))) +;; #+END_SRC +;; *** Modeline + +;; #+BEGIN_SRC emacs-lisp +(column-number-mode -1) +(line-number-mode -1) +(size-indication-mode t) + + +(require 'f) +(setq frame-title-format (list "Emacs" + (if (and nix-emacs invocation-directory) + (list " (Nix Generation " + (cadr + (split-string (f-base + (car + (last (seq-take-while + (lambda (s) (s-contains? "profile" s)) + (split-string + (s-chomp (shell-command-to-string (concat "nix-store -q --roots " invocation-directory))) + "\n"))))) + "-")) + " " + (s-left 6 (nth 3 (f-split invocation-directory))) + "..." + (s-right 6 (car (split-string (nth 3 (f-split invocation-directory)) "-"))) + ")")) + '(buffer-file-name " — %f") + '(dired-directory (" — " dired-directory)))) +;; #+END_SRC + +;; *** Chrome + +;; Sometimes I like to hide clutter. Other times, it's useful. + +;; #+BEGIN_SRC emacs-lisp +(defvar mode-line-default-format mode-line-format) +(defvar mode-line-default-hidden nil + "Whether to hide the mode line by default") + +(defun show-mode-line () + (interactive) + (setq mode-line-format mode-line-default-format) + (when (called-interactively-p 'interactive) + (setq-default mode-line-format mode-line-default-format) + (setq mode-line-default-hidden nil))) +(defun hide-mode-line () + (interactive) + (setq mode-line-format nil) + (when (called-interactively-p 'interactive) + (setq-default mode-line-format nil) + (setq mode-line-default-hidden t))) + +(setq-default cursor-in-non-selected-windows nil) + +(defun hide-clutter () + (interactive) + (hide-mode-line)) + +(defun show-clutter () + (interactive) + (show-mode-line)) + +(when mode-line-default-hidden + (call-interactively #'hide-mode-line)) + +(setq-default indicate-buffer-boundaries nil) +(fringe-mode '(4 . 4)) + +(defun hide-mode-line-if-default-hidden () + (if mode-line-default-hidden + (hide-mode-line) + (show-mode-line))) + +(add-to-list 'default-frame-alist '(border-width . 0)) +(add-to-list 'default-frame-alist '(internal-border-width . 0)) +(when (or (eq window-system 'x) + (eq window-system 'mac)) + (setq window-divider-default-bottom-width 1 + window-divider-default-right-width 1 + window-divider-default-places t) + (window-divider-mode +1)) + +(add-hook 'after-change-major-mode-hook #'hide-mode-line-if-default-hidden) + +(add-hook 'minibuffer-setup-hook #'show-mode-line) +(add-hook 'minibuffer-exit-hook #'hide-mode-line) +;; #+END_SRC + +;; *** Highlight Changes + +;; 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))) +;; #+END_SRC + +;; *** Beacon + +;; I was against the idea of having flashy animations inside Emacs, but +;; this one is useful. It highlights the cursor when scrolling or +;; switching windows. + +;; #+BEGIN_SRC emacs-lisp +(use-package beacon + :diminish beacon-mode + :config (progn + (beacon-mode +1) + (setq beacon-blink-delay 0.25 + beacon-blink-duration 0.25 + beacon-size 20 + beacon-color "#a1b56c"))) +;; #+END_SRC + +;; *** Renaming major modes + +;; Diminishing major modes does not happen in the same manner as minor +;; modes. + +;; #+BEGIN_SRC emacs-lisp +(unless (version<= emacs-version "24.4") + (use-package cyphejor + :defer 2 + :config (progn + (setq cyphejor-rules `(("emacs" "ε") + ("diff" "Δ") + ("js2" "js") + ("magit-status" ,(char-to-string (seq-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 + + +;; ** Environment Variables + +;; MacOS doesn’t have a reasonable way to set environment variables and +;; read them automatically any more. So, let’s use the +;; [[https://github.com/purcell/exec-path-from-shell][exec-path-from-shell]] package to set up ~exec-path~ and similar +;; variables from whatever my shell configuration is. + +;; On Windows, I like to run Emacs from the system tray menu of VcXsrv. +;; It starts up without an environment in this case as well. + +;; #+BEGIN_SRC emacs-lisp +(use-package exec-path-from-shell + :if (or (eq system-type 'darwin) + (eq system-type 'gnu/linux/windows) + (and (eq system-type 'gnu/linux) + (daemonp))) + :config (progn + (setq exec-path-from-shell-arguments '("-l")) + (exec-path-from-shell-initialize))) +;; #+END_SRC + +;; *** NixOS sandboxes + +;; I'm currently exploring using nix to create sandboxes for +;; development. This package allows using tools from inside sandboxes, +;; and some convenience commands for building packages and launching shells. + +;; #+BEGIN_SRC emacs-lisp +(use-package nix-sandbox + :config (progn + (with-eval-after-load 'flycheck + (setq flycheck-command-wrapper-function + (lambda (command) + (if (nix-current-sandbox) + (apply 'nix-shell-command (nix-current-sandbox) command) + command)) + flycheck-executable-find + (lambda (cmd) + (if (nix-current-sandbox) + (nix-executable-find (nix-current-sandbox) cmd) + (executable-find cmd))))))) +;; #+END_SRC + +;; ** Keybindings + +;; I think =set-keyboard-coding-system= stops OS X from doing something +;; annoying to add accents. The modifier setup is to match my +;; re-arrangement of modifiers on OSX: Cmd on the outside, then +;; 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")) +;; #+END_SRC + +;; #+BEGIN_SRC emacs-lisp +(unbind-key "") +(bind-key* "" #'compile) +(bind-key* "" #'kmacro-start-macro-or-insert-counter) +(bind-key* "" #'kmacro-end-or-call-macro) + +(bind-key* "" #'execute-extended-command) + +(unbind-key "C-z") +(bind-key* "C-" #'other-window) + +(bind-key* "C-x C-r" #'revert-buffer) +(bind-key* "C-x C-j" #'delete-indentation) +(unbind-key "C-x C-c") + +(bind-key* "C-c i" #'insert-char) +(bind-key* "M-/" #'hippie-expand) + +(unbind-key "s-h") +(unbind-key "s-n") +(unbind-key "s-p") +(unbind-key "s-w") +(bind-key* "s-k" #'kill-or-delete-this-buffer-dwim) + +(bind-key "C-M-a" #'backward-paragraph text-mode-map) +(bind-key "C-M-e" #'forward-paragraph text-mode-map) + +(bind-key* "s-x" (define-prefix-command 'super-x-map)) +(bind-key* "s-," #'switch-to-dotfiles) +(bind-key* "C-x M-x" #'execute-extended-command) +(set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) +;; #+END_SRC + +;; *** Crux + +;; I can replace most of the simple helper/wrapper functions in my +;; 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)) + :config (progn + (crux-reopen-as-root-mode +1)) + :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 +(defun switch-to-dotfiles () + (interactive) + (projectile-switch-project-by-name (car (split-string (shell-command-to-string "ghq list --full-path dotfiles"))))) +;; #+END_SRC + +;; *** The Silver Searcher + +;; #+BEGIN_SRC emacs-lisp +(use-package ag + :defer 30 + :config (setq ag-project-root-function #'projectile-project-root)) + +(use-package wgrep-ag + :after ag) +;; #+END_SRC + +;; *** Ripgrep + +;; Step over Silver Search, here comes a new challenger. + +;; #+BEGIN_SRC emacs-lisp +(use-package ripgrep + :if (executable-find "rg")) + +(use-package projectile-ripgrep + :after (ripgrep projectile) + :if (executable-find "rg") + :bind (("C-c p s r" . projectile-ripgrep))) +;; #+END_SRC + +;; *** Projectile + +;; Projectile is awesome for working in projects, especially VCS-backed +;; ones. + +;; #+BEGIN_SRC emacs-lisp +(use-package projectile + :bind (("s-p" . projectile-switch-project) + ("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 +1) + (add-to-list 'projectile-globally-ignored-directories ".stversions") + + (defun yarn-install (&optional arg) + (interactive "P") + (projectile-with-default-dir (projectile-project-root) + (cmd-to-echo "yarn" "install"))) + + (defun yarn-add-dev (package) + (interactive "spackage: ") + (projectile-with-default-dir (projectile-project-root) + (cmd-to-echo "yarn" (concat "add --dev " package)))) + + (defun yarn-add (package) + (interactive "spackage: ") + (projectile-with-default-dir (projectile-project-root) + (cmd-to-echo "yarn" (concat "add " package)))) + + (defun yarn-run (cmd) + (interactive (list + (projectile-completing-read "command: " (alist-get 'scripts (json-read-file (expand-file-name "package.json" (projectile-project-root))))))) + (projectile-with-default-dir (projectile-project-root) + (cmd-to-echo "yarn" (concat "run " cmd)))) + + (defun ap/open-project (&optional arg) + (interactive "P") + (let ((project-dir (projectile-completing-read + "Open project: " + (ghq--find-projects)))) + (projectile-switch-project-by-name + (expand-file-name project-dir (ghq--find-root)) arg))) + + (setq projectile-switch-project-action #'projectile-commander + projectile-completion-system 'ivy + projectile-create-missing-test-files t) + + (defun ap/projectile-test-suffix (project-type) + (cond + ((member project-type '(node-yarn node-npm)) ".test") + (t (projectile-test-suffix project-type)))) + (setq projectile-test-suffix-function #'ap/projectile-test-suffix) + + (projectile-register-project-type 'node-yarn '("yarn.lock") "yarn start" "yarn test") + (projectile-register-project-type 'node '("package.json") "npm start" "npm test"))) + +(use-package counsel-projectile + :after (counsel projectile) + :config (progn + (counsel-projectile-on) + (def-projectile-commander-method ?A + "Find rg on project." + (call-interactively #'counsel-projectile-rg)) + (define-key projectile-mode-map [remap counsel-projectile-ag] #'counsel-projectile-rg))) +;; #+END_SRC + +;; *** vc + +;; This is nice for some things that magit doesn’t do, and for those rare +;; occasions that I’m working with something other than git. + +;; #+BEGIN_SRC emacs-lisp +(use-package vc + :defer t + :bind (("C-x v C" . vc-resolve-conflicts)) + :config (progn + (setq vc-follow-symlinks t) + (setq vc-ignore-dir-regexp (format "\\(%s\\)\\|\\(%s\\)" + vc-ignore-dir-regexp + tramp-file-name-regexp)))) +;; #+END_SRC + +;; *** git-gutter-fringe + +;; It’s nice to be able to see at a glance which lines of a file have +;; changed. This package colours the fringe. I have it set to the right +;; fringe so it doesn’t interfere with flycheck. + +;; #+BEGIN_SRC emacs-lisp +(eval-when-compile (require 'fringe-helper)) +(use-package git-gutter-fringe + :defer 2 + :diminish git-gutter-mode + :config (progn + (global-git-gutter-mode 1) + ;; places the git gutter outside the margins. + (setq-default fringes-outside-margins t) + ;; thin fringe bitmaps + (fringe-helper-define 'git-gutter-fr:added '(center repeated) + ".XXX....") + (fringe-helper-define 'git-gutter-fr:modified '(center repeated) + ".XXX....") + (fringe-helper-define 'git-gutter-fr:deleted 'bottom + ".......X" + "......XX" + ".....XXX" + "....XXXX") + (setq git-gutter-fr:side 'right-fringe))) +;; #+END_SRC + +;; *** magit + +;; Magit is my favourite way to use git. I use selective staging all the +;; 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-completing-read-function #'ivy-completing-read + magit-popup-use-prefix-argument 'default + magit-display-buffer-function #'magit-display-buffer-fullcolumn-most-v1 + 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-messenger + +;; Popup the last commit that changed the line at point. + +;; #+BEGIN_SRC emacs-lisp +(use-package git-messenger + :bind* (("C-x v p" . git-messenger:popup-message)) + :config (progn + (setq git-messenger:use-magit-popup t))) +;; #+END_SRC + +;; *** git-timemachine + +;; This package allow me to go through a file’s history with just a few +;; keys. It makes it very easy to figure what what exactly was in a file +;; in the past. I often find it useful when I remember writing something +;; a particular way, but it changed later. + +;; #+BEGIN_SRC emacs-lisp +(use-package git-timemachine + :commands git-timemachine) +;; #+END_SRC + +;; *** ghq + +;; [[https://github.com/motemen/ghq][=ghq=]] clones VCS-backed projects to a common directory. It should +;; seem familiar to anyone who's used =go get= before. [[https://github.com/rcoedo/emacs-ghq][=emacs-ghq=]] is a +;; simple wrapper for it. + +;; #+BEGIN_SRC emacs-lisp +(use-package ghq + :if (executable-find "ghq")) +;; #+END_SRC + +;; ** Files + +;; *** Auto-saving + +;; Auto-save everything to a temporary directory, instead of cluttering +;; 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) +;; #+END_SRC +;; *** Backups + +;; I like to keep my backups out of regular folders. I tell emacs to use +;; 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)) +(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)))) +;; #+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))))) +;; #+END_SRC + +;; *** Encoding + +;; UTF-8 is usually appropriate. Note that =prefer-coding-system= expects +;; only a coding system, not a coding system and line ending combination. + +;; #+BEGIN_SRC emacs-lisp +(prefer-coding-system 'utf-8) +(setq-default buffer-file-coding-system 'utf-8-auto-unix) +;; #+END_SRC + +;; *** Buffer-file management + +;; Ask if I want to create a directory when it doesn’t exist. This is +;; 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)))) +(add-to-list 'find-file-not-found-functions #'my-create-non-existent-directory) +;; #+END_SRC + +;; I often want to rename or delete the file that I’m currently visiting +;; 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))))) +;; #+END_SRC + +;; *** Whitespace + +;; Show bad whitespace, so that I can fix it. + +;; #+BEGIN_SRC emacs-lisp +(defun show-trailing-whitespace-on () + (interactive) + (setq-local show-trailing-whitespace t)) +(defun show-trailing-whitespace-off () + (interactive) + (setq-local show-trailing-whitespace nil)) +(add-hook 'prog-mode-hook #'show-trailing-whitespace-on) +(add-hook 'text-mode-hook #'show-trailing-whitespace-on) +;; #+END_SRC + +;; *** shrink-whitespace + +;; DWIM whitespace removal. So I don’t need =M-SPC=, =M-\= and =C-x o= +;; for similar things any more. + +;; #+BEGIN_SRC emacs-lisp +(use-package shrink-whitespace + :bind ("M-SPC" . shrink-whitespace)) +;; #+END_SRC + +;; *** Tramp + +;; Tramp is awesome. It makes SSH feel Unix-y. The proxy setup is so +;; 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" (format "/run/user/%s/ssh-agent" (user-uid)))) + (setq tramp-default-method "ssh" + tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root")) + tramp-backup-directory-alist backup-directory-alist + tramp-completion-reread-directory-timeout 60 + tramp-ssh-controlmaster-options nil + 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)))) +;; #+END_SRC + +;; *** ediff + +;; I like a horizonal diff setup, with everything in one frame. + +;; #+BEGIN_SRC emacs-lisp +(use-package ediff + :defer t + :config (progn + (setq ediff-split-window-function 'split-window-horizontally + ediff-window-setup-function 'ediff-setup-windows-plain))) +;; #+END_SRC + +;; ** Indentation + +;; Ah, a complicated topic. One day we’ll all be using elastic +;; 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 2 + indent-tabs-mode nil) +(electric-indent-mode +1) +;; #+END_SRC + + +;; *** smart-tabs-mode + +;; Not related to [[smart-tab][=smart-tab=]], this mode indents with tabs and aligns +;; with spaces. Perfect! + +;; #+BEGIN_SRC emacs-lisp +(use-package smart-tabs-mode + :defer 1 + :config (progn + (smart-tabs-insinuate 'c 'cperl 'python) + (define-hook-helper php-mode () + (smart-tabs-mode indent-tabs-mode)))) +;; #+END_SRC + +;; *** editorconfig + +;; #+BEGIN_SRC emacs-lisp +(use-package editorconfig + :diminish "EC" + :config (editorconfig-mode 1)) +;; #+END_SRC + +;; *** dtrt-indent-mode + +;; Sometimes people use different indentation settings. [[https://github.com/jscheid/dtrt-indent][dtrt-indent]] +;; guesses the correct settings for me. + +;; #+BEGIN_SRC emacs-lisp +(use-package dtrt-indent + :config (progn + (define-hook-helper after-change-major-mode () + (unless (and (boundp editorconfig-mode) + editorconfig-mode) + (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 + +;; *** password-store + +;; 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))) +;; #+END_SRC +;; ** Buffers + +;; *** Ibuffer +;; Ibuffer is quite nice for listing all buffers. + +;; #+BEGIN_SRC emacs-lisp +(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))))) +;; #+END_SRC + +;; *** Relative Buffer names + +;; #+BEGIN_SRC emacs-lisp +(use-package relative-buffers + :defer 15 + :config (progn + (global-relative-buffers-mode))) +;; #+END_SRC +;; *** Narrowing + +;; Enable it without prompting + +;; #+BEGIN_SRC emacs-lisp +(put 'narrow-to-defun 'disabled nil) +(put 'narrow-to-page 'disabled nil) +(put 'narrow-to-region 'disabled nil) +;; #+END_SRC + +;; *** ace-window + +;; I don’t often have many windows open at once, but when I do, +;; =ace-window= is really nice to jump around them in the same way that +;; =ace-jump= or =avy= work. +;; #+BEGIN_SRC emacs-lisp +(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)))) +;; #+END_SRC + +;; ** Windows + +;; Scrolling is tricky. I use this setup to help me keep track of the +;; 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 160 + frame-resize-pixelwise nil) +(if (boundp 'ns-pop-up-frames) + (setq ns-pop-up-frames nil)) +;; #+END_SRC + +;; *** eyebrowse + +;; Workspaces, a bit like dwm. On Windows and Linux (at least the WMs +;; I'm likely to use), super+{0-9} are taken from the OS, so use meta +;; instead. On macOS, super makes a lot of sense, as it's used by most +;; programs to switch between program windows or views. + +;; #+BEGIN_SRC emacs-lisp +(use-package eyebrowse + :config (progn + (setq eyebrowse-new-workspace t) + (when (eq system-type 'darwin) + (bind-keys + ("s-0" . eyebrowse-switch-to-window-config-0) + ("s-1" . eyebrowse-switch-to-window-config-1) + ("s-2" . eyebrowse-switch-to-window-config-2) + ("s-3" . eyebrowse-switch-to-window-config-3) + ("s-4" . eyebrowse-switch-to-window-config-4) + ("s-5" . eyebrowse-switch-to-window-config-5) + ("s-6" . eyebrowse-switch-to-window-config-6) + ("s-7" . eyebrowse-switch-to-window-config-7) + ("s-8" . eyebrowse-switch-to-window-config-8) + ("s-9" . eyebrowse-switch-to-window-config-9))) + (bind-keys* + ("M-0" . eyebrowse-switch-to-window-config-0) + ("M-1" . eyebrowse-switch-to-window-config-1) + ("M-2" . eyebrowse-switch-to-window-config-2) + ("M-3" . eyebrowse-switch-to-window-config-3) + ("M-4" . eyebrowse-switch-to-window-config-4) + ("M-5" . eyebrowse-switch-to-window-config-5) + ("M-6" . eyebrowse-switch-to-window-config-6) + ("M-7" . eyebrowse-switch-to-window-config-7) + ("M-8" . eyebrowse-switch-to-window-config-8) + ("M-9" . eyebrowse-switch-to-window-config-9)) + (eyebrowse-mode +1))) +;; #+END_SRC + +;; ** Sessions + +;; *** Desktop +;; Save my Emacs session and restore it on startup. + +;; #+BEGIN_SRC emacs-lisp +(use-package desktop + :ensure nil + :config (progn + (setq desktop-dirname (expand-file-name "desktop/" user-emacs-directory) + desktop-base-file-name "emacs.desktop" + desktop-base-lock-name "lock" + desktop-path (list desktop-dirname) + desktop-save 'if-exists + desktop-files-not-to-save "^$" + desktop-load-locked-desktop nil) + (unless (file-directory-p desktop-dirname) + (make-directory desktop-dirname)) + (desktop-save-mode 1))) +;; #+END_SRC + +;; *** winner + +;; Undo, for window-based commands. + +;; #+BEGIN_SRC emacs-lisp +(use-package winner + :config (setq winner-boring-buffers '("*Completions*" "*Help*" "*Apropos*" "*Buffer List*" "*info*" "*Compile-Log*")) + :init (progn + (winner-mode 1))) +;; #+END_SRC + +;; *** windmove + +;; Directional window movement + +;; #+BEGIN_SRC emacs-lisp +(use-package windmove + :bind (("S-" . windmove-left) + ("S-" . windmove-right) + ("S-" . windmove-up) + ("S-" . windmove-down))) +;; #+END_SRC +;; ** Blogging + +;; I have a [[https://alanpearce.uk][blog]] that I publish with hugo. + +;; #+BEGIN_SRC emacs-lisp +(use-package easy-hugo + :config (setq easy-hugo-basedir (car (split-string (shell-command-to-string "ghq list --full-path alanpearce.uk"))) + easy-hugo-url "https://alanpearce.uk" + easy-hugo-default-ext ".md")) +;; #+END_SRC + +;; ** Completion + +;; Make built-in completion a bit more intelligent, by adding substring +;; 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) +;; #+END_SRC + +;; *** Company + +;; The main choices for automatic completion in Emacs are company and +;; auto-complete-mode. I’ve not tried auto-complete-mode as company +;; 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-on) + (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-gtags + company-etags company-keywords) company-oddmuse) + company-frontends '(company-pseudo-tooltip-unless-just-one-frontend + company-preview-frontend + company-echo-metadata-frontend) + 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-selection-wrap-around t))) +;; #+END_SRC + +;; #+BEGIN_SRC emacs-lisp +(use-package company-web + :after company) +;; #+END_SRC + +;;; * Dates: & Times + +;; *** Calendar + +;; 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))) +;; #+END_SRC + +;; Sometimes I want to insert a date or time into a buffer. +;; #+BEGIN_SRC emacs-lisp +(defun insert-date (prefix) + "Insert the current date. With prefix-argument, use British format. With + 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)))) + +(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)))) +;; #+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)) +;; #+END_SRC + +;; ** Directories + +;; Dired works quite nicely, but not always in the way I want. I don’t +;; like having so many prompts for recursive operations. Also, when I +;; have two dired windows open, assume that I’m going to be +;; copying/moving files between them. + +;; #+BEGIN_SRC emacs-lisp +(use-package dired + :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 (if delete-by-moving-to-trash + 'always + 'top) + dired-listing-switches "-alh") + (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)) + +(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 + dired-bind-jump nil)) + :init (progn + (add-hook 'dired-mode-hook #'turn-on-dired-omit-mode))) +;; #+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)))) +;; #+END_SRC + +;; *** Disk usage + +;; Combine dired and du (disk usage). + +;; #+BEGIN_SRC emacs-lisp +(use-package dired-du + :after dired + :config (progn + (setq dired-du-size-format t))) +;; #+END_SRC + +;; *** Dired-narrow +;; One can already use dired with wildcards to browse a filtered +;; directory listing, but it opens a new buffer. Dired-narrow is a +;; slightly nicer interface: with a currently-open dired buffer, use =/= +;; to start filtering, =RET= to complete the filter and =g= to refresh +;; 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)))) +;; #+END_SRC + +;; ** Documentation + +;; *** ehelp + +;; ehelp is a less well-known package that’s part of Emacs and slightly +;; improves the normal help commands, mostly by making quitting them easier. + +;; #+BEGIN_SRC emacs-lisp +(use-package ehelp + :bind-keymap ("C-h" . ehelp-map)) +;; #+END_SRC +;; *** counsel-dash + +;; Emacs’ documentation is great to read from inside Emacs. Counsel-dash +;; 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) + (seq-map #'counsel-dash-install-docset + (seq-difference ',docsets + (helm-dash-installed-docsets))) + (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")))) +;; #+END_SRC + +;; *** discover-my-major + +;; A nicer way to browse keybindings for major modes. + +;; #+BEGIN_SRC emacs-lisp +(use-package discover-my-major + :bind ("" . discover-my-major)) +;; #+END_SRC + +;; *** which-key + +;; 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))) +;; #+END_SRC + +;; *** eldoc + +;; Documentation in the echo-area (where the minibuffer is displayed) is +;; rather useful. + +;; #+BEGIN_SRC emacs-lisp +(use-package eldoc + :commands (eldoc-mode) + :diminish eldoc-mode + :config (progn + (setq eldoc-idle-delay 0.1) + (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) +;; #+END_SRC +;; ** Mail + +;; *** Gnus + +;; At work, I use gnus for email. Some of the setup is specific to my +;; workplace, so I keep it in a host-specific, GPG-encrypted file. + +;; #+BEGIN_SRC emacs-lisp +(use-package gnus + :config (progn + (setq gnus-gcc-mark-as-read t + mml-secure-openpgp-encrypt-to-self t + send-mail-function #'smtpmail-send-it + message-send-mail-function #'smtpmail-send-it))) + +(with-eval-after-load "gnus-mime" + (define-key gnus-mime-button-map " " #'gnus-mime-view-part-externally)) + +(with-eval-after-load "mailcap" + (when (eq system-type 'darwin) + (mailcap-add-mailcap-entry "application" "pdf" '((viewer . "/usr/bin/qlmanage -p %s") (type . "application/pdf"))))) + +(with-eval-after-load "mm-decode" + (add-to-list 'mm-discouraged-alternatives "text/html") + (add-to-list 'mm-discouraged-alternatives "text/richtext")) +;; #+END_SRC + +;; *** BBDB + +;; As I'm using Emacs for email, it makes sense to have contact +;; information here as well. + +;; #+BEGIN_SRC emacs-lisp +(use-package bbdb + :config (progn + (bbdb-initialize 'gnus 'message 'pgp) + (bbdb-mua-auto-update-init 'gnus 'message) + (setq bbdb-send-mail-style 'gnus + bbdb-complete-mail-allow-cycling t + bbdb-mua-auto-update t + bbdb-mua-update-interactive-p '(query . create) + bbdb-message-all-addresses t + bbdb-offer-save t + bbdb-offer-to-create 1))) +;; #+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.") +(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 " + " nil t) + (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)))) + +(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))) + +(defun process-exit-code (program &rest args) + "Run PROGRAM with ARGS and return the exit code" + (apply 'call-process program nil nil nil args)) + +(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))) + +(bind-key* "M-!" #'shell-execute) +(bind-key* "C-x r M-w" #'copy-rectangle) +;; #+END_SRC + +;; *** Auxillary Configuration + +;; #+BEGIN_SRC emacs-lisp +(require 'pinentry) + +(defvar have-private-key + (file-exists-p (expand-file-name "secring.gpg" "~/.gnupg/"))) + +(defvar gpg-agent-ssh-sock + (or (getenv "GPG_AGENT_INFO") + (concat "/run/user/" (number-to-string (user-uid)) "/gnupg/S.gpg-agent.ssh"))) + +(defun read-gpg-file (file) + (let ((file-to-decrypt (expand-file-name file user-emacs-directory)) + (ctx (epg-make-context epa-protocol))) + (if (file-exists-p file-to-decrypt) + (epg-decrypt-file ctx file-to-decrypt nil) + (message "Decrypting %s...failed" file-to-decrypt) + (error "File %s does not exist" file-to-decrypt)))) + +(defun load-gpg (file) + (if have-private-key + (load file) + (message "WARNING: Couldn't load %s (No gpg key found)" file))) + +; load this in a post-frame hook because gpg-agent asks for a password on first +; startup and caches it. Don't want emacs daemon to hang because of gpg-agent. +(defun load-private-data () + (interactive) + (if (not (file-exists-p (expand-file-name (concat (system-name) ".el.gpg") user-emacs-directory))) + (message "No encrypted configuration matches system name `%s'" (system-name)) + (if (not have-private-key) + (message "ERROR: Private GPG key not found") + (unless (or (getenv "GPG_AGENT_INFO") + (getenv "SSH_AUTH_SOCK")) + (start-process "gpg-agent" nil "gpg-agent" "--daemon") + (setenv "SSH_AUTH_SOCK" gpg-agent-ssh-sock)) + (setq password-cache-expiry nil) + (unless (file-exists-p (concat pinentry--socket-dir "pinentry")) + (pinentry-start) + (add-hook 'kill-emacs-hook 'pinentry-stop)) + (add-to-list 'load-suffixes ".el.gpg") + (load-gpg (expand-file-name (system-name) user-emacs-directory))))) + +(defun first-frame-hook (frame) + (remove-hook 'after-make-frame-functions #'first-frame-hook) + (run-at-time nil nil 'load-private-data)) + +(if (eq 1 (length (frame-list))) + (add-hook 'after-init-hook #'load-private-data) + (add-hook 'after-make-frame-functions #'first-frame-hook)) +;; #+END_SRC + +;; ** Minibuffer + +;; Sometimes I want to use the minibuffer, but I’m already inside it. +;; Fortunately, this is possible. Of course, I need to know how many +;; minibuffers there are on the stack. + +;; #+BEGIN_SRC emacs-lisp +(setq enable-recursive-minibuffers t) +(minibuffer-depth-indicate-mode t) +;; #+END_SRC + +;; This avoids some issue with the minibuffer and the point being behind +;; the prompt. I don’t remember what exactly. +;; #+BEGIN_SRC emacs-lisp +(setq minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)) +;; #+END_SRC + +;; 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)) +;; #+END_SRC + +;; *** swiper/ivy + +;; Ivy is the new kid on the completion block. It seems to be a strong +;; replacement for helm so far. + +;; #+BEGIN_SRC emacs-lisp +(use-package swiper + :bind (("C-s" . swiper) + ("C-r" . swiper) + ("C-=" . swiper)) + :diminish ivy-mode + :demand t + :config (progn + (ivy-mode 1) + (setq ivy-re-builders-alist '((t . ivy--regex-plus)) + ivy-extra-directories '("./")) + (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 "" #'counsel-M-x) + (bind-key "C-c M-x" #'execute-extended-command) + (bind-key "C-x C-f" #'counsel-find-file) + (bind-key "M-y" #'counsel-yank-pop) + (bind-key "C-x i" #'counsel-imenu) + (bind-key "M-y" #'ivy-next-line ivy-minibuffer-map) + (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)))) + (setq counsel-rg-base-command "rg -i --no-heading --line-number --hidden %s ."))) +;; #+END_SRC + + +;; *** smex + +;; Smex is my favourite way to use =M-x=. Counsel’s =counsel-M-x= +;; function uses it internally, so I’m keeping it around, even though I +;; 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")))) +;; #+END_SRC + +;; *** cmd-to-echo + +;; I’ve been looking for some way to run programming projects (mostly +;; node.js) inside emacs. =cmd-to-echo= seems great for this, as new +;; output pops up in the echo area. + +;; #+BEGIN_SRC emacs-lisp +(use-package cmd-to-echo + :commands (cmd-to-echo) + :config (setq cmd-to-echo-add-output-to-process-buffers t)) +;; #+END_SRC +;; ** Modes + +;; Setup some modes for systemd files +;; #+BEGIN_SRC emacs-lisp +(add-to-list 'auto-mode-alist '("\\.service\\'" . conf-mode)) +(add-to-list 'auto-mode-alist '("\\.target\\'" . conf-mode)) +(add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-mode)) +;; #+END_SRC + +;; =direnv=’s files are basically shell scripts, it’s a nice way to +;; set environment variables for projects. +;; #+BEGIN_SRC emacs-lisp +(add-to-list 'auto-mode-alist '("\\.envrc\\'" . sh-mode)) +;; #+END_SRC + +;; Some modes that I don’t really customise much, mostly for +;; configuration files. +;; #+BEGIN_SRC emacs-lisp +(use-package haskell-mode + :mode (("\\.hs\\'" . haskell-mode))) + +(use-package dockerfile-mode + :mode (("Dockerfile\\'" . dockerfile-mode))) + +(use-package nix-mode + :mode (("\\.nix\\'" . nix-mode))) + +(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))) + +(use-package lua-mode + :defer t) + +(use-package ruby-mode + :mode (("\\.rb\\'" . ruby-mode) + ("\\.cap\\'" . ruby-mode))) + +(use-package go-mode + :mode (("\\.go\\'" . go-mode))) + +(use-package jinja2-mode + :mode (("\\.j2\\'" . jinja2-mode) + ("\\.jinja\\'" . jinja2-mode))) + +(use-package scss-mode + :defer t + :config (progn + (setq scss-compile-at-save nil))) + +(use-package toml-mode + :mode ("\\.toml\\'" . toml-mode)) + +(use-package 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)) + +(define-derived-mode saltstack-mode yaml-mode "Salt") +(add-to-list 'auto-mode-alist '("\\.sls\\'" . saltstack-mode)) +;; #+END_SRC + +;; *** ledger + +;; I use [[http://ledger-cli.org/][=ledger=]] to manage my finances. It has an Emacs mode, which +;; works really nicely. + +;; #+BEGIN_SRC emacs-lisp +(use-package ledger-mode + :mode ("\\.ledger\\'" . ledger-mode) + :init (progn + (defun open-budget () + (interactive) + (projectile-switch-project-by-name "~/Sync/Default") + (find-file (expand-file-name "ledger/my.ledger" (projectile-project-root))) + (ledger-report "Budget (Cumulative)" nil))) + :config (progn + (setq ledger-use-iso-dates t + ledger-post-use-completion-engine :ido + ledger-reconcile-default-commodity "€" + ledger-clear-whole-transactions t + ledger-narrow-on-reconcile t + ledger-reports `(("Monthly Expenses" "ledger -f %(ledger-file) reg -M \\^Flex --real -X EUR -l \"payee != 'Opening Balances'\"") + ("Average Monthly Expenses (Past 12 Months)" ,(concat "ledger -f %(ledger-file) -b " + (format-time-string "%Y-%m" (time-add (current-time) (days-to-time -365))) + " --monthly --average balance ^Flex")) + ("Expenses:This Month" "ledger -f %(ledger-file) bal \\^Flex -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 \\^Assets:Budget$") + ("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 + +;; #+BEGIN_SRC emacs-lisp +(use-package markdown-mode + :defer t + :config (progn + (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) +;; #+END_SRC + +;; *** Lentic + +;; Multiple different views of the same file. Can be used for a kind of +;; inverse literate programming. + +;; #+BEGIN_SRC emacs-lisp +(use-package lentic + :config (global-lentic-mode)) +;; #+END_SRC + +;; *** Org + +;; 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")) + + org-default-notes-file (concat org-directory "/notes") + + ;; ‘Remember’: new items at top + org-reverse-note-order t + + org-modules '(org-protocol) + + ;; Add time done to ‘done’ tasks + org-log-done 'time + + org-list-allow-alphabetical t + + org-adapt-indentation nil + + org-pretty-entities t + + org-table-duration-custom-format 'seconds + + org-src-fontify-natively nil + + org-export-have-math t + + org-blank-before-new-entry '((heading . t) + (plain-list-item . auto)) + org-fontify-done-headline t + + org-goto-interface 'outline-path-completion + + org-outline-path-complete-in-steps nil + + 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))) + +(use-package org-src + :ensure nil + :after org + :config (progn + (bind-key "C-x C-s" #'org-edit-src-exit org-src-mode-map))) +;; #+END_SRC + +;; ***** org-babel + +;; Org’s babel feature is really nice. I use it for this file, and I can +;; use it to communicate between programming languages. Sometime I hope +;; to have my =ledger= setup in an org file with some graph processing +;; with R or something. + +;; #+BEGIN_SRC emacs-lisp +(use-package ob-core + :defer t + :ensure nil + :config (progn + (org-babel-do-load-languages 'org-babel-load-languages + '((ledger . t) + (sh . t))) + (setq org-src-tab-acts-natively t + org-edit-src-content-indentation 0 + org-src-preserve-indentation t))) +;; #+END_SRC + +;; ***** org-journal + +;; 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" + org-journal-dir "~/Sync/Default/Documents/journal") + + (define-hook-helper org-journal-mode () + (use-variable-fonts) + (text-scale-adjust 4) + (if smartparens-strict-mode + (smartparens-strict-mode -1)) + (if show-smartparens-mode + (show-smartparens-mode -1))) + (defun org-journal-display-entry-yesterday () + "Show org-journal entry for yesterday" + (interactive) + (org-journal-read-or-display-entry (yesterday-time))))) +;; #+END_SRC + + +;; ** Programming +;; *** flycheck + +;; 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 mode-enabled)) + (setq flycheck-indication-mode 'left-fringe) + (with-eval-after-load 'git-gutter-fringe + (fringe-helper-define 'flycheck-fringe-bitmap-double-arrow '(center repeated) + ".XXX....")) + (if (executable-find "eslint_d") + (setq flycheck-javascript-eslint-executable "eslint_d")))) +;; #+END_SRC + +;; **** flycheck-pos-tip + +;; Show flycheck errors in a little popup, so I don't lose my place + +;; #+BEGIN_SRC emacs-lisp +(use-package flycheck-pos-tip + :after flycheck + :config (progn + (setq flycheck-display-errors-delay 0.5) + (flycheck-pos-tip-mode 1))) +;; #+END_SRC + +;; **** flycheck-flow + +;; #+BEGIN_SRC emacs-lisp +(use-package flycheck-flow + :after js2-mode + :if (executable-find "flow") + :config (progn + (flycheck-add-next-checker 'javascript-eslint 'javascript-flow))) +;; #+END_SRC + +;; *** golang + +;; 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 + (define-hook-helper go-mode () + (set (make-local-variable 'company-backends) + '(company-go))))) + +(use-package go-eldoc + :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))) + + +;; #+END_SRC + +;; *** ggtags + +;; A nice completion backend for programming modes. + +;; #+BEGIN_SRC emacs-lisp +(use-package ggtags + :if (executable-find "gtags") + :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 + +;; *** dumb-jump + +;; A "clever" way of implementing go-to-definition across languages: use +;; a project-wide text search and apply heuristics to the results to +;; guess a definition. + +;; #+BEGIN_SRC emacs-lisp +(use-package dumb-jump + :bind (("M-g o" . dumb-jump-go-other-window) + ("M-g j" . dumb-jump-go) + ("M-g x" . dumb-jump-go-prefer-external) + ("M-g z" . dumb-jump-go-prefer-external-other-window)) + :config (setq dumb-jump-selector 'ivy)) +;; #+END_SRC + +;; *** imenu-anywhere + +;; This is like imenu, but shows functions (or similar top-level +;; entities) across buffers in the same project. Neat! + +;; #+BEGIN_SRC emacs-lisp +(use-package imenu-anywhere + :bind ("C-x C-." . ivy-imenu-anywhere)) +;; #+END_SRC +;; *** Lisps + +;; **** All + +;; Lisp modes don’t seem to have a common ancestor. So I made a custom +;; hook which I trigger in every lispy-mode. + +;; #+BEGIN_SRC emacs-lisp +(defcustom lisp-mode-common-hook nil + "Hook run when entering any Lisp mode." + :type 'hook + :group 'lisp) + +(create-hook-helper lisp-mode-setup () + :hooks (emacs-lisp-mode-hook + scheme-mode-hook + lisp-mode-hook + clojure-mode-hook) + (run-hooks 'lisp-mode-common-hook)) +;; #+END_SRC + +;; ***** Redshank + +;; Lisp syntax allows for really easy refactoring. Redshank gives some +;; 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))) +;; #+END_SRC + +;; **** Emacs Lisp + +;; Customise the modeline-display of =emacs-lisp-mode=. Then make sure +;; it runs the common lisp hooks. + +;; #+BEGIN_SRC emacs-lisp +(add-hook 'emacs-lisp-mode-hook #'eldoc-mode) +;; #+END_SRC + +;; 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))) +;; #+END_SRC + +;; Interactive elisp + +;; #+BEGIN_SRC emacs-lisp +(use-package ielm + :defer t + :ensure nil + :config (progn + (define-hook-helper ielm-mode () + (run-hooks 'lisp-mode-common-hook)))) +;; #+END_SRC + +;; **** Scheme & Lisp + +;; I don’t work with these as often as I would like + +;; #+BEGIN_SRC emacs-lisp +(define-hook-helper lisp-mode () + (set (make-local-variable 'lisp-indent-function) + #'common-lisp-indent-function)) +;; #+END_SRC + +;; ***** geiser + +;; A REPL thing for Scheme. Hopefully I’ll get to use it more in the +;; future. + +;; #+BEGIN_SRC emacs-lisp +(use-package geiser + :commands (geiser-mode + geiser + run-geiser + run-racket)) +;; #+END_SRC + +;; ***** slime + +;; A REPL thing (and more) for Lisp. + +;; #+BEGIN_SRC emacs-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 '(slime-fancy slime-asdf))) + (setq common-lisp-hyperspec-root "file://opt/local/share/doc/lisp/HyperSpec-7-0/" + inferior-lisp-program (or (executable-find "sbcl") + (executable-find "ccl64"))))) +;; #+END_SRC + +;; **** Clojure + +;; #+BEGIN_SRC emacs-lisp +(use-package clojure-mode + :defer t + :init (progn + (define-hook-helper cider-repl-mode () + (highlight-changes-mode -1)))) + +(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 + (define-hook-helper clojure-mode () + (clj-refactor-mode 1)))) +;; #+END_SRC + +;; ***** cider + +;; A REPL thing for Clojure + +;; #+BEGIN_SRC emacs-lisp +(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))) +;; #+END_SRC + +;; *** Auto-compile + +;; Auto-compile emacs lisp when saving. +;; #+BEGIN_SRC emacs-lisp +(use-package auto-compile + :defer t + :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) +;; #+END_SRC + +;; *** cc-mode + +;; Although I don’t use C or C++, setting up the mode is helpful because +;; quite a few other modes are derived from it. + +;; #+BEGIN_SRC emacs-lisp +(use-package cc-mode + :defer 5 + :config (progn + (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 + +;; It’s nice to be able to quickly evaluate some code. Although I don’t +;; really seem to use it. +;; #+BEGIN_SRC emacs-lisp +(use-package quickrun + :bind (("C-c C-e" . quickrun))) +;; #+END_SRC + +;; *** Scala + +;; Let’s try using Scala. + +;; #+BEGIN_SRC emacs-lisp +(use-package scala-mode) +;; #+END_SRC + +;; And add ensime, an IDE-style environment. + +;; #+BEGIN_SRC emacs-lisp +(use-package ensime) +;; #+END_SRC + +;; *** Web development + +;; **** js2-mode + +;; This mode is really great for editing Javascript. It turns code into +;; an AST internally, so it can work with it almost like a lisp. + +;; #+BEGIN_SRC emacs-lisp +(use-package js2-mode + :mode (("\\.js\\'" . js2-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))) + (add-hook 'js2-mode-hook #'js2-imenu-extras-mode) + (advice-add 'imenu-add-to-menubar :around #'js2--imenu-around) + (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) + (setq js2-basic-offset 2 + js-switch-indent-offset 2 + js2-include-node-externs t + js2-highlight-level 1 + js2-strict-missing-semi-warning nil))) +;; #+END_SRC + +;; ***** rjsx-mode + +;; A set of advice for js2-jsx-mode to work better with React. + +;; #+BEGIN_SRC emacs-lisp +(use-package rjsx-mode + :after js2-mode + :if (fboundp #'js2--struct-put) + :mode (("\\.jsx\\'" . rjsx-mode))) +;; #+END_SRC + +;; ***** js2-refactor + +;; Thanks to the AST provided by js2-mode, refactoring is possible. This +;; library implements some refactorings. + +;; #+BEGIN_SRC emacs-lisp +(use-package js2-refactor + :after js2-mode + :config (progn + (bind-key "C-k" #'js2r-kill js2-mode-map) + (add-hook 'js2-mode-hook #'js2-refactor-mode) + (js2r-add-keybindings-with-prefix "C-c C-m"))) +;; #+END_SRC + +;; ***** add-node-modules-path + +;; Inside a javascript project, it's common to install tools locally to +;; the project. This will allows emacs to find their executables. + +;; #+BEGIN_SRC emacs-lisp +(use-package add-node-modules-path + :config (progn + (add-hook 'js2-mode-hook #'add-node-modules-path))) +;; #+END_SRC + +;; ***** Flow + +;; #+BEGIN_SRC emacs-lisp +(use-package flow-minor-mode + :after js2-mode + :config (progn + (add-hook 'js2-mode-hook #'flow-minor-enable-automatically))) +;; #+END_SRC + +;; ***** Indium + +;; Javascript with an inferior node.js process and a debugger? Awesome. + +;; To debug with node, use version 6.9.1 or later of node and run it with +;; ~--inspect~ and, to break on the first line, ~--debug-brk~. + +;; For Chrom*, it needs to be launched with +;; ~--remote-debugging-port=9222~ + +;; Node will tell you to open an URL in Chrome: + +;; ~chrome-devtools://inspector.html?...&ws=127.0.0.1:PORT/PATH~ + +;; Instead, do this: + +;; ~M-x indium-connect-to-nodejs RET 127.0.0.1 RET PORT RET~ + +;; #+BEGIN_SRC emacs-lisp +(use-package indium + :diminish (indium-interaction-mode . "In") + :config (progn + (add-hook 'js2-mode-hook #'indium-interaction-mode))) +;; #+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))) +;; #+END_SRC + +;; **** tern + +;; Tern understands javascript. It adds really clever documented +;; completions, besides other IDE-like things. + +;; #+BEGIN_SRC emacs-lisp +(use-package tern + :diminish tern-mode + :if (executable-find "tern") + :defer 5 + :config (progn + (setq tern-command (list (executable-find "tern"))) + (create-hook-helper tern-mode-on () + :hooks (web-mode-hook + js2-mode-hook) + (tern-mode +1)))) + +(with-eval-after-load '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))) +;; #+END_SRC + +;; **** restclient + +;; Restclient is really nice. It’s like a scratchpad for HTTP api +;; calls. Feels a bit like using =org-babel=. I wonder if there’s an +;; 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))) + +(use-package company-restclient + :after (company restclient) + :init (add-to-list 'company-backends #'company-restclient t)) +;; #+END_SRC + +;; **** sgml-mode + +;; This is for HTML, since old versions of HTML were derived from SGML. +;; #+BEGIN_SRC emacs-lisp +(use-package sgml-mode + :defer t + :config (setq sgml-basic-offset 2)) +;; #+END_SRC + +;; **** emmet-mode + +;; Emmet is really nice to write HTML quickly. Especially with +;; frameworks that require multiple nested elements to do anything useful. +;; #+BEGIN_SRC emacs-lisp +(use-package emmet-mode + :commands (emmet-mode) + :diminish (emmet-mode . " >") + :init (progn + (setq emmet-indentation 2 + emmet-self-closing-tag-style " /") + (add-hook 'sgml-mode-hook #'emmet-mode) + (add-hook 'web-mode-hook #'emmet-mode) + (add-hook 'css-mode-hook #'emmet-mode))) +;; #+END_SRC + +;; **** web-mode + +;; This mode handles just about every templating language out ther, which +;; is really nice, because it handles the HTML part the same way in all +;; of them as well. + +;; #+BEGIN_SRC emacs-lisp +(use-package web-mode + :mode (("/views/.*\\.php\\'" . web-mode) + ("\\.html\\'" . web-mode) + ("/templates/.*\\.php\\'" . web-mode) + ("\\.ejs\\'" . web-mode) + ("\\.njk\\'" . web-mode)) + :config (progn + (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 + 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=. + +;; #+BEGIN_SRC emacs-lisp +(define-derived-mode twig-mode web-mode "Twig") +(add-to-list 'auto-mode-alist '("\\.html\\.twig\\'" . twig-mode)) +;; #+END_SRC + +;; *** Live coding + +;; Sometimes I might want to show off my emacs usage. + +;; #+BEGIN_SRC emacs-lisp +(defun live-coding () + (interactive) + (ap/set-fonts "SF Mono" 18 nil nil t 0.1) + (global-command-log-mode 1)) + +(defun live-coding-stop () + (interactive) + (ap/set-fonts-according-to-system) + (global-command-log-mode -1)) +;; #+END_SRC + +;; **** command-log-mode + +;; #+BEGIN_SRC emacs-lisp +(use-package command-log-mode + :defines command-log-mode-key-binding-open-log + :init (progn + (setq command-log-mode-key-binding-open-log nil + command-log-mode-auto-show t + command-log-mode-is-global t))) +;; #+END_SRC + +;; ** Spelling + +;; #+BEGIN_SRC emacs-lisp +(use-package ispell + :bind (("" . ispell-word)) + :config (progn + (cond + ((executable-find "aspell") (setq ispell-program-name "aspell" + ispell-dictionary "british" + ispell-really-aspell t + ispell-really-hunspell nil)) + ((executable-find "hunspell") (setq ispell-program-name "hunspell" + ispell-really-aspell nil + ispell-really-hunspell t))))) +;; #+END_SRC + +;; #+BEGIN_SRC emacs-lisp +(use-package flyspell + :diminish "﹏" + :config (progn + (defun flyspell-detect-ispell-args (&optional run-together) + "If RUN-TOGETHER is true, spell check the CamelCase words. + Please note RUN-TOGETHER will make aspell less capable. So it should only be used in prog-mode-hook." + (let (args) + (when ispell-program-name + (cond + ((string-match "aspell$" ispell-program-name) + (setq args (list "--sug-mode=ultra")) + (if run-together + (setq args (append args '("--run-together" "--run-together-limit=16" "--run-together-min=2"))))) + ((string-match "hunspell$" ispell-program-name) + (setq args nil)))) + args)) + ;; `ispell-extra-args' is *always* used when start CLI aspell process + (setq-default ispell-extra-args (flyspell-detect-ispell-args t)) + ;; (setq ispell-cmd-args (flyspell-detect-ispell-args)) + (defadvice ispell-word (around my-ispell-word activate) + (let ((old-ispell-extra-args ispell-extra-args)) + (ispell-kill-ispell t) + ;; use emacs original arguments + (setq ispell-extra-args (flyspell-detect-ispell-args)) + ad-do-it + ;; restore our own ispell arguments + (setq ispell-extra-args old-ispell-extra-args) + (ispell-kill-ispell t))) + + (defadvice flyspell-auto-correct-word (around my-flyspell-auto-correct-word activate) + (let* ((old-ispell-extra-args ispell-extra-args)) + (ispell-kill-ispell t) + ;; use emacs original arguments + (setq ispell-extra-args (flyspell-detect-ispell-args)) + ad-do-it + ;; restore our own ispell arguments + (setq ispell-extra-args old-ispell-extra-args) + (ispell-kill-ispell t))) + (setq flyspell-issue-message-flag nil) + + (defun fly-text-mode-hook-setup () + ;; Turn off RUN-TOGETHER option when spell check text-mode + (setq-local ispell-extra-args (flyspell-detect-ispell-args))) + (add-hook 'text-mode-hook 'fly-text-mode-hook-setup) + (add-hook 'prog-mode-hook #'flyspell-prog-mode))) +;; #+END_SRC + +;; *** Style checking + +;; [[https://github.com/ValeLint/vale][Vale]] is a linter, but for prose. Neat idea! Salesman is a bad term. + +;; #+BEGIN_SRC emacs-lisp +(use-package flycheck-vale + :if (executable-find "vale") + :config (progn + (add-to-list 'flycheck-vale-modes 'org-mode) + (add-to-list 'flycheck-vale-modes 'org-journal-mode) + (flycheck-vale-setup))) +;; #+END_SRC + +;; ** Scripting + +;; 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) + +(use-package sh-script + :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)) +;; #+END_SRC + +;; #+BEGIN_SRC emacs-lisp +(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) +;; #+END_SRC + +;; *** eshell + +;; I should try to get into the habit of using this more. It’s really +;; nice, when I remember to use it. + +;; #+BEGIN_SRC emacs-lisp +(use-package eshell + :bind ("C-c s" . eshell) + :defer 10 + :functions (eshell/pwd) + :config (progn + (setq eshell-directory-name "~/.emacs.d/eshell" + eshell-prompt-function (lambda () + (concat + (eshell/pwd) + "\n$ "))) + (define-hook-helper eshell-load () + (bind-key "C-c C-l" #'counsel-esh-history eshell-mode-map)))) + +(use-package em-smart + :ensure nil + :commands eshell-smart-initialize + :init (progn + (add-hook 'eshell-load-hook #'eshell-smart-initialize)) + :config (progn + (setq eshell-where-to-jump 'begin + eshell-review-quick-commands nil + eshell-smart-space-goes-to-end t))) + +(autoload #'eshell/cd "em-dirs") +(defun eshell-goto-current-dir (&optional arg) + (interactive "P") + (let ((dir default-directory)) + (eshell arg) + (eshell/cd dir))) +(bind-key "C-c S" #'eshell-goto-current-dir) + + +;; #+END_SRC + +;; **** Shells + +;; #+BEGIN_SRC emacs-lisp +(use-package shell + :defer t + :ensure nil + :config (define-key shell-mode-map + (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) + +(use-package comint + :defer t + :ensure nil + :config (bind-key "C-c C-l" #'counsel-shell-history comint-mode-map)) + +(defun comint-delchar-or-eof-or-kill-buffer (arg) + (interactive "p") + (if (null (get-buffer-process (current-buffer))) + (kill-buffer) + (comint-delchar-or-maybe-eof arg))) +;; #+END_SRC + +;; ** Text editing + +;; Emacs has an editor within. + +;; #+BEGIN_SRC emacs-lisp +(put 'upcase-region 'disabled nil) +(put 'downcase-region 'disabled nil) +(setq sentence-end-double-space t + line-move-visual nil) +(setq-default truncate-lines t) +;; #+END_SRC + +;; *** align + +;; =Align= is a useful command to line things up, once given some rules. +;; 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)))))) +;; #+END_SRC + +;; *** Clipboard + +;; I like to use the clipboard more than the primary selection in X11. + +;; #+BEGIN_SRC emacs-lisp +(setq select-enable-clipboard t + save-interprogram-paste-before-kill t) +(if (functionp '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 + +;; *** Selection + +;; I’m quite used to deleting text by selecting it and typing. Emacs has +;; a mode for that. + +;; #+BEGIN_SRC emacs-lisp +(use-package delsel + :config (delete-selection-mode t)) +;; #+END_SRC + +;; 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)) +;; #+END_SRC + +;; I find that =zap-up-to-char= normally makes more sense to me than +;; =zap-to-char=. + +;; #+BEGIN_SRC emacs-lisp +(use-package misc + :ensure nil + :bind (("M-z" . zap-up-to-char) + ("M-Z" . zap-to-char))) +;; #+END_SRC + +;; Expanding the region by semantic units was something I quite liked +;; 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)) +;; #+END_SRC + +;; *** avy + +;; Avy is a really nice way to move around files, like ace-jump-mode, but +;; somehow I prefer it. + +;; #+BEGIN_SRC emacs-lisp +(use-package avy + :defer 5 + :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 ?\;)))) +;; #+END_SRC + +;; **** ace-link + +;; Visit any link. Despite the name, this works with avy. + +;; #+BEGIN_SRC emacs-lisp +(use-package ace-link + :after avy + :config (progn + (ace-link-setup-default) + (with-eval-after-load "gnus" + (bind-key "M-o" #'ace-link-gnus gnus-summary-mode-map) + (bind-key "M-o" #'ace-link-gnus gnus-article-mode-map)))) +;; #+END_SRC + +;; *** goto-chg + +;; This is like popping the mark, only it filters to only change areas +;; and doesn’t go back to the same place more than once. + +;; #+BEGIN_SRC emacs-lisp +(use-package goto-chg + :bind ("C-c C-SPC" . goto-last-change)) +;; #+END_SRC + +;; *** beginend + +;; In special buffers, I would rather have =M->= and =M-<= goto the +;; logical beginning/end rather than the physical ones. + +;; #+BEGIN_SRC emacs-lisp +(use-package beginend + :config (progn + (beginend-setup-all))) +;; #+END_SRC + +;; *** multiple-cursors + +;; I mentioned before that I’d used Sublime Text before. Multiple +;; cursors was one of my favourite features, so I was really happy when I +;; saw that multiple-cursors was released for Emacs. + +;; #+BEGIN_SRC emacs-lisp +(use-package multiple-cursors + :defer 1 + :bind* (("C-." . mc/mark-next-like-this) + ("C-," . mc/mark-previous-like-this) + ("M-" . mc/mark-all-like-this-dwim) + ("C-" . mc/mark-more-like-this-extended) + ("C-S-L" . mc/edit-lines))) +;; #+END_SRC + +;; *** paredit + +;; Balanced parentheses in lisps are nice, but all the refactoring and +;; 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))) +;; #+END_SRC + +;; *** smartparens + +;; I like to use smartparens where paredit isn’t already useful. Somehow +;; I didn’t find smartparens’ implementation of paredit style to be as +;; 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-" #'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-" #'sp-splice-sexp-killing-backward smartparens-mode-map) + (bind-key "M-" #'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-" #'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 + +;; Transposing lines, made easier. + +;; #+BEGIN_SRC emacs-lisp +(use-package move-text + :config (move-text-default-bindings)) +;; #+END_SRC + +;; *** undo-tree + +;; Emacs’ default handling of undo is a bit confusing. Undo-tree makes +;; 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))) + :diminish undo-tree-mode) +;; #+END_SRC + +;; *** replace + +;; #+BEGIN_SRC emacs-lisp +(with-eval-after-load "replace.el" + (setq case-replace nil)) +;; #+END_SRC + +;; *** visual-regexp + +;; I don’t always remember exactly how Emacs’ regular expressions work, +;; so this package is pretty useful because it highlights everything in +;; 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))) +;; #+END_SRC + +;; ** End + +;; Start a server if possible. A daemon is already a server. +;; #+BEGIN_SRC emacs-lisp +(use-package server + :defer 2 + :if (not (daemonp)) + :config (unless (server-running-p server-name) + (server-start))) +(setq gc-cons-threshold 800000 + file-name-handler-alist file-name-handler-alist-backup) +;; #+END_SRC + +;; Local Variables: +;; lentic-init: lentic-orgel-org-init +;; End: diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index d15dcd65..d428bd89 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1,12 +1,14 @@ +# # emacs-config --- Summary #+TITLE: Emacs Configuration for Alan Pearce #+OPTIONS: ^:nil #+PROPERTY: results silent #+PROPERTY: eval no-export #+PROPERTY: header-args :comments link -* Introduction +* Header This is a living document, detailing my Emacs configuration using org-mode -* Basics -** Startup +* Code +** Basics +*** Startup Open Emacs with just a plain window. No graphics or messages, please! #+BEGIN_SRC emacs-lisp (put 'inhibit-startup-echo-area-message 'saved-value @@ -29,7 +31,7 @@ Are we running on Windows via the WSL? (setq system-type 'gnu/linux/windows)))) #+END_SRC -** Compatibility +*** Compatibility #+BEGIN_SRC emacs-lisp (if (version< emacs-version "25.0") @@ -37,7 +39,7 @@ Are we running on Windows via the WSL? `(eval-after-load ,file (lambda () ,@body)))) #+END_SRC -** Scratch buffers +*** Scratch buffers I usually use scratch buffers for any sort of text. If I need a programming mode in one, then I’ll just call it manually. I also like the buffer to be empty. @@ -46,15 +48,15 @@ the buffer to be empty. initial-major-mode 'text-mode) #+END_SRC -** Personal Information +*** Personal Information #+BEGIN_SRC emacs-lisp (setq user-mail-address "alan@alanpearce.eu" user-full-name "Alan Pearce") #+end_src -* Packaging +** Packaging -** Use-package +*** Use-package #+BEGIN_SRC emacs-lisp (eval-and-compile @@ -100,9 +102,9 @@ the buffer to be empty. package-enable-at-startup nil) #+END_SRC -** Helpers +*** Helpers -*** Hook Helpers +**** Hook Helpers An improvement over add-hook with lamda functions that allows modification and removal, without the boilerplate of an extra function @@ -113,7 +115,7 @@ definition. (use-package hook-helpers)) #+END_SRC -* Customize +** Customize I don’t really like using customize for normal configuration. Instead, I use it for things that get saved automatically. That’s why I use a different file, which is ignored by the VCS. It also means @@ -125,7 +127,7 @@ pass =:noerror= to =load= (load custom-file :noerror :nomessage) #+END_SRC -* Styles +** Styles I prefer an always-visible cursor. Feels less distracting. #+BEGIN_SRC emacs-lisp @@ -155,7 +157,7 @@ Ring the bell sometimes, but not so often (ding)))) #+END_SRC -** Colours +*** Colours Eziam looks nice, too, except for the non-white background. I prefer white because most other application backgrounds are that colour. @@ -212,7 +214,7 @@ can enable it if needed. :diminish highlight-stages-mode) #+END_SRC -** Fonts +*** Fonts 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]]. @@ -277,7 +279,7 @@ it has it's own, more extensive version. (global-prettify-symbols-mode +1)) #+END_SRC -** Page Breaks +*** Page Breaks By default, Emacs displays page breaks as ^L. Lines look much nicer. On Windows, Emacs incorrectly detects that U+2500 (Box Drawings Light @@ -295,7 +297,7 @@ correct, at least for Liberation Mono. (cons page-break-lines-char page-break-lines-char) (face-attribute 'default :family))))) #+END_SRC -** Modeline +*** Modeline #+BEGIN_SRC emacs-lisp (column-number-mode -1) @@ -325,7 +327,7 @@ correct, at least for Liberation Mono. '(dired-directory (" — " dired-directory)))) #+END_SRC -** Chrome +*** Chrome Sometimes I like to hide clutter. Other times, it's useful. @@ -383,7 +385,7 @@ Sometimes I like to hide clutter. Other times, it's useful. (add-hook 'minibuffer-exit-hook #'hide-mode-line) #+END_SRC -** Highlight Changes +*** Highlight Changes Highlight what just changed when I undo, yank, and so on. @@ -394,7 +396,7 @@ Highlight what just changed when I undo, yank, and so on. (volatile-highlights-mode t))) #+END_SRC -** Beacon +*** Beacon I was against the idea of having flashy animations inside Emacs, but this one is useful. It highlights the cursor when scrolling or @@ -411,7 +413,7 @@ switching windows. beacon-color "#a1b56c"))) #+END_SRC -** Renaming major modes +*** Renaming major modes Diminishing major modes does not happen in the same manner as minor modes. @@ -436,7 +438,7 @@ modes. #+END_SRC -* Environment Variables +** Environment Variables MacOS doesn’t have a reasonable way to set environment variables and read them automatically any more. So, let’s use the @@ -457,7 +459,7 @@ It starts up without an environment in this case as well. (exec-path-from-shell-initialize))) #+END_SRC -** NixOS sandboxes +*** NixOS sandboxes I'm currently exploring using nix to create sandboxes for development. This package allows using tools from inside sandboxes, @@ -479,7 +481,7 @@ and some convenience commands for building packages and launching shells. (executable-find cmd))))))) #+END_SRC -* Keybindings +** Keybindings I think =set-keyboard-coding-system= stops OS X from doing something annoying to add accents. The modifier setup is to match my @@ -533,7 +535,7 @@ Option/alt, then Control. (set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) #+END_SRC -** Crux +*** Crux I can replace most of the simple helper/wrapper functions in my configuration with crux.el @@ -554,7 +556,7 @@ configuration with crux.el (defalias 'rename-current-buffer-file #'crux-rename-file-and-buffer))) #+END_SRC -* Projects +** Projects #+BEGIN_SRC emacs-lisp (defun switch-to-dotfiles () @@ -562,7 +564,7 @@ configuration with crux.el (projectile-switch-project-by-name (car (split-string (shell-command-to-string "ghq list --full-path dotfiles"))))) #+END_SRC -** The Silver Searcher +*** The Silver Searcher #+BEGIN_SRC emacs-lisp (use-package ag @@ -573,7 +575,7 @@ configuration with crux.el :after ag) #+END_SRC -** Ripgrep +*** Ripgrep Step over Silver Search, here comes a new challenger. @@ -587,7 +589,7 @@ Step over Silver Search, here comes a new challenger. :bind (("C-c p s r" . projectile-ripgrep))) #+END_SRC -** Projectile +*** Projectile Projectile is awesome for working in projects, especially VCS-backed ones. @@ -657,7 +659,7 @@ ones. (define-key projectile-mode-map [remap counsel-projectile-ag] #'counsel-projectile-rg))) #+END_SRC -** vc +*** vc This is nice for some things that magit doesn’t do, and for those rare occasions that I’m working with something other than git. @@ -673,7 +675,7 @@ occasions that I’m working with something other than git. tramp-file-name-regexp)))) #+END_SRC -** git-gutter-fringe +*** git-gutter-fringe It’s nice to be able to see at a glance which lines of a file have changed. This package colours the fringe. I have it set to the right @@ -701,7 +703,7 @@ fringe so it doesn’t interfere with flycheck. (setq git-gutter-fr:side 'right-fringe))) #+END_SRC -** magit +*** magit Magit is my favourite way to use git. I use selective staging all the time. Make sure to set it up with a nice =completing-read-function= @@ -718,7 +720,7 @@ time. Make sure to set it up with a nice =completing-read-function= :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) #+END_SRC -** git-messenger +*** git-messenger Popup the last commit that changed the line at point. @@ -729,7 +731,7 @@ Popup the last commit that changed the line at point. (setq git-messenger:use-magit-popup t))) #+END_SRC -** git-timemachine +*** git-timemachine This package allow me to go through a file’s history with just a few keys. It makes it very easy to figure what what exactly was in a file @@ -741,7 +743,7 @@ a particular way, but it changed later. :commands git-timemachine) #+END_SRC -** ghq +*** ghq [[https://github.com/motemen/ghq][=ghq=]] clones VCS-backed projects to a common directory. It should seem familiar to anyone who's used =go get= before. [[https://github.com/rcoedo/emacs-ghq][=emacs-ghq=]] is a @@ -752,9 +754,9 @@ simple wrapper for it. :if (executable-find "ghq")) #+END_SRC -* Files +** Files -** Auto-saving +*** Auto-saving Auto-save everything to a temporary directory, instead of cluttering the filesystem. I don’t want emacs-specific lockfiles, either. @@ -763,7 +765,7 @@ the filesystem. I don’t want emacs-specific lockfiles, either. (setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t)) create-lockfiles nil) #+END_SRC -** Backups +*** Backups I like to keep my backups out of regular folders. I tell emacs to use a subfolder of its configuration directory for that. Also, use the @@ -784,7 +786,7 @@ trash for deleting on OS X. file)))) #+END_SRC -** autorevert +*** autorevert #+BEGIN_SRC emacs-lisp (use-package autorevert @@ -795,7 +797,7 @@ trash for deleting on OS X. auto-revert-use-notify (not (eq system-type 'darwin))))) #+END_SRC -** Encoding +*** Encoding UTF-8 is usually appropriate. Note that =prefer-coding-system= expects only a coding system, not a coding system and line ending combination. @@ -805,7 +807,7 @@ only a coding system, not a coding system and line ending combination. (setq-default buffer-file-coding-system 'utf-8-auto-unix) #+END_SRC -** Buffer-file management +*** Buffer-file management Ask if I want to create a directory when it doesn’t exist. This is especially nice when starting new projects. @@ -836,7 +838,7 @@ with a buffer. (kill-buffer buf))))) #+END_SRC -** Whitespace +*** Whitespace Show bad whitespace, so that I can fix it. @@ -851,7 +853,7 @@ Show bad whitespace, so that I can fix it. (add-hook 'text-mode-hook #'show-trailing-whitespace-on) #+END_SRC -** shrink-whitespace +*** shrink-whitespace DWIM whitespace removal. So I don’t need =M-SPC=, =M-\= and =C-x o= for similar things any more. @@ -861,7 +863,7 @@ for similar things any more. :bind ("M-SPC" . shrink-whitespace)) #+END_SRC -** Tramp +*** Tramp Tramp is awesome. It makes SSH feel Unix-y. The proxy setup is so that I can sudo on remote machines @@ -888,7 +890,7 @@ that I can sudo on remote machines (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil)))) #+END_SRC -** ediff +*** ediff I like a horizonal diff setup, with everything in one frame. @@ -900,7 +902,7 @@ I like a horizonal diff setup, with everything in one frame. ediff-window-setup-function 'ediff-setup-windows-plain))) #+END_SRC -* Indentation +** Indentation Ah, a complicated topic. One day we’ll all be using elastic tabstops. I’ve recently switched to using two spaces, since elastic @@ -913,7 +915,7 @@ tabstops is probably never going to happen. #+END_SRC -** smart-tabs-mode +*** smart-tabs-mode Not related to [[smart-tab][=smart-tab=]], this mode indents with tabs and aligns with spaces. Perfect! @@ -927,7 +929,7 @@ with spaces. Perfect! (smart-tabs-mode indent-tabs-mode)))) #+END_SRC -** editorconfig +*** editorconfig #+BEGIN_SRC emacs-lisp (use-package editorconfig @@ -935,7 +937,7 @@ with spaces. Perfect! :config (editorconfig-mode 1)) #+END_SRC -** dtrt-indent-mode +*** dtrt-indent-mode Sometimes people use different indentation settings. [[https://github.com/jscheid/dtrt-indent][dtrt-indent]] guesses the correct settings for me. @@ -951,9 +953,9 @@ guesses the correct settings for me. (smart-tabs-mode (or indent-tabs-mode -1))))) #+END_SRC -* Security +** Security -** password-store +*** password-store This is a frontend to the GPG-powered =pass= program. #+BEGIN_SRC emacs-lisp @@ -962,9 +964,9 @@ This is a frontend to the GPG-powered =pass= program. :config (progn (setq password-store-password-length 16))) #+END_SRC -* Buffers +** Buffers -** Ibuffer +*** Ibuffer Ibuffer is quite nice for listing all buffers. #+BEGIN_SRC emacs-lisp @@ -1000,7 +1002,7 @@ Ibuffer is quite nice for listing all buffers. filename-and-process))))) #+END_SRC -** Relative Buffer names +*** Relative Buffer names #+BEGIN_SRC emacs-lisp (use-package relative-buffers @@ -1008,7 +1010,7 @@ Ibuffer is quite nice for listing all buffers. :config (progn (global-relative-buffers-mode))) #+END_SRC -** Narrowing +*** Narrowing Enable it without prompting @@ -1018,7 +1020,7 @@ Enable it without prompting (put 'narrow-to-region 'disabled nil) #+END_SRC -** ace-window +*** ace-window I don’t often have many windows open at once, but when I do, =ace-window= is really nice to jump around them in the same way that @@ -1041,7 +1043,7 @@ I don’t often have many windows open at once, but when I do, aw-keys '(?a ?r ?s ?t ?n ?e ?i ?o)))) #+END_SRC -* Windows +** Windows Scrolling is tricky. I use this setup to help me keep track of the point whilst I’m moving about. @@ -1058,7 +1060,7 @@ point whilst I’m moving about. (setq ns-pop-up-frames nil)) #+END_SRC -** eyebrowse +*** eyebrowse Workspaces, a bit like dwm. On Windows and Linux (at least the WMs I'm likely to use), super+{0-9} are taken from the OS, so use meta @@ -1095,9 +1097,9 @@ programs to switch between program windows or views. (eyebrowse-mode +1))) #+END_SRC -* Sessions +** Sessions -** Desktop +*** Desktop Save my Emacs session and restore it on startup. #+BEGIN_SRC emacs-lisp @@ -1116,7 +1118,7 @@ Save my Emacs session and restore it on startup. (desktop-save-mode 1))) #+END_SRC -** winner +*** winner Undo, for window-based commands. @@ -1127,7 +1129,7 @@ Undo, for window-based commands. (winner-mode 1))) #+END_SRC -** windmove +*** windmove Directional window movement @@ -1138,7 +1140,7 @@ Directional window movement ("S-" . windmove-up) ("S-" . windmove-down))) #+END_SRC -* Blogging +** Blogging I have a [[https://alanpearce.uk][blog]] that I publish with hugo. @@ -1149,7 +1151,7 @@ I have a [[https://alanpearce.uk][blog]] that I publish with hugo. easy-hugo-default-ext ".md")) #+END_SRC -* Completion +** Completion Make built-in completion a bit more intelligent, by adding substring and initial-based completion and ignoring case. @@ -1160,7 +1162,7 @@ and initial-based completion and ignoring case. tab-always-indent 'complete) #+END_SRC -** Company +*** Company The main choices for automatic completion in Emacs are company and auto-complete-mode. I’ve not tried auto-complete-mode as company @@ -1194,9 +1196,9 @@ seems to work perfectly well for me. :after company) #+END_SRC -* Dates & Times +;;; * Dates: & Times -** Calendar +*** Calendar Weeks start on Monday for me and I prefer ISO-style dates. #+BEGIN_SRC emacs-lisp @@ -1234,7 +1236,7 @@ Sometimes I want to insert a date or time into a buffer. (timer-relative-time (current-time) -86400)) #+END_SRC -* Directories +** Directories Dired works quite nicely, but not always in the way I want. I don’t like having so many prompts for recursive operations. Also, when I @@ -1300,7 +1302,7 @@ Expand subfolders like a tree inside the parent (bind-key "i" #'dired-subtree-toggle dired-mode-map)))) #+END_SRC -** Disk usage +*** Disk usage Combine dired and du (disk usage). @@ -1311,7 +1313,7 @@ Combine dired and du (disk usage). (setq dired-du-size-format t))) #+END_SRC -** Dired-narrow +*** Dired-narrow One can already use dired with wildcards to browse a filtered directory listing, but it opens a new buffer. Dired-narrow is a slightly nicer interface: with a currently-open dired buffer, use =/= @@ -1325,9 +1327,9 @@ the buffer, removing the filter. ("/" . dired-narrow)))) #+END_SRC -* Documentation +** Documentation -** ehelp +*** ehelp ehelp is a less well-known package that’s part of Emacs and slightly improves the normal help commands, mostly by making quitting them easier. @@ -1336,7 +1338,7 @@ improves the normal help commands, mostly by making quitting them easier. (use-package ehelp :bind-keymap ("C-h" . ehelp-map)) #+END_SRC -** counsel-dash +*** counsel-dash Emacs’ documentation is great to read from inside Emacs. Counsel-dash helps to make documentation for other languages easier to access @@ -1371,7 +1373,7 @@ helps to make documentation for other languages easier to access (ap/create-counsel-dash-hook sql ("PostgreSQL" "MySQL")))) #+END_SRC -** discover-my-major +*** discover-my-major A nicer way to browse keybindings for major modes. @@ -1380,7 +1382,7 @@ A nicer way to browse keybindings for major modes. :bind ("" . discover-my-major)) #+END_SRC -** which-key +*** which-key Popup keybindings following a prefix automatically. @@ -1392,7 +1394,7 @@ Popup keybindings following a prefix automatically. (which-key-setup-side-window-right-bottom))) #+END_SRC -** eldoc +*** eldoc Documentation in the echo-area (where the minibuffer is displayed) is rather useful. @@ -1405,9 +1407,9 @@ rather useful. (setq eldoc-idle-delay 0.1) (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) #+END_SRC -* Mail +** Mail -** Gnus +*** Gnus At work, I use gnus for email. Some of the setup is specific to my workplace, so I keep it in a host-specific, GPG-encrypted file. @@ -1432,7 +1434,7 @@ workplace, so I keep it in a host-specific, GPG-encrypted file. (add-to-list 'mm-discouraged-alternatives "text/richtext")) #+END_SRC -** BBDB +*** BBDB As I'm using Emacs for email, it makes sense to have contact information here as well. @@ -1451,7 +1453,7 @@ information here as well. bbdb-offer-to-create 1))) #+END_SRC -* Misc +** Misc #+BEGIN_SRC emacs-lisp (defvar *init-file* @@ -1503,7 +1505,7 @@ information here as well. (bind-key* "C-x r M-w" #'copy-rectangle) #+END_SRC -** Auxillary Configuration +*** Auxillary Configuration #+BEGIN_SRC emacs-lisp (require 'pinentry) @@ -1556,7 +1558,7 @@ information here as well. (add-hook 'after-make-frame-functions #'first-frame-hook)) #+END_SRC -* Minibuffer +** Minibuffer Sometimes I want to use the minibuffer, but I’m already inside it. Fortunately, this is possible. Of course, I need to know how many @@ -1580,7 +1582,7 @@ Occasionally, I exit emacs. I should probably reduce the frequency of this. (defalias 'exit-emacs #'save-buffers-kill-emacs)) #+END_SRC -** swiper/ivy +*** swiper/ivy Ivy is the new kid on the completion block. It seems to be a strong replacement for helm so far. @@ -1603,7 +1605,7 @@ replacement for helm so far. (add-to-list 'ivy-initial-inputs-alist '(counsel-M-x . "")))) #+END_SRC -** counsel +*** counsel #+BEGIN_SRC emacs-lisp (use-package counsel @@ -1626,7 +1628,7 @@ replacement for helm so far. #+END_SRC -** smex +*** smex Smex is my favourite way to use =M-x=. Counsel’s =counsel-M-x= function uses it internally, so I’m keeping it around, even though I @@ -1650,7 +1652,7 @@ don’t use it directly. "smex-items")))) #+END_SRC -** cmd-to-echo +*** cmd-to-echo I’ve been looking for some way to run programming projects (mostly node.js) inside emacs. =cmd-to-echo= seems great for this, as new @@ -1661,7 +1663,7 @@ output pops up in the echo area. :commands (cmd-to-echo) :config (setq cmd-to-echo-add-output-to-process-buffers t)) #+END_SRC -* Modes +** Modes Setup some modes for systemd files #+BEGIN_SRC emacs-lisp @@ -1730,7 +1732,7 @@ configuration files. (add-to-list 'auto-mode-alist '("\\.sls\\'" . saltstack-mode)) #+END_SRC -** ledger +*** ledger I use [[http://ledger-cli.org/][=ledger=]] to manage my finances. It has an Emacs mode, which works really nicely. @@ -1770,7 +1772,7 @@ works really nicely. ("account" "ledger -f %(ledger-file) reg %(account)"))))) #+END_SRC -** Markdown +*** Markdown #+BEGIN_SRC emacs-lisp (use-package markdown-mode @@ -1779,7 +1781,17 @@ works really nicely. (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) #+END_SRC -** Org +*** Lentic + +Multiple different views of the same file. Can be used for a kind of +inverse literate programming. + +#+BEGIN_SRC emacs-lisp +(use-package lentic + :config (global-lentic-mode)) +#+END_SRC + +*** Org Org is wünderbar. @@ -1839,7 +1851,7 @@ Org is wünderbar. (bind-key "C-x C-s" #'org-edit-src-exit org-src-mode-map))) #+END_SRC -**** org-babel +***** org-babel Org’s babel feature is really nice. I use it for this file, and I can use it to communicate between programming languages. Sometime I hope @@ -1859,7 +1871,7 @@ with R or something. org-src-preserve-indentation t))) #+END_SRC -**** org-journal +***** org-journal I can use this to keep a journal. I should use it. @@ -1885,8 +1897,8 @@ I can use this to keep a journal. I should use it. #+END_SRC -* Programming -** flycheck +** Programming +*** flycheck On-the-fly error checking in programming modes? Yes please. @@ -1905,7 +1917,7 @@ On-the-fly error checking in programming modes? Yes please. (setq flycheck-javascript-eslint-executable "eslint_d")))) #+END_SRC -*** flycheck-pos-tip +**** flycheck-pos-tip Show flycheck errors in a little popup, so I don't lose my place @@ -1917,7 +1929,7 @@ Show flycheck errors in a little popup, so I don't lose my place (flycheck-pos-tip-mode 1))) #+END_SRC -*** flycheck-flow +**** flycheck-flow #+BEGIN_SRC emacs-lisp (use-package flycheck-flow @@ -1927,7 +1939,7 @@ Show flycheck errors in a little popup, so I don't lose my place (flycheck-add-next-checker 'javascript-eslint 'javascript-flow))) #+END_SRC -** golang +*** golang Go has a few packages to inter-operate with other emacs packages. @@ -1954,7 +1966,7 @@ Go has a few packages to inter-operate with other emacs packages. #+END_SRC -** ggtags +*** ggtags A nice completion backend for programming modes. @@ -1972,7 +1984,7 @@ A nice completion backend for programming modes. (add-hook 'c-mode-common-hook #'turn-on-ggtags-mode))) #+END_SRC -** dumb-jump +*** dumb-jump A "clever" way of implementing go-to-definition across languages: use a project-wide text search and apply heuristics to the results to @@ -1987,7 +1999,7 @@ guess a definition. :config (setq dumb-jump-selector 'ivy)) #+END_SRC -** imenu-anywhere +*** imenu-anywhere This is like imenu, but shows functions (or similar top-level entities) across buffers in the same project. Neat! @@ -1996,9 +2008,9 @@ entities) across buffers in the same project. Neat! (use-package imenu-anywhere :bind ("C-x C-." . ivy-imenu-anywhere)) #+END_SRC -** Lisps +*** Lisps -*** All +**** All Lisp modes don’t seem to have a common ancestor. So I made a custom hook which I trigger in every lispy-mode. @@ -2017,7 +2029,7 @@ hook which I trigger in every lispy-mode. (run-hooks 'lisp-mode-common-hook)) #+END_SRC -**** Redshank +***** Redshank Lisp syntax allows for really easy refactoring. Redshank gives some operations that aren’t part of paredit, like extracting variables into @@ -2030,7 +2042,7 @@ let bindings. (add-hook 'lisp-mode-common-hook #'turn-on-redshank-mode))) #+END_SRC -*** Emacs Lisp +**** Emacs Lisp Customise the modeline-display of =emacs-lisp-mode=. Then make sure it runs the common lisp hooks. @@ -2060,7 +2072,7 @@ Interactive elisp (run-hooks 'lisp-mode-common-hook)))) #+END_SRC -*** Scheme & Lisp +**** Scheme & Lisp I don’t work with these as often as I would like @@ -2070,7 +2082,7 @@ I don’t work with these as often as I would like #'common-lisp-indent-function)) #+END_SRC -**** geiser +***** geiser A REPL thing for Scheme. Hopefully I’ll get to use it more in the future. @@ -2083,7 +2095,7 @@ future. run-racket)) #+END_SRC -**** slime +***** slime A REPL thing (and more) for Lisp. @@ -2100,7 +2112,7 @@ A REPL thing (and more) for Lisp. (executable-find "ccl64"))))) #+END_SRC -*** Clojure +**** Clojure #+BEGIN_SRC emacs-lisp (use-package clojure-mode @@ -2119,7 +2131,7 @@ A REPL thing (and more) for Lisp. (clj-refactor-mode 1)))) #+END_SRC -**** cider +***** cider A REPL thing for Clojure @@ -2132,7 +2144,7 @@ A REPL thing for Clojure (add-hook 'cider-mode-hook #'eldoc-mode))) #+END_SRC -** Auto-compile +*** Auto-compile Auto-compile emacs lisp when saving. #+BEGIN_SRC emacs-lisp @@ -2141,7 +2153,7 @@ Auto-compile emacs lisp when saving. :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) #+END_SRC -** cc-mode +*** cc-mode Although I don’t use C or C++, setting up the mode is helpful because quite a few other modes are derived from it. @@ -2157,7 +2169,7 @@ quite a few other modes are derived from it. (c-set-offset 'case-label '+))) #+END_SRC -** quickrun +*** quickrun It’s nice to be able to quickly evaluate some code. Although I don’t really seem to use it. @@ -2166,7 +2178,7 @@ really seem to use it. :bind (("C-c C-e" . quickrun))) #+END_SRC -** Scala +*** Scala Let’s try using Scala. @@ -2180,9 +2192,9 @@ And add ensime, an IDE-style environment. (use-package ensime) #+END_SRC -** Web development +*** Web development -*** js2-mode +**** js2-mode This mode is really great for editing Javascript. It turns code into an AST internally, so it can work with it almost like a lisp. @@ -2213,16 +2225,18 @@ an AST internally, so it can work with it almost like a lisp. js2-strict-missing-semi-warning nil))) #+END_SRC -**** rjsx-mode +***** rjsx-mode A set of advice for js2-jsx-mode to work better with React. #+BEGIN_SRC emacs-lisp (use-package rjsx-mode + :after js2-mode + :if (fboundp #'js2--struct-put) :mode (("\\.jsx\\'" . rjsx-mode))) #+END_SRC -**** js2-refactor +***** js2-refactor Thanks to the AST provided by js2-mode, refactoring is possible. This library implements some refactorings. @@ -2236,7 +2250,7 @@ library implements some refactorings. (js2r-add-keybindings-with-prefix "C-c C-m"))) #+END_SRC -**** add-node-modules-path +***** add-node-modules-path Inside a javascript project, it's common to install tools locally to the project. This will allows emacs to find their executables. @@ -2247,7 +2261,7 @@ the project. This will allows emacs to find their executables. (add-hook 'js2-mode-hook #'add-node-modules-path))) #+END_SRC -**** Flow +***** Flow #+BEGIN_SRC emacs-lisp (use-package flow-minor-mode @@ -2256,7 +2270,7 @@ the project. This will allows emacs to find their executables. (add-hook 'js2-mode-hook #'flow-minor-enable-automatically))) #+END_SRC -**** Indium +***** Indium Javascript with an inferior node.js process and a debugger? Awesome. @@ -2281,7 +2295,7 @@ Instead, do this: (add-hook 'js2-mode-hook #'indium-interaction-mode))) #+END_SRC -*** coffee-mode +**** coffee-mode #+BEGIN_SRC emacs-lisp (use-package coffee-mode @@ -2290,7 +2304,7 @@ Instead, do this: (setq coffee-indent-like-python-mode t))) #+END_SRC -*** tern +**** tern Tern understands javascript. It adds really clever documented completions, besides other IDE-like things. @@ -2311,7 +2325,7 @@ completions, besides other IDE-like things. (use-package company-tern)) #+END_SRC -*** json-mode +**** json-mode #+BEGIN_SRC emacs-lisp (use-package json-mode @@ -2321,7 +2335,7 @@ completions, besides other IDE-like things. ("\\.tern-project\\'" . json-mode))) #+END_SRC -*** restclient +**** restclient Restclient is really nice. It’s like a scratchpad for HTTP api calls. Feels a bit like using =org-babel=. I wonder if there’s an @@ -2342,7 +2356,7 @@ integration between the two yet. :init (add-to-list 'company-backends #'company-restclient t)) #+END_SRC -*** sgml-mode +**** sgml-mode This is for HTML, since old versions of HTML were derived from SGML. #+BEGIN_SRC emacs-lisp @@ -2351,7 +2365,7 @@ This is for HTML, since old versions of HTML were derived from SGML. :config (setq sgml-basic-offset 2)) #+END_SRC -*** emmet-mode +**** emmet-mode Emmet is really nice to write HTML quickly. Especially with frameworks that require multiple nested elements to do anything useful. @@ -2367,7 +2381,7 @@ frameworks that require multiple nested elements to do anything useful. (add-hook 'css-mode-hook #'emmet-mode))) #+END_SRC -*** web-mode +**** web-mode This mode handles just about every templating language out ther, which is really nice, because it handles the HTML part the same way in all @@ -2399,7 +2413,7 @@ I derived a mode for twig, in order to use its =mode-hook=. (add-to-list 'auto-mode-alist '("\\.html\\.twig\\'" . twig-mode)) #+END_SRC -** Live coding +*** Live coding Sometimes I might want to show off my emacs usage. @@ -2415,7 +2429,7 @@ Sometimes I might want to show off my emacs usage. (global-command-log-mode -1)) #+END_SRC -*** command-log-mode +**** command-log-mode #+BEGIN_SRC emacs-lisp (use-package command-log-mode @@ -2426,7 +2440,7 @@ Sometimes I might want to show off my emacs usage. command-log-mode-is-global t))) #+END_SRC -* Spelling +** Spelling #+BEGIN_SRC emacs-lisp (use-package ispell @@ -2490,7 +2504,7 @@ Sometimes I might want to show off my emacs usage. (add-hook 'prog-mode-hook #'flyspell-prog-mode))) #+END_SRC -** Style checking +*** Style checking [[https://github.com/ValeLint/vale][Vale]] is a linter, but for prose. Neat idea! Salesman is a bad term. @@ -2503,7 +2517,7 @@ Sometimes I might want to show off my emacs usage. (flycheck-vale-setup))) #+END_SRC -* Scripting +** Scripting Make a shell-script buffer executable after saving it, if it has a shebang. @@ -2524,7 +2538,7 @@ Make a shell-script buffer executable after saving it, if it has a shebang. (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) #+END_SRC -** eshell +*** eshell I should try to get into the habit of using this more. It’s really nice, when I remember to use it. @@ -2564,7 +2578,7 @@ nice, when I remember to use it. #+END_SRC -*** Shells +**** Shells #+BEGIN_SRC emacs-lisp (use-package shell @@ -2585,7 +2599,7 @@ nice, when I remember to use it. (comint-delchar-or-maybe-eof arg))) #+END_SRC -* Text editing +** Text editing Emacs has an editor within. @@ -2597,7 +2611,7 @@ Emacs has an editor within. (setq-default truncate-lines t) #+END_SRC -** align +*** align =Align= is a useful command to line things up, once given some rules. The most important one for me is JSON property alignment. @@ -2613,7 +2627,7 @@ The most important one for me is JSON property alignment. (modes . '(js2-mode)))))) #+END_SRC -** Clipboard +*** Clipboard I like to use the clipboard more than the primary selection in X11. @@ -2626,7 +2640,7 @@ I like to use the clipboard more than the primary selection in X11. (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))) #+END_SRC -** Selection +*** Selection I’m quite used to deleting text by selecting it and typing. Emacs has a mode for that. @@ -2663,7 +2677,7 @@ from Sublime Text. As always, there’s a mode for that. :config (setq expand-region-fast-keys-enabled nil)) #+END_SRC -** avy +*** avy Avy is a really nice way to move around files, like ace-jump-mode, but somehow I prefer it. @@ -2682,7 +2696,7 @@ somehow I prefer it. avy-keys '(?a ?r ?s ?t ?d ?h ?n ?e ?i ?\;)))) #+END_SRC -*** ace-link +**** ace-link Visit any link. Despite the name, this works with avy. @@ -2696,7 +2710,7 @@ Visit any link. Despite the name, this works with avy. (bind-key "M-o" #'ace-link-gnus gnus-article-mode-map)))) #+END_SRC -** goto-chg +*** goto-chg This is like popping the mark, only it filters to only change areas and doesn’t go back to the same place more than once. @@ -2706,7 +2720,7 @@ and doesn’t go back to the same place more than once. :bind ("C-c C-SPC" . goto-last-change)) #+END_SRC -** beginend +*** beginend In special buffers, I would rather have =M->= and =M-<= goto the logical beginning/end rather than the physical ones. @@ -2717,7 +2731,7 @@ logical beginning/end rather than the physical ones. (beginend-setup-all))) #+END_SRC -** multiple-cursors +*** multiple-cursors I mentioned before that I’d used Sublime Text before. Multiple cursors was one of my favourite features, so I was really happy when I @@ -2733,7 +2747,7 @@ saw that multiple-cursors was released for Emacs. ("C-S-L" . mc/edit-lines))) #+END_SRC -** paredit +*** paredit Balanced parentheses in lisps are nice, but all the refactoring and movement commands are much more interesting. @@ -2748,7 +2762,7 @@ movement commands are much more interesting. (add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode))) #+END_SRC -** smartparens +*** smartparens I like to use smartparens where paredit isn’t already useful. Somehow I didn’t find smartparens’ implementation of paredit style to be as @@ -2785,7 +2799,7 @@ nice as the real version #+END_SRC -** move-text +*** move-text Transposing lines, made easier. @@ -2794,7 +2808,7 @@ Transposing lines, made easier. :config (move-text-default-bindings)) #+END_SRC -** undo-tree +*** undo-tree Emacs’ default handling of undo is a bit confusing. Undo-tree makes it much clearer. It’s especially helpful for protoyping and refactoring. @@ -2817,14 +2831,14 @@ it much clearer. It’s especially helpful for protoyping and refactoring. :diminish undo-tree-mode) #+END_SRC -** replace +*** replace #+BEGIN_SRC emacs-lisp (with-eval-after-load "replace.el" (setq case-replace nil)) #+END_SRC -** visual-regexp +*** visual-regexp I don’t always remember exactly how Emacs’ regular expressions work, so this package is pretty useful because it highlights everything in @@ -2836,61 +2850,8 @@ the buffer for me. ("C-c q" . vr/query-replace) ("C-c m" . vc/mc-mark))) #+END_SRC -* Tangling - -Taken from [[https://github.com/larstvei/dot-emacs/blob/master/init.org][larstvei/dot-emacs]]. I changed it so that it would work with -my current dotfiles repository structure and work asynchronously, -thanks to [[https://github.com/jwiegley/emacs-async][jwiegley/emacs-async]]. - -We can use =C-c C-v t= to run =org-babel-tangle=, which extracts the -code blocks from the current file into a source-specific file (in this -case a =.el=-file). -To avoid doing this each time a change is made we can add a function -to the =after-save-hook= ensuring to always tangle and byte-compile -the =org=-document after changes. - -#+BEGIN_SRC emacs-lisp -(use-package async - :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." - - (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))))) - -(defun tangle-init () - "Tangle init.org asynchronously." - - (interactive) - (message "Tangling init") - (async-start - (symbol-function #'tangle-init-sync) - (lambda (result) - (message "Init tangling completed: %s" result)))) -#+END_SRC - -# Local Variables: -# eval: (when (fboundp #'tangle-if-init) (add-hook 'after-save-hook #'tangle-if-init)) -# End: -* End +** End Start a server if possible. A daemon is already a server. #+BEGIN_SRC emacs-lisp @@ -2902,3 +2863,7 @@ Start a server if possible. A daemon is already a server. (setq gc-cons-threshold 800000 file-name-handler-alist file-name-handler-alist-backup) #+END_SRC + +Local Variables: +lentic-init: lentic-orgel-org-init +End: diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix index cf697c7c..aad4a780 100644 --- a/nix/.config/nixpkgs/emacs.nix +++ b/nix/.config/nixpkgs/emacs.nix @@ -52,12 +52,12 @@ in bind-key use-package smartparens + lentic ]) ++ (with epkgs.melpaPackages; [ ace-link ace-window add-node-modules-path ag - async auto-compile avy base16-theme -- cgit 1.4.1 From f4aa8c2484b2fc00afa5935e31164f0b4bb6c311 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 3 Aug 2017 12:11:01 +0200 Subject: Emacs: Update Makefile to only byte-compile init --- emacs/.emacs.d/Makefile | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/emacs/.emacs.d/Makefile b/emacs/.emacs.d/Makefile index 9f086ffd..71415d56 100644 --- a/emacs/.emacs.d/Makefile +++ b/emacs/.emacs.d/Makefile @@ -1,13 +1,3 @@ -define EMACS_TANGLE -(progn\ - (require 'package)\ - (package-refresh-contents nil)\ - (setq vc-follow-symlinks nil)\ - (find-file \"init.org\")\ - (require 'ob-tangle)\ - (org-babel-tangle nil \"init.el\")) -endef - EMACS := ${NIX_LINK}/bin/emacs # The first target is the default. `all` is typically defined here. @@ -16,11 +6,8 @@ all: init.elc # These targets don't pertain to files .PHONY: all clean -init.el: - $(EMACS) --batch --no-init-file --eval "$(EMACS_TANGLE)" --kill - init.elc: init.el $(EMACS) --batch --no-init-file --funcall batch-byte-compile init.el clean: - rm init.el init.elc + rm init.elc -- cgit 1.4.1 From 17750b72b3d5578f486c4a13901f552a93b7cdb0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 3 Aug 2017 12:16:21 +0200 Subject: Ignore .elc files With lentic-mode, these are now created inside the repository --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ea33edfb..b1a76a45 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ *.zwc *.zwc.old .DS_Store +*.elc -- cgit 1.4.1 From 0c91555d5bab41fd2ce71ea0dee29eb7fb64484a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 3 Aug 2017 12:32:16 +0200 Subject: Emacs: Remove counsel-dash I don't seem to be using it, and it's currently not installable via nix --- emacs/.emacs.d/init.el | 34 ---------------------------------- emacs/.emacs.d/init.org | 34 ---------------------------------- 2 files changed, 68 deletions(-) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 902e5b52..9e8e109a 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -1338,40 +1338,6 @@ (use-package ehelp :bind-keymap ("C-h" . ehelp-map)) ;; #+END_SRC -;; *** counsel-dash - -;; Emacs’ documentation is great to read from inside Emacs. Counsel-dash -;; 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) - (seq-map #'counsel-dash-install-docset - (seq-difference ',docsets - (helm-dash-installed-docsets))) - (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")))) -;; #+END_SRC ;; *** discover-my-major diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index d428bd89..78c1ede5 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1338,40 +1338,6 @@ improves the normal help commands, mostly by making quitting them easier. (use-package ehelp :bind-keymap ("C-h" . ehelp-map)) #+END_SRC -*** counsel-dash - -Emacs’ documentation is great to read from inside Emacs. Counsel-dash -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) - (seq-map #'counsel-dash-install-docset - (seq-difference ',docsets - (helm-dash-installed-docsets))) - (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")))) -#+END_SRC *** discover-my-major -- cgit 1.4.1 From d42c508a6c8d51ff9efa72cfcdd357cef3f0f9da Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 3 Aug 2017 12:32:36 +0200 Subject: Ignore flycheck temp files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index b1a76a45..e9fa055c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ *.zwc.old .DS_Store *.elc +flycheck_* -- cgit 1.4.1 From 0fa6a6ba99361ff513dfd93f24d605a07a5c9f07 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 3 Aug 2017 12:44:45 +0200 Subject: Emacs: Fix byte-compiler warnings --- emacs/.emacs.d/init.el | 12 ++++-------- emacs/.emacs.d/init.org | 5 ++--- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 9e8e109a..ffde904a 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -604,7 +604,7 @@ :demand t :diminish projectile-mode :config (progn - (projectile-global-mode +1) + (projectile-mode +1) (add-to-list 'projectile-globally-ignored-directories ".stversions") (defun yarn-install (&optional arg) @@ -1706,6 +1706,7 @@ ;; #+BEGIN_SRC emacs-lisp (use-package ledger-mode :mode ("\\.ledger\\'" . ledger-mode) + :functions ledger-report :init (progn (defun open-budget () (interactive) @@ -2169,16 +2170,11 @@ (use-package js2-mode :mode (("\\.js\\'" . js2-mode)) :interpreter ("node" . js2-mode) - :functions js2-next-error + :functions (js2-next-error + js2--struct-put) :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))) (add-hook 'js2-mode-hook #'js2-imenu-extras-mode) - (advice-add 'imenu-add-to-menubar :around #'js2--imenu-around) (defun ap/js2-prev-error () (interactive) (js2-next-error -1)) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 78c1ede5..da79d68f 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -604,7 +604,7 @@ ones. :demand t :diminish projectile-mode :config (progn - (projectile-global-mode +1) + (projectile-mode -1) (add-to-list 'projectile-globally-ignored-directories ".stversions") (defun yarn-install (&optional arg) @@ -2174,8 +2174,7 @@ an AST internally, so it can work with it almost like a lisp. (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)) + (if (not (string-equal name "IM-Javascript-IDE")) (do-it name))) (add-hook 'js2-mode-hook #'js2-imenu-extras-mode) (advice-add 'imenu-add-to-menubar :around #'js2--imenu-around) -- cgit 1.4.1 From 86fc398a1e808c73f5727f729460ccab01258dd8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 4 Aug 2017 10:17:36 +0200 Subject: Emacs: Move post-startup de-optimisation code to top of file --- emacs/.emacs.d/init.el | 6 ++++-- emacs/.emacs.d/init.org | 17 ++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index ffde904a..fb5a75ed 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -17,6 +17,10 @@ (setq gc-cons-threshold 100000000) (defvar file-name-handler-alist-backup file-name-handler-alist) (setq file-name-handler-alist nil) +(add-hook 'after-init-hook + #'(lambda () + (setq gc-cons-threshold 800000 + file-name-handler-alist file-name-handler-alist-backup))) (remove-hook 'find-file-hooks #'vc-refresh-state) ;; #+END_SRC @@ -2822,8 +2826,6 @@ :if (not (daemonp)) :config (unless (server-running-p server-name) (server-start))) -(setq gc-cons-threshold 800000 - file-name-handler-alist file-name-handler-alist-backup) ;; #+END_SRC ;; Local Variables: diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index da79d68f..6ca4f65f 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -17,6 +17,10 @@ Open Emacs with just a plain window. No graphics or messages, please! (setq gc-cons-threshold 100000000) (defvar file-name-handler-alist-backup file-name-handler-alist) (setq file-name-handler-alist nil) +(add-hook 'after-init-hook + #'(lambda () + (setq gc-cons-threshold 800000 + file-name-handler-alist file-name-handler-alist-backup))) (remove-hook 'find-file-hooks #'vc-refresh-state) #+END_SRC @@ -604,7 +608,7 @@ ones. :demand t :diminish projectile-mode :config (progn - (projectile-mode -1) + (projectile-mode +1) (add-to-list 'projectile-globally-ignored-directories ".stversions") (defun yarn-install (&optional arg) @@ -1706,6 +1710,7 @@ works really nicely. #+BEGIN_SRC emacs-lisp (use-package ledger-mode :mode ("\\.ledger\\'" . ledger-mode) + :functions ledger-report :init (progn (defun open-budget () (interactive) @@ -2169,15 +2174,11 @@ an AST internally, so it can work with it almost like a lisp. (use-package js2-mode :mode (("\\.js\\'" . js2-mode)) :interpreter ("node" . js2-mode) - :functions js2-next-error + :functions (js2-next-error + js2--struct-put) :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 (not (string-equal name "IM-Javascript-IDE")) - (do-it name))) (add-hook 'js2-mode-hook #'js2-imenu-extras-mode) - (advice-add 'imenu-add-to-menubar :around #'js2--imenu-around) (defun ap/js2-prev-error () (interactive) (js2-next-error -1)) @@ -2825,8 +2826,6 @@ Start a server if possible. A daemon is already a server. :if (not (daemonp)) :config (unless (server-running-p server-name) (server-start))) -(setq gc-cons-threshold 800000 - file-name-handler-alist file-name-handler-alist-backup) #+END_SRC Local Variables: -- cgit 1.4.1 From 979a1c53860c2aa8705084ebaedba2ea8d85665e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 4 Aug 2017 15:28:28 +0200 Subject: Emacs: Use outshine instead of lentic --- emacs/.emacs.d/init.el | 24 +- emacs/.emacs.d/init.org | 2833 ----------------------------------------- nix/.config/nixpkgs/emacs.nix | 3 + 3 files changed, 22 insertions(+), 2838 deletions(-) delete mode 100644 emacs/.emacs.d/init.org diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index fb5a75ed..5df1f8be 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -1200,7 +1200,7 @@ :after company) ;; #+END_SRC -;;; * Dates: & Times +;;; ** Dates & Times ;; *** Calendar @@ -1762,6 +1762,24 @@ :config (global-lentic-mode)) ;; #+END_SRC +;; *** Outshine + +;; Org-ified source code. I think this might work better than +;; lentic-mode, whilst also being more general. + +;; #+BEGIN_SRC emacs-lisp +(defvar outline-minor-mode-prefix "M-#") +(use-package outshine + :bind (:map outline-minor-mode-map + ("TAB" . outline-cycle) + ("" . outshine-cycle-buffer)) + :config (progn + (add-hook 'outline-minor-mode-hook #'outshine-hook-function) + (add-hook 'emacs-lisp-mode-hook #'outline-minor-mode) + (add-hook 'ledger-mode-hook #'outline-minor-mode) + (add-hook 'sh-mode-hook #'outline-minor-mode))) +;; #+END_SRC + ;; *** Org ;; Org is wünderbar. @@ -2827,7 +2845,3 @@ :config (unless (server-running-p server-name) (server-start))) ;; #+END_SRC - -;; Local Variables: -;; lentic-init: lentic-orgel-org-init -;; End: diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org deleted file mode 100644 index 6ca4f65f..00000000 --- a/emacs/.emacs.d/init.org +++ /dev/null @@ -1,2833 +0,0 @@ -# # emacs-config --- Summary -#+TITLE: Emacs Configuration for Alan Pearce -#+OPTIONS: ^:nil -#+PROPERTY: results silent -#+PROPERTY: eval no-export -#+PROPERTY: header-args :comments link -* Header -This is a living document, detailing my Emacs configuration using org-mode -* Code -** Basics -*** Startup -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-screen t) -(setq gc-cons-threshold 100000000) -(defvar file-name-handler-alist-backup file-name-handler-alist) -(setq file-name-handler-alist nil) -(add-hook 'after-init-hook - #'(lambda () - (setq gc-cons-threshold 800000 - file-name-handler-alist file-name-handler-alist-backup))) -(remove-hook 'find-file-hooks #'vc-refresh-state) -#+END_SRC - -Are we running on Windows via the WSL? - -#+BEGIN_SRC emacs-lisp -(when (file-exists-p "/proc/sys/kernel/osrelease") - (with-temp-buffer - (insert-file-contents-literally "/proc/sys/kernel/osrelease") - (decode-coding-region (point-min) (point-max) 'utf-8 t) - (when (string-match "Microsoft$" (buffer-string)) - (setq system-type 'gnu/linux/windows)))) -#+END_SRC - -*** Compatibility - -#+BEGIN_SRC emacs-lisp -(if (version< emacs-version "25.0") - (defmacro with-eval-after-load (file &rest body) - `(eval-after-load ,file (lambda () ,@body)))) -#+END_SRC - -*** Scratch buffers -I usually use scratch buffers for any sort of text. If I need a -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) -#+END_SRC - -*** Personal Information -#+BEGIN_SRC emacs-lisp -(setq user-mail-address "alan@alanpearce.eu" - user-full-name "Alan Pearce") -#+end_src - -** Packaging - -*** Use-package - -#+BEGIN_SRC emacs-lisp -(eval-and-compile - (require 'seq) - (defvar nix-emacs (and (string-match "^/nix/store" invocation-directory) - (not (null (seq-some (lambda (dir) (string-match "^/nix/store" dir)) load-path))))) - - (setq tls-checktrust t - gnutls-verify-error t - package-menu-async t - package-user-dir (concat "~/.emacs.d/packages/" emacs-version "/elpa") - package-menu-hide-low-priority t) - (if nix-emacs - (progn (setq package-archives nil) - (package-initialize)) - (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") - ("melpa-stable" . "https://stable.melpa.org/packages/") - ("melpa" . "https://melpa.org/packages/")) - package-pinned-packages '(("use-package" . melpa-stable) - ("diminish" . melpa-stable) - ("bind-key" . melpa-stable)) - package-archive-priorities '(("melpa" . 10) - ("gnu" . 10) - ("melpa-stable" . 5) - ("marmalade" . 0)))) - (when (eq system-type 'darwin) - (with-eval-after-load "gnutls" - (add-to-list 'gnutls-trustfiles "/etc/ssl/cert.pem"))) - (unless nix-emacs - (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)) -(setq use-package-always-ensure (not nix-emacs) - use-package-always-demand (daemonp) - package-enable-at-startup nil) -#+END_SRC - -*** Helpers - -**** Hook Helpers - -An improvement over add-hook with lamda functions that allows -modification and removal, without the boilerplate of an extra function -definition. - -#+BEGIN_SRC emacs-lisp -(eval-and-compile - (use-package hook-helpers)) -#+END_SRC - -** Customize -I don’t really like using customize for normal configuration. -Instead, I use it for things that get saved automatically. That’s why -I use a different file, which is ignored by the VCS. It also means -that it’s not important whether the file exists or not, which is why I -pass =:noerror= to =load= - -#+BEGIN_SRC emacs-lisp -(setq custom-file "~/.emacs.d/custom.el") -(load custom-file :noerror :nomessage) -#+END_SRC - -** Styles - -I prefer an always-visible cursor. Feels less distracting. -#+BEGIN_SRC emacs-lisp -(when (fboundp #'blink-cursor-mode) - (blink-cursor-mode -1)) -#+END_SRC - -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)) -(with-eval-after-load 'scroll-bar - (set-scroll-bar-mode nil)) -(with-eval-after-load 'tooltip - (tooltip-mode -1)) -(with-eval-after-load 'tool-bar - (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)))) -#+END_SRC - -*** Colours - -Eziam looks nice, too, except for the non-white background. I prefer -white because most other application backgrounds are that colour. - -#+BEGIN_SRC emacs-lisp -(use-package eziam-light-theme - :ensure eziam-theme - :disabled t - :if (or window-system - (daemonp)) - :defines (eziam-scale-headings) - :config (progn - (setq eziam-scale-headings nil) - (load-theme 'eziam-light t) - (custom-theme-set-faces 'user - '(default ((t (:background "#ffffff")))) - '(js2-function-call ((t (:underline nil)))) - '(js2-object-property ((t (:slant normal)))) - '(font-lock-keyword-face ((t (:weight normal)))) - '(git-gutter-fr:added ((t (:foreground "#96a4ab")))) - '(git-gutter-fr:modified ((t (:foreground "#96a4ab")))) - '(git-gutter-fr:deleted ((t (:foreground "#96a4ab"))))))) -#+END_SRC - -White-theme. Sounds like a good idea. - -#+BEGIN_SRC emacs-lisp -(use-package white-theme - :if (or window-system - (daemonp)) - :config (progn - (load-theme 'white t) - (custom-theme-set-faces 'user - '(git-gutter-fr:added ((t (:foreground "#b8b8b8")))) - '(git-gutter-fr:modified ((t (:foreground "#b8b8b8")))) - '(git-gutter-fr:deleted ((t (:foreground "#b8b8b8")))) - '(font-lock-string-face ((t (:slant normal))))))) -#+END_SRC - -Base16 theming allows me have a consistent style between applications -quite easily. - -#+BEGIN_SRC emacs-lisp -(use-package base16-theme - :if (or window-system - (daemonp))) -#+END_SRC - -Highlighting quasi-quoted expressions in lisps is quite useful, but I -don't need it all the time. I'll keep it around for a while so that I -can enable it if needed. -#+BEGIN_SRC emacs-lisp -(use-package highlight-stages - :diminish highlight-stages-mode) -#+END_SRC - -*** Fonts - -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 . 1))) - - (defun ap/set-fonts (mono-face mono-font-size variable-face variable-font-size antialias &optional new-line-spacing) - (if (boundp 'ns-antialias-text) - (setq ns-antialias-text antialias)) - (if (boundp 'new-line-spacing) - (setq line-spacing new-line-spacing)) - (when mono-face - (let ((default-font (font-spec :family mono-face :size mono-font-size))) - (add-to-list 'default-frame-alist `(font . ,(format "%s %s" mono-face mono-font-size))) - (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 t)) - ((or (eq window-system 'mac) - (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 "Fira Code" 14 "Lucida Grande" 14 t nil) - (ap/set-fonts "Monoid" 12 "Helvetica Neue" 12 t 0.1)))) - ((and (eq window-system 'x) - (not (eq system-type 'gnu/linux/windows))) - (set-fontset-font "fontset-default" 'unicode (font-spec :name "PT Mono" :size 17)) - (ap/set-fonts "PT Mono" 17 "Noto Sans" 14 nil)) - ((and (eq window-system 'x) - (eq system-type 'gnu/linux/windows)) - (ap/set-fonts "Noto Mono" 12 "Sans" 12 nil)))) - - (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))) -#+END_SRC - -Make symbols prettier. Turns out, in many cases, this is already -configured, just not enabled. If using the mac-port version of Emacs, -it has it's own, more extensive version. - -#+BEGIN_SRC emacs-lisp -(if (eq window-system 'mac) - (mac-auto-operator-composition-mode +1) - (global-prettify-symbols-mode +1)) -#+END_SRC - -*** Page Breaks - -By default, Emacs displays page breaks as ^L. Lines look much nicer. -On Windows, Emacs incorrectly detects that U+2500 (Box Drawings Light -Horizontal) can only be displayed with a different font, which is not -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))))) -#+END_SRC -*** Modeline - -#+BEGIN_SRC emacs-lisp -(column-number-mode -1) -(line-number-mode -1) -(size-indication-mode t) - - -(require 'f) -(setq frame-title-format (list "Emacs" - (if (and nix-emacs invocation-directory) - (list " (Nix Generation " - (cadr - (split-string (f-base - (car - (last (seq-take-while - (lambda (s) (s-contains? "profile" s)) - (split-string - (s-chomp (shell-command-to-string (concat "nix-store -q --roots " invocation-directory))) - "\n"))))) - "-")) - " " - (s-left 6 (nth 3 (f-split invocation-directory))) - "..." - (s-right 6 (car (split-string (nth 3 (f-split invocation-directory)) "-"))) - ")")) - '(buffer-file-name " — %f") - '(dired-directory (" — " dired-directory)))) -#+END_SRC - -*** Chrome - -Sometimes I like to hide clutter. Other times, it's useful. - -#+BEGIN_SRC emacs-lisp -(defvar mode-line-default-format mode-line-format) -(defvar mode-line-default-hidden nil - "Whether to hide the mode line by default") - -(defun show-mode-line () - (interactive) - (setq mode-line-format mode-line-default-format) - (when (called-interactively-p 'interactive) - (setq-default mode-line-format mode-line-default-format) - (setq mode-line-default-hidden nil))) -(defun hide-mode-line () - (interactive) - (setq mode-line-format nil) - (when (called-interactively-p 'interactive) - (setq-default mode-line-format nil) - (setq mode-line-default-hidden t))) - -(setq-default cursor-in-non-selected-windows nil) - -(defun hide-clutter () - (interactive) - (hide-mode-line)) - -(defun show-clutter () - (interactive) - (show-mode-line)) - -(when mode-line-default-hidden - (call-interactively #'hide-mode-line)) - -(setq-default indicate-buffer-boundaries nil) -(fringe-mode '(4 . 4)) - -(defun hide-mode-line-if-default-hidden () - (if mode-line-default-hidden - (hide-mode-line) - (show-mode-line))) - -(add-to-list 'default-frame-alist '(border-width . 0)) -(add-to-list 'default-frame-alist '(internal-border-width . 0)) -(when (or (eq window-system 'x) - (eq window-system 'mac)) - (setq window-divider-default-bottom-width 1 - window-divider-default-right-width 1 - window-divider-default-places t) - (window-divider-mode +1)) - -(add-hook 'after-change-major-mode-hook #'hide-mode-line-if-default-hidden) - -(add-hook 'minibuffer-setup-hook #'show-mode-line) -(add-hook 'minibuffer-exit-hook #'hide-mode-line) -#+END_SRC - -*** Highlight Changes - -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))) -#+END_SRC - -*** Beacon - -I was against the idea of having flashy animations inside Emacs, but -this one is useful. It highlights the cursor when scrolling or -switching windows. - -#+BEGIN_SRC emacs-lisp -(use-package beacon - :diminish beacon-mode - :config (progn - (beacon-mode +1) - (setq beacon-blink-delay 0.25 - beacon-blink-duration 0.25 - beacon-size 20 - beacon-color "#a1b56c"))) -#+END_SRC - -*** Renaming major modes - -Diminishing major modes does not happen in the same manner as minor -modes. - -#+BEGIN_SRC emacs-lisp -(unless (version<= emacs-version "24.4") - (use-package cyphejor - :defer 2 - :config (progn - (setq cyphejor-rules `(("emacs" "ε") - ("diff" "Δ") - ("js2" "js") - ("magit-status" ,(char-to-string (seq-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 - - -** Environment Variables - -MacOS doesn’t have a reasonable way to set environment variables and -read them automatically any more. So, let’s use the -[[https://github.com/purcell/exec-path-from-shell][exec-path-from-shell]] package to set up ~exec-path~ and similar -variables from whatever my shell configuration is. - -On Windows, I like to run Emacs from the system tray menu of VcXsrv. -It starts up without an environment in this case as well. - -#+BEGIN_SRC emacs-lisp -(use-package exec-path-from-shell - :if (or (eq system-type 'darwin) - (eq system-type 'gnu/linux/windows) - (and (eq system-type 'gnu/linux) - (daemonp))) - :config (progn - (setq exec-path-from-shell-arguments '("-l")) - (exec-path-from-shell-initialize))) -#+END_SRC - -*** NixOS sandboxes - -I'm currently exploring using nix to create sandboxes for -development. This package allows using tools from inside sandboxes, -and some convenience commands for building packages and launching shells. - -#+BEGIN_SRC emacs-lisp -(use-package nix-sandbox - :config (progn - (with-eval-after-load 'flycheck - (setq flycheck-command-wrapper-function - (lambda (command) - (if (nix-current-sandbox) - (apply 'nix-shell-command (nix-current-sandbox) command) - command)) - flycheck-executable-find - (lambda (cmd) - (if (nix-current-sandbox) - (nix-executable-find (nix-current-sandbox) cmd) - (executable-find cmd))))))) -#+END_SRC - -** Keybindings - -I think =set-keyboard-coding-system= stops OS X from doing something -annoying to add accents. The modifier setup is to match my -re-arrangement of modifiers on OSX: Cmd on the outside, then -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")) -#+END_SRC - -#+BEGIN_SRC emacs-lisp -(unbind-key "") -(bind-key* "" #'compile) -(bind-key* "" #'kmacro-start-macro-or-insert-counter) -(bind-key* "" #'kmacro-end-or-call-macro) - -(bind-key* "" #'execute-extended-command) - -(unbind-key "C-z") -(bind-key* "C-" #'other-window) - -(bind-key* "C-x C-r" #'revert-buffer) -(bind-key* "C-x C-j" #'delete-indentation) -(unbind-key "C-x C-c") - -(bind-key* "C-c i" #'insert-char) -(bind-key* "M-/" #'hippie-expand) - -(unbind-key "s-h") -(unbind-key "s-n") -(unbind-key "s-p") -(unbind-key "s-w") -(bind-key* "s-k" #'kill-or-delete-this-buffer-dwim) - -(bind-key "C-M-a" #'backward-paragraph text-mode-map) -(bind-key "C-M-e" #'forward-paragraph text-mode-map) - -(bind-key* "s-x" (define-prefix-command 'super-x-map)) -(bind-key* "s-," #'switch-to-dotfiles) -(bind-key* "C-x M-x" #'execute-extended-command) -(set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) -#+END_SRC - -*** Crux - -I can replace most of the simple helper/wrapper functions in my -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)) - :config (progn - (crux-reopen-as-root-mode +1)) - :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 -(defun switch-to-dotfiles () - (interactive) - (projectile-switch-project-by-name (car (split-string (shell-command-to-string "ghq list --full-path dotfiles"))))) -#+END_SRC - -*** The Silver Searcher - -#+BEGIN_SRC emacs-lisp -(use-package ag - :defer 30 - :config (setq ag-project-root-function #'projectile-project-root)) - -(use-package wgrep-ag - :after ag) -#+END_SRC - -*** Ripgrep - -Step over Silver Search, here comes a new challenger. - -#+BEGIN_SRC emacs-lisp -(use-package ripgrep - :if (executable-find "rg")) - -(use-package projectile-ripgrep - :after (ripgrep projectile) - :if (executable-find "rg") - :bind (("C-c p s r" . projectile-ripgrep))) -#+END_SRC - -*** Projectile - -Projectile is awesome for working in projects, especially VCS-backed -ones. - -#+BEGIN_SRC emacs-lisp -(use-package projectile - :bind (("s-p" . projectile-switch-project) - ("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-mode +1) - (add-to-list 'projectile-globally-ignored-directories ".stversions") - - (defun yarn-install (&optional arg) - (interactive "P") - (projectile-with-default-dir (projectile-project-root) - (cmd-to-echo "yarn" "install"))) - - (defun yarn-add-dev (package) - (interactive "spackage: ") - (projectile-with-default-dir (projectile-project-root) - (cmd-to-echo "yarn" (concat "add --dev " package)))) - - (defun yarn-add (package) - (interactive "spackage: ") - (projectile-with-default-dir (projectile-project-root) - (cmd-to-echo "yarn" (concat "add " package)))) - - (defun yarn-run (cmd) - (interactive (list - (projectile-completing-read "command: " (alist-get 'scripts (json-read-file (expand-file-name "package.json" (projectile-project-root))))))) - (projectile-with-default-dir (projectile-project-root) - (cmd-to-echo "yarn" (concat "run " cmd)))) - - (defun ap/open-project (&optional arg) - (interactive "P") - (let ((project-dir (projectile-completing-read - "Open project: " - (ghq--find-projects)))) - (projectile-switch-project-by-name - (expand-file-name project-dir (ghq--find-root)) arg))) - - (setq projectile-switch-project-action #'projectile-commander - projectile-completion-system 'ivy - projectile-create-missing-test-files t) - - (defun ap/projectile-test-suffix (project-type) - (cond - ((member project-type '(node-yarn node-npm)) ".test") - (t (projectile-test-suffix project-type)))) - (setq projectile-test-suffix-function #'ap/projectile-test-suffix) - - (projectile-register-project-type 'node-yarn '("yarn.lock") "yarn start" "yarn test") - (projectile-register-project-type 'node '("package.json") "npm start" "npm test"))) - -(use-package counsel-projectile - :after (counsel projectile) - :config (progn - (counsel-projectile-on) - (def-projectile-commander-method ?A - "Find rg on project." - (call-interactively #'counsel-projectile-rg)) - (define-key projectile-mode-map [remap counsel-projectile-ag] #'counsel-projectile-rg))) -#+END_SRC - -*** vc - -This is nice for some things that magit doesn’t do, and for those rare -occasions that I’m working with something other than git. - -#+BEGIN_SRC emacs-lisp -(use-package vc - :defer t - :bind (("C-x v C" . vc-resolve-conflicts)) - :config (progn - (setq vc-follow-symlinks t) - (setq vc-ignore-dir-regexp (format "\\(%s\\)\\|\\(%s\\)" - vc-ignore-dir-regexp - tramp-file-name-regexp)))) -#+END_SRC - -*** git-gutter-fringe - -It’s nice to be able to see at a glance which lines of a file have -changed. This package colours the fringe. I have it set to the right -fringe so it doesn’t interfere with flycheck. - -#+BEGIN_SRC emacs-lisp -(eval-when-compile (require 'fringe-helper)) -(use-package git-gutter-fringe - :defer 2 - :diminish git-gutter-mode - :config (progn - (global-git-gutter-mode 1) - ;; places the git gutter outside the margins. - (setq-default fringes-outside-margins t) - ;; thin fringe bitmaps - (fringe-helper-define 'git-gutter-fr:added '(center repeated) - ".XXX....") - (fringe-helper-define 'git-gutter-fr:modified '(center repeated) - ".XXX....") - (fringe-helper-define 'git-gutter-fr:deleted 'bottom - ".......X" - "......XX" - ".....XXX" - "....XXXX") - (setq git-gutter-fr:side 'right-fringe))) -#+END_SRC - -*** magit - -Magit is my favourite way to use git. I use selective staging all the -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-completing-read-function #'ivy-completing-read - magit-popup-use-prefix-argument 'default - magit-display-buffer-function #'magit-display-buffer-fullcolumn-most-v1 - 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-messenger - -Popup the last commit that changed the line at point. - -#+BEGIN_SRC emacs-lisp -(use-package git-messenger - :bind* (("C-x v p" . git-messenger:popup-message)) - :config (progn - (setq git-messenger:use-magit-popup t))) -#+END_SRC - -*** git-timemachine - -This package allow me to go through a file’s history with just a few -keys. It makes it very easy to figure what what exactly was in a file -in the past. I often find it useful when I remember writing something -a particular way, but it changed later. - -#+BEGIN_SRC emacs-lisp -(use-package git-timemachine - :commands git-timemachine) -#+END_SRC - -*** ghq - -[[https://github.com/motemen/ghq][=ghq=]] clones VCS-backed projects to a common directory. It should -seem familiar to anyone who's used =go get= before. [[https://github.com/rcoedo/emacs-ghq][=emacs-ghq=]] is a -simple wrapper for it. - -#+BEGIN_SRC emacs-lisp -(use-package ghq - :if (executable-find "ghq")) -#+END_SRC - -** Files - -*** Auto-saving - -Auto-save everything to a temporary directory, instead of cluttering -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) -#+END_SRC -*** Backups - -I like to keep my backups out of regular folders. I tell emacs to use -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)) -(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)))) -#+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))))) -#+END_SRC - -*** Encoding - -UTF-8 is usually appropriate. Note that =prefer-coding-system= expects -only a coding system, not a coding system and line ending combination. - -#+BEGIN_SRC emacs-lisp -(prefer-coding-system 'utf-8) -(setq-default buffer-file-coding-system 'utf-8-auto-unix) -#+END_SRC - -*** Buffer-file management - -Ask if I want to create a directory when it doesn’t exist. This is -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)))) -(add-to-list 'find-file-not-found-functions #'my-create-non-existent-directory) -#+END_SRC - -I often want to rename or delete the file that I’m currently visiting -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))))) -#+END_SRC - -*** Whitespace - -Show bad whitespace, so that I can fix it. - -#+BEGIN_SRC emacs-lisp -(defun show-trailing-whitespace-on () - (interactive) - (setq-local show-trailing-whitespace t)) -(defun show-trailing-whitespace-off () - (interactive) - (setq-local show-trailing-whitespace nil)) -(add-hook 'prog-mode-hook #'show-trailing-whitespace-on) -(add-hook 'text-mode-hook #'show-trailing-whitespace-on) -#+END_SRC - -*** shrink-whitespace - -DWIM whitespace removal. So I don’t need =M-SPC=, =M-\= and =C-x o= -for similar things any more. - -#+BEGIN_SRC emacs-lisp -(use-package shrink-whitespace - :bind ("M-SPC" . shrink-whitespace)) -#+END_SRC - -*** Tramp - -Tramp is awesome. It makes SSH feel Unix-y. The proxy setup is so -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" (format "/run/user/%s/ssh-agent" (user-uid)))) - (setq tramp-default-method "ssh" - tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root")) - tramp-backup-directory-alist backup-directory-alist - tramp-completion-reread-directory-timeout 60 - tramp-ssh-controlmaster-options nil - 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)))) -#+END_SRC - -*** ediff - -I like a horizonal diff setup, with everything in one frame. - -#+BEGIN_SRC emacs-lisp -(use-package ediff - :defer t - :config (progn - (setq ediff-split-window-function 'split-window-horizontally - ediff-window-setup-function 'ediff-setup-windows-plain))) -#+END_SRC - -** Indentation - -Ah, a complicated topic. One day we’ll all be using elastic -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 2 - indent-tabs-mode nil) -(electric-indent-mode +1) -#+END_SRC - - -*** smart-tabs-mode - -Not related to [[smart-tab][=smart-tab=]], this mode indents with tabs and aligns -with spaces. Perfect! - -#+BEGIN_SRC emacs-lisp -(use-package smart-tabs-mode - :defer 1 - :config (progn - (smart-tabs-insinuate 'c 'cperl 'python) - (define-hook-helper php-mode () - (smart-tabs-mode indent-tabs-mode)))) -#+END_SRC - -*** editorconfig - -#+BEGIN_SRC emacs-lisp -(use-package editorconfig - :diminish "EC" - :config (editorconfig-mode 1)) -#+END_SRC - -*** dtrt-indent-mode - -Sometimes people use different indentation settings. [[https://github.com/jscheid/dtrt-indent][dtrt-indent]] -guesses the correct settings for me. - -#+BEGIN_SRC emacs-lisp -(use-package dtrt-indent - :config (progn - (define-hook-helper after-change-major-mode () - (unless (and (boundp editorconfig-mode) - editorconfig-mode) - (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 - -*** password-store - -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))) -#+END_SRC -** Buffers - -*** Ibuffer -Ibuffer is quite nice for listing all buffers. - -#+BEGIN_SRC emacs-lisp -(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))))) -#+END_SRC - -*** Relative Buffer names - -#+BEGIN_SRC emacs-lisp -(use-package relative-buffers - :defer 15 - :config (progn - (global-relative-buffers-mode))) -#+END_SRC -*** Narrowing - -Enable it without prompting - -#+BEGIN_SRC emacs-lisp -(put 'narrow-to-defun 'disabled nil) -(put 'narrow-to-page 'disabled nil) -(put 'narrow-to-region 'disabled nil) -#+END_SRC - -*** ace-window - -I don’t often have many windows open at once, but when I do, -=ace-window= is really nice to jump around them in the same way that -=ace-jump= or =avy= work. -#+BEGIN_SRC emacs-lisp -(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)))) -#+END_SRC - -** Windows - -Scrolling is tricky. I use this setup to help me keep track of the -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 160 - frame-resize-pixelwise nil) -(if (boundp 'ns-pop-up-frames) - (setq ns-pop-up-frames nil)) -#+END_SRC - -*** eyebrowse - -Workspaces, a bit like dwm. On Windows and Linux (at least the WMs -I'm likely to use), super+{0-9} are taken from the OS, so use meta -instead. On macOS, super makes a lot of sense, as it's used by most -programs to switch between program windows or views. - -#+BEGIN_SRC emacs-lisp -(use-package eyebrowse - :config (progn - (setq eyebrowse-new-workspace t) - (when (eq system-type 'darwin) - (bind-keys - ("s-0" . eyebrowse-switch-to-window-config-0) - ("s-1" . eyebrowse-switch-to-window-config-1) - ("s-2" . eyebrowse-switch-to-window-config-2) - ("s-3" . eyebrowse-switch-to-window-config-3) - ("s-4" . eyebrowse-switch-to-window-config-4) - ("s-5" . eyebrowse-switch-to-window-config-5) - ("s-6" . eyebrowse-switch-to-window-config-6) - ("s-7" . eyebrowse-switch-to-window-config-7) - ("s-8" . eyebrowse-switch-to-window-config-8) - ("s-9" . eyebrowse-switch-to-window-config-9))) - (bind-keys* - ("M-0" . eyebrowse-switch-to-window-config-0) - ("M-1" . eyebrowse-switch-to-window-config-1) - ("M-2" . eyebrowse-switch-to-window-config-2) - ("M-3" . eyebrowse-switch-to-window-config-3) - ("M-4" . eyebrowse-switch-to-window-config-4) - ("M-5" . eyebrowse-switch-to-window-config-5) - ("M-6" . eyebrowse-switch-to-window-config-6) - ("M-7" . eyebrowse-switch-to-window-config-7) - ("M-8" . eyebrowse-switch-to-window-config-8) - ("M-9" . eyebrowse-switch-to-window-config-9)) - (eyebrowse-mode +1))) -#+END_SRC - -** Sessions - -*** Desktop -Save my Emacs session and restore it on startup. - -#+BEGIN_SRC emacs-lisp -(use-package desktop - :ensure nil - :config (progn - (setq desktop-dirname (expand-file-name "desktop/" user-emacs-directory) - desktop-base-file-name "emacs.desktop" - desktop-base-lock-name "lock" - desktop-path (list desktop-dirname) - desktop-save 'if-exists - desktop-files-not-to-save "^$" - desktop-load-locked-desktop nil) - (unless (file-directory-p desktop-dirname) - (make-directory desktop-dirname)) - (desktop-save-mode 1))) -#+END_SRC - -*** winner - -Undo, for window-based commands. - -#+BEGIN_SRC emacs-lisp -(use-package winner - :config (setq winner-boring-buffers '("*Completions*" "*Help*" "*Apropos*" "*Buffer List*" "*info*" "*Compile-Log*")) - :init (progn - (winner-mode 1))) -#+END_SRC - -*** windmove - -Directional window movement - -#+BEGIN_SRC emacs-lisp -(use-package windmove - :bind (("S-" . windmove-left) - ("S-" . windmove-right) - ("S-" . windmove-up) - ("S-" . windmove-down))) -#+END_SRC -** Blogging - -I have a [[https://alanpearce.uk][blog]] that I publish with hugo. - -#+BEGIN_SRC emacs-lisp -(use-package easy-hugo - :config (setq easy-hugo-basedir (car (split-string (shell-command-to-string "ghq list --full-path alanpearce.uk"))) - easy-hugo-url "https://alanpearce.uk" - easy-hugo-default-ext ".md")) -#+END_SRC - -** Completion - -Make built-in completion a bit more intelligent, by adding substring -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) -#+END_SRC - -*** Company - -The main choices for automatic completion in Emacs are company and -auto-complete-mode. I’ve not tried auto-complete-mode as company -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-on) - (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-gtags - company-etags company-keywords) company-oddmuse) - company-frontends '(company-pseudo-tooltip-unless-just-one-frontend - company-preview-frontend - company-echo-metadata-frontend) - 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-selection-wrap-around t))) -#+END_SRC - -#+BEGIN_SRC emacs-lisp -(use-package company-web - :after company) -#+END_SRC - -;;; * Dates: & Times - -*** Calendar - -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))) -#+END_SRC - -Sometimes I want to insert a date or time into a buffer. -#+BEGIN_SRC emacs-lisp -(defun insert-date (prefix) - "Insert the current date. With prefix-argument, use British format. With - 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)))) - -(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)))) -#+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)) -#+END_SRC - -** Directories - -Dired works quite nicely, but not always in the way I want. I don’t -like having so many prompts for recursive operations. Also, when I -have two dired windows open, assume that I’m going to be -copying/moving files between them. - -#+BEGIN_SRC emacs-lisp -(use-package dired - :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 (if delete-by-moving-to-trash - 'always - 'top) - dired-listing-switches "-alh") - (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)) - -(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 - dired-bind-jump nil)) - :init (progn - (add-hook 'dired-mode-hook #'turn-on-dired-omit-mode))) -#+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)))) -#+END_SRC - -*** Disk usage - -Combine dired and du (disk usage). - -#+BEGIN_SRC emacs-lisp -(use-package dired-du - :after dired - :config (progn - (setq dired-du-size-format t))) -#+END_SRC - -*** Dired-narrow -One can already use dired with wildcards to browse a filtered -directory listing, but it opens a new buffer. Dired-narrow is a -slightly nicer interface: with a currently-open dired buffer, use =/= -to start filtering, =RET= to complete the filter and =g= to refresh -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)))) -#+END_SRC - -** Documentation - -*** ehelp - -ehelp is a less well-known package that’s part of Emacs and slightly -improves the normal help commands, mostly by making quitting them easier. - -#+BEGIN_SRC emacs-lisp -(use-package ehelp - :bind-keymap ("C-h" . ehelp-map)) -#+END_SRC - -*** discover-my-major - -A nicer way to browse keybindings for major modes. - -#+BEGIN_SRC emacs-lisp -(use-package discover-my-major - :bind ("" . discover-my-major)) -#+END_SRC - -*** which-key - -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))) -#+END_SRC - -*** eldoc - -Documentation in the echo-area (where the minibuffer is displayed) is -rather useful. - -#+BEGIN_SRC emacs-lisp -(use-package eldoc - :commands (eldoc-mode) - :diminish eldoc-mode - :config (progn - (setq eldoc-idle-delay 0.1) - (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) -#+END_SRC -** Mail - -*** Gnus - -At work, I use gnus for email. Some of the setup is specific to my -workplace, so I keep it in a host-specific, GPG-encrypted file. - -#+BEGIN_SRC emacs-lisp -(use-package gnus - :config (progn - (setq gnus-gcc-mark-as-read t - mml-secure-openpgp-encrypt-to-self t - send-mail-function #'smtpmail-send-it - message-send-mail-function #'smtpmail-send-it))) - -(with-eval-after-load "gnus-mime" - (define-key gnus-mime-button-map " " #'gnus-mime-view-part-externally)) - -(with-eval-after-load "mailcap" - (when (eq system-type 'darwin) - (mailcap-add-mailcap-entry "application" "pdf" '((viewer . "/usr/bin/qlmanage -p %s") (type . "application/pdf"))))) - -(with-eval-after-load "mm-decode" - (add-to-list 'mm-discouraged-alternatives "text/html") - (add-to-list 'mm-discouraged-alternatives "text/richtext")) -#+END_SRC - -*** BBDB - -As I'm using Emacs for email, it makes sense to have contact -information here as well. - -#+BEGIN_SRC emacs-lisp -(use-package bbdb - :config (progn - (bbdb-initialize 'gnus 'message 'pgp) - (bbdb-mua-auto-update-init 'gnus 'message) - (setq bbdb-send-mail-style 'gnus - bbdb-complete-mail-allow-cycling t - bbdb-mua-auto-update t - bbdb-mua-update-interactive-p '(query . create) - bbdb-message-all-addresses t - bbdb-offer-save t - bbdb-offer-to-create 1))) -#+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.") -(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 " - " nil t) - (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)))) - -(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))) - -(defun process-exit-code (program &rest args) - "Run PROGRAM with ARGS and return the exit code" - (apply 'call-process program nil nil nil args)) - -(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))) - -(bind-key* "M-!" #'shell-execute) -(bind-key* "C-x r M-w" #'copy-rectangle) -#+END_SRC - -*** Auxillary Configuration - -#+BEGIN_SRC emacs-lisp -(require 'pinentry) - -(defvar have-private-key - (file-exists-p (expand-file-name "secring.gpg" "~/.gnupg/"))) - -(defvar gpg-agent-ssh-sock - (or (getenv "GPG_AGENT_INFO") - (concat "/run/user/" (number-to-string (user-uid)) "/gnupg/S.gpg-agent.ssh"))) - -(defun read-gpg-file (file) - (let ((file-to-decrypt (expand-file-name file user-emacs-directory)) - (ctx (epg-make-context epa-protocol))) - (if (file-exists-p file-to-decrypt) - (epg-decrypt-file ctx file-to-decrypt nil) - (message "Decrypting %s...failed" file-to-decrypt) - (error "File %s does not exist" file-to-decrypt)))) - -(defun load-gpg (file) - (if have-private-key - (load file) - (message "WARNING: Couldn't load %s (No gpg key found)" file))) - -; load this in a post-frame hook because gpg-agent asks for a password on first -; startup and caches it. Don't want emacs daemon to hang because of gpg-agent. -(defun load-private-data () - (interactive) - (if (not (file-exists-p (expand-file-name (concat (system-name) ".el.gpg") user-emacs-directory))) - (message "No encrypted configuration matches system name `%s'" (system-name)) - (if (not have-private-key) - (message "ERROR: Private GPG key not found") - (unless (or (getenv "GPG_AGENT_INFO") - (getenv "SSH_AUTH_SOCK")) - (start-process "gpg-agent" nil "gpg-agent" "--daemon") - (setenv "SSH_AUTH_SOCK" gpg-agent-ssh-sock)) - (setq password-cache-expiry nil) - (unless (file-exists-p (concat pinentry--socket-dir "pinentry")) - (pinentry-start) - (add-hook 'kill-emacs-hook 'pinentry-stop)) - (add-to-list 'load-suffixes ".el.gpg") - (load-gpg (expand-file-name (system-name) user-emacs-directory))))) - -(defun first-frame-hook (frame) - (remove-hook 'after-make-frame-functions #'first-frame-hook) - (run-at-time nil nil 'load-private-data)) - -(if (eq 1 (length (frame-list))) - (add-hook 'after-init-hook #'load-private-data) - (add-hook 'after-make-frame-functions #'first-frame-hook)) -#+END_SRC - -** Minibuffer - -Sometimes I want to use the minibuffer, but I’m already inside it. -Fortunately, this is possible. Of course, I need to know how many -minibuffers there are on the stack. - -#+BEGIN_SRC emacs-lisp -(setq enable-recursive-minibuffers t) -(minibuffer-depth-indicate-mode t) -#+END_SRC - -This avoids some issue with the minibuffer and the point being behind -the prompt. I don’t remember what exactly. -#+BEGIN_SRC emacs-lisp -(setq minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)) -#+END_SRC - -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)) -#+END_SRC - -*** swiper/ivy - -Ivy is the new kid on the completion block. It seems to be a strong -replacement for helm so far. - -#+BEGIN_SRC emacs-lisp -(use-package swiper - :bind (("C-s" . swiper) - ("C-r" . swiper) - ("C-=" . swiper)) - :diminish ivy-mode - :demand t - :config (progn - (ivy-mode 1) - (setq ivy-re-builders-alist '((t . ivy--regex-plus)) - ivy-extra-directories '("./")) - (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 "" #'counsel-M-x) - (bind-key "C-c M-x" #'execute-extended-command) - (bind-key "C-x C-f" #'counsel-find-file) - (bind-key "M-y" #'counsel-yank-pop) - (bind-key "C-x i" #'counsel-imenu) - (bind-key "M-y" #'ivy-next-line ivy-minibuffer-map) - (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)))) - (setq counsel-rg-base-command "rg -i --no-heading --line-number --hidden %s ."))) -#+END_SRC - - -*** smex - -Smex is my favourite way to use =M-x=. Counsel’s =counsel-M-x= -function uses it internally, so I’m keeping it around, even though I -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")))) -#+END_SRC - -*** cmd-to-echo - -I’ve been looking for some way to run programming projects (mostly -node.js) inside emacs. =cmd-to-echo= seems great for this, as new -output pops up in the echo area. - -#+BEGIN_SRC emacs-lisp -(use-package cmd-to-echo - :commands (cmd-to-echo) - :config (setq cmd-to-echo-add-output-to-process-buffers t)) -#+END_SRC -** Modes - -Setup some modes for systemd files -#+BEGIN_SRC emacs-lisp -(add-to-list 'auto-mode-alist '("\\.service\\'" . conf-mode)) -(add-to-list 'auto-mode-alist '("\\.target\\'" . conf-mode)) -(add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-mode)) -#+END_SRC - -=direnv=’s files are basically shell scripts, it’s a nice way to -set environment variables for projects. -#+BEGIN_SRC emacs-lisp -(add-to-list 'auto-mode-alist '("\\.envrc\\'" . sh-mode)) -#+END_SRC - -Some modes that I don’t really customise much, mostly for -configuration files. -#+BEGIN_SRC emacs-lisp -(use-package haskell-mode - :mode (("\\.hs\\'" . haskell-mode))) - -(use-package dockerfile-mode - :mode (("Dockerfile\\'" . dockerfile-mode))) - -(use-package nix-mode - :mode (("\\.nix\\'" . nix-mode))) - -(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))) - -(use-package lua-mode - :defer t) - -(use-package ruby-mode - :mode (("\\.rb\\'" . ruby-mode) - ("\\.cap\\'" . ruby-mode))) - -(use-package go-mode - :mode (("\\.go\\'" . go-mode))) - -(use-package jinja2-mode - :mode (("\\.j2\\'" . jinja2-mode) - ("\\.jinja\\'" . jinja2-mode))) - -(use-package scss-mode - :defer t - :config (progn - (setq scss-compile-at-save nil))) - -(use-package toml-mode - :mode ("\\.toml\\'" . toml-mode)) - -(use-package 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)) - -(define-derived-mode saltstack-mode yaml-mode "Salt") -(add-to-list 'auto-mode-alist '("\\.sls\\'" . saltstack-mode)) -#+END_SRC - -*** ledger - -I use [[http://ledger-cli.org/][=ledger=]] to manage my finances. It has an Emacs mode, which -works really nicely. - -#+BEGIN_SRC emacs-lisp -(use-package ledger-mode - :mode ("\\.ledger\\'" . ledger-mode) - :functions ledger-report - :init (progn - (defun open-budget () - (interactive) - (projectile-switch-project-by-name "~/Sync/Default") - (find-file (expand-file-name "ledger/my.ledger" (projectile-project-root))) - (ledger-report "Budget (Cumulative)" nil))) - :config (progn - (setq ledger-use-iso-dates t - ledger-post-use-completion-engine :ido - ledger-reconcile-default-commodity "€" - ledger-clear-whole-transactions t - ledger-narrow-on-reconcile t - ledger-reports `(("Monthly Expenses" "ledger -f %(ledger-file) reg -M \\^Flex --real -X EUR -l \"payee != 'Opening Balances'\"") - ("Average Monthly Expenses (Past 12 Months)" ,(concat "ledger -f %(ledger-file) -b " - (format-time-string "%Y-%m" (time-add (current-time) (days-to-time -365))) - " --monthly --average balance ^Flex")) - ("Expenses:This Month" "ledger -f %(ledger-file) bal \\^Flex -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 \\^Assets:Budget$") - ("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 - -#+BEGIN_SRC emacs-lisp -(use-package markdown-mode - :defer t - :config (progn - (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) -#+END_SRC - -*** Lentic - -Multiple different views of the same file. Can be used for a kind of -inverse literate programming. - -#+BEGIN_SRC emacs-lisp -(use-package lentic - :config (global-lentic-mode)) -#+END_SRC - -*** Org - -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")) - - org-default-notes-file (concat org-directory "/notes") - - ;; ‘Remember’: new items at top - org-reverse-note-order t - - org-modules '(org-protocol) - - ;; Add time done to ‘done’ tasks - org-log-done 'time - - org-list-allow-alphabetical t - - org-adapt-indentation nil - - org-pretty-entities t - - org-table-duration-custom-format 'seconds - - org-src-fontify-natively nil - - org-export-have-math t - - org-blank-before-new-entry '((heading . t) - (plain-list-item . auto)) - org-fontify-done-headline t - - org-goto-interface 'outline-path-completion - - org-outline-path-complete-in-steps nil - - 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))) - -(use-package org-src - :ensure nil - :after org - :config (progn - (bind-key "C-x C-s" #'org-edit-src-exit org-src-mode-map))) -#+END_SRC - -***** org-babel - -Org’s babel feature is really nice. I use it for this file, and I can -use it to communicate between programming languages. Sometime I hope -to have my =ledger= setup in an org file with some graph processing -with R or something. - -#+BEGIN_SRC emacs-lisp -(use-package ob-core - :defer t - :ensure nil - :config (progn - (org-babel-do-load-languages 'org-babel-load-languages - '((ledger . t) - (sh . t))) - (setq org-src-tab-acts-natively t - org-edit-src-content-indentation 0 - org-src-preserve-indentation t))) -#+END_SRC - -***** org-journal - -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" - org-journal-dir "~/Sync/Default/Documents/journal") - - (define-hook-helper org-journal-mode () - (use-variable-fonts) - (text-scale-adjust 4) - (if smartparens-strict-mode - (smartparens-strict-mode -1)) - (if show-smartparens-mode - (show-smartparens-mode -1))) - (defun org-journal-display-entry-yesterday () - "Show org-journal entry for yesterday" - (interactive) - (org-journal-read-or-display-entry (yesterday-time))))) -#+END_SRC - - -** Programming -*** flycheck - -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 mode-enabled)) - (setq flycheck-indication-mode 'left-fringe) - (with-eval-after-load 'git-gutter-fringe - (fringe-helper-define 'flycheck-fringe-bitmap-double-arrow '(center repeated) - ".XXX....")) - (if (executable-find "eslint_d") - (setq flycheck-javascript-eslint-executable "eslint_d")))) -#+END_SRC - -**** flycheck-pos-tip - -Show flycheck errors in a little popup, so I don't lose my place - -#+BEGIN_SRC emacs-lisp -(use-package flycheck-pos-tip - :after flycheck - :config (progn - (setq flycheck-display-errors-delay 0.5) - (flycheck-pos-tip-mode 1))) -#+END_SRC - -**** flycheck-flow - -#+BEGIN_SRC emacs-lisp -(use-package flycheck-flow - :after js2-mode - :if (executable-find "flow") - :config (progn - (flycheck-add-next-checker 'javascript-eslint 'javascript-flow))) -#+END_SRC - -*** golang - -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 - (define-hook-helper go-mode () - (set (make-local-variable 'company-backends) - '(company-go))))) - -(use-package go-eldoc - :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))) - - -#+END_SRC - -*** ggtags - -A nice completion backend for programming modes. - -#+BEGIN_SRC emacs-lisp -(use-package ggtags - :if (executable-find "gtags") - :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 - -*** dumb-jump - -A "clever" way of implementing go-to-definition across languages: use -a project-wide text search and apply heuristics to the results to -guess a definition. - -#+BEGIN_SRC emacs-lisp -(use-package dumb-jump - :bind (("M-g o" . dumb-jump-go-other-window) - ("M-g j" . dumb-jump-go) - ("M-g x" . dumb-jump-go-prefer-external) - ("M-g z" . dumb-jump-go-prefer-external-other-window)) - :config (setq dumb-jump-selector 'ivy)) -#+END_SRC - -*** imenu-anywhere - -This is like imenu, but shows functions (or similar top-level -entities) across buffers in the same project. Neat! - -#+BEGIN_SRC emacs-lisp -(use-package imenu-anywhere - :bind ("C-x C-." . ivy-imenu-anywhere)) -#+END_SRC -*** Lisps - -**** All - -Lisp modes don’t seem to have a common ancestor. So I made a custom -hook which I trigger in every lispy-mode. - -#+BEGIN_SRC emacs-lisp -(defcustom lisp-mode-common-hook nil - "Hook run when entering any Lisp mode." - :type 'hook - :group 'lisp) - -(create-hook-helper lisp-mode-setup () - :hooks (emacs-lisp-mode-hook - scheme-mode-hook - lisp-mode-hook - clojure-mode-hook) - (run-hooks 'lisp-mode-common-hook)) -#+END_SRC - -***** Redshank - -Lisp syntax allows for really easy refactoring. Redshank gives some -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))) -#+END_SRC - -**** Emacs Lisp - -Customise the modeline-display of =emacs-lisp-mode=. Then make sure -it runs the common lisp hooks. - -#+BEGIN_SRC emacs-lisp -(add-hook 'emacs-lisp-mode-hook #'eldoc-mode) -#+END_SRC - -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))) -#+END_SRC - -Interactive elisp - -#+BEGIN_SRC emacs-lisp -(use-package ielm - :defer t - :ensure nil - :config (progn - (define-hook-helper ielm-mode () - (run-hooks 'lisp-mode-common-hook)))) -#+END_SRC - -**** Scheme & Lisp - -I don’t work with these as often as I would like - -#+BEGIN_SRC emacs-lisp -(define-hook-helper lisp-mode () - (set (make-local-variable 'lisp-indent-function) - #'common-lisp-indent-function)) -#+END_SRC - -***** geiser - -A REPL thing for Scheme. Hopefully I’ll get to use it more in the -future. - -#+BEGIN_SRC emacs-lisp -(use-package geiser - :commands (geiser-mode - geiser - run-geiser - run-racket)) -#+END_SRC - -***** slime - -A REPL thing (and more) for Lisp. - -#+BEGIN_SRC emacs-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 '(slime-fancy slime-asdf))) - (setq common-lisp-hyperspec-root "file://opt/local/share/doc/lisp/HyperSpec-7-0/" - inferior-lisp-program (or (executable-find "sbcl") - (executable-find "ccl64"))))) -#+END_SRC - -**** Clojure - -#+BEGIN_SRC emacs-lisp -(use-package clojure-mode - :defer t - :init (progn - (define-hook-helper cider-repl-mode () - (highlight-changes-mode -1)))) - -(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 - (define-hook-helper clojure-mode () - (clj-refactor-mode 1)))) -#+END_SRC - -***** cider - -A REPL thing for Clojure - -#+BEGIN_SRC emacs-lisp -(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))) -#+END_SRC - -*** Auto-compile - -Auto-compile emacs lisp when saving. -#+BEGIN_SRC emacs-lisp -(use-package auto-compile - :defer t - :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) -#+END_SRC - -*** cc-mode - -Although I don’t use C or C++, setting up the mode is helpful because -quite a few other modes are derived from it. - -#+BEGIN_SRC emacs-lisp -(use-package cc-mode - :defer 5 - :config (progn - (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 - -It’s nice to be able to quickly evaluate some code. Although I don’t -really seem to use it. -#+BEGIN_SRC emacs-lisp -(use-package quickrun - :bind (("C-c C-e" . quickrun))) -#+END_SRC - -*** Scala - -Let’s try using Scala. - -#+BEGIN_SRC emacs-lisp -(use-package scala-mode) -#+END_SRC - -And add ensime, an IDE-style environment. - -#+BEGIN_SRC emacs-lisp -(use-package ensime) -#+END_SRC - -*** Web development - -**** js2-mode - -This mode is really great for editing Javascript. It turns code into -an AST internally, so it can work with it almost like a lisp. - -#+BEGIN_SRC emacs-lisp -(use-package js2-mode - :mode (("\\.js\\'" . js2-mode)) - :interpreter ("node" . js2-mode) - :functions (js2-next-error - js2--struct-put) - :config (progn - (define-key js2-mode-map [menu-bar Javascript] nil) - (add-hook 'js2-mode-hook #'js2-imenu-extras-mode) - (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) - (setq js2-basic-offset 2 - js-switch-indent-offset 2 - js2-include-node-externs t - js2-highlight-level 1 - js2-strict-missing-semi-warning nil))) -#+END_SRC - -***** rjsx-mode - -A set of advice for js2-jsx-mode to work better with React. - -#+BEGIN_SRC emacs-lisp -(use-package rjsx-mode - :after js2-mode - :if (fboundp #'js2--struct-put) - :mode (("\\.jsx\\'" . rjsx-mode))) -#+END_SRC - -***** js2-refactor - -Thanks to the AST provided by js2-mode, refactoring is possible. This -library implements some refactorings. - -#+BEGIN_SRC emacs-lisp -(use-package js2-refactor - :after js2-mode - :config (progn - (bind-key "C-k" #'js2r-kill js2-mode-map) - (add-hook 'js2-mode-hook #'js2-refactor-mode) - (js2r-add-keybindings-with-prefix "C-c C-m"))) -#+END_SRC - -***** add-node-modules-path - -Inside a javascript project, it's common to install tools locally to -the project. This will allows emacs to find their executables. - -#+BEGIN_SRC emacs-lisp -(use-package add-node-modules-path - :config (progn - (add-hook 'js2-mode-hook #'add-node-modules-path))) -#+END_SRC - -***** Flow - -#+BEGIN_SRC emacs-lisp -(use-package flow-minor-mode - :after js2-mode - :config (progn - (add-hook 'js2-mode-hook #'flow-minor-enable-automatically))) -#+END_SRC - -***** Indium - -Javascript with an inferior node.js process and a debugger? Awesome. - -To debug with node, use version 6.9.1 or later of node and run it with -~--inspect~ and, to break on the first line, ~--debug-brk~. - -For Chrom*, it needs to be launched with -~--remote-debugging-port=9222~ - -Node will tell you to open an URL in Chrome: - -~chrome-devtools://inspector.html?...&ws=127.0.0.1:PORT/PATH~ - -Instead, do this: - -~M-x indium-connect-to-nodejs RET 127.0.0.1 RET PORT RET~ - -#+BEGIN_SRC emacs-lisp -(use-package indium - :diminish (indium-interaction-mode . "In") - :config (progn - (add-hook 'js2-mode-hook #'indium-interaction-mode))) -#+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))) -#+END_SRC - -**** tern - -Tern understands javascript. It adds really clever documented -completions, besides other IDE-like things. - -#+BEGIN_SRC emacs-lisp -(use-package tern - :diminish tern-mode - :if (executable-find "tern") - :defer 5 - :config (progn - (setq tern-command (list (executable-find "tern"))) - (create-hook-helper tern-mode-on () - :hooks (web-mode-hook - js2-mode-hook) - (tern-mode +1)))) - -(with-eval-after-load '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))) -#+END_SRC - -**** restclient - -Restclient is really nice. It’s like a scratchpad for HTTP api -calls. Feels a bit like using =org-babel=. I wonder if there’s an -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))) - -(use-package company-restclient - :after (company restclient) - :init (add-to-list 'company-backends #'company-restclient t)) -#+END_SRC - -**** sgml-mode - -This is for HTML, since old versions of HTML were derived from SGML. -#+BEGIN_SRC emacs-lisp -(use-package sgml-mode - :defer t - :config (setq sgml-basic-offset 2)) -#+END_SRC - -**** emmet-mode - -Emmet is really nice to write HTML quickly. Especially with -frameworks that require multiple nested elements to do anything useful. -#+BEGIN_SRC emacs-lisp -(use-package emmet-mode - :commands (emmet-mode) - :diminish (emmet-mode . " >") - :init (progn - (setq emmet-indentation 2 - emmet-self-closing-tag-style " /") - (add-hook 'sgml-mode-hook #'emmet-mode) - (add-hook 'web-mode-hook #'emmet-mode) - (add-hook 'css-mode-hook #'emmet-mode))) -#+END_SRC - -**** web-mode - -This mode handles just about every templating language out ther, which -is really nice, because it handles the HTML part the same way in all -of them as well. - -#+BEGIN_SRC emacs-lisp -(use-package web-mode - :mode (("/views/.*\\.php\\'" . web-mode) - ("\\.html\\'" . web-mode) - ("/templates/.*\\.php\\'" . web-mode) - ("\\.ejs\\'" . web-mode) - ("\\.njk\\'" . web-mode)) - :config (progn - (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 - 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=. - -#+BEGIN_SRC emacs-lisp -(define-derived-mode twig-mode web-mode "Twig") -(add-to-list 'auto-mode-alist '("\\.html\\.twig\\'" . twig-mode)) -#+END_SRC - -*** Live coding - -Sometimes I might want to show off my emacs usage. - -#+BEGIN_SRC emacs-lisp -(defun live-coding () - (interactive) - (ap/set-fonts "SF Mono" 18 nil nil t 0.1) - (global-command-log-mode 1)) - -(defun live-coding-stop () - (interactive) - (ap/set-fonts-according-to-system) - (global-command-log-mode -1)) -#+END_SRC - -**** command-log-mode - -#+BEGIN_SRC emacs-lisp -(use-package command-log-mode - :defines command-log-mode-key-binding-open-log - :init (progn - (setq command-log-mode-key-binding-open-log nil - command-log-mode-auto-show t - command-log-mode-is-global t))) -#+END_SRC - -** Spelling - -#+BEGIN_SRC emacs-lisp -(use-package ispell - :bind (("" . ispell-word)) - :config (progn - (cond - ((executable-find "aspell") (setq ispell-program-name "aspell" - ispell-dictionary "british" - ispell-really-aspell t - ispell-really-hunspell nil)) - ((executable-find "hunspell") (setq ispell-program-name "hunspell" - ispell-really-aspell nil - ispell-really-hunspell t))))) -#+END_SRC - -#+BEGIN_SRC emacs-lisp -(use-package flyspell - :diminish "﹏" - :config (progn - (defun flyspell-detect-ispell-args (&optional run-together) - "If RUN-TOGETHER is true, spell check the CamelCase words. - Please note RUN-TOGETHER will make aspell less capable. So it should only be used in prog-mode-hook." - (let (args) - (when ispell-program-name - (cond - ((string-match "aspell$" ispell-program-name) - (setq args (list "--sug-mode=ultra")) - (if run-together - (setq args (append args '("--run-together" "--run-together-limit=16" "--run-together-min=2"))))) - ((string-match "hunspell$" ispell-program-name) - (setq args nil)))) - args)) - ;; `ispell-extra-args' is *always* used when start CLI aspell process - (setq-default ispell-extra-args (flyspell-detect-ispell-args t)) - ;; (setq ispell-cmd-args (flyspell-detect-ispell-args)) - (defadvice ispell-word (around my-ispell-word activate) - (let ((old-ispell-extra-args ispell-extra-args)) - (ispell-kill-ispell t) - ;; use emacs original arguments - (setq ispell-extra-args (flyspell-detect-ispell-args)) - ad-do-it - ;; restore our own ispell arguments - (setq ispell-extra-args old-ispell-extra-args) - (ispell-kill-ispell t))) - - (defadvice flyspell-auto-correct-word (around my-flyspell-auto-correct-word activate) - (let* ((old-ispell-extra-args ispell-extra-args)) - (ispell-kill-ispell t) - ;; use emacs original arguments - (setq ispell-extra-args (flyspell-detect-ispell-args)) - ad-do-it - ;; restore our own ispell arguments - (setq ispell-extra-args old-ispell-extra-args) - (ispell-kill-ispell t))) - (setq flyspell-issue-message-flag nil) - - (defun fly-text-mode-hook-setup () - ;; Turn off RUN-TOGETHER option when spell check text-mode - (setq-local ispell-extra-args (flyspell-detect-ispell-args))) - (add-hook 'text-mode-hook 'fly-text-mode-hook-setup) - (add-hook 'prog-mode-hook #'flyspell-prog-mode))) -#+END_SRC - -*** Style checking - -[[https://github.com/ValeLint/vale][Vale]] is a linter, but for prose. Neat idea! Salesman is a bad term. - -#+BEGIN_SRC emacs-lisp -(use-package flycheck-vale - :if (executable-find "vale") - :config (progn - (add-to-list 'flycheck-vale-modes 'org-mode) - (add-to-list 'flycheck-vale-modes 'org-journal-mode) - (flycheck-vale-setup))) -#+END_SRC - -** Scripting - -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) - -(use-package sh-script - :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)) -#+END_SRC - -#+BEGIN_SRC emacs-lisp -(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) -#+END_SRC - -*** eshell - -I should try to get into the habit of using this more. It’s really -nice, when I remember to use it. - -#+BEGIN_SRC emacs-lisp -(use-package eshell - :bind ("C-c s" . eshell) - :defer 10 - :functions (eshell/pwd) - :config (progn - (setq eshell-directory-name "~/.emacs.d/eshell" - eshell-prompt-function (lambda () - (concat - (eshell/pwd) - "\n$ "))) - (define-hook-helper eshell-load () - (bind-key "C-c C-l" #'counsel-esh-history eshell-mode-map)))) - -(use-package em-smart - :ensure nil - :commands eshell-smart-initialize - :init (progn - (add-hook 'eshell-load-hook #'eshell-smart-initialize)) - :config (progn - (setq eshell-where-to-jump 'begin - eshell-review-quick-commands nil - eshell-smart-space-goes-to-end t))) - -(autoload #'eshell/cd "em-dirs") -(defun eshell-goto-current-dir (&optional arg) - (interactive "P") - (let ((dir default-directory)) - (eshell arg) - (eshell/cd dir))) -(bind-key "C-c S" #'eshell-goto-current-dir) - - -#+END_SRC - -**** Shells - -#+BEGIN_SRC emacs-lisp -(use-package shell - :defer t - :ensure nil - :config (define-key shell-mode-map - (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) - -(use-package comint - :defer t - :ensure nil - :config (bind-key "C-c C-l" #'counsel-shell-history comint-mode-map)) - -(defun comint-delchar-or-eof-or-kill-buffer (arg) - (interactive "p") - (if (null (get-buffer-process (current-buffer))) - (kill-buffer) - (comint-delchar-or-maybe-eof arg))) -#+END_SRC - -** Text editing - -Emacs has an editor within. - -#+BEGIN_SRC emacs-lisp -(put 'upcase-region 'disabled nil) -(put 'downcase-region 'disabled nil) -(setq sentence-end-double-space t - line-move-visual nil) -(setq-default truncate-lines t) -#+END_SRC - -*** align - -=Align= is a useful command to line things up, once given some rules. -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)))))) -#+END_SRC - -*** Clipboard - -I like to use the clipboard more than the primary selection in X11. - -#+BEGIN_SRC emacs-lisp -(setq select-enable-clipboard t - save-interprogram-paste-before-kill t) -(if (functionp '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 - -*** Selection - -I’m quite used to deleting text by selecting it and typing. Emacs has -a mode for that. - -#+BEGIN_SRC emacs-lisp -(use-package delsel - :config (delete-selection-mode t)) -#+END_SRC - -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)) -#+END_SRC - -I find that =zap-up-to-char= normally makes more sense to me than -=zap-to-char=. - -#+BEGIN_SRC emacs-lisp -(use-package misc - :ensure nil - :bind (("M-z" . zap-up-to-char) - ("M-Z" . zap-to-char))) -#+END_SRC - -Expanding the region by semantic units was something I quite liked -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)) -#+END_SRC - -*** avy - -Avy is a really nice way to move around files, like ace-jump-mode, but -somehow I prefer it. - -#+BEGIN_SRC emacs-lisp -(use-package avy - :defer 5 - :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 ?\;)))) -#+END_SRC - -**** ace-link - -Visit any link. Despite the name, this works with avy. - -#+BEGIN_SRC emacs-lisp -(use-package ace-link - :after avy - :config (progn - (ace-link-setup-default) - (with-eval-after-load "gnus" - (bind-key "M-o" #'ace-link-gnus gnus-summary-mode-map) - (bind-key "M-o" #'ace-link-gnus gnus-article-mode-map)))) -#+END_SRC - -*** goto-chg - -This is like popping the mark, only it filters to only change areas -and doesn’t go back to the same place more than once. - -#+BEGIN_SRC emacs-lisp -(use-package goto-chg - :bind ("C-c C-SPC" . goto-last-change)) -#+END_SRC - -*** beginend - -In special buffers, I would rather have =M->= and =M-<= goto the -logical beginning/end rather than the physical ones. - -#+BEGIN_SRC emacs-lisp -(use-package beginend - :config (progn - (beginend-setup-all))) -#+END_SRC - -*** multiple-cursors - -I mentioned before that I’d used Sublime Text before. Multiple -cursors was one of my favourite features, so I was really happy when I -saw that multiple-cursors was released for Emacs. - -#+BEGIN_SRC emacs-lisp -(use-package multiple-cursors - :defer 1 - :bind* (("C-." . mc/mark-next-like-this) - ("C-," . mc/mark-previous-like-this) - ("M-" . mc/mark-all-like-this-dwim) - ("C-" . mc/mark-more-like-this-extended) - ("C-S-L" . mc/edit-lines))) -#+END_SRC - -*** paredit - -Balanced parentheses in lisps are nice, but all the refactoring and -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))) -#+END_SRC - -*** smartparens - -I like to use smartparens where paredit isn’t already useful. Somehow -I didn’t find smartparens’ implementation of paredit style to be as -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-" #'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-" #'sp-splice-sexp-killing-backward smartparens-mode-map) - (bind-key "M-" #'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-" #'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 - -Transposing lines, made easier. - -#+BEGIN_SRC emacs-lisp -(use-package move-text - :config (move-text-default-bindings)) -#+END_SRC - -*** undo-tree - -Emacs’ default handling of undo is a bit confusing. Undo-tree makes -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))) - :diminish undo-tree-mode) -#+END_SRC - -*** replace - -#+BEGIN_SRC emacs-lisp -(with-eval-after-load "replace.el" - (setq case-replace nil)) -#+END_SRC - -*** visual-regexp - -I don’t always remember exactly how Emacs’ regular expressions work, -so this package is pretty useful because it highlights everything in -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))) -#+END_SRC - -** End - -Start a server if possible. A daemon is already a server. -#+BEGIN_SRC emacs-lisp -(use-package server - :defer 2 - :if (not (daemonp)) - :config (unless (server-running-p server-name) - (server-start))) -#+END_SRC - -Local Variables: -lentic-init: lentic-orgel-org-init -End: diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix index aad4a780..fe661b7b 100644 --- a/nix/.config/nixpkgs/emacs.nix +++ b/nix/.config/nixpkgs/emacs.nix @@ -124,6 +124,9 @@ in nginx-mode nix-mode nix-sandbox + outorg + outshine + navi-mode org-journal page-break-lines paredit -- cgit 1.4.1 From 5029163e7d68416c9b04124467b3084c50f19bb7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 4 Aug 2017 15:29:00 +0200 Subject: Emacs: Fix smartparens not being disabled in lisp modes --- emacs/.emacs.d/init.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 5df1f8be..9a93ab2b 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -2778,7 +2778,9 @@ (sp-local-pair "{{" "}}")) (show-smartparens-global-mode t) (smartparens-global-strict-mode t) - (add-hook 'lisp-mode-common-hook #'turn-off-smartparens-mode) + (define-hook-helper lisp-mode-common () + (smartparens-strict-mode -1) + (smartparens-mode -1)) (add-hook 'coffee-mode-hook #'turn-off-smartparens-mode))) ;; #+END_SRC -- cgit 1.4.1 From 75a8eebea057167476ca9cb1653524b20760868d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 4 Aug 2017 15:29:17 +0200 Subject: Emacs: Make bbdb popup window smaller --- emacs/.emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 9a93ab2b..d6f5a82b 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -1417,6 +1417,7 @@ (setq bbdb-send-mail-style 'gnus bbdb-complete-mail-allow-cycling t bbdb-mua-auto-update t + bbdb-mua-pop-up-window-size 3 bbdb-mua-update-interactive-p '(query . create) bbdb-message-all-addresses t bbdb-offer-save t -- cgit 1.4.1 From 14a8c8a386663a969f72fbd6cfb67ea0f475c43c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 4 Aug 2017 15:29:27 +0200 Subject: Emacs: Fix startup issue opening encrypted config --- emacs/.emacs.d/init.el | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index d6f5a82b..924100a6 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -15,12 +15,9 @@ (setq inhibit-startup-echo-area-message (user-login-name))) (setq inhibit-startup-screen t) (setq gc-cons-threshold 100000000) -(defvar file-name-handler-alist-backup file-name-handler-alist) -(setq file-name-handler-alist nil) (add-hook 'after-init-hook - #'(lambda () - (setq gc-cons-threshold 800000 - file-name-handler-alist file-name-handler-alist-backup))) + (lambda () + (setq gc-cons-threshold 800000))) (remove-hook 'find-file-hooks #'vc-refresh-state) ;; #+END_SRC -- cgit 1.4.1 From cd060d4e5ecd0f53e14d698e8a76f28d2415a20c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 4 Aug 2017 15:29:47 +0200 Subject: Emacs: Simplify search for init file --- emacs/.emacs.d/init.el | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 924100a6..ef66d647 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -1425,10 +1425,7 @@ ;; #+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)))) + (file-truename user-init-file) "Where the emacs init file really is, passing through symlinks.") (set-register ?e `(file . ,*init-file*)) -- cgit 1.4.1 From 9a1e539df2bafab894bde33c39feee8c5ac4cb59 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 4 Aug 2017 16:37:06 +0200 Subject: Emacs: Remove coffee mode Unused --- emacs/.emacs.d/init.el | 12 +----------- nix/.config/nixpkgs/emacs.nix | 1 - 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index ef66d647..78e49193 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -2274,15 +2274,6 @@ (add-hook 'js2-mode-hook #'indium-interaction-mode))) ;; #+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))) -;; #+END_SRC - ;; **** tern ;; Tern understands javascript. It adds really clever documented @@ -2775,8 +2766,7 @@ (smartparens-global-strict-mode t) (define-hook-helper lisp-mode-common () (smartparens-strict-mode -1) - (smartparens-mode -1)) - (add-hook 'coffee-mode-hook #'turn-off-smartparens-mode))) + (smartparens-mode -1)))) ;; #+END_SRC diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix index fe661b7b..ad77ff5d 100644 --- a/nix/.config/nixpkgs/emacs.nix +++ b/nix/.config/nixpkgs/emacs.nix @@ -67,7 +67,6 @@ in clj-refactor clojure-mode cmd-to-echo - coffee-mode command-log-mode company company-go -- cgit 1.4.1 From 4c61a4a89c0a1613d6979a4df64ea1c2498eddaa Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 4 Aug 2017 16:40:56 +0200 Subject: Emacs: Remove twig-mode I don't use PHP any more --- emacs/.emacs.d/init.el | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 78e49193..5411adbb 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -2376,13 +2376,6 @@ (sp-local-pair '(web-mode) "<%" "%>"))) ;; #+END_SRC -;; I derived a mode for twig, in order to use its =mode-hook=. - -;; #+BEGIN_SRC emacs-lisp -(define-derived-mode twig-mode web-mode "Twig") -(add-to-list 'auto-mode-alist '("\\.html\\.twig\\'" . twig-mode)) -;; #+END_SRC - ;; *** Live coding ;; Sometimes I might want to show off my emacs usage. @@ -2758,10 +2751,7 @@ (bind-key "M-" #'sp-splice-sexp-killing-backward smartparens-mode-map) (bind-key "M-" #'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-" #'sp-slurp-hybrid-sexp smartparens-mode-map) - (sp-with-modes '(twig-mode) - (sp-local-pair "{%" "%}") - (sp-local-pair "{{" "}}")) + (bind-key "C-S-" #'sp-slurp-hybrid-sexp smartparens-mode-map) (show-smartparens-global-mode t) (smartparens-global-strict-mode t) (define-hook-helper lisp-mode-common () -- cgit 1.4.1 From 8b4451d07e6d79a61a4c25b631dfeb1767825463 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 6 Aug 2017 09:22:44 +0200 Subject: Emacs: Update linux fonts --- emacs/.emacs.d/init.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index d15dcd65..1ad54262 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -251,8 +251,8 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource (ap/set-fonts "Monoid" 12 "Helvetica Neue" 12 t 0.1)))) ((and (eq window-system 'x) (not (eq system-type 'gnu/linux/windows))) - (set-fontset-font "fontset-default" 'unicode (font-spec :name "PT Mono" :size 17)) - (ap/set-fonts "PT Mono" 17 "Noto Sans" 14 nil)) + (set-fontset-font "fontset-default" 'unicode (font-spec :name "PT Mono" :size 14)) + (ap/set-fonts "PT Mono" 14 "Noto Sans" 14 nil)) ((and (eq window-system 'x) (eq system-type 'gnu/linux/windows)) (ap/set-fonts "Noto Mono" 12 "Sans" 12 nil)))) -- cgit 1.4.1 From d160fda17634bf780c53e38e2ad895ebd15a2e1e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 6 Aug 2017 09:22:55 +0200 Subject: Xprofile: Run cmst --- xprofile/.xprofile | 1 + 1 file changed, 1 insertion(+) diff --git a/xprofile/.xprofile b/xprofile/.xprofile index d397c3c2..102db6e9 100755 --- a/xprofile/.xprofile +++ b/xprofile/.xprofile @@ -2,4 +2,5 @@ sh -c 'sleep 1 && xsetroot -cursor_name left_ptr' & xmodmap .xmodmaprc xrdb -I$HOME/.xresources .xresources/main +cmst --minimized & sxhkd & -- cgit 1.4.1 From a240cca30cb961244331e427309b18c5ae4695d4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 7 Aug 2017 16:50:24 +0200 Subject: Emacs: Fix execution of old code at startup Set load-prefer-newer before loading main init code (it does not apply to the file it is in) Set auto-compile-on-load to compile init.el if it is newer than init.elc --- emacs/.emacs.d/init.el | 2834 +----------------------------------------------- emacs/.emacs.d/main.el | 2821 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 2835 insertions(+), 2820 deletions(-) create mode 100644 emacs/.emacs.d/main.el diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 1880871c..22c3f72c 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -1,2824 +1,18 @@ -;;; emacs-config --- Summary -;; #+TITLE: Emacs Configuration for Alan Pearce -;; #+OPTIONS: ^:nil -;; #+PROPERTY: results silent -;; #+PROPERTY: eval no-export -;; #+PROPERTY: header-args :comments link -;;; Header: -;; This is a living document, detailing my Emacs configuration using org-mode +;;; init --- user init file -*- no-byte-compile: t -*- +;;; Commentary: +;; Entry point for Emacs init. +;; Ensures that main init code is up-to-date by loading the newest version. +;; ;;; Code: -;; ** Basics -;; *** Startup -;; 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-screen t) -(setq gc-cons-threshold 100000000) -(add-hook 'after-init-hook - (lambda () - (setq gc-cons-threshold 800000))) -(remove-hook 'find-file-hooks #'vc-refresh-state) -;; #+END_SRC +(setq load-prefer-newer t + package-user-dir (concat "~/.emacs.d/packages/" emacs-version "/elpa")) -;; Are we running on Windows via the WSL? +(setq package-archives nil) +(package-initialize) +(require 'auto-compile nil :noerror) -;; #+BEGIN_SRC emacs-lisp -(when (file-exists-p "/proc/sys/kernel/osrelease") - (with-temp-buffer - (insert-file-contents-literally "/proc/sys/kernel/osrelease") - (decode-coding-region (point-min) (point-max) 'utf-8 t) - (when (string-match "Microsoft$" (buffer-string)) - (setq system-type 'gnu/linux/windows)))) -;; #+END_SRC +(when (featurep 'auto-compile) + (auto-compile-on-load-mode)) -;; *** Compatibility - -;; #+BEGIN_SRC emacs-lisp -(if (version< emacs-version "25.0") - (defmacro with-eval-after-load (file &rest body) - `(eval-after-load ,file (lambda () ,@body)))) -;; #+END_SRC - -;; *** Scratch buffers -;; I usually use scratch buffers for any sort of text. If I need a -;; 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) -;; #+END_SRC - -;; *** Personal Information -;; #+BEGIN_SRC emacs-lisp -(setq user-mail-address "alan@alanpearce.eu" - user-full-name "Alan Pearce") -;; #+end_src - -;; ** Packaging - -;; *** Use-package - -;; #+BEGIN_SRC emacs-lisp -(eval-and-compile - (require 'seq) - (defvar nix-emacs (and (string-match "^/nix/store" invocation-directory) - (not (null (seq-some (lambda (dir) (string-match "^/nix/store" dir)) load-path))))) - - (setq tls-checktrust t - gnutls-verify-error t - package-menu-async t - package-user-dir (concat "~/.emacs.d/packages/" emacs-version "/elpa") - package-menu-hide-low-priority t) - (if nix-emacs - (progn (setq package-archives nil) - (package-initialize)) - (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") - ("melpa-stable" . "https://stable.melpa.org/packages/") - ("melpa" . "https://melpa.org/packages/")) - package-pinned-packages '(("use-package" . melpa-stable) - ("diminish" . melpa-stable) - ("bind-key" . melpa-stable)) - package-archive-priorities '(("melpa" . 10) - ("gnu" . 10) - ("melpa-stable" . 5) - ("marmalade" . 0)))) - (when (eq system-type 'darwin) - (with-eval-after-load "gnutls" - (add-to-list 'gnutls-trustfiles "/etc/ssl/cert.pem"))) - (unless nix-emacs - (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)) -(setq use-package-always-ensure (not nix-emacs) - use-package-always-demand (daemonp) - package-enable-at-startup nil) -;; #+END_SRC - -;; *** Helpers - -;; **** Hook Helpers - -;; An improvement over add-hook with lamda functions that allows -;; modification and removal, without the boilerplate of an extra function -;; definition. - -;; #+BEGIN_SRC emacs-lisp -(eval-and-compile - (use-package hook-helpers)) -;; #+END_SRC - -;; ** Customize -;; I don’t really like using customize for normal configuration. -;; Instead, I use it for things that get saved automatically. That’s why -;; I use a different file, which is ignored by the VCS. It also means -;; that it’s not important whether the file exists or not, which is why I -;; pass =:noerror= to =load= - -;; #+BEGIN_SRC emacs-lisp -(setq custom-file "~/.emacs.d/custom.el") -(load custom-file :noerror :nomessage) -;; #+END_SRC - -;; ** Styles - -;; I prefer an always-visible cursor. Feels less distracting. -;; #+BEGIN_SRC emacs-lisp -(when (fboundp #'blink-cursor-mode) - (blink-cursor-mode -1)) -;; #+END_SRC - -;; 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)) -(with-eval-after-load 'scroll-bar - (set-scroll-bar-mode nil)) -(with-eval-after-load 'tooltip - (tooltip-mode -1)) -(with-eval-after-load 'tool-bar - (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)))) -;; #+END_SRC - -;; *** Colours - -;; Eziam looks nice, too, except for the non-white background. I prefer -;; white because most other application backgrounds are that colour. - -;; #+BEGIN_SRC emacs-lisp -(use-package eziam-light-theme - :ensure eziam-theme - :disabled t - :if (or window-system - (daemonp)) - :defines (eziam-scale-headings) - :config (progn - (setq eziam-scale-headings nil) - (load-theme 'eziam-light t) - (custom-theme-set-faces 'user - '(default ((t (:background "#ffffff")))) - '(js2-function-call ((t (:underline nil)))) - '(js2-object-property ((t (:slant normal)))) - '(font-lock-keyword-face ((t (:weight normal)))) - '(git-gutter-fr:added ((t (:foreground "#96a4ab")))) - '(git-gutter-fr:modified ((t (:foreground "#96a4ab")))) - '(git-gutter-fr:deleted ((t (:foreground "#96a4ab"))))))) -;; #+END_SRC - -;; White-theme. Sounds like a good idea. - -;; #+BEGIN_SRC emacs-lisp -(use-package white-theme - :if (or window-system - (daemonp)) - :config (progn - (load-theme 'white t) - (custom-theme-set-faces 'user - '(git-gutter-fr:added ((t (:foreground "#b8b8b8")))) - '(git-gutter-fr:modified ((t (:foreground "#b8b8b8")))) - '(git-gutter-fr:deleted ((t (:foreground "#b8b8b8")))) - '(font-lock-string-face ((t (:slant normal))))))) -;; #+END_SRC - -;; Base16 theming allows me have a consistent style between applications -;; quite easily. - -;; #+BEGIN_SRC emacs-lisp -(use-package base16-theme - :if (or window-system - (daemonp))) -;; #+END_SRC - -;; Highlighting quasi-quoted expressions in lisps is quite useful, but I -;; don't need it all the time. I'll keep it around for a while so that I -;; can enable it if needed. -;; #+BEGIN_SRC emacs-lisp -(use-package highlight-stages - :diminish highlight-stages-mode) -;; #+END_SRC - -;; *** Fonts - -;; 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 . 1))) - - (defun ap/set-fonts (mono-face mono-font-size variable-face variable-font-size antialias &optional new-line-spacing) - (if (boundp 'ns-antialias-text) - (setq ns-antialias-text antialias)) - (if (boundp 'new-line-spacing) - (setq line-spacing new-line-spacing)) - (when mono-face - (let ((default-font (font-spec :family mono-face :size mono-font-size))) - (add-to-list 'default-frame-alist `(font . ,(format "%s %s" mono-face mono-font-size))) - (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 t)) - ((or (eq window-system 'mac) - (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 "Fira Code" 14 "Lucida Grande" 14 t nil) - (ap/set-fonts "Monoid" 12 "Helvetica Neue" 12 t 0.1)))) - ((and (eq window-system 'x) - (not (eq system-type 'gnu/linux/windows))) - (set-fontset-font "fontset-default" 'unicode (font-spec :name "PT Mono" :size 14)) - (ap/set-fonts "PT Mono" 14 "Noto Sans" 14 nil)) - ((and (eq window-system 'x) - (eq system-type 'gnu/linux/windows)) - (ap/set-fonts "Noto Mono" 12 "Sans" 12 nil)))) - - (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))) -;; #+END_SRC - -;; Make symbols prettier. Turns out, in many cases, this is already -;; configured, just not enabled. If using the mac-port version of Emacs, -;; it has it's own, more extensive version. - -;; #+BEGIN_SRC emacs-lisp -(if (eq window-system 'mac) - (mac-auto-operator-composition-mode +1) - (global-prettify-symbols-mode +1)) -;; #+END_SRC - -;; *** Page Breaks - -;; By default, Emacs displays page breaks as ^L. Lines look much nicer. -;; On Windows, Emacs incorrectly detects that U+2500 (Box Drawings Light -;; Horizontal) can only be displayed with a different font, which is not -;; 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))))) -;; #+END_SRC -;; *** Modeline - -;; #+BEGIN_SRC emacs-lisp -(column-number-mode -1) -(line-number-mode -1) -(size-indication-mode t) - - -(require 'f) -(setq frame-title-format (list "Emacs" - (if (and nix-emacs invocation-directory) - (list " (Nix Generation " - (cadr - (split-string (f-base - (car - (last (seq-take-while - (lambda (s) (s-contains? "profile" s)) - (split-string - (s-chomp (shell-command-to-string (concat "nix-store -q --roots " invocation-directory))) - "\n"))))) - "-")) - " " - (s-left 6 (nth 3 (f-split invocation-directory))) - "..." - (s-right 6 (car (split-string (nth 3 (f-split invocation-directory)) "-"))) - ")")) - '(buffer-file-name " — %f") - '(dired-directory (" — " dired-directory)))) -;; #+END_SRC - -;; *** Chrome - -;; Sometimes I like to hide clutter. Other times, it's useful. - -;; #+BEGIN_SRC emacs-lisp -(defvar mode-line-default-format mode-line-format) -(defvar mode-line-default-hidden nil - "Whether to hide the mode line by default") - -(defun show-mode-line () - (interactive) - (setq mode-line-format mode-line-default-format) - (when (called-interactively-p 'interactive) - (setq-default mode-line-format mode-line-default-format) - (setq mode-line-default-hidden nil))) -(defun hide-mode-line () - (interactive) - (setq mode-line-format nil) - (when (called-interactively-p 'interactive) - (setq-default mode-line-format nil) - (setq mode-line-default-hidden t))) - -(setq-default cursor-in-non-selected-windows nil) - -(defun hide-clutter () - (interactive) - (hide-mode-line)) - -(defun show-clutter () - (interactive) - (show-mode-line)) - -(when mode-line-default-hidden - (call-interactively #'hide-mode-line)) - -(setq-default indicate-buffer-boundaries nil) -(fringe-mode '(4 . 4)) - -(defun hide-mode-line-if-default-hidden () - (if mode-line-default-hidden - (hide-mode-line) - (show-mode-line))) - -(add-to-list 'default-frame-alist '(border-width . 0)) -(add-to-list 'default-frame-alist '(internal-border-width . 0)) -(when (or (eq window-system 'x) - (eq window-system 'mac)) - (setq window-divider-default-bottom-width 1 - window-divider-default-right-width 1 - window-divider-default-places t) - (window-divider-mode +1)) - -(add-hook 'after-change-major-mode-hook #'hide-mode-line-if-default-hidden) - -(add-hook 'minibuffer-setup-hook #'show-mode-line) -(add-hook 'minibuffer-exit-hook #'hide-mode-line) -;; #+END_SRC - -;; *** Highlight Changes - -;; 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))) -;; #+END_SRC - -;; *** Beacon - -;; I was against the idea of having flashy animations inside Emacs, but -;; this one is useful. It highlights the cursor when scrolling or -;; switching windows. - -;; #+BEGIN_SRC emacs-lisp -(use-package beacon - :diminish beacon-mode - :config (progn - (beacon-mode +1) - (setq beacon-blink-delay 0.25 - beacon-blink-duration 0.25 - beacon-size 20 - beacon-color "#a1b56c"))) -;; #+END_SRC - -;; *** Renaming major modes - -;; Diminishing major modes does not happen in the same manner as minor -;; modes. - -;; #+BEGIN_SRC emacs-lisp -(unless (version<= emacs-version "24.4") - (use-package cyphejor - :defer 2 - :config (progn - (setq cyphejor-rules `(("emacs" "ε") - ("diff" "Δ") - ("js2" "js") - ("magit-status" ,(char-to-string (seq-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 - - -;; ** Environment Variables - -;; MacOS doesn’t have a reasonable way to set environment variables and -;; read them automatically any more. So, let’s use the -;; [[https://github.com/purcell/exec-path-from-shell][exec-path-from-shell]] package to set up ~exec-path~ and similar -;; variables from whatever my shell configuration is. - -;; On Windows, I like to run Emacs from the system tray menu of VcXsrv. -;; It starts up without an environment in this case as well. - -;; #+BEGIN_SRC emacs-lisp -(use-package exec-path-from-shell - :if (or (eq system-type 'darwin) - (eq system-type 'gnu/linux/windows) - (and (eq system-type 'gnu/linux) - (daemonp))) - :config (progn - (setq exec-path-from-shell-arguments '("-l")) - (exec-path-from-shell-initialize))) -;; #+END_SRC - -;; *** NixOS sandboxes - -;; I'm currently exploring using nix to create sandboxes for -;; development. This package allows using tools from inside sandboxes, -;; and some convenience commands for building packages and launching shells. - -;; #+BEGIN_SRC emacs-lisp -(use-package nix-sandbox - :config (progn - (with-eval-after-load 'flycheck - (setq flycheck-command-wrapper-function - (lambda (command) - (if (nix-current-sandbox) - (apply 'nix-shell-command (nix-current-sandbox) command) - command)) - flycheck-executable-find - (lambda (cmd) - (if (nix-current-sandbox) - (nix-executable-find (nix-current-sandbox) cmd) - (executable-find cmd))))))) -;; #+END_SRC - -;; ** Keybindings - -;; I think =set-keyboard-coding-system= stops OS X from doing something -;; annoying to add accents. The modifier setup is to match my -;; re-arrangement of modifiers on OSX: Cmd on the outside, then -;; 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")) -;; #+END_SRC - -;; #+BEGIN_SRC emacs-lisp -(unbind-key "") -(bind-key* "" #'compile) -(bind-key* "" #'kmacro-start-macro-or-insert-counter) -(bind-key* "" #'kmacro-end-or-call-macro) - -(bind-key* "" #'execute-extended-command) - -(unbind-key "C-z") -(bind-key* "C-" #'other-window) - -(bind-key* "C-x C-r" #'revert-buffer) -(bind-key* "C-x C-j" #'delete-indentation) -(unbind-key "C-x C-c") - -(bind-key* "C-c i" #'insert-char) -(bind-key* "M-/" #'hippie-expand) - -(unbind-key "s-h") -(unbind-key "s-n") -(unbind-key "s-p") -(unbind-key "s-w") -(bind-key* "s-k" #'kill-or-delete-this-buffer-dwim) - -(bind-key "C-M-a" #'backward-paragraph text-mode-map) -(bind-key "C-M-e" #'forward-paragraph text-mode-map) - -(bind-key* "s-x" (define-prefix-command 'super-x-map)) -(bind-key* "s-," #'switch-to-dotfiles) -(bind-key* "C-x M-x" #'execute-extended-command) -(set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) -;; #+END_SRC - -;; *** Crux - -;; I can replace most of the simple helper/wrapper functions in my -;; 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)) - :config (progn - (crux-reopen-as-root-mode +1)) - :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 -(defun switch-to-dotfiles () - (interactive) - (projectile-switch-project-by-name (car (split-string (shell-command-to-string "ghq list --full-path dotfiles"))))) -;; #+END_SRC - -;; *** The Silver Searcher - -;; #+BEGIN_SRC emacs-lisp -(use-package ag - :defer 30 - :config (setq ag-project-root-function #'projectile-project-root)) - -(use-package wgrep-ag - :after ag) -;; #+END_SRC - -;; *** Ripgrep - -;; Step over Silver Search, here comes a new challenger. - -;; #+BEGIN_SRC emacs-lisp -(use-package ripgrep - :if (executable-find "rg")) - -(use-package projectile-ripgrep - :after (ripgrep projectile) - :if (executable-find "rg") - :bind (("C-c p s r" . projectile-ripgrep))) -;; #+END_SRC - -;; *** Projectile - -;; Projectile is awesome for working in projects, especially VCS-backed -;; ones. - -;; #+BEGIN_SRC emacs-lisp -(use-package projectile - :bind (("s-p" . projectile-switch-project) - ("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-mode +1) - (add-to-list 'projectile-globally-ignored-directories ".stversions") - - (defun yarn-install (&optional arg) - (interactive "P") - (projectile-with-default-dir (projectile-project-root) - (cmd-to-echo "yarn" "install"))) - - (defun yarn-add-dev (package) - (interactive "spackage: ") - (projectile-with-default-dir (projectile-project-root) - (cmd-to-echo "yarn" (concat "add --dev " package)))) - - (defun yarn-add (package) - (interactive "spackage: ") - (projectile-with-default-dir (projectile-project-root) - (cmd-to-echo "yarn" (concat "add " package)))) - - (defun yarn-run (cmd) - (interactive (list - (projectile-completing-read "command: " (alist-get 'scripts (json-read-file (expand-file-name "package.json" (projectile-project-root))))))) - (projectile-with-default-dir (projectile-project-root) - (cmd-to-echo "yarn" (concat "run " cmd)))) - - (defun ap/open-project (&optional arg) - (interactive "P") - (let ((project-dir (projectile-completing-read - "Open project: " - (ghq--find-projects)))) - (projectile-switch-project-by-name - (expand-file-name project-dir (ghq--find-root)) arg))) - - (setq projectile-switch-project-action #'projectile-commander - projectile-completion-system 'ivy - projectile-create-missing-test-files t) - - (defun ap/projectile-test-suffix (project-type) - (cond - ((member project-type '(node-yarn node-npm)) ".test") - (t (projectile-test-suffix project-type)))) - (setq projectile-test-suffix-function #'ap/projectile-test-suffix) - - (projectile-register-project-type 'node-yarn '("yarn.lock") "yarn start" "yarn test") - (projectile-register-project-type 'node '("package.json") "npm start" "npm test"))) - -(use-package counsel-projectile - :after (counsel projectile) - :config (progn - (counsel-projectile-on) - (def-projectile-commander-method ?A - "Find rg on project." - (call-interactively #'counsel-projectile-rg)) - (define-key projectile-mode-map [remap counsel-projectile-ag] #'counsel-projectile-rg))) -;; #+END_SRC - -;; *** vc - -;; This is nice for some things that magit doesn’t do, and for those rare -;; occasions that I’m working with something other than git. - -;; #+BEGIN_SRC emacs-lisp -(use-package vc - :defer t - :bind (("C-x v C" . vc-resolve-conflicts)) - :config (progn - (setq vc-follow-symlinks t) - (setq vc-ignore-dir-regexp (format "\\(%s\\)\\|\\(%s\\)" - vc-ignore-dir-regexp - tramp-file-name-regexp)))) -;; #+END_SRC - -;; *** git-gutter-fringe - -;; It’s nice to be able to see at a glance which lines of a file have -;; changed. This package colours the fringe. I have it set to the right -;; fringe so it doesn’t interfere with flycheck. - -;; #+BEGIN_SRC emacs-lisp -(eval-when-compile (require 'fringe-helper)) -(use-package git-gutter-fringe - :defer 2 - :diminish git-gutter-mode - :config (progn - (global-git-gutter-mode 1) - ;; places the git gutter outside the margins. - (setq-default fringes-outside-margins t) - ;; thin fringe bitmaps - (fringe-helper-define 'git-gutter-fr:added '(center repeated) - ".XXX....") - (fringe-helper-define 'git-gutter-fr:modified '(center repeated) - ".XXX....") - (fringe-helper-define 'git-gutter-fr:deleted 'bottom - ".......X" - "......XX" - ".....XXX" - "....XXXX") - (setq git-gutter-fr:side 'right-fringe))) -;; #+END_SRC - -;; *** magit - -;; Magit is my favourite way to use git. I use selective staging all the -;; 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-completing-read-function #'ivy-completing-read - magit-popup-use-prefix-argument 'default - magit-display-buffer-function #'magit-display-buffer-fullcolumn-most-v1 - 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-messenger - -;; Popup the last commit that changed the line at point. - -;; #+BEGIN_SRC emacs-lisp -(use-package git-messenger - :bind* (("C-x v p" . git-messenger:popup-message)) - :config (progn - (setq git-messenger:use-magit-popup t))) -;; #+END_SRC - -;; *** git-timemachine - -;; This package allow me to go through a file’s history with just a few -;; keys. It makes it very easy to figure what what exactly was in a file -;; in the past. I often find it useful when I remember writing something -;; a particular way, but it changed later. - -;; #+BEGIN_SRC emacs-lisp -(use-package git-timemachine - :commands git-timemachine) -;; #+END_SRC - -;; *** ghq - -;; [[https://github.com/motemen/ghq][=ghq=]] clones VCS-backed projects to a common directory. It should -;; seem familiar to anyone who's used =go get= before. [[https://github.com/rcoedo/emacs-ghq][=emacs-ghq=]] is a -;; simple wrapper for it. - -;; #+BEGIN_SRC emacs-lisp -(use-package ghq - :if (executable-find "ghq")) -;; #+END_SRC - -;; ** Files - -;; *** Auto-saving - -;; Auto-save everything to a temporary directory, instead of cluttering -;; 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) -;; #+END_SRC -;; *** Backups - -;; I like to keep my backups out of regular folders. I tell emacs to use -;; 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)) -(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)))) -;; #+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))))) -;; #+END_SRC - -;; *** Encoding - -;; UTF-8 is usually appropriate. Note that =prefer-coding-system= expects -;; only a coding system, not a coding system and line ending combination. - -;; #+BEGIN_SRC emacs-lisp -(prefer-coding-system 'utf-8) -(setq-default buffer-file-coding-system 'utf-8-auto-unix) -;; #+END_SRC - -;; *** Buffer-file management - -;; Ask if I want to create a directory when it doesn’t exist. This is -;; 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)))) -(add-to-list 'find-file-not-found-functions #'my-create-non-existent-directory) -;; #+END_SRC - -;; I often want to rename or delete the file that I’m currently visiting -;; 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))))) -;; #+END_SRC - -;; *** Whitespace - -;; Show bad whitespace, so that I can fix it. - -;; #+BEGIN_SRC emacs-lisp -(defun show-trailing-whitespace-on () - (interactive) - (setq-local show-trailing-whitespace t)) -(defun show-trailing-whitespace-off () - (interactive) - (setq-local show-trailing-whitespace nil)) -(add-hook 'prog-mode-hook #'show-trailing-whitespace-on) -(add-hook 'text-mode-hook #'show-trailing-whitespace-on) -;; #+END_SRC - -;; *** shrink-whitespace - -;; DWIM whitespace removal. So I don’t need =M-SPC=, =M-\= and =C-x o= -;; for similar things any more. - -;; #+BEGIN_SRC emacs-lisp -(use-package shrink-whitespace - :bind ("M-SPC" . shrink-whitespace)) -;; #+END_SRC - -;; *** Tramp - -;; Tramp is awesome. It makes SSH feel Unix-y. The proxy setup is so -;; 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" (format "/run/user/%s/ssh-agent" (user-uid)))) - (setq tramp-default-method "ssh" - tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root")) - tramp-backup-directory-alist backup-directory-alist - tramp-completion-reread-directory-timeout 60 - tramp-ssh-controlmaster-options nil - 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)))) -;; #+END_SRC - -;; *** ediff - -;; I like a horizonal diff setup, with everything in one frame. - -;; #+BEGIN_SRC emacs-lisp -(use-package ediff - :defer t - :config (progn - (setq ediff-split-window-function 'split-window-horizontally - ediff-window-setup-function 'ediff-setup-windows-plain))) -;; #+END_SRC - -;; ** Indentation - -;; Ah, a complicated topic. One day we’ll all be using elastic -;; 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 2 - indent-tabs-mode nil) -(electric-indent-mode +1) -;; #+END_SRC - - -;; *** smart-tabs-mode - -;; Not related to [[smart-tab][=smart-tab=]], this mode indents with tabs and aligns -;; with spaces. Perfect! - -;; #+BEGIN_SRC emacs-lisp -(use-package smart-tabs-mode - :defer 1 - :config (progn - (smart-tabs-insinuate 'c 'cperl 'python) - (define-hook-helper php-mode () - (smart-tabs-mode indent-tabs-mode)))) -;; #+END_SRC - -;; *** editorconfig - -;; #+BEGIN_SRC emacs-lisp -(use-package editorconfig - :diminish "EC" - :config (editorconfig-mode 1)) -;; #+END_SRC - -;; *** dtrt-indent-mode - -;; Sometimes people use different indentation settings. [[https://github.com/jscheid/dtrt-indent][dtrt-indent]] -;; guesses the correct settings for me. - -;; #+BEGIN_SRC emacs-lisp -(use-package dtrt-indent - :config (progn - (define-hook-helper after-change-major-mode () - (unless (and (boundp editorconfig-mode) - editorconfig-mode) - (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 - -;; *** password-store - -;; 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))) -;; #+END_SRC -;; ** Buffers - -;; *** Ibuffer -;; Ibuffer is quite nice for listing all buffers. - -;; #+BEGIN_SRC emacs-lisp -(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))))) -;; #+END_SRC - -;; *** Relative Buffer names - -;; #+BEGIN_SRC emacs-lisp -(use-package relative-buffers - :defer 15 - :config (progn - (global-relative-buffers-mode))) -;; #+END_SRC -;; *** Narrowing - -;; Enable it without prompting - -;; #+BEGIN_SRC emacs-lisp -(put 'narrow-to-defun 'disabled nil) -(put 'narrow-to-page 'disabled nil) -(put 'narrow-to-region 'disabled nil) -;; #+END_SRC - -;; *** ace-window - -;; I don’t often have many windows open at once, but when I do, -;; =ace-window= is really nice to jump around them in the same way that -;; =ace-jump= or =avy= work. -;; #+BEGIN_SRC emacs-lisp -(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)))) -;; #+END_SRC - -;; ** Windows - -;; Scrolling is tricky. I use this setup to help me keep track of the -;; 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 160 - frame-resize-pixelwise nil) -(if (boundp 'ns-pop-up-frames) - (setq ns-pop-up-frames nil)) -;; #+END_SRC - -;; *** eyebrowse - -;; Workspaces, a bit like dwm. On Windows and Linux (at least the WMs -;; I'm likely to use), super+{0-9} are taken from the OS, so use meta -;; instead. On macOS, super makes a lot of sense, as it's used by most -;; programs to switch between program windows or views. - -;; #+BEGIN_SRC emacs-lisp -(use-package eyebrowse - :config (progn - (setq eyebrowse-new-workspace t) - (when (eq system-type 'darwin) - (bind-keys - ("s-0" . eyebrowse-switch-to-window-config-0) - ("s-1" . eyebrowse-switch-to-window-config-1) - ("s-2" . eyebrowse-switch-to-window-config-2) - ("s-3" . eyebrowse-switch-to-window-config-3) - ("s-4" . eyebrowse-switch-to-window-config-4) - ("s-5" . eyebrowse-switch-to-window-config-5) - ("s-6" . eyebrowse-switch-to-window-config-6) - ("s-7" . eyebrowse-switch-to-window-config-7) - ("s-8" . eyebrowse-switch-to-window-config-8) - ("s-9" . eyebrowse-switch-to-window-config-9))) - (bind-keys* - ("M-0" . eyebrowse-switch-to-window-config-0) - ("M-1" . eyebrowse-switch-to-window-config-1) - ("M-2" . eyebrowse-switch-to-window-config-2) - ("M-3" . eyebrowse-switch-to-window-config-3) - ("M-4" . eyebrowse-switch-to-window-config-4) - ("M-5" . eyebrowse-switch-to-window-config-5) - ("M-6" . eyebrowse-switch-to-window-config-6) - ("M-7" . eyebrowse-switch-to-window-config-7) - ("M-8" . eyebrowse-switch-to-window-config-8) - ("M-9" . eyebrowse-switch-to-window-config-9)) - (eyebrowse-mode +1))) -;; #+END_SRC - -;; ** Sessions - -;; *** Desktop -;; Save my Emacs session and restore it on startup. - -;; #+BEGIN_SRC emacs-lisp -(use-package desktop - :ensure nil - :config (progn - (setq desktop-dirname (expand-file-name "desktop/" user-emacs-directory) - desktop-base-file-name "emacs.desktop" - desktop-base-lock-name "lock" - desktop-path (list desktop-dirname) - desktop-save 'if-exists - desktop-files-not-to-save "^$" - desktop-load-locked-desktop nil) - (unless (file-directory-p desktop-dirname) - (make-directory desktop-dirname)) - (desktop-save-mode 1))) -;; #+END_SRC - -;; *** winner - -;; Undo, for window-based commands. - -;; #+BEGIN_SRC emacs-lisp -(use-package winner - :config (setq winner-boring-buffers '("*Completions*" "*Help*" "*Apropos*" "*Buffer List*" "*info*" "*Compile-Log*")) - :init (progn - (winner-mode 1))) -;; #+END_SRC - -;; *** windmove - -;; Directional window movement - -;; #+BEGIN_SRC emacs-lisp -(use-package windmove - :bind (("S-" . windmove-left) - ("S-" . windmove-right) - ("S-" . windmove-up) - ("S-" . windmove-down))) -;; #+END_SRC -;; ** Blogging - -;; I have a [[https://alanpearce.uk][blog]] that I publish with hugo. - -;; #+BEGIN_SRC emacs-lisp -(use-package easy-hugo - :config (setq easy-hugo-basedir (car (split-string (shell-command-to-string "ghq list --full-path alanpearce.uk"))) - easy-hugo-url "https://alanpearce.uk" - easy-hugo-default-ext ".md")) -;; #+END_SRC - -;; ** Completion - -;; Make built-in completion a bit more intelligent, by adding substring -;; 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) -;; #+END_SRC - -;; *** Company - -;; The main choices for automatic completion in Emacs are company and -;; auto-complete-mode. I’ve not tried auto-complete-mode as company -;; 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-on) - (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-gtags - company-etags company-keywords) company-oddmuse) - company-frontends '(company-pseudo-tooltip-unless-just-one-frontend - company-preview-frontend - company-echo-metadata-frontend) - 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-selection-wrap-around t))) -;; #+END_SRC - -;; #+BEGIN_SRC emacs-lisp -(use-package company-web - :after company) -;; #+END_SRC - -;;; ** Dates & Times - -;; *** Calendar - -;; 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))) -;; #+END_SRC - -;; Sometimes I want to insert a date or time into a buffer. -;; #+BEGIN_SRC emacs-lisp -(defun insert-date (prefix) - "Insert the current date. With prefix-argument, use British format. With - 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)))) - -(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)))) -;; #+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)) -;; #+END_SRC - -;; ** Directories - -;; Dired works quite nicely, but not always in the way I want. I don’t -;; like having so many prompts for recursive operations. Also, when I -;; have two dired windows open, assume that I’m going to be -;; copying/moving files between them. - -;; #+BEGIN_SRC emacs-lisp -(use-package dired - :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 (if delete-by-moving-to-trash - 'always - 'top) - dired-listing-switches "-alh") - (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)) - -(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 - dired-bind-jump nil)) - :init (progn - (add-hook 'dired-mode-hook #'turn-on-dired-omit-mode))) -;; #+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)))) -;; #+END_SRC - -;; *** Disk usage - -;; Combine dired and du (disk usage). - -;; #+BEGIN_SRC emacs-lisp -(use-package dired-du - :after dired - :config (progn - (setq dired-du-size-format t))) -;; #+END_SRC - -;; *** Dired-narrow -;; One can already use dired with wildcards to browse a filtered -;; directory listing, but it opens a new buffer. Dired-narrow is a -;; slightly nicer interface: with a currently-open dired buffer, use =/= -;; to start filtering, =RET= to complete the filter and =g= to refresh -;; 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)))) -;; #+END_SRC - -;; ** Documentation - -;; *** ehelp - -;; ehelp is a less well-known package that’s part of Emacs and slightly -;; improves the normal help commands, mostly by making quitting them easier. - -;; #+BEGIN_SRC emacs-lisp -(use-package ehelp - :bind-keymap ("C-h" . ehelp-map)) -;; #+END_SRC - -;; *** discover-my-major - -;; A nicer way to browse keybindings for major modes. - -;; #+BEGIN_SRC emacs-lisp -(use-package discover-my-major - :bind ("" . discover-my-major)) -;; #+END_SRC - -;; *** which-key - -;; 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))) -;; #+END_SRC - -;; *** eldoc - -;; Documentation in the echo-area (where the minibuffer is displayed) is -;; rather useful. - -;; #+BEGIN_SRC emacs-lisp -(use-package eldoc - :commands (eldoc-mode) - :diminish eldoc-mode - :config (progn - (setq eldoc-idle-delay 0.1) - (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) -;; #+END_SRC -;; ** Mail - -;; *** Gnus - -;; At work, I use gnus for email. Some of the setup is specific to my -;; workplace, so I keep it in a host-specific, GPG-encrypted file. - -;; #+BEGIN_SRC emacs-lisp -(use-package gnus - :config (progn - (setq gnus-gcc-mark-as-read t - mml-secure-openpgp-encrypt-to-self t - send-mail-function #'smtpmail-send-it - message-send-mail-function #'smtpmail-send-it))) - -(with-eval-after-load "gnus-mime" - (define-key gnus-mime-button-map " " #'gnus-mime-view-part-externally)) - -(with-eval-after-load "mailcap" - (when (eq system-type 'darwin) - (mailcap-add-mailcap-entry "application" "pdf" '((viewer . "/usr/bin/qlmanage -p %s") (type . "application/pdf"))))) - -(with-eval-after-load "mm-decode" - (add-to-list 'mm-discouraged-alternatives "text/html") - (add-to-list 'mm-discouraged-alternatives "text/richtext")) -;; #+END_SRC - -;; *** BBDB - -;; As I'm using Emacs for email, it makes sense to have contact -;; information here as well. - -;; #+BEGIN_SRC emacs-lisp -(use-package bbdb - :config (progn - (bbdb-initialize 'gnus 'message 'pgp) - (bbdb-mua-auto-update-init 'gnus 'message) - (setq bbdb-send-mail-style 'gnus - bbdb-complete-mail-allow-cycling t - bbdb-mua-auto-update t - bbdb-mua-pop-up-window-size 3 - bbdb-mua-update-interactive-p '(query . create) - bbdb-message-all-addresses t - bbdb-offer-save t - bbdb-offer-to-create 1))) -;; #+END_SRC - -;; ** Misc - -;; #+BEGIN_SRC emacs-lisp -(defvar *init-file* - (file-truename user-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 " - " nil t) - (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)))) - -(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))) - -(defun process-exit-code (program &rest args) - "Run PROGRAM with ARGS and return the exit code" - (apply 'call-process program nil nil nil args)) - -(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))) - -(bind-key* "M-!" #'shell-execute) -(bind-key* "C-x r M-w" #'copy-rectangle) -;; #+END_SRC - -;; *** Auxillary Configuration - -;; #+BEGIN_SRC emacs-lisp -(require 'pinentry) - -(defvar have-private-key - (file-exists-p (expand-file-name "secring.gpg" "~/.gnupg/"))) - -(defvar gpg-agent-ssh-sock - (or (getenv "GPG_AGENT_INFO") - (concat "/run/user/" (number-to-string (user-uid)) "/gnupg/S.gpg-agent.ssh"))) - -(defun read-gpg-file (file) - (let ((file-to-decrypt (expand-file-name file user-emacs-directory)) - (ctx (epg-make-context epa-protocol))) - (if (file-exists-p file-to-decrypt) - (epg-decrypt-file ctx file-to-decrypt nil) - (message "Decrypting %s...failed" file-to-decrypt) - (error "File %s does not exist" file-to-decrypt)))) - -(defun load-gpg (file) - (if have-private-key - (load file) - (message "WARNING: Couldn't load %s (No gpg key found)" file))) - -; load this in a post-frame hook because gpg-agent asks for a password on first -; startup and caches it. Don't want emacs daemon to hang because of gpg-agent. -(defun load-private-data () - (interactive) - (if (not (file-exists-p (expand-file-name (concat (system-name) ".el.gpg") user-emacs-directory))) - (message "No encrypted configuration matches system name `%s'" (system-name)) - (if (not have-private-key) - (message "ERROR: Private GPG key not found") - (unless (or (getenv "GPG_AGENT_INFO") - (getenv "SSH_AUTH_SOCK")) - (start-process "gpg-agent" nil "gpg-agent" "--daemon") - (setenv "SSH_AUTH_SOCK" gpg-agent-ssh-sock)) - (setq password-cache-expiry nil) - (unless (file-exists-p (concat pinentry--socket-dir "pinentry")) - (pinentry-start) - (add-hook 'kill-emacs-hook 'pinentry-stop)) - (add-to-list 'load-suffixes ".el.gpg") - (load-gpg (expand-file-name (system-name) user-emacs-directory))))) - -(defun first-frame-hook (frame) - (remove-hook 'after-make-frame-functions #'first-frame-hook) - (run-at-time nil nil 'load-private-data)) - -(if (eq 1 (length (frame-list))) - (add-hook 'after-init-hook #'load-private-data) - (add-hook 'after-make-frame-functions #'first-frame-hook)) -;; #+END_SRC - -;; ** Minibuffer - -;; Sometimes I want to use the minibuffer, but I’m already inside it. -;; Fortunately, this is possible. Of course, I need to know how many -;; minibuffers there are on the stack. - -;; #+BEGIN_SRC emacs-lisp -(setq enable-recursive-minibuffers t) -(minibuffer-depth-indicate-mode t) -;; #+END_SRC - -;; This avoids some issue with the minibuffer and the point being behind -;; the prompt. I don’t remember what exactly. -;; #+BEGIN_SRC emacs-lisp -(setq minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)) -;; #+END_SRC - -;; 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)) -;; #+END_SRC - -;; *** swiper/ivy - -;; Ivy is the new kid on the completion block. It seems to be a strong -;; replacement for helm so far. - -;; #+BEGIN_SRC emacs-lisp -(use-package swiper - :bind (("C-s" . swiper) - ("C-r" . swiper) - ("C-=" . swiper)) - :diminish ivy-mode - :demand t - :config (progn - (ivy-mode 1) - (setq ivy-re-builders-alist '((t . ivy--regex-plus)) - ivy-extra-directories '("./")) - (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 "" #'counsel-M-x) - (bind-key "C-c M-x" #'execute-extended-command) - (bind-key "C-x C-f" #'counsel-find-file) - (bind-key "M-y" #'counsel-yank-pop) - (bind-key "C-x i" #'counsel-imenu) - (bind-key "M-y" #'ivy-next-line ivy-minibuffer-map) - (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)))) - (setq counsel-rg-base-command "rg -i --no-heading --line-number --hidden %s ."))) -;; #+END_SRC - - -;; *** smex - -;; Smex is my favourite way to use =M-x=. Counsel’s =counsel-M-x= -;; function uses it internally, so I’m keeping it around, even though I -;; 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")))) -;; #+END_SRC - -;; *** cmd-to-echo - -;; I’ve been looking for some way to run programming projects (mostly -;; node.js) inside emacs. =cmd-to-echo= seems great for this, as new -;; output pops up in the echo area. - -;; #+BEGIN_SRC emacs-lisp -(use-package cmd-to-echo - :commands (cmd-to-echo) - :config (setq cmd-to-echo-add-output-to-process-buffers t)) -;; #+END_SRC -;; ** Modes - -;; Setup some modes for systemd files -;; #+BEGIN_SRC emacs-lisp -(add-to-list 'auto-mode-alist '("\\.service\\'" . conf-mode)) -(add-to-list 'auto-mode-alist '("\\.target\\'" . conf-mode)) -(add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-mode)) -;; #+END_SRC - -;; =direnv=’s files are basically shell scripts, it’s a nice way to -;; set environment variables for projects. -;; #+BEGIN_SRC emacs-lisp -(add-to-list 'auto-mode-alist '("\\.envrc\\'" . sh-mode)) -;; #+END_SRC - -;; Some modes that I don’t really customise much, mostly for -;; configuration files. -;; #+BEGIN_SRC emacs-lisp -(use-package haskell-mode - :mode (("\\.hs\\'" . haskell-mode))) - -(use-package dockerfile-mode - :mode (("Dockerfile\\'" . dockerfile-mode))) - -(use-package nix-mode - :mode (("\\.nix\\'" . nix-mode))) - -(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))) - -(use-package lua-mode - :defer t) - -(use-package ruby-mode - :mode (("\\.rb\\'" . ruby-mode) - ("\\.cap\\'" . ruby-mode))) - -(use-package go-mode - :mode (("\\.go\\'" . go-mode))) - -(use-package jinja2-mode - :mode (("\\.j2\\'" . jinja2-mode) - ("\\.jinja\\'" . jinja2-mode))) - -(use-package scss-mode - :defer t - :config (progn - (setq scss-compile-at-save nil))) - -(use-package toml-mode - :mode ("\\.toml\\'" . toml-mode)) - -(use-package 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)) - -(define-derived-mode saltstack-mode yaml-mode "Salt") -(add-to-list 'auto-mode-alist '("\\.sls\\'" . saltstack-mode)) -;; #+END_SRC - -;; *** ledger - -;; I use [[http://ledger-cli.org/][=ledger=]] to manage my finances. It has an Emacs mode, which -;; works really nicely. - -;; #+BEGIN_SRC emacs-lisp -(use-package ledger-mode - :mode ("\\.ledger\\'" . ledger-mode) - :functions ledger-report - :init (progn - (defun open-budget () - (interactive) - (projectile-switch-project-by-name "~/Sync/Default") - (find-file (expand-file-name "ledger/my.ledger" (projectile-project-root))) - (ledger-report "Budget (Cumulative)" nil))) - :config (progn - (setq ledger-use-iso-dates t - ledger-post-use-completion-engine :ido - ledger-reconcile-default-commodity "€" - ledger-clear-whole-transactions t - ledger-narrow-on-reconcile t - ledger-reports `(("Monthly Expenses" "ledger -f %(ledger-file) reg -M \\^Flex --real -X EUR -l \"payee != 'Opening Balances'\"") - ("Average Monthly Expenses (Past 12 Months)" ,(concat "ledger -f %(ledger-file) -b " - (format-time-string "%Y-%m" (time-add (current-time) (days-to-time -365))) - " --monthly --average balance ^Flex")) - ("Expenses:This Month" "ledger -f %(ledger-file) bal \\^Flex -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 \\^Assets:Budget$") - ("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 - -;; #+BEGIN_SRC emacs-lisp -(use-package markdown-mode - :defer t - :config (progn - (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) -;; #+END_SRC - -;; *** Lentic - -;; Multiple different views of the same file. Can be used for a kind of -;; inverse literate programming. - -;; #+BEGIN_SRC emacs-lisp -(use-package lentic - :config (global-lentic-mode)) -;; #+END_SRC - -;; *** Outshine - -;; Org-ified source code. I think this might work better than -;; lentic-mode, whilst also being more general. - -;; #+BEGIN_SRC emacs-lisp -(defvar outline-minor-mode-prefix "M-#") -(use-package outshine - :bind (:map outline-minor-mode-map - ("TAB" . outline-cycle) - ("" . outshine-cycle-buffer)) - :config (progn - (add-hook 'outline-minor-mode-hook #'outshine-hook-function) - (add-hook 'emacs-lisp-mode-hook #'outline-minor-mode) - (add-hook 'ledger-mode-hook #'outline-minor-mode) - (add-hook 'sh-mode-hook #'outline-minor-mode))) -;; #+END_SRC - -;; *** Org - -;; 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")) - - org-default-notes-file (concat org-directory "/notes") - - ;; ‘Remember’: new items at top - org-reverse-note-order t - - org-modules '(org-protocol) - - ;; Add time done to ‘done’ tasks - org-log-done 'time - - org-list-allow-alphabetical t - - org-adapt-indentation nil - - org-pretty-entities t - - org-table-duration-custom-format 'seconds - - org-src-fontify-natively nil - - org-export-have-math t - - org-blank-before-new-entry '((heading . t) - (plain-list-item . auto)) - org-fontify-done-headline t - - org-goto-interface 'outline-path-completion - - org-outline-path-complete-in-steps nil - - 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))) - -(use-package org-src - :ensure nil - :after org - :config (progn - (bind-key "C-x C-s" #'org-edit-src-exit org-src-mode-map))) -;; #+END_SRC - -;; ***** org-babel - -;; Org’s babel feature is really nice. I use it for this file, and I can -;; use it to communicate between programming languages. Sometime I hope -;; to have my =ledger= setup in an org file with some graph processing -;; with R or something. - -;; #+BEGIN_SRC emacs-lisp -(use-package ob-core - :defer t - :ensure nil - :config (progn - (org-babel-do-load-languages 'org-babel-load-languages - '((ledger . t) - (sh . t))) - (setq org-src-tab-acts-natively t - org-edit-src-content-indentation 0 - org-src-preserve-indentation t))) -;; #+END_SRC - -;; ***** org-journal - -;; 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" - org-journal-dir "~/Sync/Default/Documents/journal") - - (define-hook-helper org-journal-mode () - (use-variable-fonts) - (text-scale-adjust 4) - (if smartparens-strict-mode - (smartparens-strict-mode -1)) - (if show-smartparens-mode - (show-smartparens-mode -1))) - (defun org-journal-display-entry-yesterday () - "Show org-journal entry for yesterday" - (interactive) - (org-journal-read-or-display-entry (yesterday-time))))) -;; #+END_SRC - - -;; ** Programming -;; *** flycheck - -;; 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 mode-enabled)) - (setq flycheck-indication-mode 'left-fringe) - (with-eval-after-load 'git-gutter-fringe - (fringe-helper-define 'flycheck-fringe-bitmap-double-arrow '(center repeated) - ".XXX....")) - (if (executable-find "eslint_d") - (setq flycheck-javascript-eslint-executable "eslint_d")))) -;; #+END_SRC - -;; **** flycheck-pos-tip - -;; Show flycheck errors in a little popup, so I don't lose my place - -;; #+BEGIN_SRC emacs-lisp -(use-package flycheck-pos-tip - :after flycheck - :config (progn - (setq flycheck-display-errors-delay 0.5) - (flycheck-pos-tip-mode 1))) -;; #+END_SRC - -;; **** flycheck-flow - -;; #+BEGIN_SRC emacs-lisp -(use-package flycheck-flow - :after js2-mode - :if (executable-find "flow") - :config (progn - (flycheck-add-next-checker 'javascript-eslint 'javascript-flow))) -;; #+END_SRC - -;; *** golang - -;; 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 - (define-hook-helper go-mode () - (set (make-local-variable 'company-backends) - '(company-go))))) - -(use-package go-eldoc - :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))) - - -;; #+END_SRC - -;; *** ggtags - -;; A nice completion backend for programming modes. - -;; #+BEGIN_SRC emacs-lisp -(use-package ggtags - :if (executable-find "gtags") - :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 - -;; *** dumb-jump - -;; A "clever" way of implementing go-to-definition across languages: use -;; a project-wide text search and apply heuristics to the results to -;; guess a definition. - -;; #+BEGIN_SRC emacs-lisp -(use-package dumb-jump - :bind (("M-g o" . dumb-jump-go-other-window) - ("M-g j" . dumb-jump-go) - ("M-g x" . dumb-jump-go-prefer-external) - ("M-g z" . dumb-jump-go-prefer-external-other-window)) - :config (setq dumb-jump-selector 'ivy)) -;; #+END_SRC - -;; *** imenu-anywhere - -;; This is like imenu, but shows functions (or similar top-level -;; entities) across buffers in the same project. Neat! - -;; #+BEGIN_SRC emacs-lisp -(use-package imenu-anywhere - :bind ("C-x C-." . ivy-imenu-anywhere)) -;; #+END_SRC -;; *** Lisps - -;; **** All - -;; Lisp modes don’t seem to have a common ancestor. So I made a custom -;; hook which I trigger in every lispy-mode. - -;; #+BEGIN_SRC emacs-lisp -(defcustom lisp-mode-common-hook nil - "Hook run when entering any Lisp mode." - :type 'hook - :group 'lisp) - -(create-hook-helper lisp-mode-setup () - :hooks (emacs-lisp-mode-hook - scheme-mode-hook - lisp-mode-hook - clojure-mode-hook) - (run-hooks 'lisp-mode-common-hook)) -;; #+END_SRC - -;; ***** Redshank - -;; Lisp syntax allows for really easy refactoring. Redshank gives some -;; 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))) -;; #+END_SRC - -;; **** Emacs Lisp - -;; Customise the modeline-display of =emacs-lisp-mode=. Then make sure -;; it runs the common lisp hooks. - -;; #+BEGIN_SRC emacs-lisp -(add-hook 'emacs-lisp-mode-hook #'eldoc-mode) -;; #+END_SRC - -;; 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))) -;; #+END_SRC - -;; Interactive elisp - -;; #+BEGIN_SRC emacs-lisp -(use-package ielm - :defer t - :ensure nil - :config (progn - (define-hook-helper ielm-mode () - (run-hooks 'lisp-mode-common-hook)))) -;; #+END_SRC - -;; **** Scheme & Lisp - -;; I don’t work with these as often as I would like - -;; #+BEGIN_SRC emacs-lisp -(define-hook-helper lisp-mode () - (set (make-local-variable 'lisp-indent-function) - #'common-lisp-indent-function)) -;; #+END_SRC - -;; ***** geiser - -;; A REPL thing for Scheme. Hopefully I’ll get to use it more in the -;; future. - -;; #+BEGIN_SRC emacs-lisp -(use-package geiser - :commands (geiser-mode - geiser - run-geiser - run-racket)) -;; #+END_SRC - -;; ***** slime - -;; A REPL thing (and more) for Lisp. - -;; #+BEGIN_SRC emacs-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 '(slime-fancy slime-asdf))) - (setq common-lisp-hyperspec-root "file://opt/local/share/doc/lisp/HyperSpec-7-0/" - inferior-lisp-program (or (executable-find "sbcl") - (executable-find "ccl64"))))) -;; #+END_SRC - -;; **** Clojure - -;; #+BEGIN_SRC emacs-lisp -(use-package clojure-mode - :defer t - :init (progn - (define-hook-helper cider-repl-mode () - (highlight-changes-mode -1)))) - -(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 - (define-hook-helper clojure-mode () - (clj-refactor-mode 1)))) -;; #+END_SRC - -;; ***** cider - -;; A REPL thing for Clojure - -;; #+BEGIN_SRC emacs-lisp -(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))) -;; #+END_SRC - -;; *** Auto-compile - -;; Auto-compile emacs lisp when saving. -;; #+BEGIN_SRC emacs-lisp -(use-package auto-compile - :defer t - :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) -;; #+END_SRC - -;; *** cc-mode - -;; Although I don’t use C or C++, setting up the mode is helpful because -;; quite a few other modes are derived from it. - -;; #+BEGIN_SRC emacs-lisp -(use-package cc-mode - :defer 5 - :config (progn - (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 - -;; It’s nice to be able to quickly evaluate some code. Although I don’t -;; really seem to use it. -;; #+BEGIN_SRC emacs-lisp -(use-package quickrun - :bind (("C-c C-e" . quickrun))) -;; #+END_SRC - -;; *** Scala - -;; Let’s try using Scala. - -;; #+BEGIN_SRC emacs-lisp -(use-package scala-mode) -;; #+END_SRC - -;; And add ensime, an IDE-style environment. - -;; #+BEGIN_SRC emacs-lisp -(use-package ensime) -;; #+END_SRC - -;; *** Web development - -;; **** js2-mode - -;; This mode is really great for editing Javascript. It turns code into -;; an AST internally, so it can work with it almost like a lisp. - -;; #+BEGIN_SRC emacs-lisp -(use-package js2-mode - :mode (("\\.js\\'" . js2-mode)) - :interpreter ("node" . js2-mode) - :functions (js2-next-error - js2--struct-put) - :config (progn - (define-key js2-mode-map [menu-bar Javascript] nil) - (add-hook 'js2-mode-hook #'js2-imenu-extras-mode) - (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) - (setq js2-basic-offset 2 - js-switch-indent-offset 2 - js2-include-node-externs t - js2-highlight-level 1 - js2-strict-missing-semi-warning nil))) -;; #+END_SRC - -;; ***** rjsx-mode - -;; A set of advice for js2-jsx-mode to work better with React. - -;; #+BEGIN_SRC emacs-lisp -(use-package rjsx-mode - :after js2-mode - :if (fboundp #'js2--struct-put) - :mode (("\\.jsx\\'" . rjsx-mode))) -;; #+END_SRC - -;; ***** js2-refactor - -;; Thanks to the AST provided by js2-mode, refactoring is possible. This -;; library implements some refactorings. - -;; #+BEGIN_SRC emacs-lisp -(use-package js2-refactor - :after js2-mode - :config (progn - (bind-key "C-k" #'js2r-kill js2-mode-map) - (add-hook 'js2-mode-hook #'js2-refactor-mode) - (js2r-add-keybindings-with-prefix "C-c C-m"))) -;; #+END_SRC - -;; ***** add-node-modules-path - -;; Inside a javascript project, it's common to install tools locally to -;; the project. This will allows emacs to find their executables. - -;; #+BEGIN_SRC emacs-lisp -(use-package add-node-modules-path - :config (progn - (add-hook 'js2-mode-hook #'add-node-modules-path))) -;; #+END_SRC - -;; ***** Flow - -;; #+BEGIN_SRC emacs-lisp -(use-package flow-minor-mode - :after js2-mode - :config (progn - (add-hook 'js2-mode-hook #'flow-minor-enable-automatically))) -;; #+END_SRC - -;; ***** Indium - -;; Javascript with an inferior node.js process and a debugger? Awesome. - -;; To debug with node, use version 6.9.1 or later of node and run it with -;; ~--inspect~ and, to break on the first line, ~--debug-brk~. - -;; For Chrom*, it needs to be launched with -;; ~--remote-debugging-port=9222~ - -;; Node will tell you to open an URL in Chrome: - -;; ~chrome-devtools://inspector.html?...&ws=127.0.0.1:PORT/PATH~ - -;; Instead, do this: - -;; ~M-x indium-connect-to-nodejs RET 127.0.0.1 RET PORT RET~ - -;; #+BEGIN_SRC emacs-lisp -(use-package indium - :diminish (indium-interaction-mode . "In") - :config (progn - (add-hook 'js2-mode-hook #'indium-interaction-mode))) -;; #+END_SRC - -;; **** tern - -;; Tern understands javascript. It adds really clever documented -;; completions, besides other IDE-like things. - -;; #+BEGIN_SRC emacs-lisp -(use-package tern - :diminish tern-mode - :if (executable-find "tern") - :defer 5 - :config (progn - (setq tern-command (list (executable-find "tern"))) - (create-hook-helper tern-mode-on () - :hooks (web-mode-hook - js2-mode-hook) - (tern-mode +1)))) - -(with-eval-after-load '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))) -;; #+END_SRC - -;; **** restclient - -;; Restclient is really nice. It’s like a scratchpad for HTTP api -;; calls. Feels a bit like using =org-babel=. I wonder if there’s an -;; 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))) - -(use-package company-restclient - :after (company restclient) - :init (add-to-list 'company-backends #'company-restclient t)) -;; #+END_SRC - -;; **** sgml-mode - -;; This is for HTML, since old versions of HTML were derived from SGML. -;; #+BEGIN_SRC emacs-lisp -(use-package sgml-mode - :defer t - :config (setq sgml-basic-offset 2)) -;; #+END_SRC - -;; **** emmet-mode - -;; Emmet is really nice to write HTML quickly. Especially with -;; frameworks that require multiple nested elements to do anything useful. -;; #+BEGIN_SRC emacs-lisp -(use-package emmet-mode - :commands (emmet-mode) - :diminish (emmet-mode . " >") - :init (progn - (setq emmet-indentation 2 - emmet-self-closing-tag-style " /") - (add-hook 'sgml-mode-hook #'emmet-mode) - (add-hook 'web-mode-hook #'emmet-mode) - (add-hook 'css-mode-hook #'emmet-mode))) -;; #+END_SRC - -;; **** web-mode - -;; This mode handles just about every templating language out ther, which -;; is really nice, because it handles the HTML part the same way in all -;; of them as well. - -;; #+BEGIN_SRC emacs-lisp -(use-package web-mode - :mode (("/views/.*\\.php\\'" . web-mode) - ("\\.html\\'" . web-mode) - ("/templates/.*\\.php\\'" . web-mode) - ("\\.ejs\\'" . web-mode) - ("\\.njk\\'" . web-mode)) - :config (progn - (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 - web-mode-enable-auto-pairing nil - web-mode-enable-auto-quoting nil) - (sp-local-pair '(web-mode) "<%" "%>"))) -;; #+END_SRC - -;; *** Live coding - -;; Sometimes I might want to show off my emacs usage. - -;; #+BEGIN_SRC emacs-lisp -(defun live-coding () - (interactive) - (ap/set-fonts "SF Mono" 18 nil nil t 0.1) - (global-command-log-mode 1)) - -(defun live-coding-stop () - (interactive) - (ap/set-fonts-according-to-system) - (global-command-log-mode -1)) -;; #+END_SRC - -;; **** command-log-mode - -;; #+BEGIN_SRC emacs-lisp -(use-package command-log-mode - :defines command-log-mode-key-binding-open-log - :init (progn - (setq command-log-mode-key-binding-open-log nil - command-log-mode-auto-show t - command-log-mode-is-global t))) -;; #+END_SRC - -;; ** Spelling - -;; #+BEGIN_SRC emacs-lisp -(use-package ispell - :bind (("" . ispell-word)) - :config (progn - (cond - ((executable-find "aspell") (setq ispell-program-name "aspell" - ispell-dictionary "british" - ispell-really-aspell t - ispell-really-hunspell nil)) - ((executable-find "hunspell") (setq ispell-program-name "hunspell" - ispell-really-aspell nil - ispell-really-hunspell t))))) -;; #+END_SRC - -;; #+BEGIN_SRC emacs-lisp -(use-package flyspell - :diminish "﹏" - :config (progn - (defun flyspell-detect-ispell-args (&optional run-together) - "If RUN-TOGETHER is true, spell check the CamelCase words. - Please note RUN-TOGETHER will make aspell less capable. So it should only be used in prog-mode-hook." - (let (args) - (when ispell-program-name - (cond - ((string-match "aspell$" ispell-program-name) - (setq args (list "--sug-mode=ultra")) - (if run-together - (setq args (append args '("--run-together" "--run-together-limit=16" "--run-together-min=2"))))) - ((string-match "hunspell$" ispell-program-name) - (setq args nil)))) - args)) - ;; `ispell-extra-args' is *always* used when start CLI aspell process - (setq-default ispell-extra-args (flyspell-detect-ispell-args t)) - ;; (setq ispell-cmd-args (flyspell-detect-ispell-args)) - (defadvice ispell-word (around my-ispell-word activate) - (let ((old-ispell-extra-args ispell-extra-args)) - (ispell-kill-ispell t) - ;; use emacs original arguments - (setq ispell-extra-args (flyspell-detect-ispell-args)) - ad-do-it - ;; restore our own ispell arguments - (setq ispell-extra-args old-ispell-extra-args) - (ispell-kill-ispell t))) - - (defadvice flyspell-auto-correct-word (around my-flyspell-auto-correct-word activate) - (let* ((old-ispell-extra-args ispell-extra-args)) - (ispell-kill-ispell t) - ;; use emacs original arguments - (setq ispell-extra-args (flyspell-detect-ispell-args)) - ad-do-it - ;; restore our own ispell arguments - (setq ispell-extra-args old-ispell-extra-args) - (ispell-kill-ispell t))) - (setq flyspell-issue-message-flag nil) - - (defun fly-text-mode-hook-setup () - ;; Turn off RUN-TOGETHER option when spell check text-mode - (setq-local ispell-extra-args (flyspell-detect-ispell-args))) - (add-hook 'text-mode-hook 'fly-text-mode-hook-setup) - (add-hook 'prog-mode-hook #'flyspell-prog-mode))) -;; #+END_SRC - -;; *** Style checking - -;; [[https://github.com/ValeLint/vale][Vale]] is a linter, but for prose. Neat idea! Salesman is a bad term. - -;; #+BEGIN_SRC emacs-lisp -(use-package flycheck-vale - :if (executable-find "vale") - :config (progn - (add-to-list 'flycheck-vale-modes 'org-mode) - (add-to-list 'flycheck-vale-modes 'org-journal-mode) - (flycheck-vale-setup))) -;; #+END_SRC - -;; ** Scripting - -;; 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) - -(use-package sh-script - :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)) -;; #+END_SRC - -;; #+BEGIN_SRC emacs-lisp -(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) -;; #+END_SRC - -;; *** eshell - -;; I should try to get into the habit of using this more. It’s really -;; nice, when I remember to use it. - -;; #+BEGIN_SRC emacs-lisp -(use-package eshell - :bind ("C-c s" . eshell) - :defer 10 - :functions (eshell/pwd) - :config (progn - (setq eshell-directory-name "~/.emacs.d/eshell" - eshell-prompt-function (lambda () - (concat - (eshell/pwd) - "\n$ "))) - (define-hook-helper eshell-load () - (bind-key "C-c C-l" #'counsel-esh-history eshell-mode-map)))) - -(use-package em-smart - :ensure nil - :commands eshell-smart-initialize - :init (progn - (add-hook 'eshell-load-hook #'eshell-smart-initialize)) - :config (progn - (setq eshell-where-to-jump 'begin - eshell-review-quick-commands nil - eshell-smart-space-goes-to-end t))) - -(autoload #'eshell/cd "em-dirs") -(defun eshell-goto-current-dir (&optional arg) - (interactive "P") - (let ((dir default-directory)) - (eshell arg) - (eshell/cd dir))) -(bind-key "C-c S" #'eshell-goto-current-dir) - - -;; #+END_SRC - -;; **** Shells - -;; #+BEGIN_SRC emacs-lisp -(use-package shell - :defer t - :ensure nil - :config (define-key shell-mode-map - (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) - -(use-package comint - :defer t - :ensure nil - :config (bind-key "C-c C-l" #'counsel-shell-history comint-mode-map)) - -(defun comint-delchar-or-eof-or-kill-buffer (arg) - (interactive "p") - (if (null (get-buffer-process (current-buffer))) - (kill-buffer) - (comint-delchar-or-maybe-eof arg))) -;; #+END_SRC - -;; ** Text editing - -;; Emacs has an editor within. - -;; #+BEGIN_SRC emacs-lisp -(put 'upcase-region 'disabled nil) -(put 'downcase-region 'disabled nil) -(setq sentence-end-double-space t - line-move-visual nil) -(setq-default truncate-lines t) -;; #+END_SRC - -;; *** align - -;; =Align= is a useful command to line things up, once given some rules. -;; 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)))))) -;; #+END_SRC - -;; *** Clipboard - -;; I like to use the clipboard more than the primary selection in X11. - -;; #+BEGIN_SRC emacs-lisp -(setq select-enable-clipboard t - save-interprogram-paste-before-kill t) -(if (functionp '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 - -;; *** Selection - -;; I’m quite used to deleting text by selecting it and typing. Emacs has -;; a mode for that. - -;; #+BEGIN_SRC emacs-lisp -(use-package delsel - :config (delete-selection-mode t)) -;; #+END_SRC - -;; 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)) -;; #+END_SRC - -;; I find that =zap-up-to-char= normally makes more sense to me than -;; =zap-to-char=. - -;; #+BEGIN_SRC emacs-lisp -(use-package misc - :ensure nil - :bind (("M-z" . zap-up-to-char) - ("M-Z" . zap-to-char))) -;; #+END_SRC - -;; Expanding the region by semantic units was something I quite liked -;; 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)) -;; #+END_SRC - -;; *** avy - -;; Avy is a really nice way to move around files, like ace-jump-mode, but -;; somehow I prefer it. - -;; #+BEGIN_SRC emacs-lisp -(use-package avy - :defer 5 - :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 ?\;)))) -;; #+END_SRC - -;; **** ace-link - -;; Visit any link. Despite the name, this works with avy. - -;; #+BEGIN_SRC emacs-lisp -(use-package ace-link - :after avy - :config (progn - (ace-link-setup-default) - (with-eval-after-load "gnus" - (bind-key "M-o" #'ace-link-gnus gnus-summary-mode-map) - (bind-key "M-o" #'ace-link-gnus gnus-article-mode-map)))) -;; #+END_SRC - -;; *** goto-chg - -;; This is like popping the mark, only it filters to only change areas -;; and doesn’t go back to the same place more than once. - -;; #+BEGIN_SRC emacs-lisp -(use-package goto-chg - :bind ("C-c C-SPC" . goto-last-change)) -;; #+END_SRC - -;; *** beginend - -;; In special buffers, I would rather have =M->= and =M-<= goto the -;; logical beginning/end rather than the physical ones. - -;; #+BEGIN_SRC emacs-lisp -(use-package beginend - :config (progn - (beginend-setup-all))) -;; #+END_SRC - -;; *** multiple-cursors - -;; I mentioned before that I’d used Sublime Text before. Multiple -;; cursors was one of my favourite features, so I was really happy when I -;; saw that multiple-cursors was released for Emacs. - -;; #+BEGIN_SRC emacs-lisp -(use-package multiple-cursors - :defer 1 - :bind* (("C-." . mc/mark-next-like-this) - ("C-," . mc/mark-previous-like-this) - ("M-" . mc/mark-all-like-this-dwim) - ("C-" . mc/mark-more-like-this-extended) - ("C-S-L" . mc/edit-lines))) -;; #+END_SRC - -;; *** paredit - -;; Balanced parentheses in lisps are nice, but all the refactoring and -;; 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))) -;; #+END_SRC - -;; *** smartparens - -;; I like to use smartparens where paredit isn’t already useful. Somehow -;; I didn’t find smartparens’ implementation of paredit style to be as -;; 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-" #'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-" #'sp-splice-sexp-killing-backward smartparens-mode-map) - (bind-key "M-" #'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-" #'sp-slurp-hybrid-sexp smartparens-mode-map) - (show-smartparens-global-mode t) - (smartparens-global-strict-mode t) - (define-hook-helper lisp-mode-common () - (smartparens-strict-mode -1) - (smartparens-mode -1)))) -;; #+END_SRC - - -;; *** move-text - -;; Transposing lines, made easier. - -;; #+BEGIN_SRC emacs-lisp -(use-package move-text - :config (move-text-default-bindings)) -;; #+END_SRC - -;; *** undo-tree - -;; Emacs’ default handling of undo is a bit confusing. Undo-tree makes -;; 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))) - :diminish undo-tree-mode) -;; #+END_SRC - -;; *** replace - -;; #+BEGIN_SRC emacs-lisp -(with-eval-after-load "replace.el" - (setq case-replace nil)) -;; #+END_SRC - -;; *** visual-regexp - -;; I don’t always remember exactly how Emacs’ regular expressions work, -;; so this package is pretty useful because it highlights everything in -;; 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))) -;; #+END_SRC - -;; ** End - -;; Start a server if possible. A daemon is already a server. -;; #+BEGIN_SRC emacs-lisp -(use-package server - :defer 2 - :if (not (daemonp)) - :config (unless (server-running-p server-name) - (server-start))) -;; #+END_SRC +(load-file (expand-file-name "main.el" user-emacs-directory)) +;;; init ends here diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el new file mode 100644 index 00000000..0ca1211c --- /dev/null +++ b/emacs/.emacs.d/main.el @@ -0,0 +1,2821 @@ +;;; emacs-config --- Summary +;; #+TITLE: Emacs Configuration for Alan Pearce +;; #+OPTIONS: ^:nil +;; #+PROPERTY: results silent +;; #+PROPERTY: eval no-export +;; #+PROPERTY: header-args :comments link +;;; Header: +;; This is a living document, detailing my Emacs configuration using org-mode +;;; Code: +;; ** Basics +;; *** Startup +;; 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-screen t) +(setq gc-cons-threshold 100000000) +(add-hook 'after-init-hook + (lambda () + (setq gc-cons-threshold 800000))) +(remove-hook 'find-file-hooks #'vc-refresh-state) +;; #+END_SRC + +;; Are we running on Windows via the WSL? + +;; #+BEGIN_SRC emacs-lisp +(when (file-exists-p "/proc/sys/kernel/osrelease") + (with-temp-buffer + (insert-file-contents-literally "/proc/sys/kernel/osrelease") + (decode-coding-region (point-min) (point-max) 'utf-8 t) + (when (string-match "Microsoft$" (buffer-string)) + (setq system-type 'gnu/linux/windows)))) +;; #+END_SRC + +;; *** Compatibility + +;; #+BEGIN_SRC emacs-lisp +(if (version< emacs-version "25.0") + (defmacro with-eval-after-load (file &rest body) + `(eval-after-load ,file (lambda () ,@body)))) +;; #+END_SRC + +;; *** Scratch buffers +;; I usually use scratch buffers for any sort of text. If I need a +;; 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) +;; #+END_SRC + +;; *** Personal Information +;; #+BEGIN_SRC emacs-lisp +(setq user-mail-address "alan@alanpearce.eu" + user-full-name "Alan Pearce") +;; #+end_src + +;; ** Packaging + +;; *** Use-package + +;; #+BEGIN_SRC emacs-lisp +(eval-and-compile + (require 'seq) + (defvar nix-emacs (and (string-match "^/nix/store" invocation-directory) + (not (null (seq-some (lambda (dir) (string-match "^/nix/store" dir)) load-path))))) + + (setq tls-checktrust t + gnutls-verify-error t + package-menu-async t + package-user-dir (concat "~/.emacs.d/packages/" emacs-version "/elpa") + package-menu-hide-low-priority t) + (unless nix-emacs + (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") + ("melpa-stable" . "https://stable.melpa.org/packages/") + ("melpa" . "https://melpa.org/packages/")) + package-pinned-packages '(("use-package" . melpa-stable) + ("diminish" . melpa-stable) + ("bind-key" . melpa-stable)) + package-archive-priorities '(("melpa" . 10) + ("gnu" . 10) + ("melpa-stable" . 5) + ("marmalade" . 0)))) + (when (eq system-type 'darwin) + (with-eval-after-load "gnutls" + (add-to-list 'gnutls-trustfiles "/etc/ssl/cert.pem"))) + (unless nix-emacs + (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)) +(setq use-package-always-ensure (not nix-emacs) + use-package-always-demand (daemonp) + package-enable-at-startup nil) +;; #+END_SRC + +;; *** Helpers + +;; **** Hook Helpers + +;; An improvement over add-hook with lamda functions that allows +;; modification and removal, without the boilerplate of an extra function +;; definition. + +;; #+BEGIN_SRC emacs-lisp +(eval-and-compile + (use-package hook-helpers)) +;; #+END_SRC + +;; ** Customize +;; I don’t really like using customize for normal configuration. +;; Instead, I use it for things that get saved automatically. That’s why +;; I use a different file, which is ignored by the VCS. It also means +;; that it’s not important whether the file exists or not, which is why I +;; pass =:noerror= to =load= + +;; #+BEGIN_SRC emacs-lisp +(setq custom-file "~/.emacs.d/custom.el") +(load custom-file :noerror :nomessage) +;; #+END_SRC + +;; ** Styles + +;; I prefer an always-visible cursor. Feels less distracting. +;; #+BEGIN_SRC emacs-lisp +(when (fboundp #'blink-cursor-mode) + (blink-cursor-mode -1)) +;; #+END_SRC + +;; 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)) +(with-eval-after-load 'scroll-bar + (set-scroll-bar-mode nil)) +(with-eval-after-load 'tooltip + (tooltip-mode -1)) +(with-eval-after-load 'tool-bar + (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)))) +;; #+END_SRC + +;; *** Colours + +;; Eziam looks nice, too, except for the non-white background. I prefer +;; white because most other application backgrounds are that colour. + +;; #+BEGIN_SRC emacs-lisp +(use-package eziam-light-theme + :ensure eziam-theme + :disabled t + :if (or window-system + (daemonp)) + :defines (eziam-scale-headings) + :config (progn + (setq eziam-scale-headings nil) + (load-theme 'eziam-light t) + (custom-theme-set-faces 'user + '(default ((t (:background "#ffffff")))) + '(js2-function-call ((t (:underline nil)))) + '(js2-object-property ((t (:slant normal)))) + '(font-lock-keyword-face ((t (:weight normal)))) + '(git-gutter-fr:added ((t (:foreground "#96a4ab")))) + '(git-gutter-fr:modified ((t (:foreground "#96a4ab")))) + '(git-gutter-fr:deleted ((t (:foreground "#96a4ab"))))))) +;; #+END_SRC + +;; White-theme. Sounds like a good idea. + +;; #+BEGIN_SRC emacs-lisp +(use-package white-theme + :if (or window-system + (daemonp)) + :config (progn + (load-theme 'white t) + (custom-theme-set-faces 'user + '(git-gutter-fr:added ((t (:foreground "#b8b8b8")))) + '(git-gutter-fr:modified ((t (:foreground "#b8b8b8")))) + '(git-gutter-fr:deleted ((t (:foreground "#b8b8b8")))) + '(font-lock-string-face ((t (:slant normal))))))) +;; #+END_SRC + +;; Base16 theming allows me have a consistent style between applications +;; quite easily. + +;; #+BEGIN_SRC emacs-lisp +(use-package base16-theme + :if (or window-system + (daemonp))) +;; #+END_SRC + +;; Highlighting quasi-quoted expressions in lisps is quite useful, but I +;; don't need it all the time. I'll keep it around for a while so that I +;; can enable it if needed. +;; #+BEGIN_SRC emacs-lisp +(use-package highlight-stages + :diminish highlight-stages-mode) +;; #+END_SRC + +;; *** Fonts + +;; 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 . 1))) + + (defun ap/set-fonts (mono-face mono-font-size variable-face variable-font-size antialias &optional new-line-spacing) + (if (boundp 'ns-antialias-text) + (setq ns-antialias-text antialias)) + (if (boundp 'new-line-spacing) + (setq line-spacing new-line-spacing)) + (when mono-face + (let ((default-font (font-spec :family mono-face :size mono-font-size))) + (add-to-list 'default-frame-alist `(font . ,(format "%s %s" mono-face mono-font-size))) + (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 t)) + ((or (eq window-system 'mac) + (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 "Fira Code" 14 "Lucida Grande" 14 t nil) + (ap/set-fonts "Monoid" 12 "Helvetica Neue" 12 t 0.1)))) + ((and (eq window-system 'x) + (not (eq system-type 'gnu/linux/windows))) + (set-fontset-font "fontset-default" 'unicode (font-spec :name "PT Mono" :size 14)) + (ap/set-fonts "PT Mono" 14 "Noto Sans" 14 nil)) + ((and (eq window-system 'x) + (eq system-type 'gnu/linux/windows)) + (ap/set-fonts "Noto Mono" 12 "Sans" 12 nil)))) + + (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))) +;; #+END_SRC + +;; Make symbols prettier. Turns out, in many cases, this is already +;; configured, just not enabled. If using the mac-port version of Emacs, +;; it has it's own, more extensive version. + +;; #+BEGIN_SRC emacs-lisp +(if (eq window-system 'mac) + (mac-auto-operator-composition-mode +1) + (global-prettify-symbols-mode +1)) +;; #+END_SRC + +;; *** Page Breaks + +;; By default, Emacs displays page breaks as ^L. Lines look much nicer. +;; On Windows, Emacs incorrectly detects that U+2500 (Box Drawings Light +;; Horizontal) can only be displayed with a different font, which is not +;; 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))))) +;; #+END_SRC +;; *** Modeline + +;; #+BEGIN_SRC emacs-lisp +(column-number-mode -1) +(line-number-mode -1) +(size-indication-mode t) + + +(require 'f) +(setq frame-title-format (list "Emacs" + (if (and nix-emacs invocation-directory) + (list " (Nix Generation " + (cadr + (split-string (f-base + (car + (last (seq-take-while + (lambda (s) (s-contains? "profile" s)) + (split-string + (s-chomp (shell-command-to-string (concat "nix-store -q --roots " invocation-directory))) + "\n"))))) + "-")) + " " + (s-left 6 (nth 3 (f-split invocation-directory))) + "..." + (s-right 6 (car (split-string (nth 3 (f-split invocation-directory)) "-"))) + ")")) + '(buffer-file-name " — %f") + '(dired-directory (" — " dired-directory)))) +;; #+END_SRC + +;; *** Chrome + +;; Sometimes I like to hide clutter. Other times, it's useful. + +;; #+BEGIN_SRC emacs-lisp +(defvar mode-line-default-format mode-line-format) +(defvar mode-line-default-hidden nil + "Whether to hide the mode line by default") + +(defun show-mode-line () + (interactive) + (setq mode-line-format mode-line-default-format) + (when (called-interactively-p 'interactive) + (setq-default mode-line-format mode-line-default-format) + (setq mode-line-default-hidden nil))) +(defun hide-mode-line () + (interactive) + (setq mode-line-format nil) + (when (called-interactively-p 'interactive) + (setq-default mode-line-format nil) + (setq mode-line-default-hidden t))) + +(setq-default cursor-in-non-selected-windows nil) + +(defun hide-clutter () + (interactive) + (hide-mode-line)) + +(defun show-clutter () + (interactive) + (show-mode-line)) + +(when mode-line-default-hidden + (call-interactively #'hide-mode-line)) + +(setq-default indicate-buffer-boundaries nil) +(fringe-mode '(4 . 4)) + +(defun hide-mode-line-if-default-hidden () + (if mode-line-default-hidden + (hide-mode-line) + (show-mode-line))) + +(add-to-list 'default-frame-alist '(border-width . 0)) +(add-to-list 'default-frame-alist '(internal-border-width . 0)) +(when (or (eq window-system 'x) + (eq window-system 'mac)) + (setq window-divider-default-bottom-width 1 + window-divider-default-right-width 1 + window-divider-default-places t) + (window-divider-mode +1)) + +(add-hook 'after-change-major-mode-hook #'hide-mode-line-if-default-hidden) + +(add-hook 'minibuffer-setup-hook #'show-mode-line) +(add-hook 'minibuffer-exit-hook #'hide-mode-line) +;; #+END_SRC + +;; *** Highlight Changes + +;; 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))) +;; #+END_SRC + +;; *** Beacon + +;; I was against the idea of having flashy animations inside Emacs, but +;; this one is useful. It highlights the cursor when scrolling or +;; switching windows. + +;; #+BEGIN_SRC emacs-lisp +(use-package beacon + :diminish beacon-mode + :config (progn + (beacon-mode +1) + (setq beacon-blink-delay 0.25 + beacon-blink-duration 0.25 + beacon-size 20 + beacon-color "#a1b56c"))) +;; #+END_SRC + +;; *** Renaming major modes + +;; Diminishing major modes does not happen in the same manner as minor +;; modes. + +;; #+BEGIN_SRC emacs-lisp +(unless (version<= emacs-version "24.4") + (use-package cyphejor + :defer 2 + :config (progn + (setq cyphejor-rules `(("emacs" "ε") + ("diff" "Δ") + ("js2" "js") + ("magit-status" ,(char-to-string (seq-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 + + +;; ** Environment Variables + +;; MacOS doesn’t have a reasonable way to set environment variables and +;; read them automatically any more. So, let’s use the +;; [[https://github.com/purcell/exec-path-from-shell][exec-path-from-shell]] package to set up ~exec-path~ and similar +;; variables from whatever my shell configuration is. + +;; On Windows, I like to run Emacs from the system tray menu of VcXsrv. +;; It starts up without an environment in this case as well. + +;; #+BEGIN_SRC emacs-lisp +(use-package exec-path-from-shell + :if (or (eq system-type 'darwin) + (eq system-type 'gnu/linux/windows) + (and (eq system-type 'gnu/linux) + (daemonp))) + :config (progn + (setq exec-path-from-shell-arguments '("-l")) + (exec-path-from-shell-initialize))) +;; #+END_SRC + +;; *** NixOS sandboxes + +;; I'm currently exploring using nix to create sandboxes for +;; development. This package allows using tools from inside sandboxes, +;; and some convenience commands for building packages and launching shells. + +;; #+BEGIN_SRC emacs-lisp +(use-package nix-sandbox + :config (progn + (with-eval-after-load 'flycheck + (setq flycheck-command-wrapper-function + (lambda (command) + (if (nix-current-sandbox) + (apply 'nix-shell-command (nix-current-sandbox) command) + command)) + flycheck-executable-find + (lambda (cmd) + (if (nix-current-sandbox) + (nix-executable-find (nix-current-sandbox) cmd) + (executable-find cmd))))))) +;; #+END_SRC + +;; ** Keybindings + +;; I think =set-keyboard-coding-system= stops OS X from doing something +;; annoying to add accents. The modifier setup is to match my +;; re-arrangement of modifiers on OSX: Cmd on the outside, then +;; 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")) +;; #+END_SRC + +;; #+BEGIN_SRC emacs-lisp +(unbind-key "") +(bind-key* "" #'compile) +(bind-key* "" #'kmacro-start-macro-or-insert-counter) +(bind-key* "" #'kmacro-end-or-call-macro) + +(bind-key* "" #'execute-extended-command) + +(unbind-key "C-z") +(bind-key* "C-" #'other-window) + +(bind-key* "C-x C-r" #'revert-buffer) +(bind-key* "C-x C-j" #'delete-indentation) +(unbind-key "C-x C-c") + +(bind-key* "C-c i" #'insert-char) +(bind-key* "M-/" #'hippie-expand) + +(unbind-key "s-h") +(unbind-key "s-n") +(unbind-key "s-p") +(unbind-key "s-w") +(bind-key* "s-k" #'kill-or-delete-this-buffer-dwim) + +(bind-key "C-M-a" #'backward-paragraph text-mode-map) +(bind-key "C-M-e" #'forward-paragraph text-mode-map) + +(bind-key* "s-x" (define-prefix-command 'super-x-map)) +(bind-key* "s-," #'switch-to-dotfiles) +(bind-key* "C-x M-x" #'execute-extended-command) +(set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) +;; #+END_SRC + +;; *** Crux + +;; I can replace most of the simple helper/wrapper functions in my +;; 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)) + :config (progn + (crux-reopen-as-root-mode +1)) + :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 +(defun switch-to-dotfiles () + (interactive) + (projectile-switch-project-by-name (car (split-string (shell-command-to-string "ghq list --full-path dotfiles"))))) +;; #+END_SRC + +;; *** The Silver Searcher + +;; #+BEGIN_SRC emacs-lisp +(use-package ag + :defer 30 + :config (setq ag-project-root-function #'projectile-project-root)) + +(use-package wgrep-ag + :after ag) +;; #+END_SRC + +;; *** Ripgrep + +;; Step over Silver Search, here comes a new challenger. + +;; #+BEGIN_SRC emacs-lisp +(use-package ripgrep + :if (executable-find "rg")) + +(use-package projectile-ripgrep + :after (ripgrep projectile) + :if (executable-find "rg") + :bind (("C-c p s r" . projectile-ripgrep))) +;; #+END_SRC + +;; *** Projectile + +;; Projectile is awesome for working in projects, especially VCS-backed +;; ones. + +;; #+BEGIN_SRC emacs-lisp +(use-package projectile + :bind (("s-p" . projectile-switch-project) + ("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-mode +1) + (add-to-list 'projectile-globally-ignored-directories ".stversions") + + (defun yarn-install (&optional arg) + (interactive "P") + (projectile-with-default-dir (projectile-project-root) + (cmd-to-echo "yarn" "install"))) + + (defun yarn-add-dev (package) + (interactive "spackage: ") + (projectile-with-default-dir (projectile-project-root) + (cmd-to-echo "yarn" (concat "add --dev " package)))) + + (defun yarn-add (package) + (interactive "spackage: ") + (projectile-with-default-dir (projectile-project-root) + (cmd-to-echo "yarn" (concat "add " package)))) + + (defun yarn-run (cmd) + (interactive (list + (projectile-completing-read "command: " (alist-get 'scripts (json-read-file (expand-file-name "package.json" (projectile-project-root))))))) + (projectile-with-default-dir (projectile-project-root) + (cmd-to-echo "yarn" (concat "run " cmd)))) + + (defun ap/open-project (&optional arg) + (interactive "P") + (let ((project-dir (projectile-completing-read + "Open project: " + (ghq--find-projects)))) + (projectile-switch-project-by-name + (expand-file-name project-dir (ghq--find-root)) arg))) + + (setq projectile-switch-project-action #'projectile-commander + projectile-completion-system 'ivy + projectile-create-missing-test-files t) + + (defun ap/projectile-test-suffix (project-type) + (cond + ((member project-type '(node-yarn node-npm)) ".test") + (t (projectile-test-suffix project-type)))) + (setq projectile-test-suffix-function #'ap/projectile-test-suffix) + + (projectile-register-project-type 'node-yarn '("yarn.lock") "yarn start" "yarn test") + (projectile-register-project-type 'node '("package.json") "npm start" "npm test"))) + +(use-package counsel-projectile + :after (counsel projectile) + :config (progn + (counsel-projectile-on) + (def-projectile-commander-method ?A + "Find rg on project." + (call-interactively #'counsel-projectile-rg)) + (define-key projectile-mode-map [remap counsel-projectile-ag] #'counsel-projectile-rg))) +;; #+END_SRC + +;; *** vc + +;; This is nice for some things that magit doesn’t do, and for those rare +;; occasions that I’m working with something other than git. + +;; #+BEGIN_SRC emacs-lisp +(use-package vc + :defer t + :bind (("C-x v C" . vc-resolve-conflicts)) + :config (progn + (setq vc-follow-symlinks t) + (setq vc-ignore-dir-regexp (format "\\(%s\\)\\|\\(%s\\)" + vc-ignore-dir-regexp + tramp-file-name-regexp)))) +;; #+END_SRC + +;; *** git-gutter-fringe + +;; It’s nice to be able to see at a glance which lines of a file have +;; changed. This package colours the fringe. I have it set to the right +;; fringe so it doesn’t interfere with flycheck. + +;; #+BEGIN_SRC emacs-lisp +(eval-when-compile (require 'fringe-helper)) +(use-package git-gutter-fringe + :defer 2 + :diminish git-gutter-mode + :config (progn + (global-git-gutter-mode 1) + ;; places the git gutter outside the margins. + (setq-default fringes-outside-margins t) + ;; thin fringe bitmaps + (fringe-helper-define 'git-gutter-fr:added '(center repeated) + ".XXX....") + (fringe-helper-define 'git-gutter-fr:modified '(center repeated) + ".XXX....") + (fringe-helper-define 'git-gutter-fr:deleted 'bottom + ".......X" + "......XX" + ".....XXX" + "....XXXX") + (setq git-gutter-fr:side 'right-fringe))) +;; #+END_SRC + +;; *** magit + +;; Magit is my favourite way to use git. I use selective staging all the +;; 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-completing-read-function #'ivy-completing-read + magit-popup-use-prefix-argument 'default + magit-display-buffer-function #'magit-display-buffer-fullcolumn-most-v1 + 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-messenger + +;; Popup the last commit that changed the line at point. + +;; #+BEGIN_SRC emacs-lisp +(use-package git-messenger + :bind* (("C-x v p" . git-messenger:popup-message)) + :config (progn + (setq git-messenger:use-magit-popup t))) +;; #+END_SRC + +;; *** git-timemachine + +;; This package allow me to go through a file’s history with just a few +;; keys. It makes it very easy to figure what what exactly was in a file +;; in the past. I often find it useful when I remember writing something +;; a particular way, but it changed later. + +;; #+BEGIN_SRC emacs-lisp +(use-package git-timemachine + :commands git-timemachine) +;; #+END_SRC + +;; *** ghq + +;; [[https://github.com/motemen/ghq][=ghq=]] clones VCS-backed projects to a common directory. It should +;; seem familiar to anyone who's used =go get= before. [[https://github.com/rcoedo/emacs-ghq][=emacs-ghq=]] is a +;; simple wrapper for it. + +;; #+BEGIN_SRC emacs-lisp +(use-package ghq + :if (executable-find "ghq")) +;; #+END_SRC + +;; ** Files + +;; *** Auto-saving + +;; Auto-save everything to a temporary directory, instead of cluttering +;; 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) +;; #+END_SRC +;; *** Backups + +;; I like to keep my backups out of regular folders. I tell emacs to use +;; 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)) +(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)))) +;; #+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))))) +;; #+END_SRC + +;; *** Encoding + +;; UTF-8 is usually appropriate. Note that =prefer-coding-system= expects +;; only a coding system, not a coding system and line ending combination. + +;; #+BEGIN_SRC emacs-lisp +(prefer-coding-system 'utf-8) +(setq-default buffer-file-coding-system 'utf-8-auto-unix) +;; #+END_SRC + +;; *** Buffer-file management + +;; Ask if I want to create a directory when it doesn’t exist. This is +;; 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)))) +(add-to-list 'find-file-not-found-functions #'my-create-non-existent-directory) +;; #+END_SRC + +;; I often want to rename or delete the file that I’m currently visiting +;; 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))))) +;; #+END_SRC + +;; *** Whitespace + +;; Show bad whitespace, so that I can fix it. + +;; #+BEGIN_SRC emacs-lisp +(defun show-trailing-whitespace-on () + (interactive) + (setq-local show-trailing-whitespace t)) +(defun show-trailing-whitespace-off () + (interactive) + (setq-local show-trailing-whitespace nil)) +(add-hook 'prog-mode-hook #'show-trailing-whitespace-on) +(add-hook 'text-mode-hook #'show-trailing-whitespace-on) +;; #+END_SRC + +;; *** shrink-whitespace + +;; DWIM whitespace removal. So I don’t need =M-SPC=, =M-\= and =C-x o= +;; for similar things any more. + +;; #+BEGIN_SRC emacs-lisp +(use-package shrink-whitespace + :bind ("M-SPC" . shrink-whitespace)) +;; #+END_SRC + +;; *** Tramp + +;; Tramp is awesome. It makes SSH feel Unix-y. The proxy setup is so +;; 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" (format "/run/user/%s/ssh-agent" (user-uid)))) + (setq tramp-default-method "ssh" + tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root")) + tramp-backup-directory-alist backup-directory-alist + tramp-completion-reread-directory-timeout 60 + tramp-ssh-controlmaster-options nil + 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)))) +;; #+END_SRC + +;; *** ediff + +;; I like a horizonal diff setup, with everything in one frame. + +;; #+BEGIN_SRC emacs-lisp +(use-package ediff + :defer t + :config (progn + (setq ediff-split-window-function 'split-window-horizontally + ediff-window-setup-function 'ediff-setup-windows-plain))) +;; #+END_SRC + +;; ** Indentation + +;; Ah, a complicated topic. One day we’ll all be using elastic +;; 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 2 + indent-tabs-mode nil) +(electric-indent-mode +1) +;; #+END_SRC + + +;; *** smart-tabs-mode + +;; Not related to [[smart-tab][=smart-tab=]], this mode indents with tabs and aligns +;; with spaces. Perfect! + +;; #+BEGIN_SRC emacs-lisp +(use-package smart-tabs-mode + :defer 1 + :config (progn + (smart-tabs-insinuate 'c 'cperl 'python) + (define-hook-helper php-mode () + (smart-tabs-mode indent-tabs-mode)))) +;; #+END_SRC + +;; *** editorconfig + +;; #+BEGIN_SRC emacs-lisp +(use-package editorconfig + :diminish "EC" + :config (editorconfig-mode 1)) +;; #+END_SRC + +;; *** dtrt-indent-mode + +;; Sometimes people use different indentation settings. [[https://github.com/jscheid/dtrt-indent][dtrt-indent]] +;; guesses the correct settings for me. + +;; #+BEGIN_SRC emacs-lisp +(use-package dtrt-indent + :config (progn + (define-hook-helper after-change-major-mode () + (unless (and (boundp editorconfig-mode) + editorconfig-mode) + (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 + +;; *** password-store + +;; 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))) +;; #+END_SRC +;; ** Buffers + +;; *** Ibuffer +;; Ibuffer is quite nice for listing all buffers. + +;; #+BEGIN_SRC emacs-lisp +(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))))) +;; #+END_SRC + +;; *** Relative Buffer names + +;; #+BEGIN_SRC emacs-lisp +(use-package relative-buffers + :defer 15 + :config (progn + (global-relative-buffers-mode))) +;; #+END_SRC +;; *** Narrowing + +;; Enable it without prompting + +;; #+BEGIN_SRC emacs-lisp +(put 'narrow-to-defun 'disabled nil) +(put 'narrow-to-page 'disabled nil) +(put 'narrow-to-region 'disabled nil) +;; #+END_SRC + +;; *** ace-window + +;; I don’t often have many windows open at once, but when I do, +;; =ace-window= is really nice to jump around them in the same way that +;; =ace-jump= or =avy= work. +;; #+BEGIN_SRC emacs-lisp +(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)))) +;; #+END_SRC + +;; ** Windows + +;; Scrolling is tricky. I use this setup to help me keep track of the +;; 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 160 + frame-resize-pixelwise nil) +(if (boundp 'ns-pop-up-frames) + (setq ns-pop-up-frames nil)) +;; #+END_SRC + +;; *** eyebrowse + +;; Workspaces, a bit like dwm. On Windows and Linux (at least the WMs +;; I'm likely to use), super+{0-9} are taken from the OS, so use meta +;; instead. On macOS, super makes a lot of sense, as it's used by most +;; programs to switch between program windows or views. + +;; #+BEGIN_SRC emacs-lisp +(use-package eyebrowse + :config (progn + (setq eyebrowse-new-workspace t) + (when (eq system-type 'darwin) + (bind-keys + ("s-0" . eyebrowse-switch-to-window-config-0) + ("s-1" . eyebrowse-switch-to-window-config-1) + ("s-2" . eyebrowse-switch-to-window-config-2) + ("s-3" . eyebrowse-switch-to-window-config-3) + ("s-4" . eyebrowse-switch-to-window-config-4) + ("s-5" . eyebrowse-switch-to-window-config-5) + ("s-6" . eyebrowse-switch-to-window-config-6) + ("s-7" . eyebrowse-switch-to-window-config-7) + ("s-8" . eyebrowse-switch-to-window-config-8) + ("s-9" . eyebrowse-switch-to-window-config-9))) + (bind-keys* + ("M-0" . eyebrowse-switch-to-window-config-0) + ("M-1" . eyebrowse-switch-to-window-config-1) + ("M-2" . eyebrowse-switch-to-window-config-2) + ("M-3" . eyebrowse-switch-to-window-config-3) + ("M-4" . eyebrowse-switch-to-window-config-4) + ("M-5" . eyebrowse-switch-to-window-config-5) + ("M-6" . eyebrowse-switch-to-window-config-6) + ("M-7" . eyebrowse-switch-to-window-config-7) + ("M-8" . eyebrowse-switch-to-window-config-8) + ("M-9" . eyebrowse-switch-to-window-config-9)) + (eyebrowse-mode +1))) +;; #+END_SRC + +;; ** Sessions + +;; *** Desktop +;; Save my Emacs session and restore it on startup. + +;; #+BEGIN_SRC emacs-lisp +(use-package desktop + :ensure nil + :config (progn + (setq desktop-dirname (expand-file-name "desktop/" user-emacs-directory) + desktop-base-file-name "emacs.desktop" + desktop-base-lock-name "lock" + desktop-path (list desktop-dirname) + desktop-save 'if-exists + desktop-files-not-to-save "^$" + desktop-load-locked-desktop nil) + (unless (file-directory-p desktop-dirname) + (make-directory desktop-dirname)) + (desktop-save-mode 1))) +;; #+END_SRC + +;; *** winner + +;; Undo, for window-based commands. + +;; #+BEGIN_SRC emacs-lisp +(use-package winner + :config (setq winner-boring-buffers '("*Completions*" "*Help*" "*Apropos*" "*Buffer List*" "*info*" "*Compile-Log*")) + :init (progn + (winner-mode 1))) +;; #+END_SRC + +;; *** windmove + +;; Directional window movement + +;; #+BEGIN_SRC emacs-lisp +(use-package windmove + :bind (("S-" . windmove-left) + ("S-" . windmove-right) + ("S-" . windmove-up) + ("S-" . windmove-down))) +;; #+END_SRC +;; ** Blogging + +;; I have a [[https://alanpearce.uk][blog]] that I publish with hugo. + +;; #+BEGIN_SRC emacs-lisp +(use-package easy-hugo + :config (setq easy-hugo-basedir (car (split-string (shell-command-to-string "ghq list --full-path alanpearce.uk"))) + easy-hugo-url "https://alanpearce.uk" + easy-hugo-default-ext ".md")) +;; #+END_SRC + +;; ** Completion + +;; Make built-in completion a bit more intelligent, by adding substring +;; 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) +;; #+END_SRC + +;; *** Company + +;; The main choices for automatic completion in Emacs are company and +;; auto-complete-mode. I’ve not tried auto-complete-mode as company +;; 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-on) + (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-gtags + company-etags company-keywords) company-oddmuse) + company-frontends '(company-pseudo-tooltip-unless-just-one-frontend + company-preview-frontend + company-echo-metadata-frontend) + 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-selection-wrap-around t))) +;; #+END_SRC + +;; #+BEGIN_SRC emacs-lisp +(use-package company-web + :after company) +;; #+END_SRC + +;;; ** Dates & Times + +;; *** Calendar + +;; 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))) +;; #+END_SRC + +;; Sometimes I want to insert a date or time into a buffer. +;; #+BEGIN_SRC emacs-lisp +(defun insert-date (prefix) + "Insert the current date. With prefix-argument, use British format. With + 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)))) + +(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)))) +;; #+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)) +;; #+END_SRC + +;; ** Directories + +;; Dired works quite nicely, but not always in the way I want. I don’t +;; like having so many prompts for recursive operations. Also, when I +;; have two dired windows open, assume that I’m going to be +;; copying/moving files between them. + +;; #+BEGIN_SRC emacs-lisp +(use-package dired + :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 (if delete-by-moving-to-trash + 'always + 'top) + dired-listing-switches "-alh") + (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)) + +(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 + dired-bind-jump nil)) + :init (progn + (add-hook 'dired-mode-hook #'turn-on-dired-omit-mode))) +;; #+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)))) +;; #+END_SRC + +;; *** Disk usage + +;; Combine dired and du (disk usage). + +;; #+BEGIN_SRC emacs-lisp +(use-package dired-du + :after dired + :config (progn + (setq dired-du-size-format t))) +;; #+END_SRC + +;; *** Dired-narrow +;; One can already use dired with wildcards to browse a filtered +;; directory listing, but it opens a new buffer. Dired-narrow is a +;; slightly nicer interface: with a currently-open dired buffer, use =/= +;; to start filtering, =RET= to complete the filter and =g= to refresh +;; 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)))) +;; #+END_SRC + +;; ** Documentation + +;; *** ehelp + +;; ehelp is a less well-known package that’s part of Emacs and slightly +;; improves the normal help commands, mostly by making quitting them easier. + +;; #+BEGIN_SRC emacs-lisp +(use-package ehelp + :bind-keymap ("C-h" . ehelp-map)) +;; #+END_SRC + +;; *** discover-my-major + +;; A nicer way to browse keybindings for major modes. + +;; #+BEGIN_SRC emacs-lisp +(use-package discover-my-major + :bind ("" . discover-my-major)) +;; #+END_SRC + +;; *** which-key + +;; 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))) +;; #+END_SRC + +;; *** eldoc + +;; Documentation in the echo-area (where the minibuffer is displayed) is +;; rather useful. + +;; #+BEGIN_SRC emacs-lisp +(use-package eldoc + :commands (eldoc-mode) + :diminish eldoc-mode + :config (progn + (setq eldoc-idle-delay 0.1) + (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) +;; #+END_SRC +;; ** Mail + +;; *** Gnus + +;; At work, I use gnus for email. Some of the setup is specific to my +;; workplace, so I keep it in a host-specific, GPG-encrypted file. + +;; #+BEGIN_SRC emacs-lisp +(use-package gnus + :config (progn + (setq gnus-gcc-mark-as-read t + mml-secure-openpgp-encrypt-to-self t + send-mail-function #'smtpmail-send-it + message-send-mail-function #'smtpmail-send-it))) + +(with-eval-after-load "gnus-mime" + (define-key gnus-mime-button-map " " #'gnus-mime-view-part-externally)) + +(with-eval-after-load "mailcap" + (when (eq system-type 'darwin) + (mailcap-add-mailcap-entry "application" "pdf" '((viewer . "/usr/bin/qlmanage -p %s") (type . "application/pdf"))))) + +(with-eval-after-load "mm-decode" + (add-to-list 'mm-discouraged-alternatives "text/html") + (add-to-list 'mm-discouraged-alternatives "text/richtext")) +;; #+END_SRC + +;; *** BBDB + +;; As I'm using Emacs for email, it makes sense to have contact +;; information here as well. + +;; #+BEGIN_SRC emacs-lisp +(use-package bbdb + :config (progn + (bbdb-initialize 'gnus 'message 'pgp) + (bbdb-mua-auto-update-init 'gnus 'message) + (setq bbdb-send-mail-style 'gnus + bbdb-complete-mail-allow-cycling t + bbdb-mua-auto-update t + bbdb-mua-pop-up-window-size 3 + bbdb-mua-update-interactive-p '(query . create) + bbdb-message-all-addresses t + bbdb-offer-save t + bbdb-offer-to-create 1))) +;; #+END_SRC + +;; ** Misc + +;; #+BEGIN_SRC emacs-lisp +(defvar *init-file* + (file-truename user-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 " + " nil t) + (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)))) + +(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))) + +(defun process-exit-code (program &rest args) + "Run PROGRAM with ARGS and return the exit code" + (apply 'call-process program nil nil nil args)) + +(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))) + +(bind-key* "M-!" #'shell-execute) +(bind-key* "C-x r M-w" #'copy-rectangle) +;; #+END_SRC + +;; *** Auxillary Configuration + +;; #+BEGIN_SRC emacs-lisp +(require 'pinentry) + +(defvar have-private-key + (file-exists-p (expand-file-name "secring.gpg" "~/.gnupg/"))) + +(defvar gpg-agent-ssh-sock + (or (getenv "GPG_AGENT_INFO") + (concat "/run/user/" (number-to-string (user-uid)) "/gnupg/S.gpg-agent.ssh"))) + +(defun read-gpg-file (file) + (let ((file-to-decrypt (expand-file-name file user-emacs-directory)) + (ctx (epg-make-context epa-protocol))) + (if (file-exists-p file-to-decrypt) + (epg-decrypt-file ctx file-to-decrypt nil) + (message "Decrypting %s...failed" file-to-decrypt) + (error "File %s does not exist" file-to-decrypt)))) + +(defun load-gpg (file) + (if have-private-key + (load file) + (message "WARNING: Couldn't load %s (No gpg key found)" file))) + +; load this in a post-frame hook because gpg-agent asks for a password on first +; startup and caches it. Don't want emacs daemon to hang because of gpg-agent. +(defun load-private-data () + (interactive) + (if (not (file-exists-p (expand-file-name (concat (system-name) ".el.gpg") user-emacs-directory))) + (message "No encrypted configuration matches system name `%s'" (system-name)) + (if (not have-private-key) + (message "ERROR: Private GPG key not found") + (unless (or (getenv "GPG_AGENT_INFO") + (getenv "SSH_AUTH_SOCK")) + (start-process "gpg-agent" nil "gpg-agent" "--daemon") + (setenv "SSH_AUTH_SOCK" gpg-agent-ssh-sock)) + (setq password-cache-expiry nil) + (unless (file-exists-p (concat pinentry--socket-dir "pinentry")) + (pinentry-start) + (add-hook 'kill-emacs-hook 'pinentry-stop)) + (add-to-list 'load-suffixes ".el.gpg") + (load-gpg (expand-file-name (system-name) user-emacs-directory))))) + +(defun first-frame-hook (frame) + (remove-hook 'after-make-frame-functions #'first-frame-hook) + (run-at-time nil nil 'load-private-data)) + +(if (eq 1 (length (frame-list))) + (add-hook 'after-init-hook #'load-private-data) + (add-hook 'after-make-frame-functions #'first-frame-hook)) +;; #+END_SRC + +;; ** Minibuffer + +;; Sometimes I want to use the minibuffer, but I’m already inside it. +;; Fortunately, this is possible. Of course, I need to know how many +;; minibuffers there are on the stack. + +;; #+BEGIN_SRC emacs-lisp +(setq enable-recursive-minibuffers t) +(minibuffer-depth-indicate-mode t) +;; #+END_SRC + +;; This avoids some issue with the minibuffer and the point being behind +;; the prompt. I don’t remember what exactly. +;; #+BEGIN_SRC emacs-lisp +(setq minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)) +;; #+END_SRC + +;; 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)) +;; #+END_SRC + +;; *** swiper/ivy + +;; Ivy is the new kid on the completion block. It seems to be a strong +;; replacement for helm so far. + +;; #+BEGIN_SRC emacs-lisp +(use-package swiper + :bind (("C-s" . swiper) + ("C-r" . swiper) + ("C-=" . swiper)) + :diminish ivy-mode + :demand t + :config (progn + (ivy-mode 1) + (setq ivy-re-builders-alist '((t . ivy--regex-plus)) + ivy-extra-directories '("./")) + (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 "" #'counsel-M-x) + (bind-key "C-c M-x" #'execute-extended-command) + (bind-key "C-x C-f" #'counsel-find-file) + (bind-key "M-y" #'counsel-yank-pop) + (bind-key "C-x i" #'counsel-imenu) + (bind-key "M-y" #'ivy-next-line ivy-minibuffer-map) + (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)))) + (setq counsel-rg-base-command "rg -i --no-heading --line-number --hidden %s ."))) +;; #+END_SRC + + +;; *** smex + +;; Smex is my favourite way to use =M-x=. Counsel’s =counsel-M-x= +;; function uses it internally, so I’m keeping it around, even though I +;; 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")))) +;; #+END_SRC + +;; *** cmd-to-echo + +;; I’ve been looking for some way to run programming projects (mostly +;; node.js) inside emacs. =cmd-to-echo= seems great for this, as new +;; output pops up in the echo area. + +;; #+BEGIN_SRC emacs-lisp +(use-package cmd-to-echo + :commands (cmd-to-echo) + :config (setq cmd-to-echo-add-output-to-process-buffers t)) +;; #+END_SRC +;; ** Modes + +;; Setup some modes for systemd files +;; #+BEGIN_SRC emacs-lisp +(add-to-list 'auto-mode-alist '("\\.service\\'" . conf-mode)) +(add-to-list 'auto-mode-alist '("\\.target\\'" . conf-mode)) +(add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-mode)) +;; #+END_SRC + +;; =direnv=’s files are basically shell scripts, it’s a nice way to +;; set environment variables for projects. +;; #+BEGIN_SRC emacs-lisp +(add-to-list 'auto-mode-alist '("\\.envrc\\'" . sh-mode)) +;; #+END_SRC + +;; Some modes that I don’t really customise much, mostly for +;; configuration files. +;; #+BEGIN_SRC emacs-lisp +(use-package haskell-mode + :mode (("\\.hs\\'" . haskell-mode))) + +(use-package dockerfile-mode + :mode (("Dockerfile\\'" . dockerfile-mode))) + +(use-package nix-mode + :mode (("\\.nix\\'" . nix-mode))) + +(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))) + +(use-package lua-mode + :defer t) + +(use-package ruby-mode + :mode (("\\.rb\\'" . ruby-mode) + ("\\.cap\\'" . ruby-mode))) + +(use-package go-mode + :mode (("\\.go\\'" . go-mode))) + +(use-package jinja2-mode + :mode (("\\.j2\\'" . jinja2-mode) + ("\\.jinja\\'" . jinja2-mode))) + +(use-package scss-mode + :defer t + :config (progn + (setq scss-compile-at-save nil))) + +(use-package toml-mode + :mode ("\\.toml\\'" . toml-mode)) + +(use-package 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)) + +(define-derived-mode saltstack-mode yaml-mode "Salt") +(add-to-list 'auto-mode-alist '("\\.sls\\'" . saltstack-mode)) +;; #+END_SRC + +;; *** ledger + +;; I use [[http://ledger-cli.org/][=ledger=]] to manage my finances. It has an Emacs mode, which +;; works really nicely. + +;; #+BEGIN_SRC emacs-lisp +(use-package ledger-mode + :mode ("\\.ledger\\'" . ledger-mode) + :functions ledger-report + :init (progn + (defun open-budget () + (interactive) + (projectile-switch-project-by-name "~/Sync/Default") + (find-file (expand-file-name "ledger/my.ledger" (projectile-project-root))) + (ledger-report "Budget (Cumulative)" nil))) + :config (progn + (setq ledger-use-iso-dates t + ledger-post-use-completion-engine :ido + ledger-reconcile-default-commodity "€" + ledger-clear-whole-transactions t + ledger-narrow-on-reconcile t + ledger-reports `(("Monthly Expenses" "ledger -f %(ledger-file) reg -M \\^Flex --real -X EUR -l \"payee != 'Opening Balances'\"") + ("Average Monthly Expenses (Past 12 Months)" ,(concat "ledger -f %(ledger-file) -b " + (format-time-string "%Y-%m" (time-add (current-time) (days-to-time -365))) + " --monthly --average balance ^Flex")) + ("Expenses:This Month" "ledger -f %(ledger-file) bal \\^Flex -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 \\^Assets:Budget$") + ("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 + +;; #+BEGIN_SRC emacs-lisp +(use-package markdown-mode + :defer t + :config (progn + (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) +;; #+END_SRC + +;; *** Lentic + +;; Multiple different views of the same file. Can be used for a kind of +;; inverse literate programming. + +;; #+BEGIN_SRC emacs-lisp +(use-package lentic + :config (global-lentic-mode)) +;; #+END_SRC + +;; *** Outshine + +;; Org-ified source code. I think this might work better than +;; lentic-mode, whilst also being more general. + +;; #+BEGIN_SRC emacs-lisp +(defvar outline-minor-mode-prefix "M-#") +(use-package outshine + :bind (:map outline-minor-mode-map + ("TAB" . outline-cycle) + ("" . outshine-cycle-buffer)) + :config (progn + (add-hook 'outline-minor-mode-hook #'outshine-hook-function) + (add-hook 'emacs-lisp-mode-hook #'outline-minor-mode) + (add-hook 'ledger-mode-hook #'outline-minor-mode) + (add-hook 'sh-mode-hook #'outline-minor-mode))) +;; #+END_SRC + +;; *** Org + +;; 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")) + + org-default-notes-file (concat org-directory "/notes") + + ;; ‘Remember’: new items at top + org-reverse-note-order t + + org-modules '(org-protocol) + + ;; Add time done to ‘done’ tasks + org-log-done 'time + + org-list-allow-alphabetical t + + org-adapt-indentation nil + + org-pretty-entities t + + org-table-duration-custom-format 'seconds + + org-src-fontify-natively nil + + org-export-have-math t + + org-blank-before-new-entry '((heading . t) + (plain-list-item . auto)) + org-fontify-done-headline t + + org-goto-interface 'outline-path-completion + + org-outline-path-complete-in-steps nil + + 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))) + +(use-package org-src + :ensure nil + :after org + :config (progn + (bind-key "C-x C-s" #'org-edit-src-exit org-src-mode-map))) +;; #+END_SRC + +;; ***** org-babel + +;; Org’s babel feature is really nice. I use it for this file, and I can +;; use it to communicate between programming languages. Sometime I hope +;; to have my =ledger= setup in an org file with some graph processing +;; with R or something. + +;; #+BEGIN_SRC emacs-lisp +(use-package ob-core + :defer t + :ensure nil + :config (progn + (org-babel-do-load-languages 'org-babel-load-languages + '((ledger . t) + (sh . t))) + (setq org-src-tab-acts-natively t + org-edit-src-content-indentation 0 + org-src-preserve-indentation t))) +;; #+END_SRC + +;; ***** org-journal + +;; 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" + org-journal-dir "~/Sync/Default/Documents/journal") + + (define-hook-helper org-journal-mode () + (use-variable-fonts) + (text-scale-adjust 4) + (if smartparens-strict-mode + (smartparens-strict-mode -1)) + (if show-smartparens-mode + (show-smartparens-mode -1))) + (defun org-journal-display-entry-yesterday () + "Show org-journal entry for yesterday" + (interactive) + (org-journal-read-or-display-entry (yesterday-time))))) +;; #+END_SRC + + +;; ** Programming +;; *** flycheck + +;; 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 mode-enabled)) + (setq flycheck-indication-mode 'left-fringe) + (with-eval-after-load 'git-gutter-fringe + (fringe-helper-define 'flycheck-fringe-bitmap-double-arrow '(center repeated) + ".XXX....")) + (if (executable-find "eslint_d") + (setq flycheck-javascript-eslint-executable "eslint_d")))) +;; #+END_SRC + +;; **** flycheck-pos-tip + +;; Show flycheck errors in a little popup, so I don't lose my place + +;; #+BEGIN_SRC emacs-lisp +(use-package flycheck-pos-tip + :after flycheck + :config (progn + (setq flycheck-display-errors-delay 0.5) + (flycheck-pos-tip-mode 1))) +;; #+END_SRC + +;; **** flycheck-flow + +;; #+BEGIN_SRC emacs-lisp +(use-package flycheck-flow + :after js2-mode + :if (executable-find "flow") + :config (progn + (flycheck-add-next-checker 'javascript-eslint 'javascript-flow))) +;; #+END_SRC + +;; *** golang + +;; 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 + (define-hook-helper go-mode () + (set (make-local-variable 'company-backends) + '(company-go))))) + +(use-package go-eldoc + :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))) + + +;; #+END_SRC + +;; *** ggtags + +;; A nice completion backend for programming modes. + +;; #+BEGIN_SRC emacs-lisp +(use-package ggtags + :if (executable-find "gtags") + :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 + +;; *** dumb-jump + +;; A "clever" way of implementing go-to-definition across languages: use +;; a project-wide text search and apply heuristics to the results to +;; guess a definition. + +;; #+BEGIN_SRC emacs-lisp +(use-package dumb-jump + :bind (("M-g o" . dumb-jump-go-other-window) + ("M-g j" . dumb-jump-go) + ("M-g x" . dumb-jump-go-prefer-external) + ("M-g z" . dumb-jump-go-prefer-external-other-window)) + :config (setq dumb-jump-selector 'ivy)) +;; #+END_SRC + +;; *** imenu-anywhere + +;; This is like imenu, but shows functions (or similar top-level +;; entities) across buffers in the same project. Neat! + +;; #+BEGIN_SRC emacs-lisp +(use-package imenu-anywhere + :bind ("C-x C-." . ivy-imenu-anywhere)) +;; #+END_SRC +;; *** Lisps + +;; **** All + +;; Lisp modes don’t seem to have a common ancestor. So I made a custom +;; hook which I trigger in every lispy-mode. + +;; #+BEGIN_SRC emacs-lisp +(defcustom lisp-mode-common-hook nil + "Hook run when entering any Lisp mode." + :type 'hook + :group 'lisp) + +(create-hook-helper lisp-mode-setup () + :hooks (emacs-lisp-mode-hook + scheme-mode-hook + lisp-mode-hook + clojure-mode-hook) + (run-hooks 'lisp-mode-common-hook)) +;; #+END_SRC + +;; ***** Redshank + +;; Lisp syntax allows for really easy refactoring. Redshank gives some +;; 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))) +;; #+END_SRC + +;; **** Emacs Lisp + +;; Customise the modeline-display of =emacs-lisp-mode=. Then make sure +;; it runs the common lisp hooks. + +;; #+BEGIN_SRC emacs-lisp +(add-hook 'emacs-lisp-mode-hook #'eldoc-mode) +;; #+END_SRC + +;; 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))) +;; #+END_SRC + +;; Interactive elisp + +;; #+BEGIN_SRC emacs-lisp +(use-package ielm + :defer t + :ensure nil + :config (progn + (define-hook-helper ielm-mode () + (run-hooks 'lisp-mode-common-hook)))) +;; #+END_SRC + +;; **** Scheme & Lisp + +;; I don’t work with these as often as I would like + +;; #+BEGIN_SRC emacs-lisp +(define-hook-helper lisp-mode () + (set (make-local-variable 'lisp-indent-function) + #'common-lisp-indent-function)) +;; #+END_SRC + +;; ***** geiser + +;; A REPL thing for Scheme. Hopefully I’ll get to use it more in the +;; future. + +;; #+BEGIN_SRC emacs-lisp +(use-package geiser + :commands (geiser-mode + geiser + run-geiser + run-racket)) +;; #+END_SRC + +;; ***** slime + +;; A REPL thing (and more) for Lisp. + +;; #+BEGIN_SRC emacs-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 '(slime-fancy slime-asdf))) + (setq common-lisp-hyperspec-root "file://opt/local/share/doc/lisp/HyperSpec-7-0/" + inferior-lisp-program (or (executable-find "sbcl") + (executable-find "ccl64"))))) +;; #+END_SRC + +;; **** Clojure + +;; #+BEGIN_SRC emacs-lisp +(use-package clojure-mode + :defer t + :init (progn + (define-hook-helper cider-repl-mode () + (highlight-changes-mode -1)))) + +(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 + (define-hook-helper clojure-mode () + (clj-refactor-mode 1)))) +;; #+END_SRC + +;; ***** cider + +;; A REPL thing for Clojure + +;; #+BEGIN_SRC emacs-lisp +(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))) +;; #+END_SRC + +;; *** Auto-compile + +;; Auto-compile emacs lisp when saving. +;; #+BEGIN_SRC emacs-lisp +(use-package auto-compile + :defer t + :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) +;; #+END_SRC + +;; *** cc-mode + +;; Although I don’t use C or C++, setting up the mode is helpful because +;; quite a few other modes are derived from it. + +;; #+BEGIN_SRC emacs-lisp +(use-package cc-mode + :defer 5 + :config (progn + (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 + +;; It’s nice to be able to quickly evaluate some code. Although I don’t +;; really seem to use it. +;; #+BEGIN_SRC emacs-lisp +(use-package quickrun + :bind (("C-c C-e" . quickrun))) +;; #+END_SRC + +;; *** Scala + +;; Let’s try using Scala. + +;; #+BEGIN_SRC emacs-lisp +(use-package scala-mode) +;; #+END_SRC + +;; And add ensime, an IDE-style environment. + +;; #+BEGIN_SRC emacs-lisp +(use-package ensime) +;; #+END_SRC + +;; *** Web development + +;; **** js2-mode + +;; This mode is really great for editing Javascript. It turns code into +;; an AST internally, so it can work with it almost like a lisp. + +;; #+BEGIN_SRC emacs-lisp +(use-package js2-mode + :mode (("\\.js\\'" . js2-mode)) + :interpreter ("node" . js2-mode) + :functions (js2-next-error + js2--struct-put) + :config (progn + (define-key js2-mode-map [menu-bar Javascript] nil) + (add-hook 'js2-mode-hook #'js2-imenu-extras-mode) + (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) + (setq js2-basic-offset 2 + js-switch-indent-offset 2 + js2-include-node-externs t + js2-highlight-level 1 + js2-strict-missing-semi-warning nil))) +;; #+END_SRC + +;; ***** rjsx-mode + +;; A set of advice for js2-jsx-mode to work better with React. + +;; #+BEGIN_SRC emacs-lisp +(use-package rjsx-mode + :after js2-mode + :if (fboundp #'js2--struct-put) + :mode (("\\.jsx\\'" . rjsx-mode))) +;; #+END_SRC + +;; ***** js2-refactor + +;; Thanks to the AST provided by js2-mode, refactoring is possible. This +;; library implements some refactorings. + +;; #+BEGIN_SRC emacs-lisp +(use-package js2-refactor + :after js2-mode + :config (progn + (bind-key "C-k" #'js2r-kill js2-mode-map) + (add-hook 'js2-mode-hook #'js2-refactor-mode) + (js2r-add-keybindings-with-prefix "C-c C-m"))) +;; #+END_SRC + +;; ***** add-node-modules-path + +;; Inside a javascript project, it's common to install tools locally to +;; the project. This will allows emacs to find their executables. + +;; #+BEGIN_SRC emacs-lisp +(use-package add-node-modules-path + :config (progn + (add-hook 'js2-mode-hook #'add-node-modules-path))) +;; #+END_SRC + +;; ***** Flow + +;; #+BEGIN_SRC emacs-lisp +(use-package flow-minor-mode + :after js2-mode + :config (progn + (add-hook 'js2-mode-hook #'flow-minor-enable-automatically))) +;; #+END_SRC + +;; ***** Indium + +;; Javascript with an inferior node.js process and a debugger? Awesome. + +;; To debug with node, use version 6.9.1 or later of node and run it with +;; ~--inspect~ and, to break on the first line, ~--debug-brk~. + +;; For Chrom*, it needs to be launched with +;; ~--remote-debugging-port=9222~ + +;; Node will tell you to open an URL in Chrome: + +;; ~chrome-devtools://inspector.html?...&ws=127.0.0.1:PORT/PATH~ + +;; Instead, do this: + +;; ~M-x indium-connect-to-nodejs RET 127.0.0.1 RET PORT RET~ + +;; #+BEGIN_SRC emacs-lisp +(use-package indium + :diminish (indium-interaction-mode . "In") + :config (progn + (add-hook 'js2-mode-hook #'indium-interaction-mode))) +;; #+END_SRC + +;; **** tern + +;; Tern understands javascript. It adds really clever documented +;; completions, besides other IDE-like things. + +;; #+BEGIN_SRC emacs-lisp +(use-package tern + :diminish tern-mode + :if (executable-find "tern") + :defer 5 + :config (progn + (setq tern-command (list (executable-find "tern"))) + (create-hook-helper tern-mode-on () + :hooks (web-mode-hook + js2-mode-hook) + (tern-mode +1)))) + +(with-eval-after-load '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))) +;; #+END_SRC + +;; **** restclient + +;; Restclient is really nice. It’s like a scratchpad for HTTP api +;; calls. Feels a bit like using =org-babel=. I wonder if there’s an +;; 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))) + +(use-package company-restclient + :after (company restclient) + :init (add-to-list 'company-backends #'company-restclient t)) +;; #+END_SRC + +;; **** sgml-mode + +;; This is for HTML, since old versions of HTML were derived from SGML. +;; #+BEGIN_SRC emacs-lisp +(use-package sgml-mode + :defer t + :config (setq sgml-basic-offset 2)) +;; #+END_SRC + +;; **** emmet-mode + +;; Emmet is really nice to write HTML quickly. Especially with +;; frameworks that require multiple nested elements to do anything useful. +;; #+BEGIN_SRC emacs-lisp +(use-package emmet-mode + :commands (emmet-mode) + :diminish (emmet-mode . " >") + :init (progn + (setq emmet-indentation 2 + emmet-self-closing-tag-style " /") + (add-hook 'sgml-mode-hook #'emmet-mode) + (add-hook 'web-mode-hook #'emmet-mode) + (add-hook 'css-mode-hook #'emmet-mode))) +;; #+END_SRC + +;; **** web-mode + +;; This mode handles just about every templating language out ther, which +;; is really nice, because it handles the HTML part the same way in all +;; of them as well. + +;; #+BEGIN_SRC emacs-lisp +(use-package web-mode + :mode (("/views/.*\\.php\\'" . web-mode) + ("\\.html\\'" . web-mode) + ("/templates/.*\\.php\\'" . web-mode) + ("\\.ejs\\'" . web-mode) + ("\\.njk\\'" . web-mode)) + :config (progn + (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 + web-mode-enable-auto-pairing nil + web-mode-enable-auto-quoting nil) + (sp-local-pair '(web-mode) "<%" "%>"))) +;; #+END_SRC + +;; *** Live coding + +;; Sometimes I might want to show off my emacs usage. + +;; #+BEGIN_SRC emacs-lisp +(defun live-coding () + (interactive) + (ap/set-fonts "SF Mono" 18 nil nil t 0.1) + (global-command-log-mode 1)) + +(defun live-coding-stop () + (interactive) + (ap/set-fonts-according-to-system) + (global-command-log-mode -1)) +;; #+END_SRC + +;; **** command-log-mode + +;; #+BEGIN_SRC emacs-lisp +(use-package command-log-mode + :defines command-log-mode-key-binding-open-log + :init (progn + (setq command-log-mode-key-binding-open-log nil + command-log-mode-auto-show t + command-log-mode-is-global t))) +;; #+END_SRC + +;; ** Spelling + +;; #+BEGIN_SRC emacs-lisp +(use-package ispell + :bind (("" . ispell-word)) + :config (progn + (cond + ((executable-find "aspell") (setq ispell-program-name "aspell" + ispell-dictionary "british" + ispell-really-aspell t + ispell-really-hunspell nil)) + ((executable-find "hunspell") (setq ispell-program-name "hunspell" + ispell-really-aspell nil + ispell-really-hunspell t))))) +;; #+END_SRC + +;; #+BEGIN_SRC emacs-lisp +(use-package flyspell + :diminish "﹏" + :config (progn + (defun flyspell-detect-ispell-args (&optional run-together) + "If RUN-TOGETHER is true, spell check the CamelCase words. + Please note RUN-TOGETHER will make aspell less capable. So it should only be used in prog-mode-hook." + (let (args) + (when ispell-program-name + (cond + ((string-match "aspell$" ispell-program-name) + (setq args (list "--sug-mode=ultra")) + (if run-together + (setq args (append args '("--run-together" "--run-together-limit=16" "--run-together-min=2"))))) + ((string-match "hunspell$" ispell-program-name) + (setq args nil)))) + args)) + ;; `ispell-extra-args' is *always* used when start CLI aspell process + (setq-default ispell-extra-args (flyspell-detect-ispell-args t)) + ;; (setq ispell-cmd-args (flyspell-detect-ispell-args)) + (defadvice ispell-word (around my-ispell-word activate) + (let ((old-ispell-extra-args ispell-extra-args)) + (ispell-kill-ispell t) + ;; use emacs original arguments + (setq ispell-extra-args (flyspell-detect-ispell-args)) + ad-do-it + ;; restore our own ispell arguments + (setq ispell-extra-args old-ispell-extra-args) + (ispell-kill-ispell t))) + + (defadvice flyspell-auto-correct-word (around my-flyspell-auto-correct-word activate) + (let* ((old-ispell-extra-args ispell-extra-args)) + (ispell-kill-ispell t) + ;; use emacs original arguments + (setq ispell-extra-args (flyspell-detect-ispell-args)) + ad-do-it + ;; restore our own ispell arguments + (setq ispell-extra-args old-ispell-extra-args) + (ispell-kill-ispell t))) + (setq flyspell-issue-message-flag nil) + + (defun fly-text-mode-hook-setup () + ;; Turn off RUN-TOGETHER option when spell check text-mode + (setq-local ispell-extra-args (flyspell-detect-ispell-args))) + (add-hook 'text-mode-hook 'fly-text-mode-hook-setup) + (add-hook 'prog-mode-hook #'flyspell-prog-mode))) +;; #+END_SRC + +;; *** Style checking + +;; [[https://github.com/ValeLint/vale][Vale]] is a linter, but for prose. Neat idea! Salesman is a bad term. + +;; #+BEGIN_SRC emacs-lisp +(use-package flycheck-vale + :if (executable-find "vale") + :config (progn + (add-to-list 'flycheck-vale-modes 'org-mode) + (add-to-list 'flycheck-vale-modes 'org-journal-mode) + (flycheck-vale-setup))) +;; #+END_SRC + +;; ** Scripting + +;; 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) + +(use-package sh-script + :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)) +;; #+END_SRC + +;; #+BEGIN_SRC emacs-lisp +(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) +;; #+END_SRC + +;; *** eshell + +;; I should try to get into the habit of using this more. It’s really +;; nice, when I remember to use it. + +;; #+BEGIN_SRC emacs-lisp +(use-package eshell + :bind ("C-c s" . eshell) + :defer 10 + :functions (eshell/pwd) + :config (progn + (setq eshell-directory-name "~/.emacs.d/eshell" + eshell-prompt-function (lambda () + (concat + (eshell/pwd) + "\n$ "))) + (define-hook-helper eshell-load () + (bind-key "C-c C-l" #'counsel-esh-history eshell-mode-map)))) + +(use-package em-smart + :ensure nil + :commands eshell-smart-initialize + :init (progn + (add-hook 'eshell-load-hook #'eshell-smart-initialize)) + :config (progn + (setq eshell-where-to-jump 'begin + eshell-review-quick-commands nil + eshell-smart-space-goes-to-end t))) + +(autoload #'eshell/cd "em-dirs") +(defun eshell-goto-current-dir (&optional arg) + (interactive "P") + (let ((dir default-directory)) + (eshell arg) + (eshell/cd dir))) +(bind-key "C-c S" #'eshell-goto-current-dir) + + +;; #+END_SRC + +;; **** Shells + +;; #+BEGIN_SRC emacs-lisp +(use-package shell + :defer t + :ensure nil + :config (define-key shell-mode-map + (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)) + +(use-package comint + :defer t + :ensure nil + :config (bind-key "C-c C-l" #'counsel-shell-history comint-mode-map)) + +(defun comint-delchar-or-eof-or-kill-buffer (arg) + (interactive "p") + (if (null (get-buffer-process (current-buffer))) + (kill-buffer) + (comint-delchar-or-maybe-eof arg))) +;; #+END_SRC + +;; ** Text editing + +;; Emacs has an editor within. + +;; #+BEGIN_SRC emacs-lisp +(put 'upcase-region 'disabled nil) +(put 'downcase-region 'disabled nil) +(setq sentence-end-double-space t + line-move-visual nil) +(setq-default truncate-lines t) +;; #+END_SRC + +;; *** align + +;; =Align= is a useful command to line things up, once given some rules. +;; 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)))))) +;; #+END_SRC + +;; *** Clipboard + +;; I like to use the clipboard more than the primary selection in X11. + +;; #+BEGIN_SRC emacs-lisp +(setq select-enable-clipboard t + save-interprogram-paste-before-kill t) +(if (functionp '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 + +;; *** Selection + +;; I’m quite used to deleting text by selecting it and typing. Emacs has +;; a mode for that. + +;; #+BEGIN_SRC emacs-lisp +(use-package delsel + :config (delete-selection-mode t)) +;; #+END_SRC + +;; 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)) +;; #+END_SRC + +;; I find that =zap-up-to-char= normally makes more sense to me than +;; =zap-to-char=. + +;; #+BEGIN_SRC emacs-lisp +(use-package misc + :ensure nil + :bind (("M-z" . zap-up-to-char) + ("M-Z" . zap-to-char))) +;; #+END_SRC + +;; Expanding the region by semantic units was something I quite liked +;; 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)) +;; #+END_SRC + +;; *** avy + +;; Avy is a really nice way to move around files, like ace-jump-mode, but +;; somehow I prefer it. + +;; #+BEGIN_SRC emacs-lisp +(use-package avy + :defer 5 + :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 ?\;)))) +;; #+END_SRC + +;; **** ace-link + +;; Visit any link. Despite the name, this works with avy. + +;; #+BEGIN_SRC emacs-lisp +(use-package ace-link + :after avy + :config (progn + (ace-link-setup-default) + (with-eval-after-load "gnus" + (bind-key "M-o" #'ace-link-gnus gnus-summary-mode-map) + (bind-key "M-o" #'ace-link-gnus gnus-article-mode-map)))) +;; #+END_SRC + +;; *** goto-chg + +;; This is like popping the mark, only it filters to only change areas +;; and doesn’t go back to the same place more than once. + +;; #+BEGIN_SRC emacs-lisp +(use-package goto-chg + :bind ("C-c C-SPC" . goto-last-change)) +;; #+END_SRC + +;; *** beginend + +;; In special buffers, I would rather have =M->= and =M-<= goto the +;; logical beginning/end rather than the physical ones. + +;; #+BEGIN_SRC emacs-lisp +(use-package beginend + :config (progn + (beginend-setup-all))) +;; #+END_SRC + +;; *** multiple-cursors + +;; I mentioned before that I’d used Sublime Text before. Multiple +;; cursors was one of my favourite features, so I was really happy when I +;; saw that multiple-cursors was released for Emacs. + +;; #+BEGIN_SRC emacs-lisp +(use-package multiple-cursors + :defer 1 + :bind* (("C-." . mc/mark-next-like-this) + ("C-," . mc/mark-previous-like-this) + ("M-" . mc/mark-all-like-this-dwim) + ("C-" . mc/mark-more-like-this-extended) + ("C-S-L" . mc/edit-lines))) +;; #+END_SRC + +;; *** paredit + +;; Balanced parentheses in lisps are nice, but all the refactoring and +;; 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))) +;; #+END_SRC + +;; *** smartparens + +;; I like to use smartparens where paredit isn’t already useful. Somehow +;; I didn’t find smartparens’ implementation of paredit style to be as +;; 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-" #'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-" #'sp-splice-sexp-killing-backward smartparens-mode-map) + (bind-key "M-" #'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-" #'sp-slurp-hybrid-sexp smartparens-mode-map) + (show-smartparens-global-mode t) + (smartparens-global-strict-mode t) + (define-hook-helper lisp-mode-common () + (smartparens-strict-mode -1) + (smartparens-mode -1)))) +;; #+END_SRC + + +;; *** move-text + +;; Transposing lines, made easier. + +;; #+BEGIN_SRC emacs-lisp +(use-package move-text + :config (move-text-default-bindings)) +;; #+END_SRC + +;; *** undo-tree + +;; Emacs’ default handling of undo is a bit confusing. Undo-tree makes +;; 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))) + :diminish undo-tree-mode) +;; #+END_SRC + +;; *** replace + +;; #+BEGIN_SRC emacs-lisp +(with-eval-after-load "replace.el" + (setq case-replace nil)) +;; #+END_SRC + +;; *** visual-regexp + +;; I don’t always remember exactly how Emacs’ regular expressions work, +;; so this package is pretty useful because it highlights everything in +;; 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))) +;; #+END_SRC + +;; ** End + +;; Start a server if possible. A daemon is already a server. +;; #+BEGIN_SRC emacs-lisp +(use-package server + :defer 2 + :if (not (daemonp)) + :config (unless (server-running-p server-name) + (server-start))) +;; #+END_SRC -- cgit 1.4.1 From a9587ab6704d21e61775b75818e26c0997c78e52 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 8 Aug 2017 11:02:14 +0200 Subject: Emacs: Remove eziam setup --- emacs/.emacs.d/main.el | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 0ca1211c..403c5b17 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -157,29 +157,6 @@ ;; *** Colours -;; Eziam looks nice, too, except for the non-white background. I prefer -;; white because most other application backgrounds are that colour. - -;; #+BEGIN_SRC emacs-lisp -(use-package eziam-light-theme - :ensure eziam-theme - :disabled t - :if (or window-system - (daemonp)) - :defines (eziam-scale-headings) - :config (progn - (setq eziam-scale-headings nil) - (load-theme 'eziam-light t) - (custom-theme-set-faces 'user - '(default ((t (:background "#ffffff")))) - '(js2-function-call ((t (:underline nil)))) - '(js2-object-property ((t (:slant normal)))) - '(font-lock-keyword-face ((t (:weight normal)))) - '(git-gutter-fr:added ((t (:foreground "#96a4ab")))) - '(git-gutter-fr:modified ((t (:foreground "#96a4ab")))) - '(git-gutter-fr:deleted ((t (:foreground "#96a4ab"))))))) -;; #+END_SRC - ;; White-theme. Sounds like a good idea. ;; #+BEGIN_SRC emacs-lisp -- cgit 1.4.1 From ab8c61f56ea5106868752ab023ad4ec501c5b2f2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 17 Aug 2017 19:24:19 +0200 Subject: i3: Tweak keybindings --- i3/.config/i3/config | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 54f308d4..d0863f2c 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -115,7 +115,7 @@ bindsym $mod+F11 fullscreen toggle # change container layout (stacked, tabbed, toggle split) bindsym $mod+s layout stacking bindsym $mod+t layout tabbed -bindsym $mod+d layout toggle split +bindsym $mod+r layout toggle split # toggle tiling / floating bindsym $mod+Shift+f floating toggle @@ -127,7 +127,7 @@ bindsym $mod+f focus mode_toggle bindsym $mod+a focus parent # focus the child container -#bindsym $mod+d focus child +bindsym $mod+d focus child # switch to workspace bindsym $mod+1 workspace 1 @@ -184,7 +184,7 @@ mode "resize" { bindsym Escape mode "default" } -bindsym $mod+r mode "resize" +bindsym $mod+Shift+r mode "resize" # Start i3bar to display a workspace bar (plus the system information i3status # finds out, if available) -- cgit 1.4.1 From 0c21ad07bc5297c6bb246edeea54898e5d310176 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 18 Aug 2017 21:19:04 +0200 Subject: i3: Tweak keybinds --- i3/.config/i3/config | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index d0863f2c..d67dcd35 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -73,7 +73,7 @@ bindsym $mod+Return exec st bindsym $mod+Shift+w kill # start dmenu (a program launcher) -bindsym $mod+p exec dmenu_run +bindsym $mod+Shift+r exec dmenu_run # There also is the (new) i3-dmenu-desktop which only displays applications # shipping a .desktop file. It is a wrapper around dmenu, so you need that # installed. @@ -113,15 +113,15 @@ bindsym $mod+v split v bindsym $mod+F11 fullscreen toggle # change container layout (stacked, tabbed, toggle split) -bindsym $mod+s layout stacking -bindsym $mod+t layout tabbed -bindsym $mod+r layout toggle split +bindsym $mod+Shift+s layout stacking +bindsym $mod+Shift+t layout tabbed +bindsym $mod+Shift+v layout toggle split # toggle tiling / floating bindsym $mod+Shift+f floating toggle # change focus between tiling / floating windows -bindsym $mod+f focus mode_toggle +bindsym $mod+t focus mode_toggle # focus the parent container bindsym $mod+a focus parent -- cgit 1.4.1 From a0c9b7633b0d4382e3681109d5011feae0e8bab3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 18 Aug 2017 21:19:20 +0200 Subject: xprofile: Increase delay for setting cursor Seems like it didn't always work with a 1 second delay --- xprofile/.xprofile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xprofile/.xprofile b/xprofile/.xprofile index 102db6e9..dbb8d92c 100755 --- a/xprofile/.xprofile +++ b/xprofile/.xprofile @@ -1,5 +1,5 @@ #!/bin/sh -sh -c 'sleep 1 && xsetroot -cursor_name left_ptr' & +sh -c 'sleep 5 && xsetroot -cursor_name left_ptr' & xmodmap .xmodmaprc xrdb -I$HOME/.xresources .xresources/main cmst --minimized & -- cgit 1.4.1 From aaaa3a1de82245f2a7b79475182eca113a2dfab2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 18 Aug 2017 21:23:35 +0200 Subject: Configure GPG (version 2.1) --- git/.config/git/config | 5 ++- gnupg/.gnupg/dirmngr.conf | 1 + gnupg/.gnupg/gpa.conf | 2 ++ gnupg/.gnupg/gpg-agent.conf | 3 ++ gnupg/.gnupg/gpg.conf | 84 +++++++++++++++++++++++++++++++++++++++++++++ xprofile/.xprofile | 1 + zsh/.config/zsh/.zshrc | 18 +++++++++- 7 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 gnupg/.gnupg/dirmngr.conf create mode 100644 gnupg/.gnupg/gpa.conf create mode 100644 gnupg/.gnupg/gpg-agent.conf create mode 100644 gnupg/.gnupg/gpg.conf diff --git a/git/.config/git/config b/git/.config/git/config index c82c149f..ab8143b1 100644 --- a/git/.config/git/config +++ b/git/.config/git/config @@ -1,6 +1,7 @@ [user] email = alan@alanpearce.eu name = Alan Pearce + signingkey = 0xE711C48B9C041266 [color] branch = auto diff = auto @@ -41,4 +42,6 @@ [difftool] prompt = false [difftool "icdiff"] - cmd = icdiff --line-numbers $LOCAL $REMOTE \ No newline at end of file + cmd = icdiff --line-numbers $LOCAL $REMOTE +[gpg] + program = gpg2 diff --git a/gnupg/.gnupg/dirmngr.conf b/gnupg/.gnupg/dirmngr.conf new file mode 100644 index 00000000..4392dc52 --- /dev/null +++ b/gnupg/.gnupg/dirmngr.conf @@ -0,0 +1 @@ +hkp-cacert = .gnupg/sks-keyservers.netCA.pem \ No newline at end of file diff --git a/gnupg/.gnupg/gpa.conf b/gnupg/.gnupg/gpa.conf new file mode 100644 index 00000000..2e33e80b --- /dev/null +++ b/gnupg/.gnupg/gpa.conf @@ -0,0 +1,2 @@ +default-key 5FA779613E2AB0EEFC6DD3056A56F2A314E23293 +detailed-view diff --git a/gnupg/.gnupg/gpg-agent.conf b/gnupg/.gnupg/gpg-agent.conf new file mode 100644 index 00000000..52eb1dca --- /dev/null +++ b/gnupg/.gnupg/gpg-agent.conf @@ -0,0 +1,3 @@ +enable-ssh-support +default-cache-ttl 600 +max-cache-ttl 7200 diff --git a/gnupg/.gnupg/gpg.conf b/gnupg/.gnupg/gpg.conf new file mode 100644 index 00000000..c043b31d --- /dev/null +++ b/gnupg/.gnupg/gpg.conf @@ -0,0 +1,84 @@ +# +# This is an implementation of the Riseup OpenPGP Best Practices +# https://help.riseup.net/en/security/message-security/openpgp/best-practices +# + + +#----------------------------- +# default key +#----------------------------- + +# The default key to sign with. If this option is not used, the default key is +# the first key found in the secret keyring + +# default-key + +#----------------------------- +# behavior +#----------------------------- + +# Disable inclusion of the version string in ASCII armored output +no-emit-version + +# Disable comment string in clear text signatures and ASCII armored messages +no-comments + +# Display long key IDs +keyid-format 0xlong + +# List all keys (or the specified ones) along with their fingerprints +with-fingerprint + +# Display the calculated validity of user IDs during key listings +list-options show-uid-validity +verify-options show-uid-validity + +# Try to use the GnuPG-Agent. With this option, GnuPG first tries to connect to +# the agent before it asks for a passphrase. +use-agent + +#----------------------------- +# keyserver +#----------------------------- + +# This is the server that --recv-keys, --send-keys, and --search-keys will +# communicate with to receive keys from, send keys to, and search for keys on +keyserver hkps://hkps.pool.sks-keyservers.net + +# Provide a certificate store to override the system default +# Get this from https://sks-keyservers.net/sks-keyservers.netCA.pem +# keyserver-options ca-cert-file=.gnupg/sks-keyservers.netCA.pem + +# Set the proxy to use for HTTP and HKP keyservers - default to the standard +# local Tor socks proxy +# It is encouraged to use Tor for improved anonymity. Preferrably use either a +# dedicated SOCKSPort for GnuPG and/or enable IsolateDestPort and +# IsolateDestAddr +keyserver-options http-proxy=socks5-hostname://127.0.0.1:9050 + +# When using --refresh-keys, if the key in question has a preferred keyserver +# URL, then disable use of that preferred keyserver to refresh the key from +keyserver-options no-honor-keyserver-url + +# When searching for a key with --search-keys, include keys that are marked on +# the keyserver as revoked +keyserver-options include-revoked + +#----------------------------- +# algorithm and ciphers +#----------------------------- + +# list of personal digest preferences. When multiple digests are supported by +# all recipients, choose the strongest one +personal-cipher-preferences AES256 AES192 AES CAST5 + +# list of personal digest preferences. When multiple ciphers are supported by +# all recipients, choose the strongest one +personal-digest-preferences SHA512 SHA384 SHA256 SHA224 + +# message digest algorithm used when signing a key +cert-digest-algo SHA512 + +# This preference list is used for new keys and becomes the default for +# "setpref" in the edit menu +default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed \ No newline at end of file diff --git a/xprofile/.xprofile b/xprofile/.xprofile index dbb8d92c..2811220a 100755 --- a/xprofile/.xprofile +++ b/xprofile/.xprofile @@ -1,6 +1,7 @@ #!/bin/sh sh -c 'sleep 5 && xsetroot -cursor_name left_ptr' & xmodmap .xmodmaprc +gpg-connect-agent /bye xrdb -I$HOME/.xresources .xresources/main cmst --minimized & sxhkd & diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 818cdf5f..b7a20b9c 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -106,7 +106,18 @@ bindkey '\e ' hist-complete zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*' zstyle ':completion:*' completer _expand _complete _match -if [[ -z $SSH_AUTH_SOCK && $commands[ssh-agent] ]] +if [[ -n $commands[gpg-connect-agent] ]] +then + # When using SSH support, use the current TTY for passphrase prompts + gpg-connect-agent updatestartuptty /bye > /dev/null + + # Point the SSH_AUTH_SOCK to the one handled by gpg-agent + if [ -S $(gpgconf --list-dirs agent-ssh-socket) ]; then + export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) + else + echo "$(gpgconf --list-dirs agent-ssh-socket) doesn't exist. Is gpg-agent running ?" + fi +elif [[ -z $SSH_AUTH_SOCK && $commands[ssh-agent] ]] then eval $(ssh-agent) fi @@ -167,6 +178,11 @@ then alias gh=hub fi +if [[ -n $commands[gpg2] && -z $commands[gpg] ]] +then + alias gpg=gpg2 +fi + if [[ -n $commands[lunchy] ]] then LUNCHY_DIR=$(dirname $(gem which lunchy))/../extras -- cgit 1.4.1 From c8902f1a82d0e25b358b4c18dbbf95b9f3305008 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 21 Aug 2017 12:45:38 +0200 Subject: Emacs: Update encrypted configuration --- emacs/.emacs.d/ap-spotcap.local.el.gpg | Bin 1477 -> 1333 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/emacs/.emacs.d/ap-spotcap.local.el.gpg b/emacs/.emacs.d/ap-spotcap.local.el.gpg index 4007dcd8..1751ca5f 100644 Binary files a/emacs/.emacs.d/ap-spotcap.local.el.gpg and b/emacs/.emacs.d/ap-spotcap.local.el.gpg differ -- cgit 1.4.1 From 040a5ad69c629c38663d36d2f3eca3c89c749d5f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 21 Aug 2017 12:46:02 +0200 Subject: Emacs: Fix C-c p s s binding --- emacs/.emacs.d/main.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 403c5b17..d88a45d1 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -626,6 +626,7 @@ (use-package counsel-projectile :after (counsel projectile) + :bind (("C-c p s s" . counsel-projectile-rg)) :config (progn (counsel-projectile-on) (def-projectile-commander-method ?A -- cgit 1.4.1 From 3270f4c3cb1c637a9c319a289094e32a7c1290e1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 21 Aug 2017 12:46:17 +0200 Subject: Emacs: add lentic configuration --- emacs/.emacs.d/main.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index d88a45d1..11328711 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -2797,3 +2797,7 @@ :config (unless (server-running-p server-name) (server-start))) ;; #+END_SRC + +;; # Local Variables: +;; # lentic-init: lentic-orgel-org-init +;; # End: -- cgit 1.4.1 From d7a42ad3cef9f13d56038e18e803dcd880df9fe1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 21 Aug 2017 12:47:06 +0200 Subject: Emacs: Remove base16-theme --- emacs/.emacs.d/main.el | 9 --------- nix/.config/nixpkgs/emacs.nix | 3 +-- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 11328711..8f692bb5 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -172,15 +172,6 @@ '(font-lock-string-face ((t (:slant normal))))))) ;; #+END_SRC -;; Base16 theming allows me have a consistent style between applications -;; quite easily. - -;; #+BEGIN_SRC emacs-lisp -(use-package base16-theme - :if (or window-system - (daemonp))) -;; #+END_SRC - ;; Highlighting quasi-quoted expressions in lisps is quite useful, but I ;; don't need it all the time. I'll keep it around for a while so that I ;; can enable it if needed. diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix index ad77ff5d..6ce3a210 100644 --- a/nix/.config/nixpkgs/emacs.nix +++ b/nix/.config/nixpkgs/emacs.nix @@ -60,7 +60,6 @@ in ag auto-compile avy - base16-theme bbdb beginend cider @@ -163,5 +162,5 @@ in # defined above hook-helpers dired-du - # From main packages set + # From main packages set ]) -- cgit 1.4.1 From 551a4823350285057f682ef6329d347042e1a157 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 21 Aug 2017 13:53:49 +0200 Subject: zsh: Don't init gnupg on macOS. Assume GPG Tools are installed instead --- zsh/.config/zsh/.zshrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index b7a20b9c..91d5e011 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -106,7 +106,7 @@ bindkey '\e ' hist-complete zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*' zstyle ':completion:*' completer _expand _complete _match -if [[ -n $commands[gpg-connect-agent] ]] +if [[ $os -ne "darwin" && -n $commands[gpg-connect-agent] ]] then # When using SSH support, use the current TTY for passphrase prompts gpg-connect-agent updatestartuptty /bye > /dev/null @@ -117,7 +117,7 @@ then else echo "$(gpgconf --list-dirs agent-ssh-socket) doesn't exist. Is gpg-agent running ?" fi -elif [[ -z $SSH_AUTH_SOCK && $commands[ssh-agent] ]] +elif [[ -z "$SSH_AUTH_SOCK" && -n $commands[ssh-agent] ]] then eval $(ssh-agent) fi -- cgit 1.4.1 From 4452cd686c06494e99c5584be52ef2ba9f585393 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 25 Aug 2017 23:39:54 +0200 Subject: i3: Fix duplicate keybinds again --- i3/.config/i3/config | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index d67dcd35..d81bd8a9 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -73,8 +73,9 @@ bindsym $mod+Return exec st bindsym $mod+Shift+w kill # start dmenu (a program launcher) -bindsym $mod+Shift+r exec dmenu_run -# There also is the (new) i3-dmenu-desktop which only displays applications +bindsym $mod+Mod1+r exec dmenu_run +bindsym $mod+Shift+;p exec passmenu +# There Also Is The (new) i3-dmenu-desktop which only displays applications # shipping a .desktop file. It is a wrapper around dmenu, so you need that # installed. bindsym $mod+space exec --no-startup-id i3-dmenu-desktop -- cgit 1.4.1 From 8f73546d05279d79027e0583bac1598d116e484e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 25 Aug 2017 23:40:27 +0200 Subject: gpg: Use builtin tor method --- gnupg/.gnupg/dirmngr.conf | 5 ++++- gnupg/.gnupg/gpg.conf | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gnupg/.gnupg/dirmngr.conf b/gnupg/.gnupg/dirmngr.conf index 4392dc52..cb8030bb 100644 --- a/gnupg/.gnupg/dirmngr.conf +++ b/gnupg/.gnupg/dirmngr.conf @@ -1 +1,4 @@ -hkp-cacert = .gnupg/sks-keyservers.netCA.pem \ No newline at end of file +keyserver hkps://hkps.pool.sks-keyservers.net +keyserver hkp://jirk5u4osbsr34t5.onion +use-tor +#hkp-cacert ~/.gnupg/sks-keyservers.netCA.pem diff --git a/gnupg/.gnupg/gpg.conf b/gnupg/.gnupg/gpg.conf index c043b31d..85a41f4e 100644 --- a/gnupg/.gnupg/gpg.conf +++ b/gnupg/.gnupg/gpg.conf @@ -54,7 +54,7 @@ keyserver hkps://hkps.pool.sks-keyservers.net # It is encouraged to use Tor for improved anonymity. Preferrably use either a # dedicated SOCKSPort for GnuPG and/or enable IsolateDestPort and # IsolateDestAddr -keyserver-options http-proxy=socks5-hostname://127.0.0.1:9050 +# keyserver-options http-proxy=socks5-hostname://127.0.0.1:9050 # When using --refresh-keys, if the key in question has a preferred keyserver # URL, then disable use of that preferred keyserver to refresh the key from -- cgit 1.4.1 From 6f7aee7f9c6b18b8fcd2e50423c955279760bb85 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 25 Aug 2017 23:40:40 +0200 Subject: Emacs: Default to SSH socket from GnuPG --- emacs/.emacs.d/main.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 8f692bb5..cc61b57f 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -840,7 +840,7 @@ :defer 7 :config (progn (unless (getenv "SSH_AUTH_SOCK") - (setenv "SSH_AUTH_SOCK" (format "/run/user/%s/ssh-agent" (user-uid)))) + (setenv "SSH_AUTH_SOCK" (format "/run/user/%s/gnupg/S.gpg-agent.ssh" (user-uid)))) (setq tramp-default-method "ssh" tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root")) tramp-backup-directory-alist backup-directory-alist -- cgit 1.4.1 From 8d8a47273113c252120bb9141089c819e3f10bc3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 25 Aug 2017 23:41:04 +0200 Subject: Emacs: Configure mu4e --- emacs/.emacs.d/main.el | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index cc61b57f..e45be855 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1367,6 +1367,58 @@ (add-to-list 'mm-discouraged-alternatives "text/richtext")) ;; #+END_SRC +;; *** mu + +;; #+BEGIN_SRC emacs-lisp +(add-to-list 'load-path (expand-file-name + "../share/emacs/site-lisp/mu4e" + (f-dirname + (file-truename + (executable-find "mu"))))) +(use-package mu4e + :config + (setq mu4e-use-fancy-chars nil + mu4e-attachment-dir "~/Downloads/" + mu4e-view-show-images t + mu4e-headers-date-format "%Y-%m-%d %H:%M" + + mu4e-maildir (expand-file-name "~/mail/alanpearce") + mu4e-sent-folder "/Sent" + mu4e-drafts-folder "/Drafts" + mu4e-refile-folder "/Archive" + mu4e-trash-folder "/Trash" + + message-send-mail-function #'message-send-mail-with-sendmail + sendmail-program "msmtp" + + mu4e-maildir-shortcuts '(("/INBOX" . ?i)) + ;; mu4e-get-mail-command "offlineimap -o" + mu4e-contexts + (list + (make-mu4e-context + :name "Personal" + :match-func (lambda (msg) + (when msg + (mu4e-message-contact-field-matches + msg :to "alan@alanpearce\..*"))) + :vars '((user-mail-address . "alan@alanpearce.eu"))) + (make-mu4e-context + :name "Work" + :match-func (lambda (msg) + (when msg + (mu4e-message-contact-field-matches + msg :to "alan.*@satoshipay.io"))) + :vars '((user-mail-address . "alan@satoshipay.io")))) + mu4e-user-mail-address-list (append + (delq nil + (mapcar (lambda (context) + (when (mu4e-context-vars context) + (cdr (assq 'user-mail-address (mu4e-context-vars context))))) + mu4e-contexts)) + '("alan@alanpearce.uk" + "alan@alanpearce.co.uk")))) +;; #+END_SRC + ;; *** BBDB ;; As I'm using Emacs for email, it makes sense to have contact -- cgit 1.4.1 From 2d5bbf6383d6def39df25435eaa5e244e053fda5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 26 Aug 2017 16:50:33 +0200 Subject: zsh: Ensure cache directory is present for HISTFILE --- zsh/.config/zsh/setup.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zsh/.config/zsh/setup.sh b/zsh/.config/zsh/setup.sh index 61b54417..93bbf808 100755 --- a/zsh/.config/zsh/setup.sh +++ b/zsh/.config/zsh/setup.sh @@ -5,3 +5,5 @@ git clone https://github.com/psprint/zplugin.git $HOME/.zplugin/bin zcompile $HOME/.zplugin/bin/zplugin.zsh +mkdir -p $HOME/.cache/zsh/ + -- cgit 1.4.1 From 1e0e3d3069b75389773895b9a0f8ed0282fa124a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 26 Aug 2017 16:51:16 +0200 Subject: i3: Fix passmenu binding --- i3/.config/i3/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index d81bd8a9..952f1203 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -74,7 +74,7 @@ bindsym $mod+Shift+w kill # start dmenu (a program launcher) bindsym $mod+Mod1+r exec dmenu_run -bindsym $mod+Shift+;p exec passmenu +bindsym $mod+Shift+semicolon exec passmenu # There Also Is The (new) i3-dmenu-desktop which only displays applications # shipping a .desktop file. It is a wrapper around dmenu, so you need that # installed. -- cgit 1.4.1 From 1899ee2402cb3d9e816af5b5597c4611dc77684f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 26 Aug 2017 16:51:25 +0200 Subject: i3: Use i3status from current-system It's not feasible to use the nix derivation dependency, because the i3 config file is not generated by NixOS, so use the current system version instead. This means that it needs to be added to systemPackages. --- i3/.config/i3/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 952f1203..bc7f1aef 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -191,7 +191,7 @@ bindsym $mod+Shift+r mode "resize" # finds out, if available) bar { position top - status_command /nix/store/3pwsp50dpzhs4myp1jm21w9gqw5wi8la-i3status-2.11/bin/i3status -c ~/.config/i3status/config + status_command /run/current-system/sw/bin/i3status -c ~/.config/i3status/config colors { background $base00 separator $base03 -- cgit 1.4.1 From 63597f1375e7a70e9aa7405c99c61a602bda72dd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 26 Aug 2017 17:03:46 +0200 Subject: zsh: Set SSH_AUTH_SOCK to GnuPG SSH agent socket --- zsh/.config/zsh/.zshenv | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index f82d0a26..4f7b20f7 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -10,9 +10,10 @@ then . $ZDOTDIR/zshenv.private fi - if [[ -z $SSH_AUTH_SOCK ]] + unset SSH_AGENT_PID + if [[ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]] then - export SSH_AUTH_SOCK=${XDG_RUNTIME_DIR:-/run/user/$UID}/ssh-agent + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" fi if [[ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]] -- cgit 1.4.1 From 9347d36a8bd057ca32837a35d5fa5a94c1c570ec Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 26 Aug 2017 17:59:34 +0200 Subject: offlineimap: Add initial configuration --- offlineimap/.offlineimap.py | 5 +++++ offlineimap/.offlineimaprc | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100755 offlineimap/.offlineimap.py create mode 100644 offlineimap/.offlineimaprc diff --git a/offlineimap/.offlineimap.py b/offlineimap/.offlineimap.py new file mode 100755 index 00000000..a21f4224 --- /dev/null +++ b/offlineimap/.offlineimap.py @@ -0,0 +1,5 @@ +#! /usr/bin/env python2 +from subprocess import check_output + +def get_pass(account): + return check_output("pass " + account, shell=True).splitlines()[0] diff --git a/offlineimap/.offlineimaprc b/offlineimap/.offlineimaprc new file mode 100644 index 00000000..ea98729f --- /dev/null +++ b/offlineimap/.offlineimaprc @@ -0,0 +1,34 @@ +[general] +# List of accounts to be synced, separated by a comma. +accounts = alanpearce.eu +pythonfile = ~/.offlineimap.py + +[Account alanpearce.eu] +# Identifier for the local repository; e.g. the maildir to be synced via IMAP. +localrepository = alanpearce.eu-local +# Identifier for the remote repository; i.e. the actual IMAP, usually non-local. +remoterepository = alanpearce.eu-remote +autorefresh = 20 +quick = 2 +postsynchook = mu index --maildir=%(personalmaildir)s --lazy-check --nocleanup --quiet + +[Repository alanpearce.eu-local] +# OfflineIMAP supports Maildir, GmailMaildir, and IMAP for local repositories. +type = Maildir +# Where should the mail be placed? +localfolders = %(personalmaildir)s + +[Repository alanpearce.eu-remote] +# Remote repos can be IMAP or Gmail, the latter being a preconfigured IMAP. +type = IMAP +remotehost = mail.alanpearce.eu +remoteuser = alan +remotepasseval = get_pass("mail/alanpearce.eu") +sslcacertfile = /etc/ssl/certs/ca-certificates.crt +keepalive = 1740 +holdconnectionopen = yes +usecompression = yes +idlefolders = ['INBOX'] + +[DEFAULT] +personalmaildir = ~/mail/alanpearce -- cgit 1.4.1 From e20b7cda7a29f82cd462ccceaa559bdd3f86e365 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 26 Aug 2017 18:00:33 +0200 Subject: msmtp: Add initial configuration --- msmtp/.msmtprc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 msmtp/.msmtprc diff --git a/msmtp/.msmtprc b/msmtp/.msmtprc new file mode 100644 index 00000000..9a3c1938 --- /dev/null +++ b/msmtp/.msmtprc @@ -0,0 +1,26 @@ +# Set default values for all following accounts. +defaults +auth on +tls on +tls_trust_file /etc/ssl/certs/ca-certificates.crt +logfile ~/.local/log/msmtp.log + +account personal +host mail.alanpearce.eu +port 587 +from alan@alanpearce.eu +user alan +passwordeval pass mail/alanpearce.eu + +account personal-uk : personal +from alan@alanpearce.uk + +account personal-co-uk : personal +from alan@alanpearce.co.uk + +account riseup +host smtp.riseup.net +from alanpearce@riseup.net + +# Set a default account +account default : personal -- cgit 1.4.1 From f29cc5a2d2e0aa5f4f7a6b42d051f45f18e48ce4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 27 Aug 2017 13:02:23 +0200 Subject: Emacs: Add desktop file --- emacs/.local/share/applications/emacsclient.desktop | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 emacs/.local/share/applications/emacsclient.desktop diff --git a/emacs/.local/share/applications/emacsclient.desktop b/emacs/.local/share/applications/emacsclient.desktop new file mode 100644 index 00000000..e26359ec --- /dev/null +++ b/emacs/.local/share/applications/emacsclient.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=Emacsclient +Comment=Edit text +MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++; +Exec=emacsclient -c %F -a "" +Icon=emacs +Type=Application +Terminal=false +Categories=Development;TextEditor; +StartupWMClass=Emacs +Keywords=Text;Editor; -- cgit 1.4.1 From c2977c4f4bd08f0e352ce4b79e9363eb65d9ef29 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 27 Aug 2017 13:40:41 +0200 Subject: sxhkd: Use disper for XF86Display shortcut --- sxhkd/.config/sxhkd/sxhkdrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sxhkd/.config/sxhkd/sxhkdrc b/sxhkd/.config/sxhkd/sxhkdrc index c1c3eed8..ba416168 100644 --- a/sxhkd/.config/sxhkd/sxhkdrc +++ b/sxhkd/.config/sxhkd/sxhkdrc @@ -10,7 +10,9 @@ XF86Audio{Lower,Raise}Volume XF86MonBrightness{Down,Up} light -{U,A} 0.5% -# XF86Display +XF86Display + disper -c + # XF86WLAN XF86Tools -- cgit 1.4.1 From 48968239381de2f82c04dc86f9241c83e3487f40 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 27 Aug 2017 13:41:23 +0200 Subject: Emacs: Force-bind avy shortcuts --- emacs/.emacs.d/main.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index e45be855..7db83fa3 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -2666,11 +2666,11 @@ ;; #+BEGIN_SRC emacs-lisp (use-package avy :defer 5 - :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)) + :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 -- cgit 1.4.1 From 8cdd13e28f964fdf645d05de872d71231911cc25 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 27 Aug 2017 13:41:36 +0200 Subject: Emacs: Remove workaround for echo-area-message --- emacs/.emacs.d/main.el | 2 -- 1 file changed, 2 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 7db83fa3..17d38b1b 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -11,8 +11,6 @@ ;; *** Startup ;; 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-screen t) (setq gc-cons-threshold 100000000) (add-hook 'after-init-hook -- cgit 1.4.1 From 88611afbb0fd4dd8de05ff0f4a66a2e963ecf56e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 27 Aug 2017 17:29:19 +0200 Subject: xprofile: Run NetworkManager's applet instead of connman's --- xprofile/.xprofile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xprofile/.xprofile b/xprofile/.xprofile index 2811220a..ec47d622 100755 --- a/xprofile/.xprofile +++ b/xprofile/.xprofile @@ -3,5 +3,5 @@ sh -c 'sleep 5 && xsetroot -cursor_name left_ptr' & xmodmap .xmodmaprc gpg-connect-agent /bye xrdb -I$HOME/.xresources .xresources/main -cmst --minimized & +nm-applet & sxhkd & -- cgit 1.4.1 From a8a9b68dca50d829c45c10803b3ed2329724726e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 28 Aug 2017 15:17:25 +0200 Subject: zsh: Default to current ledger file --- zsh/.config/zsh/.zshenv | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index 4f7b20f7..797dc62b 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -70,4 +70,6 @@ then export GTAGSLABEL=ctags export GHQ_ROOT="$HOME/projects:$HOME/go/src" + + export LEDGER_FILE="$HOME/Sync/Default/ledger/my.ledger" fi -- cgit 1.4.1 From 51784ea0031ab238e3c9fa6c5e18c12e2ee56225 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 29 Aug 2017 10:17:16 +0200 Subject: Emacs: Load mu4e only if mu executable is present --- emacs/.emacs.d/main.el | 95 +++++++++++++++++++++++++------------------------- 1 file changed, 48 insertions(+), 47 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 17d38b1b..69f584ec 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1368,53 +1368,54 @@ ;; *** mu ;; #+BEGIN_SRC emacs-lisp -(add-to-list 'load-path (expand-file-name - "../share/emacs/site-lisp/mu4e" - (f-dirname - (file-truename - (executable-find "mu"))))) -(use-package mu4e - :config - (setq mu4e-use-fancy-chars nil - mu4e-attachment-dir "~/Downloads/" - mu4e-view-show-images t - mu4e-headers-date-format "%Y-%m-%d %H:%M" - - mu4e-maildir (expand-file-name "~/mail/alanpearce") - mu4e-sent-folder "/Sent" - mu4e-drafts-folder "/Drafts" - mu4e-refile-folder "/Archive" - mu4e-trash-folder "/Trash" - - message-send-mail-function #'message-send-mail-with-sendmail - sendmail-program "msmtp" - - mu4e-maildir-shortcuts '(("/INBOX" . ?i)) - ;; mu4e-get-mail-command "offlineimap -o" - mu4e-contexts - (list - (make-mu4e-context - :name "Personal" - :match-func (lambda (msg) - (when msg - (mu4e-message-contact-field-matches - msg :to "alan@alanpearce\..*"))) - :vars '((user-mail-address . "alan@alanpearce.eu"))) - (make-mu4e-context - :name "Work" - :match-func (lambda (msg) - (when msg - (mu4e-message-contact-field-matches - msg :to "alan.*@satoshipay.io"))) - :vars '((user-mail-address . "alan@satoshipay.io")))) - mu4e-user-mail-address-list (append - (delq nil - (mapcar (lambda (context) - (when (mu4e-context-vars context) - (cdr (assq 'user-mail-address (mu4e-context-vars context))))) - mu4e-contexts)) - '("alan@alanpearce.uk" - "alan@alanpearce.co.uk")))) +(when (executable-find "mu") + (add-to-list 'load-path (expand-file-name + "../share/emacs/site-lisp/mu4e" + (f-dirname + (file-truename + (executable-find "mu"))))) + (use-package mu4e + :config + (setq mu4e-use-fancy-chars nil + mu4e-attachment-dir "~/Downloads/" + mu4e-view-show-images t + mu4e-headers-date-format "%Y-%m-%d %H:%M" + + mu4e-maildir (expand-file-name "~/mail/alanpearce") + mu4e-sent-folder "/Sent" + mu4e-drafts-folder "/Drafts" + mu4e-refile-folder "/Archive" + mu4e-trash-folder "/Trash" + + message-send-mail-function #'message-send-mail-with-sendmail + sendmail-program "msmtp" + + mu4e-maildir-shortcuts '(("/INBOX" . ?i)) + ;; mu4e-get-mail-command "offlineimap -o" + mu4e-contexts + (list + (make-mu4e-context + :name "Personal" + :match-func (lambda (msg) + (when msg + (mu4e-message-contact-field-matches + msg :to "alan@alanpearce\..*"))) + :vars '((user-mail-address . "alan@alanpearce.eu"))) + (make-mu4e-context + :name "Work" + :match-func (lambda (msg) + (when msg + (mu4e-message-contact-field-matches + msg :to "alan.*@satoshipay.io"))) + :vars '((user-mail-address . "alan@satoshipay.io")))) + mu4e-user-mail-address-list (append + (delq nil + (mapcar (lambda (context) + (when (mu4e-context-vars context) + (cdr (assq 'user-mail-address (mu4e-context-vars context))))) + mu4e-contexts)) + '("alan@alanpearce.uk" + "alan@alanpearce.co.uk"))))) ;; #+END_SRC ;; *** BBDB -- cgit 1.4.1 From 82485764d3001c5759bb2e56a4e2779633dcc644 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 29 Aug 2017 14:33:44 +0200 Subject: zsh: Don't configure GPG SSH agent on osx --- zsh/.config/zsh/.zshenv | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index 797dc62b..dc84f1d9 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -10,12 +10,6 @@ then . $ZDOTDIR/zshenv.private fi - unset SSH_AGENT_PID - if [[ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]] - then - export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" - fi - if [[ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]] then . $HOME/.nix-profile/etc/profile.d/nix.sh; @@ -47,6 +41,15 @@ then fi fi + if [[ $os != "darwin" ]] + then + unset SSH_AGENT_PID + if [[ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]] + then + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" + fi + fi + case $MACHTYPE in *64) arch=amd64 -- cgit 1.4.1 From 508479288c0843099d8f11da65a62e3d20950af8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 29 Aug 2017 16:57:33 +0200 Subject: Remove sshrc --- ssh/.ssh/rc | 5 ----- 1 file changed, 5 deletions(-) delete mode 100755 ssh/.ssh/rc diff --git a/ssh/.ssh/rc b/ssh/.ssh/rc deleted file mode 100755 index 59e4cfd1..00000000 --- a/ssh/.ssh/rc +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -if [ "$SSH_AUTH_SOCK" ] -then - ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock -fi -- cgit 1.4.1 From f06e76405326ad7979ba5efe2408e89f802203b5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 29 Aug 2017 21:12:35 +0200 Subject: adopt: Use stow wrapper script --- adopt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/adopt b/adopt index a0a210fa..6789a6b9 100755 --- a/adopt +++ b/adopt @@ -1,5 +1,6 @@ #!/bin/sh DOTFILES_DIR=$(dirname $(readlink -f $0)) +STOW="$DOTFILES_DIR/stow" if [ "$#" -lt 2 ] then @@ -15,7 +16,7 @@ then mkdir -p $TARGET fi mv $2/* $TARGET - ./stow $1 + $STOW $1 elif [ -f $2 ] then TARGET="$DOTFILES_DIR/$1/$(dirname $2)" @@ -24,5 +25,5 @@ then mkdir -p $TARGET fi mv $2 $TARGET - ./stow $1 + $STOW $1 fi -- cgit 1.4.1 From 46a28c0496d4d8422056011556bde12e759ff6d1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 29 Aug 2017 21:14:31 +0200 Subject: Add riseup to email system --- emacs/.emacs.d/main.el | 18 ++++++++++++------ msmtp/.msmtprc | 7 +++++++ offlineimap/.offlineimaprc | 31 +++++++++++++++++++++++++++---- 3 files changed, 46 insertions(+), 10 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 17d38b1b..e50fdad5 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1380,7 +1380,8 @@ mu4e-view-show-images t mu4e-headers-date-format "%Y-%m-%d %H:%M" - mu4e-maildir (expand-file-name "~/mail/alanpearce") + mu4e-mu-home (expand-file-name "~/.cache/mu/alanpearce.eu") + mu4e-maildir (expand-file-name "~/mail/personal/alanpearce/") mu4e-sent-folder "/Sent" mu4e-drafts-folder "/Drafts" mu4e-refile-folder "/Archive" @@ -1390,7 +1391,6 @@ sendmail-program "msmtp" mu4e-maildir-shortcuts '(("/INBOX" . ?i)) - ;; mu4e-get-mail-command "offlineimap -o" mu4e-contexts (list (make-mu4e-context @@ -1399,14 +1399,20 @@ (when msg (mu4e-message-contact-field-matches msg :to "alan@alanpearce\..*"))) - :vars '((user-mail-address . "alan@alanpearce.eu"))) + :vars `((user-mail-address . "alan@alanpearce.eu") + (mu4e-maildir . ,(expand-file-name "~/mail/personal/alanpearce")) + (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/alanpearce.eu")) + (mu4e-sent-messages-behavior . sent))) (make-mu4e-context - :name "Work" + :name "Riseup" :match-func (lambda (msg) (when msg (mu4e-message-contact-field-matches - msg :to "alan.*@satoshipay.io"))) - :vars '((user-mail-address . "alan@satoshipay.io")))) + msg :to "alanpearce@riseup.net"))) + :vars `((user-mail-address . "alanpearce@riseup.net") + (mu4e-maildir . ,(expand-file-name "~/mail/personal/riseup")) + (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/riseup.net")) + (mu4e-sent-messages-behavior . sent)))) mu4e-user-mail-address-list (append (delq nil (mapcar (lambda (context) diff --git a/msmtp/.msmtprc b/msmtp/.msmtprc index 9a3c1938..6216e0b2 100644 --- a/msmtp/.msmtprc +++ b/msmtp/.msmtprc @@ -22,5 +22,12 @@ account riseup host smtp.riseup.net from alanpearce@riseup.net +account riseup +host mail.riseup.net +from alanpearce@riseup.net +user alanpearce +port 465 +passwordeval pass mail/riseup.net + # Set a default account account default : personal diff --git a/offlineimap/.offlineimaprc b/offlineimap/.offlineimaprc index ea98729f..1e157934 100644 --- a/offlineimap/.offlineimaprc +++ b/offlineimap/.offlineimaprc @@ -1,6 +1,6 @@ [general] # List of accounts to be synced, separated by a comma. -accounts = alanpearce.eu +accounts = alanpearce.eu, riseup.net pythonfile = ~/.offlineimap.py [Account alanpearce.eu] @@ -10,13 +10,13 @@ localrepository = alanpearce.eu-local remoterepository = alanpearce.eu-remote autorefresh = 20 quick = 2 -postsynchook = mu index --maildir=%(personalmaildir)s --lazy-check --nocleanup --quiet +postsynchook = mu index --muhome=~/.cache/mu/alanpearce.eu --maildir=%(alanpearcemaildir)s --lazy-check --nocleanup --quiet [Repository alanpearce.eu-local] # OfflineIMAP supports Maildir, GmailMaildir, and IMAP for local repositories. type = Maildir # Where should the mail be placed? -localfolders = %(personalmaildir)s +localfolders = %(alanpearcemaildir)s [Repository alanpearce.eu-remote] # Remote repos can be IMAP or Gmail, the latter being a preconfigured IMAP. @@ -30,5 +30,28 @@ holdconnectionopen = yes usecompression = yes idlefolders = ['INBOX'] +[Account riseup.net] +localrepository = riseup.net-local +remoterepository = riseup.net-remote +autorefresh = 20 +quick = 2 +postsynchook = mu index --muhome=~/.cache/mu/riseup.net --maildir=%(riseupmaildir)s --lazy-check --nocleanup --quiet + +[Repository riseup.net-local] +type = Maildir +localfolders = %(riseupmaildir)s + +[Repository riseup.net-remote] +type = IMAP +remotehost = mail.riseup.net +remoteuser = alanpearce +remotepasseval = get_pass("mail/riseup.net") +sslcacertfile = /etc/ssl/certs/ca-certificates.crt +keepalive = 1740 +holdconnectionopen = yes +usecompression = yes +idlefolders = ['INBOX'] + [DEFAULT] -personalmaildir = ~/mail/alanpearce +alanpearcemaildir = ~/mail/personal/alanpearce +riseupmaildir = ~/mail/personal/riseup -- cgit 1.4.1 From ad1b15ac87f8b17b81a6c03152cd343ee34657a4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 30 Aug 2017 14:09:35 +0200 Subject: Emacs: Remove lentic It's too buggy. Let's go back to outshine --- emacs/.emacs.d/main.el | 10 ---------- nix/.config/nixpkgs/emacs.nix | 3 +-- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 69f584ec..ce9ee4b0 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1764,16 +1764,6 @@ (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) ;; #+END_SRC -;; *** Lentic - -;; Multiple different views of the same file. Can be used for a kind of -;; inverse literate programming. - -;; #+BEGIN_SRC emacs-lisp -(use-package lentic - :config (global-lentic-mode)) -;; #+END_SRC - ;; *** Outshine ;; Org-ified source code. I think this might work better than diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix index 6ce3a210..9abd3965 100644 --- a/nix/.config/nixpkgs/emacs.nix +++ b/nix/.config/nixpkgs/emacs.nix @@ -51,8 +51,7 @@ in diminish bind-key use-package - smartparens - lentic + smartparens ]) ++ (with epkgs.melpaPackages; [ ace-link ace-window -- cgit 1.4.1 From ebc213b2bac3b4e8681e0acb246dbe97c94e05fa Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 30 Aug 2017 14:59:38 +0200 Subject: Emacs: Remove gnus configuration --- emacs/.emacs.d/ap-spotcap.local.el.gpg | Bin 1333 -> 0 bytes emacs/.emacs.d/main.el | 43 ++++----------------------------- 2 files changed, 5 insertions(+), 38 deletions(-) delete mode 100644 emacs/.emacs.d/ap-spotcap.local.el.gpg diff --git a/emacs/.emacs.d/ap-spotcap.local.el.gpg b/emacs/.emacs.d/ap-spotcap.local.el.gpg deleted file mode 100644 index 1751ca5f..00000000 Binary files a/emacs/.emacs.d/ap-spotcap.local.el.gpg and /dev/null differ diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index ce9ee4b0..2dc39d3b 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1340,22 +1340,9 @@ ;; #+END_SRC ;; ** Mail -;; *** Gnus - -;; At work, I use gnus for email. Some of the setup is specific to my -;; workplace, so I keep it in a host-specific, GPG-encrypted file. +;; *** Basics ;; #+BEGIN_SRC emacs-lisp -(use-package gnus - :config (progn - (setq gnus-gcc-mark-as-read t - mml-secure-openpgp-encrypt-to-self t - send-mail-function #'smtpmail-send-it - message-send-mail-function #'smtpmail-send-it))) - -(with-eval-after-load "gnus-mime" - (define-key gnus-mime-button-map " " #'gnus-mime-view-part-externally)) - (with-eval-after-load "mailcap" (when (eq system-type 'darwin) (mailcap-add-mailcap-entry "application" "pdf" '((viewer . "/usr/bin/qlmanage -p %s") (type . "application/pdf"))))) @@ -1363,6 +1350,9 @@ (with-eval-after-load "mm-decode" (add-to-list 'mm-discouraged-alternatives "text/html") (add-to-list 'mm-discouraged-alternatives "text/richtext")) + +(with-eval-after-load "mml-sec" + (setq mml-secure-openpgp-encrypt-to-self t)) ;; #+END_SRC ;; *** mu @@ -1418,26 +1408,6 @@ "alan@alanpearce.co.uk"))))) ;; #+END_SRC -;; *** BBDB - -;; As I'm using Emacs for email, it makes sense to have contact -;; information here as well. - -;; #+BEGIN_SRC emacs-lisp -(use-package bbdb - :config (progn - (bbdb-initialize 'gnus 'message 'pgp) - (bbdb-mua-auto-update-init 'gnus 'message) - (setq bbdb-send-mail-style 'gnus - bbdb-complete-mail-allow-cycling t - bbdb-mua-auto-update t - bbdb-mua-pop-up-window-size 3 - bbdb-mua-update-interactive-p '(query . create) - bbdb-message-all-addresses t - bbdb-offer-save t - bbdb-offer-to-create 1))) -;; #+END_SRC - ;; ** Misc ;; #+BEGIN_SRC emacs-lisp @@ -2674,10 +2644,7 @@ (use-package ace-link :after avy :config (progn - (ace-link-setup-default) - (with-eval-after-load "gnus" - (bind-key "M-o" #'ace-link-gnus gnus-summary-mode-map) - (bind-key "M-o" #'ace-link-gnus gnus-article-mode-map)))) + (ace-link-setup-default))) ;; #+END_SRC ;; *** goto-chg -- cgit 1.4.1 From 9da3e40568910e4fcee192064b0d41762e9fdf53 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 31 Aug 2017 10:44:44 +0200 Subject: Emacs: Install helpful --- emacs/.emacs.d/main.el | 6 ++++++ nix/.config/nixpkgs/emacs.nix | 1 + 2 files changed, 7 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 2dc39d3b..dc14373c 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1294,6 +1294,12 @@ ;; ** Documentation +;; *** helpful + +;; #+BEGIN_SRC emacs-lisp +(use-package helpful) +;; #+END_SRC + ;; *** ehelp ;; ehelp is a less well-known package that’s part of Emacs and slightly diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix index 9abd3965..aface0fa 100644 --- a/nix/.config/nixpkgs/emacs.nix +++ b/nix/.config/nixpkgs/emacs.nix @@ -106,6 +106,7 @@ in goto-chg haskell-mode highlight-stages + helpful imenu-anywhere indium jinja2-mode -- cgit 1.4.1 From 779e9283e17e91cd7476996c9f5e83d79c3d5a3e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Sep 2017 10:14:32 +0200 Subject: Emacs: Fix syntax error --- emacs/.emacs.d/main.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 768e336f..bee592ac 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1417,7 +1417,7 @@ (cdr (assq 'user-mail-address (mu4e-context-vars context))))) mu4e-contexts)) '("alan@alanpearce.uk" - "alan@alanpearce.co.uk")))) + "alan@alanpearce.co.uk"))))) ;; #+END_SRC ;; ** Misc -- cgit 1.4.1 From c9a0183d78fa568720a5da6af892ed42003ee65c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Sep 2017 15:02:16 +0200 Subject: Add satoshipay email --- emacs/.emacs.d/main.el | 83 +++++++++++++++++++++++++++++----------------- offlineimap/.offlineimaprc | 22 ++++++++++++ 2 files changed, 74 insertions(+), 31 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index bee592ac..7c636573 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1387,37 +1387,58 @@ message-send-mail-function #'message-send-mail-with-sendmail sendmail-program "msmtp" - mu4e-maildir-shortcuts '(("/INBOX" . ?i)) - mu4e-contexts - (list - (make-mu4e-context - :name "Personal" - :match-func (lambda (msg) - (when msg - (mu4e-message-contact-field-matches - msg :to "alan@alanpearce\..*"))) - :vars `((user-mail-address . "alan@alanpearce.eu") - (mu4e-maildir . ,(expand-file-name "~/mail/personal/alanpearce")) - (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/alanpearce.eu")) - (mu4e-sent-messages-behavior . sent))) - (make-mu4e-context - :name "Riseup" - :match-func (lambda (msg) - (when msg - (mu4e-message-contact-field-matches - msg :to "alanpearce@riseup.net"))) - :vars `((user-mail-address . "alanpearce@riseup.net") - (mu4e-maildir . ,(expand-file-name "~/mail/personal/riseup")) - (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/riseup.net")) - (mu4e-sent-messages-behavior . sent)))) - mu4e-user-mail-address-list (append - (delq nil - (mapcar (lambda (context) - (when (mu4e-context-vars context) - (cdr (assq 'user-mail-address (mu4e-context-vars context))))) - mu4e-contexts)) - '("alan@alanpearce.uk" - "alan@alanpearce.co.uk"))))) + mu4e-maildir-shortcuts '(("/INBOX" . ?i)) + mu4e-contexts + (list + (make-mu4e-context + :name "Personal" + :match-func (lambda (msg) + (when msg + (mu4e-message-contact-field-matches + msg :to "alan@alanpearce\..*"))) + :vars `((user-mail-address . "alan@alanpearce.eu") + (mu4e-maildir . ,(expand-file-name "~/mail/personal/alanpearce")) + (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/alanpearce.eu")) + (mu4e-sent-messages-behavior . sent) + (mu4e-sent-folder . "/Sent") + (mu4e-drafts-folder . "/Drafts") + (mu4e-refile-folder . "/Archive") + (mu4e-trash-folder . "/Trash"))) + (make-mu4e-context + :name "Riseup" + :match-func (lambda (msg) + (when msg + (mu4e-message-contact-field-matches + msg :to "alanpearce@riseup.net"))) + :vars `((user-mail-address . "alanpearce@riseup.net") + (mu4e-maildir . ,(expand-file-name "~/mail/personal/riseup")) + (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/riseup.net")) + (mu4e-sent-messages-behavior . sent) + (mu4e-sent-folder . "/Sent") + (mu4e-drafts-folder . "/Drafts") + (mu4e-refile-folder . "/Archive") + (mu4e-trash-folder . "/Trash"))) + (make-mu4e-context + :name "Satoshipay" + :match-func (lambda (msg) + (when msg + (mu4e-message-contact-field-matches + msg :to "alan@satoshipay.io"))) + :vars `((user-mail-address . "alan@satoshipay.io") + (mu4e-maildir . ,(expand-file-name "~/mail/satoshipay")) + (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/satoshipay.io")) + (mu4e-sent-messages-behavior . sent) + (mu4e-drafts-folder . "/[Gmail].Drafts") + (mu4e-sent-folder . "/[Gmail].Sent Mail") + (mu4e-trash-folder . "/[Gmail].Bin")))) + mu4e-user-mail-address-list (append + (delq nil + (mapcar (lambda (context) + (when (mu4e-context-vars context) + (cdr (assq 'user-mail-address (mu4e-context-vars context))))) + mu4e-contexts)) + '("alan@alanpearce.uk" + "alan@alanpearce.co.uk"))))) ;; #+END_SRC ;; ** Misc diff --git a/offlineimap/.offlineimaprc b/offlineimap/.offlineimaprc index 1e157934..7fe73791 100644 --- a/offlineimap/.offlineimaprc +++ b/offlineimap/.offlineimaprc @@ -52,6 +52,28 @@ holdconnectionopen = yes usecompression = yes idlefolders = ['INBOX'] +[Account satoshipay.io] +localrepository = satoshipay.io-local +remoterepository = satoshipay.io-remote +autorefresh = 20 +quick = 2 +postsynchook = mu index --muhome=~/.cache/mu/satoshipay.io --maildir=%(satoshipaymaildir)s --lazy-check --nocleanup --quiet + +[Repository satoshipay.io-local] +type = GmailMaildir +localfolders = %(satoshipaymaildir)s + +[Repository satoshipay.io-remote] +type = Gmail +remoteuser = alan@satoshipay.io +remotepasseval = get_pass("satoshipay/google") +sslcacertfile = /etc/ssl/certs/ca-certificates.crt +keepalive = 1740 +holdconnectionopen = yes +usecompression = yes +idlefolders = ['INBOX'] + [DEFAULT] alanpearcemaildir = ~/mail/personal/alanpearce riseupmaildir = ~/mail/personal/riseup +satoshipaymaildir = ~/mail/satoshipay \ No newline at end of file -- cgit 1.4.1 From 1b0608b3999f0c0349a14cfc9227db4501110f83 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Sep 2017 15:02:44 +0200 Subject: Emacs: Set shr-like keybindings in mu4e --- emacs/.emacs.d/main.el | 140 +++++++++++++++++++++++++------------------------ 1 file changed, 72 insertions(+), 68 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 7c636573..eb8259ed 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1371,74 +1371,78 @@ (file-truename (executable-find "mu"))))) (use-package mu4e - :config - (setq mu4e-use-fancy-chars nil - mu4e-attachment-dir "~/Downloads/" - mu4e-view-show-images t - mu4e-headers-date-format "%Y-%m-%d %H:%M" - - mu4e-mu-home (expand-file-name "~/.cache/mu/alanpearce.eu") - mu4e-maildir (expand-file-name "~/mail/personal/alanpearce/") - mu4e-sent-folder "/Sent" - mu4e-drafts-folder "/Drafts" - mu4e-refile-folder "/Archive" - mu4e-trash-folder "/Trash" - - message-send-mail-function #'message-send-mail-with-sendmail - sendmail-program "msmtp" - - mu4e-maildir-shortcuts '(("/INBOX" . ?i)) - mu4e-contexts - (list - (make-mu4e-context - :name "Personal" - :match-func (lambda (msg) - (when msg - (mu4e-message-contact-field-matches - msg :to "alan@alanpearce\..*"))) - :vars `((user-mail-address . "alan@alanpearce.eu") - (mu4e-maildir . ,(expand-file-name "~/mail/personal/alanpearce")) - (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/alanpearce.eu")) - (mu4e-sent-messages-behavior . sent) - (mu4e-sent-folder . "/Sent") - (mu4e-drafts-folder . "/Drafts") - (mu4e-refile-folder . "/Archive") - (mu4e-trash-folder . "/Trash"))) - (make-mu4e-context - :name "Riseup" - :match-func (lambda (msg) - (when msg - (mu4e-message-contact-field-matches - msg :to "alanpearce@riseup.net"))) - :vars `((user-mail-address . "alanpearce@riseup.net") - (mu4e-maildir . ,(expand-file-name "~/mail/personal/riseup")) - (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/riseup.net")) - (mu4e-sent-messages-behavior . sent) - (mu4e-sent-folder . "/Sent") - (mu4e-drafts-folder . "/Drafts") - (mu4e-refile-folder . "/Archive") - (mu4e-trash-folder . "/Trash"))) - (make-mu4e-context - :name "Satoshipay" - :match-func (lambda (msg) - (when msg - (mu4e-message-contact-field-matches - msg :to "alan@satoshipay.io"))) - :vars `((user-mail-address . "alan@satoshipay.io") - (mu4e-maildir . ,(expand-file-name "~/mail/satoshipay")) - (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/satoshipay.io")) - (mu4e-sent-messages-behavior . sent) - (mu4e-drafts-folder . "/[Gmail].Drafts") - (mu4e-sent-folder . "/[Gmail].Sent Mail") - (mu4e-trash-folder . "/[Gmail].Bin")))) - mu4e-user-mail-address-list (append - (delq nil - (mapcar (lambda (context) - (when (mu4e-context-vars context) - (cdr (assq 'user-mail-address (mu4e-context-vars context))))) - mu4e-contexts)) - '("alan@alanpearce.uk" - "alan@alanpearce.co.uk"))))) + :config (progn + (setq mu4e-use-fancy-chars nil + mu4e-attachment-dir "~/Downloads/" + mu4e-view-show-images t + mu4e-headers-date-format "%Y-%m-%d %H:%M" + + mu4e-mu-home (expand-file-name "~/.cache/mu/alanpearce.eu") + mu4e-maildir (expand-file-name "~/mail/personal/alanpearce/") + mu4e-sent-folder "/Sent" + mu4e-drafts-folder "/Drafts" + mu4e-refile-folder "/Archive" + mu4e-trash-folder "/Trash" + + message-send-mail-function #'message-send-mail-with-sendmail + sendmail-program "msmtp" + + mu4e-maildir-shortcuts '(("/INBOX" . ?i)) + mu4e-contexts + (list + (make-mu4e-context + :name "Personal" + :match-func (lambda (msg) + (when msg + (mu4e-message-contact-field-matches + msg :to "alan@alanpearce\..*"))) + :vars `((user-mail-address . "alan@alanpearce.eu") + (mu4e-maildir . ,(expand-file-name "~/mail/personal/alanpearce")) + (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/alanpearce.eu")) + (mu4e-sent-messages-behavior . sent) + (mu4e-sent-folder . "/Sent") + (mu4e-drafts-folder . "/Drafts") + (mu4e-refile-folder . "/Archive") + (mu4e-trash-folder . "/Trash"))) + (make-mu4e-context + :name "Riseup" + :match-func (lambda (msg) + (when msg + (mu4e-message-contact-field-matches + msg :to "alanpearce@riseup.net"))) + :vars `((user-mail-address . "alanpearce@riseup.net") + (mu4e-maildir . ,(expand-file-name "~/mail/personal/riseup")) + (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/riseup.net")) + (mu4e-sent-messages-behavior . sent) + (mu4e-sent-folder . "/Sent") + (mu4e-drafts-folder . "/Drafts") + (mu4e-refile-folder . "/Archive") + (mu4e-trash-folder . "/Trash"))) + (make-mu4e-context + :name "Satoshipay" + :match-func (lambda (msg) + (when msg + (mu4e-message-contact-field-matches + msg :to "alan@satoshipay.io"))) + :vars `((user-mail-address . "alan@satoshipay.io") + (mu4e-maildir . ,(expand-file-name "~/mail/satoshipay")) + (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/satoshipay.io")) + (mu4e-sent-messages-behavior . sent) + (mu4e-drafts-folder . "/[Gmail].Drafts") + (mu4e-sent-folder . "/[Gmail].Sent Mail") + (mu4e-trash-folder . "/[Gmail].Bin")))) + mu4e-user-mail-address-list (append + (delq nil + (mapcar (lambda (context) + (when (mu4e-context-vars context) + (cdr (assq 'user-mail-address (mu4e-context-vars context))))) + mu4e-contexts)) + '("alan@alanpearce.uk" + "alan@alanpearce.co.uk"))) + (define-hook-helper mu4e-view-mode () + ;; try to emulate some of the eww key-bindings + (local-set-key (kbd "") 'shr-next-link) + (local-set-key (kbd "") 'shr-previous-link))))) ;; #+END_SRC ;; ** Misc -- cgit 1.4.1 From 3b17089691ea3e4f390a4ee41fd19b00a52c4b26 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Sep 2017 15:08:09 +0200 Subject: msmtp: Remove duplicate riseup setting --- msmtp/.msmtprc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/msmtp/.msmtprc b/msmtp/.msmtprc index 6216e0b2..041284ea 100644 --- a/msmtp/.msmtprc +++ b/msmtp/.msmtprc @@ -18,10 +18,6 @@ from alan@alanpearce.uk account personal-co-uk : personal from alan@alanpearce.co.uk -account riseup -host smtp.riseup.net -from alanpearce@riseup.net - account riseup host mail.riseup.net from alanpearce@riseup.net -- cgit 1.4.1 From 554583649c15cb783b637523f97252e2e036782e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Sep 2017 15:08:21 +0200 Subject: msmtp: Add satoshipay --- msmtp/.msmtprc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/msmtp/.msmtprc b/msmtp/.msmtprc index 041284ea..2c767888 100644 --- a/msmtp/.msmtprc +++ b/msmtp/.msmtprc @@ -25,5 +25,13 @@ user alanpearce port 465 passwordeval pass mail/riseup.net +account satoshipay +host smtp.gmail.com +from alan@satoshipay.io +user alan@satoshipay.io +port 465 +tls_starttls off +passwordeval pass satoshipay/google + # Set a default account account default : personal -- cgit 1.4.1 From bfdf0f4afb759fecbc6d374dadf1b522f70f9e54 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Sep 2017 20:37:00 +0200 Subject: Emacs: Fix daemon startup error --- emacs/.emacs.d/main.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index eb8259ed..1b4bff36 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -60,8 +60,11 @@ ;; #+BEGIN_SRC emacs-lisp (eval-and-compile (require 'seq) - (defvar nix-emacs (and (string-match "^/nix/store" invocation-directory) - (not (null (seq-some (lambda (dir) (string-match "^/nix/store" dir)) load-path))))) + (defun is-nix-emacs () + (and invocation-directory + (string-match "^/nix/store" invocation-directory) + (not (null (seq-some (lambda (dir) (string-match "^/nix/store" dir)) load-path))))) + (defvar nix-emacs (is-nix-emacs)) (setq tls-checktrust t gnutls-verify-error t -- cgit 1.4.1 From 57de1e62030f812a20918509fdb07154c7622e73 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Sep 2017 20:37:43 +0200 Subject: Emacs: Silence most byte-compiler warnings --- emacs/.emacs.d/main.el | 77 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 53 insertions(+), 24 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 1b4bff36..3e454195 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -242,7 +242,8 @@ ;; #+BEGIN_SRC emacs-lisp (if (eq window-system 'mac) - (mac-auto-operator-composition-mode +1) + (if (fboundp 'mac-auto-operator-composition-mode) + (mac-auto-operator-composition-mode +1)) (global-prettify-symbols-mode +1)) ;; #+END_SRC @@ -301,7 +302,7 @@ ;; #+BEGIN_SRC emacs-lisp (defvar mode-line-default-format mode-line-format) (defvar mode-line-default-hidden nil - "Whether to hide the mode line by default") + "Whether to hide the mode line by default.") (defun show-mode-line () (interactive) @@ -434,6 +435,8 @@ ;; #+BEGIN_SRC emacs-lisp (use-package nix-sandbox + :defines (flycheck-command-wrapper-function + flycheck-executable-find) :config (progn (with-eval-after-load 'flycheck (setq flycheck-command-wrapper-function @@ -527,6 +530,7 @@ ;; #+BEGIN_SRC emacs-lisp (defun switch-to-dotfiles () + "Switch to dotfiles project." (interactive) (projectile-switch-project-by-name (car (split-string (shell-command-to-string "ghq list --full-path dotfiles"))))) ;; #+END_SRC @@ -782,9 +786,10 @@ ;; #+BEGIN_SRC emacs-lisp (defun my-create-non-existent-directory () + "Offer to create non-existent directories of found-file." (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))) + (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 @@ -794,7 +799,7 @@ ;; #+BEGIN_SRC emacs-lisp (defun kill-or-delete-this-buffer-dwim (&optional arg) - "Kills current buffer. With prefix arg, delete it." + "Kill current buffer. With prefix ARG, delete it." (interactive "P") (if (equal arg '(4)) (delete-current-buffer-file) @@ -812,9 +817,11 @@ ;; #+BEGIN_SRC emacs-lisp (defun show-trailing-whitespace-on () + "Show trailing whitespace." (interactive) (setq-local show-trailing-whitespace t)) (defun show-trailing-whitespace-off () + "Hide trailing whitespace." (interactive) (setq-local show-trailing-whitespace nil)) (add-hook 'prog-mode-hook #'show-trailing-whitespace-on) @@ -1180,8 +1187,9 @@ ;; Sometimes I want to insert a date or time into a buffer. ;; #+BEGIN_SRC emacs-lisp (defun insert-date (prefix) - "Insert the current date. With prefix-argument, use British format. With - two prefix arguments, write out the day and month name." + "Insert the current date. +With PREFIX, use British format. +With two prefix arguments, write out the day and month name." (interactive "P") (let ((format (cond ((not prefix) "%Y-%m-%d") @@ -1190,7 +1198,7 @@ (insert (format-time-string format)))) (defun insert-datetime (prefix) - "Insert the current date and time." + "Insert current date and time. With PREFIX, use ISO8601 format." (interactive "P") (let ((format (cond ((not prefix) "%Y-%m-%d %H:%M:%S") @@ -1200,7 +1208,7 @@ ;; #+BEGIN_SRC emacs-lisp (defun yesterday-time () - "Provide the date/time 24 hours before the time now in the format of current-time." + "Provide the date/time 24 hours before the time now in the format of `current-time'." (timer-relative-time (current-time) -86400)) ;; #+END_SRC @@ -1233,6 +1241,7 @@ ;; #+BEGIN_SRC emacs-lisp (defun turn-on-dired-omit-mode () + "Enable dired-omit mode." (interactive) (dired-omit-mode 1)) @@ -1374,6 +1383,10 @@ (file-truename (executable-find "mu"))))) (use-package mu4e + :defines (mu4e-use-fancy-chars + mu4e-attachment-dir + mu4e-view-show-images + mu4e-headers-date-format) :config (progn (setq mu4e-use-fancy-chars nil mu4e-attachment-dir "~/Downloads/" @@ -1453,11 +1466,11 @@ ;; #+BEGIN_SRC emacs-lisp (defvar *init-file* (file-truename user-init-file) - "Where the emacs init file really is, passing through symlinks.") + "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" + "Remove extraneous CR codes from a file." (interactive) (save-excursion (goto-char (point-min)) @@ -1467,12 +1480,15 @@ (use-package rect :ensure nil + :defines (killed-rectangle) :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) + "Execute shell command, replacing % with the current buffer file name. +With prefix TO-CURRENT-BUFFER, insert command output into buffer." (interactive "P") (let ((file-buffer (if (buffer-file-name) (file-name-nondirectory (buffer-file-name)) @@ -1481,7 +1497,7 @@ (shell-command (replace-regexp-in-string "%" file-buffer command) to-current-buffer))) (defun process-exit-code (program &rest args) - "Run PROGRAM with ARGS and return the exit code" + "Run PROGRAM with ARGS and return the exit code." (apply 'call-process program nil nil nil args)) (defun narrow-to-region-indirect (start end) @@ -1510,14 +1526,16 @@ (concat "/run/user/" (number-to-string (user-uid)) "/gnupg/S.gpg-agent.ssh"))) (defun read-gpg-file (file) + "Read (decrypt) given GPG file FILE." (let ((file-to-decrypt (expand-file-name file user-emacs-directory)) - (ctx (epg-make-context epa-protocol))) + (ctx (epg-make-context epa-protocol))) (if (file-exists-p file-to-decrypt) - (epg-decrypt-file ctx file-to-decrypt nil) + (epg-decrypt-file ctx file-to-decrypt nil) (message "Decrypting %s...failed" file-to-decrypt) (error "File %s does not exist" file-to-decrypt)))) (defun load-gpg (file) + "Load FILE if private key is available." (if have-private-key (load file) (message "WARNING: Couldn't load %s (No gpg key found)" file))) @@ -1525,6 +1543,7 @@ ; load this in a post-frame hook because gpg-agent asks for a password on first ; startup and caches it. Don't want emacs daemon to hang because of gpg-agent. (defun load-private-data () + "Load encrypted config in file based upon hostname." (interactive) (if (not (file-exists-p (expand-file-name (concat (system-name) ".el.gpg") user-emacs-directory))) (message "No encrypted configuration matches system name `%s'" (system-name)) @@ -1541,7 +1560,8 @@ (add-to-list 'load-suffixes ".el.gpg") (load-gpg (expand-file-name (system-name) user-emacs-directory))))) -(defun first-frame-hook (frame) +(defun first-frame-hook () + "Hook run only after first frame is created." (remove-hook 'after-make-frame-functions #'first-frame-hook) (run-at-time nil nil 'load-private-data)) @@ -1628,6 +1648,7 @@ ;; #+BEGIN_SRC emacs-lisp (use-package smex + :defines (smex-key-advice-ignore-menu-bar) :commands (smex smex-update smex-initialize) @@ -1733,6 +1754,8 @@ (use-package ledger-mode :mode ("\\.ledger\\'" . ledger-mode) :functions ledger-report + :defines (ledger-use-iso-dates + ledger-post-use-completion-engine) :init (progn (defun open-budget () (interactive) @@ -1802,6 +1825,7 @@ ("C-c a" . org-agenda) ("C-c l" . org-store-link)) :defer 8 + :defines (org-table-duration-custom-format) :init (setq org-replace-disputed-keys t org-ellipsis "…") :config (progn @@ -1828,8 +1852,6 @@ org-src-fontify-natively nil - org-export-have-math t - org-blank-before-new-entry '((heading . t) (plain-list-item . auto)) org-fontify-done-headline t @@ -1887,9 +1909,9 @@ (define-hook-helper org-journal-mode () (use-variable-fonts) (text-scale-adjust 4) - (if smartparens-strict-mode + (if (fboundp 'smartparens-strict-mode) (smartparens-strict-mode -1)) - (if show-smartparens-mode + (if (fboundp 'show-smartparens-mode) (show-smartparens-mode -1))) (defun org-journal-display-entry-yesterday () "Show org-journal entry for yesterday" @@ -2399,11 +2421,13 @@ ;; #+BEGIN_SRC emacs-lisp (defun live-coding () + "Configure display for live coding." (interactive) (ap/set-fonts "SF Mono" 18 nil nil t 0.1) (global-command-log-mode 1)) (defun live-coding-stop () + "Revert live coding display configuration." (interactive) (ap/set-fonts-according-to-system) (global-command-log-mode -1)) @@ -2413,11 +2437,11 @@ ;; #+BEGIN_SRC emacs-lisp (use-package command-log-mode - :defines command-log-mode-key-binding-open-log - :init (progn - (setq command-log-mode-key-binding-open-log nil - command-log-mode-auto-show t - command-log-mode-is-global t))) + :defines (command-log-mode-key-binding-open-log) + :config (progn + (setq command-log-mode-key-binding-open-log nil + command-log-mode-auto-show t + command-log-mode-is-global t))) ;; #+END_SRC ;; ** Spelling @@ -2528,6 +2552,7 @@ :bind ("C-c s" . eshell) :defer 10 :functions (eshell/pwd) + :defines (eshell-prompt-function) :config (progn (setq eshell-directory-name "~/.emacs.d/eshell" eshell-prompt-function (lambda () @@ -2549,6 +2574,8 @@ (autoload #'eshell/cd "em-dirs") (defun eshell-goto-current-dir (&optional arg) + "Open `default-directory' in eshell. +Pass optional ARG to `eshell' (which see)." (interactive "P") (let ((dir default-directory)) (eshell arg) @@ -2573,6 +2600,8 @@ :config (bind-key "C-c C-l" #'counsel-shell-history comint-mode-map)) (defun comint-delchar-or-eof-or-kill-buffer (arg) + "DWIM command for ^D to behave like in shells. +Pass ARG to `comint-delchar-or-maybe-eof'." (interactive "p") (if (null (get-buffer-process (current-buffer))) (kill-buffer) @@ -2765,7 +2794,7 @@ (bind-key "M-" #'sp-splice-sexp-killing-backward smartparens-mode-map) (bind-key "M-" #'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-" #'sp-slurp-hybrid-sexp smartparens-mode-map) + (bind-key "C-S-" #'sp-slurp-hybrid-sexp smartparens-mode-map) (show-smartparens-global-mode t) (smartparens-global-strict-mode t) (define-hook-helper lisp-mode-common () -- cgit 1.4.1 From 3ad99faaddef928e1fcdfa3df6d9e96710142b1b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Sep 2017 20:48:25 +0200 Subject: Emacs: Configure beancount mode --- emacs/.emacs.d/main.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 3e454195..226cc2fb 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1788,6 +1788,18 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ("account" "ledger -f %(ledger-file) reg %(account)"))))) ;; #+END_SRC +;; *** Beancount + +;; #+BEGIN_SRC emacs-lisp +(let ((beancount-dir (car (split-string (shell-command-to-string "ghq list --full-path beancount"))))) + (when (file-directory-p beancount-dir) + (add-to-list 'load-path (expand-file-name "editors/emacs/" + beancount-dir)) + (use-package beancount + :defines (beancount-use-ido) + :config (setq beancount-use-ido nil)))) +;; #+END_SRC + ;; *** Markdown ;; #+BEGIN_SRC emacs-lisp -- cgit 1.4.1 From cce695c698235eb1e7364d73d4e708523c413eba Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 1 Sep 2017 20:48:41 +0200 Subject: Emacs: Improve first-frame-hook --- emacs/.emacs.d/main.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 226cc2fb..edd75073 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1560,14 +1560,16 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-to-list 'load-suffixes ".el.gpg") (load-gpg (expand-file-name (system-name) user-emacs-directory))))) -(defun first-frame-hook () +(defun first-frame-hook (frame) "Hook run only after first frame is created." (remove-hook 'after-make-frame-functions #'first-frame-hook) - (run-at-time nil nil 'load-private-data)) + (run-at-time nil nil #'load-private-data) + (run-at-time nil nil #'ap/set-fonts-according-to-system)) -(if (eq 1 (length (frame-list))) - (add-hook 'after-init-hook #'load-private-data) - (add-hook 'after-make-frame-functions #'first-frame-hook)) +(if (or (daemonp) + (not (eq 1 (length (frame-list))))) + (add-hook 'after-make-frame-functions #'first-frame-hook) + (add-hook 'after-init-hook #'load-private-data)) ;; #+END_SRC ;; ** Minibuffer -- cgit 1.4.1 From 6f4e0573de4b7c154ae649f6a83e2e90ee98d27b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 4 Sep 2017 09:05:07 +0200 Subject: zsh: Fix OS check for SSH agent --- zsh/.config/zsh/.zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 91d5e011..7b1249cb 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -106,7 +106,7 @@ bindkey '\e ' hist-complete zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*' zstyle ':completion:*' completer _expand _complete _match -if [[ $os -ne "darwin" && -n $commands[gpg-connect-agent] ]] +if [[ $os != "darwin" && -n $commands[gpg-connect-agent] ]] then # When using SSH support, use the current TTY for passphrase prompts gpg-connect-agent updatestartuptty /bye > /dev/null -- cgit 1.4.1 From 0baa0b002bbae48baf80c2b80cfaf64f21911594 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 4 Sep 2017 09:05:19 +0200 Subject: zsh: Set EMAIL --- zsh/.config/zsh/.zshenv | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index dc84f1d9..620ece50 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -69,6 +69,13 @@ then path+=($HOME/go/bin) fi + if [[ $HOSTNAME =~ satoshi ]] + then + EMAIL=alan@satoshipay.io + else + EMAIL=alan@alanpearce.eu + fi + export GTAGSCONF=~/.globalrc export GTAGSLABEL=ctags -- cgit 1.4.1 From 02df707aeb33315f94afd3e9c714e2f7ceed35c0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 4 Sep 2017 09:05:32 +0200 Subject: offlineimap: Change pass structure --- offlineimap/.offlineimaprc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/offlineimap/.offlineimaprc b/offlineimap/.offlineimaprc index 7fe73791..286b9582 100644 --- a/offlineimap/.offlineimaprc +++ b/offlineimap/.offlineimaprc @@ -23,7 +23,7 @@ localfolders = %(alanpearcemaildir)s type = IMAP remotehost = mail.alanpearce.eu remoteuser = alan -remotepasseval = get_pass("mail/alanpearce.eu") +remotepasseval = get_pass("mail/alanpearce") sslcacertfile = /etc/ssl/certs/ca-certificates.crt keepalive = 1740 holdconnectionopen = yes @@ -45,7 +45,7 @@ localfolders = %(riseupmaildir)s type = IMAP remotehost = mail.riseup.net remoteuser = alanpearce -remotepasseval = get_pass("mail/riseup.net") +remotepasseval = get_pass("mail/riseup") sslcacertfile = /etc/ssl/certs/ca-certificates.crt keepalive = 1740 holdconnectionopen = yes -- cgit 1.4.1 From d067d78eff9e4985bbcc9d7d53feb458cde31943 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 4 Sep 2017 12:41:34 +0200 Subject: i3: Add locker --- i3/.config/i3/config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index bc7f1aef..d245950b 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -47,6 +47,7 @@ set_from_resource $base0D i3wm.color0D #7cafc2 set_from_resource $base0E i3wm.color0E #96609e set_from_resource $base0F i3wm.color0F #a16946 +set $Locker i3lock-color # Font for window titles. Will also be used by the bar unless a different font # is used in the bar {} block below. @@ -154,6 +155,7 @@ bindsym $mod+Shift+8 move container to workspace 8 bindsym $mod+Shift+9 move container to workspace 9 bindsym $mod+Shift+0 move container to workspace 10 +bindsym $mod+l exec $Locker # reload the configuration file bindsym $mod+Shift+c reload # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) -- cgit 1.4.1 From 96f8281882885dce53bc61298933578ce2ce0c99 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 4 Sep 2017 12:41:46 +0200 Subject: i3: Fix "wait" cursor after launching --- i3/.config/i3/config | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index d245950b..f5dbd1de 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -68,14 +68,14 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 floating_modifier $mod # start a terminal -bindsym $mod+Return exec st +bindsym $mod+Return exec --no-startup-id st # kill focused window bindsym $mod+Shift+w kill # start dmenu (a program launcher) -bindsym $mod+Mod1+r exec dmenu_run -bindsym $mod+Shift+semicolon exec passmenu +bindsym $mod+Mod1+r exec --no-startup-id dmenu_run +bindsym $mod+Shift+semicolon exec --no-startup-id passmenu # There Also Is The (new) i3-dmenu-desktop which only displays applications # shipping a .desktop file. It is a wrapper around dmenu, so you need that # installed. -- cgit 1.4.1 From b9a7843d481f03ff4539b9adfebcc6620890d0b1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 4 Sep 2017 12:42:07 +0200 Subject: i3: Add mode for power commands --- i3/.config/i3/config | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index f5dbd1de..85c828d6 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -189,6 +189,22 @@ mode "resize" { bindsym $mod+Shift+r mode "resize" +set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown +mode "$mode_system" { + bindsym l exec --no-startup-id $Locker, mode "default" + bindsym e exec --no-startup-id i3-msg exit, mode "default" + bindsym s exec --no-startup-id $Locker && systemctl suspend, mode "default" + bindsym h exec --no-startup-id $Locker && systemctl hibernate, mode "default" + bindsym r exec --no-startup-id systemctl reboot, mode "default" + bindsym Shift+s exec --no-startup-id systemctl poweroff -i, mode "default" + + # back to normal: Enter or Escape + bindsym Return mode "default" + bindsym Escape mode "default" +} + +bindsym $mod+Pause mode "$mode_system" + # Start i3bar to display a workspace bar (plus the system information i3status # finds out, if available) bar { -- cgit 1.4.1 From f7637569d5e54282e8a95185802b92fc4b0f38d6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 4 Sep 2017 19:58:07 +0200 Subject: Emacs: Update mu4e automatically --- emacs/.emacs.d/main.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index edd75073..8dd3afd6 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1392,6 +1392,7 @@ With two prefix arguments, write out the day and month name." mu4e-attachment-dir "~/Downloads/" mu4e-view-show-images t mu4e-headers-date-format "%Y-%m-%d %H:%M" + mu4e-update-interval 300 mu4e-mu-home (expand-file-name "~/.cache/mu/alanpearce.eu") mu4e-maildir (expand-file-name "~/mail/personal/alanpearce/") -- cgit 1.4.1 From f21ac9298f04a588610270c6207a31709cbc96f2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 5 Sep 2017 13:08:35 +0200 Subject: git: Update signing key --- git/.config/git/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git/.config/git/config b/git/.config/git/config index ab8143b1..12a490b8 100644 --- a/git/.config/git/config +++ b/git/.config/git/config @@ -1,7 +1,7 @@ [user] email = alan@alanpearce.eu name = Alan Pearce - signingkey = 0xE711C48B9C041266 + signingkey = 0xAE8625A63F6F8FD5 [color] branch = auto diff = auto -- cgit 1.4.1 From 7c4e5b86ca9b1712882991d7e3f777db99f01356 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 6 Sep 2017 14:44:38 +0200 Subject: Emacs: Add yarn-remove command --- emacs/.emacs.d/main.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 8dd3afd6..bb902583 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -593,6 +593,11 @@ (projectile-with-default-dir (projectile-project-root) (cmd-to-echo "yarn" (concat "add " package)))) + (defun yarn-remove (package) + (interactive "spackage: ") + (projectile-with-default-dir (projectile-project-root) + (cmd-to-echo "yarn" (concat "remove " package)))) + (defun yarn-run (cmd) (interactive (list (projectile-completing-read "command: " (alist-get 'scripts (json-read-file (expand-file-name "package.json" (projectile-project-root))))))) -- cgit 1.4.1 From e88dc6c07d33e734c8059dfe4e01a8556ab8a5f8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 6 Sep 2017 16:43:17 +0200 Subject: Emacs: hook up `standard` and `eslint` if available --- emacs/.emacs.d/main.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index bb902583..2f7bf539 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -2296,7 +2296,12 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; #+BEGIN_SRC emacs-lisp (use-package add-node-modules-path :config (progn - (add-hook 'js2-mode-hook #'add-node-modules-path))) + (define-hook-helper js2-mode () + (add-node-modules-path) + (when (executable-find "eslint") + (setq flycheck-javascript-eslint-executable "eslint")) + (when (executable-find "standard") + (setq flycheck-javascript-standard-executable "standard"))))) ;; #+END_SRC ;; ***** Flow -- cgit 1.4.1 From 1fc8e0628bdac0b558a0c9cedf7d54cc6d66af14 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 6 Sep 2017 16:43:45 +0200 Subject: i3: Add extra keybind for shutdown mode --- i3/.config/i3/config | 1 + 1 file changed, 1 insertion(+) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 85c828d6..1b428621 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -204,6 +204,7 @@ mode "$mode_system" { } bindsym $mod+Pause mode "$mode_system" +bindsym $mod+Escape mode "$mode_system" # Start i3bar to display a workspace bar (plus the system information i3status # finds out, if available) -- cgit 1.4.1 From 580937e3bf5b89d9ddb2bae871af885f8947b5f4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 6 Sep 2017 16:44:07 +0200 Subject: i3: Float pinentry windows --- i3/.config/i3/config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 1b428621..39e374af 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -235,3 +235,5 @@ client.placeholder $base00 $base00 $base05 $base00 $base00 client.background $base07 hide_edge_borders both + +for_window [class="Pinentry$"] floating enable -- cgit 1.4.1 From 11209f698ab6bc154de5abf8fd14bf2f9ad28610 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 6 Sep 2017 16:44:20 +0200 Subject: offlineimap: check more often --- offlineimap/.offlineimaprc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/offlineimap/.offlineimaprc b/offlineimap/.offlineimaprc index 286b9582..0bba8963 100644 --- a/offlineimap/.offlineimaprc +++ b/offlineimap/.offlineimaprc @@ -8,7 +8,7 @@ pythonfile = ~/.offlineimap.py localrepository = alanpearce.eu-local # Identifier for the remote repository; i.e. the actual IMAP, usually non-local. remoterepository = alanpearce.eu-remote -autorefresh = 20 +autorefresh = 5 quick = 2 postsynchook = mu index --muhome=~/.cache/mu/alanpearce.eu --maildir=%(alanpearcemaildir)s --lazy-check --nocleanup --quiet @@ -33,7 +33,7 @@ idlefolders = ['INBOX'] [Account riseup.net] localrepository = riseup.net-local remoterepository = riseup.net-remote -autorefresh = 20 +autorefresh = 10 quick = 2 postsynchook = mu index --muhome=~/.cache/mu/riseup.net --maildir=%(riseupmaildir)s --lazy-check --nocleanup --quiet @@ -55,7 +55,7 @@ idlefolders = ['INBOX'] [Account satoshipay.io] localrepository = satoshipay.io-local remoterepository = satoshipay.io-remote -autorefresh = 20 +autorefresh = 5 quick = 2 postsynchook = mu index --muhome=~/.cache/mu/satoshipay.io --maildir=%(satoshipaymaildir)s --lazy-check --nocleanup --quiet -- cgit 1.4.1 From 13519aff231476ae073a74313ba037df1b05ce80 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 6 Sep 2017 19:26:28 +0200 Subject: Emacs: Extract first-frame-hook --- emacs/.emacs.d/main.el | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 2f7bf539..2e8a393a 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -224,9 +224,9 @@ (ap/set-fonts "PT Mono" 14 "Noto Sans" 14 nil)) ((and (eq window-system 'x) (eq system-type 'gnu/linux/windows)) - (ap/set-fonts "Noto Mono" 12 "Sans" 12 nil)))) + (ap/set-fonts "Noto Mono" 12 "Sans" 12 nil))))) - (ap/set-fonts-according-to-system)) +(add-hook 'first-frame-hook #'ap/set-fonts-according-to-system) ;; #+END_SRC ;; Reduce font decoration. I’m trying to see whether this helps me focus @@ -1566,16 +1566,20 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-to-list 'load-suffixes ".el.gpg") (load-gpg (expand-file-name (system-name) user-emacs-directory))))) -(defun first-frame-hook (frame) +(defvar first-frame-hook nil + "Hook for running code after first-frame is opened.") + +(defun first-frame-hook-handler (frame) "Hook run only after first frame is created." - (remove-hook 'after-make-frame-functions #'first-frame-hook) - (run-at-time nil nil #'load-private-data) - (run-at-time nil nil #'ap/set-fonts-according-to-system)) + (remove-hook 'after-make-frame-functions #'first-frame-hook-handler) + (run-at-time nil nil (lambda () (run-hooks 'first-frame-hook)))) (if (or (daemonp) (not (eq 1 (length (frame-list))))) - (add-hook 'after-make-frame-functions #'first-frame-hook) - (add-hook 'after-init-hook #'load-private-data)) + (add-hook 'after-make-frame-functions #'first-frame-hook-handler) + (run-at-time nil nil (lambda () (run-hooks 'first-frame-hook)))) + +(add-hook 'first-frame-hook #'load-private-data) ;; #+END_SRC ;; ** Minibuffer -- cgit 1.4.1 From 25a441247067ce2a0f22c2eea69fc61738008d09 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 7 Sep 2017 16:57:31 +0200 Subject: Emacs: Disable crux-reopen-as-root-mode It's annoying that it pops up when I follow a link to a source file in an emacs help file. --- emacs/.emacs.d/main.el | 2 -- 1 file changed, 2 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 2e8a393a..0f1b353e 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -519,8 +519,6 @@ ("C-c e" . crux-eval-and-replace) ("C-c D" . crux-delete-file-and-buffer) ("C-c R" . crux-rename-file-and-buffer)) - :config (progn - (crux-reopen-as-root-mode +1)) :init (progn (defalias 'delete-current-buffer-file #'crux-delete-file-and-buffer) (defalias 'rename-current-buffer-file #'crux-rename-file-and-buffer))) -- cgit 1.4.1 From 088f3423cbd586728551a910979dd130523adbde Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 7 Sep 2017 16:58:20 +0200 Subject: Emacs: Ensure shift keys are not overridden in org-mode --- emacs/.emacs.d/main.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 0f1b353e..56a62755 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1113,10 +1113,10 @@ ;; #+BEGIN_SRC emacs-lisp (use-package windmove - :bind (("S-" . windmove-left) - ("S-" . windmove-right) - ("S-" . windmove-up) - ("S-" . windmove-down))) + :bind* (("S-" . windmove-left) + ("S-" . windmove-right) + ("S-" . windmove-up) + ("S-" . windmove-down))) ;; #+END_SRC ;; ** Blogging @@ -1849,6 +1849,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :defer 8 :defines (org-table-duration-custom-format) :init (setq org-replace-disputed-keys t + org-support-shift-select 'always org-ellipsis "…") :config (progn (setq org-directory "~/Sync/org" -- cgit 1.4.1 From 82eb765f41d41ad5043c05492ca817f76007b5e2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 7 Sep 2017 17:03:13 +0200 Subject: i3: Make bar text clearer --- i3/.config/i3/config | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 39e374af..7a5b8a3f 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -51,14 +51,14 @@ set $Locker i3lock-color # Font for window titles. Will also be used by the bar unless a different font # is used in the bar {} block below. -# font pango:monospace 8 +font pango:Liberation Mono, Font Awesome 11 # This font is widely installed, provides lots of unicode glyphs, right-to-left # text rendering and scalability on retina/hidpi displays (thanks to pango). #font pango:DejaVu Sans Mono 8 # Before i3 v4.8, we used to recommend this one as the default: -font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 +# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 # The font above is very space-efficient, that is, it looks good, sharp and # clear in small sizes. However, its unicode glyph coverage is limited, the old # X core fonts rendering does not support right-to-left and this being a bitmap @@ -214,12 +214,12 @@ bar { colors { background $base00 separator $base03 - statusline $base04 + statusline $base06 # State Border BG Text focused_workspace $base05 $base0D $base00 active_workspace $base05 $base03 $base00 - inactive_workspace $base03 $base01 $base05 + inactive_workspace $base03 $base01 $base07 urgent_workspace $base08 $base08 $base00 binding_mode $base00 $base0A $base00 } -- cgit 1.4.1 From 6c29f358ae100d644318fca9d8a536422c806f70 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 8 Sep 2017 11:47:06 +0200 Subject: Revert "XResources: Remove rxvt-unicode configuration" This reverts commit 6a46db0b3784824437219cce0077ae1b600cb35a. --- xresources/.xresources/main | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/xresources/.xresources/main b/xresources/.xresources/main index 7c84fb86..49ff7423 100644 --- a/xresources/.xresources/main +++ b/xresources/.xresources/main @@ -8,6 +8,26 @@ Emacs.MenuBar: off Emacs.ScrollBars: off Emacs.CursorBlink: off +URxvt.fading: 0 +URxvt.geometry: 100x40 +URxvt.urgentOnBell: true + +URxvt.scrollBar: false +URxvt.scrollstyle: plain +URxvt.scrollTtyOutput: false +URxvt.scrollWithBuffer: true +URxvt.scrollTtyKeypress: true +URxvt.saveLines: 16384 +URxvt.secondaryScroll: false + +URxvt.font: -xos4-terminus-medium-r-normal--14-140-72-72-c-80-*-* +URxvt.boldFont: +URxvt.intensityStyles: true + +URxvt.pointerBlank: true +URxvt.pointerBlankDelay: 987654321 +URxvt.letterSpace: 0 + Emacs.Font: -Misc-Fixed-normal-normal-normal-*-14-*-*-*-c-70-iso10646-1 Emacs.fixed-pitch.attributeFont: -Misc-Fixed-normal-normal-normal-*-14-*-*-*-c-70-iso10646-1 Emacs.variable-pitch.attributeFont: -*-PT Sans-medium-r-*-*-14-*-*-*-*-*-*-* -- cgit 1.4.1 From f9fecd32dfdd8cd4fd5aaf2e322e1d9e7ca8cad6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 8 Sep 2017 11:48:17 +0200 Subject: i3: Remove border from google-chrome --- i3/.config/i3/config | 1 + 1 file changed, 1 insertion(+) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 7a5b8a3f..49a3f7c8 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -237,3 +237,4 @@ client.background $base07 hide_edge_borders both for_window [class="Pinentry$"] floating enable +for_window [class="Google-chrome"] border pixel 1 -- cgit 1.4.1 From b63e78ef7513df0ef510ffd3f86aee8c462eca61 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 8 Sep 2017 21:21:22 +0200 Subject: xprofile: Run autorandr on startup --- xprofile/.xprofile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xprofile/.xprofile b/xprofile/.xprofile index ec47d622..6e20ba91 100755 --- a/xprofile/.xprofile +++ b/xprofile/.xprofile @@ -4,4 +4,8 @@ xmodmap .xmodmaprc gpg-connect-agent /bye xrdb -I$HOME/.xresources .xresources/main nm-applet & +if command -v autorandr +then + autorandr --change --force +fi sxhkd & -- cgit 1.4.1 From 2ed6f273e51d76e15c259b8a866fded2a0d60054 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 8 Sep 2017 21:26:44 +0200 Subject: autorandr: Add initial setup (for satoshipad) --- autorandr/.config/autorandr/docked/config | 22 ++++++++++++++++++++++ autorandr/.config/autorandr/docked/setup | 3 +++ autorandr/.config/autorandr/laptop/config | 15 +++++++++++++++ autorandr/.config/autorandr/laptop/setup | 1 + autorandr/.config/autorandr/postswitch | 12 ++++++++++++ autorandr/.config/autorandr/work-1/config | 17 +++++++++++++++++ autorandr/.config/autorandr/work-1/setup | 2 ++ 7 files changed, 72 insertions(+) create mode 100644 autorandr/.config/autorandr/docked/config create mode 100644 autorandr/.config/autorandr/docked/setup create mode 100644 autorandr/.config/autorandr/laptop/config create mode 100644 autorandr/.config/autorandr/laptop/setup create mode 100755 autorandr/.config/autorandr/postswitch create mode 100644 autorandr/.config/autorandr/work-1/config create mode 100644 autorandr/.config/autorandr/work-1/setup diff --git a/autorandr/.config/autorandr/docked/config b/autorandr/.config/autorandr/docked/config new file mode 100644 index 00000000..7d10c084 --- /dev/null +++ b/autorandr/.config/autorandr/docked/config @@ -0,0 +1,22 @@ +output DP1 +off +output DP2 +off +output DP2-3 +off +output HDMI1 +off +output HDMI2 +off +output VIRTUAL1 +off +output eDP1 +off +output DP2-1 +mode 1920x1200 +pos 0x0 +rate 59.95 +output DP2-2 +mode 1920x1200 +pos 1920x0 +rate 59.95 diff --git a/autorandr/.config/autorandr/docked/setup b/autorandr/.config/autorandr/docked/setup new file mode 100644 index 00000000..4c2599be --- /dev/null +++ b/autorandr/.config/autorandr/docked/setup @@ -0,0 +1,3 @@ +DP2-1 00ffffffffffff0015c33325b1a21403041b0104a5342178fa0495a9554d9d26105054a10800a9408180b300a9c081c0810001010101283c80a070b023403020360007442100001a023a801871382d40582c450007442100001e000000fd003b3d1f4c11000a202020202020000000fc004556323435350a20202020202001cf020312f145900403020123091f0783010000023a801871382d40582c450007442100001e011d007251d01e206e28550007442100001e8f0ad08a20e02d10103e96000744210000188c0ad08a20e02d10103e9600074421000018d50980a020e02d101060a20007442100001800000000000000000000000000000000000000a4 +DP2-2 00ffffffffffff0015c3332569a21603041b0104a5342178fa0495a9554d9d26105054a10800a9408180b300a9c081c0810001010101283c80a070b023403020360007442100001a023a801871382d40582c450007442100001e000000fd003b3d1f4c11000a202020202020000000fc004556323435350a2020202020200115020312f145900403020123091f0783010000023a801871382d40582c450007442100001e011d007251d01e206e28550007442100001e8f0ad08a20e02d10103e96000744210000188c0ad08a20e02d10103e9600074421000018d50980a020e02d101060a20007442100001800000000000000000000000000000000000000a4 +eDP1 00ffffffffffff0006af3d2400000000001a0104951f117802a2b591575894281c505400000001010101010101010101010101010101843a8034713828403064310035ad10000018d02e8034713828403064310035ad10000018000000fe0041554f0a202020202020202020000000fe004231343048414e30322e34200a00e4 diff --git a/autorandr/.config/autorandr/laptop/config b/autorandr/.config/autorandr/laptop/config new file mode 100644 index 00000000..152d1b95 --- /dev/null +++ b/autorandr/.config/autorandr/laptop/config @@ -0,0 +1,15 @@ +output DP1 +off +output DP2 +off +output HDMI1 +off +output HDMI2 +off +output VIRTUAL1 +off +output eDP1 +mode 1920x1080 +pos 0x0 +primary +rate 60.03 diff --git a/autorandr/.config/autorandr/laptop/setup b/autorandr/.config/autorandr/laptop/setup new file mode 100644 index 00000000..dc17ff13 --- /dev/null +++ b/autorandr/.config/autorandr/laptop/setup @@ -0,0 +1 @@ +eDP1 00ffffffffffff0006af3d2400000000001a0104951f117802a2b591575894281c505400000001010101010101010101010101010101843a8034713828403064310035ad10000018d02e8034713828403064310035ad10000018000000fe0041554f0a202020202020202020000000fe004231343048414e30322e34200a00e4 diff --git a/autorandr/.config/autorandr/postswitch b/autorandr/.config/autorandr/postswitch new file mode 100755 index 00000000..c314da31 --- /dev/null +++ b/autorandr/.config/autorandr/postswitch @@ -0,0 +1,12 @@ +#!/bin/sh +DPI=96 +if [ "$1" != "laptop" ] +then + DPI=144 +fi + +xrandr --dpi $DPI +emacsclient -e "(setq display-pixels-per-inch $DPI)" > /dev/null +i3-msg restart +systemctl --user restart redshift + diff --git a/autorandr/.config/autorandr/work-1/config b/autorandr/.config/autorandr/work-1/config new file mode 100644 index 00000000..834278c8 --- /dev/null +++ b/autorandr/.config/autorandr/work-1/config @@ -0,0 +1,17 @@ +output DP1 +off +output DP2 +off +output HDMI1 +off +output VIRTUAL1 +off +output HDMI2 +mode 1920x1200 +pos 0x0 +primary +rate 59.95 +output eDP1 +mode 1920x1080 +pos 1920x0 +rate 60.03 diff --git a/autorandr/.config/autorandr/work-1/setup b/autorandr/.config/autorandr/work-1/setup new file mode 100644 index 00000000..12a4c698 --- /dev/null +++ b/autorandr/.config/autorandr/work-1/setup @@ -0,0 +1,2 @@ +HDMI2 00ffffffffffff0015c33425b1a21403041b010380342178ea0495a9554d9d26105054a10800a9408180b300a9c081c0810001010101283c80a070b023403020360007442100001a023a801871382d40582c450007442100001e000000fd00313d0f4c11000a202020202020000000fc004556323435350a202020202020011e020325f14e901f051404130312021107160615230907078301000066030c00100080e2007b011d8018711c1620582c250007442100009e011d80d0721c1620102c258007442100009e8c0ad08a20e02d10103e96000744210000188c0ad090204031200c4055000744210000180000000000000000000000000000000000008e +eDP1 00ffffffffffff0006af3d2400000000001a0104951f117802a2b591575894281c505400000001010101010101010101010101010101843a8034713828403064310035ad10000018d02e8034713828403064310035ad10000018000000fe0041554f0a202020202020202020000000fe004231343048414e30322e34200a00e4 -- cgit 1.4.1 From ed85cf6783ab1437bae76bce3b0951622b4d4974 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 8 Sep 2017 21:27:01 +0200 Subject: i3: change font size to follow DPI --- i3/.config/i3/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 49a3f7c8..67fbacab 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -51,7 +51,7 @@ set $Locker i3lock-color # Font for window titles. Will also be used by the bar unless a different font # is used in the bar {} block below. -font pango:Liberation Mono, Font Awesome 11 +font pango:Liberation Mono, Font Awesome 9 # This font is widely installed, provides lots of unicode glyphs, right-to-left # text rendering and scalability on retina/hidpi displays (thanks to pango). -- cgit 1.4.1 From 442bdb09581afa08d86485fffebc67e7b74e543b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 8 Sep 2017 21:30:10 +0200 Subject: xresources: Use system-wide default fonts for uxrvt --- xresources/.xresources/main | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xresources/.xresources/main b/xresources/.xresources/main index 49ff7423..43f8538e 100644 --- a/xresources/.xresources/main +++ b/xresources/.xresources/main @@ -20,8 +20,8 @@ URxvt.scrollTtyKeypress: true URxvt.saveLines: 16384 URxvt.secondaryScroll: false -URxvt.font: -xos4-terminus-medium-r-normal--14-140-72-72-c-80-*-* -URxvt.boldFont: +URxvt.font: xft:monospace:size=10 +URxvt.boldFont: xft:monospace:bold:size=10 URxvt.intensityStyles: true URxvt.pointerBlank: true -- cgit 1.4.1 From 2ccb787b935ed50590cb6889f8daf0b1a87d07b2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 8 Sep 2017 21:31:12 +0200 Subject: i3: Set urxvt as terminal --- i3/.config/i3/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 67fbacab..96765298 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -68,7 +68,7 @@ font pango:Liberation Mono, Font Awesome 9 floating_modifier $mod # start a terminal -bindsym $mod+Return exec --no-startup-id st +bindsym $mod+Return exec --no-startup-id urxvt # kill focused window bindsym $mod+Shift+w kill -- cgit 1.4.1 From 31316b5b98a37b31508e9e4e4af409c2ad60ae95 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 8 Sep 2017 21:43:18 +0200 Subject: xresources: Add compile-command for emacs --- xresources/.xresources/main | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xresources/.xresources/main b/xresources/.xresources/main index 43f8538e..f8a72693 100644 --- a/xresources/.xresources/main +++ b/xresources/.xresources/main @@ -31,3 +31,7 @@ URxvt.letterSpace: 0 Emacs.Font: -Misc-Fixed-normal-normal-normal-*-14-*-*-*-c-70-iso10646-1 Emacs.fixed-pitch.attributeFont: -Misc-Fixed-normal-normal-normal-*-14-*-*-*-c-70-iso10646-1 Emacs.variable-pitch.attributeFont: -*-PT Sans-medium-r-*-*-14-*-*-*-*-*-*-* + +! Local Variables: +! compile-command: (concat "xrdb -merge " (shell-quote-argument buffer-file-name)) +! End: -- cgit 1.4.1 From b8e3ec3e8314eafc35f825cd79f59fa1b072d1cb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 8 Sep 2017 21:45:07 +0200 Subject: yarn+npm: login --- javascript/.npmrc | 4 +++- yarn/.yarnrc | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/javascript/.npmrc b/javascript/.npmrc index 6804f657..ab499739 100644 --- a/javascript/.npmrc +++ b/javascript/.npmrc @@ -1 +1,3 @@ -prefix = ${HOME}/.local/ \ No newline at end of file +prefix=$HOME/.local +//registry.npmjs.org/:_authToken=$NPM_TOKEN +@satoshipay:registry=http://registry.npmjs.org/ diff --git a/yarn/.yarnrc b/yarn/.yarnrc index 95e833e4..57a49c81 100644 --- a/yarn/.yarnrc +++ b/yarn/.yarnrc @@ -1,2 +1,8 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + disable-self-update-check true +email alan@alanpearce.eu +username alanpearce yarn-offline-mirror-pruning true -- cgit 1.4.1 From 6aa8ab5de3bb204b807348f192e3cbdd7311a656 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 8 Sep 2017 23:08:35 +0200 Subject: Emacs: reformat to outshine style --- emacs/.emacs.d/main.el | 298 ++++++++++++++++++++++++------------------------- 1 file changed, 149 insertions(+), 149 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 56a62755..ea2712ea 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -7,8 +7,8 @@ ;;; Header: ;; This is a living document, detailing my Emacs configuration using org-mode ;;; Code: -;; ** Basics -;; *** Startup +;;;;; Basics +;;;;;; Startup ;; Open Emacs with just a plain window. No graphics or messages, please! ;; #+BEGIN_SRC emacs-lisp (setq inhibit-startup-screen t) @@ -30,7 +30,7 @@ (setq system-type 'gnu/linux/windows)))) ;; #+END_SRC -;; *** Compatibility +;;;;;; Compatibility ;; #+BEGIN_SRC emacs-lisp (if (version< emacs-version "25.0") @@ -38,7 +38,7 @@ `(eval-after-load ,file (lambda () ,@body)))) ;; #+END_SRC -;; *** Scratch buffers +;;;;;; Scratch buffers ;; I usually use scratch buffers for any sort of text. If I need a ;; programming mode in one, then I’ll just call it manually. I also like ;; the buffer to be empty. @@ -47,15 +47,15 @@ initial-major-mode 'text-mode) ;; #+END_SRC -;; *** Personal Information +;;;;;; Personal Information ;; #+BEGIN_SRC emacs-lisp (setq user-mail-address "alan@alanpearce.eu" user-full-name "Alan Pearce") ;; #+end_src -;; ** Packaging +;;;;; Packaging -;; *** Use-package +;;;;;; Use-package ;; #+BEGIN_SRC emacs-lisp (eval-and-compile @@ -101,9 +101,9 @@ package-enable-at-startup nil) ;; #+END_SRC -;; *** Helpers +;;;;;; Helpers -;; **** Hook Helpers +;;;;;;; Hook Helpers ;; An improvement over add-hook with lamda functions that allows ;; modification and removal, without the boilerplate of an extra function @@ -114,7 +114,7 @@ (use-package hook-helpers)) ;; #+END_SRC -;; ** Customize +;;;;; Customize ;; I don’t really like using customize for normal configuration. ;; Instead, I use it for things that get saved automatically. That’s why ;; I use a different file, which is ignored by the VCS. It also means @@ -126,7 +126,7 @@ (load custom-file :noerror :nomessage) ;; #+END_SRC -;; ** Styles +;;;;; Styles ;; I prefer an always-visible cursor. Feels less distracting. ;; #+BEGIN_SRC emacs-lisp @@ -156,7 +156,7 @@ (ding)))) ;; #+END_SRC -;; *** Colours +;;;;;; Colours ;; White-theme. Sounds like a good idea. @@ -181,7 +181,7 @@ :diminish highlight-stages-mode) ;; #+END_SRC -;; *** Fonts +;;;;;; Fonts ;; 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]]. @@ -247,7 +247,7 @@ (global-prettify-symbols-mode +1)) ;; #+END_SRC -;; *** Page Breaks +;;;;;; Page Breaks ;; By default, Emacs displays page breaks as ^L. Lines look much nicer. ;; On Windows, Emacs incorrectly detects that U+2500 (Box Drawings Light @@ -265,7 +265,7 @@ (cons page-break-lines-char page-break-lines-char) (face-attribute 'default :family))))) ;; #+END_SRC -;; *** Modeline +;;;;;; Modeline ;; #+BEGIN_SRC emacs-lisp (column-number-mode -1) @@ -295,7 +295,7 @@ '(dired-directory (" — " dired-directory)))) ;; #+END_SRC -;; *** Chrome +;;;;;; Chrome ;; Sometimes I like to hide clutter. Other times, it's useful. @@ -353,7 +353,7 @@ (add-hook 'minibuffer-exit-hook #'hide-mode-line) ;; #+END_SRC -;; *** Highlight Changes +;;;;;; Highlight Changes ;; Highlight what just changed when I undo, yank, and so on. @@ -364,7 +364,7 @@ (volatile-highlights-mode t))) ;; #+END_SRC -;; *** Beacon +;;;;;; Beacon ;; I was against the idea of having flashy animations inside Emacs, but ;; this one is useful. It highlights the cursor when scrolling or @@ -381,7 +381,7 @@ beacon-color "#a1b56c"))) ;; #+END_SRC -;; *** Renaming major modes +;;;;;; Renaming major modes ;; Diminishing major modes does not happen in the same manner as minor ;; modes. @@ -406,7 +406,7 @@ ;; #+END_SRC -;; ** Environment Variables +;;;;; Environment Variables ;; MacOS doesn’t have a reasonable way to set environment variables and ;; read them automatically any more. So, let’s use the @@ -427,7 +427,7 @@ (exec-path-from-shell-initialize))) ;; #+END_SRC -;; *** NixOS sandboxes +;;;;;; NixOS sandboxes ;; I'm currently exploring using nix to create sandboxes for ;; development. This package allows using tools from inside sandboxes, @@ -451,7 +451,7 @@ (executable-find cmd))))))) ;; #+END_SRC -;; ** Keybindings +;;;;; Keybindings ;; I think =set-keyboard-coding-system= stops OS X from doing something ;; annoying to add accents. The modifier setup is to match my @@ -505,7 +505,7 @@ (set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) ;; #+END_SRC -;; *** Crux +;;;;;; Crux ;; I can replace most of the simple helper/wrapper functions in my ;; configuration with crux.el @@ -524,7 +524,7 @@ (defalias 'rename-current-buffer-file #'crux-rename-file-and-buffer))) ;; #+END_SRC -;; ** Projects +;;;;; Projects ;; #+BEGIN_SRC emacs-lisp (defun switch-to-dotfiles () @@ -533,7 +533,7 @@ (projectile-switch-project-by-name (car (split-string (shell-command-to-string "ghq list --full-path dotfiles"))))) ;; #+END_SRC -;; *** The Silver Searcher +;;;;;; The Silver Searcher ;; #+BEGIN_SRC emacs-lisp (use-package ag @@ -544,7 +544,7 @@ :after ag) ;; #+END_SRC -;; *** Ripgrep +;;;;;; Ripgrep ;; Step over Silver Search, here comes a new challenger. @@ -558,7 +558,7 @@ :bind (("C-c p s r" . projectile-ripgrep))) ;; #+END_SRC -;; *** Projectile +;;;;;; Projectile ;; Projectile is awesome for working in projects, especially VCS-backed ;; ones. @@ -634,7 +634,7 @@ (define-key projectile-mode-map [remap counsel-projectile-ag] #'counsel-projectile-rg))) ;; #+END_SRC -;; *** vc +;;;;;; vc ;; This is nice for some things that magit doesn’t do, and for those rare ;; occasions that I’m working with something other than git. @@ -650,7 +650,7 @@ tramp-file-name-regexp)))) ;; #+END_SRC -;; *** git-gutter-fringe +;;;;;; git-gutter-fringe ;; It’s nice to be able to see at a glance which lines of a file have ;; changed. This package colours the fringe. I have it set to the right @@ -678,7 +678,7 @@ (setq git-gutter-fr:side 'right-fringe))) ;; #+END_SRC -;; *** magit +;;;;;; magit ;; Magit is my favourite way to use git. I use selective staging all the ;; time. Make sure to set it up with a nice =completing-read-function= @@ -695,7 +695,7 @@ :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) ;; #+END_SRC -;; *** git-messenger +;;;;;; git-messenger ;; Popup the last commit that changed the line at point. @@ -706,7 +706,7 @@ (setq git-messenger:use-magit-popup t))) ;; #+END_SRC -;; *** git-timemachine +;;;;;; git-timemachine ;; This package allow me to go through a file’s history with just a few ;; keys. It makes it very easy to figure what what exactly was in a file @@ -718,7 +718,7 @@ :commands git-timemachine) ;; #+END_SRC -;; *** ghq +;;;;;; ghq ;; [[https://github.com/motemen/ghq][=ghq=]] clones VCS-backed projects to a common directory. It should ;; seem familiar to anyone who's used =go get= before. [[https://github.com/rcoedo/emacs-ghq][=emacs-ghq=]] is a @@ -729,9 +729,9 @@ :if (executable-find "ghq")) ;; #+END_SRC -;; ** Files +;;;;; Files -;; *** Auto-saving +;;;;;; Auto-saving ;; Auto-save everything to a temporary directory, instead of cluttering ;; the filesystem. I don’t want emacs-specific lockfiles, either. @@ -740,7 +740,7 @@ (setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t)) create-lockfiles nil) ;; #+END_SRC -;; *** Backups +;;;;;; Backups ;; I like to keep my backups out of regular folders. I tell emacs to use ;; a subfolder of its configuration directory for that. Also, use the @@ -761,7 +761,7 @@ file)))) ;; #+END_SRC -;; *** autorevert +;;;;;; autorevert ;; #+BEGIN_SRC emacs-lisp (use-package autorevert @@ -772,7 +772,7 @@ auto-revert-use-notify (not (eq system-type 'darwin))))) ;; #+END_SRC -;; *** Encoding +;;;;;; Encoding ;; UTF-8 is usually appropriate. Note that =prefer-coding-system= expects ;; only a coding system, not a coding system and line ending combination. @@ -782,7 +782,7 @@ (setq-default buffer-file-coding-system 'utf-8-auto-unix) ;; #+END_SRC -;; *** Buffer-file management +;;;;;; Buffer-file management ;; Ask if I want to create a directory when it doesn’t exist. This is ;; especially nice when starting new projects. @@ -814,7 +814,7 @@ (kill-buffer buf))))) ;; #+END_SRC -;; *** Whitespace +;;;;;; Whitespace ;; Show bad whitespace, so that I can fix it. @@ -831,7 +831,7 @@ (add-hook 'text-mode-hook #'show-trailing-whitespace-on) ;; #+END_SRC -;; *** shrink-whitespace +;;;;;; shrink-whitespace ;; DWIM whitespace removal. So I don’t need =M-SPC=, =M-\= and =C-x o= ;; for similar things any more. @@ -841,7 +841,7 @@ :bind ("M-SPC" . shrink-whitespace)) ;; #+END_SRC -;; *** Tramp +;;;;;; Tramp ;; Tramp is awesome. It makes SSH feel Unix-y. The proxy setup is so ;; that I can sudo on remote machines @@ -868,7 +868,7 @@ (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil)))) ;; #+END_SRC -;; *** ediff +;;;;;; ediff ;; I like a horizonal diff setup, with everything in one frame. @@ -880,7 +880,7 @@ ediff-window-setup-function 'ediff-setup-windows-plain))) ;; #+END_SRC -;; ** Indentation +;;;;; Indentation ;; Ah, a complicated topic. One day we’ll all be using elastic ;; tabstops. I’ve recently switched to using two spaces, since elastic @@ -893,7 +893,7 @@ ;; #+END_SRC -;; *** smart-tabs-mode +;;;;;; smart-tabs-mode ;; Not related to [[smart-tab][=smart-tab=]], this mode indents with tabs and aligns ;; with spaces. Perfect! @@ -907,7 +907,7 @@ (smart-tabs-mode indent-tabs-mode)))) ;; #+END_SRC -;; *** editorconfig +;;;;;; editorconfig ;; #+BEGIN_SRC emacs-lisp (use-package editorconfig @@ -915,7 +915,7 @@ :config (editorconfig-mode 1)) ;; #+END_SRC -;; *** dtrt-indent-mode +;;;;;; dtrt-indent-mode ;; Sometimes people use different indentation settings. [[https://github.com/jscheid/dtrt-indent][dtrt-indent]] ;; guesses the correct settings for me. @@ -931,9 +931,9 @@ (smart-tabs-mode (or indent-tabs-mode -1))))) ;; #+END_SRC -;; ** Security +;;;;; Security -;; *** password-store +;;;;;; password-store ;; This is a frontend to the GPG-powered =pass= program. ;; #+BEGIN_SRC emacs-lisp @@ -942,9 +942,9 @@ :config (progn (setq password-store-password-length 16))) ;; #+END_SRC -;; ** Buffers +;;;;; Buffers -;; *** Ibuffer +;;;;;; Ibuffer ;; Ibuffer is quite nice for listing all buffers. ;; #+BEGIN_SRC emacs-lisp @@ -980,7 +980,7 @@ filename-and-process))))) ;; #+END_SRC -;; *** Relative Buffer names +;;;;;; Relative Buffer names ;; #+BEGIN_SRC emacs-lisp (use-package relative-buffers @@ -988,7 +988,7 @@ :config (progn (global-relative-buffers-mode))) ;; #+END_SRC -;; *** Narrowing +;;;;;; Narrowing ;; Enable it without prompting @@ -998,7 +998,7 @@ (put 'narrow-to-region 'disabled nil) ;; #+END_SRC -;; *** ace-window +;;;;;; ace-window ;; I don’t often have many windows open at once, but when I do, ;; =ace-window= is really nice to jump around them in the same way that @@ -1021,7 +1021,7 @@ aw-keys '(?a ?r ?s ?t ?n ?e ?i ?o)))) ;; #+END_SRC -;; ** Windows +;;;;; Windows ;; Scrolling is tricky. I use this setup to help me keep track of the ;; point whilst I’m moving about. @@ -1038,7 +1038,7 @@ (setq ns-pop-up-frames nil)) ;; #+END_SRC -;; *** eyebrowse +;;;;;; eyebrowse ;; Workspaces, a bit like dwm. On Windows and Linux (at least the WMs ;; I'm likely to use), super+{0-9} are taken from the OS, so use meta @@ -1075,9 +1075,9 @@ (eyebrowse-mode +1))) ;; #+END_SRC -;; ** Sessions +;;;;; Sessions -;; *** Desktop +;;;;;; Desktop ;; Save my Emacs session and restore it on startup. ;; #+BEGIN_SRC emacs-lisp @@ -1096,7 +1096,7 @@ (desktop-save-mode 1))) ;; #+END_SRC -;; *** winner +;;;;;; winner ;; Undo, for window-based commands. @@ -1107,7 +1107,7 @@ (winner-mode 1))) ;; #+END_SRC -;; *** windmove +;;;;;; windmove ;; Directional window movement @@ -1118,7 +1118,7 @@ ("S-" . windmove-up) ("S-" . windmove-down))) ;; #+END_SRC -;; ** Blogging +;;;;; Blogging ;; I have a [[https://alanpearce.uk][blog]] that I publish with hugo. @@ -1129,7 +1129,7 @@ easy-hugo-default-ext ".md")) ;; #+END_SRC -;; ** Completion +;;;;; Completion ;; Make built-in completion a bit more intelligent, by adding substring ;; and initial-based completion and ignoring case. @@ -1140,7 +1140,7 @@ tab-always-indent 'complete) ;; #+END_SRC -;; *** Company +;;;;;; Company ;; The main choices for automatic completion in Emacs are company and ;; auto-complete-mode. I’ve not tried auto-complete-mode as company @@ -1176,7 +1176,7 @@ ;;; ** Dates & Times -;; *** Calendar +;;;;;; Calendar ;; Weeks start on Monday for me and I prefer ISO-style dates. ;; #+BEGIN_SRC emacs-lisp @@ -1215,7 +1215,7 @@ With two prefix arguments, write out the day and month name." (timer-relative-time (current-time) -86400)) ;; #+END_SRC -;; ** Directories +;;;;; Directories ;; Dired works quite nicely, but not always in the way I want. I don’t ;; like having so many prompts for recursive operations. Also, when I @@ -1282,7 +1282,7 @@ With two prefix arguments, write out the day and month name." (bind-key "i" #'dired-subtree-toggle dired-mode-map)))) ;; #+END_SRC -;; *** Disk usage +;;;;;; Disk usage ;; Combine dired and du (disk usage). @@ -1293,7 +1293,7 @@ With two prefix arguments, write out the day and month name." (setq dired-du-size-format t))) ;; #+END_SRC -;; *** Dired-narrow +;;;;;; Dired-narrow ;; One can already use dired with wildcards to browse a filtered ;; directory listing, but it opens a new buffer. Dired-narrow is a ;; slightly nicer interface: with a currently-open dired buffer, use =/= @@ -1307,15 +1307,15 @@ With two prefix arguments, write out the day and month name." ("/" . dired-narrow)))) ;; #+END_SRC -;; ** Documentation +;;;;; Documentation -;; *** helpful +;;;;;; helpful ;; #+BEGIN_SRC emacs-lisp (use-package helpful) ;; #+END_SRC -;; *** ehelp +;;;;;; ehelp ;; ehelp is a less well-known package that’s part of Emacs and slightly ;; improves the normal help commands, mostly by making quitting them easier. @@ -1325,7 +1325,7 @@ With two prefix arguments, write out the day and month name." :bind-keymap ("C-h" . ehelp-map)) ;; #+END_SRC -;; *** discover-my-major +;;;;;; discover-my-major ;; A nicer way to browse keybindings for major modes. @@ -1334,7 +1334,7 @@ With two prefix arguments, write out the day and month name." :bind ("" . discover-my-major)) ;; #+END_SRC -;; *** which-key +;;;;;; which-key ;; Popup keybindings following a prefix automatically. @@ -1346,7 +1346,7 @@ With two prefix arguments, write out the day and month name." (which-key-setup-side-window-right-bottom))) ;; #+END_SRC -;; *** eldoc +;;;;;; eldoc ;; Documentation in the echo-area (where the minibuffer is displayed) is ;; rather useful. @@ -1359,9 +1359,9 @@ With two prefix arguments, write out the day and month name." (setq eldoc-idle-delay 0.1) (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) ;; #+END_SRC -;; ** Mail +;;;;; Mail -;; *** Basics +;;;;;; Basics ;; #+BEGIN_SRC emacs-lisp (with-eval-after-load "mailcap" @@ -1376,7 +1376,7 @@ With two prefix arguments, write out the day and month name." (setq mml-secure-openpgp-encrypt-to-self t)) ;; #+END_SRC -;; *** mu +;;;;;; mu ;; #+BEGIN_SRC emacs-lisp (when (executable-find "mu") @@ -1465,7 +1465,7 @@ With two prefix arguments, write out the day and month name." (local-set-key (kbd "") 'shr-previous-link))))) ;; #+END_SRC -;; ** Misc +;;;;; Misc ;; #+BEGIN_SRC emacs-lisp (defvar *init-file* @@ -1517,7 +1517,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (bind-key* "C-x r M-w" #'copy-rectangle) ;; #+END_SRC -;; *** Auxillary Configuration +;;;;;; Auxillary Configuration ;; #+BEGIN_SRC emacs-lisp (require 'pinentry) @@ -1580,7 +1580,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'first-frame-hook #'load-private-data) ;; #+END_SRC -;; ** Minibuffer +;;;;; Minibuffer ;; Sometimes I want to use the minibuffer, but I’m already inside it. ;; Fortunately, this is possible. Of course, I need to know how many @@ -1604,7 +1604,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (defalias 'exit-emacs #'save-buffers-kill-emacs)) ;; #+END_SRC -;; *** swiper/ivy +;;;;;; swiper/ivy ;; Ivy is the new kid on the completion block. It seems to be a strong ;; replacement for helm so far. @@ -1627,7 +1627,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-to-list 'ivy-initial-inputs-alist '(counsel-M-x . "")))) ;; #+END_SRC -;; *** counsel +;;;;;; counsel ;; #+BEGIN_SRC emacs-lisp (use-package counsel @@ -1650,7 +1650,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; #+END_SRC -;; *** smex +;;;;;; smex ;; Smex is my favourite way to use =M-x=. Counsel’s =counsel-M-x= ;; function uses it internally, so I’m keeping it around, even though I @@ -1675,7 +1675,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." "smex-items")))) ;; #+END_SRC -;; *** cmd-to-echo +;;;;;; cmd-to-echo ;; I’ve been looking for some way to run programming projects (mostly ;; node.js) inside emacs. =cmd-to-echo= seems great for this, as new @@ -1686,7 +1686,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :commands (cmd-to-echo) :config (setq cmd-to-echo-add-output-to-process-buffers t)) ;; #+END_SRC -;; ** Modes +;;;;; Modes ;; Setup some modes for systemd files ;; #+BEGIN_SRC emacs-lisp @@ -1755,7 +1755,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-to-list 'auto-mode-alist '("\\.sls\\'" . saltstack-mode)) ;; #+END_SRC -;; *** ledger +;;;;;; ledger ;; I use [[http://ledger-cli.org/][=ledger=]] to manage my finances. It has an Emacs mode, which ;; works really nicely. @@ -1798,7 +1798,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ("account" "ledger -f %(ledger-file) reg %(account)"))))) ;; #+END_SRC -;; *** Beancount +;;;;;; Beancount ;; #+BEGIN_SRC emacs-lisp (let ((beancount-dir (car (split-string (shell-command-to-string "ghq list --full-path beancount"))))) @@ -1810,7 +1810,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :config (setq beancount-use-ido nil)))) ;; #+END_SRC -;; *** Markdown +;;;;;; Markdown ;; #+BEGIN_SRC emacs-lisp (use-package markdown-mode @@ -1819,7 +1819,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) ;; #+END_SRC -;; *** Outshine +;;;;;; Outshine ;; Org-ified source code. I think this might work better than ;; lentic-mode, whilst also being more general. @@ -1837,7 +1837,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'sh-mode-hook #'outline-minor-mode))) ;; #+END_SRC -;; *** Org +;;;;;; Org ;; Org is wünderbar. @@ -1897,7 +1897,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (bind-key "C-x C-s" #'org-edit-src-exit org-src-mode-map))) ;; #+END_SRC -;; ***** org-babel +;;;;;;;* org-babel ;; Org’s babel feature is really nice. I use it for this file, and I can ;; use it to communicate between programming languages. Sometime I hope @@ -1917,7 +1917,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." org-src-preserve-indentation t))) ;; #+END_SRC -;; ***** org-journal +;;;;;;;* org-journal ;; I can use this to keep a journal. I should use it. @@ -1943,8 +1943,8 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; #+END_SRC -;; ** Programming -;; *** flycheck +;;;;; Programming +;;;;;; flycheck ;; On-the-fly error checking in programming modes? Yes please. @@ -1963,7 +1963,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (setq flycheck-javascript-eslint-executable "eslint_d")))) ;; #+END_SRC -;; **** flycheck-pos-tip +;;;;;;; flycheck-pos-tip ;; Show flycheck errors in a little popup, so I don't lose my place @@ -1975,7 +1975,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (flycheck-pos-tip-mode 1))) ;; #+END_SRC -;; **** flycheck-flow +;;;;;;; flycheck-flow ;; #+BEGIN_SRC emacs-lisp (use-package flycheck-flow @@ -1985,7 +1985,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (flycheck-add-next-checker 'javascript-eslint 'javascript-flow))) ;; #+END_SRC -;; *** golang +;;;;;; golang ;; Go has a few packages to inter-operate with other emacs packages. @@ -2012,7 +2012,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; #+END_SRC -;; *** ggtags +;;;;;; ggtags ;; A nice completion backend for programming modes. @@ -2030,7 +2030,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'c-mode-common-hook #'turn-on-ggtags-mode))) ;; #+END_SRC -;; *** dumb-jump +;;;;;; dumb-jump ;; A "clever" way of implementing go-to-definition across languages: use ;; a project-wide text search and apply heuristics to the results to @@ -2045,7 +2045,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :config (setq dumb-jump-selector 'ivy)) ;; #+END_SRC -;; *** imenu-anywhere +;;;;;; imenu-anywhere ;; This is like imenu, but shows functions (or similar top-level ;; entities) across buffers in the same project. Neat! @@ -2054,9 +2054,9 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (use-package imenu-anywhere :bind ("C-x C-." . ivy-imenu-anywhere)) ;; #+END_SRC -;; *** Lisps +;;;;;; Lisps -;; **** All +;;;;;;; All ;; Lisp modes don’t seem to have a common ancestor. So I made a custom ;; hook which I trigger in every lispy-mode. @@ -2075,7 +2075,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (run-hooks 'lisp-mode-common-hook)) ;; #+END_SRC -;; ***** Redshank +;;;;;;;* Redshank ;; Lisp syntax allows for really easy refactoring. Redshank gives some ;; operations that aren’t part of paredit, like extracting variables into @@ -2088,7 +2088,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'lisp-mode-common-hook #'turn-on-redshank-mode))) ;; #+END_SRC -;; **** Emacs Lisp +;;;;;;; Emacs Lisp ;; Customise the modeline-display of =emacs-lisp-mode=. Then make sure ;; it runs the common lisp hooks. @@ -2118,7 +2118,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (run-hooks 'lisp-mode-common-hook)))) ;; #+END_SRC -;; **** Scheme & Lisp +;;;;;;; Scheme & Lisp ;; I don’t work with these as often as I would like @@ -2128,7 +2128,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." #'common-lisp-indent-function)) ;; #+END_SRC -;; ***** geiser +;;;;;;;* geiser ;; A REPL thing for Scheme. Hopefully I’ll get to use it more in the ;; future. @@ -2141,7 +2141,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." run-racket)) ;; #+END_SRC -;; ***** slime +;;;;;;;* slime ;; A REPL thing (and more) for Lisp. @@ -2158,7 +2158,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (executable-find "ccl64"))))) ;; #+END_SRC -;; **** Clojure +;;;;;;; Clojure ;; #+BEGIN_SRC emacs-lisp (use-package clojure-mode @@ -2177,7 +2177,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (clj-refactor-mode 1)))) ;; #+END_SRC -;; ***** cider +;;;;;;;* cider ;; A REPL thing for Clojure @@ -2190,7 +2190,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'cider-mode-hook #'eldoc-mode))) ;; #+END_SRC -;; *** Auto-compile +;;;;;; Auto-compile ;; Auto-compile emacs lisp when saving. ;; #+BEGIN_SRC emacs-lisp @@ -2199,7 +2199,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) ;; #+END_SRC -;; *** cc-mode +;;;;;; cc-mode ;; Although I don’t use C or C++, setting up the mode is helpful because ;; quite a few other modes are derived from it. @@ -2215,7 +2215,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (c-set-offset 'case-label '+))) ;; #+END_SRC -;; *** quickrun +;;;;;; quickrun ;; It’s nice to be able to quickly evaluate some code. Although I don’t ;; really seem to use it. @@ -2224,7 +2224,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :bind (("C-c C-e" . quickrun))) ;; #+END_SRC -;; *** Scala +;;;;;; Scala ;; Let’s try using Scala. @@ -2238,9 +2238,9 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (use-package ensime) ;; #+END_SRC -;; *** Web development +;;;;;; Web development -;; **** js2-mode +;;;;;;; js2-mode ;; This mode is really great for editing Javascript. It turns code into ;; an AST internally, so it can work with it almost like a lisp. @@ -2266,7 +2266,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." js2-strict-missing-semi-warning nil))) ;; #+END_SRC -;; ***** rjsx-mode +;;;;;;;* rjsx-mode ;; A set of advice for js2-jsx-mode to work better with React. @@ -2277,7 +2277,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :mode (("\\.jsx\\'" . rjsx-mode))) ;; #+END_SRC -;; ***** js2-refactor +;;;;;;;* js2-refactor ;; Thanks to the AST provided by js2-mode, refactoring is possible. This ;; library implements some refactorings. @@ -2291,7 +2291,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (js2r-add-keybindings-with-prefix "C-c C-m"))) ;; #+END_SRC -;; ***** add-node-modules-path +;;;;;;;* add-node-modules-path ;; Inside a javascript project, it's common to install tools locally to ;; the project. This will allows emacs to find their executables. @@ -2307,7 +2307,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (setq flycheck-javascript-standard-executable "standard"))))) ;; #+END_SRC -;; ***** Flow +;;;;;;;* Flow ;; #+BEGIN_SRC emacs-lisp (use-package flow-minor-mode @@ -2316,7 +2316,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'js2-mode-hook #'flow-minor-enable-automatically))) ;; #+END_SRC -;; ***** Indium +;;;;;;;* Indium ;; Javascript with an inferior node.js process and a debugger? Awesome. @@ -2341,7 +2341,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'js2-mode-hook #'indium-interaction-mode))) ;; #+END_SRC -;; **** tern +;;;;;;; tern ;; Tern understands javascript. It adds really clever documented ;; completions, besides other IDE-like things. @@ -2362,7 +2362,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (use-package company-tern)) ;; #+END_SRC -;; **** json-mode +;;;;;;; json-mode ;; #+BEGIN_SRC emacs-lisp (use-package json-mode @@ -2372,7 +2372,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ("\\.tern-project\\'" . json-mode))) ;; #+END_SRC -;; **** restclient +;;;;;;; restclient ;; Restclient is really nice. It’s like a scratchpad for HTTP api ;; calls. Feels a bit like using =org-babel=. I wonder if there’s an @@ -2393,7 +2393,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :init (add-to-list 'company-backends #'company-restclient t)) ;; #+END_SRC -;; **** sgml-mode +;;;;;;; sgml-mode ;; This is for HTML, since old versions of HTML were derived from SGML. ;; #+BEGIN_SRC emacs-lisp @@ -2402,7 +2402,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :config (setq sgml-basic-offset 2)) ;; #+END_SRC -;; **** emmet-mode +;;;;;;; emmet-mode ;; Emmet is really nice to write HTML quickly. Especially with ;; frameworks that require multiple nested elements to do anything useful. @@ -2418,7 +2418,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'css-mode-hook #'emmet-mode))) ;; #+END_SRC -;; **** web-mode +;;;;;;; web-mode ;; This mode handles just about every templating language out ther, which ;; is really nice, because it handles the HTML part the same way in all @@ -2443,7 +2443,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (sp-local-pair '(web-mode) "<%" "%>"))) ;; #+END_SRC -;; *** Live coding +;;;;;; Live coding ;; Sometimes I might want to show off my emacs usage. @@ -2461,7 +2461,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (global-command-log-mode -1)) ;; #+END_SRC -;; **** command-log-mode +;;;;;;; command-log-mode ;; #+BEGIN_SRC emacs-lisp (use-package command-log-mode @@ -2472,7 +2472,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." command-log-mode-is-global t))) ;; #+END_SRC -;; ** Spelling +;;;;; Spelling ;; #+BEGIN_SRC emacs-lisp (use-package ispell @@ -2490,7 +2490,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; #+BEGIN_SRC emacs-lisp (use-package flyspell - :diminish "﹏" + :diminish " ﹏" :config (progn (defun flyspell-detect-ispell-args (&optional run-together) "If RUN-TOGETHER is true, spell check the CamelCase words. @@ -2536,7 +2536,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'prog-mode-hook #'flyspell-prog-mode))) ;; #+END_SRC -;; *** Style checking +;;;;;; Style checking ;; [[https://github.com/ValeLint/vale][Vale]] is a linter, but for prose. Neat idea! Salesman is a bad term. @@ -2549,7 +2549,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (flycheck-vale-setup))) ;; #+END_SRC -;; ** Scripting +;;;;; Scripting ;; Make a shell-script buffer executable after saving it, if it has a shebang. @@ -2570,7 +2570,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) ;; #+END_SRC -;; *** eshell +;;;;;; eshell ;; I should try to get into the habit of using this more. It’s really ;; nice, when I remember to use it. @@ -2613,7 +2613,7 @@ Pass optional ARG to `eshell' (which see)." ;; #+END_SRC -;; **** Shells +;;;;;;; Shells ;; #+BEGIN_SRC emacs-lisp (use-package shell @@ -2636,7 +2636,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (comint-delchar-or-maybe-eof arg))) ;; #+END_SRC -;; ** Text editing +;;;;; Text editing ;; Emacs has an editor within. @@ -2648,7 +2648,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (setq-default truncate-lines t) ;; #+END_SRC -;; *** align +;;;;;; align ;; =Align= is a useful command to line things up, once given some rules. ;; The most important one for me is JSON property alignment. @@ -2664,7 +2664,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (modes . '(js2-mode)))))) ;; #+END_SRC -;; *** Clipboard +;;;;;; Clipboard ;; I like to use the clipboard more than the primary selection in X11. @@ -2677,7 +2677,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))) ;; #+END_SRC -;; *** Selection +;;;;;; Selection ;; I’m quite used to deleting text by selecting it and typing. Emacs has ;; a mode for that. @@ -2714,7 +2714,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." :config (setq expand-region-fast-keys-enabled nil)) ;; #+END_SRC -;; *** avy +;;;;;; avy ;; Avy is a really nice way to move around files, like ace-jump-mode, but ;; somehow I prefer it. @@ -2733,7 +2733,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." avy-keys '(?a ?r ?s ?t ?d ?h ?n ?e ?i ?\;)))) ;; #+END_SRC -;; **** ace-link +;;;;;;; ace-link ;; Visit any link. Despite the name, this works with avy. @@ -2744,7 +2744,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (ace-link-setup-default))) ;; #+END_SRC -;; *** goto-chg +;;;;;; goto-chg ;; This is like popping the mark, only it filters to only change areas ;; and doesn’t go back to the same place more than once. @@ -2754,7 +2754,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." :bind ("C-c C-SPC" . goto-last-change)) ;; #+END_SRC -;; *** beginend +;;;;;; beginend ;; In special buffers, I would rather have =M->= and =M-<= goto the ;; logical beginning/end rather than the physical ones. @@ -2765,7 +2765,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (beginend-setup-all))) ;; #+END_SRC -;; *** multiple-cursors +;;;;;; multiple-cursors ;; I mentioned before that I’d used Sublime Text before. Multiple ;; cursors was one of my favourite features, so I was really happy when I @@ -2781,7 +2781,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." ("C-S-L" . mc/edit-lines))) ;; #+END_SRC -;; *** paredit +;;;;;; paredit ;; Balanced parentheses in lisps are nice, but all the refactoring and ;; movement commands are much more interesting. @@ -2796,7 +2796,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode))) ;; #+END_SRC -;; *** smartparens +;;;;;; smartparens ;; I like to use smartparens where paredit isn’t already useful. Somehow ;; I didn’t find smartparens’ implementation of paredit style to be as @@ -2831,7 +2831,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." ;; #+END_SRC -;; *** move-text +;;;;;; move-text ;; Transposing lines, made easier. @@ -2840,7 +2840,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." :config (move-text-default-bindings)) ;; #+END_SRC -;; *** undo-tree +;;;;;; undo-tree ;; Emacs’ default handling of undo is a bit confusing. Undo-tree makes ;; it much clearer. It’s especially helpful for protoyping and refactoring. @@ -2863,14 +2863,14 @@ Pass ARG to `comint-delchar-or-maybe-eof'." :diminish undo-tree-mode) ;; #+END_SRC -;; *** replace +;;;;;; replace ;; #+BEGIN_SRC emacs-lisp (with-eval-after-load "replace.el" (setq case-replace nil)) ;; #+END_SRC -;; *** visual-regexp +;;;;;; visual-regexp ;; I don’t always remember exactly how Emacs’ regular expressions work, ;; so this package is pretty useful because it highlights everything in @@ -2883,7 +2883,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." ("C-c m" . vc/mc-mark))) ;; #+END_SRC -;; ** End +;;;;; End ;; Start a server if possible. A daemon is already a server. ;; #+BEGIN_SRC emacs-lisp -- cgit 1.4.1 From 2036b1e56798d4ade05fee3475280ea7c111a591 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 8 Sep 2017 23:12:32 +0200 Subject: Emacs: appease emacs-lisp-checkdoc --- emacs/.emacs.d/main.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index ea2712ea..5a665c72 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -4,6 +4,8 @@ ;; #+PROPERTY: results silent ;; #+PROPERTY: eval no-export ;; #+PROPERTY: header-args :comments link +;;; Commentary: +;;; This is my Emacs configuration. ;;; Header: ;; This is a living document, detailing my Emacs configuration using org-mode ;;; Code: -- cgit 1.4.1 From 0f70a52af55ff90f10282d4894dfba0bb0dd0404 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 8 Sep 2017 23:15:24 +0200 Subject: Emacs: Replace beacon with builtin hl-line-mode --- emacs/.emacs.d/main.el | 19 ++----------------- nix/.config/nixpkgs/emacs.nix | 1 - 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 5a665c72..1844ffd3 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -183,6 +183,8 @@ :diminish highlight-stages-mode) ;; #+END_SRC +(global-hl-line-mode +1) + ;;;;;; Fonts ;; When possible, set up fonts. I don’t have any settings here for X11, @@ -366,23 +368,6 @@ (volatile-highlights-mode t))) ;; #+END_SRC -;;;;;; Beacon - -;; I was against the idea of having flashy animations inside Emacs, but -;; this one is useful. It highlights the cursor when scrolling or -;; switching windows. - -;; #+BEGIN_SRC emacs-lisp -(use-package beacon - :diminish beacon-mode - :config (progn - (beacon-mode +1) - (setq beacon-blink-delay 0.25 - beacon-blink-duration 0.25 - beacon-size 20 - beacon-color "#a1b56c"))) -;; #+END_SRC - ;;;;;; Renaming major modes ;; Diminishing major modes does not happen in the same manner as minor diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix index aface0fa..d517364d 100644 --- a/nix/.config/nixpkgs/emacs.nix +++ b/nix/.config/nixpkgs/emacs.nix @@ -156,7 +156,6 @@ in which-key yaml-mode ]) ++ (with epkgs.elpaPackages; [ - beacon rainbow-mode ]) ++ [ # defined above -- cgit 1.4.1 From 6a9bfc533275097f88c10c95c28804a014896931 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 8 Sep 2017 23:15:44 +0200 Subject: Emacs: Add company fallback keybind to overriding keymap --- emacs/.emacs.d/main.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 1844ffd3..b51e1f3b 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1137,8 +1137,8 @@ (use-package company :commands (company-mode) :diminish "Cmpl" - :bind (("C-" . company-complete) - ("TAB" . company-indent-or-complete-common)) + :bind* (("C-" . company-complete)) + :bind (("TAB" . company-indent-or-complete-common)) :init (progn (add-hook 'prog-mode-hook #'company-mode-on) (setq company-backends '(company-bbdb company-web-html company-tern company-nxml company-css company-eclim company-semantic company-elisp -- cgit 1.4.1 From 841e31a841e73ed3f6ad717c1aa45d8d80166ea8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 8 Sep 2017 23:16:24 +0200 Subject: Remove trailing spaces --- nix/.config/nixpkgs/emacs.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix index d517364d..1635e38e 100644 --- a/nix/.config/nixpkgs/emacs.nix +++ b/nix/.config/nixpkgs/emacs.nix @@ -51,7 +51,7 @@ in diminish bind-key use-package - smartparens + smartparens ]) ++ (with epkgs.melpaPackages; [ ace-link ace-window @@ -161,5 +161,5 @@ in # defined above hook-helpers dired-du - # From main packages set + # From main packages set ]) -- cgit 1.4.1 From f64d27e5aa9fa4668773a0e01bd4bf396b69d819 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 8 Sep 2017 23:20:05 +0200 Subject: Emacs: Use system default font from Xresources --- emacs/.emacs.d/main.el | 4 ---- xresources/.xresources/main | 6 +++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index b51e1f3b..7da0f6bd 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -222,10 +222,6 @@ (if (eq displays 1) (ap/set-fonts "Fira Code" 14 "Lucida Grande" 14 t nil) (ap/set-fonts "Monoid" 12 "Helvetica Neue" 12 t 0.1)))) - ((and (eq window-system 'x) - (not (eq system-type 'gnu/linux/windows))) - (set-fontset-font "fontset-default" 'unicode (font-spec :name "PT Mono" :size 14)) - (ap/set-fonts "PT Mono" 14 "Noto Sans" 14 nil)) ((and (eq window-system 'x) (eq system-type 'gnu/linux/windows)) (ap/set-fonts "Noto Mono" 12 "Sans" 12 nil))))) diff --git a/xresources/.xresources/main b/xresources/.xresources/main index f8a72693..f89da077 100644 --- a/xresources/.xresources/main +++ b/xresources/.xresources/main @@ -28,9 +28,9 @@ URxvt.pointerBlank: true URxvt.pointerBlankDelay: 987654321 URxvt.letterSpace: 0 -Emacs.Font: -Misc-Fixed-normal-normal-normal-*-14-*-*-*-c-70-iso10646-1 -Emacs.fixed-pitch.attributeFont: -Misc-Fixed-normal-normal-normal-*-14-*-*-*-c-70-iso10646-1 -Emacs.variable-pitch.attributeFont: -*-PT Sans-medium-r-*-*-14-*-*-*-*-*-*-* +Emacs.Font: monospace-10 +Emacs.fixed-pitch.attributeFont: monospace-10 +Emacs.variable-pitch.attributeFont: sans-10 ! Local Variables: ! compile-command: (concat "xrdb -merge " (shell-quote-argument buffer-file-name)) -- cgit 1.4.1 From f1321a5cc23ae13220009a220b9fe13918cb369d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 8 Sep 2017 23:21:51 +0200 Subject: Emacs: Add fontawesome --- emacs/.emacs.d/main.el | 9 +++++++++ nix/.config/nixpkgs/emacs.nix | 1 + 2 files changed, 10 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 7da0f6bd..e7a1dc1a 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -2748,6 +2748,15 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (beginend-setup-all))) ;; #+END_SRC +;;;;;; fontawesome + +;; Sometimes I might want to add a font-awesome icon to some text. +;; This package gives me two interfaces to find the icons + +;; #+BEGIN_SRC emacs-lisp +(use-package fontawesome) +;; #+END_SRC + ;;;;;; multiple-cursors ;; I mentioned before that I’d used Sublime Text before. Multiple diff --git a/nix/.config/nixpkgs/emacs.nix b/nix/.config/nixpkgs/emacs.nix index 1635e38e..62a81710 100644 --- a/nix/.config/nixpkgs/emacs.nix +++ b/nix/.config/nixpkgs/emacs.nix @@ -94,6 +94,7 @@ in flycheck-flow flycheck-pos-tip flycheck-vale + fontawesome geiser ggtags ghq -- cgit 1.4.1 From a9cf2404db130d299bd4208a6657cc1ed4b866bc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Sep 2017 20:02:40 +0200 Subject: zsh: Fix email switch --- zsh/.config/zsh/.zshenv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index 620ece50..f865d405 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -69,7 +69,7 @@ then path+=($HOME/go/bin) fi - if [[ $HOSTNAME =~ satoshi ]] + if [[ $HOST =~ satoshi ]] then EMAIL=alan@satoshipay.io else -- cgit 1.4.1 From b5919c4a52db991ea9a60410d27751afe6c87f75 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Sep 2017 20:08:51 +0200 Subject: Emacs: Add shortcut to insert current date in beancount --- emacs/.emacs.d/main.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index e7a1dc1a..6e4a5813 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1790,6 +1790,8 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." beancount-dir)) (use-package beancount :defines (beancount-use-ido) + :bind (:map beancount-mode-map + ("C-c d" . insert-date)) :config (setq beancount-use-ido nil)))) ;; #+END_SRC -- cgit 1.4.1 From 80148c26109d41cdfff6240f084f62b7573309be Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Sep 2017 20:09:09 +0200 Subject: Emacs: Use electric-pair mode in nix-mode buffers It seems to work better than smartparens --- emacs/.emacs.d/main.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 6e4a5813..b546979d 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1694,7 +1694,13 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :mode (("Dockerfile\\'" . dockerfile-mode))) (use-package nix-mode - :mode (("\\.nix\\'" . nix-mode))) + :mode (("\\.nix\\'" . nix-mode)) + :config (progn + (define-hook-helper nix-mode () + (when (fboundp 'smartparens-mode) + (smartparens-strict-mode -1) + (smartparens-mode -1)) + (electric-pair-mode +1)))) (define-derived-mode xmonad-mode haskell-mode "XM") (add-to-list 'auto-mode-alist '("xmobarrc\\'" . xmonad-mode)) -- cgit 1.4.1 From 5005fee3c4f24d93315c398292c8bd392a7169ce Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Sep 2017 20:11:20 +0200 Subject: Emacs: Move outline-cycle away from tab Use shift-tab instead. `outshine-cycle-buffer` is already bound to alt-tab or ctrl-alt-i by default. --- emacs/.emacs.d/main.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index b546979d..0b7d7b4a 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1819,8 +1819,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (defvar outline-minor-mode-prefix "M-#") (use-package outshine :bind (:map outline-minor-mode-map - ("TAB" . outline-cycle) - ("" . outshine-cycle-buffer)) + ("" . outline-cycle)) :config (progn (add-hook 'outline-minor-mode-hook #'outshine-hook-function) (add-hook 'emacs-lisp-mode-hook #'outline-minor-mode) -- cgit 1.4.1 From 2b735a460a3f8334de5cac878fd2b0a390c2f0f2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 9 Sep 2017 21:06:32 +0200 Subject: Emacs: fix error when checking if beancount is available --- emacs/.emacs.d/main.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 0b7d7b4a..e40bf958 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1791,7 +1791,8 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; #+BEGIN_SRC emacs-lisp (let ((beancount-dir (car (split-string (shell-command-to-string "ghq list --full-path beancount"))))) - (when (file-directory-p beancount-dir) + (when (and beancount-dir + (file-directory-p beancount-dir)) (add-to-list 'load-path (expand-file-name "editors/emacs/" beancount-dir)) (use-package beancount -- cgit 1.4.1 From f2a8d3bfc315fc2cdc62db92f53a807083f98a54 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 10 Sep 2017 14:49:37 +0200 Subject: xresources: Set cursor theme to Vanilla-DMZ --- xresources/.icons/default/index.theme | 5 +++++ xresources/.xresources/main | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 xresources/.icons/default/index.theme diff --git a/xresources/.icons/default/index.theme b/xresources/.icons/default/index.theme new file mode 100644 index 00000000..6652f015 --- /dev/null +++ b/xresources/.icons/default/index.theme @@ -0,0 +1,5 @@ +# This file is written by LXAppearance. Do not edit. +[Icon Theme] +Name=Default +Comment=Default Cursor Theme +Inherits=Vanilla-DMZ diff --git a/xresources/.xresources/main b/xresources/.xresources/main index f89da077..54c35308 100644 --- a/xresources/.xresources/main +++ b/xresources/.xresources/main @@ -1,6 +1,6 @@ #include "base16-mexico-light-256" -Xcursor.theme: Neutral +Xcursor.theme: Vanilla-DMZ Xcursor.size: 22 Emacs.ToolBar: off -- cgit 1.4.1 From fbb86f6a16f9e804af80e2723bd7e85b2a2f1cb2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 10 Sep 2017 14:50:24 +0200 Subject: xprofile: Set cursor after setting theme (from xresources) --- xprofile/.xprofile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xprofile/.xprofile b/xprofile/.xprofile index 6e20ba91..5bebd1a0 100755 --- a/xprofile/.xprofile +++ b/xprofile/.xprofile @@ -1,8 +1,8 @@ #!/bin/sh -sh -c 'sleep 5 && xsetroot -cursor_name left_ptr' & xmodmap .xmodmaprc gpg-connect-agent /bye xrdb -I$HOME/.xresources .xresources/main +xsetroot -cursor_name left_ptr & nm-applet & if command -v autorandr then -- cgit 1.4.1 From 6925290c151f98a6934be466ec7b0b8fac626d43 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 10 Sep 2017 14:51:12 +0200 Subject: i3: Use default font --- i3/.config/i3/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 96765298..b9e2fe2d 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -51,7 +51,7 @@ set $Locker i3lock-color # Font for window titles. Will also be used by the bar unless a different font # is used in the bar {} block below. -font pango:Liberation Mono, Font Awesome 9 +font pango:Monospace, Font Awesome 9 # This font is widely installed, provides lots of unicode glyphs, right-to-left # text rendering and scalability on retina/hidpi displays (thanks to pango). -- cgit 1.4.1 From 135d62e62f352f89fa10c5efbc6f251433f5568b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 12 Sep 2017 10:29:52 +0200 Subject: i3: Disable mouse warping --- i3/.config/i3/config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 96765298..3e8b4f0f 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -67,6 +67,8 @@ font pango:Liberation Mono, Font Awesome 9 # Use Mouse+$mod to drag floating windows to their wanted position floating_modifier $mod +mouse_warping none + # start a terminal bindsym $mod+Return exec --no-startup-id urxvt -- cgit 1.4.1 From 6567724fbb7bb5f15229bc511d6197e7f2a10213 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 12 Sep 2017 10:30:12 +0200 Subject: xprofile: Start nitrokey-app --- xprofile/.xprofile | 1 + 1 file changed, 1 insertion(+) diff --git a/xprofile/.xprofile b/xprofile/.xprofile index 6e20ba91..133c0c8c 100755 --- a/xprofile/.xprofile +++ b/xprofile/.xprofile @@ -8,4 +8,5 @@ if command -v autorandr then autorandr --change --force fi +nitrokey-app & sxhkd & -- cgit 1.4.1 From c4b7e6c30798719ce53aef92c6ffc156d0dd8b76 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 12 Sep 2017 10:30:29 +0200 Subject: XResources: Override background colour --- xresources/.xresources/main | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xresources/.xresources/main b/xresources/.xresources/main index f89da077..3da2d224 100644 --- a/xresources/.xresources/main +++ b/xresources/.xresources/main @@ -1,5 +1,7 @@ #include "base16-mexico-light-256" +*.background: #ffffff + Xcursor.theme: Neutral Xcursor.size: 22 -- cgit 1.4.1 From d0eb290066a6927238a7c94f66583eba47197817 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 12 Sep 2017 10:44:55 +0200 Subject: Emacs: Add mu4e-refile-folder for satoshipay --- emacs/.emacs.d/main.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index e40bf958..07e93bf3 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1433,6 +1433,7 @@ With two prefix arguments, write out the day and month name." (mu4e-sent-messages-behavior . sent) (mu4e-drafts-folder . "/[Gmail].Drafts") (mu4e-sent-folder . "/[Gmail].Sent Mail") + (mu4e-refile-folder . "/[Gmail].All Mail") (mu4e-trash-folder . "/[Gmail].Bin")))) mu4e-user-mail-address-list (append (delq nil -- cgit 1.4.1 From e2d53b4727a68f3cdbdd7d6c341a57f716ad3efa Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 12 Sep 2017 13:02:34 +0200 Subject: Emacs: Add mu4e variable declarations --- emacs/.emacs.d/main.el | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 07e93bf3..0e15840d 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1372,7 +1372,17 @@ With two prefix arguments, write out the day and month name." :defines (mu4e-use-fancy-chars mu4e-attachment-dir mu4e-view-show-images - mu4e-headers-date-format) + mu4e-update-interval + mu4e-maildir-shortcuts + mu4e-headers-date-format + mu4e-maildir + mu4e-mu-home + mu4e-sent-folder + mu4e-drafts-folder + mu4e-refile-folder + mu4e-trash-folder + mu4e-user-mail-address-list + mu4e-contexts) :config (progn (setq mu4e-use-fancy-chars nil mu4e-attachment-dir "~/Downloads/" -- cgit 1.4.1 From bc71ff8dcb18541e37eef2cab290c7a80d48963b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 12 Sep 2017 13:03:20 +0200 Subject: i3: Use client/server rxvt-unicode --- i3/.config/i3/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 3e8b4f0f..341a9fc9 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -70,7 +70,7 @@ floating_modifier $mod mouse_warping none # start a terminal -bindsym $mod+Return exec --no-startup-id urxvt +bindsym $mod+Return exec --no-startup-id urxvtc # kill focused window bindsym $mod+Shift+w kill -- cgit 1.4.1 From ab4e4771ec8b2cc1e714384f008f63f29d602beb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 Sep 2017 09:41:54 +0200 Subject: msmtp: Fix password fetching --- msmtp/.msmtprc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/msmtp/.msmtprc b/msmtp/.msmtprc index 2c767888..8e55b097 100644 --- a/msmtp/.msmtprc +++ b/msmtp/.msmtprc @@ -10,7 +10,7 @@ host mail.alanpearce.eu port 587 from alan@alanpearce.eu user alan -passwordeval pass mail/alanpearce.eu +passwordeval pass mail/alanpearce account personal-uk : personal from alan@alanpearce.uk @@ -23,7 +23,7 @@ host mail.riseup.net from alanpearce@riseup.net user alanpearce port 465 -passwordeval pass mail/riseup.net +passwordeval pass mail/riseup account satoshipay host smtp.gmail.com -- cgit 1.4.1 From 04cdd29bdd9ecc2fc04b7082c297bd6a68770ce4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 Sep 2017 09:50:54 +0200 Subject: Emacs: Make sure pre-set SSH_AUTH_SOCK exists before using it --- emacs/.emacs.d/main.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 0e15840d..cc4e819e 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -833,7 +833,8 @@ (use-package tramp :defer 7 :config (progn - (unless (getenv "SSH_AUTH_SOCK") + (unless (and (getenv "SSH_AUTH_SOCK") + (file-exists-p (getenv "SSH_AUTH_SOCK"))) (setenv "SSH_AUTH_SOCK" (format "/run/user/%s/gnupg/S.gpg-agent.ssh" (user-uid)))) (setq tramp-default-method "ssh" tramp-default-user-alist '(("\\`su\\(do\\)?\\'" nil "root")) -- cgit 1.4.1 From 1196160bc1502e54fb3554259df8723d8bdb8c1c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 Sep 2017 09:51:18 +0200 Subject: Emacs: Add autoload for beancount-mode --- emacs/.emacs.d/main.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index cc4e819e..1caab89f 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1809,6 +1809,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." beancount-dir)) (use-package beancount :defines (beancount-use-ido) + :commands beancount-mode :bind (:map beancount-mode-map ("C-c d" . insert-date)) :config (setq beancount-use-ido nil)))) -- cgit 1.4.1 From 9dee6fc90a41adfb2d2932088c6677871c08ff3d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 Sep 2017 13:33:41 +0200 Subject: autorandr: Fix profile detection --- autorandr/.config/autorandr/postswitch | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/autorandr/.config/autorandr/postswitch b/autorandr/.config/autorandr/postswitch index c314da31..fc5d8288 100755 --- a/autorandr/.config/autorandr/postswitch +++ b/autorandr/.config/autorandr/postswitch @@ -1,9 +1,11 @@ #!/bin/sh DPI=96 -if [ "$1" != "laptop" ] -then - DPI=144 -fi +case $AUTORANDR_CURRENT_PROFILE in + ("laptop") + DPI=144;; + ("docked") + DPI=120;; +esac xrandr --dpi $DPI emacsclient -e "(setq display-pixels-per-inch $DPI)" > /dev/null -- cgit 1.4.1 From 0872319ea4fec52fad084e9227ef17c3639a3020 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 Sep 2017 13:42:13 +0200 Subject: xprofile: Move X settings after autorandr switch --- xprofile/.xprofile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xprofile/.xprofile b/xprofile/.xprofile index 7ea57551..cd646603 100755 --- a/xprofile/.xprofile +++ b/xprofile/.xprofile @@ -1,12 +1,12 @@ #!/bin/sh xmodmap .xmodmaprc gpg-connect-agent /bye -xrdb -I$HOME/.xresources .xresources/main -xsetroot -cursor_name left_ptr & nm-applet & if command -v autorandr then autorandr --change --force fi +xrdb -I$HOME/.xresources .xresources/main +xsetroot -cursor_name left_ptr -solid '#666666' & nitrokey-app & sxhkd & -- cgit 1.4.1 From 424117953b6441f9be061f4c8324e66da971746b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 Sep 2017 13:42:31 +0200 Subject: autorandr: Add notification to postswitch script --- autorandr/.config/autorandr/postswitch | 1 + 1 file changed, 1 insertion(+) diff --git a/autorandr/.config/autorandr/postswitch b/autorandr/.config/autorandr/postswitch index fc5d8288..f0dd1efb 100755 --- a/autorandr/.config/autorandr/postswitch +++ b/autorandr/.config/autorandr/postswitch @@ -12,3 +12,4 @@ emacsclient -e "(setq display-pixels-per-inch $DPI)" > /dev/null i3-msg restart systemctl --user restart redshift +notify-send --expire-time=5000 "Display profile: '$AUTORANDR_CURRENT_PROFILE'" -- cgit 1.4.1 From 54c18184114b266cec0966b663e12e60c52ed985 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 14 Sep 2017 13:23:52 +0200 Subject: npmrc: Fix creation of '$HOME' dir --- autorandr/.config/autorandr/postswitch | 8 ++++++-- javascript/.npmrc | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/autorandr/.config/autorandr/postswitch b/autorandr/.config/autorandr/postswitch index f0dd1efb..44cb6ccf 100755 --- a/autorandr/.config/autorandr/postswitch +++ b/autorandr/.config/autorandr/postswitch @@ -2,9 +2,13 @@ DPI=96 case $AUTORANDR_CURRENT_PROFILE in ("laptop") - DPI=144;; + DPI=144 + nmcli radio wifi on + ;; ("docked") - DPI=120;; + DPI=120 + nmcli radio all off + ;; esac xrandr --dpi $DPI diff --git a/javascript/.npmrc b/javascript/.npmrc index ab499739..2da1b6db 100644 --- a/javascript/.npmrc +++ b/javascript/.npmrc @@ -1,3 +1,3 @@ -prefix=$HOME/.local +prefix=${HOME}/.local //registry.npmjs.org/:_authToken=$NPM_TOKEN @satoshipay:registry=http://registry.npmjs.org/ -- cgit 1.4.1 From edc7739837f4ecbf568405835c5470ab4ac222dd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 15 Sep 2017 12:19:57 +0200 Subject: Emacs: Remove nix info from frame title --- emacs/.emacs.d/main.el | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 1caab89f..4ccb261d 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -272,25 +272,8 @@ (line-number-mode -1) (size-indication-mode t) - (require 'f) (setq frame-title-format (list "Emacs" - (if (and nix-emacs invocation-directory) - (list " (Nix Generation " - (cadr - (split-string (f-base - (car - (last (seq-take-while - (lambda (s) (s-contains? "profile" s)) - (split-string - (s-chomp (shell-command-to-string (concat "nix-store -q --roots " invocation-directory))) - "\n"))))) - "-")) - " " - (s-left 6 (nth 3 (f-split invocation-directory))) - "..." - (s-right 6 (car (split-string (nth 3 (f-split invocation-directory)) "-"))) - ")")) '(buffer-file-name " — %f") '(dired-directory (" — " dired-directory)))) ;; #+END_SRC -- cgit 1.4.1 From d0851a07ff2101239fc5ba4c6dfb856c9984526d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 15 Sep 2017 13:02:54 +0200 Subject: i3: Switch back to bitmap fonts --- i3/.config/i3/config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index f88dc9e6..c5d5e44d 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -51,14 +51,14 @@ set $Locker i3lock-color # Font for window titles. Will also be used by the bar unless a different font # is used in the bar {} block below. -font pango:Monospace, Font Awesome 9 +# font pango:Monospace, Font Awesome 9 # This font is widely installed, provides lots of unicode glyphs, right-to-left # text rendering and scalability on retina/hidpi displays (thanks to pango). #font pango:DejaVu Sans Mono 8 # Before i3 v4.8, we used to recommend this one as the default: -# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 +font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 # The font above is very space-efficient, that is, it looks good, sharp and # clear in small sizes. However, its unicode glyph coverage is limited, the old # X core fonts rendering does not support right-to-left and this being a bitmap -- cgit 1.4.1 From 6ea264aa3cc597cdc96071cebd97b3e4d5e02dd6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 15 Sep 2017 13:03:47 +0200 Subject: i3: Configure gaps --- i3/.config/i3/config | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index c5d5e44d..bc205b3b 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -189,6 +189,43 @@ mode "resize" { bindsym Escape mode "default" } +set $mode_gaps Gaps: (o) outer, (i) inner +set $mode_gaps_outer Outer Gaps: +|-|0 (local), Shift + +|-|0 (global) +set $mode_gaps_inner Inner Gaps: +|-|0 (local), Shift + +|-|0 (global) +bindsym $mod+Shift+g mode "$mode_gaps" + +mode "$mode_gaps" { + bindsym o mode "$mode_gaps_outer" + bindsym i mode "$mode_gaps_inner" + bindsym Return mode "default" + bindsym Escape mode "default" +} + +mode "$mode_gaps_inner" { + bindsym plus gaps inner current plus 5 + bindsym minus gaps inner current minus 5 + bindsym 0 gaps inner current set 0 + + bindsym Shift+plus gaps inner all plus 5 + bindsym Shift+minus gaps inner all minus 5 + bindsym Shift+0 gaps inner all set 0 + + bindsym Return mode "default" + bindsym Escape mode "default" +} +mode "$mode_gaps_outer" { + bindsym plus gaps outer current plus 5 + bindsym minus gaps outer current minus 5 + bindsym 0 gaps outer current set 0 + + bindsym Shift+plus gaps outer all plus 5 + bindsym Shift+minus gaps outer all minus 5 + bindsym Shift+0 gaps outer all set 0 + + bindsym Return mode "default" + bindsym Escape mode "default" +} + bindsym $mod+Shift+r mode "resize" set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown @@ -236,7 +273,11 @@ client.urgent $base08 $base08 $base00 $base08 $base08 client.placeholder $base00 $base00 $base05 $base00 $base00 client.background $base07 +new_window pixel 1 +new_float normal hide_edge_borders both +gaps inner 5 +gaps outer 5 for_window [class="Pinentry$"] floating enable for_window [class="Google-chrome"] border pixel 1 -- cgit 1.4.1 From 5f06c464369af7bb617a85470ac707a288637db8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 15 Sep 2017 13:03:55 +0200 Subject: xprofile: Don't run nitrokey-app The linux version doesn't seem to do anything useful, like notify when it's plugged in --- xprofile/.xprofile | 1 - 1 file changed, 1 deletion(-) diff --git a/xprofile/.xprofile b/xprofile/.xprofile index cd646603..4101484c 100755 --- a/xprofile/.xprofile +++ b/xprofile/.xprofile @@ -8,5 +8,4 @@ then fi xrdb -I$HOME/.xresources .xresources/main xsetroot -cursor_name left_ptr -solid '#666666' & -nitrokey-app & sxhkd & -- cgit 1.4.1 From 5b505c41c798b4a1b2b7e00db89e3f11134a2bc3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 15 Sep 2017 13:05:04 +0200 Subject: i3status: Shorten networking info --- i3/.config/i3status/config | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/i3/.config/i3status/config b/i3/.config/i3status/config index be0a2561..2c8217a5 100644 --- a/i3/.config/i3status/config +++ b/i3/.config/i3status/config @@ -17,9 +17,9 @@ general { order += "disk /" order += "disk /home" -order += "wireless _first_" -order += "ethernet _first_" order += "ipv6" +order += "ethernet _first_" +order += "wireless _first_" order += "battery all" order += "battery 0" order += "battery 1" @@ -31,17 +31,20 @@ order += "tztime local" ipv6 { format_up = "6" format_down = "4" -} - -wireless _first_ { - format_up = "W: %quality (%essid)" - format_down = "W" + separator = false + separator_block_width = 0 } ethernet _first_ { - # if you use %speed, i3status requires root privileges - format_up = "E: (%speed)" + format_up = "E" format_down = "E" + separator = false + separator_block_width = 0 +} + +wireless _first_ { + format_up = "W: %quality (%essid) " + format_down = "W" } battery 0 { -- cgit 1.4.1 From 2e637e271c9f06c68efac6d526302a591d2c739b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 15 Sep 2017 13:05:45 +0200 Subject: Emacs: Move projectile-vc key to C-M-g Super should be reserved for the window manager; it was in the way of the i3 gaps mode --- emacs/.emacs.d/main.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 4ccb261d..1aa78a43 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -535,7 +535,7 @@ ("C-c C-f" . projectile-find-file) ("s-x s-f" . projectile-find-file) ("C-x g" . projectile-vc) - ("s-G" . projectile-vc)) + ("C-M-g" . projectile-vc)) :demand t :diminish projectile-mode :config (progn -- cgit 1.4.1 From 695cf955bd0071faf311e44b6ce78e8fd248564d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 16 Sep 2017 17:39:54 +0200 Subject: git: Fix gpg invocation --- git/.config/git/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git/.config/git/config b/git/.config/git/config index 12a490b8..bddd3d98 100644 --- a/git/.config/git/config +++ b/git/.config/git/config @@ -44,4 +44,4 @@ [difftool "icdiff"] cmd = icdiff --line-numbers $LOCAL $REMOTE [gpg] - program = gpg2 + program = gpg -- cgit 1.4.1 From b5a3397bb47243716738747ec82ef5019a798819 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 16 Sep 2017 17:40:07 +0200 Subject: git: Use satoshipay email for its repositories --- git/.config/git/config | 2 ++ git/.config/git/config-satoshipay | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 git/.config/git/config-satoshipay diff --git a/git/.config/git/config b/git/.config/git/config index bddd3d98..d5e6abb9 100644 --- a/git/.config/git/config +++ b/git/.config/git/config @@ -29,6 +29,8 @@ path = config-spotcap [includeIf "gitdir:bitbucket.org/spotcap-engineering/"] path = config-spotcap +[includeIf "gitdir:github.com/satoshipay/"] + path = config-satoshipay [diff] algorithm = patience [include] diff --git a/git/.config/git/config-satoshipay b/git/.config/git/config-satoshipay new file mode 100644 index 00000000..5fedb7d6 --- /dev/null +++ b/git/.config/git/config-satoshipay @@ -0,0 +1,2 @@ +[user] +email = alan@satoshipay.io \ No newline at end of file -- cgit 1.4.1 From 03551f6c04232181ea2c3b2700708bd43249a11d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 18 Sep 2017 18:36:03 +0200 Subject: Emacs: Fix incorrect keybind command --- emacs/.emacs.d/main.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 1aa78a43..5c400086 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -2876,7 +2876,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (use-package visual-regexp :bind (("C-c r" . vr/replace) ("C-c q" . vr/query-replace) - ("C-c m" . vc/mc-mark))) + ("C-c m" . vr/mc-mark))) ;; #+END_SRC ;;;;; End -- cgit 1.4.1 From f7b470763a0f1ccf9a441531e64f1807a82f9df3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 18 Sep 2017 18:56:14 +0200 Subject: Emacs: Fix beancount loading If another repository exists whose name includes beancount and sorts before it, then loading beancount.el will fail due to incorrect load path --- emacs/.emacs.d/main.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 1aa78a43..aee8450e 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1785,7 +1785,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;;;;;; Beancount ;; #+BEGIN_SRC emacs-lisp -(let ((beancount-dir (car (split-string (shell-command-to-string "ghq list --full-path beancount"))))) +(let ((beancount-dir (car (split-string (shell-command-to-string "ghq list --full-path blais/beancount"))))) (when (and beancount-dir (file-directory-p beancount-dir)) (add-to-list 'load-path (expand-file-name "editors/emacs/" -- cgit 1.4.1 From 234961c3386df99937a4b6851839985f92ed4293 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 18 Sep 2017 18:57:53 +0200 Subject: Emacs: Use correct keybinding syntax for projectile-ripgrep --- emacs/.emacs.d/main.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index f76c3298..2e6eeec5 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -521,7 +521,8 @@ (use-package projectile-ripgrep :after (ripgrep projectile) :if (executable-find "rg") - :bind (("C-c p s r" . projectile-ripgrep))) + :bind (:map projectile-command-map + ("s r" . projectile-ripgrep))) ;; #+END_SRC ;;;;;; Projectile -- cgit 1.4.1 From 202e6e82054d71cc21ac5f2880e4acf898ccebcb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 18 Sep 2017 19:04:30 +0200 Subject: Emacs: Enable projectile-mode globally The function projectile-global-mode no longe rseems to throw deprecation warnings. --- emacs/.emacs.d/main.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 2e6eeec5..7b73496d 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -540,7 +540,7 @@ :demand t :diminish projectile-mode :config (progn - (projectile-mode +1) + (projectile-global-mode +1) (add-to-list 'projectile-globally-ignored-directories ".stversions") (defun yarn-install (&optional arg) -- cgit 1.4.1 From 08b29615b1932f42fbd05cafc2717eb779769a61 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 18 Sep 2017 19:05:13 +0200 Subject: Emacs: Optimise projectile usage --- emacs/.emacs.d/main.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 7b73496d..b749a106 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -542,6 +542,7 @@ :config (progn (projectile-global-mode +1) (add-to-list 'projectile-globally-ignored-directories ".stversions") + (setq projectile-mode-line "P") (defun yarn-install (&optional arg) (interactive "P") -- cgit 1.4.1 From 78a4703f79b22f7af6e21529f3f9c73607cf691f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 18 Sep 2017 20:34:27 +0200 Subject: xresources: Switch to paper cursor-theme --- xresources/.xresources/main | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xresources/.xresources/main b/xresources/.xresources/main index 0e1e802d..a2640f9c 100644 --- a/xresources/.xresources/main +++ b/xresources/.xresources/main @@ -2,7 +2,8 @@ *.background: #ffffff -Xcursor.theme: Vanilla-DMZ +! Xcursor.theme: Vanilla-DMZ +Xcursor.theme: Paper Xcursor.size: 22 Emacs.ToolBar: off -- cgit 1.4.1 From 733c55b44027cd039dace97b64c7503da3bff41f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 19 Sep 2017 09:58:32 +0200 Subject: offlineimap: Use app-specific password for mail --- offlineimap/.offlineimaprc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/offlineimap/.offlineimaprc b/offlineimap/.offlineimaprc index 0bba8963..c1c4e37b 100644 --- a/offlineimap/.offlineimaprc +++ b/offlineimap/.offlineimaprc @@ -66,7 +66,7 @@ localfolders = %(satoshipaymaildir)s [Repository satoshipay.io-remote] type = Gmail remoteuser = alan@satoshipay.io -remotepasseval = get_pass("satoshipay/google") +remotepasseval = get_pass("satoshipay/google/app-mail") sslcacertfile = /etc/ssl/certs/ca-certificates.crt keepalive = 1740 holdconnectionopen = yes -- cgit 1.4.1 From a4cc28d1a815d504b637739f78100676983bda5c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 19 Sep 2017 14:17:27 +0200 Subject: autorandr: Set correct DPI for external monitors Turns out they're actually more like 94 dpi, but oh well. --- autorandr/.config/autorandr/postswitch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autorandr/.config/autorandr/postswitch b/autorandr/.config/autorandr/postswitch index 44cb6ccf..ae9f7f8e 100755 --- a/autorandr/.config/autorandr/postswitch +++ b/autorandr/.config/autorandr/postswitch @@ -6,7 +6,7 @@ case $AUTORANDR_CURRENT_PROFILE in nmcli radio wifi on ;; ("docked") - DPI=120 + DPI=96 nmcli radio all off ;; esac -- cgit 1.4.1 From 317cc0e7a0cbef0df499f05b38e4d7e9dc47bc32 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 22 Sep 2017 12:43:04 +0200 Subject: msmtp: Fix google mail password --- msmtp/.msmtprc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/msmtp/.msmtprc b/msmtp/.msmtprc index 8e55b097..bf67ed1e 100644 --- a/msmtp/.msmtprc +++ b/msmtp/.msmtprc @@ -31,7 +31,7 @@ from alan@satoshipay.io user alan@satoshipay.io port 465 tls_starttls off -passwordeval pass satoshipay/google +passwordeval pass satoshipay/google/app-mail # Set a default account account default : personal -- cgit 1.4.1 From a129355e81814b068993fca2fc8dc71e7501b3dc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 22 Sep 2017 12:43:29 +0200 Subject: Emacs: Complain more when editorconfig is missing --- emacs/.emacs.d/main.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index b749a106..5e5c06f3 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -880,7 +880,10 @@ ;; #+BEGIN_SRC emacs-lisp (use-package editorconfig - :diminish "EC" + :diminish editorconfig-mode + :init (progn + (unless (executable-find "editorconfig") + (warn "Missing `editorconfig' executable."))) :config (editorconfig-mode 1)) ;; #+END_SRC -- cgit 1.4.1 From ef8d2f00783a7b403fb330edde2dd516d7825bab Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 22 Sep 2017 12:47:49 +0200 Subject: Emacs: Don't complain about projectile-global-mode deprecation --- emacs/.emacs.d/main.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 5e5c06f3..1e624535 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -531,6 +531,7 @@ ;; ones. ;; #+BEGIN_SRC emacs-lisp +(add-to-list 'byte-compile-not-obsolete-funcs #'projectile-global-mode) (use-package projectile :bind (("s-p" . projectile-switch-project) ("C-c C-f" . projectile-find-file) -- cgit 1.4.1 From a9544b79cfd28d1a9ffc6fcca7d4965956d35f1f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 22 Sep 2017 12:48:14 +0200 Subject: Emacs: Diminish company some more --- emacs/.emacs.d/main.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 1e624535..91e62621 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1122,7 +1122,7 @@ ;; #+BEGIN_SRC emacs-lisp (use-package company :commands (company-mode) - :diminish "Cmpl" + :diminish " C" :bind* (("C-" . company-complete)) :bind (("TAB" . company-indent-or-complete-common)) :init (progn -- cgit 1.4.1 From c406178a86ab2bfa2b3740345b5d6509c1bd2bd0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 22 Sep 2017 12:48:42 +0200 Subject: Emacs: remove incorrect counsel-projectile-rg keybinding --- emacs/.emacs.d/main.el | 1 - 1 file changed, 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 91e62621..83cd61d5 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -594,7 +594,6 @@ (use-package counsel-projectile :after (counsel projectile) - :bind (("C-c p s s" . counsel-projectile-rg)) :config (progn (counsel-projectile-on) (def-projectile-commander-method ?A -- cgit 1.4.1 From 6601148a9ec9d1a212630c7938c705812fe24541 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 22 Sep 2017 12:49:12 +0200 Subject: Emacs: Fully diminish redshank-mode --- emacs/.emacs.d/main.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 83cd61d5..44c5ea59 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -2074,7 +2074,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; let bindings. ;; #+BEGIN_SRC emacs-lisp (use-package redshank - :diminish " Λ" + :diminish redshank-mode :after (paredit) :config (progn (add-hook 'lisp-mode-common-hook #'turn-on-redshank-mode))) -- cgit 1.4.1 From a6d1c9cdbb9b66011d1a87bf1ea688b5014ce2b9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 22 Sep 2017 12:49:37 +0200 Subject: Emacs: Diminish all beginend modes --- emacs/.emacs.d/main.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 44c5ea59..2adc39da 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -2754,7 +2754,10 @@ Pass ARG to `comint-delchar-or-maybe-eof'." ;; #+BEGIN_SRC emacs-lisp (use-package beginend :config (progn - (beginend-setup-all))) + (beginend-setup-all) + (seq-do (lambda (modepair) + (diminish (cdr modepair))) + beginend-modes))) ;; #+END_SRC ;;;;;; fontawesome -- cgit 1.4.1 From 3da76fef7e1910faa8e3fd21f2e5697c735f80af Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 22 Sep 2017 12:51:03 +0200 Subject: Emacs: Only wrap lines in non-prog modes --- emacs/.emacs.d/main.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 2adc39da..7e784362 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1936,6 +1936,11 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;;;;; Programming + +(define-hook-helper prog-mode () + :name long-lines + (setq-local truncate-lines t)) + ;;;;;; flycheck ;; On-the-fly error checking in programming modes? Yes please. @@ -2637,7 +2642,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (put 'downcase-region 'disabled nil) (setq sentence-end-double-space t line-move-visual nil) -(setq-default truncate-lines t) +(setq-default truncate-lines nil) ;; #+END_SRC ;;;;;; align -- cgit 1.4.1 From 82f8655d5348c558258dbab154b20980cd2646c6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 22 Sep 2017 12:51:50 +0200 Subject: Emacs: Diminish js2-refactor-mode --- emacs/.emacs.d/main.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 7e784362..619bff2c 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -2282,6 +2282,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; #+BEGIN_SRC emacs-lisp (use-package js2-refactor :after js2-mode + :diminish js2-refactor-mode :config (progn (bind-key "C-k" #'js2r-kill js2-mode-map) (add-hook 'js2-mode-hook #'js2-refactor-mode) -- cgit 1.4.1 From 1a78e00c483b7d100b15f96c277a8b9a71d99848 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 22 Sep 2017 12:53:20 +0200 Subject: Balance font sizes between setups correctly --- autorandr/.config/autorandr/postswitch | 2 +- xresources/.xresources/main | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/autorandr/.config/autorandr/postswitch b/autorandr/.config/autorandr/postswitch index ae9f7f8e..97e4217c 100755 --- a/autorandr/.config/autorandr/postswitch +++ b/autorandr/.config/autorandr/postswitch @@ -2,7 +2,7 @@ DPI=96 case $AUTORANDR_CURRENT_PROFILE in ("laptop") - DPI=144 + DPI=157 nmcli radio wifi on ;; ("docked") diff --git a/xresources/.xresources/main b/xresources/.xresources/main index 0e1e802d..7d14a66b 100644 --- a/xresources/.xresources/main +++ b/xresources/.xresources/main @@ -22,17 +22,17 @@ URxvt.scrollTtyKeypress: true URxvt.saveLines: 16384 URxvt.secondaryScroll: false -URxvt.font: xft:monospace:size=10 -URxvt.boldFont: xft:monospace:bold:size=10 +URxvt.font: xft:monospace:size=11 +URxvt.boldFont: xft:monospace:bold:size=11 URxvt.intensityStyles: true URxvt.pointerBlank: true URxvt.pointerBlankDelay: 987654321 URxvt.letterSpace: 0 -Emacs.Font: monospace-10 -Emacs.fixed-pitch.attributeFont: monospace-10 -Emacs.variable-pitch.attributeFont: sans-10 +Emacs.Font: monospace-11 +Emacs.fixed-pitch.attributeFont: monospace-11 +Emacs.variable-pitch.attributeFont: sans-11 ! Local Variables: ! compile-command: (concat "xrdb -merge " (shell-quote-argument buffer-file-name)) -- cgit 1.4.1 From 1f09d8508fa3847c33fb0322f777d16b9b790707 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 22 Sep 2017 15:34:14 +0200 Subject: Emacs: Fix headers --- emacs/.emacs.d/main.el | 298 ++++++++++++++++++++++++------------------------- 1 file changed, 149 insertions(+), 149 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 619bff2c..d07dfe1c 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -9,8 +9,8 @@ ;;; Header: ;; This is a living document, detailing my Emacs configuration using org-mode ;;; Code: -;;;;; Basics -;;;;;; Startup +;;;; Basics +;;;;; Startup ;; Open Emacs with just a plain window. No graphics or messages, please! ;; #+BEGIN_SRC emacs-lisp (setq inhibit-startup-screen t) @@ -32,7 +32,7 @@ (setq system-type 'gnu/linux/windows)))) ;; #+END_SRC -;;;;;; Compatibility +;;;;; Compatibility ;; #+BEGIN_SRC emacs-lisp (if (version< emacs-version "25.0") @@ -40,7 +40,7 @@ `(eval-after-load ,file (lambda () ,@body)))) ;; #+END_SRC -;;;;;; Scratch buffers +;;;;; Scratch buffers ;; I usually use scratch buffers for any sort of text. If I need a ;; programming mode in one, then I’ll just call it manually. I also like ;; the buffer to be empty. @@ -49,15 +49,15 @@ initial-major-mode 'text-mode) ;; #+END_SRC -;;;;;; Personal Information +;;;;; Personal Information ;; #+BEGIN_SRC emacs-lisp (setq user-mail-address "alan@alanpearce.eu" user-full-name "Alan Pearce") ;; #+end_src -;;;;; Packaging +;;;; Packaging -;;;;;; Use-package +;;;;; Use-package ;; #+BEGIN_SRC emacs-lisp (eval-and-compile @@ -103,9 +103,9 @@ package-enable-at-startup nil) ;; #+END_SRC -;;;;;; Helpers +;;;;; Helpers -;;;;;;; Hook Helpers +;;;;;; Hook Helpers ;; An improvement over add-hook with lamda functions that allows ;; modification and removal, without the boilerplate of an extra function @@ -116,7 +116,7 @@ (use-package hook-helpers)) ;; #+END_SRC -;;;;; Customize +;;;; Customize ;; I don’t really like using customize for normal configuration. ;; Instead, I use it for things that get saved automatically. That’s why ;; I use a different file, which is ignored by the VCS. It also means @@ -128,7 +128,7 @@ (load custom-file :noerror :nomessage) ;; #+END_SRC -;;;;; Styles +;;;; Styles ;; I prefer an always-visible cursor. Feels less distracting. ;; #+BEGIN_SRC emacs-lisp @@ -158,7 +158,7 @@ (ding)))) ;; #+END_SRC -;;;;;; Colours +;;;;; Colours ;; White-theme. Sounds like a good idea. @@ -185,7 +185,7 @@ (global-hl-line-mode +1) -;;;;;; Fonts +;;;;; Fonts ;; 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]]. @@ -247,7 +247,7 @@ (global-prettify-symbols-mode +1)) ;; #+END_SRC -;;;;;; Page Breaks +;;;;; Page Breaks ;; By default, Emacs displays page breaks as ^L. Lines look much nicer. ;; On Windows, Emacs incorrectly detects that U+2500 (Box Drawings Light @@ -265,7 +265,7 @@ (cons page-break-lines-char page-break-lines-char) (face-attribute 'default :family))))) ;; #+END_SRC -;;;;;; Modeline +;;;;; Modeline ;; #+BEGIN_SRC emacs-lisp (column-number-mode -1) @@ -278,7 +278,7 @@ '(dired-directory (" — " dired-directory)))) ;; #+END_SRC -;;;;;; Chrome +;;;;; Chrome ;; Sometimes I like to hide clutter. Other times, it's useful. @@ -336,7 +336,7 @@ (add-hook 'minibuffer-exit-hook #'hide-mode-line) ;; #+END_SRC -;;;;;; Highlight Changes +;;;;; Highlight Changes ;; Highlight what just changed when I undo, yank, and so on. @@ -347,7 +347,7 @@ (volatile-highlights-mode t))) ;; #+END_SRC -;;;;;; Renaming major modes +;;;;; Renaming major modes ;; Diminishing major modes does not happen in the same manner as minor ;; modes. @@ -372,7 +372,7 @@ ;; #+END_SRC -;;;;; Environment Variables +;;;; Environment Variables ;; MacOS doesn’t have a reasonable way to set environment variables and ;; read them automatically any more. So, let’s use the @@ -393,7 +393,7 @@ (exec-path-from-shell-initialize))) ;; #+END_SRC -;;;;;; NixOS sandboxes +;;;;; NixOS sandboxes ;; I'm currently exploring using nix to create sandboxes for ;; development. This package allows using tools from inside sandboxes, @@ -417,7 +417,7 @@ (executable-find cmd))))))) ;; #+END_SRC -;;;;; Keybindings +;;;; Keybindings ;; I think =set-keyboard-coding-system= stops OS X from doing something ;; annoying to add accents. The modifier setup is to match my @@ -471,7 +471,7 @@ (set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) ;; #+END_SRC -;;;;;; Crux +;;;;; Crux ;; I can replace most of the simple helper/wrapper functions in my ;; configuration with crux.el @@ -490,7 +490,7 @@ (defalias 'rename-current-buffer-file #'crux-rename-file-and-buffer))) ;; #+END_SRC -;;;;; Projects +;;;; Projects ;; #+BEGIN_SRC emacs-lisp (defun switch-to-dotfiles () @@ -499,7 +499,7 @@ (projectile-switch-project-by-name (car (split-string (shell-command-to-string "ghq list --full-path dotfiles"))))) ;; #+END_SRC -;;;;;; The Silver Searcher +;;;;; The Silver Searcher ;; #+BEGIN_SRC emacs-lisp (use-package ag @@ -510,7 +510,7 @@ :after ag) ;; #+END_SRC -;;;;;; Ripgrep +;;;;; Ripgrep ;; Step over Silver Search, here comes a new challenger. @@ -525,7 +525,7 @@ ("s r" . projectile-ripgrep))) ;; #+END_SRC -;;;;;; Projectile +;;;;; Projectile ;; Projectile is awesome for working in projects, especially VCS-backed ;; ones. @@ -602,7 +602,7 @@ (define-key projectile-mode-map [remap counsel-projectile-ag] #'counsel-projectile-rg))) ;; #+END_SRC -;;;;;; vc +;;;;; vc ;; This is nice for some things that magit doesn’t do, and for those rare ;; occasions that I’m working with something other than git. @@ -618,7 +618,7 @@ tramp-file-name-regexp)))) ;; #+END_SRC -;;;;;; git-gutter-fringe +;;;;; git-gutter-fringe ;; It’s nice to be able to see at a glance which lines of a file have ;; changed. This package colours the fringe. I have it set to the right @@ -646,7 +646,7 @@ (setq git-gutter-fr:side 'right-fringe))) ;; #+END_SRC -;;;;;; magit +;;;;; magit ;; Magit is my favourite way to use git. I use selective staging all the ;; time. Make sure to set it up with a nice =completing-read-function= @@ -663,7 +663,7 @@ :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) ;; #+END_SRC -;;;;;; git-messenger +;;;;; git-messenger ;; Popup the last commit that changed the line at point. @@ -674,7 +674,7 @@ (setq git-messenger:use-magit-popup t))) ;; #+END_SRC -;;;;;; git-timemachine +;;;;; git-timemachine ;; This package allow me to go through a file’s history with just a few ;; keys. It makes it very easy to figure what what exactly was in a file @@ -686,7 +686,7 @@ :commands git-timemachine) ;; #+END_SRC -;;;;;; ghq +;;;;; ghq ;; [[https://github.com/motemen/ghq][=ghq=]] clones VCS-backed projects to a common directory. It should ;; seem familiar to anyone who's used =go get= before. [[https://github.com/rcoedo/emacs-ghq][=emacs-ghq=]] is a @@ -697,9 +697,9 @@ :if (executable-find "ghq")) ;; #+END_SRC -;;;;; Files +;;;; Files -;;;;;; Auto-saving +;;;;; Auto-saving ;; Auto-save everything to a temporary directory, instead of cluttering ;; the filesystem. I don’t want emacs-specific lockfiles, either. @@ -708,7 +708,7 @@ (setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t)) create-lockfiles nil) ;; #+END_SRC -;;;;;; Backups +;;;;; Backups ;; I like to keep my backups out of regular folders. I tell emacs to use ;; a subfolder of its configuration directory for that. Also, use the @@ -729,7 +729,7 @@ file)))) ;; #+END_SRC -;;;;;; autorevert +;;;;; autorevert ;; #+BEGIN_SRC emacs-lisp (use-package autorevert @@ -740,7 +740,7 @@ auto-revert-use-notify (not (eq system-type 'darwin))))) ;; #+END_SRC -;;;;;; Encoding +;;;;; Encoding ;; UTF-8 is usually appropriate. Note that =prefer-coding-system= expects ;; only a coding system, not a coding system and line ending combination. @@ -750,7 +750,7 @@ (setq-default buffer-file-coding-system 'utf-8-auto-unix) ;; #+END_SRC -;;;;;; Buffer-file management +;;;;; Buffer-file management ;; Ask if I want to create a directory when it doesn’t exist. This is ;; especially nice when starting new projects. @@ -782,7 +782,7 @@ (kill-buffer buf))))) ;; #+END_SRC -;;;;;; Whitespace +;;;;; Whitespace ;; Show bad whitespace, so that I can fix it. @@ -799,7 +799,7 @@ (add-hook 'text-mode-hook #'show-trailing-whitespace-on) ;; #+END_SRC -;;;;;; shrink-whitespace +;;;;; shrink-whitespace ;; DWIM whitespace removal. So I don’t need =M-SPC=, =M-\= and =C-x o= ;; for similar things any more. @@ -809,7 +809,7 @@ :bind ("M-SPC" . shrink-whitespace)) ;; #+END_SRC -;;;;;; Tramp +;;;;; Tramp ;; Tramp is awesome. It makes SSH feel Unix-y. The proxy setup is so ;; that I can sudo on remote machines @@ -837,7 +837,7 @@ (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil)))) ;; #+END_SRC -;;;;;; ediff +;;;;; ediff ;; I like a horizonal diff setup, with everything in one frame. @@ -849,7 +849,7 @@ ediff-window-setup-function 'ediff-setup-windows-plain))) ;; #+END_SRC -;;;;; Indentation +;;;; Indentation ;; Ah, a complicated topic. One day we’ll all be using elastic ;; tabstops. I’ve recently switched to using two spaces, since elastic @@ -862,7 +862,7 @@ ;; #+END_SRC -;;;;;; smart-tabs-mode +;;;;; smart-tabs-mode ;; Not related to [[smart-tab][=smart-tab=]], this mode indents with tabs and aligns ;; with spaces. Perfect! @@ -876,7 +876,7 @@ (smart-tabs-mode indent-tabs-mode)))) ;; #+END_SRC -;;;;;; editorconfig +;;;;; editorconfig ;; #+BEGIN_SRC emacs-lisp (use-package editorconfig @@ -887,7 +887,7 @@ :config (editorconfig-mode 1)) ;; #+END_SRC -;;;;;; dtrt-indent-mode +;;;;; dtrt-indent-mode ;; Sometimes people use different indentation settings. [[https://github.com/jscheid/dtrt-indent][dtrt-indent]] ;; guesses the correct settings for me. @@ -903,9 +903,9 @@ (smart-tabs-mode (or indent-tabs-mode -1))))) ;; #+END_SRC -;;;;; Security +;;;; Security -;;;;;; password-store +;;;;; password-store ;; This is a frontend to the GPG-powered =pass= program. ;; #+BEGIN_SRC emacs-lisp @@ -914,9 +914,9 @@ :config (progn (setq password-store-password-length 16))) ;; #+END_SRC -;;;;; Buffers +;;;; Buffers -;;;;;; Ibuffer +;;;;; Ibuffer ;; Ibuffer is quite nice for listing all buffers. ;; #+BEGIN_SRC emacs-lisp @@ -952,7 +952,7 @@ filename-and-process))))) ;; #+END_SRC -;;;;;; Relative Buffer names +;;;;; Relative Buffer names ;; #+BEGIN_SRC emacs-lisp (use-package relative-buffers @@ -960,7 +960,7 @@ :config (progn (global-relative-buffers-mode))) ;; #+END_SRC -;;;;;; Narrowing +;;;;; Narrowing ;; Enable it without prompting @@ -970,7 +970,7 @@ (put 'narrow-to-region 'disabled nil) ;; #+END_SRC -;;;;;; ace-window +;;;;; ace-window ;; I don’t often have many windows open at once, but when I do, ;; =ace-window= is really nice to jump around them in the same way that @@ -993,7 +993,7 @@ aw-keys '(?a ?r ?s ?t ?n ?e ?i ?o)))) ;; #+END_SRC -;;;;; Windows +;;;; Windows ;; Scrolling is tricky. I use this setup to help me keep track of the ;; point whilst I’m moving about. @@ -1010,7 +1010,7 @@ (setq ns-pop-up-frames nil)) ;; #+END_SRC -;;;;;; eyebrowse +;;;;; eyebrowse ;; Workspaces, a bit like dwm. On Windows and Linux (at least the WMs ;; I'm likely to use), super+{0-9} are taken from the OS, so use meta @@ -1047,9 +1047,9 @@ (eyebrowse-mode +1))) ;; #+END_SRC -;;;;; Sessions +;;;; Sessions -;;;;;; Desktop +;;;;; Desktop ;; Save my Emacs session and restore it on startup. ;; #+BEGIN_SRC emacs-lisp @@ -1068,7 +1068,7 @@ (desktop-save-mode 1))) ;; #+END_SRC -;;;;;; winner +;;;;; winner ;; Undo, for window-based commands. @@ -1079,7 +1079,7 @@ (winner-mode 1))) ;; #+END_SRC -;;;;;; windmove +;;;;; windmove ;; Directional window movement @@ -1090,7 +1090,7 @@ ("S-" . windmove-up) ("S-" . windmove-down))) ;; #+END_SRC -;;;;; Blogging +;;;; Blogging ;; I have a [[https://alanpearce.uk][blog]] that I publish with hugo. @@ -1101,7 +1101,7 @@ easy-hugo-default-ext ".md")) ;; #+END_SRC -;;;;; Completion +;;;; Completion ;; Make built-in completion a bit more intelligent, by adding substring ;; and initial-based completion and ignoring case. @@ -1112,7 +1112,7 @@ tab-always-indent 'complete) ;; #+END_SRC -;;;;;; Company +;;;;; Company ;; The main choices for automatic completion in Emacs are company and ;; auto-complete-mode. I’ve not tried auto-complete-mode as company @@ -1146,9 +1146,9 @@ :after company) ;; #+END_SRC -;;; ** Dates & Times +;;;; Dates & Times -;;;;;; Calendar +;;;;; Calendar ;; Weeks start on Monday for me and I prefer ISO-style dates. ;; #+BEGIN_SRC emacs-lisp @@ -1187,7 +1187,7 @@ With two prefix arguments, write out the day and month name." (timer-relative-time (current-time) -86400)) ;; #+END_SRC -;;;;; Directories +;;;; Directories ;; Dired works quite nicely, but not always in the way I want. I don’t ;; like having so many prompts for recursive operations. Also, when I @@ -1254,7 +1254,7 @@ With two prefix arguments, write out the day and month name." (bind-key "i" #'dired-subtree-toggle dired-mode-map)))) ;; #+END_SRC -;;;;;; Disk usage +;;;;; Disk usage ;; Combine dired and du (disk usage). @@ -1265,7 +1265,7 @@ With two prefix arguments, write out the day and month name." (setq dired-du-size-format t))) ;; #+END_SRC -;;;;;; Dired-narrow +;;;;; Dired-narrow ;; One can already use dired with wildcards to browse a filtered ;; directory listing, but it opens a new buffer. Dired-narrow is a ;; slightly nicer interface: with a currently-open dired buffer, use =/= @@ -1279,15 +1279,15 @@ With two prefix arguments, write out the day and month name." ("/" . dired-narrow)))) ;; #+END_SRC -;;;;; Documentation +;;;; Documentation -;;;;;; helpful +;;;;; helpful ;; #+BEGIN_SRC emacs-lisp (use-package helpful) ;; #+END_SRC -;;;;;; ehelp +;;;;; ehelp ;; ehelp is a less well-known package that’s part of Emacs and slightly ;; improves the normal help commands, mostly by making quitting them easier. @@ -1297,7 +1297,7 @@ With two prefix arguments, write out the day and month name." :bind-keymap ("C-h" . ehelp-map)) ;; #+END_SRC -;;;;;; discover-my-major +;;;;; discover-my-major ;; A nicer way to browse keybindings for major modes. @@ -1306,7 +1306,7 @@ With two prefix arguments, write out the day and month name." :bind ("" . discover-my-major)) ;; #+END_SRC -;;;;;; which-key +;;;;; which-key ;; Popup keybindings following a prefix automatically. @@ -1318,7 +1318,7 @@ With two prefix arguments, write out the day and month name." (which-key-setup-side-window-right-bottom))) ;; #+END_SRC -;;;;;; eldoc +;;;;; eldoc ;; Documentation in the echo-area (where the minibuffer is displayed) is ;; rather useful. @@ -1331,9 +1331,9 @@ With two prefix arguments, write out the day and month name." (setq eldoc-idle-delay 0.1) (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) ;; #+END_SRC -;;;;; Mail +;;;; Mail -;;;;;; Basics +;;;;; Basics ;; #+BEGIN_SRC emacs-lisp (with-eval-after-load "mailcap" @@ -1348,7 +1348,7 @@ With two prefix arguments, write out the day and month name." (setq mml-secure-openpgp-encrypt-to-self t)) ;; #+END_SRC -;;;;;; mu +;;;;; mu ;; #+BEGIN_SRC emacs-lisp (when (executable-find "mu") @@ -1448,7 +1448,7 @@ With two prefix arguments, write out the day and month name." (local-set-key (kbd "") 'shr-previous-link))))) ;; #+END_SRC -;;;;; Misc +;;;; Misc ;; #+BEGIN_SRC emacs-lisp (defvar *init-file* @@ -1500,7 +1500,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (bind-key* "C-x r M-w" #'copy-rectangle) ;; #+END_SRC -;;;;;; Auxillary Configuration +;;;;; Auxillary Configuration ;; #+BEGIN_SRC emacs-lisp (require 'pinentry) @@ -1563,7 +1563,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'first-frame-hook #'load-private-data) ;; #+END_SRC -;;;;; Minibuffer +;;;; Minibuffer ;; Sometimes I want to use the minibuffer, but I’m already inside it. ;; Fortunately, this is possible. Of course, I need to know how many @@ -1587,7 +1587,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (defalias 'exit-emacs #'save-buffers-kill-emacs)) ;; #+END_SRC -;;;;;; swiper/ivy +;;;;; swiper/ivy ;; Ivy is the new kid on the completion block. It seems to be a strong ;; replacement for helm so far. @@ -1610,7 +1610,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-to-list 'ivy-initial-inputs-alist '(counsel-M-x . "")))) ;; #+END_SRC -;;;;;; counsel +;;;;; counsel ;; #+BEGIN_SRC emacs-lisp (use-package counsel @@ -1633,7 +1633,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; #+END_SRC -;;;;;; smex +;;;;; smex ;; Smex is my favourite way to use =M-x=. Counsel’s =counsel-M-x= ;; function uses it internally, so I’m keeping it around, even though I @@ -1658,7 +1658,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." "smex-items")))) ;; #+END_SRC -;;;;;; cmd-to-echo +;;;;; cmd-to-echo ;; I’ve been looking for some way to run programming projects (mostly ;; node.js) inside emacs. =cmd-to-echo= seems great for this, as new @@ -1669,7 +1669,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :commands (cmd-to-echo) :config (setq cmd-to-echo-add-output-to-process-buffers t)) ;; #+END_SRC -;;;;; Modes +;;;; Modes ;; Setup some modes for systemd files ;; #+BEGIN_SRC emacs-lisp @@ -1744,7 +1744,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-to-list 'auto-mode-alist '("\\.sls\\'" . saltstack-mode)) ;; #+END_SRC -;;;;;; ledger +;;;;; ledger ;; I use [[http://ledger-cli.org/][=ledger=]] to manage my finances. It has an Emacs mode, which ;; works really nicely. @@ -1787,7 +1787,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ("account" "ledger -f %(ledger-file) reg %(account)"))))) ;; #+END_SRC -;;;;;; Beancount +;;;;; Beancount ;; #+BEGIN_SRC emacs-lisp (let ((beancount-dir (car (split-string (shell-command-to-string "ghq list --full-path blais/beancount"))))) @@ -1803,7 +1803,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :config (setq beancount-use-ido nil)))) ;; #+END_SRC -;;;;;; Markdown +;;;;; Markdown ;; #+BEGIN_SRC emacs-lisp (use-package markdown-mode @@ -1812,7 +1812,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) ;; #+END_SRC -;;;;;; Outshine +;;;;; Outshine ;; Org-ified source code. I think this might work better than ;; lentic-mode, whilst also being more general. @@ -1829,7 +1829,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'sh-mode-hook #'outline-minor-mode))) ;; #+END_SRC -;;;;;; Org +;;;;; Org ;; Org is wünderbar. @@ -1889,7 +1889,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (bind-key "C-x C-s" #'org-edit-src-exit org-src-mode-map))) ;; #+END_SRC -;;;;;;;* org-babel +;;;;;;; org-babel ;; Org’s babel feature is really nice. I use it for this file, and I can ;; use it to communicate between programming languages. Sometime I hope @@ -1909,7 +1909,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." org-src-preserve-indentation t))) ;; #+END_SRC -;;;;;;;* org-journal +;;;;;;; org-journal ;; I can use this to keep a journal. I should use it. @@ -1935,13 +1935,13 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; #+END_SRC -;;;;; Programming +;;;; Programming (define-hook-helper prog-mode () :name long-lines (setq-local truncate-lines t)) -;;;;;; flycheck +;;;;; flycheck ;; On-the-fly error checking in programming modes? Yes please. @@ -1960,7 +1960,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (setq flycheck-javascript-eslint-executable "eslint_d")))) ;; #+END_SRC -;;;;;;; flycheck-pos-tip +;;;;;; flycheck-pos-tip ;; Show flycheck errors in a little popup, so I don't lose my place @@ -1972,7 +1972,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (flycheck-pos-tip-mode 1))) ;; #+END_SRC -;;;;;;; flycheck-flow +;;;;;; flycheck-flow ;; #+BEGIN_SRC emacs-lisp (use-package flycheck-flow @@ -1982,7 +1982,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (flycheck-add-next-checker 'javascript-eslint 'javascript-flow))) ;; #+END_SRC -;;;;;; golang +;;;;; golang ;; Go has a few packages to inter-operate with other emacs packages. @@ -2009,7 +2009,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; #+END_SRC -;;;;;; ggtags +;;;;; ggtags ;; A nice completion backend for programming modes. @@ -2027,7 +2027,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'c-mode-common-hook #'turn-on-ggtags-mode))) ;; #+END_SRC -;;;;;; dumb-jump +;;;;; dumb-jump ;; A "clever" way of implementing go-to-definition across languages: use ;; a project-wide text search and apply heuristics to the results to @@ -2042,7 +2042,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :config (setq dumb-jump-selector 'ivy)) ;; #+END_SRC -;;;;;; imenu-anywhere +;;;;; imenu-anywhere ;; This is like imenu, but shows functions (or similar top-level ;; entities) across buffers in the same project. Neat! @@ -2051,9 +2051,9 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (use-package imenu-anywhere :bind ("C-x C-." . ivy-imenu-anywhere)) ;; #+END_SRC -;;;;;; Lisps +;;;;; Lisps -;;;;;;; All +;;;;;; All ;; Lisp modes don’t seem to have a common ancestor. So I made a custom ;; hook which I trigger in every lispy-mode. @@ -2072,7 +2072,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (run-hooks 'lisp-mode-common-hook)) ;; #+END_SRC -;;;;;;;* Redshank +;;;;;;; Redshank ;; Lisp syntax allows for really easy refactoring. Redshank gives some ;; operations that aren’t part of paredit, like extracting variables into @@ -2085,7 +2085,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'lisp-mode-common-hook #'turn-on-redshank-mode))) ;; #+END_SRC -;;;;;;; Emacs Lisp +;;;;;; Emacs Lisp ;; Customise the modeline-display of =emacs-lisp-mode=. Then make sure ;; it runs the common lisp hooks. @@ -2115,7 +2115,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (run-hooks 'lisp-mode-common-hook)))) ;; #+END_SRC -;;;;;;; Scheme & Lisp +;;;;;; Scheme & Lisp ;; I don’t work with these as often as I would like @@ -2125,7 +2125,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." #'common-lisp-indent-function)) ;; #+END_SRC -;;;;;;;* geiser +;;;;;;; geiser ;; A REPL thing for Scheme. Hopefully I’ll get to use it more in the ;; future. @@ -2138,7 +2138,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." run-racket)) ;; #+END_SRC -;;;;;;;* slime +;;;;;;; slime ;; A REPL thing (and more) for Lisp. @@ -2155,7 +2155,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (executable-find "ccl64"))))) ;; #+END_SRC -;;;;;;; Clojure +;;;;;; Clojure ;; #+BEGIN_SRC emacs-lisp (use-package clojure-mode @@ -2174,7 +2174,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (clj-refactor-mode 1)))) ;; #+END_SRC -;;;;;;;* cider +;;;;;;; cider ;; A REPL thing for Clojure @@ -2187,7 +2187,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'cider-mode-hook #'eldoc-mode))) ;; #+END_SRC -;;;;;; Auto-compile +;;;;; Auto-compile ;; Auto-compile emacs lisp when saving. ;; #+BEGIN_SRC emacs-lisp @@ -2196,7 +2196,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) ;; #+END_SRC -;;;;;; cc-mode +;;;;; cc-mode ;; Although I don’t use C or C++, setting up the mode is helpful because ;; quite a few other modes are derived from it. @@ -2212,7 +2212,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (c-set-offset 'case-label '+))) ;; #+END_SRC -;;;;;; quickrun +;;;;; quickrun ;; It’s nice to be able to quickly evaluate some code. Although I don’t ;; really seem to use it. @@ -2221,7 +2221,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :bind (("C-c C-e" . quickrun))) ;; #+END_SRC -;;;;;; Scala +;;;;; Scala ;; Let’s try using Scala. @@ -2235,9 +2235,9 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (use-package ensime) ;; #+END_SRC -;;;;;; Web development +;;;;; Web development -;;;;;;; js2-mode +;;;;;; js2-mode ;; This mode is really great for editing Javascript. It turns code into ;; an AST internally, so it can work with it almost like a lisp. @@ -2263,7 +2263,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." js2-strict-missing-semi-warning nil))) ;; #+END_SRC -;;;;;;;* rjsx-mode +;;;;;;; rjsx-mode ;; A set of advice for js2-jsx-mode to work better with React. @@ -2274,7 +2274,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :mode (("\\.jsx\\'" . rjsx-mode))) ;; #+END_SRC -;;;;;;;* js2-refactor +;;;;;;; js2-refactor ;; Thanks to the AST provided by js2-mode, refactoring is possible. This ;; library implements some refactorings. @@ -2289,7 +2289,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (js2r-add-keybindings-with-prefix "C-c C-m"))) ;; #+END_SRC -;;;;;;;* add-node-modules-path +;;;;;;; add-node-modules-path ;; Inside a javascript project, it's common to install tools locally to ;; the project. This will allows emacs to find their executables. @@ -2305,7 +2305,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (setq flycheck-javascript-standard-executable "standard"))))) ;; #+END_SRC -;;;;;;;* Flow +;;;;;;; Flow ;; #+BEGIN_SRC emacs-lisp (use-package flow-minor-mode @@ -2314,7 +2314,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'js2-mode-hook #'flow-minor-enable-automatically))) ;; #+END_SRC -;;;;;;;* Indium +;;;;;;; Indium ;; Javascript with an inferior node.js process and a debugger? Awesome. @@ -2339,7 +2339,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'js2-mode-hook #'indium-interaction-mode))) ;; #+END_SRC -;;;;;;; tern +;;;;;; tern ;; Tern understands javascript. It adds really clever documented ;; completions, besides other IDE-like things. @@ -2360,7 +2360,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (use-package company-tern)) ;; #+END_SRC -;;;;;;; json-mode +;;;;;; json-mode ;; #+BEGIN_SRC emacs-lisp (use-package json-mode @@ -2370,7 +2370,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ("\\.tern-project\\'" . json-mode))) ;; #+END_SRC -;;;;;;; restclient +;;;;;; restclient ;; Restclient is really nice. It’s like a scratchpad for HTTP api ;; calls. Feels a bit like using =org-babel=. I wonder if there’s an @@ -2391,7 +2391,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :init (add-to-list 'company-backends #'company-restclient t)) ;; #+END_SRC -;;;;;;; sgml-mode +;;;;;; sgml-mode ;; This is for HTML, since old versions of HTML were derived from SGML. ;; #+BEGIN_SRC emacs-lisp @@ -2400,7 +2400,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :config (setq sgml-basic-offset 2)) ;; #+END_SRC -;;;;;;; emmet-mode +;;;;;; emmet-mode ;; Emmet is really nice to write HTML quickly. Especially with ;; frameworks that require multiple nested elements to do anything useful. @@ -2416,7 +2416,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'css-mode-hook #'emmet-mode))) ;; #+END_SRC -;;;;;;; web-mode +;;;;;; web-mode ;; This mode handles just about every templating language out ther, which ;; is really nice, because it handles the HTML part the same way in all @@ -2441,7 +2441,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (sp-local-pair '(web-mode) "<%" "%>"))) ;; #+END_SRC -;;;;;; Live coding +;;;;; Live coding ;; Sometimes I might want to show off my emacs usage. @@ -2459,7 +2459,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (global-command-log-mode -1)) ;; #+END_SRC -;;;;;;; command-log-mode +;;;;;; command-log-mode ;; #+BEGIN_SRC emacs-lisp (use-package command-log-mode @@ -2470,7 +2470,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." command-log-mode-is-global t))) ;; #+END_SRC -;;;;; Spelling +;;;; Spelling ;; #+BEGIN_SRC emacs-lisp (use-package ispell @@ -2534,7 +2534,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'prog-mode-hook #'flyspell-prog-mode))) ;; #+END_SRC -;;;;;; Style checking +;;;;; Style checking ;; [[https://github.com/ValeLint/vale][Vale]] is a linter, but for prose. Neat idea! Salesman is a bad term. @@ -2547,7 +2547,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (flycheck-vale-setup))) ;; #+END_SRC -;;;;; Scripting +;;;; Scripting ;; Make a shell-script buffer executable after saving it, if it has a shebang. @@ -2568,7 +2568,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) ;; #+END_SRC -;;;;;; eshell +;;;;; eshell ;; I should try to get into the habit of using this more. It’s really ;; nice, when I remember to use it. @@ -2611,7 +2611,7 @@ Pass optional ARG to `eshell' (which see)." ;; #+END_SRC -;;;;;;; Shells +;;;;;; Shells ;; #+BEGIN_SRC emacs-lisp (use-package shell @@ -2634,7 +2634,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (comint-delchar-or-maybe-eof arg))) ;; #+END_SRC -;;;;; Text editing +;;;; Text editing ;; Emacs has an editor within. @@ -2646,7 +2646,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (setq-default truncate-lines nil) ;; #+END_SRC -;;;;;; align +;;;;; align ;; =Align= is a useful command to line things up, once given some rules. ;; The most important one for me is JSON property alignment. @@ -2662,7 +2662,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (modes . '(js2-mode)))))) ;; #+END_SRC -;;;;;; Clipboard +;;;;; Clipboard ;; I like to use the clipboard more than the primary selection in X11. @@ -2675,7 +2675,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))) ;; #+END_SRC -;;;;;; Selection +;;;;; Selection ;; I’m quite used to deleting text by selecting it and typing. Emacs has ;; a mode for that. @@ -2712,7 +2712,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." :config (setq expand-region-fast-keys-enabled nil)) ;; #+END_SRC -;;;;;; avy +;;;;; avy ;; Avy is a really nice way to move around files, like ace-jump-mode, but ;; somehow I prefer it. @@ -2731,7 +2731,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." avy-keys '(?a ?r ?s ?t ?d ?h ?n ?e ?i ?\;)))) ;; #+END_SRC -;;;;;;; ace-link +;;;;;; ace-link ;; Visit any link. Despite the name, this works with avy. @@ -2742,7 +2742,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (ace-link-setup-default))) ;; #+END_SRC -;;;;;; goto-chg +;;;;; goto-chg ;; This is like popping the mark, only it filters to only change areas ;; and doesn’t go back to the same place more than once. @@ -2752,7 +2752,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." :bind ("C-c C-SPC" . goto-last-change)) ;; #+END_SRC -;;;;;; beginend +;;;;; beginend ;; In special buffers, I would rather have =M->= and =M-<= goto the ;; logical beginning/end rather than the physical ones. @@ -2766,7 +2766,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." beginend-modes))) ;; #+END_SRC -;;;;;; fontawesome +;;;;; fontawesome ;; Sometimes I might want to add a font-awesome icon to some text. ;; This package gives me two interfaces to find the icons @@ -2775,7 +2775,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (use-package fontawesome) ;; #+END_SRC -;;;;;; multiple-cursors +;;;;; multiple-cursors ;; I mentioned before that I’d used Sublime Text before. Multiple ;; cursors was one of my favourite features, so I was really happy when I @@ -2791,7 +2791,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." ("C-S-L" . mc/edit-lines))) ;; #+END_SRC -;;;;;; paredit +;;;;; paredit ;; Balanced parentheses in lisps are nice, but all the refactoring and ;; movement commands are much more interesting. @@ -2806,7 +2806,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode))) ;; #+END_SRC -;;;;;; smartparens +;;;;; smartparens ;; I like to use smartparens where paredit isn’t already useful. Somehow ;; I didn’t find smartparens’ implementation of paredit style to be as @@ -2841,7 +2841,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." ;; #+END_SRC -;;;;;; move-text +;;;;; move-text ;; Transposing lines, made easier. @@ -2850,7 +2850,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." :config (move-text-default-bindings)) ;; #+END_SRC -;;;;;; undo-tree +;;;;; undo-tree ;; Emacs’ default handling of undo is a bit confusing. Undo-tree makes ;; it much clearer. It’s especially helpful for protoyping and refactoring. @@ -2873,14 +2873,14 @@ Pass ARG to `comint-delchar-or-maybe-eof'." :diminish undo-tree-mode) ;; #+END_SRC -;;;;;; replace +;;;;; replace ;; #+BEGIN_SRC emacs-lisp (with-eval-after-load "replace.el" (setq case-replace nil)) ;; #+END_SRC -;;;;;; visual-regexp +;;;;; visual-regexp ;; I don’t always remember exactly how Emacs’ regular expressions work, ;; so this package is pretty useful because it highlights everything in @@ -2893,7 +2893,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." ("C-c m" . vr/mc-mark))) ;; #+END_SRC -;;;;; End +;;;; End ;; Start a server if possible. A daemon is already a server. ;; #+BEGIN_SRC emacs-lisp -- cgit 1.4.1 From 702cd2fd8286d925f4c96ba8504a138feebc3563 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 22 Sep 2017 16:00:17 +0200 Subject: zsh: Remove gh alias --- zsh/.config/zsh/.zshrc | 1 - 1 file changed, 1 deletion(-) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 7b1249cb..3efc61a7 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -175,7 +175,6 @@ fi if [[ -n $commands[hub] ]] then alias git=hub - alias gh=hub fi if [[ -n $commands[gpg2] && -z $commands[gpg] ]] -- cgit 1.4.1 From fb4d1ccef4e3bfeafd9810271a89e8a3dc9a4cff Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 23 Sep 2017 12:48:02 +0200 Subject: npm: Sign git tags --- javascript/.npmrc | 1 + 1 file changed, 1 insertion(+) diff --git a/javascript/.npmrc b/javascript/.npmrc index 2da1b6db..19aa11ce 100644 --- a/javascript/.npmrc +++ b/javascript/.npmrc @@ -1,3 +1,4 @@ prefix=${HOME}/.local //registry.npmjs.org/:_authToken=$NPM_TOKEN @satoshipay:registry=http://registry.npmjs.org/ +sign-git-tag=true -- cgit 1.4.1 From d77a54b6eee8963ea4e9a952df90622334974604 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 23 Sep 2017 12:48:14 +0200 Subject: xresources: Remove disabled cursor line --- xresources/.xresources/main | 1 - 1 file changed, 1 deletion(-) diff --git a/xresources/.xresources/main b/xresources/.xresources/main index 8cbf2683..ae64641e 100644 --- a/xresources/.xresources/main +++ b/xresources/.xresources/main @@ -2,7 +2,6 @@ *.background: #ffffff -! Xcursor.theme: Vanilla-DMZ Xcursor.theme: Paper Xcursor.size: 22 -- cgit 1.4.1 From ac9c0574c652e41f8234c8a5782600e09d50d0fe Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 23 Sep 2017 12:50:13 +0200 Subject: Emacs: Remove unnecessary SRC blocks Outorg and friends don't seem to require them --- emacs/.emacs.d/main.el | 321 ------------------------------------------------- 1 file changed, 321 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index d07dfe1c..f27f51f4 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -12,45 +12,36 @@ ;;;; Basics ;;;;; Startup ;; Open Emacs with just a plain window. No graphics or messages, please! -;; #+BEGIN_SRC emacs-lisp (setq inhibit-startup-screen t) (setq gc-cons-threshold 100000000) (add-hook 'after-init-hook (lambda () (setq gc-cons-threshold 800000))) (remove-hook 'find-file-hooks #'vc-refresh-state) -;; #+END_SRC ;; Are we running on Windows via the WSL? -;; #+BEGIN_SRC emacs-lisp (when (file-exists-p "/proc/sys/kernel/osrelease") (with-temp-buffer (insert-file-contents-literally "/proc/sys/kernel/osrelease") (decode-coding-region (point-min) (point-max) 'utf-8 t) (when (string-match "Microsoft$" (buffer-string)) (setq system-type 'gnu/linux/windows)))) -;; #+END_SRC ;;;;; Compatibility -;; #+BEGIN_SRC emacs-lisp (if (version< emacs-version "25.0") (defmacro with-eval-after-load (file &rest body) `(eval-after-load ,file (lambda () ,@body)))) -;; #+END_SRC ;;;;; Scratch buffers ;; I usually use scratch buffers for any sort of text. If I need a ;; 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) -;; #+END_SRC ;;;;; Personal Information -;; #+BEGIN_SRC emacs-lisp (setq user-mail-address "alan@alanpearce.eu" user-full-name "Alan Pearce") ;; #+end_src @@ -59,7 +50,6 @@ ;;;;; Use-package -;; #+BEGIN_SRC emacs-lisp (eval-and-compile (require 'seq) (defun is-nix-emacs () @@ -101,7 +91,6 @@ (setq use-package-always-ensure (not nix-emacs) use-package-always-demand (daemonp) package-enable-at-startup nil) -;; #+END_SRC ;;;;; Helpers @@ -111,10 +100,8 @@ ;; modification and removal, without the boilerplate of an extra function ;; definition. -;; #+BEGIN_SRC emacs-lisp (eval-and-compile (use-package hook-helpers)) -;; #+END_SRC ;;;; Customize ;; I don’t really like using customize for normal configuration. @@ -123,22 +110,17 @@ ;; that it’s not important whether the file exists or not, which is why I ;; pass =:noerror= to =load= -;; #+BEGIN_SRC emacs-lisp (setq custom-file "~/.emacs.d/custom.el") (load custom-file :noerror :nomessage) -;; #+END_SRC ;;;; Styles ;; I prefer an always-visible cursor. Feels less distracting. -;; #+BEGIN_SRC emacs-lisp (when (fboundp #'blink-cursor-mode) (blink-cursor-mode -1)) -;; #+END_SRC ;; 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)) (with-eval-after-load 'scroll-bar @@ -147,22 +129,18 @@ (tooltip-mode -1)) (with-eval-after-load 'tool-bar (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)))) -;; #+END_SRC ;;;;; Colours ;; White-theme. Sounds like a good idea. -;; #+BEGIN_SRC emacs-lisp (use-package white-theme :if (or window-system (daemonp)) @@ -173,15 +151,12 @@ '(git-gutter-fr:modified ((t (:foreground "#b8b8b8")))) '(git-gutter-fr:deleted ((t (:foreground "#b8b8b8")))) '(font-lock-string-face ((t (:slant normal))))))) -;; #+END_SRC ;; Highlighting quasi-quoted expressions in lisps is quite useful, but I ;; don't need it all the time. I'll keep it around for a while so that I ;; can enable it if needed. -;; #+BEGIN_SRC emacs-lisp (use-package highlight-stages :diminish highlight-stages-mode) -;; #+END_SRC (global-hl-line-mode +1) @@ -189,7 +164,6 @@ ;; 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)) @@ -227,25 +201,20 @@ (ap/set-fonts "Noto Mono" 12 "Sans" 12 nil))))) (add-hook 'first-frame-hook #'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))) -;; #+END_SRC ;; Make symbols prettier. Turns out, in many cases, this is already ;; configured, just not enabled. If using the mac-port version of Emacs, ;; it has it's own, more extensive version. -;; #+BEGIN_SRC emacs-lisp (if (eq window-system 'mac) (if (fboundp 'mac-auto-operator-composition-mode) (mac-auto-operator-composition-mode +1)) (global-prettify-symbols-mode +1)) -;; #+END_SRC ;;;;; Page Breaks @@ -254,7 +223,6 @@ ;; Horizontal) can only be displayed with a different font, which is not ;; correct, at least for Liberation Mono. -;; #+BEGIN_SRC emacs-lisp (use-package page-break-lines :defer 5 :diminish page-break-lines-mode @@ -264,10 +232,8 @@ (set-fontset-font "fontset-default" (cons page-break-lines-char page-break-lines-char) (face-attribute 'default :family))))) -;; #+END_SRC ;;;;; Modeline -;; #+BEGIN_SRC emacs-lisp (column-number-mode -1) (line-number-mode -1) (size-indication-mode t) @@ -276,13 +242,11 @@ (setq frame-title-format (list "Emacs" '(buffer-file-name " — %f") '(dired-directory (" — " dired-directory)))) -;; #+END_SRC ;;;;; Chrome ;; Sometimes I like to hide clutter. Other times, it's useful. -;; #+BEGIN_SRC emacs-lisp (defvar mode-line-default-format mode-line-format) (defvar mode-line-default-hidden nil "Whether to hide the mode line by default.") @@ -334,25 +298,21 @@ (add-hook 'minibuffer-setup-hook #'show-mode-line) (add-hook 'minibuffer-exit-hook #'hide-mode-line) -;; #+END_SRC ;;;;; Highlight Changes ;; 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))) -;; #+END_SRC ;;;;; Renaming major modes ;; Diminishing major modes does not happen in the same manner as minor ;; modes. -;; #+BEGIN_SRC emacs-lisp (unless (version<= emacs-version "24.4") (use-package cyphejor :defer 2 @@ -369,7 +329,6 @@ ("mode" "") ("shell" "sh" :postfix))) (cyphejor-mode 1)))) -;; #+END_SRC ;;;; Environment Variables @@ -382,7 +341,6 @@ ;; On Windows, I like to run Emacs from the system tray menu of VcXsrv. ;; It starts up without an environment in this case as well. -;; #+BEGIN_SRC emacs-lisp (use-package exec-path-from-shell :if (or (eq system-type 'darwin) (eq system-type 'gnu/linux/windows) @@ -391,7 +349,6 @@ :config (progn (setq exec-path-from-shell-arguments '("-l")) (exec-path-from-shell-initialize))) -;; #+END_SRC ;;;;; NixOS sandboxes @@ -399,7 +356,6 @@ ;; development. This package allows using tools from inside sandboxes, ;; and some convenience commands for building packages and launching shells. -;; #+BEGIN_SRC emacs-lisp (use-package nix-sandbox :defines (flycheck-command-wrapper-function flycheck-executable-find) @@ -415,7 +371,6 @@ (if (nix-current-sandbox) (nix-executable-find (nix-current-sandbox) cmd) (executable-find cmd))))))) -;; #+END_SRC ;;;; Keybindings @@ -424,7 +379,6 @@ ;; re-arrangement of modifiers on OSX: Cmd on the outside, then ;; Option/alt, then Control. -;; #+BEGIN_SRC emacs-lisp (when (eq system-type 'darwin) (set-keyboard-coding-system nil) (custom-set-variables @@ -436,9 +390,7 @@ '(mac-right-command-modifier 'left) '(mac-function-modifier 'hyper)) (unbind-key "s-x")) -;; #+END_SRC -;; #+BEGIN_SRC emacs-lisp (unbind-key "") (bind-key* "" #'compile) (bind-key* "" #'kmacro-start-macro-or-insert-counter) @@ -469,14 +421,12 @@ (bind-key* "s-," #'switch-to-dotfiles) (bind-key* "C-x M-x" #'execute-extended-command) (set-register ?z `(file . ,(expand-file-name ".config/zsh/zshrc" "~"))) -;; #+END_SRC ;;;;; Crux ;; I can replace most of the simple helper/wrapper functions in my ;; 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) @@ -488,33 +438,27 @@ :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 (defun switch-to-dotfiles () "Switch to dotfiles project." (interactive) (projectile-switch-project-by-name (car (split-string (shell-command-to-string "ghq list --full-path dotfiles"))))) -;; #+END_SRC ;;;;; The Silver Searcher -;; #+BEGIN_SRC emacs-lisp (use-package ag :defer 30 :config (setq ag-project-root-function #'projectile-project-root)) (use-package wgrep-ag :after ag) -;; #+END_SRC ;;;;; Ripgrep ;; Step over Silver Search, here comes a new challenger. -;; #+BEGIN_SRC emacs-lisp (use-package ripgrep :if (executable-find "rg")) @@ -523,14 +467,12 @@ :if (executable-find "rg") :bind (:map projectile-command-map ("s r" . projectile-ripgrep))) -;; #+END_SRC ;;;;; Projectile ;; Projectile is awesome for working in projects, especially VCS-backed ;; ones. -;; #+BEGIN_SRC emacs-lisp (add-to-list 'byte-compile-not-obsolete-funcs #'projectile-global-mode) (use-package projectile :bind (("s-p" . projectile-switch-project) @@ -600,14 +542,12 @@ "Find rg on project." (call-interactively #'counsel-projectile-rg)) (define-key projectile-mode-map [remap counsel-projectile-ag] #'counsel-projectile-rg))) -;; #+END_SRC ;;;;; vc ;; This is nice for some things that magit doesn’t do, and for those rare ;; occasions that I’m working with something other than git. -;; #+BEGIN_SRC emacs-lisp (use-package vc :defer t :bind (("C-x v C" . vc-resolve-conflicts)) @@ -616,7 +556,6 @@ (setq vc-ignore-dir-regexp (format "\\(%s\\)\\|\\(%s\\)" vc-ignore-dir-regexp tramp-file-name-regexp)))) -;; #+END_SRC ;;;;; git-gutter-fringe @@ -624,7 +563,6 @@ ;; changed. This package colours the fringe. I have it set to the right ;; fringe so it doesn’t interfere with flycheck. -;; #+BEGIN_SRC emacs-lisp (eval-when-compile (require 'fringe-helper)) (use-package git-gutter-fringe :defer 2 @@ -644,14 +582,12 @@ ".....XXX" "....XXXX") (setq git-gutter-fr:side 'right-fringe))) -;; #+END_SRC ;;;;; magit ;; Magit is my favourite way to use git. I use selective staging all the ;; 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) @@ -661,18 +597,15 @@ 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-messenger ;; Popup the last commit that changed the line at point. -;; #+BEGIN_SRC emacs-lisp (use-package git-messenger :bind* (("C-x v p" . git-messenger:popup-message)) :config (progn (setq git-messenger:use-magit-popup t))) -;; #+END_SRC ;;;;; git-timemachine @@ -681,10 +614,8 @@ ;; in the past. I often find it useful when I remember writing something ;; a particular way, but it changed later. -;; #+BEGIN_SRC emacs-lisp (use-package git-timemachine :commands git-timemachine) -;; #+END_SRC ;;;;; ghq @@ -692,10 +623,8 @@ ;; seem familiar to anyone who's used =go get= before. [[https://github.com/rcoedo/emacs-ghq][=emacs-ghq=]] is a ;; simple wrapper for it. -;; #+BEGIN_SRC emacs-lisp (use-package ghq :if (executable-find "ghq")) -;; #+END_SRC ;;;; Files @@ -704,16 +633,13 @@ ;; Auto-save everything to a temporary directory, instead of cluttering ;; 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) -;; #+END_SRC ;;;;; Backups ;; I like to keep my backups out of regular folders. I tell emacs to use ;; 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)) @@ -727,35 +653,29 @@ (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))))) -;; #+END_SRC ;;;;; Encoding ;; UTF-8 is usually appropriate. Note that =prefer-coding-system= expects ;; only a coding system, not a coding system and line ending combination. -;; #+BEGIN_SRC emacs-lisp (prefer-coding-system 'utf-8) (setq-default buffer-file-coding-system 'utf-8-auto-unix) -;; #+END_SRC ;;;;; Buffer-file management ;; Ask if I want to create a directory when it doesn’t exist. This is ;; especially nice when starting new projects. -;; #+BEGIN_SRC emacs-lisp (defun my-create-non-existent-directory () "Offer to create non-existent directories of found-file." (let ((parent-directory (file-name-directory buffer-file-name))) @@ -763,12 +683,10 @@ (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 ;; I often want to rename or delete the file that I’m currently visiting ;; with a buffer. -;; #+BEGIN_SRC emacs-lisp (defun kill-or-delete-this-buffer-dwim (&optional arg) "Kill current buffer. With prefix ARG, delete it." (interactive "P") @@ -780,13 +698,11 @@ (when (equal buf "*HTTP Response*") (other-window 1)) (kill-buffer buf))))) -;; #+END_SRC ;;;;; Whitespace ;; Show bad whitespace, so that I can fix it. -;; #+BEGIN_SRC emacs-lisp (defun show-trailing-whitespace-on () "Show trailing whitespace." (interactive) @@ -797,24 +713,20 @@ (setq-local show-trailing-whitespace nil)) (add-hook 'prog-mode-hook #'show-trailing-whitespace-on) (add-hook 'text-mode-hook #'show-trailing-whitespace-on) -;; #+END_SRC ;;;;; shrink-whitespace ;; DWIM whitespace removal. So I don’t need =M-SPC=, =M-\= and =C-x o= ;; for similar things any more. -;; #+BEGIN_SRC emacs-lisp (use-package shrink-whitespace :bind ("M-SPC" . shrink-whitespace)) -;; #+END_SRC ;;;;; Tramp ;; Tramp is awesome. It makes SSH feel Unix-y. The proxy setup is so ;; that I can sudo on remote machines -;; #+BEGIN_SRC emacs-lisp (use-package tramp :defer 7 :config (progn @@ -835,19 +747,16 @@ (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)))) -;; #+END_SRC ;;;;; ediff ;; I like a horizonal diff setup, with everything in one frame. -;; #+BEGIN_SRC emacs-lisp (use-package ediff :defer t :config (progn (setq ediff-split-window-function 'split-window-horizontally ediff-window-setup-function 'ediff-setup-windows-plain))) -;; #+END_SRC ;;;; Indentation @@ -855,11 +764,9 @@ ;; 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 2 indent-tabs-mode nil) (electric-indent-mode +1) -;; #+END_SRC ;;;;; smart-tabs-mode @@ -867,32 +774,27 @@ ;; Not related to [[smart-tab][=smart-tab=]], this mode indents with tabs and aligns ;; with spaces. Perfect! -;; #+BEGIN_SRC emacs-lisp (use-package smart-tabs-mode :defer 1 :config (progn (smart-tabs-insinuate 'c 'cperl 'python) (define-hook-helper php-mode () (smart-tabs-mode indent-tabs-mode)))) -;; #+END_SRC ;;;;; editorconfig -;; #+BEGIN_SRC emacs-lisp (use-package editorconfig :diminish editorconfig-mode :init (progn (unless (executable-find "editorconfig") (warn "Missing `editorconfig' executable."))) :config (editorconfig-mode 1)) -;; #+END_SRC ;;;;; dtrt-indent-mode ;; Sometimes people use different indentation settings. [[https://github.com/jscheid/dtrt-indent][dtrt-indent]] ;; guesses the correct settings for me. -;; #+BEGIN_SRC emacs-lisp (use-package dtrt-indent :config (progn (define-hook-helper after-change-major-mode () @@ -901,25 +803,21 @@ (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 ;;;;; password-store ;; 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))) -;; #+END_SRC ;;;; Buffers ;;;;; Ibuffer ;; Ibuffer is quite nice for listing all buffers. -;; #+BEGIN_SRC emacs-lisp (use-package ibuffer :bind (("C-x C-b" . ibuffer)) :config (progn @@ -950,32 +848,26 @@ (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))) -;; #+END_SRC ;;;;; Narrowing ;; Enable it without prompting -;; #+BEGIN_SRC emacs-lisp (put 'narrow-to-defun 'disabled nil) (put 'narrow-to-page 'disabled nil) (put 'narrow-to-region 'disabled nil) -;; #+END_SRC ;;;;; ace-window ;; I don’t often have many windows open at once, but when I do, ;; =ace-window= is really nice to jump around them in the same way that ;; =ace-jump= or =avy= work. -;; #+BEGIN_SRC emacs-lisp (use-package ace-window :bind (("s-s" . ace-window)) :config (progn @@ -991,14 +883,12 @@ (?, winner-undo) (?. winner-redo)) aw-keys '(?a ?r ?s ?t ?n ?e ?i ?o)))) -;; #+END_SRC ;;;; Windows ;; Scrolling is tricky. I use this setup to help me keep track of the ;; point whilst I’m moving about. -;; #+BEGIN_SRC emacs-lisp (setq scroll-conservatively 100 scroll-margin 1 scroll-preserve-screen-position t @@ -1008,7 +898,6 @@ frame-resize-pixelwise nil) (if (boundp 'ns-pop-up-frames) (setq ns-pop-up-frames nil)) -;; #+END_SRC ;;;;; eyebrowse @@ -1017,7 +906,6 @@ ;; instead. On macOS, super makes a lot of sense, as it's used by most ;; programs to switch between program windows or views. -;; #+BEGIN_SRC emacs-lisp (use-package eyebrowse :config (progn (setq eyebrowse-new-workspace t) @@ -1045,14 +933,12 @@ ("M-8" . eyebrowse-switch-to-window-config-8) ("M-9" . eyebrowse-switch-to-window-config-9)) (eyebrowse-mode +1))) -;; #+END_SRC ;;;; Sessions ;;;;; Desktop ;; Save my Emacs session and restore it on startup. -;; #+BEGIN_SRC emacs-lisp (use-package desktop :ensure nil :config (progn @@ -1066,51 +952,42 @@ (unless (file-directory-p desktop-dirname) (make-directory desktop-dirname)) (desktop-save-mode 1))) -;; #+END_SRC ;;;;; winner ;; Undo, for window-based commands. -;; #+BEGIN_SRC emacs-lisp (use-package winner :config (setq winner-boring-buffers '("*Completions*" "*Help*" "*Apropos*" "*Buffer List*" "*info*" "*Compile-Log*")) :init (progn (winner-mode 1))) -;; #+END_SRC ;;;;; windmove ;; Directional window movement -;; #+BEGIN_SRC emacs-lisp (use-package windmove :bind* (("S-" . windmove-left) ("S-" . windmove-right) ("S-" . windmove-up) ("S-" . windmove-down))) -;; #+END_SRC ;;;; Blogging ;; I have a [[https://alanpearce.uk][blog]] that I publish with hugo. -;; #+BEGIN_SRC emacs-lisp (use-package easy-hugo :config (setq easy-hugo-basedir (car (split-string (shell-command-to-string "ghq list --full-path alanpearce.uk"))) easy-hugo-url "https://alanpearce.uk" easy-hugo-default-ext ".md")) -;; #+END_SRC ;;;; Completion ;; Make built-in completion a bit more intelligent, by adding substring ;; 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) -;; #+END_SRC ;;;;; Company @@ -1118,7 +995,6 @@ ;; auto-complete-mode. I’ve not tried auto-complete-mode as company ;; seems to work perfectly well for me. -;; #+BEGIN_SRC emacs-lisp (use-package company :commands (company-mode) :diminish " C" @@ -1139,28 +1015,22 @@ company-auto-complete-chars '(?\ ?\( ?\) ?.) company-tooltip-align-annotations t company-selection-wrap-around t))) -;; #+END_SRC -;; #+BEGIN_SRC emacs-lisp (use-package company-web :after company) -;; #+END_SRC ;;;; Dates & Times ;;;;; Calendar ;; 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))) -;; #+END_SRC ;; Sometimes I want to insert a date or time into a buffer. -;; #+BEGIN_SRC emacs-lisp (defun insert-date (prefix) "Insert the current date. With PREFIX, use British format. @@ -1179,13 +1049,10 @@ With two prefix arguments, write out the day and month name." ((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)) -;; #+END_SRC ;;;; Directories @@ -1194,7 +1061,6 @@ With two prefix arguments, write out the day and month name." ;; have two dired windows open, assume that I’m going to be ;; copying/moving files between them. -;; #+BEGIN_SRC emacs-lisp (use-package dired :defer 3 :ensure nil @@ -1210,11 +1076,9 @@ With two prefix arguments, write out the day and month name." (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 () "Enable dired-omit mode." (interactive) @@ -1231,11 +1095,9 @@ With two prefix arguments, write out the day and month name." dired-bind-jump nil)) :init (progn (add-hook 'dired-mode-hook #'turn-on-dired-omit-mode))) -;; #+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 @@ -1252,18 +1114,15 @@ With two prefix arguments, write out the day and month name." (dired-up-directory)))) (bind-key "^" #'dired-subtree-maybe-up dired-mode-map) (bind-key "i" #'dired-subtree-toggle dired-mode-map)))) -;; #+END_SRC ;;;;; Disk usage ;; Combine dired and du (disk usage). -;; #+BEGIN_SRC emacs-lisp (use-package dired-du :after dired :config (progn (setq dired-du-size-format t))) -;; #+END_SRC ;;;;; Dired-narrow ;; One can already use dired with wildcards to browse a filtered @@ -1272,70 +1131,57 @@ With two prefix arguments, write out the day and month name." ;; to start filtering, =RET= to complete the filter and =g= to refresh ;; 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)))) -;; #+END_SRC ;;;; Documentation ;;;;; helpful -;; #+BEGIN_SRC emacs-lisp (use-package helpful) -;; #+END_SRC ;;;;; ehelp ;; ehelp is a less well-known package that’s part of Emacs and slightly ;; improves the normal help commands, mostly by making quitting them easier. -;; #+BEGIN_SRC emacs-lisp (use-package ehelp :bind-keymap ("C-h" . ehelp-map)) -;; #+END_SRC ;;;;; discover-my-major ;; A nicer way to browse keybindings for major modes. -;; #+BEGIN_SRC emacs-lisp (use-package discover-my-major :bind ("" . discover-my-major)) -;; #+END_SRC ;;;;; which-key ;; 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))) -;; #+END_SRC ;;;;; eldoc ;; Documentation in the echo-area (where the minibuffer is displayed) is ;; rather useful. -;; #+BEGIN_SRC emacs-lisp (use-package eldoc :commands (eldoc-mode) :diminish eldoc-mode :config (progn (setq eldoc-idle-delay 0.1) (eldoc-add-command 'paredit-backward-delete 'paredit-close-round))) -;; #+END_SRC ;;;; Mail ;;;;; Basics -;; #+BEGIN_SRC emacs-lisp (with-eval-after-load "mailcap" (when (eq system-type 'darwin) (mailcap-add-mailcap-entry "application" "pdf" '((viewer . "/usr/bin/qlmanage -p %s") (type . "application/pdf"))))) @@ -1346,11 +1192,9 @@ With two prefix arguments, write out the day and month name." (with-eval-after-load "mml-sec" (setq mml-secure-openpgp-encrypt-to-self t)) -;; #+END_SRC ;;;;; mu -;; #+BEGIN_SRC emacs-lisp (when (executable-find "mu") (add-to-list 'load-path (expand-file-name "../share/emacs/site-lisp/mu4e" @@ -1446,11 +1290,9 @@ With two prefix arguments, write out the day and month name." ;; try to emulate some of the eww key-bindings (local-set-key (kbd "") 'shr-next-link) (local-set-key (kbd "") 'shr-previous-link))))) -;; #+END_SRC ;;;; Misc -;; #+BEGIN_SRC emacs-lisp (defvar *init-file* (file-truename user-init-file) "Where the Emacs init file really is, passing through symlinks.") @@ -1498,11 +1340,9 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (bind-key* "M-!" #'shell-execute) (bind-key* "C-x r M-w" #'copy-rectangle) -;; #+END_SRC ;;;;; Auxillary Configuration -;; #+BEGIN_SRC emacs-lisp (require 'pinentry) (defvar have-private-key @@ -1561,7 +1401,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (run-at-time nil nil (lambda () (run-hooks 'first-frame-hook)))) (add-hook 'first-frame-hook #'load-private-data) -;; #+END_SRC ;;;; Minibuffer @@ -1569,30 +1408,23 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; Fortunately, this is possible. Of course, I need to know how many ;; minibuffers there are on the stack. -;; #+BEGIN_SRC emacs-lisp (setq enable-recursive-minibuffers t) (minibuffer-depth-indicate-mode t) -;; #+END_SRC ;; This avoids some issue with the minibuffer and the point being behind ;; the prompt. I don’t remember what exactly. -;; #+BEGIN_SRC emacs-lisp (setq minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)) -;; #+END_SRC ;; 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)) -;; #+END_SRC ;;;;; swiper/ivy ;; Ivy is the new kid on the completion block. It seems to be a strong ;; replacement for helm so far. -;; #+BEGIN_SRC emacs-lisp (use-package swiper :bind (("C-s" . swiper) ("C-r" . swiper) @@ -1608,11 +1440,9 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (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) @@ -1630,7 +1460,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (message "File not writable %s" buffer-file-name) (find-alternate-file (concat "/sudo::" buffer-file-name)))) (setq counsel-rg-base-command "rg -i --no-heading --line-number --hidden %s ."))) -;; #+END_SRC ;;;;; smex @@ -1639,7 +1468,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; function uses it internally, so I’m keeping it around, even though I ;; don’t use it directly. -;; #+BEGIN_SRC emacs-lisp (use-package smex :defines (smex-key-advice-ignore-menu-bar) :commands (smex @@ -1656,7 +1484,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (setq smex-history-length 100 smex-save-file (concat user-emacs-directory "smex-items")))) -;; #+END_SRC ;;;;; cmd-to-echo @@ -1664,29 +1491,22 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; node.js) inside emacs. =cmd-to-echo= seems great for this, as new ;; output pops up in the echo area. -;; #+BEGIN_SRC emacs-lisp (use-package cmd-to-echo :commands (cmd-to-echo) :config (setq cmd-to-echo-add-output-to-process-buffers t)) -;; #+END_SRC ;;;; Modes ;; Setup some modes for systemd files -;; #+BEGIN_SRC emacs-lisp (add-to-list 'auto-mode-alist '("\\.service\\'" . conf-mode)) (add-to-list 'auto-mode-alist '("\\.target\\'" . conf-mode)) (add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-mode)) -;; #+END_SRC ;; =direnv=’s files are basically shell scripts, it’s a nice way to ;; set environment variables for projects. -;; #+BEGIN_SRC emacs-lisp (add-to-list 'auto-mode-alist '("\\.envrc\\'" . sh-mode)) -;; #+END_SRC ;; Some modes that I don’t really customise much, mostly for ;; configuration files. -;; #+BEGIN_SRC emacs-lisp (use-package haskell-mode :mode (("\\.hs\\'" . haskell-mode))) @@ -1742,14 +1562,12 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (define-derived-mode saltstack-mode yaml-mode "Salt") (add-to-list 'auto-mode-alist '("\\.sls\\'" . saltstack-mode)) -;; #+END_SRC ;;;;; ledger ;; I use [[http://ledger-cli.org/][=ledger=]] to manage my finances. It has an Emacs mode, which ;; works really nicely. -;; #+BEGIN_SRC emacs-lisp (use-package ledger-mode :mode ("\\.ledger\\'" . ledger-mode) :functions ledger-report @@ -1785,11 +1603,9 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ("equity" "ledger -f %(ledger-file) equity") ("payee" "ledger -f %(ledger-file) reg @%(payee)") ("account" "ledger -f %(ledger-file) reg %(account)"))))) -;; #+END_SRC ;;;;; Beancount -;; #+BEGIN_SRC emacs-lisp (let ((beancount-dir (car (split-string (shell-command-to-string "ghq list --full-path blais/beancount"))))) (when (and beancount-dir (file-directory-p beancount-dir)) @@ -1801,23 +1617,19 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :bind (:map beancount-mode-map ("C-c d" . insert-date)) :config (setq beancount-use-ido nil)))) -;; #+END_SRC ;;;;; Markdown -;; #+BEGIN_SRC emacs-lisp (use-package markdown-mode :defer t :config (progn (add-hook 'markdown-mode-hook #'turn-on-auto-fill))) -;; #+END_SRC ;;;;; Outshine ;; Org-ified source code. I think this might work better than ;; lentic-mode, whilst also being more general. -;; #+BEGIN_SRC emacs-lisp (defvar outline-minor-mode-prefix "M-#") (use-package outshine :bind (:map outline-minor-mode-map @@ -1827,13 +1639,11 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'emacs-lisp-mode-hook #'outline-minor-mode) (add-hook 'ledger-mode-hook #'outline-minor-mode) (add-hook 'sh-mode-hook #'outline-minor-mode))) -;; #+END_SRC ;;;;; Org ;; Org is wünderbar. -;; #+BEGIN_SRC emacs-lisp (use-package org :bind (("C-c C-a" . org-agenda-list) ("C-c a" . org-agenda) @@ -1887,7 +1697,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :after org :config (progn (bind-key "C-x C-s" #'org-edit-src-exit org-src-mode-map))) -;; #+END_SRC ;;;;;;; org-babel @@ -1896,7 +1705,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; to have my =ledger= setup in an org file with some graph processing ;; with R or something. -;; #+BEGIN_SRC emacs-lisp (use-package ob-core :defer t :ensure nil @@ -1907,13 +1715,11 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (setq org-src-tab-acts-natively t org-edit-src-content-indentation 0 org-src-preserve-indentation t))) -;; #+END_SRC ;;;;;;; org-journal ;; 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 @@ -1932,7 +1738,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." "Show org-journal entry for yesterday" (interactive) (org-journal-read-or-display-entry (yesterday-time))))) -;; #+END_SRC ;;;; Programming @@ -1945,7 +1750,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; On-the-fly error checking in programming modes? Yes please. -;; #+BEGIN_SRC emacs-lisp (use-package flycheck :diminish " ✓" :defer 5 @@ -1958,35 +1762,29 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ".XXX....")) (if (executable-find "eslint_d") (setq flycheck-javascript-eslint-executable "eslint_d")))) -;; #+END_SRC ;;;;;; flycheck-pos-tip ;; Show flycheck errors in a little popup, so I don't lose my place -;; #+BEGIN_SRC emacs-lisp (use-package flycheck-pos-tip :after flycheck :config (progn (setq flycheck-display-errors-delay 0.5) (flycheck-pos-tip-mode 1))) -;; #+END_SRC ;;;;;; flycheck-flow -;; #+BEGIN_SRC emacs-lisp (use-package flycheck-flow :after js2-mode :if (executable-find "flow") :config (progn (flycheck-add-next-checker 'javascript-eslint 'javascript-flow))) -;; #+END_SRC ;;;;; golang ;; 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 @@ -2007,13 +1805,11 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (setq go-projectile-switch-gopath 'maybe))) -;; #+END_SRC ;;;;; ggtags ;; A nice completion backend for programming modes. -;; #+BEGIN_SRC emacs-lisp (use-package ggtags :if (executable-find "gtags") :commands turn-on-ggtags-mode @@ -2025,7 +1821,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (interactive) (ggtags-mode 1)) (add-hook 'c-mode-common-hook #'turn-on-ggtags-mode))) -;; #+END_SRC ;;;;; dumb-jump @@ -2033,24 +1828,20 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; a project-wide text search and apply heuristics to the results to ;; guess a definition. -;; #+BEGIN_SRC emacs-lisp (use-package dumb-jump :bind (("M-g o" . dumb-jump-go-other-window) ("M-g j" . dumb-jump-go) ("M-g x" . dumb-jump-go-prefer-external) ("M-g z" . dumb-jump-go-prefer-external-other-window)) :config (setq dumb-jump-selector 'ivy)) -;; #+END_SRC ;;;;; imenu-anywhere ;; This is like imenu, but shows functions (or similar top-level ;; entities) across buffers in the same project. Neat! -;; #+BEGIN_SRC emacs-lisp (use-package imenu-anywhere :bind ("C-x C-." . ivy-imenu-anywhere)) -;; #+END_SRC ;;;;; Lisps ;;;;;; All @@ -2058,7 +1849,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; Lisp modes don’t seem to have a common ancestor. So I made a custom ;; hook which I trigger in every lispy-mode. -;; #+BEGIN_SRC emacs-lisp (defcustom lisp-mode-common-hook nil "Hook run when entering any Lisp mode." :type 'hook @@ -2070,79 +1860,65 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." lisp-mode-hook clojure-mode-hook) (run-hooks 'lisp-mode-common-hook)) -;; #+END_SRC ;;;;;;; Redshank ;; Lisp syntax allows for really easy refactoring. Redshank gives some ;; operations that aren’t part of paredit, like extracting variables into ;; let bindings. -;; #+BEGIN_SRC emacs-lisp (use-package redshank :diminish redshank-mode :after (paredit) :config (progn (add-hook 'lisp-mode-common-hook #'turn-on-redshank-mode))) -;; #+END_SRC ;;;;;; Emacs Lisp ;; Customise the modeline-display of =emacs-lisp-mode=. Then make sure ;; it runs the common lisp hooks. -;; #+BEGIN_SRC emacs-lisp (add-hook 'emacs-lisp-mode-hook #'eldoc-mode) -;; #+END_SRC ;; 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))) -;; #+END_SRC ;; Interactive elisp -;; #+BEGIN_SRC emacs-lisp (use-package ielm :defer t :ensure nil :config (progn (define-hook-helper ielm-mode () (run-hooks 'lisp-mode-common-hook)))) -;; #+END_SRC ;;;;;; Scheme & Lisp ;; I don’t work with these as often as I would like -;; #+BEGIN_SRC emacs-lisp (define-hook-helper lisp-mode () (set (make-local-variable 'lisp-indent-function) #'common-lisp-indent-function)) -;; #+END_SRC ;;;;;;; geiser ;; A REPL thing for Scheme. Hopefully I’ll get to use it more in the ;; future. -;; #+BEGIN_SRC emacs-lisp (use-package geiser :commands (geiser-mode geiser run-geiser run-racket)) -;; #+END_SRC ;;;;;;; slime ;; A REPL thing (and more) for Lisp. -;; #+BEGIN_SRC emacs-lisp (use-package slime :commands (slime) :config (progn @@ -2153,11 +1929,9 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (setq common-lisp-hyperspec-root "file://opt/local/share/doc/lisp/HyperSpec-7-0/" inferior-lisp-program (or (executable-find "sbcl") (executable-find "ccl64"))))) -;; #+END_SRC ;;;;;; Clojure -;; #+BEGIN_SRC emacs-lisp (use-package clojure-mode :defer t :init (progn @@ -2172,36 +1946,30 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :init (progn (define-hook-helper clojure-mode () (clj-refactor-mode 1)))) -;; #+END_SRC ;;;;;;; cider ;; A REPL thing for Clojure -;; #+BEGIN_SRC emacs-lisp (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))) -;; #+END_SRC ;;;;; Auto-compile ;; Auto-compile emacs lisp when saving. -;; #+BEGIN_SRC emacs-lisp (use-package auto-compile :defer t :init (add-hook 'emacs-lisp-mode-hook #'auto-compile-on-save-mode)) -;; #+END_SRC ;;;;; cc-mode ;; Although I don’t use C or C++, setting up the mode is helpful because ;; quite a few other modes are derived from it. -;; #+BEGIN_SRC emacs-lisp (use-package cc-mode :defer 5 :config (progn @@ -2210,30 +1978,23 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (other . "k&r")) c-basic-offset 4) (c-set-offset 'case-label '+))) -;; #+END_SRC ;;;;; quickrun ;; It’s nice to be able to quickly evaluate some code. Although I don’t ;; really seem to use it. -;; #+BEGIN_SRC emacs-lisp (use-package quickrun :bind (("C-c C-e" . quickrun))) -;; #+END_SRC ;;;;; Scala ;; Let’s try using Scala. -;; #+BEGIN_SRC emacs-lisp (use-package scala-mode) -;; #+END_SRC ;; And add ensime, an IDE-style environment. -;; #+BEGIN_SRC emacs-lisp (use-package ensime) -;; #+END_SRC ;;;;; Web development @@ -2242,7 +2003,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; This mode is really great for editing Javascript. It turns code into ;; an AST internally, so it can work with it almost like a lisp. -;; #+BEGIN_SRC emacs-lisp (use-package js2-mode :mode (("\\.js\\'" . js2-mode)) :interpreter ("node" . js2-mode) @@ -2261,25 +2021,21 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." js2-include-node-externs t js2-highlight-level 1 js2-strict-missing-semi-warning nil))) -;; #+END_SRC ;;;;;;; rjsx-mode ;; A set of advice for js2-jsx-mode to work better with React. -;; #+BEGIN_SRC emacs-lisp (use-package rjsx-mode :after js2-mode :if (fboundp #'js2--struct-put) :mode (("\\.jsx\\'" . rjsx-mode))) -;; #+END_SRC ;;;;;;; js2-refactor ;; Thanks to the AST provided by js2-mode, refactoring is possible. This ;; library implements some refactorings. -;; #+BEGIN_SRC emacs-lisp (use-package js2-refactor :after js2-mode :diminish js2-refactor-mode @@ -2287,14 +2043,12 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (bind-key "C-k" #'js2r-kill js2-mode-map) (add-hook 'js2-mode-hook #'js2-refactor-mode) (js2r-add-keybindings-with-prefix "C-c C-m"))) -;; #+END_SRC ;;;;;;; add-node-modules-path ;; Inside a javascript project, it's common to install tools locally to ;; the project. This will allows emacs to find their executables. -;; #+BEGIN_SRC emacs-lisp (use-package add-node-modules-path :config (progn (define-hook-helper js2-mode () @@ -2303,16 +2057,13 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (setq flycheck-javascript-eslint-executable "eslint")) (when (executable-find "standard") (setq flycheck-javascript-standard-executable "standard"))))) -;; #+END_SRC ;;;;;;; Flow -;; #+BEGIN_SRC emacs-lisp (use-package flow-minor-mode :after js2-mode :config (progn (add-hook 'js2-mode-hook #'flow-minor-enable-automatically))) -;; #+END_SRC ;;;;;;; Indium @@ -2332,19 +2083,16 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; ~M-x indium-connect-to-nodejs RET 127.0.0.1 RET PORT RET~ -;; #+BEGIN_SRC emacs-lisp (use-package indium :diminish (indium-interaction-mode . "In") :config (progn (add-hook 'js2-mode-hook #'indium-interaction-mode))) -;; #+END_SRC ;;;;;; tern ;; Tern understands javascript. It adds really clever documented ;; completions, besides other IDE-like things. -;; #+BEGIN_SRC emacs-lisp (use-package tern :diminish tern-mode :if (executable-find "tern") @@ -2358,17 +2106,14 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (with-eval-after-load '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))) -;; #+END_SRC ;;;;;; restclient @@ -2376,7 +2121,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; calls. Feels a bit like using =org-babel=. I wonder if there’s an ;; integration between the two yet. -;; #+BEGIN_SRC emacs-lisp (use-package restclient :mode ("\\.api\\'" . restclient-mode) :config (progn @@ -2389,22 +2133,18 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (use-package company-restclient :after (company restclient) :init (add-to-list 'company-backends #'company-restclient t)) -;; #+END_SRC ;;;;;; sgml-mode ;; This is for HTML, since old versions of HTML were derived from SGML. -;; #+BEGIN_SRC emacs-lisp (use-package sgml-mode :defer t :config (setq sgml-basic-offset 2)) -;; #+END_SRC ;;;;;; emmet-mode ;; Emmet is really nice to write HTML quickly. Especially with ;; frameworks that require multiple nested elements to do anything useful. -;; #+BEGIN_SRC emacs-lisp (use-package emmet-mode :commands (emmet-mode) :diminish (emmet-mode . " >") @@ -2414,7 +2154,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'sgml-mode-hook #'emmet-mode) (add-hook 'web-mode-hook #'emmet-mode) (add-hook 'css-mode-hook #'emmet-mode))) -;; #+END_SRC ;;;;;; web-mode @@ -2422,7 +2161,6 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; is really nice, because it handles the HTML part the same way in all ;; of them as well. -;; #+BEGIN_SRC emacs-lisp (use-package web-mode :mode (("/views/.*\\.php\\'" . web-mode) ("\\.html\\'" . web-mode) @@ -2439,13 +2177,11 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." web-mode-enable-auto-pairing nil web-mode-enable-auto-quoting nil) (sp-local-pair '(web-mode) "<%" "%>"))) -;; #+END_SRC ;;;;; Live coding ;; Sometimes I might want to show off my emacs usage. -;; #+BEGIN_SRC emacs-lisp (defun live-coding () "Configure display for live coding." (interactive) @@ -2457,22 +2193,18 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (interactive) (ap/set-fonts-according-to-system) (global-command-log-mode -1)) -;; #+END_SRC ;;;;;; command-log-mode -;; #+BEGIN_SRC emacs-lisp (use-package command-log-mode :defines (command-log-mode-key-binding-open-log) :config (progn (setq command-log-mode-key-binding-open-log nil command-log-mode-auto-show t command-log-mode-is-global t))) -;; #+END_SRC ;;;; Spelling -;; #+BEGIN_SRC emacs-lisp (use-package ispell :bind (("" . ispell-word)) :config (progn @@ -2484,9 +2216,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ((executable-find "hunspell") (setq ispell-program-name "hunspell" ispell-really-aspell nil ispell-really-hunspell t))))) -;; #+END_SRC -;; #+BEGIN_SRC emacs-lisp (use-package flyspell :diminish " ﹏" :config (progn @@ -2532,26 +2262,22 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (setq-local ispell-extra-args (flyspell-detect-ispell-args))) (add-hook 'text-mode-hook 'fly-text-mode-hook-setup) (add-hook 'prog-mode-hook #'flyspell-prog-mode))) -;; #+END_SRC ;;;;; Style checking ;; [[https://github.com/ValeLint/vale][Vale]] is a linter, but for prose. Neat idea! Salesman is a bad term. -;; #+BEGIN_SRC emacs-lisp (use-package flycheck-vale :if (executable-find "vale") :config (progn (add-to-list 'flycheck-vale-modes 'org-mode) (add-to-list 'flycheck-vale-modes 'org-journal-mode) (flycheck-vale-setup))) -;; #+END_SRC ;;;; Scripting ;; 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) @@ -2562,18 +2288,14 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :config (setq sh-shell-file "/usr/bin/env zsh" sh-indentation 2 sh-basic-offset 2)) -;; #+END_SRC -;; #+BEGIN_SRC emacs-lisp (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) -;; #+END_SRC ;;;;; eshell ;; I should try to get into the habit of using this more. It’s really ;; nice, when I remember to use it. -;; #+BEGIN_SRC emacs-lisp (use-package eshell :bind ("C-c s" . eshell) :defer 10 @@ -2609,11 +2331,9 @@ Pass optional ARG to `eshell' (which see)." (bind-key "C-c S" #'eshell-goto-current-dir) -;; #+END_SRC ;;;;;; Shells -;; #+BEGIN_SRC emacs-lisp (use-package shell :defer t :ensure nil @@ -2632,26 +2352,22 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (if (null (get-buffer-process (current-buffer))) (kill-buffer) (comint-delchar-or-maybe-eof arg))) -;; #+END_SRC ;;;; Text editing ;; Emacs has an editor within. -;; #+BEGIN_SRC emacs-lisp (put 'upcase-region 'disabled nil) (put 'downcase-region 'disabled nil) (setq sentence-end-double-space t line-move-visual nil) (setq-default truncate-lines nil) -;; #+END_SRC ;;;;; align ;; =Align= is a useful command to line things up, once given some rules. ;; The most important one for me is JSON property alignment. -;; #+BEGIN_SRC emacs-lisp (use-package align :defer 10 :ensure nil @@ -2660,64 +2376,52 @@ Pass ARG to `comint-delchar-or-maybe-eof'." '(colon-key-value (regexp . ":\\(\\s-*\\)") (modes . '(js2-mode)))))) -;; #+END_SRC ;;;;; Clipboard ;; I like to use the clipboard more than the primary selection in X11. -;; #+BEGIN_SRC emacs-lisp (setq select-enable-clipboard t save-interprogram-paste-before-kill t) (if (functionp '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 ;;;;; Selection ;; I’m quite used to deleting text by selecting it and typing. Emacs has ;; a mode for that. -;; #+BEGIN_SRC emacs-lisp (use-package delsel :config (delete-selection-mode t)) -;; #+END_SRC ;; 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)) -;; #+END_SRC ;; I find that =zap-up-to-char= normally makes more sense to me than ;; =zap-to-char=. -;; #+BEGIN_SRC emacs-lisp (use-package misc :ensure nil :bind (("M-z" . zap-up-to-char) ("M-Z" . zap-to-char))) -;; #+END_SRC ;; Expanding the region by semantic units was something I quite liked ;; 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)) -;; #+END_SRC ;;;;; avy ;; Avy is a really nice way to move around files, like ace-jump-mode, but ;; somehow I prefer it. -;; #+BEGIN_SRC emacs-lisp (use-package avy :defer 5 :bind* (("M-g g" . avy-goto-line) @@ -2729,51 +2433,42 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (avy-setup-default) (setq avy-all-windows nil avy-keys '(?a ?r ?s ?t ?d ?h ?n ?e ?i ?\;)))) -;; #+END_SRC ;;;;;; ace-link ;; Visit any link. Despite the name, this works with avy. -;; #+BEGIN_SRC emacs-lisp (use-package ace-link :after avy :config (progn (ace-link-setup-default))) -;; #+END_SRC ;;;;; goto-chg ;; This is like popping the mark, only it filters to only change areas ;; and doesn’t go back to the same place more than once. -;; #+BEGIN_SRC emacs-lisp (use-package goto-chg :bind ("C-c C-SPC" . goto-last-change)) -;; #+END_SRC ;;;;; beginend ;; In special buffers, I would rather have =M->= and =M-<= goto the ;; logical beginning/end rather than the physical ones. -;; #+BEGIN_SRC emacs-lisp (use-package beginend :config (progn (beginend-setup-all) (seq-do (lambda (modepair) (diminish (cdr modepair))) beginend-modes))) -;; #+END_SRC ;;;;; fontawesome ;; Sometimes I might want to add a font-awesome icon to some text. ;; This package gives me two interfaces to find the icons -;; #+BEGIN_SRC emacs-lisp (use-package fontawesome) -;; #+END_SRC ;;;;; multiple-cursors @@ -2781,7 +2476,6 @@ Pass ARG to `comint-delchar-or-maybe-eof'." ;; cursors was one of my favourite features, so I was really happy when I ;; saw that multiple-cursors was released for Emacs. -;; #+BEGIN_SRC emacs-lisp (use-package multiple-cursors :defer 1 :bind* (("C-." . mc/mark-next-like-this) @@ -2789,14 +2483,12 @@ Pass ARG to `comint-delchar-or-maybe-eof'." ("M-" . mc/mark-all-like-this-dwim) ("C-" . mc/mark-more-like-this-extended) ("C-S-L" . mc/edit-lines))) -;; #+END_SRC ;;;;; paredit ;; Balanced parentheses in lisps are nice, but all the refactoring and ;; movement commands are much more interesting. -;; #+BEGIN_SRC emacs-lisp (use-package paredit :diminish "()" :config (progn @@ -2804,7 +2496,6 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (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 @@ -2812,7 +2503,6 @@ Pass ARG to `comint-delchar-or-maybe-eof'." ;; I didn’t find smartparens’ implementation of paredit style to be as ;; nice as the real version -;; #+BEGIN_SRC emacs-lisp (eval-when-compile (require 'smartparens nil :noerror)) (use-package smartparens-config :ensure smartparens @@ -2838,24 +2528,20 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (define-hook-helper lisp-mode-common () (smartparens-strict-mode -1) (smartparens-mode -1)))) -;; #+END_SRC ;;;;; move-text ;; Transposing lines, made easier. -;; #+BEGIN_SRC emacs-lisp (use-package move-text :config (move-text-default-bindings)) -;; #+END_SRC ;;;;; undo-tree ;; Emacs’ default handling of undo is a bit confusing. Undo-tree makes ;; 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) @@ -2871,14 +2557,11 @@ Pass ARG to `comint-delchar-or-maybe-eof'." (set-marker m nil)) ad-do-it))) :diminish undo-tree-mode) -;; #+END_SRC ;;;;; replace -;; #+BEGIN_SRC emacs-lisp (with-eval-after-load "replace.el" (setq case-replace nil)) -;; #+END_SRC ;;;;; visual-regexp @@ -2886,23 +2569,19 @@ Pass ARG to `comint-delchar-or-maybe-eof'." ;; so this package is pretty useful because it highlights everything in ;; 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" . vr/mc-mark))) -;; #+END_SRC ;;;; End ;; Start a server if possible. A daemon is already a server. -;; #+BEGIN_SRC emacs-lisp (use-package server :defer 2 :if (not (daemonp)) :config (unless (server-running-p server-name) (server-start))) -;; #+END_SRC ;; # Local Variables: ;; # lentic-init: lentic-orgel-org-init -- cgit 1.4.1 From 740cbaf687d64c3a026124c39a46055b6aa062de Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 23 Sep 2017 13:11:05 +0200 Subject: Git: Sign commits by default --- git/.config/git/config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/git/.config/git/config b/git/.config/git/config index d5e6abb9..da295997 100644 --- a/git/.config/git/config +++ b/git/.config/git/config @@ -47,3 +47,5 @@ cmd = icdiff --line-numbers $LOCAL $REMOTE [gpg] program = gpg +[commit] + gpgsign = true -- cgit 1.4.1 From 8e49ad077c69d1bee7358f916f9046a3340558ec Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 23 Sep 2017 13:12:53 +0200 Subject: Emacs: Enable navi-mode --- emacs/.emacs.d/main.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index f27f51f4..ca0ec4e4 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1640,6 +1640,8 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'ledger-mode-hook #'outline-minor-mode) (add-hook 'sh-mode-hook #'outline-minor-mode))) +(use-package navi-mode) + ;;;;; Org ;; Org is wünderbar. -- cgit 1.4.1 From 9a875c4c1da6dc78fc78ddc9262106c52788f65f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 23 Sep 2017 17:36:11 +0200 Subject: xresources: Tweak font sizes again... --- xresources/.xresources/main | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xresources/.xresources/main b/xresources/.xresources/main index ae64641e..821392d7 100644 --- a/xresources/.xresources/main +++ b/xresources/.xresources/main @@ -22,17 +22,17 @@ URxvt.scrollTtyKeypress: true URxvt.saveLines: 16384 URxvt.secondaryScroll: false -URxvt.font: xft:monospace:size=11 -URxvt.boldFont: xft:monospace:bold:size=11 +URxvt.font: xft:monospace:size=10 +URxvt.boldFont: xft:monospace:bold:size=10 URxvt.intensityStyles: true URxvt.pointerBlank: true URxvt.pointerBlankDelay: 987654321 URxvt.letterSpace: 0 -Emacs.Font: monospace-11 -Emacs.fixed-pitch.attributeFont: monospace-11 -Emacs.variable-pitch.attributeFont: sans-11 +Emacs.Font: monospace-10 +Emacs.fixed-pitch.attributeFont: monospace-10 +Emacs.variable-pitch.attributeFont: sans-10 ! Local Variables: ! compile-command: (concat "xrdb -merge " (shell-quote-argument buffer-file-name)) -- cgit 1.4.1 From 78673c644973ad84aec8ce9935971db11f7f2f02 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 24 Sep 2017 14:49:40 +0200 Subject: Emacs: Add reload-user-init-file command --- emacs/.emacs.d/init.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 22c3f72c..643da1b8 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -11,6 +11,11 @@ (package-initialize) (require 'auto-compile nil :noerror) +(defun reload-user-init-file () + "Reload init file." + (interactive) + (load-file user-init-file)) + (when (featurep 'auto-compile) (auto-compile-on-load-mode)) -- cgit 1.4.1 From e30c3354948024bd75a57409441507b1384226b4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 24 Sep 2017 14:56:03 +0200 Subject: offlineimap: Delegate mu index update to emacs if `mu` fails When mu4e is in a context, the `mu index` postsynchook doesn't work. Since it returns an exit code, tell Emacs to update the index with the already running `mu` server instance. --- offlineimap/.offlineimaprc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/offlineimap/.offlineimaprc b/offlineimap/.offlineimaprc index c1c4e37b..db9bffb2 100644 --- a/offlineimap/.offlineimaprc +++ b/offlineimap/.offlineimaprc @@ -10,7 +10,7 @@ localrepository = alanpearce.eu-local remoterepository = alanpearce.eu-remote autorefresh = 5 quick = 2 -postsynchook = mu index --muhome=~/.cache/mu/alanpearce.eu --maildir=%(alanpearcemaildir)s --lazy-check --nocleanup --quiet +postsynchook = mu index --muhome=~/.cache/mu/alanpearce.eu --maildir=%(alanpearcemaildir)s --lazy-check --nocleanup --quiet || emacsclient -e "(mu4e-update-index)" [Repository alanpearce.eu-local] # OfflineIMAP supports Maildir, GmailMaildir, and IMAP for local repositories. @@ -35,7 +35,7 @@ localrepository = riseup.net-local remoterepository = riseup.net-remote autorefresh = 10 quick = 2 -postsynchook = mu index --muhome=~/.cache/mu/riseup.net --maildir=%(riseupmaildir)s --lazy-check --nocleanup --quiet +postsynchook = mu index --muhome=~/.cache/mu/riseup.net --maildir=%(riseupmaildir)s --lazy-check --nocleanup --quiet || emacsclient -e "(mu4e-update-index)" [Repository riseup.net-local] type = Maildir @@ -57,7 +57,7 @@ localrepository = satoshipay.io-local remoterepository = satoshipay.io-remote autorefresh = 5 quick = 2 -postsynchook = mu index --muhome=~/.cache/mu/satoshipay.io --maildir=%(satoshipaymaildir)s --lazy-check --nocleanup --quiet +postsynchook = mu index --muhome=~/.cache/mu/satoshipay.io --maildir=%(satoshipaymaildir)s --lazy-check --nocleanup --quiet || emacsclient -e "(mu4e-update-index)" [Repository satoshipay.io-local] type = GmailMaildir -- cgit 1.4.1 From a8242c62f7f937b037f9a88023c860c201434b3e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 25 Sep 2017 15:05:50 +0200 Subject: Emacs: Use mu4e as mail agent --- emacs/.emacs.d/main.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index ca0ec4e4..6cab8612 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1216,6 +1216,7 @@ With two prefix arguments, write out the day and month name." mu4e-trash-folder mu4e-user-mail-address-list mu4e-contexts) + :init (setq mail-user-agent 'mu4e-user-agent) :config (progn (setq mu4e-use-fancy-chars nil mu4e-attachment-dir "~/Downloads/" -- cgit 1.4.1 From 90d4beb6bd40ba7bad020b988e937516139412e7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 25 Sep 2017 15:06:41 +0200 Subject: Configure mbsync --- isync/.mbsyncrc | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 isync/.mbsyncrc diff --git a/isync/.mbsyncrc b/isync/.mbsyncrc new file mode 100644 index 00000000..d357a16b --- /dev/null +++ b/isync/.mbsyncrc @@ -0,0 +1,79 @@ +# Globals +Create Both +Remove Both +CopyArrivalDate yes + +## Personal +# Account +IMAPAccount alanpearce.eu +Host mail.alanpearce.eu +User alan +PassCmd "pass show mail/alanpearce" +SSLType IMAPS +SSLVersions TLSv1.2 TLSv1.1 + +# Remote +IMAPStore alanpearce.eu-remote +Account alanpearce.eu + +# Local +MaildirStore alanpearce.eu-local +Path ~/mail/personal/alanpearce/ +Inbox ~/mail/personal/alanpearce/INBOX + +# Job +Channel personal +Master :alanpearce.eu-remote: +Slave :alanpearce.eu-local: +Patterns * +SyncState * + +## Riseup +# Account +IMAPAccount riseup.net +Host mail.riseup.net +User alanpearce +PassCmd "pass show mail/riseup" +SSLType IMAPS +SSLVersions TLSv1.2 TLSv1.1 + +# Remote +IMAPStore riseup.net-remote +Account riseup.net + +# Local +MaildirStore riseup.net-local +Path ~/mail/personal/riseup/ +Inbox ~/mail/personal/riseup/INBOX + +# Job +Channel riseup +Master :riseup.net-remote: +Slave :riseup.net-local: +Patterns * +SyncState * + +## Satoshipay +# Account +IMAPAccount satoshipay.io +Host imap.gmail.com +User alan@satoshipay.io +PassCmd "pass show satoshipay/google/app-mail" +SSLType IMAPS +SSLVersions TLSv1.2 TLSv1.1 + +# Remote +IMAPStore satoshipay.io-remote +Account satoshipay.io + +# Local +MaildirStore satoshipay.io-local +Path ~/mail/satoshipay/ +Inbox ~/mail/satoshipay/INBOX + +# Job +Channel satoshipay +Master :satoshipay.io-remote: +Slave :satoshipay.io-local: +Patterns * "[Gmail]*" +SyncState * -- cgit 1.4.1 From b5ef3b75ca57da6ebeaacc65784c0394cf8d6e37 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 25 Sep 2017 15:08:34 +0200 Subject: Emacs: Configure mu4e for mbsync compatibility --- emacs/.emacs.d/main.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 6cab8612..c293e489 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1222,7 +1222,7 @@ With two prefix arguments, write out the day and month name." mu4e-attachment-dir "~/Downloads/" mu4e-view-show-images t mu4e-headers-date-format "%Y-%m-%d %H:%M" - mu4e-update-interval 300 + mu4e-update-interval 1800 mu4e-mu-home (expand-file-name "~/.cache/mu/alanpearce.eu") mu4e-maildir (expand-file-name "~/mail/personal/alanpearce/") @@ -1231,6 +1231,8 @@ With two prefix arguments, write out the day and month name." mu4e-refile-folder "/Archive" mu4e-trash-folder "/Trash" + mu4e-change-filenames-when-moving t + message-send-mail-function #'message-send-mail-with-sendmail sendmail-program "msmtp" @@ -1275,10 +1277,10 @@ With two prefix arguments, write out the day and month name." (mu4e-maildir . ,(expand-file-name "~/mail/satoshipay")) (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/satoshipay.io")) (mu4e-sent-messages-behavior . sent) - (mu4e-drafts-folder . "/[Gmail].Drafts") - (mu4e-sent-folder . "/[Gmail].Sent Mail") - (mu4e-refile-folder . "/[Gmail].All Mail") - (mu4e-trash-folder . "/[Gmail].Bin")))) + (mu4e-drafts-folder . "/[Gmail]/.Drafts") + (mu4e-sent-folder . "/[Gmail]/.Sent Mail") + (mu4e-refile-folder . "/[Gmail]/.All Mail") + (mu4e-trash-folder . "/[Gmail]/.Bin")))) mu4e-user-mail-address-list (append (delq nil (mapcar (lambda (context) -- cgit 1.4.1 From 1b4d97aa1b1f80effa0c205b8bf6ba70dbef9fa7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 25 Sep 2017 15:08:54 +0200 Subject: Emacs: Get email per-context directly in mu4e --- emacs/.emacs.d/main.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index c293e489..c82f5e3d 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1249,6 +1249,7 @@ With two prefix arguments, write out the day and month name." (mu4e-maildir . ,(expand-file-name "~/mail/personal/alanpearce")) (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/alanpearce.eu")) (mu4e-sent-messages-behavior . sent) + (mu4e-get-mail-command . "mbsync personal") (mu4e-sent-folder . "/Sent") (mu4e-drafts-folder . "/Drafts") (mu4e-refile-folder . "/Archive") @@ -1263,6 +1264,7 @@ With two prefix arguments, write out the day and month name." (mu4e-maildir . ,(expand-file-name "~/mail/personal/riseup")) (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/riseup.net")) (mu4e-sent-messages-behavior . sent) + (mu4e-get-mail-command . "mbsync riseup") (mu4e-sent-folder . "/Sent") (mu4e-drafts-folder . "/Drafts") (mu4e-refile-folder . "/Archive") @@ -1277,6 +1279,7 @@ With two prefix arguments, write out the day and month name." (mu4e-maildir . ,(expand-file-name "~/mail/satoshipay")) (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/satoshipay.io")) (mu4e-sent-messages-behavior . sent) + (mu4e-get-mail-command . "mbsync satoshipay") (mu4e-drafts-folder . "/[Gmail]/.Drafts") (mu4e-sent-folder . "/[Gmail]/.Sent Mail") (mu4e-refile-folder . "/[Gmail]/.All Mail") -- cgit 1.4.1 From 8de306475646926afea510bbbbef1e51da9782cc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 25 Sep 2017 15:43:00 +0200 Subject: Emacs: add mu4e optimisations --- emacs/.emacs.d/main.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index c82f5e3d..2579dcf8 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1223,6 +1223,8 @@ With two prefix arguments, write out the day and month name." mu4e-view-show-images t mu4e-headers-date-format "%Y-%m-%d %H:%M" mu4e-update-interval 1800 + mu4e-index-cleanup nil + mu4e-index-lazy-check t mu4e-mu-home (expand-file-name "~/.cache/mu/alanpearce.eu") mu4e-maildir (expand-file-name "~/mail/personal/alanpearce/") -- cgit 1.4.1 From 05a4cadd32fa2ba4ac9e92c4c97f00bea12584db Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 28 Sep 2017 17:11:04 +0200 Subject: javascript: fix NPM token --- javascript/.npmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript/.npmrc b/javascript/.npmrc index 19aa11ce..a78b4a5e 100644 --- a/javascript/.npmrc +++ b/javascript/.npmrc @@ -1,4 +1,4 @@ prefix=${HOME}/.local -//registry.npmjs.org/:_authToken=$NPM_TOKEN +//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN} @satoshipay:registry=http://registry.npmjs.org/ sign-git-tag=true -- cgit 1.4.1 From e09fa05516ffc081cffb1ec55c4ef84a217ffab3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 28 Sep 2017 17:11:26 +0200 Subject: Emacs: Improve mu4e message composition --- emacs/.emacs.d/main.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 2579dcf8..b9bd6ee8 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1235,6 +1235,8 @@ With two prefix arguments, write out the day and month name." mu4e-change-filenames-when-moving t + message-kill-buffer-on-exit t + mu4e-compose-format-flowed t message-send-mail-function #'message-send-mail-with-sendmail sendmail-program "msmtp" -- cgit 1.4.1 From 6080b92b6aea07a7e7447bfc8630e4e6bb6116cc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 28 Sep 2017 17:11:44 +0200 Subject: Emacs: Improve mu4e UI --- emacs/.emacs.d/main.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index b9bd6ee8..af408e2a 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1221,6 +1221,8 @@ With two prefix arguments, write out the day and month name." (setq mu4e-use-fancy-chars nil mu4e-attachment-dir "~/Downloads/" mu4e-view-show-images t + mu4e-hide-index-messages t + mu4e-completing-read-function #'ivy-completing-read mu4e-headers-date-format "%Y-%m-%d %H:%M" mu4e-update-interval 1800 mu4e-index-cleanup nil -- cgit 1.4.1 From 13cde4dbbb5df743899f45a84d5fc0f59b615efc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 29 Sep 2017 11:06:13 +0200 Subject: Emacs: Use mu4e contexts correctly --- emacs/.emacs.d/main.el | 44 ++++++++++++++++---------------------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index af408e2a..177eefbb 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1228,12 +1228,8 @@ With two prefix arguments, write out the day and month name." mu4e-index-cleanup nil mu4e-index-lazy-check t - mu4e-mu-home (expand-file-name "~/.cache/mu/alanpearce.eu") - mu4e-maildir (expand-file-name "~/mail/personal/alanpearce/") - mu4e-sent-folder "/Sent" - mu4e-drafts-folder "/Drafts" - mu4e-refile-folder "/Archive" - mu4e-trash-folder "/Trash" + mu4e-maildir (expand-file-name "~/mail") + mu4e-mu-home (expand-file-name "~/.cache/mu") mu4e-change-filenames-when-moving t @@ -1242,7 +1238,8 @@ With two prefix arguments, write out the day and month name." message-send-mail-function #'message-send-mail-with-sendmail sendmail-program "msmtp" - mu4e-maildir-shortcuts '(("/INBOX" . ?i)) + mu4e-get-mail-command "mbsync -a" + mu4e-contexts (list (make-mu4e-context @@ -1252,14 +1249,11 @@ With two prefix arguments, write out the day and month name." (mu4e-message-contact-field-matches msg :to "alan@alanpearce\..*"))) :vars `((user-mail-address . "alan@alanpearce.eu") - (mu4e-maildir . ,(expand-file-name "~/mail/personal/alanpearce")) - (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/alanpearce.eu")) (mu4e-sent-messages-behavior . sent) - (mu4e-get-mail-command . "mbsync personal") - (mu4e-sent-folder . "/Sent") - (mu4e-drafts-folder . "/Drafts") - (mu4e-refile-folder . "/Archive") - (mu4e-trash-folder . "/Trash"))) + (mu4e-sent-folder . "/personal/alanpearce/Sent") + (mu4e-drafts-folder . "/personal/alanpearce/Drafts") + (mu4e-refile-folder . "/personal/alanpearce/Archive") + (mu4e-trash-folder . "/personal/alanpearce/Trash") (make-mu4e-context :name "Riseup" :match-func (lambda (msg) @@ -1267,14 +1261,11 @@ With two prefix arguments, write out the day and month name." (mu4e-message-contact-field-matches msg :to "alanpearce@riseup.net"))) :vars `((user-mail-address . "alanpearce@riseup.net") - (mu4e-maildir . ,(expand-file-name "~/mail/personal/riseup")) - (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/riseup.net")) (mu4e-sent-messages-behavior . sent) - (mu4e-get-mail-command . "mbsync riseup") - (mu4e-sent-folder . "/Sent") - (mu4e-drafts-folder . "/Drafts") - (mu4e-refile-folder . "/Archive") - (mu4e-trash-folder . "/Trash"))) + (mu4e-sent-folder . "/riseup/Sent") + (mu4e-drafts-folder . "/riseup/Drafts") + (mu4e-refile-folder . "/riseup/Archive") + (mu4e-trash-folder . "/riseup/Trash") (make-mu4e-context :name "Satoshipay" :match-func (lambda (msg) @@ -1282,14 +1273,11 @@ With two prefix arguments, write out the day and month name." (mu4e-message-contact-field-matches msg :to "alan@satoshipay.io"))) :vars `((user-mail-address . "alan@satoshipay.io") - (mu4e-maildir . ,(expand-file-name "~/mail/satoshipay")) - (mu4e-mu-home . ,(expand-file-name "~/.cache/mu/satoshipay.io")) (mu4e-sent-messages-behavior . sent) - (mu4e-get-mail-command . "mbsync satoshipay") - (mu4e-drafts-folder . "/[Gmail]/.Drafts") - (mu4e-sent-folder . "/[Gmail]/.Sent Mail") - (mu4e-refile-folder . "/[Gmail]/.All Mail") - (mu4e-trash-folder . "/[Gmail]/.Bin")))) + (mu4e-drafts-folder . "/satoshipay/[Gmail]/.Drafts") + (mu4e-sent-folder . "/satoshipay/[Gmail]/.Sent Mail") + (mu4e-refile-folder . "/satoshipay/[Gmail]/.All Mail") + (mu4e-trash-folder . "/satoshipay/[Gmail]/.Bin") mu4e-user-mail-address-list (append (delq nil (mapcar (lambda (context) -- cgit 1.4.1 From ae4a6f6b4e6eac58fc9283f692dd2e8d5b58ae99 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 29 Sep 2017 11:25:03 +0200 Subject: Emacs: Add contextual shortcuts for mu4e --- emacs/.emacs.d/main.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 177eefbb..93fe418f 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1254,6 +1254,12 @@ With two prefix arguments, write out the day and month name." (mu4e-drafts-folder . "/personal/alanpearce/Drafts") (mu4e-refile-folder . "/personal/alanpearce/Archive") (mu4e-trash-folder . "/personal/alanpearce/Trash") + (mu4e-maildir-shortcuts . (("/personal/alanpearce/INBOX" . ?i) + ("/personal/alanpearce/Archive" . ?s) + ("/personal/alanpearce/Sent" . ?s) + ("/personal/alanpearce/Spam" . ?p) + ("/personal/alanpearce/Orders" . ?o))) + )) (make-mu4e-context :name "Riseup" :match-func (lambda (msg) @@ -1266,6 +1272,10 @@ With two prefix arguments, write out the day and month name." (mu4e-drafts-folder . "/riseup/Drafts") (mu4e-refile-folder . "/riseup/Archive") (mu4e-trash-folder . "/riseup/Trash") + (mu4e-maildir-shortcuts . (("/personal/riseup/INBOX" . ?i) + ("/personal/riseup/Archive" . ?r) + ("/personal/riseup/Sent" . ?s) + ("/personal/riseup/Spam" . ?p))))) (make-mu4e-context :name "Satoshipay" :match-func (lambda (msg) @@ -1278,6 +1288,10 @@ With two prefix arguments, write out the day and month name." (mu4e-sent-folder . "/satoshipay/[Gmail]/.Sent Mail") (mu4e-refile-folder . "/satoshipay/[Gmail]/.All Mail") (mu4e-trash-folder . "/satoshipay/[Gmail]/.Bin") + (mu4e-maildir-shortcuts . (("/satoshipay/INBOX" . ?i) + ("/satoshipay/[Gmail]/.All Mail" . ?r) + ("/satoshipay/[Gmail]/.Sent Mail" . ?s) + ("/satoshipay/[Gmail]/.Spam" . ?p)))))) mu4e-user-mail-address-list (append (delq nil (mapcar (lambda (context) -- cgit 1.4.1 From d8b10cd59d5003030adc2f04028296de9f65f8a9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 29 Sep 2017 22:09:15 +0200 Subject: autorandr: Restart redshift without blocking --- autorandr/.config/autorandr/postswitch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autorandr/.config/autorandr/postswitch b/autorandr/.config/autorandr/postswitch index 97e4217c..76b3119e 100755 --- a/autorandr/.config/autorandr/postswitch +++ b/autorandr/.config/autorandr/postswitch @@ -13,7 +13,7 @@ esac xrandr --dpi $DPI emacsclient -e "(setq display-pixels-per-inch $DPI)" > /dev/null +systemctl --user restart redshift --no-block i3-msg restart -systemctl --user restart redshift notify-send --expire-time=5000 "Display profile: '$AUTORANDR_CURRENT_PROFILE'" -- cgit 1.4.1 From f938adf32116bc6f6042b641ea84453c069a402a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 29 Sep 2017 22:10:14 +0200 Subject: Emacs: Set mu home to default --- emacs/.emacs.d/main.el | 1 - 1 file changed, 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 93fe418f..80d4d80f 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1229,7 +1229,6 @@ With two prefix arguments, write out the day and month name." mu4e-index-lazy-check t mu4e-maildir (expand-file-name "~/mail") - mu4e-mu-home (expand-file-name "~/.cache/mu") mu4e-change-filenames-when-moving t -- cgit 1.4.1 From e6e547cb252a9ecc4d8668f529752e706b461f62 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 30 Sep 2017 10:53:58 +0200 Subject: Emacs: Increase mail check frequency --- emacs/.emacs.d/main.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 80d4d80f..1ad0cb23 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1224,7 +1224,7 @@ With two prefix arguments, write out the day and month name." mu4e-hide-index-messages t mu4e-completing-read-function #'ivy-completing-read mu4e-headers-date-format "%Y-%m-%d %H:%M" - mu4e-update-interval 1800 + mu4e-update-interval 900 mu4e-index-cleanup nil mu4e-index-lazy-check t -- cgit 1.4.1 From 01f74188c99d2cdc05fc7df412e4531fda427d67 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 1 Oct 2017 13:14:19 +0200 Subject: i3status: Add disk low space threshold --- i3/.config/i3status/config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/i3/.config/i3status/config b/i3/.config/i3status/config index 2c8217a5..51df4144 100644 --- a/i3/.config/i3status/config +++ b/i3/.config/i3status/config @@ -100,11 +100,13 @@ cpu_temperature 0 { disk "/" { prefix_type = "custom" + low_threshold = 5 format = "/ %avail" separator = false } disk "/home" { prefix_type = "custom" + low_threshold = 5 format = "/h %avail" } -- cgit 1.4.1 From 2a070ea3f04ccfe4f2fd5fd255ef4da09e7ea54f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 1 Oct 2017 13:14:56 +0200 Subject: i3status: Add 5-minute loadavg --- i3/.config/i3status/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i3/.config/i3status/config b/i3/.config/i3status/config index 51df4144..ecbef578 100644 --- a/i3/.config/i3status/config +++ b/i3/.config/i3status/config @@ -91,7 +91,7 @@ tztime local { } load { - format = "%1min" + format = "%1min %5min" } cpu_temperature 0 { -- cgit 1.4.1 From 691833dcc0e68729a63e28acd20e61f39f6407c0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 2 Oct 2017 12:38:52 +0200 Subject: Make fonts the right size across autorandr profiles --- autorandr/.config/autorandr/postswitch | 2 +- xresources/.xresources/main | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/autorandr/.config/autorandr/postswitch b/autorandr/.config/autorandr/postswitch index 76b3119e..08ce0679 100755 --- a/autorandr/.config/autorandr/postswitch +++ b/autorandr/.config/autorandr/postswitch @@ -2,7 +2,7 @@ DPI=96 case $AUTORANDR_CURRENT_PROFILE in ("laptop") - DPI=157 + DPI=144 nmcli radio wifi on ;; ("docked") diff --git a/xresources/.xresources/main b/xresources/.xresources/main index 821392d7..ae64641e 100644 --- a/xresources/.xresources/main +++ b/xresources/.xresources/main @@ -22,17 +22,17 @@ URxvt.scrollTtyKeypress: true URxvt.saveLines: 16384 URxvt.secondaryScroll: false -URxvt.font: xft:monospace:size=10 -URxvt.boldFont: xft:monospace:bold:size=10 +URxvt.font: xft:monospace:size=11 +URxvt.boldFont: xft:monospace:bold:size=11 URxvt.intensityStyles: true URxvt.pointerBlank: true URxvt.pointerBlankDelay: 987654321 URxvt.letterSpace: 0 -Emacs.Font: monospace-10 -Emacs.fixed-pitch.attributeFont: monospace-10 -Emacs.variable-pitch.attributeFont: sans-10 +Emacs.Font: monospace-11 +Emacs.fixed-pitch.attributeFont: monospace-11 +Emacs.variable-pitch.attributeFont: sans-11 ! Local Variables: ! compile-command: (concat "xrdb -merge " (shell-quote-argument buffer-file-name)) -- cgit 1.4.1 From db81c0b127dd23c71ca498aad40764bd0cb63be3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 5 Oct 2017 14:32:31 +0200 Subject: Emacs: Make yarn- commands DWIM w.r.t. yarn/npm --- emacs/.emacs.d/main.el | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 1ad0cb23..f837c836 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -490,28 +490,43 @@ (defun yarn-install (&optional arg) (interactive "P") (projectile-with-default-dir (projectile-project-root) - (cmd-to-echo "yarn" "install"))) + (cond + ((string-equal (projectile-project-type) "node-yarn") + (cmd-to-echo "yarn" "install")) + (t (cmd-to-echo "npm" "install"))))) (defun yarn-add-dev (package) (interactive "spackage: ") (projectile-with-default-dir (projectile-project-root) - (cmd-to-echo "yarn" (concat "add --dev " package)))) + (cond + ((string-equal (projectile-project-type) "node-yarn") + (cmd-to-echo "yarn" (concat "add --dev " package))) + (t (cmd-to-echo "npm" (concat "install --save-dev " package)))))) (defun yarn-add (package) (interactive "spackage: ") (projectile-with-default-dir (projectile-project-root) - (cmd-to-echo "yarn" (concat "add " package)))) + (cond + ((string-equal (projectile-project-type) "node-yarn") + (cmd-to-echo "yarn" (concat "add " package))) + (t (cmd-to-echo "npm" (concat "install --save " package)))))) (defun yarn-remove (package) (interactive "spackage: ") (projectile-with-default-dir (projectile-project-root) - (cmd-to-echo "yarn" (concat "remove " package)))) + (cond + ((string-equal (projectile-project-type) "node-yarn") + (cmd-to-echo "yarn" (concat "remove " package))) + (t (cmd-to-echo "npm" (concat "remove " package)))))) (defun yarn-run (cmd) (interactive (list (projectile-completing-read "command: " (alist-get 'scripts (json-read-file (expand-file-name "package.json" (projectile-project-root))))))) (projectile-with-default-dir (projectile-project-root) - (cmd-to-echo "yarn" (concat "run " cmd)))) + (cond + ((string-equal (projectile-project-type) "node-yarn") + (cmd-to-echo "yarn" (concat "run " cmd))) + (t (cmd-to-echo "npm" (concat "run " cmd)))))) (defun ap/open-project (&optional arg) (interactive "P") -- cgit 1.4.1 From 590c8d7e92a0dd1d7265a8661c634c70e7f8505d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 5 Oct 2017 14:32:51 +0200 Subject: Emacs: Add npx-run command for node projects --- emacs/.emacs.d/main.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index f837c836..4fa1b1a4 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -528,6 +528,11 @@ (cmd-to-echo "yarn" (concat "run " cmd))) (t (cmd-to-echo "npm" (concat "run " cmd)))))) + (defun npx-run (cmd) + (interactive "scommand: ") + (projectile-with-default-dir (projectile-project-root) + (cmd-to-echo "npx" cmd))) + (defun ap/open-project (&optional arg) (interactive "P") (let ((project-dir (projectile-completing-read -- cgit 1.4.1 From 3605ae616be961ccceef096d882a9985ebc7f0c4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 5 Oct 2017 14:33:10 +0200 Subject: Emacs: Use prettier-standard if installed --- emacs/.emacs.d/main.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 4fa1b1a4..52f6747c 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -2090,6 +2090,8 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-node-modules-path) (when (executable-find "eslint") (setq flycheck-javascript-eslint-executable "eslint")) + (when (executable-find "prettier-standard") + (setq flycheck-javascript-standard-executable "prettier-standard")) (when (executable-find "standard") (setq flycheck-javascript-standard-executable "standard"))))) -- cgit 1.4.1 From 45ceacd1cd9c1cea8d9b6a2cadb927a3269f1df1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 5 Oct 2017 20:13:19 +0200 Subject: xprofile: Remove gpg-connect-agent Superceded by gpg agents in nixos-configuration --- xprofile/.xprofile | 1 - 1 file changed, 1 deletion(-) diff --git a/xprofile/.xprofile b/xprofile/.xprofile index 4101484c..78e02b7c 100755 --- a/xprofile/.xprofile +++ b/xprofile/.xprofile @@ -1,6 +1,5 @@ #!/bin/sh xmodmap .xmodmaprc -gpg-connect-agent /bye nm-applet & if command -v autorandr then -- cgit 1.4.1 From 62d42c64813c0678ac69bd21336de5643dee626b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 6 Oct 2017 11:44:54 +0200 Subject: Mail: Update password paths again --- isync/.mbsyncrc | 4 ++-- msmtp/.msmtprc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/isync/.mbsyncrc b/isync/.mbsyncrc index d357a16b..7e6f5e14 100644 --- a/isync/.mbsyncrc +++ b/isync/.mbsyncrc @@ -8,7 +8,7 @@ CopyArrivalDate yes IMAPAccount alanpearce.eu Host mail.alanpearce.eu User alan -PassCmd "pass show mail/alanpearce" +PassCmd "pass show mail/alanpearce.eu" SSLType IMAPS SSLVersions TLSv1.2 TLSv1.1 @@ -33,7 +33,7 @@ SyncState * IMAPAccount riseup.net Host mail.riseup.net User alanpearce -PassCmd "pass show mail/riseup" +PassCmd "pass show mail/riseup.net" SSLType IMAPS SSLVersions TLSv1.2 TLSv1.1 diff --git a/msmtp/.msmtprc b/msmtp/.msmtprc index bf67ed1e..60b1ac79 100644 --- a/msmtp/.msmtprc +++ b/msmtp/.msmtprc @@ -10,7 +10,7 @@ host mail.alanpearce.eu port 587 from alan@alanpearce.eu user alan -passwordeval pass mail/alanpearce +passwordeval pass mail/alanpearce.eu account personal-uk : personal from alan@alanpearce.uk @@ -23,7 +23,7 @@ host mail.riseup.net from alanpearce@riseup.net user alanpearce port 465 -passwordeval pass mail/riseup +passwordeval pass mail/riseup.net account satoshipay host smtp.gmail.com -- cgit 1.4.1 From 93948f4b1f64732c47824e3c4b2a1bca17834dcb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 9 Oct 2017 09:57:05 +0200 Subject: Emacs: fix mu folders for Riseup --- emacs/.emacs.d/main.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 52f6747c..d138d976 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1287,10 +1287,10 @@ With two prefix arguments, write out the day and month name." msg :to "alanpearce@riseup.net"))) :vars `((user-mail-address . "alanpearce@riseup.net") (mu4e-sent-messages-behavior . sent) - (mu4e-sent-folder . "/riseup/Sent") - (mu4e-drafts-folder . "/riseup/Drafts") - (mu4e-refile-folder . "/riseup/Archive") - (mu4e-trash-folder . "/riseup/Trash") + (mu4e-sent-folder . "/personal/riseup/Sent") + (mu4e-drafts-folder . "/personal/riseup/Drafts") + (mu4e-refile-folder . "/personal/riseup/Archive") + (mu4e-trash-folder . "/personal/riseup/Trash") (mu4e-maildir-shortcuts . (("/personal/riseup/INBOX" . ?i) ("/personal/riseup/Archive" . ?r) ("/personal/riseup/Sent" . ?s) -- cgit 1.4.1 From 75ae06baf8239b9384ab6accc515aaa825194869 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 12 Oct 2017 15:22:55 +0200 Subject: git: Don't sign commits by default It's too slow with the NitroKey and probably not of that much benefit --- git/.config/git/config | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/git/.config/git/config b/git/.config/git/config index da295997..ef771932 100644 --- a/git/.config/git/config +++ b/git/.config/git/config @@ -47,5 +47,4 @@ cmd = icdiff --line-numbers $LOCAL $REMOTE [gpg] program = gpg -[commit] - gpgsign = true + -- cgit 1.4.1 From 4c695301e4759fbc25fef42d8e2d1fe430ec2549 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 13 Oct 2017 11:10:30 +0200 Subject: git: Push relevant tags by default See --follow-tags in git-push(1) --- git/.config/git/config | 1 + 1 file changed, 1 insertion(+) diff --git a/git/.config/git/config b/git/.config/git/config index ef771932..4cf2e0dc 100644 --- a/git/.config/git/config +++ b/git/.config/git/config @@ -9,6 +9,7 @@ ui = true [push] default = current + followTags = true [alias] up = merge FETCH_HEAD st = status -sb -- cgit 1.4.1 From d92c9ac5802040585d0d1bd742bd59a78c2a3922 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 13 Oct 2017 20:38:44 +0200 Subject: xprofile: Fix missing notifications Dunst wasn't being started. --- xprofile/.xprofile | 1 + 1 file changed, 1 insertion(+) diff --git a/xprofile/.xprofile b/xprofile/.xprofile index 78e02b7c..b83f94b0 100755 --- a/xprofile/.xprofile +++ b/xprofile/.xprofile @@ -6,5 +6,6 @@ then autorandr --change --force fi xrdb -I$HOME/.xresources .xresources/main +dunst & xsetroot -cursor_name left_ptr -solid '#666666' & sxhkd & -- cgit 1.4.1 From ee14f070df766bddd8710124dbcfc2737422882d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 18 Oct 2017 12:35:11 +0200 Subject: Emacs: Add npm-yarn aliases --- emacs/.emacs.d/main.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index d138d976..80ff2d5a 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -494,6 +494,7 @@ ((string-equal (projectile-project-type) "node-yarn") (cmd-to-echo "yarn" "install")) (t (cmd-to-echo "npm" "install"))))) + (defalias 'npm-install #'yarn-install) (defun yarn-add-dev (package) (interactive "spackage: ") @@ -502,6 +503,7 @@ ((string-equal (projectile-project-type) "node-yarn") (cmd-to-echo "yarn" (concat "add --dev " package))) (t (cmd-to-echo "npm" (concat "install --save-dev " package)))))) + (defalias 'npm-save-dev #'yarn-add-dev) (defun yarn-add (package) (interactive "spackage: ") @@ -510,6 +512,7 @@ ((string-equal (projectile-project-type) "node-yarn") (cmd-to-echo "yarn" (concat "add " package))) (t (cmd-to-echo "npm" (concat "install --save " package)))))) + (defalias 'npm-save #'yarn-add) (defun yarn-remove (package) (interactive "spackage: ") @@ -518,6 +521,7 @@ ((string-equal (projectile-project-type) "node-yarn") (cmd-to-echo "yarn" (concat "remove " package))) (t (cmd-to-echo "npm" (concat "remove " package)))))) + (defalias 'npm-remote #'yarn-remove) (defun yarn-run (cmd) (interactive (list @@ -527,6 +531,7 @@ ((string-equal (projectile-project-type) "node-yarn") (cmd-to-echo "yarn" (concat "run " cmd))) (t (cmd-to-echo "npm" (concat "run " cmd)))))) + (defalias 'npm-run #'yarn-run) (defun npx-run (cmd) (interactive "scommand: ") -- cgit 1.4.1 From 51fc99f1e180a30c2a7bc21517b41009fbb72f3f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 18 Oct 2017 12:35:31 +0200 Subject: Emacs: Fix flycheck setup in js2-mode --- emacs/.emacs.d/main.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 80ff2d5a..b4ddd664 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -2092,13 +2092,14 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (use-package add-node-modules-path :config (progn (define-hook-helper js2-mode () + :name node-modules-flycheck (add-node-modules-path) (when (executable-find "eslint") - (setq flycheck-javascript-eslint-executable "eslint")) + (setq-local flycheck-javascript-eslint-executable (executable-find "eslint"))) (when (executable-find "prettier-standard") - (setq flycheck-javascript-standard-executable "prettier-standard")) + (setq-local flycheck-javascript-standard-executable (executable-find "prettier-standard"))) (when (executable-find "standard") - (setq flycheck-javascript-standard-executable "standard"))))) + (setq-local flycheck-javascript-standard-executable (executable-find "standard")))))) ;;;;;;; Flow -- cgit 1.4.1 From 75c5e4df2e02756caded5047806d5e7794eea3bb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 18 Oct 2017 12:35:45 +0200 Subject: Emacs: Change mu4e shortcuts --- emacs/.emacs.d/main.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index b4ddd664..7508dd0f 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1279,10 +1279,10 @@ With two prefix arguments, write out the day and month name." (mu4e-refile-folder . "/personal/alanpearce/Archive") (mu4e-trash-folder . "/personal/alanpearce/Trash") (mu4e-maildir-shortcuts . (("/personal/alanpearce/INBOX" . ?i) - ("/personal/alanpearce/Archive" . ?s) + ("/personal/alanpearce/Archive" . ?a) ("/personal/alanpearce/Sent" . ?s) ("/personal/alanpearce/Spam" . ?p) - ("/personal/alanpearce/Orders" . ?o))) + ("/personal/alanpearce/Orders" . ?r))) )) (make-mu4e-context :name "Riseup" @@ -1297,7 +1297,7 @@ With two prefix arguments, write out the day and month name." (mu4e-refile-folder . "/personal/riseup/Archive") (mu4e-trash-folder . "/personal/riseup/Trash") (mu4e-maildir-shortcuts . (("/personal/riseup/INBOX" . ?i) - ("/personal/riseup/Archive" . ?r) + ("/personal/riseup/Archive" . ?a) ("/personal/riseup/Sent" . ?s) ("/personal/riseup/Spam" . ?p))))) (make-mu4e-context @@ -1313,7 +1313,7 @@ With two prefix arguments, write out the day and month name." (mu4e-refile-folder . "/satoshipay/[Gmail]/.All Mail") (mu4e-trash-folder . "/satoshipay/[Gmail]/.Bin") (mu4e-maildir-shortcuts . (("/satoshipay/INBOX" . ?i) - ("/satoshipay/[Gmail]/.All Mail" . ?r) + ("/satoshipay/[Gmail]/.All Mail" . ?a) ("/satoshipay/[Gmail]/.Sent Mail" . ?s) ("/satoshipay/[Gmail]/.Spam" . ?p)))))) mu4e-user-mail-address-list (append -- cgit 1.4.1 From 0a297c13575bcc98c037219017da3a2695a33eee Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 18 Oct 2017 12:35:52 +0200 Subject: Emacs: Add use-fixed-fonts function Counterpart to use-variable fonts --- emacs/.emacs.d/main.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 7508dd0f..1b30808f 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -172,6 +172,11 @@ (variable-pitch-mode) (setq cursor-type '(bar . 1))) + (defun use-fixed-fonts () + (interactive) + (variable-pitch-mode -1) + (setq cursor-type 'box)) + (defun ap/set-fonts (mono-face mono-font-size variable-face variable-font-size antialias &optional new-line-spacing) (if (boundp 'ns-antialias-text) (setq ns-antialias-text antialias)) -- cgit 1.4.1 From 83ce2da5aa4ccefd2418fc79bd34532c75b7e3a3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 18 Oct 2017 12:36:22 +0200 Subject: Git: Use github username instead of email --- git/.config/git/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git/.config/git/config b/git/.config/git/config index 4cf2e0dc..e710bbef 100644 --- a/git/.config/git/config +++ b/git/.config/git/config @@ -23,7 +23,7 @@ pr = pull-request delete-merged = "!sh -c 'git branch --merged | grep -v "\\*" | grep -v master | grep -v dev | xargs -n 1 git branch -d'" [github] - user = alan@alanpearce.eu + user = alanpearce [ghq "ssh://alanpearce.eu/"] vcs = git [includeIf "gitdir:github.com/Spotcap/"] -- cgit 1.4.1 From 92dc1beb83f9e0b56f645d7934488907389d640e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 18 Oct 2017 12:36:37 +0200 Subject: i3: Change gaps to only inner --- i3/.config/i3/config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index bc205b3b..f035ca2a 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -276,8 +276,8 @@ client.background $base07 new_window pixel 1 new_float normal hide_edge_borders both -gaps inner 5 -gaps outer 5 +gaps inner 10 +gaps outer 0 for_window [class="Pinentry$"] floating enable for_window [class="Google-chrome"] border pixel 1 -- cgit 1.4.1 From f3ae58584b0ad1c0e527fb2a5f56d25adfbccaf8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 20 Oct 2017 14:22:46 +0200 Subject: sxhkd: Cycle displays configs instead of cloning --- sxhkd/.config/sxhkd/sxhkdrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sxhkd/.config/sxhkd/sxhkdrc b/sxhkd/.config/sxhkd/sxhkdrc index ba416168..07593282 100644 --- a/sxhkd/.config/sxhkd/sxhkdrc +++ b/sxhkd/.config/sxhkd/sxhkdrc @@ -11,7 +11,7 @@ XF86MonBrightness{Down,Up} light -{U,A} 0.5% XF86Display - disper -c + disper -C # XF86WLAN -- cgit 1.4.1 From 905eb9464776c47504fef096f791e49141fa5d72 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 23 Oct 2017 14:25:33 +0200 Subject: Emacs: Open .handlebars with web-mode --- emacs/.emacs.d/main.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 1b30808f..09c7368d 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -2213,6 +2213,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :mode (("/views/.*\\.php\\'" . web-mode) ("\\.html\\'" . web-mode) ("/templates/.*\\.php\\'" . web-mode) + ("\\.handlebars\\'" . web-mode) ("\\.ejs\\'" . web-mode) ("\\.njk\\'" . web-mode)) :config (progn -- cgit 1.4.1 From a9b6773e1c864561d358405a988c27fe443b5f71 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 23 Oct 2017 14:27:09 +0200 Subject: Emacs: Configure define-word package --- emacs/.emacs.d/main.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 09c7368d..16b54059 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -2312,6 +2312,15 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (add-hook 'text-mode-hook 'fly-text-mode-hook-setup) (add-hook 'prog-mode-hook #'flyspell-prog-mode))) +;;;;; Dictionary + +;; One thing I miss from macOS is the "look up" functionality to define +;; words by a certain gesture. =define-word= can provide something +;; similar, at least in Emacs. + +(use-package define-word + :bind ("M-" . define-word-at-point)) + ;;;;; Style checking ;; [[https://github.com/ValeLint/vale][Vale]] is a linter, but for prose. Neat idea! Salesman is a bad term. -- cgit 1.4.1 From 55768649c8571f05eeac96f9ab1038ddc9721f4c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 26 Oct 2017 09:36:43 +0200 Subject: Emacs: enable completion in docker-compose files --- emacs/.emacs.d/main.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 16b54059..abec6f4d 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1556,6 +1556,11 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (use-package dockerfile-mode :mode (("Dockerfile\\'" . dockerfile-mode))) +(use-package docker-compose-mode + :mode (("docker-compose.*.yml")) + :config (progn + (add-hook 'docker-compose-mode-hook #'company-mode-on))) + (use-package nix-mode :mode (("\\.nix\\'" . nix-mode)) :config (progn -- cgit 1.4.1 From d02c49646e61d60de18fcf48f6a5f139035fa867 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 23 Oct 2017 20:52:45 +0200 Subject: Emacs: Keep package-archives even in nix-emacs --- emacs/.emacs.d/main.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index abec6f4d..5ee54d07 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -62,12 +62,12 @@ gnutls-verify-error t package-menu-async t package-user-dir (concat "~/.emacs.d/packages/" emacs-version "/elpa") - package-menu-hide-low-priority t) + package-menu-hide-low-priority t + package-archives '(("gnu" . "https://elpa.gnu.org/packages/") + ("melpa-stable" . "https://stable.melpa.org/packages/") + ("melpa" . "https://melpa.org/packages/"))) (unless nix-emacs - (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") - ("melpa-stable" . "https://stable.melpa.org/packages/") - ("melpa" . "https://melpa.org/packages/")) - package-pinned-packages '(("use-package" . melpa-stable) + (setq package-pinned-packages '(("use-package" . melpa-stable) ("diminish" . melpa-stable) ("bind-key" . melpa-stable)) package-archive-priorities '(("melpa" . 10) -- cgit 1.4.1 From 27c655106480e164f74c7f9451904d8506386325 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 2 Nov 2017 14:18:41 +0100 Subject: Emacs: Fix incorrect setup of docker-compose-mode --- emacs/.emacs.d/main.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 5ee54d07..830c4073 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1557,7 +1557,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :mode (("Dockerfile\\'" . dockerfile-mode))) (use-package docker-compose-mode - :mode (("docker-compose.*.yml")) + :mode (("docker-compose.*.yml" . docker-compose-mode)) :config (progn (add-hook 'docker-compose-mode-hook #'company-mode-on))) -- cgit 1.4.1 From 4c575b8b67e8cd75853d668581e2ea7699d62877 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 4 Nov 2017 18:00:28 +0100 Subject: Emacs: Configure spaceline --- emacs/.emacs.d/main.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 830c4073..6b987821 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -248,6 +248,12 @@ '(buffer-file-name " — %f") '(dired-directory (" — " dired-directory)))) +;;;;; Spaceline + +(use-package spaceline-config + :config (progn + (setq-default mode-line-format (spaceline-spacemacs-theme)))) + ;;;;; Chrome ;; Sometimes I like to hide clutter. Other times, it's useful. -- cgit 1.4.1 From 36218694ff7e7ae736ee3e1b9a9ecf8a04733cb0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 5 Nov 2017 21:10:58 +0100 Subject: Emacs: Fix outline-minor-mode prefix --- emacs/.emacs.d/main.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 6b987821..20143785 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1684,7 +1684,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; Org-ified source code. I think this might work better than ;; lentic-mode, whilst also being more general. -(defvar outline-minor-mode-prefix "M-#") +(defvar outline-minor-mode-prefix "\M-#") (use-package outshine :bind (:map outline-minor-mode-map ("" . outline-cycle)) -- cgit 1.4.1 From 0e542972ee5668367eadedf51874115e3add381c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 12 Nov 2017 15:56:27 +0100 Subject: i3: Don't expect startup notification from locker --- i3/.config/i3/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index f035ca2a..150c7139 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -157,7 +157,7 @@ bindsym $mod+Shift+8 move container to workspace 8 bindsym $mod+Shift+9 move container to workspace 9 bindsym $mod+Shift+0 move container to workspace 10 -bindsym $mod+l exec $Locker +bindsym $mod+l exec --no-startup-id "$Locker" # reload the configuration file bindsym $mod+Shift+c reload # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) -- cgit 1.4.1 From 4fee69b6d3873e66985e41865e435a4e66f8e0f9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 16 Nov 2017 11:14:15 +0100 Subject: Emacs: Add commands for git helpers --- emacs/.emacs.d/main.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 20143785..61da217f 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -557,6 +557,16 @@ (projectile-switch-project-by-name (expand-file-name project-dir (ghq--find-root)) arg))) + (defun git-bug (bug) + (interactive "sbug: ") + (projectile-with-default-dir (projectile-project-root) + (call-process-shell-command (concat "git bug " bug)))) + + (defun git-feature (feature) + (interactive "sfeature: ") + (projectile-with-default-dir (projectile-project-root) + (call-process-shell-command (concat "git feature " feature)))) + (setq projectile-switch-project-action #'projectile-commander projectile-completion-system 'ivy projectile-create-missing-test-files t) -- cgit 1.4.1 From ed67fa8bb1b4b253cd55801d906ac67ff6ec990f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 16 Nov 2017 12:53:53 +0100 Subject: npm: Fix yarn (!) --- javascript/.npmrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/javascript/.npmrc b/javascript/.npmrc index a78b4a5e..336eb072 100644 --- a/javascript/.npmrc +++ b/javascript/.npmrc @@ -1,4 +1,5 @@ prefix=${HOME}/.local //registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN} -@satoshipay:registry=http://registry.npmjs.org/ +@satoshipay:registry=https://registry.npmjs.org/ +always-auth=true sign-git-tag=true -- cgit 1.4.1 From b1208e513d25cecffa465ec17dfb785f91a50279 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 16 Nov 2017 12:54:36 +0100 Subject: Emacs: Add command to open pull requests --- emacs/.emacs.d/main.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 61da217f..8ac0c37d 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -567,6 +567,11 @@ (projectile-with-default-dir (projectile-project-root) (call-process-shell-command (concat "git feature " feature)))) + (defun open-pull-request () + (interactive) + (async-shell-command "hub pr")) + (defalias 'open-pr #'open-pull-request) + (setq projectile-switch-project-action #'projectile-commander projectile-completion-system 'ivy projectile-create-missing-test-files t) -- cgit 1.4.1 From 9470fce5ce8d5871ecf7a305219f8e113b34ba8d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 16 Nov 2017 16:05:38 +0100 Subject: Emacs: Re-install magithub It's not perfect, but until magit includes similar functionality, it's enough --- emacs/.emacs.d/main.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 8ac0c37d..e1d6435f 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -649,6 +649,14 @@ (add-to-list 'magit-no-confirm 'safe-with-wip)) :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) +;;;;; magithub + +(use-package magithub + :after magit + :config (progn + (magithub-feature-autoinject t) + (setq magithub-cache-refresh-seconds-plist '(:issues 600 :ci-status 180 t 120)))) + ;;;;; git-messenger ;; Popup the last commit that changed the line at point. -- cgit 1.4.1 From 5b725a3f825cffbdde7d981a0b88970cbf2764cd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 16 Nov 2017 16:06:31 +0100 Subject: nix: Remove zr It stopped building successfully and I never started using it anyway --- nix/.config/nixpkgs/config.nix | 2 -- nix/.config/nixpkgs/zr.nix | 42 ------------------------------------------ 2 files changed, 44 deletions(-) delete mode 100644 nix/.config/nixpkgs/zr.nix diff --git a/nix/.config/nixpkgs/config.nix b/nix/.config/nixpkgs/config.nix index ea6ae1aa..11d704a9 100644 --- a/nix/.config/nixpkgs/config.nix +++ b/nix/.config/nixpkgs/config.nix @@ -10,8 +10,6 @@ emacs = if stdenv.isDarwin then emacs25Macport else emacs; }; nodejs = pkgsUnstable.nodejs-8_x; - - zr = super.callPackage ./zr.nix {}; }; allowUnfree = true; diff --git a/nix/.config/nixpkgs/zr.nix b/nix/.config/nixpkgs/zr.nix deleted file mode 100644 index 1ef3e328..00000000 --- a/nix/.config/nixpkgs/zr.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ - fetchFromGitHub, - darwin, - stdenv, - rustPlatform, - cmake, - curl, - libiconv, - openssl, - zlib -}: -with rustPlatform; - -buildRustPackage rec { - name = "zr-${version}"; - version = "0.4.8"; - - src = fetchFromGitHub { - owner = "jedahan"; - repo = "zr"; - rev = "${version}"; - sha256 = "07kb8bk2zri1087dp3pk2zpqjy8rd40nw931z6nnm230ygq481zm"; - }; - - buildInputs = [ cmake curl openssl zlib libiconv ] ++ stdenv.lib.optionals stdenv.isDarwin - (with darwin.apple_sdk.frameworks; [ Security ]); - - cargoDepsHook = stdenv.lib.optionals stdenv.isDarwin '' - export OPENSSL_DIR=${openssl} - export OPENSSL_LIB_DIR=${openssl.out}/lib - export OPENSSL_INCLUDE_DIR=${openssl.dev}/include - ''; - - depsSha256 = "0cjnqilsb9la28b65j1w1n8gdr49b1d9m3z7wsl4q2w3qc42ad52"; - - meta = with stdenv.lib; { - description = "zsh plugin manager written in rust"; - homepage = https://github.com/jedahan/zr; - license = with licenses; [ unfree ]; - platforms = platforms.all; - }; -} -- cgit 1.4.1 From d4a5a7ad7aa8db917e73d5df4488a30203154c84 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 24 Nov 2017 20:54:06 +0100 Subject: Autorandr: Make satoshipad fonts the same size as marvin's --- autorandr/.config/autorandr/postswitch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autorandr/.config/autorandr/postswitch b/autorandr/.config/autorandr/postswitch index 08ce0679..76b3119e 100755 --- a/autorandr/.config/autorandr/postswitch +++ b/autorandr/.config/autorandr/postswitch @@ -2,7 +2,7 @@ DPI=96 case $AUTORANDR_CURRENT_PROFILE in ("laptop") - DPI=144 + DPI=157 nmcli radio wifi on ;; ("docked") -- cgit 1.4.1 From 1ab37d2c9820d82d21b8b447b90beae665f145d4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 24 Nov 2017 20:53:07 +0100 Subject: Xresources: Make fonts smaller They seem the same size on both laptops. Therefore, if this setup doesn't work on my docked setup, I'll have to change the DPI of those screens --- xresources/.xresources/main | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xresources/.xresources/main b/xresources/.xresources/main index ae64641e..821392d7 100644 --- a/xresources/.xresources/main +++ b/xresources/.xresources/main @@ -22,17 +22,17 @@ URxvt.scrollTtyKeypress: true URxvt.saveLines: 16384 URxvt.secondaryScroll: false -URxvt.font: xft:monospace:size=11 -URxvt.boldFont: xft:monospace:bold:size=11 +URxvt.font: xft:monospace:size=10 +URxvt.boldFont: xft:monospace:bold:size=10 URxvt.intensityStyles: true URxvt.pointerBlank: true URxvt.pointerBlankDelay: 987654321 URxvt.letterSpace: 0 -Emacs.Font: monospace-11 -Emacs.fixed-pitch.attributeFont: monospace-11 -Emacs.variable-pitch.attributeFont: sans-11 +Emacs.Font: monospace-10 +Emacs.fixed-pitch.attributeFont: monospace-10 +Emacs.variable-pitch.attributeFont: sans-10 ! Local Variables: ! compile-command: (concat "xrdb -merge " (shell-quote-argument buffer-file-name)) -- cgit 1.4.1 From 2fb03ec7e571944b66a625715c15a86714072ad9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 24 Nov 2017 20:54:56 +0100 Subject: Emacs: Configure eacl (and grep) --- emacs/.emacs.d/main.el | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index e1d6435f..268f290d 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -457,6 +457,24 @@ (interactive) (projectile-switch-project-by-name (car (split-string (shell-command-to-string "ghq list --full-path dotfiles"))))) +;;;;; Grep + +(use-package grep + :config (progn + (dolist (v '("node_modules" + "bower_components" + ".sass_cache" + ".cache" + ".npm")) + (add-to-list 'grep-find-ignored-directories v)) + (dolist (v '("*.min.js" + "*.bundle.js" + "*.min.css" + "*.lock" + "package-lock.json" + "*.log")) + (add-to-list 'grep-find-ignored-files v)))) + ;;;;; The Silver Searcher (use-package ag @@ -1078,6 +1096,17 @@ (use-package company-web :after company) +;;;;; EACL + +;; Auto-complete lines by grepping the project. + +(use-package eacl + :bind (("C-c " . eacl-complete-line) + ("C-c C-;" . eacl-complete-statement) + ("C-c C-\]" . eacl-complete-snippet) + ("C-c C-/" . eacl-complete-tag))) + + ;;;; Dates & Times ;;;;; Calendar -- cgit 1.4.1 From 45d2d53579e59f0ff4c6ceb4163ede9b26633bfd Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 24 Nov 2017 22:57:44 +0100 Subject: i3: Use rofi in place of dmenu --- i3/.config/i3/config | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 150c7139..cf67541d 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -75,13 +75,9 @@ bindsym $mod+Return exec --no-startup-id urxvtc # kill focused window bindsym $mod+Shift+w kill -# start dmenu (a program launcher) -bindsym $mod+Mod1+r exec --no-startup-id dmenu_run -bindsym $mod+Shift+semicolon exec --no-startup-id passmenu -# There Also Is The (new) i3-dmenu-desktop which only displays applications -# shipping a .desktop file. It is a wrapper around dmenu, so you need that -# installed. -bindsym $mod+space exec --no-startup-id i3-dmenu-desktop +bindsym --release $mod+Mod1+r exec rofi -show run +bindsym --release $mod+Shift+semicolon exec rofi-pass +bindsym --release $mod+space exec "rofi -show combi -combi-modi window,drun,ssh" # change focus bindsym $mod+n focus left -- cgit 1.4.1 From 4515a1f73fcb74be525670769815ae4feb1310a4 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 25 Nov 2017 00:34:07 +0100 Subject: Xresources: set font for rofi --- xresources/.xresources/main | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xresources/.xresources/main b/xresources/.xresources/main index 821392d7..ec0c6cf9 100644 --- a/xresources/.xresources/main +++ b/xresources/.xresources/main @@ -10,6 +10,8 @@ Emacs.MenuBar: off Emacs.ScrollBars: off Emacs.CursorBlink: off +rofi.font: Fantasque Sans Mono 18 + URxvt.fading: 0 URxvt.geometry: 100x40 URxvt.urgentOnBell: true -- cgit 1.4.1 From b7be428cee2e5860bfb9d79348a0db961641254a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 25 Nov 2017 00:34:21 +0100 Subject: rofi: Add initial configuration --- rofi/.config/rofi/config | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 rofi/.config/rofi/config diff --git a/rofi/.config/rofi/config b/rofi/.config/rofi/config new file mode 100644 index 00000000..d916e150 --- /dev/null +++ b/rofi/.config/rofi/config @@ -0,0 +1,8 @@ +rofi.matching: fuzzy +rofi.separator-style: none + +rofi.line-padding: 2 + +rofi.display-run: cmd +rofi.display-drun: run +rofi.display-window: win \ No newline at end of file -- cgit 1.4.1 From 8568b1783f7a9d3d061d7a3005921196b21536c6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 25 Nov 2017 00:35:13 +0100 Subject: i3: Rely on physlock instead of $Locker --- i3/.config/i3/config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index cf67541d..feae8603 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -228,8 +228,8 @@ set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) re mode "$mode_system" { bindsym l exec --no-startup-id $Locker, mode "default" bindsym e exec --no-startup-id i3-msg exit, mode "default" - bindsym s exec --no-startup-id $Locker && systemctl suspend, mode "default" - bindsym h exec --no-startup-id $Locker && systemctl hibernate, mode "default" + bindsym s exec --no-startup-id systemctl suspend, mode "default" + bindsym h exec --no-startup-id systemctl hibernate, mode "default" bindsym r exec --no-startup-id systemctl reboot, mode "default" bindsym Shift+s exec --no-startup-id systemctl poweroff -i, mode "default" -- cgit 1.4.1 From d1a4e4a6d60f97c22d1d1463eb2898c20e6db05c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 25 Nov 2017 21:01:49 +0100 Subject: Move old files to stow-correct positions --- minttyrc/.minttyrc | 33 +++++++++++++++++ minttyrc/minttyrc | 33 ----------------- xbindkeys/.xbindkeysrc.scm | 57 ++++++++++++++++++++++++++++ xbindkeys/xbindkeysrc.scm | 57 ---------------------------- xmonad/.xmonad/xmonad.hs | 92 ++++++++++++++++++++++++++++++++++++++++++++++ xmonad/xmonad/xmonad.hs | 92 ---------------------------------------------- 6 files changed, 182 insertions(+), 182 deletions(-) create mode 100644 minttyrc/.minttyrc delete mode 100644 minttyrc/minttyrc create mode 100644 xbindkeys/.xbindkeysrc.scm delete mode 100644 xbindkeys/xbindkeysrc.scm create mode 100644 xmonad/.xmonad/xmonad.hs delete mode 100644 xmonad/xmonad/xmonad.hs diff --git a/minttyrc/.minttyrc b/minttyrc/.minttyrc new file mode 100644 index 00000000..2e7f2d86 --- /dev/null +++ b/minttyrc/.minttyrc @@ -0,0 +1,33 @@ +BoldAsFont=no +Font=Cousine +FontHeight=12 +FontSmoothing=default +Locale=en_GB +Charset=UTF-8 +Columns=100 +Rows=36 +Scrollbar=none +Transparency=off +OpaqueWhenFocused=no +CursorType=block +CursorBlinks=no +RightClickAction=extend +BoldBlack=0,43,54 +Black=7,54,66 +BoldGreen=88,110,117 +BoldYellow=101,123,131 +BoldBlue=131,148,150 +BoldCyan=147,161,161 +White=238,232,213 +BoldWhite=253,246,227 +Yellow=181,137,0 +BoldRed=203,75,22 +Red=220,50,47 +Magenta=211,54,130 +BoldMagenta=108,113,196 +Blue=38,139,210 +Cyan=42,161,152 +Green=133,153,0 +ForegroundColour=101,123,117 +BackgroundColour=253,246,227 +CursorColour=112,129,131 diff --git a/minttyrc/minttyrc b/minttyrc/minttyrc deleted file mode 100644 index 2e7f2d86..00000000 --- a/minttyrc/minttyrc +++ /dev/null @@ -1,33 +0,0 @@ -BoldAsFont=no -Font=Cousine -FontHeight=12 -FontSmoothing=default -Locale=en_GB -Charset=UTF-8 -Columns=100 -Rows=36 -Scrollbar=none -Transparency=off -OpaqueWhenFocused=no -CursorType=block -CursorBlinks=no -RightClickAction=extend -BoldBlack=0,43,54 -Black=7,54,66 -BoldGreen=88,110,117 -BoldYellow=101,123,131 -BoldBlue=131,148,150 -BoldCyan=147,161,161 -White=238,232,213 -BoldWhite=253,246,227 -Yellow=181,137,0 -BoldRed=203,75,22 -Red=220,50,47 -Magenta=211,54,130 -BoldMagenta=108,113,196 -Blue=38,139,210 -Cyan=42,161,152 -Green=133,153,0 -ForegroundColour=101,123,117 -BackgroundColour=253,246,227 -CursorColour=112,129,131 diff --git a/xbindkeys/.xbindkeysrc.scm b/xbindkeys/.xbindkeysrc.scm new file mode 100644 index 00000000..7b00c38d --- /dev/null +++ b/xbindkeys/.xbindkeysrc.scm @@ -0,0 +1,57 @@ +;; To specify a key, you can use 'xbindkeys --key' or +;; 'xbindkeys --multikey' and put one of the two lines in this file. + +;; A list of keys is in /usr/include/X11/keysym.h and in +;; /usr/include/X11/keysymdef.h +;; The XK_ is not needed. + +;; List of modifier: +;; Release, Control, Shift, Mod1 (Alt), Mod2 (NumLock), +;; Mod3 (CapsLock), Mod4, Mod5 (Scroll). + + +;; The release modifier is not a standard X modifier, but you can +;; use it if you want to catch release instead of press events + +;; By defaults, xbindkeys does not pay attention to modifiers +;; NumLock, CapsLock and ScrollLock. +;; Uncomment the lines below if you want to use them. +;; To dissable them, call the functions with #f + + +;;;;EXTRA FUNCTIONS: Enable numlock, scrolllock or capslock usage +;;(set-numlock! #t) +;;(set-scrolllock! #t) +;;(set-capslock! #t) + +;;;;; Scheme API reference +;;;; +;; Optional modifier state: +;; (set-numlock! #f or #t) +;; (set-scrolllock! #f or #t) +;; (set-capslock! #f or #t) +;; +;; Shell command key: +;; (xbindkey key "foo-bar-command [args]") +;; (xbindkey '(modifier* key) "foo-bar-command [args]") +;; +;; Scheme function key: +;; (xbindkey-function key function-name-or-lambda-function) +;; (xbindkey-function '(modifier* key) function-name-or-lambda-function) +;; +;; Other functions: +;; (remove-xbindkey key) +;; (run-command "foo-bar-command [args]") +;; (grab-all-keys) +;; (ungrab-all-keys) +;; (remove-all-keys) +;; (debug) + +(xbindkey '(mod4 F9) "mpc toggle") +(xbindkey '(mod4 F10) "mpc prev") +(xbindkey '(mod4 F11) "mpc next") +(xbindkey '(mod4 F12) "mpc stop") + +(xbindkey '(mod4 p) "dmenu_run -fn '-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*' -nb '#002b36' -nf '#fdf6e3' -sb '#586e75' -sf '#fdf6e3' -hist '/home/alan/.cache/dmenu_run_history'") +(xbindkey '(mod4 shift T) "urxvtc") +(xbindkey '(mod4 shift E) "emacsclient -c") diff --git a/xbindkeys/xbindkeysrc.scm b/xbindkeys/xbindkeysrc.scm deleted file mode 100644 index 7b00c38d..00000000 --- a/xbindkeys/xbindkeysrc.scm +++ /dev/null @@ -1,57 +0,0 @@ -;; To specify a key, you can use 'xbindkeys --key' or -;; 'xbindkeys --multikey' and put one of the two lines in this file. - -;; A list of keys is in /usr/include/X11/keysym.h and in -;; /usr/include/X11/keysymdef.h -;; The XK_ is not needed. - -;; List of modifier: -;; Release, Control, Shift, Mod1 (Alt), Mod2 (NumLock), -;; Mod3 (CapsLock), Mod4, Mod5 (Scroll). - - -;; The release modifier is not a standard X modifier, but you can -;; use it if you want to catch release instead of press events - -;; By defaults, xbindkeys does not pay attention to modifiers -;; NumLock, CapsLock and ScrollLock. -;; Uncomment the lines below if you want to use them. -;; To dissable them, call the functions with #f - - -;;;;EXTRA FUNCTIONS: Enable numlock, scrolllock or capslock usage -;;(set-numlock! #t) -;;(set-scrolllock! #t) -;;(set-capslock! #t) - -;;;;; Scheme API reference -;;;; -;; Optional modifier state: -;; (set-numlock! #f or #t) -;; (set-scrolllock! #f or #t) -;; (set-capslock! #f or #t) -;; -;; Shell command key: -;; (xbindkey key "foo-bar-command [args]") -;; (xbindkey '(modifier* key) "foo-bar-command [args]") -;; -;; Scheme function key: -;; (xbindkey-function key function-name-or-lambda-function) -;; (xbindkey-function '(modifier* key) function-name-or-lambda-function) -;; -;; Other functions: -;; (remove-xbindkey key) -;; (run-command "foo-bar-command [args]") -;; (grab-all-keys) -;; (ungrab-all-keys) -;; (remove-all-keys) -;; (debug) - -(xbindkey '(mod4 F9) "mpc toggle") -(xbindkey '(mod4 F10) "mpc prev") -(xbindkey '(mod4 F11) "mpc next") -(xbindkey '(mod4 F12) "mpc stop") - -(xbindkey '(mod4 p) "dmenu_run -fn '-misc-termsyn-medium-r-normal--11-79-100-100-c-60-*-*' -nb '#002b36' -nf '#fdf6e3' -sb '#586e75' -sf '#fdf6e3' -hist '/home/alan/.cache/dmenu_run_history'") -(xbindkey '(mod4 shift T) "urxvtc") -(xbindkey '(mod4 shift E) "emacsclient -c") diff --git a/xmonad/.xmonad/xmonad.hs b/xmonad/.xmonad/xmonad.hs new file mode 100644 index 00000000..21e197d2 --- /dev/null +++ b/xmonad/.xmonad/xmonad.hs @@ -0,0 +1,92 @@ +import XMonad +import qualified XMonad.StackSet as W +import XMonad.Hooks.DynamicLog +import XMonad.Hooks.EwmhDesktops +import XMonad.Hooks.ManageDocks +import XMonad.Hooks.ManageHelpers +import XMonad.Layout.NoBorders +import XMonad.Layout.WindowNavigation +import XMonad.Util.EZConfig +import XMonad.Util.Run(spawnPipe) +import System.Exit +import System.IO +import Data.List(isPrefixOf) + +myManageHook :: ManageHook +myManageHook = composeOne + [ className =? "Firefox" -?> doShift "2" + , className =? "Pidgin" -?> doShift "3" + , className =? "nuvolaplayer" -?> doShift "8" + , className =? "Transmission-gtk" -?> doShift "9" + , isFullscreen -?> doFullFloat + , fmap ("mpv" `isPrefixOf`) title -?> doFullFloat + ] + +myKeys c = mkKeymap c $ + [ ("M-S-", spawn $ XMonad.terminal c) + , ("M-k", kill) + + , ("M-", spawn "exec $(dmenu_path | dmenu)") + , ("M-x M-e", spawn "emacsclient -c") + + , ("M-t", withFocused $ windows . W.sink) + , ("M-m", windows W.focusMaster) + , ("M-S-m", windows W.swapMaster) + + , ("M-", sendMessage $ Go R) + , ("M-", sendMessage $ Go L) + , ("M-", sendMessage $ Go U) + , ("M-", sendMessage $ Go D) + , ("M-M1-", sendMessage $ Swap R) + , ("M-M1-", sendMessage $ Swap L) + , ("M-M1-", sendMessage $ Swap U) + , ("M-M1-", sendMessage $ Swap D) + , ("M-C-", sendMessage $ Move R) + , ("M-C-", sendMessage $ Move L) + , ("M-C-", sendMessage $ Move U) + , ("M-C-", sendMessage $ Move D) + + , ("M-n", windows W.focusDown) + , ("M-p", windows W.focusUp) + , ("M-S-n", windows W.swapDown) + , ("M-S-p", windows W.swapUp) + + , ("M-,", sendMessage (IncMasterN 1)) + , ("M-.", sendMessage (IncMasterN (-1))) + + , ("M-\\", sendMessage NextLayout) + , ("M-S-\\", setLayout $ XMonad.layoutHook c) + + , ("M-+", sendMessage Shrink) + , ("M--", sendMessage Expand) + + , ("M-q", broadcastMessage ReleaseResources + >> restart "xmonad" True) + , ("C-M-q", io (exitWith ExitSuccess)) + ] ++ + + -- mod-[1..9], Switch to workspace N + -- mod-shift-[1..9], Move client to workspace N + [(m ++ k, windows $ f w) + | (w, k) <- zip (XMonad.workspaces c) (map show [1..9]) + , (m, f) <- [("M-",W.greedyView), ("M-S-",W.shift)]] + + +main :: IO () +main = do + xmproc <-spawnPipe "/usr/bin/xmobar /home/alan/.xmobarrc" + xmonad $ defaultConfig + { manageHook = myManageHook <+> manageDocks <+> manageHook defaultConfig + , layoutHook = smartBorders . avoidStruts $ layoutHook defaultConfig + , logHook = dynamicLogWithPP xmobarPP + { ppOutput = hPutStrLn xmproc + , ppTitle = xmobarColor "#859900" "" . shorten 200 + , ppCurrent = xmobarColor "#b58900" "". wrap "[" "]" + , ppHiddenNoWindows = xmobarColor "#93a1a1" "" + , ppUrgent = xmobarColor "#dc322f" "#b58900" + } + , terminal = "urxvt" + , modMask = mod4Mask + , handleEventHook = fullscreenEventHook + , keys = myKeys + } diff --git a/xmonad/xmonad/xmonad.hs b/xmonad/xmonad/xmonad.hs deleted file mode 100644 index 21e197d2..00000000 --- a/xmonad/xmonad/xmonad.hs +++ /dev/null @@ -1,92 +0,0 @@ -import XMonad -import qualified XMonad.StackSet as W -import XMonad.Hooks.DynamicLog -import XMonad.Hooks.EwmhDesktops -import XMonad.Hooks.ManageDocks -import XMonad.Hooks.ManageHelpers -import XMonad.Layout.NoBorders -import XMonad.Layout.WindowNavigation -import XMonad.Util.EZConfig -import XMonad.Util.Run(spawnPipe) -import System.Exit -import System.IO -import Data.List(isPrefixOf) - -myManageHook :: ManageHook -myManageHook = composeOne - [ className =? "Firefox" -?> doShift "2" - , className =? "Pidgin" -?> doShift "3" - , className =? "nuvolaplayer" -?> doShift "8" - , className =? "Transmission-gtk" -?> doShift "9" - , isFullscreen -?> doFullFloat - , fmap ("mpv" `isPrefixOf`) title -?> doFullFloat - ] - -myKeys c = mkKeymap c $ - [ ("M-S-", spawn $ XMonad.terminal c) - , ("M-k", kill) - - , ("M-", spawn "exec $(dmenu_path | dmenu)") - , ("M-x M-e", spawn "emacsclient -c") - - , ("M-t", withFocused $ windows . W.sink) - , ("M-m", windows W.focusMaster) - , ("M-S-m", windows W.swapMaster) - - , ("M-", sendMessage $ Go R) - , ("M-", sendMessage $ Go L) - , ("M-", sendMessage $ Go U) - , ("M-", sendMessage $ Go D) - , ("M-M1-", sendMessage $ Swap R) - , ("M-M1-", sendMessage $ Swap L) - , ("M-M1-", sendMessage $ Swap U) - , ("M-M1-", sendMessage $ Swap D) - , ("M-C-", sendMessage $ Move R) - , ("M-C-", sendMessage $ Move L) - , ("M-C-", sendMessage $ Move U) - , ("M-C-", sendMessage $ Move D) - - , ("M-n", windows W.focusDown) - , ("M-p", windows W.focusUp) - , ("M-S-n", windows W.swapDown) - , ("M-S-p", windows W.swapUp) - - , ("M-,", sendMessage (IncMasterN 1)) - , ("M-.", sendMessage (IncMasterN (-1))) - - , ("M-\\", sendMessage NextLayout) - , ("M-S-\\", setLayout $ XMonad.layoutHook c) - - , ("M-+", sendMessage Shrink) - , ("M--", sendMessage Expand) - - , ("M-q", broadcastMessage ReleaseResources - >> restart "xmonad" True) - , ("C-M-q", io (exitWith ExitSuccess)) - ] ++ - - -- mod-[1..9], Switch to workspace N - -- mod-shift-[1..9], Move client to workspace N - [(m ++ k, windows $ f w) - | (w, k) <- zip (XMonad.workspaces c) (map show [1..9]) - , (m, f) <- [("M-",W.greedyView), ("M-S-",W.shift)]] - - -main :: IO () -main = do - xmproc <-spawnPipe "/usr/bin/xmobar /home/alan/.xmobarrc" - xmonad $ defaultConfig - { manageHook = myManageHook <+> manageDocks <+> manageHook defaultConfig - , layoutHook = smartBorders . avoidStruts $ layoutHook defaultConfig - , logHook = dynamicLogWithPP xmobarPP - { ppOutput = hPutStrLn xmproc - , ppTitle = xmobarColor "#859900" "" . shorten 200 - , ppCurrent = xmobarColor "#b58900" "". wrap "[" "]" - , ppHiddenNoWindows = xmobarColor "#93a1a1" "" - , ppUrgent = xmobarColor "#dc322f" "#b58900" - } - , terminal = "urxvt" - , modMask = mod4Mask - , handleEventHook = fullscreenEventHook - , keys = myKeys - } -- cgit 1.4.1 From 0500b2694cc5fb2c0e7ab6eaaa8476e046d5cebf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 25 Nov 2017 21:30:58 +0100 Subject: xprofile: Fix rofi-pass typing --- xprofile/.xprofile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xprofile/.xprofile b/xprofile/.xprofile index b83f94b0..3052e8d3 100755 --- a/xprofile/.xprofile +++ b/xprofile/.xprofile @@ -1,4 +1,6 @@ #!/bin/sh +# Needed for pass/rofi-pass autotype +setxkbmap us -variant colemak xmodmap .xmodmaprc nm-applet & if command -v autorandr -- cgit 1.4.1 From 1ad8f424ae56daa0e7bfaecd367389ca28b255b2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 26 Nov 2017 10:48:05 +0100 Subject: Use base16-tomorrow instead of mexico-light Since this already has a white background, no need to override it --- xresources/.xresources/base16-tomorrow | 54 ++++++++++++++++++++++++++++++++++ xresources/.xresources/main | 4 +-- 2 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 xresources/.xresources/base16-tomorrow diff --git a/xresources/.xresources/base16-tomorrow b/xresources/.xresources/base16-tomorrow new file mode 100644 index 00000000..46c18805 --- /dev/null +++ b/xresources/.xresources/base16-tomorrow @@ -0,0 +1,54 @@ +! Base16 Tomorrow +! Scheme: Chris Kempson (http://chriskempson.com) + +#define base00 #ffffff +#define base01 #e0e0e0 +#define base02 #d6d6d6 +#define base03 #8e908c +#define base04 #969896 +#define base05 #4d4d4c +#define base06 #282a2e +#define base07 #1d1f21 +#define base08 #c82829 +#define base09 #f5871f +#define base0A #eab700 +#define base0B #718c00 +#define base0C #3e999f +#define base0D #4271ae +#define base0E #8959a8 +#define base0F #a3685a + +*foreground: base05 +#ifdef background_opacity +*background: [background_opacity]base00 +#else +*background: base00 +#endif +*cursorColor: base05 + +*color0: base00 +*color1: base08 +*color2: base0B +*color3: base0A +*color4: base0D +*color5: base0E +*color6: base0C +*color7: base05 + +*color8: base03 +*color9: base08 +*color10: base0B +*color11: base0A +*color12: base0D +*color13: base0E +*color14: base0C +*color15: base07 + +! Note: colors beyond 15 might not be loaded (e.g., xterm, urxvt), +! use 'shell' template to set these if necessary +*color16: base09 +*color17: base0F +*color18: base01 +*color19: base02 +*color20: base04 +*color21: base06 diff --git a/xresources/.xresources/main b/xresources/.xresources/main index ec0c6cf9..cb079fb0 100644 --- a/xresources/.xresources/main +++ b/xresources/.xresources/main @@ -1,6 +1,4 @@ -#include "base16-mexico-light-256" - -*.background: #ffffff +#include "base16-tomorrow" Xcursor.theme: Paper Xcursor.size: 22 -- cgit 1.4.1 From 746abcc8f397d396aebba1343a23583d2d0c8027 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 26 Nov 2017 10:48:36 +0100 Subject: i3: Use tomorrow-night colour scheme --- i3/.config/i3/config | 72 ++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index feae8603..55a5c294 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -13,39 +13,39 @@ set $mod Mod4 # Base16 colours: https://github.com/khamer/base16-i3 -# set $base00 #f8f8f8 -# set $base01 #e8e8e8 -# set $base02 #d8d8d8 -# set $base03 #b8b8b8 -# set $base04 #585858 -# set $base05 #383838 -# set $base06 #282828 -# set $base07 #181818 -# set $base08 #ab4642 -# set $base09 #dc9656 -# set $base0A #f79a0e -# set $base0B #538947 -# set $base0C #4b8093 -# set $base0D #7cafc2 -# set $base0E #96609e -# set $base0F #a16946 - -set_from_resource $base00 i3wm.color00 #f8f8f8 -set_from_resource $base01 i3wm.color01 #e8e8e8 -set_from_resource $base02 i3wm.color02 #d8d8d8 -set_from_resource $base03 i3wm.color03 #b8b8b8 -set_from_resource $base04 i3wm.color04 #585858 -set_from_resource $base05 i3wm.color05 #383838 -set_from_resource $base06 i3wm.color06 #282828 -set_from_resource $base07 i3wm.color07 #181818 -set_from_resource $base08 i3wm.color08 #ab4642 -set_from_resource $base09 i3wm.color09 #dc9656 -set_from_resource $base0A i3wm.color0A #f79a0e -set_from_resource $base0B i3wm.color0B #538947 -set_from_resource $base0C i3wm.color0C #4b8093 -set_from_resource $base0D i3wm.color0D #7cafc2 -set_from_resource $base0E i3wm.color0E #96609e -set_from_resource $base0F i3wm.color0F #a16946 +set $base00 #1d1f21 +set $base01 #282a2e +set $base02 #373b41 +set $base03 #969896 +set $base04 #b4b7b4 +set $base05 #c5c8c6 +set $base06 #e0e0e0 +set $base07 #ffffff +set $base08 #cc6666 +set $base09 #de935f +set $base0A #f0c674 +set $base0B #b5bd68 +set $base0C #8abeb7 +set $base0D #81a2be +set $base0E #b294bb +set $base0F #a3685a + +# set_from_resource $base00 i3wm.color00 #f8f8f8 +# set_from_resource $base01 i3wm.color01 #e8e8e8 +# set_from_resource $base02 i3wm.color02 #d8d8d8 +# set_from_resource $base03 i3wm.color03 #b8b8b8 +# set_from_resource $base04 i3wm.color04 #585858 +# set_from_resource $base05 i3wm.color05 #383838 +# set_from_resource $base06 i3wm.color06 #282828 +# set_from_resource $base07 i3wm.color07 #181818 +# set_from_resource $base08 i3wm.color08 #ab4642 +# set_from_resource $base09 i3wm.color09 #dc9656 +# set_from_resource $base0A i3wm.color0A #f79a0e +# set_from_resource $base0B i3wm.color0B #538947 +# set_from_resource $base0C i3wm.color0C #4b8093 +# set_from_resource $base0D i3wm.color0D #7cafc2 +# set_from_resource $base0E i3wm.color0E #96609e +# set_from_resource $base0F i3wm.color0F #a16946 set $Locker i3lock-color @@ -248,13 +248,13 @@ bar { status_command /run/current-system/sw/bin/i3status -c ~/.config/i3status/config colors { background $base00 - separator $base03 - statusline $base06 + separator $base01 + statusline $base04 # State Border BG Text focused_workspace $base05 $base0D $base00 active_workspace $base05 $base03 $base00 - inactive_workspace $base03 $base01 $base07 + inactive_workspace $base03 $base01 $base05 urgent_workspace $base08 $base08 $base00 binding_mode $base00 $base0A $base00 } -- cgit 1.4.1 From 4ca5ef03316b546b9737f7f1b2102a90ed30dac7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 26 Nov 2017 10:48:49 +0100 Subject: rofi: Add initial rofi-pass config --- rofi/.config/rofi-pass/config | 77 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 rofi/.config/rofi-pass/config diff --git a/rofi/.config/rofi-pass/config b/rofi/.config/rofi-pass/config new file mode 100644 index 00000000..ad997ba8 --- /dev/null +++ b/rofi/.config/rofi-pass/config @@ -0,0 +1,77 @@ +# -*- mode: sh; -*- +# permanently set alternative root dir. Use ":" to separate multiple roots +# which can be switched at runtime with shift+left/right +# root=/path/to/root + +# rofi command. Make sure to have "$@" as last argument +_rofi () { + rofi -i -no-auto-select "$@" +} + +# xdotool needs the keyboard layout to be set using setxkbmap +# You can do this in your autostart scripts (e.g. xinitrc) + +# If for some reason, you cannot do this, you can set the command here. +# and set fix_layout to true +fix_layout=false + +layout_cmd () { + setxkbmap us +} + +# fields to be used +URL_field='url' +USERNAME_field='login' +AUTOTYPE_field='autotype' + +# delay to be used for :delay keyword +delay=2 + +# rofi-pass needs to close itself before it can type passwords. Set delay here. +wait=0.2 + +## Programs to be used +# Editor +EDITOR='emacsclient' + +# Browser +# BROWSER='google-chrome-stable' + +## Misc settings + +default_do='menu' # menu, autotype, copyPass, typeUser, typePass, copyUser, copyUrl, viewEntry, typeMenu, actionMenu, copyMenu, openUrl +auto_enter='false' +notify='false' +default_autotype='login :tab pass' + +# color of the help messages +# leave empty for autodetection +help_color="#4872FF" + +# Clipboard settings +# Possible options: primary, clipboard, both +clip=both + +# Options for generating new password entries +# default_user is also used for password files that have no user field. +#default_user=john_doe +#default_user2=mary_ann +#password_length=12 + +# Custom Keybindings +autotype="Alt+1" +type_user="Alt+2" +type_pass="Alt+3" +open_url="Alt+4" +copy_name="Alt+u" +copy_url="Alt+l" +copy_pass="Alt+p" +show="Alt+o" +copy_entry="Alt+2" +type_entry="Alt+1" +copy_menu="Alt+c" +action_menu="Alt+a" +type_menu="Alt+t" +help="Alt+h" +switch="Alt+x" +insert_pass="Alt+n" -- cgit 1.4.1 From cca615d1afcafab233e79bc8a88d677b472243ef Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 26 Nov 2017 12:42:48 +0100 Subject: Delete old Spotcap git config --- git/.config/git/config | 4 ---- git/.config/git/config-spotcap | 2 -- 2 files changed, 6 deletions(-) delete mode 100644 git/.config/git/config-spotcap diff --git a/git/.config/git/config b/git/.config/git/config index e710bbef..0acdefb3 100644 --- a/git/.config/git/config +++ b/git/.config/git/config @@ -26,10 +26,6 @@ user = alanpearce [ghq "ssh://alanpearce.eu/"] vcs = git -[includeIf "gitdir:github.com/Spotcap/"] - path = config-spotcap -[includeIf "gitdir:bitbucket.org/spotcap-engineering/"] - path = config-spotcap [includeIf "gitdir:github.com/satoshipay/"] path = config-satoshipay [diff] diff --git a/git/.config/git/config-spotcap b/git/.config/git/config-spotcap deleted file mode 100644 index a340c2ed..00000000 --- a/git/.config/git/config-spotcap +++ /dev/null @@ -1,2 +0,0 @@ -[user] -email = alan.pearce@spotcap.com \ No newline at end of file -- cgit 1.4.1 From cb18ecd5105d9f7b6a9896402e26cd3aecc1203c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 26 Nov 2017 16:34:46 +0100 Subject: i3: Update statusbar highlight colours --- i3/.config/i3status/config | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/i3/.config/i3status/config b/i3/.config/i3status/config index ecbef578..f27c24a4 100644 --- a/i3/.config/i3status/config +++ b/i3/.config/i3status/config @@ -10,9 +10,9 @@ general { colors = true interval = 10 - color_good = "#538947" - color_degraded = "#f79a0e" - color_bad = "#ab4642" + color_good = "#b5bd68" + color_degraded = "#de935f" + color_bad = "#a3685a" } order += "disk /" -- cgit 1.4.1 From 897344f6e4380cdb33fea3899df3a5b273e1b906 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 26 Nov 2017 16:35:04 +0100 Subject: i3: Tweak bar colours --- i3/.config/i3/config | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 55a5c294..5b01f425 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -252,10 +252,10 @@ bar { statusline $base04 # State Border BG Text - focused_workspace $base05 $base0D $base00 - active_workspace $base05 $base03 $base00 - inactive_workspace $base03 $base01 $base05 - urgent_workspace $base08 $base08 $base00 + focused_workspace $base0D $base02 $base07 + active_workspace $base02 $base03 $base00 + inactive_workspace $base02 $base01 $base04 + urgent_workspace $base08 $base02 $base00 binding_mode $base00 $base0A $base00 } } -- cgit 1.4.1 From 369e288667f48a4220a8b060a6aed35e94b89dc3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 26 Nov 2017 19:50:48 +0100 Subject: i3: Remove gaps --- i3/.config/i3/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 5b01f425..795515d9 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -272,7 +272,7 @@ client.background $base07 new_window pixel 1 new_float normal hide_edge_borders both -gaps inner 10 +gaps inner 0 gaps outer 0 for_window [class="Pinentry$"] floating enable -- cgit 1.4.1 From dd9bd39d7ec4b5581858278a92091fedbd4eea26 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 26 Nov 2017 19:51:01 +0100 Subject: i3: Try a larger border --- i3/.config/i3/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 795515d9..449b94f6 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -269,7 +269,7 @@ client.urgent $base08 $base08 $base00 $base08 $base08 client.placeholder $base00 $base00 $base05 $base00 $base00 client.background $base07 -new_window pixel 1 +new_window pixel 2 new_float normal hide_edge_borders both gaps inner 0 -- cgit 1.4.1 From c3784a2a8ca2a485e40502616985b21beee20fba Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 27 Nov 2017 16:10:48 +0100 Subject: xprofile: Don't run dunst/sxhkd Moved to nixos-configuration repository --- xprofile/.xprofile | 2 -- 1 file changed, 2 deletions(-) diff --git a/xprofile/.xprofile b/xprofile/.xprofile index 3052e8d3..52e19661 100755 --- a/xprofile/.xprofile +++ b/xprofile/.xprofile @@ -8,6 +8,4 @@ then autorandr --change --force fi xrdb -I$HOME/.xresources .xresources/main -dunst & xsetroot -cursor_name left_ptr -solid '#666666' & -sxhkd & -- cgit 1.4.1 From ae47b52893d3e73a41c9de901771a9ad34d7a619 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 27 Nov 2017 16:11:17 +0100 Subject: zsh: Add quicklisp local-projects to ghq roots --- zsh/.config/zsh/.zshenv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index f865d405..9416dd44 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -79,7 +79,7 @@ then export GTAGSCONF=~/.globalrc export GTAGSLABEL=ctags - export GHQ_ROOT="$HOME/projects:$HOME/go/src" + export GHQ_ROOT="$HOME/projects:$HOME/go/src:$HOME/quicklisp/local-projects" export LEDGER_FILE="$HOME/Sync/Default/ledger/my.ledger" fi -- cgit 1.4.1 From 6f1192003a36d3430e79da370447f99858485030 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 29 Nov 2017 11:52:21 +0100 Subject: i3: Stop windows from moving when opening new windows --- i3/.config/i3/config | 1 - 1 file changed, 1 deletion(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 449b94f6..18344210 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -271,7 +271,6 @@ client.background $base07 new_window pixel 2 new_float normal -hide_edge_borders both gaps inner 0 gaps outer 0 -- cgit 1.4.1 From 2f99fa833347ac8dc7cef141512ef4a2f7127adf Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 29 Nov 2017 11:52:38 +0100 Subject: i3: Remove unnecessary special rule for Chrome --- i3/.config/i3/config | 1 - 1 file changed, 1 deletion(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 18344210..a9e41e62 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -275,4 +275,3 @@ gaps inner 0 gaps outer 0 for_window [class="Pinentry$"] floating enable -for_window [class="Google-chrome"] border pixel 1 -- cgit 1.4.1 From c8f05b0ff664831c6ea2c7b0a5a31dba9cd2c8e0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 29 Nov 2017 15:15:26 +0100 Subject: Emacs: Load spaceline-config later --- emacs/.emacs.d/main.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 268f290d..83a3c2a6 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -251,6 +251,7 @@ ;;;;; Spaceline (use-package spaceline-config + :after (eyebrowse projectile flycheck) :config (progn (setq-default mode-line-format (spaceline-spacemacs-theme)))) -- cgit 1.4.1 From 2a433f00aebb893e01e5d4896f05ff2ccd49da8c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 29 Nov 2017 15:22:28 +0100 Subject: Emacs: Tweak spaceline --- emacs/.emacs.d/main.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 83a3c2a6..ffa9c0f1 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -253,6 +253,8 @@ (use-package spaceline-config :after (eyebrowse projectile flycheck) :config (progn + (setq powerline-default-separator 'bar + powerline-height 24) (setq-default mode-line-format (spaceline-spacemacs-theme)))) ;;;;; Chrome -- cgit 1.4.1 From 0794610ad73b38d63fc57ce65eb19a95b8936cf7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 4 Dec 2017 17:04:34 +0100 Subject: xprofile: Remove xsetroot call Now in nixos-configuration --- xprofile/.xprofile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xprofile/.xprofile b/xprofile/.xprofile index 52e19661..caa4a301 100755 --- a/xprofile/.xprofile +++ b/xprofile/.xprofile @@ -8,4 +8,4 @@ then autorandr --change --force fi xrdb -I$HOME/.xresources .xresources/main -xsetroot -cursor_name left_ptr -solid '#666666' & + -- cgit 1.4.1 From 0b2052227e585a181fc9c10552ec53a5a87b397a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 4 Dec 2017 17:04:54 +0100 Subject: autorandr: Don't restart redshift It seems to handle display switching after a second or two --- autorandr/.config/autorandr/postswitch | 1 - 1 file changed, 1 deletion(-) diff --git a/autorandr/.config/autorandr/postswitch b/autorandr/.config/autorandr/postswitch index 76b3119e..96da6ab8 100755 --- a/autorandr/.config/autorandr/postswitch +++ b/autorandr/.config/autorandr/postswitch @@ -13,7 +13,6 @@ esac xrandr --dpi $DPI emacsclient -e "(setq display-pixels-per-inch $DPI)" > /dev/null -systemctl --user restart redshift --no-block i3-msg restart notify-send --expire-time=5000 "Display profile: '$AUTORANDR_CURRENT_PROFILE'" -- cgit 1.4.1 From 77af8db6fc77342281b7c4f5b1e7c802319ad1be Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 6 Dec 2017 11:41:10 +0100 Subject: Emacs: Remove hide/show mode-line functions Too complicated; didn't really use --- emacs/.emacs.d/main.el | 43 ------------------------------------------- 1 file changed, 43 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index ffa9c0f1..0f50e873 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -259,46 +259,8 @@ ;;;;; Chrome -;; Sometimes I like to hide clutter. Other times, it's useful. - -(defvar mode-line-default-format mode-line-format) -(defvar mode-line-default-hidden nil - "Whether to hide the mode line by default.") - -(defun show-mode-line () - (interactive) - (setq mode-line-format mode-line-default-format) - (when (called-interactively-p 'interactive) - (setq-default mode-line-format mode-line-default-format) - (setq mode-line-default-hidden nil))) -(defun hide-mode-line () - (interactive) - (setq mode-line-format nil) - (when (called-interactively-p 'interactive) - (setq-default mode-line-format nil) - (setq mode-line-default-hidden t))) - (setq-default cursor-in-non-selected-windows nil) -(defun hide-clutter () - (interactive) - (hide-mode-line)) - -(defun show-clutter () - (interactive) - (show-mode-line)) - -(when mode-line-default-hidden - (call-interactively #'hide-mode-line)) - -(setq-default indicate-buffer-boundaries nil) -(fringe-mode '(4 . 4)) - -(defun hide-mode-line-if-default-hidden () - (if mode-line-default-hidden - (hide-mode-line) - (show-mode-line))) - (add-to-list 'default-frame-alist '(border-width . 0)) (add-to-list 'default-frame-alist '(internal-border-width . 0)) (when (or (eq window-system 'x) @@ -308,11 +270,6 @@ window-divider-default-places t) (window-divider-mode +1)) -(add-hook 'after-change-major-mode-hook #'hide-mode-line-if-default-hidden) - -(add-hook 'minibuffer-setup-hook #'show-mode-line) -(add-hook 'minibuffer-exit-hook #'hide-mode-line) - ;;;;; Highlight Changes ;; Highlight what just changed when I undo, yank, and so on. -- cgit 1.4.1 From 8f00c98d5d06a0f9eed7ffa717aa9141d19b8ca7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 12 Dec 2017 16:47:44 +0100 Subject: git: add aliases for lasttag and pending (merged PRs not in a tag) --- git/.config/git/config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/git/.config/git/config b/git/.config/git/config index 0acdefb3..0a1f1bfa 100644 --- a/git/.config/git/config +++ b/git/.config/git/config @@ -17,6 +17,8 @@ br = branch co = checkout ready = rebase -i @{u} + lasttag = "!sh -c 'git tag --sort=taggerdate | tail -n1'" + pending = "!sh -c 'git log --oneline --merges --grep=\"Merge pull request\" ...$(git lasttag)'" lg = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' standup = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --since yesterday --author Alan ignored = ls-files --others -i --exclude-standard -- cgit 1.4.1 From e08c92c631b1dcbbcc8f78f5c8265032010e1124 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 13 Dec 2017 10:54:14 +0100 Subject: Emacs: Bind helpful keys --- emacs/.emacs.d/main.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 0f50e873..1ef88f7a 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1188,7 +1188,10 @@ With two prefix arguments, write out the day and month name." ;;;;; helpful -(use-package helpful) +(use-package helpful + :bind (("C-h k" . helpful-key) + ("C-h v" . helpful-variable) + ("C-h f" . helpful-callable))) ;;;;; ehelp -- cgit 1.4.1 From a54540c63ecd95778aa5d6b0a55787ccf009128b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 21 Dec 2017 11:58:52 +0100 Subject: Emacs: Hide trashed messages in mu4e --- emacs/.emacs.d/main.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 1ef88f7a..3c101047 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1281,6 +1281,10 @@ With two prefix arguments, write out the day and month name." mu4e-maildir (expand-file-name "~/mail") + mu4e-headers-hide-predicate + (lambda (msg) + (member 'trashed (mu4e-message-field msg :flags))) + mu4e-change-filenames-when-moving t message-kill-buffer-on-exit t -- cgit 1.4.1 From 160b6167644bd3f9be2f215adb88164f64ffec9f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 21 Dec 2017 11:59:08 +0100 Subject: Emacs: configure mocha.el --- emacs/.emacs.d/main.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 3c101047..ed826c29 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -2106,6 +2106,17 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :if (fboundp #'js2--struct-put) :mode (("\\.jsx\\'" . rjsx-mode))) +;;;;;;; mocha + +(use-package mocha + :after js2-mode + :config (progn + (setq mocha-reporter "tap") + (defun mocha-test-project () + "Test the current project." + (interactive) + (mocha-run "'./{src,test}/**/*.test.js'")))) + ;;;;;;; js2-refactor ;; Thanks to the AST provided by js2-mode, refactoring is possible. This -- cgit 1.4.1 From 40d25b9213259eb9a083882ffdf9108ae306c706 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 21 Dec 2017 11:59:26 +0100 Subject: zsh: Unalias git->hub --- zsh/.config/zsh/.zshrc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 3efc61a7..1bc434ca 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -172,11 +172,6 @@ fi # General configuration -if [[ -n $commands[hub] ]] -then - alias git=hub -fi - if [[ -n $commands[gpg2] && -z $commands[gpg] ]] then alias gpg=gpg2 -- cgit 1.4.1 From dcc169f7d3d291e863dd133ef4f133f40af0481c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 21 Dec 2017 12:08:09 +0100 Subject: Emacs: Use more inclusive test path for mocha --- emacs/.emacs.d/main.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index ed826c29..cbd2d3e9 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -2115,7 +2115,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (defun mocha-test-project () "Test the current project." (interactive) - (mocha-run "'./{src,test}/**/*.test.js'")))) + (mocha-run "'./{src,lib,test}/**/*.test.js'")))) ;;;;;;; js2-refactor -- cgit 1.4.1 From 69853d93879fe1d700dca8c8d9edc209d7b86229 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 21 Dec 2017 15:26:21 +0100 Subject: Emacs: Fix typo in alias --- emacs/.emacs.d/main.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index cbd2d3e9..a9f48c5f 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -510,7 +510,7 @@ ((string-equal (projectile-project-type) "node-yarn") (cmd-to-echo "yarn" (concat "remove " package))) (t (cmd-to-echo "npm" (concat "remove " package)))))) - (defalias 'npm-remote #'yarn-remove) + (defalias 'npm-remove #'yarn-remove) (defun yarn-run (cmd) (interactive (list -- cgit 1.4.1 From e2f70b524de14ba342c61af2825bb331a96a7b7f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 21 Dec 2017 21:12:06 +0100 Subject: autorandr: Make laptop DPI a little smaller --- autorandr/.config/autorandr/postswitch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autorandr/.config/autorandr/postswitch b/autorandr/.config/autorandr/postswitch index 96da6ab8..045e9159 100755 --- a/autorandr/.config/autorandr/postswitch +++ b/autorandr/.config/autorandr/postswitch @@ -2,7 +2,7 @@ DPI=96 case $AUTORANDR_CURRENT_PROFILE in ("laptop") - DPI=157 + DPI=144 nmcli radio wifi on ;; ("docked") -- cgit 1.4.1 From e165fef6030a5c131261a2d11794427355f23a46 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 21 Dec 2017 21:12:26 +0100 Subject: Emacs: Tell mocha to fail early --- emacs/.emacs.d/main.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index a9f48c5f..bd687056 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -2111,7 +2111,8 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (use-package mocha :after js2-mode :config (progn - (setq mocha-reporter "tap") + (setq mocha-reporter "tap" + mocha-options "--bail") (defun mocha-test-project () "Test the current project." (interactive) -- cgit 1.4.1 From b77dc298d7c0d51ee679ca7387effb77a4978bfc Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 21 Dec 2017 21:13:18 +0100 Subject: Emacs: Remove magithub Not all that useful --- emacs/.emacs.d/main.el | 8 -------- 1 file changed, 8 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index bd687056..d738aeff 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -627,14 +627,6 @@ (add-to-list 'magit-no-confirm 'safe-with-wip)) :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) -;;;;; magithub - -(use-package magithub - :after magit - :config (progn - (magithub-feature-autoinject t) - (setq magithub-cache-refresh-seconds-plist '(:issues 600 :ci-status 180 t 120)))) - ;;;;; git-messenger ;; Popup the last commit that changed the line at point. -- cgit 1.4.1 From 066e570ba54cffc29c6b5e48fb989145f3af65a0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 21 Dec 2017 21:13:32 +0100 Subject: Emacs: Enable diagnostics for auto-revert --- emacs/.emacs.d/main.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index d738aeff..9f413a12 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -689,7 +689,7 @@ :diminish auto-revert-mode :init (progn (global-auto-revert-mode 1) - (setq auto-revert-verbose nil + (setq auto-revert-verbose t auto-revert-use-notify (not (eq system-type 'darwin))))) ;;;;; Encoding -- cgit 1.4.1 From 29ac7bbec9ecd6439cf50ef70f396d6d991286c1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 21 Dec 2017 21:15:21 +0100 Subject: Emacs: Enable magit-file-mode globally --- emacs/.emacs.d/main.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 9f413a12..08ff9658 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -623,7 +623,7 @@ :config (progn (setq magit-completing-read-function #'ivy-completing-read magit-popup-use-prefix-argument 'default magit-display-buffer-function #'magit-display-buffer-fullcolumn-most-v1 - global-magit-file-mode nil) + global-magit-file-mode t) (add-to-list 'magit-no-confirm 'safe-with-wip)) :init (add-hook 'magit-mode-hook #'magit-load-config-extensions)) -- cgit 1.4.1 From 1d5ba912ae69db6e59fe8a987b9fdb82c3b87671 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 8 Jan 2018 15:11:36 +0100 Subject: Yarn: fix registry --- javascript/.npmrc | 2 +- yarn/.yarnrc | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/javascript/.npmrc b/javascript/.npmrc index 336eb072..4eed9ce4 100644 --- a/javascript/.npmrc +++ b/javascript/.npmrc @@ -1,5 +1,5 @@ prefix=${HOME}/.local -//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN} +https://registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN} @satoshipay:registry=https://registry.npmjs.org/ always-auth=true sign-git-tag=true diff --git a/yarn/.yarnrc b/yarn/.yarnrc index 57a49c81..6c37ae5d 100644 --- a/yarn/.yarnrc +++ b/yarn/.yarnrc @@ -2,6 +2,7 @@ # yarn lockfile v1 +registry "https://registry.npmjs.org/" disable-self-update-check true email alan@alanpearce.eu username alanpearce -- cgit 1.4.1 From a36c10e44d618d7ba568b64e11abef72549b7075 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 10 Jan 2018 17:32:30 +0100 Subject: Fix NPM registry for npm command --- javascript/.npmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript/.npmrc b/javascript/.npmrc index 4eed9ce4..336eb072 100644 --- a/javascript/.npmrc +++ b/javascript/.npmrc @@ -1,5 +1,5 @@ prefix=${HOME}/.local -https://registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN} +//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN} @satoshipay:registry=https://registry.npmjs.org/ always-auth=true sign-git-tag=true -- cgit 1.4.1 From b06ee4ed9ffb3d53369f79e354b71daa27a5baa0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 12 Jan 2018 14:54:10 +0100 Subject: Emacs: Improve fringe display --- emacs/.emacs.d/main.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 08ff9658..fd0c3e36 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -129,6 +129,7 @@ (tooltip-mode -1)) (with-eval-after-load 'tool-bar (tool-bar-mode -1)) +(set-fringe-mode '(4 . 4)) ;; Ring the bell sometimes, but not so often (setq ring-bell-function @@ -1826,7 +1827,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (setq flycheck-indication-mode 'left-fringe) (with-eval-after-load 'git-gutter-fringe (fringe-helper-define 'flycheck-fringe-bitmap-double-arrow '(center repeated) - ".XXX....")) + "XXX.....")) (if (executable-find "eslint_d") (setq flycheck-javascript-eslint-executable "eslint_d")))) -- cgit 1.4.1 From dc361800826fde7920a6dfb4b9e422fcfd06aa7f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 1 Feb 2018 12:27:14 +0100 Subject: emacs: change emacsclient desktop file --- emacs/.local/share/applications/emacsclient.desktop | 1 + 1 file changed, 1 insertion(+) mode change 100644 => 100755 emacs/.local/share/applications/emacsclient.desktop diff --git a/emacs/.local/share/applications/emacsclient.desktop b/emacs/.local/share/applications/emacsclient.desktop old mode 100644 new mode 100755 index e26359ec..7cf42241 --- a/emacs/.local/share/applications/emacsclient.desktop +++ b/emacs/.local/share/applications/emacsclient.desktop @@ -1,3 +1,4 @@ +#!/usr/bin/env xdg-open [Desktop Entry] Name=Emacsclient Comment=Edit text -- cgit 1.4.1 From 85da03b9865aea657d86a0a4ac69f53799886593 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 2 Feb 2018 11:50:49 +0100 Subject: Emacs: Configure language server protocol --- emacs/.emacs.d/main.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index fd0c3e36..d960a206 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1910,6 +1910,21 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (use-package imenu-anywhere :bind ("C-x C-." . ivy-imenu-anywhere)) + +;;;;; Language Server Protocol + +;; Enable smart language features by communicating with an outside application. Neat. + +(use-package lsp-mode + :config (progn + (add-hook 'lsp-after-open-hook #'lsp-enable-imenu))) + +(use-package company-lsp + :after (company lsp-mode) + :config (progn + (add-to-list 'company-backends #'company-lsp) + (setq company-lsp-async t))) + ;;;;; Lisps ;;;;;; All -- cgit 1.4.1 From 3bfc1bd6c3b8eaa830cb7df8e9db6f0f0ca13101 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 2 Feb 2018 11:50:59 +0100 Subject: Emacs: use LSP for javascript and typescript --- emacs/.emacs.d/main.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index d960a206..2fbd6440 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -2186,6 +2186,13 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :config (progn (add-hook 'js2-mode-hook #'indium-interaction-mode))) +;;;;;; lsp-javascript + +(use-package lsp-javascript-typescript + :config (progn + (add-hook 'js2-mode-hook #'lsp-javascript-typescript-enable) + (add-hook 'typescript-mode-hook #'lsp-javascript-typescript-enable))) + ;;;;;; tern ;; Tern understands javascript. It adds really clever documented -- cgit 1.4.1 From fc2a4fd893a9eee11d50716a775cf4efcc69dc2a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 2 Feb 2018 15:25:41 +0100 Subject: Emacs: Fix lsp-imenu setup --- emacs/.emacs.d/main.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 2fbd6440..10dbe513 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1915,7 +1915,9 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;; Enable smart language features by communicating with an outside application. Neat. -(use-package lsp-mode +(use-package lsp-mode) + +(use-package lsp-imenu :config (progn (add-hook 'lsp-after-open-hook #'lsp-enable-imenu))) -- cgit 1.4.1 From 11b419661896ab2ecb394d540670ff5163a37757 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 2 Feb 2018 15:25:55 +0100 Subject: Emacs: run add-node-modules-path also for typescript --- emacs/.emacs.d/main.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 10dbe513..81f3f0c6 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -2148,7 +2148,9 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (use-package add-node-modules-path :config (progn - (define-hook-helper js2-mode () + (create-hook-helper js2-mode () + :hooks (js2-mode-hook + typescript-mode-hook) :name node-modules-flycheck (add-node-modules-path) (when (executable-find "eslint") -- cgit 1.4.1 From c1baaeee90c3de9b489c237594ce514b8cf21f90 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 2 Feb 2018 15:26:11 +0100 Subject: Emacs: Only configure lsp-javascript if server installed --- emacs/.emacs.d/main.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 81f3f0c6..886f1a41 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -2193,6 +2193,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." ;;;;;; lsp-javascript (use-package lsp-javascript-typescript + :if (executable-find "javascript-typescript-langserver") :config (progn (add-hook 'js2-mode-hook #'lsp-javascript-typescript-enable) (add-hook 'typescript-mode-hook #'lsp-javascript-typescript-enable))) -- cgit 1.4.1 From f7376535de81cae5b59de337c8128c08a5c6d8e5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 7 Feb 2018 10:49:31 +0100 Subject: Emacs: Install prog-fill-mode --- emacs/.emacs.d/main.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 886f1a41..65630de4 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1849,6 +1849,12 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :config (progn (flycheck-add-next-checker 'javascript-eslint 'javascript-flow))) +;;;;;; prog-fill + +(use-package prog-fill + :bind (:map prog-mode-map + ("M-q" . prog-fill))) + ;;;;; golang ;; Go has a few packages to inter-operate with other emacs packages. -- cgit 1.4.1 From 7dc6f86727bd6b5519a67c4cd565cd3fee7ed081 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 7 Feb 2018 10:49:42 +0100 Subject: Emacs: switch to monotropic-theme --- emacs/.emacs.d/main.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 65630de4..f27d5908 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -140,13 +140,13 @@ ;;;;; Colours -;; White-theme. Sounds like a good idea. +;; Monotropic-theme. I don't need colours. -(use-package white-theme +(use-package monotropic-theme :if (or window-system (daemonp)) :config (progn - (load-theme 'white t) + (load-theme 'monotropic t) (custom-theme-set-faces 'user '(git-gutter-fr:added ((t (:foreground "#b8b8b8")))) '(git-gutter-fr:modified ((t (:foreground "#b8b8b8")))) -- cgit 1.4.1 From 081de5789032a4bfc5bc8c69504e6631eb870976 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 9 Feb 2018 12:45:29 +0100 Subject: Spaceline: auto-calculate a nice height --- emacs/.emacs.d/main.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index f27d5908..aadb65ba 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -255,7 +255,8 @@ :after (eyebrowse projectile flycheck) :config (progn (setq powerline-default-separator 'bar - powerline-height 24) + powerline-height (* 2 (ceiling (* (default-font-height) (+ 1 (* 2 line-spacing))) 2)) + spaceline-responsive nil) (setq-default mode-line-format (spaceline-spacemacs-theme)))) ;;;;; Chrome -- cgit 1.4.1 From bf0af92abc1a0c038851ced7ac7d7592aed4643f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 9 Feb 2018 12:45:43 +0100 Subject: Emacs: Disable company-lsp async It currently doesn't work as well --- emacs/.emacs.d/main.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index aadb65ba..b5b28d4f 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1932,7 +1932,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." :after (company lsp-mode) :config (progn (add-to-list 'company-backends #'company-lsp) - (setq company-lsp-async t))) + (setq company-lsp-async nil))) ;;;;; Lisps -- cgit 1.4.1 From 493e4adfad76edd402c86f0c241b275d3fcc7e47 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 9 Feb 2018 12:46:00 +0100 Subject: Emacs: Configure prog-fill --- emacs/.emacs.d/main.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index b5b28d4f..1318d388 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1854,7 +1854,10 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (use-package prog-fill :bind (:map prog-mode-map - ("M-q" . prog-fill))) + ("M-q" . prog-fill)) + :config (progn + (setq prog-fill-floating-close-paren-p nil + prog-fill-floating-open-paren-p nil))) ;;;;; golang -- cgit 1.4.1 From 6853e6098c858939515d429cfbdd026f5e22c50e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 12 Feb 2018 14:12:59 +0100 Subject: Move more startup applications to nixos configuration --- xprofile/.xprofile | 7 ------- 1 file changed, 7 deletions(-) diff --git a/xprofile/.xprofile b/xprofile/.xprofile index caa4a301..e63b62b1 100755 --- a/xprofile/.xprofile +++ b/xprofile/.xprofile @@ -1,11 +1,4 @@ #!/bin/sh -# Needed for pass/rofi-pass autotype -setxkbmap us -variant colemak xmodmap .xmodmaprc -nm-applet & -if command -v autorandr -then - autorandr --change --force -fi xrdb -I$HOME/.xresources .xresources/main -- cgit 1.4.1 From 549946dbbe021a1cda2c4e88a82786c97c355455 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 15 Feb 2018 16:39:20 +0100 Subject: Emacs: Automatically resize powerline after setting font --- emacs/.emacs.d/main.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 1318d388..66bfed80 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -257,6 +257,10 @@ (setq powerline-default-separator 'bar powerline-height (* 2 (ceiling (* (default-font-height) (+ 1 (* 2 line-spacing))) 2)) spaceline-responsive nil) + (define-hook-helper after-setting-font () + :name resize-powerline + (setq powerline-height (* 2 (ceiling (* (default-font-height) (+ 1 (* 2 line-spacing))) 2))) + (setq-default mode-line-format (spaceline-spacemacs-theme))) (setq-default mode-line-format (spaceline-spacemacs-theme)))) ;;;;; Chrome -- cgit 1.4.1 From bd72be45196ceb2c35182d3abd09dfc138a052d2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 18 Feb 2018 18:05:59 +0100 Subject: Use bitmap fonts again --- xresources/.xresources/main | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/xresources/.xresources/main b/xresources/.xresources/main index cb079fb0..4b1cbe10 100644 --- a/xresources/.xresources/main +++ b/xresources/.xresources/main @@ -8,7 +8,7 @@ Emacs.MenuBar: off Emacs.ScrollBars: off Emacs.CursorBlink: off -rofi.font: Fantasque Sans Mono 18 +rofi.font: Terminus Bold 14 URxvt.fading: 0 URxvt.geometry: 100x40 @@ -22,16 +22,17 @@ URxvt.scrollTtyKeypress: true URxvt.saveLines: 16384 URxvt.secondaryScroll: false -URxvt.font: xft:monospace:size=10 -URxvt.boldFont: xft:monospace:bold:size=10 +URxvt.font: -xos4-terminus-medium-r-*-*-12-*-*-*-*-*-iso10646-* +URxvt.boldFont: -xos4-terminus-bold-r-*-*-12-*-*-*-*-*-iso10646-* URxvt.intensityStyles: true URxvt.pointerBlank: true URxvt.pointerBlankDelay: 987654321 URxvt.letterSpace: 0 +URxvt.lineSpace: 2 -Emacs.Font: monospace-10 -Emacs.fixed-pitch.attributeFont: monospace-10 +Emacs.Font: -xos4-terminus-medium-r-*-*-12-*-*-*-*-*-iso10646-* +Emacs.fixed-pitch.attributeFont: -xos4-terminus-medium-r-*-*-12-*-*-*-*-*-iso10646-* Emacs.variable-pitch.attributeFont: sans-10 ! Local Variables: -- cgit 1.4.1 From b26312bf138d8843216610ddf7b7251c58b4efdb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 18 Feb 2018 18:06:16 +0100 Subject: Emacs: add line spacing --- emacs/.emacs.d/main.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 66bfed80..01ca54d9 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -168,6 +168,8 @@ (when (or (display-graphic-p) (daemonp)) + (setq-default line-spacing 0.2) + (defun use-variable-fonts () (interactive) (variable-pitch-mode) -- cgit 1.4.1 From 3003eede7cd7f0fab0374dfe9bbd650095e560b6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 18 Feb 2018 18:06:29 +0100 Subject: Emacs: Tweak theme --- emacs/.emacs.d/main.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 01ca54d9..09e43d14 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -151,7 +151,7 @@ '(git-gutter-fr:added ((t (:foreground "#b8b8b8")))) '(git-gutter-fr:modified ((t (:foreground "#b8b8b8")))) '(git-gutter-fr:deleted ((t (:foreground "#b8b8b8")))) - '(font-lock-string-face ((t (:slant normal))))))) + '(mode-line ((t (:height 1.0))))))) ;; Highlighting quasi-quoted expressions in lisps is quite useful, but I ;; don't need it all the time. I'll keep it around for a while so that I -- cgit 1.4.1 From 70a0e3c9784071b8f0470b868d3595584da235da Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 21 Feb 2018 11:23:47 +0100 Subject: Emacs: Fix chained method call indentation in Javascript --- emacs/.emacs.d/main.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 09e43d14..d75ce9a0 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -2117,6 +2117,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (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) + (advice-add #'js--multi-line-declaration-indentation :around (lambda (orig-fun &rest args) nil)) (setq js2-basic-offset 2 js-switch-indent-offset 2 js2-include-node-externs t -- cgit 1.4.1 From 64d4ecbb08d57d9399eaad9bf5a7870054f99e80 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 21 Feb 2018 11:24:20 +0100 Subject: Emacs: Fix incorrect function call --- emacs/.emacs.d/main.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index d75ce9a0..4cab6c05 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -574,7 +574,7 @@ (use-package counsel-projectile :after (counsel projectile) :config (progn - (counsel-projectile-on) + (counsel-projectile-mode +1) (def-projectile-commander-method ?A "Find rg on project." (call-interactively #'counsel-projectile-rg)) -- cgit 1.4.1 From 32fb6f5257e0b8a494d10d203b5a64f1e1e3548b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 21 Feb 2018 11:44:18 +0100 Subject: MBSync: propagate remote deletions --- isync/.mbsyncrc | 1 + 1 file changed, 1 insertion(+) diff --git a/isync/.mbsyncrc b/isync/.mbsyncrc index 7e6f5e14..d6499fb4 100644 --- a/isync/.mbsyncrc +++ b/isync/.mbsyncrc @@ -1,6 +1,7 @@ # Globals Create Both Remove Both +Expunge Slave CopyArrivalDate yes ## Personal -- cgit 1.4.1 From 115d6f250fc30150a3c7555e0ba50122710bbd39 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 21 Feb 2018 15:53:16 +0100 Subject: Emacs: Fix counsel-projectile preferring ag to rg --- emacs/.emacs.d/main.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 4cab6c05..e0c7cd54 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -578,7 +578,7 @@ (def-projectile-commander-method ?A "Find rg on project." (call-interactively #'counsel-projectile-rg)) - (define-key projectile-mode-map [remap counsel-projectile-ag] #'counsel-projectile-rg))) + (define-key counsel-projectile-command-map (kbd "s s") #'counsel-projectile-rg))) ;;;;; vc -- cgit 1.4.1 From 8fb9f5aaec6f6af7fcff8e2fcf8d35a4f7e48b48 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 21 Feb 2018 15:53:38 +0100 Subject: Emacs: Grab symbol at point for ripgrep searches --- emacs/.emacs.d/main.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index e0c7cd54..02960ece 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -578,6 +578,7 @@ (def-projectile-commander-method ?A "Find rg on project." (call-interactively #'counsel-projectile-rg)) + (setq counsel-projectile-rg-initial-input '(projectile-symbol-or-selection-at-point)) (define-key counsel-projectile-command-map (kbd "s s") #'counsel-projectile-rg))) ;;;;; vc -- cgit 1.4.1 From 5467302f079380900f2d55c80c9a9e92460137a2 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 21 Feb 2018 15:53:54 +0100 Subject: mbsync: Sync expunges in both directions --- isync/.mbsyncrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/isync/.mbsyncrc b/isync/.mbsyncrc index d6499fb4..1a1d7564 100644 --- a/isync/.mbsyncrc +++ b/isync/.mbsyncrc @@ -1,7 +1,7 @@ # Globals Create Both Remove Both -Expunge Slave +Expunge Both CopyArrivalDate yes ## Personal -- cgit 1.4.1 From 11d81ea917c58513ce67e80c91cd831e8f45e8c6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 22 Feb 2018 12:46:07 +0100 Subject: Add npm version bump command --- emacs/.emacs.d/main.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 02960ece..08e401dc 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -535,6 +535,12 @@ (projectile-with-default-dir (projectile-project-root) (cmd-to-echo "npx" cmd))) + (defun npm-version (type) + (interactive (list + (projectile-completing-read "version: " '("major" "minor" "patch" "premajor" "preminor" "prepatch" "prerelease" "from-git")))) + (projectile-with-default-dir (projectile-project-root) + (cmd-to-echo "npm" (concat "version " type)))) + (defun ap/open-project (&optional arg) (interactive "P") (let ((project-dir (projectile-completing-read -- cgit 1.4.1 From bb29bf2171e3b46ccfbf1fd49e568ee7df405510 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 28 Feb 2018 10:34:28 +0100 Subject: Emacs: Don't hide trashed messages Not needed now that I fixed mbsync --- emacs/.emacs.d/main.el | 4 ---- 1 file changed, 4 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 08e401dc..7cd85672 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1288,10 +1288,6 @@ With two prefix arguments, write out the day and month name." mu4e-maildir (expand-file-name "~/mail") - mu4e-headers-hide-predicate - (lambda (msg) - (member 'trashed (mu4e-message-field msg :flags))) - mu4e-change-filenames-when-moving t message-kill-buffer-on-exit t -- cgit 1.4.1 From 19181d1f21adf3c87a13b0901724d6828016e5a6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 6 Mar 2018 12:50:34 +0100 Subject: i3: use qwerty keybinds again --- i3/.config/i3/config | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index a9e41e62..073264e5 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -80,10 +80,10 @@ bindsym --release $mod+Shift+semicolon exec rofi-pass bindsym --release $mod+space exec "rofi -show combi -combi-modi window,drun,ssh" # change focus -bindsym $mod+n focus left -bindsym $mod+e focus down -bindsym $mod+i focus up -bindsym $mod+o focus right +bindsym $mod+h focus left +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l focus right # alternatively, you can use the cursor keys: bindsym $mod+Left focus left @@ -92,10 +92,10 @@ bindsym $mod+Up focus up bindsym $mod+Right focus right # move focused window -bindsym $mod+Shift+n move left -bindsym $mod+Shift+e move down -bindsym $mod+Shift+i move up -bindsym $mod+Shift+o move right +bindsym $mod+Shift+h move left +bindsym $mod+Shift+j move down +bindsym $mod+Shift+k move up +bindsym $mod+Shift+l move right # alternatively, you can use the cursor keys: bindsym $mod+Shift+Left move left @@ -104,7 +104,7 @@ bindsym $mod+Shift+Up move up bindsym $mod+Shift+Right move right # split in horizontal orientation -bindsym $mod+h split h +bindsym $mod+b split h # split in vertical orientation bindsym $mod+v split v @@ -153,7 +153,7 @@ bindsym $mod+Shift+8 move container to workspace 8 bindsym $mod+Shift+9 move container to workspace 9 bindsym $mod+Shift+0 move container to workspace 10 -bindsym $mod+l exec --no-startup-id "$Locker" +bindsym $mod+o exec --no-startup-id "$Locker" # reload the configuration file bindsym $mod+Shift+c reload # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) @@ -169,10 +169,10 @@ mode "resize" { # Pressing right will grow the window’s width. # Pressing up will shrink the window’s height. # Pressing down will grow the window’s height. - bindsym n resize shrink width 10 px or 10 ppt - bindsym e resize grow height 10 px or 10 ppt - bindsym i resize shrink height 10 px or 10 ppt - bindsym o resize grow width 10 px or 10 ppt + bindsym h resize shrink width 10 px or 10 ppt + bindsym j resize grow height 10 px or 10 ppt + bindsym k resize shrink height 10 px or 10 ppt + bindsym l resize grow width 10 px or 10 ppt # same bindings, but for the arrow keys bindsym Left resize shrink width 10 px or 10 ppt -- cgit 1.4.1 From 113d47cdde4a3cd152322dc6edddb2ddf40d0614 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 6 Mar 2018 13:32:30 +0100 Subject: Emacs: setup ivy-hydra --- emacs/.emacs.d/main.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 7cd85672..0f8c6871 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -578,7 +578,7 @@ (projectile-register-project-type 'node '("package.json") "npm start" "npm test"))) (use-package counsel-projectile - :after (counsel projectile) + :after (counsel projectile ivy-hydra) :config (progn (counsel-projectile-mode +1) (def-projectile-commander-method ?A @@ -1512,6 +1512,8 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." "kill"))) (add-to-list 'ivy-initial-inputs-alist '(counsel-M-x . "")))) +(use-package ivy-hydra) + ;;;;; counsel (use-package counsel -- cgit 1.4.1 From 075223102a057a4215b9caaa51b1fc9217875044 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 6 Mar 2018 13:32:49 +0100 Subject: Emacs: Don't warn on inconsistent js return statements --- emacs/.emacs.d/main.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 0f8c6871..3689a33b 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -2127,7 +2127,8 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." js-switch-indent-offset 2 js2-include-node-externs t js2-highlight-level 1 - js2-strict-missing-semi-warning nil))) + js2-strict-missing-semi-warning nil + js2-strict-inconsistent-return-warning nil))) ;;;;;;; rjsx-mode -- cgit 1.4.1 From 698a537fc74f61523b911b60750507d54b6ea32d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 6 Mar 2018 13:33:16 +0100 Subject: Emacs: use normal qwerty avy-keys --- emacs/.emacs.d/main.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 3689a33b..c1f87ce2 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -2574,8 +2574,7 @@ Pass ARG to `comint-delchar-or-maybe-eof'." ("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 ?\;)))) + (setq avy-all-windows nil))) ;;;;;; ace-link -- cgit 1.4.1 From 3e53beeb422547fd76153e6bec39bc2095fcaae0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 6 Mar 2018 13:34:04 +0100 Subject: Emacs: improve mocha output --- emacs/.emacs.d/main.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index c1f87ce2..e7499494 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -2144,7 +2144,7 @@ With prefix TO-CURRENT-BUFFER, insert command output into buffer." (use-package mocha :after js2-mode :config (progn - (setq mocha-reporter "tap" + (setq mocha-reporter "spec" mocha-options "--bail") (defun mocha-test-project () "Test the current project." -- cgit 1.4.1 From 65ce8c999a001071ca452e1ccf65f5b4ca8e8062 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 6 Mar 2018 13:34:36 +0100 Subject: Emacs: run npm version as a normal shell command --- emacs/.emacs.d/main.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index e7499494..b6fe9781 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -539,7 +539,7 @@ (interactive (list (projectile-completing-read "version: " '("major" "minor" "patch" "premajor" "preminor" "prepatch" "prerelease" "from-git")))) (projectile-with-default-dir (projectile-project-root) - (cmd-to-echo "npm" (concat "version " type)))) + (message (shell-command-to-string (concat "npm" " version " type))))) (defun ap/open-project (&optional arg) (interactive "P") -- cgit 1.4.1 From 64b1ff7265e2fb004ccd8625a0a0079f53439550 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 6 Mar 2018 13:34:59 +0100 Subject: Emacs: fix helpful keybinds --- emacs/.emacs.d/main.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index b6fe9781..6ecfaffb 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1196,9 +1196,11 @@ With two prefix arguments, write out the day and month name." ;;;;; helpful (use-package helpful - :bind (("C-h k" . helpful-key) - ("C-h v" . helpful-variable) - ("C-h f" . helpful-callable))) + :after ehelp + :bind (:map ehelp-map + ("k" . helpful-key) + ("v" . helpful-variable) + ("f" . helpful-callable))) ;;;;; ehelp -- cgit 1.4.1 From 35880803edc720a2ab5863b3f555cf045677f85e Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 7 Mar 2018 17:43:13 +0100 Subject: i3: add easier keybind for exit menu --- i3/.config/i3/config | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 073264e5..e813a81a 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -158,8 +158,6 @@ bindsym $mod+o exec --no-startup-id "$Locker" bindsym $mod+Shift+c reload # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) bindsym $mod+Shift+p restart -# exit i3 (logs you out of your X session) -bindsym $mod+Shift+q exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" # resize window (you can also use the mouse for that) mode "resize" { @@ -240,6 +238,7 @@ mode "$mode_system" { bindsym $mod+Pause mode "$mode_system" bindsym $mod+Escape mode "$mode_system" +bindsym $mod+Shift+q mode "$mode_system" # Start i3bar to display a workspace bar (plus the system information i3status # finds out, if available) -- cgit 1.4.1 From 45a7d255cdaf0f30b61f06880d4da278565b083f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 7 Mar 2018 17:43:49 +0100 Subject: Remove xmodmap content --- xmodmap/.xmodmaprc | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/xmodmap/.xmodmaprc b/xmodmap/.xmodmaprc index 82a8674f..e69de29b 100644 --- a/xmodmap/.xmodmaprc +++ b/xmodmap/.xmodmaprc @@ -1,20 +0,0 @@ -keycode 37 = Super_L NoSymbol Super_L -keycode 133 = Alt_L Meta_L Alt_L Meta_L -keycode 64 = Control_L NoSymbol Control_L - -! Thinkpad has PrtSc next to Alt_R -keycode 108 = Control_R NoSymbol Control_R -keycode 107 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift -keycode 105 = Super_R NoSymbol Super_R -! For external keyboards -keycode 134 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift - -clear Control -clear Mod1 -clear Mod3 -clear Mod4 - -add Control = Control_L Control_R -add Mod1 = Alt_L Meta_L -add Mod4 = Super_L Super_R Super_L Hyper_L -add Mod5 = ISO_Level3_Shift Mode_switch \ No newline at end of file -- cgit 1.4.1 From f692f481647054d28735c4e8222f5ef7db1d8751 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 19 Mar 2018 15:07:48 +0100 Subject: Emacs: add extra discover-my-major keybind --- emacs/.emacs.d/main.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el index 6ecfaffb..0c0bd944 100644 --- a/emacs/.emacs.d/main.el +++ b/emacs/.emacs.d/main.el @@ -1215,7 +1215,8 @@ With two prefix arguments, write out the day and month name." ;; A nicer way to browse keybindings for major modes. (use-package discover-my-major - :bind ("" . discover-my-major)) + :bind (("" . discover-my-major) + ("C-c C-m" . discover-my-major))) ;;;;; which-key -- cgit 1.4.1 From 40d896c668b85ee6c25730daeabd760253254ad1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 21 Mar 2018 16:37:41 +0100 Subject: Create overlay of custom node packages --- .../nixpkgs/overlays/node-packages/composition.nix | 16 + .../nixpkgs/overlays/node-packages/default.nix | 8 + .../nixpkgs/overlays/node-packages/generate.sh | 1 + .../nixpkgs/overlays/node-packages/node-env.nix | 497 +++++++++++++++++++++ .../overlays/node-packages/node-packages.json | 3 + .../overlays/node-packages/node-packages.nix | 148 ++++++ 6 files changed, 673 insertions(+) create mode 100644 nix/.config/nixpkgs/overlays/node-packages/composition.nix create mode 100644 nix/.config/nixpkgs/overlays/node-packages/default.nix create mode 100755 nix/.config/nixpkgs/overlays/node-packages/generate.sh create mode 100644 nix/.config/nixpkgs/overlays/node-packages/node-env.nix create mode 100644 nix/.config/nixpkgs/overlays/node-packages/node-packages.json create mode 100644 nix/.config/nixpkgs/overlays/node-packages/node-packages.nix diff --git a/nix/.config/nixpkgs/overlays/node-packages/composition.nix b/nix/.config/nixpkgs/overlays/node-packages/composition.nix new file mode 100644 index 00000000..15b445fb --- /dev/null +++ b/nix/.config/nixpkgs/overlays/node-packages/composition.nix @@ -0,0 +1,16 @@ +# This file has been generated by node2nix 1.5.1. Do not edit! + +{pkgs ? import { + inherit system; + }, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-8_x"}: + +let + nodeEnv = import ./node-env.nix { + inherit (pkgs) stdenv python2 utillinux runCommand writeTextFile; + inherit nodejs; + }; +in +import ./node-packages.nix { + inherit (pkgs) fetchurl fetchgit; + inherit nodeEnv; +} \ No newline at end of file diff --git a/nix/.config/nixpkgs/overlays/node-packages/default.nix b/nix/.config/nixpkgs/overlays/node-packages/default.nix new file mode 100644 index 00000000..f8521fc4 --- /dev/null +++ b/nix/.config/nixpkgs/overlays/node-packages/default.nix @@ -0,0 +1,8 @@ +self: super: + +let + nodePackages = super.callPackage ./composition.nix {}; +in +{ + bmpr = nodePackages.bmpr; +} diff --git a/nix/.config/nixpkgs/overlays/node-packages/generate.sh b/nix/.config/nixpkgs/overlays/node-packages/generate.sh new file mode 100755 index 00000000..5103d5c4 --- /dev/null +++ b/nix/.config/nixpkgs/overlays/node-packages/generate.sh @@ -0,0 +1 @@ +node2nix -8 -i node-packages.json -c composition.nix diff --git a/nix/.config/nixpkgs/overlays/node-packages/node-env.nix b/nix/.config/nixpkgs/overlays/node-packages/node-env.nix new file mode 100644 index 00000000..15bc6c63 --- /dev/null +++ b/nix/.config/nixpkgs/overlays/node-packages/node-env.nix @@ -0,0 +1,497 @@ +# This file originates from node2nix + +{stdenv, nodejs, python2, utillinux, runCommand, writeTextFile}: + +let + python = if nodejs ? python then nodejs.python else python2; + + # Create a tar wrapper that filters all the 'Ignoring unknown extended header keyword' noise + tarWrapper = runCommand "tarWrapper" {} '' + mkdir -p $out/bin + + cat > $out/bin/tar <> $out/nix-support/hydra-build-products + ''; + }; + + includeDependencies = {dependencies}: + stdenv.lib.optionalString (dependencies != []) + (stdenv.lib.concatMapStrings (dependency: + '' + # Bundle the dependencies of the package + mkdir -p node_modules + cd node_modules + + # Only include dependencies if they don't exist. They may also be bundled in the package. + if [ ! -e "${dependency.name}" ] + then + ${composePackage dependency} + fi + + cd .. + '' + ) dependencies); + + # Recursively composes the dependencies of a package + composePackage = { name, packageName, src, dependencies ? [], ... }@args: + '' + DIR=$(pwd) + cd $TMPDIR + + unpackFile ${src} + + # Make the base dir in which the target dependency resides first + mkdir -p "$(dirname "$DIR/${packageName}")" + + if [ -f "${src}" ] + then + # Figure out what directory has been unpacked + packageDir="$(find . -maxdepth 1 -type d | tail -1)" + + # Restore write permissions to make building work + find "$packageDir" -type d -print0 | xargs -0 chmod u+x + chmod -R u+w "$packageDir" + + # Move the extracted tarball into the output folder + mv "$packageDir" "$DIR/${packageName}" + elif [ -d "${src}" ] + then + # Get a stripped name (without hash) of the source directory. + # On old nixpkgs it's already set internally. + if [ -z "$strippedName" ] + then + strippedName="$(stripHash ${src})" + fi + + # Restore write permissions to make building work + chmod -R u+w "$strippedName" + + # Move the extracted directory into the output folder + mv "$strippedName" "$DIR/${packageName}" + fi + + # Unset the stripped name to not confuse the next unpack step + unset strippedName + + # Include the dependencies of the package + cd "$DIR/${packageName}" + ${includeDependencies { inherit dependencies; }} + cd .. + ${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} + ''; + + pinpointDependencies = {dependencies, production}: + let + pinpointDependenciesFromPackageJSON = writeTextFile { + name = "pinpointDependencies.js"; + text = '' + var fs = require('fs'); + var path = require('path'); + + function resolveDependencyVersion(location, name) { + if(location == process.env['NIX_STORE']) { + return null; + } else { + var dependencyPackageJSON = path.join(location, "node_modules", name, "package.json"); + + if(fs.existsSync(dependencyPackageJSON)) { + var dependencyPackageObj = JSON.parse(fs.readFileSync(dependencyPackageJSON)); + + if(dependencyPackageObj.name == name) { + return dependencyPackageObj.version; + } + } else { + return resolveDependencyVersion(path.resolve(location, ".."), name); + } + } + } + + function replaceDependencies(dependencies) { + if(typeof dependencies == "object" && dependencies !== null) { + for(var dependency in dependencies) { + var resolvedVersion = resolveDependencyVersion(process.cwd(), dependency); + + if(resolvedVersion === null) { + process.stderr.write("WARNING: cannot pinpoint dependency: "+dependency+", context: "+process.cwd()+"\n"); + } else { + dependencies[dependency] = resolvedVersion; + } + } + } + } + + /* Read the package.json configuration */ + var packageObj = JSON.parse(fs.readFileSync('./package.json')); + + /* Pinpoint all dependencies */ + replaceDependencies(packageObj.dependencies); + if(process.argv[2] == "development") { + replaceDependencies(packageObj.devDependencies); + } + replaceDependencies(packageObj.optionalDependencies); + + /* Write the fixed package.json file */ + fs.writeFileSync("package.json", JSON.stringify(packageObj, null, 2)); + ''; + }; + in + '' + node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"} + + ${stdenv.lib.optionalString (dependencies != []) + '' + if [ -d node_modules ] + then + cd node_modules + ${stdenv.lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies} + cd .. + fi + ''} + ''; + + # Recursively traverses all dependencies of a package and pinpoints all + # dependencies in the package.json file to the versions that are actually + # being used. + + pinpointDependenciesOfPackage = { packageName, dependencies ? [], production ? true, ... }@args: + '' + if [ -d "${packageName}" ] + then + cd "${packageName}" + ${pinpointDependencies { inherit dependencies production; }} + cd .. + ${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} + fi + ''; + + # Extract the Node.js source code which is used to compile packages with + # native bindings + nodeSources = runCommand "node-sources" {} '' + tar --no-same-owner --no-same-permissions -xf ${nodejs.src} + mv node-* $out + ''; + + # Script that adds _integrity fields to all package.json files to prevent NPM from consulting the cache (that is empty) + addIntegrityFieldsScript = writeTextFile { + name = "addintegrityfields.js"; + text = '' + var fs = require('fs'); + var path = require('path'); + + function augmentDependencies(baseDir, dependencies) { + for(var dependencyName in dependencies) { + var dependency = dependencies[dependencyName]; + + // Open package.json and augment metadata fields + var packageJSONDir = path.join(baseDir, "node_modules", dependencyName); + var packageJSONPath = path.join(packageJSONDir, "package.json"); + + if(fs.existsSync(packageJSONPath)) { // Only augment packages that exist. Sometimes we may have production installs in which development dependencies can be ignored + console.log("Adding metadata fields to: "+packageJSONPath); + var packageObj = JSON.parse(fs.readFileSync(packageJSONPath)); + + if(dependency.integrity) { + packageObj["_integrity"] = dependency.integrity; + } else { + packageObj["_integrity"] = "sha1-000000000000000000000000000="; // When no _integrity string has been provided (e.g. by Git dependencies), add a dummy one. It does not seem to harm and it bypasses downloads. + } + + packageObj["_resolved"] = dependency.version; // Set the resolved version to the version identifier. This prevents NPM from cloning Git repositories. + fs.writeFileSync(packageJSONPath, JSON.stringify(packageObj, null, 2)); + } + + // Augment transitive dependencies + if(dependency.dependencies !== undefined) { + augmentDependencies(packageJSONDir, dependency.dependencies); + } + } + } + + if(fs.existsSync("./package-lock.json")) { + var packageLock = JSON.parse(fs.readFileSync("./package-lock.json")); + + if(packageLock.lockfileVersion !== 1) { + process.stderr.write("Sorry, I only understand lock file version 1!\n"); + process.exit(1); + } + + if(packageLock.dependencies !== undefined) { + augmentDependencies(".", packageLock.dependencies); + } + } + ''; + }; + + # Reconstructs a package-lock file from the node_modules/ folder structure and package.json files with dummy sha1 hashes + reconstructPackageLock = writeTextFile { + name = "addintegrityfields.js"; + text = '' + var fs = require('fs'); + var path = require('path'); + + var packageObj = JSON.parse(fs.readFileSync("package.json")); + + var lockObj = { + name: packageObj.name, + version: packageObj.version, + lockfileVersion: 1, + requires: true, + dependencies: {} + }; + + function augmentPackageJSON(filePath, dependencies) { + var packageJSON = path.join(filePath, "package.json"); + if(fs.existsSync(packageJSON)) { + var packageObj = JSON.parse(fs.readFileSync(packageJSON)); + dependencies[packageObj.name] = { + version: packageObj.version, + integrity: "sha1-000000000000000000000000000=", + dependencies: {} + }; + processDependencies(path.join(filePath, "node_modules"), dependencies[packageObj.name].dependencies); + } + } + + function processDependencies(dir, dependencies) { + if(fs.existsSync(dir)) { + var files = fs.readdirSync(dir); + + files.forEach(function(entry) { + var filePath = path.join(dir, entry); + var stats = fs.statSync(filePath); + + if(stats.isDirectory()) { + if(entry.substr(0, 1) == "@") { + // When we encounter a namespace folder, augment all packages belonging to the scope + var pkgFiles = fs.readdirSync(filePath); + + pkgFiles.forEach(function(entry) { + if(stats.isDirectory()) { + var pkgFilePath = path.join(filePath, entry); + augmentPackageJSON(pkgFilePath, dependencies); + } + }); + } else { + augmentPackageJSON(filePath, dependencies); + } + } + }); + } + } + + processDependencies("node_modules", lockObj.dependencies); + + fs.writeFileSync("package-lock.json", JSON.stringify(lockObj, null, 2)); + ''; + }; + + # Builds and composes an NPM package including all its dependencies + buildNodePackage = { name, packageName, version, dependencies ? [], production ? true, npmFlags ? "", dontNpmInstall ? false, bypassCache ? false, preRebuild ? "", ... }@args: + + let + forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com"; + in + stdenv.lib.makeOverridable stdenv.mkDerivation (builtins.removeAttrs args [ "dependencies" ] // { + name = "node-${name}-${version}"; + buildInputs = [ tarWrapper python nodejs ] ++ stdenv.lib.optional (stdenv.isLinux) utillinux ++ args.buildInputs or []; + dontStrip = args.dontStrip or true; # Striping may fail a build for some package deployments + + inherit dontNpmInstall preRebuild; + + unpackPhase = args.unpackPhase or "true"; + + buildPhase = args.buildPhase or "true"; + + compositionScript = composePackage args; + pinpointDependenciesScript = pinpointDependenciesOfPackage args; + + passAsFile = [ "compositionScript" "pinpointDependenciesScript" ]; + + installPhase = args.installPhase or '' + # Create and enter a root node_modules/ folder + mkdir -p $out/lib/node_modules + cd $out/lib/node_modules + + # Compose the package and all its dependencies + source $compositionScriptPath + + # Pinpoint the versions of all dependencies to the ones that are actually being used + echo "pinpointing versions of dependencies..." + source $pinpointDependenciesScriptPath + + # Patch the shebangs of the bundled modules to prevent them from + # calling executables outside the Nix store as much as possible + patchShebangs . + + # Deploy the Node.js package by running npm install. Since the + # dependencies have been provided already by ourselves, it should not + # attempt to install them again, which is good, because we want to make + # it Nix's responsibility. If it needs to install any dependencies + # anyway (e.g. because the dependency parameters are + # incomplete/incorrect), it fails. + # + # The other responsibilities of NPM are kept -- version checks, build + # steps, postprocessing etc. + + export HOME=$TMPDIR + cd "${packageName}" + runHook preRebuild + + ${stdenv.lib.optionalString bypassCache '' + if [ ! -f package-lock.json ] + then + echo "No package-lock.json file found, reconstructing..." + node ${reconstructPackageLock} + fi + + node ${addIntegrityFieldsScript} + ''} + + npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild + + if [ "$dontNpmInstall" != "1" ] + then + # NPM tries to download packages even when they already exist if npm-shrinkwrap is used. + rm -f npm-shrinkwrap.json + + npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} install + fi + + # Create symlink to the deployed executable folder, if applicable + if [ -d "$out/lib/node_modules/.bin" ] + then + ln -s $out/lib/node_modules/.bin $out/bin + fi + + # Create symlinks to the deployed manual page folders, if applicable + if [ -d "$out/lib/node_modules/${packageName}/man" ] + then + mkdir -p $out/share + for dir in "$out/lib/node_modules/${packageName}/man/"* + do + mkdir -p $out/share/man/$(basename "$dir") + for page in "$dir"/* + do + ln -s $page $out/share/man/$(basename "$dir") + done + done + fi + + # Run post install hook, if provided + runHook postInstall + ''; + }); + + # Builds a development shell + buildNodeShell = { name, packageName, version, src, dependencies ? [], production ? true, npmFlags ? "", dontNpmInstall ? false, bypassCache ? false, ... }@args: + let + forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com"; + + nodeDependencies = stdenv.mkDerivation { + name = "node-dependencies-${name}-${version}"; + + buildInputs = [ tarWrapper python nodejs ] ++ stdenv.lib.optional (stdenv.isLinux) utillinux ++ args.buildInputs or []; + + includeScript = includeDependencies { inherit dependencies; }; + pinpointDependenciesScript = pinpointDependenciesOfPackage args; + + passAsFile = [ "includeScript" "pinpointDependenciesScript" ]; + + buildCommand = '' + mkdir -p $out/${packageName} + cd $out/${packageName} + + source $includeScriptPath + + # Create fake package.json to make the npm commands work properly + cp ${src}/package.json . + chmod 644 package.json + ${stdenv.lib.optionalString bypassCache '' + if [ -f ${src}/package-lock.json ] + then + cp ${src}/package-lock.json . + fi + ''} + + # Pinpoint the versions of all dependencies to the ones that are actually being used + echo "pinpointing versions of dependencies..." + cd .. + source $pinpointDependenciesScriptPath + cd ${packageName} + + # Patch the shebangs of the bundled modules to prevent them from + # calling executables outside the Nix store as much as possible + patchShebangs . + + export HOME=$PWD + + ${stdenv.lib.optionalString bypassCache '' + if [ ! -f package-lock.json ] + then + echo "No package-lock.json file found, reconstructing..." + node ${reconstructPackageLock} + fi + + node ${addIntegrityFieldsScript} + ''} + + npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild + + ${stdenv.lib.optionalString (!dontNpmInstall) '' + # NPM tries to download packages even when they already exist if npm-shrinkwrap is used. + rm -f npm-shrinkwrap.json + + npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} install + ''} + + cd .. + mv ${packageName} lib + ln -s $out/lib/node_modules/.bin $out/bin + ''; + }; + in + stdenv.lib.makeOverridable stdenv.mkDerivation { + name = "node-shell-${name}-${version}"; + + buildInputs = [ python nodejs ] ++ stdenv.lib.optional (stdenv.isLinux) utillinux ++ args.buildInputs or []; + buildCommand = '' + mkdir -p $out/bin + cat > $out/bin/shell <