(setq 
 standard-mode-hook
 (function (lambda ()
	     (turn-on-auto-fill)
	     (local-set-key "\C-m" 'newline-and-indent)))

 text-mode-hook
 (function (lambda ()
	     (turn-on-auto-fill)))
 
 tex-run-command "latex2e"
 tex-dvi-view-command "xdvi -s 8"
 
 latex-mode-hook
 (function (lambda ()
	     (turn-on-auto-fill)))

 perl-mode-hook standard-mode-hook
 message-mode-hook standard-mode-hook
 makefile-mode-hook standard-mode-hook
 
 post-command-hook (cons 'hscroll-point-visible post-command-hook)
 
 zsend-mode-hook
 (function
  (lambda ()
    (turn-on-auto-fill)
    (if (boundp 'zsend-override-zwrite)
	(progn
	  (make-local-variable 'zsend-zwrite)
	  (setq zsend-zwrite zsend-override-zwrite)))
    (define-key zsend-mode-map "\C-c\C-y" 'zsend-insert-last-long-zgram)))
 
 zsend-before-zwrite-hook
 (function
  (lambda ()
    (if (boundp 'zsend-append-realm)
	(if (eq (car zsend-dest) 'user)
	    (setq zsend-dest
		  (cons 'user (concat (cdr zsend-dest) zsend-append-realm)))
	  (make-local-variable 'zsend-zwrite-args)
	  (let ((tmp zsend-zwrite-args))
	    (make-local-variable 'zsend-zwrite-args)
	    (setq zsend-zwrite-args (cons (concat "*" zsend-append-realm)
					  tmp)))))
    (zsend-save-last-long-zgram)
    (zsend-log-zgram)))
 
 zwgc-mode-hook
 (function
  (lambda ()
    (local-set-key "w" 'zsend)
    (local-set-key "r" 'my-zreply)
    (local-set-key "N" 'zwgc-nuke-instance)
    (setq zwgc-notice-regexp-alist
	  '(("It's a PING from [a-z0-9]+" . zwgc-handle-ping)
	    ("A_FILSRV,.*" . zwgc-handle-noc)
	    ("A_NOC,.*" . zwgc-handle-noc)
	    ("message,personal". ding))
	  zwgc-summary-regexp "\\` *\\(.*[^ ]+\\) *
^ *From \\(.*\\) on"
	  zwgc-environment '("EMACS=t" "WGFILE=/tmp/wg.daveg.emacs"
			     "TERM=emacs" "DISPLAY=emacs-zwgc")
	  zwgc-window-max-height 11
	  zwgc-window-min-height 7
	  zwgc-bury-buffer nil
	  )
    (zwgc-install-window-functions)))
 
 zwgc-znol-mode-hook
 (function
  (lambda ()
    (if (or (string= env "sgi") (string= env "iris4d")
	    (string= env "unknown") (string= env "decstation"))
	(setq zwgc-znol-prog "/usr/athena/bin/znol"))))
 
; zwgc-running-hook (function (lambda () (zwgc-znol)))
 
 zwgc-killed-hook
 (function
  (lambda ()
    (let ((buf (get-buffer "*znol*")))
      (if buf (kill-buffer buf)))))
 
 zwgc-summary-hook
 (function
  (lambda (&rest strings)
    (if (< (length strings) 2)
	(error "zwgc-summary-regexp failed!")
      (concat (car strings) ": " (car (cdr strings))))))

 c-mode-hook
 (function (lambda ()
	     (local-set-key "\M-\C-I" 'indent-region)
	     (auto-fill-mode 0)
	     (line-number-mode 1)
	     (abbrev-mode 1)
	     (c-toggle-auto-hungry-state 1)
	     (c-add-style "DaveG" daveg-c-style t)
  	     (setq c-tab-always-indent t
		   c-auto-newline t
		   )))
		   
 c++-mode-hook
 (function (lambda ()
	     (run-hooks 'c-mode-hook)
	     (setq c++-auto-hungry-initial-state 'auto-only)))

 font-lock-mode-hook
 (function (lambda ()
	     (if (eq major-mode 'java-mode)
		 (setq font-lock-keywords java-font-lock-keywords-3))))
 
 cmd-mode-hook
 (function (lambda ()
	     (local-unset-key "\C-z")))
 
 emacs-lisp-mode-hook standard-mode-hook
 
 lisp-interaction-mode-hook standard-mode-hook
 
 discuss-mode-hooks
 (function (lambda ()
	     (setq discuss-DWIM t)))


 scheme-interaction-mode-hook standard-mode-hook
 
 scheme-mode-hook
 (function (lambda ()
	     (run-hooks 'standard-mode-hook)
	     (local-set-key "\C-j"
			    'advertised-xscheme-send-previous-expression)
	     ))

 ediff-load-hook
 (function (lambda ()
	     (set-face-background ediff-current-diff-face-A "navyblue")
             (set-face-foreground ediff-current-diff-face-A "white")
             (set-face-background ediff-current-diff-face-B "navyblue")
             (set-face-foreground ediff-current-diff-face-B "white")

             (set-face-background ediff-fine-diff-face-A "black")
             (set-face-foreground ediff-fine-diff-face-A "yellow")
             (set-face-background ediff-fine-diff-face-B "black")
             (set-face-foreground ediff-fine-diff-face-B "yellow")

             (set-face-foreground ediff-odd-diff-face-A "black")
             (set-face-background ediff-odd-diff-face-A "gray65")
             (set-face-foreground ediff-odd-diff-face-B "black")
             (set-face-background ediff-odd-diff-face-B "gray65")

             (set-face-foreground ediff-even-diff-face-A "black")
             (set-face-background ediff-even-diff-face-A "gray65")
             (set-face-foreground ediff-even-diff-face-B "black")
             (set-face-background ediff-even-diff-face-B "gray65")

	     (setq ediff-split-window-function
		   'split-window-horizontally)
	     (setq-default ediff-auto-refine-limit 300)))

 find-file-hook
 (function (lambda ()
	     (if (not (and (boundp 'enriched-mode)
			   enriched-mode)))))

 bbdb-initialize-hook
 (function (lambda ()
	     (setq bbdb-always-add-addresses t
		   bbdb-file (expand-file-name "~/Mail/.bbdb")
		   bbdb-info-file
		   "/afs/sipb/contrib/emacs/packages/bbdb-1.50/bbdb.info"
		   bbdb-defauylt-area-code 617
		   bbdb-auto-revert-p t
		   bbdb-use-pop-up nil
		   bbdb-completion-display-record nil
;		   bbdb-pop-up-target-lines 1
;		   bbdb-pop-up-elided-display t
		   )))

 gnus-select-group-hook
 (function (lambda ()
	     (message "selecting group")
	     (setq bbdb/news-auto-create-p
		   (or (eq (compare-strings
			    gnus-newsgroup-name 1 5
			    "nnml:" 1 5) t)
		       (eq (compare-strings
			    gnus-newsgroup-name 1 6
			    "nndsc:" 1 6) t)))
	     (message "setq acp %s" bbdb/news-auto-create-p)
	     ))

 html-helper-load-hook
 (function (lambda ()
	     (require 'html-font)))

 calendar-load-hook 
 (function (lambda ()
	     (define-key calendar-mode-map "n" 'records-calendar-to-record)))

 )

(add-hook 'write-file-hooks 'time-stamp)
