My .emacs file
This file is done and redone a zillion times, what's important with this version is that PSGML and tdtd gives nice verification and editing possibilities for any XML file or DTD file. It also give a nice java mode with pretty fonts and colors.
;; .emacs
;;----------------------------------------------------------------------------
;; Norske tegn
(require 'iso-insert)
(global-set-key [4194428] 'insert-o-slash)
(global-set-key [4194396] 'insert-O-slash)
(global-set-key [4194427] 'insert-ae)
(global-set-key [4194395] 'insert-AE)
(global-set-key [4194429] 'insert-a-ring)
(global-set-key [4194397] 'insert-A-ring)
;;----------------------------------------------------------------------------
;; Keys bindings
(progn
(setq enable-local-variables t)
(global-set-key [f6] 'goto-line)
(global-set-key [f7] 'point-to-register)
(global-set-key [f8] 'jump-to-register)
(global-set-key [f9] 'call-last-kbd-macro)
(global-set-key [f10] 'start-kbd-macro)
(global-set-key [f11] 'end-kbd-macro)
(global-set-key [f12] 'indent-c-exp)
(global-set-key [C-tab] 'indent-c-exp)
(global-set-key [prior] 'scroll-down)
(global-set-key [next] 'scroll-up)
(global-set-key [f29] 'scroll-down)
(global-set-key [f35] 'scroll-up)
(global-set-key [home] 'beginning-of-line)
(global-set-key [end] 'end-of-line)
(global-set-key [insert] 'overwrite-mode)
(global-set-key [C-prior] 'beginning-of-buffer)
(global-set-key [C-next] 'end-of-buffer)
(global-set-key [C-f29] 'beginning-of-buffer)
(global-set-key [C-f35] 'end-of-buffer)
(global-set-key [S-left] 'beginning-of-line)
(global-set-key [S-right] 'end-of-line)
(global-set-key [S-f30] 'beginning-of-line)
(global-set-key [S-f32] 'end-of-line)
(global-set-key [C-left] 'backward-word)
(global-set-key [C-right] 'forward-word)
(global-set-key [M-left] 'backward-paragraph)
(global-set-key [M-right] 'forward-paragraph)
(global-set-key [f31] 'recenter)
(global-set-key "\C-x\M-s" 'tags-search)
(global-set-key "\C-x\M-q" 'tags-query-replace)
(global-set-key "\C-x\M-a" 'tags-apropos)
(global-set-key "\M-s" 'scroll-bar-mode)
)
;;----------------------------------------------------------------------------
;; misc
(progn
(line-number-mode t)
(column-number-mode t)
(standard-display-european t)
)
;;----------------------------------------------------------------------------
;; FONT LOCK
;; Turn on font-lock in all modes that support it
(global-font-lock-mode t)
;; Maximum colors
(setq font-lock-maximum-decoration t)
(add-hook 'java-mode-hook 'turn-on-font-lock)
;;----------------------------------------------------------------------------
;; hilit19
;;(cond (window-system
; (setq hilit-mode-enable-list '(not text-mode)
; hilit-background-mode 'light
; hilit-inhibit-hooks nil
; hilit-inhibit-rebinding nil)
; (require 'hilit19)
; ))
;(setq hilit-auto-highlight-maxout 90000)
;;----------------------------------------------------------------------------
;; PSGML
;;(setq screenshots nil) ; t for screenshot color settings, else nil
;;
;;(make-face 'sgml-comment-face)
;;(make-face 'sgml-start-tag-face)
;;(make-face 'sgml-end-tag-face)
;;(make-face 'sgml-entity-face)
;;(make-face 'sgml-doctype-face)
;;
;;(cond ((equal screenshots nil)
;; (set-face-foreground 'sgml-comment-face "FireBrick")
;; (set-face-foreground 'sgml-start-tag-face "SlateBlue")
;; (set-face-foreground 'sgml-end-tag-face "SlateBlue")
;; (set-face-background 'sgml-entity-face "SlateBlue")
;; (set-face-foreground 'sgml-entity-face "Red")
;; (set-face-foreground 'sgml-doctype-face "FireBrick")
;; )
;; ((equal screenshots t)
;; ; This set for screen shots
;; (set-background-color "White")
;; (set-face-foreground 'sgml-comment-face "White") ; Comments: white on
;; (set-face-background 'sgml-comment-face "Gray") ; gray.
;; (set-face-background 'sgml-start-tag-face "Gray") ; Tags: black (default)
;; (set-face-background 'sgml-end-tag-face "Gray") ; on gray.
;; (set-face-foreground 'sgml-entity-face "White") ; Entity references:
;; (set-face-background 'sgml-entity-face "Black") ; white on black.
;; )
;;(t nil))
;;
;;(setq sgml-set-face t) ; without this, all SGML text is in same color
;;(setq sgml-markup-faces
;; '((comment . sgml-comment-face)
;; (start-tag . sgml-start-tag-face)
;; (end-tag . sgml-end-tag-face)
;; (doctype . sgml-doctype-face)
;; (entity . sgml-entity-face)))
;;
;;(autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t)
;;(autoload 'xml-mode "psgml" "Major mode to edit XML files." t)
;; Turn on syntax coloring
(cond ((fboundp 'global-font-lock-mode)
;; Turn on font-lock in all modes that support it
(global-font-lock-mode t)
;; maximum colors
(setq font-lock-maximum-decoration t)))
;; load sgml-mode
(autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t )
;; in sgml documents, parse dtd immediately to allow immediate
;; syntax coloring
(setq sgml-auto-activate-dtd t)
;; here we set the syntax color information for psgml
(setq-default sgml-set-face t)
;;
;; Faces.
;;
(make-face 'sgml-comment-face)
(make-face 'sgml-doctype-face)
(make-face 'sgml-end-tag-face)
(make-face 'sgml-entity-face)
(make-face 'sgml-ignored-face)
(make-face 'sgml-ms-end-face)
(make-face 'sgml-ms-start-face)
(make-face 'sgml-pi-face)
(make-face 'sgml-sgml-face)
(make-face 'sgml-short-ref-face)
(make-face 'sgml-start-tag-face)
(set-face-foreground 'sgml-comment-face "dark turquoise")
(set-face-foreground 'sgml-doctype-face "red")
(set-face-foreground 'sgml-end-tag-face "blue")
(set-face-foreground 'sgml-entity-face "magenta")
(set-face-foreground 'sgml-ignored-face "gray40")
(set-face-background 'sgml-ignored-face "gray60")
(set-face-foreground 'sgml-ms-end-face "green")
(set-face-foreground 'sgml-ms-start-face "yellow")
(set-face-foreground 'sgml-pi-face "lime green")
(set-face-foreground 'sgml-sgml-face "brown")
(set-face-foreground 'sgml-short-ref-face "deep sky blue")
(set-face-foreground 'sgml-start-tag-face "dark green")
(setq-default sgml-markup-faces'((comment . sgml-comment-face)
(doctype . sgml-doctype-face)
(end-tag . sgml-end-tag-face)
(entity . sgml-entity-face)
(ignored . sgml-ignored-face)
(ms-end . sgml-ms-end-face)
(ms-start . sgml-ms-start-face)
(pi . sgml-pi-face)
(sgml . sgml-sgml-face)
(short-ref . sgml-short-ref-face)
(start-tag . sgml-start-tag-face)))
;; load xml-mode
(setq auto-mode-alist
(append (list (cons "\\.xml\\'" 'xml-mode))auto-mode-alist))
(autoload 'xml-mode "psgml" nil t)
(setq sgml-xml-declaration "C:/Programs/jade/xml.dcl")
;; define html mode
;;(or (assoc "\\.html$" auto-mode-alist)
;; (setq auto-mode-alist
;; (cons '("\\.html$" . sgml-html-mode)auto-mode-alist)))
;;(or (assoc "\\.htm$" auto-mode-alist)
;; (setq auto-mode-alist
;; (cons '("\\.htm$" . sgml-html-mode)auto-mode-alist)))
;;
;;(defun sgml-html-mode ()
;; "This version of html mode is just a wrapper around sgml mode."
;; (interactive)
;; (sgml-mode)
;; (make-local-variable 'sgml-declaration)
;; (make-local-variable 'sgml-default-doctype-name)
;; (setq
;; sgml-default-doctype-name "html"
;; sgml-declaration "d:/usr/local/jade/pubtext/html.dcl"
;; sgml-always-quote-attributes t
;; sgml-indent-step 2
;; sgml-indent-data t
;; sgml-minimize-attributes nil
;; sgml-omittag t
;; sgml-shorttag t))
;;
;;(setq-default sgml-indent-data t)
;;(setq
;; sgml-always-quote-attributes t
;; sgml-auto-insert-required-elements t
;; sgml-auto-activate-dtd t
;; sgml-indent-data t
;; sgml-indent-step 2
;; sgml-minimize-attributes nil
;; sgml-omittag nil
;; sgml-shorttag nil)
;;----------------------------------------------------------------------------
;; DTD mode
;;(autoload 'dtd-mode "tdtd" "Major mode for SGML and XML DTDs." t)
;; Turn on font lock when in DTD mode
;;(add-hook 'dtd-mode-hooks
;; 'turn-on-font-lock)
;; Start DTD mode for editing SGML-DTDs
(autoload 'dtd-mode "tdtd" "Major mode for SGML and XML DTDs.")
(autoload 'dtd-etags "tdtd"
"Execute etags on FILESPEC and match on DTD-specific regular expressions."t)
(autoload 'dtd-grep "tdtd" "Grep for PATTERN in files matching FILESPEC." t)
;; Turn on font lock when in DTD mode
(add-hook 'dtd-mode-hooks
'turn-on-font-lock)
(setq auto-mode-alist(
append(
list
'("\\.dcl$" . dtd-mode)
'("\\.dec$" . dtd-mode)
'("\\.dtd$" . dtd-mode)
'("\\.ele$" . dtd-mode)
'("\\.ent$" . dtd-mode)
'("\\.mod$" . dtd-mode))
auto-mode-alist))
(add-hook 'write-file-hooks 'time-stamp)