changeset 83408:39bb10ce301a

Merged in changes from CVS trunk. Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-667 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-669 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-670 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-157 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-158 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-159 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-160 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-161 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-162 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-163 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-164 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-165 Update from CVS: texi/message.texi: Fix default values. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-166 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-167 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-168 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-448
author Karoly Lorentey <lorentey@elte.hu>
date Sun, 11 Dec 2005 22:42:40 +0000
parents 37d0562504bf (current diff) 76e4d7c8d043 (diff)
children be1f74bffc1d
files admin/FOR-RELEASE lisp/ChangeLog lisp/calendar/todo-mode.el lisp/emulation/cua-base.el lisp/files.el lisp/isearch.el lisp/recentf.el lisp/simple.el lisp/term/mac-win.el lispref/ChangeLog man/ChangeLog src/Makefile.in src/indent.c src/keyboard.c src/lread.c src/macterm.c src/macterm.h src/termhooks.h
diffstat 109 files changed, 4657 insertions(+), 1711 deletions(-) [+]
line wrap: on
line diff
--- a/admin/ChangeLog	Sat Dec 10 21:18:28 2005 +0000
+++ b/admin/ChangeLog	Sun Dec 11 22:42:40 2005 +0000
@@ -1,3 +1,10 @@
+2005-12-09  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* FOR-RELEASE (DOCUMENTATION): Remove message-mail, gnus-*
+	completing-read-multiple, mail-extract-address-components,
+	mail-mode, quail-define-package, save-buffer and
+	ucs-set-table-for-input from doc strings item (Done).
+
 2005-11-28  Chong Yidong  <cyd@stupidchicken.com>
 
 	* FOR-RELEASE: Icons installed.  Partial completion bug fixed.
--- a/admin/FOR-RELEASE	Sat Dec 10 21:18:28 2005 +0000
+++ b/admin/FOR-RELEASE	Sun Dec 11 22:42:40 2005 +0000
@@ -47,9 +47,7 @@
 
 * BUGS
 
-** Fix window resizing bug:
-C-x 2, C-x 3, C-x 2. Now try to move the bottom of the
-second window to the left.
+** Ronan Keryell's Sep 23 bug about "tramp sudo:: and version control on RCS"
 
 ** TCP server processes do not work on Windows.
 
@@ -60,8 +58,64 @@
 
 * DOCUMENTATION
 
-** Update what needs to be updated now that Global Font Lock mode and
-File Name Shadow mode are enabled by default.
+** Fix some of these doc strings by adding \\<keymap-name> where needed.
+
+ada-mode
+array-mode
+artist-mode
+autoarg-mode
+bibtext-mode
+bookmark-bmenu-other-window-with-mouse
+checkdoc-minor-mode
+constrain-to-field
+copy-file
+decipher-mode
+define-generic-mode
+define-ibuffer-op
+diff-mode
+dired-maybe-insert-subdir
+ediff-merge-buffers-with-ancestor
+ediff-merge-directories-with-ancestor
+ediff-merge-directory-revisions-with-ancestor
+edir-merge-revisions-with-ancestor
+edirs-merge-with-ancestor
+edit-picture
+ethio-fidel-to-sera-mail-or-marker
+ethio-sera-to-fidel-mail-or-marker
+face-attribute-specified-or
+face-equal
+flyspell-mode
+hexl-mode
+hi-lock-mode
+ibuffer
+ido-find-file
+internal-lisp-face-equal-p
+isearch-forward
+kmacro-start-macro
+kmacro-start-macro-or-insert-counter
+make-byte-code
+mh-user-agent-compose
+next-single-char-property-change
+octave-mode
+outline-mode
+pascal-mode
+picture-mode
+previous-single-char-property-change
+python-mode
+read-from-minibuffer
+read-key-sequence
+read-key-sequence-vector
+reftex-index-phrases-mode
+reftex-mode
+rmail-mode
+sh-mode
+shell-script-mode
+solar-equinoxes-solstices
+table-capture
+table-insert
+table-split-cell-horizontally
+view-mode
+w32-shell-dos-semantics
 
 ** Check man/info.texi.
 
@@ -77,7 +131,7 @@
 lib-src			done		ttn
 lisp			done		ttn
 lisp/calc		done		ttn
-lisp/calendar		working		Glenn Morris
+lisp/calendar		done		Glenn Morris
 lisp/emacs-lisp		done		ttn
 lisp/emulation		done		ttn
 lisp/eshell		done		ttn
--- a/etc/ChangeLog	Sat Dec 10 21:18:28 2005 +0000
+++ b/etc/ChangeLog	Sun Dec 11 22:42:40 2005 +0000
@@ -1,3 +1,8 @@
+2005-12-10  David Koppelman  <koppel@ece.lsu.edu>
+
+	* NEWS: hi-lock-mode is now buffer local, use global-hi-lock-mode
+	instead.
+
 2005-12-02  Jay Belanger  <belanger@truman.edu>
 
 	* NEWS: Add comment about the Calc prefix.
--- a/etc/NEWS	Sat Dec 10 21:18:28 2005 +0000
+++ b/etc/NEWS	Sun Dec 11 22:42:40 2005 +0000
@@ -268,6 +268,7 @@
 to the text before point.  If there is text in the buffer after point,
 it remains unchanged.
 
++++
 ** When Emacs prompts for file names, SPC no longer completes the file name.
 This is so filenames with embedded spaces could be input without the
 need to quote the space with a C-q.  The underlying changes in the
@@ -1809,6 +1810,18 @@
 
 * Changes in Specialized Modes and Packages in Emacs 22.1:
 
+** Changes in Hi Lock:
+
++++
+*** hi-lock-mode now only affects a single buffer, and a new function
+`global-hi-lock-mode' enables Hi Lock in all buffers.  By default, if
+hi-lock-mode is used in what appears to be the initialization file, a
+warning message suggests to use global-hi-lock-mode instead.  However,
+if the new variable `hi-lock-archaic-interface-deduce' is non-nil,
+using hi-lock-mode in an initialization file will turn on Hi Lock in all
+buffers and no warning will be issued (for compatibility with the
+behavior in older versions of Emacs).
+
 ** Changes in Allout
 
 *** Topic cryptography added, enabling easy gpg topic encryption and
--- a/etc/orgcard.ps	Sat Dec 10 21:18:28 2005 +0000
+++ b/etc/orgcard.ps	Sun Dec 11 22:42:40 2005 +0000
@@ -10,7 +10,7 @@
 %DVIPSWebPage: (www.radicaleye.com)
 %DVIPSCommandLine: dvips -t landscape -o orgcard.ps orgcard.dvi
 %DVIPSParameters: dpi=600, compressed
-%DVIPSSource:  TeX output 2005.12.06:1143
+%DVIPSSource:  TeX output 2005.12.08:1407
 %%BeginProcSet: texc.pro
 %!
 /TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S
@@ -2338,7 +2338,7 @@
 %%Page: 1 1
 TeXDict begin @landscape 1 0 bop -169 -357 a Fj(Org-Mo)t(de)45
 b(Reference)h(Card)g(\(1/2\))546 -242 y Fi(\(for)23 b(v)n(ersion)h
-(3.22\))-150 -36 y Fh(Getting)37 b(Started)-150 96 y
+(3.23\))-150 -36 y Fh(Getting)37 b(Started)-150 96 y
 Fg(\(add-to-list)i('auto-mode-alist)h('\("\\\\.org$")e(.)e
 (org-mode\)\))-150 179 y(\(define-key)i(global-map)h("\\C-cl")e
 ('org-store-link\))1504 155 y Ff(2)-150 261 y Fg(\(define-key)h
@@ -2360,10 +2360,10 @@
 b(to)f(higher)g(lev)n(el)f(heading)424 b Fg(C-c)36 b(C-u)-150
 1700 y Fi(jump)23 b(to)i(another)f(place)h(in)e(do)r(cumen)n(t)350
 b Fg(C-c)36 b(C-j)-150 1905 y Fh(Structure)g(Editing)-150
-2060 y Fi(insert)23 b(new)i(heading)f(at)g(same)g(lev)n(el)g(as)g
-(curren)n(t)104 b Fg(M-RET)-150 2130 y Fi(insert)23 b(new)i(TODO)e(en)n
-(try)700 b Fg(M-S-RET)-150 2228 y Fi(promote)24 b(curren)n(t)h(heading)
-f(up)g(one)h(lev)n(el)285 b Fg(M-LEFT)-150 2298 y Fi(demote)25
+2060 y Fi(insert)23 b(new)i(heading/item)g(at)f(curren)n(t)g(lev)n(el)
+195 b Fg(M-RET)-150 2130 y Fi(insert)23 b(new)i(TODO)e(en)n(try)700
+b Fg(M-S-RET)-150 2228 y Fi(promote)24 b(curren)n(t)h(heading)f(up)g
+(one)h(lev)n(el)285 b Fg(M-LEFT)-150 2298 y Fi(demote)25
 b(curren)n(t)f(heading)h(do)n(wn)f(one)g(lev)n(el)233
 b Fg(M-RIGHT)-150 2368 y Fi(promote)24 b(curren)n(t)h(subtree)f(up)g
 (one)g(lev)n(el)301 b Fg(M-S-LEFT)-150 2437 y Fi(demote)25
@@ -2549,7 +2549,7 @@
 %%Page: 2 2
 TeXDict begin @landscape 2 1 bop -169 -357 a Fj(Org-Mo)t(de)45
 b(Reference)h(Card)g(\(2/2\))546 -242 y Fi(\(for)23 b(v)n(ersion)h
-(3.22\))-150 -36 y Fh(Timeline,)36 b(Agenda,)h(Global)g(TODO)h(List)
+(3.23\))-150 -36 y Fh(Timeline,)36 b(Agenda,)h(Global)g(TODO)h(List)
 -150 120 y Fi(sho)n(w)24 b(timeline)f(of)h(curren)n(t)g(org)f(\014le)
 458 b Fg(C-c)36 b(C-r)-150 190 y Fi(...)30 b(include)24
 b(past)h(dates)793 b Fg(C-u)36 b(C-c)g(C-r)-150 288 y
@@ -2741,7 +2741,7 @@
 Fg(org-CUA-compatibility)p Fi(.)4535 3770 y Fb(Cop)n(yrigh)n(t)4838
 3768 y(c)4821 3770 y Fa(\015)d Fb(2005)i(F)-5 b(ree)21
 b(Soft)n(w)n(are)i(F)-5 b(oundation,)20 b(Inc.)4795 3826
-y(v3.22)h(for)h(Org-Mo)r(de)e(3.22,)i(2005)4912 3882
+y(v3.23)h(for)h(Org-Mo)r(de)e(3.23,)i(2005)4912 3882
 y(Author:)k(Philip)18 b(Ro)r(ok)n(e)4473 3937 y(based)j(on)g(refcard)g
 (design)g(and)f(format)i(b)n(y)f(Stephen)f(Gildea)4242
 4022 y(P)n(ermission)28 b(is)f(gran)n(ted)i(to)f(mak)n(e)h(and)e
--- a/etc/orgcard.tex	Sat Dec 10 21:18:28 2005 +0000
+++ b/etc/orgcard.tex	Sun Dec 11 22:42:40 2005 +0000
@@ -1,4 +1,4 @@
-% Reference Card for Org Mode 3.22
+% Reference Card for Org Mode 3.23
 %
 %**start of header
 \newcount\columnsperpage
@@ -58,7 +58,7 @@
 % Thanks to Paul Rubin, Bob Chassell, Len Tower, and Richard Mlynarik
 % for their many good ideas.
 
-\def\orgversionnumber{3.22}
+\def\orgversionnumber{3.23}
 \def\year{2005}
 
 \def\shortcopyrightnotice{\vskip 1ex plus 2 fill
@@ -307,7 +307,7 @@
 
 \section{Structure Editing}
 
-\key{insert new heading at same level as current}{M-RET}
+\key{insert new heading/item at current level}{M-RET}
 \key{insert new TODO entry}{M-S-RET}
 
 \key{promote current heading up one level}{M-LEFT}
--- a/lisp/ChangeLog	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/ChangeLog	Sun Dec 11 22:42:40 2005 +0000
@@ -1,3 +1,1439 @@
+2005-12-11  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* term/mac-win.el: Create keymap for mac-apple-event-map.
+
+2005-12-11  Nick Roberts  <nickrob@snap.net.nz>
+
+	* tooltip.el (tooltip-mode): Move to start of file so that it
+	appears at top of customize buffer.
+
+	* progmodes/gud.el (gud-tooltip-modes, gud-tooltip-display):
+	Add the gud groupname.
+	(gud-tooltip-mode): Add the tooltip groupname.
+	(gud-tooltip-echo-area): Add the gud groupname. Remove tag to
+	avoid conflict with tooltip-use-echo-area.
+
+2005-12-10  Romain Francoise  <romain@orebokech.com>
+
+	* help.el (help-for-help-internal): Add `r' in doc string.
+
+2005-12-10  Johan Bockg,Ae(Brd  <bojohan@dd.chalmers.se>
+
+	* align.el (align-regexp, align-highlight-rule): Use
+	region-beginning and region-end instead of point and mark, so that
+	repetition (with `repeat-complex-command') recomputes the region
+	bounds.
+
+2005-12-10  Lennart Borgman  <lennart.borgman.073@student.lu.se>
+
+	* window.el (bw-get-tree, bw-get-tree-1, bw-find-tree-sub)
+	(bw-find-tree-sub-1, bw-l, bw-t, bw-r, bw-b, bw-dir, bw-eqdir)
+	(bw-refresh-edges, bw-adjust-window, bw-balance-sub): New functions.
+	(balance-windows): Rewrite using the above new functions.
+
+2005-12-10  David Koppelman  <koppel@ece.lsu.edu>
+
+	* hi-lock.el: (hi-lock-mode) Renamed from hi-lock-buffer-mode;
+	react if global-hi-lock-mode seems intended.
+	(global-hi-lock-mode) Renamed from hi-lock-mode.
+	(hi-lock-archaic-interface-message-used)
+	(hi-lock-archaic-interface-deduce): New variables.
+	(turn-on-hi-lock-if-enabled, hi-lock-line-face-buffer)
+	(hi-lock-face-buffer, hi-lock-face-phrase-buffer)
+	(hi-lock-find-patterns, hi-lock-font-lock-hook): Replace
+	hi-lock-buffer-mode with hi-lock-mode.
+
+2005-12-10  Kevin Rodgers  <ihs_4664@ihs.com>
+
+	* emacs-lisp/lisp.el (lisp-complete-symbol): Regenerate the
+	completion list, even after a partial completion has been
+	inserted in the current buffer.  If there are more than 1
+	completion, redisplay the *Completions* buffer; if the
+	completion is unique, delete the *Completions* window.
+
+2005-12-10  Eli Zaretskii  <eliz@gnu.org>
+
+	* mail/rmail.el (rmail-next-same-subject): Handle multiple "Re: "
+	strings and long subject lines that were broken into multiple
+	lines at arbitrary places.  Handle subjects that have "Re: " in
+	the middle.
+
+2005-12-10  John W. Eaton  <jwe@octave.org>
+
+	* emacs/octave-mod.el (octave-electric-space): Don't indent
+	comments or strings if octave-auto-indent is nil.
+
+2005-12-10  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* term/mac-win.el: Require url when compiling.  Call
+	mac-process-deferred-apple-events after loading init files.
+	(mac-apple-event-map): New defvar.  Define event handlers in it.
+	(core-event, internet-event): New Apple event class symbols.
+	(open-application, reopen-application, open-documents)
+	(print-documents, open-contents, quit-application)
+	(application-died, show-preferences, autosave-now, get-url): New
+	Apple event ID symbols.
+	(about): New HICommand ID symbol.
+	(mac-event-spec, mac-event-ae): New macros.
+	(mac-ae-parameter, mac-ae-list, mac-bytes-to-integer)
+	(mac-ae-selection-range, mac-ae-text-for-search)
+	(mac-ae-open-documents, mac-ae-text, mac-ae-get-url): New functions.
+	(mac-application-menu-map): Remove keymap.  Handlers for HICommand
+	and Services menu events are now defined in mac-apple-event-map.
+	(mac-drag-n-drop): Remove selection range handling.
+
+2005-12-10  Kenichi Handa  <handa@m17n.org>
+
+	* simple.el (zap-to-char): Translate CHAR by
+	translation-table-for-input.
+
+	* isearch.el (isearch-process-search-char): Translate CHAR by
+	translation-table-for-input.
+
+2005-12-09  Chong Yidong  <cyd@stupidchicken.com>
+
+	* foldout.el (foldout-exit-fold): Properly hide subtree.
+
+2005-12-09  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* files.el (save-buffer):
+	* international/ucs-tables.el (ucs-set-table-for-input):
+	* mail/mail-extr.el (mail-extract-address-components):
+	* mail/sendmail.el (mail-mode): Reformat doc string.
+
+2005-12-09  Juri Linkov  <juri@jurta.org>
+
+	* isearch.el (isearch-highlight): Change main overlay priority
+	from 1 to 1001.  Simplify.
+	(isearch-lazy-highlight-update): Change lazy overlay priority
+	from 0 to 1000.
+
+	* replace.el (replace-highlight): Change overlay priority from
+	1 to 1001.
+
+	* textmodes/ispell.el (ispell-highlight-spelling-error-overlay):
+	Change overlay priority from 1 to 1001.  Reuse existing overlay.
+
+	* compare-w.el (compare-windows-highlight): Change overlay
+	priority from 1 to 1000.
+
+	* menu-bar.el (menu-bar-edit-menu): Add listp around
+	pending-undo-list to disable menu item "undo" when pending
+	undo list is empty.
+
+	* locate.el (locate): Disable undo in *Locate* buffer.
+
+2005-12-09  Kim F. Storm  <storm@cua.dk>
+
+	* mail/smtpmail.el (smtpmail-via-smtp): Disable undo in SMTP buffer.
+
+2005-12-09  David Ponce  <david@dponce.com>
+
+	* recentf.el: Improvement of the menu code.
+	(recentf-enabled-p): Move before first use.  Use `kill-emacs-hook'
+	instead of menu hook.
+	(recentf-show-menu, recentf-hide-menu): New functions.
+	(recentf-menu-customization-changed, recentf-mode): Use them.
+	(recentf-menu-action, recentf-max-menu-items)
+	(recentf-menu-open-all-flag, recentf-menu-append-commands-flag)
+	(recentf-arrange-by-rule-others)
+	(recentf-arrange-by-rules-min-items)
+	(recentf-arrange-by-rule-subfilter) : Don't use
+	`recentf-menu-customization-changed'.
+	(recentf-arrange-rules): Likewise.  Accept functions to compute
+	sub-menu titles.
+	(recentf-menu-filter): Likewise.  Doc fix.
+	(recentf-menu-value-shortcut): Doc fix.
+	(recentf-dump-variable): Quote atom value.
+	(recentf-make-menu-items): Update to use it as a menu filter.
+	(recentf-match-rule): New function.
+	(recentf-arrange-by-rule): Use it.
+	(recentf-indirect-mode-rule): New function.
+	(recentf-build-mode-rules): Use it.
+	(recentf-dir-rule): New function.
+	(recentf-arrange-by-dir): Use it.
+	(recentf-filter-changer-current): Rename from
+	`recentf-filter-changer-state'.  All references updated.
+	(recentf-filter-changer-alist): Update filter names.
+	(recentf-filter-changer-select): New function.
+	(recentf-filter-changer): Use it.  Make a sub-menu from filters
+	available in `recentf-filter-changer-alist'.
+	(recentf-data-cache, recentf-clear-data)
+	(recentf-update-menu): Remove.  All references updated.
+	(recentf-match-rule-p, recentf-build-dir-rules)
+	(recentf-filter-changer-goto-next)
+	(recentf-filter-changer-get-current)
+	(recentf-filter-changer-get-next): Remove.
+
+2005-12-08  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* cus-edit.el (custom-buffer-create-internal): Relabel the whole
+	buffer "Reset" button to "Reset to Current" for consistency with
+	the State buttons.
+
+2005-12-08  John Paul Wallington  <jpw@pobox.com>
+
+	* ibuf-ext.el (define-ibuffer-filter filename):
+	If `dired-directory' is a list then really use its car.
+
+2005-12-08  Kim F. Storm  <storm@cua.dk>
+
+	* emulation/cua-rect.el (cua--rectangle-aux-replace): Fix
+	indention of text on right side of replaced rectangle.
+
+2005-12-09  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gud.el (gud-speedbar-buttons, gud-tooltip-tips):
+	No need to check gud-comint-buffer is bound.
+	(gdb): Prevent multiple debugging when first session uses gdba.
+
+2005-12-08  Alan Mackenzie  <bug-cc-mode@gnu.org>
+
+	CC Mode update to 5.31.
+
+	* progmodes/cc-subword.el: Add a dummy `c-subword-mode' for
+	Emacsen which lack `define-minor-mode'.  (Currently Emacs <21.  We
+	might do this function properly in the future).
+
+	* progmodes/cc-cmds.el, cc-defs.el, cc-styles.el, cc-vars.el: New
+	macros c-sentence-end and c-default-value-sentence end, to cope
+	with Emacs 22's new function `sentence-end'.
+
+2005-12-08  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-cmds.el (c-show-syntactic-information): Solved the
+	compat issue using `c-put-overlay' and `c-delete-overlay'.
+
+	* progmodes/cc-defs.el (c-put-overlay, c-delete-overlay): New
+	compat macros to handle overlays/extents.
+
+2005-12-08  Alan Mackenzie  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-fix.el: Add definitions of the macros push and pop
+	(for GNU Emacs 20.4)
+
+	* progmodes/cc-defs.el:
+	(i) Load cc-fix.elc for `push' and `pop' (for GNU Emacs 20.4)
+
+	* progmodes/cc-cmds.el (c-show-syntactic-information): change the
+	highlighting mechanism so it will work in XEmacs too.
+
+	* progmodes/cc-defs.el: Insert c-int-to-char.
+
+	* progmodes/cc-langs.el (c-nonsymbol-token-char-list): Insert a
+	call to the new macro c-int-to-char.  This solves XEmacs's
+	regarding characters as different from integers.
+
+2005-12-08  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-fonts.el (c-make-syntactic-matcher): New internal
+	helper.
+
+	(c-cpp-matchers, c-basic-matchers-before): Use the `eval'
+	construct to make the indirect face lookup work in XEmacs.
+
+	(c-cpp-matchers): Append the negation char face to the existing
+	fontification, so that the cpp face doesn't disappear.  Use
+	`c-make-syntactic-matcher' to avoid negation chars in comments and
+	strings.
+
+	* progmodes/cc-fonts.el (c-negation-char-face-name): New variable
+	to map to `font-lock-negation-char-face' in emacsen where it
+	exists.
+
+2005-12-08  Alan Mackenzie  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-mode.el: Bind c-subword-mode to C-c C-w.
+
+	* progmodes/cc-subword.el, cc-cmds.el, cc-mode.el: Rename
+	"c-subword-move-mode" as "c-subword-mode".
+
+	* progmodes/cc-mode.el: Added tty suitable bindings for C-c
+	<delete> and C-c C-<delete>.  (To the c-hungry- delete functions).
+
+2005-12-08  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-mode.el: Added autoload directive for
+	`c-subword-move-mode' for use in older emacsen.
+
+2005-12-08  Alan Mackenzie  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-mode.el:
+	(i) Insert a binding for C-c C-backspace into
+	c-bind-special-erase-keys which works in TTYs.
+	(ii) Make sure that when file styles are used, any explicitly
+	given style variables take priority over those in the style.  Do
+	this by calling `hack-local-variables' a second time.
+
+	* progmodes/cc-vars.el: Add language specific customization
+	widgets for AWK to c-doc-comment-style, c-require-final-newline
+	and c-default-style.  Add a defcustom for awk-mode-hook.  Give
+	c-syntactic-element and c-syntactic-context doc-strings by
+	directly setting their `variable-documentation' propery.  This
+	allows Emacs 22.1 to read these with C-h v.
+
+	* progmodes/cc-awk.el: Apply a tidy-up patch (from Stefan
+	Monnier).
+
+2005-12-08  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-fonts.el, cc-vars.el
+	(gtkdoc-font-lock-doc-comments, gtkdoc-font-lock-doc-protection,
+	gtkdoc-font-lock-keywords): GtkDoc patterns contributed by
+	Masatake YAMATO.
+
+	(c-doc-comment-style): Made GtkDoc default in C mode.
+
+	* progmodes/cc-mode.el: Fixed key bindings for C-c C-<backspace>
+	and C-c C-<delete>.
+
+	(c-bind-special-erase-keys): New function for use on
+	`normal-erase-is-backspace-hook' to bind C-c C-<delete> correctly.
+
+	* progmodes/cc-cmds.el (c-hungry-delete): New function to fix
+	<delete> key behavior in XEmacs according to `delete-forward-p'.
+	C.f. `c-electric-delete'.
+
+2005-12-08  Alan Mackenzie  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-mode.el: Give c-hungry-backspace and
+	c-hungry-delete-forward permanent key bindings.
+
+	* progmodes/cc-cmds.el (c-electric-semi&comma): Bind
+	c-syntactic-context for calls to "criteria functions", for
+	consistency with other calls to user functions.
+
+	* progmodes/cc-cmds.el (c-indent-command): expunge use of
+	`current-prefix-arg', since this might be the prefix arg to a
+	command which calls c-indent-command as a function.  Change the
+	interactive spec from "p" to "P".
+
+	* progmodes/cc-styles.el: Amend the doc-string of c-set-style, in
+	reponse to a report from Joseph Kiniry <kiniry@acm.org> that it
+	was difficult to understand.
+
+2005-12-08  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-engine.el (c-on-identifier): Fixed bug when at the
+	first char of an identifier.
+
+	* progmodes/cc-engine.el (c-on-identifier): Handle the "operator
+	+" syntax in C++.
+
+2005-12-08  Alan Mackenzie  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-cmds.el (c-mask-paragraph): correct, so that
+	auto-fill doesn't split a c-comment's last word from a hanging
+	"*/" when a space is typed between them after fill-column.
+
+	* progmodes/cc-defs.el: New macro c-delete-and-extract-region.
+
+	* progmodes/cc-styles.el (c-set-style,
+	c-setup-paragraph-variables): Abort the command if we're not in a
+	CC Mode buffer.
+
+	* progmodes/cc-align.el (c-lineup-C-comments): Correct indentation
+	with blank comment-prefix, and a blank line as the comment's
+	second line.
+
+2005-12-08  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-fonts.el (c-cpp-matchers, c-basic-matchers-before):
+	Incorporated the patterns added in the Emacs development branch
+	for the new Emacs 22 face `font-lock-negation-char-face'.
+
+	* progmodes/cc-fonts.el (c-invalid-face-name): Use "red1" instead
+	of "red" since it stands out better in xterms and DOS terminals.
+
+	* progmodes/cc-engine.el (c-literal-faces): Added
+	`font-lock-comment-delimiter-face' which is new in Emacs 22.
+
+2005-12-08  Alan Mackenzie  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-cmds.el: Make C-c C-a (`c-toggle-auto-newline')
+	forcibly enable c-electric-flag.
+
+	* progmodes/cc-vars.el, cc-cmds.el: New clean-up
+	`comment-close-slash' on c-electric-slash: if enabled, typing `/'
+	just after the comment-prefix of a C-style comment will close that
+	comment.
+
+2005-12-08  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-fonts.el (c-basic-matchers-before,
+	c-complex-decl-matchers): Fixed the "not-arrow-prefix" regexp used
+	in Pike.
+
+	* progmodes/cc-langs.el (c-other-op-syntax-tokens): Only C++ has
+	digraphs.
+
+	* progmodes/cc-fonts.el, cc-langs.el, cc-engine.el
+	(c-cpp-message-directives, c-cpp-include-directives,
+	c-opt-cpp-macro-define, c-opt-cpp-macro-define-start,
+	c-cpp-expr-directives): Introduced new language constants to
+	control cpp syntax in a cleaner way.
+
+	(c-cpp-expr-functions): Renamed from c-cpp-defined-fns.
+
+	(c-cpp-matchers, c-forward-to-cpp-define-body): Use them.
+
+	* progmodes/cc-langs.el, cc-fonts.el (c-string-escaped-newlines,
+	c-multiline-string-start-char): New language constants and
+	variables to specify how newlines in string literals work.
+
+	(c-font-lock-invalid-string): Use them.
+
+	* progmodes/cc-cmds.el (c-try-one-liner): Robustness fix if an
+	unbalanced close brace is entered.  Optimization by avoiding going
+	back over arbitrarily large blocks.  Removed hints that this
+	function only would be relevant/useful in AWK.
+
+	(c-electric-brace): Indent syntactically after the cleanups since
+	lineup functions might do it differently then.
+
+	* progmodes/cc-engine.el, cc-langs.el
+	(c-opt-op-identifier-prefix): New language constant and variable.
+
+	(c-just-after-func-arglist-p, c-after-special-operator-id,
+	c-search-decl-header-end, c-inside-bracelist-p): Use it.
+
+	* progmodes/cc-align.el, cc-engine.el
+	(c-after-special-operator-id): New helper to handle C++ operator
+	identifiers.
+
+	(c-lineup-topmost-intro-cont, c-just-after-func-arglist-p,
+	c-guess-basic-syntax): Handle C++ operator identifiers in
+	declarations.
+
+	* progmodes/cc-langs.el (c-assignment-operators): Added the
+	trigraph version of ^= too.
+
+	* progmodes/cc-langs.el (c-assignment-operators): Added the
+	trigraph version of |= in C++.
+
+	* progmodes/cc-fonts.el (c-font-lock-declarators): Handle
+	`c-decl-hangon-kwds' after the identifier name.
+
+	* progmodes/cc-engine.el (c-guess-basic-syntax): When deciding
+	whether an arglist is "nonempty", ignore a comment after the open
+	paren if it isn't followed by a non-comment token on the same
+	line.
+
+	* progmodes/cc-engine.el (c-guess-basic-syntax): Case 4: Enable
+	heuristics below the point to cope with classes inside special
+	brace lists in Pike.
+
+2005-12-08  Alan Mackenzie  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-cmds.el: Amend c-point-syntax to handle macros.
+
+2005-12-08  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-guess.el (cc-guess-install): New function to
+	install an already guessed style in another buffer.
+
+	* progmodes/cc-defs.el (c-tentative-buffer-changes): No longer
+	sets `inhibit-read-only' - `c-save-buffer-state' should be used
+	anyway if the change always is undone.
+
+2005-12-08  Alan Mackenzie  <bug-cc-mode@gnu.org>
+
+	Implement togglable electricity:
+
+	* progmodes/cc-defs.el: Enhance c-save-buffer-state's doc-string,
+	saying when it should be used.
+
+	* progmodes/cc-engine.el: Add the new buffer-local variable,
+	c-electric-flag.
+
+	* progmodes/cc-langs.el: Change the name of c-toggle-auto-state to
+	c-toggle-auto-newline.
+
+	* progmodes/cc-mode.el: Rename c-toggle-auto-state to
+	c-toggle-auto-newline.  Remove the binding for
+	c-toggle-auto-hungry-state.  Add the binding C-c C-l for the new
+	c-toggle-electric-state.
+
+	* progmodes/cc-vars.el: Make c-syntactic-indentation buffer local.
+
+	* progmodes/cc-cmds.el: Add `c-bytecomp-defun's for
+	c-\(forward\|backward\)-subword.
+	(c-update-modeline): Add the new modeline flag `l' for
+	`c-electric-flag'.  Make the auto-newline flag `a' dependent on
+	`l'.
+	(c-toggle-auto-state): Rename it to `c-toggle-auto-newline'.  Make
+	the old name an alias of the new name.
+	(c-toggle-electric-state): New function.
+	c-electric-\(pound\|brace\|slash\|star\|semi&comma\|colon\|lt-gt\|paren\|continued-statement\):
+	Adapt these functions to do electric things only when
+	c-electric-flag is non-nil.
+	(c-point-syntax, c-brace-newlines, c-try-oneliner): Extract these
+	new functions from c-electric-brace.
+	(c-point-syntax): Add a check for "virtual semicolons" in AWK
+	mode, so that the tentative extra newline doesn't change the
+	syntax of the following brace.
+	(c-electric-brace): restructure by extracting the above functions.
+	Tidy up the coding somewhat.
+	(c-electric-semi&comma, c-electric-colon, c-electric-paren):
+	restructure a bit.
+
+2005-12-08  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-cmds.el (c-show-syntactic-information): Show the
+	anchor position(s) using faces.  Thanks to Masatake YAMATO for the
+	idea.
+
+	* progmodes/cc-mode.el, cc-cmds.el, cc-defs.el, cc-engine.el
+	(c-submode-indicators): Changed name from `c-auto-hungry-string'
+	since it's now used to track another submode.
+
+	(c-update-modeline): Converted to function and extended to check
+	`c-subword-move-mode'.
+
+	(c-forward-into-nomenclature, c-backward-into-nomenclature):
+	Converted to compat aliases for `c-forward-subword' and
+	`c-backward-subword'.
+
+	* progmodes/cc-subword.el: New functions and minor mode to handle
+	SillyCapsedStyleIndentifiers, contributed by Masatake YAMATO:
+
+	(c-forward-subword, c-backward-subword, c-mark-subword,
+	c-kill-subword, c-backward-kill-subword, c-transpose-subwords,
+	c-capitalize-subword, c-downcase-subword, c-upcase-subword):
+	Functions corresponding to the standard word handling functions.
+
+	(c-subword-move-mode): Minor mode that replaces all the standard
+	word handling functions with their subword equivalences.
+
+2005-12-08  Alan Mackenzie  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-vars.el (c-cleanup-list): Insert a customization
+	entry for one-liner-defun.
+
+	* progmodes/cc-defs.el: Give c-tentative-buffer-changes its own
+	name in its def-edebug-spec.
+
+	* progmodes/cc-cmds.el (c-electric-brace): Make the
+	one-liner-defun clean-up work with empty-defun-braces.  o-l-d now
+	compacts space before a comment, if this will make things fit on
+	one line.
+
+	Introduce an "awk" style, mainly for auto-newline and clean-ups.
+
+	* progmodes/cc-align.el: new function c-snug-1line-defun-close
+
+	* progmodes/cc-cmds.el: In c-electric-brace, add code for new
+	clean-up one-liner-defun.
+
+	* progmodes/cc-styles.el: Add the new "awk" style.
+
+	* progmodes/cc-vars.el: Add description of one-liner-defun to
+	c-cleanup-list's doc-string.  New user options,
+	c-max-one-liner-length.  In c-default-style, set the default style
+	for AWK to "awk".
+
+2005-12-08  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-engine.el (c-forward-label): Fixed fontification of
+	macros inside labels.
+
+	* progmodes/cc-engine.el (c-looking-at-bos): Obsoleted in favor of
+	`c-at-statement-start-p' and `c-at-expression-start-p'.
+
+	* progmodes/cc-defs.el (c-tnt-chng-record-state): Don't signal an
+	error if the mark isn't set.
+
+	* progmodes/cc-engine.el (c-guess-continued-construct,
+	c-guess-basic-syntax): Use `c-forward-decl-or-cast-1' to more
+	accurately detect functions inside functions.
+
+	* progmodes/cc-engine.el (c-at-expression-start-p): New function
+	like `c-at-statement-start-p' that additionally recognizes commas
+	and expression parentheses as delimiters.
+
+	* progmodes/cc-engine.el (c-looking-at-inexpr-block): Added flag
+	to avoid heuristics that doesn't work for unclosed blocks.
+
+	(c-at-statement-start-p): New function.
+
+	* progmodes/cc-engine.el, cc-fonts.el: Fixes in handling of
+	Objective-C directives, e.g. directives spanning lines should work
+	reasonably well now.
+
+	(c-put-c-type-property, c-clear-c-type-property): New helpers.
+
+	(c-forward-objc-directive): New function to move over any ObjC
+	directive.
+
+	(c-just-after-func-arglist-p, c-guess-basic-syntax,
+	c-basic-matchers-before): Use it.
+
+	(c-font-lock-objc-iip-decl): Removed.
+
+	* progmodes/cc-engine.el (c-guess-basic-syntax): Some improvement
+	in the template arglist recognition.
+
+	* progmodes/cc-styles.el (c-style-alist): Fixed several
+	inconsistencies in the Whitesmith style.
+
+	* progmodes/cc-align.el (c-lineup-after-whitesmith-blocks): New
+	lineup function to get lines after Whitesmith style blocks
+	correctly indented.
+
+	(c-lineup-whitesmith-in-block): Backed out the compensation for
+	opening parens since it's done using `add' lists in the style
+	definition instead.  Don't use the anchor position since it varies
+	too much between the syntactic symbols. :P
+
+	* progmodes/cc-vars.el (c-valid-offset): Updated.
+
+	* progmodes/cc-engine.el (c-evaluate-offset): Extended to handle
+	lists where the offsets are combined according to several
+	different methods: `first', `min', `max', and `add'.  Report
+	offset evaluation errors with `c-benign-error' so that some kind
+	of reindentation still is done.
+
+	* progmodes/cc-engine.el (c-guess-basic-syntax): Anchor
+	`arglist-intro' the same way as `arglist-cont-nonempty' and
+	`arglist-close'.
+
+	* progmodes/cc-engine.el (c-guess-basic-syntax): Fixed similar
+	situations for `arglist-cont-nonempty' and `arglist-close'.
+
+	* progmodes/cc-langs.el (c-opt-identifier-concat-key-depth): New
+	constant.
+
+	* progmodes/cc-defs.el: Use `cc-bytecomp-fboundp' and
+	cc-bytecomp-boundp' in a number of places.
+
+	* progmodes/cc-engine.el (c-beginning-of-statement-1): Fixed a
+	macro related issue.
+
+2005-12-08  Alan Mackenzie  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-awk.el: Change the terminology of regexps: A char
+	list is now
+	[asdf], a char class [:alpha:].  Include code for char classes.
+	Set c-awk-NL-prop on lines ending in open strings.  (Bug fix.)
+	Add character classes (e.g. "[:alpha:]") into AWK Mode's regexps.
+
+	Remove (nearly all of) the cruft associated with AWK Mode's former
+	concept of "virtual semicolons":
+
+	Adapt c-beginning-of-statement, c-end-of-statement (together with
+	subfunctions) to use the new notion of "virtual semicolon" in
+	place of the old awkward special handling for AWK.  There remains
+	much cruft in cc-awk.el, cc-cmds.el and cc-engine.el to clear out.
+	* progmodes/cc-cmds.el:
+	(c-ascertain-adjacent-literal): In the backwards direction, now
+	recognises AWK regexp delimiters as string delimiters.
+	(c-after-statement-terminator-p): Adapt for virtual semicolons;
+	check more rigorously for "end of macro".
+	(c-back-over-illiterals, c-forward-over-illiterals): Adapt for
+	virtual semicolons;
+	(c-beginning-of-statement): Adapt for virtual semicolons; Separate
+	out the code for forward movement into ...
+	(c-end-of-statement): Now contains the code for forward movement,
+	adapted for virtual semicolons.
+
+	* progmodes/cc-engine.el:
+	(c-ws*-string-limit-regexp): new regexp.
+	(c-forward-single-comment, c-backward-single-comment): Comment out
+	the (now redundant) "special" AWK stuff.
+
+	* progmodes/cc-styles.el, cc-vars.el: Change the settings of
+	c-string-par-start, c-string-par-separate to be more like Text
+	Mode than Fundamental Mode.
+
+2005-12-08  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-fonts.el (c-font-lock-declarations): Always narrow
+	to the fontified region so that fontification doesn't occur
+	outside it
+	(could happen e.g. when fontifying a line with an unfinished
+	declaration).
+
+2005-12-08  Alan Mackenzie  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-awk.el: Regexps for analysing AWK code have been
+	moved to near the start of the file.  ^L now separate sections of
+	the file.  New defconsts: c-awk-non-eol-esc-pair-re,
+	c-awk-blank-or-comment-line-re,
+	c-awk-one-line-possibly-open-string-re,
+	c-awk-regexp-one-line-possibly-open-char-class-re,
+	c-awk-one-line-possibly-open-regexp-re,
+	c-awk-one-line-non-syn-ws*-re.  New functions: c-awk-at-vsemi-p,
+	c-awk-vsemi-status-unknown-p.
+
+	Amend the concept of "virtual semicolons" (in the indentation
+	engine) for languages like AWK, such that they are now
+	conceptually attached to end of the last token of a statement, not
+	the end of the line.  (In AWK Mode, however, the pertinent text
+	property is still physically set on the EOL.)  Remove the specific
+	tests for awk-mode, thus facilitating the introduction of other
+	language modes where EOLs can end statements.  (Note: The
+	funtionality in cc-cmds.el, specifically
+	c-beginning/end-of-statement has yet to be amended.)
+
+	* progmodes/cc-defs.el: New macros c-at-vsemi-p,
+	c-vsemi-status-unknown-p.
+
+	* progmodes/cc-langs.el: Added `#' into AWK Mode's value of
+	c-stmt-delim-chars.  New c-lang-defvars: c-at-vsemi-p-fn,
+	c-vsemi-status-unknown-p-fn (in a new page).
+
+	* progmodes/cc-engine.el: In c-beginning-of-statement-1,
+	c-crosses-statement-barrier-p, c-guess-basic-syntax, replace
+	numerous awkward forms like
+	(if (c-major-mode-is 'awk-mode) (c-awk-prev-line-incomplete-p))
+	with
+	(c-at-vsemi-p).  Fix a few typos.  In c-guess-basic-syntax, new
+	variable before-ws-ip, the place just after char-before-ip
+	appears.
+
+	* progmodes/cc-mode.el: Fix what's almost a semantic ambiguity in
+	a comment.
+
+2005-12-08  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-cmds.el (c-electric-brace): Cleaned up using
+	`c-tentative-buffer-changes'.
+
+	* progmodes/cc-defs.el (c-region-is-active-p): Simplified and
+	converted to macro to choose between Emacs and XEmacs at compile
+	time.
+
+	(c-set-region-active): New set counterpart to
+	`c-region-is-active-p'.
+
+	(c-tentative-buffer-changes): New macro to handle temporary buffer
+	changes in a convenient way.
+
+	(c-tnt-chng-record-state, c-tnt-chng-cleanup): Internal helpers
+	for `c-tentative-buffer-changes'.
+
+	* progmodes/cc-engine.el (c-looking-at-inexpr-block): Tightened up
+	the checks for paren sexps between the point and the keyword, to
+	avoid some false alarms.
+
+	* progmodes/cc-engine.el, cc-langs.el (c-looking-at-inexpr-block):
+	Fixed a situation where an error could be thrown for unbalanced
+	parens.  Changed to make use of c-keyword-member' to avoid some
+	repeated regexp matches.
+
+	(c-opt-lambda-key, c-opt-inexpr-block-key,
+	c-opt-inexpr-class-key): These language variable are no longer
+	necessary.
+
+	(c-block-stmt-kwds): New language constant used by
+	c-looking-at-inexpr-block'.
+
+	(c-guess-basic-syntax): Removed an optional check that looked at
+	the existence of the now removed language variables.
+
+	* progmodes/cc-engine.el (c-fdoc-shift-type-backward,
+	c-forward-decl-or-cast-1): Fixed invalid recognition of C++ style
+	object instantiation expressions as declarations in some contexts.
+	This bug only affected languages where the declarator can't be
+	enclosed in parentheses.
+
+	* progmodes/cc-styles.el (c-style-alist): Fixed the GNU style to
+	insert newlines before and after substatement braces.
+
+	* progmodes/cc-engine.el: Improved the heuristics for recognizing
+	function declaration headers and the handling of C++ style member
+	init lists.
+
+	(c-just-after-func-arglist-p): Rewritten to use
+	`c-forward-decl-or-cast-1'.  Now behaves a bit differently too.
+
+	(c-beginning-of-member-init-list): Removed since it isn't used
+	anymore.
+
+	(c-guess-basic-syntax): Case 5B adapted for the new
+	`c-just-after-func-arglist-p'.  Cases 5B.1 and 5B.3 merged.  Cases
+	5D.1 and 5D.2 removed since they aren't trigged anymore (case 5B.1
+	covers all cases now).
+
+	* progmodes/cc-defs.el (c-point): Added 'bosws and 'eosws.
+
+2005-12-08  Alan Mackenzie  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-cmds.el, cc-styles.el, cc-vars.el: New variables
+	c-string-par-start/separate c-sentence-end-with-esc-eol,
+	initialised in c-setup-paragraph-variables, used in string
+	scanning subroutines of c-beginning-of-statement.
+
+	* progmodes/cc-cmds.el (c-electric-brace): don't delete a comment
+	which precedes the newly inserted `{'.
+
+2005-12-08  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-engine.el, cc-langs.el: Rewrote the recognition
+	function for declaration level blocks.  It should now cope with
+	templates better and also be a lot more comprehensible.
+
+	(c-looking-at-decl-block): The new function.
+
+	(c-search-uplist-for-classkey): The old one.  It's now a wrapper
+	for compatibility.
+
+	(c-add-class-syntax, c-guess-continued-construct,
+	c-guess-basic-syntax): Adapted for `c-looking-at-decl-block'.
+
+	(c-decl-block-key): Changed to tell apart ambiguous and
+	unambiguous keywords.  Pike specials are now handled directly in
+	the code instead.
+
+	(c-block-prefix-disallowed-chars, c-block-prefix-charset): New
+	language constants and variables to make the backward skip in
+	`c-looking-at-decl-block' as tight as possible.
+
+	(c-nonsymbol-token-char-list): New language constant.
+
+	* progmodes/cc-engine.el (c-backward-<>-arglist): New function to
+	find balanced template arglists backwards.
+
+	* progmodes/cc-defs.el (c-make-bare-char-alt): New helper for
+	making char classes for `c-syntactic-skip-backward'.
+
+	* progmodes/cc-engine.el (c-guess-basic-syntax): Simplified case
+	16D - can't be a class-close at that point.
+
+	* progmodes/cc-engine.el (c-guess-basic-syntax,
+	c-add-class-syntax): Don't narrow out the enclosing declaration
+	level.  This makes everything a lot easier, and it was actually
+	only four small places that needed it to work.  Some places that
+	previously did `widen' are removed now, which has the effect that
+	`c-guess-basic-syntax' never will look at things outside the
+	current narrowment now.  The anchor position for `topmost-intro'
+	is affected by this, but it was so bogus it was basically useless
+	before, and now it's equally bogus but in a slightly different
+	way.
+
+	(c-narrow-out-enclosing-class): Gone.
+
+	(c-most-enclosing-brace, c-least-enclosing-brace): Don't filter to
+	the narrowed region.
+
+	(c-least-enclosing-brace): Removed silly optional argument.
+
+	* progmodes/cc-engine.el (c-beginning-of-decl-1): Fixed bug where
+	the point could be left directly after an open paren when finding
+	the beginning of the first decl in the block.
+
+	* progmodes/cc-engine.el, cc-fonts.el (c-forward-keyword-clause):
+	Specify which submatch to use.
+
+	* progmodes/cc-langs.el (c-symbol-start): Include '@' in ObjC.
+
+	(c-decl-start-re): No no longer any need for special treatment of
+	ObjC due to the above.
+
+	(c-other-block-decl-kwds): Handle "extern" in ObjC too since it
+	presumably follows C in that regard.
+
+	* progmodes/cc-langs.el (c-identifier-ops, c-after-id-concat-ops):
+	New language constants to specify operator tokens inside
+	identifiers in a more high level way.
+
+	(c-opt-identifier-prefix-key): New internal language constant.
+
+	(c-opt-identifier-concat-key, c-opt-after-id-concat-key,
+	c-identifier-start, c-identifier-key): Now completely calculated
+	from other constants.
+
+	(c-identifier-last-sym-match): Decommissioned since it's no longer
+	used.
+
+	(c-operators): Use `c-identifier-ops'.  Documented
+	`postfix-if-paren'.
+
+	* progmodes/cc-engine.el (c-forward-name): Removed the
+	optimization when c-identifier-key is equal to c-symbol-key since
+	it doesn't work in byte compiled files.  Don't record empty
+	regions as identifiers.
+
+	* progmodes/cc-langs.el (c-filter-ops): New helper function to
+	simplify access to `c-operators' and its likes.
+
+	(c-operator-list, c-all-op-syntax-tokens,
+	c-nonsymbol-token-regexp, c-<>-multichar-token-regexp,
+	c-<-op-cont-regexp, c->-op-cont-regexp, c-expr-kwds,
+	c-primary-expr-regexp, c-cast-parens): Use it.
+
+	* progmodes/cc-defs.el (c-lang-const): Fixes to allow use without
+	an explicit language in functions.
+
+	* progmodes/cc-defs.el (c-make-keywords-re): Added an appendable
+	variant of adornment.
+
+	* progmodes/cc-langs.el (c-any-class-key): Removed unused language
+	variable.
+
+	(c-type-decl-prefix-key): Removed some now unnecessary cruft from
+	the Pike value.
+
+	* progmodes/cc-engine.el (c-on-identifier,
+	c-simple-skip-symbol-backward): Small fix for handling "-"
+	correctly in `skip-chars-backward'.  Affected the operator lfun
+	syntax in Pike.
+
+	* progmodes/cc-langs.el (c-make-init-lang-vars-fun): Disabled the
+	diagnostic message about precompiled language vars not being used.
+
+	* progmodes/cc-langs.el (c-paren-nontype-kwds): The GCC keyword
+	"__attribute__" is followed by a parenthesis.
+
+	(c-type-start-kwds, c-prefix-spec-kwds, c-prefix-spec-kwds-re,
+	c-specifier-key, c-not-decl-init-keywords): Some cleanup using new
+	language constants `c-type-start-kwds' and `c-prefix-spec-kwds'.
+
+	* progmodes/cc-fonts.el, cc-langs.el, cc-engine.el: Internal
+	cleanups to properly detect the declared identifiers in various
+	declarations.
+
+	(c-decl-start-kwds): New language constant to recognize
+	declarations that can start anywhere.  Used for class declarations
+	in Pike.
+
+	(c-specifier-key, c-not-decl-init-keywords,
+	c-decl-prefix-or-start-re, c-find-decl-prefix-search,
+	c-find-decl-spots): Implement `c-decl-start-kwds'.
+
+	(c-other-decl-kwds, c-postfix-decl-spec-kwds, c-decl-hangon-kwds,
+	c-decl-hangon-key, c-forward-decl-or-cast-1): Separated the
+	handling of the compiler specific extension keywords into a new
+	language constant `c-decl-hangon-kwds' that defines keyword
+	clauses to be ignored in declarations.
+
+	(c-forward-id-comma-list, c-forward-keyword-clause): Don't skip
+	past unrecognized tokens when handling `c-colon-type-list-kwds'.
+	Necessary to stop at the declared identifier in e.g. IDL valuetype
+	declarations.
+
+	(c-typedef-decl-kwds, c-typeless-decl-kwds, c-type-list-kwds,
+	c-prefix-spec-kwds-re, c-postfix-spec-kwds,
+	c-after-suffixed-type-decl-key, c-opt-postfix-decl-spec-key,
+	c-forward-decl-or-cast-1): Recognize the declared identifier in
+	class and enum declarations as such and not as part of the type.
+
+	(c-forward-decl-or-cast-1, c-forward-label): Relaxed the
+	interpretation of PRECEDING-TOKEN-END when there's no preceding
+	token.
+
+	(c-forward-decl-or-cast-1): Don't disregard sure signs of
+	declarations when there's some syntax error later on.
+
+	(c-complex-decl-matchers): Did away with a reference to
+	`c-specifier-key'.
+
+	* progmodes/cc-engine.el (c-maybe-labelp): Provide no default
+	value - this variable is always dynamically bound.
+
+	* progmodes/cc-engine.el, cc-fonts.el, cc-langs.el, cc-menus.el,
+	cc-mode.el, cc-styles.el, cc-vars.el, cc-align.el, cc-awk.el,
+	cc-cmds.el, cc-defs.el: Changed the policy for marking up
+	functions that might do hidden buffer changes: All such internal
+	functions are now marked instead of those that don't.
+
+	(c-beginning-of-macro, c-end-of-macro, c-(forward|backward)-comments,
+	c-(forward|backward)-single-comment, c-parse-state, c-on-identifier,
+	c-(fast-|slow-|)in-literal, c-literal-limits, c-collect-line-comments,
+	c-literal-type): Allow these functions to make hidden buffer changes,
+	so that they are free to use text property caching later on.
+
+	(c-electric-backspace, c-electric-delete-forward, c-electric-pound,
+	c-electric-brace, c-electric-slash, c-electric-star,
+	c-electric-semi&comma, c-electric-colon, c-electric-lt-gt,
+	c-electric-paren, c-electric-continued-statement, c-indent-command,
+	c-indent-region, c-mask-paragraph, c-indent-new-comment-line,
+	c-context-line-break): Added `c-save-buffer-state' calls to comply
+	with the changed semantics of the functions above.
+
+	* progmodes/cc-engine.el (c-beginning-of-statement-1): Fixed a bug
+	when macros occur in obscure places.  Optimized the sexp movement
+	a bit.
+
+2005-12-08  Alan Mackenzie  <bug-cc-mode@gnu.org>
+
+	Enhancements for c-beginning-of-statement to work in AWK Mode:
+
+	* progmodes/cc-awk.el: Supersede c-awk-NL-prop value `;'
+	(completed statement) with `}' (statement completed by closing
+	brace or semicolon) and `$' (statement completed by EOL).
+
+	(c-awk-virtual-semicolon-ends-prev-line-p,
+	c-awk-virtual-semicolon-ends-line-p,
+	c-awk-skip-semantic-ws-forward, c-awk-skip-semantic-ws-backward,
+	c-awk-at-statement-end-p): new functions
+
+	* progmodes/cc-cmds.el: Simplify the structure of functions
+	c-forward-over-illiterals, c-back-over-illiterals.  Enhance these
+	two functions and c-beginning-of-statement to handle AWK Mode.
+
+	* progmodes/cc-engine.el: Enhance c-forward-single-comment,
+	c-backward-single-comment for AWK mode.  Attempt to clarify their
+	doc-strings.
+
+	* progmodes/cc-mode.el: Put M-a and M-e into awk-mode-map.
+
+2005-12-08  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-engine.el, cc-fonts.el, cc-langs.el: Cleaned up the
+	label handling.  Labels are now recognized in a uniform and more
+	robust way, regardless of context.  Text properties are put on all
+	labels to recognize the following declarations better.  Multiword
+	labels are handled both in indentation and fontification for the
+	benefit of language extensions like Qt.  For consistency, keywords
+	in labels are now fontified with the label face instead.  That
+	also applies to "case" and "default".
+
+	(c-beginning-of-statement-1): Fixed some bugs in the label
+	handling.  Disregard `c-nonlabel-token-key' in labels that begin
+	with `c-label-kwds'.
+
+	(c-find-decl-spots): Support that the callback adds more
+	`c-decl-end' spots to find.
+
+	(c-forward-decl-or-cast-1): Don't treat a list of plain
+	identifiers followed by a colon as a declaration.
+
+	(c-forward-label): New function to recognize labels.
+
+	(c-guess-basic-syntax): Replaced uses of `c-label-key' with
+	`c-forward-label'.  Moved the label recognition cases (14 and 15)
+	earlier since they aren't so context sensitive now.  Handle labels
+	on the top level gracefully.  Moved access label recognition to
+	the generic label case (CASE 15) - removed CASE 5E.
+
+	(c-font-lock-declarations): Added recognition of labels in the
+	same round since we need to handle labels in parallell with other
+	declarations to recognize both accurately.  It should also improve
+	speed.
+
+	(c-simple-decl-matchers, c-basic-matchers-after): Moved
+	`c-font-lock-labels' so that it only is used on decoration level 2
+	since `c-font-lock-declarations' handles it otherwise.
+
+	(c-complex-decl-matchers): Removed the simplistic recognition of
+	access labels.
+
+	(c-decl-prefix-re): Removed the kludges that was necessary to cope
+	with labels earlier.
+
+	(c-decl-start-re): New language variable to make
+	`c-font-lock-declarations' stop for the special protection labels
+	in Objective-C that start with '@'.
+
+	(c-label-key): Removed since it's no longer used.
+
+	(c-recognize-colon-labels, c-label-prefix-re): New language
+	constants to support recognition of generic colon-terminated
+	labels.
+
+	(c-type-decl-end-used): `c-decl-end' is now used whenever there
+	are colon terminated labels.
+
+	* progmodes/cc-align.el (c-lineup-arglist): Fixed bug when the
+	first argument starts with a special brace list.
+
+	* progmodes/cc-engine.el, cc-fonts.el (c-forward-decl-or-cast-1,
+	c-font-lock-declarations): Broke out the declaration and cast
+	recognition from `c-font-lock-declarations' to a new function, so
+	that it can be used in the indentation engine.
+
+	* progmodes/cc-engine.el (c-find-decl-spots): Fixed bug in backing
+	up to the start of the literal.  Fixed bug with the point on the
+	wrong side of the search limit that could happen when the start
+	position is inside a literal.
+
+	* progmodes/cc-engine.el (c-parse-state,
+	c-invalidate-state-cache): Modified the use of `c-state-cache-end'
+	so that it's kept a little bit back to increase the hit rate.
+
+	(c-parse-state): Changed the macro handling and fixed some
+	glitches.  Macro context is checked more often than necessary now,
+	but otoh less garbage conses are generated.
+
+	* progmodes/cc-engine.el (c-parse-state,
+	c-invalidate-state-cache): Cache the last position where
+	`c-state-cache' applies.  This can speed up refontification quite
+	a bit in blocks where there are many non-brace parens before the
+	point.
+
+	(c-state-cache-end): New variable for this.
+
+	(c-guess-basic-syntax, c-debug-parse-state): Adapted for the new
+	cache variable.
+
+	* progmodes/cc-engine.el (c-find-decl-spots): Take more care to
+	get close initial continue positions when the start position is
+	inside a literal or macro.  Do not call the callback for spots
+	before the start position (which can happen e.g. for `c-decl-end'
+	spots inside comments).  Optimize better in special cases when the
+	region is a single line inside a literal or macro (typically when
+	the current line is refontified).
+
+	* progmodes/cc-engine.el (c-guess-basic-syntax): Simplified calls
+	to `c-add-stmt-syntax' - there's no need to explicitly whack off
+	entries from the paren state.
+
+	* progmodes/cc-engine.el (c-add-stmt-syntax): Narrowed down the
+	special case for "else if" clauses.
+
+	* progmodes/cc-engine.el (c-looking-at-inexpr-block,
+	c-add-stmt-syntax): Use `c-recognize-paren-inexpr-blocks'.
+
+	* progmodes/cc-langs.el (c-recognize-paren-inexpr-blocks): New
+	language variable to recognize the gcc extension with statement
+	blocks inside expressions.
+
+	* progmodes/cc-engine.el (c-add-stmt-syntax): Restructured to make
+	it somewhat more comprehensible.  The argument AT-BLOCK-START is
+	no longer used and hence removed.
+
+	(c-guess-continued-construct, c-guess-basic-syntax): Updated calls
+	to `c-add-stmt-syntax'.
+
+	* progmodes/cc-engine.el (c-backward-to-decl-anchor): Use
+	`c-beginning-of-statement-1' instead of duplicating parts of it.
+	This fixes bogus label recognition.
+
+	* progmodes/cc-engine.el (c-add-type, c-check-type,
+	c-forward-name, c-forward-type): Improved storage of template
+	types in `c-found-types' so that they can be recognized better.
+
+	(c-syntactic-content): Added option to skip past nested parens.
+
+	* progmodes/cc-engine.el (c-forward-name): Set
+	`c-last-identifier-range' all the time.  It's less work that way.
+	Handle that there might not be an identifier to store in
+	`c-last-identifier-range'.
+
+	(c-forward-type): Handle that `c-last-identifier-range' might be
+	nil from `c-forward-name'.
+
+	* progmodes/cc-defs.el: (c-safe-scan-lists,
+	c-(go-)?(up|down)-list-(forward|backward)): Added limit arguments.
+
+	* progmodes/cc-defs.el (c-save-buffer-state): Use `unwind-protect'
+	to work even if the form fails.
+
+	* progmodes/cc-engine.el (c-parse-state): Speedup when moving far
+	down in a large file in one go.
+
+	(c-get-fallback-start-pos): New helper function for
+	`c-parse-state'.
+
+	* progmodes/cc-align.el (c-lineup-assignments): New lineup
+	function which is like `c-lineup-math' but returns nil instead of
+	`c-basic-offset' when it doesn't match.
+
+	(c-lineup-math): Changed to use `c-lineup-assignments'.
+
+2005-12-08  Alan Mackenzie  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-cmds.el: Fix some bugs in subfunctions of
+	c-beginning-of-statement.  New subfunctions
+	c-in-comment-line-prefix-p, c-narrow-to-comment-innards.
+
+2005-12-08  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-fonts.el, cc-langs.el: Use `c-simple-ws' instead of
+	hardcoded char classes whereever possible.  Changed a couple of
+	places to use skip by syntax instead of skip by char class.
+
+	* progmodes/cc-langs.el (c-unterminated-block-comment-regexp):
+	Fixed a bug in the regexp that caused extreme backtracking.
+
+	* progmodes/cc-langs.el (c-block-comment-starter,
+	c-block-comment-ender): New language constants to specify in a
+	single place how block comments look.
+
+	(c-comment-start-regexp, c-block-comment-start-regexp,
+	comment-start, comment-end, comment-start-skip,
+	c-syntactic-ws-start, c-syntactic-ws-end, c-nonwhite-syntactic-ws,
+	c-syntactic-ws, c-nonempty-syntactic-ws,
+	c-single-line-syntactic-ws, c-syntactic-eol): Now built from
+	`c-line-comment-starter', `c-block-comment-starter' and
+	`c-block-comment-ender'.
+
+	(c-block-comment-regexp, c-unterminated-block-comment-regexp): New
+	language constants to break up things a bit.
+
+	(c-simple-ws): New language constant for simple whitespace.
+
+	* progmodes/cc-defs.el (c-concat-separated): New convenience
+	function.
+
+	* progmodes/cc-defs.el (c-make-keywords-re): Added kludge for bug
+	in `regexp-opt' in Emacs 20 and XEmacs when strings contain
+	newlines.  Allow and ignore nil elements in the list.
+
+2005-12-08  Alan Mackenzie  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-cmds.el: Comment out a (n almost certainly
+	superfluous) check, (eq here (point-max)) in
+	c-beginning-of-statement.
+
+	* progmodes/cc-cmds.el: Tidy up the comments in
+	c-beginning-of-statement and subfunctions.
+
+	* progmodes/cc-awk.el: Replace calls to put-text-property to the
+	more flexible c-put-char-property and c-clear-char-properties.
+	Add the author's email address.
+
+	* progmodes/cc-langs.el: New variable,
+	c-block-comment-start-regexp.
+
+	* progmodes/cc-cmds.el: Fix bug with M-e, when point is inside the
+	closing "*/" of a block comment.
+
+	* progmodes/cc-cmds.el: Tidy c-beginning-of-sentence (and
+	subfunctions) so that it works at BOB and EOB.
+
+	* progmodes/cc-cmds.el, cc-vars.el: More updating of
+	c-beginning-of-statement, including new variable
+	c-block-comment-start-regexp.
+
+2005-12-08  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-langs.el (c-known-type-key): Optimize simple
+	symbols from `*-font-lock-extra-types' so that there's no need to
+	use `regexp-opt' on those lists.
+
+	* progmodes/cc-langs.el (c-type-decl-suffix-key): Fix when
+	`c-type-modifier-kwds' is empty.
+
+	* progmodes/cc-fonts.el (c-font-lock-invalid-string): Fix when
+	there are several strings on the same line.
+
+	* progmodes/cc-engine.el (c-literal-limits): Removed the
+	compatibility function for older emacsen.  `c-literal-limits-fast'
+	has now taken the place of this function.
+
+	* progmodes/cc-vars.el (c-emacs-features): Removed compatibility
+	with older emacsen: We now require 'pps-extended-state.
+
+2005-12-08  Alan Mackenzie  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-cmds.el: New function c-beginning-of-sentence,
+	which obviates the need to hack sentence-end.  This now handles
+	escaped newlines in strings correctly.  Correct minor bugs in
+	c-move-over-sentence and in c-beginning-of-statement.
+
+	* progmodes/cc-cmds.el (c-beginning-of-statement (and
+	subfunctions)): Adapt c-\(back\|forward\)-over-illiterals such
+	that movement over macros and code are rigorously separated from
+	eachother.  Correct a few incidental bugs.
+
+	* progmodes/cc-cmds.el: Restructure c-beginning-of-statement:
+	Improve its doc-string.  Improve the handling of certain specific
+	cases.
+
+2005-12-08  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-engine.el, cc-fonts.el, cc-langs.el
+	(c-guess-basic-syntax): Changed the way class-level labels are
+	recognized; they can now contain essentially any symbols.
+
+	(c-opt-extra-label-key): New language variable to cope with the
+	special protection label syntax in Objective-C.
+
+	(c-opt-access-key): Removed; this is now handled better by
+	`c-nonlabel-token-key' and `c-opt-extra-label-key'.
+
+	(c-complex-decl-matchers): Update to handle that
+	`c-opt-access-key' no longer exists.
+
+	* progmodes/cc-engine.el (c-guess-basic-syntax): Make use of the
+	improved label recognition in `c-beginning-of-statement-1'.
+
+	* progmodes/cc-engine.el (c-beginning-of-member-init-list):
+	Recognize bitfields better.
+
+	* progmodes/cc-engine.el (c-beginning-of-inheritance-list):
+	Removed some cruft and fixed a bug that could cause it to go to a
+	position further down.
+
+	* progmodes/cc-langs.el, cc-engine.el
+	(c-beginning-of-statement-1): Improved detection of labels in
+	declaration contexts.
+
+	(c-beginning-of-decl-1): Use it.
+
+	(c-nonlabel-token-key): New language constant and variable needed
+	by `c-beginning-of-statement-1'.
+
+	* progmodes/cc-engine.el (c-guess-basic-syntax): Fixed bug that
+	manifested itself due to the correction in `c-forward-sexp'.
+
+	* progmodes/cc-defs.el (c-forward-sexp, c-backward-sexp): Made
+	these behave as documented when used at the buffer limits.
+
+	* progmodes/cc-mode.el, cc-engine.el, cc-langs.el
+	(c-type-decl-end-used): Made this a language variable.
+
+	* progmodes/cc-mode.el (c-after-change): Widen the buffer to work
+	correctly when `combine-after-change-calls' is used together with
+	temporary narrowings.
+
+	* progmodes/cc-engine.el (c-beginning-of-statement-1): Report
+	labels correctly when the start point is immediately after the
+	colon.
+
+	* progmodes/cc-defs.el (c-parse-sexp-lookup-properties): Removed
+	since it isn't used anymore.
+
+	* progmodes/cc-cmds.el (c-electric-lt-gt): Detect and mark angle
+	bracket arglists such as template parens in C++.
+
+	* progmodes/cc-engine.el (c-syntactic-skip-backward): Fixed a bug
+	in the last check-in.  Some optimization.
+
+	* progmodes/cc-engine.el (c-syntactic-skip-backward): Fixed bug
+	where it could stop at the same level in a preceding sexp when
+	PAREN-LEVEL is set.
+
+	* progmodes/cc-mode.el (c-basic-common-init): Turn on syntax-table
+	text property lookup only when it's needed.
+
+	* progmodes/cc-langs.el, cc-engine.el, cc-fonts.el, cc-mode.el:
+	Changed the policy for paren marked angle brackets to be more
+	persistent; once marked they remain marked even when they're found
+	to be unbalanced in the searched region.  This should keep the
+	paren syntax around even when individual lines are refontified in
+	multiline template arglists.
+
+	(c-parse-and-markup-<>-arglists): New dynamically bound variable
+	to control markup so that incorrect angle bracket arglists aren't
+	marked in contexts where the correct value for
+	`c-disallow-comma-in-<>-arglists' isn't known.
+
+	(c-forward-<>-arglist, c-forward-<>-arglist-recur): The reparse
+	argument has become `c-parse-and-markup-<>-arglists'.
+
+	(c-remove-<>-arglist-properties): Removed - no longer used.
+
+	(c-after-change-check-<>-operators): New function used on
+	`after-change-functions' to avoid that "<" and ">" characters that
+	are part of longer operators have paren syntax.
+
+	(c-<>-multichar-token-regexp): New language variable used by
+	`c-after-change-check-<>-operators'.
+
+	(c-after-change): Call `c-after-change-check-<>-operators'.
+
+	(c-font-lock-<>-arglists): Use the context properties set by
+	`c-font-lock-declarations' to set
+	`c-disallow-comma-in-<>-arglists' correctly to avoid doing invalid
+	markup.
+
+	(c-font-lock-declarations): Removed code that undoes the invalid
+	markup done by `c-font-lock-<>-arglists'.
+
+	(c-complex-decl-matchers): `c-font-lock-<>-arglists' now runs
+	after `c-font-lock-declarations'.
+
+	* progmodes/cc-engine.el (c-syntactic-skip-backward): Added
+	paren-level feature.
+
+	(c-guess-basic-syntax): Improved the anchor position for
+	`template-args-cont' in nested template arglists.  There's still
+	much to be desired in this area, though.
+
+2005-12-08  Alan Mackenzie  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-cmds.el, cc-engine.el, cc-langs.el, cc-vars.el:
+	Make the "Text Filling and Line Breaking" commands work for AWK
+	buffers.
+
+2005-12-08  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+	* progmodes/cc-defs.el, cc-engine.el (c-mode-is-new-awk-p):
+	Removed;
+	(c-major-mode-is 'awk-mode) can be used instead now.
+
+	* progmodes/cc-mode.el: Always set up AWK mode since emacsen where
+	it doesn't work no longer are supported.
+
+	* progmodes/cc-mode.el, cc-styles.el, cc-vars.el, cc-defs.el,
+	cc-engine.el, cc-fonts.el, cc-langs.el, cc-cmds.el: CC Mode now
+	requires support for the syntax-table' text property, which rules
+	out Emacs 19 and XEmacs < 21.4.  Removed various compatibility
+	cruft associated with those versions.
+
+	* progmodes/cc-defs.el, cc-fix.el: CC Mode now requires support
+	for the `syntax-table' text property, which rules out Emacs 19 and
+	XEmacs < 21.4.  Removed various compatibility cruft associated
+	with those versions.
+
+	* progmodes/cc-vars.el (c-emacs-features): CC Mode now requires
+	support for the `syntax-table' text property.
+
+	* progmodes/cc-fonts.el (c-nonbreakable-space-face): Remove the
+	variable and use an extra quoted face name instead.  All the
+	emacsen flavors handle that correctly.
+
+	* progmodes/cc-fonts.el (c-font-lock-complex-decl-prepare,
+	c-font-lock-declarators, c-font-lock-declarations,
+	c-complex-decl-matchers, c-basic-matchers-after): Use a text
+	property to mark the items in in declarator lists to handle
+	refontification inside multiline declarations better.
+
+	* progmodes/cc-fonts.el (c-font-lock-declarations): Recognize a
+	construct like "a * b = c;" as a declaration.
+
+2005-12-08  Kim F. Storm  <storm@cua.dk>
+
+	* emulation/cua-base.el (cua-use-hyper-key): Replaced by ...
+	(cua-rectangle-modifier-key): ... this.  New defcustom.  Can now
+	select either meta, hyper, or super modifier for rectangle commands.
+	(cua--rectangle-modifier-key): New defvar.
+	(cua--M/H-key): Use it.  Remove special case for 'space.
+	(cua--init-keymaps): Initialize it from cua-rectangle-modifier-key
+	on X, to meta otherwise.  Always bind C-return to toggle
+	rectangle.  Pass ?\s instead of 'space to cua--M/H-key.
+
+	* emulation/cua-rect.el (cua-help-for-rectangle): Use
+	cua--rectangle-modifier-key.  Handle super modifier too.
+	(cua--init-rectangles): Always bind C-return to toggle rectangle.
+	Pass ?\s instead of 'space to cua--M/H-key and cua--rect-M/H-key.
+
+	* ido.el: Move Acknowledgements and History after Commentary.
+	Minor changes to Commentary.
+
+	* emulation/cua-base.el (cua--select-keymaps): Enable repeat
+	keymap if cua--prefix-override-timer equals 'shift.
+	(cua--shift-control-prefix): New function; emulate "type prefix
+	key twice" functionality to handle shifted prefix key override.
+	(cua--shift-control-c-prefix, cua--shift-control-x-prefix): New
+	commands.
+	(cua--init-keymaps): Bind them to S-C-c and S-C-x.
+
+2005-12-08  Carsten Dominik  <dominik@science.uva.nl>
+
+	* textmodes/org.el (org-insert-heading): Try to do items before
+	headings.
+	(org-agenda-mode): Quote `org-agenda-mode-hook'.
+	(org-insert-item): New function.
+	(org-renumber-ordered-list): Don't skip to higher level lists.
+
+2005-12-08  Juri Linkov  <juri@jurta.org>
+
+	* info.el (Info-mode-map): Bind M-TAB to `Info-prev-reference'.
+
+	* button.el (button-buffer-map): Bind M-TAB to `backward-button'.
+
+	* wid-edit.el (widget-keymap): Bind M-TAB to `widget-backward'.
+
+	* pcvs.el (defun-cvs-mode): Put `definition-name' property on
+	the constructed function name fun-1.
+
+	* cus-edit.el (custom-add-parent-links): Filter out custom-group-link,
+	because such links don't lead to parent documentation.
+
 2005-12-08  Kenichi Handa  <handa@m17n.org>
 
 	* descr-text.el (describe-char): Use *Help-2* buffer if the
@@ -62,7 +1498,7 @@
 	(gdb-locals-watch-map): Rename from gdb-*-*-keymap.
 	(gdb-locals-font-lock-keywords-1)
 	(gdb-locals-font-lock-keywords-2): New variables.
-	(gdb-find-file-hook): fgfg.
+	(gdb-find-file-hook): Make it work with GDB 6.4+ too.
 	(gdb-set-gud-minor-mode-existing-buffers-1)
 	(gdb-var-list-children-1, gdb-var-list-children-handler-1)
 	(gdb-var-update-1, gdb-var-update-handler-1)
@@ -94,7 +1530,7 @@
 
 2005-12-06  Carsten Dominik  <dominik@science.uva.nl>
 
-	* textmodes/org.el: (org-occur-highlights): New variable.
+	* textmodes/org.el (org-occur-highlights): New variable.
 	(org-highlight-new-match, org-remove-occur-highlights): New functions.
 	(org-highlight-sparse-tree-matches): New option.
 	(org-do-occur): New function.
@@ -187,7 +1623,8 @@
 
 	* font-core.el (global-font-lock-mode): Use define-global-minor-mode
 	instead of easy-mmode-define-global-mode.  Add `:group font-lock'.
-	(font-lock-mode): Replace `:group font-lock' with `nil nil nil'.
+	(font-lock-mode): Replace `:group font-lock' with `nil nil nil'
+	because there is no customization option for it.
 
 	* font-lock.el (lisp-font-lock-keywords-1):
 	Add define-global-minor-mode.
@@ -223,8 +1660,8 @@
 	property on their symbols (they have only `custom-loads').
 
 	* simple.el (completion-setup-function): Put completions-common-part
-	face on full completion string too (i.e. completion string without
-	completions-first-difference face).
+	face on complete completion string too (i.e. completion string
+	without completions-first-difference face).
 
 	* man.el (Man-section-regexp): Add 0-9 to support "3X11" sections.
 
@@ -698,7 +2135,7 @@
 
 2005-11-24  Carsten Dominik  <dominik@science.uva.nl>
 
-	* textmodes/org.el: (org-export-plain-list-max-depth): Renamed from
+	* textmodes/org.el (org-export-plain-list-max-depth): Renamed from
 	`org-export-local-list-max-depth'.  Change default value to 3.
 	(org-auto-renumber-ordered-lists)
 	(org-plain-list-ordered-item-terminator): New options.
@@ -912,7 +2349,7 @@
 
 2005-11-18  Carsten Dominik  <dominik@science.uva.nl>
 
-	* textmodes/org.el: (org-table-sort-lines): New command.
+	* textmodes/org.el (org-table-sort-lines): New command.
 	(org-tbl-menu): Add entry for `org-table-sort-lines'.
 	(org-add-file): Command removed, use `org-agenda-file-to-front'
 	instead.
@@ -2812,7 +4249,7 @@
 
 2005-10-21  Carsten Dominik  <dominik@science.uva.nl>
 
-	* textmodes/org.el: (org-combined-agenda-icalendar-file)
+	* textmodes/org.el (org-combined-agenda-icalendar-file)
 	(org-icalendar-include-todo, org-icalendar-combined-name): New options.
 	(org-export-icalendar-this-file)
 	(org-export-icalendar-all-agenda-files)
@@ -3494,7 +4931,7 @@
 
 2005-10-10  Carsten Dominik  <dominik@science.uva.nl>
 
-	* textmodes/org.el: (org-mode-map): Explicit definition of `C-c
+	* textmodes/org.el (org-mode-map): Explicit definition of `C-c
 	C-x' as a prefix.
 	(orgtbl-mode-map): Full keymap instead of sparse, because all
 	`self-insert-command' keys are redefined in this map.
@@ -15377,7 +16814,7 @@
 
 	* cus-edit.el (custom-bury-buffer): Function deleted.
 	(custom-buffer-done-function): Option deleted.
-	(custom-buffer-done-kill): New (replacement option.
+	(custom-buffer-done-kill): New replacement option.
 	(Custom-buffer-done): Call quit-window.
 	(custom-buffer-create-internal): Update for above changes.
 
--- a/lisp/align.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/align.el	Sun Dec 11 22:42:40 2005 +0000
@@ -931,8 +931,7 @@
 region, call `align-regexp' and type in that regular expression."
   (interactive
    (append
-    (list (min (point) (mark))
-	  (max (point) (mark)))
+    (list (region-beginning) (region-end))
     (if current-prefix-arg
 	(list (read-string "Complex align using regexp: "
 			   "\\(\\s-*\\)")
@@ -988,8 +987,7 @@
 default alignment rules that would have been used to identify the text
 to be colored."
   (interactive
-   (list (min (mark) (point))
-	 (max (mark) (point))
+   (list (region-beginning) (region-end)
 	 (completing-read
 	  "Title of rule to highlight: "
 	  (mapcar
--- a/lisp/button.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/button.el	Sun Dec 11 22:42:40 2005 +0000
@@ -69,6 +69,7 @@
 (defvar button-buffer-map
   (let ((map (make-sparse-keymap)))
     (define-key map [?\t] 'forward-button)
+    (define-key map "\e\t" 'backward-button)
     (define-key map [backtab] 'backward-button)
     map)
   "Keymap useful for buffers containing buttons.
--- a/lisp/calendar/appt.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/appt.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,6 +1,7 @@
 ;;; appt.el --- appointment notification functions
 
-;; Copyright (C) 1989, 1990, 1994, 1998, 2004, 2005  Free Software Foundation, Inc.
+;; Copyright (C) 1989, 1990, 1994, 1998, 2001, 2002, 2003, 2004, 2005
+;;   Free Software Foundation, Inc.
 
 ;; Author: Neil Mager <neilm@juliet.ll.mit.edu>
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
@@ -235,6 +236,8 @@
     (cond ((eq appt-display-format 'window)
            (funcall appt-disp-window-function
                     (number-to-string mins)
+                    ;; TODO - use calendar-month-abbrev-array rather
+                    ;; than %b?
                     (format-time-string "%a %b %e " (current-time))
                     string)
            (run-at-time (format "%d sec" appt-display-duration)
--- a/lisp/calendar/cal-bahai.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/cal-bahai.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,6 +1,6 @@
 ;;; cal-bahai.el --- calendar functions for the Baha'i calendar.
 
-;; Copyright (C) 2001 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 ;; Keywords: calendar
--- a/lisp/calendar/cal-china.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/cal-china.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,8 +1,10 @@
 ;;; cal-china.el --- calendar functions for the Chinese calendar
 
-;; Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1997, 2001, 2002, 2003, 2004, 2005
+;;   Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
+;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: Chinese calendar, calendar, holidays, diary
 
--- a/lisp/calendar/cal-coptic.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/cal-coptic.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,8 +1,10 @@
 ;;; cal-coptic.el --- calendar functions for the Coptic/Ethiopic calendars
 
-;; Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1997, 2001, 2002, 2003, 2004, 2005
+;;   Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
+;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: Coptic calendar, Ethiopic calendar, calendar, diary
 
--- a/lisp/calendar/cal-dst.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/cal-dst.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,9 +1,11 @@
 ;;; cal-dst.el --- calendar functions for daylight savings rules
 
-;; Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1994, 1995, 1996, 2001, 2002, 2003, 2004, 2005
+;;   Free Software Foundation, Inc.
 
 ;; Author: Paul Eggert <eggert@twinsun.com>
 ;;	Edward M. Reingold <reingold@cs.uiuc.edu>
+;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: daylight savings time, calendar, diary, holidays
 
--- a/lisp/calendar/cal-french.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/cal-french.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,8 +1,10 @@
 ;;; cal-french.el --- calendar functions for the French Revolutionary calendar
 
-;; Copyright (C) 1988, 89, 92, 94, 95, 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 1989, 1992, 1994, 1995, 1997, 2001, 2002, 2003,
+;;   2004, 2005  Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
+;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: French Revolutionary calendar, calendar, diary
 
--- a/lisp/calendar/cal-hebrew.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/cal-hebrew.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,9 +1,11 @@
 ;;; cal-hebrew.el --- calendar functions for the Hebrew calendar
 
-;; Copyright (C) 1995, 1997, 2003 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1997, 2001, 2002, 2003, 2004, 2005
+;;   Free Software Foundation, Inc.
 
 ;; Author: Nachum Dershowitz <nachum@cs.uiuc.edu>
 ;;      Edward M. Reingold <reingold@cs.uiuc.edu>
+;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: Hebrew calendar, calendar, diary
 
--- a/lisp/calendar/cal-islam.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/cal-islam.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,8 +1,10 @@
 ;;; cal-islam.el --- calendar functions for the Islamic calendar
 
-;; Copyright (C) 1995, 1997, 2001, 2003 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1997, 2001, 2002, 2003, 2004, 2005
+;;   Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
+;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: Islamic calendar, calendar, diary
 
--- a/lisp/calendar/cal-iso.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/cal-iso.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,6 +1,7 @@
 ;;; cal-iso.el --- calendar functions for the ISO calendar
 
-;; Copyright (C) 1995, 1997, 2004 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1997, 2001, 2002, 2003, 2004, 2005
+;;   Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
--- a/lisp/calendar/cal-julian.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/cal-julian.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,8 +1,10 @@
 ;;; cal-julian.el --- calendar functions for the Julian calendar
 
-;; Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1997, 2001, 2002, 2003, 2004, 2005
+;;   Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
+;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: Julian calendar, Julian day number, calendar, diary
 
--- a/lisp/calendar/cal-mayan.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/cal-mayan.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,9 +1,11 @@
 ;;; cal-mayan.el --- calendar functions for the Mayan calendars
 
-;; Copyright (C) 1992, 1993, 1995, 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1993, 1995, 1997, 2001, 2002, 2003, 2004, 2005
+;;   Free Software Foundation, Inc.
 
 ;; Author: Stewart M. Clamen <clamen@cs.cmu.edu>
 ;;	Edward M. Reingold <reingold@cs.uiuc.edu>
+;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: Mayan calendar, Maya, calendar, diary
 
--- a/lisp/calendar/cal-menu.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/cal-menu.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,6 +1,7 @@
 ;;; cal-menu.el --- calendar functions for menu bar and popup menu support
 
-;; Copyright (C) 1994, 1995, 2001, 2003, 2004, 2005  Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1995, 2001, 2002, 2003, 2004, 2005
+;;   Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
 ;;	Lara Rios <lrios@coewl.cen.uiuc.edu>
--- a/lisp/calendar/cal-move.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/cal-move.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,6 +1,7 @@
 ;;; cal-move.el --- calendar functions for movement in the calendar
 
-;; Copyright (C) 1995, 2005  Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005
+;;   Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
--- a/lisp/calendar/cal-persia.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/cal-persia.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,8 +1,10 @@
 ;;; cal-persia.el --- calendar functions for the Persian calendar
 
-;; Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 1997, 2001, 2002, 2003, 2004, 2005
+;;   Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
+;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: Persian calendar, calendar, diary
 
--- a/lisp/calendar/cal-tex.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/cal-tex.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,9 +1,11 @@
 ;;; cal-tex.el --- calendar functions for printing calendars with LaTeX
 
-;; Copyright (C) 1995 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005
+;;   Free Software Foundation, Inc.
 
 ;; Author: Steve Fisk <fisk@bowdoin.edu>
 ;;      Edward M. Reingold <reingold@cs.uiuc.edu>
+;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: Calendar, LaTeX
 
--- a/lisp/calendar/cal-x.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/cal-x.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,6 +1,7 @@
 ;;; cal-x.el --- calendar windows in dedicated frames in X
 
-;; Copyright (C) 1994, 1995, 2005  Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1995, 2001, 2002, 2003, 2004, 2005
+;;   Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
 ;;      Edward M. Reingold <reingold@cs.uiuc.edu>
--- a/lisp/calendar/calendar.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/calendar.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,7 +1,7 @@
 ;;; calendar.el --- calendar functions
 
 ;; Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1997,
-;;	2000, 2001, 2003, 2004, 2005  Free Software Foundation, Inc.
+;;   2000, 2001, 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
--- a/lisp/calendar/diary-lib.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/diary-lib.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,7 +1,7 @@
 ;;; diary-lib.el --- diary functions
 
-;; Copyright (C) 1989, 1990, 1992, 1993, 1994, 1995, 2003, 2004, 2005
-;;           Free Software Foundation, Inc.
+;; Copyright (C) 1989, 1990, 1992, 1993, 1994, 1995, 2001, 2002, 2003,
+;;   2004, 2005  Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
--- a/lisp/calendar/holidays.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/holidays.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,7 +1,7 @@
 ;;; holidays.el --- holiday functions for the calendar package
 
-;; Copyright (C) 1989, 1990, 1992, 1993, 1994, 1997, 2004 Free
-;;   Software Foundation, Inc.
+;; Copyright (C) 1989, 1990, 1992, 1993, 1994, 1997, 2001, 2002, 2003,
+;;   2004, 2005  Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
--- a/lisp/calendar/lunar.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/lunar.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,8 +1,10 @@
 ;;; lunar.el --- calendar functions for phases of the moon
 
-;; Copyright (C) 1992, 1993, 1995, 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1993, 1995, 1997, 2001, 2002, 2003, 2004, 2005
+;;   Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
+;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: moon, lunar phases, calendar, diary
 
--- a/lisp/calendar/parse-time.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/parse-time.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,6 +1,7 @@
 ;;; parse-time.el --- parsing time strings
 
-;; Copyright (C) 1996, 2000 by Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2000, 2001, 2002, 2003, 2004, 2005
+;;   Free Software Foundation, Inc.
 
 ;; Author: Erik Naggum <erik@naggum.no>
 ;; Keywords: util
--- a/lisp/calendar/solar.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/solar.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,6 +1,7 @@
 ;;; solar.el --- calendar functions for solar events
 
-;; Copyright (C) 1992, 1993, 1995, 1997, 2003 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1993, 1995, 1997, 2001, 2002, 2003, 2004, 2005
+;;   Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
 ;;	Denis B. Roegel <Denis.Roegel@loria.fr>
--- a/lisp/calendar/time-date.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/time-date.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,6 +1,7 @@
 ;;; time-date.el --- Date and time handling functions
-;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005
-;;        Free Software Foundation, Inc.
+
+;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+;;   Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;	Masanobu Umeda <umerin@mse.kyutech.ac.jp>
--- a/lisp/calendar/timeclock.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/timeclock.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,6 +1,7 @@
 ;;; timeclock.el --- mode for keeping track of how much you work
 
-;; Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+;;   Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 ;; Created: 25 Mar 1999
--- a/lisp/calendar/todo-mode.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/calendar/todo-mode.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1,6 +1,7 @@
 ;;; todo-mode.el --- major mode for editing TODO list files
 
-;; Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2001, 2002, 2003, 2004, 2005
+;;   Free Software Foundation, Inc.
 
 ;; Author: Oliver Seidel <os10000@seidel-space.de>
 ;;   [Not clear the above works, July 2000]
--- a/lisp/compare-w.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/compare-w.el	Sun Dec 11 22:42:40 2005 +0000
@@ -343,13 +343,13 @@
         (move-overlay compare-windows-overlay1 beg1 end1 b1)
       (setq compare-windows-overlay1 (make-overlay beg1 end1 b1))
       (overlay-put compare-windows-overlay1 'face 'compare-windows)
-      (overlay-put compare-windows-overlay1 'priority 1))
+      (overlay-put compare-windows-overlay1 'priority 1000))
     (overlay-put compare-windows-overlay1 'window w1)
     (if compare-windows-overlay2
         (move-overlay compare-windows-overlay2 beg2 end2 b2)
       (setq compare-windows-overlay2 (make-overlay beg2 end2 b2))
       (overlay-put compare-windows-overlay2 'face 'compare-windows)
-      (overlay-put compare-windows-overlay2 'priority 1))
+      (overlay-put compare-windows-overlay2 'priority 1000))
     (overlay-put compare-windows-overlay2 'window w2)
     ;; Remove highlighting before next command is executed
     (add-hook 'pre-command-hook 'compare-windows-dehighlight)))
--- a/lisp/cus-edit.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/cus-edit.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1466,7 +1466,7 @@
 				 (custom-reset event))))
     (widget-insert "\n ")
     (widget-create 'push-button
-		   :tag "Reset"
+		   :tag "Reset to Current"
 		   :help-echo "\
 Reset all edited text in this buffer to reflect current values."
 		   :action 'Custom-reset-current)
@@ -2155,7 +2155,11 @@
 		  (setq parents (cons symbol parents)))))
     (and (null (get name 'custom-links)) ;No links of its own.
          (= (length parents) 1)         ;A single parent.
-         (let* ((links (get (car parents) 'custom-links))
+         (let* ((links (delq nil (mapcar (lambda (w)
+					   (unless (eq (widget-type w)
+						       'custom-group-link)
+					     w))
+					 (get (car parents) 'custom-links))))
                 (many (> (length links) 2)))
            (when links
              (insert "\nParent documentation: ")
--- a/lisp/emacs-lisp/lisp.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/emacs-lisp/lisp.el	Sun Dec 11 22:42:40 2005 +0000
@@ -569,10 +569,11 @@
 	      ((null completion)
 	       (message "Can't find completion for \"%s\"" pattern)
 	       (ding))
-	      ((not (string= pattern completion))
-	       (delete-region beg end)
-	       (insert completion))
 	      (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<))
@@ -585,8 +586,10 @@
 					 new))
 			 (setq list (cdr list)))
 		       (setq list (nreverse new))))
-		 (with-output-to-temp-buffer "*Completions*"
-		   (display-completion-list list pattern)))
+		 (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")))))))
 
 ;;; arch-tag: aa7fa8a4-2e6f-4e9b-9cd9-fef06340e67e
--- a/lisp/emulation/cua-base.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/emulation/cua-base.el	Sun Dec 11 22:42:40 2005 +0000
@@ -329,15 +329,6 @@
   :type 'boolean
   :group 'cua)
 
-(defcustom cua-use-hyper-key nil
-  "*If non-nil, bind rectangle commands to H-... instead of M-....
-If set to `also', toggle region command is also on C-return.
-Must be set prior to enabling CUA."
-  :type '(choice (const :tag "Meta key and C-return" nil)
-		 (const :tag "Hyper key only" only)
-		 (const :tag "Hyper key and C-return" also))
-  :group 'cua)
-
 (defcustom cua-enable-region-auto-help nil
   "*If non-nil, automatically show help for active region."
   :type 'boolean
@@ -379,6 +370,15 @@
 		 (other :tag "Enabled" t))
   :group 'cua)
 
+(defcustom cua-rectangle-modifier-key 'meta
+  "*Modifier key used for rectangle commands bindings.
+On non-window systems, always use the meta modifier.
+Must be set prior to enabling CUA."
+  :type '(choice (const :tag "Meta key" meta)
+		 (const :tag "Hyper key" hyper )
+		 (const :tag "Super key" super))
+  :group 'cua)
+
 (defcustom cua-enable-rectangle-auto-help t
   "*If non-nil, automatically show help for region, rectangle and global mark."
   :type 'boolean
@@ -1180,11 +1180,13 @@
 
 ;;; Keymaps
 
+;; Cached value of actual cua-rectangle-modifier-key
+(defvar cua--rectangle-modifier-key 'meta)
+
 (defun cua--M/H-key (map key fct)
   ;; bind H-KEY or M-KEY to FCT in MAP
-  (if (eq key 'space) (setq key ?\s))
   (unless (listp key) (setq key (list key)))
-  (define-key map (vector (cons (if cua-use-hyper-key 'hyper 'meta) key)) fct))
+  (define-key map (vector (cons cua--rectangle-modifier-key key)) fct))
 
 (defun cua--self-insert-char-p (def)
   ;; Return DEF if current key sequence is self-inserting in
@@ -1232,7 +1234,8 @@
 	     (not cua--prefix-override-timer)))
   (setq cua--ena-prefix-repeat-keymap
 	(and cua--ena-region-keymap
-	     (timerp cua--prefix-override-timer)))
+	     (or (timerp cua--prefix-override-timer)
+		 (eq cua--prefix-override-timer 'shift))))
   (setq cua--ena-cua-keys-keymap
 	(and cua-enable-cua-keys
 	     (not cua-inhibit-cua-keys)
@@ -1244,12 +1247,39 @@
 
 (defvar cua--keymaps-initalized nil)
 
+(defun cua--shift-control-prefix (prefix arg)
+  ;; handle S-C-x and S-C-c by emulating the fast double prefix function.
+  ;; Don't record this command
+  (setq this-command last-command)
+  ;; Restore the prefix arg
+  (setq prefix-arg arg)
+  (reset-this-command-lengths)
+  ;; Activate the cua--prefix-repeat-keymap
+  (setq cua--prefix-override-timer 'shift)
+  ;; Push duplicate keys back on the event queue
+  (setq unread-command-events (cons prefix (cons prefix unread-command-events))))
+
+(defun cua--shift-control-c-prefix (arg)
+  (interactive "P")
+  (cua--shift-control-prefix ?\C-c arg))
+
+(defun cua--shift-control-x-prefix (arg)
+  (interactive "P")
+  (cua--shift-control-prefix ?\C-x arg))
+
 (defun cua--init-keymaps ()
-  (unless (eq cua-use-hyper-key 'only)
-    (define-key cua-global-keymap [(control return)]	'cua-set-rectangle-mark))
-  (when cua-use-hyper-key
-    (cua--M/H-key cua-global-keymap 'space	'cua-set-rectangle-mark)
-    (define-key cua-global-keymap [(hyper mouse-1)] 'cua-mouse-set-rectangle-mark))
+  ;; Cache actual rectangle modifier key.
+  (setq cua--rectangle-modifier-key
+	(if (and cua-rectangle-modifier-key
+		 (memq window-system '(x)))
+	    cua-rectangle-modifier-key
+	  'meta))
+  ;; C-return always toggles rectangle mark
+  (define-key cua-global-keymap [(control return)]	'cua-set-rectangle-mark)
+  (unless (eq cua--rectangle-modifier-key 'meta)
+    (cua--M/H-key cua-global-keymap ?\s			'cua-set-rectangle-mark)
+    (define-key cua-global-keymap
+      (vector (list cua--rectangle-modifier-key 'mouse-1)) 'cua-mouse-set-rectangle-mark))
 
   (define-key cua-global-keymap [(shift control ?\s)]	'cua-toggle-global-mark)
 
@@ -1287,8 +1317,9 @@
   (define-key cua--prefix-repeat-keymap [(control c) right] 'cua--prefix-copy-handler)
 
   ;; Enable shifted fallbacks for C-x and C-c when region is active
-  (define-key cua--region-keymap [(shift control x)] 'Control-X-prefix)
-  (define-key cua--region-keymap [(shift control c)] 'mode-specific-command-prefix)
+  (define-key cua--region-keymap [(shift control x)] 'cua--shift-control-x-prefix)
+  (define-key cua--region-keymap [(shift control c)] 'cua--shift-control-c-prefix)
+
   ;; replace current region
   (define-key cua--region-keymap [remap self-insert-command]	'cua-replace-region)
   (define-key cua--region-keymap [remap self-insert-iso]	'cua-replace-region)
@@ -1365,7 +1396,7 @@
 the prefix fallback behavior."
   :global t
   :group 'cua
-  :set-after '(cua-enable-modeline-indications cua-use-hyper-key)
+  :set-after '(cua-enable-modeline-indications cua-rectangle-modifier-key)
   :require 'cua-base
   :link '(emacs-commentary-link "cua-base.el")
   (setq mark-even-if-inactive t)
--- a/lisp/emulation/cua-rect.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/emulation/cua-rect.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1242,6 +1242,7 @@
 	       (setq z (cdr z)))
 	     (if cua--debug
 		 (print (list (current-column) cc) auxbuf))
+	     (just-one-space 0)
              (indent-to cc))))
       (if (> tr 0)
 	  (message "Warning:  Truncated %d row%s" tr (if (> tr 1) "s" "")))
@@ -1358,7 +1359,9 @@
 
 (defun cua-help-for-rectangle (&optional help)
   (interactive)
-  (let ((M (if cua-use-hyper-key " H-" " M-")))
+  (let ((M (cond ((eq cua--rectangle-modifier-key 'hyper) " H-")
+		 ((eq cua--rectangle-modifier-key 'super) " s-")
+		 (t " M-"))))
     (message
      (concat (if help "C-?:help" "")
              M "p:pad" M "o:open" M "c:close" M "b:blank"
@@ -1410,12 +1413,11 @@
   (cua--M/H-key cua--rectangle-keymap key cmd))
 
 (defun cua--init-rectangles ()
-  (unless (eq cua-use-hyper-key 'only)
-    (define-key cua--rectangle-keymap [(control return)] 'cua-clear-rectangle-mark)
-    (define-key cua--region-keymap    [(control return)] 'cua-toggle-rectangle-mark))
-  (when cua-use-hyper-key
-    (cua--rect-M/H-key 'space			       'cua-clear-rectangle-mark)
-    (cua--M/H-key cua--region-keymap 'space	       'cua-toggle-rectangle-mark))
+  (define-key cua--rectangle-keymap [(control return)] 'cua-clear-rectangle-mark)
+  (define-key cua--region-keymap    [(control return)] 'cua-toggle-rectangle-mark)
+  (unless (eq cua--rectangle-modifier-key 'meta)
+    (cua--rect-M/H-key ?\s			       'cua-clear-rectangle-mark)
+    (cua--M/H-key cua--region-keymap ?\s	       'cua-toggle-rectangle-mark))
 
   (define-key cua--rectangle-keymap [remap copy-region-as-kill] 'cua-copy-rectangle)
   (define-key cua--rectangle-keymap [remap kill-ring-save]      'cua-copy-rectangle)
--- a/lisp/files.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/files.el	Sun Dec 11 22:42:40 2005 +0000
@@ -3197,7 +3197,9 @@
             ancestor))))))
 
 (defun save-buffer (&optional args)
-  "Save current buffer in visited file if modified.  Variations are described below.
+  "Save current buffer in visited file if modified.
+Variations are described below.
+
 By default, makes the previous version into a backup file
  if previously requested or if this is the first save.
 Prefixed with one \\[universal-argument], marks this version
--- a/lisp/foldout.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/foldout.el	Sun Dec 11 22:42:40 2005 +0000
@@ -308,7 +308,8 @@
 Normally causes exited folds to be hidden, but with ARG < 0, -ARG folds are
 exited and text is left visible."
   (interactive "p")
-  (let (start-marker end-marker (hide-fold t))
+  (let ((hide-fold t) start-marker end-marker
+	beginning-of-heading end-of-subtree)
 
     ;; check there are some folds to leave
     (if (null foldout-fold-list)
@@ -355,26 +356,23 @@
       ;; is \n otherwise it will be hidden.  If there is a newline
       ;; before this one, make it visible too so we do the same as
       ;; outline.el and leave a blank line before the heading.
-      (if (zerop num-folds)
-	  (let ((beginning-of-heading (point))
-		(end-of-subtree (if end-marker
-				    (progn
-				      (forward-char -1)
-				      (if (memq (preceding-char)
-						'(?\n ?\^M))
-					  (forward-char -1))
-				      (point))
-				  (point-max))))
-	    ;; hide the subtree
-	    (if hide-fold
-		(outline-flag-region start-marker end-of-subtree
-				     foldout-hide-flag))
+      (when (zerop num-folds)
+	(if end-marker
+	    (setq beginning-of-heading (point)
+		  end-of-subtree (progn (forward-char -1)
+					(if (memq (preceding-char)
+						  '(?\n ?\^M))
+					    (forward-char -1))
+					(point))))
+	;; hide the subtree
+	(when hide-fold
+	  (goto-char start-marker)
+	  (hide-subtree))
 
-	    ;; make sure the next heading is exposed
-	    (if end-marker
-		(outline-flag-region end-of-subtree beginning-of-heading
-				     foldout-show-flag))
-	    ))
+	;; make sure the next heading is exposed
+	(if end-marker
+	    (outline-flag-region end-of-subtree beginning-of-heading
+				 foldout-show-flag)))
 
       ;; zap the markers so they don't slow down editing
       (set-marker start-marker nil)
--- a/lisp/gnus/ChangeLog	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/gnus/ChangeLog	Sun Dec 11 22:42:40 2005 +0000
@@ -1,3 +1,204 @@
+2005-12-08  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* mm-decode.el (mm-discouraged-alternatives): Fix custom type.
+	Suggest image/.* in the doc string.
+
+2005-12-07  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* mm-decode.el (mm-display-external): Use nametemplate (defined in
+	RFC1524) if it is in mailcap or add a suffix according to
+	mailcap-mime-extensions when generating a temp filename; postpone
+	deleting a temp file for 2 seconds for some wrappers, shell
+	scripts, and so on, which might exit right after having started a
+	viewer command as a background job.
+
+2005-12-06  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* gnus-art.el (gnus-default-article-saver): Add user-defined
+	`function' to custom type.
+
+2005-12-02  ARISAWA Akihiro  <ari@mbf.ocn.ne.jp>  (tiny change)
+
+	* mm-view.el (mm-inline-text-html-render-with-w3m): Fix misplaced
+	parens.
+
+2005-11-29  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* gnus-cache.el (gnus-cache-rename-group): Wrap doc strings and
+	long lines.
+	(gnus-cache-delete-group): Wrap doc strings.
+
+	* gnus-agent.el (gnus-agent-rename-group)
+	(gnus-agent-delete-group): Wrap doc strings.
+
+2005-11-24  Pascal Rigaux  <pixel@mandriva.com>  (tiny change)
+
+	* rfc2231.el (rfc2231-parse-string): Support non-ascii chars.
+
+2005-11-22  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* nnmail.el (nnmail-fancy-expiry-target): Use current-time instead
+	of current-time-string.
+
+2005-11-20  Stefan Schimanski  <schimmi@debian.org>  (tiny change)
+
+	* nnmail.el (nnmail-fancy-expiry-target): Protect against invalid
+	date header.
+
+2005-11-16  Boris Samorodov <bsam@ipt.ru>  (tiny patch)
+
+	* imap.el (imap-kerberos4-open): Ignore SSL stuff.
+
+2005-11-14  Kevin Greiner  <kevin.greiner@compsol.cc>
+
+	* gnus-agent.el (gnus-agent-article-alist-save-format): Changed
+	internal variable to a custom variable.  Changed default value
+	from compressed(2) to uncompressed(1).
+	(gnus-agent-read-agentview): Reversed revision 7.8 to restore
+	support for uncompressed agentview files.  Taken together, reading
+	the agentview file should now be 6-7 times faster.
+	(gnus-agent-long-article,
+	gnus-agent-short-article, gnus-agent-score): Renamed category
+	keywords to match gnus-cus.
+	(gnus-agent-summary-fetch-series): Modified to protect against
+	gnus-agent-summary-fetch-group clearing processable flags.
+	(gnus-agent-synchronize-group-flags): Update live group buffer as
+	synchronization may occur due to the user toggling the plugged
+	status.
+	(gnus-agent-braid-nov): Now tests new nov entries
+	for duplicates which are removed.  The invalid sort check then
+	triggers a rescan after the sort as sorting may have moved
+	duplicate entries such that they can be cheaply detected.
+	(gnus-agent-read-local): Trivial fix to format of
+	error message to display actual error condition.
+	(gnus-agent-save-local): Avoid saving symbols that are bound to
+	nil as they simply result in a warning message in
+	gnus-agent-read-local.
+	(gnus-agent-fetch-group-1): Clear downloadable flag when article
+	successfully downloaded.
+	(gnus-agent-regenerate-group): Use
+	gnus-agent-synchronize-group-flags to reset read status in both
+	gnus and server.
+
+	* nntp.el (nntp-end-of-line): Doc fix.
+	(nntp-authinfo-rejected): New error condition.
+	(nntp-wait-for): Use new error condition to signal authentication
+	error.
+	(nntp-retrieve-data): Rethrow new error condition to break out of
+	recursive call to nntp-send-authinfo.
+	
+2005-11-13  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* gnus-start.el (gnus-dribble-read-file): Use make-local-variable
+	rather than make-variable-buffer-local for file-precious-flag.
+
+2005-11-13  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* gnus-start.el (gnus-dribble-read-file): Quote file-precious-flag.
+
+2005-11-11  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* gnus-start.el (gnus-dribble-read-file): Set file-precious-flag,
+	as a buffer-local variable.  This avoids creating truncated
+	dribble files as a result of a hang up, eg.
+
+2005-11-04 Ken Manheimer  <ken.manheimer@gmail.com>
+
+	* pgg-pgp.el (pgg-pgp-encrypt-region, pgg-pgp-decrypt-region)
+	(pgg-pgp-encrypt-symmetric-region, pgg-pgp-encrypt-symmetric)
+	(pgg-pgp-encrypt, pgg-pgp-decrypt-region, pgg-pgp-decrypt)
+	(pgg-pgp-sign-region, pgg-pgp-sign): Add optional 'passphrase'
+	argument to all these routines, so the passphrase can be managed
+	externally and passed in to the system.
+	(pgg-pgp-decrypt-region, pgg-pgp-sign-region): Use new name for
+	pgg-add-passphrase-to-cache function.
+
+	* pgg-pgp5.el (pgg-pgp5-encrypt-region, pgg-pgp5-decrypt-region)
+	(pgg-pgp5-encrypt-symmetric-region, pgg-pgp5-encrypt-symmetric)
+	(pgg-pgp5-encrypt, pgg-pgp5-decrypt-region, pgg-pgp5-decrypt)
+	(pgg-pgp5-sign-region, pgg-pgp5-sign): Add optional 'passphrase'
+	argument to all these routines, so the passphrase can be managed
+	externally and passed in to the system.
+	(pgg-pgp5-sign-region): Use new name of	pgg-add-passphrase-to-cache
+	function.
+
+2005-10-30  Chong Yidong  <cyd@stupidchicken.com>
+
+	* imap.el (imap-open): Handle case where buffer is a buffer
+	object.
+
+2005-10-29  Ken Manheimer  <ken.manheimer@gmail.com>
+
+	* pgg-gpg.el (pgg-gpg-select-matching-key): Fix: look at the right
+	part of the decoded armor to find the key-identifier.
+	(pgg-gpg-lookup-key-owner): New function to return the
+	human-readable identifier of a key owner.
+	(pgg-gpg-lookup-id-from-key-owner): Make it easy to identify the
+	key itself.
+	(pgg-gpg-decrypt-region): Prompt with the key owner (rather than
+	the key value) if we have a key and can match it against a secret
+	key.  Also, added a note pointing out fact that the prompt only
+	indicates the first matching key.
+
+	* pgg.el (pgg-decrypt): Passing along 'passphrase' in call to
+	pgg-decrypt-region.
+	(pgg-pending-timers): A new hash for tracking the passphrase cache
+	timers, so that new ones supercede old ones.
+	(pgg-add-passphrase-to-cache): Rename from
+	`pgg-add-passphrase-cache' to reduce confusion (all callers
+	changed).  Modified to cancel old timers when new ones are added.
+	(pgg-remove-passphrase-from-cache): Rename from
+	`pgg-remove-passphrase-cache' to reduce confusion (all callers
+	changed).  Modified to cancel old timers when their keys are
+	removed from the cache.
+	(pgg-cancel-timer): In Emacs, an alias for cancel-timer; in
+	XEmacs, an indirection to delete-itimer.
+	(pgg-read-passphrase-from-cache, pgg-read-passphrase):
+	Extract pgg-read-passphrase-from-cache from pgg-read-passphrase so
+	users can only check cache without risk of prompting.  Correct bug in
+	notruncate behavior.
+	(pgg-read-passphrase-from-cache, pgg-read-passphrase)
+	(pgg-add-passphrase-cache, pgg-remove-passphrase-cache):
+	Add informative docstrings.
+	(pgg-decrypt): Convey provided passphrase in subordinate call to
+	pgg-decrypt-region.
+
+2005-10-20  Ken Manheimer <ken.manheimer+emacs@gmail.com>
+
+	* pgg.el (pgg-encrypt-region, pgg-encrypt-symmetric-region)
+	(pgg-encrypt-symmetric, pgg-encrypt, pgg-decrypt-region)
+	(pgg-decrypt, pgg-sign-region, pgg-sign): Add optional
+	'passphrase' argument, so the passphrase can be managed externally
+	and then passed in to the system.
+
+	* pgg.el (pgg-read-passphrase, pgg-add-passphrase-cache)
+	(pgg-remove-passphrase-cache): Add optional 'notruncate' argument,
+	so the passphrase cache can be used reliably with identifiers
+	besides a pgp packet's key id.
+
+	* pgg-gpg.el (pgg-pgp-encrypt-region)
+	(pgg-pgp-encrypt-symmetric-region, pgg-pgp-encrypt-symmetric)
+	(pgg-pgp-encrypt, pgg-pgp-decrypt-region, pgg-pgp-decrypt)
+	(pgg-pgp-sign-region, pgg-pgp-sign): Add optional 'passphrase'
+	argument to all these routines, so the passphrase can be managed
+	externally and passed in to the system.
+
+	* pgg-gpg.el (pgg-gpg-possibly-cache-passphrase): Add optional
+	'notruncate' argument, so the passphrase cache can be used
+	reliably with identifiers besides a pgp packet's key id.
+
+2005-10-29  Sascha Wilde  <swilde@sha-bang.de>
+
+	* pgg-gpg.el (pgg-gpg-encrypt-symmetric-region): New function for
+	symmetric encryption.
+	(pgg-gpg-symmetric-key-p): New function to check for an symmetric
+	encrypted session key.
+	(pgg-gpg-decrypt-region): When decrypting a symmetric encrypted
+	message ask for the passphrase in a proper way.
+
+	* pgg.el (pgg-encrypt-symmetric, pgg-encrypt-symmetric-region):
+	New user commands for symmetric encryption.
+
 2005-11-30  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* gnus-delay.el (gnus-delay-group): Don't autoload.
--- a/lisp/gnus/gnus-agent.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/gnus/gnus-agent.el	Sun Dec 11 22:42:40 2005 +0000
@@ -213,6 +213,17 @@
   :group 'gnus-agent
   :type 'boolean)
 
+(defcustom gnus-agent-article-alist-save-format 1
+  "Indicates whether to use compression(2), verses no
+  compression(1), when writing agentview files.  The compressed
+  files do save space but load times are 6-7 times higher.  A
+  group must be opened then closed for the agentview to be
+  updated using the new format."
+  :version "22.1"
+  :group 'gnus-agent
+  :type '(radio (const :format "Compressed" 2)
+		(const :format "Uncompressed" 1)))
+
 ;;; Internal variables
 
 (defvar gnus-agent-history-buffers nil)
@@ -357,17 +368,17 @@
 (gnus-agent-cat-defaccessor
  gnus-agent-cat-high-score                 agent-high-score)
 (gnus-agent-cat-defaccessor
- gnus-agent-cat-length-when-long           agent-length-when-long)
+ gnus-agent-cat-length-when-long           agent-long-article)
 (gnus-agent-cat-defaccessor
- gnus-agent-cat-length-when-short          agent-length-when-short)
+ gnus-agent-cat-length-when-short          agent-short-article)
 (gnus-agent-cat-defaccessor
  gnus-agent-cat-low-score                  agent-low-score)
 (gnus-agent-cat-defaccessor
  gnus-agent-cat-predicate                  agent-predicate)
 (gnus-agent-cat-defaccessor
- gnus-agent-cat-score-file                 agent-score-file)
+ gnus-agent-cat-score-file                 agent-score)
 (gnus-agent-cat-defaccessor
- gnus-agent-cat-enable-undownloaded-faces agent-enable-undownloaded-faces)
+ gnus-agent-cat-enable-undownloaded-faces  agent-enable-undownloaded-faces)
 
 
 ;; This form is equivalent to defsetf except that it calls make-symbol
@@ -858,9 +869,11 @@
 
 ;;;###autoload
 (defun gnus-agent-rename-group (old-group new-group)
-  "Rename fully-qualified OLD-GROUP as NEW-GROUP.  Always updates the agent, even when
-disabled, as the old agent files would corrupt gnus when the agent was
-next enabled. Depends upon the caller to determine whether group renaming is supported."
+  "Rename fully-qualified OLD-GROUP as NEW-GROUP.
+Always updates the agent, even when disabled, as the old agent
+files would corrupt gnus when the agent was next enabled.
+Depends upon the caller to determine whether group renaming is
+supported."
   (let* ((old-command-method (gnus-find-method-for-group old-group))
 	 (old-path           (directory-file-name
 			      (let (gnus-command-method old-command-method)
@@ -888,9 +901,11 @@
 
 ;;;###autoload
 (defun gnus-agent-delete-group (group)
-  "Delete fully-qualified GROUP.  Always updates the agent, even when
-disabled, as the old agent files would corrupt gnus when the agent was
-next enabled. Depends upon the caller to determine whether group deletion is supported."
+  "Delete fully-qualified GROUP.
+Always updates the agent, even when disabled, as the old agent
+files would corrupt gnus when the agent was next enabled.
+Depends upon the caller to determine whether group deletion is
+supported."
   (let* ((command-method (gnus-find-method-for-group group))
 	 (path           (directory-file-name
 			  (let (gnus-command-method command-method)
@@ -1134,20 +1149,22 @@
   (when gnus-newsgroup-processable
     (setq gnus-newsgroup-downloadable
           (let* ((dl gnus-newsgroup-downloadable)
-                 (gnus-newsgroup-downloadable
-		  (sort (gnus-copy-sequence gnus-newsgroup-processable) '<))
-                 (fetched-articles (gnus-agent-summary-fetch-group)))
+		 (processable (sort (gnus-copy-sequence gnus-newsgroup-processable) '<))
+                 (gnus-newsgroup-downloadable processable))
+	    (gnus-agent-summary-fetch-group)
+
+            ;; For each article that I processed that is no longer
+            ;; undownloaded, remove its processable mark.
+
+	    (mapc #'gnus-summary-remove-process-mark 
+		  (gnus-sorted-ndifference gnus-newsgroup-processable gnus-newsgroup-undownloaded))
+
             ;; The preceeding call to (gnus-agent-summary-fetch-group)
-            ;; updated gnus-newsgroup-downloadable to remove each
-            ;; article successfully fetched.
-
-            ;; For each article that I processed, remove its
-            ;; processable mark IF the article is no longer
-            ;; downloadable (i.e. it's already downloaded)
-            (dolist (article gnus-newsgroup-processable)
-              (unless (memq article gnus-newsgroup-downloadable)
-                (gnus-summary-remove-process-mark article)))
-            (gnus-sorted-ndifference dl fetched-articles)))))
+            ;; updated the temporary gnus-newsgroup-downloadable to
+            ;; remove each article successfully fetched.  Now, I
+            ;; update the real gnus-newsgroup-downloadable to only
+            ;; include undownloaded articles.
+	    (gnus-sorted-ndifference dl (gnus-sorted-ndifference processable gnus-newsgroup-undownloaded))))))
 
 (defun gnus-agent-summary-fetch-group (&optional all)
   "Fetch the downloadable articles in the group.
@@ -1240,7 +1257,13 @@
 				  'gnus-range-add
 				'gnus-remove-from-range)
 			      (cdr info-marks)
-			      range)))))))))
+			      range))))))))
+
+      ;;Marks can be synchronized at any time by simply toggling from
+      ;;unplugged to plugged.  If that is what is happening right now, make
+      ;;sure that the group buffer is up to date.
+          (when (gnus-buffer-live-p gnus-group-buffer)
+            (gnus-group-update-group group t)))
     nil))
 
 (defun gnus-agent-save-active (method)
@@ -1330,7 +1353,7 @@
           (when (re-search-forward
                  (concat "^" (regexp-quote group) " ") nil t)
             (save-excursion
-	      (setq oactive-max (read (current-buffer)) ;; max
+              (setq oactive-max (read (current-buffer))	;; max
                     oactive-min (read (current-buffer)))) ;; min
             (gnus-delete-line)))
 	(when active
@@ -1824,7 +1847,7 @@
 (defsubst gnus-agent-read-article-number ()
   "Reads the article number at point.  Returns nil when a valid article number can not be read."
 
-  ;; It is unfortunite but the read function quietly overflows
+  ;; It is unfortunate but the read function quietly overflows
   ;; integer.  As a result, I have to use string operations to test
   ;; for overflow BEFORE calling read.
   (when (looking-at "[0-9]+\t")
@@ -1913,6 +1936,7 @@
 	(goto-char p))
 
       (setq last (or last -134217728))
+      (while (catch 'problems
       (let (sort art)
 	(while (not (eobp))
 	  (setq art (gnus-agent-read-article-number))
@@ -1924,12 +1948,27 @@
 		 ;; Art num out of order - enable sort
 		 (setq sort t)
 		 (forward-line 1))
+			 ((= art last)
+			  ;; Bad repeat of art number - delete this line
+			  (beginning-of-line)
+			  (delete-region (point) (progn (forward-line 1) (point))))
 		(t
 		 ;; Good art num
 		 (setq last art)
 		 (forward-line 1))))
 	(when sort
-	  (sort-numeric-fields 1 (point-min) (point-max)))))))
+		   ;; something is seriously wrong as we simply shouldn't see out-of-order data.
+		   ;; First, we'll fix the sort.
+		   (sort-numeric-fields 1 (point-min) (point-max))
+
+		   ;; but now we have to consider that we may have duplicate rows...	  
+		   ;; so reset to beginning of file
+		   (goto-char (point-min))
+		   (setq last -134217728)
+	  
+		   ;; and throw a code that restarts this scan
+		   (throw 'problems t))
+		 nil))))))
 
 ;; Keeps the compiler from warning about the free variable in
 ;; gnus-agent-read-agentview.
@@ -1946,11 +1985,6 @@
            'gnus-agent-file-loading-cache
            'gnus-agent-read-agentview))))
 
-;; Save format may be either 1 or 2.  Two is the new, compressed
-;; format that is still being tested.  Format 1 is uncompressed but
-;; known to be reliable.
-(defconst gnus-agent-article-alist-save-format 2)
-
 (defun gnus-agent-read-agentview (file)
   "Load FILE and do a `read' there."
   (with-temp-buffer
@@ -1964,8 +1998,6 @@
               changed-version)
 
           (cond
-           ((< version 2)
-            (error "gnus-agent-read-agentview no longer supports version %d.  Stop gnus, manually evaluate gnus-agent-convert-to-compressed-agentview, then restart gnus." version))
            ((= version 0)
             (let ((inhibit-quit t)
                   entry)
@@ -1996,7 +2028,8 @@
                              (setq uncomp (cons (cons article-id state) uncomp)))
                            sequence)))
                alist)
-              (setq alist (sort uncomp 'car-less-than-car)))))
+		(setq alist (sort uncomp 'car-less-than-car)))
+	      (setq changed-version (not (= 2 gnus-agent-article-alist-save-format)))))
           (when changed-version
             (let ((gnus-agent-article-alist alist))
               (gnus-agent-save-alist gnus-agent-read-agentview)))
@@ -2110,7 +2143,7 @@
               ;; NOTE: The '+ 0' ensure that min and max are both numerics.
               (set group (cons (+ 0 min) (+ 0 max))))
           (error
-           (gnus-message 3 "Warning - invalid agent local: %s on line %d: "
+           (gnus-message 3 "Warning - invalid agent local: %s on line %d: %s"
                          file line (error-message-string err))))
         (forward-line 1)
         (setq line (1+ line))))
@@ -2141,13 +2174,14 @@
 				((member (symbol-name symbol) '("+dirty" "+method"))
 				 nil)
 				(t
+				 (let ((range (symbol-value symbol)))
+				   (when range
 				 (prin1 symbol)
-				 (let ((range (symbol-value symbol)))
 				   (princ " ")
 				   (princ (car range))
 				   (princ " ")
 				   (princ (cdr range))
-				   (princ "\n")))))
+				     (princ "\n"))))))
 			my-obarray))))))))
 
 (defun gnus-agent-get-local (group &optional gmane method)
@@ -2402,7 +2436,9 @@
                         (dolist (article marked-articles)
                           (gnus-summary-set-agent-mark article t))
                         (dolist (article fetched-articles)
-                          (if gnus-agent-mark-unread-after-downloaded
+                          (when gnus-agent-mark-unread-after-downloaded
+			    (setq gnus-newsgroup-downloadable
+				  (delq article gnus-newsgroup-downloadable))
                               (gnus-summary-mark-article
 			       article gnus-unread-mark))
                           (when (gnus-summary-goto-subject article nil t)
@@ -3191,7 +3227,7 @@
 	       ((setq type
 		      (cond
 		       ((not (integerp fetch-date))
-			'read) ;; never fetched article (may expire
+			 'read)	;; never fetched article (may expire
 		       ;; right now)
 		       ((not (file-exists-p
 			      (concat dir (number-to-string
@@ -3871,8 +3907,9 @@
                 (gnus-agent-possibly-alter-active group group-active)))))
 
         (when (and reread gnus-agent-article-alist)
-          (gnus-make-ascending-articles-unread
+	(gnus-agent-synchronize-group-flags 
            group
+	 (list (list
            (if (listp reread)
                reread
              (delq nil (mapcar (function (lambda (c)
@@ -3880,7 +3917,9 @@
                                                   (car c))
                                                  ((cdr c)
                                                   (car c)))))
-                               gnus-agent-article-alist))))
+				    gnus-agent-article-alist)))
+		'del '(read)))
+	 gnus-command-method)
 
           (when (gnus-buffer-live-p gnus-group-buffer)
             (gnus-group-update-group group t)))
--- a/lisp/gnus/gnus-art.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/gnus/gnus-art.el	Sun Dec 11 22:42:40 2005 +0000
@@ -535,7 +535,8 @@
 		(function-item gnus-summary-save-in-file)
 		(function-item gnus-summary-save-body-in-file)
 		(function-item gnus-summary-save-in-vm)
-		(function-item gnus-summary-write-to-file)))
+		(function-item gnus-summary-write-to-file)
+		(function)))
 
 (defcustom gnus-rmail-save-name 'gnus-plain-save-name
   "A function generating a file name to save articles in Rmail format.
--- a/lisp/gnus/gnus-cache.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/gnus/gnus-cache.el	Sun Dec 11 22:42:40 2005 +0000
@@ -730,9 +730,11 @@
 
 ;;;###autoload
 (defun gnus-cache-rename-group (old-group new-group)
-  "Rename OLD-GROUP as NEW-GROUP.  Always updates the cache, even when
-disabled, as the old cache files would corrupt gnus when the cache was
-next enabled. Depends upon the caller to determine whether group renaming is supported."
+  "Rename OLD-GROUP as NEW-GROUP.
+Always updates the cache, even when disabled, as the old cache
+files would corrupt Gnus when the cache was next enabled.  It
+depends on the caller to determine whether group renaming is
+supported."
   (let ((old-dir (gnus-cache-file-name old-group ""))
 	(new-dir (gnus-cache-file-name new-group "")))
     (gnus-rename-file old-dir new-dir t))
@@ -740,9 +742,12 @@
   (let ((no-save gnus-cache-active-hashtb))
     (unless gnus-cache-active-hashtb
       (gnus-cache-read-active))
-    (let* ((old-group-hash-value (gnus-gethash old-group gnus-cache-active-hashtb))
-	   (new-group-hash-value (gnus-gethash new-group gnus-cache-active-hashtb))
-	   (delta                (or old-group-hash-value new-group-hash-value)))
+    (let* ((old-group-hash-value
+	    (gnus-gethash old-group gnus-cache-active-hashtb))
+	   (new-group-hash-value
+	    (gnus-gethash new-group gnus-cache-active-hashtb))
+	   (delta
+	    (or old-group-hash-value new-group-hash-value)))
       (gnus-sethash new-group old-group-hash-value gnus-cache-active-hashtb)
       (gnus-sethash old-group nil gnus-cache-active-hashtb)
 
@@ -752,9 +757,11 @@
 
 ;;;###autoload
 (defun gnus-cache-delete-group (group)
-  "Delete GROUP.  Always updates the cache, even when
-disabled, as the old cache files would corrupt gnus when the cache was
-next enabled. Depends upon the caller to determine whether group deletion is supported."
+  "Delete GROUP from the cache.
+Always updates the cache, even when disabled, as the old cache
+files would corrupt gnus when the cache was next enabled.
+Depends upon the caller to determine whether group deletion is
+supported."
   (let ((dir (gnus-cache-file-name group "")))
     (gnus-delete-directory dir))
 
--- a/lisp/gnus/gnus-start.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/gnus/gnus-start.el	Sun Dec 11 22:42:40 2005 +0000
@@ -858,6 +858,7 @@
       (set-buffer (setq gnus-dribble-buffer
 			(gnus-get-buffer-create
 			 (file-name-nondirectory dribble-file))))
+      (set (make-local-variable 'file-precious-flag) t)
       (erase-buffer)
       (setq buffer-file-name dribble-file)
       (auto-save-mode t)
--- a/lisp/gnus/imap.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/gnus/imap.el	Sun Dec 11 22:42:40 2005 +0000
@@ -591,6 +591,13 @@
 	    (while (and (memq (process-status process) '(open run))
 			(set-buffer buffer) ;; XXX "blue moon" nntp.el bug
 			(goto-char (point-min))
+			;; Athena IMTEST can output SSL verify errors
+			(or (while (looking-at "^verify error:num=")
+			      (forward-line))
+			    t)
+			(or (while (looking-at "^TLS connection established")
+			      (forward-line))
+			    t)
 			;; cyrus 1.6.x (13? < x <= 22) queries capabilities
 			(or (while (looking-at "^C:")
 			      (forward-line))
--- a/lisp/gnus/mm-decode.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/gnus/mm-decode.el	Sun Dec 11 22:42:40 2005 +0000
@@ -335,8 +335,11 @@
 somewhat unwanted, then the value of this variable should be set
 to:
 
- (\"text/html\" \"text/richtext\")"
-  :type '(repeat string)
+ (\"text/html\" \"text/richtext\")
+
+Adding \"image/.*\" might also be useful.  Spammers use it as the
+prefered part of multipart/alternative messages."
+  :type '(repeat regexp) ;; See `mm-preferred-alternative-precedence'.
   :group 'mime-display)
 
 (defcustom mm-tmp-directory
@@ -761,7 +764,19 @@
 			  (gnus-map-function mm-file-name-rewrite-functions
 					     (file-name-nondirectory filename))
 			  dir))
-	    (setq file (mm-make-temp-file (expand-file-name "mm." dir))))
+	    (setq file (mm-make-temp-file (expand-file-name "mm." dir)))
+	    (let ((newname
+		   ;; Use nametemplate (defined in RFC1524) if it is
+		   ;; specified in mailcap.
+		   (if (assoc "nametemplate" mime-info)
+		       (format (assoc "nametemplate" mime-info) file)
+		     ;; Add a suffix according to `mailcap-mime-extensions'.
+		     (concat file (car (rassoc (mm-handle-media-type handle)
+					       mailcap-mime-extensions))))))
+	      (unless (string-equal file newname)
+		(when (file-exists-p file)
+		  (rename-file file newname))
+		(setq file newname))))
 	  (let ((coding-system-for-write mm-binary-coding-system))
 	    (write-region (point-min) (point-max) file nil 'nomesg))
 	  (message "Viewing with %s" method)
@@ -819,6 +834,9 @@
 		   (ignore-errors (kill-buffer buffer))))))
 	    'inline)
 	   (t
+	    ;; Deleting the temp file should be postponed for some wrappers,
+	    ;; shell scripts, and so on, which might exit right after having
+	    ;; started a viewer command as a background job.
 	    (let ((command (mm-mailcap-command
 			    method file (mm-handle-type handle))))
 	      (unwind-protect
@@ -830,24 +848,38 @@
 				   shell-command-switch command)
 		    (set-process-sentinel
 		     (get-buffer-process buffer)
-		     `(lambda (process state)
-			(when (eq 'exit (process-status process))
-			  ;; Don't use `ignore-errors'.
-			  (condition-case nil
-			      (delete-file ,file)
-			    (error))
-			  (condition-case nil
-			      (delete-directory ,(file-name-directory file))
-			    (error))
-			  (condition-case nil
-			      (kill-buffer ,buffer)
-			    (error))
-			  (condition-case nil
-			      ,(macroexpand (list 'mm-handle-set-undisplayer
-						  (list 'quote handle)
-						  nil))
-			    (error))
-			  (message "Displaying %s...done" ,command)))))
+		     (lexical-let ;; Don't use `let'.
+			 ;; Function used to remove temp file and directory.
+			 ((fn `(lambda nil
+				 ;; Don't use `ignore-errors'.
+				 (condition-case nil
+				     (delete-file ,file)
+				   (error))
+				 (condition-case nil
+				     (delete-directory
+				      ,(file-name-directory file))
+				   (error))))
+			  ;; Form uses to kill the process buffer and
+			  ;; remove the undisplayer.
+			  (fm `(progn
+				 (kill-buffer ,buffer)
+				 ,(macroexpand
+				   (list 'mm-handle-set-undisplayer
+					 (list 'quote handle)
+					 nil))))
+			  ;; Message to be issued when the process exits.
+			  (done (format "Displaying %s...done" command))
+			  ;; In particular, the timer object (which is
+			  ;; a vector in Emacs but is a list in XEmacs)
+			  ;; requires that it is lexically scoped.
+			  (timer (run-at-time 2.0 nil 'ignore)))
+		       (lambda (process state)
+			 (when (eq 'exit (process-status process))
+			   (if (memq timer timer-list)
+			       (timer-set-function timer fn)
+			     (funcall fn))
+			   (ignore-errors (eval fm))
+			   (message "%s" done))))))
 		(mm-handle-set-external-undisplayer
 		 handle (cons file buffer)))
 	      (message "Displaying %s..." command))
--- a/lisp/gnus/mm-view.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/gnus/mm-view.el	Sun Dec 11 22:42:40 2005 +0000
@@ -250,19 +250,19 @@
 	   (point-min) (point-max)
 	   (list 'keymap w3m-minor-mode-map
 		 ;; Put the mark meaning this part was rendered by emacs-w3m.
-		 'mm-inline-text-html-with-w3m t))))
-      (mm-handle-set-undisplayer
-       handle
-       `(lambda ()
-	  (let (buffer-read-only)
-	    (if (functionp 'remove-specifier)
-		(mapcar (lambda (prop)
-			  (remove-specifier
-			   (face-property 'default prop)
-			   (current-buffer)))
-			'(background background-pixmap foreground)))
-	    (delete-region ,(point-min-marker)
-			   ,(point-max-marker))))))))
+		 'mm-inline-text-html-with-w3m t)))
+	(mm-handle-set-undisplayer
+	 handle
+	 `(lambda ()
+	    (let (buffer-read-only)
+	      (if (functionp 'remove-specifier)
+		  (mapcar (lambda (prop)
+			    (remove-specifier
+			     (face-property 'default prop)
+			     (current-buffer)))
+			  '(background background-pixmap foreground)))
+	      (delete-region ,(point-min-marker)
+			     ,(point-max-marker)))))))))
 
 (defun mm-links-remove-leading-blank ()
   ;; Delete the annoying three spaces preceding each line of links
--- a/lisp/gnus/nnmail.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/gnus/nnmail.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1872,9 +1872,15 @@
 	 (case-fold-search nil)
 	 (from (or (message-fetch-field "from") ""))
 	 (to (or (message-fetch-field "to") ""))
-	 (date (date-to-time
-		(or (message-fetch-field "date") (current-time-string))))
+	 (date (message-fetch-field "date"))
 	 (target 'delete))
+    (setq date (if date
+		   (condition-case err
+		       (date-to-time date)
+		     (error
+		      (message "%s" (error-message-string err))
+		      (current-time)))
+		 (current-time)))
     (dolist (regexp-target-pair (reverse nnmail-fancy-expiry-targets) target)
       (setq header (car regexp-target-pair))
       (cond
--- a/lisp/gnus/nntp.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/gnus/nntp.el	Sun Dec 11 22:42:40 2005 +0000
@@ -102,7 +102,7 @@
 (defvoo nntp-end-of-line "\r\n"
   "*String to use on the end of lines when talking to the NNTP server.
 This is \"\\r\\n\" by default, but should be \"\\n\" when
-using and indirect connection method (nntp-open-via-*).")
+using an indirect connection method (nntp-open-via-*).")
 
 (defvoo nntp-via-rlogin-command "rsh"
   "*Rlogin command used to connect to an intermediate host.
@@ -259,6 +259,13 @@
 port number on server.  The program should accept IMAP commands on
 stdin and return responses to stdout.")
 
+(defvar nntp-authinfo-rejected nil
+"A custom error condition used to report 'Authentication Rejected' errors.  
+Condition handlers that match just this condition ensure that the nntp 
+backend doesn't catch this error.")
+(put 'nntp-authinfo-rejected 'error-conditions '(error nntp-authinfo-rejected))
+(put 'nntp-authinfo-rejected 'error-message "Authorization Rejected")
+
 
 
 ;;; Internal functions.
@@ -313,12 +320,15 @@
     (set-buffer (process-buffer process))
     (goto-char (point-min))
     (while (and (or (not (memq (char-after (point)) '(?2 ?3 ?4 ?5)))
-		    (looking-at "480"))
+		    (looking-at "48[02]"))
 		(memq (process-status process) '(open run)))
-      (when (looking-at "480")
+      (cond ((looking-at "480")
 	(nntp-handle-authinfo process))
-      (when (looking-at "^.*\n")
-	(delete-region (point) (progn (forward-line 1) (point))))
+	    ((looking-at "482")
+	     (nnheader-report 'nntp (get 'nntp-authinfo-rejected 'error-message))
+	     (signal 'nntp-authinfo-rejected nil))
+	    ((looking-at "^.*\n")
+	     (delete-region (point) (progn (forward-line 1) (point)))))
       (nntp-accept-process-output process)
       (goto-char (point-min)))
     (prog1
@@ -411,6 +421,8 @@
                  (wait-for
                   (nntp-wait-for process wait-for buffer decode))
                  (t t)))
+	    (nntp-authinfo-rejected
+	     (signal 'nntp-authinfo-rejected (cdr err)))
             (error
              (nnheader-report 'nntp "Couldn't open connection to %s: %s"
                               address err))
--- a/lisp/gnus/rfc2231.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/gnus/rfc2231.el	Sun Dec 11 22:42:40 2005 +0000
@@ -127,7 +127,17 @@
 		       (> c ?\177)) ;; EXTENSION: Support non-ascii chars.
 		   (not (memq c stoken)))
 	      (setq value (buffer-substring
-			   (point) (progn (forward-sexp) (point)))))
+			   (point)
+			   (progn
+			     (forward-sexp)
+			     ;; We might not have reached at the end of
+			     ;; the value because of non-ascii chars,
+			     ;; so we should jump over them if any.
+			     (while (and (not (eobp))
+					 (> (char-after) ?\177))
+			       (forward-char 1)
+			       (forward-sexp))
+			     (point)))))
 	     (t
 	      (error "Invalid header: %s" string)))
 	    (if number
--- a/lisp/help.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/help.el	Sun Dec 11 22:42:40 2005 +0000
@@ -178,7 +178,7 @@
 (defalias 'help-for-help 'help-for-help-internal)
 ;; It can't find this, but nobody will look.
 (make-help-screen help-for-help-internal
-  "a b c C e f F i I k C-k l L m p s t v w C-c C-d C-f C-n C-p C-t C-w . or ? :"
+  "a b c C e f F i I k C-k l L m p r s t v w C-c C-d C-f C-n C-p C-t C-w . or ? :"
   "You have typed %THIS-KEY%, the help character.  Type a Help option:
 \(Use SPC or DEL to scroll through this text.  Type \\<help-map>\\[help-quit] to exit the Help command.)
 
@@ -217,6 +217,7 @@
 	and the current major mode, including their special commands.
 n  view-emacs-news.  Display news of recent Emacs changes.
 p  finder-by-keyword. Find packages matching a given topic keyword.
+r  info-emacs-manual.  Display the Emacs manual in Info mode.
 s  describe-syntax.  Display contents of syntax table, plus explanations.
 S  info-lookup-symbol.  Display the definition of a specific symbol
         as found in the manual for the language this buffer is written in.
--- a/lisp/hi-lock.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/hi-lock.el	Sun Dec 11 22:42:40 2005 +0000
@@ -58,7 +58,7 @@
 ;;    hi-lock mode and adds a "Regexp Highlighting" entry
 ;;    to the edit menu.
 ;;
-;;    (hi-lock-mode 1)
+;;    (global-hi-lock-mode 1)
 ;;
 ;;    You might also want to bind the hi-lock commands to more
 ;;    finger-friendly sequences:
@@ -188,6 +188,17 @@
 (defvar hi-lock-file-patterns-prefix "Hi-lock"
   "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
+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
+a library is being loaded.")
+
 (make-variable-buffer-local 'hi-lock-interactive-patterns)
 (put 'hi-lock-interactive-patterns 'permanent-local t)
 (make-variable-buffer-local 'hi-lock-regexp-history)
@@ -238,13 +249,15 @@
 
 
 ;;;###autoload
-(define-minor-mode hi-lock-buffer-mode
+(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.  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:
+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:
 
 \\[highlight-regexp] REGEXP FACE
   Highlight matches of pattern REGEXP in current buffer with FACE.
@@ -283,7 +296,24 @@
   :lighter " H"
   :global nil
   :keymap hi-lock-map
-  (if hi-lock-buffer-mode
+  (when (and (equal (buffer-name) "*scratch*")
+             load-in-progress
+             (not (interactive-p))
+             (not hi-lock-archaic-interface-message-used))
+    (setq hi-lock-archaic-interface-message-used t)
+    (if hi-lock-archaic-interface-deduce
+        (global-hi-lock-mode hi-lock-mode)
+      (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
+versions before 22 use the following in your .emacs file:
+
+        (if (functionp 'global-hi-lock-mode)
+            (global-hi-lock-mode 1)
+          (hi-lock-mode 1))
+")))
+  (if hi-lock-mode
       ;; Turned on.
       (progn
 	(unless font-lock-mode (font-lock-mode 1))
@@ -294,7 +324,7 @@
     ;; Turned off.
     (when (or hi-lock-interactive-patterns
 	      hi-lock-file-patterns)
-      (when hi-lock-interactive-patterns 
+      (when hi-lock-interactive-patterns
 	(font-lock-remove-keywords nil hi-lock-interactive-patterns)
 	(setq hi-lock-interactive-patterns nil))
       (when hi-lock-file-patterns
@@ -306,13 +336,14 @@
     (remove-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook t)))
 
 ;;;###autoload
-(define-global-minor-mode hi-lock-mode
-  hi-lock-buffer-mode turn-on-hi-lock-if-enabled
+(define-global-minor-mode global-hi-lock-mode
+  hi-lock-mode turn-on-hi-lock-if-enabled
   :group 'hi-lock)
-  
+
 (defun turn-on-hi-lock-if-enabled ()
+  (setq hi-lock-archaic-interface-message-used t)
   (unless (memq major-mode hi-lock-exclude-modes)
-    (hi-lock-buffer-mode 1)))
+    (hi-lock-mode 1)))
 
 ;;;###autoload
 (defalias 'highlight-lines-matching-regexp 'hi-lock-line-face-buffer)
@@ -332,7 +363,7 @@
                            nil nil 'hi-lock-regexp-history))
     (hi-lock-read-face-name)))
   (or (facep face) (setq face 'hi-yellow))
-  (unless hi-lock-buffer-mode (hi-lock-buffer-mode 1))
+  (unless hi-lock-mode (hi-lock-mode 1))
   (hi-lock-set-pattern
    ;; The \\(?:...\\) grouping construct ensures that a leading ^, +, * or ?
    ;; or a trailing $ in REGEXP will be interpreted correctly.
@@ -357,7 +388,7 @@
                            nil nil 'hi-lock-regexp-history))
     (hi-lock-read-face-name)))
   (or (facep face) (setq face 'hi-yellow))
-  (unless hi-lock-buffer-mode (hi-lock-buffer-mode 1))
+  (unless hi-lock-mode (hi-lock-mode 1))
   (hi-lock-set-pattern regexp face))
 
 ;;;###autoload
@@ -377,7 +408,7 @@
                             nil nil 'hi-lock-regexp-history)))
     (hi-lock-read-face-name)))
   (or (facep face) (setq face 'hi-yellow))
-  (unless hi-lock-buffer-mode (hi-lock-buffer-mode 1))
+  (unless hi-lock-mode (hi-lock-mode 1))
   (hi-lock-set-pattern regexp face))
 
 ;;;###autoload
@@ -535,7 +566,7 @@
                 (setq all-patterns (append (read (current-buffer)) all-patterns))
               (error (message "Invalid pattern list expression at %d"
                               (line-number-at-pos)))))))
-      (when hi-lock-buffer-mode (hi-lock-set-file-patterns all-patterns))
+      (when hi-lock-mode (hi-lock-set-file-patterns all-patterns))
       (if (interactive-p)
         (message "Hi-lock added %d patterns." (length all-patterns))))))
 
@@ -544,7 +575,7 @@
   (if font-lock-mode
       (progn (font-lock-add-keywords nil hi-lock-file-patterns)
 	     (font-lock-add-keywords nil hi-lock-interactive-patterns))
-    (hi-lock-buffer-mode -1)))
+    (hi-lock-mode -1)))
 
 (provide 'hi-lock)
 
--- a/lisp/ibuf-ext.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/ibuf-ext.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1021,10 +1021,12 @@
   (ibuffer-awhen (with-current-buffer buf
 		   (or buffer-file-name
 		       (and (boundp 'dired-directory)
-			    (if (stringp dired-directory)
-				dired-directory
-			      (car dired-directory))
-			    (expand-file-name dired-directory))))
+			    (let ((dired-dir
+				   (if (stringp dired-directory)
+				       dired-directory
+				     (car dired-directory))))
+			      (and dired-dir
+				   (expand-file-name dired-dir))))))
     (string-match qualifier it)))
 
 ;;;###autoload (autoload 'ibuffer-filter-by-size-gt  "ibuf-ext")
--- a/lisp/ido.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/ido.el	Sun Dec 11 22:42:40 2005 +0000
@@ -24,45 +24,6 @@
 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 ;; Boston, MA 02110-1301, USA.
 
-;;; Acknowledgements
-
-;; Infinite amounts of gratitude goes to Stephen Eglen <stephen@cns.ed.ac.uk>
-;; who wrote iswitch-buffer mode - from which I ripped off 99% of the code
-;; for ido-switch-buffer and found the inspiration for ido-find-file.
-;; The ido package would never have existed without his work.
-
-;; Also thanks to Klaus Berndl, Rohit Namjoshi, Robert Fenk, Alex
-;; Schroeder, Bill Benedetto, Stephen Eglen, and many others for bug
-;; fixes and improvements.
-
-;;; History
-
-;; Since I discovered Stephen Eglen's excellent iswitchb package, I just
-;; couldn't live without it, but once being addicted to switching buffers
-;; with a minimum of keystrokes, I soon found that opening files in the
-;; old-fashioned way was just too slow - so I decided to write a package
-;; which could open files with the same speed and ease as iswitchb could
-;; switch buffers.
-
-;; I originally wrote a separate ifindf.el package based on a copy of
-;; iswitchb.el, which did for opening files what iswitchb did for
-;; switching buffers.  Along the way, I corrected a few errors in
-;; ifindf which could have found its way back into iswitchb, but since
-;; most of the functionality of the two package was practically
-;; identical, I decided that the proper thing to do was to merge my
-;; ifindf package back into iswitchb.
-;;
-;; This is basically what ido (interactively do) is all about; but I
-;; found it ackward to merge my changes into the "iswitchb-" namespace,
-;; so I invented a common "ido-" namespace for the merged packages.
-;;
-;; This version is based on ido.el version 1.57 released on
-;; gnu.emacs.sources adapted for emacs 22.1 to use command remapping
-;; and optionally hooking the read-buffer and read-file-name functions.
-;;
-;; Prefix matching was added by Klaus Berndl <klaus.berndl@sdm.de> based on
-;; an idea of Yuji Minejima <ggb01164@nifty.ne.jp> and his mcomplete-package.
-
 
 ;;; Commentary:
 
@@ -94,10 +55,10 @@
 ;; most recent, when I use ido-switch-buffer, I first of all get
 ;; presented with the list of all the buffers
 ;;
-;;       Buffer:  {123456,123}
+;;       Buffer: {123456 | 123}
 ;;
 ;; If I then press 2:
-;;       Buffer: 2[3]{123456,123}
+;;       Buffer: 2[3]{123456 | 123}
 ;;
 ;; The list in {...} are the matching buffers, most recent first
 ;; (buffers visible in the current frame are put at the end of the
@@ -110,7 +71,7 @@
 ;; pressing TAB.  In this case, I will get "3" added to my input.
 
 ;; So, I press TAB:
-;;	 Buffer: 23{123456,123}
+;;	 Buffer: 23{123456 | 123}
 ;;
 ;; At this point, I still have two matching buffers.
 ;; If I want the first buffer in the list, I simply press RET.  If I
@@ -118,13 +79,16 @@
 ;; top of the list and then RET to select it.
 ;;
 ;; However, if I type 4, I only have one match left:
-;;       Buffer: 234[123456] [Matched]
+;;       Buffer: 234[123456]
 ;;
-;; Since there is only one matching buffer left, it is given in [] and we
-;; see the text [Matched] afterwards.  I can now press TAB or RET to go
-;; to that buffer.
+;; Since there is only one matching buffer left, it is given in [] and
+;; it is shown in the `ido-only-match' face (ForestGreen).  I can now
+;; press TAB or RET to go to that buffer.
 ;;
-;; If however, I now type "a":
+;; If I want to create a new buffer named "234", I press C-j instead of
+;; TAB or RET.
+;;
+;; If instead, I type "a":
 ;;       Buffer: 234a [No match]
 ;; There are no matching buffers.  If I press RET or TAB, I can be
 ;; prompted to create a new buffer called "234a".
@@ -318,6 +282,45 @@
 ;; can be used by other packages to read a buffer name, a file name,
 ;; or a directory name in the `ido' way.
 
+;;; Acknowledgements
+
+;; Infinite amounts of gratitude goes to Stephen Eglen <stephen@cns.ed.ac.uk>
+;; who wrote iswitch-buffer mode - from which I ripped off 99% of the code
+;; for ido-switch-buffer and found the inspiration for ido-find-file.
+;; The ido package would never have existed without his work.
+
+;; Also thanks to Klaus Berndl, Rohit Namjoshi, Robert Fenk, Alex
+;; Schroeder, Bill Benedetto, Stephen Eglen, and many others for bug
+;; fixes and improvements.
+
+;;; History
+
+;; Since I discovered Stephen Eglen's excellent iswitchb package, I just
+;; couldn't live without it, but once being addicted to switching buffers
+;; with a minimum of keystrokes, I soon found that opening files in the
+;; old-fashioned way was just too slow - so I decided to write a package
+;; which could open files with the same speed and ease as iswitchb could
+;; switch buffers.
+
+;; I originally wrote a separate ifindf.el package based on a copy of
+;; iswitchb.el, which did for opening files what iswitchb did for
+;; switching buffers.  Along the way, I corrected a few errors in
+;; ifindf which could have found its way back into iswitchb, but since
+;; most of the functionality of the two package was practically
+;; identical, I decided that the proper thing to do was to merge my
+;; ifindf package back into iswitchb.
+;;
+;; This is basically what ido (interactively do) is all about; but I
+;; found it ackward to merge my changes into the "iswitchb-" namespace,
+;; so I invented a common "ido-" namespace for the merged packages.
+;;
+;; This version is based on ido.el version 1.57 released on
+;; gnu.emacs.sources adapted for emacs 22.1 to use command remapping
+;; and optionally hooking the read-buffer and read-file-name functions.
+;;
+;; Prefix matching was added by Klaus Berndl <klaus.berndl@sdm.de> based on
+;; an idea of Yuji Minejima <ggb01164@nifty.ne.jp> and his mcomplete-package.
+
 
 ;;; Code:
 
--- a/lisp/info.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/info.el	Sun Dec 11 22:42:40 2005 +0000
@@ -3071,6 +3071,7 @@
   (define-key Info-mode-map " " 'Info-scroll-up)
   (define-key Info-mode-map "\C-m" 'Info-follow-nearest-node)
   (define-key Info-mode-map "\t" 'Info-next-reference)
+  (define-key Info-mode-map "\e\t" 'Info-prev-reference)
   (define-key Info-mode-map [(shift tab)] 'Info-prev-reference)
   (define-key Info-mode-map [backtab] 'Info-prev-reference)
   (define-key Info-mode-map "1" 'Info-nth-menu-item)
--- a/lisp/international/ucs-tables.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/international/ucs-tables.el	Sun Dec 11 22:42:40 2005 +0000
@@ -2499,8 +2499,8 @@
 ;; normal-mode and minibuffer-setup-hook.
 (defun ucs-set-table-for-input (&optional buffer)
   "Set up an appropriate `translation-table-for-input' for BUFFER.
-BUFFER defaults to the current buffer.
-This function is automatically called directly at the end of `get-buffer-create'."
+BUFFER defaults to the current buffer.  This function is
+automatically called directly at the end of `get-buffer-create'."
   (when (and unify-8859-on-encoding-mode
              (not unify-8859-on-decoding-mode)
 	     (char-table-p translation-table-for-input))
--- a/lisp/isearch.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/isearch.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1809,6 +1809,8 @@
    ((eq   char ?|)       (isearch-fallback t nil t)))
 
   ;; Append the char to the search string, update the message and re-search.
+  (if (char-table-p translation-table-for-input)
+      (setq char (or (aref translation-table-for-input char) char)))
   (isearch-process-search-string
    (char-to-string char)
    (if (>= char ?\200)
@@ -2235,17 +2237,15 @@
 (defvar isearch-overlay nil)
 
 (defun isearch-highlight (beg end)
-  (unless (null search-highlight)
-    (cond (isearch-overlay
-	   ;; Overlay already exists, just move it.
-	   (move-overlay isearch-overlay beg end (current-buffer)))
-
-	  (t
-	   ;; Overlay doesn't exist, create it.
-	   (setq isearch-overlay (make-overlay beg end))
-	   (overlay-put isearch-overlay 'face isearch)
-           (overlay-put isearch-overlay 'priority 1) ;higher than lazy overlays
-           ))))
+  (if search-highlight
+      (if isearch-overlay
+	  ;; Overlay already exists, just move it.
+	  (move-overlay isearch-overlay beg end (current-buffer))
+	;; Overlay doesn't exist, create it.
+	(setq isearch-overlay (make-overlay beg end))
+	;; 1001 is higher than lazy's 1000 and ediff's 100+
+	(overlay-put isearch-overlay 'priority 1001)
+	(overlay-put isearch-overlay 'face isearch))))
 
 (defun isearch-dehighlight ()
   (when isearch-overlay
@@ -2409,8 +2409,10 @@
 			;; non-zero-length match
 			(let ((ov (make-overlay mb me)))
 			  (push ov isearch-lazy-highlight-overlays)
+			  ;; 1000 is higher than ediff's 100+,
+			  ;; but lower than isearch main overlay's 1001
+			  (overlay-put ov 'priority 1000)
 			  (overlay-put ov 'face lazy-highlight-face)
-			  (overlay-put ov 'priority 0) ;lower than main overlay
 			  (overlay-put ov 'window (selected-window))))
 		      (if isearch-forward
 			  (setq isearch-lazy-highlight-end (point))
--- a/lisp/locate.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/locate.el	Sun Dec 11 22:42:40 2005 +0000
@@ -229,7 +229,8 @@
     (save-window-excursion
       (set-buffer (get-buffer-create locate-buffer-name))
       (locate-mode)
-      (let ((inhibit-read-only t))
+      (let ((inhibit-read-only t)
+	    (buffer-undo-list t))
 	(erase-buffer)
 
 	(setq locate-current-filter filter)
--- a/lisp/mail/mail-extr.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/mail/mail-extr.el	Sun Dec 11 22:42:40 2005 +0000
@@ -699,9 +699,10 @@
 ;;;###autoload
 (defun mail-extract-address-components (address &optional all)
   "Given an RFC-822 address ADDRESS, extract full name and canonical address.
-Returns a list of the form (FULL-NAME CANONICAL-ADDRESS).
-If no name can be extracted, FULL-NAME will be nil.  Also see
-`mail-extr-ignore-single-names' and `mail-extr-ignore-realname-equals-mailbox-name'.
+Returns a list of the form (FULL-NAME CANONICAL-ADDRESS).  If no
+name can be extracted, FULL-NAME will be nil.  Also see
+`mail-extr-ignore-single-names' and
+`mail-extr-ignore-realname-equals-mailbox-name'.
 
 If the optional argument ALL is non-nil, then ADDRESS can contain zero
 or more recipients, separated by commas, and we return a list of
--- a/lisp/mail/rmail.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/mail/rmail.el	Sun Dec 11 22:42:40 2005 +0000
@@ -3155,13 +3155,18 @@
 	search-regexp found)
     (if (string-match "\\`[ \t]+" subject)
 	(setq subject (substring subject (match-end 0))))
-    (if (string-match "Re:[ \t]*" subject)
+    (if (string-match "\\`\\(Re:[ \t]*\\)+" subject)
 	(setq subject (substring subject (match-end 0))))
     (if (string-match "[ \t]+\\'" subject)
 	(setq subject (substring subject 0 (match-beginning 0))))
-    (setq search-regexp (concat "^Subject: *\\(Re:[ \t]*\\)?"
-				(regexp-quote subject)
-				"[ \t]*\n"))
+    ;; If Subject is long, mailers will break it into several lines at
+    ;; arbitrary places, so replace whitespace with a regexp that will
+    ;; match any sequence of spaces, TABs, and newlines.
+    (setq subject (regexp-quote subject))
+    (setq subject
+	  (replace-regexp-in-string "[ \t\n]+" "[ \t\n]+" subject t t))
+    (setq search-regexp (concat "^Subject: *\\(Re:[ \t]*\\)*"
+				subject "[ \t]*\n"))
     (save-excursion
       (save-restriction
 	(widen)
--- a/lisp/mail/sendmail.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/mail/sendmail.el	Sun Dec 11 22:42:40 2005 +0000
@@ -596,7 +596,10 @@
 (define-derived-mode mail-mode text-mode "Mail"
   "Major mode for editing mail to be sent.
 Like Text Mode but with these additional commands:
-\\[mail-send]  mail-send (send the message)    \\[mail-send-and-exit]  mail-send-and-exit
+
+\\[mail-send]  mail-send (send the message)
+\\[mail-send-and-exit]  mail-send-and-exit (send the message and exit)
+
 Here are commands that move to a header field (and create it if there isn't):
 	 \\[mail-to]  move to To:	\\[mail-subject]  move to Subject:
 	 \\[mail-cc]  move to CC:	\\[mail-bcc]  move to BCC:
--- a/lisp/mail/smtpmail.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/mail/smtpmail.el	Sun Dec 11 22:42:40 2005 +0000
@@ -605,6 +605,7 @@
 
 	  ;; clear the trace buffer of old output
 	  (with-current-buffer process-buffer
+	    (setq buffer-undo-list t)
 	    (erase-buffer))
 
 	  ;; open the connection to the server
--- a/lisp/menu-bar.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/menu-bar.el	Sun Dec 11 22:42:40 2005 +0000
@@ -481,7 +481,7 @@
 	      :enable (and (not buffer-read-only)
 			   (not (eq t buffer-undo-list))
 			   (if (eq last-command 'undo)
-			       pending-undo-list
+			       (listp pending-undo-list)
 			     (consp buffer-undo-list)))
 	      :help "Undo last operation"))
 
--- a/lisp/mh-e/ChangeLog	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/mh-e/ChangeLog	Sun Dec 11 22:42:40 2005 +0000
@@ -1,3 +1,12 @@
+2005-12-09  Bill Wohler  <wohler@newt.com>
+
+	* mh-customize.el (mh-path): Move here from mh-init.el.
+	(mh-variant): Mention that mh-path can be customized.
+	(mh-invisible-header-fields-internal): Add X-ContentStamp,
+	X-MAIL-INFO, and X-UNTD- from NetZero.
+
+	* mh-init.el (mh-path): Move defcustom to mh-customize.el.
+
 2005-12-04  Bill Wohler  <wohler@newt.com>
 
 	* mh-customize.el (mh-sortm-args): Sync docstrings with manual.
--- a/lisp/mh-e/mh-customize.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/mh-e/mh-customize.el	Sun Dec 11 22:42:40 2005 +0000
@@ -260,15 +260,21 @@
 (eval-when (compile)
   (setq mh-variant 'none))
 
+(defcustom mh-path nil
+  "*Additional list of directories to search for MH.
+See `mh-variant'."
+  :group 'mh-e
+  :type '(repeat (directory)))
+
 (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', `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 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'
@@ -1421,6 +1427,7 @@
     "X-Bogosity:"                       ; bogofilter
     "X-Bugzilla-*"                      ; Bugzilla
     "X-Complaints-To:"
+    "X-ContentStamp:"                   ; NetZero
     "X-Cron-Env:"
     "X-DMCA"
     "X-Delivered"
@@ -1453,6 +1460,7 @@
     "X-Listprocessor-"                  ; ListProc(tm) by CREN
     "X-Listserver:"                     ; Unknown mailing list managers
     "X-Loop:"                           ; Unknown mailing list managers
+    "X-MAIL-INFO:"                      ; NetZero
     "X-MHE-Checksum"                    ; Checksum added during index search
     "X-MIME-Autoconverted:"             ; sendmail
     "X-MIMETrack:"
@@ -1506,6 +1514,7 @@
     "X-Trace:"
     "X-UID"
     "X-UIDL:"
+    "X-UNTD-"                           ; NetZero
     "X-USANET-"                         ; usa.net
     "X-UserInfo1:"
     "X-Virus-Scanned"                   ; amavisd-new
--- a/lisp/mh-e/mh-init.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/mh-e/mh-init.el	Sun Dec 11 22:42:40 2005 +0000
@@ -73,6 +73,31 @@
 ;;;###autoload
 (put 'mh-lib-progs 'risky-local-variable t)
 
+(defvar mh-variants nil
+  "List describing known MH variants.
+Created by the function `mh-variants'")
+
+;;;###mh-autoload
+(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'."
+  (if mh-variants
+      mh-variants
+    (let ((list-unique))
+      ;; Make a unique list of directories, keeping the given order.
+      ;; We don't want the same MH variant to be listed multiple times.
+      (loop for dir in (append mh-path mh-sys-path exec-path) do
+            (setq dir (file-chase-links (directory-file-name dir)))
+            (add-to-list 'list-unique dir))
+      (loop for dir in (nreverse list-unique) do
+            (when (and dir (file-directory-p dir) (file-readable-p dir))
+              (let ((variant (mh-variant-info dir)))
+                (if variant
+                    (add-to-list 'mh-variants variant)))))
+      mh-variants)))
+
 (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'.")
@@ -171,17 +196,6 @@
 There's no need for users to modify this list.  Instead add extra
 directories to the customizable variable `mh-path'.")
 
-(defcustom mh-path nil
-  "*List of directories to search for variants of the MH variant.
-The directories will be searched for `mhparam' in addition to directories
-listed in `mh-sys-path' and `exec-path'."
-  :group 'mh-e
-  :type '(repeat (directory)))
-
-(defvar mh-variants nil
-  "List describing known MH variants.
-Created by the function `mh-variants'")
-
 (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.
@@ -281,27 +295,6 @@
        ((mh-variant-nmh-info dir))
        ((mh-variant-mu-mh-info dir))))))
 
-;;;###mh-autoload
-(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'."
-  (if mh-variants
-      mh-variants
-    (let ((list-unique))
-      ;; Make a unique list of directories, keeping the given order.
-      ;; We don't want the same MH variant to be listed multiple times.
-      (loop for dir in (append mh-path mh-sys-path exec-path) do
-            (setq dir (file-chase-links (directory-file-name dir)))
-            (add-to-list 'list-unique dir))
-      (loop for dir in (nreverse list-unique) do
-            (when (and dir (file-directory-p dir) (file-readable-p dir))
-              (let ((variant (mh-variant-info dir)))
-                (if variant
-                    (add-to-list 'mh-variants variant)))))
-      mh-variants)))
-
 
 
 (defvar mh-image-load-path-called-flag nil)
--- a/lisp/pcvs.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/pcvs.el	Sun Dec 11 22:42:40 2005 +0000
@@ -775,6 +775,7 @@
 For interactive use, use `" (symbol-name fun) "' instead.")
 	     ,interact
 	     ,@body)
+	   (put ',fun-1 'definition-name ',fun)
 	   (defun ,fun ()
 	     ,(concat line1 "\nWrapper function that switches to a *cvs* buffer
 before calling the real function `" (symbol-name fun-1) "'.\n")
--- a/lisp/progmodes/gud.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/progmodes/gud.el	Sun Dec 11 22:42:40 2005 +0000
@@ -436,8 +436,7 @@
 If the GUD BUFFER is not running a supported debugger, then turn
 off the specialized speedbar mode.  BUFFER is not used, but are
 required by the caller."
-  (when (and (boundp 'gud-comint-buffer)
-	     gud-comint-buffer
+  (when (and gud-comint-buffer
 	     ;; gud-comint-buffer might be killed
 	     (buffer-name gud-comint-buffer))
     (let* ((minor-mode (with-current-buffer buffer gud-minor-mode))
@@ -661,6 +660,11 @@
 and source-file directory for your debugger."
   (interactive (list (gud-query-cmdline 'gdb)))
 
+  (if (and gud-comint-buffer
+	   (buffer-name gud-comint-buffer)
+	   (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)))
+      (error "Multiple debugging is only supported with \"gdb --fullname\""))
+				
   (gud-common-init command-line nil 'gud-gdb-marker-filter)
   (set (make-local-variable 'gud-minor-mode) 'gdb)
 
@@ -3217,10 +3221,50 @@
 ;;; tooltips for GUD
 
 ;;; Customizable settings
+
+;;;###autoload
+(define-minor-mode gud-tooltip-mode
+  "Toggle the display of GUD tooltips."
+  :global t
+  :group 'gud
+  :group 'tooltip
+  (require 'tooltip)
+  (if gud-tooltip-mode
+      (progn
+	(add-hook 'change-major-mode-hook 'gud-tooltip-change-major-mode)
+	(add-hook 'pre-command-hook 'tooltip-hide)
+	(add-hook 'tooltip-hook 'gud-tooltip-tips)
+	(define-key global-map [mouse-movement] 'gud-tooltip-mouse-motion))
+    (unless tooltip-mode (remove-hook 'pre-command-hook 'tooltip-hide)
+    (remove-hook 'change-major-mode-hook 'gud-tooltip-change-major-mode)
+    (remove-hook 'tooltip-hook 'gud-tooltip-tips)
+    (define-key global-map [mouse-movement] 'ignore)))
+  (gud-tooltip-activate-mouse-motions-if-enabled)
+  (if (and
+       gud-comint-buffer
+       (buffer-name gud-comint-buffer); gud-comint-buffer might be killed
+       (with-current-buffer gud-comint-buffer
+	(memq gud-minor-mode '(gdbmi gdba))))
+      (if gud-tooltip-mode
+	  (progn
+	    (dolist (buffer (buffer-list))
+	      (unless (eq buffer gud-comint-buffer)
+		(with-current-buffer buffer
+		  (when (and (memq gud-minor-mode '(gdbmi gdba))
+			     (not (string-match "\\`\\*.+\\*\\'"
+						(buffer-name))))
+		    (make-local-variable 'gdb-define-alist)
+		    (gdb-create-define-alist)
+		    (add-hook 'after-save-hook
+			      'gdb-create-define-alist nil t))))))
+	(kill-local-variable 'gdb-define-alist)
+	(remove-hook 'after-save-hook 'gdb-create-define-alist t))))
+
 (defcustom gud-tooltip-modes '(gud-mode c-mode c++-mode fortran-mode)
-  "List of modes for which to enable GUD tips."
+  "List of modes for which to enable GUD tooltips."
   :type 'sexp
   :tag "GUD modes"
+  :group 'gud
   :group 'tooltip)
 
 (defcustom gud-tooltip-display
@@ -3232,12 +3276,13 @@
 only tooltips in the buffer containing the overlay arrow."
   :type 'sexp
   :tag "GUD buffers predicate"
+  :group 'gud
   :group 'tooltip)
 
 (defcustom gud-tooltip-echo-area nil
   "Use the echo area instead of frames for GUD tooltips."
   :type 'boolean
-  :tag "Use echo area"
+  :group 'gud
   :group 'tooltip)
 
 (define-obsolete-variable-alias 'tooltip-gud-modes
@@ -3311,43 +3356,6 @@
 (define-obsolete-function-alias 'tooltip-gud-toggle-dereference
                                 'toggle-gud-tooltip-dereference "22.1")
 
-;;;###autoload
-(define-minor-mode gud-tooltip-mode
-  "Toggle the display of GUD tooltips."
-  :global t
-  :group 'gud
-  (require 'tooltip)
-  (if gud-tooltip-mode
-      (progn
-	(add-hook 'change-major-mode-hook 'gud-tooltip-change-major-mode)
-	(add-hook 'pre-command-hook 'tooltip-hide)
-	(add-hook 'tooltip-hook 'gud-tooltip-tips)
-	(define-key global-map [mouse-movement] 'gud-tooltip-mouse-motion))
-    (unless tooltip-mode (remove-hook 'pre-command-hook 'tooltip-hide)
-    (remove-hook 'change-major-mode-hook 'gud-tooltip-change-major-mode)
-    (remove-hook 'tooltip-hook 'gud-tooltip-tips)
-    (define-key global-map [mouse-movement] 'ignore)))
-  (gud-tooltip-activate-mouse-motions-if-enabled)
-  (if (and
-       gud-comint-buffer
-       (buffer-name gud-comint-buffer); gud-comint-buffer might be kille
-       (with-current-buffer gud-comint-buffer
-	(memq gud-minor-mode '(gdbmi gdba))))
-      (if gud-tooltip-mode
-	  (progn
-	    (dolist (buffer (buffer-list))
-	      (unless (eq buffer gud-comint-buffer)
-		(with-current-buffer buffer
-		  (when (and (memq gud-minor-mode '(gdbmi gdba))
-			     (not (string-match "\\`\\*.+\\*\\'"
-						(buffer-name))))
-		    (make-local-variable 'gdb-define-alist)
-		    (gdb-create-define-alist)
-		    (add-hook 'after-save-hook
-			      'gdb-create-define-alist nil t))))))
-	(kill-local-variable 'gdb-define-alist)
-	(remove-hook 'after-save-hook 'gdb-create-define-alist t))))
-
 ; This will only display data that comes in one chunk.
 ; Larger arrays (say 400 elements) are displayed in
 ; the tooltip incompletely and spill over into the gud buffer.
@@ -3384,9 +3392,8 @@
   (let (process)
     (when (and (eventp event)
 	       gud-tooltip-mode
-	       (boundp 'gud-comint-buffer)
 	       gud-comint-buffer
-	       (buffer-name gud-comint-buffer); gud-comint-buffer might be killed
+	       (buffer-name gud-comint-buffer); might be killed
 	       (setq process (get-buffer-process gud-comint-buffer))
 	       (posn-point (event-end event))
 	       (or (and (eq gud-minor-mode 'gdba) (not gdb-active-process))
--- a/lisp/progmodes/octave-mod.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/progmodes/octave-mod.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1311,7 +1311,8 @@
 Reindent the line of `octave-auto-indent' is non-nil."
   (interactive)
   (setq last-command-char ? )
-  (if (not (octave-not-in-string-or-comment-p))
+  (if (and octave-auto-indent
+	   (not (octave-not-in-string-or-comment-p)))
       (progn
 	(indent-according-to-mode)
 	(self-insert-command 1))
--- a/lisp/recentf.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/recentf.el	Sun Dec 11 22:42:40 2005 +0000
@@ -46,9 +46,9 @@
 (defvar recentf-list nil
   "List of recently opened files.")
 
-(defvar recentf-data-cache nil
-  "Cache of data used to build the recentf menu.
-The menu is rebuilt when this data has changed.")
+(defsubst recentf-enabled-p ()
+  "Return non-nil if recentf mode is currently enabled."
+  (memq 'recentf-save-list kill-emacs-hook))
 
 ;;; Customization
 ;;
@@ -111,10 +111,13 @@
 (defun recentf-menu-customization-changed (variable value)
   "Function called when the recentf menu customization has changed.
 Set VARIABLE with VALUE, and force a rebuild of the recentf menu."
-  (when (featurep 'recentf)
-    ;; Unavailable until recentf has been loaded.
-    (recentf-clear-data))
-  (set-default variable value))
+  (if (and (featurep 'recentf) (recentf-enabled-p))
+      (progn
+        ;; Unavailable until recentf has been loaded.
+        (recentf-hide-menu)
+        (set-default variable value)
+        (recentf-show-menu))
+    (set-default variable value)))
 
 (defcustom recentf-menu-title "Open Recent"
   "*Name of the recentf menu."
@@ -142,14 +145,12 @@
   "*Function to invoke with a filename item of the recentf menu.
 The default is to call `find-file' to edit the selected file."
   :group 'recentf
-  :type 'function
-  :set 'recentf-menu-customization-changed)
+  :type 'function)
 
 (defcustom recentf-max-menu-items 10
   "*Maximum number of items in the recentf menu."
   :group 'recentf
-  :type 'integer
-  :set 'recentf-menu-customization-changed)
+  :type 'integer)
 
 (defcustom recentf-menu-filter nil
   "*Function used to filter files displayed in the recentf menu.
@@ -182,7 +183,7 @@
 - `recentf-arrange-by-dir'
     Show a sub-menu for each directory.
 - `recentf-filter-changer'
-    Manage a ring of filters.
+    Manage a menu of filters.
 
 The filter function is called with one argument, the list of menu
 elements used to build the menu and must return a new list of menu
@@ -203,21 +204,18 @@
                 (function-item recentf-arrange-by-mode)
                 (function-item recentf-arrange-by-dir)
                 (function-item recentf-filter-changer)
-                function)
-  :set 'recentf-menu-customization-changed)
+                function))
 
 (defcustom recentf-menu-open-all-flag nil
   "*Non-nil means to show an \"All...\" item in the menu.
 This item will replace the \"More...\" item."
   :group 'recentf
-  :type 'boolean
-  :set 'recentf-menu-customization-changed)
+  :type 'boolean)
 
 (defcustom recentf-menu-append-commands-flag t
   "*Non-nil means to append command items to the menu."
   :group 'recentf
-  :type 'boolean
-  :set 'recentf-menu-customization-changed)
+  :type 'boolean)
 
 (define-obsolete-variable-alias 'recentf-menu-append-commands-p
                                 'recentf-menu-append-commands-flag
@@ -331,7 +329,7 @@
 the full list."
   (let ((value (symbol-value variable)))
     (if (atom value)
-        (insert (format "\n(setq %S %S)\n" variable value))
+        (insert (format "\n(setq %S '%S)\n" variable value))
       (when (and (integerp limit) (> limit 0))
         (setq value (recentf-trunc-list value limit)))
       (insert (format "\n(setq %S\n      '(" variable))
@@ -576,35 +574,40 @@
 ;; Count the number of assigned menu shortcuts.
 (defvar recentf-menu-shortcuts)
 
-(defun recentf-make-menu-items ()
-  "Make menu items from the recent list."
+(defun recentf-make-menu-items (&optional menu)
+  "Make menu items from the recent list.
+This is a menu filter function which ignores the MENU argument."
   (setq recentf-menu-filter-commands nil)
   (let* ((recentf-menu-shortcuts 0)
          (file-items
-          (mapcar 'recentf-make-menu-item
-                  (recentf-apply-menu-filter
-                   recentf-menu-filter
-                   (recentf-menu-elements recentf-max-menu-items)))))
-    (append (or file-items (list ["No files" t
-                                  :help "No recent file to open"
-                                  :active nil]))
-            (if recentf-menu-open-all-flag
-                (list ["All..." recentf-open-files
-                       :help "Open recent files through a dialog"
-                       :active t])
-              (and (< recentf-max-menu-items (length recentf-list))
-                   (list ["More..." recentf-open-more-files
-                          :help "Open files not in the menu through a dialog"
-                          :active t])))
-            (and recentf-menu-filter-commands
-                 (cons "---"
-                       recentf-menu-filter-commands))
-            (and recentf-menu-append-commands-flag
-                 (cons "---"
-                       recentf-menu-items-for-commands)))))
+          (condition-case err
+              (mapcar 'recentf-make-menu-item
+                      (recentf-apply-menu-filter
+                       recentf-menu-filter
+                       (recentf-menu-elements recentf-max-menu-items)))
+            (error
+             (message "recentf update menu failed: %s"
+                      (error-message-string err))))))
+    (append
+     (or file-items
+         '(["No files" t
+            :help "No recent file to open"
+            :active nil]))
+     (if recentf-menu-open-all-flag
+         '(["All..." recentf-open-files
+            :help "Open recent files through a dialog"
+            :active t])
+       (and (< recentf-max-menu-items (length recentf-list))
+            '(["More..." recentf-open-more-files
+               :help "Open files not in the menu through a dialog"
+               :active t])))
+     (and recentf-menu-filter-commands '("---"))
+     recentf-menu-filter-commands
+     (and recentf-menu-items-for-commands '("---"))
+     recentf-menu-items-for-commands)))
 
 (defun recentf-menu-value-shortcut (name)
-  "Return a shorcut digit for file NAME.
+  "Return a shortcut digit for file NAME.
 Return nil if file NAME is not one of the ten more recent."
   (let ((i 0) k)
     (while (and (not k) (< i 10))
@@ -639,12 +642,17 @@
   "Return the keymap of the global menu bar."
   (lookup-key global-map [menu-bar]))
 
-(defun recentf-clear-data ()
-  "Clear data used to build the recentf menu.
-This forces a rebuild of the menu."
-  (easy-menu-remove-item (recentf-menu-bar)
-                         recentf-menu-path recentf-menu-title)
-  (setq recentf-data-cache nil))
+(defun recentf-show-menu ()
+  "Show the menu of recently opened files."
+  (easy-menu-add-item
+   (recentf-menu-bar) recentf-menu-path
+   (list recentf-menu-title :filter 'recentf-make-menu-items)
+   recentf-menu-before))
+
+(defun recentf-hide-menu ()
+  "Hide the menu of recently opened files."
+  (easy-menu-remove-item (recentf-menu-bar) recentf-menu-path
+                         recentf-menu-title))
 
 ;;; Predefined menu filters
 ;;
@@ -750,19 +758,24 @@
 ;;
 (defcustom recentf-arrange-rules
   '(
-    ("Elisp files (%d)" ".\\.el$")
-    ("Java files (%d)"  ".\\.java$")
-    ("C/C++ files (%d)" "c\\(pp\\)?$")
+    ("Elisp files (%d)" ".\\.el\\'")
+    ("Java files (%d)"  ".\\.java\\'")
+    ("C/C++ files (%d)" "c\\(pp\\)?\\'")
     )
   "*List of rules used by `recentf-arrange-by-rule' to build sub-menus.
 A rule is a pair (SUB-MENU-TITLE . MATCHER).  SUB-MENU-TITLE is the
 displayed title of the sub-menu where a '%d' `format' pattern is
 replaced by the number of items in the sub-menu.  MATCHER is a regexp
 or a list of regexps.  Items matching one of the regular expressions in
-MATCHER are added to the corresponding sub-menu."
+MATCHER are added to the corresponding sub-menu.
+SUB-MENU-TITLE can be a function.  It is passed every items that
+matched the corresponding MATCHER, and it must return a
+pair (SUB-MENU-TITLE . ITEM).  SUB-MENU-TITLE is a computed sub-menu
+title that can be another function.  ITEM is the received item which
+may have been modified to match another rule."
   :group 'recentf-filters
-  :type '(repeat (cons string (repeat regexp)))
-  :set 'recentf-menu-customization-changed)
+  :type '(repeat (cons (choice string function)
+                       (repeat regexp))))
 
 (defcustom recentf-arrange-by-rule-others "Other files (%d)"
   "*Title of the `recentf-arrange-by-rule' sub-menu.
@@ -772,8 +785,7 @@
 the title is replaced by the number of items in the sub-menu."
   :group 'recentf-filters
   :type '(choice (const  :tag "Main menu" nil)
-                 (string :tag "Title"))
-  :set 'recentf-menu-customization-changed)
+                 (string :tag "Title")))
 
 (defcustom recentf-arrange-by-rules-min-items 0
   "*Minimum number of items in a `recentf-arrange-by-rule' sub-menu.
@@ -782,8 +794,7 @@
 menu or in the `recentf-arrange-by-rule-others' sub-menu if
 defined."
   :group 'recentf-filters
-  :type 'number
-  :set 'recentf-menu-customization-changed)
+  :type 'number)
 
 (defcustom recentf-arrange-by-rule-subfilter nil
   "*Function called by a rule based filter to filter sub-menu elements.
@@ -796,81 +807,82 @@
                              recentf-arrange-by-mode
                              recentf-arrange-by-dir))
            (error "Recursive use of a rule based filter"))
-         (recentf-menu-customization-changed variable value)))
+         (set-default variable value)))
 
-(defun recentf-match-rule-p (matcher filename)
-  "Return non-nil if the rule specified by MATCHER match FILENAME.
-See `recentf-arrange-rules' for details on MATCHER."
-  (if (stringp matcher)
-      (string-match matcher filename)
-    (while (and (consp matcher)
-                (not (string-match (car matcher) filename)))
-      (setq matcher (cdr matcher)))
-    matcher))
+(defun recentf-match-rule (file)
+  "Return the rule that match FILE."
+  (let ((rules recentf-arrange-rules)
+        match found)
+    (while (and (not found) rules)
+      (setq match (cdar rules))
+      (when (stringp match)
+        (setq match (list match)))
+      (while (and match (not (string-match (car match) file)))
+        (setq match (cdr match)))
+      (if match
+          (setq found (cons (caar rules) file))
+        (setq rules (cdr rules))))
+    found))
 
 (defun recentf-arrange-by-rule (l)
   "Filter the list of menu-elements L.
 Arrange them in sub-menus following rules in `recentf-arrange-rules'."
-  (if (not recentf-arrange-rules)
-      l
-    (let* ((strip (assq t recentf-arrange-rules))
-           (rules (remq strip recentf-arrange-rules))
-           (menus (mapcar #'(lambda (r) (list (car r))) rules))
-           others l1 l2 menu file min count)
+  (when recentf-arrange-rules
+    (let (menus others menu file min count)
       ;; Put menu items into sub-menus as defined by rules.
       (dolist (elt l)
-        (setq l1   menus ;; List of sub-menus
-              l2   rules ;; List of corresponding matchers.
-              file (recentf-menu-element-value elt)
-              menu nil)
-        ;; Apply the strip suffix rule.
-        (while (recentf-match-rule-p (cdr strip) file)
-          (setq file (substring file 0 (match-beginning 0))))
-        ;; Search which sub-menu to put the menu item into.
-        (while (and (not menu) l2)
-          (when (recentf-match-rule-p (cdar l2) file)
-            (setq menu (car l1))
-            (recentf-set-menu-element-value
-             menu (cons elt (recentf-menu-element-value menu))))
-          (setq l1 (cdr l1)
-                l2 (cdr l2)))
-        ;; Put unmatched menu items in the `others' bin.
-        (or menu (push elt others)))
-      ;; Finalize the sub-menus.  That is, for each one:
+        (setq file (recentf-menu-element-value elt)
+              menu (recentf-match-rule file))
+        (while (functionp (car menu))
+          (setq menu (funcall (car menu) (cdr menu))))
+        (if (not (stringp (car menu)))
+            (push elt others)
+          (setq menu (or (assoc (car menu) menus)
+                         (car (push (list (car menu)) menus))))
+          (recentf-set-menu-element-value
+           menu (cons elt (recentf-menu-element-value menu)))))
+      ;; Finalize each sub-menu:
       ;; - truncate it depending on the value of
       ;;   `recentf-arrange-by-rules-min-items',
       ;; - replace %d by the number of menu items,
       ;; - apply `recentf-arrange-by-rule-subfilter' to menu items.
       (setq min (if (natnump recentf-arrange-by-rules-min-items)
                     recentf-arrange-by-rules-min-items 0)
-            l2 nil)
-      (dolist (menu menus)
-        (when (setq l1 (recentf-menu-element-value menu))
-          (setq count (length l1))
-          (if (< count min)
-              (setq others (nconc l1 others))
-            (recentf-set-menu-element-item
-             menu (format (recentf-menu-element-item menu) count))
-            (recentf-set-menu-element-value
-             menu (recentf-apply-menu-filter
-                   recentf-arrange-by-rule-subfilter (nreverse l1)))
-            (push menu l2))))
+            l nil)
+      (dolist (elt menus)
+        (setq menu (recentf-menu-element-value elt)
+              count (length menu))
+        (if (< count min)
+            (setq others (nconc menu others))
+          (recentf-set-menu-element-item
+           elt (format (recentf-menu-element-item elt) count))
+          (recentf-set-menu-element-value
+           elt (recentf-apply-menu-filter
+                recentf-arrange-by-rule-subfilter (nreverse menu)))
+          (push elt l)))
       ;; Add the menu items remaining in the `others' bin.
-      (if (and (stringp recentf-arrange-by-rule-others) others)
-          (nreverse
-           (cons
-            (recentf-make-menu-element
-             (format recentf-arrange-by-rule-others (length others))
-             (recentf-apply-menu-filter
-              recentf-arrange-by-rule-subfilter (nreverse others)))
-            l2))
-        (nconc
-         (nreverse l2)
-         (recentf-apply-menu-filter
-          recentf-arrange-by-rule-subfilter (nreverse others)))))))
+      (when (setq others (nreverse others))
+        (setq l (nconc
+                 l
+                 ;; Put items in an sub menu.
+                 (if (stringp recentf-arrange-by-rule-others)
+                     (list
+                      (recentf-make-menu-element
+                       (format recentf-arrange-by-rule-others
+                               (length others))
+                       (recentf-apply-menu-filter
+                        recentf-arrange-by-rule-subfilter others)))
+                   ;; Append items to the main menu.
+                   (recentf-apply-menu-filter
+                    recentf-arrange-by-rule-subfilter others)))))))
+  l)
 
 ;;; Predefined rule based menu filters
 ;;
+(defun recentf-indirect-mode-rule (file)
+  "Apply a second level `auto-mode-alist' regexp to FILE."
+  (recentf-match-rule (substring file 0 (match-beginning 0))))
+
 (defun recentf-build-mode-rules ()
   "Convert `auto-mode-alist' to menu filter rules.
 Rules obey `recentf-arrange-rules' format."
@@ -886,7 +898,7 @@
          ;; ignored by the menu filter.  So in some corner cases a
          ;; wrong mode could be guessed.
          ((and (consp mode) (cadr mode))
-          (setq rule-name t))
+          (setq rule-name 'recentf-indirect-mode-rule))
          ((and mode (symbolp mode))
           (setq rule-name (symbol-name mode))
           (if (string-match "\\(.*\\)-mode$" rule-name)
@@ -906,21 +918,6 @@
         (recentf-arrange-by-rule-others "others (%d)"))
     (recentf-arrange-by-rule l)))
 
-(defun recentf-build-dir-rules (l)
-  "Convert directories in menu-elements L to menu filter rules.
-Rules obey `recentf-arrange-rules' format."
-  (let (dirs)
-    (mapcar #'(lambda (e)
-                (let ((dir (file-name-directory
-                            (recentf-menu-element-value e))))
-                  (or (recentf-string-member dir dirs)
-                      (push dir dirs))))
-            l)
-    (mapcar #'(lambda (d)
-                (cons (concat d " (%d)")
-                      (concat "\\`" d)))
-            (nreverse (sort dirs 'recentf-string-lessp)))))
-
 (defun recentf-file-name-nondir (l)
   "Filter the list of menu-elements L to show filenames sans directory.
 This simplified version of `recentf-show-basenames' does not handle
@@ -932,23 +929,27 @@
                (recentf-menu-element-value e)))
           l))
 
+(defun recentf-dir-rule (file)
+  "Return as a sub-menu, the directory FILE belongs to."
+  (cons (file-name-directory file) file))
+
 (defun recentf-arrange-by-dir (l)
   "Split the list of menu-elements L into sub-menus by directory."
-  (let ((recentf-arrange-rules (recentf-build-dir-rules l))
+  (let ((recentf-arrange-rules '((recentf-dir-rule . ".*")))
         (recentf-arrange-by-rule-subfilter 'recentf-file-name-nondir)
         recentf-arrange-by-rule-others)
-    (nreverse (recentf-arrange-by-rule l))))
+    (recentf-arrange-by-rule l)))
 
-;;; Ring of menu filters
+;;; Menu of menu filters
 ;;
-(defvar recentf-filter-changer-state nil
-  "Used by `recentf-filter-changer' to hold its state.")
+(defvar recentf-filter-changer-current nil
+  "Current filter used by `recentf-filter-changer'.")
 
 (defcustom recentf-filter-changer-alist
   '(
-    (recentf-arrange-by-mode . "*Files by Mode*")
-    (recentf-arrange-by-dir  . "*Files by Directory*")
-    (recentf-arrange-by-rule . "*Files by User Rule*")
+    (recentf-arrange-by-mode . "Grouped by Mode")
+    (recentf-arrange-by-dir  . "Grouped by Directory")
+    (recentf-arrange-by-rule . "Grouped by Custom Rules")
     )
   "*List of filters managed by `recentf-filter-changer'.
 Each filter is defined by a pair (FUNCTION . LABEL), where FUNCTION is
@@ -957,50 +958,38 @@
   :group 'recentf-filters
   :type '(repeat (cons function string))
   :set (lambda (variable value)
-         (setq recentf-filter-changer-state nil)
-         (recentf-menu-customization-changed variable value)))
+         (setq recentf-filter-changer-current nil)
+         (set-default variable value)))
 
-(defun recentf-filter-changer-goto-next ()
-  "Go to the next filter available.
-See `recentf-filter-changer'."
-  (setq recentf-filter-changer-state (cdr recentf-filter-changer-state))
-  (recentf-clear-data))
-
-(defsubst recentf-filter-changer-get-current ()
-  "Get the current filter available.
+(defun recentf-filter-changer-select (filter)
+  "Select FILTER as the current menu filter.
 See `recentf-filter-changer'."
-  (unless recentf-filter-changer-state
-    (setq recentf-filter-changer-state recentf-filter-changer-alist))
-  (car recentf-filter-changer-state))
-
-(defsubst recentf-filter-changer-get-next ()
-  "Get the next filter available.
-See `recentf-filter-changer'."
-  ;; At this point the current filter is the first element of
-  ;; `recentf-filter-changer-state'.
-  (car (or (cdr recentf-filter-changer-state)
-           ;; There is no next element in
-           ;; `recentf-filter-changer-state', so loop back to the
-           ;; first element of `recentf-filter-changer-alist'.
-           recentf-filter-changer-alist)))
+  (setq recentf-filter-changer-current filter))
 
 (defun recentf-filter-changer (l)
-  "Manage a ring of menu filters.
-`recentf-filter-changer-alist' defines the filters in the ring.
-Filtering of L is delegated to the current filter in the ring.  A
-filter menu item is displayed allowing to dynamically activate the
-next filter in the ring.  If the filter ring is empty, L is left
-unchanged."
-  (let ((filter (recentf-filter-changer-get-current)))
-    (when filter
-      (setq l (recentf-apply-menu-filter (car filter) l)
-            filter (recentf-filter-changer-get-next))
-      (when filter
-        (setq recentf-menu-filter-commands
-              (list (vector (cdr filter)
-                            '(recentf-filter-changer-goto-next)
-                            t)))))
-    l))
+  "Manage a sub-menu of menu filters.
+`recentf-filter-changer-alist' defines the filters in the menu.
+Filtering of L is delegated to the selected filter in the menu."
+  (unless recentf-filter-changer-current
+    (setq recentf-filter-changer-current
+          (caar recentf-filter-changer-alist)))
+  (if (not recentf-filter-changer-current)
+      l
+    (setq recentf-menu-filter-commands
+          (list
+           `("Show files"
+             ,@(mapcar
+                #'(lambda (f)
+                    `[,(cdr f)
+                      (setq recentf-filter-changer-current ',(car f))
+                      ;;:active t
+                      :style radio ;;radio Don't work with GTK :-(
+                      :selected (eq recentf-filter-changer-current
+                                    ',(car f))
+                      ;;:help ,(cdr f)
+                      ])
+                recentf-filter-changer-alist))))
+    (recentf-apply-menu-filter recentf-filter-changer-current l)))
 
 ;;; Hooks
 ;;
@@ -1017,35 +1006,14 @@
   (and buffer-file-name
        (recentf-remove-if-non-kept buffer-file-name)))
 
-(defun recentf-update-menu ()
-  "Update the recentf menu from the current recent list."
-  (let ((cache (cons default-directory recentf-list)))
-    ;; Does nothing, if nothing has changed.
-    (unless (equal recentf-data-cache cache)
-      (setq recentf-data-cache cache)
-      (condition-case err
-          (easy-menu-add-item
-           (recentf-menu-bar) recentf-menu-path
-           (easy-menu-create-menu recentf-menu-title
-                                  (recentf-make-menu-items))
-           recentf-menu-before)
-        (error
-         (message "recentf update menu failed: %s"
-                  (error-message-string err)))))))
-
 (defconst recentf-used-hooks
   '(
     (find-file-hook       recentf-track-opened-file)
     (write-file-functions recentf-track-opened-file)
     (kill-buffer-hook     recentf-track-closed-file)
-    (menu-bar-update-hook recentf-update-menu)
     (kill-emacs-hook      recentf-save-list)
     )
   "Hooks used by recentf.")
-
-(defsubst recentf-enabled-p ()
-  "Return non-nil if recentf mode is currently enabled."
-  (memq 'recentf-update-menu menu-bar-update-hook))
 
 ;;; Commands
 ;;
@@ -1126,8 +1094,7 @@
           (setq recentf-list (delq e recentf-list)
                 i (1+ i)))
         (kill-buffer (current-buffer))
-        (message "%S file(s) removed from the list" i)
-        (recentf-clear-data))
+        (message "%S file(s) removed from the list" i))
     (message "No file selected")))
 
 (defun recentf-edit-list ()
@@ -1292,7 +1259,7 @@
         (set-buffer-file-coding-system recentf-save-file-coding-system)
         (insert (format recentf-save-file-header (current-time-string)))
         (recentf-dump-variable 'recentf-list recentf-max-saved-items)
-        (recentf-dump-variable 'recentf-filter-changer-state)
+        (recentf-dump-variable 'recentf-filter-changer-current)
         (insert "\n\n;;; Local Variables:\n"
                 (format ";;; coding: %s\n" recentf-save-file-coding-system)
                 ";;; End:\n")
@@ -1354,10 +1321,12 @@
   :keymap recentf-mode-map
   (unless (and recentf-mode (recentf-enabled-p))
     (if recentf-mode
-        (recentf-load-list)
+        (progn
+          (recentf-load-list)
+          (recentf-show-menu))
+      (recentf-hide-menu)
       (recentf-save-list))
     (recentf-auto-cleanup)
-    (recentf-clear-data)
     (let ((hook-setup (if recentf-mode 'add-hook 'remove-hook)))
       (dolist (hook recentf-used-hooks)
         (apply hook-setup hook)))
--- a/lisp/replace.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/replace.el	Sun Dec 11 22:42:40 2005 +0000
@@ -1710,7 +1710,7 @@
       (if replace-overlay
 	  (move-overlay replace-overlay match-beg match-end (current-buffer))
 	(setq replace-overlay (make-overlay match-beg match-end))
-	(overlay-put replace-overlay 'priority 1) ;higher than lazy overlays
+	(overlay-put replace-overlay 'priority 1001) ;higher than lazy overlays
 	(overlay-put replace-overlay 'face 'query-replace)))
   (if query-replace-lazy-highlight
       (let ((isearch-string string)
--- a/lisp/simple.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/simple.el	Sun Dec 11 22:42:40 2005 +0000
@@ -2745,6 +2745,8 @@
 Case is ignored if `case-fold-search' is non-nil in the current buffer.
 Goes backward if ARG is negative; error if CHAR not found."
   (interactive "p\ncZap to char: ")
+  (if (char-table-p translation-table-for-input)
+      (setq char (or (aref translation-table-for-input char) char)))
   (kill-region (point) (progn
 			 (search-forward (char-to-string char) nil nil arg)
 ;			 (goto-char (if (> arg 0) (1- (point)) (1+ (point))))
--- a/lisp/term/mac-win.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/term/mac-win.el	Sun Dec 11 22:42:40 2005 +0000
@@ -76,10 +76,12 @@
 (require 'menu-bar)
 (require 'fontset)
 (require 'dnd)
+(eval-when-compile (require 'url))
 
 (defvar mac-charset-info-alist)
 (defvar mac-services-selection)
 (defvar mac-system-script-code)
+(defvar mac-apple-event-map)
 (defvar x-invocation-args)
 
 (defvar x-command-line-resources nil)
@@ -1148,7 +1150,7 @@
 
 (define-key special-event-map [language-change] 'mac-handle-language-change)
 
-;;;; Selections and Services menu
+;;;; Selections
 
 ;; Setup to use the Mac clipboard.
 (set-selection-coding-system mac-system-coding-system)
@@ -1386,6 +1388,157 @@
 	 (public.file-url . mac-select-convert-to-file-url)
 	 )
        selection-converter-alist))
+
+;;;; Apple events, HICommand events, and Services menu
+
+;;; Event classes
+(put 'core-event     'mac-apple-event-class "aevt") ; kCoreEventClass
+(put 'internet-event 'mac-apple-event-class "GURL") ; kAEInternetEventClass
+
+;;; Event IDs 
+;; kCoreEventClass
+(put 'open-application   'mac-apple-event-id "oapp") ; kAEOpenApplication
+(put 'reopen-application 'mac-apple-event-id "rapp") ; kAEReopenApplication
+(put 'open-documents     'mac-apple-event-id "odoc") ; kAEOpenDocuments
+(put 'print-documents    'mac-apple-event-id "pdoc") ; kAEPrintDocuments
+(put 'open-contents      'mac-apple-event-id "ocon") ; kAEOpenContents
+(put 'quit-application   'mac-apple-event-id "quit") ; kAEQuitApplication
+(put 'application-died   'mac-apple-event-id "obit") ; kAEApplicationDied
+(put 'show-preferences   'mac-apple-event-id "pref") ; kAEShowPreferences
+(put 'autosave-now       'mac-apple-event-id "asav") ; kAEAutosaveNow
+;; kAEInternetEventClass
+(put 'get-url            'mac-apple-event-id "GURL") ; kAEGetURL
+;; Converted HICommand events
+(put 'about              'mac-apple-event-id "abou") ; kHICommandAbout
+
+(defmacro mac-event-spec (event)
+  `(nth 1 ,event))
+
+(defmacro mac-event-ae (event)
+  `(nth 2 ,event))
+
+(defun mac-ae-parameter (ae &optional keyword type)
+  (or keyword (setq keyword "----")) ;; Direct object.
+  (if (not (and (consp ae) (equal (car ae) "aevt")))
+      (error "Not an Apple event: %S" ae)
+    (let ((type-data (cdr (assoc keyword (cdr ae))))
+	  data)
+      (when (and type type-data)
+	(setq data (mac-coerce-ae-data (car type-data) (cdr type-data) type))
+	(setq type-data (if data (cons type data) nil)))
+      type-data)))
+
+(defun mac-ae-list (ae &optional keyword type)
+  (or keyword (setq keyword "----")) ;; Direct object.
+  (let ((desc (mac-ae-parameter ae keyword)))
+    (cond ((null desc)
+	   nil)
+	  ((not (equal (car desc) "list"))
+	   (error "Parameter for \"%s\" is not a list" keyword))
+	  (t
+	   (if (null type)
+	       (cdr desc)
+	     (mapcar
+	      (lambda (type-data)
+		(mac-coerce-ae-data (car type-data) (cdr type-data) type))
+	      (cdr desc)))))))
+
+(defun mac-bytes-to-integer (bytes &optional from to)
+  (or from (setq from 0))
+  (or to (setq to (length bytes)))
+  (let* ((len (- to from))
+	 (extended-sign-len (- (1+ (ceiling (log most-positive-fixnum 2)))
+			       (* 8 len)))
+	 (result 0))
+    (dotimes (i len)
+      (setq result (logior (lsh result 8)
+			   (aref bytes (+ from (if (eq (byteorder) ?B) i
+						 (- len i 1)))))))
+    (if (> extended-sign-len 0)
+	(ash (lsh result extended-sign-len) (- extended-sign-len))
+      result)))
+
+(defun mac-ae-selection-range (ae)
+;; #pragma options align=mac68k
+;; typedef struct SelectionRange {
+;;   short unused1; // 0 (not used)
+;;   short lineNum; // line to select (<0 to specify range)
+;;   long startRange; // start of selection range (if line < 0)
+;;   long endRange; // end of selection range (if line < 0)
+;;   long unused2; // 0 (not used)
+;;   long theDate; // modification date/time
+;; } SelectionRange;
+;; #pragma options align=reset
+  (let ((range-bytes (cdr (mac-ae-parameter ae "kpos" "TEXT"))))
+    (and range-bytes
+	 (list (mac-bytes-to-integer range-bytes 2 4)
+	       (mac-bytes-to-integer range-bytes 4 8)
+	       (mac-bytes-to-integer range-bytes 8 12)
+	       (mac-bytes-to-integer range-bytes 16 20)))))
+
+;; On Mac OS X 10.4 and later, the `open-document' event contains an
+;; optional parameter keyAESearchText from the Spotlight search.
+(defun mac-ae-text-for-search (ae)
+  (let ((utf8-text (cdr (mac-ae-parameter ae "stxt" "utf8"))))
+    (and utf8-text
+	 (decode-coding-string utf8-text 'utf-8))))
+
+(defun mac-ae-open-documents (event)
+  (interactive "e")
+  (let ((ae (mac-event-ae event)))
+    (dolist (file-name (mac-ae-list ae nil 'undecoded-file-name))
+      (if file-name
+	  (dnd-open-local-file (concat "file:" file-name) nil)))
+    (let ((selection-range (mac-ae-selection-range ae))
+	  (search-text (mac-ae-text-for-search ae)))
+      (cond (selection-range
+	     (let ((line (car selection-range))
+		   (start (cadr selection-range))
+		   (end (nth 2 selection-range)))
+	       (if (> line 0)
+		   (goto-line line)
+		 (if (and (> start 0) (> end 0))
+		     (progn (set-mark start)
+			    (goto-char end))))))
+	    ((stringp search-text)
+	     (re-search-forward
+	      (mapconcat 'regexp-quote (split-string search-text) "\\|")
+	      nil t)))))
+  (raise-frame))
+
+(defun mac-ae-text (ae)
+  (or (cdr (mac-ae-parameter ae nil "TEXT"))
+      (error "No text in Apple event.")))
+
+(defun mac-ae-get-url (event)
+  (interactive "e")
+  (let* ((ae (mac-event-ae event))
+	 (parsed-url (url-generic-parse-url (mac-ae-text ae))))
+    (if (string= (url-type parsed-url) "mailto")
+	(url-mailto parsed-url)
+      (error "Unsupported URL scheme: %s" (url-type parsed-url)))))
+
+(setq mac-apple-event-map (make-sparse-keymap))
+
+;; Received when Emacs is launched without associated documents.
+;; Accept it as an Apple event, but no Emacs event is generated so as
+;; not to erase the splash screen.
+(define-key mac-apple-event-map [core-event open-application] 0)
+
+;; Received when a dock or application icon is clicked and Emacs is
+;; already running.  Simply ignored.  Another idea is to make a new
+;; frame if all frames are invisible.
+(define-key mac-apple-event-map [core-event reopen-application] 'ignore)
+
+(define-key mac-apple-event-map [core-event open-documents]
+  'mac-ae-open-documents)
+(define-key mac-apple-event-map [core-event show-preferences] 'customize)
+(define-key mac-apple-event-map [core-event quit-application]
+  'save-buffers-kill-emacs)
+
+(define-key mac-apple-event-map [internet-event get-url] 'mac-ae-get-url)
+
+(define-key mac-apple-event-map [hicommand about] 'display-splash-screen)
 
 (defun mac-services-open-file ()
   (interactive)
@@ -1420,21 +1573,35 @@
        (substitute-command-keys
 	"The text from the Services menu can be accessed with \\[yank]")))))
 
-(defvar mac-application-menu-map (make-sparse-keymap))
-(define-key mac-application-menu-map [quit] 'save-buffers-kill-emacs)
-(define-key mac-application-menu-map [services perform open-file]
+(define-key mac-apple-event-map [services paste] 'mac-services-insert-text)
+(define-key mac-apple-event-map [services perform open-file]
   'mac-services-open-file)
-(define-key mac-application-menu-map [services perform open-selection]
+(define-key mac-apple-event-map [services perform open-selection]
   'mac-services-open-selection)
-(define-key mac-application-menu-map [services perform mail-selection]
+(define-key mac-apple-event-map [services perform mail-selection]
   'mac-services-mail-selection)
-(define-key mac-application-menu-map [services perform mail-to]
+(define-key mac-apple-event-map [services perform mail-to]
   'mac-services-mail-to)
-(define-key mac-application-menu-map [services paste]
-  'mac-services-insert-text)
-(define-key mac-application-menu-map [preferences] 'customize)
-(define-key mac-application-menu-map [about] 'display-splash-screen)
-(global-set-key [menu-bar application] mac-application-menu-map)
+
+(defun mac-dispatch-apple-event (event)
+  (interactive "e")
+  (let* ((binding (lookup-key mac-apple-event-map (mac-event-spec event)))
+	 (service-message
+	  (and (keymapp binding)
+	       (cdr (mac-ae-parameter (mac-event-ae event) "svmg")))))
+    (when service-message
+      (setq service-message
+	    (intern (decode-coding-string service-message 'utf-8)))
+      (setq binding (lookup-key binding (vector service-message))))
+    (call-interactively binding)))
+
+(global-set-key [mac-apple-event] 'mac-dispatch-apple-event)
+
+;; Processing of Apple events are deferred at the startup time.  For
+;; example, files dropped onto the Emacs application icon can only be
+;; processed when the initial frame has been created: this is where
+;; the files should be opened.
+(add-hook 'after-init-hook 'mac-process-deferred-apple-events)
 
 ;;; Do the actual Windows setup here; the above code just defines
 ;;; functions and variables that we use now.
@@ -1855,31 +2022,12 @@
 	 (y (cdr coords)))
     (if (and (> x 0) (> y 0))
 	(set-frame-selected-window nil window))
-    (mapcar (lambda (file-name)
-	      (if (listp file-name)
-		  (let ((line (car file-name))
-			(start (car (cdr file-name)))
-			(end (car (cdr (cdr file-name)))))
-		    (if (> line 0)
-			(goto-line line)
-		      (if (and (> start 0) (> end 0))
-			  (progn (set-mark start)
-				 (goto-char end)))))
-		(dnd-handle-one-url window 'private
-				    (concat "file:" file-name))))
-	    (car (cdr (cdr event)))))
+    (dolist (file-name (nth 2 event))
+      (dnd-handle-one-url window 'private
+			  (concat "file:" file-name))))
   (raise-frame))
 
 (global-set-key [drag-n-drop] 'mac-drag-n-drop)
-
-;; By checking whether the variable mac-ready-for-drag-n-drop has been
-;; defined, the event loop in macterm.c can be informed that it can
-;; now receive Finder drag and drop events.  Files dropped onto the
-;; Emacs application icon can only be processed when the initial frame
-;; has been created: this is where the files should be opened.
-(add-hook 'after-init-hook
-	  '(lambda ()
-	     (defvar mac-ready-for-drag-n-drop t)))
 
 ;;;; Non-toolkit Scroll bars
 
--- a/lisp/textmodes/ispell.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/textmodes/ispell.el	Sun Dec 11 22:42:40 2005 +0000
@@ -2307,11 +2307,13 @@
 
 The variable `ispell-highlight-face' selects the face to use for highlighting."
   (if highlight
-      (progn
+      (if ispell-overlay
+	  (move-overlay ispell-overlay start end (current-buffer))
 	(setq ispell-overlay (make-overlay start end))
-	(overlay-put ispell-overlay 'priority 1) ;higher than lazy overlays
+	(overlay-put ispell-overlay 'priority 1001) ;higher than lazy overlays
 	(overlay-put ispell-overlay 'face ispell-highlight-face))
-    (delete-overlay ispell-overlay))
+    (if ispell-overlay
+	(delete-overlay ispell-overlay)))
   (if (and ispell-lazy-highlight (boundp 'lazy-highlight-cleanup))
       (if highlight
 	  (let ((isearch-string
--- a/lisp/textmodes/org.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/textmodes/org.el	Sun Dec 11 22:42:40 2005 +0000
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <dominik at science dot uva dot nl>
 ;; Keywords: outlines, hypermedia, calendar
 ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/
-;; Version: 3.22
+;; Version: 3.23
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -82,6 +82,10 @@
 ;;
 ;; Changes:
 ;; -------
+;; Version 3.23
+;;    - M-RET makes new items as well as new headings.
+;;    - Various small bug fixes
+;;
 ;; Version 3.22
 ;;    - CamelCase words link to other locations in the same file.
 ;;    - File links accept search options, to link to specific locations.
@@ -253,7 +257,7 @@
 
 ;;; Customization variables
 
-(defvar org-version "3.22"
+(defvar org-version "3.23"
   "The version number of the file org.el.")
 (defun org-version ()
   (interactive)
@@ -2530,22 +2534,39 @@
 (defvar org-ignore-region nil
   "To temporarily disable the active region.")
 
-(defun org-insert-heading ()
-  "Insert a new heading with same depth at point."
-  (interactive)
-  (let* ((head (save-excursion
-		 (condition-case nil
-		     (org-back-to-heading)
-		   (error (outline-next-heading)))
-		 (prog1 (match-string 0)
-		   (funcall outline-level)))))
+(defun org-insert-heading (&optional force-heading)
+  "Insert a new heading or item with same depth at point.
+If ARG is non-nil"
+  (interactive "P")
+  (when (or force-heading (not (org-insert-item)))
+    (let* ((head (save-excursion
+		   (condition-case nil
+		       (org-back-to-heading)
+		     (error (outline-next-heading)))
+		   (prog1 (match-string 0)
+		     (funcall outline-level)))))
+      (unless (bolp) (newline))
+      (insert head)
+      (unless (eolp)
+	(save-excursion (newline-and-indent)))
+      (unless (equal (char-before) ?\ )
+	(insert " "))
+      (run-hooks 'org-insert-heading-hook))))
+
+(defun org-insert-item ()
+  "Insert a new item at the current level.
+Return t when tings worked, nil when we are not in an item."
+  (when (save-excursion
+	  (condition-case nil
+	      (progn
+		(org-beginning-of-item)
+		(org-at-item-p)
+		t)
+	    (error nil)))
     (unless (bolp) (newline))
-    (insert head)
-    (unless (eolp)
-      (save-excursion (newline-and-indent)))
-    (unless (equal (char-before) ?\ )
-      (insert " "))
-    (run-hooks 'org-insert-heading-hook)))
+    (insert (match-string 0))
+    (org-maybe-renumber-ordered-list)
+    t))
 
 (defun org-insert-todo-heading (arg)
   "Insert a new heading with the same level and TODO state as current heading.
@@ -3034,8 +3055,9 @@
 	  (beginning-of-line 0)
 	  (if (looking-at "[ \t]*$") (throw 'next t))
 	  (skip-chars-forward " \t") (setq ind1 (current-column))
-	  (if (and (<= ind1 ind)
-		   (not (org-at-item-p)))
+	  (if (or (< ind1 ind)
+		  (and (= ind1 ind)
+		       (not (org-at-item-p))))
 	      (throw 'exit t)))))
     ;; Walk forward and replace these numbers
     (catch 'exit
@@ -3055,7 +3077,7 @@
 	  (insert (format "%d" (setq n (1+ n)))))))
     (goto-line line)
     (move-to-column col)))
-    
+
 (defvar org-last-indent-begin-marker (make-marker))
 (defvar org-last-indent-end-marker (make-marker))
 
@@ -3422,9 +3444,10 @@
 		  (save-match-data (funcall callback)))
 	  (setq cnt (1+ cnt))
 	  (org-highlight-new-match (match-beginning 0) (match-end 0))
-	  (add-hook 'before-change-functions 'org-remove-occur-highlights
-		    nil 'local)
 	  (org-show-hierarchy-above))))
+    (make-local-hook 'before-change-functions) ; needed for XEmacs
+    (add-hook 'before-change-functions 'org-remove-occur-highlights
+	      nil 'local)
     (run-hooks 'org-occur-hook)
     (if (interactive-p)
 	(message "%d match(es) for regexp %s" cnt regexp))
@@ -4036,7 +4059,9 @@
   (use-local-map org-agenda-mode-map)
   (easy-menu-add org-agenda-menu)
   (if org-startup-truncated (setq truncate-lines t))
+  (make-local-hook 'post-command-hook)  ; Needed for XEmacs
   (add-hook 'post-command-hook 'org-agenda-post-command-hook nil 'local)
+  (make-local-hook 'pre-command-hook)  ; Needed for XEmacs
   (add-hook 'pre-command-hook 'org-unhighlight nil 'local)
   (setq org-agenda-follow-mode nil)
   (easy-menu-change
@@ -4049,7 +4074,7 @@
   (org-agenda-set-mode-name)
   (apply
    (if (fboundp 'run-mode-hooks) 'run-mode-hooks 'run-hooks)
-   org-agenda-mode-hook))
+   (list 'org-agenda-mode-hook)))
 
 (define-key org-agenda-mode-map "\C-i"     'org-agenda-goto)
 (define-key org-agenda-mode-map "\C-m"     'org-agenda-switch-to)
@@ -4903,8 +4928,8 @@
   (let (tbl)
     (save-excursion
       (goto-char (point-min))
-      (while (re-search-forward "^#\\+CATEGORY:[ \t]*\\(.*\\)" nil t)
-	(push (cons (point) (org-trim (match-string 1))) tbl)))
+      (while (re-search-forward "\\(^\\|\r\\)#\\+CATEGORY:[ \t]*\\(.*\\)" nil t)
+	(push (cons (point) (org-trim (match-string 2))) tbl)))
     tbl))
   (defun org-get-category (&optional pos)
     "Get the category applying to position POS."
@@ -10899,7 +10924,7 @@
   (cond
    ((org-at-table-p)
     (org-table-wrap-region arg))
-   (t (org-insert-heading))))
+   (t (org-insert-heading arg))))
 
 ;;; Menu entries
 
--- a/lisp/tooltip.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/tooltip.el	Sun Dec 11 22:42:40 2005 +0000
@@ -30,6 +30,35 @@
 (defvar comint-prompt-regexp)
 
 ;;; Customizable settings
+;;; Switching tooltips on/off
+
+;; We don't set track-mouse globally because this is a big redisplay
+;; problem in buffers having a pre-command-hook or such installed,
+;; which does a set-buffer, like the summary buffer of Gnus.  Calling
+;; set-buffer prevents redisplay optimizations, so every mouse motion
+;; would be accompanied by a full redisplay.
+
+(define-minor-mode tooltip-mode
+  "Toggle Tooltip display.
+With ARG, turn tooltip mode on if and only if ARG is positive."
+  :global t
+  :init-value (not (or noninteractive
+		       emacs-basic-display
+		       (not (display-graphic-p))
+		       (not (fboundp 'x-show-tip))))
+  :initialize 'custom-initialize-safe-default
+  :group 'tooltip
+  (unless (or (null tooltip-mode) (fboundp 'x-show-tip))
+    (error "Sorry, tooltips are not yet available on this system"))
+  (if tooltip-mode
+      (progn
+	(add-hook 'pre-command-hook 'tooltip-hide)
+	(add-hook 'tooltip-hook 'tooltip-help-tips))
+    (unless (and (boundp 'gud-tooltip-mode) gud-tooltip-mode)
+      (remove-hook 'pre-command-hook 'tooltip-hide))
+    (remove-hook 'tooltip-hook 'tooltip-help-tips))
+  (setq show-help-function
+	(if tooltip-mode 'tooltip-show-help nil)))
 
 (defgroup tooltip nil
   "Customization group for the `tooltip' package."
@@ -145,36 +174,6 @@
   (let ((window (posn-window (event-end event))))
     (and window (window-buffer window))))
 
-;;; Switching tooltips on/off
-
-;; We don't set track-mouse globally because this is a big redisplay
-;; problem in buffers having a pre-command-hook or such installed,
-;; which does a set-buffer, like the summary buffer of Gnus.  Calling
-;; set-buffer prevents redisplay optimizations, so every mouse motion
-;; would be accompanied by a full redisplay.
-
-(define-minor-mode tooltip-mode
-  "Toggle Tooltip display.
-With ARG, turn tooltip mode on if and only if ARG is positive."
-  :global t
-  :init-value (not (or noninteractive
-		       emacs-basic-display
-		       (not (display-graphic-p))
-		       (not (fboundp 'x-show-tip))))
-  :initialize 'custom-initialize-safe-default
-  :group 'tooltip
-  (unless (or (null tooltip-mode) (fboundp 'x-show-tip))
-    (error "Sorry, tooltips are not yet available on this system"))
-  (if tooltip-mode
-      (progn
-	(add-hook 'pre-command-hook 'tooltip-hide)
-	(add-hook 'tooltip-hook 'tooltip-help-tips))
-    (unless (and (boundp 'gud-tooltip-mode) gud-tooltip-mode)
-      (remove-hook 'pre-command-hook 'tooltip-hide))
-    (remove-hook 'tooltip-hook 'tooltip-help-tips))
-  (setq show-help-function
-	(if tooltip-mode 'tooltip-show-help nil)))
-
 
 ;;; Timeout for tooltip display
 
--- a/lisp/wid-edit.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/wid-edit.el	Sun Dec 11 22:42:40 2005 +0000
@@ -852,6 +852,7 @@
 (defvar widget-keymap
   (let ((map (make-sparse-keymap)))
     (define-key map "\t" 'widget-forward)
+    (define-key map "\e\t" 'widget-backward)
     (define-key map [(shift tab)] 'widget-backward)
     (define-key map [backtab] 'widget-backward)
     (define-key map [down-mouse-2] 'widget-button-click)
--- a/lisp/window.el	Sat Dec 10 21:18:28 2005 +0000
+++ b/lisp/window.el	Sun Dec 11 22:42:40 2005 +0000
@@ -228,75 +228,201 @@
       (or (= (nth 2 edges) (nth 2 (window-edges (previous-window))))
 	  (= (nth 0 edges) (nth 0 (window-edges (next-window))))))))
 
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; `balance-windows' subroutines using `window-tree'
 
-(defun balance-windows ()
-  "Make all visible windows the same height (approximately)."
-  (interactive)
-  (let ((count -1) levels newsizes level-size
-	;; Don't count the lines that are above the uppermost windows.
-	;; (These are the menu bar lines, if any.)
-	(mbl (nth 1 (window-edges (frame-first-window (selected-frame)))))
-	(last-window (previous-window (frame-first-window (selected-frame))))
-	;; Don't count the lines that are past the lowest main window.
-	total)
-    ;; Bottom edge of last window determines what size we have to work with.
-    (setq total
-	  (+ (window-height last-window)
-	     (nth 1 (window-edges last-window))))
+;;; Translate from internal window tree format
+
+(defun bw-get-tree (&optional window-or-frame)
+  "Get a window split tree in our format.
+
+WINDOW-OR-FRAME must be nil, a frame, or a window.  If it is nil,
+then the whole window split tree for `selected-frame' is returned.
+If it is a frame, then this is used instead.  If it is a window,
+then the smallest tree containing that window is returned."
+  (when window-or-frame
+    (unless (or (framep window-or-frame)
+                (windowp window-or-frame))
+      (error "Not a frame or window: %s" window-or-frame)))
+  (let ((subtree (bw-find-tree-sub window-or-frame)))
+    (if (integerp subtree)
+        nil
+      (bw-get-tree-1 subtree))))
+
+(defun bw-get-tree-1 (split)
+  (if (windowp split)
+      split
+    (let ((dir (car split))
+          (edges (car (cdr split)))
+          (childs (cdr (cdr split))))
+      (list
+       (cons 'dir (if dir 'ver 'hor))
+       (cons 'b (nth 3 edges))
+       (cons 'r (nth 2 edges))
+       (cons 't (nth 1 edges))
+       (cons 'l (nth 0 edges))
+       (cons 'childs (mapcar #'bw-get-tree-1 childs))))))
+
+(defun bw-find-tree-sub (window-or-frame &optional get-parent)
+  (let* ((window (when (windowp window-or-frame) window-or-frame))
+         (frame (when (windowp window) (window-frame window)))
+         (wt (car (window-tree frame))))
+    (when (< 1 (length (window-list frame 0)))
+      (if window
+          (bw-find-tree-sub-1 wt window get-parent)
+        wt))))
+
+(defun bw-find-tree-sub-1 (tree win &optional get-parent)
+  (unless (windowp win) (error "Not a window: %s" win))
+  (if (memq win tree)
+      (if get-parent
+          get-parent
+        tree)
+    (let ((childs (cdr (cdr tree)))
+          child
+          subtree)
+      (while (and childs (not subtree))
+        (setq child (car childs))
+        (setq childs (cdr childs))
+        (when (and child (listp child))
+          (setq subtree (bw-find-tree-sub-1 child win get-parent))))
+      (if (integerp subtree)
+          (progn
+            (if (= 1 subtree)
+                tree
+              (1- subtree)))
+        subtree
+        ))))
+
+;;; Window or object edges
+
+(defun bw-l(obj)
+  "Left edge of OBJ."
+  (if (windowp obj) (nth 0 (window-edges obj)) (cdr (assq 'l obj))))
+(defun bw-t(obj)
+  "Top edge of OBJ."
+  (if (windowp obj) (nth 1 (window-edges obj)) (cdr (assq 't obj))))
+(defun bw-r(obj)
+  "Right edge of OBJ."
+  (if (windowp obj) (nth 2 (window-edges obj)) (cdr (assq 'r obj))))
+(defun bw-b(obj)
+  "Bottom edge of OBJ."
+  (if (windowp obj) (nth 3 (window-edges obj)) (cdr (assq 'b obj))))
+
+;;; Split directions
+
+(defun bw-dir(obj)
+  "Return window split tree direction if OBJ.
+If OBJ is a window return 'both. If it is a window split tree
+then return its direction."
+  (if (symbolp obj)
+      obj
+    (if (windowp obj)
+        'both
+      (let ((dir (cdr (assq 'dir obj))))
+        (unless (memq dir '(hor ver both))
+          (error "Can't find dir in %s" obj))
+        dir))))
 
-    ;; Find all the different vpos's at which windows start,
-    ;; then count them.  But ignore levels that differ by only 1.
-    (let (tops (prev-top -2))
-      (walk-windows (function (lambda (w)
-				(setq tops (cons (nth 1 (window-edges w))
-						 tops))))
-		    'nomini)
-      (setq tops (sort tops '<))
-      (while tops
-	(if (> (car tops) (1+ prev-top))
-	    (setq prev-top (car tops)
-		  count (1+ count)))
-	(setq levels (cons (cons (car tops) count) levels))
-	(setq tops (cdr tops)))
-      (setq count (1+ count)))
-    ;; Subdivide the frame into desired number of vertical levels.
-    (setq level-size (/ (- total mbl) count))
-    (save-selected-window
-      ;; Set up NEWSIZES to map windows to their desired sizes.
-      ;; If a window ends at the bottom level, don't include
-      ;; it in NEWSIZES.  Those windows get the right sizes
-      ;; by adjusting the ones above them.
-      (walk-windows (function
-		     (lambda (w)
-		       (let ((newtop (cdr (assq (nth 1 (window-edges w))
-						levels)))
-			     (newbot (cdr (assq (+ (window-height w)
-						   (nth 1 (window-edges w)))
-						levels))))
-			 (if newbot
-			     (setq newsizes
-				   (cons (cons w (* level-size (- newbot newtop)))
-					 newsizes))))))
-		    'nomini)
-      ;; Make walk-windows start with the topmost window.
-      (select-window (previous-window (frame-first-window (selected-frame))))
-      (let (done (count 0))
-	;; Give each window its precomputed size, or at least try.
-	;; Keep trying until they all get the intended sizes,
-	;; but not more than 3 times (to prevent infinite loop).
-	(while (and (not done) (< count 3))
-	  (setq done t)
-	  (setq count (1+ count))
-	  (walk-windows (function (lambda (w)
-				    (select-window w)
-				    (let ((newsize (cdr (assq w newsizes))))
-				      (when newsize
-					(enlarge-window (- newsize
-							   (window-height))
-							nil)
-					(unless (= (window-height) newsize)
-					  (setq done nil))))))
-			'nomini))))))
+(defun bw-eqdir(obj1 obj2)
+  "Return t if window split tree directions are equal.
+OBJ1 and OBJ2 should be either windows or window split trees in
+our format. The directions returned by `bw-dir' are compared and
+t is returned if they are `eq' or one of them is 'both."
+  (let ((dir1 (bw-dir obj1))
+        (dir2 (bw-dir obj2)))
+    (or (eq dir1 dir2)
+        (eq dir1 'both)
+        (eq dir2 'both))))
+
+;;; Building split tree
+
+(defun bw-refresh-edges(obj)
+  "Refresh the edge information of OBJ and return OBJ."
+  (unless (windowp obj)
+    (let ((childs (cdr (assq 'childs obj)))
+          (ol 1000)
+          (ot 1000)
+          (or -1)
+          (ob -1))
+      (dolist (o childs)
+        (when (> ol (bw-l o)) (setq ol (bw-l o)))
+        (when (> ot (bw-t o)) (setq ot (bw-t o)))
+        (when (< or (bw-r o)) (setq or (bw-r o)))
+        (when (< ob (bw-b o)) (setq ob (bw-b o))))
+      (setq obj (delq 'l obj))
+      (setq obj (delq 't obj))
+      (setq obj (delq 'r obj))
+      (setq obj (delq 'b obj))
+      (add-to-list 'obj (cons 'l ol))
+      (add-to-list 'obj (cons 't ot))
+      (add-to-list 'obj (cons 'r or))
+      (add-to-list 'obj (cons 'b ob))
+      ))
+  obj)
+
+;;; Balance windows
+
+(defun balance-windows(&optional window-or-frame)
+  "Make windows the same heights or widths in window split subtrees.
+
+When called non-interactively WINDOW-OR-FRAME may be either a
+window or a frame. It then balances the windows on the implied
+frame. If the parameter is a window only the corresponding window
+subtree is balanced."
+  (interactive)
+  (let (
+        (wt (bw-get-tree window-or-frame))
+        (w)
+        (h)
+        (tried-sizes)
+        (last-sizes)
+        (windows (window-list nil 0))
+        (counter 0))
+    (when wt
+      (while (not (member last-sizes tried-sizes))
+        (when last-sizes (setq tried-sizes (cons last-sizes tried-sizes)))
+        (setq last-sizes (mapcar (lambda(w)
+                                   (window-edges w))
+                                 windows))
+        (when (eq 'hor (bw-dir wt))
+          (setq w (- (bw-r wt) (bw-l wt))))
+        (when (eq 'ver (bw-dir wt))
+          (setq h (- (bw-b wt) (bw-t wt))))
+        (bw-balance-sub wt w h)))))
+
+(defun bw-adjust-window(window delta horizontal)
+  "Wrapper around `adjust-window-trailing-edge' with error checking.
+Arguments WINDOW, DELTA and HORIZONTAL are passed on to that function."
+  (condition-case err
+      (adjust-window-trailing-edge window delta horizontal)
+    (error
+     ;;(message "adjust: %s" (error-message-string err))
+     )))
+
+(defun bw-balance-sub(wt w h)
+  (setq wt (bw-refresh-edges wt))
+  (unless w (setq w (- (bw-r wt) (bw-l wt))))
+  (unless h (setq h (- (bw-b wt) (bw-t wt))))
+  (if (windowp wt)
+      (progn
+        (when w
+          (let ((dw (- w (- (bw-r wt) (bw-l wt)))))
+            (when (/= 0 dw)
+                (bw-adjust-window wt dw t))))
+        (when h
+          (let ((dh (- h (- (bw-b wt) (bw-t wt)))))
+            (when (/= 0 dh)
+              (bw-adjust-window wt dh nil)))))
+    (let* ((childs (cdr (assq 'childs wt)))
+           (lastchild (car (last childs)))
+           (cw (when w (/ w (if (bw-eqdir 'hor wt) (length childs) 1))))
+           (ch (when h (/ h (if (bw-eqdir 'ver wt) (length childs) 1)))))
+      (dolist (c childs)
+          (bw-balance-sub c cw ch)))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;; I think this should be the default; I think people will prefer it--rms.
 (defcustom split-window-keep-point t
--- a/lispref/ChangeLog	Sat Dec 10 21:18:28 2005 +0000
+++ b/lispref/ChangeLog	Sun Dec 11 22:42:40 2005 +0000
@@ -1,3 +1,12 @@
+2005-12-08  Richard M. Stallman  <rms@gnu.org>
+
+	* minibuf.texi (Intro to Minibuffers): Replace list of local maps
+	with xrefs and better explanation.
+	(Completion Commands): Add the filename completion maps.
+
+	* objects.texi (Character Type): Clarify that \s is not space
+	if a dash follows.
+
 2005-12-05  Richard M. Stallman  <rms@gnu.org>
 
 	* windows.texi (Resizing Windows): Delete preserve-before args.
--- a/lispref/minibuf.texi	Sat Dec 10 21:18:28 2005 +0000
+++ b/lispref/minibuf.texi	Sun Dec 11 22:42:40 2005 +0000
@@ -85,25 +85,12 @@
 @code{enable-recursive-minibuffers} or by putting properties of that
 name on command symbols (@pxref{Recursive Mini}).
 
-  Like other buffers, a minibuffer may use any of several local keymaps
-(@pxref{Keymaps}); these contain various exit commands and in some cases
-completion commands (@pxref{Completion}).
-
-@itemize @bullet
-@item
-@code{minibuffer-local-map} is for ordinary input (no completion).
-
-@item
-@code{minibuffer-local-ns-map} is similar, except that @key{SPC} exits
-just like @key{RET}.
-
-@item
-@code{minibuffer-local-completion-map} is for permissive completion.
-
-@item
-@code{minibuffer-local-must-match-map} is for strict completion and
-for cautious completion.
-@end itemize
+  Like other buffers, a minibuffer uses a local keymap
+(@pxref{Keymaps}) to specify special key bindings.  The function that
+invokes the minibuffer also sets up its local map according to the job
+to be done.  @xref{Text from Minibuffer}, for the non-completion
+minibuffer local maps.  @xref{Completion Commands}, for the minibuffer
+local maps for completion.
 
   When Emacs is running in batch mode, any request to read from the
 minibuffer actually reads a line from the standard input descriptor that
@@ -1034,6 +1021,16 @@
 with other characters bound as in @code{minibuffer-local-map}.
 @end defvar
 
+@defvar minibuffer-local-filename-completion-map
+This is like @code{minibuffer-local-completion-map}
+except that it does not bind @key{SPC}.
+@end defvar
+
+@defvar minibuffer-local-must-match-filename-map
+This is like @code{minibuffer-local-must-match-map}
+except that it does not bind @key{SPC}.
+@end defvar
+
 @node High-Level Completion
 @subsection High-Level Completion  Functions
 
--- a/lispref/objects.texi	Sat Dec 10 21:18:28 2005 +0000
+++ b/lispref/objects.texi	Sun Dec 11 22:42:40 2005 +0000
@@ -291,7 +291,8 @@
 vertical tab, formfeed, space, return, del, and escape as @samp{?\a},
 @samp{?\b}, @samp{?\t}, @samp{?\n}, @samp{?\v}, @samp{?\f},
 @samp{?\s}, @samp{?\r}, @samp{?\d}, and @samp{?\e}, respectively.
-Thus,
+(@samp{?\s} followed by a dash has a different meaning---it applies
+the ``super'' modifier to the following character.)  Thus,
 
 @example
 ?\a @result{} 7                 ; @r{control-g, @kbd{C-g}}
@@ -311,7 +312,7 @@
   These sequences which start with backslash are also known as
 @dfn{escape sequences}, because backslash plays the role of an
 ``escape character''; this terminology has nothing to do with the
-character @key{ESC}.  @samp{\s} is meant for use only in character
+character @key{ESC}.  @samp{\s} is meant for use in character
 constants; in string constants, just write the space.
 
 @cindex control characters
--- a/mac/ChangeLog	Sat Dec 10 21:18:28 2005 +0000
+++ b/mac/ChangeLog	Sun Dec 11 22:42:40 2005 +0000
@@ -1,3 +1,8 @@
+2005-12-10  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* Emacs.app/Contents/Info.plist: Add CFBundleURLTypes key and
+	data.  Make NSServices open-selection the first entry.
+
 2005-11-09  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
 	* makefile.MPW (shortlisp): Sync with src/Makefile.in.
--- a/mac/Emacs.app/Contents/Info.plist	Sat Dec 10 21:18:28 2005 +0000
+++ b/mac/Emacs.app/Contents/Info.plist	Sun Dec 11 22:42:40 2005 +0000
@@ -35,7 +35,18 @@
 	<string>EMAx</string>
 	<key>CFBundleVersion</key>
 	<string>1.1</string>
-	<key>NSServices</key>
+	<key>CFBundleURLTypes</key>
+	<array>
+		<dict>
+			<key>CFBundleURLName</key>
+			<string>Email Address URL</string>
+			<key>CFBundleURLSchemes</key>
+			<array>
+				<string>mailto</string>
+			</array>
+		</dict>
+	</array>
+  	<key>NSServices</key>
 	<array>
 		<dict>
 			<key>NSKeyEquivalent</key>
@@ -43,10 +54,10 @@
 			<key>NSMenuItem</key>
 			<dict>
 				<key>default</key>
-				<string>Emacs/Open Selected File</string>
+				<string>Emacs/New Buffer Containing Selection</string>
 			</dict>
 			<key>NSMessage</key>
-			<string>open-file</string>
+			<string>open-selection</string>
 			<key>NSPortName</key>
 			<string>Emacs</string>
 			<key>NSReturnTypes</key>
@@ -62,10 +73,10 @@
 			<key>NSMenuItem</key>
 			<dict>
 				<key>default</key>
-				<string>Emacs/New Buffer Containing Selection</string>
+				<string>Emacs/Open Selected File</string>
 			</dict>
 			<key>NSMessage</key>
-			<string>open-selection</string>
+			<string>open-file</string>
 			<key>NSPortName</key>
 			<string>Emacs</string>
 			<key>NSReturnTypes</key>
--- a/man/ChangeLog	Sat Dec 10 21:18:28 2005 +0000
+++ b/man/ChangeLog	Sun Dec 11 22:42:40 2005 +0000
@@ -1,3 +1,145 @@
+2005-12-10  Romain Francoise  <romain@orebokech.com>
+
+	Update the Emacs FAQ for the 22.1 release.
+
+	* faq.texi: Set VER to `22.1'.
+	(Basic editing): Explain how to use localized versions of the
+	Tutorial.  Mention that `C-h r' displays the manual.  Delete
+	obsolete WWW link to an Emacs 18 tutorial.
+	(Getting a printed manual): Point to the new locations of the
+	manuals on the GNU Web site.
+	(Emacs Lisp documentation): Explain that the Emacs Lisp manual is
+	available via Info (it was previously distributed separately).
+	(Installing Texinfo documentation): The latest version of Texinfo
+	is 4.8, not 4.0.
+	(Informational files for Emacs): COPYING is the GNU General Public
+	License, not the Emacs General Public License.
+	(Informational files for Emacs): Delete obsolete link to the
+	GNUinfo pages as they have been removed from the GNU Web site.
+	(New in Emacs 22): New node.
+	(Setting up a customization file): Say that most packages support
+	Customize nowadays.
+	(Colors on a TTY): Delete reference to instructions on how to
+	enable syntax highlighting, it is now enabled by default.
+	(Turning on abbrevs by default): Emacs now reads the abbrevs file
+	at startup automatically.
+	(Controlling case sensitivity): Mention `M-c' in isearch.
+	(Using an already running Emacs process): Emacs now creates the
+	socket in `/tmp/emacsUID'.  Fix typos.  Change default location of
+	gnuserv.  As emacsclient can now run Lisp code as well, delete a
+	sentence praising gnuserv for that.  Simplify description of how
+	the client/server operation works.
+	(Compiler error messages): Delete obsolete text (compile.el has
+	been rewritten).
+	(Indenting switch statements): Fix typo.
+	(Matching parentheses): Simplify setup instructions, mention the
+	menu bar item in the Options menu.
+	(Repeating a command as many times as possible): Mention `C-x e'.
+	(Going to a line by number): Mention new keymap and bindings
+	`M-g M-g', `M-g M-p' and `M-g M-n'.
+	(Turning on syntax highlighting): Now on by default.  Simplify.
+	(Replacing highlighted text): Use `1', not `t'.
+	(Problems with very large files): The maximum size is now 256MB on
+	32-bit machines.
+	(^M in the shell buffer): Mention `comint-process-echoes'.
+	(Emacs for Apple computers): Emacs 22 has native support for Mac
+	OS X.
+	(Translating names to IP addresses): Delete node.
+	(Binding keys to commands): Fix typo.
+	(SPC no longer completes file names): New node.
+	(MIME with Emacs mail packages): Delete section about the Emacs
+	MIME FAQ (it's not reachable anymore).
+
+2005-12-10  David Koppelman  <koppel@ece.lsu.edu>
+
+	* display.texi (Highlight Interactively): Include
+	global-hi-lock-mode.  Add miscellaneous details and elaborations.
+
+2005-12-09  Richard M. Stallman  <rms@gnu.org>
+
+	* display.texi (Font Lock): Delete the Global FL menu item.
+
+2005-12-09  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* custom.texi (Minibuffer Maps): Mention the maps for file name
+	completion.
+
+2005-12-09  Kim F. Storm  <storm@cua.dk>
+
+	* killing.texi (CUA Bindings): Describe how to use C-x and C-c as
+	prefix keys even when mark is active.  Decribe that RET moves
+	cursor to next corner in rectangle; clarify insert around rectangle.
+
+2005-12-05  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* pgg.texi (User Commands): Fix description of pgg-verify-region.
+	(Selecting an implementation): Fix descriptions.
+
+2005-11-30  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* message.texi (Various Message Variables): Addition.
+
+2005-11-29  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* message.texi: Fix default values.
+
+2005-11-25  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* message.texi (Header Commands): Clarify descriptions of
+	message-cross-post-followup-to, message-reduce-to-to-cc, and
+	message-insert-wide-reply.
+	(Various Commands): Fix kindex for message-kill-to-signature;
+	clarify description of message-tab.
+
+2005-11-22  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* message.texi (Mailing Lists): Fix description about MFT.
+
+	* gnus.texi (Emacs Lisp): Use ~/.gnus.el instead of ~/.emacs.
+
+2005-11-17  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* gnus.texi (Slow Terminal Connection): Replace old description
+	with new one.
+
+2005-11-16  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* gnus.texi (Oort Gnus): Use ~/.gnus.el instead of ~/.emacs;
+	replace X-Draft-Headers with X-Draft-From.
+
+2005-11-14  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* gnus.texi (Various Various): Fix the default value of
+	nnheader-max-head-length.
+	(Gnus Versions): Fix typo.
+
+2005-12-08  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* custom.texi (Customization): Use xref to elisp manual for
+	non-TeX output.
+	(Minor Modes): Update.
+	(Customization Groups, Changing a Variable, Face Customization):
+	Update for new appearance of Custom buffers.
+	(Changing a Variable): `custom-buffer-done-function' has been
+	replaced by `custom-buffer-done-kill'.
+	(Specific Customization): In the `customize-group' buffer, a
+	subgroup's contents are not "hidden".  They are not included at
+	all.  They have no [Show] button.
+	(Mouse Buttons): Add pxref to description of mouse event lists in
+	Elisp manual.  Add `menu-bar' and `header-line' dummy prefix keys.
+	(Find Init): Emacs now looks for ~/.emacs.d/init.el instead of
+	~/.emacs.d/.emacs, if it can not find ~/.emacs(.el).
+
+2005-12-08  Richard M. Stallman  <rms@gnu.org>
+
+	* mini.texi (Completion Commands, Completion):
+	In file name input, SPC does not do completion.
+
+2005-12-08  Carsten Dominik  <dominik@science.uva.nl>
+
+	* org.texi (Structure editing): Document new functionality of
+	M-RET.
+
 2005-12-08  Nick Roberts  <nickrob@snap.net.nz>
 
 	* building.texi (GDB Graphical Interface): Explain screen size
@@ -30,11 +172,11 @@
 
 2005-11-28  Jay Belanger  <belanger@truman.edu>
 
-	* calc.texi:  Change references of `M-#' to `C-x *' prefix.
+	* calc.texi: Change references of `M-#' to `C-x *' prefix.
 
 2005-11-24  Carsten Dominik  <dominik@science.uva.nl>
 
-	* org.texi: (Structure editing): New item moving commands added.
+	* org.texi (Structure editing): New item moving commands added.
 	(Plain Lists): New section.
 
 2005-11-24  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
@@ -82,7 +224,7 @@
 
 2005-11-18  Carsten Dominik  <dominik@science.uva.nl>
 
-	* org.texi: (FAQ): Document `org-table-tab-jumps-over-hlines'.
+	* org.texi (FAQ): Document `org-table-tab-jumps-over-hlines'.
 	(Agenda): Document commands `org-cycle-agenda-files' and
 	`org-agenda-file-to-front'
 	(Built-in table editor): Document `org-table-sort-lines'.
--- a/man/custom.texi	Sat Dec 10 21:18:28 2005 +0000
+++ b/man/custom.texi	Sun Dec 11 22:42:40 2005 +0000
@@ -7,8 +7,15 @@
 @cindex customization
 
   This chapter talks about various topics relevant to adapting the
-behavior of Emacs in minor ways.  See @cite{The Emacs Lisp Reference
-Manual} for how to make more far-reaching changes.  @xref{X Resources},
+behavior of Emacs in minor ways.
+@iftex
+See @cite{The Emacs Lisp Reference Manual}
+@end iftex
+@ifnottex
+@xref{Top, Emacs Lisp, Emacs Lisp, elisp, The Emacs Lisp
+Reference Manual},
+@end ifnottex
+for how to make more far-reaching changes.  @xref{X Resources},
 for information on using X resources to customize Emacs.
 
   Customization that you do within Emacs normally affects only the
@@ -52,8 +59,8 @@
 that Auto Fill mode is on.
 
   Append @code{-mode} to the name of a minor mode to get the name of a
-command function that turns the mode on or off.  Thus, the command to
-enable or disable Auto Fill mode is called @kbd{M-x auto-fill-mode}.  These
+command that turns the mode on or off.  Thus, the command to
+enable or disable Auto Fill mode is called @code{auto-fill-mode}.  These
 commands are usually invoked with @kbd{M-x}, but you can bind keys to them
 if you wish.  With no argument, the function turns the mode on if it was
 off and off if it was on.  This is known as @dfn{toggling}.  A positive
@@ -66,21 +73,25 @@
 the mode in certain buffers and not others.
 
   For most minor modes, the command name is also the name of a
-variable which directly controls the mode.  The mode is enabled
-whenever this variable's value is non-@code{nil}, and the minor-mode
-command works by setting the variable.  For example, the command
-@code{outline-minor-mode} works by setting the value of
-@code{outline-minor-mode} as a variable; it is this variable that
-directly turns Outline minor mode on and off.  To check whether a
-given minor mode works this way, use @kbd{C-h v} to ask for
-documentation on the variable name.
-
-  These minor-mode variables provide a good way for Lisp programs to
-turn minor modes on and off; they are also useful in a file's local
-variables list (@pxref{File Variables}).  But please think twice
-before setting minor modes with a local variables list, because most
-minor modes are a matter of user preference---other users editing the
-same file might not want the same minor modes you prefer.
+variable.  The variable's value is non-@code{nil} if the mode is
+enabled and @code{nil} if it is disabled.  Some minor-mode commands
+work by just setting the variable.  For example, the command
+@code{abbrev-mode} works by setting the value of @code{abbrev-mode} as
+a variable; it is this variable that directly turns Abbrev mode on and
+off.  You can directly set the variable's value instead of calling the
+mode function.  For other minor modes, you need to either set the
+variable through the Customize interface or call the mode function to
+correctly enable or disable the mode.  To check which of these two
+possibilities applies to a given minor mode, use @kbd{C-h v} to ask
+for documentation on the variable name.
+
+  For minor mode commands that work by just setting the minor mode
+variable, that variable provides a good way for Lisp programs to turn
+minor modes on and off; it is also useful in a file's local variables
+list (@pxref{File Variables}).  But please think twice before setting
+minor modes with a local variables list, because most minor modes are
+a matter of user preference---other users editing the same file might
+not want the same minor modes you prefer.
 
   The most useful buffer-local minor modes include Abbrev mode, Auto
 Fill mode, Auto Save mode, Font-Lock mode, Glasses mode, ISO Accents
@@ -144,9 +155,10 @@
 octal character code, as usual.
 
   Here are some useful minor modes that normally apply to all buffers
-at once.  Since each is enabled or disabled by the value of a
+at once.  Since Line Number mode and Transient Mark mode can be
+enabled or disabled just by setting the value of the minor mode
 variable, you @emph{can} set them differently for particular buffers,
-by explicitly making the corresponding variables local in those
+by explicitly making the corresponding variable local in those
 buffers.  @xref{Locals}.
 
   Icomplete mode displays an indication of available completions when
@@ -166,7 +178,7 @@
 will get an error.  This means you must either set the mark, or
 explicitly ``reactivate'' it, before each command that uses the region.
 The advantage of Transient Mark mode is that Emacs can display the
-region highlighted (currently only when using X).  @xref{Mark}.
+region highlighted.  @xref{Mark}.
 
 @node Easy Customization
 @section Easy Customization Interface
@@ -274,7 +286,7 @@
 @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{[Variable]} or @samp{[Face]}.  Invoking
+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.
@@ -286,16 +298,16 @@
 customization buffer:
 
 @smallexample
-Kill Ring Max: [Hide] 60
-   [State]: this variable is unchanged from its standard setting.
+Kill Ring Max: [Hide Value] 60
+   [State]: STANDARD.
 Maximum length of kill ring before oldest elements are thrown away.
 @end smallexample
 
-  The text following @samp{[Hide]}, @samp{60} in this case, indicates
-the current value of the variable.  If you see @samp{[Show]} instead of
-@samp{[Hide]}, it means that the value is hidden; the customization
+  The text following @samp{[Hide Value]}, @samp{60} in this case, indicates
+the current value of the variable.  If you see @samp{[Show Value]} instead of
+@samp{[Hide Value]}, it means that the value is hidden; the customization
 buffer initially hides values that take up several lines.  Invoke
-@samp{[Show]} to show the value.
+@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
@@ -317,7 +329,8 @@
 change to say that you have edited the value:
 
 @smallexample
-[State]: you have edited the value as text, but not set the variable.
+[State]: EDITED, shown value does not take effect until you set or @r{@dots{}}
+                                                           save it.
 @end smallexample
 
 @cindex setting option value
@@ -328,7 +341,7 @@
   The state of the variable changes visibly when you set it:
 
 @smallexample
-[State]: you have set this variable, but not saved it for future sessions.
+[State]: SET for current session only.
 @end smallexample
 
    You don't have to worry about specifying a value that is not valid;
@@ -355,7 +368,7 @@
 is how it appears in the customization buffer:
 
 @smallexample
-File Coding System Alist: [Hide]
+File Coding System Alist: [Hide Value]
 [INS] [DEL] File regexp: \.elc\'
             Choice: [Value Menu] Encoding/decoding pair:
             Decoding: emacs-mule
@@ -373,8 +386,9 @@
             Decoding: undecided
             Encoding: nil
 [INS]
-   [State]: this variable is unchanged from its standard setting.
-Alist to decide a coding system to use for a file I/O operation. [Hide]
+   [State]: STANDARD.
+Alist to decide a coding system to use for a file I/O @r{@dots{}}
+                                operation. [Hide Rest]
 The format is ((PATTERN . VAL) ...),
 where PATTERN is a regular expression matching a file name,
 @r{[@dots{}more lines of documentation@dots{}]}
@@ -420,10 +434,10 @@
 
   You can also restore the variable to its standard value by invoking
 @samp{[State]} and selecting the @samp{Erase Customization} operation.
-There are actually three reset operations:
+There are actually four reset operations:
 
 @table @samp
-@item Reset
+@item Reset to Current
 If you have made some modifications and not yet set the variable,
 this restores the text in the customization buffer to match
 the actual value.
@@ -452,28 +466,25 @@
 the same variable in a customization buffer, even in another session.
 
   The state of a group indicates whether anything in that group has been
-edited, set or saved.  You can select @samp{Set for Current Session},
-@samp{Save for Future Sessions} and the various kinds of @samp{Reset}
-operation for the group; these operations on the group apply to all
-options in the group and its subgroups.
+edited, set or saved.
 
   Near the top of the customization buffer there are two lines
 containing several active fields:
 
 @smallexample
  [Set for Current Session] [Save for Future Sessions]
- [Reset] [Reset to Saved] [Erase Customization]   [Finish]
+ [Reset to Current] [Reset to Saved] [Erase Customization]   [Finish]
 @end smallexample
 
 @vindex custom-buffer-done-function
 @noindent
 Invoking @samp{[Finish]} either buries or kills this customization
 buffer according to the setting of the option
-@code{custom-buffer-done-function}; the default is to bury the buffer.
+@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.
+are hidden, nor on subgroups.
 
 @node Saving Customizations
 @subsection Saving Customizations
@@ -529,10 +540,10 @@
 example of how a face looks:
 
 @smallexample
-Custom Changed Face:(sample) [Hide]
-   [State]: this face is unchanged from its standard setting.
+Custom Changed Face:(sample) [Hide Face]
+   [State]: STANDARD.
 Face used when the customize item has been changed.
-Parent groups: => Custom Magic Faces
+Parent groups: [Custom Magic Faces]
 Attributes: [ ] Font Family: *
             [ ] Width: *
             [ ] Height: *
@@ -556,7 +567,7 @@
 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
+list-colors-display} for a list of them) or a hexadecimal color
 specification of the form @samp{#@var{rr}@var{gg}@var{bb}}.
 (@samp{#000000} is black, @samp{#ff0000} is red, @samp{#00ff00} is
 green, @samp{#0000ff} is blue, and @samp{#ffffff} is white.)  On a
@@ -627,16 +638,15 @@
   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
-as well.  However, these subgroups' own contents start out hidden.  You
-can show their contents in the usual way, by invoking @samp{[Show]}.
+as well.  However, these 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 options, faces 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 in the
-customization buffer (but that takes a long time).
+expression, this includes @emph{all} groups, options and faces (but
+that takes a long time).
 
 @findex customize-changed-options
   When you upgrade to a new Emacs version, you might want to customize
@@ -1396,6 +1406,8 @@
 @vindex minibuffer-local-ns-map
 @vindex minibuffer-local-completion-map
 @vindex minibuffer-local-must-match-map
+@vindex minibuffer-local-filename-completion-map
+@vindex minibuffer-local-must-match-filename-map
   The minibuffer has its own set of local keymaps; they contain various
 completion and exit commands.
 
@@ -1410,6 +1422,11 @@
 @item
 @code{minibuffer-local-must-match-map} is for strict completion and
 for cautious completion.
+@item
+@code{minibuffer-local-filename-completion-map} and
+@code{minibuffer-local-must-match-filename-map} are like the two
+previous ones, but they are specifically for file name completion.
+They do not bind @key{SPC}.
 @end itemize
 
 @node Rebinding
@@ -1688,9 +1705,9 @@
 @cindex keypad
   Many keyboards have a ``numeric keypad'' on the right hand side.
 The numeric keys in the keypad double up as cursor motion keys,
-toggled by a key labelled @samp{Num Lock}.  By default, Emacs
+toggled by a key labeled @samp{Num Lock}.  By default, Emacs
 translates these keys to the corresponding keys in the main keyboard.
-For example, when @samp{Num Lock} is on, the key labelled @samp{8} on
+For example, when @samp{Num Lock} is on, the key labeled @samp{8} on
 the numeric keypad produces @code{kp-8}, which is translated to
 @kbd{8}; when @samp{Num Lock} is off, the same key produces
 @code{kp-up}, which is translated to @key{UP}.  If you rebind a key
@@ -1825,12 +1842,13 @@
   Emacs also supports triple-click events whose names start with
 @samp{triple-}.  Emacs does not distinguish quadruple clicks as event
 types; clicks beyond the third generate additional triple-click events.
-However, the full number of clicks is recorded in the event list, so you
-can distinguish if you really want to.  We don't recommend distinct
-meanings for more than three clicks, but sometimes it is useful for
-subsequent clicks to cycle through the same set of three meanings, so
-that four clicks are equivalent to one click, five are equivalent to
-two, and six are equivalent to three.
+However, the full number of clicks is recorded in the event list, so
+if you know Emacs Lisp you can distinguish if you really want to
+(@pxref{Accessing Events,,, elisp, The Emacs Lisp Reference Manual}).
+We don't recommend distinct meanings for more than three clicks, but
+sometimes it is useful for subsequent clicks to cycle through the same
+set of three meanings, so that four clicks are equivalent to one
+click, five are equivalent to two, and six are equivalent to three.
 
   Emacs also records multiple presses in drag and button-down events.
 For example, when you press a button twice, then move the mouse while
@@ -1848,7 +1866,7 @@
 
 @vindex double-click-fuzz
   The variable @code{double-click-fuzz} specifies how much the mouse
-can move between clicks still allow them to be grouped as a multiple
+can move between clicks and still allow them to be grouped as a multiple
 click.  Its value is in units of pixels on windowed displays and in
 units of 1/8 of a character cell on text-mode terminals; the default is
 3.
@@ -1882,6 +1900,10 @@
 @item vertical-scroll-bar
 The mouse was in a vertical scroll bar.  (This is the only kind of
 scroll bar Emacs currently supports.)
+@item menu-bar
+The mouse was in the menu bar.
+@item header-line
+The mouse was in a header line.
 @ignore
 @item horizontal-scroll-bar
 The mouse was in a horizontal scroll bar.  Horizontal scroll bars do
@@ -2397,9 +2419,10 @@
 @subsection How Emacs Finds Your Init File
 
   Normally Emacs uses the environment variable @env{HOME} to find
-@file{.emacs}; that's what @samp{~} means in a file name.  If @file{.emacs}
-is not found directly inside @file{~/}, Emacs looks for it in
-@file{~/.emacs.d/}.
+@file{.emacs}; that's what @samp{~} means in a file name.  If
+@file{.emacs} is not found inside @file{~/} (nor @file{.emacs.el}),
+Emacs looks for @file{~/.emacs.d/init.el} (which, like
+@file{~/.emacs.el}, can be byte-compiled).
 
   However, if you run Emacs from a shell started by @code{su}, Emacs
 tries to find your own @file{.emacs}, not that of the user you are
--- a/man/display.texi	Sat Dec 10 21:18:28 2005 +0000
+++ b/man/display.texi	Sun Dec 11 22:42:40 2005 +0000
@@ -274,10 +274,6 @@
 (global-font-lock-mode 0)
 @end example
 
-@noindent
-Global Font Lock mode can also be set using the menu bar Options menu,
-specifying first Syntax Highlighting and then Save Options.
-
 @findex turn-on-font-lock
   If you have disabled Global Font Lock mode, you can still enable font
 lock for specific major modes by adding the function
@@ -393,35 +389,48 @@
 @cindex highlighting by matching
 @cindex interactive highlighting
 
-  It is sometimes useful to highlight the strings that match a certain
-regular expression.  For example, you might wish to see all the
-references to a certain variable in a program source file, or highlight
-certain parts in a voluminous output of some program, or make certain
-cliches stand out in an article.
+  It is sometimes useful to temporarily highlight text that
+matches a certain regular expression.  For example, you might wish to
+see all the references to a certain variable in a program source file,
+highlight certain parts in a voluminous output of some program, or
+make certain names stand out in an article.
 
 @findex hi-lock-mode
   Use the @kbd{M-x hi-lock-mode} command to turn on a minor mode that
-allows you to specify regular expressions of the text to be
-highlighted.  Hi-lock mode works like Font Lock (@pxref{Font Lock}),
-except that it lets you specify explicitly what parts of text to
-highlight.  You control Hi-lock mode with these commands:
+allows you to interactively add and remove regular expressions
+specifying text to be highlighted.  Hi Lock mode works like Font Lock
+mode (@pxref{Font Lock}), except that it lets you easily add and
+remove regular expressions while you are editing a buffer.  To enable
+Hi Lock mode for all buffers use @kbd{M-x global-hi-lock-mode} or
+place @code{(global-hi-lock-mode 1)} in your @file{.emacs} file.
+
+You control Hi Lock mode with these commands:
 
 @table @kbd
 @item C-x w h @var{regexp} @key{RET} @var{face} @key{RET}
 @kindex C-x w h
 @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.
+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
+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
+them.
 
 @item C-x w r @var{regexp} @key{RET}
 @kindex C-x w r
 @findex unhighlight-regexp
-Unhighlight @var{regexp} (@code{unhighlight-regexp}).  You must enter
-one of the regular expressions currently specified for highlighting.
-(You can use completion, or choose from a menu, to enter one of them
-conveniently.)
+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
+the expression to unhighlight appears press @kbd{@key{RET}} to unhighlight
+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
@@ -440,7 +449,7 @@
 @code{hi-lock-write-interactive-patterns} command.
 
 These patterns will be read the next time you visit the file while
-Hi-lock mode is enabled, or whenever you use the @kbd{M-x
+Hi Lock mode is enabled, or whenever you use the @kbd{M-x
 hi-lock-find-patterns} command.
 
 @item C-x w i
@@ -448,8 +457,14 @@
 @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}).  The list of pairs is
-found no matter where in the buffer it may be.
+(@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
+including different faces for different parenthesized parts of the
+match, and finally use this command
+(@code{hi-lock-write-interactive-patterns}) to have Hi Lock highlight
+them.
 
 This command does nothing if the major mode is a member of the list
 @code{hi-lock-exclude-modes}.
--- a/man/faq.texi	Sat Dec 10 21:18:28 2005 +0000
+++ b/man/faq.texi	Sun Dec 11 22:42:40 2005 +0000
@@ -7,7 +7,7 @@
 @setchapternewpage odd
 
 @c This is used in many places
-@set VER 21.3
+@set VER 22.1
 
 @copying
 Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
@@ -30,8 +30,8 @@
 the FAQ may not be embedded in a larger literary work unless that work
 itself allows free copying and redistribution.
 
-[This version has been somewhat edited from the last-posted version
-(as of August 1999) for inclusion in the Emacs distribution.]
+[This version has been heavily edited since it was included in the Emacs
+distribution.]
 @end quotation
 @end copying
 
@@ -556,8 +556,11 @@
 @cindex Self-paced tutorial, invoking the
 @cindex Help system, entering the
 
-Type @kbd{C-h t} to invoke the self-paced tutorial.  Just typing @kbd{C-h}
-enters the help system.
+Type @kbd{C-h t} to invoke the self-paced tutorial.  Just typing
+@kbd{C-h} enters the help system.  Starting with Emacs 22, the tutorial
+is available in many foreign languages such as French, German, Japanese,
+Russian, etc.  Use @kbd{M-x help-with-tutorial-spec-language @key{RET}}
+to choose your language and start the tutorial.
 
 Your system administrator may have changed @kbd{C-h} to act like
 @key{DEL} to deal with local keyboards.  You can use @kbd{M-x
@@ -570,11 +573,6 @@
 Emacs help works best if it is invoked by a single key whose value
 should be stored in the variable @code{help-char}.
 
-There is also a WWW-based tutorial for Emacs 18, much of which is also
-relevant for later versions of Emacs, available at
-
-@uref{http://kufacts.cc.ukans.edu/cwis/writeups/misc/emacsguide.html}
-
 @node Learning how to do something, Getting a printed manual, Basic editing, Getting help
 @section How do I find out how to do something in Emacs?
 @cindex Help for Emacs
@@ -589,9 +587,9 @@
 @cindex Reading the Emacs manual
 @item
 The complete text of the Emacs manual is available on-line via the Info
-hypertext reader.  Type @kbd{C-h i} to invoke Info.  Typing @key{h}
-immediately after entering Info will provide a short tutorial on how to
-use it.
+hypertext reader.  Type @kbd{C-h r} to display the manual in Info mode.
+Typing @key{h} immediately after entering Info will provide a short
+tutorial on how to use it.
 
 @cindex Lookup a subject in a manual
 @cindex Index search in a manual
@@ -668,12 +666,12 @@
 If you absolutely have to print your own copy, and you don't have @TeX{},
 you can get a PostScript version from
 
-@uref{http://www.gnu.org/manual/emacs/ps/emacs.ps.gz}
+@uref{http://www.gnu.org/software/emacs/manual/emacs.ps.gz}
 
 @cindex HTML version of Emacs manual, obtaining
 An HTML version of the manual is at
 
-@uref{www.gnu.org/manual/emacs/index.html}
+@uref{http://www.gnu.org/software/emacs/manual/emacs.html}
 
 @xref{Learning how to do something}, for how to view the manual on-line.
 
@@ -688,24 +686,16 @@
 Within Emacs, you can type @kbd{C-h f} to get the documentation for a
 function, @kbd{C-h v} for a variable.
 
-For more information, obtain the Emacs Lisp Reference Manual.  Details
-on ordering it from FSF are on the
-@uref{http://www.gnu.org/order/order.html, GNU Web site}.
-
-The Emacs Lisp Reference Manual is also available on-line, in Info
-format.  Texinfo source for the manual (along with pregenerated Info
-files) is available at
-
-@uref{ftp://ftp.gnu.org/pub/gnu/emacs/elisp-manual-21-2.6.tar.gz}
-
-and all mirrors of @samp{ftp.gnu.org} (for a list, @pxref{Current GNU
-distributions}).  @xref{Installing Texinfo documentation}, if you want
-to install the Info files, or @ref{Printing a Texinfo file}, if you want
-to use the Texinfo source to print the manual yourself.
+For more information, the Emacs Lisp Reference Manual is available
+on-line, in Info format.  @xref{Top, Emacs Lisp,, elisp, The
+Emacs Lisp Reference Manual}.
+
+You can also order a hardcopy of the manual, details on ordering it from
+FSF are on the @uref{http://www.gnu.org/order/order.html, GNU Web site}.
 
 An HTML version of the Emacs Lisp Reference Manual is available at
 
-@uref{http://www.gnu.org/manual/elisp-manual-21-2.6/elisp.html}
+@uref{http://www.gnu.org/software/emacs/elisp-manual/elisp.html}
 
 @node Installing Texinfo documentation, Printing a Texinfo file, Emacs Lisp documentation, Getting help
 @section How do I install a piece of Texinfo documentation?
@@ -719,7 +709,7 @@
 using the stand-alone @file{makeinfo} program, available as part of the latest
 Texinfo package at
 
-@uref{ftp://ftp.gnu.org/pub/gnu/texinfo/texinfo-4.0.tar.gz}
+@uref{ftp://ftp.gnu.org/pub/gnu/texinfo/texinfo-4.8.tar.gz}
 
 and all mirrors of @samp{ftp.gnu.org} (for a list, @pxref{Current GNU
 distributions}).
@@ -903,7 +893,7 @@
 @table @file
 
 @item COPYING
-Emacs General Public License
+GNU General Public License
 
 @item DISTRIB
 Emacs Availability Information, including the popular Free Software
@@ -939,10 +929,6 @@
 
 @end table
 
-Latest versions of the above files also available at
-
-@uref{ftp://ftp.gnu.org/pub/gnu/GNUinfo/}
-
 More GNU information, including back issues of the @cite{GNU's
 Bulletin}, are at
 
@@ -1049,6 +1035,7 @@
 * Latest version of Emacs::
 * New in Emacs 20::
 * New in Emacs 21::
+* New in Emacs 22::
 @end menu
 
 @node Origin of the term Emacs, Latest version of Emacs, Status of Emacs, Status of Emacs
@@ -1112,7 +1099,7 @@
 and are now included with the standard distribution.
 
 
-@node New in Emacs 21, , New in Emacs 20, Status of Emacs
+@node New in Emacs 21, New in Emacs 22, New in Emacs 20, Status of Emacs
 @section What is different about Emacs 21?
 @cindex Differences between Emacs 20 and Emacs 21
 @cindex Emacs 21, new features in
@@ -1134,6 +1121,39 @@
 that you can now have colors when you run Emacs on a GNU/Linux console
 and on @code{xterm} with @kbd{emacs -nw}.
 
+@node New in Emacs 22, , New in Emacs 21, Status of Emacs
+@section What is different about Emacs 22?
+@cindex Differences between Emacs 21 and Emacs 22
+@cindex Emacs 22, new features in
+@cindex Recently introduced features
+
+@c FIXME: Improve this node before the 22.1 release.
+@cindex Default features
+Font-lock mode, auto-compression mode, and file name shadow mode are now
+enabled by default.  It is now possible to follow links with
+@kbd{mouse-1}.
+
+@cindex Supported systems
+Emacs 22 features support for GNU/Linux systems on S390 and X86-64
+machines, as well as support for the Mac OS X and Cygwin operating
+systems.
+
+@cindex GTK+ Toolkit
+@cindex Drag-and-drop
+@cindex Mouse wheel
+Emacs can now be built with GTK+ widgets, and supports drag-and-drop
+operation on X.  Mouse wheel support is now enabled by default.
+
+@cindex New modes
+Many new modes and packages have been included in Emacs, such as Leim,
+Calc, Tramp and URL, as well as IDO, CUA, rcirc, conf-mode,
+python-mode, table, tumme, SES, ruler, Flymake, Org, etc.
+
+@cindex Documentation
+@cindex Emacs Lisp Manual
+In addition, Emacs 22 now includes the Emacs Lisp Reference Manual
+(@pxref{Emacs Lisp documentation}) and the Emacs Lisp Intro.
+
 @c ------------------------------------------------------------
 @node    Common requests, Bugs and problems, Status of Emacs, Top
 @chapter Common requests
@@ -1205,12 +1225,11 @@
 @email{help-gnu-emacs@@gnu.org} asking why Emacs isn't behaving as
 documented.
 
-Beginning with version 20.1, Emacs includes the new Customize
-facility, which can be invoked using @kbd{M-x customize @key{RET}}.
-This allows users who are unfamiliar with Emacs Lisp to modify their
-@file{.emacs} files in a relatively straightforward way, using menus
-rather than Lisp code.  Not all packages support Customize as of this
-writing, but the number is growing fairly steadily.
+Beginning with version 20.1, Emacs includes the new Customize facility,
+which can be invoked using @kbd{M-x customize @key{RET}}.  This allows
+users who are unfamiliar with Emacs Lisp to modify their @file{.emacs}
+files in a relatively straightforward way, using menus rather than Lisp
+code.  Most packages support Customize as of this writing.
 
 While Customize might indeed make it easier to configure Emacs,
 consider taking a bit of time to learn Emacs Lisp and modifying your
@@ -1240,8 +1259,7 @@
 The command @kbd{M-x list-colors-display} pops up a window which
 exhibits all the colors Emacs knows about on the current display.
 
-Syntax highlighting is usually turned off by default; see @ref{Turning
-on syntax highlighting}, for instructions how to turn it on.
+Syntax highlighting is on by default since version 22.1.
 
 @node Debugging a customization file, Displaying the current line or column, Colors on a TTY, Common requests
 @section How do I debug a @file{.emacs} file?
@@ -1362,6 +1380,9 @@
            (setq abbrev-mode t)))
 @end lisp
 
+Starting with Emacs 22, the standard abbrevs file is read automatically
+at startup, so the first of these two forms becomes unnecessary.
+
 @node Turning on auto-fill by default, Associating modes with files, Turning on abbrevs by default, Common requests
 @section How do I turn on @code{auto-fill-mode} by default?
 @cindex @code{auto-fill-mode}, activating automatically
@@ -1510,6 +1531,8 @@
 Similarly, for replacing, the variable @code{case-replace} determines
 whether replacements preserve case.
 
+You can also toggle case sensitivity at will in isearch with @kbd{M-c}.
+
 To change the case sensitivity just for one major mode, use the major
 mode's hook.  For example:
 
@@ -1597,10 +1620,9 @@
 (if (@var{some conditions are met}) (server-start))
 @end lisp
 
-When this is done, Emacs creates a Unix domain socket.
-The socket is either named @file{.emacs_server}, in the user's home directory,
-or @file{esrv-@var{userid}-@var{systemname}}, in the @file{/tmp}
-directory, depending on your system.  See @code{server-socket-name}.
+When this is done, Emacs creates a Unix domain socket named
+@file{server} in @file{/tmp/emacs@var{userid}}. See
+@code{server-socket-dir}.
 
 To get your news reader, mail reader, etc., to invoke
 @samp{emacsclient}, try setting the environment variable @code{EDITOR}
@@ -1622,40 +1644,24 @@
 @item
 Normal use:
 
-When @samp{emacsclient} is run, it connects to the @file{.emacs_server}
-socket and passes its command line options to @samp{server}.  When
-@samp{server} receives these requests, it sends this information to the
-the Emacs process, which at the next opportunity will visit the files
-specified.  (Line numbers can be specified just like with Emacs.)  The
-user will have to switch to the Emacs window by hand.  When the user is
-done editing a file, the user can type @kbd{C-x #} (or @kbd{M-x
-server-edit}) to indicate this.  If there is another buffer requested by
-@code{emacsclient}, Emacs will switch to it; otherwise
+When @samp{emacsclient} is run, it connects to the socket and passes its
+command line options to Emacs, which at the next opportunity will visit
+the files specified.  (Line numbers can be specified just like with
+Emacs.)  The user will have to switch to the Emacs window by hand.  When
+the user is done editing a file, the user can type @kbd{C-x #} (or
+@kbd{M-x server-edit}) to indicate this.  If there is another buffer
+requested by @code{emacsclient}, Emacs will switch to it; otherwise
 @code{emacsclient} will exit, signaling the calling program to continue.
 
-@samp{emacsclient} and @samp{server} must be running on machines which
-share the same filesystem for this to work.  The pathnames that
-@samp{emacsclient} specifies should be correct for the filesystem that
-the Emacs process sees.  The Emacs process should not be suspended at
-the time @samp{emacsclient} is invoked.  On Unix and GNU/Linux systems,
-@samp{emacsclient} should either be invoked from another X window, or
-from a shell window inside Emacs itself, or from another interactive
-session, e.g., by means of a @code{screen} program.
-
 @cindex @code{gnuserv}
-There is an enhanced version of @samp{emacsclient}/server called
+There is an enhanced version of @samp{emacsclient} called
 @samp{gnuserv}, written by @email{ange@@hplb.hpl.hp.com, Andy Norman}
 (@pxref{Packages that do not come with Emacs}).  @samp{gnuserv} uses
 Internet domain sockets, so it can work across most network connections.
-It also supports the execution of arbitrary Emacs Lisp forms and does
-not require the client program to wait for completion.
-
-The alpha version of an enhanced @samp{gnuserv} is available at
-
-@uref{ftp://ftp.wellfleet.com/netman/psmith/emacs/gnuserv-2.1alpha.tar.gz}
-
-The version available from @uref{http://meltin.net/hacks/emacs/} is
-more recent, and has been tested with Emacs 21.2.
+
+The most recent @samp{gnuserv} package is available at
+
+@uref{http://meltin.net/hacks/emacs/}
 
 @end itemize
 
@@ -1666,23 +1672,7 @@
 @cindex Regexps for recognizing compiler errors
 @cindex Errors, recognizing compiler
 
-The variable @code{compilation-error-regexp-alist} helps control how
-Emacs parses your compiler output.  It is a list of triplets of the form:
-@code{(@var{regexp} @var{file-idx} @var{line-idx})}, where @var{regexp},
-@var{file-idx} and @var{line-idx} are strings.  To help determine what
-the constituent elements should be, load @file{compile.el} and then type
-@kbd{C-h v compilation-error-regexp-alist @key{RET}} to see the current
-value.  A good idea is to look at @file{compile.el} itself as the
-comments included for this variable are quite useful---the regular
-expressions required for your compiler's output may be very close to one
-already provided.  Once you have determined the proper regexps, use the
-following to inform Emacs of your changes:
-
-@lisp
-(setq compilation-error-regexp-alist
-      (cons '(@var{regexp} @var{file-idx} @var{line-idx})
-         compilation-error-regexp-alist))
-@end lisp
+Customize the @code{compilation-error-regexp-alist} variable.
 
 @node Indenting switch statements, Customizing C and C++ indentation, Compiler error messages, Common requests
 @section How do I change the indentation for @code{switch}?
@@ -1712,7 +1702,7 @@
 spacing of four instead of two.
 
 The @emph{real} solution is to use @code{cc-mode} (the default mode for
-C programming in Emacs 20 and later) and add the following line to yoyr
+C programming in Emacs 20 and later) and add the following line to your
 @file{.emacs}:
 
 @lisp
@@ -1949,28 +1939,17 @@
 @cindex Pairs of parentheses, highlighting
 @cindex Matching parentheses
 
-As of version 19, Emacs comes with @file{paren.el}, which (when loaded)
-will automatically highlight matching parentheses whenever point (i.e.,
-the cursor) is located over one.  To load @file{paren.el} automatically,
-include the line
-
-@lisp
-(require 'paren)
-@end lisp
-
-in your @file{.emacs} file.  @email{shutkoa@@ugsolutions.com, Alan Shutko}
-reports that as of version 20.1, you must also call @code{show-paren-mode} in
-your @file{.emacs} file:
+Call @code{show-paren-mode} in your @file{.emacs} file:
 
 @lisp
 (show-paren-mode 1)
 @end lisp
 
-Customize will let you turn on @code{show-paren-mode}.  Use @kbd{M-x
-customize-group @key{RET} paren-showing @key{RET}}.  From within
-Customize, you can also go directly to the ``paren-showing'' group.
-
-Alternatives to paren include:
+You can also enable this mode by selecting the @samp{Paren Match
+Highlighting} option from the @samp{Options} menu of the Emacs menu bar
+at the top of any Emacs frame.
+
+Alternatives to this mode include:
 
 @itemize @bullet
 
@@ -2160,7 +2139,7 @@
 Any messages your command prints in the echo area will be suppressed.
 
 If you need to repeat a command a small number of times, you can use
-@kbd{C-x z}, see @ref{Repeating commands}.
+@kbd{C-x z} (@pxref{Repeating commands}) or @kbd{C-x e}.
 
 @node Forcing the cursor to remain in the same column, Forcing Emacs to iconify itself, Repeating a command as many times as possible, Common requests
 @section How do I make Emacs behave like this: when I go up or down, the cursor should stay in the same column even if the line is too short?
@@ -2315,27 +2294,20 @@
 error messages, inserts them into a special buffer called
 @code{*compilation*}, and lets you visit the locus of each message in
 the source.  Type @kbd{C-x `} to step through the offending lines one by
-one.  Click @kbd{Mouse-2} or press @key{RET} on a message text in the
+one (starting with Emacs 22, you can also use @kbd{M-g M-p} and
+@kbd{M-g M-n} to go to the previous and next matches directly).  Click
+@kbd{Mouse-2} or press @key{RET} on a message text in the
 @code{*compilation*} buffer to go to the line whose number is mentioned
 in that message.
 
-But if you indeed need to go to a certain text line, type @kbd{M-x
-goto-line @key{RET}}.  Emacs will prompt you for the number of the line
-and go to that line.
+But if you indeed need to go to a certain text line, type @kbd{M-g M-g}
+(which is the default binding of the @code{goto-line} function starting
+with Emacs 22).  Emacs will prompt you for the number of the line and go
+to that line.
 
 You can do this faster by invoking @code{goto-line} with a numeric
-argument that is the line's number.  For example, @kbd{C-u 286 M-x
-goto-line @key{RET}} will jump to line number 286 in the current
-buffer.
-
-If you need to use this command frequently, you might consider binding
-it to a key.  The following snippet, if added to your @file{~/.emacs}
-file, will bind the sequence @kbd{C-x g} to @code{goto-line}:
-
-@lisp
- (global-set-key "\C-xg" 'goto-line)
-@end lisp
-
+argument that is the line's number.  For example, @kbd{C-u 286 M-g M-g}
+will jump to line number 286 in the current buffer.
 
 @node Modifying pull-down menus, Deleting menus and menu options, Going to a line by number, Common requests
 @section How can I create or modify new pull-down menu options?
@@ -2457,9 +2429,11 @@
 @cindex FAQ, @code{font-lock-mode}
 
 @code{font-lock-mode} is the standard way to have Emacs perform syntax
-highlighting in the current buffer.  With @code{font-lock-mode} turned
-on, different types of text will appear in different colors.  For
-instance, if you turn on @code{font-lock-mode} in a programming mode,
+highlighting in the current buffer.  It is enabled by default in Emacs
+22.1 and later.
+
+With @code{font-lock-mode} turned on, different types of text will
+appear in different colors.  For instance, in a programming mode,
 variables will appear in one face, keywords in a second, and comments in
 a third.
 
@@ -2468,33 +2442,16 @@
 hilit19 is now considered non-standard, although @file{hilit19.el} comes
 with the stock Emacs distribution.  It is no longer maintained.
 
-To turn @code{font-lock-mode} on within an existing buffer, use @kbd{M-x
-font-lock-mode @key{RET}}.
-
-To automatically invoke @code{font-lock-mode} when a particular major
-mode is invoked, set the major mode's hook.  For example, to fontify all
-@code{c-mode} buffers, add the following to your @file{.emacs} file:
-
-@lisp
-(add-hook 'c-mode-hook 'turn-on-font-lock)
-@end lisp
-
-To automatically invoke @code{font-lock-mode} for all major modes, you
-can turn on @code{global-font-lock-mode} by including the following line
-in your @file{.emacs} file:
+To turn @code{font-lock-mode} off within an existing buffer, use
+@kbd{M-x font-lock-mode @key{RET}}.
+
+In Emacs 21 and earlier versions, you could use the following code in
+your @file{.emacs} file to turn on @code{font-lock-mode} globally:
 
 @lisp
 (global-font-lock-mode 1)
 @end lisp
 
-@noindent
-This instructs Emacs to turn on font-lock mode in those buffers for
-which a font-lock mode definition has been provided (in the variable
-@code{font-lock-global-modes}).  If you edit a file in
-@code{pie-ala-mode}, and no font-lock definitions have been provided for
-@code{pie-ala} files, then the above setting will have no effect on that
-particular buffer.
-
 Highlighting a buffer with @code{font-lock-mode} can take quite a while,
 and cause an annoying delay in display, so several features exist to
 work around this.
@@ -2534,12 +2491,6 @@
 available by typing @kbd{C-h f font-lock-mode} (@kbd{M-x
 describe-function @key{RET} font-lock-mode @key{RET}}).
 
-For more information on font-lock mode, take a look at the
-@code{font-lock-mode} FAQ, maintained by
-@email{jari.aalto@@ntc.nokia.com, Jari Aalto} at
-
-@uref{ftp://cs.uta.fi/pub/ssjaaa/ema-font.gui}
-
 To print buffers with the faces (i.e., colors and fonts) intact, use
 @kbd{M-x ps-print-buffer-with-faces} or @kbd{M-x
 ps-print-region-with-faces}.  You will need a way to send text to a
@@ -2570,7 +2521,7 @@
 placing the following Lisp form in your @file{.emacs} file:
 
 @lisp
-(delete-selection-mode t)
+(delete-selection-mode 1)
 @end lisp
 
 According to the documentation string for @code{delete-selection-mode}
@@ -2686,41 +2637,10 @@
 @cindex Files, maximum size
 
 Old versions (i.e., anything before 19.29) of Emacs had problems editing
-files larger than 8 megabytes.  As of version 19.29, the maximum buffer
-size is at least 2^27-1, or 134,217,727 bytes, or 132 MBytes.  Emacs 20
-can be compiled on some 64-bit systems in a way that enlarges the buffer
-size up to 576,460,752,303,423,487 bytes, or 549,755,813 GBytes.
-
-If you are using a version of Emacs older than 19.29 and cannot upgrade,
-you will have to recompile. @email{lnz@@lucid.com, Leonard N. Zubkoff}
-suggests putting the following two lines in @file{src/config.h} before
-compiling Emacs to allow for 26-bit integers and pointers (and thus file
-sizes of up to 33,554,431 bytes):
-
-@example
-#define VALBITS 26
-#define GCTYPEBITS 5
-@end example
-
-@noindent
-This method may result in ``ILLEGAL DATATYPE'' and other random errors on
-some machines.
-
-@email{daveg@@csvax.cs.caltech.edu, David Gillespie} explains how this
-problems crops up; while his numbers are true only for pre-19.29
-versions of Emacs, the theory remains the same with current versions.
-
-@quotation
-Emacs is largely written in a dialect of Lisp; Lisp is a freely-typed
-language in the sense that you can put any value of any type into any
-variable, or return it from a function, and so on.  So each value
-must carry a @dfn{tag} along with it identifying what kind of thing it
-is, e.g., integer, pointer to a list, pointer to an editing buffer, and
-so on.  Emacs uses standard 32-bit integers for data objects, taking the
-top 8 bits for the tag and the bottom 24 bits for the value.  So
-integers (and pointers) are somewhat restricted compared to true C
-integers and pointers.
-@end quotation
+files larger than 8 megabytes.  In versions 19.29 and later, the maximum
+buffer size is at least 2^27-1, or 134,217,727 bytes, or 132 MBytes.
+And in Emacs 22, the maximum buffer size has been increased to
+268,435,455 bytes (or 256 MBytes) on 32-bit machines.
 
 @node ^M in the shell buffer, Shell process exits abnormally, Problems with very large files, Bugs and problems
 @section How do I get rid of @samp{^M} or echoed commands in my shell buffer?
@@ -2785,9 +2705,10 @@
 (add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m)
 @end smalllisp
 
-On a related note: If your shell is echoing your input line in the shell
-buffer, you might want to try the following command in your shell
-start-up file:
+On a related note: if your shell is echoing your input line in the shell
+buffer, you might want to customize the @code{comint-process-echoes}
+variable in your shell buffers, or try the following command in your
+shell start-up file:
 
 @example
 stty -icrnl -onlcr -echo susp ^Z
@@ -3456,7 +3377,6 @@
 * Emacs for Apple computers::
 * Emacs for VMS and DECwindows::
 * Modes for various languages::
-* Translating names to IP addresses::
 @end menu
 
 @node Finding Emacs on the Internet, Finding a package with particular functionality, Finding Emacs and related packages, Finding Emacs and related packages
@@ -3665,7 +3585,7 @@
 lack certain features, such as the Emacs Lisp extension language.
 
 @node Emacs for Windows, Emacs for OS/2, Emacs for MS-DOS, Finding Emacs and related packages
-@section Where can I get Emacs for Microsoft Windows
+@section Where can I get Emacs for Microsoft Windows?
 @cindex FAQ for NT Emacs
 @cindex Emacs for MS-Windows
 @cindex Microsoft Windows, Emacs for
@@ -3745,8 +3665,7 @@
 Emacs distribution; see the files @file{mac/README} and
 @file{mac/INSTALL} in the Emacs distribution for build instructions.
 
-Apple's ``OS X'' is based largely on NeXTSTEP and OpenStep.
-@xref{Emacs for NeXTSTEP}, for more details about that version.
+Beginning with version 22.1, Emacs supports Mac OS X natively.
 
 @node Emacs for VMS and DECwindows, Modes for various languages, Emacs for Apple computers, Finding Emacs and related packages
 @section Where do I get Emacs that runs on VMS under DECwindows?
@@ -3756,7 +3675,7 @@
 Up-to-date information about GNU software (including Emacs) for VMS is
 available at @uref{http://vms.gnu.org/}.
 
-@node Modes for various languages, Translating names to IP addresses, Emacs for VMS and DECwindows, Finding Emacs and related packages
+@node Modes for various languages, , Emacs for VMS and DECwindows, Finding Emacs and related packages
 @section Where can I get modes for Lex, Yacc/Bison, Bourne shell, csh, C@t{++}, Objective-C, Pascal, Java, and Awk?
 @cindex Awk, mode for
 @cindex @code{awk-mode}
@@ -3781,37 +3700,6 @@
 Java code.  It is distributed with Emacs, but has
 @uref{http://cc-mode.sourceforge.net/, its own homepage}.
 
-@node Translating names to IP addresses,  , Modes for various languages, Finding Emacs and related packages
-@section What is the IP address of XXX.YYY.ZZZ?
-@cindex Translating names to IP addresses
-@cindex IP addresses from names
-@cindex Using BIND to translate addresses
-@cindex DNS and IP addresses
-
-If you are on a Unix machine, try using the @samp{nslookup} command,
-included in the Berkeley BIND package.  For example, to find the IP
-address of @samp{ftp.gnu.org}, you would type @code{nslookup
-ftp.gnu.org}.
-
-Your computer should then provide the IP address of that machine.
-
-If your site's nameserver is deficient, you can use IP addresses to FTP
-files.  You can get this information by e-mail:
-
-@example
-To: dns@@[134.214.84.25]    (to grasp.insa-lyon.fr)
-Body: ip XXX.YYY.ZZZ        (or "help" for more information
-                             and options - no quotes)
-@end example
-
-@noindent
-or:
-
-@example
-To: resolve@@[147.31.254.130]         (to laverne.cs.widener.edu)
-Body: site XXX.YYY.ZZZ
-@end example
-
 @c ------------------------------------------------------------
 @node Major packages and programs, Key bindings, Finding Emacs and related packages, Top
 @chapter Major packages and programs
@@ -4183,6 +4071,7 @@
 * Binding combinations of modifiers and function keys::
 * Meta key does not work in xterm::
 * ExtendChar key does not work as Meta::
+* SPC no longer completes file names::
 @end menu
 
 @node Binding keys to commands, Invalid prefix characters, Key bindings, Key bindings
@@ -4200,7 +4089,7 @@
 
 @inforef{Key Bindings, Key Bindings, emacs}, for further details.
 
-To make the process of binding keys interactively eaiser, use the
+To make the process of binding keys interactively easier, use the
 following ``trick'': First bind the key interactively, then immediately
 type @kbd{C-x @key{ESC} @key{ESC} C-a C-k C-g}.  Now, the command needed
 to bind the key is in the kill ring, and can be yanked into your
@@ -4829,7 +4718,7 @@
 
 @end itemize
 
-@node ExtendChar key does not work as Meta,  , Meta key does not work in xterm, Key bindings
+@node ExtendChar key does not work as Meta, SPC no longer completes file names, Meta key does not work in xterm, Key bindings
 @section Why doesn't my @key{ExtendChar} key work as a @key{Meta} key under HP-UX 8.0 and 9.x?
 @cindex @key{ExtendChar} key as @key{Meta}
 @cindex @key{Meta}, using @key{ExtendChar} for
@@ -4852,6 +4741,25 @@
 This will disable the use of the extra keysyms systemwide, which may be
 undesirable if you actually intend to use them.
 
+@node SPC no longer completes file names, , ExtendChar key does not work as Meta, Key bindings
+@section Why doesn't SPC complete file names anymore?
+@cindex @kbd{SPC} file name completion
+
+Starting with Emacs 22.1, @kbd{SPC} no longer completes file names in
+the minibuffer, so that file names with embedded spaces could be typed
+without the need to quote the spaces.
+
+You can get the old behavior by binding @kbd{SPC} to
+@code{minibuffer-complete-word} in the minibuffer, as follows:
+
+@lisp
+(define-key minibuffer-local-filename-completion-map (kbd "SPC") 
+  'minibuffer-complete-word)
+
+(define-key minibuffer-local-must-match-filename-map (kbd "SPC") 
+  'minibuffer-complete-word)
+@end lisp
+
 @c ------------------------------------------------------------
 @node Alternate character sets, Mail and news, Key bindings, Top
 @chapter Alternate character sets
@@ -5154,11 +5062,6 @@
 @cindex Mail packages and MIME
 @cindex FAQ for MIME and Emacs
 
-Read the Emacs MIME FAQ, maintained by @email{trey@@cs.berkeley.edu,
-MacDonald Hall Jackson} at
-
-@uref{http://bmrc.berkeley.edu/~trey/emacs/mime.html}
-
 Version 6.x of VM supports MIME.  @xref{VM}.  Gnus supports MIME in mail
 and news messages as of version 5.8.1 (Pterodactyl).  Rmail has limited
 support for single-part MIME messages beginning with Emacs 20.3.
--- a/man/gnus.texi	Sat Dec 10 21:18:28 2005 +0000
+++ b/man/gnus.texi	Sun Dec 11 22:42:40 2005 +0000
@@ -24310,7 +24310,7 @@
 @item nnheader-max-head-length
 @vindex nnheader-max-head-length
 When the back ends read straight heads of articles, they all try to read
-as little as possible.  This variable (default 4096) specifies
+as little as possible.  This variable (default 8192) specifies
 the absolute max length the back ends will try to read before giving up
 on finding a separator line between the head and the body.  If this
 variable is @code{nil}, there is no upper read bound.  If it is
@@ -24491,7 +24491,7 @@
 January 25th 1997 (after 84 releases) as ``Gnus 5.4'' (67 releases).
 
 On September 13th 1997, Quassia Gnus was started and lasted 37 releases.
-If was released as ``Gnus 5.6'' on March 8th 1998 (46 releases).
+It was released as ``Gnus 5.6'' on March 8th 1998 (46 releases).
 
 Gnus 5.6 begat Pterodactyl Gnus on August 29th 1998 and was released as
 ``Gnus 5.8'' (after 99 releases and a CVS repository) on December 3rd
@@ -26032,7 +26032,7 @@
 Earlier this was done only via @kbd{G p} (or @kbd{G c}), which stored
 the parameters in @file{~/.newsrc.eld}, but via this variable you can
 enjoy the powers of customize, and simplified backups since you set the
-variable in @file{~/.emacs} instead of @file{~/.newsrc.eld}.  The
+variable in @file{~/.gnus.el} instead of @file{~/.newsrc.eld}.  The
 variable maps regular expressions matching group names to group
 parameters, a'la:
 @lisp
@@ -26047,7 +26047,7 @@
 @item
 Smileys (@samp{:-)}, @samp{;-)} etc) are now iconized for Emacs too.
 
-Put @code{(setq gnus-treat-display-smileys nil)} in @file{~/.emacs} to
+Put @code{(setq gnus-treat-display-smileys nil)} in @file{~/.gnus.el} to
 disable it.
 
 @item
@@ -26074,8 +26074,8 @@
 followups (see the variables @code{message-cross-post-@var{*}}).
 
 @item
-References and X-Draft-Headers are no longer generated when you start
-composing messages and @code{message-generate-headers-first} is
+References and X-Draft-From headers are no longer generated when you
+start composing messages and @code{message-generate-headers-first} is
 @code{nil}.
 
 @item
@@ -26316,7 +26316,8 @@
 (@code{gnus-summary-insert-cached-articles}).  The new function filters
 out other articles.
 
-@item Some limiting commands accept a @kbd{C-u} prefix to negate the match.
+@item
+Some limiting commands accept a @kbd{C-u} prefix to negate the match.
 
 If @kbd{C-u} is used on subject, author or extra headers, i.e., @kbd{/
 s}, @kbd{/ a}, and @kbd{/ x}
@@ -26767,7 +26768,7 @@
 useful data is in the summary buffer, anyway.  Set this variable to
 @samp{^NEVVVVER} or @samp{From:}, or whatever you feel you need.
 
-Set this hook to all the available hiding commands:
+Use the following to enable all the available hiding features:
 @lisp
 (setq gnus-treat-hide-headers 'head
       gnus-treat-hide-signature t
@@ -28495,8 +28496,10 @@
 certain things, it's trivial to have it do something a different way.
 (Well, at least if you know how to write Lisp code.)  However, that's
 beyond the scope of this manual, so we are simply going to talk about
-some common constructs that you normally use in your @file{.emacs} file
-to customize Gnus.
+some common constructs that you normally use in your @file{~/.gnus.el}
+file to customize Gnus.  (You can also use the @file{~/.emacs} file, but
+in order to set things of Gnus up, it is much better to use the
+@file{~/.gnus.el} file, @xref{Startup Files}.)
 
 If you want to set the variable @code{gnus-florgbnize} to four (4), you
 write the following:
@@ -28507,12 +28510,12 @@
 
 This function (really ``special form'') @code{setq} is the one that can
 set a variable to some value.  This is really all you need to know.  Now
-you can go and fill your @file{.emacs} file with lots of these to change
-how Gnus works.
-
-If you have put that thing in your @file{.emacs} file, it will be read
-and @code{eval}ed (which is lisp-ese for ``run'') the next time you
-start Emacs.  If you want to change the variable right away, simply say
+you can go and fill your @file{~/.gnus.el} file with lots of these to
+change how Gnus works.
+
+If you have put that thing in your @file{~/.gnus.el} file, it will be
+read and @code{eval}ed (which is Lisp-ese for ``run'') the next time you
+start Gnus.  If you want to change the variable right away, simply say
 @kbd{C-x C-e} after the closing parenthesis.  That will @code{eval} the
 previous ``form'', which is a simple @code{setq} statement here.
 
--- a/man/killing.texi	Sat Dec 10 21:18:28 2005 +0000
+++ b/man/killing.texi	Sun Dec 11 22:42:40 2005 +0000
@@ -655,20 +655,29 @@
 applications.  @kbd{C-x} means cut (kill), @kbd{C-c} copy, @kbd{C-v}
 paste (yank), and @kbd{C-z} undo.  Standard Emacs commands like
 @kbd{C-x C-c} still work, because @kbd{C-x} and @kbd{C-c} only take
-effect when the mark is active.  However, if you don't want these
-bindings at all, set @code{cua-enable-cua-keys} to @code{nil}.
+effect when the mark is active (and the region is highlighted).
+However, if you don't want these bindings at all, set
+@code{cua-enable-cua-keys} to @code{nil}.
 
   In CUA mode, using @kbd{Shift} together with the movement keys
-activates the region over which they move.  The standard (unshifted)
-movement keys deactivate the mark, and typed text replaces the active
-region as in Delete-Selection mode (@pxref{Graphical Kill}).
+activates and highlights the region over which they move.  The
+standard (unshifted) movement keys deactivate the mark, and typed text
+replaces the active region as in Delete-Selection mode
+(@pxref{Graphical Kill}).
+
+  To run a command like @kbd{C-x C-f} while the mark is active, use
+one of the following methods: either hold @kbd{Shift} together with
+the prefix key, e.g. @kbd{S-C-x C-f}, or quickly type the prefix key
+twice, e.g. @kbd{C-x C-x C-f}.
 
 @cindex rectangle highlighting
   CUA mode provides enhanced rectangle support with visible
 rectangle highlighting.  Use @kbd{C-RET} to start a rectangle,
 extend it using the movement commands, and cut or copy it using
-@kbd{C-x} or @kbd{C-c}.  When a rectangle is active, text you type is
-automatically inserted before or after each line in the rectangle.
+@kbd{C-x} or @kbd{C-c}.  @kbd{RET} moves the cursor to the next
+(clockwise) corner of the rectangle, so you can easily expand it in
+any direction.  Normal text you type is inserted to the left or right
+of each line in the rectangle (on the same side as the cursor).
 
   With CUA you can easily copy text and rectangles into and out of
 registers by providing a one-digit numeric prefix the the kill, copy,
--- a/man/message.texi	Sat Dec 10 21:18:28 2005 +0000
+++ b/man/message.texi	Sun Dec 11 22:42:40 2005 +0000
@@ -249,7 +249,10 @@
 Headers matching the @code{message-ignored-supersedes-headers} are
 removed before popping up the new message buffer.  The default is@*
 @samp{^Path:\\|^Date\\|^NNTP-Posting-Host:\\|^Xref:\\|^Lines:\\|@*
-^Received:\\|^X-From-Line:\\|Return-Path:\\|^Supersedes:}.
+^Received:\\|^X-From-Line:\\|^X-Trace:\\|^X-Complaints-To:\\|@*
+Return-Path:\\|^Supersedes:\\|^NNTP-Posting-Date:\\|^X-Trace:\\|@*
+^X-Complaints-To:\\|^Cancel-Lock:\\|^Cancel-Key:\\|^X-Hashcash:\\|@*
+^X-Payment:}.
 
 
 
@@ -330,7 +333,7 @@
 @vindex message-ignored-bounced-headers
 Headers that match the @code{message-ignored-bounced-headers} regexp
 will be removed before popping up the buffer.  The default is
-@samp{^\\(Received\\|Return-Path\\):}.
+@samp{^\\(Received\\|Return-Path\\|Delivered-To\\):}.
 
 
 @node Mailing Lists
@@ -339,7 +342,7 @@
 @cindex Mail-Followup-To
 Sometimes while posting to mailing lists, the poster needs to direct
 followups to the post to specific places.  The Mail-Followup-To (MFT)
-was created to enable just this.  Two example scenarios where this is
+was created to enable just this.  Three example scenarios where this is
 useful:
 
 @itemize @bullet
@@ -681,26 +684,30 @@
 @kindex C-c C-f x
 @findex message-cross-post-followup-to
 @vindex message-cross-post-default
+@vindex message-cross-post-note-function
 @cindex X-Post
 @cindex cross-post
-Ask for an additional @samp{Newsgroups} and @samp{FollowUp-To} for a
-cross-post.  @code{message-cross-post-followup-to} mangles
-@samp{FollowUp-To} and @samp{Newsgroups} header to point to group.
-If @code{message-cross-post-default} is @code{nil} or if called with a
-prefix-argument @samp{Follow-Up} is set, but the message is not
-cross-posted.
+Set up the @samp{FollowUp-To} header with a target newsgroup for a
+cross-post, add that target newsgroup to the @samp{Newsgroups} header if
+it is not a member of @samp{Newsgroups}, and insert a note in the body.
+If @code{message-cross-post-default} is @code{nil} or if this command is
+called with a prefix-argument, only the @samp{FollowUp-To} header will
+be set but the the target newsgroup will not be added to the
+@samp{Newsgroups} header.  The function to insert a note is controlled
+by the @code{message-cross-post-note-function} variable.
 
 @item C-c C-f t
 @kindex C-c C-f t
 @findex message-reduce-to-to-cc
 Replace contents of @samp{To} header with contents of @samp{Cc} or
-@samp{Bcc} header.
+@samp{Bcc} header.  (Iff @samp{Cc} header is not present, @samp{Bcc}
+header will be used instead.)
 
 @item C-c C-f w
 @kindex C-c C-f w
 @findex message-insert-wide-reply
 Insert @samp{To} and @samp{Cc} headers as if you were doing a wide
-reply.
+reply even if the message was not made for a wide reply first.
 
 @item C-c C-f a
 @kindex C-c C-f a
@@ -839,8 +846,8 @@
 The @code{message-use-idna} variable control whether @acronym{IDNA} is
 used.  If the variable is @code{nil} no @acronym{IDNA} encoding will
 ever happen, if it is set to the symbol @code{ask} the user will be
-queried, and if set to @code{t} @acronym{IDNA} encoding happens
-automatically (the default).
+queried, and if set to @code{t} (which is the default if @acronym{IDNA}
+is fully available) @acronym{IDNA} encoding happens automatically.
 
 @findex message-idna-to-ascii-rhs
 If you want to experiment with the @acronym{IDNA} encoding, you can
@@ -1081,7 +1088,7 @@
 (@samp{[...]}).
 
 @item C-c C-z
-@kindex C-c C-x
+@kindex C-c C-z
 @findex message-kill-to-signature
 Kill all the text up to the signature, or if that's missing, up to the
 end of the message (@code{message-kill-to-signature}).
@@ -1125,9 +1132,9 @@
 @kindex TAB
 @findex message-tab
 @vindex message-tab-body-function
-If non-@code{nil} execute the function specified in
-@code{message-tab-body-function}.  Otherwise use the function bound to
-@kbd{TAB} in @code{text-mode-map} or @code{global-map}.
+If @code{message-tab-body-function} is non-@code{nil}, execute the
+function it specifies.  Otherwise use the function bound to @kbd{TAB} in
+@code{text-mode-map} or @code{global-map}.
 
 @end table
 
@@ -1417,13 +1424,14 @@
 @item message-required-mail-headers
 @vindex message-required-mail-headers
 @xref{News Headers}, for the syntax of this variable.  It is
-@code{(From Date Subject (optional . In-Reply-To) Message-ID Lines
+@code{(From Subject Date (optional . In-Reply-To) Message-ID
 (optional . User-Agent))} by default.
 
 @item message-ignored-mail-headers
 @vindex message-ignored-mail-headers
-Regexp of headers to be removed before mailing.  The default is
-@samp{^[GF]cc:\\|^Resent-Fcc:\\|^Xref:\\|^X-Draft-From:}.
+Regexp of headers to be removed before mailing.  The default is@*
+@samp{^[GF]cc:\\|^Resent-Fcc:\\|^Xref:\\|^X-Draft-From:\\|@*
+^X-Gnus-Agent-Meta-Information:}.
 
 @item message-default-mail-headers
 @vindex message-default-mail-headers
@@ -1694,7 +1702,8 @@
 @item message-ignored-news-headers
 @vindex message-ignored-news-headers
 Regexp of headers to be removed before posting.  The default is@*
-@samp{^NNTP-Posting-Host:\\|^Xref:\\|^[BGF]cc:\\|^Resent-Fcc:\\|^X-Draft-From:}.
+@samp{^NNTP-Posting-Host:\\|^Xref:\\|^[BGF]cc:\\|^Resent-Fcc:\\|@*
+^X-Draft-From:\\|^X-Gnus-Agent-Meta-Information:}.
 
 @item message-default-news-headers
 @vindex message-default-news-headers
@@ -1847,12 +1856,13 @@
 @item message-default-charset
 @vindex message-default-charset
 @cindex charset
-Symbol naming a @acronym{MIME} charset.  Non-@acronym{ASCII}
-characters in messages are assumed to be encoded using this charset.
-The default is @code{nil}, which means ask the user.  (This variable
-is used only on non-@sc{mule} Emacsen.  @xref{Charset Translation, ,
-Charset Translation, emacs-mime, Emacs MIME Manual}, for details on
-the @sc{mule}-to-@acronym{MIME} translation process.
+Symbol naming a @acronym{MIME} charset.  Non-@acronym{ASCII} characters
+in messages are assumed to be encoded using this charset.  The default
+is @code{iso-8859-1} on non-@sc{mule} Emacsen; otherwise @code{nil},
+which means ask the user.  (This variable is used only on non-@sc{mule}
+Emacsen.)  @xref{Charset Translation, , Charset Translation, emacs-mime,
+Emacs MIME Manual}, for details on the @sc{mule}-to-@acronym{MIME}
+translation process.
 
 @item message-signature-separator
 @vindex message-signature-separator
@@ -1954,8 +1964,11 @@
 
 @item message-send-method-alist
 @vindex message-send-method-alist
-
-Alist of ways to send outgoing messages.  Each element has the form
+@findex message-mail-p
+@findex message-news-p
+@findex message-send-via-mail
+@findex message-send-via-news
+Alist of ways to send outgoing messages.  Each element has the form:
 
 @lisp
 (@var{type} @var{predicate} @var{function})
@@ -1967,20 +1980,32 @@
 
 @item predicate
 A function called without any parameters to determine whether the
-message is a message of type @var{type}.
+message is a message of type @var{type}.  The function will be called in
+the buffer where the message is.
 
 @item function
 A function to be called if @var{predicate} returns non-@code{nil}.
 @var{function} is called with one parameter -- the prefix.
 @end table
 
+The default is:
+
 @lisp
 ((news message-news-p message-send-via-news)
  (mail message-mail-p message-send-via-mail))
 @end lisp
 
-
-
+The @code{message-news-p} function returns non-@code{nil} if the message
+looks like news, and the @code{message-send-via-news} function sends the
+message according to the @code{message-send-news-function} variable
+(@pxref{News Variables}).  The @code{message-mail-p} function returns
+non-@code{nil} if the message looks like mail, and the
+@code{message-send-via-mail} function sends the message according to the
+@code{message-send-mail-function} variable (@pxref{Mail Variables}).
+
+All the elements in this alist will be tried in order, so a message
+containing both a valid @samp{Newsgroups} header and a valid @samp{To}
+header, for example, will be sent as news, and then as mail.
 @end table
 
 
--- a/man/mini.texi	Sat Dec 10 21:18:28 2005 +0000
+++ b/man/mini.texi	Sun Dec 11 22:42:40 2005 +0000
@@ -198,14 +198,16 @@
 argument.  @kbd{?} is defined to display a list of possible completions
 of what you have inserted.
 
-  For example, when @kbd{M-x} uses the minibuffer to read the name of a
-command, it provides a list of all available Emacs command names to
+  For example, when @kbd{M-x} uses the minibuffer to read the name of
+a command, it provides a list of all available Emacs command names to
 complete against.  The completion keys match the minibuffer text
 against all the command names, find any additional name characters
 implied by the ones already present in the minibuffer, and add those
 characters to the ones you have given.  This is what makes it possible
 to type @kbd{M-x ins @key{SPC} b @key{RET}} instead of @kbd{M-x
-insert-buffer @key{RET}} (for example).
+insert-buffer @key{RET}} (for example).  (@key{SPC} does not do
+completion in reading file names, because it is common to use spaces
+in file names on some systems.)
 
   Case is normally significant in completion, because it is significant
 in most of the names that you can complete (buffer names, file names and
@@ -260,8 +262,10 @@
 Complete the text before point in the minibuffer as much as possible
 (@code{minibuffer-complete}).
 @item @key{SPC}
-Complete the minibuffer text before point, but don't go beyond one word
-(@code{minibuffer-complete-word}).
+Complete the minibuffer text before point, but don't go beyond one
+word (@code{minibuffer-complete-word}).  @key{SPC} for completion is
+not available when entering a file name, since some users often put
+spaces in filenames.
 @item @key{RET}
 Submit the text in the minibuffer as the argument, possibly completing
 first as described
--- a/man/org.texi	Sat Dec 10 21:18:28 2005 +0000
+++ b/man/org.texi	Sun Dec 11 22:42:40 2005 +0000
@@ -4,7 +4,7 @@
 @setfilename ../info/org
 @settitle Org Mode Manual
 
-@set VERSION 3.22
+@set VERSION 3.23
 @set DATE December 2005
 
 @dircategory Emacs
@@ -469,7 +469,10 @@
 @table @kbd
 @kindex M-@key{RET}
 @item M-@key{RET}
-Insert new heading with same level as current
+Insert new heading with same level as current.  If the cursor is in a
+plain list item, a new item is created.  To force creation of a new
+headline, use a prefix arg, or first press @key{RET} to get to the
+beginning of the next line.
 @kindex M-S-@key{RET}
 @item M-S-@key{RET}
 Insert new TODO entry with same level as current heading.
@@ -632,6 +635,9 @@
 given by the indentation of the bullet/number.  However, items are
 always subortinate to real headlines, the hierarchies remain
 completely separated.
+@kindex M-@key{RET}
+@item M-@key{RET}
+Insert new item at current level.  With prefix arg, for a new heading.
 @kindex M-S-@key{up}
 @kindex M-S-@key{down}
 @item M-S-@key{up}
--- a/man/pgg.texi	Sat Dec 10 21:18:28 2005 +0000
+++ b/man/pgg.texi	Sun Dec 11 22:42:40 2005 +0000
@@ -177,9 +177,8 @@
 
 @deffn Command pgg-verify-region start end &optional signature fetch
 Verify the current region between @var{start} and @var{end}.  If the
-optional third argument @var{signature} is non-@code{nil}, or the function
-is called interactively, it is treated as the detached signature of the
-current region.
+optional third argument @var{signature} is non-@code{nil}, it is treated
+as the detached signature file of the current region.
 
 If the optional 4th argument @var{fetch} is non-@code{nil}, or the
 function is called interactively, we attempt to fetch the signer's
@@ -204,22 +203,18 @@
 select cipher algorithm from 3DES, CAST5, BLOWFISH, and so on, but on
 the other hand the version 2 of PGP only supports IDEA.
 
-By default, if the variable @code{pgg-scheme} is not set, PGG searches the
-registered scheme for an implementation of the requested service
-associated with the named algorithm.  If there are no match, PGG uses
-@code{pgg-default-scheme}.  In other words, there are two options to
-control which command is used to process the incoming PGP armors.  One
-is for encrypting and signing, the other is for decrypting and
-verifying.
+Which implementation is used is controlled by the @code{pgg-scheme}
+variable.  If it is @code{nil} (the default), the value of the
+@code{pgg-default-scheme} variable will be used instead.
 
 @defvar pgg-scheme
-Force specify the scheme of PGP implementation for decrypting and verifying.
-The value can be @code{gpg}, @code{pgp}, and @code{pgp5}.
+Force specify the scheme of PGP implementation.  The value can be set to
+@code{gpg}, @code{pgp}, and @code{pgp5}.  The default is @code{nil}.
 @end defvar
 
 @defvar pgg-default-scheme
-Force specify the scheme of PGP implementation for encrypting and signing.
-The value can be @code{gpg}, @code{pgp}, and @code{pgp5}.
+The default scheme of PGP implementation.  The value should be one of
+@code{gpg}, @code{pgp}, and @code{pgp5}.  The default is @code{gpg}.
 @end defvar
 
 @node Caching passphrase
--- a/nt/ChangeLog	Sat Dec 10 21:18:28 2005 +0000
+++ b/nt/ChangeLog	Sun Dec 11 22:42:40 2005 +0000
@@ -1,3 +1,8 @@
+2005-12-09  Eli Zaretskii  <eliz@gnu.org>
+
+	* INSTALL: Add explanation of how to debug with GDB starting from
+	the Emacs Abort dialog.
+
 2005-11-26  Chong Yidong  <cyd@stupidchicken.com>
 
 	* emacs.rc: Use new icons.
--- a/nt/INSTALL	Sat Dec 10 21:18:28 2005 +0000
+++ b/nt/INSTALL	Sun Dec 11 22:42:40 2005 +0000
@@ -243,7 +243,19 @@
 
   You should be able to debug Emacs using the debugger that is
   appropriate for the compiler you used, namely DevStudio or Windbg if
-  compiled with MSVC, or gdb if compiled with gcc.
+  compiled with MSVC, or GDB if compiled with GCC.
+
+  When Emacs aborts due to a fatal internal error, Emacs on Windows
+  pops up an Emacs Abort Dialog asking you whether you want to debug
+  Emacs or terminate it.  If Emacs was built with MSVC, click YES
+  twice, and Windbg or the DevStudio debugger will start up
+  automatically.  If Emacs was built with GCC, first start GDB and
+  attach it to the Emacs process with the "gdb -p EMACS-PID" command,
+  where EMACS-PID is the Emacs process ID (which you can see in the
+  Windows Task Manager), type the "continue" command inside GDB, and
+  only then click YES on the abort dialog.  This will pass control to
+  the debugger, and you will be able to debug the cause of the fatal
+  error.
 
   Emacs functions implemented in C use a naming convention that reflects
   their names in lisp.  The names of the C routines are the lisp names
@@ -254,17 +266,18 @@
   easily set breakpoints or examine familiar lisp variables by name.
 
   Since Emacs data is often in the form of a lisp object, and the
-  Lisp_Object type is difficult to examine manually in the MSVC
-  debugger, Emacs provides a helper routine called debug_print that
-  prints out a readable representation of a Lisp_Object.  (If you are
-  using gdb, there is a .gdbinit file in the src directory which
-  provides definitions that are useful for examining lisp objects.  The
-  following tips are mainly of interest when using MSVC.)  The output
-  from debug_print is sent to stderr, and to the debugger via the
-  OutputDebugString routine.  The output sent to stderr should be
-  displayed in the console window that was opened when the emacs.exe
-  executable was started.  The output sent to the debugger should be
-  displayed in its "Debug" output window.
+  Lisp_Object type is difficult to examine manually in a debugger,
+  Emacs provides a helper routine called debug_print that prints out a
+  readable representation of a Lisp_Object.  If you are using GDB,
+  there is a .gdbinit file in the src directory which provides
+  definitions that are useful for examining lisp objects.  Therefore,
+  the following tips are mainly of interest when using MSVC.
+
+  The output from debug_print is sent to stderr, and to the debugger
+  via the OutputDebugString routine.  The output sent to stderr should
+  be displayed in the console window that was opened when the
+  emacs.exe executable was started.  The output sent to the debugger
+  should be displayed in its "Debug" output window.
 
   When you are in the process of debugging Emacs and you would like to
   examine the contents of a Lisp_Object variable, popup the QuickWatch
--- a/src/ChangeLog	Sat Dec 10 21:18:28 2005 +0000
+++ b/src/ChangeLog	Sun Dec 11 22:42:40 2005 +0000
@@ -1,3 +1,100 @@
+2005-12-11  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* emacs.c (main) [MAC_OS8]: Undo previous change.
+
+	* macselect.c (syms_of_macselect) <mac-apple-event-map>:
+	Initialize to nil.  Keymap is now created in lisp/term/mac-win.el.
+
+2005-12-10  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* Makefile.in (macselect.o): Depend on keymap.h.
+
+	* emacs.c (main) [MAC_OS8]: Call syms_of_keymap before
+	syms_of_macselect.
+
+	* image.c (init_image) [MAC_OS]: Don't call EnterMovies.
+	[!HAVE_GIF && MAC_OS] (gif_load): Call EnterMovies.
+
+	* keyboard.c (Qmac_apple_event) [MAC_OS]: New variable.
+	(syms_of_keyboard) [MAC_OS]: Initialize it.
+	(make_lispy_event) [MAC_OS]: Build lisp event for MAC_APPLE_EVENT.
+
+	* 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.
+	(Fmac_coerce_ae_data): New defun.
+	(syms_of_mac): Defsubr it.
+
+	* macselect.c: Include keymap.h.
+	(mac_ready_for_apple_events): New variable.
+	(Vmac_apple_event_map, Qmac_apple_event_class)
+	(Qmac_apple_event_id): New variables.
+	(syms_of_macselect): Initialize them.
+	(Qundefined, mac_store_apple_event): Add externs.
+	(struct apple_event_binding): New struct.
+	(find_event_binding_fun, find_event_binding)
+	(mac_find_apple_event_spec, defer_apple_events)
+	(mac_handle_apple_event, init_apple_event_handler)
+	(copy_scrap_flavor_data): New functions.
+	(Fmac_process_deferred_apple_events): New defun.
+	(syms_of_macselect): Defsubr it.
+	(mac_store_services_event): Fix extern.
+	(mac_handle_service_event): Don't allocate Lisp objects during
+	asynchronous input processing.  Use mac_store_services_event
+	instead of mac_store_application_menu_event.
+
+	* macterm.c (Qmac_ready_for_drag_n_drop, Qapplication, Qabout)
+	(Qpreferences): Remove variables.
+	(syms_of_macterm) : Don't initialize them.
+	(Qhicommand) [USE_CARBON_EVENTS]: New variable.
+	(syms_of_macterm) [USE_CARBON_EVENTS]: Initialize it.
+	(init_required_apple_events, do_ae_open_application)
+	(do_ae_print_documents, do_ae_open_documents)
+	(do_ae_quit_application): Remove functions and prototypes.
+	(mac_ready_for_apple_events, Qundefined, init_apple_event_handler)
+	(mac_find_apple_event_spec): Add externs.
+	(mac_store_application_menu_event): Remove function.
+	(mac_store_apple_event, mac_make_lispy_event_code): New functions.
+	(mac_handle_command_event): Create Apple event from Carbon event.
+	Use mac_store_apple_event instead of mac_store_application_menu_event.
+	[MAC_OSX] (mac_store_services_event): Likewise.
+	(struct SelectionRange, SelectionRange): Remove struct and typedef.
+	[MAC_OS8] (main): Call init_apple_event_handler instead of
+	init_required_apple_events.
+	(mac_initialize) [MAC_OSX]: Likewise.
+	[!USE_CARBON_EVENTS] (mac_wait_next_event): Use
+	mac_ready_for_apple_events instead of Qmac_ready_for_drag_n_drop.
+
+	* macterm.h (mac_make_lispy_event_code, mac_aedesc_to_lisp): Add
+	externs.
+	(create_apple_event_from_event_ref) [TARGET_API_MAC_CARBON]: Likewise.
+	(Fmac_get_preference): Add EXFUN.
+
+	* termhooks.h (enum event_kind) [MAC_OS]: Add new MAC_APPLE_EVENT
+	event.
+
+2005-12-09  Richard M. Stallman  <rms@gnu.org>
+
+	* xfns.c (Fx_create_frame): Reinstate previous change.
+
+2005-12-09  Eli Zaretskii  <eliz@gnu.org>
+
+	* w32fns.c (w32_abort) [__GNUC__]: Add instructions for attaching
+	GDB to the abort dialog.
+
+2005-12-09  Kyotaro HORIGUCHI <horiguti@meadowy.org>  (tiny change)
+
+	* indent.c (Fvertical_motion): Force move if starting on
+	stretch glyph.
+
+2005-12-08  Richard M. Stallman  <rms@gnu.org>
+
+	* lread.c (read_escape) <\s>: Don't treat strings specially.
+
+	* xfns.c (Fx_create_frame): Comment out previous change.
+
 2005-12-07  L$,1 q(Brentey K,Aa(Broly  <lorentey@elte.hu>
 
 	* xfns.c (Fx_create_frame): Initialize Vdefault_minibuffer_frame,
--- a/src/Makefile.in	Sat Dec 10 21:18:28 2005 +0000
+++ b/src/Makefile.in	Sun Dec 11 22:42:40 2005 +0000
@@ -1261,7 +1261,7 @@
   frame.h charset.h ccl.h dispextern.h fontset.h termhooks.h termopts.h \
   termchar.h gnu.h disptab.h buffer.h window.h keyboard.h $(INTERVAL_SRC) \
   process.h coding.h $(config_h)
-macselect.o: blockinput.h macterm.h macgui.h frame.h $(config_h)
+macselect.o: blockinput.h macterm.h macgui.h frame.h keymap.h $(config_h)
 
 ${emacsapp}Contents/Resources/English.lproj:
 	mkdir -p $@
--- a/src/image.c	Sat Dec 10 21:18:28 2005 +0000
+++ b/src/image.c	Sun Dec 11 22:42:40 2005 +0000
@@ -7778,6 +7778,9 @@
   specified_file = image_spec_value (img->spec, QCfile, NULL);
   specified_data = image_spec_value (img->spec, QCdata, NULL);
 
+  /* Animated gifs use QuickTime Movie Toolbox.  So initialize it here. */
+  EnterMovies ();
+
   if (NILP (specified_data))
     {
       /* Read from a file */
@@ -8500,14 +8503,9 @@
 void
 init_image ()
 {
-#ifdef MAC_OS
-  /* Animated gifs use QuickTime Movie Toolbox.  So initialize it here. */
-  if (!inhibit_window_system)
-    EnterMovies ();
-#ifdef MAC_OSX
+#if defined (MAC_OSX) && TARGET_API_MAC_CARBON
   init_image_func_pointer ();
 #endif
-#endif
 }
 
 /* arch-tag: 123c2a5e-14a8-4c53-ab95-af47d7db49b9
--- a/src/indent.c	Sat Dec 10 21:18:28 2005 +0000
+++ b/src/indent.c	Sun Dec 11 22:42:40 2005 +0000
@@ -2076,7 +2076,7 @@
     {
       int it_start;
       int oselective;
-      int start_on_image_p;
+      int start_on_image_or_stretch_p;
 
       SET_TEXT_POS (pt, PT, PT_BYTE);
       start_display (&it, w, pt);
@@ -2088,7 +2088,8 @@
 	 while the end position is really at some X > 0, the same X that
 	 PT had.  */
       it_start = IT_CHARPOS (it);
-      start_on_image_p = (it.method == GET_FROM_IMAGE);
+      start_on_image_or_stretch_p = (it.method == GET_FROM_IMAGE
+				     || it.method == GET_FROM_STRETCH);
       reseat_at_previous_visible_line_start (&it);
       it.current_x = it.hpos = 0;
       /* Temporarily disable selective display so we don't move too far */
@@ -2099,9 +2100,10 @@
 
       /* Move back if we got too far.  This may happen if
 	 truncate-lines is on and PT is beyond right margin.
-	 It may also happen if it_start is on an image --
-	 in that case, don't go back.  */
-      if (IT_CHARPOS (it) > it_start && XINT (lines) > 0 && !start_on_image_p)
+	 It may also happen if it_start is on an image or a stretch
+	 glyph -- in that case, don't go back.  */
+      if (IT_CHARPOS (it) > it_start && XINT (lines) > 0
+	  && !start_on_image_or_stretch_p)
 	move_it_by_lines (&it, -1, 0);
 
       it.vpos = 0;
--- a/src/keyboard.c	Sat Dec 10 21:18:28 2005 +0000
+++ b/src/keyboard.c	Sun Dec 11 22:42:40 2005 +0000
@@ -514,6 +514,9 @@
 #endif
 Lisp_Object Qdrag_n_drop;
 Lisp_Object Qsave_session;
+#ifdef MAC_OS
+Lisp_Object Qmac_apple_event;
+#endif
 
 /* Lisp_Object Qmouse_movement; - also an event header */
 
@@ -5915,6 +5918,20 @@
     case SAVE_SESSION_EVENT:
       return Qsave_session;
 
+#ifdef MAC_OS
+    case MAC_APPLE_EVENT:
+      {
+	Lisp_Object spec[2];
+
+	spec[0] = event->x;
+	spec[1] = event->y;
+	return Fcons (Qmac_apple_event,
+		      Fcons (Fvector (2, spec),
+			     Fcons (mac_make_lispy_event_code (event->code),
+				    Qnil)));
+      }
+#endif
+
       /* The 'kind' field of the event is something we don't recognize.  */
     default:
       abort ();
@@ -11074,6 +11091,11 @@
   Qsave_session = intern ("save-session");
   staticpro (&Qsave_session);
 
+#ifdef MAC_OS
+  Qmac_apple_event = intern ("mac-apple-event");
+  staticpro (&Qmac_apple_event);
+#endif
+
   Qusr1_signal = intern ("usr1-signal");
   staticpro (&Qusr1_signal);
   Qusr2_signal = intern ("usr2-signal");
--- a/src/lread.c	Sat Dec 10 21:18:28 2005 +0000
+++ b/src/lread.c	Sun Dec 11 22:42:40 2005 +0000
@@ -1739,13 +1739,12 @@
       return c | alt_modifier;
 
     case 's':
-      if (stringp)
-	return ' ';
       c = READCHAR;
-      if (c != '-') {
-	UNREAD (c);
-	return ' ';
-      }
+      if (c != '-')
+	{
+	  UNREAD (c);
+	  return ' ';
+	}
       c = READCHAR;
       if (c == '\\')
 	c = read_escape (readcharfun, 0, byterep);
--- a/src/mac.c	Sat Dec 10 21:18:28 2005 +0000
+++ b/src/mac.c	Sun Dec 11 22:42:40 2005 +0000
@@ -259,6 +259,216 @@
 
 
 /***********************************************************************
+		  Conversions on Apple event objects
+ ***********************************************************************/
+
+static Lisp_Object Qundecoded_file_name;
+
+static Lisp_Object
+mac_aelist_to_lisp (desc_list)
+     AEDescList *desc_list;
+{
+  OSErr err;
+  long count;
+  Lisp_Object result, elem;
+  DescType desc_type;
+  Size size;
+  AEKeyword keyword;
+  AEDesc desc;
+
+  err = AECountItems (desc_list, &count);
+  if (err != noErr)
+    return Qnil;
+  result = Qnil;
+  while (count > 0)
+    {
+      err = AESizeOfNthItem (desc_list, count, &desc_type, &size);
+      if (err == noErr)
+	switch (desc_type)
+	  {
+	  case typeAEList:
+	  case typeAERecord:
+	  case typeAppleEvent:
+	    err = AEGetNthDesc (desc_list, count, typeWildCard,
+				&keyword, &desc);
+	    if (err != noErr)
+	      break;
+	    elem = mac_aelist_to_lisp (&desc);
+	    AEDisposeDesc (&desc);
+	    break;
+
+	  default:
+	    if (desc_type == typeNull)
+	      elem = Qnil;
+	    else
+	      {
+		elem = make_uninit_string (size);
+		err = AEGetNthPtr (desc_list, count, typeWildCard, &keyword,
+				   &desc_type, SDATA (elem), size, &size);
+	      }
+	    if (err != noErr)
+	      break;
+	    desc_type = EndianU32_NtoB (desc_type);
+	    elem = Fcons (make_unibyte_string ((char *) &desc_type, 4), elem);
+	    break;
+	}
+
+      if (err != noErr)
+	elem = Qnil;
+      else if (desc_list->descriptorType != typeAEList)
+	{
+	  keyword = EndianU32_NtoB (keyword);
+	  elem = Fcons (make_unibyte_string ((char *) &keyword, 4), elem);
+	}
+
+      result = Fcons (elem, result);
+      count--;
+    }
+
+  desc_type = EndianU32_NtoB (desc_list->descriptorType);
+  return Fcons (make_unibyte_string ((char *) &desc_type, 4), result);
+}
+
+Lisp_Object
+mac_aedesc_to_lisp (desc)
+     AEDesc *desc;
+{
+  OSErr err;
+  DescType desc_type = desc->descriptorType;
+  Lisp_Object result;
+
+  switch (desc_type)
+    {
+    case typeNull:
+      result = Qnil;
+      break;
+
+    case typeAEList:
+    case typeAERecord:
+    case typeAppleEvent:
+      return mac_aelist_to_lisp (desc);
+#if 0
+      /* The following one is much simpler, but creates and disposes
+	 of Apple event descriptors many times.  */
+      {
+	long count;
+	Lisp_Object elem;
+	AEKeyword keyword;
+	AEDesc desc1;
+
+	err = AECountItems (desc, &count);
+	if (err != noErr)
+	  break;
+	result = Qnil;
+	while (count > 0)
+	  {
+	    err = AEGetNthDesc (desc, count, typeWildCard, &keyword, &desc1);
+	    if (err != noErr)
+	      break;
+	    elem = mac_aedesc_to_lisp (&desc1);
+	    AEDisposeDesc (&desc1);
+	    if (desc_type != typeAEList)
+	      {
+		keyword = EndianU32_NtoB (keyword);
+		elem = Fcons (make_unibyte_string ((char *) &keyword, 4), elem);
+	      }
+	    result = Fcons (elem, result);
+	    count--;
+	  }
+      }
+#endif
+      break;
+
+    default:
+#if TARGET_API_MAC_CARBON
+      result = make_uninit_string (AEGetDescDataSize (desc));
+      err = AEGetDescData (desc, SDATA (result), SBYTES (result));
+#else
+      result = make_uninit_string (GetHandleSize (desc->dataHandle));
+      memcpy (SDATA (result), *(desc->dataHandle), SBYTES (result));
+#endif
+      break;
+    }
+
+  if (err != noErr)
+    return Qnil;
+
+  desc_type = EndianU32_NtoB (desc_type);
+  return Fcons (make_unibyte_string ((char *) &desc_type, 4), result);
+}
+
+#if TARGET_API_MAC_CARBON
+OSErr
+create_apple_event_from_event_ref (event, num_params, names,
+				   types, sizes, result)
+     EventRef event;
+     UInt32 num_params;
+     EventParamName *names;
+     EventParamType *types;
+     UInt32 *sizes;
+     AppleEvent *result;
+{
+  OSErr err;
+  static const ProcessSerialNumber psn = {0, kCurrentProcess};
+  AEAddressDesc address_desc;
+  UInt32 i;
+  CFStringRef string;
+  CFDataRef data;
+  char *buf;
+
+  err = AECreateDesc (typeProcessSerialNumber, &psn,
+		      sizeof (ProcessSerialNumber), &address_desc);
+  if (err == noErr)
+    {
+      err = AECreateAppleEvent (0, 0, /* Dummy class and ID.   */
+				&address_desc, /* NULL is not allowed
+						  on Mac OS Classic. */
+				kAutoGenerateReturnID,
+				kAnyTransactionID, result);
+      AEDisposeDesc (&address_desc);
+    }
+  if (err != noErr)
+    return err;
+
+  for (i = 0; i < num_params; i++)
+    switch (types[i])
+      {
+#ifdef MAC_OSX
+      case typeCFStringRef:
+	err = GetEventParameter (event, names[i], typeCFStringRef, NULL,
+				 sizeof (CFStringRef), NULL, &string);
+	if (err != noErr)
+	  break;
+	data = CFStringCreateExternalRepresentation (NULL, string,
+						     kCFStringEncodingUTF8,
+						     '?');
+	if (data == NULL)
+	  break;
+	/* typeUTF8Text is not available on Mac OS X 10.1.  */
+	AEPutParamPtr (result, names[i], 'utf8',
+		       CFDataGetBytePtr (data), CFDataGetLength (data));
+	CFRelease (data);
+	break;
+#endif
+
+      default:
+	buf = xmalloc (sizes[i]);
+	if (buf == NULL)
+	  break;
+	err = GetEventParameter (event, names[i], types[i], NULL,
+				 sizes[i], NULL, buf);
+	if (err == noErr)
+	  AEPutParamPtr (result, names[i], types[i], buf, sizes[i]);
+	xfree (buf);
+	break;
+      }
+
+  return noErr;
+}
+#endif
+
+
+/***********************************************************************
 	 Conversion between Lisp and Core Foundation objects
  ***********************************************************************/
 
@@ -3887,6 +4097,116 @@
 }
 
 
+DEFUN ("mac-coerce-ae-data", Fmac_coerce_ae_data, Smac_coerce_ae_data, 3, 3, 0,
+       doc: /* Coerce Apple event data SRC-DATA of type SRC-TYPE to DST-TYPE.
+Each type should be a string of length 4 or the symbol
+`undecoded-file-name'.  */)
+  (src_type, src_data, dst_type)
+     Lisp_Object src_type, src_data, dst_type;
+{
+  OSErr err;
+  Lisp_Object result = Qnil;
+  DescType src_desc_type, dst_desc_type;
+  AEDesc dst_desc;
+#ifdef MAC_OSX
+  FSRef fref;
+#else
+  FSSpec fs;
+#endif
+
+  CHECK_STRING (src_data);
+  if (EQ (src_type, Qundecoded_file_name))
+    {
+#ifdef MAC_OSX
+      src_desc_type = typeFileURL;
+#else
+      src_desc_type = typeFSS;
+#endif
+    }
+  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
+    }
+  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),
+		     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));
+      AEDisposeDesc (&dst_desc);
+    }
+  UNBLOCK_INPUT;
+
+  return result;
+}
+
+
 #if TARGET_API_MAC_CARBON
 static Lisp_Object Qxml, Qmime_charset;
 static Lisp_Object QNFD, QNFKD, QNFC, QNFKC, QHFS_plus_D, QHFS_plus_C;
@@ -4676,6 +4996,9 @@
 void
 syms_of_mac ()
 {
+  Qundecoded_file_name = intern ("undecoded-file-name");
+  staticpro (&Qundecoded_file_name);
+
 #if TARGET_API_MAC_CARBON
   Qstring  = intern ("string");		staticpro (&Qstring);
   Qnumber  = intern ("number");		staticpro (&Qnumber);
@@ -4699,6 +5022,7 @@
   QHFS_plus_C = intern ("HFS+C");	staticpro (&QHFS_plus_C);
 #endif
 
+  defsubr (&Smac_coerce_ae_data);
 #if TARGET_API_MAC_CARBON
   defsubr (&Smac_get_preference);
   defsubr (&Smac_code_convert_string);
--- a/src/macselect.c	Sat Dec 10 21:18:28 2005 +0000
+++ b/src/macselect.c	Sun Dec 11 22:42:40 2005 +0000
@@ -23,6 +23,7 @@
 #include "lisp.h"
 #include "macterm.h"
 #include "blockinput.h"
+#include "keymap.h"
 
 #if !TARGET_API_MAC_CARBON
 #include <Endian.h>
@@ -908,6 +909,253 @@
 }
 
 
+int mac_ready_for_apple_events = 0;
+static Lisp_Object Vmac_apple_event_map;
+static Lisp_Object Qmac_apple_event_class, Qmac_apple_event_id;
+static struct
+{
+  AppleEvent *buf;
+  int size, count;
+} deferred_apple_events;
+extern Lisp_Object Qundefined;
+extern OSErr mac_store_apple_event P_ ((Lisp_Object, Lisp_Object,
+					const AEDesc *));
+
+struct apple_event_binding
+{
+  UInt32 code;			/* Apple event class or ID.  */
+  Lisp_Object key, binding;
+};
+
+static void
+find_event_binding_fun (key, binding, args, data)
+     Lisp_Object key, binding, args;
+     void *data;
+{
+  struct apple_event_binding *event_binding =
+    (struct apple_event_binding *)data;
+  Lisp_Object code_string;
+
+  if (!SYMBOLP (key))
+    return;
+  code_string = Fget (key, args);
+  if (STRINGP (code_string) && SBYTES (code_string) == 4
+      && (EndianU32_BtoN (*((UInt32 *) SDATA (code_string)))
+	  == event_binding->code))
+    {
+      event_binding->key = key;
+      event_binding->binding = binding;
+    }
+}
+
+static void
+find_event_binding (keymap, event_binding, class_p)
+     Lisp_Object keymap;
+     struct apple_event_binding *event_binding;
+     int class_p;
+{
+  if (event_binding->code == 0)
+    event_binding->binding =
+      access_keymap (keymap, event_binding->key, 0, 1, 0);
+  else
+    {
+      event_binding->binding = Qnil;
+      map_keymap (keymap, find_event_binding_fun,
+		  class_p ? Qmac_apple_event_class : Qmac_apple_event_id,
+		  event_binding, 0);
+    }
+}
+
+void
+mac_find_apple_event_spec (class, id, class_key, id_key, binding)
+     AEEventClass class;
+     AEEventID id;
+     Lisp_Object *class_key, *id_key, *binding;
+{
+  struct apple_event_binding event_binding;
+  Lisp_Object keymap;
+
+  *binding = Qnil;
+
+  keymap = get_keymap (Vmac_apple_event_map, 0, 0);
+  if (NILP (keymap))
+    return;
+
+  event_binding.code = class;
+  event_binding.key = *class_key;
+  event_binding.binding = Qnil;
+  find_event_binding (keymap, &event_binding, 1);
+  *class_key = event_binding.key;
+  keymap = get_keymap (event_binding.binding, 0, 0);
+  if (NILP (keymap))
+    return;
+
+  event_binding.code = id;
+  event_binding.key = *id_key;
+  event_binding.binding = Qnil;
+  find_event_binding (keymap, &event_binding, 0);
+  *id_key = event_binding.key;
+  *binding = event_binding.binding;
+}
+
+static OSErr
+defer_apple_events (apple_event, reply)
+     const AppleEvent *apple_event, *reply;
+{
+  OSErr err;
+
+  err = AESuspendTheCurrentEvent (apple_event);
+
+  /* Mac OS 10.3 Xcode manual says AESuspendTheCurrentEvent makes
+     copies of the Apple event and the reply, but Mac OS 10.4 Xcode
+     manual says it doesn't.  Anyway we create copies of them and save
+     it in `deferred_apple_events'.  */
+  if (err == noErr)
+    {
+      if (deferred_apple_events.buf == NULL)
+	{
+	  deferred_apple_events.size = 16;
+	  deferred_apple_events.count = 0;
+	  deferred_apple_events.buf =
+	    xmalloc (sizeof (AppleEvent) * deferred_apple_events.size);
+	  if (deferred_apple_events.buf == NULL)
+	    err = memFullErr;
+	}
+      else if (deferred_apple_events.count == deferred_apple_events.size)
+	{
+	  AppleEvent *newbuf;
+
+	  deferred_apple_events.size *= 2;
+	  newbuf = xrealloc (deferred_apple_events.buf,
+			     sizeof (AppleEvent) * deferred_apple_events.size);
+	  if (newbuf)
+	    deferred_apple_events.buf = newbuf;
+	  else
+	    err = memFullErr;
+	}
+    }
+
+  if (err == noErr)
+    {
+      int count = deferred_apple_events.count;
+
+      AEDuplicateDesc (apple_event, deferred_apple_events.buf + count);
+      AEDuplicateDesc (reply, deferred_apple_events.buf + count + 1);
+      deferred_apple_events.count += 2;
+    }
+
+  return err;
+}
+
+static pascal OSErr
+mac_handle_apple_event (apple_event, reply, refcon)
+     const AppleEvent *apple_event;
+     AppleEvent *reply;
+     SInt32 refcon;
+{
+  OSErr err;
+  AEEventClass event_class;
+  AEEventID event_id;
+  Lisp_Object class_key, id_key, binding;
+
+  /* We can't handle an Apple event that requests a reply, but this
+     seems to be too restrictive.  */
+#if 0
+  if (reply->descriptorType != typeNull)
+    return errAEEventNotHandled;
+#endif
+
+  if (!mac_ready_for_apple_events)
+    {
+      err = defer_apple_events (apple_event, reply);
+      if (err != noErr)
+	return errAEEventNotHandled;
+      return noErr;
+    }
+
+  err = AEGetAttributePtr (apple_event, keyEventClassAttr, typeType, NULL,
+			   &event_class, sizeof (AEEventClass), NULL);
+  if (err == noErr)
+    err = AEGetAttributePtr (apple_event, keyEventIDAttr, typeType, NULL,
+			     &event_id, sizeof (AEEventID), NULL);
+  if (err == noErr)
+    {
+      mac_find_apple_event_spec (event_class, event_id,
+				 &class_key, &id_key, &binding);
+      if (!NILP (binding) && !EQ (binding, Qundefined))
+	{
+	  if (INTEGERP (binding))
+	    return XINT (binding);
+	  err = mac_store_apple_event (class_key, id_key, apple_event);
+	  if (err == noErr)
+	    return noErr;
+	}
+    }
+  return errAEEventNotHandled;
+}
+
+void
+init_apple_event_handler ()
+{
+  OSErr err;
+  long result;
+
+  /* Make sure we have Apple events before starting.  */
+  err = Gestalt (gestaltAppleEventsAttr, &result);
+  if (err != noErr)
+    abort ();
+
+  if (!(result & (1 << gestaltAppleEventsPresent)))
+    abort ();
+
+  err = AEInstallEventHandler (typeWildCard, typeWildCard,
+#if TARGET_API_MAC_CARBON
+			       NewAEEventHandlerUPP (mac_handle_apple_event),
+#else
+			       NewAEEventHandlerProc (mac_handle_apple_event),
+#endif
+			       0L, false);
+  if (err != noErr)
+    abort ();
+}
+
+DEFUN ("mac-process-deferred-apple-events", Fmac_process_deferred_apple_events, Smac_process_deferred_apple_events, 0, 0, 0,
+       doc: /* Process Apple events that are deferred at the startup time.  */)
+  ()
+{
+  OSErr err;
+  Lisp_Object result = Qnil;
+  long i, count;
+  AppleEvent apple_event, reply;
+  AEKeyword keyword;
+
+  if (mac_ready_for_apple_events)
+    return Qnil;
+
+  BLOCK_INPUT;
+  mac_ready_for_apple_events = 1;
+  if (deferred_apple_events.buf)
+    {
+      for (i = 0; i < deferred_apple_events.count; i += 2)
+	{
+	  AEResumeTheCurrentEvent (deferred_apple_events.buf + i,
+				   deferred_apple_events.buf + i + 1,
+				   ((AEEventHandlerUPP)
+				    kAEUseStandardDispatch), 0);
+	  AEDisposeDesc (deferred_apple_events.buf + i);
+	  AEDisposeDesc (deferred_apple_events.buf + i + 1);
+	}
+      xfree (deferred_apple_events.buf);
+      bzero (&deferred_apple_events, sizeof (deferred_apple_events));
+
+      result = Qt;
+    }
+  UNBLOCK_INPUT;
+
+  return result;
+}
+
+
 #ifdef MAC_OSX
 void
 init_service_handler ()
@@ -920,7 +1168,56 @@
 				  GetEventTypeCount (specs), specs, NULL, NULL);
 }
 
-extern void mac_store_services_event P_ ((EventRef));
+extern OSErr mac_store_services_event P_ ((EventRef));
+
+static OSStatus
+copy_scrap_flavor_data (from_scrap, to_scrap, flavor_type)
+     ScrapRef from_scrap, to_scrap;
+     ScrapFlavorType flavor_type;
+{
+  OSStatus err;
+  Size size, size_allocated;
+  char *buf = NULL;
+
+  err = GetScrapFlavorSize (from_scrap, flavor_type, &size);
+  if (err == noErr)
+    buf = xmalloc (size);
+  while (buf)
+    {
+      size_allocated = size;
+      err = GetScrapFlavorData (from_scrap, flavor_type, &size, buf);
+      if (err != noErr)
+	{
+	  xfree (buf);
+	  buf = NULL;
+	}
+      else if (size_allocated < size)
+	{
+	  char *newbuf = xrealloc (buf, size);
+
+	  if (newbuf)
+	    buf = newbuf;
+	  else
+	    {
+	      xfree (buf);
+	      buf = NULL;
+	    }
+	}
+      else
+	break;
+    }
+  if (err == noErr)
+    if (buf == NULL)
+      err = memFullErr;
+    else
+      {
+	err = PutScrapFlavor (to_scrap, flavor_type, kScrapFlavorMaskNone,
+			      size, buf);
+	xfree (buf);
+      }
+
+  return err;
+}
 
 static OSStatus
 mac_handle_service_event (call_ref, event, data)
@@ -929,7 +1226,12 @@
      void *data;
 {
   OSStatus err = noErr;
-  ScrapRef cur_scrap;
+  ScrapRef cur_scrap, specific_scrap;
+  UInt32 event_kind = GetEventKind (event);
+  CFMutableArrayRef copy_types, paste_types;
+  CFStringRef type;
+  Lisp_Object rest;
+  ScrapFlavorType flavor_type;
 
   /* Check if Vmac_services_selection is a valid selection that has a
      corresponding scrap.  */
@@ -940,86 +1242,103 @@
   if (!(err == noErr && cur_scrap))
     return eventNotHandledErr;
 
-  switch (GetEventKind (event))
+  switch (event_kind)
     {
     case kEventServiceGetTypes:
-      {
-	CFMutableArrayRef copy_types, paste_types;
-	CFStringRef type;
-	Lisp_Object rest;
-	ScrapFlavorType flavor_type;
+      /* Set paste types. */
+      err = GetEventParameter (event, kEventParamServicePasteTypes,
+			       typeCFMutableArrayRef, NULL,
+			       sizeof (CFMutableArrayRef), NULL,
+			       &paste_types);
+      if (err != noErr)
+	break;
+
+      for (rest = Vselection_converter_alist; CONSP (rest);
+	   rest = XCDR (rest))
+	if (CONSP (XCAR (rest)) && SYMBOLP (XCAR (XCAR (rest)))
+	    && (flavor_type =
+		get_flavor_type_from_symbol (XCAR (XCAR (rest)))))
+	  {
+	    type = CreateTypeStringWithOSType (flavor_type);
+	    if (type)
+	      {
+		CFArrayAppendValue (paste_types, type);
+		CFRelease (type);
+	      }
+	  }
 
-	/* Set paste types. */
-	err = GetEventParameter (event, kEventParamServicePasteTypes,
-				 typeCFMutableArrayRef, NULL,
-				 sizeof (CFMutableArrayRef), NULL,
-				 &paste_types);
+      /* Set copy types.  */
+      err = GetEventParameter (event, kEventParamServiceCopyTypes,
+			       typeCFMutableArrayRef, NULL,
+			       sizeof (CFMutableArrayRef), NULL,
+			       &copy_types);
+      if (err != noErr)
+	break;
+
+      if (NILP (Fx_selection_owner_p (Vmac_services_selection)))
+	break;
+      else
+	goto copy_all_flavors;
+
+    case kEventServiceCopy:
+      err = GetEventParameter (event, kEventParamScrapRef,
+			       typeScrapRef, NULL,
+			       sizeof (ScrapRef), NULL, &specific_scrap);
+      if (err != noErr
+	  || NILP (Fx_selection_owner_p (Vmac_services_selection)))
+	{
+	  err = eventNotHandledErr;
+	  break;
+	}
+
+    copy_all_flavors:
+      {
+	UInt32 count, i;
+	ScrapFlavorInfo *flavor_info = NULL;
+	ScrapFlavorFlags flags;
+
+	err = GetScrapFlavorCount (cur_scrap, &count);
 	if (err == noErr)
-	  for (rest = Vselection_converter_alist; CONSP (rest);
-	       rest = XCDR (rest))
-	    if (CONSP (XCAR (rest)) && SYMBOLP (XCAR (XCAR (rest)))
-		&& (flavor_type =
-		    get_flavor_type_from_symbol (XCAR (XCAR (rest)))))
+	  flavor_info = xmalloc (sizeof (ScrapFlavorInfo) * count);
+	if (flavor_info)
+	  {
+	    err = GetScrapFlavorInfoList (cur_scrap, &count, flavor_info);
+	    if (err != noErr)
 	      {
-		type = CreateTypeStringWithOSType (flavor_type);
-		if (type)
+		xfree (flavor_info);
+		flavor_info = NULL;
+	      }
+	  }
+	if (flavor_info == NULL)
+	  break;
+
+	for (i = 0; i < count; i++)
+	  {
+	    flavor_type = flavor_info[i].flavorType;
+	    err = GetScrapFlavorFlags (cur_scrap, flavor_type, &flags);
+	    if (err == noErr && !(flags & kScrapFlavorMaskSenderOnly))
+	      {
+		if (event_kind == kEventServiceCopy)
+		  err = copy_scrap_flavor_data (cur_scrap, specific_scrap,
+						flavor_type);
+		else	     /* event_kind == kEventServiceGetTypes */
 		  {
-		    CFArrayAppendValue (paste_types, type);
-		    CFRelease (type);
+		    type = CreateTypeStringWithOSType (flavor_type);
+		    if (type)
+		      {
+			CFArrayAppendValue (copy_types, type);
+			CFRelease (type);
+		      }
 		  }
 	      }
-
-	/* Set copy types.  */
-	err = GetEventParameter (event, kEventParamServiceCopyTypes,
-				 typeCFMutableArrayRef, NULL,
-				 sizeof (CFMutableArrayRef), NULL,
-				 &copy_types);
-	if (err == noErr
-	    && !NILP (Fx_selection_owner_p (Vmac_services_selection)))
-	  for (rest = get_scrap_target_type_list (cur_scrap);
-	       CONSP (rest) && SYMBOLP (XCAR (rest)); rest = XCDR (rest))
-	    {
-	      flavor_type = get_flavor_type_from_symbol (XCAR (rest));
-	      if (flavor_type)
-		{
-		  type = CreateTypeStringWithOSType (flavor_type);
-		  if (type)
-		    {
-		      CFArrayAppendValue (copy_types, type);
-		      CFRelease (type);
-		    }
-		}
-	    }
-      }
-      break;
-
-    case kEventServiceCopy:
-      {
-	ScrapRef specific_scrap;
-	Lisp_Object rest, data;
-
-	err = GetEventParameter (event, kEventParamScrapRef,
-				 typeScrapRef, NULL,
-				 sizeof (ScrapRef), NULL, &specific_scrap);
-	if (err == noErr
-	    && !NILP (Fx_selection_owner_p (Vmac_services_selection)))
-	  for (rest = get_scrap_target_type_list (cur_scrap);
-	       CONSP (rest) && SYMBOLP (XCAR (rest)); rest = XCDR (rest))
-	    {
-	      data = get_scrap_string (cur_scrap, XCAR (rest));
-	      if (STRINGP (data))
-		err = put_scrap_string (specific_scrap, XCAR (rest), data);
-	    }
-	else
-	  err = eventNotHandledErr;
+	  }
+	xfree (flavor_info);
       }
       break;
 
     case kEventServicePaste:
     case kEventServicePerform:
       {
-        ScrapRef specific_scrap;
-	Lisp_Object rest, data;
 	int data_exists_p = 0;
 
         err = GetEventParameter (event, kEventParamScrapRef, typeScrapRef,
@@ -1033,25 +1352,24 @@
 	    {
 	      if (! (CONSP (XCAR (rest)) && SYMBOLP (XCAR (XCAR (rest)))))
 		continue;
-	      data = get_scrap_string (specific_scrap, XCAR (XCAR (rest)));
-	      if (STRINGP (data))
-		{
-		  err = put_scrap_string (cur_scrap, XCAR (XCAR (rest)),
-					  data);
-		  if (err != noErr)
-		    break;
-		  data_exists_p = 1;
-		}
+	      flavor_type = get_flavor_type_from_symbol (XCAR (XCAR (rest)));
+	      if (flavor_type == 0)
+		continue;
+	      err = copy_scrap_flavor_data (specific_scrap, cur_scrap,
+					    flavor_type);
+	      if (err == noErr)
+		data_exists_p = 1;
 	    }
-	if (err == noErr)
-	  if (data_exists_p)
-	    mac_store_application_menu_event (event);
-	  else
-	    err = eventNotHandledErr;
+	if (!data_exists_p)
+	  err = eventNotHandledErr;
+	else
+	  err = mac_store_services_event (event);
       }
       break;
     }
 
+  if (err != noErr)
+    err = eventNotHandledErr;
   return err;
 }
 #endif
@@ -1065,6 +1383,7 @@
   defsubr (&Sx_disown_selection_internal);
   defsubr (&Sx_selection_owner_p);
   defsubr (&Sx_selection_exists_p);
+  defsubr (&Smac_process_deferred_apple_events);
 
   Vselection_alist = Qnil;
   staticpro (&Vselection_alist);
@@ -1106,6 +1425,10 @@
 set to nil.  */);
   Vnext_selection_coding_system = Qnil;
 
+  DEFVAR_LISP ("mac-apple-event-map", &Vmac_apple_event_map,
+	       doc: /* Keymap for Apple events handled by Emacs.  */);
+  Vmac_apple_event_map = Qnil;
+
 #ifdef MAC_OSX
   DEFVAR_LISP ("mac-services-selection", &Vmac_services_selection,
 	       doc: /* Selection name for communication via Services menu.  */);
@@ -1125,6 +1448,12 @@
 
   Qmac_ostype = intern ("mac-ostype");
   staticpro (&Qmac_ostype);
+
+  Qmac_apple_event_class = intern ("mac-apple-event-class");
+  staticpro (&Qmac_apple_event_class);
+
+  Qmac_apple_event_id = intern ("mac-apple-event-id");
+  staticpro (&Qmac_apple_event_id);
 }
 
 /* arch-tag: f3c91ad8-99e0-4bd6-9eef-251b2f848732
--- a/src/macterm.c	Sat Dec 10 21:18:28 2005 +0000
+++ b/src/macterm.c	Sun Dec 11 22:42:40 2005 +0000
@@ -622,7 +622,7 @@
       ByteCount sizes[] = {sizeof (ATSLineLayoutOptions)};
       static ATSLineLayoutOptions line_layout =
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
-	kATSLineDisableAllLayoutOperations  | kATSLineUseDeviceMetrics
+	kATSLineDisableAllLayoutOperations | kATSLineUseDeviceMetrics
 #else
 	kATSLineIsDisplayOnly | kATSLineFractDisable
 #endif
@@ -8127,20 +8127,18 @@
    Carbon/Apple event handlers.  */
 static struct input_event *read_socket_inev = NULL;
 
-/* Set in term/mac-win.el to indicate that event loop can now generate
-   drag and drop events.  */
-Lisp_Object Qmac_ready_for_drag_n_drop;
-
 Point saved_menu_event_location;
 
 /* Apple Events */
-static void init_required_apple_events (void);
-static pascal OSErr
-do_ae_open_application (const AppleEvent *, AppleEvent *, long);
-static pascal OSErr
-do_ae_print_documents (const AppleEvent *, AppleEvent *, long);
-static pascal OSErr do_ae_open_documents (AppleEvent *, AppleEvent *, long);
-static pascal OSErr do_ae_quit_application (AppleEvent *, AppleEvent *, long);
+#if USE_CARBON_EVENTS
+static Lisp_Object Qhicommand;
+#endif
+extern int mac_ready_for_apple_events;
+extern Lisp_Object Qundefined;
+extern void init_apple_event_handler P_ ((void));
+extern void mac_find_apple_event_spec P_ ((AEEventClass, AEEventID,
+					   Lisp_Object *, Lisp_Object *,
+					   Lisp_Object *));
 
 #if TARGET_API_MAC_CARBON
 /* Drag and Drop */
@@ -8150,11 +8148,10 @@
 static DragReceiveHandlerUPP mac_do_receive_dragUPP = NULL;
 #endif
 
-static Lisp_Object Qapplication, Qabout;
 #if USE_CARBON_EVENTS
 #ifdef MAC_OSX
 extern void init_service_handler ();
-static Lisp_Object Qpreferences, Qservices, Qpaste, Qperform;
+static Lisp_Object Qservices, Qpaste, Qperform;
 #endif
 /* Window Event Handler */
 static pascal OSStatus mac_handle_window_event (EventHandlerCallRef,
@@ -8699,179 +8696,49 @@
   x_real_positions (f, &f->left_pos, &f->top_pos);
 }
 
-/* Intialize AppleEvent dispatcher table for the required events.  */
-void
-init_required_apple_events ()
-{
-  OSErr err;
-  long result;
-
-  /* Make sure we have apple events before starting.  */
-  err = Gestalt (gestaltAppleEventsAttr, &result);
-  if (err != noErr)
-    abort ();
-
-  if (!(result & (1 << gestaltAppleEventsPresent)))
-    abort ();
-
-#if TARGET_API_MAC_CARBON
-  err = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication,
-			      NewAEEventHandlerUPP
-			      ((AEEventHandlerProcPtr) do_ae_open_application),
-                              0L, false);
-#else
-  err = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication,
-			      NewAEEventHandlerProc
-			      ((AEEventHandlerProcPtr) do_ae_open_application),
-                              0L, false);
-#endif
-  if (err != noErr)
-    abort ();
-
-#if TARGET_API_MAC_CARBON
-  err = AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
-                              NewAEEventHandlerUPP
-			      ((AEEventHandlerProcPtr) do_ae_open_documents),
-                              0L, false);
-#else
-  err = AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
-                              NewAEEventHandlerProc
-			      ((AEEventHandlerProcPtr) do_ae_open_documents),
-                              0L, false);
-#endif
-  if (err != noErr)
-    abort ();
-
-#if TARGET_API_MAC_CARBON
-  err = AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments,
-                              NewAEEventHandlerUPP
-			      ((AEEventHandlerProcPtr) do_ae_print_documents),
-                              0L, false);
-#else
-  err = AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments,
-                              NewAEEventHandlerProc
-			      ((AEEventHandlerProcPtr) do_ae_print_documents),
-                              0L, false);
-#endif
-  if (err != noErr)
-    abort ();
-
-#if TARGET_API_MAC_CARBON
-  err = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
-                              NewAEEventHandlerUPP
-			      ((AEEventHandlerProcPtr) do_ae_quit_application),
-                              0L, false);
-#else
-  err = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
-                              NewAEEventHandlerProc
-			      ((AEEventHandlerProcPtr) do_ae_quit_application),
-                              0L, false);
-#endif
-  if (err != noErr)
-    abort ();
-}
-
-void
-mac_store_application_menu_event (event)
-#if USE_CARBON_EVENTS
-     EventRef event;
-#else
-     UInt32 event;
-#endif
-{
+OSErr
+mac_store_apple_event (class, id, desc)
+     Lisp_Object class, id;
+     const AEDesc *desc;
+{
+  OSErr err = noErr;
   struct input_event buf;
-  Lisp_Object frame, entry;
-
-  EVENT_INIT (buf);
-
-  XSETFRAME (frame, mac_focus_frame (&one_mac_display_info));
-  buf.kind = MENU_BAR_EVENT;
-  buf.frame_or_window = frame;
-  buf.arg = frame;
-  kbd_buffer_store_event (&buf);
-
-  buf.arg = Qapplication;
-  kbd_buffer_store_event (&buf);
-
-#if USE_CARBON_EVENTS
-  switch (GetEventClass (event))
-    {
-#ifdef MAC_OSX
-    case kEventClassService:
-      buf.arg = Qservices;
+  AEDesc *desc_copy;
+
+  desc_copy = xmalloc (sizeof (AEDesc));
+  if (desc_copy == NULL)
+    err = memFullErr;
+  else
+    err = AEDuplicateDesc (desc, desc_copy);
+  if (err == noErr)
+    {
+      EVENT_INIT (buf);
+
+      buf.kind = MAC_APPLE_EVENT;
+      buf.x = class;
+      buf.y = id;
+      buf.code = (int)desc_copy;
+      XSETFRAME (buf.frame_or_window,
+		 mac_focus_frame (&one_mac_display_info));
+      buf.arg = Qnil;
       kbd_buffer_store_event (&buf);
-      switch (GetEventKind (event))
-	{
-	case kEventServicePaste:
-	  entry = Qpaste;
-	  break;
-
-	case kEventServicePerform:
-	  {
-	    OSErr err;
-	    CFStringRef message;
-
-	    err = GetEventParameter (event, kEventParamServiceMessageName,
-				     typeCFStringRef, NULL,
-				     sizeof (CFStringRef), NULL, &message);
-	    buf.arg = Qperform;
-	    kbd_buffer_store_event (&buf);
-	    if (err == noErr && message)
-	      entry = intern (SDATA (cfstring_to_lisp (message)));
-	    else
-	      entry = Qnil;
-	  }
-	  break;
-
-	default:
-	  abort ();
-	}
-      break;
-#endif	/* MAC_OSX */
-    case kEventClassCommand:
-      {
-	HICommand command;
-
-	GetEventParameter(event, kEventParamDirectObject, typeHICommand,
-			  NULL, sizeof (HICommand), NULL, &command);
-	switch (command.commandID)
-	  {
-	  case kHICommandAbout:
-	    entry = Qabout;
-	    break;
-#ifdef MAC_OSX
-	  case kHICommandPreferences:
-	    entry = Qpreferences;
-	    break;
-#endif /* MAC_OSX */
-	  case kHICommandQuit:
-	    entry = Qquit;
-	    break;
-	  default:
-	    abort ();
-	  }
-      }
-      break;
-
-    default:
-      abort ();
-    }
-#else  /* USE_CARBON_EVENTS */
-  switch (event)
-    {
-    case kHICommandAbout:
-      entry = Qabout;
-      break;
-    case kHICommandQuit:
-      entry = Qquit;
-      break;
-    default:
-      abort ();
-    }
-#endif
-
-  buf.arg = entry;
-  kbd_buffer_store_event (&buf);
+    }
+
+  return err;
+}
+
+Lisp_Object
+mac_make_lispy_event_code (code)
+     int code;
+{
+  AEDesc *desc = (AEDesc *)code;
+  Lisp_Object obj;
+
+  obj = mac_aedesc_to_lisp (desc);
+  AEDisposeDesc (desc);
+  xfree (desc);
+
+  return obj;
 }
 
 #if USE_CARBON_EVENTS
@@ -8881,28 +8748,49 @@
      EventRef event;
      void *data;
 {
+  OSStatus result;
+  OSErr err;
   HICommand command;
-  OSErr result;
-
-  GetEventParameter(event, kEventParamDirectObject, typeHICommand, NULL,
-		    sizeof (HICommand), NULL, &command);
-
-  switch (command.commandID)
-    {
-    case kHICommandAbout:
-#ifdef MAC_OSX
-    case kHICommandPreferences:
-#endif	/* MAC_OSX */
-      result = CallNextEventHandler (next_handler, event);
-      if (result != eventNotHandledErr)
-	return result;
-
-      mac_store_application_menu_event (event);
-      return noErr;
-
-    default:
-      break;
-    }
+  Lisp_Object class_key, id_key, binding;
+
+  result = CallNextEventHandler (next_handler, event);
+  if (result != eventNotHandledErr)
+    return result;
+
+  GetEventParameter (event, kEventParamDirectObject, typeHICommand, NULL,
+		     sizeof (HICommand), NULL, &command);
+
+  if (command.commandID == 0)
+    return eventNotHandledErr;
+
+  /* A HICommand event is mapped to an Apple event whose event class
+     symbol is `hicommand' and event ID is its command ID.  */
+  class_key = Qhicommand;
+  mac_find_apple_event_spec (0, command.commandID,
+			     &class_key, &id_key, &binding);
+  if (!NILP (binding) && !EQ (binding, Qundefined))
+    if (INTEGERP (binding))
+      return XINT (binding);
+    else
+      {
+	AppleEvent apple_event;
+	UInt32 modifiers;
+	static EventParamName names[] = {kEventParamDirectObject,
+					 kEventParamKeyModifiers};
+	static EventParamType types[] = {typeHICommand,
+					 typeUInt32};
+	static UInt32 sizes[] = {sizeof (HICommand),
+				 sizeof (UInt32)};
+	err = create_apple_event_from_event_ref (event, 2, names, types,
+						 sizes, &apple_event);
+	if (err == noErr)
+	  {
+	    err = mac_store_apple_event (class_key, id_key, &apple_event);
+	    AEDisposeDesc (&apple_event);
+	  }
+	if (err == noErr)
+	  return noErr;
+      }
 
   return eventNotHandledErr;
 }
@@ -9064,6 +8952,52 @@
 
   return eventNotHandledErr;
 }
+
+#ifdef MAC_OSX
+OSErr
+mac_store_services_event (event)
+     EventRef event;
+{
+  OSErr err;
+  AppleEvent apple_event;
+  Lisp_Object id_key;
+
+  switch (GetEventKind (event))
+    {
+    case kEventServicePaste:
+      id_key = Qpaste;
+      err = create_apple_event_from_event_ref (event, 0, NULL,
+					       NULL, NULL, &apple_event);
+      break;
+
+    case kEventServicePerform:
+      {
+	static EventParamName names[] = {kEventParamServiceMessageName,
+					 kEventParamServiceUserData};
+	static EventParamType types[] = {typeCFStringRef,
+					 typeCFStringRef};
+	static UInt32 sizes[] = {sizeof (CFStringRef),
+				 sizeof (CFStringRef)};
+
+	id_key = Qperform;
+	err = create_apple_event_from_event_ref (event, 2, names, types,
+						 sizes, &apple_event);
+      }
+      break;
+
+    default:
+      abort ();
+    }
+
+  if (err == noErr)
+    {
+      err = mac_store_apple_event (Qservices, id_key, &apple_event);
+      AEDisposeDesc (&apple_event);
+    }
+
+  return err;
+}
+#endif	/* MAC_OSX */
 #endif	/* USE_CARBON_EVENTS */
 
 
@@ -9122,159 +9056,6 @@
 #endif
 }
 
-/* Open Application Apple Event */
-static pascal OSErr
-do_ae_open_application(const AppleEvent *pae, AppleEvent *preply, long prefcon)
-{
-  return noErr;
-}
-
-
-/* Called when we receive an AppleEvent with an ID of
-   "kAEOpenDocuments".  This routine gets the direct parameter,
-   extracts the FSSpecs in it, and puts their names on a list.  */
-#pragma options align=mac68k
-typedef struct SelectionRange {
-  short unused1; // 0 (not used)
-  short lineNum; // line to select (<0 to specify range)
-  long startRange; // start of selection range (if line < 0)
-  long endRange; // end of selection range (if line < 0)
-  long unused2; // 0 (not used)
-  long theDate; // modification date/time
-} SelectionRange;
-#pragma options align=reset
-
-static pascal OSErr
-do_ae_open_documents(AppleEvent *message, AppleEvent *reply, long refcon)
-{
-  OSErr err, err2;
-  AEDesc the_desc;
-  AEKeyword keyword;
-  DescType actual_type;
-  Size actual_size;
-  SelectionRange position;
-  Lisp_Object file_list = Qnil;
-
-  xassert (read_socket_inev);
-
-  err = AEGetParamDesc (message, keyDirectObject, typeAEList, &the_desc);
-  if (err != noErr)
-    goto descriptor_error_exit;
-
-  err = AEGetParamPtr (message, keyAEPosition, typeChar, &actual_type, &position, sizeof(SelectionRange), &actual_size);
-  if (err == noErr)
-    file_list = Fcons (list3 (make_number (position.lineNum + 1),
-			      make_number (position.startRange + 1),
-			      make_number (position.endRange + 1)),
-		       file_list);
-
-  /* Check to see that we got all of the required parameters from the
-     event descriptor.  For an 'odoc' event this should just be the
-     file list.  */
-  err = AEGetAttributePtr(message, keyMissedKeywordAttr, typeWildCard,
-			  &actual_type, (Ptr) &keyword,
-                          sizeof (keyword), &actual_size);
-  /* No error means that we found some unused parameters.
-     errAEDescNotFound means that there are no more parameters.  If we
-     get an error code other than that, flag it.  */
-  if ((err == noErr) || (err != errAEDescNotFound))
-    {
-      err = errAEEventNotHandled;
-      goto error_exit;
-    }
-  err = noErr;
-
-  /* Got all the parameters we need.  Now, go through the direct
-     object list and parse it up.  */
-  {
-    long num_files_to_open;
-
-    err = AECountItems (&the_desc, &num_files_to_open);
-    if (err == noErr)
-      {
-        int i;
-
-        /* AE file list is one based so just use that for indexing here.  */
-        for (i = 1; i <= num_files_to_open; i++)
-	  {
-	    char unix_path_name[MAXPATHLEN];
-#ifdef MAC_OSX
-	    FSRef fref;
-
-	    err = AEGetNthPtr (&the_desc, i, typeFSRef, &keyword,
-			       &actual_type, &fref, sizeof (FSRef),
-			       &actual_size);
-	    if (err != noErr || actual_type != typeFSRef)
-	      continue;
-
-	    if (FSRefMakePath (&fref, unix_path_name, sizeof (unix_path_name))
-		== noErr)
-#else
-	    FSSpec fs;
-
-	    err = AEGetNthPtr(&the_desc, i, typeFSS, &keyword, &actual_type,
-			      (Ptr) &fs, sizeof (fs), &actual_size);
-	    if (err != noErr) continue;
-
-	    if (fsspec_to_posix_pathname (&fs, 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);
-	  }
-      }
-
-    /* Build a DRAG_N_DROP_EVENT type event as is done in
-       constuct_drag_n_drop in w32term.c.  */
-    if (!NILP (file_list))
-      {
-	struct frame *f = mac_focus_frame (&one_mac_display_info);
-	WindowPtr wp;
-	Lisp_Object frame;
-
-	read_socket_inev->kind = DRAG_N_DROP_EVENT;
-	read_socket_inev->code = 0;
-	read_socket_inev->modifiers = 0;
-
-	XSETINT (read_socket_inev->x, 0);
-	XSETINT (read_socket_inev->y, 0);
-
-	XSETFRAME (frame, f);
-	read_socket_inev->frame_or_window = Fcons (frame, file_list);
-
-#if 0
-	/* Regardless of whether Emacs was suspended or in the
-	   foreground, ask it to redraw its entire screen.  Otherwise
-	   parts of the screen can be left in an inconsistent
-	   state.  */
-	wp = FRAME_MAC_WINDOW (f);
-	if (wp)
-#if TARGET_API_MAC_CARBON
-	  {
-	    Rect r;
-
-	    GetWindowPortBounds (wp, &r);
-	    InvalWindowRect (wp, &r);
-	  }
-#else /* not TARGET_API_MAC_CARBON */
-	InvalRect (&(wp->portRect));
-#endif /* not TARGET_API_MAC_CARBON */
-#endif
-      }
-  }
-
-error_exit:
-  /* Nuke the coerced file list in any case */
-  err2 = AEDisposeDesc(&the_desc);
-
-descriptor_error_exit:
-  /* InvalRect(&(gFrontMacWindowP->mWP->portRect)); */
-  return err;
-}
-
-
 #if TARGET_API_MAC_CARBON
 static pascal OSErr
 mac_do_track_drag (DragTrackingMessage message, WindowPtr window,
@@ -9429,44 +9210,6 @@
 #endif
 
 
-/* Print Document Apple Event */
-static pascal OSErr
-do_ae_print_documents (const AppleEvent *pAE, AppleEvent *reply, long refcon)
-{
-  return errAEEventNotHandled;
-}
-
-
-static pascal OSErr
-do_ae_quit_application (AppleEvent* message, AppleEvent *reply, long refcon)
-{
-#if USE_CARBON_EVENTS
-  OSErr err;
-  EventRef event = NULL;
-  static const HICommand quit_command = {kEventAttributeNone, kHICommandQuit};
-
-  err = CreateEvent (NULL, kEventClassCommand, kEventCommandProcess, 0,
-		     kEventAttributeUserEvent, &event);
-  if (err == noErr)
-    err = SetEventParameter (event, kEventParamDirectObject, typeHICommand,
-			     sizeof (HICommand), &quit_command);
-  if (err == noErr)
-    mac_store_application_menu_event (event);
-  if (event)
-    ReleaseEvent (event);
-
-  if (err == noErr)
-    return noErr;
-  else
-    return errAEEventNotHandled;
-#else
-  mac_store_application_menu_event (kHICommandQuit);
-
-  return noErr;
-#endif
-}
-
-
 #if __profile__
 void
 profiler_exit_proc ()
@@ -9520,7 +9263,7 @@
 
   initialize_applescript ();
 
-  init_required_apple_events ();
+  init_apple_event_handler ();
 
   {
     char **argv;
@@ -9724,7 +9467,7 @@
     mouse_region = NewRgn ();
 
   event_mask = everyEvent;
-  if (NILP (Fboundp (Qmac_ready_for_drag_n_drop)))
+  if (!mac_ready_for_apple_events)
     event_mask -= highLevelEventMask;
 
   current_tick = TickCount ();
@@ -10892,7 +10635,6 @@
   BLOCK_INPUT;
 
 #if TARGET_API_MAC_CARBON
-  init_required_apple_events ();
 
 #if USE_CARBON_EVENTS
 #ifdef MAC_OSX
@@ -10907,6 +10649,8 @@
 #endif	/* USE_CARBON_EVENTS */
 
 #ifdef MAC_OSX
+  init_apple_event_handler ();
+
   if (!inhibit_window_system)
     MakeMeTheFrontProcess ();
 #endif
@@ -10937,15 +10681,14 @@
   Fput (Qhyper,   Qmodifier_value, make_number (hyper_modifier));
   Fput (Qsuper,   Qmodifier_value, make_number (super_modifier));
 
-  Qapplication = intern ("application");  staticpro (&Qapplication);
-  Qabout       = intern ("about");	  staticpro (&Qabout);
-
-#if USE_CARBON_EVENTS && defined (MAC_OSX)
-  Qpreferences = intern ("preferences");  staticpro (&Qpreferences);
+#if USE_CARBON_EVENTS
+  Qhicommand   = intern ("hicommand");    staticpro (&Qhicommand);
+#ifdef MAC_OSX
   Qservices    = intern ("services");	  staticpro (&Qservices);
   Qpaste       = intern ("paste");	  staticpro (&Qpaste);
   Qperform     = intern ("perform");	  staticpro (&Qperform);
 #endif
+#endif
 
 #ifdef MAC_OSX
   Fprovide (intern ("mac-carbon"), Qnil);
@@ -10954,9 +10697,6 @@
   staticpro (&Qreverse);
   Qreverse = intern ("reverse");
 
-  staticpro (&Qmac_ready_for_drag_n_drop);
-  Qmac_ready_for_drag_n_drop = intern ("mac-ready-for-drag-n-drop");
-
   staticpro (&x_display_name_list);
   x_display_name_list = Qnil;
 
--- a/src/macterm.h	Sat Dec 10 21:18:28 2005 +0000
+++ b/src/macterm.h	Sun Dec 11 22:42:40 2005 +0000
@@ -79,7 +79,7 @@
   /* Number of planes on this screen.  */
   int n_planes;
 
-  /* Whether the screen supports color */ 
+  /* Whether the screen supports color */
   int color_p;
 
   /* Dimensions of this screen.  */
@@ -564,6 +564,7 @@
 extern void mac_unload_font P_ ((struct mac_display_info *, XFontStruct *));
 extern OSErr install_window_handler P_ ((WindowPtr));
 extern void remove_window_handler P_ ((WindowPtr));
+extern Lisp_Object mac_make_lispy_event_code P_ ((int));
 
 #define FONT_TYPE_FOR_UNIBYTE(font, ch) 0
 #define FONT_TYPE_FOR_MULTIBYTE(font, ch) 0
@@ -577,7 +578,12 @@
 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
+extern OSErr create_apple_event_from_event_ref P_ ((EventRef, UInt32,
+						    EventParamName *,
+						    EventParamType *,
+						    UInt32 *, AppleEvent *));
 extern CFStringRef cfstring_create_with_utf8_cstring P_ ((const char *));
 extern CFStringRef cfstring_create_with_string P_ ((Lisp_Object));
 extern Lisp_Object cfdata_to_lisp P_ ((CFDataRef));
@@ -592,6 +598,7 @@
 extern void xrm_merge_string_database P_ ((XrmDatabase, char *));
 extern Lisp_Object xrm_get_resource P_ ((XrmDatabase, char *, char *));
 extern XrmDatabase xrm_get_preference_database P_ ((char *));
+EXFUN (Fmac_get_preference, 4);
 
 /* arch-tag: 6b4ca125-5bef-476d-8ee8-31ed808b7e79
    (do not change this comment) */
--- a/src/termhooks.h	Sat Dec 10 21:18:28 2005 +0000
+++ b/src/termhooks.h	Sun Dec 11 22:42:40 2005 +0000
@@ -129,7 +129,7 @@
 				   by MS-Windows scroll bar controls. */
 #endif
   SELECTION_REQUEST_EVENT,	/* Another X client wants a selection from us.
-				   See `struct selection_event'.  */
+				   See `struct selection_input_event'.  */
   SELECTION_CLEAR_EVENT,	/* Another X client cleared our selection.  */
   BUFFER_SWITCH_EVENT,		/* A process filter has switched buffers.  */
   DELETE_WINDOW_EVENT,		/* An X client said "delete this window".  */
@@ -177,12 +177,22 @@
 
   /* Queued from XTread_socket when session manager sends
      save yourself before shutdown. */
-  SAVE_SESSION_EVENT
+  SAVE_SESSION_EVENT,
+
+#ifdef MAC_OS
+  /* Generated when an Apple event, a HICommand event, or a Services
+     menu event is received and the corresponding handler is
+     registered.  Members `x' and `y' are for the event class and ID
+     symbols, respectively.  Member `code' points to the Apple event
+     descriptor.  Parameters for Non-Apple events are converted to
+     those in Apple events.  */
+  MAC_APPLE_EVENT
+#endif
 };
 
 /* If a struct input_event has a kind which is SELECTION_REQUEST_EVENT
    or SELECTION_CLEAR_EVENT, then its contents are really described
-   by `struct selection_event'; see xterm.h.  */
+   by `struct selection_input_event'; see xterm.h.  */
 
 /* The keyboard input buffer is an array of these structures.  Each one
    represents some sort of input event - a keystroke, a mouse click, or
@@ -208,7 +218,7 @@
   unsigned long timestamp;
 
   /* This is padding just to put the frame_or_window field
-     past the size of struct selection_event.  */
+     past the size of struct selection_input_event.  */
   int *padding[2];
 
   /* This field is copied into a vector while the event is in the queue,
--- a/src/w32fns.c	Sat Dec 10 21:18:28 2005 +0000
+++ b/src/w32fns.c	Sun Dec 11 22:42:40 2005 +0000
@@ -8939,8 +8939,12 @@
   button = MessageBox (NULL,
 		       "A fatal error has occurred!\n\n"
 		       "Would you like to attach a debugger?\n\n"
-		       "Select YES to debug, NO to abort Emacs",
-		       "Emacs Abort Dialog",
+		       "Select YES to debug, NO to abort Emacs"
+#if __GNUC__
+		       "\n\n(type \"gdb -p <emacs-PID>\" and\n"
+		       "\"continue\" inside GDB before clicking YES.)"
+#endif
+		       , "Emacs Abort Dialog",
 		       MB_ICONEXCLAMATION | MB_TASKMODAL
 		       | MB_SETFOREGROUND | MB_YESNO);
   switch (button)