changeset 83296:effe22690419

Merged from miles@gnu.org--gnu-2005 (patch 281-285) Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-281 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-282 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-283 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-284 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-285 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-336
author Karoly Lorentey <lorentey@elte.hu>
date Mon, 02 May 2005 14:38:00 +0000
parents 2d137ca54960 (current diff) 12df7bc9455d (diff)
children 8e357d90cc9f
files lisp/ChangeLog lisp/emacs-lisp/eldoc.el lisp/files.el lisp/font-lock.el lisp/loadup.el lisp/progmodes/gdb-ui.el lisp/simple.el lisp/subr.el lispref/ChangeLog man/ChangeLog src/emacs.c src/fileio.c src/indent.c src/sysdep.c src/window.c src/xdisp.c src/xfaces.c
diffstat 68 files changed, 2910 insertions(+), 1553 deletions(-) [+]
line wrap: on
line diff
--- a/etc/ChangeLog	Tue Apr 26 12:17:42 2005 +0000
+++ b/etc/ChangeLog	Mon May 02 14:38:00 2005 +0000
@@ -1,3 +1,7 @@
+2005-05-01  Lars Hansen  <larsh@math.ku.dk>
+
+	* NEWS: Correct key binding for dired-mark-omitted.
+
 2005-04-25  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* NEWS: Mention xterm key bindings.
--- a/etc/NEWS	Tue Apr 26 12:17:42 2005 +0000
+++ b/etc/NEWS	Mon May 02 14:38:00 2005 +0000
@@ -17,6 +17,7 @@
 
 * Installation Changes in Emacs 22.1
 
+---
 ** Emacs includes now support for loading image libraries on demand.
 (Currently this feature is only used on MS Windows.)  You can configure
 the supported image types and their associated dynamic libraries by
@@ -107,9 +108,19 @@
 
 * Changes in Emacs 22.1
 
++++
+** In graphical mode, with a C program, GUD Tooltips have been extended to
+display the #define directive associated with an identifier when program is
+not executing.
+
++++
+** `comint-use-prompt-regexp-instead-of-fields' has been renamed
+`comint-use-prompt-regexp'.  The old name has been kept as an alias,
+but declared obsolete.
+
 ** Improved key bindings support when running in an xterm.
 When emacs is running in an xterm more key bindings are available. The
-following should work: 
+following should work:
 {C,S,C-S,A}-{right,left,up,down,prior,next,delete,insert,F1-12}.
 These key bindings work on xterm from X.org 6.8, they might not work on
 some older versions of xterm, or on some proprietary versions.
@@ -125,6 +136,16 @@
     M-t     (transpose-words)
     M-q     (fill-paragraph)
 
++++
+** Auto Compression mode is now enabled by default.
+
+** C-x C-f RET, typing nothing in the minibuffer, is no longer a special case.
+
+Since the default input is the current directory, this has the effect
+of specifying the current directory.  Normally that means to visit the
+directory with Dired.
+
+---
 ** fast-lock.el and lazy-lock.el are obsolete.  Use jit-lock.el instead.
 
 ---
@@ -134,6 +155,7 @@
 0.5 instead of 0.125.  The new defaults should lower the CPU usage
 when Emacs is fontifying in the background.
 
+---
 ** iso-acc.el is now obsolete.  Use one of the latin input methods instead.
 
 ---
@@ -794,6 +816,7 @@
 dired-ignored, dired-directory, dired-symlink, dired-warning
 introduced for Dired mode instead of font-lock faces.
 
++++
 *** New Dired command `dired-compare-directories' marks files
 with different file attributes in two dired buffers.
 
@@ -818,7 +841,7 @@
 
 +++
 *** Omitting files is now a minor mode, dired-omit-mode. The mode toggling
-command is bound to M-o. A new command dired-mark-omitted, bound to M-O,
+command is bound to M-o. A new command dired-mark-omitted, bound to * O,
 marks omitted files. The variable dired-omit-files-p is obsoleted, use the
 mode toggling function instead.
 
@@ -1242,7 +1265,7 @@
 ESC, like they do for Gtk+, Mac and W32.
 
 ---
-**  Dialogs and menus pop down when pressing C-g.
+** Dialogs and menus pop down when pressing C-g.
 
 ---
 ** The menu item "Open File..." has been split into two items, "New File..."
@@ -1268,6 +1291,7 @@
 ** On X, MS Windows, and Mac OS, the blinking cursor's "off" state is
 now controlled by the variable `blink-cursor-alist'.
 
++++
 ** Filesets are collections of files.  You can define a fileset in
 various ways, such as based on a directory tree or based on
 program files that include other program files.
@@ -1311,6 +1335,7 @@
 
 ** TeX modes:
 
++++
 *** C-c C-c prompts for a command to run, and tries to offer a good default.
 
 +++
@@ -2473,6 +2498,7 @@
 ** New command `recode-region' decodes the region again by a specified
 coding system.
 
+---
 ** On Mac OS, the value of the variable `keyboard-coding-system' is
 now dynamically changed according to the current keyboard script.  The
 variable `mac-keyboard-text-encoding' and the constants
@@ -2509,6 +2535,7 @@
 ** The new package flymake.el does on-the-fly syntax checking of program
 source files.  See the Flymake's Info manual for more details.
 
+---
 ** The library tree-widget.el provides a new widget to display a set
 of hierarchical data as an outline.  For example, the tree-widget is
 well suited to display a hierarchy of directories and files.
@@ -2521,12 +2548,14 @@
 ** The thumbs.el package allows you to preview image files as thumbnails
 and can be invoked from a Dired buffer.
 
++++
 ** Image files are normally visited in Image mode, which lets you toggle
 between viewing the image and viewing the text using C-c C-c.
 
 +++
 ** The new python.el package is used to edit Python and Jython programs.
 
+---
 ** The URL package (which had been part of W3) is now part of Emacs.
 
 +++
@@ -2861,8 +2890,9 @@
 alist whose cdr is `eq' to a specified value.
 
 +++
-*** New macro define-obsolete-variable-alias to combine defvaralias and
-make-obsolete-variable.
+*** New macros define-obsolete-variable-alias to combine defvaralias and
+make-obsolete-variable and define-obsolete-function-alias to combine defalias
+and make-obsolete.
 
 +++
 ** copy-file now takes an additional option arg MUSTBENEW.
@@ -3133,6 +3163,7 @@
 position.  The cursor may now be placed on any character of such
 strings by giving that character a non-nil `cursor' text property.
 
++++
 ** The first face specification element in a defface can specify
 `default' instead of frame classification.  Then its attributes act as
 defaults that apply to all the subsequent cases (and may be overridden
@@ -3216,6 +3247,17 @@
 documentation purposes and should have no real effect on Lisp code.
 
 +++
+** A file name handler can declare which operations it handles.
+
+You do this by putting an `operation' property on the handler name
+symbol.  The property value should be a list of the operations that
+the handler really handles.  It won't be called for any other
+operations.
+
+This is useful for autoloaded handlers, to prevent them from being
+autoloaded when not really necessary.
+
++++
 ** The new hook `before-save-hook' is invoked by `basic-save-buffer'
 before saving buffers.  This allows packages to perform various final
 tasks, for example; it can be used by the copyright package to make
@@ -3347,7 +3389,8 @@
 beginning.  This change actually occurred in Emacs-21.1, but was not
 documented.
 
-** Major modes can define `eldoc-print-current-symbol-info-function'
++++
+** Major modes can define `eldoc-documentation-function'
 locally to provide Eldoc functionality by some method appropriate to
 the language.
 
--- a/lisp/ChangeLog	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/ChangeLog	Mon May 02 14:38:00 2005 +0000
@@ -1,16 +1,255 @@
+2005-05-01  Lute Kamstra  <lute@gnu.org>
+
+	* international/latexenc.el (latexenc-find-file-coding-system):
+	Fix regular expressions.  Suggested by David Kastrup <dak@gnu.org>
+	and Stefan Monnier <monnier@iro.umontreal.ca>.
+
+2005-05-01  Nick Roberts  <nickrob@snap.net.nz>
+
+	* subr.el (string-to-int): Make obsolete.
+
+2005-04-30  Richard M. Stallman  <rms@gnu.org>
+
+	* simple.el (next-error-overlay-arrow-position): Turn off, for ttys.
+
+	* loadup.el: load jka-comp-hook.
+
+	* jka-compr.el: Many functions and vars moved to jka-compr-hook.el.
+	(jka-compr-handler): Add autoload.  `put' calls moved
+	to jka-compr-hook.el.
+	(compression, jka-compr): defgroups moved to jka-compr-hook.el.
+	(jka-compr-inhibit): Autoload.
+	
+	* jka-comp-hook.el: New file.
+	Enable the mode by default.
+
+	* files.el (backup-buffer-copy): Use copy-file instead
+	of write-region, and put back the 'excl.
+
+2005-04-30  Chong Yidong  <cyd@stupidchicken.com>
+
+	* progmodes/flymake.el (flymake-split-string)
+	(flymake-split-string, flymake-log, flymake-pid-to-names)
+	(flymake-reg-names, flymake-get-source-buffer-name)
+	(flymake-unreg-names, flymake-add-line-err-info)
+	(flymake-add-err-info): Clarify docstrings.
+	(flymake-popup-menu, flymake-make-emacs-menu)
+	(flymake-make-xemacs-menu): Add docstrings.
+	(flymake-get-buffer-*, flymake-set-buffer-*): Functions deleted.
+	Set variables directly throughout.
+
+2005-04-30  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/cc-mode.el (cc-create-define-alist): Check that file
+	exists. Initialise cc-define-alist.
+	(c-mode): Add cc-create-define-alist locally to after-save-hook.
+	If there is no file (Macroexpansion) don't create an alist.
+
+2005-04-29  Sam Steingold  <sds@gnu.org>
+
+	* progmodes/cc-mode.el (cc-mode-cpp-program): New user variable.
+	(cc-create-define-alist): Use it instead of the hard-coded string.
+
+2005-04-29  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* international/mule-conf.el (file-coding-system-alist): Fix regexp
+	for latexenc.
+
+2005-04-29  Lute Kamstra  <lute@gnu.org>
+
+	* emacs-lisp/generic.el: Improve commentary section.
+	(define-generic-mode): Improve docstring.
+
+2005-04-29  Carsten Dominik  <dominik@science.uva.nl>
+
+	* textmodes/org.el (many places): Change to quiet the byte compiler.
+	(org-prefix-format-compiled): New variable.
+	(org-compile-prefix-format): New function.
+	(org-timeline, org-agenda, org-diary): Call org-compile-prefix-format.
+	(org-agenda-prefix-format,org-timeline-prefix-format): New options.
+	(org-agenda-get-scheduled): Check if file is opened in `org-mode'.
+	(org-get-entries-from-diary): Use `org-get-time-of-day' for
+	consistency with entries from `org-mode' files.
+	(org-get-time-of-day): Fix bug with partial matches early in a line.
+	(org-non-link-chars): New constant.
+	(org-link-regexp): Respect `org-non-link-chars'.
+	(org-agenda-day-view): Remove command.
+	(org-agenda-toggle-week-view): Rename from `org-agenda-week-view'.
+	(org-follow-bbdb-link, org-store-link): Search also company field.
+	(org-highlight-overlay): New variable.
+	(org-highlight, org-unhighlight): New functions.
+	(org-agenda-mode): Add pre-command-hook to remove highlight.
+	(org-evaluate-time-range): Behavior depends upon whether time stamp
+	contains a time or not.
+	(org-show-subtree, org-show-entry): New functions.
+	(org-agenda-cleanup-fancy-diary): Remove empty lines.
+
+2005-04-28  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* comint.el (comint-output-filter-functions): Add autoload cookie.
+
+2005-04-28  Kim F. Storm  <storm@cua.dk>
+
+	* ido.el (ido-everywhere): Fix last change.
+
+2005-04-28  Arne J,Ax(Brgensen  <arne@arnested.dk>
+
+	* international/latexenc.el: New file.
+	* international/mule-conf.el (file-coding-system-alist): For .tex,
+	.ltx, .dtx and .drv extensions, use `latexenc-find-file-coding-system'.
+
+2005-04-28  Lute Kamstra  <lute@gnu.org>
+
+	* font-lock.el (font-lock-add-keywords)
+	(font-lock-remove-keywords): Clarify docstring.
+	(font-lock-keywords-alist, font-lock-removed-keywords-alist):
+	Don't start docstrings with a `*'.
+	(font-lock-update-removed-keyword-alist): Give it a docstring.
+
+	* generic-x.el: Update commentary section.
+	Only require font-lock when compiling.
+	Define all modes conditionally.
+	Place all generic modes in the generic-x-modes customization group.
+	(generic-x-modes): New customization group.
+	(generic-default-modes, generic-mswindows-modes)
+	(generic-unix-modes, generic-other-modes): New constants.
+	(generic-define-mswindows-modes, generic-define-unix-modes):
+	Update docstrings.  Make them obsolete.
+	(generic-extras-enable-list): New default value.  Update docstring.
+	Improve :type.  Change :set function.
+	(bat-generic-mode-syntax-table, rul-generic-mode-syntax-table):
+	Fix docstring.
+
+	* emacs-lisp/generic.el (generic-mode-internal):
+	Simplify font-lock-defaults.
+	(define-generic-mode): Fix docstring.
+
+2005-04-28  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* progmodes/grep.el (grep-mode-font-lock-keywords): Use the
+	font-lock-face property to highlight matches.
+
+2005-04-28  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/cc-mode.el: (cc-create-define-alist): New function.
+	(cc-define-alist): New variable.
+	(c-mode): Make it local and initialise it.
+
+	* progmodes/gdb-ui.el (gdb-active-process): New variable.
+	(gdb-exited): New function.
+	(gdb-annotation-rules): Use it.
+	(gdb-starting): Set gdb-active-process to t.
+	(gdb-stopping): Amend doc string.
+	(gdb-reset): Set gdb-active-process to nil.
+
+	* tooltip.el (tooltip-gud-tips): Show the associated #define
+	directives when a C program under GDB is not executing.
+
+2005-04-27  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* progmodes/cperl-mode.el (cperl-mode): Don't precompile the
+	font-lock-fontify-syntactic-keywords.
+
+	* font-lock.el (font-lock-default-fontify-region): Don't force
+	parse-sexp-lookup-properties to nil.
+
+2005-04-27  Alexander Klimov  <alserkli@inbox.ru>  (tiny change)
+
+	* man.el (man-mode-syntax-table): Set up `:' to have
+	word-constituent syntax.
+
+2005-04-27  Lute Kamstra  <lute@gnu.org>
+
+	* novice.el (disable-command): Don't add spurious newlines to the
+	init file.  Reported by Dan Jacobson <jidanni@jidanni.org>.
+
+2005-04-26  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc-yank.el (calc-edit-finish): Make sure there is more
+	than one window before deleting window.
+
+2005-04-26  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* shell.el (shell-prompt-pattern): Doc fix.
+	(shell-mode): Set paragraph-separate buffer locally to "\\'".
+
+	* comint.el (comint-prompt-regexp, comint-get-old-input)
+	(comint-use-prompt-regexp)
+	(comint-use-prompt-regexp-instead-of-fields)
+	(comint-replace-by-expanded-history, comint-send-input)
+	(comint-output-filter, comint-get-old-input-default)
+	(comint-line-beginning-position, comint-bol, comint-show-output)
+	(comint-backward-matching-input, comint-forward-matching-input)
+	(comint-next-prompt, comint-previous-prompt):
+	Rename `comint-use-prompt-regexp-instead-of-fields' to
+	`comint-use-prompt-regexp'.  Keep old name as alias and declare
+	obsolete.
+	(comint-use-prompt-regexp): Shorten first line of doc string.
+
+	* ielm.el (inferior-emacs-lisp-mode): Adapt to above name change.
+	Set paragraph-separate buffer locally to "\\'".
+
+	* hippie-exp.el (try-expand-line, try-expand-line-all-buffers):
+	Adapt to above name change.
+
+	* net/net-utils.el (nslookup-prompt-regexp, ftp-prompt-regexp)
+	(smbclient-prompt-regexp): Ditto.
+
+	* progmodes/inf-lisp.el (inferior-lisp-prompt): Ditto.
+
+2005-04-27  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-location-alist): Rename from
+	gdb-location-list.
+	Break lines that are over 80 characters wide.
+
+2005-04-26  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* pcvs-info.el (cvs-fileinfo->full-path, cvs-display-full-path):
+	New fun and var, to preserve compatibility.
+
+	* pcvs.el, pcvs-info.el: Rename "full-path" -> "full-name".
+
+2005-04-26  Dominique de Waleffe  <ddw@missioncriticalit.com>  (tiny change)
+
+	* pcvs-info.el (cvs-fileinfo->backup-file): Don't pass the full file
+	name to file-newer-than-file-p.
+
+2005-04-26  Richard M. Stallman  <rms@gnu.org>
+
+	* simple.el (line-move-1): Avoid using vertical-motion in easy cases.
+
+	* progmodes/python.el (python-mode):
+	Use new name eldoc-documentation-function.
+
+	* hexl.el (hexl-mode): Use new name eldoc-documentation-function.
+
+	* emacs-lisp/eldoc.el (eldoc-mode): Doc fix.
+	(eldoc-documentation-function):
+	Rename from eldoc-print-current-symbol-info-function.  Calls changed.
+
+2005-04-26  Nick Roberts  <nickrob@snap.net.nz>
+
+	* emacs-lisp/byte-run.el (define-obsolete-function-alias): New macro.
+
 2005-04-25  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* term/xterm.el (function-key-map): Fix strings for
-	{C,S,A,C-S}-f[1-4]. Use substitute-key-definition to bind 
+	{C,S,A,C-S}-f[1-4].  Use substitute-key-definition to bind
 	{C,S,A,C-S}-{f1-f12}.
 
 2005-04-26  Kenichi Handa  <handa@m17n.org>
 
-	* international/mule-cmds.el (select-safe-coding-system): Fix
-	previous change.
+	* international/mule-cmds.el (select-safe-coding-system):
+	Fix previous change.
 
 2005-04-26  Lute Kamstra  <lute@gnu.org>
 
+	* emacs-lisp/easy-mmode.el (define-minor-mode): Fix docstring.
+
+	* font-lock.el (font-lock-fontify-region-function): Fix docstring.
+	(font-lock-comment-delimiter-face): Ditto.
+
 	* calc/calc.el (calc-trail-mode): Don't set font-lock-defaults.
 
 2005-04-25  Jay Belanger  <belanger@truman.edu>
@@ -21,8 +260,7 @@
 2005-04-25  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* term.el (ansi-term-color-vector): Use the xterm colors.
-	(term-raw-map): Don't add mappings for \eO and \e[. Map
-	deletechar.
+	(term-raw-map): Don't add mappings for \eO and \e[. Map deletechar.
 
 2005-04-25  Lute Kamstra  <lute@gnu.org>
 
@@ -32,8 +270,8 @@
 
 2005-04-25  Kenichi Handa  <handa@m17n.org>
 
-	* international/mule-cmds.el (select-safe-coding-system): Don't
-	check consistency with coding: spec, etc if raw-text or
+	* international/mule-cmds.el (select-safe-coding-system):
+	Don't check consistency with coding: spec, etc if raw-text or
 	no-conversion was found to be safe.
 
 2005-04-24  Richard M. Stallman  <rms@gnu.org>
@@ -182,13 +420,13 @@
 	not quadratic.  Suggested by David Kastrup <dak@gnu.org>.
 	(rassq-delete-all): New function.
 
-	* menu-bar.el (menu-bar-options-save, menu-bar-showhide-menu): Add
-	size-indication-mode.
+	* menu-bar.el (menu-bar-options-save, menu-bar-showhide-menu):
+	Add size-indication-mode.
 
 2005-04-21  Kenichi Handa  <handa@m17n.org>
 
 	* international/mule-cmds.el: Add autoload for widget-value in
-	eval-when-compile
+	eval-when-compile.
 
 2005-04-21  Nick Roberts  <nickrob@snap.net.nz>
 
@@ -559,8 +797,8 @@
 2005-04-11  Rajesh Vaidheeswarran  <rv@gnu.org>
 
 	* whitespace.el (whitespace-buffer-leading)
-	(whitespace-buffer-trailing): Revert the incorrect test
-	inversion. However, fix the highlight area for the leading and
+	(whitespace-buffer-trailing): Revert the incorrect test inversion.
+	However, fix the highlight area for the leading and
 	trailing whitespaces to show space.
 
 2005-04-11  Rajesh Vaidheeswarran  <rv@gnu.org>
--- a/lisp/calc/calc-yank.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/calc/calc-yank.el	Mon May 02 14:38:00 2005 +0000
@@ -528,7 +528,7 @@
     (goto-char calc-edit-top)
     (if (buffer-modified-p)
 	(eval calc-edit-handler))
-    (if one-window
+    (if (and one-window (not (one-window-p t)))
 	(delete-window))
     (if (get-buffer-window return)
 	(select-window (get-buffer-window return))
--- a/lisp/comint.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/comint.el	Mon May 02 14:38:00 2005 +0000
@@ -159,7 +159,7 @@
 Defaults to \"^\", the null string at BOL.
 
 This variable is only used if the variable
-`comint-use-prompt-regexp-instead-of-fields' is non-nil.
+`comint-use-prompt-regexp' is non-nil.
 
 Good choices:
   Canonical Lisp: \"^[^> \\n]*>+:? *\" (Lucid, franz, kcl, T, cscheme, oaklisp)
@@ -353,7 +353,7 @@
 default is `comint-get-old-input-default', which either grabs the
 current input field or grabs the current line and strips off leading
 text matching `comint-prompt-regexp', depending on the value of
-`comint-use-prompt-regexp-instead-of-fields'.")
+`comint-use-prompt-regexp'.")
 
 (defvar comint-dynamic-complete-functions
   '(comint-replace-by-expanded-history comint-dynamic-complete-filename)
@@ -373,6 +373,7 @@
   "Abnormal hook run before input is sent to the process.
 These functions get one argument, a string containing the text to send.")
 
+;;;###autoload
 (defvar comint-output-filter-functions '(comint-postoutput-scroll-to-bottom comint-watch-for-password-prompt)
   "Functions to call after output is inserted into the buffer.
 One possible function is `comint-postoutput-scroll-to-bottom'.
@@ -406,8 +407,8 @@
 ;; Note: If it is decided to purge comint-prompt-regexp from the source
 ;; entirely, searching for uses of this variable will help to identify
 ;; places that need attention.
-(defcustom comint-use-prompt-regexp-instead-of-fields nil
-  "*If non-nil, use `comint-prompt-regexp' to distinguish prompts from user-input.
+(defcustom comint-use-prompt-regexp nil
+  "*If non-nil, use `comint-prompt-regexp' to recognize prompts.
 If nil, then program output and user-input are given different `field'
 properties, which Emacs commands can use to distinguish them (in
 particular, common movement commands such as begining-of-line respect
@@ -415,6 +416,13 @@
   :type 'boolean
   :group 'comint)
 
+;; Autoload is necessary for Custom to recognize old alias.
+;;;###autoload
+(defvaralias 'comint-use-prompt-regexp-instead-of-fields
+  'comint-use-prompt-regexp)
+(make-obsolete-variable 'comint-use-prompt-regexp-instead-of-fields
+			'comint-use-prompt-regexp "22.1")
+
 (defcustom comint-mode-hook '(turn-on-font-lock)
   "Hook run upon entry to `comint-mode'.
 This is run before the process is cranked up."
@@ -1150,7 +1158,7 @@
 Returns t if successful."
   (interactive)
   (if (and comint-input-autoexpand
-	   (if comint-use-prompt-regexp-instead-of-fields
+	   (if comint-use-prompt-regexp
 	       ;; Use comint-prompt-regexp
 	       (save-excursion
 		 (beginning-of-line)
@@ -1419,10 +1427,10 @@
 
 If the interpreter is the csh,
     `comint-get-old-input' is the default:
-	If `comint-use-prompt-regexp-instead-of-fields' is nil, then
+	If `comint-use-prompt-regexp' is nil, then
 	either return the current input field, if point is on an input
 	field, or the current line, if point is on an output field.
-	If `comint-use-prompt-regexp-instead-of-fields' is non-nil, then
+	If `comint-use-prompt-regexp' is non-nil, then
 	return the current line with any initial string matching the
 	regexp `comint-prompt-regexp' removed.
     `comint-input-filter-functions' monitors input for \"cd\", \"pushd\", and
@@ -1487,14 +1495,14 @@
 		 font-lock-face comint-highlight-input
 		 mouse-face highlight
 		 help-echo "mouse-2: insert after prompt as new input"))
-	      (unless comint-use-prompt-regexp-instead-of-fields
+	      (unless comint-use-prompt-regexp
 		;; Give old user input a field property of `input', to
 		;; distinguish it from both process output and unsent
 		;; input.  The terminating newline is put into a special
 		;; `boundary' field to make cursor movement between input
 		;; and output fields smoother.
 		(put-text-property beg end 'field 'input)))
-	    (unless (or no-newline comint-use-prompt-regexp-instead-of-fields)
+	    (unless (or no-newline comint-use-prompt-regexp)
 	      ;; Cover the terminating newline
 	      (add-text-properties end (1+ end)
 				   '(rear-nonsticky t
@@ -1708,7 +1716,7 @@
 
 	    (goto-char (process-mark process)) ; in case a filter moved it
 
-	    (unless comint-use-prompt-regexp-instead-of-fields
+	    (unless comint-use-prompt-regexp
               (let ((inhibit-read-only t)
 		    (inhibit-modification-hooks t))
                 (add-text-properties comint-last-output-start (point)
@@ -1844,10 +1852,10 @@
 
 (defun comint-get-old-input-default ()
   "Default for `comint-get-old-input'.
-If `comint-use-prompt-regexp-instead-of-fields' is nil, then either
+If `comint-use-prompt-regexp' is nil, then either
 return the current input field, if point is on an input field, or the
 current line, if point is on an output field.
-If `comint-use-prompt-regexp-instead-of-fields' is non-nil, then return
+If `comint-use-prompt-regexp' is non-nil, then return
 the current line with any initial string matching the regexp
 `comint-prompt-regexp' removed."
   (let ((bof (field-beginning)))
@@ -1880,10 +1888,10 @@
 
 (defun comint-line-beginning-position ()
   "Return the buffer position of the beginning of the line, after any prompt.
-If `comint-use-prompt-regexp-instead-of-fields' is non-nil, then the
-prompt skip is done by skipping text matching the regular expression
-`comint-prompt-regexp', a buffer local variable."
-  (if comint-use-prompt-regexp-instead-of-fields
+If `comint-use-prompt-regexp' is non-nil, then the prompt skip is done by
+skipping text matching the regular expression `comint-prompt-regexp',
+a buffer local variable."
+  (if comint-use-prompt-regexp
       ;; Use comint-prompt-regexp
       (save-excursion
 	(beginning-of-line)
@@ -1901,9 +1909,9 @@
 (defun comint-bol (&optional arg)
   "Go to the beginning of line, then skip past the prompt, if any.
 If prefix argument is given (\\[universal-argument]) the prompt is not skipped.
-If `comint-use-prompt-regexp-instead-of-fields' is non-nil, then the
-prompt skip is done by skipping text matching the regular expression
-`comint-prompt-regexp', a buffer local variable."
+If `comint-use-prompt-regexp' is non-nil, then the prompt skip is done
+by skipping text matching the regular expression `comint-prompt-regexp',
+a buffer local variable."
   (interactive "P")
   (if arg
       ;; Unlike `beginning-of-line', forward-line ignores field boundaries
@@ -2034,7 +2042,7 @@
   (interactive)
   (push-mark)
   (let ((pos (or (marker-position comint-last-input-end) (point-max))))
-    (cond (comint-use-prompt-regexp-instead-of-fields
+    (cond (comint-use-prompt-regexp
 	   (goto-char pos)
 	   (beginning-of-line 0)
 	   (set-window-start (selected-window) (point))
@@ -2127,13 +2135,13 @@
 
 (defun comint-backward-matching-input (regexp n)
   "Search backward through buffer for input fields that match REGEXP.
-If `comint-use-prompt-regexp-instead-of-fields' is non-nil, then input
-fields are identified by lines that match `comint-prompt-regexp'.
+If `comint-use-prompt-regexp' is non-nil, then input fields are identified
+by lines that match `comint-prompt-regexp'.
 
 With prefix argument N, search for Nth previous match.
 If N is negative, find the next or Nth next match."
   (interactive (comint-regexp-arg "Backward input matching (regexp): "))
-  (if comint-use-prompt-regexp-instead-of-fields
+  (if comint-use-prompt-regexp
       ;; Use comint-prompt-regexp
       (let* ((re (concat comint-prompt-regexp ".*" regexp))
 	     (pos (save-excursion (end-of-line (if (> n 0) 0 1))
@@ -2159,8 +2167,8 @@
 
 (defun comint-forward-matching-input (regexp arg)
   "Search forward through buffer for input fields that match REGEXP.
-If `comint-use-prompt-regexp-instead-of-fields' is non-nil, then input
-fields are identified by lines that match `comint-prompt-regexp'.
+If `comint-use-prompt-regexp' is non-nil, then input fields are identified
+by lines that match `comint-prompt-regexp'.
 
 With prefix argument N, search for Nth following match.
 If N is negative, find the previous or Nth previous match."
@@ -2170,11 +2178,11 @@
 
 (defun comint-next-prompt (n)
   "Move to end of Nth next prompt in the buffer.
-If `comint-use-prompt-regexp-instead-of-fields' is nil, then this means
-the beginning of the Nth next `input' field, otherwise, it means the Nth
-occurrence of text matching `comint-prompt-regexp'."
+If `comint-use-prompt-regexp' is nil, then this means the beginning of
+the Nth next `input' field, otherwise, it means the Nth occurrence of
+text matching `comint-prompt-regexp'."
   (interactive "p")
-  (if comint-use-prompt-regexp-instead-of-fields
+  (if comint-use-prompt-regexp
       ;; Use comint-prompt-regexp
       (let ((paragraph-start comint-prompt-regexp))
 	(end-of-line (if (> n 0) 1 0))
@@ -2207,9 +2215,9 @@
 
 (defun comint-previous-prompt (n)
   "Move to end of Nth previous prompt in the buffer.
-If `comint-use-prompt-regexp-instead-of-fields' is nil, then this means
-the beginning of the Nth previous `input' field, otherwise, it means the Nth
-occurrence of text matching `comint-prompt-regexp'."
+If `comint-use-prompt-regexp' is nil, then this means the beginning of
+the Nth previous `input' field, otherwise, it means the Nth occurrence of
+text matching `comint-prompt-regexp'."
   (interactive "p")
   (comint-next-prompt (- n)))
 
@@ -3022,7 +3030,7 @@
 ;; appropriate magic default by examining what we think is the prompt)?
 ;;
 ;; Fixme: look for appropriate fields, rather than regexp, if
-;; `comint-use-prompt-regexp-instead-of-fields' is true.
+;; `comint-use-prompt-regexp' is true.
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Variables
--- a/lisp/emacs-lisp/byte-run.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/emacs-lisp/byte-run.el	Mon May 02 14:38:00 2005 +0000
@@ -114,6 +114,18 @@
     (put function 'byte-obsolete-info (list new handler when)))
   function)
 
+(defmacro define-obsolete-function-alias (function new
+						   &optional when docstring)
+  "Set FUNCTION's function definition to NEW and warn that FUNCTION is obsolete.
+If provided, WHEN should be a string indicating when FUNCTION was
+first made obsolete, for example a date or a release number.  The
+optional argument DOCSTRING specifies the documentation string
+for FUNCTION; if DOCSTRING is omitted or nil, FUNCTION uses the
+documentation string of NEW unluess it already has one."
+  `(progn
+     (defalias ,function ,new ,docstring)
+     (make-obsolete ,function ,new ,when)))
+
 (defun make-obsolete-variable (variable new &optional when)
   "Make the byte-compiler warn that VARIABLE is obsolete.
 The warning will say that NEW should be used instead.
--- a/lisp/emacs-lisp/easy-mmode.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/emacs-lisp/easy-mmode.el	Mon May 02 14:38:00 2005 +0000
@@ -95,8 +95,8 @@
   will be passed to `defcustom' if the minor mode is global):
 :group GROUP	Custom group name to use in all generated `defcustom' forms.
 		Defaults to MODE without the possible trailing \"-mode\".
-		(This default may not be a valid customization group defined
-		with `defgroup'.  Make sure it is.)
+		Don't use this default group name unless you have written a
+		`defgroup' to define that group properly.
 :global GLOBAL	If non-nil specifies that the minor mode is not meant to be
 		buffer-local, so don't make the variable MODE buffer-local.
 		By default, the mode is buffer-local.
--- a/lisp/emacs-lisp/eldoc.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/emacs-lisp/eldoc.el	Mon May 02 14:38:00 2005 +0000
@@ -45,7 +45,7 @@
 
 ;; Major modes for other languages may use Eldoc by defining an
 ;; appropriate function as the buffer-local value of
-;; `eldoc-print-current-symbol-info-function'.
+;; `eldoc-documentation-function'.
 
 ;;; Code:
 
@@ -139,16 +139,11 @@
 ;;;###autoload
 (define-minor-mode eldoc-mode
   "Toggle ElDoc mode on or off.
-Show the defined parameters for the elisp function near point.
-
-For the emacs lisp function at the beginning of the sexp which point is
-within, show the defined parameters for the function in the echo area.
-This information is extracted directly from the function or macro if it is
-in pure lisp.  If the emacs function is a subr, the parameters are obtained
-from the documentation string if possible.
-
-If point is over a documented variable, print that variable's docstring
-instead.
+In ElDoc mode, the echo area displays information about a
+function or variable in the text where point is.  If point is
+on a documented variable, it displays that variable's doc string.
+Otherwise it displays the argument list of the function called
+in the expression point is on.
 
 With prefix ARG, turn ElDoc mode on if and only if ARG is positive."
   :group 'eldoc :lighter eldoc-minor-mode-string
@@ -167,7 +162,6 @@
   (eldoc-mode 1))
 
 
-;; Idle timers are part of Emacs 19.31 and later.
 (defun eldoc-schedule-timer ()
   (or (and eldoc-timer
            (memq eldoc-timer timer-idle-list))
@@ -235,7 +229,7 @@
        (not (eq (selected-window) (minibuffer-window)))))
 
 
-(defvar eldoc-print-current-symbol-info-function nil
+(defvar eldoc-documentation-function nil
   "If non-nil, function to call to return doc string.
 The function of no args should return a one-line string for displaying
 doc about a function etc. appropriate to the context around point.
@@ -249,8 +243,8 @@
 (defun eldoc-print-current-symbol-info ()
   (condition-case err
       (and (eldoc-display-message-p)
-	   (if eldoc-print-current-symbol-info-function
-	       (eldoc-message (funcall eldoc-print-current-symbol-info-function))
+	   (if eldoc-documentation-function
+	       (eldoc-message (funcall eldoc-documentation-function))
 	     (let* ((current-symbol (eldoc-current-symbol))
 		    (current-fnsym  (eldoc-fnsym-in-current-sexp))
 		    (doc (cond
--- a/lisp/emacs-lisp/generic.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/emacs-lisp/generic.el	Mon May 02 14:38:00 2005 +0000
@@ -35,15 +35,15 @@
 ;;
 ;; Each generic mode can define the following:
 ;;
-;; * List of comment-characters.  The entries in this list should be
-;;   either a character, a one or two character string or a cons pair.
-;;   If the entry is a character or a string, it is added to the
-;;   mode's syntax table with `comment-start' syntax.  If the entry is
-;;   a cons pair, the elements of the pair are considered to be
-;;   `comment-start' and `comment-end' respectively.  (The latter
-;;   should be nil if you want comments to end at end of line.)
-;;   LIMITATIONS: Emacs does not support comment strings of more than
-;;   two characters in length.
+;; * List of comment-characters.  The elements of this list should be
+;;   either a character, a one or two character string, or a cons
+;;   cell.  If the entry is a character or a string, it is added to
+;;   the mode's syntax table with "comment starter" syntax.  If the
+;;   entry is a cons cell, the `car' and `cdr' of the pair are
+;;   considered the "comment starter" and "comment ender"
+;;   respectively.  (The latter should be nil if you want comments to
+;;   end at the end of the line.)  Emacs does not support comment
+;;   strings of more than two characters in length.
 ;;
 ;; * List of keywords to font-lock.  Each keyword should be a string.
 ;;   If you have additional keywords which should be highlighted in a
@@ -121,40 +121,42 @@
 				    &rest custom-keyword-args)
   "Create a new generic mode MODE.
 
-MODE is the name of the command for the generic mode; it need not
-be quoted.  The optional DOCSTRING is the documentation for the
-mode command.  If you do not supply it, a default documentation
-string will be used instead.
+MODE is the name of the command for the generic mode; don't quote
+it.  The optional DOCSTRING is the documentation for the mode
+command.  If you do not supply it, `define-generic-mode' uses a
+default documentation string instead.
 
-COMMENT-LIST is a list, whose entries are either a single
-character, a one or two character string or a cons pair.  If the
-entry is a character or a string, it is added to the mode's
-syntax table with `comment-start' syntax.  If the entry is a cons
-pair, the elements of the pair are considered to be
-`comment-start' and `comment-end' respectively.  (The latter
-should be nil if you want comments to end at end of line.)  Note
-that Emacs has limitations regarding comment characters.
+COMMENT-LIST is a list in which each element is either a
+character, a string of one or two characters, or a cons cell.  A
+character or a string is set up in the mode's syntax table as a
+\"comment starter\".  If the entry is a cons cell, the `car' is
+set up as a \"comment starter\" and the `cdr' as a \"comment
+ender\".  (Use nil for the latter if you want comments to end at
+the end of the line.)  Note that the syntax table has limitations
+about what comment starters and enders are actually possible.
 
 KEYWORD-LIST is a list of keywords to highlight with
 `font-lock-keyword-face'.  Each keyword should be a string.
 
 FONT-LOCK-LIST is a list of additional expressions to highlight.
-Each entry in the list should have the same form as an entry in
-`font-lock-keywords'.
+Each element of this list should have the same form as an element
+of `font-lock-keywords'.
 
 AUTO-MODE-LIST is a list of regular expressions to add to
-`auto-mode-alist'.  These regexps are added to `auto-mode-alist'
-as soon as `define-generic-mode' is called.
+`auto-mode-alist'.  These regular expressions are added when
+Emacs runs the macro expansion.
 
 FUNCTION-LIST is a list of functions to call to do some
-additional setup.
+additional setup.  The mode command calls these functions just
+before it runs the mode hook.
 
-The optional CUSTOM-KEYWORD-ARGS are pairs of keywords and
-values.  They will be passed to the generated `defcustom' form of
-the mode hook variable MODE-hook.  Defaults to MODE without the
-possible trailing \"-mode\".  (This default may not be a valid
-customization group defined with `defgroup'.  Make sure it is.)
-You can specify keyword arguments without specifying a docstring.
+The optional CUSTOM-KEYWORD-ARGS are pairs of keywords and values
+to include in the generated `defcustom' form for the mode hook
+variable `MODE-hook'.  The default value for the `:group' keyword
+is MODE with the final \"-mode\" (if any) removed.  (Don't use
+this default group name unless you have written a `defgroup' to
+define that group properly.)  You can specify keyword arguments
+without specifying a docstring.
 
 See the file generic-x.el for some examples of `define-generic-mode'."
   (declare (debug (sexp def-form def-form def-form form def-form
@@ -178,7 +180,7 @@
 
     (unless (plist-get custom-keyword-args :group)
       (setq custom-keyword-args
-	    (plist-put custom-keyword-args 
+	    (plist-put custom-keyword-args
 		       :group `',(intern (replace-regexp-in-string
 					  "-mode\\'" "" name)))))
 
@@ -226,7 +228,7 @@
     (when keyword-list
       (push (concat "\\_<" (regexp-opt keyword-list t) "\\_>")
 	    generic-font-lock-keywords))
-    (setq font-lock-defaults '(generic-font-lock-keywords nil))
+    (setq font-lock-defaults '(generic-font-lock-keywords))
 
     ;; Call a list of functions
     (mapcar 'funcall function-list)
--- a/lisp/files.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/files.el	Mon May 02 14:38:00 2005 +0000
@@ -2761,14 +2761,12 @@
 		       (condition-case nil
 			   (delete-file to-name)
 			 (file-error nil))
-		       (write-region "" nil to-name nil 'silent nil 'excl)
+		       (copy-file from-name to-name t t 'excl)
 		       nil)
 		   (file-already-exists t))
-	    ;; the file was somehow created by someone else between
-	    ;; `make-temp-name' and `write-region', let's try again.
-	    nil)
-;	  (copy-file from-name to-name t t 'excl))
-	  (copy-file from-name to-name t t))
+	    ;; The file was somehow created by someone else between
+	    ;; `delete-file' and `copy-file', so let's try again.
+	    nil))
       ;; Reset the umask.
       (set-default-file-modes umask)))
   (and modes
--- a/lisp/font-lock.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/font-lock.el	Mon May 02 14:38:00 2005 +0000
@@ -466,12 +466,12 @@
 optimized.")
 
 (defvar font-lock-keywords-alist nil
-  "*Alist of `font-lock-keywords' local to a `major-mode'.
+  "Alist of `font-lock-keywords' local to a `major-mode'.
 This is normally set via `font-lock-add-keywords' and
 `font-lock-remove-keywords'.")
 
 (defvar font-lock-removed-keywords-alist nil
-  "*Alist of `font-lock-keywords' removed from `major-mode'.
+  "Alist of `font-lock-keywords' removed from `major-mode'.
 This is normally set via `font-lock-add-keywords' and
 `font-lock-remove-keywords'.")
 
@@ -568,8 +568,8 @@
 (defvar font-lock-fontify-region-function 'font-lock-default-fontify-region
   "Function to use for fontifying a region.
 It should take two args, the beginning and end of the region, and an optional
-third arg VERBOSE.  If non-nil, the function should print status messages.
-This is normally set via `font-lock-defaults'.")
+third arg VERBOSE.  If VERBOSE is non-nil, the function should print status
+messages.  This is normally set via `font-lock-defaults'.")
 
 (defvar font-lock-unfontify-region-function 'font-lock-default-unfontify-region
   "Function to use for unfontifying a region.
@@ -664,9 +664,9 @@
 adds two fontification patterns for C mode, to fontify `FIXME:' words, even in
 comments, and to fontify `and', `or' and `not' words as keywords.
 
-When used from an elisp package (such as a minor mode), it is recommended
-to use nil for MODE (and place the call in a loop or on a hook) to avoid
-subtle problems due to details of the implementation.
+When used from a Lisp program (such as a minor mode), it is recommended to
+use nil for MODE (and place the call on a hook) to avoid subtle problems
+due to details of the implementation.
 
 Note that some modes have specialized support for additional patterns, e.g.,
 see the variables `c-font-lock-extra-types', `c++-font-lock-extra-types',
@@ -707,9 +707,7 @@
 		    (font-lock-compile-keywords font-lock-keywords t)))))))
 
 (defun font-lock-update-removed-keyword-alist (mode keywords append)
-  ;; Update `font-lock-removed-keywords-alist' when adding new
-  ;; KEYWORDS to MODE.
-  ;;
+  "Update `font-lock-removed-keywords-alist' when adding new KEYWORDS to MODE."
   ;; When font-lock is enabled first all keywords in the list
   ;; `font-lock-keywords-alist' are added, then all keywords in the
   ;; list `font-lock-removed-keywords-alist' are removed.  If a
@@ -757,9 +755,9 @@
 MODE should be a symbol, the major mode command name, such as `c-mode'
 or nil.  If nil, highlighting keywords are removed for the current buffer.
 
-When used from an elisp package (such as a minor mode), it is recommended
-to use nil for MODE (and place the call in a loop or on a hook) to avoid
-subtle problems due to details of the implementation."
+When used from a Lisp program (such as a minor mode), it is recommended to
+use nil for MODE (and place the call on a hook) to avoid subtle problems
+due to details of the implementation."
   (cond (mode
 	 ;; Remove one keyword at the time.
 	 (dolist (keyword keywords)
@@ -1008,7 +1006,8 @@
 
 (defun font-lock-default-fontify-region (beg end loudly)
   (save-buffer-state
-      ((parse-sexp-lookup-properties font-lock-syntactic-keywords)
+      ((parse-sexp-lookup-properties
+        (or parse-sexp-lookup-properties font-lock-syntactic-keywords))
        (old-syntax-table (syntax-table)))
     (unwind-protect
 	(save-restriction
@@ -1637,7 +1636,7 @@
     (((class color) (min-colors 8) (background dark))
      (:foreground "red1"))
     (t (:weight bold :slant italic)))
-  "Font Lock mode face used to highlight comments."
+  "Font Lock mode face used to highlight comment delimiters."
   :group 'font-lock-highlighting-faces)
 
 (defface font-lock-comment-face
--- a/lisp/generic-x.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/generic-x.el	Mon May 02 14:38:00 2005 +0000
@@ -1,4 +1,4 @@
-;;; generic-x.el --- Extra Modes for generic-mode
+;;; generic-x.el --- A collection of generic modes
 
 ;; Copyright (C) 1997, 1998, 2003, 2005 Free Software Foundation, Inc.
 
@@ -25,7 +25,7 @@
 
 ;;; Commentary:
 ;;
-;; This file contains some pre-defined generic-modes.
+;; This file contains a collection generic modes.
 ;;
 ;; INSTALLATION:
 ;;
@@ -34,12 +34,18 @@
 ;;   (require 'generic-x)
 ;;
 ;; You can decide which modes to load by setting the variable
-;; `generic-extras-enable-list'.  Some platform-specific modes are
-;; affected by the variables `generic-define-mswindows-modes' and
-;; `generic-define-unix-modes' (which see).
+;; `generic-extras-enable-list'.  Its default value is platform-
+;; specific.  The recommended way to set this variable is through
+;; customize:
+;;
+;;   M-x customize-option RET generic-extras-enable-list RET
 ;;
-;; You can also send in new modes; if the file types a reasonably common,
-;; we would like to install them.
+;; This lets you select generic modes from the list of available
+;; modes.  If you manually set `generic-extras-enable-list' in your
+;; .emacs, do it BEFORE loading generic-x with (require 'generic-x).
+;;
+;; You can also send in new modes; if the file types are reasonably
+;; common, we would like to install them.
 ;;
 ;; DEFAULT GENERIC MODE:
 ;;
@@ -54,13 +60,13 @@
 ;; PROBLEMS WHEN USED WITH FOLDING MODE:
 ;;
 ;; [The following relates to the obsolete selective-display technique.
-;; Folding mode should use invisible text properties instead. -- Dave
+;; Folding mode should use invisible text properties instead.  -- Dave
 ;; Love]
 ;;
 ;; From Anders Lindgren <andersl@csd.uu.se>
 ;;
 ;; Problem summary: Wayne Adams has found a problem when using folding
-;; mode in conjuction with font-lock for a mode defined in
+;; mode in conjunction with font-lock for a mode defined in
 ;; `generic-x.el'.
 ;;
 ;; The problem, as Wayne described it, was that error messages of the
@@ -69,18 +75,18 @@
 ;; >      - various msgs including "Fontifying region...(error Stack
 ;; > overflow in regexp matcher)" appear
 ;;
-;; I have just tracked down the cause of the problem.  The regexp:s in
-;; `generic-x.el' does not take into account the way that folding
-;; hides sections of the buffer.  The technique is known as
+;; I have just tracked down the cause of the problem.  The regexp's in
+;; `generic-x.el' do not take into account the way that folding hides
+;; sections of the buffer.  The technique is known as
 ;; `selective-display' and has been available for a very long time (I
-;; started using it back in the good old' Emacs 18 days).  Basically, a
+;; started using it back in the good old Emacs 18 days).  Basically, a
 ;; section is hidden by creating one very long line were the newline
 ;; character (C-j) is replaced by a linefeed (C-m) character.
 ;;
 ;; Many other hiding packages, besides folding, use the same technique,
 ;; the problem should occur when using them as well.
 ;;
-;; The erroronous lines in `generic-extras' look like the following (this
+;; The erroneous lines in `generic-x.el' look like the following (this
 ;; example is from the `ini' section):
 ;;
 ;;     '(("^\\(\\[.*\\]\\)"   1 'font-lock-constant-face)
@@ -92,17 +98,17 @@
 ;; [foo]
 ;; bar = xxx
 ;;
-;; However, since the `.' regexp symbol match the linefeed character the
-;; entire folded section is searched, resulting in a regexp stack
+;; However, since the `.' regexp symbol matches the linefeed character
+;; the entire folded section is searched, resulting in a regexp stack
 ;; overflow.
 ;;
-;; Solution suggestion 2: Instead of using ".", use the sequence
-;; "[^\n\r]".  This will make the rules behave just as before, but they
-;; will work together with selective-display.
+;; Solution suggestion: Instead of using ".", use the sequence
+;; "[^\n\r]".  This will make the rules behave just as before, but
+;; they will work together with selective-display.
 
 ;;; Code:
 
-(require 'font-lock)
+(eval-when-compile (require 'font-lock))
 
 (defgroup generic-x nil
   "A collection of generic modes."
@@ -110,6 +116,11 @@
   :group 'data
   :version "20.3")
 
+(defgroup generic-x-modes nil
+  "Individual modes in the collection of generic modes."
+  :group 'generic-x
+  :version "22.1")
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Default-Generic mode
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -147,7 +158,7 @@
   :type  '(choice (const :tag "Don't check file names" nil) regexp))
 
 ;; This generic mode is always defined
-(define-generic-mode default-generic-mode (list ?#) nil nil nil nil :group 'generic)
+(define-generic-mode default-generic-mode (list ?#) nil nil nil nil :group 'generic-x-modes)
 
 ;; A more general solution would allow us to enter generic-mode for
 ;; *any* comment character, but would require us to synthesize a new
@@ -185,55 +196,101 @@
 ;; Other Generic modes
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(defcustom generic-extras-enable-list nil
-  "*List of generic modes to enable by default.
-Each entry in the list should be a symbol.  The variables
-`generic-define-mswindows-modes' and `generic-define-unix-modes'
-also affect which generic modes are defined.  Please note that if
-you set this variable after generic-x is loaded, you must reload
-generic-x to enable the specified modes."
-  :group 'generic-x
-  :type  '(repeat sexp))
+;; If you add a generic mode to this file, put it in one of these four
+;; lists as well.
+
+(defconst generic-default-modes
+  '(apache-conf-generic-mode
+    apache-log-generic-mode
+    hosts-generic-mode
+    java-manifest-generic-mode
+    java-properties-generic-mode
+    javascript-generic-mode
+    show-tabs-generic-mode
+    vrml-generic-mode)
+  "List of generic modes that are defined by default.")
+
+(defconst generic-mswindows-modes
+  '(bat-generic-mode
+    inf-generic-mode
+    ini-generic-mode
+    rc-generic-mode
+    reg-generic-mode
+    rul-generic-mode)
+  "List of generic modes that are defined by default on MS-Windows.")
+
+(defconst generic-unix-modes
+  '(alias-generic-mode
+    etc-fstab-generic-mode
+    etc-modules-conf-generic-mode
+    etc-passwd-generic-mode
+    etc-services-generic-mode
+    fvwm-generic-mode
+    inetd-conf-generic-mode
+    mailagent-rules-generic-mode
+    mailrc-generic-mode
+    named-boot-generic-mode
+    named-database-generic-mode
+    prototype-generic-mode
+    resolve-conf-generic-mode
+    samba-generic-mode
+    x-resource-generic-mode)
+  "List of generic modes that are defined by default on Unix.")
+
+(defconst generic-other-modes
+  '(astap-generic-mode
+    ibis-generic-mode
+    pkginfo-generic-mode
+    spice-generic-mode)
+  "List of generic mode that are not defined by default.")
 
 (defcustom generic-define-mswindows-modes
   (memq system-type '(windows-nt ms-dos))
-  "*If non-nil, some MS-Windows specific generic modes will be defined."
+  "*Non-nil means the modes in `generic-mswindows-modes' will be defined.
+This is a list of MS-Windows specific generic modes.  This variable
+only effects the default value of `generic-extras-enable-list'."
   :group 'generic-x
-  :type  'boolean)
+  :type 'boolean
+  :version "22.1")
+(make-obsolete-variable 'generic-define-mswindows-modes 'generic-extras-enable-list "22.1")
 
 (defcustom generic-define-unix-modes
   (not (memq system-type '(windows-nt ms-dos)))
-  "*If non-nil, some Unix specific generic modes will be defined."
+  "*Non-nil means the modes in `generic-unix-modes' will be defined.
+This is a list of Unix specific generic modes.  This variable only
+effects the default value of `generic-extras-enable-list'."
   :group 'generic-x
-  :type  'boolean)
+  :type 'boolean
+  :version "22.1")
+(make-obsolete-variable 'generic-define-unix-modes 'generic-extras-enable-list "22.1")
 
-(and generic-define-mswindows-modes
-     (setq generic-extras-enable-list
-	   (append '(bat-generic-mode
-		     ini-generic-mode
-		     inf-generic-mode
-		     rc-generic-mode
-		     reg-generic-mode
-		     rul-generic-mode
-		     hosts-generic-mode
-		     apache-conf-generic-mode
-		     apache-log-generic-mode)
-		   generic-extras-enable-list)))
-
-(and generic-define-unix-modes
-     (setq generic-extras-enable-list
-	   (append '(apache-conf-generic-mode
-		     apache-log-generic-mode
-		     samba-generic-mode
-		     hosts-generic-mode
-		     fvwm-generic-mode
-		     x-resource-generic-mode
-		     alias-generic-mode
-		     inetd-conf-generic-mode
-		     etc-services-generic-mode
-		     etc-passwd-generic-mode
-		     etc-fstab-generic-mode)
-		   generic-extras-enable-list)))
+(defcustom generic-extras-enable-list
+  (append generic-default-modes
+	  (if generic-define-mswindows-modes generic-mswindows-modes)
+	  (if generic-define-unix-modes generic-unix-modes)
+	  nil)
+  "List of generic modes to define.
+Each entry in the list should be a symbol.  If you set this variable
+directly, without using customize, you must reload generic-x to put
+your changes into effect."
+  :group 'generic-x
+  :type (let (list)
+	  (dolist (mode
+		   (sort (append generic-default-modes
+				 generic-mswindows-modes
+				 generic-unix-modes
+				 generic-other-modes
+				 nil)
+			 (lambda (a b)
+			   (string< (symbol-name b)
+				    (symbol-name a))))
+		   (cons 'set list))
+	    (push `(const ,mode) list)))
+  :set (lambda (s v)
+	 (set-default s v)
+	 (unless load-in-progress
+	   (load "generic-x")))
+  :version "22.1")
 
 ;;; Apache
 (when (memq 'apache-conf-generic-mode generic-extras-enable-list)
@@ -252,7 +309,7 @@
 	      ("*Directories*" "^\\s-*<Directory\\s-*\\([^>]+\\)>" 1)
 	      ("*Locations*"   "^\\s-*<Location\\s-*\\([^>]+\\)>" 1))))))
   "Generic mode for Apache or HTTPD configuration files."
-  :group 'generic-x))
+  :group 'generic-x-modes))
 
 (when (memq 'apache-log-generic-mode generic-extras-enable-list)
 
@@ -266,7 +323,7 @@
   '("access_log\\'")
   nil
   "Mode for Apache log files"
-  :group 'generic-x))
+  :group 'generic-x-modes))
 
 ;;; Samba
 (when (memq 'samba-generic-mode generic-extras-enable-list)
@@ -281,7 +338,7 @@
   '("smb\\.conf\\'")
   '(generic-bracket-support)
   "Generic mode for Samba configuration files."
-  :group 'generic-x))
+  :group 'generic-x-modes))
 
 ;;; Fvwm
 ;; This is pretty basic. Also, modes for other window managers could
@@ -307,7 +364,7 @@
   '("\\.fvwmrc\\'" "\\.fvwm2rc\\'")
   nil
   "Generic mode for FVWM configuration files."
-  :group 'generic-x))
+  :group 'generic-x-modes))
 
 ;;; X Resource
 ;; I'm pretty sure I've seen an actual mode to do this, but I don't
@@ -321,7 +378,7 @@
   '("\\.Xdefaults\\'" "\\.Xresources\\'" "\\.Xenvironment\\'" "\\.ad\\'")
   nil
   "Generic mode for X Resource configuration files."
-  :group 'generic-x))
+  :group 'generic-x-modes))
 
 ;;; Hosts
 (when (memq 'hosts-generic-mode generic-extras-enable-list)
@@ -333,7 +390,7 @@
   '("[hH][oO][sS][tT][sS]\\'")
   nil
   "Generic mode for HOSTS files."
-  :group 'generic-x))
+  :group 'generic-x-modes))
 
 ;;; Windows INF files
 (when (memq 'inf-generic-mode generic-extras-enable-list)
@@ -345,7 +402,7 @@
   '("\\.[iI][nN][fF]\\'")
   '(generic-bracket-support)
   "Generic mode for MS-Windows INF files."
-  :group 'generic-x))
+  :group 'generic-x-modes))
 
 ;;; Windows INI files
 ;; Should define escape character as well!
@@ -368,7 +425,7 @@
   "Generic mode for MS-Windows INI files.
 You can use `ini-generic-mode-find-file-hook' to enter this mode
 automatically for INI files whose names do not end in \".ini\"."
-  :group 'generic-x)
+  :group 'generic-x-modes)
 
 (defun ini-generic-mode-find-file-hook ()
   "Hook function to enter Ini-Generic mode automatically for INI files.
@@ -397,7 +454,7 @@
       (setq imenu-generic-expression
 	    '((nil "^\\s-*\\(.*\\)\\s-*=" 1))))))
   "Generic mode for MS-Windows Registry files."
-  :group 'generic-x))
+  :group 'generic-x-modes))
 
 ;;; DOS/Windows BAT files
 (when (memq 'bat-generic-mode generic-extras-enable-list)
@@ -472,10 +529,10 @@
     "\\`[aA][uU][tT][oO][eE][xX][eE][cC]\\.")
   '(generic-bat-mode-setup-function)
   "Generic mode for MS-Windows BAT files."
-  :group 'generic-x)
+  :group 'generic-x-modes)
 
 (defvar bat-generic-mode-syntax-table nil
-  "Syntax table in use in bat-generic-mode buffers.")
+  "Syntax table in use in `bat-generic-mode' buffers.")
 
 (defvar bat-generic-mode-keymap (make-sparse-keymap)
   "Keymap for bet-generic-mode.")
@@ -552,7 +609,7 @@
       (setq imenu-generic-expression
 	    '((nil "\\s-/\\([^/]+\\)/[i, \t\n]" 1))))))
   "Mode for Mailagent rules files."
-  :group 'generic-x))
+  :group 'generic-x-modes))
 
 ;; Solaris/Sys V prototype files
 (when (memq 'prototype-generic-mode generic-extras-enable-list)
@@ -576,7 +633,7 @@
   '("prototype\\'")
   nil
   "Mode for Sys V prototype files."
-  :group 'generic-x))
+  :group 'generic-x-modes))
 
 ;; Solaris/Sys V pkginfo files
 (when (memq 'pkginfo-generic-mode generic-extras-enable-list)
@@ -590,10 +647,12 @@
   '("pkginfo\\'")
   nil
   "Mode for Sys V pkginfo files."
-  :group 'generic-x))
+  :group 'generic-x-modes))
 
 ;; Javascript mode
 ;; Includes extra keywords from Armando Singer [asinger@MAIL.COLGATE.EDU]
+(when (memq 'javascript-generic-mode generic-extras-enable-list)
+
 (define-generic-mode javascript-generic-mode
   '("//" ("/*" . "*/"))
   '("break"
@@ -668,9 +727,11 @@
 	    '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1)
 	      ("*Variables*" "^var\\s-+\\([A-Za-z0-9_]+\\)" 1))))))
   "Mode for JavaScript files."
-  :group 'generic-x)
+  :group 'generic-x-modes))
 
 ;; VRML files
+(when (memq 'vrml-generic-mode generic-extras-enable-list)
+
 (define-generic-mode vrml-generic-mode
   '(?#)
   '("DEF"
@@ -720,9 +781,11 @@
 	       "DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{"
 	       1))))))
   "Generic Mode for VRML files."
-  :group 'generic-x)
+  :group 'generic-x-modes))
 
 ;; Java Manifests
+(when (memq 'java-manifest-generic-mode generic-extras-enable-list)
+
 (define-generic-mode java-manifest-generic-mode
   '(?#)
   '("Name"
@@ -740,9 +803,11 @@
   '("[mM][aA][nN][iI][fF][eE][sS][tT]\\.[mM][fF]\\'")
   nil
   "Mode for Java Manifest files"
-  :group 'generic-x)
+  :group 'generic-x-modes))
 
 ;; Java properties files
+(when (memq 'java-properties-generic-mode generic-extras-enable-list)
+
 (define-generic-mode java-properties-generic-mode
   '(?! ?#)
   nil
@@ -771,7 +836,7 @@
       (setq imenu-generic-expression
 	    '((nil "^\\([^#! \t\n\r=:]+\\)" 1))))))
   "Mode for Java properties files."
-  :group 'generic-x)
+  :group 'generic-x-modes))
 
 ;; C shell alias definitions
 (when (memq 'alias-generic-mode generic-extras-enable-list)
@@ -790,7 +855,7 @@
       (setq imenu-generic-expression
 	    '((nil "^\\(alias\\|unalias\\)\\s-+\\([-a-zA-Z0-9_]+\\)" 2))))))
   "Mode for C Shell alias files."
-  :group 'generic-x))
+  :group 'generic-x-modes))
 
 ;;; Windows RC files
 ;; Contributed by ACorreir@pervasive-sw.com (Alfred Correira)
@@ -883,7 +948,7 @@
     '("\\.[rR][cC]\\'")
     nil
     "Generic mode for MS-Windows Resource files."
-    :group 'generic-x))
+    :group 'generic-x-modes))
 
 ;; InstallShield RUL files
 ;; Contributed by  Alfred.Correira@Pervasive.Com
@@ -1436,7 +1501,7 @@
   "Function argument constants used in InstallShield 3 and 5."))
 
 (defvar rul-generic-mode-syntax-table nil
-  "Syntax table to use in rul-generic-mode buffers.")
+  "Syntax table to use in `rul-generic-mode' buffers.")
 
 (setq rul-generic-mode-syntax-table
       (make-syntax-table c++-mode-syntax-table))
@@ -1504,7 +1569,7 @@
   '("\\.[rR][uU][lL]\\'")
   '(generic-rul-mode-setup-function)
   "Generic mode for InstallShield RUL files."
-  :group 'generic-x)
+  :group 'generic-x-modes)
 
 (define-skeleton rul-if
   "Insert an if statement."
@@ -1531,6 +1596,8 @@
   > "end;"))
 
 ;; Additions by ACorreir@pervasive-sw.com (Alfred Correira)
+(when (memq 'mailrc-generic-mode generic-extras-enable-list)
+
 (define-generic-mode mailrc-generic-mode
   '(?#)
   '("alias"
@@ -1553,7 +1620,7 @@
   '("\\.mailrc\\'")
   nil
   "Mode for mailrc files."
-  :group 'generic-x)
+  :group 'generic-x-modes))
 
 ;; Inetd.conf
 (when (memq 'inetd-conf-generic-mode generic-extras-enable-list)
@@ -1574,7 +1641,7 @@
     (lambda ()
       (setq imenu-generic-expression
 	    '((nil "^\\([-A-Za-z0-9_]+\\)" 1))))))
-  :group 'generic-x))
+  :group 'generic-x-modes))
 
 ;; Services
 (when (memq 'etc-services-generic-mode generic-extras-enable-list)
@@ -1593,7 +1660,7 @@
     (lambda ()
       (setq imenu-generic-expression
 	    '((nil "^\\([-A-Za-z0-9_]+\\)" 1))))))
-  :group 'generic-x))
+  :group 'generic-x-modes))
 
 ;; Password and Group files
 (when (memq 'etc-passwd-generic-mode generic-extras-enable-list)
@@ -1636,7 +1703,7 @@
     (lambda ()
       (setq imenu-generic-expression
 	    '((nil "^\\([-A-Za-z0-9_]+\\):" 1))))))
-  :group 'generic-x))
+  :group 'generic-x-modes))
 
 ;; Fstab
 (when (memq 'etc-fstab-generic-mode generic-extras-enable-list)
@@ -1687,9 +1754,11 @@
     (lambda ()
       (setq imenu-generic-expression
 	    '((nil "^\\([/-A-Za-z0-9_]+\\)\\s-+" 1))))))
-  :group 'generic-x))
+  :group 'generic-x-modes))
 
 ;; From Jacques Duthen <jacques.duthen@sncf.fr>
+(when (memq 'show-tabs-generic-mode generic-extras-enable-list)
+
 (eval-when-compile
 
 (defconst show-tabs-generic-mode-font-lock-defaults-1
@@ -1711,7 +1780,7 @@
     (((class color))                        (:background "red"))
     (t (:weight bold)))
   "Font Lock mode face used to highlight TABs."
-  :group 'generic-x)
+  :group 'generic-x-modes)
 
 (defface show-tabs-space-face
   '((((class grayscale) (background light)) (:background "DimGray"   :weight bold))
@@ -1720,7 +1789,7 @@
     (((class color))                        (:background "yellow"))
     (t (:weight bold)))
   "Font Lock mode face used to highlight spaces."
-  :group 'generic-x)
+  :group 'generic-x-modes)
 
 (define-generic-mode show-tabs-generic-mode
   nil ;; no comment char
@@ -1730,12 +1799,14 @@
   ;; '(show-tabs-generic-mode-hook-fun)
   nil
   "Generic mode to show tabs and trailing spaces"
-  :group 'generic-x)
+  :group 'generic-x-modes))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; DNS modes
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
+(when (memq 'named-boot-generic-mode generic-extras-enable-list)
+
 (define-generic-mode named-boot-generic-mode
   ;; List of comment characters
   '(?\;)
@@ -1752,7 +1823,9 @@
   '("/etc/named.boot\\'")
   ;; List of set up functions to call
   nil
-  :group 'generic-x)
+  :group 'generic-x-modes))
+
+(when (memq 'named-database-generic-mode generic-extras-enable-list)
 
 (define-generic-mode named-database-generic-mode
   ;; List of comment characters
@@ -1766,7 +1839,7 @@
   nil
   ;; List of set up functions to call
   nil
-  :group 'generic-x)
+  :group 'generic-x-modes)
 
 (defvar named-database-time-string "%Y%m%d%H"
   "Timestring for named serial numbers.")
@@ -1774,7 +1847,9 @@
 (defun named-database-print-serial ()
   "Print a serial number based on the current date."
   (interactive)
-  (insert (format-time-string named-database-time-string (current-time))))
+  (insert (format-time-string named-database-time-string (current-time)))))
+
+(when (memq 'resolve-conf-generic-mode generic-extras-enable-list)
 
 (define-generic-mode resolve-conf-generic-mode
   ;; List of comment characters
@@ -1787,12 +1862,14 @@
   '("/etc/resolv[e]?.conf\\'")
   ;; List of set up functions to call
   nil
-  :group 'generic-x)
+  :group 'generic-x-modes))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Modes for spice and common electrical engineering circuit netlist formats
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
+(when (memq 'spice-generic-mode generic-extras-enable-list)
+
 (define-generic-mode spice-generic-mode
   nil
   '("and"
@@ -1830,7 +1907,9 @@
     (lambda()
       (setq font-lock-defaults '(generic-font-lock-keywords nil t)))))
   "Generic mode for SPICE circuit netlist files."
-  :group 'generic-x)
+  :group 'generic-x-modes))
+
+(when (memq 'ibis-generic-mode generic-extras-enable-list)
 
 (define-generic-mode ibis-generic-mode
   '(?|)
@@ -1840,7 +1919,9 @@
   '("\\.[iI][bB][sS]\\'")
   '(generic-bracket-support)
   "Generic mode for IBIS circuit netlist files."
-  :group 'generic-x)
+  :group 'generic-x-modes))
+
+(when (memq 'astap-generic-mode generic-extras-enable-list)
 
 (define-generic-mode astap-generic-mode
   nil
@@ -1876,7 +1957,9 @@
     (lambda()
       (setq font-lock-defaults '(generic-font-lock-keywords nil t)))))
   "Generic mode for ASTAP circuit netlist files."
-  :group 'generic-x)
+  :group 'generic-x-modes))
+
+(when (memq 'etc-modules-conf-generic-mode generic-extras-enable-list)
 
 (define-generic-mode etc-modules-conf-generic-mode
   ;; List of comment characters
@@ -1919,7 +2002,7 @@
   '("/etc/modules.conf" "/etc/conf.modules")
   ;; List of set up functions to call
   nil
-  :group 'generic-x)
+  :group 'generic-x-modes))
 
 (provide 'generic-x)
 
--- a/lisp/hexl.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/hexl.el	Mon May 02 14:38:00 2005 +0000
@@ -284,7 +284,7 @@
     (add-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer nil t)
 
     ;; Set a callback function for eldoc.
-    (set (make-local-variable 'eldoc-print-current-symbol-info-function)
+    (set (make-local-variable 'eldoc-documentation-function)
 	 'hexl-print-current-point-info)
     (eldoc-add-command-completions "hexl-")
     (eldoc-remove-command "hexl-save-buffer" 
--- a/lisp/hippie-exp.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/hippie-exp.el	Mon May 02 14:38:00 2005 +0000
@@ -634,7 +634,7 @@
 string).  It returns t if a new completion is found, nil otherwise."
   (let ((expansion ())
 	(strip-prompt (and (get-buffer-process (current-buffer))
-			   comint-use-prompt-regexp-instead-of-fields
+			   comint-use-prompt-regexp
 			   comint-prompt-regexp)))
     (if (not old)
 	(progn
@@ -681,7 +681,7 @@
 string).  It returns t if a new completion is found, nil otherwise."
   (let ((expansion ())
 	(strip-prompt (and (get-buffer-process (current-buffer))
-			   comint-use-prompt-regexp-instead-of-fields
+			   comint-use-prompt-regexp
 			   comint-prompt-regexp))
 	(buf (current-buffer))
 	(orig-case-fold-search case-fold-search))
@@ -708,7 +708,7 @@
 		      (widen))
 		  (goto-char he-search-loc)
 		  (setq strip-prompt (and (get-buffer-process (current-buffer))
-					  comint-use-prompt-regexp-instead-of-fields
+					  comint-use-prompt-regexp
 					  comint-prompt-regexp))
 		  (setq expansion
 			(let ((case-fold-search orig-case-fold-search))
--- a/lisp/ido.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/ido.el	Mon May 02 14:38:00 2005 +0000
@@ -1347,19 +1347,17 @@
 			   (> (prefix-numeric-value arg) 0)
 			 (not ido-everywhere)))
   (when (get 'ido-everywhere 'file)
-    (setq read-file-name-function (get 'ido-everywhere 'file))
+    (setq read-file-name-function (car (get 'ido-everywhere 'file)))
     (put 'ido-everywhere 'file nil))
   (when (get 'ido-everywhere 'buffer)
-    (setq read-buffer-function (get 'ido-everywhere 'buffer))
+    (setq read-buffer-function (car (get 'ido-everywhere 'buffer)))
     (put 'ido-everywhere 'buffer nil))
   (when ido-everywhere
     (when (memq ido-mode '(both file))
-      (unless (get 'ido-everywhere 'file)
-	(put 'ido-everywhere 'file read-file-name-function))
+      (put 'ido-everywhere 'file (cons read-file-name-function nil))
       (setq read-file-name-function 'ido-read-file-name))
     (when (memq ido-mode '(both buffer))
-      (unless (get 'ido-everywhere 'buffer)
-	(put 'ido-everywhere 'buffer read-buffer-function))
+      (put 'ido-everywhere 'buffer (cons read-buffer-function nil))
       (setq read-buffer-function 'ido-read-buffer))))
 
 
--- a/lisp/ielm.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/ielm.el	Mon May 02 14:38:00 2005 +0000
@@ -482,6 +482,7 @@
   (interactive)
   (comint-mode)
   (setq comint-prompt-regexp (concat "^" (regexp-quote ielm-prompt)))
+  (set (make-local-variable 'paragraph-separate) "\\'")
   (make-local-variable 'paragraph-start)
   (setq paragraph-start comint-prompt-regexp)
   (setq comint-input-sender 'ielm-input-sender)
@@ -538,7 +539,7 @@
     ;; Add a silly header
     (insert ielm-header)
     (ielm-set-pm (point-max))
-    (unless comint-use-prompt-regexp-instead-of-fields
+    (unless comint-use-prompt-regexp
       (let ((inhibit-read-only t))
         (add-text-properties
          (point-min) (point-max)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/international/latexenc.el	Mon May 02 14:38:00 2005 +0000
@@ -0,0 +1,171 @@
+;;; latexenc.el --- guess correct coding system in LaTeX files
+
+;; Copyright (C) 2005 Free Software Foundation, Inc.
+
+;; Author: Arne J,Ax(Brgensen <arne@arnested.dk>
+;; Keywords: mule, coding system, latex
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;; This code tries to guess the correct coding system of a LaTeX file.
+
+;; First it searches for a \inputencoding{...} or
+;; \usepackage[...]{inputenc} line in the file and looks up the ... in
+;; `latex-inputenc-coding-alist' to find the corresponding coding
+;; system.
+
+;; If this fails it will search for AUCTeX's TeX-master or tex-mode's
+;; tex-main-file variable in the local variables section and visit
+;; that file to get the coding system from the master file. This check
+;; can be disabled by setting `latexenc-dont-use-TeX-master-flag' to
+;; t.
+
+;; If we have still not found a coding system we will try to use the
+;; standard tex-mode's `tex-guess-main-file' and get the coding system
+;; from the main file. This check can be disabled by setting
+;; `latexenc-dont-use-tex-guess-main-file-flag' to t.
+
+;; The functionality is enabled by adding the function
+;; `latexenc-find-file-coding-system' to `file-coding-system-alist'
+;; like this
+
+;; (add-to-list 'file-coding-system-alist
+;; 	     '("\\.tex\\|\\.ltx\\|\\.dtx\\|\\.drv\\'" . latexenc-find-file-coding-system))
+
+;;; Code:
+
+;;;###autoload
+(defcustom latex-inputenc-coding-alist
+  '(("ansinew" . windows-1252) ; MS Windows ANSI encoding, extension of Latin-1
+    ("applemac" . mac-roman)
+    ("ascii" . us-ascii)
+    ("cp1250" . windows-1250) ; MS Windows encoding, codepage 1250
+    ("cp1252" . windows-1252) ; synonym of ansinew
+    ("cp1257" . cp1257)
+    ("cp437de" . cp437) ; IBM code page 437 (German version): 225 is \ss
+    ("cp437" . cp437) ; IBM code page 437: 225 is \beta
+    ("cp850" . cp850) ; IBM code page 850
+    ("cp852" . cp852) ; IBM code page 852
+    ;; ("cp858" . undecided) ; IBM code page 850 but with a euro symbol
+    ("cp865" . cp865) ; IBM code page 865
+    ;; The DECMultinational charaterset used by the OpenVMS system
+    ;; ("decmulti" . undecided)
+    ("latin1" . iso-8859-1)
+    ("latin2" . iso-8859-2)
+    ("latin3" . iso-8859-3)
+    ("latin4" . iso-8859-4)
+    ("latin5" . iso-8859-5)
+    ("latin9" . iso-8859-15)
+    ;; ("latin10" . undecided)
+    ;; ("macce" . undecided) ; Apple Central European
+    ("next" . next) ; The Next encoding
+    ("utf8" . utf-8)
+    ("utf8x" . utf-8)) ; used by the Unicode LaTeX package
+  "Mapping from encoding names used by LaTeX's \"inputenc.sty\" to Emacs coding systems.
+Used by the function `latexenc-find-file-coding-system'."
+  :group 'files
+  :group 'mule
+  :type '(alist :key-type (string :tag "LaTeX input encoding")
+		:value-type (coding-system :tag "Coding system")))
+
+;;;###autoload
+(defun latexenc-inputenc-to-coding-system (inputenc)
+  "Return the corresponding coding-system for the specified input encoding.
+Return nil if no matching coding system can be found."
+  (cdr (assoc inputenc latex-inputenc-coding-alist)))
+
+;;;###autoload
+(defun latexenc-coding-system-to-inputenc (cs)
+  "Return the corresponding input encoding for the specified coding system.
+Return nil if no matching input encoding can be found."
+  (let (result)
+    (catch 'result
+      (dolist (elem latex-inputenc-coding-alist result)
+	(let ((elem-cs (cdr elem)))
+	  (when (and (coding-system-p elem-cs)
+		     (coding-system-p cs)
+		     (eq (coding-system-base cs) (coding-system-base elem-cs)))
+	    (setq result (car elem))
+	    (throw 'result result)))))))
+
+(defvar latexenc-dont-use-TeX-master-flag nil
+  "Non-nil means don't follow TeX-master to find the coding system.")
+
+(defvar latexenc-dont-use-tex-guess-main-file-flag nil
+  "Non-nil means don't use tex-guessmain-file to find the coding system.")
+
+;;;###autoload
+(defun latexenc-find-file-coding-system (arg-list)
+  "Determine the coding system of a LaTeX file if it uses \"inputenc.sty\".
+The mapping from LaTeX's \"inputenc.sty\" encoding names to Emacs
+coding system names is determined from `latex-inputenc-coding-alist'."
+  (if (eq (car arg-list) 'insert-file-contents)
+      (save-excursion
+        ;; try to find the coding system in this file
+        (goto-char (point-min))
+        (if (or
+             (re-search-forward "^[^%\n]*\\\\inputencoding{\\(.*\\)}" nil t)
+             (re-search-forward "^[^%\n]*\\\\usepackage\\[\\(.*\\)\\]{inputenc}" nil t))
+            (let* ((match (match-string 1))
+                   (sym (intern match)))
+              (when (latexenc-inputenc-to-coding-system match)
+                (setq sym (latexenc-inputenc-to-coding-system match))
+                (when (coding-system-p sym)
+		  sym
+                  (if (and (require 'code-pages nil t) (coding-system-p sym))
+                      sym
+                    'undecided))))
+          ;; else try to find it in the master/main file
+          (let (latexenc-main-file)
+            ;; is there a TeX-master or tex-main-file in the local variable section
+            (unless latexenc-dont-use-TeX-master-flag
+              (goto-char (point-max))
+              (when (re-search-backward "^%+ *\\(TeX-master\\|tex-main-file\\): *\"\\(.+\\)\"" nil t)
+                (let ((file (concat (file-name-directory (nth 1 arg-list)) (match-string 2))))
+                  (if (file-exists-p file)
+                      (setq latexenc-main-file file)
+                    (if (boundp 'TeX-default-extension)
+                        (when (file-exists-p (concat file "." TeX-default-extension))
+                          (setq latexenc-main-file (concat file "." TeX-default-extension)))
+                      (dolist (ext '("drv" "dtx" "ltx" "tex"))
+                        (if (file-exists-p (concat file "." ext))
+                            (setq latexenc-main-file (concat file "." ext)))))))))
+            ;; try tex-modes tex-guess-main-file
+            (when (and (not latexenc-dont-use-tex-guess-main-file-flag)
+                       (not latexenc-main-file))
+              (when (fboundp 'tex-guess-main-file)
+                (let ((tex-start-of-header "\\\\document\\(style\\|class\\)")
+                      (default-directory (file-name-directory (nth 1 arg-list))))
+                  (setq latexenc-main-file (tex-guess-main-file)))))
+            ;; if we found a master/main file get the coding system from it
+            (if (and latexenc-main-file
+                     (file-readable-p latexenc-main-file))
+                (let* ((latexenc-dont-use-tex-guess-main-file-flag t)
+                       (latexenc-dont-use-TeX-master-flag t)
+                       (latexenc-main-buffer (find-file-noselect latexenc-main-file t)))
+                  (or (buffer-local-value 'coding-system-for-write latexenc-main-buffer)
+                      (buffer-local-value 'buffer-file-coding-system latexenc-main-buffer)))
+              'undecided))))
+    'undecided))
+
+(provide 'latexenc)
+
+;; arch-tag: f971bc3e-1fec-4609-8f2f-73dd41ab22e1
+;;; latexenc.el ends here
--- a/lisp/international/mule-conf.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/international/mule-conf.el	Mon May 02 14:38:00 2005 +0000
@@ -501,6 +501,7 @@
 	("\\(\\`\\|/\\)loaddefs.el\\'" . (raw-text . raw-text-unix))
 	("\\.tar\\'" . (no-conversion . no-conversion))
 	( "\\.po[tx]?\\'\\|\\.po\\." . po-find-file-coding-system)
+	("\\.\\(tex\\|ltx\\|dtx\\|drv\\)\\'" . latexenc-find-file-coding-system)
 	("" . (undecided . nil))))
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/jka-comp-hook.el	Mon May 02 14:38:00 2005 +0000
@@ -0,0 +1,293 @@
+;;; jka-comp-hook.el --- preloaded code to enable jka-compr.el
+
+;; Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2003, 2004, 2005  Free Software Foundation, Inc.
+
+;; Author: jka@ece.cmu.edu (Jay K. Adams)
+;; Maintainer: FSF
+;; Keywords: data
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;; This file contains the  code to enable and disable Auto-Compression mode.
+;; It is preloaded.  The guts of this mode are in jka-compr.el, which
+;; is loaded only when you really try to uncompress something.
+
+;;; Code:
+
+(defgroup compression nil
+  "Data compression utilities"
+  :group 'data)
+
+(defgroup jka-compr nil
+  "jka-compr customization"
+  :group 'compression)
+
+;;; I have this defined so that .Z files are assumed to be in unix
+;;; compress format; and .gz files, in gzip format, and .bz2 files in bzip fmt.
+(defcustom jka-compr-compression-info-list
+  ;;[regexp
+  ;; compr-message  compr-prog  compr-args
+  ;; uncomp-message uncomp-prog uncomp-args
+  ;; can-append auto-mode-flag strip-extension-flag file-magic-bytes]
+  '(["\\.Z\\(~\\|\\.~[0-9]+~\\)?\\'"
+     "compressing"    "compress"     ("-c")
+     "uncompressing"  "uncompress"   ("-c")
+     nil t "\037\235"]
+     ;; Formerly, these had an additional arg "-c", but that fails with
+     ;; "Version 0.1pl2, 29-Aug-97." (RedHat 5.1 GNU/Linux) and
+     ;; "Version 0.9.0b, 9-Sept-98".
+    ["\\.bz2\\'"
+     "bzip2ing"        "bzip2"         nil
+     "bunzip2ing"      "bzip2"         ("-d")
+     nil t "BZh"]
+    ["\\.tbz\\'"
+     "bzip2ing"        "bzip2"         nil
+     "bunzip2ing"      "bzip2"         ("-d")
+     nil nil "BZh"]
+    ["\\.tgz\\'"
+     "compressing"        "gzip"         ("-c" "-q")
+     "uncompressing"      "gzip"         ("-c" "-q" "-d")
+     t nil "\037\213"]
+    ["\\.g?z\\(~\\|\\.~[0-9]+~\\)?\\'"
+     "compressing"        "gzip"         ("-c" "-q")
+     "uncompressing"      "gzip"         ("-c" "-q" "-d")
+     t t "\037\213"]
+    ;; dzip is gzip with random access.  Its compression program can't
+    ;; read/write stdin/out, so .dz files can only be viewed without
+    ;; saving, having their contents decompressed with gzip.
+    ["\\.dz\\'"
+     nil              nil            nil
+     "uncompressing"      "gzip"         ("-c" "-q" "-d")
+     nil t "\037\213"])
+
+  "List of vectors that describe available compression techniques.
+Each element, which describes a compression technique, is a vector of
+the form [REGEXP COMPRESS-MSG COMPRESS-PROGRAM COMPRESS-ARGS
+UNCOMPRESS-MSG UNCOMPRESS-PROGRAM UNCOMPRESS-ARGS
+APPEND-FLAG STRIP-EXTENSION-FLAG FILE-MAGIC-CHARS], where:
+
+   regexp                is a regexp that matches filenames that are
+                         compressed with this format
+
+   compress-msg          is the message to issue to the user when doing this
+                         type of compression (nil means no message)
+
+   compress-program      is a program that performs this compression
+                         (nil means visit file in read-only mode)
+
+   compress-args         is a list of args to pass to the compress program
+
+   uncompress-msg        is the message to issue to the user when doing this
+                         type of uncompression (nil means no message)
+
+   uncompress-program    is a program that performs this compression
+
+   uncompress-args       is a list of args to pass to the uncompress program
+
+   append-flag           is non-nil if this compression technique can be
+                         appended
+
+   strip-extension-flag  non-nil means strip the regexp from file names
+                         before attempting to set the mode.
+
+   file-magic-chars      is a string of characters that you would find
+			 at the beginning of a file compressed in this way.
+
+Because of the way `call-process' is defined, discarding the stderr output of
+a program adds the overhead of starting a shell each time the program is
+invoked."
+  :type '(repeat (vector regexp
+			 (choice :tag "Compress Message"
+				 (string :format "%v")
+				 (const :tag "No Message" nil))
+			 (choice :tag "Compress Program"
+				 (string)
+				 (const :tag "None" nil))
+			 (repeat :tag "Compress Arguments" string)
+			 (choice :tag "Uncompress Message"
+				 (string :format "%v")
+				 (const :tag "No Message" nil))
+			 (choice :tag "Uncompress Program"
+				 (string)
+				 (const :tag "None" nil))
+			 (repeat :tag "Uncompress Arguments" string)
+			 (boolean :tag "Append")
+			 (boolean :tag "Strip Extension")
+			 (string :tag "Magic Bytes")))
+  :group 'jka-compr)
+
+(defcustom jka-compr-mode-alist-additions
+  (list (cons "\\.tgz\\'" 'tar-mode) (cons "\\.tbz\\'" 'tar-mode))
+  "A list of pairs to add to `auto-mode-alist' when jka-compr is installed."
+  :type '(repeat (cons string symbol))
+  :group 'jka-compr)
+
+(defcustom jka-compr-load-suffixes '(".gz")
+  "List of suffixes to try when loading files."
+  :type '(repeat string)
+  :group 'jka-compr)
+
+;; List of all the elements we actually added to file-coding-system-alist.
+(defvar jka-compr-added-to-file-coding-system-alist nil)
+
+(defvar jka-compr-file-name-handler-entry
+  nil
+  "The entry in `file-name-handler-alist' used by the jka-compr I/O functions.")
+
+(defun jka-compr-build-file-regexp ()
+  (mapconcat
+   'jka-compr-info-regexp
+   jka-compr-compression-info-list
+   "\\|"))
+
+;;; Functions for accessing the return value of jka-compr-get-compression-info
+(defun jka-compr-info-regexp               (info)  (aref info 0))
+(defun jka-compr-info-compress-message     (info)  (aref info 1))
+(defun jka-compr-info-compress-program     (info)  (aref info 2))
+(defun jka-compr-info-compress-args        (info)  (aref info 3))
+(defun jka-compr-info-uncompress-message   (info)  (aref info 4))
+(defun jka-compr-info-uncompress-program   (info)  (aref info 5))
+(defun jka-compr-info-uncompress-args      (info)  (aref info 6))
+(defun jka-compr-info-can-append           (info)  (aref info 7))
+(defun jka-compr-info-strip-extension      (info)  (aref info 8))
+(defun jka-compr-info-file-magic-bytes     (info)  (aref info 9))
+
+
+(defun jka-compr-get-compression-info (filename)
+  "Return information about the compression scheme of FILENAME.
+The determination as to which compression scheme, if any, to use is
+based on the filename itself and `jka-compr-compression-info-list'."
+  (catch 'compression-info
+    (let ((case-fold-search nil))
+      (mapcar
+       (function (lambda (x)
+		   (and (string-match (jka-compr-info-regexp x) filename)
+			(throw 'compression-info x))))
+       jka-compr-compression-info-list)
+      nil)))
+
+(defun jka-compr-install ()
+  "Install jka-compr.
+This adds entries to `file-name-handler-alist' and `auto-mode-alist'
+and `inhibit-first-line-modes-suffixes'."
+
+  (setq jka-compr-file-name-handler-entry
+	(cons (jka-compr-build-file-regexp) 'jka-compr-handler))
+
+  (setq file-name-handler-alist (cons jka-compr-file-name-handler-entry
+				      file-name-handler-alist))
+
+  (setq jka-compr-added-to-file-coding-system-alist nil)
+
+  (mapcar
+   (function (lambda (x)
+	       ;; Don't do multibyte encoding on the compressed files.
+	       (let ((elt (cons (jka-compr-info-regexp x)
+				 '(no-conversion . no-conversion))))
+		 (setq file-coding-system-alist
+		       (cons elt file-coding-system-alist))
+		 (setq jka-compr-added-to-file-coding-system-alist
+		       (cons elt jka-compr-added-to-file-coding-system-alist)))
+
+	       (and (jka-compr-info-strip-extension x)
+		    ;; Make entries in auto-mode-alist so that modes
+		    ;; are chosen right according to the file names
+		    ;; sans `.gz'.
+		    (setq auto-mode-alist
+			  (cons (list (jka-compr-info-regexp x)
+				      nil 'jka-compr)
+				auto-mode-alist))
+		    ;; Also add these regexps to
+		    ;; inhibit-first-line-modes-suffixes, so that a
+		    ;; -*- line in the first file of a compressed tar
+		    ;; file doesn't override tar-mode.
+		    (setq inhibit-first-line-modes-suffixes
+			  (cons (jka-compr-info-regexp x)
+				inhibit-first-line-modes-suffixes)))))
+   jka-compr-compression-info-list)
+  (setq auto-mode-alist
+	(append auto-mode-alist jka-compr-mode-alist-additions))
+
+  ;; Make sure that (load "foo") will find /bla/foo.el.gz.
+  (setq load-suffixes
+	(apply 'append
+	       (mapcar (lambda (suffix)
+			 (cons suffix
+			       (mapcar (lambda (ext) (concat suffix ext))
+				       jka-compr-load-suffixes)))
+		       load-suffixes))))
+
+
+(defun jka-compr-installed-p ()
+  "Return non-nil if jka-compr is installed.
+The return value is the entry in `file-name-handler-alist' for jka-compr."
+
+  (let ((fnha file-name-handler-alist)
+	(installed nil))
+
+    (while (and fnha (not installed))
+     (and (eq (cdr (car fnha)) 'jka-compr-handler)
+	   (setq installed (car fnha)))
+      (setq fnha (cdr fnha)))
+
+    installed))
+
+(define-minor-mode auto-compression-mode
+  "Toggle automatic file compression and uncompression.
+With prefix argument ARG, turn auto compression on if positive, else off.
+Returns the new status of auto compression (non-nil means on)."
+  :global t :group 'jka-compr
+  (let* ((installed (jka-compr-installed-p))
+	 (flag auto-compression-mode))
+    (cond
+     ((and flag installed) t)		; already installed
+     ((and (not flag) (not installed)) nil) ; already not installed
+     (flag (jka-compr-install))
+     (t (jka-compr-uninstall)))))
+
+(defmacro with-auto-compression-mode (&rest body)
+  "Evalute BODY with automatic file compression and uncompression enabled."
+  (let ((already-installed (make-symbol "already-installed")))
+    `(let ((,already-installed (jka-compr-installed-p)))
+       (unwind-protect
+	   (progn
+	     (unless ,already-installed
+	       (jka-compr-install))
+	     ,@body)
+	 (unless ,already-installed
+	   (jka-compr-uninstall))))))
+(put 'with-auto-compression-mode 'lisp-indent-function 0)
+
+
+;;; This is what we need to know about jka-compr-handler
+;;; in order to decide when to call it.
+
+(put 'jka-compr-handler 'safe-magic t)
+(put 'jka-compr-handler 'operations '(jka-compr-byte-compiler-base-file-name
+				      write-region insert-file-contents
+				      file-local-copy load))
+
+;;; Turn on the mode.
+(auto-compression-mode 1)
+
+(provide 'jka-comp-hook)
+
+;; arch-tag: 4bd73429-f400-45fe-a065-270a113e31a8
+;;; jka-comp-hook.el ends here
\ No newline at end of file
--- a/lisp/jka-compr.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/jka-compr.el	Mon May 02 14:38:00 2005 +0000
@@ -100,15 +100,6 @@
 
 ;;; Code:
 
-(defgroup compression nil
-  "Data compression utilities"
-  :group 'data)
-
-(defgroup jka-compr nil
-  "jka-compr customization"
-  :group 'compression)
-
-
 (defcustom jka-compr-shell "sh"
   "*Shell to be used for calling compression programs.
 The value of this variable only matters if you want to discard the
@@ -120,118 +111,6 @@
 (defvar jka-compr-use-shell
   (not (memq system-type '(ms-dos windows-nt))))
 
-;;; I have this defined so that .Z files are assumed to be in unix
-;;; compress format; and .gz files, in gzip format, and .bz2 files in bzip fmt.
-(defcustom jka-compr-compression-info-list
-  ;;[regexp
-  ;; compr-message  compr-prog  compr-args
-  ;; uncomp-message uncomp-prog uncomp-args
-  ;; can-append auto-mode-flag strip-extension-flag file-magic-bytes]
-  '(["\\.Z\\(~\\|\\.~[0-9]+~\\)?\\'"
-     "compressing"    "compress"     ("-c")
-     "uncompressing"  "uncompress"   ("-c")
-     nil t "\037\235"]
-     ;; Formerly, these had an additional arg "-c", but that fails with
-     ;; "Version 0.1pl2, 29-Aug-97." (RedHat 5.1 GNU/Linux) and
-     ;; "Version 0.9.0b, 9-Sept-98".
-    ["\\.bz2\\'"
-     "bzip2ing"        "bzip2"         nil
-     "bunzip2ing"      "bzip2"         ("-d")
-     nil t "BZh"]
-    ["\\.tbz\\'"
-     "bzip2ing"        "bzip2"         nil
-     "bunzip2ing"      "bzip2"         ("-d")
-     nil nil "BZh"]
-    ["\\.tgz\\'"
-     "zipping"        "gzip"         ("-c" "-q")
-     "unzipping"      "gzip"         ("-c" "-q" "-d")
-     t nil "\037\213"]
-    ["\\.g?z\\(~\\|\\.~[0-9]+~\\)?\\'"
-     "zipping"        "gzip"         ("-c" "-q")
-     "unzipping"      "gzip"         ("-c" "-q" "-d")
-     t t "\037\213"]
-    ;; dzip is gzip with random access.  Its compression program can't
-    ;; read/write stdin/out, so .dz files can only be viewed without
-    ;; saving, having their contents decompressed with gzip.
-    ["\\.dz\\'"
-     nil              nil            nil
-     "unzipping"      "gzip"         ("-c" "-q" "-d")
-     nil t "\037\213"])
-
-  "List of vectors that describe available compression techniques.
-Each element, which describes a compression technique, is a vector of
-the form [REGEXP COMPRESS-MSG COMPRESS-PROGRAM COMPRESS-ARGS
-UNCOMPRESS-MSG UNCOMPRESS-PROGRAM UNCOMPRESS-ARGS
-APPEND-FLAG STRIP-EXTENSION-FLAG FILE-MAGIC-CHARS], where:
-
-   regexp                is a regexp that matches filenames that are
-                         compressed with this format
-
-   compress-msg          is the message to issue to the user when doing this
-                         type of compression (nil means no message)
-
-   compress-program      is a program that performs this compression
-                         (nil means visit file in read-only mode)
-
-   compress-args         is a list of args to pass to the compress program
-
-   uncompress-msg        is the message to issue to the user when doing this
-                         type of uncompression (nil means no message)
-
-   uncompress-program    is a program that performs this compression
-
-   uncompress-args       is a list of args to pass to the uncompress program
-
-   append-flag           is non-nil if this compression technique can be
-                         appended
-
-   strip-extension-flag  non-nil means strip the regexp from file names
-                         before attempting to set the mode.
-
-   file-magic-chars      is a string of characters that you would find
-			 at the beginning of a file compressed in this way.
-
-Because of the way `call-process' is defined, discarding the stderr output of
-a program adds the overhead of starting a shell each time the program is
-invoked."
-  :type '(repeat (vector regexp
-			 (choice :tag "Compress Message"
-				 (string :format "%v")
-				 (const :tag "No Message" nil))
-			 (choice :tag "Compress Program"
-				 (string)
-				 (const :tag "None" nil))
-			 (repeat :tag "Compress Arguments" string)
-			 (choice :tag "Uncompress Message"
-				 (string :format "%v")
-				 (const :tag "No Message" nil))
-			 (choice :tag "Uncompress Program"
-				 (string)
-				 (const :tag "None" nil))
-			 (repeat :tag "Uncompress Arguments" string)
-			 (boolean :tag "Append")
-			 (boolean :tag "Strip Extension")
-			 (string :tag "Magic Bytes")))
-  :group 'jka-compr)
-
-(defcustom jka-compr-mode-alist-additions
-  (list (cons "\\.tgz\\'" 'tar-mode) (cons "\\.tbz\\'" 'tar-mode))
-  "A list of pairs to add to `auto-mode-alist' when jka-compr is installed."
-  :type '(repeat (cons string symbol))
-  :group 'jka-compr)
-
-(defcustom jka-compr-load-suffixes '(".gz")
-  "List of suffixes to try when loading files."
-  :type '(repeat string)
-  :group 'jka-compr)
-
-;; List of all the elements we actually added to file-coding-system-alist.
-(defvar jka-compr-added-to-file-coding-system-alist nil)
-
-(defvar jka-compr-file-name-handler-entry
-  nil
-  "The entry in `file-name-handler-alist' used by the jka-compr I/O functions.")
-
 (defvar jka-compr-really-do-compress nil
   "Non-nil in a buffer whose visited file was uncompressed on visiting it.
 This means compress the data on writing the file, even if the
@@ -764,12 +643,13 @@
 (put 'byte-compiler-base-file-name 'jka-compr
      'jka-compr-byte-compiler-base-file-name)
 
+;;;###autoload
 (defvar jka-compr-inhibit nil
   "Non-nil means inhibit automatic uncompression temporarily.
 Lisp programs can bind this to t to do that.
 It is not recommended to set this variable permanently to anything but nil.")
 
-(put 'jka-compr-handler 'safe-magic t)
+;;;###autoload
 (defun jka-compr-handler (operation &rest args)
   (save-match-data
     (let ((jka-op (get operation 'jka-compr)))
@@ -790,65 +670,6 @@
     (apply operation args)))
 
 
-(defun jka-compr-build-file-regexp ()
-  (mapconcat
-   'jka-compr-info-regexp
-   jka-compr-compression-info-list
-   "\\|"))
-
-
-(defun jka-compr-install ()
-  "Install jka-compr.
-This adds entries to `file-name-handler-alist' and `auto-mode-alist'
-and `inhibit-first-line-modes-suffixes'."
-
-  (setq jka-compr-file-name-handler-entry
-	(cons (jka-compr-build-file-regexp) 'jka-compr-handler))
-
-  (setq file-name-handler-alist (cons jka-compr-file-name-handler-entry
-				      file-name-handler-alist))
-
-  (setq jka-compr-added-to-file-coding-system-alist nil)
-
-  (mapcar
-   (function (lambda (x)
-	       ;; Don't do multibyte encoding on the compressed files.
-	       (let ((elt (cons (jka-compr-info-regexp x)
-				 '(no-conversion . no-conversion))))
-		 (setq file-coding-system-alist
-		       (cons elt file-coding-system-alist))
-		 (setq jka-compr-added-to-file-coding-system-alist
-		       (cons elt jka-compr-added-to-file-coding-system-alist)))
-
-	       (and (jka-compr-info-strip-extension x)
-		    ;; Make entries in auto-mode-alist so that modes
-		    ;; are chosen right according to the file names
-		    ;; sans `.gz'.
-		    (setq auto-mode-alist
-			  (cons (list (jka-compr-info-regexp x)
-				      nil 'jka-compr)
-				auto-mode-alist))
-		    ;; Also add these regexps to
-		    ;; inhibit-first-line-modes-suffixes, so that a
-		    ;; -*- line in the first file of a compressed tar
-		    ;; file doesn't override tar-mode.
-		    (setq inhibit-first-line-modes-suffixes
-			  (cons (jka-compr-info-regexp x)
-				inhibit-first-line-modes-suffixes)))))
-   jka-compr-compression-info-list)
-  (setq auto-mode-alist
-	(append auto-mode-alist jka-compr-mode-alist-additions))
-
-  ;; Make sure that (load "foo") will find /bla/foo.el.gz.
-  (setq load-suffixes
-	(apply 'append
-	       (mapcar (lambda (suffix)
-			 (cons suffix
-			       (mapcar (lambda (ext) (concat suffix ext))
-				       jka-compr-load-suffixes)))
-		       load-suffixes))))
-
-
 (defun jka-compr-uninstall ()
   "Uninstall jka-compr.
 This removes the entries in `file-name-handler-alist' and `auto-mode-alist'
@@ -908,59 +729,6 @@
 	(push suffix suffixes)))
     (setq load-suffixes (nreverse suffixes))))
 
-
-(defun jka-compr-installed-p ()
-  "Return non-nil if jka-compr is installed.
-The return value is the entry in `file-name-handler-alist' for jka-compr."
-
-  (let ((fnha file-name-handler-alist)
-	(installed nil))
-
-    (while (and fnha (not installed))
-     (and (eq (cdr (car fnha)) 'jka-compr-handler)
-	   (setq installed (car fnha)))
-      (setq fnha (cdr fnha)))
-
-    installed))
-
-
-;;; Add the file I/O hook if it does not already exist.
-;;; Make sure that jka-compr-file-name-handler-entry is eq to the
-;;; entry for jka-compr in file-name-handler-alist.
-(and (jka-compr-installed-p)
-     (jka-compr-uninstall))
-
-
-;;;###autoload
-(define-minor-mode auto-compression-mode
-  "Toggle automatic file compression and uncompression.
-With prefix argument ARG, turn auto compression on if positive, else off.
-Returns the new status of auto compression (non-nil means on)."
-  :global t :group 'jka-compr
-  (let* ((installed (jka-compr-installed-p))
-	 (flag auto-compression-mode))
-    (cond
-     ((and flag installed) t)		; already installed
-     ((and (not flag) (not installed)) nil) ; already not installed
-     (flag (jka-compr-install))
-     (t (jka-compr-uninstall)))))
-
-
-;;;###autoload
-(defmacro with-auto-compression-mode (&rest body)
-  "Evalute BODY with automatic file compression and uncompression enabled."
-  (let ((already-installed (make-symbol "already-installed")))
-    `(let ((,already-installed (jka-compr-installed-p)))
-       (unwind-protect
-	   (progn
-	     (unless ,already-installed
-	       (jka-compr-install))
-	     ,@body)
-	 (unless ,already-installed
-	   (jka-compr-uninstall))))))
-(put 'with-auto-compression-mode 'lisp-indent-function 0)
-
-
 (provide 'jka-compr)
 
 ;;; arch-tag: 3f15b630-e9a7-46c4-a22a-94afdde86ebc
--- a/lisp/loadup.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/loadup.el	Mon May 02 14:38:00 2005 +0000
@@ -203,6 +203,7 @@
 (message "%s" (garbage-collect))
 
 (load "vc-hooks")
+(load "jka-comp-hook")
 (load "ediff-hook")
 (if (fboundp 'x-show-tip) (load "tooltip"))
 (message "%s" (garbage-collect))
--- a/lisp/man.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/man.el	Mon May 02 14:38:00 2005 +0000
@@ -387,6 +387,7 @@
   (let ((table (copy-syntax-table (standard-syntax-table))))
     (modify-syntax-entry ?. "w" table)
     (modify-syntax-entry ?_ "w" table)
+    (modify-syntax-entry ?: "w" table)	; for PDL::Primitive in Perl man pages
     table)
   "Syntax table used in Man mode buffers.")
 
--- a/lisp/net/net-utils.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/net/net-utils.el	Mon May 02 14:38:00 2005 +0000
@@ -160,7 +160,7 @@
   "Regexp to match the nslookup prompt.
 
 This variable is only used if the variable
-`comint-use-prompt-regexp-instead-of-fields' is non-nil."
+`comint-use-prompt-regexp' is non-nil."
   :group 'net-utils
   :type  'regexp)
 
@@ -183,7 +183,7 @@
   "Regexp which matches the FTP program's prompt.
 
 This variable is only used if the variable
-`comint-use-prompt-regexp-instead-of-fields' is non-nil."
+`comint-use-prompt-regexp' is non-nil."
   :group 'net-utils
   :type  'regexp)
 
@@ -201,7 +201,7 @@
   "Regexp which matches the smbclient program's prompt.
 
 This variable is only used if the variable
-`comint-use-prompt-regexp-instead-of-fields' is non-nil."
+`comint-use-prompt-regexp' is non-nil."
   :group 'net-utils
   :type  'regexp)
 
--- a/lisp/novice.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/novice.el	Mon May 02 14:38:00 2005 +0000
@@ -1,6 +1,6 @@
 ;;; novice.el --- handling of disabled commands ("novice mode") for Emacs
 
-;; Copyright (C) 1985, 1986, 1987, 1994, 2002, 2004
+;; Copyright (C) 1985, 1986, 1987, 1994, 2002, 2004, 2005
 ;;   Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
@@ -182,9 +182,10 @@
       (if (search-forward (concat "(put '" (symbol-name command) " ") nil t)
 	  (delete-region
 	   (progn (beginning-of-line) (point))
-	   (progn (forward-line 1) (point))))
-      (goto-char (point-max))
-      (insert "\n(put '" (symbol-name command) " 'disabled t)\n")
+	   (progn (forward-line 1) (point)))
+	(goto-char (point-max))
+	(insert ?\n))
+      (insert "(put '" (symbol-name command) " 'disabled t)\n")
       (save-buffer))))
 
 (provide 'novice)
--- a/lisp/pcvs-info.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/pcvs-info.el	Mon May 02 14:38:00 2005 +0000
@@ -41,11 +41,13 @@
 ;;;; config variables
 ;;;;
 
-(defcustom cvs-display-full-path t
-  "*Specifies how the filenames should look like in the listing.
-If t, their full path name will be displayed, else only the filename."
+(defcustom cvs-display-full-name t
+  "*Specifies how the filenames should be displayed in the listing.
+If non-nil, their full filename name will be displayed, else only the
+non-directory part."
   :group 'pcl-cvs
   :type '(boolean))
+(define-obsolete-variable-alias 'cvs-display-full-path 'cvs-display-full-name)
 
 (defcustom cvs-allow-dir-commit nil
   "*Allow `cvs-mode-commit' on directories.
@@ -165,7 +167,7 @@
   ;; In addition to the above, the following values can be extracted:
 
   ;; handled    ;; t if this file doesn't require further action.
-  ;; full-path  ;; The complete relative filename.
+  ;; full-name  ;; The complete relative filename.
   ;; pp-name    ;; The printed file name
   ;; backup-file;; For MERGED and CONFLICT files after a \"cvs update\",
                 ;; this is a full path to the backup file where the
@@ -201,7 +203,7 @@
 
 ;; Fake selectors:
 
-(defun cvs-fileinfo->full-path (fileinfo)
+(defun cvs-fileinfo->full-name (fileinfo)
   "Return the full path for the file that is described in FILEINFO."
   (let ((dir (cvs-fileinfo->dir fileinfo)))
     (if (eq (cvs-fileinfo->type fileinfo) 'DIRCHANGE)
@@ -209,11 +211,12 @@
       ;; Here, I use `concat' rather than `expand-file-name' because I want
       ;; the resulting path to stay relative if `dir' is relative.
       (concat dir (cvs-fileinfo->file fileinfo)))))
+(define-obsolete-function-alias 'cvs-fileinfo->full-path 'cvs-fileinfo->full-name)
 
 (defun cvs-fileinfo->pp-name (fi)
   "Return the filename of FI as it should be displayed."
-  (if cvs-display-full-path
-      (cvs-fileinfo->full-path fi)
+  (if cvs-display-full-name
+      (cvs-fileinfo->full-name fi)
     (cvs-fileinfo->file fi)))
 
 (defun cvs-fileinfo->backup-file (fileinfo)
@@ -225,10 +228,11 @@
 				 (concat "\\`" (regexp-quote cvs-bakprefix)
 					 (regexp-quote file) "\\(\\.[0-9]+\\.[0-9]+\\)+\\'")))
 	 bf)
-    (dolist (f files bf)
+    (dolist (f files)
       (when (and (file-readable-p f)
 		 (or (null bf) (file-newer-than-file-p f bf)))
-	(setq bf (concat dir f))))))
+	(setq bf f)))
+    (concat dir bf)))
 
 ;; (defun cvs-fileinfo->handled (fileinfo)
 ;;   "Tell if this requires further action"
@@ -327,7 +331,7 @@
     (insert
      (case type
        (DIRCHANGE (concat "In directory "
-			  (cvs-add-face (cvs-fileinfo->full-path fileinfo)
+			  (cvs-add-face (cvs-fileinfo->full-name fileinfo)
 					'cvs-header-face t
 					'cvs-goal-column t)
 			  ":"))
--- a/lisp/pcvs.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/pcvs.el	Mon May 02 14:38:00 2005 +0000
@@ -233,7 +233,7 @@
 			     nil	;don't update display while running
 			     "status"
 			     "-v"
-			     (cvs-fileinfo->full-path (car marked)))
+			     (cvs-fileinfo->full-name (car marked)))
 	       (goto-char (point-min))
 	       (let ((tags (cvs-status-get-tags)))
 		 (when (listp tags) tags)))))))
@@ -512,7 +512,7 @@
       (let* ((dir+files+rest
 	      (if (or (null fis) (not single-dir))
 		  ;; not single-dir mode: just process the whole thing
-		  (list "" (mapcar 'cvs-fileinfo->full-path fis) nil)
+		  (list "" (mapcar 'cvs-fileinfo->full-name fis) nil)
 		;; single-dir mode: extract the same-dir-elements
 		(let ((dir (cvs-fileinfo->dir (car fis))))
 		  ;; output the concerned dir so the parser can translate paths
@@ -611,7 +611,7 @@
 	     (append (cvs-flags-query 'cvs-cvs-flags nil 'noquery)
 		     (if cvs-cvsroot (list "-d" cvs-cvsroot))
 		     args
-		     (mapcar 'cvs-fileinfo->full-path fis))))))
+		     (mapcar 'cvs-fileinfo->full-name fis))))))
 
 (defun cvs-update-header (cmd add)
   (let* ((hf (ewoc-get-hf cvs-cookies))
@@ -831,7 +831,7 @@
   (and (or (eq (cvs-fileinfo->type fi) 'REMOVED)
 	   (and (eq (cvs-fileinfo->type fi) 'CONFLICT)
 		(eq (cvs-fileinfo->subtype fi) 'REMOVED)))
-       (file-exists-p (cvs-fileinfo->full-path fi))))
+       (file-exists-p (cvs-fileinfo->full-name fi))))
 
 ;; called at the following times:
 ;; - postparse  ((eq cvs-auto-remove-handled t) cvs-auto-remove-directories nil)
@@ -1406,7 +1406,7 @@
 (defun cvs-mode-files (&rest -cvs-mode-files-args)
   (cvs-mode!
    (lambda ()
-     (mapcar 'cvs-fileinfo->full-path
+     (mapcar 'cvs-fileinfo->full-name
 	     (apply 'cvs-mode-marked -cvs-mode-files-args)))))
 
 ;;
@@ -1564,7 +1564,7 @@
     ;; find directories and look for fis needing a description
     (dolist (fi fis)
       (cond
-       ((file-directory-p (cvs-fileinfo->full-path fi)) (push fi dirs))
+       ((file-directory-p (cvs-fileinfo->full-name fi)) (push fi dirs))
        ((eq (cvs-fileinfo->type fi) 'UNKNOWN) (setq needdesc t))))
     ;; prompt for description if necessary
     (let* ((msg (if (and needdesc
@@ -1642,8 +1642,8 @@
 Signal an error if there is no backup file."
   (let ((backup-file (cvs-fileinfo->backup-file fileinfo)))
     (unless backup-file
-      (error "%s has no backup file" (cvs-fileinfo->full-path fileinfo)))
-    (list backup-file (cvs-fileinfo->full-path fileinfo))))
+      (error "%s has no backup file" (cvs-fileinfo->full-name fileinfo)))
+    (list backup-file (cvs-fileinfo->full-name fileinfo))))
 
 ;;
 ;; Emerge support
@@ -1697,7 +1697,7 @@
 
 (defun cvs-retrieve-revision (fileinfo rev)
   "Retrieve the given REVision of the file in FILEINFO into a new buffer."
-  (let* ((file (cvs-fileinfo->full-path fileinfo))
+  (let* ((file (cvs-fileinfo->full-name fileinfo))
 	 (buffile (concat file "." rev)))
     (or (find-buffer-visiting buffile)
 	(with-current-buffer (create-file-buffer buffile)
@@ -1729,7 +1729,7 @@
   (interactive)
   (let ((fi (cvs-mode-marked 'merge nil :one t :file t)))
     (let ((merge (cvs-fileinfo->merge fi))
-	  (file (cvs-fileinfo->full-path fi))
+	  (file (cvs-fileinfo->full-name fi))
 	  (backup-file (cvs-fileinfo->backup-file fi)))
       (if (not (and merge backup-file))
 	  (let ((buf (find-file-noselect file)))
@@ -1760,7 +1760,7 @@
      (list (or rev1 (cvs-flags-query 'cvs-idiff-version))
 	   rev2)))
   (let ((fi (cvs-mode-marked 'diff "idiff" :one t :file t)))
-    (let* ((file (cvs-fileinfo->full-path fi))
+    (let* ((file (cvs-fileinfo->full-name fi))
 	   (rev1-buf (cvs-retrieve-revision fi (or rev1 "BASE")))
 	   (rev2-buf (if rev2 (cvs-retrieve-revision fi rev2)))
 	   ;; this binding is used by cvs-ediff-startup-hook
@@ -1778,13 +1778,13 @@
       (error "idiff-other cannot be applied to more than 2 files at a time"))
     (let* ((fi1 (car fis))
 	   (rev1-buf (if rev1 (cvs-retrieve-revision fi1 rev1)
-		       (find-file-noselect (cvs-fileinfo->full-path fi1))))
+		       (find-file-noselect (cvs-fileinfo->full-name fi1))))
 	   rev2-buf)
       (if (cdr fis)
 	  (let ((fi2 (nth 1 fis)))
 	    (setq rev2-buf
 		  (if rev2 (cvs-retrieve-revision fi2 rev2)
-		    (find-file-noselect (cvs-fileinfo->full-path fi2)))))
+		    (find-file-noselect (cvs-fileinfo->full-name fi2)))))
 	(error "idiff-other doesn't know what other file/buffer to use"))
       (let* (;; this binding is used by cvs-ediff-startup-hook
 	     (cvs-transient-buffers (list rev1-buf rev2-buf)))
@@ -1799,7 +1799,7 @@
     (let (ret)
       (dolist (fi (or fis (list (cvs-create-fileinfo 'DIRCHANGE "" "." ""))))
 	(when (cvs-string-prefix-p
-	       (expand-file-name (cvs-fileinfo->full-path fi) dir)
+	       (expand-file-name (cvs-fileinfo->full-name fi) dir)
 	       buffer-file-name)
 	  (setq ret t)))
       ret)))
@@ -2002,7 +2002,7 @@
 	     (set-buffer cvs-buf)
 	     (setq default-directory odir))
 	 (let ((buf (if rev (cvs-retrieve-revision fi rev)
-		      (find-file-noselect (cvs-fileinfo->full-path fi)))))
+		      (find-file-noselect (cvs-fileinfo->full-name fi)))))
 	   (funcall (cond ((eq other 'dont-select) 'display-buffer)
 			  (other
 			   (if view 'view-buffer-other-window
@@ -2093,14 +2093,14 @@
 	 (silent (or (not cvs-confirm-removals)
 		     (cvs-every (lambda (fi)
 				  (or (not (file-exists-p
-					    (cvs-fileinfo->full-path fi)))
+					    (cvs-fileinfo->full-name fi)))
 				      (cvs-applicable-p fi 'safe-rm)))
 				files)))
 	 (tmpbuf (cvs-temp-buffer)))
     (when (and (not silent) (equal cvs-confirm-removals 'list))
       (with-current-buffer tmpbuf
 	(let ((inhibit-read-only t))
-	  (cvs-insert-strings (mapcar 'cvs-fileinfo->full-path fis))
+	  (cvs-insert-strings (mapcar 'cvs-fileinfo->full-name fis))
 	  (cvs-pop-to-buffer-same-frame (current-buffer))
 	  (shrink-window-if-larger-than-buffer))))
     (if (not (or silent
@@ -2119,7 +2119,7 @@
 	(progn (message "Aborting") nil)
       (dolist (fi files)
 	(let* ((type (cvs-fileinfo->type fi))
-	       (file (cvs-fileinfo->full-path fi)))
+	       (file (cvs-fileinfo->full-name fi)))
 	  (when (or all (eq type 'UNKNOWN))
 	    (when (file-exists-p file) (delete-file file))
 	    (unless all (setf (cvs-fileinfo->type fi) 'DEAD) t))))
@@ -2166,7 +2166,7 @@
   (interactive)
   (let ((marked (cvs-get-marked (cvs-ignore-marks-p "byte-compile"))))
     (dolist (fi marked)
-      (let ((filename (cvs-fileinfo->full-path fi)))
+      (let ((filename (cvs-fileinfo->full-name fi)))
 	(when (string-match "\\.el\\'" filename)
 	  (byte-compile-file filename))))))
 
@@ -2237,7 +2237,7 @@
 
 (defun cvs-revert-if-needed (fis)
   (dolist (fileinfo fis)
-    (let* ((file (cvs-fileinfo->full-path fileinfo))
+    (let* ((file (cvs-fileinfo->full-name fileinfo))
 	   (buffer (find-buffer-visiting file)))
       ;; For a revert to happen the user must be editing the file...
       (unless (or (null buffer)
--- a/lisp/progmodes/cc-mode.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/progmodes/cc-mode.el	Mon May 02 14:38:00 2005 +0000
@@ -639,6 +639,24 @@
 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.y\\(acc\\)?\\'" . c-mode))
 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.lex\\'" . c-mode))
 
+(defvar cc-define-alist nil "Alist of #define directives for GUD tooltips.")
+(defvar cc-mode-cpp-program "/lib/cpp"
+  "*The program name for the CPP pre-processor.")
+
+(defun cc-create-define-alist ()
+  (let* ((file (buffer-file-name))
+	 (output
+	  (with-output-to-string
+	    (with-current-buffer standard-output
+	      (call-process cc-mode-cpp-program
+			    (if (file-exists-p file) file nil) t nil "-dM"))))
+	(define-list (split-string output "\n" t))
+	(name))
+    (setq cc-define-alist nil)
+    (dolist (define define-list)
+      (setq name (nth 1 (split-string define "[( ]")))
+      (push (cons name define) cc-define-alist))))
+
 ;;;###autoload
 (defun c-mode ()
   "Major mode for editing K&R and ANSI C code.
@@ -662,11 +680,14 @@
 	mode-name "C"
 	local-abbrev-table c-mode-abbrev-table
 	abbrev-mode t)
+  (make-local-variable 'cc-define-alist)
   (use-local-map c-mode-map)
   (c-init-language-vars-for 'c-mode)
   (c-common-init 'c-mode)
   (easy-menu-add c-c-menu)
   (cc-imenu-init cc-imenu-c-generic-expression)
+  (if (buffer-file-name) (cc-create-define-alist))
+  (add-hook 'after-save-hook 'cc-create-define-alist nil t)
   (run-mode-hooks 'c-mode-common-hook 'c-mode-hook)
   (c-update-modeline))
 
--- a/lisp/progmodes/cperl-mode.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/progmodes/cperl-mode.el	Mon May 02 14:38:00 2005 +0000
@@ -1514,14 +1514,14 @@
 	(set 'font-lock-unfontify-region-function ; not present with old Emacs
 	      'cperl-font-lock-unfontify-region-function)
 	(make-local-variable 'cperl-syntax-done-to)
-	;; Another bug: unless font-lock-syntactic-keywords, font-lock
-	;;  ignores syntax-table text-property.  (t) is a hack
-	;;  to make font-lock think that font-lock-syntactic-keywords
-	;;  are defined
 	(make-local-variable 'font-lock-syntactic-keywords)
 	(setq font-lock-syntactic-keywords
 	      (if cperl-syntaxify-by-font-lock
-		  '(t (cperl-fontify-syntaxically))
+		  '((cperl-fontify-syntaxically))
+                ;; unless font-lock-syntactic-keywords, font-lock (pre-22.1)
+                ;;  used to ignore syntax-table text-properties.  (t) is a hack
+                ;;  to make font-lock think that font-lock-syntactic-keywords
+                ;;  are defined.
 		'(t)))))
   (make-local-variable 'cperl-old-style)
   (if (boundp 'normal-auto-fill-function) ; 19.33 and later
--- a/lisp/progmodes/flymake.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/progmodes/flymake.el	Mon May 02 14:38:00 2005 +0000
@@ -62,7 +62,8 @@
     (replace-in-string str regexp rep)))
 
 (defun flymake-split-string (str pattern)
-  "Split, then remove first and/or last in case it's empty."
+  "Split STR into a list of substrings bounded by PATTERN.
+Zero-length substrings at the beginning and end of the list are omitted."
   (let* ((splitted (split-string str pattern)))
     (if (and (> (length splitted) 0) (= 0 (length (elt splitted 0))))
 	(setq splitted (cdr splitted)))
@@ -86,7 +87,12 @@
     (lambda (&optional arg) (save-excursion (end-of-line arg) (point)))))
 
 (defun flymake-popup-menu (pos menu-data)
-  (if (and (fboundp 'popup-menu) (fboundp 'make-event))
+  "Pop up the flymake menu at position POS, using the data MENU-DATA.
+POS is a list of the form ((X Y) WINDOW), where X and Y are
+pixels positions from the top left corner of WINDOW's frame.
+MENU-DATA is a list of error and warning messages returned by
+`flymake-make-err-menu-data'."
+  (if (featurep 'xemacs)
       (let* ((x-pos       (nth 0 (nth 0 pos)))
 	     (y-pos       (nth 1 (nth 0 pos)))
 	     (fake-event-props  '(button 1 x 1 y 1)))
@@ -96,6 +102,10 @@
     (x-popup-menu pos (flymake-make-emacs-menu menu-data))))
 
 (defun flymake-make-emacs-menu (menu-data)
+  "Return a menu specifier using MENU-DATA.
+MENU-DATA is a list of error and warning messages returned by
+`flymake-make-err-menu-data'.
+See `x-popup-menu' for the menu specifier format."
   (let* ((menu-title     (nth 0 menu-data))
 	 (menu-items     (nth 1 menu-data))
 	 (menu-commands  nil))
@@ -109,6 +119,7 @@
 (defun flymake-nop ())
 
 (defun flymake-make-xemacs-menu (menu-data)
+  "Return a menu specifier using MENU-DATA."
   (let* ((menu-title     (nth 0 menu-data))
 	 (menu-items     (nth 1 menu-data))
 	 (menu-commands  nil))
@@ -152,7 +163,11 @@
   :type 'integer)
 
 (defun flymake-log (level text &rest args)
-  "Log a message with optional arguments."
+  "Log a message at level LEVEL.
+If LEVEL is higher than `flymake-log-level', the message is
+ignored.  Otherwise, it is printed using `message'.
+TEXT is a format control string, and the remaining arguments ARGS
+are the string substitutions (see `format')."
   (if (<= level flymake-log-level)
       (let* ((msg (apply 'format text args)))
 	(message msg)
@@ -176,69 +191,37 @@
     tmp))
 
 (defvar flymake-pid-to-names (flymake-makehash)
-  "pid -> source buffer name, output file name mapping.")
+  "Hash table mapping PIDs to source buffer names and output files.")
 
 (defun flymake-reg-names (pid source-buffer-name)
-  "Save into in PID map."
+  "Associate PID with SOURCE-BUFFER-NAME in `flymake-pid-to-names'."
   (unless (stringp source-buffer-name)
     (error "Invalid buffer name"))
   (puthash pid (list source-buffer-name) flymake-pid-to-names))
 
 (defun flymake-get-source-buffer-name (pid)
-  "Return buffer name stored in PID map."
+  "Return buffer name associated with PID in `flymake-pid-to-names'."
   (nth 0 (gethash pid flymake-pid-to-names)))
 
 (defun flymake-unreg-names (pid)
-  "Delete PID->buffer name mapping."
+  "Remove the entry associated with PID from `flymake-pid-to-names'."
   (remhash pid flymake-pid-to-names))
 
-(defun flymake-get-buffer-var (buffer var-name)
-  "Switch to BUFFER if necessary and return local variable VAR-NAME."
-  (unless (bufferp buffer)
-    (error "Invalid buffer"))
-
-  (if (eq buffer (current-buffer))
-      (symbol-value var-name)
-    (with-current-buffer buffer
-      (symbol-value var-name))))
-
-(defun flymake-set-buffer-var (buffer var-name var-value)
-  "Switch to BUFFER if necessary and set local variable VAR-NAME to VAR-VALUE."
-  (unless (bufferp buffer)
-    (error "Invalid buffer"))
-
-  (if (eq buffer (current-buffer))
-      (set var-name var-value)
-    (with-current-buffer buffer
-      (set var-name var-value))))
-
 (defvar flymake-buffer-data (flymake-makehash)
   "Data specific to syntax check tool, in name-value pairs.")
 
 (make-variable-buffer-local 'flymake-buffer-data)
 
-(defun flymake-get-buffer-data (buffer)
-  (flymake-get-buffer-var buffer 'flymake-buffer-data))
-
-(defun flymake-set-buffer-data (buffer data)
-  (flymake-set-buffer-var buffer 'flymake-buffer-data data))
-
 (defun flymake-get-buffer-value (buffer name)
-  (gethash name (flymake-get-buffer-data buffer)))
+  (gethash name (with-current-buffer buffer flymake-buffer-data)))
 
 (defun flymake-set-buffer-value (buffer name value)
-  (puthash name value (flymake-get-buffer-data buffer)))
+  (puthash name value (with-current-buffer buffer flymake-buffer-data)))
 
 (defvar flymake-output-residual nil)
 
 (make-variable-buffer-local 'flymake-output-residual)
 
-(defun flymake-get-buffer-output-residual (buffer)
-  (flymake-get-buffer-var buffer 'flymake-output-residual))
-
-(defun flymake-set-buffer-output-residual (buffer residual)
-  (flymake-set-buffer-var buffer 'flymake-output-residual residual))
-
 (defcustom flymake-allowed-file-name-masks
   '((".+\\.c$" flymake-simple-make-init flymake-simple-cleanup flymake-get-real-file-name)
     (".+\\.cpp$" flymake-simple-make-init flymake-simple-cleanup flymake-get-real-file-name)
@@ -642,35 +625,38 @@
 
 		  (flymake-parse-residual source-buffer)
 		  (flymake-post-syntax-check source-buffer exit-status command)
-		  (flymake-set-buffer-is-running source-buffer nil))))
+		  (setq flymake-is-running nil))))
 	  (error
 	   (let ((err-str (format "Error in process sentinel for buffer %s: %s"
 				  source-buffer (error-message-string err))))
 	     (flymake-log 0 err-str)
-	     (flymake-set-buffer-is-running source-buffer nil)))))))
+	     (with-current-buffer source-buffer
+	       (setq flymake-is-running nil))))))))
 
 (defun flymake-post-syntax-check (source-buffer exit-status command)
-  (flymake-set-buffer-err-info source-buffer (flymake-get-buffer-new-err-info source-buffer))
-  (flymake-set-buffer-new-err-info source-buffer nil)
-
-  (flymake-set-buffer-err-info source-buffer (flymake-fix-line-numbers
-					      (flymake-get-buffer-err-info source-buffer)
-					      1
-					      (flymake-count-lines source-buffer)))
+  (with-current-buffer source-buffer
+    (setq flymake-err-info flymake-new-err-info)
+    (setq flymake-new-err-info nil)
+    (setq flymake-err-info
+	  (flymake-fix-line-numbers
+	   flymake-err-info 1 (flymake-count-lines source-buffer))))
   (flymake-delete-own-overlays source-buffer)
-  (flymake-highlight-err-lines source-buffer (flymake-get-buffer-err-info source-buffer))
-
-  (let ((err-count   (flymake-get-err-count (flymake-get-buffer-err-info source-buffer) "e"))
-	(warn-count  (flymake-get-err-count (flymake-get-buffer-err-info source-buffer) "w")))
+  (flymake-highlight-err-lines
+   source-buffer (with-current-buffer source-buffer flymake-err-info))
+  (let (err-count warn-count)
+    (with-current-buffer source-buffer
+      (setq err-count (flymake-get-err-count flymake-err-info "e"))
+      (setq warn-count  (flymake-get-err-count flymake-err-info "w"))
+      (flymake-log 2 "%s: %d error(s), %d warning(s) in %.2f second(s)"
+		 (buffer-name source-buffer) err-count warn-count
+		 (- (flymake-float-time) flymake-check-start-time))
+      (setq flymake-check-start-time nil))
 
-    (flymake-log 2 "%s: %d error(s), %d warning(s) in %.2f second(s)"
-		 (buffer-name source-buffer) err-count warn-count
-		 (- (flymake-float-time) (flymake-get-buffer-check-start-time source-buffer)))
-    (flymake-set-buffer-check-start-time source-buffer nil)
     (if (and (equal 0 err-count) (equal 0 warn-count))
 	(if (equal 0 exit-status)
 	    (flymake-report-status source-buffer "" "")	; PASSED
-	  (if (not (flymake-get-buffer-check-was-interrupted source-buffer))
+	  (if (not (with-current-buffer source-buffer
+		     flymake-check-was-interrupted))
 	      (flymake-report-fatal-status (current-buffer) "CFGERR"
 					   (format "Configuration error has occured while running %s" command))
 	    (flymake-report-status source-buffer nil ""))) ; "STOPPED"
@@ -679,38 +665,34 @@
 (defun flymake-parse-output-and-residual (source-buffer output)
   "Split OUTPUT into lines, merge in residual if necessary."
   (with-current-buffer source-buffer
-    (let* ((buffer-residual     (flymake-get-buffer-output-residual source-buffer))
+    (let* ((buffer-residual     flymake-output-residual)
 	   (total-output        (if buffer-residual (concat buffer-residual output) output))
 	   (lines-and-residual  (flymake-split-output total-output))
 	   (lines               (nth 0 lines-and-residual))
 	   (new-residual        (nth 1 lines-and-residual)))
-
-      (flymake-set-buffer-output-residual source-buffer new-residual)
-      (flymake-set-buffer-new-err-info source-buffer (flymake-parse-err-lines
-						      (flymake-get-buffer-new-err-info source-buffer)
-						      source-buffer lines)))))
+      (with-current-buffer source-buffer
+	(setq flymake-output-residual new-residual)
+	(setq flymake-new-err-info
+	      (flymake-parse-err-lines
+	       flymake-new-err-info
+	       source-buffer lines))))))
 
 (defun flymake-parse-residual (source-buffer)
   "Parse residual if it's non empty."
   (with-current-buffer source-buffer
-    (when (flymake-get-buffer-output-residual source-buffer)
-      (flymake-set-buffer-new-err-info source-buffer (flymake-parse-err-lines
-						      (flymake-get-buffer-new-err-info source-buffer)
-						      source-buffer
-						      (list (flymake-get-buffer-output-residual source-buffer))))
-      (flymake-set-buffer-output-residual source-buffer nil))))
+    (when flymake-output-residual
+      (setq flymake-new-err-info
+	    (flymake-parse-err-lines
+	     flymake-new-err-info
+	     source-buffer
+	     (list flymake-output-residual)))
+      (setq flymake-output-residual nil))))
 
 (defvar flymake-err-info nil
   "Sorted list of line numbers and lists of err info in the form (file, err-text).")
 
 (make-variable-buffer-local 'flymake-err-info)
 
-(defun flymake-get-buffer-err-info (buffer)
-  (flymake-get-buffer-var buffer 'flymake-err-info))
-
-(defun flymake-set-buffer-err-info (buffer err-info)
-  (flymake-set-buffer-var buffer 'flymake-err-info err-info))
-
 (defun flymake-er-make-er (line-no line-err-info-list)
   (list line-no line-err-info-list))
 
@@ -725,12 +707,6 @@
 
 (make-variable-buffer-local 'flymake-new-err-info)
 
-(defun flymake-get-buffer-new-err-info (buffer)
-  (flymake-get-buffer-var buffer 'flymake-new-err-info))
-
-(defun flymake-set-buffer-new-err-info (buffer new-err-info)
-  (flymake-set-buffer-var buffer 'flymake-new-err-info new-err-info))
-
 ;; getters/setters for line-err-info: (file, line, type, text).
 (defun flymake-ler-make-ler (file line type text &optional full-file)
   (list file line type text full-file))
@@ -1067,7 +1043,11 @@
 	       (and (not (flymake-ler-get-file line-one)) (not (flymake-ler-get-file line-two)))))))
 
 (defun flymake-add-line-err-info (line-err-info-list line-err-info)
-  "Insert new err info favoring sorting: err-type e/w, filename nil/non-nil."
+  "Update LINE-ERR-INFO-LIST with the error LINE-ERR-INFO.
+For the format of LINE-ERR-INFO, see `flymake-ler-make-ler'.
+The new element is inserted in the proper position, according to
+the predicate `flymake-line-err-info-is-less-or-equal'.
+The updated value of LINE-ERR-INFO-LIST is returned."
   (if (not line-err-info-list)
       (list line-err-info)
     (let* ((count  (length line-err-info-list))
@@ -1079,7 +1059,10 @@
       line-err-info-list)))
 
 (defun flymake-add-err-info (err-info-list line-err-info)
-  "Add error info (file line type text) to err info list preserving sort order."
+  "Update ERR-INFO-LIST with the error LINE-ERR-INFO, preserving sort order.
+Returns the updated value of ERR-INFO-LIST.
+For the format of ERR-INFO-LIST, see `flymake-err-info'.
+For the format of LINE-ERR-INFO, see `flymake-ler-make-ler'."
   (let* ((line-no             (if (flymake-ler-get-file line-err-info) 1 (flymake-ler-get-line line-err-info)))
 	 (info-and-pos        (flymake-find-err-info err-info-list line-no))
 	 (exists              (car info-and-pos))
@@ -1202,16 +1185,16 @@
   (unless (bufferp buffer)
     (error "Expected a buffer"))
   (with-current-buffer buffer
-    (flymake-log 3 "flymake is running: %s" (flymake-get-buffer-is-running buffer))
-    (when (and (not (flymake-get-buffer-is-running buffer))
+    (flymake-log 3 "flymake is running: %s" flymake-is-running)
+    (when (and (not flymake-is-running)
 	       (flymake-can-syntax-check-file (buffer-file-name buffer)))
       (when (or (not flymake-compilation-prevents-syntax-check)
 		(not (flymake-compilation-is-running)))	;+ (flymake-rep-ort-status buffer "COMP")
 	(flymake-clear-buildfile-cache)
 	(flymake-clear-project-include-dirs-cache)
 
-	(flymake-set-buffer-check-was-interrupted buffer nil)
-	(flymake-set-buffer-data buffer (flymake-makehash 'equal))
+	(setq flymake-check-was-interrupted nil)
+	(setq flymake-buffer-data (flymake-makehash 'equal))
 
 	(let* ((source-file-name  (buffer-file-name buffer))
 	       (init-f (flymake-get-init-function source-file-name))
@@ -1225,7 +1208,7 @@
 		(flymake-log 0 "init function %s for %s failed, cleaning up" init-f source-file-name)
 		(funcall cleanup-f buffer))
 	    (progn
-	      (flymake-set-buffer-last-change-time buffer nil)
+	      (setq flymake-last-change-time nil)
 	      (flymake-start-syntax-check-process buffer cmd args dir))))))))
 
 (defun flymake-start-syntax-check-process (buffer cmd args dir)
@@ -1242,9 +1225,10 @@
 
 	  (flymake-reg-names (process-id process) (buffer-name buffer))
 
-	  (flymake-set-buffer-is-running buffer t)
-	  (flymake-set-buffer-last-change-time buffer nil)
-	  (flymake-set-buffer-check-start-time buffer (flymake-float-time))
+	  (with-current-buffer buffer
+	    (setq flymake-is-running t)
+	    (setq flymake-last-change-time nil)
+	    (setq flymake-check-start-time (flymake-float-time)))
 
 	  (flymake-report-status buffer nil "*")
 	  (flymake-log 2 "started process %d, command=%s, dir=%s"
@@ -1264,7 +1248,8 @@
   (signal-process pid 9)
   (let* ((buffer-name (flymake-get-source-buffer-name pid)))
     (when (and buffer-name (get-buffer buffer-name))
-      (flymake-set-buffer-check-was-interrupted (get-buffer buffer-name) t)))
+      (with-current-buffer (get-buffer buffer-name)
+	(setq flymake-check-was-interrupted t))))
   (flymake-log 1 "killed process %d" pid))
 
 (defun flymake-stop-all-syntax-checks ()
@@ -1288,56 +1273,26 @@
 
 (make-variable-buffer-local 'flymake-is-running)
 
-(defun flymake-get-buffer-is-running (buffer)
-  (flymake-get-buffer-var buffer 'flymake-is-running))
-
-(defun flymake-set-buffer-is-running (buffer is-running)
-  (flymake-set-buffer-var buffer 'flymake-is-running is-running))
-
 (defvar flymake-timer nil
   "Timer for starting syntax check.")
 
 (make-variable-buffer-local 'flymake-timer)
 
-(defun flymake-get-buffer-timer (buffer)
-  (flymake-get-buffer-var buffer 'flymake-timer))
-
-(defun flymake-set-buffer-timer (buffer timer)
-  (flymake-set-buffer-var buffer 'flymake-timer timer))
-
 (defvar flymake-last-change-time nil
   "Time of last buffer change.")
 
 (make-variable-buffer-local 'flymake-last-change-time)
 
-(defun flymake-get-buffer-last-change-time (buffer)
-  (flymake-get-buffer-var buffer 'flymake-last-change-time))
-
-(defun flymake-set-buffer-last-change-time (buffer change-time)
-  (flymake-set-buffer-var buffer 'flymake-last-change-time change-time))
-
 (defvar flymake-check-start-time nil
   "Time at which syntax check was started.")
 
 (make-variable-buffer-local 'flymake-check-start-time)
 
-(defun flymake-get-buffer-check-start-time (buffer)
-  (flymake-get-buffer-var buffer 'flymake-check-start-time))
-
-(defun flymake-set-buffer-check-start-time (buffer check-start-time)
-  (flymake-set-buffer-var buffer 'flymake-check-start-time check-start-time))
-
 (defvar flymake-check-was-interrupted nil
   "Non-nil if syntax check was killed by `flymake-compile'.")
 
 (make-variable-buffer-local 'flymake-check-was-interrupted)
 
-(defun flymake-get-buffer-check-was-interrupted (buffer)
-  (flymake-get-buffer-var buffer 'flymake-check-was-interrupted))
-
-(defun flymake-set-buffer-check-was-interrupted (buffer interrupted)
-  (flymake-set-buffer-var buffer 'flymake-check-was-interrupted interrupted))
-
 (defcustom flymake-no-changes-timeout 0.5
   "Time to wait after last change before starting compilation."
   :group 'flymake
@@ -1345,12 +1300,13 @@
 
 (defun flymake-on-timer-event (buffer)
   "Start a syntax check for buffer BUFFER if necessary."
-  ;;+(flymake-log 3 "timer: running=%s, time=%s, cur-time=%s" (flymake-get-buffer-is-running buffer) (flymake-get-buffer-last-change-time buffer) (flymake-float-time))
-  (when (and (bufferp buffer) (not (flymake-get-buffer-is-running buffer)))
+  (when (bufferp buffer)
     (with-current-buffer buffer
-      (when (and (flymake-get-buffer-last-change-time buffer)
-		 (> (flymake-float-time) (+ flymake-no-changes-timeout (flymake-get-buffer-last-change-time buffer))))
-	(flymake-set-buffer-last-change-time buffer nil)
+      (when (and (not flymake-is-running)
+		 flymake-last-change-time
+		 (> (flymake-float-time) (+ flymake-no-changes-timeout flymake-last-change-time)))
+
+	(setq flymake-last-change-time nil)
 	(flymake-log 3 "starting syntax check as more than 1 second passed since last change")
 	(flymake-start-syntax-check buffer)))))
 
@@ -1391,7 +1347,7 @@
   "Display a menu with errors/warnings for current line if it has errors and/or warnings."
   (interactive)
   (let* ((line-no             (flymake-current-line-no))
-	 (line-err-info-list  (nth 0 (flymake-find-err-info (flymake-get-buffer-err-info (current-buffer)) line-no)))
+	 (line-err-info-list  (nth 0 (flymake-find-err-info flymake-err-info line-no)))
 	 (menu-data           (flymake-make-err-menu-data line-no line-err-info-list))
 	 (choice              nil)
 	 (mouse-pos           (flymake-get-point-pixel-pos))
@@ -1442,46 +1398,27 @@
 
 (make-variable-buffer-local 'flymake-mode-line)
 
-(defun flymake-get-buffer-mode-line (buffer)
-  (flymake-get-buffer-var buffer 'flymake-mode-line))
-
-(defun flymake-set-buffer-mode-line (buffer mode-line-string)
-  (flymake-set-buffer-var buffer 'flymake-mode-line mode-line-string))
-
 (defvar flymake-mode-line-e-w nil)
 
 (make-variable-buffer-local 'flymake-mode-line-e-w)
 
-(defun flymake-get-buffer-mode-line-e-w (buffer)
-  (flymake-get-buffer-var buffer 'flymake-mode-line-e-w))
-
-(defun flymake-set-buffer-mode-line-e-w (buffer e-w)
-  (flymake-set-buffer-var buffer 'flymake-mode-line-e-w e-w))
-
 (defvar flymake-mode-line-status nil)
 
 (make-variable-buffer-local 'flymake-mode-line-status)
 
-(defun flymake-get-buffer-mode-line-status (buffer)
-  (flymake-get-buffer-var buffer 'flymake-mode-line-status))
-
-(defun flymake-set-buffer-mode-line-status (buffer status)
-  (flymake-set-buffer-var buffer 'flymake-mode-line-status status))
-
 (defun flymake-report-status (buffer e-w &optional status)
   "Show status in mode line."
   (when (bufferp buffer)
     (with-current-buffer buffer
       (when e-w
-	(flymake-set-buffer-mode-line-e-w buffer e-w)
-	)
+	(setq flymake-mode-line-e-w e-w))
       (when status
-	(flymake-set-buffer-mode-line-status buffer status))
+	(setq flymake-mode-line-status status))
       (let* ((mode-line " Flymake"))
-	(when (> (length (flymake-get-buffer-mode-line-e-w buffer)) 0)
-	  (setq mode-line (concat mode-line ":"  (flymake-get-buffer-mode-line-e-w buffer))))
-	(setq mode-line (concat mode-line (flymake-get-buffer-mode-line-status buffer)))
-	(flymake-set-buffer-mode-line buffer mode-line)
+	(when (> (length flymake-mode-line-e-w) 0)
+	  (setq mode-line (concat mode-line ":" flymake-mode-line-e-w)))
+	(setq mode-line (concat mode-line flymake-mode-line-status))
+	(setq flymake-mode-line mode-line)
 	(force-mode-line-update)))))
 
 (defun flymake-display-warning (warning)
@@ -1532,7 +1469,8 @@
 
     (flymake-report-status (current-buffer) "" "")
 
-    (flymake-set-buffer-timer (current-buffer) (run-at-time nil 1 'flymake-on-timer-event (current-buffer)))
+    (setq flymake-timer
+	  (run-at-time nil 1 'flymake-on-timer-event (current-buffer)))
 
     (setq flymake-mode t)
     (flymake-log 1 "flymake mode turned ON for buffer %s" (buffer-name (current-buffer)))
@@ -1550,12 +1488,11 @@
 
     (flymake-delete-own-overlays (current-buffer))
 
-    (when (flymake-get-buffer-timer (current-buffer))
-      (cancel-timer (flymake-get-buffer-timer (current-buffer)))
-      (flymake-set-buffer-timer (current-buffer) nil))
+    (when flymake-timer
+      (cancel-timer flymake-timer)
+      (setq flymake-timer nil))
 
-    (flymake-set-buffer-is-running (current-buffer) nil)
-
+    (setq flymake-is-running nil)
     (setq flymake-mode nil)
     (flymake-log 1 "flymake mode turned OFF for buffer %s" (buffer-name (current-buffer)))))
 
@@ -1571,7 +1508,7 @@
     (when (and flymake-start-syntax-check-on-newline (equal new-text "\n"))
       (flymake-log 3 "starting syntax check as new-line has been seen")
       (flymake-start-syntax-check-for-current-buffer))
-    (flymake-set-buffer-last-change-time (current-buffer) (flymake-float-time))))
+    (setq flymake-last-change-time (flymake-float-time))))
 
 (defun flymake-after-save-hook ()
   (if (local-variable-p 'flymake-mode (current-buffer))	; (???) other way to determine whether flymake is active in buffer being saved?
@@ -1580,9 +1517,9 @@
 	(flymake-start-syntax-check-for-current-buffer)))) ; no more mode 3. cannot start check if mode 3 (to temp copies) is active - (???)
 
 (defun flymake-kill-buffer-hook ()
-  (when (flymake-get-buffer-timer (current-buffer))
-    (cancel-timer (flymake-get-buffer-timer (current-buffer)))
-    (flymake-set-buffer-timer (current-buffer) nil)))
+  (when flymake-timer
+    (cancel-timer flymake-timer)
+    (setq flymake-timer nil)))
 
 (defun flymake-find-file-hook ()
   ;;+(when flymake-start-syntax-check-on-find-file
@@ -1636,9 +1573,9 @@
 (defun flymake-goto-next-error ()
   "Go to next error in err ring."
   (interactive)
-  (let ((line-no (flymake-get-next-err-line-no (flymake-get-buffer-err-info (current-buffer)) (flymake-current-line-no))))
+  (let ((line-no (flymake-get-next-err-line-no flymake-err-info (flymake-current-line-no))))
     (when (not line-no)
-      (setq line-no (flymake-get-first-err-line-no (flymake-get-buffer-err-info (current-buffer))))
+      (setq line-no (flymake-get-first-err-line-no flymake-err-info))
       (flymake-log 1 "passed end of file"))
     (if line-no
 	(flymake-goto-line line-no)
@@ -1647,9 +1584,9 @@
 (defun flymake-goto-prev-error ()
   "Go to prev error in err ring."
   (interactive)
-  (let ((line-no (flymake-get-prev-err-line-no (flymake-get-buffer-err-info (current-buffer)) (flymake-current-line-no))))
+  (let ((line-no (flymake-get-prev-err-line-no flymake-err-info (flymake-current-line-no))))
     (when (not line-no)
-      (setq line-no (flymake-get-last-err-line-no (flymake-get-buffer-err-info (current-buffer))))
+      (setq line-no (flymake-get-last-err-line-no flymake-err-info))
       (flymake-log 1 "passed beginning of file"))
     (if line-no
 	(flymake-goto-line line-no)
@@ -1721,7 +1658,8 @@
 Delete temp file."
   (let* ((temp-source-file-name (flymake-get-buffer-value buffer "temp-source-file-name")))
     (flymake-safe-delete-file temp-source-file-name)
-    (flymake-set-buffer-last-change-time buffer nil)))
+    (with-current-buffer buffer
+      (setq flymake-last-change-time nil))))
 
 (defun flymake-get-real-file-name (buffer file-name-from-err-msg)
   "Translate file name from error message to \"real\" file name.
--- a/lisp/progmodes/gdb-ui.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/progmodes/gdb-ui.el	Mon May 02 14:38:00 2005 +0000
@@ -79,8 +79,11 @@
 (defvar gdb-overlay-arrow-position nil)
 (defvar gdb-server-prefix nil)
 (defvar gdb-flush-pending-output nil)
-(defvar gdb-location-list nil "Alist of breakpoint numbers and full filenames.")
+(defvar gdb-location-alist nil
+  "Alist of breakpoint numbers and full filenames.")
 (defvar gdb-find-file-unhook nil)
+(defvar gdb-active-process nil "GUD tooltips display variable values when t, \
+and #define directives otherwise.")
 
 (defvar gdb-buffer-type nil
   "One of the symbols bound in `gdb-buffer-rules'.")
@@ -281,7 +284,7 @@
   (setq gdb-output-sink 'user)
   (setq gdb-server-prefix "server ")
   (setq gdb-flush-pending-output nil)
-  (setq gdb-location-list nil)
+  (setq gdb-location-alist nil)
   (setq gdb-find-file-unhook nil)
   ;;
   (setq gdb-buffer-type 'gdba)
@@ -301,7 +304,7 @@
   (run-hooks 'gdba-mode-hook))
 
 (defcustom gdb-use-colon-colon-notation nil
-  "If non-nil use FUN::VAR format to display variables in the speedbar." ;
+  "If non-nil use FUN::VAR format to display variables in the speedbar."
   :type 'boolean
   :group 'gud
   :version "22.1")
@@ -430,7 +433,8 @@
 	(let ((varnum (match-string 1)))
 	  (gdb-enqueue-input
 	   (list
-	    (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))
+	    (if (with-current-buffer gud-comint-buffer
+		  (eq gud-minor-mode 'gdba))
 		(concat "server interpreter mi \"-var-evaluate-expression "
 			varnum "\"\n")
 	      (concat "-var-evaluate-expression " varnum "\n"))
@@ -482,7 +486,8 @@
      (list
       (if (with-current-buffer gud-comint-buffer
 	    (eq gud-minor-mode 'gdba))
-	  (concat "server interpreter mi \"-var-assign " varnum " " value "\"\n")
+	  (concat "server interpreter mi \"-var-assign "
+		  varnum " " value "\"\n")
 	(concat "-var-assign " varnum " " value "\n"))
 	   'ignore))))
 
@@ -773,8 +778,8 @@
     ("post-prompt" gdb-post-prompt)
     ("source" gdb-source)
     ("starting" gdb-starting)
-    ("exited" gdb-stopping)
-    ("signalled" gdb-stopping)
+    ("exited" gdb-exited)
+    ("signalled" gdb-exited)
     ("signal" gdb-stopping)
     ("breakpoint" gdb-stopping)
     ("watchpoint" gdb-stopping)
@@ -850,6 +855,7 @@
   "An annotation handler for `starting'.
 This says that I/O for the subprocess is now the program being debugged,
 not GDB."
+  (setq gdb-active-process t)
   (let ((sink gdb-output-sink))
     (cond
      ((eq sink 'user)
@@ -862,7 +868,7 @@
       (error "Unexpected `starting' annotation")))))
 
 (defun gdb-stopping (ignored)
-  "An annotation handler for `exited' and other annotations.
+  "An annotation handler for `breakpoint' and other annotations.
 They say that I/O for the subprocess is now GDB, not the program
 being debugged."
   (if gdb-use-inferior-io-buffer
@@ -874,6 +880,16 @@
 	  (gdb-resync)
 	  (error "Unexpected stopping annotation"))))))
 
+(defun gdb-exited (ignored)
+  "An annotation handler for `exited' and `signalled'.
+They say that I/O for the subprocess is now GDB, not the program
+being debugged and that the program is no longer running. This
+function is used to change the focus of GUD tooltips to #define
+directives."
+  (setq gdb-active-process nil)
+  (gdb-stopping ignored))
+ 
+
 (defun gdb-frame-begin (ignored)
   (let ((sink gdb-output-sink))
     (cond
@@ -981,7 +997,8 @@
 						(match-beginning 0))))
 	    ;;
 	    ;; Everything after, we save, to combine with later input.
-	    (setq gud-marker-acc (substring gud-marker-acc (match-beginning 0))))
+	    (setq gud-marker-acc (substring gud-marker-acc
+					    (match-beginning 0))))
 	;;
 	;; In case we know the gud-marker-acc contains no partial annotations:
 	(progn
@@ -1045,7 +1062,7 @@
 ;; annotation rule binding of whatever gdb sends to tell us this command
 ;; might have changed it's output.
 ;;
-;; NAME is the function name.  DEMAND-PREDICATE tests if output is really needed.
+;; NAME is the function name. DEMAND-PREDICATE tests if output is really needed.
 ;; GDB-COMMAND is a string of such.  OUTPUT-HANDLER is the function bound to the
 ;; input in the input queue (see comment about ``gdb communications'' above).
 
@@ -1077,8 +1094,9 @@
      ;; put customisation here
      (,custom-defun)))
 
-(defmacro def-gdb-auto-updated-buffer (buffer-key trigger-name gdb-command
-						  output-handler-name custom-defun)
+(defmacro def-gdb-auto-updated-buffer (buffer-key
+				       trigger-name gdb-command
+				       output-handler-name custom-defun)
   `(progn
      (def-gdb-auto-update-trigger ,trigger-name
        ;; The demand predicate:
@@ -1225,7 +1243,7 @@
 			 '(mouse-face highlight
 			   help-echo "mouse-2, RET: visit breakpoint"))
 			(unless (file-exists-p file)
-			   (setq file (cdr (assoc bptno gdb-location-list))))
+			   (setq file (cdr (assoc bptno gdb-location-alist))))
 			(unless (string-equal file "File not found")
 			  (if file
 			      (with-current-buffer (find-file-noselect file)
@@ -1233,13 +1251,15 @@
 				     'gdba)
 				(set (make-local-variable 'tool-bar-map)
 				     gud-tool-bar-map)
-				;; only want one breakpoint icon at each location
+				;; only want one breakpoint icon at each
+				;; location
 				(save-excursion
 				  (goto-line (string-to-number line))
 				  (gdb-put-breakpoint-icon (eq flag ?y) bptno)))
 			    (gdb-enqueue-input
-			     (list (concat "list "
-					   (match-string-no-properties 1) ":1\n")
+			     (list
+			      (concat "list "
+				      (match-string-no-properties 1) ":1\n")
 				   'ignore))
 			    (gdb-enqueue-input
 			     (list "info source\n"
@@ -1351,7 +1371,7 @@
     (if (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))
 	    (looking-at "\\([0-9]+\\).*point\\s-*\\S-*\\s-*\\(.\\)")
 	  (looking-at
-      "\\([0-9]+\\)\\s-*\\S-*\\s-*\\S-*\\s-*\\(.\\)\\s-*\\S-*\\s-*\\S-*:[0-9]+"))
+     "\\([0-9]+\\)\\s-*\\S-*\\s-*\\S-*\\s-*\\(.\\)\\s-*\\S-*\\s-*\\S-*:[0-9]+"))
 	(gdb-enqueue-input
 	 (list
 	  (concat gdb-server-prefix
@@ -1383,14 +1403,15 @@
     (if (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))
 	    (looking-at "\\([0-9]+\\) .* in .* at\\s-+\\(\\S-*\\):\\([0-9]+\\)")
 	  (looking-at
- "\\([0-9]+\\)\\s-*\\S-*\\s-*\\S-*\\s-*.\\s-*\\S-*\\s-*\\(\\S-*\\):\\([0-9]+\\)"))
+	   "\\([0-9]+\\)\\s-*\\S-*\\s-*\\S-*\\s-*.\\s-*\\S-*\\s-*\
+\\(\\S-*\\):\\([0-9]+\\)"))
 	(let ((bptno (match-string 1))
 	      (file  (match-string 2))
 	      (line  (match-string 3)))
 	  (save-selected-window
 	    (let* ((buf (find-file-noselect
 			 (if (file-exists-p file) file
-			   (cdr (assoc bptno gdb-location-list)))))
+			   (cdr (assoc bptno gdb-location-alist)))))
 		   (window (display-buffer buf)))
 	      (with-current-buffer buf
 		(goto-line (string-to-number line))
@@ -1481,7 +1502,8 @@
   (interactive (list last-input-event))
   (if event (mouse-set-point event))
   (gdb-enqueue-input
-   (list (concat gdb-server-prefix "frame " (gdb-get-frame-number) "\n") 'ignore))
+   (list (concat gdb-server-prefix "frame "
+		 (gdb-get-frame-number) "\n") 'ignore))
   (gud-display-frame))
 
 
@@ -1987,7 +2009,8 @@
 		:enable gdb-use-inferior-io-buffer))
   (define-key menu [locals] '("Locals" . gdb-display-locals-buffer))
   (define-key menu [frames] '("Stack" . gdb-display-stack-buffer))
-  (define-key menu [breakpoints] '("Breakpoints" . gdb-display-breakpoints-buffer)))
+  (define-key menu [breakpoints]
+    '("Breakpoints" . gdb-display-breakpoints-buffer)))
 
 (let ((menu (make-sparse-keymap "GDB-Frames")))
   (define-key gud-menu-map [frames]
@@ -2002,7 +2025,8 @@
 		:enable gdb-use-inferior-io-buffer))
   (define-key menu [locals] '("Locals" . gdb-frame-locals-buffer))
   (define-key menu [frames] '("Stack" . gdb-frame-stack-buffer))
-  (define-key menu [breakpoints] '("Breakpoints" . gdb-frame-breakpoints-buffer)))
+  (define-key menu [breakpoints]
+    '("Breakpoints" . gdb-frame-breakpoints-buffer)))
 
 (let ((menu (make-sparse-keymap "GDB-UI")))
   (define-key gud-menu-map [ui]
@@ -2129,7 +2153,8 @@
 	      (gdb-remove-breakpoint-icons (point-min) (point-max) t)
 	      (setq gud-minor-mode nil)
 	      (kill-local-variable 'tool-bar-map)
-	      (setq gud-running nil))))))
+	      (setq gud-running nil)
+	      (setq gdb-active-process nil))))))
   (when (markerp gdb-overlay-arrow-position)
     (move-marker gdb-overlay-arrow-position nil)
     (setq gdb-overlay-arrow-position nil))
@@ -2157,9 +2182,9 @@
   (catch 'file-not-found
     (if (search-forward "Located in " nil t)
 	(if (looking-at "\\S-*")
-	    (push (cons bptno (match-string 0)) gdb-location-list))
+	    (push (cons bptno (match-string 0)) gdb-location-alist))
       (gdb-resync)
-      (push (cons bptno "File not found") gdb-location-list)
+      (push (cons bptno "File not found") gdb-location-alist)
       (message-box "Cannot find source file for breakpoint location.\n\
 Add directory to search path for source files using the GDB command, dir.")
       (throw 'file-not-found nil))
@@ -2214,7 +2239,7 @@
   (unless buffer
     (setq buffer (current-buffer)))
   (dolist (overlay (overlays-in start end))
-	(when (overlay-get overlay 'put-break)
+    (when (overlay-get overlay 'put-break)
 	  (delete-overlay overlay))))
 
 (defun gdb-put-breakpoint-icon (enabled bptno)
@@ -2416,7 +2441,8 @@
 		      (setq gdb-input-queue
 			    (delete item gdb-input-queue))))))
 	    (gdb-enqueue-input
-	     (list (concat gdb-server-prefix "disassemble " gdb-current-address "\n")
+	     (list (concat gdb-server-prefix "disassemble "
+			   gdb-current-address "\n")
 		   'gdb-assembler-handler))
 	    (push 'gdb-invalidate-assembler gdb-pending-triggers)
 	    (setq gdb-previous-address gdb-current-address)
--- a/lisp/progmodes/grep.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/progmodes/grep.el	Mon May 02 14:38:00 2005 +0000
@@ -1,7 +1,7 @@
 ;;; grep.el --- run compiler as inferior of Emacs, parse error messages
 
 ;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-;;   2001, 2002, 2004  Free Software Foundation, Inc.
+;;   2001, 2002, 2004, 2005  Free Software Foundation, Inc.
 
 ;; Author: Roland McGrath <roland@gnu.org>
 ;; Maintainer: FSF
@@ -294,7 +294,10 @@
       (2 compilation-line-face))
      ;; Highlight grep matches and delete markers
      ("\\(\033\\[01;41m\\)\\(.*?\\)\\(\033\\[00m\\(\033\\[K\\)?\\)"
-      (2 grep-match-face)
+      ;; Refontification does not work after the markers have been
+      ;; deleted.  So we use the font-lock-face property here as Font
+      ;; Lock does not clear that.
+      (2 (list 'face nil 'font-lock-face grep-match-face))
       ((lambda (p))
        (progn
 	 ;; Delete markers with `replace-match' because it updates
--- a/lisp/progmodes/inf-lisp.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/progmodes/inf-lisp.el	Mon May 02 14:38:00 2005 +0000
@@ -167,7 +167,7 @@
 Inferior Lisp buffer.
 
 This variable is only used if the variable
-`comint-use-prompt-regexp-instead-of-fields' is non-nil.
+`comint-use-prompt-regexp' is non-nil.
 
 More precise choices:
 Lucid Common Lisp: \"^\\\\(>\\\\|\\\\(->\\\\)+\\\\) *\"
--- a/lisp/progmodes/python.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/progmodes/python.el	Mon May 02 14:38:00 2005 +0000
@@ -1680,7 +1680,7 @@
 ;;;; Modes.
 
 (defvar outline-heading-end-regexp)
-(defvar eldoc-print-current-symbol-info-function)
+(defvar eldoc-documentation-function)
 
 ;;;###autoload
 (define-derived-mode python-mode fundamental-mode "Python"
@@ -1740,7 +1740,7 @@
        'python-beginning-of-defun)
   (set (make-local-variable 'end-of-defun-function) 'python-end-of-defun)
   (setq imenu-create-index-function #'python-imenu-create-index)
-  (set (make-local-variable 'eldoc-print-current-symbol-info-function)
+  (set (make-local-variable 'eldoc-documentation-function)
        #'python-eldoc-function)
   (add-hook 'eldoc-mode-hook
 	    '(lambda () (run-python 0 t)) nil t) ; need it running
--- a/lisp/shell.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/shell.el	Mon May 02 14:38:00 2005 +0000
@@ -136,8 +136,9 @@
 This variable is used to initialise `comint-prompt-regexp' in the
 shell buffer.
 
-This variable is only used if the variable
-`comint-use-prompt-regexp-instead-of-fields' is non-nil.
+If `comint-use-prompt-regexp' is nil, then this variable is only used
+to determine paragraph boundaries.  See Info node `Shell Prompts' for
+how Shell mode treats paragraphs.
 
 The pattern should probably not match more than one line.  If it does,
 Shell mode may become confused trying to distinguish prompt from input
@@ -422,6 +423,7 @@
   (setq comint-file-name-chars shell-file-name-chars)
   (setq comint-file-name-quote-list shell-file-name-quote-list)
   (setq comint-dynamic-complete-functions shell-dynamic-complete-functions)
+  (set (make-local-variable 'paragraph-separate) "\\'")
   (make-local-variable 'paragraph-start)
   (setq paragraph-start comint-prompt-regexp)
   (make-local-variable 'font-lock-defaults)
--- a/lisp/simple.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/simple.el	Mon May 02 14:38:00 2005 +0000
@@ -113,7 +113,9 @@
 (defvar next-error-highlight-timer nil)
 
 (defvar next-error-overlay-arrow-position nil)
-(put 'next-error-overlay-arrow-position 'overlay-arrow-string "=>")
+;; This is nil so as not to really display anything on text
+;; terminals.  On text terminals, it would hide part of the file name.
+(put 'next-error-overlay-arrow-position 'overlay-arrow-string "")
 (add-to-list 'overlay-arrow-variable-list 'next-error-overlay-arrow-position)
 
 (defvar next-error-last-buffer nil
@@ -3407,19 +3409,33 @@
 		  (goto-char (next-char-property-change (point))))
 		;; Now move a line.
 		(end-of-line)
-		(and (zerop (vertical-motion 1))
-		     (if (not noerror)
-			 (signal 'end-of-buffer nil)
-		       (setq done t)))
+		;; If there's no invisibility here, move over the newline.
+		(if (not (line-move-invisible-p (point)))
+		    ;; We avoid vertical-motion when possible
+		    ;; because that has to fontify.
+		    (if (eobp)
+			(setq done t)
+		      (forward-line 1))
+		  ;; Otherwise move a more sophisticated way.
+		  ;; (What's the logic behind this code?)
+		  (and (zerop (vertical-motion 1))
+		       (if (not noerror)
+			   (signal 'end-of-buffer nil)
+			 (setq done t))))
 		(unless done
 		  (setq arg (1- arg))))
+	      ;; The logic of this is the same as the loop above, 
+	      ;; it just goes in the other direction.
 	      (while (and (< arg 0) (not done))
 		(beginning-of-line)
-
-		(if (zerop (vertical-motion -1))
-		    (if (not noerror)
-			(signal 'beginning-of-buffer nil)
-		      (setq done t)))
+		(if (not (line-move-invisible-p (1- (point))))
+		    (if (bobp)
+			(setq done t)
+		      (forward-line -1))
+		  (if (zerop (vertical-motion -1))
+		      (if (not noerror)
+			  (signal 'beginning-of-buffer nil)
+			(setq done t))))
 		(unless done
 		  (setq arg (1+ arg))
 		  (while (and ;; Don't move over previous invis lines
--- a/lisp/subr.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/subr.el	Mon May 02 14:38:00 2005 +0000
@@ -349,14 +349,10 @@
 (defvar key-substitution-in-progress nil
  "Used internally by substitute-key-definition.")
 
-(defun substitute-key-definition (olddef newdef keymap &optional oldmap prefix)
-  "Replace OLDDEF with NEWDEF for any keys in KEYMAP now defined as OLDDEF.
-In other words, OLDDEF is replaced with NEWDEF where ever it appears.
-Alternatively, if optional fourth argument OLDMAP is specified, we redefine
-in KEYMAP as NEWDEF those keys which are defined as OLDDEF in OLDMAP.
-
-For most uses, it is simpler and safer to use command remappping like this:
-  \(define-key KEYMAP [remap OLDDEF] NEWDEF)"
+(defun substitute-key-definitions (subst keymap &optional oldmap prefix)
+  "Applies the SUBST remapping to key bindings in KEYMAP.
+SUBST will be a list of elements of the form (OLDDEF . NEWDEF).
+See `substitue-key-definition'."
   ;; Don't document PREFIX in the doc string because we don't want to
   ;; advertise it.  It's meant for recursive calls only.  Here's its
   ;; meaning
@@ -374,11 +370,28 @@
     (map-keymap
      (lambda (char defn)
        (aset prefix1 (length prefix) char)
-       (substitute-key-definition-key defn olddef newdef prefix1 keymap))
+       (substitute-key-definitions-key defn subst prefix1 keymap))
      scan)))
 
-(defun substitute-key-definition-key (defn olddef newdef prefix keymap)
-  (let (inner-def skipped menu-item)
+(defun substitute-key-definition (olddef newdef keymap &optional oldmap prefix)
+  "Replace OLDDEF with NEWDEF for any keys in KEYMAP now defined as OLDDEF.
+In other words, OLDDEF is replaced with NEWDEF where ever it appears.
+Alternatively, if optional fourth argument OLDMAP is specified, we redefine
+in KEYMAP as NEWDEF those keys which are defined as OLDDEF in OLDMAP.
+
+For most uses, it is simpler and safer to use command remappping like this:
+  \(define-key KEYMAP [remap OLDDEF] NEWDEF)"
+  ;; Don't document PREFIX in the doc string because we don't want to
+  ;; advertise it.  It's meant for recursive calls only.  Here's its
+  ;; meaning
+
+  ;; If optional argument PREFIX is specified, it should be a key
+  ;; prefix, a string.  Redefined bindings will then be bound to the
+  ;; original key, with PREFIX added at the front.
+  (substitute-key-definitions (list (cons olddef newdef)) keymap oldmap prefix))
+
+(defun substitute-key-definitions-key (defn subst prefix keymap)
+  (let (inner-def skipped menu-item mapping)
     ;; Find the actual command name within the binding.
     (if (eq (car-safe defn) 'menu-item)
 	(setq menu-item defn defn (nth 2 defn))
@@ -388,17 +401,17 @@
       ;; Skip past cached key-equivalence data for menu items.
       (if (consp (car-safe defn))
 	  (setq defn (cdr defn))))
-    (if (or (eq defn olddef)
+    (if (or (setq mapping (assq defn subst))
 	    ;; Compare with equal if definition is a key sequence.
 	    ;; That is useful for operating on function-key-map.
 	    (and (or (stringp defn) (vectorp defn))
-		 (equal defn olddef)))
+		 (setq mapping (assoc defn subst))))
 	(define-key keymap prefix
 	  (if menu-item
 	      (let ((copy (copy-sequence menu-item)))
-		(setcar (nthcdr 2 copy) newdef)
+		(setcar (nthcdr 2 copy) (cdr mapping))
 		copy)
-	    (nconc (nreverse skipped) newdef)))
+	    (nconc (nreverse skipped) (cdr mapping))))
       ;; Look past a symbol that names a keymap.
       (setq inner-def
 	    (and defn
@@ -414,7 +427,7 @@
 	       ;; Avoid recursively rescanning keymap being scanned.
 	       (not (memq inner-def key-substitution-in-progress)))
 	  ;; If this one isn't being scanned already, scan it now.
-	  (substitute-key-definition olddef newdef keymap inner-def prefix)))))
+	  (substitute-key-definitions subst keymap inner-def prefix)))))
 
 (defun define-key-after (keymap key definition &optional after)
   "Add binding in KEYMAP for KEY => DEFINITION, right after AFTER's binding.
@@ -843,7 +856,7 @@
 
 ;;; Should this be an obsolete name?  If you decide it should, you get
 ;;; to go through all the sources and change them.
-(defalias 'string-to-int 'string-to-number)
+(define-obsolete-function-alias 'string-to-int 'string-to-number)
 
 ;;;; Hook manipulation functions.
 
--- a/lisp/textmodes/org.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/textmodes/org.el	Mon May 02 14:38:00 2005 +0000
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <dominik at science dot uva dot nl>
 ;; Keywords: outlines, hypermedia, calendar
 ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/
-;; Version: 3.06
+;; Version: 3.08
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -79,6 +79,16 @@
 ;;
 ;; Changes:
 ;; -------
+;; Version 3.08
+;;    - "|" no longer allowed as part of a link, to allow links in tables.
+;;    - The prefix of items in the agenda buffer can be configured.
+;;    - Cleanup.
+;;
+;; Version 3.07
+;;    - Some folding incinsistencies removed.
+;;    - BBDB links to company-only entries.
+;;    - Bug fixes and global cleanup.
+;;
 ;; Version 3.06
 ;;    - M-S-RET inserts a new TODO heading.
 ;;    - New startup option `content'.
@@ -131,14 +141,14 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl) (require 'calendar))
 (require 'outline)
 (require 'time-date)
 (require 'easymenu)
 
 ;;; Customization variables
 
-(defvar org-version "3.06"
+(defvar org-version "3.08"
   "The version number of the file org.el.")
 (defun org-version ()
   (interactive)
@@ -194,8 +204,7 @@
 the following lines anywhere in the buffer:
 
    #+STARTUP: dlcheck
-   #+STARTUP: nodlcheck
-"
+   #+STARTUP: nodlcheck"
   :group 'org-startup
   :type 'boolean)
 
@@ -215,8 +224,8 @@
   :group 'org)
 
 (defcustom org-todo-keywords '("TODO" "DONE")
-  "List of TODO entry keywords.\\<org-mode-map>
-By default, this is '(\"TODO\" \"DONE\").  The last entry in the list is
+  "List of TODO entry keywords.
+\\<org-mode-map>By default, this is '(\"TODO\" \"DONE\").  The last entry in the list is
 considered to mean that the entry is \"done\".  All the other mean that
 action is required, and will make the entry show up in todo lists, diaries
 etc.
@@ -228,8 +237,8 @@
   :type '(repeat (string :tag "Keyword")))
 
 (defcustom org-todo-interpretation 'sequence
-  "Controls how TODO keywords are interpreted.\\<org-mode-map>
-Possible values are `sequence' and `type'.
+  "Controls how TODO keywords are interpreted.
+\\<org-mode-map>Possible values are `sequence' and `type'.
 This variable is only relevant if `org-todo-keywords' contains more than two
 states.  There are two ways how these keywords can be used:
 
@@ -256,7 +265,7 @@
 RELAXED will not be changed REMIND, but directly to DONE.
 
 You can create a large number of types.  To initially select a
-type, it is then best to use C-u \\[org-todo] in order to specify the
+type, it is then best to use \\[universal-argument] \\[org-todo] in order to specify the
 type with completion.  Of course, you can also type the keyword
 directly into the buffer.  M-TAB completes TODO keywords at the
 beginning of a headline."
@@ -304,7 +313,7 @@
 (defcustom org-after-todo-state-change-hook nil
   "Hook which is run after the state of a TODO item was changed.
 The new state (a string with a todo keyword, or nil) is available in the
-lisp variable `state'."
+Lisp variable `state'."
   :group 'org-keywords
   :type 'hook)
 
@@ -313,7 +322,7 @@
   "Do TODO items have priorities?")
 (make-variable-buffer-local 'org-todo-kwd-priority-p)
 (defvar org-todo-kwd-max-priority nil
-  "Maximum priority of TODO items")
+  "Maximum priority of TODO items.")
 (make-variable-buffer-local 'org-todo-kwd-max-priority)
 (defvar org-ds-keyword-length 12
   "Maximum length of the Deadline and SCHEDULED keywords.")
@@ -352,6 +361,15 @@
   "Matches the SCHEDULED keyword together with a time stamp.")
 (make-variable-buffer-local 'org-scheduled-time-regexp)
 
+(defvar org-category nil
+  "Variable used by org files to set a category for agenda display.
+Such files should use a file variable to set it, for example
+
+   -*- mode: org; org-category: \"ELisp\"
+
+If the file does not specify a category, the file's base name
+is used instead.")
+
 (defun org-set-regexps-and-options ()
   "Precompute regular expressions for current buffer."
   (when (eq major-mode 'org-mode)
@@ -359,8 +377,8 @@
                '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" "STARTUP")))
           (splitre "[ \t]+")
           kwds int key value cat)
-      (save-restriction
-        (save-excursion
+      (save-excursion
+        (save-restriction
           (widen)
           (goto-char (point-min))
           (while (re-search-forward re nil t)
@@ -383,7 +401,7 @@
               (let ((opts (org-split-string value splitre))
                     (set '(("fold" org-startup-folded t)
                            ("nofold" org-startup-folded nil)
-                           ("content" org-startup-folded 'content)
+                           ("content" org-startup-folded content)
                            ("dlcheck" org-startup-with-deadline-check t)
                            ("nodlcheck" org-startup-with-deadline-check nil)))
                     l var val)
@@ -515,8 +533,7 @@
   :type 'boolean)
 
 (defcustom org-agenda-include-diary nil
-  "Non-nil means, when preparing the agenda, also get the
-entries from the emacs calendars diary."
+  "If non-nil, include in the agenda entries from the Emacs Calendar's diary."
   :group 'org-agenda
   :type 'boolean)
 
@@ -566,6 +583,43 @@
            (const priority-up)
            (const priority-down))))
 
+(defcustom org-agenda-prefix-format "  %-12:c% s"
+  "Format specification for the prefix of items in the agenda buffer.
+This format works similar to a printf format, with the following meaning:
+
+  %c   the category of the item, \"Diary\" for entries from the diary, or
+       as given by the CATEGORY keyword or derived from the file name.
+  %t   the time-of-day specification if one applies to the entry, in the
+       format HH:MM
+  %s   Scheduling/Deadline information, a short string
+
+In addition to the normal printf field modifiers like field width and
+padding instructions, in this format you can also add an additional
+punctuation or whitespace character just before the final format letter.
+This character will be appended to the field value if the value is not
+empty.  For example, the format \"%-12:c\" leads to \"Diary:    \" if
+the category is \"Diary\".  If the category were be empty, no additional
+colon would be interted.
+
+Including `%t' in the format string leads to a double time specification
+because the headline/diary item will contain the time specification as
+well.  However, using `%t' in the format will result in a canonical 24
+hour time specification at a consistent position in the prefix, while the
+time specification in the headline/diary item may be at any position and in
+various formats.
+Example:
+  (setq org-agenda-prefix-format \"  %-12:c% t% s\")"
+  :type 'string
+  :group 'org-agenda)
+
+(defcustom org-timeline-prefix-format "  % s"
+  "Like `org-agenda-prefix-format', but for the timeline of a single file."
+  :type 'string
+  :group 'org-agenda)
+
+(defvar org-prefix-format-compiled nil
+  "The compiled version of `org-???-prefix-format'.")
+
 (defcustom org-sort-agenda-notime-is-late t
   "Non-nil means, items without time are considered late.
 This is only relevant for sorting.  When t, items which have no explicit
@@ -574,15 +628,6 @@
   :group 'org-agenda
   :type 'boolean)
 
-(defvar org-category nil
-  "Variable used by org files to set a category for agenda display.
-Such files should use a file variable to set it, for example
-
-   -*- mode: org; org-category: \"ELisp\"
-
-If the file does not specify a category, the file's base name
-is used instead.")
-
 (defgroup org-structure nil
   "Options concerning structure editing in Org-mode."
   :tag "Org Structure"
@@ -647,7 +692,10 @@
 
 (defcustom org-allow-space-in-links t
   "Non-nil means, file names in links may contain space characters.
-When nil, it becomes possible to put several links into a line."
+When nil, it becomes possible to put several links into a line.
+Note that in tables, a link never extends accross fields, so in a table
+it is always possible to put several links into a line.
+Changing this varable requires a re-launch of Emacs of become effective."
   :group 'org-link
   :type 'boolean)
 
@@ -667,7 +715,7 @@
 location to an internal list. These links accumulate during a session.
 The command `org-insert-link' can be used to insert links into any
 Org-mode file (offering completion for all stored links).  When this
-option is nil, every link which has been inserted once using `C-c C-l'
+option is nil, every link which has been inserted once using \\[org-insert-link]
 will be removed from the list, to make completing the unused links
 more efficient."
   :group 'org-link
@@ -682,15 +730,15 @@
 this link in another window or frame.  This variable can be used to
 set this up for the different types of links.
 For VM, use any of
-    vm-visit-folder
-    vm-visit-folder-other-frame
+    `vm-visit-folder'
+    `vm-visit-folder-other-frame'
 For Gnus, use any of
-    gnus
-    gnus-other-frame
+    `gnus'
+    `gnus-other-frame'
 For FILE, use any of
-    find-file
-    find-file-other-window
-    find-file-other-frame
+    `find-file'
+    `find-file-other-window'
+    `find-file-other-frame'
 For the calendar, use the variable `calendar-setup'.
 For BBDB, it is currently only possible to display the matches in
 another window."
@@ -792,10 +840,10 @@
 and the corresponding command.  Possible values for the command are:
  `emacs'     The file will be visited by the current Emacs process.
  `default'   Use the default application for this file type.
- string      A command to be executed by a shell. %s will be replaced
+ string      A command to be executed by a shell; %s will be replaced
              by the path to the file.
- sexp        A lisp form which will be evaluated.  The file path will
-             be available in the lisp variable `file'.
+ sexp        A Lisp form which will be evaluated.  The file path will
+             be available in the Lisp variable `file'.
 For more examples, see the system specific constants
 `org-file-apps-defaults-macosx'
 `org-file-apps-defaults-windowsnt'
@@ -1076,7 +1124,7 @@
   :type 'boolean)
 
 (defcustom org-export-with-tables t
-  "Non-nil means, lines starting with \"|\" define a table
+  "If non-nil, lines starting with \"|\" define a table
 For example:
 
   | Name        | Address  | Birthday  |
@@ -1150,7 +1198,7 @@
   :type 'boolean)
 
 (defcustom org-export-html-with-timestamp nil
-  "Non-nil means,  write `org-export-html-html-helper-timestamp'
+  "If non-nil, write `org-export-html-html-helper-timestamp'
 into the exported html text.  Otherwise, the buffer will just be saved
 to a file."
   :group 'org-export
@@ -1348,6 +1396,7 @@
   (defvar org-cursor-color)
   (defvar org-time-was-given)
   (defvar org-ts-what)
+  (defvar mark-active)
   (defvar timecnt)
   (defvar levels-open)
   (defvar title)
@@ -1383,6 +1432,17 @@
 (defvar org-struct-menu)
 (defvar org-org-menu)
 
+;; We use a before-change function to check if a table might need
+;; an update.
+(defvar org-table-may-need-update t
+  "Indicates of a table might need an update.
+This variable is set by `org-before-change-function'. `org-table-align'
+sets it back to nil.")
+
+(defvar org-mode-hook nil)
+(defvar org-inhibit-startup nil)        ; Dynamically-scoped param.
+
+
 ;;;###autoload
 (defun org-mode (&optional arg)
   "Outline-based notes management and organizer, alias 
@@ -1437,14 +1497,15 @@
         (goto-char (point-min))
         (insert "    -*- mode: org -*-\n\n")))
   (run-hooks 'org-mode-hook)
-  (unless (boundp 'org-inhibit-startup)
+  (unless org-inhibit-startup
     (if org-startup-with-deadline-check
         (call-interactively 'org-check-deadlines)
       (cond
        ((eq org-startup-folded t)
-        (org-cycle))
-       ((eq org-startup-folded 'contents)
-        (org-cycle) (org-cycle))))))
+        (org-cycle '(4)))
+       ((eq org-startup-folded 'content)
+        (let ((this-command 'org-cycle) (last-command 'org-cycle))
+          (org-cycle '(4)) (org-cycle '(4))))))))
 
 ;;; Font-Lock stuff
 
@@ -1456,10 +1517,13 @@
 
 (require 'font-lock)
 
+(defconst org-non-link-chars "\t\n\r|")
 (defconst org-link-regexp
   (if org-allow-space-in-links
-      "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^\t\n\r]+[^ \t\n\r]\\)"
-    "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^ \t\n\r]+\\)"
+      (concat
+       "\\(https?\\|ftp\\|mailto|\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^" org-non-link-chars "]+[^ " org-non-link-chars "]\\)")
+    (concat
+     "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^ " org-non-link-chars "]+\\)")
     )
   "Regular expression for matching links.")
 (defconst org-ts-lengths
@@ -1502,6 +1566,8 @@
     (org-back-to-heading t)
     (- (match-end 0) (match-beginning 0))))
 
+(defvar org-font-lock-keywords nil)
+
 (defun org-set-font-lock-defaults ()
   (let ((org-font-lock-extra-keywords
          (list
@@ -1550,13 +1616,10 @@
          '(org-font-lock-keywords t nil nil backward-paragraph))
     (kill-local-variable 'font-lock-keywords) nil))
     
-(defvar org-font-lock-keywords nil)
-
 (defun org-unfontify-region (beg end &optional maybe_loudly)
   "Remove fontification and activation overlays from links."
   (font-lock-default-unfontify-region beg end)
-  (let* ((modified (buffer-modified-p)) ;; FIXME: Why did I add this???
-         (buffer-undo-list t)
+  (let* ((buffer-undo-list t)
          (inhibit-read-only t) (inhibit-point-motion-hooks t)
          (inhibit-modification-hooks t)
          deactivate-mark buffer-file-name buffer-file-truename)
@@ -1651,15 +1714,15 @@
     (save-excursion
       (org-back-to-heading)
       (outline-up-heading arg)
-      (show-subtree)))
+      (org-show-subtree)))
 
    ((save-excursion (beginning-of-line 1) (looking-at outline-regexp))
     ;; At a heading: rotate between three different views
     (org-back-to-heading)
-    (let ((goal-column 0) beg eoh eol eos nxh)
+    (let ((goal-column 0) eoh eol eos)
       ;; First, some boundaries
       (save-excursion
-	(org-back-to-heading)  (setq beg (point))
+	(org-back-to-heading)
 	(save-excursion
 	  (beginning-of-line 2)
 	  (while (and (not (eobp))   ;; this is like `next-line'
@@ -1667,7 +1730,7 @@
 	    (beginning-of-line 2)) (setq eol (point)))
 	(outline-end-of-heading)   (setq eoh (point))
 	(outline-end-of-subtree)   (setq eos (point))
-        (outline-next-heading)     (setq nxh (point)))
+        (outline-next-heading))
       ;; Find out what to do next and set `this-command'
       (cond
        ((= eos eoh)
@@ -1676,7 +1739,7 @@
         (setq org-cycle-subtree-status nil))
        ((>= eol eos)
 	;; Entire subtree is hidden in one line: open it
-	(show-entry)
+	(org-show-entry)
 	(show-children)
 	(message "CHILDREN")
 	(setq org-cycle-subtree-status 'children)
@@ -1684,7 +1747,7 @@
        ((and (eq last-command this-command)
 	     (eq org-cycle-subtree-status 'children))
 	;; We just showed the children, now show everything.
-	(show-subtree)
+	(org-show-subtree)
 	(message "SUBTREE")
 	(setq org-cycle-subtree-status 'subtree)
         (run-hook-with-args 'org-cycle-hook 'subtree))
@@ -1733,9 +1796,9 @@
   "Move cursor to the first headline and recenter the headline.
 Optional argument N means, put the headline into the Nth line of the window."
   (goto-char (point-min))
-  (re-search-forward (concat "^" outline-regexp))
-  (beginning-of-line)
-  (recenter (prefix-numeric-value N)))
+  (when (re-search-forward (concat "^" outline-regexp) nil t)
+    (beginning-of-line)
+    (recenter (prefix-numeric-value N))))
 
 (defvar org-goto-window-configuration nil)
 (defvar org-goto-marker nil)
@@ -1836,9 +1899,9 @@
         current-prefix-arg arg)
   (throw 'exit nil))
 
-(defun org-goto-left (&optional arg)
+(defun org-goto-left ()
   "Finish org-goto by going to the new location."
-  (interactive "P")
+  (interactive)
   (if (org-on-heading-p)
       (progn
         (beginning-of-line 1)
@@ -1847,9 +1910,9 @@
         (throw 'exit nil))
     (error "Not on a heading")))
 
-(defun org-goto-right (&optional arg)
+(defun org-goto-right ()
   "Finish org-goto by going to the new location."
-  (interactive "P")
+  (interactive)
   (if (org-on-heading-p)
       (progn
         (outline-end-of-subtree)
@@ -1870,9 +1933,9 @@
 (defvar org-ignore-region nil
   "To temporarily disable the active region.")
 
-(defun org-insert-heading (&optional arg)
+(defun org-insert-heading ()
   "Insert a new heading with same depth at point."
-  (interactive "P")
+  (interactive)
   (let* ((head (save-excursion
 		 (condition-case nil
 		     (org-back-to-heading)
@@ -1903,34 +1966,36 @@
       (insert (car org-todo-keywords) " ")
     (insert (match-string 2) " ")))
 
-(defun org-promote-subtree (&optional arg)
+(defun org-promote-subtree ()
   "Promote the entire subtree.
 See also `org-promote'."
-  (interactive "P")
-  (org-map-tree 'org-promote))
-
-(defun org-demote-subtree (&optional arg)
+  (interactive)
+  (save-excursion
+    (org-map-tree 'org-promote)))
+
+(defun org-demote-subtree ()
   "Demote the entire subtree.  See `org-demote'.
 See also `org-promote'."
-  (interactive "P")
-  (org-map-tree 'org-demote))
-
-(defun org-do-promote (&optional arg)
+  (interactive)
+  (save-excursion
+    (org-map-tree 'org-demote)))
+
+(defun org-do-promote ()
   "Promote the current heading higher up the tree.
-If the region is active in transient-mark-mode, promote all headings
+If the region is active in t`ransient-mark-mode', promote all headings
 in the region."
-  (interactive "P")
+  (interactive)
   (save-excursion
     (if (org-region-active-p)
         (org-map-region 'org-promote (region-beginning) (region-end))
       (org-promote)))
   (org-fix-position-after-promote))
 
-(defun org-do-demote (&optional arg)
+(defun org-do-demote ()
   "Demote the current heading lower down the tree.
-If the region is active in transient-mark-mode, demote all headings
+If the region is active in `transient-mark-mode', demote all headings
 in the region."
-  (interactive "P")
+  (interactive)
   (save-excursion
     (if (org-region-active-p)
         (org-map-region 'org-demote (region-beginning) (region-end))
@@ -1945,7 +2010,7 @@
 
 (defun org-promote ()
   "Promote the current heading higher up the tree.
-If the region is active in transient-mark-mode, promote all headings
+If the region is active in `transient-mark-mode', promote all headings
 in the region."
   (org-back-to-heading t)
   (let* ((level (save-match-data (funcall outline-level)))
@@ -1957,7 +2022,7 @@
 
 (defun org-demote ()
   "Demote the current heading lower down the tree.
-If the region is active in transient-mark-mode, demote all headings
+If the region is active in `transient-mark-mode', demote all headings
 in the region."
   (org-back-to-heading t)
   (let* ((level (save-match-data (funcall outline-level)))
@@ -2066,17 +2131,17 @@
   "Was the last copied subtree folded?
 This is used to fold the tree back after pasting.")
 
-(defun org-cut-subtree (&optional arg)
+(defun org-cut-subtree ()
   "Cut the current subtree into the clipboard.
 This is a short-hand for marking the subtree and then cutting it."
-  (interactive "p")
-  (org-copy-subtree arg 'cut))
-
-(defun org-copy-subtree (&optional arg cut)
+  (interactive)
+  (org-copy-subtree 'cut))
+
+(defun org-copy-subtree (&optional cut)
   "Cut the current subtree into the clipboard.
 This is a short-hand for marking the subtree and then copying it.
 If CUT is non nil, actually cut the subtree."
-  (interactive "p")
+  (interactive)
   (let (beg end folded)
     (org-back-to-heading)
     (setq beg (point))
@@ -2338,7 +2403,7 @@
   ;; Fixup cursor location if close to the keyword
   (if (and (outline-on-heading-p)
            (not (bolp))
-           (save-excursion (goto-char (point-at-bol))
+           (save-excursion (beginning-of-line 1)
                            (looking-at org-todo-line-regexp))
            (< (point) (+ 2 (or (match-end 2) (match-end 1)))))
       (progn
@@ -2681,7 +2746,7 @@
 A deadline is considered due if it happens within `org-deadline-warning-days'
 days from today's date.  If the deadline appears in an entry marked DONE,
 it is not shown.  The prefix arg NDAYS can be used to test that many
-days.  If the prefix is a raw C-u prefix, all deadlines are shown."
+days.  If the prefix is a raw \\[universal-argument] prefix, all deadlines are shown."
   (interactive "P")
   (let* ((org-warn-days
           (cond
@@ -2718,6 +2783,7 @@
         (error "Not at a time-stamp range, and none found in current line.")))
   (let* ((ts1 (match-string 1))
          (ts2 (match-string 2))
+         (havetime (or (> (length ts1) 15) (> (length ts2) 15)))
          (match-end (match-end 0))
          (time1 (org-time-string-to-time ts1))
          (time2 (org-time-string-to-time ts2))
@@ -2725,17 +2791,27 @@
          (t2 (time-to-seconds time2))
          (diff (abs (- t2 t1)))
          (negative (< (- t2 t1) 0))
-         (ys (floor (* 365 24 60 60)))
+         ;; (ys (floor (* 365 24 60 60)))
          (ds (* 24 60 60))
          (hs (* 60 60))
          (fy "%dy %dd %02d:%02d")
+         (fy1 "%dy %dd")
          (fd "%dd %02d:%02d")
+         (fd1 "%dd")
          (fh "%02d:%02d")
          y d h m align)
-    (setq y (floor (/ diff ys))  diff (mod diff ys)
-          d (floor (/ diff ds))  diff (mod diff ds)
-          h (floor (/ diff hs))  diff (mod diff hs)
-          m (floor (/ diff 60)))
+    ;; FIXME:  Should I re-introduce years, make year refer to same date?
+    ;; This would be the only useful way to have years, actually.
+    (if havetime
+        (setq ; y (floor (/ diff ys))  diff (mod diff ys)
+         y 0
+         d (floor (/ diff ds))  diff (mod diff ds)
+         h (floor (/ diff hs))  diff (mod diff hs)
+         m (floor (/ diff 60)))
+      (setq ; y (floor (/ diff ys))  diff (mod diff ys)
+       y 0
+       d (floor (+ (/ diff ds) 0.5))
+       h 0 m 0))
     (if (not to-buffer)
         (message (org-make-tdiff-string y d h m))
       (when (org-at-table-p)
@@ -2746,8 +2822,8 @@
            "\\( *-? *[0-9]+y\\)?\\( *[0-9]+d\\)? *[0-9][0-9]:[0-9][0-9]")
           (replace-match ""))
       (if negative (insert " -"))
-      (if (> y 0) (insert " " (format fy y d h m))
-        (if (> d 0) (insert " " (format fd d h m))
+      (if (> y 0) (insert " " (format (if havetime fy fy1) y d h m))
+        (if (> d 0) (insert " " (format (if havetime fd fd1) d h m))
           (insert " " (format fh h m))))
       (if align (org-table-align))
       (message "Time difference inserted"))))
@@ -2770,7 +2846,7 @@
 
 (defun org-parse-time-string (s)
   "Parse the standard Org-mode time string.
-This should be a lot faster than the normal parse-time-string."
+This should be a lot faster than the normal `parse-time-string'."
   (if (string-match org-ts-regexp1 s)
       (list 0
             (string-to-number (or (match-string 8 s) "0"))
@@ -2927,7 +3003,7 @@
 ;;; Define the mode
 
 (defvar org-agenda-mode-map (make-sparse-keymap)
-  "Keymap for org-agenda-mode.")
+  "Keymap for `org-agenda-mode'.")
 
 (defvar org-agenda-menu)
 (defvar org-agenda-follow-mode nil)
@@ -2949,6 +3025,7 @@
   (easy-menu-add org-agenda-menu)
   (if org-startup-truncated (setq truncate-lines t))
   (add-hook 'post-command-hook 'org-agenda-post-command-hook nil 'local)
+  (add-hook 'pre-command-hook 'org-unhighlight nil 'local)
   (setq org-agenda-follow-mode nil)
   (easy-menu-change 
    '("Agenda") "Agenda Files"
@@ -2968,7 +3045,7 @@
 (define-key org-agenda-mode-map "l" 'org-agenda-recenter)
 (define-key org-agenda-mode-map "t" 'org-agenda-todo)
 (define-key org-agenda-mode-map "." 'org-agenda-goto-today)
-(define-key org-agenda-mode-map "w" 'org-agenda-week-view)
+(define-key org-agenda-mode-map "w" 'org-agenda-toggle-week-view)
 (define-key org-agenda-mode-map [(shift right)] 'org-agenda-date-later)
 (define-key org-agenda-mode-map [(shift left)] 'org-agenda-date-earlier)
 
@@ -3043,7 +3120,8 @@
     ["Next Dates" org-agenda-later (local-variable-p 'starting-day)]
     ["Previous Dates" org-agenda-earlier (local-variable-p 'starting-day)]
     "--"
-    ["Week/Day View" org-agenda-week-view (local-variable-p 'starting-day)]
+    ["Week/Day View" org-agenda-toggle-week-view
+     (local-variable-p 'starting-day)]
     ["Include Diary" org-agenda-toggle-diary
      :style toggle :selected org-agenda-include-diary :active t]
     "--"
@@ -3060,7 +3138,7 @@
     ))
 
 (defvar org-agenda-markers nil
-  "List of all currently active markers created by org-agenda")
+  "List of all currently active markers created by `org-agenda'.")
 (defvar org-agenda-last-marker-time (time-to-seconds (current-time))
   "Creation time of the last agenda marker.")
 
@@ -3074,7 +3152,7 @@
     m))
 
 (defun org-agenda-maybe-reset-markers (&optional force)
-  "Reset markers created by org-agenda.  But only if they are old enough."
+  "Reset markers created by `org-agenda'.  But only if they are old enough."
   (if (or force
           (> (- (time-to-seconds (current-time))
                 org-agenda-last-marker-time)
@@ -3106,21 +3184,23 @@
       (when (and (buffer-modified-p buf)
                  file
                  (y-or-n-p (format "Save file %s? " file)))
-        (save-excursion
-          (set-buffer buf) (save-buffer)))
+        (with-current-buffer buf (save-buffer)))
       (kill-buffer buf))))
 
+(defvar org-respect-restriction nil)    ; Dynamically-scoped param.
+
 (defun org-timeline (&optional include-all)
   "Show a time-sorted view of the entries in the current org file.
 Only entries with a time stamp of today or later will be listed.  With
-one C-u prefix argument, past entries will also be listed.
-With two C-u prefixes, all unfinished TODO items will also be shown,
+one \\[universal-argument] prefix argument, past entries will also be listed.
+With two \\[universal-argument] prefixes, all unfinished TODO items will also be shown,
 under the current date.
 If the buffer contains an active region, only check the region for
 dates."
   (interactive "P")
   (require 'calendar)
   (org-agenda-maybe-reset-markers 'force)
+  (org-compile-prefix-format org-timeline-prefix-format)
   (let* ((dopast include-all)
          (dotodo (equal include-all '(16)))
          (entry (buffer-file-name))
@@ -3135,7 +3215,7 @@
          (today (time-to-days (current-time)))
          (org-respect-restriction t)
          (past t)
-         s e rtn d pos)
+         s e rtn d)
     (setq org-agenda-redo-command 
           (list 'progn
                 (list 'switch-to-buffer-other-window (current-buffer))
@@ -3188,13 +3268,14 @@
   "Produce a weekly view from all files in variable `org-agenda-files'.
 The view will be for the current week, but from the overview buffer you
 will be able to go to other weeks.
-With one C-u prefix argument INCLUDE-ALL, all unfinished TODO items will
+With one \\[universal-argument] prefix argument INCLUDE-ALL, all unfinished TODO items will
 also be shown, under the current date.
 START-DAY defaults to TODAY, or to the most recent match for the weekday
 given in `org-agenda-start-on-weekday'.
 NDAYS defaults to `org-agenda-ndays'."
   (interactive "P")
   (org-agenda-maybe-reset-markers 'force)
+  (org-compile-prefix-format org-agenda-prefix-format)
   (require 'calendar)
   (let* ((org-agenda-start-on-weekday
           (if (or (equal ndays 1)
@@ -3306,31 +3387,31 @@
         (throw 'nextfile t))
        (t (error "Abort"))))))
 
-(defun org-agenda-quit (arg)
+(defun org-agenda-quit ()
   "Exit agenda by removing the window or the buffer."
-  (interactive "P")
+  (interactive)
   (let ((buf (current-buffer)))
     (if (not (one-window-p)) (delete-window))
     (kill-buffer buf)
     (org-agenda-maybe-reset-markers 'force)))
 
-(defun org-agenda-exit (arg)
+(defun org-agenda-exit ()
   "Exit agenda by removing the window or the buffer.
 Also kill all Org-mode buffers which have been loaded by `org-agenda'.
 Org-mode buffers visited directly by the user will not be touched."
-  (interactive "P")
+  (interactive)
   (org-release-buffers org-agenda-new-buffers)
   (setq org-agenda-new-buffers nil)
-  (org-agenda-quit arg))
-
-(defun org-agenda-redo (&optional arg)
-  "Rebuild Agenda"
-  (interactive "P")
+  (org-agenda-quit))
+
+(defun org-agenda-redo ()
+  "Rebuild Agenda."
+  (interactive)
   (eval org-agenda-redo-command))
 
-(defun org-agenda-goto-today (arg)
+(defun org-agenda-goto-today ()
   "Go to today."
-  (interactive "P")
+  (interactive)
   (if (boundp 'starting-day)
       (let ((cmd (car org-agenda-redo-command))
             (iall (nth 1 org-agenda-redo-command))
@@ -3357,17 +3438,9 @@
   (org-agenda (if (boundp 'include-all-loc) include-all-loc nil)
               (- starting-day (* arg org-agenda-ndays))))
 
-(defun org-agenda-day-view (arg)
-  "Switch agenda to single day view."
-  (interactive "P")
-  (unless (boundp 'starting-day)
-    (error "Not allowed"))
-  (setq org-agenda-ndays 1)
-  (org-agenda include-all-loc starting-day 1))
-
-(defun org-agenda-week-view (arg)
-  "Switch agenda to week view."
-  (interactive "P")
+(defun org-agenda-toggle-week-view ()
+  "Toggle weekly/daily view for aagenda."
+  (interactive)
   (unless (boundp 'starting-day)
     (error "Not allowed"))
   (setq org-agenda-ndays
@@ -3397,6 +3470,21 @@
   (if (not (re-search-backward "^\\S-" nil t arg))
       (error "No previous date before this line in this buffer.")))
 
+;; Initialize the highlight
+(defvar org-hl (funcall (if org-xemacs-p 'make-extent 'make-overlay) 1 1))
+(funcall (if org-xemacs-p 'set-extent-property 'overlay-put) org-hl
+         'face 'highlight)
+
+(defun org-highlight (begin end &optional buffer)
+  "Highlight a region with overlay."
+  (funcall (if org-xemacs-p 'set-extent-endpoints 'move-overlay)
+           org-hl begin end (or buffer (current-buffer))))
+
+(defun org-unhighlight ()
+  "Detach overlay INDEX."
+  (funcall (if org-xemacs-p 'detach-extent 'delete-overlay) org-hl))
+
+
 (defun org-agenda-follow-mode ()
   "Toggle follow mode in an agenda buffer."
   (interactive)
@@ -3430,21 +3518,22 @@
            (get-text-property (point) 'org-marker))
       (org-agenda-show)))
 
+(defvar org-disable-diary nil)          ;Dynamically-scoped param.
+
 (defun org-get-entries-from-diary (date)
-  "Get the (emacs calendar) diary entries for DATE."
+  "Get the (Emacs Calendar) diary entries for DATE."
   (let* ((fancy-diary-buffer "*temporary-fancy-diary-buffer*")
          (diary-display-hook '(fancy-diary-display))
          (list-diary-entries-hook 
           (cons 'org-diary-default-entry list-diary-entries-hook))
-         entries
-         (disable-org-diary t))
+         entries tod tods
+         (org-disable-diary t))
     (save-excursion
       (save-window-excursion
         (list-diary-entries date 1)))
     (if (not (get-buffer fancy-diary-buffer))
         (setq entries nil)
-      (save-excursion
-        (switch-to-buffer fancy-diary-buffer)
+      (with-current-buffer fancy-diary-buffer
         (setq buffer-read-only nil)
         (if (= (point-max) 1)
             ;; No entries
@@ -3452,11 +3541,6 @@
           ;; Omit the date and other unnecessary stuff
           (org-agenda-cleanup-fancy-diary)
           ;; Add prefix to each line and extend the text properties
-          (goto-char (point-min))
-          (while (and (re-search-forward "^" nil t) (not (eobp)))
-            (replace-match "  Diary:     ")
-            (add-text-properties (point-at-bol) (point)
-                                 (text-properties-at (point))))
           (if (= (point-max) 1)
               (setq entries nil)
             (setq entries (buffer-substring (point-min) (- (point-max) 1)))))
@@ -3467,31 +3551,33 @@
       (setq entries 
             (mapcar 
              (lambda (x)
-               (if (string-match "\\<\\([012][0-9]\\):\\([0-6][0-9]\\)" x)
-                   (add-text-properties
-                    1 (length x)
-                    (list 'time-of-day
-                          (+ (* 100 (string-to-number
-                                     (match-string 1 x)))
-                             (string-to-number (match-string 2 x))))
-                    x))
+               (setq x (org-format-agenda-item "" x "Diary"))
+               ;; Extend the text properties to the beginning of the line
+               (add-text-properties 
+                0 (length x)
+                (text-properties-at (1- (length x)) x)
+                x)
                x)
              entries)))))
 
 (defun org-agenda-cleanup-fancy-diary ()
   "Remove unwanted stuff in buffer created by fancy-diary-display.
 This gets rid of the date, the underline under the date, and
-the dummy entry installed by org-mode to ensure non-empty diary for each
-date."
+the dummy entry installed by `org-mode' to ensure non-empty diary for each
+date.  Itt also removes lines that contain only whitespace."
   (goto-char (point-min))
   (if (looking-at ".*?:[ \t]*")
       (progn
         (replace-match "")
         (re-search-forward "\n=+$" nil t)
         (replace-match "")
-        (while (re-search-backward "^ +" nil t) (replace-match "")))
+        (while (re-search-backward "^ +\n?" nil t) (replace-match "")))
     (re-search-forward "\n=+$" nil t)
     (delete-region (point-min) (min (point-max) (1+ (match-end 0)))))
+  (goto-char (point-min))
+  (while (re-search-forward "^ +\n" nil t)
+    (replace-match ""))
+  (goto-char (point-min))
   (if (re-search-forward "^Org-mode dummy\n?" nil t)
       (replace-match "")))
 
@@ -3501,7 +3587,7 @@
 (eval-after-load "diary-lib"
   '(defadvice add-to-diary-list (before org-mark-diary-entry activate)
      "Make the position visible."
-     (if (and (boundp 'disable-org-diary)  ;; called from org-agenda
+     (if (and org-disable-diary  ;; called from org-agenda
               (stringp string)
               (buffer-file-name))
          (add-text-properties
@@ -3606,7 +3692,7 @@
 
 ;;;###autoload
 (defun org-diary (&rest args)
-  "Returns diary information from org-files.
+  "Return diary information from org-files.
 This function can be used in a \"sexp\" diary entry in the Emacs calendar.
 It accesses org files and extracts information from those files to be
 listed in the diary.  The function accepts arguments specifying what
@@ -3649,6 +3735,7 @@
 by the caller, because this is how the calendar works.  Don't use this
 function from a program - use `org-agenda-get-day-entries' instead." 
   (org-agenda-maybe-reset-markers)
+  (org-compile-agenda-prefix-format org-agenda-prefix-format)
   (setq args (or args '(:deadline :scheduled :timestamp)))
   (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry))
                     (list entry)
@@ -3656,14 +3743,14 @@
          file rtn results)
     ;; If this is called during org-agenda, don't return any entries to
     ;; the calendar.  Org Agenda will list these entries itself.
-    (if (boundp 'disable-org-diary) (setq files nil))
+    (if org-disable-diary (setq files nil))
     (while (setq file (pop files))
       (setq rtn (apply 'org-agenda-get-day-entries file date args))
       (setq results (append results rtn)))
     (concat (org-finalize-agenda-entries results) "\n")))
 
 (defun org-agenda-get-day-entries (file date &rest args)
-  "Does the work for `org-diary' and `org-agenda'
+  "Does the work for `org-diary' and `org-agenda'.
 FILE is the path to a file to be checked for entries.  DATE is date like
 the one returned by `calendar-current-date'.  ARGS are symbols indicating
 which kind of entries should be extracted.  For details about these, see
@@ -3672,26 +3759,26 @@
   (let* ((org-startup-with-deadline-check nil)
          (org-startup-folded nil)
          (buffer (if (file-exists-p file)
-;                     (find-file-noselect file)
                      (org-get-agenda-file-buffer file)
                    (error "No such file %s" file)))
-         (respect-narrow-p (boundp 'org-respect-restriction))
          arg results rtn)
     (if (not buffer)
         ;; If file does not exist, make sure an error message ends up in diary
         (format "ORG-AGENDA-ERROR: No such org-file %s" file)
-      (save-excursion
-        (set-buffer buffer)
+      (with-current-buffer buffer
+        (unless (eq major-mode 'org-mode)
+          (error "Agenda file %s is not in `org-mode'" file))
         (let ((case-fold-search nil))
           (save-excursion
             (save-restriction
-              (if respect-narrow-p
+              (if org-respect-restriction
                   (if (org-region-active-p)
                       ;; Respect a region to restrict search
                       (narrow-to-region (region-beginning) (region-end)))
                 ;; If we work for the calendar or many files, 
                 ;; get rid of any restriction
                 (widen))
+              ;; The way we repeatedly append to `results' makes it O(n^2) :-(
               (while (setq arg (pop args))
                 (cond
                  ((and (eq arg :todo)
@@ -3748,7 +3835,7 @@
          (regexp (concat "[\n\r]\\*+ *\\(" org-not-done-regexp
                          "[^\n\r]*\\)"))
          marker priority
-         ee txt pl)
+         ee txt)
     (goto-char (point-min))
     (while (re-search-forward regexp nil t)
       (goto-char (match-beginning 1))
@@ -3855,7 +3942,7 @@
          (todayp (equal date (calendar-current-date))) ; DATE bound by calendar
          (d1 (calendar-absolute-from-gregorian date))  ; DATE bound by calendar
          d2 diff pos pos1
-         ee txt head hdmarker)
+         ee txt head)
     (goto-char (point-min))
     (while (re-search-forward regexp nil t)
       (setq pos (1- (match-beginning 1))
@@ -3913,7 +4000,7 @@
          (regexp org-scheduled-time-regexp)
          (todayp (equal date (calendar-current-date))) ; DATE bound by calendar
          (d1 (calendar-absolute-from-gregorian date))  ; DATE bound by calendar
-         d2 diff marker hdmarker pos pos1
+         d2 diff pos pos1
          ee txt head)
     (goto-char (point-min))
     (while (re-search-forward regexp nil t)
@@ -3990,38 +4077,66 @@
     ;; Sort the entries by expiration date.
     (nreverse ee)))
 
-
-(defun org-format-agenda-item (prefix txt)
+(defun org-format-agenda-item (prefix txt &optional category)
   "Format TXT to be inserted into the agenda buffer.
 In particular, this indents the line and adds a category."
-  (let ((cat (or org-category
-                 (file-name-sans-extension
-                  (file-name-nondirectory (buffer-file-name)))))
-        time rtn)
-    (if (symbolp cat) (setq cat (symbol-name cat)))
-    (setq rtn (format "  %-10s %s%s" (concat cat ":") prefix txt))
-    (add-text-properties 
-     0 2 (list 'category (downcase cat)
-               'prefix-length (- (length rtn) (length txt))
-               'time-of-day (org-get-time-of-day rtn))
+  (let* ((category (or category
+                       org-category
+                       (file-name-sans-extension
+                        (file-name-nondirectory (buffer-file-name)))))
+         (extra prefix)
+         (time-of-day (org-get-time-of-day txt))
+         (t1 (if time-of-day (concat "0" (int-to-string time-of-day)) "0000"))
+         (time (if time-of-day
+                   (concat (substring t1 -4 -2)
+                           ":" (substring t1 -2))
+                 ""))
+         rtn)
+    (if (symbolp category) (setq category (symbol-name category)))
+    (setq rtn (concat (eval org-prefix-format-compiled) txt))
+    (add-text-properties
+     0 (length rtn) (list 'category (downcase category)
+                          'prefix-length (- (length rtn) (length txt))
+                          'time-of-day time-of-day)
      rtn)
     rtn))
   
-;; FIXME:  Should this be restricted to beginning of string?
+(defun org-compile-prefix-format (format)
+  "Compile the prefix format into a Lisp form that can be evaluated.
+The resulting form is returned and stored in the variable
+`org-prefix-format-compiled'."
+  (let ((start 0) varform vars (s format) c)
+    (while (string-match "%\\([-+]?[0-9.]*\\)\\([ .;,:!?=|/<>]?\\)\\([cts]\\)"
+                         s start)
+      (setq var (cdr (assoc (match-string 3 s)
+                            '(("c" . category) ("t" . time) ("s" . extra))))
+            c (match-string 2 s)
+            start (1+ (match-beginning 0)))
+      (if (= (length c) 1)
+          (setq varform `(if (equal "" ,var) "" (concat ,var ,c)))
+        (setq varform var))
+      (setq s (replace-match "%\\1s" t nil s))
+      (push varform vars))
+    (setq vars (nreverse vars))
+    (setq org-prefix-format-compiled `(format ,s ,@vars))))
+
 (defun org-get-time-of-day (s)
-  "Check string S for a time of day."
+  "Check string S for a time of day.
+If found, return it as a military time number between 0 and 2400.
+If not found, return nil."
   (save-match-data
-  (when (and 
-         (string-match
-          "\\<\\([012][0-9]\\)\\(:\\([0-6][0-9]\\)\\)?\\([AaPp][Mm]\\)?\\>" s)
-         (or (match-beginning 2) (match-beginning 4)))
-    (+ (* 100 (+ (string-to-number (match-string 1 s))
-                 (if (and (match-beginning 4)
-                          (equal (downcase (match-string 4 s)) "pm"))
-                     12 0)))
-       (if (match-beginning 3)
-           (string-to-number (match-string 3 s))
-         0)))))
+    (when (or
+           (string-match
+            "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)\\([AaPp][Mm]\\)?\\>" s)
+           (string-match
+            "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\([AaPp][Mm]\\)\\>" s))
+      (+ (* 100 (+ (string-to-number (match-string 1 s))
+                   (if (and (match-beginning 4)
+                            (equal (downcase (match-string 4 s)) "pm"))
+                       12 0)))
+         (if (match-beginning 3)
+             (string-to-number (match-string 3 s))
+           0)))))
 
 (defun org-finalize-agenda-entries (list)
   "Sort and concatenate the agenda items."
@@ -4073,7 +4188,7 @@
   (let* ((pri (get-text-property (point-at-bol) 'priority)))
     (message "Priority is %d" (if pri pri -1000))))
 
-(defun org-agenda-goto ()
+(defun org-agenda-goto (&optional highlight)
   "Go to the Org-mode file which contains the item at point."
   (interactive)
   (let* ((marker (or (get-text-property (point) 'org-marker) 
@@ -4087,7 +4202,8 @@
       (org-show-hidden-entry)
       (save-excursion
         (and (outline-next-heading)
-             (org-flag-heading nil))))))  ; show the next heading
+             (org-flag-heading nil)))) ; show the next heading
+    (and highlight (org-highlight (point-at-bol) (point-at-eol)))))
 
 (defun org-agenda-switch-to ()
   "Go to the Org-mode file which contains the item at point."
@@ -4116,14 +4232,14 @@
   "Display the Org-mode file which contains the item at point."
   (interactive)
   (let ((win (selected-window)))
-    (org-agenda-goto)
+    (org-agenda-goto t)
     (select-window win)))
 
 (defun org-agenda-recenter (arg)
   "Display the Org-mode file which contains the item at point and recenter."
   (interactive "P")
   (let ((win (selected-window)))
-    (org-agenda-goto)
+    (org-agenda-goto t)
     (recenter arg)
     (select-window win)))
 
@@ -4159,8 +4275,7 @@
          (hdmarker (get-text-property (point) 'org-hd-marker))
          (buffer-read-only nil)
          newhead)
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (widen)
       (goto-char pos)
       (org-show-hidden-entry)
@@ -4225,18 +4340,14 @@
 the same tree node, and the headline of the tree node in the Org-mode file."
   (interactive)
   (org-agenda-check-no-diary)
-  (let* ((props (text-properties-at (point)))
-         (col (current-column))
-         (marker (or (get-text-property (point) 'org-marker)
+  (let* ((marker (or (get-text-property (point) 'org-marker)
                      (org-agenda-error)))
-         (pl (get-text-property (point-at-bol) 'prefix-length))
          (buffer (marker-buffer marker))
          (pos (marker-position marker))
          (hdmarker (get-text-property (point) 'org-hd-marker))
          (buffer-read-only nil)
          newhead)
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (widen)
       (goto-char pos)
       (org-show-hidden-entry)
@@ -4271,20 +4382,21 @@
   (org-agenda-date-later (- arg) what))
 
 (defun org-agenda-date-prompt (arg)
-  "Change the date of this item.  Date is prompted for, with default today."
-  (interactive "p")
+  "Change the date of this item.  Date is prompted for, with default today.
+The prefix ARG is passed to the `org-time-stamp' command and can therefore
+be used to request time specification in the time stamp."
+  (interactive "P")
   (org-agenda-check-no-diary)
   (let* ((marker (or (get-text-property (point) 'org-marker)
                      (org-agenda-error)))
          (buffer (marker-buffer marker))
          (pos (marker-position marker)))
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (widen)
       (goto-char pos)
       (if (not (org-at-timestamp-p))
           (error "Cannot find time stamp"))
-      (org-time-stamp nil)
+      (org-time-stamp arg)
       (message "Time stamp changed to %s" org-last-changed-timestamp))))
 
 (defun org-get-heading ()
@@ -4295,10 +4407,10 @@
         (match-string 1)
       "")))
 
-(defun org-agenda-diary-entry (arg)
+(defun org-agenda-diary-entry ()
   "Make a diary entry, like the `i' command from the calendar.
 All the standard commands work: block, weekly etc"
-  (interactive "P")
+  (interactive)
   (require 'diary-lib)
   (let* ((char (progn 
                  (message "Diary entry: [d]ay [w]eekly [m]onthly [y]early [a]nniversary [b]lock [c]yclic")
@@ -4344,7 +4456,6 @@
     (error "Don't know which date to use for calendar command"))
   (let* ((oldf (symbol-function 'calendar-cursor-to-date))
          (point (point))
-         (mark (or (mark t) (point)))
          (date (calendar-gregorian-from-absolute
                 (get-text-property point 'day)))
          (displayed-day (extract-calendar-day date))
@@ -4527,11 +4638,25 @@
 (defun org-follow-bbdb-link (name)
   "Follow a BBDB link to NAME."
   (require 'bbdb)
-  ;; First try an exact match
-  (bbdb-name (concat "\\`" name "\\'") nil)
-  (if (= 0 (buffer-size (get-buffer "*BBDB*")))
-      ;; No exact match - try partial match
-      (bbdb-name name nil)))
+  (let ((inhibit-redisplay t))
+    (catch 'exit
+      ;; Exact match on name
+      (bbdb-name (concat "\\`" name "\\'") nil)
+      (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil))
+      ;; Exact match on name
+      (bbdb-company (concat "\\`" name "\\'") nil)
+      (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil))
+      ;; Partial match on name
+      (bbdb-name name nil)
+      (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil))
+      ;; Partial match on company
+      (bbdb-company name nil)
+      (if (< 0 (buffer-size (get-buffer "*BBDB*"))) (throw 'exit nil))
+      ;; General match including network address and notes
+      (bbdb name nil)
+      (when (= 0 (buffer-size (get-buffer "*BBDB*")))
+        (delete-window (get-buffer-window "*BBDB*"))
+        (error "No matching BBDB record")))))
 
 (defun org-follow-gnus-link (&optional group article)
   "Follow a Gnus link to GROUP and ARTICLE."
@@ -4545,7 +4670,6 @@
                 (gnus-summary-insert-cached-articles)
                 (gnus-summary-goto-article article nil 'force))
             (message "Message could not be found.")))))
-;;  (if article (gnus-summary-goto-article article nil 'force)))
 
 (defun org-follow-vm-link (&optional folder article readonly)
   "Follow a VM link to FOLDER and ARTICLE."
@@ -4681,8 +4805,9 @@
 
      ((eq major-mode 'bbdb-mode)
       (setq link (concat "bbdb:"
-                         (bbdb-record-name (bbdb-current-record)))))
-
+                         (or (bbdb-record-name (bbdb-current-record))
+                             (bbdb-record-company (bbdb-current-record))))))
+     
      ((eq major-mode 'calendar-mode)
       (let ((cd (calendar-cursor-to-date)))
         (setq link
@@ -4702,7 +4827,6 @@
               (folder (buffer-file-name))
               (subject (vm-su-subject message))
               (author (vm-su-full-name message))
-              (address (vm-su-from message))
               (message-id (vm-su-message-id message)))
          (setq folder (abbreviate-file-name folder))
          (if (string-match (concat "^" (regexp-quote vm-folder-directory))
@@ -4747,9 +4871,8 @@
                                group))
           (setq link (concat "gnus:" group)))))
 
-     ((or (eq major-mode 'gnus-summary-mode)
-          (eq major-mode 'gnus-article-mode))
-      (gnus-article-show-summary)
+     ((memq major-mode '(gnus-summary-mode gnus-article-mode))
+      (and (eq major-mode 'gnus-article-mode) (gnus-article-show-summary))
       (gnus-summary-beginning-of-article)
       (let* ((group (car gnus-article-current))
              (article (cdr gnus-article-current))
@@ -4825,8 +4948,7 @@
 
 
 (defun org-fixup-message-id-for-http (s)
-  "Replace special characters in a message id, so that it can be used
-in an http query."
+  "Replace special characters in a message id, so it can be used in an http query."
   (while (string-match "<" s)
     (setq s (replace-match "%3C" t t s)))
   (while (string-match ">" s)
@@ -4843,13 +4965,13 @@
 press RET at the prompt), the link defaults to the most recently
 stored link.
 
-With a C-u prefix, prompts for a file to link to.  The file name can be
+With a \\[universal-argument] prefix, prompts for a file to link to.  The file name can be
 selected using completion.  The path to the file will be relative to
 the current directory if the file is in the current directory or a
 subdirectory.  Otherwise, the link will be the absolute path as
 completed in the minibuffer (i.e. normally ~/path/to/file).
 
-With two C-u prefixes, enforce an absolute path even if the file
+With two \\[universal-argument] prefixes, enforce an absolute path even if the file
 is in the current directory or below."
   (interactive "P")
   (let ((link (if complete-file
@@ -4970,11 +5092,10 @@
       ;; Find the file
       (if (not visiting)
           (find-file-noselect file))
-      (save-excursion
-        (set-buffer (get-file-buffer file))
+      (with-current-buffer (get-file-buffer file)
         (setq reversed (org-notes-order-reversed-p))
-        (save-restriction
-          (save-excursion
+        (save-excursion
+          (save-restriction
             (widen)
             ;; Ask the User for a location
             (setq spos (if fastp 1 (org-get-location
@@ -5038,12 +5159,6 @@
 ;; Emacs package.  We call the former org-type tables, and the latter
 ;; table.el-type tables.
 
-;; We use a before-change function to check if a table might need
-;; an update.
-(defvar org-table-may-need-update t
-  "Indicates of a table might need an update.
-This variable is set by `org-before-change-function'. `org-table-align'
-sets it back to nil.")
 
 (defun org-before-change-function (beg end)
   "Every change indicates that a table might need an update."
@@ -5058,7 +5173,7 @@
 (defconst org-table1-hline-regexp "^[ \t]*\\+-[-+]"
   "Detects a table-type table hline.")
 (defconst org-table-any-line-regexp "^[ \t]*\\(|\\|\\+-[-+]\\)"
-  "Detects an org-type or table-type table")
+  "Detects an org-type or table-type table.")
 (defconst org-table-border-regexp "^[ \t]*[^| \t]"
   "Searching from within a table (any type) this finds the first line
 outside the table.")
@@ -5210,9 +5325,9 @@
 This is being used to correctly align a single field after TAB or RET.")
 
 
-(defun org-table-align (&optional arg)
+(defun org-table-align ()
   "Align the table at point by aligning all vertical bars."
-  (interactive "P")
+  (interactive)
   (let* (
          ;; Limits of table
          (beg (org-table-begin))
@@ -5366,10 +5481,10 @@
           (setq org-table-may-need-update t))
         (goto-char pos))))))
 
-(defun org-table-next-field (&optional arg)
+(defun org-table-next-field ()
   "Go to the next field in the current table.
 Before doing so, re-align the table if necessary."
-  (interactive "P")
+  (interactive)
   (if (and org-table-automatic-realign
            org-table-may-need-update)
       (org-table-align))
@@ -5388,10 +5503,10 @@
     (error
      (org-table-insert-row 'below))))
 
-(defun org-table-previous-field (&optional arg)
+(defun org-table-previous-field ()
   "Go to the previous field in the table.
 Before doing so, re-align the table if necessary."
-  (interactive "P")
+  (interactive)
   (if (and org-table-automatic-realign
            org-table-may-need-update)
       (org-table-align))
@@ -5404,10 +5519,10 @@
   (if (looking-at "| ?")
       (goto-char (match-end 0))))
 
-(defun org-table-next-row (&optional arg)
+(defun org-table-next-row ()
   "Go to the next row (same column) in the current table.
 Before doing so, re-align the table if necessary."
-  (interactive "P")
+  (interactive)
   (if (or (looking-at "[ \t]*$")
           (save-excursion (skip-chars-backward " \t") (bolp)))
       (newline)
@@ -5470,6 +5585,9 @@
           (looking-at "[ \t]*$"))
       (error "Not in table data field")))
 
+(defvar org-table-clip nil
+  "Clipboard for table regions")
+
 (defun org-table-blank-field ()
   "Blank the current table field or active region."
   (interactive)
@@ -5497,7 +5615,6 @@
   (backward-char 1)
   (if (looking-at "|[^|\r\n]*")
       (let* ((pos (match-beginning 0))
-             (len (length (match-string 0)))
              (val (buffer-substring (1+ pos) (match-end 0))))
         (if replace
             (replace-match (concat "|" replace)))
@@ -5591,9 +5708,9 @@
         (looking-at org-table-hline-regexp))
     nil))
 
-(defun org-table-insert-column (&optional arg)
+(defun org-table-insert-column ()
   "Insert a new column into the table."
-  (interactive "P")
+  (interactive)
   (if (not (org-at-table-p))
       (error "Not at a table"))
   (org-table-find-dataline)
@@ -5634,9 +5751,9 @@
         (error
          "Please position cursor in a data line for column operations")))))
 
-(defun org-table-delete-column (&optional arg)
+(defun org-table-delete-column ()
   "Delete a column into the table."
-  (interactive "P")
+  (interactive)
   (if (not (org-at-table-p))
       (error "Not at a table"))
   (org-table-find-dataline)
@@ -5777,9 +5894,9 @@
     (beginning-of-line 0)
     (move-to-column col)))
 
-(defun org-table-kill-row (&optional arg)
+(defun org-table-kill-row ()
   "Delete the current row or horizontal line from the table."
-  (interactive "P")
+  (interactive)
   (if (not (org-at-table-p))
       (error "Not at a table"))
   (let ((col (current-column)))
@@ -5788,14 +5905,11 @@
     (move-to-column col)))
 
 
-(defun org-table-cut-region (&optional arg)
+(defun org-table-cut-region ()
   "Copy region in table to the clipboard and blank all relevant fields."
-  (interactive "P")
+  (interactive)
   (org-table-copy-region 'cut))
 
-(defvar org-table-clip nil
-  "Clipboard for table regions")
-
 (defun org-table-copy-region (&optional cut)
   "Copy rectangular region in table to clipboard.
 A special clipboard is used which can only be accessed
@@ -5832,20 +5946,19 @@
     (setq org-table-clip (nreverse region))
     (if cut (org-table-align))))
   
-(defun org-table-paste-rectangle (&optional arg)
+(defun org-table-paste-rectangle ()
   "Paste a rectangular region into a table.
 The upper right corner ends up in the current field.  All involved fields
 will be overwritten.  If the rectangle does not fit into the present table,
 the table is enlarged as needed.  The process ignores horizontal separator
 lines."
-  (interactive "P")
+  (interactive)
   (unless (and org-table-clip (listp org-table-clip))
     (error "First cut/copy a region to paste!"))
   (org-table-check-inside-data-field)
   (let* ((clip org-table-clip)
          (line (count-lines (point-min) (point)))
          (col (org-table-current-column))
-         (l line)
          (org-enable-table-editor t)
          (org-table-automatic-realign nil)
          c cols field)
@@ -5864,7 +5977,7 @@
     (org-table-align)))
 
 (defun org-table-convert ()
-  "Convert from org-mode table to table.el and back.
+  "Convert from `org-mode' table to table.el and back.
 Obviously, this only works within limits.  When an Org-mode table is
 converted to table.el, all horizontal separator lines get lost, because
 table.el uses these as cell boundaries and has no notion of horizontal lines.
@@ -5915,7 +6028,7 @@
 If there is an active region, and both point and mark are in the same column,
 the text in the column is wrapped to minimum width for the given number of
 lines.  Generally, this makes the table more compact.  A prefix ARG may be
-used to change the number of desired lines.  For example, `C-2 C-c C-q'
+used to change the number of desired lines.  For example, `C-2 \\[org-table-wrap]'
 formats the selected text to two lines.  If the region was longer than 2
 lines, the remaining lines remain empty.  A negative prefix argument reduces
 the current number of lines by that amount.  The wrapped text is pasted back
@@ -5984,8 +6097,6 @@
 The return value is a list of lines, without newlines at the end."
   (let* ((words (org-split-string string "[ \t\n]+"))
          (maxword (apply 'max (mapcar 'length words)))
-         (black (apply '+ (mapcar 'length words)))
-         (total (+ black (length words)))
          w ll)
     (cond (width
            (org-do-wrap words (max maxword width)))
@@ -6003,7 +6114,7 @@
            
 
 (defun org-do-wrap (words width)
-  "Creates lines of maximum width WIDTH (in characters) from word list WORDS."
+  "Create lines of maximum width WIDTH (in characters) from word list WORDS."
   (let (lines line)
     (while words
       (setq line (pop words))
@@ -6222,10 +6333,10 @@
   $;%.1f              Reformat current cell to 1 digit after dec.point
   ($3-32)*5/9         degrees F -> C conversion
 
-When called with a raw C-u prefix, the formula is applied to the current
+When called with a raw \\[universal-argument] prefix, the formula is applied to the current
 field, and to the same same column in all following rows, until reaching a
 horizontal line or the end of the table.  When the command is called with a
-numeric prefix argument (like M-3 or C-7 or C-u 24), the formula is applied
+numeric prefix argument (like M-3 or C-7 or \\[universal-argument] 24), the formula is applied
 to the current row, and to the following n-1 rows (but not beyond a
 separator line)."
   (interactive "P")
@@ -6297,7 +6408,7 @@
 ;; modified self-insert.
 
 (defcustom orgtbl-optimized (eq org-enable-table-editor 'optimized)
-  "Non-nil means, use the optimized table editor version for orgtbl-mode.
+  "Non-nil means, use the optimized table editor version for `orgtbl-mode'.
 In the optimized version, the table editor takes over all simple keys that
 normally just insert a character.  In tables, the characters are inserted
 in a way to minimize disturbing the table structure (i.e. in overwrite mode
@@ -6311,21 +6422,21 @@
   :type 'boolean)
 
 (defvar orgtbl-mode nil
-  "Variable controlling orgtbl-mode, a minor mode enabling the org-mode
+  "Variable controlling `orgtbl-mode', a minor mode enabling the `org-mode'
 table editor in arbitrary modes.")
 (make-variable-buffer-local 'orgtbl-mode)
 
 (defvar orgtbl-mode-map (make-sparse-keymap)
-  "Keymap for orgtbl-mode.")
+  "Keymap for `orgtbl-mode'.")
 
 ;;;###autoload
 (defun turn-on-orgtbl ()
-  "Unconditionally turn on orgtbl-mode."
+  "Unconditionally turn on `orgtbl-mode'."
   (orgtbl-mode 1))
 
 ;;;###autoload
 (defun orgtbl-mode (&optional arg)
-  "The org-mode table editor as a minor mode for use in other modes." 
+  "The `org-mode' table editor as a minor mode for use in other modes." 
   (interactive) 
   (setq orgtbl-mode
         (if arg (> (prefix-numeric-value arg) 0) (not orgtbl-mode)))
@@ -6435,13 +6546,13 @@
   (define-key org-mode-map "|" 'self-insert-command))
 
 (defun orgtbl-tab ()
-  "Justification and field motion for orgtbl-mode."
+  "Justification and field motion for `orgtbl-mode'."
   (interactive)
   (org-table-justify-field-maybe)
   (org-table-next-field))
 
 (defun orgtbl-ret ()
-  "Justification and field motion for orgtbl-mode."
+  "Justification and field motion for `orgtbl-mode'."
   (interactive)
   (org-table-justify-field-maybe)
   (org-table-next-row))
@@ -6454,7 +6565,7 @@
   (if (and (org-at-table-p)
            (eq N 1)
            (looking-at "[^|\n]*  +|"))
-      (let (org-table-may-need-update (pos (point)))
+      (let (org-table-may-need-update)
         (goto-char (1- (match-end 0)))
         (delete-backward-char 1)
         (goto-char (match-beginning 0))
@@ -6869,6 +6980,8 @@
 It is supplemented by a number of commonly used TeX macros with appropriate
 translations.")
 
+(defvar org-last-level nil) ; dynamically scoped variable
+
 (defun org-export-as-ascii (arg)
   "Export the outline as a pretty ASCII file.
 If there is an active region, export only the region.
@@ -6898,10 +7011,10 @@
 	 (email       user-mail-address)
          (language    org-export-default-language)
 	 (text        nil)
-         (last-level  1)
          (todo nil)
          (lang-words nil))
 
+    (setq org-last-level 1)
     (org-init-section-numbers)
 
     (find-file-noselect filename)
@@ -6962,7 +7075,7 @@
 				 (insert
                                   (make-string (* (1- level) 4) ?\ )
 				  (format (if todo "%s (*)\n" "%s\n") txt))
-				 (setq last-level level))
+				 (setq org-last-level level))
 			     ))))
 		  lines)))
 
@@ -7030,11 +7143,11 @@
           (setq title (concat (org-section-number level) " " title)))
       (insert title "\n" (make-string (string-width title) char) "\n"))))
 
-(defun org-export-copy-visible (&optional arg)
+(defun org-export-copy-visible ()
   "Copy the visible part of the buffer to another buffer, for printing.
 Also removes the first line of the buffer if it specifies a mode,
 and all options lines."
-  (interactive "P")
+  (interactive)
   (let* ((filename (concat (file-name-sans-extension (buffer-file-name))
                            ".txt"))
          (buffer (find-file-noselect filename))
@@ -7044,8 +7157,7 @@
                   "TITLE" "AUTHOR" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE"))
                (if org-noutline-p "\\(\n\\|$\\)" "")))
          s e)
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (erase-buffer)
       (text-mode))
     (save-excursion
@@ -7174,7 +7286,7 @@
   (org-open-file (buffer-file-name)))
 
 (defun org-export-as-html-batch ()
-  "Call org-export-as-html, may be used in batch processing as
+  "Call `org-export-as-html', may be used in batch processing as
 emacs 	--batch
 	--load=$HOME/lib/emacs/org.el
 	--eval \"(setq org-export-headline-levels 2)\"
@@ -7199,7 +7311,6 @@
           (org-skip-comments (org-split-string region "[\r\n]")))
          (lines (org-export-find-first-heading-line all_lines))
          (level 0) (line "") (origline "") txt todo
-	 (last-level 1)
          (umax nil)
          (filename (concat (file-name-sans-extension (buffer-file-name))
                            ".html"))
@@ -7220,6 +7331,7 @@
 	 )
     (message "Exporting...")
 
+    (setq org-last-level 1)
     (org-init-section-numbers)
 
     ;; Search for the export key lines
@@ -7284,15 +7396,15 @@
                              (if (<= level umax)
                                  (progn
                                    (setq head-count (+ head-count 1))
-                                   (if (> level last-level)
+                                   (if (> level org-last-level)
                                        (progn
-                                         (setq cnt (- level last-level))
+                                         (setq cnt (- level org-last-level))
                                          (while (>= (setq cnt (1- cnt)) 0)
                                            (insert "<ul>"))
                                          (insert "\n")))
-                                   (if (< level last-level)
+                                   (if (< level org-last-level)
                                        (progn
-                                         (setq cnt (- last-level level))
+                                         (setq cnt (- org-last-level level))
                                          (while (>= (setq cnt (1- cnt)) 0)
                                            (insert "</ul>"))
                                          (insert "\n")))
@@ -7302,11 +7414,11 @@
                                          "<li><a href=\"#sec-%d\"><span style='color:red'>%s</span></a></li>\n"
                                        "<li><a href=\"#sec-%d\">%s</a></li>\n")
                                      head-count txt))
-                                   (setq last-level level))
+                                   (setq org-last-level level))
                                ))))
                     lines)
-            (while (> last-level 0)
-              (setq last-level (1- last-level))
+            (while (> org-last-level 0)
+              (setq org-last-level (1- org-last-level))
               (insert "</ul>\n"))
             ))
       (setq head-count 0)
@@ -7537,17 +7649,14 @@
 This has the advantage that cell- or row-spanning is allowed.
 But it has the disadvantage, that Org-mode's HTML conversions cannot be used."
   (require 'table)
-  (save-excursion
-    (set-buffer (get-buffer-create " org-tmp1 "))
+  (with-current-buffer (get-buffer-create " org-tmp1 ")
     (erase-buffer)
     (insert (mapconcat 'identity lines "\n"))
     (goto-char (point-min))
     (if (not (re-search-forward "|[^+]" nil t))
         (error "Error processing table."))
     (table-recognize-table)
-    (save-excursion
-      (set-buffer (get-buffer-create " org-tmp2 "))
-      (erase-buffer))
+    (with-current-buffer (get-buffer-create " org-tmp2 ") (erase-buffer))
     (table-generate-source 'html " org-tmp2 ")
     (set-buffer " org-tmp2 ")
     (buffer-substring (point-min) (point-max))))
@@ -7711,7 +7820,7 @@
 			  level head-count title level))
 	(insert (format "\n<H%d>%s</H%d>\n" level title level))))))
 
-(defun org-html-level-close (level)
+(defun org-html-level-close (&rest args)
   "Terminate one level in HTML export."
   (insert "</ul>"))
 
@@ -7800,6 +7909,7 @@
 (define-key org-mode-map "\C-c/"    'org-occur)   ; Minor-mode reserved
 (define-key org-mode-map "\C-c\C-m" 'org-insert-heading)
 (define-key org-mode-map "\M-\C-m"  'org-insert-heading)
+(define-key org-mode-map [(meta shift return)] 'org-insert-todo-heading)
 (define-key org-mode-map "\C-c\C-l" 'org-insert-link)
 (define-key org-mode-map "\C-c\C-o" 'org-open-at-point)
 (define-key org-mode-map "\C-c\C-z" 'org-time-stamp)  ; Alternative binding
@@ -7811,8 +7921,6 @@
 (define-key org-mode-map "\C-c["    'org-add-file)
 (define-key org-mode-map "\C-c]"    'org-remove-file)
 (define-key org-mode-map "\C-c\C-r"       'org-timeline)
-;(define-key org-mode-map [(shift up)]     'org-timestamp-up)
-;(define-key org-mode-map [(shift down)]   'org-timestamp-down)
 (define-key org-mode-map [(shift up)]     'org-shiftup)
 (define-key org-mode-map [(shift down)]   'org-shiftdown)
 (define-key org-mode-map [(shift left)]   'org-timestamp-down-day)
@@ -7864,7 +7972,7 @@
   (if (and (org-table-p)
            (eq N 1)
            (looking-at "[^|\n]*  +|"))
-      (let (org-table-may-need-update (pos (point)))
+      (let (org-table-may-need-update)
         (goto-char (1- (match-end 0)))
         (delete-backward-char 1)
         (goto-char (match-beginning 0))
@@ -7935,25 +8043,27 @@
    ((org-at-table-p) (org-table-previous-field))
    (t (org-cycle '(4)))))
 
-(defun org-shiftmetaleft (&optional arg)
+(defun org-shiftmetaleft ()
   "Call `org-promote-subtree' or `org-table-delete-column'."
-  (interactive "P")
+  (interactive)
   (cond
-   ((org-at-table-p) (org-table-delete-column arg))
-   ((org-on-heading-p) (org-promote-subtree arg))
+   ((org-at-table-p) (org-table-delete-column))
+   ((org-on-heading-p) (org-promote-subtree))
    (t (org-shiftcursor-error))))
-(defun org-shiftmetaright (&optional arg)
+
+(defun org-shiftmetaright ()
   "Call `org-demote-subtree' or `org-table-insert-column'."
-  (interactive "P")
+  (interactive)
   (cond
-   ((org-at-table-p) (org-table-insert-column arg))
-   ((org-on-heading-p) (org-demote-subtree arg))
+   ((org-at-table-p) (org-table-insert-column))
+   ((org-on-heading-p) (org-demote-subtree))
    (t (org-shiftcursor-error))))
+
 (defun org-shiftmetaup (&optional arg)
   "Call `org-move-subtree-up' or `org-table-kill-row'."
   (interactive "P")
   (cond
-   ((org-at-table-p) (org-table-kill-row arg))
+   ((org-at-table-p) (org-table-kill-row))
    ((org-on-heading-p) (org-move-subtree-up arg))
    (t (org-shiftcursor-error))))
 (defun org-shiftmetadown (&optional arg)
@@ -7969,15 +8079,17 @@
   (interactive "P")
   (cond
    ((org-at-table-p) (org-table-move-column 'left))
-   ((or (org-on-heading-p) (org-region-active-p)) (org-do-promote arg))
+   ((or (org-on-heading-p) (org-region-active-p)) (org-do-promote))
    (t (backward-word (prefix-numeric-value arg)))))
+
 (defun org-metaright (&optional arg)
   "Call `org-do-demote' or `org-table-move-column' to right."
   (interactive "P")
   (cond
    ((org-at-table-p) (org-table-move-column nil))
-   ((or (org-on-heading-p) (org-region-active-p)) (org-do-demote arg))
+   ((or (org-on-heading-p) (org-region-active-p)) (org-do-demote))
    (t (forward-word (prefix-numeric-value arg)))))
+
 (defun org-metaup (&optional arg)
   "Call `org-move-subtree-up' or `org-table-move-row' up."
   (interactive "P")
@@ -7985,6 +8097,7 @@
    ((org-at-table-p) (org-table-move-row 'up))
    ((org-on-heading-p) (org-move-subtree-up arg))
    (t (org-shiftcursor-error))))
+
 (defun org-metadown (&optional arg)
   "Call `org-move-subtree-down' or `org-table-move-row' down."
   (interactive "P")
@@ -8007,25 +8120,25 @@
    ((org-at-timestamp-p) (org-timestamp-down arg))
    (t (org-priority-down))))
 
-(defun org-copy-special (arg)
+(defun org-copy-special ()
   "Call either `org-table-copy' or `org-copy-subtree'."
-  (interactive "P")
+  (interactive)
   (if (org-at-table-p)
-      (org-table-copy-region arg)
-    (org-copy-subtree arg)))
-
-(defun org-cut-special (arg)
-  "Call either `org-table-copy' or `org-copy-subtree'."
-  (interactive "P")
+      (org-table-copy-region)
+    (org-copy-subtree)))
+
+(defun org-cut-special ()
+  "Call either `org-table-copy' or `org-cut-subtree'."
+  (interactive)
   (if (org-at-table-p)
-      (org-table-cut-region arg)
-    (org-cut-subtree arg)))
+      (org-table-cut-region)
+    (org-cut-subtree)))
 
 (defun org-paste-special (arg)
   "Call either `org-table-paste-rectangle' or `org-paste-subtree'."
   (interactive "P")
   (if (org-at-table-p)
-      (org-table-paste-rectangle arg)
+      (org-table-paste-rectangle)
     (org-paste-subtree arg)))
 
 (defun org-ctrl-c-ctrl-c (&optional arg)
@@ -8040,12 +8153,12 @@
      ((org-at-table.el-p)
       (require 'table)
       (beginning-of-line 1)
-      (re-search-forward "|" (save-excursion (end-of-line 2) (point)))
+      (re-search-forward "|" (save-excursion (end-of-line 2) (point))) ;FIXME: line-end-position?
       (table-recognize-table))
      ((org-at-table-p)
       (org-table-align))
      ((save-excursion (beginning-of-line 1) (looking-at "#\\+[A-Z]+"))
-      (let (org-inhibit-startup) (org-mode)))
+      (let ((org-inhibit-startup t)) (org-mode)))
      ((org-region-active-p)
       (org-table-convert-region (region-beginning) (region-end) arg))
      ((and (region-beginning) (region-end))
@@ -8054,9 +8167,9 @@
         (error "Abort")))
      (t (error "No table at point, and no region to make one.")))))
 
-(defun org-return (&optional arg)
+(defun org-return ()
   "Call `org-table-next-row' or `newline'."
-  (interactive "P")
+  (interactive)
   (cond
    ((org-at-table-p)
     (org-table-justify-field-maybe)
@@ -8069,7 +8182,7 @@
   (cond
    ((org-at-table-p)
     (org-table-wrap-region arg))
-   (t (org-insert-heading arg))))
+   (t (org-insert-heading))))
 
 ;;; Menu entries
 
@@ -8256,7 +8369,7 @@
 ;;; Miscellaneous stuff
 
 (defun org-move-line-down (arg)
-  "Move the current line up."
+  "Move the current line down.  With prefix argument, move it past ARG lines."
   (interactive "p")
   (let ((col (current-column))
 	beg end pos)
@@ -8269,13 +8382,13 @@
     (move-to-column col)))
 
 (defun org-move-line-up (arg)
-  "Move the current line up."
+  "Move the current line up.  With prefix argument, move it past ARG lines."
   (interactive "p")
   (let ((col (current-column))
 	beg end pos)
     (beginning-of-line 1) (setq beg (point))
     (beginning-of-line 2) (setq end (point))
-    (beginning-of-line (+ -2 arg))
+    (beginning-of-line (- arg))
     (setq pos (move-marker (make-marker) (point)))
     (insert (delete-and-extract-region beg end))
     (goto-char pos)
@@ -8284,7 +8397,7 @@
 ;; Functions needed for Emacs/XEmacs region compatibility
 
 (defun org-region-active-p ()
-  "Is transient-mark-mode on and the region active?
+  "Is `transient-mark-mode' on and the region active?
 Works on both Emacs and XEmacs."
   (if org-ignore-region
       nil
@@ -8403,7 +8516,9 @@
 This function considers both visible and invisible heading lines.
 With argument, move up ARG levels."
   (if org-noutline-p
-      (outline-up-heading arg t)
+      (if (fboundp 'outline-up-heading-all) 
+          (outline-up-heading-all arg)   ; emacs 21 version of outline.el
+        (outline-up-heading arg t))      ; emacs 22 version of outline.el
     (org-back-to-heading t)
     (looking-at outline-regexp)
     (if (<= (- (match-end 0) (match-beginning 0)) arg)
@@ -8422,7 +8537,7 @@
         (progn
           (org-back-to-heading t)
           (org-flag-heading nil)))
-    (show-entry)))
+    (org-show-entry)))
 
 (defun org-check-occur-regexp (regexp)
   "If REGEXP starts with \"^\", modify it to check for \\r as well.
@@ -8444,7 +8559,7 @@
     ;; Check if we should show the entire entry
     (if entry
         (progn
-          (show-entry)
+          (org-show-entry)
           (save-excursion  ;; FIXME: Is this the fix for points in the   -|
                            ;;        middle of text?                      |
             (and (outline-next-heading)   ;;                              |
@@ -8455,6 +8570,28 @@
                                flag
                              (if flag ?\r ?\n))))))
 
+(defun org-show-subtree ()
+  "Show everything after this heading at deeper levels."
+  (outline-flag-region 
+   (point) 
+   (save-excursion
+     (outline-end-of-subtree) (outline-next-heading) (point))
+   (if org-noutline-p nil ?\n)))
+
+(defun org-show-entry ()
+  "Show the body directly following this heading.
+Show the heading too, if it is currently invisible."
+  (interactive)
+  (save-excursion
+    (org-back-to-heading t)
+    (outline-flag-region 
+     (1- (point))
+     (save-excursion
+       (re-search-forward (concat "[\r\n]\\(" outline-regexp "\\)") nil 'move)
+       (or (match-beginning 1) (point-max)))
+     (if org-noutline-p nil ?\n))))
+
+
 (defun org-make-options-regexp (kwds)
   "Make a regular expression for keyword lines."
   (concat
--- a/lisp/tooltip.el	Tue Apr 26 12:17:42 2005 +0000
+++ b/lisp/tooltip.el	Mon May 02 14:38:00 2005 +0000
@@ -453,29 +453,46 @@
   "Show tip for identifier or selection under the mouse.
 The mouse must either point at an identifier or inside a selected
 region for the tip window to be shown.  If tooltip-gud-dereference is t,
-add a `*' in front of the printed expression.
+add a `*' in front of the printed expression. In the case of a C program
+controlled by GDB, show the associated #define directives when program is
+not executing.
 
 This function must return nil if it doesn't handle EVENT."
   (let (process)
     (when (and (eventp event)
 	       tooltip-gud-tips-p
 	       (boundp 'gud-comint-buffer)
+	       gud-comint-buffer
+	       (buffer-name gud-comint-buffer); gud-comint-buffer might be killed
 	       (setq process (get-buffer-process gud-comint-buffer))
 	       (posn-point (event-end event))
-	       (progn (setq tooltip-gud-event event)
-		      (eval (cons 'and tooltip-gud-display))))
+	       (or (eq gud-minor-mode 'gdba)
+		   (progn (setq tooltip-gud-event event)
+			  (eval (cons 'and tooltip-gud-display)))))
       (let ((expr (tooltip-expr-to-print event)))
 	(when expr
-	  (let ((cmd (tooltip-gud-print-command expr)))
-	    (unless (null cmd)	       ; CMD can be nil if unknown debugger
-	      (case gud-minor-mode
-		    (gdba (gdb-enqueue-input
-			   (list  (concat cmd "\n") 'gdb-tooltip-print)))
-		    (t
-		     (setq tooltip-gud-original-filter (process-filter process))
-		       (set-process-filter process 'tooltip-gud-process-output)
-		       (gud-basic-call cmd)))
-		    expr)))))))
+	  (if (and (eq gud-minor-mode 'gdba)
+		   (not gdb-active-process))
+	      (progn
+		(with-current-buffer
+		    (window-buffer (let ((mouse (mouse-position)))
+				     (window-at (cadr mouse)
+						(cddr mouse))))
+		  (when (boundp 'cc-define-alist) ; might be a Fortran program
+		    (let ((define-elt (assoc expr cc-define-alist)))
+		      (unless (null define-elt)
+			(tooltip-show (cdr define-elt))
+			expr)))))
+	    (let ((cmd (tooltip-gud-print-command expr)))
+	      (unless (null cmd) ; CMD can be nil if unknown debugger
+		(case gud-minor-mode
+		  (gdba (gdb-enqueue-input
+			 (list  (concat cmd "\n") 'gdb-tooltip-print)))
+		  (t
+		   (setq tooltip-gud-original-filter (process-filter process))
+		   (set-process-filter process 'tooltip-gud-process-output)
+	       	  (gud-basic-call cmd)))
+		expr))))))))
 
 (defun gdb-tooltip-print ()
   (tooltip-show
--- a/lispref/ChangeLog	Tue Apr 26 12:17:42 2005 +0000
+++ b/lispref/ChangeLog	Mon May 02 14:38:00 2005 +0000
@@ -1,3 +1,56 @@
+2005-04-30  Richard M. Stallman  <rms@gnu.org>
+
+	* files.texi (Magic File Names): Document `operations' property.
+
+2005-04-29  Lute Kamstra  <lute@gnu.org>
+
+	* modes.texi (Generic Modes): New node.
+	(Major Modes): Add it to the menu.
+	(Derived Modes): Add "derived mode" to concept index.
+
+2005-04-28  Lute Kamstra  <lute@gnu.org>
+
+	* modes.texi (Defining Minor Modes): Fix previous change.
+	(Font Lock Mode): Simplify.
+	(Font Lock Basics): Say that font-lock-defaults is buffer-local
+	when set and that some parts are optional.  Add cross references.
+	(Search-based Fontification): Say how to specify font-lock-keywords.
+	Add cross references.  Add font-lock-multiline to index.  Move
+	font-lock-keywords-case-fold-search here from node "Other Font
+	Lock Variables".  Document font-lock-add-keywords and
+	font-lock-remove-keywords
+	(Other Font Lock Variables): Move font-lock-keywords-only,
+	font-lock-syntax-table, font-lock-beginning-of-syntax-function,
+	and font-lock-syntactic-face-function to node "Syntactic Font
+	Lock".  Move font-lock-keywords-case-fold-search to node
+	"Search-based Fontification".  Document font-lock-inhibit-thing-lock
+	and font-lock-{,un}fontify-{buffer,region}-function.
+	(Precalculated Fontification): Remove reference to deleted variable
+	font-lock-core-only.
+	(Faces for Font Lock): Add font-lock-comment-delimiter-face.
+	(Syntactic Font Lock): Add intro.  Move font-lock-keywords-only,
+	font-lock-syntax-table, font-lock-beginning-of-syntax-function,
+	and font-lock-syntactic-face-function here from node "Other Font
+	Lock Variables".  Move font-lock-syntactic-keywords to "Setting
+	Syntax Properties".  Add cross references.
+	(Setting Syntax Properties): New node.  Move
+	font-lock-syntactic-keywords here from "Syntactic Font Lock".
+	* syntax.texi (Syntax Properties): Add cross reference.
+	* hooks.texi (Standard Hooks): Add Font-Lock hooks.
+
+2005-04-26  Richard M. Stallman  <rms@gnu.org>
+
+	* display.texi (Defining Faces):
+	Document `default' elements of defface spec.
+
+	* modes.texi (Major Mode Conventions): Explain customizing ElDoc mode.
+
+	* variables.texi (Variable Aliases): Clarify text.
+
+2005-04-25  Chong Yidong  <cyd@stupidchicken.com>
+
+	* windows.texi (Window Hooks): Remove reference to obsolete Lazy Lock.
+
 2005-04-25  Luc Teirlinck  <teirllm@auburn.edu>
 
 	* hooks.texi (Standard Hooks): Most minor modes have mode hooks too.
--- a/lispref/display.texi	Tue Apr 26 12:17:42 2005 +0000
+++ b/lispref/display.texi	Mon May 02 14:38:00 2005 +0000
@@ -1800,19 +1800,28 @@
 init file (@pxref{Init File}) to override that specification.
 
 The purpose of @var{spec} is to specify how the face should appear on
-different kinds of terminals.  It should be an alist whose elements have
-the form @code{(@var{display} @var{atts})}.  Each element's @sc{car},
-@var{display}, specifies a class of terminals.  The element's second element,
-@var{atts}, is a list of face attributes and their values; it specifies
-what the face should look like on that kind of terminal.  The possible
-attributes are defined in the value of @code{custom-face-attributes}.
+different kinds of terminals.  It should be an alist whose elements
+have the form @code{(@var{display} @var{atts})}.  Each element's
+@sc{car}, @var{display}, specifies a class of terminals.  (The first
+element, if it s @sc{car} is @code{default}, is special---it specifies
+defaults for the remaining elements).  The element's @sc{cadr},
+@var{atts}, is a list of face attributes and their values; it
+specifies what the face should look like on that kind of terminal.
+The possible attributes are defined in the value of
+@code{custom-face-attributes}.
 
 The @var{display} part of an element of @var{spec} determines which
-frames the element applies to.  If more than one element of @var{spec}
-matches a given frame, the first matching element is the only one used
-for that frame.  There are two possibilities for @var{display}:
+frames the element matches.  If more than one element of @var{spec}
+matches a given frame, the first element that matches is the one used
+for that frame.  There are three possibilities for @var{display}:
 
 @table @asis
+@item @code{default}
+This element of @var{spec} doesn't match any frames; instead, it
+specifies defaults that apply to all frames.  This kind of element, if
+used, must be the first element of @var{spec}.  Each of the following
+elements can override any or all of these defaults.
+
 @item @code{t}
 This element of @var{spec} matches all frames.  Therefore, any
 subsequent elements of @var{spec} are never used.  Normally
@@ -1840,8 +1849,9 @@
 The kind of background---either @code{light} or @code{dark}.
 
 @item min-colors
-An integer that represents the minimum number of colors the frame should
-support, it is compared with the result of @code{display-color-cells}.
+An integer that represents the minimum number of colors the frame
+should support.  This matches a frame if its
+@code{display-color-cells} value is at least the specified integer.
 
 @item supports
 Whether or not the frame can display the face attributes given in
--- a/lispref/files.texi	Tue Apr 26 12:17:42 2005 +0000
+++ b/lispref/files.texi	Mon May 02 14:38:00 2005 +0000
@@ -2441,7 +2441,7 @@
 the file name matches @var{regexp}, the primitives handle that file by
 calling @var{handler}.
 
-The first argument given to @var{handler} is the name of the
+  The first argument given to @var{handler} is the name of the
 primitive, as a symbol; the remaining arguments are the arguments that
 were passed to that primitive.  (The first of these arguments is most
 often the file name itself.)  For example, if you do this:
@@ -2458,7 +2458,7 @@
 (funcall @var{handler} 'file-exists-p @var{filename})
 @end example
 
-When a function takes two or more arguments that must be file names,
+  When a function takes two or more arguments that must be file names,
 it checks each of those names for a handler.  For example, if you do
 this:
 
@@ -2479,7 +2479,7 @@
 The @var{handler} then needs to figure out whether to handle
 @var{filename} or @var{dirname}.
 
-If the specified file name matches more than one handler, the one
+  If the specified file name matches more than one handler, the one
 whose match starts last in the file name gets precedence.  This rule
 is chosen so that handlers for jobs such as uncompression are handled
 first, before handlers for jobs such as remote file access.
@@ -2575,12 +2575,12 @@
 @end flushleft
 @end iftex
 
-Handlers for @code{insert-file-contents} typically need to clear the
+  Handlers for @code{insert-file-contents} typically need to clear the
 buffer's modified flag, with @code{(set-buffer-modified-p nil)}, if the
 @var{visit} argument is non-@code{nil}.  This also has the effect of
 unlocking the buffer if it is locked.
 
-The handler function must handle all of the above operations, and
+  The handler function must handle all of the above operations, and
 possibly others to be added in the future.  It need not implement all
 these operations itself---when it has nothing special to do for a
 certain operation, it can reinvoke the primitive, to handle the
@@ -2603,7 +2603,7 @@
              (apply operation args)))))
 @end smallexample
 
-When a handler function decides to call the ordinary Emacs primitive for
+  When a handler function decides to call the ordinary Emacs primitive for
 the operation at hand, it needs to prevent the primitive from calling
 the same handler once again, thus leading to an infinite recursion.  The
 example above shows how to do this, with the variables
@@ -2614,7 +2614,7 @@
 each have handlers.
 
 @kindex safe-magic (@r{property})
-Handlers that don't really do anything special for actual access to the
+  Handlers that don't really do anything special for actual access to the
 file---such as the ones that implement completion of host names for
 remote file names---should have a non-@code{nil} @code{safe-magic}
 property.  For instance, Emacs normally ``protects'' directory names
@@ -2623,6 +2623,15 @@
 would be used for them has a non-@code{nil} @code{safe-magic}
 property, the @samp{/:} is not added.
 
+@kindex operations (@r{property})
+  A file name handler can have an @code{operations} property to
+declare which operations it handles in a nontrivial way.  If this
+property has a non-@code{nil} value, it should be a list of
+operations; then only those operations will call the handler.  This
+avoids inefficiency, but its main purpose is for autoloaded handler
+functions, so that they won't be loaded except when they have real
+work to do.
+
 @defvar inhibit-file-name-handlers
 This variable holds a list of handlers whose use is presently inhibited
 for a certain operation.
--- a/lispref/hooks.texi	Tue Apr 26 12:17:42 2005 +0000
+++ b/lispref/hooks.texi	Mon May 02 14:38:00 2005 +0000
@@ -148,6 +148,27 @@
 @item first-change-hook
 @xref{Change Hooks}.
 
+@item font-lock-beginning-of-syntax-function
+@xref{Syntactic Font Lock}.
+
+@item font-lock-fontify-buffer-function
+@xref{Other Font Lock Variables}.
+
+@item font-lock-fontify-region-function
+@xref{Other Font Lock Variables}.
+
+@item font-lock-mark-block-function
+@xref{Other Font Lock Variables}.
+
+@item font-lock-syntactic-face-function
+@xref{Syntactic Font Lock}.
+
+@item font-lock-unfontify-buffer-function
+@xref{Other Font Lock Variables}.
+
+@item font-lock-unfontify-region-function
+@xref{Other Font Lock Variables}.
+
 @item initial-calendar-window-hook
 @inforef{Calendar Customizing,, emacs-xtra}.
 
--- a/lispref/modes.texi	Tue Apr 26 12:17:42 2005 +0000
+++ b/lispref/modes.texi	Mon May 02 14:38:00 2005 +0000
@@ -103,6 +103,8 @@
 * Mode Help::               Finding out how to use a mode.
 * Derived Modes::           Defining a new major mode based on another major
                               mode.
+* Generic Modes::           Defining a simple major mode that supports
+                              comment syntax and Font Lock mode.
 * Mode Hooks::              Hooks run at the end of major mode functions.
 @end menu
 
@@ -255,6 +257,11 @@
 @code{imenu-create-index-function} (@pxref{Imenu}).
 
 @item
+The mode can specify a local value for
+@code{eldoc-documentation-function} to tell ElDoc mode how to handle
+this mode.
+
+@item
 Use @code{defvar} or @code{defcustom} to set mode-related variables, so
 that they are not reinitialized if they already have a value.  (Such
 reinitialization could discard customizations made by the user.)
@@ -793,6 +800,7 @@
 
 @node Derived Modes
 @subsection Defining Derived Modes
+@cindex derived mode
 
   It's often useful to define a new major mode in terms of an existing
 one.  An easy way to do this is to use @code{define-derived-mode}.
@@ -855,6 +863,57 @@
 @code{define-derived-mode} does that automatically.
 @end defmac
 
+@node Generic Modes
+@subsection Generic Modes
+@cindex generic mode
+
+@dfn{Generic modes} are simple major modes with basic support for
+comment syntax and Font Lock mode.  They are primarily useful for
+configuration files.  To define a generic mode, use the macro
+@code{define-generic-mode}.  See the file @file{generic-x.el} for some
+examples of the use of @code{define-generic-mode}.
+
+@defmac define-generic-mode mode comment-list keyword-list font-lock-list auto-mode-list function-list &optional docstring &rest custom-keyword-args
+This macro creates a new generic mode.  The argument @var{mode} (an
+unquoted symbol) is the major mode command.  The optional argument
+@var{docstring} is the documentation for the mode command.  If you do
+not supply it, @code{define-generic-mode} uses a default documentation
+string instead.
+
+@var{comment-list} is a list in which each element is either a
+character, a string of one or two characters, or a cons cell.  A
+character or a string is set up in the mode's syntax table as a
+``comment starter.''  If the entry is a cons cell, the @sc{car} is set
+up as a ``comment starter'' and the @sc{cdr} as a ``comment ender.''
+(Use @code{nil} for the latter if you want comments to end at the end
+of the line.)  Note that the syntax table has limitations about what
+comment starters and enders are actually possible.  @xref{Syntax
+Tables}.
+
+@var{keyword-list} is a list of keywords to highlight with
+@code{font-lock-keyword-face}.  Each keyword should be a string.
+@var{font-lock-list} is a list of additional expressions to highlight.
+Each element of this list should have the same form as an element of
+@code{font-lock-keywords}.  @xref{Search-based Fontification}.
+
+@var{auto-mode-list} is a list of regular expressions to add to the
+variable @code{auto-mode-alist}.  These regular expressions are added
+when Emacs runs the macro expansion.
+
+@var{function-list} is a list of functions to call to do some
+additional setup.  The mode command calls these functions just before
+it runs the mode hook.
+
+The optional @var{custom-keyword-args} are pairs of keywords and
+values to include in the generated @code{defcustom} form for the mode
+hook variable @code{@var{mode}-hook}.  The default value for the
+@samp{:group} keyword is @var{mode} with the final @samp{-mode} (if
+any) removed.  Don't use this default group name unless you have
+written a @code{defgroup} to define that group properly (@pxref{Group
+Definitions}).  You can specify keyword arguments without specifying a
+docstring.
+@end defmac
+
 @node Mode Hooks
 @subsection Mode Hooks
 
@@ -1129,9 +1188,10 @@
 @table @code
 @item :group @var{group}
 Custom group name to use in all generated @code{defcustom} forms.
-Defaults to @var{mode} without the possible trailing @samp{-mode}.  Be
-aware that this default may not be a valid customization group defined
-with @code{defgroup}.  Please make sure it is.
+Defaults to @var{mode} without the possible trailing @samp{-mode}.
+@strong{Warning:} don't use this default group name unless you have
+written a @code{defgroup} to define that group properly.  @xref{Group
+Definitions}.
 
 @item :global @var{global}
 If non-@code{nil} specifies that the minor mode should be global.
@@ -2020,12 +2080,11 @@
 which contexts.  This section explains how to customize Font Lock for a
 particular major mode.
 
-  Font Lock mode finds text to highlight in two ways: through syntactic
-parsing based on the syntax table, and through searching (usually for
-regular expressions).  Syntactic fontification happens first; it finds
-comments and string constants, and highlights them using
-@code{font-lock-comment-face} and @code{font-lock-string-face}
-(@pxref{Faces for Font Lock}).  Search-based fontification follows.
+  Font Lock mode finds text to highlight in two ways: through
+syntactic parsing based on the syntax table, and through searching
+(usually for regular expressions).  Syntactic fontification happens
+first; it finds comments and string constants and highlights them.
+Search-based fontification happens second.
 
 @menu
 * Font Lock Basics::            Overview of customizing Font Lock.
@@ -2036,7 +2095,8 @@
 * Precalculated Fontification:: How Lisp programs that produce the buffer
                                   contents can also specify how to fontify it.
 * Faces for Font Lock::         Special faces specifically for Font Lock.
-* Syntactic Font Lock::         Defining character syntax based on context
+* Syntactic Font Lock::         Fontification based on syntax tables.
+* Setting Syntax Properties::   Defining character syntax based on context
                                   using the Font Lock mechanism.
 @end menu
 
@@ -2051,45 +2111,48 @@
 
 @defvar font-lock-defaults
 This variable is set by major modes, as a buffer-local variable, to
-specify how to fontify text in that mode.  The value should look like
-this:
+specify how to fontify text in that mode.  It automatically becomes
+buffer-local when you set it.  The value should look like this:
 
 @example
-(@var{keywords} @var{keywords-only} @var{case-fold}
- @var{syntax-alist} @var{syntax-begin} @var{other-vars}@dots{})
+(@var{keywords} [@var{keywords-only} [@var{case-fold}
+ [@var{syntax-alist} [@var{syntax-begin} @var{other-vars}@dots{}]]]])
 @end example
 
 The first element, @var{keywords}, indirectly specifies the value of
-@code{font-lock-keywords}.  It can be a symbol, a variable whose value
-is the list to use for @code{font-lock-keywords}.  It can also be a list of
-several such symbols, one for each possible level of fontification.  The
-first symbol specifies how to do level 1 fontification, the second
-symbol how to do level 2, and so on.
+@code{font-lock-keywords} which directs search-based fontification.
+It can be a symbol, a variable or a function whose value is the list
+to use for @code{font-lock-keywords}.  It can also be a list of
+several such symbols, one for each possible level of fontification.
+The first symbol specifies how to do level 1 fontification, the second
+symbol how to do level 2, and so on.  @xref{Levels of Font Lock}.
 
 The second element, @var{keywords-only}, specifies the value of the
 variable @code{font-lock-keywords-only}.  If this is non-@code{nil},
 syntactic fontification (of strings and comments) is not performed.
+@xref{Syntactic Font Lock}.
 
 The third element, @var{case-fold}, specifies the value of
-@code{font-lock-keywords-case-fold-search}.  If it is non-@code{nil}, Font Lock
-mode ignores case when searching as directed by
+@code{font-lock-keywords-case-fold-search}.  If it is non-@code{nil},
+Font Lock mode ignores case when searching as directed by
 @code{font-lock-keywords}.
 
-If the fourth element, @var{syntax-alist}, is non-@code{nil}, it should be
-a list of cons cells of the form @code{(@var{char-or-string}
+If the fourth element, @var{syntax-alist}, is non-@code{nil}, it
+should be a list of cons cells of the form @code{(@var{char-or-string}
 . @var{string})}.  These are used to set up a syntax table for
-fontification (@pxref{Syntax Table Functions}).  The resulting syntax
-table is stored in @code{font-lock-syntax-table}.
+syntactic fontification (@pxref{Syntax Table Functions}).  The
+resulting syntax table is stored in @code{font-lock-syntax-table}.
 
 The fifth element, @var{syntax-begin}, specifies the value of
-@code{font-lock-beginning-of-syntax-function} (see below).
+@code{font-lock-beginning-of-syntax-function}.
 
 All the remaining elements (if any) are collectively called
 @var{other-vars}.  Each of these elements should have the form
-@code{(@var{variable} . @var{value})}---which means, make @var{variable}
-buffer-local and then set it to @var{value}.  You can use these
-@var{other-vars} to set other variables that affect fontification,
-aside from those you can control with the first five elements.
+@code{(@var{variable} . @var{value})}---which means, make
+@var{variable} buffer-local and then set it to @var{value}.  You can
+use these @var{other-vars} to set other variables that affect
+fontification, aside from those you can control with the first five
+elements.  @xref{Other Font Lock Variables}.
 @end defvar
 
 @node Search-based Fontification
@@ -2097,7 +2160,8 @@
 
   The most important variable for customizing Font Lock mode is
 @code{font-lock-keywords}.  It specifies the search criteria for
-search-based fontification.
+search-based fontification.  You should specify the value of this
+variable with @var{keywords} in @code{font-lock-defaults}.
 
 @defvar font-lock-keywords
 This variable's value is a list of the keywords to highlight.  Be
@@ -2187,7 +2251,8 @@
 @code{font-lock-extra-managed-props} so that the properties will also
 be cleared out when they are no longer appropriate.  Alternatively,
 you can set the variable @code{font-lock-unfontify-region-function} to
-a function that clears these properties.
+a function that clears these properties.  @xref{Other Font Lock
+Variables}.
 
 @item (@var{matcher} . @var{subexp-highlighter})
 In this kind of element, @var{subexp-highlighter} is a list
@@ -2307,6 +2372,7 @@
 Its value should have one of the forms described in this table.
 @end table
 
+@vindex font-lock-multiline
 @strong{Warning:} Do not design an element of @code{font-lock-keywords}
 to match text which spans lines; this does not work reliably.  While
 @code{font-lock-fontify-buffer} handles multi-line patterns correctly,
@@ -2317,52 +2383,75 @@
 setting @code{font-lock-multiline} to @code{t}.  But it still will not
 work in all cases.
 
-@node Other Font Lock Variables
-@subsection Other Font Lock Variables
-
-  This section describes additional variables that a major mode
-can set by means of @code{font-lock-defaults}.
-
-@defvar font-lock-keywords-only
-Non-@code{nil} means Font Lock should not fontify comments or strings
-syntactically; it should only fontify based on
-@code{font-lock-keywords}.
-@end defvar
-
-@ignore
-Other variables include those for buffer-specialized fontification functions,
-`font-lock-fontify-buffer-function', `font-lock-unfontify-buffer-function',
-`font-lock-fontify-region-function', `font-lock-unfontify-region-function',
-`font-lock-inhibit-thing-lock' and `font-lock-maximum-size'.
-@end ignore
+You can use @var{case-fold} in @code{font-lock-defaults} to specify
+the value of @code{font-lock-keywords-case-fold-search} which says
+whether search-based fontification should be case-insensitive.
 
 @defvar font-lock-keywords-case-fold-search
 Non-@code{nil} means that regular expression matching for the sake of
 @code{font-lock-keywords} should be case-insensitive.
 @end defvar
 
-@defvar font-lock-syntax-table
-This variable specifies the syntax table to use for fontification of
-comments and strings.
-@end defvar
-
-@defvar font-lock-beginning-of-syntax-function
-If this variable is non-@code{nil}, it should be a function to move
-point back to a position that is syntactically at ``top level'' and
-outside of strings or comments.  Font Lock uses this when necessary
-to get the right results for syntactic fontification.
-
-This function is called with no arguments.  It should leave point at the
-beginning of any enclosing syntactic block.  Typical values are
-@code{beginning-of-line} (i.e., the start of the line is known to be
-outside a syntactic block), or @code{beginning-of-defun} for programming
-modes or @code{backward-paragraph} for textual modes (i.e., the
-mode-dependent function is known to move outside a syntactic block).
-
-If the value is @code{nil}, the beginning of the buffer is used as a
-position outside of a syntactic block.  This cannot be wrong, but it can
-be slow.
-@end defvar
+You can use @code{font-lock-add-keywords} to add additional
+search-based fontification rules to a major mode, and
+@code{font-lock-remove-keywords} to removes rules.
+
+@defun font-lock-add-keywords mode keywords &optional append
+This function adds highlighting @var{keywords} for @var{mode}.  The
+argument @var{keywords} should be a list with the same format as the
+variable @code{font-lock-keywords}.  @var{mode} should be a symbol,
+the major mode command name, such as @code{c-mode}.  When Font Lock
+mode is turned on in @var{mode}, it adds @var{keywords} to
+@code{font-lock-keywords}.  @var{mode} can also be @code{nil}; the
+highlighting @var{keywords} are immediately added to
+@code{font-lock-keywords} in the current buffer in that case.
+
+By default, @var{keywords} are added at the beginning of
+@code{font-lock-keywords}.  If the optional argument @var{append} is
+@code{set}, they are used to replace the value of
+@code{font-lock-keywords}.  If @var{append} is any other
+non-@code{nil} value, they are added at the end of
+@code{font-lock-keywords}.
+
+For example:
+
+@smallexample
+(font-lock-add-keywords 'c-mode
+ '(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend)
+   ("\\<\\(and\\|or\\|not\\)\\>" . font-lock-keyword-face)))
+@end smallexample
+
+adds two fontification patterns for C mode: one to fontify the word
+@samp{FIXME}, even in comments, and another to fontify the words
+@samp{and}, @samp{or} and @samp{not} as keywords.
+
+Some modes have specialized support for additional patterns.  See the
+variables @code{c-font-lock-extra-types},
+@code{c++-font-lock-extra-types}, @code{objc-font-lock-extra-types}
+and @code{java-font-lock-extra-types}, for example.
+@end defun
+
+@defun font-lock-remove-keywords mode keywords
+This function removes highlighting @var{keywords} for @var{mode}.  As
+in @code{font-lock-add-keywords}, @var{mode} should be a major mode
+command name or @code{nil}.  If @code{nil}, the highlighting
+@var{keywords} are immediately removed in the current buffer.
+@end defun
+
+@strong{Warning:} Only use a non-@code{nil} @var{mode} argument when
+you use @code{font-lock-add-keywords} or
+@code{font-lock-remove-keywords} in your @file{.emacs} file.  When you
+use these functions from a Lisp program (such as a minor mode), we
+recommend that you use @code{nil} for @var{mode} (and place the call
+on a hook) to avoid subtle problems due to the details of the
+implementation.
+
+@node Other Font Lock Variables
+@subsection Other Font Lock Variables
+
+  This section describes additional variables that a major mode can
+set by means of @var{other-vars} in @code{font-lock-defaults}
+(@pxref{Font Lock Basics}).
 
 @defvar font-lock-mark-block-function
 If this variable is non-@code{nil}, it should be a function that is
@@ -2378,25 +2467,38 @@
 @end defvar
 
 @defvar font-lock-extra-managed-props
-Additional properties (other than @code{font-lock-face}) that are
-being managed by Font Lock mode.  Font Lock mode normally manages only
-the @code{font-lock-face} property; if you want it to manage others as
-well, you must specify them in a @var{facespec} in
-@code{font-lock-keywords} as well as adding them to this list.
+This variable specifies additional properties (other than
+@code{font-lock-face}) that are being managed by Font Lock mode.  It
+is used by @code{font-lock-default-unfontify-region}, which normally
+only manages the @code{font-lock-face} property.  If you want Font
+Lock to manage other properties as well, you must specify them in a
+@var{facespec} in @code{font-lock-keywords} as well as add them to
+this list.  @xref{Search-based Fontification}.
+@end defvar
+
+@defvar font-lock-fontify-buffer-function
+Function to use for fontifying the buffer.  The default value is
+@code{font-lock-default-fontify-buffer}.
 @end defvar
 
-@defvar font-lock-syntactic-face-function
-A function to determine which face to use for a given syntactic
-element (a string or a comment).  The function is called with one
-argument, the parse state at point returned by
-@code{parse-partial-sexp}, and should return a face.  The default
-value returns @code{font-lock-comment-face} for comments and
-@code{font-lock-string-face} for strings.
-
-This can be used to highlighting different kinds of strings or
-comments differently.  It is also sometimes abused together with
-@code{font-lock-syntactic-keywords} to highlight elements that span
-multiple lines, but this is too obscure to document in this manual.
+@defvar font-lock-unfontify-buffer-function
+Function to use for unfontifying the buffer.  This is used when
+turning off Font Lock mode.  The default value is
+@code{font-lock-default-unfontify-buffer}.
+@end defvar
+
+@defvar font-lock-fontify-region-function
+Function to use for fontifying a region.  It should take two
+arguments, the beginning and end of the region, and an optional third
+argument @var{verbose}.  If @var{verbose} is non-@code{nil}, the
+function should print status messages.  The default value is
+@code{font-lock-default-fontify-region}.
+@end defvar
+
+@defvar font-lock-unfontify-region-function
+Function to use for unfontifying a region.  It should take two
+arguments, the beginning and end of the region.  The default value is
+@code{font-lock-default-unfontify-region}.
 @end defvar
 
 @defvar font-lock-lines-before
@@ -2407,6 +2509,14 @@
 multi-line patterns.
 @end defvar
 
+@ignore
+@defvar font-lock-inhibit-thing-lock
+List of Font Lock mode related modes that should not be turned on.
+Currently, valid mode names are @code{fast-lock-mode},
+@code{jit-lock-mode} and @code{lazy-lock-mode}.
+@end defvar
+@end ignore
+
 @node Levels of Font Lock
 @subsection Levels of Font Lock
 
@@ -2451,16 +2561,9 @@
 @code{list-buffers} and @code{occur}.
 
 If your mode does not use any of the other machinery of Font Lock
-(i.e. it only uses the @code{font-lock-face} property), you can tell
-Emacs not to load all of font-lock.el (unless it's already loaded), by
-setting the variable @code{font-lock-core-only} to non-@code{nil} as
-part of the @code{font-lock-defaults} settings.  Here is the canonical
-way to do this:
-
-@example
-(set (make-local-variable 'font-lock-defaults)
-     '(nil t nil nil nil (font-lock-core-only . t)))
-@end example
+(i.e. it only uses the @code{font-lock-face} property), it should not
+set the variable @code{font-lock-defaults}.  That way, it will not
+cause loading of the @file{font-lock} library.
 
 @node Faces for Font Lock
 @subsection Faces for Font Lock
@@ -2478,6 +2581,10 @@
 @vindex font-lock-comment-face
 Used (typically) for comments.
 
+@item font-lock-comment-delimiter-face
+@vindex font-lock-comment-delimiter-face
+Used (typically) for comments delimiters.
+
 @item font-lock-doc-face
 @vindex font-lock-doc-face
 Used (typically) for documentation strings in the code.
@@ -2529,14 +2636,78 @@
 @node Syntactic Font Lock
 @subsection Syntactic Font Lock
 
+Syntactic fontification uses the syntax table to find comments and
+string constants (@pxref{Syntax Tables}).  It highlights them using
+@code{font-lock-comment-face} and @code{font-lock-string-face}
+(@pxref{Faces for Font Lock}).  There are several variables that
+affect syntactic fontification; you should set them by means of
+@code{font-lock-defaults} (@pxref{Font Lock Basics}).
+
+@defvar font-lock-keywords-only
+Non-@code{nil} means Font Lock should not do syntactic fontification;
+it should only fontify based on @code{font-lock-keywords}.  The normal
+way for a mode to set this variable to @code{t} is with
+@var{keywords-only} in @code{font-lock-defaults}.
+@end defvar
+
+@defvar font-lock-syntax-table
+This variable holds the syntax table to use for fontification of
+comments and strings.  Specify it using @var{syntax-alist} in
+@code{font-lock-defaults}.
+@end defvar
+
+@c ???
+@c The docstring says that font-lock-syntax-table is semi-obsolete.
+@c How the alternative should be used is not clear.  --lute
+
+@defvar font-lock-beginning-of-syntax-function
+If this variable is non-@code{nil}, it should be a function to move
+point back to a position that is syntactically at ``top level'' and
+outside of strings or comments.  Font Lock uses this when necessary
+to get the right results for syntactic fontification.
+
+This function is called with no arguments.  It should leave point at
+the beginning of any enclosing syntactic block.  Typical values are
+@code{beginning-of-line} (used when the start of the line is known to
+be outside a syntactic block), or @code{beginning-of-defun} for
+programming modes, or @code{backward-paragraph} for textual modes.
+
+If the value is @code{nil}, the beginning of the buffer is used as a
+position outside of a syntactic block.  This cannot be wrong, but it
+can be slow.
+
+Specify this variable using @var{syntax-begin} in
+@code{font-lock-defaults}.
+@end defvar
+
+@defvar font-lock-syntactic-face-function
+A function to determine which face to use for a given syntactic
+element (a string or a comment).  The function is called with one
+argument, the parse state at point returned by
+@code{parse-partial-sexp}, and should return a face.  The default
+value returns @code{font-lock-comment-face} for comments and
+@code{font-lock-string-face} for strings.
+
+This can be used to highlighting different kinds of strings or
+comments differently.  It is also sometimes abused together with
+@code{font-lock-syntactic-keywords} to highlight elements that span
+multiple lines, but this is too obscure to document in this manual.
+
+Specify this variable using @var{other-vars} in
+@code{font-lock-defaults}.
+@end defvar
+
+@node Setting Syntax Properties
+@subsection Setting Syntax Properties
+
   Font Lock mode can be used to update @code{syntax-table} properties
-automatically.  This is useful in languages for which a single syntax
-table by itself is not sufficient.
+automatically (@pxref{Syntax Properties}).  This is useful in
+languages for which a single syntax table by itself is not sufficient.
 
 @defvar font-lock-syntactic-keywords
-This variable enables and controls syntactic Font Lock.  It is
-normally set via @code{font-lock-defaults}.  Its value should be a
-list of elements of this form:
+This variable enables and controls updating @code{syntax-table}
+properties by Font Lock.  Its value should be a list of elements of
+this form:
 
 @example
 (@var{matcher} @var{subexp} @var{syntax} @var{override} @var{laxmatch})
@@ -2546,10 +2717,10 @@
 sort of element of @code{font-lock-keywords},
 
 @example
-(@var{matcher} @var{subexp} @var{facename} @var{override} @var{laxmatch})
+(@var{matcher} @var{subexp} @var{facespec} @var{override} @var{laxmatch})
 @end example
 
-However, instead of specifying the value @var{facename} to use for the
+However, instead of specifying the value @var{facespec} to use for the
 @code{face} property, it specifies the value @var{syntax} to use for
 the @code{syntax-table} property.  Here, @var{syntax} can be a string
 (as taken by @code{modify-syntax-entry}), a syntax table, a cons cell
@@ -2586,6 +2757,8 @@
 as @samp{foo'bar} or @samp{'fubar'}, will not be highlighted as
 strings.
 
+Major modes normally set this variable with @var{other-vars} in
+@code{font-lock-defaults}.
 @end defvar
 
 @node Desktop Save Mode
--- a/lispref/syntax.texi	Tue Apr 26 12:17:42 2005 +0000
+++ b/lispref/syntax.texi	Mon May 02 14:38:00 2005 +0000
@@ -528,10 +528,12 @@
 @section Syntax Properties
 @kindex syntax-table @r{(text property)}
 
-When the syntax table is not flexible enough to specify the syntax of a
-language, you can use @code{syntax-table} text properties to override
-the syntax table for specific character occurrences in the buffer.
-@xref{Text Properties}.
+When the syntax table is not flexible enough to specify the syntax of
+a language, you can use @code{syntax-table} text properties to
+override the syntax table for specific character occurrences in the
+buffer.  @xref{Text Properties}.  You can use Font Lock mode to set
+@code{syntax-table} text properties.  @xref{Setting Syntax
+Properties}.
 
 The valid values of @code{syntax-table} text property are:
 
--- a/lispref/variables.texi	Tue Apr 26 12:17:42 2005 +0000
+++ b/lispref/variables.texi	Mon May 02 14:38:00 2005 +0000
@@ -1714,31 +1714,36 @@
 This function returns @var{base-var}.
 @end defun
 
-Variables aliases are often used prior to replacing an old name for a variable
-with a new name. To allow some time for existing code to adapt to this change,
-@code{make-obsolete-variable} declares that the old name is obsolete and
-therefore that it may be removed at some stage in the future.
+Variable aliases are convenient for replacing an old name for a
+variable with a new name.  @code{make-obsolete-variable} declares that
+the old name is obsolete and therefore that it may be removed at some
+stage in the future.
 
 @defmac make-obsolete-variable variable new &optional when
-This macro makes the byte-compiler warn that symbol @var{variable} is
-obsolete and that symbol @var{new} should be used instead.  If
-@var{new} is a string, this is the message and there is no replacement
-variable.  If it is provided, @var{when} should be a string indicating
-when the variable was first made obsolete, for example a date or a
-release number.
+This macro makes the byte-compiler warn that the variable
+@var{variable} is obsolete.  If @var{new} is a symbol, it is the
+variable's new name; then the warning message says to use @var{new}
+instead of @var{variable}.  If @var{new} is a string, this is the
+message and there is no replacement variable.
+
+If provided, @var{when} should be a string indicating when the
+variable was first made obsolete---for example, a date or a release
+number.
 @end defmac
 
 You can make two variables synonyms and declare one obsolete at the
 same time using the macro @code{define-obsolete-variable-alias}.
 
 @defmac define-obsolete-variable-alias variable new &optional when docstring
-This macro defines the symbol @var{variable} as a variable alias for
-symbol @var{new} and warns that @var{variable} is obsolete.  If it is
-provided, @var{when} should be a string indicating when @var{variable}
-was first made obsolete.  The optional argument @var{docstring}
-specifies the documentation string for @var{variable}.  If
-@var{docstring} is omitted or nil, @var{variable} uses the
-documentation string of @var{new} unless it already has one.
+This macro marks the variable @var{variable} as obsolete and also
+makes it an alias for the variable @var{new}.
+
+If provided, @var{when} should be a string indicating when
+@var{variable} was first made obsolete.  The optional argument
+@var{docstring} specifies the documentation string for @var{variable}.
+If @var{docstring} is omitted or nil, @var{variable} uses the
+documentation string of @var{new} unless it already has one of its
+own.
 @end defmac
 
 @defun indirect-variable variable
--- a/lispref/windows.texi	Tue Apr 26 12:17:42 2005 +0000
+++ b/lispref/windows.texi	Mon May 02 14:38:00 2005 +0000
@@ -2288,8 +2288,7 @@
 There are three actions that can change this: scrolling the window,
 switching buffers in the window, and changing the size of the window.
 The first two actions run @code{window-scroll-functions}; the last runs
-@code{window-size-change-functions}.  The paradigmatic use of these
-hooks is in the implementation of Lazy Lock mode; see @file{lazy-lock.el}.
+@code{window-size-change-functions}.
 
 @defvar window-scroll-functions
 This variable holds a list of functions that Emacs should call before
--- a/man/ChangeLog	Tue Apr 26 12:17:42 2005 +0000
+++ b/man/ChangeLog	Mon May 02 14:38:00 2005 +0000
@@ -1,3 +1,49 @@
+2005-04-30  Richard M. Stallman  <rms@gnu.org>
+
+	* files.texi (Compressed Files): Auto Compression normally enabled.
+
+	* building.texi (Debugger Operation): Clarify previous change.
+
+2005-04-29  Carsten Dominik  <dominik@science.uva.nl>
+
+	* org.texi: Version 3.08, structure reorganized.
+
+2005-04-28  Nick Roberts  <nickrob@snap.net.nz>
+
+	* building.texi (Debugger Operation): Add description for
+	GUD tooltips when program is not running.
+
+2005-04-26  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* misc.texi (Shell): Add `Shell Prompts' to menu.
+	(Shell Mode): Add xref to `Shell Prompts'.  Clarify `C-c C-u'
+	description.  Delete remarks moved to new node.
+	(Shell Prompts): New node.
+	(History References): Replace remarks moved to `Shell Prompts'
+	with xref to that node.
+	(Remote Host): Clarify how to specify the terminal type when
+	logging in to a different machine.
+
+2005-04-26  Richard M. Stallman  <rms@gnu.org>
+
+	* emacs.texi (Top): Update submenus from files.texi.
+
+	* files.texi (Filesets): Clarify previous change.
+
+	* dired.texi (Misc Dired Features): Clarify previous change.
+
+2005-04-25  Chong Yidong  <cyd@stupidchicken.com>
+
+	* ack.texi (Acknowledgments): Delete info about iso-acc.el
+
+	* dired.texi (Misc Dired Features): Document
+	dired-compare-directories.
+
+	* files.texi (Filesets): New node.
+	(File Conveniences): Document Image mode.
+
+	* text.texi (TeX Print): Document tex-compile.
+
 2005-04-25  Luc Teirlinck  <teirllm@auburn.edu>
 
 	* frames.texi (Tooltips): Tooltip mode is enabled by default.
--- a/man/ack.texi	Tue Apr 26 12:17:42 2005 +0000
+++ b/man/ack.texi	Mon May 02 14:38:00 2005 +0000
@@ -1312,9 +1312,8 @@
 of Emacs, and @file{w32-fns.el}, MS-Windows specific support functions.
 
 @item
-Johan Vromans wrote @file{forms.el} and its associated files, defining a
-mode for filling in forms, and @file{iso-acc.el}, a minor mode providing
-electric accent keys for text using the ISO-8859 character set.
+Johan Vromans wrote @file{forms.el} and its associated files, a
+mode for filling in forms.
 
 @item
 Colin Walters wrote @file{ibuffer.el}, a Dired-like major mode for
--- a/man/building.texi	Tue Apr 26 12:17:42 2005 +0000
+++ b/man/building.texi	Mon May 02 14:38:00 2005 +0000
@@ -496,8 +496,10 @@
 You activate this feature by setting the variable
 @code{tooltip-gud-tips-p} to @code{t}.  Then you can display a
 variable's value in a tooltip simply by pointing at it with the mouse.
-This operates in the GUD buffer and in source buffers with major modes
-in the list @code{tooltip-gud-modes}.
+In graphical mode, with a C program, you can also display the
+@code{#define} directive associated with an identifier when program is
+not executing.  This operates in the GUD buffer and in source buffers
+with major modes in the list @code{tooltip-gud-modes}.
 
 @node Commands of GUD
 @subsection Commands of GUD
@@ -907,7 +909,7 @@
 debugger}).
 
 Arrays and structures display their type only.  You must display them
-separately to examine their values.  @ref{Watch Expressions}.
+separately to examine their values.  @xref{Watch Expressions}.
 
 @item Registers Buffer
 The registers buffer displays the values held by the registers
--- a/man/dired.texi	Tue Apr 26 12:17:42 2005 +0000
+++ b/man/dired.texi	Mon May 02 14:38:00 2005 +0000
@@ -1161,6 +1161,32 @@
 headerline, @kbd{w} gives you the absolute name of that directory.
 Any prefix argument or marked files are ignored in this case.
 
+@findex dired-compare-directories
+  The command @kbd{M-x dired-compare-directories} is used to compare
+the current Dired buffer with another directory.  It marks all the files
+that are ``different'' between the two directories.  It puts these marks
+in all Dired buffers where these files are listed, which of course includes
+the current buffer.
+
+  The default comparison method (used if you type @key{RET} at the
+prompt) is to compare just the file names---each file name that does
+not appear in the other directory is ``different''.  You can specify
+more stringent comparisons by entering a Lisp expression, which can
+refer to the variables @code{size1} and @code{size2}, the respective
+file sizes; @code{mtime1} and @code{mtime2}, the last modification
+times in seconds, as floating point numers; and @code{fa1} and
+@code{fa2}, the respective file attribute lists (as returned by the
+function @code{file-attributes}).  This expression is evaluated for
+each pair of like-named files, and if the expression's value is
+non-@code{nil}, those files are considered ``different''.
+
+  For instance, @code{M-x dired-compare-directories @key{RET} (>
+mtime1 mtime2) @key{RET}} marks files newer in this directory than in
+the other, and marks files older in the other directory than in this
+one.  It also marks files with no counterpart, in both directories, as
+always.
+
+@cindex drag and drop, Dired
   On the X window system, Emacs supports the ``drag and drop''
 protocol.  You can drag a file object from another program, and drop
 it onto a Dired buffer; this either moves, copies, or creates a link
--- a/man/emacs.texi	Tue Apr 26 12:17:42 2005 +0000
+++ b/man/emacs.texi	Mon May 02 14:38:00 2005 +0000
@@ -370,23 +370,31 @@
 * Comparing Files::     Finding where two files differ.
 * Misc File Ops::       Other things you can do on files.
 * Compressed Files::    Accessing compressed files.
+* File Archives::       Operating on tar, zip, jar etc. archive files.
 * Remote Files::        Accessing files on other sites.
 * Quoted File Names::   Quoting special characters in file names.
+* File Name Cache::     Completion against a list of files you often use.
+* File Conveniences::   Convenience Features for Finding Files.
+* Filesets::            Handling sets of files.
 
 Saving Files
 
 * Backup::              How Emacs saves the old version of your file.
 * Interlocking::        How Emacs protects against simultaneous editing
                           of one file by two users.
+* Shadowing: File Shadowing.
+                        Copying files to "shadows" automatically.
+* Time Stamps::         Emacs can update time stamps on saved files.
 
 Version Control
 
 * Introduction to VC::  How version control works in general.
-* VC Mode Line::     How the mode line shows version control status.
+* VC Mode Line::        How the mode line shows version control status.
 * Basic VC Editing::    How to edit a file under version control.
 * Old Versions::        Examining and comparing old versions.
 * Secondary VC Commands::    The commands used a little less frequently.
 * Branches::            Multiple lines of development.
+* Remote Repositories:: Efficient access to remote CVS servers.
 * Snapshots::           Sets of file versions treated as a unit.
 * Miscellaneous VC::    Various other commands and features of VC.
 * Customizing VC::      Variables that change VC's behavior.
--- a/man/files.texi	Tue Apr 26 12:17:42 2005 +0000
+++ b/man/files.texi	Mon May 02 14:38:00 2005 +0000
@@ -37,6 +37,7 @@
 * Quoted File Names::   Quoting special characters in file names.
 * File Name Cache::     Completion against a list of files you often use.
 * File Conveniences::   Convenience Features for Finding Files.
+* Filesets::            Handling sets of files.
 @end menu
 
 @node File Names
@@ -3029,17 +3030,10 @@
 @cindex mode, Auto Compression
 @pindex gzip
 
-@findex auto-compression-mode
-@vindex auto-compression-mode
-  Emacs comes with a library that can automatically uncompress
-compressed files when you visit them, and automatically recompress them
-if you alter them and save them.  To enable this feature, type the
-command @kbd{M-x auto-compression-mode}.  You can enable it permanently
-by customizing the variable @code{auto-compression-mode}.
-
-  When automatic compression (which implies automatic uncompression as
-well) is enabled, Emacs recognizes compressed files by their file names.
-File names ending in @samp{.gz} indicate a file compressed with
+  Emacs automatically uncompresses compressed files when you visit
+them, and automatically recompress them if you alter them and save
+them.  Emacs recognizes compressed files by their file names.  File
+names ending in @samp{.gz} indicate a file compressed with
 @code{gzip}.  Other endings indicate other compression programs.
 
   Automatic uncompression and compression apply to all the operations in
@@ -3047,6 +3041,12 @@
 saving it, inserting its contents into a buffer, loading it, and byte
 compiling it.
 
+@findex auto-compression-mode
+@vindex auto-compression-mode
+  To disable this feature, type the command @kbd{M-x
+auto-compression-mode}.  You can disenable it permanently by
+customizing the variable @code{auto-compression-mode}.
+
 @node File Archives
 @section File Archives
 @cindex mode, tar
@@ -3325,6 +3325,15 @@
 @code{find-file}, which can be used with @code{ffap}.
 @xref{Completion Options}.
 
+@findex image-mode
+@findex image-toggle-display
+@cindex images, viewing
+  Visiting image files automatically selects Image mode.  This major
+mode allows you to toggle between displaying the file as an image in
+the Emacs buffer, and displaying its underlying text representation,
+using the command @kbd{C-c C-c} (@code{image-toggle-display}).  This
+works only when Emacs can display the specific image type.
+
 @findex thumbs-mode
 @findex mode, thumbs
   Thumbs mode is a major mode for viewing directories containing many
@@ -3335,6 +3344,43 @@
 @file{convert} program, which is part of the ImageMagick software
 package.
 
+@node Filesets
+@section Filesets
+@cindex filesets
+
+@findex filesets-init
+  If you regularly edit a certain group of files, you can define them
+as a @dfn{fileset}.  This lets you perform certain operations, such as
+visiting, @code{query-replace}, and shell commands on all the files
+at once.  To make use of filesets, you must first add the expression
+@code{(filesets-init)} to your @file{.emacs} file (@pxref{Init File}).
+This adds a @samp{Filesets} menu to the menu bar.
+
+@findex filesets-add-buffer
+@findex filesets-remove-buffer
+  The simplest way to define filesets is by adding files to them one
+at a time.  To add a file to fileset @var{name}, visit the file and
+type @kbd{M-x filesets-add-buffer @kbd{RET} @var{name} @kbd{RET}}.  If
+there is no fileset @var{name}, this creates a new one, which
+initially creates only the current file.  The command @kbd{M-x
+filesets-remove-buffer} removes the current file from a fileset.
+
+  You can also edit the list of filesets directly, with @kbd{M-x
+filesets-edit} (or by choosing @samp{Edit Filesets} from the
+@samp{Filesets} menu).  The editing is performed in a Customize buffer
+(@pxref{Easy Customization}).  Filesets need not be a simple list of
+files---you can also define filesets using regular expression matching
+file names.  Some examples of these more complicated filesets are
+shown in the Customize buffer.  Remember to select @samp{Save for
+future sessions} if you want to use the same filesets in future Emacs
+sessions.
+
+  You can use the command @kbd{M-x filesets-open} to visit all the
+files in a fileset, and @kbd{M-x filesets-close} to close them.  Use
+@kbd{M-x filesets-run-cmd} to run a shell command on all the files in
+a fileset.  These commands are also available from the @samp{Filesets}
+menu, where each existing fileset is represented by a submenu.
+
 @ignore
    arch-tag: 768d32cb-e15a-4cc1-b7bf-62c00ee12250
 @end ignore
--- a/man/misc.texi	Tue Apr 26 12:17:42 2005 +0000
+++ b/man/misc.texi	Mon May 02 14:38:00 2005 +0000
@@ -342,6 +342,7 @@
 * Single Shell::           How to run one shell command and return.
 * Interactive Shell::      Permanent shell taking input via Emacs.
 * Shell Mode::             Special Emacs commands used with permanent shell.
+* Shell Prompts::          Two ways to recognize shell prompts.
 * History: Shell History.  Repeating previous commands in a shell buffer.
 * Directory Tracking::     Keeping track when the subshell changes directory.
 * Options: Shell Options.  Options for customizing Shell mode.
@@ -405,7 +406,7 @@
 either or both of these default initializations.@refill
 
   Both @kbd{M-!} and @kbd{M-|} wait for the shell command to complete,
-unless you end the command with @samp{&} to make it asyncronous.  To
+unless you end the command with @samp{&} to make it asynchronous.  To
 stop waiting, type @kbd{C-g} to quit; that terminates the shell
 command with the signal @code{SIGINT}---the same signal that @kbd{C-c}
 normally generates in the shell.  Emacs waits until the command
@@ -506,8 +507,8 @@
 At end of buffer send line as input; otherwise, copy current line to
 end of buffer and send it (@code{comint-send-input}).  When a line is
 copied, any prompt at the beginning of the line (text output by
-programs preceding your input) is omitted.  (See also the variable
-@code{comint-use-prompt-regexp-instead-of-fields}.)
+programs preceding your input) is omitted.  @xref{Shell Prompts}, for
+how Shell mode recognizes prompts.
 
 @item @key{TAB}
 @kindex TAB @r{(Shell mode)}
@@ -562,7 +563,8 @@
 @kindex C-c C-u @r{(Shell mode)}
 @findex comint-kill-input
 Kill all text pending at end of buffer to be sent as input
-(@code{comint-kill-input}).
+(@code{comint-kill-input}).  If point is not at end of buffer,
+this only kills the part of this text that precedes point.
 
 @item C-c C-w
 @kindex C-c C-w @r{(Shell mode)}
@@ -684,10 +686,6 @@
 @end example
 @end table
 
-  Shell mode also customizes the paragraph commands so that only shell
-prompts start new paragraphs.  Thus, a paragraph consists of an input
-command plus the output that follows it in the buffer.
-
 @cindex Comint mode
 @cindex mode, Comint
   Shell mode is a derivative of Comint mode, a general-purpose mode for
@@ -704,6 +702,45 @@
 in a subprocess using unmodified Comint mode---without the
 specializations of Shell mode.
 
+@node Shell Prompts
+@subsection Shell Prompts
+
+@vindex shell-prompt-pattern
+@vindex comint-prompt-regexp
+@vindex comint-use-prompt-regexp
+@cindex prompt, shell
+  A prompt is text output by a program to show that it is ready to
+accept new user input.  Normally, Comint mode (and thus Shell mode)
+considers the prompt to be any text output by a program at the
+beginning of an input line.  However, if the variable
+@code{comint-use-prompt-regexp} is non-@code{nil}, then Comint mode
+uses a regular expression to recognize prompts.  In Shell mode,
+@code{shell-prompt-pattern} specifies the regular expression.
+
+  The value of @code{comint-use-prompt-regexp} also affects many
+motion and paragraph commands.  If the value is non-@code{nil}, the
+general Emacs motion commands behave as they normally do in buffers
+without special text properties.  However, if the value is @code{nil},
+the default, then Comint mode divides the buffer into two types of
+``fields'' (ranges of consecutive characters having the same
+@code{field} text property): input and output.  Prompts are part of
+the output.  Most Emacs motion commands do not cross field boundaries,
+unless they move over multiple lines.  For instance, when point is in
+input on the same line as a prompt, @kbd{C-a} puts point at the
+beginning of the input if @code{comint-use-prompt-regexp} is
+@code{nil} and at the beginning of the line otherwise.
+
+  In Shell mode, only shell prompts start new paragraphs.  Thus, a
+paragraph consists of a prompt and the input and output that follow
+it.  However, if @code{comint-use-prompt-regexp} is @code{nil}, the
+default, most paragraph commands do not cross field boundaries.  This
+means that prompts, ranges of input, and ranges of non-prompt output
+behave mostly like separate paragraphs; with this setting, numeric
+arguments to most paragraph commands yield essentially undefined
+behavior.  For the purpose of finding paragraph boundaries, Shell mode
+uses @code{shell-prompt-pattern}, regardless of
+@code{comint-use-prompt-regexp}.
+
 @node Shell History
 @subsection Shell Command History
 
@@ -810,7 +847,7 @@
 
 @vindex shell-input-ring-file-name
   Some shells store their command histories in files so that you can
-refer to previous commands from previous shell sessions.  Emacs reads
+refer to commands from previous shell sessions.  Emacs reads
 the command history file for your chosen shell, to initialize its own
 command history.  The file name is @file{~/.bash_history} for bash,
 @file{~/.sh_history} for ksh, and @file{~/.history} for other shells.
@@ -876,19 +913,8 @@
 @key{SPC} perform history expansion by binding @key{SPC} to the
 command @code{comint-magic-space}.
 
-@vindex shell-prompt-pattern
-@vindex comint-prompt-regexp
-@vindex comint-use-prompt-regexp-instead-of-fields
-@cindex prompt, shell
   Shell mode recognizes history references when they follow a prompt.
-Normally, any text output by a program at the beginning of an input
-line is considered a prompt.  However, if the variable
-@code{comint-use-prompt-regexp-instead-of-fields} is non-@code{nil},
-then Comint mode uses a regular expression to recognize prompts.  In
-general, the variable @code{comint-prompt-regexp} specifies the
-regular expression; Shell mode uses the variable
-@code{shell-prompt-pattern} to set up @code{comint-prompt-regexp} in
-the shell buffer.
+@xref{Shell Prompts}, for how Shell mode recognizes prompts.
 
 @node Directory Tracking
 @subsection Directory Tracking
@@ -1119,8 +1145,11 @@
 happens automatically; there is no special password processing.)
 
   When you log in to a different machine, you need to specify the type
-of terminal you're using.  Terminal types @samp{ansi} or @samp{vt100}
-will work on most systems.
+of terminal you're using, by setting the @env{TERM} environment
+variable in the environment for the remote login command.  (If you use
+bash, you do that by writing the variable assignment before the remote
+login command, without separating comma.)  Terminal types @samp{ansi}
+or @samp{vt100} will work on most systems.
 
 @c   If you are talking to a Bourne-compatible
 @c shell, and your system understands the @env{TERMCAP} variable,
@@ -2078,7 +2107,7 @@
 paste (yank), and @kbd{C-z} undo.  Standard Emacs commands like
 @kbd{C-x C-c} still work, because @kbd{C-x} and @kbd{C-c} only take
 effect when the mark is active.  However, if you don't want these
-bindings at all, set @code{cua-enable-cua-keys} to nil.
+bindings at all, set @code{cua-enable-cua-keys} to @code{nil}.
 
 In CUA mode, using @kbd{Shift} together with the movement keys
 activates the region over which they move.  The standard (unshifted)
--- a/man/org.texi	Tue Apr 26 12:17:42 2005 +0000
+++ b/man/org.texi	Mon May 02 14:38:00 2005 +0000
@@ -1,9 +1,10 @@
 \input texinfo
 @c %**start of header
+@c @setfilename org
 @setfilename ../info/org
 @settitle Org Mode Manual
 
-@set VERSION 3.06
+@set VERSION 3.08
 @set DATE April 2005
 
 @dircategory Emacs
@@ -76,9 +77,9 @@
 @menu
 * Introduction::                Getting started
 * Document Structure::          A tree works like your brain
-* TODO items::                  Every tree branch can be a TODO item
 * Tables::                      Pure magic for quick formatting
 * Hyperlinks::                  Notes in context
+* TODO items::                  Every tree branch can be a TODO item
 * Timestamps::                  Assign date and time to items
 * Timeline and Agenda::         Use time-stamped items to produce an agenda
 * Exporting::                   Sharing and publishing of notes
@@ -93,6 +94,7 @@
 
 * Summary::                     Brief summary of what Org-mode does
 * Installation and Activation::  How to install Org-mode
+* Feedback::                    Bug reportes, ideas, patches etc.
 
 Document Structure
 
@@ -103,6 +105,17 @@
 * Structure editing::           Changing sequence and level of headlines
 * Sparse trees::                Matches embedded in context
 
+Tables
+
+* Built-in table editor::       Simple tables
+* table.el::                    Complex tables
+* orgtbl-mode::                 The table editor as minor mode
+
+Hyperlinks
+
+* Links::                       URL-like links to the world
+* Remember::                    Org-trees store quick notes
+
 TODO items
 
 * TODO basics::                 Marking and displaying TODO entries
@@ -115,17 +128,6 @@
 * TODO types::                  I do this, Fred the rest
 * Per file keywords::           Different files, different requirements
 
-Tables
-
-* Built-in table editor::       Simple tables
-* table.el::                    Complex tables
-* orgtbl-mode::                 The table editor as minor mode
-
-Hyperlinks
-
-* Links::                       URL-like links to the world
-* Remember::                    Org-trees store quick notes
-
 Timestamps
 
 * Time stamps::                 Assigning a time to a tree entry
@@ -169,6 +171,7 @@
 @menu
 * Summary::                     Brief summary of what Org-mode does
 * Installation and Activation::  How to install Org-mode
+* Feedback::                    Bug reportes, ideas, patches etc.
 @end menu
 
 @node Summary, Installation and Activation, Introduction, Introduction
@@ -214,7 +217,7 @@
 
 @page
 
-@node Installation and Activation,  , Summary, Introduction
+@node Installation and Activation, Feedback, Summary, Introduction
 @section Installation and Activation
 @cindex installation
 @cindex autoload
@@ -263,7 +266,32 @@
 the file's name is.  See also the variable
 @code{org-insert-mode-line-in-empty-file'}. 
 
-@node Document Structure, TODO items, Introduction, Top
+@node Feedback,  , Installation and Activation, Introduction
+@section Feedback
+@cindex feedback
+@cindex bug reports
+@cindex maintainer
+@cindex author
+
+If you find problems with Org-mode, or if you have questions, remarks,
+or ideas about it, please contact the maintainer Carsten Dominik at
+@value{MAINTAINEREMAIL}.
+
+For bug reports, please provide as much information as possible,
+including the version information of Emacs (@kbd{C-h v emacs-version
+@key{RET}}) and Org-mode (@kbd{M-x org-version}), as well as the
+Org-mode related setup in @file{.emacs}.  If an error occurs, a
+traceback can be very useful.  Often a small example file helps, along
+with clear information about:
+@enumerate
+@item What exactly did you do?
+@item What did you expect to happen?
+@item What happened instead?
+@end enumerate
+@noindent Thanks for helping to improve this mode.
+
+
+@node Document Structure, Tables, Introduction, Top
 @chapter Document Structure
 @cindex document structure
 @cindex structure of document
@@ -503,209 +531,7 @@
 the document to another file (extension @file{.txt}) which then can be
 printed in any desired way.
 
-@node TODO items, Tables, Document Structure, Top
-@chapter TODO items
-@cindex TODO items
-
-Org-mode does not maintain TODO lists as a separate document.  TODO
-items are an integral part of the notes file, because TODO items
-usually come up while taking notes!  With Org-mode, you simply mark
-any entry in a tree as being a TODO item.  In this way, the
-information is not duplicated, and the entire context from which the
-item emerged is always present when you check.
-
-Of course, this technique causes TODO items to be scattered throughout
-your file.  Org-mode provides methods to give you an overview over all
-things you have to do.
-
-@menu
-* TODO basics::                 Marking and displaying TODO entries
-* TODO extensions::             Workflow and assignments
-* Priorities::                  Some things are more important than others
-@end menu
-
-@node TODO basics, TODO extensions, TODO items, TODO items
-@section Basic TODO functionality
-
-Any headline can become a TODO item by starting it with the word TODO,
-for example
-
-@example
-*** TODO Write letter to Sam Fortune
-@end example
-
-@noindent
-The most important commands to work with TODO entries are:
-
-@table @kbd
-@kindex C-c C-t
-@item C-c C-t
-Rotate the TODO state of the current item between
-@example
-,-> (unmarked) -> TODO -> DONE --.
-'--------------------------------'
-@end example
-The same rotation can also be done ``remotely'' from the timeline and
-agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
-@kindex C-c C-v
-@cindex sparse tree, for TODO
-@item C-c C-v
-View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}).  Folds
-the entire buffer, but shows all TODO items and the headings hierarchy
-above them.  With prefix arg, show also the DONE entries.
-@item C-u C-c a
-A @kbd{C-u} argument to the @code{org-agenda command} (@pxref{Agenda})
-collects all unfinished TODO items into a single place.
-@end table
-
-@node TODO extensions, Priorities, TODO basics, TODO items
-@section Extended use of TODO keywords
-@cindex extended TODO keywords
-
-The default implementation of TODO entries is just two states:  TODO
-and DONE.  You can, however, use the TODO feature for more
-complicated things by configuring the variables
-@code{org-todo-keywords} and @code{org-todo-interpretation}.  Using
-special setup, you can even use TODO keywords in different ways in
-different org files.
-
-@menu
-* Workflow states::             From TODO to DONE in steps
-* TODO types::                  I do this, Fred the rest
-* Per file keywords::           Different files, different requirements
-@end menu
-
-@node Workflow states, TODO types, TODO extensions, TODO extensions
-@subsection TODO keywords as workflow states
-@cindex TODO workflow
-@cindex workflow states as TODO keywords
-
-You can use TODO keywords to indicate different states in the process
-of working on an item, for example
-
-@lisp
-(setq org-todo-keywords '("TODO" "FEEDBACK" "VERIFY" "DONE")
-      org-todo-interpretation 'sequence)
-@end lisp
-
-With this setup, the command @kbd{C-c C-t} will cycle an entry from
-TODO to FEEDBACK, then to VERIFY, and finally too DONE.  You may also
-use a prefix argument to quickly select a specific state.  For example
-@kbd{C-3 C-c C-t} will change the state immediately to VERIFY.
-If you define many keywords, you can use in-buffer completion (see
-@ref{Completion}) to insert these words into the buffer.
-
-@node TODO types, Per file keywords, Workflow states, TODO extensions
-@subsection TODO keywords as types
-@cindex TODO types
-@cindex names as TODO keywords
-@cindex types as TODO keywords
-
-The second possibility is to use TODO keywords to indicate different
-types of action items.  For example, you might want to indicate that
-items are for ``work'' or ``home''.  Or, when you work with several
-people on a single project, you might want to assign action items
-directly to persons, by using their names as TODO keywords.  This
-would be set up like this:
-
-@lisp
-(setq org-todo-keywords '("Fred" "Sara" "Lucy" "Mike" "DONE")
-      org-todo-interpretation 'type)
-@end lisp
-
-In this case, different keywords do not indicate a sequence, but
-rather different types.  So it is normally not useful to change from
-one type to another.  Therefore, in this case the the behavior of the
-command @kbd{C-c C-t} is changed slightly@footnote{This is also true
-for the @kbd{t} command in the timeline and agenda buffers}.  When
-used several times in succession, it will still cycle through all
-names.  But when when you return to the item after some time and
-execute @kbd{C-c C-t} again, it will switch from each name directly to
-DONE.  Use prefix arguments or completion to quickly select a specific
-name.
-
-@node Per file keywords,  , TODO types, TODO extensions
-@subsection Setting up TODO keywords for individual files
-@cindex keyword options
-@cindex per file keywords
-
-It can be very useful to use different aspects of the TODO mechanism
-in different files, which is not possible with the global settings
-described above.  For file-local settings, you need to add special
-lines to the file which set the keywords and interpretation for that
-file only.  For example, to set one of the two examples discussed
-above, you need one of the following lines, starting in column zero
-anywhere in the file:
-
-@example
-#+SEQ_TODO: TODO FEEDBACK VERIFY DONE
-#+TYP_TODO: Fred Sara Lucy Mike DONE
-@end example
-
-@cindex Completing option keywords
-@kindex M-@key{TAB}
-@noindent To make sure you are using the correct keyword, type
-@samp{#+} into the buffer and then use @kbd{M-@key{TAB}} completion.
-
-@cindex DONE, final TODO keyword
-Remember that the last keyword must always mean that the item is DONE
-(you may use a different word, though).  Also note that in each file,
-only one of the two aspects of TODO keywords can be used.  After
-changing one of these lines, use @kbd{C-c C-c} with the cursor still
-in the line to make the changes known to Org-mode@footnote{Org-mode
-parses these lines only when Org-mode is activated after visiting a
-file.  @kbd{C-c C-c} with the cursor in a line starting with @samp{#-}
-is simply restarting Org-mode, making sure that these changes will be
-respected.}. 
-
-If you want to use very many keywords, for example when working with a
-large group of people, you may split the names over several lines:
-
-@example
-#+TYP_TODO: Fred Sara Lucy Mike
-#+TYP_TODO: Luis George Jules Jessica
-#+TYP_TODO: Kim Arnold Peter
-#+TYP_TODO: DONE
-@end example
-
-@node Priorities,  , TODO extensions, TODO items
-@section Priorities
-@cindex priorities
-
-If you use Org-mode extensively to organize your work, you may end up
-with a number of TODO entries so large that you'd like to prioritize
-them.  This can be done by placing a @emph{priority cookie} into the
-headline, like this
-
-@example
-*** TODO [#A] Write letter to Sam Fortune
-@end example
-
-@noindent
-With its standard setup, Org-mode supports priorities @samp{A},
-@samp{B}, and @samp{C}.  @samp{A} is the highest priority.  An entry
-without a cookie is treated as priority @samp{B}.  Priorities make a
-difference only in the agenda (@pxref{Agenda}).
-
-@table @kbd
-@kindex @kbd{C-c ,}
-@item @kbd{C-c ,}
-Set the priority of the current item.  The command prompts for a
-priority character @samp{A}, @samp{B} or @samp{C}.  When you press
-@key{SPC} instead, the priority cookie is removed from the headline.
-The priorities can also be changed ``remotely'' from the timeline and
-agenda buffer with the @kbd{,} command (@pxref{Agenda commands}).
-
-@kindex S-@key{up}
-@kindex S-@key{down}
-@item S-@key{up}
-@itemx S-@key{down}
-Increase/decrease priority of current item.  Note that these keys are
-also used to modify time stamps (@pxref{Creating timestamps}).
-@end table
-
-
-@node Tables, Hyperlinks, TODO items, Top
+@node Tables, Hyperlinks, Document Structure, Top
 @chapter Tables
 @cindex tables
 
@@ -951,14 +777,14 @@
 
 If you like the intuitive way the Org-mode table editor works, you
 might want to use it also in other modes like text-mode or mail-mode.
-The minor mode Orgtbl-mode make this possible.  You can always toggle
+The minor mode Orgtbl-mode makes this possible.  You can always toggle
 the mode with @kbd{M-x orgtbl-mode}.  To turn it on by default, for
 example in mail mode, use
 @lisp
 (add-hook 'mail-mode-hook 'turn-on-orgtbl)
 @end lisp
 
-@node Hyperlinks, Timestamps, Tables, Top
+@node Hyperlinks, TODO items, Tables, Top
 @chapter Hyperlinks
 @cindex hyperlinks
 
@@ -1006,7 +832,8 @@
 @end example
 
 A link may contain space characters and is terminated by the end of
-the line.  Therefore, there can be only one link per line (but see the
+the line or, in tables, by the end of the table field.  Therefore,
+outside of tables there can be only one link per line (but see the
 variable @code{org-allow-space-in-links}).
 
 @cindex storing links
@@ -1115,7 +942,210 @@
 non-nil, the entire text is also indented so that it starts in the
 same column as the headline (after the asterisks).
 
-@node Timestamps, Timeline and Agenda, Hyperlinks, Top
+@node TODO items, Timestamps, Hyperlinks, Top
+@chapter TODO items
+@cindex TODO items
+
+Org-mode does not maintain TODO lists as a separate document.  TODO
+items are an integral part of the notes file, because TODO items
+usually come up while taking notes!  With Org-mode, you simply mark
+any entry in a tree as being a TODO item.  In this way, the
+information is not duplicated, and the entire context from which the
+item emerged is always present when you check.
+
+Of course, this technique causes TODO items to be scattered throughout
+your file.  Org-mode provides methods to give you an overview over all
+things you have to do.
+
+@menu
+* TODO basics::                 Marking and displaying TODO entries
+* TODO extensions::             Workflow and assignments
+* Priorities::                  Some things are more important than others
+@end menu
+
+@node TODO basics, TODO extensions, TODO items, TODO items
+@section Basic TODO functionality
+
+Any headline can become a TODO item by starting it with the word TODO,
+for example
+
+@example
+*** TODO Write letter to Sam Fortune
+@end example
+
+@noindent
+The most important commands to work with TODO entries are:
+
+@table @kbd
+@kindex C-c C-t
+@item C-c C-t
+Rotate the TODO state of the current item between
+@example
+,-> (unmarked) -> TODO -> DONE --.
+'--------------------------------'
+@end example
+The same rotation can also be done ``remotely'' from the timeline and
+agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
+@kindex C-c C-v
+@cindex sparse tree, for TODO
+@item C-c C-v
+View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}).  Folds
+the entire buffer, but shows all TODO items and the headings hierarchy
+above them.  With prefix arg, show also the DONE entries.
+@item C-u C-c a
+A @kbd{C-u} argument to the @code{org-agenda command} (@pxref{Agenda})
+collects all unfinished TODO items into a single place.
+@end table
+
+@node TODO extensions, Priorities, TODO basics, TODO items
+@section Extended use of TODO keywords
+@cindex extended TODO keywords
+
+The default implementation of TODO entries is just two states:  TODO
+and DONE.  You can, however, use the TODO feature for more
+complicated things by configuring the variables
+@code{org-todo-keywords} and @code{org-todo-interpretation}.  Using
+special setup, you can even use TODO keywords in different ways in
+different org files.
+
+@menu
+* Workflow states::             From TODO to DONE in steps
+* TODO types::                  I do this, Fred the rest
+* Per file keywords::           Different files, different requirements
+@end menu
+
+@node Workflow states, TODO types, TODO extensions, TODO extensions
+@subsection TODO keywords as workflow states
+@cindex TODO workflow
+@cindex workflow states as TODO keywords
+
+You can use TODO keywords to indicate different states in the process
+of working on an item, for example
+
+@lisp
+(setq org-todo-keywords '("TODO" "FEEDBACK" "VERIFY" "DONE")
+      org-todo-interpretation 'sequence)
+@end lisp
+
+With this setup, the command @kbd{C-c C-t} will cycle an entry from
+TODO to FEEDBACK, then to VERIFY, and finally too DONE.  You may also
+use a prefix argument to quickly select a specific state.  For example
+@kbd{C-3 C-c C-t} will change the state immediately to VERIFY.
+If you define many keywords, you can use in-buffer completion (see
+@ref{Completion}) to insert these words into the buffer.
+
+@node TODO types, Per file keywords, Workflow states, TODO extensions
+@subsection TODO keywords as types
+@cindex TODO types
+@cindex names as TODO keywords
+@cindex types as TODO keywords
+
+The second possibility is to use TODO keywords to indicate different
+types of action items.  For example, you might want to indicate that
+items are for ``work'' or ``home''.  Or, when you work with several
+people on a single project, you might want to assign action items
+directly to persons, by using their names as TODO keywords.  This
+would be set up like this:
+
+@lisp
+(setq org-todo-keywords '("Fred" "Sara" "Lucy" "Mike" "DONE")
+      org-todo-interpretation 'type)
+@end lisp
+
+In this case, different keywords do not indicate a sequence, but
+rather different types.  So it is normally not useful to change from
+one type to another.  Therefore, in this case the the behavior of the
+command @kbd{C-c C-t} is changed slightly@footnote{This is also true
+for the @kbd{t} command in the timeline and agenda buffers}.  When
+used several times in succession, it will still cycle through all
+names.  But when when you return to the item after some time and
+execute @kbd{C-c C-t} again, it will switch from each name directly to
+DONE.  Use prefix arguments or completion to quickly select a specific
+name.
+
+@node Per file keywords,  , TODO types, TODO extensions
+@subsection Setting up TODO keywords for individual files
+@cindex keyword options
+@cindex per file keywords
+
+It can be very useful to use different aspects of the TODO mechanism
+in different files, which is not possible with the global settings
+described above.  For file-local settings, you need to add special
+lines to the file which set the keywords and interpretation for that
+file only.  For example, to set one of the two examples discussed
+above, you need one of the following lines, starting in column zero
+anywhere in the file:
+
+@example
+#+SEQ_TODO: TODO FEEDBACK VERIFY DONE
+#+TYP_TODO: Fred Sara Lucy Mike DONE
+@end example
+
+@cindex Completing option keywords
+@kindex M-@key{TAB}
+@noindent To make sure you are using the correct keyword, type
+@samp{#+} into the buffer and then use @kbd{M-@key{TAB}} completion.
+
+@cindex DONE, final TODO keyword
+Remember that the last keyword must always mean that the item is DONE
+(you may use a different word, though).  Also note that in each file,
+only one of the two aspects of TODO keywords can be used.  After
+changing one of these lines, use @kbd{C-c C-c} with the cursor still
+in the line to make the changes known to Org-mode@footnote{Org-mode
+parses these lines only when Org-mode is activated after visiting a
+file.  @kbd{C-c C-c} with the cursor in a line starting with @samp{#-}
+is simply restarting Org-mode, making sure that these changes will be
+respected.}. 
+
+If you want to use very many keywords, for example when working with a
+large group of people, you may split the names over several lines:
+
+@example
+#+TYP_TODO: Fred Sara Lucy Mike
+#+TYP_TODO: Luis George Jules Jessica
+#+TYP_TODO: Kim Arnold Peter
+#+TYP_TODO: DONE
+@end example
+
+@node Priorities,  , TODO extensions, TODO items
+@section Priorities
+@cindex priorities
+
+If you use Org-mode extensively to organize your work, you may end up
+with a number of TODO entries so large that you'd like to prioritize
+them.  This can be done by placing a @emph{priority cookie} into the
+headline, like this
+
+@example
+*** TODO [#A] Write letter to Sam Fortune
+@end example
+
+@noindent
+With its standard setup, Org-mode supports priorities @samp{A},
+@samp{B}, and @samp{C}.  @samp{A} is the highest priority.  An entry
+without a cookie is treated as priority @samp{B}.  Priorities make a
+difference only in the agenda (@pxref{Agenda}).
+
+@table @kbd
+@kindex @kbd{C-c ,}
+@item @kbd{C-c ,}
+Set the priority of the current item.  The command prompts for a
+priority character @samp{A}, @samp{B} or @samp{C}.  When you press
+@key{SPC} instead, the priority cookie is removed from the headline.
+The priorities can also be changed ``remotely'' from the timeline and
+agenda buffer with the @kbd{,} command (@pxref{Agenda commands}).
+
+@kindex S-@key{up}
+@kindex S-@key{down}
+@item S-@key{up}
+@itemx S-@key{down}
+Increase/decrease priority of current item.  Note that these keys are
+also used to modify time stamps (@pxref{Creating timestamps}).
+@end table
+
+
+
+@node Timestamps, Timeline and Agenda, TODO items, Top
 @chapter Timestamps
 
 Items can be labeled with timestamps to make them useful for project
@@ -1415,10 +1445,11 @@
 @end example
 @noindent
 After changing this line, press @kbd{C-c C-c} with the cursor still in
-the line, to make the changes know to org-mode.  Otherwise, the change
-will only be active the next time you visit this file with Emacs.
+the line, to make the changes known to org-mode.  Otherwise, the
+change will only be active the next time you visit this file with
+Emacs.
 
-The display in the agenda buffer looks best if the category is no
+The display in the agenda buffer looks best if the category is not
 longer than 10 characters.
 
 @subsection Sorting of agenda items
@@ -2078,10 +2109,9 @@
 @cindex acknowledgments
 
 Org-mode was written by Carsten Dominik, who still maintains it at the
-Org-mode homepage
-@uref{http://www.astro.uva.nl/~dominik/Tools/org/}.  The following
-people have helped the development along with ideas, suggestions and
-patches. 
+Org-mode homepage @uref{http://www.astro.uva.nl/~dominik/Tools/org/}.
+The following people have helped the development along with ideas,
+suggestions and patches.
 
 @itemize @bullet
 @item
@@ -2112,6 +2142,9 @@
 @item
 Carsten Wimmer suggested some changes and helped fix a bug in linking
 to GNUS.
+@item
+Stefan Monnier provided a patch with lots of little fixes to keep the
+Emacs-Lisp compiler happy.
 @end itemize
 
 @node Bugs,  , Acknowledgments, Miscellaneous
@@ -2154,6 +2187,7 @@
 
 @bye
 
+
 @ignore
    arch-tag: 7893d1fe-cc57-4d13-b5e5-f494a1bcc7ac
 @end ignore
--- a/man/text.texi	Tue Apr 26 12:17:42 2005 +0000
+++ b/man/text.texi	Mon May 02 14:38:00 2005 +0000
@@ -1540,6 +1540,9 @@
 C-f} command (@code{tex-view}).
 @item C-c C-q
 Show the printer queue (@code{tex-show-print-queue}).
+@item C-c C-c
+Invoke some other compilation command on the entire current buffer
+(@code{tex-compile}).
 @end table
 
 @findex tex-buffer
@@ -1684,6 +1687,15 @@
 @kbd{C-c TAB} (@code{tex-bibtex-file}), and then repeat @kbd{C-c C-f}
 (@code{tex-file}) twice more to get the cross-references correct.
 
+@findex tex-compile
+@kindex C-c C-c @r{(@TeX{} mode)}
+  To invoke some other compilation program on the current @TeX{}
+buffer, type @kbd{C-c C-c} (@code{tex-compile}).  This command knows
+how to pass arguments to many common programs, including
+@file{pdflatex}, @file{yap}, @file{xdvi}, and @file{dvips}.  You can
+select your desired compilation program using the standard completion
+keys (@pxref{Completion}).
+
 @node TeX Misc
 @subsection @TeX{} Mode Miscellany
 
--- a/src/ChangeLog	Tue Apr 26 12:17:42 2005 +0000
+++ b/src/ChangeLog	Mon May 02 14:38:00 2005 +0000
@@ -1,3 +1,52 @@
+2005-05-01  Thien-Thi Nguyen  <ttn@gnu.org>
+
+	* sysdep.c (get_frame_size) [VMS]: Use a fresh i/o channel.
+
+2005-04-30  Richard M. Stallman  <rms@gnu.org>
+
+	* fileio.c (Ffind_file_name_handler): Handle the `operations'
+	property of the file name handler.
+	(Qoperations): New variable.
+	(syms_of_fileio): Initialize and staticpro it.
+
+	* xdisp.c (set_message_1): Delete xassert.
+
+2005-04-29  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* mac.c: Don't include time.h.  Include sysselect.h after
+	systime.h.
+
+	* macfns.c (Fx_server_version): Add BLOCK_INPUT around Gestalt.
+
+	* macgui.h [HAVE_CARBON && MAC_OSX]: Don't undefine/define mktime
+	before/after including Carbon.h if there is a working mktime.
+
+2005-04-28  Kim F. Storm  <storm@cua.dk>
+
+	* xfaces.c (resolve_face_name): Add arg SIGNAL_P.  Calls changed.
+	Fix cyclic alias check.  If alias loop is detected, signal
+	circular-list error if SIGNAL_P, and return Qdefault if !SIGNAL_P.
+
+2005-04-28  Lute Kamstra  <lute@gnu.org>
+
+	* eval.c (do_autoload): Record only autoloads in the autoload
+	property of symbols.
+
+2005-04-28  Nick Roberts  <nickrob@snap.net.nz>
+
+	* emacs.c (USAGE1): Add --basic-display and --quick options.
+
+2005-04-27  Kim F. Storm  <storm@cua.dk>
+
+	* data.c (syms_of_data) Staticpro Qcyclic_variable_indirection.
+
+2005-04-26  Richard M. Stallman  <rms@gnu.org>
+
+	* window.c (Fsame_window_p, Fspecial_display_p): Doc fixes.
+	(syms_of_window): Doc fixes.
+
+	* indent.c (Fvertical_motion): Undo previous change.
+
 2005-04-26  Kenichi Handa  <handa@m17n.org>
 
 	* fns.c (char_table_range): New function.
@@ -61,7 +110,7 @@
 	[USE_CARBON_EVENTS && MAC_OSX] (Qpreferences, Qservices, Qpaste)
 	(Qperform): New variables.
 	(syms_of_mac) [USE_CARBON_EVENTS && MAC_OSX]: Initialize them.
-	(do_get_menus) [!TARGET_API_MAC_CARBON]: Don't call AppendResMenu.
+	(do_get_menus) [TARGET_API_MAC_CARBON]: Don't call AppendResMenu.
 	(do_menu_choice): Unhighlight menu bar also when menu_id is 0.
 	(mac_store_application_menu_event, init_menu_bar): New functions.
 	[USE_CARBON_EVENTS] (mac_handle_command_event)
--- a/src/data.c	Tue Apr 26 12:17:42 2005 +0000
+++ b/src/data.c	Mon May 02 14:38:00 2005 +0000
@@ -3181,6 +3181,7 @@
   staticpro (&Qargs_out_of_range);
   staticpro (&Qvoid_function);
   staticpro (&Qcyclic_function_indirection);
+  staticpro (&Qcyclic_variable_indirection);
   staticpro (&Qvoid_variable);
   staticpro (&Qsetting_constant);
   staticpro (&Qinvalid_read_syntax);
--- a/src/emacs.c	Tue Apr 26 12:17:42 2005 +0000
+++ b/src/emacs.c	Mon May 02 14:38:00 2005 +0000
@@ -265,7 +265,8 @@
 --no-shared-memory, -nl     do not use shared memory\n\
 --no-site-file              do not load site-start.el\n\
 --no-splash                 do not display a splash screen on startup\n\
---no-window-system, -nw     don't communicate with X, ignoring $DISPLAY\n\
+--no-window-system, -nw     do not communicate with X, ignoring $DISPLAY\n\
+--quick, -Q                 equivalent to -q --no-site-file\n\
 --script FILE               run FILE as an Emacs Lisp script\n\
 --terminal, -t DEVICE       use DEVICE for terminal I/O\n\
 --unibyte, --no-multibyte   run Emacs in unibyte mode\n\
@@ -295,6 +296,8 @@
 Display options:\n\
 \n\
 --background-color, -bg COLOR   window background color\n\
+--basic-display, -D             disable many display features;\n\
+                                  used for debugging Emacs\n\
 --border-color, -bd COLOR       main border color\n\
 --border-width, -bw WIDTH       width of main border\n\
 --color, --color=MODE           color mode for character terminals;\n\
--- a/src/eval.c	Tue Apr 26 12:17:42 2005 +0000
+++ b/src/eval.c	Mon May 02 14:38:00 2005 +0000
@@ -1,6 +1,6 @@
 /* Evaluator for GNU Emacs Lisp interpreter.
-   Copyright (C) 1985, 86, 87, 93, 94, 95, 99, 2000, 2001, 02, 2004
-     Free Software Foundation, Inc.
+   Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1999, 2000, 2001,
+     2002, 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -1982,10 +1982,7 @@
       second = Fcdr (first);
       first = Fcar (first);
 
-      /* Note: This test is subtle.  The cdr of an autoload-queue entry
-	 may be an atom if the autoload entry was generated by a defalias
-	 or fset.  */
-      if (CONSP (second))
+      if (CONSP (second) && EQ (XCAR (second), Qautoload))
 	Fput (first, Qautoload, (XCDR (second)));
 
       queue = XCDR (queue);
--- a/src/fileio.c	Tue Apr 26 12:17:42 2005 +0000
+++ b/src/fileio.c	Mon May 02 14:38:00 2005 +0000
@@ -177,6 +177,10 @@
    whose I/O is done with a special handler.  */
 Lisp_Object Vfile_name_handler_alist;
 
+/* Property name of a file name handler,
+   which gives a list of operations it handles..  */
+Lisp_Object Qoperations;
+
 /* Lisp functions for translating file formats */
 Lisp_Object Qformat_decode, Qformat_annotate_function;
 
@@ -368,13 +372,16 @@
       elt = XCAR (chain);
       if (CONSP (elt))
 	{
-	  Lisp_Object string;
+	  Lisp_Object string = XCAR (elt);
 	  int match_pos;
-	  string = XCAR (elt);
+	  Lisp_Object handler = XCDR (elt);
+	  Lisp_Object operations = Fget (handler, Qoperations);
+
 	  if (STRINGP (string)
-	      && (match_pos = fast_string_match (string, filename)) > pos)
+	      && (match_pos = fast_string_match (string, filename)) > pos
+	      && (NILP (operations) || ! NILP (Fmemq (operation, operations))))
 	    {
-	      Lisp_Object handler, tem;
+	      Lisp_Object tem;
 
 	      handler = XCDR (elt);
 	      tem = Fmemq (handler, inhibited_handlers);
@@ -6439,6 +6446,7 @@
 void
 syms_of_fileio ()
 {
+  Qoperations = intern ("operations");
   Qexpand_file_name = intern ("expand-file-name");
   Qsubstitute_in_file_name = intern ("substitute-in-file-name");
   Qdirectory_file_name = intern ("directory-file-name");
@@ -6473,6 +6481,7 @@
   Qset_visited_file_modtime = intern ("set-visited-file-modtime");
   Qauto_save_coding = intern ("auto-save-coding");
 
+  staticpro (&Qoperations);
   staticpro (&Qexpand_file_name);
   staticpro (&Qsubstitute_in_file_name);
   staticpro (&Qdirectory_file_name);
--- a/src/indent.c	Tue Apr 26 12:17:42 2005 +0000
+++ b/src/indent.c	Mon May 02 14:38:00 2005 +0000
@@ -67,8 +67,6 @@
 
 int current_column_bol_cache;
 
-extern Lisp_Object Qfontification_functions;
-
 /* Get the display table to use for the current buffer.  */
 
 struct Lisp_Char_Table *
@@ -2051,7 +2049,6 @@
   struct window *w;
   Lisp_Object old_buffer;
   struct gcpro gcpro1;
-  int count = SPECPDL_INDEX ();
 
   CHECK_NUMBER (lines);
   if (! NILP (window))
@@ -2069,9 +2066,6 @@
       XSETBUFFER (w->buffer, current_buffer);
     }
 
-  /* Don't fontify text that we just move across.  */
-  specbind (Qfontification_functions, Qnil);
-
   if (noninteractive)
     {
       struct position pos;
@@ -2117,7 +2111,6 @@
   if (BUFFERP (old_buffer))
     w->buffer = old_buffer;
 
-  unbind_to (count, Qnil);
   RETURN_UNGCPRO (make_number (it.vpos));
 }
 
--- a/src/mac.c	Tue Apr 26 12:17:42 2005 +0000
+++ b/src/mac.c	Mon May 02 14:38:00 2005 +0000
@@ -24,12 +24,11 @@
 
 #include <stdio.h>
 #include <errno.h>
-#include <time.h>
 
 #include "lisp.h"
 #include "process.h"
+#include "systime.h"
 #include "sysselect.h"
-#include "systime.h"
 #include "blockinput.h"
 
 #include "macterm.h"
--- a/src/macfns.c	Tue Apr 26 12:17:42 2005 +0000
+++ b/src/macfns.c	Mon May 02 14:38:00 2005 +0000
@@ -2969,8 +2969,13 @@
 {
   int mac_major_version;
   SInt32 response;
-
-  if (Gestalt (gestaltSystemVersion, &response) != noErr)
+  OSErr err;
+
+  BLOCK_INPUT;
+  err = Gestalt (gestaltSystemVersion, &response);
+  UNBLOCK_INPUT;
+
+  if (err != noErr)
     error ("Cannot get Mac OS version");
 
   mac_major_version = (response >> 8) & 0xff;
--- a/src/macgui.h	Tue Apr 26 12:17:42 2005 +0000
+++ b/src/macgui.h	Mon May 02 14:38:00 2005 +0000
@@ -32,7 +32,9 @@
 #ifdef HAVE_CARBON
 #undef Z
 #ifdef MAC_OSX
+#if ! HAVE_MKTIME || BROKEN_MKTIME
 #undef mktime
+#endif
 #undef DEBUG
 #undef free
 #undef malloc
@@ -43,8 +45,10 @@
 #undef min
 #undef init_process
 #include <Carbon/Carbon.h>
+#if ! HAVE_MKTIME || BROKEN_MKTIME
 #undef mktime
 #define mktime emacs_mktime
+#endif
 #undef free
 #define free unexec_free
 #undef malloc
--- a/src/sysdep.c	Tue Apr 26 12:17:42 2005 +0000
+++ b/src/sysdep.c	Mon May 02 14:38:00 2005 +0000
@@ -1793,10 +1793,16 @@
 #else
 #ifdef VMS
 
+  /* Use a fresh channel since the current one may have stale info
+     (for example, from prior to a suspend); and to avoid a dependency
+     in the init sequence.  */
+  int chan;
   struct sensemode tty;
 
-  SYS$QIOW (0, fd, IO$_SENSEMODE, &tty, 0, 0,
-	    &tty.class, 12, 0, 0, 0, 0);
+  SYS$ASSIGN (&input_dsc, &chan, 0, 0);
+  SYS$QIOW (0, chan, IO$_SENSEMODE, &tty, 0, 0,
+            &tty.class, 12, 0, 0, 0, 0);
+  SYS$DASSGN (chan);
   *widthp = tty.scr_wid;
   *heightp = tty.scr_len;
 
--- a/src/window.c	Tue Apr 26 12:17:42 2005 +0000
+++ b/src/window.c	Mon May 02 14:38:00 2005 +0000
@@ -3265,9 +3265,10 @@
 
 DEFUN ("special-display-p", Fspecial_display_p, Sspecial_display_p, 1, 1, 0,
        doc: /* Returns non-nil if a buffer named BUFFER-NAME gets a special frame.
-If the value is t, a frame would be created for that buffer
-using the default frame parameters.  If the value is a list,
-it is a list of frame parameters that would be used
+If the value is t, `display-buffer' or `pop-to-buffer' would create a
+special frame for that buffer using the default frame parameters.
+
+If the value is a list, it is a list of frame parameters that would be used
 to make a frame for that buffer.
 The variables `special-display-buffer-names'
 and `special-display-regexps' control this.  */)
@@ -3301,7 +3302,9 @@
 }
 
 DEFUN ("same-window-p", Fsame_window_p, Ssame_window_p, 1, 1, 0,
-       doc: /* Returns non-nil if a new buffer named BUFFER-NAME would use the same window.
+       doc: /* Returns non-nil if a buffer named BUFFER-NAME would use the same window.
+More precisely, if `display-buffer' or `pop-to-buffer' would display
+that buffer in the selected window rather than (as usual) in some other window.
 See `same-window-buffer-names' and `same-window-regexps'.  */)
      (buffer_name)
      Lisp_Object buffer_name;
@@ -6750,7 +6753,8 @@
 
   DEFVAR_LISP ("special-display-buffer-names", &Vspecial_display_buffer_names,
 	       doc: /* *List of buffer names that should have their own special frames.
-Displaying a buffer whose name is in this list makes a special frame for it
+Displaying a buffer with `display-buffer' or `pop-to-buffer',
+if its name is in this list, makes a special frame for it
 using `special-display-function'.  See also `special-display-regexps'.
 
 An element of the list can be a list instead of just a string.
@@ -6775,9 +6779,9 @@
 
   DEFVAR_LISP ("special-display-regexps", &Vspecial_display_regexps,
 	       doc: /* *List of regexps saying which buffers should have their own special frames.
-If a buffer name matches one of these regexps, it gets its own frame.
-Displaying a buffer whose name is in this list makes a special frame for it
-using `special-display-function'.
+When displaying a buffer with `display-buffer' or `pop-to-buffer',
+if any regexp in this list matches the buffer name, it makes a
+special frame for the buffer by calling `special-display-function'.
 
 An element of the list can be a list instead of just a string.
 There are two ways to use a list as an element:
--- a/src/xdisp.c	Tue Apr 26 12:17:42 2005 +0000
+++ b/src/xdisp.c	Mon May 02 14:38:00 2005 +0000
@@ -7901,8 +7901,6 @@
   const char *s = (const char *) a1;
   Lisp_Object string = a2;
 
-  xassert (BEG == Z);
-
   /* Change multibyteness of the echo buffer appropriately.  */
   if (message_enable_multibyte
       != !NILP (current_buffer->enable_multibyte_characters))
--- a/src/xfaces.c	Tue Apr 26 12:17:42 2005 +0000
+++ b/src/xfaces.c	Mon May 02 14:38:00 2005 +0000
@@ -336,6 +336,8 @@
 
 Lisp_Object Qface_alias;
 
+extern Lisp_Object Qcircular_list;
+
 /* Default stipple pattern used on monochrome displays.  This stipple
    pattern is used on monochrome displays instead of shades of gray
    for a face background color.  See `set-face-stipple' for possible
@@ -471,7 +473,7 @@
 
 static void map_tty_color P_ ((struct frame *, struct face *,
 			       enum lface_attribute_index, int *));
-static Lisp_Object resolve_face_name P_ ((Lisp_Object));
+static Lisp_Object resolve_face_name P_ ((Lisp_Object, int));
 static int may_use_scalable_font_p P_ ((const char *));
 static void set_font_frame_param P_ ((Lisp_Object, Lisp_Object));
 static int better_font_p P_ ((int *, struct font_name *, struct font_name *,
@@ -3220,27 +3222,47 @@
 }
 
 /* Resolve face name FACE_NAME.  If FACE_NAME is a string, intern it
-   to make it a symvol.  If FACE_NAME is an alias for another face,
-   return that face's name.  */
+   to make it a symbol.  If FACE_NAME is an alias for another face,
+   return that face's name.
+
+   Return default face in case of errors.  */
 
 static Lisp_Object
-resolve_face_name (face_name)
+resolve_face_name (face_name, signal_p)
      Lisp_Object face_name;
-{
-  Lisp_Object aliased;
-  int alias_loop_max = 10;
+     int signal_p;
+{
+  Lisp_Object orig_face;
+  Lisp_Object tortoise, hare;
 
   if (STRINGP (face_name))
     face_name = intern (SDATA (face_name));
 
-  while (SYMBOLP (face_name))
-    {
-      aliased = Fget (face_name, Qface_alias);
-      if (NILP (aliased))
+  if (NILP (face_name) || !SYMBOLP (face_name))
+    return face_name;
+
+  orig_face = face_name;
+  tortoise = hare = face_name;
+
+  while (1)
+    {
+      face_name = hare;
+      hare = Fget (hare, Qface_alias);
+      if (NILP (hare) || !SYMBOLP (hare))
 	break;
-      if (--alias_loop_max == 0)
+
+      face_name = hare;
+      hare = Fget (hare, Qface_alias);
+      if (NILP (hare) || !SYMBOLP (hare))
 	break;
-      face_name = aliased;
+
+      tortoise = Fget (tortoise, Qface_alias);
+      if (EQ (hare, tortoise))
+	{
+	  if (signal_p)
+	    Fsignal (Qcircular_list, Fcons (orig_face, Qnil));
+	  return Qdefault;
+	}
     }
 
   return face_name;
@@ -3264,7 +3286,7 @@
 {
   Lisp_Object lface;
 
-  face_name = resolve_face_name (face_name);
+  face_name = resolve_face_name (face_name, signal_p);
 
   if (f)
     lface = assq_no_quit (face_name, f->face_alist);
@@ -3999,7 +4021,7 @@
   CHECK_SYMBOL (face);
   CHECK_SYMBOL (attr);
 
-  face = resolve_face_name (face);
+  face = resolve_face_name (face, 1);
 
   /* If FRAME is 0, change face on all frames, and change the
      default for new frames.  */