get back!    get down!   

Welcome.


my .emacs
my .gnus
ssh forwarding stuff
sshfwd.el (by Mark Plaksin)
Brief intro to the use of ssh port forwarding in emacs.
BBDB
The BBDB is the Big Brother Insidious Database. It works with gnus and other emacs mail packages to sneakily and automatically store information about the people whose mail or news postings you read. Then, when you need the info later, it's there!
handy
Here is some emacs lisp that will search open buffers for breakpoints, finally inserting gdb commands into the current buffer. This can be a big speedup when using kgdb.
breakpoints.el

;; .emacs -*- emacs-lisp -*- (leave this here for backups)

;;; originally this file was based on Eli Zaretskii's _emacs.xmpl file,
;;; included in the djgpp v2 distribution a while back.
;;;
;;; Later, stuff was added based on Mark Plaksin's .emacs and from
;;; usenet suggestions.  Then I got better at emacs lisp and made up
;;; some features.
;;;

(require 'cl)				; because cl is cool

;;; identity-related configuration
;;
(setq mail-host-address "uga.edu"
      user-full-name "Ed L. Cashin"
      user-login-name "cashin"
      user-mail-address "ecashin@uga.edu")

(set-face-background 'modeline "black")
(set-face-foreground 'modeline "lightgray")

;;; host-specific configuration
(let ((host (system-name)))
  (if host
      (cond ((equal host "nilda")
	     (set-background-color "SteelBlue4"))
	    ((equal host "tougas")
	     (progn
	       (set-background-color "ivory4")
	       (set-cursor-color "plum")))
	    ((equal host "marblerye.cs.uga.edu")
	     (progn
	       (if (getenv "GNUS_EMACS")
		   (set-background-color "DarkSlateGray")
		   (set-background-color "SlateGray"))
	       (set-cursor-color "Orchid")))
	    ((equal host "tornado")
	     (progn
	       (set-background-color "SlateGray")
	       (set-foreground-color "wheat")
	       (set-cursor-color "magenta")))
	    (t
	     (if (getenv "GNUS_EMACS")
		 ;; (set-background-color "snow4")
		 ;; (set-background-color "azure4")
		 (set-background-color "DarkSlateGray")
		 (set-background-color "SlateGray"))))))

(if (equal window-system 'x)
    (progn        ; Font-locking faces set-up
      (require 'font-lock)
      (setq
       font-lock-maximum-decoration t
       font-lock-maximum-size (if font-lock-maximum-decoration
				  (* 70 1024)
				  (* 150 1024)))
      (defvar elc-font-lock-faces-alist
	'((font-lock-comment-face . "lightgreen")
	  (font-lock-string-face . "yellow")
	  (font-lock-keyword-face . "white")
	  (font-lock-type-face . "white")
	  (font-lock-function-name-face . "gold")
	  (font-lock-variable-name-face . "lightblue")
	  (font-lock-constant-face . "lightblue"))
	"mapping of font lock faces to my favorite corresponding colors")
      (loop for p in elc-font-lock-faces-alist
	    do (let ((face (car p))
		     (color (cdr p)))
		 (set-face-foreground face color)))))

;;; Automatically makes the matching paren stand out in color.
(condition-case err
    (show-paren-mode t)
  (error
   (message "Cannot show parens %s" (cdr err))))

;;; This moves the mouse pointer out of my way.
(condition-case err
    (mouse-avoidance-mode 'exile)
  (error
   (message "Cannot use mouse-avoid %s" (cdr err))))

(condition-case err                     ; Display the time on modeline
    (display-time)
  (error
   (message "Cannot display time %s" (cdr err))))

;;; This loads a package which enables automatic scrolling when long
;;; lines are truncated.
(condition-case err
    (require 'auto-show)
  (error
   (message "Cannot auto-scroll long lines %s" (cdr err))))

;;; This enables automatic resizing of the minibuffer when its contents
;;; won't fit into a single line.
(condition-case err
    (resize-minibuffer-mode 1)
  (error
   (message "Cannot resize minibuffer %s" (cdr err))))

;
;;; This installs the `saveplace' package and defines where the places
;;; in visited files are saved between sessions.
(condition-case err
    (progn
      (require 'saveplace)
      (setq-default save-place t)    ; place saved in all files
      (setq save-place-file    "~/.places.sav"))
  (error
   (message "Cannot save places %s" (cdr err))))

;;; Enable some commands we need.
(put 'narrow-to-region 'disabled nil)
; (put 'downcase-region 'disabled nil)
; (put 'upcase-region 'disabled nil)

(setq visible-bell t)                   ; Blink the screen instead of beeping.
(setq enable-local-eval 'ask-me)	; don't blindly run lisp in files
(setq inhibit-startup-message t)
(setq next-line-add-newlines nil)       ; This disables down-arrow and
                                        ; C-n at the end of a buffer
                                        ; from adding a new line to
                                        ; that buffer.

(menu-bar-mode -1)                      ; get rid of the menu bar
(if (equal window-system 'x)            
    (scroll-bar-mode -1))               ; get rid of the scroll bar
(setq default-major-mode 'text-mode)

(setq-default transient-mark-mode       nil)
(setq line-number-mode                  t
      auto-save-timeout                 30
      require-final-newline             t
      search-highlight                  t
      compilation-window-height         12
      compilation-ask-about-save        nil)

(setq compilation-scroll-output t)

;;; This makes `apropos' and `super-apropos' do everything that they can.
;;; Makes them run 2 or 3 times slower.  Set this non-nil if you have a
;;; fast machine.
(setq apropos-do-all t)

;;;; This is a great little thing to partially solve the terminal mode
;;;; backspace key problem.
;;; -------------------------------------------------------------------
;;; From: Thomas L|fgren 
;;; Subject: Re: How do you make the back space key work in emacs?
;;; Newsgroups: gnu.emacs.help
;;; Date: 25 Mar 1999 11:14:14 +0100
;;; Organization: Uppsala University, Sweden
;;; Message-ID: 
;;; X-Newsreader: Gnus v5.5/Emacs 20.3
;;; NNTP-Posting-Host: ida.csd.uu.se
;;; Xref: cronkite.cc.uga.edu gnu.emacs.help:53827
;;; 
;;; >>>>> "DB" == David Beckwith  writes:
;;; 
;;;     DB> Does anybody know a quick one-liner for my .emacs file to make
;;;     DB> the back space key work?  Thanks!!!!  -David dab@ucla.edu
;;; 
;;; Kai posted this a while back, and I find it very useful, as it doesn't
;;; change the behavior under X, but makes the backspace key "work" on
;;; ttys.
;;; 
(or window-system
    (progn
      (setq key-translation-map (or key-translation-map (make-keymap)))
      (define-key key-translation-map "\C-h" (kbd "DEL"))
      (global-set-key (kbd "ESC ?") 'help-command)
      (setq help-char ??)))
;;; 
;;; If you use Emacs under X _and_ on ttys, this is a great thing to have
;;; in your .emacs.
;;; 
;;; Tom
;;; -- 
;;; Wherever I lay my .emacs, that's my ${HOME}

;;;; no annoying message added to newsgroup posts that are copied to
;;; email addresses.
(setq message-courtesy-message nil)

;;;; I really hate it when I can't find uppercase things.
(add-hook 'isearch-mode-hook
	  (lambda ()
	    (setq isearch-case-fold-search t)))

(defun elc-insert-buffer-list ()
  "insert a buffer-name per line into the current buffer"
  (interactive)
  (mapc (lambda (buf)
	  (insert (concat (buffer-name buf) "\n")))
	(buffer-list)))

(progn		; magicpoint support
  ; (setq load-path (cons "/usr/share/emacs/site-lisp/mgp/" load-path))
  (add-to-list 'auto-mode-alist '("\\.mgp?\\'" . mgp-mode))
  (autoload 'mgp-mode "mgp-mode")
  (setq mgp-options "-g 800x600")
  (setq mgp-window-height 6))

(progn		; linux kernel support
  (let ((homedir (expand-file-name "~")))
    (defvar elc-kernel-dir-regexps
      `("/usr/src/linux.*" 
	,(concat homedir "/build/linux-.*")
	,(concat homedir ".*/kernel/macc-.*")
	,(concat homedir "/kernel/.*")
	".*/kernel/macc/.*"
	".*/kernel/macc-.*/.*")
      "list of regular expressions to match directories that have kernel sources"))

  (defun elc-delete-buffer-trailing-ws ()
    "get rid of trailing whitespace in all lines in current buffer"
    (interactive)
    (save-excursion
      (goto-char (point-min))
      (end-of-line)
      (delete-horizontal-space)
      (loop do (let ((inhibit-field-text-motion t))
		 (end-of-line 2)
		 (delete-horizontal-space))
	    while (/= (point) (point-max)))))

  (defun linux-c-setup ()
    "adjust C mode for editing Linux kernel sources."
    (interactive)
    ;; (add-hook 'local-write-file-hooks
    ;; 	      'elc-delete-buffer-trailing-ws)
    (c-set-offset 'arglist-cont-nonempty 8 nil)
    (c-set-style "K&R")
    (setq c-basic-offset 8))

  ;; make it quicker to build kernel with a hotkey
  (defvar default-kernel-srcdir
    "/tmp/bogus"			; testing kernel-srcdir
    "the place where the kernel to compile is")

  (defvar kernel-build-cmd
    "make -w vmlinux"
    "the command to use for building in default-kernel-srcdir
We need the -w option to GNU make so that it says, \"Entering Directory\",
which compile.el understands.")

  ;; From: Kevin Rodgers 
  ;; Newsgroups: gnu.emacs.help
  ;; Subject: Re: dir-specific grep-find-command?
  ;; Date: Tue, 17 Jun 2003 13:10:24 -0600
  ;; Message-ID: <3EEF67A0.1020507@yahoo.com>
  (defun in-kernel-hook ()
    "If `in-kernel', override global `grep-find-command' value."
    (if (in-kernel 0)
	(set (make-local-variable 'grep-find-command) "kern-grep-find ")))
  (add-hook 'find-file-hooks 'in-kernel-hook)
  (add-hook 'dired-mode-hook 'in-kernel-hook)

  (defun compile-sparc-kernel ()
    "go to (kernel-srcdir) and run sparc-kernel-build-cmd"
    (interactive)
    (let ((kernel-build-cmd
	   "sh -c \"PATH=/opt/xcc-sparc64/bin:$PATH make ARCH=sparc64 CROSS_COMPILE=sparc64-gentoo-linux-gnu-\""))
      (compile-kernel)))
  (global-set-key [f11] 'compile-sparc-kernel)

  (defun compile-kernel ()
    "go to (kernel-srcdir) and run kernel-build-cmd"
    (interactive)
    (compile (format "cd %s && %s" (kernel-srcdir) kernel-build-cmd)))
  (global-set-key [f10] 'compile-kernel)

  ;; load my gdb breakpoints finding elisp if available
  (let ((f (concat default-kernel-srcdir
		   "/scripts/breakpoints.el")))
    (if (file-readable-p f)
	(let ((b (substring f 0 -3)))
	  (message ".emacs: loading linux debugging support library %s" f)
	  (load-library b)))))

(defun elc-integer-series (start end incr)
  "create a list of increasing integers from start (inclusive) 
to end (exclusive), stepping by incr"
  (let ((i start) (ints nil))
    (while (< i end)
      (setq ints (append ints (list i))
	    i (+ i incr)))
    ints))

;;; use longer tab stop lists
(setq tab-stop-list (elc-integer-series 8 300 8)
      elc-four-space-tab-stop-list (elc-integer-series 4 300 4))

;;; configure the load-path based on what's available
;;
(let ((paths '(
               "/usr/share/emacs/site-lisp"
	       "/usr/share/emacs/site-lisp/sml-mode"
	       "/usr/share/emacs/site-lisp/mgp"
	       "/usr/local/share/emacs/site-lisp"
	       "/opt/ocaml-3.06/share/emacs"
               "~/site-lisp/dismal-1.4"
               "~/site-lisp/bbdb"
               "~/site-lisp/gnus/lisp"
	       "~/site-lisp"
	       )))
  (mapc '(lambda (f)
	  (if f
	      (let ((dir (expand-file-name f)))
		(if (file-readable-p dir)
		    (add-to-list 'load-path dir)))))
	paths))

;;; cvs support configuration
(progn
  (setq vc-default-back-end "CVS")
  ;; I think that I want to see all the files.
  (setq vc-dired-terse-display nil))

(defun elc-kill-bbdb-buffers ()
  "unconditionally kill buffers associated with the BBDB"
  (interactive)
  (let ((victim-list '("*BBDB*" ".bbdb")))
    (mapcar 'elc-maybe-delete-buffer victim-list)))
(defun elc-maybe-delete-buffer (bufname)
  "Delete a buffer by name if it is not already killed"
  (interactive "sBuffer: ")
  (let ((victim (get-buffer bufname)))
     (if (buffer-live-p victim)
         (kill-buffer victim)
       (message "buffer not alive"))))
(defun elc-delete-nntpd-process()
  "kill bad process buffer when gnus is messed up"
  (interactive)
  (delete-process (get-process "nntpd")))

(defun alist-update (a key val)     ; is something like this extant already?
  (if a
      (let ((pair (car a)))
	(cons (if (equal (car pair) key)
		  (list key val)
		pair)
	      (alist-update (cdr a) key val)))))

(progn                                  ; prolog stuff
  (autoload 'run-prolog "prolog" "Start a Prolog sub-process." t)
  (autoload 'prolog-mode "prolog" "Major mode for editing Prolog programs." t)
  (autoload 'mercury-mode "prolog" "Major mode for editing Mercury programs." t)
  (setq prolog-system 'swi)
  (add-hook 'prolog-mode-hook
	    '(lambda ()
	      (if (consp prolog-program-name)
		  (setq prolog-program-name
			(alist-update prolog-program-name 'swi "swipl"))
		  (setq prolog-program-name
			"swipl"))))
  (add-to-list 'auto-mode-alist '("\\.plg$" . prolog-mode))
  (add-to-list 'auto-mode-alist '("\\.swi$" . prolog-mode))
  (defun elc-prolog ()
    "run prolog after setting stuff up (allows hooks to run before prolog)"
    (interactive)
    (setq debug-on-error t)
    (with-temp-buffer
      (prolog-mode))
    (run-prolog nil))
  (add-hook 'prolog-mode-hook 'turn-on-font-lock))

(progn                                  ; ruby stuff
  ;; used to be that font-lock-face-attributes had to be finished
  ;; before calling this, but now I use set-face-foreground above.
  (require 'font-lock)
  
  (autoload 'ruby-mode "ruby-mode"
    "Mode for editing ruby source files")
  (add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode))
  (setq interpreter-mode-alist (append '(("ruby" . ruby-mode))
                                       interpreter-mode-alist))
  (add-hook 'ruby-mode-hook 'turn-on-font-lock))

;;; Talk about handy!!  20001026
(defun elc-search-last-killed (&optional backwards)
  "search forward or backward in current buffer for regexp from kill ring"
  (interactive "p")
  (if (> backwards 1)
         (search-backward (car kill-ring-yank-pointer))
         (search-forward (car kill-ring-yank-pointer))))
;;; updated to get the X clipboard if applicable, elc 20001113,
;; but only the first search works.  Best leave it an emacs-only thing.
;; (defun elc-search-last-killed (&optional backwards)
;;   "search forward or backward in current buffer for regexp from kill ring"
;;   (interactive "p")
;;   (if (> backwards 1)
;;       (search-backward (or (x-cut-buffer-or-selection-value)
;;                            (car kill-ring-yank-pointer)))
;;       (search-forward (or (x-cut-buffer-or-selection-value)
;;                           (car kill-ring-yank-pointer)))))
(defun elc-search-last-killed-backward ()
  "search backward in current buffer for regexp from kill ring"
  (interactive)
  (elc-search-last-killed 4))

(defun elc-integrit-cc-notice ()
  "insert notice about Cc'ing the integrit-users list"
  (interactive)
  (insert "(Cc'ed to integrit-users mailing list.  For more info, see:
  http://sourceforge.net/mail/?group_id=15369)
"))

(defun elc-comment-line (prefix suffix)
  "make current line into a comment that starts with PREFIX and ends with 
SUFFIX, leaving point between them, after indenting the line"
  (interactive)
  (indent-according-to-mode)
  (insert prefix)
  (let ((finishpt (point))
	(eol))
    (end-of-line)
    (setq eol (point))
    (skip-chars-backward " \t" finishpt)
    (delete-region (point) eol)
    (insert suffix)
    (goto-char finishpt)))

;; unused ;;;; Key customizations. 
;; unused ;;; 
;; unused ;;; from Kai Grossjohann's tutorial at:
;; unused ;;;   http://ls6-www.cs.uni-dortmund.de/~grossjoh/emacs/tutorials.html
;; unused ;;; 
;; unused ;;; All key bindings of the form C-c x where x is any letter are
;; unused ;;; reserved for the user. This means that you can count on all
;; unused ;;; well-behaved packages not to clobber these bindings. Please note
;; unused ;;; that bindings for non-letters might be used by major modes.
;; unused ;;; 
;; unused ;(define-prefix-command 'elc-keymap)	; my keymap
;; unused ;(global-set-key "\C-ck" 'elc-keymap)
;; unused ;(define-key elc-keymap "e" 'ediff-buffers)
;; unused ;;; 
;; unused ;(global-set-key "\C-c\t" 'tab-to-tab-stop)
;; unused ;(global-set-key [f12] 'elc-insert-regular-sig)

(global-set-key [f8] 'ediff-buffers)
(global-set-key [f9] '(lambda () ; just run the compile command
			(interactive)
			(compile compile-command)))
(global-set-key [f5] '(lambda () ; c-style comments
			(interactive)
			(elc-comment-line
			 (if (and (boundp 'comment-start) comment-start)
			     (if (char-equal
				  (aref comment-start (1- (length comment-start)))
				  ? )
				 comment-start
				 (concat comment-start " "))
			     "/* ")
			 (if (and (boundp 'comment-end) comment-end)
			     (if (char-equal
				  (aref comment-end 0)
				  ? )
				 comment-end
				 (concat " " comment-end))
			     " */"))))
(global-set-key [f6] '(lambda () ; javadoc-style comments
			(interactive)
			(elc-comment-line "/** " " */")))
(global-set-key [f4] 'elc-search-last-killed-backward)
(global-set-key [f3] 'elc-search-last-killed)
(global-set-key "\C-ci" 'ispell-region)
(global-set-key "\C-c\C-z." 'browse-url-at-point)
;; (global-set-key [C-tab] 'move-to-tab-stop)
(global-set-key "\C-xg" 'goto-line)
(global-set-key "\C-x\C-b" 'electric-buffer-list)
;; (global-set-key "\M-*" 'query-replace-regexp)

(defun elc-smaller-fill-column (&optional ncols)
  "set the fillcol to smaller value: default 55"
  (interactive "p")
  (let ((default-cols 55))
    (if (= ncols 1)
        (setq ncols default-cols))
    (setq fill-column ncols)
    (message (concat "set fill-column to " (number-to-string ncols)))))
(global-set-key "\C-x\M-f" 'elc-smaller-fill-column)

;;; unconditionally revert a buffer quickly to its state on disk
;;;
;;; based on Jacques Duthen's revt in gnu.emacs.help
;; Message-ID: <36303C68.42D@aigf.sncf.fr>#1/1
(defun revt ()
  "Replace the buffer text with the text of the visited file on disk.
This undoes all changes since the file was visited or saved."
  (interactive)
  (save-excursion
    (revert-buffer 'nil 't)))

(require 'browse-url)

(condition-case err
    (load "galeon-new-tab")		; contains browse-url-galeon
  (error
   (message "Cannot load galeon-new-tab %s" (cdr err))))

;;;; ------ This is a nice way to get a separate browser window
;;;  ------ for the links you click in gnus.
;; based on post by Karl Kleinpaste 
;; on gnu.emacs.gnus, Message-ID: #1/1
(setq browse-url-browser-function
      '(lambda (url &optional new-window)
	 (setq browse-url-new-window-flag t)
	 (browse-url-galeon url nil)))

(defun elc-emacs-lisp-stuff ()
  "set thangs up fer emacs lisp"
  (define-key emacs-lisp-mode-map "\C-j" 'newline-and-indent))
(add-hook 'emacs-lisp-mode-hook 'elc-emacs-lisp-stuff)

(defun elc-text-mode-setup ()
  "Ed's customizations for text mode"
  (turn-on-auto-fill)			; fancy line wrapping
  (make-local-variable 'tab-stop-list)	; use four-space tabs
  (setq tab-stop-list elc-four-space-tab-stop-list))

(defun elc-sgml-stuff ()
  "Idiosyncrasies for SGML mode"
  ;; turn off auto-fill-mode for XML documents
  (if (string-match "\\.xml$" (buffer-file-name))
      (if (auto-fill-mode) (auto-fill-mode))))
(add-hook 'sgml-mode-hook 'elc-sgml-stuff)

(defun is-kernel-dir (dirname)
  (find-if (lambda (d)
	     (message "is-kernel-dir: dirname %s regexp %s" dirname d)
	     (let ((match (string-match d cwd)))
	       ; (message "match %s" match)
	       (and match
		    (= match 0))))
	   elc-kernel-dir-regexps))

(defun in-kernel (prefix)
  "is current buffer associated under a kernel-source directory?"
  (interactive "p")
  (let* ((verbose (> prefix 1))
	 (cwd (expand-file-name default-directory))
	 (result (is-kernel-dir cwd)))
    (if verbose
	(message "in-kernel :%s: %s" result
		 (if result "yes" "no")))
    result))

(defun kernel-srcdir ()
  "the base kernel source directory that is likely to be 
relevant to the default buffer."
  (interactive)
  (let ((cwd (expand-file-name default-directory)))
    (labels ((updir (d) 
	       (file-name-directory (directory-file-name d))))
      (or (loop while (is-kernel-dir cwd)
		do (progn
		     (message "kernel-srcdir cwd: %s" cwd)
		     (if (and (file-exists-p (concat (file-name-directory cwd)
						     "REPORTING-BUGS"))
			      (file-directory-p (concat (file-name-directory cwd)
							"Documentation")))
			 (return cwd)
			 (setq cwd (updir cwd)))))
	  default-kernel-srcdir))))
	
(defun elc-c-stuff ()
    "My own C stuff."
    (modify-syntax-entry ?_ "w")
    (c-set-offset 'defun-block-intro '4) ; gonna modify the block
                                         ; statement offset!
    (c-set-offset 'case-label '+)
    (c-set-offset 'brace-list-open '+)
    (c-set-offset 'substatement-open 0)
    (condition-case err
        (line-number-mode t)
      (error
       (message "Cannot display line numbers %s" (cdr err))))

    ;; ELC: new variables:
    (setq c-tab-always-indent t)
    (setq c-electric-pound-behavior '(alignleft))
    (setq c-macro-shrink-window-flag t)
    (setq c-macro-prompt-flag t)
    (set (make-local-variable 'dabbrev-case-fold-search) nil)
    (set (make-local-variable 'dabbrev-case-replace) nil)
    ; (define-key c-mode-map "\C-c %" 'match-paren)
    ; (define-key c-mode-map "\C-j" 'newline)
    ; (define-key c-mode-map "\C-m" 'newline-and-indent)
    (setq c-mode-auto-newline nil)
    (require 'cl)
    (if (in-kernel 0)
	(linux-c-setup)))

(defun elc-c++-stuff ()
  "my customizations for C++ mode"
  (c-set-offset 'topmost-intro 2))	; this is too much 

(add-hook 'c-mode-common-hook 'elc-c-stuff)
;; (add-hook 'c-mode-hook 'elc-c-stuff)
(add-hook 'c-mode-common-hook 'turn-on-font-lock)
;; (add-hook 'c++-mode-hook 'elc-c++-stuff)

(add-hook 'sh-mode-hook 'turn-on-font-lock)
(add-hook 'm4-mode-hook 'turn-on-font-lock)
(add-hook 'text-mode-hook 'elc-text-mode-setup)

(defun elc-perl-stuff ()
    "My own Perl stuff."
    (condition-case err
        (line-number-mode t)
      (error
       (message "Cannot display line numbers %s" (cdr err))))
    (setq perl-tab-always-indent t)
    ;(setq perl-indent-level 4) ;--the default is 4
    (setq perl-continued-statement-offset 2)
    (define-key perl-mode-map "\C-c\C-c" 'comment-region))
(add-hook 'perl-mode-hook 'elc-perl-stuff)
(add-hook 'perl-mode-hook 'font-lock-mode)

(add-hook 'emacs-lisp-mode-hook 'turn-on-font-lock)
(add-hook 'lisp-mode-hook 'turn-on-font-lock)

;; ;;; We want to find all the documentation.
(setq Info-directory-list Info-default-directory-list)
(let ((dirs '("/inst/info"
	      "/usr/info"
              "/usr/share/info"
              "/usr/lib/info" 
              "/usr/local/info"
              "/usr/X11R6/info"
              "~/doc/info"
	      "~/site-lisp/gnus/texi"
              "/usr/local/lib/info")))
  (mapc '(lambda (d)
	  (let ((dir (expand-file-name d)))
	    (if (file-readable-p dir)
		(add-to-list 'Info-directory-list dir))))
	dirs))

(defun elc-info-stuff ()
  "My own Info stuff.  Currently sets faces and some variables."
    (set-face-foreground 'info-xref     "yellow")
    (set-face-foreground 'info-node     "red")
    (setq automatic-footnotes "On"))
(add-hook 'Info-mode-hook 'elc-info-stuff)

(setq auto-mode-alist
      (append '(("\\.txh$"  . texinfo-mode))
              auto-mode-alist))

(add-hook 'texinfo-mode-hook 'turn-on-font-lock)
(add-hook 'change-log-mode-hook 'turn-on-font-lock)

;;;; my indention function
(defun indent-tab-stop-or-relative (&optional unindented-ok)
"indent even under blank line.  indent to beginning of last line if
non-blank"
  (interactive "P")
  (if (and abbrev-mode
	   (eq (char-syntax (preceding-char)) ?w))
      (expand-abbrev))
  (let ((indent nil))
    (save-excursion
      (beginning-of-line)
      ;; if we're not on the first line
      (if (save-excursion (re-search-backward "\n" nil t))
	  (progn
	    (forward-line -1)
	    (if (looking-at "[[ \t]")
		(progn
		  (skip-chars-forward " \t[")
		  (setq indent (current-column)))))))
    (let ((opoint (point-marker)))
      (delete-horizontal-space)
      (if indent
	  (indent-to indent)
	(tab-to-tab-stop))
      (if (> opoint (point))
	  (goto-char opoint))
      (move-marker opoint nil))))

; (setq tex-mode-hook nil)
(add-hook
 'tex-mode-hook
 '(lambda ()
    "my own tex stuff.  enough misery!!!"
    (make-local-variable 'tab-stop-list)
    (setq tab-stop-list elc-four-space-tab-stop-list)
    (local-set-key "\C-j" 'newline-and-indent)
    (local-set-key "\t" 'indent-tab-stop-or-relative)))

;;; This fontifies the compilation buffer when compilation exits.
(defun my-compilation-finish-function (buf msg)
  "This is called after the compilation exits.  Currently just
highlights the compilation messages."
  (save-excursion
    (set-buffer buf)
    (font-lock-fontify-buffer)))
(setq compilation-finish-function 'my-compilation-finish-function)

;;; For when I'm developing with tramp and do "make > compile.out 2>&1"
;;
(defun elc-compilation-open ()
  "put a broom in your room"
  (interactive)
  (compilation-mode)
  (font-lock-fontify-buffer))

(add-to-list 'auto-mode-alist
	     '("compile\\.out$" . elc-compilation-open))


;;; This exists because I have to type the filename a lot.
(defun elc-insert-buffer-file-name()
  (interactive)
  (insert (or
           (buffer-file-name) "(no file)")))
(defun elc-insert-regular-sig ()
  "insert the regular sig file contents at point"
  (interactive)
  (save-excursion
    (insert "\n-- \n")
    (insert-file-contents "/home/ecashin/.signature.normal")))

;;; enable lazy lock feature
;; Setting this to t makes scrolling faster, but may momentarily
;; present unfontified areas when you scroll into them.
(progn 
  (setq lazy-lock-defer-on-scrolling t)
  ;; (autoload 'turn-on-lazy-lock "lazy-lock"
  ;;  "Unconditionally turn on Lazy Lock mode.")
  (setq font-lock-support-mode 'lazy-lock-mode)
  ;; (add-hook 'font-lock-mode-hook 'turn-on-lazy-lock)
  (setq lazy-lock-minimum-size (* 4 1024))
  (setq lazy-lock-stealth-time 3)
  (setq lazy-lock-defer-time 0.15)
  (setq lazy-lock-stealth-nice 1)
  (setq lazy-lock-stealth-lines 60)
  (setq font-lock-maximum-size nil))

;;; This enables archive browsing and editing.
(setq auto-mode-alist
      (cons '("\\.\\(arc\\|zip\\|lzh\\|zoo\\)\\'" . archive-mode)
            auto-mode-alist))
(autoload 'archive-mode "arc-mode" "Major mode for editing archives." t)

;;; This installs `dired-x.el' when `dired' is first invoked, and also
;;; replaces `find-file' with `dired-x-find-file'.
(add-hook 'dired-load-hook
          (function (lambda ()
	    ;; (elc) I find it annoying when markers follow
	    ;; copied or moved files.
	    (setq dired-keep-marker-rename nil)
	    (setq dired-keep-marker-copy nil)
	    (setq dired-keep-marker-hardlink nil)
	    (setq dired-keep-marker-symlink nil)
	    (setq dired-x-hands-off-my-keys nil)
	    (load "dired-x")
	    ;; Set dired-x global variables here.  For example:
	    ;; (setq dired-guess-shell-gnutar "gtar")
	    (setq dired-no-confirm
		  '(byte-compile chmod compress copy load move
		    print shell symlink uncompress)))))

;;; (add-hook 'dired-mode-hook
;;;           (function (lambda ()
;;;                       ;; Set dired-x buffer-local variables here.  For
;;;                       ;; example: (setq dired-omit-files-p t)
;;;                       )))

(add-hook 'dired-mode-hook
          (lambda ()
	    (local-set-key "\C-c\C-zf" 'browse-url-of-dired-file)))

;;; 20010115
(defun elc-asm-stuff ()
  "set up assembly mode nice and sleazy like"
  (interactive)
  ; set buffer variable comment-start to "# "
  (make-local-variable 'asm-comment-char)
  (setq asm-comment-char ?\#); gas-style (also spim)
  (font-lock-mode))
(add-hook 'asm-mode-hook 'elc-asm-stuff)

(add-hook 'makefile-mode-hook 'turn-on-font-lock)
(add-hook 'metapost-mode-hook 'turn-on-font-lock)

;;; Ps-Print customization.
;;(setq ps-header-lines 3)
;;(setq ps-paper-type 'ps-a4)
(setq printer-name "lp")
;(setq printer-name "oit_cs")
; (setq lpr-switches '("-h"))
(setq ps-print-color-p nil)

(condition-case err
    (progn
      ;;-------------MailCrypt
      (load-library "mailcrypt")
      ;;(mc-setversion "gpg")
      ;;(mc-setversion "5.0")
      (mc-setversion "gpg")
      (autoload 'mc-install-write-mode "mailcrypt" nil t)
      (autoload 'mc-install-read-mode "mailcrypt" nil t)
      (add-hook 'mail-mode-hook 'mc-install-write-mode)
      (add-hook 'rmail-show-message-hook 'mc-install-read-mode)
      (add-hook 'rmail-summary-mode-hook 'mc-install-read-mode)
      (add-hook 'gnus-summary-mode-hook 'mc-install-read-mode)
      (add-hook 'message-mode-hook 'mc-install-write-mode)
      (add-hook 'news-reply-mode-hook 'mc-install-write-mode)
      (setq mc-encrypt-for-me t)
      (setq mc-pgp-always-sign t)
      ;; (setq mc-pgp-user-id "ecashin")
      (setq mc-pgp-user-id "ecashin@uga.edu"
	    mc-gpg-user-id mc-pgp-user-id
	    mc-passwd-timeout 360)
      'configured-mailcrypt)
  (error
   (message "Cannot initialize mailcrypt %s" (cdr err))))

;;; try to get Insidious Big Brother Database going, but don't freak on failure
(condition-case err
    (progn
      (require 'bbdb)
      (bbdb-initialize 'gnus 'message)
      (bbdb-insinuate-message)
      (setq bbdb/news-auto-create-p t)
      (setq bbdb-offer-save "Danger, Will Robinson!!")
      (setq bbdb-info-file (expand-file-name "~/doc/info/bbdb.info"))
      (setq bbdb-notice-hook 'bbdb-auto-notes-hook)
      ;; (setq bbdb-auto-notes-alist
      ;;       '(("Organization"  (".+" company 0))
      ;;         ("Newsgroups"     (".+" groups 0))))
      )
  (error
   (message "Cannot initialize bbdb %s" (cdr err))))

;;; auto-compression-mode means turn on automatic decompression of
;; visited files, e.g., *tar.gz files, so that tar-mode can work!
;; Whoo!  This rocks.  
(message
 (progn
   ;; turn it on (it's a toggle, so the "or" will turn it on)
   (or (auto-compression-mode)
       (auto-compression-mode))
   "Auto (de)compression of visited files is now ON."))

(setq bbdb-electric-p nil)

;;; finally, I submit to all the broken email server software out
;; there: use SMTP to send mail instead of sending it out from kali;
;; since everyone always assumes kali can receive mail if she sends it.
(progn (setq message-send-mail-function 'smtpmail-send-it
             send-mail-function 'smtpmail-send-it
	     ; smtpmail-default-smtp-server "smtp.charter.net"
             ; smtpmail-default-smtp-server "mail.charter.net"
	     ; smtpmail-default-smtp-server "smtp.directvinternet.com"
	     smtpmail-default-smtp-server "127.0.0.1"
             ; smtpmail-smtp-server "mail.charter.net"
	     ; smtpmail-smtp-server "smtp.charter.net"
	     ; smtpmail-smtp-server "smtp.directvinternet.com"
	     smtpmail-smtp-server "127.0.0.1"
             smtpmail-smtp-service "smtp"
             ; smtpmail-local-domain "terry.uga.edu"
	     ; smtpmail-local-domain "cs.uga.edu"
	     smtpmail-smtp-service (let ((host (shell-command-to-string "hostname")))
				     (if (equal host "marblerye\n")
					 "smtp"
					 2525))
             smtpmail-debug-info t)
       (load-library "smtpmail")
       (setq smtpmail-code-conv-from nil)
       (setq user-full-name "Ed L Cashin"))

(setq auto-mode-alist
  (append '(("\\.sql$" . fundamental-mode)) auto-mode-alist))
;;; .mak means it's probably a makefile
(setq auto-mode-alist
  (append '(("\\.mak$" . makefile-mode)
            ("\\.mak.in$" . makefile-mode)) auto-mode-alist))

;;; I use "*.htpt" for HTML templates
(add-to-list 'auto-mode-alist
             '("\\.htpt$" . html-mode))
(defun elc-html-stuff ()
  "set up html mode nice and sleazy like"
  (interactive)
  (if (auto-fill-mode) (auto-fill-mode)))
(add-hook 'html-mode-hook 'elc-html-stuff)

;;;; psgml support
(progn
  (autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t)
  (autoload 'xml-mode "psgml" "Major mode to edit XML files." t)
  (add-to-list 'auto-mode-alist '("\\.xhtml$" . sgml-mode)))

;;;; because FreeBSD make is a different beast
; (setq compile-command "gmake -k ")
(setq c-macro-preprocessor "/usr/bin/cpp -C")

;;;; handle re2c source files
(add-to-list 'auto-mode-alist '("\\.re$" . c-mode))

;;;; obviously objc
(add-to-list 'auto-mode-alist
             '("^\/usr\/include\/objc\/.*\\.h$" . objc-mode))

(condition-case err
    (let* ((ddir (expand-file-name "~/site-lisp/dismal-1.4"))
	   (dmodefile (concat ddir "/dismal")))
      (load "dismal-mode-defaults.el")
      ;; (setq dismal-directory
      ;;       "/psyc/lang/soar/emacs/utils/dismal/new")
      ;; (defvar dismal-directory
      ;;   ddir
      ;;   "Directory where dismal lives.  Automatically loaded to load-path.")
      (autoload 'dismal-mode
	  ;; the path to dismal goes here:
	  dmodefile
	"The dismal code." t)
      ;; This make any new file ending in .dis get opened up into dismal-mode
      (if (not (assoc "\\.dis$" auto-mode-alist))
	  (set-default 'auto-mode-alist
		       (append (mapcar '(lambda (x) (cons x 'dismal-mode))
				       '("\\.dis$"))
			       auto-mode-alist))))
  (error (message "Cannot setup dismal %s" (cdr err))))

;; when your cursor is magenta you don't want it blinking at you.
(blink-cursor-mode nil)

;; don't use emacs 21's toolbar
(if (boundp 'tool-bar-mode)
    (tool-bar-mode nil))

;;; debugger generally isn't necessary
(setq eval-expression-debug-on-error nil
      debug-on-error nil)

;; make searches case insensitive by default
(setq-default case-fold-search 't)

;;; so that vi users with custom tabs can see my indentation
; (setq-default indent-tabs-mode nil)

;; ilisp configuration
(if (boundp 'ilisp-*directory*)
    ;; don't use old C-z ilisp key prefix
    (setq ilisp-*use-fsf-compliant-keybindings* t))

;; From: cracauer@counter.bik-gmbh.de (Martin Cracauer)
;; Newsgroups: comp.lang.lisp
;; Subject: Re: *Good* EMACS Lisp mode?
;; Date: 21 Mar 2002 00:46:55 +0100
;; Organization: BIK GmbH Hamburg/Germany
;; Message-ID: 
;; 
;; Nils Goesche  writes:
;; 
;; >I haven't used ILISP for quite some time, but does this work:
;; 
;; >(setq lisp-indent-function 'common-lisp-indent-function)
;; 
;; After doing
;; (require 'cl)
;; 
;; it does.
;; 
;; Thanks!
;; 
;; Martin
;; -- 
;; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
;; Martin Cracauer  http://www.bik-gmbh.de/~cracauer/
;; FreeBSD - where you want to go. Today. http://www.freebsd.org/
(require 'cl)
(setq lisp-indent-function 'common-lisp-indent-function)

;;;; sml support (assumes sml-mode dir has been added to load path already)
;;
(condition-case err                     ; load sml-mode if available
    (load "sml-mode/sml-mode-startup")
  (error
   (message "Cannot load emacs sml support %s" (cdr err))))

(add-hook 'sml-mode-hook 'turn-on-font-lock)
(add-hook 'caml-mode-hook 'turn-on-font-lock)

(progn					; icon conf
  (add-to-list 'auto-mode-alist '("\\.icn$" . icon-mode))
  (add-hook 'icon-mode-hook 'turn-on-font-lock))

(progn					; goo stuff
  (autoload 'goo-mode "goo" "Major mode for editing Goo source." t)
  (autoload 'run-goo  "goo-shell" "Run an inferior Goo process." t)
  (add-to-list 'auto-mode-alist '("\\.goo$" . goo-mode))
  (setq goo-program-name "/inst/bin/goo"))

;; From: Kevin Rodgers 
;; Subject: Re: customize messing up .emacs symlink?
;; Newsgroups: gnu.emacs.help
;; Date: Tue, 02 Mar 2004 11:52:40 -0700
;; 
;; Ed L Cashin wrote:
;; 
;; > Hi.  I have a .emacs file under version control and symlinked into my
;; > home directory.  Every once in a while, emacs replaces my symlink and
;; > creates a regular file.
;; > Just now I sent some usenet news and saw a message flash by:
;; >   Wrote /home/ecashin/.emacs
;; >   Sending news via news.gmane.org using nntp...
;; >   Opening nnimap server on 127.0.0.1...
;; > The difference between the old .emacs and the impostor is shown
;; > below.  It leads me to suspect that the customize code of the two
;; > emacs versions I use are competing.  I wish they would leave .emacs
;; > alone, since I edit it myself and like
;; > the symlink.
;; 
(setq custom-file "~/emacs.custom")
;; 
;; -- 
;; Kevin Rodgers

(defun mips-asm-mode ()
  "asm mode with adjusted defaults for use MIPS asm."
  (interactive)
  (setq asm-comment-char ?\#)
  (asm-mode))

(setq tramp-default-method "scp")
; (setq tramp-default-method "su")

;;; caml-mode stuff
(setq caml-lookback-limit 50000000)

;;; these functions are for editing files on virtual machines running on jeremy
(progn
  (defun elc-jeremy-ip ()
    (or (getenv "JEREMY")
	"128.192.4.194"))
  ;;   (let ((jeremy-ip (getenv "JEREMY")))
  ;;     (if (not jeremy-ip)
  ;;         (error "no $JEREMY in environment")
  ;;         jeremy-ip)))

  (defun elc-get-jeremy-vm-ip (vm-number)
    "get the jeremy-internal VMWare network IP number for a VM
VM-NUMBER is either one or two"
    (let ((cmd (format "printf \"%%s\" \"`ssh %s 'vm-ip %d'`\"" 
		       (elc-jeremy-ip) vm-number)))
      (message "running command: %s" cmd)
      (shell-command-to-string cmd)))

  (defun elc-browse-vm (vm-number)
    (interactive "nWhich vm (1 or 2)? ")
    (if (not (or (= vm-number 1)
		 (= vm-number 2)))
	(error "%d isn't a VM" vm-number)
	(let* ((vm-ip (elc-get-jeremy-vm-ip vm-number))
	       (fname (format "/[multiu/ssh:ecashin@%s/ssh:ecashin@%s]/home/ecashin"
			      (elc-jeremy-ip) vm-ip)))
	  (message "finding file %s ..." fname)
	  (find-file fname)))))

; (progn					; man setup
;   (setq Man-notify-method 'aggressive)	; go to man window when it's ready 
;   'elc-man-setup)

;;;; I don't want gnus fetching images from spammers
(setq w3-image-size-restriction 0)

;;;; this is something new: quit gnus when receiving signal SIGUSR1
(defun elc-exit-gnus ()
  "go to the group buffer (if it's there) and exit gnus"
  (interactive)
  (message "Hear that lonesome whipporwhil")
  (save-excursion 
    (let ((g (get-buffer "*Group*"))
	  (gnus-interactive-exit nil))
      (if g
	  (with-current-buffer g
	    (gnus-group-exit))))))

;;;; this is right out of Robert Spier's Dec 14, 1997 gnu.emacs.bug
;;;  patch, but it doesn't work, possibly because of RMS' 1999 
;;;  changes, which create an event instead of running the handler.
;;;
(add-hook 'signal-USR1-hook (function
    (lambda ()
      (message "HI!!!"))))

(progn					; setup for ESS
  ;; remassoc exists as a built-in function in xemacs, but
  ;; not in GNU emacs
  ;;
  (if (not (functionp 'remassoc))
      (defun remassoc (key a)     
	"remove an association pair from an alist"
	(if a
	    (let ((pair (car a)))
	      (if (equal (car pair) key)
		  (cdr a)
		  (cons pair (remassoc key (cdr a))))))))

  (defun un-annex-asm-extns ()
    "take away the association for .s and .S files added by ESS"
    (if (assoc "\\.[qsS]\\'" auto-mode-alist)
	(progn
	  (setq auto-mode-alist
		(remassoc "\\.[qsS]\\'" auto-mode-alist))
	  ;; put .q extention back
	  (add-to-list 'auto-mode-alist '("\\.q\\'" . S-mode)))))

  ;; doesn't work ;; (add-hook 'ess-mode-load-hook 'un-annex-asm-extns)
  (add-hook 'ess-mode-hook 'un-annex-asm-extns)
  (add-hook 'inferior-ess-mode-hook 'un-annex-asm-extns))

(progn					; comint setup
  (setq comint-input-ring-size 320))	; ten times more than usual

 
 
;;; -*- emacs-lisp -*- 

;;; --- from Plaksin -----------------------------------------------------
;; Newsrc
;; Keep it small and speedy
(setq gnus-check-new-newsgroups nil)
(setq gnus-save-killed-list nil)
(setq gnus-save-newsrc-file nil)
;; Do not backup newsrc
(defun map-gnus-turn-off-backup ()
  (set (make-local-variable 'backup-inhibited) t))
(add-hook 'gnus-save-quick-newsrc-hook 'map-gnus-turn-off-backup)
(add-hook 'gnus-save-standard-newsrc-hook 'map-gnus-turn-off-backup)
(setq gnus-button-url 'gnus-netscape-open-url)
;; don't CC: me in wide replies
(setq rmail-dont-reply-to-names
      (concat
       "ecashin@uga.edu"
       "\\|Ed Cashin "
       "\\|Ed L. Cashin "
       "\\|Ed L Cashin "
       "\\|cashin@cs.uga.edu"
       "\\|Ed Cashin "
       "\\|Ed L. Cashin "
       "\\|Ed L Cashin "
       "\\|ecashin@arches.uga.edu"
       "\\|Ed Cashin "
       "\\|Ed L. Cashin "
       "\\|Ed L Cashin "
       ))
(setq gnus-verbose 7)
(setq gnus-no-groups-message "No gnus is happy gnus!") ; much better than
                                        ; the default
;;; --- end from Plaksin -------------------------------------------------

; (require 'nnimap)
(add-to-list 'gnus-secondary-select-methods '(nnmbox ""))
(add-to-list
 'gnus-secondary-select-methods
 '(nnimap "marblerye" (nnimap-address "127.0.0.1") (nnimap-server-port 143)))
(add-to-list
 'gnus-secondary-select-methods
 '(nntp "gmane" (nntp-address "news.gmane.org")))

(setq gnus-message-archive-method
      '(nnimap "127.0.0.1"))
(setq gnus-message-archive-group
      '((if (message-news-p)
            "Mail/misc-news")
        (concat "Mail/sent-" (format-time-string "%Y%m" (current-time)))))

(setq gnus-move-split-methods
      '(("^To:.*[tT][cC][bB][cC][cC].*@"         "nnimap+ajax:Mail/tcbcc")
        ("^Cc:.*[tT][cC][bB][cC][cC].*@"         "nnimap+ajax:Mail/tcbcc")
	;; this rule doesn't work in older, buggy gnus versions
        ("^From:.*\\(piotr\\|misztal\\)@"         "nnimap+127.0.0.1:Mail/misztal")
        (".*"                    "nnimap+127.0.0.1:Mail/temp")))

(setq gnus-activate-foreign-newsgroups 2)
(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
(setq gnus-large-newsgroup 230000)      ; max int is 134,217,727
;; (setq gnus-activate-level 6) ; default six
(setq gnus-activate-level 2)

;;;    gnus-summary-line-format
;;;
;;;    default: "%U%R%z%I%(%[%4L: %-20,20n%]%) %s\n"
;;;    U:               unread
;;;    R:               secondary mark
;;;    z:               zscore
;;;    I:               indentation
;;;    [:               bracket
;;;    L:               number of lines
;;;    n:               name (from "From" header)
;;;    s:               subject
(setq gnus-extra-headers                '(To Newsgroups))
(setq nnimap-extra-headers gnus-extra-headers)
;(setq gnus-summary-line-format         "%%U%R%z%I%(%[%4L: %-20,20f%]%) %s\n")
;; include BBDB-known-person mark
(setq gnus-summary-line-format
      ; "%ub%U%R%z%I%(%[%4L: %-20,20f%]%) %s\n")
      "%U%R%z%I%(%[%4L: %-20,20f%]%) %s\n")
(setq gnus-ignored-from-addresses "ecashin")

;; This is necessary, since otherwise gnus will (correctly) add a
;; "Sender" field with ecashin@kali.coe.uga.edu in it.  Since some
;; email clients (incorrectly) try to send mail to kali, that
;; sender address is invalid.
;;
;; see FAQ: http://www.ccs.neu.edu/software/contrib/gnus/#Q2_15
(setq system-name "uga.edu")

;; ;; This is Kai's nice TAB-completion code for message mode.
;; ;; (in ~/site-lisp)
;; (require 'message-x)
;; 
;; ;; for bbdb, so that the little box doesn't pop up in gnus
;; (setq bbdb-use-pop-up nil)

(setq gnus-posting-styles
      '((".*"
         (signature-file "~/.signature"))
        ("^comp\."
         (signature-file "~/.signature.nomunge"))))

;; ;;; patched versions of functions in ~/site-lisp
;; ;;
;; ;; check these on upgrading gnus to see whether fixes have been
;; ;; incorporated into the release.
;; (load-library "my-get-split")
;; (load-library "sj-gnus-sum-expire")

;;;; nnfolder for archives.  With auto-compression-mode, these are very
;;; nice for storing gobs of old mail locally.
;;
;; to create new compressed folder:
;;
;;  1) create zero-byte file in ~/mail-archives, say "voldo"
;;  2) gzip voldo
;;  3) from another group, copy or move a couple messages
;;     to nnfolder:voldo.gz, answering that, "yes", the new
;;     group should be created
;;  4) use "U" in the group buffer to subscribe to the group
;;  5) set the level with "S l 3".
;;
;;; some mail folders are left out when nnfolder's active file is regenerated
(setq nnfolder-ignore-active-file t)

;; support for the Insidious Big Brother Database
(progn
  (require 'bbdb)
  (bbdb-initialize 'gnus 'message)
  (bbdb-insinuate-message)
  (setq bbdb/news-auto-create-p t)
  (setq bbdb-offer-save "Danger, Will Robinson!!")
  (setq bbdb-info-file (expand-file-name "~/doc/info/bbdb.info"))
  (setq bbdb-notice-hook 'bbdb-auto-notes-hook)
  (setq bbdb-auto-notes-alist
	'(("Organization"  (".+" company 0))
	  ("Newsgroups"     (".+" groups 0))))
  ;; for bbdb, so that the little box doesn't pop up in gnus
  (setq bbdb-use-pop-up nil))

;; ;; always forget previous uidvalidity info when group is not uid valid
;; (defun nnimap-possibly-change-group (group &optional server)
;;   "Make GROUP the current group, and SERVER the current server."
;;   (when (nnimap-possibly-change-server server)
;;     (with-current-buffer nnimap-server-buffer
;; 	 (if (or (null group) (imap-current-mailbox-p group))
;; 	     imap-current-mailbox
;; 	   (if (imap-mailbox-select group)
;; 	       (if (not (nnimap-verify-uidvalidity
;; 			 group (or server nnimap-current-server)))
;; 			; (zerop (imap-mailbox-get 'exists group))
;; 		   (let* ((gnusgroup (gnus-group-prefixed-name
;; 				      group (gnus-server-to-method
;; 					     (format "nnimap:%s" server))))
;; 			  (new-uidvalidity (imap-mailbox-get 'uidvalidity))
;; 			  (old-uidvalidity
;; 			   (gnus-group-get-parameter gnusgroup
;; 						     'uidvalidity)))
;; 		     (message
;; 		      (format "resetting group uidvalidity param %s to nil"
;; 			      old-uidvalidity))
;; 		     (gnus-group-set-parameter gnusgroup 'uidvalidity nil)
;; 		     imap-current-mailbox))
;; 	     (nnheader-report 'nnimap (imap-error-text)))))))
;; 

;; This is Kai's nice TAB-completion code for message mode.
;; (in ~/site-lisp)
(require 'message-x)

(setq gnus-read-active-file nil)

;; (if (gnus-treat-smiley)
;;     (gnus-treat-smiley))
(setq gnus-treat-display-smileys nil)

(defun elc-summary-mark-region-as-expired (point mark all)
  "Mark all unread articles between point and mark as expired.
If given a prefix, the behavior is the same.  (Too lazy to look it up.)"
  (interactive "r\nP")
  (save-excursion
    (let (article)
      (goto-char point)
      (beginning-of-line)
      (while (<= (point) mark)
	(let ((article (gnus-summary-article-number)))
	  (gnus-summary-mark-article article gnus-expirable-mark)
	  (next-line 1))))))

(progn					; moving in group buffer
  (defun elc-add-topic-motion-key-bindings ()
    (interactive)
    (local-set-key [C-next] 'forward-list)
    (local-set-key [C-prior] 'backward-list))
  (add-hook 'gnus-group-mode-hook 'elc-add-topic-motion-key-bindings))
 
 

TOP O THE PAGE to ya!