From fb5b1be345bf463f90aaa0b14f92ec9c5868523f Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 17 May 2013 21:29:44 -0400 Subject: [PATCH] Refactor Emacs module --- modules/emacs/init.zsh | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/modules/emacs/init.zsh b/modules/emacs/init.zsh index ff78800..cce9e1e 100644 --- a/modules/emacs/init.zsh +++ b/modules/emacs/init.zsh @@ -4,17 +4,22 @@ # Authors: Sebastian Wiesner # -# Enable Carton -if [[ -d "$HOME/.carton" ]]; then - path=($HOME/.carton/bin $path) - - alias cai='carton install' - alias cau='carton update' - alias caI='carton init' - alias cae='carton exec' - - local completion="$HOME/.carton/etc/carton_completion.zsh" - if [[ -e "${completion}" ]]; then - source "${completion}" - fi +# Return if requirements are not found. +if [[ ! -d "$HOME/.carton" ]]; then + return 1 fi + +# Prepend Carton bin directory. +path=($HOME/.carton/bin $path) + +# Load Carton completion +source "$HOME/.carton/etc/carton_completion.zsh" 2> /dev/null + +# +# Aliases +# + +alias cai='carton install' +alias cau='carton update' +alias caI='carton init' +alias cae='carton exec'