SaltyCrane Blog — Notes on JavaScript and web development

.emacs

(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.
 '(c-basic-offset 3)
 '(column-number-mode t)
 '(cua-mode t nil (cua-base))
 '(scroll-bar-mode nil)
 '(tool-bar-mode nil)
 '(transient-mark-mode t))

;;================================================
;; server mode
(server-start)

;; custimizations
(setq inhibit-startup-message t)
(setq default-truncate-lines t)
(setq default-tab-width 4)
(setq dabbrev-case-replace nil)     ; make sure case is preserved when expanding

;; from http://geosoft.no/development/emacs.html
(setq search-highlight           t) ; Highlight search object
(setq query-replace-highlight    t) ; Highlight query object
(setq mouse-sel-retain-highlight t) ; Keep mouse high-lightening 

;;================================================
;; Behaviour
;; from http://www.postulate.org/emacs.php

;; don't automatically add new lines when scrolling down at
;; the bottom of a buffer
(setq next-line-add-newlines nil)

;; scroll just one line when hitting the bottom of the window
(setq scroll-step 1)
(setq scroll-conservatively 1)

;; move around a little 
(defun cursor-up-slightly () (interactive) (previous-line 7))
(defun cursor-down-slightly () (interactive) (next-line 7))
(global-set-key [C-down] 'cursor-down-slightly)
(global-set-key [C-up] 'cursor-up-slightly)

(defun scroll-up-slightly () (interactive) (scroll-up 7))
(defun scroll-down-slightly () (interactive) (scroll-down 7))
(global-set-key [M-down] 'scroll-down-slightly)
(global-set-key [M-up] 'scroll-up-slightly)

(defun scroll-right-slightly () (interactive) (scroll-right 5))
(defun scroll-left-slightly () (interactive) (scroll-left 5))
(global-set-key [M-right] 'scroll-right-slightly)
(global-set-key [M-left] 'scroll-left-slightly)

;; do scroll horizontally when at edge of screen
(setq auto-hscroll-mode t)
(setq hscroll-margin 0)

;;================================================
;; key bindings
(global-set-key "\C-f" 'isearch-forward)
(global-set-key "\C-s" 'save-buffer)
(global-set-key "\C-w" 'kill-this-buffer)
(global-set-key [C-prior] 'previous-buffer) ; that's CTRL+PGUP
(global-set-key [C-next] 'next-buffer)     ; that's CTRL+PGDOWN
(global-set-key "\M- " 'dabbrev-expand)

;;================================================
;; cc mode
(setq c-default-style '((c-mode . "bsd")))

;;================================================
;; setup frame position and size
(setq initial-frame-alist
   '((top . 0) (left . 600)
  (width . 80) (height . 60)))

(setq default-frame-alist
   '((top . 0) (left . 0)
  (width . 80) (height. 40)
  )
)