changeset 83207:4df500c93e1d

Merged in changes from CVS trunk. Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-552 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-553 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-554 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-555 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-556 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-557 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-27 Use the same directory explicit id-tags as Emacs where possible * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-28 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-29 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-247
author Karoly Lorentey <lorentey@elte.hu>
date Mon, 20 Sep 2004 09:41:18 +0000
parents b5dee7c1d483 (current diff) bb857995295b (diff)
children e318dfc2edc6
files admin/FOR-RELEASE lisp/ChangeLog lisp/simple.el lisp/subr.el src/alloc.c src/buffer.c src/xdisp.c src/xterm.c
diffstat 25 files changed, 545 insertions(+), 333 deletions(-) [+]
line wrap: on
line diff
--- a/admin/ChangeLog	Thu Sep 16 13:09:53 2004 +0000
+++ b/admin/ChangeLog	Mon Sep 20 09:41:18 2004 +0000
@@ -1,3 +1,8 @@
+2004-09-18  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* FOR-RELEASE (Indications): Clean up and update checklists for
+	Emacs and Elisp manuals.
+
 2004-09-11  Kim F. Storm  <storm@cua.dk>
 
 	* FOR-RELEASE (New features): Remove Gnus 5.10 entry (Done!).
--- a/admin/FOR-RELEASE	Thu Sep 16 13:09:53 2004 +0000
+++ b/admin/FOR-RELEASE	Mon Sep 20 09:41:18 2004 +0000
@@ -50,85 +50,45 @@
 DONE	SECTION
 ---------------------------------------------
 	man/abbrevs.texi
-	man/ack.texi
-	man/ada-mode.texi
 	man/anti.texi
-	man/autotype.texi
-	man/back.texi
-	man/basic.texi
-	man/buffers.texi
+LT	man/basic.texi
+LT	man/buffers.texi
 	man/building.texi
-	man/calc.texi
 	man/calendar.texi
-	man/cc-mode.texi
-	man/cl.texi
 	man/cmdargs.texi
-	man/commands.texi
+LT	man/commands.texi
 	man/custom.texi
 	man/dired.texi
-	man/dired-x.texi
-	man/display.texi
-	man/doclicense.texi
-	man/ebrowse.texi
-	man/ediff.texi
-	man/emacs-mime.texi
-	man/emacs.texi
-	man/emacs-xtra.texi
-	man/entering.texi
-	man/eshell.texi
-	man/eudc.texi
-	man/faq.texi
-	man/files.texi
-	man/fixit.texi
-	man/flymake.texi
-	man/forms.texi
-	man/frames.texi
+LT	man/display.texi
+LT	man/emacs.texi
+LT	man/entering.texi
+LT	man/files.texi
+LT	man/fixit.texi
+LT	man/frames.texi
 	man/glossary.texi
-	man/gnus-faq.texi
-	man/gnus.texi
-	man/gnu.texi
-	man/help.texi
-	man/idlwave.texi
-	man/indent.texi
-	man/info.texi
-	man/killing.texi
-	man/kmacro.texi
+LT	man/help.texi
+LT	man/indent.texi
+LT	man/killing.texi
+LT	man/kmacro.texi
 	man/macos.texi
 	man/maintaining.texi
-	man/major.texi
-	man/mark.texi
-	man/message.texi
-	man/mh-e.texi
-	man/mini.texi
+LT	man/major.texi
+LT	man/mark.texi
+LT	man/mini.texi
 	man/misc.texi
 	man/msdog.texi
-	man/mule.texi
-	man/m-x.texi
-	man/pcl-cvs.texi
-	man/pgg.texi
+LT	man/mule.texi
+LT	man/m-x.texi
 	man/picture.texi
 	man/programs.texi
-	man/reftex.texi
-	man/regs.texi
+LT	man/regs.texi
 	man/rmail.texi
-	man/screen.texi
-	man/sc.texi
-	man/search.texi
+LT	man/screen.texi
+LT	man/search.texi
 	man/sending.texi
-	man/ses.texi
-	man/sieve.texi
-	man/smtpmail.texi
-	man/speedbar.texi
-	man/texinfo.tex
-	man/text.texi
-	man/tramp.texi
-	man/trampver.texi
+LT	man/text.texi
 	man/trouble.texi
-	man/viper.texi
-	man/vip.texi
-	man/widget.texi
-	man/windows.texi
-	man/woman.texi
+LT	man/windows.texi
 	man/xresources.texi
 
 ** Check the Emacs Lisp manual.
@@ -138,62 +98,55 @@
 
 DONE	SECTION
 ---------------------------------------------
-	lispref/abbrevs.texi
+LT	lispref/abbrevs.texi
 	lispref/advice.texi
 	lispref/anti.texi
-	lispref/back.texi
-	lispref/backups.texi
-	lispref/buffers.texi
+LT	lispref/backups.texi
+LT	lispref/buffers.texi
 	lispref/calendar.texi
-	lispref/commands.texi
-	lispref/compile.texi
-	lispref/control.texi
+LT	lispref/commands.texi
+LT	lispref/compile.texi
+LT	lispref/control.texi
 	lispref/customize.texi
 	lispref/debugging.texi
 	lispref/display.texi
-	lispref/doclicense.texi
 	lispref/edebug.texi
-	lispref/elisp-covers.texi
-	lispref/elisp.texi
-	lispref/errors.texi
-	lispref/eval.texi
-	lispref/files.texi
-	lispref/frames.texi
-	lispref/front-cover-1.texi
-	lispref/functions.texi
-	lispref/gpl.texi
-	lispref/hash.texi
-	lispref/help.texi
+LT	lispref/elisp.texi
+LT	lispref/errors.texi
+LT	lispref/eval.texi
+LT	lispref/files.texi
+LT	lispref/frames.texi
+LT	lispref/functions.texi
+LT	lispref/hash.texi
+LT	lispref/help.texi
 	lispref/hooks.texi
-	lispref/index.texi
-	lispref/internals.texi
-	lispref/intro.texi
-	lispref/keymaps.texi
-	lispref/lay-flat.texi
-	lispref/lists.texi
-	lispref/loading.texi
+LT	lispref/internals.texi
+LT	lispref/intro.texi
+LT	lispref/keymaps.texi
+LT	lispref/lists.texi
+LT	lispref/loading.texi
 	lispref/locals.texi
-	lispref/macros.texi
+LT	lispref/macros.texi
 	lispref/maps.texi
-	lispref/markers.texi
-	lispref/minibuf.texi
+LT	lispref/markers.texi
+LT	lispref/minibuf.texi
 	lispref/modes.texi
-	lispref/nonascii.texi
-	lispref/numbers.texi
-	lispref/objects.texi
-	lispref/os.texi
-	lispref/positions.texi
+LT	lispref/nonascii.texi
+LT	lispref/numbers.texi
+LT	lispref/objects.texi
+LT	lispref/os.texi
+LT	lispref/positions.texi
 	lispref/processes.texi
-	lispref/searching.texi
-	lispref/sequences.texi
-	lispref/streams.texi
-	lispref/strings.texi
-	lispref/symbols.texi
-	lispref/syntax.texi
+LT	lispref/searching.texi
+LT	lispref/sequences.texi
+LT	lispref/streams.texi
+LT	lispref/strings.texi
+LT	lispref/symbols.texi
+LT	lispref/syntax.texi
 	lispref/text.texi
-	lispref/tips.texi
-	lispref/variables.texi
-	lispref/windows.texi
+LT	lispref/tips.texi
+LT	lispref/variables.texi
+LT	lispref/windows.texi
 
 
 Local variables:
--- a/etc/ChangeLog	Thu Sep 16 13:09:53 2004 +0000
+++ b/etc/ChangeLog	Mon Sep 20 09:41:18 2004 +0000
@@ -1,3 +1,8 @@
+2004-09-16  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* e/eterm.ti: Change the strings for smso and rmso.
+          e/eterm: Regenerate.
+
 2004-09-09  Thien-Thi Nguyen  <ttn@gnu.org>
 
 	* MORE.STUFF (EDB): Update entry.
--- a/etc/NEWS	Thu Sep 16 13:09:53 2004 +0000
+++ b/etc/NEWS	Mon Sep 20 09:41:18 2004 +0000
@@ -1496,6 +1496,8 @@
 **** The `::' qualifier triggers C++ parsing in C file.
 Previously, only the `template' and `class' keywords had this effect.
 
+**** The gnucc __attribute__ keyword is now recognised and ignored.
+
 **** New language HTML.
 Title and h1, h2, h3 are tagged.  Also, tags are generated when name= is
 used inside an anchor and whenever id= is used.
@@ -1504,7 +1506,8 @@
 If you want the old behavior instead, thus avoiding to increase the
 size of the tags file, use the --no-globals option.
 
-**** In Lua, all functions are tagged.
+**** New language Lua.
+All functions are tagged.
 
 **** In Perl, packages are tags.
 Subroutine tags are named from their package.  You can jump to sub tags
@@ -1515,7 +1518,7 @@
 
 **** New language PHP.
 Tags are functions, classes and defines.
-If the --members option is specified to etags, tags are vars also.
+If the --members option is specified to etags, tags are variables also.
 
 **** New default keywords for TeX.
 The new keywords are def, newcommand, renewcommand, newenvironment and
@@ -2239,6 +2242,10 @@
 
 * Lisp Changes in Emacs 21.4
 
+** Major mode functions now run the new normal hook
+`after-change-major-mode-hook', at the end, just before the mode
+dependent hooks.
+
 +++
 ** `auto-save-file-format' has been renamed to
 `buffer-auto-save-file-format' and made into a permanent local.
Binary file etc/e/eterm has changed
--- a/etc/e/eterm.ti	Thu Sep 16 13:09:53 2004 +0000
+++ b/etc/e/eterm.ti	Mon Sep 20 09:41:18 2004 +0000
@@ -12,8 +12,8 @@
 	smcup=\E7\E[?47h,rmcup=\E[2J\E[?47l\E8,
 	ht=\t,khome=\E[1~,kend=\E[4~,knp=\E[6~,kpp=\E[5~,
 	kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
-	smso=\E[7m,rmso=\E[m,
-	smul=\E[4m,rmul=\E[m,
+ 	smso=\E[7m,rmso=\E[27m,
+	smul=\E[4m,rmul=\E[24m,
 	rev=\E[7m,bold=\E[1m,sgr0=\E[m,
 	invis=\E[8m,op=\E[39;49m,
 	setab=\E[%p1%{40}%+%dm, setaf=\E[%p1%{30}%+%dm,
--- a/lisp/ChangeLog	Thu Sep 16 13:09:53 2004 +0000
+++ b/lisp/ChangeLog	Mon Sep 20 09:41:18 2004 +0000
@@ -1,3 +1,77 @@
+2004-09-19  Stefan  <monnier@iro.umontreal.ca>
+
+	* subr.el (event-basic-type): Fix mask (extend to 22bits).
+
+2004-09-18  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* textmodes/enriched.el (enriched-rerun-flag): New variable.
+	(enriched-before-change-major-mode): New function.
+	Add it to `change-major-mode-hook'.
+	(enriched-after-change-major-mode): New function.
+	Add it to `after-change-major-mode-hook'.
+	(enriched-mode): Make it work correctly if called from
+	`after-change-major-mode-hook'.
+	No longer set `indent-line-function'.
+
+	* simple.el (fundamental-mode): Run `after-change-major-mode-hook'.
+
+	* subr.el (after-change-major-mode-hook): New variable.
+	(run-mode-hooks): Implement it.
+
+2004-09-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* battery.el (battery-linux-proc-apm): Use string-to-number.
+	(battery-linux-proc-acpi): Ignore all hidden files in the battery dir.
+	Use dolist (and less indentation).  Use erase-buffer.
+	Pre-initialize `design-capacity', `warn', and `low'.
+	(battery-format): Use replace-regexp-in-string.
+
+2004-09-18  Ralph Schleicher  <rs@nunatak.allgaeu.org>
+
+	* battery.el: Delete superfluous empty lines.
+	(battery-linux-proc-acpi): Attempt to gather information from all
+	battery subdirectories regardless of their file name.
+	(battery-linux-proc-apm): Replace all occurrences of
+	battery-hex-to-int-2 with string-to-int (base 16).
+	(battery-hex-to-int-2, battery-hex-to-int): Delete functions.
+	(battery-hex-map): Delete variable.
+
+2004-09-18  John Paul Wallington  <jpw@gnu.org>
+
+	* calc/calc-units.el (calc-quick-units): Fix overzealous
+	s/or/unless/.
+
+2004-09-17  Romain Francoise  <romain@orebokech.com>
+
+	* ibuf-ext.el (define-ibuffer-filter filename):
+	Expand dired-directory since buffer-file-name is absolute.
+
+2004-09-17  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* ediff-init.el (ediff-current-diff-face-A)
+	(ediff-current-diff-face-B, ediff-current-diff-face-C)
+	(ediff-current-diff-face-Ancestor)
+	(ediff-fine-diff-face-A, ediff-fine-diff-face-B)
+	(ediff-fine-diff-face-C, ediff-fine-diff-face-Ancestor)
+	(ediff-even-diff-face-A, ediff-even-diff-face-B)
+	(ediff-even-diff-face-C, ediff-even-diff-face-Ancestor)
+	(ediff-odd-diff-face-A, ediff-odd-diff-face-B)
+	(ediff-odd-diff-face-C, ediff-odd-diff-face-Ancestor):
+	Use min-colors.
+
+	* term.el (term-down): Perform vertical motion if DOWN is negative.
+	(term-exec-1): Set both TERMCAP and TERMINFO unconditionally.
+	(term-termcap-format): Synchronyze with the eterm terminfo entry
+	in etc/e/eterm.ti.
+	(term-handle-colors-array): If the current foreground or
+	background are zero (i.e. unspecified), use the foreground and
+	background of the default face for reverse video.
+	(term-ansi-at-eval-string, term-ansi-default-fg)
+	(term-ansi-default-bg, term-ansi-current-temp): Delete unused variable.
+	(term-mem): Delete ununsed function.
+	(term-protocol-version): Increment.
+	(term-current-face): Set to default.
+
 2004-09-15  Thien-Thi Nguyen  <ttn@gnu.org>
 
 	* vc.el (annotate-time): Document point handling.
--- a/lisp/battery.el	Thu Sep 16 13:09:53 2004 +0000
+++ b/lisp/battery.el	Mon Sep 20 09:41:18 2004 +0000
@@ -1,6 +1,7 @@
 ;;; battery.el --- display battery status information
 
-;; Copyright (C) 1997, 1998, 2000, 2001, 2003 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1998, 2000, 2001, 2003, 2004
+;;           Free Software Foundation, Inc.
 
 ;; Author: Ralph Schleicher <rs@nunatak.allgaeu.org>
 ;; Keywords: hardware
@@ -31,9 +32,9 @@
 ;;; Code:
 
 (require 'timer)
+(eval-when-compile (require 'cl))
 
 
-
 (defgroup battery nil
   "Display battery status information."
   :prefix "battery-"
@@ -182,20 +183,20 @@
 	  (re-search-forward battery-linux-proc-apm-regexp)
 	  (setq driver-version (match-string 1))
 	  (setq bios-version (match-string 2))
-	  (setq tem (battery-hex-to-int-2 (match-string 3)))
+	  (setq tem (string-to-number (match-string 3) 16))
 	  (if (not (logand tem 2))
 	      (setq bios-interface "not supported")
 	    (setq bios-interface "enabled")
 	    (cond ((logand tem 16) (setq bios-interface "disabled"))
 		  ((logand tem 32) (setq bios-interface "disengaged")))
-	    (setq tem (battery-hex-to-int-2 (match-string 4)))
+	    (setq tem (string-to-number (match-string 4) 16))
 	    (cond ((= tem 0) (setq line-status "off-line"))
 		  ((= tem 1) (setq line-status "on-line"))
 		  ((= tem 2) (setq line-status "on backup")))
-	    (setq tem (battery-hex-to-int-2 (match-string 6)))
+	    (setq tem (string-to-number (match-string 6) 16))
 	    (if (= tem 255)
 		(setq battery-status "N/A")
-	      (setq tem (battery-hex-to-int-2 (match-string 5)))
+	      (setq tem (string-to-number (match-string 5) 16))
 	      (cond ((= tem 0) (setq battery-status "high"
 				     battery-status-symbol ""))
 		    ((= tem 1) (setq battery-status "low"
@@ -243,54 +244,52 @@
 %m Remaining time in minutes
 %h Remaining time in hours
 %t Remaining time in the form `h:min'"
-  (let (capacity design-capacity rate rate-type charging-state warn low
-		 minutes hours)
-    (when (file-directory-p "/proc/acpi/battery/")
-      ;; ACPI provides information about each battery present in the system in
-      ;; a separate subdirectory.  We are going to merge the available
-      ;; information together since displaying for a variable amount of
-      ;; batteries seems overkill for format-strings.
-      (mapc
-       (lambda (dir)
-	 (with-temp-buffer
-	   (insert-file-contents (expand-file-name "state" dir))
-	   (when (re-search-forward "present: +yes$" nil t)
-	     (and (re-search-forward "charging state: +\\(.*\\)$" nil t)
-		  (or (null charging-state) (string= charging-state
-						     "unknown"))
-		  ;; On most multi-battery systems, most of the time only one
-		  ;; battery is "charging"/"discharging", the others are
-		  ;; "unknown".
-		  (setq charging-state (match-string 1)))
-	     (when (re-search-forward "present rate: +\\([0-9]+\\) \\(m[AW]\\)$"
-				      nil t)
-	       (setq rate (+ (or rate 0) (string-to-int (match-string 1)))
-		     rate-type (or (and rate-type
-					(if (string= rate-type (match-string 2))
-					    rate-type
-					  (error
-					   "Inconsistent rate types (%s vs. %s)"
-					   rate-type (match-string 2))))
-				   (match-string 2))))
-	     (when (re-search-forward "remaining capacity: +\\([0-9]+\\) m[AW]h$"
-				      nil t)
-	       (setq capacity
-		     (+ (or capacity 0) (string-to-int (match-string 1))))))
-	   (goto-char (point-max))
-	   (insert-file-contents (expand-file-name "info" dir))
-	   (when (re-search-forward "present: +yes$" nil t)
-	     (when (re-search-forward "design capacity: +\\([0-9]+\\) m[AW]h$"
-				      nil t)
-	       (setq design-capacity (+ (or design-capacity 0)
-					(string-to-int (match-string 1)))))
-	     (when (re-search-forward "design capacity warning: +\\([0-9]+\\) m[AW]h$"
-				      nil t)
-	       (setq warn (+ (or warn 0) (string-to-int (match-string 1)))))
-	     (when (re-search-forward "design capacity low: +\\([0-9]+\\) m[AW]h$"
-				      nil t)
-	       (setq low (+ (or low 0)
-			    (string-to-int (match-string 1))))))))
-       (directory-files "/proc/acpi/battery/" t "\\(BAT\\|CMB\\)")))
+  (let ((design-capacity 0)
+	(warn 0)
+	(low 0)
+	capacity rate rate-type charging-state minutes hours)
+    ;; ACPI provides information about each battery present in the system in
+    ;; a separate subdirectory.  We are going to merge the available
+    ;; information together since displaying for a variable amount of
+    ;; batteries seems overkill for format-strings.
+    (with-temp-buffer
+      (dolist (dir (ignore-errors (directory-files "/proc/acpi/battery/"
+						   t "\\`[^.]")))
+	(erase-buffer)
+	(ignore-errors (insert-file-contents (expand-file-name "state" dir)))
+	(when (re-search-forward "present: +yes$" nil t)
+	  (and (re-search-forward "charging state: +\\(.*\\)$" nil t)
+	       (member charging-state '("unknown" nil))
+	       ;; On most multi-battery systems, most of the time only one
+	       ;; battery is "charging"/"discharging", the others are
+	       ;; "unknown".
+	       (setq charging-state (match-string 1)))
+	  (when (re-search-forward "present rate: +\\([0-9]+\\) \\(m[AW]\\)$"
+				   nil t)
+	    (setq rate (+ (or rate 0) (string-to-number (match-string 1)))
+		  rate-type (or (and rate-type
+				     (if (string= rate-type (match-string 2))
+					 rate-type
+				       (error
+					"Inconsistent rate types (%s vs. %s)"
+					rate-type (match-string 2))))
+				(match-string 2))))
+	  (when (re-search-forward "remaining capacity: +\\([0-9]+\\) m[AW]h$"
+				   nil t)
+	    (setq capacity
+		  (+ (or capacity 0) (string-to-number (match-string 1))))))
+	(goto-char (point-max))
+	(ignore-errors (insert-file-contents (expand-file-name "info" dir)))
+	(when (re-search-forward "present: +yes$" nil t)
+	  (when (re-search-forward "design capacity: +\\([0-9]+\\) m[AW]h$"
+				   nil t)
+	    (incf design-capacity (string-to-number (match-string 1))))
+	  (when (re-search-forward
+		 "design capacity warning: +\\([0-9]+\\) m[AW]h$" nil t)
+	    (incf warn (string-to-number (match-string 1))))
+	  (when (re-search-forward "design capacity low: +\\([0-9]+\\) m[AW]h$"
+				   nil t)
+	    (incf low (string-to-number (match-string 1)))))))
     (and capacity rate
 	 (setq minutes (if (zerop rate) 0
 			 (floor (* (/ (float (if (string= charging-state
@@ -327,8 +326,8 @@
 					 rate-type)) "N/A"))
 	  (cons ?B (or charging-state "N/A"))
 	  (cons ?b (or (and (string= charging-state "charging") "+")
-		       (and low (< capacity low) "!")
-		       (and warn (< capacity warn) "-")
+		       (and (< capacity low) "!")
+		       (and (< capacity warn) "-")
 		       ""))
 	  (cons ?h (or (and hours (number-to-string hours)) "N/A"))
 	  (cons ?m (or (and minutes (number-to-string minutes)) "N/A"))
@@ -346,54 +345,16 @@
 
 (defun battery-format (format alist)
   "Substitute %-sequences in FORMAT."
-  (let ((index 0)
-	(length (length format))
-	(result "")
-	char flag elem)
-    (while (< index length)
-      (setq char (aref format index))
-      (if (not flag)
-	  (if (char-equal char ?%)
-	      (setq flag t)
-	    (setq result (concat result (char-to-string char))))
-	(cond ((char-equal char ?%)
-	       (setq result (concat result "%")))
-	      ((setq elem (assoc char alist))
-	       (setq result (concat result (cdr elem)))))
-	(setq flag nil))
-      (setq index (1+ index)))
-    (or (null flag)
-	(setq result (concat result "%")))
-    result))
-
-(defconst battery-hex-map '((?0 .  0) (?1 .  1) (?2 .  2) (?3 .  3)
-			    (?4 .  4) (?5 .  5) (?6 .  6) (?7 .  7)
-			    (?8 .  8) (?9 .  9) (?a . 10) (?b . 11)
-			    (?c . 12) (?d . 13) (?e . 14) (?f . 15)))
-
-(defun battery-hex-to-int (string)
-  "Convert a hexadecimal number (a string) into a number."
-  (save-match-data
-    (and (string-match "^[ \t]+" string)
-	 (setq string (substring string (match-end 0))))
-    (and (string-match "^0[xX]" string)
-	 (setq string (substring string (match-end 0)))))
-  (battery-hex-to-int-2 string))
-
-(defun battery-hex-to-int-2 (string)
-  (let ((index 0)
-	(length (length string))
-	(value 0)
-	(elem nil))
-    (while (and (< index length)
-		(setq elem (assoc (downcase (aref string index))
-				  battery-hex-map)))
-      (setq value (+ (* 16 value) (cdr elem))
-	    index (1+ index)))
-    value))
+  (replace-regexp-in-string
+   "%."
+   (lambda (str)
+     (let ((char (aref str 1)))
+       (if (eq char ?%) "%"
+	 (or (cdr (assoc char alist)) ""))))
+   format t t))
 
 
 (provide 'battery)
 
-;;; arch-tag: 65916f50-4754-4b6b-ac21-0b510f545a37
+;; arch-tag: 65916f50-4754-4b6b-ac21-0b510f545a37
 ;;; battery.el ends here
--- a/lisp/calc/calc-units.el	Thu Sep 16 13:09:53 2004 +0000
+++ b/lisp/calc/calc-units.el	Mon Sep 20 09:41:18 2004 +0000
@@ -297,11 +297,11 @@
 	  (units (calc-var-value 'var-Units))
 	  (expr (calc-top-n 1)))
      (unless (and (>= num 0) (<= num 9))
-       (errunless "Bad unit number"))
+       (error "Bad unit number"))
      (unless (math-vectorp units)
-       (errunless "No \"quick units\" are defined"))
+       (error "No \"quick units\" are defined"))
      (unless (< pos (length units))
-       (errunless "Unit number %d not defined" pos))
+       (error "Unit number %d not defined" pos))
      (if (math-units-in-expr-p expr nil)
 	 (calc-enter-result 1 (format "cun%d" num)
 			    (math-convert-units expr (nth pos units)))
--- a/lisp/calc/calc.el	Thu Sep 16 13:09:53 2004 +0000
+++ b/lisp/calc/calc.el	Mon Sep 20 09:41:18 2004 +0000
@@ -447,7 +447,7 @@
   (calc-vector-brackets "[]"
    "If non-nil, surround displayed vectors with these characters.")
 
-  (calc-matrix-brackets '(R O)
+  (calc-matrix-brackets (R O)
    "A list of code-letter symbols that control \"big\" matrix display.
 If `R' is present, display inner brackets for matrices.
 If `O' is present, display outer brackets for matrices (above/below).
--- a/lisp/cmuscheme.el	Thu Sep 16 13:09:53 2004 +0000
+++ b/lisp/cmuscheme.el	Mon Sep 20 09:41:18 2004 +0000
@@ -1,6 +1,6 @@
 ;;; cmuscheme.el --- Scheme process in a buffer. Adapted from tea.el
 
-;; Copyright (C) 1988, 1994, 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 1994, 1997, 2004  Free Software Foundation, Inc.
 
 ;; Author: Olin Shivers <olin.shivers@cs.cmu.edu>
 ;; Maintainer: FSF
@@ -140,9 +140,9 @@
   (define-key map [switch]
     '("Switch to Scheme" . switch-to-scheme))
   (define-key map [com-def-go]
-    '("Compile Definitiion & Go" . scheme-compile-definition-and-go))
+    '("Compile Definition & Go" . scheme-compile-definition-and-go))
   (define-key map [com-def]
-    '("Compile Definitiion" . scheme-compile-definition))
+    '("Compile Definition" . scheme-compile-definition))
   (define-key map [send-def-go]
     '("Evaluate Last Definition & Go" . scheme-send-definition-and-go))
   (define-key map [send-def]
@@ -437,5 +437,5 @@
 
 (provide 'cmuscheme)
 
-;;; arch-tag: e8795f4a-c496-45a2-97b4-8e0f2a2c57d2
+;; arch-tag: e8795f4a-c496-45a2-97b4-8e0f2a2c57d2
 ;;; cmuscheme.el ends here
--- a/lisp/ediff-init.el	Thu Sep 16 13:09:53 2004 +0000
+++ b/lisp/ediff-init.el	Mon Sep 20 09:41:18 2004 +0000
@@ -902,9 +902,15 @@
 
 
 (defface ediff-current-diff-face-A
-  '((((type tty))    (:foreground "blue3" :background "yellow3"))
-    (((class color)) (:foreground "firebrick" :background "pale green"))
-    (t	     	     (:inverse-video t)))
+  (if ediff-emacs-p
+      '((((class color) (min-colors 16))
+	 (:foreground "firebrick" :background "pale green"))
+	(((class color))
+	 (:foreground "blue3" :background "yellow3"))
+	(t		     (:inverse-video t)))
+    '((((type tty))    (:foreground "blue3" :background "yellow3"))
+      (((class color)) (:foreground "firebrick" :background "pale green"))
+      (t	     	     (:inverse-video t))))
   "Face for highlighting the selected difference in buffer A."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
@@ -925,10 +931,17 @@
 
 
 (defface ediff-current-diff-face-B
-  '((((type tty))    (:foreground "magenta3" :background "yellow3"
-				  :weight bold))
-    (((class color)) (:foreground "DarkOrchid" :background "Yellow"))
-    (t	     	     (:inverse-video t)))
+  (if ediff-emacs-p
+      '((((class color) (min-colors 16))
+	 (:foreground "DarkOrchid" :background "Yellow"))
+	(((class color))
+	 (:foreground "magenta3" :background "yellow3"
+		      :weight bold))
+	(t		     (:inverse-video t)))
+    '((((type tty))    (:foreground "magenta3" :background "yellow3"
+				    :weight bold))
+      (((class color)) (:foreground "DarkOrchid" :background "Yellow"))
+      (t	     	     (:inverse-video t))))
   "Face for highlighting the selected difference in buffer B."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
@@ -948,9 +961,15 @@
 
 
 (defface ediff-current-diff-face-C
-  '((((type tty))    (:foreground "cyan3" :background "yellow3" :weight bold))
-    (((class color)) (:foreground "Navy" :background "Pink"))
-    (t	     	     (:inverse-video t)))
+  (if ediff-emacs-p
+      '((((class color) (min-colors 16))
+	 (:foreground "Navy" :background "Pink"))
+	(((class color))
+	 (:foreground "cyan3" :background "yellow3" :weight bold))
+	(t		     (:inverse-video t)))
+    '((((type tty))    (:foreground "cyan3" :background "yellow3" :weight bold))
+      (((class color)) (:foreground "Navy" :background "Pink"))
+      (t	     	     (:inverse-video t))))
   "Face for highlighting the selected difference in buffer C."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
@@ -970,9 +989,15 @@
 
 
 (defface ediff-current-diff-face-Ancestor
-  '((((type tty))    (:foreground "black" :background "magenta3"))
-    (((class color)) (:foreground "Black" :background "VioletRed"))
-    (t (:inverse-video t)))
+  (if ediff-emacs-p
+      '((((class color) (min-colors 16))
+	 (:foreground "Black" :background "VioletRed"))
+	(((class color))
+	 (:foreground "black" :background "magenta3"))
+	(t (:inverse-video t)))
+    '((((type tty))    (:foreground "black" :background "magenta3"))
+      (((class color)) (:foreground "Black" :background "VioletRed"))
+      (t (:inverse-video t))))
   "Face for highlighting the selected difference in buffer Ancestor."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
@@ -992,9 +1017,15 @@
 
 
 (defface ediff-fine-diff-face-A
-  '((((type tty))    (:foreground "white" :background "sky blue" :weight bold))
-    (((class color)) (:foreground "Navy" :background "sky blue"))
-    (t (:underline t :stipple "gray3")))
+  (if ediff-emacs-p
+      '((((class color) (min-colors 16))
+	 (:foreground "Navy" :background "sky blue"))
+	(((class color))
+	 (:foreground "white" :background "sky blue" :weight bold))
+	(t (:underline t :stipple "gray3")))
+    '((((type tty))    (:foreground "white" :background "sky blue" :weight bold))
+      (((class color)) (:foreground "Navy" :background "sky blue"))
+      (t (:underline t :stipple "gray3"))))
   "Face for highlighting the refinement of the selected diff in buffer A."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
@@ -1007,9 +1038,15 @@
 (ediff-hide-face 'ediff-fine-diff-face-A)
 
 (defface ediff-fine-diff-face-B
-  '((((type tty))    (:foreground "magenta3" :background "cyan3"))
-    (((class color)) (:foreground "Black" :background "cyan"))
-    (t	     	     (:underline t :stipple "gray3")))
+  (if ediff-emacs-p
+      '((((class color) (min-colors 16))
+	 (:foreground "Black" :background "cyan"))
+	(((class color))
+	 (:foreground "magenta3" :background "cyan3"))
+	(t		     (:underline t :stipple "gray3")))
+    '((((type tty))    (:foreground "magenta3" :background "cyan3"))
+      (((class color)) (:foreground "Black" :background "cyan"))
+      (t	     	     (:underline t :stipple "gray3"))))
   "Face for highlighting the refinement of the selected diff in buffer B."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
@@ -1022,11 +1059,20 @@
 (ediff-hide-face 'ediff-fine-diff-face-B)
 
 (defface ediff-fine-diff-face-C
-  '((((type tty))    (:foreground "yellow3" :background "Turquoise"
-				  :weight bold))
-    (((type pc))     (:foreground "white" :background "Turquoise"))
-    (((class color)) (:foreground "Black" :background "Turquoise"))
-    (t (:underline t :stipple "gray3")))
+  (if ediff-emacs-p
+      '((((type pc))
+	 (:foreground "white" :background "Turquoise"))
+	(((class color) (min-colors 16))
+	 (:foreground "Black" :background "Turquoise"))
+	(((class color))
+	 (:foreground "yellow3" :background "Turquoise"
+		      :weight bold))
+	(t (:underline t :stipple "gray3")))
+    '((((type tty))    (:foreground "yellow3" :background "Turquoise"
+				    :weight bold))
+      (((type pc))     (:foreground "white" :background "Turquoise"))
+      (((class color)) (:foreground "Black" :background "Turquoise"))
+      (t (:underline t :stipple "gray3"))))
   "Face for highlighting the refinement of the selected diff in buffer C."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
@@ -1039,9 +1085,15 @@
 (ediff-hide-face 'ediff-fine-diff-face-C)
 
 (defface ediff-fine-diff-face-Ancestor
-  '((((type tty))    (:foreground "red3" :background "green"))
-    (((class color)) (:foreground "Black" :background "Green"))
-    (t	     	     (:underline t :stipple "gray3")))
+  (if ediff-emacs-p
+      '((((class color) (min-colors 16))
+	 (:foreground "Black" :background "Green"))
+	(((class color))
+	 (:foreground "red3" :background "green"))
+	(t		     (:underline t :stipple "gray3")))
+    '((((type tty))    (:foreground "red3" :background "green"))
+      (((class color)) (:foreground "Black" :background "Green"))
+      (t	     	     (:underline t :stipple "gray3"))))
   "Face for highlighting the refinement of the selected diff in the ancestor buffer.
 At present, this face is not used and no fine differences are computed for the
 ancestor buffer."
@@ -1065,11 +1117,20 @@
 	(t "Stipple")))
 
 (defface ediff-even-diff-face-A
-  `((((type tty))    (:foreground "red3" :background "light grey"
-				  :weight bold))
-    (((type pc))     (:foreground "green3" :background "light grey"))
-    (((class color)) (:foreground "Black" :background "light grey"))
-    (t	     	     (:italic t :stipple ,stipple-pixmap)))
+  (if ediff-emacs-p
+      `((((type pc))
+	 (:foreground "green3" :background "light grey"))
+	(((class color) (min-colors 16))
+	 (:foreground "Black" :background "light grey"))
+	(((class color))
+	 (:foreground "red3" :background "light grey"
+		      :weight bold))
+	(t		     (:italic t :stipple ,stipple-pixmap)))
+    `((((type tty))    (:foreground "red3" :background "light grey"
+				    :weight bold))
+      (((type pc))     (:foreground "green3" :background "light grey"))
+      (((class color)) (:foreground "Black" :background "light grey"))
+      (t	     	     (:italic t :stipple ,stipple-pixmap))))
   "Face for highlighting even-numbered non-current differences in buffer A."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
@@ -1082,9 +1143,15 @@
 (ediff-hide-face 'ediff-even-diff-face-A)
 
 (defface ediff-even-diff-face-B
-  `((((type tty))    (:foreground "blue3" :background "Grey" :weight bold))
-    (((class color)) (:foreground "White" :background "Grey"))
-    (t	     	     (:italic t :stipple ,stipple-pixmap)))
+  (if ediff-emacs-p
+      `((((class color) (min-colors 16)) 
+	 (:foreground "White" :background "Grey"))
+	(((class color))    
+	 (:foreground "blue3" :background "Grey" :weight bold))
+	(t		     (:italic t :stipple ,stipple-pixmap)))
+    `((((type tty))    (:foreground "blue3" :background "Grey" :weight bold))
+      (((class color)) (:foreground "White" :background "Grey"))
+      (t	     	     (:italic t :stipple ,stipple-pixmap))))
   "Face for highlighting even-numbered non-current differences in buffer B."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
@@ -1097,11 +1164,20 @@
 (ediff-hide-face 'ediff-even-diff-face-B)
 
 (defface ediff-even-diff-face-C
-  `((((type tty))    (:foreground "yellow3" :background "light grey"
-				  :weight bold))
-    (((type pc))     (:foreground "yellow3" :background "light grey"))
-    (((class color)) (:foreground "Black" :background "light grey"))
-    (t	     	     (:italic t :stipple ,stipple-pixmap)))
+  (if ediff-emacs-p
+      `((((type pc))
+	 (:foreground "yellow3" :background "light grey"))
+	(((class color) (min-colors 16))
+	 (:foreground "Black" :background "light grey"))
+	(((class color))
+	 (:foreground "yellow3" :background "light grey"
+		      :weight bold))
+	(t		     (:italic t :stipple ,stipple-pixmap)))
+    `((((type tty))    (:foreground "yellow3" :background "light grey"
+				    :weight bold))
+      (((type pc))     (:foreground "yellow3" :background "light grey"))
+      (((class color)) (:foreground "Black" :background "light grey"))
+      (t	     	     (:italic t :stipple ,stipple-pixmap))))
   "Face for highlighting even-numbered non-current differences in buffer C."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
@@ -1114,11 +1190,20 @@
 (ediff-hide-face 'ediff-even-diff-face-C)
 
 (defface ediff-even-diff-face-Ancestor
-  `((((type tty))    (:foreground "cyan3" :background "light grey"
-				  :weight bold))
-    (((type pc))     (:foreground "cyan3" :background "light grey"))
-    (((class color)) (:foreground "White" :background "Grey"))
-    (t (:italic t :stipple ,stipple-pixmap)))
+  (if ediff-emacs-p
+      `((((type pc))
+	 (:foreground "cyan3" :background "light grey"))
+	(((class color) (min-colors 16))
+	 (:foreground "White" :background "Grey"))
+	(((class color))
+	 (:foreground "cyan3" :background "light grey"
+		      :weight bold))
+	(t (:italic t :stipple ,stipple-pixmap)))
+    `((((type tty))    (:foreground "cyan3" :background "light grey"
+				    :weight bold))
+      (((type pc))     (:foreground "cyan3" :background "light grey"))
+      (((class color)) (:foreground "White" :background "Grey"))
+      (t (:italic t :stipple ,stipple-pixmap))))
   "Face for highlighting even-numbered non-current differences in the ancestor buffer."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
@@ -1138,10 +1223,18 @@
     (Ancestor . ediff-even-diff-face-Ancestor)))
 
 (defface ediff-odd-diff-face-A
-  '((((type tty))    (:foreground "red3" :background "black" :weight bold))
-    (((type pc))     (:foreground "green3" :background "gray40"))
-    (((class color)) (:foreground "White" :background "Grey"))
-    (t	     	     (:italic t :stipple "gray1")))
+  (if ediff-emacs-p
+      '((((type pc))
+	 (:foreground "green3" :background "gray40"))
+	(((class color) (min-colors 16))
+	 (:foreground "White" :background "Grey"))
+	(((class color))
+	 (:foreground "red3" :background "black" :weight bold))
+	(t		     (:italic t :stipple "gray1")))
+    '((((type tty))    (:foreground "red3" :background "black" :weight bold))
+      (((type pc))     (:foreground "green3" :background "gray40"))
+      (((class color)) (:foreground "White" :background "Grey"))
+      (t	     	     (:italic t :stipple "gray1"))))
   "Face for highlighting odd-numbered non-current differences in buffer A."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
@@ -1155,10 +1248,18 @@
 
 
 (defface ediff-odd-diff-face-B
-  '((((type tty))    (:foreground "cyan3" :background "black" :weight bold))
-    (((type pc))     (:foreground "White" :background "gray40"))
-    (((class color)) (:foreground "Black" :background "light grey"))
-    (t	     	     (:italic t :stipple "gray1")))
+  (if ediff-emacs-p
+      '((((type pc))
+	 (:foreground "White" :background "gray40"))
+	(((class color) (min-colors 16))
+	 (:foreground "Black" :background "light grey"))
+	(((class color))
+	 (:foreground "cyan3" :background "black" :weight bold))
+	(t		     (:italic t :stipple "gray1")))
+    '((((type tty))    (:foreground "cyan3" :background "black" :weight bold))
+      (((type pc))     (:foreground "White" :background "gray40"))
+      (((class color)) (:foreground "Black" :background "light grey"))
+      (t	     	     (:italic t :stipple "gray1"))))
   "Face for highlighting odd-numbered non-current differences in buffer B."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
@@ -1171,10 +1272,18 @@
 (ediff-hide-face 'ediff-odd-diff-face-B)
 
 (defface ediff-odd-diff-face-C
-  '((((type tty))    (:foreground "yellow3" :background "black" :weight bold))
-    (((type pc))     (:foreground "yellow3" :background "gray40"))
-    (((class color)) (:foreground "White" :background "Grey"))
-    (t	     	     (:italic t :stipple "gray1")))
+  (if ediff-emacs-p
+      '((((type pc))
+	 (:foreground "yellow3" :background "gray40"))
+	(((class color) (min-colors 16))
+	 (:foreground "White" :background "Grey"))
+	(((class color))
+	 (:foreground "yellow3" :background "black" :weight bold))
+	(t		     (:italic t :stipple "gray1")))
+    '((((type tty))    (:foreground "yellow3" :background "black" :weight bold))
+      (((type pc))     (:foreground "yellow3" :background "gray40"))
+      (((class color)) (:foreground "White" :background "Grey"))
+      (t	     	     (:italic t :stipple "gray1"))))
   "Face for highlighting odd-numbered non-current differences in buffer C."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
@@ -1187,9 +1296,15 @@
 (ediff-hide-face 'ediff-odd-diff-face-C)
 
 (defface ediff-odd-diff-face-Ancestor
-  '((((type tty))    (:foreground "green3" :background "black" :weight bold))
-    (((class color)) (:foreground "cyan3" :background "gray40"))
-    (t	     	     (:italic t :stipple "gray1")))
+  (if ediff-emacs-p
+      '((((class color) (min-colors 16))
+	 (:foreground "cyan3" :background "gray40"))
+	(((class color))
+	 (:foreground "green3" :background "black" :weight bold))
+	(t		     (:italic t :stipple "gray1")))
+    '((((type tty))    (:foreground "green3" :background "black" :weight bold))
+      (((class color)) (:foreground "cyan3" :background "gray40"))
+      (t	     	     (:italic t :stipple "gray1"))))
   "Face for highlighting odd-numbered non-current differences in the ancestor buffer."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
--- a/lisp/gnus/ChangeLog	Thu Sep 16 13:09:53 2004 +0000
+++ b/lisp/gnus/ChangeLog	Mon Sep 20 09:41:18 2004 +0000
@@ -1,3 +1,12 @@
+2004-09-16  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* gnus-sum.el (gnus-fetch-old-headers): Added custom choices `t'
+	and `invisible'.
+
+2004-09-13  Simon Josefsson  <jas@extundo.com>
+
+	* nnimap.el (nnimap-demule): Revert 2004-08-30 change.
+
 2004-09-13  Reiner Steib  <Reiner.Steib@gmx.de>
 
 	* gnus-sum.el (gnus-summary-copy-article): Fixed doc string.
--- a/lisp/gnus/gnus-sum.el	Thu Sep 16 13:09:53 2004 +0000
+++ b/lisp/gnus/gnus-sum.el	Mon Sep 20 09:41:18 2004 +0000
@@ -63,7 +63,7 @@
   "*Non-nil means that Gnus will try to build threads by grabbing old headers.
 If an unread article in the group refers to an older, already read (or
 just marked as read) article, the old article will not normally be
-displayed in the Summary buffer.  If this variable is non-nil, Gnus
+displayed in the Summary buffer.  If this variable is t, Gnus
 will attempt to grab the headers to the old articles, and thereby
 build complete threads.  If it has the value `some', only enough
 headers to connect otherwise loose threads will be displayed.  This
@@ -74,7 +74,9 @@
 The server has to support NOV for any of this to work."
   :group 'gnus-thread
   :type '(choice (const :tag "off" nil)
+		 (const :tag "on" t)
 		 (const some)
+		 (const invisible)
 		 number
 		 (sexp :menu-tag "other" t)))
 
--- a/lisp/gnus/nnimap.el	Thu Sep 16 13:09:53 2004 +0000
+++ b/lisp/gnus/nnimap.el	Mon Sep 20 09:41:18 2004 +0000
@@ -812,9 +812,11 @@
   ;; BEWARE: we used to use string-as-multibyte here which is braindead
   ;; because it will turn accidental emacs-mule-valid byte sequences
   ;; into multibyte chars.  --Stef
-  (funcall (if (and (fboundp 'string-to-multibyte)
-		    (subrp (symbol-function 'string-to-multibyte)))
-	       'string-to-multibyte
+  ;; Reverted, braindead got 7.5 out of 10 on imdb, so it can't be
+  ;; that bad. --Simon
+  (funcall (if (and (fboundp 'string-as-multibyte)
+		    (subrp (symbol-function 'string-as-multibyte)))
+	       'string-as-multibyte
 	     'identity)
 	   (or string "")))
 
--- a/lisp/ibuf-ext.el	Thu Sep 16 13:09:53 2004 +0000
+++ b/lisp/ibuf-ext.el	Mon Sep 20 09:41:18 2004 +0000
@@ -1018,7 +1018,8 @@
   (ibuffer-awhen (with-current-buffer buf
 		   (or buffer-file-name
 		       (and (boundp 'dired-directory)
-			    dired-directory)))
+			    dired-directory
+			    (expand-file-name dired-directory))))
     (string-match qualifier it)))
 
 ;;;###autoload (autoload 'ibuffer-filter-by-size-gt  "ibuf-ext.el")
--- a/lisp/simple.el	Thu Sep 16 13:09:53 2004 +0000
+++ b/lisp/simple.el	Mon Sep 20 09:41:18 2004 +0000
@@ -282,7 +282,8 @@
   "Major mode not specialized for anything in particular.
 Other major modes are defined by comparison with this one."
   (interactive)
-  (kill-all-local-variables))
+  (kill-all-local-variables)
+  (run-hooks 'after-change-major-mode-hook))
 
 ;; Making and deleting lines.
 
--- a/lisp/subr.el	Thu Sep 16 13:09:53 2004 +0000
+++ b/lisp/subr.el	Mon Sep 20 09:41:18 2004 +0000
@@ -1,7 +1,7 @@
 ;;; subr.el --- basic lisp subroutines for Emacs
 
-;; Copyright (C) 1985, 86, 92, 94, 95, 99, 2000, 2001, 2002, 03, 2004
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1986, 1992, 1994, 1995, 1999, 2000, 2001, 2002, 2003,
+;;   2004  Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: internal
@@ -683,7 +683,7 @@
       (setq event (car event)))
   (if (symbolp event)
       (car (get event 'event-symbol-elements))
-    (let ((base (logand event (1- (lsh 1 18)))))
+    (let ((base (logand event (1- ?\A-\^@))))
       (downcase (if (< base 32) (logior base 64) base)))))
 
 (defsubst mouse-movement-p (object)
@@ -1949,6 +1949,10 @@
 (make-variable-buffer-local 'delayed-mode-hooks)
 (put 'delay-mode-hooks 'permanent-local t)
 
+(defvar after-change-major-mode-hook nil
+  "Mode independent hook run at the end of major mode functions.
+This is run just before the mode dependent hooks.")
+
 (defun run-mode-hooks (&rest hooks)
   "Run mode hooks `delayed-mode-hooks' and HOOKS, or delay HOOKS.
 Execution is delayed if `delay-mode-hooks' is non-nil.
@@ -1960,6 +1964,7 @@
     ;; Normal case, just run the hook as before plus any delayed hooks.
     (setq hooks (nconc (nreverse delayed-mode-hooks) hooks))
     (setq delayed-mode-hooks nil)
+    (run-hooks 'after-change-major-mode-hook)
     (apply 'run-hooks hooks)))
 
 (defmacro delay-mode-hooks (&rest body)
@@ -2656,5 +2661,5 @@
   (put symbol 'abortfunc (or abortfunc 'kill-buffer))
   (put symbol 'hookvar (or hookvar 'mail-send-hook)))
 
-;;; arch-tag: f7e0e6e5-70aa-4897-ae72-7a3511ec40bc
+;; arch-tag: f7e0e6e5-70aa-4897-ae72-7a3511ec40bc
 ;;; subr.el ends here
--- a/lisp/term.el	Thu Sep 16 13:09:53 2004 +0000
+++ b/lisp/term.el	Mon Sep 20 09:41:18 2004 +0000
@@ -396,7 +396,7 @@
 
 ;; This is passed to the inferior in the EMACS environment variable,
 ;; so it is important to increase it if there are protocol-relevant changes.
-(defconst term-protocol-version "0.95")
+(defconst term-protocol-version "0.96")
 
 (eval-when-compile
   (require 'ange-ftp))
@@ -457,7 +457,7 @@
 ;;		we want suppressed.
 (defvar term-terminal-parameter)
 (defvar term-terminal-previous-parameter)
-(defvar term-current-face 'term-default)
+(defvar term-current-face 'default)
 (defvar term-scroll-start 0) ;; Top-most line (inclusive) of scrolling region.
 (defvar term-scroll-end) ;; Number of line (zero-based) after scrolling region.
 (defvar term-pager-count nil) ;; If nil, paging is disabled.
@@ -1365,11 +1365,14 @@
 (defvar term-termcap-format
   "%s%s:li#%d:co#%d:cl=\\E[H\\E[J:cd=\\E[J:bs:am:xn:cm=\\E[%%i%%d;%%dH\
 :nd=\\E[C:up=\\E[A:ce=\\E[K:ho=\\E[H:pt\
-:al=\\E[L:dl=\\E[M:DL=\\E[%%dM:AL=\\E[%%dL:cs=\\E[%%i%%d;%%dr:sf=\\n\
+:al=\\E[L:dl=\\E[M:DL=\\E[%%dM:AL=\\E[%%dL:cs=\\E[%%i%%d;%%dr:sf=^J\
 :te=\\E[2J\\E[?47l\\E8:ti=\\E7\\E[?47h\
 :dc=\\E[P:DC=\\E[%%dP:IC=\\E[%%d@:im=\\E[4h:ei=\\E[4l:mi:\
 :so=\\E[7m:se=\\E[m:us=\\E[4m:ue=\\E[m:md=\\E[1m:mr=\\E[7m:me=\\E[m\
-:UP=\\E[%%dA:DO=\\E[%%dB:LE=\\E[%%dD:RI=\\E[%%dC"
+:UP=\\E[%%dA:DO=\\E[%%dB:LE=\\E[%%dD:RI=\\E[%%dC\
+:kl=\\EOD:kd=\\EOB:kr=\\EOC:ku=\\EOA:kN=\\E[6~:kP=\\E[5~:@7=\\E[4~:kh=\\E[1~\
+:mk=\\E[8m:cb=\\E[1K:op=\\E[39;49m:Co#8:pa#64:AB=\\E[4%%dm:AF=\\E[3%%dm:cr=^M\
+:bl=^G:do=^J:le=^H:ta=^I:se=\E[27m:ue=\E24m:"
 ;;; : -undefine ic
   "termcap capabilities supported")
 
@@ -1386,10 +1389,9 @@
 	 (nconc
 	  (list
 	   (format "TERM=%s" term-term-name)
-	   (if (and (boundp 'system-uses-terminfo) system-uses-terminfo)
-	       (format "TERMINFO=%s" data-directory)
-	    (format term-termcap-format "TERMCAP="
-		    term-term-name term-height term-width))
+	   (format "TERMINFO=%s" data-directory)
+	   (format term-termcap-format "TERMCAP="
+		   term-term-name term-height term-width)
 	   ;; Breaks `./configure' of w3 and url which try to run $EMACS.
 	   (format "EMACS=%s (term:%s)" emacs-version term-protocol-version)
 	   (format "LINES=%d" term-height)
@@ -1409,18 +1411,6 @@
 	   ".."
 	   command switches)))
 
-;;; This should be in Emacs, but it isn't.
-(defun term-mem (item list &optional elt=)
-  "Test to see if ITEM is equal to an item in LIST.
-Option comparison function ELT= defaults to equal."
-  (let ((elt= (or elt= (function equal)))
-	(done nil))
-    (while (and list (not done))
-      (if (funcall elt= item (car list))
-	  (setq done list)
-	  (setq list (cdr list))))
-    done))
-
 
 ;;; Input history processing in a buffer
 ;;; ===========================================================================
@@ -2990,6 +2980,14 @@
    ((eq parameter 8)
     (setq term-ansi-current-invisible 1))
 
+;;; Reset reverse (i.e. terminfo rmso)
+   ((eq parameter 24)
+    (setq term-ansi-current-reverse 0))
+
+;;; Reset underline (i.e. terminfo rmul)
+   ((eq parameter 27)
+    (setq term-ansi-current-underline 0))
+
 ;;; Foreground
    ((and (>= parameter 30) (<= parameter 37))
     (setq term-ansi-current-color (- parameter 29)))
@@ -3044,9 +3042,13 @@
 		    )
 	    (setq term-current-face
 		  (list :background
-			(elt ansi-term-color-vector term-ansi-current-color)
+			(if (= term-ansi-current-color 0)
+			    (face-foreground 'default)
+			    (elt ansi-term-color-vector term-ansi-current-color))
 			:foreground
-			(elt ansi-term-color-vector term-ansi-current-bg-color)))
+			(if (= term-ansi-current-bg-color 0)
+			    (face-background 'default)
+			(elt ansi-term-color-vector term-ansi-current-bg-color))))
 	    (if (= term-ansi-current-bold 1)
 		(setq term-current-face
 		      (append '(:weight bold) term-current-face)))
@@ -3503,7 +3505,7 @@
     (if (and check-for-scroll (or term-scroll-with-delete term-pager-count))
 	(setq down (term-handle-scroll down)))
     (term-adjust-current-row-cache down)
-    (if (/= (point) (point-max))
+    (if (or (/= (point) (point-max)) (< down 0))
 	(setq down (- down (term-vertical-motion down))))
     ;; Extend buffer with extra blank lines if needed.
     (cond ((> down 0)
--- a/lisp/textmodes/enriched.el	Thu Sep 16 13:09:53 2004 +0000
+++ b/lisp/textmodes/enriched.el	Mon Sep 20 09:41:18 2004 +0000
@@ -1,6 +1,6 @@
 ;;; enriched.el --- read and save files in text/enriched format
 
-;; Copyright (c) 1994, 1995, 1996, 2002 Free Software Foundation, Inc.
+;; Copyright (c) 1994, 1995, 1996, 2002, 2004 Free Software Foundation, Inc.
 
 ;; Author: Boris Goldowsky <boris@gnu.org>
 ;; Keywords: wp, faces
@@ -141,7 +141,6 @@
 
 ;;; Internal variables
 
-
 (defcustom enriched-mode-hook nil
   "Hook run after entering/leaving Enriched mode.
 If you set variables in this hook, you should arrange for them to be restored
@@ -155,6 +154,11 @@
 The value is a list of \(VAR VALUE VAR VALUE...).")
 (make-variable-buffer-local 'enriched-old-bindings)
 
+;; Technical internal variable.  Bound to t if `enriched-mode' is
+;; being rerun by a major mode to allow it to restore buffer-local
+;; variables and to correctly update `enriched-old-bindings'.
+(defvar enriched-rerun-flag nil)
+
 ;;;
 ;;; Define the mode
 ;;;
@@ -181,23 +185,21 @@
 	 (while enriched-old-bindings
 	   (set (pop enriched-old-bindings) (pop enriched-old-bindings))))
 
-	((memq 'text/enriched buffer-file-format)
+	((and (memq 'text/enriched buffer-file-format)
+	      (not enriched-rerun-flag))
 	 ;; Mode already on; do nothing.
 	 nil)
 
 	(t				; Turn mode on
-	 (push 'text/enriched buffer-file-format)
+	 (add-to-list 'buffer-file-format 'text/enriched)
 	 ;; Save old variable values before we change them.
 	 ;; These will be restored if we exit Enriched mode.
 	 (setq enriched-old-bindings
 	       (list 'buffer-display-table buffer-display-table
-		     'indent-line-function indent-line-function
 		     'default-text-properties default-text-properties))
-	 (make-local-variable 'indent-line-function)
 	 (make-local-variable 'default-text-properties)
-	 (setq indent-line-function 'indent-to-left-margin ;WHY??  -sm
-	       buffer-display-table  enriched-display-table)
-	 (use-hard-newlines 1 nil)
+	 (setq buffer-display-table  enriched-display-table)
+	 (use-hard-newlines 1 (if enriched-rerun-flag 'never nil))
 	 (let ((sticky (plist-get default-text-properties 'front-sticky))
 	       (p enriched-par-props))
 	   (dolist (x p)
@@ -207,6 +209,20 @@
 		     (plist-put default-text-properties
 				'front-sticky sticky)))))))
 
+(defun enriched-before-change-major-mode ()
+  (when enriched-mode
+    (while enriched-old-bindings
+      (set (pop enriched-old-bindings) (pop enriched-old-bindings)))))
+
+(add-hook 'change-major-mode-hook 'enriched-before-change-major-mode)
+
+(defun enriched-after-change-major-mode ()
+  (when enriched-mode
+    (let ((enriched-rerun-flag t))
+      (enriched-mode 1))))
+
+(add-hook 'after-change-major-mode-hook 'enriched-after-change-major-mode)
+
 ;;;
 ;;; Keybindings
 ;;;
--- a/src/ChangeLog	Thu Sep 16 13:09:53 2004 +0000
+++ b/src/ChangeLog	Mon Sep 20 09:41:18 2004 +0000
@@ -1,3 +1,15 @@
+2004-09-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* xterm.c (x_term_init): Work around a bug in some X servers.
+
+2004-09-18  Richard M. Stallman  <rms@gnu.org>
+
+	* buffer.c (syms_of_buffer) <default-major-mode>: Doc fix.
+
+	* xdisp.c (try_window_reusing_current_matrix):
+	Handle the case where we reach the old displayed text,
+	out of sync with the old line boundary.
+
 2004-09-14  Stefan  <monnier@iro.umontreal.ca>
 
 	* fileio.c (Finsert_file_contents): Fix case of replacement in a
--- a/src/alloc.c	Thu Sep 16 13:09:53 2004 +0000
+++ b/src/alloc.c	Mon Sep 20 09:41:18 2004 +0000
@@ -186,8 +186,11 @@
 
 #ifndef HAVE_SHM
 
-/* Force it into data space!  Initialize it to a nonzero value;
-   otherwise some compilers put it into BSS.  */
+/* Initialize it to a nonzero value to force it into data space
+   (rather than bss space).  That way unexec will remap it into text
+   space (pure), on some systems.  We have not implemented the
+   remapping on more recent systems because this is less important
+   nowadays than in the days of small memories and timesharing.  */
 
 EMACS_INT pure[PURESIZE / sizeof (EMACS_INT)] = {1,};
 #define PUREBEG (char *) pure
--- a/src/buffer.c	Thu Sep 16 13:09:53 2004 +0000
+++ b/src/buffer.c	Mon Sep 20 09:41:18 2004 +0000
@@ -5430,7 +5430,14 @@
 
   DEFVAR_LISP_NOPRO ("default-major-mode", &buffer_defaults.major_mode,
 		     doc: /* *Major mode for new buffers.  Defaults to `fundamental-mode'.
-nil here means use current buffer's major mode.  */);
+nil here means use current buffer's major mode, provided it is not
+marked as "special".
+
+When a mode is used by default, `find-file' switches to it
+before it reads the contents into the buffer and before
+it finishes setting up the buffer.  Thus, the mode and
+its hooks should not expect certain variables such as
+`buffer-read-only' and `buffer-file-coding-system' to be set up.  */);
 
   DEFVAR_PER_BUFFER ("major-mode", &current_buffer->major_mode,
 		     make_number (Lisp_Symbol),
--- a/src/xdisp.c	Thu Sep 16 13:09:53 2004 +0000
+++ b/src/xdisp.c	Mon Sep 20 09:41:18 2004 +0000
@@ -12403,10 +12403,36 @@
       last_text_row = last_reused_text_row = NULL;
 
       while (it.current_y < it.last_visible_y
-	     && IT_CHARPOS (it) < CHARPOS (start)
 	     && !fonts_changed_p)
-	if (display_line (&it))
-	  last_text_row = it.glyph_row - 1;
+	{
+	  /* If we have reached into the characters in the START row,
+	     that means the line boundaries have changed.  So we
+	     can't start copying with the row START.  Maybe it will
+	     work to start copying with the following row.  */
+	  while (IT_CHARPOS (it) > CHARPOS (start))
+	    {
+	      /* Advance to the next row as the "start".  */
+	      start_row++;
+	      start = start_row->start.pos;
+	      /* If there are no more rows to try, or just one, give up.  */
+	      if (start_row == MATRIX_MODE_LINE_ROW (w->current_matrix) - 1
+		  || w->vscroll || MATRIX_ROW_PARTIALLY_VISIBLE_P (start_row)
+		  || CHARPOS (start) == ZV)
+		{
+		  clear_glyph_matrix (w->desired_matrix);
+		  return 0;
+		}
+
+	      start_vpos = MATRIX_ROW_VPOS (start_row, w->current_matrix);
+	    }
+	  /* If we have reached alignment,
+	     we can copy the rest of the rows.  */
+	  if (IT_CHARPOS (it) == CHARPOS (start))
+	    break;
+
+	  if (display_line (&it))
+	    last_text_row = it.glyph_row - 1;
+	}
 
       /* A value of current_y < last_visible_y means that we stopped
 	 at the previous window start, which in turn means that we
@@ -12414,12 +12440,12 @@
       if (it.current_y < it.last_visible_y)
 	{
 	  /* IT.vpos always starts from 0; it counts text lines.  */
-	  nrows_scrolled = it.vpos;
+	  nrows_scrolled = it.vpos - (start_row - MATRIX_FIRST_TEXT_ROW (w->current_matrix));
 
 	  /* Find PT if not already found in the lines displayed.  */
 	  if (w->cursor.vpos < 0)
 	    {
-	      int dy = it.current_y - first_row_y;
+	      int dy = it.current_y - start_row->y;
 
 	      row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
 	      row = row_containing_pos (w, PT, row, NULL, dy);
@@ -12439,7 +12465,7 @@
 	     scroll_run_hook will clear the cursor, and use the
 	     current matrix to get the height of the row the cursor is
 	     in.  */
-	  run.current_y = first_row_y;
+	  run.current_y = start_row->y;
 	  run.desired_y = it.current_y;
 	  run.height = it.last_visible_y - it.current_y;
 
@@ -15334,6 +15360,10 @@
 	    Lisp_Object oprops, aelt;
 	    oprops = Ftext_properties_at (make_number (0), elt);
 
+	    /* If the starting string's properties are not what
+	       we want, translate the string.  Also, if the string
+	       is risky, do that anyway.  */
+
 	    if (NILP (Fequal (props, oprops)) || risky)
 	      {
 		/* If the starting string has properties,
--- a/src/xterm.c	Thu Sep 16 13:09:53 2004 +0000
+++ b/src/xterm.c	Mon Sep 20 09:41:18 2004 +0000
@@ -10450,10 +10450,12 @@
     int screen_number = XScreenNumberOfScreen (dpyinfo->screen);
     double pixels = DisplayHeight (dpyinfo->display, screen_number);
     double mm = DisplayHeightMM (dpyinfo->display, screen_number);
-    dpyinfo->resy = pixels * 25.4 / mm;
+    /* Mac OS X 10.3's Xserver sometimes reports 0.0mm.  */
+    dpyinfo->resy = (mm < 1) ? 100 : pixels * 25.4 / mm;
     pixels = DisplayWidth (dpyinfo->display, screen_number);
+    /* Mac OS X 10.3's Xserver sometimes reports 0.0mm.  */
     mm = DisplayWidthMM (dpyinfo->display, screen_number);
-    dpyinfo->resx = pixels * 25.4 / mm;
+    dpyinfo->resx = (mm < 1) ? 100 : pixels * 25.4 / mm;
   }
 
   dpyinfo->Xatom_wm_protocols