🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.help
Article #2176

Re: model for .emacs file

#2176
From: Piercarlo Grandi
Date: Sat, 23 Jan 1993 14:58
453 lines
15308 bytes
Well, I can post my own emacs.el source. It is organzied into various
sections, and I have tried to keep it as tidy as possible. It is
designed to adapt to many different site. Overall it should be easy
to adapt to any other user's preferences.

------------------------------------------------------------------------
;;;			Some preparatory work

;; Flow controlled terminals

; We want to have flow controlled terminals.
; Disable interrupt input, enable cbreak and ^S-^Q
; and redefine ^Q and ^S as ^^ and ^\ (and viceversa!)

(set-input-mode nil t)
(setq keyboard-translate-table
  "\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"
)

;; I really hate next-line creating new empty lines at the
;; end of a file. This version does not.

(defun next-line (arg)
  "Move cursor vertically down ARG lines. Obey eventual goal column."
  (interactive "p")
  (next-line-internal arg)
  nil
)

;; Epoch, epoch, you should not auto raise yourself...

(if (boundp 'epoch::version) (setq auto-raise-screen 0))

;;;			Variables from the environment

(setq
  env::DOMAIN				(getenv "DOMAIN")
  env::HOST				(getenv "HOST")
  env::LOCAL				(getenv "LOCAL")
  env::ANY				(getenv "ANY")
  env::ARCH				(getenv "ARCH")
  env::HOME				(getenv "HOME")
  env::YEAR				(getenv "YEAR")
  env::SHELL				(getenv "SHELL")
)


;;;			Configure standard packages

;; Change defaults

(setq-default case-fold-search		nil)
(setq-default fill-column		72)
(setq-default indent-tabs-mode		t)
(setq-default tab-stop			2)
(setq-default tab-width			8)
(setq-default truncate-lines		nil)

;; Change globals

(defun list-tab-stops (interval last)
  (let ((tabs ()) (tab interval))
    (while (<= tab last)
      (setq tabs (nconc tabs (cons tab nil)))
      (setq tab (+ tab interval))
    )
    tabs
  )
)

(setq

  auto-save-default			nil
  auto-save-visited-file-name		nil

  c-argdecl-indent			tab-stop
  c-auto-newline			nil
  c-brace-imaginary-offset		0
  c-brace-offset			(- tab-stop)
  c-continued-statement-offset		tab-stop
  c-indent-level			tab-stop
  c-label-offset			(- tab-stop)
  c-tab-always-indent			nil

  comment-column			40
  comment-multi-line			t

  completion-auto-help			nil
  dired-listing-switches		"-al"
  explicit-shell-file-name		env::SHELL

  load-path
    (cons (concat env::LOCAL env::ANY "/emacs/elisp") load-path)

  inhibit-default-init			t
  inhibit-startup-message		t

  kill-ring-max				16
  list-directory-brief-switches		"-C"
  lpr-switches				"-p"
  make-backup-files			nil
  mark-ring-max				16
  mode-line-inverse-video		t
  page-delimiter			"\f$"
  require-final-newline			1
  shell-prompt-pattern			"^[^#$%>;@*&]*[#$%>;@*&] *"
  tab-stop-list				(list-tab-stops tab-stop 80)
  truncate-partial-width-windows	t
  visible-bell				t

)

(setq auto-mode-alist
  '(
    ("\\.m[vesmn]"			. nroff-mode)
    ("\\.\\([1-8]\\|man\\)$"		. nroff-mode)
    ("\\.[CHYLchylq]$"			. simple-indent-mode)
    ("\\.[chylq]$"			. c-mode)
    ("\\.[CHYL]$"			. c++-mode)
    ("\\.el$"				. emacs-lisp-mode)
    ("\\.\\(lsp\\|lisp\\|cl\\)$"	. lisp-mode)
    ("\\.\\(scm\\|t\\|oak\\|k\\)$"	. lisp-mode)
    ("\\.\\(bib\\|pr\\|txt\\)$"		. text-mode)
    ("\\.tex$"				. plain-tex-mode)
    ("\\.\\(lax\\|sty\\|bbl\\)$"	. latex-mode)
    ("\\.\\(texinfo\\|txi\\)$"		. texinfo-mode)
    ("^\\.emacs$"			. emacs-lisp-mode)
    ("^\\.article\\|\\.letter$"		. text-mode)
    ("/snd.[0-9]*$"			. text-mode)
  )
)

(put 'eval-expression			'disabled	nil)
(put 'narrow-to-page			'disabled	nil)
(put 'narrow-to-region			'disabled	nil)

;; Change hooks

(defun c-mode-customize ()
  ;; This is used by indent-for-comment to decide how much to
  ;; indent a comment in C code based on its context.
  (setq comment-indent-hook
    '(lambda ()
      (if (looking-at "^/\\*") c-indent-level
	(save-excursion ; (skip-chars-backward " \t")
	  (max (+ c-indent-level (current-column)) comment-column))
      )
    )
  )
  (setq sentence-end		"[;.!?][ \t]*$")
  (setq paragraph-separate	"^\f\\|^[\t ]*\\([{}]\\|/\\*\\|\\*/\\)")
  (setq paragraph-start		"^[\t ]*\\([{}]\\|/\\*\\|\\*/\\)")
  (define-key (current-local-map) "\177" 'backward-delete-char)
)

(defun emacs-lisp-mode-customize ()
  (define-key (current-local-map) "\177" 'backward-delete-char)
)

(defun mail-setup-customize ()
  (mail-add-header "Date" (current-time-string))
  (mail-add-header "From"  mail-default-reply-to t)
)

(defun nroff-mode-customize ()
  (setq sentence-end "^\.\\(+[c+]\\|sh\\|uh\\|SH\\|NH\\)")
  (define-key (current-local-map) "\177" 'backward-delete-char)
)

(defun text-mode-customize ()
  (or (eq major-mode 'simple-indent-mode) (auto-fill-mode 1))
)

(setq

  c-mode-hook				'c-mode-customize
  emacs-lisp-mode-hook			'emacs-lisp-mode-customize
  mail-setup-hook			'mail-setup-customize
  nroff-mode-hook			'nroff-mode-customize
  text-mode-hook			'text-mode-customize

)
		       
;; Bindings and rebindings

(define-key global-map	"\C-\\"		'isearch-forward)
(define-key global-map	"\C-^"		'quoted-insert)
(define-key esc-map	"\C-\\"		'isearch-forward-regexp)
(define-key esc-map	"\C-^"		'indent-sexp)
(define-key esc-map 	" "		'set-mark-command)
(define-key esc-map 	"i"		'tab-to-tab-stop)
(define-key esc-map 	"*"		'replace-regexp)
(define-key esc-map 	"%"		'query-replace-regexp)
(define-key esc-map 	"g"		'goto-line)
(define-key esc-map 	"\C-x" 	    	'eval-defun)
(define-key ctl-x-map	"\C-^"		'toggle-read-only)
(define-key ctl-x-map	"\C-\\"		'save-buffer)
(define-key ctl-x-map 	"v"		'view-file)


;;;			Configure extra packages

;; Load those that are permanently loaded

(if (eq window-system 'x-windows)
  (load "fix-x-mouse" t t)
  (load "x-mouse" t t)
)

;; Autoload some

(autoload 'fast-apropos			"apropos" "Fast apropos" t)
(autoload 'back-indent-relative		"back-indent" "Undo indent-relative" t)
(autoload 'calc-dispatch		"calc" "Calculator Options" t)
(autoload 'full-calc			"calc" "Full-screen Calculator" t)
(autoload 'full-calc-keypad		"calc" "Full-screen X Calculator" t)
(autoload 'calc-eval			"calc" "Use Calculator from Lisp")
(autoload 'defmath			"calc" nil t t)
(autoload 'calc				"calc" "Calculator Mode" t)
(autoload 'quick-calc			"calc" "Quick Calculator" t)
(autoload 'calc-keypad			"calc" "X windows Calculator" t)
(autoload 'calc-embedded		"calc" "Use Calc inside any buffer" t)
(autoload 'calc-embedded-activate	"calc" "Activate =>'s in buffer" t)
(autoload 'calc-grab-region		"calc" "Grab region of Calc data" t)
(autoload 'calc-grab-rectangle		"calc" "Grab rectangle of data" t)
(autoload 'calendar			"calendar" "Sophisticated calendar" t)
(autoload 'cmushell			"cmushell" "Sophisticated shell" t)
(autoload 'gnus				"gnus" "Read network news." t)
(autoload 'gnus-post-news		"gnuspost" "Post a news article." t)
(autoload 'gnus-find-new-newsgroups	"gnus-news" "Return groups with new news" t)
(autoload 'gnus-optional-lines-and-author "gnus-fname" "Display real user name" t)
(autoload 'kill-whole-line		"kill-line" "Kill whole line" t)
(autoload 'edit-kbd-macro		"macedit" "Edit Keyboard Macro" t)
(autoload 'edit-last-kbd-macro		"macedit" "Edit Keyboard Macro" t)
(autoload 'read-kbd-macro		"macedit" "Read Keyboard Macro" t)
(autoload 'mail-add-header		"mail-headers" "Add mail header" t)
(autoload 'mail-remove-header		"mail-headers" "Remove mail header" t)
(autoload 'rename-to-new-name		"rename" "Rename a buffer" t)
(autoload 'sc-cite-original 		"sc" "Supercite 2.2" t)
(autoload 'simple-indent-mode		"sindent" "Simple indentation mode" t)
(autoload 'tab-to-tab-stop		"sindent" "Simple indentation" t)
(autoload 'vm				"vm" "Read current mail." t)
(autoload 'vm-visit-folder		"vm" "Read mail in folder." t)
(autoload 'vm-mode			"vm" "Enter VM mode." t)

;; Change globals

(setq

  gnus-auto-center-subject		nil
  gnus-break-pages			nil
  gnus-default-article-saver		'gnus-Subject-save-in-mail
  gnus-default-distribution		"world"
  gnus-digest-show-summary		t
  gnus-large-newsgroup			1000
  gnus-novice-user			nil
  gnus-save-all-headers			nil
  gnus-show-threads	    		nil
  gnus-thread-hide-subject		nil
  gnus-thread-indent-level		2
  gnus-use-generic-from			t
  gnus-use-cross-reference		t
  gnus-use-followup-to			t
  
  gnus-autohide-only-on-followup	t
  gnus-hide-largest-signature		16

  ; Specify window configurations for each action.  The format of the
  ; variable is a list of (ACTION (G S A)), where G, S, and A are the
  ; relative height of Group, Subject, and Article windows, respectively.
  ; ACTION is `SelectNewsgroup', `ExitNewsgroup', `SelectArticle', or
  ; `ExpandSubject'.

  gnus-window-configuration
    '((summary (0 1 0)) (newsgroups (1 0 0)) (article (0 3 5)))

  nntp-large-newsgroup			1000
  nntp-maximum-request			100

  vm-startup-with-summary		1
  vm-mutable-windows			t
  vm-inhibit-startup-message		t
  vm-preview-lines			nil
  vm-berkeley-mail-compatibility	t
  vm-gargle-uucp			t
)

;; Hooks

(defun gnus-Startup-customize ()
   (load "gnus-hide" t t)
   (load "gnus-mark" t t)
   (define-key gnus-Subject-mode-map "\C-f" 'gnus-Subject-forward)
   ;(setq gnus-optional-headers (function gnus-optional-lines-and-author))
)

(defun sc-load-customize ()
  (setq
    mail-indention-spaces		2
    sc-all-but-cite-p			nil
    sc-auto-fill-query-each-paragraph	nil
    sc-auto-fill-region-p		nil
    sc-citation-leader			""
    sc-cite-regexp			"^\\s *[-_.a-zA-Z0-9]*[>|#][ >|#]*"
    sc-confirm-always-p			nil
    sc-default-attribution		"(somebody)"
    sc-default-author-name		"(somebody)"
    sc-electric-references-p		t
    sc-fixup-whitespace-p		nil
    sc-mumble-string			"<unknown>"
    sc-nested-citation-p		nil
    sc-preferred-attribution		'lastname
    sc-preferred-header-style		1
    sc-reference-tag-string		">>> "
  )
)

(defun sc-require-overloads ()
  (require 'sc-oloads)
  (sc-overload-functions)
)

(defun gnus-Select-group-customize ()
  (gnus-sort-headers
    (function
      (lambda (a b)
        (let
	  (
	    (subj-a (gnus-simplify-subject (gnus-header-subject a) 're))
	    (subj-b (gnus-simplify-subject (gnus-header-subject b) 're))
	  )
	      
;	  (if (equal subj-a subj-b)
;	    (return (gnus-date-lessp
;	      (nntp-header-date a) (nntp-header-date b))))

	  (string-lessp (downcase subj-a) (downcase subj-b))
        )
      )
    )
  )
)

(setq

  gnus-Select-group-hook		'gnus-Select-group-customize
  gnus-Startup-hook			'gnus-Startup-customize
  sc-load-hook				'sc-load-customize

  mh-letter-mode-hook 			'sc-require-overloads
  mail-setup-hook  			'sc-require-overloads
  news-reply-mode-hook    		'sc-require-overloads

  mh-yank-hooks				'sc-cite-original
  mail-yank-hooks			'sc-cite-original
  news-reply-header-hook		'sc-cite-original
 
)

;; Bindings and rebindings

(define-key esc-map	"#"		'calc-dispatch)
(define-key esc-map 	"h"         	'back-indent-relative)
(define-key ctl-x-map 	"r" 	    	'rename-to-new-name)
(define-key ctl-x-map 	"\C-k" 	    	'kill-entire-line)
(define-key help-map 	"a" 	    	'fast-apropos)


;;;			Site dependent initialization

(setq yearly-directory			(concat env::HOME "/" env::YEAR "./"))

(cond

  ((equal env::DOMAIN "aber.ac.uk")

    (load "scroll" t t)
    (load "slowsplit" t t)

    ; (load "help-win" t t)
    ; (load "filter" t t)

    (setq
      mail-directory			(concat env::HOME "/UwaFrom.")
      mail-archive-file-name		(concat mail-directory "/LOG.m")
      mail-default-reply-to		"pcg@aber.ac.uk (Piercarlo Grandi)"
      vm-folder-directory		(concat mail-directory "/")
      vm-primary-inbox			(concat mail-directory "/VMBOX.m")
      vm-crash-box			(concat mail-directory "/VMDUMP.m")
      gnus-user-full-name		"Piercarlo Grandi"
      gnus-article-save-directory	mail-directory
      gnus-author-copy			(concat gnus-article-save-directory  "/POSTED.m")
      gnus-your-domain			env::DOMAIN
      gnus-your-organization		"Prifysgol Cymru, Aberystwyth"
      gnus-nntp-server			(concat "fronta." env::DOMAIN)
    )
  )

  ((equal env::DOMAIN "quinary")
    (setq
      mail-directory			env::HOME
      mail-archive-file-name		(concat mail-directory "/LOG.m")
      mail-default-reply-to		"piercarl@cons.quinary.it (Piercarlo Grandi)"
      vm-folder-directory		(concat mail-directory "/")
      vm-primary-inbox			(concat mail-directory "/VMBOX.m")
      vm-crash-box			(concat mail-directory "/VMDUMP.m")
    )
  )

  ((equal (concat env::HOST "." env::DOMAIN) "bagatt.mate.com")
    (setq
      load-path
        (cons (concat env::HOME "/Sw./Emacs./Lisp.") load-path)
      mail-directory			(concat yearly-directory "Mail.")
      mail-archive-file-name		(concat mail-directory "/Log.m")
      mail-default-reply-to		(concat "piercarl@" env::HOST "." env::DOMAIN " (Piercarlo Grandi)")
      vm-folder-directory		(concat mail-directory "/")
      vm-primary-inbox			(concat mail-directory "/VmBox.m")
      vm-crash-box			(concat mail-directory "/VmDump.m")
      gnus-article-save-directory	(concat env::HOME "/News./" env::YEAR ".")
      gnus-author-copy			(concat gnus-article-save-directory  "/Posted.m")
      gnus-user-full-name		"Piercarlo Grandi"
      gnus-your-domain			"mate.com"
      gnus-your-organization		"c/o MATE s.r.l"
      gnus-nntp-server			nil
    )
  )

  ((equal env::HOST "aware")
    (setq
      load-path
        (cons (concat env::HOME "/Sw./Emacs./Lisp.") load-path)
      mail-directory			(concat yearly-directory "Mail.")
      mail-archive-file-name		(concat mail-directory "/Log.m")
      mail-default-reply-to		(concat env::HOST "!piercarl (Piercarlo Grandi)")
      vm-folder-directory		(concat mail-directory "/")
      vm-primary-inbox			(concat mail-directory "/VmBox.vm")
      vm-crash-box			(concat mail-directory "/VmDump.vm")
      gnus-article-save-directory	(concat env::HOME "/News./" env::YEAR ".")
      gnus-author-copy			(concat gnus-article-save-directory  "/Posted.m")
      gnus-user-full-name		"Piercarlo Grandi"
      gnus-your-domain			"aware"
      gnus-your-organization		"Home's where my rucksack's"
      gnus-nntp-server			nil
    )
  )

)
------------------------------------------------------------------------
--
Piercarlo Grandi <pcg@aber.ac.uk> c/o Dept of CS
University of Wales, Penglais, Aberystwyth SY23 3BZ, UK
Technical Details
Message-ID: <PCG.93Jan23145824@decb.aber.ac.uk>
Path: arc1-ca.pugleaf.net!sparky!uunet!pipex!warwick!uknet!gdt!aber!fronta.aber.ac.uk!pcg
References: <1993Jan12.154544.17064@fuug.fi> <4fJ4tnu00VpGMiuQx_@andrew.cmu.edu> <1j6s13INN67t@life.ai.mit.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!pipex!warwick!uknet!gdt!aber!fronta.aber.ac.uk!pcg
From: pcg@aber.ac.uk (Piercarlo Grandi)
Newsgroups: gnu.emacs.help,comp.emacs
Subject: Re: model for .emacs file
Message-ID: <PCG.93Jan23145824@decb.aber.ac.uk>
Date: 23 Jan 93 14:58:24 GMT
References: <1993Jan12.154544.17064@fuug.fi> <4fJ4tnu00VpGMiuQx_@andrew.cmu.edu>
 <1j6s13INN67t@life.ai.mit.edu>
Sender: news@aber.ac.uk (USENET news service)
Reply-To: pcg@aber.ac.uk (Piercarlo Grandi)
Organization: Prifysgol Cymru, Aberystwyth
Lines: 453
In-Reply-To: petrilli@hal.gnu.ai.mit.edu's message of 15 Jan 93 17: 24:51 GMT
Nntp-Posting-Host: decb.aber.ac.uk