
;; Redefining the yes-or-no-p function
;; let "yes or no" questions be answered with a simple y/n
(fset 'yes-or-no-p 'y-or-n-p)
(define-key query-replace-map [return] 'act) ; makes return act as yes
(define-key query-replace-map [?\C-m]  'act)

;;  Control which filename extensions should be avoided and not avoided,
;;  when doing the filename completion thing, i.e. which files do we not
;;  wish to open with emacs
(mapcar
 (lambda (expr)
   (add-to-list 'completion-ignored-extensions expr))
 '(".mdb" ".exe" ".xls" ".doc" ".flc"))

;; Prevent emacs from adding lines to the bottom of a buffer
;; if the end of the buffer is reached
(setq next-line-extends-end-of-buffer nil)
(setq next-line-add-newlines          nil)

;; show line and column numbers in the mode-line
(setq line-number-mode   t)
(setq column-number-mode t)

;; Modify syntax entry for underscore (95) to be "word"
(eval-after-load
    "cc-mode"
  '(modify-syntax-entry 95 "w" c-mode-syntax-table))

;; Case sensistive searches
;(setq case-fold-search nil) ; make searches case sensitive
(setq case-fold-search t)   ; make searches case insensitive

;; Let ALT-TAB behave the windows way (or sort off)
(setq w32-pass-alt-to-system t)

;; Highlightning af region
(setq transient-mark-mode t)

;; Enable font-lock
(global-font-lock-mode t)
;; Maximum highlight level
(setq font-lock-maximum-decoration t)

;; It will display highlighting on whatever paren matches the one
;; before or after point.
(customize-set-variable 'show-paren-style 'mixed)
(show-paren-mode t)

;; Enable pc-bindings
(require 'pc-select)
(pc-selection-mode)
(require 'pc-mode)
(pc-bindings-mode)


;; Some mice have a "wheel" instead of a third button.  You can
;; usually click the wheel to act as either `Mouse-2' or `Mouse-3',
;; depending on the setup.  You can also use the wheel to scroll
;; windows instead of using the scroll bar or keyboard commands.  To
;; do so, turn on Mouse Wheel global minor mode with the command `M-x
;; mouse-wheel-mode' or by customizing the option
;; `mouse-wheel-mode'. Support for the wheel depends on the system
;; generating appropriate events for Emacs.
(mouse-wheel-mode t)

; Non-nil means highlight trailing whitespace in face `trailing-whitespace'.
(setq show-trailing-whitespace t)

;; Set the text cursor color of the selected frame to COLOR-NAME.
(set-cursor-color "blue")

;; Non-nil means show an hourglass pointer when running under a window system."
(setq display-hourglass t)

;; disable TAB as indent in most places
(customize-set-variable 'indent-tabs-mode nil)

;; Start the emacs-server, so we can connect to emacs
(condition-case var
    (server-start)
  (error nil)) ; ignore errors


;; Set the format for the title bars and icon text for each window
(setq frame-title-format
      '("emacs://" user-login-name "@" system-name "/" 
        mode-line-buffer-identification
        " L:%l C:%c P:%p"
        " S:"
        mode-line-modified 
        ))
(setq icon-title-format "emacs: %b")

;; Make a message when compilation finishes
(defun message-compilation-finish (buf how)
  (message "%s: %s" (buffer-name buf) how))
(customize-set-value 'compilation-finish-functions 
		     (cons 'message-compilation-finish compilation-finish-functions))
;; Make compilation windows scroll with output
(customize-set-variable 'compilation-scroll-output t)

