Newsgroups: bit.listserv.power-l
Date:         Thu, 17 Dec 1992 23:12:57 -0600
From:         Chris Petrilli <petrilli@GNU.AI.MIT.EDU>
Subject:      Re: GNUEmacs
              17 Dec 92 20:56:39 PST.) <9212180503.AA03409@geech.gnu.ai.mit.edu>

Well, for what it's worth, I've got a helatious .emacs file, and I've
attached a shar file with them in it.

If you have any questions, ask, this is a serious startup, as I use
Emacs VERY heavily :-).

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#               "End of shell archive."
# Contents:  .emacs .emacsrc.el
# Wrapped by petrilli@hal.gnu.ai.mit.edu on Thu Dec 17 23:11:47 1992
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f '.emacs' -a "${1}" != "-c" ; then
  echo shar: Will not clobber existing file \"'.emacs'\"
else
echo shar: Extracting \"'.emacs'\" \(1585 characters\)
sed "s/^X//" >'.emacs' <<'END_OF_FILE'
X;;;; $HOME/.emacs Chris Petrilli <petrilli@gnu.ai.mit.edu>
X;;;; Last modified Wed Jul 15 13:24:27 EDT 1992
X;;;; Mostly stolen from Roland McGrath
X
X(defun load-init-file (init)
X  (let ((initc (concat init "c"))
X       (compile-after-load nil))
X    (if (file-newer-than-file-p init initc)
X       (while (let* ((cursor-in-echo-area t)
X                     (help-form (format "\
X%s %s.
X
X1      Compile %s and then load it.
X2      Load %s, then compile %s.
X3      Just load %s.
X4      Just load %s (which is out of date).
X"
X                                        initc (if (file-exists-p initc)
X                                                  (format "is older than %s"
X                                                          init))
X                                        initc init initc init initc))
X                     (c (let ((inhibit-quit t))
X                           (insert help-form)
X                          (message "%s is not up to date.  What to do? "
X                                   initc)
X                          (prog1 (read-char)
X                            (setq quit-flag nil)))))
X                (cond ((= c ?1)
X                       (byte-compile-file init)
X                       (setq init initc)
X                       nil)
X                      ((= c ?2)
X                       (setq compile-after-load t)
X                       nil)
X                      ((= c ?3)
X                       nil)
X                      ((= c ?4)
X                       (setq init initc)
X                       nil)
X                      ((= c ?\C-g)
X                       (error "Well be that way!"))
X                      (t
X                       (recenter)
X                       t))))
X      (setq init initc))
X    (if inhibit-quit
X       (error "inhibit-quit is set!"))
X    (load init t t)
X    (if compile-after-load
X       (byte-compile-file init))))
X
X
X;; The startup message happens before term-setup-hook is called.
X(setq inhibit-startup-message t
X      load-path (cons (expand-file-name "~/lib/elisp") load-path)
X      term-setup-hook '(lambda ()
X                         (let ((debug-on-error t))
X                           (load-init-file "~/.emacsrc.el"))))
X
X;; eof
END_OF_FILE
if test 1585 -ne `wc -c <'.emacs'`; then
    echo shar: \"'.emacs'\" unpacked with wrong size!
fi
# end of '.emacs'
fi
if test -f '.emacsrc.el' -a "${1}" != "-c" ; then
  echo shar: Will not clobber existing file \"'.emacsrc.el'\"
else
echo shar: Extracting \"'.emacsrc.el'\" \(29953 characters\)
sed "s/^X//" >'.emacsrc.el' <<'END_OF_FILE'
X;;;; $HOME/.emacsrc.el by Chris Petrilli (petrilli@gnu.ai.mit.edu)
X;;;; Last modified Thu Dec 17 23:12:48 CST 1992
X
X;;; This file should be byte-compiled and loaded by $HOME/.emacs.
X;;; We could simply make this file .emacs, but it's rather large and
X;;; emacs would be slower without this being byte-compiled.
X
X;;;;;;
X;;; Flow-control within Emacs.
X;;;   Emacs 19 has one more argument to set-input-mode. We have to check for
X;;;   the version number and use the appropriate number of arguments.
X;;;;;;
X
X(if (>= (string-to-int emacs-version) 19)
X    (set-input-mode t nil nil)
X  (set-input-mode t nil))
X
X;;;;;;
X;;; Defuns (and other function-related things)
X;;;
X;;;     add-hook
X;;;     domain-name
X;;;     elisp-file-in-loadpath-p
X;;;     file-in-loadpath-p
X;;;     file-in-pathlist-p
X;;;     from
X;;;     get-pretty-buffer-file-name
X;;;     host-nickname
X;;;     insert-date-in-current-buffer
X;;;     insert-signature-file
X;;;     mail-add-header
X;;;     mail-remove-header
X;;;     mail-add-zippy-quote
X;;;     make-interactive
X;;;     my-c-mode
X;;;     override-default-variable-settings
X;;;     remap-minibuffer-keys
X;;;     safe-server-start
X;;;     set-mode-line-file-name
X;;;     set-my-default-mode-line-format
X;;;     shell-command-to-buffer
X;;;     start-process-shell-command
X;;;     who
X;;;     who-function
X;;;     who-what
X;;;;;;
X
X;; ----------
X (or (fboundp 'add-hook)
X    ;; From version 19 subr.el
X    (defun add-hook (hook function)
X      "Add to the value of HOOK the function FUNCTION unless already present.
XHOOK should be a symbol, and FUNCTION may be any valid function.
XHOOK's value should be a list of functions, not a single function.
XIf HOOK is void, it is first set to nil."
X      (or (boundp hook) (set hook nil))
X      (or (if (consp function)
X              ;; Clever way to tell whether a given lambda-expression
X              ;; is equal to anything in the hook.
X              (let ((tail (assoc (cdr function) (symbol-value hook))))
X                (equal function tail))
X            (memq function (symbol-value hook)))
X          (set hook (cons function (symbol-value hook))))))
X
X;; ----------
X(defun domain-name ()
X  "Gets the domain name of the current host and returns it as a string.
XThis is not an emacs builtin like system-name is.  If the domain name
Xcannot be found the return string is \"unknown\".  The external
Xprogram \"hostname\" is called first.  If it does not return a string
Xthat includes a domain (e.g.  \"hostname.domain.name\") then the
Xprogram \"domainname\" is called.  If neither of these programs can be
Xexecuted then the function assumes the domain name is unknown."
X  (interactive)
X  (let ((domain "unknown")
X        domain-name-buffer)
X    (save-excursion
X      (setq domain-name-buffer (generate-new-buffer "*domain-name*"))
X      (set-buffer domain-name-buffer)
X
X      (and (file-in-pathlist-p "hostname" exec-path)
X           (setq domain
X                 (progn
X                   (let (output-string)
X                     (call-process "hostname" nil t nil)
X                     (goto-char (point-min))
X                     (setq output-string (buffer-substring (point-min)
 (buffer-size)))
X                     (if (string-match "^[^.]*\\." output-string)
X                         (substring output-string (match-end 0))
X                       "unknown")))))
X      (and (equal domain "unknown")
X           (file-in-pathlist-p "domainname" exec-path)
X           (setq domain
X                 (progn
X                   (let (output-string)
X                     (call-process "domainname" nil t nil)
X                     (goto-char (point-min))
X                     (setq output-string (buffer-substring (point-min)
 (buffer-size)))
X                     (if (string-match "..*" output-string)
X                         output-string
X                       "unknown")))))
X      (kill-buffer domain-name-buffer))
X    domain))
X
X;; ----------
X;; This could probably be rewritten to use mapcar
X(defun elisp-file-in-loadpath-p (file-name)
X  "Returns t if there is an emacs lisp-library of the name FILENAME in
Xthe load-path list. Matching is first done by looking for the file
Xwith an .elc extension, an .el extension, and finally with no
Xextension at all, and returning t if any of the three are found. Nil
Xis returned otherwise."
X  (let ((extension-list (list ".elc" ".el" ""))
X        (file-found-p nil)
X        name-to-try)
X    (while (and (not file-found-p) (not (null extension-list)))
X      (setq name-to-try (concat file-name (car extension-list)))
X      (setq extension-list (cdr extension-list))
X      (setq file-found-p (file-in-loadpath-p name-to-try)))
X    (eval 'file-found-p)))
X
X;; ----------
X(defun file-in-loadpath-p (file-name)
X  "Returns t if the string argument FILENAME is a file name present in a
Xdirectory in the load-path list, otherwise returns nil."
X  (file-in-pathlist-p file-name load-path))
X
X;; ----------
X(defun file-in-pathlist-p (file-name path-list)
X  "Returns t if the string FILENAME is a file name which occurs in a
Xdirectory in the list PATHLIST, otherwise nil."
X  (let (try-path (file-found-in-path-p nil))
X    (while (not (or file-found-in-path-p (null path-list)))
X      (setq try-path (car path-list)
X            path-list (cdr path-list))
X      (if (file-exists-p (concat try-path "/" file-name))
X          (setq file-found-in-path-p t)))
X    (eval 'file-found-in-path-p)))
X
X;; ----------
X;; From Chris Petrilli <petrilli@gnu.ai.mit.edu>
X(defun finger ()
X  "Finger a user on the current system or on a remote system.  It first
Xprompts to user for a name."
X  (interactive)
X  (shell-command-to-buffer "finger" "*finger-process*"
X                           (read-string "Finger: ")))
X
X;; ----------
X(defun from ()
X  "Shows what mail you have, and from whom."
X  (interactive)
X  (shell-command-to-buffer "from" "*from*"))
X
X;; ----------
X(defun get-pretty-buffer-file-name ()
X  "Returns the file name associated with the current buffer, if there is
Xone.  If the path is within the user's home directory, then the
Xcomponent of the path which matches the home directory is replaced
Xwith a ~ character. "
X  (let ((filename (buffer-file-name))
X        (home (expand-file-name "~")))
X    (if (string-match (concat "^" (regexp-quote home)) filename)
X        (concat "~" (substring filename (match-end 0)))
X      filename)))
X
X;; ----------
X(defun host-nickname ()
X  "Returns a string which is the name of the current host up to any \".\"
Xor \"-\" character. Thus if the hostname is \"apple-gunkies.ai.mit.edu\"
Xthen the return string will just be \"apple\""
X  (let ((hostname (system-name)))
X    (substring hostname (string-match ".[^.-]*" hostname) (match-end 0))))
X
X;; ----------
X(defun insert-date-in-current-buffer ()
X  "Insert time and date in current buffer at point."
X  (interactive)
X  (call-process "date" nil t t))
X
X;; ----------
X(defun insert-signature-file ()
X  "Insert the contents of the users .sig file in their home directory.
XThis is usually a signature file, but any file could be loaded by
Xsetting the variable \"my-signature-file\" to the path of the file."
X  (interactive)
X  (if (not (file-exists-p my-signature-file))
X      (error (format "File does not seem to exist: %s" my-signature-file))
X    (if (file-readable-p my-signature-file)
X        (insert-file my-signature-file)
X      (error (format "Permission denied: %s" my-signature-file)))))
X;; Some variables to set for function insert-signature-file
X(defvar my-signature-file (expand-file-name "~/.signature")
X  "*The file inserted into the current buffer by the function
Xinsert-signature-file the default being \"~/.signature\"")
X
X;; From: mike-w@cs.aukuni.ac.nz (Mike Williams)
X;; Date: 8 Apr 91 16:20:41 GMT
X;;
X;;    If you want make sure that one (and only one) "Full-Name" field gets
X;;  added to all your mail, do something like:
X;;
X;;  (setq mail-setup-hook
X;;    '(lambda ()
X;;        (mail-add-header "Full-Name" (user-full-name))
X;;        ;; ... and the rest ...
X;;        ))
X;;
X;;  And for those of you who are bugged by the header:
X;;
X;;  (setq mail-setup-hook
X;;    '(lambda ()
X;;        (mail-remove-header "Full-Name")
X;;        ;; ... and the rest ...
X;;        ))
X
X;; ----------
X(defun mail-add-header (HEADER CONTENTS &optional REPLACE)
X  "Add the specified HEADER to the current mail message, with the given
XCONTENTS.
XIf the header already exists, the contents are left unchanged, unless optional
Xargument REPLACE is non-nil."
X  (save-excursion
X    (let ((header-exists (mail-position-on-field HEADER)))
X      ;; Delete old contents if REPLACE is set
X      (if (and header-exists REPLACE)
X         (let ((end (point))
X               (beg (progn
X                      (re-search-backward (concat HEADER ": "))
X                      (goto-char (match-end 0)))))
X           (delete-region beg end)))
X      ;; Add new contents if REPLACE is set, or this is a new header.
X      (if (or (not header-exists) REPLACE)
X         (progn (insert CONTENTS) CONTENTS)))))
X
X;; ----------
X(defun mail-remove-header (HEADER)
X  "Remove the specified HEADER from the current mail message."
X  (save-excursion
X    (if (mail-position-on-field HEADER 'soft)
X       (let ((end (point))
X             (beg (progn
X                    (re-search-backward (concat HEADER ": "))
X                    (goto-char (match-beginning 0)))))
X         (delete-region beg (1+ end))))))
X
X;; ----------
X;; Important pinheaddery.
X(defun mail-add-zippy-quote ()
X  "Add zippy quote into mail buffer.  Probably called by mail-setup hook"
X  (interactive)
X  (let (pinhead-buffer
X        pinhead-quote
X        (indent-string "   ")
X        (pinhead-header "X-Zippy-Says"))
X    (save-excursion
X      (setq pinhead-buffer (generate-new-buffer "*yow*"))
X      (set-buffer pinhead-buffer)
X      (call-process "yow" nil t nil)
X
X      (goto-char (point-min))
X      (insert (concat "\C-j" indent-string))
X
X      ;; Insert a tab before each line except first.
X      (while (= (forward-line 1) 0)
X        (while (and (not (= (point) (point-max)))
X                    (or
X                     (= (following-char) (string-to-char " "))
X                     (= (following-char) (string-to-char "     "))))
X          (delete-char 1)
X          (insert indent-string)))
X
X      (setq pinhead-quote (buffer-substring (point-min) (buffer-size)))
X      (kill-buffer pinhead-buffer))
X    (mail-add-header pinhead-header pinhead-quote)
X    (set-buffer-modified-p nil)))
X
X;; ----------
X;; More stuff stolen from Roland.
X(defun make-interactive (symbol &rest interactive-args)
X  "Make the function definition of SYMBOL an interactive command.
XRemaining arguments, if any, are passed to interactive in the function."
X  (let ((func (symbol-function symbol))
X       interactive)
X    (if (commandp func)
X       (let ((msg (format "%s is already interactively callable." symbol)))
X         (or (null interactive-args)
X             (y-or-n-p (concat msg "  Continue? "))
X             (error msg))))
X    (setq interactive (cons 'interactive interactive-args))
X    (if (subrp func)
X       (setq func
X             (list 'lambda '(&rest args) (documentation func) interactive
X                   (cons 'eval
X                         (list
X                          (cons '` (list (list 'funcall func '(,@ args))))
X                          ))))
X      (let ((funcar (car func))
X           (args (car (cdr func)))
X           doc body)
X       (setq doc (car (cdr (cdr func))))
X       (if (stringp doc)
X           (setq body (cdr (cdr (cdr func))))
X         (setq doc nil
X               body (cdr (cdr func))))
X       (setq func
X             (cons funcar
X                   (if doc (cons args (cons doc (cons interactive body)))
X                     (cons args (cons args (cons interactive body))))))
X       ))
X    (fset symbol func)))
X
X;; ----------
X(defun my-c-mode ()
X  "Just like C mode.  All this function does is make the various c-*
Xvariables buffer-local and set them to values I happen to like.  My
Xpreferences differ from the standard GNU format, so I can't use them
Xwhen I'm working on FSF code."
X  (interactive)
X  (c-mode)
X  (setq mode-name "mC")
X  (mapcar
X   (function
X    (lambda (pair)
X      (let ((variable (car pair))
X            (value (car (cdr pair))))
X        (make-local-variable (symbol-value 'variable))
X        (set (symbol-value 'variable) value))))
X   '((c-auto-newline nil)
X     (c-tab-always-indent nil)
X     (c-indent-level 1)
X     (c-continued-statement-offset 0)
X     (c-brace-offset 2)
X     (c-brace-imaginary-offset 2)
X     (c-argdecl-indent 1)
X     (c-label-offset 0))))
X
X;; ----------
X(defun override-default-variable-settings ()
X  "User defined function.  Intended to be called within various hooks to
Xoverride the value of buffer-local variables whose default values
Xmight have been overridden by the major mode."
X  (setq case-fold-search t
X        indent-tabs-mode nil
X        selective-display nil))
X
X;; ----------
X(defun remap-minibuffer-keys ()
X  "User defined function.  Remaps keys in the various minubuffer keymaps"
X  (mapcar '(lambda (key-defn-list)
X             (mapcar '(lambda (keymap)
X                        (define-key keymap (car key-defn-list)
X                          (car (cdr key-defn-list))))
X                     (list minibuffer-local-map
X                           minibuffer-local-completion-map
X                           minibuffer-local-must-match-map
X                           minibuffer-local-ns-map)))
X          '(("\C-w"             backward-kill-word)
X            ("\e\C-w"   minibuffer-kill-region))))
X
X;; ----------
X;; This was shamelessly pilfered from Christopher North-Keys' files.
X(defun safe-server-start ()
X  "Start the Emacs server process.  Once started, set the file protection
Xon the server socket to 0600.  This prevents other users from accessing
Xyour Emacs server without your permission (and maybe evaluating shell
Xcommands as you during local variable initialization). Invoked by
Xincluding this before you run server-start, and then using
Xsafe-server-start instead.  Note that this function does not work for
Xversions of emacs later than 18.56, since the location and name of the
Xserver socket has been changed."
X  (interactive)
X  (let ((server-socket (expand-file-name "~/.emacs_server")))
X    (server-start)
X    (while (not (file-exists-p server-socket))
X      (sleep-for 1));; wait for the socket to be created
X    (set-file-modes server-socket 384)))
X
X;; ----------
X;; This function must return nil or it will prevent buffers from ever
X;; being saved if it's called by write-file-hooks (read documentation
X;; for this hook to find out why).
X(defun set-mode-line-file-name ()
X  (let (name-if-any)
X    (if (setq name-if-any (get-pretty-buffer-file-name))
X        (setq mode-line-file-name (concat "-{" name-if-any "}"))
X      (setq mode-line-file-name nil)))
X  nil)
X
X;; ----------
X(defun set-my-default-mode-line-format ()
X  (setq-default mode-line-modified '("-%1*-"))
X  (setq-default mode-line-buffer-ident-prefix nil)
X  (setq-default mode-line-buffer-identification
X                (list (host-nickname)
X                      (if (= (user-uid) 0) "#" ":")
X                      " %b"))
X;  (setq-default mode-line-format
X;                '( "" mode-line-modified mode-line-buffer-ident-prefix
X;                   mode-line-buffer-identification "   "
X;                   global-mode-string "  " (-3 . "%p") " %[(" mode-name
X;                   minor-mode-alist "%n" mode-line-process ")%]"
X;                   mode-line-file-name "-%-")))
X  (setq-default mode-line-format
X                '( "" mode-line-modified mode-line-buffer-ident-prefix
X                   mode-line-buffer-identification "   "
X                   global-mode-string "  " (-3 . "%p") " (" mode-name
X                   minor-mode-alist "%n" mode-line-process ")"
X                   mode-line-file-name "-%-")))
X
X;; ----------
X;;Old version.  I might change my mind.
X;;(defun set-my-default-mode-line-format ()
X;;  (setq-default mode-line-modified '("-%1*-"))
X;;  (setq-default mode-line-buffer-ident-prefix nil)
X;;  (setq-default mode-line-buffer-identification
X;;                (list "Emacs"
X;;                      (if (= (user-uid) 0) "#" "@")
X;;                      (host-nickname)
X;;                      ": %b"))
X;;  (setq-default mode-line-format
X;;                '( "" mode-line-modified mode-line-buffer-ident-prefix
X;;                   mode-line-buffer-identification "   "
X;;                   global-mode-string "  %[(" mode-name minor-mode-alist
X;;                   "%n" mode-line-process ")%]--" (-3 . "%p") "-"
X;;                   mode-line-file-name "-%-")))
X
X;; ----------
X(defun shell-command-to-buffer (process-name buffer-name &rest args)
X  "Runs a command string PROCESS-NAME and puts it in buffer
XBUFFER-NAME.  Optional command args to process supplied by ARGS"
X  (set-buffer (get-buffer-create buffer-name))
X  (setq buffer-read-only nil)
X  (erase-buffer)
X  (apply 'call-process process-name nil t nil args)
X  (setq buffer-read-only t)
X  (goto-char (point-min))
X  (pop-to-buffer (current-buffer)))
X
X;; ----------
X(or (fboundp 'start-process-shell-command)
X    ;; From version 19 subr.el.
X    (defun start-process-shell-command (name buffer &rest args)
X      "Start a program in a subprocess.  Return the process object for it.
XArgs are NAME BUFFER COMMAND &rest COMMAND-ARGS.
XNAME is name for process.  It is modified if necessary to make it unique.
XBUFFER is the buffer or (buffer-name) to associate with the process.
X Process output goes at end of that buffer, unless you specify
X an output stream or filter function to handle the output.
X BUFFER may be also nil, meaning that this process is not associated
X with any buffer
XThird arg is command name, the name of a shell command.
XRemaining arguments are the arguments for the command.
XWildcards and redirection are handle as usual in the shell."
X      (if (eq system-type 'vax-vms)
X          (apply 'start-process name buffer args)
X        (start-process name buffer shell-file-name "-c"
X                       (concat "exec " (mapconcat 'identity args " "))))))
X
X;; ----------
X(defun who ()
X  "Show who's on in a buffer"
X  (interactive)
X  (shell-command-to-buffer "who" "*who-process*"))
X
X;; ----------
X(defun who-what ()
X  "Show who is on and what they're doing.  Boy are you nosy."
X  (interactive)
X  (shell-command-to-buffer "w" "*w-process*"))
X
X(fset 'elisp 'emacs-lisp-mode)
X(fset 'date 'insert-date-in-current-buffer)
X(fset 'sig 'insert-signature-file)
X(fset 'sh 'cmushell)
X;; Makes emacs complain a lot.  Almost as much as you.
X(fset 'whine '(lambda () (interactive) (load "whine" t t)))
X
X;;;;;;
X;;; Mode hooks
X;;;
X;;;    c-mode-hook
X;;;    cmushell-mode-hook
X;;;    disabled-command-hook
X;;;    emacs-lisp-mode-hook
X;;;    find-file-hooks
X;;;    lisp-interaction-mode-hook
X;;;    mail-mode-hook
X;;;    mail-setup-hook
X;;;    text-mode-hook
X;;;    write-file-hooks
X;;;;;;
X
X;; ----------
X(add-hook 'c-mode-hook
X          (function
X           (lambda ()
X             (override-default-variable-settings))))
X
X;; ----------
X(add-hook 'cmushell-mode-hook
X          (function
X           (lambda ()
X             (override-default-variable-settings)
X             (make-local-variable 'scroll-step)
X             (setq scroll-step 1))))
X
X;; ----------
X;; Automatically re-enable any command that happens to be disabled the
X;; first time it's called.  Yow!  Are we wizards yet?
X(setq disabled-command-hook
X      (function
X       (lambda (&rest args)
X         (put this-command 'disabled nil)
X         (call-interactively this-command))))
X
X;; ----------
X(add-hook 'emacs-lisp-mode-hook
X          (function
X           (lambda ()
X             (setq mode-name "Elisp")
X             (override-default-variable-settings)
X             (define-key emacs-lisp-mode-map "\^j" 'eval-print-last-sexp))))
X
X;; ----------
X(add-hook 'find-file-hooks 'set-mode-line-file-name)
X
X;; ----------
X(add-hook 'lisp-interaction-mode-hook
X          (function
X           (lambda ()
X             (override-default-variable-settings)
X             (setq mode-name "Lispint"))))
X
X;; ----------
X(add-hook 'mail-mode-hook
X          (function
X           (lambda ()
X             (override-default-variable-settings)
X             (define-key mail-mode-map "\C-cq" 'quote-region)
X             (or (boundp 'mail-abbrevs-already-loaded)
X                 (and (load "mail-abbrevs" t t)
X                      (setq mail-abbrevs-already-loaded t)))
X             (and (boundp 'mail-abbrevs-already-loaded)
X                  (progn
X                    (use-local-map mail-mode-map)
X                    (abbrev-mode 1))))))
X
X;; ----------
X(add-hook 'mail-setup-hook
X          (function
X           (lambda ()
X             ;; Yow!  Am I being suppressed yet?
X             (and (or (not (boundp 'suppress-zippy-quotes)) (not
 suppress-zippy-quotes))
X                  (mail-add-zippy-quote)))))
X
X;; ----------
X(add-hook 'text-mode-hook
X          (function
X           (lambda ()
X             ;; If for some reason the *scratch* buffer was killed earlier
X             ;; and is recreated here because all other buffers have been
X             ;; killed, then reset the major mode to emacs-lisp-mode.
X             ;; One disadvantage to this is that you can't put the
X             ;; *scratch* buffer in text mode without disabling this hook.
X             (if (equal (buffer-name) "*scratch*")
X                 (emacs-lisp-mode)
X               (progn
X                 (override-default-variable-settings)
X                 (turn-on-auto-fill)
X                 (setq fill-column 70))))))
X
X;; ----------
X(add-hook 'write-file-hooks 'set-mode-line-file-name)
X
X;;;;;;
X;;; Variables
X;;;  label "default" means default setting of buffer-local variable
X;;;
X;;;    PATH                                     ; environment
X;;;    load-path                                : global
X;;;    mode-line-modified                       : default
X;;;    mode-line-buffer-identification          : default
X;;;    mode-line-format                         : default
X;;;
X;;;  Defaults for buffer-locals (not listed here)
X;;;  Global variables (not listed here)
X;;;
X;;;;;;
X
X(and (fboundp 'setenv)
X     (progn
X       ;; Set the PATH environment variable from the exec-path so
X       ;; that child processes will inherit anything emacs uses.
X       (setenv "PATH"
X               (mapconcat
X                '(lambda (string) string)
X                exec-path
X                ":"))
X       ;; So that subprocesses will use emacs for editing.
X       (setenv "EDITOR" "emacsclient")
X       (setenv "VISUAL" "emacs-client")))
X
X;; Set the load-path, but only the first time this file is loaded.
X;; This way we don't keep adding the current load-path to itself if
X;; ~/.emacs is re-read.
X(or (boundp 'my-load-path-already-set)
X    (setq my-load-path-already-set t
X          load-path (append
X                     (list (expand-file-name "~petrilli/lib/elisp"))
X                     load-path
X                     '(".")
X                    '("/usr/local/lib/elisp/vm-5.31beta")
X                     '("/usr/local/lib/elisp/gnus")
X                     '("/usr/local/lib/elisp/misc")
X                     '("/usr/local/lib/elisp/tree-dired")
X                     '("/usr/local/lib/emacs/lisp"))))
X
X;; Set up the mode line with my own customization.  First define a
X;; variable I'll need.
X(make-variable-buffer-local 'mode-line-file-name)
X(setq-default mode-line-file-name nil)
X(set-my-default-mode-line-format)
X
X;; Set defaults of other buffer-local variables
X(setq-default case-fold-search t)
X(setq-default indent-tabs-mode nil)
X(setq-default selective-display nil)
X
X(setq my-emacs-shell-file-name (expand-file-name "/usr/local/bin/bash"))
X
X;; Global variables
X(setq
X   moby-bignum                          (/ (lsh (lsh -1 1) -1) 2)
X   blink-matching-paren-distance        moby-bignum
X   default-ctl-arrow                    t
X   default-major-mode                   'text-mode
X   default-abbrev-mode                  t
X   enable-recursive-minibuffers         t
X   fill-column                          70
X   dired-listing-switches               "-Fla"
X   explicit-shell-file-name             my-emacs-shell-file-name
X   gc-cons-threshold                    300000
X   Info-enable-edit                     nil
X   inhibit-local-variables              t
X   inhibit-startup-message              t
X   initial-major-mode                   'emacs-lisp-mode
X   max-lisp-eval-depth                  2000
X   max-specpdl-size                     2000
X   meta-flag                            t
X   require-final-newline                t
X   suppress-zippy-quotes                t
X   undo-threshold                       moby-bignum
X   undo-high-threshold                  moby-bignum
X   window-min-height                    1
X   window-min-width                     1)
X
X;; File backup and version control stuff. Middle backups are deleted
X;; without asking me because if I have that many backups I won't care
X;; or indeed even notice if I lose a few.
X(setq
X   version-control                      t
X   kept-old-versions                    moby-bignum
X   kept-new-versions                    moby-bignum
X   trim-versions-without-asking         t
X   backup-by-copying                    nil
X   backup-by-copying-when-linked        t)
X
X;;; C/C++ mode configuration stuff
X(setq
X   c-tab-always-indent                  nil
X   c-auto-newline                       t
X   c++-auto-hungry-delete-initial-state 'auto-only
X   c++-hangning-braces                  nil
X   c++-cleanuo-}-else-{-p               nil)
X
X
X;;;;;;
X;;; Key bindings
X;;;;;;
X
X;; Global key bindings (WARNING: Some of these replace default
X;; bindings and may thus confuse novice users)
X(global-set-key "\C-c\C-a"      'add-change-log-entry)
X(global-set-key "\C-?"          'backward-delete-char-untabify)
X(global-set-key "\C-w"          'backward-kill-word)
X(global-set-key "\C-c\C-l"      'center-line)
X(global-set-key "\C-cl"         'count-lines-page)
X(global-set-key "\C-cg"         'goto-line)
X(global-set-key "\C-h"          'help-command)
X(global-set-key "\C-s"          'isearch-forward-regexp)
X(global-set-key "\C-r"          'isearch-backward-regexp)
X(global-set-key "\e$"           'ispell-word)
X(global-set-key "\e\C-w"        'kill-region)
X(global-set-key "\C-c\C-i"      'overwrite-mode)
X(global-set-key "\C-c\C-f"      'auto-fill-mode)
X(global-set-key "\e%"           'query-replace-regexp)
X(global-set-key "\C-c\C-r"      'replace-regexp)
X(global-set-key "\C-cr"         'replace-string)
X(global-set-key "\C-c)"         'blink-matching-open)
X(global-set-key "\C-x\C-b"      'buffer-menu)
X(global-set-key "\C-xm"         'mh-smail)
X(global-set-key "\C-xr"         'mh-rmail)
X
X;;;;;;
X;;; Miscellaneous stuff to do
X;;;;;;
X
X;; Reset the path that Emacs thinks is the current working directory,
X;; since on the RS/6000 the auto-mounting messes up things.
X(cd "~/")
X
X;; Enable undo in the minibuffer.
X(buffer-enable-undo (window-buffer (minibuffer-window)))
X
X(make-interactive 'erase-buffer)
X(make-interactive 'blink-matching-open)
X
X;; Fix the cwd if we're in an automounted directory.
X(let ((cwd (expand-file-name ".")))
X  (if (string-match "^/tmp_mnt\\(/.*\\)" cwd)
X      (setq default-directory
X                    (file-name-as-directory
X                     (substring cwd (match-beginning 1) (match-end 1))))))
X
X;;;;;;
X;;; External libraries to load
X;;;    Everything here is loaded quietly, without complaints if the
X;;;    library doesn't exist.  If the library is successfully loaded,
X;;;    an expression can be evaluated (which may be a function).  For
X;;;    example, if the library "time" is loaded, then the function
X;;;    display-time will be called.
X;;;;;;
X
X(mapcar
X (function
X  (lambda (list)
X    (and (load (car list) t t)
X         (eval (car (cdr list))))))
X '(("execcmd"           nil)
X   ("filladapt"         nil)
X   ("smart-ff"          nil)
X   ("crypt"             nil)
X   ("quote-region"      nil)
X   ("resize-minibuf"    (remap-minibuffer-keys))
X   ("gnus-stuff"        nil)
X   ("gnus"              nil)
X   ("vm"                nil)
X   ("ange-ftp-init"     nil) ;; loads ange-ftp and sets variables.
X   ("vkill-init"        nil) ;; process lister/signaler
X   ("time"              (display-time))
X   ("my-autoloads"      nil)))
X
X;; C++ programs
X   (setq auto-mode-alist
X        (cons '("\\.cc$" . c++-mode) auto-mode-alist))
X   (autoload 'c++-mode "c++-mode" nil t)
X
X;; Objective-C programs
X   (setq auto-mode-alist
X        (cons '("\\.m$" . objective-C-mode)
X              auto-mode-alist))
X   (autoload 'objective-C-mode "objective-C-mode" "Objective-C mode" t)
X   (setq objective-C-interface-file-dir "~/src")
X   (setq objective-C-document-file-dir "~/src")
X   (setq objective-C-auto-newline t)
X   (setq objective-C-tab-always-indent nil)
X
X;; Tar editing
X   (setq auto-mode-alist
X        (cons '("\\.tar$" . tar-mode) auto-mode-alist))
X   (autoload 'tar-mode "tar-mode" nil t)
X
X;; EDB Emacs Database System
X   (autoload 'db-find-file "database" "EDB" t)
X   (setq find-file-hooks (cons 'after-find-file-edb find-file-hooks))
X   (defun after-find-file-edb ()
X     "If find-file is in internal EDB format, run db-this-buffer on it"
X     (if (looking-at ";; Database file written by EDB")
X         (progn
X           (require 'database)
X           (db-this-buffer))))
X   (defun irc-notebook ()
X     "Start up the EDB Database for my IRC Notebook"
X     (interactive)
X     (db-find-file "/home/fsf/petrilli/lib/edb/irc-notebook"))
X
X;; MH-e
X   (autoload 'mh-rmail "mh-e" "Emacs MH Mode" t)
X   (autoload 'mh-smail "mh-e" "Emacs MH Mode" t)
X   (setq
X         mh-lib                         "/lib/mh/"
X         mh-progs                       "/usr/bin/"
X         mh-clean-message-header        t
X         mh-delete-yanked-msg-window    t)
X
X;; SuperCite 2.1
X   (autoload 'sc-cite-original "supercite" "Hooked Supercite 2.1" t)
X   (autoload 'sc-cite "supercite" "Interactive Supercite 2.1" t)
X   (setq mh-yank-hooks 'sc-cite-original)
X
X;; RCS Manipulation
X   (load "rcs")
X
X;; Load ange-ftp stuff for automagical FTP stuff
X   (load "ange-ftp")
X
X;; Vkill Process Management
X   (autoload 'ps "vkill-init")
X
X;; Take care of abbrevs
X   (read-abbrev-file "~/.abbrev_defs")
X
X;; Finally, start the Emacs server
X   (server-start)
X
X;; Now redraw the screen
X   (recenter)
X
X;;; End of .emacsrc.el
X
END_OF_FILE
if test 29953 -ne `wc -c <'.emacsrc.el'`; then
    echo shar: \"'.emacsrc.el'\" unpacked with wrong size!
fi
# end of '.emacsrc.el'
fi
echo shar: End of shell archive.
exit 0
Chris
Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU