From 7cec58210aa2a805279b7c96d4241a0bacbcae84 Mon Sep 17 00:00:00 2001 From: Vincent Date: Wed, 6 Mar 2013 11:51:13 -0800 Subject: Initial commit --- README.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000000..ec381bcd29 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +dotfiles +======== + +Various configuration files \ No newline at end of file -- cgit 1.4.1 From 8dfa868c2fecbefc9d220196505ebda04d609ea8 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 6 Mar 2013 21:13:01 +0100 Subject: xnomad & zshrc --- xnomad | 20 ++++++++++++++++++++ zshrc | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 xnomad create mode 100644 zshrc diff --git a/xnomad b/xnomad new file mode 100644 index 0000000000..4a2adc0258 --- /dev/null +++ b/xnomad @@ -0,0 +1,20 @@ +{ + "Ratio": 0.7, + "WindowsInMaster": 1, + "Hotkeys": { + "Swap": { "key": "s", "modifiers": [ "option", "control" ] }, + "SelectPrev": { "key": "j", "modifiers": [ "option", "control" ] }, + "SelectNext": { "key": "k", "modifiers": [ "option", "control" ] }, + "SwapPrev": { "key": "j", "modifiers": [ "option", "control", "command" ] }, + "SwapNext": { "key": "k", "modifiers": [ "option", "control", "command" ] }, + "FocusDisplay1": { "key": "e", "modifiers": [ "option", "control" ] }, + "FocusDisplay2": { "key": "w", "modifiers": [ "option", "control" ] }, + "ToDisplay1": { "key": "e", "modifiers": [ "option", "control", "command" ] }, + "ToDisplay2": { "key": "w", "modifiers": [ "option", "control", "command" ] }, + "CycleLayouts": { "key": " ", "modifiers": [ "option", "control", "command" ] }, + "IncreaseRatio": { "key": "l", "modifiers": [ "option", "control" ] }, + "DecreaseRatio": { "key": "h", "modifiers": [ "option", "control" ] }, + "MoreMasters": { "key": ".", "modifiers": [ "option", "control" ] }, + "FewerMasters": { "key": ",", "modifiers": [ "option", "control" ] } + } +} diff --git a/zshrc b/zshrc new file mode 100644 index 0000000000..a6cc783a32 --- /dev/null +++ b/zshrc @@ -0,0 +1,60 @@ +zmodload -a colors +zmodload -a autocomplete +autoload -U age && age + +export EDITOR='subl -w' + +[ -x /usr/bin/dircolors ] && eval $(dircolors) +zstyle ':completion:*' menu select=2 +zstyle ':completion:*' verbose true +zstyle ':completion:*' extra-verbose true +zstyle ':completion:*' use-cache on +zstyle ':completion:*' cache-path ~/.zsh/cache +zstyle ':completion:*:approximate:*' max-errors 1 numeric +zstyle ':completion:*:functions' ignored-patterns '_*' +zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} +zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate + +autoload -Uz compinit && compinit + +setopt autocd autopushd pushdminus pushdsilent pushdtohome +setopt HIST_REDUCE_BLANKS HIST_IGNORE_SPACE SHARE_HISTORY inc_append_history +setopt no_hup no_clobber print_exit_value +setopt extendedglob glob_dots +setopt correct +setopt completealiases + +case $TERM in + rxvt|*term) + precmd() { print -Pn "\e]0;%m:%~\a" } + preexec () { print -Pn "\e]0;$1\a" } + ;; +esac + +autoload -U colors && colors +PS1="%{%B$fg[blue]%}%n%{$reset_color%B%}@%{%b$fg[magenta]%}%1~ %{$reset_color%}%# " +### PIERRE: # PS1="%{%B$fg[green]%}%n%{$reset_color%B%}@%{$fg[blue]%}%m %{%b$fg[magenta]%}%1~ %{$reset_color%}%# " + +#RPS1="%M:%d" + +alias ls="ls -liFG" + +autoload -Uz compinit && compinit + +source ~/.zsh/plugins/history-substring-search.zsh +source ~/.zsh/plugins/git.plugin.zsh +source ~/.zsh/plugins/git-extras.plugin.zsh + +# Customize to your needs... +export PATH=/Users/vincent/Library/Haskell/bin:/Users/vincent/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/munki + +source /opt/boxen/env.sh + + +alias google.py="/Users/vincent/Source/management-scripts/google-apps/google.py" + +alias runhoogle="screen -dm hoogle server -p 4000" + +alias irssi="screen -S irssi irssi" + +HISTFILE="$HOME/.zsh_history" -- cgit 1.4.1 From 19dd5c8bac87655b063df983b80a2803bfc1e940 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 6 Mar 2013 23:21:00 +0100 Subject: iTerm 2 config --- com.googlecode.iterm2.plist | Bin 0 -> 13417 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 com.googlecode.iterm2.plist diff --git a/com.googlecode.iterm2.plist b/com.googlecode.iterm2.plist new file mode 100644 index 0000000000..667361b2f7 Binary files /dev/null and b/com.googlecode.iterm2.plist differ -- cgit 1.4.1 From bb3c6afb7f7274ec80a259a44a8abaa71df412ff Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 13 Mar 2013 13:33:05 +0100 Subject: * moved plist configurations to plist folder --- com.googlecode.iterm2.plist | Bin 13417 -> 0 bytes plists/com.googlecode.iterm2.plist | Bin 0 -> 13417 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 com.googlecode.iterm2.plist create mode 100644 plists/com.googlecode.iterm2.plist diff --git a/com.googlecode.iterm2.plist b/com.googlecode.iterm2.plist deleted file mode 100644 index 667361b2f7..0000000000 Binary files a/com.googlecode.iterm2.plist and /dev/null differ diff --git a/plists/com.googlecode.iterm2.plist b/plists/com.googlecode.iterm2.plist new file mode 100644 index 0000000000..667361b2f7 Binary files /dev/null and b/plists/com.googlecode.iterm2.plist differ -- cgit 1.4.1 From 2225a11289dcff0bf2e45988ae9e21f6224976ed Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 13 Mar 2013 13:34:03 +0100 Subject: * updated zshrc --- zshrc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/zshrc b/zshrc index a6cc783a32..15846cbbe0 100644 --- a/zshrc +++ b/zshrc @@ -23,6 +23,7 @@ setopt no_hup no_clobber print_exit_value setopt extendedglob glob_dots setopt correct setopt completealiases +setopt prompt_subst case $TERM in rxvt|*term) @@ -32,10 +33,12 @@ case $TERM in esac autoload -U colors && colors -PS1="%{%B$fg[blue]%}%n%{$reset_color%B%}@%{%b$fg[magenta]%}%1~ %{$reset_color%}%# " -### PIERRE: # PS1="%{%B$fg[green]%}%n%{$reset_color%B%}@%{$fg[blue]%}%m %{%b$fg[magenta]%}%1~ %{$reset_color%}%# " +#vincent: PS1="%{%B$fg[blue]%}%n%{$reset_color%B%}@%{%b$fg[magenta]%}%1~ %{$reset_color%}\$(vcprompt -f '%b:%r ')%# " + +#PS1="%n@%1~ \$(vcprompt -f '%b:%r ') %# " +PS1="%{$fg[green]%}%n%{$fg[cyan]%}@%{$fg[magenta]%}%1~ %{$fg[yellow]%}\$(vcprompt -f '%b:%r ')%{$fg[cyan]%}%# %{$reset_color%}" +RPS1="%{$fg[cyan]%}%B[%M:%d]%b%{$reset_color%}" -#RPS1="%M:%d" alias ls="ls -liFG" -- cgit 1.4.1 From 384b4e1ec173354816ca8536bfc91407801c8970 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 13 Mar 2013 22:02:31 +0100 Subject: * added config for PCKeyboardHack and KeyRemap4MacBook --- plists/org.pqrs.KeyRemap4MacBook.plist | Bin 0 -> 394 bytes plists/org.pqrs.PCKeyboardHack.plist | Bin 0 -> 223 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 plists/org.pqrs.KeyRemap4MacBook.plist create mode 100644 plists/org.pqrs.PCKeyboardHack.plist diff --git a/plists/org.pqrs.KeyRemap4MacBook.plist b/plists/org.pqrs.KeyRemap4MacBook.plist new file mode 100644 index 0000000000..c6be298394 Binary files /dev/null and b/plists/org.pqrs.KeyRemap4MacBook.plist differ diff --git a/plists/org.pqrs.PCKeyboardHack.plist b/plists/org.pqrs.PCKeyboardHack.plist new file mode 100644 index 0000000000..4e4b74cb6e Binary files /dev/null and b/plists/org.pqrs.PCKeyboardHack.plist differ -- cgit 1.4.1 From 50b1cc1612933e656540f0a1ad48a577891528f0 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 20 Jun 2013 13:08:18 +0200 Subject: * Added fish config --- fish/config.fish | 12 ++++++++++++ fish/functions/runhoogle.fish | 5 +++++ fish/functions/runirc.fish | 3 +++ 3 files changed, 20 insertions(+) create mode 100644 fish/config.fish create mode 100644 fish/functions/runhoogle.fish create mode 100644 fish/functions/runirc.fish diff --git a/fish/config.fish b/fish/config.fish new file mode 100644 index 0000000000..d861f876bb --- /dev/null +++ b/fish/config.fish @@ -0,0 +1,12 @@ +function fish_prompt + set_color blue + echo -n (whoami) + set_color cyan + echo -n '@' + set_color magenta + echo -n (prompt_pwd) + set_color cyan + echo -n '> ' +end + +set PATH ~/Library/Haskell/bin ~/bin/ /Users/vincent/Source/management-scripts/google-apps/ $PATH diff --git a/fish/functions/runhoogle.fish b/fish/functions/runhoogle.fish new file mode 100644 index 0000000000..45160062e3 --- /dev/null +++ b/fish/functions/runhoogle.fish @@ -0,0 +1,5 @@ +function runhoogle + cd ~/.hoogle + screen -dm hoogle server -p 4000 + cd - +end diff --git a/fish/functions/runirc.fish b/fish/functions/runirc.fish new file mode 100644 index 0000000000..d162342683 --- /dev/null +++ b/fish/functions/runirc.fish @@ -0,0 +1,3 @@ +function runirc + screen -S irssi irssi +end -- cgit 1.4.1 From ca9a059b8878111a75b45f2980d8f79367382952 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 20 Jun 2013 13:12:28 +0200 Subject: Removed fish's greeting --- fish/config.fish | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fish/config.fish b/fish/config.fish index d861f876bb..a55a063688 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -9,4 +9,6 @@ function fish_prompt echo -n '> ' end +set fish_greeting "" + set PATH ~/Library/Haskell/bin ~/bin/ /Users/vincent/Source/management-scripts/google-apps/ $PATH -- cgit 1.4.1 From ee76e971ceb0bb700ab7701fb3d63590f025ba06 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 1 Jul 2013 02:32:30 +0200 Subject: Added initial emacs init --- init.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 init.el diff --git a/init.el b/init.el new file mode 100644 index 0000000000..0c5dc0bfc7 --- /dev/null +++ b/init.el @@ -0,0 +1,19 @@ +(require 'package) +(add-to-list 'package-archives + '("marmalade" . "http://marmalade-repo.org/packages/") t) +(package-initialize) + +(when (not package-archive-contents) + (package-refresh-contents)) + +;; Important packages +(defvar my-pkgs '(starter-kit starter-kit-bindings haskell-mode) + "A list of packages to install at launch.") + +(dolist (p my-pkgs) + (when (not (package-installed-p p)) + (package-install p))) + +;; Configure haskell-mode +(custom-set-variables + '(haskell-mode-hook '(turn-on-haskell-indentation))) -- cgit 1.4.1 From 1c1128c2e10a0cbd39b9844adab99e082f1ccdd5 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 1 Jul 2013 03:03:23 +0200 Subject: Added mouse-support and some haskell-mode config to init.el --- .gitignore | 2 ++ init.el | 25 ++++++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..07e51b9cb9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/plists/.DS_Store +/.DS_Store diff --git a/init.el b/init.el index 0c5dc0bfc7..74dc734281 100644 --- a/init.el +++ b/init.el @@ -8,12 +8,31 @@ ;; Important packages (defvar my-pkgs '(starter-kit starter-kit-bindings haskell-mode) - "A list of packages to install at launch.") + "Packages to install at launch.") (dolist (p my-pkgs) (when (not (package-installed-p p)) (package-install p))) +;; Enable mouse support on OS X +(unless window-system + (require 'mouse) + (xterm-mouse-mode t) + (global-set-key [mouse-4] '(lambda () + (interactive) + (scroll-down 1))) + (global-set-key [mouse-5] '(lambda () + (interactive) + (scroll-up 1))) + (defun track-mouse (e)) + (setq mouse-sel-mode t) +) + ;; Configure haskell-mode -(custom-set-variables - '(haskell-mode-hook '(turn-on-haskell-indentation))) +;; Enable semi-automatic indentation and font-locking +(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation) +(add-hook 'haskell-mode-hook 'font-lock-mode) + +;; Add keybindings to move nested blocks with C-, rsp. C-. +(define-key haskell-mode-map (kbd "C-,") 'haskell-move-nested-left) +(define-key haskell-mode-map (kbd "C-.") 'haskell-move-nested-right) -- cgit 1.4.1 From 76dd77aad0158c5104143de23a28567de0c13b5f Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 1 Jul 2013 03:05:46 +0200 Subject: Added magit to package list --- init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.el b/init.el index 74dc734281..c7256a50d6 100644 --- a/init.el +++ b/init.el @@ -7,7 +7,7 @@ (package-refresh-contents)) ;; Important packages -(defvar my-pkgs '(starter-kit starter-kit-bindings haskell-mode) +(defvar my-pkgs '(starter-kit starter-kit-bindings haskell-mode magit) "Packages to install at launch.") (dolist (p my-pkgs) -- cgit 1.4.1 From 9d17f365c8fad91965b0efe0c2fc62237669838c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 1 Jul 2013 03:08:10 +0200 Subject: Updated gitignore with init.el buffer --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 07e51b9cb9..cff209380a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /plists/.DS_Store /.DS_Store +/#init.el# +/.#init.el -- cgit 1.4.1 From baa59374dded355ffc0691ff6b549b153a3d24bb Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 1 Jul 2013 03:14:15 +0200 Subject: Added solarized-dark colour theme --- init.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/init.el b/init.el index c7256a50d6..620048ed0a 100644 --- a/init.el +++ b/init.el @@ -7,13 +7,16 @@ (package-refresh-contents)) ;; Important packages -(defvar my-pkgs '(starter-kit starter-kit-bindings haskell-mode magit) - "Packages to install at launch.") +(defvar my-pkgs '(starter-kit starter-kit-bindings haskell-mode magit color-theme-solarized) + "A list of packages to install at launch.") (dolist (p my-pkgs) (when (not (package-installed-p p)) (package-install p))) +;; Set solarized theme +(load-theme 'solarized-dark t) + ;; Enable mouse support on OS X (unless window-system (require 'mouse) -- cgit 1.4.1 From ee536eb9b79f5dd7d5c0c7882de0759740affba3 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 1 Jul 2013 19:09:26 +0200 Subject: Emacs: Added IRC config --- init.el | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/init.el b/init.el index 620048ed0a..7756f01245 100644 --- a/init.el +++ b/init.el @@ -39,3 +39,24 @@ ;; Add keybindings to move nested blocks with C-, rsp. C-. (define-key haskell-mode-map (kbd "C-,") 'haskell-move-nested-left) (define-key haskell-mode-map (kbd "C-.") 'haskell-move-nested-right) + +;; IRC configuration (erc) +;; Actual servers and such are loaded from irc.el +(require 'erc) +(load "~/.emacs.d/irc") + +;; Hiding JOIN, QUIT, PART +(setq erc-hide-list '("JOIN" "PART" "QUIT")) + +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(erc-modules (quote (autojoin button completion dcc irccontrols list log match menu move-to-prompt netsplit networks noncommands notifications readonly ring scrolltobottom stamp track)))) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + ) -- cgit 1.4.1 From 2ec20941fd941ac26fffec7301ca289c99b758ad Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 2 Jul 2013 23:08:09 +0200 Subject: * added el-get to config file ** Installing switch-windows through el-get * added several small options to make things nicer --- init.el | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/init.el b/init.el index 7756f01245..c68489b0ae 100644 --- a/init.el +++ b/init.el @@ -1,3 +1,4 @@ +;; Configure package manager (require 'package) (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/") t) @@ -14,9 +15,32 @@ (when (not (package-installed-p p)) (package-install p))) +;; Configure el-get +(require 'cl) + +(add-to-list 'load-path "~/.emacs.d/el-get/el-get") + +;; Install el-get if not already present +(unless (require 'el-get nil t) + (url-retrieve + "https://github.com/dimitri/el-get/raw/master/el-get-install.el" + (lambda (s) + (end-of-buffer) + (eval-print-last-sexp)))) + +;; el-get recipes +(setq + my:el-get-packages + '(el-get + switch-window)) + +(el-get 'sync my:el-get-packages) + ;; Set solarized theme (load-theme 'solarized-dark t) +;; Other general settings + ;; Enable mouse support on OS X (unless window-system (require 'mouse) @@ -28,9 +52,17 @@ (interactive) (scroll-up 1))) (defun track-mouse (e)) + (setq mouse-sel-mode t) ) +;; Use clipboard properly +(setq x-select-enable-clipboard t) + +;; Navigate windows with M- +(windmove-default-keybindings 'meta) +(setq windmove-wrap-around t) + ;; Configure haskell-mode ;; Enable semi-automatic indentation and font-locking (add-hook 'haskell-mode-hook 'turn-on-haskell-indentation) -- cgit 1.4.1 From 75d437e45a3a710d195960aa012ab3c1c746ff77 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 2 Jul 2013 23:13:15 +0200 Subject: * added markdown-mode --- init.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index c68489b0ae..7cfd3f4e31 100644 --- a/init.el +++ b/init.el @@ -8,7 +8,7 @@ (package-refresh-contents)) ;; Important packages -(defvar my-pkgs '(starter-kit starter-kit-bindings haskell-mode magit color-theme-solarized) +(defvar my-pkgs '(starter-kit starter-kit-bindings haskell-mode markdown-mode magit color-theme-solarized) "A list of packages to install at launch.") (dolist (p my-pkgs) @@ -63,6 +63,13 @@ (windmove-default-keybindings 'meta) (setq windmove-wrap-around t) +;; Configure markdown-mode +(autoload 'markdown-mode "markdown-mode" + "Major mode for editing Markdown files" t) +(add-to-list 'auto-mode-alist '("\\.txt\\'" . markdown-mode)) +(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) +(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) + ;; Configure haskell-mode ;; Enable semi-automatic indentation and font-locking (add-hook 'haskell-mode-hook 'turn-on-haskell-indentation) -- cgit 1.4.1 From 613c12af106e7614fc3aabab1c67ab8fc800602f Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 4 Jul 2013 11:21:28 +0200 Subject: Updated fish config --- fish/config.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fish/config.fish b/fish/config.fish index a55a063688..36c9a3d016 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -11,4 +11,4 @@ end set fish_greeting "" -set PATH ~/Library/Haskell/bin ~/bin/ /Users/vincent/Source/management-scripts/google-apps/ $PATH +set PATH /usr/local/bin ~/Library/Haskell/bin ~/bin/ /Users/vincent/Source/management-scripts/google-apps/ $PATH -- cgit 1.4.1 From ea7e25d25d8735c3b3c37bdd6a33a7b6478705f6 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 4 Jul 2013 11:58:15 +0200 Subject: Updated fish shell with VC prompt and right pwd --- fish/config.fish | 18 +++++++++++++++--- fish/functions/edit.fish | 3 +++ 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 fish/functions/edit.fish diff --git a/fish/config.fish b/fish/config.fish index 36c9a3d016..3c7b71aade 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -1,14 +1,26 @@ function fish_prompt set_color blue echo -n (whoami) - set_color cyan - echo -n '@' set_color magenta - echo -n (prompt_pwd) + echo -n (vcprompt -f "(%s:%b%a%m)") set_color cyan echo -n '> ' end +function fish_right_prompt + set_color --bold yellow + echo -n '[' + set_color --bold blue + echo -n (prompt_pwd) + set_color --bold yellow + echo -n ']' +end + + +set -gx EDITOR emacsclient +set -gx ALTERNATE_EDITOR emacs +set -gx VISUAL emacsclient + set fish_greeting "" set PATH /usr/local/bin ~/Library/Haskell/bin ~/bin/ /Users/vincent/Source/management-scripts/google-apps/ $PATH diff --git a/fish/functions/edit.fish b/fish/functions/edit.fish new file mode 100644 index 0000000000..83f6eb854f --- /dev/null +++ b/fish/functions/edit.fish @@ -0,0 +1,3 @@ +function edit + emacsclient -no-wait $argv +end \ No newline at end of file -- cgit 1.4.1 From ec8571ac093f78993a7459c495ae220a3bfee451 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 4 Jul 2013 12:08:59 +0200 Subject: fish: removed whoami from prompt --- fish/config.fish | 2 -- 1 file changed, 2 deletions(-) diff --git a/fish/config.fish b/fish/config.fish index 3c7b71aade..bc816eb627 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -1,6 +1,4 @@ function fish_prompt - set_color blue - echo -n (whoami) set_color magenta echo -n (vcprompt -f "(%s:%b%a%m)") set_color cyan -- cgit 1.4.1 From 3facbfcaaba3c26773f56510d8ca5e2fa1de639a Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 4 Jul 2013 12:10:05 +0200 Subject: emacs: start server automatically --- init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init.el b/init.el index 7cfd3f4e31..1c7fc53a36 100644 --- a/init.el +++ b/init.el @@ -87,6 +87,9 @@ ;; Hiding JOIN, QUIT, PART (setq erc-hide-list '("JOIN" "PART" "QUIT")) +;; Start server for emacsclient +(server-start) + (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. -- cgit 1.4.1 From e7c303a6a36c60b4c1b7737fdf442260dfe1fd5f Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 4 Jul 2013 14:35:37 +0200 Subject: Added some tweaks (taken from @pcarrier's config! :)) --- init.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/init.el b/init.el index 1c7fc53a36..36e1f814e7 100644 --- a/init.el +++ b/init.el @@ -87,6 +87,17 @@ ;; Hiding JOIN, QUIT, PART (setq erc-hide-list '("JOIN" "PART" "QUIT")) +;; Eshell +;; Start/join +(global-set-key (kbd "C-x m") 'eshell) +;; Always start +(global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) + +;; Git +(global-set-key (kbd "C-c g") 'magit-status) + +(remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function) + ;; Start server for emacsclient (server-start) -- cgit 1.4.1 From b3940040a28bfc68bf362a8244ae23a9e2e13ef3 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 4 Jul 2013 18:54:31 +0200 Subject: emacs: Added rainbow-delimiters and other things --- init.el | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index 36e1f814e7..7422236e89 100644 --- a/init.el +++ b/init.el @@ -8,7 +8,14 @@ (package-refresh-contents)) ;; Important packages -(defvar my-pkgs '(starter-kit starter-kit-bindings haskell-mode markdown-mode magit color-theme-solarized) +(defvar my-pkgs '(starter-kit + starter-kit-bindings + haskell-mode + markdown-mode + magit + color-theme-solarized + projectile + rainbow-delimiters) "A list of packages to install at launch.") (dolist (p my-pkgs) @@ -98,6 +105,14 @@ (remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function) +;; Enable projectile for all things programming +(require 'projectile) +(add-hook 'prog-mode-hook 'projectile-on) + +;; Enable rainbow-delimiters for all things programming +(require 'rainbow-delimiters) +(add-hook 'prog-mode-hook 'rainbow-delimiters-mode) + ;; Start server for emacsclient (server-start) -- cgit 1.4.1 From a5a7db8f1b541a78613fe0696887151e3564b0e3 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 4 Jul 2013 22:49:26 +0200 Subject: emacs: Added clojure stuff --- init.el | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index 7422236e89..5caa84d117 100644 --- a/init.el +++ b/init.el @@ -15,7 +15,8 @@ magit color-theme-solarized projectile - rainbow-delimiters) + rainbow-delimiters + nrepl) "A list of packages to install at launch.") (dolist (p my-pkgs) @@ -86,6 +87,20 @@ (define-key haskell-mode-map (kbd "C-,") 'haskell-move-nested-left) (define-key haskell-mode-map (kbd "C-.") 'haskell-move-nested-right) +;; Configure nreply (Clojure mode) +(require 'nrepl) +;; eldoc in clojure +(add-hook 'nrepl-interaction-mode-hook + 'nrepl-turn-on-eldoc-mode) + +;; Don't annoy me +(setq nrepl-hide-special-buffers t) +(setq nrepl-popup-stacktraces nil) + +;; Paredit in nrepl +(add-hook 'nrepl-mode-hook 'paredit-mode) +(add-hook 'nrepl-mode-hook 'rainbow-delimiters-mode) + ;; IRC configuration (erc) ;; Actual servers and such are loaded from irc.el (require 'erc) @@ -121,6 +136,7 @@ ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. + '(custom-safe-themes (quote ("fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "d6a00ef5e53adf9b6fe417d2b4404895f26210c52bb8716971be106550cea257" default))) '(erc-modules (quote (autojoin button completion dcc irccontrols list log match menu move-to-prompt netsplit networks noncommands notifications readonly ring scrolltobottom stamp track)))) (custom-set-faces ;; custom-set-faces was added by Custom. -- cgit 1.4.1 From 62f609b47ff4195901b902fec0ea2365f9b3feb5 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 5 Jul 2013 00:28:47 +0200 Subject: emacs: Swedish locales & ace-jump --- init.el | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index 5caa84d117..2fb3d8cf77 100644 --- a/init.el +++ b/init.el @@ -16,7 +16,8 @@ color-theme-solarized projectile rainbow-delimiters - nrepl) + nrepl + ace-jump-mode) "A list of packages to install at launch.") (dolist (p my-pkgs) @@ -49,6 +50,9 @@ ;; Other general settings +;; Swedish! +(set-language-environment 'Swedish) + ;; Enable mouse support on OS X (unless window-system (require 'mouse) @@ -71,6 +75,26 @@ (windmove-default-keybindings 'meta) (setq windmove-wrap-around t) +;; Load ace-jump-mode +(autoload + 'ace-jump-mode + "ace-jump-mode" + "Emacs quick move minor mode" + t) + +(define-key global-map [?] 'ace-jump-mode) + +;; Quick jump back +(autoload + 'ace-jump-mode-pop-mark + "ace-jump-mode" + "Ace jump back:-)" + t) + +(eval-after-load "ace-jump-mode" + '(ace-jump-mode-enable-mark-sync)) +(define-key global-map (kbd "C-x ö") 'ace-jump-mode-pop-mark) + ;; Configure markdown-mode (autoload 'markdown-mode "markdown-mode" "Major mode for editing Markdown files" t) -- cgit 1.4.1 From c8dc574fcd374c1e1cdc59e5da0331e5dc361106 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 7 Jul 2013 22:03:29 +0200 Subject: emacs: - Move to Emacs.app (which doesn't work with Xnomad! :( But it's goood) - Add clojure-mode - Switch to leuven theme (again, thanks @pcarrier) --- init.el | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/init.el b/init.el index 2fb3d8cf77..001b085ad1 100644 --- a/init.el +++ b/init.el @@ -1,7 +1,13 @@ ;; Configure package manager (require 'package) -(add-to-list 'package-archives - '("marmalade" . "http://marmalade-repo.org/packages/") t) + +;; Add Marmalade repo +(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/")) + +;; ... and melpa. Melpa packages that exist on marmalade will have +;; precendence. +(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) + (package-initialize) (when (not package-archive-contents) @@ -13,10 +19,11 @@ haskell-mode markdown-mode magit - color-theme-solarized + leuven-theme projectile rainbow-delimiters nrepl + clojure-mode ace-jump-mode) "A list of packages to install at launch.") @@ -46,7 +53,7 @@ (el-get 'sync my:el-get-packages) ;; Set solarized theme -(load-theme 'solarized-dark t) +(load-theme 'leuven t) ;; Other general settings @@ -71,6 +78,17 @@ ;; Use clipboard properly (setq x-select-enable-clipboard t) +;; Settings for Emacs.app (Cocoa Emacs) +;; Menu bar doesn't take up additional space, so lets use it. +(menu-bar-mode 1) + +;; Don't use Apple's native fullscreen (FIXME: Change with Mavericks) +(setq ns-use-native-fullscreen nil) + +;; ... and then enable fullscreen. (This requires a nightly build of +;; Emacs for OS X) +;;(toggle-frame-fullscreen) + ;; Navigate windows with M- (windmove-default-keybindings 'meta) (setq windmove-wrap-around t) @@ -111,8 +129,11 @@ (define-key haskell-mode-map (kbd "C-,") 'haskell-move-nested-left) (define-key haskell-mode-map (kbd "C-.") 'haskell-move-nested-right) -;; Configure nreply (Clojure mode) -(require 'nrepl) +;; Configure nrepl (Clojure REPL) and clojure-mode +;; Paredit in clojure + +(add-hook 'clojure-mode-hook 'paredit-mode) + ;; eldoc in clojure (add-hook 'nrepl-interaction-mode-hook 'nrepl-turn-on-eldoc-mode) @@ -160,8 +181,14 @@ ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. - '(custom-safe-themes (quote ("fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "d6a00ef5e53adf9b6fe417d2b4404895f26210c52bb8716971be106550cea257" default))) - '(erc-modules (quote (autojoin button completion dcc irccontrols list log match menu move-to-prompt netsplit networks noncommands notifications readonly ring scrolltobottom stamp track)))) + '(custom-safe-themes + (quote + ("ea0c5df0f067d2e3c0f048c1f8795af7b873f5014837feb0a7c8317f34417b04" "a234f91f9be6ed40f6ce0e94dce5cea1b9f1ccec2b9ccd42bb71c499867a3fcc" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "d6a00ef5e53adf9b6fe417d2b4404895f26210c52bb8716971be106550cea257" default))) + '(erc-modules + (quote + (autojoin button completion dcc irccontrols list log match menu move-to-prompt netsplit networks noncommands notifications readonly ring scrolltobottom stamp track))) + '(ns-alternate-modifier (quote none)) + '(ns-command-modifier (quote meta))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. -- cgit 1.4.1 From 90f95a6a3dd5a95a3df315a9dfcdf8ea94d59104 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 8 Jul 2013 00:16:17 +0200 Subject: Emacs: Added file init-functions.el which I'll use for handy functions --- init-functions.el | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 init-functions.el diff --git a/init-functions.el b/init-functions.el new file mode 100644 index 0000000000..43d7c81c2f --- /dev/null +++ b/init-functions.el @@ -0,0 +1,23 @@ +;; A few handy functions I use in init.el (or not, but they're nice to +;; have) + +;; Ensure that the themes folder exists + +(defun custom-download-theme (url filename) + "Downloads a theme through HTTP and places it in ~/.emacs.d/themes" + + ;; Ensure the directory exists + (unless (file-exists-p "~/.emacs.d/themes") + (make-directory "~/.emacs.d/themes")) + + ;; Adds the themes folder to the theme load path (if not already + ;; there) + (unless (member "~/.emacs.d/themes" custom-theme-load-path) + (add-to-list 'custom-theme-load-path "~/.emacs.d/themes")) + + ;; Download file if it doesn't exist. + + (let ((file + (concat "~/.emacs.d/themes/" filename))) + (unless (file-exists-p file) + (url-copy-file url file)))) -- cgit 1.4.1 From 0d133eceb395d44b7a234b5f455d9d92bba43f4e Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 8 Jul 2013 01:15:05 +0200 Subject: Split up configuration in five files. I wrote a nice commit message explaining this, but I wrote it in vi and it died on me. --- emacs.d/init-custom.el | 19 +++++ emacs.d/init-functions.el | 53 +++++++++++++ emacs.d/init-modes.el | 38 +++++++++ emacs.d/init-settings.el | 180 ++++++++++++++++++++++++++++++++++++++++++ emacs.d/init.el | 50 ++++++++++++ init-functions.el | 23 ------ init.el | 197 ---------------------------------------------- 7 files changed, 340 insertions(+), 220 deletions(-) create mode 100644 emacs.d/init-custom.el create mode 100644 emacs.d/init-functions.el create mode 100644 emacs.d/init-modes.el create mode 100644 emacs.d/init-settings.el create mode 100644 emacs.d/init.el delete mode 100644 init-functions.el delete mode 100644 init.el diff --git a/emacs.d/init-custom.el b/emacs.d/init-custom.el new file mode 100644 index 0000000000..e0ef7ce63b --- /dev/null +++ b/emacs.d/init-custom.el @@ -0,0 +1,19 @@ +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(custom-safe-themes + (quote + ("ea0c5df0f067d2e3c0f048c1f8795af7b873f5014837feb0a7c8317f34417b04" "a234f91f9be6ed40f6ce0e94dce5cea1b9f1ccec2b9ccd42bb71c499867a3fcc" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "d6a00ef5e53adf9b6fe417d2b4404895f26210c52bb8716971be106550cea257" default))) + '(erc-modules + (quote + (autojoin button completion dcc irccontrols list log match menu move-to-prompt netsplit networks noncommands notifications readonly ring scrolltobottom stamp track))) + '(ns-alternate-modifier (quote none)) + '(ns-command-modifier (quote meta))) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + ) diff --git a/emacs.d/init-functions.el b/emacs.d/init-functions.el new file mode 100644 index 0000000000..5ede8ee7dc --- /dev/null +++ b/emacs.d/init-functions.el @@ -0,0 +1,53 @@ +;; A few handy functions I use in init.el (or not, but they're nice to +;; have) + +;; Ensure that the themes folder exists + +(defun custom-download-theme (url filename) + "Downloads a theme through HTTP and places it in ~/.emacs.d/themes" + + ;; Ensure the directory exists + (unless (file-exists-p "~/.emacs.d/themes") + (make-directory "~/.emacs.d/themes")) + + ;; Adds the themes folder to the theme load path (if not already + ;; there) + (unless (member "~/.emacs.d/themes" custom-theme-load-path) + (add-to-list 'custom-theme-load-path "~/.emacs.d/themes")) + + ;; Download file if it doesn't exist. + + (let ((file + (concat "~/.emacs.d/themes/" filename))) + (unless (file-exists-p file) + (url-copy-file url file)))) + + +;; These come from the emacs starter kit +(defun esk-pretty-lambdas () + (font-lock-add-keywords + nil `(("(?\\(lambda\\>\\)" + (0 (progn (compose-region (match-beginning 1) (match-end 1) + ,(make-char 'greek-iso8859-7 107)) + nil)))))) + +(defun esk-add-watchwords () + (font-lock-add-keywords + nil '(("\\<\\(FIX\\(ME\\)?\\|TODO\\|HACK\\|REFACTOR\\|NOCOMMIT\\)" + 1 font-lock-warning-face t)))) + +(defun esk-sudo-edit (&optional arg) + (interactive "p") + (if (or arg (not buffer-file-name)) + (find-file (concat "/sudo:root@localhost:" (ido-read-file-name "File: "))) + (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))) + +(defun esk-suck-it (suckee) + "Insert a comment of appropriate length about what can suck it." + (interactive "MWhat can suck it? ") + (let ((prefix (concat ";; " suckee " can s")) + (postfix "ck it!") + (col (current-column))) + (insert prefix) + (dotimes (_ (- 80 col (length prefix) (length postfix))) (insert "u")) + (insert postfix))) diff --git a/emacs.d/init-modes.el b/emacs.d/init-modes.el new file mode 100644 index 0000000000..d7415fda06 --- /dev/null +++ b/emacs.d/init-modes.el @@ -0,0 +1,38 @@ +;; Initializes modes I use. + +(add-hook 'prog-mode-hook 'esk-pretty-lambdas) +(add-hook 'prog-mode-hook 'esk-add-watchwords) +(add-hook 'prog-mode-hook 'idle-highlight-mode) + +;; Configure markdown-mode +(autoload 'markdown-mode "markdown-mode" + "Major mode for editing Markdown files" t) +(add-to-list 'auto-mode-alist '("\\.txt\\'" . markdown-mode)) +(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) +(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) + +;; Configure haskell-mode +;; Enable semi-automatic indentation and font-locking +(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation) +(add-hook 'haskell-mode-hook 'font-lock-mode) + +;; Add keybindings to move nested blocks with C-, rsp. C-. +(define-key haskell-mode-map (kbd "C-,") 'haskell-move-nested-left) +(define-key haskell-mode-map (kbd "C-.") 'haskell-move-nested-right) + +;; Configure nrepl (Clojure REPL) and clojure-mode +;; Paredit in clojure + +(add-hook 'clojure-mode-hook 'paredit-mode) + +;; eldoc in clojure +(add-hook 'nrepl-interaction-mode-hook + 'nrepl-turn-on-eldoc-mode) + +;; Don't annoy me +(setq nrepl-hide-special-buffers t) +(setq nrepl-popup-stacktraces nil) + +;; Paredit in nrepl +(add-hook 'nrepl-mode-hook 'paredit-mode) +(add-hook 'nrepl-mode-hook 'rainbow-delimiters-mode) diff --git a/emacs.d/init-settings.el b/emacs.d/init-settings.el new file mode 100644 index 0000000000..1d72624b3e --- /dev/null +++ b/emacs.d/init-settings.el @@ -0,0 +1,180 @@ +;; ## Generic settings ## + +(tool-bar-mode -1) +(scroll-bar-mode -1) + +;;; Code: + +(when window-system + (setq frame-title-format '(buffer-file-name "%f" ("%b"))) + (tooltip-mode -1) + (mouse-wheel-mode t) + (blink-cursor-mode -1)) + +;; can't do it at launch or emacsclient won't always honor it +(add-hook 'before-make-frame-hook 'esk-turn-off-tool-bar) + +(setq visible-bell t + inhibit-startup-message t + color-theme-is-global t + sentence-end-double-space nil + shift-select-mode nil + mouse-yank-at-point t + uniquify-buffer-name-style 'forward + whitespace-style '(face trailing lines-tail tabs) + whitespace-line-column 80 + ediff-window-setup-function 'ediff-setup-windows-plain + oddmuse-directory (concat user-emacs-directory "oddmuse") + save-place-file (concat user-emacs-directory "places") + backup-directory-alist `(("." . ,(concat user-emacs-directory "backups"))) + diff-switches "-u") + +(setq smex-save-file (concat user-emacs-directory ".smex-items")) +(smex-initialize) +(global-set-key (kbd "M-x") 'smex) + +(add-to-list 'safe-local-variable-values '(lexical-binding . t)) +(add-to-list 'safe-local-variable-values '(whitespace-line-column . 80)) + +;; ido-mode is like magic pixie dust! +(ido-mode t) +(ido-ubiquitous t) +(setq ido-enable-prefix nil + ido-enable-flex-matching t + ido-auto-merge-work-directories-length nil + ido-create-new-buffer 'always + ido-use-filename-at-point 'guess + ido-use-virtual-buffers t + ido-handle-duplicate-virtual-buffers 2 + ido-max-prospects 10) + +;; Swedish! +(set-language-environment 'Swedish) + +(require 'ffap) +(defvar ffap-c-commment-regexp "^/\\*+" + "Matches an opening C-style comment, like \"/***\".") + +(defadvice ffap-file-at-point (after avoid-c-comments activate) + "Don't return paths like \"/******\" unless they actually exist. + +This fixes the bug where ido would try to suggest a C-style +comment as a filename." + (ignore-errors + (when (and ad-return-value + (string-match-p ffap-c-commment-regexp + ad-return-value) + (not (ffap-file-exists-string ad-return-value))) + (setq ad-return-value nil)))) + +(defalias 'yes-or-no-p 'y-or-n-p) +(defalias 'auto-tail-revert-mode 'tail-mode) + +;; Hippie expand: at times perhaps too hip +(eval-after-load 'hippie-exp + '(progn + (dolist (f '(try-expand-line try-expand-list try-complete-file-name-partially)) + (delete f hippie-expand-try-functions-list)) + + ;; Add this back in at the end of the list. + (add-to-list 'hippie-expand-try-functions-list 'try-complete-file-name-partially t))) + +;; ## Look and feel ## + +;; Theme! +(custom-download-theme "https://raw.github.com/owainlewis/emacs-color-themes/master/themes/hickey-theme.el" + "hickey-theme.el") + +(load-theme 'hickey t) + +;; Hiding JOIN, QUIT, PART +(setq erc-hide-list '("JOIN" "PART" "QUIT")) + +;; Enable projectile for all things programming +(add-hook 'prog-mode-hook 'projectile-on) + +;; Enable rainbow-delimiters for all things programming +(add-hook 'prog-mode-hook 'rainbow-delimiters-mode) + +;; Enable paredit in all Lisps +(add-hook 'lisp-mode-hook 'paredit-mode) + +(eval-after-load 'diff-mode + '(progn + (set-face-foreground 'diff-added "green4") + (set-face-foreground 'diff-removed "red3"))) + +(eval-after-load 'magit + '(progn + (set-face-foreground 'magit-diff-add "green4") + (set-face-foreground 'magit-diff-del "red3"))) + +;; ## Mac specific settings ## + +(setq browse-url-browser-function 'browse-default-macosx-browser) + +;; Enable mouse support on OS X +(unless window-system + (require 'mouse) + (xterm-mouse-mode t) + (global-set-key [mouse-4] '(lambda () + (interactive) + (scroll-down 1))) + (global-set-key [mouse-5] '(lambda () + (interactive) + (scroll-up 1))) + (defun track-mouse (e)) + + (setq mouse-sel-mode t) +) + +;; Use clipboard properly +(setq x-select-enable-clipboard t) + +;; Settings for Emacs.app (Cocoa Emacs) +;; Menu bar doesn't take up additional space, so lets use it. +(menu-bar-mode 1) + +;; Don't use Apple's native fullscreen (FIXME: Change with Mavericks) +(setq ns-use-native-fullscreen nil) + +;; ... and then enable fullscreen. (This requires a nightly build of +;; Emacs for OS X) +;;(toggle-frame-fullscreen) + +;; ## Navigation and key bindings ## + +;; Navigate windows with M- +(windmove-default-keybindings 'meta) +(setq windmove-wrap-around t) + +;; Load ace-jump-mode +(autoload + 'ace-jump-mode + "ace-jump-mode" + "Emacs quick move minor mode" + ) + +(define-key global-map [?] 'ace-jump-mode) + +;; Quick jump back +(autoload + 'ace-jump-mode-pop-mark + "ace-jump-mode" + "Ace jump back:-)" + ) + +(eval-after-load "ace-jump-mode" + '(ace-jump-mode-enable-mark-sync)) +(define-key global-map (kbd "C-x ö") 'ace-jump-mode-pop-mark) + +;; Eshell +;; Start/join +(global-set-key (kbd "C-x m") 'eshell) +;; Always start +(global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) + +;; Git +(global-set-key (kbd "C-c g") 'magit-status) + +(remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function) diff --git a/emacs.d/init.el b/emacs.d/init.el new file mode 100644 index 0000000000..7d8733fe48 --- /dev/null +++ b/emacs.d/init.el @@ -0,0 +1,50 @@ +;; Configure package manager +(require 'package) + +;; Add Marmalade repo +(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/")) + +;; ... and melpa. Melpa packages that exist on marmalade will have +;; precendence. +(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) + +(package-initialize) + +(when (not package-archive-contents) + (package-refresh-contents)) + +;; Important packages +(defvar my-pkgs '(starter-kit-bindings + haskell-mode + markdown-mode + magit + leuven-theme + projectile + rainbow-delimiters + nrepl + clojure-mode + ace-jump-mode + switch-window) + "A list of packages to install at launch.") + +(dolist (p my-pkgs) + (when (not (package-installed-p p)) + (package-install p))) + + +(load "~/.emacs.d/init-functions.el") +(load "~/.emacs.d/init-settings.el") + +(setq custom-file "~/.emacs.d/init-custom.el") +(load custom-file) + +;; IRC configuration (erc) +;; Actual servers and such are loaded from irc.el +(require 'erc) +(load "~/.emacs.d/irc") + +;; Seed RNG +(random t) + +;; Start server for emacsclient +(server-start) diff --git a/init-functions.el b/init-functions.el deleted file mode 100644 index 43d7c81c2f..0000000000 --- a/init-functions.el +++ /dev/null @@ -1,23 +0,0 @@ -;; A few handy functions I use in init.el (or not, but they're nice to -;; have) - -;; Ensure that the themes folder exists - -(defun custom-download-theme (url filename) - "Downloads a theme through HTTP and places it in ~/.emacs.d/themes" - - ;; Ensure the directory exists - (unless (file-exists-p "~/.emacs.d/themes") - (make-directory "~/.emacs.d/themes")) - - ;; Adds the themes folder to the theme load path (if not already - ;; there) - (unless (member "~/.emacs.d/themes" custom-theme-load-path) - (add-to-list 'custom-theme-load-path "~/.emacs.d/themes")) - - ;; Download file if it doesn't exist. - - (let ((file - (concat "~/.emacs.d/themes/" filename))) - (unless (file-exists-p file) - (url-copy-file url file)))) diff --git a/init.el b/init.el deleted file mode 100644 index 001b085ad1..0000000000 --- a/init.el +++ /dev/null @@ -1,197 +0,0 @@ -;; Configure package manager -(require 'package) - -;; Add Marmalade repo -(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/")) - -;; ... and melpa. Melpa packages that exist on marmalade will have -;; precendence. -(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) - -(package-initialize) - -(when (not package-archive-contents) - (package-refresh-contents)) - -;; Important packages -(defvar my-pkgs '(starter-kit - starter-kit-bindings - haskell-mode - markdown-mode - magit - leuven-theme - projectile - rainbow-delimiters - nrepl - clojure-mode - ace-jump-mode) - "A list of packages to install at launch.") - -(dolist (p my-pkgs) - (when (not (package-installed-p p)) - (package-install p))) - -;; Configure el-get -(require 'cl) - -(add-to-list 'load-path "~/.emacs.d/el-get/el-get") - -;; Install el-get if not already present -(unless (require 'el-get nil t) - (url-retrieve - "https://github.com/dimitri/el-get/raw/master/el-get-install.el" - (lambda (s) - (end-of-buffer) - (eval-print-last-sexp)))) - -;; el-get recipes -(setq - my:el-get-packages - '(el-get - switch-window)) - -(el-get 'sync my:el-get-packages) - -;; Set solarized theme -(load-theme 'leuven t) - -;; Other general settings - -;; Swedish! -(set-language-environment 'Swedish) - -;; Enable mouse support on OS X -(unless window-system - (require 'mouse) - (xterm-mouse-mode t) - (global-set-key [mouse-4] '(lambda () - (interactive) - (scroll-down 1))) - (global-set-key [mouse-5] '(lambda () - (interactive) - (scroll-up 1))) - (defun track-mouse (e)) - - (setq mouse-sel-mode t) -) - -;; Use clipboard properly -(setq x-select-enable-clipboard t) - -;; Settings for Emacs.app (Cocoa Emacs) -;; Menu bar doesn't take up additional space, so lets use it. -(menu-bar-mode 1) - -;; Don't use Apple's native fullscreen (FIXME: Change with Mavericks) -(setq ns-use-native-fullscreen nil) - -;; ... and then enable fullscreen. (This requires a nightly build of -;; Emacs for OS X) -;;(toggle-frame-fullscreen) - -;; Navigate windows with M- -(windmove-default-keybindings 'meta) -(setq windmove-wrap-around t) - -;; Load ace-jump-mode -(autoload - 'ace-jump-mode - "ace-jump-mode" - "Emacs quick move minor mode" - t) - -(define-key global-map [?] 'ace-jump-mode) - -;; Quick jump back -(autoload - 'ace-jump-mode-pop-mark - "ace-jump-mode" - "Ace jump back:-)" - t) - -(eval-after-load "ace-jump-mode" - '(ace-jump-mode-enable-mark-sync)) -(define-key global-map (kbd "C-x ö") 'ace-jump-mode-pop-mark) - -;; Configure markdown-mode -(autoload 'markdown-mode "markdown-mode" - "Major mode for editing Markdown files" t) -(add-to-list 'auto-mode-alist '("\\.txt\\'" . markdown-mode)) -(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) -(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) - -;; Configure haskell-mode -;; Enable semi-automatic indentation and font-locking -(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation) -(add-hook 'haskell-mode-hook 'font-lock-mode) - -;; Add keybindings to move nested blocks with C-, rsp. C-. -(define-key haskell-mode-map (kbd "C-,") 'haskell-move-nested-left) -(define-key haskell-mode-map (kbd "C-.") 'haskell-move-nested-right) - -;; Configure nrepl (Clojure REPL) and clojure-mode -;; Paredit in clojure - -(add-hook 'clojure-mode-hook 'paredit-mode) - -;; eldoc in clojure -(add-hook 'nrepl-interaction-mode-hook - 'nrepl-turn-on-eldoc-mode) - -;; Don't annoy me -(setq nrepl-hide-special-buffers t) -(setq nrepl-popup-stacktraces nil) - -;; Paredit in nrepl -(add-hook 'nrepl-mode-hook 'paredit-mode) -(add-hook 'nrepl-mode-hook 'rainbow-delimiters-mode) - -;; IRC configuration (erc) -;; Actual servers and such are loaded from irc.el -(require 'erc) -(load "~/.emacs.d/irc") - -;; Hiding JOIN, QUIT, PART -(setq erc-hide-list '("JOIN" "PART" "QUIT")) - -;; Eshell -;; Start/join -(global-set-key (kbd "C-x m") 'eshell) -;; Always start -(global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) - -;; Git -(global-set-key (kbd "C-c g") 'magit-status) - -(remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function) - -;; Enable projectile for all things programming -(require 'projectile) -(add-hook 'prog-mode-hook 'projectile-on) - -;; Enable rainbow-delimiters for all things programming -(require 'rainbow-delimiters) -(add-hook 'prog-mode-hook 'rainbow-delimiters-mode) - -;; Start server for emacsclient -(server-start) - -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(custom-safe-themes - (quote - ("ea0c5df0f067d2e3c0f048c1f8795af7b873f5014837feb0a7c8317f34417b04" "a234f91f9be6ed40f6ce0e94dce5cea1b9f1ccec2b9ccd42bb71c499867a3fcc" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "d6a00ef5e53adf9b6fe417d2b4404895f26210c52bb8716971be106550cea257" default))) - '(erc-modules - (quote - (autojoin button completion dcc irccontrols list log match menu move-to-prompt netsplit networks noncommands notifications readonly ring scrolltobottom stamp track))) - '(ns-alternate-modifier (quote none)) - '(ns-command-modifier (quote meta))) -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - ) -- cgit 1.4.1 From 50ec87400c82e921dd9404672b7e64828abaeca1 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 8 Jul 2013 01:31:03 +0200 Subject: emacs: Moved some configurations around and fixed init-modes.el --- emacs.d/init-custom.el | 2 +- emacs.d/init-modes.el | 12 +++++++++--- emacs.d/init-settings.el | 9 --------- emacs.d/init.el | 1 - 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/emacs.d/init-custom.el b/emacs.d/init-custom.el index e0ef7ce63b..b77eae8dcf 100644 --- a/emacs.d/init-custom.el +++ b/emacs.d/init-custom.el @@ -5,7 +5,7 @@ ;; If there is more than one, they won't work right. '(custom-safe-themes (quote - ("ea0c5df0f067d2e3c0f048c1f8795af7b873f5014837feb0a7c8317f34417b04" "a234f91f9be6ed40f6ce0e94dce5cea1b9f1ccec2b9ccd42bb71c499867a3fcc" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "d6a00ef5e53adf9b6fe417d2b4404895f26210c52bb8716971be106550cea257" default))) + ("8eaa3bce3c618cd81a318fcf2d28c1cd21278531f028feb53186f6387547dfb4" "ea0c5df0f067d2e3c0f048c1f8795af7b873f5014837feb0a7c8317f34417b04" "a234f91f9be6ed40f6ce0e94dce5cea1b9f1ccec2b9ccd42bb71c499867a3fcc" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "d6a00ef5e53adf9b6fe417d2b4404895f26210c52bb8716971be106550cea257" default))) '(erc-modules (quote (autojoin button completion dcc irccontrols list log match menu move-to-prompt netsplit networks noncommands notifications readonly ring scrolltobottom stamp track))) diff --git a/emacs.d/init-modes.el b/emacs.d/init-modes.el index d7415fda06..6e523c3877 100644 --- a/emacs.d/init-modes.el +++ b/emacs.d/init-modes.el @@ -1,3 +1,4 @@ +(mapc 'require '(projectile)) ;; Initializes modes I use. (add-hook 'prog-mode-hook 'esk-pretty-lambdas) @@ -33,6 +34,11 @@ (setq nrepl-hide-special-buffers t) (setq nrepl-popup-stacktraces nil) -;; Paredit in nrepl -(add-hook 'nrepl-mode-hook 'paredit-mode) -(add-hook 'nrepl-mode-hook 'rainbow-delimiters-mode) +;; Enable projectile for all things programming +(add-hook 'prog-mode-hook 'projectile-on) + +;; Enable rainbow-delimiters for all things programming +(add-hook 'prog-mode-hook 'rainbow-delimiters-mode) + +;; Enable paredit in all programming buffers +(add-hook 'prog-mode-hook 'paredit-mode) diff --git a/emacs.d/init-settings.el b/emacs.d/init-settings.el index 1d72624b3e..7e0d7ca786 100644 --- a/emacs.d/init-settings.el +++ b/emacs.d/init-settings.el @@ -90,15 +90,6 @@ comment as a filename." ;; Hiding JOIN, QUIT, PART (setq erc-hide-list '("JOIN" "PART" "QUIT")) -;; Enable projectile for all things programming -(add-hook 'prog-mode-hook 'projectile-on) - -;; Enable rainbow-delimiters for all things programming -(add-hook 'prog-mode-hook 'rainbow-delimiters-mode) - -;; Enable paredit in all Lisps -(add-hook 'lisp-mode-hook 'paredit-mode) - (eval-after-load 'diff-mode '(progn (set-face-foreground 'diff-added "green4") diff --git a/emacs.d/init.el b/emacs.d/init.el index 7d8733fe48..235cff1f4b 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -40,7 +40,6 @@ ;; IRC configuration (erc) ;; Actual servers and such are loaded from irc.el -(require 'erc) (load "~/.emacs.d/irc") ;; Seed RNG -- cgit 1.4.1 From 7e66456fc0926101424e2d064284214464c1e673 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 8 Jul 2013 01:39:10 +0200 Subject: emacs: Added a function to download a custom script --- emacs.d/init-functions.el | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/emacs.d/init-functions.el b/emacs.d/init-functions.el index 5ede8ee7dc..c627a5df96 100644 --- a/emacs.d/init-functions.el +++ b/emacs.d/init-functions.el @@ -1,8 +1,6 @@ ;; A few handy functions I use in init.el (or not, but they're nice to ;; have) -;; Ensure that the themes folder exists - (defun custom-download-theme (url filename) "Downloads a theme through HTTP and places it in ~/.emacs.d/themes" @@ -22,6 +20,21 @@ (unless (file-exists-p file) (url-copy-file url file)))) +(defun custom-download-script (url filename) + "Downloads an Elisp script, places it in ~/.emacs/other and then loads it" + + ;; Ensure the directory exists + (unless (file-exists-p "~/.emacs.d/other") + (make-directory "~/.emacs.d/other")) + + ;; Download file if it doesn't exist. + (let ((file + (concat "~/.emacs.d/" filename))) + (unless (file-exists-p file) + (url-copy-file url file)) + + (load file))) + ;; These come from the emacs starter kit (defun esk-pretty-lambdas () -- cgit 1.4.1 From 977f658cf7fbdcf4567a3e9296b7555a26f4ad9d Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 8 Jul 2013 01:39:36 +0200 Subject: emacs: Fetch switch-window from Github --- emacs.d/init.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/emacs.d/init.el b/emacs.d/init.el index 235cff1f4b..1def230fde 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -23,8 +23,8 @@ rainbow-delimiters nrepl clojure-mode - ace-jump-mode - switch-window) + ace-jump-mode) + "A list of packages to install at launch.") (dolist (p my-pkgs) @@ -38,6 +38,10 @@ (setq custom-file "~/.emacs.d/init-custom.el") (load custom-file) +;; Other packages that need manual installation +(custom-download-script "https://raw.github.com/dimitri/switch-window/master/switch-window.el" + "switch-window.el") + ;; IRC configuration (erc) ;; Actual servers and such are loaded from irc.el (load "~/.emacs.d/irc") -- cgit 1.4.1 From 802f0f4213900ae78cd5eea63f40e46651f90cbd Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 8 Jul 2013 01:52:03 +0200 Subject: emacs: Loading hooks + disabling hl-line-mode globally (I really don't like it) --- emacs.d/init-functions.el | 1 - emacs.d/init-settings.el | 2 ++ emacs.d/init.el | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs.d/init-functions.el b/emacs.d/init-functions.el index c627a5df96..de68ab71f5 100644 --- a/emacs.d/init-functions.el +++ b/emacs.d/init-functions.el @@ -35,7 +35,6 @@ (load file))) - ;; These come from the emacs starter kit (defun esk-pretty-lambdas () (font-lock-add-keywords diff --git a/emacs.d/init-settings.el b/emacs.d/init-settings.el index 7e0d7ca786..042f35a48c 100644 --- a/emacs.d/init-settings.el +++ b/emacs.d/init-settings.el @@ -87,6 +87,8 @@ comment as a filename." (load-theme 'hickey t) +(global-hl-line-mode -1) + ;; Hiding JOIN, QUIT, PART (setq erc-hide-list '("JOIN" "PART" "QUIT")) diff --git a/emacs.d/init.el b/emacs.d/init.el index 1def230fde..971ff2b749 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -34,6 +34,7 @@ (load "~/.emacs.d/init-functions.el") (load "~/.emacs.d/init-settings.el") +(load "~/.emacs.d/init-modes.el") (setq custom-file "~/.emacs.d/init-custom.el") (load custom-file) -- cgit 1.4.1 From 4454fca696b12d19157a0ab6770c3348c0b9f119 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 8 Jul 2013 02:18:19 +0200 Subject: Emacs: Added another theme (Gruber Darker), added a toggle for fullscreen mode (M-RET) --- emacs.d/init-settings.el | 13 +++++++------ emacs.d/init.el | 3 +++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/emacs.d/init-settings.el b/emacs.d/init-settings.el index 042f35a48c..281abbd85a 100644 --- a/emacs.d/init-settings.el +++ b/emacs.d/init-settings.el @@ -81,11 +81,16 @@ comment as a filename." ;; ## Look and feel ## -;; Theme! +;; Themes! I download and install the ones I like and default the one +;; I currently like most. This changes a lot because I hate +;; everything. (It's in my nature, don't judge) (custom-download-theme "https://raw.github.com/owainlewis/emacs-color-themes/master/themes/hickey-theme.el" "hickey-theme.el") -(load-theme 'hickey t) +(custom-download-theme "https://raw.github.com/rexim/gruber-darker-theme/master/gruber-darker-theme.el" + "gruber-darker-theme.el") + +(load-theme 'gruber-darker t) (global-hl-line-mode -1) @@ -131,10 +136,6 @@ comment as a filename." ;; Don't use Apple's native fullscreen (FIXME: Change with Mavericks) (setq ns-use-native-fullscreen nil) -;; ... and then enable fullscreen. (This requires a nightly build of -;; Emacs for OS X) -;;(toggle-frame-fullscreen) - ;; ## Navigation and key bindings ## ;; Navigate windows with M- diff --git a/emacs.d/init.el b/emacs.d/init.el index 971ff2b749..e27a15f84e 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -50,5 +50,8 @@ ;; Seed RNG (random t) +;; Add a fullscreen toggle +(global-set-key (kbd "M-RET") 'toggle-frame-fullscreen) + ;; Start server for emacsclient (server-start) -- cgit 1.4.1 From 74d252df97ccee6b407aa79d0d763090346b3b14 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 8 Jul 2013 16:54:54 +0200 Subject: Emacs: Added init-bindings.el, removed starter-kit-bindings --- emacs.d/init-bindings.el | 35 +++++++++++++++++++++++++++++++++++ emacs.d/init.el | 7 ++----- 2 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 emacs.d/init-bindings.el diff --git a/emacs.d/init-bindings.el b/emacs.d/init-bindings.el new file mode 100644 index 0000000000..57586101f2 --- /dev/null +++ b/emacs.d/init-bindings.el @@ -0,0 +1,35 @@ +;; Various keybindings, most of them taken from starter-kit-bindings + +;; Font size +(define-key global-map (kbd "C-+") 'text-scale-increase) +(define-key global-map (kbd "C--") 'text-scale-decrease) + +;; Use regex searches by default. +(global-set-key (kbd "C-s") 'isearch-forward-regexp) +(global-set-key (kbd "\C-r") 'isearch-backward-regexp) +(global-set-key (kbd "M-%") 'query-replace-regexp) +(global-set-key (kbd "C-M-s") 'isearch-forward) +(global-set-key (kbd "C-M-r") 'isearch-backward) +(global-set-key (kbd "C-M-%") 'query-replace) + +;; Jump to a definition in the current file. (Protip: this is awesome.) +(global-set-key (kbd "C-x C-i") 'imenu) + +;; Window switching. (C-x o goes to the next window) +(windmove-default-keybindings) ;; Shift+direction + +;; Start eshell or switch to it if it's active. +(global-set-key (kbd "C-x m") 'eshell) + +;; Start a new eshell even if one is active. +(global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) + +;; Start a regular shell if you prefer that. +(global-set-key (kbd "C-x C-m") 'shell) + +;; So good! +(global-set-key (kbd "C-c g") 'magit-status) + +;; Add a fullscreen toggle +(global-set-key (kbd "M-RET") 'toggle-frame-fullscreen) + diff --git a/emacs.d/init.el b/emacs.d/init.el index e27a15f84e..866f18f728 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -14,8 +14,7 @@ (package-refresh-contents)) ;; Important packages -(defvar my-pkgs '(starter-kit-bindings - haskell-mode +(defvar my-pkgs '(haskell-mode markdown-mode magit leuven-theme @@ -35,6 +34,7 @@ (load "~/.emacs.d/init-functions.el") (load "~/.emacs.d/init-settings.el") (load "~/.emacs.d/init-modes.el") +(load "~/.emacs.d/init-bindings.el") (setq custom-file "~/.emacs.d/init-custom.el") (load custom-file) @@ -50,8 +50,5 @@ ;; Seed RNG (random t) -;; Add a fullscreen toggle -(global-set-key (kbd "M-RET") 'toggle-frame-fullscreen) - ;; Start server for emacsclient (server-start) -- cgit 1.4.1 From 0ebbf64fd1e42e69de29d5d49ffcedbf110c83dd Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 8 Jul 2013 16:55:56 +0200 Subject: Emacs: Added a function to reconnect rcirc --- emacs.d/init-functions.el | 25 +++++++++++++++++++++++++ fish/config.fish | 1 - 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/emacs.d/init-functions.el b/emacs.d/init-functions.el index de68ab71f5..3572cca69b 100644 --- a/emacs.d/init-functions.el +++ b/emacs.d/init-functions.el @@ -63,3 +63,28 @@ (insert prefix) (dotimes (_ (- 80 col (length prefix) (length postfix))) (insert "u")) (insert postfix))) + +;; Reconnect rcirc +(eval-after-load 'rcirc + '(defun-rcirc-command reconnect (arg) + "Reconnect the server process." + (interactive "i") + (unless process + (error "There's no process for this target")) + (let* ((server (car (process-contact process))) + (port (process-contact process :service)) + (nick (rcirc-nick process)) + channels query-buffers) + (dolist (buf (buffer-list)) + (with-current-buffer buf + (when (eq process (rcirc-buffer-process)) + (remove-hook 'change-major-mode-hook + 'rcirc-change-major-mode-hook) + (if (rcirc-channel-p rcirc-target) + (setq channels (cons rcirc-target channels)) + (setq query-buffers (cons buf query-buffers)))))) + (delete-process process) + (rcirc-connect server port nick + rcirc-default-user-name + rcirc-default-full-name + channels)))) diff --git a/fish/config.fish b/fish/config.fish index bc816eb627..b47d60adb4 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -13,7 +13,6 @@ function fish_right_prompt set_color --bold yellow echo -n ']' end - set -gx EDITOR emacsclient set -gx ALTERNATE_EDITOR emacs -- cgit 1.4.1 From 9961463ad7f5cec06447c3b193d50122b12c54d3 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 8 Jul 2013 16:59:35 +0200 Subject: emacs: Switched Haskell indent mode --- emacs.d/init-custom.el | 1 + emacs.d/init-modes.el | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs.d/init-custom.el b/emacs.d/init-custom.el index b77eae8dcf..c582239054 100644 --- a/emacs.d/init-custom.el +++ b/emacs.d/init-custom.el @@ -9,6 +9,7 @@ '(erc-modules (quote (autojoin button completion dcc irccontrols list log match menu move-to-prompt netsplit networks noncommands notifications readonly ring scrolltobottom stamp track))) + '(haskell-mode-hook (quote (font-lock-mode))) '(ns-alternate-modifier (quote none)) '(ns-command-modifier (quote meta))) (custom-set-faces diff --git a/emacs.d/init-modes.el b/emacs.d/init-modes.el index 6e523c3877..8a87aeb711 100644 --- a/emacs.d/init-modes.el +++ b/emacs.d/init-modes.el @@ -14,7 +14,7 @@ ;; Configure haskell-mode ;; Enable semi-automatic indentation and font-locking -(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation) +(add-hook 'haskell-mode-hook 'turn-on-haskell-indent) (add-hook 'haskell-mode-hook 'font-lock-mode) ;; Add keybindings to move nested blocks with C-, rsp. C-. -- cgit 1.4.1 From 51fdc2a29511b9c60cbee0f4026bf9e279eb69e3 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 8 Jul 2013 17:51:08 +0200 Subject: emacs: Fixed browser setting (by removing it!) --- emacs.d/init-settings.el | 2 -- 1 file changed, 2 deletions(-) diff --git a/emacs.d/init-settings.el b/emacs.d/init-settings.el index 281abbd85a..201f8465eb 100644 --- a/emacs.d/init-settings.el +++ b/emacs.d/init-settings.el @@ -109,8 +109,6 @@ comment as a filename." ;; ## Mac specific settings ## -(setq browse-url-browser-function 'browse-default-macosx-browser) - ;; Enable mouse support on OS X (unless window-system (require 'mouse) -- cgit 1.4.1 From f2c32a12be3dc69e82d7a8cc6bce762885afb424 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 8 Jul 2013 18:54:54 +0200 Subject: emacs: Completely removed starter-pack, shuffling dependencies --- emacs.d/init.el | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/emacs.d/init.el b/emacs.d/init.el index 866f18f728..98bffa577f 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -13,16 +13,22 @@ (when (not package-archive-contents) (package-refresh-contents)) -;; Important packages +;; Important defvar (defvar my-pkgs '(haskell-mode - markdown-mode - magit - leuven-theme - projectile - rainbow-delimiters - nrepl - clojure-mode - ace-jump-mode) + idle-highlight-mode + ido-ubiquitous + magit + paredit + smex + ace-jump-mode + clojure-mode + leuven-theme + magit + markdown-mode + nrepl + projectile + rainbow-delimiters + ) "A list of packages to install at launch.") -- cgit 1.4.1 From b65611db02e7d63c7b2d23f70eece5381c6ab700 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 8 Jul 2013 18:55:16 +0200 Subject: emacs: Initial mail settings --- emacs.d/init-mail.el | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 emacs.d/init-mail.el diff --git a/emacs.d/init-mail.el b/emacs.d/init-mail.el new file mode 100644 index 0000000000..982b78156f --- /dev/null +++ b/emacs.d/init-mail.el @@ -0,0 +1,18 @@ +(require 'gnus) + +(setq gnus-select-method '(nnimap "gmail" + (nnimap-address "imap.gmail.com") + (nnimap-server-port 993) + (nnimap-stream ssl))) + +(setq message-send-mail-function 'smtpmail-send-it + smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil)) + smtpmail-auth-credentials '(("smtp.gmail.com" 587 "vincent@spotify.com" nil)) + smtpmail-default-smtp-server "smtp.gmail.com" + smtpmail-smtp-server "smtp.gmail.com" + smtpmail-smtp-service 587 + smtpmail-local-domain "spotify.com") + + ;; Make Gnus NOT ignore [Gmail] mailboxes +(setq gnus-ignored-newsgroups "^to\\.\\|^[0-9. ]+\\( \\|$\\)\\|^[\"]\"[#'()]") + -- cgit 1.4.1 From c5f6606f63bf1a916d81d11f000003ff1ca668c6 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 9 Jul 2013 14:04:58 +0200 Subject: emacs: Switched font --- emacs.d/init-settings.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs.d/init-settings.el b/emacs.d/init-settings.el index 201f8465eb..aa73e25a69 100644 --- a/emacs.d/init-settings.el +++ b/emacs.d/init-settings.el @@ -94,6 +94,8 @@ comment as a filename." (global-hl-line-mode -1) +(set-default-font "Source Code Pro 13") + ;; Hiding JOIN, QUIT, PART (setq erc-hide-list '("JOIN" "PART" "QUIT")) -- cgit 1.4.1 From f2d23b818290e2719cc2898fbd9d25a5b743c5ec Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 10 Jul 2013 11:39:13 +0200 Subject: fish: Set EDITOR variable and edit function to use -n and -create-frame option in emacsclient --- fish/config.fish | 2 +- fish/functions/edit.fish | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fish/config.fish b/fish/config.fish index b47d60adb4..40a4e809da 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -14,7 +14,7 @@ function fish_right_prompt echo -n ']' end -set -gx EDITOR emacsclient +set -gx EDITOR "emacsclient -n -create-frame" set -gx ALTERNATE_EDITOR emacs set -gx VISUAL emacsclient diff --git a/fish/functions/edit.fish b/fish/functions/edit.fish index 83f6eb854f..61bf373456 100644 --- a/fish/functions/edit.fish +++ b/fish/functions/edit.fish @@ -1,3 +1,3 @@ function edit - emacsclient -no-wait $argv + emacsclient -no-wait -create-frame $argv end \ No newline at end of file -- cgit 1.4.1 From d2311f48f6778790d02deaab7b3c87c503c25335 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 10 Jul 2013 14:32:09 +0200 Subject: emacs: add /usr/local/bin to emacs' $PATH --- emacs.d/init-settings.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs.d/init-settings.el b/emacs.d/init-settings.el index aa73e25a69..db4f281cac 100644 --- a/emacs.d/init-settings.el +++ b/emacs.d/init-settings.el @@ -5,6 +5,8 @@ ;;; Code: +(add-to-list 'exec-path "/usr/local/bin") + (when window-system (setq frame-title-format '(buffer-file-name "%f" ("%b"))) (tooltip-mode -1) -- cgit 1.4.1 From 0de09c890d7f124c7814051705e4aec6603b226c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 14 Jul 2013 18:08:44 +0200 Subject: emacs: Changed rainbow-delimiters colours to those from Solarized theme (very visible on Gruber Darker, I like it!) and forcing show-parens-mode --- emacs.d/init-custom.el | 12 ++++++++++-- emacs.d/init-modes.el | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/emacs.d/init-custom.el b/emacs.d/init-custom.el index c582239054..f345915c22 100644 --- a/emacs.d/init-custom.el +++ b/emacs.d/init-custom.el @@ -9,7 +9,7 @@ '(erc-modules (quote (autojoin button completion dcc irccontrols list log match menu move-to-prompt netsplit networks noncommands notifications readonly ring scrolltobottom stamp track))) - '(haskell-mode-hook (quote (font-lock-mode))) + '(haskell-mode-hook (quote (font-lock-mode)) t) '(ns-alternate-modifier (quote none)) '(ns-command-modifier (quote meta))) (custom-set-faces @@ -17,4 +17,12 @@ ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. - ) + '(rainbow-delimiters-depth-1-face ((t (:foreground "#2aa198")))) + '(rainbow-delimiters-depth-2-face ((t (:foreground "#b58900")))) + '(rainbow-delimiters-depth-3-face ((t (:foreground "#268bd2")))) + '(rainbow-delimiters-depth-4-face ((t (:foreground "#dc322f")))) + '(rainbow-delimiters-depth-5-face ((t (:foreground "#859900")))) + '(rainbow-delimiters-depth-6-face ((t (:foreground "#268bd2")))) + '(rainbow-delimiters-depth-7-face ((t (:foreground "#cb4b16")))) + '(rainbow-delimiters-depth-8-face ((t (:foreground "#d33682")))) + '(rainbow-delimiters-depth-9-face ((t (:foreground "#839496"))))) diff --git a/emacs.d/init-modes.el b/emacs.d/init-modes.el index 8a87aeb711..2c07032c5b 100644 --- a/emacs.d/init-modes.el +++ b/emacs.d/init-modes.el @@ -42,3 +42,7 @@ ;; Enable paredit in all programming buffers (add-hook 'prog-mode-hook 'paredit-mode) + +;; Always highlight matching brackets +(show-paren-mode 1) + -- cgit 1.4.1 From d23221d2436f0a4558d5ac35e9e272ab950b656e Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 14 Jul 2013 23:50:24 +0200 Subject: emacs: Added a custom-git-clone function --- emacs.d/init-functions.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/emacs.d/init-functions.el b/emacs.d/init-functions.el index 3572cca69b..c15b27248e 100644 --- a/emacs.d/init-functions.el +++ b/emacs.d/init-functions.el @@ -35,6 +35,15 @@ (load file))) +;; This clones a git repository to 'foldername in .emacs.d +;; if there isn't already a folder with that name +(defun custom-clone-git (url foldername) + "Clones a git repository to .emacs.d/foldername" + (let ((fullpath (concat "~/.emacs.d/" foldername))) + (unless (file-exists-p fullpath) + (shell-command (concat "git clone " url " " fullpath)))) + ) + ;; These come from the emacs starter kit (defun esk-pretty-lambdas () (font-lock-add-keywords -- cgit 1.4.1 From dc0e8b98715ece0a574c3e28dff0af65b9a28229 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 14 Jul 2013 23:51:01 +0200 Subject: emacs: Add racket things --- emacs.d/init-settings.el | 3 ++- emacs.d/init.el | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/emacs.d/init-settings.el b/emacs.d/init-settings.el index db4f281cac..d963c82882 100644 --- a/emacs.d/init-settings.el +++ b/emacs.d/init-settings.el @@ -5,7 +5,8 @@ ;;; Code: -(add-to-list 'exec-path "/usr/local/bin") +(add-to-list 'exec-path "/usr/local/bin") +(add-to-list 'exec-path "/Applications/Racket/bin") (when window-system (setq frame-title-format '(buffer-file-name "%f" ("%b"))) diff --git a/emacs.d/init.el b/emacs.d/init.el index 98bffa577f..8c89496ae9 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -28,6 +28,8 @@ nrepl projectile rainbow-delimiters + geiser + quack ) "A list of packages to install at launch.") -- cgit 1.4.1 From a5f4b2f479f12eacb4a7e2b52d2c7866cb58bb9c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 15 Jul 2013 00:02:08 +0200 Subject: emacs: Nyan cat mode! --- emacs.d/init-modes.el | 2 ++ emacs.d/init-settings.el | 6 ++++++ emacs.d/init.el | 11 ++++++++--- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/emacs.d/init-modes.el b/emacs.d/init-modes.el index 2c07032c5b..74178b1e84 100644 --- a/emacs.d/init-modes.el +++ b/emacs.d/init-modes.el @@ -46,3 +46,5 @@ ;; Always highlight matching brackets (show-paren-mode 1) +;; Enable Nyan mode +(nyan-mode 1) diff --git a/emacs.d/init-settings.el b/emacs.d/init-settings.el index d963c82882..b4ad1c2095 100644 --- a/emacs.d/init-settings.el +++ b/emacs.d/init-settings.el @@ -99,6 +99,12 @@ comment as a filename." (set-default-font "Source Code Pro 13") +;; Don't make the nyan cat too long ... I have other stuff in the mode +;; bar as well! +(set-variable 'nyan-bar-length 15) +;; Not the real deal without this ... +(set-variable 'nyan-wavy-trail t) + ;; Hiding JOIN, QUIT, PART (setq erc-hide-list '("JOIN" "PART" "QUIT")) diff --git a/emacs.d/init.el b/emacs.d/init.el index 8c89496ae9..a80eb81339 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -40,9 +40,6 @@ (load "~/.emacs.d/init-functions.el") -(load "~/.emacs.d/init-settings.el") -(load "~/.emacs.d/init-modes.el") -(load "~/.emacs.d/init-bindings.el") (setq custom-file "~/.emacs.d/init-custom.el") (load custom-file) @@ -51,6 +48,14 @@ (custom-download-script "https://raw.github.com/dimitri/switch-window/master/switch-window.el" "switch-window.el") +;; NYAN CAT! +(custom-clone-git "https://github.com/TeMPOraL/nyan-mode" "nyan-mode") +(load "~/.emacs.d/nyan-mode/nyan-mode.el") + +(load "~/.emacs.d/init-settings.el") +(load "~/.emacs.d/init-modes.el") +(load "~/.emacs.d/init-bindings.el") + ;; IRC configuration (erc) ;; Actual servers and such are loaded from irc.el (load "~/.emacs.d/irc") -- cgit 1.4.1 From 23806edd3ef23f18d68923e13d5bc9d1a36b3ad4 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 15 Jul 2013 01:06:32 +0200 Subject: emacs: Some bindings and word jumping --- emacs.d/init-bindings.el | 6 ++++++ emacs.d/init.el | 3 +++ 2 files changed, 9 insertions(+) diff --git a/emacs.d/init-bindings.el b/emacs.d/init-bindings.el index 57586101f2..d60c1cbc03 100644 --- a/emacs.d/init-bindings.el +++ b/emacs.d/init-bindings.el @@ -15,6 +15,12 @@ ;; Jump to a definition in the current file. (Protip: this is awesome.) (global-set-key (kbd "C-x C-i") 'imenu) +;; Ace-jump-mode +(global-set-key (kbd "M-j") 'ace-jump-char-mode) + +;; Jump to next occurence of char +(global-set-key (kbd "M-m") 'iy-go-to-char) + ;; Window switching. (C-x o goes to the next window) (windmove-default-keybindings) ;; Shift+direction diff --git a/emacs.d/init.el b/emacs.d/init.el index a80eb81339..827eb859b2 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -48,6 +48,9 @@ (custom-download-script "https://raw.github.com/dimitri/switch-window/master/switch-window.el" "switch-window.el") +(custom-download-script "https://raw.github.com/doitian/iy-go-to-char/master/iy-go-to-char.el" + "goto-char.el") + ;; NYAN CAT! (custom-clone-git "https://github.com/TeMPOraL/nyan-mode" "nyan-mode") (load "~/.emacs.d/nyan-mode/nyan-mode.el") -- cgit 1.4.1 From 9342b6e56f5a5481203a99d95ef442ae50f14f83 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 15 Jul 2013 13:34:18 +0200 Subject: emacs: Added speak function --- emacs.d/init-functions.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/emacs.d/init-functions.el b/emacs.d/init-functions.el index c15b27248e..09ffe17772 100644 --- a/emacs.d/init-functions.el +++ b/emacs.d/init-functions.el @@ -73,6 +73,10 @@ (dotimes (_ (- 80 col (length prefix) (length postfix))) (insert "u")) (insert postfix))) +(defun speak (m &optional voice) + (shell-command (if 'voice (concat "say " m) + (concat "say -v " voice " " m)))) + ;; Reconnect rcirc (eval-after-load 'rcirc '(defun-rcirc-command reconnect (arg) -- cgit 1.4.1 From eadc09e76ffe80e3bf8c3e873df1b8367e88f7de Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 15 Jul 2013 13:42:08 +0200 Subject: emacs: Fixed voices --- emacs.d/init-functions.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/emacs.d/init-functions.el b/emacs.d/init-functions.el index 09ffe17772..640a8f8c62 100644 --- a/emacs.d/init-functions.el +++ b/emacs.d/init-functions.el @@ -74,8 +74,9 @@ (insert postfix))) (defun speak (m &optional voice) - (shell-command (if 'voice (concat "say " m) - (concat "say -v " voice " " m)))) + (shell-command (if 'voice (concat "say -v " voice " \"" m "\"") + (concat "say " m)))) + ;; Reconnect rcirc (eval-after-load 'rcirc -- cgit 1.4.1 From f61db0ceefcd5d928bf824c3dd4d499fb802cf61 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 19 Jul 2013 13:57:13 +0200 Subject: emacs: Added functions from ESK, removed rcirc connect function, added scripts folder to load path --- emacs.d/init-bindings.el | 3 +++ emacs.d/init-functions.el | 39 +++++++++++++-------------------------- emacs.d/init.el | 2 ++ 3 files changed, 18 insertions(+), 26 deletions(-) diff --git a/emacs.d/init-bindings.el b/emacs.d/init-bindings.el index d60c1cbc03..214ef5b489 100644 --- a/emacs.d/init-bindings.el +++ b/emacs.d/init-bindings.el @@ -30,6 +30,9 @@ ;; Start a new eshell even if one is active. (global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) +;; Eval sexp and replace it with result +(global-set-key (kbd "C-c e") 'esk-eval-and-replace) + ;; Start a regular shell if you prefer that. (global-set-key (kbd "C-x C-m") 'shell) diff --git a/emacs.d/init-functions.el b/emacs.d/init-functions.el index 640a8f8c62..b394b999fd 100644 --- a/emacs.d/init-functions.el +++ b/emacs.d/init-functions.el @@ -52,6 +52,16 @@ ,(make-char 'greek-iso8859-7 107)) nil)))))) +(defun esk-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))))) + (defun esk-add-watchwords () (font-lock-add-keywords nil '(("\\<\\(FIX\\(ME\\)?\\|TODO\\|HACK\\|REFACTOR\\|NOCOMMIT\\)" @@ -73,32 +83,9 @@ (dotimes (_ (- 80 col (length prefix) (length postfix))) (insert "u")) (insert postfix))) +(defun esk-turn-off-tool-bar () + (if (functionp 'tool-bar-mode) (tool-bar-mode -1))) + (defun speak (m &optional voice) (shell-command (if 'voice (concat "say -v " voice " \"" m "\"") (concat "say " m)))) - - -;; Reconnect rcirc -(eval-after-load 'rcirc - '(defun-rcirc-command reconnect (arg) - "Reconnect the server process." - (interactive "i") - (unless process - (error "There's no process for this target")) - (let* ((server (car (process-contact process))) - (port (process-contact process :service)) - (nick (rcirc-nick process)) - channels query-buffers) - (dolist (buf (buffer-list)) - (with-current-buffer buf - (when (eq process (rcirc-buffer-process)) - (remove-hook 'change-major-mode-hook - 'rcirc-change-major-mode-hook) - (if (rcirc-channel-p rcirc-target) - (setq channels (cons rcirc-target channels)) - (setq query-buffers (cons buf query-buffers)))))) - (delete-process process) - (rcirc-connect server port nick - rcirc-default-user-name - rcirc-default-full-name - channels)))) diff --git a/emacs.d/init.el b/emacs.d/init.el index 827eb859b2..9d4ac4b720 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -41,6 +41,8 @@ (load "~/.emacs.d/init-functions.el") +(add-to-list 'load-path "~/.emacs.d/scripts/") + (setq custom-file "~/.emacs.d/init-custom.el") (load custom-file) -- cgit 1.4.1 From 319ff395d8dc14026bd22f98f1350704a205a2f5 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 21 Jul 2013 01:23:03 +0200 Subject: emacs: Added configuration for EShell, mainly prompt and path. --- emacs.d/init-eshell.el | 66 ++++++++++++++++++++++++++++++++++++++++++++++++ emacs.d/init-settings.el | 1 + emacs.d/init.el | 1 + 3 files changed, 68 insertions(+) create mode 100644 emacs.d/init-eshell.el diff --git a/emacs.d/init-eshell.el b/emacs.d/init-eshell.el new file mode 100644 index 0000000000..858715737a --- /dev/null +++ b/emacs.d/init-eshell.el @@ -0,0 +1,66 @@ +;; EShell configuration + +(defvar home-dir) +(setq home-dir (expand-file-name "~")) + +(setq eshell-path-env (concat + "/usr/local/bin:" + (concat home-dir "/bin:") + eshell-path-env)) + +;; Prompt configuration + +(defun clean-pwd (path) + "Turns a path of the form /foo/bar/baz into /f/b/baz + (inspired by fish shell)" + (message path) + (let* ((current-dir (split-string path "/")) + (cdir (last current-dir)) + (head (butlast current-dir))) + (concat (mapconcat (lambda (s) + (if (string= "" s) nil + (substring s 0 1))) + head + "/") + (if head "/" nil) + (car cdir)))) + +(setq eshell-pwd-convert-function + (lambda (path) + (clean-pwd (replace-regexp-in-string + home-dir + "~" + path)))) + +(defun vcprompt (&optional args) + "Call the external vcprompt command with optional arguments. + VCPrompt" + (replace-regexp-in-string + "\n" "" + (shell-command-to-string (concat "vcprompt" args)))) + +(defmacro with-face (str &rest properties) + `(propertize ,str 'face (list ,@properties))) + +(defun prompt-f () + "My EShell prompt displaying VC info and such" + (concat + (with-face (concat (eshell/pwd) " ") :foreground "#96a6c8") + (with-face (vcprompt " -f \"(%s:%b%a%m) \"") :foreground "#5f627f") + (if (= 0 (user-uid)) + (with-face "#" :foreground "#f43841") + (with-face "$" :foreground "#73c936")) + (with-face " " :foreground "#95a99f"))) + + +(setq eshell-prompt-function 'prompt-f) +(setq eshell-highlight-prompt nil) + +;; EShell functions that come in handy + +;; clear in eshell +(defun eshell/clear () + "clear the eshell buffer." + (interactive) + (let ((inhibit-read-only t)) + (erase-buffer))) diff --git a/emacs.d/init-settings.el b/emacs.d/init-settings.el index b4ad1c2095..2d1f3c4bcc 100644 --- a/emacs.d/init-settings.el +++ b/emacs.d/init-settings.el @@ -6,6 +6,7 @@ ;;; Code: (add-to-list 'exec-path "/usr/local/bin") +(add-to-list 'exec-path (expand-file-name "~/bin")) (add-to-list 'exec-path "/Applications/Racket/bin") (when window-system diff --git a/emacs.d/init.el b/emacs.d/init.el index 9d4ac4b720..9c3304fdc7 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -30,6 +30,7 @@ rainbow-delimiters geiser quack + rainbow-mode ) "A list of packages to install at launch.") -- cgit 1.4.1 From c6a9219ff5fd899808b03bdf5eebeccb904378b0 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 21 Jul 2013 01:48:06 +0200 Subject: emacs: Load init-eshell.el --- emacs.d/init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs.d/init.el b/emacs.d/init.el index 9c3304fdc7..489479773b 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -61,6 +61,7 @@ (load "~/.emacs.d/init-settings.el") (load "~/.emacs.d/init-modes.el") (load "~/.emacs.d/init-bindings.el") +(load "~/.emacs.d/init-eshell.el") ;; IRC configuration (erc) ;; Actual servers and such are loaded from irc.el -- cgit 1.4.1 From 16e42ba338a42463bab13a8bf5d35f53b853ce95 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 21 Jul 2013 01:49:53 +0200 Subject: emacs: require eshell --- emacs.d/init-eshell.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs.d/init-eshell.el b/emacs.d/init-eshell.el index 858715737a..1a3c539448 100644 --- a/emacs.d/init-eshell.el +++ b/emacs.d/init-eshell.el @@ -1,5 +1,7 @@ ;; EShell configuration +(require 'eshell) + (defvar home-dir) (setq home-dir (expand-file-name "~")) -- cgit 1.4.1 From 817ebc39e4f82147472a334d67e8070b6c6a75ae Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 21 Jul 2013 15:23:35 +0200 Subject: emacs: Added Jabber config --- emacs.d/init-custom.el | 12 +++++++++--- emacs.d/init.el | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/emacs.d/init-custom.el b/emacs.d/init-custom.el index f345915c22..dad8de7454 100644 --- a/emacs.d/init-custom.el +++ b/emacs.d/init-custom.el @@ -5,13 +5,19 @@ ;; If there is more than one, they won't work right. '(custom-safe-themes (quote - ("8eaa3bce3c618cd81a318fcf2d28c1cd21278531f028feb53186f6387547dfb4" "ea0c5df0f067d2e3c0f048c1f8795af7b873f5014837feb0a7c8317f34417b04" "a234f91f9be6ed40f6ce0e94dce5cea1b9f1ccec2b9ccd42bb71c499867a3fcc" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "d6a00ef5e53adf9b6fe417d2b4404895f26210c52bb8716971be106550cea257" default))) + ("854dc57026d3226addcc46b2b460034a74609edbd9c14e626769ac724b10fcf5" "8eaa3bce3c618cd81a318fcf2d28c1cd21278531f028feb53186f6387547dfb4" "ea0c5df0f067d2e3c0f048c1f8795af7b873f5014837feb0a7c8317f34417b04" "a234f91f9be6ed40f6ce0e94dce5cea1b9f1ccec2b9ccd42bb71c499867a3fcc" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "d6a00ef5e53adf9b6fe417d2b4404895f26210c52bb8716971be106550cea257" default))) '(erc-modules (quote (autojoin button completion dcc irccontrols list log match menu move-to-prompt netsplit networks noncommands notifications readonly ring scrolltobottom stamp track))) - '(haskell-mode-hook (quote (font-lock-mode)) t) + '(haskell-mode-hook (quote (font-lock-mode))) + '(jabber-account-list (quote (("im@tazj.in")))) + '(jabber-history-enabled t) + '(jabber-mode-line-compact t) + '(jabber-mode-line-mode t) '(ns-alternate-modifier (quote none)) - '(ns-command-modifier (quote meta))) + '(ns-command-modifier (quote meta)) + '(yapm-file-path "~/.pass.gpg") + '(yapm-user (quote hej@tazj\.in))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. diff --git a/emacs.d/init.el b/emacs.d/init.el index 489479773b..919a7bb63c 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -31,6 +31,7 @@ geiser quack rainbow-mode + jabber ) "A list of packages to install at launch.") -- cgit 1.4.1 From 818b2eb2d5349935055304150a50651fa13b18b1 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 22 Jul 2013 02:26:51 +0200 Subject: emacs: Eshell prompt regexp --- emacs.d/init-eshell.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs.d/init-eshell.el b/emacs.d/init-eshell.el index 1a3c539448..59cebe62a5 100644 --- a/emacs.d/init-eshell.el +++ b/emacs.d/init-eshell.el @@ -57,6 +57,8 @@ (setq eshell-prompt-function 'prompt-f) (setq eshell-highlight-prompt nil) +(setq eshell-prompt-regexp "^.+? \\((\\(git\\|svn\\|hg\\|darcs\\|cvs\\|bzr\\):.+?) \\)?[$#] ") + ;; EShell functions that come in handy -- cgit 1.4.1 From 2e9b4cf111b3ba46994b6bb608aca5e07ac00b75 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 22 Jul 2013 11:43:48 +0200 Subject: emacs: Fixed EShell path --- emacs.d/init-eshell.el | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/emacs.d/init-eshell.el b/emacs.d/init-eshell.el index 59cebe62a5..2fd2ed9422 100644 --- a/emacs.d/init-eshell.el +++ b/emacs.d/init-eshell.el @@ -5,10 +5,17 @@ (defvar home-dir) (setq home-dir (expand-file-name "~")) -(setq eshell-path-env (concat - "/usr/local/bin:" - (concat home-dir "/bin:") - eshell-path-env)) +(defun eshell-mode-hook-setup () + "Sets up EShell when it is loaded" + + (setq eshell-path-env (concat + "/usr/local/bin:" + (concat home-dir "/bin:") + eshell-path-env)) + + (setenv "PATH" eshell-path-env)) + +(add-hook 'eshell-mode-hook 'eshell-mode-hook-setup) ;; Prompt configuration -- cgit 1.4.1 From 2f8813385805b7091b3a5c95a30a2985046424d1 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 25 Jul 2013 20:22:57 +0200 Subject: emacs: Added init-local.el loading for machine-local configuration, removed jabber (using bitlbee instead) --- emacs.d/init.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs.d/init.el b/emacs.d/init.el index 919a7bb63c..3710b6380b 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -31,7 +31,6 @@ geiser quack rainbow-mode - jabber ) "A list of packages to install at launch.") @@ -64,6 +63,9 @@ (load "~/.emacs.d/init-bindings.el") (load "~/.emacs.d/init-eshell.el") +;; A file with machine specific settings +(load "~/.emacs.d/init-local.el") + ;; IRC configuration (erc) ;; Actual servers and such are loaded from irc.el (load "~/.emacs.d/irc") -- cgit 1.4.1 From 488a5c4956ea5789528b48d5a8dd97c9c8f3e701 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 28 Jul 2013 18:02:36 +0200 Subject: Emacs: Enabling some more visual commands in EShell, set EShell config directory to ~/.config/eshell (similar to the fish dir) --- emacs.d/init-eshell.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/emacs.d/init-eshell.el b/emacs.d/init-eshell.el index 2fd2ed9422..18543f80a7 100644 --- a/emacs.d/init-eshell.el +++ b/emacs.d/init-eshell.el @@ -66,6 +66,21 @@ (setq eshell-highlight-prompt nil) (setq eshell-prompt-regexp "^.+? \\((\\(git\\|svn\\|hg\\|darcs\\|cvs\\|bzr\\):.+?) \\)?[$#] ") +;; Ignore version control folders in autocompletion +(setq eshell-cmpl-cycle-completions nil + eshell-save-history-on-exit t + eshell-cmpl-dir-ignore "\\`\\(\\.\\.?\\|CVS\\|\\.svn\\|\\.git\\)/\\'") + +;; Load some EShell extensions +(eval-after-load 'esh-opt + '(progn + (require 'em-term) + (require 'em-cmpl) + ;; More visual commands! + (add-to-list 'eshell-visual-commands "ssh") + (add-to-list 'eshell-visual-commands "tail"))) + +(setq eshell-directory-name "~/.config/eshell/") ;; EShell functions that come in handy -- cgit 1.4.1 From cdffc846bbc81a8bbf976a46321898fdd7073c17 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 29 Jul 2013 00:53:08 +0200 Subject: Emacs: Various changes: - Moved Haskell-mode configuration to customize - Disabled Paredit in non-lisp buffers (or more explicitly: Enabled it in Elisp and Clojure buffers) - Removed some custom items that I don't use anymore (e.g. Jabber-mode because I switched to bitlbee with rcirc) - New packages: hi2 (Haskell indent mode revamped), browse-kill-ring - Always enable undo-tree-mode and recentf-mode - Keep all auto-save files in /tmp --- emacs.d/init-custom.el | 12 ++++-------- emacs.d/init-modes.el | 15 +++++++++++---- emacs.d/init-settings.el | 7 +++++++ emacs.d/init.el | 41 +++++++++++++++++++++-------------------- 4 files changed, 43 insertions(+), 32 deletions(-) diff --git a/emacs.d/init-custom.el b/emacs.d/init-custom.el index dad8de7454..f3859ba1dd 100644 --- a/emacs.d/init-custom.el +++ b/emacs.d/init-custom.el @@ -9,15 +9,11 @@ '(erc-modules (quote (autojoin button completion dcc irccontrols list log match menu move-to-prompt netsplit networks noncommands notifications readonly ring scrolltobottom stamp track))) - '(haskell-mode-hook (quote (font-lock-mode))) - '(jabber-account-list (quote (("im@tazj.in")))) - '(jabber-history-enabled t) - '(jabber-mode-line-compact t) - '(jabber-mode-line-mode t) + '(haskell-mode-hook + (quote + (capitalized-words-mode turn-on-haskell-decl-scan turn-on-haskell-doc turn-on-hi2))) '(ns-alternate-modifier (quote none)) - '(ns-command-modifier (quote meta)) - '(yapm-file-path "~/.pass.gpg") - '(yapm-user (quote hej@tazj\.in))) + '(ns-command-modifier (quote meta))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. diff --git a/emacs.d/init-modes.el b/emacs.d/init-modes.el index 74178b1e84..39dcfd74bc 100644 --- a/emacs.d/init-modes.el +++ b/emacs.d/init-modes.el @@ -14,8 +14,9 @@ ;; Configure haskell-mode ;; Enable semi-automatic indentation and font-locking -(add-hook 'haskell-mode-hook 'turn-on-haskell-indent) -(add-hook 'haskell-mode-hook 'font-lock-mode) +(require 'hi2) +;;(add-hook 'haskell-mode-hook 'turn-on-hi2) +;;(add-hook 'haskell-mode-hook 'font-lock-mode) ;; Add keybindings to move nested blocks with C-, rsp. C-. (define-key haskell-mode-map (kbd "C-,") 'haskell-move-nested-left) @@ -40,11 +41,17 @@ ;; Enable rainbow-delimiters for all things programming (add-hook 'prog-mode-hook 'rainbow-delimiters-mode) -;; Enable paredit in all programming buffers -(add-hook 'prog-mode-hook 'paredit-mode) +;; Enable Paredit in Emacs Lisp mode +(add-hook 'emacs-lisp-mode-hook 'paredit-mode) ;; Always highlight matching brackets (show-paren-mode 1) +;; Undo-Tree at all times! +(undo-tree-mode) + +;; Keep track of recent files +(recentf-mode) + ;; Enable Nyan mode (nyan-mode 1) diff --git a/emacs.d/init-settings.el b/emacs.d/init-settings.el index 2d1f3c4bcc..aa702bf8bc 100644 --- a/emacs.d/init-settings.el +++ b/emacs.d/init-settings.el @@ -9,6 +9,7 @@ (add-to-list 'exec-path (expand-file-name "~/bin")) (add-to-list 'exec-path "/Applications/Racket/bin") + (when window-system (setq frame-title-format '(buffer-file-name "%f" ("%b"))) (tooltip-mode -1) @@ -172,6 +173,12 @@ comment as a filename." '(ace-jump-mode-enable-mark-sync)) (define-key global-map (kbd "C-x ö") 'ace-jump-mode-pop-mark) +;; Keep your backup files in tmp, emacs! +(setq backup-directory-alist + `((".*" . ,temporary-file-directory))) +(setq auto-save-file-name-transforms + `((".*" ,temporary-file-directory t))) + ;; Eshell ;; Start/join (global-set-key (kbd "C-x m") 'eshell) diff --git a/emacs.d/init.el b/emacs.d/init.el index 3710b6380b..35d5fda16b 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -13,26 +13,27 @@ (when (not package-archive-contents) (package-refresh-contents)) -;; Important defvar -(defvar my-pkgs '(haskell-mode - idle-highlight-mode - ido-ubiquitous - magit - paredit - smex - ace-jump-mode - clojure-mode - leuven-theme - magit - markdown-mode - nrepl - projectile - rainbow-delimiters - geiser - quack - rainbow-mode - ) - +(defvar my-pkgs + '(ace-jump-mode + browse-kill-ring + clojure-mode + flycheck + haskell-mode + hi2 + idle-highlight-mode + ido-ubiquitous + leuven-theme + magit + magit + markdown-mode + nrepl + paredit + projectile + rainbow-delimiters + rainbow-mode + smex + geiser + quack) "A list of packages to install at launch.") (dolist (p my-pkgs) -- cgit 1.4.1 From cae07c88fd5ebb26caf78c37c560855b12cb8268 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 29 Jul 2013 18:44:02 +0200 Subject: emacs: Disabled EShell banner message, amended PATH fish: Amended PATH --- emacs.d/init-eshell.el | 8 +++++++- fish/config.fish | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/emacs.d/init-eshell.el b/emacs.d/init-eshell.el index 18543f80a7..4a520c3a86 100644 --- a/emacs.d/init-eshell.el +++ b/emacs.d/init-eshell.el @@ -2,6 +2,10 @@ (require 'eshell) +;; Generic settings +;; Hide banner message ... +(setq eshell-banner-message "") + (defvar home-dir) (setq home-dir (expand-file-name "~")) @@ -11,6 +15,7 @@ (setq eshell-path-env (concat "/usr/local/bin:" (concat home-dir "/bin:") + "/usr/local/share/python" eshell-path-env)) (setenv "PATH" eshell-path-env)) @@ -78,7 +83,8 @@ (require 'em-cmpl) ;; More visual commands! (add-to-list 'eshell-visual-commands "ssh") - (add-to-list 'eshell-visual-commands "tail"))) + (add-to-list 'eshell-visual-commands "tail") + (add-to-list 'eshell-visual-commands "sl"))) (setq eshell-directory-name "~/.config/eshell/") diff --git a/fish/config.fish b/fish/config.fish index 40a4e809da..1fdeb0e92f 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -20,4 +20,4 @@ set -gx VISUAL emacsclient set fish_greeting "" -set PATH /usr/local/bin ~/Library/Haskell/bin ~/bin/ /Users/vincent/Source/management-scripts/google-apps/ $PATH +set PATH /usr/local/share/python /usr/local/bin ~/Library/Haskell/bin ~/bin/ /Users/vincent/Source/management-scripts/google-apps/ $PATH -- cgit 1.4.1 From 459f0433e66c3a2c7f2b30df85267d9d9064faf2 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 30 Jul 2013 16:19:58 +0200 Subject: emacs: Minor fixes --- emacs.d/init-custom.el | 1 + emacs.d/init-eshell.el | 2 +- emacs.d/init.el | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/emacs.d/init-custom.el b/emacs.d/init-custom.el index f3859ba1dd..2b2916143f 100644 --- a/emacs.d/init-custom.el +++ b/emacs.d/init-custom.el @@ -12,6 +12,7 @@ '(haskell-mode-hook (quote (capitalized-words-mode turn-on-haskell-decl-scan turn-on-haskell-doc turn-on-hi2))) + '(it-mode-google-cmd "/usr/local/share/python/google") '(ns-alternate-modifier (quote none)) '(ns-command-modifier (quote meta))) (custom-set-faces diff --git a/emacs.d/init-eshell.el b/emacs.d/init-eshell.el index 4a520c3a86..239a9980ce 100644 --- a/emacs.d/init-eshell.el +++ b/emacs.d/init-eshell.el @@ -15,7 +15,7 @@ (setq eshell-path-env (concat "/usr/local/bin:" (concat home-dir "/bin:") - "/usr/local/share/python" + "/usr/local/share/python:" eshell-path-env)) (setenv "PATH" eshell-path-env)) diff --git a/emacs.d/init.el b/emacs.d/init.el index 35d5fda16b..bd3ecc9f70 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -26,12 +26,14 @@ magit magit markdown-mode + multiple-cursors nrepl paredit projectile rainbow-delimiters rainbow-mode smex + undo-tree geiser quack) "A list of packages to install at launch.") -- cgit 1.4.1 From 580f642d4051aed2d61d1c8db1322507720d087d Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 1 Aug 2013 11:31:13 +0200 Subject: emacs: Function to toggle native/non-native fullscreen on OS X --- emacs.d/init-settings.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/emacs.d/init-settings.el b/emacs.d/init-settings.el index aa702bf8bc..f8e87ef0ab 100644 --- a/emacs.d/init-settings.el +++ b/emacs.d/init-settings.el @@ -147,6 +147,11 @@ comment as a filename." ;; Don't use Apple's native fullscreen (FIXME: Change with Mavericks) (setq ns-use-native-fullscreen nil) +(defun toggle-native-fullscreen () + "Toggles between native and non-native OS X fullscreen" + (interactive) + (setq ns-use-native-fullscreen (not ns-use-native-fullscreen))) + ;; ## Navigation and key bindings ## ;; Navigate windows with M- -- cgit 1.4.1 From 006043d82e7938f5f79d11e17e03314e932f8684 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 3 Aug 2013 15:36:05 +0200 Subject: emacs: Added flx (glorious!), removed some unused settings and functions --- emacs.d/init-functions.el | 13 ------------- emacs.d/init-modes.el | 8 +------- emacs.d/init-settings.el | 4 ++++ emacs.d/init.el | 1 + 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/emacs.d/init-functions.el b/emacs.d/init-functions.el index b394b999fd..3a1c8c7e8e 100644 --- a/emacs.d/init-functions.el +++ b/emacs.d/init-functions.el @@ -73,19 +73,6 @@ (find-file (concat "/sudo:root@localhost:" (ido-read-file-name "File: "))) (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))) -(defun esk-suck-it (suckee) - "Insert a comment of appropriate length about what can suck it." - (interactive "MWhat can suck it? ") - (let ((prefix (concat ";; " suckee " can s")) - (postfix "ck it!") - (col (current-column))) - (insert prefix) - (dotimes (_ (- 80 col (length prefix) (length postfix))) (insert "u")) - (insert postfix))) - -(defun esk-turn-off-tool-bar () - (if (functionp 'tool-bar-mode) (tool-bar-mode -1))) - (defun speak (m &optional voice) (shell-command (if 'voice (concat "say -v " voice " \"" m "\"") (concat "say " m)))) diff --git a/emacs.d/init-modes.el b/emacs.d/init-modes.el index 39dcfd74bc..3e9cff9996 100644 --- a/emacs.d/init-modes.el +++ b/emacs.d/init-modes.el @@ -1,4 +1,4 @@ -(mapc 'require '(projectile)) +(mapc 'require '(projectile hi2)) ;; Initializes modes I use. (add-hook 'prog-mode-hook 'esk-pretty-lambdas) @@ -12,12 +12,6 @@ (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) -;; Configure haskell-mode -;; Enable semi-automatic indentation and font-locking -(require 'hi2) -;;(add-hook 'haskell-mode-hook 'turn-on-hi2) -;;(add-hook 'haskell-mode-hook 'font-lock-mode) - ;; Add keybindings to move nested blocks with C-, rsp. C-. (define-key haskell-mode-map (kbd "C-,") 'haskell-move-nested-left) (define-key haskell-mode-map (kbd "C-.") 'haskell-move-nested-right) diff --git a/emacs.d/init-settings.el b/emacs.d/init-settings.el index f8e87ef0ab..02069a82f8 100644 --- a/emacs.d/init-settings.el +++ b/emacs.d/init-settings.el @@ -3,6 +3,10 @@ (tool-bar-mode -1) (scroll-bar-mode -1) +(flx-ido-mode 1) +(setq ido-use-faces nil) +(setq gc-cons-threshold 20000000) + ;;; Code: (add-to-list 'exec-path "/usr/local/bin") diff --git a/emacs.d/init.el b/emacs.d/init.el index bd3ecc9f70..d9bc8d874b 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -18,6 +18,7 @@ browse-kill-ring clojure-mode flycheck + flx-ido haskell-mode hi2 idle-highlight-mode -- cgit 1.4.1 From 46b80c00fd8a260e130e4f785b3f46c49487c9db Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 5 Aug 2013 11:54:38 +0200 Subject: emacs: Added some functions from @magnars, replaced standard goto-line with his version --- emacs.d/init-bindings.el | 2 ++ emacs.d/init-functions.el | 58 ++++++++++++++++++++++++++++++++++++++++++++--- emacs.d/init-settings.el | 10 ++++++++ emacs.d/init.el | 3 +++ 4 files changed, 70 insertions(+), 3 deletions(-) diff --git a/emacs.d/init-bindings.el b/emacs.d/init-bindings.el index 214ef5b489..2593ddd6d0 100644 --- a/emacs.d/init-bindings.el +++ b/emacs.d/init-bindings.el @@ -42,3 +42,5 @@ ;; Add a fullscreen toggle (global-set-key (kbd "M-RET") 'toggle-frame-fullscreen) +;; Replace standard goto-line with goto-line-with-feedback +(global-set-key (kbd "M-g g") 'goto-line-with-feedback) diff --git a/emacs.d/init-functions.el b/emacs.d/init-functions.el index 3a1c8c7e8e..dfdfee0838 100644 --- a/emacs.d/init-functions.el +++ b/emacs.d/init-functions.el @@ -12,7 +12,7 @@ ;; there) (unless (member "~/.emacs.d/themes" custom-theme-load-path) (add-to-list 'custom-theme-load-path "~/.emacs.d/themes")) - + ;; Download file if it doesn't exist. (let ((file @@ -22,7 +22,7 @@ (defun custom-download-script (url filename) "Downloads an Elisp script, places it in ~/.emacs/other and then loads it" - + ;; Ensure the directory exists (unless (file-exists-p "~/.emacs.d/other") (make-directory "~/.emacs.d/other")) @@ -44,6 +44,58 @@ (shell-command (concat "git clone " url " " fullpath)))) ) +;; These come from magnars, he's got some awesome things. + +(defun goto-line-with-feedback () + "Show line numbers temporarily, while prompting for the line number input" + (interactive) + (unwind-protect + (progn + (linum-mode 1) + (call-interactively 'goto-line)) + (linum-mode -1))) + +(defun rotate-windows () + "Rotate your windows" + (interactive) + (cond ((not (> (count-windows)1)) + (message "You can't rotate a single window!")) + (t + (setq i 1) + (setq numWindows (count-windows)) + (while (< i numWindows) + (let* ( + (w1 (elt (window-list) i)) + (w2 (elt (window-list) (+ (% i numWindows) 1))) + + (b1 (window-buffer w1)) + (b2 (window-buffer w2)) + + (s1 (window-start w1)) + (s2 (window-start w2)) + ) + (set-window-buffer w1 b2) + (set-window-buffer w2 b1) + (set-window-start w1 s2) + (set-window-start w2 s1) + (setq i (1+ i))))))) + +(defun untabify-buffer () + (interactive) + (untabify (point-min) (point-max))) + +(defun indent-buffer () + (interactive) + (indent-region (point-min) (point-max))) + +(defun cleanup-buffer () + "Perform a bunch of operations on the whitespace content of a buffer. +Including indent-buffer, which should not be called automatically on save." + (interactive) + (untabify-buffer) + (delete-trailing-whitespace) + (indent-buffer)) + ;; These come from the emacs starter kit (defun esk-pretty-lambdas () (font-lock-add-keywords @@ -75,4 +127,4 @@ (defun speak (m &optional voice) (shell-command (if 'voice (concat "say -v " voice " \"" m "\"") - (concat "say " m)))) + (concat "say " m)))) diff --git a/emacs.d/init-settings.el b/emacs.d/init-settings.el index 02069a82f8..e2c7e6249b 100644 --- a/emacs.d/init-settings.el +++ b/emacs.d/init-settings.el @@ -111,6 +111,16 @@ comment as a filename." ;; Not the real deal without this ... (set-variable 'nyan-wavy-trail t) +(setq linum-format (lambda (line) + (propertize + (format (concat " %" + (number-to-string + (length (number-to-string + (line-number-at-pos (point-max))))) + "d ") + line) + 'face 'linum))) + ;; Hiding JOIN, QUIT, PART (setq erc-hide-list '("JOIN" "PART" "QUIT")) diff --git a/emacs.d/init.el b/emacs.d/init.el index d9bc8d874b..4551a7b9ad 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -74,6 +74,9 @@ ;; Actual servers and such are loaded from irc.el (load "~/.emacs.d/irc") +;; Load magnars' string manipulation library +(require 's) + ;; Seed RNG (random t) -- cgit 1.4.1 From e320f142636c5db25f0f3a786ce6c2ea41c36c06 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 5 Aug 2013 15:17:23 +0200 Subject: * removed dotfiles stuff, this is emacs.d only --- emacs.d/init-bindings.el | 46 -------- emacs.d/init-custom.el | 31 ----- emacs.d/init-eshell.el | 98 --------------- emacs.d/init-functions.el | 130 -------------------- emacs.d/init-mail.el | 18 --- emacs.d/init-modes.el | 51 -------- emacs.d/init-settings.el | 210 --------------------------------- emacs.d/init.el | 84 ------------- fish/config.fish | 23 ---- fish/functions/edit.fish | 3 - fish/functions/runhoogle.fish | 5 - fish/functions/runirc.fish | 3 - init-bindings.el | 46 ++++++++ init-custom.el | 31 +++++ init-eshell.el | 98 +++++++++++++++ init-functions.el | 130 ++++++++++++++++++++ init-mail.el | 18 +++ init-modes.el | 51 ++++++++ init-settings.el | 210 +++++++++++++++++++++++++++++++++ init.el | 84 +++++++++++++ plists/com.googlecode.iterm2.plist | Bin 13417 -> 0 bytes plists/org.pqrs.KeyRemap4MacBook.plist | Bin 394 -> 0 bytes plists/org.pqrs.PCKeyboardHack.plist | Bin 223 -> 0 bytes xnomad | 20 ---- zshrc | 63 ---------- 25 files changed, 668 insertions(+), 785 deletions(-) delete mode 100644 emacs.d/init-bindings.el delete mode 100644 emacs.d/init-custom.el delete mode 100644 emacs.d/init-eshell.el delete mode 100644 emacs.d/init-functions.el delete mode 100644 emacs.d/init-mail.el delete mode 100644 emacs.d/init-modes.el delete mode 100644 emacs.d/init-settings.el delete mode 100644 emacs.d/init.el delete mode 100644 fish/config.fish delete mode 100644 fish/functions/edit.fish delete mode 100644 fish/functions/runhoogle.fish delete mode 100644 fish/functions/runirc.fish create mode 100644 init-bindings.el create mode 100644 init-custom.el create mode 100644 init-eshell.el create mode 100644 init-functions.el create mode 100644 init-mail.el create mode 100644 init-modes.el create mode 100644 init-settings.el create mode 100644 init.el delete mode 100644 plists/com.googlecode.iterm2.plist delete mode 100644 plists/org.pqrs.KeyRemap4MacBook.plist delete mode 100644 plists/org.pqrs.PCKeyboardHack.plist delete mode 100644 xnomad delete mode 100644 zshrc diff --git a/emacs.d/init-bindings.el b/emacs.d/init-bindings.el deleted file mode 100644 index 2593ddd6d0..0000000000 --- a/emacs.d/init-bindings.el +++ /dev/null @@ -1,46 +0,0 @@ -;; Various keybindings, most of them taken from starter-kit-bindings - -;; Font size -(define-key global-map (kbd "C-+") 'text-scale-increase) -(define-key global-map (kbd "C--") 'text-scale-decrease) - -;; Use regex searches by default. -(global-set-key (kbd "C-s") 'isearch-forward-regexp) -(global-set-key (kbd "\C-r") 'isearch-backward-regexp) -(global-set-key (kbd "M-%") 'query-replace-regexp) -(global-set-key (kbd "C-M-s") 'isearch-forward) -(global-set-key (kbd "C-M-r") 'isearch-backward) -(global-set-key (kbd "C-M-%") 'query-replace) - -;; Jump to a definition in the current file. (Protip: this is awesome.) -(global-set-key (kbd "C-x C-i") 'imenu) - -;; Ace-jump-mode -(global-set-key (kbd "M-j") 'ace-jump-char-mode) - -;; Jump to next occurence of char -(global-set-key (kbd "M-m") 'iy-go-to-char) - -;; Window switching. (C-x o goes to the next window) -(windmove-default-keybindings) ;; Shift+direction - -;; Start eshell or switch to it if it's active. -(global-set-key (kbd "C-x m") 'eshell) - -;; Start a new eshell even if one is active. -(global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) - -;; Eval sexp and replace it with result -(global-set-key (kbd "C-c e") 'esk-eval-and-replace) - -;; Start a regular shell if you prefer that. -(global-set-key (kbd "C-x C-m") 'shell) - -;; So good! -(global-set-key (kbd "C-c g") 'magit-status) - -;; Add a fullscreen toggle -(global-set-key (kbd "M-RET") 'toggle-frame-fullscreen) - -;; Replace standard goto-line with goto-line-with-feedback -(global-set-key (kbd "M-g g") 'goto-line-with-feedback) diff --git a/emacs.d/init-custom.el b/emacs.d/init-custom.el deleted file mode 100644 index 2b2916143f..0000000000 --- a/emacs.d/init-custom.el +++ /dev/null @@ -1,31 +0,0 @@ -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(custom-safe-themes - (quote - ("854dc57026d3226addcc46b2b460034a74609edbd9c14e626769ac724b10fcf5" "8eaa3bce3c618cd81a318fcf2d28c1cd21278531f028feb53186f6387547dfb4" "ea0c5df0f067d2e3c0f048c1f8795af7b873f5014837feb0a7c8317f34417b04" "a234f91f9be6ed40f6ce0e94dce5cea1b9f1ccec2b9ccd42bb71c499867a3fcc" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "d6a00ef5e53adf9b6fe417d2b4404895f26210c52bb8716971be106550cea257" default))) - '(erc-modules - (quote - (autojoin button completion dcc irccontrols list log match menu move-to-prompt netsplit networks noncommands notifications readonly ring scrolltobottom stamp track))) - '(haskell-mode-hook - (quote - (capitalized-words-mode turn-on-haskell-decl-scan turn-on-haskell-doc turn-on-hi2))) - '(it-mode-google-cmd "/usr/local/share/python/google") - '(ns-alternate-modifier (quote none)) - '(ns-command-modifier (quote meta))) -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(rainbow-delimiters-depth-1-face ((t (:foreground "#2aa198")))) - '(rainbow-delimiters-depth-2-face ((t (:foreground "#b58900")))) - '(rainbow-delimiters-depth-3-face ((t (:foreground "#268bd2")))) - '(rainbow-delimiters-depth-4-face ((t (:foreground "#dc322f")))) - '(rainbow-delimiters-depth-5-face ((t (:foreground "#859900")))) - '(rainbow-delimiters-depth-6-face ((t (:foreground "#268bd2")))) - '(rainbow-delimiters-depth-7-face ((t (:foreground "#cb4b16")))) - '(rainbow-delimiters-depth-8-face ((t (:foreground "#d33682")))) - '(rainbow-delimiters-depth-9-face ((t (:foreground "#839496"))))) diff --git a/emacs.d/init-eshell.el b/emacs.d/init-eshell.el deleted file mode 100644 index 239a9980ce..0000000000 --- a/emacs.d/init-eshell.el +++ /dev/null @@ -1,98 +0,0 @@ -;; EShell configuration - -(require 'eshell) - -;; Generic settings -;; Hide banner message ... -(setq eshell-banner-message "") - -(defvar home-dir) -(setq home-dir (expand-file-name "~")) - -(defun eshell-mode-hook-setup () - "Sets up EShell when it is loaded" - - (setq eshell-path-env (concat - "/usr/local/bin:" - (concat home-dir "/bin:") - "/usr/local/share/python:" - eshell-path-env)) - - (setenv "PATH" eshell-path-env)) - -(add-hook 'eshell-mode-hook 'eshell-mode-hook-setup) - -;; Prompt configuration - -(defun clean-pwd (path) - "Turns a path of the form /foo/bar/baz into /f/b/baz - (inspired by fish shell)" - (message path) - (let* ((current-dir (split-string path "/")) - (cdir (last current-dir)) - (head (butlast current-dir))) - (concat (mapconcat (lambda (s) - (if (string= "" s) nil - (substring s 0 1))) - head - "/") - (if head "/" nil) - (car cdir)))) - -(setq eshell-pwd-convert-function - (lambda (path) - (clean-pwd (replace-regexp-in-string - home-dir - "~" - path)))) - -(defun vcprompt (&optional args) - "Call the external vcprompt command with optional arguments. - VCPrompt" - (replace-regexp-in-string - "\n" "" - (shell-command-to-string (concat "vcprompt" args)))) - -(defmacro with-face (str &rest properties) - `(propertize ,str 'face (list ,@properties))) - -(defun prompt-f () - "My EShell prompt displaying VC info and such" - (concat - (with-face (concat (eshell/pwd) " ") :foreground "#96a6c8") - (with-face (vcprompt " -f \"(%s:%b%a%m) \"") :foreground "#5f627f") - (if (= 0 (user-uid)) - (with-face "#" :foreground "#f43841") - (with-face "$" :foreground "#73c936")) - (with-face " " :foreground "#95a99f"))) - - -(setq eshell-prompt-function 'prompt-f) -(setq eshell-highlight-prompt nil) -(setq eshell-prompt-regexp "^.+? \\((\\(git\\|svn\\|hg\\|darcs\\|cvs\\|bzr\\):.+?) \\)?[$#] ") - -;; Ignore version control folders in autocompletion -(setq eshell-cmpl-cycle-completions nil - eshell-save-history-on-exit t - eshell-cmpl-dir-ignore "\\`\\(\\.\\.?\\|CVS\\|\\.svn\\|\\.git\\)/\\'") - -;; Load some EShell extensions -(eval-after-load 'esh-opt - '(progn - (require 'em-term) - (require 'em-cmpl) - ;; More visual commands! - (add-to-list 'eshell-visual-commands "ssh") - (add-to-list 'eshell-visual-commands "tail") - (add-to-list 'eshell-visual-commands "sl"))) - -(setq eshell-directory-name "~/.config/eshell/") - -;; EShell functions that come in handy - -;; clear in eshell -(defun eshell/clear () - "clear the eshell buffer." - (interactive) - (let ((inhibit-read-only t)) - (erase-buffer))) diff --git a/emacs.d/init-functions.el b/emacs.d/init-functions.el deleted file mode 100644 index dfdfee0838..0000000000 --- a/emacs.d/init-functions.el +++ /dev/null @@ -1,130 +0,0 @@ -;; A few handy functions I use in init.el (or not, but they're nice to -;; have) - -(defun custom-download-theme (url filename) - "Downloads a theme through HTTP and places it in ~/.emacs.d/themes" - - ;; Ensure the directory exists - (unless (file-exists-p "~/.emacs.d/themes") - (make-directory "~/.emacs.d/themes")) - - ;; Adds the themes folder to the theme load path (if not already - ;; there) - (unless (member "~/.emacs.d/themes" custom-theme-load-path) - (add-to-list 'custom-theme-load-path "~/.emacs.d/themes")) - - ;; Download file if it doesn't exist. - - (let ((file - (concat "~/.emacs.d/themes/" filename))) - (unless (file-exists-p file) - (url-copy-file url file)))) - -(defun custom-download-script (url filename) - "Downloads an Elisp script, places it in ~/.emacs/other and then loads it" - - ;; Ensure the directory exists - (unless (file-exists-p "~/.emacs.d/other") - (make-directory "~/.emacs.d/other")) - - ;; Download file if it doesn't exist. - (let ((file - (concat "~/.emacs.d/" filename))) - (unless (file-exists-p file) - (url-copy-file url file)) - - (load file))) - -;; This clones a git repository to 'foldername in .emacs.d -;; if there isn't already a folder with that name -(defun custom-clone-git (url foldername) - "Clones a git repository to .emacs.d/foldername" - (let ((fullpath (concat "~/.emacs.d/" foldername))) - (unless (file-exists-p fullpath) - (shell-command (concat "git clone " url " " fullpath)))) - ) - -;; These come from magnars, he's got some awesome things. - -(defun goto-line-with-feedback () - "Show line numbers temporarily, while prompting for the line number input" - (interactive) - (unwind-protect - (progn - (linum-mode 1) - (call-interactively 'goto-line)) - (linum-mode -1))) - -(defun rotate-windows () - "Rotate your windows" - (interactive) - (cond ((not (> (count-windows)1)) - (message "You can't rotate a single window!")) - (t - (setq i 1) - (setq numWindows (count-windows)) - (while (< i numWindows) - (let* ( - (w1 (elt (window-list) i)) - (w2 (elt (window-list) (+ (% i numWindows) 1))) - - (b1 (window-buffer w1)) - (b2 (window-buffer w2)) - - (s1 (window-start w1)) - (s2 (window-start w2)) - ) - (set-window-buffer w1 b2) - (set-window-buffer w2 b1) - (set-window-start w1 s2) - (set-window-start w2 s1) - (setq i (1+ i))))))) - -(defun untabify-buffer () - (interactive) - (untabify (point-min) (point-max))) - -(defun indent-buffer () - (interactive) - (indent-region (point-min) (point-max))) - -(defun cleanup-buffer () - "Perform a bunch of operations on the whitespace content of a buffer. -Including indent-buffer, which should not be called automatically on save." - (interactive) - (untabify-buffer) - (delete-trailing-whitespace) - (indent-buffer)) - -;; These come from the emacs starter kit -(defun esk-pretty-lambdas () - (font-lock-add-keywords - nil `(("(?\\(lambda\\>\\)" - (0 (progn (compose-region (match-beginning 1) (match-end 1) - ,(make-char 'greek-iso8859-7 107)) - nil)))))) - -(defun esk-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))))) - -(defun esk-add-watchwords () - (font-lock-add-keywords - nil '(("\\<\\(FIX\\(ME\\)?\\|TODO\\|HACK\\|REFACTOR\\|NOCOMMIT\\)" - 1 font-lock-warning-face t)))) - -(defun esk-sudo-edit (&optional arg) - (interactive "p") - (if (or arg (not buffer-file-name)) - (find-file (concat "/sudo:root@localhost:" (ido-read-file-name "File: "))) - (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))) - -(defun speak (m &optional voice) - (shell-command (if 'voice (concat "say -v " voice " \"" m "\"") - (concat "say " m)))) diff --git a/emacs.d/init-mail.el b/emacs.d/init-mail.el deleted file mode 100644 index 982b78156f..0000000000 --- a/emacs.d/init-mail.el +++ /dev/null @@ -1,18 +0,0 @@ -(require 'gnus) - -(setq gnus-select-method '(nnimap "gmail" - (nnimap-address "imap.gmail.com") - (nnimap-server-port 993) - (nnimap-stream ssl))) - -(setq message-send-mail-function 'smtpmail-send-it - smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil)) - smtpmail-auth-credentials '(("smtp.gmail.com" 587 "vincent@spotify.com" nil)) - smtpmail-default-smtp-server "smtp.gmail.com" - smtpmail-smtp-server "smtp.gmail.com" - smtpmail-smtp-service 587 - smtpmail-local-domain "spotify.com") - - ;; Make Gnus NOT ignore [Gmail] mailboxes -(setq gnus-ignored-newsgroups "^to\\.\\|^[0-9. ]+\\( \\|$\\)\\|^[\"]\"[#'()]") - diff --git a/emacs.d/init-modes.el b/emacs.d/init-modes.el deleted file mode 100644 index 3e9cff9996..0000000000 --- a/emacs.d/init-modes.el +++ /dev/null @@ -1,51 +0,0 @@ -(mapc 'require '(projectile hi2)) -;; Initializes modes I use. - -(add-hook 'prog-mode-hook 'esk-pretty-lambdas) -(add-hook 'prog-mode-hook 'esk-add-watchwords) -(add-hook 'prog-mode-hook 'idle-highlight-mode) - -;; Configure markdown-mode -(autoload 'markdown-mode "markdown-mode" - "Major mode for editing Markdown files" t) -(add-to-list 'auto-mode-alist '("\\.txt\\'" . markdown-mode)) -(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) -(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) - -;; Add keybindings to move nested blocks with C-, rsp. C-. -(define-key haskell-mode-map (kbd "C-,") 'haskell-move-nested-left) -(define-key haskell-mode-map (kbd "C-.") 'haskell-move-nested-right) - -;; Configure nrepl (Clojure REPL) and clojure-mode -;; Paredit in clojure - -(add-hook 'clojure-mode-hook 'paredit-mode) - -;; eldoc in clojure -(add-hook 'nrepl-interaction-mode-hook - 'nrepl-turn-on-eldoc-mode) - -;; Don't annoy me -(setq nrepl-hide-special-buffers t) -(setq nrepl-popup-stacktraces nil) - -;; Enable projectile for all things programming -(add-hook 'prog-mode-hook 'projectile-on) - -;; Enable rainbow-delimiters for all things programming -(add-hook 'prog-mode-hook 'rainbow-delimiters-mode) - -;; Enable Paredit in Emacs Lisp mode -(add-hook 'emacs-lisp-mode-hook 'paredit-mode) - -;; Always highlight matching brackets -(show-paren-mode 1) - -;; Undo-Tree at all times! -(undo-tree-mode) - -;; Keep track of recent files -(recentf-mode) - -;; Enable Nyan mode -(nyan-mode 1) diff --git a/emacs.d/init-settings.el b/emacs.d/init-settings.el deleted file mode 100644 index e2c7e6249b..0000000000 --- a/emacs.d/init-settings.el +++ /dev/null @@ -1,210 +0,0 @@ -;; ## Generic settings ## - -(tool-bar-mode -1) -(scroll-bar-mode -1) - -(flx-ido-mode 1) -(setq ido-use-faces nil) -(setq gc-cons-threshold 20000000) - -;;; Code: - -(add-to-list 'exec-path "/usr/local/bin") -(add-to-list 'exec-path (expand-file-name "~/bin")) -(add-to-list 'exec-path "/Applications/Racket/bin") - - -(when window-system - (setq frame-title-format '(buffer-file-name "%f" ("%b"))) - (tooltip-mode -1) - (mouse-wheel-mode t) - (blink-cursor-mode -1)) - -;; can't do it at launch or emacsclient won't always honor it -(add-hook 'before-make-frame-hook 'esk-turn-off-tool-bar) - -(setq visible-bell t - inhibit-startup-message t - color-theme-is-global t - sentence-end-double-space nil - shift-select-mode nil - mouse-yank-at-point t - uniquify-buffer-name-style 'forward - whitespace-style '(face trailing lines-tail tabs) - whitespace-line-column 80 - ediff-window-setup-function 'ediff-setup-windows-plain - oddmuse-directory (concat user-emacs-directory "oddmuse") - save-place-file (concat user-emacs-directory "places") - backup-directory-alist `(("." . ,(concat user-emacs-directory "backups"))) - diff-switches "-u") - -(setq smex-save-file (concat user-emacs-directory ".smex-items")) -(smex-initialize) -(global-set-key (kbd "M-x") 'smex) - -(add-to-list 'safe-local-variable-values '(lexical-binding . t)) -(add-to-list 'safe-local-variable-values '(whitespace-line-column . 80)) - -;; ido-mode is like magic pixie dust! -(ido-mode t) -(ido-ubiquitous t) -(setq ido-enable-prefix nil - ido-enable-flex-matching t - ido-auto-merge-work-directories-length nil - ido-create-new-buffer 'always - ido-use-filename-at-point 'guess - ido-use-virtual-buffers t - ido-handle-duplicate-virtual-buffers 2 - ido-max-prospects 10) - -;; Swedish! -(set-language-environment 'Swedish) - -(require 'ffap) -(defvar ffap-c-commment-regexp "^/\\*+" - "Matches an opening C-style comment, like \"/***\".") - -(defadvice ffap-file-at-point (after avoid-c-comments activate) - "Don't return paths like \"/******\" unless they actually exist. - -This fixes the bug where ido would try to suggest a C-style -comment as a filename." - (ignore-errors - (when (and ad-return-value - (string-match-p ffap-c-commment-regexp - ad-return-value) - (not (ffap-file-exists-string ad-return-value))) - (setq ad-return-value nil)))) - -(defalias 'yes-or-no-p 'y-or-n-p) -(defalias 'auto-tail-revert-mode 'tail-mode) - -;; Hippie expand: at times perhaps too hip -(eval-after-load 'hippie-exp - '(progn - (dolist (f '(try-expand-line try-expand-list try-complete-file-name-partially)) - (delete f hippie-expand-try-functions-list)) - - ;; Add this back in at the end of the list. - (add-to-list 'hippie-expand-try-functions-list 'try-complete-file-name-partially t))) - -;; ## Look and feel ## - -;; Themes! I download and install the ones I like and default the one -;; I currently like most. This changes a lot because I hate -;; everything. (It's in my nature, don't judge) -(custom-download-theme "https://raw.github.com/owainlewis/emacs-color-themes/master/themes/hickey-theme.el" - "hickey-theme.el") - -(custom-download-theme "https://raw.github.com/rexim/gruber-darker-theme/master/gruber-darker-theme.el" - "gruber-darker-theme.el") - -(load-theme 'gruber-darker t) - -(global-hl-line-mode -1) - -(set-default-font "Source Code Pro 13") - -;; Don't make the nyan cat too long ... I have other stuff in the mode -;; bar as well! -(set-variable 'nyan-bar-length 15) -;; Not the real deal without this ... -(set-variable 'nyan-wavy-trail t) - -(setq linum-format (lambda (line) - (propertize - (format (concat " %" - (number-to-string - (length (number-to-string - (line-number-at-pos (point-max))))) - "d ") - line) - 'face 'linum))) - -;; Hiding JOIN, QUIT, PART -(setq erc-hide-list '("JOIN" "PART" "QUIT")) - -(eval-after-load 'diff-mode - '(progn - (set-face-foreground 'diff-added "green4") - (set-face-foreground 'diff-removed "red3"))) - -(eval-after-load 'magit - '(progn - (set-face-foreground 'magit-diff-add "green4") - (set-face-foreground 'magit-diff-del "red3"))) - -;; ## Mac specific settings ## - -;; Enable mouse support on OS X -(unless window-system - (require 'mouse) - (xterm-mouse-mode t) - (global-set-key [mouse-4] '(lambda () - (interactive) - (scroll-down 1))) - (global-set-key [mouse-5] '(lambda () - (interactive) - (scroll-up 1))) - (defun track-mouse (e)) - - (setq mouse-sel-mode t) -) - -;; Use clipboard properly -(setq x-select-enable-clipboard t) - -;; Settings for Emacs.app (Cocoa Emacs) -;; Menu bar doesn't take up additional space, so lets use it. -(menu-bar-mode 1) - -;; Don't use Apple's native fullscreen (FIXME: Change with Mavericks) -(setq ns-use-native-fullscreen nil) - -(defun toggle-native-fullscreen () - "Toggles between native and non-native OS X fullscreen" - (interactive) - (setq ns-use-native-fullscreen (not ns-use-native-fullscreen))) - -;; ## Navigation and key bindings ## - -;; Navigate windows with M- -(windmove-default-keybindings 'meta) -(setq windmove-wrap-around t) - -;; Load ace-jump-mode -(autoload - 'ace-jump-mode - "ace-jump-mode" - "Emacs quick move minor mode" - ) - -(define-key global-map [?] 'ace-jump-mode) - -;; Quick jump back -(autoload - 'ace-jump-mode-pop-mark - "ace-jump-mode" - "Ace jump back:-)" - ) - -(eval-after-load "ace-jump-mode" - '(ace-jump-mode-enable-mark-sync)) -(define-key global-map (kbd "C-x ö") 'ace-jump-mode-pop-mark) - -;; Keep your backup files in tmp, emacs! -(setq backup-directory-alist - `((".*" . ,temporary-file-directory))) -(setq auto-save-file-name-transforms - `((".*" ,temporary-file-directory t))) - -;; Eshell -;; Start/join -(global-set-key (kbd "C-x m") 'eshell) -;; Always start -(global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) - -;; Git -(global-set-key (kbd "C-c g") 'magit-status) - -(remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function) diff --git a/emacs.d/init.el b/emacs.d/init.el deleted file mode 100644 index 4551a7b9ad..0000000000 --- a/emacs.d/init.el +++ /dev/null @@ -1,84 +0,0 @@ -;; Configure package manager -(require 'package) - -;; Add Marmalade repo -(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/")) - -;; ... and melpa. Melpa packages that exist on marmalade will have -;; precendence. -(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) - -(package-initialize) - -(when (not package-archive-contents) - (package-refresh-contents)) - -(defvar my-pkgs - '(ace-jump-mode - browse-kill-ring - clojure-mode - flycheck - flx-ido - haskell-mode - hi2 - idle-highlight-mode - ido-ubiquitous - leuven-theme - magit - magit - markdown-mode - multiple-cursors - nrepl - paredit - projectile - rainbow-delimiters - rainbow-mode - smex - undo-tree - geiser - quack) - "A list of packages to install at launch.") - -(dolist (p my-pkgs) - (when (not (package-installed-p p)) - (package-install p))) - - -(load "~/.emacs.d/init-functions.el") - -(add-to-list 'load-path "~/.emacs.d/scripts/") - -(setq custom-file "~/.emacs.d/init-custom.el") -(load custom-file) - -;; Other packages that need manual installation -(custom-download-script "https://raw.github.com/dimitri/switch-window/master/switch-window.el" - "switch-window.el") - -(custom-download-script "https://raw.github.com/doitian/iy-go-to-char/master/iy-go-to-char.el" - "goto-char.el") - -;; NYAN CAT! -(custom-clone-git "https://github.com/TeMPOraL/nyan-mode" "nyan-mode") -(load "~/.emacs.d/nyan-mode/nyan-mode.el") - -(load "~/.emacs.d/init-settings.el") -(load "~/.emacs.d/init-modes.el") -(load "~/.emacs.d/init-bindings.el") -(load "~/.emacs.d/init-eshell.el") - -;; A file with machine specific settings -(load "~/.emacs.d/init-local.el") - -;; IRC configuration (erc) -;; Actual servers and such are loaded from irc.el -(load "~/.emacs.d/irc") - -;; Load magnars' string manipulation library -(require 's) - -;; Seed RNG -(random t) - -;; Start server for emacsclient -(server-start) diff --git a/fish/config.fish b/fish/config.fish deleted file mode 100644 index 1fdeb0e92f..0000000000 --- a/fish/config.fish +++ /dev/null @@ -1,23 +0,0 @@ -function fish_prompt - set_color magenta - echo -n (vcprompt -f "(%s:%b%a%m)") - set_color cyan - echo -n '> ' -end - -function fish_right_prompt - set_color --bold yellow - echo -n '[' - set_color --bold blue - echo -n (prompt_pwd) - set_color --bold yellow - echo -n ']' -end - -set -gx EDITOR "emacsclient -n -create-frame" -set -gx ALTERNATE_EDITOR emacs -set -gx VISUAL emacsclient - -set fish_greeting "" - -set PATH /usr/local/share/python /usr/local/bin ~/Library/Haskell/bin ~/bin/ /Users/vincent/Source/management-scripts/google-apps/ $PATH diff --git a/fish/functions/edit.fish b/fish/functions/edit.fish deleted file mode 100644 index 61bf373456..0000000000 --- a/fish/functions/edit.fish +++ /dev/null @@ -1,3 +0,0 @@ -function edit - emacsclient -no-wait -create-frame $argv -end \ No newline at end of file diff --git a/fish/functions/runhoogle.fish b/fish/functions/runhoogle.fish deleted file mode 100644 index 45160062e3..0000000000 --- a/fish/functions/runhoogle.fish +++ /dev/null @@ -1,5 +0,0 @@ -function runhoogle - cd ~/.hoogle - screen -dm hoogle server -p 4000 - cd - -end diff --git a/fish/functions/runirc.fish b/fish/functions/runirc.fish deleted file mode 100644 index d162342683..0000000000 --- a/fish/functions/runirc.fish +++ /dev/null @@ -1,3 +0,0 @@ -function runirc - screen -S irssi irssi -end diff --git a/init-bindings.el b/init-bindings.el new file mode 100644 index 0000000000..2593ddd6d0 --- /dev/null +++ b/init-bindings.el @@ -0,0 +1,46 @@ +;; Various keybindings, most of them taken from starter-kit-bindings + +;; Font size +(define-key global-map (kbd "C-+") 'text-scale-increase) +(define-key global-map (kbd "C--") 'text-scale-decrease) + +;; Use regex searches by default. +(global-set-key (kbd "C-s") 'isearch-forward-regexp) +(global-set-key (kbd "\C-r") 'isearch-backward-regexp) +(global-set-key (kbd "M-%") 'query-replace-regexp) +(global-set-key (kbd "C-M-s") 'isearch-forward) +(global-set-key (kbd "C-M-r") 'isearch-backward) +(global-set-key (kbd "C-M-%") 'query-replace) + +;; Jump to a definition in the current file. (Protip: this is awesome.) +(global-set-key (kbd "C-x C-i") 'imenu) + +;; Ace-jump-mode +(global-set-key (kbd "M-j") 'ace-jump-char-mode) + +;; Jump to next occurence of char +(global-set-key (kbd "M-m") 'iy-go-to-char) + +;; Window switching. (C-x o goes to the next window) +(windmove-default-keybindings) ;; Shift+direction + +;; Start eshell or switch to it if it's active. +(global-set-key (kbd "C-x m") 'eshell) + +;; Start a new eshell even if one is active. +(global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) + +;; Eval sexp and replace it with result +(global-set-key (kbd "C-c e") 'esk-eval-and-replace) + +;; Start a regular shell if you prefer that. +(global-set-key (kbd "C-x C-m") 'shell) + +;; So good! +(global-set-key (kbd "C-c g") 'magit-status) + +;; Add a fullscreen toggle +(global-set-key (kbd "M-RET") 'toggle-frame-fullscreen) + +;; Replace standard goto-line with goto-line-with-feedback +(global-set-key (kbd "M-g g") 'goto-line-with-feedback) diff --git a/init-custom.el b/init-custom.el new file mode 100644 index 0000000000..2b2916143f --- /dev/null +++ b/init-custom.el @@ -0,0 +1,31 @@ +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(custom-safe-themes + (quote + ("854dc57026d3226addcc46b2b460034a74609edbd9c14e626769ac724b10fcf5" "8eaa3bce3c618cd81a318fcf2d28c1cd21278531f028feb53186f6387547dfb4" "ea0c5df0f067d2e3c0f048c1f8795af7b873f5014837feb0a7c8317f34417b04" "a234f91f9be6ed40f6ce0e94dce5cea1b9f1ccec2b9ccd42bb71c499867a3fcc" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "d6a00ef5e53adf9b6fe417d2b4404895f26210c52bb8716971be106550cea257" default))) + '(erc-modules + (quote + (autojoin button completion dcc irccontrols list log match menu move-to-prompt netsplit networks noncommands notifications readonly ring scrolltobottom stamp track))) + '(haskell-mode-hook + (quote + (capitalized-words-mode turn-on-haskell-decl-scan turn-on-haskell-doc turn-on-hi2))) + '(it-mode-google-cmd "/usr/local/share/python/google") + '(ns-alternate-modifier (quote none)) + '(ns-command-modifier (quote meta))) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(rainbow-delimiters-depth-1-face ((t (:foreground "#2aa198")))) + '(rainbow-delimiters-depth-2-face ((t (:foreground "#b58900")))) + '(rainbow-delimiters-depth-3-face ((t (:foreground "#268bd2")))) + '(rainbow-delimiters-depth-4-face ((t (:foreground "#dc322f")))) + '(rainbow-delimiters-depth-5-face ((t (:foreground "#859900")))) + '(rainbow-delimiters-depth-6-face ((t (:foreground "#268bd2")))) + '(rainbow-delimiters-depth-7-face ((t (:foreground "#cb4b16")))) + '(rainbow-delimiters-depth-8-face ((t (:foreground "#d33682")))) + '(rainbow-delimiters-depth-9-face ((t (:foreground "#839496"))))) diff --git a/init-eshell.el b/init-eshell.el new file mode 100644 index 0000000000..239a9980ce --- /dev/null +++ b/init-eshell.el @@ -0,0 +1,98 @@ +;; EShell configuration + +(require 'eshell) + +;; Generic settings +;; Hide banner message ... +(setq eshell-banner-message "") + +(defvar home-dir) +(setq home-dir (expand-file-name "~")) + +(defun eshell-mode-hook-setup () + "Sets up EShell when it is loaded" + + (setq eshell-path-env (concat + "/usr/local/bin:" + (concat home-dir "/bin:") + "/usr/local/share/python:" + eshell-path-env)) + + (setenv "PATH" eshell-path-env)) + +(add-hook 'eshell-mode-hook 'eshell-mode-hook-setup) + +;; Prompt configuration + +(defun clean-pwd (path) + "Turns a path of the form /foo/bar/baz into /f/b/baz + (inspired by fish shell)" + (message path) + (let* ((current-dir (split-string path "/")) + (cdir (last current-dir)) + (head (butlast current-dir))) + (concat (mapconcat (lambda (s) + (if (string= "" s) nil + (substring s 0 1))) + head + "/") + (if head "/" nil) + (car cdir)))) + +(setq eshell-pwd-convert-function + (lambda (path) + (clean-pwd (replace-regexp-in-string + home-dir + "~" + path)))) + +(defun vcprompt (&optional args) + "Call the external vcprompt command with optional arguments. + VCPrompt" + (replace-regexp-in-string + "\n" "" + (shell-command-to-string (concat "vcprompt" args)))) + +(defmacro with-face (str &rest properties) + `(propertize ,str 'face (list ,@properties))) + +(defun prompt-f () + "My EShell prompt displaying VC info and such" + (concat + (with-face (concat (eshell/pwd) " ") :foreground "#96a6c8") + (with-face (vcprompt " -f \"(%s:%b%a%m) \"") :foreground "#5f627f") + (if (= 0 (user-uid)) + (with-face "#" :foreground "#f43841") + (with-face "$" :foreground "#73c936")) + (with-face " " :foreground "#95a99f"))) + + +(setq eshell-prompt-function 'prompt-f) +(setq eshell-highlight-prompt nil) +(setq eshell-prompt-regexp "^.+? \\((\\(git\\|svn\\|hg\\|darcs\\|cvs\\|bzr\\):.+?) \\)?[$#] ") + +;; Ignore version control folders in autocompletion +(setq eshell-cmpl-cycle-completions nil + eshell-save-history-on-exit t + eshell-cmpl-dir-ignore "\\`\\(\\.\\.?\\|CVS\\|\\.svn\\|\\.git\\)/\\'") + +;; Load some EShell extensions +(eval-after-load 'esh-opt + '(progn + (require 'em-term) + (require 'em-cmpl) + ;; More visual commands! + (add-to-list 'eshell-visual-commands "ssh") + (add-to-list 'eshell-visual-commands "tail") + (add-to-list 'eshell-visual-commands "sl"))) + +(setq eshell-directory-name "~/.config/eshell/") + +;; EShell functions that come in handy + +;; clear in eshell +(defun eshell/clear () + "clear the eshell buffer." + (interactive) + (let ((inhibit-read-only t)) + (erase-buffer))) diff --git a/init-functions.el b/init-functions.el new file mode 100644 index 0000000000..dfdfee0838 --- /dev/null +++ b/init-functions.el @@ -0,0 +1,130 @@ +;; A few handy functions I use in init.el (or not, but they're nice to +;; have) + +(defun custom-download-theme (url filename) + "Downloads a theme through HTTP and places it in ~/.emacs.d/themes" + + ;; Ensure the directory exists + (unless (file-exists-p "~/.emacs.d/themes") + (make-directory "~/.emacs.d/themes")) + + ;; Adds the themes folder to the theme load path (if not already + ;; there) + (unless (member "~/.emacs.d/themes" custom-theme-load-path) + (add-to-list 'custom-theme-load-path "~/.emacs.d/themes")) + + ;; Download file if it doesn't exist. + + (let ((file + (concat "~/.emacs.d/themes/" filename))) + (unless (file-exists-p file) + (url-copy-file url file)))) + +(defun custom-download-script (url filename) + "Downloads an Elisp script, places it in ~/.emacs/other and then loads it" + + ;; Ensure the directory exists + (unless (file-exists-p "~/.emacs.d/other") + (make-directory "~/.emacs.d/other")) + + ;; Download file if it doesn't exist. + (let ((file + (concat "~/.emacs.d/" filename))) + (unless (file-exists-p file) + (url-copy-file url file)) + + (load file))) + +;; This clones a git repository to 'foldername in .emacs.d +;; if there isn't already a folder with that name +(defun custom-clone-git (url foldername) + "Clones a git repository to .emacs.d/foldername" + (let ((fullpath (concat "~/.emacs.d/" foldername))) + (unless (file-exists-p fullpath) + (shell-command (concat "git clone " url " " fullpath)))) + ) + +;; These come from magnars, he's got some awesome things. + +(defun goto-line-with-feedback () + "Show line numbers temporarily, while prompting for the line number input" + (interactive) + (unwind-protect + (progn + (linum-mode 1) + (call-interactively 'goto-line)) + (linum-mode -1))) + +(defun rotate-windows () + "Rotate your windows" + (interactive) + (cond ((not (> (count-windows)1)) + (message "You can't rotate a single window!")) + (t + (setq i 1) + (setq numWindows (count-windows)) + (while (< i numWindows) + (let* ( + (w1 (elt (window-list) i)) + (w2 (elt (window-list) (+ (% i numWindows) 1))) + + (b1 (window-buffer w1)) + (b2 (window-buffer w2)) + + (s1 (window-start w1)) + (s2 (window-start w2)) + ) + (set-window-buffer w1 b2) + (set-window-buffer w2 b1) + (set-window-start w1 s2) + (set-window-start w2 s1) + (setq i (1+ i))))))) + +(defun untabify-buffer () + (interactive) + (untabify (point-min) (point-max))) + +(defun indent-buffer () + (interactive) + (indent-region (point-min) (point-max))) + +(defun cleanup-buffer () + "Perform a bunch of operations on the whitespace content of a buffer. +Including indent-buffer, which should not be called automatically on save." + (interactive) + (untabify-buffer) + (delete-trailing-whitespace) + (indent-buffer)) + +;; These come from the emacs starter kit +(defun esk-pretty-lambdas () + (font-lock-add-keywords + nil `(("(?\\(lambda\\>\\)" + (0 (progn (compose-region (match-beginning 1) (match-end 1) + ,(make-char 'greek-iso8859-7 107)) + nil)))))) + +(defun esk-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))))) + +(defun esk-add-watchwords () + (font-lock-add-keywords + nil '(("\\<\\(FIX\\(ME\\)?\\|TODO\\|HACK\\|REFACTOR\\|NOCOMMIT\\)" + 1 font-lock-warning-face t)))) + +(defun esk-sudo-edit (&optional arg) + (interactive "p") + (if (or arg (not buffer-file-name)) + (find-file (concat "/sudo:root@localhost:" (ido-read-file-name "File: "))) + (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))) + +(defun speak (m &optional voice) + (shell-command (if 'voice (concat "say -v " voice " \"" m "\"") + (concat "say " m)))) diff --git a/init-mail.el b/init-mail.el new file mode 100644 index 0000000000..982b78156f --- /dev/null +++ b/init-mail.el @@ -0,0 +1,18 @@ +(require 'gnus) + +(setq gnus-select-method '(nnimap "gmail" + (nnimap-address "imap.gmail.com") + (nnimap-server-port 993) + (nnimap-stream ssl))) + +(setq message-send-mail-function 'smtpmail-send-it + smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil)) + smtpmail-auth-credentials '(("smtp.gmail.com" 587 "vincent@spotify.com" nil)) + smtpmail-default-smtp-server "smtp.gmail.com" + smtpmail-smtp-server "smtp.gmail.com" + smtpmail-smtp-service 587 + smtpmail-local-domain "spotify.com") + + ;; Make Gnus NOT ignore [Gmail] mailboxes +(setq gnus-ignored-newsgroups "^to\\.\\|^[0-9. ]+\\( \\|$\\)\\|^[\"]\"[#'()]") + diff --git a/init-modes.el b/init-modes.el new file mode 100644 index 0000000000..3e9cff9996 --- /dev/null +++ b/init-modes.el @@ -0,0 +1,51 @@ +(mapc 'require '(projectile hi2)) +;; Initializes modes I use. + +(add-hook 'prog-mode-hook 'esk-pretty-lambdas) +(add-hook 'prog-mode-hook 'esk-add-watchwords) +(add-hook 'prog-mode-hook 'idle-highlight-mode) + +;; Configure markdown-mode +(autoload 'markdown-mode "markdown-mode" + "Major mode for editing Markdown files" t) +(add-to-list 'auto-mode-alist '("\\.txt\\'" . markdown-mode)) +(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) +(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) + +;; Add keybindings to move nested blocks with C-, rsp. C-. +(define-key haskell-mode-map (kbd "C-,") 'haskell-move-nested-left) +(define-key haskell-mode-map (kbd "C-.") 'haskell-move-nested-right) + +;; Configure nrepl (Clojure REPL) and clojure-mode +;; Paredit in clojure + +(add-hook 'clojure-mode-hook 'paredit-mode) + +;; eldoc in clojure +(add-hook 'nrepl-interaction-mode-hook + 'nrepl-turn-on-eldoc-mode) + +;; Don't annoy me +(setq nrepl-hide-special-buffers t) +(setq nrepl-popup-stacktraces nil) + +;; Enable projectile for all things programming +(add-hook 'prog-mode-hook 'projectile-on) + +;; Enable rainbow-delimiters for all things programming +(add-hook 'prog-mode-hook 'rainbow-delimiters-mode) + +;; Enable Paredit in Emacs Lisp mode +(add-hook 'emacs-lisp-mode-hook 'paredit-mode) + +;; Always highlight matching brackets +(show-paren-mode 1) + +;; Undo-Tree at all times! +(undo-tree-mode) + +;; Keep track of recent files +(recentf-mode) + +;; Enable Nyan mode +(nyan-mode 1) diff --git a/init-settings.el b/init-settings.el new file mode 100644 index 0000000000..e2c7e6249b --- /dev/null +++ b/init-settings.el @@ -0,0 +1,210 @@ +;; ## Generic settings ## + +(tool-bar-mode -1) +(scroll-bar-mode -1) + +(flx-ido-mode 1) +(setq ido-use-faces nil) +(setq gc-cons-threshold 20000000) + +;;; Code: + +(add-to-list 'exec-path "/usr/local/bin") +(add-to-list 'exec-path (expand-file-name "~/bin")) +(add-to-list 'exec-path "/Applications/Racket/bin") + + +(when window-system + (setq frame-title-format '(buffer-file-name "%f" ("%b"))) + (tooltip-mode -1) + (mouse-wheel-mode t) + (blink-cursor-mode -1)) + +;; can't do it at launch or emacsclient won't always honor it +(add-hook 'before-make-frame-hook 'esk-turn-off-tool-bar) + +(setq visible-bell t + inhibit-startup-message t + color-theme-is-global t + sentence-end-double-space nil + shift-select-mode nil + mouse-yank-at-point t + uniquify-buffer-name-style 'forward + whitespace-style '(face trailing lines-tail tabs) + whitespace-line-column 80 + ediff-window-setup-function 'ediff-setup-windows-plain + oddmuse-directory (concat user-emacs-directory "oddmuse") + save-place-file (concat user-emacs-directory "places") + backup-directory-alist `(("." . ,(concat user-emacs-directory "backups"))) + diff-switches "-u") + +(setq smex-save-file (concat user-emacs-directory ".smex-items")) +(smex-initialize) +(global-set-key (kbd "M-x") 'smex) + +(add-to-list 'safe-local-variable-values '(lexical-binding . t)) +(add-to-list 'safe-local-variable-values '(whitespace-line-column . 80)) + +;; ido-mode is like magic pixie dust! +(ido-mode t) +(ido-ubiquitous t) +(setq ido-enable-prefix nil + ido-enable-flex-matching t + ido-auto-merge-work-directories-length nil + ido-create-new-buffer 'always + ido-use-filename-at-point 'guess + ido-use-virtual-buffers t + ido-handle-duplicate-virtual-buffers 2 + ido-max-prospects 10) + +;; Swedish! +(set-language-environment 'Swedish) + +(require 'ffap) +(defvar ffap-c-commment-regexp "^/\\*+" + "Matches an opening C-style comment, like \"/***\".") + +(defadvice ffap-file-at-point (after avoid-c-comments activate) + "Don't return paths like \"/******\" unless they actually exist. + +This fixes the bug where ido would try to suggest a C-style +comment as a filename." + (ignore-errors + (when (and ad-return-value + (string-match-p ffap-c-commment-regexp + ad-return-value) + (not (ffap-file-exists-string ad-return-value))) + (setq ad-return-value nil)))) + +(defalias 'yes-or-no-p 'y-or-n-p) +(defalias 'auto-tail-revert-mode 'tail-mode) + +;; Hippie expand: at times perhaps too hip +(eval-after-load 'hippie-exp + '(progn + (dolist (f '(try-expand-line try-expand-list try-complete-file-name-partially)) + (delete f hippie-expand-try-functions-list)) + + ;; Add this back in at the end of the list. + (add-to-list 'hippie-expand-try-functions-list 'try-complete-file-name-partially t))) + +;; ## Look and feel ## + +;; Themes! I download and install the ones I like and default the one +;; I currently like most. This changes a lot because I hate +;; everything. (It's in my nature, don't judge) +(custom-download-theme "https://raw.github.com/owainlewis/emacs-color-themes/master/themes/hickey-theme.el" + "hickey-theme.el") + +(custom-download-theme "https://raw.github.com/rexim/gruber-darker-theme/master/gruber-darker-theme.el" + "gruber-darker-theme.el") + +(load-theme 'gruber-darker t) + +(global-hl-line-mode -1) + +(set-default-font "Source Code Pro 13") + +;; Don't make the nyan cat too long ... I have other stuff in the mode +;; bar as well! +(set-variable 'nyan-bar-length 15) +;; Not the real deal without this ... +(set-variable 'nyan-wavy-trail t) + +(setq linum-format (lambda (line) + (propertize + (format (concat " %" + (number-to-string + (length (number-to-string + (line-number-at-pos (point-max))))) + "d ") + line) + 'face 'linum))) + +;; Hiding JOIN, QUIT, PART +(setq erc-hide-list '("JOIN" "PART" "QUIT")) + +(eval-after-load 'diff-mode + '(progn + (set-face-foreground 'diff-added "green4") + (set-face-foreground 'diff-removed "red3"))) + +(eval-after-load 'magit + '(progn + (set-face-foreground 'magit-diff-add "green4") + (set-face-foreground 'magit-diff-del "red3"))) + +;; ## Mac specific settings ## + +;; Enable mouse support on OS X +(unless window-system + (require 'mouse) + (xterm-mouse-mode t) + (global-set-key [mouse-4] '(lambda () + (interactive) + (scroll-down 1))) + (global-set-key [mouse-5] '(lambda () + (interactive) + (scroll-up 1))) + (defun track-mouse (e)) + + (setq mouse-sel-mode t) +) + +;; Use clipboard properly +(setq x-select-enable-clipboard t) + +;; Settings for Emacs.app (Cocoa Emacs) +;; Menu bar doesn't take up additional space, so lets use it. +(menu-bar-mode 1) + +;; Don't use Apple's native fullscreen (FIXME: Change with Mavericks) +(setq ns-use-native-fullscreen nil) + +(defun toggle-native-fullscreen () + "Toggles between native and non-native OS X fullscreen" + (interactive) + (setq ns-use-native-fullscreen (not ns-use-native-fullscreen))) + +;; ## Navigation and key bindings ## + +;; Navigate windows with M- +(windmove-default-keybindings 'meta) +(setq windmove-wrap-around t) + +;; Load ace-jump-mode +(autoload + 'ace-jump-mode + "ace-jump-mode" + "Emacs quick move minor mode" + ) + +(define-key global-map [?] 'ace-jump-mode) + +;; Quick jump back +(autoload + 'ace-jump-mode-pop-mark + "ace-jump-mode" + "Ace jump back:-)" + ) + +(eval-after-load "ace-jump-mode" + '(ace-jump-mode-enable-mark-sync)) +(define-key global-map (kbd "C-x ö") 'ace-jump-mode-pop-mark) + +;; Keep your backup files in tmp, emacs! +(setq backup-directory-alist + `((".*" . ,temporary-file-directory))) +(setq auto-save-file-name-transforms + `((".*" ,temporary-file-directory t))) + +;; Eshell +;; Start/join +(global-set-key (kbd "C-x m") 'eshell) +;; Always start +(global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) + +;; Git +(global-set-key (kbd "C-c g") 'magit-status) + +(remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function) diff --git a/init.el b/init.el new file mode 100644 index 0000000000..4551a7b9ad --- /dev/null +++ b/init.el @@ -0,0 +1,84 @@ +;; Configure package manager +(require 'package) + +;; Add Marmalade repo +(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/")) + +;; ... and melpa. Melpa packages that exist on marmalade will have +;; precendence. +(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) + +(package-initialize) + +(when (not package-archive-contents) + (package-refresh-contents)) + +(defvar my-pkgs + '(ace-jump-mode + browse-kill-ring + clojure-mode + flycheck + flx-ido + haskell-mode + hi2 + idle-highlight-mode + ido-ubiquitous + leuven-theme + magit + magit + markdown-mode + multiple-cursors + nrepl + paredit + projectile + rainbow-delimiters + rainbow-mode + smex + undo-tree + geiser + quack) + "A list of packages to install at launch.") + +(dolist (p my-pkgs) + (when (not (package-installed-p p)) + (package-install p))) + + +(load "~/.emacs.d/init-functions.el") + +(add-to-list 'load-path "~/.emacs.d/scripts/") + +(setq custom-file "~/.emacs.d/init-custom.el") +(load custom-file) + +;; Other packages that need manual installation +(custom-download-script "https://raw.github.com/dimitri/switch-window/master/switch-window.el" + "switch-window.el") + +(custom-download-script "https://raw.github.com/doitian/iy-go-to-char/master/iy-go-to-char.el" + "goto-char.el") + +;; NYAN CAT! +(custom-clone-git "https://github.com/TeMPOraL/nyan-mode" "nyan-mode") +(load "~/.emacs.d/nyan-mode/nyan-mode.el") + +(load "~/.emacs.d/init-settings.el") +(load "~/.emacs.d/init-modes.el") +(load "~/.emacs.d/init-bindings.el") +(load "~/.emacs.d/init-eshell.el") + +;; A file with machine specific settings +(load "~/.emacs.d/init-local.el") + +;; IRC configuration (erc) +;; Actual servers and such are loaded from irc.el +(load "~/.emacs.d/irc") + +;; Load magnars' string manipulation library +(require 's) + +;; Seed RNG +(random t) + +;; Start server for emacsclient +(server-start) diff --git a/plists/com.googlecode.iterm2.plist b/plists/com.googlecode.iterm2.plist deleted file mode 100644 index 667361b2f7..0000000000 Binary files a/plists/com.googlecode.iterm2.plist and /dev/null differ diff --git a/plists/org.pqrs.KeyRemap4MacBook.plist b/plists/org.pqrs.KeyRemap4MacBook.plist deleted file mode 100644 index c6be298394..0000000000 Binary files a/plists/org.pqrs.KeyRemap4MacBook.plist and /dev/null differ diff --git a/plists/org.pqrs.PCKeyboardHack.plist b/plists/org.pqrs.PCKeyboardHack.plist deleted file mode 100644 index 4e4b74cb6e..0000000000 Binary files a/plists/org.pqrs.PCKeyboardHack.plist and /dev/null differ diff --git a/xnomad b/xnomad deleted file mode 100644 index 4a2adc0258..0000000000 --- a/xnomad +++ /dev/null @@ -1,20 +0,0 @@ -{ - "Ratio": 0.7, - "WindowsInMaster": 1, - "Hotkeys": { - "Swap": { "key": "s", "modifiers": [ "option", "control" ] }, - "SelectPrev": { "key": "j", "modifiers": [ "option", "control" ] }, - "SelectNext": { "key": "k", "modifiers": [ "option", "control" ] }, - "SwapPrev": { "key": "j", "modifiers": [ "option", "control", "command" ] }, - "SwapNext": { "key": "k", "modifiers": [ "option", "control", "command" ] }, - "FocusDisplay1": { "key": "e", "modifiers": [ "option", "control" ] }, - "FocusDisplay2": { "key": "w", "modifiers": [ "option", "control" ] }, - "ToDisplay1": { "key": "e", "modifiers": [ "option", "control", "command" ] }, - "ToDisplay2": { "key": "w", "modifiers": [ "option", "control", "command" ] }, - "CycleLayouts": { "key": " ", "modifiers": [ "option", "control", "command" ] }, - "IncreaseRatio": { "key": "l", "modifiers": [ "option", "control" ] }, - "DecreaseRatio": { "key": "h", "modifiers": [ "option", "control" ] }, - "MoreMasters": { "key": ".", "modifiers": [ "option", "control" ] }, - "FewerMasters": { "key": ",", "modifiers": [ "option", "control" ] } - } -} diff --git a/zshrc b/zshrc deleted file mode 100644 index 15846cbbe0..0000000000 --- a/zshrc +++ /dev/null @@ -1,63 +0,0 @@ -zmodload -a colors -zmodload -a autocomplete -autoload -U age && age - -export EDITOR='subl -w' - -[ -x /usr/bin/dircolors ] && eval $(dircolors) -zstyle ':completion:*' menu select=2 -zstyle ':completion:*' verbose true -zstyle ':completion:*' extra-verbose true -zstyle ':completion:*' use-cache on -zstyle ':completion:*' cache-path ~/.zsh/cache -zstyle ':completion:*:approximate:*' max-errors 1 numeric -zstyle ':completion:*:functions' ignored-patterns '_*' -zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} -zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate - -autoload -Uz compinit && compinit - -setopt autocd autopushd pushdminus pushdsilent pushdtohome -setopt HIST_REDUCE_BLANKS HIST_IGNORE_SPACE SHARE_HISTORY inc_append_history -setopt no_hup no_clobber print_exit_value -setopt extendedglob glob_dots -setopt correct -setopt completealiases -setopt prompt_subst - -case $TERM in - rxvt|*term) - precmd() { print -Pn "\e]0;%m:%~\a" } - preexec () { print -Pn "\e]0;$1\a" } - ;; -esac - -autoload -U colors && colors -#vincent: PS1="%{%B$fg[blue]%}%n%{$reset_color%B%}@%{%b$fg[magenta]%}%1~ %{$reset_color%}\$(vcprompt -f '%b:%r ')%# " - -#PS1="%n@%1~ \$(vcprompt -f '%b:%r ') %# " -PS1="%{$fg[green]%}%n%{$fg[cyan]%}@%{$fg[magenta]%}%1~ %{$fg[yellow]%}\$(vcprompt -f '%b:%r ')%{$fg[cyan]%}%# %{$reset_color%}" -RPS1="%{$fg[cyan]%}%B[%M:%d]%b%{$reset_color%}" - - -alias ls="ls -liFG" - -autoload -Uz compinit && compinit - -source ~/.zsh/plugins/history-substring-search.zsh -source ~/.zsh/plugins/git.plugin.zsh -source ~/.zsh/plugins/git-extras.plugin.zsh - -# Customize to your needs... -export PATH=/Users/vincent/Library/Haskell/bin:/Users/vincent/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/munki - -source /opt/boxen/env.sh - - -alias google.py="/Users/vincent/Source/management-scripts/google-apps/google.py" - -alias runhoogle="screen -dm hoogle server -p 4000" - -alias irssi="screen -S irssi irssi" - -HISTFILE="$HOME/.zsh_history" -- cgit 1.4.1 From 97af8f36313fdd26a6edfd080c681782511e30c3 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 5 Aug 2013 15:23:18 +0200 Subject: Removed mail config, ignored local files and IRC config --- .gitignore | 7 +++---- init-mail.el | 18 ------------------ 2 files changed, 3 insertions(+), 22 deletions(-) delete mode 100644 init-mail.el diff --git a/.gitignore b/.gitignore index cff209380a..35ab96e9fb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -/plists/.DS_Store -/.DS_Store -/#init.el# -/.#init.el +scripts/ +init-local.el +irc.el diff --git a/init-mail.el b/init-mail.el deleted file mode 100644 index 982b78156f..0000000000 --- a/init-mail.el +++ /dev/null @@ -1,18 +0,0 @@ -(require 'gnus) - -(setq gnus-select-method '(nnimap "gmail" - (nnimap-address "imap.gmail.com") - (nnimap-server-port 993) - (nnimap-stream ssl))) - -(setq message-send-mail-function 'smtpmail-send-it - smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil)) - smtpmail-auth-credentials '(("smtp.gmail.com" 587 "vincent@spotify.com" nil)) - smtpmail-default-smtp-server "smtp.gmail.com" - smtpmail-smtp-server "smtp.gmail.com" - smtpmail-smtp-service 587 - smtpmail-local-domain "spotify.com") - - ;; Make Gnus NOT ignore [Gmail] mailboxes -(setq gnus-ignored-newsgroups "^to\\.\\|^[0-9. ]+\\( \\|$\\)\\|^[\"]\"[#'()]") - -- cgit 1.4.1 From 9112881277a565613c42e63e7e7c89ca23a6de4e Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 5 Aug 2013 15:28:47 +0200 Subject: * Gitignore some more files * Install tumblesocks --- .gitignore | 4 ++++ init.el | 1 + 2 files changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 35ab96e9fb..c6aee83ff2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ scripts/ init-local.el irc.el +elpa/ +themes/ +other/ +*token* \ No newline at end of file diff --git a/init.el b/init.el index 4551a7b9ad..1bf161a5f0 100644 --- a/init.el +++ b/init.el @@ -34,6 +34,7 @@ rainbow-delimiters rainbow-mode smex + tumblesocks undo-tree geiser quack) -- cgit 1.4.1 From 1ba56be2ee45cf902199223d6ed86d04739c1399 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 5 Aug 2013 15:34:46 +0200 Subject: Only load irc.el and init-local if they exist --- init.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/init.el b/init.el index 1bf161a5f0..a448bf2f2d 100644 --- a/init.el +++ b/init.el @@ -68,12 +68,16 @@ (load "~/.emacs.d/init-bindings.el") (load "~/.emacs.d/init-eshell.el") -;; A file with machine specific settings -(load "~/.emacs.d/init-local.el") +(defun load-file-if-exists (filename) + (if (file-exists-p filename) + (load filename))) + +;; A file with machine specific settings. +(load-file-if-exists "~/.emacs.d/init-local.el") ;; IRC configuration (erc) ;; Actual servers and such are loaded from irc.el -(load "~/.emacs.d/irc") +(load-file-if-exists "~/.emacs.d/irc.el") ;; Load magnars' string manipulation library (require 's) -- cgit 1.4.1 From edb2ca67d3d4809af7f164142a318b65e6ecae69 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 5 Aug 2013 15:37:43 +0200 Subject: Rename irc.el to init-irc.el --- .gitignore | 2 +- init.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c6aee83ff2..e0336e08de 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ scripts/ init-local.el -irc.el +init-irc.el elpa/ themes/ other/ diff --git a/init.el b/init.el index a448bf2f2d..50b140ac42 100644 --- a/init.el +++ b/init.el @@ -77,7 +77,7 @@ ;; IRC configuration (erc) ;; Actual servers and such are loaded from irc.el -(load-file-if-exists "~/.emacs.d/irc.el") +(load-file-if-exists "~/.emacs.d/init-irc.el") ;; Load magnars' string manipulation library (require 's) -- cgit 1.4.1 From 2d27485f361614aeb91a850d0c1a10cff9f0e8f9 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 5 Aug 2013 16:18:56 +0200 Subject: * Global undo-tree (again) * several config things copied from @magnars --- init-modes.el | 12 ++++++++++-- init-settings.el | 28 ++++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/init-modes.el b/init-modes.el index 3e9cff9996..9c505f3ff2 100644 --- a/init-modes.el +++ b/init-modes.el @@ -41,11 +41,19 @@ ;; Always highlight matching brackets (show-paren-mode 1) -;; Undo-Tree at all times! -(undo-tree-mode) +;; Represent undo-history as an actual tree (visualize with C-x u) +(setq undo-tree-mode-lighter "") +(require 'undo-tree) +(global-undo-tree-mode) ;; Keep track of recent files (recentf-mode) ;; Enable Nyan mode (nyan-mode 1) + +;; Easily navigate sillycased words +(global-subword-mode 1) + +;; Transparently open compressed files +(auto-compression-mode t) diff --git a/init-settings.el b/init-settings.el index e2c7e6249b..3d6cf9402e 100644 --- a/init-settings.el +++ b/init-settings.el @@ -32,7 +32,10 @@ uniquify-buffer-name-style 'forward whitespace-style '(face trailing lines-tail tabs) whitespace-line-column 80 + fill-column 80 ediff-window-setup-function 'ediff-setup-windows-plain + ediff-diff-options "-w" + ediff-split-window-function 'split-window-horizontally oddmuse-directory (concat user-emacs-directory "oddmuse") save-place-file (concat user-emacs-directory "places") backup-directory-alist `(("." . ,(concat user-emacs-directory "backups"))) @@ -60,6 +63,13 @@ ;; Swedish! (set-language-environment 'Swedish) +;; UTF-8 please +(setq locale-coding-system 'utf-8) ; pretty +(set-terminal-coding-system 'utf-8) ; pretty +(set-keyboard-coding-system 'utf-8) ; pretty +(set-selection-coding-system 'utf-8) ; please +(prefer-coding-system 'utf-8) ; with sugar on top + (require 'ffap) (defvar ffap-c-commment-regexp "^/\\*+" "Matches an opening C-style comment, like \"/***\".") @@ -161,6 +171,22 @@ comment as a filename." ;; Don't use Apple's native fullscreen (FIXME: Change with Mavericks) (setq ns-use-native-fullscreen nil) +;; Auto refresh buffers +(global-auto-revert-mode 1) + +;; Also auto refresh dired, but be quiet about it +(setq global-auto-revert-non-file-buffers t) +(setq auto-revert-verbose nil) + +;; Show keystrokes in progress +(setq echo-keystrokes 0.1) + +;; Move files to trash when deleting +(setq delete-by-moving-to-trash t) + +;; Make emacs behave sanely (overwrite selected text) +(delete-selection-mode 1) + (defun toggle-native-fullscreen () "Toggles between native and non-native OS X fullscreen" (interactive) @@ -168,8 +194,6 @@ comment as a filename." ;; ## Navigation and key bindings ## -;; Navigate windows with M- -(windmove-default-keybindings 'meta) (setq windmove-wrap-around t) ;; Load ace-jump-mode -- cgit 1.4.1 From 152faa5421cf279d882c31429534d65125d9ba57 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 5 Aug 2013 16:47:40 +0200 Subject: Removed tumblesocks from packages, I'll load it locally --- init.el | 1 - 1 file changed, 1 deletion(-) diff --git a/init.el b/init.el index 50b140ac42..73f6805461 100644 --- a/init.el +++ b/init.el @@ -34,7 +34,6 @@ rainbow-delimiters rainbow-mode smex - tumblesocks undo-tree geiser quack) -- cgit 1.4.1 From 262abd3eadc21fb58fc1e365a641697f2b85eaa1 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 6 Aug 2013 11:16:15 +0200 Subject: This was an invalid hook being added. --- init-settings.el | 3 --- 1 file changed, 3 deletions(-) diff --git a/init-settings.el b/init-settings.el index 3d6cf9402e..bc167fb172 100644 --- a/init-settings.el +++ b/init-settings.el @@ -20,9 +20,6 @@ (mouse-wheel-mode t) (blink-cursor-mode -1)) -;; can't do it at launch or emacsclient won't always honor it -(add-hook 'before-make-frame-hook 'esk-turn-off-tool-bar) - (setq visible-bell t inhibit-startup-message t color-theme-is-global t -- cgit 1.4.1 From 9ae4bc6a27291f7c9a8667878236c499d5eab28c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 6 Aug 2013 13:12:24 +0200 Subject: Made custom-clone-git asynchronous --- init-functions.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init-functions.el b/init-functions.el index dfdfee0838..1fdf64ed59 100644 --- a/init-functions.el +++ b/init-functions.el @@ -41,7 +41,7 @@ "Clones a git repository to .emacs.d/foldername" (let ((fullpath (concat "~/.emacs.d/" foldername))) (unless (file-exists-p fullpath) - (shell-command (concat "git clone " url " " fullpath)))) + (async-shell-command (concat "git clone " url " " fullpath)))) ) ;; These come from magnars, he's got some awesome things. -- cgit 1.4.1 From 52d2182fa212a3d28e54e76afa0d9a5176d2f459 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 6 Aug 2013 13:27:26 +0200 Subject: Switched M-j to ace-jump-word-mode, hopping to a character is very rarely my requirement. --- init-bindings.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init-bindings.el b/init-bindings.el index 2593ddd6d0..23917802fe 100644 --- a/init-bindings.el +++ b/init-bindings.el @@ -16,7 +16,7 @@ (global-set-key (kbd "C-x C-i") 'imenu) ;; Ace-jump-mode -(global-set-key (kbd "M-j") 'ace-jump-char-mode) +(global-set-key (kbd "M-j") 'ace-jump-word-mode) ;; Jump to next occurence of char (global-set-key (kbd "M-m") 'iy-go-to-char) -- cgit 1.4.1 From 43a99dea3aa6651b1b060ace714bddc1e10925ea Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 6 Aug 2013 23:46:26 +0200 Subject: * moved switch-window and iy-go-to-char to package.el installs * changed 'custom-clone-git and 'custom-download-script to place things in special folders * added those folders and some other things to .gitignore * changed binding for iy-go-to-char to C-c f --- .gitignore | 13 ++++++++----- init-bindings.el | 2 +- init-functions.el | 9 ++++----- init.el | 13 +++---------- 4 files changed, 16 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index e0336e08de..2456e9d97e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,10 @@ -scripts/ -init-local.el -init-irc.el +.smex-items +*token* +auto-save-list/ +clones/ elpa/ -themes/ +init-irc.el +init-local.el other/ -*token* \ No newline at end of file +scripts/ +themes/ \ No newline at end of file diff --git a/init-bindings.el b/init-bindings.el index 23917802fe..d4026f157b 100644 --- a/init-bindings.el +++ b/init-bindings.el @@ -19,7 +19,7 @@ (global-set-key (kbd "M-j") 'ace-jump-word-mode) ;; Jump to next occurence of char -(global-set-key (kbd "M-m") 'iy-go-to-char) +(global-set-key (kbd "C-c f") 'iy-go-to-char) ;; Window switching. (C-x o goes to the next window) (windmove-default-keybindings) ;; Shift+direction diff --git a/init-functions.el b/init-functions.el index 1fdf64ed59..4814cee5d3 100644 --- a/init-functions.el +++ b/init-functions.el @@ -20,7 +20,7 @@ (unless (file-exists-p file) (url-copy-file url file)))) -(defun custom-download-script (url filename) + (defun custom-download-script (url filename) "Downloads an Elisp script, places it in ~/.emacs/other and then loads it" ;; Ensure the directory exists @@ -29,7 +29,7 @@ ;; Download file if it doesn't exist. (let ((file - (concat "~/.emacs.d/" filename))) + (concat "~/.emacs.d/other/" filename))) (unless (file-exists-p file) (url-copy-file url file)) @@ -39,10 +39,9 @@ ;; if there isn't already a folder with that name (defun custom-clone-git (url foldername) "Clones a git repository to .emacs.d/foldername" - (let ((fullpath (concat "~/.emacs.d/" foldername))) + (let ((fullpath (concat "~/.emacs.d/clones/" foldername))) (unless (file-exists-p fullpath) - (async-shell-command (concat "git clone " url " " fullpath)))) - ) + (async-shell-command (concat "git clone " url " " fullpath))))) ;; These come from magnars, he's got some awesome things. diff --git a/init.el b/init.el index 73f6805461..a85e4c4b49 100644 --- a/init.el +++ b/init.el @@ -23,17 +23,20 @@ hi2 idle-highlight-mode ido-ubiquitous + iy-go-to-char leuven-theme magit magit markdown-mode multiple-cursors nrepl + nyan-mode paredit projectile rainbow-delimiters rainbow-mode smex + switch-window undo-tree geiser quack) @@ -51,16 +54,6 @@ (setq custom-file "~/.emacs.d/init-custom.el") (load custom-file) -;; Other packages that need manual installation -(custom-download-script "https://raw.github.com/dimitri/switch-window/master/switch-window.el" - "switch-window.el") - -(custom-download-script "https://raw.github.com/doitian/iy-go-to-char/master/iy-go-to-char.el" - "goto-char.el") - -;; NYAN CAT! -(custom-clone-git "https://github.com/TeMPOraL/nyan-mode" "nyan-mode") -(load "~/.emacs.d/nyan-mode/nyan-mode.el") (load "~/.emacs.d/init-settings.el") (load "~/.emacs.d/init-modes.el") -- cgit 1.4.1 From 503600091e63ebe63c8a84ec6b8a6120ff89dc23 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 7 Aug 2013 00:49:20 +0200 Subject: * Providing all init files, loading them with require * Moved load-file-if-exists to init-functions * Added init-misc.el for random things that don't fit anywhere else * Never any tabs, ever. Go away! Bindings: * quit Emacs -> C-x r q ("real quit") * delete-frame -> C-x C-c * make-frame -> C-x C-n --- init-bindings.el | 11 +++++++++++ init-eshell.el | 2 ++ init-functions.el | 6 ++++++ init-misc.el | 9 +++++++++ init-modes.el | 2 ++ init-settings.el | 4 ++++ init.el | 20 +++++++++----------- 7 files changed, 43 insertions(+), 11 deletions(-) create mode 100644 init-misc.el diff --git a/init-bindings.el b/init-bindings.el index d4026f157b..2242bf733e 100644 --- a/init-bindings.el +++ b/init-bindings.el @@ -44,3 +44,14 @@ ;; Replace standard goto-line with goto-line-with-feedback (global-set-key (kbd "M-g g") 'goto-line-with-feedback) + +;; Goodness from @magnars +;; I don't need to kill emacs that easily +;; the mnemonic is C-x REALLY QUIT +(global-set-key (kbd "C-x r q") 'save-buffers-kill-terminal) +(global-set-key (kbd "C-x C-c") 'delete-frame) + +;; Create new frame +(define-key global-map (kbd "C-x C-n") 'make-frame-command) + +(provide 'init-bindings) diff --git a/init-eshell.el b/init-eshell.el index 239a9980ce..58c5888512 100644 --- a/init-eshell.el +++ b/init-eshell.el @@ -96,3 +96,5 @@ (interactive) (let ((inhibit-read-only t)) (erase-buffer))) + +(provide 'init-eshell) diff --git a/init-functions.el b/init-functions.el index 4814cee5d3..9cae3c677d 100644 --- a/init-functions.el +++ b/init-functions.el @@ -43,6 +43,10 @@ (unless (file-exists-p fullpath) (async-shell-command (concat "git clone " url " " fullpath))))) +(defun load-file-if-exists (filename) + (if (file-exists-p filename) + (load filename))) + ;; These come from magnars, he's got some awesome things. (defun goto-line-with-feedback () @@ -127,3 +131,5 @@ Including indent-buffer, which should not be called automatically on save." (defun speak (m &optional voice) (shell-command (if 'voice (concat "say -v " voice " \"" m "\"") (concat "say " m)))) + +(provide 'init-functions) diff --git a/init-misc.el b/init-misc.el new file mode 100644 index 0000000000..87343205b7 --- /dev/null +++ b/init-misc.el @@ -0,0 +1,9 @@ +;; For everything that doesn't fit anywhere else. + +;; Ignore .DS_Store files with ido mode +(add-to-list 'ido-ignore-files "\\.DS_Store") + +;; Use aspell for spell checking: brew install aspell --lang=en +(setq ispell-program-name "/usr/local/bin/aspell") + +(provide 'init-misc) diff --git a/init-modes.el b/init-modes.el index 9c505f3ff2..fc4923c200 100644 --- a/init-modes.el +++ b/init-modes.el @@ -57,3 +57,5 @@ ;; Transparently open compressed files (auto-compression-mode t) + +(provide 'init-modes) diff --git a/init-settings.el b/init-settings.el index bc167fb172..2f22f42a04 100644 --- a/init-settings.el +++ b/init-settings.el @@ -45,6 +45,8 @@ (add-to-list 'safe-local-variable-values '(lexical-binding . t)) (add-to-list 'safe-local-variable-values '(whitespace-line-column . 80)) +(set-default 'indent-tabs-mode nil) + ;; ido-mode is like magic pixie dust! (ido-mode t) (ido-ubiquitous t) @@ -229,3 +231,5 @@ comment as a filename." (global-set-key (kbd "C-c g") 'magit-status) (remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function) + +(provide 'init-settings) diff --git a/init.el b/init.el index a85e4c4b49..191acf8847 100644 --- a/init.el +++ b/init.el @@ -46,24 +46,22 @@ (when (not (package-installed-p p)) (package-install p))) +;; Are we on a mac? +(setq is-mac (equal system-type 'darwin)) -(load "~/.emacs.d/init-functions.el") +(add-to-list 'load-path user-emacs-directory) + +(mapc 'require '(init-functions + init-settings + init-modes + init-bindings + init-eshell)) (add-to-list 'load-path "~/.emacs.d/scripts/") (setq custom-file "~/.emacs.d/init-custom.el") (load custom-file) - -(load "~/.emacs.d/init-settings.el") -(load "~/.emacs.d/init-modes.el") -(load "~/.emacs.d/init-bindings.el") -(load "~/.emacs.d/init-eshell.el") - -(defun load-file-if-exists (filename) - (if (file-exists-p filename) - (load filename))) - ;; A file with machine specific settings. (load-file-if-exists "~/.emacs.d/init-local.el") -- cgit 1.4.1 From 494cda1ac0728f20b6a6372a6cc5c51aa248a71b Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 7 Aug 2013 00:58:14 +0200 Subject: Require a final newline on both visiting and saving a file --- .gitignore | 2 +- init-custom.el | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 2456e9d97e..620c180555 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ init-irc.el init-local.el other/ scripts/ -themes/ \ No newline at end of file +themes/ diff --git a/init-custom.el b/init-custom.el index 2b2916143f..22e37bfa62 100644 --- a/init-custom.el +++ b/init-custom.el @@ -14,7 +14,8 @@ (capitalized-words-mode turn-on-haskell-decl-scan turn-on-haskell-doc turn-on-hi2))) '(it-mode-google-cmd "/usr/local/share/python/google") '(ns-alternate-modifier (quote none)) - '(ns-command-modifier (quote meta))) + '(ns-command-modifier (quote meta)) + '(require-final-newline (quote visit-save))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. -- cgit 1.4.1 From 996c5867e6bcb871348f914e460f0d82729d268e Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 8 Aug 2013 00:54:35 +0200 Subject: Highlight DEBUG --- init-functions.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init-functions.el b/init-functions.el index 9cae3c677d..79a9bddc16 100644 --- a/init-functions.el +++ b/init-functions.el @@ -119,7 +119,7 @@ Including indent-buffer, which should not be called automatically on save." (defun esk-add-watchwords () (font-lock-add-keywords - nil '(("\\<\\(FIX\\(ME\\)?\\|TODO\\|HACK\\|REFACTOR\\|NOCOMMIT\\)" + nil '(("\\<\\(FIX\\(ME\\)?\\|TODO\\|DEBUG\\|HACK\\|REFACTOR\\|NOCOMMIT\\)" 1 font-lock-warning-face t)))) (defun esk-sudo-edit (&optional arg) -- cgit 1.4.1 From 15f83cc78f9776e9c63a57f681c60608221a7758 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 17 Aug 2013 20:43:05 +0200 Subject: * Fixed eshell pwd function * Minor changes --- init-custom.el | 2 +- init-eshell.el | 15 +++++---------- init-settings.el | 1 + 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/init-custom.el b/init-custom.el index 22e37bfa62..a67302aa52 100644 --- a/init-custom.el +++ b/init-custom.el @@ -12,7 +12,7 @@ '(haskell-mode-hook (quote (capitalized-words-mode turn-on-haskell-decl-scan turn-on-haskell-doc turn-on-hi2))) - '(it-mode-google-cmd "/usr/local/share/python/google") + '(it-mode-google-cmd "/usr/local/bin/google") '(ns-alternate-modifier (quote none)) '(ns-command-modifier (quote meta)) '(require-final-newline (quote visit-save))) diff --git a/init-eshell.el b/init-eshell.el index 58c5888512..77f99e551a 100644 --- a/init-eshell.el +++ b/init-eshell.el @@ -27,8 +27,10 @@ (defun clean-pwd (path) "Turns a path of the form /foo/bar/baz into /f/b/baz (inspired by fish shell)" - (message path) - (let* ((current-dir (split-string path "/")) + (let* ((hpath (replace-regexp-in-string home-dir + "~" + path)) + (current-dir (split-string hpath "/")) (cdir (last current-dir)) (head (butlast current-dir))) (concat (mapconcat (lambda (s) @@ -39,13 +41,6 @@ (if head "/" nil) (car cdir)))) -(setq eshell-pwd-convert-function - (lambda (path) - (clean-pwd (replace-regexp-in-string - home-dir - "~" - path)))) - (defun vcprompt (&optional args) "Call the external vcprompt command with optional arguments. VCPrompt" @@ -59,7 +54,7 @@ (defun prompt-f () "My EShell prompt displaying VC info and such" (concat - (with-face (concat (eshell/pwd) " ") :foreground "#96a6c8") + (with-face (concat (clean-pwd (eshell/pwd)) " ") :foreground "#96a6c8") (with-face (vcprompt " -f \"(%s:%b%a%m) \"") :foreground "#5f627f") (if (= 0 (user-uid)) (with-face "#" :foreground "#f43841") diff --git a/init-settings.el b/init-settings.el index 2f22f42a04..3730497966 100644 --- a/init-settings.el +++ b/init-settings.el @@ -120,6 +120,7 @@ comment as a filename." ;; Not the real deal without this ... (set-variable 'nyan-wavy-trail t) +;; Style line numbers (shown with M-g g) (setq linum-format (lambda (line) (propertize (format (concat " %" -- cgit 1.4.1 From 32fdafedcc6a05d9106eeefe95c0eee15a7094a2 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 19 Aug 2013 00:46:15 +0200 Subject: Global autocomplete mode --- init-custom.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init-custom.el b/init-custom.el index a67302aa52..754689d668 100644 --- a/init-custom.el +++ b/init-custom.el @@ -3,12 +3,15 @@ ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. + '(ac-auto-show-menu 0.8) + '(ac-delay 0.2) '(custom-safe-themes (quote ("854dc57026d3226addcc46b2b460034a74609edbd9c14e626769ac724b10fcf5" "8eaa3bce3c618cd81a318fcf2d28c1cd21278531f028feb53186f6387547dfb4" "ea0c5df0f067d2e3c0f048c1f8795af7b873f5014837feb0a7c8317f34417b04" "a234f91f9be6ed40f6ce0e94dce5cea1b9f1ccec2b9ccd42bb71c499867a3fcc" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "d6a00ef5e53adf9b6fe417d2b4404895f26210c52bb8716971be106550cea257" default))) '(erc-modules (quote (autojoin button completion dcc irccontrols list log match menu move-to-prompt netsplit networks noncommands notifications readonly ring scrolltobottom stamp track))) + '(global-auto-complete-mode t) '(haskell-mode-hook (quote (capitalized-words-mode turn-on-haskell-decl-scan turn-on-haskell-doc turn-on-hi2))) -- cgit 1.4.1 From b23609fb69c558f3e6092c5938852a71987f0e3e Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 19 Aug 2013 00:46:54 +0200 Subject: Add ac-nrepl to packages --- init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index 191acf8847..c89a6d0e25 100644 --- a/init.el +++ b/init.el @@ -14,7 +14,8 @@ (package-refresh-contents)) (defvar my-pkgs - '(ace-jump-mode + '(ac-nrepl + ace-jump-mode browse-kill-ring clojure-mode flycheck -- cgit 1.4.1 From b007f3d0ff15c8e0c7b1fbf752386791ee69b7ae Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 19 Aug 2013 00:53:05 +0200 Subject: Setup ac-nrepl --- init-modes.el | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/init-modes.el b/init-modes.el index fc4923c200..84b985ba2c 100644 --- a/init-modes.el +++ b/init-modes.el @@ -1,4 +1,4 @@ -(mapc 'require '(projectile hi2)) +(mapc 'require '(projectile hi2 ac-nrepl)) ;; Initializes modes I use. (add-hook 'prog-mode-hook 'esk-pretty-lambdas) @@ -16,14 +16,33 @@ (define-key haskell-mode-map (kbd "C-,") 'haskell-move-nested-left) (define-key haskell-mode-map (kbd "C-.") 'haskell-move-nested-right) +;; Use auto-complete as completion at point +(defun set-auto-complete-as-completion-at-point-function () + (setq completion-at-point-functions '(auto-complete))) +(add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function) + + ;; Configure nrepl (Clojure REPL) and clojure-mode -;; Paredit in clojure +;; Use ac-nrepl for completion +(add-hook 'nrepl-mode-hook 'ac-nrep-setup) +(add-hook 'nrepl-interaction-mode-hook 'ac-nrepl-setup) +(eval-after-load "auto-complete" + '(add-to-list 'ac-modes 'nrepl-mode)) + +(add-hook 'nrepl-mode-hook 'set-auto-complete-as-completion-at-point-function) +(add-hook 'nrepl-interaction-mode-hook 'set-auto-complete-as-completion-at-point-function) +(define-key nrepl-interaction-mode-map (kbd "C-c C-d") 'ac-nrepl-popup-doc) + +;; Paredit in clojure (add-hook 'clojure-mode-hook 'paredit-mode) ;; eldoc in clojure (add-hook 'nrepl-interaction-mode-hook - 'nrepl-turn-on-eldoc-mode) + 'nrepl-turn-on-eldoc-mode) + +(add-hook 'nrepl-interaction-mode-hook + 'paredit-mode) ;; Don't annoy me (setq nrepl-hide-special-buffers t) -- cgit 1.4.1 From fa927ebf7ccce6e017cfbf400edba1eee55151e9 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 19 Aug 2013 02:38:02 +0200 Subject: Typo in modes file, Postgres.app PATH changes --- init-eshell.el | 1 + init-modes.el | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/init-eshell.el b/init-eshell.el index 77f99e551a..66ee951315 100644 --- a/init-eshell.el +++ b/init-eshell.el @@ -13,6 +13,7 @@ "Sets up EShell when it is loaded" (setq eshell-path-env (concat + "/Applications/Postgres.app/Contents/MacOS/bin:" "/usr/local/bin:" (concat home-dir "/bin:") "/usr/local/share/python:" diff --git a/init-modes.el b/init-modes.el index 84b985ba2c..d24ee7b0c8 100644 --- a/init-modes.el +++ b/init-modes.el @@ -25,13 +25,11 @@ ;; Configure nrepl (Clojure REPL) and clojure-mode ;; Use ac-nrepl for completion -(add-hook 'nrepl-mode-hook 'ac-nrep-setup) +(add-hook 'nrepl-mode-hook 'ac-nrepl-setup) (add-hook 'nrepl-interaction-mode-hook 'ac-nrepl-setup) (eval-after-load "auto-complete" '(add-to-list 'ac-modes 'nrepl-mode)) -(add-hook 'nrepl-mode-hook 'set-auto-complete-as-completion-at-point-function) -(add-hook 'nrepl-interaction-mode-hook 'set-auto-complete-as-completion-at-point-function) (define-key nrepl-interaction-mode-map (kbd "C-c C-d") 'ac-nrepl-popup-doc) ;; Paredit in clojure -- cgit 1.4.1 From 867a87387c8232c48170c045d13a556a1d68fe3a Mon Sep 17 00:00:00 2001 From: "vincent@spotify.com" Date: Mon, 19 Aug 2013 02:40:07 +0200 Subject: Typo in modes file, Postgres.app PATH changes --- init-eshell.el | 1 + init-modes.el | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/init-eshell.el b/init-eshell.el index 77f99e551a..66ee951315 100644 --- a/init-eshell.el +++ b/init-eshell.el @@ -13,6 +13,7 @@ "Sets up EShell when it is loaded" (setq eshell-path-env (concat + "/Applications/Postgres.app/Contents/MacOS/bin:" "/usr/local/bin:" (concat home-dir "/bin:") "/usr/local/share/python:" diff --git a/init-modes.el b/init-modes.el index 84b985ba2c..d24ee7b0c8 100644 --- a/init-modes.el +++ b/init-modes.el @@ -25,13 +25,11 @@ ;; Configure nrepl (Clojure REPL) and clojure-mode ;; Use ac-nrepl for completion -(add-hook 'nrepl-mode-hook 'ac-nrep-setup) +(add-hook 'nrepl-mode-hook 'ac-nrepl-setup) (add-hook 'nrepl-interaction-mode-hook 'ac-nrepl-setup) (eval-after-load "auto-complete" '(add-to-list 'ac-modes 'nrepl-mode)) -(add-hook 'nrepl-mode-hook 'set-auto-complete-as-completion-at-point-function) -(add-hook 'nrepl-interaction-mode-hook 'set-auto-complete-as-completion-at-point-function) (define-key nrepl-interaction-mode-map (kbd "C-c C-d") 'ac-nrepl-popup-doc) ;; Paredit in clojure -- cgit 1.4.1 From a7e4801f3b5c42ad131b4427c75cc021c7ef418a Mon Sep 17 00:00:00 2001 From: "vincent@spotify.com" Date: Wed, 28 Aug 2013 00:56:20 +0200 Subject: Loading mail settings if they exist \nProper up/down history movement in nrepl --- init-custom.el | 1 + init-modes.el | 11 +++++++++-- init-settings.el | 2 ++ init.el | 3 +++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/init-custom.el b/init-custom.el index 754689d668..347413452f 100644 --- a/init-custom.el +++ b/init-custom.el @@ -16,6 +16,7 @@ (quote (capitalized-words-mode turn-on-haskell-decl-scan turn-on-haskell-doc turn-on-hi2))) '(it-mode-google-cmd "/usr/local/bin/google") + '(mu4e-use-fancy-chars t) '(ns-alternate-modifier (quote none)) '(ns-command-modifier (quote meta)) '(require-final-newline (quote visit-save))) diff --git a/init-modes.el b/init-modes.el index d24ee7b0c8..1664de11f6 100644 --- a/init-modes.el +++ b/init-modes.el @@ -27,11 +27,18 @@ ;; Use ac-nrepl for completion (add-hook 'nrepl-mode-hook 'ac-nrepl-setup) (add-hook 'nrepl-interaction-mode-hook 'ac-nrepl-setup) -(eval-after-load "auto-complete" - '(add-to-list 'ac-modes 'nrepl-mode)) + +;; I want history up/down without modifiers +(define-key nrepl-mode-map (kbd "") 'nrepl-backward-input) +(define-key nrepl-mode-map (kbd "") 'nrepl-forward-input) +(define-key nrepl-mode-map (kbd "C-") 'previous-line) +(define-key nrepl-mode-map (kbd "C-") 'next-line) (define-key nrepl-interaction-mode-map (kbd "C-c C-d") 'ac-nrepl-popup-doc) +(eval-after-load "auto-complete" + '(add-to-list 'ac-modes 'nrepl-mode)) + ;; Paredit in clojure (add-hook 'clojure-mode-hook 'paredit-mode) diff --git a/init-settings.el b/init-settings.el index 3730497966..4256ba1c0f 100644 --- a/init-settings.el +++ b/init-settings.el @@ -9,6 +9,8 @@ ;;; Code: +(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu4e") + (add-to-list 'exec-path "/usr/local/bin") (add-to-list 'exec-path (expand-file-name "~/bin")) (add-to-list 'exec-path "/Applications/Racket/bin") diff --git a/init.el b/init.el index c89a6d0e25..9281861bb4 100644 --- a/init.el +++ b/init.el @@ -70,6 +70,9 @@ ;; Actual servers and such are loaded from irc.el (load-file-if-exists "~/.emacs.d/init-irc.el") +;; Mail configuration (mu4e && mbsync) +(load-file-if-exists "~/.emacs.d/init-mail.el") + ;; Load magnars' string manipulation library (require 's) -- cgit 1.4.1 From 25d348673bd6951e5e9f9235dbd4db311e1a0567 Mon Sep 17 00:00:00 2001 From: "vincent@spotify.com" Date: Wed, 28 Aug 2013 17:16:44 +0200 Subject: * added circe to package list (*potential* replacement for rcirc) * added a handy function to retrieve passwords from the OS X keychain --- init-functions.el | 11 +++++++++++ init.el | 1 + 2 files changed, 12 insertions(+) diff --git a/init-functions.el b/init-functions.el index 79a9bddc16..b461b2e6a7 100644 --- a/init-functions.el +++ b/init-functions.el @@ -35,6 +35,17 @@ (load file))) +(defun keychain-password (account &optional keychain) + "Returns the password for the account, by default it's looked up in the Login.keychain but a + different keychain can be specified." + (let ((k (if keychain keychain "Login.keychain"))) + (replace-regexp-in-string + "\n" "" + (shell-command-to-string (concat "security find-generic-password -w -a " + account + " " + k))))) + ;; This clones a git repository to 'foldername in .emacs.d ;; if there isn't already a folder with that name (defun custom-clone-git (url foldername) diff --git a/init.el b/init.el index 9281861bb4..80525b12cc 100644 --- a/init.el +++ b/init.el @@ -17,6 +17,7 @@ '(ac-nrepl ace-jump-mode browse-kill-ring + circe clojure-mode flycheck flx-ido -- cgit 1.4.1 From 924e60005e10aba8ec16622998df642f14997807 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 16 Sep 2013 13:58:44 +0200 Subject: Minor fixes for nrepl-mode --- init-custom.el | 3 ++- init-modes.el | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/init-custom.el b/init-custom.el index 347413452f..8adbb800fe 100644 --- a/init-custom.el +++ b/init-custom.el @@ -7,10 +7,11 @@ '(ac-delay 0.2) '(custom-safe-themes (quote - ("854dc57026d3226addcc46b2b460034a74609edbd9c14e626769ac724b10fcf5" "8eaa3bce3c618cd81a318fcf2d28c1cd21278531f028feb53186f6387547dfb4" "ea0c5df0f067d2e3c0f048c1f8795af7b873f5014837feb0a7c8317f34417b04" "a234f91f9be6ed40f6ce0e94dce5cea1b9f1ccec2b9ccd42bb71c499867a3fcc" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "d6a00ef5e53adf9b6fe417d2b4404895f26210c52bb8716971be106550cea257" default))) + ("2fb6fbdb644441c4ed1d47f25bed9aa7f7136271c2454ba9a29975d3cfba94c0" "466ae54a7b157ad02fd91da72b7871bccfb9bac98fdab95cf7a0d405c8572bd0" "854dc57026d3226addcc46b2b460034a74609edbd9c14e626769ac724b10fcf5" "8eaa3bce3c618cd81a318fcf2d28c1cd21278531f028feb53186f6387547dfb4" "ea0c5df0f067d2e3c0f048c1f8795af7b873f5014837feb0a7c8317f34417b04" "a234f91f9be6ed40f6ce0e94dce5cea1b9f1ccec2b9ccd42bb71c499867a3fcc" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "d6a00ef5e53adf9b6fe417d2b4404895f26210c52bb8716971be106550cea257" default))) '(erc-modules (quote (autojoin button completion dcc irccontrols list log match menu move-to-prompt netsplit networks noncommands notifications readonly ring scrolltobottom stamp track))) + '(frame-brackground-mode (quote dark)) '(global-auto-complete-mode t) '(haskell-mode-hook (quote diff --git a/init-modes.el b/init-modes.el index 1664de11f6..7a66bb2a6a 100644 --- a/init-modes.el +++ b/init-modes.el @@ -24,8 +24,14 @@ ;; Configure nrepl (Clojure REPL) and clojure-mode +(defun nrepl-mode-setup () + "Activates paredit, rainbow delimiters and ac-nrepl" + (ac-nrepl-setup) + (rainbow-delimiters-mode) + (paredit-mode)) + ;; Use ac-nrepl for completion -(add-hook 'nrepl-mode-hook 'ac-nrepl-setup) +(add-hook 'nrepl-mode-hook 'nrepl-mode-setup) (add-hook 'nrepl-interaction-mode-hook 'ac-nrepl-setup) ;; I want history up/down without modifiers @@ -33,8 +39,11 @@ (define-key nrepl-mode-map (kbd "") 'nrepl-forward-input) (define-key nrepl-mode-map (kbd "C-") 'previous-line) (define-key nrepl-mode-map (kbd "C-") 'next-line) +(define-key nrepl-mode-map (kbd "C-c C-d") 'ac-nrepl-popup-doc) (define-key nrepl-interaction-mode-map (kbd "C-c C-d") 'ac-nrepl-popup-doc) +(define-key nrepl-interaction-mode-map (kbd "C-c D") 'nrepl-doc) + (eval-after-load "auto-complete" '(add-to-list 'ac-modes 'nrepl-mode)) -- cgit 1.4.1 From 9a9c9192b1e060ace939c35150042cbcfb164bd6 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 20 Sep 2013 01:02:16 +0200 Subject: Removed some packages --- init.el | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/init.el b/init.el index 80525b12cc..4abdac188a 100644 --- a/init.el +++ b/init.el @@ -17,7 +17,6 @@ '(ac-nrepl ace-jump-mode browse-kill-ring - circe clojure-mode flycheck flx-ido @@ -28,7 +27,6 @@ iy-go-to-char leuven-theme magit - magit markdown-mode multiple-cursors nrepl @@ -39,9 +37,7 @@ rainbow-mode smex switch-window - undo-tree - geiser - quack) + undo-tree) "A list of packages to install at launch.") (dolist (p my-pkgs) -- cgit 1.4.1 From a4e7f10362c807e5494debc2810f490cb2350608 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 5 Oct 2013 00:12:18 +0200 Subject: updated init-modes for new nrepl.el --- init-modes.el | 10 +++++----- init.el | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/init-modes.el b/init-modes.el index 7a66bb2a6a..7a6a8e21b0 100644 --- a/init-modes.el +++ b/init-modes.el @@ -35,11 +35,11 @@ (add-hook 'nrepl-interaction-mode-hook 'ac-nrepl-setup) ;; I want history up/down without modifiers -(define-key nrepl-mode-map (kbd "") 'nrepl-backward-input) -(define-key nrepl-mode-map (kbd "") 'nrepl-forward-input) -(define-key nrepl-mode-map (kbd "C-") 'previous-line) -(define-key nrepl-mode-map (kbd "C-") 'next-line) -(define-key nrepl-mode-map (kbd "C-c C-d") 'ac-nrepl-popup-doc) +(define-key nrepl-repl-mode-map (kbd "") 'nrepl-backward-input) +(define-key nrepl-repl-mode-map (kbd "") 'nrepl-forward-input) +(define-key nrepl-repl-mode-map (kbd "C-") 'previous-line) +(define-key nrepl-repl-mode-map (kbd "C-") 'next-line) +(define-key nrepl-repl-mode-map (kbd "C-c C-d") 'ac-nrepl-popup-doc) (define-key nrepl-interaction-mode-map (kbd "C-c C-d") 'ac-nrepl-popup-doc) (define-key nrepl-interaction-mode-map (kbd "C-c D") 'nrepl-doc) diff --git a/init.el b/init.el index 4abdac188a..cb35667772 100644 --- a/init.el +++ b/init.el @@ -60,6 +60,9 @@ (setq custom-file "~/.emacs.d/init-custom.el") (load custom-file) +(custom-download-script "https://gist.github.com/gongo/1789605/raw/526e3f21dc7d6cef20951cf0ce5d51b90b7821ff/json-reformat.el" + "json-reformat.el") + ;; A file with machine specific settings. (load-file-if-exists "~/.emacs.d/init-local.el") -- cgit 1.4.1 From cbecd5031d57528c39b61e16f2aad850f40b49a1 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 14 Oct 2013 08:50:56 +0200 Subject: Add YaSnippet & enable Uniquify - Added YaSnippet & clojure-snippets for it - Enabled uniquify buffer naming (oh so good) - various smaller things --- README.md | 6 ++++-- init-custom.el | 2 +- init-functions.el | 2 +- init-modes.el | 5 ++++- init-settings.el | 3 +++ init.el | 15 +++++++++++---- 6 files changed, 24 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ec381bcd29..2dd067a910 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -dotfiles +emacs.d ======== -Various configuration files \ No newline at end of file +This contains my emacs.d folder. + +I use emacs for many things. diff --git a/init-custom.el b/init-custom.el index 8adbb800fe..a1333954b0 100644 --- a/init-custom.el +++ b/init-custom.el @@ -7,7 +7,7 @@ '(ac-delay 0.2) '(custom-safe-themes (quote - ("2fb6fbdb644441c4ed1d47f25bed9aa7f7136271c2454ba9a29975d3cfba94c0" "466ae54a7b157ad02fd91da72b7871bccfb9bac98fdab95cf7a0d405c8572bd0" "854dc57026d3226addcc46b2b460034a74609edbd9c14e626769ac724b10fcf5" "8eaa3bce3c618cd81a318fcf2d28c1cd21278531f028feb53186f6387547dfb4" "ea0c5df0f067d2e3c0f048c1f8795af7b873f5014837feb0a7c8317f34417b04" "a234f91f9be6ed40f6ce0e94dce5cea1b9f1ccec2b9ccd42bb71c499867a3fcc" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "d6a00ef5e53adf9b6fe417d2b4404895f26210c52bb8716971be106550cea257" default))) + ("d0ff5ea54497471567ed15eb7279c37aef3465713fb97a50d46d95fe11ab4739" "2fd1c7f994649d9f879521c4634bd8eddae866db9ff50269a9127b9f93b4e582" "2fb6fbdb644441c4ed1d47f25bed9aa7f7136271c2454ba9a29975d3cfba94c0" "466ae54a7b157ad02fd91da72b7871bccfb9bac98fdab95cf7a0d405c8572bd0" "854dc57026d3226addcc46b2b460034a74609edbd9c14e626769ac724b10fcf5" "8eaa3bce3c618cd81a318fcf2d28c1cd21278531f028feb53186f6387547dfb4" "ea0c5df0f067d2e3c0f048c1f8795af7b873f5014837feb0a7c8317f34417b04" "a234f91f9be6ed40f6ce0e94dce5cea1b9f1ccec2b9ccd42bb71c499867a3fcc" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "d6a00ef5e53adf9b6fe417d2b4404895f26210c52bb8716971be106550cea257" default))) '(erc-modules (quote (autojoin button completion dcc irccontrols list log match menu move-to-prompt netsplit networks noncommands notifications readonly ring scrolltobottom stamp track))) diff --git a/init-functions.el b/init-functions.el index b461b2e6a7..033c525eb5 100644 --- a/init-functions.el +++ b/init-functions.el @@ -50,7 +50,7 @@ ;; if there isn't already a folder with that name (defun custom-clone-git (url foldername) "Clones a git repository to .emacs.d/foldername" - (let ((fullpath (concat "~/.emacs.d/clones/" foldername))) + (let ((fullpath (concat "~/.emacs.d/" foldername))) (unless (file-exists-p fullpath) (async-shell-command (concat "git clone " url " " fullpath))))) diff --git a/init-modes.el b/init-modes.el index 7a6a8e21b0..9c766de69d 100644 --- a/init-modes.el +++ b/init-modes.el @@ -1,10 +1,13 @@ -(mapc 'require '(projectile hi2 ac-nrepl)) +(mapc 'require '(projectile hi2 ac-nrepl yasnippet)) ;; Initializes modes I use. (add-hook 'prog-mode-hook 'esk-pretty-lambdas) (add-hook 'prog-mode-hook 'esk-add-watchwords) (add-hook 'prog-mode-hook 'idle-highlight-mode) +;; Yasnippet everywhere + activate Clojure snippets! +(yas-global-mode 1) + ;; Configure markdown-mode (autoload 'markdown-mode "markdown-mode" "Major mode for editing Markdown files" t) diff --git a/init-settings.el b/init-settings.el index 4256ba1c0f..e691328e13 100644 --- a/init-settings.el +++ b/init-settings.el @@ -1,3 +1,4 @@ +(require 'uniquify) ;; ## Generic settings ## (tool-bar-mode -1) @@ -7,6 +8,8 @@ (setq ido-use-faces nil) (setq gc-cons-threshold 20000000) +(setq uniquify-buffer-name-style 'forward) + ;;; Code: (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu4e") diff --git a/init.el b/init.el index cb35667772..473a7b6777 100644 --- a/init.el +++ b/init.el @@ -25,7 +25,6 @@ idle-highlight-mode ido-ubiquitous iy-go-to-char - leuven-theme magit markdown-mode multiple-cursors @@ -37,7 +36,8 @@ rainbow-mode smex switch-window - undo-tree) + undo-tree + yasnippet) "A list of packages to install at launch.") (dolist (p my-pkgs) @@ -49,8 +49,15 @@ (add-to-list 'load-path user-emacs-directory) -(mapc 'require '(init-functions - init-settings +(require 'init-functions) + +(unless (file-exists-p "~/.emacs.d/snippets") + (make-directory "~/.emacs.d/snippets")) + +(custom-clone-git "http://github.com/swannodette/clojure-snippets" + "snippets/clojure-mode") + +(mapc 'require '(init-settings init-modes init-bindings init-eshell)) -- cgit 1.4.1 From 2acc9f23fa214d4b661387c17d4c19312eb49c35 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 17 Oct 2013 14:17:38 +0200 Subject: Cleanup and evil setup Removed several functions from init-functions that I didn't actually use. Lots of other cleanup. The variable "is-vim-user" in init.el controls whether or not evil packages should be installed and configured. --- init-bindings.el | 4 ++-- init-eshell.el | 2 -- init-functions.el | 50 +++------------------------------------ init-modes.el | 18 +++++--------- init-settings.el | 70 +++++++++++++++---------------------------------------- init.el | 64 ++++++++++++++++++++++++++++++++------------------ 6 files changed, 71 insertions(+), 137 deletions(-) diff --git a/init-bindings.el b/init-bindings.el index 2242bf733e..24517fd36c 100644 --- a/init-bindings.el +++ b/init-bindings.el @@ -39,8 +39,8 @@ ;; So good! (global-set-key (kbd "C-c g") 'magit-status) -;; Add a fullscreen toggle -(global-set-key (kbd "M-RET") 'toggle-frame-fullscreen) +;; Add a fullscreen toggle - TODO: reenable in next Emacs release +; (global-set-key (kbd "M-RET") 'toggle-frame-fullscreen) ;; Replace standard goto-line with goto-line-with-feedback (global-set-key (kbd "M-g g") 'goto-line-with-feedback) diff --git a/init-eshell.el b/init-eshell.el index 66ee951315..912f8ee82b 100644 --- a/init-eshell.el +++ b/init-eshell.el @@ -11,9 +11,7 @@ (defun eshell-mode-hook-setup () "Sets up EShell when it is loaded" - (setq eshell-path-env (concat - "/Applications/Postgres.app/Contents/MacOS/bin:" "/usr/local/bin:" (concat home-dir "/bin:") "/usr/local/share/python:" diff --git a/init-functions.el b/init-functions.el index 033c525eb5..233d40dd8b 100644 --- a/init-functions.el +++ b/init-functions.el @@ -20,13 +20,13 @@ (unless (file-exists-p file) (url-copy-file url file)))) - (defun custom-download-script (url filename) +(defun custom-download-script (url filename) "Downloads an Elisp script, places it in ~/.emacs/other and then loads it" - + ;; Ensure the directory exists (unless (file-exists-p "~/.emacs.d/other") (make-directory "~/.emacs.d/other")) - + ;; Download file if it doesn't exist. (let ((file (concat "~/.emacs.d/other/" filename))) @@ -69,30 +69,6 @@ (call-interactively 'goto-line)) (linum-mode -1))) -(defun rotate-windows () - "Rotate your windows" - (interactive) - (cond ((not (> (count-windows)1)) - (message "You can't rotate a single window!")) - (t - (setq i 1) - (setq numWindows (count-windows)) - (while (< i numWindows) - (let* ( - (w1 (elt (window-list) i)) - (w2 (elt (window-list) (+ (% i numWindows) 1))) - - (b1 (window-buffer w1)) - (b2 (window-buffer w2)) - - (s1 (window-start w1)) - (s2 (window-start w2)) - ) - (set-window-buffer w1 b2) - (set-window-buffer w2 b1) - (set-window-start w1 s2) - (set-window-start w2 s1) - (setq i (1+ i))))))) (defun untabify-buffer () (interactive) @@ -111,22 +87,6 @@ Including indent-buffer, which should not be called automatically on save." (indent-buffer)) ;; These come from the emacs starter kit -(defun esk-pretty-lambdas () - (font-lock-add-keywords - nil `(("(?\\(lambda\\>\\)" - (0 (progn (compose-region (match-beginning 1) (match-end 1) - ,(make-char 'greek-iso8859-7 107)) - nil)))))) - -(defun esk-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))))) (defun esk-add-watchwords () (font-lock-add-keywords @@ -139,8 +99,4 @@ Including indent-buffer, which should not be called automatically on save." (find-file (concat "/sudo:root@localhost:" (ido-read-file-name "File: "))) (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))) -(defun speak (m &optional voice) - (shell-command (if 'voice (concat "say -v " voice " \"" m "\"") - (concat "say " m)))) - (provide 'init-functions) diff --git a/init-modes.el b/init-modes.el index 9c766de69d..55b25358bf 100644 --- a/init-modes.el +++ b/init-modes.el @@ -1,13 +1,9 @@ (mapc 'require '(projectile hi2 ac-nrepl yasnippet)) ;; Initializes modes I use. -(add-hook 'prog-mode-hook 'esk-pretty-lambdas) (add-hook 'prog-mode-hook 'esk-add-watchwords) (add-hook 'prog-mode-hook 'idle-highlight-mode) -;; Yasnippet everywhere + activate Clojure snippets! -(yas-global-mode 1) - ;; Configure markdown-mode (autoload 'markdown-mode "markdown-mode" "Major mode for editing Markdown files" t) @@ -15,14 +11,12 @@ (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) -;; Add keybindings to move nested blocks with C-, rsp. C-. -(define-key haskell-mode-map (kbd "C-,") 'haskell-move-nested-left) -(define-key haskell-mode-map (kbd "C-.") 'haskell-move-nested-right) - ;; Use auto-complete as completion at point (defun set-auto-complete-as-completion-at-point-function () (setq completion-at-point-functions '(auto-complete))) -(add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function) + +(add-hook 'auto-complete-mode-hook + 'set-auto-complete-as-completion-at-point-function) ;; Configure nrepl (Clojure REPL) and clojure-mode @@ -30,12 +24,12 @@ (defun nrepl-mode-setup () "Activates paredit, rainbow delimiters and ac-nrepl" (ac-nrepl-setup) - (rainbow-delimiters-mode) - (paredit-mode)) + (rainbow-delimiters-mode 1) + (paredit-mode 1)) ;; Use ac-nrepl for completion (add-hook 'nrepl-mode-hook 'nrepl-mode-setup) -(add-hook 'nrepl-interaction-mode-hook 'ac-nrepl-setup) +(add-hook 'nrepl-interaction-mode-hook 'nrepl-mode-setup) ;; I want history up/down without modifiers (define-key nrepl-repl-mode-map (kbd "") 'nrepl-backward-input) diff --git a/init-settings.el b/init-settings.el index e691328e13..4f78a8cc10 100644 --- a/init-settings.el +++ b/init-settings.el @@ -1,6 +1,7 @@ (require 'uniquify) -;; ## Generic settings ## +; ## Generic settings ## +; Hide those ugly tool bars (tool-bar-mode -1) (scroll-bar-mode -1) @@ -12,11 +13,8 @@ ;;; Code: -(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu4e") - (add-to-list 'exec-path "/usr/local/bin") (add-to-list 'exec-path (expand-file-name "~/bin")) -(add-to-list 'exec-path "/Applications/Racket/bin") (when window-system @@ -25,6 +23,7 @@ (mouse-wheel-mode t) (blink-cursor-mode -1)) +; Fix some defaults (setq visible-bell t inhibit-startup-message t color-theme-is-global t @@ -75,43 +74,22 @@ (prefer-coding-system 'utf-8) ; with sugar on top (require 'ffap) -(defvar ffap-c-commment-regexp "^/\\*+" - "Matches an opening C-style comment, like \"/***\".") - -(defadvice ffap-file-at-point (after avoid-c-comments activate) - "Don't return paths like \"/******\" unless they actually exist. - -This fixes the bug where ido would try to suggest a C-style -comment as a filename." - (ignore-errors - (when (and ad-return-value - (string-match-p ffap-c-commment-regexp - ad-return-value) - (not (ffap-file-exists-string ad-return-value))) - (setq ad-return-value nil)))) (defalias 'yes-or-no-p 'y-or-n-p) (defalias 'auto-tail-revert-mode 'tail-mode) -;; Hippie expand: at times perhaps too hip -(eval-after-load 'hippie-exp - '(progn - (dolist (f '(try-expand-line try-expand-list try-complete-file-name-partially)) - (delete f hippie-expand-try-functions-list)) - - ;; Add this back in at the end of the list. - (add-to-list 'hippie-expand-try-functions-list 'try-complete-file-name-partially t))) - ;; ## Look and feel ## ;; Themes! I download and install the ones I like and default the one ;; I currently like most. This changes a lot because I hate ;; everything. (It's in my nature, don't judge) -(custom-download-theme "https://raw.github.com/owainlewis/emacs-color-themes/master/themes/hickey-theme.el" - "hickey-theme.el") +(custom-download-theme + "https://raw.github.com/owainlewis/emacs-color-themes/master/themes/hickey-theme.el" + "hickey-theme.el") -(custom-download-theme "https://raw.github.com/rexim/gruber-darker-theme/master/gruber-darker-theme.el" - "gruber-darker-theme.el") +(custom-download-theme + "https://raw.github.com/rexim/gruber-darker-theme/master/gruber-darker-theme.el" + "gruber-darker-theme.el") (load-theme 'gruber-darker t) @@ -126,18 +104,16 @@ comment as a filename." (set-variable 'nyan-wavy-trail t) ;; Style line numbers (shown with M-g g) -(setq linum-format (lambda (line) - (propertize - (format (concat " %" - (number-to-string - (length (number-to-string - (line-number-at-pos (point-max))))) - "d ") - line) - 'face 'linum))) - -;; Hiding JOIN, QUIT, PART -(setq erc-hide-list '("JOIN" "PART" "QUIT")) +(setq linum-format + (lambda (line) + (propertize + (format (concat " %" + (number-to-string + (length (number-to-string + (line-number-at-pos (point-max))))) + "d ") + line) + 'face 'linum))) (eval-after-load 'diff-mode '(progn @@ -173,9 +149,6 @@ comment as a filename." ;; Menu bar doesn't take up additional space, so lets use it. (menu-bar-mode 1) -;; Don't use Apple's native fullscreen (FIXME: Change with Mavericks) -(setq ns-use-native-fullscreen nil) - ;; Auto refresh buffers (global-auto-revert-mode 1) @@ -192,11 +165,6 @@ comment as a filename." ;; Make emacs behave sanely (overwrite selected text) (delete-selection-mode 1) -(defun toggle-native-fullscreen () - "Toggles between native and non-native OS X fullscreen" - (interactive) - (setq ns-use-native-fullscreen (not ns-use-native-fullscreen))) - ;; ## Navigation and key bindings ## (setq windmove-wrap-around t) diff --git a/init.el b/init.el index 473a7b6777..861f64ce22 100644 --- a/init.el +++ b/init.el @@ -1,3 +1,7 @@ +;; Emacs 24 or higher! +(when (< emacs-major-version 24) + (error "This setup requires Emacs v24, or higher. You have: v%d" emacs-major-version)) + ;; Configure package manager (require 'package) @@ -6,7 +10,7 @@ ;; ... and melpa. Melpa packages that exist on marmalade will have ;; precendence. -(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) +;(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) (package-initialize) @@ -14,21 +18,16 @@ (package-refresh-contents)) (defvar my-pkgs - '(ac-nrepl + '(; Basic functionality ace-jump-mode browse-kill-ring - clojure-mode - flycheck flx-ido - haskell-mode - hi2 + flycheck idle-highlight-mode ido-ubiquitous iy-go-to-char magit - markdown-mode multiple-cursors - nrepl nyan-mode paredit projectile @@ -37,9 +36,26 @@ smex switch-window undo-tree - yasnippet) + + ; Clojure + ac-nrepl +; clojure-cheatsheet + clojure-mode + nrepl +; nrepl-eval-sexp-fu +) "A list of packages to install at launch.") +(defvar evil-pkgs + '(evil + evil-leader +; evil-tabs + evil-paredit + key-chord + surround) + "Evil related packages" +) + (dolist (p my-pkgs) (when (not (package-installed-p p)) (package-install p))) @@ -47,39 +63,41 @@ ;; Are we on a mac? (setq is-mac (equal system-type 'darwin)) -(add-to-list 'load-path user-emacs-directory) - -(require 'init-functions) +;; Is this being used by a vim user? +(setq is-vim-mode t) -(unless (file-exists-p "~/.emacs.d/snippets") - (make-directory "~/.emacs.d/snippets")) +(when is-vim-mode + (dolist (p evil-pkgs) + (when (not (package-installed-p p)) + (package-install p)))) -(custom-clone-git "http://github.com/swannodette/clojure-snippets" - "snippets/clojure-mode") +(add-to-list 'load-path user-emacs-directory) -(mapc 'require '(init-settings +(mapc 'require '(init-functions + init-settings init-modes init-bindings init-eshell)) +(when is-vim-mode + (require 'init-evil)) + (add-to-list 'load-path "~/.emacs.d/scripts/") (setq custom-file "~/.emacs.d/init-custom.el") (load custom-file) -(custom-download-script "https://gist.github.com/gongo/1789605/raw/526e3f21dc7d6cef20951cf0ce5d51b90b7821ff/json-reformat.el" - "json-reformat.el") +(custom-download-script + "https://gist.github.com/gongo/1789605/raw/526e3f21dc7d6cef20951cf0ce5d51b90b7821ff/json-reformat.el" + "json-reformat.el") ;; A file with machine specific settings. (load-file-if-exists "~/.emacs.d/init-local.el") -;; IRC configuration (erc) +;; IRC configuration ;; Actual servers and such are loaded from irc.el (load-file-if-exists "~/.emacs.d/init-irc.el") -;; Mail configuration (mu4e && mbsync) -(load-file-if-exists "~/.emacs.d/init-mail.el") - ;; Load magnars' string manipulation library (require 's) -- cgit 1.4.1 From 1ce5c5bdaac3646b7a833932bfcc0baf2b198587 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 17 Oct 2013 14:21:00 +0200 Subject: Evil configuration file --- init-evil.el | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 init-evil.el diff --git a/init-evil.el b/init-evil.el new file mode 100644 index 0000000000..0c4780fddf --- /dev/null +++ b/init-evil.el @@ -0,0 +1,23 @@ +; Basic vim emulation + +(evil-mode t) +(global-evil-tabs-mode 1) + +(evil-ex-define-cmd "Exp[lore]" 'dired-jump) +(evil-ex-define-cmd "color[scheme]" 'customize-themes) + +(evil-define-key 'normal global-map + "\\\\w" 'evil-ace-jump-word-mode) + +(evil-define-key 'normal clojure-mode-map + "\M-q" 'paredit-reindent-defun + "gK" 'nrepl-src + "K" 'ac-nrepl-popup-doc) + +(setq evil-default-cursor '("#ffdd33")) + +;;; Uncomment these key-chord lines if you like that "remap 'jk' to ESC" trick. +;; (key-chord-mode t) +;; (key-chord-define evil-insert-state-map "jk" 'evil-normal-state) + +(provide 'init-evil) -- cgit 1.4.1 From 6d0042f2b0703c9bf7166db92e7f12782d7c280b Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 17 Oct 2013 14:22:04 +0200 Subject: Disabled evil tabs mode (because it's gone??) --- init-evil.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init-evil.el b/init-evil.el index 0c4780fddf..ae2e9fd031 100644 --- a/init-evil.el +++ b/init-evil.el @@ -1,7 +1,7 @@ ; Basic vim emulation (evil-mode t) -(global-evil-tabs-mode 1) +; (global-evil-tabs-mode 1) (evil-ex-define-cmd "Exp[lore]" 'dired-jump) (evil-ex-define-cmd "color[scheme]" 'customize-themes) -- cgit 1.4.1 From a4c4a9dfa9ff396c3917c5cd86c730ad4f85f47d Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 17 Oct 2013 14:22:50 +0200 Subject: Reenabled marmelade --- init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.el b/init.el index 861f64ce22..66b984b09d 100644 --- a/init.el +++ b/init.el @@ -10,7 +10,7 @@ ;; ... and melpa. Melpa packages that exist on marmalade will have ;; precendence. -;(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) +(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) (package-initialize) -- cgit 1.4.1 From f4089367a015454bfb84622748c21378b3b946f5 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 19 Oct 2013 19:31:35 +0200 Subject: Added project-explorer --- init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index 66b984b09d..785a407f67 100644 --- a/init.el +++ b/init.el @@ -30,6 +30,7 @@ multiple-cursors nyan-mode paredit + project-explorer projectile rainbow-delimiters rainbow-mode @@ -64,7 +65,7 @@ (setq is-mac (equal system-type 'darwin)) ;; Is this being used by a vim user? -(setq is-vim-mode t) +(setq is-vim-mode nil) (when is-vim-mode (dolist (p evil-pkgs) -- cgit 1.4.1 From 47f5ddebc0486d8d8c194ae3561d21e6697daf82 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 19 Oct 2013 19:34:30 +0200 Subject: nrepl.el is cider now --- init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.el b/init.el index 785a407f67..d44a46f3ef 100644 --- a/init.el +++ b/init.el @@ -40,9 +40,9 @@ ; Clojure ac-nrepl -; clojure-cheatsheet + clojure-cheatsheet + cider clojure-mode - nrepl ; nrepl-eval-sexp-fu ) "A list of packages to install at launch.") -- cgit 1.4.1 From 6aba1cbda92d082f087c5308fb03c678f24f7d14 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 19 Oct 2013 20:04:45 +0200 Subject: Fix settings for nrepl.el -> cider --- init-bindings.el | 13 +++++++++++++ init-modes.el | 41 +++++++++++++---------------------------- init.el | 1 + 3 files changed, 27 insertions(+), 28 deletions(-) diff --git a/init-bindings.el b/init-bindings.el index 24517fd36c..88b8a6596b 100644 --- a/init-bindings.el +++ b/init-bindings.el @@ -54,4 +54,17 @@ ;; Create new frame (define-key global-map (kbd "C-x C-n") 'make-frame-command) +;; Cider/nrepl stuff +;; I want history up/down without modifiers +(define-key cider-repl-mode-map (kbd "") 'cider-backward-input) +(define-key cider-repl-mode-map (kbd "") 'cider-forward-input) +(define-key cider-repl-mode-map (kbd "C-") 'previous-line) +(define-key cider-repl-mode-map (kbd "C-") 'next-line) + +;; ... and ac-cider with C-c C-d +(define-key cider-repl-mode-map (kbd "C-c C-d") 'ac-nrepl-popup-doc) +(define-key cider-mode-map (kbd "C-c C-d") 'ac-nrepl-popup-doc) +(define-key cider-mode-map (kbd "C-c D") 'cider-doc) + + (provide 'init-bindings) diff --git a/init-modes.el b/init-modes.el index 55b25358bf..e8283df704 100644 --- a/init-modes.el +++ b/init-modes.el @@ -1,4 +1,4 @@ -(mapc 'require '(projectile hi2 ac-nrepl yasnippet)) +(mapc 'require '(projectile ac-nrepl cider)) ;; Initializes modes I use. (add-hook 'prog-mode-hook 'esk-add-watchwords) @@ -19,45 +19,30 @@ 'set-auto-complete-as-completion-at-point-function) -;; Configure nrepl (Clojure REPL) and clojure-mode +;; Configure CIDER (Clojure REPL) and clojure-mode -(defun nrepl-mode-setup () +(defun cider-mode-setup () "Activates paredit, rainbow delimiters and ac-nrepl" (ac-nrepl-setup) - (rainbow-delimiters-mode 1) - (paredit-mode 1)) - -;; Use ac-nrepl for completion -(add-hook 'nrepl-mode-hook 'nrepl-mode-setup) -(add-hook 'nrepl-interaction-mode-hook 'nrepl-mode-setup) - -;; I want history up/down without modifiers -(define-key nrepl-repl-mode-map (kbd "") 'nrepl-backward-input) -(define-key nrepl-repl-mode-map (kbd "") 'nrepl-forward-input) -(define-key nrepl-repl-mode-map (kbd "C-") 'previous-line) -(define-key nrepl-repl-mode-map (kbd "C-") 'next-line) -(define-key nrepl-repl-mode-map (kbd "C-c C-d") 'ac-nrepl-popup-doc) - -(define-key nrepl-interaction-mode-map (kbd "C-c C-d") 'ac-nrepl-popup-doc) -(define-key nrepl-interaction-mode-map (kbd "C-c D") 'nrepl-doc) - + (clojure-mode)) +(add-hook 'cider-repl-mode-hook 'cider-mode-setup) +(add-hook 'cider-interaction-mode-hook 'cider-mode-setup) (eval-after-load "auto-complete" - '(add-to-list 'ac-modes 'nrepl-mode)) + '(add-to-list 'ac-modes 'cider-repl-mode)) ;; Paredit in clojure (add-hook 'clojure-mode-hook 'paredit-mode) ;; eldoc in clojure -(add-hook 'nrepl-interaction-mode-hook - 'nrepl-turn-on-eldoc-mode) - -(add-hook 'nrepl-interaction-mode-hook - 'paredit-mode) +(add-hook 'cider-interaction-mode-hook + 'cider-turn-on-eldoc-mode) ;; Don't annoy me -(setq nrepl-hide-special-buffers t) -(setq nrepl-popup-stacktraces nil) +(setq cider-hide-special-buffers t) +(setq cider-popup-stacktraces nil) +; (setq cider-repl-pop-to-buffer-on-connect nil) +(setq cider-repl-popup-stacktraces t) ;; Enable projectile for all things programming (add-hook 'prog-mode-hook 'projectile-on) diff --git a/init.el b/init.el index d44a46f3ef..90d258dee6 100644 --- a/init.el +++ b/init.el @@ -21,6 +21,7 @@ '(; Basic functionality ace-jump-mode browse-kill-ring + dash flx-ido flycheck idle-highlight-mode -- cgit 1.4.1 From 53162ecd24431387769c2c125f4764ae1c97ac8d Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 19 Oct 2013 22:25:00 +0200 Subject: Don't pop up the Cider REPL after launching --- init-modes.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init-modes.el b/init-modes.el index e8283df704..7117edd96e 100644 --- a/init-modes.el +++ b/init-modes.el @@ -41,7 +41,7 @@ ;; Don't annoy me (setq cider-hide-special-buffers t) (setq cider-popup-stacktraces nil) -; (setq cider-repl-pop-to-buffer-on-connect nil) +(setq cider-repl-pop-to-buffer-on-connect nil) (setq cider-repl-popup-stacktraces t) ;; Enable projectile for all things programming -- cgit 1.4.1 From 8a33aaa7caee17f42df1213e436c2fc84cf2d51d Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 19 Oct 2013 22:44:30 +0200 Subject: Added smart-mode-line In line with this I've finally kicked the Nyan-cat out. Sorry! --- init-custom.el | 15 +++++---------- init-modes.el | 3 --- init-settings.el | 6 ++++++ init.el | 1 + 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/init-custom.el b/init-custom.el index a1333954b0..62510a9e2a 100644 --- a/init-custom.el +++ b/init-custom.el @@ -5,22 +5,17 @@ ;; If there is more than one, they won't work right. '(ac-auto-show-menu 0.8) '(ac-delay 0.2) - '(custom-safe-themes - (quote - ("d0ff5ea54497471567ed15eb7279c37aef3465713fb97a50d46d95fe11ab4739" "2fd1c7f994649d9f879521c4634bd8eddae866db9ff50269a9127b9f93b4e582" "2fb6fbdb644441c4ed1d47f25bed9aa7f7136271c2454ba9a29975d3cfba94c0" "466ae54a7b157ad02fd91da72b7871bccfb9bac98fdab95cf7a0d405c8572bd0" "854dc57026d3226addcc46b2b460034a74609edbd9c14e626769ac724b10fcf5" "8eaa3bce3c618cd81a318fcf2d28c1cd21278531f028feb53186f6387547dfb4" "ea0c5df0f067d2e3c0f048c1f8795af7b873f5014837feb0a7c8317f34417b04" "a234f91f9be6ed40f6ce0e94dce5cea1b9f1ccec2b9ccd42bb71c499867a3fcc" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "d6a00ef5e53adf9b6fe417d2b4404895f26210c52bb8716971be106550cea257" default))) - '(erc-modules - (quote - (autojoin button completion dcc irccontrols list log match menu move-to-prompt netsplit networks noncommands notifications readonly ring scrolltobottom stamp track))) + '(custom-safe-themes (quote ("d0ff5ea54497471567ed15eb7279c37aef3465713fb97a50d46d95fe11ab4739" "2fd1c7f994649d9f879521c4634bd8eddae866db9ff50269a9127b9f93b4e582" "2fb6fbdb644441c4ed1d47f25bed9aa7f7136271c2454ba9a29975d3cfba94c0" "466ae54a7b157ad02fd91da72b7871bccfb9bac98fdab95cf7a0d405c8572bd0" "854dc57026d3226addcc46b2b460034a74609edbd9c14e626769ac724b10fcf5" "8eaa3bce3c618cd81a318fcf2d28c1cd21278531f028feb53186f6387547dfb4" "ea0c5df0f067d2e3c0f048c1f8795af7b873f5014837feb0a7c8317f34417b04" "a234f91f9be6ed40f6ce0e94dce5cea1b9f1ccec2b9ccd42bb71c499867a3fcc" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "d6a00ef5e53adf9b6fe417d2b4404895f26210c52bb8716971be106550cea257" default))) + '(erc-modules (quote (autojoin button completion dcc irccontrols list log match menu move-to-prompt netsplit networks noncommands notifications readonly ring scrolltobottom stamp track))) '(frame-brackground-mode (quote dark)) '(global-auto-complete-mode t) - '(haskell-mode-hook - (quote - (capitalized-words-mode turn-on-haskell-decl-scan turn-on-haskell-doc turn-on-hi2))) + '(haskell-mode-hook (quote (capitalized-words-mode turn-on-haskell-decl-scan turn-on-haskell-doc turn-on-hi2))) '(it-mode-google-cmd "/usr/local/bin/google") '(mu4e-use-fancy-chars t) '(ns-alternate-modifier (quote none)) '(ns-command-modifier (quote meta)) - '(require-final-newline (quote visit-save))) + '(require-final-newline (quote visit-save)) + '(sml/override-theme nil)) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. diff --git a/init-modes.el b/init-modes.el index 7117edd96e..5c8cb2b21e 100644 --- a/init-modes.el +++ b/init-modes.el @@ -64,9 +64,6 @@ ;; Keep track of recent files (recentf-mode) -;; Enable Nyan mode -(nyan-mode 1) - ;; Easily navigate sillycased words (global-subword-mode 1) diff --git a/init-settings.el b/init-settings.el index 4f78a8cc10..470e79b20e 100644 --- a/init-settings.el +++ b/init-settings.el @@ -1,4 +1,6 @@ (require 'uniquify) +(require 'smart-mode-line) + ; ## Generic settings ## ; Hide those ugly tool bars @@ -42,6 +44,10 @@ backup-directory-alist `(("." . ,(concat user-emacs-directory "backups"))) diff-switches "-u") +;; Fix mode line +(if after-init-time (sml/setup) + (add-hook 'after-init-hook 'sml/setup)) + (setq smex-save-file (concat user-emacs-directory ".smex-items")) (smex-initialize) (global-set-key (kbd "M-x") 'smex) diff --git a/init.el b/init.el index 90d258dee6..96c3dde850 100644 --- a/init.el +++ b/init.el @@ -36,6 +36,7 @@ rainbow-delimiters rainbow-mode smex + smart-mode-line switch-window undo-tree -- cgit 1.4.1 From 38f531c926d1c370c6dbad38a1c056951127fdcf Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 19 Oct 2013 22:58:38 +0200 Subject: Cleaned up init-custom --- init-custom.el | 5 ----- 1 file changed, 5 deletions(-) diff --git a/init-custom.el b/init-custom.el index 62510a9e2a..99a6876fc4 100644 --- a/init-custom.el +++ b/init-custom.el @@ -5,13 +5,8 @@ ;; If there is more than one, they won't work right. '(ac-auto-show-menu 0.8) '(ac-delay 0.2) - '(custom-safe-themes (quote ("d0ff5ea54497471567ed15eb7279c37aef3465713fb97a50d46d95fe11ab4739" "2fd1c7f994649d9f879521c4634bd8eddae866db9ff50269a9127b9f93b4e582" "2fb6fbdb644441c4ed1d47f25bed9aa7f7136271c2454ba9a29975d3cfba94c0" "466ae54a7b157ad02fd91da72b7871bccfb9bac98fdab95cf7a0d405c8572bd0" "854dc57026d3226addcc46b2b460034a74609edbd9c14e626769ac724b10fcf5" "8eaa3bce3c618cd81a318fcf2d28c1cd21278531f028feb53186f6387547dfb4" "ea0c5df0f067d2e3c0f048c1f8795af7b873f5014837feb0a7c8317f34417b04" "a234f91f9be6ed40f6ce0e94dce5cea1b9f1ccec2b9ccd42bb71c499867a3fcc" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" "d6a00ef5e53adf9b6fe417d2b4404895f26210c52bb8716971be106550cea257" default))) - '(erc-modules (quote (autojoin button completion dcc irccontrols list log match menu move-to-prompt netsplit networks noncommands notifications readonly ring scrolltobottom stamp track))) '(frame-brackground-mode (quote dark)) '(global-auto-complete-mode t) - '(haskell-mode-hook (quote (capitalized-words-mode turn-on-haskell-decl-scan turn-on-haskell-doc turn-on-hi2))) - '(it-mode-google-cmd "/usr/local/bin/google") - '(mu4e-use-fancy-chars t) '(ns-alternate-modifier (quote none)) '(ns-command-modifier (quote meta)) '(require-final-newline (quote visit-save)) -- cgit 1.4.1 From 96a0605e81443b41373c31a1276d8879523d13eb Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 20 Oct 2013 20:05:13 +0200 Subject: Small defaults changes --- init-bindings.el | 3 +++ init-modes.el | 2 +- init-settings.el | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/init-bindings.el b/init-bindings.el index 88b8a6596b..f44a3d3ed3 100644 --- a/init-bindings.el +++ b/init-bindings.el @@ -39,6 +39,9 @@ ;; So good! (global-set-key (kbd "C-c g") 'magit-status) +;; Open project drawer +(global-set-key (kbd "M-p") 'project-explorer-open) + ;; Add a fullscreen toggle - TODO: reenable in next Emacs release ; (global-set-key (kbd "M-RET") 'toggle-frame-fullscreen) diff --git a/init-modes.el b/init-modes.el index 5c8cb2b21e..ab02bc6c57 100644 --- a/init-modes.el +++ b/init-modes.el @@ -1,4 +1,4 @@ -(mapc 'require '(projectile ac-nrepl cider)) +(mapc 'require '(projectile ac-nrepl cider project-explorer)) ;; Initializes modes I use. (add-hook 'prog-mode-hook 'esk-add-watchwords) diff --git a/init-settings.el b/init-settings.el index 470e79b20e..6388a88ce3 100644 --- a/init-settings.el +++ b/init-settings.el @@ -35,6 +35,7 @@ uniquify-buffer-name-style 'forward whitespace-style '(face trailing lines-tail tabs) whitespace-line-column 80 + default-directory "~" fill-column 80 ediff-window-setup-function 'ediff-setup-windows-plain ediff-diff-options "-w" @@ -101,8 +102,11 @@ (global-hl-line-mode -1) +(set-face-attribute 'default nil :font "Source Code Pro 13") (set-default-font "Source Code Pro 13") +(add-to-list 'after-make-frame-functions 'set-font) + ;; Don't make the nyan cat too long ... I have other stuff in the mode ;; bar as well! (set-variable 'nyan-bar-length 15) -- cgit 1.4.1 From 41a12d8fdf7a2fe10042ca16288b84d1e81bbe15 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 21 Oct 2013 13:28:13 +0200 Subject: Added puppet-mode and evil-tabs --- init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index 96c3dde850..d5455f27dd 100644 --- a/init.el +++ b/init.el @@ -33,6 +33,7 @@ paredit project-explorer projectile + puppet-mode rainbow-delimiters rainbow-mode smex @@ -52,7 +53,7 @@ (defvar evil-pkgs '(evil evil-leader -; evil-tabs + evil-tabs evil-paredit key-chord surround) -- cgit 1.4.1 From a9acb7f560f19a3971922852878418b742872eb3 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 22 Oct 2013 12:06:55 +0200 Subject: clojure-mode kills the REPL -oops! --- init-modes.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init-modes.el b/init-modes.el index ab02bc6c57..b04b2333fc 100644 --- a/init-modes.el +++ b/init-modes.el @@ -24,7 +24,7 @@ (defun cider-mode-setup () "Activates paredit, rainbow delimiters and ac-nrepl" (ac-nrepl-setup) - (clojure-mode)) + (paredit-mode)) (add-hook 'cider-repl-mode-hook 'cider-mode-setup) (add-hook 'cider-interaction-mode-hook 'cider-mode-setup) -- cgit 1.4.1 From 490ea14fadb3dabdf71e6ac55a0a2a1e4f3d9330 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 7 Jan 2014 14:54:32 +0100 Subject: Ignore key-advice from menu-bar options --- init-settings.el | 1 + init.el | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/init-settings.el b/init-settings.el index 6388a88ce3..4aaaa622f2 100644 --- a/init-settings.el +++ b/init-settings.el @@ -50,6 +50,7 @@ (add-hook 'after-init-hook 'sml/setup)) (setq smex-save-file (concat user-emacs-directory ".smex-items")) +(setq smex-key-advice-ignore-menu-bar t) (smex-initialize) (global-set-key (kbd "M-x") 'smex) diff --git a/init.el b/init.el index d5455f27dd..e0a7709454 100644 --- a/init.el +++ b/init.el @@ -12,11 +12,10 @@ ;; precendence. (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) +;; And load things! +(package-refresh-contents) (package-initialize) -(when (not package-archive-contents) - (package-refresh-contents)) - (defvar my-pkgs '(; Basic functionality ace-jump-mode @@ -57,8 +56,7 @@ evil-paredit key-chord surround) - "Evil related packages" -) + "Evil related packages") (dolist (p my-pkgs) (when (not (package-installed-p p)) -- cgit 1.4.1 From 8a5115d5b5aa2330f861f735ea5fe72f5667c4bb Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 30 Jan 2014 14:26:52 +0100 Subject: Some updates --- init-bindings.el | 4 ++-- init-eshell.el | 2 +- init-modes.el | 4 ++++ init-settings.el | 14 +++++++++++--- init.el | 10 +++++----- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/init-bindings.el b/init-bindings.el index f44a3d3ed3..3876f85c5e 100644 --- a/init-bindings.el +++ b/init-bindings.el @@ -59,8 +59,8 @@ ;; Cider/nrepl stuff ;; I want history up/down without modifiers -(define-key cider-repl-mode-map (kbd "") 'cider-backward-input) -(define-key cider-repl-mode-map (kbd "") 'cider-forward-input) +(define-key cider-repl-mode-map (kbd "") 'cider-repl-backward-input) +(define-key cider-repl-mode-map (kbd "") 'cider-repl-forward-input) (define-key cider-repl-mode-map (kbd "C-") 'previous-line) (define-key cider-repl-mode-map (kbd "C-") 'next-line) diff --git a/init-eshell.el b/init-eshell.el index 912f8ee82b..e2191dd4ec 100644 --- a/init-eshell.el +++ b/init-eshell.el @@ -54,7 +54,7 @@ "My EShell prompt displaying VC info and such" (concat (with-face (concat (clean-pwd (eshell/pwd)) " ") :foreground "#96a6c8") - (with-face (vcprompt " -f \"(%s:%b%a%m) \"") :foreground "#5f627f") + ;(with-face (vcprompt " -f \"(%s:%b%a%m) \"") :foreground "#5f627f") (if (= 0 (user-uid)) (with-face "#" :foreground "#f43841") (with-face "$" :foreground "#73c936")) diff --git a/init-modes.el b/init-modes.el index b04b2333fc..0f28b48d17 100644 --- a/init-modes.el +++ b/init-modes.el @@ -53,6 +53,10 @@ ;; Enable Paredit in Emacs Lisp mode (add-hook 'emacs-lisp-mode-hook 'paredit-mode) +;; Configure Haskell mode +;; Indentation ... +(add-hook 'haskell-mode-hook 'hi2-mode) + ;; Always highlight matching brackets (show-paren-mode 1) diff --git a/init-settings.el b/init-settings.el index 4aaaa622f2..97103a298f 100644 --- a/init-settings.el +++ b/init-settings.el @@ -4,8 +4,11 @@ ; ## Generic settings ## ; Hide those ugly tool bars -(tool-bar-mode -1) -(scroll-bar-mode -1) +(tool-bar-mode 0) +(scroll-bar-mode 0) + +;; Go away go away +(setq initial-scratch-message "") (flx-ido-mode 1) (setq ido-use-faces nil) @@ -45,6 +48,11 @@ backup-directory-alist `(("." . ,(concat user-emacs-directory "backups"))) diff-switches "-u") +;; Fix keys on Linux +(if is-linux + (setq x-super-keysym 'meta + x-alt-keysym 'alt)) + ;; Fix mode line (if after-init-time (sml/setup) (add-hook 'after-init-hook 'sml/setup)) @@ -103,7 +111,7 @@ (global-hl-line-mode -1) -(set-face-attribute 'default nil :font "Source Code Pro 13") +(set-face-attribute 'default nil :font "Source Code Pro 12") (set-default-font "Source Code Pro 13") (add-to-list 'after-make-frame-functions 'set-font) diff --git a/init.el b/init.el index e0a7709454..ddf5c50bf1 100644 --- a/init.el +++ b/init.el @@ -13,12 +13,13 @@ (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) ;; And load things! -(package-refresh-contents) +;; (package-refresh-contents) (package-initialize) (defvar my-pkgs '(; Basic functionality ace-jump-mode + ack-and-a-half browse-kill-ring dash flx-ido @@ -65,6 +66,9 @@ ;; Are we on a mac? (setq is-mac (equal system-type 'darwin)) +;; Or on Linux? +(setq is-linux (equal system-type 'gnu/linux)) + ;; Is this being used by a vim user? (setq is-vim-mode nil) @@ -89,10 +93,6 @@ (setq custom-file "~/.emacs.d/init-custom.el") (load custom-file) -(custom-download-script - "https://gist.github.com/gongo/1789605/raw/526e3f21dc7d6cef20951cf0ce5d51b90b7821ff/json-reformat.el" - "json-reformat.el") - ;; A file with machine specific settings. (load-file-if-exists "~/.emacs.d/init-local.el") -- cgit 1.4.1 From 40dfc754d90a9a9876aef5ff5b0a63f4860f03e1 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 1 Feb 2014 21:20:10 +0100 Subject: Visible bell was annoying --- init-settings.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init-settings.el b/init-settings.el index 97103a298f..36c3709f24 100644 --- a/init-settings.el +++ b/init-settings.el @@ -29,7 +29,7 @@ (blink-cursor-mode -1)) ; Fix some defaults -(setq visible-bell t +(setq visible-bell nil inhibit-startup-message t color-theme-is-global t sentence-end-double-space nil -- cgit 1.4.1 From 05d10fae2ad2142555b5dbacf5fc7786ea485dec Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 3 Feb 2014 15:55:19 +0100 Subject: Emacs as a daemon needs font set differently --- init-settings.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/init-settings.el b/init-settings.el index 36c3709f24..0b02335547 100644 --- a/init-settings.el +++ b/init-settings.el @@ -111,8 +111,10 @@ (global-hl-line-mode -1) -(set-face-attribute 'default nil :font "Source Code Pro 12") -(set-default-font "Source Code Pro 13") +(setq default-frame-alist '((font-backend . "xft") + (font . "Source Code Pro-12"))) + +(set-default-font "Source Code Pro 12") (add-to-list 'after-make-frame-functions 'set-font) -- cgit 1.4.1 From bdbc18d285dee458f73c92efeac9a5eb417892e0 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 4 Feb 2014 23:48:29 +0100 Subject: Various things - Disable local file loading for now until I have a solution for the DBus problem - Emacs daemon implicitly starts server --- init-eshell.el | 3 --- init-settings.el | 2 -- init.el | 11 ++++++++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/init-eshell.el b/init-eshell.el index e2191dd4ec..73ec85a565 100644 --- a/init-eshell.el +++ b/init-eshell.el @@ -6,9 +6,6 @@ ;; Hide banner message ... (setq eshell-banner-message "") -(defvar home-dir) -(setq home-dir (expand-file-name "~")) - (defun eshell-mode-hook-setup () "Sets up EShell when it is loaded" (setq eshell-path-env (concat diff --git a/init-settings.el b/init-settings.el index 0b02335547..524275e73f 100644 --- a/init-settings.el +++ b/init-settings.el @@ -116,8 +116,6 @@ (set-default-font "Source Code Pro 12") -(add-to-list 'after-make-frame-functions 'set-font) - ;; Don't make the nyan cat too long ... I have other stuff in the mode ;; bar as well! (set-variable 'nyan-bar-length 15) diff --git a/init.el b/init.el index ddf5c50bf1..fa7f7a5a23 100644 --- a/init.el +++ b/init.el @@ -72,6 +72,10 @@ ;; Is this being used by a vim user? (setq is-vim-mode nil) +;; What's the home folder? +(defvar home-dir) +(setq home-dir (expand-file-name "~")) + (when is-vim-mode (dolist (p evil-pkgs) (when (not (package-installed-p p)) @@ -94,11 +98,11 @@ (load custom-file) ;; A file with machine specific settings. -(load-file-if-exists "~/.emacs.d/init-local.el") +;(load-file-if-exists (concat home-dir "/.emacs.d/init-local.el")) ;; IRC configuration ;; Actual servers and such are loaded from irc.el -(load-file-if-exists "~/.emacs.d/init-irc.el") +; (load-file-if-exists (concat home-dir "/.emacs.d/init-irc.el")) ;; Load magnars' string manipulation library (require 's) @@ -107,4 +111,5 @@ (random t) ;; Start server for emacsclient -(server-start) +;; (server-start) + -- cgit 1.4.1 From 4fd813f0def2a2cf0da5da7f15603765f725e7b7 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 9 Feb 2014 11:12:51 +0100 Subject: Small changes: - No bells at all. Shut up, emacs! - Don't put temporary files everywhere. Just don't! - Don't have scroll bars in new frames --- init-settings.el | 11 ++++++++++- init.el | 3 +-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/init-settings.el b/init-settings.el index 524275e73f..7f239bbde6 100644 --- a/init-settings.el +++ b/init-settings.el @@ -7,6 +7,15 @@ (tool-bar-mode 0) (scroll-bar-mode 0) +(defun disable-scroll-bar () + (scroll-bar-mode 0)) + +; And remember to do it if I create a new frame. +(add-hook 'before-make-frame-hook 'disable-scroll-bar) + +;; Don't make any noises, don't flash, just leave me alone +(setq ring-bell-function 'ignore) + ;; Go away go away (setq initial-scratch-message "") @@ -45,7 +54,7 @@ ediff-split-window-function 'split-window-horizontally oddmuse-directory (concat user-emacs-directory "oddmuse") save-place-file (concat user-emacs-directory "places") - backup-directory-alist `(("." . ,(concat user-emacs-directory "backups"))) + backup-directory-alist `((,(concat user-emacs-directory "backups"))) diff-switches "-u") ;; Fix keys on Linux diff --git a/init.el b/init.el index fa7f7a5a23..5058730327 100644 --- a/init.el +++ b/init.el @@ -13,7 +13,7 @@ (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) ;; And load things! -;; (package-refresh-contents) +(package-refresh-contents) (package-initialize) (defvar my-pkgs @@ -112,4 +112,3 @@ ;; Start server for emacsclient ;; (server-start) - -- cgit 1.4.1 From 479e2447b022ea95b922b6b5c46cb882324d995e Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 25 Feb 2014 17:12:53 +0100 Subject: Updates, updates --- init-bindings.el | 4 ++-- init-modes.el | 8 ++++++-- init.el | 9 +++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/init-bindings.el b/init-bindings.el index 3876f85c5e..17c568c0ea 100644 --- a/init-bindings.el +++ b/init-bindings.el @@ -65,8 +65,8 @@ (define-key cider-repl-mode-map (kbd "C-") 'next-line) ;; ... and ac-cider with C-c C-d -(define-key cider-repl-mode-map (kbd "C-c C-d") 'ac-nrepl-popup-doc) -(define-key cider-mode-map (kbd "C-c C-d") 'ac-nrepl-popup-doc) +(define-key cider-repl-mode-map (kbd "C-c C-d") 'ac-cider-compliment-popup-doc) +(define-key cider-mode-map (kbd "C-c C-d") 'ac-cider-compliment-popup-doc) (define-key cider-mode-map (kbd "C-c D") 'cider-doc) diff --git a/init-modes.el b/init-modes.el index 0f28b48d17..f1a9a37174 100644 --- a/init-modes.el +++ b/init-modes.el @@ -1,4 +1,4 @@ -(mapc 'require '(projectile ac-nrepl cider project-explorer)) +(mapc 'require '(projectile ac-cider-compliment cider)) ;; Initializes modes I use. (add-hook 'prog-mode-hook 'esk-add-watchwords) @@ -23,9 +23,13 @@ (defun cider-mode-setup () "Activates paredit, rainbow delimiters and ac-nrepl" - (ac-nrepl-setup) + (ac-cider-compliment-setup) + (ac-flyspell-workaround) (paredit-mode)) +(eval-after-load "auto-complete" + '(add-to-list 'ac-modes cider-mode)) + (add-hook 'cider-repl-mode-hook 'cider-mode-setup) (add-hook 'cider-interaction-mode-hook 'cider-mode-setup) (eval-after-load "auto-complete" diff --git a/init.el b/init.el index 5058730327..2642901c80 100644 --- a/init.el +++ b/init.el @@ -21,6 +21,7 @@ ace-jump-mode ack-and-a-half browse-kill-ring + confluence dash flx-ido flycheck @@ -31,22 +32,20 @@ multiple-cursors nyan-mode paredit - project-explorer projectile puppet-mode rainbow-delimiters rainbow-mode + s smex smart-mode-line switch-window undo-tree ; Clojure - ac-nrepl - clojure-cheatsheet + ac-cider-compliment cider clojure-mode -; nrepl-eval-sexp-fu ) "A list of packages to install at launch.") @@ -107,6 +106,8 @@ ;; Load magnars' string manipulation library (require 's) +(require 'ack-and-a-half) + ;; Seed RNG (random t) -- cgit 1.4.1 From 0ae66bb85e43ccf06ec3e0c4a9738b467e125f08 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 30 May 2014 20:02:53 +0200 Subject: Some bugfixes --- init-bindings.el | 2 ++ init-custom.el | 5 +++-- init-settings.el | 7 +++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/init-bindings.el b/init-bindings.el index 17c568c0ea..9a4157ba19 100644 --- a/init-bindings.el +++ b/init-bindings.el @@ -69,5 +69,7 @@ (define-key cider-mode-map (kbd "C-c C-d") 'ac-cider-compliment-popup-doc) (define-key cider-mode-map (kbd "C-c D") 'cider-doc) +;; Org-mode agenda keys +(global-set-key (kbd "C-c a") 'org-agenda) (provide 'init-bindings) diff --git a/init-custom.el b/init-custom.el index 99a6876fc4..5ad8ebe983 100644 --- a/init-custom.el +++ b/init-custom.el @@ -5,12 +5,13 @@ ;; If there is more than one, they won't work right. '(ac-auto-show-menu 0.8) '(ac-delay 0.2) + '(custom-safe-themes (quote ("6e92ca53a22d9b0577ad0b16e07e2e020c8b621197e39fec454048e51b7954cb" default))) '(frame-brackground-mode (quote dark)) '(global-auto-complete-mode t) '(ns-alternate-modifier (quote none)) '(ns-command-modifier (quote meta)) - '(require-final-newline (quote visit-save)) - '(sml/override-theme nil)) + '(org-agenda-files (quote ("~/source/spotify-puppet/modules/jira/TODO.org"))) + '(require-final-newline (quote visit-save))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. diff --git a/init-settings.el b/init-settings.el index 7f239bbde6..d432adb382 100644 --- a/init-settings.el +++ b/init-settings.el @@ -62,10 +62,6 @@ (setq x-super-keysym 'meta x-alt-keysym 'alt)) -;; Fix mode line -(if after-init-time (sml/setup) - (add-hook 'after-init-hook 'sml/setup)) - (setq smex-save-file (concat user-emacs-directory ".smex-items")) (setq smex-key-advice-ignore-menu-bar t) (smex-initialize) @@ -234,4 +230,7 @@ (remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function) +;; Set up Java home & path +(setenv "JAVA_HOME" "/opt/java") + (provide 'init-settings) -- cgit 1.4.1 From bbe5e31268640900296822815e1b7476a1e0968a Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 15 Jun 2014 12:22:18 +0200 Subject: Various updates #2 --- init-eshell.el | 1 + init-modes.el | 1 - init.el | 8 ++++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/init-eshell.el b/init-eshell.el index 73ec85a565..69c7104865 100644 --- a/init-eshell.el +++ b/init-eshell.el @@ -12,6 +12,7 @@ "/usr/local/bin:" (concat home-dir "/bin:") "/usr/local/share/python:" + "/opt/java/bin" eshell-path-env)) (setenv "PATH" eshell-path-env)) diff --git a/init-modes.el b/init-modes.el index f1a9a37174..8ec6309d49 100644 --- a/init-modes.el +++ b/init-modes.el @@ -18,7 +18,6 @@ (add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function) - ;; Configure CIDER (Clojure REPL) and clojure-mode (defun cider-mode-setup () diff --git a/init.el b/init.el index 2642901c80..69ca725dad 100644 --- a/init.el +++ b/init.el @@ -30,12 +30,15 @@ iy-go-to-char magit multiple-cursors + mvn nyan-mode paredit + password-store projectile puppet-mode rainbow-delimiters rainbow-mode + rust-mode s smex smart-mode-line @@ -111,5 +114,6 @@ ;; Seed RNG (random t) -;; Start server for emacsclient -;; (server-start) +;; SML should respect theme colours +(setq sml/theme 'black) +(sml/setup) -- cgit 1.4.1 From 10057a887b931b25d93691992c35665cac277fcb Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 21 Oct 2014 19:11:09 +0200 Subject: Several updates after 24.4 upgrade --- init-custom.el | 3 ++- init-modes.el | 2 +- init-settings.el | 9 ++++++++- init.el | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/init-custom.el b/init-custom.el index 5ad8ebe983..18af68c890 100644 --- a/init-custom.el +++ b/init-custom.el @@ -5,9 +5,10 @@ ;; If there is more than one, they won't work right. '(ac-auto-show-menu 0.8) '(ac-delay 0.2) - '(custom-safe-themes (quote ("6e92ca53a22d9b0577ad0b16e07e2e020c8b621197e39fec454048e51b7954cb" default))) + '(custom-safe-themes (quote ("6a37be365d1d95fad2f4d185e51928c789ef7a4ccf17e7ca13ad63a8bf5b922f" "6e92ca53a22d9b0577ad0b16e07e2e020c8b621197e39fec454048e51b7954cb" default))) '(frame-brackground-mode (quote dark)) '(global-auto-complete-mode t) + '(magit-log-show-gpg-status t) '(ns-alternate-modifier (quote none)) '(ns-command-modifier (quote meta)) '(org-agenda-files (quote ("~/source/spotify-puppet/modules/jira/TODO.org"))) diff --git a/init-modes.el b/init-modes.el index 8ec6309d49..9141404b74 100644 --- a/init-modes.el +++ b/init-modes.el @@ -48,7 +48,7 @@ (setq cider-repl-popup-stacktraces t) ;; Enable projectile for all things programming -(add-hook 'prog-mode-hook 'projectile-on) +(add-hook 'prog-mode-hook 'projectile-mode) ;; Enable rainbow-delimiters for all things programming (add-hook 'prog-mode-hook 'rainbow-delimiters-mode) diff --git a/init-settings.el b/init-settings.el index d432adb382..9601752ec6 100644 --- a/init-settings.el +++ b/init-settings.el @@ -230,7 +230,14 @@ (remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function) +;; Display tabs as 4 spaces +(setq default-tab-width 4) + ;; Set up Java home & path -(setenv "JAVA_HOME" "/opt/java") +(setenv "JAVA_HOME" "/usr/lib/jvm/default") + +;; Use CUPS +(setq lpr-command "xpp") + (provide 'init-settings) diff --git a/init.el b/init.el index 69ca725dad..90fc92c09c 100644 --- a/init.el +++ b/init.el @@ -115,5 +115,5 @@ (random t) ;; SML should respect theme colours -(setq sml/theme 'black) +; (setq sml/theme 'black) (sml/setup) -- cgit 1.4.1 From 1f70abb1769a3528f23bc96ee3f570338ace50d3 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 21 Oct 2014 19:37:19 +0200 Subject: Move all configuration to subfolder --- .gitignore | 4 +- init-bindings.el | 75 ---------------- init-custom.el | 29 ------ init-eshell.el | 92 ------------------- init-evil.el | 23 ----- init-functions.el | 102 --------------------- init-misc.el | 9 -- init-modes.el | 80 ----------------- init-settings.el | 243 --------------------------------------------------- init.el | 14 ++- init/bindings.el | 75 ++++++++++++++++ init/custom.el | 29 ++++++ init/eshell-setup.el | 92 +++++++++++++++++++ init/functions.el | 102 +++++++++++++++++++++ init/misc.el | 9 ++ init/modes.el | 80 +++++++++++++++++ init/settings.el | 243 +++++++++++++++++++++++++++++++++++++++++++++++++++ 17 files changed, 638 insertions(+), 663 deletions(-) delete mode 100644 init-bindings.el delete mode 100644 init-custom.el delete mode 100644 init-eshell.el delete mode 100644 init-evil.el delete mode 100644 init-functions.el delete mode 100644 init-misc.el delete mode 100644 init-modes.el delete mode 100644 init-settings.el create mode 100644 init/bindings.el create mode 100644 init/custom.el create mode 100644 init/eshell-setup.el create mode 100644 init/functions.el create mode 100644 init/misc.el create mode 100644 init/modes.el create mode 100644 init/settings.el diff --git a/.gitignore b/.gitignore index 620c180555..0f9b0bae46 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,8 @@ auto-save-list/ clones/ elpa/ -init-irc.el -init-local.el +irc.el +local.el other/ scripts/ themes/ diff --git a/init-bindings.el b/init-bindings.el deleted file mode 100644 index 9a4157ba19..0000000000 --- a/init-bindings.el +++ /dev/null @@ -1,75 +0,0 @@ -;; Various keybindings, most of them taken from starter-kit-bindings - -;; Font size -(define-key global-map (kbd "C-+") 'text-scale-increase) -(define-key global-map (kbd "C--") 'text-scale-decrease) - -;; Use regex searches by default. -(global-set-key (kbd "C-s") 'isearch-forward-regexp) -(global-set-key (kbd "\C-r") 'isearch-backward-regexp) -(global-set-key (kbd "M-%") 'query-replace-regexp) -(global-set-key (kbd "C-M-s") 'isearch-forward) -(global-set-key (kbd "C-M-r") 'isearch-backward) -(global-set-key (kbd "C-M-%") 'query-replace) - -;; Jump to a definition in the current file. (Protip: this is awesome.) -(global-set-key (kbd "C-x C-i") 'imenu) - -;; Ace-jump-mode -(global-set-key (kbd "M-j") 'ace-jump-word-mode) - -;; Jump to next occurence of char -(global-set-key (kbd "C-c f") 'iy-go-to-char) - -;; Window switching. (C-x o goes to the next window) -(windmove-default-keybindings) ;; Shift+direction - -;; Start eshell or switch to it if it's active. -(global-set-key (kbd "C-x m") 'eshell) - -;; Start a new eshell even if one is active. -(global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) - -;; Eval sexp and replace it with result -(global-set-key (kbd "C-c e") 'esk-eval-and-replace) - -;; Start a regular shell if you prefer that. -(global-set-key (kbd "C-x C-m") 'shell) - -;; So good! -(global-set-key (kbd "C-c g") 'magit-status) - -;; Open project drawer -(global-set-key (kbd "M-p") 'project-explorer-open) - -;; Add a fullscreen toggle - TODO: reenable in next Emacs release -; (global-set-key (kbd "M-RET") 'toggle-frame-fullscreen) - -;; Replace standard goto-line with goto-line-with-feedback -(global-set-key (kbd "M-g g") 'goto-line-with-feedback) - -;; Goodness from @magnars -;; I don't need to kill emacs that easily -;; the mnemonic is C-x REALLY QUIT -(global-set-key (kbd "C-x r q") 'save-buffers-kill-terminal) -(global-set-key (kbd "C-x C-c") 'delete-frame) - -;; Create new frame -(define-key global-map (kbd "C-x C-n") 'make-frame-command) - -;; Cider/nrepl stuff -;; I want history up/down without modifiers -(define-key cider-repl-mode-map (kbd "") 'cider-repl-backward-input) -(define-key cider-repl-mode-map (kbd "") 'cider-repl-forward-input) -(define-key cider-repl-mode-map (kbd "C-") 'previous-line) -(define-key cider-repl-mode-map (kbd "C-") 'next-line) - -;; ... and ac-cider with C-c C-d -(define-key cider-repl-mode-map (kbd "C-c C-d") 'ac-cider-compliment-popup-doc) -(define-key cider-mode-map (kbd "C-c C-d") 'ac-cider-compliment-popup-doc) -(define-key cider-mode-map (kbd "C-c D") 'cider-doc) - -;; Org-mode agenda keys -(global-set-key (kbd "C-c a") 'org-agenda) - -(provide 'init-bindings) diff --git a/init-custom.el b/init-custom.el deleted file mode 100644 index 18af68c890..0000000000 --- a/init-custom.el +++ /dev/null @@ -1,29 +0,0 @@ -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(ac-auto-show-menu 0.8) - '(ac-delay 0.2) - '(custom-safe-themes (quote ("6a37be365d1d95fad2f4d185e51928c789ef7a4ccf17e7ca13ad63a8bf5b922f" "6e92ca53a22d9b0577ad0b16e07e2e020c8b621197e39fec454048e51b7954cb" default))) - '(frame-brackground-mode (quote dark)) - '(global-auto-complete-mode t) - '(magit-log-show-gpg-status t) - '(ns-alternate-modifier (quote none)) - '(ns-command-modifier (quote meta)) - '(org-agenda-files (quote ("~/source/spotify-puppet/modules/jira/TODO.org"))) - '(require-final-newline (quote visit-save))) -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(rainbow-delimiters-depth-1-face ((t (:foreground "#2aa198")))) - '(rainbow-delimiters-depth-2-face ((t (:foreground "#b58900")))) - '(rainbow-delimiters-depth-3-face ((t (:foreground "#268bd2")))) - '(rainbow-delimiters-depth-4-face ((t (:foreground "#dc322f")))) - '(rainbow-delimiters-depth-5-face ((t (:foreground "#859900")))) - '(rainbow-delimiters-depth-6-face ((t (:foreground "#268bd2")))) - '(rainbow-delimiters-depth-7-face ((t (:foreground "#cb4b16")))) - '(rainbow-delimiters-depth-8-face ((t (:foreground "#d33682")))) - '(rainbow-delimiters-depth-9-face ((t (:foreground "#839496"))))) diff --git a/init-eshell.el b/init-eshell.el deleted file mode 100644 index 69c7104865..0000000000 --- a/init-eshell.el +++ /dev/null @@ -1,92 +0,0 @@ -;; EShell configuration - -(require 'eshell) - -;; Generic settings -;; Hide banner message ... -(setq eshell-banner-message "") - -(defun eshell-mode-hook-setup () - "Sets up EShell when it is loaded" - (setq eshell-path-env (concat - "/usr/local/bin:" - (concat home-dir "/bin:") - "/usr/local/share/python:" - "/opt/java/bin" - eshell-path-env)) - - (setenv "PATH" eshell-path-env)) - -(add-hook 'eshell-mode-hook 'eshell-mode-hook-setup) - -;; Prompt configuration - -(defun clean-pwd (path) - "Turns a path of the form /foo/bar/baz into /f/b/baz - (inspired by fish shell)" - (let* ((hpath (replace-regexp-in-string home-dir - "~" - path)) - (current-dir (split-string hpath "/")) - (cdir (last current-dir)) - (head (butlast current-dir))) - (concat (mapconcat (lambda (s) - (if (string= "" s) nil - (substring s 0 1))) - head - "/") - (if head "/" nil) - (car cdir)))) - -(defun vcprompt (&optional args) - "Call the external vcprompt command with optional arguments. - VCPrompt" - (replace-regexp-in-string - "\n" "" - (shell-command-to-string (concat "vcprompt" args)))) - -(defmacro with-face (str &rest properties) - `(propertize ,str 'face (list ,@properties))) - -(defun prompt-f () - "My EShell prompt displaying VC info and such" - (concat - (with-face (concat (clean-pwd (eshell/pwd)) " ") :foreground "#96a6c8") - ;(with-face (vcprompt " -f \"(%s:%b%a%m) \"") :foreground "#5f627f") - (if (= 0 (user-uid)) - (with-face "#" :foreground "#f43841") - (with-face "$" :foreground "#73c936")) - (with-face " " :foreground "#95a99f"))) - - -(setq eshell-prompt-function 'prompt-f) -(setq eshell-highlight-prompt nil) -(setq eshell-prompt-regexp "^.+? \\((\\(git\\|svn\\|hg\\|darcs\\|cvs\\|bzr\\):.+?) \\)?[$#] ") - -;; Ignore version control folders in autocompletion -(setq eshell-cmpl-cycle-completions nil - eshell-save-history-on-exit t - eshell-cmpl-dir-ignore "\\`\\(\\.\\.?\\|CVS\\|\\.svn\\|\\.git\\)/\\'") - -;; Load some EShell extensions -(eval-after-load 'esh-opt - '(progn - (require 'em-term) - (require 'em-cmpl) - ;; More visual commands! - (add-to-list 'eshell-visual-commands "ssh") - (add-to-list 'eshell-visual-commands "tail") - (add-to-list 'eshell-visual-commands "sl"))) - -(setq eshell-directory-name "~/.config/eshell/") - -;; EShell functions that come in handy - -;; clear in eshell -(defun eshell/clear () - "clear the eshell buffer." - (interactive) - (let ((inhibit-read-only t)) - (erase-buffer))) - -(provide 'init-eshell) diff --git a/init-evil.el b/init-evil.el deleted file mode 100644 index ae2e9fd031..0000000000 --- a/init-evil.el +++ /dev/null @@ -1,23 +0,0 @@ -; Basic vim emulation - -(evil-mode t) -; (global-evil-tabs-mode 1) - -(evil-ex-define-cmd "Exp[lore]" 'dired-jump) -(evil-ex-define-cmd "color[scheme]" 'customize-themes) - -(evil-define-key 'normal global-map - "\\\\w" 'evil-ace-jump-word-mode) - -(evil-define-key 'normal clojure-mode-map - "\M-q" 'paredit-reindent-defun - "gK" 'nrepl-src - "K" 'ac-nrepl-popup-doc) - -(setq evil-default-cursor '("#ffdd33")) - -;;; Uncomment these key-chord lines if you like that "remap 'jk' to ESC" trick. -;; (key-chord-mode t) -;; (key-chord-define evil-insert-state-map "jk" 'evil-normal-state) - -(provide 'init-evil) diff --git a/init-functions.el b/init-functions.el deleted file mode 100644 index 233d40dd8b..0000000000 --- a/init-functions.el +++ /dev/null @@ -1,102 +0,0 @@ -;; A few handy functions I use in init.el (or not, but they're nice to -;; have) - -(defun custom-download-theme (url filename) - "Downloads a theme through HTTP and places it in ~/.emacs.d/themes" - - ;; Ensure the directory exists - (unless (file-exists-p "~/.emacs.d/themes") - (make-directory "~/.emacs.d/themes")) - - ;; Adds the themes folder to the theme load path (if not already - ;; there) - (unless (member "~/.emacs.d/themes" custom-theme-load-path) - (add-to-list 'custom-theme-load-path "~/.emacs.d/themes")) - - ;; Download file if it doesn't exist. - - (let ((file - (concat "~/.emacs.d/themes/" filename))) - (unless (file-exists-p file) - (url-copy-file url file)))) - -(defun custom-download-script (url filename) - "Downloads an Elisp script, places it in ~/.emacs/other and then loads it" - - ;; Ensure the directory exists - (unless (file-exists-p "~/.emacs.d/other") - (make-directory "~/.emacs.d/other")) - - ;; Download file if it doesn't exist. - (let ((file - (concat "~/.emacs.d/other/" filename))) - (unless (file-exists-p file) - (url-copy-file url file)) - - (load file))) - -(defun keychain-password (account &optional keychain) - "Returns the password for the account, by default it's looked up in the Login.keychain but a - different keychain can be specified." - (let ((k (if keychain keychain "Login.keychain"))) - (replace-regexp-in-string - "\n" "" - (shell-command-to-string (concat "security find-generic-password -w -a " - account - " " - k))))) - -;; This clones a git repository to 'foldername in .emacs.d -;; if there isn't already a folder with that name -(defun custom-clone-git (url foldername) - "Clones a git repository to .emacs.d/foldername" - (let ((fullpath (concat "~/.emacs.d/" foldername))) - (unless (file-exists-p fullpath) - (async-shell-command (concat "git clone " url " " fullpath))))) - -(defun load-file-if-exists (filename) - (if (file-exists-p filename) - (load filename))) - -;; These come from magnars, he's got some awesome things. - -(defun goto-line-with-feedback () - "Show line numbers temporarily, while prompting for the line number input" - (interactive) - (unwind-protect - (progn - (linum-mode 1) - (call-interactively 'goto-line)) - (linum-mode -1))) - - -(defun untabify-buffer () - (interactive) - (untabify (point-min) (point-max))) - -(defun indent-buffer () - (interactive) - (indent-region (point-min) (point-max))) - -(defun cleanup-buffer () - "Perform a bunch of operations on the whitespace content of a buffer. -Including indent-buffer, which should not be called automatically on save." - (interactive) - (untabify-buffer) - (delete-trailing-whitespace) - (indent-buffer)) - -;; These come from the emacs starter kit - -(defun esk-add-watchwords () - (font-lock-add-keywords - nil '(("\\<\\(FIX\\(ME\\)?\\|TODO\\|DEBUG\\|HACK\\|REFACTOR\\|NOCOMMIT\\)" - 1 font-lock-warning-face t)))) - -(defun esk-sudo-edit (&optional arg) - (interactive "p") - (if (or arg (not buffer-file-name)) - (find-file (concat "/sudo:root@localhost:" (ido-read-file-name "File: "))) - (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))) - -(provide 'init-functions) diff --git a/init-misc.el b/init-misc.el deleted file mode 100644 index 87343205b7..0000000000 --- a/init-misc.el +++ /dev/null @@ -1,9 +0,0 @@ -;; For everything that doesn't fit anywhere else. - -;; Ignore .DS_Store files with ido mode -(add-to-list 'ido-ignore-files "\\.DS_Store") - -;; Use aspell for spell checking: brew install aspell --lang=en -(setq ispell-program-name "/usr/local/bin/aspell") - -(provide 'init-misc) diff --git a/init-modes.el b/init-modes.el deleted file mode 100644 index 9141404b74..0000000000 --- a/init-modes.el +++ /dev/null @@ -1,80 +0,0 @@ -(mapc 'require '(projectile ac-cider-compliment cider)) -;; Initializes modes I use. - -(add-hook 'prog-mode-hook 'esk-add-watchwords) -(add-hook 'prog-mode-hook 'idle-highlight-mode) - -;; Configure markdown-mode -(autoload 'markdown-mode "markdown-mode" - "Major mode for editing Markdown files" t) -(add-to-list 'auto-mode-alist '("\\.txt\\'" . markdown-mode)) -(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) -(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) - -;; Use auto-complete as completion at point -(defun set-auto-complete-as-completion-at-point-function () - (setq completion-at-point-functions '(auto-complete))) - -(add-hook 'auto-complete-mode-hook - 'set-auto-complete-as-completion-at-point-function) - -;; Configure CIDER (Clojure REPL) and clojure-mode - -(defun cider-mode-setup () - "Activates paredit, rainbow delimiters and ac-nrepl" - (ac-cider-compliment-setup) - (ac-flyspell-workaround) - (paredit-mode)) - -(eval-after-load "auto-complete" - '(add-to-list 'ac-modes cider-mode)) - -(add-hook 'cider-repl-mode-hook 'cider-mode-setup) -(add-hook 'cider-interaction-mode-hook 'cider-mode-setup) -(eval-after-load "auto-complete" - '(add-to-list 'ac-modes 'cider-repl-mode)) - -;; Paredit in clojure -(add-hook 'clojure-mode-hook 'paredit-mode) - -;; eldoc in clojure -(add-hook 'cider-interaction-mode-hook - 'cider-turn-on-eldoc-mode) - -;; Don't annoy me -(setq cider-hide-special-buffers t) -(setq cider-popup-stacktraces nil) -(setq cider-repl-pop-to-buffer-on-connect nil) -(setq cider-repl-popup-stacktraces t) - -;; Enable projectile for all things programming -(add-hook 'prog-mode-hook 'projectile-mode) - -;; Enable rainbow-delimiters for all things programming -(add-hook 'prog-mode-hook 'rainbow-delimiters-mode) - -;; Enable Paredit in Emacs Lisp mode -(add-hook 'emacs-lisp-mode-hook 'paredit-mode) - -;; Configure Haskell mode -;; Indentation ... -(add-hook 'haskell-mode-hook 'hi2-mode) - -;; Always highlight matching brackets -(show-paren-mode 1) - -;; Represent undo-history as an actual tree (visualize with C-x u) -(setq undo-tree-mode-lighter "") -(require 'undo-tree) -(global-undo-tree-mode) - -;; Keep track of recent files -(recentf-mode) - -;; Easily navigate sillycased words -(global-subword-mode 1) - -;; Transparently open compressed files -(auto-compression-mode t) - -(provide 'init-modes) diff --git a/init-settings.el b/init-settings.el deleted file mode 100644 index 9601752ec6..0000000000 --- a/init-settings.el +++ /dev/null @@ -1,243 +0,0 @@ -(require 'uniquify) -(require 'smart-mode-line) - -; ## Generic settings ## - -; Hide those ugly tool bars -(tool-bar-mode 0) -(scroll-bar-mode 0) - -(defun disable-scroll-bar () - (scroll-bar-mode 0)) - -; And remember to do it if I create a new frame. -(add-hook 'before-make-frame-hook 'disable-scroll-bar) - -;; Don't make any noises, don't flash, just leave me alone -(setq ring-bell-function 'ignore) - -;; Go away go away -(setq initial-scratch-message "") - -(flx-ido-mode 1) -(setq ido-use-faces nil) -(setq gc-cons-threshold 20000000) - -(setq uniquify-buffer-name-style 'forward) - -;;; Code: - -(add-to-list 'exec-path "/usr/local/bin") -(add-to-list 'exec-path (expand-file-name "~/bin")) - - -(when window-system - (setq frame-title-format '(buffer-file-name "%f" ("%b"))) - (tooltip-mode -1) - (mouse-wheel-mode t) - (blink-cursor-mode -1)) - -; Fix some defaults -(setq visible-bell nil - inhibit-startup-message t - color-theme-is-global t - sentence-end-double-space nil - shift-select-mode nil - mouse-yank-at-point t - uniquify-buffer-name-style 'forward - whitespace-style '(face trailing lines-tail tabs) - whitespace-line-column 80 - default-directory "~" - fill-column 80 - ediff-window-setup-function 'ediff-setup-windows-plain - ediff-diff-options "-w" - ediff-split-window-function 'split-window-horizontally - oddmuse-directory (concat user-emacs-directory "oddmuse") - save-place-file (concat user-emacs-directory "places") - backup-directory-alist `((,(concat user-emacs-directory "backups"))) - diff-switches "-u") - -;; Fix keys on Linux -(if is-linux - (setq x-super-keysym 'meta - x-alt-keysym 'alt)) - -(setq smex-save-file (concat user-emacs-directory ".smex-items")) -(setq smex-key-advice-ignore-menu-bar t) -(smex-initialize) -(global-set-key (kbd "M-x") 'smex) - -(add-to-list 'safe-local-variable-values '(lexical-binding . t)) -(add-to-list 'safe-local-variable-values '(whitespace-line-column . 80)) - -(set-default 'indent-tabs-mode nil) - -;; ido-mode is like magic pixie dust! -(ido-mode t) -(ido-ubiquitous t) -(setq ido-enable-prefix nil - ido-enable-flex-matching t - ido-auto-merge-work-directories-length nil - ido-create-new-buffer 'always - ido-use-filename-at-point 'guess - ido-use-virtual-buffers t - ido-handle-duplicate-virtual-buffers 2 - ido-max-prospects 10) - -;; Swedish! -(set-language-environment 'Swedish) - -;; UTF-8 please -(setq locale-coding-system 'utf-8) ; pretty -(set-terminal-coding-system 'utf-8) ; pretty -(set-keyboard-coding-system 'utf-8) ; pretty -(set-selection-coding-system 'utf-8) ; please -(prefer-coding-system 'utf-8) ; with sugar on top - -(require 'ffap) - -(defalias 'yes-or-no-p 'y-or-n-p) -(defalias 'auto-tail-revert-mode 'tail-mode) - -;; ## Look and feel ## - -;; Themes! I download and install the ones I like and default the one -;; I currently like most. This changes a lot because I hate -;; everything. (It's in my nature, don't judge) -(custom-download-theme - "https://raw.github.com/owainlewis/emacs-color-themes/master/themes/hickey-theme.el" - "hickey-theme.el") - -(custom-download-theme - "https://raw.github.com/rexim/gruber-darker-theme/master/gruber-darker-theme.el" - "gruber-darker-theme.el") - -(load-theme 'gruber-darker t) - -(global-hl-line-mode -1) - -(setq default-frame-alist '((font-backend . "xft") - (font . "Source Code Pro-12"))) - -(set-default-font "Source Code Pro 12") - -;; Don't make the nyan cat too long ... I have other stuff in the mode -;; bar as well! -(set-variable 'nyan-bar-length 15) -;; Not the real deal without this ... -(set-variable 'nyan-wavy-trail t) - -;; Style line numbers (shown with M-g g) -(setq linum-format - (lambda (line) - (propertize - (format (concat " %" - (number-to-string - (length (number-to-string - (line-number-at-pos (point-max))))) - "d ") - line) - 'face 'linum))) - -(eval-after-load 'diff-mode - '(progn - (set-face-foreground 'diff-added "green4") - (set-face-foreground 'diff-removed "red3"))) - -(eval-after-load 'magit - '(progn - (set-face-foreground 'magit-diff-add "green4") - (set-face-foreground 'magit-diff-del "red3"))) - -;; ## Mac specific settings ## - -;; Enable mouse support on OS X -(unless window-system - (require 'mouse) - (xterm-mouse-mode t) - (global-set-key [mouse-4] '(lambda () - (interactive) - (scroll-down 1))) - (global-set-key [mouse-5] '(lambda () - (interactive) - (scroll-up 1))) - (defun track-mouse (e)) - - (setq mouse-sel-mode t) -) - -;; Use clipboard properly -(setq x-select-enable-clipboard t) - -;; Settings for Emacs.app (Cocoa Emacs) -;; Menu bar doesn't take up additional space, so lets use it. -(menu-bar-mode 1) - -;; Auto refresh buffers -(global-auto-revert-mode 1) - -;; Also auto refresh dired, but be quiet about it -(setq global-auto-revert-non-file-buffers t) -(setq auto-revert-verbose nil) - -;; Show keystrokes in progress -(setq echo-keystrokes 0.1) - -;; Move files to trash when deleting -(setq delete-by-moving-to-trash t) - -;; Make emacs behave sanely (overwrite selected text) -(delete-selection-mode 1) - -;; ## Navigation and key bindings ## - -(setq windmove-wrap-around t) - -;; Load ace-jump-mode -(autoload - 'ace-jump-mode - "ace-jump-mode" - "Emacs quick move minor mode" - ) - -(define-key global-map [?] 'ace-jump-mode) - -;; Quick jump back -(autoload - 'ace-jump-mode-pop-mark - "ace-jump-mode" - "Ace jump back:-)" - ) - -(eval-after-load "ace-jump-mode" - '(ace-jump-mode-enable-mark-sync)) -(define-key global-map (kbd "C-x ö") 'ace-jump-mode-pop-mark) - -;; Keep your backup files in tmp, emacs! -(setq backup-directory-alist - `((".*" . ,temporary-file-directory))) -(setq auto-save-file-name-transforms - `((".*" ,temporary-file-directory t))) - -;; Eshell -;; Start/join -(global-set-key (kbd "C-x m") 'eshell) -;; Always start -(global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) - -;; Git -(global-set-key (kbd "C-c g") 'magit-status) - -(remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function) - -;; Display tabs as 4 spaces -(setq default-tab-width 4) - -;; Set up Java home & path -(setenv "JAVA_HOME" "/usr/lib/jvm/default") - -;; Use CUPS -(setq lpr-command "xpp") - - -(provide 'init-settings) diff --git a/init.el b/init.el index 90fc92c09c..d91f536e15 100644 --- a/init.el +++ b/init.el @@ -85,18 +85,16 @@ (add-to-list 'load-path user-emacs-directory) -(mapc 'require '(init-functions - init-settings - init-modes - init-bindings - init-eshell)) +(mapc 'require '(functions + settings + modes + bindings + eshell-setup)) (when is-vim-mode (require 'init-evil)) -(add-to-list 'load-path "~/.emacs.d/scripts/") - -(setq custom-file "~/.emacs.d/init-custom.el") +(setq custom-file (concat user-emacs-directory "init/custom.el")) (load custom-file) ;; A file with machine specific settings. diff --git a/init/bindings.el b/init/bindings.el new file mode 100644 index 0000000000..d29081d172 --- /dev/null +++ b/init/bindings.el @@ -0,0 +1,75 @@ +;; Various keybindings, most of them taken from starter-kit-bindings + +;; Font size +(define-key global-map (kbd "C-+") 'text-scale-increase) +(define-key global-map (kbd "C--") 'text-scale-decrease) + +;; Use regex searches by default. +(global-set-key (kbd "C-s") 'isearch-forward-regexp) +(global-set-key (kbd "\C-r") 'isearch-backward-regexp) +(global-set-key (kbd "M-%") 'query-replace-regexp) +(global-set-key (kbd "C-M-s") 'isearch-forward) +(global-set-key (kbd "C-M-r") 'isearch-backward) +(global-set-key (kbd "C-M-%") 'query-replace) + +;; Jump to a definition in the current file. (Protip: this is awesome.) +(global-set-key (kbd "C-x C-i") 'imenu) + +;; Ace-jump-mode +(global-set-key (kbd "M-j") 'ace-jump-word-mode) + +;; Jump to next occurence of char +(global-set-key (kbd "C-c f") 'iy-go-to-char) + +;; Window switching. (C-x o goes to the next window) +(windmove-default-keybindings) ;; Shift+direction + +;; Start eshell or switch to it if it's active. +(global-set-key (kbd "C-x m") 'eshell) + +;; Start a new eshell even if one is active. +(global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) + +;; Eval sexp and replace it with result +(global-set-key (kbd "C-c e") 'esk-eval-and-replace) + +;; Start a regular shell if you prefer that. +(global-set-key (kbd "C-x C-m") 'shell) + +;; So good! +(global-set-key (kbd "C-c g") 'magit-status) + +;; Open project drawer +(global-set-key (kbd "M-p") 'project-explorer-open) + +;; Add a fullscreen toggle - TODO: reenable in next Emacs release +; (global-set-key (kbd "M-RET") 'toggle-frame-fullscreen) + +;; Replace standard goto-line with goto-line-with-feedback +(global-set-key (kbd "M-g g") 'goto-line-with-feedback) + +;; Goodness from @magnars +;; I don't need to kill emacs that easily +;; the mnemonic is C-x REALLY QUIT +(global-set-key (kbd "C-x r q") 'save-buffers-kill-terminal) +(global-set-key (kbd "C-x C-c") 'delete-frame) + +;; Create new frame +(define-key global-map (kbd "C-x C-n") 'make-frame-command) + +;; Cider/nrepl stuff +;; I want history up/down without modifiers +(define-key cider-repl-mode-map (kbd "") 'cider-repl-backward-input) +(define-key cider-repl-mode-map (kbd "") 'cider-repl-forward-input) +(define-key cider-repl-mode-map (kbd "C-") 'previous-line) +(define-key cider-repl-mode-map (kbd "C-") 'next-line) + +;; ... and ac-cider with C-c C-d +(define-key cider-repl-mode-map (kbd "C-c C-d") 'ac-cider-compliment-popup-doc) +(define-key cider-mode-map (kbd "C-c C-d") 'ac-cider-compliment-popup-doc) +(define-key cider-mode-map (kbd "C-c D") 'cider-doc) + +;; Org-mode agenda keys +(global-set-key (kbd "C-c a") 'org-agenda) + +(provide 'bindings) diff --git a/init/custom.el b/init/custom.el new file mode 100644 index 0000000000..18af68c890 --- /dev/null +++ b/init/custom.el @@ -0,0 +1,29 @@ +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(ac-auto-show-menu 0.8) + '(ac-delay 0.2) + '(custom-safe-themes (quote ("6a37be365d1d95fad2f4d185e51928c789ef7a4ccf17e7ca13ad63a8bf5b922f" "6e92ca53a22d9b0577ad0b16e07e2e020c8b621197e39fec454048e51b7954cb" default))) + '(frame-brackground-mode (quote dark)) + '(global-auto-complete-mode t) + '(magit-log-show-gpg-status t) + '(ns-alternate-modifier (quote none)) + '(ns-command-modifier (quote meta)) + '(org-agenda-files (quote ("~/source/spotify-puppet/modules/jira/TODO.org"))) + '(require-final-newline (quote visit-save))) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(rainbow-delimiters-depth-1-face ((t (:foreground "#2aa198")))) + '(rainbow-delimiters-depth-2-face ((t (:foreground "#b58900")))) + '(rainbow-delimiters-depth-3-face ((t (:foreground "#268bd2")))) + '(rainbow-delimiters-depth-4-face ((t (:foreground "#dc322f")))) + '(rainbow-delimiters-depth-5-face ((t (:foreground "#859900")))) + '(rainbow-delimiters-depth-6-face ((t (:foreground "#268bd2")))) + '(rainbow-delimiters-depth-7-face ((t (:foreground "#cb4b16")))) + '(rainbow-delimiters-depth-8-face ((t (:foreground "#d33682")))) + '(rainbow-delimiters-depth-9-face ((t (:foreground "#839496"))))) diff --git a/init/eshell-setup.el b/init/eshell-setup.el new file mode 100644 index 0000000000..43b1c16b33 --- /dev/null +++ b/init/eshell-setup.el @@ -0,0 +1,92 @@ +;; EShell configuration + +(require 'eshell) + +;; Generic settings +;; Hide banner message ... +(setq eshell-banner-message "") + +(defun eshell-mode-hook-setup () + "Sets up EShell when it is loaded" + (setq eshell-path-env (concat + "/usr/local/bin:" + (concat home-dir "/bin:") + "/usr/local/share/python:" + "/opt/java/bin" + eshell-path-env)) + + (setenv "PATH" eshell-path-env)) + +(add-hook 'eshell-mode-hook 'eshell-mode-hook-setup) + +;; Prompt configuration + +(defun clean-pwd (path) + "Turns a path of the form /foo/bar/baz into /f/b/baz + (inspired by fish shell)" + (let* ((hpath (replace-regexp-in-string home-dir + "~" + path)) + (current-dir (split-string hpath "/")) + (cdir (last current-dir)) + (head (butlast current-dir))) + (concat (mapconcat (lambda (s) + (if (string= "" s) nil + (substring s 0 1))) + head + "/") + (if head "/" nil) + (car cdir)))) + +(defun vcprompt (&optional args) + "Call the external vcprompt command with optional arguments. + VCPrompt" + (replace-regexp-in-string + "\n" "" + (shell-command-to-string (concat "vcprompt" args)))) + +(defmacro with-face (str &rest properties) + `(propertize ,str 'face (list ,@properties))) + +(defun prompt-f () + "My EShell prompt displaying VC info and such" + (concat + (with-face (concat (clean-pwd (eshell/pwd)) " ") :foreground "#96a6c8") + ;(with-face (vcprompt " -f \"(%s:%b%a%m) \"") :foreground "#5f627f") + (if (= 0 (user-uid)) + (with-face "#" :foreground "#f43841") + (with-face "$" :foreground "#73c936")) + (with-face " " :foreground "#95a99f"))) + + +(setq eshell-prompt-function 'prompt-f) +(setq eshell-highlight-prompt nil) +(setq eshell-prompt-regexp "^.+? \\((\\(git\\|svn\\|hg\\|darcs\\|cvs\\|bzr\\):.+?) \\)?[$#] ") + +;; Ignore version control folders in autocompletion +(setq eshell-cmpl-cycle-completions nil + eshell-save-history-on-exit t + eshell-cmpl-dir-ignore "\\`\\(\\.\\.?\\|CVS\\|\\.svn\\|\\.git\\)/\\'") + +;; Load some EShell extensions +(eval-after-load 'esh-opt + '(progn + (require 'em-term) + (require 'em-cmpl) + ;; More visual commands! + (add-to-list 'eshell-visual-commands "ssh") + (add-to-list 'eshell-visual-commands "tail") + (add-to-list 'eshell-visual-commands "sl"))) + +(setq eshell-directory-name "~/.config/eshell/") + +;; EShell functions that come in handy + +;; clear in eshell +(defun eshell/clear () + "clear the eshell buffer." + (interactive) + (let ((inhibit-read-only t)) + (erase-buffer))) + +(provide 'eshell-setup) diff --git a/init/functions.el b/init/functions.el new file mode 100644 index 0000000000..e26e1f1bea --- /dev/null +++ b/init/functions.el @@ -0,0 +1,102 @@ +;; A few handy functions I use in init.el (or not, but they're nice to +;; have) + +(defun custom-download-theme (url filename) + "Downloads a theme through HTTP and places it in ~/.emacs.d/themes" + + ;; Ensure the directory exists + (unless (file-exists-p "~/.emacs.d/themes") + (make-directory "~/.emacs.d/themes")) + + ;; Adds the themes folder to the theme load path (if not already + ;; there) + (unless (member "~/.emacs.d/themes" custom-theme-load-path) + (add-to-list 'custom-theme-load-path "~/.emacs.d/themes")) + + ;; Download file if it doesn't exist. + + (let ((file + (concat "~/.emacs.d/themes/" filename))) + (unless (file-exists-p file) + (url-copy-file url file)))) + +(defun custom-download-script (url filename) + "Downloads an Elisp script, places it in ~/.emacs/other and then loads it" + + ;; Ensure the directory exists + (unless (file-exists-p "~/.emacs.d/other") + (make-directory "~/.emacs.d/other")) + + ;; Download file if it doesn't exist. + (let ((file + (concat "~/.emacs.d/other/" filename))) + (unless (file-exists-p file) + (url-copy-file url file)) + + (load file))) + +(defun keychain-password (account &optional keychain) + "Returns the password for the account, by default it's looked up in the Login.keychain but a + different keychain can be specified." + (let ((k (if keychain keychain "Login.keychain"))) + (replace-regexp-in-string + "\n" "" + (shell-command-to-string (concat "security find-generic-password -w -a " + account + " " + k))))) + +;; This clones a git repository to 'foldername in .emacs.d +;; if there isn't already a folder with that name +(defun custom-clone-git (url foldername) + "Clones a git repository to .emacs.d/foldername" + (let ((fullpath (concat "~/.emacs.d/" foldername))) + (unless (file-exists-p fullpath) + (async-shell-command (concat "git clone " url " " fullpath))))) + +(defun load-file-if-exists (filename) + (if (file-exists-p filename) + (load filename))) + +;; These come from magnars, he's got some awesome things. + +(defun goto-line-with-feedback () + "Show line numbers temporarily, while prompting for the line number input" + (interactive) + (unwind-protect + (progn + (linum-mode 1) + (call-interactively 'goto-line)) + (linum-mode -1))) + + +(defun untabify-buffer () + (interactive) + (untabify (point-min) (point-max))) + +(defun indent-buffer () + (interactive) + (indent-region (point-min) (point-max))) + +(defun cleanup-buffer () + "Perform a bunch of operations on the whitespace content of a buffer. +Including indent-buffer, which should not be called automatically on save." + (interactive) + (untabify-buffer) + (delete-trailing-whitespace) + (indent-buffer)) + +;; These come from the emacs starter kit + +(defun esk-add-watchwords () + (font-lock-add-keywords + nil '(("\\<\\(FIX\\(ME\\)?\\|TODO\\|DEBUG\\|HACK\\|REFACTOR\\|NOCOMMIT\\)" + 1 font-lock-warning-face t)))) + +(defun esk-sudo-edit (&optional arg) + (interactive "p") + (if (or arg (not buffer-file-name)) + (find-file (concat "/sudo:root@localhost:" (ido-read-file-name "File: "))) + (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))) + +(provide 'functions) diff --git a/init/misc.el b/init/misc.el new file mode 100644 index 0000000000..9403704930 --- /dev/null +++ b/init/misc.el @@ -0,0 +1,9 @@ +;; For everything that doesn't fit anywhere else. + +;; Ignore .DS_Store files with ido mode +(add-to-list 'ido-ignore-files "\\.DS_Store") + +;; Use aspell for spell checking: brew install aspell --lang=en +(setq ispell-program-name "/usr/local/bin/aspell") + +(provide 'misc) diff --git a/init/modes.el b/init/modes.el new file mode 100644 index 0000000000..a28ece3e57 --- /dev/null +++ b/init/modes.el @@ -0,0 +1,80 @@ +(mapc 'require '(projectile ac-cider-compliment cider)) +;; Initializes modes I use. + +(add-hook 'prog-mode-hook 'esk-add-watchwords) +(add-hook 'prog-mode-hook 'idle-highlight-mode) + +;; Configure markdown-mode +(autoload 'markdown-mode "markdown-mode" + "Major mode for editing Markdown files" t) +(add-to-list 'auto-mode-alist '("\\.txt\\'" . markdown-mode)) +(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) +(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) + +;; Use auto-complete as completion at point +(defun set-auto-complete-as-completion-at-point-function () + (setq completion-at-point-functions '(auto-complete))) + +(add-hook 'auto-complete-mode-hook + 'set-auto-complete-as-completion-at-point-function) + +;; Configure CIDER (Clojure REPL) and clojure-mode + +(defun cider-mode-setup () + "Activates paredit, rainbow delimiters and ac-nrepl" + (ac-cider-compliment-setup) + (ac-flyspell-workaround) + (paredit-mode)) + +(eval-after-load "auto-complete" + '(add-to-list 'ac-modes cider-mode)) + +(add-hook 'cider-repl-mode-hook 'cider-mode-setup) +(add-hook 'cider-interaction-mode-hook 'cider-mode-setup) +(eval-after-load "auto-complete" + '(add-to-list 'ac-modes 'cider-repl-mode)) + +;; Paredit in clojure +(add-hook 'clojure-mode-hook 'paredit-mode) + +;; eldoc in clojure +(add-hook 'cider-interaction-mode-hook + 'cider-turn-on-eldoc-mode) + +;; Don't annoy me +(setq cider-hide-special-buffers t) +(setq cider-popup-stacktraces nil) +(setq cider-repl-pop-to-buffer-on-connect nil) +(setq cider-repl-popup-stacktraces t) + +;; Enable projectile for all things programming +(add-hook 'prog-mode-hook 'projectile-mode) + +;; Enable rainbow-delimiters for all things programming +(add-hook 'prog-mode-hook 'rainbow-delimiters-mode) + +;; Enable Paredit in Emacs Lisp mode +(add-hook 'emacs-lisp-mode-hook 'paredit-mode) + +;; Configure Haskell mode +;; Indentation ... +(add-hook 'haskell-mode-hook 'hi2-mode) + +;; Always highlight matching brackets +(show-paren-mode 1) + +;; Represent undo-history as an actual tree (visualize with C-x u) +(setq undo-tree-mode-lighter "") +(require 'undo-tree) +(global-undo-tree-mode) + +;; Keep track of recent files +(recentf-mode) + +;; Easily navigate sillycased words +(global-subword-mode 1) + +;; Transparently open compressed files +(auto-compression-mode t) + +(provide 'modes) diff --git a/init/settings.el b/init/settings.el new file mode 100644 index 0000000000..8d1b7fbace --- /dev/null +++ b/init/settings.el @@ -0,0 +1,243 @@ +(require 'uniquify) +(require 'smart-mode-line) + +; ## Generic settings ## + +; Hide those ugly tool bars +(tool-bar-mode 0) +(scroll-bar-mode 0) + +(defun disable-scroll-bar () + (scroll-bar-mode 0)) + +; And remember to do it if I create a new frame. +(add-hook 'before-make-frame-hook 'disable-scroll-bar) + +;; Don't make any noises, don't flash, just leave me alone +(setq ring-bell-function 'ignore) + +;; Go away go away +(setq initial-scratch-message "") + +(flx-ido-mode 1) +(setq ido-use-faces nil) +(setq gc-cons-threshold 20000000) + +(setq uniquify-buffer-name-style 'forward) + +;;; Code: + +(add-to-list 'exec-path "/usr/local/bin") +(add-to-list 'exec-path (expand-file-name "~/bin")) + + +(when window-system + (setq frame-title-format '(buffer-file-name "%f" ("%b"))) + (tooltip-mode -1) + (mouse-wheel-mode t) + (blink-cursor-mode -1)) + +; Fix some defaults +(setq visible-bell nil + inhibit-startup-message t + color-theme-is-global t + sentence-end-double-space nil + shift-select-mode nil + mouse-yank-at-point t + uniquify-buffer-name-style 'forward + whitespace-style '(face trailing lines-tail tabs) + whitespace-line-column 80 + default-directory "~" + fill-column 80 + ediff-window-setup-function 'ediff-setup-windows-plain + ediff-diff-options "-w" + ediff-split-window-function 'split-window-horizontally + oddmuse-directory (concat user-emacs-directory "oddmuse") + save-place-file (concat user-emacs-directory "places") + backup-directory-alist `((,(concat user-emacs-directory "backups"))) + diff-switches "-u") + +;; Fix keys on Linux +(if is-linux + (setq x-super-keysym 'meta + x-alt-keysym 'alt)) + +(setq smex-save-file (concat user-emacs-directory ".smex-items")) +(setq smex-key-advice-ignore-menu-bar t) +(smex-initialize) +(global-set-key (kbd "M-x") 'smex) + +(add-to-list 'safe-local-variable-values '(lexical-binding . t)) +(add-to-list 'safe-local-variable-values '(whitespace-line-column . 80)) + +(set-default 'indent-tabs-mode nil) + +;; ido-mode is like magic pixie dust! +(ido-mode t) +(ido-ubiquitous t) +(setq ido-enable-prefix nil + ido-enable-flex-matching t + ido-auto-merge-work-directories-length nil + ido-create-new-buffer 'always + ido-use-filename-at-point 'guess + ido-use-virtual-buffers t + ido-handle-duplicate-virtual-buffers 2 + ido-max-prospects 10) + +;; Swedish! +(set-language-environment 'Swedish) + +;; UTF-8 please +(setq locale-coding-system 'utf-8) ; pretty +(set-terminal-coding-system 'utf-8) ; pretty +(set-keyboard-coding-system 'utf-8) ; pretty +(set-selection-coding-system 'utf-8) ; please +(prefer-coding-system 'utf-8) ; with sugar on top + +(require 'ffap) + +(defalias 'yes-or-no-p 'y-or-n-p) +(defalias 'auto-tail-revert-mode 'tail-mode) + +;; ## Look and feel ## + +;; Themes! I download and install the ones I like and default the one +;; I currently like most. This changes a lot because I hate +;; everything. (It's in my nature, don't judge) +(custom-download-theme + "https://raw.github.com/owainlewis/emacs-color-themes/master/themes/hickey-theme.el" + "hickey-theme.el") + +(custom-download-theme + "https://raw.github.com/rexim/gruber-darker-theme/master/gruber-darker-theme.el" + "gruber-darker-theme.el") + +(load-theme 'gruber-darker t) + +(global-hl-line-mode -1) + +(setq default-frame-alist '((font-backend . "xft") + (font . "Source Code Pro-12"))) + +(set-default-font "Source Code Pro 12") + +;; Don't make the nyan cat too long ... I have other stuff in the mode +;; bar as well! +(set-variable 'nyan-bar-length 15) +;; Not the real deal without this ... +(set-variable 'nyan-wavy-trail t) + +;; Style line numbers (shown with M-g g) +(setq linum-format + (lambda (line) + (propertize + (format (concat " %" + (number-to-string + (length (number-to-string + (line-number-at-pos (point-max))))) + "d ") + line) + 'face 'linum))) + +(eval-after-load 'diff-mode + '(progn + (set-face-foreground 'diff-added "green4") + (set-face-foreground 'diff-removed "red3"))) + +(eval-after-load 'magit + '(progn + (set-face-foreground 'magit-diff-add "green4") + (set-face-foreground 'magit-diff-del "red3"))) + +;; ## Mac specific settings ## + +;; Enable mouse support on OS X +(unless window-system + (require 'mouse) + (xterm-mouse-mode t) + (global-set-key [mouse-4] '(lambda () + (interactive) + (scroll-down 1))) + (global-set-key [mouse-5] '(lambda () + (interactive) + (scroll-up 1))) + (defun track-mouse (e)) + + (setq mouse-sel-mode t) +) + +;; Use clipboard properly +(setq x-select-enable-clipboard t) + +;; Settings for Emacs.app (Cocoa Emacs) +;; Menu bar doesn't take up additional space, so lets use it. +(menu-bar-mode 1) + +;; Auto refresh buffers +(global-auto-revert-mode 1) + +;; Also auto refresh dired, but be quiet about it +(setq global-auto-revert-non-file-buffers t) +(setq auto-revert-verbose nil) + +;; Show keystrokes in progress +(setq echo-keystrokes 0.1) + +;; Move files to trash when deleting +(setq delete-by-moving-to-trash t) + +;; Make emacs behave sanely (overwrite selected text) +(delete-selection-mode 1) + +;; ## Navigation and key bindings ## + +(setq windmove-wrap-around t) + +;; Load ace-jump-mode +(autoload + 'ace-jump-mode + "ace-jump-mode" + "Emacs quick move minor mode" + ) + +(define-key global-map [?] 'ace-jump-mode) + +;; Quick jump back +(autoload + 'ace-jump-mode-pop-mark + "ace-jump-mode" + "Ace jump back:-)" + ) + +(eval-after-load "ace-jump-mode" + '(ace-jump-mode-enable-mark-sync)) +(define-key global-map (kbd "C-x ö") 'ace-jump-mode-pop-mark) + +;; Keep your backup files in tmp, emacs! +(setq backup-directory-alist + `((".*" . ,temporary-file-directory))) +(setq auto-save-file-name-transforms + `((".*" ,temporary-file-directory t))) + +;; Eshell +;; Start/join +(global-set-key (kbd "C-x m") 'eshell) +;; Always start +(global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) + +;; Git +(global-set-key (kbd "C-c g") 'magit-status) + +(remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function) + +;; Display tabs as 4 spaces +(setq default-tab-width 4) + +;; Set up Java home & path +(setenv "JAVA_HOME" "/usr/lib/jvm/default") + +;; Use CUPS +(setq lpr-command "xpp") + + +(provide 'settings) -- cgit 1.4.1 From 677eba3e60b5f1b1473524a83e4d73dae1cba99b Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 21 Oct 2014 19:38:18 +0200 Subject: Cleanup: remove evil stuff & others (Also sneakily adds go-mode and haskell-mode back in) --- init.el | 35 ++++------------------------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/init.el b/init.el index d91f536e15..4a9a4e6c7c 100644 --- a/init.el +++ b/init.el @@ -1,7 +1,3 @@ -;; Emacs 24 or higher! -(when (< emacs-major-version 24) - (error "This setup requires Emacs v24, or higher. You have: v%d" emacs-major-version)) - ;; Configure package manager (require 'package) @@ -25,6 +21,8 @@ dash flx-ido flycheck + go-mode + haskell-mode idle-highlight-mode ido-ubiquitous iy-go-to-char @@ -52,15 +50,6 @@ ) "A list of packages to install at launch.") -(defvar evil-pkgs - '(evil - evil-leader - evil-tabs - evil-paredit - key-chord - surround) - "Evil related packages") - (dolist (p my-pkgs) (when (not (package-installed-p p)) (package-install p))) @@ -71,19 +60,11 @@ ;; Or on Linux? (setq is-linux (equal system-type 'gnu/linux)) -;; Is this being used by a vim user? -(setq is-vim-mode nil) - ;; What's the home folder? (defvar home-dir) (setq home-dir (expand-file-name "~")) -(when is-vim-mode - (dolist (p evil-pkgs) - (when (not (package-installed-p p)) - (package-install p)))) - -(add-to-list 'load-path user-emacs-directory) +(add-to-list 'load-path (concat user-emacs-directory "init")) (mapc 'require '(functions settings @@ -91,19 +72,11 @@ bindings eshell-setup)) -(when is-vim-mode - (require 'init-evil)) +(add-to-list 'load-path (concat user-emacs-directory "scripts")) (setq custom-file (concat user-emacs-directory "init/custom.el")) (load custom-file) -;; A file with machine specific settings. -;(load-file-if-exists (concat home-dir "/.emacs.d/init-local.el")) - -;; IRC configuration -;; Actual servers and such are loaded from irc.el -; (load-file-if-exists (concat home-dir "/.emacs.d/init-irc.el")) - ;; Load magnars' string manipulation library (require 's) -- cgit 1.4.1 From fb9a837c67a3f7e15c89daad168f2982aa3be8cc Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 29 Dec 2014 21:51:25 +0100 Subject: Split out Haskell and Clojure config --- init.el | 5 ++++- init/bindings.el | 12 ------------ init/clojure.el | 45 +++++++++++++++++++++++++++++++++++++++++++++ init/haskell.el | 25 +++++++++++++++++++++++++ init/modes.el | 39 +++++++-------------------------------- 5 files changed, 81 insertions(+), 45 deletions(-) create mode 100644 init/clojure.el create mode 100644 init/haskell.el diff --git a/init.el b/init.el index 4a9a4e6c7c..3e6a074321 100644 --- a/init.el +++ b/init.el @@ -70,7 +70,10 @@ settings modes bindings - eshell-setup)) + eshell-setup + clojure + haskell + )) (add-to-list 'load-path (concat user-emacs-directory "scripts")) diff --git a/init/bindings.el b/init/bindings.el index d29081d172..c62daad544 100644 --- a/init/bindings.el +++ b/init/bindings.el @@ -57,18 +57,6 @@ ;; Create new frame (define-key global-map (kbd "C-x C-n") 'make-frame-command) -;; Cider/nrepl stuff -;; I want history up/down without modifiers -(define-key cider-repl-mode-map (kbd "") 'cider-repl-backward-input) -(define-key cider-repl-mode-map (kbd "") 'cider-repl-forward-input) -(define-key cider-repl-mode-map (kbd "C-") 'previous-line) -(define-key cider-repl-mode-map (kbd "C-") 'next-line) - -;; ... and ac-cider with C-c C-d -(define-key cider-repl-mode-map (kbd "C-c C-d") 'ac-cider-compliment-popup-doc) -(define-key cider-mode-map (kbd "C-c C-d") 'ac-cider-compliment-popup-doc) -(define-key cider-mode-map (kbd "C-c D") 'cider-doc) - ;; Org-mode agenda keys (global-set-key (kbd "C-c a") 'org-agenda) diff --git a/init/clojure.el b/init/clojure.el new file mode 100644 index 0000000000..5ec4848b8f --- /dev/null +++ b/init/clojure.el @@ -0,0 +1,45 @@ +(require 'cider) +(require 'ac-cider-compliment) + +;; Configure CIDER (Clojure REPL) and clojure-mode + +(defun cider-mode-setup () + "Activates paredit, rainbow delimiters and ac-nrepl" + (ac-cider-compliment-setup) + (ac-flyspell-workaround) + (paredit-mode)) + +(eval-after-load "auto-complete" + '(add-to-list 'ac-modes cider-mode)) + +(add-hook 'cider-repl-mode-hook 'cider-mode-setup) +(add-hook 'cider-interaction-mode-hook 'cider-mode-setup) +(eval-after-load "auto-complete" + '(add-to-list 'ac-modes 'cider-repl-mode)) + +;; Paredit in clojure +(add-hook 'clojure-mode-hook 'paredit-mode) + +;; eldoc in clojure +(add-hook 'cider-interaction-mode-hook + 'cider-turn-on-eldoc-mode) + +;; Don't annoy me +(setq cider-hide-special-buffers t) +(setq cider-popup-stacktraces nil) +(setq cider-repl-pop-to-buffer-on-connect nil) +(setq cider-repl-popup-stacktraces t) + +;; I want history up/down without modifiers +(define-key cider-repl-mode-map (kbd "") 'cider-repl-backward-input) +(define-key cider-repl-mode-map (kbd "") 'cider-repl-forward-input) +(define-key cider-repl-mode-map (kbd "C-") 'previous-line) +(define-key cider-repl-mode-map (kbd "C-") 'next-line) + +;; ... and ac-cider with C-c C-d +(define-key cider-repl-mode-map (kbd "C-c C-d") 'ac-cider-compliment-popup-doc) +(define-key cider-mode-map (kbd "C-c C-d") 'ac-cider-compliment-popup-doc) +(define-key cider-mode-map (kbd "C-c D") 'cider-doc) + + +(provide 'clojure) diff --git a/init/haskell.el b/init/haskell.el new file mode 100644 index 0000000000..af105e00e8 --- /dev/null +++ b/init/haskell.el @@ -0,0 +1,25 @@ +(require 'haskell-mode) + +;; Setup for Haskell mode + +;; Bindings + +(eval-after-load "haskell-mode" + '(define-key haskell-mode-map (kbd "C-c C-c") 'haskell-compile)) + +(eval-after-load "haskell-cabal" + '(define-key haskell-cabal-mode-map (kbd "C-c C-c") 'haskell-compile)) + +(add-hook 'haskell-mode-hook 'hi2-mode) + +;; Settings + +(setq haskell-interactive-popup-errors t + haskell-stylish-on-save t + haskell-tags-on-save t + haskell-process-suggest-remove-import-types t + haskell-process-auto-import-loaded-modules t + haskell-process-log t + haskell-process-type 'cabal-repl) + +(provide 'haskell) diff --git a/init/modes.el b/init/modes.el index a28ece3e57..c1d5c37253 100644 --- a/init/modes.el +++ b/init/modes.el @@ -1,4 +1,5 @@ -(mapc 'require '(projectile ac-cider-compliment cider)) +(require 'projectile) + ;; Initializes modes I use. (add-hook 'prog-mode-hook 'esk-add-watchwords) @@ -18,34 +19,12 @@ (add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function) -;; Configure CIDER (Clojure REPL) and clojure-mode - -(defun cider-mode-setup () - "Activates paredit, rainbow delimiters and ac-nrepl" - (ac-cider-compliment-setup) - (ac-flyspell-workaround) - (paredit-mode)) - -(eval-after-load "auto-complete" - '(add-to-list 'ac-modes cider-mode)) - -(add-hook 'cider-repl-mode-hook 'cider-mode-setup) -(add-hook 'cider-interaction-mode-hook 'cider-mode-setup) -(eval-after-load "auto-complete" - '(add-to-list 'ac-modes 'cider-repl-mode)) +;; Configure Erlang mode -;; Paredit in clojure -(add-hook 'clojure-mode-hook 'paredit-mode) - -;; eldoc in clojure -(add-hook 'cider-interaction-mode-hook - 'cider-turn-on-eldoc-mode) - -;; Don't annoy me -(setq cider-hide-special-buffers t) -(setq cider-popup-stacktraces nil) -(setq cider-repl-pop-to-buffer-on-connect nil) -(setq cider-repl-popup-stacktraces t) +;; Don't indent after '>' while I'm writing +(add-hook 'erlang-mode-hook + '(lambda () + (local-set-key ">" 'self-insert-command))) ;; Enable projectile for all things programming (add-hook 'prog-mode-hook 'projectile-mode) @@ -56,10 +35,6 @@ ;; Enable Paredit in Emacs Lisp mode (add-hook 'emacs-lisp-mode-hook 'paredit-mode) -;; Configure Haskell mode -;; Indentation ... -(add-hook 'haskell-mode-hook 'hi2-mode) - ;; Always highlight matching brackets (show-paren-mode 1) -- cgit 1.4.1 From a21aeac72cd3cfd153edfd0bcaf9d1d1b031914a Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 29 Dec 2014 21:52:21 +0100 Subject: General cleanup --- init.el | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/init.el b/init.el index 3e6a074321..da93bf1eb8 100644 --- a/init.el +++ b/init.el @@ -13,41 +13,44 @@ (package-initialize) (defvar my-pkgs - '(; Basic functionality + '(;; All packages + ac-cider-compliment ace-jump-mode ack-and-a-half browse-kill-ring + cider + clojure-mode confluence dash + dockerfile-mode flx-ido flycheck go-mode haskell-mode + hi2 idle-highlight-mode ido-ubiquitous iy-go-to-char magit + markdown-mode+ multiple-cursors mvn nyan-mode paredit password-store + pkgbuild-mode projectile puppet-mode rainbow-delimiters rainbow-mode rust-mode s - smex smart-mode-line + smex switch-window undo-tree - - ; Clojure - ac-cider-compliment - cider - clojure-mode -) + yaml-mode + ) "A list of packages to install at launch.") (dolist (p my-pkgs) @@ -89,5 +92,5 @@ (random t) ;; SML should respect theme colours -; (setq sml/theme 'black) +;; (setq sml/theme 'black) (sml/setup) -- cgit 1.4.1 From e5ece0c35a3ea0d6cbc155453786e8922ea2ab34 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 16 Jan 2015 14:42:31 +0100 Subject: [haskell] Split out haskell config into new file --- init.el | 2 +- init/haskell-setup.el | 34 ++++++++++++++++++++++++++++++++++ init/haskell.el | 25 ------------------------- 3 files changed, 35 insertions(+), 26 deletions(-) create mode 100644 init/haskell-setup.el delete mode 100644 init/haskell.el diff --git a/init.el b/init.el index da93bf1eb8..26c5dfab82 100644 --- a/init.el +++ b/init.el @@ -75,7 +75,7 @@ bindings eshell-setup clojure - haskell + haskell-setup )) (add-to-list 'load-path (concat user-emacs-directory "scripts")) diff --git a/init/haskell-setup.el b/init/haskell-setup.el new file mode 100644 index 0000000000..bd61013c25 --- /dev/null +++ b/init/haskell-setup.el @@ -0,0 +1,34 @@ +(require 'haskell-mode) + +;; Setup for Haskell mode + +(add-hook 'haskell-mode-hook 'interactive-haskell-mode) +(add-hook 'haskell-mode-hook 'hi2-mode) + +;; Bindings + +(defun haskell-mode-binding-setup () + (interactive) + (define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-or-reload) + (define-key haskell-mode-map (kbd "C-c C-c") 'haskell-compile) + (define-key haskell-mode-map (kbd "C-r") 'haskell-interactive-bring) + (define-key haskell-mode-map (kbd "SPC") 'haskell-mode-contextual-space)) + +(eval-after-load "haskell-mode" + '(haskell-mode-binding-setup)) + +(eval-after-load "haskell-cabal" + '(define-key haskell-cabal-mode-map (kbd "C-c C-c") 'haskell-compile)) + +;; Settings + +(setq haskell-interactive-popup-errors nil + haskell-stylish-on-save t + haskell-tags-on-save t + haskell-process-suggest-remove-import-types t + haskell-process-auto-import-loaded-modules t + haskell-process-log t + haskell-process-type 'ghci + haskell-process-show-debug-tips nil) + +(provide 'haskell-setup) diff --git a/init/haskell.el b/init/haskell.el deleted file mode 100644 index af105e00e8..0000000000 --- a/init/haskell.el +++ /dev/null @@ -1,25 +0,0 @@ -(require 'haskell-mode) - -;; Setup for Haskell mode - -;; Bindings - -(eval-after-load "haskell-mode" - '(define-key haskell-mode-map (kbd "C-c C-c") 'haskell-compile)) - -(eval-after-load "haskell-cabal" - '(define-key haskell-cabal-mode-map (kbd "C-c C-c") 'haskell-compile)) - -(add-hook 'haskell-mode-hook 'hi2-mode) - -;; Settings - -(setq haskell-interactive-popup-errors t - haskell-stylish-on-save t - haskell-tags-on-save t - haskell-process-suggest-remove-import-types t - haskell-process-auto-import-loaded-modules t - haskell-process-log t - haskell-process-type 'cabal-repl) - -(provide 'haskell) -- cgit 1.4.1 From d9bd9ef50c19a6b918a490b429d6571685446c22 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 16 Jan 2015 14:42:48 +0100 Subject: [init] Add Erlang config --- init.el | 1 + init/modes.el | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/init.el b/init.el index 26c5dfab82..d650eb2b59 100644 --- a/init.el +++ b/init.el @@ -23,6 +23,7 @@ confluence dash dockerfile-mode + erlang flx-ido flycheck go-mode diff --git a/init/modes.el b/init/modes.el index c1d5c37253..6ed5c7ee3f 100644 --- a/init/modes.el +++ b/init/modes.el @@ -21,10 +21,14 @@ ;; Configure Erlang mode -;; Don't indent after '>' while I'm writing -(add-hook 'erlang-mode-hook - '(lambda () - (local-set-key ">" 'self-insert-command))) +(defun erlang-mode-init-setup () + (interactive) + ;; Don't indent after '>' while I'm writing + (local-set-key ">" 'self-insert-command) + ;(local-set-key "RET" 'newline) + ) + +(add-hook 'erlang-mode-hook 'erlang-mode-init-setup) ;; Enable projectile for all things programming (add-hook 'prog-mode-hook 'projectile-mode) -- cgit 1.4.1 From 4cca819886657fe6300435ed97296a9848995cc8 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 20 Feb 2015 11:45:37 +0100 Subject: Minor changes * use ace-jump-line-mode for quick line jumping * column-number-mode enabled by default --- init/bindings.el | 6 +++--- init/functions.el | 7 +++++++ init/settings.el | 3 +++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/init/bindings.el b/init/bindings.el index c62daad544..e6128aaa78 100644 --- a/init/bindings.el +++ b/init/bindings.el @@ -31,7 +31,7 @@ (global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) ;; Eval sexp and replace it with result -(global-set-key (kbd "C-c e") 'esk-eval-and-replace) +(global-set-key (kbd "C-c e") 'replace-last-sexp) ;; Start a regular shell if you prefer that. (global-set-key (kbd "C-x C-m") 'shell) @@ -45,8 +45,8 @@ ;; Add a fullscreen toggle - TODO: reenable in next Emacs release ; (global-set-key (kbd "M-RET") 'toggle-frame-fullscreen) -;; Replace standard goto-line with goto-line-with-feedback -(global-set-key (kbd "M-g g") 'goto-line-with-feedback) +;; Replace standard goto-line with ace-jump-line-mode +(global-set-key (kbd "M-g g") 'ace-jump-line-mode) ;; Goodness from @magnars ;; I don't need to kill emacs that easily diff --git a/init/functions.el b/init/functions.el index e26e1f1bea..a0bf51a9e0 100644 --- a/init/functions.el +++ b/init/functions.el @@ -99,4 +99,11 @@ Including indent-buffer, which should not be called automatically on save." (find-file (concat "/sudo:root@localhost:" (ido-read-file-name "File: "))) (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))) +;; Evaluate sexp and replace it with result +(defun replace-last-sexp () + (interactive) + (let ((value (eval (preceding-sexp)))) + (kill-sexp -1) + (insert (format "%S" value)))) + (provide 'functions) diff --git a/init/settings.el b/init/settings.el index 8d1b7fbace..6c81536df1 100644 --- a/init/settings.el +++ b/init/settings.el @@ -25,6 +25,9 @@ (setq uniquify-buffer-name-style 'forward) +;; Give me column numbers +(column-number-mode t) + ;;; Code: (add-to-list 'exec-path "/usr/local/bin") -- cgit 1.4.1 From d45518f7c33ed5dc3b41711d70ae12b960d2e9e7 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 11 Mar 2015 14:42:58 +0100 Subject: Add bindings for whitespace cleanup, line jumping & Fefes Blog --- init/bindings.el | 10 +++++++--- init/functions.el | 5 +++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/init/bindings.el b/init/bindings.el index e6128aaa78..32579919b6 100644 --- a/init/bindings.el +++ b/init/bindings.el @@ -42,11 +42,12 @@ ;; Open project drawer (global-set-key (kbd "M-p") 'project-explorer-open) -;; Add a fullscreen toggle - TODO: reenable in next Emacs release -; (global-set-key (kbd "M-RET") 'toggle-frame-fullscreen) - ;; Replace standard goto-line with ace-jump-line-mode (global-set-key (kbd "M-g g") 'ace-jump-line-mode) +(global-set-key (kbd "M-g M-g") 'goto-line-with-feedback) + +;; Bind whitespace cleanup to a key +(global-set-key (kbd "C-c w") 'whitespace-cleanup) ;; Goodness from @magnars ;; I don't need to kill emacs that easily @@ -60,4 +61,7 @@ ;; Org-mode agenda keys (global-set-key (kbd "C-c a") 'org-agenda) +;; Open Fefes Blog +(global-set-key (kbd "C-c C-f") 'fefes-blog) + (provide 'bindings) diff --git a/init/functions.el b/init/functions.el index a0bf51a9e0..6389931bc0 100644 --- a/init/functions.el +++ b/init/functions.el @@ -106,4 +106,9 @@ Including indent-buffer, which should not be called automatically on save." (kill-sexp -1) (insert (format "%S" value)))) +;; Open Fefes blog +(defun fefes-blog () + (interactive) + (eww "https://blog.fefe.de/")) + (provide 'functions) -- cgit 1.4.1 From ee070585df022e410158a7f078084f767361fd6f Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 3 May 2015 18:22:08 +0200 Subject: Use ag instead of ack --- init.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/init.el b/init.el index d650eb2b59..8928e284be 100644 --- a/init.el +++ b/init.el @@ -16,7 +16,7 @@ '(;; All packages ac-cider-compliment ace-jump-mode - ack-and-a-half + ag browse-kill-ring cider clojure-mode @@ -87,8 +87,6 @@ ;; Load magnars' string manipulation library (require 's) -(require 'ack-and-a-half) - ;; Seed RNG (random t) -- cgit 1.4.1 From 90f4e2811d1ca951eed2ce435a3dc63c56798788 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 3 May 2015 18:22:58 +0200 Subject: Minor changes --- init.el | 1 + init/bindings.el | 7 ++++--- init/custom.el | 6 ++++-- init/modes.el | 4 +++- init/settings.el | 3 +++ 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/init.el b/init.el index 8928e284be..ef2fbeb539 100644 --- a/init.el +++ b/init.el @@ -35,6 +35,7 @@ magit markdown-mode+ multiple-cursors + multi-term mvn nyan-mode paredit diff --git a/init/bindings.el b/init/bindings.el index 32579919b6..38540968db 100644 --- a/init/bindings.el +++ b/init/bindings.el @@ -17,6 +17,7 @@ ;; Ace-jump-mode (global-set-key (kbd "M-j") 'ace-jump-word-mode) +(global-set-key (kbd "M-p") 'ace-jump-mode-pop-mark) ;; Jump to next occurence of char (global-set-key (kbd "C-c f") 'iy-go-to-char) @@ -39,9 +40,6 @@ ;; So good! (global-set-key (kbd "C-c g") 'magit-status) -;; Open project drawer -(global-set-key (kbd "M-p") 'project-explorer-open) - ;; Replace standard goto-line with ace-jump-line-mode (global-set-key (kbd "M-g g") 'ace-jump-line-mode) (global-set-key (kbd "M-g M-g") 'goto-line-with-feedback) @@ -58,6 +56,9 @@ ;; Create new frame (define-key global-map (kbd "C-x C-n") 'make-frame-command) +;; Recompile easily +(define-key prog-mode-map (kbd "C-c r") 'recompile) + ;; Org-mode agenda keys (global-set-key (kbd "C-c a") 'org-agenda) diff --git a/init/custom.el b/init/custom.el index 18af68c890..99cb135253 100644 --- a/init/custom.el +++ b/init/custom.el @@ -5,14 +5,16 @@ ;; If there is more than one, they won't work right. '(ac-auto-show-menu 0.8) '(ac-delay 0.2) - '(custom-safe-themes (quote ("6a37be365d1d95fad2f4d185e51928c789ef7a4ccf17e7ca13ad63a8bf5b922f" "6e92ca53a22d9b0577ad0b16e07e2e020c8b621197e39fec454048e51b7954cb" default))) + '(custom-safe-themes + (quote + ("3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "72e42ba8f32bbf4a0b30c4c25f378289058efb1790dbd9a3e7c3d9666cc7fee4" "0e7da2c7c64fb5d4764250ffa4b8b33c0946577108d1d6444f1020d0dabba784" "6a37be365d1d95fad2f4d185e51928c789ef7a4ccf17e7ca13ad63a8bf5b922f" "6e92ca53a22d9b0577ad0b16e07e2e020c8b621197e39fec454048e51b7954cb" default))) '(frame-brackground-mode (quote dark)) '(global-auto-complete-mode t) '(magit-log-show-gpg-status t) '(ns-alternate-modifier (quote none)) '(ns-command-modifier (quote meta)) '(org-agenda-files (quote ("~/source/spotify-puppet/modules/jira/TODO.org"))) - '(require-final-newline (quote visit-save))) + '(require-final-newline (quote visit-save)) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. diff --git a/init/modes.el b/init/modes.el index 6ed5c7ee3f..400daffa49 100644 --- a/init/modes.el +++ b/init/modes.el @@ -25,7 +25,9 @@ (interactive) ;; Don't indent after '>' while I'm writing (local-set-key ">" 'self-insert-command) - ;(local-set-key "RET" 'newline) + ;;(local-set-key "RET" 'newline) + (projectile-mode 1) + (rainbow-delimiters-mode 1) ) (add-hook 'erlang-mode-hook 'erlang-mode-init-setup) diff --git a/init/settings.el b/init/settings.el index 6c81536df1..72959026af 100644 --- a/init/settings.el +++ b/init/settings.el @@ -28,6 +28,9 @@ ;; Give me column numbers (column-number-mode t) +;; Bash is the reliable one here +(setq multi-term-program "/bin/bash") + ;;; Code: (add-to-list 'exec-path "/usr/local/bin") -- cgit 1.4.1 From c2ef13da72a27822810a9823f208b4c4edf7f49b Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 18 May 2015 14:21:39 +0200 Subject: Remove melpa, fix custom.el --- init.el | 4 ++-- init/custom.el | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/init.el b/init.el index ef2fbeb539..d1bd702da8 100644 --- a/init.el +++ b/init.el @@ -2,11 +2,11 @@ (require 'package) ;; Add Marmalade repo -(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/")) +(add-to-list 'package-archives '("marmalade" . "https://marmalade-repo.org/packages/")) ;; ... and melpa. Melpa packages that exist on marmalade will have ;; precendence. -(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) +; (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) ;; And load things! (package-refresh-contents) diff --git a/init/custom.el b/init/custom.el index 99cb135253..68a4bed78a 100644 --- a/init/custom.el +++ b/init/custom.el @@ -13,7 +13,6 @@ '(magit-log-show-gpg-status t) '(ns-alternate-modifier (quote none)) '(ns-command-modifier (quote meta)) - '(org-agenda-files (quote ("~/source/spotify-puppet/modules/jira/TODO.org"))) '(require-final-newline (quote visit-save)) (custom-set-faces ;; custom-set-faces was added by Custom. @@ -28,4 +27,4 @@ '(rainbow-delimiters-depth-6-face ((t (:foreground "#268bd2")))) '(rainbow-delimiters-depth-7-face ((t (:foreground "#cb4b16")))) '(rainbow-delimiters-depth-8-face ((t (:foreground "#d33682")))) - '(rainbow-delimiters-depth-9-face ((t (:foreground "#839496"))))) + '(rainbow-delimiters-depth-9-face ((t (:foreground "#839496")))))) -- cgit 1.4.1 From 560176bc7789c2b0aa12b4dbab064f328c3454a5 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 21 May 2015 12:03:46 +0200 Subject: Use GPG-agent's SSH agent (for Tramp etc.) --- init/settings.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init/settings.el b/init/settings.el index 72959026af..f58063a5dc 100644 --- a/init/settings.el +++ b/init/settings.el @@ -31,6 +31,9 @@ ;; Bash is the reliable one here (setq multi-term-program "/bin/bash") +;; Use the GPG-provided SSH agent +(setenv "SSH_AUTH_SOCK" (concat (getenv "HOME") "/.gnupg/S.gpg-agent.ssh")) + ;;; Code: (add-to-list 'exec-path "/usr/local/bin") -- cgit 1.4.1 From af87ca21eeffe7faa7663ed23af20374f0407168 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 14 Dec 2015 00:04:29 +0100 Subject: Various changes --- init.el | 10 +++++----- init/clojure.el | 4 ++-- init/custom.el | 10 +++++++--- init/settings.el | 17 +++++------------ 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/init.el b/init.el index d1bd702da8..9358bb6c01 100644 --- a/init.el +++ b/init.el @@ -6,7 +6,7 @@ ;; ... and melpa. Melpa packages that exist on marmalade will have ;; precendence. -; (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) +(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) ;; And load things! (package-refresh-contents) @@ -14,7 +14,6 @@ (defvar my-pkgs '(;; All packages - ac-cider-compliment ace-jump-mode ag browse-kill-ring @@ -36,8 +35,6 @@ markdown-mode+ multiple-cursors multi-term - mvn - nyan-mode paredit password-store pkgbuild-mode @@ -85,6 +82,9 @@ (setq custom-file (concat user-emacs-directory "init/custom.el")) (load custom-file) +;; Local configuration +(load-file-if-exists "~/.emacs.d/init/local.el") + ;; Load magnars' string manipulation library (require 's) @@ -92,5 +92,5 @@ (random t) ;; SML should respect theme colours -;; (setq sml/theme 'black) +;; (setq sml/theme 'powerline) (sml/setup) diff --git a/init/clojure.el b/init/clojure.el index 5ec4848b8f..c88c86f4e3 100644 --- a/init/clojure.el +++ b/init/clojure.el @@ -1,11 +1,11 @@ (require 'cider) -(require 'ac-cider-compliment) +;(require 'ac-cider-compliment) ;; Configure CIDER (Clojure REPL) and clojure-mode (defun cider-mode-setup () "Activates paredit, rainbow delimiters and ac-nrepl" - (ac-cider-compliment-setup) + ; (ac-cider-compliment-setup) (ac-flyspell-workaround) (paredit-mode)) diff --git a/init/custom.el b/init/custom.el index 68a4bed78a..ba1ac791b7 100644 --- a/init/custom.el +++ b/init/custom.el @@ -7,13 +7,17 @@ '(ac-delay 0.2) '(custom-safe-themes (quote - ("3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "72e42ba8f32bbf4a0b30c4c25f378289058efb1790dbd9a3e7c3d9666cc7fee4" "0e7da2c7c64fb5d4764250ffa4b8b33c0946577108d1d6444f1020d0dabba784" "6a37be365d1d95fad2f4d185e51928c789ef7a4ccf17e7ca13ad63a8bf5b922f" "6e92ca53a22d9b0577ad0b16e07e2e020c8b621197e39fec454048e51b7954cb" default))) + ("c74e83f8aa4c78a121b52146eadb792c9facc5b1f02c917e3dbb454fca931223" "26614652a4b3515b4bbbb9828d71e206cc249b67c9142c06239ed3418eff95e2" "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "72e42ba8f32bbf4a0b30c4c25f378289058efb1790dbd9a3e7c3d9666cc7fee4" "0e7da2c7c64fb5d4764250ffa4b8b33c0946577108d1d6444f1020d0dabba784" "6a37be365d1d95fad2f4d185e51928c789ef7a4ccf17e7ca13ad63a8bf5b922f" "6e92ca53a22d9b0577ad0b16e07e2e020c8b621197e39fec454048e51b7954cb" default))) '(frame-brackground-mode (quote dark)) '(global-auto-complete-mode t) + '(ido-use-filename-at-point nil) '(magit-log-show-gpg-status t) + '(nil nil t) '(ns-alternate-modifier (quote none)) - '(ns-command-modifier (quote meta)) + '(ns-command-modifier (quote control)) + '(ns-right-command-modifier (quote meta)) '(require-final-newline (quote visit-save)) + '(sml/theme (quote dark))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. @@ -27,4 +31,4 @@ '(rainbow-delimiters-depth-6-face ((t (:foreground "#268bd2")))) '(rainbow-delimiters-depth-7-face ((t (:foreground "#cb4b16")))) '(rainbow-delimiters-depth-8-face ((t (:foreground "#d33682")))) - '(rainbow-delimiters-depth-9-face ((t (:foreground "#839496")))))) + '(rainbow-delimiters-depth-9-face ((t (:foreground "#839496"))))) diff --git a/init/settings.el b/init/settings.el index f58063a5dc..4aa5da15dc 100644 --- a/init/settings.el +++ b/init/settings.el @@ -1,5 +1,5 @@ (require 'uniquify) -(require 'smart-mode-line) +; (require 'smart-mode-line) ; ## Generic settings ## @@ -38,7 +38,8 @@ (add-to-list 'exec-path "/usr/local/bin") (add-to-list 'exec-path (expand-file-name "~/bin")) - +;; Stack installs here: +(add-to-list 'exec-path (expand-file-name "~/.local/bin")) (when window-system (setq frame-title-format '(buffer-file-name "%f" ("%b"))) @@ -148,16 +149,6 @@ line) 'face 'linum))) -(eval-after-load 'diff-mode - '(progn - (set-face-foreground 'diff-added "green4") - (set-face-foreground 'diff-removed "red3"))) - -(eval-after-load 'magit - '(progn - (set-face-foreground 'magit-diff-add "green4") - (set-face-foreground 'magit-diff-del "red3"))) - ;; ## Mac specific settings ## ;; Enable mouse support on OS X @@ -248,5 +239,7 @@ ;; Use CUPS (setq lpr-command "xpp") +;; Allow same window in two frames +(setq ido-default-buffer-method 'selected-window) (provide 'settings) -- cgit 1.4.1 From 8f0949dbb26c89d3209f2735996a9be7accc8e86 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 6 Jun 2017 13:33:13 +0200 Subject: chore: Minor sync with Dell machine config --- init.el | 1 + init/custom.el | 3 +++ init/haskell-setup.el | 3 +-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/init.el b/init.el index 9358bb6c01..db788c4d22 100644 --- a/init.el +++ b/init.el @@ -94,3 +94,4 @@ ;; SML should respect theme colours ;; (setq sml/theme 'powerline) (sml/setup) +(put 'upcase-region 'disabled nil) diff --git a/init/custom.el b/init/custom.el index ba1ac791b7..03183f7d5a 100644 --- a/init/custom.el +++ b/init/custom.el @@ -16,6 +16,9 @@ '(ns-alternate-modifier (quote none)) '(ns-command-modifier (quote control)) '(ns-right-command-modifier (quote meta)) + '(package-selected-packages + (quote + (fish-mode string-inflection groovy-mode swift-mode toml-mode nginx-mode elixir-mode terraform-mode uuidgen uuid yaml-mode undo-tree switch-window smex smart-mode-line rust-mode rainbow-mode rainbow-delimiters puppet-mode projectile pkgbuild-mode password-store paredit multi-term multiple-cursors markdown-mode+ magit iy-go-to-char ido-ubiquitous idle-highlight-mode hi2 haskell-mode go-mode flycheck flx-ido erlang dockerfile-mode confluence cider browse-kill-ring ag ace-jump-mode))) '(require-final-newline (quote visit-save)) '(sml/theme (quote dark))) (custom-set-faces diff --git a/init/haskell-setup.el b/init/haskell-setup.el index bd61013c25..c2ed22b252 100644 --- a/init/haskell-setup.el +++ b/init/haskell-setup.el @@ -11,8 +11,7 @@ (interactive) (define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-or-reload) (define-key haskell-mode-map (kbd "C-c C-c") 'haskell-compile) - (define-key haskell-mode-map (kbd "C-r") 'haskell-interactive-bring) - (define-key haskell-mode-map (kbd "SPC") 'haskell-mode-contextual-space)) + (define-key haskell-mode-map (kbd "C-r") 'haskell-interactive-bring)) (eval-after-load "haskell-mode" '(haskell-mode-binding-setup)) -- cgit 1.4.1 From 2c02c371fe488f584c96fbf8720a8943746b837f Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 30 Jul 2017 18:28:03 +0200 Subject: fix custom: Fix a bug and truncate theme list --- init.el | 2 +- init/custom.el | 6 ++---- init/settings.el | 6 +++++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/init.el b/init.el index db788c4d22..0761b13a30 100644 --- a/init.el +++ b/init.el @@ -29,7 +29,7 @@ haskell-mode hi2 idle-highlight-mode - ido-ubiquitous + ido-completing-read+ iy-go-to-char magit markdown-mode+ diff --git a/init/custom.el b/init/custom.el index 03183f7d5a..d3ef8efbd6 100644 --- a/init/custom.el +++ b/init/custom.el @@ -7,20 +7,18 @@ '(ac-delay 0.2) '(custom-safe-themes (quote - ("c74e83f8aa4c78a121b52146eadb792c9facc5b1f02c917e3dbb454fca931223" "26614652a4b3515b4bbbb9828d71e206cc249b67c9142c06239ed3418eff95e2" "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "72e42ba8f32bbf4a0b30c4c25f378289058efb1790dbd9a3e7c3d9666cc7fee4" "0e7da2c7c64fb5d4764250ffa4b8b33c0946577108d1d6444f1020d0dabba784" "6a37be365d1d95fad2f4d185e51928c789ef7a4ccf17e7ca13ad63a8bf5b922f" "6e92ca53a22d9b0577ad0b16e07e2e020c8b621197e39fec454048e51b7954cb" default))) + ("3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" default))) '(frame-brackground-mode (quote dark)) '(global-auto-complete-mode t) '(ido-use-filename-at-point nil) '(magit-log-show-gpg-status t) - '(nil nil t) '(ns-alternate-modifier (quote none)) '(ns-command-modifier (quote control)) '(ns-right-command-modifier (quote meta)) '(package-selected-packages (quote (fish-mode string-inflection groovy-mode swift-mode toml-mode nginx-mode elixir-mode terraform-mode uuidgen uuid yaml-mode undo-tree switch-window smex smart-mode-line rust-mode rainbow-mode rainbow-delimiters puppet-mode projectile pkgbuild-mode password-store paredit multi-term multiple-cursors markdown-mode+ magit iy-go-to-char ido-ubiquitous idle-highlight-mode hi2 haskell-mode go-mode flycheck flx-ido erlang dockerfile-mode confluence cider browse-kill-ring ag ace-jump-mode))) - '(require-final-newline (quote visit-save)) - '(sml/theme (quote dark))) + '(require-final-newline (quote visit-save))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. diff --git a/init/settings.el b/init/settings.el index 4aa5da15dc..bc78d62be2 100644 --- a/init/settings.el +++ b/init/settings.el @@ -84,7 +84,11 @@ ;; ido-mode is like magic pixie dust! (ido-mode t) -(ido-ubiquitous t) + +;; ido-completing-read+ enables ido everywhere, not just for buffers and files. +(require 'ido-completing-read+) +(ido-ubiquitous-mode 1) + (setq ido-enable-prefix nil ido-enable-flex-matching t ido-auto-merge-work-directories-length nil -- cgit 1.4.1 From 6c2da17783ef0931e1d44dbd22c79f91668a4dc0 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 30 Jul 2017 18:30:04 +0200 Subject: refactor: Some minor cleanups --- init.el | 6 +++--- init/settings.el | 40 ++++------------------------------------ 2 files changed, 7 insertions(+), 39 deletions(-) diff --git a/init.el b/init.el index 0761b13a30..839c1291aa 100644 --- a/init.el +++ b/init.el @@ -91,7 +91,7 @@ ;; Seed RNG (random t) -;; SML should respect theme colours -;; (setq sml/theme 'powerline) -(sml/setup) (put 'upcase-region 'disabled nil) + +;; Configure smart mode line +(sml/setup) diff --git a/init/settings.el b/init/settings.el index bc78d62be2..48c5a853e7 100644 --- a/init/settings.el +++ b/init/settings.el @@ -1,11 +1,11 @@ (require 'uniquify) -; (require 'smart-mode-line) ; ## Generic settings ## ; Hide those ugly tool bars (tool-bar-mode 0) (scroll-bar-mode 0) +(menu-bar-mode 0) (defun disable-scroll-bar () (scroll-bar-mode 0)) @@ -115,13 +115,8 @@ ;; ## Look and feel ## -;; Themes! I download and install the ones I like and default the one -;; I currently like most. This changes a lot because I hate -;; everything. (It's in my nature, don't judge) -(custom-download-theme - "https://raw.github.com/owainlewis/emacs-color-themes/master/themes/hickey-theme.el" - "hickey-theme.el") - +;; Themes! +;; I've pretty much settled on this Gruber darker theme (custom-download-theme "https://raw.github.com/rexim/gruber-darker-theme/master/gruber-darker-theme.el" "gruber-darker-theme.el") @@ -135,12 +130,6 @@ (set-default-font "Source Code Pro 12") -;; Don't make the nyan cat too long ... I have other stuff in the mode -;; bar as well! -(set-variable 'nyan-bar-length 15) -;; Not the real deal without this ... -(set-variable 'nyan-wavy-trail t) - ;; Style line numbers (shown with M-g g) (setq linum-format (lambda (line) @@ -153,30 +142,9 @@ line) 'face 'linum))) -;; ## Mac specific settings ## - -;; Enable mouse support on OS X -(unless window-system - (require 'mouse) - (xterm-mouse-mode t) - (global-set-key [mouse-4] '(lambda () - (interactive) - (scroll-down 1))) - (global-set-key [mouse-5] '(lambda () - (interactive) - (scroll-up 1))) - (defun track-mouse (e)) - - (setq mouse-sel-mode t) -) - ;; Use clipboard properly (setq x-select-enable-clipboard t) -;; Settings for Emacs.app (Cocoa Emacs) -;; Menu bar doesn't take up additional space, so lets use it. -(menu-bar-mode 1) - ;; Auto refresh buffers (global-auto-revert-mode 1) @@ -206,7 +174,7 @@ (define-key global-map [?] 'ace-jump-mode) -;; Quick jump back +;; Quick jump back (autoload 'ace-jump-mode-pop-mark "ace-jump-mode" -- cgit 1.4.1 From 6107ec40d67c7269a3dbbc7453341d946bda3068 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 27 Sep 2017 15:02:33 +0200 Subject: fix(init.el): Initialise package manager immediately --- init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.el b/init.el index 839c1291aa..bbfdcce274 100644 --- a/init.el +++ b/init.el @@ -1,5 +1,6 @@ ;; Configure package manager (require 'package) +(package-initialize) ;; Add Marmalade repo (add-to-list 'package-archives '("marmalade" . "https://marmalade-repo.org/packages/")) @@ -10,7 +11,6 @@ ;; And load things! (package-refresh-contents) -(package-initialize) (defvar my-pkgs '(;; All packages -- cgit 1.4.1 From 5683eab48e96ccb78dbeb680269bdff29190cf62 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 27 Sep 2017 15:02:45 +0200 Subject: refactor: Install gruber-darker-theme from package repo --- init.el | 1 + init/custom.el | 3 ++- init/settings.el | 7 ------- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/init.el b/init.el index bbfdcce274..5f286e6e2c 100644 --- a/init.el +++ b/init.el @@ -26,6 +26,7 @@ flx-ido flycheck go-mode + gruber-darker-theme haskell-mode hi2 idle-highlight-mode diff --git a/init/custom.el b/init/custom.el index d3ef8efbd6..b4094b20a9 100644 --- a/init/custom.el +++ b/init/custom.el @@ -5,9 +5,10 @@ ;; If there is more than one, they won't work right. '(ac-auto-show-menu 0.8) '(ac-delay 0.2) + '(custom-enabled-themes (quote (gruber-darker))) '(custom-safe-themes (quote - ("3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" default))) + ("3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "d61fc0e6409f0c2a22e97162d7d151dee9e192a90fa623f8d6a071dbf49229c6" default))) '(frame-brackground-mode (quote dark)) '(global-auto-complete-mode t) '(ido-use-filename-at-point nil) diff --git a/init/settings.el b/init/settings.el index 48c5a853e7..4fcd1cd074 100644 --- a/init/settings.el +++ b/init/settings.el @@ -116,13 +116,6 @@ ;; ## Look and feel ## ;; Themes! -;; I've pretty much settled on this Gruber darker theme -(custom-download-theme - "https://raw.github.com/rexim/gruber-darker-theme/master/gruber-darker-theme.el" - "gruber-darker-theme.el") - -(load-theme 'gruber-darker t) - (global-hl-line-mode -1) (setq default-frame-alist '((font-backend . "xft") -- cgit 1.4.1 From f83eeaf4f8a1d285c560e62313a308d9abf29635 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 27 Sep 2017 15:04:33 +0200 Subject: chore(clojure): Remove all Clojure settings --- init.el | 3 --- init/clojure.el | 45 --------------------------------------------- 2 files changed, 48 deletions(-) delete mode 100644 init/clojure.el diff --git a/init.el b/init.el index 5f286e6e2c..957e533936 100644 --- a/init.el +++ b/init.el @@ -17,8 +17,6 @@ ace-jump-mode ag browse-kill-ring - cider - clojure-mode confluence dash dockerfile-mode @@ -74,7 +72,6 @@ modes bindings eshell-setup - clojure haskell-setup )) diff --git a/init/clojure.el b/init/clojure.el deleted file mode 100644 index c88c86f4e3..0000000000 --- a/init/clojure.el +++ /dev/null @@ -1,45 +0,0 @@ -(require 'cider) -;(require 'ac-cider-compliment) - -;; Configure CIDER (Clojure REPL) and clojure-mode - -(defun cider-mode-setup () - "Activates paredit, rainbow delimiters and ac-nrepl" - ; (ac-cider-compliment-setup) - (ac-flyspell-workaround) - (paredit-mode)) - -(eval-after-load "auto-complete" - '(add-to-list 'ac-modes cider-mode)) - -(add-hook 'cider-repl-mode-hook 'cider-mode-setup) -(add-hook 'cider-interaction-mode-hook 'cider-mode-setup) -(eval-after-load "auto-complete" - '(add-to-list 'ac-modes 'cider-repl-mode)) - -;; Paredit in clojure -(add-hook 'clojure-mode-hook 'paredit-mode) - -;; eldoc in clojure -(add-hook 'cider-interaction-mode-hook - 'cider-turn-on-eldoc-mode) - -;; Don't annoy me -(setq cider-hide-special-buffers t) -(setq cider-popup-stacktraces nil) -(setq cider-repl-pop-to-buffer-on-connect nil) -(setq cider-repl-popup-stacktraces t) - -;; I want history up/down without modifiers -(define-key cider-repl-mode-map (kbd "") 'cider-repl-backward-input) -(define-key cider-repl-mode-map (kbd "") 'cider-repl-forward-input) -(define-key cider-repl-mode-map (kbd "C-") 'previous-line) -(define-key cider-repl-mode-map (kbd "C-") 'next-line) - -;; ... and ac-cider with C-c C-d -(define-key cider-repl-mode-map (kbd "C-c C-d") 'ac-cider-compliment-popup-doc) -(define-key cider-mode-map (kbd "C-c C-d") 'ac-cider-compliment-popup-doc) -(define-key cider-mode-map (kbd "C-c D") 'cider-doc) - - -(provide 'clojure) -- cgit 1.4.1 From 8cc36e0eab7e90149f114dcef1fe2ebae5da569b Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 13 Oct 2017 18:14:33 +0200 Subject: feat: Add terraform-mode --- init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/init.el b/init.el index 957e533936..0989b0e4fa 100644 --- a/init.el +++ b/init.el @@ -46,6 +46,7 @@ smart-mode-line smex switch-window + terraform-mode undo-tree yaml-mode ) -- cgit 1.4.1 From bc12439cf730b79194cdd48ea41150c4ea917ac6 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 15 Oct 2017 13:29:36 +0200 Subject: chore: Remove unused misc.el --- init/misc.el | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 init/misc.el diff --git a/init/misc.el b/init/misc.el deleted file mode 100644 index 9403704930..0000000000 --- a/init/misc.el +++ /dev/null @@ -1,9 +0,0 @@ -;; For everything that doesn't fit anywhere else. - -;; Ignore .DS_Store files with ido mode -(add-to-list 'ido-ignore-files "\\.DS_Store") - -;; Use aspell for spell checking: brew install aspell --lang=en -(setq ispell-program-name "/usr/local/bin/aspell") - -(provide 'misc) -- cgit 1.4.1 From 774aea8eddb98ab3545ef74c669601c436a15bec Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 15 Oct 2017 13:30:10 +0200 Subject: feat: Switch from ido/smex to Helm --- init.el | 5 +---- init/functions.el | 2 +- init/settings.el | 33 +++++++-------------------------- 3 files changed, 9 insertions(+), 31 deletions(-) diff --git a/init.el b/init.el index 0989b0e4fa..86876c121c 100644 --- a/init.el +++ b/init.el @@ -21,14 +21,13 @@ dash dockerfile-mode erlang - flx-ido flycheck go-mode gruber-darker-theme haskell-mode + helm hi2 idle-highlight-mode - ido-completing-read+ iy-go-to-char magit markdown-mode+ @@ -42,9 +41,7 @@ rainbow-delimiters rainbow-mode rust-mode - s smart-mode-line - smex switch-window terraform-mode undo-tree diff --git a/init/functions.el b/init/functions.el index 6389931bc0..29d07f8112 100644 --- a/init/functions.el +++ b/init/functions.el @@ -96,7 +96,7 @@ Including indent-buffer, which should not be called automatically on save." (defun esk-sudo-edit (&optional arg) (interactive "p") (if (or arg (not buffer-file-name)) - (find-file (concat "/sudo:root@localhost:" (ido-read-file-name "File: "))) + (find-file (concat "/sudo:root@localhost:" (read-file-name "File: "))) (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))) ;; Evaluate sexp and replace it with result diff --git a/init/settings.el b/init/settings.el index 4fcd1cd074..5db6619c8c 100644 --- a/init/settings.el +++ b/init/settings.el @@ -2,6 +2,13 @@ ; ## Generic settings ## +;; Make Helm go! +(require 'helm-config) +(global-set-key (kbd "M-x") #'helm-M-x) +(global-set-key (kbd "C-x r b") #'helm-filtered-bookmarks) +(global-set-key (kbd "C-x C-f") #'helm-find-files) +(helm-mode 1) + ; Hide those ugly tool bars (tool-bar-mode 0) (scroll-bar-mode 0) @@ -19,8 +26,6 @@ ;; Go away go away (setq initial-scratch-message "") -(flx-ido-mode 1) -(setq ido-use-faces nil) (setq gc-cons-threshold 20000000) (setq uniquify-buffer-name-style 'forward) @@ -72,35 +77,11 @@ (setq x-super-keysym 'meta x-alt-keysym 'alt)) -(setq smex-save-file (concat user-emacs-directory ".smex-items")) -(setq smex-key-advice-ignore-menu-bar t) -(smex-initialize) -(global-set-key (kbd "M-x") 'smex) - (add-to-list 'safe-local-variable-values '(lexical-binding . t)) (add-to-list 'safe-local-variable-values '(whitespace-line-column . 80)) (set-default 'indent-tabs-mode nil) -;; ido-mode is like magic pixie dust! -(ido-mode t) - -;; ido-completing-read+ enables ido everywhere, not just for buffers and files. -(require 'ido-completing-read+) -(ido-ubiquitous-mode 1) - -(setq ido-enable-prefix nil - ido-enable-flex-matching t - ido-auto-merge-work-directories-length nil - ido-create-new-buffer 'always - ido-use-filename-at-point 'guess - ido-use-virtual-buffers t - ido-handle-duplicate-virtual-buffers 2 - ido-max-prospects 10) - -;; Swedish! -(set-language-environment 'Swedish) - ;; UTF-8 please (setq locale-coding-system 'utf-8) ; pretty (set-terminal-coding-system 'utf-8) ; pretty -- cgit 1.4.1 From 0fe21a4f277f9b5201c4d7141d80ca8d635e8ef0 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 15 Oct 2017 13:30:25 +0200 Subject: feat: Switch default font to Input Mono --- init/settings.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init/settings.el b/init/settings.el index 5db6619c8c..cd77d6034b 100644 --- a/init/settings.el +++ b/init/settings.el @@ -100,9 +100,9 @@ (global-hl-line-mode -1) (setq default-frame-alist '((font-backend . "xft") - (font . "Source Code Pro-12"))) + (font . "Input Mono-12"))) -(set-default-font "Source Code Pro 12") +(set-default-font "Input Mono 12") ;; Style line numbers (shown with M-g g) (setq linum-format -- cgit 1.4.1 From 099020c1761e8976adbf802837facf75753ee18a Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 15 Oct 2017 13:40:05 +0200 Subject: chore: remove unused ido-related lines --- init/custom.el | 4 ---- init/settings.el | 6 ------ 2 files changed, 10 deletions(-) diff --git a/init/custom.el b/init/custom.el index b4094b20a9..16f9802dfd 100644 --- a/init/custom.el +++ b/init/custom.el @@ -11,14 +11,10 @@ ("3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "d61fc0e6409f0c2a22e97162d7d151dee9e192a90fa623f8d6a071dbf49229c6" default))) '(frame-brackground-mode (quote dark)) '(global-auto-complete-mode t) - '(ido-use-filename-at-point nil) '(magit-log-show-gpg-status t) '(ns-alternate-modifier (quote none)) '(ns-command-modifier (quote control)) '(ns-right-command-modifier (quote meta)) - '(package-selected-packages - (quote - (fish-mode string-inflection groovy-mode swift-mode toml-mode nginx-mode elixir-mode terraform-mode uuidgen uuid yaml-mode undo-tree switch-window smex smart-mode-line rust-mode rainbow-mode rainbow-delimiters puppet-mode projectile pkgbuild-mode password-store paredit multi-term multiple-cursors markdown-mode+ magit iy-go-to-char ido-ubiquitous idle-highlight-mode hi2 haskell-mode go-mode flycheck flx-ido erlang dockerfile-mode confluence cider browse-kill-ring ag ace-jump-mode))) '(require-final-newline (quote visit-save))) (custom-set-faces ;; custom-set-faces was added by Custom. diff --git a/init/settings.el b/init/settings.el index cd77d6034b..1024d81998 100644 --- a/init/settings.el +++ b/init/settings.el @@ -179,13 +179,7 @@ ;; Display tabs as 4 spaces (setq default-tab-width 4) -;; Set up Java home & path -(setenv "JAVA_HOME" "/usr/lib/jvm/default") - ;; Use CUPS (setq lpr-command "xpp") -;; Allow same window in two frames -(setq ido-default-buffer-method 'selected-window) - (provide 'settings) -- cgit 1.4.1 From 867ea97fd943a10313dce16b668eb6fa45d3a69c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 15 Oct 2017 16:31:23 +0200 Subject: fix: Remove projectile which slowed everything down --- init.el | 1 - init/modes.el | 6 ------ 2 files changed, 7 deletions(-) diff --git a/init.el b/init.el index 86876c121c..a8c9ae9cd4 100644 --- a/init.el +++ b/init.el @@ -36,7 +36,6 @@ paredit password-store pkgbuild-mode - projectile puppet-mode rainbow-delimiters rainbow-mode diff --git a/init/modes.el b/init/modes.el index 400daffa49..6d542f496b 100644 --- a/init/modes.el +++ b/init/modes.el @@ -1,5 +1,3 @@ -(require 'projectile) - ;; Initializes modes I use. (add-hook 'prog-mode-hook 'esk-add-watchwords) @@ -26,15 +24,11 @@ ;; Don't indent after '>' while I'm writing (local-set-key ">" 'self-insert-command) ;;(local-set-key "RET" 'newline) - (projectile-mode 1) (rainbow-delimiters-mode 1) ) (add-hook 'erlang-mode-hook 'erlang-mode-init-setup) -;; Enable projectile for all things programming -(add-hook 'prog-mode-hook 'projectile-mode) - ;; Enable rainbow-delimiters for all things programming (add-hook 'prog-mode-hook 'rainbow-delimiters-mode) -- cgit 1.4.1 From dadb4b4fed3954fbd5490ca15c7ddae67099ab53 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 15 Oct 2017 16:31:39 +0200 Subject: feat: Ostensibly enable fuzzy matching in Helm --- init/settings.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init/settings.el b/init/settings.el index 1024d81998..852bf17650 100644 --- a/init/settings.el +++ b/init/settings.el @@ -4,6 +4,10 @@ ;; Make Helm go! (require 'helm-config) + +;; Enable fuzzy matching in Helm +(setq helm-mode-fuzzy-match t + helm-completion-in-region-fuzzy-match t) (global-set-key (kbd "M-x") #'helm-M-x) (global-set-key (kbd "C-x r b") #'helm-filtered-bookmarks) (global-set-key (kbd "C-x C-f") #'helm-find-files) -- cgit 1.4.1 From af8913382132e15266b244a5b0acc9f1ddd1e180 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 15 Oct 2017 16:31:56 +0200 Subject: fix: Remove old GPG-agent SSH config --- init/settings.el | 3 --- 1 file changed, 3 deletions(-) diff --git a/init/settings.el b/init/settings.el index 852bf17650..2818aeb5c1 100644 --- a/init/settings.el +++ b/init/settings.el @@ -40,9 +40,6 @@ ;; Bash is the reliable one here (setq multi-term-program "/bin/bash") -;; Use the GPG-provided SSH agent -(setenv "SSH_AUTH_SOCK" (concat (getenv "HOME") "/.gnupg/S.gpg-agent.ssh")) - ;;; Code: (add-to-list 'exec-path "/usr/local/bin") -- cgit 1.4.1 From 5e48ce3f9b210078fb99c4d173f223c2da0379b0 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 15 Oct 2017 20:23:51 +0200 Subject: feat: Add nix-mode & nix-config function * install nix-mode by default * add a function to quickly open the system configuration.nix --- init.el | 1 + init/custom.el | 3 +++ init/functions.el | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/init.el b/init.el index a8c9ae9cd4..2959691b6f 100644 --- a/init.el +++ b/init.el @@ -33,6 +33,7 @@ markdown-mode+ multiple-cursors multi-term + nix-mode paredit password-store pkgbuild-mode diff --git a/init/custom.el b/init/custom.el index 16f9802dfd..f9729f28e8 100644 --- a/init/custom.el +++ b/init/custom.el @@ -15,6 +15,9 @@ '(ns-alternate-modifier (quote none)) '(ns-command-modifier (quote control)) '(ns-right-command-modifier (quote meta)) + '(package-selected-packages + (quote + (fish-mode nix-mode yaml-mode undo-tree terraform-mode switch-window smart-mode-line rust-mode rainbow-mode rainbow-delimiters puppet-mode pkgbuild-mode password-store paredit multi-term multiple-cursors markdown-mode+ magit iy-go-to-char idle-highlight-mode hi2 helm haskell-mode gruber-darker-theme go-mode flycheck erlang dockerfile-mode confluence browse-kill-ring ag ace-jump-mode))) '(require-final-newline (quote visit-save))) (custom-set-faces ;; custom-set-faces was added by Custom. diff --git a/init/functions.el b/init/functions.el index 29d07f8112..a0f4d59456 100644 --- a/init/functions.el +++ b/init/functions.el @@ -111,4 +111,9 @@ Including indent-buffer, which should not be called automatically on save." (interactive) (eww "https://blog.fefe.de/")) +;; Open this machines NixOS config +(defun nix-config () + (interactive) + (find-file "/etc/nixos/configuration.nix")) + (provide 'functions) -- cgit 1.4.1 From 319347e5cc6b31a4d3669dfe7f56bbf904039fb4 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 15 Oct 2017 20:24:28 +0200 Subject: fix(settings): Correctly enable Helm's fuzzy matches The global Helm fuzzy matching doesn't actually seem to enable fuzzy matching for modes that have an explicit config. This enables fuzzy matching for M-x and C-x b --- init/settings.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/init/settings.el b/init/settings.el index 2818aeb5c1..1786957b4c 100644 --- a/init/settings.el +++ b/init/settings.el @@ -5,9 +5,15 @@ ;; Make Helm go! (require 'helm-config) -;; Enable fuzzy matching in Helm +;; Enable fuzzy matching in Helm. +;; The wiki recommends the first two options for globally enabling fuzzy +;; matching, however this does not actually work. +;; Setting all the options helps! (setq helm-mode-fuzzy-match t - helm-completion-in-region-fuzzy-match t) + helm-completion-in-region-fuzzy-match t + helm-M-x-fuzzy-match t + helm-buffers-fuzzy-matching t + ) (global-set-key (kbd "M-x") #'helm-M-x) (global-set-key (kbd "C-x r b") #'helm-filtered-bookmarks) (global-set-key (kbd "C-x C-f") #'helm-find-files) -- cgit 1.4.1 From 17e57e42efa30c2182e0b28ee09029db795db803 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 15 Oct 2017 20:25:08 +0200 Subject: style: Make emacs transparent Party like it's 2004. --- init/settings.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/init/settings.el b/init/settings.el index 1786957b4c..7754449cca 100644 --- a/init/settings.el +++ b/init/settings.el @@ -19,11 +19,15 @@ (global-set-key (kbd "C-x C-f") #'helm-find-files) (helm-mode 1) -; Hide those ugly tool bars +;; Hide those ugly tool bars (tool-bar-mode 0) (scroll-bar-mode 0) (menu-bar-mode 0) +;; Now that I have nice wallpapers, let me see them. +(set-frame-parameter (selected-frame) 'alpha '(97 . 95)) +(add-to-list 'default-frame-alist '(alpha . (97 . 95))) + (defun disable-scroll-bar () (scroll-bar-mode 0)) -- cgit 1.4.1 From 0338fcc89242deeed4f8e639182481d3b5a02a95 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 6 Nov 2017 19:31:02 +0100 Subject: feat(modes): Always enable electric-pair-mode --- init/modes.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init/modes.el b/init/modes.el index 6d542f496b..a0ad034cda 100644 --- a/init/modes.el +++ b/init/modes.el @@ -38,6 +38,9 @@ ;; Always highlight matching brackets (show-paren-mode 1) +;; Always auto-close parantheses and other pairs +(electric-pair-mode) + ;; Represent undo-history as an actual tree (visualize with C-x u) (setq undo-tree-mode-lighter "") (require 'undo-tree) -- cgit 1.4.1 From 6bef57e347881de5ddf21c9bf21ecce0d7150e57 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 6 Nov 2017 19:35:19 +0100 Subject: feat(rust-setup): Add Rust setup Adds a simple Rust setup with autocompletion via Racer and built-in Cargo command support. --- init.el | 2 ++ init/rust-setup.el | 14 ++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 init/rust-setup.el diff --git a/init.el b/init.el index 2959691b6f..6f22217839 100644 --- a/init.el +++ b/init.el @@ -17,6 +17,7 @@ ace-jump-mode ag browse-kill-ring + cargo confluence dash dockerfile-mode @@ -38,6 +39,7 @@ password-store pkgbuild-mode puppet-mode + racer rainbow-delimiters rainbow-mode rust-mode diff --git a/init/rust-setup.el b/init/rust-setup.el new file mode 100644 index 0000000000..a4cf3c5a51 --- /dev/null +++ b/init/rust-setup.el @@ -0,0 +1,14 @@ +(require 'rust-mode) + +;; Enable cargo-related (C-c C-c C-...) commands. +(add-hook 'rust-mode-hook #'cargo-minor-mode) + +;; Configure autocompletion for rust +(add-hook 'rust-mode-hook #'racer-mode) +(add-hook 'racer-mode-hook #'company-mode) +(add-hook 'racer-mode-hook #'eldoc-mode) +(define-key rust-mode-map (kbd "TAB") #'company-indent-or-complete-common) +(setq company-tooltip-align-annotations t) + +;; Ensure long compiler errors don't flow out of the screen (very annoying!) +(add-hook 'cargo-process-mode-hook #'visual-line-mode) -- cgit 1.4.1 From 8996bceea1ed99cc13a7dd3f030395487a0d6ac9 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 6 Nov 2017 19:35:53 +0100 Subject: feat(init): Add some useful development packages Adds packages for interfacing with PostgreSQL and HTTP APIs which can be very useful during development. --- init.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index 6f22217839..27a0bec35a 100644 --- a/init.el +++ b/init.el @@ -32,21 +32,24 @@ iy-go-to-char magit markdown-mode+ - multiple-cursors multi-term + multiple-cursors nix-mode paredit password-store + pg pkgbuild-mode puppet-mode racer rainbow-delimiters rainbow-mode + restclient rust-mode smart-mode-line switch-window terraform-mode undo-tree + uuidgen yaml-mode ) "A list of packages to install at launch.") -- cgit 1.4.1 From 5f5abc05ba1b86689477669290b61a39ad35f5c0 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 6 Nov 2017 22:26:47 +0100 Subject: fix(rust): Include automatically & set racer path --- init.el | 1 + init/rust-setup.el | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/init.el b/init.el index 27a0bec35a..e7357bb4ce 100644 --- a/init.el +++ b/init.el @@ -76,6 +76,7 @@ bindings eshell-setup haskell-setup + rust-setup )) (add-to-list 'load-path (concat user-emacs-directory "scripts")) diff --git a/init/rust-setup.el b/init/rust-setup.el index a4cf3c5a51..8eab1d9bdc 100644 --- a/init/rust-setup.el +++ b/init/rust-setup.el @@ -12,3 +12,9 @@ ;; Ensure long compiler errors don't flow out of the screen (very annoying!) (add-hook 'cargo-process-mode-hook #'visual-line-mode) + +;; I don't use rustup and I'm not sure which derivation would normally place +;; Rust sources in the nix-store, so I'll continue using my local Rust checkout. +(setq racer-rust-src-path "~/source/rust") + +(provide 'rust-setup) -- cgit 1.4.1 From ac5b34e131abecbda9c2c039adab38a2dca64224 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 7 Nov 2017 21:29:20 +0100 Subject: feat: Install modern elisp libraries Elisp can actually be quite nice with a bunch of modern tooling. --- init.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index e7357bb4ce..fa2ffc14a9 100644 --- a/init.el +++ b/init.el @@ -13,7 +13,13 @@ (package-refresh-contents) (defvar my-pkgs - '(;; All packages + '(;; elisp libraries + dash + dash-functional + ht + s + + ;; editor packages ace-jump-mode ag browse-kill-ring -- cgit 1.4.1 From 5fcabc204a878fa385450febf4eaabaa46386786 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 12 Nov 2017 19:00:49 +0100 Subject: feat(functions): Add functions to insert nix-store paths These can be useful - for example - while debugging nix things in eshell. --- init/functions.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/init/functions.el b/init/functions.el index a0f4d59456..af8ab51b45 100644 --- a/init/functions.el +++ b/init/functions.el @@ -116,4 +116,15 @@ Including indent-buffer, which should not be called automatically on save." (interactive) (find-file "/etc/nixos/configuration.nix")) +;; Get the nix store path for a given derivation. +;; If the derivation has not been built before, this will trigger a build. +(defun nix-store-path (derivation) + (let ((expr (concat "with import {}; " derivation))) + (s-chomp (shell-command-to-string (concat "nix-build -E '" expr "'"))))) + +(defun insert-nix-store-path () + (interactive) + (let ((derivation (read-string "Derivation name (in ): "))) + (insert-string (nix-store-path derivation)))) + (provide 'functions) -- cgit 1.4.1 From 99d9981dd9a10e4feade16161a13df64b0580da2 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 12 Nov 2017 19:46:14 +0100 Subject: refactor(init): Refactor package installation process Refactors package installation to be slightly more sane, for example package-refresh-contents will only be called if packages are missing. Removes some other old cruft, too, and paves way for a slightly different initialisation process. --- init.el | 88 +++++++++++++++++++++++++++++------------------------------ init/theme.el | 6 ++++ 2 files changed, 50 insertions(+), 44 deletions(-) create mode 100644 init/theme.el diff --git a/init.el b/init.el index fa2ffc14a9..4a80e44ed5 100644 --- a/init.el +++ b/init.el @@ -1,18 +1,18 @@ -;; Configure package manager +;;; init.el --- Package bootstrapping. -*- lexical-binding: t; -*- + +;; This file bootstraps the Emacs setup by going through package installations. +;; After all packages are installed, local configuration is loaded. + (require 'package) -(package-initialize) +(require 'seq) -;; Add Marmalade repo +;; Configure Marmalade and MELPA repositories. Packages available on Marmalade +;; will have precedence. (add-to-list 'package-archives '("marmalade" . "https://marmalade-repo.org/packages/")) - -;; ... and melpa. Melpa packages that exist on marmalade will have -;; precendence. (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) -;; And load things! -(package-refresh-contents) - -(defvar my-pkgs +;; This variable controls all packages that should be installed. +(setq-local desired-packages '(;; elisp libraries dash dash-functional @@ -57,49 +57,49 @@ undo-tree uuidgen yaml-mode - ) - "A list of packages to install at launch.") - -(dolist (p my-pkgs) - (when (not (package-installed-p p)) - (package-install p))) - -;; Are we on a mac? -(setq is-mac (equal system-type 'darwin)) - -;; Or on Linux? -(setq is-linux (equal system-type 'gnu/linux)) - -;; What's the home folder? -(defvar home-dir) -(setq home-dir (expand-file-name "~")) + )) -(add-to-list 'load-path (concat user-emacs-directory "init")) +(defun installable-packages (pkg-list) + "Filter out not-yet installed packages from package list." + (seq-filter (lambda (p) (not (package-installed-p p))) pkg-list)) -(mapc 'require '(functions - settings - modes - bindings - eshell-setup - haskell-setup - rust-setup - )) +(defun install-needed-packages (pkg-list) + (let ((to-install (installable-packages pkg-list))) + (if (< 0 (length to-install)) + (progn (package-refresh-contents) + (mapcar #'package-install to-install)) + (message "No new packages to install.")))) -(add-to-list 'load-path (concat user-emacs-directory "scripts")) +;; Run package installation! +(install-needed-packages desired-packages) +;; Configure a few basics before moving on to package-specific initialisation. (setq custom-file (concat user-emacs-directory "init/custom.el")) (load custom-file) -;; Local configuration -(load-file-if-exists "~/.emacs.d/init/local.el") - -;; Load magnars' string manipulation library -(require 's) +(defvar home-dir) +(setq home-dir (expand-file-name "~")) ;; Seed RNG (random t) -(put 'upcase-region 'disabled nil) +;; Add 'init' folder that contains other settings to load. +(add-to-list 'load-path (concat user-emacs-directory "init")) + +;; Load configuration that makes use of installed packages: + + +;; Emacs will automatically initialise all installed packages. +;; After initialisation, proceed to load configuration that requires packages: +(defun load-other-settings () + (mapc 'require '(theme + functions + settings + modes + bindings + eshell-setup + haskell-setup + rust-setup + ))) -;; Configure smart mode line -(sml/setup) +(add-hook 'after-init-hook 'load-other-settings) diff --git a/init/theme.el b/init/theme.el new file mode 100644 index 0000000000..3ad6a8a818 --- /dev/null +++ b/init/theme.el @@ -0,0 +1,6 @@ +;;; theme.el --- Editor theming. -*- lexical-binding: t; -*- + +;; Configure smart mode line +(sml/setup) + +(provide 'theme) -- cgit 1.4.1 From 0d5bdbd7ceceaa48d2caa8129f78a499d8bc68c1 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 12 Nov 2017 20:24:21 +0100 Subject: refactor: Remove lots of deprecated/unused settings * move all look-and-feel related settings into, you guessed it, look-and-feel.el * remove *lots* of old stuff and also re-evaluate what it's actually doing. --- init.el | 4 +- init/bindings.el | 23 +-------- init/eshell-setup.el | 26 +--------- init/settings.el | 143 ++------------------------------------------------- init/theme.el | 6 --- 5 files changed, 9 insertions(+), 193 deletions(-) delete mode 100644 init/theme.el diff --git a/init.el b/init.el index 4a80e44ed5..4f26322adf 100644 --- a/init.el +++ b/init.el @@ -10,6 +10,7 @@ ;; will have precedence. (add-to-list 'package-archives '("marmalade" . "https://marmalade-repo.org/packages/")) (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) +(package-initialize) ;; This variable controls all packages that should be installed. (setq-local desired-packages @@ -35,7 +36,6 @@ helm hi2 idle-highlight-mode - iy-go-to-char magit markdown-mode+ multi-term @@ -92,7 +92,7 @@ ;; Emacs will automatically initialise all installed packages. ;; After initialisation, proceed to load configuration that requires packages: (defun load-other-settings () - (mapc 'require '(theme + (mapc 'require '(look-and-feel functions settings modes diff --git a/init/bindings.el b/init/bindings.el index 38540968db..2e37469df6 100644 --- a/init/bindings.el +++ b/init/bindings.el @@ -12,16 +12,10 @@ (global-set-key (kbd "C-M-r") 'isearch-backward) (global-set-key (kbd "C-M-%") 'query-replace) -;; Jump to a definition in the current file. (Protip: this is awesome.) -(global-set-key (kbd "C-x C-i") 'imenu) - ;; Ace-jump-mode (global-set-key (kbd "M-j") 'ace-jump-word-mode) (global-set-key (kbd "M-p") 'ace-jump-mode-pop-mark) -;; Jump to next occurence of char -(global-set-key (kbd "C-c f") 'iy-go-to-char) - ;; Window switching. (C-x o goes to the next window) (windmove-default-keybindings) ;; Shift+direction @@ -31,13 +25,7 @@ ;; Start a new eshell even if one is active. (global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) -;; Eval sexp and replace it with result -(global-set-key (kbd "C-c e") 'replace-last-sexp) - -;; Start a regular shell if you prefer that. -(global-set-key (kbd "C-x C-m") 'shell) - -;; So good! +;; Magit! (global-set-key (kbd "C-c g") 'magit-status) ;; Replace standard goto-line with ace-jump-line-mode @@ -53,15 +41,6 @@ (global-set-key (kbd "C-x r q") 'save-buffers-kill-terminal) (global-set-key (kbd "C-x C-c") 'delete-frame) -;; Create new frame -(define-key global-map (kbd "C-x C-n") 'make-frame-command) - -;; Recompile easily -(define-key prog-mode-map (kbd "C-c r") 'recompile) - -;; Org-mode agenda keys -(global-set-key (kbd "C-c a") 'org-agenda) - ;; Open Fefes Blog (global-set-key (kbd "C-c C-f") 'fefes-blog) diff --git a/init/eshell-setup.el b/init/eshell-setup.el index 43b1c16b33..0b23c5a2d1 100644 --- a/init/eshell-setup.el +++ b/init/eshell-setup.el @@ -6,21 +6,7 @@ ;; Hide banner message ... (setq eshell-banner-message "") -(defun eshell-mode-hook-setup () - "Sets up EShell when it is loaded" - (setq eshell-path-env (concat - "/usr/local/bin:" - (concat home-dir "/bin:") - "/usr/local/share/python:" - "/opt/java/bin" - eshell-path-env)) - - (setenv "PATH" eshell-path-env)) - -(add-hook 'eshell-mode-hook 'eshell-mode-hook-setup) - ;; Prompt configuration - (defun clean-pwd (path) "Turns a path of the form /foo/bar/baz into /f/b/baz (inspired by fish shell)" @@ -49,10 +35,9 @@ `(propertize ,str 'face (list ,@properties))) (defun prompt-f () - "My EShell prompt displaying VC info and such" + "EShell prompt displaying VC info and such" (concat (with-face (concat (clean-pwd (eshell/pwd)) " ") :foreground "#96a6c8") - ;(with-face (vcprompt " -f \"(%s:%b%a%m) \"") :foreground "#5f627f") (if (= 0 (user-uid)) (with-face "#" :foreground "#f43841") (with-face "$" :foreground "#73c936")) @@ -80,13 +65,4 @@ (setq eshell-directory-name "~/.config/eshell/") -;; EShell functions that come in handy - -;; clear in eshell -(defun eshell/clear () - "clear the eshell buffer." - (interactive) - (let ((inhibit-read-only t)) - (erase-buffer))) - (provide 'eshell-setup) diff --git a/init/settings.el b/init/settings.el index 7754449cca..b29e6eae20 100644 --- a/init/settings.el +++ b/init/settings.el @@ -1,7 +1,5 @@ (require 'uniquify) -; ## Generic settings ## - ;; Make Helm go! (require 'helm-config) @@ -19,74 +17,27 @@ (global-set-key (kbd "C-x C-f") #'helm-find-files) (helm-mode 1) -;; Hide those ugly tool bars -(tool-bar-mode 0) -(scroll-bar-mode 0) -(menu-bar-mode 0) - -;; Now that I have nice wallpapers, let me see them. -(set-frame-parameter (selected-frame) 'alpha '(97 . 95)) -(add-to-list 'default-frame-alist '(alpha . (97 . 95))) - -(defun disable-scroll-bar () - (scroll-bar-mode 0)) - -; And remember to do it if I create a new frame. -(add-hook 'before-make-frame-hook 'disable-scroll-bar) - -;; Don't make any noises, don't flash, just leave me alone -(setq ring-bell-function 'ignore) - -;; Go away go away -(setq initial-scratch-message "") +;; Move files to trash when deleting +(setq delete-by-moving-to-trash t) +;; We don't live in the 80s, but we're also not a shitty web app. (setq gc-cons-threshold 20000000) (setq uniquify-buffer-name-style 'forward) -;; Give me column numbers -(column-number-mode t) - -;; Bash is the reliable one here -(setq multi-term-program "/bin/bash") - -;;; Code: - -(add-to-list 'exec-path "/usr/local/bin") -(add-to-list 'exec-path (expand-file-name "~/bin")) -;; Stack installs here: -(add-to-list 'exec-path (expand-file-name "~/.local/bin")) - -(when window-system - (setq frame-title-format '(buffer-file-name "%f" ("%b"))) - (tooltip-mode -1) - (mouse-wheel-mode t) - (blink-cursor-mode -1)) - ; Fix some defaults (setq visible-bell nil inhibit-startup-message t color-theme-is-global t sentence-end-double-space nil shift-select-mode nil - mouse-yank-at-point t uniquify-buffer-name-style 'forward whitespace-style '(face trailing lines-tail tabs) whitespace-line-column 80 default-directory "~" fill-column 80 - ediff-window-setup-function 'ediff-setup-windows-plain - ediff-diff-options "-w" ediff-split-window-function 'split-window-horizontally - oddmuse-directory (concat user-emacs-directory "oddmuse") - save-place-file (concat user-emacs-directory "places") - backup-directory-alist `((,(concat user-emacs-directory "backups"))) - diff-switches "-u") - -;; Fix keys on Linux -(if is-linux - (setq x-super-keysym 'meta - x-alt-keysym 'alt)) + backup-directory-alist `((,(concat user-emacs-directory "backups")))) (add-to-list 'safe-local-variable-values '(lexical-binding . t)) (add-to-list 'safe-local-variable-values '(whitespace-line-column . 80)) @@ -100,97 +51,13 @@ (set-selection-coding-system 'utf-8) ; please (prefer-coding-system 'utf-8) ; with sugar on top -(require 'ffap) - -(defalias 'yes-or-no-p 'y-or-n-p) -(defalias 'auto-tail-revert-mode 'tail-mode) - -;; ## Look and feel ## - -;; Themes! -(global-hl-line-mode -1) - -(setq default-frame-alist '((font-backend . "xft") - (font . "Input Mono-12"))) - -(set-default-font "Input Mono 12") - -;; Style line numbers (shown with M-g g) -(setq linum-format - (lambda (line) - (propertize - (format (concat " %" - (number-to-string - (length (number-to-string - (line-number-at-pos (point-max))))) - "d ") - line) - 'face 'linum))) - -;; Use clipboard properly -(setq x-select-enable-clipboard t) - -;; Auto refresh buffers -(global-auto-revert-mode 1) - -;; Also auto refresh dired, but be quiet about it -(setq global-auto-revert-non-file-buffers t) -(setq auto-revert-verbose nil) - -;; Show keystrokes in progress -(setq echo-keystrokes 0.1) - -;; Move files to trash when deleting -(setq delete-by-moving-to-trash t) - ;; Make emacs behave sanely (overwrite selected text) (delete-selection-mode 1) -;; ## Navigation and key bindings ## - -(setq windmove-wrap-around t) - -;; Load ace-jump-mode -(autoload - 'ace-jump-mode - "ace-jump-mode" - "Emacs quick move minor mode" - ) - -(define-key global-map [?] 'ace-jump-mode) - -;; Quick jump back -(autoload - 'ace-jump-mode-pop-mark - "ace-jump-mode" - "Ace jump back:-)" - ) - -(eval-after-load "ace-jump-mode" - '(ace-jump-mode-enable-mark-sync)) -(define-key global-map (kbd "C-x ö") 'ace-jump-mode-pop-mark) - -;; Keep your backup files in tmp, emacs! -(setq backup-directory-alist - `((".*" . ,temporary-file-directory))) +;; Keep your temporary files in tmp, emacs! (setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t))) -;; Eshell -;; Start/join -(global-set-key (kbd "C-x m") 'eshell) -;; Always start -(global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) - -;; Git -(global-set-key (kbd "C-c g") 'magit-status) - (remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function) -;; Display tabs as 4 spaces -(setq default-tab-width 4) - -;; Use CUPS -(setq lpr-command "xpp") - (provide 'settings) diff --git a/init/theme.el b/init/theme.el deleted file mode 100644 index 3ad6a8a818..0000000000 --- a/init/theme.el +++ /dev/null @@ -1,6 +0,0 @@ -;;; theme.el --- Editor theming. -*- lexical-binding: t; -*- - -;; Configure smart mode line -(sml/setup) - -(provide 'theme) -- cgit 1.4.1 From 0511e7eb970e99f3c889aac323ff5ae2a550232e Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 12 Nov 2017 22:41:54 +0100 Subject: fix: Fix warnings & errors detected by elisp compiler Minor things that came up when byte-compiling the configuration. --- .gitignore | 1 + init.el | 3 ++- init/functions.el | 14 ++++---------- init/rust-setup.el | 1 + 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 0f9b0bae46..7b666905f8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ local.el other/ scripts/ themes/ +*.elc diff --git a/init.el b/init.el index 4f26322adf..c1dd7fc510 100644 --- a/init.el +++ b/init.el @@ -13,7 +13,7 @@ (package-initialize) ;; This variable controls all packages that should be installed. -(setq-local desired-packages +(defvar desired-packages '(;; elisp libraries dash dash-functional @@ -25,6 +25,7 @@ ag browse-kill-ring cargo + company confluence dash dockerfile-mode diff --git a/init/functions.el b/init/functions.el index af8ab51b45..c47e64d348 100644 --- a/init/functions.el +++ b/init/functions.el @@ -1,3 +1,4 @@ +(require 's) ;; A few handy functions I use in init.el (or not, but they're nice to ;; have) @@ -22,11 +23,11 @@ (defun custom-download-script (url filename) "Downloads an Elisp script, places it in ~/.emacs/other and then loads it" - + ;; Ensure the directory exists (unless (file-exists-p "~/.emacs.d/other") (make-directory "~/.emacs.d/other")) - + ;; Download file if it doesn't exist. (let ((file (concat "~/.emacs.d/other/" filename))) @@ -99,13 +100,6 @@ Including indent-buffer, which should not be called automatically on save." (find-file (concat "/sudo:root@localhost:" (read-file-name "File: "))) (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))) -;; Evaluate sexp and replace it with result -(defun replace-last-sexp () - (interactive) - (let ((value (eval (preceding-sexp)))) - (kill-sexp -1) - (insert (format "%S" value)))) - ;; Open Fefes blog (defun fefes-blog () (interactive) @@ -125,6 +119,6 @@ Including indent-buffer, which should not be called automatically on save." (defun insert-nix-store-path () (interactive) (let ((derivation (read-string "Derivation name (in ): "))) - (insert-string (nix-store-path derivation)))) + (insert (nix-store-path derivation)))) (provide 'functions) diff --git a/init/rust-setup.el b/init/rust-setup.el index 8eab1d9bdc..b1a5681527 100644 --- a/init/rust-setup.el +++ b/init/rust-setup.el @@ -1,3 +1,4 @@ +(require 'company) (require 'rust-mode) ;; Enable cargo-related (C-c C-c C-...) commands. -- cgit 1.4.1 From 85207b2598d0300bcca893e3ef8348aa469f616e Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 12 Nov 2017 22:42:17 +0100 Subject: feat: Add look-and-feel.el with theme & behaviour config --- init/look-and-feel.el | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 init/look-and-feel.el diff --git a/init/look-and-feel.el b/init/look-and-feel.el new file mode 100644 index 0000000000..83aad1c3a6 --- /dev/null +++ b/init/look-and-feel.el @@ -0,0 +1,75 @@ +;;; -*- lexical-binding: t; -*- + +;; Hide those ugly tool bars: +(tool-bar-mode 0) +(scroll-bar-mode 0) +(menu-bar-mode 0) + +;; Don't do any annoying things: +(setq ring-bell-function 'ignore) +(setq initial-scratch-message "") + +;; Usually emacs will run as a proper GUI application, in which case a few +;; extra settings are nice-to-have: +(when window-system + (setq frame-title-format '(buffer-file-name "%f" ("%b"))) + (mouse-wheel-mode t) + (blink-cursor-mode -1)) + +;; Configure editor fonts +(setq default-frame-alist '((font-backend . "xft") + (font . "Input Mono-12"))) + +(set-frame-font "Input Mono 12" t t) + +(defun configure-new-frame (frame) + "Configuration settings to run whenever a new frame is created." + (scroll-bar-mode 0) ; Disable visual scroll bar (ugh!) + (set-frame-parameter frame 'alpha '(97 . 95))) ; Transparent emacs! + +(add-hook 'after-make-frame-functions 'configure-new-frame) + +;; If this file is evaluating there may also be a new (initial) frame: +(configure-new-frame (selected-frame)) + +;; Configure smart mode line +(sml/setup) + +;; Auto refresh buffers +(global-auto-revert-mode 1) + +;; Use clipboard properly +(setq select-enable-clipboard t) + +;; Show in-progress chords in minibuffer +(setq echo-keystrokes 0.1) + +;; Show column numbers in all buffers +(column-number-mode t) + +;; Highlight currently active line +(global-hl-line-mode t) + +(defalias 'yes-or-no-p 'y-or-n-p) +(defalias 'auto-tail-revert-mode 'tail-mode) + +;; Style line numbers (shown with M-g g) +(setq linum-format + (lambda (line) + (propertize + (format (concat " %" + (number-to-string + (length (number-to-string + (line-number-at-pos (point-max))))) + "d ") + line) + 'face 'linum))) + +;; Display tabs as 2 spaces +(setq tab-width 2) + +;; Don't wrap around when moving between buffers +(setq windmove-wrap-around nil) + +(provide 'look-and-feel) + -- cgit 1.4.1 From b0faa53657b3ef1c686ff0f87e75560bc6b104ef Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 13 Nov 2017 00:58:41 +0100 Subject: feat: Install magnars' string-edit package It's very nice. --- init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/init.el b/init.el index c1dd7fc510..986444ce34 100644 --- a/init.el +++ b/init.el @@ -53,6 +53,7 @@ restclient rust-mode smart-mode-line + string-edit switch-window terraform-mode undo-tree -- cgit 1.4.1 From 18462a2f287d8f2b90f98b4abe64da99dac6d84a Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 13 Nov 2017 10:21:37 +0100 Subject: feat(functions): Add M-x emacs-config helper --- init/functions.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/init/functions.el b/init/functions.el index c47e64d348..738b6d9f9d 100644 --- a/init/functions.el +++ b/init/functions.el @@ -110,6 +110,11 @@ Including indent-buffer, which should not be called automatically on save." (interactive) (find-file "/etc/nixos/configuration.nix")) +;; Open local emacs configuration +(defun emacs-config () + (interactive) + (dired "~/.emacs.d/")) + ;; Get the nix store path for a given derivation. ;; If the derivation has not been built before, this will trigger a build. (defun nix-store-path (derivation) -- cgit 1.4.1 From 6e7386b662d208f93e40b4567ad16f8d5ab54d5b Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 13 Nov 2017 10:23:52 +0100 Subject: fix(settings): Fix backup folder location --- init/settings.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/init/settings.el b/init/settings.el index b29e6eae20..cb19116e40 100644 --- a/init/settings.el +++ b/init/settings.el @@ -36,8 +36,7 @@ whitespace-line-column 80 default-directory "~" fill-column 80 - ediff-split-window-function 'split-window-horizontally - backup-directory-alist `((,(concat user-emacs-directory "backups")))) + ediff-split-window-function 'split-window-horizontally) (add-to-list 'safe-local-variable-values '(lexical-binding . t)) (add-to-list 'safe-local-variable-values '(whitespace-line-column . 80)) @@ -57,6 +56,8 @@ ;; Keep your temporary files in tmp, emacs! (setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t))) +(setq backup-directory-alist + `((".*" . ,temporary-file-directory))) (remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function) -- cgit 1.4.1 From 6225c1891424414a06f4b5a3a5a4c30312e24ace Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 15 Nov 2017 17:07:27 +0100 Subject: fix(custom): Fix Helm window splitting behaviour The default Helm window splitting behaviour is ridiculous. This fixes it! --- init/custom.el | 1 + 1 file changed, 1 insertion(+) diff --git a/init/custom.el b/init/custom.el index f9729f28e8..ef901fd94d 100644 --- a/init/custom.el +++ b/init/custom.el @@ -11,6 +11,7 @@ ("3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "d61fc0e6409f0c2a22e97162d7d151dee9e192a90fa623f8d6a071dbf49229c6" default))) '(frame-brackground-mode (quote dark)) '(global-auto-complete-mode t) + '(helm-split-window-in-side-p t) '(magit-log-show-gpg-status t) '(ns-alternate-modifier (quote none)) '(ns-command-modifier (quote control)) -- cgit 1.4.1 From 4e1661604d78d1a72c6a5203d0015c82c8ba684c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 15 Nov 2017 17:35:17 +0100 Subject: feat(nixos): Add initial NixOS & EXWM configuration Adds configuratio for using Emacs as a window manager, because clear that is an extremely sane thing to do. --- init.el | 5 +++-- init/custom.el | 2 +- init/nixos.el | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 init/nixos.el diff --git a/init.el b/init.el index 986444ce34..2ddebe4758 100644 --- a/init.el +++ b/init.el @@ -30,6 +30,7 @@ dash dockerfile-mode erlang + exwm flycheck go-mode gruber-darker-theme @@ -90,11 +91,11 @@ ;; Load configuration that makes use of installed packages: - ;; Emacs will automatically initialise all installed packages. ;; After initialisation, proceed to load configuration that requires packages: (defun load-other-settings () - (mapc 'require '(look-and-feel + (mapc 'require '(nixos + look-and-feel functions settings modes diff --git a/init/custom.el b/init/custom.el index ef901fd94d..0613cd781b 100644 --- a/init/custom.el +++ b/init/custom.el @@ -18,7 +18,7 @@ '(ns-right-command-modifier (quote meta)) '(package-selected-packages (quote - (fish-mode nix-mode yaml-mode undo-tree terraform-mode switch-window smart-mode-line rust-mode rainbow-mode rainbow-delimiters puppet-mode pkgbuild-mode password-store paredit multi-term multiple-cursors markdown-mode+ magit iy-go-to-char idle-highlight-mode hi2 helm haskell-mode gruber-darker-theme go-mode flycheck erlang dockerfile-mode confluence browse-kill-ring ag ace-jump-mode))) + (exwm which-key pandoc elnode fish-mode nix-mode yaml-mode undo-tree terraform-mode switch-window smart-mode-line rust-mode rainbow-mode rainbow-delimiters puppet-mode pkgbuild-mode password-store paredit multi-term multiple-cursors markdown-mode+ magit iy-go-to-char idle-highlight-mode hi2 helm haskell-mode gruber-darker-theme go-mode flycheck erlang dockerfile-mode confluence browse-kill-ring ag ace-jump-mode))) '(require-final-newline (quote visit-save))) (custom-set-faces ;; custom-set-faces was added by Custom. diff --git a/init/nixos.el b/init/nixos.el new file mode 100644 index 0000000000..ab62f81909 --- /dev/null +++ b/init/nixos.el @@ -0,0 +1,57 @@ +;; Configure additional settings if this is one of my NixOS machines +;; (i.e. if ExWM is required) +;; -*- lexical-binding: t; -*- + +(require 's) +(require 'f) + +(defvar is-nixos + (let ((os-f "/etc/os-release")) + (s-contains? + "NixOS" (if (f-file? os-f) (f-read os-f))))) + +(if is-nixos + (progn + (message "Running on NixOS, configuring ExWM.") + (require 'exwm) + (require 'exwm-config) + + ;; Start with one workspace (make more as needed) + (setq exwm-workspace-number 1) + ;; Make class name the buffer name + (add-hook 'exwm-update-class-hook + (lambda () + (exwm-workspace-rename-buffer exwm-class-name))) + + ;; 's-r': Reset + (exwm-input-set-key (kbd "s-r") #'exwm-reset) + ;; 's-w': Switch workspace + (exwm-input-set-key (kbd "s-w") #'exwm-workspace-switch) + ;; 's-N': Switch to certain workspace + (dotimes (i 10) + (exwm-input-set-key (kbd (format "s-%d" i)) + `(lambda () + (interactive) + (exwm-workspace-switch-create ,i)))) + + ;; Launch applications with completion (dmenu style!) + (exwm-input-set-key (kbd "s-p") #'helm-run-external-command) + + ;; Line-editing shortcuts + (exwm-input-set-simulation-keys + '(([?\C-b] . left) + ([?\C-f] . right) + ([?\C-p] . up) + ([?\C-n] . down) + ([?\C-a] . home) + ([?\C-e] . end) + ([?\M-v] . prior) + ([?\C-v] . next) + ([?\C-d] . delete) + ([?\C-k] . (S-end delete)))) + + ;; Enable EXWM + (exwm-enable) + (fringe-mode 1))) + +(provide 'nixos) -- cgit 1.4.1 From 29d4413f16af4afe30e2fcc543e29762fcc04b42 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 15 Nov 2017 18:29:01 +0100 Subject: feat: Install & globally enable which-key --- init.el | 1 + init/modes.el | 3 +++ 2 files changed, 4 insertions(+) diff --git a/init.el b/init.el index 2ddebe4758..275d445107 100644 --- a/init.el +++ b/init.el @@ -60,6 +60,7 @@ undo-tree uuidgen yaml-mode + which-key )) (defun installable-packages (pkg-list) diff --git a/init/modes.el b/init/modes.el index a0ad034cda..795e75365c 100644 --- a/init/modes.el +++ b/init/modes.el @@ -55,4 +55,7 @@ ;; Transparently open compressed files (auto-compression-mode t) +;; Show available key chord completions +(which-key-mode t) + (provide 'modes) -- cgit 1.4.1 From f06401d49339b8690aa4dbf660492d0d733d6a5b Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 15 Nov 2017 18:29:30 +0100 Subject: fix(nixos): Finetune some minor EXWM parameters --- init/nixos.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/init/nixos.el b/init/nixos.el index ab62f81909..1a4e6bb46c 100644 --- a/init/nixos.el +++ b/init/nixos.el @@ -16,8 +16,9 @@ (require 'exwm) (require 'exwm-config) - ;; Start with one workspace (make more as needed) - (setq exwm-workspace-number 1) + (fringe-mode 3) + + (setq exwm-workspace-number 2) ;; Make class name the buffer name (add-hook 'exwm-update-class-hook (lambda () @@ -37,6 +38,9 @@ ;; Launch applications with completion (dmenu style!) (exwm-input-set-key (kbd "s-p") #'helm-run-external-command) + ;; Toggle between line-mode / char-mode + (exwm-input-set-key (kbd "C-c C-t C-t") #'exwm-input-toggle-keyboard) + ;; Line-editing shortcuts (exwm-input-set-simulation-keys '(([?\C-b] . left) @@ -52,6 +56,5 @@ ;; Enable EXWM (exwm-enable) - (fringe-mode 1))) (provide 'nixos) -- cgit 1.4.1 From 84601a397866ad3c0b509e2003567c415b852244 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 15 Nov 2017 18:30:33 +0100 Subject: fix(nixos): Improve key bindings in X11 applications I don't actually use all that many emacs navication keys in X11 applications - but being able to copy & paste is nice. Overrides the default set of input simulation keys for EXWM with slightly fewer and more sane bindings. --- init/nixos.el | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/init/nixos.el b/init/nixos.el index 1a4e6bb46c..a8d02652a2 100644 --- a/init/nixos.el +++ b/init/nixos.el @@ -43,16 +43,8 @@ ;; Line-editing shortcuts (exwm-input-set-simulation-keys - '(([?\C-b] . left) - ([?\C-f] . right) - ([?\C-p] . up) - ([?\C-n] . down) - ([?\C-a] . home) - ([?\C-e] . end) - ([?\M-v] . prior) - ([?\C-v] . next) - ([?\C-d] . delete) - ([?\C-k] . (S-end delete)))) + '(([?\C-d] . delete) + ([?\C-w] . ?\C-c))) ;; Enable EXWM (exwm-enable) -- cgit 1.4.1 From b7a5dd0c1bd232f7c521d5647f57ba4021787e06 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 15 Nov 2017 18:56:01 +0100 Subject: feat(nixos): Enable EXWM compositor --- init/nixos.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/init/nixos.el b/init/nixos.el index a8d02652a2..20f2e6937e 100644 --- a/init/nixos.el +++ b/init/nixos.el @@ -15,6 +15,7 @@ (message "Running on NixOS, configuring ExWM.") (require 'exwm) (require 'exwm-config) + (require 'exwm-cm) (fringe-mode 3) @@ -49,4 +50,8 @@ ;; Enable EXWM (exwm-enable) + ;; Configure compositor + (setq exwm-cm-opacity 95) + (exwm-cm-enable))) + (provide 'nixos) -- cgit 1.4.1 From eb67c739b2c97b423d5b0223945b88a7a787b674 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 15 Nov 2017 18:56:23 +0100 Subject: feat: Use ace-window for jumping between windows --- init.el | 1 + init/bindings.el | 3 +++ init/custom.el | 2 +- init/modes.el | 3 +++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index 275d445107..a0db1aeb58 100644 --- a/init.el +++ b/init.el @@ -22,6 +22,7 @@ ;; editor packages ace-jump-mode + ace-window ag browse-kill-ring cargo diff --git a/init/bindings.el b/init/bindings.el index 2e37469df6..bb030f1bcc 100644 --- a/init/bindings.el +++ b/init/bindings.el @@ -16,6 +16,9 @@ (global-set-key (kbd "M-j") 'ace-jump-word-mode) (global-set-key (kbd "M-p") 'ace-jump-mode-pop-mark) +(global-set-key (kbd "C-x o") ; Yes, I went there! + 'ace-window) + ;; Window switching. (C-x o goes to the next window) (windmove-default-keybindings) ;; Shift+direction diff --git a/init/custom.el b/init/custom.el index 0613cd781b..c1276f7ea4 100644 --- a/init/custom.el +++ b/init/custom.el @@ -18,7 +18,7 @@ '(ns-right-command-modifier (quote meta)) '(package-selected-packages (quote - (exwm which-key pandoc elnode fish-mode nix-mode yaml-mode undo-tree terraform-mode switch-window smart-mode-line rust-mode rainbow-mode rainbow-delimiters puppet-mode pkgbuild-mode password-store paredit multi-term multiple-cursors markdown-mode+ magit iy-go-to-char idle-highlight-mode hi2 helm haskell-mode gruber-darker-theme go-mode flycheck erlang dockerfile-mode confluence browse-kill-ring ag ace-jump-mode))) + (ace-window exwm which-key pandoc elnode fish-mode nix-mode yaml-mode undo-tree terraform-mode switch-window smart-mode-line rust-mode rainbow-mode rainbow-delimiters puppet-mode pkgbuild-mode password-store paredit multi-term multiple-cursors markdown-mode+ magit iy-go-to-char idle-highlight-mode hi2 helm haskell-mode gruber-darker-theme go-mode flycheck erlang dockerfile-mode confluence browse-kill-ring ag ace-jump-mode))) '(require-final-newline (quote visit-save))) (custom-set-faces ;; custom-set-faces was added by Custom. diff --git a/init/modes.el b/init/modes.el index 795e75365c..4ce32ae304 100644 --- a/init/modes.el +++ b/init/modes.el @@ -58,4 +58,7 @@ ;; Show available key chord completions (which-key-mode t) +;; Show previews of ace-window numbers in the mode line for each window. +(ace-window-display-mode) + (provide 'modes) -- cgit 1.4.1 From 586148bd522b11081bde648c4e6da2c27d456cb3 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 15 Nov 2017 20:46:56 +0100 Subject: feat(nixos): Show time in the mode line --- init/nixos.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/init/nixos.el b/init/nixos.el index 20f2e6937e..da9bc1e56d 100644 --- a/init/nixos.el +++ b/init/nixos.el @@ -52,6 +52,9 @@ ;; Configure compositor (setq exwm-cm-opacity 95) - (exwm-cm-enable))) + (exwm-cm-enable) + + ;; Show time in the mode line + (display-time-mode))) (provide 'nixos) -- cgit 1.4.1 From 87a385557e26e3164d086e73ae753b94ffc471f6 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 15 Nov 2017 20:59:51 +0100 Subject: feat(modes): Enable company-mode for elisp by default --- init/modes.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init/modes.el b/init/modes.el index 4ce32ae304..d9a27c52a4 100644 --- a/init/modes.el +++ b/init/modes.el @@ -32,8 +32,9 @@ ;; Enable rainbow-delimiters for all things programming (add-hook 'prog-mode-hook 'rainbow-delimiters-mode) -;; Enable Paredit in Emacs Lisp mode +;; Enable Paredit & Company in Emacs Lisp mode (add-hook 'emacs-lisp-mode-hook 'paredit-mode) +(add-hook 'emacs-lisp-mode-hook 'company-mode) ;; Always highlight matching brackets (show-paren-mode 1) -- cgit 1.4.1 From a260bf9e8d3a02f68df0b664c7450693cd9d724f Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 15 Nov 2017 21:00:38 +0100 Subject: fix(settings): Show time in 24h format --- init/settings.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init/settings.el b/init/settings.el index cb19116e40..36380792d7 100644 --- a/init/settings.el +++ b/init/settings.el @@ -61,4 +61,7 @@ (remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function) +;; Show time in 24h format +(setq display-time-24hr-format t) + (provide 'settings) -- cgit 1.4.1 From a564cd4112b1136511536afea96fbc561d73e7ad Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 15 Nov 2017 21:00:59 +0100 Subject: fix(nixos): Let buffers move between workspaces --- init/nixos.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/init/nixos.el b/init/nixos.el index da9bc1e56d..b84624aa7d 100644 --- a/init/nixos.el +++ b/init/nixos.el @@ -55,6 +55,10 @@ (exwm-cm-enable) ;; Show time in the mode line - (display-time-mode))) + (display-time-mode) + + ;; Let buffers move seamlessly between workspaces + (setq exwm-workspace-show-all-buffers t) + (setq exwm-layout-show-all-buffers t))) (provide 'nixos) -- cgit 1.4.1 From 78f65fbc183556a98a23a7ed319f3384ae8b76db Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 17 Nov 2017 10:30:56 +0100 Subject: fix(settings): Make ace-window behave sanely --- init/settings.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init/settings.el b/init/settings.el index 36380792d7..7fc5126a73 100644 --- a/init/settings.el +++ b/init/settings.el @@ -64,4 +64,8 @@ ;; Show time in 24h format (setq display-time-24hr-format t) +;; Make ace-window behave in a sane way: +(setq aw-keys '(?f ?j ?d ?k ?s ?l ?a)) ; Homerow keys in sensible order! +(setq aw-scope 'frame) ; There are many frames in exwm, I don't care! + (provide 'settings) -- cgit 1.4.1 From 051c1116465141e0f5a9cf71bb0b08de06f7d874 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 17 Nov 2017 16:12:40 +0100 Subject: feat(nixos): Map brightness keys to light command --- init/nixos.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/init/nixos.el b/init/nixos.el index b84624aa7d..28b5f7fcb8 100644 --- a/init/nixos.el +++ b/init/nixos.el @@ -10,6 +10,14 @@ (s-contains? "NixOS" (if (f-file? os-f) (f-read os-f))))) +(defun brightness-up () + (interactive) + (shell-command "exec light -A 10")) + +(defun brightness-down () + (interactive) + (shell-command "exec light -U 10")) + (if is-nixos (progn (message "Running on NixOS, configuring ExWM.") @@ -42,6 +50,10 @@ ;; Toggle between line-mode / char-mode (exwm-input-set-key (kbd "C-c C-t C-t") #'exwm-input-toggle-keyboard) + ;; Brightness keys + (exwm-input-set-key (kbd "") #'brightness-down) + (exwm-input-set-key (kbd "") #'brightness-up) + ;; Line-editing shortcuts (exwm-input-set-simulation-keys '(([?\C-d] . delete) -- cgit 1.4.1 From f18e578c4b0caf241345a205d9a89d4151ccc85b Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 17 Nov 2017 18:24:27 +0100 Subject: feat(nixos): Add key binding for starting i3lock --- init/nixos.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/init/nixos.el b/init/nixos.el index 28b5f7fcb8..edeeca49d2 100644 --- a/init/nixos.el +++ b/init/nixos.el @@ -18,6 +18,10 @@ (interactive) (shell-command "exec light -U 10")) +(defun lock-screen () + (interactive) + (shell-command "i3lock")) + (if is-nixos (progn (message "Running on NixOS, configuring ExWM.") @@ -53,6 +57,7 @@ ;; Brightness keys (exwm-input-set-key (kbd "") #'brightness-down) (exwm-input-set-key (kbd "") #'brightness-up) + (exwm-input-set-key (kbd "") #'lock-screen) ;; Line-editing shortcuts (exwm-input-set-simulation-keys -- cgit 1.4.1 From 06cf685a88df067bd5812f06f1a60da9ed63e21a Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 18 Nov 2017 23:19:15 +0100 Subject: feat(nixos): Configure pulseaudio volume keys --- init/nixos.el | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/init/nixos.el b/init/nixos.el index edeeca49d2..1c874dacdc 100644 --- a/init/nixos.el +++ b/init/nixos.el @@ -10,13 +10,23 @@ (s-contains? "NixOS" (if (f-file? os-f) (f-read os-f))))) +(defun pulseaudio-ctl (cmd) + (shell-command (concat "pulseaudio-ctl " cmd)) + (message "Volume command: %s" cmd)) + +(defun volume-mute () (interactive) (pulseaudio-ctl "mute")) +(defun volume-up () (interactive) (pulseaudio-ctl "up")) +(defun volume-down () (interactive) (pulseaudio-ctl "down")) + (defun brightness-up () (interactive) - (shell-command "exec light -A 10")) + (shell-command "exec light -A 10") + (message "Brightness increased")) (defun brightness-down () (interactive) - (shell-command "exec light -U 10")) + (shell-command "exec light -U 10") + (message "Brightness decreased")) (defun lock-screen () (interactive) @@ -54,6 +64,11 @@ ;; Toggle between line-mode / char-mode (exwm-input-set-key (kbd "C-c C-t C-t") #'exwm-input-toggle-keyboard) + ;; Volume keys + (exwm-input-set-key (kbd "") #'volume-mute) + (exwm-input-set-key (kbd "") #'volume-up) + (exwm-input-set-key (kbd "") #'volume-down) + ;; Brightness keys (exwm-input-set-key (kbd "") #'brightness-down) (exwm-input-set-key (kbd "") #'brightness-up) -- cgit 1.4.1 From dd9d8af25b0821985eba38ba87533fe4f43e5123 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 18 Nov 2017 23:19:30 +0100 Subject: feat(nixos): Make helm "dmenu alternatives" work similar to i3 --- init/nixos.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init/nixos.el b/init/nixos.el index 1c874dacdc..537fae4ed4 100644 --- a/init/nixos.el +++ b/init/nixos.el @@ -59,7 +59,8 @@ (exwm-workspace-switch-create ,i)))) ;; Launch applications with completion (dmenu style!) - (exwm-input-set-key (kbd "s-p") #'helm-run-external-command) + (exwm-input-set-key (kbd "s-d") #'helm-run-external-command) + (exwm-input-set-key (kbd "s-p") #'helm-pass) ;; Toggle between line-mode / char-mode (exwm-input-set-key (kbd "C-c C-t C-t") #'exwm-input-toggle-keyboard) -- cgit 1.4.1 From 7a41f8cd229111284a47b38d5b01da10f6a111ad Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 18 Nov 2017 23:20:11 +0100 Subject: chore: Remove unused dependencies (well, dash was technically a duplicate) --- init.el | 4 ---- 1 file changed, 4 deletions(-) diff --git a/init.el b/init.el index a0db1aeb58..e984010023 100644 --- a/init.el +++ b/init.el @@ -23,12 +23,9 @@ ;; editor packages ace-jump-mode ace-window - ag browse-kill-ring cargo company - confluence - dash dockerfile-mode erlang exwm @@ -47,7 +44,6 @@ paredit password-store pg - pkgbuild-mode puppet-mode racer rainbow-delimiters -- cgit 1.4.1 From a9866504ea3d1423912403a5cad3526621a2d76a Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 20 Nov 2017 13:21:39 +0100 Subject: fix(look-and-feel): Transparent emacs gets old fast --- init/look-and-feel.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/init/look-and-feel.el b/init/look-and-feel.el index 83aad1c3a6..59a937a176 100644 --- a/init/look-and-feel.el +++ b/init/look-and-feel.el @@ -24,8 +24,7 @@ (defun configure-new-frame (frame) "Configuration settings to run whenever a new frame is created." - (scroll-bar-mode 0) ; Disable visual scroll bar (ugh!) - (set-frame-parameter frame 'alpha '(97 . 95))) ; Transparent emacs! + (scroll-bar-mode 0)) ; Disable visual scroll bar (ugh!) (add-hook 'after-make-frame-functions 'configure-new-frame) -- cgit 1.4.1 From 75fc7a0cc14dce0c3bbdc43d2143ff78d6ee71d8 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 20 Nov 2017 14:19:18 +0100 Subject: fix(nixos): Disable the rather unstable EXWM compositor --- init/nixos.el | 5 ----- 1 file changed, 5 deletions(-) diff --git a/init/nixos.el b/init/nixos.el index 537fae4ed4..2fc5bc4340 100644 --- a/init/nixos.el +++ b/init/nixos.el @@ -37,7 +37,6 @@ (message "Running on NixOS, configuring ExWM.") (require 'exwm) (require 'exwm-config) - (require 'exwm-cm) (fringe-mode 3) @@ -83,10 +82,6 @@ ;; Enable EXWM (exwm-enable) - ;; Configure compositor - (setq exwm-cm-opacity 95) - (exwm-cm-enable) - ;; Show time in the mode line (display-time-mode) -- cgit 1.4.1 From 3c0622afe687df0acadb7e36d64b042dcf1c6005 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 20 Nov 2017 17:34:28 +0100 Subject: feat(helm): Always split inside of active window --- init/custom.el | 1 + 1 file changed, 1 insertion(+) diff --git a/init/custom.el b/init/custom.el index c1276f7ea4..1d8840bf3e 100644 --- a/init/custom.el +++ b/init/custom.el @@ -12,6 +12,7 @@ '(frame-brackground-mode (quote dark)) '(global-auto-complete-mode t) '(helm-split-window-in-side-p t) + '(helm-split-window-inside-p t) '(magit-log-show-gpg-status t) '(ns-alternate-modifier (quote none)) '(ns-command-modifier (quote control)) -- cgit 1.4.1 From 1eab9e4b256b26bd3e2c6cd3dc4ad0b97fb8032d Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 20 Nov 2017 17:35:25 +0100 Subject: feat(pkgs): Add geiser & helm extensions --- init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init.el b/init.el index e984010023..044d946e7b 100644 --- a/init.el +++ b/init.el @@ -30,10 +30,13 @@ erlang exwm flycheck + geiser go-mode gruber-darker-theme haskell-mode helm + helm-exwm + helm-pass hi2 idle-highlight-mode magit -- cgit 1.4.1 From 553b38ea76d1e2309744595441ffb9a841d15c1d Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 20 Nov 2017 17:35:59 +0100 Subject: feat(pkgs): Install Racket mode --- init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/init.el b/init.el index 044d946e7b..0b7733bb0c 100644 --- a/init.el +++ b/init.el @@ -49,6 +49,7 @@ pg puppet-mode racer + racket-mode rainbow-delimiters rainbow-mode restclient -- cgit 1.4.1 From 3cd22f287814fe37c2c7335256444d3339041a23 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 20 Nov 2017 17:36:24 +0100 Subject: feat: Show backtraces for failed cargo commands --- init/custom.el | 1 + 1 file changed, 1 insertion(+) diff --git a/init/custom.el b/init/custom.el index 1d8840bf3e..cc4ec3268a 100644 --- a/init/custom.el +++ b/init/custom.el @@ -5,6 +5,7 @@ ;; If there is more than one, they won't work right. '(ac-auto-show-menu 0.8) '(ac-delay 0.2) + '(cargo-process--enable-rust-backtrace 1) '(custom-enabled-themes (quote (gruber-darker))) '(custom-safe-themes (quote -- cgit 1.4.1 From ff7a9576b2ce206ff2bf73b53de2191d41f347b3 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 22 Nov 2017 23:54:38 +0100 Subject: fix(kubernetes): Don't open overview in full-frame mode --- init/custom.el | 1 + 1 file changed, 1 insertion(+) diff --git a/init/custom.el b/init/custom.el index cc4ec3268a..85423e0ae5 100644 --- a/init/custom.el +++ b/init/custom.el @@ -14,6 +14,7 @@ '(global-auto-complete-mode t) '(helm-split-window-in-side-p t) '(helm-split-window-inside-p t) + '(kubernetes-commands-display-buffer-function (quote display-buffer)) '(magit-log-show-gpg-status t) '(ns-alternate-modifier (quote none)) '(ns-command-modifier (quote control)) -- cgit 1.4.1 From 4dce87d1e21e06f3321b974ebc3f37490121ebfc Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 22 Nov 2017 23:55:01 +0100 Subject: feat(lisp): Add basic Common Lisp settings --- init.el | 1 + init/lisp-settings.el | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 init/lisp-settings.el diff --git a/init.el b/init.el index 0b7733bb0c..345e43859c 100644 --- a/init.el +++ b/init.el @@ -56,6 +56,7 @@ rust-mode smart-mode-line string-edit + slime switch-window terraform-mode undo-tree diff --git a/init/lisp-settings.el b/init/lisp-settings.el new file mode 100644 index 0000000000..31bbe3537f --- /dev/null +++ b/init/lisp-settings.el @@ -0,0 +1,11 @@ +;; lisp-settings.el - settings for various Lisp dialects +;; -*- lexical-binding: t; -*- + +;; All the lisps: + +(add-to-list 'lisp-mode-hook #'paredit-mode) + +;; Common Lisp: +(load (expand-file-name "~/quicklisp/slime-helper.el")) +(setq inferior-lisp-program (concat (nix-store-path "sbcl") "/bin/sbcl")) +(setq slime-contribs '(slime-fancy)) -- cgit 1.4.1 From f93f03661beb8cbb88e24609d06c1f4c9fea8b6e Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 22 Nov 2017 23:55:21 +0100 Subject: feat(functions): Add function to toggle final-newline behaviour --- init/functions.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/init/functions.el b/init/functions.el index 738b6d9f9d..726d40f257 100644 --- a/init/functions.el +++ b/init/functions.el @@ -126,4 +126,12 @@ Including indent-buffer, which should not be called automatically on save." (let ((derivation (read-string "Derivation name (in ): "))) (insert (nix-store-path derivation)))) +(defun toggle-force-newline () + "Buffer-local toggle for enforcing final newline on save." + (interactive) + (setq-local require-final-newline (not require-final-newline)) + (message "require-final-newline in buffer %s is now %s" + (buffer-name) + require-final-newline)) + (provide 'functions) -- cgit 1.4.1 From 5b946a930cdcab0d37ad1f06b2c40d43073e67d0 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 24 Nov 2017 16:45:12 +0100 Subject: fix(lisp): Actually require lisp-setup in init.el --- init.el | 1 + init/lisp-settings.el | 11 ----------- init/lisp-setup.el | 13 +++++++++++++ 3 files changed, 14 insertions(+), 11 deletions(-) delete mode 100644 init/lisp-settings.el create mode 100644 init/lisp-setup.el diff --git a/init.el b/init.el index 345e43859c..10b1bcbd34 100644 --- a/init.el +++ b/init.el @@ -106,6 +106,7 @@ eshell-setup haskell-setup rust-setup + lisp-setup ))) (add-hook 'after-init-hook 'load-other-settings) diff --git a/init/lisp-settings.el b/init/lisp-settings.el deleted file mode 100644 index 31bbe3537f..0000000000 --- a/init/lisp-settings.el +++ /dev/null @@ -1,11 +0,0 @@ -;; lisp-settings.el - settings for various Lisp dialects -;; -*- lexical-binding: t; -*- - -;; All the lisps: - -(add-to-list 'lisp-mode-hook #'paredit-mode) - -;; Common Lisp: -(load (expand-file-name "~/quicklisp/slime-helper.el")) -(setq inferior-lisp-program (concat (nix-store-path "sbcl") "/bin/sbcl")) -(setq slime-contribs '(slime-fancy)) diff --git a/init/lisp-setup.el b/init/lisp-setup.el new file mode 100644 index 0000000000..816d34b37e --- /dev/null +++ b/init/lisp-setup.el @@ -0,0 +1,13 @@ +;; lisp-settings.el - settings for various Lisp dialects +;; -*- lexical-binding: t; -*- + +;; All the lisps: + +(add-to-list 'lisp-mode-hook #'paredit-mode) + +;; Common Lisp: +(load (expand-file-name "~/quicklisp/slime-helper.el")) +(setq inferior-lisp-program (concat (nix-store-path "sbcl") "/bin/sbcl")) +(setq slime-contribs '(slime-fancy)) + +(provide 'lisp-setup) -- cgit 1.4.1 From 443e8ea995e423f6a0795bd88b79164cd816b795 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 3 Dec 2017 18:36:19 +0100 Subject: feat(look-and-feel): Font-size based on host My desktop is currently connected to a 4K screen and needs *slightly* larger fonts for readability. --- init/look-and-feel.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/init/look-and-feel.el b/init/look-and-feel.el index 59a937a176..3229b85a40 100644 --- a/init/look-and-feel.el +++ b/init/look-and-feel.el @@ -17,10 +17,14 @@ (blink-cursor-mode -1)) ;; Configure editor fonts -(setq default-frame-alist '((font-backend . "xft") - (font . "Input Mono-12"))) -(set-frame-font "Input Mono 12" t t) +;; Determine fontsize based on machine (4K display on stallo): +(letrec ((hostname (s-trim (f-read "/etc/hostname"))) + (font-size (if (equal hostname "stallo") 38 12)) + (font (format "Input Mono-%d" font-size))) + (setq default-frame-alist `((font-backend . "xft") + (font . ,font))) + (set-frame-font font t t)) (defun configure-new-frame (frame) "Configuration settings to run whenever a new frame is created." -- cgit 1.4.1 From f50c4a9ec137185afa7143801d71f9b18ca46d79 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 4 Jan 2018 09:29:15 +0100 Subject: feat(nixos): Fix EXWM multi-screen outputting Pins a set amount of screens on each display corresponding to the key wells on my Kinesis :sun: --- init/nixos.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/init/nixos.el b/init/nixos.el index 2fc5bc4340..3caeec9a5c 100644 --- a/init/nixos.el +++ b/init/nixos.el @@ -4,6 +4,7 @@ (require 's) (require 'f) +(require 'dash) (defvar is-nixos (let ((os-f "/etc/os-release")) @@ -32,11 +33,17 @@ (interactive) (shell-command "i3lock")) +(defun generate-randr-config () + (-flatten `(,(-map (lambda (n) (list n "DP2")) (number-sequence 1 5)) + (0 "eDP1") + ,(-map (lambda (n) (list n "eDP1")) (number-sequence 6 9))))) + (if is-nixos (progn (message "Running on NixOS, configuring ExWM.") (require 'exwm) (require 'exwm-config) + (require 'exwm-randr) (fringe-mode 3) @@ -85,6 +92,10 @@ ;; Show time in the mode line (display-time-mode) + ;; Another attempt at xrandr configuration + (setq exwm-randr-workspace-output-plist (generate-randr-config)) + (exwm-randr-enable) + ;; Let buffers move seamlessly between workspaces (setq exwm-workspace-show-all-buffers t) (setq exwm-layout-show-all-buffers t))) -- cgit 1.4.1 From f7a4d401b8117f96142a17a29d65b1e69c152d5b Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 4 Jan 2018 09:29:56 +0100 Subject: chore(pkgs): Minor package updates --- init.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index 10b1bcbd34..aba5bfc002 100644 --- a/init.el +++ b/init.el @@ -37,6 +37,7 @@ helm helm-exwm helm-pass + helm-swoop hi2 idle-highlight-mode magit @@ -56,7 +57,9 @@ rust-mode smart-mode-line string-edit - slime + sly + sly-company + sly-quicklisp switch-window terraform-mode undo-tree -- cgit 1.4.1 From 40abd164e6133e31e0437e4fa1adc0f3b8ba20d5 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 4 Jan 2018 09:30:08 +0100 Subject: fix(custom): Fix Elnode file sending on NixOS --- init/custom.el | 1 + 1 file changed, 1 insertion(+) diff --git a/init/custom.el b/init/custom.el index 85423e0ae5..7921d0a4a2 100644 --- a/init/custom.el +++ b/init/custom.el @@ -10,6 +10,7 @@ '(custom-safe-themes (quote ("3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "d61fc0e6409f0c2a22e97162d7d151dee9e192a90fa623f8d6a071dbf49229c6" default))) + '(elnode-send-file-program "/run/current-system/sw/bin/cat") '(frame-brackground-mode (quote dark)) '(global-auto-complete-mode t) '(helm-split-window-in-side-p t) -- cgit 1.4.1 From 866d8996e3b5c6c71691726070fbd4719c1c8824 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 4 Jan 2018 09:30:30 +0100 Subject: feat(settings): Enable GPG pinentry in emacs This doesn't work via helm-pass yet, not quite sure why (yet). --- init/settings.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init/settings.el b/init/settings.el index 7fc5126a73..2324a38f45 100644 --- a/init/settings.el +++ b/init/settings.el @@ -68,4 +68,8 @@ (setq aw-keys '(?f ?j ?d ?k ?s ?l ?a)) ; Homerow keys in sensible order! (setq aw-scope 'frame) ; There are many frames in exwm, I don't care! +;; Configure pinentry for use with GPG +(setq epa-pinentry-mode 'loopback) +(pinentry-start) + (provide 'settings) -- cgit 1.4.1 From f3b9126fa20c946325bad332ee2a48443feb4843 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 4 Jan 2018 23:22:51 +0100 Subject: chore(look-and-feel): Remove 4K display logic for stallo Back to a normal screen! --- init/look-and-feel.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/init/look-and-feel.el b/init/look-and-feel.el index 3229b85a40..e40299c602 100644 --- a/init/look-and-feel.el +++ b/init/look-and-feel.el @@ -19,8 +19,7 @@ ;; Configure editor fonts ;; Determine fontsize based on machine (4K display on stallo): -(letrec ((hostname (s-trim (f-read "/etc/hostname"))) - (font-size (if (equal hostname "stallo") 38 12)) +(letrec ((font-size 12) (font (format "Input Mono-%d" font-size))) (setq default-frame-alist `((font-backend . "xft") (font . ,font))) -- cgit 1.4.1 From 2dff64d9b45c41572ecbab4a370656a246e220ad Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 20 Jan 2018 16:57:10 +0100 Subject: feat(lisp): Configure company-mode for Common Lisp --- init/lisp-setup.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/init/lisp-setup.el b/init/lisp-setup.el index 816d34b37e..e4174b587b 100644 --- a/init/lisp-setup.el +++ b/init/lisp-setup.el @@ -3,11 +3,20 @@ ;; All the lisps: +(add-to-list 'lisp-mode-hook #'company-mode) (add-to-list 'lisp-mode-hook #'paredit-mode) +(define-key lisp-mode-map (kbd "TAB") + #'company-indent-or-complete-common) + ;; Common Lisp: -(load (expand-file-name "~/quicklisp/slime-helper.el")) (setq inferior-lisp-program (concat (nix-store-path "sbcl") "/bin/sbcl")) -(setq slime-contribs '(slime-fancy)) + +(add-to-list 'company-backends 'sly-company) +(add-to-list 'sly-mrepl-mode-hook #'paredit-mode) +(add-to-list 'sly-mrepl-mode-hook #'company-mode) + +(define-key sly-mrepl-mode-map (kbd "TAB") + #'company-indent-or-complete-common) (provide 'lisp-setup) -- cgit 1.4.1 From b713aab0d12a5c90d2ef1fe5b17f7d075cabacce Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 25 Jan 2018 13:22:21 +0100 Subject: chore(bindings): Replace ace-jump with avy --- init/bindings.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init/bindings.el b/init/bindings.el index bb030f1bcc..1495e9e99b 100644 --- a/init/bindings.el +++ b/init/bindings.el @@ -12,9 +12,9 @@ (global-set-key (kbd "C-M-r") 'isearch-backward) (global-set-key (kbd "C-M-%") 'query-replace) -;; Ace-jump-mode -(global-set-key (kbd "M-j") 'ace-jump-word-mode) -(global-set-key (kbd "M-p") 'ace-jump-mode-pop-mark) +;; Avy mode +(global-set-key (kbd "M-j") 'avy-goto-char) +(global-set-key (kbd "M-p") 'avy-pop-mark) (global-set-key (kbd "C-x o") ; Yes, I went there! 'ace-window) -- cgit 1.4.1 From ed4cc264fa725835372dbd4d926ac0bf75544a08 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 4 Feb 2018 13:42:42 +0100 Subject: feat(lisp): Install and enable adjust-parens --- init.el | 1 + init/custom.el | 2 +- init/lisp-setup.el | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index aba5bfc002..0a85fa5397 100644 --- a/init.el +++ b/init.el @@ -23,6 +23,7 @@ ;; editor packages ace-jump-mode ace-window + adjust-parens browse-kill-ring cargo company diff --git a/init/custom.el b/init/custom.el index 7921d0a4a2..21f1715939 100644 --- a/init/custom.el +++ b/init/custom.el @@ -22,7 +22,7 @@ '(ns-right-command-modifier (quote meta)) '(package-selected-packages (quote - (ace-window exwm which-key pandoc elnode fish-mode nix-mode yaml-mode undo-tree terraform-mode switch-window smart-mode-line rust-mode rainbow-mode rainbow-delimiters puppet-mode pkgbuild-mode password-store paredit multi-term multiple-cursors markdown-mode+ magit iy-go-to-char idle-highlight-mode hi2 helm haskell-mode gruber-darker-theme go-mode flycheck erlang dockerfile-mode confluence browse-kill-ring ag ace-jump-mode))) + (adjust-parens parinfer pdf-tools groovy-mode ace-window exwm which-key pandoc elnode fish-mode nix-mode yaml-mode undo-tree terraform-mode switch-window smart-mode-line rust-mode rainbow-mode rainbow-delimiters puppet-mode pkgbuild-mode password-store paredit multi-term multiple-cursors markdown-mode+ magit iy-go-to-char idle-highlight-mode hi2 helm haskell-mode gruber-darker-theme go-mode flycheck erlang dockerfile-mode confluence browse-kill-ring ag ace-jump-mode))) '(require-final-newline (quote visit-save))) (custom-set-faces ;; custom-set-faces was added by Custom. diff --git a/init/lisp-setup.el b/init/lisp-setup.el index e4174b587b..62bb1122ad 100644 --- a/init/lisp-setup.el +++ b/init/lisp-setup.el @@ -5,6 +5,7 @@ (add-to-list 'lisp-mode-hook #'company-mode) (add-to-list 'lisp-mode-hook #'paredit-mode) +(add-to-list 'lisp-mode-hook #'adjust-parens-mode) (define-key lisp-mode-map (kbd "TAB") #'company-indent-or-complete-common) -- cgit 1.4.1 From 11eed83d5762c148b3a22402eb99a3bd800509d1 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 4 Feb 2018 13:43:06 +0100 Subject: fix(custom): Fix look&feel of Avy to be more like ace-jump --- init/custom.el | 1 + 1 file changed, 1 insertion(+) diff --git a/init/custom.el b/init/custom.el index 21f1715939..28618b5322 100644 --- a/init/custom.el +++ b/init/custom.el @@ -5,6 +5,7 @@ ;; If there is more than one, they won't work right. '(ac-auto-show-menu 0.8) '(ac-delay 0.2) + '(avy-background t) '(cargo-process--enable-rust-backtrace 1) '(custom-enabled-themes (quote (gruber-darker))) '(custom-safe-themes -- cgit 1.4.1 From 536bdb40f3a7700a4d9774196cad099875adbab3 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 4 Feb 2018 21:17:32 +0100 Subject: fix(lisp): Don't set any Sly-mrepl hook settings For some reason the Sly-mrepl hooks aren't available until a REPL has actually been launched once. There doesn't seem to be a library that I can require to fix it, either, so until I have time to figure it out it stays commented out. --- init/custom.el | 1 - init/lisp-setup.el | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/init/custom.el b/init/custom.el index 28618b5322..d91afb668c 100644 --- a/init/custom.el +++ b/init/custom.el @@ -14,7 +14,6 @@ '(elnode-send-file-program "/run/current-system/sw/bin/cat") '(frame-brackground-mode (quote dark)) '(global-auto-complete-mode t) - '(helm-split-window-in-side-p t) '(helm-split-window-inside-p t) '(kubernetes-commands-display-buffer-function (quote display-buffer)) '(magit-log-show-gpg-status t) diff --git a/init/lisp-setup.el b/init/lisp-setup.el index 62bb1122ad..7cab95a220 100644 --- a/init/lisp-setup.el +++ b/init/lisp-setup.el @@ -1,6 +1,8 @@ ;; lisp-settings.el - settings for various Lisp dialects ;; -*- lexical-binding: t; -*- +(require 'sly) + ;; All the lisps: (add-to-list 'lisp-mode-hook #'company-mode) @@ -14,10 +16,5 @@ (setq inferior-lisp-program (concat (nix-store-path "sbcl") "/bin/sbcl")) (add-to-list 'company-backends 'sly-company) -(add-to-list 'sly-mrepl-mode-hook #'paredit-mode) -(add-to-list 'sly-mrepl-mode-hook #'company-mode) - -(define-key sly-mrepl-mode-map (kbd "TAB") - #'company-indent-or-complete-common) (provide 'lisp-setup) -- cgit 1.4.1 From 128bb8c417602961a6d95427336c5d64bf1c2321 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 5 Feb 2018 23:04:09 +0100 Subject: fix(lisp): Require adjust-parens mode If this mode is not required in time it will cause Lisp mode setup hooks to fail. --- init/lisp-setup.el | 1 + 1 file changed, 1 insertion(+) diff --git a/init/lisp-setup.el b/init/lisp-setup.el index 7cab95a220..e117817e3f 100644 --- a/init/lisp-setup.el +++ b/init/lisp-setup.el @@ -1,6 +1,7 @@ ;; lisp-settings.el - settings for various Lisp dialects ;; -*- lexical-binding: t; -*- +(require 'adjust-parens) (require 'sly) ;; All the lisps: -- cgit 1.4.1 From 91f50b5f0a7c556a969c2fb3a9c85ebf7d0c766c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 22 Feb 2018 23:25:57 +0100 Subject: feat(bindings): Bind imenu to a global key --- init/bindings.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init/bindings.el b/init/bindings.el index 1495e9e99b..e4cd17599f 100644 --- a/init/bindings.el +++ b/init/bindings.el @@ -16,6 +16,9 @@ (global-set-key (kbd "M-j") 'avy-goto-char) (global-set-key (kbd "M-p") 'avy-pop-mark) +;; imenu instead of insert-file +(global-set-key (kbd "C-x i") 'imenu) + (global-set-key (kbd "C-x o") ; Yes, I went there! 'ace-window) -- cgit 1.4.1 From 3902efcf9aac42431873ea76b8ef2fe07f9c1116 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 23 Feb 2018 10:03:15 +0100 Subject: chore: Remove helm-swoop helm-occur does what I want already --- init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.el b/init.el index 0a85fa5397..58e0b81a78 100644 --- a/init.el +++ b/init.el @@ -38,7 +38,6 @@ helm helm-exwm helm-pass - helm-swoop hi2 idle-highlight-mode magit @@ -114,3 +113,4 @@ ))) (add-hook 'after-init-hook 'load-other-settings) +(put 'narrow-to-region 'disabled nil) -- cgit 1.4.1 From fc76db3d96626ba449a37d603e2a44c3c7d78123 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 4 Mar 2018 00:14:13 +0100 Subject: refactor(init): Remove package installation configuration Package installation has moved to my NixOS configuration. --- init.el | 78 ++--------------------------------------------------------------- 1 file changed, 2 insertions(+), 76 deletions(-) diff --git a/init.el b/init.el index 58e0b81a78..8cc6fe7cf7 100644 --- a/init.el +++ b/init.el @@ -1,87 +1,13 @@ ;;; init.el --- Package bootstrapping. -*- lexical-binding: t; -*- -;; This file bootstraps the Emacs setup by going through package installations. -;; After all packages are installed, local configuration is loaded. +;; Packages are installed via Nix configuration, this file only +;; initialises the newly loaded packages. (require 'package) (require 'seq) -;; Configure Marmalade and MELPA repositories. Packages available on Marmalade -;; will have precedence. -(add-to-list 'package-archives '("marmalade" . "https://marmalade-repo.org/packages/")) -(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")) (package-initialize) -;; This variable controls all packages that should be installed. -(defvar desired-packages - '(;; elisp libraries - dash - dash-functional - ht - s - - ;; editor packages - ace-jump-mode - ace-window - adjust-parens - browse-kill-ring - cargo - company - dockerfile-mode - erlang - exwm - flycheck - geiser - go-mode - gruber-darker-theme - haskell-mode - helm - helm-exwm - helm-pass - hi2 - idle-highlight-mode - magit - markdown-mode+ - multi-term - multiple-cursors - nix-mode - paredit - password-store - pg - puppet-mode - racer - racket-mode - rainbow-delimiters - rainbow-mode - restclient - rust-mode - smart-mode-line - string-edit - sly - sly-company - sly-quicklisp - switch-window - terraform-mode - undo-tree - uuidgen - yaml-mode - which-key - )) - -(defun installable-packages (pkg-list) - "Filter out not-yet installed packages from package list." - (seq-filter (lambda (p) (not (package-installed-p p))) pkg-list)) - -(defun install-needed-packages (pkg-list) - (let ((to-install (installable-packages pkg-list))) - (if (< 0 (length to-install)) - (progn (package-refresh-contents) - (mapcar #'package-install to-install)) - (message "No new packages to install.")))) - -;; Run package installation! -(install-needed-packages desired-packages) - ;; Configure a few basics before moving on to package-specific initialisation. (setq custom-file (concat user-emacs-directory "init/custom.el")) (load custom-file) -- cgit 1.4.1 From 845fa34448b8c7c66a6b7cd18d2b2f2d5016542c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 4 Mar 2018 00:15:35 +0100 Subject: feat(custom): Set term-mode colour scheme to Gruber Darker --- init/custom.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/init/custom.el b/init/custom.el index d91afb668c..61fbfabe85 100644 --- a/init/custom.el +++ b/init/custom.el @@ -37,4 +37,12 @@ '(rainbow-delimiters-depth-6-face ((t (:foreground "#268bd2")))) '(rainbow-delimiters-depth-7-face ((t (:foreground "#cb4b16")))) '(rainbow-delimiters-depth-8-face ((t (:foreground "#d33682")))) - '(rainbow-delimiters-depth-9-face ((t (:foreground "#839496"))))) + '(rainbow-delimiters-depth-9-face ((t (:foreground "#839496")))) + '(term-color-black ((t (:background "#282828" :foreground "#282828")))) + '(term-color-blue ((t (:background "#96a6c8" :foreground "#96a6c8")))) + '(term-color-cyan ((t (:background "#1fad83" :foreground "#1fad83")))) + '(term-color-green ((t (:background "#73c936" :foreground "#73c936")))) + '(term-color-magenta ((t (:background "#9e95c7" :foreground "#9e95c7")))) + '(term-color-red ((t (:background "#f43841" :foreground "#f43841")))) + '(term-color-white ((t (:background "#f5f5f5" :foreground "#f5f5f5")))) + '(term-color-yellow ((t (:background "#ffdd33" :foreground "#ffdd33"))))) -- cgit 1.4.1 From 82c6a5e3d59308cb7bff653a6b20745528b47dce Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 4 Mar 2018 00:28:52 +0100 Subject: chore(custom): Remove package-related settings Remove settings that are no longer needed after migrating package installations to Nix. --- init/custom.el | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/init/custom.el b/init/custom.el index 61fbfabe85..d518483678 100644 --- a/init/custom.el +++ b/init/custom.el @@ -10,7 +10,7 @@ '(custom-enabled-themes (quote (gruber-darker))) '(custom-safe-themes (quote - ("3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "d61fc0e6409f0c2a22e97162d7d151dee9e192a90fa623f8d6a071dbf49229c6" default))) + ("3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "89336ca71dae5068c165d932418a368a394848c3b8881b2f96807405d8c6b5b6" default))) '(elnode-send-file-program "/run/current-system/sw/bin/cat") '(frame-brackground-mode (quote dark)) '(global-auto-complete-mode t) @@ -20,9 +20,6 @@ '(ns-alternate-modifier (quote none)) '(ns-command-modifier (quote control)) '(ns-right-command-modifier (quote meta)) - '(package-selected-packages - (quote - (adjust-parens parinfer pdf-tools groovy-mode ace-window exwm which-key pandoc elnode fish-mode nix-mode yaml-mode undo-tree terraform-mode switch-window smart-mode-line rust-mode rainbow-mode rainbow-delimiters puppet-mode pkgbuild-mode password-store paredit multi-term multiple-cursors markdown-mode+ magit iy-go-to-char idle-highlight-mode hi2 helm haskell-mode gruber-darker-theme go-mode flycheck erlang dockerfile-mode confluence browse-kill-ring ag ace-jump-mode))) '(require-final-newline (quote visit-save))) (custom-set-faces ;; custom-set-faces was added by Custom. -- cgit 1.4.1 From 97da0904f9297ec39f61b59a961d430eb131eb97 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 9 Mar 2018 11:09:32 +0100 Subject: feat(init): Start edit-server on launch --- init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/init.el b/init.el index 8cc6fe7cf7..6e6dd07e1e 100644 --- a/init.el +++ b/init.el @@ -40,3 +40,4 @@ (add-hook 'after-init-hook 'load-other-settings) (put 'narrow-to-region 'disabled nil) +(edit-server-start) -- cgit 1.4.1 From 58d825d5dd0d661a09cd145034ce9518a25d5933 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 9 Mar 2018 11:09:45 +0100 Subject: feat(bindings): Bind align-regexp & browse-url-* functions to keys --- init/bindings.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/init/bindings.el b/init/bindings.el index e4cd17599f..edb1b9c0ab 100644 --- a/init/bindings.el +++ b/init/bindings.el @@ -38,8 +38,12 @@ (global-set-key (kbd "M-g g") 'ace-jump-line-mode) (global-set-key (kbd "M-g M-g") 'goto-line-with-feedback) -;; Bind whitespace cleanup to a key (global-set-key (kbd "C-c w") 'whitespace-cleanup) +(global-set-key (kbd "C-c a") 'align-regexp) + +;; Browse URLs (very useful for Gitlab's SSH output!) +(global-set-key (kbd "C-c b p") 'browse-url-at-point) +(global-set-key (kbd "C-c b b") 'browse-url) ;; Goodness from @magnars ;; I don't need to kill emacs that easily -- cgit 1.4.1 From 33bb6c9dbc59e0b84f71fdd7edff6684107b13f9 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 17 Mar 2018 21:53:44 +0100 Subject: fix(custom): Fix window-splitting config for Helm Apparently this parameter was renamed? --- init/custom.el | 1 + 1 file changed, 1 insertion(+) diff --git a/init/custom.el b/init/custom.el index d518483678..16faa4cd0c 100644 --- a/init/custom.el +++ b/init/custom.el @@ -14,6 +14,7 @@ '(elnode-send-file-program "/run/current-system/sw/bin/cat") '(frame-brackground-mode (quote dark)) '(global-auto-complete-mode t) + '(helm-split-window-in-side-p t) '(helm-split-window-inside-p t) '(kubernetes-commands-display-buffer-function (quote display-buffer)) '(magit-log-show-gpg-status t) -- cgit 1.4.1 From 7d13aa41484f15dcfd8eb671138813e477e55e37 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 17 Mar 2018 21:54:08 +0100 Subject: chore(haskell): Remove everything except for intero setup --- init/haskell-setup.el | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/init/haskell-setup.el b/init/haskell-setup.el index c2ed22b252..23de004cde 100644 --- a/init/haskell-setup.el +++ b/init/haskell-setup.el @@ -1,33 +1,5 @@ (require 'haskell-mode) -;; Setup for Haskell mode - -(add-hook 'haskell-mode-hook 'interactive-haskell-mode) -(add-hook 'haskell-mode-hook 'hi2-mode) - -;; Bindings - -(defun haskell-mode-binding-setup () - (interactive) - (define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-or-reload) - (define-key haskell-mode-map (kbd "C-c C-c") 'haskell-compile) - (define-key haskell-mode-map (kbd "C-r") 'haskell-interactive-bring)) - -(eval-after-load "haskell-mode" - '(haskell-mode-binding-setup)) - -(eval-after-load "haskell-cabal" - '(define-key haskell-cabal-mode-map (kbd "C-c C-c") 'haskell-compile)) - -;; Settings - -(setq haskell-interactive-popup-errors nil - haskell-stylish-on-save t - haskell-tags-on-save t - haskell-process-suggest-remove-import-types t - haskell-process-auto-import-loaded-modules t - haskell-process-log t - haskell-process-type 'ghci - haskell-process-show-debug-tips nil) +(add-hook 'haskell-mode-hook 'intero-mode) (provide 'haskell-setup) -- cgit 1.4.1 From ace425793a5d4739400533e3512417c5b5ce0d33 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 17 Mar 2018 21:54:18 +0100 Subject: fix(rust): Fix Rust source path for >1.20 --- init/rust-setup.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/rust-setup.el b/init/rust-setup.el index b1a5681527..df9633da5c 100644 --- a/init/rust-setup.el +++ b/init/rust-setup.el @@ -16,6 +16,6 @@ ;; I don't use rustup and I'm not sure which derivation would normally place ;; Rust sources in the nix-store, so I'll continue using my local Rust checkout. -(setq racer-rust-src-path "~/source/rust") +(setq racer-rust-src-path "~/source/rust/src") (provide 'rust-setup) -- cgit 1.4.1 From ec3e2da5061f3fd0802c38ae681f3088c21db59f Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 30 Mar 2018 12:16:00 +0200 Subject: feat(bindings): Bind project-find-file & helm-occur globally --- init/bindings.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/init/bindings.el b/init/bindings.el index edb1b9c0ab..b8af7751f1 100644 --- a/init/bindings.el +++ b/init/bindings.el @@ -54,4 +54,10 @@ ;; Open Fefes Blog (global-set-key (kbd "C-c C-f") 'fefes-blog) +;; Open a file in project: +(global-set-key (kbd "C-c f") 'project-find-file) + +;; Interactively filter lines in current buffer: +(global-set-key (kbd "C-c o") 'helm-occur) + (provide 'bindings) -- cgit 1.4.1 From eaac33465d7885ec71f161ad769f04103ff2f58f Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 17 Mar 2018 22:06:52 +0100 Subject: fix(custom): Mark gruber-darker safe, again. This comes up again and again and again and again, for reasons I don't understand or have time to care about. --- init/custom.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/custom.el b/init/custom.el index 16faa4cd0c..5baf33da0f 100644 --- a/init/custom.el +++ b/init/custom.el @@ -10,7 +10,7 @@ '(custom-enabled-themes (quote (gruber-darker))) '(custom-safe-themes (quote - ("3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "89336ca71dae5068c165d932418a368a394848c3b8881b2f96807405d8c6b5b6" default))) + ("d61fc0e6409f0c2a22e97162d7d151dee9e192a90fa623f8d6a071dbf49229c6" "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "89336ca71dae5068c165d932418a368a394848c3b8881b2f96807405d8c6b5b6" default))) '(elnode-send-file-program "/run/current-system/sw/bin/cat") '(frame-brackground-mode (quote dark)) '(global-auto-complete-mode t) -- cgit 1.4.1 From 72a33b9156ac1b60703659c3ff204a501f67599f Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 1 May 2018 16:01:38 +0200 Subject: feat(all): Replace helm with ivy For most of my use-cases Helm seems to be overkill, and despite overall seeming like a nice and featureful package it has stability issues and bugs that annoy me. I've heard that ivy is simpler to use and configure, so I'm giving it a chance here. --- init/bindings.el | 4 ++-- init/custom.el | 2 -- init/nixos.el | 2 +- init/settings.el | 26 ++++++++++---------------- 4 files changed, 13 insertions(+), 21 deletions(-) diff --git a/init/bindings.el b/init/bindings.el index b8af7751f1..775128bcd2 100644 --- a/init/bindings.el +++ b/init/bindings.el @@ -57,7 +57,7 @@ ;; Open a file in project: (global-set-key (kbd "C-c f") 'project-find-file) -;; Interactively filter lines in current buffer: -(global-set-key (kbd "C-c o") 'helm-occur) +;; Use swiper instead of isearch +(global-set-key "\C-s" 'swiper) (provide 'bindings) diff --git a/init/custom.el b/init/custom.el index 5baf33da0f..474eeae926 100644 --- a/init/custom.el +++ b/init/custom.el @@ -14,8 +14,6 @@ '(elnode-send-file-program "/run/current-system/sw/bin/cat") '(frame-brackground-mode (quote dark)) '(global-auto-complete-mode t) - '(helm-split-window-in-side-p t) - '(helm-split-window-inside-p t) '(kubernetes-commands-display-buffer-function (quote display-buffer)) '(magit-log-show-gpg-status t) '(ns-alternate-modifier (quote none)) diff --git a/init/nixos.el b/init/nixos.el index 3caeec9a5c..4a3e4435b6 100644 --- a/init/nixos.el +++ b/init/nixos.el @@ -66,7 +66,7 @@ ;; Launch applications with completion (dmenu style!) (exwm-input-set-key (kbd "s-d") #'helm-run-external-command) - (exwm-input-set-key (kbd "s-p") #'helm-pass) + (exwm-input-set-key (kbd "s-p") #'ivy-pass) ;; Toggle between line-mode / char-mode (exwm-input-set-key (kbd "C-c C-t C-t") #'exwm-input-toggle-keyboard) diff --git a/init/settings.el b/init/settings.el index 2324a38f45..3f55774fa5 100644 --- a/init/settings.el +++ b/init/settings.el @@ -1,21 +1,15 @@ (require 'uniquify) -;; Make Helm go! -(require 'helm-config) - -;; Enable fuzzy matching in Helm. -;; The wiki recommends the first two options for globally enabling fuzzy -;; matching, however this does not actually work. -;; Setting all the options helps! -(setq helm-mode-fuzzy-match t - helm-completion-in-region-fuzzy-match t - helm-M-x-fuzzy-match t - helm-buffers-fuzzy-matching t - ) -(global-set-key (kbd "M-x") #'helm-M-x) -(global-set-key (kbd "C-x r b") #'helm-filtered-bookmarks) -(global-set-key (kbd "C-x C-f") #'helm-find-files) -(helm-mode 1) +;; Make ivy go! +(ivy-mode 1) +(counsel-mode 1) + +(setq ivy-use-virtual-buffers t) +(setq enable-recursive-minibuffers t) + +;; Enable fuzzy matching in ivy (requires flx installed for sane +;; ordering) +(setq ivy-re-builders-alist '((t . ivy--regex-fuzzy))) ;; Move files to trash when deleting (setq delete-by-moving-to-trash t) -- cgit 1.4.1 From 456f692b88323575aacab137a1a016df88f76638 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 1 May 2018 16:02:53 +0200 Subject: feat(functions): Add ivy-run-external-command Adds an ivy-based function akin to Helm's helm-run-external-command, but without all the things I don't need/want. --- init/functions.el | 36 ++++++++++++++++++++++++++++++++++++ init/nixos.el | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/init/functions.el b/init/functions.el index 726d40f257..ed1cf9d2a4 100644 --- a/init/functions.el +++ b/init/functions.el @@ -134,4 +134,40 @@ Including indent-buffer, which should not be called automatically on save." (buffer-name) require-final-newline)) +;; Helm includes a command to run external applications, which does +;; not seem to exist in ivy. This implementation uses some of the +;; logic from Helm to provide similar functionality using ivy. +(defun list-external-commands () + "Creates a list of all external commands available on $PATH + while filtering NixOS wrappers." + (cl-loop + for dir in (split-string (getenv "PATH") path-separator) + when (and (file-exists-p dir) (file-accessible-directory-p dir)) + for lsdir = (cl-loop for i in (directory-files dir t) + for bn = (file-name-nondirectory i) + when (and (not (s-contains? "-wrapped" i)) + (not (member bn completions)) + (not (file-directory-p i)) + (file-executable-p i)) + collect bn) + append lsdir into completions + finally return (sort completions 'string-lessp))) + +(defun ivy-run-external-command () + "Prompts the user with a list of all installed applications and + lets them select one to launch." + + (interactive) + (let ((external-commands-list (list-external-commands))) + (ivy-read "Command:" external-commands-list + :require-match t + :history 'external-commands-history + :action (lambda (cmd) + (message "Starting %s..." cmd) + (set-process-sentinel + (start-process-shell-command cmd nil cmd) + (lambda (process event) + (when (string= event "finished\n") + (message "%s process finished." process)))))))) + (provide 'functions) diff --git a/init/nixos.el b/init/nixos.el index 4a3e4435b6..eaf68dd982 100644 --- a/init/nixos.el +++ b/init/nixos.el @@ -65,7 +65,7 @@ (exwm-workspace-switch-create ,i)))) ;; Launch applications with completion (dmenu style!) - (exwm-input-set-key (kbd "s-d") #'helm-run-external-command) + (exwm-input-set-key (kbd "s-d") #'ivy-run-external-command) (exwm-input-set-key (kbd "s-p") #'ivy-pass) ;; Toggle between line-mode / char-mode -- cgit 1.4.1 From e5d129b49902987d68078bd41ac11389e4eae028 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 1 May 2018 16:41:17 +0200 Subject: fix(nixos): Use 'screen-lock' command instead of i3lock directly --- init/nixos.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/nixos.el b/init/nixos.el index eaf68dd982..71cd8adbc2 100644 --- a/init/nixos.el +++ b/init/nixos.el @@ -31,7 +31,7 @@ (defun lock-screen () (interactive) - (shell-command "i3lock")) + (shell-command "screen-lock")) (defun generate-randr-config () (-flatten `(,(-map (lambda (n) (list n "DP2")) (number-sequence 1 5)) -- cgit 1.4.1 From 85fad035041b09383b82270b005c2e815f2f42a8 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 6 May 2018 21:44:34 +0200 Subject: feat(custom): Enable incremental compilation in Cargo commands --- init/custom.el | 1 + 1 file changed, 1 insertion(+) diff --git a/init/custom.el b/init/custom.el index 474eeae926..5392eb4fd8 100644 --- a/init/custom.el +++ b/init/custom.el @@ -6,6 +6,7 @@ '(ac-auto-show-menu 0.8) '(ac-delay 0.2) '(avy-background t) + '(cargo-process--custom-path-to-bin "env CARGO_INCREMENTAL=1 cargo") '(cargo-process--enable-rust-backtrace 1) '(custom-enabled-themes (quote (gruber-darker))) '(custom-safe-themes -- cgit 1.4.1 From 301a9c538df455111ac47c1c75eb29c4912a6093 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 6 May 2018 21:44:48 +0200 Subject: feat(bindings): Bind counsel-rg to 'C-c r g' --- init/bindings.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/init/bindings.el b/init/bindings.el index 775128bcd2..0c9d07bd42 100644 --- a/init/bindings.el +++ b/init/bindings.el @@ -5,13 +5,15 @@ (define-key global-map (kbd "C--") 'text-scale-decrease) ;; Use regex searches by default. -(global-set-key (kbd "C-s") 'isearch-forward-regexp) (global-set-key (kbd "\C-r") 'isearch-backward-regexp) (global-set-key (kbd "M-%") 'query-replace-regexp) (global-set-key (kbd "C-M-s") 'isearch-forward) (global-set-key (kbd "C-M-r") 'isearch-backward) (global-set-key (kbd "C-M-%") 'query-replace) +;; Counsel stuff: +(global-set-key (kbd "C-c r g") 'counsel-rg) + ;; Avy mode (global-set-key (kbd "M-j") 'avy-goto-char) (global-set-key (kbd "M-p") 'avy-pop-mark) -- cgit 1.4.1 From 6061d1bbb29f93e6aeeb0e8b530571cf08e59af2 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 7 May 2018 14:02:43 +0200 Subject: chore(init): Enable upcase-region command --- init.el | 1 + 1 file changed, 1 insertion(+) diff --git a/init.el b/init.el index 6e6dd07e1e..f237d17013 100644 --- a/init.el +++ b/init.el @@ -41,3 +41,4 @@ (add-hook 'after-init-hook 'load-other-settings) (put 'narrow-to-region 'disabled nil) (edit-server-start) +(put 'upcase-region 'disabled nil) -- cgit 1.4.1 From ced93e2606bbe610650e5313ab5c7cd0f0726887 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 8 May 2018 22:32:09 +0200 Subject: feat(rust): Move to RLS/LSP setup Lets see how long this lasts ... --- init/rust-setup.el | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/init/rust-setup.el b/init/rust-setup.el index df9633da5c..6bffc8ef1f 100644 --- a/init/rust-setup.el +++ b/init/rust-setup.el @@ -1,21 +1,26 @@ (require 'company) +(require 'flycheck) +(require 'lsp-mode) +(require 'lsp-rust) +(require 'lsp-ui) (require 'rust-mode) +;; LSP configuration: +(setq lsp-ui-sideline-delay 0.5) +(add-hook 'lsp-mode-hook 'lsp-ui-mode) +(add-hook 'rust-mode-hook #'lsp-rust-enable) +(add-hook 'rust-mode-hook 'flycheck-mode) +(add-hook 'rust-mode-hook 'company-mode) +(push 'company-lsp company-backends) + ;; Enable cargo-related (C-c C-c C-...) commands. (add-hook 'rust-mode-hook #'cargo-minor-mode) ;; Configure autocompletion for rust -(add-hook 'rust-mode-hook #'racer-mode) -(add-hook 'racer-mode-hook #'company-mode) -(add-hook 'racer-mode-hook #'eldoc-mode) (define-key rust-mode-map (kbd "TAB") #'company-indent-or-complete-common) (setq company-tooltip-align-annotations t) ;; Ensure long compiler errors don't flow out of the screen (very annoying!) (add-hook 'cargo-process-mode-hook #'visual-line-mode) -;; I don't use rustup and I'm not sure which derivation would normally place -;; Rust sources in the nix-store, so I'll continue using my local Rust checkout. -(setq racer-rust-src-path "~/source/rust/src") - (provide 'rust-setup) -- cgit 1.4.1 From 7b8902a36adaa8d1ca7cc70a7b9a31a46aaf37fa Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 9 May 2018 00:41:48 +0200 Subject: feat(term-setup): First attempt to make multi-term tolerable I've been wanting to use in-emacs terminal buffers instead of Alacritty as an EXWM window for a while. In light of the recent EXWM bugs that cause overlapping X-windows occasionally I've finally had it! This commit introduces a new configuration file for multi-term related settings. Primarily this does the following: * Introduce a new `C-x t` keybinding which launches a terminal if none is running, or prompts the user to select one of the existing ones. * Remap key bindings in term-mode for quick access to features I want. * Add a `C-c C-r` key binding in term-mode to quickly rename terminal buffers into something sensible. Hopefully this will play nice with the ivy-based selector from the first point mentioned here. I'll see how it goes! --- init.el | 1 + init/term-setup.el | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 init/term-setup.el diff --git a/init.el b/init.el index f237d17013..aedee7b5dd 100644 --- a/init.el +++ b/init.el @@ -32,6 +32,7 @@ settings modes bindings + term-setup eshell-setup haskell-setup rust-setup diff --git a/init/term-setup.el b/init/term-setup.el new file mode 100644 index 0000000000..e8c7438715 --- /dev/null +++ b/init/term-setup.el @@ -0,0 +1,46 @@ +;; Configuration for multi-term mode: + +(require 'multi-term) + +(defun open-or-create-term-buffer (buffer-name) + "Switch to the buffer with BUFFER-NAME or create a + new (multi-)term-mode buffer." + (let ((buffer (get-buffer buffer-name))) + (if (not buffer) + (multi-term) + (switch-to-buffer buffer)))) + +(defun counsel-switch-to-term () + "Switch to a (multi-)term buffer or create one." + (interactive) + (let ((terms (counsel-list-buffers-with-mode 'term-mode))) + (if terms + (ivy-read "Switch to term buffer: " + (cons "New terminal" terms) + :caller 'counsel-switch-to-term + :require-match t + :action #'open-or-create-term-buffer) + (multi-term)))) + +(defun term-rename () + "Rename the current terminal buffer." + (interactive) + (let* ((buffer (get-buffer (buffer-name))) + (mode (buffer-local-value 'major-mode buffer))) + (if (equal 'term-mode mode) + (rename-buffer (format "*terminal<%s>*" (read-string "New terminal name: "))) + (error "This function is only intended to rename terminal buffers.")))) + +(global-set-key (kbd "C-x t") #'counsel-switch-to-term) + +;; term-mode's attempt to use isearch is not my favourite thing in the +;; world. +(delete '("C-r" . isearch-backward) term-bind-key-alist) +(delete '("C-s" . isearch-forward) term-bind-key-alist) + +(add-to-list 'term-bind-key-alist '("C-r" . term-send-reverse-search-history)) +(add-to-list 'term-bind-key-alist '("C-c C-l" . term-line-mode)) +(add-to-list 'term-bind-key-alist '("C-s" . swiper)) +(add-to-list 'term-bind-key-alist '("C-c C-r" . term-rename)) + +(provide 'term-setup) -- cgit 1.4.1 From b5e3f492f4d360e9be9f870e1e9f545f2bb3b0cc Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 9 May 2018 00:51:34 +0200 Subject: fix(nixos): Start EXWM with 10 workspaces pre-configured --- init/nixos.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/nixos.el b/init/nixos.el index 71cd8adbc2..4facf40ae7 100644 --- a/init/nixos.el +++ b/init/nixos.el @@ -47,7 +47,7 @@ (fringe-mode 3) - (setq exwm-workspace-number 2) + (setq exwm-workspace-number 10) ;; Make class name the buffer name (add-hook 'exwm-update-class-hook (lambda () -- cgit 1.4.1 From 4fabc361723ee056575c256ddc4549a71e48cccf Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 18 May 2018 12:20:34 +0200 Subject: feat(settings): Always load notmuch --- init/settings.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init/settings.el b/init/settings.el index 3f55774fa5..d445765d4e 100644 --- a/init/settings.el +++ b/init/settings.el @@ -1,4 +1,5 @@ (require 'uniquify) +(require 'notmuch) ;; Make ivy go! (ivy-mode 1) @@ -66,4 +67,7 @@ (setq epa-pinentry-mode 'loopback) (pinentry-start) +;; Close mail buffers after sending mail +(setq message-kill-buffer-on-exit t) + (provide 'settings) -- cgit 1.4.1 From 91dac5f692d022bcc66758a5678d01351568587c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 1 Jun 2018 17:07:46 +0200 Subject: refactor(functions): Use display-line-numbers instead of linum --- init/functions.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/init/functions.el b/init/functions.el index ed1cf9d2a4..07411396b2 100644 --- a/init/functions.el +++ b/init/functions.el @@ -59,16 +59,16 @@ (if (file-exists-p filename) (load filename))) -;; These come from magnars, he's got some awesome things. - (defun goto-line-with-feedback () "Show line numbers temporarily, while prompting for the line number input" (interactive) (unwind-protect (progn - (linum-mode 1) - (call-interactively 'goto-line)) - (linum-mode -1))) + (setq-local display-line-numbers t) + (let ((target (read-number "Goto line: "))) + (avy-push-mark) + (goto-line target))) + (setq-local display-line-numbers nil))) (defun untabify-buffer () -- cgit 1.4.1 From 2e637433c12eb7a26f9c6c8512643df03fb311a0 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 1 Jun 2018 17:08:28 +0200 Subject: fix(bindings): Use avy-goto-line instead of ace-jump-line-mode --- init/bindings.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/bindings.el b/init/bindings.el index 0c9d07bd42..5918e8f8fc 100644 --- a/init/bindings.el +++ b/init/bindings.el @@ -37,7 +37,7 @@ (global-set-key (kbd "C-c g") 'magit-status) ;; Replace standard goto-line with ace-jump-line-mode -(global-set-key (kbd "M-g g") 'ace-jump-line-mode) +(global-set-key (kbd "M-g g") 'avy-goto-line) (global-set-key (kbd "M-g M-g") 'goto-line-with-feedback) (global-set-key (kbd "C-c w") 'whitespace-cleanup) -- cgit 1.4.1 From ac527952ce9416a66414ca5e767c5a6ebefa3de1 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 3 Jun 2018 18:17:51 +0200 Subject: refactor(nixos): Only load exwm-randr on adho Last attempt to at least work around https://github.com/ch11ng/exwm/issues/425 on one of my machines before reverting to an old EXWM version. If the randr module is responsible for this issue it will probably still occur on the laptop and I'll eventually downgrade, but it may be a clue for debugging it at some point in the future. --- init/nixos.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/init/nixos.el b/init/nixos.el index 4facf40ae7..a75695d0c8 100644 --- a/init/nixos.el +++ b/init/nixos.el @@ -43,7 +43,6 @@ (message "Running on NixOS, configuring ExWM.") (require 'exwm) (require 'exwm-config) - (require 'exwm-randr) (fringe-mode 3) @@ -92,9 +91,11 @@ ;; Show time in the mode line (display-time-mode) - ;; Another attempt at xrandr configuration - (setq exwm-randr-workspace-output-plist (generate-randr-config)) - (exwm-randr-enable) + ;; Configure xrandr when running on laptop + (when (equal (shell-command-to-string "hostname") "adho\n") + (require 'exwm-randr) + (setq exwm-randr-workspace-output-plist (generate-randr-config)) + (exwm-randr-enable)) ;; Let buffers move seamlessly between workspaces (setq exwm-workspace-show-all-buffers t) -- cgit 1.4.1 From 4b9b7f299985c3d4c8cbc8bcbb612135b6b09da9 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 3 Jun 2018 22:36:43 +0200 Subject: feat(rust): Use eglot instead of LSP-mode See commit `6939aa9` in Nix configuration for more information. --- init/rust-setup.el | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/init/rust-setup.el b/init/rust-setup.el index 6bffc8ef1f..fcc39ff4e7 100644 --- a/init/rust-setup.el +++ b/init/rust-setup.el @@ -1,22 +1,20 @@ (require 'company) +(require 'eglot) (require 'flycheck) -(require 'lsp-mode) -(require 'lsp-rust) -(require 'lsp-ui) (require 'rust-mode) ;; LSP configuration: -(setq lsp-ui-sideline-delay 0.5) -(add-hook 'lsp-mode-hook 'lsp-ui-mode) -(add-hook 'rust-mode-hook #'lsp-rust-enable) -(add-hook 'rust-mode-hook 'flycheck-mode) -(add-hook 'rust-mode-hook 'company-mode) -(push 'company-lsp company-backends) +(defvar rust-eglot-initialized nil) +(add-hook 'rust-mode-hook (lambda () + (unless rust-eglot-initialized + (call-interactively #'eglot) + (setq rust-eglot-initialized t)))) ;; Enable cargo-related (C-c C-c C-...) commands. (add-hook 'rust-mode-hook #'cargo-minor-mode) ;; Configure autocompletion for rust +(add-hook 'rust-mode-hook #'company-mode) (define-key rust-mode-map (kbd "TAB") #'company-indent-or-complete-common) (setq company-tooltip-align-annotations t) -- cgit 1.4.1 From fa63debbfb04e0ed4373e45b16ce12ec77db67b4 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 6 Jun 2018 09:18:44 +0200 Subject: feat(mail): Add notmuch configuration to git (should've done this earlier *cough*) --- init.el | 1 + init/mail.el | 45 +++++++++++++++++++++++++++++++++++++++++++++ init/settings.el | 1 - 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 init/mail.el diff --git a/init.el b/init.el index aedee7b5dd..5cbf5cd92f 100644 --- a/init.el +++ b/init.el @@ -37,6 +37,7 @@ haskell-setup rust-setup lisp-setup + mail-setup ))) (add-hook 'after-init-hook 'load-other-settings) diff --git a/init/mail.el b/init/mail.el new file mode 100644 index 0000000000..0d5fdc4537 --- /dev/null +++ b/init/mail.el @@ -0,0 +1,45 @@ +(require 'notmuch) + +(global-set-key (kbd "C-c m") 'notmuch-hello) +(global-set-key (kbd "C-c C-e n") 'notmuch-mua-new-mail) + +(setq notmuch-cache-dir "~/.cache/notmuch") +(make-directory notmuch-cache-dir t) + +;; Mark things as read when archiving them: +(setq notmuch-archive-tags '("-inbox" "-unread" "+archive")) + +;; Cache addresses for completion: +(setq notmuch-address-save-filename (concat notmuch-cache-dir "/addresses")) + +;; Don't spam my home folder with drafts: +(setq notmuch-draft-folder notmuch-cache-dir) + +;; Show me saved searches that I care about: +(setq notmuch-saved-searches + '((:name "inbox" :query "tag:inbox" :key "i") + (:name "gitlab" :query "tag:gitlab" :key "g") + (:name "sent" :query "tag:sent" :key "t") + (:name "drafts" :query "tag:draft" :key "d"))) +(setq notmuch-show-empty-saved-searches t) + +;; Mail sending configuration +(setq notmuch-always-prompt-for-sender t) +(setq notmuch-mua-user-agent-function + (lambda () (format "Emacs %s; notmuch.el %s" emacs-version notmuch-emacs-version))) + +;; Ensure sender is correctly passed to msmtp +(setq mail-specify-envelope-from t + message-sendmail-envelope-from 'header + mail-envelope-from 'header) + +;; Store sent mail in the correct folder per account +(setq notmuch-maildir-use-notmuch-insert nil) +(setq notmuch-fcc-dirs '(("mail@tazj.in" . "tazjin/Sent") + ;; Not a mistake, Office365 apparently + ;; renames IMAP folders (!) to your local + ;; language instead of providing translations + ;; in the UI m( + ("vincent@aprila.no" . "aprila/Sende element"))) + +(provide 'mail-setup) diff --git a/init/settings.el b/init/settings.el index d445765d4e..00ede17e91 100644 --- a/init/settings.el +++ b/init/settings.el @@ -1,5 +1,4 @@ (require 'uniquify) -(require 'notmuch) ;; Make ivy go! (ivy-mode 1) -- cgit 1.4.1 From be8d47257f1fa60e63e4ea6e76502011067a515d Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 6 Jun 2018 09:45:47 +0200 Subject: feat(settings): Enable new password-store auth-source --- init/settings.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/init/settings.el b/init/settings.el index 00ede17e91..d7c0674fd5 100644 --- a/init/settings.el +++ b/init/settings.el @@ -66,6 +66,11 @@ (setq epa-pinentry-mode 'loopback) (pinentry-start) +;; Configure password-store as an auth-source +;; (this requires emacs 26) +(require 'auth-source-pass) +(auth-source-pass-enable) + ;; Close mail buffers after sending mail (setq message-kill-buffer-on-exit t) -- cgit 1.4.1 From 66e86d2546c8abdc22cc7333e85e50eef3408c3d Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 6 Jun 2018 09:46:01 +0200 Subject: feat(functions): Add custom ivy-password-store function The default `ivy-pass` function shells out to `pass` in such a way that using pinentry with emacs doesn't work, causing EXWM to freeze until `C-g` is hit, after which the password entry buffer pops up. That was very inconvenient - however, the new auth-source integration with pass works correctly and this commit introduces a new function and bindings for using the same functionality as before but doing the actual password-reading via auth-source. --- init/functions.el | 20 ++++++++++++++++++++ init/nixos.el | 5 ++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/init/functions.el b/init/functions.el index 07411396b2..5ed9a06fd6 100644 --- a/init/functions.el +++ b/init/functions.el @@ -170,4 +170,24 @@ Including indent-buffer, which should not be called automatically on save." (when (string= event "finished\n") (message "%s process finished." process)))))))) +(defun ivy-password-store (&optional password-store-dir) + "Custom version of password-store integration with ivy that + actually uses the GPG agent correctly." + + (interactive) + (ivy-read "Copy password of entry: " + (password-store-list (or password-store-dir (password-store-dir))) + :require-match t + :keymap ivy-pass-map + :action (lambda (entry) + (let ((password (auth-source-pass-get 'secret entry))) + (password-store-clear) + (kill-new password) + (setq password-store-kill-ring-pointer kill-ring-yank-pointer) + (message "Copied %s to the kill ring. Will clear in %s seconds." + entry (password-store-timeout)) + (setq password-store-timeout-timer + (run-at-time (password-store-timeout) + nil 'password-store-clear)))))) + (provide 'functions) diff --git a/init/nixos.el b/init/nixos.el index a75695d0c8..431ba705c3 100644 --- a/init/nixos.el +++ b/init/nixos.el @@ -65,7 +65,10 @@ ;; Launch applications with completion (dmenu style!) (exwm-input-set-key (kbd "s-d") #'ivy-run-external-command) - (exwm-input-set-key (kbd "s-p") #'ivy-pass) + (exwm-input-set-key (kbd "s-p") #'ivy-password-store) + (exwm-input-set-key (kbd "C-s-p") '(lambda () + (interactive) + (ivy-password-store "~/.aprila-secrets"))) ;; Toggle between line-mode / char-mode (exwm-input-set-key (kbd "C-c C-t C-t") #'exwm-input-toggle-keyboard) -- cgit 1.4.1 From 0806463a004de5258640664280b69b1118c624b2 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 6 Jun 2018 10:22:06 +0200 Subject: fix(mail): Add hack to "warm up" GPG agent before sending mail This is required in order to let password lookups work correctly when shelling out to password-store from MSMTP, as it won't be calling pinentry correctly otherwise. --- init/functions.el | 9 +++++++++ init/mail.el | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/init/functions.el b/init/functions.el index 5ed9a06fd6..84a6896564 100644 --- a/init/functions.el +++ b/init/functions.el @@ -190,4 +190,13 @@ Including indent-buffer, which should not be called automatically on save." (run-at-time (password-store-timeout) nil 'password-store-clear)))))) +(defun warmup-gpg-agent (arg &optional exit) + "Function used to warm up the GPG agent before use. This is + useful in cases where there is no easy way to make pinentry run + in the correct context (such as when sending email)." + (interactive) + (message "Warming up GPG agent") + (epg-sign-string (epg-make-context) "dummy") + nil) + (provide 'functions) diff --git a/init/mail.el b/init/mail.el index 0d5fdc4537..ecc6aa4648 100644 --- a/init/mail.el +++ b/init/mail.el @@ -42,4 +42,12 @@ ;; in the UI m( ("vincent@aprila.no" . "aprila/Sende element"))) +;; MSMTP decrypts passwords using pass, but pinentry doesn't work +;; correctly in that setup. This forces a warmup of the GPG agent +;; before sending the message. +;; +;; Note that the sending function is advised because the provided hook +;; for this seems to run at the wrong time. +(advice-add 'notmuch-mua-send-common :before 'warmup-gpg-agent) + (provide 'mail-setup) -- cgit 1.4.1 From 4f64ab29423e81748cf179e6dab4fc049bb7a803 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 6 Jun 2018 10:24:27 +0200 Subject: chore(mail): Rename file to match provides --- init/mail-setup.el | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ init/mail.el | 53 ----------------------------------------------------- 2 files changed, 53 insertions(+), 53 deletions(-) create mode 100644 init/mail-setup.el delete mode 100644 init/mail.el diff --git a/init/mail-setup.el b/init/mail-setup.el new file mode 100644 index 0000000000..ecc6aa4648 --- /dev/null +++ b/init/mail-setup.el @@ -0,0 +1,53 @@ +(require 'notmuch) + +(global-set-key (kbd "C-c m") 'notmuch-hello) +(global-set-key (kbd "C-c C-e n") 'notmuch-mua-new-mail) + +(setq notmuch-cache-dir "~/.cache/notmuch") +(make-directory notmuch-cache-dir t) + +;; Mark things as read when archiving them: +(setq notmuch-archive-tags '("-inbox" "-unread" "+archive")) + +;; Cache addresses for completion: +(setq notmuch-address-save-filename (concat notmuch-cache-dir "/addresses")) + +;; Don't spam my home folder with drafts: +(setq notmuch-draft-folder notmuch-cache-dir) + +;; Show me saved searches that I care about: +(setq notmuch-saved-searches + '((:name "inbox" :query "tag:inbox" :key "i") + (:name "gitlab" :query "tag:gitlab" :key "g") + (:name "sent" :query "tag:sent" :key "t") + (:name "drafts" :query "tag:draft" :key "d"))) +(setq notmuch-show-empty-saved-searches t) + +;; Mail sending configuration +(setq notmuch-always-prompt-for-sender t) +(setq notmuch-mua-user-agent-function + (lambda () (format "Emacs %s; notmuch.el %s" emacs-version notmuch-emacs-version))) + +;; Ensure sender is correctly passed to msmtp +(setq mail-specify-envelope-from t + message-sendmail-envelope-from 'header + mail-envelope-from 'header) + +;; Store sent mail in the correct folder per account +(setq notmuch-maildir-use-notmuch-insert nil) +(setq notmuch-fcc-dirs '(("mail@tazj.in" . "tazjin/Sent") + ;; Not a mistake, Office365 apparently + ;; renames IMAP folders (!) to your local + ;; language instead of providing translations + ;; in the UI m( + ("vincent@aprila.no" . "aprila/Sende element"))) + +;; MSMTP decrypts passwords using pass, but pinentry doesn't work +;; correctly in that setup. This forces a warmup of the GPG agent +;; before sending the message. +;; +;; Note that the sending function is advised because the provided hook +;; for this seems to run at the wrong time. +(advice-add 'notmuch-mua-send-common :before 'warmup-gpg-agent) + +(provide 'mail-setup) diff --git a/init/mail.el b/init/mail.el deleted file mode 100644 index ecc6aa4648..0000000000 --- a/init/mail.el +++ /dev/null @@ -1,53 +0,0 @@ -(require 'notmuch) - -(global-set-key (kbd "C-c m") 'notmuch-hello) -(global-set-key (kbd "C-c C-e n") 'notmuch-mua-new-mail) - -(setq notmuch-cache-dir "~/.cache/notmuch") -(make-directory notmuch-cache-dir t) - -;; Mark things as read when archiving them: -(setq notmuch-archive-tags '("-inbox" "-unread" "+archive")) - -;; Cache addresses for completion: -(setq notmuch-address-save-filename (concat notmuch-cache-dir "/addresses")) - -;; Don't spam my home folder with drafts: -(setq notmuch-draft-folder notmuch-cache-dir) - -;; Show me saved searches that I care about: -(setq notmuch-saved-searches - '((:name "inbox" :query "tag:inbox" :key "i") - (:name "gitlab" :query "tag:gitlab" :key "g") - (:name "sent" :query "tag:sent" :key "t") - (:name "drafts" :query "tag:draft" :key "d"))) -(setq notmuch-show-empty-saved-searches t) - -;; Mail sending configuration -(setq notmuch-always-prompt-for-sender t) -(setq notmuch-mua-user-agent-function - (lambda () (format "Emacs %s; notmuch.el %s" emacs-version notmuch-emacs-version))) - -;; Ensure sender is correctly passed to msmtp -(setq mail-specify-envelope-from t - message-sendmail-envelope-from 'header - mail-envelope-from 'header) - -;; Store sent mail in the correct folder per account -(setq notmuch-maildir-use-notmuch-insert nil) -(setq notmuch-fcc-dirs '(("mail@tazj.in" . "tazjin/Sent") - ;; Not a mistake, Office365 apparently - ;; renames IMAP folders (!) to your local - ;; language instead of providing translations - ;; in the UI m( - ("vincent@aprila.no" . "aprila/Sende element"))) - -;; MSMTP decrypts passwords using pass, but pinentry doesn't work -;; correctly in that setup. This forces a warmup of the GPG agent -;; before sending the message. -;; -;; Note that the sending function is advised because the provided hook -;; for this seems to run at the wrong time. -(advice-add 'notmuch-mua-send-common :before 'warmup-gpg-agent) - -(provide 'mail-setup) -- cgit 1.4.1 From ead3a701147a013394c0e08fb30cc248aead0de6 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 6 Jun 2018 10:29:30 +0200 Subject: fix(mail): Only show unread messages in inbox count --- init/mail-setup.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/mail-setup.el b/init/mail-setup.el index ecc6aa4648..c98d54d46d 100644 --- a/init/mail-setup.el +++ b/init/mail-setup.el @@ -17,7 +17,7 @@ ;; Show me saved searches that I care about: (setq notmuch-saved-searches - '((:name "inbox" :query "tag:inbox" :key "i") + '((:name "inbox" :query "tag:inbox" :count-query "tag:inbox AND tag:unread" :key "i") (:name "gitlab" :query "tag:gitlab" :key "g") (:name "sent" :query "tag:sent" :key "t") (:name "drafts" :query "tag:draft" :key "d"))) -- cgit 1.4.1 From c1c102665cf42a4b91a377fae550ebb34f3b9c53 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 6 Jun 2018 21:05:47 +0200 Subject: fix(mail): Ensure MSMTP's sendmail binary is used for sending --- init/mail-setup.el | 1 + 1 file changed, 1 insertion(+) diff --git a/init/mail-setup.el b/init/mail-setup.el index c98d54d46d..8f2bd80105 100644 --- a/init/mail-setup.el +++ b/init/mail-setup.el @@ -24,6 +24,7 @@ (setq notmuch-show-empty-saved-searches t) ;; Mail sending configuration +(setq send-mail-function 'sendmail-send-it) ;; sendmail provided by MSMTP (setq notmuch-always-prompt-for-sender t) (setq notmuch-mua-user-agent-function (lambda () (format "Emacs %s; notmuch.el %s" emacs-version notmuch-emacs-version))) -- cgit 1.4.1 From 9576f7352677f41d4a946f5ca4e15f1311109f46 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 6 Jun 2018 21:05:58 +0200 Subject: fix(settings): Require password-store related libraries These libraries are no longer auto-required because I don't actually use the default ivy-pass anymore, just some helper functions from the libs. --- init/settings.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init/settings.el b/init/settings.el index d7c0674fd5..904f6eda03 100644 --- a/init/settings.el +++ b/init/settings.el @@ -1,4 +1,6 @@ (require 'uniquify) +(require 'password-store) +(require 'ivy-pass) ;; Make ivy go! (ivy-mode 1) -- cgit 1.4.1 From b304289de3cff5c8374aba26c9dcde267c46f330 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 6 Jun 2018 23:33:22 +0200 Subject: chore(rust): Remove flycheck-require eglot uses flymake, which is bundled. --- init/rust-setup.el | 1 - 1 file changed, 1 deletion(-) diff --git a/init/rust-setup.el b/init/rust-setup.el index fcc39ff4e7..cc61718c1d 100644 --- a/init/rust-setup.el +++ b/init/rust-setup.el @@ -1,6 +1,5 @@ (require 'company) (require 'eglot) -(require 'flycheck) (require 'rust-mode) ;; LSP configuration: -- cgit 1.4.1 From f70a16f45302111c7b17d7d247aa01b09039b4ed Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 7 Jun 2018 23:23:57 +0200 Subject: feat(mail): Add development list to notmuch jump shortcuts --- init/mail-setup.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init/mail-setup.el b/init/mail-setup.el index 8f2bd80105..fdfadf0245 100644 --- a/init/mail-setup.el +++ b/init/mail-setup.el @@ -18,9 +18,10 @@ ;; Show me saved searches that I care about: (setq notmuch-saved-searches '((:name "inbox" :query "tag:inbox" :count-query "tag:inbox AND tag:unread" :key "i") + (:name "aprila-dev" :query "tag:aprila-dev" :count-query "tag:aprila-dev AND tag:unread" :key "d") (:name "gitlab" :query "tag:gitlab" :key "g") (:name "sent" :query "tag:sent" :key "t") - (:name "drafts" :query "tag:draft" :key "d"))) + (:name "drafts" :query "tag:draft"))) (setq notmuch-show-empty-saved-searches t) ;; Mail sending configuration -- cgit 1.4.1 From d146f1089b3edb66d192df4fa725c5f6936a0ff4 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 8 Jun 2018 15:14:09 +0200 Subject: feat(functions): Add M-x nixos-man Opens the configuration.nix man page --- init/functions.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/init/functions.el b/init/functions.el index 84a6896564..ebcc5b5f7d 100644 --- a/init/functions.el +++ b/init/functions.el @@ -110,6 +110,11 @@ Including indent-buffer, which should not be called automatically on save." (interactive) (find-file "/etc/nixos/configuration.nix")) +;; Open the NixOS man page +(defun nixos-man () + (interactive) + (man "configuration.nix")) + ;; Open local emacs configuration (defun emacs-config () (interactive) -- cgit 1.4.1 From 45432f9b34d8ba5b204a409a1959e1ccf4147faf Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 8 Jun 2018 15:14:22 +0200 Subject: fix(mail): Set `mail-host-address` variable from hostname --- init/mail-setup.el | 1 + 1 file changed, 1 insertion(+) diff --git a/init/mail-setup.el b/init/mail-setup.el index fdfadf0245..bdbab45fdd 100644 --- a/init/mail-setup.el +++ b/init/mail-setup.el @@ -34,6 +34,7 @@ (setq mail-specify-envelope-from t message-sendmail-envelope-from 'header mail-envelope-from 'header) +(setq mail-host-address (system-name)) ;; Store sent mail in the correct folder per account (setq notmuch-maildir-use-notmuch-insert nil) -- cgit 1.4.1 From 711afd3bd5e367df2812ac4e14128b4a034db081 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 12 Jun 2018 09:10:25 +0200 Subject: chore(mail): Unbind notmuch-save-draft I don't use drafts and they're kind of annoying. --- init/mail-setup.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init/mail-setup.el b/init/mail-setup.el index bdbab45fdd..cec8b7a3f3 100644 --- a/init/mail-setup.el +++ b/init/mail-setup.el @@ -45,6 +45,10 @@ ;; in the UI m( ("vincent@aprila.no" . "aprila/Sende element"))) +;; I don't use drafts but I instinctively hit C-x C-s constantly, lets +;; handle that gracefully. +(define-key notmuch-message-mode-map (kbd "C-x C-s") #'ignore) + ;; MSMTP decrypts passwords using pass, but pinentry doesn't work ;; correctly in that setup. This forces a warmup of the GPG agent ;; before sending the message. -- cgit 1.4.1 From 7781a059b3d06a9bc5bb86473686103ebfad6d5f Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 12 Jun 2018 09:11:52 +0200 Subject: fix(mail): Fix setup of drafts & cache folder --- init/mail-setup.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/init/mail-setup.el b/init/mail-setup.el index cec8b7a3f3..98ad17fed8 100644 --- a/init/mail-setup.el +++ b/init/mail-setup.el @@ -3,17 +3,17 @@ (global-set-key (kbd "C-c m") 'notmuch-hello) (global-set-key (kbd "C-c C-e n") 'notmuch-mua-new-mail) -(setq notmuch-cache-dir "~/.cache/notmuch") +(setq notmuch-cache-dir (format "%s/.cache/notmuch" (getenv "HOME"))) (make-directory notmuch-cache-dir t) -;; Mark things as read when archiving them: -(setq notmuch-archive-tags '("-inbox" "-unread" "+archive")) - ;; Cache addresses for completion: (setq notmuch-address-save-filename (concat notmuch-cache-dir "/addresses")) ;; Don't spam my home folder with drafts: -(setq notmuch-draft-folder notmuch-cache-dir) +(setq notmuch-draft-folder "drafts") ;; relative to notmuch database + +;; Mark things as read when archiving them: +(setq notmuch-archive-tags '("-inbox" "-unread" "+archive")) ;; Show me saved searches that I care about: (setq notmuch-saved-searches -- cgit 1.4.1 From ebc1dd1a18857ff7d63f09236552ddaf43885cb2 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 12 Jun 2018 09:12:26 +0200 Subject: chore(mail): Switch to citing messages without signature --- init/mail-setup.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init/mail-setup.el b/init/mail-setup.el index 98ad17fed8..b7fffa3608 100644 --- a/init/mail-setup.el +++ b/init/mail-setup.el @@ -29,12 +29,13 @@ (setq notmuch-always-prompt-for-sender t) (setq notmuch-mua-user-agent-function (lambda () (format "Emacs %s; notmuch.el %s" emacs-version notmuch-emacs-version))) +(setq mail-host-address (system-name)) +(setq notmuch-mua-cite-function #'message-cite-original-without-signature) ;; Ensure sender is correctly passed to msmtp (setq mail-specify-envelope-from t message-sendmail-envelope-from 'header mail-envelope-from 'header) -(setq mail-host-address (system-name)) ;; Store sent mail in the correct folder per account (setq notmuch-maildir-use-notmuch-insert nil) -- cgit 1.4.1 From a6a0e28e116e2e8d8826bbc1d3711f3615e919e0 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 13 Jun 2018 00:09:16 +0200 Subject: refactor(settings): Use prescient together with ivy Ivy's regex-based fuzzy matching can occasionally be slow, which was getting on my nerves. This switches the completion engine to prescient[1] which promises to be faster. Experimental testing in large files like the `configuration.nix` man page looks promissing. [1]: https://github.com/raxod502/prescient.el --- init/settings.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/init/settings.el b/init/settings.el index 904f6eda03..a32528012b 100644 --- a/init/settings.el +++ b/init/settings.el @@ -1,3 +1,5 @@ +(require 'prescient) +(require 'ivy-prescient) (require 'uniquify) (require 'password-store) (require 'ivy-pass) @@ -9,9 +11,9 @@ (setq ivy-use-virtual-buffers t) (setq enable-recursive-minibuffers t) -;; Enable fuzzy matching in ivy (requires flx installed for sane -;; ordering) -(setq ivy-re-builders-alist '((t . ivy--regex-fuzzy))) +;; Enable support for prescient in ivy +(ivy-prescient-mode) +(prescient-persist-mode) ;; Move files to trash when deleting (setq delete-by-moving-to-trash t) -- cgit 1.4.1 From ecf68e357c5349d4cda9916152fdb371ee51571d Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 15 Jun 2018 00:02:04 +0200 Subject: feat(functions): Add predicate function to determine last window Adds a function that can be used to check whether the current buffer is displayed in the "last" window of the active frame. The intention is to use this predicate to modify the modeline display to only show miscellaneous information (time, battery percentage etc.) on the last window instead of duplicating it. --- init/functions.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/init/functions.el b/init/functions.el index ebcc5b5f7d..4ca7cedb27 100644 --- a/init/functions.el +++ b/init/functions.el @@ -204,4 +204,14 @@ Including indent-buffer, which should not be called automatically on save." (epg-sign-string (epg-make-context) "dummy") nil) +(defun bottom-right-window-p () + "Determines whether the last (i.e. bottom-right) window of the + active frame is showing the buffer in which this function is + executed." + (let* ((frame (selected-frame)) + (right-windows (window-at-side-list frame 'right)) + (bottom-windows (window-at-side-list frame 'bottom)) + (last-window (car (seq-intersection right-windows bottom-windows)))) + (eq (current-buffer) (window-buffer last-window)))) + (provide 'functions) -- cgit 1.4.1 From 75749b68b0deb34588c8bd88597f1ac9583c815c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 15 Jun 2018 00:03:11 +0200 Subject: fix(settings): Add counsel-rg to ivy-prescient-excluded-commands History should not be remembered for counsel-rg --- init/settings.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init/settings.el b/init/settings.el index a32528012b..1c801cd09a 100644 --- a/init/settings.el +++ b/init/settings.el @@ -11,9 +11,10 @@ (setq ivy-use-virtual-buffers t) (setq enable-recursive-minibuffers t) -;; Enable support for prescient in ivy +;; Enable support for prescient in ivy & configure it (ivy-prescient-mode) (prescient-persist-mode) +(add-to-list 'ivy-prescient-excluded-commands 'counsel-rg) ;; Move files to trash when deleting (setq delete-by-moving-to-trash t) -- cgit 1.4.1 From 221c60e44864272785bab9f012c9128af021b9b6 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 15 Jun 2018 00:03:29 +0200 Subject: refactor(look-and-feel): Replace SML with telephone-line Telephone line has a slightly easier to configure segment system. This commit also uses the commit introduced in the previous function to conditionally display miscellaneous modeline information in the last window of a frame. More configuration for this will come over time. --- init/look-and-feel.el | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/init/look-and-feel.el b/init/look-and-feel.el index e40299c602..67f09834ae 100644 --- a/init/look-and-feel.el +++ b/init/look-and-feel.el @@ -1,5 +1,7 @@ ;;; -*- lexical-binding: t; -*- +(require 'telephone-line) + ;; Hide those ugly tool bars: (tool-bar-mode 0) (scroll-bar-mode 0) @@ -34,8 +36,30 @@ ;; If this file is evaluating there may also be a new (initial) frame: (configure-new-frame (selected-frame)) -;; Configure smart mode line -(sml/setup) +;; Configure telephone-line +(defun telephone-misc-if-last-window () + "Renders the mode-line-misc-info string for display in the + mode-line if the currently active window is the last one in the + frame. + + The idea is to not display information like the current time, + load, battery levels in all buffers." + + (if (bottom-right-window-p) + (telephone-line-raw mode-line-misc-info t) + "")) + +(telephone-line-defsegment telephone-line-last-window-segment () + (telephone-misc-if-last-window)) + +(setq telephone-line-lhs + '((nil . (telephone-line-position-segment)) + (accent . (telephone-line-buffer-segment)))) + +(setq telephone-line-rhs + '((accent . (telephone-line-major-mode-segment)) + (nil . (telephone-line-last-window-segment)))) +(telephone-line-mode 1) ;; Auto refresh buffers (global-auto-revert-mode 1) -- cgit 1.4.1 From e941e6b836f343b49f9d67915e16a359f58df249 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 15 Jun 2018 00:08:43 +0200 Subject: feat(look-and-feel): Enable winner-mode --- init/look-and-feel.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init/look-and-feel.el b/init/look-and-feel.el index 67f09834ae..c011cb14a8 100644 --- a/init/look-and-feel.el +++ b/init/look-and-feel.el @@ -11,6 +11,9 @@ (setq ring-bell-function 'ignore) (setq initial-scratch-message "") +;; Remember layout changes +(winner-mode 1) + ;; Usually emacs will run as a proper GUI application, in which case a few ;; extra settings are nice-to-have: (when window-system -- cgit 1.4.1 From 5442d6c0fbe634539cdb92710ef5cf1ae722bf3a Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 15 Jun 2018 00:08:58 +0200 Subject: refactor(look-and-feel): Simplify frame configuration When using EXWM new frames don't just show up the way they used to. --- init/look-and-feel.el | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/init/look-and-feel.el b/init/look-and-feel.el index c011cb14a8..4c9f700820 100644 --- a/init/look-and-feel.el +++ b/init/look-and-feel.el @@ -6,6 +6,8 @@ (tool-bar-mode 0) (scroll-bar-mode 0) (menu-bar-mode 0) +(add-hook 'after-make-frame-functions + (lambda (frame) (scroll-bar-mode 0))) ;; Don't do any annoying things: (setq ring-bell-function 'ignore) @@ -22,23 +24,11 @@ (blink-cursor-mode -1)) ;; Configure editor fonts - -;; Determine fontsize based on machine (4K display on stallo): -(letrec ((font-size 12) - (font (format "Input Mono-%d" font-size))) +(let ((font (format "Input Mono-%d" 12))) (setq default-frame-alist `((font-backend . "xft") (font . ,font))) (set-frame-font font t t)) -(defun configure-new-frame (frame) - "Configuration settings to run whenever a new frame is created." - (scroll-bar-mode 0)) ; Disable visual scroll bar (ugh!) - -(add-hook 'after-make-frame-functions 'configure-new-frame) - -;; If this file is evaluating there may also be a new (initial) frame: -(configure-new-frame (selected-frame)) - ;; Configure telephone-line (defun telephone-misc-if-last-window () "Renders the mode-line-misc-info string for display in the @@ -101,4 +91,3 @@ (setq windmove-wrap-around nil) (provide 'look-and-feel) - -- cgit 1.4.1 From 96653181158a799ba091e76fe66784826da71f9f Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 15 Jun 2018 00:11:52 +0200 Subject: feat(look-and-feel): Display battery % in mode-line on adho --- init/look-and-feel.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init/look-and-feel.el b/init/look-and-feel.el index 4c9f700820..4dad0334be 100644 --- a/init/look-and-feel.el +++ b/init/look-and-feel.el @@ -29,6 +29,10 @@ (font . ,font))) (set-frame-font font t t)) +;; Display battery in mode-line's misc section on adho: +(when (equal "adho" (system-name)) + (display-battery-mode)) + ;; Configure telephone-line (defun telephone-misc-if-last-window () "Renders the mode-line-misc-info string for display in the -- cgit 1.4.1 From 59aa3389325fd1ddad56f98aec917ab6583f52ea Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 15 Jun 2018 01:12:51 +0200 Subject: feat(mail): Implement unread count telephone-line segment Implements a periodically updated telephone-line segment that displays the current unread count for the two most important inboxes in the mode-line, if there are unread mails. --- init/mail-setup.el | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/init/mail-setup.el b/init/mail-setup.el index b7fffa3608..8db2662d17 100644 --- a/init/mail-setup.el +++ b/init/mail-setup.el @@ -58,4 +58,36 @@ ;; for this seems to run at the wrong time. (advice-add 'notmuch-mua-send-common :before 'warmup-gpg-agent) +;; Define a telephone-line segment for displaying the count of unread, +;; important mails in the last window's mode-line: +(defvar *last-notmuch-count-redraw* 0) +(defvar *current-notmuch-count* nil) + +(defun update-display-notmuch-counts () + "Update and render the current state of the notmuch unread + count for display in the mode-line. + + The offlineimap-timer runs every 2 minutes, so it does not make + sense to refresh this much more often than that." + + (when (> (- (float-time) *last-notmuch-count-redraw*) 90) + (setq *last-notmuch-count-redraw* (float-time)) + (let* ((inbox-unread (notmuch-saved-search-count "tag:inbox and tag:unread")) + (devel-unread (notmuch-saved-search-count "tag:aprila-dev and tag:unread")) + (notmuch-count (format "I: %s; D: %s" inbox-unread devel-unread))) + (setq *current-notmuch-count* notmuch-count))) + + (when (and (bottom-right-window-p) + ;; Only render if the initial update is done and there + ;; are unread mails: + *current-notmuch-count* + (not (equal *current-notmuch-count* "I: 0; D: 0"))) + *current-notmuch-count*)) + +(telephone-line-defsegment telephone-line-notmuch-counts () + "This segment displays the count of unread notmuch messages in + the last window's mode-line (if unread messages are present)." + + (update-display-notmuch-counts)) + (provide 'mail-setup) -- cgit 1.4.1 From e543ddff2e56571a60919ca041ce54523c55847b Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 15 Jun 2018 01:14:08 +0200 Subject: style(look-and-feel): Use tan-shaped separators for telephone-line --- init/look-and-feel.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/init/look-and-feel.el b/init/look-and-feel.el index 4dad0334be..e12e62662a 100644 --- a/init/look-and-feel.el +++ b/init/look-and-feel.el @@ -56,6 +56,12 @@ (setq telephone-line-rhs '((accent . (telephone-line-major-mode-segment)) (nil . (telephone-line-last-window-segment)))) + +(setq telephone-line-primary-left-separator 'telephone-line-tan-left + telephone-line-primary-right-separator 'telephone-line-tan-right + telephone-line-secondary-left-separator 'telephone-line-tan-hollow-left + telephone-line-secondary-right-separator 'telephone-line-tan-hollow-right) + (telephone-line-mode 1) ;; Auto refresh buffers -- cgit 1.4.1 From 454cb9e5065f84e82b435794f3b59e743846630f Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 15 Jun 2018 01:14:28 +0200 Subject: feat(look-and-feel): Display unread mail telephone line segment Defines a new highlight face and configures the telephone line segments to display the unread count if there are unread mails. --- init.el | 2 +- init/look-and-feel.el | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/init.el b/init.el index 5cbf5cd92f..b73eaccef5 100644 --- a/init.el +++ b/init.el @@ -27,6 +27,7 @@ ;; After initialisation, proceed to load configuration that requires packages: (defun load-other-settings () (mapc 'require '(nixos + mail-setup look-and-feel functions settings @@ -37,7 +38,6 @@ haskell-setup rust-setup lisp-setup - mail-setup ))) (add-hook 'after-init-hook 'load-other-settings) diff --git a/init/look-and-feel.el b/init/look-and-feel.el index e12e62662a..63a3c1e3f8 100644 --- a/init/look-and-feel.el +++ b/init/look-and-feel.el @@ -42,20 +42,26 @@ The idea is to not display information like the current time, load, battery levels in all buffers." - (if (bottom-right-window-p) - (telephone-line-raw mode-line-misc-info t) - "")) + (when (bottom-right-window-p) + (telephone-line-raw mode-line-misc-info t))) (telephone-line-defsegment telephone-line-last-window-segment () (telephone-misc-if-last-window)) +;; Define a highlight font for ~ important ~ information in the last +;; window. +(defface special-highlight '((t (:foreground "white" :background "#5f627f"))) "") +(add-to-list 'telephone-line-faces + '(highlight . (special-highlight . special-highlight))) + (setq telephone-line-lhs '((nil . (telephone-line-position-segment)) (accent . (telephone-line-buffer-segment)))) (setq telephone-line-rhs '((accent . (telephone-line-major-mode-segment)) - (nil . (telephone-line-last-window-segment)))) + (nil . (telephone-line-last-window-segment)) + (highlight . (telephone-line-notmuch-counts)))) (setq telephone-line-primary-left-separator 'telephone-line-tan-left telephone-line-primary-right-separator 'telephone-line-tan-right -- cgit 1.4.1 From 9da46061627196c977c69a8d84f9023c47640f75 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 15 Jun 2018 01:32:15 +0200 Subject: style(look-and-feel): Use more compact battery display layout --- init/look-and-feel.el | 1 + 1 file changed, 1 insertion(+) diff --git a/init/look-and-feel.el b/init/look-and-feel.el index 63a3c1e3f8..0a7c21c2d8 100644 --- a/init/look-and-feel.el +++ b/init/look-and-feel.el @@ -31,6 +31,7 @@ ;; Display battery in mode-line's misc section on adho: (when (equal "adho" (system-name)) + (setq battery-mode-line-format " %b%p%%") (display-battery-mode)) ;; Configure telephone-line -- cgit 1.4.1 From e743ea28c50ffd8a702b943260f05cbeee642bcc Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 15 Jun 2018 01:32:34 +0200 Subject: feat(look-and-feel): Display EXWM workspace index in mode-line Been waiting to do this since forever! --- init/look-and-feel.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/init/look-and-feel.el b/init/look-and-feel.el index 0a7c21c2d8..555feca43f 100644 --- a/init/look-and-feel.el +++ b/init/look-and-feel.el @@ -49,6 +49,11 @@ (telephone-line-defsegment telephone-line-last-window-segment () (telephone-misc-if-last-window)) +;; Display the current EXWM workspace index in the mode-line +(telephone-line-defsegment telephone-line-exwm-workspace-index () + (when (bottom-right-window-p) + (format "[%s]" exwm-workspace-current-index))) + ;; Define a highlight font for ~ important ~ information in the last ;; window. (defface special-highlight '((t (:foreground "white" :background "#5f627f"))) "") @@ -61,7 +66,8 @@ (setq telephone-line-rhs '((accent . (telephone-line-major-mode-segment)) - (nil . (telephone-line-last-window-segment)) + (nil . (telephone-line-last-window-segment + telephone-line-exwm-workspace-index)) (highlight . (telephone-line-notmuch-counts)))) (setq telephone-line-primary-left-separator 'telephone-line-tan-left -- cgit 1.4.1 From f0dfc8b06de568e57050510a5b56fcbb725a6733 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 18 Jun 2018 16:39:28 +0200 Subject: feat(functions): Add ivy-browse-repositories function Quick helper to switch between all relevant projects. --- init/bindings.el | 1 + init/functions.el | 10 ++++++++++ init/mail-setup.el | 3 +++ init/settings.el | 4 ++-- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/init/bindings.el b/init/bindings.el index 5918e8f8fc..cb793f7253 100644 --- a/init/bindings.el +++ b/init/bindings.el @@ -35,6 +35,7 @@ ;; Magit! (global-set-key (kbd "C-c g") 'magit-status) +(global-set-key (kbd "C-x p") 'ivy-browse-repositories) ;; Replace standard goto-line with ace-jump-line-mode (global-set-key (kbd "M-g g") 'avy-goto-line) diff --git a/init/functions.el b/init/functions.el index 4ca7cedb27..c0169955a1 100644 --- a/init/functions.el +++ b/init/functions.el @@ -195,6 +195,16 @@ Including indent-buffer, which should not be called automatically on save." (run-at-time (password-store-timeout) nil 'password-store-clear)))))) +(defun ivy-browse-repositories () + "Select a git repository and open its associated magit buffer." + + (interactive) + (ivy-read "Repository: " + (magit-list-repos) + :require-match t + :sort t + :action #'magit-status)) + (defun warmup-gpg-agent (arg &optional exit) "Function used to warm up the GPG agent before use. This is useful in cases where there is no easy way to make pinentry run diff --git a/init/mail-setup.el b/init/mail-setup.el index 8db2662d17..a277af7dbe 100644 --- a/init/mail-setup.el +++ b/init/mail-setup.el @@ -32,6 +32,9 @@ (setq mail-host-address (system-name)) (setq notmuch-mua-cite-function #'message-cite-original-without-signature) +;; Close mail buffers after sending mail +(setq message-kill-buffer-on-exit t) + ;; Ensure sender is correctly passed to msmtp (setq mail-specify-envelope-from t message-sendmail-envelope-from 'header diff --git a/init/settings.el b/init/settings.el index 1c801cd09a..5d09dfb4d3 100644 --- a/init/settings.el +++ b/init/settings.el @@ -76,7 +76,7 @@ (require 'auth-source-pass) (auth-source-pass-enable) -;; Close mail buffers after sending mail -(setq message-kill-buffer-on-exit t) +;; Configure magit-repository-list +(setq magit-repository-directories '(("/home/vincent/projects" . 2))) (provide 'settings) -- cgit 1.4.1 From 4fe8d78dbb16dbec2b8c173a5142b4b14927fd28 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 22 Jun 2018 10:29:31 +0200 Subject: refactor: Begin moving package configuration to use-package This is the first in a series of commits for refactoring my configuration to make use of jwiegley's use-package. In the previous layout of the configuration there were some questions around what settings go into which file, but in the end it is all just related to which packages are being configured (besides settings related to global Emacs behaviour). This commit introduces use-package forms for all currently used packages (which are still installed via Nix, not via package.el) but does not yet clean up the rest of the configuration in a suitable way. Note that this version introduces a bug in which the configuration of telephone line is not correctly initialised after package setup. --- init.el | 147 +++++++++++++++++++++++++++++++++++++++++++++++--- init/bindings.el | 12 ----- init/haskell-setup.el | 5 -- init/lisp-setup.el | 21 -------- init/look-and-feel.el | 63 +++++++++++----------- init/modes.el | 33 +----------- init/nixos.el | 133 ++++++++++++++++++++++----------------------- init/rust-setup.el | 23 -------- init/settings.el | 17 ------ init/term-setup.el | 16 +----- 10 files changed, 236 insertions(+), 234 deletions(-) delete mode 100644 init/haskell-setup.el delete mode 100644 init/lisp-setup.el delete mode 100644 init/rust-setup.el diff --git a/init.el b/init.el index b73eaccef5..7a4af10606 100644 --- a/init.el +++ b/init.el @@ -3,11 +3,149 @@ ;; Packages are installed via Nix configuration, this file only ;; initialises the newly loaded packages. -(require 'package) +(require 'use-package) (require 'seq) (package-initialize) +;; Add 'init' folder that contains other settings to load. +(add-to-list 'load-path (concat user-emacs-directory "init")) + +;; Initialise all packages installed via Nix. +;; +;; TODO: Generate this section in Nix for all packages that do not +;; require special configuration. + +;; +;; Packages providing generic functionality. +;; + +(use-package ace-window + :bind (("C-x o" . ace-window)) + :init + (progn (setq aw-keys '(?f ?j ?d ?k ?s ?l ?a) + aw-scope 'frame) + ;; Show previews of ace-window numbers in the mode line for each window. + (ace-window-display-mode))) + +(use-package adjust-parens :hook ((lisp-mode . adjust-parens-hook))) +(use-package auth-source-pass :init (auth-source-pass-enable)) + +(use-package avy + :bind (("M-j" . avy-goto-char) + ("M-p" . avy-pop-mark) + ("M-g g" . avy-goto-line))) + +(use-package browse-kill-ring) + +(use-package company + :hook ((prog-mode . company-mode)) + :bind (:map rust-mode-map ("" . company-indent-or-complete-common) + :map lisp-mode-map ("" . company-indent-or-complete-common)) + :init (setq company-tooltip-align-annotations t)) + +(use-package dash) +(use-package dash-functional) +(use-package edit-server :init (edit-server-start)) +(use-package gruber-darker-theme) +(use-package ht) +(use-package hydra) +(use-package idle-highlight-mode :hook ((prog-mode . idle-highlight-mode))) +(use-package paredit :hook ((lisp-mode . paredit-mode))) +(use-package multiple-cursors) + +(use-package pinentry + :init + (setq epa-pinentry-mode 'loopback) + (pinentry-start)) + +(use-package rainbow-delimiters :hook (prog-mode . rainbow-delimiters-mode)) +(use-package rainbow-mode) +(use-package s) +(use-package smartparens :init (smartparens-global-mode)) +(use-package string-edit) +(use-package telephone-line :init (telephone-line-setup)) +(use-package undo-tree :init (global-undo-tree-mode)) +(use-package uuidgen) +(use-package which-key :init (which-key-mode t)) + +;; +;; Applications in emacs +;; + +(use-package magit + :bind ("C-c g" . magit-status) + :init (setq magit-repository-directories '(("/home/vincent/projects" . 2)))) + +(use-package multi-term + :bind ("C-x t" . counsel-switch-to-term) + :init (progn + ;; term-mode's attempt to use isearch is not my favourite thing in the + ;; world. + (delete '("C-r" . isearch-backward) term-bind-key-alist) + (delete '("C-s" . isearch-forward) term-bind-key-alist) + + (add-to-list 'term-bind-key-alist '("C-r" . term-send-reverse-search-history)) + (add-to-list 'term-bind-key-alist '("C-c C-l" . term-line-mode)) + (add-to-list 'term-bind-key-alist '("C-s" . swiper)) + (add-to-list 'term-bind-key-alist '("C-c C-r" . term-rename)))) + +(use-package password-store) +(use-package pg) +(use-package restclient) + +;; +;; Packages providing language-specific functionality +;; + +(use-package cargo :hook ((rust-mode . cargo-minor-mode) + (cargo-process-mode . visual-line-mode))) + +(use-package dockerfile-mode) + +(use-package eglot + :init (defvar rust-eglot-initialized nil) + :hook ((rust-mode . (lambda () + (unless rust-eglot-initialized + (call-interactively #'eglot) + (setq rust-eglot-initialized t)))))) + +(use-package erlang + :hook ((erlang-mode . (lambda () + ;; Don't indent after '>' while I'm writing + (local-set-key ">" 'self-insert-command))))) + +(use-package go-mode) +(use-package haskell-mode) + +(use-package jq-mode + :init (add-to-list 'auto-mode-alist '("\\.jq\\'" . jq-mode))) + +(use-package kotlin-mode) + +(use-package markdown-mode + :init + (add-to-list 'auto-mode-alist '("\\.txt\\'" . markdown-mode)) + (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) + (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))) + +(use-package markdown-toc) +(use-package nginx-mode) +(use-package rust-mode) +(use-package terraform-mode) +(use-package toml-mode) +(use-package web-mode) +(use-package yaml-mode) + +;; (use-package sly +;; :init +;; (setq inferior-lisp-program (concat (nix-store-path "sbcl") "/bin/sbcl")) +;; (add-to-list 'company-backends 'sly-company)) + +;; +;; EXWM / NixOS related packages +;; + ;; Configure a few basics before moving on to package-specific initialisation. (setq custom-file (concat user-emacs-directory "init/custom.el")) (load custom-file) @@ -18,9 +156,6 @@ ;; Seed RNG (random t) -;; Add 'init' folder that contains other settings to load. -(add-to-list 'load-path (concat user-emacs-directory "init")) - ;; Load configuration that makes use of installed packages: ;; Emacs will automatically initialise all installed packages. @@ -35,12 +170,8 @@ bindings term-setup eshell-setup - haskell-setup - rust-setup - lisp-setup ))) (add-hook 'after-init-hook 'load-other-settings) (put 'narrow-to-region 'disabled nil) -(edit-server-start) (put 'upcase-region 'disabled nil) diff --git a/init/bindings.el b/init/bindings.el index cb793f7253..f10869a532 100644 --- a/init/bindings.el +++ b/init/bindings.el @@ -14,16 +14,9 @@ ;; Counsel stuff: (global-set-key (kbd "C-c r g") 'counsel-rg) -;; Avy mode -(global-set-key (kbd "M-j") 'avy-goto-char) -(global-set-key (kbd "M-p") 'avy-pop-mark) - ;; imenu instead of insert-file (global-set-key (kbd "C-x i") 'imenu) -(global-set-key (kbd "C-x o") ; Yes, I went there! - 'ace-window) - ;; Window switching. (C-x o goes to the next window) (windmove-default-keybindings) ;; Shift+direction @@ -33,12 +26,7 @@ ;; Start a new eshell even if one is active. (global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) -;; Magit! -(global-set-key (kbd "C-c g") 'magit-status) (global-set-key (kbd "C-x p") 'ivy-browse-repositories) - -;; Replace standard goto-line with ace-jump-line-mode -(global-set-key (kbd "M-g g") 'avy-goto-line) (global-set-key (kbd "M-g M-g") 'goto-line-with-feedback) (global-set-key (kbd "C-c w") 'whitespace-cleanup) diff --git a/init/haskell-setup.el b/init/haskell-setup.el deleted file mode 100644 index 23de004cde..0000000000 --- a/init/haskell-setup.el +++ /dev/null @@ -1,5 +0,0 @@ -(require 'haskell-mode) - -(add-hook 'haskell-mode-hook 'intero-mode) - -(provide 'haskell-setup) diff --git a/init/lisp-setup.el b/init/lisp-setup.el deleted file mode 100644 index e117817e3f..0000000000 --- a/init/lisp-setup.el +++ /dev/null @@ -1,21 +0,0 @@ -;; lisp-settings.el - settings for various Lisp dialects -;; -*- lexical-binding: t; -*- - -(require 'adjust-parens) -(require 'sly) - -;; All the lisps: - -(add-to-list 'lisp-mode-hook #'company-mode) -(add-to-list 'lisp-mode-hook #'paredit-mode) -(add-to-list 'lisp-mode-hook #'adjust-parens-mode) - -(define-key lisp-mode-map (kbd "TAB") - #'company-indent-or-complete-common) - -;; Common Lisp: -(setq inferior-lisp-program (concat (nix-store-path "sbcl") "/bin/sbcl")) - -(add-to-list 'company-backends 'sly-company) - -(provide 'lisp-setup) diff --git a/init/look-and-feel.el b/init/look-and-feel.el index 555feca43f..3d480bd5f4 100644 --- a/init/look-and-feel.el +++ b/init/look-and-feel.el @@ -1,7 +1,5 @@ ;;; -*- lexical-binding: t; -*- -(require 'telephone-line) - ;; Hide those ugly tool bars: (tool-bar-mode 0) (scroll-bar-mode 0) @@ -46,36 +44,37 @@ (when (bottom-right-window-p) (telephone-line-raw mode-line-misc-info t))) -(telephone-line-defsegment telephone-line-last-window-segment () - (telephone-misc-if-last-window)) - -;; Display the current EXWM workspace index in the mode-line -(telephone-line-defsegment telephone-line-exwm-workspace-index () - (when (bottom-right-window-p) - (format "[%s]" exwm-workspace-current-index))) - -;; Define a highlight font for ~ important ~ information in the last -;; window. -(defface special-highlight '((t (:foreground "white" :background "#5f627f"))) "") -(add-to-list 'telephone-line-faces - '(highlight . (special-highlight . special-highlight))) - -(setq telephone-line-lhs - '((nil . (telephone-line-position-segment)) - (accent . (telephone-line-buffer-segment)))) - -(setq telephone-line-rhs - '((accent . (telephone-line-major-mode-segment)) - (nil . (telephone-line-last-window-segment - telephone-line-exwm-workspace-index)) - (highlight . (telephone-line-notmuch-counts)))) - -(setq telephone-line-primary-left-separator 'telephone-line-tan-left - telephone-line-primary-right-separator 'telephone-line-tan-right - telephone-line-secondary-left-separator 'telephone-line-tan-hollow-left - telephone-line-secondary-right-separator 'telephone-line-tan-hollow-right) - -(telephone-line-mode 1) +(defun telephone-line-setup () + (telephone-line-defsegment telephone-line-last-window-segment () + (telephone-misc-if-last-window)) + + ;; Display the current EXWM workspace index in the mode-line + (telephone-line-defsegment telephone-line-exwm-workspace-index () + (when (bottom-right-window-p) + (format "[%s]" exwm-workspace-current-index))) + + ;; Define a highlight font for ~ important ~ information in the last + ;; window. + (defface special-highlight '((t (:foreground "white" :background "#5f627f"))) "") + (add-to-list 'telephone-line-faces + '(highlight . (special-highlight . special-highlight))) + + (setq telephone-line-lhs + '((nil . (telephone-line-position-segment)) + (accent . (telephone-line-buffer-segment)))) + + (setq telephone-line-rhs + '((accent . (telephone-line-major-mode-segment)) + (nil . (telephone-line-last-window-segment + telephone-line-exwm-workspace-index)) + (highlight . (telephone-line-notmuch-counts)))) + + (setq telephone-line-primary-left-separator 'telephone-line-tan-left + telephone-line-primary-right-separator 'telephone-line-tan-right + telephone-line-secondary-left-separator 'telephone-line-tan-hollow-left + telephone-line-secondary-right-separator 'telephone-line-tan-hollow-right) + + (telephone-line-mode 1)) ;; Auto refresh buffers (global-auto-revert-mode 1) diff --git a/init/modes.el b/init/modes.el index d9a27c52a4..19ed2a6843 100644 --- a/init/modes.el +++ b/init/modes.el @@ -1,14 +1,6 @@ ;; Initializes modes I use. (add-hook 'prog-mode-hook 'esk-add-watchwords) -(add-hook 'prog-mode-hook 'idle-highlight-mode) - -;; Configure markdown-mode -(autoload 'markdown-mode "markdown-mode" - "Major mode for editing Markdown files" t) -(add-to-list 'auto-mode-alist '("\\.txt\\'" . markdown-mode)) -(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) -(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) ;; Use auto-complete as completion at point (defun set-auto-complete-as-completion-at-point-function () @@ -17,35 +9,18 @@ (add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function) -;; Configure Erlang mode - -(defun erlang-mode-init-setup () - (interactive) - ;; Don't indent after '>' while I'm writing - (local-set-key ">" 'self-insert-command) - ;;(local-set-key "RET" 'newline) - (rainbow-delimiters-mode 1) - ) - -(add-hook 'erlang-mode-hook 'erlang-mode-init-setup) - ;; Enable rainbow-delimiters for all things programming (add-hook 'prog-mode-hook 'rainbow-delimiters-mode) ;; Enable Paredit & Company in Emacs Lisp mode -(add-hook 'emacs-lisp-mode-hook 'paredit-mode) (add-hook 'emacs-lisp-mode-hook 'company-mode) ;; Always highlight matching brackets (show-paren-mode 1) ;; Always auto-close parantheses and other pairs -(electric-pair-mode) - -;; Represent undo-history as an actual tree (visualize with C-x u) -(setq undo-tree-mode-lighter "") -(require 'undo-tree) -(global-undo-tree-mode) +;; (replaced by smartparens) +;; (electric-pair-mode) ;; Keep track of recent files (recentf-mode) @@ -57,9 +32,5 @@ (auto-compression-mode t) ;; Show available key chord completions -(which-key-mode t) - -;; Show previews of ace-window numbers in the mode line for each window. -(ace-window-display-mode) (provide 'modes) diff --git a/init/nixos.el b/init/nixos.el index 431ba705c3..f3cefea7f3 100644 --- a/init/nixos.el +++ b/init/nixos.el @@ -6,11 +6,6 @@ (require 'f) (require 'dash) -(defvar is-nixos - (let ((os-f "/etc/os-release")) - (s-contains? - "NixOS" (if (f-file? os-f) (f-read os-f))))) - (defun pulseaudio-ctl (cmd) (shell-command (concat "pulseaudio-ctl " cmd)) (message "Volume command: %s" cmd)) @@ -38,70 +33,68 @@ (0 "eDP1") ,(-map (lambda (n) (list n "eDP1")) (number-sequence 6 9))))) -(if is-nixos - (progn - (message "Running on NixOS, configuring ExWM.") - (require 'exwm) - (require 'exwm-config) - - (fringe-mode 3) - - (setq exwm-workspace-number 10) - ;; Make class name the buffer name - (add-hook 'exwm-update-class-hook - (lambda () - (exwm-workspace-rename-buffer exwm-class-name))) - - ;; 's-r': Reset - (exwm-input-set-key (kbd "s-r") #'exwm-reset) - ;; 's-w': Switch workspace - (exwm-input-set-key (kbd "s-w") #'exwm-workspace-switch) - ;; 's-N': Switch to certain workspace - (dotimes (i 10) - (exwm-input-set-key (kbd (format "s-%d" i)) - `(lambda () - (interactive) - (exwm-workspace-switch-create ,i)))) - - ;; Launch applications with completion (dmenu style!) - (exwm-input-set-key (kbd "s-d") #'ivy-run-external-command) - (exwm-input-set-key (kbd "s-p") #'ivy-password-store) - (exwm-input-set-key (kbd "C-s-p") '(lambda () - (interactive) - (ivy-password-store "~/.aprila-secrets"))) - - ;; Toggle between line-mode / char-mode - (exwm-input-set-key (kbd "C-c C-t C-t") #'exwm-input-toggle-keyboard) - - ;; Volume keys - (exwm-input-set-key (kbd "") #'volume-mute) - (exwm-input-set-key (kbd "") #'volume-up) - (exwm-input-set-key (kbd "") #'volume-down) - - ;; Brightness keys - (exwm-input-set-key (kbd "") #'brightness-down) - (exwm-input-set-key (kbd "") #'brightness-up) - (exwm-input-set-key (kbd "") #'lock-screen) - - ;; Line-editing shortcuts - (exwm-input-set-simulation-keys - '(([?\C-d] . delete) - ([?\C-w] . ?\C-c))) - - ;; Enable EXWM - (exwm-enable) - - ;; Show time in the mode line - (display-time-mode) - - ;; Configure xrandr when running on laptop - (when (equal (shell-command-to-string "hostname") "adho\n") - (require 'exwm-randr) - (setq exwm-randr-workspace-output-plist (generate-randr-config)) - (exwm-randr-enable)) - - ;; Let buffers move seamlessly between workspaces - (setq exwm-workspace-show-all-buffers t) - (setq exwm-layout-show-all-buffers t))) +(use-package exwm + :hook ((exwm-update-class . (lambda () + ;; Make class name the buffer name + (exwm-workspace-rename-buffer exwm-class-name)))) + :init + (progn + (require 'exwm-config) + + (fringe-mode 3) + + (setq exwm-workspace-number 10) + + ;; 's-r': Reset + (exwm-input-set-key (kbd "s-r") #'exwm-reset) + ;; 's-w': Switch workspace + (exwm-input-set-key (kbd "s-w") #'exwm-workspace-switch) + ;; 's-N': Switch to certain workspace + (dotimes (i 10) + (exwm-input-set-key (kbd (format "s-%d" i)) + `(lambda () + (interactive) + (exwm-workspace-switch-create ,i)))) + + ;; Launch applications with completion (dmenu style!) + (exwm-input-set-key (kbd "s-d") #'ivy-run-external-command) + (exwm-input-set-key (kbd "s-p") #'ivy-password-store) + (exwm-input-set-key (kbd "C-s-p") '(lambda () + (interactive) + (ivy-password-store "~/.aprila-secrets"))) + + ;; Toggle between line-mode / char-mode + (exwm-input-set-key (kbd "C-c C-t C-t") #'exwm-input-toggle-keyboard) + + ;; Volume keys + (exwm-input-set-key (kbd "") #'volume-mute) + (exwm-input-set-key (kbd "") #'volume-up) + (exwm-input-set-key (kbd "") #'volume-down) + + ;; Brightness keys + (exwm-input-set-key (kbd "") #'brightness-down) + (exwm-input-set-key (kbd "") #'brightness-up) + (exwm-input-set-key (kbd "") #'lock-screen) + + ;; Line-editing shortcuts + (exwm-input-set-simulation-keys + '(([?\C-d] . delete) + ([?\C-w] . ?\C-c))) + + ;; Enable EXWM + (exwm-enable) + + ;; Show time in the mode line + (display-time-mode) + + ;; Configure xrandr when running on laptop + (when (equal (shell-command-to-string "hostname") "adho\n") + (require 'exwm-randr) + (setq exwm-randr-workspace-output-plist (generate-randr-config)) + (exwm-randr-enable)) + + ;; Let buffers move seamlessly between workspaces + (setq exwm-workspace-show-all-buffers t) + (setq exwm-layout-show-all-buffers t))) (provide 'nixos) diff --git a/init/rust-setup.el b/init/rust-setup.el deleted file mode 100644 index cc61718c1d..0000000000 --- a/init/rust-setup.el +++ /dev/null @@ -1,23 +0,0 @@ -(require 'company) -(require 'eglot) -(require 'rust-mode) - -;; LSP configuration: -(defvar rust-eglot-initialized nil) -(add-hook 'rust-mode-hook (lambda () - (unless rust-eglot-initialized - (call-interactively #'eglot) - (setq rust-eglot-initialized t)))) - -;; Enable cargo-related (C-c C-c C-...) commands. -(add-hook 'rust-mode-hook #'cargo-minor-mode) - -;; Configure autocompletion for rust -(add-hook 'rust-mode-hook #'company-mode) -(define-key rust-mode-map (kbd "TAB") #'company-indent-or-complete-common) -(setq company-tooltip-align-annotations t) - -;; Ensure long compiler errors don't flow out of the screen (very annoying!) -(add-hook 'cargo-process-mode-hook #'visual-line-mode) - -(provide 'rust-setup) diff --git a/init/settings.el b/init/settings.el index 5d09dfb4d3..2e4dedc0a5 100644 --- a/init/settings.el +++ b/init/settings.el @@ -1,7 +1,6 @@ (require 'prescient) (require 'ivy-prescient) (require 'uniquify) -(require 'password-store) (require 'ivy-pass) ;; Make ivy go! @@ -63,20 +62,4 @@ ;; Show time in 24h format (setq display-time-24hr-format t) -;; Make ace-window behave in a sane way: -(setq aw-keys '(?f ?j ?d ?k ?s ?l ?a)) ; Homerow keys in sensible order! -(setq aw-scope 'frame) ; There are many frames in exwm, I don't care! - -;; Configure pinentry for use with GPG -(setq epa-pinentry-mode 'loopback) -(pinentry-start) - -;; Configure password-store as an auth-source -;; (this requires emacs 26) -(require 'auth-source-pass) -(auth-source-pass-enable) - -;; Configure magit-repository-list -(setq magit-repository-directories '(("/home/vincent/projects" . 2))) - (provide 'settings) diff --git a/init/term-setup.el b/init/term-setup.el index e8c7438715..ea58a53bbf 100644 --- a/init/term-setup.el +++ b/init/term-setup.el @@ -1,6 +1,4 @@ -;; Configuration for multi-term mode: - -(require 'multi-term) +;; Utilities for term-mode (defun open-or-create-term-buffer (buffer-name) "Switch to the buffer with BUFFER-NAME or create a @@ -31,16 +29,4 @@ (rename-buffer (format "*terminal<%s>*" (read-string "New terminal name: "))) (error "This function is only intended to rename terminal buffers.")))) -(global-set-key (kbd "C-x t") #'counsel-switch-to-term) - -;; term-mode's attempt to use isearch is not my favourite thing in the -;; world. -(delete '("C-r" . isearch-backward) term-bind-key-alist) -(delete '("C-s" . isearch-forward) term-bind-key-alist) - -(add-to-list 'term-bind-key-alist '("C-r" . term-send-reverse-search-history)) -(add-to-list 'term-bind-key-alist '("C-c C-l" . term-line-mode)) -(add-to-list 'term-bind-key-alist '("C-s" . swiper)) -(add-to-list 'term-bind-key-alist '("C-c C-r" . term-rename)) - (provide 'term-setup) -- cgit 1.4.1 From 169b6754d018493a5c7e69d073c9fb52e6f3f267 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 22 Jun 2018 10:31:38 +0200 Subject: chore(custom): Add some Aprila-related settings --- init/custom.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init/custom.el b/init/custom.el index 5392eb4fd8..0faca268de 100644 --- a/init/custom.el +++ b/init/custom.el @@ -5,6 +5,9 @@ ;; If there is more than one, they won't work right. '(ac-auto-show-menu 0.8) '(ac-delay 0.2) + '(aprila-nixops-path "/home/vincent/projects/langler/nixops") + '(aprila-release-author "Vincent Ambo ") + '(aprila-releases-path "/home/vincent/projects/langler/docs/releases") '(avy-background t) '(cargo-process--custom-path-to-bin "env CARGO_INCREMENTAL=1 cargo") '(cargo-process--enable-rust-backtrace 1) -- cgit 1.4.1 From 47ba177c00d7009725a80755d9e5880053a6bcdf Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 28 Jun 2018 11:01:54 +0200 Subject: fix(init): Fix setup of lisp modes --- init.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/init.el b/init.el index 7a4af10606..74b87e968e 100644 --- a/init.el +++ b/init.el @@ -28,7 +28,8 @@ ;; Show previews of ace-window numbers in the mode line for each window. (ace-window-display-mode))) -(use-package adjust-parens :hook ((lisp-mode . adjust-parens-hook))) +(use-package adjust-parens :hook ((lisp-mode . adjust-parens-mode) + (emacs-lisp-mode . adjust-parens-mode))) (use-package auth-source-pass :init (auth-source-pass-enable)) (use-package avy @@ -51,7 +52,8 @@ (use-package ht) (use-package hydra) (use-package idle-highlight-mode :hook ((prog-mode . idle-highlight-mode))) -(use-package paredit :hook ((lisp-mode . paredit-mode))) +(use-package paredit :hook ((lisp-mode . paredit-mode) + (emacs-lisp-mode . paredit-mode))) (use-package multiple-cursors) (use-package pinentry -- cgit 1.4.1 From 660fc549f4c1d67f1206d4a2cd9e7ca4f4de33de Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 28 Jun 2018 11:02:24 +0200 Subject: feat(init): Reintroduce sly configuration Sly is back! --- init.el | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/init.el b/init.el index 74b87e968e..4567024122 100644 --- a/init.el +++ b/init.el @@ -66,7 +66,7 @@ (use-package s) (use-package smartparens :init (smartparens-global-mode)) (use-package string-edit) -(use-package telephone-line :init (telephone-line-setup)) +(use-package telephone-line) ;; configuration happens outside of use-package (use-package undo-tree :init (global-undo-tree-mode)) (use-package uuidgen) (use-package which-key :init (which-key-mode t)) @@ -139,11 +139,6 @@ (use-package web-mode) (use-package yaml-mode) -;; (use-package sly -;; :init -;; (setq inferior-lisp-program (concat (nix-store-path "sbcl") "/bin/sbcl")) -;; (add-to-list 'company-backends 'sly-company)) - ;; ;; EXWM / NixOS related packages ;; @@ -152,16 +147,11 @@ (setq custom-file (concat user-emacs-directory "init/custom.el")) (load custom-file) -(defvar home-dir) -(setq home-dir (expand-file-name "~")) +(defvar home-dir (expand-file-name "~")) ;; Seed RNG (random t) -;; Load configuration that makes use of installed packages: - -;; Emacs will automatically initialise all installed packages. -;; After initialisation, proceed to load configuration that requires packages: (defun load-other-settings () (mapc 'require '(nixos mail-setup @@ -172,7 +162,17 @@ bindings term-setup eshell-setup - ))) + )) + (telephone-line-setup) + + (use-package sly + :init (setq inferior-lisp-program (concat (nix-store-path "sbcl") "/bin/sbcl")) + ;;(add-to-list 'company-backends 'sly-company) + )) + +;; Some packages can only be initialised after the rest of the +;; settings has been applied: + (add-hook 'after-init-hook 'load-other-settings) (put 'narrow-to-region 'disabled nil) -- cgit 1.4.1 From dea6ece741c130e70e710c53d6caba796c88ac83 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 28 Jun 2018 11:02:40 +0200 Subject: chore(init): Comment out multi-term configuration Multi-term is currently broken, I think this may be related to Emacs 26, but as I don't actively use it much I haven't investigated more. --- init.el | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/init.el b/init.el index 4567024122..ad03fdfad7 100644 --- a/init.el +++ b/init.el @@ -79,18 +79,18 @@ :bind ("C-c g" . magit-status) :init (setq magit-repository-directories '(("/home/vincent/projects" . 2)))) -(use-package multi-term - :bind ("C-x t" . counsel-switch-to-term) - :init (progn - ;; term-mode's attempt to use isearch is not my favourite thing in the - ;; world. - (delete '("C-r" . isearch-backward) term-bind-key-alist) - (delete '("C-s" . isearch-forward) term-bind-key-alist) - - (add-to-list 'term-bind-key-alist '("C-r" . term-send-reverse-search-history)) - (add-to-list 'term-bind-key-alist '("C-c C-l" . term-line-mode)) - (add-to-list 'term-bind-key-alist '("C-s" . swiper)) - (add-to-list 'term-bind-key-alist '("C-c C-r" . term-rename)))) +;; (use-package multi-term +;; :bind ("C-x t" . counsel-switch-to-term) +;; :init (progn +;; ;; term-mode's attempt to use isearch is not my favourite thing in the +;; ;; world. +;; (delete '("C-r" . isearch-backward) term-bind-key-alist) +;; (delete '("C-s" . isearch-forward) term-bind-key-alist) + +;; (add-to-list 'term-bind-key-alist '("C-r" . term-send-reverse-search-history)) +;; (add-to-list 'term-bind-key-alist '("C-c C-l" . term-line-mode)) +;; (add-to-list 'term-bind-key-alist '("C-s" . swiper)) +;; (add-to-list 'term-bind-key-alist '("C-c C-r" . term-rename)))) (use-package password-store) (use-package pg) -- cgit 1.4.1 From 5b32cd74c60ba02fde8a4e8b15b3ce603358d86c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 29 Jun 2018 13:06:29 +0200 Subject: feat(mail): Add counsel-notmuch support --- init/mail-setup.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init/mail-setup.el b/init/mail-setup.el index a277af7dbe..1292a7e15f 100644 --- a/init/mail-setup.el +++ b/init/mail-setup.el @@ -1,6 +1,8 @@ (require 'notmuch) +(require 'counsel-notmuch) (global-set-key (kbd "C-c m") 'notmuch-hello) +(global-set-key (kbd "C-c C-m") 'counsel-notmuch) (global-set-key (kbd "C-c C-e n") 'notmuch-mua-new-mail) (setq notmuch-cache-dir (format "%s/.cache/notmuch" (getenv "HOME"))) -- cgit 1.4.1 From e0a8a6f35f3afbb838f3c3819d4bf9ca66e10d00 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 11 Jul 2018 23:27:30 +0200 Subject: feat(functions): Add function to start inferior Erlang via Nix --- init/functions.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/init/functions.el b/init/functions.el index c0169955a1..019bf16460 100644 --- a/init/functions.el +++ b/init/functions.el @@ -224,4 +224,11 @@ Including indent-buffer, which should not be called automatically on save." (last-window (car (seq-intersection right-windows bottom-windows)))) (eq (current-buffer) (window-buffer last-window)))) +(defun inferior-erlang-nix-shell () + "Start an inferior Erlang process from the root of the current + project." + (interactive) + (inferior-erlang + (format "nix-shell --command erl %s" (cdr (project-current))))) + (provide 'functions) -- cgit 1.4.1 From d74692acf20ee47ca7a87a7f164cea77a70256bd Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 10 Aug 2018 22:17:26 +0200 Subject: chore(custom): Configure Intero to use 0.1.31 backend --- init/custom.el | 1 + 1 file changed, 1 insertion(+) diff --git a/init/custom.el b/init/custom.el index 0faca268de..c7500c4abe 100644 --- a/init/custom.el +++ b/init/custom.el @@ -18,6 +18,7 @@ '(elnode-send-file-program "/run/current-system/sw/bin/cat") '(frame-brackground-mode (quote dark)) '(global-auto-complete-mode t) + '(intero-package-version "0.1.31") '(kubernetes-commands-display-buffer-function (quote display-buffer)) '(magit-log-show-gpg-status t) '(ns-alternate-modifier (quote none)) -- cgit 1.4.1 From 0cf7af4403ea17603fd3627c8791e9c8ab12de9b Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 2 Sep 2018 18:14:12 +0200 Subject: fix(cargo): Disable keybinding for 'cargo clean' --- init.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/init.el b/init.el index ad03fdfad7..a29d79c226 100644 --- a/init.el +++ b/init.el @@ -100,8 +100,10 @@ ;; Packages providing language-specific functionality ;; -(use-package cargo :hook ((rust-mode . cargo-minor-mode) - (cargo-process-mode . visual-line-mode))) +(use-package cargo + :hook ((rust-mode . cargo-minor-mode) + (cargo-process-mode . visual-line-mode)) + :bind (:map cargo-minor-mode-map ("C-c C-c C-l" . ignore))) (use-package dockerfile-mode) -- cgit 1.4.1 From bab9f15a33ae85a685a766e74e57df3ade467274 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 12 Sep 2018 11:21:19 +0200 Subject: fix: Add temporary workaround for Intero + GHC 8.4 bug Adds a workaround for commercialhaskell/intero#569 by adding a function that disables the offending GHCi flag in the Intero REPL, and advising the `intero-repl` and `intero-repl-load` commands to always execute it. I did not manage to locate a common entrypoint to the REPL, but it's probably not worth spending more time on as this will be fixed properly in a future GHC release. --- init/functions.el | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/init/functions.el b/init/functions.el index 019bf16460..ef4c8cef79 100644 --- a/init/functions.el +++ b/init/functions.el @@ -231,4 +231,32 @@ Including indent-buffer, which should not be called automatically on save." (inferior-erlang (format "nix-shell --command erl %s" (cdr (project-current))))) +(defun intero-fix-ghci-panic () + "Disable deferring of out of scope variable errors, which + triggers a bug in the interactive Emacs REPL printing a panic + under certain conditions." + + (interactive) + (let* ((root (intero-project-root)) + (package-name (intero-package-name)) + (backend-buffer (intero-buffer 'backend)) + (name (format "*intero:%s:%s:repl*" + (file-name-nondirectory root) + package-name)) + (setting ":set -fno-defer-out-of-scope-variables\n")) + (when (get-buffer name) + (with-current-buffer (get-buffer name) + (goto-char (point-max)) + (let ((process (get-buffer-process (current-buffer)))) + (when process (process-send-string process setting))))))) + +;; Brute-force fix: Ensure the setting is injected every time the REPL +;; is selected. +;; +;; Upstream issue: https://github.com/commercialhaskell/intero/issues/569 +(advice-add 'intero-repl :before (lambda (&rest r) (intero-fix-ghci-panic)) + '((name . intero-panic-fix))) +(advice-add 'intero-repl-load :before (lambda (&rest r) (intero-fix-ghci-panic)) + '((name . intero-panic-fix))) + (provide 'functions) -- cgit 1.4.1 From ee143eaf147847eada08207c8f72eb04dc834ed5 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 12 Sep 2018 11:38:04 +0200 Subject: fix: Run GHCi-workaround /after/ switching to REPL buffer This simply changes the advice position. This way around makes more sense in case that the REPL is just being started up. --- init/functions.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init/functions.el b/init/functions.el index ef4c8cef79..640957f109 100644 --- a/init/functions.el +++ b/init/functions.el @@ -254,9 +254,9 @@ Including indent-buffer, which should not be called automatically on save." ;; is selected. ;; ;; Upstream issue: https://github.com/commercialhaskell/intero/issues/569 -(advice-add 'intero-repl :before (lambda (&rest r) (intero-fix-ghci-panic)) +(advice-add 'intero-repl :after (lambda (&rest r) (intero-fix-ghci-panic)) '((name . intero-panic-fix))) -(advice-add 'intero-repl-load :before (lambda (&rest r) (intero-fix-ghci-panic)) +(advice-add 'intero-repl-load :after (lambda (&rest r) (intero-fix-ghci-panic)) '((name . intero-panic-fix))) (provide 'functions) -- cgit 1.4.1 From dd2ba5aafcce30ba9b91a561705319d2b6410826 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 12 Oct 2018 19:11:43 +0200 Subject: fix: Use indent-relative in Kotlin buffers --- init.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/init.el b/init.el index a29d79c226..a572d35f9b 100644 --- a/init.el +++ b/init.el @@ -55,7 +55,6 @@ (use-package paredit :hook ((lisp-mode . paredit-mode) (emacs-lisp-mode . paredit-mode))) (use-package multiple-cursors) - (use-package pinentry :init (setq epa-pinentry-mode 'loopback) @@ -125,7 +124,8 @@ (use-package jq-mode :init (add-to-list 'auto-mode-alist '("\\.jq\\'" . jq-mode))) -(use-package kotlin-mode) +(use-package kotlin-mode + :bind (:map kotlin-mode-map ("" . indent-relative))) (use-package markdown-mode :init @@ -175,7 +175,6 @@ ;; Some packages can only be initialised after the rest of the ;; settings has been applied: - (add-hook 'after-init-hook 'load-other-settings) (put 'narrow-to-region 'disabled nil) (put 'upcase-region 'disabled nil) -- cgit 1.4.1 From 0f9136ab88c9f9b0ddbd093c0977704a8dff248b Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 12 Oct 2018 19:12:13 +0200 Subject: feat(custom): Enable intero-global-mode --- init/custom.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init/custom.el b/init/custom.el index c7500c4abe..4c92f0d32f 100644 --- a/init/custom.el +++ b/init/custom.el @@ -18,6 +18,8 @@ '(elnode-send-file-program "/run/current-system/sw/bin/cat") '(frame-brackground-mode (quote dark)) '(global-auto-complete-mode t) + '(intero-debug nil) + '(intero-global-mode t nil (intero)) '(intero-package-version "0.1.31") '(kubernetes-commands-display-buffer-function (quote display-buffer)) '(magit-log-show-gpg-status t) @@ -30,6 +32,7 @@ ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. + '(default ((t (:foreground "#e4e4ef" :background "#181818")))) '(rainbow-delimiters-depth-1-face ((t (:foreground "#2aa198")))) '(rainbow-delimiters-depth-2-face ((t (:foreground "#b58900")))) '(rainbow-delimiters-depth-3-face ((t (:foreground "#268bd2")))) -- cgit 1.4.1 From 2c5946163c03dfa9b12f9bc83697c593965d08cd Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 28 Oct 2018 23:39:58 +0100 Subject: fix(nix-mode): Use nix-indent-line as indentation function --- init.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init.el b/init.el index a572d35f9b..22422c7722 100644 --- a/init.el +++ b/init.el @@ -134,6 +134,10 @@ (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))) (use-package markdown-toc) + +(use-package nix-mode + :bind (:map nix-mode-map ("" . nix-indent-line))) + (use-package nginx-mode) (use-package rust-mode) (use-package terraform-mode) -- cgit 1.4.1 From 5b5f051b13633cec58e7daa0399085ffcdb1e430 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 31 Oct 2018 10:29:49 +0100 Subject: refactor: Reutilise multi-term commands for Alacritty buffers In practice I never use multi-term, but it's nice to have the same buffer selection functionality for Alacritty buffers. --- init.el | 13 ------------- init/functions.el | 18 +++++++++++------- init/nixos.el | 3 +++ init/term-setup.el | 37 +++++++++++++++++++++---------------- 4 files changed, 35 insertions(+), 36 deletions(-) diff --git a/init.el b/init.el index 22422c7722..73780d4035 100644 --- a/init.el +++ b/init.el @@ -78,19 +78,6 @@ :bind ("C-c g" . magit-status) :init (setq magit-repository-directories '(("/home/vincent/projects" . 2)))) -;; (use-package multi-term -;; :bind ("C-x t" . counsel-switch-to-term) -;; :init (progn -;; ;; term-mode's attempt to use isearch is not my favourite thing in the -;; ;; world. -;; (delete '("C-r" . isearch-backward) term-bind-key-alist) -;; (delete '("C-s" . isearch-forward) term-bind-key-alist) - -;; (add-to-list 'term-bind-key-alist '("C-r" . term-send-reverse-search-history)) -;; (add-to-list 'term-bind-key-alist '("C-c C-l" . term-line-mode)) -;; (add-to-list 'term-bind-key-alist '("C-s" . swiper)) -;; (add-to-list 'term-bind-key-alist '("C-c C-r" . term-rename)))) - (use-package password-store) (use-package pg) (use-package restclient) diff --git a/init/functions.el b/init/functions.el index 640957f109..8b96a0e737 100644 --- a/init/functions.el +++ b/init/functions.el @@ -158,6 +158,16 @@ Including indent-buffer, which should not be called automatically on save." append lsdir into completions finally return (sort completions 'string-lessp))) +(defun run-external-command (cmd) + "Execute the specified command and notify the user when it + finishes." + (message "Starting %s..." cmd) + (set-process-sentinel + (start-process-shell-command cmd nil cmd) + (lambda (process event) + (when (string= event "finished\n") + (message "%s process finished." process))))) + (defun ivy-run-external-command () "Prompts the user with a list of all installed applications and lets them select one to launch." @@ -167,13 +177,7 @@ Including indent-buffer, which should not be called automatically on save." (ivy-read "Command:" external-commands-list :require-match t :history 'external-commands-history - :action (lambda (cmd) - (message "Starting %s..." cmd) - (set-process-sentinel - (start-process-shell-command cmd nil cmd) - (lambda (process event) - (when (string= event "finished\n") - (message "%s process finished." process)))))))) + :action #'run-external-command))) (defun ivy-password-store (&optional password-store-dir) "Custom version of password-store integration with ivy that diff --git a/init/nixos.el b/init/nixos.el index f3cefea7f3..e0e832ce15 100644 --- a/init/nixos.el +++ b/init/nixos.el @@ -63,6 +63,9 @@ (interactive) (ivy-password-store "~/.aprila-secrets"))) + ;; Add Alacritty selector to a key + (exwm-input-set-key (kbd "C-x t") #'counsel-switch-to-alacritty) + ;; Toggle between line-mode / char-mode (exwm-input-set-key (kbd "C-c C-t C-t") #'exwm-input-toggle-keyboard) diff --git a/init/term-setup.el b/init/term-setup.el index ea58a53bbf..a2a71be9ee 100644 --- a/init/term-setup.el +++ b/init/term-setup.el @@ -1,32 +1,37 @@ -;; Utilities for term-mode +;; Utilities for Alacritty buffers. -(defun open-or-create-term-buffer (buffer-name) +(defun open-or-create-alacritty-buffer (buffer-name) "Switch to the buffer with BUFFER-NAME or create a - new (multi-)term-mode buffer." + new buffer running Alacritty." (let ((buffer (get-buffer buffer-name))) (if (not buffer) - (multi-term) + (run-external-command "alacritty") (switch-to-buffer buffer)))) -(defun counsel-switch-to-term () +(defun is-alacritty-buffer (buffer) + "Determine whether BUFFER runs Alacritty." + (and (equal 'exwm-mode (buffer-local-value 'major-mode buffer)) + (s-starts-with? "Alacritty" (buffer-name buffer)))) + +(defun counsel-switch-to-alacritty () "Switch to a (multi-)term buffer or create one." (interactive) - (let ((terms (counsel-list-buffers-with-mode 'term-mode))) + (let ((terms (-map #'buffer-name + (-filter #'is-alacritty-buffer (buffer-list))))) (if terms - (ivy-read "Switch to term buffer: " + (ivy-read "Switch to Alacritty buffer: " (cons "New terminal" terms) - :caller 'counsel-switch-to-term + :caller 'counsel-switch-to-alacritty :require-match t - :action #'open-or-create-term-buffer) - (multi-term)))) + :action #'open-or-create-alacritty-buffer) + (run-external-command "alacritty")))) -(defun term-rename () +(defun alacritty-rename () "Rename the current terminal buffer." (interactive) - (let* ((buffer (get-buffer (buffer-name))) - (mode (buffer-local-value 'major-mode buffer))) - (if (equal 'term-mode mode) - (rename-buffer (format "*terminal<%s>*" (read-string "New terminal name: "))) - (error "This function is only intended to rename terminal buffers.")))) + (let* ((buffer (get-buffer (buffer-name)))) + (if (is-alacritty-buffer buffer) + (rename-buffer (format "Alacritty<%s>" (read-string "New terminal name: "))) + (error "This function is only intended to rename Alacritty buffers.")))) (provide 'term-setup) -- cgit 1.4.1 From dd5c880138b36c41e78632bac8b11f0430c4cef6 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 31 Oct 2018 10:30:22 +0100 Subject: chore(nixos): Reshuffle EXWM screen assignment on adho --- init/nixos.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init/nixos.el b/init/nixos.el index e0e832ce15..e384e9b77d 100644 --- a/init/nixos.el +++ b/init/nixos.el @@ -29,9 +29,9 @@ (shell-command "screen-lock")) (defun generate-randr-config () - (-flatten `(,(-map (lambda (n) (list n "DP2")) (number-sequence 1 5)) + (-flatten `(,(-map (lambda (n) (list n "DP2")) (number-sequence 1 7)) (0 "eDP1") - ,(-map (lambda (n) (list n "eDP1")) (number-sequence 6 9))))) + ,(-map (lambda (n) (list n "eDP1")) (number-sequence 8 9))))) (use-package exwm :hook ((exwm-update-class . (lambda () -- cgit 1.4.1 From 4a53a084a50b2e28cfe6e95c3222134146e2e7c9 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 13 Nov 2018 15:33:10 +0100 Subject: feat(mail): Refresh unread mail count more often Decreases the interval from 90 seconds to 30 seconds. --- init/mail-setup.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/mail-setup.el b/init/mail-setup.el index 1292a7e15f..1700ccddd3 100644 --- a/init/mail-setup.el +++ b/init/mail-setup.el @@ -75,7 +75,7 @@ The offlineimap-timer runs every 2 minutes, so it does not make sense to refresh this much more often than that." - (when (> (- (float-time) *last-notmuch-count-redraw*) 90) + (when (> (- (float-time) *last-notmuch-count-redraw*) 30) (setq *last-notmuch-count-redraw* (float-time)) (let* ((inbox-unread (notmuch-saved-search-count "tag:inbox and tag:unread")) (devel-unread (notmuch-saved-search-count "tag:aprila-dev and tag:unread")) -- cgit 1.4.1 From bdff24f52b5488041e840c045c9f8c829dd9c94a Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 13 Nov 2018 15:35:37 +0100 Subject: fix(init): Initialise ace-window-display-mode on launch --- init.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/init.el b/init.el index 73780d4035..32b87ba32b 100644 --- a/init.el +++ b/init.el @@ -23,10 +23,8 @@ (use-package ace-window :bind (("C-x o" . ace-window)) :init - (progn (setq aw-keys '(?f ?j ?d ?k ?s ?l ?a) - aw-scope 'frame) - ;; Show previews of ace-window numbers in the mode line for each window. - (ace-window-display-mode))) + (setq aw-keys '(?f ?j ?d ?k ?s ?l ?a) + aw-scope 'frame)) (use-package adjust-parens :hook ((lisp-mode . adjust-parens-mode) (emacs-lisp-mode . adjust-parens-mode))) @@ -163,6 +161,11 @@ ;;(add-to-list 'company-backends 'sly-company) )) +;; Show previews of ace-window numbers in the mode line for each +;; window. Initialising this in the package configuration does not +;; work. +(ace-window-display-mode) + ;; Some packages can only be initialised after the rest of the ;; settings has been applied: -- cgit 1.4.1 From 09daca2fea2a857caddbeed2723b6e0c1854877d Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 14 Jan 2019 13:39:43 +0100 Subject: fix(init): Move ace-window-display-mode into hook function For some reason that I can not be bothered to debug this mode will only work correctly if initialised from inside this hook function (or manually, after startup). --- init.el | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/init.el b/init.el index 32b87ba32b..f76fb9fea4 100644 --- a/init.el +++ b/init.el @@ -152,19 +152,15 @@ modes bindings term-setup - eshell-setup - )) + eshell-setup)) (telephone-line-setup) + (ace-window-display-mode) (use-package sly :init (setq inferior-lisp-program (concat (nix-store-path "sbcl") "/bin/sbcl")) ;;(add-to-list 'company-backends 'sly-company) )) -;; Show previews of ace-window numbers in the mode line for each -;; window. Initialising this in the package configuration does not -;; work. -(ace-window-display-mode) ;; Some packages can only be initialised after the rest of the ;; settings has been applied: -- cgit 1.4.1 From 9b35db823f5947d289a9d8b18c5ca415e3be814d Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 14 Jan 2019 13:40:23 +0100 Subject: chore(init): Remove adjust-parens configuration This package is actually kind of annoying. --- init.el | 2 -- 1 file changed, 2 deletions(-) diff --git a/init.el b/init.el index f76fb9fea4..66d38cd9fc 100644 --- a/init.el +++ b/init.el @@ -26,8 +26,6 @@ (setq aw-keys '(?f ?j ?d ?k ?s ?l ?a) aw-scope 'frame)) -(use-package adjust-parens :hook ((lisp-mode . adjust-parens-mode) - (emacs-lisp-mode . adjust-parens-mode))) (use-package auth-source-pass :init (auth-source-pass-enable)) (use-package avy -- cgit 1.4.1 From 15c61c0beebeb2d9645ac7cd3736d21fe286dd3a Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 14 Dec 2019 11:30:56 +0000 Subject: chore(emacs): Move emacs config to tools/emacs --- .gitignore | 11 -- README.md | 6 - init.el | 168 ------------------------ init/bindings.el | 54 -------- init/custom.el | 52 -------- init/eshell-setup.el | 68 ---------- init/functions.el | 266 -------------------------------------- init/look-and-feel.el | 115 ---------------- init/mail-setup.el | 98 -------------- init/modes.el | 36 ------ init/nixos.el | 103 --------------- init/settings.el | 65 ---------- init/term-setup.el | 37 ------ tools/emacs/.gitignore | 11 ++ tools/emacs/README.md | 6 + tools/emacs/init.el | 168 ++++++++++++++++++++++++ tools/emacs/init/bindings.el | 54 ++++++++ tools/emacs/init/custom.el | 52 ++++++++ tools/emacs/init/eshell-setup.el | 68 ++++++++++ tools/emacs/init/functions.el | 266 ++++++++++++++++++++++++++++++++++++++ tools/emacs/init/look-and-feel.el | 115 ++++++++++++++++ tools/emacs/init/mail-setup.el | 98 ++++++++++++++ tools/emacs/init/modes.el | 36 ++++++ tools/emacs/init/nixos.el | 103 +++++++++++++++ tools/emacs/init/settings.el | 65 ++++++++++ tools/emacs/init/term-setup.el | 37 ++++++ 26 files changed, 1079 insertions(+), 1079 deletions(-) delete mode 100644 .gitignore delete mode 100644 README.md delete mode 100644 init.el delete mode 100644 init/bindings.el delete mode 100644 init/custom.el delete mode 100644 init/eshell-setup.el delete mode 100644 init/functions.el delete mode 100644 init/look-and-feel.el delete mode 100644 init/mail-setup.el delete mode 100644 init/modes.el delete mode 100644 init/nixos.el delete mode 100644 init/settings.el delete mode 100644 init/term-setup.el create mode 100644 tools/emacs/.gitignore create mode 100644 tools/emacs/README.md create mode 100644 tools/emacs/init.el create mode 100644 tools/emacs/init/bindings.el create mode 100644 tools/emacs/init/custom.el create mode 100644 tools/emacs/init/eshell-setup.el create mode 100644 tools/emacs/init/functions.el create mode 100644 tools/emacs/init/look-and-feel.el create mode 100644 tools/emacs/init/mail-setup.el create mode 100644 tools/emacs/init/modes.el create mode 100644 tools/emacs/init/nixos.el create mode 100644 tools/emacs/init/settings.el create mode 100644 tools/emacs/init/term-setup.el diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 7b666905f8..0000000000 --- a/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -.smex-items -*token* -auto-save-list/ -clones/ -elpa/ -irc.el -local.el -other/ -scripts/ -themes/ -*.elc diff --git a/README.md b/README.md deleted file mode 100644 index 2dd067a910..0000000000 --- a/README.md +++ /dev/null @@ -1,6 +0,0 @@ -emacs.d -======== - -This contains my emacs.d folder. - -I use emacs for many things. diff --git a/init.el b/init.el deleted file mode 100644 index 66d38cd9fc..0000000000 --- a/init.el +++ /dev/null @@ -1,168 +0,0 @@ -;;; init.el --- Package bootstrapping. -*- lexical-binding: t; -*- - -;; Packages are installed via Nix configuration, this file only -;; initialises the newly loaded packages. - -(require 'use-package) -(require 'seq) - -(package-initialize) - -;; Add 'init' folder that contains other settings to load. -(add-to-list 'load-path (concat user-emacs-directory "init")) - -;; Initialise all packages installed via Nix. -;; -;; TODO: Generate this section in Nix for all packages that do not -;; require special configuration. - -;; -;; Packages providing generic functionality. -;; - -(use-package ace-window - :bind (("C-x o" . ace-window)) - :init - (setq aw-keys '(?f ?j ?d ?k ?s ?l ?a) - aw-scope 'frame)) - -(use-package auth-source-pass :init (auth-source-pass-enable)) - -(use-package avy - :bind (("M-j" . avy-goto-char) - ("M-p" . avy-pop-mark) - ("M-g g" . avy-goto-line))) - -(use-package browse-kill-ring) - -(use-package company - :hook ((prog-mode . company-mode)) - :bind (:map rust-mode-map ("" . company-indent-or-complete-common) - :map lisp-mode-map ("" . company-indent-or-complete-common)) - :init (setq company-tooltip-align-annotations t)) - -(use-package dash) -(use-package dash-functional) -(use-package edit-server :init (edit-server-start)) -(use-package gruber-darker-theme) -(use-package ht) -(use-package hydra) -(use-package idle-highlight-mode :hook ((prog-mode . idle-highlight-mode))) -(use-package paredit :hook ((lisp-mode . paredit-mode) - (emacs-lisp-mode . paredit-mode))) -(use-package multiple-cursors) -(use-package pinentry - :init - (setq epa-pinentry-mode 'loopback) - (pinentry-start)) - -(use-package rainbow-delimiters :hook (prog-mode . rainbow-delimiters-mode)) -(use-package rainbow-mode) -(use-package s) -(use-package smartparens :init (smartparens-global-mode)) -(use-package string-edit) -(use-package telephone-line) ;; configuration happens outside of use-package -(use-package undo-tree :init (global-undo-tree-mode)) -(use-package uuidgen) -(use-package which-key :init (which-key-mode t)) - -;; -;; Applications in emacs -;; - -(use-package magit - :bind ("C-c g" . magit-status) - :init (setq magit-repository-directories '(("/home/vincent/projects" . 2)))) - -(use-package password-store) -(use-package pg) -(use-package restclient) - -;; -;; Packages providing language-specific functionality -;; - -(use-package cargo - :hook ((rust-mode . cargo-minor-mode) - (cargo-process-mode . visual-line-mode)) - :bind (:map cargo-minor-mode-map ("C-c C-c C-l" . ignore))) - -(use-package dockerfile-mode) - -(use-package eglot - :init (defvar rust-eglot-initialized nil) - :hook ((rust-mode . (lambda () - (unless rust-eglot-initialized - (call-interactively #'eglot) - (setq rust-eglot-initialized t)))))) - -(use-package erlang - :hook ((erlang-mode . (lambda () - ;; Don't indent after '>' while I'm writing - (local-set-key ">" 'self-insert-command))))) - -(use-package go-mode) -(use-package haskell-mode) - -(use-package jq-mode - :init (add-to-list 'auto-mode-alist '("\\.jq\\'" . jq-mode))) - -(use-package kotlin-mode - :bind (:map kotlin-mode-map ("" . indent-relative))) - -(use-package markdown-mode - :init - (add-to-list 'auto-mode-alist '("\\.txt\\'" . markdown-mode)) - (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) - (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))) - -(use-package markdown-toc) - -(use-package nix-mode - :bind (:map nix-mode-map ("" . nix-indent-line))) - -(use-package nginx-mode) -(use-package rust-mode) -(use-package terraform-mode) -(use-package toml-mode) -(use-package web-mode) -(use-package yaml-mode) - -;; -;; EXWM / NixOS related packages -;; - -;; Configure a few basics before moving on to package-specific initialisation. -(setq custom-file (concat user-emacs-directory "init/custom.el")) -(load custom-file) - -(defvar home-dir (expand-file-name "~")) - -;; Seed RNG -(random t) - -(defun load-other-settings () - (mapc 'require '(nixos - mail-setup - look-and-feel - functions - settings - modes - bindings - term-setup - eshell-setup)) - (telephone-line-setup) - (ace-window-display-mode) - - (use-package sly - :init (setq inferior-lisp-program (concat (nix-store-path "sbcl") "/bin/sbcl")) - ;;(add-to-list 'company-backends 'sly-company) - )) - - -;; Some packages can only be initialised after the rest of the -;; settings has been applied: - -(add-hook 'after-init-hook 'load-other-settings) -(put 'narrow-to-region 'disabled nil) -(put 'upcase-region 'disabled nil) diff --git a/init/bindings.el b/init/bindings.el deleted file mode 100644 index f10869a532..0000000000 --- a/init/bindings.el +++ /dev/null @@ -1,54 +0,0 @@ -;; Various keybindings, most of them taken from starter-kit-bindings - -;; Font size -(define-key global-map (kbd "C-+") 'text-scale-increase) -(define-key global-map (kbd "C--") 'text-scale-decrease) - -;; Use regex searches by default. -(global-set-key (kbd "\C-r") 'isearch-backward-regexp) -(global-set-key (kbd "M-%") 'query-replace-regexp) -(global-set-key (kbd "C-M-s") 'isearch-forward) -(global-set-key (kbd "C-M-r") 'isearch-backward) -(global-set-key (kbd "C-M-%") 'query-replace) - -;; Counsel stuff: -(global-set-key (kbd "C-c r g") 'counsel-rg) - -;; imenu instead of insert-file -(global-set-key (kbd "C-x i") 'imenu) - -;; Window switching. (C-x o goes to the next window) -(windmove-default-keybindings) ;; Shift+direction - -;; Start eshell or switch to it if it's active. -(global-set-key (kbd "C-x m") 'eshell) - -;; Start a new eshell even if one is active. -(global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) - -(global-set-key (kbd "C-x p") 'ivy-browse-repositories) -(global-set-key (kbd "M-g M-g") 'goto-line-with-feedback) - -(global-set-key (kbd "C-c w") 'whitespace-cleanup) -(global-set-key (kbd "C-c a") 'align-regexp) - -;; Browse URLs (very useful for Gitlab's SSH output!) -(global-set-key (kbd "C-c b p") 'browse-url-at-point) -(global-set-key (kbd "C-c b b") 'browse-url) - -;; Goodness from @magnars -;; I don't need to kill emacs that easily -;; the mnemonic is C-x REALLY QUIT -(global-set-key (kbd "C-x r q") 'save-buffers-kill-terminal) -(global-set-key (kbd "C-x C-c") 'delete-frame) - -;; Open Fefes Blog -(global-set-key (kbd "C-c C-f") 'fefes-blog) - -;; Open a file in project: -(global-set-key (kbd "C-c f") 'project-find-file) - -;; Use swiper instead of isearch -(global-set-key "\C-s" 'swiper) - -(provide 'bindings) diff --git a/init/custom.el b/init/custom.el deleted file mode 100644 index 4c92f0d32f..0000000000 --- a/init/custom.el +++ /dev/null @@ -1,52 +0,0 @@ -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(ac-auto-show-menu 0.8) - '(ac-delay 0.2) - '(aprila-nixops-path "/home/vincent/projects/langler/nixops") - '(aprila-release-author "Vincent Ambo ") - '(aprila-releases-path "/home/vincent/projects/langler/docs/releases") - '(avy-background t) - '(cargo-process--custom-path-to-bin "env CARGO_INCREMENTAL=1 cargo") - '(cargo-process--enable-rust-backtrace 1) - '(custom-enabled-themes (quote (gruber-darker))) - '(custom-safe-themes - (quote - ("d61fc0e6409f0c2a22e97162d7d151dee9e192a90fa623f8d6a071dbf49229c6" "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "89336ca71dae5068c165d932418a368a394848c3b8881b2f96807405d8c6b5b6" default))) - '(elnode-send-file-program "/run/current-system/sw/bin/cat") - '(frame-brackground-mode (quote dark)) - '(global-auto-complete-mode t) - '(intero-debug nil) - '(intero-global-mode t nil (intero)) - '(intero-package-version "0.1.31") - '(kubernetes-commands-display-buffer-function (quote display-buffer)) - '(magit-log-show-gpg-status t) - '(ns-alternate-modifier (quote none)) - '(ns-command-modifier (quote control)) - '(ns-right-command-modifier (quote meta)) - '(require-final-newline (quote visit-save))) -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(default ((t (:foreground "#e4e4ef" :background "#181818")))) - '(rainbow-delimiters-depth-1-face ((t (:foreground "#2aa198")))) - '(rainbow-delimiters-depth-2-face ((t (:foreground "#b58900")))) - '(rainbow-delimiters-depth-3-face ((t (:foreground "#268bd2")))) - '(rainbow-delimiters-depth-4-face ((t (:foreground "#dc322f")))) - '(rainbow-delimiters-depth-5-face ((t (:foreground "#859900")))) - '(rainbow-delimiters-depth-6-face ((t (:foreground "#268bd2")))) - '(rainbow-delimiters-depth-7-face ((t (:foreground "#cb4b16")))) - '(rainbow-delimiters-depth-8-face ((t (:foreground "#d33682")))) - '(rainbow-delimiters-depth-9-face ((t (:foreground "#839496")))) - '(term-color-black ((t (:background "#282828" :foreground "#282828")))) - '(term-color-blue ((t (:background "#96a6c8" :foreground "#96a6c8")))) - '(term-color-cyan ((t (:background "#1fad83" :foreground "#1fad83")))) - '(term-color-green ((t (:background "#73c936" :foreground "#73c936")))) - '(term-color-magenta ((t (:background "#9e95c7" :foreground "#9e95c7")))) - '(term-color-red ((t (:background "#f43841" :foreground "#f43841")))) - '(term-color-white ((t (:background "#f5f5f5" :foreground "#f5f5f5")))) - '(term-color-yellow ((t (:background "#ffdd33" :foreground "#ffdd33"))))) diff --git a/init/eshell-setup.el b/init/eshell-setup.el deleted file mode 100644 index 0b23c5a2d1..0000000000 --- a/init/eshell-setup.el +++ /dev/null @@ -1,68 +0,0 @@ -;; EShell configuration - -(require 'eshell) - -;; Generic settings -;; Hide banner message ... -(setq eshell-banner-message "") - -;; Prompt configuration -(defun clean-pwd (path) - "Turns a path of the form /foo/bar/baz into /f/b/baz - (inspired by fish shell)" - (let* ((hpath (replace-regexp-in-string home-dir - "~" - path)) - (current-dir (split-string hpath "/")) - (cdir (last current-dir)) - (head (butlast current-dir))) - (concat (mapconcat (lambda (s) - (if (string= "" s) nil - (substring s 0 1))) - head - "/") - (if head "/" nil) - (car cdir)))) - -(defun vcprompt (&optional args) - "Call the external vcprompt command with optional arguments. - VCPrompt" - (replace-regexp-in-string - "\n" "" - (shell-command-to-string (concat "vcprompt" args)))) - -(defmacro with-face (str &rest properties) - `(propertize ,str 'face (list ,@properties))) - -(defun prompt-f () - "EShell prompt displaying VC info and such" - (concat - (with-face (concat (clean-pwd (eshell/pwd)) " ") :foreground "#96a6c8") - (if (= 0 (user-uid)) - (with-face "#" :foreground "#f43841") - (with-face "$" :foreground "#73c936")) - (with-face " " :foreground "#95a99f"))) - - -(setq eshell-prompt-function 'prompt-f) -(setq eshell-highlight-prompt nil) -(setq eshell-prompt-regexp "^.+? \\((\\(git\\|svn\\|hg\\|darcs\\|cvs\\|bzr\\):.+?) \\)?[$#] ") - -;; Ignore version control folders in autocompletion -(setq eshell-cmpl-cycle-completions nil - eshell-save-history-on-exit t - eshell-cmpl-dir-ignore "\\`\\(\\.\\.?\\|CVS\\|\\.svn\\|\\.git\\)/\\'") - -;; Load some EShell extensions -(eval-after-load 'esh-opt - '(progn - (require 'em-term) - (require 'em-cmpl) - ;; More visual commands! - (add-to-list 'eshell-visual-commands "ssh") - (add-to-list 'eshell-visual-commands "tail") - (add-to-list 'eshell-visual-commands "sl"))) - -(setq eshell-directory-name "~/.config/eshell/") - -(provide 'eshell-setup) diff --git a/init/functions.el b/init/functions.el deleted file mode 100644 index 8b96a0e737..0000000000 --- a/init/functions.el +++ /dev/null @@ -1,266 +0,0 @@ -(require 's) -;; A few handy functions I use in init.el (or not, but they're nice to -;; have) - -(defun custom-download-theme (url filename) - "Downloads a theme through HTTP and places it in ~/.emacs.d/themes" - - ;; Ensure the directory exists - (unless (file-exists-p "~/.emacs.d/themes") - (make-directory "~/.emacs.d/themes")) - - ;; Adds the themes folder to the theme load path (if not already - ;; there) - (unless (member "~/.emacs.d/themes" custom-theme-load-path) - (add-to-list 'custom-theme-load-path "~/.emacs.d/themes")) - - ;; Download file if it doesn't exist. - - (let ((file - (concat "~/.emacs.d/themes/" filename))) - (unless (file-exists-p file) - (url-copy-file url file)))) - -(defun custom-download-script (url filename) - "Downloads an Elisp script, places it in ~/.emacs/other and then loads it" - - ;; Ensure the directory exists - (unless (file-exists-p "~/.emacs.d/other") - (make-directory "~/.emacs.d/other")) - - ;; Download file if it doesn't exist. - (let ((file - (concat "~/.emacs.d/other/" filename))) - (unless (file-exists-p file) - (url-copy-file url file)) - - (load file))) - -(defun keychain-password (account &optional keychain) - "Returns the password for the account, by default it's looked up in the Login.keychain but a - different keychain can be specified." - (let ((k (if keychain keychain "Login.keychain"))) - (replace-regexp-in-string - "\n" "" - (shell-command-to-string (concat "security find-generic-password -w -a " - account - " " - k))))) - -;; This clones a git repository to 'foldername in .emacs.d -;; if there isn't already a folder with that name -(defun custom-clone-git (url foldername) - "Clones a git repository to .emacs.d/foldername" - (let ((fullpath (concat "~/.emacs.d/" foldername))) - (unless (file-exists-p fullpath) - (async-shell-command (concat "git clone " url " " fullpath))))) - -(defun load-file-if-exists (filename) - (if (file-exists-p filename) - (load filename))) - -(defun goto-line-with-feedback () - "Show line numbers temporarily, while prompting for the line number input" - (interactive) - (unwind-protect - (progn - (setq-local display-line-numbers t) - (let ((target (read-number "Goto line: "))) - (avy-push-mark) - (goto-line target))) - (setq-local display-line-numbers nil))) - - -(defun untabify-buffer () - (interactive) - (untabify (point-min) (point-max))) - -(defun indent-buffer () - (interactive) - (indent-region (point-min) (point-max))) - -(defun cleanup-buffer () - "Perform a bunch of operations on the whitespace content of a buffer. -Including indent-buffer, which should not be called automatically on save." - (interactive) - (untabify-buffer) - (delete-trailing-whitespace) - (indent-buffer)) - -;; These come from the emacs starter kit - -(defun esk-add-watchwords () - (font-lock-add-keywords - nil '(("\\<\\(FIX\\(ME\\)?\\|TODO\\|DEBUG\\|HACK\\|REFACTOR\\|NOCOMMIT\\)" - 1 font-lock-warning-face t)))) - -(defun esk-sudo-edit (&optional arg) - (interactive "p") - (if (or arg (not buffer-file-name)) - (find-file (concat "/sudo:root@localhost:" (read-file-name "File: "))) - (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))) - -;; Open Fefes blog -(defun fefes-blog () - (interactive) - (eww "https://blog.fefe.de/")) - -;; Open this machines NixOS config -(defun nix-config () - (interactive) - (find-file "/etc/nixos/configuration.nix")) - -;; Open the NixOS man page -(defun nixos-man () - (interactive) - (man "configuration.nix")) - -;; Open local emacs configuration -(defun emacs-config () - (interactive) - (dired "~/.emacs.d/")) - -;; Get the nix store path for a given derivation. -;; If the derivation has not been built before, this will trigger a build. -(defun nix-store-path (derivation) - (let ((expr (concat "with import {}; " derivation))) - (s-chomp (shell-command-to-string (concat "nix-build -E '" expr "'"))))) - -(defun insert-nix-store-path () - (interactive) - (let ((derivation (read-string "Derivation name (in ): "))) - (insert (nix-store-path derivation)))) - -(defun toggle-force-newline () - "Buffer-local toggle for enforcing final newline on save." - (interactive) - (setq-local require-final-newline (not require-final-newline)) - (message "require-final-newline in buffer %s is now %s" - (buffer-name) - require-final-newline)) - -;; Helm includes a command to run external applications, which does -;; not seem to exist in ivy. This implementation uses some of the -;; logic from Helm to provide similar functionality using ivy. -(defun list-external-commands () - "Creates a list of all external commands available on $PATH - while filtering NixOS wrappers." - (cl-loop - for dir in (split-string (getenv "PATH") path-separator) - when (and (file-exists-p dir) (file-accessible-directory-p dir)) - for lsdir = (cl-loop for i in (directory-files dir t) - for bn = (file-name-nondirectory i) - when (and (not (s-contains? "-wrapped" i)) - (not (member bn completions)) - (not (file-directory-p i)) - (file-executable-p i)) - collect bn) - append lsdir into completions - finally return (sort completions 'string-lessp))) - -(defun run-external-command (cmd) - "Execute the specified command and notify the user when it - finishes." - (message "Starting %s..." cmd) - (set-process-sentinel - (start-process-shell-command cmd nil cmd) - (lambda (process event) - (when (string= event "finished\n") - (message "%s process finished." process))))) - -(defun ivy-run-external-command () - "Prompts the user with a list of all installed applications and - lets them select one to launch." - - (interactive) - (let ((external-commands-list (list-external-commands))) - (ivy-read "Command:" external-commands-list - :require-match t - :history 'external-commands-history - :action #'run-external-command))) - -(defun ivy-password-store (&optional password-store-dir) - "Custom version of password-store integration with ivy that - actually uses the GPG agent correctly." - - (interactive) - (ivy-read "Copy password of entry: " - (password-store-list (or password-store-dir (password-store-dir))) - :require-match t - :keymap ivy-pass-map - :action (lambda (entry) - (let ((password (auth-source-pass-get 'secret entry))) - (password-store-clear) - (kill-new password) - (setq password-store-kill-ring-pointer kill-ring-yank-pointer) - (message "Copied %s to the kill ring. Will clear in %s seconds." - entry (password-store-timeout)) - (setq password-store-timeout-timer - (run-at-time (password-store-timeout) - nil 'password-store-clear)))))) - -(defun ivy-browse-repositories () - "Select a git repository and open its associated magit buffer." - - (interactive) - (ivy-read "Repository: " - (magit-list-repos) - :require-match t - :sort t - :action #'magit-status)) - -(defun warmup-gpg-agent (arg &optional exit) - "Function used to warm up the GPG agent before use. This is - useful in cases where there is no easy way to make pinentry run - in the correct context (such as when sending email)." - (interactive) - (message "Warming up GPG agent") - (epg-sign-string (epg-make-context) "dummy") - nil) - -(defun bottom-right-window-p () - "Determines whether the last (i.e. bottom-right) window of the - active frame is showing the buffer in which this function is - executed." - (let* ((frame (selected-frame)) - (right-windows (window-at-side-list frame 'right)) - (bottom-windows (window-at-side-list frame 'bottom)) - (last-window (car (seq-intersection right-windows bottom-windows)))) - (eq (current-buffer) (window-buffer last-window)))) - -(defun inferior-erlang-nix-shell () - "Start an inferior Erlang process from the root of the current - project." - (interactive) - (inferior-erlang - (format "nix-shell --command erl %s" (cdr (project-current))))) - -(defun intero-fix-ghci-panic () - "Disable deferring of out of scope variable errors, which - triggers a bug in the interactive Emacs REPL printing a panic - under certain conditions." - - (interactive) - (let* ((root (intero-project-root)) - (package-name (intero-package-name)) - (backend-buffer (intero-buffer 'backend)) - (name (format "*intero:%s:%s:repl*" - (file-name-nondirectory root) - package-name)) - (setting ":set -fno-defer-out-of-scope-variables\n")) - (when (get-buffer name) - (with-current-buffer (get-buffer name) - (goto-char (point-max)) - (let ((process (get-buffer-process (current-buffer)))) - (when process (process-send-string process setting))))))) - -;; Brute-force fix: Ensure the setting is injected every time the REPL -;; is selected. -;; -;; Upstream issue: https://github.com/commercialhaskell/intero/issues/569 -(advice-add 'intero-repl :after (lambda (&rest r) (intero-fix-ghci-panic)) - '((name . intero-panic-fix))) -(advice-add 'intero-repl-load :after (lambda (&rest r) (intero-fix-ghci-panic)) - '((name . intero-panic-fix))) - -(provide 'functions) diff --git a/init/look-and-feel.el b/init/look-and-feel.el deleted file mode 100644 index 3d480bd5f4..0000000000 --- a/init/look-and-feel.el +++ /dev/null @@ -1,115 +0,0 @@ -;;; -*- lexical-binding: t; -*- - -;; Hide those ugly tool bars: -(tool-bar-mode 0) -(scroll-bar-mode 0) -(menu-bar-mode 0) -(add-hook 'after-make-frame-functions - (lambda (frame) (scroll-bar-mode 0))) - -;; Don't do any annoying things: -(setq ring-bell-function 'ignore) -(setq initial-scratch-message "") - -;; Remember layout changes -(winner-mode 1) - -;; Usually emacs will run as a proper GUI application, in which case a few -;; extra settings are nice-to-have: -(when window-system - (setq frame-title-format '(buffer-file-name "%f" ("%b"))) - (mouse-wheel-mode t) - (blink-cursor-mode -1)) - -;; Configure editor fonts -(let ((font (format "Input Mono-%d" 12))) - (setq default-frame-alist `((font-backend . "xft") - (font . ,font))) - (set-frame-font font t t)) - -;; Display battery in mode-line's misc section on adho: -(when (equal "adho" (system-name)) - (setq battery-mode-line-format " %b%p%%") - (display-battery-mode)) - -;; Configure telephone-line -(defun telephone-misc-if-last-window () - "Renders the mode-line-misc-info string for display in the - mode-line if the currently active window is the last one in the - frame. - - The idea is to not display information like the current time, - load, battery levels in all buffers." - - (when (bottom-right-window-p) - (telephone-line-raw mode-line-misc-info t))) - -(defun telephone-line-setup () - (telephone-line-defsegment telephone-line-last-window-segment () - (telephone-misc-if-last-window)) - - ;; Display the current EXWM workspace index in the mode-line - (telephone-line-defsegment telephone-line-exwm-workspace-index () - (when (bottom-right-window-p) - (format "[%s]" exwm-workspace-current-index))) - - ;; Define a highlight font for ~ important ~ information in the last - ;; window. - (defface special-highlight '((t (:foreground "white" :background "#5f627f"))) "") - (add-to-list 'telephone-line-faces - '(highlight . (special-highlight . special-highlight))) - - (setq telephone-line-lhs - '((nil . (telephone-line-position-segment)) - (accent . (telephone-line-buffer-segment)))) - - (setq telephone-line-rhs - '((accent . (telephone-line-major-mode-segment)) - (nil . (telephone-line-last-window-segment - telephone-line-exwm-workspace-index)) - (highlight . (telephone-line-notmuch-counts)))) - - (setq telephone-line-primary-left-separator 'telephone-line-tan-left - telephone-line-primary-right-separator 'telephone-line-tan-right - telephone-line-secondary-left-separator 'telephone-line-tan-hollow-left - telephone-line-secondary-right-separator 'telephone-line-tan-hollow-right) - - (telephone-line-mode 1)) - -;; Auto refresh buffers -(global-auto-revert-mode 1) - -;; Use clipboard properly -(setq select-enable-clipboard t) - -;; Show in-progress chords in minibuffer -(setq echo-keystrokes 0.1) - -;; Show column numbers in all buffers -(column-number-mode t) - -;; Highlight currently active line -(global-hl-line-mode t) - -(defalias 'yes-or-no-p 'y-or-n-p) -(defalias 'auto-tail-revert-mode 'tail-mode) - -;; Style line numbers (shown with M-g g) -(setq linum-format - (lambda (line) - (propertize - (format (concat " %" - (number-to-string - (length (number-to-string - (line-number-at-pos (point-max))))) - "d ") - line) - 'face 'linum))) - -;; Display tabs as 2 spaces -(setq tab-width 2) - -;; Don't wrap around when moving between buffers -(setq windmove-wrap-around nil) - -(provide 'look-and-feel) diff --git a/init/mail-setup.el b/init/mail-setup.el deleted file mode 100644 index 1700ccddd3..0000000000 --- a/init/mail-setup.el +++ /dev/null @@ -1,98 +0,0 @@ -(require 'notmuch) -(require 'counsel-notmuch) - -(global-set-key (kbd "C-c m") 'notmuch-hello) -(global-set-key (kbd "C-c C-m") 'counsel-notmuch) -(global-set-key (kbd "C-c C-e n") 'notmuch-mua-new-mail) - -(setq notmuch-cache-dir (format "%s/.cache/notmuch" (getenv "HOME"))) -(make-directory notmuch-cache-dir t) - -;; Cache addresses for completion: -(setq notmuch-address-save-filename (concat notmuch-cache-dir "/addresses")) - -;; Don't spam my home folder with drafts: -(setq notmuch-draft-folder "drafts") ;; relative to notmuch database - -;; Mark things as read when archiving them: -(setq notmuch-archive-tags '("-inbox" "-unread" "+archive")) - -;; Show me saved searches that I care about: -(setq notmuch-saved-searches - '((:name "inbox" :query "tag:inbox" :count-query "tag:inbox AND tag:unread" :key "i") - (:name "aprila-dev" :query "tag:aprila-dev" :count-query "tag:aprila-dev AND tag:unread" :key "d") - (:name "gitlab" :query "tag:gitlab" :key "g") - (:name "sent" :query "tag:sent" :key "t") - (:name "drafts" :query "tag:draft"))) -(setq notmuch-show-empty-saved-searches t) - -;; Mail sending configuration -(setq send-mail-function 'sendmail-send-it) ;; sendmail provided by MSMTP -(setq notmuch-always-prompt-for-sender t) -(setq notmuch-mua-user-agent-function - (lambda () (format "Emacs %s; notmuch.el %s" emacs-version notmuch-emacs-version))) -(setq mail-host-address (system-name)) -(setq notmuch-mua-cite-function #'message-cite-original-without-signature) - -;; Close mail buffers after sending mail -(setq message-kill-buffer-on-exit t) - -;; Ensure sender is correctly passed to msmtp -(setq mail-specify-envelope-from t - message-sendmail-envelope-from 'header - mail-envelope-from 'header) - -;; Store sent mail in the correct folder per account -(setq notmuch-maildir-use-notmuch-insert nil) -(setq notmuch-fcc-dirs '(("mail@tazj.in" . "tazjin/Sent") - ;; Not a mistake, Office365 apparently - ;; renames IMAP folders (!) to your local - ;; language instead of providing translations - ;; in the UI m( - ("vincent@aprila.no" . "aprila/Sende element"))) - -;; I don't use drafts but I instinctively hit C-x C-s constantly, lets -;; handle that gracefully. -(define-key notmuch-message-mode-map (kbd "C-x C-s") #'ignore) - -;; MSMTP decrypts passwords using pass, but pinentry doesn't work -;; correctly in that setup. This forces a warmup of the GPG agent -;; before sending the message. -;; -;; Note that the sending function is advised because the provided hook -;; for this seems to run at the wrong time. -(advice-add 'notmuch-mua-send-common :before 'warmup-gpg-agent) - -;; Define a telephone-line segment for displaying the count of unread, -;; important mails in the last window's mode-line: -(defvar *last-notmuch-count-redraw* 0) -(defvar *current-notmuch-count* nil) - -(defun update-display-notmuch-counts () - "Update and render the current state of the notmuch unread - count for display in the mode-line. - - The offlineimap-timer runs every 2 minutes, so it does not make - sense to refresh this much more often than that." - - (when (> (- (float-time) *last-notmuch-count-redraw*) 30) - (setq *last-notmuch-count-redraw* (float-time)) - (let* ((inbox-unread (notmuch-saved-search-count "tag:inbox and tag:unread")) - (devel-unread (notmuch-saved-search-count "tag:aprila-dev and tag:unread")) - (notmuch-count (format "I: %s; D: %s" inbox-unread devel-unread))) - (setq *current-notmuch-count* notmuch-count))) - - (when (and (bottom-right-window-p) - ;; Only render if the initial update is done and there - ;; are unread mails: - *current-notmuch-count* - (not (equal *current-notmuch-count* "I: 0; D: 0"))) - *current-notmuch-count*)) - -(telephone-line-defsegment telephone-line-notmuch-counts () - "This segment displays the count of unread notmuch messages in - the last window's mode-line (if unread messages are present)." - - (update-display-notmuch-counts)) - -(provide 'mail-setup) diff --git a/init/modes.el b/init/modes.el deleted file mode 100644 index 19ed2a6843..0000000000 --- a/init/modes.el +++ /dev/null @@ -1,36 +0,0 @@ -;; Initializes modes I use. - -(add-hook 'prog-mode-hook 'esk-add-watchwords) - -;; Use auto-complete as completion at point -(defun set-auto-complete-as-completion-at-point-function () - (setq completion-at-point-functions '(auto-complete))) - -(add-hook 'auto-complete-mode-hook - 'set-auto-complete-as-completion-at-point-function) - -;; Enable rainbow-delimiters for all things programming -(add-hook 'prog-mode-hook 'rainbow-delimiters-mode) - -;; Enable Paredit & Company in Emacs Lisp mode -(add-hook 'emacs-lisp-mode-hook 'company-mode) - -;; Always highlight matching brackets -(show-paren-mode 1) - -;; Always auto-close parantheses and other pairs -;; (replaced by smartparens) -;; (electric-pair-mode) - -;; Keep track of recent files -(recentf-mode) - -;; Easily navigate sillycased words -(global-subword-mode 1) - -;; Transparently open compressed files -(auto-compression-mode t) - -;; Show available key chord completions - -(provide 'modes) diff --git a/init/nixos.el b/init/nixos.el deleted file mode 100644 index e384e9b77d..0000000000 --- a/init/nixos.el +++ /dev/null @@ -1,103 +0,0 @@ -;; Configure additional settings if this is one of my NixOS machines -;; (i.e. if ExWM is required) -;; -*- lexical-binding: t; -*- - -(require 's) -(require 'f) -(require 'dash) - -(defun pulseaudio-ctl (cmd) - (shell-command (concat "pulseaudio-ctl " cmd)) - (message "Volume command: %s" cmd)) - -(defun volume-mute () (interactive) (pulseaudio-ctl "mute")) -(defun volume-up () (interactive) (pulseaudio-ctl "up")) -(defun volume-down () (interactive) (pulseaudio-ctl "down")) - -(defun brightness-up () - (interactive) - (shell-command "exec light -A 10") - (message "Brightness increased")) - -(defun brightness-down () - (interactive) - (shell-command "exec light -U 10") - (message "Brightness decreased")) - -(defun lock-screen () - (interactive) - (shell-command "screen-lock")) - -(defun generate-randr-config () - (-flatten `(,(-map (lambda (n) (list n "DP2")) (number-sequence 1 7)) - (0 "eDP1") - ,(-map (lambda (n) (list n "eDP1")) (number-sequence 8 9))))) - -(use-package exwm - :hook ((exwm-update-class . (lambda () - ;; Make class name the buffer name - (exwm-workspace-rename-buffer exwm-class-name)))) - :init - (progn - (require 'exwm-config) - - (fringe-mode 3) - - (setq exwm-workspace-number 10) - - ;; 's-r': Reset - (exwm-input-set-key (kbd "s-r") #'exwm-reset) - ;; 's-w': Switch workspace - (exwm-input-set-key (kbd "s-w") #'exwm-workspace-switch) - ;; 's-N': Switch to certain workspace - (dotimes (i 10) - (exwm-input-set-key (kbd (format "s-%d" i)) - `(lambda () - (interactive) - (exwm-workspace-switch-create ,i)))) - - ;; Launch applications with completion (dmenu style!) - (exwm-input-set-key (kbd "s-d") #'ivy-run-external-command) - (exwm-input-set-key (kbd "s-p") #'ivy-password-store) - (exwm-input-set-key (kbd "C-s-p") '(lambda () - (interactive) - (ivy-password-store "~/.aprila-secrets"))) - - ;; Add Alacritty selector to a key - (exwm-input-set-key (kbd "C-x t") #'counsel-switch-to-alacritty) - - ;; Toggle between line-mode / char-mode - (exwm-input-set-key (kbd "C-c C-t C-t") #'exwm-input-toggle-keyboard) - - ;; Volume keys - (exwm-input-set-key (kbd "") #'volume-mute) - (exwm-input-set-key (kbd "") #'volume-up) - (exwm-input-set-key (kbd "") #'volume-down) - - ;; Brightness keys - (exwm-input-set-key (kbd "") #'brightness-down) - (exwm-input-set-key (kbd "") #'brightness-up) - (exwm-input-set-key (kbd "") #'lock-screen) - - ;; Line-editing shortcuts - (exwm-input-set-simulation-keys - '(([?\C-d] . delete) - ([?\C-w] . ?\C-c))) - - ;; Enable EXWM - (exwm-enable) - - ;; Show time in the mode line - (display-time-mode) - - ;; Configure xrandr when running on laptop - (when (equal (shell-command-to-string "hostname") "adho\n") - (require 'exwm-randr) - (setq exwm-randr-workspace-output-plist (generate-randr-config)) - (exwm-randr-enable)) - - ;; Let buffers move seamlessly between workspaces - (setq exwm-workspace-show-all-buffers t) - (setq exwm-layout-show-all-buffers t))) - -(provide 'nixos) diff --git a/init/settings.el b/init/settings.el deleted file mode 100644 index 2e4dedc0a5..0000000000 --- a/init/settings.el +++ /dev/null @@ -1,65 +0,0 @@ -(require 'prescient) -(require 'ivy-prescient) -(require 'uniquify) -(require 'ivy-pass) - -;; Make ivy go! -(ivy-mode 1) -(counsel-mode 1) - -(setq ivy-use-virtual-buffers t) -(setq enable-recursive-minibuffers t) - -;; Enable support for prescient in ivy & configure it -(ivy-prescient-mode) -(prescient-persist-mode) -(add-to-list 'ivy-prescient-excluded-commands 'counsel-rg) - -;; Move files to trash when deleting -(setq delete-by-moving-to-trash t) - -;; We don't live in the 80s, but we're also not a shitty web app. -(setq gc-cons-threshold 20000000) - -(setq uniquify-buffer-name-style 'forward) - -; Fix some defaults -(setq visible-bell nil - inhibit-startup-message t - color-theme-is-global t - sentence-end-double-space nil - shift-select-mode nil - uniquify-buffer-name-style 'forward - whitespace-style '(face trailing lines-tail tabs) - whitespace-line-column 80 - default-directory "~" - fill-column 80 - ediff-split-window-function 'split-window-horizontally) - -(add-to-list 'safe-local-variable-values '(lexical-binding . t)) -(add-to-list 'safe-local-variable-values '(whitespace-line-column . 80)) - -(set-default 'indent-tabs-mode nil) - -;; UTF-8 please -(setq locale-coding-system 'utf-8) ; pretty -(set-terminal-coding-system 'utf-8) ; pretty -(set-keyboard-coding-system 'utf-8) ; pretty -(set-selection-coding-system 'utf-8) ; please -(prefer-coding-system 'utf-8) ; with sugar on top - -;; Make emacs behave sanely (overwrite selected text) -(delete-selection-mode 1) - -;; Keep your temporary files in tmp, emacs! -(setq auto-save-file-name-transforms - `((".*" ,temporary-file-directory t))) -(setq backup-directory-alist - `((".*" . ,temporary-file-directory))) - -(remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function) - -;; Show time in 24h format -(setq display-time-24hr-format t) - -(provide 'settings) diff --git a/init/term-setup.el b/init/term-setup.el deleted file mode 100644 index a2a71be9ee..0000000000 --- a/init/term-setup.el +++ /dev/null @@ -1,37 +0,0 @@ -;; Utilities for Alacritty buffers. - -(defun open-or-create-alacritty-buffer (buffer-name) - "Switch to the buffer with BUFFER-NAME or create a - new buffer running Alacritty." - (let ((buffer (get-buffer buffer-name))) - (if (not buffer) - (run-external-command "alacritty") - (switch-to-buffer buffer)))) - -(defun is-alacritty-buffer (buffer) - "Determine whether BUFFER runs Alacritty." - (and (equal 'exwm-mode (buffer-local-value 'major-mode buffer)) - (s-starts-with? "Alacritty" (buffer-name buffer)))) - -(defun counsel-switch-to-alacritty () - "Switch to a (multi-)term buffer or create one." - (interactive) - (let ((terms (-map #'buffer-name - (-filter #'is-alacritty-buffer (buffer-list))))) - (if terms - (ivy-read "Switch to Alacritty buffer: " - (cons "New terminal" terms) - :caller 'counsel-switch-to-alacritty - :require-match t - :action #'open-or-create-alacritty-buffer) - (run-external-command "alacritty")))) - -(defun alacritty-rename () - "Rename the current terminal buffer." - (interactive) - (let* ((buffer (get-buffer (buffer-name)))) - (if (is-alacritty-buffer buffer) - (rename-buffer (format "Alacritty<%s>" (read-string "New terminal name: "))) - (error "This function is only intended to rename Alacritty buffers.")))) - -(provide 'term-setup) diff --git a/tools/emacs/.gitignore b/tools/emacs/.gitignore new file mode 100644 index 0000000000..7b666905f8 --- /dev/null +++ b/tools/emacs/.gitignore @@ -0,0 +1,11 @@ +.smex-items +*token* +auto-save-list/ +clones/ +elpa/ +irc.el +local.el +other/ +scripts/ +themes/ +*.elc diff --git a/tools/emacs/README.md b/tools/emacs/README.md new file mode 100644 index 0000000000..2dd067a910 --- /dev/null +++ b/tools/emacs/README.md @@ -0,0 +1,6 @@ +emacs.d +======== + +This contains my emacs.d folder. + +I use emacs for many things. diff --git a/tools/emacs/init.el b/tools/emacs/init.el new file mode 100644 index 0000000000..66d38cd9fc --- /dev/null +++ b/tools/emacs/init.el @@ -0,0 +1,168 @@ +;;; init.el --- Package bootstrapping. -*- lexical-binding: t; -*- + +;; Packages are installed via Nix configuration, this file only +;; initialises the newly loaded packages. + +(require 'use-package) +(require 'seq) + +(package-initialize) + +;; Add 'init' folder that contains other settings to load. +(add-to-list 'load-path (concat user-emacs-directory "init")) + +;; Initialise all packages installed via Nix. +;; +;; TODO: Generate this section in Nix for all packages that do not +;; require special configuration. + +;; +;; Packages providing generic functionality. +;; + +(use-package ace-window + :bind (("C-x o" . ace-window)) + :init + (setq aw-keys '(?f ?j ?d ?k ?s ?l ?a) + aw-scope 'frame)) + +(use-package auth-source-pass :init (auth-source-pass-enable)) + +(use-package avy + :bind (("M-j" . avy-goto-char) + ("M-p" . avy-pop-mark) + ("M-g g" . avy-goto-line))) + +(use-package browse-kill-ring) + +(use-package company + :hook ((prog-mode . company-mode)) + :bind (:map rust-mode-map ("" . company-indent-or-complete-common) + :map lisp-mode-map ("" . company-indent-or-complete-common)) + :init (setq company-tooltip-align-annotations t)) + +(use-package dash) +(use-package dash-functional) +(use-package edit-server :init (edit-server-start)) +(use-package gruber-darker-theme) +(use-package ht) +(use-package hydra) +(use-package idle-highlight-mode :hook ((prog-mode . idle-highlight-mode))) +(use-package paredit :hook ((lisp-mode . paredit-mode) + (emacs-lisp-mode . paredit-mode))) +(use-package multiple-cursors) +(use-package pinentry + :init + (setq epa-pinentry-mode 'loopback) + (pinentry-start)) + +(use-package rainbow-delimiters :hook (prog-mode . rainbow-delimiters-mode)) +(use-package rainbow-mode) +(use-package s) +(use-package smartparens :init (smartparens-global-mode)) +(use-package string-edit) +(use-package telephone-line) ;; configuration happens outside of use-package +(use-package undo-tree :init (global-undo-tree-mode)) +(use-package uuidgen) +(use-package which-key :init (which-key-mode t)) + +;; +;; Applications in emacs +;; + +(use-package magit + :bind ("C-c g" . magit-status) + :init (setq magit-repository-directories '(("/home/vincent/projects" . 2)))) + +(use-package password-store) +(use-package pg) +(use-package restclient) + +;; +;; Packages providing language-specific functionality +;; + +(use-package cargo + :hook ((rust-mode . cargo-minor-mode) + (cargo-process-mode . visual-line-mode)) + :bind (:map cargo-minor-mode-map ("C-c C-c C-l" . ignore))) + +(use-package dockerfile-mode) + +(use-package eglot + :init (defvar rust-eglot-initialized nil) + :hook ((rust-mode . (lambda () + (unless rust-eglot-initialized + (call-interactively #'eglot) + (setq rust-eglot-initialized t)))))) + +(use-package erlang + :hook ((erlang-mode . (lambda () + ;; Don't indent after '>' while I'm writing + (local-set-key ">" 'self-insert-command))))) + +(use-package go-mode) +(use-package haskell-mode) + +(use-package jq-mode + :init (add-to-list 'auto-mode-alist '("\\.jq\\'" . jq-mode))) + +(use-package kotlin-mode + :bind (:map kotlin-mode-map ("" . indent-relative))) + +(use-package markdown-mode + :init + (add-to-list 'auto-mode-alist '("\\.txt\\'" . markdown-mode)) + (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) + (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))) + +(use-package markdown-toc) + +(use-package nix-mode + :bind (:map nix-mode-map ("" . nix-indent-line))) + +(use-package nginx-mode) +(use-package rust-mode) +(use-package terraform-mode) +(use-package toml-mode) +(use-package web-mode) +(use-package yaml-mode) + +;; +;; EXWM / NixOS related packages +;; + +;; Configure a few basics before moving on to package-specific initialisation. +(setq custom-file (concat user-emacs-directory "init/custom.el")) +(load custom-file) + +(defvar home-dir (expand-file-name "~")) + +;; Seed RNG +(random t) + +(defun load-other-settings () + (mapc 'require '(nixos + mail-setup + look-and-feel + functions + settings + modes + bindings + term-setup + eshell-setup)) + (telephone-line-setup) + (ace-window-display-mode) + + (use-package sly + :init (setq inferior-lisp-program (concat (nix-store-path "sbcl") "/bin/sbcl")) + ;;(add-to-list 'company-backends 'sly-company) + )) + + +;; Some packages can only be initialised after the rest of the +;; settings has been applied: + +(add-hook 'after-init-hook 'load-other-settings) +(put 'narrow-to-region 'disabled nil) +(put 'upcase-region 'disabled nil) diff --git a/tools/emacs/init/bindings.el b/tools/emacs/init/bindings.el new file mode 100644 index 0000000000..f10869a532 --- /dev/null +++ b/tools/emacs/init/bindings.el @@ -0,0 +1,54 @@ +;; Various keybindings, most of them taken from starter-kit-bindings + +;; Font size +(define-key global-map (kbd "C-+") 'text-scale-increase) +(define-key global-map (kbd "C--") 'text-scale-decrease) + +;; Use regex searches by default. +(global-set-key (kbd "\C-r") 'isearch-backward-regexp) +(global-set-key (kbd "M-%") 'query-replace-regexp) +(global-set-key (kbd "C-M-s") 'isearch-forward) +(global-set-key (kbd "C-M-r") 'isearch-backward) +(global-set-key (kbd "C-M-%") 'query-replace) + +;; Counsel stuff: +(global-set-key (kbd "C-c r g") 'counsel-rg) + +;; imenu instead of insert-file +(global-set-key (kbd "C-x i") 'imenu) + +;; Window switching. (C-x o goes to the next window) +(windmove-default-keybindings) ;; Shift+direction + +;; Start eshell or switch to it if it's active. +(global-set-key (kbd "C-x m") 'eshell) + +;; Start a new eshell even if one is active. +(global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t))) + +(global-set-key (kbd "C-x p") 'ivy-browse-repositories) +(global-set-key (kbd "M-g M-g") 'goto-line-with-feedback) + +(global-set-key (kbd "C-c w") 'whitespace-cleanup) +(global-set-key (kbd "C-c a") 'align-regexp) + +;; Browse URLs (very useful for Gitlab's SSH output!) +(global-set-key (kbd "C-c b p") 'browse-url-at-point) +(global-set-key (kbd "C-c b b") 'browse-url) + +;; Goodness from @magnars +;; I don't need to kill emacs that easily +;; the mnemonic is C-x REALLY QUIT +(global-set-key (kbd "C-x r q") 'save-buffers-kill-terminal) +(global-set-key (kbd "C-x C-c") 'delete-frame) + +;; Open Fefes Blog +(global-set-key (kbd "C-c C-f") 'fefes-blog) + +;; Open a file in project: +(global-set-key (kbd "C-c f") 'project-find-file) + +;; Use swiper instead of isearch +(global-set-key "\C-s" 'swiper) + +(provide 'bindings) diff --git a/tools/emacs/init/custom.el b/tools/emacs/init/custom.el new file mode 100644 index 0000000000..4c92f0d32f --- /dev/null +++ b/tools/emacs/init/custom.el @@ -0,0 +1,52 @@ +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(ac-auto-show-menu 0.8) + '(ac-delay 0.2) + '(aprila-nixops-path "/home/vincent/projects/langler/nixops") + '(aprila-release-author "Vincent Ambo ") + '(aprila-releases-path "/home/vincent/projects/langler/docs/releases") + '(avy-background t) + '(cargo-process--custom-path-to-bin "env CARGO_INCREMENTAL=1 cargo") + '(cargo-process--enable-rust-backtrace 1) + '(custom-enabled-themes (quote (gruber-darker))) + '(custom-safe-themes + (quote + ("d61fc0e6409f0c2a22e97162d7d151dee9e192a90fa623f8d6a071dbf49229c6" "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "89336ca71dae5068c165d932418a368a394848c3b8881b2f96807405d8c6b5b6" default))) + '(elnode-send-file-program "/run/current-system/sw/bin/cat") + '(frame-brackground-mode (quote dark)) + '(global-auto-complete-mode t) + '(intero-debug nil) + '(intero-global-mode t nil (intero)) + '(intero-package-version "0.1.31") + '(kubernetes-commands-display-buffer-function (quote display-buffer)) + '(magit-log-show-gpg-status t) + '(ns-alternate-modifier (quote none)) + '(ns-command-modifier (quote control)) + '(ns-right-command-modifier (quote meta)) + '(require-final-newline (quote visit-save))) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(default ((t (:foreground "#e4e4ef" :background "#181818")))) + '(rainbow-delimiters-depth-1-face ((t (:foreground "#2aa198")))) + '(rainbow-delimiters-depth-2-face ((t (:foreground "#b58900")))) + '(rainbow-delimiters-depth-3-face ((t (:foreground "#268bd2")))) + '(rainbow-delimiters-depth-4-face ((t (:foreground "#dc322f")))) + '(rainbow-delimiters-depth-5-face ((t (:foreground "#859900")))) + '(rainbow-delimiters-depth-6-face ((t (:foreground "#268bd2")))) + '(rainbow-delimiters-depth-7-face ((t (:foreground "#cb4b16")))) + '(rainbow-delimiters-depth-8-face ((t (:foreground "#d33682")))) + '(rainbow-delimiters-depth-9-face ((t (:foreground "#839496")))) + '(term-color-black ((t (:background "#282828" :foreground "#282828")))) + '(term-color-blue ((t (:background "#96a6c8" :foreground "#96a6c8")))) + '(term-color-cyan ((t (:background "#1fad83" :foreground "#1fad83")))) + '(term-color-green ((t (:background "#73c936" :foreground "#73c936")))) + '(term-color-magenta ((t (:background "#9e95c7" :foreground "#9e95c7")))) + '(term-color-red ((t (:background "#f43841" :foreground "#f43841")))) + '(term-color-white ((t (:background "#f5f5f5" :foreground "#f5f5f5")))) + '(term-color-yellow ((t (:background "#ffdd33" :foreground "#ffdd33"))))) diff --git a/tools/emacs/init/eshell-setup.el b/tools/emacs/init/eshell-setup.el new file mode 100644 index 0000000000..0b23c5a2d1 --- /dev/null +++ b/tools/emacs/init/eshell-setup.el @@ -0,0 +1,68 @@ +;; EShell configuration + +(require 'eshell) + +;; Generic settings +;; Hide banner message ... +(setq eshell-banner-message "") + +;; Prompt configuration +(defun clean-pwd (path) + "Turns a path of the form /foo/bar/baz into /f/b/baz + (inspired by fish shell)" + (let* ((hpath (replace-regexp-in-string home-dir + "~" + path)) + (current-dir (split-string hpath "/")) + (cdir (last current-dir)) + (head (butlast current-dir))) + (concat (mapconcat (lambda (s) + (if (string= "" s) nil + (substring s 0 1))) + head + "/") + (if head "/" nil) + (car cdir)))) + +(defun vcprompt (&optional args) + "Call the external vcprompt command with optional arguments. + VCPrompt" + (replace-regexp-in-string + "\n" "" + (shell-command-to-string (concat "vcprompt" args)))) + +(defmacro with-face (str &rest properties) + `(propertize ,str 'face (list ,@properties))) + +(defun prompt-f () + "EShell prompt displaying VC info and such" + (concat + (with-face (concat (clean-pwd (eshell/pwd)) " ") :foreground "#96a6c8") + (if (= 0 (user-uid)) + (with-face "#" :foreground "#f43841") + (with-face "$" :foreground "#73c936")) + (with-face " " :foreground "#95a99f"))) + + +(setq eshell-prompt-function 'prompt-f) +(setq eshell-highlight-prompt nil) +(setq eshell-prompt-regexp "^.+? \\((\\(git\\|svn\\|hg\\|darcs\\|cvs\\|bzr\\):.+?) \\)?[$#] ") + +;; Ignore version control folders in autocompletion +(setq eshell-cmpl-cycle-completions nil + eshell-save-history-on-exit t + eshell-cmpl-dir-ignore "\\`\\(\\.\\.?\\|CVS\\|\\.svn\\|\\.git\\)/\\'") + +;; Load some EShell extensions +(eval-after-load 'esh-opt + '(progn + (require 'em-term) + (require 'em-cmpl) + ;; More visual commands! + (add-to-list 'eshell-visual-commands "ssh") + (add-to-list 'eshell-visual-commands "tail") + (add-to-list 'eshell-visual-commands "sl"))) + +(setq eshell-directory-name "~/.config/eshell/") + +(provide 'eshell-setup) diff --git a/tools/emacs/init/functions.el b/tools/emacs/init/functions.el new file mode 100644 index 0000000000..8b96a0e737 --- /dev/null +++ b/tools/emacs/init/functions.el @@ -0,0 +1,266 @@ +(require 's) +;; A few handy functions I use in init.el (or not, but they're nice to +;; have) + +(defun custom-download-theme (url filename) + "Downloads a theme through HTTP and places it in ~/.emacs.d/themes" + + ;; Ensure the directory exists + (unless (file-exists-p "~/.emacs.d/themes") + (make-directory "~/.emacs.d/themes")) + + ;; Adds the themes folder to the theme load path (if not already + ;; there) + (unless (member "~/.emacs.d/themes" custom-theme-load-path) + (add-to-list 'custom-theme-load-path "~/.emacs.d/themes")) + + ;; Download file if it doesn't exist. + + (let ((file + (concat "~/.emacs.d/themes/" filename))) + (unless (file-exists-p file) + (url-copy-file url file)))) + +(defun custom-download-script (url filename) + "Downloads an Elisp script, places it in ~/.emacs/other and then loads it" + + ;; Ensure the directory exists + (unless (file-exists-p "~/.emacs.d/other") + (make-directory "~/.emacs.d/other")) + + ;; Download file if it doesn't exist. + (let ((file + (concat "~/.emacs.d/other/" filename))) + (unless (file-exists-p file) + (url-copy-file url file)) + + (load file))) + +(defun keychain-password (account &optional keychain) + "Returns the password for the account, by default it's looked up in the Login.keychain but a + different keychain can be specified." + (let ((k (if keychain keychain "Login.keychain"))) + (replace-regexp-in-string + "\n" "" + (shell-command-to-string (concat "security find-generic-password -w -a " + account + " " + k))))) + +;; This clones a git repository to 'foldername in .emacs.d +;; if there isn't already a folder with that name +(defun custom-clone-git (url foldername) + "Clones a git repository to .emacs.d/foldername" + (let ((fullpath (concat "~/.emacs.d/" foldername))) + (unless (file-exists-p fullpath) + (async-shell-command (concat "git clone " url " " fullpath))))) + +(defun load-file-if-exists (filename) + (if (file-exists-p filename) + (load filename))) + +(defun goto-line-with-feedback () + "Show line numbers temporarily, while prompting for the line number input" + (interactive) + (unwind-protect + (progn + (setq-local display-line-numbers t) + (let ((target (read-number "Goto line: "))) + (avy-push-mark) + (goto-line target))) + (setq-local display-line-numbers nil))) + + +(defun untabify-buffer () + (interactive) + (untabify (point-min) (point-max))) + +(defun indent-buffer () + (interactive) + (indent-region (point-min) (point-max))) + +(defun cleanup-buffer () + "Perform a bunch of operations on the whitespace content of a buffer. +Including indent-buffer, which should not be called automatically on save." + (interactive) + (untabify-buffer) + (delete-trailing-whitespace) + (indent-buffer)) + +;; These come from the emacs starter kit + +(defun esk-add-watchwords () + (font-lock-add-keywords + nil '(("\\<\\(FIX\\(ME\\)?\\|TODO\\|DEBUG\\|HACK\\|REFACTOR\\|NOCOMMIT\\)" + 1 font-lock-warning-face t)))) + +(defun esk-sudo-edit (&optional arg) + (interactive "p") + (if (or arg (not buffer-file-name)) + (find-file (concat "/sudo:root@localhost:" (read-file-name "File: "))) + (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))) + +;; Open Fefes blog +(defun fefes-blog () + (interactive) + (eww "https://blog.fefe.de/")) + +;; Open this machines NixOS config +(defun nix-config () + (interactive) + (find-file "/etc/nixos/configuration.nix")) + +;; Open the NixOS man page +(defun nixos-man () + (interactive) + (man "configuration.nix")) + +;; Open local emacs configuration +(defun emacs-config () + (interactive) + (dired "~/.emacs.d/")) + +;; Get the nix store path for a given derivation. +;; If the derivation has not been built before, this will trigger a build. +(defun nix-store-path (derivation) + (let ((expr (concat "with import {}; " derivation))) + (s-chomp (shell-command-to-string (concat "nix-build -E '" expr "'"))))) + +(defun insert-nix-store-path () + (interactive) + (let ((derivation (read-string "Derivation name (in ): "))) + (insert (nix-store-path derivation)))) + +(defun toggle-force-newline () + "Buffer-local toggle for enforcing final newline on save." + (interactive) + (setq-local require-final-newline (not require-final-newline)) + (message "require-final-newline in buffer %s is now %s" + (buffer-name) + require-final-newline)) + +;; Helm includes a command to run external applications, which does +;; not seem to exist in ivy. This implementation uses some of the +;; logic from Helm to provide similar functionality using ivy. +(defun list-external-commands () + "Creates a list of all external commands available on $PATH + while filtering NixOS wrappers." + (cl-loop + for dir in (split-string (getenv "PATH") path-separator) + when (and (file-exists-p dir) (file-accessible-directory-p dir)) + for lsdir = (cl-loop for i in (directory-files dir t) + for bn = (file-name-nondirectory i) + when (and (not (s-contains? "-wrapped" i)) + (not (member bn completions)) + (not (file-directory-p i)) + (file-executable-p i)) + collect bn) + append lsdir into completions + finally return (sort completions 'string-lessp))) + +(defun run-external-command (cmd) + "Execute the specified command and notify the user when it + finishes." + (message "Starting %s..." cmd) + (set-process-sentinel + (start-process-shell-command cmd nil cmd) + (lambda (process event) + (when (string= event "finished\n") + (message "%s process finished." process))))) + +(defun ivy-run-external-command () + "Prompts the user with a list of all installed applications and + lets them select one to launch." + + (interactive) + (let ((external-commands-list (list-external-commands))) + (ivy-read "Command:" external-commands-list + :require-match t + :history 'external-commands-history + :action #'run-external-command))) + +(defun ivy-password-store (&optional password-store-dir) + "Custom version of password-store integration with ivy that + actually uses the GPG agent correctly." + + (interactive) + (ivy-read "Copy password of entry: " + (password-store-list (or password-store-dir (password-store-dir))) + :require-match t + :keymap ivy-pass-map + :action (lambda (entry) + (let ((password (auth-source-pass-get 'secret entry))) + (password-store-clear) + (kill-new password) + (setq password-store-kill-ring-pointer kill-ring-yank-pointer) + (message "Copied %s to the kill ring. Will clear in %s seconds." + entry (password-store-timeout)) + (setq password-store-timeout-timer + (run-at-time (password-store-timeout) + nil 'password-store-clear)))))) + +(defun ivy-browse-repositories () + "Select a git repository and open its associated magit buffer." + + (interactive) + (ivy-read "Repository: " + (magit-list-repos) + :require-match t + :sort t + :action #'magit-status)) + +(defun warmup-gpg-agent (arg &optional exit) + "Function used to warm up the GPG agent before use. This is + useful in cases where there is no easy way to make pinentry run + in the correct context (such as when sending email)." + (interactive) + (message "Warming up GPG agent") + (epg-sign-string (epg-make-context) "dummy") + nil) + +(defun bottom-right-window-p () + "Determines whether the last (i.e. bottom-right) window of the + active frame is showing the buffer in which this function is + executed." + (let* ((frame (selected-frame)) + (right-windows (window-at-side-list frame 'right)) + (bottom-windows (window-at-side-list frame 'bottom)) + (last-window (car (seq-intersection right-windows bottom-windows)))) + (eq (current-buffer) (window-buffer last-window)))) + +(defun inferior-erlang-nix-shell () + "Start an inferior Erlang process from the root of the current + project." + (interactive) + (inferior-erlang + (format "nix-shell --command erl %s" (cdr (project-current))))) + +(defun intero-fix-ghci-panic () + "Disable deferring of out of scope variable errors, which + triggers a bug in the interactive Emacs REPL printing a panic + under certain conditions." + + (interactive) + (let* ((root (intero-project-root)) + (package-name (intero-package-name)) + (backend-buffer (intero-buffer 'backend)) + (name (format "*intero:%s:%s:repl*" + (file-name-nondirectory root) + package-name)) + (setting ":set -fno-defer-out-of-scope-variables\n")) + (when (get-buffer name) + (with-current-buffer (get-buffer name) + (goto-char (point-max)) + (let ((process (get-buffer-process (current-buffer)))) + (when process (process-send-string process setting))))))) + +;; Brute-force fix: Ensure the setting is injected every time the REPL +;; is selected. +;; +;; Upstream issue: https://github.com/commercialhaskell/intero/issues/569 +(advice-add 'intero-repl :after (lambda (&rest r) (intero-fix-ghci-panic)) + '((name . intero-panic-fix))) +(advice-add 'intero-repl-load :after (lambda (&rest r) (intero-fix-ghci-panic)) + '((name . intero-panic-fix))) + +(provide 'functions) diff --git a/tools/emacs/init/look-and-feel.el b/tools/emacs/init/look-and-feel.el new file mode 100644 index 0000000000..3d480bd5f4 --- /dev/null +++ b/tools/emacs/init/look-and-feel.el @@ -0,0 +1,115 @@ +;;; -*- lexical-binding: t; -*- + +;; Hide those ugly tool bars: +(tool-bar-mode 0) +(scroll-bar-mode 0) +(menu-bar-mode 0) +(add-hook 'after-make-frame-functions + (lambda (frame) (scroll-bar-mode 0))) + +;; Don't do any annoying things: +(setq ring-bell-function 'ignore) +(setq initial-scratch-message "") + +;; Remember layout changes +(winner-mode 1) + +;; Usually emacs will run as a proper GUI application, in which case a few +;; extra settings are nice-to-have: +(when window-system + (setq frame-title-format '(buffer-file-name "%f" ("%b"))) + (mouse-wheel-mode t) + (blink-cursor-mode -1)) + +;; Configure editor fonts +(let ((font (format "Input Mono-%d" 12))) + (setq default-frame-alist `((font-backend . "xft") + (font . ,font))) + (set-frame-font font t t)) + +;; Display battery in mode-line's misc section on adho: +(when (equal "adho" (system-name)) + (setq battery-mode-line-format " %b%p%%") + (display-battery-mode)) + +;; Configure telephone-line +(defun telephone-misc-if-last-window () + "Renders the mode-line-misc-info string for display in the + mode-line if the currently active window is the last one in the + frame. + + The idea is to not display information like the current time, + load, battery levels in all buffers." + + (when (bottom-right-window-p) + (telephone-line-raw mode-line-misc-info t))) + +(defun telephone-line-setup () + (telephone-line-defsegment telephone-line-last-window-segment () + (telephone-misc-if-last-window)) + + ;; Display the current EXWM workspace index in the mode-line + (telephone-line-defsegment telephone-line-exwm-workspace-index () + (when (bottom-right-window-p) + (format "[%s]" exwm-workspace-current-index))) + + ;; Define a highlight font for ~ important ~ information in the last + ;; window. + (defface special-highlight '((t (:foreground "white" :background "#5f627f"))) "") + (add-to-list 'telephone-line-faces + '(highlight . (special-highlight . special-highlight))) + + (setq telephone-line-lhs + '((nil . (telephone-line-position-segment)) + (accent . (telephone-line-buffer-segment)))) + + (setq telephone-line-rhs + '((accent . (telephone-line-major-mode-segment)) + (nil . (telephone-line-last-window-segment + telephone-line-exwm-workspace-index)) + (highlight . (telephone-line-notmuch-counts)))) + + (setq telephone-line-primary-left-separator 'telephone-line-tan-left + telephone-line-primary-right-separator 'telephone-line-tan-right + telephone-line-secondary-left-separator 'telephone-line-tan-hollow-left + telephone-line-secondary-right-separator 'telephone-line-tan-hollow-right) + + (telephone-line-mode 1)) + +;; Auto refresh buffers +(global-auto-revert-mode 1) + +;; Use clipboard properly +(setq select-enable-clipboard t) + +;; Show in-progress chords in minibuffer +(setq echo-keystrokes 0.1) + +;; Show column numbers in all buffers +(column-number-mode t) + +;; Highlight currently active line +(global-hl-line-mode t) + +(defalias 'yes-or-no-p 'y-or-n-p) +(defalias 'auto-tail-revert-mode 'tail-mode) + +;; Style line numbers (shown with M-g g) +(setq linum-format + (lambda (line) + (propertize + (format (concat " %" + (number-to-string + (length (number-to-string + (line-number-at-pos (point-max))))) + "d ") + line) + 'face 'linum))) + +;; Display tabs as 2 spaces +(setq tab-width 2) + +;; Don't wrap around when moving between buffers +(setq windmove-wrap-around nil) + +(provide 'look-and-feel) diff --git a/tools/emacs/init/mail-setup.el b/tools/emacs/init/mail-setup.el new file mode 100644 index 0000000000..1700ccddd3 --- /dev/null +++ b/tools/emacs/init/mail-setup.el @@ -0,0 +1,98 @@ +(require 'notmuch) +(require 'counsel-notmuch) + +(global-set-key (kbd "C-c m") 'notmuch-hello) +(global-set-key (kbd "C-c C-m") 'counsel-notmuch) +(global-set-key (kbd "C-c C-e n") 'notmuch-mua-new-mail) + +(setq notmuch-cache-dir (format "%s/.cache/notmuch" (getenv "HOME"))) +(make-directory notmuch-cache-dir t) + +;; Cache addresses for completion: +(setq notmuch-address-save-filename (concat notmuch-cache-dir "/addresses")) + +;; Don't spam my home folder with drafts: +(setq notmuch-draft-folder "drafts") ;; relative to notmuch database + +;; Mark things as read when archiving them: +(setq notmuch-archive-tags '("-inbox" "-unread" "+archive")) + +;; Show me saved searches that I care about: +(setq notmuch-saved-searches + '((:name "inbox" :query "tag:inbox" :count-query "tag:inbox AND tag:unread" :key "i") + (:name "aprila-dev" :query "tag:aprila-dev" :count-query "tag:aprila-dev AND tag:unread" :key "d") + (:name "gitlab" :query "tag:gitlab" :key "g") + (:name "sent" :query "tag:sent" :key "t") + (:name "drafts" :query "tag:draft"))) +(setq notmuch-show-empty-saved-searches t) + +;; Mail sending configuration +(setq send-mail-function 'sendmail-send-it) ;; sendmail provided by MSMTP +(setq notmuch-always-prompt-for-sender t) +(setq notmuch-mua-user-agent-function + (lambda () (format "Emacs %s; notmuch.el %s" emacs-version notmuch-emacs-version))) +(setq mail-host-address (system-name)) +(setq notmuch-mua-cite-function #'message-cite-original-without-signature) + +;; Close mail buffers after sending mail +(setq message-kill-buffer-on-exit t) + +;; Ensure sender is correctly passed to msmtp +(setq mail-specify-envelope-from t + message-sendmail-envelope-from 'header + mail-envelope-from 'header) + +;; Store sent mail in the correct folder per account +(setq notmuch-maildir-use-notmuch-insert nil) +(setq notmuch-fcc-dirs '(("mail@tazj.in" . "tazjin/Sent") + ;; Not a mistake, Office365 apparently + ;; renames IMAP folders (!) to your local + ;; language instead of providing translations + ;; in the UI m( + ("vincent@aprila.no" . "aprila/Sende element"))) + +;; I don't use drafts but I instinctively hit C-x C-s constantly, lets +;; handle that gracefully. +(define-key notmuch-message-mode-map (kbd "C-x C-s") #'ignore) + +;; MSMTP decrypts passwords using pass, but pinentry doesn't work +;; correctly in that setup. This forces a warmup of the GPG agent +;; before sending the message. +;; +;; Note that the sending function is advised because the provided hook +;; for this seems to run at the wrong time. +(advice-add 'notmuch-mua-send-common :before 'warmup-gpg-agent) + +;; Define a telephone-line segment for displaying the count of unread, +;; important mails in the last window's mode-line: +(defvar *last-notmuch-count-redraw* 0) +(defvar *current-notmuch-count* nil) + +(defun update-display-notmuch-counts () + "Update and render the current state of the notmuch unread + count for display in the mode-line. + + The offlineimap-timer runs every 2 minutes, so it does not make + sense to refresh this much more often than that." + + (when (> (- (float-time) *last-notmuch-count-redraw*) 30) + (setq *last-notmuch-count-redraw* (float-time)) + (let* ((inbox-unread (notmuch-saved-search-count "tag:inbox and tag:unread")) + (devel-unread (notmuch-saved-search-count "tag:aprila-dev and tag:unread")) + (notmuch-count (format "I: %s; D: %s" inbox-unread devel-unread))) + (setq *current-notmuch-count* notmuch-count))) + + (when (and (bottom-right-window-p) + ;; Only render if the initial update is done and there + ;; are unread mails: + *current-notmuch-count* + (not (equal *current-notmuch-count* "I: 0; D: 0"))) + *current-notmuch-count*)) + +(telephone-line-defsegment telephone-line-notmuch-counts () + "This segment displays the count of unread notmuch messages in + the last window's mode-line (if unread messages are present)." + + (update-display-notmuch-counts)) + +(provide 'mail-setup) diff --git a/tools/emacs/init/modes.el b/tools/emacs/init/modes.el new file mode 100644 index 0000000000..19ed2a6843 --- /dev/null +++ b/tools/emacs/init/modes.el @@ -0,0 +1,36 @@ +;; Initializes modes I use. + +(add-hook 'prog-mode-hook 'esk-add-watchwords) + +;; Use auto-complete as completion at point +(defun set-auto-complete-as-completion-at-point-function () + (setq completion-at-point-functions '(auto-complete))) + +(add-hook 'auto-complete-mode-hook + 'set-auto-complete-as-completion-at-point-function) + +;; Enable rainbow-delimiters for all things programming +(add-hook 'prog-mode-hook 'rainbow-delimiters-mode) + +;; Enable Paredit & Company in Emacs Lisp mode +(add-hook 'emacs-lisp-mode-hook 'company-mode) + +;; Always highlight matching brackets +(show-paren-mode 1) + +;; Always auto-close parantheses and other pairs +;; (replaced by smartparens) +;; (electric-pair-mode) + +;; Keep track of recent files +(recentf-mode) + +;; Easily navigate sillycased words +(global-subword-mode 1) + +;; Transparently open compressed files +(auto-compression-mode t) + +;; Show available key chord completions + +(provide 'modes) diff --git a/tools/emacs/init/nixos.el b/tools/emacs/init/nixos.el new file mode 100644 index 0000000000..e384e9b77d --- /dev/null +++ b/tools/emacs/init/nixos.el @@ -0,0 +1,103 @@ +;; Configure additional settings if this is one of my NixOS machines +;; (i.e. if ExWM is required) +;; -*- lexical-binding: t; -*- + +(require 's) +(require 'f) +(require 'dash) + +(defun pulseaudio-ctl (cmd) + (shell-command (concat "pulseaudio-ctl " cmd)) + (message "Volume command: %s" cmd)) + +(defun volume-mute () (interactive) (pulseaudio-ctl "mute")) +(defun volume-up () (interactive) (pulseaudio-ctl "up")) +(defun volume-down () (interactive) (pulseaudio-ctl "down")) + +(defun brightness-up () + (interactive) + (shell-command "exec light -A 10") + (message "Brightness increased")) + +(defun brightness-down () + (interactive) + (shell-command "exec light -U 10") + (message "Brightness decreased")) + +(defun lock-screen () + (interactive) + (shell-command "screen-lock")) + +(defun generate-randr-config () + (-flatten `(,(-map (lambda (n) (list n "DP2")) (number-sequence 1 7)) + (0 "eDP1") + ,(-map (lambda (n) (list n "eDP1")) (number-sequence 8 9))))) + +(use-package exwm + :hook ((exwm-update-class . (lambda () + ;; Make class name the buffer name + (exwm-workspace-rename-buffer exwm-class-name)))) + :init + (progn + (require 'exwm-config) + + (fringe-mode 3) + + (setq exwm-workspace-number 10) + + ;; 's-r': Reset + (exwm-input-set-key (kbd "s-r") #'exwm-reset) + ;; 's-w': Switch workspace + (exwm-input-set-key (kbd "s-w") #'exwm-workspace-switch) + ;; 's-N': Switch to certain workspace + (dotimes (i 10) + (exwm-input-set-key (kbd (format "s-%d" i)) + `(lambda () + (interactive) + (exwm-workspace-switch-create ,i)))) + + ;; Launch applications with completion (dmenu style!) + (exwm-input-set-key (kbd "s-d") #'ivy-run-external-command) + (exwm-input-set-key (kbd "s-p") #'ivy-password-store) + (exwm-input-set-key (kbd "C-s-p") '(lambda () + (interactive) + (ivy-password-store "~/.aprila-secrets"))) + + ;; Add Alacritty selector to a key + (exwm-input-set-key (kbd "C-x t") #'counsel-switch-to-alacritty) + + ;; Toggle between line-mode / char-mode + (exwm-input-set-key (kbd "C-c C-t C-t") #'exwm-input-toggle-keyboard) + + ;; Volume keys + (exwm-input-set-key (kbd "") #'volume-mute) + (exwm-input-set-key (kbd "") #'volume-up) + (exwm-input-set-key (kbd "") #'volume-down) + + ;; Brightness keys + (exwm-input-set-key (kbd "") #'brightness-down) + (exwm-input-set-key (kbd "") #'brightness-up) + (exwm-input-set-key (kbd "") #'lock-screen) + + ;; Line-editing shortcuts + (exwm-input-set-simulation-keys + '(([?\C-d] . delete) + ([?\C-w] . ?\C-c))) + + ;; Enable EXWM + (exwm-enable) + + ;; Show time in the mode line + (display-time-mode) + + ;; Configure xrandr when running on laptop + (when (equal (shell-command-to-string "hostname") "adho\n") + (require 'exwm-randr) + (setq exwm-randr-workspace-output-plist (generate-randr-config)) + (exwm-randr-enable)) + + ;; Let buffers move seamlessly between workspaces + (setq exwm-workspace-show-all-buffers t) + (setq exwm-layout-show-all-buffers t))) + +(provide 'nixos) diff --git a/tools/emacs/init/settings.el b/tools/emacs/init/settings.el new file mode 100644 index 0000000000..2e4dedc0a5 --- /dev/null +++ b/tools/emacs/init/settings.el @@ -0,0 +1,65 @@ +(require 'prescient) +(require 'ivy-prescient) +(require 'uniquify) +(require 'ivy-pass) + +;; Make ivy go! +(ivy-mode 1) +(counsel-mode 1) + +(setq ivy-use-virtual-buffers t) +(setq enable-recursive-minibuffers t) + +;; Enable support for prescient in ivy & configure it +(ivy-prescient-mode) +(prescient-persist-mode) +(add-to-list 'ivy-prescient-excluded-commands 'counsel-rg) + +;; Move files to trash when deleting +(setq delete-by-moving-to-trash t) + +;; We don't live in the 80s, but we're also not a shitty web app. +(setq gc-cons-threshold 20000000) + +(setq uniquify-buffer-name-style 'forward) + +; Fix some defaults +(setq visible-bell nil + inhibit-startup-message t + color-theme-is-global t + sentence-end-double-space nil + shift-select-mode nil + uniquify-buffer-name-style 'forward + whitespace-style '(face trailing lines-tail tabs) + whitespace-line-column 80 + default-directory "~" + fill-column 80 + ediff-split-window-function 'split-window-horizontally) + +(add-to-list 'safe-local-variable-values '(lexical-binding . t)) +(add-to-list 'safe-local-variable-values '(whitespace-line-column . 80)) + +(set-default 'indent-tabs-mode nil) + +;; UTF-8 please +(setq locale-coding-system 'utf-8) ; pretty +(set-terminal-coding-system 'utf-8) ; pretty +(set-keyboard-coding-system 'utf-8) ; pretty +(set-selection-coding-system 'utf-8) ; please +(prefer-coding-system 'utf-8) ; with sugar on top + +;; Make emacs behave sanely (overwrite selected text) +(delete-selection-mode 1) + +;; Keep your temporary files in tmp, emacs! +(setq auto-save-file-name-transforms + `((".*" ,temporary-file-directory t))) +(setq backup-directory-alist + `((".*" . ,temporary-file-directory))) + +(remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function) + +;; Show time in 24h format +(setq display-time-24hr-format t) + +(provide 'settings) diff --git a/tools/emacs/init/term-setup.el b/tools/emacs/init/term-setup.el new file mode 100644 index 0000000000..a2a71be9ee --- /dev/null +++ b/tools/emacs/init/term-setup.el @@ -0,0 +1,37 @@ +;; Utilities for Alacritty buffers. + +(defun open-or-create-alacritty-buffer (buffer-name) + "Switch to the buffer with BUFFER-NAME or create a + new buffer running Alacritty." + (let ((buffer (get-buffer buffer-name))) + (if (not buffer) + (run-external-command "alacritty") + (switch-to-buffer buffer)))) + +(defun is-alacritty-buffer (buffer) + "Determine whether BUFFER runs Alacritty." + (and (equal 'exwm-mode (buffer-local-value 'major-mode buffer)) + (s-starts-with? "Alacritty" (buffer-name buffer)))) + +(defun counsel-switch-to-alacritty () + "Switch to a (multi-)term buffer or create one." + (interactive) + (let ((terms (-map #'buffer-name + (-filter #'is-alacritty-buffer (buffer-list))))) + (if terms + (ivy-read "Switch to Alacritty buffer: " + (cons "New terminal" terms) + :caller 'counsel-switch-to-alacritty + :require-match t + :action #'open-or-create-alacritty-buffer) + (run-external-command "alacritty")))) + +(defun alacritty-rename () + "Rename the current terminal buffer." + (interactive) + (let* ((buffer (get-buffer (buffer-name)))) + (if (is-alacritty-buffer buffer) + (rename-buffer (format "Alacritty<%s>" (read-string "New terminal name: "))) + (error "This function is only intended to rename Alacritty buffers.")))) + +(provide 'term-setup) -- cgit 1.4.1