Skip to content
Snippets Groups Projects
Select Git revision
  • c41b1e6271e2d47964ec608113ef38e87764fc26
  • master default protected
2 results

04-multiple-spacemacs-configs.sh

Blame
  • 04-multiple-spacemacs-configs.sh 984 B
    #!/bin/bash
    
    mefs_indent_message "Multiple spacemacs..."
    
    mefs_BEG_PATTERN="SPACEMACS MULTIPLE CONFIGURATIONS STARTS HERE"
    mefs_END_PATTERN="SPACEMACS MULTIPLE CONFIGURATIONS ENDS HERE"
    mefs_TEMPLATE1='("<conf>" . ((user-emacs-directory . "~/emacs/flavors/<conf>")'
    mefs_TEMPLATE2='(env . (("SPACEMACSDIR" . "~/emacs/configs/<conf>")))))'
    
    sed -i "/$mefs_BEG_PATTERN/,/$mefs_END/{/;;/!d}" dot.emacs-profiles.el
    
    mefs_CONFIGS=$(ls $mefs_CONFIGDIR | grep spacemacs)
    
    for conf in $mefs_CONFIGS
    do
        mefs_indent_message "Creating dir for $conf..."
        [ -d ${mefs_FLAVORDIR}/${conf} ] ||
            cp -r $mefs_FLAVORDIR/spacemacs-develop ${mefs_FLAVORDIR}/${conf}
    
        mefs_indent_message "Adding emacs profile for $conf..."
        echo ${mefs_TEMPLATE1//<conf>/$conf}
        echo ${mefs_TEMPLATE2//<conf>/$conf}
        sed -i "/$mefs_BEG_PATTERN/a ${mefs_TEMPLATE2//<conf>/$conf}" dot.emacs-profiles.el
        sed -i "/$mefs_BEG_PATTERN/a ${mefs_TEMPLATE1//<conf>/$conf}" dot.emacs-profiles.el
    done