changeset 83320:ebfb2856c8e6

Merged from miles@gnu.org--gnu-2005 (patch 447-448) Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-447 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-448 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-360
author Karoly Lorentey <lorentey@elte.hu>
date Sun, 26 Jun 2005 21:12:57 +0000
parents 8f5787c83345 (current diff) fd183c9e3b18 (diff)
children f6ed7ae6fa8d
files admin/FOR-RELEASE lisp/ChangeLog lisp/cus-face.el lisp/faces.el lisp/simple.el lisp/subr.el lispref/ChangeLog man/ChangeLog src/dispextern.h src/fileio.c src/lread.c src/xdisp.c src/xfns.c
diffstat 37 files changed, 484 insertions(+), 188 deletions(-) [+]
line wrap: on
line diff
--- a/admin/FOR-RELEASE	Sun Jun 26 21:06:46 2005 +0000
+++ b/admin/FOR-RELEASE	Sun Jun 26 21:12:57 2005 +0000
@@ -14,6 +14,8 @@
 ** Check for widow and orphan lines in manuals;
 make sure all the pages really look ok in the manual as formatted.
 
+** Update facemenu-unlisted-faces, adding whatever other
+face name prefixes should be in it for good results.
 
 * NEW FEATURES
 
@@ -43,6 +45,36 @@
 
 * BUGS
 
+** Bug in ebrowse
+
+Date: Fri, 27 May 2005 17:35:48 +0200
+From: Markus Gritsch <gritsch@iue.tuwien.ac.at>
+
+the C++ header file which led to the problematic BROWSE file reads
+
+namespace test {
+     class Base
+     {
+     };
+
+     class B : public Base
+     {
+     };
+}
+
+class A : public test::Base
+{
+};
+
+The *Tree* is then displayed as
+
+   *Globals*
+   test
+   test::Base
+     test::B
+
+The class A seems to be missing.
+
 ** Ange-ftp should ignore irrelevant IPv6 errors:
 
 Message-Id: <4121-Tue23Mar2004165249+0100-piet@cs.uu.nl>
--- a/etc/NEWS	Sun Jun 26 21:06:46 2005 +0000
+++ b/etc/NEWS	Sun Jun 26 21:12:57 2005 +0000
@@ -4097,6 +4097,7 @@
 +++
 *** The new macro `with-selected-window' temporarily switches the
 selected window without impacting the order of `buffer-list'.
+It saves and restores the current buffer, too.
 
 +++
 *** `select-window' takes an optional second argument NORECORD.
@@ -4106,7 +4107,8 @@
 +++
 *** `save-selected-window' now saves and restores the selected window
 of every frame.  This way, it restores everything that can be changed
-by calling `select-window'.
+by calling `select-window'.  It also saves and restores the current
+buffer.
 
 +++
 *** `set-window-buffer' has an optional argument KEEP-MARGINS.
--- a/etc/PROBLEMS	Sun Jun 26 21:06:46 2005 +0000
+++ b/etc/PROBLEMS	Sun Jun 26 21:12:57 2005 +0000
@@ -961,6 +961,20 @@
 
 Use the shell command `xset bc' to make the old X Menu package work.
 
+*** C-SPC fails to work on Fedora GNU/Linux.
+
+Fedora Core 4 steals the C-SPC key by default for the `iiimx' program
+which is the input method for some languages.  It blocks Emacs users
+from using the C-SPC key for `set-mark-command'.
+
+One solutions is to remove the `<Ctrl>space' from the `Iiimx' file
+which can be found in the `/usr/lib/X11/app-defaults' directory.
+However, that requires root access.
+
+Another is to specify `Emacs*useXIM: false' in your X resources.
+
+Another is to build Emacs with the `--without-xim' configure option.
+
 *** M-SPC seems to be ignored as input.
 
 See if your X server is set up to use this as a command
--- a/lisp/ChangeLog	Sun Jun 26 21:06:46 2005 +0000
+++ b/lisp/ChangeLog	Sun Jun 26 21:12:57 2005 +0000
@@ -1,13 +1,48 @@
+2005-06-25  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* faces.el (facep): Doc fix.
+
+2005-06-25  Richard M. Stallman  <rms@gnu.org>
+
+	* facemenu.el (facemenu-enable-faces-p): New function.
+	(facemenu-background-menu, facemenu-foreground-menu)
+	(facemenu-face-menu): Add menu-enable property.
+
+	* jka-compr.el (jka-compr-insert-file-contents):
+	Special handling if cannot find the uncompression program.
+
+	* cus-face.el (custom-face-attributes): Add autoload.
+
+	* emacs-lisp/lisp-mode.el (lisp-mode-variables):
+	Bind comment-indent-function locally.
+
+	* window.el (save-selected-window): Use save-current-buffer.
+
+	* subr.el (with-selected-window): Use save-current-buffer.
+
+	* progmodes/gud.el (gud-filter): Simplify using with-selected-window
+	and with-current-buffer.
+
+2005-06-24  Richard M. Stallman  <rms@gnu.org>
+
+	* simple.el (line-move-1): Fix previous change.
+
+2005-06-24  Juanma Barranquero  <lekktu@gmail.com>
+
+	* replace.el (occur-1): Set `buffer-read-only' and the
+	buffer-modified flag before running `occur-hook' to protect
+	against unintentional buffer switches that can lead to data loss.
+
 2005-06-24  Nick Roberts  <nickrob@snap.net.nz>
 
 	* progmodes/gud.el (gud-tooltip-print-command): Indent properly.
 	(gud-gdb-marker-filter): Use font-lock-warning-face for any
 	initial error.
-	
+
 	* progmodes/gdb-ui.el (gdb-send): Remove warning face from errors
 	after fresh input.
 	(gdb-var-create-handler): Put name of expression in quotes.
-	
+
 2005-06-23  Luc Teirlinck  <teirllm@auburn.edu>
 
 	* emacs-lisp/ring.el (ring-elements): Make it return a list of the
@@ -532,7 +567,7 @@
 
 	* progmodes/gdb-ui.el (menu): Re-order menu items.
 	(gdb-tooltip-print): Respect tooltip-use-echo-area.
-	
+
 	* progmodes/gud.el (tooltip-use-echo-area): Remove alias.
 	Define in tooltip.el.
 	(gud-tooltip-process-output): Respect tooltip-use-echo-area.
--- a/lisp/cus-face.el	Sun Jun 26 21:06:46 2005 +0000
+++ b/lisp/cus-face.el	Sun Jun 26 21:12:57 2005 +0000
@@ -62,6 +62,7 @@
 
 ;;; Face attributes.
 
+;;;###autoload
 (defconst custom-face-attributes
   '((:family
      (string :tag "Font Family"
--- a/lisp/emacs-lisp/lisp-mode.el	Sun Jun 26 21:06:46 2005 +0000
+++ b/lisp/emacs-lisp/lisp-mode.el	Sun Jun 26 21:12:57 2005 +0000
@@ -202,6 +202,8 @@
   (setq comment-column 40)
   ;; Don't get confused by `;' in doc strings when paragraph-filling.
   (set (make-local-variable 'comment-use-global-state) t)
+  (make-local-variable 'comment-indent-function)
+  (setq comment-indent-function 'lisp-comment-indent)
   (make-local-variable 'imenu-generic-expression)
   (setq imenu-generic-expression lisp-imenu-generic-expression)
   (make-local-variable 'multibyte-syntax-as-symbol)
@@ -714,7 +716,7 @@
 	       (setq debug-on-error new-value))
 	     value)))))
 
-
+;; Used for comment-indent-function in Lisp modes.
 (defun lisp-comment-indent ()
   (if (looking-at "\\s<\\s<\\s<")
       (current-column)
--- a/lisp/facemenu.el	Sun Jun 26 21:06:46 2005 +0000
+++ b/lisp/facemenu.el	Sun Jun 26 21:12:57 2005 +0000
@@ -162,6 +162,7 @@
   "Menu keymap for faces.")
 ;;;###autoload
 (defalias 'facemenu-face-menu facemenu-face-menu)
+(put 'facemenu-face-menu 'menu-enable '(facemenu-enable-faces-p))
 
 ;;;###autoload
 (defvar facemenu-foreground-menu
@@ -171,6 +172,7 @@
   "Menu keymap for foreground colors.")
 ;;;###autoload
 (defalias 'facemenu-foreground-menu facemenu-foreground-menu)
+(put 'facemenu-foreground-menu 'menu-enable '(facemenu-enable-faces-p))
 
 ;;;###autoload
 (defvar facemenu-background-menu
@@ -180,6 +182,11 @@
   "Menu keymap for background colors.")
 ;;;###autoload
 (defalias 'facemenu-background-menu facemenu-background-menu)
+(put 'facemenu-background-menu 'menu-enable '(facemenu-enable-faces-p))
+
+;;; Condition for enabling menu items that set faces.
+(defun facemenu-enable-faces-p ()
+  (not (and font-lock-mode font-lock-defaults)))
 
 ;;;###autoload
 (defvar facemenu-special-menu
--- a/lisp/faces.el	Sun Jun 26 21:06:46 2005 +0000
+++ b/lisp/faces.el	Sun Jun 26 21:12:57 2005 +0000
@@ -204,7 +204,10 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defun facep (face)
-  "Return non-nil if FACE is a face name."
+  "Return non-nil if FACE is a face name or internal face object.
+Return nil otherwise.  A face name can be a string or a symbol.
+An internal face object is a vector of the kind used internally
+to record face data."
   (internal-lisp-face-p face))
 
 
--- a/lisp/gnus/ChangeLog	Sun Jun 26 21:06:46 2005 +0000
+++ b/lisp/gnus/ChangeLog	Sun Jun 26 21:12:57 2005 +0000
@@ -1,3 +1,8 @@
+2005-06-24  Juanma Barranquero  <lekktu@gmail.com>
+
+	* gnus-art.el (gnus-article-mode): Set `nobreak-char-display', not
+	`show-nonbreak-escape'.
+
 2005-06-23  Lute Kamstra  <lute@gnu.org>
 
 	* gnus-art.el (gnus-article-mode): Use kill-all-local-variables.
--- a/lisp/gnus/gnus-art.el	Sun Jun 26 21:06:46 2005 +0000
+++ b/lisp/gnus/gnus-art.el	Sun Jun 26 21:12:57 2005 +0000
@@ -3755,7 +3755,7 @@
   (make-local-variable 'gnus-article-charset)
   (make-local-variable 'gnus-article-ignored-charsets)
   ;; Prevent recent Emacsen from displaying non-break space as "\ ".
-  (set (make-local-variable 'show-nonbreak-escape) nil)
+  (set (make-local-variable 'nobreak-char-display) nil)
   (gnus-set-default-directory)
   (buffer-disable-undo)
   (setq buffer-read-only t)
--- a/lisp/jka-compr.el	Sun Jun 26 21:06:46 2005 +0000
+++ b/lisp/jka-compr.el	Sun Jun 26 21:12:57 2005 +0000
@@ -474,6 +474,9 @@
 			  (delete-region (point) (point-max)))
 		      (goto-char start))
 		  (error
+		   ;; If the file we wanted to uncompress does not exist,
+		   ;; handle that according to VISIT as `insert-file-contents'
+		   ;; would, maybe signaling the same error it normally would.
 		   (if (and (eq (car error-code) 'file-error)
 			    (eq (nth 3 error-code) local-file))
 		       (if visit
@@ -481,6 +484,13 @@
 			 (signal 'file-error
 				 (cons "Opening input file"
 				       (nthcdr 2 error-code))))
+		     ;; If the uncompression program can't be found,
+		     ;; signal that as a non-file error
+		     ;; so that find-file-noselect-1 won't handle it.
+		     (if (and (eq (car error-code) 'file-error)
+			      (equal (cadr error-code) "Searching for program"))
+			 (error "Uncompression program `%s' not found"
+				(nth 3 error-code)))
 		     (signal (car error-code) (cdr error-code))))))
 
 	    (and
--- a/lisp/progmodes/gud.el	Sun Jun 26 21:06:46 2005 +0000
+++ b/lisp/progmodes/gud.el	Sun Jun 26 21:12:57 2005 +0000
@@ -2534,16 +2534,12 @@
 	    ;; This must be outside of the save-excursion
 	    ;; in case the source file is our current buffer.
 	    (if process-window
-		(save-selected-window
-		  (select-window process-window)
+		(with-selected-window
 		  (gud-display-frame))
 	      ;; We have to be in the proper buffer, (process-buffer proc),
 	      ;; but not in a save-excursion, because that would restore point.
-	      (let ((old-buf (current-buffer)))
-		(set-buffer (process-buffer proc))
-		(unwind-protect
-		    (gud-display-frame)
-		  (set-buffer old-buf)))))
+	      (with-current-buffer (process-buffer proc)
+		(gud-display-frame))))
 
 	  ;; If we deferred text that arrived during this processing,
 	  ;; handle it now.
--- a/lisp/replace.el	Sun Jun 26 21:06:46 2005 +0000
+++ b/lisp/replace.el	Sun Jun 26 21:12:57 2005 +0000
@@ -1001,9 +1001,9 @@
 		(display-buffer occur-buf)
 		(setq next-error-last-buffer occur-buf))
 	    (kill-buffer occur-buf)))
-	(run-hooks 'occur-hook))
-      (setq buffer-read-only t)
-      (set-buffer-modified-p nil))))
+        (setq buffer-read-only t)
+        (set-buffer-modified-p nil)
+	(run-hooks 'occur-hook)))))
 
 (defun occur-engine-add-prefix (lines)
   (mapcar
--- a/lisp/simple.el	Sun Jun 26 21:06:46 2005 +0000
+++ b/lisp/simple.el	Sun Jun 26 21:12:57 2005 +0000
@@ -3446,18 +3446,14 @@
 		  (when (and (not done)
 			     (not (integerp selective-display))
 			     (not (line-move-invisible-p (point))))
-		    ;; We avoid vertical-motion when possible
-		    ;; because that has to fontify.
-		    (forward-line 1)
-		    ;; If there are overlays in and around
-		    ;; the text we moved over, we need to be
-		    ;; sophisticated.
 		    (unless (overlays-in (max (1- pos-before) (point-min))
 					 (min (1+ (point)) (point-max)))
+		      ;; We avoid vertical-motion when possible
+		      ;; because that has to fontify.
+		      (forward-line 1)
 		      (setq line-done t)))
-		  ;; Otherwise move a more sophisticated way.
-		  ;; (What's the logic behind this code?)
 		  (and (not done) (not line-done)
+		       ;; Otherwise move a more sophisticated way.
 		       (zerop (vertical-motion 1))
 		       (if (not noerror)
 			   (signal 'end-of-buffer nil)
@@ -3477,9 +3473,9 @@
 		  (when (and (not done)
 			     (not (integerp selective-display))
 			     (not (line-move-invisible-p (1- (point)))))
-		    (forward-line -1)
 		    (unless (overlays-in (max (1- (point)) (point-min))
 					 (min (1+ pos-before) (point-max)))
+		      (forward-line -1)
 		      (setq line-done t)))
 		  (and (not done) (not line-done)
 		       (zerop (vertical-motion -1))
--- a/lisp/subr.el	Sun Jun 26 21:06:46 2005 +0000
+++ b/lisp/subr.el	Sun Jun 26 21:12:57 2005 +0000
@@ -1717,8 +1717,12 @@
 (defmacro with-selected-window (window &rest body)
   "Execute the forms in BODY with WINDOW as the selected window.
 The value returned is the value of the last form in BODY.
-This does not alter the buffer list ordering.
-This function saves and restores the selected window, as well as
+
+This macro saves and restores the current buffer, since otherwise
+its normal operation could potentially make a different
+buffer current.  It does not alter the buffer list ordering.
+
+This macro saves and restores the selected window, as well as
 the selected window in each frame.  If the previously selected
 window of some frame is no longer live at the end of BODY, that
 frame's selected window is left alone.  If the selected window is
@@ -1734,15 +1738,16 @@
 	 (save-selected-window-alist
 	  (mapcar (lambda (frame) (list frame (frame-selected-window frame)))
 		  (frame-list))))
-     (unwind-protect
-	 (progn (select-window ,window 'norecord)
-		,@body)
-       (dolist (elt save-selected-window-alist)
-	 (and (frame-live-p (car elt))
-	      (window-live-p (cadr elt))
-	      (set-frame-selected-window (car elt) (cadr elt))))
-       (if (window-live-p save-selected-window-window)
-	   (select-window save-selected-window-window 'norecord)))))
+     (save-current-buffer
+       (unwind-protect
+	   (progn (select-window ,window 'norecord)
+		  ,@body)
+	 (dolist (elt save-selected-window-alist)
+	   (and (frame-live-p (car elt))
+		(window-live-p (cadr elt))
+		(set-frame-selected-window (car elt) (cadr elt))))
+	 (if (window-live-p save-selected-window-window)
+	     (select-window save-selected-window-window 'norecord))))))
 
 (defmacro with-selected-frame (frame &rest body)
   "Execute the forms in BODY with FRAME as the selected frame.
--- a/lisp/wid-edit.el	Sun Jun 26 21:06:46 2005 +0000
+++ b/lisp/wid-edit.el	Sun Jun 26 21:12:57 2005 +0000
@@ -967,28 +967,28 @@
 		(recenter))
 	      )
 
-	    (let ((up t) command)
-	      ;; Mouse click not on a widget button.  Find the global
-	      ;; command to run, and check whether it is bound to an
-	      ;; up event.
-	      (mouse-set-point event)
-	      (if (memq (event-basic-type event) '(mouse-1 down-mouse-1))
-		  (cond ((setq command	;down event
-			       (lookup-key widget-global-map [down-mouse-1]))
-			 (setq up nil))
-			((setq command	;up event
-			       (lookup-key widget-global-map [mouse-1]))))
+	  (let ((up t) command)
+	    ;; Mouse click not on a widget button.  Find the global
+	    ;; command to run, and check whether it is bound to an
+	    ;; up event.
+	    (mouse-set-point event)
+	    (if (memq (event-basic-type event) '(mouse-1 down-mouse-1))
 		(cond ((setq command	;down event
-			     (lookup-key widget-global-map [down-mouse-2]))
+			     (lookup-key widget-global-map [down-mouse-1]))
 		       (setq up nil))
 		      ((setq command	;up event
-			     (lookup-key widget-global-map [mouse-2])))))
-	      (when up
-		;; Don't execute up events twice.
-		(while (not (widget-button-release-event-p event))
-		  (setq event (read-event))))
-	      (when command
-		(call-interactively command)))))
+			     (lookup-key widget-global-map [mouse-1]))))
+	      (cond ((setq command	;down event
+			   (lookup-key widget-global-map [down-mouse-2]))
+		     (setq up nil))
+		    ((setq command	;up event
+			   (lookup-key widget-global-map [mouse-2])))))
+	    (when up
+	      ;; Don't execute up events twice.
+	      (while (not (widget-button-release-event-p event))
+		(setq event (read-event))))
+	    (when command
+	      (call-interactively command)))))
     (message "You clicked somewhere weird.")))
 
 (defun widget-button-press (pos &optional event)
--- a/lisp/window.el	Sun Jun 26 21:06:46 2005 +0000
+++ b/lisp/window.el	Sun Jun 26 21:12:57 2005 +0000
@@ -40,11 +40,18 @@
 
 (defmacro save-selected-window (&rest body)
   "Execute BODY, then select the window that was selected before BODY.
-Also restore the selected window of each frame as it was at the start
-of this construct.
-However, if a window has become dead, don't get an error,
-just refrain from reselecting it.
-Return the value of the last form in BODY."
+The value returned is the value of the last form in BODY.
+
+This macro saves and restores the current buffer, since otherwise
+its normal operation could potentially make a different
+buffer current.  It does not alter the buffer list ordering.
+
+This macro saves and restores the selected window, as well as
+the selected window in each frame.  If the previously selected
+window of some frame is no longer live at the end of BODY, that
+frame's selected window is left alone.  If the selected window is
+no longer live, then whatever window is selected at the end of
+BODY remains selected."
   `(let ((save-selected-window-window (selected-window))
 	 ;; It is necessary to save all of these, because calling
 	 ;; select-window changes frame-selected-window for whatever
@@ -52,14 +59,15 @@
 	 (save-selected-window-alist
 	  (mapcar (lambda (frame) (list frame (frame-selected-window frame)))
 		  (frame-list))))
-     (unwind-protect
-	 (progn ,@body)
-       (dolist (elt save-selected-window-alist)
-	 (and (frame-live-p (car elt))
-	      (window-live-p (cadr elt))
-	      (set-frame-selected-window (car elt) (cadr elt))))
-       (if (window-live-p save-selected-window-window)
-	   (select-window save-selected-window-window)))))
+     (save-current-buffer
+       (unwind-protect
+	   (progn ,@body)
+	 (dolist (elt save-selected-window-alist)
+	   (and (frame-live-p (car elt))
+		(window-live-p (cadr elt))
+		(set-frame-selected-window (car elt) (cadr elt))))
+	 (if (window-live-p save-selected-window-window)
+	     (select-window save-selected-window-window))))))
 
 (defun window-body-height (&optional window)
   "Return number of lines in window WINDOW for actual buffer text.
--- a/lispref/ChangeLog	Sun Jun 26 21:06:46 2005 +0000
+++ b/lispref/ChangeLog	Sun Jun 26 21:12:57 2005 +0000
@@ -1,3 +1,24 @@
+2005-06-25  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* display.texi (Faces): `facep' returns t for strings that are
+	face names.
+
+2005-06-25  Richard M. Stallman  <rms@gnu.org>
+
+	* objects.texi (Equality Predicates): Clarify meaning of equal.
+
+	* windows.texi (Selecting Windows): save-selected-window
+	and with-selected-window save and restore the current buffer.
+
+2005-06-24  Richard M. Stallman  <rms@gnu.org>
+
+	* numbers.texi (Float Basics): Explain how to test for NaN,
+	and printing the sign of NaNs.
+
+2005-06-24  Eli Zaretskii  <eliz@gnu.org>
+
+	* makefile.w32-in (MAKEINFO): Use --force.
+
 2005-06-23  Richard M. Stallman  <rms@gnu.org>
 
 	* display.texi (Face Functions): Correct Texinfo usage.
--- a/lispref/display.texi	Sun Jun 26 21:06:46 2005 +0000
+++ b/lispref/display.texi	Sun Jun 26 21:12:57 2005 +0000
@@ -1628,12 +1628,12 @@
 @cindex face id
 Each face has its own @dfn{face number}, which distinguishes faces at
 low levels within Emacs.  However, for most purposes, you refer to
-faces in Lisp programs by their names.
+faces in Lisp programs by the symbol that names them.
 
 @defun facep object
-This function returns @code{t} if @var{object} is a face name symbol (or
-if it is a vector of the kind used internally to record face data).  It
-returns @code{nil} otherwise.
+This function returns @code{t} if @var{object} is a face name string
+or symbol (or if it is a vector of the kind used internally to record
+face data).  It returns @code{nil} otherwise.
 @end defun
 
 Each face name is meaningful for all frames, and by default it has the
@@ -1795,7 +1795,7 @@
   The way to define a new face is with @code{defface}.  This creates a
 kind of customization item (@pxref{Customization}) which the user can
 customize using the Customization buffer (@pxref{Easy Customization,,,
-emacs, The GNU Emacs Manual}).  
+emacs, The GNU Emacs Manual}).
 
 @defmac defface face spec doc [keyword value]...
 This declares @var{face} as a customizable face that defaults
--- a/lispref/makefile.w32-in	Sun Jun 26 21:06:46 2005 +0000
+++ b/lispref/makefile.w32-in	Sun Jun 26 21:12:57 2005 +0000
@@ -29,7 +29,7 @@
 # TEX=platex
 TEX=tex
 INSTALL_INFO = install-info
-MAKEINFO = makeinfo
+MAKEINFO = makeinfo --force
 
 # The environment variable and its value to add $(srcdir) to the path
 # searched for TeX input files.
--- a/lispref/numbers.texi	Sun Jun 26 21:06:46 2005 +0000
+++ b/lispref/numbers.texi	Sun Jun 26 21:12:57 2005 +0000
@@ -183,21 +183,26 @@
 NaN.  For practical purposes, there's no significant difference between
 different NaN values in Emacs Lisp, and there's no rule for precisely
 which NaN value should be used in a particular case, so Emacs Lisp
-doesn't try to distinguish them.  Here are the read syntaxes for
-these special floating point values:
+doesn't try to distinguish them (but it does report the sign, if you
+print it).  Here are the read syntaxes for these special floating
+point values:
 
 @table @asis
 @item positive infinity
 @samp{1.0e+INF}
 @item negative infinity
 @samp{-1.0e+INF}
-@item Not-a-number
-@samp{0.0e+NaN}.
+@item Not-a-number 
+@samp{0.0e+NaN} or @samp{-0.0e+NaN}.
 @end table
 
-  In addition, the value @code{-0.0} is distinguishable from ordinary
-zero in @acronym{IEEE} floating point (although @code{equal} and
-@code{=} consider them equal values).
+  To test whether a floating point value is a NaN, compare it with
+itself using @code{=}.  That returns @code{nil} for a NaN, and
+@code{t} for any other floating point value.
+
+  The value @code{-0.0} is distinguishable from ordinary zero in
+@acronym{IEEE} floating point, but Emacs Lisp @code{equal} and
+@code{=} consider them equal values.
 
   You can use @code{logb} to extract the binary exponent of a floating
 point number (or estimate the logarithm of an integer):
--- a/lispref/objects.texi	Sun Jun 26 21:06:46 2005 +0000
+++ b/lispref/objects.texi	Sun Jun 26 21:12:57 2005 +0000
@@ -1820,8 +1820,7 @@
 
 @defun eq object1 object2
 This function returns @code{t} if @var{object1} and @var{object2} are
-the same object, @code{nil} otherwise.  The ``same object'' means that a
-change in one will be reflected by the same change in the other.
+the same object, @code{nil} otherwise.
 
 @code{eq} returns @code{t} if @var{object1} and @var{object2} are
 integers with the same value.  Also, since symbol names are normally
@@ -1829,7 +1828,8 @@
 @code{eq}.  For other types (e.g., lists, vectors, strings), two
 arguments with the same contents or elements are not necessarily
 @code{eq} to each other: they are @code{eq} only if they are the same
-object.
+object, meaning that a change in the contents of one will be reflected
+by the same change in the contents of the other.
 
 @example
 @group
--- a/lispref/windows.texi	Sun Jun 26 21:06:46 2005 +0000
+++ b/lispref/windows.texi	Sun Jun 26 21:12:57 2005 +0000
@@ -463,8 +463,8 @@
 @defmac save-selected-window forms@dots{}
 This macro records the selected frame, as well as the selected window
 of each frame, executes @var{forms} in sequence, then restores the
-earlier selected frame and windows It returns the value of the last
-form in @var{forms}.
+earlier selected frame and windows.  It also saves and restores the
+current buffer.  It returns the value of the last form in @var{forms}.
 
 This macro does not save or restore anything about the sizes,
 arrangement or contents of windows; therefore, if the @var{forms}
@@ -478,9 +478,9 @@
 @defmac with-selected-window window forms@dots{}
 This macro selects @var{window} (without changing the buffer list),
 executes @var{forms} in sequence, then restores the previously
-selected window (unless that window is no longer alive).  It is similar
-to @code{save-selected-window} except that it explicitly selects
-@var{window}, without altering the buffer list sequence.
+selected window and current buffer.  It is just like
+@code{save-selected-window}, except that it explicitly selects
+@var{window}, also without altering the buffer list sequence.
 @end defmac
 
 @cindex finding windows
--- a/man/ChangeLog	Sun Jun 26 21:06:46 2005 +0000
+++ b/man/ChangeLog	Sun Jun 26 21:12:57 2005 +0000
@@ -1,3 +1,15 @@
+2005-06-24  Richard M. Stallman  <rms@gnu.org>
+
+	* display.texi (Text Display): Change index entries.
+
+2005-06-24  Eli Zaretskii  <eliz@gnu.org>
+
+	* makefile.w32-in (MAKEINFO): Use --force.
+	(INFO_TARGETS, DVI_TARGETS): Make identical to the lists in
+	Makefile.in.
+	(gnus.dvi): Use "..." to quote Sed args, so that it works with
+	more shells.
+
 2005-06-23  Richard M. Stallman  <rms@gnu.org>
 
 	* anti.texi (Antinews): Renamed show-nonbreak-escape to
--- a/man/display.texi	Sun Jun 26 21:06:46 2005 +0000
+++ b/man/display.texi	Sun Jun 26 21:12:57 2005 +0000
@@ -946,8 +946,9 @@
 Support}.
 
 @vindex nobreak-char-display
-@cindex nobreak space, display
-@cindex nobreak hyphen, display
+@cindex no-break space, display
+@cindex no-break hyphen, display
+@cindex soft hyphen, display
   Some character sets define ``no-break'' versions of the space and
 hyphen characters, which are used where a line should not be broken.
 Emacs normally displays these characters with special faces
--- a/man/makefile.w32-in	Sun Jun 26 21:06:46 2005 +0000
+++ b/man/makefile.w32-in	Sun Jun 26 21:12:57 2005 +0000
@@ -29,33 +29,28 @@
 infodir = $(srcdir)/../info
 
 # The makeinfo program is part of the Texinfo distribution.
-MAKEINFO = makeinfo
+MAKEINFO = makeinfo --force
 MULTI_INSTALL_INFO = $(srcdir)\..\nt\multi-install-info.bat
-INFO_TARGETS = $(infodir)/emacs $(infodir)/ccmode \
-		$(infodir)/cl $(infodir)/dired-x \
-		$(infodir)/ediff $(infodir)/forms \
-		$(infodir)/gnus $(infodir)/info \
-		$(infodir)/message $(infodir)/mh-e \
-		$(infodir)/reftex $(infodir)/sc \
-		$(infodir)/vip $(infodir)/viper \
-		$(infodir)/widget $(infodir)/efaq \
-		$(infodir)/ada-mode $(infodir)/autotype \
-		$(infodir)/calc $(infodir)/idlwave \
-		$(infodir)/eudc $(infodir)/ebrowse \
-		$(infodir)/pcl-cvs $(infodir)/woman \
-		$(infodir)/emacs-mime $(infodir)/eshell \
-		$(infodir)/speedbar $(infodir)/tramp \
-		$(infodir)/ses $(infodir)/smtpmail \
-		$(infodir)/flymake $(infodir)/emacs-xtra \
-		$(infodir)/org $(infodir)/url \
-		$(infodir)/pgg $(infodir)/sieve
+INFO_TARGETS = $(infodir)/emacs $(infodir)/emacs-xtra $(infodir)/ccmode \
+		$(infodir)/cl $(infodir)/dired-x $(infodir)/ediff \
+		$(infodir)/forms $(infodir)/gnus $(infodir)/message \
+		$(infodir)/sieve $(infodir)/pgg $(infodir)/emacs-mime \
+		$(infodir)/info $(infodir)/mh-e $(infodir)/reftex \
+		$(infodir)/sc $(infodir)/vip $(infodir)/viper \
+		$(infodir)/widget $(infodir)/efaq $(infodir)/ada-mode \
+		$(infodir)/autotype $(infodir)/calc $(infodir)/idlwave \
+		$(infodir)/eudc $(infodir)/ebrowse $(infodir)/pcl-cvs \
+		$(infodir)/woman $(infodir)/eshell $(infodir)/org \
+		$(infodir)/url $(infodir)/speedbar $(infodir)/tramp \
+		$(infodir)/ses $(infodir)/smtpmail $(infodir)/flymake
 DVI_TARGETS = 	emacs.dvi calc.dvi cc-mode.dvi cl.dvi dired-x.dvi \
-		 ediff.dvi forms.dvi gnus.dvi message.dvi mh-e.dvi \
+		 ediff.dvi forms.dvi gnus.dvi message.dvi emacs-mime.dvi \
+                 gnus.dvi message.dvi sieve.dvi pgg.dvi mh-e.dvi \
 		 reftex.dvi sc.dvi vip.dvi viper.dvi widget.dvi faq.dvi \
 		 ada-mode.dvi autotype.dvi idlwave.dvi eudc.dvi ebrowse.dvi \
-		 org.dvi pcl-cvs.dvi woman.dvi emacs-mime.dvi eshell.dvi \
+		 pcl-cvs.dvi woman.dvi eshell.dvi org.dvi url.dvi \
 		 speedbar.dvi tramp.dvi ses.dvi smtpmail.dvi flymake.dvi \
-		 emacs-xtra.dvi pgg.dvi sieve.dvi url.dvi
+                 emacs-xtra.dvi
 INFOSOURCES = info.texi
 
 # The following rule does not work with all versions of `make'.
@@ -197,7 +192,7 @@
 $(infodir)/gnus: gnus.texi
 	$(MAKEINFO) gnus.texi
 gnus.dvi: gnus.texi
-	sed -e '/@iflatex/,/@end iflatex/d' $(srcdir)/gnus.texi > gnustmp.texi
+	sed -e "/@iflatex/,/@end iflatex/d" $(srcdir)/gnus.texi > gnustmp.texi
 	$(ENVADD) $(TEXI2DVI) gnustmp.texi
 	cp gnustmp.dvi $*.dvi
 	rm gnustmp.*
--- a/src/ChangeLog	Sun Jun 26 21:06:46 2005 +0000
+++ b/src/ChangeLog	Sun Jun 26 21:12:57 2005 +0000
@@ -1,3 +1,54 @@
+2005-06-25  Richard M. Stallman  <rms@gnu.org>
+
+	* macfns.c (Fx_show_tip): Pass new arg to try_window.
+
+	* w32fns.c (Fx_show_tip): Pass new arg to try_window.
+
+	* xfns.c (Fx_show_tip): Pass new arg to try_window.
+
+	* xdisp.c (try_window): New arg CHECK_MARGINS.  Calls changed.
+	(redisplay_window): Handle try_window reporting point in scroll margin.
+
+	* dispextern.h (try_window): Declare new arg.
+
+	* fileio.c (Fcopy_file): New arg PRESERVE_UID_GID.
+	Use fchmod to copy the file modes.
+	(Frename_file): Don't copy UID and GID here;
+	instead, specify t for PRESERVE_UID_GID when calling Fcopy_file.
+
+	* eval.c (call_debugger): Take full care of extending stack limits
+	to make space for the debugger, and restore the change afterward.
+	Bind debug-on-error to nil.
+	(restore_stack_limits): New subroutine.
+	(Fsignal): Extend specpdl bound along with eval depth bound,
+	for calling edebug.  Don't do either one, for calling debugger.
+	(find_handler_clause): Don't bind debug-on-error here.
+	Don't unbind anything either.
+	Temporarily advance max_specpdl_size for calling
+	internal_with_output_to_temp_buffer.
+	(grow_specpdl): Don't alter max_specpdl_size before signaling
+	an error.
+	(syms_of_eval) <max-specpdl-size>: Doc fix.
+
+	* lread.c (read1): 0.0e+NaN should make a "positive" NaN.
+
+2005-06-24  Eli Zaretskii  <eliz@gnu.org>
+
+	* fileio.c (Frename_file): Undo last change: no need to ifdef away
+	chown on DOS_NT platforms.
+
+	* w32.c (sys_chown): New function.
+
+	* s/ms-w32.h (chown): New; define to sys_chown.
+
+2005-06-24  Juanma Barranquero  <lekktu@gmail.com>
+
+	* xdisp.c (syms_of_xdisp) <nobreak-char-display>: Doc fix.
+	(syms_of_xdisp) <void-text-area-pointer>: Doc fix.
+
+	* fileio.c (Frename_file)[!DOS_NT]: Don't call chown on
+	MSDOS/Windows.
+
 2005-06-23  Richard M. Stallman  <rms@gnu.org>
 
 	* xdisp.c (get_next_display_element): Finish reversing the tests of
--- a/src/dispextern.h	Sun Jun 26 21:06:46 2005 +0000
+++ b/src/dispextern.h	Sun Jun 26 21:12:57 2005 +0000
@@ -2584,7 +2584,7 @@
 int display_prop_intangible_p P_ ((Lisp_Object));
 void resize_echo_area_exactly P_ ((void));
 int resize_mini_window P_ ((struct window *, int));
-int try_window P_ ((Lisp_Object, struct text_pos));
+int try_window P_ ((Lisp_Object, struct text_pos, int));
 void window_box P_ ((struct window *, int, int *, int *, int *, int *));
 int window_box_height P_ ((struct window *));
 int window_text_bottom_y P_ ((struct window *));
--- a/src/eval.c	Sun Jun 26 21:06:46 2005 +0000
+++ b/src/eval.c	Sun Jun 26 21:12:57 2005 +0000
@@ -227,6 +227,18 @@
   when_entered_debugger = -1;
 }
 
+/* unwind-protect function used by call_debugger.  */
+
+static Lisp_Object
+restore_stack_limits (data)
+     Lisp_Object data;
+{
+  max_specpdl_size = XINT (XCAR (data));
+  max_lisp_eval_depth = XINT (XCDR (data));
+}
+
+/* Call the Lisp debugger, giving it argument ARG.  */
+
 Lisp_Object
 call_debugger (arg)
      Lisp_Object arg;
@@ -234,12 +246,22 @@
   int debug_while_redisplaying;
   int count = SPECPDL_INDEX ();
   Lisp_Object val;
-
-  if (lisp_eval_depth + 20 > max_lisp_eval_depth)
-    max_lisp_eval_depth = lisp_eval_depth + 20;
-
-  if (specpdl_size + 40 > max_specpdl_size)
-    max_specpdl_size = specpdl_size + 40;
+  int old_max = max_specpdl_size;
+
+  /* Temporarily bump up the stack limits,
+     so the debugger won't run out of stack.  */
+
+  max_specpdl_size += 1;
+  record_unwind_protect (restore_stack_limits,
+			 Fcons (make_number (old_max),
+				make_number (max_lisp_eval_depth)));
+  max_specpdl_size = old_max;
+
+  if (lisp_eval_depth + 40 > max_lisp_eval_depth)
+    max_lisp_eval_depth = lisp_eval_depth + 40;
+
+  if (SPECPDL_INDEX () + 100 > max_specpdl_size)
+    max_specpdl_size = SPECPDL_INDEX () + 100;
 
 #ifdef HAVE_X_WINDOWS
   if (display_hourglass_p)
@@ -256,6 +278,7 @@
   specbind (intern ("debugger-may-continue"),
 	    debug_while_redisplaying ? Qnil : Qt);
   specbind (Qinhibit_redisplay, Qnil);
+  specbind (Qdebug_on_error, Qnil);
 
 #if 0 /* Binding this prevents execution of Lisp code during
 	 redisplay, which necessarily leads to display problems.  */
@@ -1533,7 +1556,16 @@
   /* This hook is used by edebug.  */
   if (! NILP (Vsignal_hook_function)
       && ! NILP (error_symbol))
-    call2 (Vsignal_hook_function, error_symbol, data);
+    {
+      /* Edebug takes care of restoring these variables when it exits.  */
+      if (lisp_eval_depth + 20 > max_lisp_eval_depth)
+	max_lisp_eval_depth = lisp_eval_depth + 20;
+
+      if (SPECPDL_INDEX () + 40 > max_specpdl_size)
+	max_specpdl_size = SPECPDL_INDEX () + 40;
+
+      call2 (Vsignal_hook_function, error_symbol, data);
+    }
 
   conditions = Fget (real_error_symbol, Qerror_conditions);
 
@@ -1555,12 +1587,6 @@
     {
       register Lisp_Object clause;
 
-      if (lisp_eval_depth + 20 > max_lisp_eval_depth)
-	max_lisp_eval_depth = lisp_eval_depth + 20;
-
-      if (specpdl_size + 40 > max_specpdl_size)
-	max_specpdl_size = specpdl_size + 40;
-
       clause = find_handler_clause (handlerlist->handler, conditions,
 				    error_symbol, data, &debugger_value);
 
@@ -1673,7 +1699,11 @@
     = SIG is nil, and DATA is (SYMBOL . REST-OF-DATA).
        This is for memory-full errors only.
 
-   Store value returned from debugger into *DEBUGGER_VALUE_PTR.  */
+   Store value returned from debugger into *DEBUGGER_VALUE_PTR.
+
+   We need to increase max_specpdl_size temporarily around
+   anything we do that can push on the specpdl, so as not to get
+   a second error here in case we're handling specpdl overflow.  */
 
 static Lisp_Object
 find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr)
@@ -1691,7 +1721,6 @@
       || !NILP (Vdebug_on_signal)) /* This says call debugger even if
 				      there is a handler.  */
     {
-      int count = SPECPDL_INDEX ();
       int debugger_called = 0;
       Lisp_Object sig_symbol, combined_data;
       /* This is set to 1 if we are handling a memory-full error,
@@ -1713,6 +1742,7 @@
 
       if (wants_debugger (Vstack_trace_on_error, conditions))
 	{
+	  max_specpdl_size++;
 #ifdef PROTOTYPES
 	  internal_with_output_to_temp_buffer ("*Backtrace*",
 					       (Lisp_Object (*) (Lisp_Object)) Fbacktrace,
@@ -1721,6 +1751,7 @@
 	  internal_with_output_to_temp_buffer ("*Backtrace*",
 					       Fbacktrace, Qnil);
 #endif
+	  max_specpdl_size--;
 	}
       if (! no_debugger
 	  && (EQ (sig_symbol, Qquit)
@@ -1729,7 +1760,6 @@
 	  && ! skip_debugger (conditions, combined_data)
 	  && when_entered_debugger < num_nonmacro_input_events)
 	{
-	  specbind (Qdebug_on_error, Qnil);
 	  *debugger_value_ptr
 	    = call_debugger (Fcons (Qerror,
 				    Fcons (combined_data, Qnil)));
@@ -1739,7 +1769,7 @@
       if (EQ (handlers, Qerror))
 	{
 	  if (debugger_called)
-	    return unbind_to (count, Qlambda);
+	    return Qlambda;
 	  return Qt;
 	}
     }
@@ -3019,13 +3049,8 @@
       if (max_specpdl_size < 400)
 	max_specpdl_size = 400;
       if (specpdl_size >= max_specpdl_size)
-	{
-	  if (!NILP (Vdebug_on_error))
-	    /* Leave room for some specpdl in the debugger.  */
-	    max_specpdl_size = specpdl_size + 100;
-	  Fsignal (Qerror,
-		   Fcons (build_string ("Variable binding depth exceeds max-specpdl-size"), Qnil));
-	}
+	Fsignal (Qerror,
+		 Fcons (build_string ("Variable binding depth exceeds max-specpdl-size"), Qnil));
     }
   specpdl_size *= 2;
   if (specpdl_size > max_specpdl_size)
@@ -3333,7 +3358,7 @@
 {
   DEFVAR_INT ("max-specpdl-size", &max_specpdl_size,
 	      doc: /* *Limit on number of Lisp variable bindings & unwind-protects.
-If Lisp code tries to make more than this many at once,
+If Lisp code tries to increase the total number past this amount,
 an error is signaled.
 You can safely use a value considerably larger than the default value,
 if that proves inconveniently small.  However, if you increase it too far,
--- a/src/fileio.c	Sun Jun 26 21:06:46 2005 +0000
+++ b/src/fileio.c	Sun Jun 26 21:12:57 2005 +0000
@@ -2408,7 +2408,7 @@
   return;
 }
 
-DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 5,
+DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 6,
        "fCopy file: \nGCopy %s to file: \np\nP",
        doc: /* Copy FILE to NEWNAME.  Both args must be strings.
 If NEWNAME names a directory, copy FILE there.
@@ -2428,9 +2428,13 @@
 that means to get an error if the file already exists; never overwrite.
 If MUSTBENEW is neither nil nor `excl', that means ask for
 confirmation before overwriting, but do go ahead and overwrite the file
-if the user confirms.  */)
-  (file, newname, ok_if_already_exists, keep_time, mustbenew)
+if the user confirms.
+
+If PRESERVE-UID-GID is non-nil, we try to transfer the
+uid and gid of FILE to NEWNAME.  */)
+  (file, newname, ok_if_already_exists, keep_time, mustbenew, preserve_uid_gid)
      Lisp_Object file, newname, ok_if_already_exists, keep_time, mustbenew;
+     Lisp_Object preserve_uid_gid;
 {
   int ifd, ofd, n;
   char buf[16 * 1024];
@@ -2572,6 +2576,26 @@
       report_file_error ("I/O error", Fcons (newname, Qnil));
   immediate_quit = 0;
 
+  /* Preserve the owner and group, if requested.  */
+  if (input_file_statable_p && ! NILP (preserve_uid_gid))
+    fchown (ofd, st.st_uid, st.st_gid);
+
+  if (input_file_statable_p)
+    {
+#ifndef MSDOS
+      fchmod (ofd, st.st_mode & 07777);
+#else /* MSDOS */
+#if defined (__DJGPP__) && __DJGPP__ > 1
+      /* In DJGPP v2.0 and later, fstat usually returns true file mode bits,
+         and if it can't, it tells so.  Otherwise, under MSDOS we usually
+         get only the READ bit, which will make the copied file read-only,
+         so it's better not to chmod at all.  */
+      if ((_djstat_flags & _STFAIL_WRITEBIT) == 0)
+	chmod (SDATA (encoded_newname), st.st_mode & 07777);
+#endif /* DJGPP version 2 or newer */
+#endif /* MSDOS */
+    }
+
   /* Closing the output clobbers the file times on some systems.  */
   if (emacs_close (ofd) < 0)
     report_file_error ("I/O error", Fcons (newname, Qnil));
@@ -2589,18 +2613,6 @@
 		     Fcons (build_string ("Cannot set file date"),
 			    Fcons (newname, Qnil)));
 	}
-#ifndef MSDOS
-      chmod (SDATA (encoded_newname), st.st_mode & 07777);
-#else /* MSDOS */
-#if defined (__DJGPP__) && __DJGPP__ > 1
-      /* In DJGPP v2.0 and later, fstat usually returns true file mode bits,
-         and if it can't, it tells so.  Otherwise, under MSDOS we usually
-         get only the READ bit, which will make the copied file read-only,
-         so it's better not to chmod at all.  */
-      if ((_djstat_flags & _STFAIL_WRITEBIT) == 0)
-	chmod (SDATA (encoded_newname), st.st_mode & 07777);
-#endif /* DJGPP version 2 or newer */
-#endif /* MSDOS */
     }
 
   emacs_close (ifd);
@@ -2777,7 +2789,6 @@
     {
       if (errno == EXDEV)
 	{
-	  struct stat data;
 #ifdef S_IFLNK
           symlink_target = Ffile_symlink_p (file);
           if (! NILP (symlink_target))
@@ -2785,15 +2796,11 @@
                                  NILP (ok_if_already_exists) ? Qnil : Qt);
           else
 #endif
-            Fcopy_file (file, newname,
-                        /* We have already prompted if it was an integer,
-                           so don't have copy-file prompt again.  */
-                        NILP (ok_if_already_exists) ? Qnil : Qt,
-			Qt, Qnil);
-
-	  /* Preserve owner and group, if possible (if we are root).  */
-	  if (stat (SDATA (encoded_file), &data) >= 0)
-	    chown (SDATA (encoded_file), data.st_uid, data.st_gid);
+	    Fcopy_file (file, newname,
+			/* We have already prompted if it was an integer,
+			   so don't have copy-file prompt again.  */
+			NILP (ok_if_already_exists) ? Qnil : Qt,
+			Qt, Qnil, Qt);
 
 	  Fdelete_file (file);
 	}
--- a/src/lread.c	Sun Jun 26 21:06:46 2005 +0000
+++ b/src/lread.c	Sun Jun 26 21:12:57 2005 +0000
@@ -2596,6 +2596,23 @@
 		    break;
 		  case 'N':
 		    value = zero / zero;
+
+		    /* If that made a "negative" NaN, negate it.  */
+
+		    {
+		      int i;
+		      union { double d; char c[sizeof (double)]; } u_data, u_minus_zero;
+
+		      u_data.d = value;
+		      u_minus_zero.d = - 0.0;
+		      for (i = 0; i < sizeof (double); i++)
+			if (u_data.c[i] & u_minus_zero.c[i])
+			  {
+			    value = - value;
+			    break;
+			  }
+		    }
+		    /* Now VALUE is a positive NaN.  */
 		    break;
 		  default:
 		    value = atof (read_buffer + negative);
--- a/src/macfns.c	Sun Jun 26 21:06:46 2005 +0000
+++ b/src/macfns.c	Sun Jun 26 21:12:57 2005 +0000
@@ -4088,7 +4088,7 @@
   clear_glyph_matrix (w->desired_matrix);
   clear_glyph_matrix (w->current_matrix);
   SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
-  try_window (FRAME_ROOT_WINDOW (f), pos);
+  try_window (FRAME_ROOT_WINDOW (f), pos, 0);
 
   /* Compute width and height of the tooltip.  */
   width = height = 0;
--- a/src/s/ms-w32.h	Sun Jun 26 21:06:46 2005 +0000
+++ b/src/s/ms-w32.h	Sun Jun 26 21:12:57 2005 +0000
@@ -311,6 +311,7 @@
 #define chdir   sys_chdir
 #undef chmod
 #define chmod   sys_chmod
+#define chown   sys_chown
 #undef close
 #define close   sys_close
 #undef creat
--- a/src/w32.c	Sun Jun 26 21:06:46 2005 +0000
+++ b/src/w32.c	Sun Jun 26 21:12:57 2005 +0000
@@ -1898,6 +1898,14 @@
 }
 
 int
+sys_chown (const char *path, uid_t owner, gid_t group)
+{
+  if (sys_chmod (path, _S_IREAD) == -1) /* check if file exists */
+    return -1;
+  return 0;
+}
+
+int
 sys_creat (const char * path, int mode)
 {
   return _creat (map_w32_filename (path, NULL), mode);
--- a/src/w32fns.c	Sun Jun 26 21:06:46 2005 +0000
+++ b/src/w32fns.c	Sun Jun 26 21:12:57 2005 +0000
@@ -7586,7 +7586,7 @@
   clear_glyph_matrix (w->desired_matrix);
   clear_glyph_matrix (w->current_matrix);
   SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
-  try_window (FRAME_ROOT_WINDOW (f), pos);
+  try_window (FRAME_ROOT_WINDOW (f), pos, 0);
 
   /* Compute width and height of the tooltip.  */
   width = height = 0;
--- a/src/xdisp.c	Sun Jun 26 21:06:46 2005 +0000
+++ b/src/xdisp.c	Sun Jun 26 21:12:57 2005 +0000
@@ -7594,7 +7594,7 @@
   clear_glyph_matrix (w->desired_matrix);
   XSETWINDOW (window, w);
   SET_TEXT_POS (start, BEG, BEG_BYTE);
-  try_window (window, start);
+  try_window (window, start, 0);
 
   return window_height_changed_p;
 }
@@ -11573,7 +11573,7 @@
 
   /* Display the window.  Give up if new fonts are loaded, or if point
      doesn't appear.  */
-  if (!try_window (window, startp))
+  if (!try_window (window, startp, 0))
     rc = SCROLLING_NEED_LARGER_MATRICES;
   else if (w->cursor.vpos < 0)
     {
@@ -12178,6 +12178,7 @@
     {
       /* We set this later on if we have to adjust point.  */
       int new_vpos = -1;
+      int val;
 
       w->force_start = Qnil;
       w->vscroll = 0;
@@ -12211,12 +12212,16 @@
 
       /* Redisplay, then check if cursor has been set during the
 	 redisplay.  Give up if new fonts were loaded.  */
-      if (!try_window (window, startp))
+      val = try_window (window, startp, 1);
+      if (!val)
 	{
 	  w->force_start = Qt;
 	  clear_glyph_matrix (w->desired_matrix);
 	  goto need_larger_matrices;
 	}
+      /* Point was outside the scroll margins.  */
+      if (val < 0)
+	new_vpos = window_box_height (w) / 2;
 
       if (w->cursor.vpos < 0 && !w->frozen_window_start_p)
 	{
@@ -12259,7 +12264,7 @@
 	      && !NILP (current_buffer->mark_active))
 	    {
 	      clear_glyph_matrix (w->desired_matrix);
-	      if (!try_window (window, startp))
+	      if (!try_window (window, startp, 0))
 		goto need_larger_matrices;
 	    }
 	}
@@ -12349,7 +12354,11 @@
 	       = try_window_reusing_current_matrix (w)))
 	{
 	  IF_DEBUG (debug_method_add (w, "1"));
-	  try_window (window, startp);
+	  if (try_window (window, startp, 1) < 0)
+	    /* -1 means we need to scroll.
+	       0 means we need new matrices, but fonts_changed_p
+	       is set in that case, so we will detect it below.  */
+	    goto try_to_scroll;
 	}
 
       if (fonts_changed_p)
@@ -12479,7 +12488,7 @@
       || MINI_WINDOW_P (w)
       || !(used_current_matrix_p
 	   = try_window_reusing_current_matrix (w)))
-    try_window (window, startp);
+    try_window (window, startp, 0);
 
   /* If new fonts have been loaded (due to fontsets), give up.  We
      have to start a new redisplay since we need to re-adjust glyph
@@ -12499,13 +12508,13 @@
 	{
 	  clear_glyph_matrix (w->desired_matrix);
 	  move_it_by_lines (&it, 1, 0);
-	  try_window (window, it.current.pos);
+	  try_window (window, it.current.pos, 0);
 	}
       else if (PT < IT_CHARPOS (it))
 	{
 	  clear_glyph_matrix (w->desired_matrix);
 	  move_it_by_lines (&it, -1, 0);
-	  try_window (window, it.current.pos);
+	  try_window (window, it.current.pos, 0);
 	}
       else
 	{
@@ -12691,14 +12700,18 @@
 
 
 /* Build the complete desired matrix of WINDOW with a window start
-   buffer position POS.  Value is non-zero if successful.  It is zero
-   if fonts were loaded during redisplay which makes re-adjusting
-   glyph matrices necessary.  */
+   buffer position POS.
+
+   Value is 1 if successful.  It is zero if fonts were loaded during
+   redisplay which makes re-adjusting glyph matrices necessary, and -1
+   if point would appear in the scroll margins.
+   (We check that only if CHECK_MARGINS is nonzero.  */
 
 int
-try_window (window, pos)
+try_window (window, pos, check_margins)
      Lisp_Object window;
      struct text_pos pos;
+     int check_margins;
 {
   struct window *w = XWINDOW (window);
   struct it it;
@@ -12723,6 +12736,30 @@
 	return 0;
     }
 
+  /* Don't let the cursor end in the scroll margins.  */
+  if (check_margins)
+    {
+      int this_scroll_margin, cursor_height;
+
+      this_scroll_margin = max (0, scroll_margin);
+      this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4);
+      this_scroll_margin *= FRAME_LINE_HEIGHT (it.f);
+      cursor_height = MATRIX_ROW (w->desired_matrix, w->cursor.vpos)->height;
+
+      if ((w->cursor.y < this_scroll_margin
+	   && CHARPOS (pos) > BEGV)
+	  /* Old redisplay didn't take scroll margin into account at the bottom,
+	     but then global-hl-line-mode doesn't scroll.  KFS 2004-06-14 */
+	  || (w->cursor.y + (make_cursor_line_fully_visible_p
+			     ? cursor_height + this_scroll_margin
+			     : 1)) > it.last_visible_y)
+	{
+	  w->cursor.vpos = -1;
+	  clear_glyph_matrix (w->desired_matrix);
+	  return -1;
+	}
+    }
+
   /* If bottom moved off end of frame, change mode line percentage.  */
   if (XFASTINT (w->window_end_pos) <= 0
       && Z != IT_CHARPOS (it))
@@ -21667,7 +21704,7 @@
   /* If we were displaying active text in another window, clear that.
      Also clear if we move out of text area in same window.  */
   if (! EQ (window, dpyinfo->mouse_face_window)
-      || (part != ON_TEXT && part != ON_MODE_LINE && part != ON_HEADER_LINE 
+      || (part != ON_TEXT && part != ON_MODE_LINE && part != ON_HEADER_LINE
 	  && !NILP (dpyinfo->mouse_face_window)))
     clear_mouse_face (dpyinfo);
 
@@ -22894,17 +22931,17 @@
 
   DEFVAR_LISP ("nobreak-char-display", &Vnobreak_char_display,
     doc: /* *Control highlighting of nobreak space and soft hyphen.
-t means highlight the character itself (for nobreak space,
-use face `nobreak-space'.
-nil means no highlighting.
-other values mean display the escape glyph followed by an ordinary
+A value of t means highlight the character itself (for nobreak space,
+use face `nobreak-space').
+A value of nil means no highlighting.
+Other values mean display the escape glyph followed by an ordinary
 space or ordinary hyphen.  */);
   Vnobreak_char_display = Qt;
 
   DEFVAR_LISP ("void-text-area-pointer", &Vvoid_text_area_pointer,
     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'.  */);
+A value of nil means to show the text pointer.  Other options are `arrow',
+`text', `hand', `vdrag', `hdrag', `modeline', and `hourglass'.  */);
   Vvoid_text_area_pointer = Qarrow;
 
   DEFVAR_LISP ("inhibit-redisplay", &Vinhibit_redisplay,
--- a/src/xfns.c	Sun Jun 26 21:06:46 2005 +0000
+++ b/src/xfns.c	Sun Jun 26 21:12:57 2005 +0000
@@ -5101,7 +5101,7 @@
   clear_glyph_matrix (w->desired_matrix);
   clear_glyph_matrix (w->current_matrix);
   SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
-  try_window (FRAME_ROOT_WINDOW (f), pos);
+  try_window (FRAME_ROOT_WINDOW (f), pos, 0);
 
   /* Compute width and height of the tooltip.  */
   width = height = 0;