My Emacs Setup Suite
A.J.Hurst
Version 1.3.2
Table of Contents
1. Introduction
This is the .emacs file as customized for John Hurst.
The .emacs file, which should reside in your home directory, allows
you to customize the behavior of Emacs. In general, changes to your
.emacs file will not take effect until the next time you start up
Emacs. You can load it explicitly with `M-x load-file RET
~/.emacs RET'.
There is a great deal of documentation on customization in the
Emacs manual. You can read this manual with the online Info
browser: type `C-h i' or select "Emacs Info" from the "Help"
menu.
2. The .emacs file
A major issue to resolve at the start is whether we are setting
up to run Xemacs or GNU Emacs. The basic approach I am settling
upon is to not make a top level branch, but to put
switches in whatever specific customization is occuring. This
may contradict some of the statements and code below, since the
process of conversion is not yet complete.
This is revisited (20030120:094835) because under mac OSX
10.2.3 running Apple X11 beta, emacs does not work under X11,
but does as an Aqua application. XEmacs on the other hand works
as X11, but not Aqua. So I need both once again.
".emacs" 2.1 =
2.1 Emacs or XEmacs?
Since there is just the one .emacs file, we have
to parameterize things with respect to which system of emacs
we are running, Emacs or XEmacs. While in earlier versions I
tened to switch between them, the recent GNU Emacs versions
(20.3 on) have provided all the facilities I need, so I'm
sticking with that for the moment. We can pick which emacs we
are in from the variable emacs-version, and this is
used to set one of the variables running-xemacs and
running-emacs to true (obviously not both!). These
variables are subsequently used wherever there needs to be a
distinction made in the setup or customization.
<define whether emacs or xemacs 2.2> =(defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version))
(defvar running-emacs (not running-xemacs))
2.2 UTF-8
<setup UTF-8 2.3> =;;;;;;;;;;;;;;;;;;;;
;; set up unicode
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
;; This from a japanese individual. I hope it works.
(setq default-buffer-file-coding-system 'utf-8)
;; From Emacs wiki
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
I know very little about what UTF-8 means to emacs, so I just
copied this from a web page. I think it works! Note that I
had to move it up to the front of the file - again I don't
know why this has to be.
2.3 Setting the load path
This is akin to setting the PATH variable at the
shell level. The emacs variable load-path
determines where any load files are searched. The
load-path is set to different things depending upon
whether we are xemacs or not.
<set up load path 2.4> =(setq homedir (getenv "HOME"))
(defvar my-emacs-dir "/Computers/emacs")
(setq load-path
(append
(list
(concat homedir my-emacs-dir)
(concat homedir my-emacs-dir "/lisp")
"/usr/share/emacs/site-lisp"
"/usr/share/emacs/22.1/lisp/progmodes"
"/usr/share/emacs/site-lisp/psgml"
"/usr/local/share/emacs/site-lisp"
"/sw/share/emacs22/site-lisp/nxml-mode"
)
load-path)
)
These are the default ones: both emacs and xemacs use this.
If a file is defined in both the emacs and xemacs
subdirectories, the latter will be found first and override
the emacs version.
<set up load path 2.5> =(cond (running-xemacs
(setq load-path
(append (list
(concat homedir "/.xemacs")
)
load-path)))
)
The XEmacs only ones.
<set up load path 2.6> =(setq load-path (append nil load-path))
Finally, include a nil at the start of the list. This
indicates we want to search the current directory first.
2.4 Basic Customization
Enable the commands narrow-to-region (C-x
n n) and eval-expression
(M-ESC, or ESC ESC). Both are
useful commands, but they can be confusing for a new user,
so they can be commented out if necessary.
<basic customization 2.7> =(put 'narrow-to-region 'disabled nil)
(put 'eval-expression 'disabled nil)
(setq host (system-name))
Chunk referenced in 2.1Chunk defined in 2.7,
2.8
Make the sequence C-x w execute the
what-line command, which prints the current line
number in the echo area. I use kp-insert t l for
this function, so it is commented out.
<basic customization 2.8> =;(global-set-key "\C-xw" 'what-line)
;(global-set-key "\M-s" 'save-buffer)
Chunk referenced in 2.1Chunk defined in 2.7,
2.8
2.5 Time zone customization
Xemacs has a bug that when using pre-built binaries, it uses
the time zone under which it was built, not the local time
zone. (See XEmacs FAQ,
http://www.xemacs.org/faq/xemacs-installation.html\#Q2_1_19)
It also does not respond correctly to the
``Australia/Victoria'' rule. Why, I don't know. You have to
change manually the GMT-10 to GMT-11
when it is daylight savings time because of this.
<set time zone 2.9> =
<default time zone rule 2.10> =(t (set-time-zone-rule "Australia/Victoria"))
2.6 Face and Colour customization
I like to have pretty background colours and stuff. Here's where we
set all that.
<face and colour customization 2.11> =(setq ararat-colour "rgb:ff/ff/cc")
(setq ballarat-colour "rgb:cc/ff/66")
(setq bendigo-colour "rgb:ff/cc/cc")
(setq bittern-colour "rgb:dd/ff/ff")
(setq clematis-colour "rgb:99/ff/ff")
(setq dimboola-colour "rgb:dd/ff/dd")
(setq murtoa-colour "rgb:ff/ff/99")
(setq rainbow-colour "rgb:cc/ff/99")
(setq hawthorn-colour "rgb:cc/ff/ff")
(string-match "\\([^.]*\\)" (system-name))
(setq host (match-string 0 (system-name)))
(setq server host)
(cond
((or (equal server "ararat"))
(setq background-colour ararat-colour)
)
((or (equal server "bittern")
(equal server "dhcp84-140")
(equal server "localhost")
(string-match "roaming-.*" server)
(string-match "bsit-.*" server)
(string-match "dyn-.*" server))
(setq background-colour bittern-colour)
)
((equal server "clematis")
(setq background-colour clematis-colour)
)
((equal server "ballarat")
(setq background-colour ballarat-colour)
)
((equal server "bendigo")
(setq background-colour bendigo-colour)
)
((equal server "dimboola")
(setq background-colour dimboola-colour)
)
((equal server "murtoa")
(setq background-colour murtoa-colour)
)
((equal server "rainbow")
(setq background-colour rainbow-colour)
)
(t
(setq background-colour hawthorn-colour)
)
)
<customization 2.12> =(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(gud-gdb-command-name "gdb --annotate=1")
'(large-file-warning-threshold nil)
'(py-indent-offset 2)
'(tool-bar-mode nil nil (tool-bar)))
(setq which-emacs nil)
(if (or (string-match "/Applications/Emacs.app/Contents/MacOS/" invocation-directory)
(string-match "/Applications/Aquamacs Emacs.app/Contents/MacOS/" invocation-directory))
(progn
(setq which-emacs "MacOSX")
(string-match ".*:\\([^/]*\\)/\\([^/]*\\)/\\([^/]*\\)" background-colour)
(setq red (match-string 1 background-colour))
(setq green (match-string 2 background-colour))
(setq blue (match-string 3 background-colour))
(setq background-colour (concat "rgb:" blue "/" green "/" red))
))
(if which-emacs
(custom-set-faces
'(default ((t (:stipple nil :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 90 :width normal :family "apple-monaco")
)
))
)
'(font-lock-keyword-face ((((class color) (min-colors 88) (background light)) (:foreground "Red" :inverse-video nil))))
'(nxml-element-prefix-face ((t (:foreground "#007700"))))
'(nxml-name-face ((((class color) (background light)) (:foreground "#ff1111"))))
'(nxml-tag-delimiter-face ((t (:inherit nxml-name-face))))
'(nxml-tag-slash-face ((t (:background "white" :foreground "#661111")))
)
)
<face and colour customization 2.13> =(unless running-xemacs
(set-foreground-color "black")
(setq fontstr "6x10")
(or (string= "6x10" (cdr (assoc 'font (frame-parameters))))
(condition-case nil
(set-default-font fontstr)
(error (setq fontstr "-apple-monaco-medium-r-normal--9-90-75-75-m-90-mac-roman")
(set-default-font fontstr)
)
)
)
(set-face-font 'default fontstr)
(set-face-background 'default background-colour)
(set-face-background 'mode-line "brown")
(set-face-foreground 'mode-line "white")
(set-face-font 'mode-line fontstr)
(set-face-background 'region "yellow")
)
2.7 Load Macro Collections
Now get various collections of macros.
<load up macro collections 2.14> =(load "ajhmac")
(load "date-time")
(load "files")
;(load "sgml-catalog-links")
;(load-library "mh-e")
I was going to add a link to pull up some handy definitions
of PUBLIC identifiers through sgml-catalog-links, but
it all got a bit too hard for me thinking how to do it.
Perhaps another time.
<set some variables 2.15> =
<set term file prefix 2.16> = (setq term-file-prefix "/home/ajh/emacs/term/")
Identify where terminal parameters are located. Commented
out, since we don't have differing terminals. (I think.)
<set version control 2.17> = (setq version-control t)
Control use of version numbers for backup files. t means
make numeric backup versions unconditionally. nil means make
them for files that have some already. `never' means do not
make them.
<set number of old versions kept 2.18> = (setq kept-old-versions 6)
Handle various windowing methods.
<get environment 2.19> =(string-match "\\([^.]*\\)" (system-name))
(setq host (match-string 0 (system-name)))
(setq server host)
This used to perform a call on getenv to collect three environment variables set by my bash_profile. Since moving to xdm, which doesn't run
<handle various windowing methods 2.20> =(if (and running-xemacs (eq (console-type) 'x))
(progn
(require 'tile-screens "tile")
;;(setq default-frame-alist
;; (append '((left . -0) (top . 0) (height . 43) (width . 80))
;; default-frame-alist))
(setq initial-frame-alist default-frame-alist)
)
)
2.8 Setup Hooks
Set my hook and other variables
<setup hooks 2.21> =;(indented-text-mode)
;(setq text-mode-hook 'turn-on-auto-fill)
<setup tex-mode hook 2.22>
<setup calendar hook 2.23> **** Chunk omitted!
<setup sgml hook 2.24>
<setup server hooks 2.25>
;(display-time) ; run the time display
;(diary)
;(add-hook 'diary-hook 'appt-make-list)
(if running-emacs
(add-hook 'after-make-frame-functions
(lambda (frame)
(select-frame frame)
(let ((bgc (getenv "BGCOLOUR")))
(if bgc (set-background-color bgc))
)
(condition-case nil
(set-default-font "6x10")
(error (set-default-font "-apple-monaco-medium-r-normal--9-90-75-75-m-90-mac-roman")))
(set-foreground-color "black")
(set-face-background 'default background-colour)
(set-face-foreground 'mode-line "white")
(set-face-background 'mode-line "brown")
(set-face-font 'mode-line "-apple-monaco-medium-r-normal--10-100-75-75-m-100-mac-roman")
(set-face-background 'region "yellow")
)
)
(add-hook 'create-frame-hook
(lambda ()
(set-face-background (find-face 'default) "rgb:f/f/c")
)
)
)
;(setq enable-local-variables t)
Note the subtle difference between Emacs and XEmacs in
setting the background colour
<setup tex-mode hook 2.22> =(setq tex-mode-hook
(function (lambda ()
(turn-on-auto-fill)
(load "ajh-tex")
(local-set-key "\C-ce" 'mc-env)
(local-set-key "\C-ci" 'mc-italic)
(local-set-key "\C-cb" 'mc-boldface)
(local-set-key "\C-ct" 'mc-typewriter)
(local-set-key "\C-cv" 'mc-verbatim)
(local-set-key "\C-cg" 'tex-tab-toggle)
(local-set-key "\C-i" 'tab-to-tab-stop)
(local-set-key "\"" 'self-insert-command)
)))
<setup calendar hook 2.23> =(setq calendar-load-hook
(function (lambda ()
(define-key calendar-mode-map [down] 'move-down)
(define-key calendar-mode-map [up] 'move-up)
(define-key calendar-mode-map [left] 'move-left)
(define-key calendar-mode-map [right] 'move-right)
(european-calendar)
)
)
)
<setup sgml hook 2.24> =(defun ajh-xml-functions ()
(setq sgml-custom-markup `(("double quote" "\"\\r\"")))
(setq sgml-local-catalogs `("/home/ajh/etc/sgml/catalog"))
)
(add-hook `sgml-mode-hook `ajh-xml-functions)
I like to have some additional features provided in xml-mode.
<setup server hooks 2.25> =(add-hook 'server-switch-hook
(lambda nil
(let ((server-buf (current-buffer)))
(bury-buffer)
(switch-to-buffer-other-frame server-buf))))
Make a server hook to create new frames when emacsclient
called.
<set up autoloads 2.26> =(autoload 'python-mode "python-mode" "Python editing mode" t)
(autoload 'napier-mode "napier" "Napier mode" t nil)
(autoload 'funnelweb-mode "funnelweb" "FunnelWeb mode" t nil)
(autoload 'noweb-mode "noweb" "Noweb Mode" t nil)
(autoload 'nutweb-mode "nutweb" "Nutweb Mode" t nil)
;(load "/sw/share/emacs/site-lisp/nxml-mode/rng-auto.el")
(autoload 'xml-mode "psgml" "XML major mode" t)
(cond ((equal server "murtoa")
(autoload 'prolog-mode "/usr/local/lib/ciao/DOTemacs.el"
"prolog editing mode" t nil)
(load-file "/usr/local/lib/ciao/DOTemacs.el")
)
)
(setq auto-mode-alist
(append
(list
(cons "\\.w$" 'xml-mode)
(cons "\\.xsl$" 'xml-mode)
(cons "\\.xml$" 'xml-mode)
(cons "\\.xlp$" 'xml-mode)
(cons "\\.xlu$" 'xml-mode)
(cons "\\.py$" 'python-mode)
(cons "\\.s$" 'nutweb-mode)
(cons "\\.nw$" 'noweb-mode)
(cons "\\.N$" 'napier-mode)
(cons "\\.fw$" 'funnelweb-mode)
)
auto-mode-alist))
(setq interpreter-mode-alist (cons '("python" . python-mode)
interpreter-mode-alist))
<psgml xml mode .emacs autoloads 2.46>
Set up autoloads and automodes. These are modes that are
triggered automatically by file suffixes. The modes themselves
are autoloaded as necessary.
<global key bindings 2.27> =(global-set-key "\M-s" 'save-buffer)
(global-set-key "\C-cf" 'mc-fill)
(global-set-key "\C-n" 'mc-next-line)
(global-set-key "\C-o" nil)
(setq tab-stop-list '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 80))
(setq-default indent-tabs-mode nil)
Define various global key bindings and other settings.
-
C-c f fills a paragraph (like
insert t f)
- Change C-n to my version of next line.
- Set the tabs to be four spaces apart, not 8.
-
indent-tabs-mode is turned off. If this is true,
indentation will use tab characters. I prefer spaces.
<set the frame titles 2.28> =(setq frame-title-format "=%b=%f")
(setq frame-icon-title-format "=%b")
(setq icon-title-format "=%b")
Finally, setup keyboard. The following code determines the
style of keyboard. It would be nice if there some way of
determining the keyboard type. I can't think of any way of
extracting this from environment variables or the like.
(version 1.1.7) Now I have the server and
host variables, we can test for the keyboard type. We
do it like so:
<setup keyboard 2.29> =(cond
((equal server "ararat") (load "powerbook-keys"))
((equal server "ballarat") (load "powerbook-keys"))
((equal server "bendigo") (load "powerbook-keys"))
((equal server "bittern") (load "powerbook-keys"))
((equal server "clematis") (load "powerbook-keys"))
((equal server "dimboola") (load "powerbook-keys"))
((equal server "murtoa") (load "powerbook-keys"))
((string-match "Ararat" server) (load "powerbook-keys"))
((string-match "localhost" server) (load "powerbook-keys"))
((string-match "roaming-.*" server) (load "powerbook-keys"))
((string-match "dyn-.*" server) (load "powerbook-keys"))
((string-match "dhcp.*-.*" server) (load "powerbook-keys"))
((string-match "bsit.*-.*" server) (load "powerbook-keys"))
((string-match "wc-caul-jhurst" server) (load "powerbook-keys"))
((equal server "junee") (load "ppc-keys"))
((equal server "central") (load "pc-keys"))
((equal server "hawthorn") (load "pc-keys"))
((equal server "indy03") (load "indy-keys"))
((null server) (load "powerbook-keys"))
)
2.9 Multiple Frames
I find it handy when Emacs is fired up to make a number of
frames immediately. The frame parameters of this initial frame
set are adjusted to make the frames appear on the desktop
below the default one.
<number of additional initial frames 2.30> = 0
<create multiple frames 2.31> =(setq default-frame-alist '((tool-bar-lines . 0)
(menu-bar-lines . 1) (height . 60) (width . 80) (top . 0) (left . 0)))
(setq i 0)
(cond ((equal host server)
(while (< i
<number of additional initial frames 2.30>)
(make-frame (list (cons 'user-position t)
(cons 'top 0)
(cons 'left 770)
(cons 'visibility 'icon)))
(setq i (1+ i))
)
)
)
Rev up a <number of additional initial frames 2.30>. I do this because I
have not yet worked out how to send a signal from the external
environment into emacs to cause it to spawn a new window.
Hence I just make some spares, and drag around the desktop as
necessary.
The spare frames are made iconic initially, but it seems that
the positioning parameters don't work in this case. However,
I have left them in, to indicate where I want the frames to
appear! (This would seem to be a bug in something?) (v1.2.5)
Problem solved! The addition of the user-position
parameter and setting it non-nil fixed this. See the ELisp
manual page 528.
2.10 XEmacs customization
<XEmacs customization 2.32> =(cond (running-xemacs
;;
;; Code for any version of XEmacs/Lucid Emacs goes here
;;
<set xemacs variables 2.33>
<set ispell parameters 2.34> **** Chunk omitted!
<set buffer name format in mode line 2.35>
<running under X code 2.36> **** Chunk omitted!
<sticky modifier keys 2.38> **** Chunk omitted!
<setup window title bar 2.39> **** Chunk omitted!
<setup emacs sounds 2.40> **** Chunk omitted!
; (cond ((string-match ":0" (getenv "DISPLAY"))
; nil ;(load-default-sounds)
; )
; (t
; (setq bell-volume 40)
; (setq sound-alist
; (append sound-alist '((no-completion :pitch 500))))
; ))
;; Make `C-x C-m' and `C-x RET' be different (since I tend
;; to type the latter by accident sometimes.)
;(define-key global-map [(control x) return] nil)
;; Change the pointer used when the mouse is over a modeline
;(set-glyph-image modeline-pointer-glyph "leftbutton")
;; Change the pointer used during garbage collection.
;;
;; Note that this pointer image is rather large as pointers go,
;; and so it won't work on some X servers (such as the MIT
;; R5 Sun server) because servers may have lamentably small
;; upper limits on pointer size.
;;(if (featurep 'xpm)
;; (set-glyph-image gc-pointer-glyph
;; (expand-file-name "trash.xpm" data-directory)))
;; Here's another way to do that: it first tries to load the
;; pointer once and traps the error, just to see if it's
;; possible to load that pointer on this system; if it is,
;; then it sets gc-pointer-glyph, because we know that
;; will work. Otherwise, it doesn't change that variable
;; because we know it will just cause some error messages.
; (if (featurep 'xpm)
; (let ((file (expand-file-name "recycle.xpm" data-directory)))
; (if (condition-case error
; ;; check to make sure we can use the pointer.
; (make-image-instance file nil
; '(pointer))
; (error nil)) ; returns nil if an error occurred.
; (set-glyph-image gc-pointer-glyph file))))
;; Add `dired' to the File menu
;(add-menu-item '("File") "Edit Directory" 'dired t)
; ;; Here's a way to add scrollbar-like buttons to the menubar
; (add-menu-item nil "Top" 'beginning-of-buffer t)
; (add-menu-item nil "<<<" 'scroll-down t)
; (add-menu-item nil " . " 'recenter t)
; (add-menu-item nil ">>>" 'scroll-up t)
; (add-menu-item nil "Bot" 'end-of-buffer t)
;; Change the behavior of mouse button 2 (which is normally
;; bound to `mouse-yank'), so that it inserts the selected text
;; at point (where the text cursor is), instead of at the
;; position clicked.
;;
;; Note that you can find out what a particular key sequence or
;; mouse button does by using the "Describe Key..." option on
;; the Help menu.
;(setq mouse-yank-at-point t)
;;
;; When editing C code (and Lisp code and the like), I often
;; like to insert tabs into comments and such. It gets to be
;; a pain to always have to use `C-q TAB', so I set up a more
;; convenient binding. Note that this does not work in
;; TTY frames.
; (define-key global-map '(shift tab) 'self-insert-command)
;; LISPM bindings of Control-Shift-C and Control-Shift-E.
;; Note that "\C-C" means Control-C, not Control-Shift-C.
;; To specify shifted control characters, you must use the
;; more verbose syntax used here.
; (define-key emacs-lisp-mode-map '(control C) 'compile-defun)
; (define-key emacs-lisp-mode-map '(control E) 'eval-defun)
;; If you like the FSF Emacs binding of button3 (single-click
;; extends the selection, double-click kills the selection),
;; uncomment the following:
;; Under 19.13, the following is enough:
(define-key global-map 'button3 'mouse-track-adjust)
;; But under 19.12, you need this:
;(define-key global-map 'button3
; (lambda (event)
; (interactive "e")
; (let ((default-mouse-track-adjust t))
; (mouse-track event))))
;; Under both 19.12 and 19.13, you also need this:
(add-hook 'mouse-track-click-hook
(lambda (event count)
(if (or (/= (event-button event) 3)
(/= count 2))
nil ;; do the normal operation
(kill-region (point) (mark))
t ;; don't do the normal operations.
)))
;; If you select text, and you want the next input to
;; replace that selected text, uncomment the following line.
(if running-emacs (require 'pending-del))
))
;;; Older versions of emacs did not have these variables
;;; (emacs-major-version and emacs-minor-version.)
;;; Let's define them if they're not around, since they make
;;; it much easier to conditionalize on the emacs version.
(if (and (not (boundp 'emacs-major-version))
(string-match "^[0-9]+" emacs-version))
(setq emacs-major-version
(string-to-int (substring emacs-version
(match-beginning 0) (match-end 0)))))
(if (and (not (boundp 'emacs-minor-version))
(string-match "^[0-9]+\\.\\([0-9]+\\)" emacs-version))
(setq emacs-minor-version
(string-to-int (substring emacs-version
(match-beginning 1) (match-end 1)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Customization of Specific Packages ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ********************
;;; Load ange-ftp, which uses the FTP protocol as a pseudo-filesystem.
;;; When this is loaded, the pathname syntax /user@host:/remote/path
;;; refers to files accessible through ftp.
;;;
;(require 'dired)
;(require 'ange-ftp)
;(setq ange-ftp-default-user "anonymous" ; id to use for /host:/remote/path
; ange-ftp-generate-anonymous-password t ; use $USER@`hostname`
; ange-ftp-binary-file-name-regexp "." ; always transfer in binary mode
; )
;; This adds additional extensions which indicate files normally
;; handled by cc-mode.
;(setq auto-mode-alist
; (append '(("\\.C$" . c++-mode)
; ("\\.cc$" . c++-mode)
; ("\\.hh$" . c++-mode)
; ("\\.c$" . c-mode)
; ("\\.h$" . c-mode))
; auto-mode-alist))
;;; ********************
;;; cc-mode (the mode you're in when editing C, C++, and Objective C files)
;; Tell cc-mode not to check for old-style (K&R) function declarations.
;; This speeds up indenting a lot.
;(setq c-recognize-knr-p nil)
;;; Change the indentation amount to 4 spaces instead of 2.
;;; You have to do it in this complicated way because of the
;;; strange way the cc-mode initializes the value of `c-basic-offset'.
;(add-hook 'c-mode-hook (lambda () (setq c-basic-offset 4)))
;;; ********************
;;; Load a partial-completion mechanism, which makes minibuffer completion
;;; search multiple words instead of just prefixes; for example, the command
;;; `M-x byte-compile-and-load-file RET' can be abbreviated as `M-x b-c-a RET'
;;; because there are no other commands whose first three words begin with
;;; the letters `b', `c', and `a' respectively.
;;;
;(load-library "completer")
;;; ********************
;;; Load crypt, which is a package for automatically decoding and reencoding
;;; files by various methods - for example, you can visit a .Z or .gz file,
;;; edit it, and have it automatically re-compressed when you save it again.
;;;
;(setq crypt-encryption-type 'pgp ; default encryption mechanism
; crypt-confirm-password t ; make sure new passwords are correct
; ;crypt-never-ever-decrypt t ; if you don't encrypt anything, set this to
; ; tell it not to assume that "binary"
; ; are encrypted and require a password.
; )
;(require 'crypt)
;;; ********************
;;; Edebug is a source-level debugger for emacs-lisp programs.
;;;
;(define-key emacs-lisp-mode-map "\C-xx" 'edebug-defun)
;;; ********************
;;; Font-Lock is a syntax-highlighting package. When it is enabled and you
;;; are editing a program, different parts of your program will appear in
;;; different fonts or colors. For example, with the code below, comments
;;; appear in red italics, function names in function definitions appear in
;;; blue bold, etc. The code below will cause font-lock to automatically be
;;; enabled when you edit C, C++, Emacs-Lisp, and many other kinds of
;;; programs.
;;;
;;; The "Options" menu has some commands for controlling this as well.
;;;
;(cond (running-xemacs
; ;; If you want the default colors, you could do this:
; ;; (setq font-lock-use-default-fonts nil)
; ;; (setq font-lock-use-default-colors t)
; ;; but I want to specify my own colors, so I turn off all
; ;; default values.
; (setq font-lock-use-default-fonts nil)
; (setq font-lock-use-default-colors nil)
; (require 'font-lock)
; ;; Mess around with the faces a bit. Note that you have
; ;; to change the font-lock-use-default-* variables *before*
; ;; loading font-lock, and wait till *after* loading font-lock
; ;; to customize the faces.
; ;; string face is green
; (set-face-foreground 'font-lock-string-face "forest green")
; ;; comments are italic and red; doc strings are italic
; ;;
; ;; (I use copy-face instead of make-face-italic/make-face-bold
; ;; because the startup code does intelligent things to the
; ;; 'italic and 'bold faces to ensure that they are different
; ;; from the default face. For example, if the default face
; ;; is bold, then the 'bold face will be unbold.)
; ;(copy-face 'italic 'font-lock-comment-face)
; ;; Underling comments looks terrible on tty's
; (set-face-underline-p 'font-lock-comment-face nil 'global 'tty)
; (set-face-highlight-p 'font-lock-comment-face t 'global 'tty)
; (copy-face 'font-lock-comment-face 'font-lock-doc-string-face)
; (set-face-foreground 'font-lock-comment-face "red")
; ;; function names are bold and blue
; (copy-face 'bold 'font-lock-function-name-face)
; (set-face-foreground 'font-lock-function-name-face "blue")
; ;; misc. faces
; (and (find-face 'font-lock-preprocessor-face) ; 19.13 and above
; (copy-face 'bold 'font-lock-preprocessor-face))
; (copy-face 'italic 'font-lock-type-face)
; (copy-face 'bold 'font-lock-keyword-face)
; ))
;;; ********************
;;; fast-lock is a package which speeds up the highlighting of files
;;; by saving information about a font-locked buffer to a file and
;;; loading that information when the file is loaded again. This
;;; requires a little extra disk space be used.
;;;
;;; Normally fast-lock puts the cache file (the filename appended with
;;; .flc) in the same directory as the file it caches. You can
;;; specify an alternate directory to use by setting the variable
;;; fast-lock-cache-directories.
;; Let's use lazy-lock instead.
;(add-hook 'font-lock-mode-hook 'turn-on-fast-lock)
;(setq fast-lock-cache-directories '("/foo/bar/baz"))
;;; ********************
;;; lazy-lock is a package which speeds up the highlighting of files
;;; by doing it "on-the-fly" -- only the visible portion of the
;;; buffer is fontified. The results may not always be quite as
;;; accurate as using full font-lock or fast-lock, but it's *much*
;;; faster. No more annoying pauses when you load files.
;(add-hook 'font-lock-mode-hook 'turn-on-lazy-lock)
;; I personally don't like "stealth mode" (where lazy-lock starts
;; fontifying in the background if you're idle for 30 seconds)
;; because it takes too long to wake up again on my piddly Sparc 1+.
;(setq lazy-lock-stealth-time nil)
;;; ********************
;;; func-menu is a package that scans your source file for function
;;; definitions and makes a menubar entry that lets you jump to any
;;; particular function definition by selecting it from the menu. The
;;; following code turns this on for all of the recognized languages.
;;; Scanning the buffer takes some time, but not much.
;;;
;;; Send bug reports, enhancements etc to:
;;; David Hughes <ukchugd@ukpmr.cs.philips.nl>
;;;
;(cond (running-xemacs
; (require 'func-menu)
; (define-key global-map 'f14 'function-menu)
; (add-hook 'find-file-hooks 'fume-add-menubar-entry)
; (define-key global-map "\C-cl" 'fume-list-functions)
; (define-key global-map "\C-cg" 'fume-prompt-function-goto)
;; The Hyperbole information manager package uses (shift button2) and
;; (shift button3) to provide context-sensitive mouse keys. If you
;; use this next binding, it will conflict with Hyperbole's setup.
;; Choose another mouse key if you use Hyperbole.
; (define-key global-map '(shift button3) 'mouse-function-menu)
;; For descriptions of the following user-customizable variables,
;; type C-h v <variable>
; (setq fume-max-items 25
; fume-fn-window-position 3
; fume-auto-position-popup t
; fume-display-in-modeline-p t
; fume-menubar-menu-location "File"
; fume-buffer-name "*Function List*"
; fume-no-prompt-on-valid-default nil)
; ))
;;; ********************
;;; MH is a mail-reading system from the Rand Corporation that relies on a
;;; number of external filter programs (which do not come with emacs.)
;;; Emacs provides a nice front-end onto MH, called "mh-e".
;;;
;; Bindings that let you send or read mail using MH
;(global-set-key "\C-xm" 'mh-smail)
;(global-set-key "\C-x4m" 'mh-smail-other-window)
;(global-set-key "\C-cr" 'mh-rmail)
;; Customization of MH behavior.
;(setq mh-delete-yanked-msg-window t)
;(setq mh-yank-from-start-of-msg 'body)
;(setq mh-summary-height 11)
;; Use lines like the following if your version of MH
;; is in a special place.
;(setq mh-progs "/usr/dist/pkgs/mh/bin.svr4/")
;(setq mh-lib "/usr/dist/pkgs/mh/lib.svr4/")
;;; ********************
;;; resize-minibuffer-mode makes the minibuffer automatically
;;; resize as necessary when it's too big to hold its contents.
;(autoload 'resize-minibuffer-mode "rsz-minibuf" nil t)
;(resize-minibuffer-mode)
;(setq resize-minibuffer-window-exactly nil)
;;; ********************
;;; W3 is a browser for the World Wide Web, and takes advantage of the very
;;; latest redisplay features in XEmacs. You can access it simply by typing
;;; 'M-x w3'; however, if you're unlucky enough to be on a machine that is
;;; behind a firewall, you will have to do something like this first:
;(setq w3-use-telnet t
; ;;
; ;; If the Telnet program you use to access the outside world is
; ;; not called "telnet", specify its name like this.
; w3-telnet-prog "itelnet"
; ;;
; ;; If your Telnet program adds lines of junk at the beginning
; ;; of the session, specify the number of lines here.
; w3-telnet-header-length 4
; )
;(setq w3-default-homepage "http://www.cs.monash.edu.au/~ajh/index.html")
;(setq url-keep-history t)
;(setq minibuffer-max-depth nil)
;(set-specifier default-toolbar-visible-p nil)
<set xemacs variables 2.33> =(setq
find-file-use-truenames nil
find-file-compare-truenames t
minibuffer-confirm-incomplete t
complex-buffers-menu-p nil
next-line-add-newlines nil
; mail-yank-prefix "> "
kill-whole-line t
)
Change the values of some variables. (t means true; nil
means false.) Use the "Describe Variable..." C-h v
keystrokes to find out what these variables mean.
<set ispell parameters 2.34> =(setq ispell-extra-args '("-W" "3"))
When running ispell, consider all 1-3 character words as
correct.
<set buffer name format in mode line 2.35> =(if (boundp 'modeline-buffer-identification)
(progn
(setq-default modeline-buffer-identification '("XEmacs: %17b"))
(setq modeline-buffer-identification '("XEmacs: %17b"))
)
)
Change the way the buffer name is displayed in the
modeline. The variable for this is called
modeline-buffer-identification but was called
mode-line-buffer-identification in older
XEmacsen.
<running under X code 2.36> =
Code which applies only when running emacs under X goes
here. (We check whether the function device-type
exists before using it. In versions before 19.12, there
was no such function. If it doesn't exist, we simply
assume we're running under X -- versions before 19.12 only
supported X.)
<X specific code 2.37> =
<sticky modifier keys 2.38> =(setq modifier-keys-are-sticky t)
Uncomment this to enable ``sticky modifier keys'' in
19.13 and up. With sticky modifier keys enabled, you can
press and release a modifier key before pressing the key
to be modified, like how the ESC key works always. If you
hold the modifier key down, however, you still get the
standard behavior. I personally think this is the best
thing since sliced bread (and a *major* win when it comes
to reducing Emacs pinky), but it's disorienting at first
so I'm not enabling it here by default.
<setup window title bar 2.39> =(if (equal frame-title-format "%S: %b")
(setq frame-title-format
(concat "%S: " invocation-directory invocation-name
" [" emacs-version "]"
(if nil ; (getenv "NCD")
""
" %b")
)
)
)
This changes the variable which controls the text that
goes in the top window title bar. (However, it is not
changed unless it currently has the default value, to
avoid interfering with a -wn command line argument I may
have started emacs with.)
<setup emacs sounds 2.40> =
If we're running on display 0, load some nifty sounds
that will replace the default beep. But if we're running
on a display other than 0, which probably means my NCD X
terminal, which can't play digitized sounds, do two
things: reduce the beep volume a bit, and change the pitch
of the sound that is made for "no completions."
(Note that sampled sounds only work if XEmacs was
compiled with sound support, and we're running on the
console of a Sparc, HP, or SGI machine, or on a machine
which has a NetAudio server; otherwise, you just get the
standard beep.)
(Note further that changing the pitch and duration of the
standard beep only works with some X servers; many servers
completely ignore those parameters.)
<set up autosaves 2.41> =(setq auto-save-directory (expand-file-name "~/autosave/")
auto-save-directory-fallback auto-save-directory
auto-save-hash-p nil
ange-ftp-auto-save t
ange-ftp-auto-save-remotely nil
Define a variable to indicate whether we're running
XEmacs/Lucid Emacs. (You do not have to defvar a global
variable before using it -- you can just call `setq'
directly like we do for `emacs-major-version' below. It's
clearer this way, though.)
Load the auto-save.el package, which lets you put all of
your autosave files in one place, instead of scattering
them around the file system. This is xemacs specific.
<set up autosaves 2.42> = auto-save-interval 2000
)
Now that we have auto-save-timeout, we crank this up for
a better interactive response.
<set up autosaves 2.43> =(require 'auto-save)
We load this afterwards because it checks to make sure
the auto-save-directory exists (creating it if not) when
it's loaded.
2.11 Emacs customization
The first thing to set is transient-mark-mode,
which makes the region get highlighted regardless of whether
selected by mouse drag of point and mark positioning.
<Emacs customization 2.44> =
I run an emacs client for handling exmh mail editing. Here we
start that emacsclient.
<start emacsclient 2.45> =(server-start)
2.12 Various Application Customizations
2.12.1 The PSGML SGML editing mode
This is the READ ME file for psgml.el version 1.0
PSGML is a major mode for editing SGML documents. It works
with GNU Emacs 19.19 and later or with XEmacs 19.13.
This distribution should contain the following source
files:
psgml.el
psgml.texi
psgml-other.el
psgml-lucid.el
psgml-edit.el
psgml-parse.el
psgml-dtd.el
psgml-info.el
psgml-charent.el
psgml-api.texi -- internals documentation
psgml-api.el -- Extra functions for the API
iso88591.map
Makefile.in
In addition the distribution contains the formatted versions of the
documentation files (psgml.info, ...). But the compiled elisp code is
no longer supplied. You will have to byte compile the files before
PSGML will achieve usable speed.
PSGML now comes with autoconf support. See INSTALL for generic
instructions. Run
sh configure
make
and possibly
make install
If you are using xemacs, you can run give the argument
`--with-xemacs' to configure, or use `make xemacs'.
Instead of using configure you can load the psgml-main.el file
and run the command psgml-compile-files. Then you have to set
load-path or move the .elc files.
Send bug reports, comments and suggestions to lenst@@lysator.liu.se.
2.12.1.1 New in version 1.0
Main changes:
- Support for general entities
- Support for short reference
- Support for catalog files
- New mechanism for caching parsed DTD
- Includes commands to list various aspects of the DTD
Entity support:
PSGML will recognize entity references (except in attribute values). If
the entity is a general text entity, PSGML will also parse the content
of the entity. To support this PSGML has a new entity manager with a
new mechanism for looking up entities (see belove).
Short references are also supported, for the short reference delimiters
from the concrete reference syntax.
There are some new and changed commands to complete the entity support:
- Command: `sgml-expand-entity-reference'
Insert the text of the entity referenced at point.
- Command: `sgml-expand-all-shortrefs'
Expand all short references in the buffer. Short references to text
entities are expanded to the replacement text of the entity, other
short references are expanded into general entity references. If
argument, `to-entity', is non-nil, or if called interactive with
numeric prefix argument, all short references are replaced by generally
entity references.
- Command: `sgml-normalize'
Changed to expand short references also. Normalize buffer by filling in
omitted tags and expanding empty tags. Argument `to-entity' controls
how short references are expanded as with `sgml-expand-all-shortrefs'.
Fontification:
If `sgml-set-face' is true and the DTD has been activated,
PSGML will automatically set the face of markup in the buffer.
First the current line is parsed and fontified. If this would mean
parsing more than 500 chars, wait 1 second first.
The rest of the buffer is fontified after 6 seconds idle time.
Fontification can be interrupted by any input event.
The buffer can be fontified initially if
`sgml-auto-activate-dtd' is true.
New entity manager:
The new entity manager will handle an entity reference thus:
- If the entity has a system identifier, the entity manager will first
try and call the functions on `sgml-sysid-resolve-functions'
with the system identifier as argument, and if any function returns
non-nil assume that the function has handled the entity.
- If the entity has a system identifier and
`sgml-system-identifiers-are-preferred' is non-nil, the system
identifier will be used as a file name relative to the file containing
the entity declaration.
- Next the entity manager will try the catalog, and
- if not found there use the `sgml-public-map'.
- Finally if the entity has not been found and it has a system
identifier, this will be used as a file name.
Note: `sgml-system-path' is no longer used for entity lookup.
The catalog files searched is given by the variable
`sgml-local-catalogs' and `sgml-catalog-files'. The
`sgml-catalog-files' variable is initialized from the environment
variable `SGML_CATALOG_FILES' (should be a colon separated list of
files). The `sgml-local-catalogs' variable is assumed to be set in a
files local variables.
File names for external entities (e.g system identifiers) are relative
to the directory containing the file declaring the entity.
The `sgml-public-map' is initialized from the environment variable
`SGML_PATH'.
`sgml-system-path' defaults to nil.
Supports most of sgmls substitutions for sgml-public-map. Supported:
%%, %N, %P, %S, %Y, %C, %L, %O, %T, %V. Unsupported: %D, %X, %A, %E,
%I, %R, %U. Note: that %D is and alias for %C in PSGML (historical
accident).
New and changed options:
- `sgml-recompile-out-of-date-cdtd'
- New options for insert-element:
`sgml-insert-missing-element-comment' and hfil break
`sgml-insert-end-tag-on-new-line'.
- `sgml-validate-files' and slight change of `sgml-validate-command'
The variable `sgml-validate-command' can now be a list of strings. The
strings can contain %-sequences that will be expanded: %b to buffer
file name, %s to SGML Declaration file, either the value of
sgml-declaration variable or SGML Declaration file for parent document
or DOCTYPE file or SGMLDECL from catalog. %d value of `sgml-doctype'.
- `sgml-set-face'
Now automatically sets faces for all visible text, with a delay of 1s.
- `sgml-exposed-tags'
The list of tag names that remain visible, despite `M-x
sgml-hide-tags'. Each name is a lowercase string, and start-tags and
end-tags must be listed individually.
- `sgml-auto-activate-dtd'
PSGML was behaving inconsistent when a new file was loaded. If the
variable `sgml-set-face' was true the DTD would automatically be
activated (loaded or parsed), but only if psgml-parse already loaded.
Rather than let `sgml-set-face' decide if the DTD is activated, there
is now a distinct option for this. This option works even the first
time.
If non-nil, loading a sgml-file will automatically try to activate its
DTD. Activation means either to parse the document type declaration or
to load a previously saved parsed DTD. The name of the activated DTD
will be shown in the mode line.
Various:
Changes to API:
- New hooks
- `sgml-close-element-hook'
The hook run by `sgml-close-element'. These functions
are invoked with `sgml-current-tree' bound to the
element just parsed.
- `sgml-new-attribute-list-function'
This hook is run when a new element is inserted to construct the
attribute specification list. The default function prompts for the
required attributes.
- `sgml-doctype-parsed-hook'
This hook is called after the doctype has been parsed. It can be used
to load any additional information into the DTD structure.
Example: add description to element types
(defun set-help-info ()
(let ((help '(("para" "A Paragraph")
("q" "A Quotation")
("date" "A Date")))
(dtd (sgml-pstate-dtd sgml-buffer-parse-state)))
(loop for h in help do
(setf (sgml-eltype-appdata (sgml-lookup-eltype (first h) dtd)
'help-string)
(second h)))))
(add-hook 'sgml-doctype-parsed-hook 'set-help-info)
(defun sgml-help-for-element ()
(interactive)
(let* ((el (sgml-find-element-of (point)))
(help (sgml-element-appdata el 'help-string)))
(and help
(message "%s" help))))
- sgml-sysid-resolve-functions
This variable should contain a list of functions. Each function should
take one argument, the system identifier of an entity. If the function
can handle that identifier, it should insert the text of the entity
into the current buffer at point and return t. If the system identifier
is not handled the function should return nil.
Example use: Support URLs as system identifiers
(defun sgml-url-sysid (sysid)
(cond ((string-match "^\\([a-z]+\\):" sysid) ; looks like url
(require 'url)
(set-buffer (prog1 (current-buffer)
(url-retrieve sysid)))
(insert-buffer url-working-buffer)
t)))
(add-hook 'sgml-sysid-resolve-functions 'sgml-url-sysid)
- New file psgml-api.el
This file contain API-functions that are not used by other parts of
psgml. Use `(require 'psgml-api)' to use the API functions (psgml-api
includes the rest of the psgml files).
2.12.2 XML Support for PSGML
This document copied from David Megginson's README.XML.
XML modifications copyright {\copyright} David Megginson, 1997 and 1998
Distributed under the same copyright terms as PSGML.
NO WARRANTY: use at your OWN RISK!
PSGML now has a new major mode called xml-mode. To use this, you
should add the following declarations to your .emacs or site-start.el
files:
<psgml xml mode .emacs autoloads 2.46> =(autoload 'xml-mode "psgml" nil t)
(load-library "psgml")
I'm still experimenting with these declarations (v1.1.12), but these
are here to control the validation process, and make it use XML4C2
instead of nsgmls.
<psgml xml mode variables 2.47> =(make-face 'sgml-start-tag-face)
(make-face 'sgml-end-tag-face)
(cond
((equal server "bendigo")
(set-face-background 'sgml-start-tag-face "palegreen")
(set-face-background 'sgml-end-tag-face "hotpink")
)
((equal server "ararat")
(set-face-background 'sgml-start-tag-face "palegreen")
(set-face-background 'sgml-end-tag-face "pink")
)
((equal server "ballarat")
(set-face-background 'sgml-start-tag-face "palegreen")
(set-face-background 'sgml-end-tag-face "pink")
)
(t
(set-face-background 'sgml-start-tag-face "palegreen")
(set-face-background 'sgml-end-tag-face "pink")
)
)
(setq sgml-markup-faces
'(
(start-tag . sgml-start-tag-face)
(end-tag . sgml-end-tag-face)
)
)
(defun my-sgml-mode-hook ()
"SGML mode customization"
(setq sgml-set-face t)
(setq sgml-indent-data t)
(setq sgml-declaration nil)
(setq sgml-validate-command "DOMCount %s %s")
(setq sgml-auto-insert-required-elements t)
)
(add-hook 'sgml-mode-hook 'my-sgml-mode-hook)
If you want to use a newish version of nsgmls to do XML validation,
you should also include the following (for
/usr/src/jade/pubtext/xml.dcl, substitute the location on your
system of the XML-compatible SGML declaration distributed with Jade.):
<psgml xml mode variables 2.48> =;(setq sgml-xml-declaration (concat homedir "/sgml/lib/jade/xml.dcl"))
When you edit an XML file, the xml-mode will set the following PSGML
variables automatically:
------------------------------------------------------------------------
Variable Value Explanation
------------------------------------------------------------------------
sgml-omittag nil (OMITTAG forbidden by XML.)
sgml-shorttag nil (SHORTTAG forbidden by XML.)
sgml-minimize-attributes nil (Forbidden by XML.)
sgml-always-quote-attributes t (Required by XML.)
sgml-namecase-general nil (Required by XML.)
------------------------------------------------------------------------
(The last one is a new variable that is also available in
sgml-mode, corresponding to NAMECASE GENERAL NO in an SGML
declaration.)
Furthermore, the parser will add or alter some of the delimiters to
conform to XML.
2.12.3 Note on System Identifiers
XML emphasises system identifiers rather than public identifiers,
so document exchange can be tricky. This new version of
PSGML makes better use of the
`sgml-system-path' variable to allow you to make files
available from any directory on your system. For example, if you put
the file `spec.dtd' in the directory `/home/david/xml/dtds', and then
include in your .emacs file
<psgml xml mode variables 2.49> =;(setq sgml-system-path '("." "/home/ajh/sgml/lib/dtd"))
you can simply use
<!DOCTYPE spec SYSTEM "spec.dtd">
in your XML document, and PSGML will find
spec.dtd even if it is not actually in the current
directory.
Nsgmlsv already uses a similar mechanism with its
SGML_SEARCH_PATH environment variable; in fact, if you
have SGML_SEARCH_PATH set, PSGML will use it
automatically to set the initial value of
`sgml-system-path'.
subsubsubsection{XML Features Currently Supported}
- names and keywords are case sensitive
- understands /> TAGC for empty elements, and inserts it by default
- requires ?> PIC for processing instructions
- always quotes attribute value literals
- Reports the following DTD errors:
- use of AND-connector in content model in element declaration
- use of name group for element type in element declaration
- use of omitted tag minimization in element declaration
- use of CDATA or RCDATA declared content
- use of inclusion or exclusion exceptions
- declaration of external CDATA, SDATA, or
SUBDOC entities
- declaration of internal CDATA, SDATA, PI,
STARTTAG, ENDTAG, MS, or MD entities
- declaration of data attributes
- use of name group for associated element type in ATTLIST
- declaration of NAME, NAMES, NUMBER,
NUMBERS, NUTOKEN, or NUTOKENS attributes
- declaration of #CURRENT or #CONREF attributes
- a public identifier that is not accompanied by a system
identifier (except for notations)
- Reports the following general errors:
- data entity references in data
- nested comments (enforces XML-style comments)
- use of tag minimization
subsubsubsection{XML Features Not Yet Supported}
The first two need to be fixed for Emacs in general, and not just
for a single mode:
- Unicode support
- allow SYSIDs to be URLs
The remainder can be caught by using a fully conforming XML parser,
like XP, in tandem with PSGML:
- full well-formedness checking
- validate that mixed content follows XML restrictions
- validate that marked sections in DTD are either INCLUDE or IGNORE
- validate that marked sections in content are CDATA (no parameter entities)
- probably many others that I've missed
2.12.4 Ulrich Windl's Code
This bit of code was posted to the SGML Tools mailing list. I
haven't done anything with it yet, but put it here for future
reference.
<Ulrich Windl's Code 2.50> =;;; PSGML
(load "/usr/doc/packages/psgml/dot.emacs")
(defun my-sgml-mode-hook ()
"SGML mode customization"
(setq sgml-set-face t)
(setq sgml-validate-command "DOMCount %s %s")
(setq sgml-auto-insert-required-elements t)
)
; (default imported from environment)
(setq sgml-declaration nil)
(setq sgml-catalog-files (cons "/usr/lib/sgml-tools/dtd/catalog"
sgml-catalog-files))
(setq sgml-catalog-files (cons "~/SGML/catalog" sgml-catalog-files))
(setq sgml-catalog-files (cons "/usr/doc/packages/docbk30/CATALOG.example"
sgml-catalog-files))
(setq sgml-trace-entity-lookup t) ; trace lookups
(setq sgml-markup-faces '((start-tag . bold)
(end-tag . bold)
(comment . italic)
(pi . bold)
(sgml . bold)
(doctype . bold)
(entity . bold-italic)
(shortref . underline)))
(add-hook 'sgml-mode-hook 'my-sgml-mode-hook)
2.13 The Makefile
The Makefile handles the nitty-gritty of copying files to the
right places, and setting permissions, etc.
Note the nifty use of ${HOST} as parameter to
nutweb to get the right version of things for the current
platform created. This is used in all the @@<$1@@]
references in macros such as (not used).
"Makefile" 2.51 =default=emacs
GenFiles = .emacs install-emacs
include ${HOME}/etc/MakeXLP
install-emacs: emacs.tangle
cp .emacs ${HOME}
touch install-emacs
install: install-emacs
all: install emacs.dvi
clean: litclean
-rm $(GenFiles)
3. Date and Time
"date-time.el" 3.1 =(defun date ()
(interactive)
(let ((s (current-time-string)))
(let (
(d (substring s 8 10))
(m (substring s 4 7))
(y (substring s 20 24))
)
(if (string= " " (substring d 0 1))
(aset d 0 ?0))
(setq m (cdr (assoc m '(("Jan"."01")("Feb"."02")("Mar"."03")
("Apr"."04")("May"."05")("Jun"."06")
("Jul"."07")("Aug"."08")("Sep"."09")
("Oct"."10")("Nov"."11")("Dec"."12")
))))
(concat y m d)
)
)
)
(defun today ()
(interactive)
(let ((s (current-time-string)))
(let (
(d (substring s 8 10))
(m (substring s 4 7))
(y (substring s 20 24))
)
(if (string= " " (substring d 0 1))
(aset d 0 ?0))
(concat d " " m " " y)
)
)
)
(defun time ()
(interactive)
(let* ((cts (current-time-string))
(h (substring cts 11 13))
(m (substring cts 14 16))
(s (substring cts 17 19))
)
(concat h m s)
)
)
(defun date-time ()
(interactive)
(concat (date) ":" (time))
)
(defun stamp-date-time ()
"insert date and time in format yyyymmdd:hhmmss into buffer at point"
(interactive)
(insert (date-time))
)
(provide 'date-time)
This file provides dates and times in a modified ISO 8601
format (change 'T' to ':' for improved readability).
Document History
02 Oct 1998 |
ajh |
1.0 |
first version to get a version number! |
02 Oct 1998 |
ajh |
1.1 |
Add SGML and XML sections |
04 Oct 1998 |
ajh |
1.1.1 |
make clean improvements |
06 May 1999 |
ajh |
1.1.2 |
add GNU Emacs colour improvements |
08 May 1999 |
ajh |
1.1.3 |
change face and colour customization to general |
12 May 1999 |
ajh |
1.1.4 |
add multiple frames to both XEmacs and GNU Emacs |
17 May 1999 |
ajh |
1.1.5 |
change number of multiple frames |
19 May 1999 |
ajh |
1.1.6 |
birthday change to initial frame set creation |
07 Jun 1999 |
ajh |
1.1.7 |
... which now takes note of which server we are on |
16 Jun 1999 |
ajh |
1.1.8 |
add psgml load-path to emacs |
21 Jun 1999 |
ajh |
1.1.9 |
hawthorn specific stuff |
15 Jul 1999 |
ajh |
1.1.10 |
add ``load-library mh-e'', which seems to be
not required on indy03, but is on hawthorn. |
16 Nov 1999 |
ajh |
1.1.11 |
add Ulrich Windl's code for PSGML (but not yet linked
in) |
12 Dec 1999 |
ajh |
1.1.12 |
sgml changes |
07 Jan 2000 |
ajh |
1.1.13 |
remove auto xml |
06 Apr 2000 |
ajh |
1.1.14 |
add /usr/src/psgml-1.2.1/ (psgml) load path |
11 Apr 2000 |
ajh |
1.1.15 |
revise XML psgml setup |
11 Apr 2000 |
ajh |
1.2.0 |
revise to xlp2 markup |
01 Aug 2000 |
ajh |
1.2.1 |
remove host variation in frame titles |
19 Aug 2000 |
ajh |
1.2.2 |
customization for junee |
20001115:083627 |
ajh |
1.2.3 |
revised frame startup and placement
(Multiple Frames) |
20001122:075501 |
ajh |
1.2.4 |
adjustments to frame startup |
20010306:100720 |
ajh |
1.2.5 |
adjustments to frame startup: fixed positioning
problem |
20030524:123034 |
ajh |
1.3.0 |
Convert to full xml, add xlp mode |
20080705:135329 |
ajh |
1.3.1 |
add localhost to set of recognized servers |
20080717:105800 |
ajh |
1.3.2 |
Added date and time functions |
20080722:130551 |
ajh |
1.3.3 |
added .xlu as XML mode extension |
4. Indices
4.1 Files
File Name |
Defined in |
.emacs |
2.1 |
Makefile |
2.51 |
date-time.el |
3.1 |
4.2 Chunks
4.3 Identifiers
Identifier |
Defined in |
Used in |