Emacs with Subversion

Configuring Emacs to work with subversion and more..dot emacs file sample

Emacs with Subversion
Date: 29 mars 2009

== Emacs 22.3 instructions ==

Uncompress emacs zip file to c:/emacs
set HOME=c:\emacs\
create .emacs in this folder and go
if home is not set put .emacs in the C:\  folder

Packages should be under lisp directory
* For php we need
php-mode.el
* For subversion (in windows a svn command client should be installed, like CollabNetSubversionClient)
psvn.el
* To show line numbers on the left
linelo
* Multimode, indenting an html-php file
multi-mode



Subversion working method:

Open your file and update it,when done (C-x C-s)
press M-x vc-next-action
(Where M is the ALT key)
this will perform a commit

And here is my emacs file, I hope you will find it useful:


;; PHP
(require 'php-mode)
;;(autoload 'php-mode "php-mode" "PHP editing mode" t)
(add-to-list 'auto-mode-alist '(".php$" . php-mode))
(add-to-list 'auto-mode-alist '(".php3$" . php-mode))
(add-to-list 'auto-mode-alist '(".php4$" . php-mode))
(add-to-list 'auto-mode-alist '(".php5$" . php-mode))
(add-to-list 'auto-mode-alist '(".inc$" . php-mode))

;; multi-mode php with html
(require 'multi-mode)

;; psvn SUBVERSION
;; (autoload 'psvn "psvn" "Subversion" t)
(require 'psvn)
;; hide unmodified files
(setq svn-status-hide-unmodified t)

;; use longer phrases
(setq svn-status-short-mod-flag-p nil)

;; delete temporary files
(setq svn-status-ediff-delete-temporary-files t)

;; examine
(global-set-key [(control x) (v) (e)] 'svn-status)

;; UTF-8
;; Preferred Charset
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
;; Default buffer.
(setq default-buffer-file-coding-system 'utf-8)
;; Cut buffer
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
(modify-coding-system-alist 'file ".*" 'utf-8)
(setq locale-coding-system 'utf-8)

;; Autocomplete
(abbrev-mode t) ; Autocomplete
(global-set-key (quote [S-tab]) (quote dabbrev-expand))

;; Wheel Mouse Scrolling
(mouse-wheel-mode t)

; Cursor stays in place there where it was
(setq scroll-preserve-screen-position t)

;; Menus etc...
;(tool-bar-mode 1)
(scroll-bar-mode 1)
(menu-bar-mode 1)

;;; Syntax color
(global-font-lock-mode 1)

;; Max color
(setq font-lock-maximum-size t)

;; Colors for every mode
(setq font-lock-maximum-decoration t)

;; Changes windows name it sets the current edited file name on
(setq frame-title-format '(buffer-file-name "Emacs: %b (%f)" "Emacs: %b"))

; Erase backup files
; (those famous files ending by: ~ )
(setq make-backup-files nil)

;; Show line numbers on the left
(require 'lineno)

;; Turn off tab, use spaces only
(setq-default indent-tabs-mode nil)

;; Set standard indent
(setq standard-indent 4)

;; Line by line Scrolling
(setq scroll-step 1)

;; Show column-number in the mode line
(column-number-mode 1)

;; Set the fill column
(setq-default fill-column 72)

;; Lines automatically wrapped when beyond column limit
(setq auto-fill-mode 1)

;; Customized cursor
(setq default-cursor-type '(bar . 1))
(set-cursor-color "black")

;; Abreviations for "yes","no"..
(fset 'yes-or-no-p 'y-or-n-p)

;; Writing over selected text
;; erase former text
(delete-selection-mode 1)


;; When copy-paste with the mouse
;; insert text at clicked point
(setq mouse-yank-at-point nil)


;; Startup screen options, do not show emacs help screen
(defun activate-at-startup ()
(lineno-minor-mode 1))
(add-hook 'php-mode-hook 'activate-at-startup)
(add-hook 'c-mode-hook 'activate-at-startup)
(add-hook 'emacs-lisp-mode-hook 'activate-at-startup)
(add-hook 'text-mode-hook 'activate-at-startup)
(add-hook 'fundamental-mode-hook 'activate-at-startup)
(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.
'(case-fold-search t)
'(current-language-environment "UTF-8")
'(default-input-method "rfc1345")
'(global-font-lock-mode t nil (font-lock))
'(inhibit-startup-screen t)
'(show-paren-mode t nil (paren))
'(transient-mark-mode 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.
)

;;;;;;;;;;;;;;;;;;;;;;;;
;;; Fonts and colors ;;;
;;;;;;;;;;;;;;;;;;;;;;;;

;; Courier New font of size 10 and font style Regular: if you want bold, change normal to bold here
(set-default-font "-*-Courier New-normal-r-*-*-12-*-*-*-c-*-*-utf-8-1")

;;(set-background-color "DarkSlateGrey")
(set-background-color "Black")
(set-foreground-color "White")
(set-cursor-color "Orchid")