changeset 90341:5754737d1e04

Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-34 Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 123-134) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 40-48) - Merge from emacs--devo--0 - Update from CVS - Munge arch explicit ids in etc/images to match Emacs
author Miles Bader <miles@gnu.org>
date Fri, 03 Mar 2006 07:48:46 +0000
parents 8f2b88ad38c4 (current diff) 6580c61aced7 (diff)
children c649841811e1
files admin/FOR-RELEASE lisp/ChangeLog lisp/calc/calccomp.el lisp/calendar/calendar.el lisp/emacs-lisp/autoload.el lisp/emacs-lisp/find-func.el lisp/files.el lisp/gnus/ChangeLog lisp/gnus/flow-fill.el lisp/gnus/gnus-draft.el lisp/gnus/gnus-int.el lisp/gnus/gnus-sum.el lisp/gnus/mm-decode.el lisp/gnus/mm-util.el lisp/gnus/mml.el lisp/gnus/nnweb.el lisp/jka-compr.el lisp/loadhist.el lisp/mh-e/ChangeLog lisp/mh-e/mh-e.el lisp/mh-e/mh-mime.el lisp/mh-e/mh-utils.el lisp/progmodes/gdb-ui.el lisp/progmodes/gud.el lisp/speedbar.el lisp/startup.el lisp/subr.el lisp/textmodes/org.el lisp/textmodes/reftex-index.el lisp/textmodes/reftex-sel.el lisp/textmodes/reftex-toc.el lispref/ChangeLog lispref/elisp.texi lispref/files.texi lispref/keymaps.texi lispref/loading.texi man/ChangeLog man/emacs-mime.texi man/files.texi src/ChangeLog src/eval.c src/frame.h src/lisp.h src/lread.c src/search.c src/w32.c src/window.c src/xdisp.c src/xfns.c src/xselect.c src/xterm.c src/xterm.h
diffstat 65 files changed, 2250 insertions(+), 799 deletions(-) [+]
line wrap: on
line diff
--- a/admin/FOR-RELEASE	Fri Mar 03 05:16:17 2006 +0000
+++ b/admin/FOR-RELEASE	Fri Mar 03 07:48:46 2006 +0000
@@ -31,15 +31,22 @@
 ** Ensure MH-E 8.0 has been released.
 Assigned to Bill Wohler <wohler@newt.com>.
 
-* NEW FEATURES
-
 * BUGS
 
 ** Reiner Steib's 23 Jan 2006 bug report that tool bar icons don't update.
 URL/MID: http://mid.gmane.org/v9acdmrcse.fsf@marauder.physik.uni-ulm.de
 
-** Ralf Angeli's 4 Jul 2005 bug report about scroll-preserve-screen-position.
-URL/MID: http://mid.gmane.org/877jg6o7k4.fsf@neutrino.iwi.uni-sb.de
+** Problems with moving point across invisible text,
+including Ralf Angeli's 21 Feb bug report
+and Martin Rudalics' 14 Feb bug report "Re: moving point and invisible text"
+  
+** Markus Gritsch's report about Emacs looping on Windoze with the following
+.emacs file, and then reduce Emacs frame width to "something quite narrow":
+	(setq-default truncate-lines t)
+	(custom-set-variables
+	 '(hscroll-margin 20)
+	 '(hscroll-step 1)
+	)
 
 ** TCP server processes do not work on Windows.
 
--- a/etc/gnus-tut.txt	Fri Mar 03 05:16:17 2006 +0000
+++ b/etc/gnus-tut.txt	Fri Mar 03 07:48:46 2006 +0000
@@ -223,7 +223,7 @@
 
 Create the group by saying
 
-`M-a my.virtual.newsgroup<RET>nnvirtual<RET>^rec\.aquaria\.*<RET>'
+`G m my.virtual.newsgroup<RET>nnvirtual<RET>^rec\.aquaria\.*<RET>'
 
 This will create the group "nnvirtual:my.virtual.newsgroup", which
 will collect all articles from all the groups in the "rec.aquaria"
--- a/etc/orgcard.tex	Fri Mar 03 05:16:17 2006 +0000
+++ b/etc/orgcard.tex	Fri Mar 03 07:48:46 2006 +0000
@@ -1,4 +1,4 @@
-% Reference Card for Org Mode 4.06
+% Reference Card for Org Mode 4.07
 %
 %**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{4.06}
+\def\orgversionnumber{4.07}
 \def\year{2006}
 
 \def\shortcopyrightnotice{\vskip 1ex plus 2 fill
--- a/lisp/ChangeLog	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/ChangeLog	Fri Mar 03 07:48:46 2006 +0000
@@ -1,3 +1,149 @@
+2006-03-02  Carsten Dominik  <dominik@science.uva.nl>
+
+	* textmodes/org.el (org-paste-subtree): Removed forgotten (debug)
+	form.
+
+2006-03-02  Nick Roberts  <nickrob@snap.net.nz>
+
+	* dframe.el (dframe-frame-mode): Don't burp when menu-bar-lines
+	is nil.
+
+	* progmodes/gud.el (gud-speedbar-menu-items): Use
+	buffer-local-value and add missing :visible keyword.
+
+	* progmodes/gdb-ui.el (gdb-speedbar-refresh): Quieten
+	speedbar-refresh.
+
+2006-03-01  Carsten Dominik  <dominik@science.uva.nl>
+
+	* textmodes/reftex-index.el (reftex-index-map): `follow-mouse'
+	must be `follow-link'.
+
+	* textmodes/reftex-toc.el (reftex-toc-map): `follow-mouse' must be
+	`follow-link'.
+
+	* textmodes/org.el (org-export-as-html): Fix bugs in HTML
+	formatting: No nested anchors.
+	(org-all-targets): Fix bug with XEmacs compatibility.
+	(org-read-date): Add (require 'parse-time).
+	(org-set-tags): Fix bug with extra inserted space.
+	(org-export-html-style): Define a style class for targets.
+	(org-agenda-keymap, org-mouse-map): Add a binding for
+	`follow-link'.
+	(org-hide-leading-stars): New option.
+	(org-hide): New face.
+	(org-set-font-lock-defaults): Allow to hide leading stars.
+	(org-get-legal-level, org-tr-level): New functions.
+	(org-odd-levels-only): New option.
+	(org-level-faces, org-paste-subtree, org-convert-to-odd-levels)
+	(org-demote, org-promote): Deal with double-star levels.
+	(org-convert-to-odd-levels): New command.
+
+2006-03-01  Nick Roberts  <nickrob@snap.net.nz>
+
+	* speedbar.el (speedbar-update-localized-contents): Try to
+	preserve window-start.
+	(speedbar-update-directory-contents): Try to preserve window-start
+	and window-point.
+	(speedbar-update-special-contents): Don't move back to start of
+	window.
+
+	* progmodes/gdb-ui.el (gdb-speedbar-refresh): Rename from
+	gdb-speedbar-timer-fn.  Use speedbar-refresh instead of
+	speedbar-timer-fn
+	(gdb-var-update-handler, gdb-var-update-handler-1): Use it.
+	(gdb-speedbar-expand-node): Use speedbar-delete-subblock
+	instead of gdb-speedbar-timer-fn.
+
+2006-02-28  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calccomp.el (math-compose-tex-matrix): Add a latex option.
+	(math-compose-expr): Use latex option when calling
+	`math-compose-tex-matrix' for latex mode.
+
+2006-02-28  Nick Roberts  <nickrob@snap.net.nz>
+
+	* speedbar.el: Re-instate comments about developing for speedbar
+	[this is what info and gdb-ui use even if better methods exist now].
+
+	* t-mouse.el: New file.
+	(t-mouse-tty): Use with-temp-buffer.  Add more terminal types.
+	(t-mouse-lispy-buffer-posn-from-coords): Remove.  Use the C
+	primitive...
+	(t-mouse-make-event-element): ...posn-at-x-y instead.
+	(t-mouse-make-event): Deal with Fedora Core 3.
+	(t-mouse-make-event): Don't sink the `stupid text mode menubar'.
+	(t-mouse-mouse-position-function): New function.  Use it instead
+	of advising mouse-position.
+	(t-mouse-mode): New minor mode.
+	(t-mouse-stop, t-mouse-run): Remove.  Use t-mouse-mode instead.
+
+2006-02-27  Glenn Morris  <rgm@gnu.org>
+
+	* calendar/calendar.el (calendar-holidays): Doc fix.
+
+2006-02-27  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-source-window): New variable.
+	Re-introduce the concept of a source window.
+	(gdb-get-buffer-create): Rename from gdb-get-create-buffer for
+	consistency with get-buffer-create.
+	(def-gdb-auto-update-handler, gdb-info-locals-handler)
+	(gdb-data-list-register-values-handler)
+	(gdb-stack-list-locals-handler): Try to preserve window-start as
+	well as window-point.
+	(gdb-display-source-buffer): New function (old concept).
+	(gdb-goto-breakpoint): Use it.
+
+	* progmodes/gud.el (gud-display-line): Use gdb-display-source-buffer
+	for gdb-ui/gdb-mi (old concept).
+
+2006-02-27  Carsten Dominik  <dominik@science.uva.nl>
+
+	* textmodes/reftex-index.el (reftex-index-map): Add `follow-mouse'
+	binding.
+
+	* textmodes/reftex-toc.el (reftex-toc-map): Add `follow-mouse'
+	binding.
+
+	* textmodes/reftex-sel.el (reftex-select-label-map)
+	(reftex-select-bib-map): Add `follow-mouse' binding.
+
+2006-02-26  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* jka-cmpr-hook.el (jka-compr-compression-info-list)
+	(jka-compr-mode-alist-additions, jka-compr-load-suffixes):
+	Give :set functions to provide automatic updating.
+	Update docstring.  Give compiler defvars early in the file
+	and move the defcustoms to a later spot where all called functions
+	are defined.
+	(jka-compr-file-name-handler-entry): Doc fix.
+	(jka-compr-compression-info-list--internal)
+	(jka-compr-mode-alist-additions--internal)
+	(jka-compr-load-suffixes--internal): New variables.
+	(jka-compr-install): Set the three above variables.
+	Update `load-file-rep-suffixes' instead of `load-suffixes'.
+	(jka-compr-update, jka-compr-set): New functions.
+	(auto-compression-mode): Doc fix.
+
+	* jka-compr.el (jka-compr-uninstall): Replace `mapcar' with `mapc'.
+	Update `load-file-rep-suffixes' instead of `load-suffixes'.
+	Use jka-compr-compression-info-list--internal,
+	jka-compr-mode-alist-additions--internal and
+	jka-compr-load-suffixes--internal.
+
+	* files.el (load-library):
+	* loadhist.el (file-loadhist-lookup):
+	* startup.el (command-line):
+	* subr.el (locate-library):
+	* emacs-lisp/autoload.el (update-directory-autoloads):
+	* emacs-lisp/find-func.el (find-library-suffixes): Use
+	`get-load-suffixes' instead of `load-suffixes'.
+
+	* subr.el (locate-library):
+	* emacs-lisp/find-func.el (find-library-name): Use
+	`load-file-rep-suffixes' instead of '("").
+
 2006-02-26  Kim F. Storm  <storm@cua.dk>
 
 	* ido.el (ido-save-history, ido-load-history): Simplify.  Don't
@@ -20,7 +166,7 @@
 
 2006-02-24  Alan Mackenzie  <bug-cc-mode@gnu.org>
 
-	* progmodes/cc-mode.el (c-postprocess-file-styles): bind
+	* progmodes/cc-mode.el (c-postprocess-file-styles): Bind
 	inhibit-read-only to t, around the call to
 	c-remove-any-local-eval-or-mode-variables, so that it works on a
 	RO file.
@@ -53,8 +199,8 @@
 	* progmodes/cc-mode.el: File Local variables: Solve the problem
 	where both `mode' and c-file-offsets are specified: `mode' will
 	overwrite c-f-o's settings:
-	(c-remove-any-local-eval-or-mode-variables): new function.
-	(c-postprocess-file-styles): call the above new function, within
+	(c-remove-any-local-eval-or-mode-variables): New function.
+	(c-postprocess-file-styles): Call the above new function, within
 	c-tentative-buffer-change, to splat `mode' and `eval' before the
 	second hack-local-variables.
 
@@ -93,15 +239,15 @@
 	Sometimes, c-s-i got separated from the mode name on the mode
 	line.
 
-	* progmodes/cc-cmds.el (c-electric-brace, c-electric-semi&comma,
-	c-electric-colon): Correct doc-strings: "/ln" -> "/la".
+	* progmodes/cc-cmds.el (c-electric-brace, c-electric-semi&comma)
+	(c-electric-colon): Correct doc-strings: "/ln" -> "/la".
 
 2006-02-24  Martin Stjernholm  <bug-cc-mode@gnu.org>
 
-	* progmodes/cc-langs.el (c-make-init-lang-vars-fun): Improved the
+	* progmodes/cc-langs.el (c-make-init-lang-vars-fun): Improve the
 	error message when there's an evaluation error to show whether
 	it's loaded from source or not.
-	(c-filter-ops): Made it available at runtime too to work when
+	(c-filter-ops): Make it available at runtime too to work when
 	`c-make-init-lang-vars-fun' needs to evaluate from source.
 
 2006-02-24  Juanma Barranquero  <lekktu@gmail.com>
@@ -182,6 +328,11 @@
 	* textmodes/reftex.el (reftex-locate-file): Search all extensions
 	if `reftex-try-all-extensions' is set.
 
+	* textmodes/reftex-dcr.el (reftex-view-crossref): New argument to
+	fail silently when there is no valid argument at point.
+	(reftex-view-crossref-when-idle): Call `reftex-view-crossref' with
+	`fail-silently' argument.  From a patch by David Reiter.
+
 	* textmodes/org.el (org-mark-ring-push, org-mark-ring-goto):
 	New commands.
 	(org-mark-ring): New variable.
--- a/lisp/calc/calccomp.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/calc/calccomp.el	Fri Mar 03 07:48:46 2006 +0000
@@ -286,10 +286,10 @@
                                      (> calc-language-option 1)
                                      (< calc-language-option -1)))
                             (append '(vleft 0 "\\begin{pmatrix}")
-                                    (math-compose-tex-matrix (cdr a))
+                                    (math-compose-tex-matrix (cdr a) t)
                                     '("\\end{pmatrix}"))
                           (append '(horiz "\\begin{pmatrix} ")
-                                  (math-compose-tex-matrix (cdr a))
+                                  (math-compose-tex-matrix (cdr a) t)
                                   '(" \\end{pmatrix}")))
                       (if (and (eq calc-language 'eqn)
                                (math-matrixp a))
@@ -1015,10 +1015,11 @@
 		(math-compose-expr (car a) math-comp-vector-prec)
 		(concat " " math-comp-right-bracket)))))
 
-(defun math-compose-tex-matrix (a)
+(defun math-compose-tex-matrix (a &optional ltx)
   (if (cdr a)
-      (cons (append (math-compose-vector (cdr (car a)) " & " 0) '(" \\\\ "))
-            (math-compose-tex-matrix (cdr a)))
+      (cons (append (math-compose-vector (cdr (car a)) " & " 0) 
+                    (if ltx '(" \\\\ ") '(" \\cr ")))
+            (math-compose-tex-matrix (cdr a) ltx))
     (list (math-compose-vector (cdr (car a)) " & " 0))))
 
 (defun math-compose-eqn-matrix (a)
--- a/lisp/calendar/calendar.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/calendar/calendar.el	Fri Mar 03 07:48:46 2006 +0000
@@ -1190,9 +1190,16 @@
 of `general-holidays', `local-holidays' `christian-holidays',
 `hebrew-holidays', `islamic-holidays', `bahai-holidays',
 `oriental-holidays', or `solar-holidays' to nil in your .emacs file,
-you can eliminate unwanted categories of holidays.  The intention is
-that (in the US) `local-holidays' be set in site-init.el and
-`other-holidays' be set by the user.
+you can eliminate unwanted categories of holidays.
+
+Note that these variables are only used to initialize the default
+value of `calendar-holidays'.  In other words, they only have an
+effect on the displayed holidays if set before the calendar is
+loaded.  After the calendar has been loaded, you must customize
+`calendar-holidays' directly.
+
+The intention is that (in the US) `local-holidays' be set in
+site-init.el and `other-holidays' be set by the user.
 
 Entries on the list are expressions that return (possibly empty) lists of
 items of the form ((month day year) string) of a holiday in the in the
--- a/lisp/dframe.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/dframe.el	Fri Mar 03 07:48:46 2006 +0000
@@ -422,7 +422,7 @@
 			    parameters
 			  (append
 			   parameters
-			   (list (cons 'height (+ mh (frame-height)))))))
+			   (list (cons 'height (+ (or mh 0) (frame-height)))))))
 		       (params
 			;; Only add a guessed width if one is not specified
 			;; in the input parameters.
--- a/lisp/emacs-lisp/autoload.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/emacs-lisp/autoload.el	Fri Mar 03 07:48:46 2006 +0000
@@ -512,7 +512,7 @@
 directory or directories specified."
   (interactive "DUpdate autoloads from directory: ")
   (let* ((files-re (let ((tmp nil))
-		     (dolist (suf load-suffixes
+		     (dolist (suf (get-load-suffixes)
 				  (concat "^[^=.].*" (regexp-opt tmp t) "\\'"))
 		       (unless (string-match "\\.elc" suf) (push suf tmp)))))
 	 (files (apply 'nconc
--- a/lisp/emacs-lisp/find-func.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/emacs-lisp/find-func.el	Fri Mar 03 07:48:46 2006 +0000
@@ -142,7 +142,7 @@
 
 (defun find-library-suffixes ()
   (let ((suffixes nil))
-    (dolist (suffix load-suffixes (nreverse suffixes))
+    (dolist (suffix (get-load-suffixes) (nreverse suffixes))
       (unless (string-match "elc" suffix) (push suffix suffixes)))))
 
 (defun find-library-name (library)
@@ -153,7 +153,7 @@
       (setq library (replace-match "" t t library)))
   (or (locate-file library
 		   (or find-function-source-path load-path)
-		   (append (find-library-suffixes) '("")))
+		   (append (find-library-suffixes) load-file-rep-suffixes))
       (error "Can't find library %s" library)))
 
 (defvar find-function-C-source-directory
--- a/lisp/files.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/files.el	Fri Mar 03 07:48:46 2006 +0000
@@ -699,7 +699,7 @@
   (interactive
    (list (completing-read "Load library: "
 			  'locate-file-completion
-			  (cons load-path load-suffixes))))
+			  (cons load-path (get-load-suffixes)))))
   (load library))
 
 (defun file-remote-p (file)
--- a/lisp/gnus/ChangeLog	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/gnus/ChangeLog	Fri Mar 03 07:48:46 2006 +0000
@@ -1,3 +1,66 @@
+2006-03-03  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* mm-decode.el (mm-get-part): Don't use
+	mm-with-unibyte-current-buffer.
+
+	* gnus-sum.el (gnus-summary-set-display-table): Don't nix out
+	characters 160 through 255 in Emacs 23.
+
+2006-03-02  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* mml.el (mml-generate-mime-1): Encode parts other than text/* or
+	message/* containing non-ASCII text properly.
+
+2006-02-28  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* mm-util.el (mm-with-unibyte-current-buffer): Add note.
+
+2006-02-28  Andreas Seltenreich  <uwi7@rz.uni-karlsruhe.de>
+
+	* nnweb.el (nnweb-gmane-create-mapping): Don't choke on ^M.
+
+2006-02-28  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* nnweb.el (nnweb-type-definition, nnweb-gmane-search): Use new
+	nov.php.
+
+2006-02-28  Andreas Seltenreich  <uwi7@stud.uni-karlsruhe.de>
+
+	* nnweb.el (nnweb-type-definition, nnweb-gmane-create-mapping)
+	(nnweb-gmane-wash-article, nnweb-gmane-search): Fix Gmane web
+	groups.  Kudos to Olly Betts <olly@survex.com> for providing NOV
+	output on the server side.
+	(nnweb-google-create-mapping): Update regexps and add some
+	progress indication.
+
+2006-02-28  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* message.el (message-user-fqdn): Remove useless * in doc string.
+
+	* gnus-draft.el (gnus-draft-send): Bind message-signature to avoid
+	unnecessary interaction when sending queued mails.  Reported by
+	TAKAHASHI Yoshio <tkh@jp.fujitsu.com>.
+
+2006-02-28  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* gnus-int.el (gnus-open-server): Respect gnus-batch-mode.
+	Merge of 2006-02-20 change from the trunk.
+
+2006-02-28  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* dns.el (query-dns): Protect more against buggy tcp output.
+	Merge of 2006-02-20 change from the trunk.
+
+2006-02-27  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* gnus-sum.el (gnus-sequence-of-unread-articles): Return nil if
+	first or last are nil.
+
+2006-02-24  Simon Josefsson  <jas@extundo.com>
+
+	* flow-fill.el (fill-flowed): Flow-fill unquoted lines too.
+	Merge of 2005-10-26 change from the trunk.
+
 2006-02-23  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
 	* flow-fill.el (fill-flowed): Bind adaptive-fill-mode to nil.
@@ -863,10 +926,9 @@
 	* pgg-parse.el (top-level): Don't require custom, it is
 	autoloaded.  (To sync with No Gnus.)
 
-2005-05-09  Simon Josefsson  <jas@extundo.com>
-
-	* pgg-gpg.el (pgg-gpg-possibly-cache-passphrase): Fix PIN caching,
-	tiny patch from "Georg C. F. Greve" <greve@gnu.org>.
+2005-05-09  Georg C. F. Greve  <greve@gnu.org>  (tiny change)
+
+	* pgg-gpg.el (pgg-gpg-possibly-cache-passphrase): Fix PIN caching.
 
 2005-10-08  Simon Josefsson  <jas@extundo.com>
 
@@ -2571,11 +2633,13 @@
 
 	* deuglify.el (gnus-outlook-deuglify): Add :version.
 
-	* html2text.el: Beautify code.  Improve doc strings.  Some checkdoc
-	cleanup.
+	* html2text.el: Beautify code.  Improve doc strings.  Some
+	checkdoc cleanup.
 	(html2text-get-attr, html2text-fix-paragraph): Simplify code.
-	(html2text-format-tag-list): Add "strong" and "em".
-	From "Alfred M. Szmidt" <ams@kemisten.nu> (tiny change).
+
+2004-11-01  Alfred M. Szmidt  <ams@kemisten.nu>  (tiny change)
+
+	* html2text.el (html2text-format-tag-list): Add "strong" and "em".
 
 2004-10-29  Katsumi Yamaoka  <yamaoka@jpl.org>
 
@@ -3436,14 +3500,13 @@
 	Check `starttls-use-gnutls' and pass on to corresponding *-gnutls
 	function if it is set.
 
-2004-08-31  Simon Josefsson  <jas@extundo.com>
+2004-08-30  Andreas Schwab  <schwab@suse.de>
 
 	* rfc2231.el (rfc2231-parse-string): Restore whitespace syntax for
-	?* and ?\; (tiny patch).  From Andreas Schwab <schwab@suse.de>.
+	?* and ?\;.
 
 	* ietf-drums.el (ietf-drums-syntax-table): Set syntax of ?* ?\;
-	and ?\' to symbol instead of whitespace (tiny patch).
-	From Andreas Schwab <schwab@suse.de>.
+	and ?\' to symbol instead of whitespace.
 
 2004-08-31  Jesper Harder  <harder@ifa.au.dk>
 
--- a/lisp/gnus/dns.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/gnus/dns.el	Fri Mar 03 07:48:46 2006 +0000
@@ -347,7 +347,7 @@
 		     (>= (buffer-size) 2))
 	    (goto-char (point-min))
 	    (delete-region (point) (+ (point) 2)))
-	  (unless (zerop (buffer-size))
+	  (when (>= (buffer-size) 2)
 	    (let ((result (dns-read (buffer-string))))
 	      (if fullp
 		  result
--- a/lisp/gnus/flow-fill.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/gnus/flow-fill.el	Fri Mar 03 07:48:46 2006 +0000
@@ -121,7 +121,7 @@
     (while (re-search-forward " $" nil t)
       (when (save-excursion
 	      (beginning-of-line)
-	      (looking-at "^\\(>+\\)\\( ?\\)"))
+	      (looking-at "^\\(>*\\)\\( ?\\)"))
 	(let ((quote (match-string 1))
 	      sig)
 	  (if (string= quote "")
--- a/lisp/gnus/gnus-draft.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/gnus/gnus-draft.el	Fri Mar 03 07:48:46 2006 +0000
@@ -146,6 +146,8 @@
                                  message-send-hook))
          (message-setup-hook (and (not is-queue)
                                   message-setup-hook))
+	 (message-signature (and (not is-queue)
+				 message-signature))
          (gnus-agent-queue-mail (and (not is-queue)
                                      gnus-agent-queue-mail))
 	 (rfc2047-encode-encoded-words nil)
--- a/lisp/gnus/gnus-int.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/gnus/gnus-int.el	Fri Mar 03 07:48:46 2006 +0000
@@ -250,10 +250,12 @@
                               ;; recurse to open the agent's backend.
                               (setq open-offline (eq gnus-server-unopen-status 'offline))
                               gnus-server-unopen-status)
-                             ((gnus-y-or-n-p
-                               (format "Unable to open %s:%s, go offline? "
-                                       (car gnus-command-method)
-                                       (cadr gnus-command-method)))
+                             ((and
+			       (not gnus-batch-mode)
+			       (gnus-y-or-n-p
+				(format "Unable to open %s:%s, go offline? "
+					(car gnus-command-method)
+					(cadr gnus-command-method))))
                               (setq open-offline t)
                               'offline)
                              (t
--- a/lisp/gnus/gnus-sum.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/gnus/gnus-sum.el	Fri Mar 03 07:48:46 2006 +0000
@@ -3098,8 +3098,11 @@
     (aset table ?\r nil)
     ;; We keep TAB as well.
     (aset table ?\t nil)
-    ;; We nix out any glyphs over 126 that are not set already.
-    (let ((i 256))
+    ;; We nix out any glyphs 127 through 255, or 127 through 159 in
+    ;; Emacs 23, that are not set already.
+    (let ((i (if (ignore-errors (= (make-char 'latin-iso8859-1 160) 160))
+		 160
+	       256)))
       (while (>= (setq i (1- i)) 127)
 	;; Only modify if the entry is nil.
 	(unless (aref table i)
@@ -6452,10 +6455,12 @@
 	  (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
 	  (setq read (cdr read)))))
     ;; And add the last unread articles.
-    (cond ((< first last)
-           (push (cons first last) unread))
-          ((= first last)
-           (push first unread)))
+    (cond ((not (and first last))
+	   nil)
+	  ((< first last)
+	   (push (cons first last) unread))
+	  ((= first last)
+	   (push first unread)))
     ;; Return the sequence of unread articles.
     (delq 0 (nreverse unread))))
 
--- a/lisp/gnus/mm-decode.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/gnus/mm-decode.el	Fri Mar 03 07:48:46 2006 +0000
@@ -1084,14 +1084,16 @@
 
 (defun mm-get-part (handle)
   "Return the contents of HANDLE as a string."
-  (mm-with-unibyte-buffer
-    (insert (with-current-buffer (mm-handle-buffer handle)
-	      (mm-with-unibyte-current-buffer
-		(buffer-string))))
-    (mm-decode-content-transfer-encoding
-     (mm-handle-encoding handle)
-     (mm-handle-media-type handle))
-    (buffer-string)))
+  (let ((default-enable-multibyte-characters
+	  (with-current-buffer (mm-handle-buffer handle)
+	    (mm-multibyte-p))))
+    (with-temp-buffer
+      (insert-buffer-substring (mm-handle-buffer handle))
+      (mm-disable-multibyte)
+      (mm-decode-content-transfer-encoding
+       (mm-handle-encoding handle)
+       (mm-handle-media-type handle))
+      (buffer-string))))
 
 (defun mm-insert-part (handle)
   "Insert the contents of HANDLE in the current buffer."
--- a/lisp/gnus/mm-util.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/gnus/mm-util.el	Fri Mar 03 07:48:46 2006 +0000
@@ -727,11 +727,17 @@
 (defmacro mm-with-unibyte-current-buffer (&rest forms)
   "Evaluate FORMS with current buffer temporarily made unibyte.
 Also bind `default-enable-multibyte-characters' to nil.
-Equivalent to `progn' in XEmacs"
+Equivalent to `progn' in XEmacs
+
+NOTE: Use this macro with caution in multibyte buffers (it is not
+worth using this macro in unibyte buffers of course).  Use of
+`(set-buffer-multibyte t)', which is run finally, is generally
+harmful since it is likely to modify existing data in the buffer.
+For instance, it converts \"\\300\\255\" into \"\\255\" in Emacs 23."
   (let ((multibyte (make-symbol "multibyte"))
 	(buffer (make-symbol "buffer")))
     `(if mm-emacs-mule
- 	 (let ((,multibyte enable-multibyte-characters)
+	 (let ((,multibyte enable-multibyte-characters)
 	       (,buffer (current-buffer)))
 	   (unwind-protect
 	       (let (default-enable-multibyte-characters)
--- a/lisp/gnus/mml.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/gnus/mml.el	Fri Mar 03 07:48:46 2006 +0000
@@ -506,7 +506,15 @@
 		(let ((coding-system-for-read mm-binary-coding-system))
 		  (mm-insert-file-contents filename nil nil nil nil t)))
 	       (t
-		(insert (cdr (assq 'contents cont)))))
+		(let ((contents (cdr (assq 'contents cont))))
+		  (if (if (featurep 'xemacs)
+			  (string-match "[^\000-\377]" contents)
+			(mm-multibyte-string-p contents))
+		      (progn
+			(mm-enable-multibyte)
+			(insert contents)
+			(setq charset (mm-encode-body)))
+		    (insert contents)))))
 	      (setq encoding (mm-encode-buffer type)
 		    coded (mm-string-as-multibyte (buffer-string))))
 	    (mml-insert-mime-headers cont type charset encoding nil)
--- a/lisp/gnus/nnweb.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/gnus/nnweb.el	Fri Mar 03 07:48:46 2006 +0000
@@ -27,9 +27,6 @@
 
 ;; Note: You need to have `w3' installed for some functions to work.
 
-;; FIXME: Due to changes in the HTML output of Gmane, stuff related to Gmane
-;; web groups (`gnus-group-make-web-group') doesn't work anymore.
-
 ;;; Code:
 
 (eval-when-compile (require 'cl))
@@ -82,7 +79,7 @@
      (reference . identity)
      (map . nnweb-gmane-create-mapping)
      (search . nnweb-gmane-search)
-     (address . "http://gmane.org/")
+     (address . "http://search.gmane.org/nov.php")
      (identifier . nnweb-gmane-identity)))
   "Type-definition alist.")
 
@@ -99,7 +96,7 @@
 
 (defvoo nnweb-articles nil)
 (defvoo nnweb-buffer nil)
-(defvar nnweb-group-alist nil)
+(defvoo nnweb-group-alist nil)
 (defvoo nnweb-group nil)
 (defvoo nnweb-hashtb nil)
 
@@ -309,22 +306,26 @@
 
 (defun nnweb-google-wash-article ()
   ;; We have Google's masked e-mail addresses here.  :-/
-  (let ((case-fold-search t))
+  (let ((case-fold-search t)
+	(start-re "<pre>\n *")
+	(end-re "\n *</pre>"))
     (goto-char (point-min))
     (if (save-excursion
 	  (or (re-search-forward "The requested message.*could not be found."
 				 nil t)
-	      (not (and (re-search-forward "^<pre>" nil t)
-			(re-search-forward "^</pre>" nil t)))))
+	      (not (and (re-search-forward start-re nil t)
+			(re-search-forward end-re nil t)))))
 	;; FIXME: Don't know how to indicate "not found".
 	;; Should this function throw an error?  --rsteib
 	(progn
 	  (gnus-message 3 "Requested article not found")
 	  (erase-buffer))
       (delete-region (point-min)
-		     (1+ (re-search-forward "^<pre>" nil t)))
+		     (re-search-forward start-re))
       (goto-char (point-min))
-      (delete-region (- (re-search-forward "^</pre>" nil t) (length "</pre>"))
+      (delete-region (progn
+		       (re-search-forward end-re)
+		       (match-beginning 0))
 		     (point-max))
       (mm-url-decode-entities))))
 
@@ -403,6 +404,7 @@
   (save-excursion
     (set-buffer nnweb-buffer)
     (erase-buffer)
+    (nnheader-message 7 "Searching google...")
     (when (funcall (nnweb-definition 'search) nnweb-search)
 	(let ((more t)
 	      (i 0))
@@ -413,15 +415,18 @@
 	    (goto-char (point-min))
 	    (incf i 100)
 	    (if (or (not (re-search-forward
-			  "<td><a href=\"\n\\([^>\"]+\\)\"><img src=\"/img/nav_next" nil t))
+			  "<a href=\"\n\\([^>\"]+\\)\"><img src=\"[^\"]+next"
+			  nil t))
 		    (>= i nnweb-max-hits))
 		(setq more nil)
 	      ;; Yup, there are more articles
 	      (setq more (concat (nnweb-definition 'base) (match-string 1)))
 	    (when more
 	      (erase-buffer)
+	      (nnheader-message 7 "Searching google...(%d)" i)
 	      (mm-url-insert more))))
 	  ;; Return the articles in the right order.
+	  (nnheader-message 7 "Searching google...done")
 	  (setq nnweb-articles
 		(sort nnweb-articles 'car-less-than-car))))))
 
@@ -454,46 +459,61 @@
   "Perform the search and create a number-to-url alist."
   (save-excursion
     (set-buffer nnweb-buffer)
-    (erase-buffer)
-    (when (funcall (nnweb-definition 'search) nnweb-search)
-      (let ((more t)
-	    (case-fold-search t)
-	    (active (or (cadr (assoc nnweb-group nnweb-group-alist))
-			(cons 1 0)))
-	    subject group url
-	    map)
-	  ;; Remove stuff from the beginning of results
-	(goto-char (point-min))
-	(search-forward "Search Results</h1><ul>" nil t)
-	(delete-region (point-min) (point))
+    (let ((case-fold-search t)
+	  (active (or (cadr (assoc nnweb-group nnweb-group-alist))
+		      (cons 1 0)))
+	  map)
+      (erase-buffer)
+      (nnheader-message 7 "Searching Gmane..." )
+      (when (funcall (nnweb-definition 'search) nnweb-search)
 	(goto-char (point-min))
-	;; Iterate over the actual hits
-	(while (re-search-forward ".*href=\"\\([^\"]+\\)\">\\(.*\\)" nil t)
-	    (setq url (concat "http://gmane.org/" (match-string 1)))
-	    (setq subject (match-string 2))
-	  (unless (nnweb-get-hashtb url)
-	    (push
-	     (list
-	      (incf (cdr active))
-	      (make-full-mail-header
-	       (cdr active) (concat  "(" group ") " subject) nil nil
-	       nil nil 0 0 url))
-	     map)
-	    (nnweb-set-hashtb (cadar map) (car map))))
-	;; Return the articles in the right order.
-	(setq nnweb-articles
-	      (sort (nconc nnweb-articles map) 'car-less-than-car))))))
+	;; Skip the status line
+	(forward-line 1)
+	;; Thanks to Olly Betts we now have NOV lines in our buffer!
+	(while (not (eobp))
+	  (unless (or (eolp) (looking-at "\x0d"))
+	    (let ((header (nnheader-parse-nov)))
+	      (let ((xref (mail-header-xref header))
+		    (from (mail-header-from header))
+		    (subject (mail-header-subject header))
+		    (rfc2047-encoding-type 'mime))
+		(when (string-match " \\([^:]+\\):\\([0-9]+\\)" xref)
+		  (mail-header-set-xref
+		   header
+		   (format "http://article.gmane.org/%s/%s/raw"
+			   (match-string 1 xref)
+			   (match-string 2 xref))))
+
+		;; Add host part to gmane-encrypted addresses
+		(when (string-match "@$" from)
+		  (mail-header-set-from header
+					(concat from "public.gmane.org")))
+
+		(mail-header-set-subject header
+					 (rfc2047-encode-string subject))
+
+		(unless (nnweb-get-hashtb (mail-header-xref header))
+		  (push
+		   (list
+		    (incf (cdr active))
+		    header)
+		   map)
+		  (nnweb-set-hashtb (cadar map) (car map))))))
+	  (forward-line 1)))
+      (nnheader-message 7 "Searching Gmane...done")
+      (setq nnweb-articles
+	    (sort (nconc nnweb-articles map) 'car-less-than-car)))))
 
 (defun nnweb-gmane-wash-article ()
   (let ((case-fold-search t))
     (goto-char (point-min))
-    (re-search-forward "<!--X-Head-of-Message-->" nil t)
-    (delete-region (point-min) (point))
-    (goto-char (point-min))
-    (while (looking-at "^<li><em>\\([^ ]+\\)</em>.*</li>")
-      (replace-match "\\1\\2" t)
-      (forward-line 1))
-    (mm-url-remove-markup)))
+    (when (search-forward "<!--X-Head-of-Message-->" nil t)
+      (delete-region (point-min) (point))
+      (goto-char (point-min))
+      (while (looking-at "^<li><em>\\([^ ]+\\)</em>.*</li>")
+	(replace-match "\\1\\2" t)
+	(forward-line 1))
+      (mm-url-remove-markup))))
 
 (defun nnweb-gmane-search (search)
   (mm-url-insert
@@ -501,11 +521,13 @@
     (nnweb-definition 'address)
     "?"
     (mm-url-encode-www-form-urlencoded
-     `(("query" . ,search)))))
+     `(("query" . ,search)
+       ("HITSPERPAGE" . ,(number-to-string nnweb-max-hits))))))
   (setq buffer-file-name nil)
+  (set-buffer-multibyte t)
+  (mm-decode-coding-region (point-min) (point-max) 'utf-8)
   t)
 
-
 (defun nnweb-gmane-identity (url)
   "Return a unique identifier based on URL."
   (if (string-match "group=\\(.+\\)" url)
--- a/lisp/jka-cmpr-hook.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/jka-cmpr-hook.el	Fri Mar 03 07:48:46 2006 +0000
@@ -26,7 +26,7 @@
 
 ;;; Commentary:
 
-;; This file contains the  code to enable and disable Auto-Compression mode.
+;; This file contains the code to enable and disable Auto-Compression mode.
 ;; It is preloaded.  The guts of this mode are in jka-compr.el, which
 ;; is loaded only when you really try to uncompress something.
 
@@ -40,6 +40,143 @@
   "jka-compr customization."
   :group 'compression)
 
+;; List of all the elements we actually added to file-coding-system-alist.
+(defvar jka-compr-added-to-file-coding-system-alist nil)
+
+(defvar jka-compr-file-name-handler-entry
+  nil
+  "`file-name-handler-alist' entry used by jka-compr I/O functions.")
+
+;; Compiler defvars.  These three variables will be defined later with
+;; `defcustom' when everything used in the :set functions is defined.
+(defvar jka-compr-compression-info-list)
+(defvar jka-compr-mode-alist-additions)
+(defvar jka-compr-load-suffixes)
+
+(defvar jka-compr-compression-info-list--internal nil
+  "Stored value of `jka-compr-compression-info-list'.
+If Auto Compression mode is enabled, this is the value of
+`jka-compr-compression-info-list' when `jka-compr-install' was last called.
+Otherwise, it is nil.")
+
+(defvar jka-compr-mode-alist-additions--internal nil
+  "Stored value of `jka-compr-mode-alist-additions'.
+If Auto Compression mode is enabled, this is the value of
+`jka-compr-mode-alist-additions' when `jka-compr-install' was last called.
+Otherwise, it is nil.")
+
+(defvar jka-compr-load-suffixes--internal nil
+  "Stored value of `jka-compr-load-suffixes'.
+If Auto Compression mode is enabled, this is the value of
+`jka-compr-load-suffixes' when `jka-compr-install' was last called.
+Otherwise, it is nil.")
+
+
+(defun jka-compr-build-file-regexp ()
+  (mapconcat
+   'jka-compr-info-regexp
+   jka-compr-compression-info-list
+   "\\|"))
+
+;; Functions for accessing the return value of jka-compr-get-compression-info
+(defun jka-compr-info-regexp               (info)  (aref info 0))
+(defun jka-compr-info-compress-message     (info)  (aref info 1))
+(defun jka-compr-info-compress-program     (info)  (aref info 2))
+(defun jka-compr-info-compress-args        (info)  (aref info 3))
+(defun jka-compr-info-uncompress-message   (info)  (aref info 4))
+(defun jka-compr-info-uncompress-program   (info)  (aref info 5))
+(defun jka-compr-info-uncompress-args      (info)  (aref info 6))
+(defun jka-compr-info-can-append           (info)  (aref info 7))
+(defun jka-compr-info-strip-extension      (info)  (aref info 8))
+(defun jka-compr-info-file-magic-bytes     (info)  (aref info 9))
+
+
+(defun jka-compr-get-compression-info (filename)
+  "Return information about the compression scheme of FILENAME.
+The determination as to which compression scheme, if any, to use is
+based on the filename itself and `jka-compr-compression-info-list'."
+  (catch 'compression-info
+    (let ((case-fold-search nil))
+      (mapcar
+       (function (lambda (x)
+		   (and (string-match (jka-compr-info-regexp x) filename)
+			(throw 'compression-info x))))
+       jka-compr-compression-info-list)
+      nil)))
+
+(defun jka-compr-install ()
+  "Install jka-compr.
+This adds entries to `file-name-handler-alist' and `auto-mode-alist'
+and `inhibit-first-line-modes-suffixes'."
+
+  (setq jka-compr-file-name-handler-entry
+	(cons (jka-compr-build-file-regexp) 'jka-compr-handler))
+
+  (push jka-compr-file-name-handler-entry file-name-handler-alist)
+
+  (setq jka-compr-compression-info-list--internal
+	jka-compr-compression-info-list
+	jka-compr-mode-alist-additions--internal
+	jka-compr-mode-alist-additions
+	jka-compr-load-suffixes--internal
+	jka-compr-load-suffixes)
+
+  (dolist (x jka-compr-compression-info-list)
+    ;; Don't do multibyte encoding on the compressed files.
+    (let ((elt (cons (jka-compr-info-regexp x)
+                     '(no-conversion . no-conversion))))
+      (push elt file-coding-system-alist)
+      (push elt jka-compr-added-to-file-coding-system-alist))
+
+    (and (jka-compr-info-strip-extension x)
+         ;; Make entries in auto-mode-alist so that modes
+         ;; are chosen right according to the file names
+         ;; sans `.gz'.
+         (push (list (jka-compr-info-regexp x) nil 'jka-compr) auto-mode-alist)
+         ;; Also add these regexps to
+         ;; inhibit-first-line-modes-suffixes, so that a
+         ;; -*- line in the first file of a compressed tar
+         ;; file doesn't override tar-mode.
+         (push (jka-compr-info-regexp x)
+               inhibit-first-line-modes-suffixes)))
+  (setq auto-mode-alist
+	(append auto-mode-alist jka-compr-mode-alist-additions))
+
+  ;; Make sure that (load "foo") will find /bla/foo.el.gz.
+  (setq load-file-rep-suffixes
+	(append load-file-rep-suffixes jka-compr-load-suffixes nil)))
+
+(defun jka-compr-installed-p ()
+  "Return non-nil if jka-compr is installed.
+The return value is the entry in `file-name-handler-alist' for jka-compr."
+
+  (let ((fnha file-name-handler-alist)
+	(installed nil))
+
+    (while (and fnha (not installed))
+     (and (eq (cdr (car fnha)) 'jka-compr-handler)
+	   (setq installed (car fnha)))
+      (setq fnha (cdr fnha)))
+
+    installed))
+
+(defun jka-compr-update ()
+  "Update Auto Compression mode for changes in option values.
+If you change the options `jka-compr-compression-info-list',
+`jka-compr-mode-alist-additions' or `jka-compr-load-suffixes'
+outside Custom, while Auto Compression mode is already enabled
+\(as it is by default), then you have to call this function
+afterward to properly update other variables.  Setting these
+options through Custom does this automatically."
+  (when (jka-compr-installed-p)
+    (jka-compr-uninstall)
+    (jka-compr-install)))
+
+(defun jka-compr-set (variable value)
+  "Internal Custom :set function."
+  (set-default variable value)
+  (jka-compr-update))
+
 ;; I have this defined so that .Z files are assumed to be in unix
 ;; compress format; and .gz files, in gzip format, and .bz2 files in bzip fmt.
 (defcustom jka-compr-compression-info-list
@@ -113,7 +250,12 @@
 
 Because of the way `call-process' is defined, discarding the stderr output of
 a program adds the overhead of starting a shell each time the program is
-invoked."
+invoked.
+
+If you set this outside Custom while Auto Compression mode is
+already enabled \(as it is by default), you have to call
+`jka-compr-update' after setting it to properly update other
+variables.  Setting this through Custom does that automatically."
   :type '(repeat (vector regexp
 			 (choice :tag "Compress Message"
 				 (string :format "%v")
@@ -132,118 +274,41 @@
 			 (boolean :tag "Append")
 			 (boolean :tag "Strip Extension")
 			 (string :tag "Magic Bytes")))
+  :set 'jka-compr-set
   :group 'jka-compr)
 
 (defcustom jka-compr-mode-alist-additions
   (list (cons "\\.tgz\\'" 'tar-mode) (cons "\\.tbz\\'" 'tar-mode))
-  "A list of pairs to add to `auto-mode-alist' when jka-compr is installed."
+  "List of pairs added to `auto-mode-alist' when installing jka-compr.
+Uninstalling jka-compr removes all pairs from `auto-mode-alist' that
+installing added.
+
+If you set this outside Custom while Auto Compression mode is
+already enabled \(as it is by default), you have to call
+`jka-compr-update' after setting it to properly update other
+variables.  Setting this through Custom does that automatically."
   :type '(repeat (cons string symbol))
+  :set 'jka-compr-set
   :group 'jka-compr)
 
 (defcustom jka-compr-load-suffixes '(".gz")
-  "List of suffixes to try when loading files."
-  :type '(repeat string)
-  :group 'jka-compr)
-
-;; List of all the elements we actually added to file-coding-system-alist.
-(defvar jka-compr-added-to-file-coding-system-alist nil)
-
-(defvar jka-compr-file-name-handler-entry
-  nil
-  "The entry in `file-name-handler-alist' used by the jka-compr I/O functions.")
-
-(defun jka-compr-build-file-regexp ()
-  (mapconcat
-   'jka-compr-info-regexp
-   jka-compr-compression-info-list
-   "\\|"))
-
-;; Functions for accessing the return value of jka-compr-get-compression-info
-(defun jka-compr-info-regexp               (info)  (aref info 0))
-(defun jka-compr-info-compress-message     (info)  (aref info 1))
-(defun jka-compr-info-compress-program     (info)  (aref info 2))
-(defun jka-compr-info-compress-args        (info)  (aref info 3))
-(defun jka-compr-info-uncompress-message   (info)  (aref info 4))
-(defun jka-compr-info-uncompress-program   (info)  (aref info 5))
-(defun jka-compr-info-uncompress-args      (info)  (aref info 6))
-(defun jka-compr-info-can-append           (info)  (aref info 7))
-(defun jka-compr-info-strip-extension      (info)  (aref info 8))
-(defun jka-compr-info-file-magic-bytes     (info)  (aref info 9))
-
-
-(defun jka-compr-get-compression-info (filename)
-  "Return information about the compression scheme of FILENAME.
-The determination as to which compression scheme, if any, to use is
-based on the filename itself and `jka-compr-compression-info-list'."
-  (catch 'compression-info
-    (let ((case-fold-search nil))
-      (mapcar
-       (function (lambda (x)
-		   (and (string-match (jka-compr-info-regexp x) filename)
-			(throw 'compression-info x))))
-       jka-compr-compression-info-list)
-      nil)))
-
-(defun jka-compr-install ()
-  "Install jka-compr.
-This adds entries to `file-name-handler-alist' and `auto-mode-alist'
-and `inhibit-first-line-modes-suffixes'."
+  "List of compression related suffixes to try when loading files.
+Enabling Auto Compression mode appends this list to `load-file-rep-suffixes',
+which see.  Disabling Auto Compression mode removes all suffixes
+from `load-file-rep-suffixes' that enabling added.
 
-  (setq jka-compr-file-name-handler-entry
-	(cons (jka-compr-build-file-regexp) 'jka-compr-handler))
-
-  (push jka-compr-file-name-handler-entry file-name-handler-alist)
-
-  (dolist (x jka-compr-compression-info-list)
-    ;; Don't do multibyte encoding on the compressed files.
-    (let ((elt (cons (jka-compr-info-regexp x)
-                     '(no-conversion . no-conversion))))
-      (push elt file-coding-system-alist)
-      (push elt jka-compr-added-to-file-coding-system-alist))
-
-    (and (jka-compr-info-strip-extension x)
-         ;; Make entries in auto-mode-alist so that modes
-         ;; are chosen right according to the file names
-         ;; sans `.gz'.
-         (push (list (jka-compr-info-regexp x) nil 'jka-compr) auto-mode-alist)
-         ;; Also add these regexps to
-         ;; inhibit-first-line-modes-suffixes, so that a
-         ;; -*- line in the first file of a compressed tar
-         ;; file doesn't override tar-mode.
-         (push (jka-compr-info-regexp x)
-               inhibit-first-line-modes-suffixes)))
-  (setq auto-mode-alist
-	(append auto-mode-alist jka-compr-mode-alist-additions))
-
-  ;; Make sure that (load "foo") will find /bla/foo.el.gz.
-  (setq load-suffixes
-	(apply 'append
-	       (append (mapcar (lambda (suffix)
-                               (cons suffix
-                                     (mapcar (lambda (ext) (concat suffix ext))
-                                             jka-compr-load-suffixes)))
-                             load-suffixes)
-                       (list jka-compr-load-suffixes)))))
-
-
-(defun jka-compr-installed-p ()
-  "Return non-nil if jka-compr is installed.
-The return value is the entry in `file-name-handler-alist' for jka-compr."
-
-  (let ((fnha file-name-handler-alist)
-	(installed nil))
-
-    (while (and fnha (not installed))
-     (and (eq (cdr (car fnha)) 'jka-compr-handler)
-	   (setq installed (car fnha)))
-      (setq fnha (cdr fnha)))
-
-    installed))
+If you set this outside Custom while Auto Compression mode is
+already enabled \(as it is by default), you have to call
+`jka-compr-update' after setting it to properly update other
+variables.  Setting this through Custom does that automatically."
+  :type '(repeat string)
+  :set 'jka-compr-set
+  :group 'jka-compr)
 
 (define-minor-mode auto-compression-mode
   "Toggle automatic file compression and uncompression.
 With prefix argument ARG, turn auto compression on if positive, else off.
-Returns the new status of auto compression (non-nil means on)."
+Return the new status of auto compression (non-nil means on)."
   :global t :init-value t :group 'jka-compr :version "22.1"
   (let* ((installed (jka-compr-installed-p))
 	 (flag auto-compression-mode))
--- a/lisp/jka-compr.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/jka-compr.el	Fri Mar 03 07:48:46 2006 +0000
@@ -662,13 +662,13 @@
 by `jka-compr-installed'."
   ;; Delete from inhibit-first-line-modes-suffixes
   ;; what jka-compr-install added.
-  (mapcar
+  (mapc
      (function (lambda (x)
 		 (and (jka-compr-info-strip-extension x)
 		      (setq inhibit-first-line-modes-suffixes
 			    (delete (jka-compr-info-regexp x)
 				    inhibit-first-line-modes-suffixes)))))
-     jka-compr-compression-info-list)
+     jka-compr-compression-info-list--internal)
 
   (let* ((fnha (cons nil file-name-handler-alist))
 	 (last fnha))
@@ -686,7 +686,7 @@
 
     (while (cdr last)
       (setq entry (car (cdr last)))
-      (if (or (member entry jka-compr-mode-alist-additions)
+      (if (or (member entry jka-compr-mode-alist-additions--internal)
 	      (and (consp (cdr entry))
 		   (eq (nth 2 entry) 'jka-compr)))
 	  (setcdr last (cdr (cdr last)))
@@ -701,12 +701,12 @@
                 file-coding-system-alist)))
 
   ;; Remove the suffixes that were added by jka-compr.
-  (let ((suffixes nil)
-	(re (jka-compr-build-file-regexp)))
-    (dolist (suffix load-suffixes)
-      (unless (string-match re suffix)
-	(push suffix suffixes)))
-    (setq load-suffixes (nreverse suffixes))))
+  (dolist (suff jka-compr-load-suffixes--internal)
+    (setq load-file-rep-suffixes (delete suff load-file-rep-suffixes)))
+
+  (setq jka-compr-compression-info-list--internal nil
+	jka-compr-mode-alist-additions--internal nil
+	jka-compr-load-suffixes--internal nil))
 
 (provide 'jka-compr)
 
--- a/lisp/loadhist.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/loadhist.el	Fri Mar 03 07:48:46 2006 +0000
@@ -60,8 +60,8 @@
   (let ((symbols (assoc file load-history)))
     ;; Try converting a library name to an absolute file name.
     (and (null symbols)
-	 (let ((absname 
-		(locate-file file load-path load-suffixes)))
+	 (let ((absname
+		(locate-file file load-path (get-load-suffixes))))
 	   (and absname (not (equal absname file))
 		(setq symbols (cdr (assoc absname load-history))))))
     symbols))
--- a/lisp/mh-e/ChangeLog	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/mh-e/ChangeLog	Fri Mar 03 07:48:46 2006 +0000
@@ -1,11 +1,81 @@
+2006-03-02  Bill Wohler  <wohler@newt.com>
+
+	* mh-folder.el (mh-tool-bar-init): Autoload.
+	(mh-folder-mode): Call mh-tool-bar-init conditionally in XEmacs.
+	Set scoped variables image-load-path and load-path with updated
+	mh-image-load-path before calling mh-tool-bar-folder-buttons-init.
+
+	* mh-letter.el (mh-tool-bar-init): Autoload.
+	(mh-letter-mode): Call mh-tool-bar-init conditionally in XEmacs.
+	Set scoped variables image-load-path and load-path with updated
+	mh-image-load-path before calling mh-tool-bar-letter-buttons-init.
+
+	* mh-show.el (mh-tool-bar-init): Autoload.
+	(mh-show-mode): Perform tool bar stuff conditionally in XEmacs and
+	GNU Emacs.
+
+	* mh-tool-bar.el (mh-tool-bar-define): Don't quote stuff in error
+	messages per conventions.
+	(mh-tool-bar-folder-buttons-init)
+	(mh-tool-bar-letter-buttons-init): Don't call mh-image-load-path.
+	(mh-tool-bar-define call): Format.
+
+	* mh-utils.el (mh-image-directory,
+	mh-image-load-path-called-flag): Delete.
+	(mh-image-load-path): Incorporate changes from Gnus team. Biggest
+	changes are that it no longer uses/sets mh-image-directory or
+	mh-image-load-path-called-flag, and returns the updated path
+	rather than change it.
+	(mh-logo-display): Change usage of mh-image-load-path.
+
+2006-02-28  Bill Wohler  <wohler@newt.com>
+
+	* mh-limit.el (mh-narrow-to-cc, mh-narrow-to-from)
+	(mh-narrow-to-subject, mh-narrow-to-to): Fix inability to narrow
+	to subjects with special characters by quoting regular expression
+	characters in pick expression derived from existing subjects and
+	other fields (closes SF #1432548).
+	(mh-narrow-to-subject): Remove Re: string from subject so that
+	pick can find originating message (closes SF #1438369).
+
+	* mh-utils.el (mh-image-load-path): Rename variable to
+	mh-image-directory.
+	(mh-image-load-path): Access mh-image-directory instead of
+	mh-image-load-path.
+	(mh-folder-list): Fix problem with passing in a folder and getting
+	nothing back. Fix problem with passing in empty string and getting
+	the entire filesystem (or infinite loop). Don't append slash to
+	folder. These fixes fix problems observed with the pick search.
+	Thanks to Thomas Baumann for the help (closes SF #1435381).
+	(mh-pick-regexp-chars, mh-quote-pick-expr): New variable and
+	function for quoting pick regular expression characters (closes SF
+	#1432548).
+
+2006-02-27  Bill Wohler  <wohler@newt.com>
+
+	* mh-e.el (mh-default-folder-for-message-function): Sync docstring
+	with manual.
+
+	* mh-mime.el (mh-minibuffer-read-type): Delete comment in
+	docstring about obsolete variable mh-mime-content-types.
+
+	* mh-e.el (mh-variant): Sync docstring with manual.
+	(cus-face): Require as it is needed by mh-inherit-face-flag.
+
+	* mh-compat.el (mh-display-color-cells): Return 2 if
+	device-color-cells returns nil (closes SF #1436924).
+
+	* mh-e.el (mh-compiling-flag): Delete. No longer needed by
+	mh-display-color-cells.
+
 2006-02-21  Eric Ding  <ericding@alum.mit.edu>
 
-	* mh-e.el (mh-invisible-header-fields-internal): Added entry
+	* mh-e.el (mh-invisible-header-fields-internal): Add entry
 	"X-Sasl-enc:"
 
 2006-02-20  Eric Ding  <ericding@alum.mit.edu>
 
-	* mh-e.el (mh-invisible-header-fields-internal): Added entries
+	* mh-e.el (mh-invisible-header-fields-internal): Add entries
 	"X-Authenticated-Sender:", "X-Barracuda-", "X-EFL-Spamscore",
 	"X-IronPort-AV:", "X-Mail-from:", "X-Mailman-Approved-At:",
 	"X-Resolved-to:", and "X-SA-Exim".  Fixed "X-Bugzilla-" and
@@ -111,7 +181,7 @@
 
 2006-02-04  Eric Ding  <ericding@alum.mit.edu>
 
-	* mh-mime.el (mh-file-mime-type-substitutions): Added entries to
+	* mh-mime.el (mh-file-mime-type-substitutions): Add entries to
 	handle OpenOffice documents.
 
 2006-02-03  Bill Wohler  <wohler@newt.com>
--- a/lisp/mh-e/mh-compat.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/mh-e/mh-compat.el	Fri Mar 03 07:48:46 2006 +0000
@@ -79,11 +79,11 @@
 
 (mh-defun-compat mh-display-color-cells display-color-cells (&optional display)
   "Return the number of color cells supported by DISPLAY.
-This function is used by XEmacs to always return 0 when compiling
-to avoid compiling errors. Otherwise uses `device-color-cells'."
-  (if mh-compiling-flag
-      0
-    (device-color-cells display)))
+This function is used by XEmacs to return 2 when
+`device-color-cells' returns nil. This happens when compiling or
+running on a tty and causes errors since `display-color-cells' is
+expected to return an integer."
+  (or (device-color-cells display) 2))
 
 (defmacro mh-display-completion-list (completions &optional common-substring)
   "Display the list of COMPLETIONS.
--- a/lisp/mh-e/mh-e.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/mh-e/mh-e.el	Fri Mar 03 07:48:46 2006 +0000
@@ -101,12 +101,7 @@
 
 (eval-and-compile
   (defvar mh-xemacs-flag (featurep 'xemacs)
-    "Non-nil means the current Emacs is XEmacs.")
-  (defvar mh-compiling-flag nil
-    "Non-nil means we're compiling."))
-
-(eval-when (compile)
-  (setq mh-compiling-flag t))
+    "Non-nil means the current Emacs is XEmacs."))
 
 (mh-do-in-xemacs
   (require 'mh-xemacs))
@@ -869,14 +864,18 @@
 that MH-E will automatically choose the first of nmh, MH, or GNU
 mailutils that it finds in the directories listed in
 `mh-path' (which you can customize), `mh-sys-path', and
-`exec-path'. If, for example, you have both nmh and mailutils
-installed and `mh-variant-in-use' was initialized to nmh but you
-want to use mailutils, then you can set this option to
-\"mailutils\".
+`exec-path'. If MH-E can't find MH at all, you may have to
+customize `mh-path' and add the directory in which the command
+\"mhparam\" is located. If, on the other hand, you have both nmh
+and mailutils installed (for example) 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'
-accordingly."
+accordingly. Prior to version 8, it was often necessary to set
+some of these variables in \"~/.emacs\"; now it is no longer
+necessary and can actually cause problems."
   :type `(radio
           (const :tag "Auto-detect" autodetect)
           ,@(mapcar (lambda (x) `(const ,(car x))) (mh-variants)))
@@ -1241,11 +1240,11 @@
 (defcustom mh-default-folder-for-message-function nil
   "Function to select a default folder for refiling or \"Fcc:\".
 
-The current buffer is set to the message being refiled with point
-at the start of the message. This function should return the
-default folder as a string with a leading \"+\" sign. It can also
-return nil so that the last folder name is used as the default,
-or an empty string to suppress the default entirely."
+When this function is called, the current buffer contains the message
+being refiled and point is at the start of the message. This function
+should return the default folder as a string with a leading \"+\"
+sign. It can also return nil so that the last folder name is used as
+the default, or an empty string to suppress the default entirely."
   :type 'function
   :group 'mh-folder-selection)
 
@@ -2994,6 +2993,8 @@
                 (setq new-spec (cons entry new-spec)))))
       new-spec)))
 
+(require 'cus-face)
+
 (defvar mh-inherit-face-flag (assq :inherit custom-face-attributes)
   "Non-nil means that the `defface' :inherit keyword is available.
 The :inherit keyword is available on all supported versions of
--- a/lisp/mh-e/mh-folder.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/mh-e/mh-folder.el	Fri Mar 03 07:48:46 2006 +0000
@@ -36,8 +36,9 @@
 (require 'mh-scan)
 (mh-require-cl)
 
-;; Dynamically-created function not found in mh-loaddefs.el.
+;; Dynamically-created functions not found in mh-loaddefs.el.
 (autoload 'mh-tool-bar-folder-buttons-init "mh-tool-bar")
+(autoload 'mh-tool-bar-init "mh-tool-bar")
 
 (require 'gnus-util)
 (autoload 'message-fetch-field "message")
@@ -589,9 +590,16 @@
 
 \\{mh-folder-mode-map}"
   (mh-do-in-gnu-emacs
-   (unless mh-folder-buttons-init-flag
-     (mh-tool-bar-folder-buttons-init)
-     (setq mh-folder-buttons-init-flag t)))
+    (unless mh-folder-buttons-init-flag
+      (let ((load-path
+             (mh-image-load-path "mh-e" "mh-logo.xpm" 'load-path))
+            (image-load-path
+             (mh-image-load-path "mh-e" "mh-logo.xpm" 'image-load-path)))
+        (mh-tool-bar-folder-buttons-init)
+        (setq mh-folder-buttons-init-flag t)))
+    (set (make-local-variable 'tool-bar-map) mh-folder-tool-bar-map))
+  (mh-do-in-xemacs
+    (mh-tool-bar-init :folder))
   (make-local-variable 'font-lock-defaults)
   (setq font-lock-defaults '(mh-folder-font-lock-keywords t))
   (make-local-variable 'desktop-save-buffer)
@@ -652,8 +660,6 @@
   (easy-menu-add mh-folder-message-menu)
   (easy-menu-add mh-folder-folder-menu)
   (mh-inc-spool-make)
-  (set (make-local-variable 'tool-bar-map) mh-folder-tool-bar-map)
-  (mh-funcall-if-exists mh-tool-bar-init :folder)
   (mh-set-help mh-folder-mode-help-messages)
   (if (and mh-xemacs-flag
            font-lock-auto-fontify)
--- a/lisp/mh-e/mh-letter.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/mh-e/mh-letter.el	Fri Mar 03 07:48:46 2006 +0000
@@ -42,8 +42,9 @@
 
 (require 'gnus-util)
 
-;; Dynamically-created function not found in mh-loaddefs.el.
+;; Dynamically-created functions not found in mh-loaddefs.el.
 (autoload 'mh-tool-bar-letter-buttons-init "mh-tool-bar")
+(autoload 'mh-tool-bar-init "mh-tool-bar")
 
 (autoload 'mml-insert-tag "mml")
 
@@ -311,9 +312,16 @@
   (make-local-variable 'mh-sent-from-folder)
   (make-local-variable 'mh-sent-from-msg)
   (mh-do-in-gnu-emacs
-   (unless mh-letter-buttons-init-flag
-     (mh-tool-bar-letter-buttons-init)
-     (setq mh-letter-buttons-init-flag t)))
+    (unless mh-letter-buttons-init-flag
+      (let ((load-path
+             (mh-image-load-path "mh-e" "mh-logo.xpm" 'load-path))
+            (image-load-path
+             (mh-image-load-path "mh-e" "mh-logo.xpm" 'image-load-path)))
+        (mh-tool-bar-letter-buttons-init)
+        (setq mh-letter-buttons-init-flag t)))
+    (set (make-local-variable 'tool-bar-map) mh-letter-tool-bar-map))
+  (mh-do-in-xemacs
+    (mh-tool-bar-init :letter))
   ;; Set the local value of mh-mail-header-separator according to what is
   ;; present in the buffer...
   (set (make-local-variable 'mh-mail-header-separator)
@@ -328,8 +336,6 @@
 
   ;; Enable undo since a show-mode buffer might have been reused.
   (buffer-enable-undo)
-  (set (make-local-variable 'tool-bar-map) mh-letter-tool-bar-map)
-  (mh-funcall-if-exists mh-tool-bar-init :letter)
   (make-local-variable 'font-lock-defaults)
   (cond
    ((or (equal mh-highlight-citation-style 'font-lock)
--- a/lisp/mh-e/mh-limit.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/mh-e/mh-limit.el	Fri Mar 03 07:48:46 2006 +0000
@@ -89,7 +89,8 @@
 
 Use \\<mh-folder-mode-map>\\[mh-widen] to undo this command."
   (interactive
-   (list (mh-edit-pick-expr (mh-current-message-header-field 'cc))))
+   (list (mh-edit-pick-expr
+          (mh-quote-pick-expr (mh-current-message-header-field 'cc)))))
   (mh-narrow-to-header-field 'cc pick-expr))
 
 ;;;###mh-autoload
@@ -99,7 +100,8 @@
 
 Use \\<mh-folder-mode-map>\\[mh-widen] to undo this command."
   (interactive
-   (list (mh-edit-pick-expr (mh-current-message-header-field 'from))))
+   (list (mh-edit-pick-expr
+          (mh-quote-pick-expr (mh-current-message-header-field 'from)))))
   (mh-narrow-to-header-field 'from pick-expr))
 
 ;;;###mh-autoload
@@ -119,10 +121,16 @@
 (defun mh-narrow-to-subject (&optional pick-expr)
   "Limit to messages with same subject.
 With a prefix argument, edit PICK-EXPR.
+The string Re: is removed from the search.
 
 Use \\<mh-folder-mode-map>\\[mh-widen] to undo this command."
   (interactive
-   (list (mh-edit-pick-expr (mh-current-message-header-field 'subject))))
+   (list (mh-edit-pick-expr
+          (mh-quote-pick-expr (mh-current-message-header-field 'subject)))))
+  (setq pick-expr
+        (let ((case-fold-search t))
+          (loop for s in pick-expr
+                collect (mh-replace-regexp-in-string "re: *" "" s))))
   (mh-narrow-to-header-field 'subject pick-expr))
 
 ;;;###mh-autoload
@@ -132,7 +140,8 @@
 
 Use \\<mh-folder-mode-map>\\[mh-widen] to undo this command."
   (interactive
-   (list (mh-edit-pick-expr (mh-current-message-header-field 'to))))
+   (list (mh-edit-pick-expr
+          (mh-quote-pick-expr (mh-current-message-header-field 'to)))))
   (mh-narrow-to-header-field 'to pick-expr))
 
 
--- a/lisp/mh-e/mh-mime.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/mh-e/mh-mime.el	Fri Mar 03 07:48:46 2006 +0000
@@ -1689,8 +1689,7 @@
   "Return the content type associated with the given FILENAME.
 If the \"file\" command exists and recognizes the given file,
 then its value is returned\; otherwise, the user is prompted for
-a type (see `mailcap-mime-types' and for Emacs 20,
-`mh-mime-content-types').
+a type (see `mailcap-mime-types').
 Optional argument DEFAULT is returned if a type isn't entered."
   (mailcap-parse-mimetypes)
   (let* ((default (or default
--- a/lisp/mh-e/mh-show.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/mh-e/mh-show.el	Fri Mar 03 07:48:46 2006 +0000
@@ -36,6 +36,9 @@
 (require 'mh-e)
 (require 'mh-scan)
 
+;; Dynamically-created function not found in mh-loaddefs.el.
+(autoload 'mh-tool-bar-init "mh-tool-bar")
+
 (require 'font-lock)
 (require 'gnus-cite)
 (require 'gnus-util)
@@ -830,6 +833,10 @@
 See also `mh-folder-mode'.
 
 \\{mh-show-mode-map}"
+  (mh-do-in-gnu-emacs
+    (set (make-local-variable 'tool-bar-map) mh-show-tool-bar-map))
+  (mh-do-in-xemacs
+    (mh-tool-bar-init :show))
   (set (make-local-variable 'mail-header-separator) mh-mail-header-separator)
   (setq paragraph-start (default-value 'paragraph-start))
   (mh-show-unquote-From)
@@ -853,8 +860,6 @@
   (if (and mh-xemacs-flag
            font-lock-auto-fontify)
       (turn-on-font-lock))
-  (set (make-local-variable 'tool-bar-map) mh-show-tool-bar-map)
-  (mh-funcall-if-exists mh-tool-bar-init :show)
   (when mh-decode-mime-flag
     (mh-make-local-hook 'kill-buffer-hook)
     (add-hook 'kill-buffer-hook 'mh-mime-cleanup nil t))
--- a/lisp/mh-e/mh-tool-bar.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/mh-e/mh-tool-bar.el	Fri Mar 03 07:48:46 2006 +0000
@@ -204,10 +204,10 @@
           letter-vectors (nreverse letter-vectors))
     (dolist (x folder-defaults)
       (unless (memq x folder-buttons)
-        (error "Folder defaults contains unknown button '%s'" x)))
+        (error "Folder defaults contains unknown button %s" x)))
     (dolist (x letter-defaults)
       (unless (memq x letter-buttons)
-        (error "Letter defaults contains unknown button '%s'" x)))
+        (error "Letter defaults contains unknown button %s" x)))
     `(eval-when (compile load eval)
        (defun mh-buffer-exists-p (mode)
          "Test whether a buffer with major mode MODE is present."
@@ -222,7 +222,6 @@
          ;; Tool bar initialization functions
          (defun mh-tool-bar-folder-buttons-init ()
            (when (mh-buffer-exists-p 'mh-folder-mode)
-             (mh-image-load-path)
              (setq mh-folder-tool-bar-map
                    (let ((tool-bar-map (make-sparse-keymap)))
                      ,@(nreverse folder-button-setter)
@@ -241,7 +240,6 @@
                      tool-bar-map))))
          (defun mh-tool-bar-letter-buttons-init ()
            (when (mh-buffer-exists-p 'mh-letter-mode)
-             (mh-image-load-path)
              (setq mh-letter-tool-bar-map
                    (let ((tool-bar-map (make-sparse-keymap)))
                      ,@(nreverse letter-button-setter)
@@ -334,84 +332,82 @@
                             collect `(const :tag ,y ,x)))))))
 
 (mh-tool-bar-define
-    ((:folder mh-inc-folder mh-mime-save-parts mh-previous-undeleted-msg
-              mh-page-msg  mh-next-undeleted-msg mh-delete-msg mh-refile-msg
-              mh-undo mh-execute-commands mh-toggle-tick mh-reply
-              mh-alias-grab-from-field mh-send mh-rescan-folder
-              mh-tool-bar-search mh-visit-folder
-              mh-tool-bar-customize mh-tool-bar-folder-help mh-widen)
-     (:letter mh-send-letter mh-compose-insertion ispell-message save-buffer
-              undo kill-region menu-bar-kill-ring-save yank mh-fully-kill-draft
-              mh-tool-bar-customize mh-tool-bar-letter-help))
-  ;; Folder/Show buffer buttons
-  (mh-inc-folder (folder) "mail"
-    "Incorporate new mail in Inbox
+ ((:folder mh-inc-folder mh-mime-save-parts mh-previous-undeleted-msg
+           mh-page-msg  mh-next-undeleted-msg mh-delete-msg mh-refile-msg
+           mh-undo mh-execute-commands mh-toggle-tick mh-reply
+           mh-alias-grab-from-field mh-send mh-rescan-folder
+           mh-tool-bar-search mh-visit-folder
+           mh-tool-bar-customize mh-tool-bar-folder-help mh-widen)
+  (:letter mh-send-letter mh-compose-insertion ispell-message save-buffer
+           undo kill-region menu-bar-kill-ring-save yank mh-fully-kill-draft
+           mh-tool-bar-customize mh-tool-bar-letter-help))
+ ;; Folder/Show buffer buttons
+ (mh-inc-folder (folder) "mail" "Incorporate new mail in Inbox
 This button runs `mh-inc-folder' which drags any
-new mail into your Inbox folder.")
-  (mh-mime-save-parts (folder) "attach"
-    "Save MIME parts from this message
+new mail into your Inbox folder")
+ (mh-mime-save-parts (folder) "attach" "Save MIME parts from this message
 This button runs `mh-mime-save-parts' which saves a message's
-different parts into separate files.")
-  (mh-previous-undeleted-msg (folder) "left-arrow"
-    "Go to the previous undeleted message
+different parts into separate files")
+ (mh-previous-undeleted-msg (folder) "left-arrow"
+                            "Go to the previous undeleted message
 This button runs `mh-previous-undeleted-msg'")
-  (mh-page-msg (folder) "page-down"
-    "Page the current message forwards\nThis button runs `mh-page-msg'")
-  (mh-next-undeleted-msg (folder) "right-arrow"
-    "Go to the next undeleted message\nThe button runs `mh-next-undeleted-msg'")
-  (mh-delete-msg (folder) "close"
-    "Mark this message for deletion\nThis button runs `mh-delete-msg'")
-  (mh-refile-msg (folder) "mail/refile"
-    "Refile this message\nThis button runs `mh-refile-msg'")
-  (mh-undo (folder) "undo" "Undo last operation\nThis button runs `undo'"
-    (mh-outstanding-commands-p))
-  (mh-execute-commands (folder) "execute"
-    "Perform moves and deletes\nThis button runs `mh-execute-commands'"
-    (mh-outstanding-commands-p))
-  (mh-toggle-tick (folder) "highlight"
-    "Toggle tick mark\nThis button runs `mh-toggle-tick'")
-  (mh-toggle-showing (folder) "show"
-    "Toggle showing message\nThis button runs `mh-toggle-showing'")
-  (mh-tool-bar-reply-from (folder) "mail/reply-from" "Reply to \"from\"")
-  (mh-tool-bar-reply-to (folder) "mail/reply-to" "Reply to \"to\"")
-  (mh-tool-bar-reply-all (folder) "mail/reply-all" "Reply to \"all\"")
-  (mh-reply (folder) "mail/reply"
-    "Reply to this message\nThis button runs `mh-reply'")
-  (mh-alias-grab-from-field (folder) "mail/alias"
-    "Grab From alias\nThis button runs `mh-alias-grab-from-field'"
-    (and (mh-extract-from-header-value) (not (mh-alias-for-from-p))))
-  (mh-send (folder) "mail/compose"
-    "Compose new message\nThis button runs `mh-send'")
-  (mh-rescan-folder (folder) "refresh"
-    "Rescan this folder\nThis button runs `mh-rescan-folder'")
-  (mh-pack-folder (folder) "mail/repack"
-    "Repack this folder\nThis button runs `mh-pack-folder'")
-  (mh-tool-bar-search (folder) "search"
-    "Search\nThis button runs `mh-tool-bar-search-function'")
-  (mh-visit-folder (folder) "fld-open"
-    "Visit other folder\nThis button runs `mh-visit-folder'")
-  ;; Letter buffer buttons
-  (mh-send-letter (letter) "mail/send" "Send this letter")
-  (mh-compose-insertion (letter) "attach" "Insert attachment")
-  (ispell-message (letter) "spell" "Check spelling")
-  (save-buffer (letter) "save" "Save current buffer to its file"
-    (buffer-modified-p))
-  (undo (letter) "undo" "Undo last operation")
-  (kill-region (letter) "cut"
-    "Cut (kill) text in region between mark and current position")
-  (menu-bar-kill-ring-save (letter) "copy"
-    "Copy text in region between mark and current position")
-  (yank (letter) "paste" "Paste (yank) text cut or copied earlier")
-  (mh-fully-kill-draft (letter) "close" "Kill this draft")
-  ;; Common buttons
-  (mh-tool-bar-customize (folder letter) "preferences" "MH-E Preferences")
-  (mh-tool-bar-folder-help (folder) "help"
-    "Help! (general help)\nThis button runs `info'")
-  (mh-tool-bar-letter-help (letter) "help"
-    "Help! (general help)\nThis button runs `info'")
-  ;; Folder narrowed to sequence buttons
-  (mh-widen (sequence) "widen"
-    "Widen from the sequence\nThis button runs `mh-widen'"))
+ (mh-page-msg (folder) "page-down" "Page the current message forwards
+This button runs `mh-page-msg'")
+ (mh-next-undeleted-msg (folder) "right-arrow" "Go to the next undeleted message
+The button runs `mh-next-undeleted-msg'")
+ (mh-delete-msg (folder) "close" "Mark this message for deletion
+This button runs `mh-delete-msg'")
+ (mh-refile-msg (folder) "mail/refile" "Refile this message
+This button runs `mh-refile-msg'")
+ (mh-undo (folder) "undo" "Undo last operation
+This button runs `undo'"
+          (mh-outstanding-commands-p))
+ (mh-execute-commands (folder) "execute" "Perform moves and deletes
+This button runs `mh-execute-commands'"
+                      (mh-outstanding-commands-p))
+ (mh-toggle-tick (folder) "highlight" "Toggle tick mark
+This button runs `mh-toggle-tick'")
+ (mh-toggle-showing (folder) "show" "Toggle showing message
+This button runs `mh-toggle-showing'")
+ (mh-tool-bar-reply-from (folder) "mail/reply-from" "Reply to \"from\"")
+ (mh-tool-bar-reply-to (folder) "mail/reply-to" "Reply to \"to\"")
+ (mh-tool-bar-reply-all (folder) "mail/reply-all" "Reply to \"all\"")
+ (mh-reply (folder) "mail/reply" "Reply to this message
+This button runs `mh-reply'")
+ (mh-alias-grab-from-field (folder) "mail/alias" "Grab From alias
+This button runs `mh-alias-grab-from-field'"
+                           (and (mh-extract-from-header-value)
+                                (not (mh-alias-for-from-p))))
+ (mh-send (folder) "mail/compose" "Compose new message
+This button runs `mh-send'")
+ (mh-rescan-folder (folder) "refresh" "Rescan this folder
+This button runs `mh-rescan-folder'")
+ (mh-pack-folder (folder) "mail/repack" "Repack this folder
+This button runs `mh-pack-folder'")
+ (mh-tool-bar-search (folder) "search" "Search
+This button runs `mh-tool-bar-search-function'")
+ (mh-visit-folder (folder) "fld-open" "Visit other folder
+This button runs `mh-visit-folder'")
+ ;; Letter buffer buttons
+ (mh-send-letter (letter) "mail/send" "Send this letter")
+ (mh-compose-insertion (letter) "attach" "Insert attachment")
+ (ispell-message (letter) "spell" "Check spelling")
+ (save-buffer (letter) "save" "Save current buffer to its file"
+              (buffer-modified-p))
+ (undo (letter) "undo" "Undo last operation")
+ (kill-region (letter) "cut" "Cut (kill) text in region")
+ (menu-bar-kill-ring-save (letter) "copy" "Copy text in region")
+ (yank (letter) "paste" "Paste (yank) text cut or copied earlier")
+ (mh-fully-kill-draft (letter) "close" "Kill this draft")
+ ;; Common buttons
+ (mh-tool-bar-customize (folder letter) "preferences" "MH-E Preferences")
+ (mh-tool-bar-folder-help (folder) "help" "Help! (general help)
+This button runs `info'")
+ (mh-tool-bar-letter-help (letter) "help" "Help! (general help)
+This button runs `info'")
+ ;; Folder narrowed to sequence buttons
+ (mh-widen (sequence) "widen" "Widen from the sequence
+This button runs `mh-widen'"))
 
 (provide 'mh-tool-bar)
 
--- a/lisp/mh-e/mh-utils.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/mh-e/mh-utils.el	Fri Mar 03 07:48:46 2006 +0000
@@ -81,69 +81,77 @@
   "Delete the next LINES lines."
   (delete-region (point) (progn (forward-line lines) (point))))
 
-(defvar mh-image-load-path nil
-  "Directory where images for MH-E are found.
-If nil, then the function `mh-image-load-path' will search for
-the images in \"../../etc/images\" relative to the files in
-\"lisp/mh-e\".")
-
-(defvar mh-image-load-path-called-flag nil
-  "Non-nil means that the function `mh-image-load-path' has been called.
-This variable is used by that function to avoid doing the work repeatedly.")
-
 ;;;###mh-autoload
-(defun mh-image-load-path ()
-  "Ensure that the MH-E images are accessible by `find-image'.
+(defun mh-image-load-path (library image &optional path)
+  "Return a suitable search path for images of LIBRARY.
 
-Images for MH-E are found in \"../../etc/images\" relative to the
-files in \"lisp/mh-e\", in `image-load-path', or in `load-path'.
-This function saves the actual location found in the variable
-`mh-image-load-path'. If the images on your system are actually
-located elsewhere, then set the variable `mh-image-load-path'
-before starting MH-E.
+Images for LIBRARY are searched for in \"../../etc/images\" and
+\"../etc/images\" relative to the files in \"lisp/LIBRARY\", in
+`image-load-path', or in `load-path'.
 
-If `image-load-path' exists (since Emacs 22), then the contents
-of the variable `mh-image-load-path' is added to it if isn't
-already there. Otherwise, the contents of the variable
-`mh-image-load-path' is added to the `load-path' if it isn't
-already there.
-
-See also variable `mh-image-load-path-called-flag'."
-  (unless mh-image-load-path-called-flag
+This function returns value of `load-path' augmented with the
+path to IMAGE.  If PATH is given, it is used instead of
+`load-path'."
+  (unless library (error "No library specified"))
+  (unless image   (error "No image specified"))
+  (let ((mh-image-directory))
     (cond
-     (mh-image-load-path)               ; user setting exists
-     ((let (mh-library-name)            ; try relative setting
-        ;; First, find mh-e in the load-path.
-        (setq mh-library-name (locate-library "mh-e"))
+     ;; Try relative setting.
+     ((let (mh-library-name d1ei d2ei)
+        ;; First, find library in the load-path.
+        (setq mh-library-name (locate-library library))
         (if (not mh-library-name)
-            (error "Can not find MH-E in load-path"))
-        ;; And then set mh-image-load-path relative to that.
-        (setq mh-image-load-path
-              (expand-file-name (concat
-                                 (file-name-directory mh-library-name)
-                                 "../../etc/images")))
-        (file-exists-p (expand-file-name "mh-logo.xpm" mh-image-load-path))))
-     ((mh-image-search-load-path "mh-logo.xpm")
-      ;; Images in image-load-path.
-      (setq mh-image-load-path
-	    (file-name-directory (mh-image-search-load-path "mh-logo.xpm"))))
-     ((locate-library "mh-logo.xpm")
-      ;; Images in load-path.
-      (setq mh-image-load-path
-	    (file-name-directory (locate-library "mh-logo.xpm")))))
-
-    (if (not (file-exists-p mh-image-load-path))
-        (error "Directory %s in mh-image-load-path does not exist"
-               mh-image-load-path))
-    (if (not (file-exists-p
-              (expand-file-name "mh-logo.xpm" mh-image-load-path)))
-      (error "Directory %s in mh-image-load-path does not contain MH-E images"
-             mh-image-load-path))
-    (if (boundp 'image-load-path)
-        (add-to-list 'image-load-path mh-image-load-path)
-      (add-to-list 'load-path mh-image-load-path))
-
-    (setq mh-image-load-path-called-flag t)))
+            (error "Cannot find library %s in load-path" library))
+        ;; And then set mh-image-directory relative to that.
+        (setq
+         ;; Go down 2 levels.
+         d2ei (expand-file-name
+               (concat (file-name-directory mh-library-name)
+                       "../../etc/images"))
+         ;; Go down 1 level.
+         d1ei (expand-file-name
+               (concat (file-name-directory mh-library-name)
+                       "../etc/images")))
+        (setq mh-image-directory
+              ;; Set it to nil if image is not found.
+              (cond ((file-exists-p (expand-file-name image d2ei)) d2ei)
+                    ((file-exists-p (expand-file-name image d1ei)) d1ei)))))
+     ;; Check for images in image-load-path or load-path.
+     ((let ((img image)
+            (dir (or
+                  ;; Images in image-load-path.
+                  (mh-image-search-load-path image)
+                  ;; Images in load-path.
+                  (locate-library image)))
+            parent)
+        ;; Since the image might be in a nested directory
+        ;; (for example, mail/attach.pbm), adjust `mh-image-directory'
+        ;; accordingly.
+        (and dir
+             (setq dir (file-name-directory dir))
+             (progn
+               (while (setq parent (file-name-directory img))
+                 (setq img (directory-file-name parent)
+                       dir (expand-file-name "../" dir)))
+               (setq mh-image-directory dir))))))
+    ;;
+    (unless (file-exists-p mh-image-directory)
+      (error "Directory %s in mh-image-directory does not exist"
+	     mh-image-directory))
+    (unless (file-exists-p (expand-file-name image mh-image-directory))
+      (error "Directory %s in mh-image-directory does not contain image %s"
+             mh-image-directory image))
+    ;; Return augmented `image-load-path' or `load-path'.
+    (cond ((and path (symbolp path))
+           (nconc (list mh-image-directory)
+                  (delete mh-image-directory
+                          (if (boundp path)
+                              (copy-sequence (symbol-value path))
+                            nil))))
+          (t
+           (nconc (list mh-image-directory)
+                  (delete mh-image-directory
+                          (copy-sequence load-path)))))))
 
 ;;;###mh-autoload
 (defun mh-make-local-vars (&rest pairs)
@@ -159,6 +167,23 @@
     (funcall function (car list))
     (setq list (cdr list))))
 
+(defvar mh-pick-regexp-chars ".*$["
+  "List of special characters in pick regular expressions.")
+
+;;;###mh-autoload
+(defun mh-quote-pick-expr (pick-expr)
+  "Quote `mh-pick-regexp-chars' in PICK-EXPR.
+PICK-EXPR is a list of strings. Return nil if PICK-EXPR is nil."
+  (let ((quoted-pick-expr))
+    (dolist (string pick-expr)
+      (when (and string
+                 (not (string-equal string "")))
+        (loop for i from 0 to (1- (length mh-pick-regexp-chars)) do
+              (let ((s (string ?\\ (aref mh-pick-regexp-chars i))))
+                (setq string (mh-replace-regexp-in-string s s string t t))))
+        (setq quoted-pick-expr (append quoted-pick-expr (list string)))))
+    quoted-pick-expr))
+
 ;;;###mh-autoload
 (defun mh-replace-string (old new)
   "Replace all occurrences of OLD with NEW in the current buffer.
@@ -177,23 +202,26 @@
 ;;;###mh-autoload
 (defun mh-logo-display ()
   "Modify mode line to display MH-E logo."
-  (mh-image-load-path)
   (mh-do-in-gnu-emacs
-   (add-text-properties
-    0 2
-    `(display ,(or mh-logo-cache
-                   (setq mh-logo-cache
-                         (mh-funcall-if-exists
-                          find-image '((:type xpm :ascent center
-                                              :file "mh-logo.xpm"))))))
-    (car mode-line-buffer-identification)))
+    (let ((load-path
+           (mh-image-load-path "mh-e" "mh-logo.xpm" 'load-path))
+          (image-load-path
+           (mh-image-load-path "mh-e" "mh-logo.xpm" 'image-load-path)))
+      (add-text-properties
+       0 2
+       `(display ,(or mh-logo-cache
+                      (setq mh-logo-cache
+                            (mh-funcall-if-exists
+                             find-image '((:type xpm :ascent center
+                                                 :file "mh-logo.xpm"))))))
+       (car mode-line-buffer-identification))))
   (mh-do-in-xemacs
-   (setq modeline-buffer-identification
-         (list
-          (if mh-modeline-glyph
-              (cons modeline-buffer-id-left-extent mh-modeline-glyph)
-            (cons modeline-buffer-id-left-extent "XEmacs%N:"))
-          (cons modeline-buffer-id-right-extent " %17b")))))
+    (setq modeline-buffer-identification
+          (list
+           (if mh-modeline-glyph
+               (cons modeline-buffer-id-left-extent mh-modeline-glyph)
+             (cons modeline-buffer-id-left-extent "XEmacs%N:"))
+           (cons modeline-buffer-id-right-extent " %17b")))))
 
 
 
@@ -526,14 +554,19 @@
 ;;;###mh-autoload
 (defun mh-folder-list (folder)
   "Return FOLDER and its descendents.
-Returns a list of strings. For example,
-
-  '(\"inbox\" \"lists\" \"lists/mh-e\").
+FOLDER may have a + prefix. Returns a list of strings without the
++ prefix. If FOLDER is nil, then all folders are considered. For
+example, if your Mail directory only contains the folders +inbox,
++outbox, +lists, and +lists/mh-e, then
 
-If folder is nil, then all folders are considered. Respects the
-value of `mh-recursive-folders-flag'. If this flag is nil, and
-the sub-folders have not been explicitly viewed, then they will
-not be returned."
+  (mh-folder-list nil)
+       => (\"inbox\" \"lists\" \"lists/mh-e\" \"outbox\")
+  (mh-folder-list \"+lists\")
+       => (\"lists/mh-e\")
+
+Respects the value of `mh-recursive-folders-flag'. If this flag
+is nil, and the sub-folders have not been explicitly viewed, then
+they will not be returned."
   (let ((folder-list))
     ;; Normalize folder. Strip leading +. Add trailing slash (done in
     ;; two steps to avoid infinite loops when replacing "/*$" with "/"
@@ -542,16 +575,16 @@
     ;; returns all the files in / if given an empty string or +.
     (when folder
       (setq folder (mh-replace-regexp-in-string "^\+" "" folder))
-      (setq folder (mh-replace-regexp-in-string "/+$" "" folder))
-      (setq folder (concat folder "/"))
-      (if (equal folder "")
-        (setq folder nil)))
+      (setq folder (mh-replace-regexp-in-string "/+$" "" folder)))
+    ;; Add provided folder to list, unless all folders are asked for.
+    (unless (null folder)
+      (setq folder-list (list folder)))
     (loop for f in (mh-sub-folders folder) do
-          (setq folder-list (append folder-list (list (concat folder (car f)))))
-          (if (mh-children-p f)
-              (setq folder-list
-                    (append folder-list
-                            (mh-folder-list (concat folder (car f)))))))
+          (setq folder-list
+                (append folder-list
+                        (if (mh-children-p f)
+                            (mh-folder-list (concat folder "/" (car f)))
+                          (list (concat folder "/" (car f)))))))
     folder-list))
 
 ;;;###mh-autoload
--- a/lisp/progmodes/gdb-ui.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/progmodes/gdb-ui.el	Fri Mar 03 07:48:46 2006 +0000
@@ -71,17 +71,17 @@
 ;;; Known Bugs:
 
 ;; 1) Strings that are watched don't update in the speedbar when their
-;; contents change.
+;; contents change unless the first character changes.
 ;; 2) Cannot handle multiple debug sessions.
-
-;;; Problems with watch expressions:
+;; 3) Initially, the assembler buffer does not display the cursor at the
+;; current line if the line is not visible in the window (but when testing
+;; gdb-assembler-custom with a lisp debugger it does!).
+
+;;; Problems with watch expressions, GDB/MI:
 
 ;; 1) They go out of scope when the inferior is re-run.
-;; 2) -var-update reports that an out of scope variable has changed:
-;;    changelist=[{name="var1",in_scope="false"}], but the value can't be accessed.
-;;    (-var-list-children, in contrast allows you to create variable objects of
-;;      the children when they are out of scope and get their values).
-;; 3) VARNUM increments even when vaiable object is not created (maybe trivial).
+;; 2) -stack-list-locals has a type field but also prints type in values field.
+;; 3) VARNUM increments even when vairable object is not created (maybe trivial).
 
 ;;; TODO:
 
@@ -124,6 +124,7 @@
   "Non-nil if GDB knows that the inferior includes preprocessor macro info.")
 (defvar gdb-buffer-fringe-width nil)
 (defvar gdb-signalled nil)
+(defvar gdb-source-window nil)
 
 (defvar gdb-buffer-type nil
   "One of the symbols bound in `gdb-buffer-rules'.")
@@ -489,7 +490,8 @@
 	gdb-macro-info nil
 	gdb-buffer-fringe-width (car (window-fringes))
 	gdb-debug-ring nil
-	gdb-signalled nil)
+	gdb-signalled nil
+	gdb-source-window nil)
 
   (setq gdb-buffer-type 'gdba)
 
@@ -748,15 +750,17 @@
 	(delq 'gdb-var-update gdb-pending-triggers))
   (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
     ;; Dummy command to update speedbar at right time.
-    (gdb-enqueue-input (list "server pwd\n" 'gdb-speedbar-timer-fn))
+    (gdb-enqueue-input (list "server pwd\n" 'gdb-speedbar-refresh))
     ;; Keep gdb-pending-triggers non-nil till end.
-    (push 'gdb-speedbar-timer gdb-pending-triggers)))
-
-(defun gdb-speedbar-timer-fn ()
+    (push 'gdb-speedbar-refresh gdb-pending-triggers)))
+
+(defun gdb-speedbar-refresh ()
   (setq gdb-pending-triggers
-	(delq 'gdb-speedbar-timer gdb-pending-triggers))
+	(delq 'gdb-speedbar-refresh gdb-pending-triggers))
   (with-current-buffer gud-comint-buffer
-    (speedbar-timer-fn)))
+    (let ((speedbar-verbosity-level 0))
+      (save-excursion
+	(speedbar-refresh)))))
 
 (defun gdb-var-delete ()
   "Delete watch expression at point from the speedbar."
@@ -817,9 +821,10 @@
 	 (dolist (var gdb-var-list)
 	   (if (string-match (concat token "\\.") (nth 1 var))
 	       (setq gdb-var-list (delq var gdb-var-list))))
-	 (setq gdb-force-update t)
-	 (with-current-buffer gud-comint-buffer
-	   (speedbar-timer-fn)))))
+	 (speedbar-change-expand-button-char ?+)
+	 (speedbar-delete-subblock indent))
+	(t (error "Ooops...  not sure what to do")))
+  (speedbar-center-buffer-smartly))
 
 (defun gdb-get-target-string ()
   (with-current-buffer gud-comint-buffer
@@ -835,7 +840,7 @@
 ;; The usual gdb interaction buffer is given the type `gdba' and
 ;; is constructed specially.
 ;;
-;; Others are constructed by gdb-get-create-buffer and
+;; Others are constructed by gdb-get-buffer-create and
 ;; named according to the rules set forth in the gdb-buffer-rules-assoc
 
 (defvar gdb-buffer-rules-assoc '())
@@ -846,7 +851,7 @@
   (save-excursion
     (gdb-look-for-tagged-buffer key (buffer-list))))
 
-(defun gdb-get-create-buffer (key)
+(defun gdb-get-buffer-create (key)
   "Create a new gdb  buffer of the type specified by KEY.
 The key should be one of the cars in `gdb-buffer-rules-assoc'."
   (or (gdb-get-buffer key)
@@ -924,7 +929,7 @@
   (interactive)
   (if gdb-use-separate-io-buffer
       (gdb-display-buffer
-       (gdb-get-create-buffer 'gdb-inferior-io))))
+       (gdb-get-buffer-create 'gdb-inferior-io))))
 
 (defconst gdb-frame-parameters
   '((height . 14) (width . 80)
@@ -939,7 +944,7 @@
   (if gdb-use-separate-io-buffer
       (let ((special-display-regexps (append special-display-regexps '(".*")))
 	    (special-display-frame-alist gdb-frame-parameters))
-	(display-buffer (gdb-get-create-buffer 'gdb-inferior-io)))))
+	(display-buffer (gdb-get-buffer-create 'gdb-inferior-io)))))
 
 (defvar gdb-inferior-io-mode-map
   (let ((map (make-sparse-keymap)))
@@ -1156,7 +1161,7 @@
       (setq gdb-output-sink 'user)
       (let ((handler
 	     (car (cdr gdb-current-item))))
-	(with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
+	(with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
 	  (funcall handler))))
      (t
       (gdb-resync)
@@ -1248,12 +1253,13 @@
   "An annotation handler for `post-prompt'.
 This begins the collection of output from the current command if that
 happens to be appropriate."
-  ;; Don't add to queue if there outstanding items or GDB is not known yet.
+  ;; Don't add to queue if there outstanding items or gdb-version is not known
+  ;; yet.
   (unless (or gdb-pending-triggers gdb-first-post-prompt)
     (gdb-get-selected-frame)
     (gdb-invalidate-frames)
     ;; Regenerate breakpoints buffer in case it has been inadvertantly deleted.
-    (gdb-get-create-buffer 'gdb-breakpoints-buffer)
+    (gdb-get-buffer-create 'gdb-breakpoints-buffer)
     (gdb-invalidate-breakpoints)
     ;; Do this through gdb-get-selected-frame -> gdb-frame-handler
     ;; so gdb-frame-address is updated.
@@ -1288,6 +1294,22 @@
       (gdb-resync)
       (error "Phase error in gdb-post-prompt (got %s)" sink)))))
 
+;; GUD displays the selected GDB frame.  This might might not be the current
+;; GDB frame (after up, down etc).  If no GDB frame is visible but the last
+;; visited breakpoint is, use that window.
+(defun gdb-display-source-buffer (buffer)
+  (let* ((last-window (if gud-last-last-frame
+			 (get-buffer-window
+			  (gud-find-file (car gud-last-last-frame)))))
+	 (source-window (or last-window
+			    (if (and gdb-source-window
+				     (window-live-p gdb-source-window))
+				gdb-source-window))))
+    (when source-window
+      (setq gdb-source-window source-window)
+      (set-window-buffer source-window buffer))
+    source-window))
+
 (defun gud-gdba-marker-filter (string)
   "A gud marker filter for gdb.  Handle a burst of output from GDB."
   (if gdb-flush-pending-output
@@ -1370,23 +1392,23 @@
       (error "Bogon output sink %S" sink)))))
 
 (defun gdb-append-to-partial-output (string)
-  (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
+  (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
     (goto-char (point-max))
     (insert string)))
 
 (defun gdb-clear-partial-output ()
-  (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
+  (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
     (erase-buffer)))
 
 (defun gdb-append-to-inferior-io (string)
-  (with-current-buffer (gdb-get-create-buffer 'gdb-inferior-io)
+  (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io)
     (goto-char (point-max))
     (insert-before-markers string))
   (if (not (string-equal string ""))
-      (gdb-display-buffer (gdb-get-create-buffer 'gdb-inferior-io))))
+      (gdb-display-buffer (gdb-get-buffer-create 'gdb-inferior-io))))
 
 (defun gdb-clear-inferior-io ()
-  (with-current-buffer (gdb-get-create-buffer 'gdb-inferior-io)
+  (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io)
     (erase-buffer)))
 
 
@@ -1434,11 +1456,13 @@
        (and buf
 	    (with-current-buffer buf
 	      (let* ((window (get-buffer-window buf 0))
+		     (start (window-start window))
 		     (p (window-point window))
 		    (buffer-read-only nil))
 		(erase-buffer)
-		(insert-buffer-substring (gdb-get-create-buffer
+		(insert-buffer-substring (gdb-get-buffer-create
 					  'gdb-partial-output-buffer))
+		(set-window-start window start)
 		(set-window-point window p)))))
      ;; put customisation here
      (,custom-defun)))
@@ -1688,14 +1712,14 @@
   "Display status of user-settable breakpoints."
   (interactive)
   (gdb-display-buffer
-   (gdb-get-create-buffer 'gdb-breakpoints-buffer)))
+   (gdb-get-buffer-create 'gdb-breakpoints-buffer)))
 
 (defun gdb-frame-breakpoints-buffer ()
   "Display status of user-settable breakpoints in a new frame."
   (interactive)
   (let ((special-display-regexps (append special-display-regexps '(".*")))
 	(special-display-frame-alist gdb-frame-parameters))
-    (display-buffer (gdb-get-create-buffer 'gdb-breakpoints-buffer))))
+    (display-buffer (gdb-get-buffer-create 'gdb-breakpoints-buffer))))
 
 (defvar gdb-breakpoints-mode-map
   (let ((map (make-sparse-keymap))
@@ -1767,9 +1791,6 @@
   "Display the breakpoint location specified at current line."
   (interactive (list last-input-event))
   (if event (posn-set-point (event-end event)))
-  ;; Hack to stop gdb-goto-breakpoint displaying in GUD buffer.
-  (let ((window (get-buffer-window gud-comint-buffer)))
-    (if window (save-selected-window  (select-window window))))
   (save-excursion
     (beginning-of-line 1)
     (if (looking-at "\\([0-9]+\\) .+ in .+ at\\s-+\\(\\S-+\\):\\([0-9]+\\)")
@@ -1777,11 +1798,13 @@
 	      (file  (match-string 2))
 	      (line  (match-string 3)))
 	  (save-selected-window
-	    (let* ((buf (find-file-noselect
+	    (let* ((buffer (find-file-noselect
 			 (if (file-exists-p file) file
 			   (cdr (assoc bptno gdb-location-alist)))))
-		   (window (display-buffer buf)))
-	      (with-current-buffer buf
+		   (window (unless (gdb-display-source-buffer buffer)
+			       (display-buffer buffer))))
+	      (setq gdb-source-window window)
+	      (with-current-buffer buffer
 		(goto-line (string-to-number line))
 		(set-window-point window (point))))))
       (error "No location specified."))))
@@ -1844,14 +1867,14 @@
   "Display backtrace of current stack."
   (interactive)
   (gdb-display-buffer
-   (gdb-get-create-buffer 'gdb-stack-buffer)))
+   (gdb-get-buffer-create 'gdb-stack-buffer)))
 
 (defun gdb-frame-stack-buffer ()
   "Display backtrace of current stack in a new frame."
   (interactive)
   (let ((special-display-regexps (append special-display-regexps '(".*")))
 	(special-display-frame-alist gdb-frame-parameters))
-    (display-buffer (gdb-get-create-buffer 'gdb-stack-buffer))))
+    (display-buffer (gdb-get-buffer-create 'gdb-stack-buffer))))
 
 (defvar gdb-frames-mode-map
   (let ((map (make-sparse-keymap)))
@@ -1925,14 +1948,14 @@
   "Display IDs of currently known threads."
   (interactive)
   (gdb-display-buffer
-   (gdb-get-create-buffer 'gdb-threads-buffer)))
+   (gdb-get-buffer-create 'gdb-threads-buffer)))
 
 (defun gdb-frame-threads-buffer ()
   "Display IDs of currently known threads in a new frame."
   (interactive)
   (let ((special-display-regexps (append special-display-regexps '(".*")))
 	(special-display-frame-alist gdb-frame-parameters))
-    (display-buffer (gdb-get-create-buffer 'gdb-threads-buffer))))
+    (display-buffer (gdb-get-buffer-create 'gdb-threads-buffer))))
 
 (defvar gdb-threads-mode-map
   (let ((map (make-sparse-keymap)))
@@ -2061,14 +2084,14 @@
   "Display integer register contents."
   (interactive)
   (gdb-display-buffer
-   (gdb-get-create-buffer 'gdb-registers-buffer)))
+   (gdb-get-buffer-create 'gdb-registers-buffer)))
 
 (defun gdb-frame-registers-buffer ()
   "Display integer register contents in a new frame."
   (interactive)
   (let ((special-display-regexps (append special-display-regexps '(".*")))
 	(special-display-frame-alist gdb-frame-parameters))
-    (display-buffer (gdb-get-create-buffer 'gdb-registers-buffer))))
+    (display-buffer (gdb-get-buffer-create 'gdb-registers-buffer))))
 
 (defun gdb-all-registers ()
   "Toggle the display of floating-point registers (pre GDB 6.4 only)."
@@ -2077,10 +2100,10 @@
     (if gdb-all-registers
 	(progn
 	  (setq gdb-all-registers nil)
-	  (with-current-buffer (gdb-get-create-buffer 'gdb-registers-buffer)
+	  (with-current-buffer (gdb-get-buffer-create 'gdb-registers-buffer)
 	    (setq mode-name "Registers")))
       (setq gdb-all-registers t)
-      (with-current-buffer (gdb-get-create-buffer 'gdb-registers-buffer)
+      (with-current-buffer (gdb-get-buffer-create 'gdb-registers-buffer)
 	(setq mode-name "Registers:All")))
     (message (format "Display of floating-point registers %sabled"
 		     (if gdb-all-registers "en" "dis")))
@@ -2385,14 +2408,14 @@
   "Display memory contents."
   (interactive)
   (gdb-display-buffer
-   (gdb-get-create-buffer 'gdb-memory-buffer)))
+   (gdb-get-buffer-create 'gdb-memory-buffer)))
 
 (defun gdb-frame-memory-buffer ()
   "Display memory contents in a new frame."
   (interactive)
   (let ((special-display-regexps (append special-display-regexps '(".*")))
 	(special-display-frame-alist gdb-frame-parameters))
-    (display-buffer (gdb-get-create-buffer 'gdb-memory-buffer))))
+    (display-buffer (gdb-get-buffer-create 'gdb-memory-buffer))))
 
 
 ;; Locals buffer.
@@ -2450,12 +2473,15 @@
     (and buf
 	 (with-current-buffer buf
 	      (let* ((window (get-buffer-window buf 0))
+		     (start (window-start window))
 		     (p (window-point window))
 		     (buffer-read-only nil))
 		 (erase-buffer)
-		 (insert-buffer-substring (gdb-get-create-buffer
+		 (insert-buffer-substring (gdb-get-buffer-create
 					   'gdb-partial-output-buffer))
-		(set-window-point window p)))))
+		(set-window-start window start)
+		(set-window-point window p))
+)))
   (run-hooks 'gdb-info-locals-hook))
 
 (defvar gdb-locals-mode-map
@@ -2489,14 +2515,14 @@
   "Display local variables of current stack and their values."
   (interactive)
   (gdb-display-buffer
-   (gdb-get-create-buffer 'gdb-locals-buffer)))
+   (gdb-get-buffer-create 'gdb-locals-buffer)))
 
 (defun gdb-frame-locals-buffer ()
   "Display local variables of current stack and their values in a new frame."
   (interactive)
   (let ((special-display-regexps (append special-display-regexps '(".*")))
 	(special-display-frame-alist gdb-frame-parameters))
-    (display-buffer (gdb-get-create-buffer 'gdb-locals-buffer))))
+    (display-buffer (gdb-get-buffer-create 'gdb-locals-buffer))))
 
 
 ;;;; Window management
@@ -2619,7 +2645,7 @@
     (split-window-horizontally)
     (other-window 1)
     (gdb-set-window-buffer
-     (gdb-get-create-buffer 'gdb-inferior-io)))
+     (gdb-get-buffer-create 'gdb-inferior-io)))
   (other-window 1)
   (gdb-set-window-buffer (gdb-stack-buffer-name))
   (split-window-horizontally)
@@ -2672,7 +2698,7 @@
 
 (defun gdb-reset ()
   "Exit a debugging session cleanly.
-Kills the gdb buffers and resets the source buffers."
+Kills the gdb buffers, and resets variables and the source buffers."
   (dolist (buffer (buffer-list))
     (unless (eq buffer gud-comint-buffer)
       (with-current-buffer buffer
@@ -2707,7 +2733,7 @@
       (setq gdb-macro-info t))
  (if gdb-many-windows
       (gdb-setup-windows)
-   (gdb-get-create-buffer 'gdb-breakpoints-buffer)
+   (gdb-get-buffer-create 'gdb-breakpoints-buffer)
    (if gdb-show-main
        (let ((pop-up-windows t))
 	 (display-buffer (gud-find-file gdb-main-file))))))
@@ -2960,7 +2986,7 @@
   (interactive)
   (setq gdb-previous-frame nil)
   (gdb-display-buffer
-   (gdb-get-create-buffer 'gdb-assembler-buffer)))
+   (gdb-get-buffer-create 'gdb-assembler-buffer)))
 
 (defun gdb-frame-assembler-buffer ()
   "Display disassembly view in a new frame."
@@ -2968,7 +2994,7 @@
   (setq gdb-previous-frame nil)
   (let ((special-display-regexps (append special-display-regexps '(".*")))
 	(special-display-frame-alist gdb-frame-parameters))
-    (display-buffer (gdb-get-create-buffer 'gdb-assembler-buffer))))
+    (display-buffer (gdb-get-buffer-create 'gdb-assembler-buffer))))
 
 ;; modified because if gdb-frame-address has changed value a new command
 ;; must be enqueued to update the buffer with the new output
@@ -3122,9 +3148,9 @@
    (delq 'gdb-var-update gdb-pending-triggers))
   (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
     ;; dummy command to update speedbar at right time
-    (gdb-enqueue-input (list "server pwd\n" 'gdb-speedbar-timer-fn))
+    (gdb-enqueue-input (list "server pwd\n" 'gdb-speedbar-refresh))
     ;; keep gdb-pending-triggers non-nil till end
-    (push 'gdb-speedbar-timer gdb-pending-triggers)))
+    (push 'gdb-speedbar-refresh gdb-pending-triggers)))
 
 ;; Registers buffer.
 ;;
@@ -3166,11 +3192,14 @@
 	      (concat register-values register-string)))
       (let ((buf (gdb-get-buffer 'gdb-registers-buffer)))
 	(with-current-buffer buf
-	  (let ((p (window-point (get-buffer-window buf 0)))
-		(buffer-read-only nil))
+	  (let* ((window (get-buffer-window buf 0))
+		 (start (window-start window))
+		 (p (window-point window))
+		 (buffer-read-only nil))
 	    (erase-buffer)
 	    (insert register-values)
-	    (set-window-point (get-buffer-window buf 0) p))))))
+	    (set-window-start window start)
+	    (set-window-point window p))))))
   (gdb-data-list-register-values-custom))
 
 (defun gdb-data-list-register-values-custom ()
@@ -3255,6 +3284,7 @@
     (let ((buf (gdb-get-buffer 'gdb-locals-buffer)))
       (and buf (with-current-buffer buf
 		 (let* ((window (get-buffer-window buf 0))
+			(start (window-start window))
 			(p (window-point window))
 			(buffer-read-only nil))
 		   (erase-buffer)
@@ -3270,6 +3300,7 @@
 		       (insert 
 			(concat name "\t" (nth 1 local)
 				"\t" (nth 2 local) "\n")))
+		   (set-window-start window start)
 		   (set-window-point window p)))))))
 
 (defun gdb-get-register-names ()
--- a/lisp/progmodes/gud.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/progmodes/gud.el	Fri Mar 03 07:48:46 2006 +0000
@@ -406,18 +406,18 @@
 
 (defvar gud-speedbar-menu-items
   '(["Jump to stack frame" speedbar-edit-line
-     :visible (with-current-buffer gud-comint-buffer
-		(not (memq gud-minor-mode '(gdbmi gdba))))]
+     :visible (not (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
+		    '(gdbmi gdba)))]
     ["Edit value" speedbar-edit-line
-     :visible (with-current-buffer gud-comint-buffer
-		(memq gud-minor-mode '(gdbmi gdba)))]
+     :visible (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
+		    '(gdbmi gdba))]
     ["Delete expression" gdb-var-delete
-     (with-current-buffer gud-comint-buffer
-       (memq gud-minor-mode '(gdbmi gdba)))]
+     :visible (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
+		    '(gdbmi gdba))]
     ["Auto raise frame" gdb-speedbar-auto-raise
      :style toggle :selected gdb-speedbar-auto-raise
-     :visible (with-current-buffer gud-comint-buffer
-       (memq gud-minor-mode '(gdbmi gdba)))])
+     :visible (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
+		    '(gdbmi gdba))])
   "Additional menu items to add to the speedbar frame.")
 
 ;; Make sure our special speedbar mode is loaded
@@ -2753,9 +2753,10 @@
 	  (with-current-buffer gud-comint-buffer
 	    (gud-find-file true-file)))
 	 (window (and buffer (or (get-buffer-window buffer)
-				   (display-buffer buffer))))
+				 (if (memq gud-minor-mode '(gdbmi gdba))
+				     (gdb-display-source-buffer buffer))
+				 (display-buffer buffer))))
 	 (pos))
-    (message "%s %s" (current-buffer) buffer)
     (if buffer
 	(progn
 	  (with-current-buffer buffer
--- a/lisp/speedbar.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/speedbar.el	Fri Mar 03 07:48:46 2006 +0000
@@ -57,6 +57,73 @@
 ;;     http://www.dina.kvl.dk/~abraham/custom/
 ;;     custom is available in all versions of Emacs version 20 or better.
 ;;
+;;; Developing for speedbar
+;;
+;; Adding a speedbar specialized display mode:
+;;
+;; Speedbar can be configured to create a special display for certain
+;; modes that do not display traditional file/tag data.  Rmail, Info,
+;; and the debugger are examples.  These modes can, however, benefit
+;; from a speedbar style display in their own way.
+;;
+;; If your `major-mode' is `foo-mode', the only requirement is to
+;; create a function called `foo-speedbar-buttons' which takes one
+;; argument, BUFFER.  BUFFER will be the buffer speedbar wants filled.
+;; In `foo-speedbar-buttons' there are several functions that make
+;; building a speedbar display easy.  See the documentation for
+;; `speedbar-with-writable' (needed because the buffer is usually
+;; read-only) `speedbar-make-tag-line', `speedbar-insert-button', and
+;; `speedbar-insert-generic-list'.  If you use
+;; `speedbar-insert-generic-list', also read the doc for
+;; `speedbar-tag-hierarchy-method' in case you wish to override it.
+;; The macro `speedbar-with-attached-buffer' brings you back to the
+;; buffer speedbar is displaying for.
+;;
+;; For those functions that make buttons, the "function" should be a
+;; symbol that is the function to call when clicked on.  The "token"
+;; is extra data you can pass along.  The "function" must take three
+;; parameters.  They are (TEXT TOKEN INDENT).  TEXT is the text of the
+;; button clicked on.  TOKEN is the data passed in when you create the
+;; button.  INDENT is an indentation level, or 0.  You can store
+;; indentation levels with `speedbar-make-tag-line' which creates a
+;; line with an expander (eg.  [+]) and a text button.
+;;
+;; Some useful functions when writing expand functions, and click
+;; functions are `speedbar-change-expand-button-char',
+;; `speedbar-delete-subblock', and `speedbar-center-buffer-smartly'.
+;; The variable `speedbar-power-click' is set to t in your functions
+;; when the user shift-clicks.  This is an indication of anything from
+;; refreshing cached data to making a buffer appear in a new frame.
+;;
+;; If you wish to add to the default speedbar menu for the case of
+;; `foo-mode', create a variable `foo-speedbar-menu-items'.  This
+;; should be a list compatible with the `easymenu' package.  It will
+;; be spliced into the main menu.  (Available with click-mouse-3).  If
+;; you wish to have extra key bindings in your special mode, create a
+;; variable `foo-speedbar-key-map'.  Instead of using `make-keymap',
+;; or `make-sparse-keymap', use the function
+;; `speedbar-make-specialized-keymap'.  This lets you inherit all of
+;; speedbar's default bindings with low overhead.
+;;
+;; Adding a speedbar top-level display mode:
+;;
+;; Unlike the specialized modes, there are no name requirements,
+;; however the methods for writing a button display, menu, and keymap
+;; are the same.  Once you create these items, you can call the
+;; function `speedbar-add-expansion-list'.  It takes one parameter
+;; which is a list element of the form (NAME MENU KEYMAP &rest
+;; BUTTON-FUNCTIONS).  NAME is a string that will show up in the
+;; Displays menu item.  MENU is a symbol containing the menu items to
+;; splice in.  KEYMAP is a symbol holding the keymap to use, and
+;; BUTTON-FUNCTIONS are the function names to call, in order, to create
+;; the display.
+;;  Another tweakable variable is `speedbar-stealthy-function-list'
+;; which is of the form (NAME &rest FUNCTION ...).  NAME is the string
+;; name matching `speedbar-add-expansion-list'.  (It does not need to
+;; exist.). This provides additional display info which might be
+;; time-consuming to calculate.
+;;  Lastly, `speedbar-mode-functions-list' allows you to set special
+;; function overrides.
 
 ;;; TODO:
 ;; - Timeout directories we haven't visited in a while.
@@ -2467,20 +2534,19 @@
 	(set-buffer speedbar-buffer)
 	(speedbar-with-writable
 	  (let* ((window (get-buffer-window speedbar-buffer 0))
-		 (p (window-point window)))
+		 (p (window-point window))
+		 (start (window-start window)))
 	    (erase-buffer)
 	    (dolist (func funclst)
 	      (setq default-directory cbd)
 	      (funcall func cbd 0))
 	    (speedbar-reconfigure-keymaps)
-	    (set-window-point window p)))
+	    (set-window-point window p)
+	    (set-window-start window start)))
 	))))
 
 (defun speedbar-update-directory-contents ()
   "Update the contents of the speedbar buffer based on the current directory."
-
-  (save-excursion
-
     (let ((cbd (expand-file-name default-directory))
 	  cbd-parent
 	  (funclst (speedbar-initial-expansion-list))
@@ -2541,17 +2607,21 @@
 		 (speedbar-directory-line cbd))
 	    ;; Open it.
 	    (speedbar-expand-line)
-	  (erase-buffer)
-	  (cond (use-cache
-		 (setq default-directory
-		       (nth (1- (length speedbar-shown-directories))
-			    speedbar-shown-directories))
-		 (insert (cdr cache)))
-		(t
-	  (dolist (func funclst)
-	    (setq default-directory cbd)
-	    (funcall func cbd 0)))))
-	(goto-char (point-min)))))
+	  (let* ((window (get-buffer-window speedbar-buffer 0))
+		 (p (window-point window))
+		 (start (window-start window)))
+	    (erase-buffer)
+	    (cond (use-cache
+		   (setq default-directory
+			 (nth (1- (length speedbar-shown-directories))
+			      speedbar-shown-directories))
+		   (insert (cdr cache)))
+		  (t
+		   (dolist (func funclst)
+		     (setq default-directory cbd)
+	    (funcall func cbd 0))))
+	    (set-window-point window p)
+	    (set-window-start window start)))))
   (speedbar-reconfigure-keymaps))
 
 (defun speedbar-update-special-contents ()
@@ -2576,8 +2646,7 @@
 	  (dolist (func funclst)
 	    ;; We do not erase the buffer because these functions may
 	    ;; decide NOT to update themselves.
-	    (funcall func specialbuff)))
-      (goto-char (point-min))))
+	    (funcall func specialbuff)))))
   (speedbar-reconfigure-keymaps))
 
 (defun speedbar-set-timer (timeout)
--- a/lisp/startup.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/startup.el	Fri Mar 03 07:48:46 2006 +0000
@@ -646,7 +646,7 @@
   (let ((lisp-dir
 	 (file-name-directory
 	  (locate-file "simple" load-path
-		       load-suffixes))))
+		       (get-load-suffixes)))))
 
     (setq load-history
 	  (mapcar (lambda (elt)
--- a/lisp/subr.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/subr.el	Fri Mar 03 07:48:46 2006 +0000
@@ -1324,12 +1324,13 @@
 and the file name is displayed in the echo area."
   (interactive (list (completing-read "Locate library: "
 				      'locate-file-completion
-				      (cons load-path load-suffixes))
+				      (cons load-path (get-load-suffixes)))
 		     nil nil
 		     t))
   (let ((file (locate-file library
 			   (or path load-path)
-			   (append (unless nosuffix load-suffixes) '("")))))
+			   (append (unless nosuffix (get-load-suffixes))
+				   load-file-rep-suffixes))))
     (if interactive-call
 	(if file
 	    (message "Library is file %s" (abbreviate-file-name file))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/t-mouse.el	Fri Mar 03 07:48:46 2006 +0000
@@ -0,0 +1,306 @@
+;;; t-mouse.el --- mouse support within the text terminal
+
+;; Authors: Alessandro Rubini and Ian T Zimmerman
+;; Maintainer: Nick Roberts <nickrob@gnu.org>
+;; Keywords: mouse gpm linux
+
+;; Copyright (C) 1994,1995 Alessandro Rubini <rubini@linux.it>
+;;               parts are by Ian T Zimmermann <itz@rahul.net>, 1995,1998
+;; Copyright (C) 2006 
+;; Free Software Foundation, Inc.
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+
+;; This package provides access to mouse event as reported by the
+;; gpm-Linux package. It uses the program "mev" to get mouse events.
+;; It tries to reproduce the functionality offered by emacs under X.
+;; The "gpm" server runs under Linux, so this package is rather
+;; Linux-dependent.
+
+;; Modified by Nick Roberts for Emacs 22.  In particular, the mode-line is
+;; now position sensitive.
+
+(defvar t-mouse-process nil 
+  "Embeds the process which passes mouse events to emacs.
+It is used by the program t-mouse.")
+
+(defvar t-mouse-filter-accumulator ""
+  "Accumulates input from the mouse reporting process.")
+
+(defvar t-mouse-debug-buffer nil
+  "Events normally posted to command queue are printed here in debug mode.
+See `t-mouse-start-debug'.")
+
+(defvar t-mouse-current-xy '(0 . 0)
+  "Stores the last mouse position t-mouse has been told about.")
+
+(defvar t-mouse-drag-start nil
+  "Whenever a drag starts in a special part of a window
+(not the text), the `translated' starting coordinates including the
+window and part involved are saved here.  This is necessary lest they
+get re-translated when the button goes up, at which time window
+configuration may have changed.")
+
+(defvar t-mouse-prev-set-selection-function 'x-set-selection)
+(defvar t-mouse-prev-get-selection-function 'x-get-selection)
+
+(defvar t-mouse-swap-alt-keys nil
+  "When set, Emacs will handle mouse events with the right Alt
+(a.k.a. Alt-Ger) modifier, not with the regular left Alt modifier.
+Useful for people who play strange games with their keyboard tables.")
+
+(defvar t-mouse-fix-21 nil 
+  "Enable brain-dead chords for 2 button mice.")
+
+
+;;; Code:
+
+;; get the number of the current virtual console
+
+(defun t-mouse-tty ()
+  "Returns number of virtual terminal Emacs is running on, as a string.
+For example, \"2\" for /dev/tty2."
+  (with-temp-buffer
+    (call-process "ps" nil t nil "h" (format "%s" (emacs-pid)))
+    (goto-char (point-min))
+    (if (or
+	 ;; Many versions of "ps", all different....
+	 (re-search-forward " +tty\\(.?[0-9a-f]\\)" nil t)
+	 (re-search-forward "p \\([0-9a-f]\\)" nil t)
+	 (re-search-forward "v0\\([0-9a-f]\\)" nil t)
+	 (re-search-forward "[0-9]+ +\\([0-9]+\\)" nil t)
+	 (re-search-forward "[\\t ]*[0-9]+[\\t ]+\\([0-9]+\\)" nil t)
+	 (re-search-forward " +vc/\\(.?[0-9a-f]\\)" nil t)
+	 (re-search-forward " +pts/\\(.?[0-9a-f]\\)" nil t))
+	(buffer-substring (match-beginning 1) (match-end 1)))))
+
+
+;; due to a horrible kludge in Emacs' keymap handler
+;; (read_key_sequence) mouse clicks on funny parts of windows generate
+;; TWO events, the first being a dummy of the sort '(mode-line).
+;; That's why Per Abrahamsen's code in xt-mouse.el doesn't work for
+;; the modeline, for instance.
+
+;; now get this:  the Emacs C code that generates these fake events
+;; depends on certain things done by the very lowest level input
+;; handlers; namely the symbols for the events (for instance
+;; 'C-S-double-mouse-2) must have an 'event-kind property, set to
+;; 'mouse-click.  Since events from unread-command-events do not pass
+;; through the low level handlers, they don't get this property unless
+;; I set it myself.  I imagine this has caused innumerable attempts by
+;; hackers to do things similar to t-mouse to lose.
+
+;; The next page of code is devoted to fixing this ugly problem.
+
+;; WOW! a fully general powerset generator
+;; (C) Ian Zimmerman Mon Mar 23 12:00:16 PST 1998 :-)
+(defun t-mouse-powerset (l)
+  (if (null l) '(nil)
+    (let ((l1 (t-mouse-powerset (cdr l)))
+          (first (nth 0 l)))
+      (append
+       (mapcar (function (lambda (l) (cons first l))) l1) l1))))
+
+;; and a slightly less general cartesian product
+(defun t-mouse-cartesian (l1 l2)
+  (if (null l1) l2
+    (append (mapcar (function (lambda (x) (append (nth 0 l1) x))) l2)
+            (t-mouse-cartesian (cdr l1) l2))))
+      
+(let* ((modifier-sets (t-mouse-powerset '(control meta shift)))
+       (typed-sets (t-mouse-cartesian '((down) (drag))
+                                      '((mouse-1) (mouse-2) (mouse-3))))
+       (multipled-sets (t-mouse-cartesian '((double) (triple)) typed-sets))
+       (all-sets (t-mouse-cartesian modifier-sets multipled-sets)))
+  (while all-sets
+    (let ((event-sym (event-convert-list (nth 0 all-sets))))
+      (if (not (get event-sym 'event-kind))
+          (put event-sym 'event-kind 'mouse-click)))
+    (setq all-sets (cdr all-sets))))
+
+(defun t-mouse-make-event-element (x-dot-y-avec-time)
+  (let* ((x-dot-y (nth 0 x-dot-y-avec-time))
+         (x (car x-dot-y))
+         (y (cdr x-dot-y))
+         (w (window-at x y))
+         (ltrb (window-edges w))
+         (left (nth 0 ltrb))
+         (top (nth 1 ltrb)))
+    (if w (posn-at-x-y (- x left) (- y top) w t)
+      (append (list nil 'menu-bar) (nthcdr 2 (posn-at-x-y x y w t))))))
+
+;;; This fun is partly Copyright (C) 1994 Per Abrahamsen <abraham@iesd.auc.dk>
+(defun t-mouse-make-event ()
+  "Makes a Lisp style event from the contents of mouse input accumulator.
+Also trims the accumulator by all the data used to build the event."
+  (let (ob (ob-pos (condition-case nil
+		       (progn
+			 ;; this test is just needed for Fedora Core 3
+			 (if (string-match "STILL RUNNING_1\n"
+					   t-mouse-filter-accumulator)
+			     (setq t-mouse-filter-accumulator
+				   (substring
+				    t-mouse-filter-accumulator (match-end 0))))
+			 (read-from-string t-mouse-filter-accumulator))
+                     (error nil))))
+    ;; this test is just needed for Fedora Core 3
+    (if (or (eq (car ob-pos) 'STILL) (eq (car ob-pos) '***) (not ob-pos))
+	nil
+      (setq ob (car ob-pos))
+      (setq t-mouse-filter-accumulator
+            (substring t-mouse-filter-accumulator (cdr ob-pos)))
+
+      ;;now the real work
+
+      (let ((event-type (nth 0 ob))
+            (current-xy-avec-time (nth 1 ob))
+            (type-switch (length ob)))
+ 	(if t-mouse-fix-21
+            (let
+                ;;Acquire the event's symbol's name.
+                ((event-name-string (symbol-name event-type))
+                 end-of-root-event-name
+                 new-event-name-string)
+ 
+              (if (string-match "-\\(21\\|\\12\\)$" event-name-string)
+ 
+                  ;;Transform the name to what it should have been.
+                  (progn
+                    (setq end-of-root-event-name (match-beginning 0))
+                    (setq new-event-name-string
+                          (concat (substring  
+                                   event-name-string 0
+                                   end-of-root-event-name) "-3"))
+ 	      
+                    ;;Change the event to the symbol that corresponds to the
+                    ;;name we made. The proper symbol already exists.
+                    (setq event-type 
+                          (intern new-event-name-string))))))
+ 	
+        ;;store current position for mouse-position
+
+        (setq t-mouse-current-xy (nth 0 current-xy-avec-time))
+
+        ;;events have many types but fortunately they differ in length
+
+        (cond
+         ((= type-switch 4)             ;must be drag
+          (let ((count (nth 2 ob))
+                (start-element
+                 (or t-mouse-drag-start
+                     (t-mouse-make-event-element (nth 3 ob))))
+                (end-element
+                 (t-mouse-make-event-element current-xy-avec-time)))
+            (setq t-mouse-drag-start nil)
+            (list event-type start-element end-element count)))
+         ((= type-switch 3)             ;down or up
+          (let ((count (nth 2 ob))
+                (element
+                 (t-mouse-make-event-element current-xy-avec-time)))
+            (if (and (not t-mouse-drag-start)
+                     (symbolp (nth 1 element)))
+                ;; OUCH! GOTCHA! emacs uses setc[ad]r on these!
+                (setq t-mouse-drag-start (copy-sequence element))
+              (setq t-mouse-drag-start nil))
+            (list event-type element count)))
+         ((= type-switch 2)             ;movement
+          (list (if (eq 'vertical-scroll-bar
+                        (nth 1 t-mouse-drag-start)) 'scroll-bar-movement
+                  'mouse-movement)
+                (t-mouse-make-event-element current-xy-avec-time))))))))
+
+(defun t-mouse-process-filter (proc string)
+  (setq t-mouse-filter-accumulator
+        (concat t-mouse-filter-accumulator string))
+  (let ((event (t-mouse-make-event)))
+    (while event
+      (if (or track-mouse 
+              (not (eq 'mouse-movement (event-basic-type event))))
+          (setq unread-command-events
+                (nconc unread-command-events (list event))))
+      (if t-mouse-debug-buffer
+          (print unread-command-events t-mouse-debug-buffer))
+      (setq event (t-mouse-make-event)))))
+
+(defun t-mouse-mouse-position-function (pos)
+  "Return the t-mouse-position unless running with a window system.
+The (secret) scrollbar interface is not implemented yet."
+  (setcdr pos t-mouse-current-xy)
+  pos)
+
+;; It should be possible to just send SIGTSTP to the inferior with
+;; stop-process.  That doesn't work; mev receives the signal fine but
+;; is not really stopped: instead it returns from
+;; kill(getpid(), SIGTSTP) immediately.  I don't understand what's up
+;; itz Tue Mar 24 14:27:38 PST 1998. 
+
+(add-hook 'suspend-hook
+          (function (lambda ()
+                      (and t-mouse-process
+                           ;(stop-process t-mouse-process)
+                           (process-send-string
+                            t-mouse-process "push -enone -dall -Mnone\n")))))
+
+(add-hook 'suspend-resume-hook
+          (function (lambda ()
+                      (and t-mouse-process
+                           ;(continue-process t-mouse-process)
+                           (process-send-string t-mouse-process "pop\n")))))
+
+;;;###autoload
+(define-minor-mode t-mouse-mode
+  "Toggle t-mouse mode.
+With prefix arg, turn t-mouse mode on iff arg is positive.
+
+Turn it on to use emacs mouse commands, and off to use t-mouse commands."
+  nil " Mouse" nil :global t
+  (if t-mouse-mode
+      ;; Turn it on
+      (unless window-system
+        ;; Starts getting a stream of mouse events from an asynchronous process.
+        ;; Only works if Emacs is running on a virtual terminal without a window system.
+	(progn
+	 (setq mouse-position-function #'t-mouse-mouse-position-function)
+	 (let ((tty (t-mouse-tty))
+	       (process-connection-type t))
+	   (if (not (stringp tty))
+	       (error "Cannot find a virtual terminal."))
+	   (setq t-mouse-process 
+		 (start-process "t-mouse" nil
+				"mev" "-i" "-E" "-C" tty
+				(if t-mouse-swap-alt-keys
+				    "-M-leftAlt" "-M-rightAlt")
+				"-e-move"
+				"-dall" "-d-hard"
+				"-f")))
+	 (setq t-mouse-filter-accumulator "")
+	 (set-process-filter t-mouse-process 't-mouse-process-filter)
+; use commented line instead for emacs 21.4 onwards
+	 (process-kill-without-query t-mouse-process)))
+;	 (set-process-query-on-exit-flag t-mouse-process nil)))
+    ;; Turn it off
+    (setq mouse-position-function nil)
+    (delete-process t-mouse-process)
+    (setq t-mouse-process nil)))
+
+(provide 't-mouse)
+
+;; arch-tag: a63163b3-bfbe-4eb2-ab4f-201cd164b05d
+;;; t-mouse.el ends here
--- a/lisp/textmodes/org.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/textmodes/org.el	Fri Mar 03 07:48:46 2006 +0000
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <dominik at science dot uva dot nl>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/
-;; Version: 4.06
+;; Version: 4.07
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -81,6 +81,12 @@
 ;;
 ;; Changes since version 4.00:
 ;; ---------------------------
+;; Version 4.07
+;;    - Bug fixes.
+;;    - Leading stars in headlines can be hidden, so make the outline look
+;;      cleaner.
+;;    - Mouse-1 can be used to follow links.
+;;     
 ;; Version 4.06
 ;;    - HTML exporter treats targeted internal links.
 ;;    - Bug fixes.
@@ -130,7 +136,7 @@
 
 ;;; Customization variables
 
-(defvar org-version "4.06"
+(defvar org-version "4.07"
   "The version number of the file org.el.")
 (defun org-version ()
   (interactive)
@@ -794,6 +800,24 @@
   :group 'org-structure
   :type 'boolean)
 
+(defcustom org-hide-leading-stars nil
+  "Non-nil means, hide the first N-1 stars in a headline.
+This works by using the face `org-hide' for these stars.  This
+face is white for a light background, and black for a dark
+background.  You may have to customize the face `org-hide' to
+make this work.
+Changing the variable requires restart of Emacs to become effective."
+  :group 'org-structure
+  :type 'boolean)
+
+(defcustom org-odd-levels-only nil
+  "Non-nil means, skip even levels and only use odd levels for the outline.
+This has the effect that two stars are being added/taken away in
+promotion/demotion commands.  It also influences how levels are
+handled by the exporters."
+  :group 'org-structure
+  :type 'boolean)
+
 (defcustom org-adapt-indentation t
   "Non-nil means, adapt indentation when promoting and demoting.
 When this is set and the *entire* text in an entry is indented, the
@@ -1409,6 +1433,7 @@
   .title { text-align: center; }
   .todo, .deadline { color: red; }
   .done { color: green; }
+  .target { background-color: lavender; }
   pre {
 	border: 1pt solid #AEBDCC;
 	background-color: #F3F5F7;
@@ -1633,7 +1658,7 @@
 
 (defcustom org-export-html-with-timestamp nil
   "If non-nil, write `org-export-html-html-helper-timestamp'
-into the exported html text.  Otherwise, the buffer will just be saved
+into the exported HTML text.  Otherwise, the buffer will just be saved
 to a file."
   :group 'org-export
   :type 'boolean)
@@ -1651,7 +1676,7 @@
   :type 'boolean)
 
 (defcustom org-export-html-show-new-buffer nil
-  "Non-nil means, popup buffer containing the exported HTML text.
+  "Non-nil means, popup buffer containing the exported html text.
 Otherwise, the buffer will just be saved to a file and stay hidden."
   :group 'org-export
   :type 'boolean)
@@ -1677,6 +1702,16 @@
   :tag "Org Faces"
   :group 'org)
 
+(defface org-hide
+  '((((type tty) (class color)) (:foreground "blue" :weight bold))
+    (((class color) (background light)) (:foreground "white"))
+    (((class color) (background dark)) (:foreground "black"))
+;    (((class color) (background light)) (:foreground "grey90"))
+;    (((class color) (background dark)) (:foreground "grey10"))
+    (t (:inverse-video nil)))
+  "Face used for level 1 headlines."
+  :group 'org-faces)
+
 (defface org-level-1 ;; font-lock-function-name-face
   '((((type tty) (class color)) (:foreground "blue" :weight bold))
     (((class color) (background light)) (:foreground "Blue"))
@@ -1844,17 +1879,25 @@
   "Face used for time grids."
   :group 'org-faces)
 
-(defvar org-level-faces
-  '(
-    org-level-1
-    org-level-2
-    org-level-3
-    org-level-4
-    org-level-5
-    org-level-6
-    org-level-7
-    org-level-8
-    ))
+(defvar org-level-faces nil)
+
+(when (not org-level-faces)
+  (setq org-level-faces
+	'(
+	  org-level-1
+	  org-level-2
+	  org-level-3
+	  org-level-4
+	  org-level-5
+	  org-level-6
+	  org-level-7
+	  org-level-8
+	  ))
+  (when org-odd-levels-only
+    (setq org-level-faces (apply 'append (mapcar (lambda (x) (list x x))
+						 org-level-faces)))
+    (setq org-level-faces (append (cdr org-level-faces) (list 'org-level-1)))))
+
 (defvar org-n-levels (length org-level-faces))
 
 (defun org-set-regexps-and-options ()
@@ -1985,7 +2028,6 @@
   (defvar remember-data-file)
   (defvar last-arg))
 
-
 ;;; Define the mode
 
 (defvar org-mode-map (copy-keymap outline-mode-map)
@@ -2000,7 +2042,7 @@
 (defvar org-table-may-need-update t
   "Indicates that a table might need an update.
 This variable is set by `org-before-change-function'.
-`org-table-align'sets it back to nil.")
+`org-table-align' sets it back to nil.")
 (defvar org-mode-hook nil)
 (defvar org-inhibit-startup nil)        ; Dynamically-scoped param.
 (defvar org-agenda-keep-modes nil)      ; Dynamically-scoped param.
@@ -2090,6 +2132,7 @@
   (if org-xemacs-p [button2] [mouse-2]) 'org-open-at-mouse)
 (define-key org-mouse-map
   (if org-xemacs-p [button3] [mouse-3]) 'org-find-file-at-mouse)
+(define-key org-mouse-map [follow-link] 'mouse-face)
 (when org-tab-follows-link
   (define-key org-mouse-map [(tab)] 'org-open-at-point)
   (define-key org-mouse-map "\C-i" 'org-open-at-point))
@@ -2200,7 +2243,10 @@
     (save-excursion
       (goto-char (point-min))
       (while (re-search-forward re nil t)
-	(add-to-list 'rtn (downcase (match-string-no-properties 1))))
+	(add-to-list 'rtn (downcase
+                           (if (fboundp 'match-string-no-properties)
+                               (match-string-no-properties 1)
+                             (match-string 1)))))
       rtn)))
 
 (defun org-make-target-link-regexp (targets)
@@ -2274,8 +2320,6 @@
 	  ;; (3 'italic))
 	  ;; '("\\(\\s-\\|^\\)\\(_\\([a-zA-Z]+\\)_\\)\\([^a-zA-Z*]\\|$\\)"
 	  ;; (3 'underline))
-;	  (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string "\\)\\>")
-;		'(1 'org-warning t))
 	  (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string
 			"\\|" org-quote-string "\\)\\>")
 		'(1 'org-special-keyword t))
@@ -2290,24 +2334,25 @@
 	  '("^[ \t]*\\(:.*\\)" (1 'org-table t))
 	  '("| *\\(:?=[^|\n]*\\)" (1 'org-formula t))
 	  '("^[ \t]*| *\\([#!$*_^]\\) *|" (1 'org-formula t))
-	  )))
+	  ))
+	(exp
+	 ;; The font-lock expression for headlines is complicated.  It depends
+	 ;; on two user options, and it needs to determine the level in
+	 ;; order to compute the level.
+	 (cond
+	  ((and org-level-color-stars-only (not org-hide-leading-stars))
+	   '("^\\(\\*+\\).*" 1 (nth (% (- (match-end 1) (match-beginning 1) 1) org-n-levels) org-level-faces) nil t))
+	  ((and (not org-level-color-stars-only) org-hide-leading-stars)
+	   '("^\\(\\**\\)\\(\\*.*\\)" (1 'org-hide) (2 (nth (% (- (match-end 1) (match-beginning 1)) org-n-levels) org-level-faces) nil t)))
+	  ((and org-level-color-stars-only org-hide-leading-stars)
+	   '("^\\(\\**\\)\\(\\*\\).*" (1 'org-hide) (2 (nth (% (- (match-end 1) (match-beginning 1)) org-n-levels) org-level-faces) nil t)))
+	  (t
+	   '("^\\(\\*+\\).*" 0 (nth (% (- (match-end 1) (match-beginning 1) 1) org-n-levels) org-level-faces) nil t)))))
+    
+    ;; Now set the full font-lock-keywords
     (set (make-local-variable 'org-font-lock-keywords)
 	 (append
-	  (if org-noutline-p     ; FIXME:  I am not sure if eval will work
-				 ; on XEmacs if noutline is ever ported
-	      `((eval . (list "^\\(\\*+\\).*"
-			      ,(if org-level-color-stars-only 1 0)
-			      '(nth
-				  (% (- (match-end 1) (match-beginning 1) 1)
-				     org-n-levels)
-				  org-level-faces)
-			      nil t)))
-	    `(("^\\(\\(\\*+\\)[^\r\n]*\\)[\n\r]"
-	       (,(if org-level-color-stars-only 2 0)
-	        (nth (% (- (match-end 2) (match-beginning 2) 1)
-			org-n-levels)
-		     org-level-faces)
-		nil t))))
+	  (if org-xemacs-p (list exp) (list (cons 'eval (list 'quote exp))))
 	  org-font-lock-extra-keywords))
     (set (make-local-variable 'font-lock-defaults)
 	 '(org-font-lock-keywords t nil nil backward-paragraph))
@@ -2731,19 +2776,32 @@
        (equal (char-before) ?*)
        (forward-char 1)))
 
+(defun org-get-legal-level (level change)
+  "Rectify a level change under the influence of `org-odd-levels-only'
+LEVEL is a current level, CHANGE is by how much the level should be
+modified.  Even if CHANGE is nil, LEVEL may be returned modified because
+even level numbers will become the next higher odd number."
+  (if org-odd-levels-only
+      (cond ((not change) (1+ (* 2 (/ level 2))))
+	    ((> change 0) (1+ (* 2 (/ (+ level (* 2 change)) 2))))
+	    ((< change 0) (max 1 (1+ (* 2 (/ (+ level (* 2 change)) 2))))))
+    (max 1 (+ level change))))
+
 (defun org-promote ()
   "Promote the current heading higher up the tree.
 If the region is active in `transient-mark-mode', promote all headings
 in the region."
   (org-back-to-heading t)
   (let* ((level (save-match-data (funcall outline-level)))
-	 (up-head (make-string (1- level) ?*)))
+	 (up-head (make-string (org-get-legal-level level -1) ?*))
+	 (diff (abs (- level (length up-head)))))
     (if (= level 1) (error "Cannot promote to level 0. UNDO to recover"))
     (replace-match up-head nil t)
     ;; Fixup tag positioning
     (and org-auto-align-tags (org-set-tags nil t))
     (if org-adapt-indentation
-	(org-fixup-indentation "^ " "" "^ ?\\S-"))))
+	(org-fixup-indentation (if (> diff 1) "^  " "^ ") ""
+			       (if (> diff 1) "^ ? ?\\S-" "^ ?\\S-")))))
 
 (defun org-demote ()
   "Demote the current heading lower down the tree.
@@ -2751,12 +2809,13 @@
 in the region."
   (org-back-to-heading t)
   (let* ((level (save-match-data (funcall outline-level)))
-	 (down-head (make-string (1+ level) ?*)))
+	 (down-head (make-string (org-get-legal-level level 1) ?*))
+	 (diff (abs (- level (length down-head)))))
     (replace-match down-head nil t)
     ;; Fixup tag positioning
     (and org-auto-align-tags (org-set-tags nil t))
     (if org-adapt-indentation
-	(org-fixup-indentation "^ " "  " "^\\S-"))))
+	(org-fixup-indentation "^ " (if (> diff 1) "   " "  ") "^\\S-"))))
 
 (defun org-map-tree (fun)
   "Call FUN for every heading underneath the current one."
@@ -2885,6 +2944,7 @@
 	       (if cut "Cut" "Copied")
 	       (length org-subtree-clip)))))
 
+;; FIXME: this needs to be adapted for the odd-level-only stuff.
 (defun org-paste-subtree (&optional level tree)
   "Paste the clipboard as a subtree, with modification of headline level.
 The entire subtree is promoted or demoted in order to match a new headline
@@ -2945,6 +3005,7 @@
 	 (shift1 shift)
 	 (delta (if (> shift 0) -1 1))
 	 (func (if (> shift 0) 'org-demote 'org-promote))
+	 (org-odd-levels-only nil)
 	 beg end)
     ;; Remove the forces level indicator
     (if force-level
@@ -3827,6 +3888,7 @@
 enter a time, and this function will inform the calling routine about
 this change.  The calling routine may then choose to change the format
 used to insert the time stamp into the buffer to include the time."
+  (require 'parse-time)
   (let* ((default-time
 	   ;; Default time is either today, or, when entering a range,
 	   ;; the range start.
@@ -4348,7 +4410,7 @@
   (if org-xemacs-p [(button2)] [(mouse-2)]) 'org-agenda-goto-mouse)
 (define-key org-agenda-keymap
   (if org-xemacs-p [(button3)] [(mouse-3)]) 'org-agenda-show-mouse)
-
+(define-key org-agenda-keymap [follow-link] 'mouse-face)
 (easy-menu-define org-agenda-menu org-agenda-mode-map "Agenda menu"
   '("Agenda"
     ("Agenda Files")
@@ -6625,10 +6687,11 @@
 		(completing-read "Tags: " 'org-tags-completion-function
 				 nil nil current 'org-tags-history)))
 	(while (string-match "[-+&]+" tags)
-	  (setq tags (replace-match ":" t t tags)))
-	(unless (setq empty (string-match "\\`[\t ]*\\'" tags))
-	  (unless (string-match ":$" tags) (setq tags (concat tags ":")))
-	  (unless (string-match "^:" tags) (setq tags (concat ":" tags)))))
+	  (setq tags (replace-match ":" t t tags))))
+      ;; FIXME: still optimize this byt not checking when JUST-ALIGN?
+      (unless (setq empty (string-match "\\`[\t ]*\\'" tags))
+	(unless (string-match ":$" tags) (setq tags (concat tags ":")))
+	(unless (string-match "^:" tags) (setq tags (concat ":" tags))))
       (if (equal current "")
 	  (progn
 	    (end-of-line 1)
@@ -7192,8 +7255,8 @@
       (mh-show-buffer-message-number))))
 
 (defun org-mhe-get-header (header)
-  "Return a header of the message in folder mode.  This will create a
-show buffer for the corresponding message.  If you have a more clever
+  "Return a header of the message in folder mode. This will create a
+show buffer for the corresponding message. If you have a more clever
 idea..."
   (let* ((folder (org-mhe-get-message-folder))
          (num (org-mhe-get-message-num))
@@ -10454,10 +10517,11 @@
       (erase-buffer)
       (insert string)
       (org-mode)
-      ;; Find targets in comments and move them out of comments
+      ;; Find targets in comments and move them out of comments,
+      ;; but mark them as targets that should be invisible
       (goto-char (point-min))
       (while (re-search-forward "^#.*?\\(<<<?[^>\r\n]+>>>?\\).*" nil t)
-	(replace-match "\\1"))
+	(replace-match "\\1(INVISIBLE)"))
       ;; Find matches for radio targets and turn them into links
       (goto-char (point-min))
       (while (re-search-forward re-radio nil t)
@@ -10475,12 +10539,34 @@
     (kill-buffer " org-mode-tmp")
     rtn))
 
-(defun org-solidify-link-text (s)
+(defun org-solidify-link-text (s &optional alist)
   "Take link text and make a safe target out of it."
   (save-match-data
-    (mapconcat
-     'identity
-     (org-split-string s "[ \t\r\n]+") "--")))
+    (let* ((rtn
+	    (mapconcat
+	     'identity
+	     (org-split-string s "[ \t\r\n]+") "--"))
+	   (a (assoc rtn alist)))
+      (or (cdr a) rtn))))
+
+(defun org-convert-to-odd-levels ()
+  "Convert an org-mode file with all levels allowed to one with odd levels.
+This will leave level 1 alone, convert level 2 to level 3, level 3 to
+level 5 etc."
+  (interactive)
+  (when (yes-or-no-p "Are you sure you want to globally change levels? ")
+    (let ((org-odd-levels-only nil) n)
+      (save-excursion
+	(goto-char (point-min))
+	(while (re-search-forward "^\\*\\*+" nil t)
+	  (setq n (1- (length (match-string 0))))
+	  (while (>= (setq n (1- n)) 0)
+	    (org-demote))
+	  (end-of-line 1))))))
+
+(defun org-tr-level (n)
+  "Make N odd if required."
+  (if org-odd-levels-only (1+ (/ n 2)) n))
 
 (defvar org-last-level nil) ; dynamically scoped variable
 
@@ -10561,6 +10647,7 @@
 			 ;; This is a headline
 			 (progn
 			   (setq level (- (match-end 1) (match-beginning 1))
+				 level (org-tr-level level)
 				 txt (match-string 3 line)
 				 todo
 				 (or (and (match-beginning 2)
@@ -10599,7 +10686,7 @@
       (cond
        ((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line)
 	;; a Headline
-	(setq level (- (match-end 1) (match-beginning 1))
+	(setq level (org-tr-level (- (match-end 1) (match-beginning 1)))
 	      txt (match-string 2 line))
 	(org-ascii-level-start level txt umax))
        (t (insert line "\n"))))
@@ -10860,6 +10947,7 @@
          (language    org-export-default-language)
 	 (text        nil)
          (lang-words  nil)
+	 (target-alist nil) tg
 	 (head-count  0) cnt
 	 (start       0)
 	 ;; FIXME: The following returns always nil under XEmacs
@@ -10923,11 +11011,13 @@
 	  (progn
 	    (insert (format "<H2>%s</H2>\n" (nth 3 lang-words)))
 	    (insert "<ul>\n")
+	    (setq lines
 	    (mapcar '(lambda (line)
 		       (if (string-match org-todo-line-regexp line)
 			   ;; This is a headline
 			   (progn
 			     (setq level (- (match-end 1) (match-beginning 1))
+				   level (org-tr-level level)
 				   txt (save-match-data
 					 (org-html-expand
 					  (match-string 3 line)))
@@ -10957,15 +11047,28 @@
 					 (while (>= (setq cnt (1- cnt)) 0)
 					   (insert "</ul>"))
 					 (insert "\n")))
+				   ;; Check for targets
+				   (while (string-match org-target-regexp line)
+				     (setq tg (match-string 1 line)
+					   line (replace-match
+						 (concat "@<span class=\"target\">" tg "@</span> ")
+						 t t line))
+				     (push (cons (org-solidify-link-text tg)
+						 (format "sec-%d" head-count))
+					   target-alist))
+				   (while (string-match "&lt;\\(&lt;\\)+\\|&gt;\\(&gt;\\)+" txt)
+				     (setq txt (replace-match "" t t txt)))
 				   (insert
 				    (format
 				     (if todo
 					 "<li><a href=\"#sec-%d\"><span class=\"todo\">%s</span></a>\n"
 				       "<li><a href=\"#sec-%d\">%s</a>\n")
 				     head-count txt))
+
 				   (setq org-last-level level))
-			       ))))
-		    lines)
+			       )))
+		       line)
+		    lines))
 	    (while (> org-last-level 0)
 	      (setq org-last-level (1- org-last-level))
 	      (insert "</ul>\n"))
@@ -11001,18 +11104,31 @@
 
 
 	  ;; make targets to anchors
-	  (while (string-match "<<<?\\([^<>]*\\)>>>?[ \t]*\n?" line)
-	    (setq line (replace-match
-			(concat "@<a name=\""
-				(org-solidify-link-text (match-string 1 line))
-				"\">\\nbsp@</a>")
-			t t line)))
+	  (while (string-match "<<<?\\([^<>]*\\)>>>?\\((INVISIBLE)\\)?[ \t]*\n?" line)
+	    (cond
+	     ((match-end 2)
+	      (setq line (replace-match
+			  (concat "@<a name=\"" 
+				  (org-solidify-link-text (match-string 1 line))
+				  "\">\\nbsp@</a>")
+			  t t line)))
+	     ((and org-export-with-toc (equal (string-to-char line) ?*))
+	      (setq line (replace-match
+			  (concat "@<span class=\"target\">" (match-string 1 line) "@</span> ")
+;			  (concat "@<i>" (match-string 1 line) "@</i> ")
+			  t t line)))
+	     (t
+	      (setq line (replace-match
+			  (concat "@<a name=\"" 
+				  (org-solidify-link-text (match-string 1 line))
+				  "\" class=\"target\">" (match-string 1 line) "@</a> ")
+			  t t line)))))	      
 	  ;; Replace internal links
 	  (while (string-match org-bracket-link-regexp line)
 	    (setq line (replace-match
 			(concat
 			    "@<a href=\"#"
-			    (org-solidify-link-text (match-string 1 line))
+			    (org-solidify-link-text (match-string 1 line) target-alist)
 			    "\">"
 			    (match-string (if (match-end 3) 3 1) line)
 			    "@</a>")
@@ -11087,7 +11203,7 @@
 	  (cond
 	   ((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line)
 	    ;; This is a headline
-	    (setq level (- (match-end 1) (match-beginning 1))
+	    (setq level (org-tr-level (- (match-end 1) (match-beginning 1)))
 		  txt (match-string 2 line))
 	    (if (<= level umax) (setq head-count (+ head-count 1)))
 	    (when in-local-list
@@ -11822,6 +11938,7 @@
 (define-key org-mode-map "\C-c\C-xb"      'org-export-as-html-and-open)
 (define-key org-mode-map "\C-c\C-x\C-b"   'org-export-as-html-and-open)
 
+(define-key org-mode-map "\C-c\C-x\C-k"   'org-cut-special)
 (define-key org-mode-map "\C-c\C-x\C-w"   'org-cut-special)
 (define-key org-mode-map "\C-c\C-x\M-w"   'org-copy-special)
 (define-key org-mode-map "\C-c\C-x\C-y"   'org-paste-special)
@@ -12244,7 +12361,9 @@
      ["Demote Heading"  org-metaright (not (org-at-table-p))]
      ["Demote Subtree"  org-shiftmetaright (not (org-at-table-p))]
      "--"
-     ["Archive Subtree" org-archive-subtree t])
+     ["Archive Subtree" org-archive-subtree t]
+     "--"
+     ["Convert file to odd levels" org-convert-to-odd-levels t])
     "--"
     ("TODO Lists"
      ["TODO/DONE/-" org-todo t]
--- a/lisp/textmodes/reftex-index.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/textmodes/reftex-index.el	Fri Mar 03 07:48:46 2006 +0000
@@ -1034,6 +1034,7 @@
 ;; Index map
 (define-key reftex-index-map (if (featurep 'xemacs) [(button2)] [(mouse-2)])
   'reftex-index-mouse-goto-line-and-hide)
+(define-key reftex-index-map [follow-link] 'mouse-face)
 
 (substitute-key-definition
  'next-line 'reftex-index-next reftex-index-map global-map)
--- a/lisp/textmodes/reftex-sel.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/textmodes/reftex-sel.el	Fri Mar 03 07:48:46 2006 +0000
@@ -685,7 +685,9 @@
   ;; The mouse-2 binding
   (if (featurep 'xemacs)
       (define-key map [(button2)] 'reftex-select-mouse-accept)
-    (define-key map [(mouse-2)] 'reftex-select-mouse-accept))
+    (define-key map [(mouse-2)] 'reftex-select-mouse-accept)
+    (define-key map [follow-link] 'mouse-face))
+    
 
   ;; Digit arguments
   (loop for key across "0123456789" do
--- a/lisp/textmodes/reftex-toc.el	Fri Mar 03 05:16:17 2006 +0000
+++ b/lisp/textmodes/reftex-toc.el	Fri Mar 03 07:48:46 2006 +0000
@@ -1011,6 +1011,7 @@
 ;; Table of Contents map
 (define-key reftex-toc-map (if (featurep 'xemacs) [(button2)] [(mouse-2)])
   'reftex-toc-mouse-goto-line-and-hide)
+(define-key reftex-toc-map [follow-link] 'mouse-face)
 
 (substitute-key-definition
  'next-line 'reftex-toc-next reftex-toc-map global-map)
--- a/lispref/ChangeLog	Fri Mar 03 05:16:17 2006 +0000
+++ b/lispref/ChangeLog	Fri Mar 03 07:48:46 2006 +0000
@@ -1,3 +1,26 @@
+2006-03-02  Kim F. Storm  <storm@cua.dk>
+
+	* keymaps.texi (Tool Bar): Add tool-bar-border.
+
+2006-02-28  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* loading.texi (Load Suffixes): Rephrase last paragraph.  Fix typos.
+
+2006-02-27  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* elisp.texi (Top): Include "Load Suffixes" in the detailed menu.
+
+	* files.texi (Locating Files): Suggest additional values for the
+	SUFFIXES arg of `locate-file'.  Update pxref.
+
+	* loading.texi (Loading): Include new node "Load Suffixes" in menu.
+	(How Programs Do Loading): Discuss the effects of Auto Compression
+	mode on `load'.
+	(Load Suffixes): New node.
+	(Library Search): Delete description of `load-suffixes'; it was
+	moved to "Load Suffixes".
+	(Autoload, Named Features): Mention `load-suffixes'.
+
 2006-02-21  Giorgos Keramidas  <keramida@ceid.upatras.gr>  (tiny change)
 
 	* display.texi (Fringe Indicators, Fringe Cursors): Fix typos.
--- a/lispref/elisp.texi	Fri Mar 03 05:16:17 2006 +0000
+++ b/lispref/elisp.texi	Fri Mar 03 07:48:46 2006 +0000
@@ -78,7 +78,7 @@
 
 @ifnottex
 @node Top, Introduction, (dir), (dir)
-@top Emacs Lisp 
+@top Emacs Lisp
 
 This Info file contains edition @value{VERSION} of the GNU Emacs Lisp
 Reference Manual, corresponding to GNU Emacs version @value{EMACSVER}.
@@ -438,6 +438,7 @@
 Loading
 
 * How Programs Do Loading:: The @code{load} function and others.
+* Load Suffixes::           Details about the suffixes that @code{load} tries.
 * Library Search::          Finding a library to load.
 * Loading Non-ASCII::       Non-@acronym{ASCII} characters in Emacs Lisp files.
 * Autoload::                Setting up a function to autoload.
--- a/lispref/files.texi	Fri Mar 03 05:16:17 2006 +0000
+++ b/lispref/files.texi	Fri Mar 03 07:48:46 2006 +0000
@@ -1283,8 +1283,9 @@
 suffixes.  If @var{suffixes} is @code{nil}, or @code{("")}, then there
 are no suffixes, and @var{filename} is used only as-is.  Typical
 values of @var{suffixes} are @code{exec-suffixes} (@pxref{Subprocess
-Creation, exec-suffixes}) and @code{load-suffixes} (@pxref{Library
-Search, load-suffixes}).
+Creation, exec-suffixes}), @code{load-suffixes},
+@code{load-file-rep-suffixes} and the return value of the function
+@code{get-load-suffixes} (@pxref{Load Suffixes}).
 
 Typical values for @var{path} are @code{exec-path} (@pxref{Subprocess
 Creation, exec-path}) when looking for executable programs or
--- a/lispref/keymaps.texi	Fri Mar 03 05:16:17 2006 +0000
+++ b/lispref/keymaps.texi	Fri Mar 03 07:48:46 2006 +0000
@@ -2498,6 +2498,15 @@
 The value is an integer, a number of pixels.  The default is 1.
 @end defvar
 
+@tindex tool-bar-border
+@defvar tool-bar-border
+This variable specifies the height of the border drawn below the tool
+bar area.  An integer value specifies height as a number of pixels.
+If the value is one of @code{internal-border-width} (the default) or
+@code{border-width}, the tool bar border height corresponds to the
+corresponding frame parameter.
+@end defvar
+
   You can define a special meaning for clicking on a tool bar item with
 the shift, control, meta, etc., modifiers.  You do this by setting up
 additional items that relate to the original item through the fake
--- a/lispref/loading.texi	Fri Mar 03 05:16:17 2006 +0000
+++ b/lispref/loading.texi	Fri Mar 03 07:48:46 2006 +0000
@@ -36,6 +36,7 @@
 
 @menu
 * How Programs Do Loading:: The @code{load} function and others.
+* Load Suffixes::           Details about the suffixes that @code{load} tries.
 * Library Search::          Finding a library to load.
 * Loading Non-ASCII::       Non-@acronym{ASCII} characters in Emacs Lisp files.
 * Autoload::                Setting up a function to autoload.
@@ -72,17 +73,27 @@
 @var{filename}.  In the perverse case of a file named @file{foo.el.el},
 evaluation of @code{(load "foo.el")} will indeed find it.)
 
-If the optional argument @var{nosuffix} is non-@code{nil}, then the
-suffixes @samp{.elc} and @samp{.el} are not tried.  In this case, you
-must specify the precise file name you want.  By specifying the precise
-file name and using @code{t} for @var{nosuffix}, you can prevent
-perverse file names such as @file{foo.el.el} from being tried.
+If Auto Compression mode is enabled, as it is by default, then
+if @code{load} can not find a file, it searches for a compressed
+version of the file before trying other file names.  It decompresses
+and loads it if it exists.  It looks for compressed versions by
+appending the suffixes in @code{jka-compr-load-suffixes} to the file
+name.  The value of this variable must be a list of strings. Its
+standard value is @code{(".gz")}.
+
+If the optional argument @var{nosuffix} is non-@code{nil}, then
+@code{load} does not try the suffixes @samp{.elc} and @samp{.el}.  In
+this case, you must specify the precise file name you want, except
+that, if Auto Compression mode is enabled, @code{load} will still use
+@code{jka-compr-load-suffixes} to find compressed versions.  By
+specifying the precise file name and using @code{t} for
+@var{nosuffix}, you can prevent perverse file names such as
+@file{foo.el.el} from being tried.
 
 If the optional argument @var{must-suffix} is non-@code{nil}, then
 @code{load} insists that the file name used must end in either
-@samp{.el} or @samp{.elc}, unless it contains an explicit directory
-name.  If @var{filename} does not contain an explicit directory name,
-and does not end in a suffix, then @code{load} insists on adding one.
+@samp{.el} or @samp{.elc} (possibly extended with a compression
+suffix), unless it contains an explicit directory name.
 
 If @var{filename} is a relative file name, such as @file{foo} or
 @file{baz/foo.bar}, @code{load} searches for the file using the variable
@@ -127,8 +138,10 @@
 @deffn Command load-file filename
 This command loads the file @var{filename}.  If @var{filename} is a
 relative file name, then the current default directory is assumed.
-@code{load-path} is not used, and suffixes are not appended.  Use this
-command if you wish to specify precisely the file name to load.
+This command does not use @code{load-path}, and does not append
+suffixes.  However, it does look for compressed versions (if Auto
+Compression Mode is enabled).  Use this command if you wish to specify
+precisely the file name to load.
 @end deffn
 
 @deffn Command load-library library
@@ -158,6 +171,52 @@
   For information about how @code{load} is used in building Emacs, see
 @ref{Building Emacs}.
 
+@node Load Suffixes
+@section Load Suffixes
+We now describe some technical details about the exact suffixes that
+@code{load} tries.
+
+@defvar load-suffixes
+This is a list of suffixes indicating (compiled or source) Emacs Lisp
+files.  It should not include the empty string.  @code{load} uses
+these suffixes in order when it appends Lisp suffixes to the specified
+file name.  The standard value is @code{(".elc" ".el")} which produces
+the behavior described in the previous section.
+@end defvar
+
+@defvar load-file-rep-suffixes
+This is a list of suffixes that indicate representations of the same
+file.  This list should normally start with the empty string.
+When @code{load} searches for a file it appends the suffixes in this
+list, in order, to the file name, before searching for another file.
+
+Enabling Auto Compression mode appends the suffixes in
+@code{jka-compr-load-suffixes} to this list and disabling Auto
+Compression mode removes them again.  The standard value of
+@code{load-file-rep-suffixes} if Auto Compression mode is disabled is
+@code{("")}.  Given that the standard value of
+@code{jka-compr-load-suffixes} is @code{(".gz")}, the standard value
+of @code{load-file-rep-suffixes} if Auto Compression mode is enabled
+is @code{("" ".gz")}.
+@end defvar
+
+@defun get-load-suffixes
+This function returns the list of all suffixes that @code{load} should
+try, in order, when its @var{must-suffix} argument is non-@code{nil}.
+This takes both @code{load-suffixes} and @code{load-file-rep-suffixes}
+into account.  If @code{load-suffixes}, @code{jka-compr-load-suffixes}
+and @code{load-file-rep-suffixes} all have their standard values, this
+function returns @code{(".elc" ".elc.gz" ".el" ".el.gz")} if Auto
+Compression mode is enabled and @code{(".elc" ".el")} if Auto
+Compression mode is disabled.
+@end defun
+
+To summarize, @code{load} normally first tries the suffixes in the
+value of @code{(get-load-suffixes)} and then those in
+@code{load-file-rep-suffixes}.  If @var{nosuffix} is non-@code{nil},
+it skips the former group, and if @var{must-suffix} is non-@code{nil},
+it skips the latter group.
+
 @node Library Search
 @section Library Search
 
@@ -288,13 +347,6 @@
 tells @code{locate-library} to display the file name in the echo area.
 @end deffn
 
-@defvar load-suffixes
-This variable is a list of suffixes (strings) that @code{load} should
-try adding to the specified file name.  The default value is
-@code{(".elc" ".elc.gz" ".el" ".el.gz" ".gz")}.  There is no need to
-include the null suffix.
-@end defvar
-
 @node Loading Non-ASCII
 @section Loading Non-@acronym{ASCII} Characters
 
@@ -362,7 +414,8 @@
 If @var{filename} does not contain either a directory name, or the
 suffix @code{.el} or @code{.elc}, then @code{autoload} insists on adding
 one of these suffixes, and it will not load from a file whose name is
-just @var{filename} with no added suffix.
+just @var{filename} with no added suffix.  (The variable
+@code{load-suffixes} specifies the exact required suffixes.)
 
 The argument @var{docstring} is the documentation string for the
 function.  Specifying the documentation string in the call to
@@ -699,8 +752,10 @@
 with @code{load}.  If @var{filename} is not supplied, then the name of
 the symbol @var{feature} is used as the base file name to load.
 However, in this case, @code{require} insists on finding @var{feature}
-with an added suffix; a file whose name is just @var{feature} won't be
-used.
+with an added @samp{.el} or @samp{.elc} suffix (possibly extended with
+a compression suffix); a file whose name is just @var{feature} won't
+be used.  (The variable @code{load-suffixes} specifies the exact
+required Lisp suffixes.)
 
 If @var{noerror} is non-@code{nil}, that suppresses errors from actual
 loading of the file.  In that case, @code{require} returns @code{nil}
--- a/man/ChangeLog	Fri Mar 03 05:16:17 2006 +0000
+++ b/man/ChangeLog	Fri Mar 03 07:48:46 2006 +0000
@@ -1,3 +1,22 @@
+2006-03-01  Carsten Dominik  <dominik@science.uva.nl>
+
+	* org.texi: (Interaction): Added item about `org-mouse.el' by
+	Piotr Zielinski.
+	(Managing links): Documented that also mouse-1 can be used to
+	activate a link.
+	(Headlines, FAQ): Added entry about hiding leading stars.
+	(Miscellaneous): Resorted the sections in this chapter to a more
+	logical sequence.
+
+2006-02-28  Andre Spiegel  <spiegel@gnu.org>
+
+	* files.texi (Old Versions): Clarify operation of C-x v =.
+
+2006-02-27  Simon Josefsson  <jas@extundo.com>
+
+	* emacs-mime.texi (Flowed text): Add mm-fill-flowed.  (Sync
+	2004-01-27 from the trunk).
+
 2006-02-24  Alan Mackenzie  <bug-cc-mode@gnu.org>
 
 	* cc-mode.texi: Rename c-hungry-backspace to
--- a/man/emacs-mime.texi	Fri Mar 03 05:16:17 2006 +0000
+++ b/man/emacs-mime.texi	Fri Mar 03 07:48:46 2006 +0000
@@ -983,7 +983,11 @@
 @code{fill-flowed-display-column}.  The default is to wrap after
 @code{fill-column}.
 
-
+@table @code
+@item mm-fill-flowed
+@vindex mm-fill-flowed
+If non-@code{nil} a format=flowed article will be displayed flowed.
+@end table
 
 
 @node Interface Functions
--- a/man/files.texi	Fri Mar 03 05:16:17 2006 +0000
+++ b/man/files.texi	Fri Mar 03 07:48:46 2006 +0000
@@ -1661,11 +1661,11 @@
 the options in @code{vc-rcs-diff-switches}.  The
 @samp{vc@dots{}diff-switches} variables are @code{nil} by default.
 
-  Unlike the @kbd{M-x diff} command, @kbd{C-x v =} does not try to
-locate the changes in the old and new versions.  This is because
-normally one or both versions do not exist as files when you compare
-them; they exist only in the records of the master file.
-@xref{Comparing Files}, for more information about @kbd{M-x diff}.
+  The buffer produced by @kbd{C-x v =} supports the commands of
+Compilation mode (@pxref{Compilation Mode}), such as @kbd{C-x `} and
+@kbd{C-c C-c}, in both the ``old'' and ``new'' text, and they always
+find the corresponding locations in the current work file.  (Older
+versions are not, in general, present as files on your disk.)
 
 @findex vc-annotate
 @kindex C-x v g
--- a/man/org.texi	Fri Mar 03 05:16:17 2006 +0000
+++ b/man/org.texi	Fri Mar 03 07:48:46 2006 +0000
@@ -4,8 +4,8 @@
 @setfilename ../info/org
 @settitle Org Mode Manual
 
-@set VERSION 4.06
-@set DATE February 2006
+@set VERSION 4.07
+@set DATE March 2006
 
 @dircategory Emacs
 @direntry
@@ -188,9 +188,10 @@
 
 * Completion::                  M-TAB knows what you need
 * Customization::               Adapting Org-mode to your taste
+* Clean view::                  Getting rid of leading stars in the outline
+* TTY keys::                    Using Org-mode on a tty
 * FAQ::                         Frequently asked questions
 * Interaction::                 Other Emacs packages
-* TTY keys::                    Using Org-mode on a tty
 * Bugs::                        Things which do not work perfectly
 * Acknowledgments::             These people provided feedback and more
 
@@ -378,6 +379,9 @@
     more text
 * Another top level headline
 @end example
+@noindent Some people find the many stars too noisy and would prefer an
+outline that has whitespace followed by a single star as headline
+starters.  @ref{Clean view} describes a setup to realize this.
 
 @node Visibility cycling, Motion, Headlines, Document Structure
 @section Visibility cycling
@@ -512,7 +516,9 @@
 @item M-S-@key{down}
 Move subtree down (swap with next subtree of same level)
 @kindex C-c C-x C-w
+@kindex C-c C-x C-k
 @item C-c C-x C-w
+@itemx C-c C-x C-k
 Kill subtree, i.e. remove it from buffer but save in kill ring.
 @kindex C-c C-x M-w
 @item C-c C-x M-w
@@ -627,7 +633,7 @@
 If you wish to implement a tag system to cross-correlate information,
 this can be done as well in Org-mode.  Every headline can contain a
 list of tags, at the end of the headline.  Tags are normal words
-containing letters and @samp{_}, but no numbers.  Tags must be
+containing letters, numbers, @samp{_}, and @samp{@@}.  Tags must be
 preceded and followed by a single colon; like @samp{:WORK:}.  Several
 tags can be specified like @samp{:WORK:URGENT:}.
 
@@ -709,16 +715,20 @@
 editing such lists, and the HTML exporter (@pxref{Exporting}) does
 parse and format them.
 
-Org-mode knows ordered and unordered lists.  Unordered list items
-start with @samp{-}, @samp{+}, or @samp{*}@footnote{When using
-@samp{*} as a bullet, lines must be indented or they will be seen as
-top-level headlines.} as bullets.  Ordered list items start with
-@samp{1.} or @samp{1)}.  Items belonging to the same list must have
-the same indentation on the first line.  In particular, if an ordered
-list reaches number @samp{10.}, also the 2--digit numbers must be
-written left-aligned with the other numbers in the list.  Indentation
-also determines the end of a list item.  It ends before the next line
-that is indented like the bullet/number, or less.  For example:
+Org-mode knows ordered and unordered lists.  Unordered list items start
+with @samp{-}, @samp{+}, or @samp{*}@footnote{When using @samp{*} as a
+bullet, lines must be indented or they will be seen as top-level
+headlines.  Also, when you are hiding leading stars to get a clean
+outline view, plain list items starting with a star are visually
+indistinguishable from true headlines.  In short: Even though @samp{*}
+is supported, it may be better to not use it for plain list items} as
+bullets.  Ordered list items start with @samp{1.} or @samp{1)}.  Items
+belonging to the same list must have the same indentation on the first
+line.  In particular, if an ordered list reaches number @samp{10.}, also
+the 2--digit numbers must be written left-aligned with the other numbers
+in the list.  Indentation also determines the end of a list item.  It
+ends before the next line that is indented like the bullet/number, or
+less.  For example:
 
 @example
 ** Lord of the Rings
@@ -1050,10 +1060,12 @@
 @cindex syntax, of formulas
 
 A formula can be any algebraic expression understood by the Emacs
-@file{calc} package.  Before evaluation by @code{calc-eval}
-(@pxref{Calling Calc from Your Lisp Programs,calc-eval,Calling calc
-from Your Lisp Programs,calc,GNU Emacs Calc Manual}), variable
-substitution takes place:
+@file{calc} package.  Note that @file{calc} has the slightly
+non-standard conversion that @samp{/} has lower precedence than
+@samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.  Before
+evaluation by @code{calc-eval} (@pxref{Calling Calc from Your Lisp
+Programs,calc-eval,Calling calc from Your Lisp Programs,calc,GNU Emacs
+Calc Manual}), variable substitution takes place:
 
 @example
   $        @r{refers to the current field}
@@ -1521,9 +1533,7 @@
 
 @cindex following links
 @kindex C-c C-o
-@kindex mouse-2
 @item C-c C-o
-@itemx mouse-2
 Open link at point.  This will launch a web browser for URLs (using
 @command{browse-url-at-point}), run vm/gnus/bbdb for the corresponding
 links, and execute the command in a shell link.  When the cursor is on
@@ -1542,8 +1552,11 @@
 shell link.
 
 @kindex mouse-2
+@kindex mouse-1
 @item mouse-2
-On links, @kbd{mouse-2} will open the link just like @kbd{C-c C-o} would.
+@itemx mouse-1
+On links, @kbd{mouse-2} will open the link just like @kbd{C-c C-o}
+would.  Under Emacs 22, also @kbd{mouse-1} will follow a link.
 
 @kindex mouse-3
 @item mouse-3
@@ -2487,10 +2500,13 @@
 Display original location and recenter that window.
 
 @kindex mouse-2
+@kindex mouse-1
 @kindex @key{TAB}
 @item mouse-2
+@itemx mouse-1
 @itemx @key{TAB}
-Go to the original location of the item in another window.
+Go to the original location of the item in another window.  Under Emacs
+22, also @kbd{mouse-1} will works for this.
 
 @kindex @key{RET}
 @itemx @key{RET}
@@ -2952,9 +2968,10 @@
 @menu
 * Completion::                  M-TAB knows what you need
 * Customization::               Adapting Org-mode to your taste
+* Clean view::                  Getting rid of leading stars in the outline
+* TTY keys::                    Using Org-mode on a tty
 * FAQ::                         Frequently asked questions
 * Interaction::                 Other Emacs packages
-* TTY keys::                    Using Org-mode on a tty
 * Bugs::                        Things which do not work perfectly
 * Acknowledgments::             These people provided feedback and more
 @end menu
@@ -3002,7 +3019,8 @@
 @end itemize
 @end table
 
-@node Customization, FAQ, Completion, Miscellaneous
+
+@node Customization, Clean view, Completion, Miscellaneous
 @section Customization
 @cindex customization
 @cindex options, for customization
@@ -3014,7 +3032,126 @@
 variables is available with @kbd{M-x org-customize}.  Or select
 @code{Browse Org Group} from the @code{Org->Customization} menu.
 
-@node FAQ, Interaction, Customization, Miscellaneous
+@node Clean view, TTY keys, Customization, Miscellaneous
+@section A cleaner outline view
+@cindex hiding leading stars
+@cindex clean outline view
+
+Some people find it noisy and distracting that the Org-mode headlines
+are starting with a potentially large number of stars.  For example in
+the example tree from @ref{Headlines}:
+
+@example
+* Top level headline
+** Second level
+*** 3rd level
+    some text
+*** 3rd level
+    more text
+* Another top level headline
+@end example
+
+@noindent
+Unfortunately this is deeply ingrained into the code of Org-mode and
+cannot be easily changed.  You can, however, modify the display in such
+a way that all leading stars become invisible and the outline more easy
+to read.  To do this, customize the variable
+@code{org-hide-leading-stars} like this:
+
+@lisp
+(setq org-hide-leading-stars t)
+@end lisp
+
+@noindent
+and restart emacs (this is necessary to make this change effective).
+The tree then becomes
+
+@example
+* Top level headline
+ * Second level
+  * 3rd level
+    some text
+  * 3rd level
+    more text
+* Another top level headline
+@end example
+
+@noindent
+Note that the leading stars are not truly replaced by whitespace, they
+are only fontified with the face @code{org-hide} that uses the
+background color as font color.  If are are not using either white or
+black background, you may have to customize this face to get the wanted
+effect.  Another possibility is to set this font such that the extra
+stars are @i{almost} invisible, for example using the color
+@code{grey90} on a white background.
+
+Things become cleaner still if you skip all the even levels and use only
+odd levels 1, 3, 5..., effectively adding two stars to go from one
+outline level to the next:
+
+@example
+* Top level headline
+  * Second level
+    * 3rd level
+      some text
+    * 3rd level
+      more text
+* Another top level headline
+@end example
+
+@noindent
+In order to make the structure editing and export commands handle this
+convention correctly, use (again a restart of emacs will be needed)
+
+@lisp
+(setq org-odd-levels-only t)
+@end lisp
+
+@noindent
+You can convert an Org-mode file from single-star-per-level to
+double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels
+RET} in that file.  It is not possible to use this setting on a
+file-local basis, so you need to decide which format to use.
+
+@node TTY keys, FAQ, Clean view, Miscellaneous
+@section Using org-mode on a tty
+@cindex tty keybindings
+
+Org-mode uses a number of keys that are not accessible on a tty.  This
+applies to most special keys like cursor keys, @key{TAB} and
+@key{RET}, when these are combined with modifier keys like @key{Meta}
+and/or @key{Shift}.  Org-mode uses these bindings because it needs to
+provide keys for a large number of commands, and because these keys
+appeared particularly easy to remember.  In order to still be able to
+access the core functionality of Org-mode on a tty, alternative
+bindings are provided.  Here is a complete list of these bindings,
+which are obviously more cumbersome to use.  Note that sometimes a
+work-around can be better.  For example changing a time stamp is
+really only fun with @kbd{S-@key{cursor}} keys.  On a tty you would
+rather use @kbd{C-c .}  to re-insert the timestamp.
+
+@page
+@multitable @columnfractions 0.15 0.2 0.2
+@item @b{Default} @tab @b{Alternative 1} @tab @b{Alternative 2}
+@item @kbd{S-@key{TAB}}     @tab @kbd{C-u @key{TAB}}       @tab
+@item @kbd{M-@key{left}}    @tab @kbd{C-c C-x l}           @tab @kbd{@key{Esc} @key{left}}
+@item @kbd{M-S-@key{left}}  @tab @kbd{C-c C-x L}           @tab
+@item @kbd{M-@key{right}}   @tab @kbd{C-c C-x r}           @tab @kbd{@key{Esc} @key{right}}
+@item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R}           @tab
+@item @kbd{M-@key{up}}      @tab @kbd{C-c C-x u}           @tab @kbd{@key{Esc} @key{up}}
+@item @kbd{M-S-@key{up}}    @tab @kbd{C-c C-x U}           @tab
+@item @kbd{M-@key{down}}    @tab @kbd{C-c C-x d}           @tab @kbd{@key{Esc} @key{down}}
+@item @kbd{M-S-@key{down}}  @tab @kbd{C-c C-x D}           @tab
+@item @kbd{S-@key{RET}}     @tab @kbd{C-c C-x c}           @tab
+@item @kbd{M-@key{RET}}     @tab @kbd{C-c C-x m}           @tab @kbd{@key{Esc} @key{RET}}
+@item @kbd{M-S-@key{RET}}   @tab @kbd{C-c C-x M}           @tab
+@item @kbd{S-@key{left}}    @tab @kbd{C-c C-x @key{left}}  @tab
+@item @kbd{S-@key{right}}   @tab @kbd{C-c C-x @key{right}} @tab
+@item @kbd{S-@key{up}}      @tab @kbd{C-c C-x @key{up}}    @tab
+@item @kbd{S-@key{down}}    @tab @kbd{C-c C-x @key{down}}  @tab
+@end multitable
+
+@node FAQ, Interaction, TTY keys, Miscellaneous
 @section Frequently asked questions
 @cindex FAQ
 
@@ -3026,6 +3163,11 @@
 (add-to-list 'auto-mode-alist '("README$" . org-mode))
 @end example
 
+@item @b{All these stars are driving me mad, I just find the Emacs
+outlines unreadable. Can't you just put white space and a single star as a
+starter for headlines?}@*
+See @ref{Clean view}.
+
 @item @b{I would like to have two windows on the same Org-mode
 file, but with different outline visibility.  Is that possible?}@*
 @cindex @code{make-indirect-buffer}
@@ -3138,15 +3280,23 @@
 @end enumerate
 
 
-@node Interaction, TTY keys, FAQ, Miscellaneous
+@node Interaction, Bugs, FAQ, Miscellaneous
 @section Interaction with other packages
 @cindex packages, interaction with other
 Org-mode can cooperate with the following packages:
 
 @table @asis
+@cindex @file{org-mouse.el}
+@item @file{org-mouse.el} by Piotr Zielinski
+This package implements extended mouse functionality for Org-mode.  It
+allows to cycle visibility and to edit the document structure with the
+mouse.  It also provides a context-sensitive menu that changes depending
+on the context of a mouse-click.  Use a search engine to find this
+package on the web.
 @cindex @file{table.el}
 @item @file{table.el} by Takaaki Ota
-Org mode cooperates with table.el, see @ref{table.el}.
+Org mode cooperates with table.el, see @ref{table.el}.  @file{table.el}
+is part of Emacs 22.
 @cindex @file{calc.el}
 @item @file{calc.el} by Dave Gillespie
 Org-mode uses the calc package for implementing spreadsheet
@@ -3189,6 +3339,7 @@
 @code{org-disputed-keys}.
 @item @file{remember.el} by John Wiegley
 Org mode cooperates with remember, see @ref{Remember}.
+@file{remember.el} is not part of Emacs, find it on the web.
 @cindex @file{planner.el}
 @item @file{planner.el} by John Wiegley
 Planner is another tool to plan work and keep track of tasks.  Planner
@@ -3197,48 +3348,11 @@
 display the agenda entries resulting from org files in day-pages of
 the planner.  This can be done through the diary of the calendar:
 Integrate org files into the diary as described above, and then turn
-on the diary support of planner.
+on the diary support of planner.  Planner is not part of Emacs, find it
+on the web.
 @end table
 
-@node TTY keys, Bugs, Interaction, Miscellaneous
-@section Using org-mode on a tty
-@cindex tty keybindings
-
-Org-mode uses a number of keys that are not accessible on a tty.  This
-applies to most special keys like cursor keys, @key{TAB} and
-@key{RET}, when these are combined with modifier keys like @key{Meta}
-and/or @key{Shift}.  Org-mode uses these bindings because it needs to
-provide keys for a large number of commands, and because these keys
-appeared particularly easy to remember.  In order to still be able to
-access the core functionality of Org-mode on a tty, alternative
-bindings are provided.  Here is a complete list of these bindings,
-which are obviously more cumbersome to use.  Note that sometimes a
-work-around can be better.  For example changing a time stamp is
-really only fun with @kbd{S-@key{cursor}} keys.  On a tty you would
-rather use @kbd{C-c .}  to re-insert the timestamp.
-
-@page
-@multitable @columnfractions 0.15 0.2 0.2
-@item @b{Default} @tab @b{Alternative 1} @tab @b{Alternative 2}
-@item @kbd{S-@key{TAB}}     @tab @kbd{C-u @key{TAB}}       @tab
-@item @kbd{M-@key{left}}    @tab @kbd{C-c C-x l}           @tab @kbd{@key{Esc} @key{left}}
-@item @kbd{M-S-@key{left}}  @tab @kbd{C-c C-x L}           @tab
-@item @kbd{M-@key{right}}   @tab @kbd{C-c C-x r}           @tab @kbd{@key{Esc} @key{right}}
-@item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R}           @tab
-@item @kbd{M-@key{up}}      @tab @kbd{C-c C-x u}           @tab @kbd{@key{Esc} @key{up}}
-@item @kbd{M-S-@key{up}}    @tab @kbd{C-c C-x U}           @tab
-@item @kbd{M-@key{down}}    @tab @kbd{C-c C-x d}           @tab @kbd{@key{Esc} @key{down}}
-@item @kbd{M-S-@key{down}}  @tab @kbd{C-c C-x D}           @tab
-@item @kbd{S-@key{RET}}     @tab @kbd{C-c C-x c}           @tab
-@item @kbd{M-@key{RET}}     @tab @kbd{C-c C-x m}           @tab @kbd{@key{Esc} @key{RET}}
-@item @kbd{M-S-@key{RET}}   @tab @kbd{C-c C-x M}           @tab
-@item @kbd{S-@key{left}}    @tab @kbd{C-c C-x @key{left}}  @tab
-@item @kbd{S-@key{right}}   @tab @kbd{C-c C-x @key{right}} @tab
-@item @kbd{S-@key{up}}      @tab @kbd{C-c C-x @key{up}}    @tab
-@item @kbd{S-@key{down}}    @tab @kbd{C-c C-x @key{down}}  @tab
-@end multitable
-
-@node Bugs, Acknowledgments, TTY keys, Miscellaneous
+@node Bugs, Acknowledgments, Interaction, Miscellaneous
 @section Bugs
 @cindex bugs
 
@@ -3246,13 +3360,6 @@
 have found too hard to fix.
 
 @itemize @bullet
-@c @item
-@c If you call @code{fill-paragraph} (bound to @kbd{M-q}) in a table, the
-@c filling is correctly disabled.  However, if some text directly
-@c (without an empty line in between) precedes or follows a table, calling
-@c @code{fill-paragraph} in that text will also fill the table like
-@c normal text.  Also, @code{fill-region} does bypass the
-@c @code{fill-paragraph} code and will fill tables like normal text.
 @item
 Text in an entry protected with the @samp{QUOTE} keyword should not
 autowrap.
@@ -3261,6 +3368,10 @@
 (for example because the application does not exits or refuses to open
 the file), it does so silently.  No error message is displayed.
 @item
+Plain list items should be able to hold a TODO item.  Unfortunately this
+has so many technical problems that I will only consider this change for
+the next major release (5.0).
+@item
 The remote-editing commands in the agenda buffer cannot be undone with
 @code{undo} called from within the agenda buffer.  But you can go to
 the corresponding buffer (using @key{TAB} or @key{RET} and execute
@@ -3276,11 +3387,9 @@
 However, from Org-mode's timeline and agenda buffers (created with
 @kbd{C-c C-r} and @kbd{C-c a}), things do work correctly.
 @item
-Linux should also have a default viewer application, using mailcap.
-Maybe we can use GNUS or VM mime code?  Or dired's guessing commands?
-Any hints (or even patches) are appreciated.
-@item
-When you write @samp{x = a /b/ c}, b will be exported in italics.
+You can only make a single word boldface or italic.  To emphasize
+several words in a row, each much have the emphasize markers, like in
+@samp{*three* *bold* *words*}.
 @item
 The exporters work well, but could be made more efficient.
 @end itemize
@@ -3353,6 +3462,9 @@
 @item 
 Roland Winkler pointed out that additional keybindings are needed to
 use Org-mode on a tty.
+@item
+Piotr Zielinski wrote @file{org-mouse.el} and pointed out to me that
+Emacs 22 can be made to follow links using mouse-1 clicks.
 @c @item
 @c Nic Ferrier and Christian Egli implemented XML export.
 @end itemize
--- a/src/ChangeLog	Fri Mar 03 05:16:17 2006 +0000
+++ b/src/ChangeLog	Fri Mar 03 07:48:46 2006 +0000
@@ -1,8 +1,87 @@
+2006-03-02  Kim F. Storm  <storm@cua.dk>
+
+	* frame.h (struct frame): New member n_tool_bar_rows.
+
+	* xdisp.c: Minimize the unpleasent visual impact of the requirement
+	that non-toolkit tool-bars must occupy an integral number of screen
+	lines, by distributing the rows evenly over the tool-bar screen	area.
+	(Vtool_bar_border): New variable.
+	(syms_of_xdisp): DEFVAR_LISP it.
+	(display_tool_bar_line): Add HEIGHT arg for desired row height.  Make
+	tool-bar row the desired height.  Use default face for border below
+	tool-bar.
+	(tool_bar_lines_needed): Add N_ROWS arg.  Use it to return number of
+	actual tool-bar rows.
+	(redisplay_tool_bar): Calculate f->n_tool_bar_rows initially.
+	Adjust the height of the tool-bar rows to fill tool-bar screen area.
+	(redisplay_tool_bar): Calculate f->n_tool_bar_rows when tool-bar area
+	is resized.
+
+2006-03-01  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* search.c (Fregexp_quote): Do not precede a literal `]' with two
+	backslashes to try to make clear that it has a literal meaning; it
+	does not do that.  (It could close a character alternative
+	containing a backslash.)
+
+2006-02-28  Chong Yidong  <cyd@stupidchicken.com>
+
+	* xselect.c (x_catch_errors_unwind): New function.
+	(x_reply_selection_request): Put x_uncatch_errors in an unwind.
+	(Fx_get_atom_name): Call x_uncatch_errors earlier.
+
+	* window.c (Qscroll_up, Qscroll_down): New syms.
+	(window_scroll_pixel_based): Make preserve_y static to avoid
+	getting point stuck when scrolling 1 line.
+
+2006-02-26  Chong Yidong  <cyd@stupidchicken.com>
+
+	* xterm.h, xterm.c (x_uncatch_errors): Delete unneccessary
+	argument.
+
+	* xterm.c: (x_load_font, x_term_init, XTmouse_position)
+	(handle_one_xevent, x_connection_closed, x_list_fonts): No arg for
+	x_uncatch_errors.
+
+	* xselect.c (x_own_selection, x_decline_selection_request)
+	(x_reply_selection_request, x_get_foreign_selection)
+	(Fx_get_atom_name, Fx_send_client_event): Likewise.
+
+	* xfns.c (x_real_positions, x_set_mouse_color, Fx_focus_frame):
+	Likewise.
+
+2006-02-26  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* lread.c: Declare Vload_file_rep_suffixes instead of
+	deleted variable default_suffixes.
+	(Fget_load_suffixes): New function.
+	(Fload): Use Fget_load_suffixes and Vload_file_rep_suffixes.
+	No longer use deleted variable default_suffixes.  Update docstring.
+	(syms_of_lread): defsubr Sget_load_suffixes.
+	Expand `load-suffixes' docstring.
+	Delete default_suffixes and DEFVAR_LISP the new variable
+	`load-file-rep-suffixes'.
+
+	* w32.c (check_windows_init_file): Use Fget_load_suffixes instead
+	of Vload_suffixes.
+
+	* lisp.h: EXFUN Fget_load_suffixes.
+	Extern Vload_file_rep_suffixes.
+
+	* eval.c (specpdl_ptr): Remove volatile qualifier for consistency
+	with lisp.h.
+
+2006-02-26  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* lisp.h (struct specbinding, specpdl_ptr): Remove the volatile
+	qualifier which was trying to avoid the bug that was fixed by
+	yesterday's changes to xterm.c.
+
 2006-02-25  Chong Yidong  <cyd@stupidchicken.com>
 
 	* xterm.h (x_catch_errors) Return value changed to void.
-	(x_uncatch_errors): Unused count argument deleted.
-	
+	(x_uncatch_errors): Delete unused count argument.
+
 	* xterm.c (x_catch_errors): Don't use record_unwind_protect, since
 	it can be called in a signal handler.
 	(x_catch_errors_unwind): Function deleted.
--- a/src/eval.c	Fri Mar 03 05:16:17 2006 +0000
+++ b/src/eval.c	Fri Mar 03 07:48:46 2006 +0000
@@ -117,7 +117,7 @@
 
 /* Pointer to first unused element in specpdl.  */
 
-volatile struct specbinding *specpdl_ptr;
+struct specbinding *specpdl_ptr;
 
 /* Maximum size allowed for specpdl allocation */
 
--- a/src/frame.h	Fri Mar 03 05:16:17 2006 +0000
+++ b/src/frame.h	Fri Mar 03 07:48:46 2006 +0000
@@ -222,6 +222,7 @@
   /* Margin at the top of the frame.  Used to display the tool-bar.  */
   int tool_bar_lines;
 
+  int n_tool_bar_rows;
   int n_tool_bar_items;
 
   /* A buffer for decode_mode_line. */
--- a/src/lisp.h	Fri Mar 03 05:16:17 2006 +0000
+++ b/src/lisp.h	Fri Mar 03 07:48:46 2006 +0000
@@ -1754,13 +1754,13 @@
 
 struct specbinding
   {
-    volatile Lisp_Object symbol, old_value;
-    volatile specbinding_func func;
+    Lisp_Object symbol, old_value;
+    specbinding_func func;
     Lisp_Object unused;		/* Dividing by 16 is faster than by 12 */
   };
 
 extern struct specbinding *specpdl;
-extern volatile struct specbinding *specpdl_ptr;
+extern struct specbinding *specpdl_ptr;
 extern int specpdl_size;
 
 extern EMACS_INT max_specpdl_size;
@@ -2638,6 +2638,7 @@
 EXFUN (Fintern, 2);
 EXFUN (Fintern_soft, 2);
 EXFUN (Fload, 5);
+EXFUN (Fget_load_suffixes, 0);
 EXFUN (Fget_file_char, 0);
 EXFUN (Fread_char, 2);
 EXFUN (Fread_event, 2);
@@ -2649,7 +2650,7 @@
 #define LOADHIST_ATTACH(x) \
  if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list)
 extern Lisp_Object Vcurrent_load_list;
-extern Lisp_Object Vload_history, Vload_suffixes;
+extern Lisp_Object Vload_history, Vload_suffixes, Vload_file_rep_suffixes;
 extern int openp P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
 		      Lisp_Object *, Lisp_Object));
 extern int isfloat_string P_ ((char *));
--- a/src/lread.c	Fri Mar 03 05:16:17 2006 +0000
+++ b/src/lread.c	Fri Mar 03 07:48:46 2006 +0000
@@ -106,7 +106,7 @@
 Lisp_Object Vsource_directory;
 
 /* Search path and suffixes for files to be loaded. */
-Lisp_Object Vload_path, Vload_suffixes, default_suffixes;
+Lisp_Object Vload_path, Vload_suffixes, Vload_file_rep_suffixes;
 
 /* File name of user's init file.  */
 Lisp_Object Vuser_init_file;
@@ -832,28 +832,64 @@
   return Qnil;
 }
 
+DEFUN ("get-load-suffixes", Fget_load_suffixes, Sget_load_suffixes, 0, 0, 0,
+       doc: /* Return the suffixes that `load' should try if a suffix is \
+required.
+This uses the variables `load-suffixes' and `load-file-rep-suffixes'.  */)
+     ()
+{
+  Lisp_Object lst = Qnil, suffixes = Vload_suffixes, suffix, ext;
+  while (CONSP (suffixes))
+    {
+      Lisp_Object exts = Vload_file_rep_suffixes;
+      suffix = XCAR (suffixes);
+      suffixes = XCDR (suffixes);
+      while (CONSP (exts))
+	{
+	  ext = XCAR (exts);
+	  exts = XCDR (exts);
+	  lst = Fcons (concat2 (suffix, ext), lst);
+	}
+    }
+  return Fnreverse (lst);
+}
+
 DEFUN ("load", Fload, Sload, 1, 5, 0,
        doc: /* Execute a file of Lisp code named FILE.
 First try FILE with `.elc' appended, then try with `.el',
- then try FILE unmodified (the exact suffixes are determined by
-`load-suffixes').  Environment variable references in FILE
- are replaced with their values by calling `substitute-in-file-name'.
+then try FILE unmodified (the exact suffixes in the exact order are
+determined by  `load-suffixes').  Environment variable references in
+FILE are replaced with their values by calling `substitute-in-file-name'.
 This function searches the directories in `load-path'.
+
 If optional second arg NOERROR is non-nil,
- report no error if FILE doesn't exist.
+report no error if FILE doesn't exist.
 Print messages at start and end of loading unless
- optional third arg NOMESSAGE is non-nil.
+optional third arg NOMESSAGE is non-nil.
 If optional fourth arg NOSUFFIX is non-nil, don't try adding
- suffixes `.elc' or `.el' to the specified name FILE.
+suffixes `.elc' or `.el' to the specified name FILE.
 If optional fifth arg MUST-SUFFIX is non-nil, insist on
- the suffix `.elc' or `.el'; don't accept just FILE unless
- it ends in one of those suffixes or includes a directory name.
+the suffix `.elc' or `.el'; don't accept just FILE unless
+it ends in one of those suffixes or includes a directory name.
+
+If this function fails to find a file, it may look for different
+representations of that file before trying another file.
+It does so by adding the non-empty suffixes in `load-file-rep-suffixes'
+to the file name.  Emacs uses this feature mainly to find compressed
+versions of files when Auto Compression mode is enabled.
+
+The exact suffixes that this function tries out, in the exact order,
+are given by the value of the variable `load-file-rep-suffixes' if
+NOSUFFIX is non-nil and by the return value of the function
+`get-load-suffixes' if MUST-SUFFIX is non-nil.  If both NOSUFFIX and
+MUST-SUFFIX are nil, this function first tries out the latter suffixes
+and then the former.
 
 Loading a file records its definitions, and its `provide' and
 `require' calls, in an element of `load-history' whose
 car is the file name loaded.  See `load-history'.
 
-Return t if file exists.  */)
+Return t if the file exists and loads successfully.  */)
      (file, noerror, nomessage, nosuffix, must_suffix)
      Lisp_Object file, noerror, nomessage, nosuffix, must_suffix;
 {
@@ -930,9 +966,9 @@
 
       fd = openp (Vload_path, file,
 		  (!NILP (nosuffix) ? Qnil
-		   : !NILP (must_suffix) ? Vload_suffixes
-		   : Fappend (2, (tmp[0] = Vload_suffixes,
-				  tmp[1] = default_suffixes,
+		   : !NILP (must_suffix) ? Fget_load_suffixes ()
+		   : Fappend (2, (tmp[0] = Fget_load_suffixes (),
+				  tmp[1] = Vload_file_rep_suffixes,
 				  tmp))),
 		  &found, Qnil);
       UNGCPRO;
@@ -1303,7 +1339,7 @@
 	fn = (char *) alloca (fn_size = 100 + want_size);
 
       /* Loop over suffixes.  */
-      for (tail = NILP (suffixes) ? default_suffixes : suffixes;
+      for (tail = NILP (suffixes) ? Fcons (build_string (""), Qnil) : suffixes;
 	   CONSP (tail); tail = XCDR (tail))
 	{
 	  int lsuffix = SBYTES (XCAR (tail));
@@ -3979,6 +4015,7 @@
   defsubr (&Sintern);
   defsubr (&Sintern_soft);
   defsubr (&Sunintern);
+  defsubr (&Sget_load_suffixes);
   defsubr (&Sload);
   defsubr (&Seval_buffer);
   defsubr (&Seval_region);
@@ -4040,13 +4077,27 @@
 otherwise to default specified by file `epaths.h' when Emacs was built.  */);
 
   DEFVAR_LISP ("load-suffixes", &Vload_suffixes,
-	       doc: /* *List of suffixes to try for files to load.
-This list should not include the empty string.  */);
+	       doc: /* List of suffixes for (compiled or source) Emacs Lisp files.
+This list should not include the empty string.
+`load' and related functions try to append these suffixes, in order,
+to the specified file name if a Lisp suffix is allowed or required.  */);
   Vload_suffixes = Fcons (build_string (".elc"),
 			  Fcons (build_string (".el"), Qnil));
+  DEFVAR_LISP ("load-file-rep-suffixes", &Vload_file_rep_suffixes,
+	       doc: /* List of suffixes that indicate representations of \
+the same file.
+This list should normally start with the empty string.
+
+Enabling Auto Compression mode appends the suffixes in
+`jka-compr-load-suffixes' to this list and disabling Auto Compression
+mode removes them again.  `load' and related functions use this list to
+determine whether they should look for compressed versions of a file
+and, if so, which suffixes they should try to append to the file name
+in order to do so.  However, if you want to customize which suffixes
+the loading functions recognize as compression suffixes, you should
+customize `jka-compr-load-suffixes' rather than the present variable.  */);
   /* We don't use empty_string because it's not initialized yet.  */
-  default_suffixes = Fcons (build_string (""), Qnil);
-  staticpro (&default_suffixes);
+  Vload_file_rep_suffixes = Fcons (build_string (""), Qnil);
 
   DEFVAR_BOOL ("load-in-progress", &load_in_progress,
 	       doc: /* Non-nil iff inside of `load'.  */);
--- a/src/search.c	Fri Mar 03 05:16:17 2006 +0000
+++ b/src/search.c	Fri Mar 03 07:48:46 2006 +0000
@@ -3042,7 +3042,7 @@
 
   for (; in != end; in++)
     {
-      if (*in == '[' || *in == ']'
+      if (*in == '['
 	  || *in == '*' || *in == '.' || *in == '\\'
 	  || *in == '?' || *in == '+'
 	  || *in == '^' || *in == '$')
--- a/src/w32.c	Fri Mar 03 05:16:17 2006 +0000
+++ b/src/w32.c	Fri Mar 03 07:48:46 2006 +0000
@@ -3888,7 +3888,7 @@
       objs[1] = decode_env_path (0, (getenv ("EMACSLOADPATH")));
       full_load_path = Fappend (2, objs);
       init_file = build_string ("term/w32-win");
-      fd = openp (full_load_path, init_file, Vload_suffixes, NULL, Qnil);
+      fd = openp (full_load_path, init_file, Fget_load_suffixes (), NULL, Qnil);
       if (fd < 0)
 	{
 	  Lisp_Object load_path_print = Fprin1_to_string (full_load_path, Qnil);
--- a/src/window.c	Fri Mar 03 05:16:17 2006 +0000
+++ b/src/window.c	Fri Mar 03 07:48:46 2006 +0000
@@ -50,6 +50,7 @@
 
 
 Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p;
+Lisp_Object Qscroll_up, Qscroll_down;
 Lisp_Object Qwindow_size_fixed;
 extern Lisp_Object Qleft_margin, Qright_margin;
 
@@ -4721,9 +4722,9 @@
   struct text_pos start;
   Lisp_Object tem;
   int this_scroll_margin;
-  int preserve_y;
   /* True if we fiddled the window vscroll field without really scrolling.   */
   int vscrolled = 0;
+  static int preserve_y = -1;
 
   SET_TEXT_POS_FROM_MARKER (start, w->start);
 
@@ -4787,9 +4788,18 @@
      point in the same window line as it is now, so get that line.  */
   if (!NILP (Vscroll_preserve_screen_position))
     {
-      start_display (&it, w, start);
-      move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
-      preserve_y = it.current_y;
+      /* We preserve the goal pixel coordinate across consecutive
+	 calls to scroll-up or scroll-down.  This avoids the
+	 possibility of point becoming "stuck" on a tall line when
+	 scrolling by one line.  */
+      if (preserve_y < 0
+	  || (current_kboard->Vlast_command != Qscroll_up
+	      && current_kboard->Vlast_command != Qscroll_down))
+	{
+	  start_display (&it, w, start);
+	  move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
+	  preserve_y = it.current_y;
+	}
     }
   else
     preserve_y = -1;
@@ -4926,10 +4936,9 @@
 	{
 	  /* If we have a header line, take account of it.
 	     This is necessary because we set it.current_y to 0, above.  */
-	  if (WINDOW_WANTS_HEADER_LINE_P (w))
-	    preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w);
-
-	  move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y);
+	  move_it_to (&it, -1, -1,
+		      preserve_y - (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0 ),
+		      -1, MOVE_TO_Y);
 	  SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
 	}
       else
@@ -4983,15 +4992,9 @@
 	{
 	  SET_TEXT_POS_FROM_MARKER (start, w->start);
 	  start_display (&it, w, start);
-#if 0  /* It's wrong to subtract this here
-	  because we called start_display again
-	  and did not alter it.current_y this time.  */
-
-	  /* If we have a header line, take account of it.  */
-	  if (WINDOW_WANTS_HEADER_LINE_P (w))
-	    preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w);
-#endif
-
+	  /* It would be wrong to subtract CURRENT_HEADER_LINE_HEIGHT
+	     here because we called start_display again and did not
+	     alter it.current_y this time.  */
 	  move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y);
 	  SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
 	}
@@ -6988,6 +6991,12 @@
 void
 syms_of_window ()
 {
+  Qscroll_up = intern ("scroll-up");
+  staticpro (&Qscroll_up);
+
+  Qscroll_down = intern ("scroll-down");
+  staticpro (&Qscroll_down);
+
   Qwindow_size_fixed = intern ("window-size-fixed");
   staticpro (&Qwindow_size_fixed);
   Fset (Qwindow_size_fixed, Qnil);
--- a/src/xdisp.c	Fri Mar 03 05:16:17 2006 +0000
+++ b/src/xdisp.c	Fri Mar 03 07:48:46 2006 +0000
@@ -270,6 +270,12 @@
 
 int make_cursor_line_fully_visible_p;
 
+/* Margin below tool bar in pixels.  0 or nil means no margin.
+   If value is `internal-border-width' or `border-width',
+   the corresponding frame parameter is used.  */
+
+Lisp_Object Vtool_bar_border;
+
 /* Margin around tool bar buttons in pixels.  */
 
 Lisp_Object Vtool_bar_button_margin;
@@ -855,7 +861,7 @@
 static int store_mode_line_noprop P_ ((const unsigned char *, int, int));
 static void x_consider_frame_title P_ ((Lisp_Object));
 static void handle_stop P_ ((struct it *));
-static int tool_bar_lines_needed P_ ((struct frame *));
+static int tool_bar_lines_needed P_ ((struct frame *, int *));
 static int single_display_spec_intangible_p P_ ((Lisp_Object));
 static void ensure_echo_area_buffers P_ ((void));
 static Lisp_Object unwind_with_echo_area_buffer P_ ((Lisp_Object));
@@ -966,7 +972,7 @@
 static void update_tool_bar P_ ((struct frame *, int));
 static void build_desired_tool_bar_string P_ ((struct frame *f));
 static int redisplay_tool_bar P_ ((struct frame *));
-static void display_tool_bar_line P_ ((struct it *));
+static void display_tool_bar_line P_ ((struct it *, int));
 static void notice_overwritten_cursor P_ ((struct window *,
 					   enum glyph_row_area,
 					   int, int, int, int));
@@ -9530,11 +9536,17 @@
 }
 
 
-/* Display one line of the tool-bar of frame IT->f.  */
-
-static void
-display_tool_bar_line (it)
-     struct it *it;
+/* Display one line of the tool-bar of frame IT->f.
+
+   HEIGHT specifies the desired height of the tool-bar line.
+   If the actual height of the glyph row is less than HEIGHT, the
+   row's height is increased to HEIGHT, and the icons are centered
+   vertically in the new height.  */
+
+static void
+display_tool_bar_line (it, height)
+     struct it *it;
+     int height;
 {
   struct glyph_row *row = it->glyph_row;
   int max_x = it->last_visible_x;
@@ -9590,11 +9602,22 @@
  out:;
 
   row->displays_text_p = row->used[TEXT_AREA] != 0;
+  /* Use default face for the border below the tool bar.  */
+  if (!row->displays_text_p)
+    it->face_id = DEFAULT_FACE_ID;
   extend_face_to_end_of_line (it);
   last = row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1;
   last->right_box_line_p = 1;
   if (last == row->glyphs[TEXT_AREA])
     last->left_box_line_p = 1;
+
+  /* Make line the desired height and center it vertically.  */
+  if ((height -= it->max_ascent + it->max_descent) > 0)
+    {
+      it->max_ascent += height / 2;
+      it->max_descent += (height + 1) / 2;
+    }
+
   compute_line_metrics (it);
 
   /* If line is empty, make it occupy the rest of the tool-bar.  */
@@ -9618,11 +9641,13 @@
 
 
 /* Value is the number of screen lines needed to make all tool-bar
-   items of frame F visible.  */
-
-static int
-tool_bar_lines_needed (f)
+   items of frame F visible.  The number of actual rows needed is
+   returned in *N_ROWS if non-NULL.  */
+
+static int
+tool_bar_lines_needed (f, n_rows)
      struct frame *f;
+     int *n_rows;
 {
   struct window *w = XWINDOW (f->tool_bar_window);
   struct it it;
@@ -9638,8 +9663,11 @@
     {
       it.glyph_row = w->desired_matrix->rows;
       clear_glyph_row (it.glyph_row);
-      display_tool_bar_line (&it);
-    }
+      display_tool_bar_line (&it, 0);
+    }
+
+  if (n_rows)
+    *n_rows = it.vpos;
 
   return (it.current_y + FRAME_LINE_HEIGHT (f) - 1) / FRAME_LINE_HEIGHT (f);
 }
@@ -9669,7 +9697,7 @@
       if (f->n_tool_bar_items)
 	{
 	  build_desired_tool_bar_string (f);
-	  nlines = tool_bar_lines_needed (f);
+	  nlines = tool_bar_lines_needed (f, NULL);
 	}
     }
 
@@ -9714,9 +9742,50 @@
   build_desired_tool_bar_string (f);
   reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1);
 
+  if (f->n_tool_bar_rows == 0)
+    {
+      (void)tool_bar_lines_needed (f, &f->n_tool_bar_rows);
+      if (f->n_tool_bar_rows == 0)
+	f->n_tool_bar_rows = -1;
+    }
+
   /* Display as many lines as needed to display all tool-bar items.  */
-  while (it.current_y < it.last_visible_y)
-    display_tool_bar_line (&it);
+
+  if (f->n_tool_bar_rows > 0)
+    {
+      int border, rows, height, extra;
+
+      if (INTEGERP (Vtool_bar_border))
+	border = XINT (Vtool_bar_border);
+      else if (EQ (Vtool_bar_border, Qinternal_border_width))
+	border = FRAME_INTERNAL_BORDER_WIDTH (f);
+      else if (EQ (Vtool_bar_border, Qborder_width))
+	border = f->border_width;
+      else
+	border = 0;
+      if (border < 0)
+	border = 0;
+
+      rows = f->n_tool_bar_rows;
+      height = (it.last_visible_y - border) / rows;
+      extra = it.last_visible_y - border - height * rows;
+
+      while (it.current_y < it.last_visible_y)
+	{
+	  int h = 0;
+	  if (extra > 0 && rows-- > 0)
+	    {
+	      h = (extra + rows - 1) / rows;
+	      extra -= h;
+	    }
+	  display_tool_bar_line (&it, height + h);
+	}
+    }
+  else
+    {
+      while (it.current_y < it.last_visible_y)
+	display_tool_bar_line (&it, 0);
+    }
 
   /* It doesn't make much sense to try scrolling in the tool-bar
      window, so don't do it.  */
@@ -9749,7 +9818,7 @@
       /* Resize windows as needed by changing the `tool-bar-lines'
 	 frame parameter.  */
       if (change_height_p
-	  && (nlines = tool_bar_lines_needed (f),
+	  && (nlines = tool_bar_lines_needed (f, &f->n_tool_bar_rows),
 	      nlines != WINDOW_TOTAL_LINES (w)))
 	{
 	  extern Lisp_Object Qtool_bar_lines;
@@ -23817,6 +23886,14 @@
     doc: /* *Non-nil means to scroll (recenter) cursor line if it is not fully visible.  */);
   make_cursor_line_fully_visible_p = 1;
 
+  DEFVAR_LISP ("tool-bar-border", &Vtool_bar_border,
+    doc: /* *Border below tool-bar in pixels.
+If an integer, use it as the height of the border.
+If it is one of `internal-border-width' or `border-width', use the
+value of the corresponding frame parameter.
+Otherwise, no border is added below the tool-bar.  */);
+  Vtool_bar_border = Qinternal_border_width;
+
   DEFVAR_LISP ("tool-bar-button-margin", &Vtool_bar_button_margin,
     doc: /* *Margin around tool-bar buttons in pixels.
 If an integer, use that for both horizontal and vertical margins.
--- a/src/xfns.c	Fri Mar 03 05:16:17 2006 +0000
+++ b/src/xfns.c	Fri Mar 03 07:48:46 2006 +0000
@@ -667,7 +667,7 @@
       had_errors = x_had_errors_p (FRAME_X_DISPLAY (f));
     }
 
-  x_uncatch_errors (FRAME_X_DISPLAY (f));
+  x_uncatch_errors ();
 
   UNBLOCK_INPUT;
 
@@ -1022,7 +1022,7 @@
 
   /* Check and report errors with the above calls.  */
   x_check_errors (dpy, "can't set cursor shape: %s");
-  x_uncatch_errors (dpy);
+  x_uncatch_errors ();
 
   {
     XColor fore_color, back_color;
@@ -3427,7 +3427,7 @@
   x_catch_errors (dpy);
   XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
 		  RevertToParent, CurrentTime);
-  x_uncatch_errors (dpy);
+  x_uncatch_errors ();
   UNBLOCK_INPUT;
 
   return Qnil;
--- a/src/xselect.c	Fri Mar 03 05:16:17 2006 +0000
+++ b/src/xselect.c	Fri Mar 03 07:48:46 2006 +0000
@@ -55,6 +55,7 @@
 static Lisp_Object x_selection_request_lisp_error P_ ((Lisp_Object));
 static Lisp_Object queue_selection_requests_unwind P_ ((Lisp_Object));
 static Lisp_Object some_frame_on_display P_ ((struct x_display_info *));
+static Lisp_Object x_catch_errors_unwind P_ ((Lisp_Object));
 static void x_reply_selection_request P_ ((struct input_event *, int,
 					   unsigned char *, int, Atom));
 static int waiting_for_other_props_on_window P_ ((Display *, Window));
@@ -410,7 +411,7 @@
   x_catch_errors (display);
   XSetSelectionOwner (display, selection_atom, selecting_window, time);
   x_check_errors (display, "Can't set selection: %s");
-  x_uncatch_errors (display);
+  x_uncatch_errors ();
   UNBLOCK_INPUT;
 
   /* Now update the local cache */
@@ -586,7 +587,7 @@
   x_catch_errors (reply.display);
   XSendEvent (reply.display, reply.requestor, False, 0L, (XEvent *) &reply);
   XFlush (reply.display);
-  x_uncatch_errors (reply.display);
+  x_uncatch_errors ();
   UNBLOCK_INPUT;
 }
 
@@ -611,6 +612,15 @@
     x_decline_selection_request (x_selection_current_request);
   return Qnil;
 }
+
+static Lisp_Object
+x_catch_errors_unwind (dummy)
+     Lisp_Object dummy;
+{
+  BLOCK_INPUT;
+  x_uncatch_errors ();
+  UNBLOCK_INPUT;
+}
 
 
 /* This stuff is so that INCR selections are reentrant (that is, so we can
@@ -703,8 +713,11 @@
   if (reply.property == None)
     reply.property = reply.target;
 
-  /* #### XChangeProperty can generate BadAlloc, and we must handle it! */
   BLOCK_INPUT;
+  /* The protected block contains wait_for_property_change, which can
+     run random lisp code (process handlers) or signal.  Therefore, we
+     put the x_uncatch_errors call in an unwind.  */
+  record_unwind_protect (x_catch_errors_unwind, Qnil);
   x_catch_errors (display);
 
 #ifdef TRACE_SELECTION
@@ -858,9 +871,8 @@
      UNBLOCK to enter the event loop and get possible errors delivered,
      and then BLOCK again because x_uncatch_errors requires it.  */
   BLOCK_INPUT;
-
+  /* This calls x_uncatch_errors.  */
   unbind_to (count, Qnil);
-  x_uncatch_errors (display);
   UNBLOCK_INPUT;
 }
 
@@ -1370,7 +1382,7 @@
   Atom selection_atom = symbol_to_x_atom (dpyinfo, display, selection_symbol);
   Atom type_atom;
   int secs, usecs;
-  int count;
+  int count = SPECPDL_INDEX ();
   Lisp_Object frame;
 
   if (CONSP (target_type))
@@ -1392,6 +1404,10 @@
 
   BLOCK_INPUT;
 
+  /* The protected block contains wait_reading_process_output, which
+     can run random lisp code (process handlers) or signal.
+     Therefore, we put the x_uncatch_errors call in an unwind.  */
+  record_unwind_protect (x_catch_errors_unwind, Qnil);
   x_catch_errors (display);
 
   TRACE2 ("Get selection %s, type %s",
@@ -1409,8 +1425,6 @@
 
   frame = some_frame_on_display (dpyinfo);
 
-  count = SPECPDL_INDEX ();
-
   /* If the display no longer has frames, we can't expect
      to get many more selection requests from it, so don't
      bother trying to queue them.  */
@@ -1432,9 +1446,10 @@
   TRACE1 ("  Got event = %d", !NILP (XCAR (reading_selection_reply)));
 
   BLOCK_INPUT;
+  if (x_had_errors_p (display))
+    error ("Cannot get selection");
+  /* This calls x_uncatch_errors.  */
   unbind_to (count, Qnil);
-  x_check_errors (display, "Cannot get selection: %s");
-  x_uncatch_errors (display);
   UNBLOCK_INPUT;
 
   if (NILP (XCAR (reading_selection_reply)))
@@ -2655,6 +2670,7 @@
   Lisp_Object ret = Qnil;
   Display *dpy = FRAME_X_DISPLAY (f);
   Atom atom;
+  int had_errors;
 
   if (INTEGERP (value))
     atom = (Atom) XUINT (value);
@@ -2667,14 +2683,13 @@
 
   BLOCK_INPUT;
   x_catch_errors (dpy);
-
   name = atom ? XGetAtomName (dpy, atom) : "";
-
-  if (! x_had_errors_p (dpy))
+  had_errors = x_had_errors_p (dpy);
+  x_uncatch_errors ();
+
+  if (!had_errors)
     ret = make_string (name, strlen (name));
 
-  x_uncatch_errors (dpy);
-
   if (atom && name) XFree (name);
   if (NILP (ret)) ret = make_string ("", 0);
 
@@ -2849,7 +2864,7 @@
     XSendEvent (dpyinfo->display, wdest, propagate, mask, &event);
     XFlush (dpyinfo->display);
   }
-  x_uncatch_errors (dpyinfo->display);
+  x_uncatch_errors ();
   UNBLOCK_INPUT;
 
   return Qnil;
--- a/src/xterm.c	Fri Mar 03 05:16:17 2006 +0000
+++ b/src/xterm.c	Fri Mar 03 07:48:46 2006 +0000
@@ -326,7 +326,7 @@
 
 static int x_io_error_quitter P_ ((Display *));
 void x_catch_errors P_ ((Display *));
-void x_uncatch_errors P_ ((Display *));
+void x_uncatch_errors P_ ((void));
 void x_lower_frame P_ ((struct frame *));
 void x_scroll_bar_clear P_ ((struct frame *));
 int x_had_errors_p P_ ((Display *));
@@ -3877,7 +3877,7 @@
 	if (x_had_errors_p (FRAME_X_DISPLAY (*fp)))
 	  f1 = 0;
 
-	x_uncatch_errors (FRAME_X_DISPLAY (*fp));
+	x_uncatch_errors ();
 
 	/* If not, is it one of our scroll bars?  */
 	if (! f1)
@@ -5803,7 +5803,7 @@
                     /* This is needed to detect the error
                        if there is an error.  */
                     XSync (d, False);
-                    x_uncatch_errors (d);
+                    x_uncatch_errors ();
                   }
                 /* Not certain about handling scroll bars here */
 #endif /* 0 */
@@ -7585,19 +7585,16 @@
    DPY should be the display that was passed to x_catch_errors.  */
 
 void
-x_uncatch_errors (dpy)
-     Display *dpy;
+x_uncatch_errors ()
 {
   struct x_error_message_stack *tmp;
 
-  eassert (x_error_message && dpy == x_error_message->dpy);
-
   /* The display may have been closed before this function is called.
      Check if it is still open before calling XSync.  */
-  if (x_display_info_for_display (dpy) != 0)
+  if (x_display_info_for_display (x_error_message->dpy) != 0)
     {
       BLOCK_INPUT;
-      XSync (dpy, False);
+      XSync (x_error_message->dpy, False);
       UNBLOCK_INPUT;
     }
 
@@ -7622,7 +7619,7 @@
     {
       char string[X_ERROR_MESSAGE_SIZE];
       bcopy (x_error_message->string, string, X_ERROR_MESSAGE_SIZE);
-      x_uncatch_errors (dpy);
+      x_uncatch_errors ();
       error (format, string);
     }
 }
@@ -7782,7 +7779,7 @@
   if (dpyinfo)
     x_delete_display (dpyinfo);
 
-  x_uncatch_errors (dpy);
+  x_uncatch_errors ();
 
   if (x_display_list == 0)
     {
@@ -9525,7 +9522,7 @@
 	    }
 	}
 
-      x_uncatch_errors (dpy);
+      x_uncatch_errors ();
       UNBLOCK_INPUT;
 
       if (names)
@@ -9626,7 +9623,7 @@
 		  thisinfo = NULL;
 		  x_clear_errors (dpy);
 		}
-	      x_uncatch_errors (dpy);
+	      x_uncatch_errors ();
 	      UNBLOCK_INPUT;
 
 	      if (thisinfo)
@@ -9829,7 +9826,7 @@
 	font = NULL;
 	x_clear_errors (FRAME_X_DISPLAY (f));
       }
-    x_uncatch_errors (FRAME_X_DISPLAY (f));
+    x_uncatch_errors ();
     UNBLOCK_INPUT;
     if (!font)
       return NULL;
@@ -10769,7 +10766,7 @@
       abort ();
     if (x_had_errors_p (dpy) || !XQueryFont (dpy, font))
       XrmPutLineResource (&xrdb, "Emacs.dialog.*.font: 9x15");
-    x_uncatch_errors (dpy);
+    x_uncatch_errors ();
   }
 #endif
 #endif
--- a/src/xterm.h	Fri Mar 03 05:16:17 2006 +0000
+++ b/src/xterm.h	Fri Mar 03 07:48:46 2006 +0000
@@ -963,7 +963,7 @@
 void x_wm_set_size_hint P_ ((struct frame *, long, int));
 void x_catch_errors P_ ((Display *));
 int x_had_errors_p P_ ((Display *));
-void x_uncatch_errors P_ ((Display *));
+void x_uncatch_errors P_ ((void));
 void x_check_errors P_ ((Display *, char *));
 int x_text_icon P_ ((struct frame *, char *));
 int x_bitmap_icon P_ ((struct frame *, Lisp_Object));
@@ -980,7 +980,7 @@
 extern void x_catch_errors P_ ((Display *));
 extern void x_check_errors P_ ((Display *, char *));
 extern int x_had_errors_p P_ ((Display *));
-extern void x_uncatch_errors P_ ((Display *));
+extern void x_uncatch_errors P_ ((void));
 extern void x_set_window_size P_ ((struct frame *, int, int, int));
 extern void x_set_mouse_position P_ ((struct frame *, int, int));
 extern void x_set_mouse_pixel_position P_ ((struct frame *, int, int));