home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / gnu / emacs / help / 5478 < prev    next >
Encoding:
Text File  |  1993-01-24  |  14.5 KB  |  470 lines

  1. Xref: sparky gnu.emacs.help:5478 comp.emacs:4055
  2. Path: sparky!uunet!pipex!warwick!uknet!gdt!aber!fronta.aber.ac.uk!pcg
  3. From: pcg@aber.ac.uk (Piercarlo Grandi)
  4. Newsgroups: gnu.emacs.help,comp.emacs
  5. Subject: Re: model for .emacs file
  6. Message-ID: <PCG.93Jan23145824@decb.aber.ac.uk>
  7. Date: 23 Jan 93 14:58:24 GMT
  8. References: <1993Jan12.154544.17064@fuug.fi> <4fJ4tnu00VpGMiuQx_@andrew.cmu.edu>
  9.     <1j6s13INN67t@life.ai.mit.edu>
  10. Sender: news@aber.ac.uk (USENET news service)
  11. Reply-To: pcg@aber.ac.uk (Piercarlo Grandi)
  12. Organization: Prifysgol Cymru, Aberystwyth
  13. Lines: 453
  14. In-Reply-To: petrilli@hal.gnu.ai.mit.edu's message of 15 Jan 93 17: 24:51 GMT
  15. Nntp-Posting-Host: decb.aber.ac.uk
  16.  
  17.  
  18. Well, I can post my own emacs.el source. It is organzied into various
  19. sections, and I have tried to keep it as tidy as possible. It is
  20. designed to adapt to many different site. Overall it should be easy
  21. to adapt to any other user's preferences.
  22.  
  23. ------------------------------------------------------------------------
  24. ;;;            Some preparatory work
  25.  
  26. ;; Flow controlled terminals
  27.  
  28. ; We want to have flow controlled terminals.
  29. ; Disable interrupt input, enable cbreak and ^S-^Q
  30. ; and redefine ^Q and ^S as ^^ and ^\ (and viceversa!)
  31.  
  32. (set-input-mode nil t)
  33. (setq keyboard-translate-table
  34.   "\C-@\C-a\C-b\C-c\C-d\C-e\C-f\C-g\C-h\C-i\C-j\C-k\C-l\C-m\C-n\C-o\C-p\C-^\C-r\C-\\\C-t\C-u\C-v\C-w\C-x\C-y\C-z\C-[\C-s\C-]\C-q"
  35. )
  36.  
  37. ;; I really hate next-line creating new empty lines at the
  38. ;; end of a file. This version does not.
  39.  
  40. (defun next-line (arg)
  41.   "Move cursor vertically down ARG lines. Obey eventual goal column."
  42.   (interactive "p")
  43.   (next-line-internal arg)
  44.   nil
  45. )
  46.  
  47. ;; Epoch, epoch, you should not auto raise yourself...
  48.  
  49. (if (boundp 'epoch::version) (setq auto-raise-screen 0))
  50.  
  51. ;;;            Variables from the environment
  52.  
  53. (setq
  54.   env::DOMAIN                (getenv "DOMAIN")
  55.   env::HOST                (getenv "HOST")
  56.   env::LOCAL                (getenv "LOCAL")
  57.   env::ANY                (getenv "ANY")
  58.   env::ARCH                (getenv "ARCH")
  59.   env::HOME                (getenv "HOME")
  60.   env::YEAR                (getenv "YEAR")
  61.   env::SHELL                (getenv "SHELL")
  62. )
  63.  
  64.  
  65. ;;;            Configure standard packages
  66.  
  67. ;; Change defaults
  68.  
  69. (setq-default case-fold-search        nil)
  70. (setq-default fill-column        72)
  71. (setq-default indent-tabs-mode        t)
  72. (setq-default tab-stop            2)
  73. (setq-default tab-width            8)
  74. (setq-default truncate-lines        nil)
  75.  
  76. ;; Change globals
  77.  
  78. (defun list-tab-stops (interval last)
  79.   (let ((tabs ()) (tab interval))
  80.     (while (<= tab last)
  81.       (setq tabs (nconc tabs (cons tab nil)))
  82.       (setq tab (+ tab interval))
  83.     )
  84.     tabs
  85.   )
  86. )
  87.  
  88. (setq
  89.  
  90.   auto-save-default            nil
  91.   auto-save-visited-file-name        nil
  92.  
  93.   c-argdecl-indent            tab-stop
  94.   c-auto-newline            nil
  95.   c-brace-imaginary-offset        0
  96.   c-brace-offset            (- tab-stop)
  97.   c-continued-statement-offset        tab-stop
  98.   c-indent-level            tab-stop
  99.   c-label-offset            (- tab-stop)
  100.   c-tab-always-indent            nil
  101.  
  102.   comment-column            40
  103.   comment-multi-line            t
  104.  
  105.   completion-auto-help            nil
  106.   dired-listing-switches        "-al"
  107.   explicit-shell-file-name        env::SHELL
  108.  
  109.   load-path
  110.     (cons (concat env::LOCAL env::ANY "/emacs/elisp") load-path)
  111.  
  112.   inhibit-default-init            t
  113.   inhibit-startup-message        t
  114.  
  115.   kill-ring-max                16
  116.   list-directory-brief-switches        "-C"
  117.   lpr-switches                "-p"
  118.   make-backup-files            nil
  119.   mark-ring-max                16
  120.   mode-line-inverse-video        t
  121.   page-delimiter            "\f$"
  122.   require-final-newline            1
  123.   shell-prompt-pattern            "^[^#$%>;@*&]*[#$%>;@*&] *"
  124.   tab-stop-list                (list-tab-stops tab-stop 80)
  125.   truncate-partial-width-windows    t
  126.   visible-bell                t
  127.  
  128. )
  129.  
  130. (setq auto-mode-alist
  131.   '(
  132.     ("\\.m[vesmn]"            . nroff-mode)
  133.     ("\\.\\([1-8]\\|man\\)$"        . nroff-mode)
  134.     ("\\.[CHYLchylq]$"            . simple-indent-mode)
  135.     ("\\.[chylq]$"            . c-mode)
  136.     ("\\.[CHYL]$"            . c++-mode)
  137.     ("\\.el$"                . emacs-lisp-mode)
  138.     ("\\.\\(lsp\\|lisp\\|cl\\)$"    . lisp-mode)
  139.     ("\\.\\(scm\\|t\\|oak\\|k\\)$"    . lisp-mode)
  140.     ("\\.\\(bib\\|pr\\|txt\\)$"        . text-mode)
  141.     ("\\.tex$"                . plain-tex-mode)
  142.     ("\\.\\(lax\\|sty\\|bbl\\)$"    . latex-mode)
  143.     ("\\.\\(texinfo\\|txi\\)$"        . texinfo-mode)
  144.     ("^\\.emacs$"            . emacs-lisp-mode)
  145.     ("^\\.article\\|\\.letter$"        . text-mode)
  146.     ("/snd.[0-9]*$"            . text-mode)
  147.   )
  148. )
  149.  
  150. (put 'eval-expression            'disabled    nil)
  151. (put 'narrow-to-page            'disabled    nil)
  152. (put 'narrow-to-region            'disabled    nil)
  153.  
  154. ;; Change hooks
  155.  
  156. (defun c-mode-customize ()
  157.   ;; This is used by indent-for-comment to decide how much to
  158.   ;; indent a comment in C code based on its context.
  159.   (setq comment-indent-hook
  160.     '(lambda ()
  161.       (if (looking-at "^/\\*") c-indent-level
  162.     (save-excursion ; (skip-chars-backward " \t")
  163.       (max (+ c-indent-level (current-column)) comment-column))
  164.       )
  165.     )
  166.   )
  167.   (setq sentence-end        "[;.!?][ \t]*$")
  168.   (setq paragraph-separate    "^\f\\|^[\t ]*\\([{}]\\|/\\*\\|\\*/\\)")
  169.   (setq paragraph-start        "^[\t ]*\\([{}]\\|/\\*\\|\\*/\\)")
  170.   (define-key (current-local-map) "\177" 'backward-delete-char)
  171. )
  172.  
  173. (defun emacs-lisp-mode-customize ()
  174.   (define-key (current-local-map) "\177" 'backward-delete-char)
  175. )
  176.  
  177. (defun mail-setup-customize ()
  178.   (mail-add-header "Date" (current-time-string))
  179.   (mail-add-header "From"  mail-default-reply-to t)
  180. )
  181.  
  182. (defun nroff-mode-customize ()
  183.   (setq sentence-end "^\.\\(+[c+]\\|sh\\|uh\\|SH\\|NH\\)")
  184.   (define-key (current-local-map) "\177" 'backward-delete-char)
  185. )
  186.  
  187. (defun text-mode-customize ()
  188.   (or (eq major-mode 'simple-indent-mode) (auto-fill-mode 1))
  189. )
  190.  
  191. (setq
  192.  
  193.   c-mode-hook                'c-mode-customize
  194.   emacs-lisp-mode-hook            'emacs-lisp-mode-customize
  195.   mail-setup-hook            'mail-setup-customize
  196.   nroff-mode-hook            'nroff-mode-customize
  197.   text-mode-hook            'text-mode-customize
  198.  
  199. )
  200.                
  201. ;; Bindings and rebindings
  202.  
  203. (define-key global-map    "\C-\\"        'isearch-forward)
  204. (define-key global-map    "\C-^"        'quoted-insert)
  205. (define-key esc-map    "\C-\\"        'isearch-forward-regexp)
  206. (define-key esc-map    "\C-^"        'indent-sexp)
  207. (define-key esc-map     " "        'set-mark-command)
  208. (define-key esc-map     "i"        'tab-to-tab-stop)
  209. (define-key esc-map     "*"        'replace-regexp)
  210. (define-key esc-map     "%"        'query-replace-regexp)
  211. (define-key esc-map     "g"        'goto-line)
  212. (define-key esc-map     "\C-x"             'eval-defun)
  213. (define-key ctl-x-map    "\C-^"        'toggle-read-only)
  214. (define-key ctl-x-map    "\C-\\"        'save-buffer)
  215. (define-key ctl-x-map     "v"        'view-file)
  216.  
  217.  
  218. ;;;            Configure extra packages
  219.  
  220. ;; Load those that are permanently loaded
  221.  
  222. (if (eq window-system 'x-windows)
  223.   (load "fix-x-mouse" t t)
  224.   (load "x-mouse" t t)
  225. )
  226.  
  227. ;; Autoload some
  228.  
  229. (autoload 'fast-apropos            "apropos" "Fast apropos" t)
  230. (autoload 'back-indent-relative        "back-indent" "Undo indent-relative" t)
  231. (autoload 'calc-dispatch        "calc" "Calculator Options" t)
  232. (autoload 'full-calc            "calc" "Full-screen Calculator" t)
  233. (autoload 'full-calc-keypad        "calc" "Full-screen X Calculator" t)
  234. (autoload 'calc-eval            "calc" "Use Calculator from Lisp")
  235. (autoload 'defmath            "calc" nil t t)
  236. (autoload 'calc                "calc" "Calculator Mode" t)
  237. (autoload 'quick-calc            "calc" "Quick Calculator" t)
  238. (autoload 'calc-keypad            "calc" "X windows Calculator" t)
  239. (autoload 'calc-embedded        "calc" "Use Calc inside any buffer" t)
  240. (autoload 'calc-embedded-activate    "calc" "Activate =>'s in buffer" t)
  241. (autoload 'calc-grab-region        "calc" "Grab region of Calc data" t)
  242. (autoload 'calc-grab-rectangle        "calc" "Grab rectangle of data" t)
  243. (autoload 'calendar            "calendar" "Sophisticated calendar" t)
  244. (autoload 'cmushell            "cmushell" "Sophisticated shell" t)
  245. (autoload 'gnus                "gnus" "Read network news." t)
  246. (autoload 'gnus-post-news        "gnuspost" "Post a news article." t)
  247. (autoload 'gnus-find-new-newsgroups    "gnus-news" "Return groups with new news" t)
  248. (autoload 'gnus-optional-lines-and-author "gnus-fname" "Display real user name" t)
  249. (autoload 'kill-whole-line        "kill-line" "Kill whole line" t)
  250. (autoload 'edit-kbd-macro        "macedit" "Edit Keyboard Macro" t)
  251. (autoload 'edit-last-kbd-macro        "macedit" "Edit Keyboard Macro" t)
  252. (autoload 'read-kbd-macro        "macedit" "Read Keyboard Macro" t)
  253. (autoload 'mail-add-header        "mail-headers" "Add mail header" t)
  254. (autoload 'mail-remove-header        "mail-headers" "Remove mail header" t)
  255. (autoload 'rename-to-new-name        "rename" "Rename a buffer" t)
  256. (autoload 'sc-cite-original         "sc" "Supercite 2.2" t)
  257. (autoload 'simple-indent-mode        "sindent" "Simple indentation mode" t)
  258. (autoload 'tab-to-tab-stop        "sindent" "Simple indentation" t)
  259. (autoload 'vm                "vm" "Read current mail." t)
  260. (autoload 'vm-visit-folder        "vm" "Read mail in folder." t)
  261. (autoload 'vm-mode            "vm" "Enter VM mode." t)
  262.  
  263. ;; Change globals
  264.  
  265. (setq
  266.  
  267.   gnus-auto-center-subject        nil
  268.   gnus-break-pages            nil
  269.   gnus-default-article-saver        'gnus-Subject-save-in-mail
  270.   gnus-default-distribution        "world"
  271.   gnus-digest-show-summary        t
  272.   gnus-large-newsgroup            1000
  273.   gnus-novice-user            nil
  274.   gnus-save-all-headers            nil
  275.   gnus-show-threads                nil
  276.   gnus-thread-hide-subject        nil
  277.   gnus-thread-indent-level        2
  278.   gnus-use-generic-from            t
  279.   gnus-use-cross-reference        t
  280.   gnus-use-followup-to            t
  281.   
  282.   gnus-autohide-only-on-followup    t
  283.   gnus-hide-largest-signature        16
  284.  
  285.   ; Specify window configurations for each action.  The format of the
  286.   ; variable is a list of (ACTION (G S A)), where G, S, and A are the
  287.   ; relative height of Group, Subject, and Article windows, respectively.
  288.   ; ACTION is `SelectNewsgroup', `ExitNewsgroup', `SelectArticle', or
  289.   ; `ExpandSubject'.
  290.  
  291.   gnus-window-configuration
  292.     '((summary (0 1 0)) (newsgroups (1 0 0)) (article (0 3 5)))
  293.  
  294.   nntp-large-newsgroup            1000
  295.   nntp-maximum-request            100
  296.  
  297.   vm-startup-with-summary        1
  298.   vm-mutable-windows            t
  299.   vm-inhibit-startup-message        t
  300.   vm-preview-lines            nil
  301.   vm-berkeley-mail-compatibility    t
  302.   vm-gargle-uucp            t
  303. )
  304.  
  305. ;; Hooks
  306.  
  307. (defun gnus-Startup-customize ()
  308.    (load "gnus-hide" t t)
  309.    (load "gnus-mark" t t)
  310.    (define-key gnus-Subject-mode-map "\C-f" 'gnus-Subject-forward)
  311.    ;(setq gnus-optional-headers (function gnus-optional-lines-and-author))
  312. )
  313.  
  314. (defun sc-load-customize ()
  315.   (setq
  316.     mail-indention-spaces        2
  317.     sc-all-but-cite-p            nil
  318.     sc-auto-fill-query-each-paragraph    nil
  319.     sc-auto-fill-region-p        nil
  320.     sc-citation-leader            ""
  321.     sc-cite-regexp            "^\\s *[-_.a-zA-Z0-9]*[>|#][ >|#]*"
  322.     sc-confirm-always-p            nil
  323.     sc-default-attribution        "(somebody)"
  324.     sc-default-author-name        "(somebody)"
  325.     sc-electric-references-p        t
  326.     sc-fixup-whitespace-p        nil
  327.     sc-mumble-string            "<unknown>"
  328.     sc-nested-citation-p        nil
  329.     sc-preferred-attribution        'lastname
  330.     sc-preferred-header-style        1
  331.     sc-reference-tag-string        ">>> "
  332.   )
  333. )
  334.  
  335. (defun sc-require-overloads ()
  336.   (require 'sc-oloads)
  337.   (sc-overload-functions)
  338. )
  339.  
  340. (defun gnus-Select-group-customize ()
  341.   (gnus-sort-headers
  342.     (function
  343.       (lambda (a b)
  344.         (let
  345.       (
  346.         (subj-a (gnus-simplify-subject (gnus-header-subject a) 're))
  347.         (subj-b (gnus-simplify-subject (gnus-header-subject b) 're))
  348.       )
  349.           
  350. ;      (if (equal subj-a subj-b)
  351. ;        (return (gnus-date-lessp
  352. ;          (nntp-header-date a) (nntp-header-date b))))
  353.  
  354.       (string-lessp (downcase subj-a) (downcase subj-b))
  355.         )
  356.       )
  357.     )
  358.   )
  359. )
  360.  
  361. (setq
  362.  
  363.   gnus-Select-group-hook        'gnus-Select-group-customize
  364.   gnus-Startup-hook            'gnus-Startup-customize
  365.   sc-load-hook                'sc-load-customize
  366.  
  367.   mh-letter-mode-hook             'sc-require-overloads
  368.   mail-setup-hook              'sc-require-overloads
  369.   news-reply-mode-hook            'sc-require-overloads
  370.  
  371.   mh-yank-hooks                'sc-cite-original
  372.   mail-yank-hooks            'sc-cite-original
  373.   news-reply-header-hook        'sc-cite-original
  374.  
  375. )
  376.  
  377. ;; Bindings and rebindings
  378.  
  379. (define-key esc-map    "#"        'calc-dispatch)
  380. (define-key esc-map     "h"             'back-indent-relative)
  381. (define-key ctl-x-map     "r"             'rename-to-new-name)
  382. (define-key ctl-x-map     "\C-k"             'kill-entire-line)
  383. (define-key help-map     "a"             'fast-apropos)
  384.  
  385.  
  386. ;;;            Site dependent initialization
  387.  
  388. (setq yearly-directory            (concat env::HOME "/" env::YEAR "./"))
  389.  
  390. (cond
  391.  
  392.   ((equal env::DOMAIN "aber.ac.uk")
  393.  
  394.     (load "scroll" t t)
  395.     (load "slowsplit" t t)
  396.  
  397.     ; (load "help-win" t t)
  398.     ; (load "filter" t t)
  399.  
  400.     (setq
  401.       mail-directory            (concat env::HOME "/UwaFrom.")
  402.       mail-archive-file-name        (concat mail-directory "/LOG.m")
  403.       mail-default-reply-to        "pcg@aber.ac.uk (Piercarlo Grandi)"
  404.       vm-folder-directory        (concat mail-directory "/")
  405.       vm-primary-inbox            (concat mail-directory "/VMBOX.m")
  406.       vm-crash-box            (concat mail-directory "/VMDUMP.m")
  407.       gnus-user-full-name        "Piercarlo Grandi"
  408.       gnus-article-save-directory    mail-directory
  409.       gnus-author-copy            (concat gnus-article-save-directory  "/POSTED.m")
  410.       gnus-your-domain            env::DOMAIN
  411.       gnus-your-organization        "Prifysgol Cymru, Aberystwyth"
  412.       gnus-nntp-server            (concat "fronta." env::DOMAIN)
  413.     )
  414.   )
  415.  
  416.   ((equal env::DOMAIN "quinary")
  417.     (setq
  418.       mail-directory            env::HOME
  419.       mail-archive-file-name        (concat mail-directory "/LOG.m")
  420.       mail-default-reply-to        "piercarl@cons.quinary.it (Piercarlo Grandi)"
  421.       vm-folder-directory        (concat mail-directory "/")
  422.       vm-primary-inbox            (concat mail-directory "/VMBOX.m")
  423.       vm-crash-box            (concat mail-directory "/VMDUMP.m")
  424.     )
  425.   )
  426.  
  427.   ((equal (concat env::HOST "." env::DOMAIN) "bagatt.mate.com")
  428.     (setq
  429.       load-path
  430.         (cons (concat env::HOME "/Sw./Emacs./Lisp.") load-path)
  431.       mail-directory            (concat yearly-directory "Mail.")
  432.       mail-archive-file-name        (concat mail-directory "/Log.m")
  433.       mail-default-reply-to        (concat "piercarl@" env::HOST "." env::DOMAIN " (Piercarlo Grandi)")
  434.       vm-folder-directory        (concat mail-directory "/")
  435.       vm-primary-inbox            (concat mail-directory "/VmBox.m")
  436.       vm-crash-box            (concat mail-directory "/VmDump.m")
  437.       gnus-article-save-directory    (concat env::HOME "/News./" env::YEAR ".")
  438.       gnus-author-copy            (concat gnus-article-save-directory  "/Posted.m")
  439.       gnus-user-full-name        "Piercarlo Grandi"
  440.       gnus-your-domain            "mate.com"
  441.       gnus-your-organization        "c/o MATE s.r.l"
  442.       gnus-nntp-server            nil
  443.     )
  444.   )
  445.  
  446.   ((equal env::HOST "aware")
  447.     (setq
  448.       load-path
  449.         (cons (concat env::HOME "/Sw./Emacs./Lisp.") load-path)
  450.       mail-directory            (concat yearly-directory "Mail.")
  451.       mail-archive-file-name        (concat mail-directory "/Log.m")
  452.       mail-default-reply-to        (concat env::HOST "!piercarl (Piercarlo Grandi)")
  453.       vm-folder-directory        (concat mail-directory "/")
  454.       vm-primary-inbox            (concat mail-directory "/VmBox.vm")
  455.       vm-crash-box            (concat mail-directory "/VmDump.vm")
  456.       gnus-article-save-directory    (concat env::HOME "/News./" env::YEAR ".")
  457.       gnus-author-copy            (concat gnus-article-save-directory  "/Posted.m")
  458.       gnus-user-full-name        "Piercarlo Grandi"
  459.       gnus-your-domain            "aware"
  460.       gnus-your-organization        "Home's where my rucksack's"
  461.       gnus-nntp-server            nil
  462.     )
  463.   )
  464.  
  465. )
  466. ------------------------------------------------------------------------
  467. --
  468. Piercarlo Grandi <pcg@aber.ac.uk> c/o Dept of CS
  469. University of Wales, Penglais, Aberystwyth SY23 3BZ, UK
  470.