previous ] [ start page ] [ next ]

Commented sample site-start.el for Emacs 19.33 for OS/2

;;;                       The science of setting up Emacs                ;;;
;;; Users of multiuser OS's, please note:
;;;   This file serves as a site-start.el emacs configuration and although
;;;   all OS/2 specific stuff is marked so, it may be that not everything
;;;   herein will fit into the .emacs file in a multiuser environment, i.e.
;;;   you will be *probably* not allowed to do all the things described
;;;   here, if you are not a superuser on your machine.
;;; Notes on the comment style used in this file:
;;; - All textual comments have at least three ";;;" in front of them.
;;; - All lisp code commented has only two ";;". (Some code shows
;;;   alternatives or even does not make sense in any environment.)
;;; - There are main sections and subsections to let you easily find
;;;   what you are interested in.
;;; It is not a very good idea to change your emacs configuration with
;;; lots of new and unknown code, because if your emacs crashes you
;;; will not be able to spot which statement is responsble for it.
;;; For documentation resons I left some code only needed for older
;;; version of emacs - watch out for comments
;;; To learn more about the following functions and variables make
;;; use of emacs' describe-mode, describe-function and describe-variable
;;; features.
;;; Oliver Heidelbach - - 12.03.1997
;;;                          Fundamentals                                ;;;

;;; Start emacs server - needed for the emacsclient

;; (setq gc-cons-threshold 1000000)	    ;;; Fewer garbage collections

;;; Raise frame to the foreground if emacsclient requests a buffer.
(add-hook 'server-request-hook
          '(lambda ()
             (focus-frame (selected-frame))))

;;; mostly used for packages
(setq load-path (append '("f:/emacs/lisp/w3"

;;;                             Debugging                                ;;;

;;;You might need to start emacs with the -q
;;;option, load the .emacs file, and do M-x eval-buffer.
;; (setq debug-on-error t)

;;; For debugging emacs
;; (open-termscript "termscript")
;; (open-dribble-file "dribble")

;;;                       Fundamental display setup                      ;;;

;;; Load asorted Buffer menu (v19.30+)
(load "msb")

;;; Set up a menu displaying the last visited files
(load "edit-history")            ;;; no standard code
(setq ehistory-history-length 12)
(defvar ehistory-ignore-regexp "/\\(browse\\|diary\\|site-diary\\|tags\\|.*rmail.*\\|.*tmp\\|.*a[d]*ress.*\\|.*bbdb)$")

;;; Specify additional frame parameters.
;;; Font WarpSans comes with Warp 4
(setq default-frame-alist
      (append '(;; (altgr-modifier . meta) ;;; AltGr (and AltCar) generate M-
                (shortcuts . (alt-f4))   ;;; Disable all shortcuts but Alt+F4
                (menu-font . "9.WarpSans Bold")) ;;; Use small font for menus

;;; Select initial frame size
;;; emx environment variable 'osrelease' should be set for this
;;; This is an example of how to work with different screen resolutions
 (setq initial-frame-alist
     ;; (if (equal (getenv "OSRELEASE") "3.0")   ;;; 800x600 mit Warp 3
      ;; (append '((width . 81) (height . 42)
                ;; (left . 31) (top .-2)) initial-frame-alist)
      (append '((width . 81)(height . 52)        ;;; 1024x768
                (left . 280)(top . -2)) initial-frame-alist))

;;; Select display font, select 8 point Courier with Warp, else 10 point
;;; emx environment variable 'osrelease' should be set for this
 (setq default-frame-alist
      (if (equal (getenv "OSRELEASE") "3.0")
      (append '((font . "8.Courier")) default-frame-alist)
      (append '((font . "10.Courier")) default-frame-alist)))

;;; Enable 8-bit input.  set-input-mode must be called when running
;;; Emacs -- calling it before dumping doesn't work.
(set-input-mode nil nil 1)

;;(set-input-mode (car (current-input-mode))
;;                (nth 1 (current-input-mode))
;;                 0)

;;; Display characters 128 through 254 as-is.  Without this
;;; statement, octal notation is used for these characters.
(standard-display-8bit 128 255)
(standard-display-european 1)		;;; Eight-bit characters - V19+

;; Use special symbols (which are not displayed as-is when occurring
;; in a buffer) for truncated screen lines, continued lines, for
;; displaying control characters, and for separating side-by-side
;; windows.
(set-display-table-slot standard-display-table 'truncation      16)
(set-display-table-slot standard-display-table 'wrap            31)
(set-display-table-slot standard-display-table 'control         24)
(set-display-table-slot standard-display-table 'vertical-border 186)

;;; Do something about that annoying codepage problem in mail and news
;;; Set it up for correct use with mails, postings etc.
(require 'iso-syntax)
(load "iso-pc")        ;;; no standard code

(defun my-toggle-code-page ()
  "Toggle codepage betweemn 850 \(PC\) and 1004 \(ISO-8859-1\)"
  (if (equal (current-code-page) '1004)
      (set-code-page '850)
    (set-code-page '1004))
  (message (concat "Using codepage " (current-code-page))))

(defun my-toggle-charset ()
  "Toggle codepage between 850 \(PC\) and 1004 \(ISO-8859-1\)"
  (if window-system
(global-set-key "" 'my-toggle-charset)

(defun my-iso-chars-enable ()
  "Enables the ISO-8859-1 charset."
  (if window-system (set-code-page '1004) (iso-pc-enable))
  (message (concat "Using ISO-8859-1 charset.")))
(defun my-iso-chars-disable ()
  "Disables the ISO-8859-1 charset."
  (if window-system (set-code-page '850) (iso-pc-disable))
  (message (concat "Using PC charset.")))

;;;                           Keyboard setup                             ;;;

;;; Rebinding keys
;;; The following can be used to load heavily used files via keys
(global-set-key [C-f12] '(lambda () (interactive) 
                  (find-file "f:/emacs/19.33/lisp/site-start.el")))
(global-set-key [C-f11] '(lambda () (interactive) 
                  (forms-find-file "f:/emacs/lisp/address.el")))
;;; Set goto-line to something apropriate (ALT-G)
(global-set-key "\eg" 'goto-line)
;;; Set count-lines-region to something apropriate (ALT-C)
(global-set-key "\ec" 'count-lines-region)
;;; Set sort-lines to something apropriate (ALT-#)
(global-set-key "\e#" 'sort-lines)
;;; Set sort-paragraphs to something apropriate (CONTROL-#)
(global-set-key ""\C-#"" 'sort-paragraphs)

;;; Set Font menu to CTRL-SHIFT-MOUSE-LEFT with two button mouse
;;; Only needed prior to version 19.29
;;(global-set-key [C-S-down-mouse-1] 'mouse-set-font)

;;;                          Setup some modes                            ;;;

;;; File modes - automatically load modes on file extension
(setq auto-mode-alist (cons '("\\.awk\\'" . awk-mode)
(setq auto-mode-alist (cons '("\\.c\\'" . c-mode)
(setq auto-mode-alist (cons '("\\.cpp\\'" . c-mode)
(setq auto-mode-alist (cons '("\\.tex\\'" . tex-mode)
(setq auto-mode-alist (cons '("\\.com\\'" . hexl-mode)
(setq auto-mode-alist (cons '("\\.exe\\'" . hexl-binary-mode)
(setq auto-mode-alist (cons '("\\.pl\\'" . perl-mode)
;;; OS/2 specific file modes - normal binary mode produces garbage
(emx-add-binary-mode "\\.exe$")
(emx-add-binary-mode "\\.com$")
;;(emx-add-binary-mode "\\.gz$")
;;(emx-add-binary-mode "\\.[Zz]$")

;;; Mode for internet jargon file
;;; also a good example for the use of regular expressions with emacs
(setq auto-mode-alist (cons
                       '("[jJ]argon.*\\.\\(txt\\|ascii\\)" . jargon-mode)
;;(autoload 'jargon-mode "jargon-mode"
;;          "Major mode for browsing the Jargon File." t)

;; (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)

;;;                         Additional setup                             ;;;

;;; set default mode for unknown files
(setq default-major-mode 'text-mode)
(setq text-mode-hook 'turn-on-auto-fill)
;;(setq-default auto-fill-hook 'do-auto-fill)
;;; Make case sensitive searches default
(setq-default case-fold-search nil)
;;; show line numbers on status line
(line-number-mode t)
;;; make emacs blink instead of beep
(setq visible-bell t)
(setq truncate-partial-width-windows t)
;;(setq tab-stop-list '(4 8 12 16 20 24 28 32 36 40 48 56 64 72 80 88 96 104 112 120))
(setq completion-auto-help t)
;;(autoload 'faces "faces" nil t)
;;(require 'faces-os2)
;;(autoload 'font-lock "font-lock" nil t)
;;; Do not automatically add newlines on (page) down
(setq next-line-add-newlines nil)
;;; set the temporary buffers for emacsclient to delete when finished
;;; If you want to get rid of all the buffers you
;;; edit with emacsclient after hitting "C-x #", just set the regexp to "*"
(setq server-temp-file-regexp "*")
;;; Get rid of the message file input
(setq message-log-max 0)
;;; Display full path name if appropriate on mode line.
(add-hook 'find-file-hooks 
	  '(lambda ()
	     (setq mode-line-buffer-identification 'buffer-file-truename)))

(defun adressen ()
  "Load address book."
  (forms-find-file "f:/emacs/lisp/address.el"))

(defun region-new-buffer ()
  "Insert region into a new buffer."
  (copy-region-as-kill (point) (mark))
  (switch-to-buffer (generate-new-buffer "new"))
(global-set-key [C-f5] '(lambda () (interactive) 

;;;Set up highlighting functions
(cond (window-system                  ;;; use e.g. (not c-mode) to exclude
       (setq hilit-mode-enable-list  '(html-helper-mode rexx-mode c-mode 
                        emacs-lisp-mode perl-mode rmail-mode jargon-mode)   
             hilit-background-mode   'light
             hilit-inhibit-hooks     nil
             hilit-inhibit-rebinding nil
             hilit-quietly t
             hilit-face-check nil) ;;; no fonts changing check ==> faster
       (require 'hilit19)
;;(autoload 'hilit19 "hilit19" nil t)

;;;                         Programming modes setup                      ;;;

;;; HTML additions ;;;
(setq auto-mode-alist (cons '("\\.htm.*$" . html-helper-mode) 
(autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
(setq html-helper-do-write-file-hooks t
      html-helper-build-new-buffer t
      html-helper-address-string "Oliver Heidelbach <>")
;;; insert "tempo" macros in uppercase
;;(setq tempo-insert-string-functions 'upcase)

;;; REXX additions ;;;
(setq auto-mode-alist (cons '("\\.cmd$" . rexx-mode) 
(autoload 'rexx-mode "rexx-mode")

(setq set-rexx-style '("Cowlishaw")
      rexx-command-auto-upper 2
      rexx-external-function-auto-capitilize t
      rexx-auto-build-procedure-table t
      rexx-super-completion-mode t
;;    rexx-additional-doc-files '("rexx-os2" "vxrexx-doc")
      rexx-additional-doc-files '("rexx-os2")

;;(setq auto-mode-alist (cons '("\\.vrx$" . rexx-mode) auto-mode-alist))
;;(setq auto-mode-alist (cons '("\\.vrm$" . rexx-mode) auto-mode-alist))
;;(load "vxrexx-mode")
;;(setq vxrexx-build-master-table t)

;;; Also, you should be aware that both [ESC Tab] and [Ctrl Tab] are
;;; mapped to REXX completion.  Just type part of the command name and
;;; hit one of these combinations and rexx-mode will spit out the rest
;;; of the word or a list of choices.  You can hit [Ctrl-x 1] to get
;;; rid of the completion window.

;;; C additions (K&R style) ;;;
(setq c-basic-offset 5
;;    c-continued-statement-offset 5
;;    c-brace-offset -5
;;    c-argdecl-indent 0
;;    c-label-offset -5

;;;                        ELISP packages setup(s)                       ;;;

;;; BBDB setup ;;;
(autoload 'bbdb         "bbdb-com" "Insidious Big Brother Database" t)
(autoload 'bbdb-name    "bbdb-com" "Insidious Big Brother Database" t)
(autoload 'bbdb-company "bbdb-com" "Insidious Big Brother Database" t)
(autoload 'bbdb-net     "bbdb-com" "Insidious Big Brother Database" t)
(autoload 'bbdb-notes   "bbdb-com" "Insidious Big Brother Database" t)
;;(autoload 'bbdb-insinuate-vm       "bbdb-vm"    "Hook BBDB into VM")
(autoload 'bbdb-insinuate-rmail    "bbdb-rmail" "Hook BBDB into RMAIL")
;;(autoload 'bbdb-insinuate-mh       "bbdb-mhe"   "Hook BBDB into MH-E")
;;(autoload 'bbdb-insinuate-gnus     "bbdb-gnus"  "Hook BBDB into GNUS")
(autoload 'bbdb-insinuate-sendmail "bbdb"       "Hook BBDB into sendmail")

(setq rmail-mode-hook 'bbdb-insinuate-rmail
;;    mh-folder-mode-hook 'bbdb-insinuate-mh
;;    gnus-Startup-hook 'bbdb-insinuate-gnus	; for GNUS 3.14 or older
;;    gnus-startup-hook 'bbdb-insinuate-gnus	; for GNUS 3.15 or newer
      mail-setup-hook 'bbdb-insinuate-sendmail

(setq bbdb-info-file "f:/emx/info/"
      bbdb-user-mail-names "oheiabbd"
;;(setq bbdb-user-mail-names (append '("oheiabbd"
;;                                     "ohei"
;;                                     "o\\.heidelbach")
;;                               bbdb-user-mail-names))

;;; Setup what is to be ignored in BBDB
(setq bbdb/mail-auto-create-p 'bbdb-ignore-some-messages-hook)
(setq bbdb-ignore-some-messages-alist
      '(("From" . "listserv\\|mailer\\|list\\|[Bb]enutzerservice\\|euwhatsnew\\|[Mm]ail [Dd]elivery")
;;	("Originator" . "emx\\|glelist")
;;	("Sender" . "emx\\|glelist\\|maiser\\|Finance")
	("To" . "gateway\\|info\\|vote\\|mathcad\\|s-\\|ding")
;;	("Apparently-To" . "emtex")
        ("Subject" . "[Cc]onfirm")
	("CC" . "info\\|teach\\|supercite\\|gaussian")
	("Reply-To" . "trumpet\\|os2ip\\|FINANCE")

;;; Emacs-W3 setup ;;;

;;; I currently don't use it, but it should work

;;(autoload 'browse-url-at-point "browse-url"
;;  "Ask a WWW browser to load the URL at or before point." t)
;;(autoload 'browse-url-at-mouse "browse-url"
;;  "Ask a WWW browser to load a URL clicked with the mouse." t)
;;(autoload 'browse-url-of-buffer "browse-url"
;;  "Ask a WWW browser to display BUFFER." t)
;;(autoload 'browse-url-of-file "browse-url"
;;  "Ask a WWW browser to display FILE." t)
;;(autoload 'browse-url-of-dired-file "browse-url"
;;  "In Dired, ask a WWW browser to display the file named on this line." t)
;;(add-hook 'rmail-mode-hook (function (lambda () ; rmail-mode startup
;;  (define-key rmail-mode-map [mouse-2] 'browse-url-at-mouse))))
;;;;(setq url-gateway-method 'tcp
;;      w3-default-homepage "http://home/"
;;      w3-delay-image-loads t
;;      tcp-binary-process-output-services '("nntp" "119" "80")
;;      url-temporary-directory "e:/temp"
;;      url-be-asynchronous nil    ; Interacts badly with caching
;;      url-pgp/pem-entity ""
;;      url-personal-mail-address ""
;;      url-automatic-caching nil  ; What about ZIP files etc?
;;      w3-track-mouse nil    ; Buggy under 19.29
;;      url-keep-history t
;;      w3-debug-html nil
;;(autoload 'w3-preview-this-buffer "w3" "WWW Previewer" t)
;;(autoload 'w3-follow-url-at-point "w3" "Find document at pt" t)
;;(autoload 'w3 "w3" "WWW Browser" t)
;;(autoload 'w3-open-local "w3" "Open local file for WWW browsing" t)
;;(autoload 'w3-fetch "w3" "Open remote file for WWW browsing" t)
;;(autoload 'w3-use-hotlist "w3" "Use shortcuts to view WWW docs" t)
;;(autoload 'w3-show-hotlist "w3" "Use shortcuts to view WWW docs" t)
;;(autoload 'w3-follow-link "w3" "Follow a hypertext link." t)
;;(autoload 'w3-batch-fetch "w3" "Batch retrieval of URLs" t)
;;(autoload 'url-get-url-at-point "url" "Find the url under the cursor" nil)
;;(autoload 'url-file-attributes  "url" "File attributes of a URL" nil)
;;(autoload 'url-popup-info "url" "Get info on a URL" t)
;;(autoload 'url-retrieve   "url" "Retrieve a URL" nil)
;;(autoload 'url-buffer-visiting "url" "Find buffer visiting a URL." nil)
;;(autoload 'gopher-dispatch-object "gopher" "Fetch gopher dir" t)

;;;                         OS/2 specific setup(s)                       ;;;

;;; Make Emacs print with OS/2 - ONLY PRIOR TO V19.30.1
;;(if (eq window-system 'pm)
;;  (progn
;;    (defvar lpr-tmp-file "d:\\swap\\lprfile.tmp"
;;      "*Filename to use as an tmp file for printing contents of a buffer.")
;;    (setq print-region-function 'os2-print-command
;;          lpr-command "print"
;;          lpr-switches nil)))
;;; OS cannot print piped, so make an own defun to redirect commands.
;;; Print does not take input as stdin. Ergo make a tmp file and print it
;;(defun os2-print-command (start end command &rest bogus)
;;  (write-region start end lpr-tmp-file)
;;  (call-process command nil nil nil lpr-tmp-file "/D:LPT1")
;;  (delete-file lpr-tmp-file))

(setq lpr-switches '("-Phpdj"))  ;;; for HP Deskjet series

;;; Use Kai Uwe Rommel's port of GNU ls.
;;; Use only for version prior to 19.30.1
;;(add-hook 'dired-load-hook 'emx-dired-kur-ls-setup)

;;; Preserve mixed-case filenames
(setq case-fold-file-names 'preserve)

;;; Extended attributes are kept with edited (new) file
(setq backup-by-copying t)

;;; Enable OS/2 on-line help.
(autoload 'os2help "os2help" "OS/2 on-line help" t)
(setq os2help "/emx/book/emxdoc.ndx")
(global-set-key [C-f1] 'os2help)

;;; Do something about that annoying ^M problem
(defun strip-^m ()
  (goto-char (point-min))
  (while (search-forward "\r" nil nil)
    (replace-match "")))

(define-key esc-map "o" 'strip-^m)

;;; Call pm-edit-menu to let the Cut, Copy and Paste choices of the
;;; Edit menu use the OS/2 clipboard.
;;; Call pm-files-menu to let the `Open File...' and `Save Buffer As...'
;;; choices from the Files menu use OS/2's standard file dialog.
;;; Call remove-from-window-list to remove emacs.exe (the VIO window)
;;; from the Window List.  You might want to uncomment that statement
;;; if you use the PM interface and don't run Emacs manually.
;;; Call pm-session-bond to establish a bond between emacs.exe (the VIO
;;; window) and pmemacs.exe (the PM windows).  If you select emacs.exe,
;;; for instance by using the Window List, one of the PM windows will
;;; be selected instead of emacs.exe.
;;; Set the foreground and background colors of the mode line.
;;; Use `bold' face instead of `bold-italic' face for info nodes
(if window-system
      (pm-files-menu)   ;;; (pm-file-menu) prior to 19.29
      (pm-session-bond t)
      (set-face-background 'modeline "cyan")
      (set-face-foreground 'modeline "black")
      (make-face 'info-node)
      (copy-face 'bold 'info-node)))

;;;                             Online setup                             ;;;

;;; Set up files and directories for IBM TCP/IP 2.0 ;;;
(let ((etc (getenv "ETC"))
  (setq etc (if etc (replace-char-in-string etc ?\\ ?/)
  (setq etc (expand-file-name etc))
  (if (not (string-match "/$" etc))
      (setq etc (concat etc "/")))
  (setq mbox (concat etc "mail/inbox.ndx")
        rmail-spool-directory (concat etc "mail/")
        rmail-primary-inbox-list (list mbox)
        display-time-mail-file mbox
(setq rmail-secondary-file-regexp ".*\\(RMAIL\\|[Rr]mail\\).*"
      user-mail-address ""
       " (Oliver Heidelbach)"

;;; Set up rmail, gnus and supercite ;;;
;;; send back mail or archive mail in ~outgoing (or both)
;;  (setq mail-self-blind t)
(setq mail-archive-file-name (expand-file-name "~/outgoing"))

;;; Set height of header window
(setq rmail-summary-window-size 8)

;;; Set up additional header string for mail
(defun my-mail-setup ()
  (end-of-buffer) (previous-line 2)
      "Organization: Not organized\n"
      "X-Mailer: GNU Emacs [version "emacs-version"] for OS/2\n"

(add-hook 'mail-setup-hook 'my-mail-setup)

;; The following forms cause "r" to respond to message with
;; just the sender as the TO field. "R" builds a response with a
;; CC containing all original CCs.

(defun rmail-reply-cc-just-sender ()
  "Reply to the current message. CC just sender."
  (rmail-reply t))

(add-hook 'rmail-mode-hook '(lambda ()
	       (define-key rmail-mode-map "r" 
	       (define-key rmail-mode-map "R" 
               (local-set-key [M-C-down-mouse-1] 'make-mail-alias-menu)

;;; Rlogin does NOT work with OS/2 (as well as emacs telnet)
;;  (setq rlogin-explicit-args '("-8"))
;;; Supercite, use with EMACS higher than 19.16
;;  (autoload 'sc-perform-overloads "sc-oloads" "Supercite 3.1" t)
;;; for RMAIL:
;;  (setq mail-setup-hook 'sc-perform-overloads)
;;; for GNUS:
;;  (setq news-reply-mode-hook 'sc-perform-overloads)
;;  (setq mail-setup-hook 'sc-perform-overloads)

;;; Supercite Setup
;;; Use this if it's not done by another package, e.g. tm 
;;(autoload 'sc-cite-original     "supercite" "Supercite 3.1" t)
;;(autoload 'sc-submit-bug-report "supercite" "Supercite 3.1" t)
;;(add-hook 'mail-citation-hook 'sc-cite-original)

;;; tm (tiny mime) package
(setq mime-setup-use-sc t
      signature-insert-at-eof t
      signature-delete-blank-lines-at-eof t
      mime-editor/split-message nil        ;;; Don't split messages >64K
(require 'mime-setup)
(require 'tm-os2)
(cond (window-system
       (require 'hilit19)
       (let* ((csubject-patterns '(("^\\[.+\\]$" nil msg-subject)))
	      (header-patterns '(("^Subject:.*$" nil msg-subject)
				 ("^From:.*$" nil msg-from)
				 ("^--text follows this line--$"
				  nil msg-separator)
				 ("^[A-Za-z][A-Za-z0-9-]+:" nil msg-header)
	      (body-patterns '(("^\\(In article\\|[ \t]*\\w*[]<>}|]\\).*$"
				nil msg-quote)))
	      (message-patterns (append ;;csubject-patterns
	 (hilit-set-mode-patterns 'msg-header header-patterns)
	 (hilit-set-mode-patterns 'msg-body body-patterns)
	 (hilit-set-mode-patterns 'mime/viewer-mode
       (add-hook 'mime-viewer/content-header-filter-hook
		 (lambda ()
		   (if (not (eq mime::preview/original-major-mode
       (add-hook 'mime-viewer/plain-text-preview-hook
		 (lambda ()
		   (if (not (eq mime::preview/original-major-mode

;;;                             Test section                             ;;;
;;; From here on no guarantee ;-)                                        ;;;

;; End of site-start.el
previous ] [ start page ] [ next ]

Emacs site-start.el Oliver Heidelbach <ohei@snafu> is not responsible for the content of this page.
[Tue Oct 23 22:10:26 2001]