#!/bin/sh

if [ -z "$1" ]; then
  echo "Where config file?"
  exit 1
fi

cfg=$1

if command -v ispell; then
  echo >>$cfg
  echo "(setq-default ispell-program-name \"ispell\")" >>$cfg
  if [ -e /etc/debian_version ]; then
    echo "(setq-default ispell-local-dictionary \"british\")" >>$cfg
  else
    echo "(setq-default ispell-local-dictionary \"default\")" >>$cfg
  fi
elif command -v aspell; then
  echo >>$cfg
  echo "(setq-default ispell-program-name \"aspell\")" >>$cfg
  echo "(setq-default ispell-local-dictionary \"english\")" >>$cfg
fi
