Next: Update RC Files, Previous: Ignore, Up: Build Scripts [Index]
This script allows the user to switch into using a different Emacs
initialization setup. The script first lists the currently-selected
initialization setup, then it lists the available initialization setups, then
requests the user’s choice. After obtaining the choice, it changes the
symbolic link in ‘~/.emacs.d’ to that chosen by the user. Emacs is then killed
and restarted using the desktop-save
feature.
Each initialization setup is a complete ‘~/.emacs.d’ subtree, which must be set up by the user, with its name given after a dash, such as ‘~/.emacs.d-original’ or ‘~/.emacs.d-cfbt’ (“Clojure for the Brave and True”).
printf "${GREEN}" ls -l ~/.emacs.d | cut -f 12- -d ' ' printf "${CLEAR}" echo select choice in $(ls -1d ~/.emacs.d-*) "abort" do echo -n 'You chose ' printf " ${B_YELLOW}${F_BLACK}$choice${CLEAR} " [[ $choice = "abort" ]] && exit 0 rm ~/.emacs.d printf "${CYAN}" ln -vs $choice ~/.emacs.d echo printf "${RED}" read -N 1 -p "Restart Emacs now? (y/n) " printf "${CLEAR}\n" [[ $REPLY =~ y|Y ]] || { echo "Not restarting"; break; } echo "Restarting..." emacsclient --eval '(progn (desktop-save "~/.emacs.d-original/")(kill-emacs))' break done /Applications/MacPorts/EmacsMac.app/Contents/MacOS/Emacs --eval '(progn (server-start)(desktop-read "~/.emacs.d-original/"))' &