(setq frame-title-format '(buffer-file-name "Emacs: %b (%f)" "Emacs: %b")) 

(setq next-line-add-newlines		nil)

(setq
 c-mode-hook '(lambda ()
  (auto-fill-mode 1))
 c++-mode-hook '(lambda ()
    (auto-fill-mode 1))
 text-mode-hook '(lambda ()
    (auto-fill-mode 1))
 java-mode-hook '(lambda ()
     (c-set-style "gnu")))

(set-variable 'truncate-partial-width-windows nil)
(setq scroll-step 1)
(delete-selection-mode t)
(define-key global-map (read-kbd-macro "M-\\") 'hippie-expand)
(add-hook 'message-setup-hook 'mail-abbrevs-setup)
(add-hook 'write-file-hooks 'time-stamp)
(setq time-stamp-active t)
(setq time-stamp-format "%02d-%3b-%:y %02H:%02M:%02S %u")
(setq line-number-mode t)
(setq column-number-mode t)
(setq font-lock-use-default-fonts nil)
(setq font-lock-use-default-colors nil)
(require 'font-lock)
(global-font-lock-mode nil)
(show-paren-mode t)

(defun devenv()
  (interactive)
  (split-window-vertically 55)
  (find-file "changesLog")
  (split-window-horizontally)
  (other-window 2)
  (split-window-horizontally)
  (other-window 1)
  (shell)
  (other-window 1)
  (find-file "Main.cpp")
  ;on active l'auto-scrolling ohorizontal:
  (hscroll-global-mode)
  ;on lance la speedar
  (speedbar)
)


;;scanne le dossier courant a la recherche de nouveau type
(lambda()
   (interactive)
   (ctypes-dir "."))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Quit this buffer
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun quit-this-buffer ()
  "Exit current buffer by selecting some other buffer."
  (interactive)
  (switch-to-buffer (prog1 (other-buffer (current-buffer))
			   (bury-buffer (current-buffer)))))

(global-set-key "\C-cq" 'quit-this-buffer)



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; slow scrolling
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defvar slow-scroll-mode 0)

(defun toggle-slow-scroll-mode (&optional arg)
  "Toggle slow scroll mode at each call of this function.
If slow-scroll-mode is 1, the cursor stays on current line after each scroll; else not."
  (interactive "P")
  (if (= slow-scroll-mode 0)
      (setq slow-scroll-mode 1)
    (setq slow-scroll-mode 0)))

(defun scroll-up-slowly (&optional arg)
  "Scroll text of current window upward ARG lines; or one line if no ARG.
This depend of slow scroll mode (keeping cursor on current line or not).
When calling from a program, supply a number as argument or nil."
  (interactive "P")
  (progn (if arg
	     (scroll-up arg)
	   (scroll-up 1))
	 (if (= slow-scroll-mode 1)
	     (next-line 1))))

(defun do_insert_time () 
  (interactive)
 (insert-string (current-time-string)))

(defun scroll-down-slowly (&optional arg)
  "Scroll text of current window downward ARG lines; or one line if no ARG.
This depend of slow scroll mode (keeping cursor on current line or not).
When calling from a program, supply a number as argument or nil."
  (interactive "P")
  (progn (if arg
	     (scroll-down arg)
	   (scroll-down 1))
	 (if (= slow-scroll-mode 1)
	     (previous-line 1))))

(set-variable 'slow-scroll-mode 1)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; versions control
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq vc-handle-cvs nil)
(set-variable 'version-control t)
(set-variable 'kept-old-versions 5)
(set-variable 'kept-new-versions 20)
(set-variable 'delete-old-versions t)
(set-variable 'auto-save-interval 50)
(set-variable 'auto-save-timeout 10)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; key bindings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;





;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; colors
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(custom-set-faces
  ;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 (when (< emacs-major-version 21)
   '(default ((t (:foreground "white"))))
   '(default ((t (:background "black"))))
   )
 '(background "blue")
 '(font-lock-builtin-face ((((class color) (background dark)) (:foreground "Turquoise"))))
 '(font-lock-comment-face ((t (:foreground "MediumAquamarine"))))
 '(font-lock-constant-face ((((class color) (background dark)) (:bold t :foreground "DarkOrchid"))))
 '(font-lock-doc-string-face ((t (:foreground "green2"))))
 '(font-lock-function-name-face ((t (:foreground "SkyBlue"))))
 '(font-lock-keyword-face ((t (:bold t :foreground "CornflowerBlue"))))
 '(font-lock-preprocessor-face ((t (:italic nil :foreground "CornFlowerBlue"))))
 '(font-lock-reference-face ((t (:foreground "DodgerBlue"))))
 '(font-lock-string-face ((t (:foreground "LimeGreen"))))
 '(font-lock-type-face ((t (:foreground "#9290ff"))))
 '(font-lock-variable-name-face ((t (:foreground "PaleGreen"))))
 '(font-lock-warning-face ((((class color) (background dark)) (:foreground "yellow" :background "red"))))
 '(highlight ((t (:background "CornflowerBlue"))))
 '(list-mode-item-selected ((t (:background "gold"))))
 '(makefile-space-face ((t (:background "wheat"))))
 '(modeline ((t (:background "Navy"))))
 '(paren-match ((t (:background "darkseagreen4"))))
 '(region ((t (:background "DarkSlateBlue"))))
 '(show-paren-match-face ((t (:foreground "black" :background "wheat"))))
 '(show-paren-mismatch-face ((((class color)) (:foreground "white" :background "red"))))
 '(speedbar-button-face ((((class color) (background dark)) (:foreground "green4"))))
 '(speedbar-directory-face ((((class color) (background dark)) (:foreground "khaki"))))
 '(speedbar-file-face ((((class color) (background dark)) (:foreground "cyan"))))
 '(speedbar-tag-face ((((class color) (background dark)) (:foreground "Springgreen"))))
 '(vhdl-speedbar-architecture-selected-face ((((class color) (background dark)) (:underline t :foreground "Blue"))))
 '(vhdl-speedbar-entity-face ((((class color) (background dark)) (:foreground "darkGreen"))))
 '(vhdl-speedbar-entity-selected-face ((((class color) (background dark)) (:underline t :foreground "darkGreen"))))
 '(vhdl-speedbar-package-face ((((class color) (background dark)) (:foreground "black"))))
 '(vhdl-speedbar-package-selected-face ((((class color) (background dark)) (:underline t :foreground "black"))))
 '(widget-field-face ((((class grayscale color) (background light)) (:background "DarkBlue")))))


(set-background-color "black")
(set-foreground-color "white")
(set-cursor-color "Steelblue")

;; parseur mulot
;;(add-hook 'c-mode-hook '(lambda ()
;;(autoload 'norme      "~/emacs-config/norme.el" nil t)))

;(if (file-exists-p "~/emacs-config/ocaml.emacs")
;    (load-file "~/emacs-config/ocaml.emacs")
;)
;;auto-fill-mode (70 colonnes)

(if (file-exists-p "~/.myemacs")
    (load-file "~/.myemacs")
)

(custom-set-variables
  ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 '(speedbar-frame-parameters (quote ((minibuffer) (width . 20) (border-width . 0) (menu-bar-lines . 0) (tool-bar-lines . 0) (unsplittable . t) (set-background-color "black")))))
