See here for unformatted version.
;; -*- Mode: Emacs-Lisp -*-

; Is this emacs or xemacs?
(or (boundp 'running-xemacs)
    (defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version)))

; use e.g. as follows:
(if (not running-xemacs)
    t
  nil)

(require 'desktop)
(require 'redo)
(require 'font-lock)
(require 'paren)
;;(require 'recent-files)
(load-library "reposition");;reposition the window better than C-l with C-M-l
;;(vc-load-vc-hooks)
(require 'vc)
;; ANSI color mode for shells, etc
(autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t)
(autoload 'font-lock-add-buffer-keywords "add-buffer-keywords" nil t)
(autoload 'mount "mouumo" nil t)
(autoload 'umount "mouumo" nil t)
(autoload 'vvb-mode "vvb-mode" nil t)
(autoload 'htmlize-buffer "htmlize" nil t)
(require 'mmm-auto)
(require 'preview)
(require 'fscroll)  ;; make sure that when you pgup to top of document, it gets to very top

;;iswitch is does a better job with C-x b
(autoload 'iswitchb "iswitchb" "Run iswitchb" t)
(setq read-buffer-function 'iswitchb-read-buffer)
(setq iswitchb-default-method 'samewindow)
(iswitchb-default-keybindings)

(gnuserv-start)

;(setq load-path (pushnew "/usr/share/xemacs21/packages/lisp/tramp" load-path))
(add-to-list 'load-path "~/elisp/tramp/lisp")
(add-to-list 'load-path "~/elisp/preview-latex/....")
;(add-to-list 'load-path "~/elisp/latex-symbols-0.04")
(add-to-list 'load-path "~/elisp")

;(load-library "tramp")
(require 'tramp)
(add-to-list 'tramp-multi-connection-function-alist
             '("sshc" tramp-multi-connect-rlogin "ssh1killkludge %h %u%n"))
(require 'recentf)
(recentf-mode 1)

;;end of loading libraries, setting paths, etc


(setq options-file-xemacs-version '(20 4))
(setq-default case-fold-search t)
(setq-default overwrite-mode nil)
(setq-default case-fold-search t)
(setq-default case-replace t)
(setq-default zmacs-regions t)
(setq-default mouse-yank-at-point nil)
(setq-default require-final-newline t)
(setq-default next-line-add-newlines nil)
(setq-default teach-extended-commands-p t)
(setq-default teach-extended-commands-timeout 4)
(setq-default debug-on-error nil)
(setq-default debug-on-quit nil)
(setq-default lpr-switches nil)
(setq-default ps-print-color-p nil)
(setq-default ps-paper-type 'letter)
(setq-default get-frame-for-buffer-default-instance-limit nil)
(setq-default temp-buffer-show-function 'show-temp-buffer-in-current-frame)
(setq-default font-lock-auto-fontify t)
(setq-default font-lock-use-fonts nil)
(setq-default font-lock-use-colors '(color))
(setq-default font-lock-maximum-decoration t)
(setq-default font-lock-maximum-size 256000)
(setq-default font-lock-mode-enable-list nil)
(setq-default font-lock-mode-disable-list nil)
(remove-hook 'font-lock-mode-hook 'turn-on-fast-lock)
(remove-hook 'font-lock-mode-hook 'turn-on-lazy-shot)
(paren-set-mode 'blink-paren)
(if (featurep 'scrollbar) (progn (add-spec-list-to-specifier scrollbar-width 'nil) (add-spec-list-to-specifier scrollbar-height 'nil)))
(add-spec-list-to-specifier modeline-shadow-thickness '((global (nil . 2))))
(setq-default truncate-lines nil)
(setq-default bar-cursor nil)
(setq-default buffers-menu-max-size 25)
(setq-default complex-buffers-menu-p nil)
(setq-default buffers-menu-sort-function 'sort-buffers-menu-by-mode-then-alphabetically)
(setq-default buffers-menu-grouping-function 'group-buffers-menu-by-mode-then-alphabetically)
(setq-default buffers-menu-submenus-for-groups-p nil)
(setq-default font-menu-ignore-scaled-fonts t)
(setq-default font-menu-this-frame-only-p nil)
(if (featurep 'toolbar) (progn (set-default-toolbar-position 'top) (add-spec-list-to-specifier default-toolbar-visible-p 'nil) (add-spec-list-to-specifier toolbar-buttons-captioned-p 'nil)))
;(setq-default mouse-avoidance-mode nil)
(setq-default browse-url-browser-function 'browse-url-w3)
(setq rfcr-proxy-host "wwwproxy.swin.edu.au")
(setq rfcr-proxy-port 8000)


(setq c-recognize-knr-p nil);;speeds up indenting a lot, by not
;;looking for old style k&r



;;make f90 mode default
;(setq auto-mode-alist
;      (append '(("\\.f$"  . f90-mode)
;		("\\.F$" . f90-mode))
;	      auto-mode-alist))



;; adds an imenu
(defun add-imenu ()
  (f90-add-imenu-menu))

;(add-hook 'c-mode-hook 'turn-off-auto-fill)
(add-hook 'fortran-mode-hook 'turn-on-auto-fill)
(add-hook 'f90-mode-hook 'turn-on-auto-fill)
(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)   
(add-hook 'TeX-mode-hook   'turn-on-auto-fill)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
(add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode
(add-hook 'f90-mode-hook 'add-imenu)
(add-hook 'fortran-mode-hook 'vvb-mode)
(add-hook 'f90-mode-hook 'vvb-mode)
;(if (eq (console-type) 'x) (x-symbol-initialize))
;(add-hook 'LaTeX-mode-hook 'x-symbol-mode)   
;(add-hook 'TeX-mode-hook   'x-symbol-mode)

;;(require 'backup)
;;(backup-set-directory "~/xemacs-backups/")


;;Get tramp to beep whenever it finishes doing something.

;(defadvice tramp-handle-write-region
;  (after tramp-write-beep-advice activate)
;  " make tramp beep after writing a file."
;  (interactive)
;  (beep))
;(defadvice tramp-handle-do-copy-or-rename-file
;  (after tramp-copy-beep-advice activate)
;  " make tramp beep after copying a file."
;  (interactive)
;  (beep))
;(defadvice tramp-handle-insert-file-contents
;  (after tramp-copy-beep-advice activate)
;  " make tramp beep after copying a file."
;  (interactive)
;  (beep))

(load "/home/office/tconnors/.xemacs/funckeybindings.el")
(load "/home/office/tconnors/.xemacs/savefiles.el")
(load "/home/office/tconnors/.xemacs/highlighting.el")
(load "/home/office/tconnors/.xemacs/keysettings.el")

(display-time)

;-------------------------------------------------------------------------
; Find matching parenthesis for "()", "[]" and "{}".
; Bind <Ctrl-C g> to - go to the matching parenthesis.
; Bind <Ctrl-C s> to - a brief show of the matching parenthesis.
; Original code: http://list-archive.xemacs.org/xemacs-nt/199912/msg00050.html

(defun prepareprettyprint ()
  "Colors the screen in an appropriate way for pretty preinting. When I work out something better, I will use it!."
  (interactive)
  (set-face-background 'default "white")
  (set-face-foreground 'default "black"))

(defun deprepareprettyprint ()
  "Un-Colors the screen in an appropriate way for viewing. When I work out something better, I will use it!."
  (interactive)
  (setdefaultcolors))

(defun setdefaultcolors ()
  "Set the default colors of the screen."
  (interactive)
  (set-face-background 'default "black") ;screen background
  (set-face-foreground 'default "lightblue") ;normal text (not really - just do it before setting it properly later, in case of failures during init
  )

(defun go-matching-paren ()
  "Move cursor to the matching parenthesis."
  (interactive)
  (cond ((looking-at "[[({]") (forward-sexp 1))
	((save-excursion
           (backward-char 1)
           (looking-at "[])}]")) (backward-sexp 1))
        (t (ding) (message "Unbalanced parenthesis"))))

(defun show-matching-paren ()
  "Move cursor momentarily to the matching parenthesis."
  (interactive)
  (save-excursion
    (cond ((looking-at "[[({]") (forward-sexp 1) (sit-for 1))
          ((save-excursion
             (backward-char 1)
             (looking-at "[])}]")) (backward-sexp 1) (sit-for 1))
	  (t (ding) (message "Unbalanced parenthesis")))))

(define-key global-map "\C-cg" 'go-matching-paren)
(define-key global-map "\C-cs" 'show-matching-paren)

;; set the tag files used by the following directories:
;; /home/office/tconnors/TAGs/TAGS is createed with tags-create.sh
(setq tag-table-alist
      '(("/ficticious/directory/name" . "/ficticious/directory/name/and/crap")
        ("\\.el" . "/home/office/tconnors/TAGS/xel-TAGS")
        ("\\.c" . "/home/office/tconnors/TAGS/c-TAGS");;anything ending with .c
        ("" . "/home/office/tconnors/TAGS/");;default
        ))

(defun timc-write-file-hook ()
  "Do personal setting of file permissions"
;  (let ((permission #O644))
  (let ((permission 420))
    (when (string-match ".*\.*html" buffer-file-name)
      (message "set permissions of %s to %o" buffer-file-name permission)
      (set-file-modes buffer-file-name permission)))
  nil)

(add-hook 'after-save-hook 'timc-write-file-hook)

;(let
;    ((c-keyword-names
;      (concat "\\b\\(0[xX][0-9a-fA-F]+[lL]?\\|[0-9]+\\.?[0-9]*"
;              "\\([eE][-+]?[0-9]+\\)?\\([lL]\\|[fF]\\|[dD]\\)?\\)\\b")))
;  (setq c-font-lock-keywords-4
;        (list
;         (list (concat "\\<\\(" c-keyword-names "\\)\\>") 1 'c-number-face)
;         )))




(defun timc-c-settings-hook ()
  (c-set-style "k&r")
  (c-set-offset 'case-label 2)
;  (setq c-font-lock-keywords  (append c-font-lock-keywords-4
;                                      c-font-lock-keywords-3))
  )

(add-hook 'c-mode-common-hook 'timc-c-settings-hook)

;(mouse-avoidance-mode 'animate)


(defun count-words-buffer ()
  "Count the number of words in the current buffer;
print a message in the minibuffer with the result."
  (interactive)
  (save-excursion
    (let ((count 0))
      (goto-char (point-min))
      (while (< (point) (point-max))
	(forward-word 1)
	(setq count (1+ count)))
      (message "Buffer contains %d words." count))))

;; call fortune!
(defun fortune ()
  "What is life without a fortune cookie?"
  (interactive)
  (pop-to-buffer "*Fortune*")
  (insert (shell-command-to-string "/usr/games/fortune")))

;;; dos2unix and unix2dos from Benjamin Rutt's .emacs ;; Convert a buffer from dos ^M end of lines to unix end of lines
(defun dos2unix ()
  "Simply convert \\cr\\lf in a buffer into \\n."
  (interactive)
  (save-excursion 
    (goto-char (point-min))
    (while (search-forward "
" nil t)
      (replace-match ""))))

;;vice versa
(defun unix2dos ()
  "Simply convert \\n in a buffer into \\cr\\lf." 
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (while (search-forward "\n" nil t)
      (replace-match "\r\n"))))

(setq vc-diff-switches "-u")

;(setq visible-bell t)    ;;for my local terminal - it has no beeper
(setq remote-shell-program 'ssh)




(defun toggle-case-sensitivity ()
  "Switch from case-sentitive to case-insensitive searches, and back again."
  (interactive)
;  (if case-fold-search
;      (progn
;	(setq case-fold-search nil)
;	(message "Searches will be case sensitive." ())
;	)
;      (progn
;	(setq case-fold-search t)
;	(message "Searches will ignore case." ())
;	)
;      )
  (if font-lock-keywords-case-fold-search
      (progn
	(setq font-lock-keywords-case-fold-search nil)
	(message "Font lock searches will be case sensitive." ())
	)
    (progn
      (setq font-lock-keywords-case-fold-search t)
      (message "Font lock searches will ignore case." ())
      )
    ))


;(require 'func-menu)
;(add-hook 'find-file-hooks 'fume-add-menubar-entry)











(setdefaultcolors);;do this last, so we know instantly if we have b0rked something in the init.el scripts.