Skip to content

Instantly share code, notes, and snippets.

@paudirac
Last active August 7, 2021 07:23
Show Gist options
  • Save paudirac/6924b16c340ed8aae3eab0a4912b9cb1 to your computer and use it in GitHub Desktop.
Save paudirac/6924b16c340ed8aae3eab0a4912b9cb1 to your computer and use it in GitHub Desktop.
Select from multiples emacs.d
#!/bin/bash
function show_options {
readlink $(find $HOME -maxdepth 1 -type l -iname '.*emacs.d') \
| awk 'sub(/\.d\//,"",$0) { print "Current emacs is \t\t" substr($0,2) }'
echo
echo "Call with following options to change:"
find $HOME/emacs -maxdepth 1 -mindepth 1 -type d -printf "\t%f\n"
}
function switch_emacs {
rm -rf .emacs.d # if exists
ln -s $HOME/emacs/$1 .emacs.d
echo "Emacs set to $1"
}
cd $HOME
if [ -z "$1" ]
then
show_options
else
switch_emacs $1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment