#! /bin/bash
# Creates ~/.emacs startup configuration that properly displays "\" as backslash and not Ws.
# Written by A. Moise (avy@fdos.ca)
#

file=~/.emacs

shft() {
	for suff in {9..1} ; do
		if [[ -f "$1.${suff}" ]] ; then
			((nxt = suff + 1))
			#echo Moving "$1.${suff}" to "$1.${nxt}"
			mv -f "$1.${suff}" "$1.${nxt}"
		fi
		done
		echo Moving "$1" to "$1.1"
		mv -f "$1" "$1.1"
}

if [ -f $file ] ; then
    shft "$file"
fi
echo Creating $file
cat >"$file" << EOF
;; .emacs

;;; uncomment this line to disable loading of "default.el" at startup
;; (setq inhibit-default-init t)

;; enable visual feedback on selections
;(setq transient-mark-mode t)

;; default to better frame titles
(setq frame-title-format
      (concat  "%b - emacs@" (system-name)))

;; default to unified diffs
(setq diff-switches "-u")

;; always end a file with a newline
;(setq require-final-newline 'query)

;;; uncomment for CJK utf-8 support for non-Asian users
;; (require 'un-define)
(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(inhibit-startup-screen t))
(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(default ((t (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 143 :width normal :foundry "urw" :family "Nimbus Roman No9 L")))))
END;
EOF
