changeset 83019:82c3b4da43ca

Merged in changes from CVS HEAD Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-33 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-34 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-35 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-36 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-37 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-38 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-39 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-40 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-41 Make fringe-drawing stuff compile without a window-system * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-42 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-43 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-44 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-45 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-46 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-47 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-48 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-49 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-50 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-59
author Karoly Lorentey <lorentey@elte.hu>
date Thu, 22 Jan 2004 15:37:19 +0000
parents 1465425fe2d3 (current diff) 4cd105e25246 (diff)
children d617fe346b2b
files lib-src/emacsclient.c lisp/ChangeLog lisp/emacs-lisp/bytecomp.el lisp/term/x-win.el lisp/vc-cvs.el lisp/vc.el src/alloc.c src/buffer.c src/dispextern.h src/dispnew.c src/fontset.c src/keyboard.c src/lisp.h src/lread.c src/macterm.c src/process.c src/w32term.c src/xdisp.c src/xterm.c
diffstat 57 files changed, 2038 insertions(+), 584 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS	Thu Jan 22 02:36:55 2004 +0000
+++ b/etc/NEWS	Thu Jan 22 15:37:19 2004 +0000
@@ -14,6 +14,9 @@
 
 * Installation Changes in Emacs 21.4
 
+---
+** A Bulgarian translation of the Emacs Tutorial is available.
+
 ** You can build Emacs with Gtk+ widgets by specifying `--with-x-toolkit=gtk'
 when you run configure.  This requires Gtk+ 2.0 or newer.  This port
 provides a way to display multilingual text in menus (with some caveats).
@@ -79,10 +82,32 @@
 
 ---
 ** A French translation of the Emacs Tutorial is available.
+** Building with -DENABLE_CHECKING does not automatically build with union
+types any more.  Add -DUSE_LISP_UNION_TYPE if you want union types.
 
 
 * Changes in Emacs 21.4
 
+** On window systems, lines which are exactly as wide as the window
+(not counting the final newline character) are no longer broken into
+two lines on the display (with just the newline on the second line).
+Instead, the newline now "overflows" into the right fringe, and the
+cursor will be displayed in the fringe when positioned on that newline.
+
+The new user option 'overflow-newline-into-fringe' may be set to nil to
+revert to the old behaviour of continuing such lines.
+
+** The buffer boundaries (i.e. first and last line in the buffer) may now
+be marked with bitmaps in the fringes.  In addition, up and down
+arrow bitmaps may be shown at the top and bottom of the right fringe
+if the window can be scrolled in either direction.
+
+This behavior is activated by setting the buffer-local variable
+`indicate-buffer-boundaries' to a non-nil value.  If value is t, both
+boundaries and scrolling arrows are shown; any other non-nil value
+shows only the buffer boundaries.  The default value of this variable
+is found in `default-indicate-buffer-boundaries'.
+
 ** New command `display-local-help' displays any local help at point
 in the echo area.  It is bound to `C-h .'.  It normally displays the
 same string that would be displayed on mouse-over using the
@@ -1526,6 +1551,21 @@
 Meta and Alt:
     (setq x-alt-keysym 'meta)
     (setq x-meta-keysym 'alt)
+
++++
+** vc-annotate-mode enhancements
+
+In vc-annotate mode, you can now use the following key bindings for
+enhanced functionality to browse the annotations of past revisions, or
+to view diffs or log entries directly from vc-annotate-mode:
+
+    P:  annotates the previous revision
+    N:  annotates the next revision
+    J:  annotates the revision at line
+    A:  annotates the revision previous to line
+    D:  shows the diff of the revision at line with its previous revision
+    L:  shows the log of the revision at line
+    W:  annotates the workfile (most up to date) version
 
 * New modes and packages in 21.4
 
@@ -1750,6 +1790,15 @@
 
 * Lisp Changes in Emacs 21.4
 
++++
+** New function `delete-dups' destructively removes `equal' duplicates
+from a list.  Of several `equal' occurrences of an element in the list,
+the last one is kept.
+
++++
+** `declare' is now a macro.  This change was made mostly for
+documentation purposes and should have no real effect on Lisp code.
+
 ** The new hook `before-save-hook' is invoked by `basic-save-buffer'
 before saving buffers.  This allows packages to perform various final
 tasks, for example; it can be used by the copyright package to make
--- a/leim/ChangeLog	Thu Jan 22 02:36:55 2004 +0000
+++ b/leim/ChangeLog	Thu Jan 22 15:37:19 2004 +0000
@@ -1,3 +1,9 @@
+2004-01-22  Ognyan Kulev  <ogi@fmi.uni-sofia.bg>  (tiny change)
+
+	* quail/cyrillic.el ("bulgarian-phonetic"): Docstring fixed.
+	Duplicated entry removed.
+	("bulgarian-bds"): Docstring fixed.
+
 2003-10-06  Dave Love  <fx@gnu.org>
 
 	* quail/latin-ltx.el: Several additions.
--- a/leim/quail/cyrillic.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/leim/quail/cyrillic.el	Thu Jan 22 15:37:19 2004 +0000
@@ -1169,12 +1169,15 @@
 The layout is similar to `cyrillic-translit', but all Bulgarian
 characters are typed with a single key.
 
-Use /& for ,A'(B (Cyrillic paragraph) and /# for $,1uV(B."
+Use /& for ,A'(B (Cyrillic paragraph) and /# for $,1uV(B.
+
+The letters $,1(G(B, $,1(H(B, $,1(I(B and $,1(N(B are not affected by Caps Lock."
  nil t t t t nil nil nil nil nil t)
 
-;;   $,1(O(B  $,1(2(B  $,1(5(B  $,1(@(B  $,1(B(B  $,1(J(B  $,1(C(B  $,1(8(B  $,1(>(B  $,1(?(B  $,1(H(B  $,1(I(B
-;;    $,1(0(B  $,1(A(B  $,1(4(B  $,1(D(B  $,1(3(B  $,1(E(B  $,1(9(B  $,1(:(B  $,1(;(B        $,1(G(B
-;;  $,1(N(B  $,1(7(B  $,1(L(B  $,1(F(B  $,1(6(B  $,1(1(B  $,1(=(B  $,1(<(B
+;;  $,1(G(B
+;;      $,1(O(B  $,1(2(B  $,1(5(B  $,1(@(B  $,1(B(B  $,1(J(B  $,1(C(B  $,1(8(B  $,1(>(B  $,1(?(B  $,1(H(B  $,1(I(B
+;;       $,1(0(B  $,1(A(B  $,1(4(B  $,1(D(B  $,1(3(B  $,1(E(B  $,1(9(B  $,1(:(B  $,1(;(B        $,1(N(B
+;;        $,1(7(B  $,1(L(B  $,1(F(B  $,1(6(B  $,1(1(B  $,1(=(B  $,1(<(B
 
 (quail-define-rules
  ("/&" ?,A'(B)
@@ -1238,7 +1241,6 @@
  ("y" ?$,1(j(B)
  ("x" ?$,1(l(B)
  ("\\" ?$,1(n(B)
- ("|" ?$,1(N(B)
  ("q" ?$,1(o(B))
 
 ;; Based on an implementation by Ognyan Kulev <ogi@fmi.uni-sofia.bg>.
@@ -1248,13 +1250,18 @@
  "bulgarian-bds" "Bulgarian" "$,1(1(4(A(B" nil
  "Bulgarian standard keyboard layout (BDS)
 
-This keyboard layout is standard for Bulgarian typewriters."
+This keyboard layout is standard for Bulgarian typewriters.
+
+The letters $,1(F(B, $,1(<(B, $,1(G(B, $,1(@(B, $,1(;(B, $,1(1(B and $,1(K(B are not affected by Caps Lock.
+
+In addition to original bulgarian typewriter layout, keys \ and |
+are transformed into ' and $,1(K(B respectively."
  nil t t t t nil nil nil nil nil t)
 
-;;  1! 2? 3+ 4" 5% 6= 7: 8/ 9_ 0$,1uV(B -I .V
-;;   ,$,1(k(B $,1(C(B  $,1(5(B  $,1(8(B  $,1(H(B  $,1(I(B  $,1(:(B  $,1(A(B  $,1(4(B  $,1(7(B  $,1(F(B  ;,A'(B
-;;    $,1(l(B  $,1(O(B  $,1(0(B  $,1(>(B  $,1(6(B  $,1(3(B  $,1(B(B  $,1(=(B  $,1(2(B  $,1(<(B  $,1(G(B  ()
-;;     $,1(N(B  $,1(9(B  $,1(J(B  $,1(M(B  $,1(D(B  $,1(E(B  $,1(?(B  $,1(@(B  $,1(;(B  $,1(1(B
+;;  () 1! 2? 3+ 4" 5% 6= 7: 8/ 9_ 0$,1uV(B -I .V
+;;      ,$,1(k(B $,1(C(B  $,1(5(B  $,1(8(B  $,1(H(B  $,1(I(B  $,1(:(B  $,1(A(B  $,1(4(B  $,1(7(B  $,1(F(B  ;,A'(B
+;;       $,1(l(B  $,1(O(B  $,1(0(B  $,1(>(B  $,1(6(B  $,1(3(B  $,1(B(B  $,1(=(B  $,1(2(B  $,1(<(B  $,1(G(B  '$,1(K(B
+;;        $,1(N(B  $,1(9(B  $,1(J(B  $,1(M(B  $,1(D(B  $,1(E(B  $,1(?(B  $,1(@(B  $,1(;(B  $,1(1(B
 
 (quail-define-rules
 
--- a/lib-src/emacsclient.c	Thu Jan 22 02:36:55 2004 +0000
+++ b/lib-src/emacsclient.c	Thu Jan 22 15:37:19 2004 +0000
@@ -1,5 +1,5 @@
 /* Client process that communicates with GNU Emacs acting as server.
-   Copyright (C) 1986, 1987, 1994, 1999, 2000, 2001, 2003
+   Copyright (C) 1986, 1987, 1994, 1999, 2000, 2001, 2003, 2004
    Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -438,9 +438,10 @@
 
   {
     int sock_status = 0;
+    int default_sock = !socket_name;
     int saved_errno = 0;
     
-    if (! socket_name)
+    if (default_sock)
       {
 	socket_name = alloca (system_name_length + 100);
 	sprintf (socket_name, "/tmp/emacs%d-%s/server",
@@ -459,7 +460,7 @@
     /* See if the socket exists, and if it's owned by us. */
     sock_status = socket_status (server.sun_path);
     saved_errno = errno;
-    if (sock_status)
+    if (sock_status && default_sock)
       {
 	/* Failing that, see if LOGNAME or USER exist and differ from
 	   our euid.  If so, look for a socket based on the UID
@@ -476,8 +477,18 @@
 	    if (pw && (pw->pw_uid != geteuid ()))
 	      {
 		/* We're running under su, apparently. */
-		sprintf (server.sun_path, "/tmp/emacs%d-%s/server",
+		sprintf (socket_name, "/tmp/emacs%d-%s/server",
 			 (int) pw->pw_uid, system_name);
+
+		if (strlen (socket_name) < sizeof (server.sun_path))
+		  strcpy (server.sun_path, socket_name);
+		else
+		  {
+		    fprintf (stderr, "%s: socket-name %s too long",
+			     argv[0], socket_name);
+		    exit (1);
+		  }
+
 		sock_status = socket_status (server.sun_path);
                 saved_errno = errno;
 	      }
--- a/lisp/ChangeLog	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/ChangeLog	Thu Jan 22 15:37:19 2004 +0000
@@ -1,22 +1,161 @@
+2004-01-22  Kenichi Handa  <handa@m17n.org>
+
+	* language/cyrillic.el (ccl-encode-windows-1251-font): Rearrange
+	code point (register r1) only for charset mule-unicode-0100-24ff.
+
+2004-01-21  Markus Rost  <rost@mathematik.uni-bielefeld.de>
+
+	* mail/rmail.el (rmail-convert-to-babyl-format): Avoid deleting
+	trailing white space and ensure a final newline.
+
+	* mail/rmail-spam-filter.el (rmail-use-spam-filter): Add autoload
+	cookie.
+
+2004-01-21  Benjamin Rutt  <brutt@bloomington.in.us>
+
+	* vc.el (vc-annotate-mode): Inherit from fundamental-mode and
+	activate view-mode explicitly.
+
+2004-01-21  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* term/x-win.el: Call menu-bar-enable-clipboard and make Paste
+	use clipboard first.
+
+2004-01-20  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* vc-mcvs.el (vc-mcvs-mode-line-string): Remove.  Does not work.
+	(vc-mcvs-workfile-version): Manually macro expand vc-mcvs-cvs.
+	(vc-mcvs-cvs): Remove.
+	(vc-mcvs-command): Remove use of assert.
+
+	* outline.el (outline-insert-heading): Tighten up match.
+	(outline-demote, outline-move-subtree-down): Don't assume anything
+	about outline-regexp.
+
+	* textmodes/texinfo.el (texinfo-mode): Remove ^ from outline-regexp.
+	(texinfo-show-structure): Explicitly add ^, and simplify.
+
+2004-01-20  Glenn Morris  <gmorris@ast.cam.ac.uk>
+
+	* calendar/appt.el (appt-check): Restore usage of
+	appt-issue-message deleted in previous change.
+	(top-level): Activate package when loaded (needed for backwards
+	compatibility).
+
+2004-01-20  Jesper Harder  <harder@ifa.au.dk>
+
+	* mail/smtpmail.el (smtpmail-via-smtp): No need to add two bytes
+	following previous change to smtpmail-send-data.
+
+2004-01-20  Benjamin Rutt  <brutt@bloomington.in.us>
+
+	* vc.el (vc-default-previous-version): Doc enhancement.
+	(vc-default-next-version): New function.
+	(vc-print-log): New arg FOCUS-REV.
+	(vc-annotate-mode): Derive from view-mode.
+	(vc-annotate): New args REVISION, DISPLAY-MODE.
+	(vc-annotate-workfile-version, vc-annotate-extract-revision-at-line)
+	(vc-annotate-revision-at-line, vc-annotate-revision-previous-to-line)
+	(vc-annotate-show-log-revision-at-line, vc-annotate-warp-version)
+	(vc-annotate-show-diff-revision-at-line, vc-current-line)
+	(vc-annotate-prev-version, vc-annotate-next-version): New functions.
+
+	* vc-cvs.el (vc-cvs-annotate-extract-revision-at-line): New function.
+
+2004-01-19  Karl Berry  <karl@gnu.org>
+
+	* textmodes/texinfo.el: Use "Texinfo" consistently, no "TeXinfo"
+	or "TexInfo".
+
+2004-01-19  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* subr.el (delete-dups): New function.
+
+2004-01-19  Karl Berry  <karl@gnu.org>
+
+	* textmodes/texinfo.el (texinfo-mode): Define outline-regexp to start
+	with ^, since that's what texinfo-show-structure
+	documentation says (plus it works much better in texinfo.txi).
+
+2004-01-18  Jesper Harder  <harder@ifa.au.dk>
+
+	* mail/smtpmail.el (smtpmail-send-data): Don't append spurious newline.
+
+2004-01-18   David Ponce  <david@dponce.com>  (tiny change)
+
+	* progmodes/which-func.el (which-function-mode): Don't cancel
+	which-func-update-timer if not set.
+
+2004-01-17  Thien-Thi Nguyen  <ttn@gnu.org>
+
+	* calendar/diary-lib.el (diary-entry-time): Fix typo/bug:
+	Remove spurious left square bracket in XX:XXam regexp.
+
+2004-01-16  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* progmodes/cc-defs.el: Do not require cl at run time.
+
+2004-01-16  Richard M. Stallman  <rms@gnu.org>
+
+	* emacs-lisp/cl.el (cl-cannot-unload): New function.
+	(cl-unload-hook): Defvar this to run cl-cannot-unload.
+
+	* mail/rmail.el (rmail-get-new-mail): New local rsf-number-of-spam.
+	Call rmail-spam-filter.  Delete and expunge spam.
+	Print number of spam messages deleted.
+	Save and restore the deletion status of old messages when reading
+	new mail with spam filter, so that expunging spam does not expunge
+	msgs deleted by the user.
+	(rmail-only-expunge): Add an optional argument dont-show to
+	prevent showing message after expunge.
+
+2004-01-15  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* emacs-lisp/cl.el (declare): Add `fmakunbound' for `declare'.
+	* subr.el (declare): New macro.
+
+2004-01-15  Thien-Thi Nguyen  <ttn@gnu.org>
+
+	* progmodes/scheme.el (scheme-font-lock-keywords-2): Add "force".
+
+2004-01-14  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* mwheel.el (mouse-wheel-down-event, mouse-wheel-up-event):
+	Test window-system rather than system-type (for X11/Mac).
+
+2004-01-12  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* emacs-lisp/bytecomp.el (compile-defun): Doc fix.
+
+2004-01-12  Richard M. Stallman  <rms@gnu.org>
+
+	* mail/rmail.el (rmail-convert-to-babyl-format):
+	Use mail-unquote-printable-region.
+	(rmail-hex-string-to-integer, rmail-decode-quoted-printable):
+	(rmail-hex-char-to-integer): Functions deleted.
+
+	* mail/mail-utils.el (mail-unquote-printable-hexdigit): Upcase CHAR.
+	(mail-unquote-printable-region): New arg NOERROR.
+	For invalid encoding, either signal an error to just return nil.
+
 2004-01-11  Glenn Morris  <gmorris@ast.cam.ac.uk>
 
 	* calendar/appt.el: Update copyright and commentary.
-	(appt-issue-message): Delete (see appt-activate).
+	(appt-issue-message): Make obsolete.
 	(appt-visible, appt-msg-window): Make obsolete, in favour of
 	appt-display-format.
 	(appt-display-mode-line, appt-display-duration)
 	(appt-display-diary, appt-time-msg-list, appt-mode-string)
 	(appt-prev-comp-time, appt-display-count, appt-timer)
 	(appt-convert-time): Doc change.
-	(appt-disp-window-function, appt-delete-window-function): Use
-	defcustom rather than defvar.
+	(appt-disp-window-function, appt-delete-window-function):
+	Use defcustom rather than defvar.
 	(appt-display-format): New variable.
-	(appt-display-message): New function with display code from
-	appt-check.
-	(appt-check): Add optional FORCE argument.  Doc change.  Add
-	appt-make-list to diary-hook if displaying diary.  Remove
-	checking of view-diary-entries-initially.  Message
-	display section removed to new function appt-display-message.
+	(appt-display-message): New function with display code from appt-check.
+	(appt-check): Add optional FORCE argument.  Doc change.
+	Add appt-make-list to diary-hook if displaying diary.
+	Remove checking of view-diary-entries-initially.
+	Message display section removed to new function appt-display-message.
 	(appt-display-window): Doc change.  Remove unused internal var
 	this-buffer.  Do not beep, since appt-display-message does that.
 	(appt-make-list): Doc change.  Use caar.
@@ -27,12 +166,10 @@
 	functionality.
 
 	* calendar/cal-x.el: (calendar-one-frame-setup)
-	(calendar-only-one-frame-setup, calendar-two-frame-setup): Doc
-	change.
+	(calendar-only-one-frame-setup, calendar-two-frame-setup): Doc change.
 
 	* calendar/calendar.el: Update copyright.
-	(view-diary-entries-initially, european-calendar-style): Doc
-	change.
+	(view-diary-entries-initially, european-calendar-style): Doc change.
 	(calendar-setup): Make defcustom rather than defvar.
 	(mark-visible-calendar-date): Initialize temp-face and faceinfo
 	in let binding so local to function.
@@ -71,8 +208,7 @@
 
 2004-01-07  Nick Roberts  <nick@nick.uklinux.net>
 
-	* progmodes/gud.el (gdb-first-prompt): Renamed from
-	gdb-first-pre-prompt
+	* progmodes/gud.el (gdb-first-prompt): Rename from gdb-first-pre-prompt
 
 	* gdb-ui.el (gdba): Avoid duplication, use gdb-ann3.
 	(gdb-ann3): Use GDB command "set width 0" to prevent word wrapping
@@ -140,7 +276,7 @@
 
 	* textmodes/tex-mode.el (latex-find-indent): Avoid error at end of buf.
 
-	* emacs-lisp/lisp-mnt.el (lm-section-end): require outline.
+	* emacs-lisp/lisp-mnt.el (lm-section-end): Require outline.
 
 	* progmodes/grep.el (grep-mode-map):
 	Don't remap next-line, previous-line.
@@ -219,9 +355,9 @@
 	gud-n.*, gud-ni.*, gud-s.*, and gud-si.*, respectively, to avoid
 	file-name clashes on 8+3 filesystems.
 
-	* emacs-lisp/tcover-unsafep.el, emacs-lisp/tcover-ses.el: Renamed
-	from testcover-unsafep.el and testcover-ses.el to avoid file-name
-	clashes on 8+3 DOS filesystems.
+	* emacs-lisp/tcover-unsafep.el, emacs-lisp/tcover-ses.el:
+	Renamed from testcover-unsafep.el and testcover-ses.el to avoid
+	file-name clashes on 8+3 DOS filesystems.
 
 2003-12-29  Richard M. Stallman  <rms@gnu.org>
 
@@ -334,7 +470,7 @@
 
 	* xml.el (xml-get-attribute-or-nil): New function, like
 	xml-get-attribute, but returns nil if the attribute was not found.
-	(xml-get-attribute): Converted to defsubst, uses
+	(xml-get-attribute): Convert to defsubst, uses
 	xml-get-attribute-or-nil.
 
 2003-12-29  Eli Zaretskii  <eliz@elta.co.il>
@@ -370,8 +506,8 @@
 
 2003-12-29  Kenichi Handa  <handa@m17n.org>
 
-	* international/mule-cmds.el (reset-language-environment): Call
-	set-overriding-fontspec-internal with nil.
+	* international/mule-cmds.el (reset-language-environment):
+	Call set-overriding-fontspec-internal with nil.
 	(set-language-environment): Call set-overriding-fontspec-internal
 	if the language environment specify `overriding-fontspec'.
 	(language-info-alist): Doc added.
@@ -461,12 +597,12 @@
 
 2003-12-24  Kenichi Handa  <handa@m17n.org>
 
-	* international/mule-cmds.el (set-default-coding-systems): Call
-	ucs-set-table-for-input for all buffers that don't have local
+	* international/mule-cmds.el (set-default-coding-systems):
+	Call ucs-set-table-for-input for all buffers that don't have local
 	value of buffer-file-coding-system.
 
-	* international/ucs-tables.el (ucs-set-table-for-input): If
-	translation-table-for-encode is a symbol, get its
+	* international/ucs-tables.el (ucs-set-table-for-input):
+	If translation-table-for-encode is a symbol, get its
 	translation-table property.
 
 2003-12-23  Luc Teirlinck  <teirllm@auburn.edu>
@@ -475,11 +611,11 @@
 	to `completing-read' on a recently fixed bug.
 
 	* fringe.el (fringe-query-style): Suggest `?' in minibuffer prompt,
-	instead of SPACE, to get the list of possible fringe modes.  SPACE
-	only works if both `partial-completion-mode' and
+	instead of SPACE, to get the list of possible fringe modes.
+	SPACE only works if both `partial-completion-mode' and
 	`completion-auto-help' are nil.
 
-	* complete.el (PC-is-complete-p): delete.
+	* complete.el (PC-is-complete-p): Delete.
 	(PC-do-completion): Replace all calls to `PC-is-complete-p' with
 	calls to `test-completion'.
 
@@ -490,17 +626,15 @@
 
 	* gdb-ui.el (gdba, gdb-assembler-mode): Call the mode "Machine" as
 	a mode called "Assembler" already exists.
-	(gdb-use-colon-colon-notation, gdb-show-changed-values): New
-	options.
-	(gud-watch): Use format option. Remove font properties from
-	string.
-	(gdb-var-create-handler, gdb-var-list-children-handler): Don't
-	bother about properties as there are none.
+	(gdb-use-colon-colon-notation, gdb-show-changed-values): New options.
+	(gud-watch): Use format option. Remove font properties from string.
+	(gdb-var-create-handler, gdb-var-list-children-handler):
+	Don't bother about properties as there are none.
 	(gdb-var-create-handler, gdb-var-list-children-handler)
 	(gdb-var-update-handler): Call gdb-var-evaluate-expression-handler
 	with two arguments.
-	(gdb-var-evaluate-expression-handler, gdb-post-prompt): Let
-	speedbar show value changes with a different font.
+	(gdb-var-evaluate-expression-handler, gdb-post-prompt):
+	Let speedbar show value changes with a different font.
 	(gdb-edit-value): New defun.
 	(gdb-clear-partial-output, gdb-clear-inferior-io)
 	(def-gdb-auto-update-handler): Use erase-buffer.
@@ -523,11 +657,10 @@
 	(widget-type-default-get, widget-type-match): New functions.
 	(lazy): New widget.
 	(menu-choice, checklist, radio-button-choice, editable-list)
-	(group, documentation-string): Removed redundant (per 2003-10-25
+	(group, documentation-string): Remove redundant (per 2003-10-25
 	change) calls to `widget-children-value-delete'.
-	(widget-choice-value-get, widget-choice-value-inline): Removed
-	functions.
-	(menu-choice): Updated widget.
+	(widget-choice-value-get, widget-choice-value-inline): Remove.
+	(menu-choice): Update widget.
 
 2003-12-03  Kenichi Handa  <handa@m17n.org>
 
@@ -581,19 +714,18 @@
 	parameter for backward compatibility reasons.
 	(tramp-perl-file-attributes): Add a new parameter to Perl script
 	in order to handle uid/gid as strings, if desired.
-	(tramp-handle-file-truename, tramp-handle-file-symlink-p): Apply
-	`file-attributes' instead of `tramp-handle-file-attributes' in
+	(tramp-handle-file-truename, tramp-handle-file-symlink-p):
+	Apply `file-attributes' instead of `tramp-handle-file-attributes' in
 	order to make the function more general.
 	(tramp-handle-file-attributes): Replace proprietary optional
-	parameter NONNUMERIC by the recently (Emacs 21.4) introduced
-	ID-FORMAT.
+	parameter NONNUMERIC by the recently (Emacs 21.4) introduced ID-FORMAT.
 	(tramp-handle-file-attributes-with-perl): Handle parameter
 	NONNUMERIC if set. This wasn't done in the past.
 	(tramp-post-connection): Apply second parameter "$2" if
 	`tramp-remote-perl' is called.
 
-	* net/tramp-smb.el (tramp-smb-handle-delete-file): Correct
-	cut'n'waste error (`filename' instead of `directory').
+	* net/tramp-smb.el (tramp-smb-handle-delete-file):
+	Correct cut'n'waste error (`filename' instead of `directory').
 	(tramp-smb-handle-directory-files-and-attributes)
 	(tramp-smb-handle-file-attributes): Add recently (Emacs 21.4)
 	introduced parameter ID-FORMAT.
@@ -616,8 +748,8 @@
 
 2003-11-30  Jonathan Yavner  <jyavner@member.fsf.org>
 
-	* subr.el (noreturn, 1value): New macros for test coverage.  See
-	`testcover.el'.
+	* subr.el (noreturn, 1value): New macros for test coverage.
+	See `testcover.el'.
 
 	* emacs-lisp/edebug.el: Add def-edebug-spec for `noreturn' and `1value'.
 
@@ -637,10 +769,20 @@
 
 	* cus-start.el (all): Add use-file-dialog.
 
+2003-11-27  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* textmodes/tex-mode.el (latex-mode): `tex-trailer' is not a regexp.
+
 2003-11-27  Kim F. Storm  <storm@cua.dk>
 
 	* subr.el (posn-object-x-y): New defun.
 
+2003-11-26  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* progmodes/make-mode.el (makefile-font-lock-syntactic-keywords):
+	Don't use `space' for \\\n.
+	Be more selective as to which # are comment-starters.
+
 2003-11-26  Luc Teirlinck  <teirllm@auburn.edu>
 
 	* subr.el (number-sequence): Improve handling of floating point
@@ -747,14 +889,19 @@
 	(breakpoint-enabled-icon, breakpoint-disabled-icon): Set :ascent
 	to 100 for icons to avoid increasing line height when shown.
 
+2003-11-17  Jesper Harder  <harder@ifa.au.dk>  (tiny change)
+
+	* newcomment.el (comment-normalize-vars): Initialize properly if
+	comment-start was nil.
+
 2003-11-19  Andreas Schwab  <schwab@suse.de>
 
 	* simple.el (set-variable): Fix indentation.
 
 2003-11-17  Kenichi Handa  <handa@m17n.org>
 
-	* international/latin1-disp.el (latin1-display-ucs-per-lynx): Fix
-	docstring.
+	* international/latin1-disp.el (latin1-display-ucs-per-lynx):
+	Fix docstring.
 
 2003-11-17  Jesper Harder  <harder@ifa.au.dk>  (tiny change)
 
@@ -771,13 +918,13 @@
 
 2003-11-16  Martin Stjernholm  <bug-cc-mode@gnu.org>
 
-	* cc-engine.el (c-guess-continued-construct,
-	c-guess-basic-syntax): Check a little more carefully if it's a
+	* cc-engine.el (c-guess-continued-construct)
+	(c-guess-basic-syntax): Check a little more carefully if it's a
 	function declaration when an unknown construct followed by a block
 	is found inside a statement context.  This avoids macros followed
 	by blocks to be taken as function declarations.
 
-	(c-guess-continued-construct): Changed the analysis of a statement
+	(c-guess-continued-construct): Change the analysis of a statement
 	continuation with a brace open to `substatement-block', for
 	consistency with recognized statements.
 
@@ -785,9 +932,9 @@
 	start is in a position so that `c-beginning-of-statement-1' jumped
 	to the beginning of the same statement.
 
-	* cc-fonts.el, cc-engine.el (c-forward-<>-arglist-recur): Don't
-	accept binary operators in the arglist if we're in a function call
-	context, i.e. if `c-restricted-<>-arglists' is set.  That avoids
+	* cc-fonts.el, cc-engine.el (c-forward-<>-arglist-recur):
+	Don't accept binary operators in the arglist if we're in a function
+	call context, i.e. if `c-restricted-<>-arglists' is set.  That avoids
 	template recognition in cases like "if (a < b || c > d)".
 
 	(c-restricted-<>-arglists): New more appropriate name for
@@ -805,7 +952,7 @@
 	instead of duplicating parts of it.  This fixes bogus label
 	recognition.
 
-	* cc-align.el (c-gnu-impose-minimum): Reverted to the old method
+	* cc-align.el (c-gnu-impose-minimum): Revert to the old method
 	of checking the context in which to apply the minimum indentation,
 	so that it isn't enforced in e.g. namespace blocks.
 
@@ -813,19 +960,18 @@
 	`c-gnu-impose-minimum'.  It's defined close to `c-offsets-alist'
 	to somewhat reduce the risk of becoming stale.
 
-	* cc-cmds.el, cc-engine.el (c-shift-line-indentation): Moved from
+	* cc-cmds.el, cc-engine.el (c-shift-line-indentation): Move from
 	cc-cmds to cc-engine to allow use from cc-align.
 
 	* cc-engine.el (c-beginning-of-inheritance-list): Cope with fully
 	qualified identifiers containing "::".
 
-	* cc-defs.el (c-make-keywords-re): Added kludge for bug in
+	* cc-defs.el (c-make-keywords-re): Add kludge for bug in
 	`regexp-opt' in Emacs 20 and XEmacs when strings contain newlines.
 
 	* cc-vars.el (c-emacs-features): Use a space in front of the name
 	of the temporary buffer.  That also avoids dumping problems in
-	XEmacs due to undo info being left around after the buffer is
-	killed.
+	XEmacs due to undo info being left around after the buffer is killed.
 
 	* cc-engine.el (c-in-knr-argdecl): Look closer at the function
 	arglist to see if it's a K&R style declaration.
@@ -845,22 +991,21 @@
 
 2003-11-14  Thien-Thi Nguyen  <ttn@gnu.org>
 
-	* diff-mode.el (diff-hunk-prev, diff-hunk-next): Support
-	operation while narrowed, with `diff-restrict-view'.
+	* diff-mode.el (diff-hunk-prev, diff-hunk-next):
+	Support operation while narrowed, with `diff-restrict-view'.
 
 2003-11-14  Thien-Thi Nguyen  <ttn@gnu.org>
 
-	* emacs-lisp/easy-mmode.el (easy-mmode-define-navigation): Take
-	additional optional arg NARROWFUN.  For the generated functions: Add
-	local var `was-narrowed-p'.  Also, if NARROWFUN is specified, include
-	frags that arrange to check for and save narrowing state before the
-	move and then conditionally call NARROWFUN after the move.
+	* emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
+	Take additional optional arg NARROWFUN.  For the generated functions:
+	Add local var `was-narrowed-p'.  Also, if NARROWFUN is specified,
+	include frags that arrange to check for and save narrowing state before
+	the move and then conditionally call NARROWFUN after the move.
 
 2003-11-14  John Wiegley  <johnw@newartisans.com>
 
-	* eshell/esh-var.el (eshell-parse-variable-ref): Added a backslash
-	that was optional, but obviously missing based on surrounding
-	code.
+	* eshell/esh-var.el (eshell-parse-variable-ref): Add a backslash
+	that was optional, but obviously missing based on surrounding code.
 
 	* eshell/esh-cmd.el (eshell-lisp-command): Do not late-convert
 	string arguments to numbers unless the whole argument was seen as
@@ -868,16 +1013,16 @@
 
 2003-11-14  Kenichi Handa  <handa@m17n.org>
 
-	* international/mule.el (ctext-non-standard-encodings-alist): Fix
-	coding systems.
+	* international/mule.el (ctext-non-standard-encodings-alist):
+	Fix coding systems.
 
 2003-11-10  Kenichi Handa  <handa@m17n.org>
 
 	* language/kannada.el ("Kannada"): Add sample-text.
 
 	* language/knd-util.el (kannada-compose-region)
-	(kannada-compose-string, kannada-post-read-conversion): Add
-	autoload cookie.
+	(kannada-compose-string, kannada-post-read-conversion):
+	Add autoload cookie.
 
 	* international/quail.el (quail-completion): Change the message
 	"corresponding translations" to "corresponding characters".
@@ -906,8 +1051,8 @@
 
 2003-11-07  Andreas Schwab  <schwab@suse.de>
 
-	* progmodes/autoconf.el (autoconf-font-lock-keywords): Also
-	highlight AH_*.
+	* progmodes/autoconf.el (autoconf-font-lock-keywords):
+	Also highlight AH_*.
 
 	* xml.el (xml-parse-dtd): Fix misplaced paren.
 
@@ -926,10 +1071,14 @@
 
 	* files.el (risky-local-variable-p): Make second argument optional.
 
+2003-11-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* subr.el (add-hook): Fix last change.
+
 2003-11-03  Eli Zaretskii  <eliz@elta.co.il>
 
-	* mail/rmail.el (rmail-convert-to-babyl-format): If
-	base64-decode-region signals an error, catch it and silently
+	* mail/rmail.el (rmail-convert-to-babyl-format):
+	If base64-decode-region signals an error, catch it and silently
 	ignore it.
 
 2003-11-01  Mark A. Hershberger  <mah@everybody.org>
@@ -938,8 +1087,7 @@
 	topmost element has closed.
 	(xml-ns-parse-ns-attrs, xml-ns-expand-el)
 	(xml-ns-expand-attr): New functions to do namespace handling.
-	(xml-intern-attrlist): Back-compatible handling of attribute
-	names.
+	(xml-intern-attrlist): Back-compatible handling of attribute names.
 	(xml-parse-tag): Move namespace handling to seperate functions.
 	Now produces elements in the form ((:ns . "element") (attr-list)
 	children) instead of ('ns:element (attr-list) children).
@@ -979,10 +1127,8 @@
 	(isearch-lazy-highlight-new-loop): Pay attention to the window's
 	end (thru isearch-lazy-highlight-window-end), not only its start.
 
-	* simple.el (overriding-map-is-bound, saved-overriding-map): New
-	variables.
-	(ensure-overriding-map-is-bound, restore-overriding-map): New
-	functions.
+	* simple.el (overriding-map-is-bound, saved-overriding-map): New vars.
+	(ensure-overriding-map-is-bound, restore-overriding-map): New funs.
 	(universal-argument, universal-argument-more, negative-argument)
 	(digit-argument, universal-argument-other-key): Minor changes.
 
--- a/lisp/calendar/appt.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/calendar/appt.el	Thu Jan 22 15:37:19 2004 +0000
@@ -341,7 +341,7 @@
 	  ;; get the first time off of the list
 	  ;; and calculate the number of minutes until the appointment.
 
-	  (if appt-time-msg-list
+	  (if (and appt-issue-message appt-time-msg-list)
 	      (let ((appt-comp-time (car (car (car appt-time-msg-list)))))
 		(setq min-to-app (- appt-comp-time cur-comp-time))
 
@@ -659,6 +659,10 @@
       (appt-check t))))
 
 
+;; This is needed for backwards compatibility. Feh.
+(appt-activate 1)
+
+
 (provide 'appt)
 
 ;;; arch-tag: bf5791c4-8921-499e-a26f-772b1788d347
--- a/lisp/calendar/diary-lib.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/calendar/diary-lib.el	Thu Jan 22 15:37:19 2004 +0000
@@ -1118,7 +1118,7 @@
 	      (if (equal ?a (downcase (aref s (match-beginning 2))))
 		  0 1200)))
 	  ((string-match        ; Hour and minute  XX:XXam or XX:XXpm
-	    "\\`[ \t\n\\^M]*\\([0-9]?[0-9]\\)[:.][\\([0-9][0-9]\\)\\([ap]\\)m\\>" s)
+	    "\\`[ \t\n\\^M]*\\([0-9]?[0-9]\\)[:.]\\([0-9][0-9]\\)\\([ap]\\)m\\>" s)
 	   (+ (* 100 (% (string-to-int
 			   (substring s (match-beginning 1) (match-end 1)))
 			  12))
--- a/lisp/emacs-lisp/bytecomp.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/emacs-lisp/bytecomp.el	Thu Jan 22 15:37:19 2004 +0000
@@ -10,7 +10,7 @@
 
 ;;; This version incorporates changes up to version 2.10 of the
 ;;; Zawinski-Furuseth compiler.
-(defconst byte-compile-version "$Revision: 2.139 $")
+(defconst byte-compile-version "$Revision: 2.141 $")
 
 ;; This file is part of GNU Emacs.
 
@@ -75,7 +75,7 @@
 ;; User customization variables:
 ;;
 ;; byte-compile-verbose	Whether to report the function currently being
-;;				compiled in the minibuffer;
+;;				compiled in the echo area;
 ;; byte-optimize		Whether to do optimizations; this may be
 ;;				t, nil, 'source, or 'byte;
 ;; byte-optimize-log		Whether to report (in excruciating detail)
@@ -130,7 +130,7 @@
 ;;		 (baz 0))
 ;;
 ;;  o	It is possible to open-code a function in the same file it is defined
-;;	in without having to load that file before compiling it.  the
+;;	in without having to load that file before compiling it.  The
 ;;	byte-compiler has been modified to remember function definitions in
 ;;	the compilation environment in the same way that it remembers macro
 ;;	definitions.
@@ -1658,7 +1658,7 @@
 ;;;###autoload
 (defun compile-defun (&optional arg)
   "Compile and evaluate the current top-level form.
-Print the result in the minibuffer.
+Print the result in the echo area.
 With argument, insert value in current buffer after the form."
   (interactive "P")
   (save-excursion
--- a/lisp/emacs-lisp/cl.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/emacs-lisp/cl.el	Thu Jan 22 15:37:19 2004 +0000
@@ -108,6 +108,10 @@
 This variable is not used at present, but it is defined in hopes that
 a future Emacs interpreter will be able to use it.")
 
+(defvar cl-unload-hook '(cl-cannot-unload)
+  "Prevent unloading the feature `cl', since it does not work.")
+(defun cl-cannot-unload ()
+  (error "Cannot unload the feature `cl'"))
 
 ;;; Predicates.
 
@@ -579,9 +583,10 @@
   "Non-nil means don't make CL functions autoload.")
 
 ;;; Autoload the other portions of the package.
-;; We want to replace the basic versions of dolist, dotimes below.
+;; We want to replace the basic versions of dolist, dotimes, declare below.
 (fmakunbound 'dolist)
 (fmakunbound 'dotimes)
+(fmakunbound 'declare)
 (mapcar (function
 	 (lambda (set)
 	   (let ((file (if cl-fake-autoloads "<none>" (car set))))
--- a/lisp/files.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/files.el	Thu Jan 22 15:37:19 2004 +0000
@@ -2429,7 +2429,7 @@
 
 If you specify just a directory name as FILENAME, that means to use
 the default file name but in that directory.  You can also yank
-the default file name into the minibuffer to edit it, using M-n.
+the default file name into the minibuffer to edit it, using \\<minibuffer-local-map>\\[next-history-element].
 
 If the buffer is not already visiting a file, the default file name
 for the output file is the buffer name.
--- a/lisp/gnus/mm-util.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/gnus/mm-util.el	Thu Jan 22 15:37:19 2004 +0000
@@ -454,7 +454,7 @@
     (mm-mule-charset-to-mime-charset charset)))
 
 (defun mm-delete-duplicates (list)
-  "Simple  substitute for CL `delete-duplicates', testing with `equal'."
+  "Simple substitute for CL `delete-duplicates', testing with `equal'."
   (let (result head)
     (while list
       (setq head (car list))
--- a/lisp/language/cyrillic.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/language/cyrillic.el	Thu Jan 22 15:37:19 2004 +0000
@@ -476,11 +476,11 @@
     (push elt ctext-non-standard-encodings-alist)))
 
 (define-ccl-program ccl-encode-windows-1251-font
-  '(0
-    ((r1 <<= 7)
-     (r1 += r2)
-     (translate-character encode-windows-1251 r0 r1)
-     )))
+  `(0
+    ((if (r0 == ,(charset-id 'mule-unicode-0100-24ff))
+	 ((r1 <<= 7)
+	  (r1 += r2)))
+     (translate-character encode-windows-1251 r0 r1))))
 
 (add-to-list 'font-ccl-encoder-alist
 	     '("microsoft-cp1251" . ccl-encode-windows-1251-font))
--- a/lisp/loadhist.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/loadhist.el	Thu Jan 22 15:37:19 2004 +0000
@@ -137,8 +137,8 @@
     ;; Try to avoid losing badly when hooks installed in critical
     ;; places go away.  (Some packages install things on
     ;; `kill-buffer-hook', `activate-menubar-hook' and the like.)
-    ;; First off, provide a clean way for package `foo' to arrange
-    ;; this by defining `foo-unload-hook'.
+    ;; First off, provide a clean way for package FOO to arrange
+    ;; this by adding hooks on the variable `FOO-unload-hook'.
     (if unload-hook
         (run-hooks unload-hook)
       ;; Otherwise, do our best.  Look through the obarray for symbols
--- a/lisp/mail/mail-utils.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/mail/mail-utils.el	Thu Jan 22 15:37:19 2004 +0000
@@ -79,6 +79,7 @@
 	(concat result (substring string i))))))
 
 (defun mail-unquote-printable-hexdigit (char)
+  (setq char (upcase char))
   (if (>= char ?A)
       (+ (- char ?A) 10)
     (- char ?0)))
@@ -107,31 +108,41 @@
       (apply 'concat (nreverse (cons (substring string i) strings))))))
 
 ;;;###autoload
-(defun mail-unquote-printable-region (beg end &optional wrapper)
+(defun mail-unquote-printable-region (beg end &optional wrapper noerror)
   "Undo the \"quoted printable\" encoding in buffer from BEG to END.
 If the optional argument WRAPPER is non-nil,
-we expect to find and remove the wrapper characters =?ISO-8859-1?Q?....?=."
+we expect to find and remove the wrapper characters =?ISO-8859-1?Q?....?=.
+If NOERROR is non-nil, return t if successful."
   (interactive "r\nP")
-  (save-match-data
-    (save-excursion
-      (save-restriction
-	(narrow-to-region beg end)
-	(goto-char (point-min))
-	(when (and wrapper
-		   (looking-at "\\`=\\?ISO-8859-1\\?Q\\?\\([^?]*\\)\\?"))
-	  (delete-region (match-end 1) end)
-	  (delete-region (point) (match-beginning 1)))
-	(while (re-search-forward "=\\(..\\|\n\\)" nil t)
-	  (goto-char (match-end 0))
-	  (replace-match
-	   (if (= (char-after (match-beginning 1)) ?\n)
-	       ""
-	     (make-string 1
-			  (+ (* 16 (mail-unquote-printable-hexdigit
-				    (char-after (match-beginning 1))))
-			     (mail-unquote-printable-hexdigit
-			      (char-after (1+ (match-beginning 1)))))))
-	   t t))))))
+  (let (failed)
+    (save-match-data
+      (save-excursion
+	(save-restriction
+	  (narrow-to-region beg end)
+	  (goto-char (point-min))
+	  (when (and wrapper
+		     (looking-at "\\`=\\?ISO-8859-1\\?Q\\?\\([^?]*\\)\\?"))
+	    (delete-region (match-end 1) end)
+	    (delete-region (point) (match-beginning 1)))
+	  (while (re-search-forward "=\\(\\([0-9A-F][0-9A-F]\\)\\|[=\n]\\|..\\)" nil t)
+	    (goto-char (match-end 0))
+	    (cond ((= (char-after (match-beginning 1)) ?\n)
+		   (replace-match ""))
+		  ((= (char-after (match-beginning 1)) ?=)
+		   (replace-match "="))
+		  ((match-beginning 2)
+		   (replace-match
+		    (make-string 1
+				 (+ (* 16 (mail-unquote-printable-hexdigit
+					   (char-after (match-beginning 2))))
+				    (mail-unquote-printable-hexdigit
+				     (char-after (1+ (match-beginning 2))))))
+		    t t))
+		  (noerror
+		   (setq failed t))
+		  (t
+		   (error "Malformed MIME quoted-printable message"))))
+	  (not failed))))))
 
 (eval-when-compile (require 'rfc822))
 
--- a/lisp/mail/rmail-spam-filter.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/mail/rmail-spam-filter.el	Thu Jan 22 15:37:19 2004 +0000
@@ -84,6 +84,7 @@
   "Spam filter for RMAIL, the mail reader for Emacs."
   :group 'rmail)
 
+;;;###autoload
 (defcustom rmail-use-spam-filter nil
   "*Non-nil to activate the rmail spam filter.
 Specify `rmail-spam-definitions-alist' to define what you consider spam
--- a/lisp/mail/rmail.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/mail/rmail.el	Thu Jan 22 15:37:19 2004 +0000
@@ -1364,6 +1364,7 @@
 	  (while all-files
 	    (let ((opoint (point))
 		  (new-messages 0)
+		  (rsf-number-of-spam 0)
 		  (delete-files ())
 		  ;; If buffer has not changed yet, and has not been saved yet,
 		  ;; don't replace the old backup file now.
@@ -1446,11 +1447,59 @@
 		  (progn (goto-char opoint)
 			 (if (or file-name rmail-inbox-list)
 			     (message "(No new mail has arrived)")))
-		(if (rmail-summary-exists)
+		;; check new messages to see if any of them is spam:
+		(if rmail-use-spam-filter
+		    (let*
+			((old-messages (- rmail-total-messages new-messages))
+                         (rsf-scanned-message-number (1+ old-messages))
+                         ;; save deletion flags of old messages: vector starts
+                         ;; at zero (is one longer that no of messages),
+                         ;; therefore take 1+ old-messages
+                         (save-deleted
+                          (substring rmail-deleted-vector 0 (1+
+                          old-messages))))
+                      ;; set all messages to undeleted
+                      (setq rmail-deleted-vector
+                            (make-string (1+ rmail-total-messages) ?\ ))
+		      (while (<= rsf-scanned-message-number
+		      rmail-total-messages)
+			(progn
+			  (if (not (rmail-spam-filter rsf-scanned-message-number))
+			      (progn (setq rsf-number-of-spam (1+ rsf-number-of-spam)))
+			    )
+			  (setq rsf-scanned-message-number (1+ rsf-scanned-message-number))
+			  ))
+		      (if (> rsf-number-of-spam 0)
+			  (progn
+			    (when (rmail-expunge-confirmed)
+                              (rmail-only-expunge t))
+                            ))
+                      (setq rmail-deleted-vector
+                            (concat
+                             save-deleted
+                             (make-string (- rmail-total-messages old-messages)
+                                          ?\ )))
+		      ))
+ 		(if (rmail-summary-exists)
 		    (rmail-select-summary
 		     (rmail-update-summary)))
-		(message "%d new message%s read"
-			 new-messages (if (= 1 new-messages) "" "s"))
+		(message "%d new message%s read%s"
+			 new-messages (if (= 1 new-messages) "" "s")
+			 ;; print out a message on number of spam messages found:
+			 (if (and rmail-use-spam-filter (> rsf-number-of-spam 0))
+			     (if (= 1 new-messages)
+				 (format ", and found to be a spam message"
+					 rsf-number-of-spam)
+			       (if (> rsf-number-of-spam 1)
+				   (format ", %d of which found to be spam messages"
+					   rsf-number-of-spam)
+				 (format ", one of which found to be a spam message"
+					 rsf-number-of-spam)))
+			   ""))
+		(if (and rmail-use-spam-filter (> rsf-number-of-spam 0))
+		    (progn (if rmail-spam-filter-beep (beep t))
+			   (sleep-for rmail-spam-sleep-after-message)))
+
 		;; Move to the first new message
 		;; unless we have other unseen messages before it.
 		(rmail-show-message (rmail-first-unseen-message))
@@ -1680,7 +1729,9 @@
 			    header-end t))))
 		   (if quoted-printable-header-field-end
 		       (save-excursion
-			 (rmail-decode-quoted-printable header-end (point))
+			 (unless
+			     (mail-unquote-printable-region header-end (point) nil t)
+			   (message "Malformed MIME quoted-printable message"))
 			 ;; Change "quoted-printable" to "8bit",
 			 ;; to reflect the decoding we just did.
 			 (goto-char quoted-printable-header-field-end)
@@ -1825,7 +1876,10 @@
 		 (setq count (1+ count))
 		 (if quoted-printable-header-field-end
 		     (save-excursion
-		       (rmail-decode-quoted-printable header-end (point))
+		       (unless
+			   (mail-unquote-printable-region header-end (point) nil t)
+			 
+			 (message "Malformed MIME quoted-printable message"))
 		       ;; Change "quoted-printable" to "8bit",
 		       ;; to reflect the decoding we just did.
 		       (goto-char quoted-printable-header-field-end)
@@ -1836,7 +1890,13 @@
 		       (when
 			   (condition-case nil
 			       (progn
-				 (base64-decode-region (1+ header-end) (point))
+				 (base64-decode-region
+				  (1+ header-end)
+				  (save-excursion
+				    ;; Prevent base64-decode-region
+				    ;; from removing newline characters.
+				    (skip-chars-backward "\n\t ")
+				    (point)))
 				 t)
 			     (error nil))
 			 (goto-char header-end)
@@ -1854,6 +1914,7 @@
 		   (goto-char (point-min))
 		   (while (search-forward "\n\^_" nil t); single char
 		     (replace-match "\n^_")))); 2 chars: "^" and "_"
+	       (or (bolp) (newline)) ; in case we lost the final newline.
 	       (insert ?\^_)
 	       (setq last-coding-system-used nil)
 	       (or rmail-enable-mime
@@ -1887,45 +1948,6 @@
 	      (t (error "Cannot convert to babyl format")))))
     count))
 
-(defun rmail-hex-char-to-integer (character)
-  "Return CHARACTER's value interpreted as a hex digit."
-  (if (and (>= character ?0) (<= character ?9))
-      (- character ?0)
-    (let ((ch (logior character 32)))
-      (if (and (>= ch ?a) (<= ch ?f))
-	  (- ch (- ?a 10))
-	(error "Invalid hex digit `%c'" ch)))))
-
-(defun rmail-hex-string-to-integer (hex-string)
-  "Return decimal integer for HEX-STRING."
-  (let ((hex-num 0)
-	(index 0))
-    (while (< index (length hex-string))
-      (setq hex-num (+ (* hex-num 16)
-		       (rmail-hex-char-to-integer (aref hex-string index))))
-      (setq index (1+ index)))
-    hex-num))
-
-(defun rmail-decode-quoted-printable (from to)
-  "Decode Quoted-Printable in the region between FROM and TO."
-  (interactive "r")
-  (goto-char from)
-  (or (markerp to)
-      (setq to (copy-marker to)))
-  (while (search-forward "=" to t)
-    (cond ((eq (following-char) ?\n)
-	   (delete-char -1)
-	   (delete-char 1))
-	  ((looking-at "[0-9A-F][0-9A-F]")
-	   (let ((byte (rmail-hex-string-to-integer
-			(buffer-substring (point) (+ 2 (point))))))
-	     (delete-region (1- (point)) (+ 2 (point)))
-	     (insert byte)))
-	  ((looking-at "=")
-	   (delete-char 1))
-	  (t
-	   (message "Malformed MIME quoted-printable message")))))
-
 ;; Delete the "From ..." line, creating various other headers with
 ;; information from it if they don't already exist.  Now puts the
 ;; original line into a mail-from: header line for debugging and for
@@ -3033,7 +3055,7 @@
       (funcall rmail-confirm-expunge
 	       "Erase deleted messages from Rmail file? ")))
 
-(defun rmail-only-expunge ()
+(defun rmail-only-expunge (&optional dont-show)
   "Actually erase all deleted messages in the file."
   (interactive)
   (set-buffer rmail-buffer)
@@ -3112,11 +3134,12 @@
       (message "Expunging deleted messages...done")
       (if (not win)
 	  (narrow-to-region (- (buffer-size) omin) (- (buffer-size) omax)))
-      (rmail-show-message
-       (if (zerop rmail-current-message) 1 nil))
-      (if rmail-enable-mime
-	  (goto-char (+ (point-min) opoint))
-	(goto-char (+ (point) opoint))))))
+      (if (not dont-show)
+	  (rmail-show-message
+	   (if (zerop rmail-current-message) 1 nil)
+	(if rmail-enable-mime
+	    (goto-char (+ (point-min) opoint))
+	  (goto-char (+ (point) opoint))))))))
 
 (defun rmail-expunge ()
   "Erase deleted messages from Rmail file and summary buffer."
--- a/lisp/mail/smtpmail.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/mail/smtpmail.el	Thu Jan 22 15:37:19 2004 +0000
@@ -680,13 +680,8 @@
 				 ;; size estimate:
 				 (+ (- (point-max) (point-min))
 				    ;; Add one byte for each change-of-line
-				    ;; because or CR-LF representation:
-				    (count-lines (point-min) (point-max))
-				    ;; For some reason, an empty line is
-				    ;; added to the message.  Maybe this
-				    ;; is a bug, but it can't hurt to add
-				    ;; those two bytes anyway:
-				    2)))
+				    ;; because of CR-LF representation:
+				    (count-lines (point-min) (point-max)))))
 		     ""))
 		  (body-part
 		   (if (member '8bitmime supported-extensions)
@@ -858,31 +853,15 @@
   )
 
 (defun smtpmail-send-data (process buffer)
-  (let
-      ((data-continue t)
-       (sending-data nil)
-       this-line
-       this-line-end)
-
+  (let ((data-continue t) sending-data)
     (with-current-buffer buffer
       (goto-char (point-min)))
-
     (while data-continue
       (with-current-buffer buffer
-	(beginning-of-line)
-	(setq this-line (point))
-	(end-of-line)
-	(setq this-line-end (point))
-	(setq sending-data nil)
-	(setq sending-data (buffer-substring this-line this-line-end))
-	(if (/= (forward-line 1) 0)
-	    (setq data-continue nil)))
-
-      (smtpmail-send-data-1 process sending-data)
-      )
-    )
-  )
-
+        (setq sending-data (buffer-substring (point-at-bol) (point-at-eol)))
+	(end-of-line 2)
+        (setq data-continue (not (eobp))))
+      (smtpmail-send-data-1 process sending-data))))
 
 (defun smtpmail-deduce-address-list (smtpmail-text-buffer header-start header-end)
   "Get address list suitable for smtp RCPT TO: <address>."
--- a/lisp/mwheel.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/mwheel.el	Thu Jan 22 15:37:19 2004 +0000
@@ -58,7 +58,7 @@
                         'mouse-wheel-down-event)
 (defcustom mouse-wheel-down-event
   ;; In the latest versions of XEmacs, we could just use mouse-%s as well.
-  (if (memq system-type '(windows-nt macos darwin))
+  (if (memq window-system '(w32 mac))
       'wheel-up
     (intern (format (if (featurep 'xemacs) "button%s" "mouse-%s")
 		    mouse-wheel-down-button)))
@@ -72,7 +72,7 @@
                         'mouse-wheel-up-event)
 (defcustom mouse-wheel-up-event
   ;; In the latest versions of XEmacs, we could just use mouse-%s as well.
-  (if (memq system-type '(windows-nt macos darwin))
+  (if (memq window-system '(w32 mac))
       'wheel-down
     (intern (format (if (featurep 'xemacs) "button%s" "mouse-%s")
 		    mouse-wheel-up-button)))
--- a/lisp/outline.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/outline.el	Thu Jan 22 15:37:19 2004 +0000
@@ -1,6 +1,6 @@
 ;;; outline.el --- outline mode commands for Emacs
 
-;; Copyright (C) 1986, 93, 94, 95, 97, 2000, 2001
+;; Copyright (C) 1986, 93, 94, 95, 97, 2000, 01, 2004
 ;;   Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
@@ -410,7 +410,8 @@
 		    (or (caar outline-heading-alist) "")
 		  (match-string 0)))))
     (unless (or (string-match "[ \t]\\'" head)
-		(not (string-match outline-regexp (concat head " "))))
+		(not (string-match (concat "\\`\\(?:" outline-regexp "\\)")
+				   (concat head " "))))
       (setq head (concat head " ")))
     (unless (bolp) (end-of-line) (newline))
     (insert head)
@@ -486,7 +487,8 @@
 		  ;; Bummer!! There is no lower heading in the buffer.
 		  ;; Let's try to invent one by repeating the first char.
 		  (let ((new-head (concat (substring head 0 1) head)))
-		    (if (string-match (concat "\\`" outline-regexp) new-head)
+		    (if (string-match (concat "\\`\\(?:" outline-regexp "\\)")
+				      new-head)
 			;; Why bother checking that it is indeed lower level ?
 			new-head
 		      ;; Didn't work: keep it as is so it's still a heading.
@@ -557,7 +559,7 @@
 (defun outline-move-subtree-down (&optional arg)
   "Move the currrent subtree down past ARG headlines of the same level."
   (interactive "p")
-  (let ((re (concat "^" outline-regexp))
+  (let ((re (concat "^\\(?:" outline-regexp "\\)"))
 	(movfunc (if (> arg 0) 'outline-get-next-sibling
 		   'outline-get-last-sibling))
 	(ins-point (make-marker))
--- a/lisp/progmodes/cc-defs.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/progmodes/cc-defs.el	Thu Jan 22 15:37:19 2004 +0000
@@ -100,7 +100,7 @@
 	       font-lock-keywords)))
       (cc-load "cc-fix")))
 
-(cc-external-require 'cl)
+(eval-when-compile (require 'cl))
 
 
 ;;; Variables also used at compile time.
--- a/lisp/progmodes/scheme.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/progmodes/scheme.el	Thu Jan 22 15:37:19 2004 +0000
@@ -328,7 +328,7 @@
 	       "do" "else" "for-each" "if" "lambda"
 	       "let" "let*" "let-syntax" "letrec" "letrec-syntax"
 	       ;; Hannes Haug <hannes.haug@student.uni-tuebingen.de> wants:
-	       "and" "or" "delay"
+	       "and" "or" "delay" "force"
 	       ;; Stefan Monnier <stefan.monnier@epfl.ch> says don't bother:
 	       ;;"quasiquote" "quote" "unquote" "unquote-splicing"
 	       "map" "syntax" "syntax-rules") t)
--- a/lisp/progmodes/which-func.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/progmodes/which-func.el	Thu Jan 22 15:37:19 2004 +0000
@@ -198,7 +198,8 @@
                   (or (eq which-func-modes t)
                       (member major-mode which-func-modes))))))
     ;; Turn it off
-    (cancel-timer which-func-update-timer)
+    (when (timerp which-func-update-timer)
+      (cancel-timer which-func-update-timer))
     (setq which-func-update-timer nil)
     (dolist (buf (buffer-list))
       (with-current-buffer buf (setq which-func-mode nil)))))
--- a/lisp/subr.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/subr.el	Thu Jan 22 15:37:19 2004 +0000
@@ -65,7 +65,7 @@
 (defmacro noreturn (form)
   "Evaluates FORM, with the expectation that the evaluation will signal an error
 instead of returning to its caller.  If FORM does return, an error is
-signalled." 
+signalled."
   `(prog1 ,form
      (error "Form marked with `noreturn' did return")))
 
@@ -158,6 +158,12 @@
 	 (setq ,(car spec) (1+ ,(car spec))))
        ,@(cdr (cdr spec)))))
 
+(defmacro declare (&rest specs)
+  "Do not evaluate any arguments and return nil.
+Treated as a declaration when used at the right place in a
+`defmacro' form.  \(See Info anchor `(elisp)Definition of declare'."
+  nil)
+
 (defsubst caar (x)
   "Return the car of the car of X."
   (car (car x)))
@@ -203,6 +209,21 @@
 	   (if (> n 0) (setcdr (nthcdr (- (1- m) n) x) nil))
 	   x))))
 
+(defun delete-dups (list)
+  "Destructively return LIST, with `equal' duplicates removed.
+LIST must be a proper list.  The value of LIST after a call to
+this function is undefined.  Use \(setq LIST (delete-dups LIST))
+if you want to store the return value in LIST.  Of several
+`equal' occurrences of an element in LIST, the last one is kept."
+  (while (member (car list) (cdr list))
+    (pop list))
+  (let ((tail list))
+    (while tail
+      (while (member (cadr tail) (cddr tail))
+	(setcdr tail (cddr tail)))
+      (pop tail)))
+  list)
+
 (defun number-sequence (from &optional to inc)
   "Return a sequence of numbers from FROM to TO (both inclusive) as a list.
 INC is the increment used between numbers in the sequence and defaults to 1.
@@ -689,13 +710,13 @@
 (defsubst posn-window (position)
   "Return the window in POSITION.
 POSITION should be a list of the form returned by the `event-start'
-and `event-end' functions." 
+and `event-end' functions."
   (nth 0 position))
 
 (defsubst posn-area (position)
   "Return the window area recorded in POSITION, or nil for the text area.
 POSITION should be a list of the form returned by the `event-start'
-and `event-end' functions." 
+and `event-end' functions."
   (let ((area (if (consp (nth 1 position))
 		  (car (nth 1 position))
 		(nth 1 position))))
@@ -704,7 +725,7 @@
 (defsubst posn-point (position)
   "Return the buffer location in POSITION.
 POSITION should be a list of the form returned by the `event-start'
-and `event-end' functions." 
+and `event-end' functions."
   (or (nth 5 position)
       (if (consp (nth 1 position))
 	  (car (nth 1 position))
@@ -713,18 +734,18 @@
 (defsubst posn-x-y (position)
   "Return the x and y coordinates in POSITION.
 POSITION should be a list of the form returned by the `event-start'
-and `event-end' functions." 
+and `event-end' functions."
   (nth 2 position))
 
 (defun posn-col-row (position)
   "Return the nominal column and row in POSITION, measured in characters.
 The column and row values are approximations calculated from the x
 and y coordinates in POSITION and the frame's default character width
-and height. 
+and height.
 For a scroll-bar event, the result column is 0, and the row
 corresponds to the vertical position of the click in the scroll bar.
 POSITION should be a list of the form returned by the `event-start'
-and `event-end' functions." 
+and `event-end' functions."
   (let* ((pair   (posn-x-y position))
 	 (window (posn-window position))
 	 (area   (posn-area position)))
@@ -750,43 +771,43 @@
 Return nil if POSITION does not contain the actual position; in that case
 `posn-col-row' can be used to get approximate values.
 POSITION should be a list of the form returned by the `event-start'
-and `event-end' functions." 
+and `event-end' functions."
   (nth 6 position))
 
 (defsubst posn-timestamp (position)
   "Return the timestamp of POSITION.
 POSITION should be a list of the form returned by the `event-start'
-and `event-end' functions." 
+and `event-end' functions."
   (nth 3 position))
 
 (defsubst posn-string (position)
   "Return the string object of POSITION, or nil if a buffer position.
 POSITION should be a list of the form returned by the `event-start'
-and `event-end' functions." 
+and `event-end' functions."
   (nth 4 position))
 
 (defsubst posn-image (position)
   "Return the image object of POSITION, or nil if a not an image.
 POSITION should be a list of the form returned by the `event-start'
-and `event-end' functions." 
+and `event-end' functions."
   (nth 7 position))
 
 (defsubst posn-object (position)
   "Return the object (image or string) of POSITION.
 POSITION should be a list of the form returned by the `event-start'
-and `event-end' functions." 
+and `event-end' functions."
   (or (posn-image position) (posn-string position)))
 
 (defsubst posn-object-x-y (position)
   "Return the x and y coordinates relative to the object of POSITION.
 POSITION should be a list of the form returned by the `event-start'
-and `event-end' functions." 
+and `event-end' functions."
   (nth 8 position))
 
 (defsubst posn-object-width-height (position)
   "Return the pixel width and height of the object of POSITION.
 POSITION should be a list of the form returned by the `event-start'
-and `event-end' functions." 
+and `event-end' functions."
   (nth 9 position))
 
 
--- a/lisp/term/x-win.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/term/x-win.el	Thu Jan 22 15:37:19 2004 +0000
@@ -2330,6 +2330,15 @@
     (or clip-text primary-text cut-text)
     ))
 
+(defun x-clipboard-yank ()
+  "Insert the clipboard contents, or the last stretch of killed text."
+  (interactive)
+  (let ((clipboard-text (x-get-selection 'CLIPBOARD))
+	(x-select-enable-clipboard t))
+    (if (and clipboard-text (> (length clipboard-text) 0))
+	(kill-new clipboard-text))
+    (yank)))
+
 
 ;;; Window system initialization.
 
@@ -2392,12 +2401,6 @@
 	  ;; generated from FONT.
 	  (create-fontset-from-ascii-font font resolved-name "startup"))))
 
-  ;; Sun expects the menu bar cut and paste commands to use the clipboard.
-  ;; This has ,? to match both on Sunos and on Solaris.
-  (if (string-match "Sun Microsystems,? Inc\\."
-		    (x-server-vendor))
-      (menu-bar-enable-clipboard))
-
   ;; Apply a geometry resource to the initial frame.  Put it at the end
   ;; of the alist, so that anything specified on the command line takes
   ;; precedence.
@@ -2463,6 +2466,14 @@
   ;; Turn on support for mouse wheels.
   (mouse-wheel-mode 1)
 
+  ;; Enable CLIPBOARD copy/paste through menu bar commands.
+  (menu-bar-enable-clipboard)
+
+  ;; Override Paste so it looks at CLIPBOARD first.
+  (define-key menu-bar-edit-menu [paste]
+    (cons "Paste" (cons "Paste text from clipboard or kill ring"
+			'x-clipboard-yank)))
+
   (setq x-initialized t))
 
 (add-to-list 'handle-args-function-alist '(x . x-handle-args))
--- a/lisp/textmodes/texinfo.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/textmodes/texinfo.el	Thu Jan 22 15:37:19 2004 +0000
@@ -1,6 +1,6 @@
 ;;; texinfo.el --- major mode for editing Texinfo files
 
-;; Copyright (C) 1985,88,89,90,91,92,93,96,97,2000,01,03
+;; Copyright (C) 1985,88,89,90,91,92,93,96,97,2000,01,03,04
 ;;           Free Software Foundation, Inc.
 
 ;; Author: Robert J. Chassell
@@ -316,7 +316,7 @@
 (defvar texinfo-imenu-generic-expression
   '((nil "^@\\(node\\|anchor\\)[ \t]+\\([^,\n]*\\)" 2)
     ("Chapters" "^@chapter[ \t]+\\(.*\\)$" 1))
-  "Imenu generic expression for TexInfo mode.  See `imenu-generic-expression'.")
+  "Imenu generic expression for Texinfo mode.  See `imenu-generic-expression'.")
 
 (defvar texinfo-font-lock-syntactic-keywords
   '(("\\(@\\)c\\(omment\\)?\\>" (1 "<"))
@@ -336,11 +336,11 @@
     "macro" "menu" "multitable" "quotation" "smalldisplay"
     "smallexample" "smallformat" "smalllisp" "table" "tex"
     "titlepage" "verbatim" "vtable")
-  "List of TeXinfo environments.")
+  "List of Texinfo environments.")
 
 (defconst texinfo-environment-regexp
   (concat "^@" (regexp-opt (cons "end" texinfo-environments) t) "\\>")
-  "Regexp for environment-like TexInfo list commands.
+  "Regexp for environment-like Texinfo list commands.
 Subexpression 1 is what goes into the corresponding `@end' statement.")
 
 (defface texinfo-heading-face
@@ -373,7 +373,7 @@
     ;;  1 (texinfo-clone-environment (match-beginning 1) (match-end 1)) keep)
     (,(concat "^@" (regexp-opt (mapcar 'car texinfo-section-list) t)
 	       ".*\n") 0 texinfo-heading-face t))
-  "Additional expressions to highlight in TeXinfo mode.")
+  "Additional expressions to highlight in Texinfo mode.")
 
 (defun texinfo-clone-environment (start end)
   (let ((endp nil))
@@ -676,7 +676,7 @@
 (defvar texinfo-enable-quote-macros "@\\(code\\|samp\\|kbd\\)\\>")
 (defvar texinfo-enable-quote-envs '("example\\>" "lisp\\>"))
 (defun texinfo-insert-quote (&optional arg)
-  "Insert the appropriate quote mark for TeXinfo.
+  "Insert the appropriate quote mark for Texinfo.
 Usually inserts the value of `texinfo-open-quote' (normally ``) or
 `texinfo-close-quote' (normally ''), depending on the context.
 With prefix argument or inside @code or @example, inserts a plain \"."
@@ -904,9 +904,8 @@
     ;; Second, create and format an *Occur* buffer
     (save-excursion
       (goto-char (point-min))
-      (if nodes-too
-          (occur (concat "^@node\\>\\|" outline-regexp))
-        (occur outline-regexp)))
+      (occur (concat "^\\(?:" (if nodes-too "@node\\>\\|")
+		     outline-regexp "\\)")))
     (pop-to-buffer "*Occur*")
     (goto-char (point-min))
     (let ((inhibit-read-only t))
--- a/lisp/vc-cvs.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/vc-cvs.el	Thu Jan 22 15:37:19 2004 +0000
@@ -5,7 +5,7 @@
 ;; Author:      FSF (see vc.el for full credits)
 ;; Maintainer:  Andre Spiegel <spiegel@gnu.org>
 
-;; $Id: vc-cvs.el,v 1.66 2003/10/01 13:22:53 fx Exp $
+;; $Id: vc-cvs.el,v 1.67 2004/01/20 17:41:18 uid65624 Exp $
 
 ;; This file is part of GNU Emacs.
 
@@ -625,6 +625,14 @@
 	  (beginning-of-line nil)
 	    (vc-cvs-annotate-time))))))
 
+(defun vc-cvs-annotate-extract-revision-at-line ()
+  (save-excursion
+    (beginning-of-line)
+    (if (re-search-forward "^\\([0-9]+\\.[0-9]+\\(\\.[0-9]+\\)*\\) +("
+			   (line-end-position) t)
+	(match-string-no-properties 1)
+      nil)))
+
 ;;;
 ;;; Snapshot system
 ;;;
--- a/lisp/vc-mcvs.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/vc-mcvs.el	Thu Jan 22 15:37:19 2004 +0000
@@ -1,6 +1,6 @@
 ;;; vc-mcvs.el --- VC backend for the Meta-CVS version-control system
 
-;; Copyright (C) 1995,98,99,2000,01,02,2003  Free Software Foundation, Inc.
+;; Copyright (C) 1995,98,99,2000,01,02,03,2004  Free Software Foundation, Inc.
 
 ;; Author:      FSF (see vc.el for full credits)
 ;; Maintainer:  Stefan Monnier <monnier@gnu.org>
@@ -170,13 +170,6 @@
 			 0))
       t)))
 
-(defmacro vc-mcvs-cvs (op file &rest args)
-  (declare (debug t))
-  `(,(intern (concat "vc-cvs-" (symbol-name op)))
-    (expand-file-name (vc-file-getprop ,file 'mcvs-inode)
-		      (vc-file-getprop ,file 'mcvs-root))
-    ,@args))
-
 (defun vc-mcvs-state (file)
   ;; This would assume the Meta-CVS sandbox is synchronized.
   ;; (vc-mcvs-cvs state file))
@@ -215,19 +208,13 @@
 	    (goto-char (point-max))
 	    (widen)))))))
 
-(defun vc-mcvs-workfile-version (file) (vc-mcvs-cvs workfile-version file))
+(defun vc-mcvs-workfile-version (file)
+  (vc-cvs-workfile-version
+   (expand-file-name (vc-file-getprop file 'mcvs-inode)
+		     (vc-file-getprop file 'mcvs-root))))
 
 (defalias 'vc-mcvs-checkout-model 'vc-cvs-checkout-model)
 
-(defun vc-mcvs-mode-line-string (file)
-  (let ((s (vc-mcvs-cvs mode-line-string file)))
-    (when s
-      (if (and (not (memq (vc-state file) '(up-to-date needs-patch)))
-	       (string-match "\\`CVS-" s))
-	  ;; The CVS file is not in sync, so we need to adjust the state.
-	  (concat "MCVS:" (substring s 4))
-	(concat "M" s)))))
-
 ;;;
 ;;; State-changing functions
 ;;;
@@ -589,7 +576,7 @@
       ;; We need to filter the output.
       ;; The output of the filter uses filenames relative to the root,
       ;; so we need to change the default-directory.
-      (assert (equal default-directory (vc-mcvs-root file)))
+      ;; (assert (equal default-directory (vc-mcvs-root file)))
       (vc-do-command
        buffer okstatus "sh" nil "-c"
        (concat "mcvs "
--- a/lisp/vc.el	Thu Jan 22 02:36:55 2004 +0000
+++ b/lisp/vc.el	Thu Jan 22 15:37:19 2004 +0000
@@ -7,7 +7,7 @@
 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
 ;; Keywords: tools
 
-;; $Id: vc.el,v 1.361 2003/12/24 23:18:10 uid66361 Exp $
+;; $Id: vc.el,v 1.363 2004/01/21 11:05:51 uid65624 Exp $
 
 ;; This file is part of GNU Emacs.
 
@@ -347,6 +347,13 @@
 ;;   time with hours, minutes, and seconds included.  Probably safe to
 ;;   ignore.  Return the current-time, in units of fractional days.
 ;;
+;; - annotate-extract-revision-at-line ()
+;;
+;;   Only required if `annotate-command' is defined for the backend.
+;;   Invoked from a buffer in vc-annotate-mode, return the revision
+;;   corresponding to the current line, or nil if there is no revision
+;;   corresponding to the current line.
+;;
 ;; SNAPSHOT SYSTEM
 ;;
 ;; - create-snapshot (dir name branchp)
@@ -392,7 +399,13 @@
 ;;
 ;; - previous-version (file rev)
 ;;
-;;   Return the version number that precedes REV for FILE.
+;;   Return the version number that precedes REV for FILE, or nil if no such
+;;   version exists.
+;;
+;; - next-version (file rev)
+;;
+;;   Return the version number that follows REV for FILE, or nil if no such
+;;   version exists.
 ;;
 ;; - check-headers ()
 ;;
@@ -631,6 +644,14 @@
     m)
   "Local keymap used for VC-Annotate mode.")
 
+(define-key vc-annotate-mode-map "A" 'vc-annotate-revision-previous-to-line)
+(define-key vc-annotate-mode-map "D" 'vc-annotate-show-diff-revision-at-line)
+(define-key vc-annotate-mode-map "J" 'vc-annotate-revision-at-line)
+(define-key vc-annotate-mode-map "L" 'vc-annotate-show-log-revision-at-line)
+(define-key vc-annotate-mode-map "N" 'vc-annotate-next-version)
+(define-key vc-annotate-mode-map "P" 'vc-annotate-prev-version)
+(define-key vc-annotate-mode-map "W" 'vc-annotate-workfile-version)
+
 (defvar vc-annotate-mode-menu nil
   "Local keymap used for VC-Annotate mode's menu bar menu.")
 
@@ -714,9 +735,10 @@
   (substring rev (match-beginning 0) (match-end 0)))
 
 (defun vc-default-previous-version (backend file rev)
-  "Guess the version number immediately preceding REV for FILE.
-This default implementation works for <major>.<minor>-style version numbers
-as used by RCS and CVS."
+  "Return the version number immediately preceding REV for FILE,
+or nil if there is no previous version.  This default
+implementation works for <major>.<minor>-style version numbers as
+used by RCS and CVS."
   (let ((branch (vc-branch-part rev))
         (minor-num (string-to-number (vc-minor-part rev))))
     (when branch
@@ -731,6 +753,16 @@
           ;; return version of starting point
           (vc-branch-part branch))))))
 
+(defun vc-default-next-version (backend file rev)
+  "Return the version number immediately following REV for FILE,
+or nil if there is no next version.  This default implementation
+works for <major>.<minor>-style version numbers as used by RCS
+and CVS."
+  (when (not (string= rev (vc-workfile-version file)))
+    (let ((branch (vc-branch-part rev))
+	  (minor-num (string-to-number (vc-minor-part rev))))
+      (concat branch "." (number-to-string (1+ minor-num))))))
+
 ;; File property caching
 
 (defun vc-clear-context ()
@@ -2285,11 +2317,13 @@
 ;; Miscellaneous other entry points
 
 ;;;###autoload
-(defun vc-print-log ()
-  "List the change log of the current buffer in a window."
+(defun vc-print-log (&optional focus-rev)
+  "List the change log of the current buffer in a window.  If
+FOCUS-REV is non-nil, leave the point at that revision."
   (interactive)
   (vc-ensure-vc-buffer)
   (let ((file buffer-file-name))
+    (or focus-rev (setq focus-rev (vc-workfile-version file)))
     (vc-call print-log file)
     (set-buffer "*vc*")
     (pop-to-buffer (current-buffer))
@@ -2307,7 +2341,7 @@
 	;; move point to the log entry for the current version
 	(vc-call-backend ',(vc-backend file)
 			 'show-log-entry
-			 ',(vc-workfile-version file))
+			 ',focus-rev)
         (set-buffer-modified-p nil)))))
 
 (defun vc-default-show-log-entry (backend rev)
@@ -2778,6 +2812,14 @@
 (defvar vc-annotate-ratio nil "Global variable.")
 (defvar vc-annotate-backend nil "Global variable.")
 
+;; internal buffer-local variables
+(defvar vc-annotate-parent-file nil)
+(defvar vc-annotate-parent-rev nil)
+(defvar vc-annotate-parent-display-mode nil)
+(make-local-variable 'vc-annotate-parent-file)
+(make-local-variable 'vc-annotate-parent-rev)
+(make-local-variable 'vc-annotate-parent-display-mode)
+
 (defconst vc-annotate-font-lock-keywords
   ;; The fontification is done by vc-annotate-lines instead of font-lock.
   '((vc-annotate-lines)))
@@ -2797,6 +2839,7 @@
   (set (make-local-variable 'truncate-lines) t)
   (set (make-local-variable 'font-lock-defaults)
        '(vc-annotate-font-lock-keywords t))
+  (view-mode 1)
   (vc-annotate-add-menu))
 
 (defun vc-annotate-display-default (&optional ratio)
@@ -2885,7 +2928,23 @@
 		    (unless (eq vc-annotate-display-mode 'fullscale)
 		      (vc-annotate-display-select nil 'fullscale))
 		    :style toggle :selected
-		    (eq vc-annotate-display-mode 'fullscale)])))
+		    (eq vc-annotate-display-mode 'fullscale)])
+		  (list "--")
+		  (list ["Annotate previous revision"
+			 (call-interactively 'vc-annotate-prev-version)])
+		  (list ["Annotate next revision"
+			 (call-interactively 'vc-annotate-next-version)])
+		  (list ["Annotate revision at line"
+			 (vc-annotate-revision-at-line)])
+		  (list ["Annotate revision previous to line"
+			 (vc-annotate-revision-previous-to-line)])
+		  (list ["Annotate latest revision"
+			 (vc-annotate-workfile-version)])
+		  (list ["Show log of revision at line"
+			 (vc-annotate-show-log-revision-at-line)])
+		  (list ["Show diff of revision at line"
+			 (vc-annotate-show-diff-revision-at-line)])))
+
     ;; Define the menu
     (if (or (featurep 'easymenu) (load "easymenu" t))
 	(easy-menu-define vc-annotate-mode-menu vc-annotate-mode-map
@@ -2922,7 +2981,7 @@
 ;;;;  the contents in BUFFER.
 
 ;;;###autoload
-(defun vc-annotate (prefix)
+(defun vc-annotate (prefix &optional revision display-mode)
   "Display the edit history of the current file using colours.
 
 This command creates a buffer that shows, for each line of the current
@@ -2949,19 +3008,24 @@
 colors. `vc-annotate-background' specifies the background color."
   (interactive "P")
   (vc-ensure-vc-buffer)
-  (let* ((temp-buffer-name (concat "*Annotate " (buffer-name) "*"))
+  (let* ((temp-buffer-name nil)
          (temp-buffer-show-function 'vc-annotate-display-select)
-         (rev (vc-workfile-version buffer-file-name))
+	 (rev (or revision (vc-workfile-version buffer-file-name)))
+	 (bfn buffer-file-name)
          (vc-annotate-version
-          (if prefix (read-string
-                      (format "Annotate from version: (default %s) " rev)
-                      nil nil rev)
-            rev)))
-    (if prefix
-        (setq vc-annotate-display-mode
-              (float (string-to-number
-                      (read-string "Annotate span days: (default 20) "
-                                   nil nil "20")))))
+	  (if prefix (read-string
+		      (format "Annotate from version: (default %s) " rev)
+		      nil nil rev)
+	    rev)))
+    (if display-mode
+	(setq vc-annotate-display-mode display-mode)
+      (if prefix
+	  (setq vc-annotate-display-mode
+		(float (string-to-number
+			(read-string "Annotate span days: (default 20) "
+				     nil nil "20"))))))
+    (setq temp-buffer-name (format "*Annotate %s (rev %s)*"
+				   (buffer-name) vc-annotate-version))
     (setq vc-annotate-backend (vc-backend buffer-file-name))
     (message "Annotating...")
     (if (not (vc-find-backend-function vc-annotate-backend 'annotate-command))
@@ -2972,6 +3036,12 @@
 		       buffer-file-name
 		       (get-buffer temp-buffer-name)
                        vc-annotate-version))
+    (save-excursion
+      (set-buffer temp-buffer-name)
+      (setq vc-annotate-parent-file bfn)
+      (setq vc-annotate-parent-rev vc-annotate-version)
+      (setq vc-annotate-parent-display-mode vc-annotate-display-mode))
+	   
     ;; Don't use the temp-buffer-name until the buffer is created
     ;; (only after `with-output-to-temp-buffer'.)
     (setq vc-annotate-buffers
@@ -2979,6 +3049,150 @@
 		  (list (cons (get-buffer temp-buffer-name) vc-annotate-backend))))
   (message "Annotating... done")))
 
+(defun vc-annotate-prev-version (prefix)
+  "Visit the annotation of the version previous to this one.
+
+With a numeric prefix argument, annotate the version that many
+versions previous."
+  (interactive "p")
+  (vc-annotate-warp-version (- 0 prefix)))
+
+(defun vc-annotate-next-version (prefix)
+  "Visit the annotation of the version after this one.
+
+With a numeric prefix argument, annotate the version that many
+versions after."
+  (interactive "p")
+  (vc-annotate-warp-version prefix))
+
+(defun vc-annotate-workfile-version ()
+  "Visit the annotation of the workfile version of this file."
+  (interactive)
+  (if (not (equal major-mode 'vc-annotate-mode))
+      (message "Cannot be invoked outside of a vc annotate buffer")
+    (let ((warp-rev (vc-workfile-version vc-annotate-parent-file)))
+      (if (equal warp-rev vc-annotate-parent-rev)
+	  (message "Already at version %s" warp-rev)
+	(vc-annotate-warp-version warp-rev)))))
+
+(defun vc-annotate-extract-revision-at-line ()
+  "Extract the revision number of the current line."
+  ;; This function must be invoked from a buffer in vc-annotate-mode
+  (save-window-excursion
+    (vc-ensure-vc-buffer)
+    (setq vc-annotate-backend (vc-backend buffer-file-name)))
+  (vc-call-backend vc-annotate-backend 'annotate-extract-revision-at-line))
+
+(defun vc-annotate-revision-at-line ()
+  "Visit the annotation of the version identified in the current line."
+  (interactive)
+  (if (not (equal major-mode 'vc-annotate-mode))
+      (message "Cannot be invoked outside of a vc annotate buffer")
+    (let ((rev-at-line (vc-annotate-extract-revision-at-line)))
+      (if (not rev-at-line)
+	  (message "Cannot extract revision number from the current line")
+	(if (equal rev-at-line vc-annotate-parent-rev)
+	    (message "Already at version %s" rev-at-line)
+	  (vc-annotate-warp-version rev-at-line))))))
+
+(defun vc-annotate-revision-previous-to-line ()
+  "Visit the annotation of the version before the version at line."  
+  (interactive)
+  (if (not (equal major-mode 'vc-annotate-mode))
+      (message "Cannot be invoked outside of a vc annotate buffer")
+    (let ((rev-at-line (vc-annotate-extract-revision-at-line))
+	  (prev-rev nil))
+      (if (not rev-at-line)
+	  (message "Cannot extract revision number from the current line")
+	(setq prev-rev
+	      (vc-call previous-version vc-annotate-parent-file rev-at-line))
+	(vc-annotate-warp-version prev-rev)))))
+
+(defun vc-annotate-show-log-revision-at-line ()
+  "Visit the log of the version at line."
+  (interactive)
+  (if (not (equal major-mode 'vc-annotate-mode))
+      (message "Cannot be invoked outside of a vc annotate buffer")
+    (let ((rev-at-line (vc-annotate-extract-revision-at-line)))
+      (if (not rev-at-line)
+	  (message "Cannot extract revision number from the current line")
+	(vc-print-log rev-at-line)))))
+
+(defun vc-annotate-show-diff-revision-at-line ()
+  "Visit the diff of the version at line from its previous version."
+  (interactive)
+  (if (not (equal major-mode 'vc-annotate-mode))
+      (message "Cannot be invoked outside of a vc annotate buffer")
+    (let ((rev-at-line (vc-annotate-extract-revision-at-line))
+	  (prev-rev nil))
+      (if (not rev-at-line)
+	  (message "Cannot extract revision number from the current line")
+	(setq prev-rev
+	      (vc-call previous-version vc-annotate-parent-file rev-at-line))
+	(if (not prev-rev)
+	    (message "Cannot diff from any version prior to %s" rev-at-line)
+	  (save-window-excursion
+	    (vc-version-diff vc-annotate-parent-file prev-rev rev-at-line))
+	  (switch-to-buffer "*vc-diff*"))))))
+
+(defun vc-current-line ()
+  "Return the current buffer's line number."
+  (let ((oldpoint (point)) start)
+    (save-excursion
+      (save-restriction
+	(goto-char (point-min))
+	(widen)
+	(forward-line 0)
+	(setq start (point))
+	(goto-char oldpoint)
+	(forward-line 0)
+	(1+ (count-lines (point-min) (point)))))))
+
+(defun vc-annotate-warp-version (revspec)
+  "Annotate the version described by REVSPEC.
+
+If REVSPEC is a positive integer, warp that many versions
+forward, if possible, otherwise echo a warning message.  If
+REVSPEC is a negative integer, warp that many versions backward,
+if possible, otherwise echo a warning message.  If REVSPEC is a
+string, then it describes a revision number, so warp to that
+revision."
+  (if (not (equal major-mode 'vc-annotate-mode))
+      (message "Cannot be invoked outside of a vc annotate buffer")
+    (let* ((oldline (vc-current-line))
+	   (revspeccopy revspec)
+	   (newrev nil))
+      (cond
+       ((and (integerp revspec) (> revspec 0))
+	(setq newrev vc-annotate-parent-rev)
+	(while (and (> revspec 0) newrev)
+	       (setq newrev (vc-call next-version
+				     vc-annotate-parent-file newrev))
+	       (setq revspec (1- revspec)))
+	(if (not newrev)
+	    (message "Cannot increment %d versions from version %s"
+		     revspeccopy vc-annotate-parent-rev)))
+       ((and (integerp revspec) (< revspec 0))
+	(setq newrev vc-annotate-parent-rev)
+	(while (and (< revspec 0) newrev)
+	       (setq newrev (vc-call previous-version
+				     vc-annotate-parent-file newrev))
+	       (setq revspec (1+ revspec)))
+	(if (not newrev)
+	    (message "Cannot decrement %d versions from version %s"
+		     (- 0 revspeccopy) vc-annotate-parent-rev)))
+       ((stringp revspec) (setq newrev revspec))
+       (t (error "Invalid argument to vc-annotate-warp-version")))
+      (when newrev
+	(save-window-excursion
+	  (find-file vc-annotate-parent-file)
+	  (vc-annotate nil newrev vc-annotate-parent-display-mode))
+	(kill-buffer (current-buffer)) ;; kill the buffer we started from
+	(switch-to-buffer (car (car (last vc-annotate-buffers))))
+	(goto-line (min oldline (progn (goto-char (point-max))
+				       (previous-line)
+				       (vc-current-line))))))))
+
 (defun vc-annotate-car-last-cons (a-list)
   "Return car of last cons in association list A-LIST."
   (if (not (eq nil (cdr a-list)))
--- a/lispref/ChangeLog	Thu Jan 22 02:36:55 2004 +0000
+++ b/lispref/ChangeLog	Thu Jan 22 15:37:19 2004 +0000
@@ -1,3 +1,23 @@
+2004-01-20  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* lists.texi (Sets And Lists): Add delete-dups.
+
+2004-01-15  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* edebug.texi (Instrumenting Macro Calls): `declare' is not a
+	special form.
+	* macros.texi (Defining Macros): Update description of `declare',
+	which now is a macro.
+	(Wrong Time): Fix typos.
+
+2004-01-14  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* compile.texi (Compilation Functions): Expand descriptions of
+	`compile-defun', `byte-compile-file', `byte-recompile-directory'
+	and `batch-byte-compile'.  In particular, mention and describe
+	all optional arguments.
+	(Disassembly): Correct and clarify the description of `disassemble'.
+
 2004-01-11  Luc Teirlinck  <teirllm@auburn.edu>
 
 	* searching.texi: Various small changes in addition to the
--- a/lispref/compile.texi	Thu Jan 22 02:36:55 2004 +0000
+++ b/lispref/compile.texi	Thu Jan 22 15:37:19 2004 +0000
@@ -173,14 +173,18 @@
 certain primitives that are coded as special instructions.
 @end defun
 
-@deffn Command compile-defun
+@deffn Command compile-defun &optional arg
 This command reads the defun containing point, compiles it, and
 evaluates the result.  If you use this on a defun that is actually a
 function definition, the effect is to install a compiled version of that
 function.
+
+@code{compile-defun} normally displays the result of evaluation in the
+echo area, but if @var{arg} is non-@code{nil}, it inserts the result
+in the current buffer after the form it compiled.
 @end deffn
 
-@deffn Command byte-compile-file filename
+@deffn Command byte-compile-file filename &optional load
 This function compiles a file of Lisp code named @var{filename} into a
 file of byte-code.  The output file's name is made by changing the
 @samp{.el} suffix into @samp{.elc}; if @var{filename} does not end in
@@ -193,8 +197,11 @@
 executed when the file is read.  All comments are discarded when the
 input file is read.
 
-This command returns @code{t}.  When called interactively, it prompts
-for the file name.
+This command returns @code{t} if there were no errors and @code{nil}
+otherwise.  When called interactively, it prompts for the file name.
+
+If @var{load} is non-@code{nil}, this command loads the compiled file
+after compiling it.  Interactively, @var{load} is the prefix argument.
 
 @example
 @group
@@ -215,20 +222,28 @@
 @end example
 @end deffn
 
-@deffn Command byte-recompile-directory directory flag
+@deffn Command byte-recompile-directory directory &optional flag force
 @cindex library compilation
-This function recompiles every @samp{.el} file in @var{directory} that
-needs recompilation.  A file needs recompilation if a @samp{.elc} file
-exists but is older than the @samp{.el} file.
+This command recompiles every @samp{.el} file in @var{directory} (or
+its subdirectories) that needs recompilation.  A file needs
+recompilation if a @samp{.elc} file exists but is older than the
+@samp{.el} file.
 
-When a @samp{.el} file has no corresponding @samp{.elc} file, @var{flag}
-says what to do.  If it is @code{nil}, these files are ignored.  If it
-is non-@code{nil}, the user is asked whether to compile each such file.
+When a @samp{.el} file has no corresponding @samp{.elc} file,
+@var{flag} says what to do.  If it is @code{nil}, this command ignores
+these files.  If @var{flag} is 0, it compiles them.  If it is neither
+@code{nil} nor 0, it asks the user whether to compile each such file.
 
-The returned value of this command is unpredictable.
+Interactively, @code{byte-recompile-directory} prompts for
+@var{directory} and @var{flag} is the prefix argument.
+
+If @var{force} is non-@code{nil}, this command recompiles every
+@samp{.el} file that has a @samp{.elc} file.
+
+The returned value is unpredictable.
 @end deffn
 
-@defun batch-byte-compile
+@defun batch-byte-compile &optional noforce
 This function runs @code{byte-compile-file} on files specified on the
 command line.  This function must be used only in a batch execution of
 Emacs, as it kills Emacs on completion.  An error in one file does not
@@ -236,6 +251,9 @@
 generated for it, and the Emacs process will terminate with a nonzero
 status code.
 
+If @var{noforce} is non-@code{nil}, this function does not recompile
+files that have an up-to-date @samp{.elc} file.
+
 @example
 % emacs -batch -f batch-byte-compile *.el
 @end example
@@ -420,7 +438,7 @@
 defined are always ``located'' at the end of the file, so these
 commands won't find the places they are really used.  To do that,
 you must search for the function names.
- 
+
   You can suppress the compiler warning for calling an undefined
 function @var{func} by conditionalizing the function call on a
 @code{fboundp} test, like this:
@@ -549,14 +567,16 @@
 ordinary Lisp variables, by transferring values between variables and
 the stack.
 
-@deffn Command disassemble object &optional stream
-This function prints the disassembled code for @var{object}.  If
-@var{stream} is supplied, then output goes there.  Otherwise, the
-disassembled code is printed to the stream @code{standard-output}.  The
-argument @var{object} can be a function name or a lambda expression.
+@deffn Command disassemble object &optional buffer-or-name
+This command displays the disassembled code for @var{object}.  In
+interactive use, or if @var{buffer-or-name} is @code{nil} or omitted,
+the output goes in a buffer named @samp{*Disassemble*}.  If
+@var{buffer-or-name} is non-@code{nil}, it must be a buffer or the
+name of an existing buffer.  Then the output goes there, at point, and
+point is left before the output.
 
-As a special exception, if this function is used interactively,
-it outputs to a buffer named @samp{*Disassemble*}.
+The argument @var{object} can be a function name, a lambda expression
+or a byte-code object.
 @end deffn
 
   Here are two examples of using the @code{disassemble} function.  We
--- a/lispref/edebug.texi	Thu Jan 22 02:36:55 2004 +0000
+++ b/lispref/edebug.texi	Thu Jan 22 15:37:19 2004 +0000
@@ -1091,7 +1091,7 @@
 often looks very similar to the formal argument list of the macro
 definition, but specifications are much more general than macro
 arguments.  @xref{Defining Macros}, for more explanation of
-the @code{declare} special form.
+the @code{declare} form.
 
   You can also define an edebug specification for a macro separately
 from the macro definition with @code{def-edebug-spec}.  Adding
@@ -1381,7 +1381,7 @@
 constraint by factoring the symbol out of the alternatives, e.g.,
 @code{["foo" &or [first case] [second case] ...]}.
 
-Most needs are satisfied by these two ways that bactracking is
+Most needs are satisfied by these two ways that backtracking is
 automatically disabled, but occasionally it is useful to explicitly
 disable backtracking by using the @code{gate} specification.  This is
 useful when you know that no higher alternatives could apply.  See the
--- a/lispref/files.texi	Thu Jan 22 02:36:55 2004 +0000
+++ b/lispref/files.texi	Thu Jan 22 15:37:19 2004 +0000
@@ -416,9 +416,9 @@
 @defopt before-save-hook
 This normal hook runs before a buffer is saved in its visited file,
 regardless of whether that is done normally or by one of the hooks
-described above.  One use of this hook is for the Copyright package;
-it uses this hook to make sure the file has the current year in the
-copyright header.
+described above.  For instance, the @file{copyright.el} program uses
+this hook to make sure the file you are saving has the current year in
+its copyright notice.
 @end defopt
 
 @c Emacs 19 feature
--- a/lispref/lists.texi	Thu Jan 22 02:36:55 2004 +0000
+++ b/lispref/lists.texi	Thu Jan 22 15:37:19 2004 +0000
@@ -1223,7 +1223,8 @@
   A list can represent an unordered mathematical set---simply consider a
 value an element of a set if it appears in the list, and ignore the
 order of the list.  To form the union of two sets, use @code{append} (as
-long as you don't mind having duplicate elements).  Other useful
+long as you don't mind having duplicate elements).  You can remove
+@code{equal} duplicates using @code{delete-dups}.  Other useful
 functions for sets include @code{memq} and @code{delq}, and their
 @code{equal} versions, @code{member} and @code{delete}.
 
@@ -1433,6 +1434,20 @@
 comparison.
 @end defun
 
+@defun delete-dups list
+This function destructively removes all @code{equal} duplicates from
+@var{list} and returns the result.  Of several @code{equal}
+occurrences of an element in @var{list}, @code{delete-dups} keeps the
+last one.
+
+The value of @var{list} after a call to this function is undefined.
+Usually, we store the return value back in @var{list}:
+
+@example
+(setq list (delete-dups list))
+@end example
+@end defun
+
   See also the function @code{add-to-list}, in @ref{Setting Variables},
 for another way to add an element to a list stored in a variable.
 
--- a/lispref/macros.texi	Thu Jan 22 02:36:55 2004 +0000
+++ b/lispref/macros.texi	Thu Jan 22 15:37:19 2004 +0000
@@ -210,10 +210,11 @@
 which can specify how @key{TAB} should indent macro calls, and how to
 step through them for Edebug.
 
-@defspec declare @var{specs}...
-This special form is used at top level in a macro definition to
-specify various additional information about it.  Two kinds of
-specification are currently supported:
+@anchor{Definition of declare}
+@defmac declare @var{specs}@dots{}
+A @code{declare} form is used in a macro definition to specify various
+additional information about it.  Two kinds of specification are
+currently supported:
 
 @table @code
 @item (edebug @var{edebug-form-spec})
@@ -224,7 +225,17 @@
 Specify how to indent calls to this macro.  @xref{Indenting Macros},
 for more details.
 @end table
-@end defspec
+
+A @code{declare} form only has its special effect in the body of a
+@code{defmacro} form if it immediately follows the documentation
+string, if present, or the argument list otherwise.  (Strictly
+speaking, @emph{several} @code{declare} forms can follow the
+documentation string or argument list, but since a @code{declare} form
+can have several @var{specs}, they can always be combined into a
+single form.)  When used at other places in a @code{defmacro} form, or
+outside a @code{defmacro} form, @code{declare} just returns @code{nil}
+without evaluating any @var{specs}.
+@end defmac
 
   No macro absolutely needs a @code{declare} form, because that form
 has no effect on how the macro expands, on what the macro means in the
@@ -356,9 +367,9 @@
 @node Wrong Time
 @subsection Wrong Time
 
-  The most common problem in writing macros is doing too some of the
+  The most common problem in writing macros is doing some of the
 real work prematurely---while expanding the macro, rather than in the
-expansion itself.  For instance, one real package had this nmacro
+expansion itself.  For instance, one real package had this macro
 definition:
 
 @example
--- a/mac/ChangeLog	Thu Jan 22 02:36:55 2004 +0000
+++ b/mac/ChangeLog	Thu Jan 22 15:37:19 2004 +0000
@@ -1,13 +1,16 @@
+2004-01-14  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* src/Emacs.r: Update TOO_MUCH_RAM error message.
+
 2003-11-22  Lars Hansen <larsh@math.ku.dk>
 
 	* inc/grp.h: Added.
 
 2003-11-02  Andrew Choi  <akochoi@shaw.ca>
 
-	* src/Emacs.r [!TARGET_API_MAC_CARBON]: Don't define hfdr
-	resource.
+	* src/Emacs.r [!TARGET_API_MAC_CARBON]: Don't define hfdr resource.
 	* Emacs.app/Contents/Resources/Emacs.rsrc: Remove.
-	
+
 2003-10-31  Andrew Choi  <akochoi@shaw.ca>
 
 	* INSTALL: Add Nozomu Ando's changes to instructions for
--- a/mac/INSTALL	Thu Jan 22 02:36:55 2004 +0000
+++ b/mac/INSTALL	Thu Jan 22 15:37:19 2004 +0000
@@ -1,6 +1,6 @@
 * BUILDING EMACS ON MAC OS 8/9 AND MAC OS X     -*- outline -*-
 
-Copyright (c) 2001, 2002 Free Software Foundation, Inc.
+Copyright (c) 2001, 2002, 2004 Free Software Foundation, Inc.
 
    Permission is granted to anyone to make or distribute verbatim
    copies of this document as received, in any medium, provided that
@@ -205,7 +205,7 @@
 You will need around 100 MB of disk space for the source files and
 intermediate files.
 
-It will not run on machines running Mac OS 8/9 with more than 256 MB
+It will not run on machines running Mac OS 8/9 with more than 512 MB
 of physical or virtual memory.  It does not have this restriction when
 it is run under Mac OS X.  But the usual 128MB buffer limit of a
 32-bit Emacs still exists.
--- a/mac/src/Emacs.r	Thu Jan 22 02:36:55 2004 +0000
+++ b/mac/src/Emacs.r	Thu Jan 22 15:37:19 2004 +0000
@@ -1,5 +1,5 @@
 /* Resource definitions for GNU Emacs on the Macintosh.
-   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -174,7 +174,7 @@
 		{10, 60, 72, 278},
 		StaticText {
 			disabled,
-			"Emacs does not run on a Macintosh with more than 256 MB of physical or virtual memory"
+			"Emacs does not run on a Macintosh with more than 512 MB of physical or virtual memory"
 		}
 	}
 };
--- a/man/files.texi	Thu Jan 22 02:36:55 2004 +0000
+++ b/man/files.texi	Thu Jan 22 15:37:19 2004 +0000
@@ -1536,6 +1536,46 @@
 stretch factor greater than 1 means the color range spans more than a
 year.
 
+From the annotate buffer, you can use the following keys to browse the
+annotations of past revisions, view diffs, or view log entries:
+
+@itemize @bullet
+
+@item
+Pressing @kbd{P} annotates the previous revision.  It also takes a
+numeric prefix argument, so for example @kbd{C-u 10 P} would take you
+back 10 revisions.
+
+@item
+Pressing @kbd{N} annotates the next revision.  It also takes a numeric
+prefix argument, so for example @kbd{C-u 10 N} would take you forward
+10 revisions.
+
+@item
+Pressing @kbd{J} annotates the revision at line (as denoted by the
+version number on the same line).
+
+@item
+Pressing @kbd{A} annotates the revision previous to line (as denoted
+by the version number on the same line).  This is useful to see the
+state the file was in before the change on the current line was made.
+
+@item
+Pressing @kbd{D} shows the diff of the revision at line with its
+previous revision.  This is useful to see what actually changed when
+the revision denoted on the current line was committed.
+
+@item
+Pressing @kbd{L} shows the log of the revision at line.  This is
+useful to see the author's description of the changes that occured
+when the revision denoted on the current line was committed.
+
+@item
+Pressing @kbd{W} annotates the workfile (most up to date) version.  If
+you used @kbd{P} and @kbd{N} to browse to other revisions, use this
+key to return to the latest version.
+@end itemize
+
 @node Secondary VC Commands
 @subsection The Secondary Commands of VC
 
--- a/src/.cvsignore	Thu Jan 22 02:36:55 2004 +0000
+++ b/src/.cvsignore	Thu Jan 22 15:37:19 2004 +0000
@@ -1,18 +1,19 @@
+*-spd
 *.core
+*.pdb
+.gdb_history
 Makefile
 Makefile.c
 TAGS-LISP
+_gdbinit
 bootstrap-emacs
 config.h
 config.stamp
 emacs
 emacs-*
 epaths.h
+gdb.ini
 obj
 prefix-args
 stamp-oldxmenu
 temacs
-_gdbinit
-gdb.ini
-*-spd
-*.pdb
--- a/src/ChangeLog	Thu Jan 22 02:36:55 2004 +0000
+++ b/src/ChangeLog	Thu Jan 22 15:37:19 2004 +0000
@@ -1,3 +1,164 @@
+2004-01-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* lisp.h [USE_LSB_TAG && !DECL_ALIGN]: Signal an error.
+
+2004-01-21  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* lisp.h: Add undef DECL_ALIGN.
+
+2004-01-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* process.c (wait_reading_process_input) [SYNC_INPUT]:
+	Check interrupt_input_pending explicitly.
+
+	* lisp.h (QUIT) [SYNC_INPUT]: Check interrupt_input_pending as well.
+
+	* keyboard.c (handle_async_input): New fun,
+	extracted from input_available_signal.
+	(input_available_signal, reinvoke_input_signal): Use it.
+
+2004-01-20  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* buffer.c (buffer_defaults, buffer_local_symbols): Use DECL_ALIGN.
+
+	* lisp.h [USE_LSB_TAG]: Add definitions for Lisp_Object value
+	manipulation macros for when tags are in the lower bits.
+	(struct Lisp_Free) [USE_LSB_TAG]: Add padding.
+	(DECL_ALIGN): New macro.
+	(DEFUN): Use it.
+
+	* lisp.h [ENABLE_CHECKING]: Don't force union type.
+
+	* s/darwin.h (__attribute__): Remove outdated workaround.
+
+	* macterm.c (main) [USE_LSB_TAG]: Don't range check the ram.
+
+	* alloc.c (lisp_malloc, lisp_align_malloc) [USE_LSB_TAG]:
+	Don't check range of malloc address.
+	(pure_alloc) [USE_LSB_TAG]: Enforce alignment.
+
+	* process.c (wait_reading_process_input): Lisp_Object/int mixup.
+
+	* dired.c (Ffile_attributes): Lisp_Object/int mixup.
+
+2004-01-19  Kenichi Handa  <handa@m17n.org>
+
+	* fontset.c (fontset_font_pattern): Fix previous change.
+
+2004-01-16  Miles Bader  <miles@gnu.ai.mit.edu>
+
+	* xdisp.c (Voverflow_newline_into_fringe)
+	(move_it_in_display_line_to, redisplay_internal)
+	(update_window_fringes, redisplay_window, display_line, window):
+	Add `#ifdef HAVE_WINDOW_SYSTEM' around fringe-drawing stuff, so
+	that it compiles without a window-system.
+	* dispnew.c (direct_output_for_insert, update_window): Likewise.
+
+2004-01-16  Kim F. Storm  <storm@cua.dk>
+
+	* buffer.h (struct buffer): New member indicate_buffer_boundaries.
+
+	* buffer.c (init_buffer_once):  Set buffer_defaults and
+	buffer_local_flags for indicate_buffer_boundaries.
+	(syms_of_buffer): Defvar_per_buffer it, and defvar_lisp_nopro
+	default- variable for it.
+
+	* dispextern.h (struct glyph_row): New members left_fringe_bitmap,
+	right_fringe_bitmap, redraw_fringe_bitmaps_p for new fringe handling.
+	New members exact_window_width_line_p and cursor_in_fringe_p for
+	overflowing newlines into right fringe.
+	New members indicate_bob_p, indicate_top_line_p, indicate_eob_p,
+	and indicate_bottom_line_p for buffer boundaries and scrolling.
+	(enum fringe_bitmap_type): Add UP_ARROW_BITMAP, DOWN_ARROW_BITMAP,
+	FIRST_LINE_BITMAP, LAST_LINE_BITMAP, FILLED_BOX_CURSOR_BITMAP,
+	HOLLOW_BOX_CURSOR_BITMAP, BAR_CURSOR_BITMAP, HBAR_CURSOR_BITMAP,
+	and HOLLOW_SQUARE_BITMAP.
+	(draw_fringe_bitmap, draw_window_fringes, update_window_fringes):
+	Add prototypes.
+
+	* dispnew.c (row_equal_p, update_window_line): Compare fringe bitmaps
+	instead of related indicator fields.
+	Compare exact_window_width_line_p and cursor_in_mouse_face_p indicators.
+	(direct_output_for_insert): Handle exact width lines like
+	contined lines.  Call update_window_fringes.
+	(update_window): Call update_window_fringes.
+	(scrolling_window): Don't skip desired rows with changed bitmaps.
+	Check if fringe bitmaps changes when assigning scrolled rows.
+
+	* xdisp.c (Voverflow_newline_into_fringe): New variable.
+	(IT_OVERFLOW_NEWLINE_INTO_FRINGE): New macro.
+	(move_it_in_display_line_to): Overflow newline into fringe for
+	rows that are exactly as wide as the window.
+	(up_arrow_bits, down_arrow_bits, first_line_bits, last_line_bits)
+	(filled_box_cursor_bits, hollow_box_cursor_bits, bar_cursor_bits)
+	(hbar_cursor_bits, hollow_square_bits): New fringe bitmaps.
+	(fringe_bitmaps): Add new bitmaps.
+	(draw_fringe_bitmap): Make extern.  Remove WHICH arg.
+	Select proper bitmap for cursor in fringe when appropriate.
+	Handle alignment of bitmap to top or bottom of row.
+	(draw_row_fringe_bitmaps): Don't select bitmaps here; that is now
+	done by update_window_fringes.
+	(update_window_fringes, draw_window_fringes): New functions.
+	(redisplay_internal): Call update_window_fringes in case only
+	cursor row is updated.
+	(redisplay_window): Call update_window_fringes.
+	Explicitly call draw_window_fringes if redisplay was done using
+	the current matrix or the overlay arrow is in the window.
+	(try_window_reusing_current_matrix): Mark scrolled rows for
+	fringe update (to update buffer-boundaries / scrolling icons).
+	(find_last_unchanged_at_beg_row): Handle exact width lines line
+	continued lines.
+	(display_line): Overflow newline into fringe for rows that are
+	exactly as wide as the window.  Don't append space for newline
+	in this case.
+	(notice_overwritten_cursor): Explicitly clear cursor bitmap
+	in fringe as if it had been overwritten.
+	(erase_phys_cursor): Erase cursor bitmap in fringe.
+	(syms_of_xdisp): Mark show-trailing-whitespace and
+	void-text-area-pointer as user options.
+	DEFVAR_LISP Voverflow_newline_into_fringe.  Enable by default.
+
+	* xterm.c (x_update_window_end): Call draw_window_fringes.
+	(x_after_update_window_line): Just set redraw_fringe_bitmaps_p
+	in row instead of actually drawing fringe bitmaps.
+	(x_draw_fringe_bitmap): Handle bottom aligned bitmaps.
+	(x_draw_window_cursor): Draw cursor in fringe.
+
+	* w32term.c (x_update_window_end): Call draw_window_fringes.
+	(x_after_update_window_line): Just set redraw_fringe_bitmaps_p
+	in row instead of actually drawing fringe bitmaps.
+	(w32_draw_fringe_bitmap): Handle bottom aligned bitmaps.
+	(w32_draw_window_cursor): Draw cursor in fringe.
+
+	* macterm.c (x_update_window_end): Call draw_window_fringes.
+	(x_after_update_window_line): Just set redraw_fringe_bitmaps_p
+	in row instead of actually drawing fringe bitmaps.
+	(x_draw_fringe_bitmap): Handle bottom aligned bitmaps.
+	(mac_draw_window_cursor): Draw cursor in fringe.
+
+2004-01-16  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* xterm.c (handle_one_xevent): Don't handle characters that are part
+	of an old style (XLookupString) compose sequence.
+
+2004-01-15  Kenichi Handa  <handa@m17n.org>
+
+	* search.c (Freplace_match): Use make_multibyte_string or
+	make_unibyte_string according to the buffer multibyteness.
+
+2004-01-14  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* alloc.c (struct interval_block, struct string_block)
+	(struct symbol_block, struct marker_block, live_string_p)
+	(live_cons_p, live_symbol_p, live_float_p, live_misc_p):
+	Better preserve alignment for objects in blocks.
+	(FLOAT_BLOCK_SIZE): Adjust for possible alignment padding.
+
+	* lread.c (defvar_per_buffer): Remove dead declaration.
+
+	* macterm.c (do_check_ram_size): Don't hardcode the lisp address
+	space size.
+
 2004-01-12  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
 	* xmenu.c (popup_get_selection): Check new parameter down_on_keypress
@@ -61,7 +222,7 @@
 	* xdisp.c (note_mode_line_or_margin_highlight): Use modified
 	mode_line_string and marginal_area_string functions to handle
 	both string object and image object properties.
-	
+
 2004-01-06  Andreas Schwab  <schwab@suse.de>
 
 	* syntax.c (skip_chars): Treat '-' at end of string as ordinary
@@ -69,8 +230,8 @@
 
 2004-01-02  Andreas Schwab  <schwab@suse.de>
 
-	* macterm.c (emacs_options, x_initialized, same_x_server): Remove
-	unused (and duplicated) definitions.
+	* macterm.c (emacs_options, x_initialized, same_x_server):
+	Remove unused (and duplicated) definitions.
 
 2004-01-02  Kim F. Storm  <storm@cua.dk>
 
@@ -100,8 +261,7 @@
 
 2004-01-01  Jason Rumney  <jasonr@gnu.org>
 
-	* w32term.c (w32_text_out): Use s->font, for consistency with
-	callers.
+	* w32term.c (w32_text_out): Use s->font, for consistency with callers.
 
 2003-12-30  Luc Teirlinck  <teirllm@auburn.edu>
 
@@ -132,15 +292,13 @@
 
 	* fontset.c (Voverriding_fontspec_alist): New variable.
 	(lookup_overriding_fontspec): New function.
-	(fontset_ref_via_base): Call lookup_overriding_fontspec if
-	necessary.
+	(fontset_ref_via_base): Call lookup_overriding_fontspec if necessary.
 	(fontset_font_pattern): Likewise.
 	(regulalize_fontname): New function.
 	(Fset_fontset_font): Call regulalize_fontname.
 	(Fset_overriding_fontspec_internal): New function.
-	(syms_of_fontset): Initialize and staticprop
-	Voverriding_fontspec_alist. Defsubr
-	Sset_overriding_fontspec_internal.
+	(syms_of_fontset): Initialize and staticpro Voverriding_fontspec_alist.
+	Defsubr Sset_overriding_fontspec_internal.
 
 	* xfaces.c (face_font_available_p): New function.
 
@@ -197,7 +355,7 @@
 	(Vvoid_text_area_pointer): Replace Vshow_text_cursor_in_void.
 	(QCmap, QCpointer, Qrect, Qcircle, Qpoly): New variables for
 	image maps.
-	(x_y_to_hpos_vpos): Return glyph relative coordinates through 
+	(x_y_to_hpos_vpos): Return glyph relative coordinates through
 	new dx and dy args.
 	Remove buffer_only_p arg (always 0).  Simplify code accordingly.
 	(get_glyph_string_clip_rect): Draw cursor using glyph's rather
@@ -207,9 +365,9 @@
 	(produce_image_glyph): Adjust it.ascent to minimum row ascent if
 	image glyph is alone on the last line.
 	(append_glyph, append_composite_glyph, produce_image_glyph)
-	(append_stretch_glyph): Set glyph's ascent and descent. 
+	(append_stretch_glyph): Set glyph's ascent and descent.
 	(on_hot_spot_p): New function to check if position is inside an
-	rectangular, circular, or polygon-shaped image hot-spot, 
+	rectangular, circular, or polygon-shaped image hot-spot,
 	(find_hot_spot): New function to search for image hot-spot.
 	(Flookup_image_map): New defun to search for image hot-spot.
 	(define_frame_cursor1): New aux function to determine frame pointer.
@@ -277,8 +435,7 @@
 	(Fread_minibuffer, Fread_no_blanks_input): Adapt to changes in
 	read_minibuf.
 	(Fcompleting_read): Delete code moved into read_minibuf.
-	(Ftest_completion): Make it handle obarrays and hash tables
-	correctly.
+	(Ftest_completion): Make it handle obarrays and hash tables correctly.
 
 2003-12-03  Kenichi Handa  <handa@m17n.org>
 
@@ -429,10 +586,8 @@
 
 2003-11-22  Lars Hansen <larsh@math.ku.dk>
 
-	* w32.c (struct the_group): Added.
-	(getgrgid): Added.
-	* mac.c (struct my_group): Added.
-	(getgrgid): Added.
+	* w32.c (struct the_group, getgrgid): Add.
+	* mac.c (struct my_group, getgrgid): Add.
 
 2003-11-21  Luc Teirlinck  <teirllm@auburn.edu>
 
@@ -440,18 +595,19 @@
 
 2003-11-21  Lars Hansen  <larsh@math.ku.dk>
 
-	* dired.c (Ffile_attributes): Parameter ID-FORMAT added and
-	included in call to file name handler. Numeric UID and GID
-	optionally translated to strings. Docstring updated.
-	(directory_files_internal): Parameter ID-FORMAT added.
-	(Fdirectory_files_and_attributes): Parameter ID-FORMAT added and
-	included in call to file name handler and call to
-	directory_files_internal. Docstring updated.  (Fdirectory_files):
-	Dummy parameter added in call to directory_files_internal.
-	* lisp.h (Qinteger): Added.  (Qinteger_or_floatp,
-	Qinteger_or_float_or_marker_p): Removed.  (Ffile_attributes):
-	Parameter added.
-	* data.c (Qinteger): Exported.
+	* dired.c (Ffile_attributes): Add parameter ID-FORMAT and
+	include in call to file name handler.  Optionally translate numeric
+	UID and GID to strings.  Update docstring.
+	(directory_files_internal): Add parameter ID-FORMAT.
+	(Fdirectory_files_and_attributes): Add parameter ID-FORMAT and
+	include in call to file name handler and call to
+	directory_files_internal.  Update Docstring.
+	(Fdirectory_files): Add dummy parameter in call to
+	directory_files_internal.
+	* lisp.h (Qinteger): Add.
+	(Qinteger_or_floatp, Qinteger_or_float_or_marker_p): Remove.
+	(Ffile_attributes): Add parameter.
+	* data.c (Qinteger): Export.
 
 2003-11-21  Luc Teirlinck  <teirllm@auburn.edu>
 
@@ -1788,7 +1944,7 @@
 	* gtkutil.c: Include keyboard.h, charset.h, coding.h.
 	(xg_create_frame_widgets): Use ENCODE_UTF_8.
 
-	* xterm.c (Qutf_8): Moved to coding.c
+	* xterm.c (Qutf_8): Move to coding.c
 
 	* xmenu.c (ENCODE_MENU_STRING): New.
 	(list_of_panes, list_of_items, digest_single_submenu, xmenu_show):
--- a/src/alloc.c	Thu Jan 22 02:36:55 2004 +0000
+++ b/src/alloc.c	Thu Jan 22 15:37:19 2004 +0000
@@ -1,5 +1,5 @@
 /* Storage allocation and gc for GNU Emacs Lisp interpreter.
-   Copyright (C) 1985, 86, 88, 93, 94, 95, 97, 98, 1999, 2000, 2001, 2002, 2003
+   Copyright (C) 1985,86,88,93,94,95,97,98,1999,2000,01,02,03,2004
       Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -599,6 +599,7 @@
 
   val = (void *) malloc (nbytes);
 
+#ifndef USE_LSB_TAG
   /* If the memory just allocated cannot be addressed thru a Lisp
      object's pointer, and it needs to be,
      that's equivalent to running out of memory.  */
@@ -613,6 +614,7 @@
 	  val = 0;
 	}
     }
+#endif
 
 #if GC_MARK_STACK && !defined GC_MALLOC_CHECK
   if (val && type != MEM_TYPE_NON_LISP)
@@ -773,6 +775,7 @@
       mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
 #endif
 
+#ifndef USE_LSB_TAG
       /* If the memory just allocated cannot be addressed thru a Lisp
 	 object's pointer, and it needs to be, that's equivalent to
 	 running out of memory.  */
@@ -789,6 +792,7 @@
 	      memory_full ();
 	    }
 	}
+#endif
 
       /* Initialize the blocks and put them on the free list.
 	 Is `base' was not properly aligned, we can't use the last block.  */
@@ -1105,8 +1109,9 @@
 
 struct interval_block
 {
+  /* Place `intervals' first, to preserve alignment.  */
+  struct interval intervals[INTERVAL_BLOCK_SIZE];
   struct interval_block *next;
-  struct interval intervals[INTERVAL_BLOCK_SIZE];
 };
 
 /* Current interval block.  Its `next' pointer points to older
@@ -1344,8 +1349,9 @@
 
 struct string_block
 {
+  /* Place `strings' first, to preserve alignment.  */
+  struct Lisp_String strings[STRING_BLOCK_SIZE];
   struct string_block *next;
-  struct Lisp_String strings[STRING_BLOCK_SIZE];
 };
 
 /* Head and tail of the list of sblock structures holding Lisp string
@@ -2126,8 +2132,10 @@
    by GC are put on a free list to be reallocated before allocating
    any new float cells from the latest float_block.  */
 
-#define FLOAT_BLOCK_SIZE \
-  (((BLOCK_BYTES - sizeof (struct float_block *)) * CHAR_BIT) \
+#define FLOAT_BLOCK_SIZE					\
+  (((BLOCK_BYTES - sizeof (struct float_block *)		\
+     /* The compiler might add padding at the end.  */		\
+     - (sizeof (struct Lisp_Float) - sizeof (int))) * CHAR_BIT) \
    / (sizeof (struct Lisp_Float) * CHAR_BIT + 1))
 
 #define GETMARKBIT(block,n)				\
@@ -2754,8 +2762,9 @@
 
 struct symbol_block
 {
+  /* Place `symbols' first, to preserve alignment.  */
+  struct Lisp_Symbol symbols[SYMBOL_BLOCK_SIZE];
   struct symbol_block *next;
-  struct Lisp_Symbol symbols[SYMBOL_BLOCK_SIZE];
 };
 
 /* Current symbol block and index of first unused Lisp_Symbol
@@ -2846,8 +2855,9 @@
 
 struct marker_block
 {
+  /* Place `markers' first, to preserve alignment.  */
+  union Lisp_Misc markers[MARKER_BLOCK_SIZE];
   struct marker_block *next;
-  union Lisp_Misc markers[MARKER_BLOCK_SIZE];
 };
 
 struct marker_block *marker_block;
@@ -3428,6 +3438,7 @@
 	 must not be on the free-list.  */
       return (offset >= 0
 	      && offset % sizeof b->strings[0] == 0
+	      && offset < (STRING_BLOCK_SIZE * sizeof b->strings[0])
 	      && ((struct Lisp_String *) p)->data != NULL);
     }
   else
@@ -3452,8 +3463,8 @@
 	 one of the unused cells in the current cons block,
 	 and not be on the free-list.  */
       return (offset >= 0
+	      && offset % sizeof b->conses[0] == 0
 	      && offset < (CONS_BLOCK_SIZE * sizeof b->conses[0])
-	      && offset % sizeof b->conses[0] == 0
 	      && (b != cons_block
 		  || offset / sizeof b->conses[0] < cons_block_index)
 	      && !EQ (((struct Lisp_Cons *) p)->car, Vdead));
@@ -3481,6 +3492,7 @@
 	 and not be on the free-list.  */
       return (offset >= 0
 	      && offset % sizeof b->symbols[0] == 0
+	      && offset < (SYMBOL_BLOCK_SIZE * sizeof b->symbols[0])
 	      && (b != symbol_block
 		  || offset / sizeof b->symbols[0] < symbol_block_index)
 	      && !EQ (((struct Lisp_Symbol *) p)->function, Vdead));
@@ -3506,8 +3518,8 @@
       /* P must point to the start of a Lisp_Float and not be
 	 one of the unused cells in the current float block.  */
       return (offset >= 0
+	      && offset % sizeof b->floats[0] == 0
 	      && offset < (FLOAT_BLOCK_SIZE * sizeof b->floats[0])
-	      && offset % sizeof b->floats[0] == 0
 	      && (b != float_block
 		  || offset / sizeof b->floats[0] < float_block_index));
     }
@@ -3534,6 +3546,7 @@
 	 and not be on the free-list.  */
       return (offset >= 0
 	      && offset % sizeof b->markers[0] == 0
+	      && offset < (MARKER_BLOCK_SIZE * sizeof b->markers[0])
 	      && (b != marker_block
 		  || offset / sizeof b->markers[0] < marker_block_index)
 	      && ((union Lisp_Misc *) p)->u_marker.type != Lisp_Misc_Free);
@@ -4068,6 +4081,9 @@
      int type;
 {
   POINTER_TYPE *result;
+#ifdef USE_LSB_TAG
+  size_t alignment = (1 << GCTYPEBITS);
+#else
   size_t alignment = sizeof (EMACS_INT);
 
   /* Give Lisp_Floats an extra alignment.  */
@@ -4079,6 +4095,7 @@
       alignment = sizeof (struct Lisp_Float);
 #endif
     }
+#endif
 
  again:
   result = ALIGN (purebeg + pure_bytes_used, alignment);
--- a/src/buffer.c	Thu Jan 22 02:36:55 2004 +0000
+++ b/src/buffer.c	Thu Jan 22 15:37:19 2004 +0000
@@ -1,5 +1,5 @@
 /* Buffer manipulation primitives for GNU Emacs.
-   Copyright (C) 1985,86,87,88,89,93,94,95,97,98, 1999, 2000, 2001, 02, 2003
+   Copyright (C) 1985,86,87,88,89,93,94,95,97,98, 1999, 2000, 2001, 02, 03, 2004
 	Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -67,7 +67,7 @@
    Setting the default value also goes through the alist of buffers
    and stores into each buffer that does not say it has a local value.  */
 
-struct buffer buffer_defaults;
+DECL_ALIGN (struct buffer, buffer_defaults);
 
 /* A Lisp_Object pointer to the above, used for staticpro */
 
@@ -97,7 +97,8 @@
 /* This structure holds the names of symbols whose values may be
    buffer-local.  It is indexed and accessed in the same way as the above. */
 
-struct buffer buffer_local_symbols;
+DECL_ALIGN (struct buffer, buffer_local_symbols);
+
 /* A Lisp_Object pointer to the above, used for staticpro */
 static Lisp_Object Vbuffer_local_symbols;
 
@@ -4959,6 +4960,7 @@
   buffer_defaults.scroll_bar_width = Qnil;
   buffer_defaults.vertical_scroll_bar_type = Qt;
   buffer_defaults.indicate_empty_lines = Qnil;
+  buffer_defaults.indicate_buffer_boundaries = Qnil;
   buffer_defaults.scroll_up_aggressively = Qnil;
   buffer_defaults.scroll_down_aggressively = Qnil;
   buffer_defaults.display_time = Qnil;
@@ -5028,6 +5030,7 @@
   XSETFASTINT (buffer_local_flags.scroll_bar_width, idx); ++idx;
   XSETFASTINT (buffer_local_flags.vertical_scroll_bar_type, idx); ++idx;
   XSETFASTINT (buffer_local_flags.indicate_empty_lines, idx); ++idx;
+  XSETFASTINT (buffer_local_flags.indicate_buffer_boundaries, idx); ++idx;
   XSETFASTINT (buffer_local_flags.scroll_up_aggressively, idx); ++idx;
   XSETFASTINT (buffer_local_flags.scroll_down_aggressively, idx); ++idx;
   XSETFASTINT (buffer_local_flags.header_line_format, idx); ++idx;
@@ -5316,6 +5319,11 @@
 		     doc: /* Default value of `indicate-empty-lines' for buffers that don't override it.
 This is the same as (default-value 'indicate-empty-lines).  */);
 
+  DEFVAR_LISP_NOPRO ("default-indicate-buffer-boundaries",
+		     &buffer_defaults.indicate_buffer_boundaries,
+		     doc: /* Default value of `indicate-buffer-boundaries' for buffers that don't override it.
+This is the same as (default-value 'indicate-buffer-boundaries).  */);
+
   DEFVAR_LISP_NOPRO ("default-scroll-up-aggressively",
 		     &buffer_defaults.scroll_up_aggressively,
 		     doc: /* Default value of `scroll-up-aggressively'.
@@ -5626,6 +5634,14 @@
 If non-nil, a bitmap is displayed in the left fringe of a window on
 window-systems.  */);
 
+  DEFVAR_PER_BUFFER ("indicate-buffer-boundaries",
+		     &current_buffer->indicate_buffer_boundaries, Qnil,
+		     doc: /* *Visually indicate buffer boundaries and scrolling.
+If non-nil, the first and last line of the buffer are marked in the left and
+right fringe of a window on window-systems.
+In addition, if value is t, the top and bottom line of the window are marked
+with up and down arrow bitmaps in the right fringe if window can be scrolled.  */);
+
   DEFVAR_PER_BUFFER ("scroll-up-aggressively",
 		     &current_buffer->scroll_up_aggressively, Qnil,
 		     doc: /* How far to scroll windows upward.
--- a/src/buffer.h	Thu Jan 22 02:36:55 2004 +0000
+++ b/src/buffer.h	Thu Jan 22 15:37:19 2004 +0000
@@ -733,6 +733,9 @@
      like vi).  */
   Lisp_Object indicate_empty_lines;
 
+  /* Non-nil means indicate buffer boundaries and scrolling.  */
+  Lisp_Object indicate_buffer_boundaries;
+
   /* Time stamp updated each time this buffer is displayed in a window.  */
   Lisp_Object display_time;
 
--- a/src/dired.c	Thu Jan 22 02:36:55 2004 +0000
+++ b/src/dired.c	Thu Jan 22 15:37:19 2004 +0000
@@ -1,5 +1,5 @@
 /* Lisp functions for making directory listings.
-   Copyright (C) 1985, 1986, 1993, 1994, 1999, 2000, 2001
+   Copyright (C) 1985, 1986, 1993, 1994, 1999, 2000, 2001, 2004
      Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -941,9 +941,9 @@
   else
     {
       pw = (struct passwd *) getpwuid (s.st_uid);
-      values[2] = (pw ? build_string (pw->pw_name) : s.st_uid);
+      values[2] = (pw ? build_string (pw->pw_name) : make_number (s.st_uid));
       gr = (struct group *) getgrgid (s.st_gid);
-      values[3] = (gr ? build_string (gr->gr_name) : s.st_gid);
+      values[3] = (gr ? build_string (gr->gr_name) : make_number (s.st_gid));
     }
   values[4] = make_time (s.st_atime);
   values[5] = make_time (s.st_mtime);
--- a/src/dispextern.h	Thu Jan 22 02:36:55 2004 +0000
+++ b/src/dispextern.h	Thu Jan 22 15:37:19 2004 +0000
@@ -709,6 +709,15 @@
      position of the next row.  */
   struct display_pos end;
 
+  /* Left fringe bitmap number (enum fringe_bitmap_type).  */
+  unsigned left_fringe_bitmap : 4;
+
+  /* Right fringe bitmap number (enum fringe_bitmap_type).  */
+  unsigned right_fringe_bitmap : 4;
+
+  /* 1 means that we must draw the bitmaps of this row.  */
+  unsigned redraw_fringe_bitmaps_p : 1;
+
   /* In a desired matrix, 1 means that this row must be updated.  In a
      current matrix, 0 means that the row has been invalidated, i.e.
      the row's contents do not agree with what is visible on the
@@ -777,6 +786,29 @@
   /* 1 means this row was ended by a newline from a string.  */
   unsigned ends_in_newline_from_string_p : 1;
 
+  /* 1 means this row width is exactly the width of the window, and the
+     final newline character is hidden in the right fringe.  */
+  unsigned exact_window_width_line_p : 1;
+
+  /* 1 means this row currently shows the cursor in the right fringe.  */
+  unsigned cursor_in_fringe_p : 1;
+
+  /* Non-zero means display a bitmap on X frames indicating that this
+     the first line of the buffer.  */
+  unsigned indicate_bob_p : 1;
+
+  /* Non-zero means display a bitmap on X frames indicating that this
+     the top line of the window, but not start of the buffer.  */
+  unsigned indicate_top_line_p : 1;
+
+  /* Non-zero means display a bitmap on X frames indicating that this
+     the last line of the buffer.  */
+  unsigned indicate_eob_p : 1;
+
+  /* Non-zero means display a bitmap on X frames indicating that this
+     the bottom line of the window, but not end of the buffer.  */
+  unsigned indicate_bottom_line_p : 1;
+
   /* Continuation lines width at the start of the row.  */
   int continuation_lines_width;
 };
@@ -1582,10 +1614,19 @@
   NO_FRINGE_BITMAP = 0,
   LEFT_TRUNCATION_BITMAP,
   RIGHT_TRUNCATION_BITMAP,
+  UP_ARROW_BITMAP,
+  DOWN_ARROW_BITMAP,
   CONTINUED_LINE_BITMAP,
   CONTINUATION_LINE_BITMAP,
   OVERLAY_ARROW_BITMAP,
+  FIRST_LINE_BITMAP,
+  LAST_LINE_BITMAP,
+  FILLED_BOX_CURSOR_BITMAP,
+  HOLLOW_BOX_CURSOR_BITMAP,
+  BAR_CURSOR_BITMAP,
+  HBAR_CURSOR_BITMAP,
   ZV_LINE_BITMAP,
+  HOLLOW_SQUARE_BITMAP,
   MAX_FRINGE_BITMAPS
 };
 
@@ -2485,7 +2526,10 @@
 int in_display_vector_p P_ ((struct it *));
 int frame_mode_line_height P_ ((struct frame *));
 void highlight_trailing_whitespace P_ ((struct frame *, struct glyph_row *));
+void draw_fringe_bitmap P_ ((struct window *, struct glyph_row *, int));
 void draw_row_fringe_bitmaps P_ ((struct window *, struct glyph_row *));
+void draw_window_fringes P_ ((struct window *));
+int update_window_fringes P_ ((struct window *, int));
 void compute_fringe_widths P_ ((struct frame *, int));
 extern Lisp_Object Qtool_bar;
 extern Lisp_Object Vshow_trailing_whitespace;
--- a/src/dispnew.c	Thu Jan 22 02:36:55 2004 +0000
+++ b/src/dispnew.c	Thu Jan 22 15:37:19 2004 +0000
@@ -1,5 +1,5 @@
 /* Updating of data structures for redisplay.
-   Copyright (C) 1985,86,87,88,93,94,95,97,98,1999,2000,01,02,2003
+   Copyright (C) 1985,86,87,88,93,94,95,97,98,1999,2000,01,02,03,04
        Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -1500,12 +1500,11 @@
 	    return 0;
 	}
 
-      if (a->truncated_on_left_p != b->truncated_on_left_p
-	  || a->fill_line_p != b->fill_line_p
-	  || a->truncated_on_right_p != b->truncated_on_right_p
-	  || a->overlay_arrow_p != b->overlay_arrow_p
-	  || a->continued_p != b->continued_p
-	  || a->indicate_empty_line_p != b->indicate_empty_line_p
+      if (a->fill_line_p != b->fill_line_p
+	  || a->cursor_in_fringe_p != b->cursor_in_fringe_p
+	  || a->left_fringe_bitmap != b->left_fringe_bitmap
+	  || a->right_fringe_bitmap != b->right_fringe_bitmap
+	  || a->exact_window_width_line_p != b->exact_window_width_line_p
 	  || a->overlapped_p != b->overlapped_p
 	  || (MATRIX_ROW_CONTINUATION_LINE_P (a)
 	      != MATRIX_ROW_CONTINUATION_LINE_P (b))
@@ -3442,6 +3441,7 @@
 	  /* Can't do it in a continued line because continuation
 	     lines would change.  */
 	  (glyph_row->continued_p
+	   || glyph_row->exact_window_width_line_p
 	   /* Can't use this method if the line overlaps others or is
 	      overlapped by others because these other lines would
 	      have to be redisplayed.  */
@@ -3647,6 +3647,10 @@
       cursor_to (y, x);
     }
 
+#ifdef HAVE_WINDOW_SYSTEM
+  update_window_fringes (w, 0);
+#endif
+
   if (FRAME_RIF (f))
     FRAME_RIF (f)->update_window_end_hook (w, 1, 0);
   update_end (f);
@@ -4194,6 +4198,10 @@
       strcpy (w->current_matrix->method, w->desired_matrix->method);
 #endif
 
+#ifdef HAVE_WINDOW_SYSTEM
+      update_window_fringes (w, 0);
+#endif
+
       /* End the update of window W.  Don't set the cursor if we
          paused updating the display because in this case,
          set_window_cursor_after_update hasn't been called, and
@@ -4515,13 +4523,10 @@
       if (!current_row->enabled_p
 	  || desired_row->y != current_row->y
 	  || desired_row->visible_height != current_row->visible_height
-	  || desired_row->overlay_arrow_p != current_row->overlay_arrow_p
-	  || desired_row->truncated_on_left_p != current_row->truncated_on_left_p
-	  || desired_row->truncated_on_right_p != current_row->truncated_on_right_p
-	  || desired_row->continued_p != current_row->continued_p
+	  || desired_row->cursor_in_fringe_p != current_row->cursor_in_fringe_p
+	  || current_row->redraw_fringe_bitmaps_p
 	  || desired_row->mode_line_p != current_row->mode_line_p
-	  || (desired_row->indicate_empty_line_p
-	      != current_row->indicate_empty_line_p)
+	  || desired_row->exact_window_width_line_p != current_row->exact_window_width_line_p
 	  || (MATRIX_ROW_CONTINUATION_LINE_P (desired_row)
 	      != MATRIX_ROW_CONTINUATION_LINE_P (current_row)))
 	rif->after_update_window_line_hook (desired_row);
@@ -4776,6 +4781,7 @@
 
       if (c->enabled_p
 	  && d->enabled_p
+	  && !d->redraw_fringe_bitmaps_p
 	  && c->y == d->y
 	  && MATRIX_ROW_BOTTOM_Y (c) <= yb
 	  && MATRIX_ROW_BOTTOM_Y (d) <= yb
@@ -4831,6 +4837,7 @@
          && MATRIX_ROW (current_matrix, i - 1)->enabled_p
 	 && (MATRIX_ROW (current_matrix, i - 1)->y
 	     == MATRIX_ROW (desired_matrix, j - 1)->y)
+	 && !MATRIX_ROW (desired_matrix, j - 1)->redraw_fringe_bitmaps_p
          && row_equal_p (w,
 			 MATRIX_ROW (desired_matrix, i - 1),
                          MATRIX_ROW (current_matrix, j - 1), 1))
@@ -5023,6 +5030,10 @@
 	    to = MATRIX_ROW (current_matrix, r->desired_vpos + j);
 	    from = MATRIX_ROW (desired_matrix, r->desired_vpos + j);
 	    to_overlapped_p = to->overlapped_p;
+	    if (!from->mode_line_p && !w->pseudo_window_p
+		&& (to->left_fringe_bitmap != from->left_fringe_bitmap
+		    || to->right_fringe_bitmap != from->right_fringe_bitmap))
+	      from->redraw_fringe_bitmaps_p = 1;
 	    assign_row (to, from);
 	    to->enabled_p = 1, from->enabled_p = 0;
 	    to->overlapped_p = to_overlapped_p;
--- a/src/fontset.c	Thu Jan 22 02:36:55 2004 +0000
+++ b/src/fontset.c	Thu Jan 22 15:37:19 2004 +0000
@@ -599,7 +599,8 @@
       fontset = FONTSET_FROM_ID (id);
       xassert (!BASE_FONTSET_P (fontset));
       fontset = FONTSET_BASE (fontset);
-      elt = FONTSET_REF (fontset, c);
+      if (! EQ (fontset, Vdefault_fontset))
+	elt = FONTSET_REF (fontset, c);
     }
   if (NILP (elt))
     {
--- a/src/keyboard.c	Thu Jan 22 02:36:55 2004 +0000
+++ b/src/keyboard.c	Thu Jan 22 15:37:19 2004 +0000
@@ -1,5 +1,5 @@
 /* Keyboard and mouse input; editor command loop.
-   Copyright (C) 1985,86,87,88,89,93,94,95,96,97,99,2000,01,02,03
+   Copyright (C) 1985,86,87,88,89,93,94,95,96,97,99,2000,01,02,03,04
      Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -470,36 +470,6 @@
 
 static struct input_event kbd_buffer[KBD_BUFFER_SIZE];
 
-/* Vector to GCPRO the Lisp objects referenced from kbd_buffer.
-
-   The interrupt-level event handlers will never enqueue an event on a
-   frame which is not in Vframe_list, and once an event is dequeued,
-   internal_last_event_frame or the event itself points to the frame.
-   So that's all fine.
-
-   But while the event is sitting in the queue, it's completely
-   unprotected.  Suppose the user types one command which will run for
-   a while and then delete a frame, and then types another event at
-   the frame that will be deleted, before the command gets around to
-   it.  Suppose there are no references to this frame elsewhere in
-   Emacs, and a GC occurs before the second event is dequeued.  Now we
-   have an event referring to a freed frame, which will crash Emacs
-   when it is dequeued.
-
-   Similar things happen when an event on a scroll bar is enqueued; the
-   window may be deleted while the event is in the queue.
-
-   So, we use this vector to protect the Lisp_Objects in the event
-   queue.  That way, they'll be dequeued as dead frames or windows,
-   but still valid Lisp objects.
-
-   If kbd_buffer[i].kind != NO_EVENT, then
-
-   AREF (kbd_buffer_gcpro, 2 * i) == kbd_buffer[i].frame_or_window.
-   AREF (kbd_buffer_gcpro, 2 * i + 1) == kbd_buffer[i].arg.  */
-
-static Lisp_Object kbd_buffer_gcpro;
-
 /* Pointer to next available character in kbd_buffer.
    If kbd_fetch_ptr == kbd_store_ptr, the buffer is empty.
    This may be kbd_buffer + KBD_BUFFER_SIZE, meaning that the
@@ -3630,7 +3600,6 @@
      Discard the event if it would fill the last slot.  */
   if (kbd_fetch_ptr - 1 != kbd_store_ptr)
     {
-      int idx;
 
 #if 0 /* The SELECTION_REQUEST_EVENT case looks bogus, and it's error
 	 prone to assign individual members for other events, in case
@@ -3660,9 +3629,6 @@
       *kbd_store_ptr = *event;
 #endif
 
-      idx = 2 * (kbd_store_ptr - kbd_buffer);
-      ASET (kbd_buffer_gcpro, idx, event->frame_or_window);
-      ASET (kbd_buffer_gcpro, idx + 1, event->arg);
       ++kbd_store_ptr;
     }
 }
@@ -3778,9 +3744,6 @@
 clear_event (event)
      struct input_event *event;
 {
-  int idx = 2 * (event - kbd_buffer);
-  ASET (kbd_buffer_gcpro, idx, Qnil);
-  ASET (kbd_buffer_gcpro, idx + 1, Qnil);
   event->kind = NO_EVENT;
 }
 
@@ -6805,6 +6768,30 @@
 
 #endif /* not VMS */
 
+void
+handle_async_input ()
+{
+#ifdef BSD4_1
+  extern int select_alarmed;
+#endif
+  interrupt_input_pending = 0;
+
+  while (1)
+    {
+      int nread;
+      nread = read_avail_input (1);
+      /* -1 means it's not ok to read the input now.
+	 UNBLOCK_INPUT will read it later; now, avoid infinite loop.
+	 0 means there was no keyboard input available.  */
+      if (nread <= 0)
+	break;
+
+#ifdef BSD4_1
+      select_alarmed = 1;  /* Force the select emulator back to life */
+#endif
+    }
+}
+
 #ifdef SIGIO   /* for entire page */
 /* Note SIGIO has been undef'd if FIONREAD is missing.  */
 
@@ -6814,9 +6801,6 @@
 {
   /* Must preserve main program's value of errno.  */
   int old_errno = errno;
-#ifdef BSD4_1
-  extern int select_alarmed;
-#endif
 
 #if defined (USG) && !defined (POSIX_SIGNALS)
   /* USG systems forget handlers when they are used;
@@ -6831,20 +6815,11 @@
   if (input_available_clear_time)
     EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0);
 
-  while (1)
-    {
-      int nread;
-      nread = read_avail_input (1);
-      /* -1 means it's not ok to read the input now.
-	 UNBLOCK_INPUT will read it later; now, avoid infinite loop.
-	 0 means there was no keyboard input available.  */
-      if (nread <= 0)
-	break;
-
-#ifdef BSD4_1
-      select_alarmed = 1;  /* Force the select emulator back to life */
-#endif
-    }
+#ifdef SYNC_INPUT
+  interrupt_input_pending = 1;
+#else
+  handle_async_input ();
+#endif
 
 #ifdef BSD4_1
   sigfree ();
@@ -6863,7 +6838,7 @@
 reinvoke_input_signal ()
 {
 #ifdef SIGIO
-  kill (getpid (), SIGIO);
+  handle_async_input ();
 #endif
 }
 
@@ -10123,7 +10098,6 @@
   discard_tty_input ();
 
   kbd_fetch_ptr =  kbd_store_ptr;
-  Ffillarray (kbd_buffer_gcpro, Qnil);
   input_pending = 0;
 
   return Qnil;
@@ -10217,17 +10191,13 @@
      Should we ignore anything that was typed in at the "wrong" kboard?  */
   for (; kbd_fetch_ptr != kbd_store_ptr; kbd_fetch_ptr++)
     {
-      int idx;
 
       if (kbd_fetch_ptr == kbd_buffer + KBD_BUFFER_SIZE)
 	kbd_fetch_ptr = kbd_buffer;
       if (kbd_fetch_ptr->kind == ASCII_KEYSTROKE_EVENT)
 	stuff_char (kbd_fetch_ptr->code);
 
-      kbd_fetch_ptr->kind = NO_EVENT;
-      idx = 2 * (kbd_fetch_ptr - kbd_buffer);
-      ASET (kbd_buffer_gcpro, idx, Qnil);
-      ASET (kbd_buffer_gcpro, idx + 1, Qnil);
+      clear_event (kbd_fetch_ptr);
     }
 
   input_pending = 0;
@@ -10679,7 +10649,6 @@
   recent_keys_index = 0;
   kbd_fetch_ptr = kbd_buffer;
   kbd_store_ptr = kbd_buffer;
-  kbd_buffer_gcpro = Fmake_vector (make_number (2 * KBD_BUFFER_SIZE), Qnil);
 #ifdef HAVE_MOUSE
   do_mouse_tracking = Qnil;
 #endif
@@ -10976,9 +10945,6 @@
   Fset (Qextended_command_history, Qnil);
   staticpro (&Qextended_command_history);
 
-  kbd_buffer_gcpro = Fmake_vector (make_number (2 * KBD_BUFFER_SIZE), Qnil);
-  staticpro (&kbd_buffer_gcpro);
-
   accent_key_syms = Qnil;
   staticpro (&accent_key_syms);
 
--- a/src/lisp.h	Thu Jan 22 02:36:55 2004 +0000
+++ b/src/lisp.h	Thu Jan 22 15:37:19 2004 +0000
@@ -1,5 +1,5 @@
 /* Fundamental definitions for GNU Emacs Lisp interpreter.
-   Copyright (C) 1985,86,87,93,94,95,97,98,1999,2000, 2001, 2002, 2003
+   Copyright (C) 1985,86,87,93,94,95,97,98,1999,2000,01,02,03,2004
      Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -67,10 +67,6 @@
 			   ? (void) 0				\
 			   : die ((msg), __FILE__, __LINE__)),	\
 			  0)
-
-/* Let's get some compile-time checking too.  */
-#undef NO_UNION_TYPE
-
 #else
 
 /* Produce same side effects and result, but don't complain.  */
@@ -293,12 +289,55 @@
 /* For convenience, we also store the number of elements in these bits.  */
 #define PSEUDOVECTOR_SIZE_MASK 0x1ff
 
+/***** Select the tagging scheme.  *****/
+
+/* First, try and define DECL_ALIGN(type,var) which declares a static
+   variable VAR of type TYPE with the added requirement that it be
+   TYPEBITS-aligned. */
+#if defined USE_LSB_TAG && !defined DECL_ALIGN
+/* What compiler directive should we use for non-gcc compilers?  -stef  */
+# if defined (__GNUC__)
+#  define DECL_ALIGN(type, var) \
+    type __attribute__ ((__aligned__ (1 << GCTYPEBITS))) var
+# else
+#  error "USE_LSB_TAG used without defining DECL_ALIGN"
+# endif
+#endif
+
+#ifndef USE_LSB_TAG
+/* Just remove the alignment annotation if we don't use it.  */
+#undef DECL_ALIGN
+#define DECL_ALIGN(type, var) type var
+#endif
+
+
 /* These macros extract various sorts of values from a Lisp_Object.
  For example, if tem is a Lisp_Object whose type is Lisp_Cons,
  XCONS (tem) is the struct Lisp_Cons * pointing to the memory for that cons.  */
 
 #ifdef NO_UNION_TYPE
 
+#ifdef USE_LSB_TAG
+
+#define TYPEMASK ((((EMACS_INT) 1) << GCTYPEBITS) - 1)
+#define XTYPE(a) ((enum Lisp_Type) (((EMACS_UINT) (a)) & TYPEMASK))
+#define XINT(a) (((EMACS_INT) (a)) >> GCTYPEBITS)
+#define XUINT(a) (((EMACS_UINT) (a)) >> GCTYPEBITS)
+#define XSET(var, type, ptr)					\
+    (eassert (XTYPE (ptr) == 0), /* Check alignment.  */	\
+     (var) = ((EMACS_INT) (type)) | ((EMACS_INT) (ptr)))
+#define make_number(N) (((EMACS_INT) (N)) << GCTYPEBITS)
+
+/* XFASTINT and XSETFASTINT are for use when the integer is known to be
+   positive, in which case the implementation can sometimes be faster
+   depending on the tagging scheme.  With USE_LSB_TAG, there's no benefit.  */
+#define XFASTINT(a) XINT (a)
+#define XSETFASTINT(a, b) ((a) = make_number (b))
+
+#define XPNTR(a) ((EMACS_INT) ((a) & ~TYPEMASK))
+
+#else  /* not USE_LSB_TAG */
+
 #define VALMASK ((((EMACS_INT) 1) << VALBITS) - 1)
 
 /* One need to override this if there must be high bits set in data space
@@ -337,6 +376,8 @@
 #define make_number(N)		\
   ((((EMACS_INT) (N)) & VALMASK) | ((EMACS_INT) Lisp_Int) << VALBITS)
 
+#endif /* not USE_LSB_TAG */
+
 #define EQ(x, y) ((x) == (y))
 
 #else /* not NO_UNION_TYPE */
@@ -1150,6 +1191,13 @@
     unsigned gcmarkbit : 1;
     int spacer : 15;
     union Lisp_Misc *chain;
+#ifdef USE_LSB_TAG
+    /* Try to make sure that sizeof(Lisp_Misc) preserves TYPEBITS-alignment.
+       This assumes that Lisp_Marker is the largest of the alternatives and
+       that Lisp_Intfwd has the same size as "Lisp_Free w/o padding".  */
+    char padding[((((sizeof (struct Lisp_Marker) - 1) >> GCTYPEBITS) + 1)
+		  << GCTYPEBITS) - sizeof (struct Lisp_Intfwd)];
+#endif
   };
 
 /* To get the type field of a union Lisp_Misc, use XMISCTYPE.
@@ -1517,7 +1565,7 @@
 
 #define DEFUN(lname, fnname, sname, minargs, maxargs, prompt, doc)	\
   Lisp_Object fnname ();						\
-  struct Lisp_Subr sname =						\
+  DECL_ALIGN (struct Lisp_Subr, sname) =				\
     { PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)),	\
       fnname, minargs, maxargs, lname, prompt, 0};			\
   Lisp_Object fnname
@@ -1528,7 +1576,7 @@
    arguments, so we can catch errors with maxargs at compile-time.  */
 #define DEFUN(lname, fnname, sname, minargs, maxargs, prompt, doc)	\
   Lisp_Object fnname DEFUN_ARGS_ ## maxargs ;				\
-  struct Lisp_Subr sname =						\
+  DECL_ALIGN (struct Lisp_Subr, sname) =				\
     { PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)),	\
       fnname, minargs, maxargs, lname, prompt, 0};			\
   Lisp_Object fnname
@@ -1675,6 +1723,22 @@
    This is a good thing to do around a loop that has no side effects
    and (in particular) cannot call arbitrary Lisp code.  */
 
+#ifdef SYNC_INPUT
+extern void handle_async_input P_ ((void));
+extern int interrupt_input_pending;
+#define QUIT						\
+  do {							\
+    if (!NILP (Vquit_flag) && NILP (Vinhibit_quit))	\
+      {							\
+	Vquit_flag = Qnil;				\
+	Fsignal (Qquit, Qnil);				\
+      }							\
+    else if (interrupt_input_pending)			\
+      handle_async_input ();				\
+  } while (0)
+
+#else  /* not SYNC_INPUT */
+
 #define QUIT						\
   do {							\
     if (!NILP (Vquit_flag) && NILP (Vinhibit_quit))	\
@@ -1684,6 +1748,9 @@
       }							\
   } while (0)
 
+#endif	/* not SYNC_INPUT */
+
+
 /* Nonzero if ought to quit now.  */
 
 #define QUITP (!NILP (Vquit_flag) && NILP (Vinhibit_quit))
--- a/src/lread.c	Thu Jan 22 02:36:55 2004 +0000
+++ b/src/lread.c	Thu Jan 22 15:37:19 2004 +0000
@@ -1,5 +1,5 @@
 /* Lisp parsing and input streams.
-   Copyright (C) 1985, 86, 87, 88, 89, 93, 94, 95, 97, 98, 99, 2000, 01, 2003
+   Copyright (C) 1985,86,87,88,89,93,94,95,97,98,99,2000,01,03,2004
       Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -3496,7 +3496,6 @@
 {
   Lisp_Object sym, val;
   int offset;
-  extern struct buffer buffer_local_symbols;
 
   sym = intern (namestring);
   val = allocate_misc ();
--- a/src/macterm.c	Thu Jan 22 02:36:55 2004 +0000
+++ b/src/macterm.c	Thu Jan 22 15:37:19 2004 +0000
@@ -1143,6 +1143,9 @@
 				output_cursor.x, output_cursor.y);
 
       x_draw_vertical_border (w);
+
+      draw_window_fringes (w);
+
       UNBLOCK_INPUT;
     }
 
@@ -1239,11 +1242,7 @@
   xassert (w);
 
   if (!desired_row->mode_line_p && !w->pseudo_window_p)
-    {
-      BLOCK_INPUT;
-      draw_row_fringe_bitmaps (w, desired_row);
-      UNBLOCK_INPUT;
-    }
+    desired_row->redraw_fringe_bitmaps_p = 1;
 
   /* When a window has disappeared, make sure that no rest of
      full-width rows stays visible in the internal border.  Could
@@ -1295,9 +1294,24 @@
   XGCValues gcv;
   GC gc = f->output_data.mac->normal_gc;
   struct face *face = p->face;
+  int rowY;
 
   /* Must clip because of partially visible lines.  */
-  x_clip_to_row (w, row, gc);
+  rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
+  if (p->y < rowY)
+    {
+      /* Adjust position of "bottom aligned" bitmap on partially
+	 visible last row.  */
+      int oldY = row->y;
+      int oldVH = row->visible_height;
+      row->visible_height = p->h;
+      row->y -= rowY - p->y;
+      x_clip_to_row (w, row, gc);
+      row->y = oldY;
+      row->visible_height = oldVH;
+    }
+  else
+    x_clip_to_row (w, row, gc);
 
   if (p->bx >= 0)
     {
@@ -4546,6 +4560,14 @@
       w->phys_cursor_width = cursor_width;
       w->phys_cursor_on_p = 1;
 
+      if (glyph_row->exact_window_width_line_p
+	  && w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA])
+	{
+	  glyph_row->cursor_in_fringe_p = 1;
+	  draw_fringe_bitmap (w, glyph_row, 0);
+	  return;
+	}
+
       switch (cursor_type)
 	{
 	case HOLLOW_BOX_CURSOR:
@@ -6643,8 +6665,8 @@
 
   if (Gestalt (gestaltPhysicalRAMSize, &physical_ram_size) != noErr
       || Gestalt (gestaltLogicalRAMSize, &logical_ram_size) != noErr
-      || physical_ram_size > 256 * 1024 * 1024
-      || logical_ram_size > 256 * 1024 * 1024)
+      || physical_ram_size > (1 << VALBITS)
+      || logical_ram_size > (1 << VALBITS))
     {
       StopAlert (RAM_TOO_LARGE_ALERT_ID, NULL);
       exit (1);
@@ -7443,7 +7465,9 @@
 
   do_get_menus ();
 
+#ifndef USE_LSB_TAG
   do_check_ram_size ();
+#endif
 
   init_emacs_passwd_dir ();
 
--- a/src/process.c	Thu Jan 22 02:36:55 2004 +0000
+++ b/src/process.c	Thu Jan 22 15:37:19 2004 +0000
@@ -1,6 +1,6 @@
 /* Asynchronous subprocess control for GNU Emacs.
    Copyright (C) 1985, 86, 87, 88, 93, 94, 95, 96, 98, 1999,
-      2001, 2002, 2003 Free Software Foundation, Inc.
+      2001, 2002, 2003, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -4080,6 +4080,10 @@
 	 Otherwise, do pending quit if requested.  */
       if (XINT (read_kbd) >= 0)
 	QUIT;
+#ifdef SYNC_INPUT
+      else if (interrupt_input_pending)
+	handle_async_input ();
+#endif
 
       /* Exit now if the cell we're waiting for became non-nil.  */
       if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
@@ -4296,7 +4300,7 @@
 		  proc = chan_process[channel];
 		  if (NILP (proc))
 		    continue;
-		  if (XPROCESS (proc)->read_output_delay > 0)
+		  if (XINT (XPROCESS (proc)->read_output_delay) > 0)
 		    {
 		      check_delay--;
 		      if (NILP (XPROCESS (proc)->read_output_skip))
--- a/src/s/darwin.h	Thu Jan 22 02:36:55 2004 +0000
+++ b/src/s/darwin.h	Thu Jan 22 15:37:19 2004 +0000
@@ -1,5 +1,5 @@
 /* System description header file for Darwin (Mac OS X).
-   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 2001, 02, 2004  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -203,9 +203,6 @@
 /* Fix compilation problem for regex.c.  */
 #define __restrict
 
-/* Fix compilation problem for md5.c.  */
-#define __attribute__(x)
-
 /* Used in dispnew.c.  Copied from freebsd.h. */
 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
 
--- a/src/search.c	Thu Jan 22 02:36:55 2004 +0000
+++ b/src/search.c	Thu Jan 22 15:37:19 2004 +0000
@@ -2553,8 +2553,16 @@
 	}
 
       if (really_changed)
-	newtext = make_string (substed, substed_len);
-
+	{
+	  if (buf_multibyte)
+	    {
+	      int nchars = multibyte_chars_in_text (substed, substed_len);
+
+	      newtext = make_multibyte_string (substed, nchars, substed_len);
+	    }
+	  else
+	    newtext = make_unibyte_string (substed, substed_len);
+	}
       xfree (substed);
     }
 
--- a/src/w32term.c	Thu Jan 22 02:36:55 2004 +0000
+++ b/src/w32term.c	Thu Jan 22 15:37:19 2004 +0000
@@ -540,6 +540,9 @@
 				output_cursor.x, output_cursor.y);
 
       x_draw_vertical_border (w);
+
+      draw_window_fringes (w);
+
       UNBLOCK_INPUT;
     }
 
@@ -624,11 +627,7 @@
   xassert (w);
 
   if (!desired_row->mode_line_p && !w->pseudo_window_p)
-    {
-      BLOCK_INPUT;
-      draw_row_fringe_bitmaps (w, desired_row);
-      UNBLOCK_INPUT;
-    }
+    desired_row->redraw_fringe_bitmaps_p = 1;
 
   /* When a window has disappeared, make sure that no rest of
      full-width rows stays visible in the internal border.  Could
@@ -678,11 +677,26 @@
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   HDC hdc;
   struct face *face = p->face;
+  int rowY;
 
   hdc = get_frame_dc (f);
 
   /* Must clip because of partially visible lines.  */
-  w32_clip_to_row (w, row, hdc);
+  rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
+  if (p->y < rowY)
+    {
+      /* Adjust position of "bottom aligned" bitmap on partially
+	 visible last row.  */
+      int oldY = row->y;
+      int oldVH = row->visible_height;
+      row->visible_height = p->h;
+      row->y -= rowY - p->y;
+      w32_clip_to_row (w, row, hdc);
+      row->y = oldY;
+      row->visible_height = oldVH;
+    }
+  else
+    w32_clip_to_row (w, row, hdc);
 
   if (p->bx >= 0)
     {
@@ -5120,6 +5134,14 @@
 	  PostMessage (hwnd, WM_EMACS_TRACK_CARET, 0, 0);
 	}
 
+      if (glyph_row->exact_window_width_line_p
+	  && w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA])
+	{
+	  glyph_row->cursor_in_fringe_p = 1;
+	  draw_fringe_bitmap (w, glyph_row, 0);
+	  return;
+	}
+
       switch (cursor_type)
 	{
 	case HOLLOW_BOX_CURSOR:
--- a/src/xdisp.c	Thu Jan 22 02:36:55 2004 +0000
+++ b/src/xdisp.c	Thu Jan 22 15:37:19 2004 +0000
@@ -1,5 +1,5 @@
 /* Display generation from window structure and buffer text.
-   Copyright (C) 1985,86,87,88,93,94,95,97,98,99,2000,01,02,03
+   Copyright (C) 1985,86,87,88,93,94,95,97,98,99,2000,01,02,03,04
    Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -310,6 +310,21 @@
 
 Lisp_Object Vshow_trailing_whitespace;
 
+#ifdef HAVE_WINDOW_SYSTEM
+/* Non-nil means that newline may flow into the right fringe.  */
+
+Lisp_Object Voverflow_newline_into_fringe;
+#endif /* HAVE_WINDOW_SYSTEM */
+
+/* Test if overflow newline into fringe.  Called with iterator IT
+   at or past right window margin, and with IT->current_x set.  */ 
+
+#define IT_OVERFLOW_NEWLINE_INTO_FRINGE(it)	\
+  (!NILP (Voverflow_newline_into_fringe)	\
+   && FRAME_WINDOW_P (it->f)			\
+   && WINDOW_RIGHT_FRINGE_WIDTH (it->w) > 0	\
+   && it->current_x == it->last_visible_x)
+
 /* Non-nil means show the text cursor in void text areas
    i.e. in blank areas after eol and eob.  This used to be
    the default in 21.3.  */
@@ -5590,7 +5605,20 @@
 		      ++it->hpos;
 		      it->current_x = new_x;
 		      if (i == it->nglyphs - 1)
-			set_iterator_to_next (it, 1);
+			{
+			  set_iterator_to_next (it, 1);
+#ifdef HAVE_WINDOW_SYSTEM
+			  if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
+			    {
+			      get_next_display_element (it);
+			      if (ITERATOR_AT_END_OF_LINE_P (it))
+				{
+				  result = MOVE_NEWLINE_OR_CR;
+				  break;
+				}
+			    }
+#endif /* HAVE_WINDOW_SYSTEM */
+			}
 		    }
 		  else
 		    {
@@ -5647,6 +5675,17 @@
       if (it->truncate_lines_p
 	  && it->current_x >= it->last_visible_x)
 	{
+#ifdef HAVE_WINDOW_SYSTEM
+	  if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
+	    {
+	      get_next_display_element (it);
+	      if (ITERATOR_AT_END_OF_LINE_P (it))
+		{
+		  result = MOVE_NEWLINE_OR_CR;
+		  break;
+		}
+	    }
+#endif /* HAVE_WINDOW_SYSTEM */
 	  result = MOVE_LINE_TRUNCATED;
 	  break;
 	}
@@ -8895,26 +8934,205 @@
 
 #ifdef HAVE_WINDOW_SYSTEM
 
+/* Notice that all bitmaps bits are "mirrored".  */
+
 /* An arrow like this: `<-'.  */
+/*
+  ...xx...
+  ....xx..
+  .....xx.
+  ..xxxxxx
+  ..xxxxxx
+  .....xx.
+  ....xx..
+  ...xx...
+*/
 static unsigned char left_bits[] = {
    0x18, 0x0c, 0x06, 0x3f, 0x3f, 0x06, 0x0c, 0x18};
 
+
 /* Right truncation arrow bitmap `->'.  */
+/*
+  ...xx...
+  ..xx....
+  .xx.....
+  xxxxxx..
+  xxxxxx..
+  .xx.....
+  ..xx....
+  ...xx...
+*/
 static unsigned char right_bits[] = {
    0x18, 0x30, 0x60, 0xfc, 0xfc, 0x60, 0x30, 0x18};
 
+
+/* Up arrow bitmap.  */
+/*
+  ...xx...
+  ..xxxx..
+  .xxxxxx.
+  xxxxxxxx
+  ...xx...
+  ...xx...
+  ...xx...
+  ...xx...
+*/
+static unsigned char up_arrow_bits[] = {
+   0x18, 0x3c, 0x7e, 0xff, 0x18, 0x18, 0x18, 0x18};
+
+
+/* Down arrow bitmap.  */
+/*
+  ...xx...
+  ...xx...
+  ...xx...
+  ...xx...
+  xxxxxxxx
+  .xxxxxx.
+  ..xxxx..
+  ...xx...
+*/
+static unsigned char down_arrow_bits[] = {
+   0x18, 0x18, 0x18, 0x18, 0xff, 0x7e, 0x3c, 0x18};
+
 /* Marker for continued lines.  */
+/*
+  ..xxxx..
+  .xxxxx..
+  xx......
+  xxx..x..
+  xxxxxx..
+  .xxxxx..
+  ..xxxx..
+  .xxxxx..
+*/
 static unsigned char continued_bits[] = {
    0x3c, 0x7c, 0xc0, 0xe4, 0xfc, 0x7c, 0x3c, 0x7c};
 
 /* Marker for continuation lines.  */
+/*
+  ..xxxx..
+  ..xxxxx.
+  ......xx
+  ..x..xxx
+  ..xxxxxx
+  ..xxxxx.
+  ..xxxx..
+  ..xxxxx.
+*/
 static unsigned char continuation_bits[] = {
    0x3c, 0x3e, 0x03, 0x27, 0x3f, 0x3e, 0x3c, 0x3e};
 
 /* Overlay arrow bitmap.  A triangular arrow.  */
+/*
+  ......xx
+  ....xxxx
+  ...xxxxx
+  ..xxxxxx
+  ..xxxxxx
+  ...xxxxx
+  ....xxxx
+  ......xx
+*/
 static unsigned char ov_bits[] = {
    0x03, 0x0f, 0x1f, 0x3f, 0x3f, 0x1f, 0x0f, 0x03};
 
+
+/* First line bitmap.  An left-up angle.  */
+/*
+  ..xxxxxx
+  ..xxxxxx
+  ......xx
+  ......xx
+  ......xx
+  ......xx
+  ......xx
+  ........
+*/
+static unsigned char first_line_bits[] = {
+   0x3f, 0x3f, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00};
+
+
+/* Last line bitmap.  An left-down angle.  */
+/*
+  ........
+  xx......
+  xx......
+  xx......
+  xx......
+  xx......
+  xxxxxx..
+  xxxxxx..
+*/
+static unsigned char last_line_bits[] = {
+   0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xfc};
+
+/* Filled box cursor bitmap.  A filled box; max 13 pixels high.  */
+/*
+  .xxxxxxx
+  .xxxxxxx
+  .xxxxxxx
+  .xxxxxxx
+  .xxxxxxx
+  .xxxxxxx
+  .xxxxxxx
+  .xxxxxxx
+  .xxxxxxx
+  .xxxxxxx
+  .xxxxxxx
+  .xxxxxxx
+  .xxxxxxx
+*/
+static unsigned char filled_box_cursor_bits[] = {
+   0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f};
+
+/* Hollow box cursor bitmap.  A hollow box; max 13 pixels high.  */
+/*
+  .xxxxxxx
+  .x.....x
+  .x.....x
+  .x.....x
+  .x.....x
+  .x.....x
+  .x.....x
+  .x.....x
+  .x.....x
+  .x.....x
+  .x.....x
+  .x.....x
+  .xxxxxxx
+*/
+static unsigned char hollow_box_cursor_bits[] = {
+   0x7f, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x7f};
+
+/* Bar cursor bitmap.  A vertical bar; max 13 pixels high.  */
+/*
+  ......xx
+  ......xx
+  ......xx
+  ......xx
+  ......xx
+  ......xx
+  ......xx
+  ......xx
+  ......xx
+  ......xx
+  ......xx
+  ......xx
+  ......xx
+*/
+static unsigned char bar_cursor_bits[] = {
+   0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03};
+
+/* HBar cursor bitmap.  A horisontal bar; 2 pixels high.  */
+/*
+  .xxxxxxx
+  .xxxxxxx
+*/
+static unsigned char hbar_cursor_bits[] = {
+  0x7f, 0x7f};
+
+
 /* Bitmap drawn to indicate lines not displaying text if
    `indicate-empty-lines' is non-nil.  */
 static unsigned char zv_bits[] = {
@@ -8927,32 +9145,89 @@
   0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
   0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00};
 
+/* Hollow square bitmap.  */
+/*
+  .xxxxxx.
+  .x....x.
+  .x....x.
+  .x....x.
+  .x....x.
+  .xxxxxx.
+*/
+static unsigned char hollow_square_bits[] = {
+   0x7e, 0x42, 0x42, 0x42, 0x42, 0x7e};
+
+
 struct fringe_bitmap fringe_bitmaps[MAX_FRINGE_BITMAPS] =
 {
   { 0, 0, 0, NULL /* NO_FRINGE_BITMAP */ },
   { 8, sizeof (left_bits), 0, left_bits },
   { 8, sizeof (right_bits), 0, right_bits },
+  { 8, sizeof (up_arrow_bits), -1, up_arrow_bits },
+  { 8, sizeof (down_arrow_bits), -2, down_arrow_bits },
   { 8, sizeof (continued_bits), 0, continued_bits },
   { 8, sizeof (continuation_bits), 0, continuation_bits },
   { 8, sizeof (ov_bits), 0, ov_bits },
-  { 8, sizeof (zv_bits), 3, zv_bits }
+  { 8, sizeof (first_line_bits), -1, first_line_bits },
+  { 8, sizeof (last_line_bits), -2, last_line_bits },
+  { 8, sizeof (filled_box_cursor_bits), 0, filled_box_cursor_bits },
+  { 8, sizeof (hollow_box_cursor_bits), 0, hollow_box_cursor_bits },
+  { 8, sizeof (bar_cursor_bits), 0, bar_cursor_bits },
+  { 8, sizeof (hbar_cursor_bits), -2, hbar_cursor_bits },
+  { 8, sizeof (zv_bits), 3, zv_bits },
+  { 8, sizeof (hollow_square_bits), 0, hollow_square_bits },
 };
 
 
 /* Draw the bitmap WHICH in one of the left or right fringes of
    window W.  ROW is the glyph row for which to display the bitmap; it
    determines the vertical position at which the bitmap has to be
-   drawn.  */
-
-static void
-draw_fringe_bitmap (w, row, which, left_p)
+   drawn.
+   LEFT_P is 1 for left fringe, 0 for right fringe.
+*/
+
+void
+draw_fringe_bitmap (w, row, left_p)
      struct window *w;
      struct glyph_row *row;
-     enum fringe_bitmap_type which;
      int left_p;
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   struct draw_fringe_bitmap_params p;
+  enum fringe_bitmap_type which;
+  int period;
+
+  if (left_p)
+    which = row->left_fringe_bitmap;
+  else if (!row->cursor_in_fringe_p)
+    which = row->right_fringe_bitmap;
+  else
+    switch (w->phys_cursor_type)
+      {
+      case HOLLOW_BOX_CURSOR:
+	if (row->visible_height >= sizeof(hollow_box_cursor_bits))
+	  which = HOLLOW_BOX_CURSOR_BITMAP;
+	else
+	  which = HOLLOW_SQUARE_BITMAP;
+	break;
+      case FILLED_BOX_CURSOR:
+	which = FILLED_BOX_CURSOR_BITMAP;
+	break;
+      case BAR_CURSOR:
+	which = BAR_CURSOR_BITMAP;
+	break;
+      case HBAR_CURSOR:
+	which = HBAR_CURSOR_BITMAP;
+	break;
+      case NO_CURSOR:
+      default:
+	w->phys_cursor_on_p = 0;
+	row->cursor_in_fringe_p = 0;
+	which = row->right_fringe_bitmap;
+	break;
+      }
+
+  period = fringe_bitmaps[which].period;
 
   /* Convert row to frame coordinates.  */
   p.y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
@@ -8961,9 +9236,7 @@
   p.wd = fringe_bitmaps[which].width;
 
   p.h = fringe_bitmaps[which].height;
-  p.dh = (fringe_bitmaps[which].period
-	  ? (p.y % fringe_bitmaps[which].period)
-	  : 0);
+  p.dh = (period > 0 ? (p.y % period) : 0);
   p.h -= p.dh;
   /* Clip bitmap if too high.  */
   if (p.h > row->height)
@@ -9023,7 +9296,13 @@
     }
 
   /* Adjust y to the offset in the row to start drawing the bitmap.  */
-  p.y += (row->height - p.h) / 2;
+  if (period == 0)
+    p.y += (row->height - p.h) / 2;
+  else if (period == -2)
+    {
+      p.h = fringe_bitmaps[which].height;
+      p.y += (row->visible_height - p.h);
+    }
 
   FRAME_RIF (f)->draw_fringe_bitmap (w, row, &p);
 }
@@ -9036,8 +9315,6 @@
      struct window *w;
      struct glyph_row *row;
 {
-  enum fringe_bitmap_type bitmap;
-
   xassert (interrupt_input_blocked);
 
   /* If row is completely invisible, because of vscrolling, we
@@ -9046,35 +9323,35 @@
     return;
 
   if (WINDOW_LEFT_FRINGE_WIDTH (w) != 0)
-    {
-      /* Decide which bitmap to draw in the left fringe.  */
-      if (row->overlay_arrow_p)
-	bitmap = OVERLAY_ARROW_BITMAP;
-      else if (row->truncated_on_left_p)
-	bitmap = LEFT_TRUNCATION_BITMAP;
-      else if (MATRIX_ROW_CONTINUATION_LINE_P (row))
-	bitmap = CONTINUATION_LINE_BITMAP;
-      else if (row->indicate_empty_line_p)
-	bitmap = ZV_LINE_BITMAP;
-      else
-	bitmap = NO_FRINGE_BITMAP;
-
-      draw_fringe_bitmap (w, row, bitmap, 1);
-    }
+    draw_fringe_bitmap (w, row, 1);
 
   if (WINDOW_RIGHT_FRINGE_WIDTH (w) != 0)
-    {
-      /* Decide which bitmap to draw in the right fringe.  */
-      if (row->truncated_on_right_p)
-	bitmap = RIGHT_TRUNCATION_BITMAP;
-      else if (row->continued_p)
-	bitmap = CONTINUED_LINE_BITMAP;
-      else if (row->indicate_empty_line_p && WINDOW_LEFT_FRINGE_WIDTH (w) == 0)
-	bitmap = ZV_LINE_BITMAP;
-      else
-	bitmap = NO_FRINGE_BITMAP;
-
-      draw_fringe_bitmap (w, row, bitmap, 0);
+    draw_fringe_bitmap (w, row, 0);
+}
+
+/* Draw the fringes of window W.  Only fringes for rows marked for
+   update in redraw_fringe_bitmaps_p are drawn.  */
+
+void
+draw_window_fringes (w)
+     struct window *w;
+{
+  struct glyph_row *row;
+  int yb = window_text_bottom_y (w);
+  int nrows = w->current_matrix->nrows;
+  int y = 0, rn;
+
+  if (w->pseudo_window_p)
+    return;
+
+  for (y = 0, rn = 0, row = w->current_matrix->rows;
+       y < yb && rn < nrows;
+       y += row->height, ++row, ++rn)
+    {
+      if (!row->redraw_fringe_bitmaps_p)
+	continue;
+      draw_row_fringe_bitmaps (w, row);
+      row->redraw_fringe_bitmaps_p = 0;
     }
 }
 
@@ -9982,6 +10259,9 @@
 	      *w->desired_matrix->method = 0;
 	      debug_method_add (w, "optimization 1");
 #endif
+#ifdef HAVE_WINDOW_SYSTEM
+	      update_window_fringes (w, 0);
+#endif
 	      goto update;
 	    }
 	  else
@@ -11394,6 +11674,137 @@
       (w, end - start, whole, start);
 }
 
+#ifdef HAVE_WINDOW_SYSTEM
+
+/* Recalculate the bitmaps to show in the fringes of window W.
+   If FORCE_P is 0, only mark rows with modified bitmaps for update in
+   redraw_fringe_bitmaps_p; else mark all rows for update.  */
+
+int
+update_window_fringes (w, force_p)
+     struct window *w;
+     int force_p;
+{
+  struct glyph_row *row, *cur = 0;
+  int yb = window_text_bottom_y (w);
+  int rn, nrows = w->current_matrix->nrows;
+  int y;
+  int redraw_p = 0;
+  Lisp_Object ind;
+
+  if (w->pseudo_window_p)
+    return 0;
+
+  if (!MINI_WINDOW_P (w)
+      && (ind = XBUFFER (w->buffer)->indicate_buffer_boundaries, !NILP (ind)))
+    {
+      int do_eob = 1, do_bob = 1;
+
+      for (y = 0, rn = 0;
+	   y < yb && rn < nrows;
+	   y += row->height, ++rn)
+	{
+	  unsigned indicate_bob_p, indicate_top_line_p;
+	  unsigned indicate_eob_p, indicate_bottom_line_p;
+	  
+	  row = w->desired_matrix->rows + rn;
+	  if (!row->enabled_p)
+	    row = w->current_matrix->rows + rn;
+
+	  indicate_bob_p = row->indicate_bob_p;
+	  indicate_top_line_p = row->indicate_top_line_p;
+	  indicate_eob_p = row->indicate_eob_p;
+	  indicate_bottom_line_p = row->indicate_bottom_line_p;
+	  
+	  row->indicate_bob_p = row->indicate_top_line_p = 0;
+	  row->indicate_eob_p = row->indicate_bottom_line_p = 0;
+
+	  if (MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->buffer)))
+	    row->indicate_bob_p = do_bob, do_bob = 0;
+	  else if (EQ (ind, Qt)
+		   && (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0) == rn)
+	    row->indicate_top_line_p = 1;
+
+	  if (MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->buffer)))
+	    row->indicate_eob_p = do_eob, do_eob = 0;
+	  else if (EQ (ind, Qt)
+		   && y + row->height >= yb)
+	    row->indicate_bottom_line_p = 1;
+
+	  if (indicate_bob_p != row->indicate_bob_p
+	      || indicate_top_line_p != row->indicate_top_line_p
+	      || indicate_eob_p != row->indicate_eob_p
+	      || indicate_bottom_line_p != row->indicate_bottom_line_p)
+	    row->redraw_fringe_bitmaps_p = 1;
+	}
+    }
+
+  for (y = 0, rn = 0;
+       y < yb && rn < nrows;
+       y += row->height, rn++)
+    {
+      enum fringe_bitmap_type left, right;
+
+      row = w->desired_matrix->rows + rn;
+      cur = w->current_matrix->rows + rn;
+      if (!row->enabled_p)
+	row = cur;
+
+      /* Decide which bitmap to draw in the left fringe.  */
+      if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0)
+	left = NO_FRINGE_BITMAP;
+      else if (row->overlay_arrow_p)
+	left = OVERLAY_ARROW_BITMAP;
+      else if (row->truncated_on_left_p)
+	left = LEFT_TRUNCATION_BITMAP;
+      else if (MATRIX_ROW_CONTINUATION_LINE_P (row))
+	left = CONTINUATION_LINE_BITMAP;
+      else if (row->indicate_empty_line_p)
+	left = ZV_LINE_BITMAP;
+      else if (row->indicate_bob_p)
+	left = FIRST_LINE_BITMAP;
+      else
+	left = NO_FRINGE_BITMAP;
+
+      /* Decide which bitmap to draw in the right fringe.  */
+      if (WINDOW_RIGHT_FRINGE_WIDTH (w) == 0)
+	right = NO_FRINGE_BITMAP;
+      else if (row->truncated_on_right_p)
+	right = RIGHT_TRUNCATION_BITMAP;
+      else if (row->continued_p)
+	right = CONTINUED_LINE_BITMAP;
+      else if (row->indicate_eob_p)
+	right = LAST_LINE_BITMAP;
+      else if (row->indicate_top_line_p) 
+	right = UP_ARROW_BITMAP;
+      else if (row->indicate_bottom_line_p)
+	right = DOWN_ARROW_BITMAP;
+      else if (row->indicate_empty_line_p && WINDOW_LEFT_FRINGE_WIDTH (w) == 0)
+	right = ZV_LINE_BITMAP;
+      else
+	right = NO_FRINGE_BITMAP;
+
+      if (force_p
+	  || row->y != cur->y
+	  || row->visible_height != cur->visible_height
+	  || left != cur->left_fringe_bitmap
+	  || right != cur->right_fringe_bitmap
+	  || cur->redraw_fringe_bitmaps_p)
+	{
+	  redraw_p = row->redraw_fringe_bitmaps_p = cur->redraw_fringe_bitmaps_p = 1;
+	  cur->left_fringe_bitmap = left;
+	  cur->right_fringe_bitmap = right;
+	}
+
+      row->left_fringe_bitmap = left;
+      row->right_fringe_bitmap = right;
+    }
+
+  return redraw_p;
+}
+
+#endif /* HAVE_WINDOW_SYSTEM */
+
 /* Redisplay leaf window WINDOW.  JUST_THIS_ONE_P non-zero means only
    selected_window is redisplayed.
 
@@ -11416,6 +11827,7 @@
   struct it it;
   /* Record it now because it's overwritten.  */
   int current_matrix_up_to_date_p = 0;
+  int used_current_matrix_p = 0;
   /* This is less strict than current_matrix_up_to_date_p.
      It indictes that the buffer contents and narrowing are unchanged.  */
   int buffer_unchanged_p = 0;
@@ -11722,6 +12134,7 @@
       switch (rc)
 	{
 	case CURSOR_MOVEMENT_SUCCESS:
+	  used_current_matrix_p = 1;
 	  goto done;
 
 #if 0  /* try_cursor_movement never returns this value.  */
@@ -11786,7 +12199,8 @@
 	     buffer.  */
 	  || !NILP (Vwindow_scroll_functions)
 	  || MINI_WINDOW_P (w)
-	  || !try_window_reusing_current_matrix (w))
+	  || !(used_current_matrix_p =
+	       try_window_reusing_current_matrix (w)))
 	{
 	  IF_DEBUG (debug_method_add (w, "1"));
 	  try_window (window, startp);
@@ -11915,7 +12329,8 @@
       || !NILP (Vwindow_scroll_functions)
       || !just_this_one_p
       || MINI_WINDOW_P (w)
-      || !try_window_reusing_current_matrix (w))
+      || !(used_current_matrix_p =
+	   try_window_reusing_current_matrix (w)))
     try_window (window, startp);
 
   /* If new fonts have been loaded (due to fontsets), give up.  We
@@ -12077,6 +12492,19 @@
 #endif
     }
 
+#ifdef HAVE_WINDOW_SYSTEM
+  if (update_window_fringes (w, 0)
+      && (used_current_matrix_p || overlay_arrow_seen)
+      && !w->pseudo_window_p)
+    {
+      update_begin (f);
+      BLOCK_INPUT;
+      draw_window_fringes (w);
+      UNBLOCK_INPUT;
+      update_end (f);
+    }
+#endif /* HAVE_WINDOW_SYSTEM */
+
   /* We go to this label, with fonts_changed_p nonzero,
      if it is necessary to try again using larger glyph matrices.
      We have to redeem the scroll bar even in this case,
@@ -12334,6 +12762,7 @@
 		row->visible_height -= min_y - row->y;
 	      if (row->y + row->height > max_y)
 		row->visible_height -= row->y + row->height - max_y;
+	      row->redraw_fringe_bitmaps_p = 1;
 
 	      it.current_y += row->height;
 
@@ -12473,7 +12902,6 @@
 
       if (run.height)
 	{
-	  struct frame *f = XFRAME (WINDOW_FRAME (w));
 	  update_begin (f);
 	  FRAME_RIF (f)->update_window_begin_hook (w);
 	  FRAME_RIF (f)->clear_window_mouse_face (w);
@@ -12494,6 +12922,7 @@
 	    row->visible_height -= min_y - row->y;
 	  if (row->y + row->height > max_y)
 	    row->visible_height -= row->y + row->height - max_y;
+	  row->redraw_fringe_bitmaps_p = 1;
 	}
 
       /* Scroll the current matrix.  */
@@ -12616,7 +13045,8 @@
 	     row is not unchanged because it may be no longer
 	     continued.  */
 	  && !(MATRIX_ROW_END_CHARPOS (row) == first_changed_pos
-	       && row->continued_p))
+	       && (row->continued_p
+		   || row->exact_window_width_line_p)))
 	row_found = row;
 
       /* Stop if last visible row.  */
@@ -14512,7 +14942,20 @@
 		      it->continuation_lines_width += new_x;
 		      ++it->hpos;
 		      if (i == nglyphs - 1)
-			set_iterator_to_next (it, 1);
+			{
+			  set_iterator_to_next (it, 1);
+#ifdef HAVE_WINDOW_SYSTEM
+			  if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
+			    {
+			      get_next_display_element (it);
+			      if (ITERATOR_AT_END_OF_LINE_P (it))
+				{
+				  row->continued_p = 0;
+				  row->exact_window_width_line_p = 1;
+				}
+			    }
+#endif /* HAVE_WINDOW_SYSTEM */
+			}
 		    }
 		  else if (CHAR_GLYPH_PADDING_P (*glyph)
 			   && !FRAME_WINDOW_P (it->f))
@@ -14614,6 +15057,7 @@
 	    break;
 	}
 
+    at_end_of_line:
       /* Is this a line end?  If yes, we're also done, after making
 	 sure that a non-default face is extended up to the right
 	 margin of the window.  */
@@ -14623,9 +15067,12 @@
 
 	  row->ends_in_newline_from_string_p = STRINGP (it->object);
 
+#ifdef HAVE_WINDOW_SYSTEM
 	  /* Add a space at the end of the line that is used to
 	     display the cursor there.  */
-	  append_space (it, 0);
+	  if (!IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
+	    append_space (it, 0);
+#endif /* HAVE_WINDOW_SYSTEM */
 
 	  /* Extend the face to the end of the line.  */
 	  extend_face_to_end_of_line (it);
@@ -14666,6 +15113,21 @@
 		  produce_special_glyphs (it, IT_TRUNCATION);
 		}
 	    }
+#ifdef HAVE_WINDOW_SYSTEM
+	  else
+	    {
+	      /* Don't truncate if we can overflow newline into fringe.  */
+	      if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
+		{
+		  get_next_display_element (it);
+		  if (ITERATOR_AT_END_OF_LINE_P (it))
+		    {
+		      row->exact_window_width_line_p = 1;
+		      goto at_end_of_line;
+		    }
+		}
+	    }
+#endif /* HAVE_WINDOW_SYSTEM */
 
 	  row->truncated_on_right_p = 1;
 	  it->continuation_lines_width = 0;
@@ -19213,36 +19675,53 @@
      enum glyph_row_area area;
      int x0, y0, x1, y1;
 {
-  if (area == TEXT_AREA && w->phys_cursor_on_p)
-    {
-      int cx0 = w->phys_cursor.x;
-      int cx1 = cx0 + w->phys_cursor_width;
-      int cy0 = w->phys_cursor.y;
-      int cy1 = cy0 + w->phys_cursor_height;
-
-      if (x0 <= cx0 && (x1 < 0 || x1 >= cx1))
-	{
-	  /* The cursor image will be completely removed from the
-	     screen if the output area intersects the cursor area in
-	     y-direction.  When we draw in [y0 y1[, and some part of
-	     the cursor is at y < y0, that part must have been drawn
-	     before.  When scrolling, the cursor is erased before
-	     actually scrolling, so we don't come here.  When not
-	     scrolling, the rows above the old cursor row must have
-	     changed, and in this case these rows must have written
-	     over the cursor image.
-
-	     Likewise if part of the cursor is below y1, with the
-	     exception of the cursor being in the first blank row at
-	     the buffer and window end because update_text_area
-	     doesn't draw that row.  (Except when it does, but
-	     that's handled in update_text_area.)  */
-
-	  if (((y0 >= cy0 && y0 < cy1) || (y1 > cy0 && y1 < cy1))
-	      && w->current_matrix->rows[w->phys_cursor.vpos].displays_text_p)
-	    w->phys_cursor_on_p = 0;
-	}
-    }
+  int cx0, cx1, cy0, cy1;
+  struct glyph_row *row;
+
+  if (!w->phys_cursor_on_p)
+    return;
+  if (area != TEXT_AREA)
+    return;
+
+  row = w->current_matrix->rows + w->phys_cursor.vpos;
+  if (!row->displays_text_p)
+    return;
+
+  if (row->cursor_in_fringe_p)
+    {
+      row->cursor_in_fringe_p = 0;
+      draw_fringe_bitmap (w, row, 0);
+      w->phys_cursor_on_p = 0;
+      return;
+    }
+
+  cx0 = w->phys_cursor.x;
+  cx1 = cx0 + w->phys_cursor_width;
+  if (x0 > cx0 || (x1 >= 0 && x1 < cx1))
+    return;
+
+  /* The cursor image will be completely removed from the
+     screen if the output area intersects the cursor area in
+     y-direction.  When we draw in [y0 y1[, and some part of
+     the cursor is at y < y0, that part must have been drawn
+     before.  When scrolling, the cursor is erased before
+     actually scrolling, so we don't come here.  When not
+     scrolling, the rows above the old cursor row must have
+     changed, and in this case these rows must have written
+     over the cursor image.
+
+     Likewise if part of the cursor is below y1, with the
+     exception of the cursor being in the first blank row at
+     the buffer and window end because update_text_area
+     doesn't draw that row.  (Except when it does, but
+     that's handled in update_text_area.)  */
+
+  cy0 = w->phys_cursor.y;
+  cy1 = cy0 + w->phys_cursor_height;
+  if ((y0 < cy0 || y0 >= cy1) && (y1 <= cy0 || y1 >= cy1))
+    return;
+
+  w->phys_cursor_on_p = 0;
 }
 
 #endif /* HAVE_WINDOW_SYSTEM */
@@ -19377,6 +19856,14 @@
   if (cursor_row->visible_height <= 0)
     goto mark_cursor_off;
 
+  /* If cursor is in the fringe, erase by drawing actual bitmap there.  */
+  if (cursor_row->cursor_in_fringe_p)
+    {
+      cursor_row->cursor_in_fringe_p = 0;
+      draw_fringe_bitmap (w, cursor_row, 0);
+      goto mark_cursor_off;
+    }
+
   /* This can happen when the new row is shorter than the old one.
      In this case, either draw_glyphs or clear_end_of_line
      should have cleared the cursor.  Note that we wouldn't be
@@ -21533,12 +22020,23 @@
 #endif
 
   DEFVAR_LISP ("show-trailing-whitespace", &Vshow_trailing_whitespace,
-    doc: /* Non-nil means highlight trailing whitespace.
+    doc: /* *Non-nil means highlight trailing whitespace.
 The face used for trailing whitespace is `trailing-whitespace'.  */);
   Vshow_trailing_whitespace = Qnil;
 
+#ifdef HAVE_WINDOW_SYSTEM
+  DEFVAR_LISP ("overflow-newline-into-fringe", &Voverflow_newline_into_fringe,
+    doc: /* *Non-nil means that newline may flow into the right fringe.
+This means that display lines which are exactly as wide as the window
+(not counting the final newline) will only occupy one screen line, by
+showing (or hiding) the final newline in the right fringe; when point
+is at the final newline, the cursor is shown in the right fringe.
+If nil, also continue lines which are exactly as wide as the window.  */);
+  Voverflow_newline_into_fringe = Qt;
+#endif
+
   DEFVAR_LISP ("void-text-area-pointer", &Vvoid_text_area_pointer,
-    doc: /* The pointer shape to show in void text areas.
+    doc: /* *The pointer shape to show in void text areas.
 Nil means to show the text pointer.  Other options are `arrow', `text',
 `hand', `vdrag', `hdrag', `modeline', and `hourglass'.  */); 
   Vvoid_text_area_pointer = Qarrow;
--- a/src/xterm.c	Thu Jan 22 02:36:55 2004 +0000
+++ b/src/xterm.c	Thu Jan 22 15:37:19 2004 +0000
@@ -571,6 +571,9 @@
 				output_cursor.x, output_cursor.y);
 
       x_draw_vertical_border (w);
+
+      draw_window_fringes (w);
+
       UNBLOCK_INPUT;
     }
 
@@ -650,11 +653,7 @@
   xassert (w);
 
   if (!desired_row->mode_line_p && !w->pseudo_window_p)
-    {
-      BLOCK_INPUT;
-      draw_row_fringe_bitmaps (w, desired_row);
-      UNBLOCK_INPUT;
-    }
+    desired_row->redraw_fringe_bitmaps_p = 1;
 
   /* When a window has disappeared, make sure that no rest of
      full-width rows stays visible in the internal border.  Could
@@ -698,9 +697,24 @@
   Window window = FRAME_X_WINDOW (f);
   GC gc = f->output_data.x->normal_gc;
   struct face *face = p->face;
+  int rowY;
 
   /* Must clip because of partially visible lines.  */
-  x_clip_to_row (w, row, gc);
+  rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
+  if (p->y < rowY)
+    {
+      /* Adjust position of "bottom aligned" bitmap on partially
+	 visible last row.  */
+      int oldY = row->y;
+      int oldVH = row->visible_height;
+      row->visible_height = p->h;
+      row->y -= rowY - p->y;
+      x_clip_to_row (w, row, gc);
+      row->y = oldY;
+      row->visible_height = oldVH;
+    }
+  else
+    x_clip_to_row (w, row, gc);
 
   if (p->bx >= 0)
     {
@@ -6314,6 +6328,11 @@
                                   &compose_status);
 #endif
 
+          /* If not using XIM/XIC, and a compose sequence is in progress,
+             we break here.  Otherwise, chars_matched is always 0.  */
+          if (compose_status.chars_matched > 0 && nbytes == 0)
+            break;
+
           orig_keysym = keysym;
 
           if (numchars > 1)
@@ -7452,6 +7471,13 @@
       w->phys_cursor_type = cursor_type;
       w->phys_cursor_on_p = 1;
 
+      if (glyph_row->exact_window_width_line_p
+	  && w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA])
+	{
+	  glyph_row->cursor_in_fringe_p = 1;
+	  draw_fringe_bitmap (w, glyph_row, 0);
+	}
+      else
       switch (cursor_type)
 	{
 	case HOLLOW_BOX_CURSOR: