Created
March 24, 2013 05:13
-
-
Save pgmot/5230651 to your computer and use it in GitHub Desktop.
init-loaderでelをオンオフするやつ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function el-on { | |
for SCRIPT in $@ | |
do | |
if [ ! -e ~/.emacs.d/inits-available/$SCRIPT.el ]; then | |
echo "$SCRIPT.el is not found"; | |
else | |
rm -rf ~/.emacs.d/inits-enable/$SCRIPT.el ~/.emacs.d/inits-enable/$SCRIPT.elc | |
ln -s ~/.emacs.d/inits-available/$SCRIPT.el ~/.emacs.d/inits-enable/$SCRIPT.el | |
fi | |
done | |
} | |
function el-off { | |
for SCRIPT in $@ | |
do | |
if [ ! -e ~/.emacs.d/inits-enable/$SCRIPT.el ]; then | |
echo "$SCRIPT.el is not found"; | |
else | |
rm -rf ~/.emacs.d/inits-enable/$SCRIPT.el ~/.emacs.d/inits-enable/$SCRIPT.elc | |
fi | |
done | |
} | |
function _el-on { | |
local -a scripts | |
scripts=( $( find ~/.emacs.d/inits-available/ -name '*.el' | sed -e 's/\.[^.]*$//g' | sed -e 's/.*\///' ) ) | |
compadd $scripts | |
return 1; | |
} | |
function _el-off { | |
local -a scripts | |
scripts=( $( find ~/.emacs.d/inits-enable/ -name '*.el' | sed -e 's/\.[^.]*$//g' | sed -e 's/.*\///' ) ) | |
compadd $scripts | |
return 1; | |
} | |
compdef _el-on el-on | |
compdef _el-off el-off |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment