;; Added by Package.el.  This must come before configurations of
;; installed packages.  Don't delete this line.  If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.

(require 'package)
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/"))
(when (< emacs-major-version 24)
  ;; For important compatibility libraries like cl-lib
  (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line


;; Add my custom lisp scripts dir
(add-to-list 'load-path "~/.emacs.d/lisp")


(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 "black" :foreground "white" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 105 :width normal :foundry "unknown" :family "Terminus"))))
 '(font-lock-comment-delimiter-face ((t (:inherit font-lock-comment-face :foreground "dim gray"))))
 '(font-lock-comment-face ((t (:foreground "gray"))))
 '(font-lock-constant-face ((t (:foreground "cyan"))))
 '(font-lock-function-name-face ((t (:foreground "green"))))
 '(font-lock-keyword-face ((t (:foreground "cyan" :family "terminus bold"))))
 '(font-lock-negation-char-face ((t (:inherit font-lock-keyword-face))))
 '(font-lock-string-face ((t (:foreground "magenta"))))
 '(font-lock-type-face ((t (:foreground "green yellow"))))
 '(font-lock-variable-name-face ((t (:foreground "gold")))))




;; enable line numbers
(global-linum-mode 1)
(column-number-mode 1)
(display-time-mode 1)


(set-fill-column 80) ;;set margin to 80 for fci-mode

;; Delete selection mode (delete marked region on key press)
(delete-selection-mode 1)

(show-paren-mode 1)

(setq ring-bell-function 'ignore)

(setq make-backup-files nil) ; stop creating backup~ files
(setq auto-save-default nil) ; stop creating #autosave# files
(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))
(put 'upcase-region 'disabled nil)

;; Overwrite selected text when typing
(delete-selection-mode 1)

;; AUCTex install
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq TeX-save-query nil)



;; Sun type6 keyboard specifics
;; Get the media keys to work
(global-set-key [XF86Copy] 'kill-ring-save)
(global-set-key [XF86Paste] 'yank)
(global-set-key [XF86Cut] 'kill-region)
(global-set-key [XF86Open] 'find-file)
(global-set-key [cancel] 'keyboard-quit)
;; F12 kills current buffer
(global-set-key [f12] (lambda () (interactive) (kill-buffer (current-buffer))))
;; F9 toggle margin at 80 chars
;; (global-set-key [f9] 'fci-mode)

;; Props key brings up a terminal
(global-set-key [SunProps] (lambda () (interactive) (term '"/bin/bash")))

(defun includeguard ()
  "Create an includeguard around a file"
  (interactive)
  (setq fname
	(replace-regexp-in-string "\\." "_" (upcase (buffer-name (current-buffer)))))
  (beginning-of-buffer)
  (insert (concat "#ifndef _" fname "\n"))
  (insert (concat "#define _" fname "\n\n"))
  
  (end-of-buffer)
  (insert (concat "\n\n#endif // _" fname ))
  
  )




