changeset 83428:d0eee3282e6b

Merged from miles@gnu.org--gnu-2005 (patch 678-680) Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-678 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-679 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-680 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-468
author Karoly Lorentey <lorentey@elte.hu>
date Thu, 29 Dec 2005 04:41:02 +0000
parents 2afc49c9f0c0 (current diff) 063e68f9e91f (diff)
children ec395f552d45
files ChangeLog configure.in etc/TODO lisp/ChangeLog lisp/font-lock.el lisp/progmodes/delphi.el lisp/simple.el lisp/url/url-cookie.el lisp/url/url.el lisp/vc.el lispref/ChangeLog man/ChangeLog src/macterm.c src/macterm.h src/minibuf.c src/xfns.c src/xmenu.c
diffstat 78 files changed, 5167 insertions(+), 3708 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Dec 29 04:31:04 2005 +0000
+++ b/ChangeLog	Thu Dec 29 04:41:02 2005 +0000
@@ -1,3 +1,7 @@
+2005-12-25  Giorgos Keramidas  <keramida@ceid.upatras.gr> (tiny change)
+
+	* configure.in: use amdx86-64 for freebsd on x86_64.
+
 2005-11-22  Romain Francoise  <romain@orebokech.com>
 
 	* make-dist: Add etc/images/icons.
--- a/configure.in	Thu Dec 29 04:31:04 2005 +0000
+++ b/configure.in	Thu Dec 29 04:41:02 2005 +0000
@@ -238,6 +238,7 @@
     case "${canonical}" in
       alpha*-*-freebsd*)	machine=alpha ;;
       i[3456]86-*-freebsd*)	machine=intel386 ;;
+      amd64-*-freebsd*|x86_64-*-freebsd*) machine=amdx86-64 ;;
     esac
   ;;
 
--- a/etc/ChangeLog	Thu Dec 29 04:31:04 2005 +0000
+++ b/etc/ChangeLog	Thu Dec 29 04:41:02 2005 +0000
@@ -1,3 +1,7 @@
+2005-12-21  L$,1 q(Brentey K,Aa(Broly  <lorentey@elte.hu>
+
+	* TODO: Add note on the multi-tty branch.
+
 2005-12-16  L$,1 q(Brentey K,Aa(Broly  <lorentey@elte.hu>
 
 	* NEWS: Change `prev-buffer' to `previous-buffer'; add note on
--- a/etc/TODO	Thu Dec 29 04:31:04 2005 +0000
+++ b/etc/TODO	Thu Dec 29 04:41:02 2005 +0000
@@ -240,10 +240,8 @@
 ** Highlight rectangles (`mouse-track-rectangle-p' in XEmacs).  Already in CUA,
   but it's a valuable feature worth making more general.
 
-** Support simultaneous tty and X frames.  [For a partial
-  implementation, see tla branch
-  lorentey@elte.hu--2004/emacs--multi-tty--0 at
-  http://lorentey.hu/arch/2004]
+** Support simultaneous tty and X frames.  [See the multi-tty branch of Emacs 
+  at http://lorentey.hu/project/emacs.]
 
 ** Provide MIME support for Rmail using the Gnus MIME library.  [Maybe
   not now feasible, given Gnus maintenance decisions.  fx looked at
@@ -419,6 +417,12 @@
 ** Provide the toolbar on ttys. This could map a bit like tmm-menubar
    for the menubar and buttons could look a bit like those used by customize.
 
+** Improve Help buffers: Change the face of previously visited links (like
+   Info, but also with regard to namespace), add a forward button to make the
+   Help buffer more browser like and gives the value of lisp expressions
+   e.g auto-mode-alist, the right face. [nickrob@snap.net.nz has a patch
+   for this for inclusion after 22.1].
+
 * Internal changes
 
 ** Replace gmalloc.c with the modified Doug Lea code from the current
--- a/lib-src/ChangeLog	Thu Dec 29 04:31:04 2005 +0000
+++ b/lib-src/ChangeLog	Thu Dec 29 04:41:02 2005 +0000
@@ -1,3 +1,7 @@
+2005-12-22  Richard M. Stallman  <rms@gnu.org>
+
+	* Makefile.in (update-game-score.o): Delete spurious final `\'.
+
 2005-11-18  Hideki IWAMOTO <h-iwamoto@kit.hi-ho.ne.jp>  (tiny change)
 
 	* etags.c (main): Cxref mode writes to stdout: do not close tagf,
--- a/lib-src/Makefile.in	Thu Dec 29 04:31:04 2005 +0000
+++ b/lib-src/Makefile.in	Thu Dec 29 04:41:02 2005 +0000
@@ -465,7 +465,7 @@
 
 update-game-score.o: ${srcdir}/update-game-score.c ../src/config.h $(GETOPT_H)
 	$(CC) -c ${CPP_CFLAGS} ${srcdir}/update-game-score.c \
-	  -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
+	  -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\""
 
 /* These are NOT included in INSTALLABLES or UTILITIES.
    See ../src/Makefile.in.  */
--- a/lisp/ChangeLog	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/ChangeLog	Thu Dec 29 04:41:02 2005 +0000
@@ -1,3 +1,206 @@
+2005-12-25  Richard M. Stallman  <rms@gnu.org>
+
+	* progmodes/delphi.el (delphi-other-face): Allow nil in type.
+
+	* locate.el (locate-header-face): Allow nil in type.
+
+	* progmodes/cpp.el (cpp-face-none-list): Use cpp-face instead of face.
+
+2005-12-25  Romain Francoise  <romain@orebokech.com>
+
+	* battery.el (battery-linux-proc-acpi): Also try
+	`/proc/acpi/thermal_zone/THM0/temperature'.
+
+2005-12-24  Chong Yidong  <cyd@stupidchicken.com>
+
+	* custom.el (custom-push-theme): Fix docstring.
+
+	* cus-edit.el (custom-variable-set, custom-variable-save,
+	custom-variable-save): Custom-quote widget values.
+	(customize-save-variable): Fix custom-push-theme call.
+
+2005-12-24  Eli Zaretskii  <eliz@gnu.org>
+
+	* w32-fns.el (w32-batch-update-autoloads): New function.
+
+	* makefile.w32-in (autoloads, $(lisp)/mh-e/mh-loaddefs.el): Use
+	w32-batch-update-autoloads, and don't setq generated-autoload-file
+	from the command line.
+
+2005-12-23  Chong Yidong  <cyd@stupidchicken.com>
+
+	* custom.el (custom-push-theme): Clarify docstring.  VALUE nil for
+	reset means to remove setting from theme entirely.  Don't keep
+	expanding theme-settings list; delete old entries if necessary.
+
+	* cus-edit.el (custom-buffer-create-internal): Move "Erase
+	customization" button one line up.
+	(custom-themed): New face.
+	(custom-magic-alist): New value, THEMED, for theme settings.
+	(custom-variable-state-set, custom-face-state-set): Check
+	theme-value instead of saved-value.
+	(custom-variable-reset-standard, custom-face-reset-standard):
+	Remove theme setting entirely.  Recalculate new values.
+	(custom-variable-set, custom-variable-set)
+	(custom-variable-reset-saved, custom-variable-reset-backup)
+	(custom-face-set, custom-face-reset-saved): Update `user' theme.
+	(custom-variable-save): Fix typos.
+	
+2005-12-23  Juri Linkov  <juri@jurta.org>
+
+	* emacs-lisp/edebug.el (edebug-all-defs, edebug-all-forms):
+	Add autoload cookies.
+	(edebug-outside-d-c-i-n-s-w): New variable.
+	(edebug-display, edebug-outside-excursion): Use it to save the
+	original value of default-cursor-in-non-selected-windows.
+	Set default-cursor-in-non-selected-windows to t while Edebug
+	is active.
+	(edebug-mode, edebug-eval-mode): Doc fix.
+
+	* mouse.el (mouse-choose-completion): Replace `buffer-substring'
+	with `buffer-substring-no-properties' to remove common substring
+	highlighting.
+
+	* info.el (info-other-window, info): Rename function argument
+	`file' to `file-or-node'.
+	(Info-complete-menu-item): Use local variable `complete-nodes' to
+	keep the global value of `Info-complete-nodes' unchanged for
+	subsequent completions.
+	(info-tool-bar-map): Put `Info-index' icon just before `Info-search'.
+
+	* simple.el (get-next-valid-buffer, last-buffer)
+	(next-error-buffer-p, next-error-find-buffer)
+	(minibuffer-history-sexp-flag): Doc fix.
+
+	* savehist.el (savehist-mode-hook): Add `:group'.
+
+	* log-view.el: Call autoload for vc-find-version.
+	(log-view-current-file): Adjust subgroup numbers.
+	(log-view-current-tag): Add `length'.
+
+2005-12-23  Richard M. Stallman  <rms@gnu.org>
+
+	* vc.el (vc-annotate-car-last-cons): Defn moved up.
+
+2005-12-23  Juri Linkov  <juri@jurta.org>
+
+	* hi-lock.el (hi-lock-archaic-interface-message-used)
+	(hi-lock-archaic-interface-deduce, hi-lock-mode): Doc fix.
+	(hi-lock-mode): Display "Hi" in the mode line only when
+	hi-lock-interactive-patterns or hi-lock-file-patterns is non-nil.
+	(hi-lock-write-interactive-patterns):
+	Use hi-lock-file-patterns-prefix instead of hard-coded "Hi-lock".
+	(hi-lock-set-pattern, hi-lock-set-file-patterns)
+	(hi-lock-font-lock-hook): Set 3rd arg `how' of
+	font-lock-add-keywords to t.
+
+2005-12-23  David Koppelman  <koppel@ece.lsu.edu>
+
+	* hi-lock.el (hi-lock-highlight-range): New variable.
+	(hi-lock-mode, hi-lock-unface-buffer): Call font-lock-fontify-buffer
+	only if font-lock-fontified is non-nil.  Remove overlays.
+	(hi-lock-set-pattern): Call font-lock-fontify-buffer if
+	font-lock-fontified is non-nil, otherwise use overlays (instead of
+	text properties).
+	(hi-lock-string-serialize-hash, hi-lock-string-serialize-serial):
+	New variables.
+	(hi-lock-string-serialize) New function.
+
+2005-12-23  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* menu-bar.el (menu-find-file-existing): New function.
+	(menu-bar-file-menu): Use menu-find-file-existing for Open.
+
+	* tool-bar.el (tool-bar-setup): open changed to menu-find-file-existing.
+
+2005-12-22  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* vc.el: Remove unnecessary leading * in docstrings.
+	(vc-annotate-mode-map): Move initialization into declaration.
+	(vc-static-header-alist): Nitpick on the regexp.
+	(vc-default-init-version): New fun.
+	(vc-register): Use it.
+	(vc-insert-headers): Use dolist.
+	(vc-annotate-get-backend): Remove unused function.
+	(vc-annotate-add-menu): Remove.  Build the menu directly at toplevel.
+	(vc-annotate-mode): Remove corresponding call.
+	(vc-annotate-car-last-cons): Simplify.
+	(vc-annotate-buffers): Remove var.
+	(vc-annotate-backend): Make it buffer-local.
+	(vc-annotate): Move the interaction to the interactive spec.
+	Add a `buf' argument.
+	(vc-annotate-warp-version): Use this new `buf' argument to avoid
+	killing&creating a vc-annotate buffer, which is very disruptive when
+	the buffers are shown in dedicated frames.
+
+2005-12-23  Nick Roberts  <nickrob@snap.net.nz>
+
+	* descr-text.el: Add FSF as maintainer.
+	(describe-text-mode, describe-text-mode-map)
+	(describe-text-mode-hook, describe-text-done): Delete.  Use normal
+	help-mode.
+	(describe-text-widget, describe-text-sexp)
+	(describe-property-list, describe-text-category)
+	(describe-text-properties, describe-text-properties-1)
+	(describe-char): Use help buttons instead of widgets.
+	(describe-char-unicodedata-file): Make URL link in doc string.
+
+2005-12-22  Richard M. Stallman  <rms@gnu.org>
+
+	* cus-edit.el (custom-variable-prompt): Say "variable" in prompt.
+	(custom-buffer-create-internal): Reword the top-of-buffer help intro.
+	Don't include buttons that write a file when there's no file.
+	(custom-variable-menu, custom-face-menu, custom-group-menu):
+	Don't include commands that write a file when there's no file.
+	(customize-browse): Reword the top-of-buffer help intro.
+	(custom-buffer-create-internal): Fix previous change.
+	(customize-changed-options-previous-release): Prev release is 21.1.
+	(customize-changed-options): Doc fix.
+	(customize-changed): New alias.
+	(custom-reset-menu, custom-magic-alist, Custom-mode-menu):
+	Say "standard values".
+	(Custom-reset-standard): Doc fix.
+	(custom-face-reset-standard): Doc fix.
+
+2005-12-22  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* font-lock.el (font-lock-default-fontify-buffer): Try and set-defaults
+	even if font-lock-mode is non-nil since it may be t without having
+	turned on font-lock-mode-internal.
+	(font-lock-choose-keywords): Minor optimization.
+	(font-lock-add-keywords, font-lock-remove-keywords)
+	(font-lock-set-defaults): Don't call make-local-variable on a variable
+	that we know to already be local.
+
+2005-12-22  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* emacs-lisp/lisp.el (lisp-complete-symbol): Don't print progress
+	messages if in the minibuffer.
+
+2005-12-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* textmodes/flyspell.el (flyspell-check-word-p): Don't quote - in a RE.
+	(tex-mode-flyspell-verify, flyspell-get-word)
+	(flyspell-external-point-words): Don't use point-min/max uselessly.
+
+	* emacs-lisp/lisp.el (lisp-complete-symbol): Mostly undo the change
+	by Kevin Rodgers.  Instead, just hide the completions buffer if we
+	don't need to show it.
+
+2005-12-21  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* wid-edit.el (file, directory): Doc fixes for the `define-widget's.
+
+2005-12-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* emacs-lisp/lisp.el (lisp-complete-symbol): Don't call
+	delete-windows-on with an inexistent buffer.
+
+2005-12-22  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gud.el (gud-tooltip-modes, gud-tooltip-display):
+	Delete defcustom variable :tag names.
+
 2005-12-20  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* log-view.el (log-view-file-re, log-view-message-re): Use shy groups.
@@ -5506,7 +5709,7 @@
 	* progmodes/gud.el (gud-speedbar-menu-items): Use :visible
 	instead of :active.
 
-2005-10-08  Eric Hanchrow  <offby1@blarg.net>
+2005-10-08  Eric Hanchrow  <offby1@blarg.net>  (tiny change)
 
 	* textmodes/ispell.el (ispell-check-version):
 	Ignore hyphen, and all that follows, in aspell's version text.
--- a/lisp/battery.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/battery.el	Thu Dec 29 04:41:02 2005 +0000
@@ -347,6 +347,14 @@
 			   (when (re-search-forward
 				  "temperature: +\\([0-9]+\\) C$" nil t)
 			     (match-string 1))))
+		       (when (file-exists-p
+			      "/proc/acpi/thermal_zone/THM0/temperature")
+			 (with-temp-buffer
+			   (insert-file-contents
+			    "/proc/acpi/thermal_zone/THM0/temperature")
+			   (when (re-search-forward
+				  "temperature: +\\([0-9]+\\) C$" nil t)
+			     (match-string 1))))
 		       "N/A"))
 	  (cons ?r (or (and rate (concat (number-to-string rate) " "
 					 rate-type)) "N/A"))
--- a/lisp/cus-edit.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/cus-edit.el	Thu Dec 29 04:41:02 2005 +0000
@@ -506,8 +506,8 @@
 	  (enable-recursive-minibuffers t)
 	  val)
      (setq val (completing-read
-		(if default (format "Customize option (default %s): " default)
-		  "Customize option: ")
+		(if default (format "Customize variable (default %s): " default)
+		  "Customize variable: ")
 		obarray 'custom-variable-p t nil nil default))
      (list (if (equal val "")
 	       (if (symbolp v) v nil)
@@ -766,7 +766,7 @@
 (defvar custom-reset-menu
   '(("Current" . Custom-reset-current)
     ("Saved" . Custom-reset-saved)
-    ("Erase Customization (use standard settings)" . Custom-reset-standard))
+    ("Erase Customization (use standard values)" . Custom-reset-standard))
   "Alist of actions for the `Reset' button.
 The key is a string containing the name of the action, the value is a
 Lisp function taking the widget as an element which will be called
@@ -803,8 +803,8 @@
 
 (defun Custom-reset-standard (&rest ignore)
   "Erase all customization (either current or saved) for the group members.
-The immediate result is to restore them to their standard settings.
-This operation eliminates any saved settings for the group members,
+The immediate result is to restore them to their standard values.
+This operation eliminates any saved values for the group members,
 making them as if they had never been customized at all."
   (interactive)
   (let ((children custom-options))
@@ -940,7 +940,7 @@
 				       current-prefix-arg))
   (funcall (or (get variable 'custom-set) 'set-default) variable value)
   (put variable 'saved-value (list (custom-quote value)))
-  (custom-push-theme 'theme-value variable 'user 'set (list (custom-quote value)))
+  (custom-push-theme 'theme-value variable 'user 'set (custom-quote value))
   (cond ((string= comment "")
  	 (put variable 'variable-comment nil)
  	 (put variable 'saved-variable-comment nil))
@@ -1065,19 +1065,21 @@
     (unless (eq symbol basevar)
       (message "`%s' is an alias for `%s'" symbol basevar))))
 
-(defvar customize-changed-options-previous-release "20.2"
+(defvar customize-changed-options-previous-release "21.1"
   "Version for `customize-changed-options' to refer back to by default.")
 
 ;;;###autoload
+(defalias 'customize-changed 'customize-changed-options)
+
+;;;###autoload
 (defun customize-changed-options (since-version)
-  "Customize all user option variables changed in Emacs itself.
+  "Customize all settings whose meanings have changed in Emacs itself.
 This includes new user option variables and faces, and new
-customization groups, as well as older options and faces whose default
-values have changed since the previous major Emacs release.
-
-With argument SINCE-VERSION (a string), customize all user option
-variables that were added (or their meanings were changed) since that
-version."
+customization groups, as well as older options and faces whose meanings
+or default values have changed since the previous major Emacs release.
+
+With argument SINCE-VERSION (a string), customize all settings
+that were added or redefined since that version."
 
   (interactive "sCustomize options changed, since version (default all versions): ")
   (if (equal since-version "")
@@ -1430,25 +1432,25 @@
 	(if description
 	    (widget-insert description))
 	(widget-insert (format ".
-%s show active fields; type RET or click mouse-1
-on an active field to invoke its action.  Editing an option value
-changes only the text in the buffer.  Invoke the State button to set or
-save the option value.  Saving an option normally edits your init file.
-Invoke "
+%s buttons; type RET or click mouse-1 to actuate one.
+Editing a setting changes only the text in the buffer.
+Use the setting's State button to set it or save changes in it.
+Saving a change normally works by editing your Emacs init file.
+See "
 			       (if custom-raised-buttons
-				   "`Raised' buttons"
-				 "Square brackets")))
+				   "`Raised' text indicates"
+				 "Square brackets indicate")))
 	(widget-create 'info-link
 		       :tag "Custom file"
 		       "(emacs)Saving Customizations")
 	(widget-insert
-	 " for information on how to save in a different file.
-Invoke ")
+	 " for information on how to save in a different file.\n
+See ")
 	(widget-create 'info-link
 		       :tag "Help"
 		       :help-echo "Read the online help."
 		       "(emacs)Easy Customization")
-	(widget-insert " for general information.\n\n")
+	(widget-insert " for more information.\n\n")
 	(widget-insert "Operate on everything in this buffer:\n "))
     (widget-insert " "))
   (widget-create 'push-button
@@ -1457,14 +1459,15 @@
 Make your editing in this buffer take effect for this session."
 		 :action (lambda (widget &optional event)
 			   (Custom-set)))
-  (widget-insert " ")
-  (widget-create 'push-button
-		 :tag "Save for Future Sessions"
-		 :help-echo "\
+  (when (or custom-file user-init-file)
+    (widget-insert " ")
+    (widget-create 'push-button
+		   :tag "Save for Future Sessions"
+		   :help-echo "\
 Make your editing in this buffer take effect for future Emacs sessions.
 This updates your Emacs initialization file or creates a new one."
-		 :action (lambda (widget &optional event)
-			   (Custom-save)))
+		   :action (lambda (widget &optional event)
+			     (Custom-save))))
   (if custom-reset-button-menu
       (progn
 	(widget-insert " ")
@@ -1474,6 +1477,13 @@
 		       :mouse-down-action (lambda (&rest junk) t)
 		       :action (lambda (widget &optional event)
 				 (custom-reset event))))
+    (widget-insert " ")
+    (when (or custom-file user-init-file)
+      (widget-create 'push-button
+		     :tag "Erase Customization"
+		     :help-echo "\
+Un-customize all settings in this buffer--save them with standard values."
+		     :action 'Custom-reset-standard)))
     (widget-insert "\n ")
     (widget-create 'push-button
 		   :tag "Reset to Current"
@@ -1484,14 +1494,8 @@
     (widget-create 'push-button
 		   :tag "Reset to Saved"
 		   :help-echo "\
-Reset all values in this buffer to their saved settings."
+Reset all settings in this buffer to their saved values."
 		   :action 'Custom-reset-saved)
-    (widget-insert " ")
-    (widget-create 'push-button
-		   :tag "Erase Customization"
-		   :help-echo "\
-Un-customize all values in this buffer.  They get their standard settings."
-		   :action 'Custom-reset-standard))
   (if (not custom-buffer-verbose-help)
       (progn
 	(widget-insert " ")
@@ -1560,10 +1564,15 @@
   (let ((name "*Customize Browser*"))
     (pop-to-buffer (custom-get-fresh-buffer name)))
   (custom-mode)
-  (widget-insert "\
-Square brackets show active fields; type RET or click mouse-1
-on an active field to invoke its action.
-Invoke [+] below to expand a group, and [-] to collapse an expanded group.\n")
+  (widget-insert (format "\
+%s buttons; type RET or click mouse-1
+on a button to invoke its action.
+Invoke [+] to expand a group, and [-] to collapse an expanded group.\n"
+			 (if custom-raised-buttons
+			     "`Raised' text indicates"
+			   "Square brackets indicate")))
+
+
   (if custom-browse-only-groups
       (widget-insert "\
 Invoke the [Group] button below to edit that item in another window.\n\n")
@@ -1738,6 +1747,15 @@
 ;; backward-compatibility alias
 (put 'custom-changed-face 'face-alias 'custom-changed)
 
+(defface custom-themed '((((min-colors 88) (class color))
+			   (:foreground "white" :background "blue1"))
+			  (((class color))
+			   (:foreground "white" :background "blue"))
+			  (t
+			   (:slant italic)))
+  "Face used when the customize item has been set by a theme."
+  :group 'custom-magic-faces)
+
 (defface custom-saved '((t (:underline t)))
   "Face used when the customize item has been saved."
   :group 'custom-magic-faces)
@@ -1766,12 +1784,15 @@
     (saved "!" custom-saved "\
 SAVED and set." "\
 something in this group has been set and saved.")
+    (themed "o" custom-themed "\
+THEMED." "\
+visible group members are all at standard values.")
     (rogue "@" custom-rogue "\
 NO CUSTOMIZATION DATA; not intended to be customized." "\
 something in this group is not prepared for customization.")
     (standard " " nil "\
 STANDARD." "\
-visible group members are all at standard settings."))
+visible group members are all at standard values."))
   "Alist of customize option states.
 Each entry is of the form (STATE MAGIC FACE ITEM-DESC [ GROUP-DESC ]), where
 
@@ -2524,14 +2545,22 @@
 			     (error nil))
 			   'set
 			 'changed))
-		      ((progn (setq tmp (get symbol 'saved-value))
+		      ((progn (setq tmp (get symbol 'theme-value))
 			      (setq temp (get symbol 'saved-variable-comment))
 			      (or tmp temp))
 		       (if (condition-case nil
-			       (and (equal value (eval (car tmp)))
-				    (equal comment temp))
+			       (and (equal comment temp)
+				    (equal value
+					   (eval (car
+						  (custom-theme-value
+						   (caar tmp) tmp)))))
 			     (error nil))
-			   'saved
+			   (cond
+			    ((eq 'user (caar (get symbol 'theme-value)))
+			     'saved)
+			    ((eq 'standard (caar (get symbol 'theme-value)))
+			     'changed)
+			    (t 'themed))
 			 'changed))
 		      ((setq tmp (get symbol 'standard-value))
 		       (if (condition-case nil
@@ -2547,12 +2576,13 @@
   (get (widget-value widget) 'standard-value))
 
 (defvar custom-variable-menu
-  '(("Set for Current Session" custom-variable-set
+  `(("Set for Current Session" custom-variable-set
      (lambda (widget)
        (eq (widget-get widget :custom-state) 'modified)))
-    ("Save for Future Sessions" custom-variable-save
-     (lambda (widget)
-       (memq (widget-get widget :custom-state) '(modified set changed rogue))))
+    ,@(when (or custom-file user-init-file)
+	'(("Save for Future Sessions" custom-variable-save
+	   (lambda (widget)
+	     (memq (widget-get widget :custom-state) '(modified set changed rogue))))))
     ("Reset to Current" custom-redraw
      (lambda (widget)
        (and (default-boundp (widget-value widget))
@@ -2563,11 +2593,12 @@
 		(get (widget-value widget) 'saved-variable-comment))
 	    (memq (widget-get widget :custom-state)
 		  '(modified set changed rogue)))))
-    ("Erase Customization" custom-variable-reset-standard
-     (lambda (widget)
-       (and (get (widget-value widget) 'standard-value)
-	    (memq (widget-get widget :custom-state)
-		  '(modified set changed saved rogue)))))
+    ,@(when (or custom-file user-init-file)
+	'(("Erase Customization" custom-variable-reset-standard
+	   (lambda (widget)
+	     (and (get (widget-value widget) 'standard-value)
+		  (memq (widget-get widget :custom-state)
+			'(modified set changed saved rogue)))))))
     ("Use Backup Value" custom-variable-reset-backup
      (lambda (widget)
        (get (widget-value widget) 'backup-value)))
@@ -2638,6 +2669,8 @@
 	     ;; Make the comment invisible by hand if it's empty
 	     (custom-comment-hide comment-widget))
 	   (custom-variable-backup-value widget)
+	   (custom-push-theme 'theme-value symbol 'user
+			      'set (custom-quote (widget-value child)))
 	   (funcall set symbol (eval (setq val (widget-value child))))
 	   (put symbol 'customized-value (list val))
 	   (put symbol 'variable-comment comment)
@@ -2648,6 +2681,8 @@
 	     ;; Make the comment invisible by hand if it's empty
 	     (custom-comment-hide comment-widget))
 	   (custom-variable-backup-value widget)
+	   (custom-push-theme 'theme-value symbol 'user
+			      'set (custom-quote (widget-value child)))
 	   (funcall set symbol (setq val (widget-value child)))
 	   (put symbol 'customized-value (list (custom-quote val)))
 	   (put symbol 'variable-comment comment)
@@ -2677,7 +2712,7 @@
 	     (custom-comment-hide comment-widget))
 	   (put symbol 'saved-value (list (widget-value child)))
 	   (custom-push-theme 'theme-value symbol 'user
-			      'set (list (widget-value child)))
+			      'set (custom-quote (widget-value child)))
 	   (funcall set symbol (eval (widget-value child)))
 	   (put symbol 'variable-comment comment)
 	   (put symbol 'saved-variable-comment comment))
@@ -2689,8 +2724,7 @@
 	   (put symbol 'saved-value
 		(list (custom-quote (widget-value child))))
 	   (custom-push-theme 'theme-value symbol 'user
-			      'set (list (custom-quote (widget-value
-						  child))))
+			      'set (custom-quote (widget-value child)))
 	   (funcall set symbol (widget-value child))
 	   (put symbol 'variable-comment comment)
 	   (put symbol 'saved-variable-comment comment)))
@@ -2711,6 +2745,7 @@
     (cond ((or value comment)
 	   (put symbol 'variable-comment comment)
 	   (custom-variable-backup-value widget)
+	   (custom-push-theme 'theme-value symbol 'user 'set value)
 	   (condition-case nil
 	       (funcall set symbol (eval (car value)))
 	     (error nil)))
@@ -2731,20 +2766,15 @@
   (let* ((symbol (widget-value widget))
 	 (set (or (get symbol 'custom-set) 'set-default)))
     (if (get symbol 'standard-value)
-	(progn
-	  (custom-variable-backup-value widget)
-	  (funcall set symbol (eval (car (get symbol 'standard-value)))))
+	(custom-variable-backup-value widget)
       (error "No standard setting known for %S" symbol))
     (put symbol 'variable-comment nil)
     (put symbol 'customized-value nil)
     (put symbol 'customized-variable-comment nil)
+    (custom-push-theme 'theme-value symbol 'user 'reset nil)
+    (custom-theme-recalc-variable symbol)
     (when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment))
       (put symbol 'saved-value nil)
-      (custom-push-theme 'theme-value symbol 'user 'reset 'standard)
-      ;; As a special optimizations we do not (explictly)
-      ;; save resets to standard when no theme set the value.
-      (if (null (cdr (get symbol 'theme-value)))
-	  (put symbol 'theme-value nil))
       (put symbol 'saved-variable-comment nil)
       (custom-save-all))
     (widget-put widget :custom-state 'unknown)
@@ -2776,6 +2806,7 @@
     (if value
 	(progn
 	  (custom-variable-backup-value widget)
+	  (custom-push-theme 'theme-value symbol 'user 'set value)
 	  (condition-case nil
 	      (funcall set symbol (car value))
 	     (error nil)))
@@ -3218,15 +3249,17 @@
 	     (message "Creating face editor...done"))))))
 
 (defvar custom-face-menu
-  '(("Set for Current Session" custom-face-set)
-    ("Save for Future Sessions" custom-face-save-command)
+  `(("Set for Current Session" custom-face-set)
+    ,@(when (or custom-file user-init-file)
+	'(("Save for Future Sessions" custom-face-save-command)))
     ("Reset to Saved" custom-face-reset-saved
      (lambda (widget)
        (or (get (widget-value widget) 'saved-face)
 	   (get (widget-value widget) 'saved-face-comment))))
-    ("Erase Customization" custom-face-reset-standard
-     (lambda (widget)
-       (get (widget-value widget) 'face-defface-spec)))
+    ,@(when (or custom-file user-init-file)
+	'(("Erase Customization" custom-face-reset-standard
+	   (lambda (widget)
+	     (get (widget-value widget) 'face-defface-spec)))))
     ("---" ignore ignore)
     ("Add Comment" custom-comment-show custom-comment-invisible-p)
     ("---" ignore ignore)
@@ -3282,7 +3315,12 @@
 		   (setq temp (get symbol 'saved-face-comment))
 		   (or tmp temp))
 		 (if (equal temp comment)
-		     'saved
+		     (cond
+		      ((eq 'user (caar (get symbol 'theme-face)))
+		       'saved)
+		      ((eq 'standard (caar (get symbol 'theme-face)))
+		       'changed)
+		      (t 'themed))
 		   'changed))
 		((get symbol 'face-defface-spec)
 		 (if (equal comment nil)
@@ -3329,6 +3367,7 @@
       ;; face-set-spec ignores empty attribute lists, so just give it
       ;; something harmless instead.
       (face-spec-set symbol '((t :foreground unspecified))))
+    (custom-push-theme 'theme-face symbol 'user 'set value)
     (put symbol 'customized-face-comment comment)
     (put symbol 'face-comment comment)
     (custom-face-state-set widget)
@@ -3377,6 +3416,7 @@
       (error "No saved value for this face"))
     (put symbol 'customized-face nil)
     (put symbol 'customized-face-comment nil)
+    (custom-push-theme 'theme-face symbol 'user 'set value)
     (face-spec-set symbol value)
     (put symbol 'face-comment comment)
     (widget-value-set child value)
@@ -3389,8 +3429,8 @@
   (get (widget-value widget) 'face-defface-spec))
 
 (defun custom-face-reset-standard (widget)
-  "Restore WIDGET to the face's standard settings.
-This operation eliminates any saved setting for the face,
+  "Restore WIDGET to the face's standard attribute values.
+This operation eliminates any saved attributes for the face,
 restoring it to the state of a face that has never been customized."
   (let* ((symbol (widget-value widget))
 	 (child (car (widget-get widget :children)))
@@ -3400,15 +3440,12 @@
       (error "No standard setting for this face"))
     (put symbol 'customized-face nil)
     (put symbol 'customized-face-comment nil)
+    (custom-push-theme 'theme-face symbol 'user 'reset nil)
+    (custom-theme-recalc-face symbol)
     (when (or (get symbol 'saved-face) (get symbol 'saved-face-comment))
       (put symbol 'saved-face nil)
-      (custom-push-theme 'theme-face symbol 'user 'reset 'standard)
-      ;; Do not explictly save resets to standards without themes.
-      (if (null (cdr (get symbol 'theme-face)))
-	  (put symbol  'theme-face nil))
       (put symbol 'saved-face-comment nil)
       (custom-save-all))
-    (face-spec-set symbol value)
     (put symbol 'face-comment nil)
     (widget-value-set child value)
     ;; This call manages the comment visibility
@@ -3808,21 +3845,23 @@
 	   (insert "/\n")))))
 
 (defvar custom-group-menu
-  '(("Set for Current Session" custom-group-set
+  `(("Set for Current Session" custom-group-set
      (lambda (widget)
        (eq (widget-get widget :custom-state) 'modified)))
-    ("Save for Future Sessions" custom-group-save
-     (lambda (widget)
-       (memq (widget-get widget :custom-state) '(modified set))))
+    ,@(when (or custom-file user-init-file)
+	'(("Save for Future Sessions" custom-group-save
+	   (lambda (widget)
+	     (memq (widget-get widget :custom-state) '(modified set))))))
     ("Reset to Current" custom-group-reset-current
      (lambda (widget)
        (memq (widget-get widget :custom-state) '(modified))))
     ("Reset to Saved" custom-group-reset-saved
      (lambda (widget)
        (memq (widget-get widget :custom-state) '(modified set))))
-    ("Reset to standard setting" custom-group-reset-standard
-     (lambda (widget)
-       (memq (widget-get widget :custom-state) '(modified set saved)))))
+    ,@(when (or custom-file user-init-file)
+	'(("Reset to standard setting" custom-group-reset-standard
+	   (lambda (widget)
+	     (memq (widget-get widget :custom-state) '(modified set saved)))))))
   "Alist of actions for the `custom-group' widget.
 Each entry has the form (NAME ACTION FILTER) where NAME is the name of
 the menu entry, ACTION is the function to call on the widget when the
@@ -4326,7 +4365,7 @@
     ["Save" Custom-save t]
     ["Reset to Current" Custom-reset-current t]
     ["Reset to Saved" Custom-reset-saved t]
-    ["Reset to Standard Settings" Custom-reset-standard t]
+    ["Reset to Standard Values" Custom-reset-standard t]
     ["Info" (info "(emacs)Easy Customization") t]))
 
 (defun Custom-goto-parent ()
--- a/lisp/custom.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/custom.el	Thu Dec 29 04:41:02 2005 +0000
@@ -626,63 +626,75 @@
 
 MODE can be either the symbol `set' or the symbol `reset'.  If it is the
 symbol `set', then VALUE is the value to use.  If it is the symbol
-`reset', then VALUE is another theme, whose value for this face or
-variable should be used.
+`reset', then VALUE is either another theme, which means to use the
+value defined by that theme; or nil, which means to remove SYMBOL from
+THEME entirely.
 
-In the following example for the variable `goto-address-url-face', the
-theme `subtle-hacker' uses the same value for the variable as the theme
-`gnome2':
-
-  \((standard set bold)
-   \(gnome2 set info-xref)
-   \(jonadab set underline)
-   \(subtle-hacker reset gnome2))
+In the following example, the variable `goto-address-url-face' has been
+set by three different themes.  Its `theme-value' property is:
 
-
-If a value has been stored for themes A B and C, and a new value
-is to be stored for theme C, then the old value of C is discarded.
-If a new value is to be stored for theme B, however, the old value
-of B is not discarded because B is not the car of the list.
+  \((subtle-hacker reset gnome2)
+   \(jonadab set underline)
+   \(gnome2 set info-xref)
 
-For variables, list property PROP is `theme-value'.
-For faces, list property PROP is `theme-face'.
-This is used in `custom-do-theme-reset', for example.
+The theme value defined by `subtle-hacker' is in effect, because
+that theme currently has the highest precedence.  The theme
+`subtle-hacker' says to use the same value for the variable as
+the theme `gnome2'.  Therefore, the theme value of the variable
+is `info-xref'.  To change the precedence of the themes, use
+`enable-theme'.
 
-The list looks the same in any case; the examples shows a possible
-value of the `theme-face' property for the face `region':
+The user has not customized the variable; had he done that, the
+list would contain an entry for the `user' theme, too.
 
-  \((gnome2 set ((t (:foreground \"cyan\" :background \"dark cyan\"))))
-   \(standard set ((((class color) (background dark))
-		   \(:background \"blue\"))
-		  \(t (:background \"gray\")))))
-
-This records values for the `standard' and the `gnome2' themes.
-The user has not customized the face; had he done that,
-the list would contain an entry for the `user' theme, too.
 See `custom-known-themes' for a list of known themes."
+  (unless (or (eq prop 'theme-value)
+	      (eq prop 'theme-face))
+    (error "Unknown theme property"))
   (let* ((old (get symbol prop))
-	 (setting (assq theme old)))
-    ;; Alter an existing theme-setting for the symbol,
-    ;; or add a new one.
-    (if setting
-	(progn
-	  (setcar (cdr setting) mode)
-	  (setcar (cddr setting) value))
-      ;; If no custom theme has been applied yet, first save the
-      ;; current values to the 'standard theme.
-      (if (null old)
-	  (if (and (eq prop 'theme-value)
-		   (boundp symbol))
-	      (setq old
-		    (list (list 'standard 'set (symbol-value symbol))))
-	    (if (facep symbol)
-		(setq old (list (list 'standard 'set (list
-		  (append '(t) (custom-face-attributes-get symbol nil)))))))))
-      (put symbol prop (cons (list theme mode value) old)))
-    ;; Record, for each theme, all its settings.
-    (put theme 'theme-settings
-	 (cons (list prop symbol theme mode value)
-	       (get theme 'theme-settings)))))
+	 (setting (assq theme old))
+	 (theme-settings (get theme 'theme-settings)))
+    (if (and (eq mode 'reset) (null value))
+	;; Remove a setting.
+	(when setting
+	  (let (res)
+	    (dolist (theme-setting theme-settings)
+	      (if (and (eq (car  theme-setting) prop)
+		       (eq (cadr theme-setting) symbol))
+		  (setq res theme-setting)))
+	    (put theme 'theme-settings (delq res theme-settings)))
+	  (put symbol prop (delq setting old)))
+      (if setting
+	  ;; Alter an existing setting.
+	  (let (res)
+	    (dolist (theme-setting theme-settings)
+	      (if (and (eq (car  theme-setting) prop)
+		       (eq (cadr theme-setting) symbol))
+		  (setq res theme-setting)))
+	    (put theme 'theme-settings
+		 (cons (list prop symbol theme mode value)
+		       (delq res theme-settings)))
+	    (setcar (cdr setting) mode)
+	    (setcar (cddr setting) value))
+	;; Add a new setting.
+	;; If the user changed the value outside of Customize, we
+	;; first save the current value to a fake theme, `standard'.
+	;; This ensures that the user-set value comes back if the
+	;; theme is later disabled.
+	(if (null old)
+	    (if (and (eq prop 'theme-value)
+		     (boundp symbol)
+		     (or (null (get symbol 'standard-value))
+			 (not (equal (eval (car (get symbol 'standard-value)))
+				     (symbol-value symbol)))))
+		(setq old (list (list 'standard 'set (symbol-value symbol))))
+	      (if (facep symbol)
+		  (setq old (list (list 'standard 'set (list
+		    (append '(t) (custom-face-attributes-get symbol nil)))))))))
+	(put symbol prop (cons (list theme mode value) old))
+	(put theme 'theme-settings
+	     (cons (list prop symbol theme mode value)
+		   theme-settings))))))
 
 (defvar custom-local-buffer nil
   "Non-nil, in a Customization buffer, means customize a specific buffer.
--- a/lisp/descr-text.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/descr-text.el	Thu Dec 29 04:41:02 2005 +0000
@@ -4,6 +4,7 @@
 ;;   2005 Free Software Foundation, Inc.
 
 ;; Author: Boris Goldowsky <boris@gnu.org>
+;; Maintainer: FSF
 ;; Keywords: faces, i18n, Unicode, multilingual
 
 ;; This file is part of GNU Emacs.
@@ -31,50 +32,18 @@
 
 (eval-when-compile (require 'button) (require 'quail))
 
-(defun describe-text-done ()
-  "Delete the current window or bury the current buffer."
-  (interactive)
-  (if (> (count-windows) 1)
-      (delete-window)
-    (bury-buffer)))
-
-(defvar describe-text-mode-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map widget-keymap)
-    map)
-  "Keymap for `describe-text-mode'.")
-
-(defcustom describe-text-mode-hook nil
-  "List of hook functions ran by `describe-text-mode'."
-  :type 'hook
-  :group 'facemenu)
-
-(defun describe-text-mode ()
-  "Major mode for buffers created by `describe-char'.
-
-\\{describe-text-mode-map}
-Entry to this mode calls the value of `describe-text-mode-hook'
-if that value is non-nil."
-  (kill-all-local-variables)
-  (setq major-mode 'describe-text-mode
-	mode-name "Describe-Text")
-  (use-local-map describe-text-mode-map)
-  (widget-setup)
-  (add-hook 'change-major-mode-hook 'font-lock-defontify nil t)
-  (run-mode-hooks 'describe-text-mode-hook))
-
 ;;; Describe-Text Utilities.
 
 (defun describe-text-widget (widget)
   "Insert text to describe WIDGET in the current buffer."
-  (widget-create 'link
-		 :notify `(lambda (&rest ignore)
-			    (widget-browse ',widget))
-		 (format "%S" (if (symbolp widget)
-				  widget
-				(car widget))))
-  (widget-insert " ")
-  (widget-create 'info-link :tag "widget" "(widget)Top"))
+  (insert-text-button
+   (symbol-name (if (symbolp widget) widget (car widget)))
+   'action `(lambda (&rest ignore)
+	      (widget-browse ',widget)))
+  (insert " ")
+  (insert-text-button "(widget)Top"
+		      'action (lambda (&rest ignore) (info "(widget)Top"))
+		      'help-echo "mouse-2, RET: read this Info node"))
 
 (defun describe-text-sexp (sexp)
   "Insert a short description of SEXP in the current buffer."
@@ -88,20 +57,19 @@
 	      ((> (length pp) (- (window-width) (current-column)))
 	       nil)
 	      (t t))
-	(widget-insert pp)
-      (widget-create 'push-button
-		     :tag "show"
-		     :action (lambda (widget &optional event)
-			       (with-output-to-temp-buffer
-				   "*Pp Eval Output*"
-				 (princ (widget-get widget :value))))
-		     pp))))
+	(insert pp)
+      (insert-text-button
+       "show" 'action `(lambda (&rest ignore)
+			(with-output-to-temp-buffer
+			    "*Pp Eval Output*"
+			  (princ ',pp)))
+       'help-echo "mouse-2, RET: pretty print value in another buffer"))))
 
 (defun describe-property-list (properties)
   "Insert a description of PROPERTIES in the current buffer.
 PROPERTIES should be a list of overlay or text properties.
 The `category', `face' and `font-lock-face' properties are made
-into widget buttons that call `describe-text-category' or
+into help buttons that call `describe-text-category' or
 `describe-face' when pushed."
   ;; Sort the properties by the size of their value.
   (dolist (elt (sort (let (ret)
@@ -112,23 +80,21 @@
 					    (prin1-to-string (nth 0 b) t)))))
     (let ((key (nth 0 elt))
 	  (value (nth 1 elt)))
-      (widget-insert (propertize (format "  %-20s " key)
-				 'font-lock-face 'italic))
+      (insert (propertize (format "  %-20s " key)
+			  'face 'italic))
       (cond ((eq key 'category)
-	     (widget-create 'link
-			    :notify `(lambda (&rest ignore)
-				       (describe-text-category ',value))
-			    (format "%S" value)))
+	     (insert-text-button (symbol-name value)
+				 'action `(lambda (&rest ignore)
+					    (describe-text-category ',value))
+				 'help-echo
+				 "mouse-2, RET: describe this category"))
             ((memq key '(face font-lock-face mouse-face))
-	     (widget-create 'link
-			    :notify `(lambda (&rest ignore)
-				       (describe-face ',value))
-			    (format "%S" value)))
+	     (insert (concat "`" (format "%S" value) "'")))
             ((widgetp value)
 	     (describe-text-widget value))
 	    (t
 	     (describe-text-sexp value))))
-    (widget-insert "\n")))
+    (insert "\n")))
 
 ;;; Describe-Text Commands.
 
@@ -138,9 +104,8 @@
   (save-excursion
     (with-output-to-temp-buffer "*Help*"
       (set-buffer standard-output)
-      (widget-insert "Category " (format "%S" category) ":\n\n")
+      (insert "Category " (format "%S" category) ":\n\n")
       (describe-property-list (symbol-plist category))
-      (describe-text-mode)
       (goto-char (point-min)))))
 
 ;;;###autoload
@@ -165,10 +130,9 @@
 	  (with-output-to-temp-buffer target-buffer
 	    (set-buffer standard-output)
 	    (setq output-buffer (current-buffer))
-	    (widget-insert "Text content at position " (format "%d" pos) ":\n\n")
+	    (insert "Text content at position " (format "%d" pos) ":\n\n")
 	    (with-current-buffer buffer
 	      (describe-text-properties-1 pos output-buffer))
-	    (describe-text-mode)
 	    (goto-char (point-min))))))))
 
 (defun describe-text-properties-1 (pos output-buffer)
@@ -186,33 +150,33 @@
       ;; Widgets
       (when (widgetp widget)
 	(newline)
-	(widget-insert (cond (wid-field "This is an editable text area")
-			     (wid-button "This is an active area")
-			     (wid-doc "This is documentation text")))
-	(widget-insert " of a ")
+	(insert (cond (wid-field "This is an editable text area")
+		      (wid-button "This is an active area")
+		      (wid-doc "This is documentation text")))
+	(insert " of a ")
 	(describe-text-widget widget)
-	(widget-insert ".\n\n"))
+	(insert ".\n\n"))
       ;; Buttons
       (when (and button (not (widgetp wid-button)))
 	(newline)
-	(widget-insert "Here is a " (format "%S" button-type)
-		       " button labeled `" button-label "'.\n\n"))
+	(insert "Here is a " (format "%S" button-type)
+		" button labeled `" button-label "'.\n\n"))
       ;; Overlays
       (when overlays
 	(newline)
 	(if (eq (length overlays) 1)
-	    (widget-insert "There is an overlay here:\n")
-	  (widget-insert "There are " (format "%d" (length overlays))
+	    (insert "There is an overlay here:\n")
+	  (insert "There are " (format "%d" (length overlays))
 			 " overlays here:\n"))
 	(dolist (overlay overlays)
-	  (widget-insert " From " (format "%d" (overlay-start overlay))
+	  (insert " From " (format "%d" (overlay-start overlay))
 			 " to " (format "%d" (overlay-end overlay)) "\n")
 	  (describe-property-list (overlay-properties overlay)))
-	(widget-insert "\n"))
+	(insert "\n"))
       ;; Text properties
       (when properties
 	(newline)
-	(widget-insert "There are text properties here:\n")
+	(insert "There are text properties here:\n")
 	(describe-property-list properties)))))
 
 (defcustom describe-char-unicodedata-file nil
@@ -223,8 +187,8 @@
 multilingual development.
 
 This is a fairly large file, not typically present on GNU systems.  At
-the time of writing it is at
-<URL:http://www.unicode.org/Public/UNIDATA/UnicodeData.txt>."
+the time of writing it is at the URL
+`http://www.unicode.org/Public/UNIDATA/UnicodeData.txt'."
   :group 'mule
   :version "22.1"
   :type '(choice (const :tag "None" nil)
@@ -488,27 +452,28 @@
 			 (format ", U+%04X" unicode)
 		       "")))
 	    ("charset"
-	     ,`(widget-create 'link
-			      :notify (lambda (&rest ignore)
-					(describe-character-set ',charset))
-			      ,(symbol-name charset))
+	     ,`(insert-text-button
+		(symbol-name charset)
+		'action `(lambda (&rest ignore)
+			   (describe-character-set ',charset))
+		'help-echo
+		"mouse-2, RET: describe this character set")
 	     ,(format "(%s)" (charset-description charset)))
 	    ("code point"
 	     ,(let ((split (split-char char)))
-		`(widget-create
-		  'link
-		  :notify (lambda (&rest ignore)
-			    (list-charset-chars ',charset)
-			    (with-selected-window
-				(get-buffer-window "*Character List*" 0)
-			      (goto-char (point-min))
+		`(insert-text-button ,(if (= (charset-dimension charset) 1)
+					  (format "%d" (nth 1 split))
+					(format "%d %d" (nth 1 split)
+						(nth 2 split)))
+		 'action (lambda (&rest ignore)
+			   (list-charset-chars ',charset)
+			   (with-selected-window
+			       (get-buffer-window "*Character List*" 0)
+			     (goto-char (point-min))
                               (forward-line 2) ;Skip the header.
                               (let ((case-fold-search nil))
                                 (search-forward ,(char-to-string char)
-                                                nil t))))
-		  ,(if (= (charset-dimension charset) 1)
-		       (format "%d" (nth 1 split))
-		     (format "%d %d" (nth 1 split) (nth 2 split))))))
+                                                nil t)))))))
 	    ("syntax"
 	     ,(let ((syntax (syntax-after pos)))
 		(with-temp-buffer
@@ -537,12 +502,11 @@
 			   (mapconcat #'(lambda (x) (concat "\"" x "\""))
 				      key-list " or ")
 			   "with"
-			   `(widget-create
-			     'link
-			     :notify (lambda (&rest ignore)
+			   `(insert-text-button
+			     (symbol-name current-input-method)
+			     'action (lambda (&rest ignore)
 				       (describe-input-method
-					',current-input-method))
-			     ,(format "%s" current-input-method))))))
+					',current-input-method)))))))
 	    ("buffer code"
 	     ,(encoded-string-description
 	       (string-as-unibyte (char-to-string char)) nil))
@@ -611,11 +575,8 @@
 			  ((and (< char 32) (not (memq char '(9 10))))
 			   'escape-glyph)))))
 		(if face (list (list "hardcoded face"
-				     `(widget-create
-				       'link
-				       :notify (lambda (&rest ignore)
-						 (describe-face ',face))
-				       ,(format "%s" face))))))
+				     '(insert
+				       (concat "`" (symbol-name face) "'"))))))
 	    ,@(let ((unicodedata (and unicode
 				      (describe-char-unicode-data unicode))))
 		(if unicodedata
@@ -623,17 +584,16 @@
     (setq max-width (apply #'max (mapcar #'(lambda (x)
 					     (if (cadr x) (length (car x)) 0))
 					 item-list)))
-    (with-output-to-temp-buffer "*Help*"
+    (help-setup-xref nil (interactive-p))
+    (with-output-to-temp-buffer (help-buffer)
       (with-current-buffer standard-output
-	(let ((help-xref-following t))
-	  (help-setup-xref nil nil))
 	(set-buffer-multibyte multibyte-p)
 	(let ((formatter (format "%%%ds:" max-width)))
 	  (dolist (elt item-list)
 	    (when (cadr elt)
 	      (insert (format formatter (car elt)))
 	      (dolist (clm (cdr elt))
-		(if (eq (car-safe clm) 'widget-create)
+		(if (eq (car-safe clm) 'insert-text-button)
 		    (progn (insert " ") (eval clm))
 		  (when (>= (+ (current-column)
 			       (or (string-match "\n" clm)
@@ -673,17 +633,15 @@
 			  "\n")
 		  (when (> (car (aref disp-vector i)) #x7ffff)
 		    (let* ((face-id (lsh (car (aref disp-vector i)) -19))
-			   (face (car (delq nil (mapcar (lambda (face)
-							  (and (eq (face-id face)
-								   face-id) face))
-							(face-list))))))
+			   (face (car (delq nil (mapcar
+						 (lambda (face)
+						   (and (eq (face-id face)
+							    face-id) face))
+						 (face-list))))))
 		      (when face
 			(insert (propertize " " 'display '(space :align-to 5))
 				"face: ")
-			(widget-create 'link
-				       :notify `(lambda (&rest ignore)
-						  (describe-face ',face))
-				       (format "%S" face))
+			(insert (concat "`" (symbol-name face) "'"))
 			(insert "\n"))))))
 	    (insert "these terminal codes:\n")
 	    (dotimes (i (length disp-vector))
@@ -729,9 +687,7 @@
 		  "the meaning of the rule.\n"))
 
         (if text-props-desc (insert text-props-desc))
-	(describe-text-mode)
 	(toggle-read-only 1)
-	(help-make-xrefs (current-buffer))
 	(print-help-return-message)))))
 
 (defalias 'describe-char-after 'describe-char)
--- a/lisp/emacs-lisp/edebug.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/emacs-lisp/edebug.el	Thu Dec 29 04:41:02 2005 +0000
@@ -570,6 +570,7 @@
 ;; Compatibility with old versions.
 (defalias 'edebug-all-defuns 'edebug-all-defs)
 
+;;;###autoload
 (defun edebug-all-defs ()
   "Toggle edebugging of all definitions."
   (interactive)
@@ -578,6 +579,7 @@
 	   (if edebug-all-defs "on" "off")))
 
 
+;;;###autoload
 (defun edebug-all-forms ()
   "Toggle edebugging of all forms."
   (interactive)
@@ -2516,6 +2518,7 @@
 (defvar edebug-outside-o-a-p) ; outside overlay-arrow-position
 (defvar edebug-outside-o-a-s) ; outside overlay-arrow-string
 (defvar edebug-outside-c-i-e-a) ; outside cursor-in-echo-area
+(defvar edebug-outside-d-c-i-n-s-w) ; outside default-cursor-in-non-selected-windows
 
 (defvar edebug-eval-list nil) ;; List of expressions to evaluate.
 
@@ -2557,11 +2560,13 @@
 
 	(edebug-outside-o-a-p overlay-arrow-position)
 	(edebug-outside-o-a-s overlay-arrow-string)
-	(edebug-outside-c-i-e-a cursor-in-echo-area))
+	(edebug-outside-c-i-e-a cursor-in-echo-area)
+	(edebug-outside-d-c-i-n-s-w default-cursor-in-non-selected-windows))
     (unwind-protect
 	(let ((overlay-arrow-position overlay-arrow-position)
 	      (overlay-arrow-string overlay-arrow-string)
 	      (cursor-in-echo-area nil)
+	      (default-cursor-in-non-selected-windows t)
 	      ;; any others??
 	      )
 	  (if (not (buffer-name edebug-buffer))
@@ -2767,7 +2772,8 @@
       (setq
        overlay-arrow-position edebug-outside-o-a-p
        overlay-arrow-string edebug-outside-o-a-s
-       cursor-in-echo-area edebug-outside-c-i-e-a)
+       cursor-in-echo-area edebug-outside-c-i-e-a
+       default-cursor-in-non-selected-windows edebug-outside-d-c-i-n-s-w)
       )))
 
 
@@ -3580,6 +3586,7 @@
 	   (overlay-arrow-position edebug-outside-o-a-p)
 	   (overlay-arrow-string edebug-outside-o-a-s)
 	   (cursor-in-echo-area edebug-outside-c-i-e-a)
+	   (default-cursor-in-non-selected-windows edebug-outside-d-c-i-n-s-w)
 	   )
        (unwind-protect
 	   (save-excursion		; of edebug-buffer
@@ -3618,6 +3625,7 @@
 	  edebug-outside-o-a-p overlay-arrow-position
 	  edebug-outside-o-a-s overlay-arrow-string
 	  edebug-outside-c-i-e-a cursor-in-echo-area
+	  edebug-outside-d-c-i-n-s-w default-cursor-in-non-selected-windows
 	  )
 
 	 ;; Restore the outside saved values; don't alter
@@ -3897,7 +3905,7 @@
 specific commands.  E.g. `edebug-step-mode' is bound to \\[edebug-step-mode]
 in the Edebug buffer and \\<global-map>\\[edebug-step-mode] in any buffer.
 
-Also see bindings for the eval list buffer, *edebug*.
+Also see bindings for the eval list buffer *edebug* in `edebug-eval-mode'.
 
 The edebug buffer commands:
 \\{edebug-mode-map}
@@ -4054,7 +4062,7 @@
 Eval list buffer commands:
 \\{edebug-eval-mode-map}
 
-Global commands prefixed by global-edebug-prefix:
+Global commands prefixed by `global-edebug-prefix':
 \\{global-edebug-map}")
 
 ;;; Interface with standard debugger.
--- a/lisp/emacs-lisp/lisp.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/emacs-lisp/lisp.el	Thu Dec 29 04:41:02 2005 +0000
@@ -569,28 +569,37 @@
 	      ((null completion)
 	       (message "Can't find completion for \"%s\"" pattern)
 	       (ding))
+	      ((not (string= pattern completion))
+	       (delete-region beg end)
+	       (insert completion)
+	       ;; Don't leave around a completions buffer that's out of date.
+	       (let ((win (get-buffer-window "*Completions*" 0)))
+		 (if win (with-selected-window win (bury-buffer)))))
 	      (t
-	       (unless (string= completion pattern)
-		 (delete-region beg end)
-		 (insert completion)
-		 (setq pattern completion))
-	       (message "Making completion list...")
-	       (let ((list (all-completions pattern obarray predicate)))
-		 (setq list (sort list 'string<))
-		 (or (eq predicate 'fboundp)
-		     (let (new)
-		       (while list
-			 (setq new (cons (if (fboundp (intern (car list)))
-					     (list (car list) " <f>")
-					   (car list))
-					 new))
-			 (setq list (cdr list)))
-		       (setq list (nreverse new))))
-		 (if (> (length list) 1)
-		     (with-output-to-temp-buffer "*Completions*"
-		       (display-completion-list list pattern))
-		   (delete-windows-on "*Completions*")))
-	       (message "Making completion list...%s" "done")))))))
+	       (let ((minibuf-is-in-use
+		      (eq (minibuffer-window) (selected-window))))
+		 (unless minibuf-is-in-use
+		   (message "Making completion list..."))
+		 (let ((list (all-completions pattern obarray predicate)))
+		   (setq list (sort list 'string<))
+		   (or (eq predicate 'fboundp)
+		       (let (new)
+			 (while list
+			   (setq new (cons (if (fboundp (intern (car list)))
+					       (list (car list) " <f>")
+					     (car list))
+					   new))
+			   (setq list (cdr list)))
+			 (setq list (nreverse new))))
+		   (if (> (length list) 1)
+		       (with-output-to-temp-buffer "*Completions*"
+			 (display-completion-list list pattern))
+		     ;; Don't leave around a completions buffer that's
+		     ;; out of date.
+		     (let ((win (get-buffer-window "*Completions*" 0)))
+		       (if win (with-selected-window win (bury-buffer))))))
+		 (unless minibuf-is-in-use
+		   (message "Making completion list...%s" "done")))))))))
 
-;;; arch-tag: aa7fa8a4-2e6f-4e9b-9cd9-fef06340e67e
+;; arch-tag: aa7fa8a4-2e6f-4e9b-9cd9-fef06340e67e
 ;;; lisp.el ends here
--- a/lisp/font-lock.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/font-lock.el	Thu Dec 29 04:41:02 2005 +0000
@@ -153,8 +153,8 @@
 ;;
 ;;  (add-hook 'foo-mode-hook
 ;;   (lambda ()
-;;     (make-local-variable 'font-lock-defaults)
-;;     (setq font-lock-defaults '(foo-font-lock-keywords t))))
+;;     (set (make-local-variable 'font-lock-defaults)
+;;          '(foo-font-lock-keywords t))))
 
 ;;; Adding Font Lock support for modes:
 
@@ -174,8 +174,8 @@
 ;;
 ;; and within `bar-mode' there could be:
 ;;
-;;  (make-local-variable 'font-lock-defaults)
-;;  (setq font-lock-defaults '(bar-font-lock-keywords nil t))
+;;  (set (make-local-variable 'font-lock-defaults)
+;;       '(bar-font-lock-keywords nil t))
 
 ;; What is fontification for?  You might say, "It's to make my code look nice."
 ;; I think it should be for adding information in the form of cues.  These cues
@@ -723,8 +723,8 @@
 					  (append keywords old)))))
 	   ;; If the keywords were compiled before, compile them again.
 	   (if was-compiled
-	       (set (make-local-variable 'font-lock-keywords)
-		    (font-lock-compile-keywords font-lock-keywords t)))))))
+	       (setq font-lock-keywords
+                     (font-lock-compile-keywords font-lock-keywords t)))))))
 
 (defun font-lock-update-removed-keyword-alist (mode keywords how)
   "Update `font-lock-removed-keywords-alist' when adding new KEYWORDS to MODE."
@@ -830,8 +830,8 @@
 
 	   ;; If the keywords were compiled before, compile them again.
 	   (if was-compiled
-	       (set (make-local-variable 'font-lock-keywords)
-		    (font-lock-compile-keywords font-lock-keywords t)))))))
+	       (setq font-lock-keywords
+                     (font-lock-compile-keywords font-lock-keywords t)))))))
 
 ;;; Font Lock Support mode.
 
@@ -1001,8 +1001,7 @@
 	(when verbose
 	  (format "Fontifying %s..." (buffer-name)))
       ;; Make sure we have the right `font-lock-keywords' etc.
-      (unless font-lock-mode
-	(font-lock-set-defaults))
+      (font-lock-set-defaults)
       ;; Make sure we fontify etc. in the whole buffer.
       (save-restriction
 	(widen)
@@ -1574,9 +1573,9 @@
   (cond ((not (and (listp keywords) (symbolp (car keywords))))
 	 keywords)
 	((numberp level)
-	 (or (nth level keywords) (car (reverse keywords))))
+	 (or (nth level keywords) (car (last keywords))))
 	((eq level t)
-	 (car (reverse keywords)))
+	 (car (last keywords)))
 	(t
 	 (car keywords))))
 
@@ -1642,8 +1641,8 @@
 	(font-lock-remove-keywords nil removed-keywords))
       ;; Now compile the keywords.
       (unless (eq (car font-lock-keywords) t)
-	(set (make-local-variable 'font-lock-keywords)
-	     (font-lock-compile-keywords font-lock-keywords t))))))
+	(setq font-lock-keywords
+              (font-lock-compile-keywords font-lock-keywords t))))))
 
 ;;; Colour etc. support.
 
--- a/lisp/hi-lock.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/hi-lock.el	Thu Dec 29 04:41:02 2005 +0000
@@ -97,6 +97,16 @@
   :type 'integer
   :group 'hi-lock)
 
+(defcustom hi-lock-highlight-range 200000
+  "Size of area highlighted by hi-lock when font-lock not active.
+Font-lock is not active in buffers that do their own highlighting,
+such as the buffer created by `list-colors-display'.  In those buffers
+hi-lock patterns will only be applied over a range of
+`hi-lock-highlight-range' characters.  If font-lock is active then
+highlighting will be applied throughout the buffer."
+  :type 'integer
+  :group 'hi-lock)
+
 (defcustom hi-lock-exclude-modes
   '(rmail-mode mime/viewer-mode gnus-article-mode)
   "List of major modes in which hi-lock will not run.
@@ -189,14 +199,14 @@
   "Regexp for finding hi-lock patterns at top of file.")
 
 (defvar hi-lock-archaic-interface-message-used nil
-  "True if user alerted that global-hi-lock-mode is now the global switch.
-Earlier versions of hi-lock used hi-lock-mode as the global switch,
-the message is issued if it appears that hi-lock-mode is used assuming
+  "True if user alerted that `global-hi-lock-mode' is now the global switch.
+Earlier versions of hi-lock used `hi-lock-mode' as the global switch,
+the message is issued if it appears that `hi-lock-mode' is used assuming
 that older functionality.  This variable avoids multiple reminders.")
 
 (defvar hi-lock-archaic-interface-deduce nil
-  "If non-nil, sometimes assume that hi-lock-mode means global-hi-lock-mode.
-Assumption is made if hi-lock-mode used in the *scratch* buffer while
+  "If non-nil, sometimes assume that `hi-lock-mode' means `global-hi-lock-mode'.
+Assumption is made if `hi-lock-mode' used in the *scratch* buffer while
 a library is being loaded.")
 
 (make-variable-buffer-local 'hi-lock-interactive-patterns)
@@ -247,14 +257,13 @@
 
 ;; Visible Functions
 
-
 ;;;###autoload
 (define-minor-mode hi-lock-mode
   "Toggle minor mode for interactively adding font-lock highlighting patterns.
 
-If ARG positive turn hi-lock on.  Issuing a hi-lock command will also
-turn hi-lock on; to turn hi-lock on in all buffers use
-global-hi-lock-mode or in your .emacs file (global-hi-lock-mode 1).
+If ARG positive, turn hi-lock on.  Issuing a hi-lock command will also
+turn hi-lock on.  To turn hi-lock on in all buffers use
+`global-hi-lock-mode' or in your .emacs file (global-hi-lock-mode 1).
 When hi-lock is turned on, a \"Regexp Highlighting\" submenu is added
 to the \"Edit\" menu.  The commands in the submenu, which can be
 called interactively, are:
@@ -293,7 +302,9 @@
  Hi-lock: end
 is found. A mode is excluded if it's in the list `hi-lock-exclude-modes'."
   :group 'hi-lock
-  :lighter " H"
+  :lighter (:eval (if (or hi-lock-interactive-patterns
+			  hi-lock-file-patterns)
+		      " Hi" ""))
   :global nil
   :keymap hi-lock-map
   (when (and (equal (buffer-name) "*scratch*")
@@ -306,7 +317,7 @@
       (warn
        "Possible archaic use of (hi-lock-mode).
 Use (global-hi-lock-mode 1) in .emacs to enable hi-lock for all buffers,
-use (hi-lock-mode 1) for individual buffers. For compatibility with Emacs
+use (hi-lock-mode 1) for individual buffers.  For compatibility with Emacs
 versions before 22 use the following in your .emacs file:
 
         (if (functionp 'global-hi-lock-mode)
@@ -330,8 +341,8 @@
       (when hi-lock-file-patterns
 	(font-lock-remove-keywords nil hi-lock-file-patterns)
 	(setq hi-lock-file-patterns nil))
-      (if font-lock-mode
-	  (font-lock-fontify-buffer)))
+      (remove-overlays nil nil 'hi-lock-overlay t)
+      (when font-lock-fontified (font-lock-fontify-buffer)))
     (define-key-after menu-bar-edit-menu [hi-lock] nil)
     (remove-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook t)))
 
@@ -461,7 +472,9 @@
       (font-lock-remove-keywords nil (list keyword))
       (setq hi-lock-interactive-patterns
             (delq keyword hi-lock-interactive-patterns))
-      (font-lock-fontify-buffer))))
+      (remove-overlays
+       nil nil 'hi-lock-overlay-regexp (hi-lock-string-serialize regexp))
+      (when font-lock-fontified (font-lock-fontify-buffer)))))
 
 ;;;###autoload
 (defun hi-lock-write-interactive-patterns ()
@@ -476,7 +489,9 @@
   (let ((beg (point)))
     (mapcar
      (lambda (pattern)
-       (insert (format "Hi-lock: (%s)\n" (prin1-to-string pattern))))
+       (insert (format "%s: (%s)\n"
+		       hi-lock-file-patterns-prefix
+		       (prin1-to-string pattern))))
      hi-lock-interactive-patterns)
     (comment-region beg (point)))
   (when (> (point) hi-lock-file-patterns-range)
@@ -526,25 +541,34 @@
   "Highlight REGEXP with face FACE."
   (let ((pattern (list regexp (list 0 (list 'quote face) t))))
     (unless (member pattern hi-lock-interactive-patterns)
-      (font-lock-add-keywords nil (list pattern))
+      (font-lock-add-keywords nil (list pattern) t)
       (push pattern hi-lock-interactive-patterns)
-      (let ((buffer-undo-list t)
-	    (inhibit-read-only t)
-	    (mod (buffer-modified-p)))
-	(save-excursion
-	  (goto-char (point-min))
-	  (while (re-search-forward regexp (point-max) t)
-	    (put-text-property
-	     (match-beginning 0) (match-end 0) 'face face)
-	    (goto-char (match-end 0))))
-	(set-buffer-modified-p mod)))))
+      (if font-lock-fontified
+          (font-lock-fontify-buffer)
+        (let* ((serial (hi-lock-string-serialize regexp))
+               (range-min (- (point) (/ hi-lock-highlight-range 2)))
+               (range-max (+ (point) (/ hi-lock-highlight-range 2)))
+               (search-start
+                (max (point-min)
+                     (- range-min (max 0 (- range-max (point-max))))))
+               (search-end
+                (min (point-max)
+                     (+ range-max (max 0 (- (point-min) range-min))))))
+          (save-excursion
+            (goto-char search-start)
+            (while (re-search-forward regexp search-end t)
+              (let ((overlay (make-overlay (match-beginning 0) (match-end 0))))
+                (overlay-put overlay 'hi-lock-overlay t)
+                (overlay-put overlay 'hi-lock-overlay-regexp serial)
+                (overlay-put overlay 'face face))
+              (goto-char (match-end 0)))))))))
 
 (defun hi-lock-set-file-patterns (patterns)
   "Replace file patterns list with PATTERNS and refontify."
   (when (or hi-lock-file-patterns patterns)
     (font-lock-remove-keywords nil hi-lock-file-patterns)
     (setq hi-lock-file-patterns patterns)
-    (font-lock-add-keywords nil hi-lock-file-patterns)
+    (font-lock-add-keywords nil hi-lock-file-patterns t)
     (font-lock-fontify-buffer)))
 
 (defun hi-lock-find-patterns ()
@@ -573,10 +597,31 @@
 (defun hi-lock-font-lock-hook ()
   "Add hi lock patterns to font-lock's."
   (if font-lock-mode
-      (progn (font-lock-add-keywords nil hi-lock-file-patterns)
-	     (font-lock-add-keywords nil hi-lock-interactive-patterns))
+      (progn
+	(font-lock-add-keywords nil hi-lock-file-patterns t)
+	(font-lock-add-keywords nil hi-lock-interactive-patterns t))
     (hi-lock-mode -1)))
 
+(defvar hi-lock-string-serialize-hash
+  (make-hash-table :test 'equal)
+  "Hash table used to assign unique numbers to strings.")
+
+(defvar hi-lock-string-serialize-serial 1
+  "Number assigned to last new string in call to `hi-lock-string-serialize'.
+A string is considered new if it had not previously been used in a call to
+`hi-lock-string-serialize'.")
+
+(defun hi-lock-string-serialize (string)
+  "Return unique serial number for STRING."
+  (interactive)
+  (let ((val (gethash string hi-lock-string-serialize-hash)))
+    (if val val
+      (puthash string
+               (setq hi-lock-string-serialize-serial
+                     (1+ hi-lock-string-serialize-serial))
+               hi-lock-string-serialize-hash)
+      hi-lock-string-serialize-serial)))
+
 (provide 'hi-lock)
 
 ;; arch-tag: d2e8fd07-4cc9-4c6f-a200-1e729bc54066
--- a/lisp/info.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/info.el	Thu Dec 29 04:41:02 2005 +0000
@@ -521,22 +521,22 @@
 	       (Info-default-dirs)))))))
 
 ;;;###autoload
-(defun info-other-window (&optional file)
+(defun info-other-window (&optional file-or-node)
   "Like `info' but show the Info buffer in another window."
   (interactive (if current-prefix-arg
 		   (list (read-file-name "Info file name: " nil nil t))))
   (let (same-window-buffer-names same-window-regexps)
-    (info file)))
+    (info file-or-node)))
 
 ;;;###autoload (add-hook 'same-window-regexps "\\*info\\*\\(\\|<[0-9]+>\\)")
 
 ;;;###autoload (put 'info 'info-file "emacs")
 ;;;###autoload
-(defun info (&optional file buffer)
+(defun info (&optional file-or-node buffer)
   "Enter Info, the documentation browser.
-Optional argument FILE specifies the file to examine;
+Optional argument FILE-OR-NODE specifies the file to examine;
 the default is the top-level directory of Info.
-Called from a program, FILE may specify an Info node of the form
+Called from a program, FILE-OR-NODE may specify an Info node of the form
 `(FILENAME)NODENAME'.
 Optional argument BUFFER specifies the Info buffer name;
 the default buffer name is *info*.  If BUFFER exists,
@@ -559,15 +559,15 @@
   (pop-to-buffer (or buffer "*info*"))
   (if (and buffer (not (eq major-mode 'Info-mode)))
       (Info-mode))
-  (if file
+  (if file-or-node
       ;; If argument already contains parentheses, don't add another set
       ;; since the argument will then be parsed improperly.  This also
       ;; has the added benefit of allowing node names to be included
       ;; following the parenthesized filename.
       (Info-goto-node
-       (if (and (stringp file) (string-match "(.*)" file))
-           file
-         (concat "(" file ")")))
+       (if (and (stringp file-or-node) (string-match "(.*)" file-or-node))
+           file-or-node
+         (concat "(" file-or-node ")")))
     (if (zerop (buffer-size))
         (Info-directory))))
 
@@ -2260,7 +2260,8 @@
 	(let ((pattern (concat "\n\\* +\\("
 			       (regexp-quote string)
 			       Info-menu-entry-name-re "\\):" Info-node-spec-re))
-	      completions)
+	      completions
+	      (complete-nodes Info-complete-nodes))
 	  ;; Check the cache.
 	  (if (and (equal (nth 0 Info-complete-cache) Info-current-file)
 		   (equal (nth 1 Info-complete-cache) Info-current-node)
@@ -2281,9 +2282,9 @@
 		  (or (and Info-complete-next-re
 		           (setq nextnode (Info-extract-pointer "next" t))
 		           (string-match Info-complete-next-re nextnode))
-		      (and Info-complete-nodes
-		           (setq Info-complete-nodes (cdr Info-complete-nodes)
-		                 nextnode (car Info-complete-nodes)))))
+		      (and complete-nodes
+		           (setq complete-nodes (cdr complete-nodes)
+		                 nextnode (car complete-nodes)))))
 	      (Info-goto-node nextnode))
 	    ;; Go back to the start node (for the next completion).
 	    (unless (equal Info-current-node orignode)
@@ -3192,8 +3193,8 @@
 	(tool-bar-local-item-from-menu 'Info-next "next-node" map Info-mode-map)
 	(tool-bar-local-item-from-menu 'Info-up "up-node" map Info-mode-map)
 	(tool-bar-local-item-from-menu 'Info-top-node "home" map Info-mode-map)
+	(tool-bar-local-item-from-menu 'Info-goto-node "jump-to" map Info-mode-map)
 	(tool-bar-local-item-from-menu 'Info-index "index" map Info-mode-map)
-	(tool-bar-local-item-from-menu 'Info-goto-node "jump-to" map Info-mode-map)
 	(tool-bar-local-item-from-menu 'Info-search "search" map Info-mode-map)
 	map)))
 
--- a/lisp/locate.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/locate.el	Thu Dec 29 04:41:02 2005 +0000
@@ -149,7 +149,7 @@
 
 (defcustom locate-header-face nil
   "*Face used to highlight the locate header."
-  :type 'face
+  :type '(choice face (const nil))
   :group 'locate)
 
 ;;;###autoload
--- a/lisp/log-view.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/log-view.el	Thu Dec 29 04:41:02 2005 +0000
@@ -60,6 +60,7 @@
 
 (eval-when-compile (require 'cl))
 (require 'pcvs-util)
+(autoload 'vc-find-version "vc")
 (autoload 'vc-version-diff "vc")
 
 (defvar cvs-minor-wrap-function)
@@ -168,7 +169,7 @@
     (forward-line 1)
     (or (re-search-backward log-view-file-re nil t)
 	(re-search-forward log-view-file-re))
-    (let* ((file (or (match-string 2) (match-string 3)))
+    (let* ((file (or (match-string 1) (match-string 2)))
 	   (cvsdir (and (re-search-backward log-view-dir-re nil t)
 			(match-string 1)))
 	   (pcldir (and (boundp 'cvs-pcl-cvs-dirchange-re)
@@ -188,7 +189,7 @@
       (when (re-search-backward log-view-message-re nil t)
         (let (rev)
           ;; Find the subgroup that matched.
-          (dotimes (i (/ (match-data 'integers) 2))
+          (dotimes (i (/ (length (match-data 'integers)) 2))
             (setq rev (or rev (match-string (1+ i)))))
 	  (unless (re-search-forward log-view-file-re pt t)
 	    rev))))))
--- a/lisp/makefile.w32-in	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/makefile.w32-in	Thu Dec 29 04:41:02 2005 +0000
@@ -158,8 +158,8 @@
 autoloads: $(lisp)/loaddefs.el doit
 	@echo Directories: . $(WINS)
 	$(emacs) -l autoload \
-		--eval $(ARGQUOTE)(setq find-file-hook nil find-file-suppress-same-file-warnings t generated-autoload-file $(DQUOTE)$(lisp)/loaddefs.el$(DQUOTE))$(ARGQUOTE) \
-		-f batch-update-autoloads . $(WINS)
+		--eval $(ARGQUOTE)(setq find-file-hook nil find-file-suppress-same-file-warnings t)$(ARGQUOTE) \
+		-f w32-batch-update-autoloads "$(lisp)/loaddefs.el" . $(WINS)
 
 $(lisp)/subdirs.el:
 	$(MAKE) $(MFLAGS) update-subdirs
@@ -311,10 +311,10 @@
 	$(EMACS) $(EMACSOPT) \
 	   -l autoload \
 	   --eval "(setq generate-autoload-cookie \";;;###mh-autoload\")" \
-	   --eval "(setq generated-autoload-file \"$(lisp)/mh-e/mh-loaddefs.el\")" \
 	   --eval "(setq find-file-suppress-same-file-warnings t)" \
 	   --eval "(setq make-backup-files nil)" \
-	   -f batch-update-autoloads $(lisp)/mh-e
+	   -f w32-batch-update-autoloads \
+	   "$(lisp)/mh-e/mh-loaddefs.el" $(lisp)/mh-e
 
 pre-mh-loaddefs.el-SH:
 	echo ";;; mh-loaddefs.el --- automatically extracted autoloads" > $@
--- a/lisp/menu-bar.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/menu-bar.el	Thu Dec 29 04:41:02 2005 +0000
@@ -178,6 +178,17 @@
 (define-key menu-bar-file-menu [separator-save]
   '(menu-item "--"))
 
+(defun menu-find-file-existing ()
+  "Edit the existing file FILENAME."
+  (interactive)
+  (let* ((mustmatch (not (and (fboundp 'x-uses-old-gtk-dialog)
+			      (x-uses-old-gtk-dialog))))
+	 (filename (car (find-file-read-args "Find file: " mustmatch))))
+    (if mustmatch
+	(find-file-existing filename)
+      (find-file filename))))
+
+
 (define-key menu-bar-file-menu [kill-buffer]
   '(menu-item "Close" kill-this-buffer
 	      :enable (kill-this-buffer-enabled-p)
@@ -191,7 +202,7 @@
 	      :enable (menu-bar-non-minibuffer-window-p)
 	      :help "Read a directory, to operate on its files"))
 (define-key menu-bar-file-menu [open-file]
-  '(menu-item "Open File..." find-file-existing
+  '(menu-item "Open File..." menu-find-file-existing
 	      :enable (menu-bar-non-minibuffer-window-p)
 	      :help "Read an existing file into an Emacs buffer"))
 (define-key menu-bar-file-menu [new-file]
--- a/lisp/mh-e/ChangeLog	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/mh-e/ChangeLog	Thu Dec 29 04:41:02 2005 +0000
@@ -1,3 +1,78 @@
+2005-12-23  Bill Wohler  <wohler@newt.com>
+
+	* mh-e.el (mh-folders-changed): Fix typo in docstring.
+
+	Follow MH-E Developers Guide conventions. Use `' quotes for Help
+	hyperlinks such as symbols, Info nodes, or URLs. Use \" quotes for
+	everything else. Otherwise, you can accidently get links to
+	nonsense symbols.
+	
+2005-12-22  Bill Wohler  <wohler@newt.com>
+
+	Follow Emacs coding conventions. Use default setting of
+	emacs-lisp-docstring-fill-column which is 65.
+	
+	* mh-alias.el (mh-alias-reload): Sync docstrings with manual.
+
+	* mh-comp.el (mh-letter-mode): Use 60 column width.
+	(mh-forward, mh-insert-signature, mh-send-letter): Sync docstrings
+	with manual.
+	(mh-yank-cur-msg): Mention that mh-ins-buf-prefix isn't used if
+	you have added a mail-citation-hook and neither are used if you
+	use one of the supercite flavors of mh-yank-behavior. Sync
+	docstrings with manual.
+
+	* mh-customize.el (mh-kill-folder-suppress-prompt-hooks): Rename
+	from mh-kill-folder-suppress-prompt-hook since it is an abnormal
+	hook. Use "Hook run by `function'..." instead of "Invoked...".
+	Sync docstrings with manual.
+	(mh-ins-buf-prefix, mh-yank-behavior): Mention that
+	mh-ins-buf-prefix isn't used if you have added a
+	mail-citation-hook and neither are used if you use one of the
+	supercite flavors of mh-yank-behavior. Sync docstrings with
+	manual.
+	(mail-citation-hook): Delete. Use one in sendmail.el.
+	(mh-signature-file-name, mh-after-commands-processed-hook)
+	(mh-alias-reloaded-hook, mh-before-commands-processed-hook)
+	(mh-before-quit-hook, mh-before-send-letter-hook)
+	(mh-delete-msg-hook, mh-find-path-hook, mh-folder-mode-hook)
+	(mh-forward-hook, mh-inc-folder-hook, mh-insert-signature-hook)
+	(mh-letter-mode-hook)
+	(mh-mh-to-mime-hook, mh-pick-mode-hook, mh-quit-hook)
+	(mh-refile-msg-hook, mh-show-hook, mh-show-mode-hook)
+	(mh-unseen-updated-hook): Use "Hook run by `function'..." instead
+	of "Invoked...". Sync docstrings with manual.
+
+	* mh-e.el (mh-last-destination, mh-last-destination-folder)
+	(mh-last-destination-write, mh-folder-mode-map, mh-arrow-marker)
+	(mh-delete-list, mh-refile-list, mh-folders-changed)
+	(mh-next-direction, mh-view-ops, mh-folder-view-stack)
+	(mh-index-data, mh-first-msg-num, mh-last-msg-num)
+	(mh-mode-line-annotation, mh-sequence-notation-history)
+	(mh-colors-available-flag): Move comment into docstring.
+	(mh-delete-msg, mh-execute-commands, mh-inc-folder, mh-quit,
+	mh-process-commands): Sync docstrings with manual.
+	(mh-refile-msg): Small doc edit.
+	(mh-delete-a-msg, mh-refile-a-msg): Sync docstrings with manual.
+	Rename msg argument to message.
+
+	* mh-funcs.el (mh-kill-folder): Sync docstrings with manual.
+
+	* mh-e.el (mh-update-unseen): No longer say "The value of
+	`foo-hook' is a list of functions to be called, with no arguments,
+	...," but rather just "The hook foo-hook is called...".
+
+	* mh-mime.el (mh-mh-to-mime): Ditto
+
+	* mh-pick.el (mh-pick-mode): Ditto.
+
+	* mh-utils.el (mh-showing-mode): Use uppercase for argument in
+	docstring.
+	(mh-seq-list, mh-seen-list, mh-showing-with-headers): Move comment
+	into docstring.
+	(mh-show-mode, mh-show-msg, mh-find-path): Sync docstrings with
+	manual.
+
 2005-12-19  Stephen Gildea
 
 	* mh-customize.el (mh-after-commands-processed-hook): New variable.
--- a/lisp/mh-e/mh-acros.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/mh-e/mh-acros.el	Thu Dec 29 04:41:02 2005 +0000
@@ -32,7 +32,7 @@
 ;;
 ;;   (eval-when-compile (require 'mh-acros))
 ;;
-;; It is so named with a silent `m' so that it is compiled first. Otherwise,
+;; It is so named with a silent "m" so that it is compiled first. Otherwise,
 ;; "make recompile" in Emacs 21.4 fails.
 
 ;;; Change Log:
@@ -47,10 +47,11 @@
 ;; routines in their macro expansions. Use mh-require-cl to provide the cl
 ;; routines in the best way possible.
 (defmacro mh-require-cl ()
-  "Macro to load `cl' if needed.
-Some versions of `cl' produce code for the expansion of
-\(setf (gethash ...) ...) that uses functions in `cl' at run time.  This macro
-recognizes that and loads `cl' where appropriate."
+  "Macro to load \"cl\" if needed.
+Some versions of \"cl\" produce code for the expansion of
+\(setf (gethash ...) ...) that uses functions in \"cl\" at run
+time. This macro recognizes that and loads \"cl\" where
+appropriate."
   (if (eq (car (macroexpand '(setf (gethash foo bar) baz))) 'cl-puthash)
       `(require 'cl)
     `(eval-when-compile (require 'cl))))
@@ -75,16 +76,16 @@
 
 (defmacro mh-make-local-hook (hook)
   "Make HOOK local if needed.
-XEmacs and versions of GNU Emacs before 21.1 require `make-local-hook' to be
-called."
+XEmacs and versions of GNU Emacs before 21.1 require
+`make-local-hook' to be called."
   (when (and (fboundp 'make-local-hook)
              (not (get 'make-local-hook 'byte-obsolete-info)))
     `(make-local-hook ,hook)))
 
 (defmacro mh-mark-active-p (check-transient-mark-mode-flag)
   "A macro that expands into appropriate code in XEmacs and nil in GNU Emacs.
-In GNU Emacs if CHECK-TRANSIENT-MARK-MODE-FLAG is non-nil then check if
-variable `transient-mark-mode' is active."
+In GNU Emacs if CHECK-TRANSIENT-MARK-MODE-FLAG is non-nil then
+check if variable `transient-mark-mode' is active."
   (cond ((featurep 'xemacs)             ;XEmacs
          `(and (boundp 'zmacs-regions) zmacs-regions (region-active-p)))
         ((not check-transient-mark-mode-flag) ;GNU Emacs
@@ -94,13 +95,15 @@
                (boundp 'mark-active) mark-active))))
 
 (defmacro mh-defstruct (name-spec &rest fields)
-  "Replacement for `defstruct' from the `cl' package.
-The `defstruct' in the `cl' library produces compiler warnings, and generates
-code that uses functions present in `cl' at run-time.  This is a partial
-replacement, that avoids these issues.
+  "Replacement for `defstruct' from the \"cl\" package.
+The `defstruct' in the \"cl\" library produces compiler warnings,
+and generates code that uses functions present in \"cl\" at
+run-time. This is a partial replacement, that avoids these
+issues.
 
-NAME-SPEC declares the name of the structure, while FIELDS describes the
-various structure fields. Lookup `defstruct' for more details."
+NAME-SPEC declares the name of the structure, while FIELDS
+describes the various structure fields. Lookup `defstruct' for
+more details."
   (let* ((struct-name (if (atom name-spec) name-spec (car name-spec)))
          (conc-name (or (and (consp name-spec)
                              (cadr (assoc :conc-name (cdr name-spec))))
@@ -136,8 +139,8 @@
 
 (defmacro mh-assoc-ignore-case (key alist)
   "Check if KEY is present in ALIST while ignoring case to do the comparison.
-Compatibility macro for Emacs versions that lack `assoc-string', introduced in
-Emacs 22."
+Compatibility macro for Emacs versions that lack `assoc-string',
+introduced in Emacs 22."
   (if (fboundp 'assoc-string)
       `(assoc-string ,key ,alist t)
     `(assoc-ignore-case ,key ,alist)))
--- a/lisp/mh-e/mh-alias.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/mh-e/mh-alias.el	Thu Dec 29 04:41:02 2005 +0000
@@ -68,10 +68,11 @@
     "/usr/lib/mh/MailAliases" "/usr/share/mailutils/mh/MailAliases"
     "/etc/passwd")
   "*A list of system files which are a source of aliases.
-If these files are modified, they are automatically reread. This list need
-include only system aliases and the passwd file, since personal alias files
-listed in your `Aliasfile:' MH profile component are automatically included.
-You can update the alias list manually using \\[mh-alias-reload].")
+If these files are modified, they are automatically reread. This list
+need include only system aliases and the passwd file, since personal
+alias files listed in your \"Aliasfile:\" MH profile component are
+automatically included. You can update the alias list manually using
+\\[mh-alias-reload].")
 
 
 
@@ -79,8 +80,8 @@
 
 (defun mh-alias-tstamp (arg)
   "Check whether alias files have been modified.
-Return t if any file listed in the Aliasfile MH profile component has been
-modified since the timestamp.
+Return t if any file listed in the Aliasfile MH profile component has
+been modified since the timestamp.
 If ARG is non-nil, set timestamp with the current time."
   (if arg
       (let ((time (current-time)))
@@ -98,8 +99,10 @@
 
 (defun mh-alias-filenames (arg)
   "Return list of filenames that contain aliases.
-The filenames come from the Aliasfile profile component and are expanded.
-If ARG is non-nil, filenames listed in `mh-alias-system-aliases' are appended."
+The filenames come from the Aliasfile profile component and are
+expanded.
+If ARG is non-nil, filenames listed in `mh-alias-system-aliases' are
+appended."
   (or mh-progs (mh-find-path))
   (save-excursion
     (let* ((filename (mh-profile-component "Aliasfile"))
@@ -120,8 +123,8 @@
 
 (defun mh-alias-gecos-name (gecos-name username comma-separator)
   "Return a usable address string from a GECOS-NAME and USERNAME.
-Use only part of the GECOS-NAME up to the first comma if COMMA-SEPARATOR is
-non-nil."
+Use only part of the GECOS-NAME up to the first comma if
+COMMA-SEPARATOR is non-nil."
   (let ((res gecos-name))
     ;; Keep only string until first comma if COMMA-SEPARATOR is t.
     (if (and comma-separator
@@ -143,7 +146,7 @@
 
 (defun mh-alias-local-users ()
   "Return an alist of local users from /etc/passwd.
-Exclude all aliases already in `mh-alias-alist' from `ali'"
+Exclude all aliases already in `mh-alias-alist' from \"ali\""
   (let (passwd-alist)
     (save-excursion
       (set-buffer (get-buffer-create mh-temp-buffer))
@@ -183,14 +186,15 @@
 (defun mh-alias-reload ()
   "Reload MH aliases.
 
-Since aliases are updated frequently, MH-E will reload aliases automatically
-whenever an alias lookup occurs if an alias source (a file listed in your
-`Aliasfile:' profile component and your password file if variable
-`mh-alias-local-users' is non-nil) has changed. However, you can reload your
-aliases manually by calling this command directly.
+Since aliases are updated frequently, MH-E reloads aliases
+automatically whenever an alias lookup occurs if an alias source has
+changed. Sources include files listed in your \"Aliasfile:\" profile
+component and your password file if option `mh-alias-local-users' is
+turned on. However, you can reload your aliases manually by calling
+this command directly.
 
-The value of `mh-alias-reloaded-hook' is a list of functions to be called,
-with no arguments, after the aliases have been loaded."
+This function runs `mh-alias-reloaded-hook' after the aliases have
+been loaded."
   (interactive)
   (save-excursion
     (message "Loading MH aliases...")
@@ -238,8 +242,8 @@
 (defun mh-alias-ali (alias &optional user)
   "Return ali expansion for ALIAS.
 ALIAS must be a string for a single alias.
-If USER is t, then assume ALIAS is an address and call ali -user.
-ali returns the string unchanged if not defined.  The same is done here."
+If USER is t, then assume ALIAS is an address and call ali -user. ali
+returns the string unchanged if not defined. The same is done here."
   (condition-case err
       (save-excursion
         (let ((user-arg (if user "-user" "-nouser")))
@@ -322,8 +326,8 @@
 
 (defun mh-alias-suggest-alias (string &optional no-comma-swap)
   "Suggest an alias for STRING.
-Don't reverse the order of strings separated by a comma if NO-COMMA-SWAP is
-non-nil."
+Don't reverse the order of strings separated by a comma if
+NO-COMMA-SWAP is non-nil."
   (cond
    ((string-match "^<\\(.*\\)>$" string)
     ;; <somename@foo.bar>  -> recurse, stripping brackets.
@@ -378,8 +382,8 @@
 (defun mh-alias-canonicalize-suggestion (string)
   "Process STRING to replace spaces by periods.
 First all spaces and commas are replaced by periods. Then every run of
-consecutive periods are replaced with a single period. Finally the string
-is converted to lower case."
+consecutive periods are replaced with a single period. Finally the
+string is converted to lower case."
   (with-temp-buffer
     (insert string)
     ;; Replace spaces with periods
@@ -417,10 +421,10 @@
 
 (defun mh-alias-insert-file (&optional alias)
   "Return filename which should be used to add ALIAS.
-The value of the option `mh-alias-insert-file' is used if non-nil\; otherwise
-the value of the `Aliasfile:' profile component is used.
-If the alias already exists, try to return the name of the file that contains
-it."
+The value of the option `mh-alias-insert-file' is used if non-nil\;
+otherwise the value of the \"Aliasfile:\" profile component is used.
+If the alias already exists, try to return the name of the file that
+contains it."
   (cond
    ((and mh-alias-insert-file (listp mh-alias-insert-file))
     (if (not (elt mh-alias-insert-file 1))        ; Only one entry, use it
@@ -445,7 +449,7 @@
       (cond
        ((not autolist)
         (error "No writable alias file.
-Set `mh-alias-insert-file' or the Aliasfile profile component"))
+Set `mh-alias-insert-file' or the \"Aliasfile:\" profile component"))
        ((not (elt autolist 1))        ; Only one entry, use it
         (car autolist))
        ((or (not alias)
@@ -488,12 +492,14 @@
 
 (defun mh-alias-add-alias-to-file (alias address &optional file)
   "Add ALIAS for ADDRESS in alias FILE without alias check or prompts.
-Prompt for alias file if not provided and there is more than one candidate.
+Prompt for alias file if not provided and there is more than one
+candidate.
 
-If the alias exists already, you will have the choice of inserting the new
-alias before or after the old alias. In the former case, this alias will be
-used when sending mail to this alias. In the latter case, the alias serves as
-an additional folder name hint when filing messages."
+If the alias exists already, you will have the choice of
+inserting the new alias before or after the old alias. In the
+former case, this alias will be used when sending mail to this
+alias. In the latter case, the alias serves as an additional
+folder name hint when filing messages."
   (if (not file)
       (setq file (mh-alias-insert-file alias)))
   (save-excursion
@@ -543,11 +549,12 @@
 ;;;###mh-autoload
 (defun mh-alias-add-alias (alias address)
   "*Add ALIAS for ADDRESS in personal alias file.
-This function prompts you for an alias and address. If the alias exists
-already, you will have the choice of inserting the new alias before or after
-the old alias. In the former case, this alias will be used when sending mail
-to this alias. In the latter case, the alias serves as an additional folder
-name hint when filing messages."
+This function prompts you for an alias and address. If the alias
+exists already, you will have the choice of inserting the new
+alias before or after the old alias. In the former case, this
+alias will be used when sending mail to this alias. In the latter
+case, the alias serves as an additional folder name hint when
+filing messages."
   (interactive "P\nP")
   (mh-alias-reload-maybe)
   (setq alias (completing-read "Alias: " mh-alias-alist nil nil alias))
--- a/lisp/mh-e/mh-comp.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/mh-e/mh-comp.el	Thu Dec 29 04:41:02 2005 +0000
@@ -92,8 +92,8 @@
 
 (defvar mh-redist-background nil
   "If non-nil redist will be done in background like send.
-This allows transaction log to be visible if -watch, -verbose or -snoop are
-used.")
+This allows transaction log to be visible if -watch, -verbose or
+-snoop are used.")
 
 
 
@@ -110,32 +110,39 @@
 
 (defvar mh-yank-hooks nil
   "Obsolete hook for modifying a citation just inserted in the mail buffer.
+
 Each hook function can find the citation between point and mark.
-And each hook function should leave point and mark around the citation
-text as modified.
+And each hook function should leave point and mark around the
+citation text as modified.
 
-This is a normal hook, misnamed for historical reasons.
-It is semi-obsolete and is only used if `mail-citation-hook' is nil.")
+This is a normal hook, misnamed for historical reasons. It is
+semi-obsolete and is only used if `mail-citation-hook' is nil.")
 
 (defvar mh-comp-formfile "components"
   "Name of file to be used as a skeleton for composing messages.
-Default is \"components\".  If not an absolute file name, the file
-is searched for first in the user's MH directory, then in the
-system MH lib directory.")
+
+Default is \"components\".
+
+If not an absolute file name, the file is searched for first in the
+user's MH directory, then in the system MH lib directory.")
 
 (defvar mh-repl-formfile "replcomps"
   "Name of file to be used as a skeleton for replying to messages.
-Default is \"replcomps\".  If not an absolute file name, the file
-is searched for first in the user's MH directory, then in the
-system MH lib directory.")
+
+Default is \"replcomps\".
+
+If not an absolute file name, the file is searched for first in the
+user's MH directory, then in the system MH lib directory.")
 
 (defvar mh-repl-group-formfile "replgroupcomps"
   "Name of file to be used as a skeleton for replying to messages.
-This file is used to form replies to the sender and all recipients of a
-message. Only used if `(mh-variant-p 'nmh)' is non-nil.
+
 Default is \"replgroupcomps\".
-If not an absolute file name, the file is searched for first in the user's MH
-directory, then in the system MH lib directory.")
+
+This file is used to form replies to the sender and all recipients of
+a message. Only used if `(mh-variant-p 'nmh)' is non-nil.
+If not an absolute file name, the file is searched for first in the
+user's MH directory, then in the system MH lib directory.")
 
 (defvar mh-rejected-letter-start
   (format "^%s$"
@@ -155,8 +162,8 @@
 
 (defvar mh-new-draft-cleaned-headers
   "^Date:\\|^Received:\\|^Message-Id:\\|^From:\\|^Sender:\\|^Errors-To:\\|^Delivery-Date:\\|^Return-Path:"
-  "Regexp of header lines to remove before offering a message as a new draft.
-Used by the \\<mh-folder-mode-map>`\\[mh-edit-again]' and `\\[mh-extract-rejected-mail]' commands.")
+  "Regexp of header lines to remove before offering a message as a new draft\\<mh-folder-mode-map>.
+Used by the \\[mh-edit-again] and \\[mh-extract-rejected-mail] commands.")
 
 (defvar mh-to-field-choices '(("t" . "To:") ("s" . "Subject:") ("c" . "Cc:")
                               ("b" . "Bcc:") ("f" . "Fcc:") ("r" . "From:")
@@ -216,12 +223,12 @@
 (defun mh-smail-batch (&optional to subject other-headers &rest ignored)
   "Compose a message with the MH mail system.
 
-This function does not prompt the user for any header fields, and thus
-is suitable for use by programs that want to create a mail buffer. Users
-should use \\[mh-smail] to compose mail.
+This function does not prompt the user for any header fields, and
+thus is suitable for use by programs that want to create a mail
+buffer. Users should use \\[mh-smail] to compose mail.
 
-Optional arguments for setting certain fields include TO, SUBJECT, and
-OTHER-HEADERS. Additional arguments are IGNORED."
+Optional arguments for setting certain fields include TO,
+SUBJECT, and OTHER-HEADERS. Additional arguments are IGNORED."
   (mh-find-path)
   (let ((mh-error-if-no-draft t))
     (mh-send (or to "") "" (or subject ""))))
@@ -237,11 +244,12 @@
 The optional arguments TO and SUBJECT specify recipients and the
 initial Subject field, respectively.
 
-OTHER-HEADERS is an alist specifying additional
-header fields.  Elements look like (HEADER . VALUE) where both
-HEADER and VALUE are strings.
+OTHER-HEADERS is an alist specifying additional header fields.
+Elements look like (HEADER . VALUE) where both HEADER and VALUE
+are strings.
 
-CONTINUE, SWITCH-FUNCTION, YANK-ACTION and SEND-ACTIONS are ignored."
+CONTINUE, SWITCH-FUNCTION, YANK-ACTION and SEND-ACTIONS are
+ignored."
   (mh-find-path)
   (let ((mh-error-if-no-draft t))
     (mh-send to "" subject)
@@ -254,20 +262,21 @@
 (defun mh-edit-again (message)
   "Edit a MESSAGE to send it again.
 
-If you don't complete a draft for one reason or another, and if the draft
-buffer is no longer available, you can pick your draft up again with this
-command. If you don't use a draft folder, your last \"draft\" file will be
-used. If you use draft folders, you'll need to visit the draft folder with
-\"\\[mh-visit-folder] drafts <RET>\", use \\[mh-next-undeleted-msg] to move to
-the appropriate message, and then use \\[mh-edit-again] to prepare the message
-for editing.
+If you don't complete a draft for one reason or another, and if
+the draft buffer is no longer available, you can pick your draft
+up again with this command. If you don't use a draft folder, your
+last \"draft\" file will be used. If you use draft folders,
+you'll need to visit the draft folder with \"\\[mh-visit-folder]
+drafts <RET>\", use \\[mh-next-undeleted-msg] to move to the
+appropriate message, and then use \\[mh-edit-again] to prepare
+the message for editing.
 
-This command can also be used to take messages that were sent to you and to
-send them to more people.
+This command can also be used to take messages that were sent to
+you and to send them to more people.
 
-Don't use this command to re-edit a message from a Mailer-Daemon who
-complained that your mail wasn't posted for some reason or another (see
-`mh-extract-rejected-mail').
+Don't use this command to re-edit a message from a Mailer-Daemon
+who complained that your mail wasn't posted for some reason or
+another (see `mh-extract-rejected-mail').
 
 The default message is the current message.
 
@@ -303,9 +312,10 @@
 (defun mh-extract-rejected-mail (message)
   "Edit a MESSAGE that was returned by the mail system.
 
-This command prepares the message for editing by removing the Mailer-Daemon
-envelope and unneeded header fields. Fix whatever addressing problem you had,
-and send the message again with \\[mh-send-letter].
+This command prepares the message for editing by removing the
+Mailer-Daemon envelope and unneeded header fields. Fix whatever
+addressing problem you had, and send the message again with
+\\[mh-send-letter].
 
 The default message is the current message.
 
@@ -335,15 +345,19 @@
 (defun mh-forward (to cc &optional range)
   "Forward message.
 
-You are prompted for the TO and CC recipients. You are given a draft to edit
-that looks like it would if you had run the MH command \"forw\". You are given
-a chance to add some text.
+You are prompted for the TO and CC recipients. You are given a
+draft to edit that looks like it would if you had run the MH
+command \"forw\". You can then add some text.
 
-You can forward several messages by using a RANGE. Check the documentation of
-`mh-interactive-range' to see how RANGE is read in interactive use.
+You can forward several messages by using a RANGE. All of the
+messages in the range are inserted into your draft. Check the
+documentation of `mh-interactive-range' to see how RANGE is read
+in interactive use.
 
-See also `mh-compose-forward-as-mime-flag', `mh-forward-subject-format',
-and `mh-send'."
+The hook `mh-forward-hook' is called on the draft.
+
+See also `mh-compose-forward-as-mime-flag',
+`mh-forward-subject-format', and `mh-send'."
   (interactive (list (mh-interactive-read-address "To: ")
                      (mh-interactive-read-address "Cc: ")
                      (mh-interactive-range "Forward")))
@@ -431,14 +445,15 @@
 (defun mh-redistribute (to cc &optional message)
   "Redistribute a message.
 
-This command is similar in function to forwarding mail, but it does not allow
-you to edit the message, nor does it add your name to the \"From\" header
-field. It appears to the recipient as if the message had come from the
-original sender. When you run this command, you are prompted for the TO and CC
-recipients. The default MESSAGE is the current message.
+This command is similar in function to forwarding mail, but it
+does not allow you to edit the message, nor does it add your name
+to the \"From\" header field. It appears to the recipient as if
+the message had come from the original sender. When you run this
+command, you are prompted for the TO and CC recipients. The
+default MESSAGE is the current message.
 
-Also investigate the \\[mh-edit-again] command for another way to redistribute
-messages.
+Also investigate the \\[mh-edit-again] command for another way to
+redistribute messages.
 
 See also `mh-redist-full-contents-flag'."
   (interactive (list (mh-read-address "Redist-To: ")
@@ -483,10 +498,11 @@
 
 (defun mh-show-buffer-message-number (&optional buffer)
   "Message number of displayed message in corresponding show buffer.
+
 Return nil if show buffer not displayed.
-If in `mh-letter-mode', don't display the message number being replied to,
-but rather the message number of the show buffer associated with our
-originating folder buffer.
+If in `mh-letter-mode', don't display the message number being replied
+to, but rather the message number of the show buffer associated with
+our originating folder buffer.
 Optional argument BUFFER can be used to specify the buffer."
   (save-excursion
     (if buffer
@@ -510,14 +526,14 @@
 (defun mh-reply (message &optional reply-to includep)
   "Reply to a MESSAGE.
 
-When you reply to a message, you are first prompted with \"Reply to whom?\"
-\(unless the optional argument REPLY-TO is provided). You have several choices
-here.
+When you reply to a message, you are first prompted with \"Reply
+to whom?\" (unless the optional argument REPLY-TO is provided).
+You have several choices here.
 
      Response     Reply Goes To
 
-     from         The person who sent the message.  This is the default,
-                  so <RET> is sufficient.
+     from         The person who sent the message.  This is the
+                  default, so <RET> is sufficient.
 
      to           Replies to the sender, plus all recipients in the
                   \"To:\" header field.
@@ -525,31 +541,32 @@
      all
      cc           Forms a reply to the sender, plus all recipients.
 
-Depending on your answer, \"repl\" is given a different argument to form your
-reply. Specifically, a choice of \"from\" or none at all runs \"repl -nocc
-all\", and a choice of \"to\" runs \"repl -cc to\". Finally, either \"cc\" or
-\"all\" runs \"repl -cc all -nocc me\".
+Depending on your answer, \"repl\" is given a different argument
+to form your reply. Specifically, a choice of \"from\" or none at
+all runs \"repl -nocc all\", and a choice of \"to\" runs \"repl
+-cc to\". Finally, either \"cc\" or \"all\" runs \"repl -cc all
+-nocc me\".
 
-Two windows are then created. One window contains the message to which you are
-replying in an MH-Show buffer. Your draft, in MH-Letter mode
-\(see `mh-letter-mode'), is in the other window.
-
-If you supply a prefix argument INCLUDEP, the message you are replying to is
-inserted in your reply after having first been run through \"mhl\" with the
-format file \"mhl.reply\".
+Two windows are then created. One window contains the message to
+which you are replying in an MH-Show buffer. Your draft, in
+MH-Letter mode (see `mh-letter-mode'), is in the other window.
 
-Alternatively, you can customize the option `mh-yank-behavior' and choose one
-of its \"Automatically\" variants to do the same thing. If you do so, the
-prefix argument has no effect.
+If you supply a prefix argument INCLUDEP, the message you are
+replying to is inserted in your reply after having first been run
+through \"mhl\" with the format file \"mhl.reply\".
+
+Alternatively, you can customize the option `mh-yank-behavior'
+and choose one of its \"Automatically\" variants to do the same
+thing. If you do so, the prefix argument has no effect.
 
-Another way to include the message automatically in your draft is to use
-\"repl: -filter repl.filter\" in your MH profile.
+Another way to include the message automatically in your draft is
+to use \"repl: -filter repl.filter\" in your MH profile.
 
-If you wish to customize the header or other parts of the reply draft, please
-see \"repl\" and \"mh-format\".
+If you wish to customize the header or other parts of the reply
+draft, please see \"repl\" and \"mh-format\".
 
-See also `mh-reply-show-message-flag', `mh-reply-default-reply-to', and
-`mh-send'."
+See also `mh-reply-show-message-flag',
+`mh-reply-default-reply-to', and `mh-send'."
   (interactive (list
                 (mh-get-msg-num t)
                 (let ((minibuffer-help-form
@@ -616,17 +633,19 @@
 (defun mh-send (to cc subject)
   "Compose a message.
 
-Your letter appears in an Emacs buffer whose mode is MH-Letter (see
-`mh-letter-mode').
+Your letter appears in an Emacs buffer whose mode is
+MH-Letter (see `mh-letter-mode').
 
-The arguments TO, CC, and SUBJECT can be used to prefill the draft fields or
-suppress the prompts if `mh-compose-prompt-flag' is on. They are also passed
-to the function set in the option `mh-compose-letter-function'.
+The arguments TO, CC, and SUBJECT can be used to prefill the
+draft fields or suppress the prompts if `mh-compose-prompt-flag'
+is on. They are also passed to the function set in the option
+`mh-compose-letter-function'.
 
 See also `mh-insert-x-mailer-flag' and `mh-letter-mode-hook'.
 
-Outside of an MH-Folder buffer (`mh-folder-mode'), you must call either
-\\[mh-smail] or \\[mh-smail-other-window] to compose a new message."
+Outside of an MH-Folder buffer (`mh-folder-mode'), you must call
+either \\[mh-smail] or \\[mh-smail-other-window] to compose a new
+message."
   (interactive (list
                 (mh-interactive-read-address "To: ")
                 (mh-interactive-read-address "Cc: ")
@@ -639,8 +658,8 @@
 (defun mh-send-other-window (to cc subject)
   "Compose a message in another window.
 
-See `mh-send' for more information and a description of how the TO, CC, and
-SUBJECT arguments are used."
+See `mh-send' for more information and a description of how the
+TO, CC, and SUBJECT arguments are used."
   (interactive (list
                 (mh-interactive-read-address "To: ")
                 (mh-interactive-read-address "Cc: ")
@@ -690,14 +709,16 @@
 
 (defun mh-read-draft (use initial-contents delete-contents-file)
   "Read draft file into a draft buffer and make that buffer the current one.
-USE is a message used for prompting about the intended use of the message.
+
+USE is a message used for prompting about the intended use of the
+message.
 INITIAL-CONTENTS is filename that is read into an empty buffer, or nil
-if buffer should not be modified.  Delete the initial-contents file if
+if buffer should not be modified. Delete the initial-contents file if
 DELETE-CONTENTS-FILE flag is set.
 Returns the draft folder's name.
-If the draft folder facility is enabled in ~/.mh_profile, a new buffer is
-used each time and saved in the draft folder.  The draft file can then be
-reused."
+If the draft folder facility is enabled in ~/.mh_profile, a new buffer
+is used each time and saved in the draft folder. The draft file can
+then be reused."
   (cond (mh-draft-folder
          (let ((orig-default-dir default-directory)
                (draft-file-name (mh-new-draft-name)))
@@ -745,7 +766,8 @@
 
 (defun mh-annotate-msg (msg buffer note &rest args)
   "Mark MSG in BUFFER with character NOTE and annotate message with ARGS.
-MSG can be a message number, a list of message numbers, or a sequence."
+MSG can be a message number, a list of message numbers, or a
+sequence."
   (apply 'mh-exec-cmd "anno" buffer
          (if (listp msg) (append msg args) (cons msg args)))
   (save-excursion
@@ -777,7 +799,8 @@
   "Move to the end of the FIELD in the header.
 Move to end of entire header if FIELD not found.
 Returns non-nil iff FIELD was found.
-The optional second arg is for pre-version 4 compatibility and is IGNORED."
+The optional second arg is for pre-version 4 compatibility and is
+IGNORED."
   (cond ((mh-goto-header-field field)
          (mh-header-field-end)
          t)
@@ -904,20 +927,21 @@
      "\t\t  Signature:              \\[mh-insert-signature]"))
   "Key binding cheat sheet.
 
-This is an associative array which is used to show the most common commands.
-The key is a prefix char. The value is one or more strings which are
-concatenated together and displayed in the minibuffer if ? is pressed after
-the prefix character. The special key nil is used to display the
-non-prefixed commands.
+This is an associative array which is used to show the most
+common commands. The key is a prefix char. The value is one or
+more strings which are concatenated together and displayed in the
+minibuffer if ? is pressed after the prefix character. The
+special key nil is used to display the non-prefixed commands.
 
-The substitutions described in `substitute-command-keys' are performed as
-well.")
+The substitutions described in `substitute-command-keys' are
+performed as well.")
 
 ;;;###mh-autoload
 (defun mh-fill-paragraph-function (arg)
   "Fill paragraph at or after point.
-Prefix ARG means justify as well. This function enables `fill-paragraph' to
-work better in MH-Letter mode (see `mh-letter-mode')."
+Prefix ARG means justify as well. This function enables
+`fill-paragraph' to work better in MH-Letter mode (see
+`mh-letter-mode')."
   (interactive "P")
   (let ((fill-paragraph-function) (fill-prefix))
     (if (mh-in-header-p)
@@ -933,18 +957,19 @@
 
 ;;;###autoload
 (define-derived-mode mh-letter-mode text-mode "MH-Letter"
-  "Mode for composing letters in MH-E.\\<mh-letter-mode-map>
+  "Mode for composing letters in MH-E\\<mh-letter-mode-map>.
 
-When you have finished composing, type \\[mh-send-letter] to send the message
-using the MH mail handling system.
+When you have finished composing, type \\[mh-send-letter] to send
+the message using the MH mail handling system.
 
-There are two types of tags used by MH-E when composing MIME messages: MML and
-MH. The option `mh-compose-insertion' controls what type of tags are inserted
-by MH-E commands. These tags can be converted to MIME body parts by running
-\\[mh-mh-to-mime] for MH-style directives or \\[mh-mml-to-mime] for MML tags.
+There are two types of tags used by MH-E when composing MIME
+messages: MML and MH. The option `mh-compose-insertion' controls
+what type of tags are inserted by MH-E commands. These tags can
+be converted to MIME body parts by running \\[mh-mh-to-mime] for
+MH-style directives or \\[mh-mml-to-mime] for MML tags.
 
-Options that control this mode can be changed with \\[customize-group];
-specify the \"mh-compose\" group.
+Options that control this mode can be changed with
+\\[customize-group]; specify the \"mh-compose\" group.
 
 When a message is composed, the hooks `text-mode-hook' and
 `mh-letter-mode-hook' are run.
@@ -1050,8 +1075,8 @@
 
 (defun mh-letter-header-end ()
   "Find the end of the message header.
-This function is to be used only for font locking. It works by searching for
-`mh-mail-header-separator' in the buffer."
+This function is to be used only for font locking. It works by
+searching for `mh-mail-header-separator' in the buffer."
   (save-excursion
     (goto-char (point-min))
     (cond ((equal mh-mail-header-separator "") (point-min))
@@ -1061,7 +1086,8 @@
 
 (defun mh-auto-fill-for-letter ()
   "Perform auto-fill for message.
-Header is treated specially by inserting a tab before continuation lines."
+Header is treated specially by inserting a tab before continuation
+lines."
   (if (mh-in-header-p)
       (let ((fill-prefix "\t"))
         (do-auto-fill))
@@ -1079,8 +1105,9 @@
 (defun mh-to-field ()
   "Move to specified header field.
 The field is indicated by the previous keystroke (the last keystroke
-of the command) according to the list in the variable `mh-to-field-choices'.
-Create the field if it does not exist.  Set the mark to point before moving."
+of the command) according to the list in the variable
+`mh-to-field-choices'. Create the field if it does not exist. Set the
+mark to point before moving."
   (interactive)
   (expand-abbrev)
   (let ((target (cdr (or (assoc (char-to-string (logior last-input-char ?`))
@@ -1109,8 +1136,8 @@
 ;;;###mh-autoload
 (defun mh-to-fcc (&optional folder)
   "Move to \"Fcc:\" header field.
-This command will prompt you for the FOLDER name in which to file a copy of
-the draft."
+This command will prompt you for the FOLDER name in which to file a
+copy of the draft."
   (interactive)
   (or folder
       (setq folder (mh-prompt-for-folder
@@ -1143,21 +1170,24 @@
 ;;;###mh-autoload
 (defun mh-insert-signature (&optional file)
   "Insert signature in message.
+
 This command inserts your signature at the current cursor location.
 
 By default, the text of your signature is taken from the file
-\"~/.signature\". You can read from other sources by changing the option
-`mh-signature-file-name' or passing in a signature FILE.
+\"~/.signature\". You can read from other sources by changing the
+option `mh-signature-file-name'.
 
-A signature separator (\"-- \") will be added if the signature block does not
-contain one and `mh-signature-separator-flag' is on.
+A signature separator (\"-- \") will be added if the signature block
+does not contain one and `mh-signature-separator-flag' is on.
 
-The value of `mh-insert-signature-hook' is a list of functions to be
-called, with no arguments, after the signature is inserted. These functions
-may access the actual name of the file or the function used to insert the
-signature with `mh-signature-file-name'.
+The hook `mh-insert-signature-hook' is run after the signature is
+inserted. Hook functions may access the actual name of the file or the
+function used to insert the signature with `mh-signature-file-name'.
 
-The signature can also be inserted using Identities (see `mh-identity-list')"
+The signature can also be inserted using Identities (see
+`mh-identity-list').
+
+In a program, you can pass in a signature FILE."
   (interactive)
   (save-excursion
     (insert "\n")
@@ -1208,9 +1238,10 @@
 ;;;###mh-autoload
 (defun mh-check-whom ()
   "Verify recipients, showing expansion of any aliases.
-This command expands aliases so you can check the actual address(es) in the
-alias. A new buffer named \"*MH-E Recipients*\" is created with the output of
-\"whom\"."
+
+This command expands aliases so you can check the actual address(es)
+in the alias. A new buffer named \"*MH-E Recipients*\" is created with
+the output of \"whom\"."
   (interactive)
   (let ((file-name buffer-file-name))
     (save-buffer)
@@ -1249,8 +1280,8 @@
 
 (defvar mh-x-mailer-string nil
   "*String containing the contents of the X-Mailer header field.
-If nil, this variable is initialized to show the version of MH-E, Emacs, and
-MH the first time a message is composed.")
+If nil, this variable is initialized to show the version of MH-E,
+Emacs, and MH the first time a message is composed.")
 
 (defun mh-insert-x-mailer ()
   "Append an X-Mailer field to the header.
@@ -1291,11 +1322,14 @@
 ;;;###mh-autoload
 (defun mh-insert-auto-fields (&optional non-interactive)
   "Insert custom fields if recipient is found in `mh-auto-fields-list'.
-Sets buffer-local `mh-insert-auto-fields-done-local' when done and inserted
-something.  If NON-INTERACTIVE is non-nil, do not be verbose and only
-attempt matches if `mh-insert-auto-fields-done-local' is nil.
 
-An `identity' entry is skipped if one was already entered manually.
+Sets buffer-local `mh-insert-auto-fields-done-local' when done
+and inserted something. If NON-INTERACTIVE is non-nil, do not be
+verbose and only attempt matches if
+`mh-insert-auto-fields-done-local' is nil.
+
+An `identity' entry is skipped if one was already entered
+manually.
 
 Return t if fields added; otherwise return nil."
   (interactive)
@@ -1336,7 +1370,8 @@
 
 (defun mh-modify-header-field (field value &optional overwrite-flag)
   "To header FIELD add VALUE.
-If OVERWRITE-FLAG is non-nil then the old value, if present, is discarded."
+If OVERWRITE-FLAG is non-nil then the old value, if present, is
+discarded."
   (cond ((and overwrite-flag
               (mh-goto-header-field (concat field ":")))
          (insert " " value)
@@ -1359,15 +1394,16 @@
                                        config)
   "Edit and compose a draft message in buffer DRAFT and send or save it.
 SEND-ARGS is the argument passed to the send command.
-SENT-FROM-FOLDER is buffer containing scan listing of current folder, or
-nil if none exists.
+SENT-FROM-FOLDER is buffer containing scan listing of current folder,
+or nil if none exists.
 SENT-FROM-MSG is the message number or sequence name or nil.
 The TO, SUBJECT, and CC fields are passed to the
 `mh-compose-letter-function'.
-If ANNOTATE-CHAR is non-null, it is used to notate the scan listing of the
-message.  In that case, the ANNOTATE-FIELD is used to build a string
-for `mh-annotate-msg'.
-CONFIG is the window configuration to restore after sending the letter."
+If ANNOTATE-CHAR is non-null, it is used to notate the scan listing of
+the message. In that case, the ANNOTATE-FIELD is used to build a
+string for `mh-annotate-msg'.
+CONFIG is the window configuration to restore after sending the
+letter."
   (pop-to-buffer draft)
   (mh-letter-mode)
 
@@ -1414,8 +1450,8 @@
 
 (defun mh-ascii-buffer-p ()
   "Check if current buffer is entirely composed of ASCII.
-The function doesn't work for XEmacs since `find-charset-region' doesn't exist
-there."
+The function doesn't work for XEmacs since `find-charset-region'
+doesn't exist there."
   (loop for charset in (mh-funcall-if-exists
                         find-charset-region (point-min) (point-max))
         unless (eq charset 'ascii) return nil
@@ -1424,16 +1460,18 @@
 ;;;###mh-autoload
 (defun mh-send-letter (&optional arg)
   "Save draft and send message.
-When you are all through editing a message, you send it with this command. You
-can give an argument ARG to monitor the first stage of the delivery\; this
-output can be found in a buffer called \"*MH-E Mail Delivery*\".
+
+When you are all through editing a message, you send it with this
+command. You can give a prefix argument ARG to monitor the first stage
+of the delivery\; this output can be found in a buffer called \"*MH-E
+Mail Delivery*\".
 
-The value of `mh-before-send-letter-hook' is a list of functions to be called
-at the beginning of this command. For example, if you want to check your
-spelling in your message before sending, add the `ispell-message' function.
+The hook `mh-before-send-letter-hook' is run at the beginning of the
+this command. For example, if you want to check your spelling in your
+message before sending, add the `ispell-message' function.
 
-In case the MH \"send\" program is installed under a different name, use
-`mh-send-prog' to tell MH-E the name."
+In case the MH \"send\" program is installed under a different name,
+use `mh-send-prog' to tell MH-E the name."
   (interactive "P")
   (run-hooks 'mh-before-send-letter-hook)
   (if (and (mh-insert-auto-fields t)
@@ -1500,15 +1538,17 @@
 ;;;###mh-autoload
 (defun mh-insert-letter (folder message verbatim)
   "Insert a message.
-This command prompts you for the FOLDER and MESSAGE number and inserts the
-message, indented by `mh-ins-buf-prefix' (\"> \") unless `mh-yank-behavior' is
-set to one of the supercite flavors in which case supercite is used to format
-the message. Certain undesirable header fields (see
-`mh-invisible-header-fields-compiled') are removed before insertion.
 
-If given a prefix argument VERBATIM, the header is left intact, the message is
-not indented, and \"> \" is not inserted before each line. This command leaves
-the mark before the letter and point after it."
+This command prompts you for the FOLDER and MESSAGE number and inserts
+the message, indented by `mh-ins-buf-prefix' (\"> \") unless
+`mh-yank-behavior' is set to one of the supercite flavors in which
+case supercite is used to format the message. Certain undesirable
+header fields (see `mh-invisible-header-fields-compiled') are removed
+before insertion.
+
+If given a prefix argument VERBATIM, the header is left intact, the
+message is not indented, and \"> \" is not inserted before each line.
+This command leaves the mark before the letter and point after it."
   (interactive
    (list (mh-prompt-for-folder "Message from" mh-sent-from-folder nil)
          (read-string (concat "Message number"
@@ -1550,24 +1590,34 @@
 (defun mh-yank-cur-msg ()
   "Insert the current message into the draft buffer.
 
-It is often useful to insert a snippet of text from a letter that someone
-mailed to provide some context for your reply. This command does this by
-adding an attribution, yanking a portion of text from the message to which
-you're replying, and inserting `mh-ins-buf-prefix' (`> ') before each line.
+It is often useful to insert a snippet of text from a letter that
+someone mailed to provide some context for your reply. This
+command does this by adding an attribution, yanking a portion of
+text from the message to which you're replying, and inserting
+`mh-ins-buf-prefix' (`> ') before each line.
 
 The attribution consists of the sender's name and email address
 followed by the content of the `mh-extract-from-attribution-verb'
 option.
 
-You can also turn on the `mh-delete-yanked-msg-window-flag' option to delete
-the window containing the original message after yanking it to make more room
-on your screen for your reply.
+You can also turn on the `mh-delete-yanked-msg-window-flag'
+option to delete the window containing the original message after
+yanking it to make more room on your screen for your reply.
+
+You can control how the message to which you are replying is
+yanked into your reply using `mh-yank-behavior'.
 
-You can control how the message to which you are replying is yanked
-into your reply using `mh-yank-behavior'.
+If this isn't enough, you can gain full control over the
+appearance of the included text by setting `mail-citation-hook'
+to a function that modifies it. For example, if you set this hook
+to `trivial-cite' (which is NOT part of Emacs), set
+`mh-yank-behavior' to \"Body and Header\" (see URL
+`http://shasta.cs.uiuc.edu/~lrclause/tc.html').
 
-If this isn't enough, you can gain full control over the appearance of the
-included text by setting `mail-citation-hook' to a function that modifies it."
+Note that if `mail-citation-hook' is set, `mh-ins-buf-prefix' is
+not inserted. If the option `mh-yank-behavior' is set to one of
+the supercite flavors, the hook `mail-citation-hook' is ignored
+and `mh-ins-buf-prefix' is not inserted."
   (interactive)
   (if (and mh-sent-from-folder
            (save-excursion (set-buffer mh-sent-from-folder) mh-show-buffer)
@@ -1660,9 +1710,9 @@
 
 (defun mh-insert-prefix-string (mh-ins-string)
   "Insert prefix string before each line in buffer.
-The inserted letter is cited using `sc-cite-original' if `mh-yank-behavior' is
-one of 'supercite or 'autosupercite. Otherwise, simply insert MH-INS-STRING
-before each line."
+The inserted letter is cited using `sc-cite-original' if
+`mh-yank-behavior' is one of 'supercite or 'autosupercite.
+Otherwise, simply insert MH-INS-STRING before each line."
   (goto-char (point-min))
   (cond ((or (eq mh-yank-behavior 'supercite)
              (eq mh-yank-behavior 'autosupercite))
@@ -1681,9 +1731,10 @@
 ;;;###mh-autoload
 (defun mh-fully-kill-draft ()
   "Quit editing and delete draft message.
-If for some reason you are not happy with the draft, you can use the this
-command to kill the draft buffer and delete the draft message. Use the
-\\[kill-buffer] command if you don't want to delete the draft message."
+If for some reason you are not happy with the draft, you can use
+the this command to kill the draft buffer and delete the draft
+message. Use the \\[kill-buffer] command if you don't want to
+delete the draft message."
   (interactive)
   (if (y-or-n-p "Kill draft message? ")
       (let ((config mh-previous-window-config))
@@ -1711,10 +1762,12 @@
 ;;;###mh-autoload
 (defun mh-open-line ()
   "Insert a newline and leave point after it.
-This command is similar to the \\[open-line] command in that it inserts a
-newline after point. It differs in that it also inserts the right number of
-quoting characters and spaces so that the next line begins in the same column
-as it was. This is useful when breaking up paragraphs in replies."
+
+This command is similar to the \\[open-line] command in that it
+inserts a newline after point. It differs in that it also inserts
+the right number of quoting characters and spaces so that the
+next line begins in the same column as it was. This is useful
+when breaking up paragraphs in replies."
   (interactive)
   (let ((column (current-column))
         (prefix (mh-current-fill-prefix)))
@@ -1731,9 +1784,9 @@
 (defmacro mh-display-completion-list-compat (word choices)
   "Completes WORD from CHOICES using `display-completion-list'.
 Calls `display-completion-list' correctly in older environments.
-Versions of Emacs prior to version 22 lacked a COMMON-SUBSTRING argument
-which is used to highlight the next possible character you can enter
-in the current list of completions."
+Versions of Emacs prior to version 22 lacked a COMMON-SUBSTRING
+argument which is used to highlight the next possible character you
+can enter in the current list of completions."
   (if (>= emacs-major-version 22)
       `(display-completion-list (all-completions ,word ,choices) ,word)
     `(display-completion-list (all-completions ,word ,choices))))
@@ -1802,11 +1855,12 @@
 
 (defun mh-letter-complete (arg)
   "Perform completion on header field or word preceding point.
-If the field contains addresses (for example, \"To:\" or \"Cc:\") or folders
-\(for example, \"Fcc:\") then this command will provide alias completion. In
-the body of the message, this command runs `mh-letter-complete-function'
-instead, which is set to \"'ispell-complete-word\" by default. This command
-takes a prefix argument ARG that is passed to the
+If the field contains addresses (for example, \"To:\" or \"Cc:\")
+or folders (for example, \"Fcc:\") then this command will
+provide alias completion. In the body of the message, this
+command runs `mh-letter-complete-function' instead, which is set
+to \"'ispell-complete-word\" by default. This command takes a
+prefix argument ARG that is passed to the
 `mh-letter-complete-function'."
   (interactive "P")
   (let ((func nil))
@@ -1819,8 +1873,9 @@
 
 (defun mh-letter-complete-or-space (arg)
   "Perform completion or insert space.
-Turn on the `mh-compose-space-does-completion-flag' option to use this command
-to perform completion in the header. Otherwise, a space is inserted.
+Turn on the `mh-compose-space-does-completion-flag' option to use
+this command to perform completion in the header. Otherwise, a
+space is inserted.
 
 ARG is the number of spaces inserted."
   (interactive "p")
@@ -1839,9 +1894,9 @@
 
 (defun mh-letter-confirm-address ()
   "Flash alias expansion.
-Addresses are separated by a comma\; and when you press the comma, this
-command flashes the alias expansion in the minibuffer if
-`mh-alias-flash-on-comma' is turned on."
+Addresses are separated by a comma\; and when you press the
+comma, this command flashes the alias expansion in the minibuffer
+if `mh-alias-flash-on-comma' is turned on."
   (interactive)
   (cond ((not (mh-in-header-p)) (self-insert-command 1))
         ((eq (cdr (assoc (mh-letter-header-field-at-point)
@@ -1855,8 +1910,8 @@
 
 (defun mh-letter-header-field-at-point ()
   "Return the header field name at point.
-A symbol is returned whose name is the string obtained by downcasing the field
-name."
+A symbol is returned whose name is the string obtained by
+downcasing the field name."
   (save-excursion
     (end-of-line)
     (and (re-search-backward mh-letter-header-field-regexp nil t)
@@ -1865,12 +1920,13 @@
 ;;;###mh-autoload
 (defun mh-letter-next-header-field-or-indent (arg)
   "Move to next field or indent depending on point.
-Within the header of the message, this command moves between fields, but skips
-those fields listed in `mh-compose-skipped-header-fields'. After the last
-field, this command then moves point to the message body before cycling back
-to the first field. If point is already past the first line of the message
-body, then this command indents by calling `indent-relative' with the given
-prefix argument ARG."
+Within the header of the message, this command moves between
+fields, but skips those fields listed in
+`mh-compose-skipped-header-fields'. After the last field, this
+command then moves point to the message body before cycling back
+to the first field. If point is already past the first line of
+the message body, then this command indents by calling
+`indent-relative' with the given prefix argument ARG."
   (interactive "P")
   (let ((header-end (save-excursion
                       (goto-char (mh-mail-header-end))
@@ -1882,7 +1938,8 @@
 
 (defun mh-letter-next-header-field ()
   "Cycle to the next header field.
-If we are at the last header field go to the start of the message body."
+If we are at the last header field go to the start of the message
+body."
   (let ((header-end (mh-mail-header-end)))
     (cond ((>= (point) header-end) (goto-char (point-min)))
           ((< (point) (progn
@@ -1902,10 +1959,10 @@
 ;;;###mh-autoload
 (defun mh-letter-previous-header-field ()
   "Cycle to the previous header field.
-This command moves backwards between the fields and cycles to the body of the
-message after the first field. Unlike the
-\\[mh-letter-next-header-field-or-indent] command, it will always take point
-to the last field from anywhere in the body."
+This command moves backwards between the fields and cycles to the
+body of the message after the first field. Unlike the
+\\[mh-letter-next-header-field-or-indent] command, it will always
+take point to the last field from anywhere in the body."
   (interactive)
   (let ((header-end (mh-mail-header-end)))
     (if (>= (point) header-end)
@@ -1928,8 +1985,8 @@
 
 (defun mh-letter-skip-leading-whitespace-in-header-field ()
   "Skip leading whitespace in a header field.
-If the header field doesn't have at least one space after the colon then a
-space character is added."
+If the header field doesn't have at least one space after the
+colon then a space character is added."
   (let ((need-space t))
     (while (memq (char-after) '(?\t ?\ ))
       (forward-char)
@@ -1947,8 +2004,9 @@
 
 (defun mh-letter-toggle-header-field-display-button (event)
   "Toggle header field display at location of EVENT.
-This function does the same thing as `mh-letter-toggle-header-field-display'
-except that it is callable from a mouse button."
+This function does the same thing as
+`mh-letter-toggle-header-field-display' except that it is
+callable from a mouse button."
   (interactive "e")
   (mh-do-at-event-location event
     (mh-letter-toggle-header-field-display nil)))
@@ -1956,10 +2014,10 @@
 (defun mh-letter-toggle-header-field-display (arg)
   "Toggle display of header field at point.
 
-Use this command to display truncated header fields. This command is a toggle
-so entering it again will hide the field. This command takes a prefix argument
-ARG: if negative then the field is hidden, if positive then the field is
-displayed."
+Use this command to display truncated header fields. This command
+is a toggle so entering it again will hide the field. This
+command takes a prefix argument ARG: if negative then the field
+is hidden, if positive then the field is displayed."
   (interactive (list nil))
   (when (and (mh-in-header-p)
              (progn
@@ -2019,13 +2077,15 @@
 
 (defun mh-interactive-read-address (prompt)
   "Read an address.
-If `mh-compose-prompt-flag' is non-nil, then read an address with PROMPT.
+If `mh-compose-prompt-flag' is non-nil, then read an address with
+PROMPT.
 Otherwise return the empty string."
   (if mh-compose-prompt-flag (mh-read-address prompt) ""))
 
 (defun mh-interactive-read-string (prompt)
   "Read a string.
-If `mh-compose-prompt-flag' is non-nil, then read a string with PROMPT.
+If `mh-compose-prompt-flag' is non-nil, then read a string with
+PROMPT.
 Otherwise return the empty string."
   (if mh-compose-prompt-flag (read-string prompt) ""))
 
--- a/lisp/mh-e/mh-customize.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/mh-e/mh-customize.el	Thu Dec 29 04:41:02 2005 +0000
@@ -90,8 +90,8 @@
 
 (defun mh-customize (&optional delete-other-windows-flag)
   "Customize MH-E variables.
-If optional argument DELETE-OTHER-WINDOWS-FLAG is non-nil, other windows in
-the frame are removed."
+If optional argument DELETE-OTHER-WINDOWS-FLAG is non-nil, other
+windows in the frame are removed."
   (interactive "P")
   (customize-group 'mh-e)
   (when delete-other-windows-flag
@@ -103,8 +103,8 @@
 
 (defgroup mh-e nil
   "Emacs interface to the MH mail system.
-MH is the Rand Mail Handler. Other implementations include nmh and GNU
-mailutils."
+MH is the Rand Mail Handler. Other implementations include nmh
+and GNU mailutils."
   :link '(custom-manual "(mh-e)Top")
   :group 'mail)
 
@@ -271,12 +271,14 @@
 (defcustom mh-variant 'autodetect
   "*Specifies the variant used by MH-E.
 
-The default setting of this option is `Auto-detect' which means that MH-E will
-automatically choose the first of nmh, MH, or GNU mailutils that it finds in
-the directories listed in `mh-path' (which you can customize), `mh-sys-path',
-and `exec-path'. If, for example, you have both nmh and mailutils installed
-and `mh-variant-in-use' was initialized to nmh but you want to use mailutils,
-then you can set this option to `mailutils'.
+The default setting of this option is \"Auto-detect\" which means
+that MH-E will automatically choose the first of nmh, MH, or GNU
+mailutils that it finds in the directories listed in
+`mh-path' (which you can customize), `mh-sys-path', and
+`exec-path'. If, for example, you have both nmh and mailutils
+installed and `mh-variant-in-use' was initialized to nmh but you
+want to use mailutils, then you can set this option to
+\"mailutils\".
 
 When this variable is changed, MH-E resets `mh-progs', `mh-lib',
 `mh-lib-progs', `mh-flists-present-flag', and `mh-variant-in-use'
@@ -295,26 +297,30 @@
 
 (defcustom mh-alias-completion-ignore-case-flag t
   "*Non-nil means don't consider case significant in MH alias completion.
-As MH ignores case in the aliases, so too does MH-E. However, you may turn
-this option off to make case significant which can be used to segregate
-completion of your aliases. You might use lowercase for mailing lists and
-uppercase for people."
+
+As MH ignores case in the aliases, so too does MH-E. However, you
+may turn this option off to make case significant which can be
+used to segregate completion of your aliases. You might use
+lowercase for mailing lists and uppercase for people."
   :type 'boolean
   :group 'mh-alias)
 
 (defcustom mh-alias-expand-aliases-flag nil
   "*Non-nil means to expand aliases entered in the minibuffer.
-In other words, aliases entered in the minibuffer will be expanded to the full
-address in the message draft. By default, this expansion is not performed."
+
+In other words, aliases entered in the minibuffer will be
+expanded to the full address in the message draft. By default,
+this expansion is not performed."
   :type 'boolean
   :group 'mh-alias)
 
 (defcustom mh-alias-flash-on-comma t
   "*Specify whether to flash address or warn on translation.
-This option controls the behavior when a [comma] is pressed while entering
-aliases or addresses. The default setting flashes the address associated with
-an address in the minibuffer briefly, but does not display a warning if the
-alias is not found."
+
+This option controls the behavior when a [comma] is pressed while
+entering aliases or addresses. The default setting flashes the
+address associated with an address in the minibuffer briefly, but
+does not display a warning if the alias is not found."
   :type '(choice (const :tag "Flash but Don't Warn If No Alias" t)
                  (const :tag "Flash and Warn If No Alias" 1)
                  (const :tag "Don't Flash Nor Warn If No Alias" nil))
@@ -322,11 +328,12 @@
 
 (defcustom mh-alias-insert-file nil
   "*Filename used to store a new MH-E alias.
-The default setting of this option is `Use Aliasfile Profile Component'. This
-option can also hold the name of a file or a list a file names. If this option
-is set to a list of file names, or the `Aliasfile:' profile component contains
-more than one file name, MH-E will prompt for one of them when MH-E adds an
-alias."
+
+The default setting of this option is \"Use Aliasfile Profile
+Component\". This option can also hold the name of a file or a
+list a file names. If this option is set to a list of file names,
+or the \"Aliasfile:\" profile component contains more than one file
+name, MH-E will prompt for one of them when MH-E adds an alias."
   :type '(choice (const :tag "Use Aliasfile Profile Component" nil)
                  (file :tag "Alias File")
                  (repeat :tag "List of Alias Files" file))
@@ -334,9 +341,10 @@
 
 (defcustom mh-alias-insertion-location 'sorted
   "Specifies where new aliases are entered in alias files.
-This option is set to `Alphabetical' by default. If you organize your alias
-file in other ways, then adding aliases to the `Top' or `Bottom' of your alias
-file might be more appropriate."
+
+This option is set to \"Alphabetical\" by default. If you organize
+your alias file in other ways, then adding aliases to the \"Top\"
+or \"Bottom\" of your alias file might be more appropriate."
   :type '(choice (const :tag "Alphabetical" sorted)
                  (const :tag "Top" top)
                  (const :tag "Bottom" bottom))
@@ -345,46 +353,52 @@
 (defcustom mh-alias-local-users t
   "*If on, local users are added to alias completion.
 
-Aliases are created from `/etc/passwd' entries with a user ID larger than
-a magical number, typically 200. This can be a handy tool on a machine where
-you and co-workers exchange messages. These aliases have the form
-`local.first.last' if a real name is present in the password file.
-Otherwise, the alias will have the form `local.login'.
-
-If you're on a system with thousands of users you don't know, and the loading
-of local aliases slows MH-E down noticeably, then turn this option off.
-
-This option also takes a string which is executed to generate the password
-file. For example, use \"ypcat passwd\" to obtain the NIS password file."
+Aliases are created from \"/etc/passwd\" entries with a user ID
+larger than a magical number, typically 200. This can be a handy
+tool on a machine where you and co-workers exchange messages.
+These aliases have the form \"local.first.last\" if a real name is
+present in the password file. Otherwise, the alias will have the
+form \"local.login\".
+
+If you're on a system with thousands of users you don't know, and
+the loading of local aliases slows MH-E down noticeably, then
+turn this option off.
+
+This option also takes a string which is executed to generate the
+password file. For example, use \"ypcat passwd\" to obtain the
+NIS password file."
   :type '(choice (boolean) (string))
   :group 'mh-alias)
 
 (defcustom mh-alias-local-users-prefix "local."
   "*String prefixed to the real names of users from the password file.
-This option can also be set to `Use Login'.
+This option can also be set to \"Use Login\".
 
 For example, consider the following password file entry:
 
     psg:x:1000:1000:Peter S Galbraith,,,:/home/psg:/bin/tcsh
 
-The following settings of this option will produce the associated aliases:
+The following settings of this option will produce the associated
+aliases:
 
     \"local.\"                  local.peter.galbraith
     \"\"                        peter.galbraith
     Use Login                   psg
 
-This option has no effect if variable `mh-alias-local-users' is turned off."
+This option has no effect if variable `mh-alias-local-users' is
+turned off."
   :type '(choice (const :tag "Use Login" nil)
                  (string))
   :group 'mh-alias)
 
 (defcustom mh-alias-passwd-gecos-comma-separator-flag t
   "*Non-nil means the gecos field in the password file uses a comma separator.
-In the example in `mh-alias-local-users-prefix', commas are used to separate
-different values within the so-called gecos field. This is a fairly common
-usage. However, in the rare case that the gecos field in your password file is
-not separated by commas and whose contents may contain commas, you can turn
-this option off."
+
+In the example in `mh-alias-local-users-prefix', commas are used
+to separate different values within the so-called gecos field.
+This is a fairly common usage. However, in the rare case that the
+gecos field in your password file is not separated by commas and
+whose contents may contain commas, you can turn this option off."
   :type 'boolean
   :group 'mh-alias)
 
@@ -395,9 +409,10 @@
 (defcustom mh-new-messages-folders t
   "Folders searched for the \"unseen\" sequence.
 
-Set this option to \"Inbox\" to search the \"+inbox\" folder or \"All\" to
-search all of the top level folders. Otherwise, list the folders that should
-be searched with the \"Choose Folders\" menu item.
+Set this option to \"Inbox\" to search the \"+inbox\" folder or
+\"All\" to search all of the top level folders. Otherwise, list
+the folders that should be searched with the \"Choose Folders\"
+menu item.
 
 See also `mh-recursive-folders-flag'."
   :type '(choice (const :tag "Inbox" t)
@@ -408,9 +423,10 @@
 (defcustom mh-ticked-messages-folders t
   "Folders searched for `mh-tick-seq'.
 
-Set this option to \"Inbox\" to search the \"+inbox\" folder or \"All\" to
-search all of the top level folders. Otherwise, list the folders that should
-be searched with the \"Choose Folders\" menu item.
+Set this option to \"Inbox\" to search the \"+inbox\" folder or
+\"All\" to search all of the top level folders. Otherwise, list
+the folders that should be searched with the \"Choose Folders\"
+menu item.
 
 See also `mh-recursive-folders-flag'."
   :type '(choice (const :tag "Inbox" t)
@@ -420,17 +436,20 @@
 
 (defcustom mh-large-folder 200
   "The number of messages that indicates a large folder.
-If a folder is deemed to be large, that is the number of messages in it exceed
-this value, then confirmation is needed when it is visited. Even when
-`mh-show-threads-flag' is non-nil, the folder is not automatically threaded, if
-it is large. If set to nil all folders are treated as if they are small."
+
+If a folder is deemed to be large, that is the number of messages
+in it exceed this value, then confirmation is needed when it is
+visited. Even when `mh-show-threads-flag' is non-nil, the folder
+is not automatically threaded, if it is large. If set to nil all
+folders are treated as if they are small."
   :type '(choice (const :tag "No Limit") integer)
   :group 'mh-folder)
 
 (defcustom mh-recenter-summary-flag nil
   "*Non-nil means to recenter the summary window.
-If this option is turned on, recenter the summary window when the show window
-is toggled off."
+
+If this option is turned on, recenter the summary window when the
+show window is toggled off."
   :type 'boolean
   :group 'mh-folder)
 
@@ -443,9 +462,10 @@
   "*Additional arguments for \"sortm\"\\<mh-folder-mode-map>.
 
 This option is consulted when a prefix argument is used with
-\\[mh-sort-folder]. Normally default arguments to \"sortm\" are specified in
-the MH profile. This option may be used to provide an alternate view. For
-example, \"'(\"-nolimit\" \"-textfield\" \"subject\")\" is a useful setting."
+\\[mh-sort-folder]. Normally default arguments to \"sortm\" are
+specified in the MH profile. This option may be used to provide
+an alternate view. For example, \"'(\"-nolimit\" \"-textfield\"
+\"subject\")\" is a useful setting."
   :type 'string
   :group 'mh-folder)
 
@@ -454,24 +474,28 @@
 ;;; Folder Selection (:group 'mh-folder-selection)
 
 (defcustom mh-default-folder-for-message-function nil
-  "Function to select a default folder for refiling or `Fcc'.
-The current buffer is set to the message being refiled with point at the start
-of the message. This function should return the default folder as a string
-with a leading `+' sign. It can also return nil so that the last folder name
-is used as the default, or an empty string to suppress the default entirely."
+  "Function to select a default folder for refiling or \"Fcc\".
+
+The current buffer is set to the message being refiled with point
+at the start of the message. This function should return the
+default folder as a string with a leading \"+\" sign. It can also
+return nil so that the last folder name is used as the default,
+or an empty string to suppress the default entirely."
   :type 'function
   :group 'mh-folder-selection)
 
 (defcustom mh-default-folder-list nil
   "*List of addresses and folders.
-The folder name associated with the first address found in this list is used
-as the default for `mh-refile-msg' and similar functions. Each element in this
-list contains a `Check Recipient' item. If this item is turned on, then the
-address is checked against the recipient instead of the sender. This is useful
-for mailing lists.
-
-See `mh-prompt-for-refile-folder' and `mh-folder-from-address' for more
-information."
+
+The folder name associated with the first address found in this
+list is used as the default for `mh-refile-msg' and similar
+functions. Each element in this list contains a \"Check Recipient\"
+item. If this item is turned on, then the address is checked
+against the recipient instead of the sender. This is useful for
+mailing lists.
+
+See `mh-prompt-for-refile-folder' and `mh-folder-from-address'
+for more information."
   :type '(repeat (list (regexp :tag "Address")
                        (string :tag "Folder")
                        (boolean :tag "Check Recipient")))
@@ -479,13 +503,14 @@
 
 (defcustom mh-default-folder-must-exist-flag t
   "*Non-nil means guessed folder name must exist to be used.
-If the derived folder does not exist, and this option is on, then the last
-folder name used is suggested. This is useful if you get mail from various
-people for whom you have an alias, but file them all in the same project
-folder.
-
-See `mh-prompt-for-refile-folder' and `mh-folder-from-address' for more
-information."
+
+If the derived folder does not exist, and this option is on, then
+the last folder name used is suggested. This is useful if you get
+mail from various people for whom you have an alias, but file
+them all in the same project folder.
+
+See `mh-prompt-for-refile-folder' and `mh-folder-from-address'
+for more information."
   :type 'boolean
   :group 'mh-folder-selection)
 
@@ -493,8 +518,8 @@
   "*Prefix used for folder names generated from aliases.
 The prefix is used to prevent clutter in your mail directory.
 
-See `mh-prompt-for-refile-folder' and `mh-folder-from-address' for more
-information."
+See `mh-prompt-for-refile-folder' and `mh-folder-from-address'
+for more information."
   :type 'string
   :group 'mh-folder-selection)
 
@@ -505,34 +530,38 @@
 (defcustom mh-identity-list nil
   "*List of identities.
 
-To customize this option, click on the `INS' button and enter a label such as
-`Home' or `Work'. Then click on the `INS' button with the label `Add at least
-one item below'. Then choose one of the items in the `Value Menu'.
-
-You can specify an alternate `From:' header field using the `From Field' menu
-item. You must include a valid email address. A standard format is `First Last
-<login@@host.domain>'. If you use an initial with a period, then you must
-quote your name as in `\"First I. Last\" <login@@host.domain>'. People usually
-list the name of the company where they work using the `Organization Field'
-menu item. Set any arbitrary header field and value in the `Other Field' menu
-item. Unless the header field is a standard one, precede the name of your
-field's label with `X-', as in `X-Fruit-of-the-Day:'. The value of
-`Attribution Verb' overrides the setting of
-`mh-extract-from-attribution-verb'. Set your signature with the `Signature'
-menu item. You can specify the contents of `mh-signature-file-name', a file,
-or a function. Specify a different key to sign or encrypt messages with the
-`GPG Key ID' menu item.
-
-You can select the identities you have added via the menu called `Identity' in
-the MH-Letter buffer. You can also use \\[mh-insert-identity]. To clear the
-fields and signature added by the identity, select the `None' identity.
-
-The `Identity' menu contains two other items to save you from having to set
-the identity on every message. The menu item `Set Default for Session' can be
-used to set the default identity to the current identity until you exit Emacs.
-The menu item `Save as Default' sets the option `mh-identity-default' to the
-current identity setting. You can also customize the `mh-identity-default'
-option in the usual fashion."
+To customize this option, click on the \"INS\" button and enter a label
+such as \"Home\" or \"Work\". Then click on the \"INS\" button with the
+label \"Add at least one item below\". Then choose one of the items in
+the \"Value Menu\".
+
+You can specify an alternate \"From:\" header field using the \"From
+Field\" menu item. You must include a valid email address. A standard
+format is \"First Last <login@@host.domain>\". If you use an initial
+with a period, then you must quote your name as in '\"First I. Last\"
+<login@@host.domain>'. People usually list the name of the company
+where they work using the \"Organization Field\" menu item. Set any
+arbitrary header field and value in the \"Other Field\" menu item.
+Unless the header field is a standard one, precede the name of your
+field's label with \"X-\", as in \"X-Fruit-of-the-Day:\". The value of
+\"Attribution Verb\" overrides the setting of
+`mh-extract-from-attribution-verb'. Set your signature with the
+\"Signature\" menu item. You can specify the contents of
+`mh-signature-file-name', a file, or a function. Specify a different
+key to sign or encrypt messages with the \"GPG Key ID\" menu item.
+
+You can select the identities you have added via the menu called
+\"Identity\" in the MH-Letter buffer. You can also use
+\\[mh-insert-identity]. To clear the fields and signature added by the
+identity, select the \"None\" identity.
+
+The \"Identity\" menu contains two other items to save you from having
+to set the identity on every message. The menu item \"Set Default for
+Session\" can be used to set the default identity to the current
+identity until you exit Emacs. The menu item \"Save as Default\" sets
+the option `mh-identity-default' to the current identity setting. You
+can also customize the `mh-identity-default' option in the usual
+fashion."
   :type '(repeat (list :tag ""
                        (string :tag "Label")
                        (repeat :tag "Add at least one item below"
@@ -567,37 +596,40 @@
 (defcustom mh-auto-fields-list nil
   "List of recipients for which header lines are automatically inserted.
 
-This option can be used to set the identity depending on the recipient. To
-customize this option, click on the `INS' button and enter a regular
-expression for the recipient's address. Click on the `INS' button with the
-`Add at least one item below' label. Then choose one of the items in the
-`Value Menu'.
-
-The `Identity' menu item is used to select an identity from those configured
-in `mh-identity-list'. All of the information for that identity will be added
-if the recipient matches. The `Fcc Field' menu item is used to select a folder
-that is used in the `Fcc:' header. When you send the message, MH will put a
-copy of your message in this folder. The `Mail-Followup-To Field' menu item is
-used to insert an `Mail-Followup-To:' header field with the recipients you
-provide. If the recipient's mail user agent supports this header field (as nmh
-does), then their replies will go to the addresses listed. This is useful if
-their replies go both to the list and to you and you don't have a mechanism to
-suppress duplicates. If you reply to someone not on the list, you must either
-remove the `Mail-Followup-To:' field, or ensure the recipient is also listed
-there so that he receives replies to your reply. Other header fields may be
-added using the `Other Field' menu item.
-
-These fields can only be added after the recipient is known. Once the header
-contains one or more recipients, run the \\[mh-insert-auto-fields] command or
-choose the `Identity -> Insert Auto Fields' menu item to insert these fields
-manually. However, you can just send the message and the fields will be added
-automatically. You are given a chance to see these fields and to confirm them
-before the message is actually sent. You can do away with this confirmation by
-turning off the option `mh-auto-fields-prompt-flag'.
-
-You should avoid using the same header field in `mh-auto-fields-list' and
-`mh-identity-list' definitions that may apply to the same message as the
-result is undefined."
+This option can be used to set the identity depending on the
+recipient. To customize this option, click on the \"INS\" button and
+enter a regular expression for the recipient's address. Click on the
+\"INS\" button with the \"Add at least one item below\" label. Then choose
+one of the items in the \"Value Menu\".
+
+The \"Identity\" menu item is used to select an identity from those
+configured in `mh-identity-list'. All of the information for that
+identity will be added if the recipient matches. The \"Fcc Field\" menu
+item is used to select a folder that is used in the \"Fcc:\" header.
+When you send the message, MH will put a copy of your message in this
+folder. The \"Mail-Followup-To Field\" menu item is used to insert an
+\"Mail-Followup-To:\" header field with the recipients you provide. If
+the recipient's mail user agent supports this header field (as nmh
+does), then their replies will go to the addresses listed. This is
+useful if their replies go both to the list and to you and you don't
+have a mechanism to suppress duplicates. If you reply to someone not
+on the list, you must either remove the \"Mail-Followup-To:\" field, or
+ensure the recipient is also listed there so that he receives replies
+to your reply. Other header fields may be added using the \"Other
+Field\" menu item.
+
+These fields can only be added after the recipient is known. Once the
+header contains one or more recipients, run the
+\\[mh-insert-auto-fields] command or choose the \"Identity -> Insert
+Auto Fields\" menu item to insert these fields manually. However, you
+can just send the message and the fields will be added automatically.
+You are given a chance to see these fields and to confirm them before
+the message is actually sent. You can do away with this confirmation
+by turning off the option `mh-auto-fields-prompt-flag'.
+
+You should avoid using the same header field in `mh-auto-fields-list'
+and `mh-identity-list' definitions that may apply to the same message
+as the result is undefined."
   :type `(repeat
           (list :tag ""
                 (string :tag "Recipient")
@@ -645,25 +677,28 @@
     (":pgg-default-user-id" . mh-identity-handler-gpg-identity))
   "Handler functions for fields in `mh-identity-list'.
 
-This option is used to change the way that fields, signatures, and
-attributions in `mh-identity-list' are added. To customize
-`mh-identity-handlers', replace the name of an existing handler function
-associated with the field you want to change with the name of a function you
-have written. You can also click on an `INS' button and insert a field of your
-choice and the name of the function you have written to handle it.
-
-The `Field' field can be any field that you've used in your
-`mh-identity-list'. The special fields `:attribution-verb', `:signature', or
-`:pgg-default-user-id' are used for the `mh-identity-list' choices
-`Attribution Verb', `Signature', and `GPG Key ID' respectively.
-
-The handler associated with the `:default' field is used when no other field
-matches.
-
-The handler functions are passed two or three arguments: the FIELD itself (for
-example, `From'), or one of the special fields (for example, `:signature'),
-and the ACTION `'remove' or `'add'. If the action is `'add', an additional
-argument containing the VALUE for the field is given."
+This option is used to change the way that fields, signatures,
+and attributions in `mh-identity-list' are added. To customize
+`mh-identity-handlers', replace the name of an existing handler
+function associated with the field you want to change with the
+name of a function you have written. You can also click on an
+\"INS\" button and insert a field of your choice and the name of
+the function you have written to handle it.
+
+The \"Field\" field can be any field that you've used in your
+`mh-identity-list'. The special fields \":attribution-verb\",
+\":signature\", or \":pgg-default-user-id\" are used for the
+`mh-identity-list' choices \"Attribution Verb\", \"Signature\", and
+\"GPG Key ID\" respectively.
+
+The handler associated with the \":default\" field is used when no
+other field matches.
+
+The handler functions are passed two or three arguments: the
+FIELD itself (for example, \"From\"), or one of the special
+fields (for example, \":signature\"), and the ACTION 'remove or
+'add. If the action is 'add, an additional argument
+containing the VALUE for the field is given."
   :type '(repeat (cons (string :tag "Field") function))
   :group 'mh-identity)
 
@@ -674,36 +709,38 @@
 (defcustom mh-inc-prog "inc"
   "*Program to incorporate new mail into a folder.
 
-This program generates a one-line summary for each of the new messages. Unless
-it is an absolute pathname, the file is assumed to be in the `mh-progs'
-directory. You may also link a file to `inc' that uses a different format.
-You'll then need to modify several scan line format variables appropriately."
+This program generates a one-line summary for each of the new
+messages. Unless it is an absolute pathname, the file is assumed
+to be in the `mh-progs' directory. You may also link a file to
+\"inc\" that uses a different format. You'll then need to modify
+several scan line format variables appropriately."
   :type 'string
   :group 'mh-inc)
 
 (defcustom mh-inc-spool-list nil
   "*Alternate spool files.
 
-You can use the `mh-inc-spool-list' variable to direct MH-E to retrieve mail
-from arbitrary spool files other than your system mailbox, file it in folders
-other than your `+inbox', and assign key bindings to incorporate this mail.
-
-Suppose you are subscribed to the `mh-e-devel' mailing list and you use
-`procmail' to filter this mail into `~/mail/mh-e' with the following recipe in
-`.procmailrc':
+You can use the `mh-inc-spool-list' variable to direct MH-E to
+retrieve mail from arbitrary spool files other than your system
+mailbox, file it in folders other than your \"+inbox\", and assign
+key bindings to incorporate this mail.
+
+Suppose you are subscribed to the \"mh-e-devel\" mailing list and
+you use \"procmail\" to filter this mail into \"~/mail/mh-e\" with
+the following recipe in \".procmailrc\":
 
     MAILDIR=$HOME/mail
     :0:
     * ^From mh-e-devel-admin@stop.mail-abuse.org
     mh-e
 
-In order to incorporate `~/mail/mh-e' into `+mh-e' with an `I m'
-\(`mh-inc-spool-mh-e'\) command, customize this option, and click on the `INS'
-button. Enter a `Spool File' of `~/mail/mh-e', a `Folder' of `mh-e', and a
-`Key Binding' of `m'.
-
-You can use `xbuffy' to automate the incorporation of this mail using the
-`gnudoit' command in the `gnuserv' package as follows:
+In order to incorporate \"~/mail/mh-e\" into \"+mh-e\" with an
+\"I m\" (mh-inc-spool-mh-e) command, customize this option, and click
+on the \"INS\" button. Enter a \"Spool File\" of \"~/mail/mh-e\", a
+\"Folder\" of \"mh-e\", and a \"Key Binding\" of \"m\".
+
+You can use \"xbuffy\" to automate the incorporation of this mail
+using the \"gnudoit\" command in the \"gnuserv\" package as follows:
 
     box ~/mail/mh-e
         title mh-e
@@ -723,13 +760,15 @@
 
 (defcustom mh-index-program nil
   "Indexing program that MH-E shall use.
-The default setting of this option is `Auto-detect' which means that MH-E will
-automatically choose one of swish++, swish-e, mairix, namazu, pick and grep in
-that order. If, for example, you have both swish++ and mairix installed and
-you want to use mairix, then you can set this option to `mairix'.
-
-More information about setting up an indexing program to use with MH-E can be
-found in the documentation of `mh-index-search'."
+
+The default setting of this option is \"Auto-detect\" which means
+that MH-E will automatically choose one of swish++, swish-e,
+mairix, namazu, pick and grep in that order. If, for example, you
+have both swish++ and mairix installed and you want to use
+mairix, then you can set this option to \"mairix\".
+
+More information about setting up an indexing program to use with
+MH-E can be found in the documentation of `mh-index-search'."
   :type '(choice (const :tag "Auto-detect" nil)
                  (const :tag "swish++" swish++)
                  (const :tag "swish-e" swish)
@@ -752,13 +791,17 @@
     (bogofilter mh-bogofilter-blacklist mh-bogofilter-whitelist)
     (spamprobe mh-spamprobe-blacklist mh-spamprobe-whitelist))
   "Available choices of spam programs to use.
-This is an alist. For each element there are functions that blacklist a message
-as spam and whitelist a message incorrectly classified as spam.")
+
+This is an alist. For each element there are functions that
+blacklist a message as spam and whitelist a message incorrectly
+classified as spam.")
 
 (defun mh-junk-choose (symbol value)
   "Choose spam program to use.
-The function is always called with SYMBOL bound to `mh-junk-program' and VALUE
-bound to the new value of `mh-junk-program'. The function sets the variable
+
+The function is always called with SYMBOL bound to
+`mh-junk-program' and VALUE bound to the new value of
+`mh-junk-program'. The function sets the variable
 `mh-junk-choice' in addition to `mh-junk-program'."
   (set symbol value)
   (setq mh-junk-choice
@@ -770,9 +813,11 @@
 ;; User customizable variables
 (defcustom mh-junk-background nil
   "If on, spam programs are run in background.
-By default, the programs are run in the foreground, but this can be slow when
-junking large numbers of messages. If you have enough memory or don't junk
-that many messages at the same time, you might try turning on this option."
+
+By default, the programs are run in the foreground, but this can
+be slow when junking large numbers of messages. If you have
+enough memory or don't junk that many messages at the same time,
+you might try turning on this option."
   :type '(choice (const :tag "Off" nil)
                  (const :tag "On" 0))
   :group 'mh-junk)
@@ -786,11 +831,11 @@
 (defcustom mh-junk-program nil
   "Spam program that MH-E should use.
 
-The default setting of this option is \"Auto-detect\" which means that MH-E
-will automatically choose one of SpamAssassin, bogofilter, or SpamProbe in
-that order. If, for example, you have both SpamAssassin and bogofilter
-installed and you want to use bogofilter, then you can set this option to
-\"Bogofilter\"."
+The default setting of this option is \"Auto-detect\" which means
+that MH-E will automatically choose one of SpamAssassin,
+bogofilter, or SpamProbe in that order. If, for example, you have
+both SpamAssassin and bogofilter installed and you want to use
+bogofilter, then you can set this option to \"Bogofilter\"."
   :type '(choice (const :tag "Auto-detect" nil)
                  (const :tag "SpamAssassin" spamassassin)
                  (const :tag "Bogofilter" bogofilter)
@@ -804,11 +849,13 @@
 
 (defcustom mh-compose-insertion (if (locate-library "mml") 'mml 'mh)
   "Type of tags used when composing MIME messages.
-In addition to MH-style directives, MH-E also supports MML (MIME Meta
-Language) tags. (see Info node `(emacs-mime)Composing'). This option can be
-used to choose between them. By default, this option is set to \"MML\" if it
-is supported since it provides a lot more functionality. This option can also
-be set to \"MH\" if MH-style directives are preferred."
+
+In addition to MH-style directives, MH-E also supports MML (MIME
+Meta Language) tags. (see Info node `(emacs-mime)Composing').
+This option can be used to choose between them. By default, this
+option is set to \"MML\" if it is supported since it provides a
+lot more functionality. This option can also be set to \"MH\" if
+MH-style directives are preferred."
   :type '(choice (const :tag "MML" mml)
                  (const :tag "MH"  mh))
   :group 'mh-letter)
@@ -827,18 +874,20 @@
 
 (defcustom mh-delete-yanked-msg-window-flag nil
   "*Non-nil means delete any window displaying the message.
-This deletes the window containing the original message after yanking it with
-\\<mh-letter-mode-map>\\[mh-yank-cur-msg] to make more room on your screen for
-your reply."
+
+This deletes the window containing the original message after
+yanking it with \\<mh-letter-mode-map>\\[mh-yank-cur-msg] to make
+more room on your screen for your reply."
   :type 'boolean
   :group 'mh-letter)
 
 (defcustom mh-extract-from-attribution-verb "wrote:"
   "*Verb to use for attribution when a message is yanked by \\<mh-letter-mode-map>\\[mh-yank-cur-msg].
-The attribution consists of the sender's name and email address followed by
-the content of this option. This option can be set to \"wrote:\", \"a
-écrit:\", and \"schrieb:\". You can also use the \"Custom String\" menu item
-to enter your own verb."
+
+The attribution consists of the sender's name and email address
+followed by the content of this option. This option can be set to
+\"wrote:\", \"a écrit:\", and \"schrieb:\". You can also use the
+\"Custom String\" menu item to enter your own verb."
   :type '(choice (const "wrote:")
                  (const "a écrit:")
                  (const "schrieb:")
@@ -847,40 +896,51 @@
 
 (defcustom mh-ins-buf-prefix "> "
   "*String to put before each line of a yanked or inserted message.
-The prefix \"> \" is the default setting of this option. I suggest that you
-not modify this option since it is used by many mailers and news readers:
-messages are far easier to read if several included messages have all been
-indented by the same string."
+
+The prefix \"> \" is the default setting of this option. I
+suggest that you not modify this option since it is used by many
+mailers and news readers: messages are far easier to read if
+several included messages have all been indented by the same
+string.
+
+This prefix is not inserted if you use one of the supercite
+flavors of `mh-yank-behavior' or you have added a
+`mail-citation-hook'."
   :type 'string
   :group 'mh-letter)
 
 (defcustom mh-letter-complete-function 'ispell-complete-word
   "*Function to call when completing outside of address or folder fields.
-In the body of the message, \\<mh-letter-mode-map>\\[mh-letter-complete] runs
-this function, which is set to \"ispell-complete-word\" by default."
+
+In the body of the message,
+\\<mh-letter-mode-map>\\[mh-letter-complete] runs this function,
+which is set to \"ispell-complete-word\" by default."
   :type '(choice function (const nil))
   :group 'mh-letter)
 
 (defcustom mh-letter-fill-column 72
   "*Fill column to use in MH Letter mode.
-By default, this option is 72 to allow others to quote your message without
-line wrapping."
+
+By default, this option is 72 to allow others to quote your
+message without line wrapping."
   :type 'integer
   :group 'mh-letter)
 
 (defcustom mh-mml-method-default (if mh-pgp-support-flag "pgpmime" "none")
   "Default method to use in security tags.
-This option is used to select between a variety of mail security mechanisms.
-The default is \"PGP (MIME)\" if it is supported\; otherwise, the default is
-\"None\". Other mechanisms include vanilla \"PGP\" and \"S/MIME\".
-
-The `pgg' customization group may have some settings which may interest you
-\(see Info node `(pgg)').
-
-In particular, I set the option `pgg-encrypt-for-me' to t so that all messages
-I encrypt are encrypted with my public key as well. If you keep a copy of all
-of your outgoing mail with a \"Fcc:\" header field, this setting is vital so
-that you can read the mail you write!"
+
+This option is used to select between a variety of mail security
+mechanisms. The default is \"PGP (MIME)\" if it is supported\;
+otherwise, the default is \"None\". Other mechanisms include
+vanilla \"PGP\" and \"S/MIME\".
+
+The `pgg' customization group may have some settings which may
+interest you (see Info node `(pgg)').
+
+In particular, I set the option `pgg-encrypt-for-me' to t so that all
+messages I encrypt are encrypted with my public key as well. If you
+keep a copy of all of your outgoing mail with a \"Fcc:\" header field,
+this setting is vital so that you can read the mail you write!"
   :type '(choice (const :tag "PGP (MIME)" "pgpmime")
                  (const :tag "PGP" "pgp")
                  (const :tag "S/MIME" "smime")
@@ -890,89 +950,97 @@
 (defcustom mh-signature-file-name "~/.signature"
   "*Source of user's signature.
 
-By default, the text of your signature is taken from the file \"~/.signature\".
-You can read from other files by changing this option. This file may contain a
-vCard in which case an attachment is added with the vCard.
-
-This option may also be a symbol, in which case that function is called. You
-may not want a signature separator to be added for you; instead you may want
-to insert one yourself. Options that you may find useful to do this include
-`mh-signature-separator' (when inserting a signature separator) and
-`mh-signature-separator-regexp' (for finding said separator). The function
-`mh-signature-separator-p', which reports t if the buffer contains a
-separator, may be useful as well.
+By default, the text of your signature is taken from the file
+\"~/.signature\". You can read from other sources by changing this
+option. This file may contain a vCard in which case an attachment is
+added with the vCard.
+
+This option may also be a symbol, in which case that function is
+called. You may not want a signature separator to be added for you;
+instead you may want to insert one yourself. Options that you may find
+useful to do this include `mh-signature-separator' (when inserting a
+signature separator) and `mh-signature-separator-regexp' (for finding
+said separator). The function `mh-signature-separator-p', which
+reports t if the buffer contains a separator, may be useful as well.
 
 The signature is inserted into your message with the command
-\\<mh-letter-mode-map>\\[mh-insert-signature] or with the `mh-identity-list'
-option."
+\\<mh-letter-mode-map>\\[mh-insert-signature] or with the
+`mh-identity-list' option."
   :type 'file
   :group 'mh-letter)
 
 (defcustom mh-signature-separator-flag t
   "*Non-nil means a signature separator should be inserted.
-It is not recommended that you change this option since various mail user
-agents, including MH-E, use the separator to present the signature
-differently, and to suppress the signature when replying or yanking a letter
-into a draft."
+
+It is not recommended that you change this option since various
+mail user agents, including MH-E, use the separator to present
+the signature differently, and to suppress the signature when
+replying or yanking a letter into a draft."
   :type 'boolean
   :group 'mh-letter)
 
 (defcustom mh-x-face-file "~/.face"
   "*File containing face header field to insert in outgoing mail.
 
-If the file starts with either of the strings \"X-Face:\", \"Face:\" or
-\"X-Image-URL:\" then the contents are added to the message header verbatim.
-Otherwise it is assumed that the file contains the value of the \"X-Face:\"
-header field.
-
-The \"X-Face:\" header field, which is a low-resolution, black
-and white image, can be generated using the \"compface\" command
-\(see URL `ftp://ftp.cs.indiana.edu/pub/faces/compface/compface.tar.Z').
-The \"Online X-Face Converter\" is a useful resource for quick
-conversion of images into \"X-Face:\" header fields (see URL
+If the file starts with either of the strings \"X-Face:\", \"Face:\"
+or \"X-Image-URL:\" then the contents are added to the message header
+verbatim. Otherwise it is assumed that the file contains the value of
+the \"X-Face:\" header field.
+
+The \"X-Face:\" header field, which is a low-resolution, black and
+white image, can be generated using the \"compface\" command (see URL
+`ftp://ftp.cs.indiana.edu/pub/faces/compface/compface.tar.Z'). The
+\"Online X-Face Converter\" is a useful resource for quick conversion
+of images into \"X-Face:\" header fields (see URL
 `http://www.dairiki.org/xface/').
 
-Use the \"make-face\" script to convert a JPEG image to the
-higher resolution, color, \"Face:\" header field (see URL
+Use the \"make-face\" script to convert a JPEG image to the higher
+resolution, color, \"Face:\" header field (see URL
 `http://quimby.gnus.org/circus/face/make-face').
 
 The URL of any image can be used for the \"X-Image-URL:\" field and no
 processing of the image is required.
 
 To prevent the setting of any of these header fields, either set
-`mh-x-face-file' to nil, or simply ensure that the file defined by this option
-doesn't exist."
+`mh-x-face-file' to nil, or simply ensure that the file defined by
+this option doesn't exist."
   :type 'file
   :group 'mh-letter)
 
 (defcustom mh-yank-behavior 'attribution
   "*Controls which part of a message is yanked by \\<mh-letter-mode-map>\\[mh-yank-cur-msg].
 
-To include the entire message, including the entire header, use \"Body and
-Header\". Use \"Body\" to yank just the body without the header. To yank only
-the portion of the message following the point, set this option to \"Below
-Point\".
-
-Choose \"Invoke supercite\" to pass the entire message and header through
-supercite.
-
-If the \"Body With Attribution\" setting is used, then the message minus the
-header is yanked and a simple attribution line is added at the top using the
-value of the `mh-extract-from-attribution-verb' option. This is the default.
-
-If the \"Invoke supercite\" or \"Body With Attribution\" settings are used,
-the \"-noformat\" argument is passed to the \"repl\" program to override a
-\"-filter\" or \"-format\" argument. These settings also have
-\"Automatically\" variants that perform the action automatically when you
-reply so that you don't need to use \\[mh-yank-cur-msg] at all. Note that this
-automatic action is only performed if the show buffer matches the message
-being replied to. People who use the automatic variants tend to turn on the
-`mh-delete-yanked-msg-window-flag' option as well so that the show window is
-never displayed.
-
-If the show buffer has a region, the `mh-yank-behavior' option is ignored
-unless its value is one of Attribution variants in which case the attribution
-is added to the yanked region."
+To include the entire message, including the entire header, use \"Body
+and Header\". Use \"Body\" to yank just the body without the header.
+To yank only the portion of the message following the point, set this
+option to \"Below Point\".
+
+Choose \"Invoke supercite\" to pass the entire message and header
+through supercite.
+
+If the \"Body With Attribution\" setting is used, then the message
+minus the header is yanked and a simple attribution line is added at
+the top using the value of the `mh-extract-from-attribution-verb'
+option. This is the default.
+
+If the \"Invoke supercite\" or \"Body With Attribution\" settings are
+used, the \"-noformat\" argument is passed to the \"repl\" program to
+override a \"-filter\" or \"-format\" argument. These settings also
+have \"Automatically\" variants that perform the action automatically
+when you reply so that you don't need to use \\[mh-yank-cur-msg] at
+all. Note that this automatic action is only performed if the show
+buffer matches the message being replied to. People who use the
+automatic variants tend to turn on the
+`mh-delete-yanked-msg-window-flag' option as well so that the show
+window is never displayed.
+
+If the show buffer has a region, the `mh-yank-behavior' option is
+ignored unless its value is one of Attribution variants in which case
+the attribution is added to the yanked region.
+
+If this option is set to one of the supercite flavors, the hook
+`mail-citation-hook' is ignored and `mh-ins-buf-prefix' is not
+inserted."
   :type '(choice (const :tag "Body and Header" t)
                  (const :tag "Body" body)
                  (const :tag "Below Point" nil)
@@ -989,10 +1057,11 @@
 
 (defcustom mh-interpret-number-as-range-flag t
   "*Non-nil means interpret a number as a range.
-Since one of the most frequent ranges used is \"last:N\", MH-E will interpret
-input such as \"200\" as \"last:200\" if this option is on (which is the
-default). If you need to scan just the message 200, then use the range
-\"200:200\"."
+
+Since one of the most frequent ranges used is \"last:N\", MH-E
+will interpret input such as \"200\" as \"last:200\" if this
+option is on (which is the default). If you need to scan just the
+message 200, then use the range \"200:200\"."
   :type 'boolean
   :group 'mh-ranges)
 
@@ -1005,8 +1074,9 @@
 
 (defun mh-adaptive-cmd-note-flag-check (symbol value)
   "Check if desired setting is legal.
-Throw an error if user tries to turn on `mh-adaptive-cmd-note-flag' when
-`mh-scan-format-file' isn't t. Otherwise, set SYMBOL to VALUE."
+Throw an error if user tries to turn on
+`mh-adaptive-cmd-note-flag' when `mh-scan-format-file' isn't t.
+Otherwise, set SYMBOL to VALUE."
   (if (and value
            (not (eq mh-scan-format-file t)))
       (error "%s %s" "Can't turn on unless mh-scan-format-file"
@@ -1015,8 +1085,9 @@
 
 (defun mh-scan-format-file-check (symbol value)
   "Check if desired setting is legal.
-Throw an error if user tries to set `mh-scan-format-file' to anything but t
-when `mh-adaptive-cmd-note-flag' is on. Otherwise, set SYMBOL to VALUE."
+Throw an error if user tries to set `mh-scan-format-file' to
+anything but t when `mh-adaptive-cmd-note-flag' is on. Otherwise,
+set SYMBOL to VALUE."
   (if (and (not (eq value t))
            (eq mh-adaptive-cmd-note-flag t))
       (error "%s %s" "You must turn off mh-adaptive-cmd-note-flag"
@@ -1025,16 +1096,17 @@
 
 (defcustom mh-adaptive-cmd-note-flag t
   "*Non-nil means that the message number width is determined dynamically.
-If you've created your own format to handle long message numbers, you'll be
-pleased to know you no longer need it since MH-E adapts its internal format
-based upon the largest message number if this option is on (the default).
-This option may only be turned on when `mh-scan-format-file' is set to \"Use
-MH-E scan Format\".
-
-If you prefer fixed-width message numbers, turn off this option and call
-`mh-set-cmd-note' with the width specified by your format file
-\(see `mh-scan-format-file'). For example, the default width is 4, so you would
-use \"(mh-set-cmd-note 4)\"."
+
+If you've created your own format to handle long message numbers,
+you'll be pleased to know you no longer need it since MH-E adapts its
+internal format based upon the largest message number if this option
+is on (the default). This option may only be turned on when
+`mh-scan-format-file' is set to \"Use MH-E scan Format\".
+
+If you prefer fixed-width message numbers, turn off this option and
+call `mh-set-cmd-note' with the width specified by your format file
+\(see `mh-scan-format-file'). For example, the default width is 4, so
+you would use \"(mh-set-cmd-note 4)\"."
   :type 'boolean
   :group 'mh-scan-line-formats
   :set 'mh-adaptive-cmd-note-flag-check)
@@ -1042,22 +1114,24 @@
 (defcustom mh-scan-format-file t
   "Specifies the format file to pass to the scan program.
 
-The default setting for this option is \"Use MH-E scan Format\". This means
-that the format string will be taken from the either `mh-scan-format-mh' or
-`mh-scan-format-nmh' depending on whether MH or nmh (or GNU mailutils) is in
-use. This setting also enables you to turn on the `mh-adaptive-cmd-note-flag'
-option.
+The default setting for this option is \"Use MH-E scan Format\". This
+means that the format string will be taken from the either
+`mh-scan-format-mh' or `mh-scan-format-nmh' depending on whether MH or
+nmh (or GNU mailutils) is in use. This setting also enables you to
+turn on the `mh-adaptive-cmd-note-flag' option.
 
 You can also set this option to \"Use Default scan Format\" to get the
-same output as you would get if you ran \"scan\" from the shell. If you have a
-format file that you want MH-E to use but not MH, you can set this option to
-\"Specify a scan Format File\" and enter the name of your format file.
-
-If you change the format of the scan lines you'll need to tell MH-E how to
-parse the new format. As you will see, quite a lot of variables are involved
-to do that. Use \"\\[apropos] RET mh-scan.*regexp\" to obtain a list of these
-variables. You will also have to call `mh-set-cmd-note' if your notations are
-not in column 4 (columns in Emacs start with 0)."
+same output as you would get if you ran \"scan\" from the shell. If
+you have a format file that you want MH-E to use but not MH, you can
+set this option to \"Specify a scan Format File\" and enter the name
+of your format file.
+
+If you change the format of the scan lines you'll need to tell MH-E
+how to parse the new format. As you will see, quite a lot of variables
+are involved to do that. Use \"\\[apropos] RET mh-scan.*regexp\" to
+obtain a list of these variables. You will also have to call
+`mh-set-cmd-note' if your notations are not in column 4 (columns in
+Emacs start with 0)."
   :type '(choice (const :tag "Use MH-E scan Format" t)
                  (const :tag "Use Default scan Format" nil)
                  (file  :tag "Specify a scan Format File"))
@@ -1066,10 +1140,12 @@
 
 (defcustom mh-scan-prog "scan"
   "*Program used to scan messages.
-The name of the program that generates a listing of one line per message is
-held in this option. Unless this variable contains an absolute pathname, it is
-assumed to be in the `mh-progs' directory. You may link another program to
-`scan' (see \"mh-profile(5)\") to produce a different type of listing."
+
+The name of the program that generates a listing of one line per
+message is held in this option. Unless this variable contains an
+absolute pathname, it is assumed to be in the `mh-progs'
+directory. You may link another program to `scan' (see
+\"mh-profile(5)\") to produce a different type of listing."
   :type 'string
   :group 'mh-scan-line-formats)
 (make-variable-buffer-local 'mh-scan-prog)
@@ -1081,24 +1157,26 @@
 (defcustom mh-compose-forward-as-mime-flag t
   "*Non-nil means that messages are forwarded as attachments.
 
-By default, this option is on which means that the forwarded messages are
-included as attachments. If you would prefer to forward your messages verbatim
-\(as text, inline), then turn off this option. Forwarding messages verbatim
-works well for short, textual messages, but your recipient won't be able to
-view any non-textual attachments that were in the forwarded message. Be aware
-that if you have \"forw: -mime\" in your MH profile, then forwarded messages
-will always be included as attachments regardless of the settings of this
-option."
+By default, this option is on which means that the forwarded
+messages are included as attachments. If you would prefer to
+forward your messages verbatim (as text, inline), then turn off
+this option. Forwarding messages verbatim works well for short,
+textual messages, but your recipient won't be able to view any
+non-textual attachments that were in the forwarded message. Be
+aware that if you have \"forw: -mime\" in your MH profile, then
+forwarded messages will always be included as attachments
+regardless of the settings of this option."
   :type 'boolean
   :group 'mh-sending-mail)
 
 (defcustom mh-compose-letter-function nil
   "Invoked when starting a new draft.
 
-However, it is the last function called before you edit your message. The
-consequence of this is that you can write a function to write and send the
-message for you. This function is passed three arguments: the contents of the
-TO, SUBJECT, and CC header fields."
+However, it is the last function called before you edit your
+message. The consequence of this is that you can write a function
+to write and send the message for you. This function is passed
+three arguments: the contents of the TO, SUBJECT, and CC header
+fields."
   :type '(choice (const nil) function)
   :group 'mh-sending-mail)
 
@@ -1110,40 +1188,40 @@
 (defcustom mh-forward-subject-format "%s: %s"
   "*Format string for forwarded message subject.
 
-This option is a string which includes two escapes (\"%s\"). The first \"%s\"
-is replaced with the sender of the original message, and the second one is
-replaced with the original \"Subject:\"."
+This option is a string which includes two escapes (\"%s\"). The
+first \"%s\" is replaced with the sender of the original message,
+and the second one is replaced with the original \"Subject:\"."
   :type 'string
   :group 'mh-sending-mail)
 
 (defcustom mh-insert-x-mailer-flag t
   "*Non-nil means append an \"X-Mailer:\" header field to the header.
 
-This header field includes the version of MH-E and Emacs that you are using.
-If you don't want to participate in our marketing, you can turn this option
-off."
+This header field includes the version of MH-E and Emacs that you
+are using. If you don't want to participate in our marketing, you
+can turn this option off."
   :type 'boolean
   :group 'mh-sending-mail)
 
 (defcustom mh-redist-full-contents-flag nil
   "*Non-nil means the \"dist\" command needs entire letter for redistribution.
 
-This option must be turned on if \"dist\" requires the whole letter for
-redistribution, which is the case if \"send\" is compiled with the BERK option
-\(which many people abhor). If you find that MH will not allow you to
-redistribute a message that has been redistributed before, turn off this
-option."
+This option must be turned on if \"dist\" requires the whole
+letter for redistribution, which is the case if \"send\" is
+compiled with the BERK option (which many people abhor). If you
+find that MH will not allow you to redistribute a message that
+has been redistributed before, turn off this option."
   :type 'boolean
   :group 'mh-sending-mail)
 
 (defcustom mh-reply-default-reply-to nil
   "*Sets the person or persons to whom a reply will be sent.
 
-This option is set to \"Prompt\" by default so that you are prompted for the
-recipient of a reply. If you find that most of the time that you specify
-\"cc\" when you reply to a message, set this option to \"cc\". Other choices
-include \"from\", \"to\", or \"all\". You can always edit the recipients in
-the draft."
+This option is set to \"Prompt\" by default so that you are
+prompted for the recipient of a reply. If you find that most of
+the time that you specify \"cc\" when you reply to a message, set
+this option to \"cc\". Other choices include \"from\", \"to\", or
+\"all\". You can always edit the recipients in the draft."
   :type '(choice (const :tag "Prompt" nil)
                  (const "from")
                  (const "to")
@@ -1154,8 +1232,8 @@
 (defcustom mh-reply-show-message-flag t
   "*Non-nil means the MH-Show buffer is displayed when replying.
 
-If you include the message automatically, you can hide the MH-Show
-buffer by turning off this option.
+If you include the message automatically, you can hide the
+MH-Show buffer by turning off this option.
 
 See also `mh-reply'."
   :type 'boolean
@@ -1172,32 +1250,34 @@
 (defcustom mh-refile-preserves-sequences-flag t
   "*Non-nil means that sequences are preserved when messages are refiled.
 
-If a message is in any sequence (except \"Previous-Sequence:\" and \"cur\")
-when it is refiled, then it will still be in those sequences in the
-destination folder. If this behavior is not desired, then turn off this
-option."
+If a message is in any sequence (except \"Previous-Sequence:\"
+and \"cur\") when it is refiled, then it will still be in those
+sequences in the destination folder. If this behavior is not
+desired, then turn off this option."
   :type 'boolean
   :group 'mh-sequences)
 
 (defcustom mh-tick-seq 'tick
   "The name of the MH sequence for ticked messages.
 
-You can customize this option if you already use the \"tick\" sequence for
-your own use. You can also disable all of the ticking functions by choosing
-the \"Disable Ticking\" item but there isn't much advantage to that."
+You can customize this option if you already use the \"tick\"
+sequence for your own use. You can also disable all of the
+ticking functions by choosing the \"Disable Ticking\" item but
+there isn't much advantage to that."
   :type '(choice (const :tag "Disable Ticking" nil)
                  symbol)
   :group 'mh-sequences)
 
 (defcustom mh-update-sequences-after-mh-show-flag t
-  "*Non-nil means flush MH sequences to disk after message is shown.
-
-Three sequences are maintained internally by MH-E and pushed out to MH when a
-message is shown. They include the sequence specified by your
-\"Unseen-Sequence:\" profile entry, \"cur\", and the sequence listed by the
-option `mh-tick-seq' which is \"tick\" by default. If you do not like this
-behavior, turn off this option. You can then update the state manually with
-the `\\[mh-execute-commands]', `\\[mh-quit]', or `\\[mh-update-sequences]'
+  "*Non-nil means flush MH sequences to disk after message is shown\\<mh-folder-mode-map>.
+
+Three sequences are maintained internally by MH-E and pushed out
+to MH when a message is shown. They include the sequence
+specified by your \"Unseen-Sequence:\" profile entry, \"cur\",
+and the sequence listed by the option `mh-tick-seq' which is
+\"tick\" by default. If you do not like this behavior, turn off
+this option. You can then update the state manually with the
+\\[mh-execute-commands], \\[mh-quit], or \\[mh-update-sequences]
 commands."
   :type 'boolean
   :group 'mh-sequences)
@@ -1209,10 +1289,10 @@
 (defcustom mh-bury-show-buffer-flag t
   "*Non-nil means show buffer is buried.
 
-One advantage of not burying the show buffer is that one can delete the show
-buffer more easily in an electric buffer list because of its proximity to its
-associated MH-Folder buffer. Try running \\[electric-buffer-list] to see what
-I mean."
+One advantage of not burying the show buffer is that one can
+delete the show buffer more easily in an electric buffer list
+because of its proximity to its associated MH-Folder buffer. Try
+running \\[electric-buffer-list] to see what I mean."
   :type 'boolean
   :group 'mh-show)
 
@@ -1227,45 +1307,47 @@
 (defcustom mh-decode-mime-flag (not (not (locate-library "mm-decode")))
   "*Non-nil means attachments are handled\\<mh-folder-mode-map>.
 
-MH-E can handle attachments as well if the Gnus `mm-decode' library is
-present. If so, this option will be on. Otherwise, you'll see the MIME body
-parts rather than text or attachments. There isn't much point in turning off
-this option; however, you can inspect it if it appears that the body parts are
-not being interpreted correctly or toggle it with the command
+MH-E can handle attachments as well if the Gnus `mm-decode'
+library is present. If so, this option will be on. Otherwise,
+you'll see the MIME body parts rather than text or attachments.
+There isn't much point in turning off this option; however, you
+can inspect it if it appears that the body parts are not being
+interpreted correctly or toggle it with the command
 \\[mh-toggle-mh-decode-mime-flag] to view the raw message.
 
-This option also controls the display of quoted-printable messages and other
-graphical widgets. See the options `mh-graphical-smileys-flag' and
-`mh-graphical-emphasis-flag'."
+This option also controls the display of quoted-printable
+messages and other graphical widgets. See the options
+`mh-graphical-smileys-flag' and `mh-graphical-emphasis-flag'."
   :type 'boolean
   :group 'mh-show)
 
 (defcustom mh-display-buttons-for-alternatives-flag nil
   "*Non-nil means display buttons for all alternative attachments.
 
-Sometimes, a mail program will produce multiple alternatives of the attachment
-in increasing degree of faithfulness to the original content. By default, only
-the preferred alternative is displayed. If this option is on, then the
-preferred part is shown inline and buttons are shown for each of the other
-alternatives."
+Sometimes, a mail program will produce multiple alternatives of
+the attachment in increasing degree of faithfulness to the
+original content. By default, only the preferred alternative is
+displayed. If this option is on, then the preferred part is shown
+inline and buttons are shown for each of the other alternatives."
   :type 'boolean
   :group 'mh-show)
 
 (defcustom mh-display-buttons-for-inline-parts-flag nil
   "*Non-nil means display buttons for all inline attachments\\<mh-folder-mode-map>.
 
-The sender can request that attachments should be viewed inline so that they
-do not really appear like an attachment at all to the reader. Most of the
-time, this is desirable, so by default MH-E suppresses the buttons for inline
-attachments. On the other hand, you may receive code or HTML which the sender
-has added to his message as inline attachments so that you can read them in
-MH-E. In this case, it is useful to see the buttons so that you know you don't
-have to cut and paste the code into a file; you can simply save the
-attachment.
-
-If you want to make the buttons visible for inline attachments, you can use
-the command \\[mh-toggle-mime-buttons] to toggle the visibility of these
-buttons. You can turn on these buttons permanently by turning on this option.
+The sender can request that attachments should be viewed inline so
+that they do not really appear like an attachment at all to the
+reader. Most of the time, this is desirable, so by default MH-E
+suppresses the buttons for inline attachments. On the other hand, you
+may receive code or HTML which the sender has added to his message as
+inline attachments so that you can read them in MH-E. In this case, it
+is useful to see the buttons so that you know you don't have to cut
+and paste the code into a file; you can simply save the attachment.
+
+If you want to make the buttons visible for inline attachments, you
+can use the command \\[mh-toggle-mime-buttons] to toggle the
+visibility of these buttons. You can turn on these buttons permanently
+by turning on this option.
 
 MH-E cannot display all attachments inline however. It can display
 text (including HTML) and images."
@@ -1275,42 +1357,44 @@
 (defcustom mh-do-not-confirm-flag nil
   "*Non-nil means non-reversible commands do not prompt for confirmation.
 
-Commands such as `mh-pack-folder' prompt to confirm whether to process
-outstanding moves and deletes or not before continuing. Turning on this option
-means that these actions will be performed--which is usually desired but
-cannot be retracted--without question."
+Commands such as `mh-pack-folder' prompt to confirm whether to
+process outstanding moves and deletes or not before continuing.
+Turning on this option means that these actions will be
+performed--which is usually desired but cannot be
+retracted--without question."
   :type 'boolean
   :group 'mh-show)
 
 (defcustom mh-fetch-x-image-url nil
   "*Control fetching of \"X-Image-URL:\" header field image.
 
-Ths option controls the fetching of the \"X-Image-URL:\" header field image
-with the following values:
+Ths option controls the fetching of the \"X-Image-URL:\" header
+field image with the following values:
 
 Ask Before Fetching
-     You are prompted before the image is fetched. MH-E will remember
-     your reply and will either use the already fetched image the next
-     time the same URL is encountered or silently skip it if you didn't
-     fetch it the first time. This is a good setting.
+     You are prompted before the image is fetched. MH-E will
+     remember your reply and will either use the already fetched
+     image the next time the same URL is encountered or silently
+     skip it if you didn't fetch it the first time. This is a
+     good setting.
 
 Never Fetch
-     Images are never fetched and only displayed if they are already
-     present in the cache. This is the default.
+     Images are never fetched and only displayed if they are
+     already present in the cache. This is the default.
 
 There isn't a value of \"Always Fetch\" for privacy and DOS (denial of
-service) reasons. For example, fetching a URL can tip off a spammer that
-you've read his email (which is why you shouldn't blindly answer yes if you've
-set this option to \"Ask Before Fetching\"). Someone may also flood your
-network and fill your disk drive by sending a torrent of messages, each
-specifying a unique URL to a very large file.
-
-The cache of images is found in the directory \".mhe-x-image-cache\" within
-your MH directory. You can add your own face to the \"From:\" field too. See
-Info node `(mh-e)Picture'.
-
-This setting only has effect if the option `mh-show-use-xface-flag' is turned
-on."
+service) reasons. For example, fetching a URL can tip off a spammer
+that you've read his email (which is why you shouldn't blindly answer
+yes if you've set this option to \"Ask Before Fetching\"). Someone may
+also flood your network and fill your disk drive by sending a torrent
+of messages, each specifying a unique URL to a very large file.
+
+The cache of images is found in the directory \".mhe-x-image-cache\"
+within your MH directory. You can add your own face to the \"From:\"
+field too. See Info node `(mh-e)Picture'.
+
+This setting only has effect if the option `mh-show-use-xface-flag' is
+turned on."
 
   :type '(choice (const :tag "Ask Before Fetching" ask)
                  (const :tag "Never Fetch" nil))
@@ -1319,37 +1403,42 @@
 (defcustom mh-graphical-smileys-flag t
   "*Non-nil means graphical smileys are displayed.
 
-It is a long standing custom to inject body language using a cornucopia of
-punctuation, also known as the \"smileys\". MH-E can render these as graphical
-widgets if this option is turned on, which it is by default. Smileys include
-patterns such as :-) and ;-).
-
-This option is disabled if the option `mh-decode-mime-flag' is turned off."
+It is a long standing custom to inject body language using a
+cornucopia of punctuation, also known as the \"smileys\". MH-E
+can render these as graphical widgets if this option is turned
+on, which it is by default. Smileys include patterns such as :-)
+and ;-).
+
+This option is disabled if the option `mh-decode-mime-flag' is
+turned off."
   :type 'boolean
   :group 'mh-show)
 
 (defcustom mh-graphical-emphasis-flag t
   "*Non-nil means graphical emphasis is displayed.
 
-A few typesetting features are indicated in ASCII text with certain
-characters. If your terminal supports it, MH-E can render these typesetting
-directives naturally if this option is turned on, which it is by default. For
-example, _underline_ will be underlined, *bold* will appear in bold, /italics/
-will appear in italics, and so on. See the option `gnus-emphasis-alist' for
-the whole list.
-
-This option is disabled if the option `mh-decode-mime-flag' is turned off."
+A few typesetting features are indicated in ASCII text with
+certain characters. If your terminal supports it, MH-E can render
+these typesetting directives naturally if this option is turned
+on, which it is by default. For example, _underline_ will be
+underlined, *bold* will appear in bold, /italics/ will appear in
+italics, and so on. See the option `gnus-emphasis-alist' for the
+whole list.
+
+This option is disabled if the option `mh-decode-mime-flag' is
+turned off."
   :type 'boolean
   :group 'mh-show)
 
 (defcustom mh-highlight-citation-style 'gnus
   "Style for highlighting citations.
 
-If the sender of the message has cited other messages in his message, then
-MH-E will highlight these citations to emphasize the sender's actual response.
-This option can be customized to change the highlighting style. The
-\"Multicolor\" method uses a different color for each indentation while the
-\"Monochrome\" method highlights all citations in red. To disable highlighting
+If the sender of the message has cited other messages in his
+message, then MH-E will highlight these citations to emphasize
+the sender's actual response. This option can be customized to
+change the highlighting style. The \"Multicolor\" method uses a
+different color for each indentation while the \"Monochrome\"
+method highlights all citations in red. To disable highlighting
 of citations entirely, choose \"None\"."
   :type '(choice (const :tag "Multicolor" gnus)
                  (const :tag "Monochrome" font-lock)
@@ -1531,9 +1620,11 @@
     "X400-"                             ; X400
     "Xref:")
   "List of default header fields that are not to be shown.
-Do not alter this variable directly.  Instead, add entries from here that you
-would like to be displayed in `mh-invisible-header-fields-default'
-and add entries to hide in `mh-invisible-header-fields'.")
+
+Do not alter this variable directly. Instead, add entries from
+here that you would like to be displayed in
+`mh-invisible-header-fields-default' and add entries to hide in
+`mh-invisible-header-fields'.")
 
 (defvar mh-invisible-header-fields-compiled nil
   "*Regexp matching lines in a message header that are not to be shown.
@@ -1544,9 +1635,9 @@
 
 (defun mh-invisible-headers ()
   "Make or remake the variable `mh-invisible-header-fields-compiled'.
-Done using `mh-invisible-header-fields-internal' as input, from which entries
-from `mh-invisible-header-fields-default' are removed and entries
-from `mh-invisible-header-fields' are added."
+Done using `mh-invisible-header-fields-internal' as input, from
+which entries from `mh-invisible-header-fields-default' are
+removed and entries from `mh-invisible-header-fields' are added."
   (let ((fields mh-invisible-header-fields-internal))
     (when mh-invisible-header-fields-default
       ;; Remove entries from `mh-invisible-header-fields-default'
@@ -1570,11 +1661,11 @@
 (defcustom mh-invisible-header-fields-default nil
   "*List of hidden header fields.
 
-The header fields listed in this option are hidden, although you can check off
-any field that you would like to see.
-
-Header fields that you would like to hide that aren't listed can be added to
-the option `mh-invisible-header-fields'.
+The header fields listed in this option are hidden, although you
+can check off any field that you would like to see.
+
+Header fields that you would like to hide that aren't listed can
+be added to the option `mh-invisible-header-fields'.
 
 See also `mh-clean-message-header-flag'."
   :type `(set ,@(mapcar (lambda (x) `(const ,x))
@@ -1588,11 +1679,12 @@
   "*Additional header fields to hide.
 
 Header fields that you would like to hide that aren't listed in
-`mh-invisible-header-fields-default' can be added to this option with a couple
-of caveats. Regular expressions are not allowed. Unique fields should have a
-`:' suffix; otherwise, the element can be used to render invisible an entire
-class of fields that start with the same prefix. If you think a header field
-should be generally ignored, report a bug (see URL
+`mh-invisible-header-fields-default' can be added to this option
+with a couple of caveats. Regular expressions are not allowed.
+Unique fields should have a \":\" suffix; otherwise, the element
+can be used to render invisible an entire class of fields that
+start with the same prefix. If you think a header field should be
+generally ignored, report a bug (see URL
 `https://sourceforge.net/tracker/?group_id=13357&atid=113357').
 
 See also `mh-clean-message-header-flag'."
@@ -1606,12 +1698,13 @@
 (defcustom mh-lpr-command-format "lpr -J '%s'"
   "*Command used to print\\<mh-folder-mode-map>.
 
-This option contains the Unix command line which performs the actual printing
-for the \\[mh-print-msg] command. The string can contain one escape, \"%s\",
-which is replaced by the name of the folder and the message number and is
-useful for print job names. I use \"mpage -h'%s' -b Letter -H1of -mlrtb -P\"
-which produces a nice header and adds a bit of margin so the text fits within
-my printer's margins.
+This option contains the Unix command line which performs the
+actual printing for the \\[mh-print-msg] command. The string can
+contain one escape, \"%s\", which is replaced by the name of the
+folder and the message number and is useful for print job names.
+I use \"mpage -h'%s' -b Letter -H1of -mlrtb -P\" which produces a
+nice header and adds a bit of margin so the text fits within my
+printer's margins.
 
 This options is not used by the commands \\[mh-ps-print-msg] or
 \\[mh-ps-print-msg-file]."
@@ -1621,48 +1714,51 @@
 (defcustom mh-max-inline-image-height nil
   "*Maximum inline image height if \"Content-Disposition:\" is not present.
 
-Some older mail programs do not insert this needed plumbing to tell
-MH-E whether to display the attachments inline or not. If this is the
-case, MH-E will display these images inline if they are smaller than
-the window. However, you might want to allow larger images to be
-displayed inline. To do this, you can change the options
-`mh-max-inline-image-width' and `mh-max-inline-image-height' from their
-default value of zero to a large number. The size of your screen is a
-good choice for these numbers."
+Some older mail programs do not insert this needed plumbing to
+tell MH-E whether to display the attachments inline or not. If
+this is the case, MH-E will display these images inline if they
+are smaller than the window. However, you might want to allow
+larger images to be displayed inline. To do this, you can change
+the options `mh-max-inline-image-width' and
+`mh-max-inline-image-height' from their default value of zero to
+a large number. The size of your screen is a good choice for
+these numbers."
   :type '(choice (const nil) integer)
   :group 'mh-show)
 
 (defcustom mh-max-inline-image-width nil
   "*Maximum inline image width if \"Content-Disposition:\" is not present.
 
-Some older mail programs do not insert this needed plumbing to tell
-MH-E whether to display the attachments inline or not. If this is the
-case, MH-E will display these images inline if they are smaller than
-the window. However, you might want to allow larger images to be
-displayed inline. To do this, you can change the options
-`mh-max-inline-image-width' and `mh-max-inline-image-height' from their
-default value of zero to a large number. The size of your screen is a
-good choice for these numbers."
+Some older mail programs do not insert this needed plumbing to
+tell MH-E whether to display the attachments inline or not. If
+this is the case, MH-E will display these images inline if they
+are smaller than the window. However, you might want to allow
+larger images to be displayed inline. To do this, you can change
+the options `mh-max-inline-image-width' and
+`mh-max-inline-image-height' from their default value of zero to
+a large number. The size of your screen is a good choice for
+these numbers."
   :type '(choice (const nil) integer)
   :group 'mh-show)
 
 (defcustom mh-mhl-format-file nil
   "*Specifies the format file to pass to the \"mhl\" program.
 
-Normally MH-E takes care of displaying messages itself (rather than calling an
-MH program to do the work). If you'd rather have \"mhl\" display the
-message (within MH-E), change this option from its default value of \"Use
-Default mhl Format (Printing Only)\".
-
-You can set this option to \"Use Default mhl Format\" to get the same output
-as you would get if you ran \"mhl\" from the shell.
-
-If you have a format file that you want MH-E to use, you can set this option
-to \"Specify an mhl Format File\" and enter the name of your format file. Your
-format file should specify a non-zero value for \"overflowoffset\" to allow
-MH-E to parse the header. Note that \"mhl\" is always used for printing and
-forwarding; in this case, the value of this option is consulted if you have
-specified a format file."
+Normally MH-E takes care of displaying messages itself (rather than
+calling an MH program to do the work). If you'd rather have \"mhl\"
+display the message (within MH-E), change this option from its default
+value of \"Use Default mhl Format (Printing Only)\".
+
+You can set this option to \"Use Default mhl Format\" to get the same
+output as you would get if you ran \"mhl\" from the shell.
+
+If you have a format file that you want MH-E to use, you can set this
+option to \"Specify an mhl Format File\" and enter the name of your
+format file. Your format file should specify a non-zero value for
+\"overflowoffset\" to allow MH-E to parse the header. Note that
+\"mhl\" is always used for printing and forwarding; in this case, the
+value of this option is consulted if you have specified a format
+file."
   :type '(choice (const :tag "Use Default mhl Format (Printing Only)" nil)
                  (const :tag "Use Default mhl Format" t)
                  (file :tag "Specify an mhl Format File"))
@@ -1671,12 +1767,13 @@
 (defcustom mh-mime-save-parts-default-directory t
   "Default directory to use for \\<mh-folder-mode-map>\\[mh-mime-save-parts].
 
-The default value for this option is \"Prompt Always\" so that you are always
-prompted for the directory in which to save the attachments. However, if you
-usually use the same directory within a session, then you can set this option
-to \"Prompt the First Time\" to avoid the prompt each time. you can make this
-directory permanent by choosing \"Directory\" and entering the directory's
-name."
+The default value for this option is \"Prompt Always\" so that
+you are always prompted for the directory in which to save the
+attachments. However, if you usually use the same directory
+within a session, then you can set this option to \"Prompt the
+First Time\" to avoid the prompt each time. you can make this
+directory permanent by choosing \"Directory\" and entering the
+directory's name."
   :type '(choice (const :tag "Prompt the First Time" nil)
                  (const :tag "Prompt Always" t)
                  directory)
@@ -1685,11 +1782,12 @@
 (defcustom mh-print-background-flag nil
   "*Non-nil means messages should be printed in the background\\<mh-folder-mode-map>.
 
-Normally messages are printed in the foreground. If this is slow on your
-system, you may elect to turn off this option to print in the background.
-
-WARNING: If you do this, do not delete the message until it is printed or else
-the output may be truncated.
+Normally messages are printed in the foreground. If this is slow on
+your system, you may elect to turn off this option to print in the
+background.
+
+WARNING: If you do this, do not delete the message until it is printed
+or else the output may be truncated.
 
 This option is not used by the commands \\[mh-ps-print-msg] or
 \\[mh-ps-print-msg-file]."
@@ -1699,9 +1797,9 @@
 (defcustom mh-show-maximum-size 0
   "*Maximum size of message (in bytes) to display automatically.
 
-This option provides an opportunity to skip over large messages which may be
-slow to load. The default value of 0 means that all message are shown
-regardless of size."
+This option provides an opportunity to skip over large messages
+which may be slow to load. The default value of 0 means that all
+message are shown regardless of size."
   :type 'integer
   :group 'mh-show)
 
@@ -1709,12 +1807,12 @@
                                            goto-address-highlight-p)
   "*Non-nil means highlight URLs and email addresses\\<goto-address-highlight-keymap>.
 
-To send a message using the highlighted email address or to view the web page
-for the highlighted URL, use the middle mouse button or
-\\[goto-address-at-point].
-
-See Info node `(mh-e)Sending Mail' to see how to configure Emacs to send the
-message using MH-E.
+To send a message using the highlighted email address or to view
+the web page for the highlighted URL, use the middle mouse button
+or \\[goto-address-at-point].
+
+See Info node `(mh-e)Sending Mail' to see how to configure Emacs
+to send the message using MH-E.
 
 The default value of this option comes from the value of
 `goto-address-highlight-p'."
@@ -1724,33 +1822,36 @@
 (defcustom mh-show-use-xface-flag (>= emacs-major-version 21)
   "*Non-nil means display face images in MH-show buffers.
 
-MH-E can display the content of \"Face:\", \"X-Face:\", and \"X-Image-URL:\"
-header fields. If any of these fields occur in the header of your message, the
-sender's face will appear in the \"From:\" header field. If more than one of
-these fields appear, then the first field found in the order \"Face:\",
-\"X-Face:\", and \"X-Image-URL:\" will be used.
-
-The option `mh-show-use-xface-flag' is used to turn this feature on and off.
-This feature will be turned on by default if your system supports it.
-
-The first header field used, if present, is the Gnus-specific \"Face:\" field.
-The \"Face:\" field appeared in GNU Emacs 21 and XEmacs. For more information,
-see URL `http://quimby.gnus.org/circus/face/'. Next is the traditional
+MH-E can display the content of \"Face:\", \"X-Face:\", and
+\"X-Image-URL:\" header fields. If any of these fields occur in the
+header of your message, the sender's face will appear in the \"From:\"
+header field. If more than one of these fields appear, then the first
+field found in the order \"Face:\", \"X-Face:\", and \"X-Image-URL:\"
+will be used.
+
+The option `mh-show-use-xface-flag' is used to turn this feature on
+and off. This feature will be turned on by default if your system
+supports it.
+
+The first header field used, if present, is the Gnus-specific
+\"Face:\" field. The \"Face:\" field appeared in GNU Emacs 21 and
+XEmacs. For more information, see URL
+`http://quimby.gnus.org/circus/face/'. Next is the traditional
 \"X-Face:\" header field. The display of this field requires the
 \"uncompface\" program (see URL
-`ftp://ftp.cs.indiana.edu/pub/faces/compface/compface.tar.z'). Recent versions
-of XEmacs have internal support for \"X-Face:\" images. If your version of
-XEmacs does not, then you'll need both \"uncompface\" and the x-face
-package (see URL `ftp://ftp.jpl.org/pub/elisp/').
-
-Finally, MH-E will display images referenced by the \"X-Image-URL:\" header
-field if neither the \"Face:\" nor the \"X-Face:\" fields are present. The
-display of the images requires \"wget\" (see URL
-`http://www.gnu.org/software/wget/wget.html'), \"fetch\", or \"curl\" to fetch
-the image and the \"convert\" program from the ImageMagick suite (see URL
-`http://www.imagemagick.org/'). Of the three header fields this is the most
-efficient in terms of network usage since the image doesn't need to be
-transmitted with every single mail.
+`ftp://ftp.cs.indiana.edu/pub/faces/compface/compface.tar.z'). Recent
+versions of XEmacs have internal support for \"X-Face:\" images. If
+your version of XEmacs does not, then you'll need both \"uncompface\"
+and the x-face package (see URL `ftp://ftp.jpl.org/pub/elisp/').
+
+Finally, MH-E will display images referenced by the \"X-Image-URL:\"
+header field if neither the \"Face:\" nor the \"X-Face:\" fields are
+present. The display of the images requires \"wget\" (see URL
+`http://www.gnu.org/software/wget/wget.html'), \"fetch\", or \"curl\"
+to fetch the image and the \"convert\" program from the ImageMagick
+suite (see URL `http://www.imagemagick.org/'). Of the three header
+fields this is the most efficient in terms of network usage since the
+image doesn't need to be transmitted with every single mail.
 
 The option `mh-fetch-x-image-url' controls the fetching of the
 \"X-Image-URL:\" header field image."
@@ -1760,9 +1861,10 @@
 (defcustom mh-store-default-directory nil
   "*Default directory for \\<mh-folder-mode-map>\\[mh-store-msg].
 
-If you would like to change the initial default directory, customize this
-option, change the value from `Current' to `Directory', and then enter the
-name of the directory for storing the content of these messages."
+If you would like to change the initial default directory,
+customize this option, change the value from \"Current\" to
+\"Directory\", and then enter the name of the directory for storing
+the content of these messages."
   :type '(choice (const :tag "Current" nil)
                  directory)
   :group 'mh-show)
@@ -1770,10 +1872,11 @@
 (defcustom mh-summary-height nil
   "*Number of lines in MH-Folder buffer (including the mode line).
 
-The default value of this option is \"Automatic\" which means that the
-MH-Folder buffer will maintain the same proportional size if the frame is
-resized. If you'd prefer a fixed height, then choose the \"Fixed Size\" option
-and enter the number of lines you'd like to see."
+The default value of this option is \"Automatic\" which means
+that the MH-Folder buffer will maintain the same proportional
+size if the frame is resized. If you'd prefer a fixed height,
+then choose the \"Fixed Size\" option and enter the number of
+lines you'd like to see."
   :type '(choice (const :tag "Automatic" nil)
                  (integer :tag "Fixed Size"))
   :group 'mh-show)
@@ -1795,9 +1898,10 @@
 (defcustom mh-show-threads-flag nil
   "*Non-nil means new folders start in threaded mode.
 
-Threading large number of messages can be time consuming so this option is
-turned off by default. If you turn this option on, then threading will be done
-only if the number of messages being threaded is less than `mh-large-folder'."
+Threading large number of messages can be time consuming so this
+option is turned off by default. If you turn this option on, then
+threading will be done only if the number of messages being
+threaded is less than `mh-large-folder'."
   :type 'boolean
   :group 'mh-thread)
 
@@ -1809,8 +1913,8 @@
   "*Function called by the tool bar search button.
 
 Available functions include `mh-search-folder', the default, and
-`mh-index-search'. You can also choose \"Other Function\" from the \"Value
-Menu\" and enter a function of your own choosing."
+`mh-index-search'. You can also choose \"Other Function\" from
+the \"Value Menu\" and enter a function of your own choosing."
   :type '(choice (const mh-search-folder)
                  (const mh-index-search)
                  (function :tag "Other Function"))
@@ -1842,7 +1946,7 @@
 
 (defmacro mh-tool-bar-reply-generator (function recipient folder-buffer-flag)
   "Generate FUNCTION that replies to RECIPIENT.
-If FOLDER-BUFFER-FLAG is nil then the function generated
+If FOLDER-BUFFER-FLAG is nil then the function generated...
 When INCLUDE-FLAG is non-nil, include message body being replied to."
   `(defun ,function (&optional arg)
      ,(format "Reply to \"%s\".\nWhen ARG is non-nil include message in reply."
@@ -1863,9 +1967,10 @@
   (defcustom mh-xemacs-use-tool-bar-flag mh-xemacs-has-tool-bar-flag
     "*If non-nil, use tool bar.
 
-This option controls whether to show the MH-E icons at all. By default, this
-option is turned on if the window system supports tool bars. If your system
-doesn't support tool bars, then you won't be able to turn on this option."
+This option controls whether to show the MH-E icons at all. By
+default, this option is turned on if the window system supports
+tool bars. If your system doesn't support tool bars, then you
+won't be able to turn on this option."
     :type 'boolean
     :group 'mh-tool-bar
     :set (lambda (symbol value)
@@ -1877,11 +1982,12 @@
   (defcustom mh-xemacs-tool-bar-position nil
     "*Tool bar location.
 
-This option controls the placement of the tool bar along the four edges of the
-frame. You can choose from one of \"Same As Default Tool Bar\", \"Top\",
-\"Bottom\", \"Left\", or \"Right\". If this variable is set to anything other
-than \"Same As Default Tool Bar\" and the default tool bar is in a different
-location, then two tool bars will be displayed: the MH-E tool bar and the
+This option controls the placement of the tool bar along the four
+edges of the frame. You can choose from one of \"Same As Default
+Tool Bar\", \"Top\", \"Bottom\", \"Left\", or \"Right\". If this
+variable is set to anything other than \"Same As Default Tool
+Bar\" and the default tool bar is in a different location, then
+two tool bars will be displayed: the MH-E tool bar and the
 default tool bar."
     :type '(radio (const :tag "Same As Default Tool Bar" :value nil)
                   (const :tag "Top" :value top)
@@ -1900,47 +2006,49 @@
 
 (defmacro mh-tool-bar-define (defaults &rest buttons)
   "Define a tool bar for MH-E.
-DEFAULTS is the list of buttons that are present by default. It is a list of
-lists where the sublists are of the following form:
+DEFAULTS is the list of buttons that are present by default. It
+is a list of lists where the sublists are of the following form:
 
   (:KEYWORD FUNC1 FUNC2 FUNC3 ...)
 
-Here :KEYWORD is one of :folder or :letter. If it is :folder then the default
-buttons in the folder and show mode buffers are being specified. If it is
-:letter then the default buttons in the letter mode are listed. FUNC1, FUNC2,
-FUNC3, ... are the names of the functions that the buttons would execute.
-
-Each element of BUTTONS is a list consisting of four mandatory items and one
-optional item as follows:
+Here :KEYWORD is one of :folder or :letter. If it is :folder then
+the default buttons in the folder and show mode buffers are being
+specified. If it is :letter then the default buttons in the
+letter mode are listed. FUNC1, FUNC2, FUNC3, ... are the names of
+the functions that the buttons would execute.
+
+Each element of BUTTONS is a list consisting of four mandatory
+items and one optional item as follows:
 
   (FUNCTION MODES ICON DOC &optional ENABLE-EXPR)
 
 where,
 
-  FUNCTION is the name of the function that will be executed when the button
-  is clicked.
-
-  MODES is a list of symbols. List elements must be from `folder', `letter' and
-  `sequence'. If `folder' is present then the button is available in the
-  folder and show buffer. If the name of FUNCTION is of the form \"mh-foo\",
-  where foo is some arbitrary string, then we check if the function
-  `mh-show-foo' exists. If it exists then that function is used in the show
-  buffer. Otherwise the original function `mh-foo' is used in the show buffer
-  as well. Presence of `sequence' is handled similar to the above. The only
-  difference is that the button is shown only when the folder is narrowed to a
-  sequence. If `letter' is present in MODES, then the button is available
-  during draft editing and runs FUNCTION when clicked.
+  FUNCTION is the name of the function that will be executed when
+  the button is clicked.
+
+  MODES is a list of symbols. List elements must be from \"folder\",
+  \"letter\" and \"sequence\". If \"folder\" is present then the button is
+  available in the folder and show buffer. If the name of FUNCTION is
+  of the form \"mh-foo\", where foo is some arbitrary string, then we
+  check if the function `mh-show-foo' exists. If it exists then that
+  function is used in the show buffer. Otherwise the original function
+  `mh-foo' is used in the show buffer as well. Presence of \"sequence\"
+  is handled similar to the above. The only difference is that the
+  button is shown only when the folder is narrowed to a sequence. If
+  \"letter\" is present in MODES, then the button is available during
+  draft editing and runs FUNCTION when clicked.
 
   ICON is the icon that is drawn in the button.
 
-  DOC is the documentation for the button. It is used in tool-tips and in
-  providing other help to the user. GNU Emacs uses only the first line of the
-  string. So the DOC should be formatted such that the first line is useful and
-  complete without the rest of the string.
-
-  Optional item ENABLE-EXPR is an arbitrary lisp expression. If it evaluates
-  to nil, then the button is deactivated, otherwise it is active. If is in't
-  present then the button is always active."
+  DOC is the documentation for the button. It is used in tool-tips and
+  in providing other help to the user. GNU Emacs uses only the first
+  line of the string. So the DOC should be formatted such that the
+  first line is useful and complete without the rest of the string.
+
+  Optional item ENABLE-EXPR is an arbitrary lisp expression. If it
+  evaluates to nil, then the button is deactivated, otherwise it is
+  active. If it isn't present then the button is always active."
   ;; The following variable names have been carefully chosen to make code
   ;; generation easier. Modifying the names should be done carefully.
   (let (folder-buttons folder-docs folder-button-setter sequence-button-setter
@@ -2227,176 +2335,191 @@
 
 ;;; Hooks (:group 'mh-hooks + group where hook described)
 
-(defcustom mail-citation-hook nil
-  "*Hook for modifying a citation just inserted in the mail buffer.
-You can gain full control over the appearance of the included text by setting
-this hook to a function that modifies it. This hook is ignored if the option
-`mh-yank-behavior' is set to one of the supercite flavors. Otherwise, this
-option controls how much of the message is passed to the hook. The function
-can find the citation between point and mark and it should leave point and
-mark around the modified citation text for the next hook function. The
-standard prefix `mh-ins-buf-prefix' is not added if this hook is set.
-
-For example, if you use the hook function trivial-cite (which is NOT part of
-Emacs), set `mh-yank-behavior' to \"Body and Header\" (see URL
-`http://shasta.cs.uiuc.edu/~lrclause/tc.html')."
+(defcustom mh-after-commands-processed-hook nil
+  "Hook run by \\<mh-folder-mode-map>\\[mh-execute-commands] after performing outstanding requests.
+
+Variables that are useful in this hook include
+`mh-folders-changed', which lists which folders were affected by
+deletes and refiles. This list will always include the current
+folder, which is also available in `mh-current-folder'."
   :type 'hook
-  :options '(trivial-cite)
   :group 'mh-hooks
-  :group 'mh-letter)
+  :group 'mh-folder)
 
 (defcustom mh-alias-reloaded-hook nil
-  "Invoked by `mh-alias-reload' after reloading aliases."
+  "Hook run by `mh-alias-reload' after loading aliases."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-alias)
 
+(defcustom mh-before-commands-processed-hook nil
+  "Hook run by \\<mh-folder-mode-map>\\[mh-execute-commands] before performing outstanding requests.
+
+Variables that are useful in this hook include `mh-delete-list'
+and `mh-refile-list' which can be used to see which changes will
+be made to the current folder, `mh-current-folder'."
+  :type 'hook
+  :group 'mh-hooks
+  :group 'mh-folder)
+
 (defcustom mh-before-quit-hook nil
-  "Invoked by \\<mh-folder-mode-map>`\\[mh-quit]' before quitting MH-E.
+  "Hook run by \\<mh-folder-mode-map>\\[mh-quit] before quitting MH-E.
+
+This hook is called before the quit occurs, so you might use it
+to perform any MH-E operations; you could perform some query and
+abort the quit or call `mh-execute-commands', for example.
+
 See also `mh-quit-hook'."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-folder)
 
 (defcustom mh-before-send-letter-hook nil
-  "Invoked at the beginning of the \\<mh-letter-mode-map>\\[mh-send-letter] command.
-For example, if you want to check your spelling in your message before
-sending, add the `ispell-message' function."
+  "Hook run at the beginning of the \\<mh-letter-mode-map>\\[mh-send-letter] command.
+
+For example, if you want to check your spelling in your message
+before sending, add the `ispell-message' function."
   :type 'hook
   :options '(ispell-message)
   :group 'mh-hooks
   :group 'mh-letter)
 
 (defcustom mh-delete-msg-hook nil
-  "Invoked after marking each message for deletion.
-
-For example, a past maintainer of MH-E used this once when he kept statistics
-on his mail usage."
+  "Hook run by \\<mh-letter-mode-map>\\[mh-delete-msg] after marking each message for deletion.
+
+For example, a past maintainer of MH-E used this once when he
+kept statistics on his mail usage."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-show)
 
-(defcustom mh-mh-to-mime-hook nil
-  "Invoked on the formatted letter by \\<mh-letter-mode-map>\\[mh-mh-to-mime]."
-  :type 'hook
-  :group 'mh-hooks
-  :group 'mh-letter)
-
 (defcustom mh-find-path-hook nil
-  "Invoked by `mh-find-path' after reading the user's MH profile."
+  "Hook run by `mh-find-path' after reading the user's MH profile.
+
+This hook can be used the change the value of the variables that
+`mh-find-path' sets if you need to run with different values
+between MH and MH-E."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-e)
 
 (defcustom mh-folder-mode-hook nil
-  "Invoked in `mh-folder-mode' on a new folder."
-  :type 'hook
-  :group 'mh-hooks
-  :group 'mh-folder)
-
-(defcustom mh-before-commands-processed-hook nil
-  "Invoked before the folder actions (such as moves and deletes) are performed.
-Variables that are useful in this hook include `mh-delete-list' and
-`mh-refile-list' which can be used to see which changes will be made to
-current folder, `mh-current-folder'."
+  "Hook run by `mh-folder-mode' when visiting a new folder."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-folder)
 
-(defcustom mh-after-commands-processed-hook nil
-  "Invoked after the folder actions (such as moves and deletes) are performed.
-Variables that are useful in this hook include `mh-folders-changed',
-which lists which folders were affected by deletes and refiles.  This
-list will always include the current folder, which is also available
-in `mh-current-folder'."
-  :type 'hook
-  :group 'mh-hooks)
-
 (defcustom mh-forward-hook nil
-  "Invoked on the forwarded letter by \\<mh-folder-mode-map>\\[mh-forward]."
+  "Hook run by `mh-forward' on a forwarded letter."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-sending-mail)
 
 (defcustom mh-inc-folder-hook nil
-  "Invoked by \\<mh-folder-mode-map>`\\[mh-inc-folder]' after incorporating mail into a folder."
+  "Hook run by \\<mh-folder-mode-map>\\[mh-inc-folder] after incorporating mail into a folder."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-inc)
 
 (defcustom mh-insert-signature-hook nil
-  "Invoked after signature has been inserted.
-
-These functions may access the actual name of the file or the function used to
-insert the signature with `mh-signature-file-name'."
+  "Hook run by \\<mh-letter-mode-map>\\[mh-insert-signature] after signature has been inserted.
+
+Hook functions may access the actual name of the file or the
+function used to insert the signature with
+`mh-signature-file-name'."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-letter)
 
-(defcustom mh-kill-folder-suppress-prompt-hook '(mh-index-p)
-  "Invoked at the beginning of the  \\<mh-folder-mode-map>`\\[mh-kill-folder]' command.
-This hook is a list of functions to be called, with no arguments, which should
-return a value of non-nil if you should not be asked if you're sure that you
-want to remove the folder. This is useful for folders that are easily
-regenerated.
-
-The default value of `mh-index-p' suppresses the prompt on folders generated
-by an index search.
-
-WARNING: Use this hook with care. If there is a bug in your hook which returns
-t on +inbox and you hit \\<mh-folder-mode-map>`\\[mh-kill-folder]' by accident
-in the +inbox buffer, you will not be happy."
+(defcustom mh-kill-folder-suppress-prompt-hooks '(mh-index-p)
+  "Abnormal hook run at the beginning of \\<mh-folder-mode-map>\\[mh-kill-folder].
+
+The hook functions are called with no arguments and should return
+a non-nil value to suppress the normal prompt when you remove a
+folder. This is useful for folders that are easily regenerated.
+
+The default value of `mh-index-p' suppresses the prompt on
+folders generated by an index search.
+
+WARNING: Use this hook with care. If there is a bug in your hook
+which returns t on \"+inbox\" and you hit \\[mh-kill-folder] by
+accident in the \"+inbox\" folder, you will not be happy."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-folder)
 
 (defcustom mh-letter-mode-hook nil
-  "Invoked by `mh-letter-mode' on a new letter."
+  "Hook run by `mh-letter-mode' on a new letter.
+
+This hook allows you to do some processing before editing a
+letter. For example, you may wish to modify the header after
+\"repl\" has done its work, or you may have a complicated
+\"components\" file and need to tell MH-E where the cursor should
+go."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-sending-mail)
 
+(defcustom mh-mh-to-mime-hook nil
+  "Hook run on the formatted letter by \\<mh-letter-mode-map>\\[mh-mh-to-mime]."
+  :type 'hook
+  :group 'mh-hooks
+  :group 'mh-letter)
+
 (defcustom mh-pick-mode-hook nil
-  "Invoked upon entry to `mh-pick-mode'."
+  "Hook run upon entry to `mh-pick-mode'\\<mh-folder-mode-map>.
+
+If you find that you do the same thing over and over when editing
+the search template, you may wish to bind some shortcuts to keys.
+This can be done with this hook which is called when
+\\[mh-search-folder] is run on a new pattern."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-index)
 
 (defcustom mh-quit-hook nil
-  "Invoked after \\<mh-folder-mode-map>`\\[mh-quit]' quits MH-E.
+  "Hook run by \\<mh-folder-mode-map>\\[mh-quit] after quitting MH-E.
+
+This hook is not run in an MH-E context, so you might use it to
+modify the window setup.
+
 See also `mh-before-quit-hook'."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-folder)
 
 (defcustom mh-refile-msg-hook nil
-  "Invoked after marking each message for refiling."
+  "Hook run by \\<mh-folder-mode-map>\\[mh-refile-msg] after marking each message for refiling."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-folder)
 
 (defcustom mh-show-hook nil
-  "Invoked after \\<mh-folder-mode-map>\\[mh-show] shows a message.
-
-It is the last thing called after messages are displayed. It's used to affect
-the behavior of MH-E in general or when `mh-show-mode-hook' is too early."
+  "Hook run after \\<mh-folder-mode-map>\\[mh-show] shows a message.
+
+It is the last thing called after messages are displayed. It's
+used to affect the behavior of MH-E in general or when
+`mh-show-mode-hook' is too early."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-show)
 
 (defcustom mh-show-mode-hook nil
-  "Invoked upon entry to `mh-show-mode'.
-
-This hook is called early on in the process of the message display. It is
-usually used to perform some action on the message's content."
+  "Hook run upon entry to `mh-show-mode'.
+
+This hook is called early on in the process of the message
+display. It is usually used to perform some action on the
+message's content."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-show)
 
 (defcustom mh-unseen-updated-hook nil
-  "Invoked after the unseen sequence has been updated.
-The variable `mh-seen-list' can be used to obtain the list of messages which
-will be removed from the unseen sequence."
+  "Hook run after the unseen sequence has been updated.
+
+The variable `mh-seen-list' can be used by this hook to obtain
+the list of messages which were removed from the unseen
+sequence."
   :type 'hook
   :group 'mh-hooks
   :group 'mh-sequences)
@@ -2675,7 +2798,8 @@
 
 (defvar mh-show-pgg-unknown-face 'mh-show-pgg-unknown
   "Face used to highlight a PGG signature whose status is unknown.
-This face is also used for a signature when the signer is untrusted.")
+This face is also used for a signature when the signer is
+untrusted.")
 (defface mh-show-pgg-unknown
   '((t
      (:bold t :foreground "DarkGoldenrod2")))
--- a/lisp/mh-e/mh-e.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/mh-e/mh-e.el	Thu Dec 29 04:41:02 2005 +0000
@@ -102,7 +102,8 @@
 
 (defvar mh-partial-folder-mode-line-annotation "select"
   "Annotation when displaying part of a folder.
-The string is displayed after the folder's name.  nil for no annotation.")
+The string is displayed after the folder's name. nil for no
+annotation.")
 
 
 
@@ -133,15 +134,16 @@
    "%<(zero)%17(friendly{from})%>  "
    "%{subject}%<{body}<<%{body}%>")
   "*Scan format string for MH.
-This string is passed to the scan program via the -format argument.
-This format is identical to the default except that additional hints for
-fontification have been added to the fifth column (remember that in Emacs, the
-first column is 0).
-
-The values of the fifth column, in priority order, are: `-' if the message has
-been replied to, t if an address on the To: line matches one of the
-mailboxes of the current user, `c' if the Cc: line matches, `b' if the Bcc:
-line matches, and `n' if a non-empty Newsgroups: header is present.")
+This string is passed to the scan program via the -format
+argument. This format is identical to the default except that
+additional hints for fontification have been added to the fifth
+column (remember that in Emacs, the first column is 0).
+
+The values of the fifth column, in priority order, are: \"-\" if
+the message has been replied to, t if an address on the To: line
+matches one of the mailboxes of the current user, \"c\" if the Cc:
+line matches, \"b\" if the Bcc: line matches, and \"n\" if a
+non-empty Newsgroups: header is present.")
 
 (defvar mh-scan-format-nmh
   (concat
@@ -159,14 +161,15 @@
    "%(decode{subject})%<{body}<<%{body}%>")
   "*Scan format string for nmh.
 This string is passed to the scan program via the -format arg.
-This format is identical to the default except that additional hints for
-fontification have been added to the fifth column (remember that in Emacs, the
-first column is 0).
-
-The values of the fifth column, in priority order, are: `-' if the message has
-been replied to, t if an address on the To: field matches one of the
-mailboxes of the current user, `c' if the Cc: field matches, `b' if the Bcc:
-field matches, and `n' if a non-empty Newsgroups: field is present.")
+This format is identical to the default except that additional
+hints for fontification have been added to the fifth
+column (remember that in Emacs, the first column is 0).
+
+The values of the fifth column, in priority order, are: \"-\" if
+the message has been replied to, t if an address on the To: field
+matches one of the mailboxes of the current user, \"c\" if the Cc:
+field matches, \"b\" if the Bcc: field matches, and \"n\" if a
+non-empty Newsgroups: field is present.")
 
 (defvar mh-note-deleted ?D
   "Messages that have been deleted are marked by this character.
@@ -182,101 +185,140 @@
 
 (defvar mh-scan-good-msg-regexp  "^\\( *[0-9]+\\)[^D^0-9]"
   "This regular expression matches \"good\" messages.
-It must match from the beginning of the line. Note that the default setting of
-`mh-folder-font-lock-keywords' expects this expression to contain at least one
-parenthesized expression which matches the message number as in the default of
-\"^\\\\( *[0-9]+\\\\)[^D^0-9]\". This expression includes the leading space
-within the parenthesis since it looks better to highlight it as well. This
-regular expression should be correct as it is needed by non-fontification
+
+It must match from the beginning of the line. Note that the
+default setting of `mh-folder-font-lock-keywords' expects this
+expression to contain at least one parenthesized expression which
+matches the message number as in the default of
+
+  \"^\\\\( *[0-9]+\\\\)[^D^0-9]\".
+
+This expression includes the leading space within the parenthesis
+since it looks better to highlight it as well. This regular
+expression should be correct as it is needed by non-fontification
 functions.")
 
 (defvar mh-scan-deleted-msg-regexp "^\\( *[0-9]+\\)D"
   "This regular expression matches deleted messages.
-It must match from the beginning of the line. Note that the default setting of
-`mh-folder-font-lock-keywords' expects this expression to contain at least one
-parenthesized expression which matches the message number as in the default of
-\"^\\\\( *[0-9]+\\\\)D\". This expression includes the leading space within
-the parenthesis since it looks better to highlight it as well. This regular
-expression should be correct as it is needed by non-fontification functions.
-See also `mh-note-deleted'.")
+
+It must match from the beginning of the line. Note that the
+default setting of `mh-folder-font-lock-keywords' expects this
+expression to contain at least one parenthesized expression which
+matches the message number as in the default of
+
+  \"^\\\\( *[0-9]+\\\\)D\".
+
+This expression includes the leading space within the parenthesis
+since it looks better to highlight it as well. This regular
+expression should be correct as it is needed by non-fontification
+functions. See also `mh-note-deleted'.")
 
 (defvar mh-scan-refiled-msg-regexp  "^\\( *[0-9]+\\)\\^"
   "This regular expression matches refiled messages.
-It must match from the beginning of the line. Note that the default setting of
-`mh-folder-font-lock-keywords' expects this expression to contain at least one
-parenthesized expression which matches the message number as in the default of
-\"^\\\\( *[0-9]+\\\\)\\\\^\". This expression includes the leading space
-within the parenthesis since it looks better to highlight it as well. This
-regular expression should be correct as it is needed by non-fontification
+
+It must match from the beginning of the line. Note that the
+default setting of `mh-folder-font-lock-keywords' expects this
+expression to contain at least one parenthesized expression which
+matches the message number as in the default of
+
+  \"^\\\\( *[0-9]+\\\\)\\\\^\".
+
+This expression includes the leading space within the parenthesis
+since it looks better to highlight it as well. This regular
+expression should be correct as it is needed by non-fontification
 functions. See also `mh-note-refiled'.")
 
 (defvar mh-scan-valid-regexp "^ *[0-9]"
   "This regular expression describes a valid scan line.
-This is used to eliminate error messages that are occasionally produced by
-\"inc\".")
+
+This is used to eliminate error messages that are occasionally
+produced by \"inc\".")
 
 (defvar mh-scan-cur-msg-number-regexp "^\\( *[0-9]+\\+\\).*"
   "This regular expression matches the current message.
-It must match from the beginning of the line. Note that the default setting of
-`mh-folder-font-lock-keywords' expects this expression to contain at least one
-parenthesized expression which matches the message number as in the default of
-\"^\\\\( *[0-9]+\\\\+\\\\).*\". This expression includes the leading space and
-current message marker \"+\" within the parenthesis since it looks better to
-highlight these items as well. This regular expression should be correct as it
-is needed by non-fontification functions. See also `mh-note-cur'.")
+
+It must match from the beginning of the line. Note that the
+default setting of `mh-folder-font-lock-keywords' expects this
+expression to contain at least one parenthesized expression which
+matches the message number as in the default of
+
+  \"^\\\\( *[0-9]+\\\\+\\\\).*\".
+
+This expression includes the leading space and current message
+marker \"+\" within the parenthesis since it looks better to
+highlight these items as well. This regular expression should be
+correct as it is needed by non-fontification functions. See also
+`mh-note-cur'.")
 
 (defvar mh-scan-date-regexp "\\([0-9][0-9]/[0-9][0-9]\\)"
   "This regular expression matches a valid date.
-It must not be anchored to the beginning or the end of the line. Note that the
-default setting of `mh-folder-font-lock-keywords' expects this expression to
-contain only one parenthesized expression which matches the date field as in
-the default of \"\\\\([0-9][0-9]/[0-9][0-9]\\\\)\"}. If this regular
-expression is not correct, the date will not be highlighted. See also
+
+It must not be anchored to the beginning or the end of the line.
+Note that the default setting of `mh-folder-font-lock-keywords'
+expects this expression to contain only one parenthesized
+expression which matches the date field as in the default of
+\"\\\\([0-9][0-9]/[0-9][0-9]\\\\)\"}. If this regular expression
+is not correct, the date will not be highlighted. See also
 `mh-scan-format-regexp'.")
 
 (defvar mh-scan-rcpt-regexp  "\\(To:\\)\\(..............\\)"
   "This regular expression specifies the recipient in messages you sent.
+
 Note that the default setting of `mh-folder-font-lock-keywords'
-expects this expression to contain two parenthesized expressions. The
-first is expected to match the `To:' that the default scan format
-file generates. The second is expected to match the recipient's name
-as in the default of \"\\\\(To:\\\\)\\\\(..............\\\\)\". If this
-regular expression is not correct, the recipient will not be highlighted.")
+expects this expression to contain two parenthesized expressions.
+The first is expected to match the \"To:\" that the default scan
+format file generates. The second is expected to match the
+recipient's name as in the default of
+\"\\\\(To:\\\\)\\\\(..............\\\\)\". If this regular
+expression is not correct, the recipient will not be
+highlighted.")
 
 (defvar mh-scan-body-regexp "\\(<<\\([^\n]+\\)?\\)"
   "This regular expression matches the message body fragment.
-Note that the default setting of `mh-folder-font-lock-keywords' expects this
-expression to contain at least one parenthesized expression which matches the
-body text as in the default of \"\\\\(<<\\\\([^\\n]+\\\\)?\\\\)\". If this
-regular expression is not correct, the body fragment will not be highlighted.")
+
+Note that the default setting of `mh-folder-font-lock-keywords'
+expects this expression to contain at least one parenthesized
+expression which matches the body text as in the default of
+\"\\\\(<<\\\\([^\\n]+\\\\)?\\\\)\". If this regular expression is
+not correct, the body fragment will not be highlighted.")
 
 (defvar mh-scan-subject-regexp
   "^ *[0-9]+........[ ]*...................\\([Rr][Ee]\\(\\[[0-9]+\\]\\)?:\\s-*\\)*\\([^<\n]*\\)"
   "This regular expression matches the subject.
-It must match from the beginning of the line. Note that the default setting
-of `mh-folder-font-lock-keywords' expects this expression to contain at least
-three parenthesized expressions. The first is expected to match the `Re:'
-string, if any. The second matches an optional bracketed number after `Re:',
-such as in `Re[2]:' (and is thus a sub-expression of the first expression) and
-the third is expected to match the subject line itself as in the default of
-\(broken on multiple lines for readability):
+
+It must match from the beginning of the line. Note that the
+default setting of `mh-folder-font-lock-keywords' expects this
+expression to contain at least three parenthesized expressions.
+The first is expected to match the \"Re:\" string, if any. The
+second matches an optional bracketed number after \"Re:\", such as
+in \"Re[2]:\" (and is thus a sub-expression of the first
+expression) and the third is expected to match the subject line
+itself as in the default of (broken on multiple lines for
+readability):
+
   ^ *[0-9]+........[ ]*...................
   \\\\([Rr][Ee]\\\\(\\\\\\=[[0-9]+\\\\]\\\\)?:\\\\s-*\\\\)*
   \\\\([^<\\n]*\\\\)
-This regular expression should be correct as it is needed by non-fontification
-functions.")
+
+This regular expression should be correct as it is needed by
+non-fontification functions.")
 
 (defvar mh-scan-format-regexp
   (concat "\\([bct]\\)" mh-scan-date-regexp " *\\(..................\\)")
   "This regular expression matches the output of scan.
-Note that the default setting of `mh-folder-font-lock-keywords' expects this
-expression to contain at least three parenthesized expressions. The first
-should match the fontification hint (see `mh-scan-format-nmh'), the second is
-found in `mh-scan-date-regexp', and the third should match the user name as in
-the default of \"(concat \"\\\\([bct]\\\\)\" mh-scan-date-regexp
-                         \"*\\\\(..................\\\\)\")\".
-If this regular expression is not correct, the notation hints and the sender
-will not be highlighted.")
+
+Note that the default setting of `mh-folder-font-lock-keywords'
+expects this expression to contain at least three parenthesized
+expressions. The first should match the fontification hint (see
+`mh-scan-format-nmh'), the second is found in
+`mh-scan-date-regexp', and the third should match the user name
+as in the default of
+
+  \"(concat \"\\\\([bct]\\\\)\" mh-scan-date-regexp
+            \"*\\\\(..................\\\\)\")\".
+
+If this regular expression is not correct, the notation hints and
+the sender will not be highlighted.")
 
 
 
@@ -313,22 +355,27 @@
 
 (defvar mh-scan-cmd-note-width 1
   "Number of columns consumed by the cmd-note field in `mh-scan-format'.
-This column will have one of the values: ` ', `D', `^', `+' and where
-` ' is the default value,
-`D' is the `mh-note-deleted' character,
-`^' is the `mh-note-refiled' character, and
-`+' is the `mh-note-cur' character.")
+
+This column will have one of the values: \" \", \"D\", \"^\", \"+\" and
+where \" \" is the default value,
+
+  \"D\" is the `mh-note-deleted' character,
+  \"^\" is the `mh-note-refiled' character, and
+  \"+\" is the `mh-note-cur' character.")
 
 (defvar mh-scan-destination-width 1
   "Number of columns consumed by the destination field in `mh-scan-format'.
-This column will have one of ' ', '%', '-', 't', 'c', 'b', or `n' in it.
-A ' ' blank space is the default character.
-A '%' indicates that the message in in a named MH sequence.
-A '-' indicates that the message has been annotated with a replied field.
-A 't' indicates that the message contains mymbox in the To: field.
-A 'c' indicates that the message contains mymbox in the Cc: field.
-A 'b' indicates that the message contains mymbox in the Bcc: field.
-A 'n' indicates that the message contains a Newsgroups: field.")
+
+This column will have one of \" \", \"%\", \"-\", \"t\", \"c\", \"b\", or \"n\"
+in it.
+
+  \" \" blank space is the default character.
+  \"%\" indicates that the message in in a named MH sequence.
+  \"-\" indicates that the message has been annotated with a replied field.
+  \"t\" indicates that the message contains mymbox in the To: field.
+  \"c\" indicates that the message contains mymbox in the Cc: field.
+  \"b\" indicates that the message contains mymbox in the Bcc: field.
+  \"n\" indicates that the message contains a Newsgroups: field.")
 
 (defvar mh-scan-date-width 5
   "Number of columns consumed by the date field in `mh-scan-format'.
@@ -336,7 +383,8 @@
 
 (defvar mh-scan-date-flag-width 1
   "Number of columns consumed to flag (in)valid dates in `mh-scan-format'.
-This column will have ` ' for valid and `*' for invalid or missing dates.")
+This column will have \" \" for valid and \"*\" for invalid or
+missing dates.")
 
 (defvar mh-scan-from-mbox-width 17
   "Number of columns consumed with the \"From:\" line in `mh-scan-format'.
@@ -388,17 +436,17 @@
 
 (defmacro mh-generate-sequence-font-lock (seq prefix face)
   "Generate the appropriate code to fontify messages in SEQ.
-PREFIX is used to generate unique names for the variables and functions
-defined by the macro. So a different prefix should be provided for every
-invocation.
+PREFIX is used to generate unique names for the variables and
+functions defined by the macro. So a different prefix should be
+provided for every invocation.
 FACE is the font-lock face used to display the matching scan lines."
   (let ((cache (intern (format "mh-folder-%s-seq-cache" prefix)))
         (func (intern (format "mh-folder-font-lock-%s" prefix))))
     `(progn
        (defvar ,cache nil
          "Internal cache variable used for font-lock in MH-E.
-Should only be non-nil through font-lock stepping, and nil once font-lock
-is done highlighting.")
+Should only be non-nil through font-lock stepping, and nil once
+font-lock is done highlighting.")
        (make-variable-buffer-local ',cache)
 
        (defun ,func (limit)
@@ -446,45 +494,69 @@
 
 ;;; Internal variables:
 
-(defvar mh-last-destination nil)        ;Destination of last refile or write
-                                        ;command.
-(defvar mh-last-destination-folder nil) ;Destination of last refile command.
-(defvar mh-last-destination-write nil)  ;Destination of last write command.
+(defvar mh-last-destination nil
+  "Destination of last refile or write command.")
+
+(defvar mh-last-destination-folder nil
+  "Destination of last refile command.")
+
+(defvar mh-last-destination-write nil
+  "Destination of last write command.")
 
 (defvar mh-folder-mode-map (make-keymap)
   "Keymap for MH folders.")
 
-(defvar mh-arrow-marker nil)            ;Marker for arrow display in fringe.
-
-(defvar mh-delete-list nil)             ;List of msg numbers to delete.
-
-(defvar mh-refile-list nil)             ;List of folder names in mh-seq-list.
-
-(defvar mh-folders-changed nil)         ;For mh-after-commands-processed-hook.
-
-(defvar mh-next-direction 'forward)     ;Direction to move to next message.
-
-(defvar mh-view-ops ())                 ;Stack of ops that change the folder
-                                        ;view (such as narrowing or threading).
-(defvar mh-folder-view-stack ())        ;Stack of previous folder views.
-
-(defvar mh-index-data nil)              ;Info about index search results
+(defvar mh-arrow-marker nil
+  "Marker for arrow display in fringe.")
+
+(defvar mh-delete-list nil
+  "List of message numbers to delete.
+This variable can be used by
+`mh-before-commands-processed-hook'.")
+
+(defvar mh-refile-list nil
+  "List of folder names in `mh-seq-list'.
+This variable can be used by
+`mh-before-commands-processed-hook'.")
+
+(defvar mh-folders-changed nil
+  "Lists which folders were affected by deletes and refiles.
+This list will always include the current folder
+`mh-current-folder'. This variable can be used by
+`mh-after-commands-processed-hook'.")
+
+(defvar mh-next-direction 'forward
+  "Direction to move to next message.")
+
+(defvar mh-view-ops ()
+  "Stack of operations that change the folder view.
+These operations include narrowing or threading.")
+
+(defvar mh-folder-view-stack ()
+  "Stack of previous folder views.")
+
+(defvar mh-index-data nil
+  "Info about index search results.")
+
 (defvar mh-index-previous-search nil)
 (defvar mh-index-msg-checksum-map nil)
 (defvar mh-index-checksum-origin-map nil)
 (defvar mh-index-sequence-search-flag nil)
 
-(defvar mh-first-msg-num nil)           ;Number of first msg in buffer.
-
-(defvar mh-last-msg-num nil)            ;Number of last msg in buffer.
-
-(defvar mh-mode-line-annotation nil)    ;Message range displayed in buffer.
-
-(defvar mh-sequence-notation-history nil)
-                                        ;Rememeber original notation that
-                                        ;is overwritten by `mh-note-seq'.
-
-(defvar mh-colors-available-flag nil)   ;Are colors available?
+(defvar mh-first-msg-num nil
+  "Number of first message in buffer.")
+
+(defvar mh-last-msg-num nil
+  "Number of last msg in buffer.")
+
+(defvar mh-mode-line-annotation nil
+  "Message range displayed in buffer.")
+
+(defvar mh-sequence-notation-history nil
+  "Remember original notation that is overwritten by `mh-note-seq'.")
+
+(defvar mh-colors-available-flag nil
+  "Non-nil means colors are available.")
 
 
 
@@ -513,9 +585,11 @@
 
 ;;;###autoload
 (defun mh-rmail (&optional arg)
-  "Inc(orporate) new mail with MH.
-Scan an MH folder if ARG is non-nil. This function is an entry point to MH-E,
-the Emacs interface to the MH mail system."
+  "Incorporate new mail with MH.
+Scan an MH folder if ARG is non-nil.
+
+This function is an entry point to MH-E, the Emacs interface to
+the MH mail system."
   (interactive "P")
   (mh-find-path)
   (if arg
@@ -527,8 +601,10 @@
 ;;;###autoload
 (defun mh-nmail (&optional arg)
   "Check for new mail in inbox folder.
-Scan an MH folder if ARG is non-nil. This function is an entry point to MH-E,
-the Emacs interface to the MH mail system."
+Scan an MH folder if ARG is non-nil.
+
+This function is an entry point to MH-E, the Emacs interface to
+the MH mail system."
   (interactive "P")
   (mh-find-path)                        ; init mh-inbox
   (if arg
@@ -542,34 +618,53 @@
 (defun mh-delete-msg (range)
   "Delete RANGE\\<mh-folder-mode-map>.
 
-To mark a message for deletion, use this command. A \"D\" is placed by the
-message in the scan window, and the next undeleted message is displayed. If
-the previous command had been \\[mh-previous-undeleted-msg], then the next
-message displayed is the first undeleted message previous to the message just
-deleted. Use \\[mh-next-undeleted-msg] to force subsequent \\[mh-delete-msg]
-commands to move forward to the next undeleted message after deleting the
-message under the cursor.
-
-Check the documentation of `mh-interactive-range' to see how RANGE is read in
-interactive use."
+To mark a message for deletion, use this command. A \"D\" is
+placed by the message in the scan window, and the next undeleted
+message is displayed. If the previous command had been
+\\[mh-previous-undeleted-msg], then the next message displayed is
+the first undeleted message previous to the message just deleted.
+Use \\[mh-next-undeleted-msg] to force subsequent
+\\[mh-delete-msg] commands to move forward to the next undeleted
+message after deleting the message under the cursor.
+
+The hook `mh-delete-msg-hook' is called after you mark a message
+for deletion. For example, a past maintainer of MH-E used this
+once when he kept statistics on his mail usage.
+
+Check the documentation of `mh-interactive-range' to see how
+RANGE is read in interactive use."
   (interactive (list (mh-interactive-range "Delete")))
   (mh-delete-msg-no-motion range)
-  (if (looking-at mh-scan-deleted-msg-regexp) (mh-next-msg)))
+  (if (looking-at mh-scan-deleted-msg-regexp)
+      (mh-next-msg)))
 
 (defun mh-delete-msg-no-motion (range)
   "Delete RANGE, don't move to next message.
 
-This command marks the RANGE for deletion but leaves the cursor at the current
-message in case you wish to perform other operations on the message.
-
-Check the documentation of `mh-interactive-range' to see how RANGE is read in
-interactive use."
+This command marks the RANGE for deletion but leaves the cursor
+at the current message in case you wish to perform other
+operations on the message.
+
+Check the documentation of `mh-interactive-range' to see how
+RANGE is read in interactive use."
   (interactive (list (mh-interactive-range "Delete")))
   (mh-iterate-on-range () range
     (mh-delete-a-msg nil)))
 
 (defun mh-execute-commands ()
-  "Process outstanding delete and refile requests."
+  "Process outstanding delete and refile requests\\<mh-folder-mode-map>.
+
+If you've marked messages to be deleted or refiled and you want
+to go ahead and delete or refile the messages, use this command.
+Many MH-E commands that may affect the numbering of the
+messages (such as \\[mh-rescan-folder] or \\[mh-pack-folder])
+will ask if you want to process refiles or deletes first and then
+either run this command for you or undo the pending refiles and
+deletes, which are lost.
+
+This function runs `mh-before-commands-processed-hook' before the
+commands are processed and `mh-after-commands-processed-hook'
+after the commands are processed."
   (interactive)
   (if mh-folder-view-stack (mh-widen t))
   (mh-process-commands mh-current-folder)
@@ -603,13 +698,20 @@
     (setq mh-showing-with-headers t)))
 
 (defun mh-inc-folder (&optional maildrop-name folder)
-  "Inc(orporate)s new mail into the Inbox folder.
-Optional argument MAILDROP-NAME specifies an alternate maildrop from the
-default. The optional argument FOLDER specifies where to incorporate mail
-instead of the default named by `mh-inbox'.
-The value of `mh-inc-folder-hook' is a list of functions to be called, with no
-arguments, after incorporating new mail.
-Do not call this function from outside MH-E; use \\[mh-rmail] instead."
+  "Incorporate new mail into a folder.
+
+You can incorporate mail from any file into the current folder by
+specifying a prefix argument; you'll be prompted for the name of
+the file to use as well as the destination folder
+
+The hook `mh-inc-folder-hook' is run after incorporating new
+mail. Do not call this function from outside MH-E; use
+\\[mh-rmail] instead.
+
+In a program optional argument MAILDROP-NAME specifies an
+alternate maildrop from the default. The optional argument FOLDER
+specifies where to incorporate mail instead of the default named
+by `mh-inbox'."
   (interactive (list (if current-prefix-arg
                          (expand-file-name
                           (read-file-name "inc mail from file: "
@@ -653,12 +755,12 @@
 (defun mh-next-undeleted-msg (&optional count wait-after-complaining-flag)
   "Display next message.
 
-This command can be given a prefix argument COUNT to specify how many unread
-messages to skip.
-
-In a program, pause for a second after printing message if we are at the last
-undeleted message and optional argument WAIT-AFTER-COMPLAINING-FLAG is
-non-nil."
+This command can be given a prefix argument COUNT to specify how
+many unread messages to skip.
+
+In a program, pause for a second after printing message if we are
+at the last undeleted message and optional argument
+WAIT-AFTER-COMPLAINING-FLAG is non-nil."
   (interactive "p")
   (setq mh-next-direction 'forward)
   (forward-line 1)
@@ -674,18 +776,19 @@
 
 The name of the folder is derived as follows:
 
-  a) The folder name associated with the first address found in the list
-     `mh-default-folder-list' is used. Each element in this list contains a
-     `Check Recipient' item. If this item is turned on, then the address is
-     checked against the recipient instead of the sender. This is useful for
-     mailing lists.
-
-  b) An alias prefixed by `mh-default-folder-prefix' corresponding to the
-     address is used. The prefix is used to prevent clutter in your mail
-     directory.
+  a) The folder name associated with the first address found in
+     the list `mh-default-folder-list' is used. Each element in
+     this list contains a \"Check Recipient\" item. If this item is
+     turned on, then the address is checked against the recipient
+     instead of the sender. This is useful for mailing lists.
+
+  b) An alias prefixed by `mh-default-folder-prefix'
+     corresponding to the address is used. The prefix is used to
+     prevent clutter in your mail directory.
 
 Return nil if a folder name was not derived, or if the variable
-`mh-default-folder-must-exist-flag' is t and the folder does not exist."
+`mh-default-folder-must-exist-flag' is t and the folder does not
+exist."
   ;; Loop for all entries in mh-default-folder-list
   (save-restriction
     (goto-char (point-min))
@@ -750,18 +853,19 @@
 (defun mh-refile-msg (range folder &optional dont-update-last-destination-flag)
   "Refile (output) RANGE into FOLDER.
 
-You are prompted for the folder name. Note that this command can also be used
-to create folders. If you specify a folder that does not exist, you will be
-prompted to create it.
-
-The hook `mh-refile-msg-hook' is called after a message is marked to be
-refiled.
-
-Check the documentation of `mh-interactive-range' to see how RANGE is read in
-interactive use.
-
-If DONT-UPDATE-LAST-DESTINATION-FLAG is non-nil, then the variables
-`mh-last-destination' and `mh-last-destination-folder' are not updated."
+You are prompted for the folder name. Note that this command can also
+be used to create folders. If you specify a folder that does not
+exist, you will be prompted to create it.
+
+The hook `mh-refile-msg-hook' is called after a message is marked to
+be refiled.
+
+Check the documentation of `mh-interactive-range' to see how RANGE is
+read in interactive use.
+
+In a program, the variables `mh-last-destination' and
+`mh-last-destination-folder' are not updated if
+DONT-UPDATE-LAST-DESTINATION-FLAG is non-nil."
   (interactive (list (mh-interactive-range "Refile")
                      (intern (mh-prompt-for-refile-folder))))
   (unless dont-update-last-destination-flag
@@ -774,14 +878,14 @@
 (defun mh-refile-or-write-again (range &optional interactive-flag)
   "Repeat last output command.
 
-If you are refiling several messages into the same folder, you can use this
-command to repeat the last refile or write. You can use a range.
-
-Check the documentation of `mh-interactive-range' to see how RANGE is read in
-interactive use.
-
-In a program, a non-nil INTERACTIVE-FLAG means that the function was called
-interactively."
+If you are refiling several messages into the same folder, you can use
+this command to repeat the last refile or write. You can use a range.
+
+Check the documentation of `mh-interactive-range' to see how RANGE is
+read in interactive use.
+
+In a program, a non-nil INTERACTIVE-FLAG means that the function was
+called interactively."
   (interactive (list (mh-interactive-range "Redo") t))
   (if (null mh-last-destination)
       (error "No previous refile or write"))
@@ -796,13 +900,21 @@
 
 (defun mh-quit ()
   "Quit the current MH-E folder.
-Restore the previous window configuration, if one exists.
-The value of `mh-before-quit-hook' is a list of functions to be called, with
-no arguments, immediately upon entry to this function.
-The value of `mh-quit-hook' is a list of functions to be called, with no
-arguments, upon exit of this function.
-MH-E working buffers (whose name begins with \" *mh-\" or \"*MH-E \") are
-killed."
+
+When you want to quit using MH-E and go back to editing, you can use
+this command. This buries the buffers of the current MH-E folder and
+restores the buffers that were present when you first ran
+\\[mh-rmail]. It also removes any MH-E working buffers whose name
+begins with \" *mh-\" or \"*MH-E \". You can later restore your MH-E
+session by selecting the \"+inbox\" buffer or by running \\[mh-rmail]
+again.
+
+The two hooks `mh-before-quit-hook' and `mh-quit-hook' are called by
+this function. The former one is called before the quit occurs, so you
+might use it to perform any MH-E operations; you could perform some
+query and abort the quit or call `mh-execute-commands', for example.
+The latter is not run in an MH-E context, so you might use it to
+modify the window setup."
   (interactive)
   (run-hooks 'mh-before-quit-hook)
   (let ((show-buffer (get-buffer mh-show-buffer)))
@@ -825,9 +937,9 @@
 (defun mh-page-msg (&optional lines)
   "Display next page in message.
 
-You can give this command a prefix argument that specifies the number of LINES
-to scroll. This command will also show the next undeleted message if it is
-used at the bottom of a message."
+You can give this command a prefix argument that specifies the
+number of LINES to scroll. This command will also show the next
+undeleted message if it is used at the bottom of a message."
   (interactive "P")
   (if mh-showing-mode
       (if mh-page-to-next-msg-flag
@@ -850,8 +962,8 @@
 (defun mh-previous-page (&optional lines)
   "Display next page in message.
 
-You can give this command a prefix argument that specifies the number of LINES
-to scroll."
+You can give this command a prefix argument that specifies the
+number of LINES to scroll."
   (interactive "P")
   (mh-in-show-buffer (mh-show-buffer)
     (scroll-down lines)))
@@ -859,12 +971,12 @@
 (defun mh-previous-undeleted-msg (&optional count wait-after-complaining-flag)
   "Display previous message.
 
-This command can be given a prefix argument COUNT to specify how many unread
-messages to skip.
-
-In a program, pause for a second after printing message if we are at the last
-undeleted message and optional argument WAIT-AFTER-COMPLAINING-FLAG is
-non-nil."
+This command can be given a prefix argument COUNT to specify how
+many unread messages to skip.
+
+In a program, pause for a second after printing message if we are
+at the last undeleted message and optional argument
+WAIT-AFTER-COMPLAINING-FLAG is non-nil."
   (interactive "p")
   (setq mh-next-direction 'backward)
   (beginning-of-line)
@@ -876,8 +988,8 @@
 (defun mh-previous-unread-msg (&optional count)
   "Display previous unread message.
 
-This command can be given a prefix argument COUNT to specify how many unread
-messages to skip."
+This command can be given a prefix argument COUNT to specify how
+many unread messages to skip."
   (interactive "p")
   (unless (> count 0)
     (error "The function mh-previous-unread-msg expects positive argument"))
@@ -909,9 +1021,11 @@
 
 (defun mh-goto-next-button (backward-flag &optional criterion)
   "Search for next button satisfying criterion.
-If BACKWARD-FLAG is non-nil search backward in the buffer for a mime button. If
-CRITERION is a function or a symbol which has a function binding then that
-function must return non-nil at the button we stop."
+
+If BACKWARD-FLAG is non-nil search backward in the buffer for a mime
+button.
+If CRITERION is a function or a symbol which has a function binding
+then that function must return non-nil at the button we stop."
   (unless (or (and (symbolp criterion) (fboundp criterion))
               (functionp criterion))
     (setq criterion (lambda (x) t)))
@@ -954,11 +1068,11 @@
 (defun mh-next-button (&optional backward-flag)
   "Go to the next button.
 
-If the end of the buffer is reached then the search wraps over to the start of
-the buffer.
-
-If an optional prefix argument BACKWARD-FLAG is given, the cursor will move to
-the previous button."
+If the end of the buffer is reached then the search wraps over to
+the start of the buffer.
+
+If an optional prefix argument BACKWARD-FLAG is given, the cursor
+will move to the previous button."
   (interactive (list current-prefix-arg))
   (unless mh-showing-mode
     (mh-show))
@@ -968,17 +1082,18 @@
 (defun mh-prev-button ()
   "Go to the previous button.
 
-If the beginning of the buffer is reached then the search wraps over to the
-end of the buffer."
+If the beginning of the buffer is reached then the search wraps
+over to the end of the buffer."
   (interactive)
   (mh-next-button t))
 
 (defun mh-folder-mime-action (part-index action include-security-flag)
   "Go to PART-INDEX and carry out ACTION.
-If PART-INDEX is nil then go to the next part in the buffer. The search for
-the next buffer wraps around if end of buffer is reached. If argument
-INCLUDE-SECURITY-FLAG is non-nil then include security info buttons when
-searching for a suitable parts."
+
+If PART-INDEX is nil then go to the next part in the buffer. The
+search for the next buffer wraps around if end of buffer is reached.
+If argument INCLUDE-SECURITY-FLAG is non-nil then include security
+info buttons when searching for a suitable parts."
   (unless mh-showing-mode
     (mh-show))
   (mh-in-show-buffer (mh-show-buffer)
@@ -1009,15 +1124,17 @@
 (defun mh-folder-toggle-mime-part (part-index)
   "View attachment.
 
-This command displays (or hides) the attachment associated with the button
-under the cursor. If the cursor is not located over a button, then the cursor
-first moves to the next button, wrapping to the beginning of the message if
-necessary. This command has the advantage over related commands of working
-from the MH-Folder buffer.
-
-You can also provide a numeric prefix argument PART-INDEX to view the
-attachment labeled with that number. If Emacs does not know how to display the
-attachment, then Emacs offers to save the attachment in a file."
+This command displays (or hides) the attachment associated with
+the button under the cursor. If the cursor is not located over a
+button, then the cursor first moves to the next button, wrapping
+to the beginning of the message if necessary. This command has
+the advantage over related commands of working from the MH-Folder
+buffer.
+
+You can also provide a numeric prefix argument PART-INDEX to view
+the attachment labeled with that number. If Emacs does not know
+how to display the attachment, then Emacs offers to save the
+attachment in a file."
   (interactive "P")
   (when (consp part-index) (setq part-index (car part-index)))
   (mh-folder-mime-action part-index #'mh-press-button t))
@@ -1025,14 +1142,15 @@
 (defun mh-folder-inline-mime-part (part-index)
   "Show attachment verbatim.
 
-You can view the raw contents of an attachment with this command. This command
-displays (or hides) the contents of the attachment associated with the button
-under the cursor verbatim. If the cursor is not located over a button, then
-the cursor first moves to the next button, wrapping to the beginning of the
-message if necessary.
-
-You can also provide a numeric prefix argument PART-INDEX to view the
-attachment labeled with that number."
+You can view the raw contents of an attachment with this command.
+This command displays (or hides) the contents of the attachment
+associated with the button under the cursor verbatim. If the
+cursor is not located over a button, then the cursor first moves
+to the next button, wrapping to the beginning of the message if
+necessary.
+
+You can also provide a numeric prefix argument PART-INDEX to view
+the attachment labeled with that number."
   (interactive "P")
   (when (consp part-index) (setq part-index (car part-index)))
   (mh-folder-mime-action part-index #'mh-mime-inline-part nil))
@@ -1040,15 +1158,16 @@
 (defun mh-folder-save-mime-part (part-index)
   "Save (output) attachment.
 
-This command saves the attachment associated with the button under the cursor.
-If the cursor is not located over a button, then the cursor first moves to the
-next button, wrapping to the beginning of the message if necessary.
+This command saves the attachment associated with the button under the
+cursor. If the cursor is not located over a button, then the cursor
+first moves to the next button, wrapping to the beginning of the
+message if necessary.
 
 You can also provide a numeric prefix argument PART-INDEX to save the
 attachment labeled with that number.
 
-This command prompts you for a filename and suggests a specific name if it is
-available."
+This command prompts you for a filename and suggests a specific name
+if it is available."
   (interactive "P")
   (when (consp part-index) (setq part-index (car part-index)))
   (mh-folder-mime-action part-index #'mh-mime-save-part nil))
@@ -1067,16 +1186,17 @@
   "Rescan folder\\<mh-folder-mode-map>.
 
 This command is useful to grab all messages in your \"+inbox\" after
-processing your new mail for the first time. If you don't want to rescan the
-entire folder, this command will accept a RANGE. Check the documentation of
-`mh-interactive-range' to see how RANGE is read in interactive use.
-
-This command will ask if you want to process refiles or deletes first and then
-either run \\[mh-execute-commands] for you or undo the pending refiles and
-deletes, which are lost.
-
-In a program, the processing of outstanding commands is not performed if
-DONT-EXEC-PENDING is non-nil."
+processing your new mail for the first time. If you don't want to
+rescan the entire folder, this command will accept a RANGE. Check the
+documentation of `mh-interactive-range' to see how RANGE is read in
+interactive use.
+
+This command will ask if you want to process refiles or deletes first
+and then either run \\[mh-execute-commands] for you or undo the
+pending refiles and deletes, which are lost.
+
+In a program, the processing of outstanding commands is not performed
+if DONT-EXEC-PENDING is non-nil."
   (interactive (list (if current-prefix-arg
                          (mh-read-range "Rescan" mh-current-folder t nil t
                                         mh-interpret-number-as-range-flag)
@@ -1090,10 +1210,11 @@
 (defun mh-write-msg-to-file (message file no-header)
   "Append MESSAGE to end of FILE\\<mh-folder-mode-map>.
 
-You are prompted for the filename. If the file already exists, the message is
-appended to it. You can also write the message to the file without the header
-by specifying a prefix argument NO-HEADER. Subsequent writes to the same file
-can be made with the command \\[mh-refile-or-write-again]."
+You are prompted for the filename. If the file already exists,
+the message is appended to it. You can also write the message to
+the file without the header by specifying a prefix argument
+NO-HEADER. Subsequent writes to the same file can be made with
+the command \\[mh-refile-or-write-again]."
   (interactive
    (list (mh-get-msg-num t)
          (let ((default-dir (if (eq 'write (car mh-last-destination-write))
@@ -1129,13 +1250,14 @@
 (defun mh-undo (range)
   "Undo pending deletes or refiles in RANGE.
 
-If you've deleted a message or refiled it, but changed your mind, you can
-cancel the action before you've executed it. Use this command to undo a refile
-on or deletion of a single message. You can also undo refiles and deletes for
-messages that are found in a given RANGE.
-
-Check the documentation of `mh-interactive-range' to see how RANGE is read in
-interactive use."
+If you've deleted a message or refiled it, but changed your mind,
+you can cancel the action before you've executed it. Use this
+command to undo a refile on or deletion of a single message. You
+can also undo refiles and deletes for messages that are found in
+a given RANGE.
+
+Check the documentation of `mh-interactive-range' to see how
+RANGE is read in interactive use."
   (interactive (list (mh-interactive-range "Undo")))
   (cond ((numberp range)
          (let ((original-position (point)))
@@ -1161,8 +1283,8 @@
 
 (defun mh-folder-line-matches-show-buffer-p ()
   "Return t if the message under point in folder-mode is in the show buffer.
-Return nil in any other circumstance (no message under point, no show buffer,
-the message in the show buffer doesn't match."
+Return nil in any other circumstance (no message under point, no
+show buffer, the message in the show buffer doesn't match."
   (and (eq major-mode 'mh-folder-mode)
        (mh-get-msg-num nil)
        mh-show-buffer
@@ -1178,9 +1300,9 @@
 
 (defmacro mh-macro-expansion-time-gnus-version ()
   "Return Gnus version available at macro expansion time.
-The macro evaluates the Gnus version at macro expansion time. If MH-E was
-compiled then macro expansion happens at compile time."
-  gnus-version)
+The macro evaluates the Gnus version at macro expansion time. If
+MH-E was compiled then macro expansion happens at compile time."
+gnus-version)
 
 (defun mh-run-time-gnus-version ()
   "Return Gnus version available at run time."
@@ -1222,9 +1344,9 @@
 
 (defun mh-parse-flist-output-line (line &optional current-folder)
   "Parse LINE to generate folder name, unseen messages and total messages.
-If CURRENT-FOLDER is non-nil then it contains the current folder name and it is
-used to avoid problems in corner cases involving folders whose names end with a
-'+' character."
+If CURRENT-FOLDER is non-nil then it contains the current folder
+name and it is used to avoid problems in corner cases involving
+folders whose names end with a '+' character."
   (with-temp-buffer
     (insert line)
     (goto-char (point-max))
@@ -1248,7 +1370,7 @@
             (values (format "+%s" folder) (car unseen) (car total))))))))
 
 (defun mh-folder-size-folder (folder)
-  "Find size of FOLDER using `folder'."
+  "Find size of FOLDER using \"folder\"."
   (with-temp-buffer
     (let ((u (length (cdr (assoc mh-unseen-seq
                                  (mh-read-folder-sequences folder nil))))))
@@ -1260,7 +1382,7 @@
         (values 0 u folder)))))
 
 (defun mh-folder-size-flist (folder)
-  "Find size of FOLDER using `flist'."
+  "Find size of FOLDER using \"flist\"."
   (with-temp-buffer
     (call-process (expand-file-name "flist" mh-progs) nil t nil "-showzero"
                   "-norecurse" folder "-sequence" (symbol-name mh-unseen-seq))
@@ -1279,27 +1401,31 @@
 (defun mh-visit-folder (folder &optional range index-data)
   "Visit FOLDER.
 
-When you want to read the messages that you have refiled into folders, use
-this command to visit the folder. You are prompted for the folder name.
-
-The folder buffer will show just unseen messages if there are any; otherwise,
-it will show all the messages in the buffer as long there are fewer than
-`mh-large-folder' messages. If there are more, then you are prompted for a
-range of messages to scan.
-
-You can provide a prefix argument in order to specify a RANGE of messages to
-show when you visit the folder. In this case, regions are not used to specify
-the range and `mh-large-folder' is ignored. Check the documentation of
-`mh-interactive-range' to see how RANGE is read in interactive use.
-
-Note that this command can also be used to create folders. If you specify a
-folder that does not exist, you will be prompted to create it.
+When you want to read the messages that you have refiled into folders,
+use this command to visit the folder. You are prompted for the folder
+name.
+
+The folder buffer will show just unseen messages if there are any;
+otherwise, it will show all the messages in the buffer as long there
+are fewer than `mh-large-folder' messages. If there are more, then you
+are prompted for a range of messages to scan.
+
+You can provide a prefix argument in order to specify a RANGE of
+messages to show when you visit the folder. In this case, regions are
+not used to specify the range and `mh-large-folder' is ignored. Check
+the documentation of `mh-interactive-range' to see how RANGE is read
+in interactive use.
+
+Note that this command can also be used to create folders. If you
+specify a folder that does not exist, you will be prompted to create
+it.
 
 Do not call this function from outside MH-E; use \\[mh-rmail] instead.
 
-If, in a program, RANGE is nil (the default), then all messages in FOLDER are
-displayed. If an index buffer is being created then INDEX-DATA is used to
-initialize the index buffer specific data structures."
+If, in a program, RANGE is nil (the default), then all messages in
+FOLDER are displayed. If an index buffer is being created then
+INDEX-DATA is used to initialize the index buffer specific data
+structures."
   (interactive (let ((folder-name (mh-prompt-for-folder "Visit" mh-inbox t)))
                  (list folder-name
                        (mh-read-range "Scan" folder-name t nil
@@ -1338,10 +1464,11 @@
 
 (defun mh-update-sequences ()
   "Flush MH-E's state out to MH.
-This function updates the sequence specified by your \"Unseen-Sequence:\"
-profile component, \"cur\", and the sequence listed by the `mh-tick-seq'
-option which is \"tick\" by default. The message at the cursor is used for
-\"cur\"."
+
+This function updates the sequence specified by your
+\"Unseen-Sequence:\" profile component, \"cur\", and the sequence
+listed by the `mh-tick-seq' option which is \"tick\" by default.
+The message at the cursor is used for \"cur\"."
   (interactive)
   ;; mh-update-sequences is the opposite of mh-read-folder-sequences,
   ;; which updates MH-E's state from MH.
@@ -1368,44 +1495,43 @@
 
 ;;; Support routines.
 
-(defun mh-delete-a-msg (msg)
-  "Delete the MSG.
-If MSG is nil then the message at point is deleted.
-
-The value of `mh-delete-msg-hook' is a list of functions to be called, with no
-arguments, after the message has been deleted."
+(defun mh-delete-a-msg (message)
+  "Delete MESSAGE.
+If MESSAGE is nil then the message at point is deleted.
+The hook `mh-delete-msg-hook' is called after you mark a message
+for deletion. For example, a past maintainer of MH-E used this
+once when he kept statistics on his mail usage."
   (save-excursion
-    (if (numberp msg)
-        (mh-goto-msg msg nil t)
+    (if (numberp message)
+        (mh-goto-msg message nil t)
       (beginning-of-line)
-      (setq msg (mh-get-msg-num t)))
+      (setq message (mh-get-msg-num t)))
     (if (looking-at mh-scan-refiled-msg-regexp)
-        (error "Message %d is refiled.  Undo refile before deleting" msg))
+        (error "Message %d is refiled.  Undo refile before deleting" message))
     (if (looking-at mh-scan-deleted-msg-regexp)
         nil
       (mh-set-folder-modified-p t)
-      (setq mh-delete-list (cons msg mh-delete-list))
+      (setq mh-delete-list (cons message mh-delete-list))
       (mh-notate nil mh-note-deleted mh-cmd-note)
       (run-hooks 'mh-delete-msg-hook))))
 
-(defun mh-refile-a-msg (msg folder)
-  "Refile MSG in FOLDER.
-If MSG is nil then the message at point is refiled.
-
+(defun mh-refile-a-msg (message folder)
+  "Refile MESSAGE in FOLDER.
+If MESSAGE is nil then the message at point is refiled.
 Folder is a symbol, not a string.
-The value of `mh-refile-msg-hook' is a list of functions to be called, with no
-arguments, after the message has been refiled."
+The hook `mh-refile-msg-hook' is called after a message is marked to
+be refiled."
   (save-excursion
-    (if (numberp msg)
-        (mh-goto-msg msg nil t)
+    (if (numberp message)
+        (mh-goto-msg message nil t)
       (beginning-of-line)
-      (setq msg (mh-get-msg-num t)))
+      (setq message (mh-get-msg-num t)))
     (cond ((looking-at mh-scan-deleted-msg-regexp)
-           (error "Message %d is deleted.  Undo delete before moving" msg))
+           (error "Message %d is deleted.  Undo delete before moving" message))
           ((looking-at mh-scan-refiled-msg-regexp)
            (if (y-or-n-p
                 (format "Message %d already refiled.  Copy to %s as well? "
-                        msg folder))
+                        message folder))
                (mh-exec-cmd "refile" (mh-get-msg-num t) "-link"
                             "-src" mh-current-folder
                             (symbol-name folder))
@@ -1413,17 +1539,17 @@
           (t
            (mh-set-folder-modified-p t)
            (cond ((null (assoc folder mh-refile-list))
-                  (push (list folder msg) mh-refile-list))
-                 ((not (member msg (cdr (assoc folder mh-refile-list))))
-                  (push msg (cdr (assoc folder mh-refile-list)))))
+                  (push (list folder message) mh-refile-list))
+                 ((not (member message (cdr (assoc folder mh-refile-list))))
+                  (push message (cdr (assoc folder mh-refile-list)))))
            (mh-notate nil mh-note-refiled mh-cmd-note)
            (run-hooks 'mh-refile-msg-hook)))))
 
 (defun mh-next-msg (&optional wait-after-complaining-flag)
   "Move backward or forward to the next undeleted message in the buffer.
-If optional argument WAIT-AFTER-COMPLAINING-FLAG is non-nil and we are at the
-last message, then wait for a second after telling the user that there aren't
-any more unread messages."
+If optional argument WAIT-AFTER-COMPLAINING-FLAG is non-nil and
+we are at the last message, then wait for a second after telling
+the user that there aren't any more unread messages."
   (if (eq mh-next-direction 'forward)
       (mh-next-undeleted-msg 1 wait-after-complaining-flag)
     (mh-previous-undeleted-msg 1 wait-after-complaining-flag)))
@@ -1431,8 +1557,8 @@
 (defun mh-next-unread-msg (&optional count)
   "Display next unread message.
 
-This command can be given a prefix argument COUNT to specify how many unread
-messages to skip."
+This command can be given a prefix argument COUNT to specify how
+many unread messages to skip."
   (interactive "p")
   (unless (> count 0)
     (error "The function mh-next-unread-msg expects positive argument"))
@@ -1609,9 +1735,9 @@
 
 (defmacro mh-write-file-functions-compat ()
   "Return `write-file-functions' if it exists.
-Otherwise return `local-write-file-hooks'. This macro exists purely for
-compatibility. The former symbol is used in Emacs 21.4 onward while the latter
-is used in previous versions and XEmacs."
+Otherwise return `local-write-file-hooks'. This macro exists
+purely for compatibility. The former symbol is used in Emacs 21.4
+onward while the latter is used in previous versions and XEmacs."
   (if (boundp 'write-file-functions)
       ''write-file-functions            ;Emacs 21.4
     ''local-write-file-hooks))          ;<Emacs 21.4, XEmacs
@@ -1635,52 +1761,56 @@
 (define-derived-mode mh-folder-mode fundamental-mode "MH-Folder"
   "Major MH-E mode for \"editing\" an MH folder scan listing.\\<mh-folder-mode-map>
 
-You can show the message the cursor is pointing to, and step through the
-messages.  Messages can be marked for deletion or refiling into another
-folder; these commands are executed all at once with a separate command.
-
-Options that control this mode can be changed with \\[customize-group];
-specify the \"mh\" group. In particular, please see the `mh-scan-format-file'
-option if you wish to modify scan's format.
+You can show the message the cursor is pointing to, and step through
+the messages. Messages can be marked for deletion or refiling into
+another folder; these commands are executed all at once with a
+separate command.
+
+Options that control this mode can be changed with
+\\[customize-group]; specify the \"mh\" group. In particular, please
+see the `mh-scan-format-file' option if you wish to modify scan's
+format.
 
 When a folder is visited, the hook `mh-folder-mode-hook' is run.
 
 Ranges
 ======
-Many commands that operate on individual messages, such as `mh-forward' or
-`mh-refile-msg' take a RANGE argument. This argument can be used in several
-ways.
-
-If you provide the prefix argument (\\[universal-argument]) to these commands,
-then you will be prompted for the message range. This can be any valid MH
-range which can include messages, sequences, and the abbreviations (described
-in the mh(1) man page):
+Many commands that operate on individual messages, such as
+`mh-forward' or `mh-refile-msg' take a RANGE argument. This argument
+can be used in several ways.
+
+If you provide the prefix argument (\\[universal-argument]) to
+these commands, then you will be prompted for the message range.
+This can be any valid MH range which can include messages,
+sequences, and the abbreviations (described in the mh(1) man
+page):
 
 <num1>-<num2>
-    Indicates all messages in the range <num1> to <num2>, inclusive. The range
-    must be nonempty.
-
-`<num>:N'
-`<num>:+N'
-`<num>:-N'
-    Up to N messages beginning with (or ending with) message num. Num may be
-    any of the predefined symbols: first, prev, cur, next or last.
-
-`first:N'
-`prev:N'
-`next:N'
-`last:N'
+    Indicates all messages in the range <num1> to <num2>, inclusive.
+    The range must be nonempty.
+
+<num>:N
+<num>:+N
+<num>:-N
+    Up to N messages beginning with (or ending with) message num. Num
+    may be any of the predefined symbols: first, prev, cur, next or
+    last.
+
+first:N
+prev:N
+next:N
+last:N
     The first, previous, next or last messages, if they exist.
 
-`all'
+all
     All of the messages.
 
-For example, a range that shows all of these things is `1 2 3 5-10 last:5
-unseen'.
-
-If the option `transient-mark-mode' is set to t and you set a region in the
-MH-Folder buffer, then the MH-E command will perform the operation on all
-messages in that region.
+For example, a range that shows all of these things is `1 2 3
+5-10 last:5 unseen'.
+
+If the option `transient-mark-mode' is set to t and you set a
+region in the MH-Folder buffer, then the MH-E command will
+perform the operation on all messages in that region.
 
 \\{mh-folder-mode-map}"
   (mh-do-in-gnu-emacs
@@ -1785,10 +1915,10 @@
                                   desktop-buffer-name
                                   desktop-buffer-misc)
   "Restore an MH folder buffer specified in a desktop file.
-When desktop creates a buffer, DESKTOP-BUFFER-FILE-NAME holds the file name to
-visit, DESKTOP-BUFFER-NAME holds the desired buffer name, and
-DESKTOP-BUFFER-MISC holds a list of miscellaneous info used by the
-`desktop-buffer-handlers' functions."
+When desktop creates a buffer, DESKTOP-BUFFER-FILE-NAME holds the
+file name to visit, DESKTOP-BUFFER-NAME holds the desired buffer
+name, and DESKTOP-BUFFER-MISC holds a list of miscellaneous info
+used by the `desktop-buffer-handlers' functions."
   (mh-find-path)
   (mh-visit-folder desktop-buffer-name)
   (current-buffer))
@@ -1801,13 +1931,14 @@
 (defun mh-scan-folder (folder range &optional dont-exec-pending)
   "Scan FOLDER over RANGE.
 
-After the scan is performed, switch to the buffer associated with FOLDER.
-
-Check the documentation of `mh-interactive-range' to see how RANGE is read in
-interactive use.
-
-The processing of outstanding commands is not performed if DONT-EXEC-PENDING
-is non-nil."
+After the scan is performed, switch to the buffer associated with
+FOLDER.
+
+Check the documentation of `mh-interactive-range' to see how RANGE is
+read in interactive use.
+
+The processing of outstanding commands is not performed if
+DONT-EXEC-PENDING is non-nil."
   (when (stringp range)
     (setq range (delete "" (split-string range "[ \t\n]"))))
   (cond ((null (get-buffer folder))
@@ -1830,11 +1961,12 @@
   "Return the column for notations given message number WIDTH.
 Note that columns in Emacs start with 0.
 
-If `mh-scan-format-file' is set to \"Use MH-E scan Format\" this means that
-either `mh-scan-format-mh' or `mh-scan-format-nmh' are in use. This function
-therefore assumes that the first column is empty (to provide room for the
-cursor), the following WIDTH columns contain the message number, and the
-column for notations comes after that."
+If `mh-scan-format-file' is set to \"Use MH-E scan Format\" this
+means that either `mh-scan-format-mh' or `mh-scan-format-nmh' are
+in use. This function therefore assumes that the first column is
+empty (to provide room for the cursor), the following WIDTH
+columns contain the message number, and the column for notations
+comes after that."
   (if (eq mh-scan-format-file t)
       (max (1+ width) 2)
     (error "%s %s" "Can't call mh-msg-num-width-to-column"
@@ -1893,9 +2025,9 @@
 After doing an `mh-get-new-mail' operation in this FOLDER, at least
 one line that looks like a truncated message number was found.
 
-Remove the text added by the last `mh-inc' command. It should be the messages
-cur-last. Call `mh-set-cmd-note', adjusting the notation column with the width
-of the largest message number in FOLDER.
+Remove the text added by the last `mh-inc' command. It should be the
+messages cur-last. Call `mh-set-cmd-note', adjusting the notation
+column with the width of the largest message number in FOLDER.
 
 Reformat the message number width on each line in the buffer and trim
 the line length to fit in the window.
@@ -2016,8 +2148,9 @@
 
 (defun mh-make-folder-mode-line (&optional ignored)
   "Set the fields of the mode line for a folder buffer.
-The optional argument is now obsolete and IGNORED. It used to be used to pass
-in what is now stored in the buffer-local variable `mh-mode-line-annotation'."
+The optional argument is now obsolete and IGNORED. It used to be
+used to pass in what is now stored in the buffer-local variable
+`mh-mode-line-annotation'."
   (save-excursion
     (save-window-excursion
       (mh-first-msg)
@@ -2057,8 +2190,8 @@
 
 (defun mh-add-sequence-notation (msg internal-seq-flag)
   "Add sequence notation to the MSG on the current line.
-If INTERNAL-SEQ-FLAG is non-nil, then refontify the scan line if font-lock is
-turned on."
+If INTERNAL-SEQ-FLAG is non-nil, then refontify the scan line if
+font-lock is turned on."
   (with-mh-folder-updating (t)
     (save-excursion
       (beginning-of-line)
@@ -2079,10 +2212,11 @@
 
 (defun mh-remove-sequence-notation (msg internal-seq-flag &optional all)
   "Remove sequence notation from the MSG on the current line.
-If INTERNAL-SEQ-FLAG is non-nil, then `font-lock' was used to highlight the
-sequence. In that case, no notation needs to be removed. Otherwise the effect
-of inserting `mh-note-seq' needs to be reversed.
-If ALL is non-nil, then all sequence marks on the scan line are removed."
+If INTERNAL-SEQ-FLAG is non-nil, then `font-lock' was used to
+highlight the sequence. In that case, no notation needs to be removed.
+Otherwise the effect of inserting `mh-note-seq' needs to be reversed.
+If ALL is non-nil, then all sequence marks on the scan line are
+removed."
   (with-mh-folder-updating (t)
     ;; This takes care of internal sequences...
     (mh-notate nil nil mh-cmd-note)
@@ -2122,8 +2256,8 @@
 
 (defun mh-goto-cur-msg (&optional minimal-changes-flag)
   "Position the cursor at the current message.
-When optional argument MINIMAL-CHANGES-FLAG is non-nil, the function doesn't
-recenter the folder buffer."
+When optional argument MINIMAL-CHANGES-FLAG is non-nil, the
+function doesn't recenter the folder buffer."
   (let ((cur-msg (car (mh-seq-to-msgs 'cur))))
     (cond ((and cur-msg
                 (mh-goto-msg cur-msg t t))
@@ -2137,7 +2271,8 @@
 
 (defun mh-process-or-undo-commands (folder)
   "If FOLDER has outstanding commands, then either process or discard them.
-Called by functions like `mh-sort-folder', so also invalidate show buffer."
+Called by functions like `mh-sort-folder', so also invalidate
+show buffer."
   (set-buffer folder)
   (if (mh-outstanding-commands-p)
       (if (or mh-do-not-confirm-flag
@@ -2151,10 +2286,10 @@
 
 (defun mh-process-commands (folder)
   "Process outstanding commands for FOLDER.
-The value of `mh-before-commands-processed-hook' is a list of functions
-to be called, with no arguments, before the commands are processed.
-After all cammands are processed, the functions in
-`mh-after-commands-processed-hook' are called with no arguments."
+
+This function runs `mh-before-commands-processed-hook' before the
+commands are processed and `mh-after-commands-processed-hook'
+after the commands are processed."
   (message "Processing deletes and refiles for %s..." folder)
   (set-buffer folder)
   (with-mh-folder-updating (nil)
@@ -2238,7 +2373,7 @@
       (mh-remove-all-notation)
       (mh-notate-user-sequences)
 
-      ;; Run the after hook -- now folders-changed is valid, 
+      ;; Run the after hook -- now folders-changed is valid,
       ;; but not the lists of specific messages.
       (let ((mh-folders-changed folders-changed))
         (run-hooks 'mh-after-commands-processed-hook)))
@@ -2248,8 +2383,8 @@
 (defun mh-update-unseen ()
   "Synchronize the unseen sequence with MH.
 Return non-nil iff the MH folder was set.
-The value of `mh-unseen-updated-hook' is a list of functions to be called,
-with no arguments, after the unseen sequence is updated."
+The hook `mh-unseen-updated-hook' is called after the unseen sequence
+is updated."
   (if mh-seen-list
       (let* ((unseen-seq (mh-find-seq mh-unseen-seq))
              (unseen-msgs (mh-seq-msgs unseen-seq)))
@@ -2284,8 +2419,8 @@
 (defun mh-coalesce-msg-list (messages)
   "Given a list of MESSAGES, return a list of message number ranges.
 This is the inverse of `mh-read-msg-list', which expands ranges.
-Message lists passed to MH programs should be processed by this function
-to avoid exceeding system command line argument limits."
+Message lists passed to MH programs should be processed by this
+function to avoid exceeding system command line argument limits."
   (let ((msgs (sort (copy-sequence messages) 'mh-greaterp))
         (range-high nil)
         (prev -1)
@@ -2383,8 +2518,9 @@
 (defun mh-notate-user-sequences (&optional range)
   "Mark user-defined sequences in RANGE.
 
-Check the documentation of `mh-interactive-range' to see how RANGE is read in
-interactive use; if nil all messages are notated."
+Check the documentation of `mh-interactive-range' to see how
+RANGE is read in interactive use; if nil all messages are
+notated."
   (unless range
     (setq range (cons (point-min) (point-max))))
   (let ((seqs mh-seq-list)
@@ -2414,10 +2550,11 @@
 (defun mh-delete-msg-from-seq (range sequence &optional internal-flag)
   "Delete RANGE from SEQUENCE.
 
-Check the documentation of `mh-interactive-range' to see how RANGE is read in
-interactive use.
-
-In a program, non-nil INTERNAL-FLAG means do not inform MH of the change."
+Check the documentation of `mh-interactive-range' to see how
+RANGE is read in interactive use.
+
+In a program, non-nil INTERNAL-FLAG means do not inform MH of the
+change."
   (interactive (list (mh-interactive-range "Delete")
                      (mh-read-seq-default "Delete from" t)
                      nil))
@@ -2445,15 +2582,16 @@
 (defun mh-catchup (range)
   "Delete RANGE from the \"unseen\" sequence.
 
-Check the documentation of `mh-interactive-range' to see how RANGE is read in
-interactive use."
+Check the documentation of `mh-interactive-range' to see how
+RANGE is read in interactive use."
   (interactive (list (mh-interactive-range "Catchup"
                                            (cons (point-min) (point-max)))))
   (mh-delete-msg-from-seq range mh-unseen-seq))
 
 (defun mh-delete-a-msg-from-seq (msg sequence internal-flag)
   "Delete MSG from SEQUENCE.
-If INTERNAL-FLAG is non-nil, then do not inform MH of the change."
+If INTERNAL-FLAG is non-nil, then do not inform MH of the
+change."
   (let ((entry (mh-find-seq sequence)))
     (when (and entry (memq msg (mh-seq-msgs entry)))
       (if (not internal-flag)
@@ -2480,7 +2618,8 @@
 
 (defun mh-seq-containing-msg (msg &optional include-internal-flag)
   "Return a list of the sequences containing MSG.
-If INCLUDE-INTERNAL-FLAG non-nil, include MH-E internal sequences in list."
+If INCLUDE-INTERNAL-FLAG non-nil, include MH-E internal sequences
+in list."
   (let ((l mh-seq-list)
         (seqs ()))
     (while l
@@ -2504,7 +2643,7 @@
 (defalias 'mh-alt-send 'mh-send)
 (defalias 'mh-alt-visit-folder 'mh-visit-folder)
 
-;; Save the `b' binding for a future `back'. Maybe?
+;; Save the "b" binding for a future `back'. Maybe?
 (gnus-define-keys  mh-folder-mode-map
   " "           mh-page-msg
   "!"           mh-refile-or-write-again
@@ -2654,7 +2793,7 @@
 ;;
 ;; When adding a new prefix, ensure that the help message contains "what" the
 ;; prefix is for. For example, if the word "folder" were not present in the
-;; `F' entry, it would not be clear what these commands operated upon.
+;; "F" entry, it would not be clear what these commands operated upon.
 (defvar mh-help-messages
   '((nil "[i]nc, [.]show, [,]show all, [n]ext, [p]revious,\n"
          "[d]elete, [o]refile, e[x]ecute,\n"
--- a/lisp/mh-e/mh-funcs.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/mh-e/mh-funcs.el	Thu Dec 29 04:41:02 2005 +0000
@@ -57,17 +57,19 @@
 (defun mh-burst-digest ()
   "Break up digest into separate messages\\<mh-folder-mode-map>.
 
-This command uses the MH command \"burst\" to break out each message in the
-digest into its own message. Using this command, you can quickly delete
-unwanted messages, like this: Once the digest is split up, toggle out of
-MH-Folder Show mode with \\[mh-toggle-showing] so that the scan lines fill the
-screen and messages aren't displayed. Then use \\[mh-delete-msg] to quickly
-delete messages that you don't want to read (based on the \"Subject:\" header
-field). You can also burst the digest to reply directly to the people who
-posted the messages in the digest. One problem you may encounter is that the
-\"From:\" header fields are preceded with a \">\" so that your reply can't
-create the \"To:\" field correctly. In this case, you must correct the \"To:\"
-field yourself."
+This command uses the MH command \"burst\" to break out each
+message in the digest into its own message. Using this command,
+you can quickly delete unwanted messages, like this: Once the
+digest is split up, toggle out of MH-Folder Show mode with
+\\[mh-toggle-showing] so that the scan lines fill the screen and
+messages aren't displayed. Then use \\[mh-delete-msg] to quickly
+delete messages that you don't want to read (based on the
+\"Subject:\" header field). You can also burst the digest to
+reply directly to the people who posted the messages in the
+digest. One problem you may encounter is that the \"From:\"
+header fields are preceded with a \">\" so that your reply can't
+create the \"To:\" field correctly. In this case, you must
+correct the \"To:\" field yourself."
   (interactive)
   (let ((digest (mh-get-msg-num t)))
     (mh-process-or-undo-commands mh-current-folder)
@@ -85,15 +87,15 @@
 (defun mh-copy-msg (range folder)
   "Copy RANGE to FOLDER\\<mh-folder-mode-map>.
 
-If you wish to copy a message to another folder, you can use this command
-\(see the \"-link\" argument to \"refile\"). Like the command
-\\[mh-refile-msg], this command prompts you for the name of the target folder
-and you can specify a range. Note that unlike the command \\[mh-refile-msg],
-the copy takes place immediately. The original copy remains in the current
-folder.
+If you wish to copy a message to another folder, you can use this
+command (see the \"-link\" argument to \"refile\"). Like the
+command \\[mh-refile-msg], this command prompts you for the name
+of the target folder and you can specify a range. Note that
+unlike the command \\[mh-refile-msg], the copy takes place
+immediately. The original copy remains in the current folder.
 
-Check the documentation of `mh-interactive-range' to see how RANGE is read in
-interactive use."
+Check the documentation of `mh-interactive-range' to see how
+RANGE is read in interactive use."
   (interactive (list (mh-interactive-range "Copy")
                      (mh-prompt-for-folder "Copy to" "" t)))
   (let ((msg-list (let ((result ()))
@@ -106,15 +108,18 @@
 
 ;;;###mh-autoload
 (defun mh-kill-folder ()
-  "Remove the current folder and all included messages.
-Removes all of the messages (files) within the specified current folder,
-and then removes the folder (directory) itself.
-The value of `mh-kill-folder-suppress-prompt-hook' is a list of functions to
-be called, with no arguments, which should return a value of non-nil if
-verification is not desired."
+  "Remove folder.
+
+Remove all of the messages (files) within the current folder, and
+then remove the folder (directory) itself.
+
+Run the abnormal hook `mh-kill-folder-suppress-prompt-hooks'. The
+hook functions are called with no arguments and should return a
+non-nil value to suppress the normal prompt when you remove a
+folder. This is useful for folders that are easily regenerated."
   (interactive)
   (if (or (run-hook-with-args-until-success
-           'mh-kill-folder-suppress-prompt-hook)
+           'mh-kill-folder-suppress-prompt-hooks)
           (yes-or-no-p (format "Remove folder %s (and all included messages)? "
                                mh-current-folder)))
       (let ((folder mh-current-folder)
@@ -169,14 +174,15 @@
 (defun mh-pack-folder (range)
   "Pack folder\\<mh-folder-mode-map>.
 
-This command packs the folder, removing gaps from the numbering sequence. If
-you don't want to rescan the entire folder afterward, this command will accept
-a RANGE. Check the documentation of `mh-interactive-range' to see how RANGE is
-read in interactive use.
+This command packs the folder, removing gaps from the numbering
+sequence. If you don't want to rescan the entire folder
+afterward, this command will accept a RANGE. Check the
+documentation of `mh-interactive-range' to see how RANGE is read
+in interactive use.
 
-This command will ask if you want to process refiles or deletes first and then
-either run \\[mh-execute-commands] for you or undo the pending refiles and
-deletes, which are lost."
+This command will ask if you want to process refiles or deletes
+first and then either run \\[mh-execute-commands] for you or undo
+the pending refiles and deletes, which are lost."
   (interactive (list (if current-prefix-arg
                          (mh-read-range "Scan" mh-current-folder t nil t
                                         mh-interpret-number-as-range-flag)
@@ -207,9 +213,10 @@
 (defun mh-pipe-msg (command include-header)
   "Pipe message through shell command COMMAND.
 
-You are prompted for the Unix command through which you wish to run your
-message. If you give an argument INCLUDE-HEADER to this command, the message
-header is included in the text passed to the command."
+You are prompted for the Unix command through which you wish to
+run your message. If you give an argument INCLUDE-HEADER to this
+command, the message header is included in the text passed to the
+command."
   (interactive
    (list (read-string "Shell command on message: ") current-prefix-arg))
   (let ((msg-file-to-pipe (mh-msg-filename (mh-get-msg-num t)))
@@ -260,9 +267,11 @@
 ;;;###mh-autoload
 (defun mh-sort-folder (&optional extra-args)
   "Sort the messages in the current folder by date.
+
 Calls the MH program sortm to do the work.
-The arguments in the list `mh-sortm-args' are passed to sortm if the optional
-argument EXTRA-ARGS is given."
+
+The arguments in the list `mh-sortm-args' are passed to sortm if
+the optional argument EXTRA-ARGS is given."
   (interactive "P")
   (mh-process-or-undo-commands mh-current-folder)
   (setq mh-next-direction 'forward)
@@ -294,12 +303,13 @@
 
 ;;;###mh-autoload
 (defun mh-store-msg (directory)
-  "Unpack message created with `uudecode' or `shar'.
+  "Unpack message created with \"uudecode\" or \"shar\".
 
-The default DIRECTORY for extraction is the current directory; however, you
-have a chance to specify a different extraction directory. The next time you
-use this command, the default directory is the last directory you used. If you
-would like to change the initial default directory, customize the option
+The default DIRECTORY for extraction is the current directory;
+however, you have a chance to specify a different extraction
+directory. The next time you use this command, the default
+directory is the last directory you used. If you would like to
+change the initial default directory, customize the option
 `mh-store-default-directory'."
   (interactive (list (let ((udir (or mh-store-default-directory
                                      default-directory)))
@@ -315,9 +325,11 @@
 ;;;###mh-autoload
 (defun mh-store-buffer (directory)
   "Store the file(s) contained in the current buffer into DIRECTORY.
+
 The buffer can contain a shar file or uuencoded file.
-Default directory is the last directory used, or initially the value of
-`mh-store-default-directory' or the current directory."
+
+Default directory is the last directory used, or initially the
+value of `mh-store-default-directory' or the current directory."
   (interactive (list (let ((udir (or mh-store-default-directory
                                      default-directory)))
                        (read-file-name "Store buffer in directory: "
@@ -397,7 +409,7 @@
 (defun mh-prefix-help ()
   "Display cheat sheet for the commands of the current prefix in minibuffer."
   (interactive)
-  ;; We got here because the user pressed a `?', but he pressed a prefix key
+  ;; We got here because the user pressed a "?", but he pressed a prefix key
   ;; before that. Since the the key vector starts at index 0, the index of the
   ;; last keystroke is length-1 and thus the second to last keystroke is at
   ;; length-2. We use that information to obtain a suitable prefix character
--- a/lisp/mh-e/mh-gnus.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/mh-e/mh-gnus.el	Thu Dec 29 04:41:02 2005 +0000
@@ -41,9 +41,9 @@
 
 (defmacro mh-defun-compat (function arg-list &rest body)
   "This is a macro to define functions which are not defined.
-It is used for Gnus utility functions which were added recently. If FUNCTION
-is not defined then it is defined to have argument list, ARG-LIST and body,
-BODY."
+It is used for Gnus utility functions which were added recently.
+If FUNCTION is not defined then it is defined to have argument
+list, ARG-LIST and body, BODY."
   (let ((defined-p (fboundp function)))
     (unless defined-p
       `(defun ,function ,arg-list ,@body))))
@@ -51,9 +51,9 @@
 
 (defmacro mh-defmacro-compat (function arg-list &rest body)
   "This is a macro to define functions which are not defined.
-It is used for Gnus utility functions which were added recently. If FUNCTION
-is not defined then it is defined to have argument list, ARG-LIST and body,
-BODY."
+It is used for Gnus utility functions which were added recently.
+If FUNCTION is not defined then it is defined to have argument
+list, ARG-LIST and body, BODY."
   (let ((defined-p (fboundp function)))
     (unless defined-p
       `(defmacro ,function ,arg-list ,@body))))
--- a/lisp/mh-e/mh-identity.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/mh-e/mh-identity.el	Thu Dec 29 04:41:02 2005 +0000
@@ -47,14 +47,15 @@
 
 (defvar mh-identity-pgg-default-user-id nil
   "Holds the GPG key ID to be used by pgg.el.
-This is normally set as part of an Identity in `mh-identity-list'.")
+This is normally set as part of an Identity in
+`mh-identity-list'.")
 (make-variable-buffer-local 'mh-identity-pgg-default-user-id)
 
 ;;;###mh-autoload
 (defun mh-identity-make-menu ()
   "Build the Identity menu.
-This should be called any time `mh-identity-list' or `mh-auto-fields-list'
-change."
+This should be called any time `mh-identity-list' or
+`mh-auto-fields-list' change."
   (easy-menu-define mh-identity-menu mh-letter-mode-map
     "MH-E identity menu"
     (append
@@ -87,9 +88,9 @@
 ;;;###mh-autoload
 (defun mh-identity-list-set (symbol value)
   "Update the `mh-identity-list' variable, and rebuild the menu.
-Sets the default for SYMBOL (for example, `mh-identity-list') to VALUE (as set
-in customization). This is called after 'customize is used to alter
-`mh-identity-list'."
+Sets the default for SYMBOL (for example, `mh-identity-list') to
+VALUE (as set in customization). This is called after 'customize
+is used to alter `mh-identity-list'."
   (set-default symbol value)
   (mh-identity-make-menu))
 
@@ -120,10 +121,10 @@
 
 (defun mh-identity-field-handler (field)
   "Return the handler for header FIELD or nil if none set.
-The field name is downcased. If the FIELD begins with the character
-`:', then it must have a special handler defined in
-`mh-identity-handlers', else return an error since it is not a valid
-header field."
+The field name is downcased. If the FIELD begins with the
+character \":\", then it must have a special handler defined in
+`mh-identity-handlers', else return an error since it is not a
+valid header field."
   (or (cdr (mh-assoc-ignore-case field mh-identity-handlers))
       (and (eq (aref field 0) ?:)
            (error "Field %s - unknown mh-identity-handler" field))
@@ -169,8 +170,8 @@
 (defun mh-identity-handler-gpg-identity (field action &optional value)
   "Process header FIELD \":pgg-default-user-id\".
 The ACTION is one of 'remove or 'add. If 'add, the VALUE is added.
-The buffer-local variable `mh-identity-pgg-default-user-id' is set to VALUE
-when action 'add is selected."
+The buffer-local variable `mh-identity-pgg-default-user-id' is set to
+VALUE when action 'add is selected."
   (cond
    ((or (equal action 'remove)
         (not value)
@@ -182,7 +183,8 @@
 ;;;###mh-autoload
 (defun mh-identity-handler-signature (field action &optional value)
   "Process header FIELD \":signature\".
-The ACTION is one of 'remove or 'add. If 'add, the VALUE is added."
+The ACTION is one of 'remove or 'add. If 'add, the VALUE is
+added."
   (cond
    ((equal action 'remove)
     (when (and (markerp mh-identity-signature-start)
@@ -212,7 +214,8 @@
 ;;;###mh-autoload
 (defun mh-identity-handler-attribution-verb (field action &optional value)
   "Process header FIELD \":attribution-verb\".
-The ACTION is one of 'remove or 'add. If 'add, the VALUE is added."
+The ACTION is one of 'remove or 'add. If 'add, the VALUE is
+added."
   (when (and (markerp mh-identity-attribution-verb-start)
              (markerp mh-identity-attribution-verb-end))
     (delete-region mh-identity-attribution-verb-start
@@ -241,9 +244,9 @@
 
 (defun mh-identity-handler-default (field action top &optional value)
   "Process header FIELD.
-The ACTION is one of 'remove or 'add. If TOP is non-nil, add the field and its
-VALUE at the top of the header, else add it at the bottom of the header. If
-action is 'add, the VALUE is added."
+The ACTION is one of 'remove or 'add. If TOP is non-nil, add the
+field and its VALUE at the top of the header, else add it at the
+bottom of the header. If action is 'add, the VALUE is added."
   (let ((field-colon (if (string-match "^.*:$" field)
                          field
                        (concat field ":"))))
@@ -269,15 +272,17 @@
 ;;;###mh-autoload
 (defun mh-identity-handler-top (field action &optional value)
   "Process header FIELD.
-The ACTION is one of 'remove or 'add. If 'add, the VALUE is added.
-If the field wasn't present, it is added to the top of the header."
+The ACTION is one of 'remove or 'add. If 'add, the VALUE is
+added. If the field wasn't present, it is added to the top of the
+header."
   (mh-identity-handler-default field action t value))
 
 ;;;###mh-autoload
 (defun mh-identity-handler-bottom (field action &optional value)
   "Process header FIELD.
-The ACTION is one of 'remove or 'add. If 'add, the VALUE is added.
-If the field wasn't present, it is added to the bottom of the header."
+The ACTION is one of 'remove or 'add. If 'add, the VALUE is
+added. If the field wasn't present, it is added to the bottom of
+the header."
   (mh-identity-handler-default field action nil value))
 
 (provide 'mh-identity)
--- a/lisp/mh-e/mh-inc.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/mh-e/mh-inc.el	Thu Dec 29 04:41:02 2005 +0000
@@ -1,4 +1,4 @@
-;;; mh-inc.el --- MH-E `inc' and separate mail spool handling
+;;; mh-inc.el --- MH-E "inc" and separate mail spool handling
 ;;
 ;; Copyright (C) 2003, 2004 Free Software Foundation, Inc.
 
@@ -28,7 +28,7 @@
 
 ;;  Support for inc. In addition to reading from the system mailbox, inc can
 ;;  also be used to incorporate mail from multiple spool files into separate
-;;  folders. See `C-h v mh-inc-spool-list'.
+;;  folders. See "C-h v mh-inc-spool-list".
 
 ;;; Change Log:
 
--- a/lisp/mh-e/mh-index.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/mh-e/mh-index.el	Thu Dec 29 04:41:02 2005 +0000
@@ -158,9 +158,10 @@
 
 (defun mh-index-execute (cmd &rest args)
   "Partial imitation of xargs.
-The current buffer contains a list of strings, one on each line. The function
-will execute CMD with ARGS and pass the first `mh-index-max-cmdline-args'
-strings to it. This is repeated till all the strings have been used."
+The current buffer contains a list of strings, one on each line.
+The function will execute CMD with ARGS and pass the first
+`mh-index-max-cmdline-args' strings to it. This is repeated till
+all the strings have been used."
   (goto-char (point-min))
   (let ((current-buffer (current-buffer)))
     (with-temp-buffer
@@ -183,12 +184,14 @@
 
 (defun mh-index-update-single-msg (msg checksum origin-map)
   "Update various maps for one message.
-MSG is a index folder message, CHECKSUM its MD5 hash and ORIGIN-MAP, if
-non-nil, a hashtable containing which maps each message in the index folder to
-the folder and message that it was copied from. The function updates the hash
-tables `mh-index-msg-checksum-map' and `mh-index-checksum-origin-map'.
+MSG is a index folder message, CHECKSUM its MD5 hash and
+ORIGIN-MAP, if non-nil, a hashtable containing which maps each
+message in the index folder to the folder and message that it was
+copied from. The function updates the hash tables
+`mh-index-msg-checksum-map' and `mh-index-checksum-origin-map'.
 
-This function should only be called in the appropriate index folder buffer."
+This function should only be called in the appropriate index
+folder buffer."
   (cond ((and origin-map (gethash checksum mh-index-checksum-origin-map))
          (let* ((intermediate (gethash msg origin-map))
                 (ofolder (car intermediate))
@@ -208,10 +211,11 @@
 ;;;###mh-autoload
 (defun mh-index-update-maps (folder &optional origin-map)
   "Annotate all as yet unannotated messages in FOLDER with their MD5 hash.
-As a side effect msg -> checksum map is updated. Optional argument ORIGIN-MAP
-is a hashtable which maps each message in the index folder to the original
-folder and message from whence it was copied. If present the
-checksum -> (origin-folder, origin-index) map is updated too."
+As a side effect msg -> checksum map is updated. Optional
+argument ORIGIN-MAP is a hashtable which maps each message in the
+index folder to the original folder and message from whence it
+was copied. If present the checksum -> (origin-folder,
+origin-index) map is updated too."
   (clrhash mh-index-msg-checksum-map)
   (save-excursion
     ;; Clear temp buffer
@@ -266,8 +270,9 @@
 
 (defun mh-unpropagated-sequences ()
   "Return a list of sequences that aren't propagated to the source folders.
-It is just the sequences in the variable `mh-unpropagated-sequences' in
-addition to the Previous-Sequence (see mh-profile 5)."
+It is just the sequences in the variable
+`mh-unpropagated-sequences' in addition to the
+Previous-Sequence (see mh-profile 5)."
   (if mh-previous-seq
       (cons mh-previous-seq mh-unpropagated-sequences)
     mh-unpropagated-sequences))
@@ -275,8 +280,8 @@
 ;;;###mh-autoload
 (defun mh-create-sequence-map (seq-list)
   "Return a map from msg number to list of sequences in which it is present.
-SEQ-LIST is an assoc list whose keys are sequence names and whose cdr is the
-list of messages in that sequence."
+SEQ-LIST is an assoc list whose keys are sequence names and whose
+cdr is the list of messages in that sequence."
   (loop with map = (make-hash-table)
         for seq in seq-list
         when (and (not (memq (car seq) (mh-unpropagated-sequences)))
@@ -316,10 +321,11 @@
 
 (defun mh-index-generate-pretty-name (string)
   "Given STRING generate a name which is suitable for use as a folder name.
-White space from the beginning and end are removed. All spaces in the name are
-replaced with underscores and all / are replaced with $. If STRING is longer
-than 20 it is truncated too. STRING could be a list of strings in which case
-they are concatenated to construct the base name."
+White space from the beginning and end are removed. All spaces in
+the name are replaced with underscores and all / are replaced
+with $. If STRING is longer than 20 it is truncated too. STRING
+could be a list of strings in which case they are concatenated to
+construct the base name."
   (with-temp-buffer
     (if (stringp string)
         (insert string)
@@ -352,60 +358,66 @@
 (defun* mh-index-search (redo-search-flag folder search-regexp
                         &optional window-config)
   "Perform an indexed search in an MH mail folder.
+
 Use a prefix argument to repeat the search.
 
-Unlike regular searches, the prompt for the folder to search can be `all' to
-search all folders; in addition, the search works recursively on the listed
-folder. The search criteria are entered in an MH-Pick buffer as described in
-`mh-search-folder'.
+Unlike regular searches, the prompt for the folder to search can be
+\"all\" to search all folders; in addition, the search works recursively
+on the listed folder. The search criteria are entered in an MH-Pick
+buffer as described in `mh-search-folder'.
 
-To perform the search, type \\<mh-pick-mode-map>\\[mh-do-search]. Another
-difference from the regular searches is that because the search operates on
-more than one folder, the messages that are found are put in a temporary
-sub-folder of `+mhe-index' and are displayed in an MH-Folder buffer. This
-buffer is special because it displays messages from multiple folders; each set
-of messages from a given folder has a heading with the folder name.
+To perform the search, type \\<mh-pick-mode-map>\\[mh-do-search].
+Another difference from the regular searches is that because the
+search operates on more than one folder, the messages that are found
+are put in a temporary sub-folder of \"+mhe-index\" and are displayed in
+an MH-Folder buffer. This buffer is special because it displays
+messages from multiple folders; each set of messages from a given
+folder has a heading with the folder name.
 
-In addition, the \\<mh-folder-mode-map>\\[mh-index-visit-folder] command can
-be used to visit the folder of the message at point. Initially, only the
-messages that matched the search criteria are displayed in the folder. While
-the temporary buffer has its own set of message numbers, the actual messages
-numbers are shown in the visited folder. Thus, the \\[mh-index-visit-folder]
-command is useful to find the actual message number of an interesting message,
-or to view surrounding messages with the \\[mh-rescan-folder] command.
+In addition, the \\<mh-folder-mode-map>\\[mh-index-visit-folder]
+command can be used to visit the folder of the message at point.
+Initially, only the messages that matched the search criteria are
+displayed in the folder. While the temporary buffer has its own set of
+message numbers, the actual messages numbers are shown in the visited
+folder. Thus, the \\[mh-index-visit-folder] command is useful to find
+the actual message number of an interesting message, or to view
+surrounding messages with the \\[mh-rescan-folder] command.
 
-Because this folder is temporary, you'll probably get in the habit of killing
-it when you're done with \\[mh-kill-folder].
+Because this folder is temporary, you'll probably get in the habit of
+killing it when you're done with \\[mh-kill-folder].
 
-If you have run the \\[mh-search-folder] command, but change your mind while
-entering the search criteria and actually want to run an indexed search, then
-you can use the \\<mh-pick-mode-map>\\[mh-index-do-search] command in the
-MH-Pick buffer.
+If you have run the \\[mh-search-folder] command, but change your mind
+while entering the search criteria and actually want to run an indexed
+search, then you can use the
+\\<mh-pick-mode-map>\\[mh-index-do-search] command in the MH-Pick
+buffer.
 
-The \\<mh-folder-mode-map>\\[mh-index-search] command runs the command defined
-by the `mh-index-program' option. The default value is \"Auto-detect\" which
-means that MH-E will automatically choose one of \"swish++\", \"swish-e\",
-\"mairix\", \"namazu\", \"pick\" and \"grep\" in that order. If, for example,
-you have both \"swish++\" and \"mairix\" installed and you want to use
-\"mairix\", then you can set this option to \"mairix\".
+The \\<mh-folder-mode-map>\\[mh-index-search] command runs the command
+defined by the `mh-index-program' option. The default value is
+\"Auto-detect\" which means that MH-E will automatically choose one of
+\"swish++\", \"swish-e\", \"mairix\", \"namazu\", \"pick\" and
+\"grep\" in that order. If, for example, you have both \"swish++\" and
+\"mairix\" installed and you want to use \"mairix\", then you can set
+this option to \"mairix\".
 
                                 *NOTE*
 
-     The \"pick\" and \"grep\" commands do not perform a recursive search on
-     the given folder.
+     The \"pick\" and \"grep\" commands do not perform a
+     recursive search on the given folder.
 
-This command uses an \"X-MHE-Checksum:\" header field to cache the MD5
-checksum of a message. This means that if an incoming message already contains
-an \"X-MHE-Checksum:\" field, that message might not be found by this command.
-The following \"procmail\" recipe avoids this problem by renaming the existing
+This command uses an \"X-MHE-Checksum:\" header field to cache
+the MD5 checksum of a message. This means that if an incoming
+message already contains an \"X-MHE-Checksum:\" field, that
+message might not be found by this command. The following
+\"procmail\" recipe avoids this problem by renaming the existing
 header field:
 
      :0 wf
      | formail -R \"X-MHE-Checksum\" \"X-Old-MHE-Checksum\"
 
-The documentation for the following commands describe how to set up the
-various indexing programs to use with MH-E. The \"pick\" and \"grep\" commands
-do not require additional configuration.
+The documentation for the following commands describe how to set
+up the various indexing programs to use with MH-E. The \"pick\"
+and \"grep\" commands do not require additional configuration.
 
     - `mh-swish++-execute-search'
     - `mh-swish-execute-search'
@@ -414,12 +426,14 @@
     - `mh-pick-execute-search'
     - `mh-grep-execute-search'
 
-In a program, if REDO-SEARCH-FLAG is non-nil and the current folder buffer was
-generated by a index search, then the search is repeated. Otherwise, FOLDER is
-searched with SEARCH-REGEXP and the results are presented in an MH-E folder.
-If FOLDER is \"+\" then mail in all folders are searched. Optional argument
-WINDOW-CONFIG stores the window configuration that will be restored after the
-user quits the folder containing the index search results."
+In a program, if REDO-SEARCH-FLAG is non-nil and the current
+folder buffer was generated by a index search, then the search is
+repeated. Otherwise, FOLDER is searched with SEARCH-REGEXP and
+the results are presented in an MH-E folder. If FOLDER is \"+\"
+then mail in all folders are searched. Optional argument
+WINDOW-CONFIG stores the window configuration that will be
+restored after the user quits the folder containing the index
+search results."
   (interactive
    (list current-prefix-arg
          (progn
@@ -540,7 +554,7 @@
   "Write index data to file."
   (ignore-errors
     (unless (eq major-mode 'mh-folder-mode)
-      (error "Can't be called from folder in `%s'" major-mode))
+      (error "Can't be called from folder in \"%s\"" major-mode))
     (let ((data mh-index-data)
           (msg-checksum-map mh-index-msg-checksum-map)
           (checksum-origin-map mh-index-checksum-origin-map)
@@ -562,7 +576,7 @@
   "Read index data from file."
   (ignore-errors
     (unless (eq major-mode 'mh-folder-mode)
-      (error "Can't be called from folder in `%s'" major-mode))
+      (error "Can't be called from folder in \"%s\"" major-mode))
     (let ((infile (concat buffer-file-name mh-index-data-file))
           t1 t2 t3 t4 t5)
       (with-temp-buffer
@@ -585,7 +599,8 @@
 
 (defun mh-index-write-hashtable (table proc)
   "Write TABLE to `current-buffer'.
-PROC is used to serialize the values corresponding to the hash table keys."
+PROC is used to serialize the values corresponding to the hash
+table keys."
   (pp (loop for x being the hash-keys of table
             collect (cons x (funcall proc (gethash x table))))
       (current-buffer))
@@ -619,8 +634,9 @@
 ;;;###mh-autoload
 (defun mh-index-parse-search-regexp (input-string)
   "Construct parse tree for INPUT-STRING.
-All occurrences of &, |, ! and ~ in INPUT-STRING are replaced by AND, OR and
-NOT as appropriate. Then the resulting string is parsed."
+All occurrences of &, |, ! and ~ in INPUT-STRING are replaced by
+AND, OR and NOT as appropriate. Then the resulting string is
+parsed."
   (let (input)
     (with-temp-buffer
       (insert input-string)
@@ -720,9 +736,10 @@
 ;;;###mh-autoload
 (defun mh-index-next-folder (&optional backward-flag)
   "Jump to the next folder marker.
-The function is only applicable to folders displaying index search results.
-With non-nil optional argument BACKWARD-FLAG, jump to the previous group of
-results."
+The function is only applicable to folders displaying index search
+results.
+With non-nil optional argument BACKWARD-FLAG, jump to the previous
+group of results."
   (interactive "P")
   (if (null mh-index-data)
       (message "Only applicable in an MH-E index search buffer")
@@ -764,12 +781,12 @@
 (defun mh-index-new-folder (name search-regexp)
   "Return a folder name based on NAME for search results of SEARCH-REGEXP.
 
-If folder NAME already exists and was generated for the same SEARCH-REGEXP
-then it is reused.
+If folder NAME already exists and was generated for the same
+SEARCH-REGEXP then it is reused.
 
-Otherwise if the folder NAME was generated from a different search then check
-if NAME<2> can be used. Otherwise try NAME<3>. This is repeated till we find a
-new folder name.
+Otherwise if the folder NAME was generated from a different
+search then check if NAME<2> can be used. Otherwise try NAME<3>.
+This is repeated till we find a new folder name.
 
 If the folder returned doesn't exist then it is created."
   (unless (mh-folder-name-p name)
@@ -794,7 +811,8 @@
 
 (defun mh-index-folder-search-regexp (folder)
   "If FOLDER was created by a index search, return the search regexp.
-Return nil if FOLDER doesn't exist or the .mhe_index file is garbled."
+Return nil if FOLDER doesn't exist or the .mhe_index file is
+garbled."
   (ignore-errors
     (with-temp-buffer
       (insert-file-contents
@@ -844,8 +862,8 @@
 ;;;###mh-autoload
 (defun mh-index-group-by-folder ()
   "Partition the messages based on source folder.
-Returns an alist with the the folder names in the car and the cdr being the
-list of messages originally from that folder."
+Returns an alist with the the folder names in the car and the cdr
+being the list of messages originally from that folder."
   (save-excursion
     (goto-char (point-min))
     (let ((result-table (make-hash-table :test #'equal)))
@@ -909,9 +927,9 @@
 
 (defun mh-index-matching-source-msgs (msgs &optional delete-from-index-data)
   "Return a table of original messages and folders for messages in MSGS.
-If optional argument DELETE-FROM-INDEX-DATA is non-nil, then each of the
-messages, whose counter-part is found in some source folder, is removed from
-`mh-index-data'."
+If optional argument DELETE-FROM-INDEX-DATA is non-nil, then each
+of the messages, whose counter-part is found in some source
+folder, is removed from `mh-index-data'."
   (let ((table (make-hash-table :test #'equal)))
     (dolist (msg msgs)
       (let* ((checksum (gethash msg mh-index-msg-checksum-map))
@@ -926,9 +944,10 @@
 ;;;###mh-autoload
 (defun mh-index-execute-commands ()
   "Delete/refile the actual messages.
-The copies in the searched folder are then deleted/refiled to get the desired
-result. Before deleting the messages we make sure that the message being
-deleted is identical to the one that the user has marked in the index buffer."
+The copies in the searched folder are then deleted/refiled to get
+the desired result. Before deleting the messages we make sure
+that the message being deleted is identical to the one that the
+user has marked in the index buffer."
   (save-excursion
     (let ((folders ())
           (mh-speed-flists-inhibit-flag t))
@@ -967,8 +986,8 @@
 ;;;###mh-autoload
 (defun mh-index-add-to-sequence (seq msgs)
   "Add to SEQ the messages in the list MSGS.
-This function updates the source folder sequences. Also makes an attempt to
-update the source folder buffer if we have it open."
+This function updates the source folder sequences. Also makes an
+attempt to update the source folder buffer if we have it open."
   ;; Don't need to do anything for cur
   (save-excursion
     (when (and (not (memq seq (mh-unpropagated-sequences)))
@@ -993,8 +1012,8 @@
 ;;;###mh-autoload
 (defun mh-index-delete-from-sequence (seq msgs)
   "Delete from SEQ the messages in MSGS.
-This function updates the source folder sequences. Also makes an attempt to
-update the source folder buffer if present."
+This function updates the source folder sequences. Also makes an
+attempt to update the source folder buffer if present."
   (save-excursion
     (when (and (not (memq seq (mh-unpropagated-sequences)))
                (mh-valid-seq-p seq))
@@ -1025,12 +1044,12 @@
 (defun mh-pick-execute-search (folder-path search-regexp)
   "Execute pick.
 
-Unlike the other index search programs \"pick\" only searches messages present
-in the folder itself and does not descend into any sub-folders that may be
-present.
+Unlike the other index search programs \"pick\" only searches
+messages present in the folder itself and does not descend into
+any sub-folders that may be present.
 
-In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP is used
-to search."
+In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP
+is used to search."
   (set-buffer (get-buffer-create mh-index-temp-buffer))
   (erase-buffer)
   (setq mh-index-pick-folder
@@ -1061,12 +1080,12 @@
 (defun mh-grep-execute-search (folder-path search-regexp)
   "Execute grep and read the results.
 
-Unlike the other index search programs \"grep\" only searches messages present
-in the folder itself and does not descend into any sub-folders that may be
-present.
+Unlike the other index search programs \"grep\" only searches
+messages present in the folder itself and does not descend into
+any sub-folders that may be present.
 
-In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP is used
-to search."
+In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP
+is used to search."
   (set-buffer (get-buffer-create mh-index-temp-buffer))
   (erase-buffer)
   (call-process mh-grep-binary nil '(t nil) nil
@@ -1075,9 +1094,9 @@
 
 (defun mh-grep-next-result ()
   "Read the next result.
-Parse it and return the message folder, message index and the match. If no
-other matches left then return nil. If the current record is invalid return
-'error."
+Parse it and return the message folder, message index and the
+match. If no other matches left then return nil. If the current
+record is invalid return 'error."
   (prog1
       (block nil
         (when (eobp)
@@ -1118,11 +1137,12 @@
 (defun mh-mairix-execute-search (folder-path search-regexp-list)
   "Execute mairix and read the results.
 
-In the examples below, replace \"/home/user/Mail\" with the path to your MH
-directory.
+In the examples below, replace \"/home/user/Mail\" with the path
+to your MH directory.
 
-First create the directory \"/home/user/Mail/.mairix\". Then create the file
-\"/home/user/Mail/.mairix/config\" with the following contents:
+First create the directory \"/home/user/Mail/.mairix\". Then
+create the file \"/home/user/Mail/.mairix/config\" with the
+following contents:
 
      base=/home/user/Mail
 
@@ -1133,13 +1153,13 @@
      vfolder_format=raw
      database=/home/user/Mail/mairix/database
 
-Use the following command line to generate the mairix index. Run this daily
-from cron:
+Use the following command line to generate the mairix index. Run
+this daily from cron:
 
      mairix -f /home/user/Mail/.mairix/config
 
-In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP-LIST is used
-to search."
+In a program, FOLDER-PATH is the directory in which
+SEARCH-REGEXP-LIST is used to search."
   (set-buffer (get-buffer-create mh-index-temp-buffer))
   (erase-buffer)
   (unless mh-mairix-binary
@@ -1258,9 +1278,10 @@
 
 (defun mh-flists-execute (&rest args)
   "Execute flists.
-Search for messages belonging to `mh-flists-sequence' in the folders
-specified by `mh-flists-search-folders'. If `mh-recursive-folders-flag' is t,
-then the folders are searched recursively. All parameters ARGS are ignored."
+Search for messages belonging to `mh-flists-sequence' in the
+folders specified by `mh-flists-search-folders'. If
+`mh-recursive-folders-flag' is t, then the folders are searched
+recursively. All parameters ARGS are ignored."
   (set-buffer (get-buffer-create mh-index-temp-buffer))
   (erase-buffer)
   (unless (executable-find "sh")
@@ -1286,8 +1307,9 @@
 (defun mh-index-sequenced-messages (folders sequence)
   "Display messages from FOLDERS in SEQUENCE.
 All messages in the sequence you provide from the folders in
-`mh-new-messages-folders' are listed. With a prefix argument, enter a
-space-separated list of folders, or nothing to search all folders."
+`mh-new-messages-folders' are listed. With a prefix argument,
+enter a space-separated list of folders, or nothing to search all
+folders."
   (interactive
    (list (if current-prefix-arg
              (split-string (read-string "Search folder(s) (default all): "))
@@ -1330,13 +1352,14 @@
 (defun mh-index-new-messages (folders)
   "Display unseen messages.
 
-If you use a program such as `procmail' to use `rcvstore' to file your
-incoming mail automatically, you can display new, unseen, messages using this
-command. All messages in the `unseen' sequence from the folders in
-`mh-new-messages-folders' are listed.
+If you use a program such as \"procmail\" to use \"rcvstore\" to file
+your incoming mail automatically, you can display new, unseen,
+messages using this command. All messages in the \"unseen\"
+sequence from the folders in `mh-new-messages-folders' are
+listed.
 
-With a prefix argument, enter a space-separated list of FOLDERS, or nothing to
-search all folders."
+With a prefix argument, enter a space-separated list of FOLDERS,
+or nothing to search all folders."
   (interactive
    (list (if current-prefix-arg
              (split-string (read-string "Search folder(s) (default all): "))
@@ -1347,11 +1370,11 @@
 (defun mh-index-ticked-messages (folders)
   "Display ticked messages.
 
-All messages in `mh-tick-seq' from the folders in `mh-ticked-messages-folders'
-are listed.
+All messages in `mh-tick-seq' from the folders in
+`mh-ticked-messages-folders' are listed.
 
-With a prefix argument, enter a space-separated list of FOLDERS, or nothing to
-search all folders."
+With a prefix argument, enter a space-separated list of FOLDERS,
+or nothing to search all folders."
   (interactive
    (list (if current-prefix-arg
              (split-string (read-string "Search folder(s) (default all): "))
@@ -1370,11 +1393,12 @@
 (defun mh-swish-execute-search (folder-path search-regexp)
   "Execute swish-e and read the results.
 
-In the examples below, replace \"/home/user/Mail\" with the path to your
-MH directory.
+In the examples below, replace \"/home/user/Mail\" with the path
+to your MH directory.
 
-First create the directory \"/home/user/Mail/.swish\". Then create the file
-\"/home/user/Mail/.swish/config\" with the following contents:
+First create the directory \"/home/user/Mail/.swish\". Then
+create the file \"/home/user/Mail/.swish/config\" with the
+following contents:
 
      DefaultContents TXT*
      IndexDir /home/user/Mail
@@ -1397,22 +1421,22 @@
      FileRules pathname contains /home/user/Mail/.swish
      FileRules pathname contains /home/user/Mail/mhe-index
 
-This configuration does not index the folders that hold the results of your
-searches in \"+mhe-index\" since they tend to be ephemeral and the original
-messages are indexed anyway.
+This configuration does not index the folders that hold the
+results of your searches in \"+mhe-index\" since they tend to be
+ephemeral and the original messages are indexed anyway.
 
-If there are any directories you would like to ignore, append lines like the
-following to \"config\":
+If there are any directories you would like to ignore, append
+lines like the following to \"config\":
 
      FileRules pathname contains /home/user/Mail/scripts
 
-Use the following command line to generate the swish index. Run this daily
-from cron:
+Use the following command line to generate the swish index. Run
+this daily from cron:
 
          swish-e -c /home/user/Mail/.swish/config
 
-In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP is used to
-search."
+In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP
+is used to search."
   (set-buffer (get-buffer-create mh-index-temp-buffer))
   (erase-buffer)
   (unless mh-swish-binary
@@ -1472,11 +1496,12 @@
 (defun mh-swish++-execute-search (folder-path search-regexp)
   "Execute swish++ and read the results.
 
-In the examples below, replace \"/home/user/Mail\" with the path to your MH
-directory.
+In the examples below, replace \"/home/user/Mail\" with the path to
+your MH directory.
 
-First create the directory \"/home/user/Mail/.swish++\". Then create the file
-\"/home/user/Mail/.swish++/swish++.conf\" with the following contents:
+First create the directory \"/home/user/Mail/.swish++\". Then create
+the file \"/home/user/Mail/.swish++/swish++.conf\" with the following
+contents:
 
      IncludeMeta         Bcc Cc Comments Content-Description From Keywords
      IncludeMeta         Newsgroups Resent-To Subject To
@@ -1484,23 +1509,23 @@
      IncludeFile         Mail    *
      IndexFile           /home/user/Mail/.swish++/swish++.index
 
-Use the following command line to generate the swish index. Run this daily
-from cron:
+Use the following command line to generate the swish index. Run
+this daily from cron:
 
      find /home/user/Mail -path /home/user/Mail/mhe-index -prune \\
                           -o -path /home/user/Mail/.swish++ -prune \\
                           -o -name \"[0-9]*\" -print \\
          | index -c /home/user/Mail/.swish++/swish++.conf -
 
-This command does not index the folders that hold the results of your searches
-in \"+mhe-index\" since they tend to be ephemeral and the original messages
-are indexed anyway.
+This command does not index the folders that hold the results of your
+searches in \"+mhe-index\" since they tend to be ephemeral and the
+original messages are indexed anyway.
 
-On some systems (Debian GNU/Linux, for example), use \"index++\" instead of
-\"index\".
+On some systems (Debian GNU/Linux, for example), use \"index++\"
+instead of \"index\".
 
-In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP is used to
-search."
+In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP is
+used to search."
   (set-buffer (get-buffer-create mh-index-temp-buffer))
   (erase-buffer)
   (unless mh-swish++-binary
@@ -1554,29 +1579,30 @@
 (defun mh-namazu-execute-search (folder-path search-regexp)
   "Execute namazu and read the results.
 
-In the examples below, replace \"/home/user/Mail\" with the path to your MH
-directory.
+In the examples below, replace \"/home/user/Mail\" with the path to
+your MH directory.
 
-First create the directory \"/home/user/Mail/.namazu\". Then create the file
-\"/home/user/Mail/.namazu/mknmzrc\" with the following contents:
+First create the directory \"/home/user/Mail/.namazu\". Then create
+the file \"/home/user/Mail/.namazu/mknmzrc\" with the following
+contents:
 
      package conf;  # Don't remove this line!
      $ADDRESS = 'user@localhost';
      $ALLOW_FILE = \"[0-9]*\";
      $EXCLUDE_PATH = \"^/home/user/Mail/(mhe-index|spam)\";
 
-This configuration does not index the folders that hold the results of your
-searches in \"+mhe-index\" since they tend to be ephemeral and the original
-messages are indexed anyway.
+This configuration does not index the folders that hold the results of
+your searches in \"+mhe-index\" since they tend to be ephemeral and
+the original messages are indexed anyway.
 
-Use the following command line to generate the namazu index. Run this daily
-from cron:
+Use the following command line to generate the namazu index. Run this
+daily from cron:
 
      mknmz -f /home/user/Mail/.namazu/mknmzrc -O /home/user/Mail/.namazu \\
               /home/user/Mail
 
-In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP is used to
-search."
+In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP
+is used to search."
   (let ((namazu-index-directory
          (format "%s%s" mh-user-path mh-namazu-directory)))
     (unless (file-exists-p namazu-index-directory)
@@ -1623,10 +1649,10 @@
 ;;;###mh-autoload
 (defun mh-index-choose ()
   "Choose an indexing function.
-The side-effects of this function are that the variables `mh-indexer',
-`mh-index-execute-search-function', and `mh-index-next-result-function' are
-set according to the first indexer in `mh-indexer-choices' present on the
-system."
+The side-effects of this function are that the variables
+`mh-indexer', `mh-index-execute-search-function', and
+`mh-index-next-result-function' are set according to the first
+indexer in `mh-indexer-choices' present on the system."
   (block nil
     ;; The following favors the user's preference; otherwise, the last
     ;; automatically chosen indexer is used for efficiency rather than going
--- a/lisp/mh-e/mh-init.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/mh-e/mh-init.el	Thu Dec 29 04:41:02 2005 +0000
@@ -64,7 +64,7 @@
 This directory contains, among other things, the mhl program.")
 
 (defvar mh-flists-present-flag nil
-  "Non-nil means that we have `flists'.")
+  "Non-nil means that we have \"flists\".")
 
 ;;;###autoload
 (put 'mh-progs 'risky-local-variable t)
@@ -81,8 +81,8 @@
 (defun mh-variants ()
   "Return a list of installed variants of MH on the system.
 This function looks for MH in `mh-sys-path', `mh-path' and
-`exec-path'. The format of the list of variants that is returned is described
-by the variable `mh-variants'."
+`exec-path'. The format of the list of variants that is returned
+is described by the variable `mh-variants'."
   (if mh-variants
       mh-variants
     (let ((list-unique))
@@ -100,14 +100,16 @@
 
 (defvar mh-variant-in-use nil
   "The MH variant currently in use; a string with variant and version number.
-This differs from `mh-variant' when the latter is set to `autodetect'.")
+This differs from `mh-variant' when the latter is set to
+\"autodetect\".")
 
 ;;;###mh-autoload
 (defun mh-variant-set (variant)
   "Set the MH variant to VARIANT.
-Sets `mh-progs', `mh-lib', `mh-lib-progs' and `mh-flists-present-flag'.
-If the VARIANT is `autodetect', then first try nmh, then MH and finally
-GNU mailutils."
+Sets `mh-progs', `mh-lib', `mh-lib-progs' and
+`mh-flists-present-flag'.
+If the VARIANT is \"autodetect\", then first try nmh, then MH and
+finally GNU mailutils."
   (interactive
    (list (completing-read
           "MH Variant: "
@@ -138,7 +140,8 @@
 (defun mh-variant-set-variant (variant)
   "Setup the system variables for the MH variant named VARIANT.
 If VARIANT is a string, use that key in the variable `mh-variants'.
-If VARIANT is a symbol, select the first entry that matches that variant."
+If VARIANT is a symbol, select the first entry that matches that
+variant."
   (cond
    ((stringp variant)                   ;e.g. "nmh 1.1-RC1"
     (when (assoc variant mh-variants)
@@ -193,13 +196,13 @@
     "/usr/bin/mu-mh/")                  ; GNU mailutils - packaged
   "List of directories to search for variants of the MH variant.
 The list `exec-path' is searched in addition to this list.
-There's no need for users to modify this list.  Instead add extra
+There's no need for users to modify this list. Instead add extra
 directories to the customizable variable `mh-path'.")
 
 (defun mh-variant-mh-info (dir)
   "Return info for MH variant in DIR assuming a temporary buffer is setup."
   ;; MH does not have the -version option.
-  ;; Its version number is included in the output of `-help' as:
+  ;; Its version number is included in the output of "-help" as:
   ;;
   ;; version: MH 6.8.4 #2[UCI] (burrito) of Fri Jan 15 20:01:39 EST 1999
   ;; options: [ATHENA] [BIND] [DUMB] [LIBLOCKFILE] [LOCALE] [MAILGROUP] [MHE]
@@ -302,10 +305,11 @@
 ;;;###mh-autoload
 (defun mh-image-load-path ()
   "Ensure that the MH-E images are accessible by `find-image'.
-Images for MH-E are found in ../../etc/images relative to the files in
-`lisp/mh-e'. If `image-load-path' exists (since Emacs 22), then the images
-directory is added to it if isn't already there. Otherwise, the images
-directory is added to the `load-path' if it isn't already there."
+Images for MH-E are found in ../../etc/images relative to the
+files in \"lisp/mh-e\". If `image-load-path' exists (since Emacs
+22), then the images directory is added to it if isn't already
+there. Otherwise, the images directory is added to the
+`load-path' if it isn't already there."
   (unless mh-image-load-path-called-flag
     (let (mh-library-name mh-image-load-path)
       ;; First, find mh-e in the load-path.
@@ -332,10 +336,11 @@
   "Convert SPEC for defface if necessary to run on older platforms.
 See `defface' for the spec definition.
 
-When `mh-min-colors-defined-flag' is nil, this function finds a display with a
-single \"class\" requirement with a \"color\" item, renames the requirement to
-\"tty\" and moves it to the beginning of the list. It then strips any
-\"min-colors\" requirements."
+When `mh-min-colors-defined-flag' is nil, this function finds a
+display with a single \"class\" requirement with a \"color\"
+item, renames the requirement to \"tty\" and moves it to the
+beginning of the list. It then strips any \"min-colors\"
+requirements."
   (when (not mh-min-colors-defined-flag)
     ;; Insert ((class tty)) display with ((class color)) attributes.
     (let ((attributes (cdr (assoc '((class color)) spec))))
--- a/lisp/mh-e/mh-junk.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/mh-e/mh-junk.el	Thu Dec 29 04:41:02 2005 +0000
@@ -41,14 +41,15 @@
 (defun mh-junk-blacklist (range)
   "Blacklist RANGE as spam.
 
-This command trains the spam program in use (see the option `mh-junk-program')
-with the content of RANGE and then handles the message(s) as specified by the
-option `mh-junk-disposition'.
+This command trains the spam program in use (see the option
+`mh-junk-program') with the content of RANGE and then handles the
+message(s) as specified by the option `mh-junk-disposition'.
 
-Check the documentation of `mh-interactive-range' to see how RANGE is read in
-interactive use.
+Check the documentation of `mh-interactive-range' to see how RANGE is
+read in interactive use.
 
-For more information about using your particular spam fighting program, see:
+For more information about using your particular spam fighting
+program, see:
 
   - `mh-spamassassin-blacklist'
   - `mh-bogofilter-blacklist'
@@ -80,12 +81,12 @@
 (defun mh-junk-whitelist (range)
   "Whitelist RANGE as ham.
 
-This command reclassifies the RANGE as ham if it were incorrectly classified
-as spam (see the option `mh-junk-program'). It then refiles the message into
-the \"+inbox\" folder.
+This command reclassifies the RANGE as ham if it were incorrectly
+classified as spam (see the option `mh-junk-program'). It then
+refiles the message into the \"+inbox\" folder.
 
-Check the documentation of `mh-interactive-range' to see how RANGE is read in
-interactive use."
+Check the documentation of `mh-interactive-range' to see how
+RANGE is read in interactive use."
   (interactive (list (mh-interactive-range "Whitelist")))
   (let ((whitelist-func (nth 2 (assoc mh-junk-choice mh-junk-function-alist))))
     (unless whitelist-func
@@ -107,10 +108,10 @@
 (defun mh-spamassassin-blacklist (msg)
   "Blacklist MSG with SpamAssassin.
 
-SpamAssassin is one of the more popular spam filtering programs. Get it from
-your local distribution or from http://spamassassin.org/.
+SpamAssassin is one of the more popular spam filtering programs. Get
+it from your local distribution or from http://spamassassin.org/.
 
-To use SpamAssassin, add the following recipes to `.procmailrc':
+To use SpamAssassin, add the following recipes to \".procmailrc\":
 
     MAILDIR=$HOME/`mhparam Path`
 
@@ -127,54 +128,58 @@
     * ^X-Spam-Status: Yes
     spam/.
 
-If you don't use `spamc', use `spamassassin -P -a'.
+If you don't use \"spamc\", use \"spamassassin -P -a\".
 
-Note that one of the recipes above throws away messages with a score greater
-than or equal to 10. Here's how you can determine a value that works best for
-you.
+Note that one of the recipes above throws away messages with a score
+greater than or equal to 10. Here's how you can determine a value that
+works best for you.
 
-First, run `spamassassin -t' on every mail message in your archive and use
-Gnumeric to verify that the average plus the standard deviation of good mail
-is under 5, the SpamAssassin default for \"spam\".
+First, run \"spamassassin -t\" on every mail message in your archive and
+use Gnumeric to verify that the average plus the standard deviation of
+good mail is under 5, the SpamAssassin default for \"spam\".
 
-Using Gnumeric, sort the messages by score and view the messages with the
-highest score. Determine the score which encompasses all of your interesting
-messages and add a couple of points to be conservative. Add that many dots to
-the `X-Spam-Level:' header field above to send messages with that score down
-the drain.
+Using Gnumeric, sort the messages by score and view the messages with
+the highest score. Determine the score which encompasses all of your
+interesting messages and add a couple of points to be conservative.
+Add that many dots to the \"X-Spam-Level:\" header field above to send
+messages with that score down the drain.
 
-In the example above, messages with a score of 5-9 are set aside in the
-`+spam' folder for later review. The major weakness of rules-based filters is
-a plethora of false positives so it is worthwhile to check.
+In the example above, messages with a score of 5-9 are set aside in
+the \"+spam\" folder for later review. The major weakness of rules-based
+filters is a plethora of false positives so it is worthwhile to check.
 
-If SpamAssassin classifies a message incorrectly, or is unsure, you can use
-the MH-E commands \\[mh-junk-blacklist] and \\[mh-junk-whitelist].
+If SpamAssassin classifies a message incorrectly, or is unsure, you
+can use the MH-E commands \\[mh-junk-blacklist] and
+\\[mh-junk-whitelist].
 
-The \\[mh-junk-blacklist] command adds a `blacklist_from' entry to
-`~/spamassassin/user_prefs', deletes the message, and sends the message to the
-Razor, so that others might not see this spam. If the `sa-learn' command is
-available, the message is also recategorized as spam.
+The \\[mh-junk-blacklist] command adds a \"blacklist_from\" entry to
+\"~/spamassassin/user_prefs\", deletes the message, and sends the
+message to the Razor, so that others might not see this spam. If the
+\"sa-learn\" command is available, the message is also recategorized as
+spam.
 
-The \\[mh-junk-whitelist] command adds a `whitelist_from' rule to the
-`~/.spamassassin/user_prefs' file. If the `sa-learn' command is available, the
-message is also recategorized as ham.
+The \\[mh-junk-whitelist] command adds a \"whitelist_from\" rule to the
+\"~/.spamassassin/user_prefs\" file. If the \"sa-learn\" command is
+available, the message is also recategorized as ham.
 
-Over time, you'll observe that the same host or domain occurs repeatedly in
-the `blacklist_from' entries, so you might think that you could avoid future
-spam by blacklisting all mail from a particular domain. The utility function
-`mh-spamassassin-identify-spammers' helps you do precisely that. This function
-displays a frequency count of the hosts and domains in the `blacklist_from'
-entries from the last blank line in `~/.spamassassin/user_prefs' to the end of
-the file. This information can be used so that you can replace multiple
-`blacklist_from' entries with a single wildcard entry such as:
+Over time, you'll observe that the same host or domain occurs
+repeatedly in the \"blacklist_from\" entries, so you might think that
+you could avoid future spam by blacklisting all mail from a particular
+domain. The utility function `mh-spamassassin-identify-spammers' helps
+you do precisely that. This function displays a frequency count of the
+hosts and domains in the \"blacklist_from\" entries from the last blank
+line in \"~/.spamassassin/user_prefs\" to the end of the file. This
+information can be used so that you can replace multiple
+\"blacklist_from\" entries with a single wildcard entry such as:
 
     blacklist_from *@*amazingoffersdirect2u.com
 
-In versions of SpamAssassin (2.50 and on) that support a Bayesian classifier,
-\\[mh-junk-blacklist] uses the `sa-learn' program to recategorize the message
-as spam. Neither MH-E, nor SpamAssassin, rebuilds the database after adding
-words, so you will need to run `sa-learn --rebuild' periodically. This can be
-done by adding the following to your crontab:
+In versions of SpamAssassin (2.50 and on) that support a Bayesian
+classifier, \\[mh-junk-blacklist] uses the \"sa-learn\" program to
+recategorize the message as spam. Neither MH-E, nor SpamAssassin,
+rebuilds the database after adding words, so you will need to run
+\"sa-learn --rebuild\" periodically. This can be done by adding the
+following to your crontab:
 
     0 * * * *	sa-learn --rebuild > /dev/null 2>&1"
   (unless mh-spamassassin-executable
@@ -210,9 +215,9 @@
 (defun mh-spamassassin-whitelist (msg)
   "Whitelist MSG with SpamAssassin.
 
-The \\[mh-junk-whitelist] command adds a `whitelist_from' rule to the
-`~/.spamassassin/user_prefs' file. If the `sa-learn' command is available, the
-message is also recategorized as ham.
+The \\[mh-junk-whitelist] command adds a \"whitelist_from\" rule to
+the \"~/.spamassassin/user_prefs\" file. If the \"sa-learn\" command
+is available, the message is also recategorized as ham.
 
 See `mh-spamassassin-blacklist' for more information."
   (unless mh-spamassassin-executable
@@ -244,7 +249,7 @@
       (message "Whitelisting message %d...done" msg))))
 
 (defun mh-spamassassin-add-rule (rule body)
-  "Add a new rule to `~/.spamassassin/user_prefs'.
+  "Add a new rule to \"~/.spamassassin/user_prefs\".
 The name of the rule is RULE and its body is BODY."
   (save-window-excursion
     (let* ((line (format "%s\t%s\n" rule body))
@@ -263,11 +268,11 @@
 (defun mh-spamassassin-identify-spammers ()
   "Identify spammers who are repeat offenders.
 
-This function displays a frequency count of the hosts and domains in the
-`blacklist_from' entries from the last blank line in
-`~/.spamassassin/user_prefs' to the end of the file. This information can be
-used so that you can replace multiple `blacklist_from' entries with a single
-wildcard entry such as:
+This function displays a frequency count of the hosts and domains
+in the \"blacklist_from\" entries from the last blank line in
+\"~/.spamassassin/user_prefs\" to the end of the file. This
+information can be used so that you can replace multiple
+\"blacklist_from\" entries with a single wildcard entry such as:
 
     blacklist_from *@*amazingoffersdirect2u.com"
   (interactive)
@@ -312,8 +317,8 @@
 (defun mh-bogofilter-blacklist (msg)
   "Blacklist MSG with bogofilter.
 
-Bogofilter is a Bayesian spam filtering program. Get it from your local
-distribution or from http://bogofilter.sourceforge.net/.
+Bogofilter is a Bayesian spam filtering program. Get it from your
+local distribution or from http://bogofilter.sourceforge.net/.
 
 Bogofilter is taught by running:
 
@@ -324,11 +329,11 @@
     bogofilter -s < spam-message
 
 on every spam message. This is called a full training; three other
-training methods are described in the FAQ that is distributed with bogofilter.
-Note that most Bayesian filters need 1000 to 5000 of each type of message to
-start doing a good job.
+training methods are described in the FAQ that is distributed with
+bogofilter. Note that most Bayesian filters need 1000 to 5000 of each
+type of message to start doing a good job.
 
-To use bogofilter, add the following recipes to `.procmailrc':
+To use bogofilter, add the following recipes to \".procmailrc\":
 
     MAILDIR=$HOME/`mhparam Path`
 
@@ -344,9 +349,9 @@
     * ^X-Bogosity: Unsure, tests=bogofilter
     spam/unsure/.
 
-If bogofilter classifies a message incorrectly, or is unsure, you can use the
-MH-E commands \\[mh-junk-blacklist] and \\[mh-junk-whitelist] to update
-bogofilter's training.
+If bogofilter classifies a message incorrectly, or is unsure, you can
+use the MH-E commands \\[mh-junk-blacklist] and \\[mh-junk-whitelist]
+to update bogofilter's training.
 
 The \"Bogofilter FAQ\" suggests that you run the following
 occasionally to shrink the database:
@@ -384,7 +389,7 @@
 SpamProbe is a Bayesian spam filtering program. Get it from your local
 distribution or from http://spamprobe.sourceforge.net.
 
-To use SpamProbe, add the following recipes to `.procmailrc':
+To use SpamProbe, add the following recipes to \".procmailrc\":
 
     MAILDIR=$HOME/`mhparam Path`
 
@@ -399,9 +404,9 @@
     *^X-SpamProbe: SPAM
     spam/.
 
-If SpamProbe classifies a message incorrectly, you can use the MH-E commands
-\\[mh-junk-blacklist] and \\[mh-junk-whitelist] to update SpamProbe's
-training."
+If SpamProbe classifies a message incorrectly, you can use the
+MH-E commands \\[mh-junk-blacklist] and \\[mh-junk-whitelist] to
+update SpamProbe's training."
   (unless mh-spamprobe-executable
     (error "Unable to find the spamprobe executable"))
   (let ((msg-file (mh-msg-filename msg mh-current-folder)))
--- a/lisp/mh-e/mh-mime.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/mh-e/mh-mime.el	Thu Dec 29 04:41:02 2005 +0000
@@ -55,12 +55,15 @@
 ;;;###mh-autoload
 (defun mh-compose-insertion (&optional inline)
   "Add tag to include a file such as an image or sound.
-You are prompted for the filename containing the object, the media type if it
-cannot be determined automatically, and a content description. If you're using
-MH-style directives, you will also be prompted for additional attributes.
 
-The option `mh-compose-insertion' controls what type of tags are inserted.
-Optional argument INLINE means make it an inline attachment."
+You are prompted for the filename containing the object, the
+media type if it cannot be determined automatically, and a
+content description. If you're using MH-style directives, you
+will also be prompted for additional attributes.
+
+The option `mh-compose-insertion' controls what type of tags are
+inserted. Optional argument INLINE means make it an inline
+attachment."
   (interactive "P")
   (if (equal mh-compose-insertion 'mml)
       (if inline
@@ -71,8 +74,10 @@
 ;;;###mh-autoload
 (defun mh-compose-forward (&optional description folder messages)
   "Add tag to forward a message.
-You are prompted for a content DESCRIPTION, the name of the FOLDER in which
-the messages to forward are located, and the MESSAGES' numbers.
+
+You are prompted for a content DESCRIPTION, the name of the
+FOLDER in which the messages to forward are located, and the
+MESSAGES' numbers.
 
 The option `mh-compose-insertion' controls what type of tags are inserted."
   (interactive (let*
@@ -117,9 +122,9 @@
 
 (defvar mh-mh-to-mime-args nil
   "Extra arguments for \\[mh-mh-to-mime] to pass to the \"mhbuild\" command.
-The arguments are passed to \"mhbuild\" if \\[mh-mh-to-mime] is given a prefix
-argument. Normally default arguments to \"mhbuild\" are specified in the MH
-profile.")
+The arguments are passed to \"mhbuild\" if \\[mh-mh-to-mime] is
+given a prefix argument. Normally default arguments to
+\"mhbuild\" are specified in the MH profile.")
 
 (defvar mh-media-type-regexp
   (concat (regexp-opt '("text" "image" "audio" "video" "application"
@@ -151,12 +156,14 @@
     ("text/plain" "\.vcf" "text/x-vcard"))
   "Substitutions to make for Content-Type returned from file command.
 The first element is the Content-Type returned by the file command.
-The second element is a regexp matching the file name, usually the extension.
+The second element is a regexp matching the file name, usually the
+extension.
 The third element is the Content-Type to replace with.")
 
 (defun mh-file-mime-type-substitute (content-type filename)
   "Return possibly changed CONTENT-TYPE on the FILENAME.
-Substitutions are made from the `mh-file-mime-type-substitutions' variable."
+Substitutions are made from the `mh-file-mime-type-substitutions'
+variable."
   (let ((subst mh-file-mime-type-substitutions)
         (type) (match) (answer content-type)
         (case-fold-search t))
@@ -225,9 +232,10 @@
 
 (defun mh-minibuffer-read-type (filename &optional default)
   "Return the content type associated with the given FILENAME.
-If the \"file\" command exists and recognizes the given file, then its value
-is returned\; otherwise, the user is prompted for a type (see
-`mailcap-mime-types' and for Emacs 20, `mh-mime-content-types').
+If the \"file\" command exists and recognizes the given file,
+then its value is returned\; otherwise, the user is prompted for
+a type (see `mailcap-mime-types' and for Emacs 20,
+`mh-mime-content-types').
 Optional argument DEFAULT is returned if a type isn't entered."
   (mailcap-parse-mimetypes)
   (let* ((default (or default
@@ -272,9 +280,10 @@
 ;;;###mh-autoload
 (defun mh-mh-attach-file (filename type description attributes)
   "Add a tag to insert a MIME message part from a file.
-You are prompted for the FILENAME containing the object, the media TYPE if it
-cannot be determined automatically, and a content DESCRIPTION. In addition,
-you are also prompted for additional ATTRIBUTES.
+You are prompted for the FILENAME containing the object, the
+media TYPE if it cannot be determined automatically, and a
+content DESCRIPTION. In addition, you are also prompted for
+additional ATTRIBUTES.
 
 See also \\[mh-mh-to-mime]."
   (interactive (let ((filename (mml-minibuffer-read-file "Attach file: ")))
@@ -291,9 +300,9 @@
 (defun mh-mh-compose-type (filename type
                                      &optional description attributes comment)
   "Insert an MH-style directive to insert a file.
-The file specified by FILENAME is encoded as TYPE. An optional DESCRIPTION is
-used as the Content-Description field, optional set of ATTRIBUTES and an
-optional COMMENT can also be included."
+The file specified by FILENAME is encoded as TYPE. An optional
+DESCRIPTION is used as the Content-Description field, optional
+set of ATTRIBUTES and an optional COMMENT can also be included."
   (beginning-of-line)
   (insert "#" type)
   (and attributes
@@ -309,8 +318,8 @@
 ;;;###mh-autoload
 (defun mh-mh-compose-anon-ftp (host filename type description)
   "Add tag to include anonymous ftp reference to a file.
-You can even have your message initiate an \"ftp\" transfer when the
-recipient reads the message. You are prompted for the remote
+You can even have your message initiate an \"ftp\" transfer when
+the recipient reads the message. You are prompted for the remote
 HOST and FILENAME, the media TYPE, and the content DESCRIPTION.
 
 See also \\[mh-mh-to-mime]."
@@ -325,10 +334,10 @@
 ;;;###mh-autoload
 (defun mh-mh-compose-external-compressed-tar (host filename description)
   "Add tag to include anonymous ftp reference to a compressed tar file.
-In addition to retrieving the file via anonymous \"ftp\" as per the
-\\[mh-mh-compose-anon-ftp] command, the file will also be uncompressed and
-untarred. You are prompted for the remote HOST and FILENAME and the content
-DESCRIPTION.
+In addition to retrieving the file via anonymous \"ftp\" as per
+the \\[mh-mh-compose-anon-ftp] command, the file will also be
+uncompressed and untarred. You are prompted for the remote HOST
+and FILENAME and the content DESCRIPTION.
 
 See also \\[mh-mh-to-mime]."
   (interactive (list
@@ -347,11 +356,12 @@
                                                 attributes parameters
                                                 comment)
   "Add tag to refer to a remote file.
-This command is a general utility for referencing external files. In fact, all
-of the other commands that insert directives to access external files call
-this command. You are prompted for the ACCESS-TYPE, remote HOST and FILENAME,
-and content TYPE. If you provide a prefix argument, you are also prompted for
-a content DESCRIPTION, ATTRIBUTES, PARAMETERS, and a COMMENT.
+This command is a general utility for referencing external files.
+In fact, all of the other commands that insert directives to
+access external files call this command. You are prompted for the
+ACCESS-TYPE, remote HOST and FILENAME, and content TYPE. If you
+provide a prefix argument, you are also prompted for a content
+DESCRIPTION, ATTRIBUTES, PARAMETERS, and a COMMENT.
 
 See also \\[mh-mh-to-mime]."
   (interactive (list
@@ -386,8 +396,9 @@
 ;;;###mh-autoload
 (defun mh-mh-forward-message (&optional description folder messages)
   "Add tag to forward a message.
-You are prompted for a content DESCRIPTION, the name of the FOLDER in which
-the messages to forward are located, and the MESSAGES' numbers.
+You are prompted for a content DESCRIPTION, the name of the
+FOLDER in which the messages to forward are located, and the
+MESSAGES' numbers.
 
 See also \\[mh-mh-to-mime]."
   (interactive (list
@@ -419,22 +430,25 @@
 ;;;###mh-autoload
 (defun mh-mh-to-mime (&optional extra-args)
   "Compose MIME message from MH-style directives.
-Typically, you send a message with attachments just like any other message.
-However, you may take a sneak preview of the MIME encoding if you wish by
-running this command.
+
+Typically, you send a message with attachments just like any other
+message. However, you may take a sneak preview of the MIME encoding if
+you wish by running this command.
 
-If you wish to pass additional arguments to \"mhbuild\" (\"mhn\") to affect
-how it builds your message, use the `mh-mh-to-mime-args' option. For example,
-you can build a consistency check into the message by setting
-`mh-mh-to-mime-args' to \"-check\". The recipient of your message can then run
-\"mhbuild -check\" on the message--\"mhbuild\" (\"mhn\") will complain if the
-message has been corrupted on the way. This command only consults this option
-when given a prefix argument EXTRA-ARGS.
+If you wish to pass additional arguments to \"mhbuild\" (\"mhn\") to
+affect how it builds your message, use the `mh-mh-to-mime-args'
+option. For example, you can build a consistency check into the
+message by setting `mh-mh-to-mime-args' to \"-check\". The recipient
+of your message can then run \"mhbuild -check\" on the
+message--\"mhbuild\" (\"mhn\") will complain if the message has been
+corrupted on the way. This command only consults this option when
+given a prefix argument EXTRA-ARGS.
 
-The value of `mh-mh-to-mime-hook' is a list of functions to be called after
-the message has been formatted.
+The hook `mh-mh-to-mime-hook' is called after the message has been
+formatted.
 
-The effects of this command can be undone by running \\[mh-mh-to-mime-undo]."
+The effects of this command can be undone by running
+\\[mh-mh-to-mime-undo]."
   (interactive "*P")
   (mh-mh-quote-unescaped-sharp)
   (save-buffer)
@@ -455,10 +469,10 @@
   (run-hooks 'mh-mh-to-mime-hook))
 
 (defun mh-mh-quote-unescaped-sharp ()
-  "Quote `#' characters that haven't been quoted for \"mhbuild\".
-If the `#' character is present in the first column, but it isn't part of a
-MH-style directive then \"mhbuild\" gives an error. This function will quote
-all such characters."
+  "Quote \"#\" characters that haven't been quoted for \"mhbuild\".
+If the \"#\" character is present in the first column, but it isn't
+part of a MH-style directive then \"mhbuild\" gives an error.
+This function will quote all such characters."
   (save-excursion
     (goto-char (point-min))
     (while (re-search-forward "^#" nil t)
@@ -470,7 +484,8 @@
 ;;;###mh-autoload
 (defun mh-mh-to-mime-undo (noconfirm)
   "Undo effects of \\[mh-mh-to-mime].
-Optional non-nil argument NOCONFIRM means don't ask for confirmation."
+Optional non-nil argument NOCONFIRM means don't ask for
+confirmation."
   (interactive "*P")
   (if (null buffer-file-name)
       (error "Buffer does not seem to be associated with any file"))
@@ -498,8 +513,8 @@
 ;;;###mh-autoload
 (defun mh-mh-directive-present-p (&optional begin end)
   "Check if the text between BEGIN and END might be a MH-style directive.
-The optional argument BEGIN defaults to the beginning of the buffer, while END
-defaults to the the end of the buffer."
+The optional argument BEGIN defaults to the beginning of the
+buffer, while END defaults to the the end of the buffer."
   (unless begin (setq begin (point-min)))
   (unless end (setq end (point-max)))
   (save-excursion
@@ -524,9 +539,10 @@
 ;;;###mh-autoload
 (defun mh-mml-to-mime ()
   "Compose MIME message from MML tags.
-Typically, you send a message with attachments just like any other message.
-However, you may take a sneak preview of the MIME encoding if you wish by
-running this command.
+
+Typically, you send a message with attachments just like any
+other message. However, you may take a sneak preview of the MIME
+encoding if you wish by running this command.
 
 This action can be undone by running \\[undo]."
   (interactive)
@@ -547,8 +563,9 @@
 ;;;###mh-autoload
 (defun mh-mml-forward-message (description folder message)
   "Forward a message as attachment.
-The function will prompt the user for a DESCRIPTION, a FOLDER and MESSAGE
-number."
+
+The function will prompt the user for a DESCRIPTION, a FOLDER and
+MESSAGE number."
   (let ((msg (if (and (equal message "") (numberp mh-sent-from-msg))
                  mh-sent-from-msg
                (car (read-from-string message)))))
@@ -581,12 +598,13 @@
 ;;;###mh-autoload
 (defun mh-mml-attach-file (&optional disposition)
   "Add a tag to insert a MIME message part from a file.
-You are prompted for the filename containing the object, the media type if it
-cannot be determined automatically, a content description and the DISPOSITION
-of the attachment.
+
+You are prompted for the filename containing the object, the
+media type if it cannot be determined automatically, a content
+description and the DISPOSITION of the attachment.
 
 This is basically `mml-attach-file' from Gnus, modified such that a prefix
-argument yields an `inline' disposition and Content-Type is determined
+argument yields an \"inline\" disposition and Content-Type is determined
 automatically."
   (let* ((file (mml-minibuffer-read-file "Attach file: "))
          (type (mh-minibuffer-read-type file))
@@ -600,6 +618,7 @@
 
 (defun mh-secure-message (method mode &optional identity)
   "Add tag to encrypt or sign message.
+
 METHOD should be one of: \"pgpmime\", \"pgp\", \"smime\".
 MODE should be one of: \"sign\", \"encrypt\", \"signencrypt\", \"none\".
 IDENTITY is optionally the default-user-id to use."
@@ -634,30 +653,33 @@
 ;;;###mh-autoload
 (defun mh-mml-secure-message-sign (method)
   "Add tag to sign the message.
-A proper multipart message is created for you when you send the message. Use
-the \\[mh-mml-unsecure-message] command to remove this tag. Use a prefix
-argument METHOD to be prompted for one of the possible security methods
-\(see `mh-mml-method-default')."
+
+A proper multipart message is created for you when you send the
+message. Use the \\[mh-mml-unsecure-message] command to remove
+this tag. Use a prefix argument METHOD to be prompted for one of
+the possible security methods (see `mh-mml-method-default')."
   (interactive (list (mh-mml-query-cryptographic-method)))
   (mh-secure-message method "sign" mh-identity-pgg-default-user-id))
 
 ;;;###mh-autoload
 (defun mh-mml-secure-message-encrypt (method)
   "Add tag to encrypt the message.
-A proper multipart message is created for you when you send the message. Use
-the \\[mh-mml-unsecure-message] command to remove this tag. Use a prefix
-argument METHOD to be prompted for one of the possible security methods
-\(see `mh-mml-method-default')."
+
+A proper multipart message is created for you when you send the
+message. Use the \\[mh-mml-unsecure-message] command to remove
+this tag. Use a prefix argument METHOD to be prompted for one of
+the possible security methods (see `mh-mml-method-default')."
   (interactive (list (mh-mml-query-cryptographic-method)))
   (mh-secure-message method "encrypt" mh-identity-pgg-default-user-id))
 
 ;;;###mh-autoload
 (defun mh-mml-secure-message-signencrypt (method)
   "Add tag to encrypt and sign the message.
-A proper multipart message is created for you when you send the message. Use
-the \\[mh-mml-unsecure-message] command to remove this tag. Use a prefix
-argument METHOD to be prompted for one of the possible security methods
-\(see `mh-mml-method-default')."
+
+A proper multipart message is created for you when you send the
+message. Use the \\[mh-mml-unsecure-message] command to remove
+this tag. Use a prefix argument METHOD to be prompted for one of
+the possible security methods (see `mh-mml-method-default')."
   (interactive (list (mh-mml-query-cryptographic-method)))
   (mh-secure-message method "signencrypt" mh-identity-pgg-default-user-id))
 
@@ -694,10 +716,11 @@
 
 (defun mh-handle-set-external-undisplayer (folder handle function)
   "Replacement for `mm-handle-set-external-undisplayer'.
-This is only called in recent versions of Gnus. The MIME handles are stored
-in data structures corresponding to MH-E folder buffer FOLDER instead of in
-Gnus (as in the original). The MIME part, HANDLE is associated with the
-undisplayer FUNCTION."
+
+This is only called in recent versions of Gnus. The MIME handles
+are stored in data structures corresponding to MH-E folder buffer
+FOLDER instead of in Gnus (as in the original). The MIME part,
+HANDLE is associated with the undisplayer FUNCTION."
   (if (mm-keep-viewer-alive-p handle)
       (let ((new-handle (copy-sequence handle)))
         (mm-handle-set-undisplayer new-handle function)
@@ -715,7 +738,8 @@
 ;;;###mh-autoload
 (defun mh-add-missing-mime-version-header ()
   "Some mail programs don't put a MIME-Version header.
-I have seen this only in spam, so maybe we shouldn't fix this ;-)"
+I have seen this only in spam, so maybe we shouldn't fix
+this ;-)"
   (save-excursion
     (goto-char (point-min))
     (re-search-forward "\n\n" nil t)
@@ -728,7 +752,8 @@
 
 (defun mh-small-show-buffer-p ()
   "Check if show buffer is small.
-This is used to decide if smileys and graphical emphasis will be displayed."
+This is used to decide if smileys and graphical emphasis will be
+displayed."
   (let ((max nil))
     (when (and (boundp 'font-lock-maximum-size) font-lock-maximum-size)
       (cond ((numberp font-lock-maximum-size)
@@ -802,12 +827,13 @@
 (defun mh-mime-save-parts (prompt)
   "Save attachments.
 
-You can save all of the attachments at once with this command. The attachments
-are saved in the directory specified by the option
-`mh-mime-save-parts-default-directory' unless you use a prefix argument PROMPT
-in which case you are prompted for the directory. These directories may be
-superseded by MH profile components, since this function calls on
-\"mhstore\" (\"mhn\") to do the work."
+You can save all of the attachments at once with this command.
+The attachments are saved in the directory specified by the
+option `mh-mime-save-parts-default-directory' unless you use a
+prefix argument PROMPT in which case you are prompted for the
+directory. These directories may be superseded by MH profile
+components, since this function calls on \"mhstore\" (\"mhn\") to
+do the work."
   (interactive "P")
   (let ((msg (if (eq major-mode 'mh-show-mode)
                  (mh-show-buffer-message-number)
@@ -899,9 +925,9 @@
 ;;;###mh-autoload
 (defun mh-mime-display (&optional pre-dissected-handles)
   "Display (and possibly decode) MIME handles.
-Optional argument, PRE-DISSECTED-HANDLES is a list of MIME handles. If
-present they are displayed otherwise the buffer is parsed and then
-displayed."
+Optional argument, PRE-DISSECTED-HANDLES is a list of MIME
+handles. If present they are displayed otherwise the buffer is
+parsed and then displayed."
   (let ((handles ())
         (folder mh-show-folder-buffer)
         (raw-message-data (buffer-string)))
@@ -973,8 +999,8 @@
 
 (defun mh-mime-maybe-display-alternatives (alternatives)
   "Show buttons for ALTERNATIVES.
-If `mh-mime-display-alternatives-flag' is non-nil then display buttons for
-alternative parts that are usually suppressed."
+If `mh-mime-display-alternatives-flag' is non-nil then display
+buttons for alternative parts that are usually suppressed."
   (when (and mh-display-buttons-for-alternatives-flag alternatives)
     (insert "\n----------------------------------------------------\n")
     (insert "Alternatives:\n")
@@ -989,9 +1015,9 @@
 
 (defun mh-mime-part-index (handle)
   "Generate the button number for MIME part, HANDLE.
-Notice that a hash table is used to display the same number when buttons need
-to be displayed multiple times (for instance when nested messages are
-opened)."
+Notice that a hash table is used to display the same number when
+buttons need to be displayed multiple times (for instance when
+nested messages are opened)."
   (or (gethash handle (mh-mime-part-index-hash (mh-buffer-data)))
       (setf (gethash handle (mh-mime-part-index-hash (mh-buffer-data)))
             (incf (mh-mime-parts-count (mh-buffer-data))))))
@@ -1074,8 +1100,8 @@
 
 (defun mh-signature-highlight (&optional handle)
   "Highlight message signature in HANDLE.
-The optional argument, HANDLE is a MIME handle if the function is being used
-to highlight the signature in a MIME part."
+The optional argument, HANDLE is a MIME handle if the function is
+being used to highlight the signature in a MIME part."
   (let ((regexp
          (cond ((not handle) "^-- $")
                ((not (and (equal (mm-handle-media-supertype handle) "text")
@@ -1100,8 +1126,8 @@
 
 (defun mh-insert-mime-button (handle index displayed)
   "Insert MIME button for HANDLE.
-INDEX is the part number that will be DISPLAYED. It is also used by commands
-like \"K v\" which operate on individual MIME parts."
+INDEX is the part number that will be DISPLAYED. It is also used
+by commands like \"K v\" which operate on individual MIME parts."
   ;; The button could be displayed by a previous decode. In that case
   ;; undisplay it if we need a hidden button.
   (when (and (mm-handle-displayed-p handle) (not displayed))
@@ -1213,8 +1239,8 @@
 (defun mh-press-button ()
   "View contents of button.
 
-This command is a toggle so if you use it again on the same attachment, the
-attachment is hidden."
+This command is a toggle so if you use it again on the same
+attachment, the attachment is hidden."
   (interactive)
   (let ((mm-inline-media-tests mh-mm-inline-media-tests)
         (data (get-text-property (point) 'mh-data))
@@ -1232,9 +1258,10 @@
 ;;;###mh-autoload
 (defun mh-push-button (event)
   "Click MIME button for EVENT.
-If the MIME part is visible then it is removed. Otherwise the part is
-displayed. This function is called when the mouse is used to click the MIME
-button."
+
+If the MIME part is visible then it is removed. Otherwise the
+part is displayed. This function is called when the mouse is used
+to click the MIME button."
   (interactive "e")
   (mh-do-at-event-location event
     (let ((folder mh-show-folder-buffer)
@@ -1288,21 +1315,24 @@
 (defun mh-display-with-external-viewer (part-index)
   "View attachment externally.
 
-If Emacs does not know how to view an attachment, you could save it into a
-file and then run some program to open it. It is easier, however, to launch
-the program directly from MH-E with this command. While you'll most likely use
-this to view spreadsheets and documents, it is also useful to use your browser
-to view HTML attachments with higher fidelity than what Emacs can provide.
+If Emacs does not know how to view an attachment, you could save
+it into a file and then run some program to open it. It is
+easier, however, to launch the program directly from MH-E with
+this command. While you'll most likely use this to view
+spreadsheets and documents, it is also useful to use your browser
+to view HTML attachments with higher fidelity than what Emacs can
+provide.
 
-This command displays the attachment associated with the button under the
-cursor. If the cursor is not located over a button, then the cursor first
-moves to the next button, wrapping to the beginning of the message if
-necessary. You can provide a numeric prefix argument PART-INDEX to view the
-attachment labeled with that number.
+This command displays the attachment associated with the button
+under the cursor. If the cursor is not located over a button,
+then the cursor first moves to the next button, wrapping to the
+beginning of the message if necessary. You can provide a numeric
+prefix argument PART-INDEX to view the attachment labeled with
+that number.
 
-This command tries to provide a reasonable default for the viewer by calling
-the Emacs function `mailcap-mime-info'. This function usually reads the file
-\"/etc/mailcap\"."
+This command tries to provide a reasonable default for the viewer
+by calling the Emacs function `mailcap-mime-info'. This function
+usually reads the file \"/etc/mailcap\"."
   (interactive "P")
   (when (consp part-index) (setq part-index (car part-index)))
   (mh-folder-mime-action
@@ -1457,8 +1487,8 @@
 
 (defun mh-mm-inline-message (handle)
   "Display message, HANDLE.
-The function decodes the message and displays it. It avoids decoding the same
-message multiple times."
+The function decodes the message and displays it. It avoids
+decoding the same message multiple times."
   (let ((b (point))
         (clean-message-header mh-clean-message-header-flag)
         (invisible-headers mh-invisible-header-fields-compiled)
--- a/lisp/mh-e/mh-pick.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/mh-e/mh-pick.el	Thu Dec 29 04:41:02 2005 +0000
@@ -55,12 +55,12 @@
   "Search FOLDER for messages matching a pattern.
 
 With this command, you can search a folder for messages to or from a
-particular person or about a particular subject. In fact, you can also search
-for messages containing selected strings in any arbitrary header field or any
-string found within the messages.
+particular person or about a particular subject. In fact, you can also
+search for messages containing selected strings in any arbitrary
+header field or any string found within the messages.
 
-You are first prompted for the name of the folder to search and then placed in
-the following buffer in MH-Pick mode:
+You are first prompted for the name of the folder to search and then
+placed in the following buffer in MH-Pick mode:
 
      From:
      To:
@@ -69,24 +69,26 @@
      Subject:
      --------
 
-Edit this template by entering your search criteria in an appropriate header
-field that is already there, or create a new field yourself. If the string
-you're looking for could be anywhere in a message, then place the string
-underneath the row of dashes. The \\[mh-search-folder] command uses the MH
-command \"pick\" to do the real work.
+Edit this template by entering your search criteria in an appropriate
+header field that is already there, or create a new field yourself. If
+the string you're looking for could be anywhere in a message, then
+place the string underneath the row of dashes. The
+\\[mh-search-folder] command uses the MH command \"pick\" to do the
+real work.
 
-There are no semantics associated with the search criteria--they are simply
-treated as strings. Case is ignored when all lowercase is used, and regular
-expressions (a la \"ed\") are available. It is all right to specify several
-search criteria. What happens then is that a logical _and_ of the various
-fields is performed. If you prefer a logical _or_ operation, run
-\\[mh-search-folder] multiple times.
+There are no semantics associated with the search criteria--they are
+simply treated as strings. Case is ignored when all lowercase is used,
+and regular expressions (a la \"ed\") are available. It is all right
+to specify several search criteria. What happens then is that a
+logical _and_ of the various fields is performed. If you prefer a
+logical _or_ operation, run \\[mh-search-folder] multiple times.
 
-As an example, let's say that we want to find messages from Ginnean about
-horseback riding in the Kosciusko National Park (Australia) during January,
-1994. Normally we would start with a broad search and narrow it down if
-necessary to produce a manageable amount of data, but we'll cut to the chase
-and create a fairly restrictive set of criteria as follows:
+As an example, let's say that we want to find messages from Ginnean
+about horseback riding in the Kosciusko National Park (Australia)
+during January, 1994. Normally we would start with a broad search and
+narrow it down if necessary to produce a manageable amount of data,
+but we'll cut to the chase and create a fairly restrictive set of
+criteria as follows:
 
      From: ginnean
      To:
@@ -98,29 +100,32 @@
 As with MH-Letter mode, MH-Pick provides commands like
 \\<mh-pick-mode-map>\\[mh-to-field] to help you fill in the blanks.
 
-To perform the search, type \\[mh-do-search]. The selected messages are placed
-in the \"search\" sequence, which you can use later in forwarding, printing,
-or narrowing your field of view. Subsequent searches are appended to the
-\"search\" sequence. If, however, you wish to start with a clean slate, first
-delete the \"search\" sequence.
-
-If you're searching in a folder that is already displayed in an MH-Folder
-buffer, only those messages contained in the buffer are used for the search.
-Therefore, if you want to search in all messages, first kill the folder's
-buffer with \\<mh-folder-mode-map>\\[kill-buffer] or scan the entire folder
-with \\[mh-rescan-folder].
+To perform the search, type \\[mh-do-search]. The selected messages
+are placed in the \"search\" sequence, which you can use later in
+forwarding, printing, or narrowing your field of view. Subsequent
+searches are appended to the \"search\" sequence. If, however, you
+wish to start with a clean slate, first delete the \"search\"
+sequence.
 
-If you find that you do the same thing over and over when editing the search
-template, you may wish to bind some shortcuts to keys. This can be done with
-the variable `mh-pick-mode-hook', which is called when \\[mh-search-folder] is
-run on a new pattern.
+If you're searching in a folder that is already displayed in an
+MH-Folder buffer, only those messages contained in the buffer are used
+for the search. Therefore, if you want to search in all messages,
+first kill the folder's buffer with
+\\<mh-folder-mode-map>\\[kill-buffer] or scan the entire folder with
+\\[mh-rescan-folder].
 
-If you have run the \\[mh-index-search] command, but change your mind while
-entering the search criteria and actually want to run a regular search, then
-you can use the \\<mh-pick-mode-map>\\[mh-pick-do-search] command.
+If you find that you do the same thing over and over when editing the
+search template, you may wish to bind some shortcuts to keys. This can
+be done with the variable `mh-pick-mode-hook', which is called when
+\\[mh-search-folder] is run on a new pattern.
 
-In a program, argument WINDOW-CONFIG is the current window configuration and
-is used when the search folder is dismissed."
+If you have run the \\[mh-index-search] command, but change your mind
+while entering the search criteria and actually want to run a regular
+search, then you can use the \\<mh-pick-mode-map>\\[mh-pick-do-search]
+command.
+
+In a program, argument WINDOW-CONFIG is the current window
+configuration and is used when the search folder is dismissed."
   (interactive (list (mh-prompt-for-folder "Search" mh-current-folder nil nil t)
                      (current-window-configuration)))
   (let ((pick-folder (if (equal folder "+") mh-current-folder folder)))
@@ -182,29 +187,28 @@
      "where <field> is the first letter of the desired field."))
   "Key binding cheat sheet.
 
-This is an associative array which is used to show the most common commands.
-The key is a prefix char. The value is one or more strings which are
-concatenated together and displayed in the minibuffer if ? is pressed after
-the prefix character. The special key nil is used to display the
-non-prefixed commands.
+This is an associative array which is used to show the most common
+commands. The key is a prefix char. The value is one or more strings
+which are concatenated together and displayed in the minibuffer if ?
+is pressed after the prefix character. The special key nil is used to
+display the non-prefixed commands.
 
-The substitutions described in `substitute-command-keys' are performed as
-well.")
+The substitutions described in `substitute-command-keys' are performed
+as well.")
 
 (put 'mh-pick-mode 'mode-class 'special)
 
 (define-derived-mode mh-pick-mode fundamental-mode "MH-Pick"
   "Mode for creating search templates in MH-E.\\<mh-pick-mode-map>
 
-After each field name, enter the pattern to search for.  If a field's
-value does not matter for the search, leave it empty.  To search the
+After each field name, enter the pattern to search for. If a field's
+value does not matter for the search, leave it empty. To search the
 entire message, supply the pattern in the \"body\" of the template.
-Each non-empty field must be matched for a message to be selected.
-To effect a logical \"or\", use \\[mh-search-folder] multiple times.
-When you have finished, type  \\[mh-pick-do-search]  to do the search.
+Each non-empty field must be matched for a message to be selected. To
+effect a logical \"or\", use \\[mh-search-folder] multiple times. When
+you have finished, type \\[mh-pick-do-search] to do the search.
 
-The value of `mh-pick-mode-hook' is a list of functions to be called,
-with no arguments, upon entry to this mode.
+The hook `mh-pick-mode-hook' is called upon entry to this mode.
 
 \\{mh-pick-mode-map}"
 
@@ -217,8 +221,10 @@
 ;;;###mh-autoload
 (defun mh-pick-do-search ()
   "Find messages that match the qualifications in the current pattern buffer.
-Messages are searched for in the folder named in `mh-searching-folder'.
-Add the messages found to the sequence named `search'."
+
+Messages are searched for in the folder named in
+`mh-searching-folder'. Add the messages found to the sequence
+named \"search\"."
   (interactive)
   (let ((pattern-list (mh-pick-parse-search-buffer))
         (folder mh-searching-folder)
@@ -252,9 +258,11 @@
 ;;;###mh-autoload
 (defun mh-do-search ()
   "Use the default searching function.
-If \\[mh-search-folder] was used to create the search pattern then pick is used
-to search the folder. Otherwise if \\[mh-index-search] was used then the
-indexing program specified in `mh-index-program' is used."
+
+If \\[mh-search-folder] was used to create the search pattern
+then pick is used to search the folder. Otherwise if
+\\[mh-index-search] was used then the indexing program specified
+in `mh-index-program' is used."
   (interactive)
   (if (symbolp mh-searching-function)
       (funcall mh-searching-function)
@@ -262,8 +270,8 @@
 
 (defun mh-seq-from-command (folder seq command)
   "In FOLDER, make a sequence named SEQ by executing COMMAND.
-COMMAND is a list.  The first element is a program name
-and the subsequent elements are its arguments, all strings."
+COMMAND is a list. The first element is a program name and the
+subsequent elements are its arguments, all strings."
   (let ((msg)
         (msgs ())
         (case-fold-search t))
@@ -280,9 +288,9 @@
 
 (defun mh-pick-parse-search-buffer ()
   "Parse the search buffer contents.
-The function returns a alist. The car of each element is either the header name
-to search in or nil to search the whole message. The cdr of the element is the
-pattern to search."
+The function returns a alist. The car of each element is either
+the header name to search in or nil to search the whole message.
+The cdr of the element is the pattern to search."
   (save-excursion
     (let ((pattern-list ())
           (in-body-flag nil)
@@ -329,9 +337,9 @@
 ;; All implementations of pick have special options -cc, -date, -from and
 ;; -subject that allow to search for corresponding components. Any other
 ;; component is searched using option --COMPNAME, for example: `pick
-;; --x-mailer mh-e'. Mailutils `pick' supports this option using a certain
+;; --x-mailer mh-e'. Mailutils "pick" supports this option using a certain
 ;; kludge, but it prefers the following syntax for this purpose:
-;; `--component=COMPNAME --pattern=PATTERN'.
+;; "--component=COMPNAME --pattern=PATTERN".
 ;;                                           -- Sergey Poznyakoff, Aug 2003
 (defun mh-pick-regexp-builder (pattern-list)
   "Generate pick search expression from PATTERN-LIST."
--- a/lisp/mh-e/mh-print.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/mh-e/mh-print.el	Thu Dec 29 04:41:02 2005 +0000
@@ -47,8 +47,8 @@
    black-white - Print colors on black/white printer.
 		 See also `ps-black-white-faces'.
 
-Any other value is treated as t. This variable is initialized from
-`ps-print-color-p'.")
+Any other value is treated as t. This variable is initialized
+from `ps-print-color-p'.")
 
 (defvar mh-ps-print-func 'ps-spool-buffer-with-faces
   "Function to use to spool a buffer.
@@ -108,20 +108,22 @@
 (defun mh-ps-print-msg (range)
   "Print RANGE\\<mh-folder-mode-map>.
 
-Check the documentation of `mh-interactive-range' to see how RANGE is read in
-interactive use.
+Check the documentation of `mh-interactive-range' to see how RANGE is
+read in interactive use.
 
-This command will print inline text attachments but will not decrypt messages.
-However, when a message is displayed in an MH-Show buffer, then that buffer is
-used verbatim for printing with the caveat that only text attachments, if
-opened inline, are printed. Therefore, encrypted messages can be printed by
-showing and decrypting them first.
+This command will print inline text attachments but will not decrypt
+messages. However, when a message is displayed in an MH-Show buffer,
+then that buffer is used verbatim for printing with the caveat that
+only text attachments, if opened inline, are printed. Therefore,
+encrypted messages can be printed by showing and decrypting them
+first.
 
-MH-E uses the \"ps-print\" package to do the printing, so you can customize
-the printing further by going to the `ps-print' customization group. This
-command does not use the options `mh-lpr-command-format' or
-`mh-print-background-flag'. See also the commands \\[mh-ps-print-toggle-color]
-and \\[mh-ps-print-toggle-faces]."
+MH-E uses the \"ps-print\" package to do the printing, so you can
+customize the printing further by going to the `ps-print'
+customization group. This command does not use the options
+`mh-lpr-command-format' or `mh-print-background-flag'. See also the
+commands \\[mh-ps-print-toggle-color] and
+\\[mh-ps-print-toggle-faces]."
   (interactive (list (mh-interactive-range "Print")))
   (mh-ps-print-range range nil))
 
@@ -129,20 +131,22 @@
 (defun mh-ps-print-msg-file (range file)
   "Print RANGE to FILE\\<mh-folder-mode-map>.
 
-Check the documentation of `mh-interactive-range' to see how RANGE is read in
-interactive use.
+Check the documentation of `mh-interactive-range' to see how RANGE is
+read in interactive use.
 
-This command will print inline text attachments but will not decrypt messages.
-However, when a message is displayed in an MH-Show buffer, then that buffer is
-used verbatim for printing with the caveat that only text attachments, if
-opened inline, are printed. Therefore, encrypted messages can be printed by
-showing and decrypting them first.
+This command will print inline text attachments but will not decrypt
+messages. However, when a message is displayed in an MH-Show buffer,
+then that buffer is used verbatim for printing with the caveat that
+only text attachments, if opened inline, are printed. Therefore,
+encrypted messages can be printed by showing and decrypting them
+first.
 
-MH-E uses the \"ps-print\" package to do the printing, so you can customize
-the printing further by going to the `ps-print' customization group. This
-command does not use the options `mh-lpr-command-format' or
-`mh-print-background-flag'. See also the commands \\[mh-ps-print-toggle-color]
-and \\[mh-ps-print-toggle-faces]."
+MH-E uses the \"ps-print\" package to do the printing, so you can
+customize the printing further by going to the `ps-print'
+customization group. This command does not use the options
+`mh-lpr-command-format' or `mh-print-background-flag'. See also the
+commands \\[mh-ps-print-toggle-color] and
+\\[mh-ps-print-toggle-faces]."
   (interactive (list (mh-interactive-range "Print") (mh-ps-print-preprint 1)))
   (mh-ps-print-range range file))
 
@@ -150,8 +154,8 @@
 (defun mh-ps-print-toggle-faces ()
  "Toggle whether printing is done with faces or not.
 
-When faces are enabled, the printed message will look very similar to the
-message in the MH-Show buffer."
+When faces are enabled, the printed message will look very
+similar to the message in the MH-Show buffer."
  (interactive)
  (if (eq mh-ps-print-func 'ps-spool-buffer-with-faces)
      (progn
@@ -164,13 +168,13 @@
 (defun mh-ps-print-toggle-color ()
   "Toggle whether color is used in printing messages.
 
-Colors are emulated on black-and-white printers with shades of gray. This
-might produce illegible output, even if your screen colors only use shades of
-gray. If this is the case, try using this command to toggle between color, no
-color, and a black and white representation of the colors and see which works
-best. You change this setting permanently by customizing the option
+Colors are emulated on black-and-white printers with shades of
+gray. This might produce illegible output, even if your screen
+colors only use shades of gray. If this is the case, try using
+this command to toggle between color, no color, and a black and
+white representation of the colors and see which works best. You
+change this setting permanently by customizing the option
 `ps-print-color-p'."
-
  (interactive)
  (if (eq mh-ps-print-color-option nil)
      (progn
@@ -188,11 +192,12 @@
 (defun mh-print-msg (range)
   "Print RANGE the old fashioned way\\<mh-folder-mode-map>.
 
-The message is formatted with \"mhl\" (see option `mh-mhl-format-file') and
-printed with the \"lpr\" command (see option `mh-lpr-command-format').
+The message is formatted with \"mhl\" (see option
+`mh-mhl-format-file') and printed with the \"lpr\" command (see
+option `mh-lpr-command-format').
 
-Check the documentation of `mh-interactive-range' to see how RANGE is read in
-interactive use.
+Check the documentation of `mh-interactive-range' to see how
+RANGE is read in interactive use.
 
 Consider using \\[mh-ps-print-msg] instead."
   (interactive (list (mh-interactive-range "Print")))
--- a/lisp/mh-e/mh-seq.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/mh-e/mh-seq.el	Thu Dec 29 04:41:02 2005 +0000
@@ -122,16 +122,18 @@
   "Map of message index to various parts of the scan line.")
 (defvar mh-thread-scan-line-map-stack nil
   "Old map of message index to various parts of the scan line.
-This is the original map that is stored when the folder is narrowed.")
+This is the original map that is stored when the folder is
+narrowed.")
 (defvar mh-thread-subject-container-hash nil
   "Hashtable used to group messages by subject.")
 (defvar mh-thread-duplicates nil
   "Hashtable used to associate messages with the same message identifier.")
 (defvar mh-thread-history ()
   "Variable to remember the transformations to the thread tree.
-When new messages are added, these transformations are rewound, then the
-links are added from the newly seen messages. Finally the transformations are
-redone to get the new thread tree. This makes incremental threading easier.")
+When new messages are added, these transformations are rewound,
+then the links are added from the newly seen messages. Finally
+the transformations are redone to get the new thread tree. This
+makes incremental threading easier.")
 (defvar mh-thread-body-width nil
   "Width of scan substring that contains subject and body of message.")
 
@@ -150,9 +152,10 @@
 (defun mh-delete-seq (sequence)
   "Delete SEQUENCE.
 
-You are prompted for the sequence to delete. Note that this deletes only the
-sequence, not the messages in the sequence. If you want to delete the
-messages, use \"\\[universal-argument] \\[mh-delete-msg]\"."
+You are prompted for the sequence to delete. Note that this
+deletes only the sequence, not the messages in the sequence. If
+you want to delete the messages, use \"\\[universal-argument]
+\\[mh-delete-msg]\"."
   (interactive (list (mh-read-seq-default "Delete" t)))
   (let ((msg-list (mh-seq-to-msgs sequence))
         (internal-flag (mh-internal-seq sequence))
@@ -216,8 +219,8 @@
 ;;;###mh-autoload
 (defun mh-msg-is-in-seq (message)
   "Display the sequences in which the current message appears.
-Use a prefix argument to display the sequences in which another MESSAGE
-appears."
+Use a prefix argument to display the sequences in which another
+MESSAGE appears."
   (interactive "P")
   (if (not message)
       (setq message (mh-get-msg-num t)))
@@ -243,11 +246,13 @@
 (defun mh-narrow-to-seq (sequence)
   "Restrict display to messages in SEQUENCE.
 
-You are prompted for the name of the sequence. What this command does is show
-only those messages that are in the selected sequence in the MH-Folder buffer.
-In addition, it limits further MH-E searches to just those messages.
+You are prompted for the name of the sequence. What this command
+does is show only those messages that are in the selected
+sequence in the MH-Folder buffer. In addition, it limits further
+MH-E searches to just those messages.
 
-When you want to widen the view to all your messages again, use \\[mh-widen]."
+When you want to widen the view to all your messages again, use
+\\[mh-widen]."
   (interactive (list (mh-read-seq "Narrow to" t)))
   (with-mh-folder-updating (t)
     (cond ((mh-seq-to-msgs sequence)
@@ -277,24 +282,27 @@
                         mh-show-seq-tool-bar-map))))
              (push 'widen mh-view-ops)))
           (t
-           (error "No messages in sequence `%s'" (symbol-name sequence))))))
+           (error "No messages in sequence \"%s\"" (symbol-name sequence))))))
 
 ;;;###mh-autoload
 (defun mh-put-msg-in-seq (range sequence)
   "Add RANGE to SEQUENCE\\<mh-folder-mode-map>.
 
-To place a message in a sequence, use this command to do it manually, or use
-the MH command \"pick\" or the MH-E version of \"pick\", \\[mh-search-folder],
-which create a sequence automatically.
+To place a message in a sequence, use this command to do it
+manually, or use the MH command \"pick\" or the MH-E version of
+\"pick\", \\[mh-search-folder], which create a sequence
+automatically.
 
-Give this command a RANGE and you can add all the messages in a sequence to
-another sequence (for example, \"\\[universal-argument] \\[mh-put-msg-in-seq]
-SourceSequence RET DestSequence RET\"). Check the documentation of
-`mh-interactive-range' to see how RANGE is read in interactive use."
+Give this command a RANGE and you can add all the messages in a
+sequence to another sequence (for example,
+\"\\[universal-argument] \\[mh-put-msg-in-seq] SourceSequence RET
+DestSequence RET\"). Check the documentation of
+`mh-interactive-range' to see how RANGE is read in interactive
+use."
   (interactive (list (mh-interactive-range "Add messages from")
                      (mh-read-seq-default "Add to" nil)))
   (unless (mh-valid-seq-p sequence)
-    (error "Can't put message in invalid sequence `%s'" sequence))
+    (error "Can't put message in invalid sequence \"%s\"" sequence))
   (let* ((internal-seq-flag (mh-internal-seq sequence))
          (original-msgs (mh-seq-msgs (mh-find-seq sequence)))
          (folders (list mh-current-folder))
@@ -321,7 +329,8 @@
 ;;;###mh-autoload
 (defun mh-widen (&optional all-flag)
   "Remove last restriction.
-If optional prefix argument ALL-FLAG is non-nil, remove all limits."
+If optional prefix argument ALL-FLAG is non-nil, remove all
+limits."
   (interactive "P")
   (let ((msg (mh-get-msg-num nil)))
     (when mh-folder-view-stack
@@ -368,8 +377,8 @@
 ;;;###mh-autoload
 (defun mh-notate-deleted-and-refiled ()
   "Notate messages marked for deletion or refiling.
-Messages to be deleted are given by `mh-delete-list' while messages to be
-refiled are present in `mh-refile-list'."
+Messages to be deleted are given by `mh-delete-list' while
+messages to be refiled are present in `mh-refile-list'."
   (let ((refiled-hash (make-hash-table))
         (deleted-hash (make-hash-table)))
     (dolist (msg mh-delete-list)
@@ -395,17 +404,18 @@
 ;;;###mh-autoload
 (defun mh-read-seq-default (prompt not-empty)
   "Read and return sequence name with default narrowed or previous sequence.
-PROMPT is the prompt to use when reading. If NOT-EMPTY is non-nil then a
-non-empty sequence is read."
+PROMPT is the prompt to use when reading. If NOT-EMPTY is non-nil
+then a non-empty sequence is read."
   (mh-read-seq prompt not-empty
                (or mh-last-seq-used
                    (car (mh-seq-containing-msg (mh-get-msg-num nil) nil)))))
 
 (defun mh-read-seq (prompt not-empty &optional default)
   "Read and return a sequence name.
-Prompt with PROMPT, raise an error if the sequence is empty and the NOT-EMPTY
-flag is non-nil, and supply an optional DEFAULT sequence. A reply of '%'
-defaults to the first sequence containing the current message."
+Prompt with PROMPT, raise an error if the sequence is empty and
+the NOT-EMPTY flag is non-nil, and supply an optional DEFAULT
+sequence. A reply of '%' defaults to the first sequence
+containing the current message."
   (let* ((input (completing-read (format "%s %s %s" prompt "sequence:"
                                          (if default
                                              (format "[%s] " default)
@@ -418,7 +428,7 @@
                     (t (intern input))))
          (msgs (mh-seq-to-msgs seq)))
     (if (and (null msgs) not-empty)
-        (error "No messages in sequence `%s'" seq))
+        (error "No messages in sequence \"%s\"" seq))
     seq))
 
 
@@ -459,35 +469,40 @@
                              expand-flag ask-flag number-as-range-flag)
   "Read a message range with PROMPT.
 
-If FOLDER is non-nil then a range is read from that folder, otherwise use
-`mh-current-folder'.
+If FOLDER is non-nil then a range is read from that folder, otherwise
+use `mh-current-folder'.
 
-If DEFAULT is a string then use that as default range to return. If DEFAULT is
-nil then ask user with default answer a range based on the sequences that seem
-relevant. Finally if DEFAULT is t, try to avoid prompting the user. Unseen
-messages, if present, are returned. If the folder has fewer than
-`mh-large-folder' messages then \"all\" messages are returned. Finally as a
-last resort prompt the user.
+If DEFAULT is a string then use that as default range to return. If
+DEFAULT is nil then ask user with default answer a range based on the
+sequences that seem relevant. Finally if DEFAULT is t, try to avoid
+prompting the user. Unseen messages, if present, are returned. If the
+folder has fewer than `mh-large-folder' messages then \"all\" messages
+are returned. Finally as a last resort prompt the user.
 
-If EXPAND-FLAG is non-nil then a list of message numbers corresponding to the
-input is returned. If this list is empty then an error is raised. If
-EXPAND-FLAG is nil just return the input string. In this case we don't check
-if the range is empty.
+If EXPAND-FLAG is non-nil then a list of message numbers corresponding
+to the input is returned. If this list is empty then an error is
+raised. If EXPAND-FLAG is nil just return the input string. In this
+case we don't check if the range is empty.
 
 If ASK-FLAG is non-nil, then the user is always queried for a range of
-messages. If ASK-FLAG is nil, then the function checks if the unseen sequence
-is non-empty. If that is the case, `mh-unseen-seq', or the list of messages in
-it depending on the value of EXPAND, is returned. Otherwise if the folder has
-fewer than `mh-large-folder' messages then the list of messages corresponding
-to \"all\" is returned. If neither of the above holds then as a last resort
-the user is queried for a range of messages.
+messages. If ASK-FLAG is nil, then the function checks if the unseen
+sequence is non-empty. If that is the case, `mh-unseen-seq', or the
+list of messages in it depending on the value of EXPAND, is returned.
+Otherwise if the folder has fewer than `mh-large-folder' messages then
+the list of messages corresponding to \"all\" is returned. If neither
+of the above holds then as a last resort the user is queried for a
+range of messages.
 
-If NUMBER-AS-RANGE-FLAG is non-nil, then if a number, N is read as input, it
-is interpreted as the range \"last:N\".
+If NUMBER-AS-RANGE-FLAG is non-nil, then if a number, N is read as
+input, it is interpreted as the range \"last:N\".
 
-This function replaces the existing function `mh-read-msg-range'. Calls to:
+This function replaces the existing function `mh-read-msg-range'.
+Calls to:
+
   (mh-read-msg-range folder flag)
+
 should be replaced with:
+
   (mh-read-range \"Suitable prompt\" folder t nil flag
                  mh-interpret-number-as-range-flag)"
   (setq default (or default mh-last-seq-used
@@ -528,7 +543,7 @@
           ((assoc (intern input) seq-list)
            (cdr (assoc (intern input) seq-list)))
           ((setq msg-list (mh-translate-range folder input)) msg-list)
-          (t (error "No messages in range `%s'" input)))))
+          (t (error "No messages in range \"%s\"" input)))))
 
 ;;;###mh-autoload
 (defun mh-translate-range (folder expr)
@@ -565,8 +580,9 @@
 ;;;###mh-autoload
 (defun mh-notate-cur ()
   "Mark the MH sequence cur.
-In addition to notating the current message with `mh-note-cur' the function
-uses `overlay-arrow-position' to put a marker in the fringe."
+In addition to notating the current message with `mh-note-cur'
+the function uses `overlay-arrow-position' to put a marker in the
+fringe."
   (let ((cur (car (mh-seq-to-msgs 'cur))))
     (when (and cur (mh-goto-msg cur t t))
       (beginning-of-line)
@@ -617,8 +633,9 @@
 ;;;###mh-autoload
 (defmacro mh-iterate-on-messages-in-region (var begin end &rest body)
   "Iterate over region.
-VAR is bound to the message on the current line as we loop starting from BEGIN
-till END. In each step BODY is executed.
+
+VAR is bound to the message on the current line as we loop
+starting from BEGIN till END. In each step BODY is executed.
 
 If VAR is nil then the loop is executed without any binding."
   (unless (symbolp var)
@@ -639,13 +656,14 @@
 (defmacro mh-iterate-on-range (var range &rest body)
   "Iterate an operation over a region or sequence.
 
-VAR is bound to each message in turn in a loop over RANGE, which can be a
-message number, a list of message numbers, a sequence, a region in a cons
-cell, or a MH range (something like last:20) in a string. In each iteration,
-BODY is executed.
+VAR is bound to each message in turn in a loop over RANGE, which
+can be a message number, a list of message numbers, a sequence, a
+region in a cons cell, or a MH range (something like last:20) in
+a string. In each iteration, BODY is executed.
 
-The parameter RANGE is usually created with `mh-interactive-range'
-in order to provide a uniform interface to MH-E functions."
+The parameter RANGE is usually created with
+`mh-interactive-range' in order to provide a uniform interface to
+MH-E functions."
   (unless (symbolp var)
     (error "Can not bind the non-symbol %s" var))
   (let ((binding-needed-flag var)
@@ -680,8 +698,8 @@
 (defun mh-range-to-msg-list (range)
   "Return a list of messages for RANGE.
 
-Check the documentation of `mh-interactive-range' to see how RANGE is read in
-interactive use."
+Check the documentation of `mh-interactive-range' to see how
+RANGE is read in interactive use."
   (let (msg-list)
     (mh-iterate-on-range msg range
       (push msg msg-list))
@@ -692,21 +710,21 @@
   "Return interactive specification for message, sequence, range or region.
 By convention, the name of this argument is RANGE.
 
-If variable `transient-mark-mode' is non-nil and the mark is active, then this
-function returns a cons-cell of the region.
+If variable `transient-mark-mode' is non-nil and the mark is active,
+then this function returns a cons-cell of the region.
 
-If optional prefix argument is provided, then prompt for message range with
-RANGE-PROMPT. A list of messages in that range is returned.
+If optional prefix argument is provided, then prompt for message range
+with RANGE-PROMPT. A list of messages in that range is returned.
 
-If a MH range is given, say something like last:20, then a list containing
-the messages in that range is returned.
+If a MH range is given, say something like last:20, then a list
+containing the messages in that range is returned.
 
 If DEFAULT non-nil then it is returned.
 
 Otherwise, the message number at point is returned.
 
-This function is usually used with `mh-iterate-on-range' in order to provide
-a uniform interface to MH-E functions."
+This function is usually used with `mh-iterate-on-range' in order to
+provide a uniform interface to MH-E functions."
   (cond ((mh-mark-active-p t) (cons (region-beginning) (region-end)))
         (current-prefix-arg (mh-read-range range-prompt nil nil t t))
         (default default)
@@ -720,13 +738,17 @@
 ;;  41 for the max size of the subject part. Avoiding this would be desirable.
 (defun mh-subject-to-sequence (all)
   "Put all following messages with same subject in sequence 'subject.
-If arg ALL is t, move to beginning of folder buffer to collect all messages.
+If arg ALL is t, move to beginning of folder buffer to collect all
+messages.
 If arg ALL is nil, collect only messages fron current one on forward.
 
 Return number of messages put in the sequence:
 
  nil -> there was no subject line.
- 0   -> there were no later messages with the same subject (sequence not made)
+
+ 0   -> there were no later messages with the same
+        subject (sequence not made)
+
  >1  -> the total number of messages including current one."
   (if (memq 'unthread mh-view-ops)
       (mh-subject-to-sequence-threaded all)
@@ -734,14 +756,17 @@
 
 (defun mh-subject-to-sequence-unthreaded (all)
   "Put all following messages with same subject in sequence 'subject.
-This function only works with an unthreaded folder. If arg ALL is t, move to
-beginning of folder buffer to collect all messages. If arg ALL is nil, collect
-only messages fron current one on forward.
+
+This function only works with an unthreaded folder. If arg ALL is
+t, move to beginning of folder buffer to collect all messages. If
+arg ALL is nil, collect only messages fron current one on
+forward.
 
 Return number of messages put in the sequence:
 
  nil -> there was no subject line.
- 0   -> there were no later messages with the same subject (sequence not made)
+ 0   -> there were no later messages with the same
+        subject (sequence not made)
  >1  -> the total number of messages including current one."
   (if (not (eq major-mode 'mh-folder-mode))
       (error "Not in a folder buffer"))
@@ -782,12 +807,14 @@
 
 (defun mh-subject-to-sequence-threaded (all)
   "Put all messages with the same subject in the 'subject sequence.
-This function works when the folder is threaded. In this situation the subject
-could get truncated and so the normal matching doesn't work.
 
-The parameter ALL is non-nil then all the messages in the buffer are
-considered, otherwise only the messages after the current one are taken into
-account."
+This function works when the folder is threaded. In this
+situation the subject could get truncated and so the normal
+matching doesn't work.
+
+The parameter ALL is non-nil then all the messages in the buffer
+are considered, otherwise only the messages after the current one
+are taken into account."
   (let* ((cur (mh-get-msg-num nil))
          (subject (mh-thread-find-msg-subject cur))
          region msgs)
@@ -824,9 +851,9 @@
 
 (defun mh-pick-args-list (s)
   "Form list by grouping elements in string S suitable for pick arguments.
-For example, the string \"-subject a b c -from Joe User <user@domain.com>\"
-is converted to (\"-subject\" \"a b c\" \"-from\"
-\"Joe User <user@domain.com>\""
+For example, the string \"-subject a b c -from Joe User
+<user@domain.com>\" is converted to (\"-subject\" \"a b c\"
+\"-from\" \"Joe User <user@domain.com>\""
   (let ((full-list (split-string s))
         current-arg collection arg-list)
     (while full-list
@@ -857,7 +884,7 @@
 
 ;;;###mh-autoload
 (defun mh-narrow-to-from (&optional pick-expr)
-  "Limit to messages with the same `From:' field.
+  "Limit to messages with the same \"From:\" field.
 With a prefix argument, edit PICK-EXPR.
 
 Use \\<mh-folder-mode-map>\\[mh-widen] to undo this command."
@@ -867,7 +894,7 @@
 
 ;;;###mh-autoload
 (defun mh-narrow-to-cc (&optional pick-expr)
-  "Limit to messages with the same `Cc:' field.
+  "Limit to messages with the same \"Cc:\" field.
 With a prefix argument, edit PICK-EXPR.
 
 Use \\<mh-folder-mode-map>\\[mh-widen] to undo this command."
@@ -877,7 +904,7 @@
 
 ;;;###mh-autoload
 (defun mh-narrow-to-to (&optional pick-expr)
-  "Limit to messages with the same `To:' field.
+  "Limit to messages with the same \"To:\" field.
 With a prefix argument, edit PICK-EXPR.
 
 Use \\<mh-folder-mode-map>\\[mh-widen] to undo this command."
@@ -935,8 +962,8 @@
 (defun mh-narrow-to-range (range)
   "Limit to RANGE.
 
-Check the documentation of `mh-interactive-range' to see how RANGE is read in
-interactive use.
+Check the documentation of `mh-interactive-range' to see how
+RANGE is read in interactive use.
 
 Use \\<mh-folder-mode-map>\\[mh-widen] to undo this command."
   (interactive (list (mh-interactive-range "Narrow to")))
@@ -949,10 +976,11 @@
 (defun mh-delete-subject ()
   "Delete messages with same subject\\<mh-folder-mode-map>.
 
-To delete messages faster, you can use this command to delete all the messages
-with the same subject as the current message. This command puts these messages
-in a sequence named \"subject\". You can undo this action by using \\[mh-undo]
-with a prefix argument and then specifying the \"subject\" sequence."
+To delete messages faster, you can use this command to delete all
+the messages with the same subject as the current message. This
+command puts these messages in a sequence named \"subject\". You
+can undo this action by using \\[mh-undo] with a prefix argument
+and then specifying the \"subject\" sequence."
   (interactive)
   (let ((count (mh-subject-to-sequence nil)))
     (cond
@@ -969,13 +997,14 @@
 (defun mh-delete-subject-or-thread ()
   "Delete messages with same subject or thread\\<mh-folder-mode-map>.
 
-To delete messages faster, you can use this command to delete all the messages
-with the same subject as the current message. This command puts these messages
-in a sequence named \"subject\". You can undo this action by using \\[mh-undo]
-with a prefix argument and then specifying the \"subject\" sequence.
+To delete messages faster, you can use this command to delete all
+the messages with the same subject as the current message. This
+command puts these messages in a sequence named \"subject\". You
+can undo this action by using \\[mh-undo] with a prefix argument
+and then specifying the \"subject\" sequence.
 
-However, if the buffer is displaying a threaded view of the folder then this
-command behaves like \\[mh-thread-delete]."
+However, if the buffer is displaying a threaded view of the
+folder then this command behaves like \\[mh-thread-delete]."
   (interactive)
   (if (memq 'unthread mh-view-ops)
       (mh-thread-delete)
@@ -1005,8 +1034,8 @@
 
 (defsubst mh-thread-id-container (id)
   "Given ID, return the corresponding container in `mh-thread-id-table'.
-If no container exists then a suitable container is created and the id-table
-is updated."
+If no container exists then a suitable container is created and
+the id-table is updated."
   (when (not id)
     (error "1"))
   (or (gethash id mh-thread-id-table)
@@ -1027,9 +1056,9 @@
 
 (defsubst mh-thread-add-link (parent child &optional at-end-p)
   "Add links so that PARENT becomes a parent of CHILD.
-Doesn't make any changes if CHILD is already an ancestor of PARENT. If
-optional argument AT-END-P is non-nil, the CHILD is added to the end of the
-children list of PARENT."
+Doesn't make any changes if CHILD is already an ancestor of
+PARENT. If optional argument AT-END-P is non-nil, the CHILD is
+added to the end of the children list of PARENT."
   (let ((parent-container (cond ((null parent) nil)
                                 ((mh-thread-container-p parent) parent)
                                 (t (mh-thread-id-container parent))))
@@ -1053,8 +1082,8 @@
 
 (defun mh-thread-ancestor-p (ancestor successor)
   "Return t if ANCESTOR is really an ancestor of SUCCESSOR and nil otherwise.
-In the limit, the function returns t if ANCESTOR and SUCCESSOR are the same
-containers."
+In the limit, the function returns t if ANCESTOR and SUCCESSOR
+are the same containers."
   (block nil
     (while successor
       (when (eq ancestor successor) (return t))
@@ -1063,7 +1092,8 @@
 
 (defsubst mh-thread-get-message-container (message)
   "Return container which has MESSAGE in it.
-If there is no container present then a new container is allocated."
+If there is no container present then a new container is
+allocated."
   (let* ((id (mh-message-id message))
          (container (gethash id mh-thread-id-table)))
     (cond (container (setf (mh-container-message container) message)
@@ -1073,8 +1103,8 @@
 
 (defsubst mh-thread-get-message (id subject-re-p subject refs)
   "Return appropriate message.
-Otherwise update message already present to have the proper ID, SUBJECT-RE-P,
-SUBJECT and REFS fields."
+Otherwise update message already present to have the proper ID,
+SUBJECT-RE-P, SUBJECT and REFS fields."
   (let* ((container (gethash id mh-thread-id-table))
          (message (if container (mh-container-message container) nil)))
     (cond (message
@@ -1103,9 +1133,10 @@
 
 (defsubst mh-thread-prune-subject (subject)
   "Prune leading Re:'s, Fwd:'s etc. and trailing (fwd)'s from SUBJECT.
-If the result after pruning is not the empty string then it is canonicalized
-so that subjects can be tested for equality with eq. This is done so that all
-the messages without a subject are not put into a single thread."
+If the result after pruning is not the empty string then it is
+canonicalized so that subjects can be tested for equality with
+eq. This is done so that all the messages without a subject are
+not put into a single thread."
   (let ((case-fold-search t)
         (subject-pruned-flag nil))
     ;; Prune subject leader
@@ -1128,7 +1159,8 @@
 
 (defun mh-thread-container-subject (container)
   "Return the subject of CONTAINER.
-If CONTAINER is empty return the subject info of one of its children."
+If CONTAINER is empty return the subject info of one of its
+children."
   (cond ((and (mh-container-message container)
               (mh-message-id (mh-container-message container)))
          (mh-message-subject (mh-container-message container)))
@@ -1233,8 +1265,8 @@
 
 (defsubst mh-thread-group-by-subject (roots)
   "Group the set of message containers, ROOTS based on subject.
-Bug: Check for and make sure that something without Re: is made the parent in
-preference to something that has it."
+Bug: Check for and make sure that something without Re: is made
+the parent in preference to something that has it."
   (clrhash mh-thread-subject-container-hash)
   (let ((results ()))
     (dolist (root roots)
@@ -1251,9 +1283,9 @@
 
 (defun mh-thread-process-in-reply-to (reply-to-header)
   "Extract message id's from REPLY-TO-HEADER.
-Ideally this should have some regexp which will try to guess if a string
-between < and > is a message id and not an email address. For now it will
-take the last string inside angles."
+Ideally this should have some regexp which will try to guess if a
+string between < and > is a message id and not an email address.
+For now it will take the last string inside angles."
   (let ((end (mh-search-from-end ?> reply-to-header)))
     (when (numberp end)
       (let ((begin (mh-search-from-end ?< (substring reply-to-header 0 end))))
@@ -1279,9 +1311,9 @@
 
 (defsubst mh-thread-update-id-index-maps (id index)
   "Message with id, ID is the message in INDEX.
-The function also checks for duplicate messages (that is multiple messages
-with the same ID). These messages are put in the `mh-thread-duplicates' hash
-table."
+The function also checks for duplicate messages (that is multiple
+messages with the same ID). These messages are put in the
+`mh-thread-duplicates' hash table."
   (let ((old-index (gethash id mh-thread-id-index-map)))
     (when old-index (push old-index (gethash id mh-thread-duplicates)))
     (setf (gethash id mh-thread-id-index-map) index)
@@ -1383,9 +1415,9 @@
 
 (defun mh-thread-generate-scan-lines (tree level)
   "Generate scan lines.
-TREE is the hierarchical tree of messages, SCAN-LINE-MAP maps message indices
-to the corresponding scan lines and LEVEL used to determine indentation of
-the message."
+TREE is the hierarchical tree of messages, SCAN-LINE-MAP maps
+message indices to the corresponding scan lines and LEVEL used to
+determine indentation of the message."
   (cond ((null tree) nil)
         ((mh-thread-container-p tree)
          (let* ((message (mh-container-message tree))
@@ -1436,8 +1468,9 @@
 ;; the scan which generates the threading info. For now this will have to do.
 (defun mh-thread-parse-scan-line (&optional string)
   "Parse a scan line.
-If optional argument STRING is given then that is assumed to be the scan line.
-Otherwise uses the line at point as the scan line to parse."
+If optional argument STRING is given then that is assumed to be
+the scan line. Otherwise uses the line at point as the scan line
+to parse."
   (let* ((string (or string
                      (buffer-substring-no-properties (line-beginning-position)
                                                      (line-end-position))))
@@ -1583,7 +1616,8 @@
 (defun mh-thread-next-sibling (&optional previous-flag)
   "Display next sibling.
 
-With non-nil optional argument PREVIOUS-FLAG jump to the previous sibling."
+With non-nil optional argument PREVIOUS-FLAG jump to the previous
+sibling."
   (interactive)
   (cond ((not (memq 'unthread mh-view-ops))
          (error "Folder isn't threaded"))
@@ -1632,9 +1666,10 @@
 (defun mh-thread-ancestor (&optional thread-root-flag)
   "Display ancestor of current message.
 
-If you do not care for the way a particular thread has turned, you can move up
-the chain of messages with this command. This command can also take a prefix
-argument THREAD-ROOT-FLAG to jump to the message that started everything."
+If you do not care for the way a particular thread has turned,
+you can move up the chain of messages with this command. This
+command can also take a prefix argument THREAD-ROOT-FLAG to jump
+to the message that started everything."
   (interactive "P")
   (beginning-of-line)
   (cond ((not (memq 'unthread mh-view-ops))
@@ -1652,8 +1687,9 @@
 
 (defun mh-thread-find-children ()
   "Return a region containing the current message and its children.
-The result is returned as a list of two elements. The first is the point at the
-start of the region and the second is the point at the end."
+The result is returned as a list of two elements. The first is
+the point at the start of the region and the second is the point
+at the end."
   (beginning-of-line)
   (if (eobp)
       nil
@@ -1744,10 +1780,11 @@
 (defun mh-narrow-to-tick ()
   "Limit to ticked messages.
 
-What this command does is show only those messages that are in the \"tick\"
-sequence (which you can customize via the `mh-tick-seq' option) in the
-MH-Folder buffer. In addition, it limits further MH-E searches to just those
-messages. When you want to widen the view to all your messages again, use
+What this command does is show only those messages that are in
+the \"tick\" sequence (which you can customize via the
+`mh-tick-seq' option) in the MH-Folder buffer. In addition, it
+limits further MH-E searches to just those messages. When you
+want to widen the view to all your messages again, use
 \\[mh-widen]."
   (interactive)
   (cond ((not mh-tick-seq)
--- a/lisp/mh-e/mh-speed.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/mh-e/mh-speed.el	Thu Dec 29 04:41:02 2005 +0000
@@ -62,7 +62,8 @@
 ;;;###mh-autoload
 (defun mh-folder-speedbar-buttons (buffer)
   "Interface function to create MH-E speedbar buffer.
-BUFFER is the MH-E buffer for which the speedbar buffer is to be created."
+BUFFER is the MH-E buffer for which the speedbar buffer is to be
+created."
   (unless (get-text-property (point-min) 'mh-level)
     (erase-buffer)
     (clrhash mh-speed-folder-map)
@@ -125,11 +126,13 @@
 
 (defun mh-speed-update-current-folder (force)
   "Update speedbar highlighting of the current folder.
-The function tries to be smart so that work done is minimized. The currently
-highlighted folder is cached and no highlighting happens unless it changes.
+The function tries to be smart so that work done is minimized.
+The currently highlighted folder is cached and no highlighting
+happens unless it changes.
 Also highlighting is suspended while the speedbar frame is selected.
-Otherwise you get the disconcerting behavior of folders popping open on their
-own when you are trying to navigate around in the speedbar buffer.
+Otherwise you get the disconcerting behavior of folders popping open
+on their own when you are trying to navigate around in the speedbar
+buffer.
 
 The update is always carried out if FORCE is non-nil."
   (let* ((lastf (selected-frame))
@@ -237,7 +240,8 @@
 
 (defun mh-speed-extract-folder-name (buffer)
   "Given an MH-E BUFFER find the folder that should be highlighted.
-Do the right thing for the different kinds of buffers that MH-E uses."
+Do the right thing for the different kinds of buffers that MH-E
+uses."
   (save-excursion
     (set-buffer buffer)
     (cond ((eq major-mode 'mh-folder-mode)
@@ -353,8 +357,8 @@
 
 (defmacro mh-process-kill-without-query (process)
   "PROCESS can be killed without query on Emacs exit.
-Avoid using `process-kill-without-query' if possible since it is now
-obsolete."
+Avoid using `process-kill-without-query' if possible since it is
+now obsolete."
   (if (fboundp 'set-process-query-on-exit-flag)
       `(set-process-query-on-exit-flag ,process nil)
     `(process-kill-without-query ,process)))
@@ -364,8 +368,8 @@
   "Execute flists -recurse and update message counts.
 If FORCE is non-nil the timer is reset.
 
-Any number of optional FOLDERS can be specified. If specified, flists is run
-only for that one folder."
+Any number of optional FOLDERS can be specified. If specified,
+flists is run only for that one folder."
   (interactive (list t))
   (when force
     (when mh-speed-flists-timer
@@ -412,8 +416,8 @@
 ;; Copied from mh-make-folder-list-filter...
 (defun mh-speed-parse-flists-output (process output)
   "Parse the incremental results from flists.
-PROCESS is the flists process and OUTPUT is the results that must be handled
-next."
+PROCESS is the flists process and OUTPUT is the results that must
+be handled next."
   (let ((prevailing-match-data (match-data))
         (position 0)
         line-end line folder unseen total)
@@ -506,8 +510,9 @@
 (defun mh-speed-refresh ()
   "Regenerates the list of folders in the speedbar.
 
-Run this command if you've added or deleted a folder, or want to update the
-unseen message count before the next automatic update."
+Run this command if you've added or deleted a folder, or want to
+update the unseen message count before the next automatic
+update."
   (interactive)
   (mh-speed-flists t)
   (mh-speed-invalidate-map ""))
--- a/lisp/mh-e/mh-utils.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/mh-e/mh-utils.el	Thu Dec 29 04:41:02 2005 +0000
@@ -79,8 +79,8 @@
 
 (defun mh-search-from-end (char string)
   "Return the position of last occurrence of CHAR in STRING.
-If CHAR is not present in STRING then return nil. The function is used in lieu
-of `search' in the CL package."
+If CHAR is not present in STRING then return nil. The function is
+used in lieu of `search' in the CL package."
   (loop for index from (1- (length string)) downto 0
         when (equal (aref string index) char) return index
         finally return nil))
@@ -94,59 +94,73 @@
 
 (defvar mh-scan-msg-number-regexp "^ *\\([0-9]+\\)"
   "This regular expression extracts the message number.
-It must match from the beginning of the line. Note that the message number
-must be placed in a parenthesized expression as in the default of
-\"^ *\\\\([0-9]+\\\\)\".")
+
+It must match from the beginning of the line. Note that the
+message number must be placed in a parenthesized expression as in
+the default of \"^ *\\\\([0-9]+\\\\)\".")
 
 (defvar mh-scan-msg-overflow-regexp "^[?0-9][0-9]"
   "This regular expression matches overflowed message numbers.")
 
 (defvar mh-scan-msg-format-regexp "%\\([0-9]*\\)(msg)"
   "This regular expression finds the message number width in a scan format.
-Note that the message number must be placed in a parenthesized expression as
-in the default of \"%\\\\([0-9]*\\\\)(msg)\". This variable is only consulted
-if `mh-scan-format-file' is set to \"Use MH-E scan Format\".")
+
+Note that the message number must be placed in a parenthesized
+expression as in the default of \"%\\\\([0-9]*\\\\)(msg)\". This
+variable is only consulted if `mh-scan-format-file' is set to
+\"Use MH-E scan Format\".")
 
 (defvar mh-scan-msg-format-string "%d"
   "This is a format string for width of the message number in a scan format.
-Use `0%d' for zero-filled message numbers. This variable is only consulted if
-`mh-scan-format-file' is set to \"Use MH-E scan Format\".")
+
+Use \"0%d\" for zero-filled message numbers. This variable is only
+consulted if `mh-scan-format-file' is set to \"Use MH-E scan
+Format\".")
 
 (defvar mh-scan-msg-search-regexp "^[^0-9]*%d[^0-9]"
   "This regular expression matches a particular message.
-It is a format string; use `%d' to represent the location of the message
-number within the expression as in the default of \"^[^0-9]*%d[^0-9]\".")
+
+It is a format string; use \"%d\" to represent the location of the
+message number within the expression as in the default of
+\"^[^0-9]*%d[^0-9]\".")
 
 (defvar mh-cmd-note 4
   "Column for notations.
-This variable should be set with the function `mh-set-cmd-note'. This variable
-may be updated dynamically if `mh-adaptive-cmd-note-flag' is on.
+
+This variable should be set with the function `mh-set-cmd-note'.
+This variable may be updated dynamically if
+`mh-adaptive-cmd-note-flag' is on.
 
 Note that columns in Emacs start with 0.")
 (make-variable-buffer-local 'mh-cmd-note)
 
 (defvar mh-note-seq ?%
   "Messages in a user-defined sequence are marked by this character.
-Messages in the `search' sequence are marked by this character as well.")
+
+Messages in the \"search\" sequence are marked by this character as
+well.")
 
 
 
 (defvar mh-show-buffer-mode-line-buffer-id "    {show-%s} %d"
   "Format string to produce `mode-line-buffer-identification' for show buffers.
-First argument is folder name.  Second is message number.")
+
+First argument is folder name. Second is message number.")
 
 
 
 (defvar mh-mail-header-separator "--------"
   "*Line used by MH to separate headers from text in messages being composed.
-This variable should not be used directly in programs. Programs should use
-`mail-header-separator' instead. `mail-header-separator' is initialized to
-`mh-mail-header-separator' in `mh-letter-mode'; in other contexts, you may
-have to perform this initialization yourself.
 
-Do not make this a regular expression as it may be the argument to `insert'
-and it is passed through `regexp-quote' before being used by functions like
-`re-search-forward'.")
+This variable should not be used directly in programs. Programs
+should use `mail-header-separator' instead.
+`mail-header-separator' is initialized to
+`mh-mail-header-separator' in `mh-letter-mode'; in other
+contexts, you may have to perform this initialization yourself.
+
+Do not make this a regular expression as it may be the argument
+to `insert' and it is passed through `regexp-quote' before being
+used by functions like `re-search-forward'.")
 
 (defvar mh-signature-separator-regexp "^-- $"
   "This regular expression matches the signature separator.
@@ -154,11 +168,12 @@
 
 (defvar mh-signature-separator "-- \n"
   "Text of a signature separator.
-A signature separator is used to separate the body of a message from the
-signature. This can be used by user agents such as MH-E to render the
-signature differently or to suppress the inclusion of the signature in a
-reply.
-Use `mh-signature-separator-regexp' when searching for a separator.")
+
+A signature separator is used to separate the body of a message
+from the signature. This can be used by user agents such as MH-E
+to render the signature differently or to suppress the inclusion
+of the signature in a reply. Use `mh-signature-separator-regexp'
+when searching for a separator.")
 
 (defun mh-signature-separator-p ()
   "Return non-nil if buffer includes \"^-- $\"."
@@ -288,8 +303,9 @@
 
 (defun mh-goto-address-find-address-at-point ()
   "Find e-mail address around or before point.
-Then search backwards to beginning of line for the start of an e-mail
-address.  If no e-mail address found, return nil."
+
+Then search backwards to beginning of line for the start of an
+e-mail address. If no e-mail address found, return nil."
   (re-search-backward "[^-_A-z0-9.@]" (line-beginning-position) 'lim)
   (if (or (looking-at mh-address-mail-regexp)	; already at start
 	  (and (re-search-forward mh-address-mail-regexp
@@ -299,8 +315,10 @@
 
 (defun mh-mail-header-end ()
   "Substitute for `mail-header-end' that doesn't widen the buffer.
-In MH-E we frequently need to find the end of headers in nested messages, where
-the buffer has been narrowed. This function works in this situation."
+
+In MH-E we frequently need to find the end of headers in nested
+messages, where the buffer has been narrowed. This function works
+in this situation."
   (save-excursion
     ;; XXX: The following replaces a call to rfc822-goto-eoh. Occasionally,
     ;; mail headers that MH-E has to read contains lines of the form:
@@ -423,10 +441,11 @@
 (defun mh-show-font-lock-fontify-region (beg end loudly)
   "Limit font-lock in `mh-show-mode' to the header.
 
-Used when the option `mh-highlight-citation-style' is set to \"Gnus\", leaving
-the body to be dealt with by Gnus highlighting. The region between BEG and END
-is given over to be fontified and LOUDLY controls if a user sees a message
-about the fontification operation."
+Used when the option `mh-highlight-citation-style' is set to
+\"Gnus\", leaving the body to be dealt with by Gnus highlighting.
+The region between BEG and END is given over to be fontified and
+LOUDLY controls if a user sees a message about the fontification
+operation."
   (let ((header-end (mh-mail-header-end)))
     (cond
      ((and (< beg header-end)(< end header-end))
@@ -469,28 +488,27 @@
 
 ;;; Internal bookkeeping variables:
 
-;; Cached value of the `Path:' component in the user's MH profile.
-;; User's mail folder directory.
-(defvar mh-user-path nil)
+(defvar mh-user-path nil
+  "Cached value of the \"Path:\" MH profile component.
+User's mail folder directory.")
 
-;; An mh-draft-folder of nil means do not use a draft folder.
-;; Cached value of the `Draft-Folder:' component in the user's MH profile.
-;; Name of folder containing draft messages.
-(defvar mh-draft-folder nil)
+(defvar mh-draft-folder nil
+  "Cached value of the \"Draft-Folder:\" MH profile component.
+Name of folder containing draft messages.
+Nil means do not use a draft folder.")
 
-;; Cached value of the `Unseen-Sequence:' component in the user's MH profile.
-;; Name of the Unseen sequence.
-(defvar mh-unseen-seq nil)
+(defvar mh-unseen-seq nil
+  "Cached value of the \"Unseen-Sequence:\" MH profile component.
+Name of the Unseen sequence.")
 
-;; Cached value of the `Previous-Sequence:' component in the user's MH
-;; profile.
-;; Name of the Previous sequence.
-(defvar mh-previous-seq nil)
+(defvar mh-previous-seq nil
+  "Cached value of the \"Previous-Sequence:\" MH profile component.
+Name of the Previous sequence.")
 
-;; Cached value of the `Inbox:' component in the user's MH profile,
-;; or "+inbox" if no such component.
-;; Name of the Inbox folder.
-(defvar mh-inbox nil)
+(defvar mh-inbox nil
+  "Cached value of the \"Inbox:\" MH profile component.
+Set to \"+inbox\" if no such component.
+Name of the Inbox folder.")
 
 ;; The names of ephemeral buffers have a " *mh-" prefix (so that they are
 ;; hidden and can be programmatically removed in mh-quit), and the variable
@@ -511,33 +529,33 @@
 (defconst mh-recipients-buffer "*MH-E Recipients*") ;killed when draft sent
 (defconst mh-sequences-buffer "*MH-E Sequences*") ;sequences list
 
-;; Number of lines to keep in mh-log-buffer.
-(defvar mh-log-buffer-lines 100)
+(defvar mh-log-buffer-lines 100
+  "Number of lines to keep in `mh-log-buffer'.")
 
-;; Window configuration before MH-E command.
-(defvar mh-previous-window-config nil)
+(defvar mh-previous-window-config nil
+  "Window configuration before MH-E command.")
 
-;;Non-nil means next SPC or whatever goes to next undeleted message.
-(defvar mh-page-to-next-msg-flag nil)
+(defvar mh-page-to-next-msg-flag nil
+  "Non-nil means next SPC or whatever goes to next undeleted message.")
 
 
 
 ;;; Internal variables local to a folder.
 
-;; Name of current folder, a string.
-(defvar mh-current-folder nil)
+(defvar mh-current-folder nil
+  "Name of current folder, a string.")
 
-;; Buffer that displays message for this folder.
-(defvar mh-show-buffer nil)
+(defvar mh-show-buffer nil
+  "Buffer that displays message for this folder.")
 
-;; Full path of directory for this folder.
-(defvar mh-folder-filename nil)
+(defvar mh-folder-filename nil
+  "Full path of directory for this folder.")
 
-;;Number of msgs in buffer.
-(defvar mh-msg-count nil)
+(defvar mh-msg-count nil
+  "Number of msgs in buffer.")
 
-;; If non-nil, show the message in a separate window.
-(defvar mh-showing-mode nil)
+(defvar mh-showing-mode nil
+  "If non-nil, show the message in a separate window.")
 
 (defvar mh-show-mode-map (make-sparse-keymap)
   "Keymap used by the show buffer.")
@@ -566,25 +584,25 @@
             (cons modeline-buffer-id-left-extent "XEmacs%N:"))
           (cons modeline-buffer-id-right-extent " %17b")))))
 
-;; This holds a documentation string used by describe-mode.
 (defun mh-showing-mode (&optional arg)
   "Change whether messages should be displayed.
-With arg, display messages iff ARG is positive."
+
+With ARG, display messages iff ARG is positive."
   (setq mh-showing-mode
         (if (null arg)
             (not mh-showing-mode)
           (> (prefix-numeric-value arg) 0))))
 
-;; The sequences of this folder.  An alist of (seq . msgs).
-(defvar mh-seq-list nil)
+(defvar mh-seq-list nil
+  "Alist of this folder's sequences.
+Elements have the form (SEQUENCE . MESSAGES).")
 
-;; List of displayed messages to be removed from the Unseen sequence.
-(defvar mh-seen-list nil)
+(defvar mh-seen-list nil
+  "List of displayed messages to be removed from the \"Unseen\" sequence.")
 
-;; If non-nil, show buffer contains message with all headers.
-;; If nil, show buffer contains message processed normally.
-;; Showing message with headers or normally.
-(defvar mh-showing-with-headers nil)
+(defvar mh-showing-with-headers nil
+  "If non-nil, MH-Show buffer contains message with all header fields.
+If nil, MH-Show buffer contains message processed normally.")
 
 
 
@@ -594,8 +612,8 @@
   "Format is (with-mh-folder-updating (SAVE-MODIFICATION-FLAG) &body BODY).
 Execute BODY, which can modify the folder buffer without having to
 worry about file locking or the read-only flag, and return its result.
-If SAVE-MODIFICATION-FLAG is non-nil, the buffer's modification
-flag is unchanged, otherwise it is cleared."
+If SAVE-MODIFICATION-FLAG is non-nil, the buffer's modification flag
+is unchanged, otherwise it is cleared."
   (setq save-modification-flag (car save-modification-flag)) ; CL style
   `(prog1
        (let ((mh-folder-updating-mod-flag (buffer-modified-p))
@@ -627,8 +645,9 @@
 
 (defmacro mh-do-at-event-location (event &rest body)
   "Switch to the location of EVENT and execute BODY.
-After BODY has been executed return to original window. The modification flag
-of the buffer in the event window is preserved."
+After BODY has been executed return to original window. The
+modification flag of the buffer in the event window is
+preserved."
   (let ((event-window (make-symbol "event-window"))
         (event-position (make-symbol "event-position"))
         (original-window (make-symbol "original-window"))
@@ -672,9 +691,12 @@
 
 (defun mh-recenter (arg)
   "Like recenter but with three improvements:
+
 - At the end of the buffer it tries to show fewer empty lines.
+
 - operates only if the current buffer is in the selected window.
   (Commands like `save-some-buffers' can make this false.)
+
 - nil ARG means recenter as if prefix argument had been given."
   (cond ((not (eq (get-buffer-window (current-buffer)) (selected-window)))
          nil)
@@ -718,8 +740,8 @@
 
 (defun mh-get-msg-num (error-if-no-message)
   "Return the message number of the displayed message.
-If the argument ERROR-IF-NO-MESSAGE is non-nil, then complain if the cursor is
-not pointing to a message."
+If the argument ERROR-IF-NO-MESSAGE is non-nil, then complain if
+the cursor is not pointing to a message."
   (save-excursion
     (beginning-of-line)
     (cond ((looking-at mh-scan-msg-number-regexp)
@@ -731,7 +753,8 @@
 
 (defun mh-folder-name-p (name)
   "Return non-nil if NAME is the name of a folder.
-A name (a string or symbol) can be a folder name if it begins with \"+\"."
+A name (a string or symbol) can be a folder name if it begins
+with \"+\"."
   (if (symbolp name)
       (eq (aref (symbol-name name) 0) ?+)
     (and (> (length name) 0)
@@ -761,10 +784,10 @@
 (defmacro mh-defun-show-buffer (function original-function
                                          &optional dont-return)
   "Define FUNCTION to run ORIGINAL-FUNCTION in folder buffer.
-If the buffer we start in is still visible and DONT-RETURN is nil then switch
-to it after that."
+If the buffer we start in is still visible and DONT-RETURN is nil
+then switch to it after that."
   `(defun ,function ()
-     ,(format "Calls %s from the message's folder.\n%s\nSee `%s' for more info.\n"
+     ,(format "Calls %s from the message's folder.\n%s\nSee \"%s\" for more info.\n"
               original-function
               (if dont-return ""
                 "When function completes, returns to the show buffer if it is
@@ -1108,8 +1131,9 @@
 
 (define-derived-mode mh-show-mode text-mode "MH-Show"
   "Major mode for showing messages in MH-E.\\<mh-show-mode-map>
-The value of `mh-show-mode-hook' is a list of functions to
-be called, with no arguments, upon entry to this mode.
+
+The hook `mh-show-mode-hook' is called upon entry to this mode.
+
 See also `mh-folder-mode'.
 
 \\{mh-show-mode-map}"
@@ -1207,8 +1231,8 @@
 
 (defun mh-face-display-function ()
   "Display a Face, X-Face, or X-Image-URL header field.
-If more than one of these are present, then the first one found in this order
-is used."
+If more than one of these are present, then the first one found
+in this order is used."
   (save-restriction
     (goto-char (point-min))
     (re-search-forward "\n\n" (point-max) t)
@@ -1374,9 +1398,9 @@
 
 (defun mh-picon-file-contents (file)
   "Return details about FILE.
-A list of consisting of a symbol for the type of the file and the file
-contents as a string is returned. If FILE is nil, then both elements of the
-list are nil."
+A list of consisting of a symbol for the type of the file and the
+file contents as a string is returned. If FILE is nil, then both
+elements of the list are nil."
   (if (stringp file)
       (with-temp-buffer
         (let ((type (and (string-match ".*\\.\\(...\\)$" file)
@@ -1387,8 +1411,9 @@
 
 (defun mh-picon-generate-path (host-list user directory)
   "Generate the image file path.
-HOST-LIST is the parsed host address of the email address, USER the username
-and DIRECTORY is the directory relative to which the path is generated."
+HOST-LIST is the parsed host address of the email address, USER
+the username and DIRECTORY is the directory relative to which the
+path is generated."
   (loop with acc = ""
         for elem in host-list
         do (setq acc (format "%s/%s" elem acc))
@@ -1459,9 +1484,9 @@
 
 (defun mh-x-image-url-fetch-image (url cache-file marker sentinel)
   "Fetch and display the image specified by URL.
-After the image is fetched, it is stored in CACHE-FILE. It will be displayed
-in a buffer and position specified by MARKER. The actual display is carried
-out by the SENTINEL function."
+After the image is fetched, it is stored in CACHE-FILE. It will
+be displayed in a buffer and position specified by MARKER. The
+actual display is carried out by the SENTINEL function."
   (if mh-wget-executable
       (let ((buffer (get-buffer-create (generate-new-buffer-name
                                         mh-temp-fetch-buffer)))
@@ -1575,18 +1600,18 @@
 (defun mh-show (&optional message redisplay-flag)
   "Display message\\<mh-folder-mode-map>.
 
-If the message under the cursor is already displayed, this command scrolls to
-the beginning of the message. MH-E normally hides a lot of the superfluous
-header fields that mailers add to a message, but if you wish to see all of
-them, use the command \\[mh-header-display].
+If the message under the cursor is already displayed, this command
+scrolls to the beginning of the message. MH-E normally hides a lot of
+the superfluous header fields that mailers add to a message, but if
+you wish to see all of them, use the command \\[mh-header-display].
 
 From a program, optional argument MESSAGE can be used to display an
-alternative message. The optional argument REDISPLAY-FLAG forces the redisplay
-of the message even if the show buffer was already displaying the correct
-message.
+alternative message. The optional argument REDISPLAY-FLAG forces the
+redisplay of the message even if the show buffer was already
+displaying the correct message.
 
-See the \"mh-show\" customization group for a litany of options that control
-what displayed messages look like."
+See the \"mh-show\" customization group for a litany of options that
+control what displayed messages look like."
   (interactive (list nil t))
   (when (or redisplay-flag
             (and mh-showing-with-headers
@@ -1610,8 +1635,9 @@
 
 (defun mh-show-msg (msg)
   "Show MSG.
-The value of `mh-show-hook' is a list of functions to be called, with no
-arguments, after the message has been displayed."
+
+The hook `mh-show-hook' is called after the message has been
+displayed."
   (if (not msg)
       (setq msg (mh-get-msg-num t)))
   (mh-showing-mode t)
@@ -1654,10 +1680,11 @@
 (defun mh-modify (&optional message)
   "Edit message.
 
-There are times when you need to edit a message. For example, you may need to
-fix a broken Content-Type header field. You can do this with this command. It
-displays the raw message in an editable buffer. When you are done editing,
-save and kill the buffer as you would any other.
+There are times when you need to edit a message. For example, you
+may need to fix a broken Content-Type header field. You can do
+this with this command. It displays the raw message in an
+editable buffer. When you are done editing, save and kill the
+buffer as you would any other.
 
 From a program, edit MESSAGE instead if it is non-nil."
   (interactive)
@@ -1791,13 +1818,14 @@
 
 (defun mh-clean-msg-header (start invisible-headers visible-headers)
   "Flush extraneous lines in message header.
+
 Header is cleaned from START to the end of the message header.
-INVISIBLE-HEADERS contains a regular expression specifying lines to delete
-from the header. VISIBLE-HEADERS contains a regular expression specifying the
-lines to display. INVISIBLE-HEADERS is ignored if VISIBLE-HEADERS is non-nil.
-
-Note that MH-E no longer supports the `mh-visible-headers' variable, so
-this function could be trimmed of this feature too."
+INVISIBLE-HEADERS contains a regular expression specifying lines
+to delete from the header. VISIBLE-HEADERS contains a regular
+expression specifying the lines to display. INVISIBLE-HEADERS is
+ignored if VISIBLE-HEADERS is non-nil."
+  ;; XXX Note that MH-E no longer supports the `mh-visible-headers'
+  ;; variable, so this function could be trimmed of this feature too."
   (let ((case-fold-search t)
         (buffer-read-only nil)
         (after-change-functions nil))   ;Work around emacs-20 font-lock bug
@@ -1868,10 +1896,11 @@
 You can enter the message NUMBER either before or after typing
 \\[mh-goto-msg]. In the latter case, Emacs prompts you.
 
-In a program, optional non-nil second argument NO-ERROR-IF-NO-MESSAGE means
-return nil instead of signaling an error if message does not exist\; in this
-case, the cursor is positioned near where the message would have been. Non-nil
-third argument DONT-SHOW means not to show the message."
+In a program, optional non-nil second argument NO-ERROR-IF-NO-MESSAGE
+means return nil instead of signaling an error if message does not
+exist\; in this case, the cursor is positioned near where the message
+would have been. Non-nil third argument DONT-SHOW means not to show
+the message."
   (interactive "NGo to message: ")
   (setq number (prefix-numeric-value number))
   (let ((point (point))
@@ -1904,10 +1933,18 @@
 
 (defun mh-find-path ()
   "Set variables from user's MH profile.
-Set `mh-user-path', `mh-draft-folder', `mh-unseen-seq', `mh-previous-seq',
-`mh-inbox' from user's MH profile.
-The value of `mh-find-path-hook' is a list of functions to be called, with no
-arguments, after these variable have been set."
+
+This function sets `mh-user-path' from your \"Path:\" MH profile
+component (but defaults to \"Mail\" if one isn't present),
+`mh-draft-folder' from \"Draft-Folder:\", `mh-unseen-seq' from
+\"Unseen-Sequence:\", `mh-previous-seq' from
+\"Previous-Sequence:\", and `mh-inbox' from \"Inbox:\" (defaults
+to \"+inbox\").
+
+The hook `mh-find-path-hook' is run after these variables have
+been set. This hook can be used the change the value of these
+variables if you need to run with different values between MH and
+MH-E."
   (mh-variants)
   (unless mh-find-path-run
     (setq mh-find-path-run t)
@@ -1962,8 +1999,8 @@
 
 (defun mh-install (profile error-val)
   "Initialize the MH environment.
-This is called if we fail to read the PROFILE file. ERROR-VAL is the error
-that made this call necessary."
+This is called if we fail to read the PROFILE file. ERROR-VAL is
+the error that made this call necessary."
   (if (or (getenv "MH")
           (file-exists-p profile)
           mh-no-install)
@@ -1999,9 +2036,9 @@
 (defun mh-update-scan-format (fmt width)
   "Return a scan format with the (msg) width in the FMT replaced with WIDTH.
 
-The message number width portion of the format is discovered using
-`mh-scan-msg-format-regexp'. Its replacement is controlled with
-`mh-scan-msg-format-string'."
+The message number width portion of the format is discovered
+using `mh-scan-msg-format-regexp'. Its replacement is controlled
+with `mh-scan-msg-format-string'."
   (or (and
        (string-match mh-scan-msg-format-regexp fmt)
        (let ((begin (match-beginning 1))
@@ -2030,12 +2067,13 @@
 
 (defun mh-add-msgs-to-seq (msgs seq &optional internal-flag dont-annotate-flag)
   "Add MSGS to SEQ.
-Remove duplicates and keep sequence sorted. If optional INTERNAL-FLAG is
-non-nil, do not mark the message in the scan listing or inform MH of the
-addition.
 
-If DONT-ANNOTATE-FLAG is non-nil then the annotations in the folder buffer are
-not updated."
+Remove duplicates and keep sequence sorted. If optional
+INTERNAL-FLAG is non-nil, do not mark the message in the scan
+listing or inform MH of the addition.
+
+If DONT-ANNOTATE-FLAG is non-nil then the annotations in the
+folder buffer are not updated."
   (let ((entry (mh-find-seq seq))
         (internal-seq-flag (mh-internal-seq seq)))
     (if (and msgs (atom msgs)) (setq msgs (list msgs)))
@@ -2069,7 +2107,7 @@
 
 ;; Initialize mh-sub-folders-cache...
 (defun mh-collect-folder-names ()
-  "Collect folder names by running `flists'."
+  "Collect folder names by running \"flists\"."
   (unless mh-flists-process
     (setq mh-flists-process
           (mh-exec-cmd-daemon "folders" 'mh-collect-folder-names-filter
@@ -2077,8 +2115,8 @@
 
 (defun mh-collect-folder-names-filter (process output)
   "Read folder names.
-PROCESS is the flists process that was run to collect folder names and the
-function is called when OUTPUT is available."
+PROCESS is the flists process that was run to collect folder
+names and the function is called when OUTPUT is available."
   (let ((position 0)
 	(prevailing-match-data (match-data))
 	line-end folder)
@@ -2116,16 +2154,18 @@
 (defun mh-normalize-folder-name (folder &optional empty-string-okay
                                         dont-remove-trailing-slash)
   "Normalizes FOLDER name.
-Makes sure that two '/' characters never occur next to each other. Also all
-occurrences of \"..\" and \".\" are suitably processed. So \"+inbox/../news\"
-will be normalized to \"+news\".
+
+Makes sure that two '/' characters never occur next to each
+other. Also all occurrences of \"..\" and \".\" are suitably
+processed. So \"+inbox/../news\" will be normalized to \"+news\".
 
-If optional argument EMPTY-STRING-OKAY is nil then a '+' is added at the
-front if FOLDER lacks one. If non-nil and FOLDER is the empty string then
-nothing is added.
+If optional argument EMPTY-STRING-OKAY is nil then a '+' is added
+at the front if FOLDER lacks one. If non-nil and FOLDER is the
+empty string then nothing is added.
 
-If optional argument DONT-REMOVE-TRAILING-SLASH is non-nil then a trailing '/'
-if present is retained (if present), otherwise it is removed."
+If optional argument DONT-REMOVE-TRAILING-SLASH is non-nil then a
+trailing '/' if present is retained (if present), otherwise it is
+removed."
   (when (stringp folder)
     ;; Replace two or more consecutive '/' characters with a single '/'
     (while (string-match "//" folder)
@@ -2168,11 +2208,12 @@
 
 (defun mh-sub-folders (folder &optional add-trailing-slash-flag)
   "Find the subfolders of FOLDER.
-The function avoids running folders unnecessarily by caching the results of
-the actual folders call.
+The function avoids running folders unnecessarily by caching the
+results of the actual folders call.
 
-If optional argument ADD-TRAILING-SLASH-FLAG is non-nil then a slash is added
-to each of the sub-folder names that may have nested folders within them."
+If optional argument ADD-TRAILING-SLASH-FLAG is non-nil then a
+slash is added to each of the sub-folder names that may have
+nested folders within them."
   (let* ((folder (mh-normalize-folder-name folder))
          (match (gethash folder mh-sub-folders-cache 'no-result))
          (sub-folders (cond ((eq match 'no-result)
@@ -2187,8 +2228,8 @@
 
 (defun mh-sub-folders-actual (folder)
   "Execute the command folders to return the sub-folders of FOLDER.
-Filters out the folder names that start with \".\" so that directories that
-aren't usually mail folders are hidden."
+Filters out the folder names that start with \".\" so that
+directories that aren't usually mail folders are hidden."
   (let ((arg-list `(,(expand-file-name "folders" mh-progs)
                     nil (t nil) nil "-noheader" "-norecurse" "-nototal"
                     ,@(if (stringp folder) (list folder) ())))
@@ -2235,13 +2276,15 @@
 
 (defun mh-remove-from-sub-folders-cache (folder)
   "Remove FOLDER and its parent from `mh-sub-folders-cache'.
-FOLDER should be unconditionally removed from the cache. Also the last ancestor
-of FOLDER present in the cache must be removed as well.
+FOLDER should be unconditionally removed from the cache. Also the
+last ancestor of FOLDER present in the cache must be removed as
+well.
 
-To see why this is needed assume we have a folder +foo which has a single
-sub-folder qux. Now we create the folder +foo/bar/baz. Here we will need to
-invalidate the cached sub-folders of +foo, otherwise completion on +foo won't
-tell us about the option +foo/bar!"
+To see why this is needed assume we have a folder +foo which has
+a single sub-folder qux. Now we create the folder +foo/bar/baz.
+Here we will need to invalidate the cached sub-folders of +foo,
+otherwise completion on +foo won't tell us about the option
++foo/bar!"
   (remhash folder mh-sub-folders-cache)
   (block ancestor-found
     (let ((parent folder)
@@ -2262,8 +2305,9 @@
 
 (defvar mh-allow-root-folder-flag nil
   "Non-nil means \"+\" is an acceptable folder name.
-This variable is used to communicate with `mh-folder-completion-function'. That
-function can have exactly three arguments so we bind this variable to t or nil.
+This variable is used to communicate with
+`mh-folder-completion-function'. That function can have exactly
+three arguments so we bind this variable to t or nil.
 
 This variable should never be set.")
 
@@ -2280,9 +2324,9 @@
 
 (defun mh-folder-completion-function (name predicate flag)
   "Programmable completion for folder names.
-NAME is the partial folder name that has been input. PREDICATE if non-nil is a
-function that is used to filter the possible choices and FLAG determines
-whether the completion is over."
+NAME is the partial folder name that has been input. PREDICATE if
+non-nil is a function that is used to filter the possible choices
+and FLAG determines whether the completion is over."
   (let* ((orig-name name)
          (name (mh-normalize-folder-name name nil t))
          (last-slash (mh-search-from-end ?/ name))
@@ -2317,8 +2361,8 @@
 
 (defun mh-folder-completing-read (prompt default allow-root-folder-flag)
   "Read folder name with PROMPT and default result DEFAULT.
-If ALLOW-ROOT-FOLDER-FLAG is non-nil then \"+\" is allowed to be a folder name
-corresponding to `mh-user-path'."
+If ALLOW-ROOT-FOLDER-FLAG is non-nil then \"+\" is allowed to be
+a folder name corresponding to `mh-user-path'."
   (mh-normalize-folder-name
    (let ((minibuffer-completing-file-name t)
          (completion-root-regexp "^[+/]")
@@ -2331,12 +2375,13 @@
 (defun mh-prompt-for-folder (prompt default can-create
                              &optional default-string allow-root-folder-flag)
   "Prompt for a folder name with PROMPT.
-Returns the folder's name as a string. DEFAULT is used if the folder exists
-and the user types return. If the CAN-CREATE flag is t, then a folder is
-created if it doesn't already exist. If optional argument DEFAULT-STRING is
-non-nil, use it in the prompt instead of DEFAULT. If ALLOW-ROOT-FOLDER-FLAG is
-non-nil then the function will accept the folder +, which means all folders
-when used in searching."
+Returns the folder's name as a string. DEFAULT is used if the
+folder exists and the user types return. If the CAN-CREATE flag
+is t, then a folder is created if it doesn't already exist. If
+optional argument DEFAULT-STRING is non-nil, use it in the prompt
+instead of DEFAULT. If ALLOW-ROOT-FOLDER-FLAG is non-nil then the
+function will accept the folder +, which means all folders when
+used in searching."
   (if (null default)
       (setq default ""))
   (let* ((default-string (cond (default-string (format " (default %s)" default-string))
@@ -2389,9 +2434,10 @@
 
 (defun mh-truncate-log-buffer ()
   "If `mh-log-buffer' is too big then truncate it.
-If the number of lines in `mh-log-buffer' exceeds `mh-log-buffer-lines' then
-keep only the last `mh-log-buffer-lines'. As a side effect the point is set to
-the end of the log buffer.
+If the number of lines in `mh-log-buffer' exceeds
+`mh-log-buffer-lines' then keep only the last
+`mh-log-buffer-lines'. As a side effect the point is set to the
+end of the log buffer.
 
 The function returns the size of the final size of the log buffer."
   (with-current-buffer (get-buffer-create mh-log-buffer)
@@ -2411,9 +2457,9 @@
 
 (defun mh-exec-cmd (command &rest args)
   "Execute mh-command COMMAND with ARGS.
-The side effects are what is desired.
-Any output is assumed to be an error and is shown to the user.
-The output is not read or parsed by MH-E."
+The side effects are what is desired. Any output is assumed to be
+an error and is shown to the user. The output is not read or
+parsed by MH-E."
   (save-excursion
     (set-buffer (get-buffer-create mh-log-buffer))
     (let* ((initial-size (mh-truncate-log-buffer))
@@ -2450,9 +2496,9 @@
 (defun mh-exec-cmd-daemon (command filter &rest args)
   "Execute MH command COMMAND in the background.
 
-If FILTER is non-nil then it is used to process the output otherwise the
-default filter `mh-process-daemon' is used. See `set-process-filter' for more
-details of FILTER.
+If FILTER is non-nil then it is used to process the output
+otherwise the default filter `mh-process-daemon' is used. See
+`set-process-filter' for more details of FILTER.
 
 ARGS are passed to COMMAND as command line arguments."
   (save-excursion
@@ -2472,9 +2518,9 @@
 ENV is nil or a string of space-separated \"var=value\" elements.
 Signals an error if process does not complete successfully.
 
-If FILTER is non-nil then it is used to process the output otherwise the
-default filter `mh-process-daemon' is used. See `set-process-filter' for more
-details of FILTER.
+If FILTER is non-nil then it is used to process the output
+otherwise the default filter `mh-process-daemon' is used. See
+`set-process-filter' for more details of FILTER.
 
 ARGS are passed to COMMAND as command line arguments."
   (let ((process-environment process-environment))
@@ -2484,17 +2530,20 @@
 
 (defun mh-process-daemon (process output)
   "PROCESS daemon that puts OUTPUT into a temporary buffer.
-Any output from the process is displayed in an asynchronous pop-up window."
+Any output from the process is displayed in an asynchronous
+pop-up window."
   (set-buffer (get-buffer-create mh-log-buffer))
   (insert-before-markers output)
   (display-buffer mh-log-buffer))
 
 (defun mh-exec-cmd-quiet (raise-error command &rest args)
   "Signal RAISE-ERROR if COMMAND with ARGS fails.
-Execute MH command COMMAND with ARGS.  ARGS is a list of strings.
-Return at start of mh-temp buffer, where output can be parsed and used.
-Returns value of `call-process', which is 0 for success, unless RAISE-ERROR is
-non-nil, in which case an error is signaled if `call-process' returns non-0."
+Execute MH command COMMAND with ARGS. ARGS is a list of strings.
+Return at start of mh-temp buffer, where output can be parsed and
+used.
+Returns value of `call-process', which is 0 for success, unless
+RAISE-ERROR is non-nil, in which case an error is signaled if
+`call-process' returns non-0."
   (set-buffer (get-buffer-create mh-temp-buffer))
   (erase-buffer)
   (let ((value
@@ -2514,8 +2563,8 @@
 
 (defun mh-exchange-point-and-mark-preserving-active-mark ()
   "Put the mark where point is now, and point where the mark is now.
-This command works even when the mark is not active, and preserves whether the
-mark is active or not."
+This command works even when the mark is not active, and
+preserves whether the mark is active or not."
   (interactive nil)
   (let ((is-active (and (boundp 'mark-active) mark-active)))
     (let ((omark (mark t)))
@@ -2529,7 +2578,8 @@
 
 (defun mh-exec-cmd-output (command display &rest args)
   "Execute MH command COMMAND with DISPLAY flag and ARGS.
-Put the output into buffer after point.  Set mark after inserted text.
+Put the output into buffer after point.
+Set mark after inserted text.
 Output is expected to be shown to user, not parsed by MH-E."
   (push-mark (point) t)
   (apply 'call-process
@@ -2545,7 +2595,8 @@
 
 (defun mh-exec-lib-cmd-output (command &rest args)
   "Execute MH library command COMMAND with ARGS.
-Put the output into buffer after point.  Set mark after inserted text."
+Put the output into buffer after point.
+Set mark after inserted text."
   (apply 'mh-exec-cmd-output (expand-file-name command mh-lib-progs) nil args))
 
 (defun mh-handle-process-error (command status)
@@ -2597,11 +2648,13 @@
   "Replace REGEXP with NEWTEXT everywhere in STRING and return result.
 NEWTEXT is taken literally---no \\DIGIT escapes will be recognized.
 
-The function body was copied from `dired-replace-in-string' in dired.el.
-Emacs21 has `replace-regexp-in-string' while XEmacs has `replace-in-string'.
-Neither is present in Emacs20. The file gnus-util.el in Gnus 5.10.1 and above
-has `gnus-replace-in-string'. We should use that when we decide to not support
-older versions of Gnus."
+The function body was copied from `dired-replace-in-string' in
+dired.el.
+Emacs21 has `replace-regexp-in-string' while XEmacs has
+`replace-in-string'.
+Neither is present in Emacs20. The file gnus-util.el in Gnus 5.10.1
+and above has `gnus-replace-in-string'. We should use that when we
+decide to not support older versions of Gnus."
   (let ((result "") (start 0) mb me)
     (while (string-match regexp string start)
       (setq mb (match-beginning 0)
--- a/lisp/mouse.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/mouse.el	Thu Dec 29 04:41:02 2005 +0000
@@ -2230,7 +2230,7 @@
 	  (setq beg (previous-single-property-change beg 'mouse-face))
 	  (setq end (or (next-single-property-change end 'mouse-face)
 			(point-max)))
-	  (setq choice (buffer-substring beg end)))))
+	  (setq choice (buffer-substring-no-properties beg end)))))
     (let ((owindow (selected-window)))
       (select-window (posn-window (event-start event)))
       (if (and (one-window-p t 'selected-frame)
--- a/lisp/progmodes/cpp.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/progmodes/cpp.el	Thu Dec 29 04:41:02 2005 +0000
@@ -189,7 +189,7 @@
    '(("default" . default)
      ("invisible" . invisible))
    "Alist of names and faces available even if you don't use a window system."
-  :type '(repeat (cons string face))
+  :type '(repeat (cons string cpp-face))
   :group 'cpp)
 
 (defvar cpp-face-all-list
--- a/lisp/progmodes/delphi.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/progmodes/delphi.el	Thu Dec 29 04:41:02 2005 +0000
@@ -177,7 +177,7 @@
 
 (defcustom delphi-other-face nil
   "*Face used to color everything else."
-  :type 'face
+  :type '(choice face (const nil))
   :group 'delphi)
 
 (defconst delphi-directives
--- a/lisp/progmodes/gud.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/progmodes/gud.el	Thu Dec 29 04:41:02 2005 +0000
@@ -3263,7 +3263,6 @@
 (defcustom gud-tooltip-modes '(gud-mode c-mode c++-mode fortran-mode)
   "List of modes for which to enable GUD tooltips."
   :type 'sexp
-  :tag "GUD modes"
   :group 'gud
   :group 'tooltip)
 
@@ -3275,7 +3274,6 @@
 Forms in the list are combined with AND.  The default is to display
 only tooltips in the buffer containing the overlay arrow."
   :type 'sexp
-  :tag "GUD buffers predicate"
   :group 'gud
   :group 'tooltip)
 
--- a/lisp/savehist.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/savehist.el	Thu Dec 29 04:41:02 2005 +0000
@@ -129,7 +129,8 @@
 
 (defcustom savehist-mode-hook nil
   "Hook called when `savehist-mode' is turned on."
-  :type 'hook)
+  :type 'hook
+  :group 'savehist)
 
 (defcustom savehist-save-hook nil
   "Hook called by `savehist-save' before saving the variables.
--- a/lisp/simple.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/simple.el	Thu Dec 29 04:41:02 2005 +0000
@@ -52,15 +52,15 @@
   "Highlight (un)matching of parens and expressions."
   :group 'matching)
 
-(defun get-next-valid-buffer (list &optional buffer visible-ok frame) "\
-Search LIST for a valid buffer to display in FRAME.
+(defun get-next-valid-buffer (list &optional buffer visible-ok frame)
+  "Search LIST for a valid buffer to display in FRAME.
 Return nil when all buffers in LIST are undesirable for display,
 otherwise return the first suitable buffer in LIST.
 
 Buffers not visible in windows are preferred to visible buffers,
 unless VISIBLE-OK is non-nil.
 If the optional argument FRAME is nil, it defaults to the selected frame.
-If BUFFER is non-nil, ignore occurances of that buffer in LIST."
+If BUFFER is non-nil, ignore occurrences of that buffer in LIST."
   ;; This logic is more or less copied from other-buffer.
   (setq frame (or frame (selected-frame)))
   (let ((pred (frame-parameter frame 'buffer-predicate))
@@ -76,8 +76,8 @@
 	(setq list (cdr list))))
     (car list)))
 
-(defun last-buffer (&optional buffer visible-ok frame) "\
-Return the last non-hidden displayable buffer in the buffer list.
+(defun last-buffer (&optional buffer visible-ok frame)
+  "Return the last non-hidden displayable buffer in the buffer list.
 If BUFFER is non-nil, last-buffer will ignore that buffer.
 Buffers not visible in windows are preferred to visible buffers,
 unless optional argument VISIBLE-OK is non-nil.
@@ -184,7 +184,7 @@
 that normally would not qualify.  If it returns t, the buffer
 in question is treated as usable.
 
-The function EXTRA-TEST-EXCLUSIVE, if non-nil is called in each buffer
+The function EXTRA-TEST-EXCLUSIVE, if non-nil, is called in each buffer
 that would normally be considered usable.  If it returns nil,
 that buffer is rejected."
   (and (buffer-name buffer)		;First make sure it's live.
@@ -203,6 +203,7 @@
 					 extra-test-inclusive
 					 extra-test-exclusive)
   "Return a `next-error' capable buffer.
+
 If AVOID-CURRENT is non-nil, treat the current buffer
 as an absolute last resort only.
 
@@ -210,7 +211,7 @@
 that normally would not qualify.  If it returns t, the buffer
 in question is treated as usable.
 
-The function EXTRA-TEST-EXCLUSIVE, if non-nil is called in each buffer
+The function EXTRA-TEST-EXCLUSIVE, if non-nil, is called in each buffer
 that would normally be considered usable.  If it returns nil,
 that buffer is rejected."
   (or
@@ -1137,7 +1138,7 @@
   "Control whether history list elements are expressions or strings.
 If the value of this variable equals current minibuffer depth,
 they are expressions; otherwise they are strings.
-\(That convention is designed to do the right thing fora
+\(That convention is designed to do the right thing for
 recursive uses of the minibuffer.)")
 (setq minibuffer-history-variable 'minibuffer-history)
 (setq minibuffer-history-position nil)
--- a/lisp/textmodes/flyspell.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/textmodes/flyspell.el	Thu Dec 29 04:41:02 2005 +0000
@@ -324,7 +324,7 @@
   "This function is used for `flyspell-generic-check-word-p' in LaTeX mode."
   (and
    (not (save-excursion
-	  (re-search-backward "^[ \t]*%%%[ \t]+Local" (point-min) t)))
+	  (re-search-backward "^[ \t]*%%%[ \t]+Local" nil t)))
    (not (save-excursion
 	  (let ((this (point-marker))
 		(e (progn (end-of-line) (point-marker))))
@@ -753,7 +753,7 @@
 	   (backward-char 1)
 	   (and (looking-at (flyspell-get-not-casechars))
 		(or flyspell-consider-dash-as-word-delimiter-flag
-		    (not (looking-at "\\-"))))))
+		    (not (looking-at "-"))))))
     ;; yes because we have reached or typed a word delimiter.
     t)
    ((symbolp this-command)
@@ -1225,10 +1225,10 @@
     ;; find the word
     (if (not (looking-at flyspell-casechars))
 	(if following
-	    (re-search-forward flyspell-casechars (point-max) t)
-	  (re-search-backward flyspell-casechars (point-min) t)))
+	    (re-search-forward flyspell-casechars nil t)
+	  (re-search-backward flyspell-casechars nil t)))
     ;; move to front of word
-    (re-search-backward flyspell-not-casechars (point-min) 'start)
+    (re-search-backward flyspell-not-casechars nil 'start)
     (while (and (or (and (not (string= "" ispell-otherchars))
 			 (looking-at ispell-otherchars))
 		    (and extra-otherchars (looking-at extra-otherchars)))
@@ -1240,15 +1240,15 @@
 	  (progn
 	    (backward-char 1)
 	    (if (looking-at flyspell-casechars)
-		(re-search-backward flyspell-not-casechars (point-min) 'move)))
+		(re-search-backward flyspell-not-casechars nil 'move)))
 	(setq did-it-once t
 	      prevpt (point))
 	(backward-char 1)
 	(if (looking-at flyspell-casechars)
-	    (re-search-backward flyspell-not-casechars (point-min) 'move)
+	    (re-search-backward flyspell-not-casechars nil 'move)
 	  (backward-char -1))))
     ;; Now mark the word and save to string.
-    (if (not (re-search-forward word-regexp (point-max) t))
+    (if (not (re-search-forward word-regexp nil t))
 	nil
       (progn
 	(setq start (match-beginning 0)
@@ -1312,7 +1312,7 @@
     (with-current-buffer flyspell-external-ispell-buffer
       (goto-char (point-min))
       ;; Loop over incorrect words.
-      (while (re-search-forward "\\([^\n]+\\)\n" (point-max) t)
+      (while (re-search-forward "\\([^\n]+\\)\n" nil t)
 	;; Bind WORD to the next one.
 	(let ((word (match-string 1)) (wordpos (point)))
 	  ;; Here there used to be code to see if WORD is the same
--- a/lisp/tool-bar.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/tool-bar.el	Thu Dec 29 04:41:02 2005 +0000
@@ -233,7 +233,7 @@
   ;; might inadvertently click that button.
   ;;(tool-bar-add-item-from-menu 'save-buffers-kill-emacs "exit")
   (tool-bar-add-item-from-menu 'find-file "new")
-  (tool-bar-add-item-from-menu 'find-file-existing "open")
+  (tool-bar-add-item-from-menu 'menu-find-file-existing "open")
   (tool-bar-add-item-from-menu 'dired "diropen")
   (tool-bar-add-item-from-menu 'kill-this-buffer "close")
   (tool-bar-add-item-from-menu 'save-buffer "save" nil
--- a/lisp/url/ChangeLog	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/url/ChangeLog	Thu Dec 29 04:41:02 2005 +0000
@@ -1,3 +1,9 @@
+2005-12-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* url-cookie.el (url-cookie-write-file): Create parent dir.
+
+	* url.el (url-configuration-directory): Use ~/.emacs.d if possible.
+
 2005-12-07  Klaus Straubinger  <KSNetz@Arcor.DE>  (tiny change)
 
 	* url-cookie.el (url-cookie-save-interval): Simplify.
--- a/lisp/url/url-cookie.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/url/url-cookie.el	Thu Dec 29 04:41:02 2005 +0000
@@ -148,6 +148,8 @@
 ;;;###autoload
 (defun url-cookie-write-file (&optional fname)
   (setq fname (or fname url-cookie-file))
+  (unless (file-directory-p (file-name-directory fname))
+    (ignore-errors (make-directory (file-name-directory fname))))
   (cond
    ((not url-cookies-changed-since-last-save) nil)
    ((not (file-writable-p fname))
@@ -155,8 +157,7 @@
    (t
     (url-cookie-clean-up)
     (url-cookie-clean-up t)
-    (save-excursion
-      (set-buffer (get-buffer-create " *cookies*"))
+    (with-current-buffer (get-buffer-create " *cookies*")
       (erase-buffer)
       (fundamental-mode)
       (insert ";; Emacs-W3 HTTP cookies file\n"
--- a/lisp/url/url.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/url/url.el	Thu Dec 29 04:41:02 2005 +0000
@@ -48,7 +48,11 @@
 
 ;; Fixme: customize? convert-standard-filename?
 ;;;###autoload
-(defvar url-configuration-directory "~/.url")
+(defvar url-configuration-directory
+  (cond
+   ((file-directory-p "~/.url") "~/.url")
+   ((file-directory-p "~/.emacs.d") "~/.emacs.d/url")
+   (t "~/.url")))
 
 (defun url-do-setup ()
   "Setup the url package.
--- a/lisp/vc.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/vc.el	Thu Dec 29 04:41:02 2005 +0000
@@ -469,12 +469,12 @@
   :group 'tools)
 
 (defcustom vc-suppress-confirm nil
-  "*If non-nil, treat user as expert; suppress yes-no prompts on some things."
+  "If non-nil, treat user as expert; suppress yes-no prompts on some things."
   :type 'boolean
   :group 'vc)
 
 (defcustom vc-delete-logbuf-window t
-  "*If non-nil, delete the *VC-log* buffer and window after each logical action.
+  "If non-nil, delete the *VC-log* buffer and window after each logical action.
 If nil, bury that buffer instead.
 This is most useful if you have multiple windows on a frame and would like to
 preserve the setting."
@@ -482,12 +482,12 @@
   :group 'vc)
 
 (defcustom vc-initial-comment nil
-  "*If non-nil, prompt for initial comment when a file is registered."
+  "If non-nil, prompt for initial comment when a file is registered."
   :type 'boolean
   :group 'vc)
 
 (defcustom vc-default-init-version "1.1"
-  "*A string used as the default version number when a new file is registered.
+  "A string used as the default version number when a new file is registered.
 This can be overridden by giving a prefix argument to \\[vc-register].  This
 can also be overridden by a particular VC backend."
   :type 'string
@@ -495,12 +495,12 @@
   :version "20.3")
 
 (defcustom vc-command-messages nil
-  "*If non-nil, display run messages from back-end commands."
+  "If non-nil, display run messages from back-end commands."
   :type 'boolean
   :group 'vc)
 
 (defcustom vc-checkin-switches nil
-  "*A string or list of strings specifying extra switches for checkin.
+  "A string or list of strings specifying extra switches for checkin.
 These are passed to the checkin program by \\[vc-checkin]."
   :type '(choice (const :tag "None" nil)
 		 (string :tag "Argument String")
@@ -510,7 +510,7 @@
   :group 'vc)
 
 (defcustom vc-checkout-switches nil
-  "*A string or list of strings specifying extra switches for checkout.
+  "A string or list of strings specifying extra switches for checkout.
 These are passed to the checkout program by \\[vc-checkout]."
   :type '(choice (const :tag "None" nil)
 		 (string :tag "Argument String")
@@ -520,7 +520,7 @@
   :group 'vc)
 
 (defcustom vc-register-switches nil
-  "*A string or list of strings; extra switches for registering a file.
+  "A string or list of strings; extra switches for registering a file.
 These are passed to the checkin program by \\[vc-register]."
   :type '(choice (const :tag "None" nil)
 		 (string :tag "Argument String")
@@ -530,30 +530,30 @@
   :group 'vc)
 
 (defcustom vc-dired-listing-switches "-al"
-  "*Switches passed to `ls' for vc-dired.  MUST contain the `l' option."
+  "Switches passed to `ls' for vc-dired.  MUST contain the `l' option."
   :type 'string
   :group 'vc
   :version "21.1")
 
 (defcustom vc-dired-recurse t
-  "*If non-nil, show directory trees recursively in VC Dired."
+  "If non-nil, show directory trees recursively in VC Dired."
   :type 'boolean
   :group 'vc
   :version "20.3")
 
 (defcustom vc-dired-terse-display t
-  "*If non-nil, show only locked files in VC Dired."
+  "If non-nil, show only locked files in VC Dired."
   :type 'boolean
   :group 'vc
   :version "20.3")
 
 (defcustom vc-directory-exclusion-list '("SCCS" "RCS" "CVS" "MCVS" ".svn" "{arch}")
-  "*List of directory names to be ignored when walking directory trees."
+  "List of directory names to be ignored when walking directory trees."
   :type '(repeat string)
   :group 'vc)
 
 (defcustom vc-diff-switches nil
-  "*A string or list of strings specifying switches for diff under VC.
+  "A string or list of strings specifying switches for diff under VC.
 When running diff under a given BACKEND, VC concatenates the values of
 `diff-switches', `vc-diff-switches', and `vc-BACKEND-diff-switches' to
 get the switches for that command.  Thus, `vc-diff-switches' should
@@ -568,7 +568,7 @@
   :version "21.1")
 
 (defcustom vc-allow-async-revert nil
-  "*Specifies whether the diff during \\[vc-revert-buffer] may be asynchronous.
+  "Specifies whether the diff during \\[vc-revert-buffer] may be asynchronous.
 Enabling this option means that you can confirm a revert operation even
 if the local changes in the file have not been found and displayed yet."
   :type '(choice (const :tag "No" nil)
@@ -578,7 +578,7 @@
 
 ;;;###autoload
 (defcustom vc-checkout-hook nil
-  "*Normal hook (list of functions) run after checking out a file.
+  "Normal hook (list of functions) run after checking out a file.
 See `run-hooks'."
   :type 'hook
   :group 'vc
@@ -595,7 +595,7 @@
 
 ;;;###autoload
 (defcustom vc-checkin-hook nil
-  "*Normal hook (list of functions) run after a checkin is done.
+  "Normal hook (list of functions) run after a checkin is done.
 See also `log-edit-done-hook'."
   :type 'hook
   :options '(log-edit-comment-to-change-log)
@@ -603,13 +603,13 @@
 
 ;;;###autoload
 (defcustom vc-before-checkin-hook nil
-  "*Normal hook (list of functions) run before a file is checked in.
+  "Normal hook (list of functions) run before a file is checked in.
 See `run-hooks'."
   :type 'hook
   :group 'vc)
 
 (defcustom vc-logentry-check-hook nil
-  "*Normal hook run by `vc-backend-logentry-check'.
+  "Normal hook run by `vc-backend-logentry-check'.
 Use this to impose your own rules on the entry in addition to any the
 version control backend imposes itself."
   :type 'hook
@@ -634,25 +634,25 @@
     (300. . "#00CCFF")
     (320. . "#00CC99")
     (340. . "#0099FF"))
-  "*Association list of age versus color, for \\[vc-annotate].
+  "Association list of age versus color, for \\[vc-annotate].
 Ages are given in units of fractional days.  Default is eighteen steps
 using a twenty day increment."
   :type 'alist
   :group 'vc)
 
 (defcustom vc-annotate-very-old-color "#0046FF"
-  "*Color for lines older than the current color range in \\[vc-annotate]]."
+  "Color for lines older than the current color range in \\[vc-annotate]]."
   :type 'string
   :group 'vc)
 
 (defcustom vc-annotate-background "black"
-  "*Background color for \\[vc-annotate].
+  "Background color for \\[vc-annotate].
 Default color is used if nil."
   :type 'string
   :group 'vc)
 
 (defcustom vc-annotate-menu-elements '(2 0.5 0.1 0.01)
-  "*Menu elements for the mode-specific menu of VC-Annotate mode.
+  "Menu elements for the mode-specific menu of VC-Annotate mode.
 List of factors, used to expand/compress the time scale.  See `vc-annotate'."
   :type '(repeat number)
   :group 'vc)
@@ -660,24 +660,23 @@
 (defvar vc-annotate-mode-map
   (let ((m (make-sparse-keymap)))
     (define-key m [menu-bar] (make-sparse-keymap "VC-Annotate"))
+    (define-key m "A" 'vc-annotate-revision-previous-to-line)
+    (define-key m "D" 'vc-annotate-show-diff-revision-at-line)
+    (define-key m "J" 'vc-annotate-revision-at-line)
+    (define-key m "L" 'vc-annotate-show-log-revision-at-line)
+    (define-key m "N" 'vc-annotate-next-version)
+    (define-key m "P" 'vc-annotate-prev-version)
+    (define-key m "W" 'vc-annotate-workfile-version)
     m)
   "Local keymap used for VC-Annotate mode.")
 
-(define-key vc-annotate-mode-map "A" 'vc-annotate-revision-previous-to-line)
-(define-key vc-annotate-mode-map "D" 'vc-annotate-show-diff-revision-at-line)
-(define-key vc-annotate-mode-map "J" 'vc-annotate-revision-at-line)
-(define-key vc-annotate-mode-map "L" 'vc-annotate-show-log-revision-at-line)
-(define-key vc-annotate-mode-map "N" 'vc-annotate-next-version)
-(define-key vc-annotate-mode-map "P" 'vc-annotate-prev-version)
-(define-key vc-annotate-mode-map "W" 'vc-annotate-workfile-version)
-
 (defvar vc-annotate-mode-menu nil
   "Local keymap used for VC-Annotate mode's menu bar menu.")
 
 ;; Header-insertion hair
 
 (defcustom vc-static-header-alist
-  '(("\\.c$" .
+  '(("\\.c\\'" .
      "\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n#endif /* lint */\n"))
   "*Associate static header string templates with file types.
 A \%s in the template is replaced with the first string associated with
@@ -713,9 +712,7 @@
 ;; Variables the user doesn't need to know about.
 (defvar vc-log-operation nil)
 (defvar vc-log-after-operation-hook nil)
-(defvar vc-annotate-buffers nil
-  "Alist of current \"Annotate\" buffers and their corresponding backends.
-The keys are \(BUFFER . BACKEND\).  See also `vc-annotate-get-backend'.")
+
 ;; In a log entry buffer, this is a local variable
 ;; that points to the buffer for which it was made
 ;; (either a file, or a VC dired buffer).
@@ -1367,6 +1364,8 @@
 
 ;; These functions help the vc-next-action entry point
 
+(defun vc-default-init-version (backend) vc-default-init-version)
+
 ;;;###autoload
 (defun vc-register (&optional set-version comment)
   "Register the current file into a version control system.
@@ -1398,10 +1397,8 @@
                   (if set-version
                       (read-string (format "Initial version level for %s: "
 					   (buffer-name)))
-		    (let ((backend (vc-responsible-backend buffer-file-name)))
-		      (if (vc-find-backend-function backend 'init-version)
-			  (vc-call-backend backend 'init-version)
-			vc-default-init-version)))
+		    (vc-call-backend (vc-responsible-backend buffer-file-name)
+				     'init-version))
                   (or comment (not vc-initial-comment))
 		  nil
                   "Enter initial comment."
@@ -1937,24 +1934,19 @@
       (widen)
       (if (or (not (vc-check-headers))
 	      (y-or-n-p "Version headers already exist.  Insert another set? "))
-	  (progn
-	    (let* ((delims (cdr (assq major-mode vc-comment-alist)))
-		   (comment-start-vc (or (car delims) comment-start "#"))
-		   (comment-end-vc (or (car (cdr delims)) comment-end ""))
-		   (hdsym (vc-make-backend-sym (vc-backend buffer-file-name)
-					       'header))
-		   (hdstrings (and (boundp hdsym) (symbol-value hdsym))))
-	      (mapcar (lambda (s)
-			(insert comment-start-vc "\t" s "\t"
-				comment-end-vc "\n"))
-		      hdstrings)
-	      (if vc-static-header-alist
-		  (mapcar (lambda (f)
-			    (if (string-match (car f) buffer-file-name)
-				(insert (format (cdr f) (car hdstrings)))))
-			  vc-static-header-alist))
-	      )
-	    )))))
+          (let* ((delims (cdr (assq major-mode vc-comment-alist)))
+                 (comment-start-vc (or (car delims) comment-start "#"))
+                 (comment-end-vc (or (car (cdr delims)) comment-end ""))
+                 (hdsym (vc-make-backend-sym (vc-backend buffer-file-name)
+                                             'header))
+                 (hdstrings (and (boundp hdsym) (symbol-value hdsym))))
+            (dolist (s hdstrings)
+              (insert comment-start-vc "\t" s "\t"
+                      comment-end-vc "\n"))
+            (if vc-static-header-alist
+                (dolist (f vc-static-header-alist)
+                  (if (string-match (car f) buffer-file-name)
+                      (insert (format (cdr f) (car hdstrings)))))))))))
 
 (defun vc-clear-headers (&optional file)
   "Clear all version headers in the current buffer (or FILE).
@@ -2897,8 +2889,7 @@
                                           (concat odefault f))))
                                      files)))
                        "done"
-		     (pop-to-buffer
-		      (set-buffer (get-buffer-create "*vc*")))
+		     (pop-to-buffer (get-buffer-create "*vc*"))
 		     (erase-buffer)
 		     (insert-file-contents tempfile)
 		     "failed"))
@@ -2913,9 +2904,9 @@
 ;; annotate-mode, which replaces it with the more sensible "span-to
 ;; days", along with autoscaling support.
 (defvar vc-annotate-ratio nil "Global variable.")
-(defvar vc-annotate-backend nil "Global variable.")
 
 ;; internal buffer-local variables
+(defvar vc-annotate-backend nil)
 (defvar vc-annotate-parent-file nil)
 (defvar vc-annotate-parent-rev nil)
 (defvar vc-annotate-parent-display-mode nil)
@@ -2924,12 +2915,6 @@
   ;; The fontification is done by vc-annotate-lines instead of font-lock.
   '((vc-annotate-lines)))
 
-(defun vc-annotate-get-backend (buffer)
-  "Return the backend matching \"Annotate\" buffer BUFFER.
-Return nil if no match made.  Associations are made based on
-`vc-annotate-buffers'."
-  (cdr (assoc buffer vc-annotate-buffers)))
-
 (define-derived-mode vc-annotate-mode fundamental-mode "Annotate"
   "Major mode for output buffers of the `vc-annotate' command.
 
@@ -2939,8 +2924,7 @@
   (set (make-local-variable 'truncate-lines) t)
   (set (make-local-variable 'font-lock-defaults)
        '(vc-annotate-font-lock-keywords t))
-  (view-mode 1)
-  (vc-annotate-add-menu))
+  (view-mode 1))
 
 (defun vc-annotate-display-default (&optional ratio)
   "Display the output of \\[vc-annotate] using the default color range.
@@ -2952,6 +2936,10 @@
    (if ratio (vc-annotate-time-span vc-annotate-color-map ratio)))
   (message "Redisplaying annotation...done"))
 
+(defun vc-annotate-car-last-cons (a-list)
+  "Return car of last cons in association list A-LIST."
+  (caar (last a-list)))
+
 (defun vc-annotate-display-autoscale (&optional full)
   "Highlight the output of \\[vc-annotate] using an autoscaled color map.
 Autoscaling means that the map is scaled from the current time to the
@@ -2987,70 +2975,48 @@
 	       (format "Spanned to %.1f days old" (- current oldest))))))
 
 ;; Menu -- Using easymenu.el
-(defun vc-annotate-add-menu ()
-  "Add the menu 'Annotate' to the menu bar in VC-Annotate mode."
-  (let ((menu-elements vc-annotate-menu-elements)
-	(menu-def
-	 '("VC-Annotate"
-	   ["Default" (unless (null vc-annotate-display-mode)
-			(setq vc-annotate-display-mode nil)
-			(vc-annotate-display-select))
-	    :style toggle :selected (null vc-annotate-display-mode)]))
-	(oldest-in-map (vc-annotate-car-last-cons vc-annotate-color-map)))
-    (while menu-elements
-      (let* ((element (car menu-elements))
-	     (days (* element oldest-in-map)))
-	(setq menu-elements (cdr menu-elements))
-	(setq menu-def
-	      (append menu-def
-		      `([,(format "Span %.1f days" days)
-			 (unless (and (numberp vc-annotate-display-mode)
-				      (= vc-annotate-display-mode ,days))
-			   (vc-annotate-display-select nil ,days))
-			 :style toggle :selected
-			 (and (numberp vc-annotate-display-mode)
-			      (= vc-annotate-display-mode ,days)) ])))))
-    (setq menu-def
-	  (append menu-def
-		  (list
-		   ["Span ..."
-		    (let ((days
-			   (float (string-to-number
-				   (read-string "Span how many days? ")))))
-		      (vc-annotate-display-select nil days)) t])
-		  (list "--")
-		  (list
-		   ["Span to Oldest"
-		    (unless (eq vc-annotate-display-mode 'scale)
-		      (vc-annotate-display-select nil 'scale))
-		    :style toggle :selected
-		    (eq vc-annotate-display-mode 'scale)])
-		  (list
-		   ["Span Oldest->Newest"
-		    (unless (eq vc-annotate-display-mode 'fullscale)
-		      (vc-annotate-display-select nil 'fullscale))
-		    :style toggle :selected
-		    (eq vc-annotate-display-mode 'fullscale)])
-		  (list "--")
-		  (list ["Annotate previous revision"
-			 (call-interactively 'vc-annotate-prev-version)])
-		  (list ["Annotate next revision"
-			 (call-interactively 'vc-annotate-next-version)])
-		  (list ["Annotate revision at line"
-			 (vc-annotate-revision-at-line)])
-		  (list ["Annotate revision previous to line"
-			 (vc-annotate-revision-previous-to-line)])
-		  (list ["Annotate latest revision"
-			 (vc-annotate-workfile-version)])
-		  (list ["Show log of revision at line"
-			 (vc-annotate-show-log-revision-at-line)])
-		  (list ["Show diff of revision at line"
-			 (vc-annotate-show-diff-revision-at-line)])))
-
-    ;; Define the menu
-    (if (or (featurep 'easymenu) (load "easymenu" t))
-	(easy-menu-define vc-annotate-mode-menu vc-annotate-mode-map
-			  "VC Annotate Display Menu" menu-def))))
+(easy-menu-define vc-annotate-mode-menu vc-annotate-mode-map
+  "VC Annotate Display Menu"
+  `("VC-Annotate"
+    ["Default" (unless (null vc-annotate-display-mode)
+                 (setq vc-annotate-display-mode nil)
+                 (vc-annotate-display-select))
+     :style toggle :selected (null vc-annotate-display-mode)]
+    ,@(let ((oldest-in-map (vc-annotate-car-last-cons vc-annotate-color-map)))
+        (mapcar (lambda (element)
+                  (let ((days (* element oldest-in-map)))
+                    `([,(format "Span %.1f days" days)
+                       (unless (and (numberp vc-annotate-display-mode)
+                                    (= vc-annotate-display-mode ,days))
+                         (vc-annotate-display-select nil ,days))
+                       :style toggle :selected
+                       (and (numberp vc-annotate-display-mode)
+                            (= vc-annotate-display-mode ,days)) ])))
+                vc-annotate-menu-elements))
+    ["Span ..."
+     (let ((days
+            (float (string-to-number
+                    (read-string "Span how many days? ")))))
+       (vc-annotate-display-select nil days)) t]
+    "--"
+    ["Span to Oldest"
+     (unless (eq vc-annotate-display-mode 'scale)
+       (vc-annotate-display-select nil 'scale))
+     :style toggle :selected
+     (eq vc-annotate-display-mode 'scale)]
+    ["Span Oldest->Newest"
+     (unless (eq vc-annotate-display-mode 'fullscale)
+       (vc-annotate-display-select nil 'fullscale))
+     :style toggle :selected
+     (eq vc-annotate-display-mode 'fullscale)]
+    "--"
+    ["Annotate previous revision" vc-annotate-prev-version]
+    ["Annotate next revision" vc-annotate-next-version]
+    ["Annotate revision at line" vc-annotate-revision-at-line]
+    ["Annotate revision previous to line" vc-annotate-revision-previous-to-line]
+    ["Annotate latest revision" vc-annotate-workfile-version]
+    ["Show log of revision at line" vc-annotate-show-log-revision-at-line]
+    ["Show diff of revision at line" vc-annotate-show-diff-revision-at-line]))
 
 (defun vc-annotate-display-select (&optional buffer mode)
   "Highlight the output of \\[vc-annotate].
@@ -3083,7 +3049,7 @@
 ;;;;  the contents in BUFFER.
 
 ;;;###autoload
-(defun vc-annotate (prefix &optional revision display-mode)
+(defun vc-annotate (file rev &optional display-mode buf)
   "Display the edit history of the current file using colors.
 
 This command creates a buffer that shows, for each line of the current
@@ -3108,48 +3074,44 @@
 mode-specific menu. `vc-annotate-color-map' and
 `vc-annotate-very-old-color' defines the mapping of time to
 colors. `vc-annotate-background' specifies the background color."
-  (interactive "P")
+  (interactive
+   (save-current-buffer
+     (vc-ensure-vc-buffer)
+     (list buffer-file-name
+	   (let ((def (vc-workfile-version buffer-file-name)))
+	     (if (null current-prefix-arg) def
+	       (read-string
+		(format "Annotate from version (default %s): " def)
+		nil nil def)))
+	   (if (null current-prefix-arg)
+	       vc-annotate-display-mode
+	     (float (string-to-number
+		     (read-string "Annotate span days (default 20): "
+				  nil nil "20")))))))
   (vc-ensure-vc-buffer)
-  (let* ((temp-buffer-name nil)
-         (temp-buffer-show-function 'vc-annotate-display-select)
-	 (rev (or revision (vc-workfile-version buffer-file-name)))
-	 (bfn buffer-file-name)
-         (vc-annotate-version
-	  (if prefix (read-string
-		      (format "Annotate from version (default %s): " rev)
-		      nil nil rev)
-	    rev)))
-    (if display-mode
-	(setq vc-annotate-display-mode display-mode)
-      (if prefix
-	  (setq vc-annotate-display-mode
-		(float (string-to-number
-			(read-string "Annotate span days (default 20): "
-				     nil nil "20"))))))
-    (setq temp-buffer-name (format "*Annotate %s (rev %s)*"
-				   (buffer-name) vc-annotate-version))
-    (setq vc-annotate-backend (vc-backend buffer-file-name))
+  (setq vc-annotate-display-mode display-mode) ;Not sure why.  --Stef
+  (let* ((temp-buffer-name (format "*Annotate %s (rev %s)*" (buffer-name) rev))
+         (temp-buffer-show-function 'vc-annotate-display-select))
     (message "Annotating...")
+    ;; If BUF is specified it tells in which buffer we should put the
+    ;; annotations.  This is used when switching annotations to another
+    ;; revision, so we should update the buffer's name.
+    (if buf (with-current-buffer buf
+	      (rename-buffer temp-buffer-name t)
+	      ;; In case it had to be uniquified.
+	      (setq temp-buffer-name (buffer-name))))
     (if (not (vc-find-backend-function vc-annotate-backend 'annotate-command))
 	(error "Sorry, annotating is not implemented for %s"
 	       vc-annotate-backend))
     (with-output-to-temp-buffer temp-buffer-name
-      (vc-call-backend vc-annotate-backend 'annotate-command
-		       buffer-file-name
-		       (get-buffer temp-buffer-name)
-                       vc-annotate-version))
-    (save-excursion
-      (set-buffer temp-buffer-name)
-      (set (make-local-variable 'vc-annotate-parent-file) bfn)
-      (set (make-local-variable 'vc-annotate-parent-rev) vc-annotate-version)
+      (vc-call annotate-command file (get-buffer temp-buffer-name) rev))
+    (with-current-buffer temp-buffer-name
+      (set (make-local-variable 'vc-annotate-backend) (vc-backend file))
+      (set (make-local-variable 'vc-annotate-parent-file) file)
+      (set (make-local-variable 'vc-annotate-parent-rev) rev)
       (set (make-local-variable 'vc-annotate-parent-display-mode)
-	   vc-annotate-display-mode))
+	   display-mode))
 
-    ;; Don't use the temp-buffer-name until the buffer is created
-    ;; (only after `with-output-to-temp-buffer'.)
-    (setq vc-annotate-buffers
-	  (append vc-annotate-buffers
-		  (list (cons (get-buffer temp-buffer-name) vc-annotate-backend))))
   (message "Annotating... done")))
 
 (defun vc-annotate-prev-version (prefix)
@@ -3274,21 +3236,13 @@
        ((stringp revspec) (setq newrev revspec))
        (t (error "Invalid argument to vc-annotate-warp-version")))
       (when newrev
-	(save-window-excursion
-	  (find-file vc-annotate-parent-file)
-	  (vc-annotate nil newrev vc-annotate-parent-display-mode))
-	(kill-buffer (current-buffer)) ;; kill the buffer we started from
-	(switch-to-buffer (car (car (last vc-annotate-buffers))))
+	(vc-annotate vc-annotate-parent-file newrev
+                     vc-annotate-parent-display-mode
+                     (current-buffer))
 	(goto-line (min oldline (progn (goto-char (point-max))
 				       (previous-line)
 				       (line-number-at-pos))))))))
 
-(defun vc-annotate-car-last-cons (a-list)
-  "Return car of last cons in association list A-LIST."
-  (if (not (eq nil (cdr a-list)))
-      (vc-annotate-car-last-cons (cdr a-list))
-    (car (car a-list))))
-
 (defun vc-annotate-time-span (a-list span &optional quantize)
   "Apply factor SPAN to the time-span of association list A-LIST.
 Return the new alist.
--- a/lisp/w32-fns.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/w32-fns.el	Thu Dec 29 04:41:02 2005 +0000
@@ -456,6 +456,18 @@
 (setq interprogram-cut-function 'x-select-text)
 (setq interprogram-paste-function 'x-get-selection-value)
 
+
+;;;; Support for build process
+(defun w32-batch-update-autoloads ()
+  "Like `batch-update-autoloads', but takes the name of the autoloads file
+from the command line.
+
+This is required because some Windows build environments, such as MSYS,
+munge command-line arguments that include file names to a horrible mess
+that Emacs is unable to cope with."
+  (let ((generated-autoload-file
+	 (expand-file-name (pop command-line-args-left))))
+    (batch-update-autoloads)))
 
 ;;; arch-tag: c49b48cc-0f4f-454f-a274-c2dc34815e14
 ;;; w32-fns.el ends here
--- a/lisp/wid-edit.el	Thu Dec 29 04:31:04 2005 +0000
+++ b/lisp/wid-edit.el	Thu Dec 29 04:41:02 2005 +0000
@@ -2988,7 +2988,7 @@
 
 (define-widget 'file 'string
   "A file widget.
-It will read a file name from the minibuffer when invoked."
+It reads a file name from an editable text field."
   :complete-function 'widget-file-complete
   :prompt-value 'widget-file-prompt-value
   :format "%{%t%}: %v"
@@ -3050,7 +3050,7 @@
 ;; Fixme: use file-name-as-directory.
 (define-widget 'directory 'file
   "A directory widget.
-It will read a directory name from the minibuffer when invoked."
+It reads a directory name from an editable text field."
   :tag "Directory")
 
 (defvar widget-symbol-prompt-value-history nil
--- a/lispref/ChangeLog	Thu Dec 29 04:31:04 2005 +0000
+++ b/lispref/ChangeLog	Thu Dec 29 04:41:02 2005 +0000
@@ -1,3 +1,17 @@
+2005-12-23  Richard M. Stallman  <rms@gnu.org>
+
+	* text.texi (Undo): Restore some explanation from the version
+	that was deleted.
+
+2005-12-23  Eli Zaretskii  <eliz@gnu.org>
+
+	* text.texi (Undo): Remove dupliate descriptions of `apply
+	funname' and `apply delta' elements of the undo list.
+
+2005-12-20  Richard M. Stallman  <rms@gnu.org>
+
+	* help.texi (Help Functions): Update documentation of `apropos'.
+
 2005-12-20  Luc Teirlinck  <teirllm@auburn.edu>
 
 	* customize.texi (Type Keywords): Delete xref to "Text help-echo",
--- a/lispref/help.texi	Thu Dec 29 04:31:04 2005 +0000
+++ b/lispref/help.texi	Thu Dec 29 04:41:02 2005 +0000
@@ -520,7 +520,8 @@
 The function returns a list of elements that look like this:
 
 @example
-(@var{symbol} @var{score} @var{fn-doc} @var{var-doc} @var{plist-doc} @var{widget-doc} @var{face-doc} @var{group-doc})
+(@var{symbol} @var{score} @var{fn-doc} @var{var-doc}
+ @var{plist-doc} @var{widget-doc} @var{face-doc} @var{group-doc})
 @end example
 
 Here, @var{score} is an integer measure of how important the symbol
--- a/lispref/text.texi	Thu Dec 29 04:31:04 2005 +0000
+++ b/lispref/text.texi	Thu Dec 29 04:41:02 2005 +0000
@@ -470,6 +470,9 @@
 
 In an interactive call, @var{count} is the numeric prefix argument.
 
+Self-insertion translates the input character through
+@code{translation-table-for-input}.  @xref{Translation of Characters}.
+
 This command calls @code{auto-fill-function} whenever that is
 non-@code{nil} and the character inserted is in the table
 @code{auto-fill-chars} (@pxref{Auto Filling}).
@@ -477,10 +480,9 @@
 @c Cross refs reworded to prevent overfull hbox.  --rjc 15mar92
 This command performs abbrev expansion if Abbrev mode is enabled and
 the inserted character does not have word-constituent
-syntax. (@xref{Abbrevs}, and @ref{Syntax Class Table}.)
-
-This is also responsible for calling @code{blink-paren-function} when
-the inserted character has close parenthesis syntax (@pxref{Blinking}).
+syntax. (@xref{Abbrevs}, and @ref{Syntax Class Table}.)  It is also
+responsible for calling @code{blink-paren-function} when the inserted
+character has close parenthesis syntax (@pxref{Blinking}).
 
 Do not try substituting your own definition of
 @code{self-insert-command} for the standard one.  The editor command
@@ -1241,19 +1243,6 @@
 (put-text-property @var{beg} @var{end} @var{property} @var{value})
 @end example
 
-@item (apply @var{funname} . @var{args})
-This kind of element records a change that can be undone by evaluating
-(@code{apply} @var{funname} @var{args}).
-
-@item (apply @var{delta} @var{beg} @var{end} @var{funname} . @var{args})
-This kind of element records a change that can be undone by evaluating
-(@code{apply} @var{funname} @var{args}).  The integer values @var{beg}
-and @var{end} is buffer positions of the range affected by this change
-and @var{delta} is an integer value which is the number of bytes added
-or deleted in that range by this change.  This kind of element
-enables undo limited to a region to determine whether the element
-pertains to that region.
-
 @item (@var{marker} . @var{adjustment})
 This kind of element records the fact that the marker @var{marker} was
 relocated due to deletion of surrounding text, and that it moved
@@ -1270,6 +1259,9 @@
 by @var{delta}.  It is undone by calling @var{funname} with arguments
 @var{args}.
 
+This kind of element enables undo limited to a region to determine
+whether the element pertains to that region.
+
 @item nil
 This element is a boundary.  The elements between two boundaries are
 called a @dfn{change group}; normally, each change group corresponds to
@@ -1806,7 +1798,7 @@
 rearranges the order of the elements of a list (@pxref{Rearrangement}).
 The values returned by these functions are not meaningful.
 
-@defun sort-subr reverse nextrecfun endrecfun &optional startkeyfun endkeyfun
+@defun sort-subr reverse nextrecfun endrecfun &optional startkeyfun endkeyfun predicate
 This function is the general text-sorting routine that subdivides a
 buffer into records and then sorts them.  Most of the commands in this
 section use this function.
@@ -1860,6 +1852,10 @@
 non-@code{nil} value.
 @end enumerate
 
+The argument @var{predicate} is the function to use to compare keys.
+If keys are numbers, it defaults to @code{<}; otherwise it defaults to
+@code{string<}.
+
 As an example of @code{sort-subr}, here is the complete function
 definition for @code{sort-lines}:
 
--- a/man/ChangeLog	Thu Dec 29 04:31:04 2005 +0000
+++ b/man/ChangeLog	Thu Dec 29 04:41:02 2005 +0000
@@ -1,10 +1,36 @@
+2005-12-24  Chong Yidong  <cyd@stupidchicken.com>
+
+	* custom.texi (Custom Themes): `load-theme' always loads.
+
+2005-12-23  Juri Linkov  <juri@jurta.org>
+
+	* display.texi (Highlight Interactively): Use double space to
+	separate sentences.  Replace C-p with M-p, and C-n with M-n.
+
+2005-12-22  Richard M. Stallman  <rms@gnu.org>
+
+	* custom.texi (Easy Customization and subnodes):
+	Replace "active field" with "button".
+	Use "user option" only for variables.
+	Use "setting" for variable-or-face.
+
+2005-12-22  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* buffers.texi (Select Buffer): Change order in table to make
+	"Similar" refer to the correct item.
+	(Indirect Buffers): Minor rewording.
+
+2005-12-21  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* widget.texi (atoms): Delete obsolete remark about `file' widget.
+
 2005-12-20  Juri Linkov  <juri@jurta.org>
 
 	* files.texi (VC Status): Put P and N near p and n.
 
 2005-12-20  Carsten Dominik  <dominik@science.uva.nl>
 
-	* org.texi: (Tags): Boolean logic documented.
+	* org.texi (Tags): Boolean logic documented.
 	(Agenda Views): Document custom commands.
 
 2005-12-20  David Kastrup  <dak@gnu.org>
--- a/man/buffers.texi	Thu Dec 29 04:31:04 2005 +0000
+++ b/man/buffers.texi	Thu Dec 29 04:41:02 2005 +0000
@@ -67,16 +67,16 @@
 @table @kbd
 @item C-x b @var{buffer} @key{RET}
 Select or create a buffer named @var{buffer} (@code{switch-to-buffer}).
-@item C-x @key{LEFT}
-Select the previous buffer in the list of existing buffers.
-@item C-x @key{RIGHT}
-Select the next buffer in the list of existing buffers.
 @item C-x 4 b @var{buffer} @key{RET}
 Similar, but select @var{buffer} in another window
 (@code{switch-to-buffer-other-window}).
 @item C-x 5 b @var{buffer} @key{RET}
 Similar, but select @var{buffer} in a separate frame
 (@code{switch-to-buffer-other-frame}).
+@item C-x @key{LEFT}
+Select the previous buffer in the list of existing buffers.
+@item C-x @key{RIGHT}
+Select the next buffer in the list of existing buffers.
 @item C-u M-g M-g
 @itemx C-u M-g g
 Read a number @var{n} and move to line @var{n} in the most recently
@@ -530,11 +530,10 @@
 @kbd{M-x clone-indirect-buffer}.  It creates and selects an indirect
 buffer whose base buffer is the current buffer.  With a numeric
 argument, it prompts for the name of the indirect buffer; otherwise it
-defaults to the name of the current buffer, modifying it by adding a
-@samp{<@var{n}>} suffix if required.  @kbd{C-x 4 c}
-(@code{clone-indirect-buffer-other-window}) works like @kbd{M-x
-clone-indirect-buffer}, but it selects the new buffer in another
-window.
+uses the name of the current buffer, with a @samp{<@var{n}>} suffix
+added.  @kbd{C-x 4 c} (@code{clone-indirect-buffer-other-window})
+works like @kbd{M-x clone-indirect-buffer}, but it selects the new
+buffer in another window.
 
   The more general way to make an indirect buffer is with the command
 @kbd{M-x make-indirect-buffer}.  It creates an indirect buffer from
--- a/man/custom.texi	Thu Dec 29 04:31:04 2005 +0000
+++ b/man/custom.texi	Thu Dec 29 04:41:02 2005 +0000
@@ -34,7 +34,7 @@
 @menu
 * Minor Modes::		Each minor mode is one feature you can turn on
 			  independently of any others.
-* Easy Customization::  Convenient way to browse and change user options.
+* Easy Customization::  Convenient way to browse and change settings.
 * Variables::		Many Emacs commands examine Emacs variables
 			  to decide what to do; by setting variables,
 			  you can control their functioning.
@@ -183,31 +183,31 @@
 @node Easy Customization
 @section Easy Customization Interface
 
-@cindex user option
-  Emacs has many @dfn{user options} which have values that you can set
-in order to customize various commands.  Many user options are
-documented in this manual.  Most user options are actually Lisp
-variables (@pxref{Variables}), so their names appear in the Variable
-Index (@pxref{Variable Index}).  The rest are faces and their
-attributes (@pxref{Faces}).
+@cindex settings
+  Emacs has many @dfn{settings} which have values that you can specify
+in order to customize various commands.  Many are documented in this
+manual.  Most settings are @dfn{user options}---that is to say, Lisp
+variables (@pxref{Variables})---so their names appear in the Variable
+Index (@pxref{Variable Index}).  The other settings are faces and
+their attributes (@pxref{Faces}).
 
 @findex customize
 @cindex customization buffer
-  You can browse interactively through the user options and change
-some of them using @kbd{M-x customize}.  This command creates a
-@dfn{customization buffer}, which offers commands to navigate through
-a logically organized structure of the Emacs user options; you can
-also use it to edit and set their values, and to save settings
-permanently in your @file{~/.emacs} file (@pxref{Init File}).
+  You can browse interactively through settings and change them using
+@kbd{M-x customize}.  This command creates a @dfn{customization
+buffer}, which offers commands to navigate through a logically
+organized structure of the Emacs settings; you can also use it to edit
+and set their values, and to save settings permanently in your
+@file{~/.emacs} file (@pxref{Init File}).
 
   The appearance of the example buffers in this section is typically
 different under a window system, since faces are then used to indicate
-the active fields and other features.
+buttons and editable fields.
 
 @menu
-* Groups: Customization Groups.   How options are classified in a structure.
-* Browsing: Browsing Custom.   Browsing and searching for options and faces.
-* Changing a Variable::      How to edit a value and set an option.
+* Groups: Customization Groups.   How settings are classified in a structure.
+* Browsing: Browsing Custom.   Browsing and searching for settings.
+* Changing a Variable::      How to edit an option's value and set the option.
 * Saving Customizations::    Specifying the file for saving customizations.
 * Face Customization::       How to edit the attributes of a face.
 * Specific Customization::   Making a customization buffer for specific
@@ -220,9 +220,9 @@
 @subsection Customization Groups
 @cindex customization groups
 
-  For customization purposes, user options are organized into
-@dfn{groups} to help you find them.  Groups are collected into bigger
-groups, all the way up to a master group called @code{Emacs}.
+  For customization purposes, settings are organized into @dfn{groups}
+to help you find them.  Groups are collected into bigger groups, all
+the way up to a master group called @code{Emacs}.
 
   @kbd{M-x customize} creates a customization buffer that shows the
 top-level @code{Emacs} group and the second-level groups immediately
@@ -255,59 +255,57 @@
 line.
 
 @cindex editable fields (customization buffer)
-@cindex active fields (customization buffer)
+@cindex buttons (customization buffer)
   Most of the text in the customization buffer is read-only, but it
-typically includes some @dfn{editable fields} that you can edit.  There
-are also @dfn{active fields}; this means a field that does something
-when you @dfn{invoke} it.  To invoke an active field, either click on it
-with @kbd{Mouse-1}, or move point to it and type @key{RET}.
+typically includes some @dfn{editable fields} that you can edit.
+There are also @dfn{buttons}, which do something when you @dfn{invoke}
+them.  To invoke a button, either click on it with @kbd{Mouse-1}, or
+move point to it and type @key{RET}.
 
   For example, the phrase @samp{[Go to Group]} that appears in a
-second-level group is an active field.  Invoking the @samp{[Go to
-Group]} field for a group creates a new customization buffer, which
-shows that group and its contents.  This field is a kind of hypertext
-link to another group.
-
-  The @code{Emacs} group includes a few user options itself, but
-mainly it contains other groups, which contain more groups, which
-contain the user options.  By browsing the hierarchy of groups, you
-will eventually find the feature you are interested in customizing.
-Then you can use the customization buffer to set the options
-pertaining to that feature.  You can also go straight to a particular
-group by name, using the command @kbd{M-x customize-group}.
+second-level group is a button.  Invoking it creates a new
+customization buffer, which shows that group and its contents.  This
+is a kind of hypertext link to another group.
+
+  The @code{Emacs} group includes a few settings, but mainly it
+contains other groups, which contain more groups, which contain the
+settings.  By browsing the hierarchy of groups, you will eventually
+find the feature you are interested in customizing.  Then you can use
+the customization buffer to set that feature's settings.  You can also
+go straight to a particular group by name, using the command @kbd{M-x
+customize-group}.
 
 @node Browsing Custom
 @subsection Browsing and Searching for Options and Faces
 @findex customize-browse
-You can use @kbd{M-x customize} to browse the groups and options, but
-often @kbd{M-x customize-browse} is a more efficient alternative.
-That is because it lets you view the structure of customization groups
-on a larger scale.  This command creates a special kind of
-customization buffer which shows only the names of the groups (and
-variables and faces), and their structure.
+
+  @kbd{M-x customize-browse} is another way to browse the available
+settings.  This command creates a special customization buffer which
+shows only the names of groups and settings, and puts them in a
+structure.
 
   In this buffer, you can show the contents of a group by invoking
 @samp{[+]}.  When the group contents are visible, this button changes to
 @samp{[-]}; invoking that hides the group contents.
 
-  Each group, variable, or face name in this buffer has an active field
-which says @samp{[Group]}, @samp{[Option]} or @samp{[Face]}.  Invoking
-that active field creates an ordinary customization buffer showing just
-that group and its contents, just that variable, or just that face.
-This is the way to set values in it.
-
-  If you can guess part of the name of the options you are interested
-in, then sometimes @kbd{M-x customize-apropos} can be another useful
-way to search for options.  However, unlike @code{customize} and
-@code{customize-browse}, @code{customize-apropos} can only find
-options that are loaded in the current Emacs session.  @xref{Specific
-Customization,, Customizing Specific Items}.
+  Each setting in this buffer has a button which says @samp{[Group]},
+@samp{[Option]} or @samp{[Face]}.  Invoking this button creates an
+ordinary customization buffer showing just that group and its
+contents, just that user option, or just that face.  This is the way
+to change settings that you find with @kbd{M-x customize-browse}.
+
+  If you can guess part of the name of the settings you are interested
+in, @kbd{M-x customize-apropos} is another way to search for settings.
+However, unlike @code{customize} and @code{customize-browse},
+@code{customize-apropos} can only find groups and settings that are
+loaded in the current Emacs session.  @xref{Specific Customization,,
+Customizing Specific Items}.
 
 @node Changing a Variable
 @subsection Changing a Variable
 
-  Here is an example of what a variable looks like in the
-customization buffer:
+  Here is an example of what a variable (a user option) looks like in
+the customization buffer:
 
 @smallexample
 Kill Ring Max: [Hide Value] 60
@@ -321,34 +319,32 @@
 buffer initially hides values that take up several lines.  Invoke
 @samp{[Show Value]} to show the value.
 
-  The line after the option name indicates the @dfn{customization state}
-of the variable: in the example above, it says you have not changed the
-option yet.  The word @samp{[State]} at the beginning of this line is
-active; you can get a menu of various operations by invoking it with
-@kbd{Mouse-1} or @key{RET}.  These operations are essential for
-customizing the variable.
+  The line after the variable name indicates the @dfn{customization
+state} of the variable: in the example above, it says you have not
+changed the option yet.  The @samp{[State]} button at the beginning of
+this line gives you a menu of various operations for customizing the
+variable.
 
   The line after the @samp{[State]} line displays the beginning of the
 variable's documentation string.  If there are more lines of
-documentation, this line ends with @samp{[More]}; invoke this to show
-the full documentation string.
-
-  To enter a new value for @samp{Kill Ring Max}, move point to the value
-and edit it textually.  For example, you can type @kbd{M-d}, then insert
-another number.
-
-  When you begin to alter the text, you will see the @samp{[State]} line
-change to say that you have edited the value:
+documentation, this line ends with a @samp{[More]} button; invoke that
+to show the full documentation string.
+
+  To enter a new value for @samp{Kill Ring Max}, move point to the
+value and edit it textually.  For example, you can type @kbd{M-d},
+then insert another number.  As you begin to alter the text, you will
+see the @samp{[State]} line change to say that you have edited the
+value:
 
 @smallexample
 [State]: EDITED, shown value does not take effect until you set or @r{@dots{}}
                                                            save it.
 @end smallexample
 
-@cindex setting option value
-  Editing the value does not actually set the variable.  To do
-that, you must @dfn{set} it.  To do this, invoke the word
-@samp{[State]} and choose @samp{Set for Current Session}.
+@cindex settings, how to set
+  Editing the value does not actually set the variable.  To do that,
+you must @dfn{set} the variable.  To do this, invoke the
+@samp{[State]} button and choose @samp{Set for Current Session}.
 
   The state of the variable changes visibly when you set it:
 
@@ -357,23 +353,24 @@
 @end smallexample
 
    You don't have to worry about specifying a value that is not valid;
-setting the variable checks for validity and will not really install an
-unacceptable value.
+the @samp{Set for Current Session} operation checks for validity and
+will not install an unacceptable value.
 
 @kindex M-TAB @r{(customization buffer)}
 @findex widget-complete
-  While editing a value or field that is a file name, directory name,
+  While editing a field that is a file name, directory name,
 command name, or anything else for which completion is defined, you
 can type @kbd{M-@key{TAB}} (@code{widget-complete}) to do completion.
 (@kbd{@key{ESC} @key{TAB}} and @kbd{C-M-i} do the same thing.)
 
   Some variables have a small fixed set of possible legitimate values.
-These variables don't let you edit the value textually.  Instead, an
-active field @samp{[Value Menu]} appears before the value; invoke this
-field to edit the value.  For a boolean ``on or off'' value, the active
-field says @samp{[Toggle]}, and it changes to the other value.
-@samp{[Value Menu]} and @samp{[Toggle]} edit the buffer; the changes
-take effect when you use the @samp{Set for Current Session} operation.
+These variables don't let you edit the value textually.  Instead, a
+@samp{[Value Menu]} button appears before the value; invoke this
+button to change the value.  For a boolean ``on or off'' value, the
+button says @samp{[Toggle]}, and it changes to the other value.
+@samp{[Value Menu]} and @samp{[Toggle]} simply edit the buffer; the
+changes take real effect when you use the @samp{Set for Current
+Session} operation.
 
   Some variables have values with complex structure.  For example, the
 value of @code{file-coding-system-alist} is an association list.  Here
@@ -408,10 +405,10 @@
 
 @noindent
 Each association in the list appears on four lines, with several
-editable or ``active'' fields.  You can edit the regexps and coding
+editable fields and/or buttons.  You can edit the regexps and coding
 systems using ordinary editing commands.  You can also invoke
-@samp{[Value Menu]} to switch to a kind of value---for instance, to
-specify a function instead of a pair of coding systems.
+@samp{[Value Menu]} to switch to a different kind of value---for
+instance, to specify a function instead of a pair of coding systems.
 
 To delete an association from the list, invoke the @samp{[DEL]} button
 for that item.  To add an association, invoke @samp{[INS]} at the
@@ -424,19 +421,19 @@
 @kindex S-TAB @r{(customization buffer)}
 @findex widget-forward
 @findex widget-backward
-  Two special commands, @key{TAB} and @kbd{S-@key{TAB}}, are useful for
-moving through the customization buffer.  @key{TAB}
-(@code{widget-forward}) moves forward to the next active or editable
-field; @kbd{S-@key{TAB}} (@code{widget-backward}) moves backward to the
-previous active or editable field.
+  Two special commands, @key{TAB} and @kbd{S-@key{TAB}}, are useful
+for moving through the customization buffer.  @key{TAB}
+(@code{widget-forward}) moves forward to the next button or editable
+field; @kbd{S-@key{TAB}} (@code{widget-backward}) moves backward to
+the previous button or editable field.
 
   Typing @key{RET} on an editable field also moves forward, just like
 @key{TAB}.  We set it up this way because people often type @key{RET}
 when they are finished editing a field.  To insert a newline within an
 editable field, use @kbd{C-o} or @kbd{C-q C-j}.
 
-@cindex saving variable value
-@cindex customized variables, saving
+@cindex saving a setting
+@cindex settings, how to save
   Setting the variable changes its value in the current Emacs session;
 @dfn{saving} the value changes it for future sessions as well.  To
 save the variable, invoke @samp{[State]} and select the @samp{Save for
@@ -460,7 +457,7 @@
 
 @item Erase Customization
 This sets the variable to its standard value, and updates the text
-accordingly.  This also eliminates any saved value for the option,
+accordingly.  This also eliminates any saved value for the variable,
 so that you will get the standard value in future Emacs sessions.
 
 @item Use Backup Value
@@ -480,8 +477,7 @@
   The state of a group indicates whether anything in that group has been
 edited, set or saved.
 
-  Near the top of the customization buffer there are two lines
-containing several active fields:
+  Near the top of the customization buffer there are two lines of buttons:
 
 @smallexample
  [Set for Current Session] [Save for Future Sessions]
@@ -493,10 +489,10 @@
 Invoking @samp{[Finish]} either buries or kills this customization
 buffer according to the setting of the option
 @code{custom-buffer-done-kill}; the default is to bury the buffer.
-Each of the other fields performs an operation---set, save or
-reset---on each of the options in the buffer that could meaningfully
-be set, saved or reset.  They do not operate on options whose values
-are hidden, nor on subgroups.
+Each of the other buttons performs an operation---set, save or
+reset---on each of the settings in the buffer that could meaningfully
+be set, saved or reset.  They do not operate on settings whose values
+are hidden, nor on subgroups not visible in the buffer.
 
 @node Saving Customizations
 @subsection Saving Customizations
@@ -572,11 +568,12 @@
             [ ] Inherit: *
 @end smallexample
 
-  Each face attribute has its own line.  The @samp{[@var{x}]} field
+  Each face attribute has its own line.  The @samp{[@var{x}]} button
 before the attribute name indicates whether the attribute is
-@dfn{enabled}; @samp{X} means that it is.  You can enable or disable the
-attribute by invoking that field.  When the attribute is enabled, you
-can change the attribute value in the usual ways.
+@dfn{enabled}; @samp{[X]} means that it's enabled, and @samp{[ ]}
+means that it's disabled.  You can enable or disable the attribute by
+clicking that button.  When the attribute is enabled, you can change
+the attribute value in the usual ways.
 
   For the colors, you can specify a color name (use @kbd{M-x
 list-colors-display} for a list of them) or a hexadecimal color
@@ -608,9 +605,9 @@
 @node Specific Customization
 @subsection Customizing Specific Items
 
-  Instead of finding the options you want to change by moving down
-through the structure of groups, you can specify the particular variable,
-face, or group that you want to customize.
+  Instead of finding the setting you want to change by navigating the
+structure of groups, here are other ways to specify the settings that
+you want to customize.
 
 @table @kbd
 @item M-x customize-variable @key{RET} @var{variable} @key{RET}
@@ -620,17 +617,17 @@
 @item M-x customize-group @key{RET} @var{group} @key{RET}
 Set up a customization buffer with just one group, @var{group}.
 @item M-x customize-apropos @key{RET} @var{regexp} @key{RET}
-Set up a customization buffer with all the variables, faces and groups
-that match @var{regexp}.
+Set up a customization buffer with all the settings and groups that
+match @var{regexp}.
 @item M-x customize-changed-options @key{RET} @var{version} @key{RET}
-Set up a customization buffer with all the variables, faces and groups
+Set up a customization buffer with all the settings and groups
 whose meaning has changed since Emacs version @var{version}.
 @item M-x customize-saved
-Set up a customization buffer containing all variables and faces that you
+Set up a customization buffer containing all settings that you
 have saved with customization buffers.
 @item M-x customize-customized
-Set up a customization buffer containing all variables and faces that you
-have customized but not saved.
+Set up a customization buffer containing all settings that you have
+customized but not saved.
 @end table
 
 @findex customize-variable
@@ -639,8 +636,8 @@
 customize-variable} and specify the variable name.  This sets up the
 customization buffer with just one variable---the one that you asked
 for.  Editing, setting and saving the value work as described above,
-but only for the specified variable.  Minibuffer completion is very
-handy if you only know part of the name.  However, it only finds
+but only for the specified variable.  Minibuffer completion is handy
+if you only know part of the name.  However, this command can only see
 options that have been loaded in the current Emacs session.
 
 @findex customize-face
@@ -651,57 +648,56 @@
 @findex customize-group
   You can also set up the customization buffer with a specific group,
 using @kbd{M-x customize-group}.  The immediate contents of the chosen
-group, including user options, faces, and other groups, all appear
+group, including variables, faces, and other groups, all appear
 as well (even if not already loaded).  However, the subgroups' own
 contents are not included.
 
 @findex customize-apropos
   To control more precisely what to customize, you can use @kbd{M-x
-customize-apropos}.  You specify a regular expression as argument; then
-all @emph{loaded} options, faces and groups whose names match this
+customize-apropos}.  You specify a regular expression as argument;
+then all @emph{loaded} settings and groups whose names match this
 regular expression are set up in the customization buffer.  If you
-specify an empty regular expression, this includes @emph{all} groups,
-options and faces (but that takes a long time).
-
-@findex customize-changed-options
+specify an empty regular expression, this includes @emph{all} loaded
+groups and settings---which takes a long time to set up.
+
+@findex customize-changed
   When you upgrade to a new Emacs version, you might want to customize
-new options and options whose meanings or default values have changed.
-To do this, use @kbd{M-x customize-changed-options} and specify a
-previous Emacs version number using the minibuffer.  It creates a
-customization buffer which shows all the options (and groups) whose
-definitions have been changed since the specified version.  (Not just
-those that are already loaded.)
+new settings and settings whose meanings or default values have
+changed.  To do this, use @kbd{M-x customize-changed} and
+specify a previous Emacs version number using the minibuffer.  It
+creates a customization buffer which shows all the settings and groups
+whose definitions have been changed since the specified version, loading
+them if necessary.
 
 @findex customize-saved
 @findex customize-customized
-  If you change option values and then decide the change was a
-mistake, you can use two special commands to revisit your previous
-changes.  Use @kbd{M-x customize-saved} to look at the options that
-you have saved.  Use @kbd{M-x customize-customized} to look at the
-options that you have set but not saved.
+  If you change settings and then decide the change was a mistake, you
+can use two special commands to revisit your previous changes.  Use
+@kbd{M-x customize-saved} to look at the settings that you have saved.
+Use @kbd{M-x customize-customized} to look at the settings that you
+have set but not saved.
 
 @node Custom Themes
 @subsection Customization Themes
 @cindex custom themes
 
-@dfn{Custom themes} are collections of customized options that can be
-enabled or disabled as a unit.  You can use Custom themes to switch
-quickly and easily between various collections of settings, and to
-transfer such collections from one computer to another.
+  @dfn{Custom themes} are collections of settings that can be enabled
+or disabled as a unit.  You can use Custom themes to switch quickly
+and easily between various collections of settings, and to transfer
+such collections from one computer to another.
 
 @findex customize-create-theme
-To define a Custom theme, use the command
-@kbd{M-x customize-create-theme}, which brings up a buffer named
-@samp{*New Custom Theme*}.  At the top of the buffer is an editable
-field where you can specify the name of the theme.  To add a
-customization option to the theme, click on the @samp{INS} button to
-open up a field where you can insert the name of the option.  The
-current value of that option is applied to the theme.  After adding as
-many options as you like, click on @samp{Done} to save the Custom
-theme.
+  To define a Custom theme, use the command @kbd{M-x
+customize-create-theme}, which brings up a buffer named @samp{*New
+Custom Theme*}.  At the top of the buffer is an editable field where
+you can specify the name of the theme.  To add a customization option
+to the theme, click on the @samp{INS} button to open up a field where
+you can insert the name of the option.  The current value of that
+option is applied to the theme.  After adding as many options as you
+like, click on @samp{Done} to save the Custom theme.
 
 @vindex custom-theme-directory
-Saving a Custom theme named @var{foo} writes its definition into the
+  Saving a Custom theme named @var{foo} writes its definition into the
 file @file{@var{foo}-theme.el}, in the directory @file{~/.emacs.d/}
 (you can specify the directory by setting
 @code{custom-theme-directory}).
@@ -710,13 +706,12 @@
 @findex enable-theme
 @findex disable-theme
 You can load the themes you've previously defined with the command
-@code{load-theme}.  It prompts for a theme name in the minibuffer,
-then loads that theme if it isn't already loaded.  It also
-@dfn{enables} the theme, which means putting its settings into effect.
-An enabled theme can be @dfn{disabled} with the command
-@kbd{M-x disable-theme}; this returns the options specified in the
-theme to their original values.  To re-enable the theme, use the
-command @kbd{M-x enable-theme}.
+@code{load-theme}.  It prompts for a theme name in the minibuffer, and
+loads that theme from the theme file.  It also @dfn{enables} the
+theme, which means putting its settings into effect.  An enabled theme
+can be @dfn{disabled} with the command @kbd{M-x disable-theme}; this
+returns the options specified in the theme to their original values.
+To re-enable the theme, use the command @kbd{M-x enable-theme}.
 
 To enable a Custom theme named @var{foo} whenever Emacs is started up,
 add the line @code{(load-theme '@var{foo})} to your @file{.emacs} file
@@ -747,25 +742,26 @@
 have a documentation string which describes what kind of value it should
 have and how the value will be used.
 
-  Lisp allows any variable to have any kind of value, but most variables
-that Emacs uses need a value of a certain type.  Often the value should
-always be a string, or should always be a number.  Sometimes we say that a
-certain feature is turned on if a variable is ``non-@code{nil},'' meaning
-that if the variable's value is @code{nil}, the feature is off, but the
-feature is on for @emph{any} other value.  The conventional value to use to
-turn on the feature---since you have to pick one particular value when you
-set the variable---is @code{t}.
+  Emacs Lisp allows any variable (with a few exceptions) to have any
+kind of value, but most variables that Emacs uses need a value of a
+certain type.  Often the value should always be a string, or should
+always be a number.  Sometimes we say that a certain feature is turned
+on if a variable is ``non-@code{nil},'' meaning that if the variable's
+value is @code{nil}, the feature is off, but the feature is on for
+@emph{any} other value.  The conventional value to use to turn on the
+feature---since you have to pick one particular value when you set the
+variable---is @code{t}.
 
   Emacs uses many Lisp variables for internal record keeping, but the
-most interesting variables for a non-programmer user are those that
-are also @dfn{user options}, the variables that are meant for users to
-change.  Each user option that you can set with the customization
-buffer is (if it is not a face) in fact a Lisp variable.  Emacs does
-not (usually) change the values of these variables; instead, you set
-the values, and thereby alter and control the behavior of certain
-Emacs commands.  Use of the customization buffer is explained above
-(@pxref{Easy Customization}); here we describe other aspects of Emacs
-variables.
+most interesting variables for a non-programmer user are those meant
+for users to change---the @dfn{user options}.
+
+  Each user option that you can set with the customization buffer is
+in fact a Lisp variable.  Emacs does not (usually) change the values
+of these variables; instead, you set the values, and thereby alter and
+control the behavior of certain Emacs commands.  Use of the
+customization buffer is explained above (@pxref{Easy Customization});
+here we describe other aspects of Emacs variables.
 
 @menu
 * Examining::	        Examining or setting one variable's value.
--- a/man/display.texi	Thu Dec 29 04:31:04 2005 +0000
+++ b/man/display.texi	Thu Dec 29 04:41:02 2005 +0000
@@ -412,25 +412,25 @@
 @findex highlight-regexp
 Highlight text that matches @var{regexp} using face @var{face}
 (@code{highlight-regexp}).  By using this command more than once, you
-can highlight various parts of the text in different ways. The
+can highlight various parts of the text in different ways.  The
 highlighting will remain as long as the buffer is loaded.  For
 example, to highlight all occurrences of the word ``whim'' using the
 default face (a yellow background) @kbd{C-x w h whim @key{RET}
 @key{RET}}.  Any face can be used for highlighting, Hi Lock provides
-several of its own and these are pre-loaded into a history list. While
-being prompted for a face use @kbd{C-p} and @kbd{C-n} to cycle through
+several of its own and these are pre-loaded into a history list.  While
+being prompted for a face use @kbd{M-p} and @kbd{M-n} to cycle through
 them.
 
 @item C-x w r @var{regexp} @key{RET}
 @kindex C-x w r
 @findex unhighlight-regexp
-Unhighlight @var{regexp} (@code{unhighlight-regexp}).  
+Unhighlight @var{regexp} (@code{unhighlight-regexp}).
 When activated from the menu select the expression to unhighlight from
 a list.  When activated from the keyboard the most recently added
-expression will be shown. Use @kbd{C-p} to show the next older
-expression and @kbd{C-n} to select the next newer expression. When
+expression will be shown.  Use @kbd{M-p} to show the next older
+expression and @kbd{M-n} to select the next newer expression.  When
 the expression to unhighlight appears press @kbd{@key{RET}} to unhighlight
-it. The expression can also be typed and completion is available. 
+it.  The expression can also be typed and completion is available.
 
 @item C-x w l @var{regexp} @key{RET} @var{face} @key{RET}
 @kindex C-x w l
@@ -457,7 +457,7 @@
 @findex hi-lock-find-patterns
 @vindex hi-lock-exclude-modes
 Re-read regexp/face pairs in the current buffer
-(@code{hi-lock-write-interactive-patterns}). Users familiar with Font
+(@code{hi-lock-write-interactive-patterns}).  Users familiar with Font
 Lock keywords might interactively enter patterns
 (@code{highlight-regexp}), write them into the file
 (@code{hi-lock-write-interactive-patterns}), edit them, perhaps
--- a/man/widget.texi	Thu Dec 29 04:31:04 2005 +0000
+++ b/man/widget.texi	Thu Dec 29 04:41:02 2005 +0000
@@ -1282,9 +1282,7 @@
 @end deffn
 
 @deffn Widget file
-Allows you to edit a file name in an editable field.  If you invoke
-the tag button, you can edit the file name in the mini-buffer with
-completion.
+Allows you to edit a file name in an editable field.
 
 Keywords:
 @table @code
--- a/nt/ChangeLog	Thu Dec 29 04:31:04 2005 +0000
+++ b/nt/ChangeLog	Thu Dec 29 04:41:02 2005 +0000
@@ -1,3 +1,8 @@
+2005-12-24  Eli Zaretskii  <eliz@gnu.org>
+
+	* gmake.defs (TEMACS_EXTRA_LINK): Remove redundant -g.
+	(DEBUG_FLAG, DEBUG_LINK): Upgrade to "-gstabs+ -g3".
+
 2005-12-09  Eli Zaretskii  <eliz@gnu.org>
 
 	* INSTALL: Add explanation of how to debug with GDB starting from
--- a/nt/gmake.defs	Thu Dec 29 04:31:04 2005 +0000
+++ b/nt/gmake.defs	Thu Dec 29 04:41:02 2005 +0000
@@ -191,7 +191,7 @@
 
 # see comments in allocate_heap in w32heap.c before changing any of the
 # -stack, -heap, or -image-base settings.
-TEMACS_EXTRA_LINK = -Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x01000000 -g $(SUBSYSTEM_CONSOLE) -Wl,-entry,__start -Wl,-Map,$(BLD)/temacs.map
+TEMACS_EXTRA_LINK = -Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x01000000 $(SUBSYSTEM_CONSOLE) -Wl,-entry,__start -Wl,-Map,$(BLD)/temacs.map
 
 ifdef NOOPT
 OBJDIR          = oo
@@ -242,8 +242,8 @@
 DEBUG_FLAG =
 DEBUG_LINK =
 else
-DEBUG_FLAG = -g
-DEBUG_LINK = -g
+DEBUG_FLAG = -gstabs+ -g3
+DEBUG_LINK = -gstabs+ -g3
 endif
 
 ifdef NOCYGWIN
--- a/src/ChangeLog	Thu Dec 29 04:31:04 2005 +0000
+++ b/src/ChangeLog	Thu Dec 29 04:41:02 2005 +0000
@@ -1,3 +1,118 @@
+2005-12-25  Giorgos Keramidas  <keramida@ceid.upatras.gr>
+
+	* m/amdx86-64.h [__FreeBSD__] (START_FILES, LIB_STANDARD):
+	define for FreeBSD on this platform.
+
+2005-12-24  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* macterm.h (TYPE_FILE_NAME): New define.
+	(posix_pathname_to_fsspec, fsspec_to_posix_pathname): Remove externs.
+
+	* mac.c (posix_pathname_to_fsspec, fsspec_to_posix_pathname): Add
+	prototypes.  Make static.
+	(mac_aedesc_to_lisp): Initialize err to noErr.
+	(mac_coerce_file_name_ptr, mac_coerce_file_name_desc)
+	(init_coercion_handler): New functions.
+	(Fmac_coerce_ae_data): Use coercion of Apple event data for
+	translation from/to file names.
+
+	* macterm.c: Don't include sys/param.h.
+	(init_coercion_handler): Add extern.
+	[MAC_OS8] (main): Call init_coercion_handler.
+	(mac_initialize) [MAC_OSX]: Likewise.
+	[TARGET_API_MAC_CARBON] (mac_do_receive_drag): Use coercion of
+	Apple event data for translation from/to file names.
+
+	* macfns.c [TARGET_API_MAC_CARBON] (Fx_file_dialog): Likewise.
+
+	* image.c [MAC_OS] (find_image_fsspec): Likewise.
+
+2005-12-23  Martin Rudalics  <rudalics@gmx.at>  (tiny change)
+
+	* insdel.c (insert, insert_and_inherit, insert_before_markers)
+	(insert_before_markers_and_inherit): Make sure FROM is correct
+	when `after-change-functions' are called.
+
+2005-12-23  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* xfns.c (Fx_uses_old_gtk_dialog): New function.
+
+	* gtkutil.c (xg_uses_old_file_dialog): New function.
+	(xg_get_file_name): Use xg_uses_old_file_dialog.
+
+	* gtkutil.h: Declare xg_uses_old_file_dialog.
+
+2005-12-22  Richard M. Stallman  <rms@gnu.org>
+
+	* xmenu.c (xmenu_show): Call inhibit_garbage_collection.
+
+2005-12-22  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* mac.c (Fmac_coerce_ae_data) [MAC_OSX]: Fix memory leak.
+
+	* macgui.h (XCharStruct): Remove member `valid_p'.
+	(STORE_XCHARSTRUCT): Don't set member `valid_p'.
+	(XCharStructRow): New typedef.
+	(XCHARSTRUCTROW_CHAR_VALID_P, XCHARSTRUCTROW_SET_CHAR_VALID): New
+	macros.
+	(struct MacFontStruct): Add member `bounds'.  Remove member
+	`per_char'.  All uses for QuichDraw Text fonts are changed to
+	`bounds.per_char'.  ATSUI font bounds are represented as an array
+	`bounds.rows' of XCharStructRow's, each of which consists of a
+	bitmap of valid entries and an array of char bounds.
+
+	* macterm.c (mac_per_char_metric): Add prototype.
+	(x_per_char_metric) [USE_CG_TEXT_DRAWING]: Remove prototype.
+	(mac_query_char_extents): New function.
+	(x_per_char_metric): Use it.
+	(XLoadQueryFont): Likewise.  Consolidate min/max_bounds calculations.
+	[USE_CG_TEXT_DRAWING] (mac_draw_string_cg): Use
+	mac_per_char_metric instead of x_per_char_metric.
+	(mac_text_extents_16): New function.
+	(mac_compute_glyph_string_overhangs): Use it.
+	(mac_unload_font): Free member `bounds' in struct MacFontStruct.
+
+2005-12-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* minibuf.c (Fdisplay_completion_list): Use XCAR/XCDR.
+	(Fminibuffer_completion_help): Remove duplicates before display.
+
+2005-12-21  L$,1 q(Brentey K,Aa(Broly  <lorentey@elte.hu>
+
+	* print.c (print_preprocess): Don't lose print_depth levels while
+	iterating.
+
+2005-12-21  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* macmenu.c (Qmac_apple_event): Add extern.
+	(set_frame_menubar, mac_menu_show keymp_panes)
+	(single_keymap_panes, list_of_panes, list_of_item)
+	(single_menu_item): Add argument types to prototypes.
+	(mac_dialog_show) [HAVE_DIALOGS]: Likewise.
+	(struct skp): New struct (from xmenu.c).
+	(single_keymap_panes, single_menu_item, list_of_panes)
+	(list_of_item): Sync with xmenu.c.
+	(Fx_popup_menu, Fx_popup_dialog): Likewise.  Don't get window from
+	POSITION if it is mac-apple-event event.
+	(menubar_selection_callback): Don't use menu_command_in_progress.
+	(set_frame_menubar): First parse all submenus, then make
+	widget_value trees from them.  Don't allocate any widget_value
+	objects until we are done with the parsing.
+	(parse_single_submenu, digest_single_submenu): New functions.
+	(single_submenu): Function deleted, replaced by those two.
+	(install_menu_quit_handler) [HAVE_CANCELMENUTRACKING]: Don't
+	create or dispose of EventHandlerUPP.  Install hander to all submenus.
+	(mac_menu_show) [!HAVE_MULTILINGUAL_MENU]: Use ENCODE_MENU_STRING
+	instead of ENCODE_SYSTEM.
+	(free_frame_menubar, fill_submenu, fill_menu): Don't use NULL for
+	integer values.
+	[HAVE_DIALOGS] (mac_dialog_show): Sync with xdialog_show (in xmenu.c).
+	(add_menu_item) [TARGET_API_MAC_CARBON]: Use CFString functions to
+	format menu item string.  Don't use NULL for integer value.
+
+	* macterm.h (struct mac_output): Remove unused member
+	menu_command_in_progress.
+
 2005-12-20  Juri Linkov  <juri@jurta.org>
 
 	* xmenu.c (Fx_popup_menu): Set Vmenu_updating_frame to f if
@@ -25,15 +140,15 @@
 	(x_use_underline_position_properties): Undo 2005-07-13 change.
 	(syms_of_macterm) <x-use-underline-position-properties>: Likewise.
 	(mac_use_core_graphics, mac_wheel_button_is_mouse_2)
-	(mac_pass_command_to_system, mac_pass_control_to_system): New
-	boolean variables renamed from Lisp_Object ones
+	(mac_pass_command_to_system, mac_pass_control_to_system):
+	New boolean variables renamed from Lisp_Object ones
 	Vmac_use_core_graphics, Vmac_wheel_button_is_mouse_2,
-	Vmac_pass_command_to_system, and Vmac_pass_control_to_system.  All
-	uses changed.
+	Vmac_pass_command_to_system, and Vmac_pass_control_to_system.
+	All uses changed.
 	(syms_of_macterm): DEFVAR_BOOL them.  Remove previous DEFVAR_LISPs.
 	Make them user options.
-	(mac_handle_command_event, mac_store_services_event): Call
-	create_apple_event_from_event_ref without 5th argument.
+	(mac_handle_command_event, mac_store_services_event):
+	Call create_apple_event_from_event_ref without 5th argument.
 	(backtranslate_modified_keycode): Mask off modifier keys that are
 	mapped to some Emacs modifiers before passing it to KeyTranslate.
 	(syms_of_macterm): Make variables `mac-emulate-three-button-mouse',
@@ -41,8 +156,8 @@
 	Fix docstrings of `mac-*-modifier'.
 
 	* mac.c (create_apple_event_from_event_ref): Remove arg `types'.
-	(do_applescript): Change argument types to Lisp_Object.  All uses
-	changed.
+	(do_applescript): Change argument types to Lisp_Object.
+	All uses changed.
 
 	* macterm.h (create_apple_event_from_event_ref): Remove 5th
 	argument from extern.
@@ -85,9 +200,9 @@
 
 	* xfns.c (compute_tip_xy): Handle negative dx and dy.
 
-	* w32fns.c (compute_tip_xy): Ditto
-
-	* macfns.c (compute_tip_xy): Ditto
+	* w32fns.c (compute_tip_xy): Ditto.
+
+	* macfns.c (compute_tip_xy): Ditto.
 
 2005-12-14  Chong Yidong  <cyd@stupidchicken.com>
 
@@ -165,8 +280,7 @@
 	* mac.c (Qundecoded_file_name): New variable.
 	(syms_of_mac): Initialize it.
 	(mac_aelist_to_lisp, mac_aedesc_to_lisp): New functions.
-	[TARGET_API_MAC_CARBON] (create_apple_event_from_event_ref): New
-	function.
+	[TARGET_API_MAC_CARBON] (create_apple_event_from_event_ref): New fun.
 	(Fmac_coerce_ae_data): New defun.
 	(syms_of_mac): Defsubr it.
 
--- a/src/gtkutil.c	Thu Dec 29 04:31:04 2005 +0000
+++ b/src/gtkutil.c	Thu Dec 29 04:41:02 2005 +0000
@@ -1155,6 +1155,27 @@
 /***********************************************************************
                       File dialog functions
  ***********************************************************************/
+/* Return non-zero if the old file selection dialog is being used.
+   Return zero if not.  */
+
+int
+xg_uses_old_file_dialog ()
+{
+#ifdef HAVE_GTK_FILE_BOTH
+  extern int x_use_old_gtk_file_dialog;
+  return x_use_old_gtk_file_dialog;
+#else /* ! HAVE_GTK_FILE_BOTH */
+
+#ifdef HAVE_GTK_FILE_SELECTION_NEW
+  return 1;
+#else
+  return 0;
+#endif
+
+#endif /* ! HAVE_GTK_FILE_BOTH */
+}
+
+
 /* Function that is called when the file dialog pops down.
    W is the dialog widget, RESPONSE is the response code.
    USER_DATA is what we passed in to g_signal_connect (pointer to int).  */
@@ -1343,7 +1364,6 @@
   char *fn = 0;
   int filesel_done = 0;
   xg_get_file_func func;
-  extern int x_use_old_gtk_file_dialog;
 
 #if defined (HAVE_GTK_AND_PTHREAD) && defined (__SIGRTMIN)
   /* I really don't know why this is needed, but without this the GLIBC add on
@@ -1354,7 +1374,7 @@
 
 #ifdef HAVE_GTK_FILE_BOTH
 
-  if (x_use_old_gtk_file_dialog)
+  if (xg_uses_old_file_dialog ())
     w = xg_get_file_with_selection (f, prompt, default_filename,
                                     mustmatch_p, only_dir_p, &func);
   else
--- a/src/gtkutil.h	Thu Dec 29 04:31:04 2005 +0000
+++ b/src/gtkutil.h	Thu Dec 29 04:41:02 2005 +0000
@@ -132,6 +132,8 @@
 extern widget_value *malloc_widget_value P_ ((void));
 extern void free_widget_value P_ ((widget_value *));
 
+extern int xg_uses_old_file_dialog P_ ((void));
+
 extern char *xg_get_file_name P_ ((FRAME_PTR f,
                                    char *prompt,
                                    char *default_filename,
--- a/src/image.c	Thu Dec 29 04:31:04 2005 +0000
+++ b/src/image.c	Thu Dec 29 04:41:02 2005 +0000
@@ -2259,23 +2259,25 @@
      Lisp_Object specified_file, *file;
      FSSpec *fss;
 {
-#if MAC_OSX
-  FSRef fsr;
-#endif
   OSErr err;
+  AEDesc desc;
 
   *file = x_find_image_file (specified_file);
   if (!STRINGP (*file))
     return fnfErr;		/* file or directory not found;
 				   incomplete pathname */
   /* Try to open the image file.  */
-#if MAC_OSX
-  err = FSPathMakeRef (SDATA (*file), &fsr, NULL);
+  err = AECoercePtr (TYPE_FILE_NAME, SDATA (*file),
+		     SBYTES (*file), typeFSS, &desc);
   if (err == noErr)
-    err = FSGetCatalogInfo (&fsr, kFSCatInfoNone, NULL, NULL, fss, NULL);
+    {
+#if TARGET_API_MAC_CARBON
+      err = AEGetDescData (&desc, fss, sizeof (FSSpec));
 #else
-  err = posix_pathname_to_fsspec (SDATA (*file), fss);
+      *fss = *(FSSpec *)(*(desc.dataHandle));
 #endif
+      AEDisposeDesc (&desc);
+    }
   return err;
 }
 
--- a/src/insdel.c	Thu Dec 29 04:31:04 2005 +0000
+++ b/src/insdel.c	Thu Dec 29 04:41:02 2005 +0000
@@ -749,9 +749,10 @@
 {
   if (nbytes > 0)
     {
-      int opoint = PT;
-      insert_1 (string, nbytes, 0, 1, 0);
-      signal_after_change (opoint, 0, PT - opoint);
+      int len = chars_in_text (string, nbytes), opoint;
+      insert_1_both (string, len, nbytes, 0, 1, 0);
+      opoint = PT - len;
+      signal_after_change (opoint, 0, len);
       update_compositions (opoint, PT, CHECK_BORDER);
     }
 }
@@ -765,9 +766,10 @@
 {
   if (nbytes > 0)
     {
-      int opoint = PT;
-      insert_1 (string, nbytes, 1, 1, 0);
-      signal_after_change (opoint, 0, PT - opoint);
+      int len = chars_in_text (string, nbytes), opoint;
+      insert_1_both (string, len, nbytes, 1, 1, 0);
+      opoint = PT - len;
+      signal_after_change (opoint, 0, len);
       update_compositions (opoint, PT, CHECK_BORDER);
     }
 }
@@ -813,10 +815,10 @@
 {
   if (nbytes > 0)
     {
-      int opoint = PT;
-
-      insert_1 (string, nbytes, 0, 1, 1);
-      signal_after_change (opoint, 0, PT - opoint);
+      int len = chars_in_text (string, nbytes), opoint;
+      insert_1_both (string, len, nbytes, 0, 1, 1);
+      opoint = PT - len;
+      signal_after_change (opoint, 0, len);
       update_compositions (opoint, PT, CHECK_BORDER);
     }
 }
@@ -830,10 +832,10 @@
 {
   if (nbytes > 0)
     {
-      int opoint = PT;
-
-      insert_1 (string, nbytes, 1, 1, 1);
-      signal_after_change (opoint, 0, PT - opoint);
+      int len = chars_in_text (string, nbytes), opoint;
+      insert_1_both (string, len, nbytes, 1, 1, 1);
+      opoint = PT - len;
+      signal_after_change (opoint, 0, len);
       update_compositions (opoint, PT, CHECK_BORDER);
     }
 }
--- a/src/m/amdx86-64.h	Thu Dec 29 04:31:04 2005 +0000
+++ b/src/m/amdx86-64.h	Thu Dec 29 04:41:02 2005 +0000
@@ -100,11 +100,38 @@
 /* Define XPNTR to avoid or'ing with DATA_SEG_BITS */
 #undef DATA_SEG_BITS
 
+#ifdef __FreeBSD__
+
+/* The libraries for binaries native to the build host's architecture are
+   installed under /usr/lib in FreeBSD, and the ones that need special paths
+   are 32-bit compatibility libraries (installed under /usr/lib32).  To build
+   a native binary of Emacs on FreeBSD/amd64 we can just point to /usr/lib.  */
+
+#undef START_FILES
+#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o
+
+/* The duplicate -lgcc is intentional in the definition of LIB_STANDARD.
+   The reason is that some functions in libgcc.a call functions from libc.a,
+   and some libc.a functions need functions from libgcc.a.  Since most
+   versions of ld are one-pass linkers, we need to mention -lgcc twice,
+   or else we risk getting unresolved externals.  */
+#undef LIB_STANDARD
+#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o
+
+#else /* !__FreeBSD__ */
+
 #undef START_FILES
 #define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o
 
+/* The duplicate -lgcc is intentional in the definition of LIB_STANDARD.
+   The reason is that some functions in libgcc.a call functions from libc.a,
+   and some libc.a functions need functions from libgcc.a.  Since most
+   versions of ld are one-pass linkers, we need to mention -lgcc twice,
+   or else we risk getting unresolved externals.  */
 #undef LIB_STANDARD
 #define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o
 
+#endif /* __FreeBSD__ */
+
 /* arch-tag: 8a5e001d-e12e-4692-a3a6-0b15ba271c6e
    (do not change this comment) */
--- a/src/mac.c	Thu Dec 29 04:31:04 2005 +0000
+++ b/src/mac.c	Thu Dec 29 04:41:02 2005 +0000
@@ -79,6 +79,8 @@
 /* The single script context used for all script executions.  */
 static OSAID as_script_context;
 
+static OSErr posix_pathname_to_fsspec P_ ((const char *, FSSpec *));
+static OSErr fsspec_to_posix_pathname P_ ((const FSSpec *, char *, int));
 
 /* When converting from Mac to Unix pathnames, /'s in folder names are
    converted to :'s.  This function, used in copying folder names,
@@ -333,7 +335,7 @@
 mac_aedesc_to_lisp (desc)
      AEDesc *desc;
 {
-  OSErr err;
+  OSErr err = noErr;
   DescType desc_type = desc->descriptorType;
   Lisp_Object result;
 
@@ -397,6 +399,277 @@
   return Fcons (make_unibyte_string ((char *) &desc_type, 4), result);
 }
 
+static pascal OSErr
+mac_coerce_file_name_ptr (type_code, data_ptr, data_size,
+			  to_type, handler_refcon, result)
+     DescType type_code;
+     const void *data_ptr;
+     Size data_size;
+     DescType to_type;
+     long handler_refcon;
+     AEDesc *result;
+{
+  OSErr err;
+
+  if (type_code == TYPE_FILE_NAME)
+    /* Coercion from undecoded file name.  */
+    switch (to_type)
+      {
+      case typeAlias:
+      case typeFSS:
+      case typeFSRef:
+#ifdef MAC_OSX
+      case typeFileURL:
+#endif
+	{
+#ifdef MAC_OSX
+	  CFStringRef str;
+	  CFURLRef url = NULL;
+	  CFDataRef data = NULL;
+
+	  str = CFStringCreateWithBytes (NULL, data_ptr, data_size,
+					 kCFStringEncodingUTF8, false);
+	  if (str)
+	    {
+	      url = CFURLCreateWithFileSystemPath (NULL, str,
+						   kCFURLPOSIXPathStyle, false);
+	      CFRelease (str);
+	    }
+	  if (url)
+	    {
+	      data = CFURLCreateData (NULL, url, kCFStringEncodingUTF8, true);
+	      CFRelease (url);
+	    }
+	  if (data)
+	    {
+	      err = AECoercePtr (typeFileURL, CFDataGetBytePtr (data),
+				 CFDataGetLength (data), to_type, result);
+	      CFRelease (data);
+	    }
+	else
+	  err = memFullErr;
+#else
+	  FSSpec fs;
+	  char *buf;
+
+	  buf = xmalloc (data_size + 1);
+	  if (buf)
+	    {
+	      memcpy (buf, data_ptr, data_size);
+	      buf[data_size] = '\0';
+	      err = posix_pathname_to_fsspec (buf, &fs);
+	      xfree (buf);
+	    }
+	  else
+	    err = memFullErr;
+	  if (err == noErr)
+	    err = AECoercePtr (typeFSS, &fs, sizeof (FSSpec),
+			       to_type, result);
+#endif
+	}
+	break;
+
+      case TYPE_FILE_NAME:
+      case typeWildCard:
+	err = AECreateDesc (TYPE_FILE_NAME, data_ptr, data_size, result);
+	break;
+
+      default:
+	err = errAECoercionFail;
+	break;
+      }
+  else if (to_type == TYPE_FILE_NAME)
+    /* Coercion to undecoded file name.  */
+    switch (type_code)
+      {
+      case typeAlias:
+      case typeFSS:
+      case typeFSRef:
+#ifdef MAC_OSX
+      case typeFileURL:
+#endif
+	{
+	  AEDesc desc;
+#ifdef MAC_OSX
+	  Size size;
+	  char *buf;
+	  CFURLRef url = NULL;
+	  CFStringRef str = NULL;
+	  CFDataRef data = NULL;
+
+	  err = AECoercePtr (type_code, data_ptr, data_size,
+			     typeFileURL, &desc);
+	  if (err == noErr)
+	    {
+	      size = AEGetDescDataSize (&desc);
+	      buf = xmalloc (size);
+	      if (buf)
+		{
+		  err = AEGetDescData (&desc, buf, size);
+		  if (err == noErr)
+		    url = CFURLCreateWithBytes (NULL, buf, size,
+						kCFStringEncodingUTF8, NULL);
+		  xfree (buf);
+		}
+	      AEDisposeDesc (&desc);
+	    }
+	  if (url)
+	    {
+	      str = CFURLCopyFileSystemPath (url, kCFURLPOSIXPathStyle);
+	      CFRelease (url);
+	    }
+	  if (str)
+	    {
+	      data =
+		CFStringCreateExternalRepresentation (NULL, str,
+						      kCFStringEncodingUTF8,
+						      '\0');
+	      CFRelease (str);
+	    }
+	  if (data)
+	    {
+	      err = AECreateDesc (TYPE_FILE_NAME, CFDataGetBytePtr (data),
+				  CFDataGetLength (data), result);
+	      CFRelease (data);
+	    }
+	  else
+	    err = memFullErr;
+#else
+	  FSSpec fs;
+	  char file_name[MAXPATHLEN];
+
+	  err = AECoercePtr (type_code, data_ptr, data_size,
+			     typeFSS, &desc);
+	  if (err == noErr)
+	    {
+#if TARGET_API_MAC_CARBON
+	      err = AEGetDescData (&desc, &fs, sizeof (FSSpec));
+#else
+	      fs = *(FSSpec *)(*(desc.dataHandle));
+#endif
+	      if (err == noErr)
+		err = fsspec_to_posix_pathname (&fs, file_name,
+						sizeof (file_name) - 1);
+	      if (err == noErr)
+		err = AECreateDesc (TYPE_FILE_NAME, file_name,
+				    strlen (file_name), result);
+	      AEDisposeDesc (&desc);
+	    }
+#endif
+	}
+	break;
+
+      default:
+	err = errAECoercionFail;
+	break;
+      }
+  else
+    abort ();
+
+  if (err != noErr)
+    return errAECoercionFail;
+  return noErr;
+}
+
+static pascal OSErr
+mac_coerce_file_name_desc (from_desc, to_type, handler_refcon, result)
+     const AEDesc *from_desc;
+     DescType to_type;
+     long handler_refcon;
+     AEDesc *result;
+{
+  OSErr err = noErr;
+  DescType from_type = from_desc->descriptorType;
+
+  if (from_type == TYPE_FILE_NAME)
+    {
+      if (to_type != TYPE_FILE_NAME && to_type != typeWildCard
+	  && to_type != typeAlias && to_type != typeFSS
+	  && to_type != typeFSRef
+#ifdef MAC_OSX
+	  && to_type != typeFileURL
+#endif
+	  )
+	return errAECoercionFail;
+    }
+  else if (to_type == TYPE_FILE_NAME)
+    {
+      if (from_type != typeAlias && from_type != typeFSS
+	  && from_type != typeFSRef
+#ifdef MAC_OSX
+	  && from_type != typeFileURL
+#endif
+	  )
+	return errAECoercionFail;
+    }
+  else
+    abort ();
+
+  if (from_type == to_type || to_type == typeWildCard)
+    err = AEDuplicateDesc (from_desc, result);
+  else
+    {
+      char *data_ptr;
+      Size data_size;
+
+#if TARGET_API_MAC_CARBON
+      data_size = AEGetDescDataSize (from_desc);
+#else
+      data_size = GetHandleSize (from_desc->dataHandle);
+#endif
+      data_ptr = xmalloc (data_size);
+      if (data_ptr)
+	{
+#if TARGET_API_MAC_CARBON
+	  err = AEGetDescData (from_desc, data_ptr, data_size);
+#else
+	  memcpy (data_ptr, *(from_desc->dataHandle), data_size);
+#endif
+	  if (err == noErr)
+	    err = mac_coerce_file_name_ptr (from_type, data_ptr,
+					    data_size, to_type,
+					    handler_refcon, result);
+	  xfree (data_ptr);
+	}
+      else
+	err = memFullErr;
+    }
+
+  if (err != noErr)
+    return errAECoercionFail;
+  return noErr;
+}
+
+OSErr
+init_coercion_handler ()
+{
+  OSErr err;
+
+  static AECoercePtrUPP coerce_file_name_ptrUPP = NULL;
+  static AECoerceDescUPP coerce_file_name_descUPP = NULL;
+
+  if (coerce_file_name_ptrUPP == NULL)
+    {
+      coerce_file_name_ptrUPP = NewAECoercePtrUPP (mac_coerce_file_name_ptr);
+      coerce_file_name_descUPP = NewAECoerceDescUPP (mac_coerce_file_name_desc);
+    }
+
+  err = AEInstallCoercionHandler (TYPE_FILE_NAME, typeWildCard,
+				  (AECoercionHandlerUPP)
+				  coerce_file_name_ptrUPP, 0, false, false);
+  if (err == noErr)
+    err = AEInstallCoercionHandler (typeWildCard, TYPE_FILE_NAME,
+				    (AECoercionHandlerUPP)
+				    coerce_file_name_ptrUPP, 0, false, false);
+  if (err == noErr)
+    err = AEInstallCoercionHandler (TYPE_FILE_NAME, typeWildCard,
+				    coerce_file_name_descUPP, 0, true, false);
+  if (err == noErr)
+    err = AEInstallCoercionHandler (typeWildCard, TYPE_FILE_NAME,
+				    coerce_file_name_descUPP, 0, true, false);
+  return err;
+}
+
 #if TARGET_API_MAC_CARBON
 OSErr
 create_apple_event_from_event_ref (event, num_params, names, types, result)
@@ -2602,7 +2875,7 @@
 }
 
 
-OSErr
+static OSErr
 posix_pathname_to_fsspec (ufn, fs)
      const char *ufn;
      FSSpec *fs;
@@ -2618,7 +2891,7 @@
     }
 }
 
-OSErr
+static OSErr
 fsspec_to_posix_pathname (fs, ufn, ufnbuflen)
      const FSSpec *fs;
      char *ufn;
@@ -4072,89 +4345,21 @@
 
   CHECK_STRING (src_data);
   if (EQ (src_type, Qundecoded_file_name))
-    {
-#ifdef MAC_OSX
-      src_desc_type = typeFileURL;
-#else
-      src_desc_type = typeFSS;
-#endif
-    }
+    src_desc_type = TYPE_FILE_NAME;
   else
     src_desc_type = mac_get_code_from_arg (src_type, 0);
 
   if (EQ (dst_type, Qundecoded_file_name))
-    {
-#ifdef MAC_OSX
-    dst_desc_type = typeFSRef;
-#else
-    dst_desc_type = typeFSS;
-#endif
-    }
+    dst_desc_type = TYPE_FILE_NAME;
   else
     dst_desc_type = mac_get_code_from_arg (dst_type, 0);
 
   BLOCK_INPUT;
-  if (EQ (src_type, Qundecoded_file_name))
-    {
-#ifdef MAC_OSX
-      CFStringRef str;
-      CFURLRef url = NULL;
-      CFDataRef data = NULL;
-
-      str = cfstring_create_with_utf8_cstring (SDATA (src_data));
-      if (str)
-	{
-	  url = CFURLCreateWithFileSystemPath (NULL, str,
-					       kCFURLPOSIXPathStyle, false);
-	  CFRelease (str);
-	}
-      if (url)
-	{
-	  data = CFURLCreateData (NULL, url, kCFStringEncodingUTF8, true);
-	  CFRelease (url);
-	}
-      if (data)
-	err = AECoercePtr (src_desc_type, CFDataGetBytePtr (data),
-			   CFDataGetLength (data),
-			   dst_desc_type, &dst_desc);
-      else
-	err = memFullErr;
-#else
-      err = posix_pathname_to_fsspec (SDATA (src_data), &fs);
-      if (err == noErr)
-	AECoercePtr (src_desc_type, &fs, sizeof (FSSpec),
+  err = AECoercePtr (src_desc_type, SDATA (src_data), SBYTES (src_data),
 		     dst_desc_type, &dst_desc);
-#endif
-    }
-  else
-    err = AECoercePtr (src_desc_type, SDATA (src_data), SBYTES (src_data),
-		       dst_desc_type, &dst_desc);
-
   if (err == noErr)
     {
-      if (EQ (dst_type, Qundecoded_file_name))
-	{
-	  char file_name[MAXPATHLEN];
-
-#ifdef MAC_OSX
-	  err = AEGetDescData (&dst_desc, &fref, sizeof (FSRef));
-	  if (err == noErr)
-	    err = FSRefMakePath (&fref, file_name, sizeof (file_name));
-#else
-#if TARGET_API_MAC_CARBON
-	  err = AEGetDescData (&dst_desc, &fs, sizeof (FSSpec));
-#else
-	  memcpy (&fs, *(dst_desc.dataHandle), sizeof (FSSpec));
-#endif
-	  if (err == noErr)
-	    err = fsspec_to_posix_pathname (&fs, file_name,
-					    sizeof (file_name) - 1);
-#endif
-	  if (err == noErr)
-	    result = make_unibyte_string (file_name, strlen (file_name));
-	}
-      else
-	result = Fcdr (mac_aedesc_to_lisp (&dst_desc));
+      result = Fcdr (mac_aedesc_to_lisp (&dst_desc));
       AEDisposeDesc (&dst_desc);
     }
   UNBLOCK_INPUT;
--- a/src/macfns.c	Thu Dec 29 04:31:04 2005 +0000
+++ b/src/macfns.c	Thu Dec 29 04:41:02 2005 +0000
@@ -4226,21 +4226,13 @@
     /* Set the default location and continue*/
     if (status == noErr)
       {
+	Lisp_Object encoded_dir = ENCODE_FILE (dir);
 	AEDesc defLocAed;
-#ifdef MAC_OSX
-	FSRef defLoc;
-	status = FSPathMakeRef(SDATA(ENCODE_FILE(dir)), &defLoc, NULL);
-#else
-	FSSpec defLoc;
-	status = posix_pathname_to_fsspec (SDATA (ENCODE_FILE (dir)), &defLoc);
-#endif
+
+	status = AECreateDesc (TYPE_FILE_NAME, SDATA (encoded_dir),
+			       SBYTES (encoded_dir), &defLocAed);
 	if (status == noErr)
 	  {
-#ifdef MAC_OSX
-	    AECreateDesc(typeFSRef, &defLoc, sizeof(FSRef), &defLocAed);
-#else
-	    AECreateDesc(typeFSS, &defLoc, sizeof(FSSpec), &defLocAed);
-#endif
 	    NavCustomControl(dialogRef, kNavCtlSetLocation, (void*) &defLocAed);
 	    AEDisposeDesc(&defLocAed);
 	  }
@@ -4262,41 +4254,36 @@
 	case kNavUserActionSaveAs:
 	  {
 	    NavReplyRecord reply;
-	    AEDesc aed;
-#ifdef MAC_OSX
-	    FSRef fsRef;
-#else
-	    FSSpec fs;
-#endif
+	    Size len;
+
 	    status = NavDialogGetReply(dialogRef, &reply);
-
-#ifdef MAC_OSX
-	    AECoerceDesc(&reply.selection, typeFSRef, &aed);
-	    AEGetDescData(&aed, (void *) &fsRef, sizeof (FSRef));
-	    FSRefMakePath(&fsRef, (UInt8 *) filename, sizeof (filename));
+	    if (status != noErr)
+	      break;
+	    status = AEGetNthPtr (&reply.selection, 1, TYPE_FILE_NAME,
+				  NULL, NULL, filename,
+				  sizeof (filename) - 1, &len);
+	    if (status == noErr)
+	      {
+		len = min (len, sizeof (filename) - 1);
+		filename[len] = '\0';
+		if (reply.saveFileName)
+		  {
+		    /* If it was a saved file, we need to add the file name */
+		    if (len && len < sizeof (filename) - 1
+			&& filename[len-1] != '/')
+		      filename[len++] = '/';
+		    CFStringGetCString(reply.saveFileName, filename+len,
+				       sizeof (filename) - len,
+#if MAC_OSX
+				       kCFStringEncodingUTF8
 #else
-	    AECoerceDesc (&reply.selection, typeFSS, &aed);
-	    AEGetDescData (&aed, (void *) &fs, sizeof (FSSpec));
-	    fsspec_to_posix_pathname (&fs, filename, sizeof (filename) - 1);
+				       CFStringGetSystemEncoding ()
 #endif
-	    AEDisposeDesc(&aed);
-	    if (reply.saveFileName)
-	      {
-		/* If it was a saved file, we need to add the file name */
-		int len = strlen(filename);
-		if (len && filename[len-1] != '/')
-		  filename[len++] = '/';
-		CFStringGetCString(reply.saveFileName, filename+len,
-				   sizeof (filename) - len,
-#if MAC_OSX
-				   kCFStringEncodingUTF8
-#else
-				   CFStringGetSystemEncoding ()
-#endif
-				   );
+				       );
+		  }
+		file = DECODE_FILE (make_unibyte_string (filename,
+							 strlen (filename)));
 	      }
-	    file = DECODE_FILE (make_unibyte_string (filename,
-						     strlen (filename)));
 	    NavDisposeReply(&reply);
 	  }
 	  break;
--- a/src/macgui.h	Thu Dec 29 04:31:04 2005 +0000
+++ b/src/macgui.h	Thu Dec 29 04:41:02 2005 +0000
@@ -109,7 +109,6 @@
 #if 0
   unsigned short attributes;	/* per char flags (not predefined) */
 #endif
-  unsigned valid_p : 1;
 } XCharStruct;
 
 #define STORE_XCHARSTRUCT(xcs, w, bds)			\
@@ -117,8 +116,19 @@
    (xcs).lbearing = (bds).left,				\
    (xcs).rbearing = (bds).right,			\
    (xcs).ascent = -(bds).top,				\
-   (xcs).descent = (bds).bottom,			\
-   (xcs).valid_p = 1)
+   (xcs).descent = (bds).bottom)
+
+typedef struct
+{
+  char valid_bits[0x100 / 8];
+  XCharStruct per_char[0x100];
+} XCharStructRow;
+
+#define XCHARSTRUCTROW_CHAR_VALID_P(row, byte2) \
+  ((row)->valid_bits[(byte2) / 8] & (1 << (byte2) % 8))
+
+#define XCHARSTRUCTROW_SET_CHAR_VALID(row, byte2) \
+  ((row)->valid_bits[(byte2) / 8] |= (1 << (byte2) % 8))
 
 struct MacFontStruct {
   char *full_name;
@@ -157,7 +167,10 @@
 #endif /* 0 */
   XCharStruct min_bounds;  /* minimum bounds over all existing char */
   XCharStruct max_bounds;  /* maximum bounds over all existing char */
-  XCharStruct *per_char;   /* first_char to last_char information */
+  union {
+    XCharStruct *per_char; /* first_char to last_char information */
+    XCharStructRow **rows; /* first row to last row information */
+  } bounds;
   int ascent;              /* logical extent above baseline for spacing */
   int descent;             /* logical decent below baseline for spacing */
 };
--- a/src/macmenu.c	Thu Dec 29 04:31:04 2005 +0000
+++ b/src/macmenu.c	Thu Dec 29 04:41:02 2005 +0000
@@ -1,4 +1,4 @@
-/* Menu support for GNU Emacs on the for Mac OS.
+/* Menu support for GNU Emacs on Mac OS.
    Copyright (C) 2000, 2001, 2002, 2003, 2004,
                  2005 Free Software Foundation, Inc.
 
@@ -24,6 +24,7 @@
 #include <config.h>
 
 #include <stdio.h>
+
 #include "lisp.h"
 #include "termhooks.h"
 #include "keyboard.h"
@@ -154,7 +155,7 @@
 
 Lisp_Object Qdebug_on_next_call;
 
-extern Lisp_Object Qmenu_bar;
+extern Lisp_Object Qmenu_bar, Qmac_apple_event;
 
 extern Lisp_Object QCtoggle, QCradio;
 
@@ -165,27 +166,28 @@
 
 extern Lisp_Object Qmenu_bar_update_hook;
 
+void set_frame_menubar P_ ((FRAME_PTR, int, int));
+
 #if TARGET_API_MAC_CARBON
 #define ENCODE_MENU_STRING(str) ENCODE_UTF_8 (str)
 #else
 #define ENCODE_MENU_STRING(str) ENCODE_SYSTEM (str)
 #endif
 
-void set_frame_menubar ();
-
 static void push_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
 				Lisp_Object, Lisp_Object, Lisp_Object,
 				Lisp_Object, Lisp_Object));
 #ifdef HAVE_DIALOGS
-static Lisp_Object mac_dialog_show ();
+static Lisp_Object mac_dialog_show P_ ((FRAME_PTR, int, Lisp_Object,
+					Lisp_Object, char **));
 #endif
-static Lisp_Object mac_menu_show ();
-
-static void keymap_panes ();
-static void single_keymap_panes ();
-static void single_menu_item ();
-static void list_of_panes ();
-static void list_of_items ();
+static Lisp_Object mac_menu_show P_ ((struct frame *, int, int, int, int,
+				      Lisp_Object, char **));
+static void keymap_panes P_ ((Lisp_Object *, int, int));
+static void single_keymap_panes P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
+				     int, int));
+static void list_of_panes P_ ((Lisp_Object));
+static void list_of_items P_ ((Lisp_Object));
 
 static void fill_submenu (MenuHandle, widget_value *);
 static void fill_menubar (widget_value *);
@@ -280,8 +282,7 @@
   menu_items_submenu_depth = 0;
 }
 
-/* Call at the end of generating the data in menu_items.
-   This fills in the number of items in the last pane.  */
+/* Call at the end of generating the data in menu_items.  */
 
 static void
 finish_menu_items ()
@@ -415,11 +416,21 @@
      P is the number of panes we have made so far.  */
   for (mapno = 0; mapno < nmaps; mapno++)
     single_keymap_panes (keymaps[mapno],
-                         Fkeymap_prompt (keymaps[mapno]), Qnil, notreal, 10);
+			 Fkeymap_prompt (keymaps[mapno]), Qnil, notreal, 10);
 
   finish_menu_items ();
 }
 
+/* Args passed between single_keymap_panes and single_menu_item.  */
+struct skp
+  {
+     Lisp_Object pending_maps;
+     int maxdepth, notreal;
+  };
+
+static void single_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
+				  void *));
+
 /* This is a recursive subroutine of keymap_panes.
    It handles one keymap, KEYMAP.
    The other arguments are passed along
@@ -437,89 +448,71 @@
      int notreal;
      int maxdepth;
 {
-  Lisp_Object pending_maps = Qnil;
-  Lisp_Object tail, item;
-  struct gcpro gcpro1, gcpro2;
+  struct skp skp;
+  struct gcpro gcpro1;
+
+  skp.pending_maps = Qnil;
+  skp.maxdepth = maxdepth;
+  skp.notreal = notreal;
 
   if (maxdepth <= 0)
     return;
 
   push_menu_pane (pane_name, prefix);
 
-  for (tail = keymap; CONSP (tail); tail = XCDR (tail))
-    {
-      GCPRO2 (keymap, pending_maps);
-      /* Look at each key binding, and if it is a menu item add it
-	 to this menu.  */
-      item = XCAR (tail);
-      if (CONSP (item))
-	single_menu_item (XCAR (item), XCDR (item),
-			  &pending_maps, notreal, maxdepth);
-      else if (VECTORP (item))
-	{
-	  /* Loop over the char values represented in the vector.  */
-	  int len = XVECTOR (item)->size;
-	  int c;
-	  for (c = 0; c < len; c++)
-	    {
-	      Lisp_Object character;
-	      XSETFASTINT (character, c);
-	      single_menu_item (character, XVECTOR (item)->contents[c],
-				&pending_maps, notreal, maxdepth);
-	    }
-	}
-      UNGCPRO;
-    }
+  GCPRO1 (skp.pending_maps);
+  map_keymap (keymap, single_menu_item, Qnil, &skp, 1);
+  UNGCPRO;
 
   /* Process now any submenus which want to be panes at this level.  */
-  while (!NILP (pending_maps))
+  while (CONSP (skp.pending_maps))
     {
       Lisp_Object elt, eltcdr, string;
-      elt = Fcar (pending_maps);
+      elt = XCAR (skp.pending_maps);
       eltcdr = XCDR (elt);
       string = XCAR (eltcdr);
       /* We no longer discard the @ from the beginning of the string here.
 	 Instead, we do this in mac_menu_show.  */
       single_keymap_panes (Fcar (elt), string,
 			   XCDR (eltcdr), notreal, maxdepth - 1);
-      pending_maps = Fcdr (pending_maps);
+      skp.pending_maps = XCDR (skp.pending_maps);
     }
 }
 
 /* This is a subroutine of single_keymap_panes that handles one
    keymap entry.
    KEY is a key in a keymap and ITEM is its binding.
-   PENDING_MAPS_PTR points to a list of keymaps waiting to be made into
+   SKP->PENDING_MAPS_PTR is a list of keymaps waiting to be made into
    separate panes.
-   If NOTREAL is nonzero, only check for equivalent key bindings, don't
+   If SKP->NOTREAL is nonzero, only check for equivalent key bindings, don't
    evaluate expressions in menu items and don't make any menu.
-   If we encounter submenus deeper than MAXDEPTH levels, ignore them.  */
+   If we encounter submenus deeper than SKP->MAXDEPTH levels, ignore them.  */
 
 static void
-single_menu_item (key, item, pending_maps_ptr, notreal, maxdepth)
-     Lisp_Object key, item;
-     Lisp_Object *pending_maps_ptr;
-     int maxdepth, notreal;
+single_menu_item (key, item, dummy, skp_v)
+     Lisp_Object key, item, dummy;
+     void *skp_v;
 {
   Lisp_Object map, item_string, enabled;
   struct gcpro gcpro1, gcpro2;
   int res;
+  struct skp *skp = skp_v;
 
   /* Parse the menu item and leave the result in item_properties.  */
   GCPRO2 (key, item);
-  res = parse_menu_item (item, notreal, 0);
+  res = parse_menu_item (item, skp->notreal, 0);
   UNGCPRO;
   if (!res)
     return;			/* Not a menu item.  */
 
   map = XVECTOR (item_properties)->contents[ITEM_PROPERTY_MAP];
 
-  if (notreal)
+  if (skp->notreal)
     {
       /* We don't want to make a menu, just traverse the keymaps to
 	 precompute equivalent key bindings.  */
       if (!NILP (map))
-	single_keymap_panes (map, Qnil, key, 1, maxdepth - 1);
+	single_keymap_panes (map, Qnil, key, 1, skp->maxdepth - 1);
       return;
     }
 
@@ -530,8 +523,8 @@
     {
       if (!NILP (enabled))
 	/* An enabled separate pane. Remember this to handle it later.  */
-	*pending_maps_ptr = Fcons (Fcons (map, Fcons (item_string, key)),
-				   *pending_maps_ptr);
+	skp->pending_maps = Fcons (Fcons (map, Fcons (item_string, key)),
+				   skp->pending_maps);
       return;
     }
 
@@ -539,14 +532,14 @@
 		  XVECTOR (item_properties)->contents[ITEM_PROPERTY_DEF],
 		  XVECTOR (item_properties)->contents[ITEM_PROPERTY_KEYEQ],
 		  XVECTOR (item_properties)->contents[ITEM_PROPERTY_TYPE],
-                  XVECTOR (item_properties)->contents[ITEM_PROPERTY_SELECTED],
-                  XVECTOR (item_properties)->contents[ITEM_PROPERTY_HELP]);
+		  XVECTOR (item_properties)->contents[ITEM_PROPERTY_SELECTED],
+		  XVECTOR (item_properties)->contents[ITEM_PROPERTY_HELP]);
 
   /* Display a submenu using the toolkit.  */
   if (! (NILP (map) || NILP (enabled)))
     {
       push_submenu_start ();
-      single_keymap_panes (map, Qnil, key, 0, maxdepth - 1);
+      single_keymap_panes (map, Qnil, key, 0, skp->maxdepth - 1);
       push_submenu_end ();
     }
 }
@@ -563,13 +556,13 @@
 
   init_menu_items ();
 
-  for (tail = menu; !NILP (tail); tail = Fcdr (tail))
+  for (tail = menu; CONSP (tail); tail = XCDR (tail))
     {
       Lisp_Object elt, pane_name, pane_data;
-      elt = Fcar (tail);
+      elt = XCAR (tail);
       pane_name = Fcar (elt);
       CHECK_STRING (pane_name);
-      push_menu_pane (pane_name, Qnil);
+      push_menu_pane (ENCODE_MENU_STRING (pane_name), Qnil);
       pane_data = Fcdr (elt);
       CHECK_CONS (pane_data);
       list_of_items (pane_data);
@@ -586,20 +579,22 @@
 {
   Lisp_Object tail, item, item1;
 
-  for (tail = pane; !NILP (tail); tail = Fcdr (tail))
+  for (tail = pane; CONSP (tail); tail = XCDR (tail))
     {
-      item = Fcar (tail);
+      item = XCAR (tail);
       if (STRINGP (item))
-	push_menu_item (item, Qnil, Qnil, Qt, Qnil, Qnil, Qnil, Qnil);
-      else if (NILP (item))
+	push_menu_item (ENCODE_MENU_STRING (item), Qnil, Qnil, Qt,
+			Qnil, Qnil, Qnil, Qnil);
+      else if (CONSP (item))
+	{
+	  item1 = XCAR (item);
+	  CHECK_STRING (item1);
+	  push_menu_item (ENCODE_MENU_STRING (item1), Qt, XCDR (item),
+			  Qt, Qnil, Qnil, Qnil, Qnil);
+	}
+      else
 	push_left_right_boundary ();
-      else
-	{
-	  CHECK_CONS (item);
-	  item1 = Fcar (item);
-	  CHECK_STRING (item1);
-	  push_menu_item (item1, Qt, Fcdr (item), Qt, Qnil, Qnil, Qnil, Qnil);
-	}
+
     }
 }
 
@@ -659,15 +654,14 @@
   Lisp_Object keymap, tem;
   int xpos = 0, ypos = 0;
   Lisp_Object title;
-  char *error_name;
+  char *error_name = NULL;
   Lisp_Object selection;
   FRAME_PTR f = NULL;
   Lisp_Object x, y, window;
   int keymaps = 0;
   int for_click = 0;
+  int specpdl_count = SPECPDL_INDEX ();
   struct gcpro gcpro1;
-  int specpdl_count = SPECPDL_INDEX ();
-
 
 #ifdef HAVE_MENUS
   if (! NILP (position))
@@ -677,7 +671,8 @@
       /* Decode the first argument: find the window and the coordinates.  */
       if (EQ (position, Qt)
 	  || (CONSP (position) && (EQ (XCAR (position), Qmenu_bar)
-                                   || EQ (XCAR (position), Qtool_bar))))
+				   || EQ (XCAR (position), Qtool_bar)
+				   || EQ (XCAR (position), Qmac_apple_event))))
 	{
 	  /* Use the mouse's current position.  */
 	  FRAME_PTR new_f = SELECTED_FRAME ();
@@ -703,8 +698,8 @@
 	  if (CONSP (tem))
 	    {
 	      window = Fcar (Fcdr (position));
-	      x = Fcar (tem);
-	      y = Fcar (Fcdr (tem));
+	      x = XCAR (tem);
+	      y = Fcar (XCDR (tem));
 	    }
 	  else
 	    {
@@ -788,11 +783,11 @@
 
       /* The first keymap that has a prompt string
 	 supplies the menu title.  */
-      for (tem = menu, i = 0; CONSP (tem); tem = Fcdr (tem))
+      for (tem = menu, i = 0; CONSP (tem); tem = XCDR (tem))
 	{
 	  Lisp_Object prompt;
 
-	  maps[i++] = keymap = get_keymap (Fcar (tem), 1, 0);
+	  maps[i++] = keymap = get_keymap (XCAR (tem), 1, 0);
 
 	  prompt = Fkeymap_prompt (keymap);
 	  if (NILP (title) && !NILP (prompt))
@@ -879,7 +874,8 @@
   /* Decode the first argument: find the window or frame to use.  */
   if (EQ (position, Qt)
       || (CONSP (position) && (EQ (XCAR (position), Qmenu_bar)
-                               || EQ (XCAR (position), Qtool_bar))))
+			       || EQ (XCAR (position), Qtool_bar)
+			       || EQ (XCAR (position), Qmac_apple_event))))
     {
 #if 0 /* Using the frame the mouse is on may not be right.  */
       /* Use the mouse's current position.  */
@@ -947,6 +943,7 @@
     Lisp_Object title;
     char *error_name;
     Lisp_Object selection;
+    int specpdl_count = SPECPDL_INDEX ();
 
     /* Decode the dialog items from what was specified.  */
     title = Fcar (contents);
@@ -955,11 +952,11 @@
     list_of_panes (Fcons (contents, Qnil));
 
     /* Display them in a dialog box.  */
+    record_unwind_protect (cleanup_popup_menu, Qnil);
     BLOCK_INPUT;
     selection = mac_dialog_show (f, 0, title, header, &error_name);
     UNBLOCK_INPUT;
-
-    discard_menu_items ();
+    unbind_to (specpdl_count, Qnil);
 
     if (error_name) error (error_name);
     return selection;
@@ -971,13 +968,14 @@
    This is called from keyboard.c when it gets the
    MENU_BAR_ACTIVATE_EVENT out of the Emacs event queue.
 
-   To activate the menu bar, we signal to the input thread that it can
-   return from the WM_INITMENU message, allowing the normal Windows
-   processing of the menus.
+   To activate the menu bar, we use the button-press event location
+   that was saved in saved_menu_event_location.
 
    But first we recompute the menu bar contents (the whole tree).
 
-   This way we can safely execute Lisp code.  */
+   The reason for saving the button event until here, instead of
+   passing it to the toolkit right away, is that we can safely
+   execute Lisp code.  */
 
 void
 x_activate_menubar (f)
@@ -1074,14 +1072,12 @@
 	      buf.arg = entry;
 	      kbd_buffer_store_event (&buf);
 
-	      f->output_data.mac->menu_command_in_progress = 0;
 	      f->output_data.mac->menubar_active = 0;
 	      return;
 	    }
 	  i += MENU_ITEMS_ITEM_LENGTH;
 	}
     }
-  f->output_data.mac->menu_command_in_progress = 0;
   f->output_data.mac->menubar_active = 0;
 }
 
@@ -1127,22 +1123,18 @@
   UNBLOCK_INPUT;
 }
 
-/* Return a tree of widget_value structures for a menu bar item
+/* Set up data in menu_items for a menu bar item
    whose event type is ITEM_KEY (with string ITEM_NAME)
    and whose contents come from the list of keymaps MAPS.  */
 
-static widget_value *
-single_submenu (item_key, item_name, maps)
+static int
+parse_single_submenu (item_key, item_name, maps)
      Lisp_Object item_key, item_name, maps;
 {
-  widget_value *wv, *prev_wv, *save_wv, *first_wv;
-  int i;
-  int submenu_depth = 0;
   Lisp_Object length;
   int len;
   Lisp_Object *mapvec;
-  widget_value **submenu_stack;
-  int previous_items = menu_items_used;
+  int i;
   int top_level_items = 0;
 
   length = Flength (maps);
@@ -1156,28 +1148,44 @@
       maps = Fcdr (maps);
     }
 
-  menu_items_n_panes = 0;
-
   /* Loop over the given keymaps, making a pane for each map.
      But don't make a pane that is empty--ignore that map instead.  */
   for (i = 0; i < len; i++)
     {
-      if (SYMBOLP (mapvec[i])
-	  || (CONSP (mapvec[i]) && !KEYMAPP (mapvec[i])))
+      if (!KEYMAPP (mapvec[i]))
 	{
 	  /* Here we have a command at top level in the menu bar
 	     as opposed to a submenu.  */
 	  top_level_items = 1;
 	  push_menu_pane (Qnil, Qnil);
 	  push_menu_item (item_name, Qt, item_key, mapvec[i],
-                          Qnil, Qnil, Qnil, Qnil);
+			  Qnil, Qnil, Qnil, Qnil);
 	}
       else
-	single_keymap_panes (mapvec[i], item_name, item_key, 0, 10);
+	{
+	  Lisp_Object prompt;
+	  prompt = Fkeymap_prompt (mapvec[i]);
+	  single_keymap_panes (mapvec[i],
+			       !NILP (prompt) ? prompt : item_name,
+			       item_key, 0, 10);
+	}
     }
 
-  /* Create a tree of widget_value objects
-     representing the panes and their items.  */
+  return top_level_items;
+}
+
+/* Create a tree of widget_value objects
+   representing the panes and items
+   in menu_items starting at index START, up to index END.  */
+
+static widget_value *
+digest_single_submenu (start, end, top_level_items)
+     int start, end, top_level_items;
+{
+  widget_value *wv, *prev_wv, *save_wv, *first_wv;
+  int i;
+  int submenu_depth = 0;
+  widget_value **submenu_stack;
 
   submenu_stack
     = (widget_value **) alloca (menu_items_used * sizeof (widget_value *));
@@ -1191,12 +1199,12 @@
   save_wv = 0;
   prev_wv = 0;
 
-  /* Loop over all panes and items made during this call
-     and construct a tree of widget_value objects.
-     Ignore the panes and items made by previous calls to
-     single_submenu, even though those are also in menu_items.  */
-  i = previous_items;
-  while (i < menu_items_used)
+  /* Loop over all panes and items made by the preceding call
+     to parse_single_submenu and construct a tree of widget_value objects.
+     Ignore the panes and items used by previous calls to
+     digest_single_submenu, even though those are also in menu_items.  */
+  i = start;
+  while (i < end)
     {
       if (EQ (XVECTOR (menu_items)->contents[i], Qnil))
 	{
@@ -1230,7 +1238,7 @@
 #ifndef HAVE_MULTILINGUAL_MENU
 	  if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name))
 	    {
-	      pane_name = ENCODE_SYSTEM (pane_name);
+	      pane_name = ENCODE_MENU_STRING (pane_name);
 	      AREF (menu_items, i + MENU_ITEMS_PANE_NAME) = pane_name;
 	    }
 #endif
@@ -1266,7 +1274,7 @@
 	{
 	  /* Create a new item within current pane.  */
 	  Lisp_Object item_name, enable, descrip, def, type, selected;
-          Lisp_Object help;
+	  Lisp_Object help;
 
 	  item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
 	  enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);
@@ -1277,13 +1285,13 @@
 	  help = AREF (menu_items, i + MENU_ITEMS_ITEM_HELP);
 
 #ifndef HAVE_MULTILINGUAL_MENU
-	  if (STRING_MULTIBYTE (item_name))
+          if (STRING_MULTIBYTE (item_name))
 	    {
 	      item_name = ENCODE_MENU_STRING (item_name);
 	      AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
 	    }
 
-	  if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
+          if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
 	    {
 	      descrip = ENCODE_MENU_STRING (descrip);
 	      AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
@@ -1315,7 +1323,7 @@
 	    abort ();
 
 	  wv->selected = !NILP (selected);
-	  if (!STRINGP (help))
+	  if (! STRINGP (help))
 	    help = Qnil;
 
 	  wv->help = help;
@@ -1337,6 +1345,7 @@
 
   return first_wv;
 }
+
 /* Walk through the widget_value tree starting at FIRST_WV and update
    the char * pointers from the corresponding lisp values.
    We do this after building the whole tree, since GC may happen while the
@@ -1418,20 +1427,28 @@
 install_menu_quit_handler (MenuHandle menu_handle)
 {
 #ifdef HAVE_CANCELMENUTRACKING
-  EventHandlerUPP handler = NewEventHandlerUPP(menu_quit_handler);
-  UInt32 numTypes = 1;
   EventTypeSpec typesList[] = { { kEventClassKeyboard, kEventRawKeyDown } };
   int i = MIN_MENU_ID;
   MenuHandle menu = menu_handle ? menu_handle : GetMenuHandle (i);
 
   while (menu != NULL)
     {
-      InstallMenuEventHandler (menu, handler, GetEventTypeCount (typesList),
+      InstallMenuEventHandler (menu, menu_quit_handler,
+			       GetEventTypeCount (typesList),
                                typesList, menu_handle, NULL);
       if (menu_handle) break;
       menu = GetMenuHandle (++i);
     }
-  DisposeEventHandlerUPP (handler);
+
+  i = menu_handle ? MIN_POPUP_SUBMENU_ID : MIN_SUBMENU_ID;  
+  menu = GetMenuHandle (i);
+  while (menu != NULL)
+    {
+      InstallMenuEventHandler (menu, menu_quit_handler,
+			       GetEventTypeCount (typesList),
+                               typesList, menu_handle, NULL);
+      menu = GetMenuHandle (++i);
+    }
 #endif /* HAVE_CANCELMENUTRACKING */
 }
 
@@ -1448,7 +1465,9 @@
   int menubar_widget = f->output_data.mac->menubar_widget;
   Lisp_Object items;
   widget_value *wv, *first_wv, *prev_wv = 0;
-  int i;
+  int i, last_i = 0;
+  int *submenu_start, *submenu_end;
+  int *submenu_top_level_items, *submenu_n_panes;
 
   /* We must not change the menubar when actually in use.  */
   if (f->output_data.mac->menubar_active)
@@ -1461,14 +1480,6 @@
   else if (pending_menu_activation && !deep_p)
     deep_p = 1;
 
-  wv = xmalloc_widget_value ();
-  wv->name = "menubar";
-  wv->value = 0;
-  wv->enabled = 1;
-  wv->button_type = BUTTON_TYPE_NONE;
-  wv->help = Qnil;
-  first_wv = wv;
-
   if (deep_p)
     {
       /* Make a widget-value tree representing the entire menu trees.  */
@@ -1503,6 +1514,7 @@
 
       /* Run the Lucid hook.  */
       safe_run_hooks (Qactivate_menubar_hook);
+
       /* If it has changed current-menubar from previous value,
 	 really recompute the menubar from the value.  */
       if (! NILP (Vlucid_menu_bar_dirty_flag))
@@ -1517,21 +1529,56 @@
 	bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items,
 	       previous_menu_items_used * sizeof (Lisp_Object));
 
-      /* Fill in the current menu bar contents.  */
+      /* Fill in menu_items with the current menu bar contents.
+	 This can evaluate Lisp code.  */
       menu_items = f->menu_bar_vector;
       menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
+      submenu_start = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
+      submenu_end = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
+      submenu_n_panes = (int *) alloca (XVECTOR (items)->size * sizeof (int));
+      submenu_top_level_items
+	= (int *) alloca (XVECTOR (items)->size * sizeof (int *));
       init_menu_items ();
       for (i = 0; i < XVECTOR (items)->size; i += 4)
 	{
 	  Lisp_Object key, string, maps;
 
+	  last_i = i;
+
 	  key = XVECTOR (items)->contents[i];
 	  string = XVECTOR (items)->contents[i + 1];
 	  maps = XVECTOR (items)->contents[i + 2];
 	  if (NILP (string))
 	    break;
 
-	  wv = single_submenu (key, string, maps);
+	  submenu_start[i] = menu_items_used;
+
+	  menu_items_n_panes = 0;
+	  submenu_top_level_items[i]
+	    = parse_single_submenu (key, string, maps);
+	  submenu_n_panes[i] = menu_items_n_panes;
+
+	  submenu_end[i] = menu_items_used;
+	}
+
+      finish_menu_items ();
+
+      /* Convert menu_items into widget_value trees
+	 to display the menu.  This cannot evaluate Lisp code.  */
+
+      wv = xmalloc_widget_value ();
+      wv->name = "menubar";
+      wv->value = 0;
+      wv->enabled = 1;
+      wv->button_type = BUTTON_TYPE_NONE;
+      wv->help = Qnil;
+      first_wv = wv;
+
+      for (i = 0; i < last_i; i += 4)
+	{
+	  menu_items_n_panes = submenu_n_panes[i];
+	  wv = digest_single_submenu (submenu_start[i], submenu_end[i],
+				      submenu_top_level_items[i]);
 	  if (prev_wv)
 	    prev_wv->next = wv;
 	  else
@@ -1542,8 +1589,6 @@
 	  prev_wv = wv;
 	}
 
-      finish_menu_items ();
-
       set_buffer_internal_1 (prev);
       unbind_to (specpdl_count, Qnil);
 
@@ -1552,22 +1597,18 @@
 
       for (i = 0; i < previous_menu_items_used; i++)
 	if (menu_items_used == i
-	    || (NILP (Fequal (previous_items[i],
-			      XVECTOR (menu_items)->contents[i]))))
+	    || (!EQ (previous_items[i], XVECTOR (menu_items)->contents[i])))
 	  break;
       if (i == menu_items_used && i == previous_menu_items_used && i != 0)
 	{
 	  free_menubar_widget_value_tree (first_wv);
-	  menu_items = Qnil;
+	  discard_menu_items ();
 
 	  return;
 	}
 
       /* Now GC cannot happen during the lifetime of the widget_value,
-	 so it's safe to store data from a Lisp_String, as long as
-	 local copies are made when the actual menu is created.
-	 Windows takes care of this for normal string items, but
-	 not for owner-drawn items or additional item-info.  */
+	 so it's safe to store data from a Lisp_String.  */
       wv = first_wv->contents;
       for (i = 0; i < XVECTOR (items)->size; i += 4)
 	{
@@ -1582,13 +1623,21 @@
 
       f->menu_bar_vector = menu_items;
       f->menu_bar_items_used = menu_items_used;
-      menu_items = Qnil;
+      discard_menu_items ();
     }
   else
     {
       /* Make a widget-value tree containing
 	 just the top level menu bar strings.  */
 
+      wv = xmalloc_widget_value ();
+      wv->name = "menubar";
+      wv->value = 0;
+      wv->enabled = 1;
+      wv->button_type = BUTTON_TYPE_NONE;
+      wv->help = Qnil;
+      first_wv = wv;
+
       items = FRAME_MENU_BAR_ITEMS (f);
       for (i = 0; i < XVECTOR (items)->size; i += 4)
 	{
@@ -1676,6 +1725,7 @@
   set_frame_menubar (f, 1, 1);
 }
 
+
 /* Get rid of the menu bar of frame F, and free its storage.
    This is used when deleting a frame, and when turning off the menu bar.  */
 
@@ -1683,7 +1733,7 @@
 free_frame_menubar (f)
      FRAME_PTR f;
 {
-  f->output_data.mac->menubar_widget = NULL;
+  f->output_data.mac->menubar_widget = 0;
 }
 
 
@@ -1760,6 +1810,7 @@
   Lisp_Object *subprefix_stack
     = (Lisp_Object *) alloca (menu_items_used * sizeof (Lisp_Object));
   int submenu_depth = 0;
+
   int first_pane;
   int specpdl_count = SPECPDL_INDEX ();
 
@@ -1813,12 +1864,14 @@
 	  /* Create a new pane.  */
 	  Lisp_Object pane_name, prefix;
 	  char *pane_string;
+
 	  pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
 	  prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
+
 #ifndef HAVE_MULTILINGUAL_MENU
 	  if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name))
 	    {
-	      pane_name = ENCODE_SYSTEM (pane_name);
+	      pane_name = ENCODE_MENU_STRING (pane_name);
 	      AREF (menu_items, i + MENU_ITEMS_PANE_NAME) = pane_name;
 	    }
 #endif
@@ -1861,14 +1914,13 @@
 	{
 	  /* Create a new item within current pane.  */
 	  Lisp_Object item_name, enable, descrip, def, type, selected, help;
-
 	  item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
 	  enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);
 	  descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY);
 	  def = AREF (menu_items, i + MENU_ITEMS_ITEM_DEFINITION);
 	  type = AREF (menu_items, i + MENU_ITEMS_ITEM_TYPE);
 	  selected = AREF (menu_items, i + MENU_ITEMS_ITEM_SELECTED);
-          help = AREF (menu_items, i + MENU_ITEMS_ITEM_HELP);
+	  help = AREF (menu_items, i + MENU_ITEMS_ITEM_HELP);
 
 #ifndef HAVE_MULTILINGUAL_MENU
           if (STRINGP (item_name) && STRING_MULTIBYTE (item_name))
@@ -1876,8 +1928,9 @@
 	      item_name = ENCODE_MENU_STRING (item_name);
 	      AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
 	    }
+
           if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
-            {
+	    {
 	      descrip = ENCODE_MENU_STRING (descrip);
 	      AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
 	    }
@@ -1907,7 +1960,8 @@
 	    abort ();
 
 	  wv->selected = !NILP (selected);
-          if (!STRINGP (help))
+
+          if (! STRINGP (help))
 	    help = Qnil;
 
 	  wv->help = help;
@@ -1934,6 +1988,7 @@
       if (STRING_MULTIBYTE (title))
 	title = ENCODE_MENU_STRING (title);
 #endif
+
       wv_title->name = (char *) SDATA (title);
       wv_title->enabled = FALSE;
       wv_title->title = TRUE;
@@ -1957,7 +2012,6 @@
   pos.v = y;
 
   SetPortWindowPort (FRAME_MAC_WINDOW (f));
-
   LocalToGlobal (&pos);
 
   /* No selection has been chosen yet.  */
@@ -2167,11 +2221,11 @@
   "button6", "button7", "button8", "button9", "button10" };
 
 static Lisp_Object
-mac_dialog_show (f, keymaps, title, header, error)
+mac_dialog_show (f, keymaps, title, header, error_name)
      FRAME_PTR f;
      int keymaps;
      Lisp_Object title, header;
-     char **error;
+     char **error_name;
 {
   int i, nb_buttons=0;
   char dialog_name[6];
@@ -2184,11 +2238,11 @@
   /* 1 means we've seen the boundary between left-hand elts and right-hand.  */
   int boundary_seen = 0;
 
-  *error = NULL;
+  *error_name = NULL;
 
   if (menu_items_n_panes > 1)
     {
-      *error = "Multiple panes in dialog box";
+      *error_name = "Multiple panes in dialog box";
       return Qnil;
     }
 
@@ -2216,18 +2270,16 @@
       {
 
 	/* Create a new item within current pane.  */
-	Lisp_Object item_name, enable, descrip, help;
-
+	Lisp_Object item_name, enable, descrip;
 	item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME];
 	enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE];
 	descrip
 	  = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
-        help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP];
 
 	if (NILP (item_name))
 	  {
 	    free_menubar_widget_value_tree (first_wv);
-	    *error = "Submenu in dialog items";
+	    *error_name = "Submenu in dialog items";
 	    return Qnil;
 	  }
 	if (EQ (item_name, Qquote))
@@ -2241,7 +2293,7 @@
 	if (nb_buttons >= 9)
 	  {
 	    free_menubar_widget_value_tree (first_wv);
-	    *error = "Too many dialog items";
+	    *error_name = "Too many dialog items";
 	    return Qnil;
 	  }
 
@@ -2304,8 +2356,8 @@
   /* Free the widget_value objects we used to specify the contents.  */
   free_menubar_widget_value_tree (first_wv);
 
-  /* Find the selected item, and its pane, to return the proper
-     value.  */
+  /* Find the selected item, and its pane, to return
+     the proper value.  */
   if (menu_item_selection != 0)
     {
       Lisp_Object prefix;
@@ -2322,6 +2374,12 @@
 		= XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX];
 	      i += MENU_ITEMS_PANE_LENGTH;
 	    }
+	  else if (EQ (XVECTOR (menu_items)->contents[i], Qquote))
+	    {
+	      /* This is the boundary between left-side elts and
+		 right-side elts.  */
+	      ++i;
+	    }
 	  else
 	    {
 	      entry
@@ -2340,6 +2398,9 @@
 	    }
 	}
     }
+  else
+    /* Make "Cancel" equivalent to C-g.  */
+    Fsignal (Qquit, Qnil);
 
   return Qnil;
 }
@@ -2365,7 +2426,11 @@
 add_menu_item (MenuHandle menu, widget_value *wv, int submenu,
 	       int force_disable)
 {
+#if TARGET_API_MAC_CARBON
+  CFStringRef item_name;
+#else
   Str255 item_name;
+#endif
   int pos;
 
   if (name_is_separator (wv->name))
@@ -2376,42 +2441,49 @@
 
 #if TARGET_API_MAC_CARBON
       pos = CountMenuItems (menu);
-#else
-      pos = CountMItems (menu);
-#endif
-
-      strcpy (item_name, "");
-      strncat (item_name, wv->name, 255);
+
+      item_name = cfstring_create_with_utf8_cstring (wv->name);
+
       if (wv->key != NULL)
 	{
-	  strncat (item_name, " ", 255);
-	  strncat (item_name, wv->key, 255);
+	  CFStringRef name, key;
+
+	  name = item_name;
+	  key = cfstring_create_with_utf8_cstring (wv->key);
+	  item_name = CFStringCreateWithFormat (NULL, NULL, CFSTR ("%@ %@"),
+						name, key);
+	  CFRelease (name);
+	  CFRelease (key);
 	}
-      item_name[255] = 0;
-#if TARGET_API_MAC_CARBON
-      {
-	CFStringRef string = cfstring_create_with_utf8_cstring (item_name);
-
-	SetMenuItemTextWithCFString (menu, pos, string);
-	CFRelease (string);
-      }
-#else
+
+      SetMenuItemTextWithCFString (menu, pos, item_name);
+      CFRelease (item_name);
+
+      if (wv->enabled && !force_disable)
+        EnableMenuItem (menu, pos);
+      else
+        DisableMenuItem (menu, pos);
+#else  /* ! TARGET_API_MAC_CARBON */
+      pos = CountMItems (menu);
+
+      item_name[sizeof (item_name) - 1] = '\0';
+      strncpy (item_name, wv->name, sizeof (item_name) - 1);
+      if (wv->key != NULL)
+	{
+	  int len = strlen (item_name);
+
+	  strncpy (item_name + len, " ", sizeof (item_name) - 1 - len);
+	  len = strlen (item_name);
+	  strncpy (item_name + len, wv->key, sizeof (item_name) - 1 - len);
+	}
       c2pstr (item_name);
       SetMenuItemText (menu, pos, item_name);
-#endif
 
       if (wv->enabled && !force_disable)
-#if TARGET_API_MAC_CARBON
-        EnableMenuItem (menu, pos);
-#else
         EnableItem (menu, pos);
-#endif
       else
-#if TARGET_API_MAC_CARBON
-        DisableMenuItem (menu, pos);
-#else
         DisableItem (menu, pos);
-#endif
+#endif  /* ! TARGET_API_MAC_CARBON */
 
       /* Draw radio buttons and tickboxes. */
       {
@@ -2425,7 +2497,7 @@
       SetMenuItemRefCon (menu, pos, (UInt32) wv->call_data);
     }
 
-  if (submenu != NULL)
+  if (submenu != 0)
     SetMenuItemHierarchicalID (menu, pos, submenu);
 }
 
@@ -2444,7 +2516,7 @@
         add_menu_item (menu, wv, cur_submenu, 0);
       }
     else
-      add_menu_item (menu, wv, NULL, 0);
+      add_menu_item (menu, wv, 0, 0);
 }
 
 
@@ -2463,7 +2535,7 @@
         add_menu_item (menu, wv, cur_submenu, 0);
       }
     else
-      add_menu_item (menu, wv, NULL, 0);
+      add_menu_item (menu, wv, 0, 0);
 }
 
 /* Construct native Mac OS menubar based on widget_value tree.  */
@@ -2493,7 +2565,6 @@
 }
 
 #endif /* HAVE_MENUS */
-
 
 void
 syms_of_macmenu ()
--- a/src/macterm.c	Thu Dec 29 04:31:04 2005 +0000
+++ b/src/macterm.c	Thu Dec 29 04:41:02 2005 +0000
@@ -68,7 +68,6 @@
 #include <errno.h>
 #include <setjmp.h>
 #include <sys/stat.h>
-#include <sys/param.h>
 
 #include "charset.h"
 #include "coding.h"
@@ -259,7 +258,7 @@
 					    unsigned long *));
 
 static int is_emacs_window P_ ((WindowPtr));
-
+static XCharStruct *mac_per_char_metric P_ ((XFontStruct *, XChar2b *, int));
 static void XSetFont P_ ((Display *, GC, XFontStruct *));
 
 /* Defined in macmenu.h.  */
@@ -868,9 +867,159 @@
 }
 
 
+/* Mac replacement for XQueryTextExtents, but takes a character.  If
+   STYLE is NULL, measurement is done by QuickDraw Text routines for
+   the font of the current graphics port.  If CG_GLYPH is not NULL,
+   *CG_GLYPH is set to the glyph ID or 0 if it cannot be obtained.  */
+
+static OSErr
+mac_query_char_extents (style, c,
+			font_ascent_return, font_descent_return,
+			overall_return, cg_glyph)
+#if USE_ATSUI
+     ATSUStyle style;
+#else
+     void *style;
+#endif
+     int c;
+     int *font_ascent_return, *font_descent_return;
+     XCharStruct *overall_return;
 #if USE_CG_TEXT_DRAWING
-static XCharStruct *x_per_char_metric P_ ((XFontStruct *, XChar2b *));
-
+     CGGlyph *cg_glyph;
+#else
+     void *cg_glyph;
+#endif
+{
+  OSErr err = noErr;
+  int width;
+  Rect char_bounds;
+
+#if USE_ATSUI
+  if (style)
+    {
+      ATSUTextLayout text_layout;
+      UniChar ch = c;
+
+      err = atsu_get_text_layout_with_text_ptr (&ch, 1, style, &text_layout);
+      if (err == noErr)
+	{
+	  ATSTrapezoid glyph_bounds;
+
+	  err = ATSUGetGlyphBounds (text_layout, 0, 0,
+				    kATSUFromTextBeginning, kATSUToTextEnd,
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
+				    kATSUseFractionalOrigins,
+#else
+				    kATSUseDeviceOrigins,
+#endif
+				    1, &glyph_bounds, NULL);
+	  if (err == noErr)
+	    {
+	      xassert (glyph_bounds.lowerRight.x - glyph_bounds.lowerLeft.x
+		       == glyph_bounds.upperRight.x - glyph_bounds.upperLeft.x);
+
+	      width = Fix2Long (glyph_bounds.upperRight.x
+				- glyph_bounds.upperLeft.x);
+	      if (font_ascent_return)
+		*font_ascent_return = -Fix2Long (glyph_bounds.upperLeft.y);
+	      if (font_descent_return)
+		*font_descent_return = Fix2Long (glyph_bounds.lowerLeft.y);
+	    }
+	}
+      if (err == noErr && overall_return)
+	{
+	  err = ATSUMeasureTextImage (text_layout,
+				      kATSUFromTextBeginning, kATSUToTextEnd,
+				      0, 0, &char_bounds);
+	  if (err == noErr)
+	    STORE_XCHARSTRUCT (*overall_return, width, char_bounds);
+#if USE_CG_TEXT_DRAWING
+	  if (err == noErr && cg_glyph)
+	    {
+	      OSErr err1;
+	      ATSUGlyphInfoArray glyph_info_array;
+	      ByteCount count = sizeof (ATSUGlyphInfoArray);
+
+	      err1 = ATSUMatchFontsToText (text_layout, kATSUFromTextBeginning,
+					   kATSUToTextEnd, NULL, NULL, NULL);
+	      if (err1 == noErr)
+		err1 = ATSUGetGlyphInfo (text_layout, kATSUFromTextBeginning,
+					 kATSUToTextEnd, &count,
+					 &glyph_info_array);
+	      if (err1 == noErr)
+		{
+		  xassert (glyph_info_array.glyphs[0].glyphID);
+		  *cg_glyph = glyph_info_array.glyphs[0].glyphID;
+		}
+	      else
+		*cg_glyph = 0;
+	    }
+#endif
+	}
+    }
+  else
+#endif
+    {
+      if (font_ascent_return || font_descent_return)
+	{
+	  FontInfo font_info;
+
+	  GetFontInfo (&font_info);
+	  if (font_ascent_return)
+	    *font_ascent_return = font_info.ascent;
+	  if (font_descent_return)
+	    *font_descent_return = font_info.descent;
+	}
+      if (overall_return)
+	{
+	  char ch = c;
+
+	  width = CharWidth (ch);
+	  QDTextBounds (1, &ch, &char_bounds);
+	  STORE_XCHARSTRUCT (*overall_return, width, char_bounds);
+	}
+    }
+
+  return err;
+}
+
+
+/* Mac replacement for XTextExtents16.  Only sets horizontal metrics.  */
+
+static int
+mac_text_extents_16 (font_struct, string, nchars, overall_return)
+     XFontStruct *font_struct;
+     XChar2b *string;
+     int nchars;
+     XCharStruct *overall_return;
+{
+  int i;
+  short width = 0, lbearing = 0, rbearing = 0;
+  XCharStruct *pcm;
+
+  for (i = 0; i < nchars; i++)
+    {
+      pcm = mac_per_char_metric (font_struct, string, 0);
+      if (pcm == NULL)
+	width += FONT_WIDTH (font_struct);
+      else
+	{
+	  lbearing = min (lbearing, width + pcm->lbearing);
+	  rbearing = max (rbearing, width + pcm->rbearing);
+	  width += pcm->width;
+	}
+      string++;
+    }
+
+  overall_return->lbearing = lbearing;
+  overall_return->rbearing = rbearing;
+  overall_return->width = width;
+
+  /* What's the meaning of the return value of XTextExtents16?  */
+}
+
+
+#if USE_CG_TEXT_DRAWING
 static int cg_text_anti_aliasing_threshold = 8;
 
 static void
@@ -910,7 +1059,9 @@
   advances = xmalloc (sizeof (CGSize) * nchars);
   for (i = 0; i < nchars; i++)
     {
-      advances[i].width = x_per_char_metric (GC_FONT (gc), buf)->width;
+      XCharStruct *pcm = mac_per_char_metric (GC_FONT (gc), buf, 0);
+
+      advances[i].width = pcm->width;
       advances[i].height = 0;
       glyphs[i] = GC_FONT (gc)->cg_glyphs[buf->byte2];
       buf++;
@@ -1724,63 +1875,32 @@
 #if USE_ATSUI
   if (font->mac_style)
     {
-      if (char2b->byte1 >= font->min_byte1
-	  && char2b->byte1 <= font->max_byte1
-	  && char2b->byte2 >= font->min_char_or_byte2
-	  && char2b->byte2 <= font->max_char_or_byte2)
+      XCharStructRow **row = font->bounds.rows + char2b->byte1;
+
+      if (*row == NULL)
 	{
-	  pcm = (font->per_char
-		 + ((font->max_char_or_byte2 - font->min_char_or_byte2 + 1)
-		    * (char2b->byte1 - font->min_byte1))
-		 + (char2b->byte2 - font->min_char_or_byte2));
+	  *row = xmalloc (sizeof (XCharStructRow));
+	  if (*row)
+	    bzero (*row, sizeof (XCharStructRow));
 	}
-
-      if (pcm && !pcm->valid_p)
+      if (*row)
 	{
-	  OSErr err;
-	  ATSUTextLayout text_layout;
-	  UniChar c;
-	  int char_width;
-	  ATSTrapezoid glyph_bounds;
-	  Rect char_bounds;
-
-	  c = (char2b->byte1 << 8) + char2b->byte2;
-	  BLOCK_INPUT;
-	  err = atsu_get_text_layout_with_text_ptr (&c, 1,
-						    font->mac_style,
-						    &text_layout);
-	  if (err == noErr)
-	    err = ATSUMeasureTextImage (text_layout,
-					kATSUFromTextBeginning, kATSUToTextEnd,
-					0, 0, &char_bounds);
-
-	  if (err == noErr)
-	    err = ATSUGetGlyphBounds (text_layout, 0, 0,
-				      kATSUFromTextBeginning, kATSUToTextEnd,
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
-				      kATSUseFractionalOrigins,
-#else
-				      kATSUseDeviceOrigins,
-#endif
-				      1, &glyph_bounds, NULL);
-	  UNBLOCK_INPUT;
-	  if (err != noErr)
-	    pcm = NULL;
-	  else
+	  pcm = (*row)->per_char + char2b->byte2;
+	  if (!XCHARSTRUCTROW_CHAR_VALID_P (*row, char2b->byte2))
 	    {
-	      xassert (glyph_bounds.lowerRight.x - glyph_bounds.lowerLeft.x
-		       == glyph_bounds.upperRight.x - glyph_bounds.upperLeft.x);
-
-	      char_width = Fix2Long (glyph_bounds.upperRight.x
-				     - glyph_bounds.upperLeft.x);
-	      STORE_XCHARSTRUCT (*pcm, char_width, char_bounds);
+	      BLOCK_INPUT;
+	      mac_query_char_extents (font->mac_style,
+				      (char2b->byte1 << 8) + char2b->byte2,
+				      NULL, NULL, pcm, NULL);
+	      UNBLOCK_INPUT;
+	      XCHARSTRUCTROW_SET_CHAR_VALID (*row, char2b->byte2);
 	    }
 	}
     }
   else
     {
 #endif
-  if (font->per_char != NULL)
+  if (font->bounds.per_char != NULL)
     {
       if (font->min_byte1 == 0 && font->max_byte1 == 0)
 	{
@@ -1793,7 +1913,8 @@
 	  if (char2b->byte1 == 0
 	      && char2b->byte2 >= font->min_char_or_byte2
 	      && char2b->byte2 <= font->max_char_or_byte2)
-	    pcm = font->per_char + char2b->byte2 - font->min_char_or_byte2;
+	    pcm = font->bounds.per_char
+	      + (char2b->byte2 - font->min_char_or_byte2);
 	}
       else
 	{
@@ -1815,7 +1936,7 @@
 	      && char2b->byte2 >= font->min_char_or_byte2
 	      && char2b->byte2 <= font->max_char_or_byte2)
 	    {
-	      pcm = (font->per_char
+	      pcm = (font->bounds.per_char
 		     + ((font->max_char_or_byte2 - font->min_char_or_byte2 + 1)
 			* (char2b->byte1 - font->min_byte1))
 		     + (char2b->byte2 - font->min_char_or_byte2));
@@ -2157,67 +2278,32 @@
 {
   if (s->cmp == NULL
       && s->first_glyph->type == CHAR_GLYPH)
-    {
-      Rect r;
-      MacFontStruct *font = s->font;
-
+    if (!s->two_byte_p
 #if USE_ATSUI
-      if (font->mac_style)
-	{
-	  OSErr err;
-	  ATSUTextLayout text_layout;
-	  UniChar *buf;
-	  int i;
-
-	  SetRect (&r, 0, 0, 0, 0);
-	  buf = xmalloc (sizeof (UniChar) * s->nchars);
-	  if (buf)
-	    {
-	      for (i = 0; i < s->nchars; i++)
-		buf[i] = (s->char2b[i].byte1 << 8) + s->char2b[i].byte2;
-
-	      err = atsu_get_text_layout_with_text_ptr (buf, s->nchars,
-							font->mac_style,
-							&text_layout);
-	      if (err == noErr)
-		err = ATSUMeasureTextImage (text_layout,
-					    kATSUFromTextBeginning,
-					    kATSUToTextEnd,
-					    0, 0, &r);
-	      xfree (buf);
-	    }
-	}
-      else
-	{
-#endif
-      TextFont (font->mac_fontnum);
-      TextSize (font->mac_fontsize);
-      TextFace (font->mac_fontface);
-
-      if (s->two_byte_p)
+	|| s->font->mac_style
+#endif
+	)
+      {
+	XCharStruct cs;
+
+	mac_text_extents_16 (s->font, s->char2b, s->nchars, &cs);
+	s->right_overhang = cs.rbearing > cs.width ? cs.rbearing - cs.width : 0;
+	s->left_overhang = cs.lbearing < 0 ? -cs.lbearing : 0;
+      }
+    else
+      {
+	Rect r;
+	MacFontStruct *font = s->font;
+
+	TextFont (font->mac_fontnum);
+	TextSize (font->mac_fontsize);
+	TextFace (font->mac_fontface);
+
 	QDTextBounds (s->nchars * 2, (char *)s->char2b, &r);
-      else
-	{
-	  int i;
-	  char *buf = xmalloc (s->nchars);
-
-	  if (buf == NULL)
-	    SetRect (&r, 0, 0, 0, 0);
-	  else
-	    {
-	      for (i = 0; i < s->nchars; ++i)
-		buf[i] = s->char2b[i].byte2;
-	      QDTextBounds (s->nchars, buf, &r);
-	      xfree (buf);
-	    }
-	}
-#if USE_ATSUI
-        }
-#endif
-
-      s->right_overhang = r.right > s->width ? r.right - s->width : 0;
-      s->left_overhang = r.left < 0 ? -r.left : 0;
-    }
+
+	s->right_overhang = r.right > s->width ? r.right - s->width : 0;
+	s->left_overhang = r.left < 0 ? -r.left : 0;
+      }
 }
 
 
@@ -7375,7 +7461,7 @@
 static MacFontStruct *
 XLoadQueryFont (Display *dpy, char *fontname)
 {
-  int i, size, char_width;
+  int size;
   char *name;
   Str255 family;
   Str31 charset;
@@ -7392,6 +7478,7 @@
   short scriptcode;
 #endif
   MacFontStruct *font;
+  XCharStruct *space_bounds = NULL, *pcm;
 
   if (is_fully_specified_xlfd (fontname))
     name = fontname;
@@ -7488,19 +7575,27 @@
   if (font->mac_style)
     {
       OSErr err;
-      ATSUTextLayout text_layout;
-      UniChar c = 0x20;
-      Rect char_bounds, min_bounds, max_bounds;
-      int min_width, max_width;
-      ATSTrapezoid glyph_bounds;
-
-      font->per_char = xmalloc (sizeof (XCharStruct) * 0x10000);
-      if (font->per_char == NULL)
+      UniChar c;
+
+      font->min_byte1 = 0;
+      font->max_byte1 = 0xff;
+      font->min_char_or_byte2 = 0;
+      font->max_char_or_byte2 = 0xff;
+
+      font->bounds.rows = xmalloc (sizeof (XCharStructRow *) * 0x100);
+      if (font->bounds.rows == NULL)
 	{
 	  mac_unload_font (&one_mac_display_info, font);
 	  return NULL;
 	}
-      bzero (font->per_char, sizeof (XCharStruct) * 0x10000);
+      bzero (font->bounds.rows, sizeof (XCharStructRow *) * 0x100);
+      font->bounds.rows[0] = xmalloc (sizeof (XCharStructRow));
+      if (font->bounds.rows[0] == NULL)
+	{
+	  mac_unload_font (&one_mac_display_info, font);
+	  return NULL;
+	}
+      bzero (font->bounds.rows[0], sizeof (XCharStructRow));
 
 #if USE_CG_TEXT_DRAWING
       {
@@ -7525,108 +7620,58 @@
       if (font->cg_glyphs)
 	bzero (font->cg_glyphs, sizeof (CGGlyph) * 0x100);
 #endif
-
-      err = atsu_get_text_layout_with_text_ptr (&c, 1,
-						font->mac_style,
-						&text_layout);
+      space_bounds = font->bounds.rows[0]->per_char + 0x20;
+      err = mac_query_char_extents (font->mac_style, 0x20,
+				    &font->ascent, &font->descent,
+				    space_bounds,
+#if USE_CG_TEXT_DRAWING
+				    (font->cg_glyphs ? font->cg_glyphs + 0x20
+				     : NULL)
+#else
+				    NULL
+#endif
+				    );
       if (err != noErr)
 	{
 	  mac_unload_font (&one_mac_display_info, font);
 	  return NULL;
 	}
-
-      for (c = 0x20; c <= 0xff; c++)
+      XCHARSTRUCTROW_SET_CHAR_VALID (font->bounds.rows[0], 0x20);
+
+      pcm = font->bounds.rows[0]->per_char;
+      for (c = 0x21; c <= 0xff; c++)
 	{
 	  if (c == 0xad)
 	    /* Soft hyphen is not supported in ATSUI.  */
 	    continue;
 	  else if (c == 0x7f)
 	    {
-	      STORE_XCHARSTRUCT (font->min_bounds, min_width, min_bounds);
-	      STORE_XCHARSTRUCT (font->max_bounds, max_width, max_bounds);
 	      c = 0x9f;
 	      continue;
 	    }
 
-	  err = ATSUClearLayoutCache (text_layout, kATSUFromTextBeginning);
-	  if (err == noErr)
-	    err = ATSUMeasureTextImage (text_layout,
-					kATSUFromTextBeginning, kATSUToTextEnd,
-					0, 0, &char_bounds);
-	  if (err == noErr)
-	    err = ATSUGetGlyphBounds (text_layout, 0, 0,
-				      kATSUFromTextBeginning, kATSUToTextEnd,
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
-				      kATSUseFractionalOrigins,
+	  mac_query_char_extents (font->mac_style, c, NULL, NULL, pcm + c,
+#if USE_CG_TEXT_DRAWING
+				  (font->cg_glyphs ? font->cg_glyphs + c
+				   : NULL)
 #else
-				      kATSUseDeviceOrigins,
-#endif
-				      1, &glyph_bounds, NULL);
-	  if (err == noErr)
+				    NULL
+#endif
+				  );
+	  XCHARSTRUCTROW_SET_CHAR_VALID (font->bounds.rows[0], c);
+
+#if USE_CG_TEXT_DRAWING
+	  if (font->cg_glyphs && font->cg_glyphs[c] == 0)
 	    {
-	      xassert (glyph_bounds.lowerRight.x - glyph_bounds.lowerLeft.x
-		       == glyph_bounds.upperRight.x - glyph_bounds.upperLeft.x);
-
-	      char_width = Fix2Long (glyph_bounds.upperRight.x
-				     - glyph_bounds.upperLeft.x);
-	      STORE_XCHARSTRUCT (font->per_char[c],
-				 char_width, char_bounds);
-	      if (c == 0x20)
-		{
-		  min_width = max_width = char_width;
-		  min_bounds = max_bounds = char_bounds;
-		  font->ascent = -Fix2Long (glyph_bounds.upperLeft.y);
-		  font->descent = Fix2Long (glyph_bounds.lowerLeft.y);
-		}
-	      else
-		{
-		  if (char_width > 0)
-		    {
-		      min_width = min (min_width, char_width);
-		      max_width = max (max_width, char_width);
-		    }
-		  if (!EmptyRect (&char_bounds))
-		    {
-		      SetRect (&min_bounds,
-			       max (min_bounds.left, char_bounds.left),
-			       max (min_bounds.top, char_bounds.top),
-			       min (min_bounds.right, char_bounds.right),
-			       min (min_bounds.bottom, char_bounds.bottom));
-		      UnionRect (&max_bounds, &char_bounds, &max_bounds);
-		    }
-		}
-	    }
-#if USE_CG_TEXT_DRAWING
-	  if (err == noErr && char_width > 0 && font->cg_font)
-	    {
-	      ATSUGlyphInfoArray glyph_info_array;
-	      ByteCount count = sizeof (ATSUGlyphInfoArray);
-
-	      err = ATSUMatchFontsToText (text_layout, kATSUFromTextBeginning,
-					  kATSUToTextEnd, NULL, NULL, NULL);
-	      if (err == noErr)
-		err = ATSUGetGlyphInfo (text_layout, kATSUFromTextBeginning,
-					kATSUToTextEnd, &count,
-					&glyph_info_array);
-	      if (err == noErr)
-		font->cg_glyphs[c] = glyph_info_array.glyphs[0].glyphID;
-	      else
-		{
-		  /* Don't use CG text drawing if font substitution
-		     occurs in ASCII or Latin-1 characters.  */
-		  CGFontRelease (font->cg_font);
-		  font->cg_font = NULL;
-		  xfree (font->cg_glyphs);
-		  font->cg_glyphs = NULL;
-		}
+	      /* Don't use CG text drawing if font substitution occurs in
+		 ASCII or Latin-1 characters.  */
+	      CGFontRelease (font->cg_font);
+	      font->cg_font = NULL;
+	      xfree (font->cg_glyphs);
+	      font->cg_glyphs = NULL;
 	    }
 #endif
 	}
-
-      font->min_byte1 = 0;
-      font->max_byte1 = 0xff;
-      font->min_char_or_byte2 = 0;
-      font->max_char_or_byte2 = 0xff;
     }
   else
 #endif
@@ -7665,6 +7710,8 @@
 
       if (is_two_byte_font)
 	{
+	  int char_width;
+
 	  font->min_byte1 = 0xa1;
 	  font->max_byte1 = 0xfe;
 	  font->min_char_or_byte2 = 0xa1;
@@ -7693,21 +7740,8 @@
 	      char_width = StringWidth("\p\xa1\xa1");
 	      break;
 	    }
-	}
-      else
-	{
-	  font->min_byte1 = font->max_byte1 = 0;
-	  font->min_char_or_byte2 = 0x20;
-	  font->max_char_or_byte2 = 0xff;
-
-	  /* Do this instead of use the_fontinfo.widMax, which
-	     incorrectly returns 15 for 12-point Monaco! */
-	  char_width = CharWidth ('m');
-	}
-
-      if (is_two_byte_font)
-	{
-	  font->per_char = NULL;
+
+	  font->bounds.per_char = NULL;
 
 	  if (fontface & italic)
 	    font->max_bounds.rbearing = char_width + 1;
@@ -7722,54 +7756,28 @@
 	}
       else
 	{
-	  int c, min_width, max_width;
-	  Rect char_bounds, min_bounds, max_bounds;
-	  char ch;
-
-	  font->per_char = xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1));
-	  bzero (font->per_char, sizeof (XCharStruct) * (0xff - 0x20 + 1));
-
-	  min_width = max_width = char_width;
-	  SetRect (&min_bounds, -32767, -32767, 32767, 32767);
-	  SetRect (&max_bounds, 0, 0, 0, 0);
-	  for (c = 0x20; c <= 0xff; c++)
+	  int c;
+
+	  font->min_byte1 = font->max_byte1 = 0;
+	  font->min_char_or_byte2 = 0x20;
+	  font->max_char_or_byte2 = 0xff;
+
+	  font->bounds.per_char =
+	    xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1));
+	  if (font->bounds.per_char == NULL)
 	    {
-	      if (c == 0x7f)
-		{
-		  STORE_XCHARSTRUCT (font->min_bounds, min_width, min_bounds);
-		  STORE_XCHARSTRUCT (font->max_bounds, max_width, max_bounds);
-		  continue;
-		}
-
-	      ch = c;
-	      char_width = CharWidth (ch);
-	      QDTextBounds (1, &ch, &char_bounds);
-	      STORE_XCHARSTRUCT (font->per_char[c - 0x20],
-				 char_width, char_bounds);
-	      /* Some Japanese fonts (in SJIS encoding) return 0 as
-		 the character width of 0x7f.  */
-	      if (char_width > 0)
-		{
-		  min_width = min (min_width, char_width);
-		  max_width = max (max_width, char_width);
-		}
-	      if (!EmptyRect (&char_bounds))
-		{
-		  SetRect (&min_bounds,
-			   max (min_bounds.left, char_bounds.left),
-			   max (min_bounds.top, char_bounds.top),
-			   min (min_bounds.right, char_bounds.right),
-			   min (min_bounds.bottom, char_bounds.bottom));
-		  UnionRect (&max_bounds, &char_bounds, &max_bounds);
-		}
+	      mac_unload_font (&one_mac_display_info, font);
+	      return NULL;
 	    }
-	  if (min_width == max_width
-	      && max_bounds.left >= 0 && max_bounds.right <= max_width)
-	    {
-	      /* Fixed width and no overhangs.  */
-	      xfree (font->per_char);
-	      font->per_char = NULL;
-	    }
+	  bzero (font->bounds.per_char,
+		 sizeof (XCharStruct) * (0xff - 0x20 + 1));
+
+	  space_bounds = font->bounds.per_char;
+	  mac_query_char_extents (NULL, 0x20, &font->ascent, &font->descent,
+				  space_bounds, NULL);
+
+	  for (c = 0x21, pcm = space_bounds + 1; c <= 0xff; c++, pcm++)
+	    mac_query_char_extents (NULL, c, NULL, NULL, pcm, NULL);
 	}
 
       /* Restore previous font number, size and face.  */
@@ -7778,6 +7786,46 @@
       TextFace (old_fontface);
     }
 
+  if (space_bounds)
+    {
+      int c;
+
+      font->min_bounds = font->max_bounds = *space_bounds;
+      for (c = 0x21, pcm = space_bounds + 1; c <= 0x7f; c++, pcm++)
+	if (pcm->width > 0)
+	  {
+	    font->min_bounds.lbearing = min (font->min_bounds.lbearing,
+					     pcm->lbearing);
+	    font->min_bounds.rbearing = min (font->min_bounds.rbearing,
+					     pcm->rbearing);
+	    font->min_bounds.width    = min (font->min_bounds.width,
+					     pcm->width);
+	    font->min_bounds.ascent   = min (font->min_bounds.ascent,
+					     pcm->ascent);
+
+	    font->max_bounds.lbearing = max (font->max_bounds.lbearing,
+					     pcm->lbearing);
+	    font->max_bounds.rbearing = max (font->max_bounds.rbearing,
+					     pcm->rbearing);
+	    font->max_bounds.width    = max (font->max_bounds.width,
+					     pcm->width);
+	    font->max_bounds.ascent   = max (font->max_bounds.ascent,
+					     pcm->ascent);
+	  }
+      if (
+#if USE_ATSUI
+	  font->mac_style == NULL &&
+#endif
+	  font->max_bounds.width == font->min_bounds.width
+	  && font->min_bounds.lbearing >= 0
+	  && font->max_bounds.rbearing <= font->max_bounds.width)
+	{
+	  /* Fixed width and no overhangs.  */
+	  xfree (font->bounds.per_char);
+	  font->bounds.per_char = NULL;
+	}
+    }
+
 #if !defined (MAC_OS8) || USE_ATSUI
   /* AppKit and WebKit do some adjustment to the heights of Courier,
      Helvetica, and Times.  This only works on the environments where
@@ -7797,18 +7845,27 @@
      XFontStruct *font;
 {
   xfree (font->full_name);
-  if (font->per_char)
-    xfree (font->per_char);
 #if USE_ATSUI
   if (font->mac_style)
-    ATSUDisposeStyle (font->mac_style);
+    {
+      int i;
+
+      for (i = font->min_byte1; i <= font->max_byte1; i++)
+	if (font->bounds.rows[i])
+	  xfree (font->bounds.rows[i]);
+      xfree (font->bounds.rows);
+      ATSUDisposeStyle (font->mac_style);
+    }
+  else
+#endif
+    if (font->bounds.per_char)
+      xfree (font->bounds.per_char);
 #if USE_CG_TEXT_DRAWING
   if (font->cg_font)
     CGFontRelease (font->cg_font);
   if (font->cg_glyphs)
     xfree (font->cg_glyphs);
 #endif
-#endif
   xfree (font);
 }
 
@@ -8143,6 +8200,7 @@
 extern void mac_find_apple_event_spec P_ ((AEEventClass, AEEventID,
 					   Lisp_Object *, Lisp_Object *,
 					   Lisp_Object *));
+extern OSErr init_coercion_handler P_ ((void));
 
 #if TARGET_API_MAC_CARBON
 /* Drag and Drop */
@@ -9149,25 +9207,25 @@
       result = GetFlavorFlags (theDrag, theItem, flavorTypeHFS, &theFlags);
       if (result == noErr)
 	{
-#ifdef MAC_OSX
-	  FSRef fref;
-#endif
-	  char unix_path_name[MAXPATHLEN];
-
-	  GetFlavorData (theDrag, theItem, flavorTypeHFS, &data, &size, 0L);
-#ifdef MAC_OSX
-	  /* Use Carbon routines, otherwise it converts the file name
-	     to /Macintosh HD/..., which is not correct. */
-	  FSpMakeFSRef (&data.fileSpec, &fref);
-	  if (! FSRefMakePath (&fref, unix_path_name, sizeof (unix_path_name)));
-#else
-	  if (fsspec_to_posix_pathname (&data.fileSpec, unix_path_name,
-					sizeof (unix_path_name) - 1) == noErr)
-#endif
-	    /* x-dnd functions expect undecoded filenames.  */
-            file_list = Fcons (make_unibyte_string (unix_path_name,
-						    strlen (unix_path_name)),
-			       file_list);
+	  OSErr err;
+	  AEDesc desc;
+
+	  err = GetFlavorData (theDrag, theItem, flavorTypeHFS,
+			       &data, &size, 0L);
+	  if (err == noErr)
+	    err = AECoercePtr (typeFSS, &data.fileSpec, sizeof (FSSpec),
+			       TYPE_FILE_NAME, &desc);
+	  if (err == noErr)
+	    {
+	      Lisp_Object file;
+
+	      /* x-dnd functions expect undecoded filenames.  */
+	      file = make_uninit_string (AEGetDescDataSize (&desc));
+	      err = AEGetDescData (&desc, SDATA (file), SBYTES (file));
+	      if (err == noErr)
+		file_list = Fcons (file, file_list);
+	      AEDisposeDesc (&desc);
+	    }
 	}
     }
   /* If there are items in the list, construct an event and post it to
@@ -9259,6 +9317,8 @@
 
   init_environ ();
 
+  init_coercion_handler ();
+
   initialize_applescript ();
 
   init_apple_event_handler ();
@@ -10648,6 +10708,8 @@
 #endif	/* USE_CARBON_EVENTS */
 
 #ifdef MAC_OSX
+  init_coercion_handler ();
+
   init_apple_event_handler ();
 
   if (!inhibit_window_system)
--- a/src/macterm.h	Thu Dec 29 04:31:04 2005 +0000
+++ b/src/macterm.h	Thu Dec 29 04:41:02 2005 +0000
@@ -322,9 +322,6 @@
   /* Nonzero means menubar is currently active.  */
   char menubar_active;
 
-  /* Nonzero means a menu command is being processed.  */
-  char menu_command_in_progress;
-
   /* Relief GCs, colors etc.  */
   struct relief
   {
@@ -569,14 +566,14 @@
 #define FONT_TYPE_FOR_UNIBYTE(font, ch) 0
 #define FONT_TYPE_FOR_MULTIBYTE(font, ch) 0
 
+#define TYPE_FILE_NAME 'fNam'
+
 /* Defined in macselect.c */
 
 extern void x_clear_frame_selections P_ ((struct frame *));
 
 /* Defined in mac.c.  */
 
-extern OSErr posix_pathname_to_fsspec P_ ((const char *, FSSpec *));
-extern OSErr fsspec_to_posix_pathname P_ ((const FSSpec *, char *, int));
 extern void mac_clear_font_name_table P_ ((void));
 extern Lisp_Object mac_aedesc_to_lisp P_ ((AEDesc *));
 #if TARGET_API_MAC_CARBON
--- a/src/minibuf.c	Thu Dec 29 04:31:04 2005 +0000
+++ b/src/minibuf.c	Thu Dec 29 04:41:02 2005 +0000
@@ -2410,7 +2410,7 @@
   else
     {
       write_string ("Possible completions are:", -1);
-      for (tail = completions, i = 0; !NILP (tail); tail = Fcdr (tail), i++)
+      for (tail = completions, i = 0; CONSP (tail); tail = XCDR (tail), i++)
 	{
 	  Lisp_Object tem, string;
 	  int length;
@@ -2418,7 +2418,7 @@
 
 	  startpos = Qnil;
 
-	  elt = Fcar (tail);
+	  elt = XCAR (tail);
 	  if (SYMBOLP (elt))
 	    elt = SYMBOL_NAME (elt);
 	  /* Compute the length of this element.  */
@@ -2594,9 +2594,21 @@
       temp_echo_area_glyphs (build_string (" [No completions]"));
     }
   else
-    internal_with_output_to_temp_buffer ("*Completions*",
-					 display_completion_list_1,
-					 Fsort (completions, Qstring_lessp));
+    {
+      /* Sort and remove duplicates.  */
+      Lisp_Object tmp = completions = Fsort (completions, Qstring_lessp);
+      while (CONSP (tmp))
+	{
+	  if (CONSP (XCDR (tmp))
+	      && !NILP (Fequal (XCAR (tmp), XCAR (XCDR (tmp)))))
+	    XSETCDR (tmp, XCDR (XCDR (tmp)));
+	  else
+	    tmp = XCDR (tmp);
+	}
+      internal_with_output_to_temp_buffer ("*Completions*",
+					   display_completion_list_1,
+					   completions);
+    }
   return Qnil;
 }
 
--- a/src/xfns.c	Thu Dec 29 04:31:04 2005 +0000
+++ b/src/xfns.c	Thu Dec 29 04:41:02 2005 +0000
@@ -5238,8 +5238,27 @@
 			File selection dialog
  ***********************************************************************/
 
+DEFUN ("x-uses-old-gtk-dialog", Fx_uses_old_gtk_dialog,
+       Sx_uses_old_gtk_dialog,
+       0, 0, 0,
+       doc: /* Return t if the old Gtk+ file selection dialog is used.  */)
+     ()
+{
+#ifdef USE_GTK
+  extern int use_dialog_box;
+  extern int use_file_dialog;
+
+  if (use_dialog_box
+      && use_file_dialog
+      && have_menus_p ()
+      && xg_uses_old_file_dialog ())
+    return Qt;
+#endif
+  return Qnil;
+}
+
+
 #ifdef USE_MOTIF
-
 /* Callback for "OK" and "Cancel" on file selection dialog.  */
 
 static void
@@ -5859,6 +5878,7 @@
   last_show_tip_args = Qnil;
   staticpro (&last_show_tip_args);
 
+  defsubr (&Sx_uses_old_gtk_dialog);
 #if defined (USE_MOTIF) || defined (USE_GTK)
   defsubr (&Sx_file_dialog);
 #endif
--- a/src/xmenu.c	Thu Dec 29 04:31:04 2005 +0000
+++ b/src/xmenu.c	Thu Dec 29 04:41:02 2005 +0000
@@ -3388,6 +3388,11 @@
       return Qnil;
     }
 
+  /* Don't GC while we prepare and show the menu,
+     because we give the oldxmenu library pointers to the
+     contents of strings.  */
+  inhibit_garbage_collection ();
+
 #ifdef HAVE_X_WINDOWS
   /* Adjust coordinates to relative to the outer (window manager) window.  */
   x += FRAME_OUTER_TO_INNER_DIFF_X (f);