/doom-config

My configuration for doom emacs

Primary LanguageEmacs Lisp

My Doom Emacs Configuration

Doom Emacs is a great configuration framework I ended up settling on after writing emacs configs myself and trying out other frameworks like Spacemacs and co.

To re-generate all configuration and installation files, run the org-tangle command:

(org-babel-tangle)

Installation

Let’s tangle an install.sh script to get everything set up for us.

#> set up some directory variables
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "installing doom configuration from ${SCRIPT_DIR} ..."

<<check_emacs>>

<<backup_emacs>>

<<install_doom>>

<<config_doom>>

Check for emacs

if ! command -v emacs &> /dev/null; then
    echo "could not find an installation of emacs!"
    exit 1
else
    #> should check version?
    :
fi

Backup any existing emacs configuration

if [[ -d "$HOME/.emacs.d" ]]; then
    if ! [[ -f $HOME/.emacs.d/bin/doom ]]; then
        #> not a doom installation => backup
        echo "backing up ~/.emacs.d to ~/.emacs.d.bak ..."
        mv $HOME/.emacs.d $HOME/.emacs.d.bak
    fi
fi

Install Doom emacs

if ! [[ -f "$HOME/.emacs.d/bin/doom" ]]; then
    git clone https://github.com/hlissner/doom-emacs ~/.emacs.d
    ~/.emacs.d/bin/doom install
    if [[ -d "$HOME/bin" ]]; then
        ln -s $HOME/.emacs.d/bin/doom $HOME/bin/doom
    else
        echo "no $HOME/bin folder: did not create a symbolic link to 'doom'"
    fi
fi

Set up doom configuration

if [[ -d "$HOME/.doom.d" ]]; then
    echo "found existing doom confiuration at '$HOME/.doom.d'"
    read -r -p "backup & proceed? [y/N] " response
    case "$response" in
        [yY][eE][sS]|[yY])
            mv $HOME/.doom.d $HOME/.doom.d.bak
            # rm -rf $HOME/.doom.d
            ;;
        *)
            exit 0
            ;;
    esac
fi

mkdir $HOME/.doom.d
for cfg in config.el custom.el init.el packages.el; do
    cp ${SCRIPT_DIR}/${cfg} $HOME/.doom.d/${cfg}
done

Configuration

There is also a literate configuration option within doom emacs, which could be worth exploring in the future.

init

every source block here should be exported to the a test_init.el file. Untimately will want to move to tangle all config files from this one.
(setq user-full-name "Alexander Huss"
      user-mail-address "alexander.huss@cern.ch")
;; defaults proposed in the manual [https://orgmode.org/manual/Activation.html]
(global-set-key (kbd "C-c l") #'org-store-link)
(global-set-key (kbd "C-c a") #'org-agenda)
(global-set-key (kbd "C-c c") #'org-capture)

packages