Skip to content

Instantly share code, notes, and snippets.

@pgmot
Created March 24, 2013 05:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pgmot/5230651 to your computer and use it in GitHub Desktop.
Save pgmot/5230651 to your computer and use it in GitHub Desktop.
init-loaderでelをオンオフするやつ
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