changeset 83162:dbcd0af66869

Merged in changes from CVS trunk. Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-409 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-410 Make sure image types are initialized for lookup too * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-411 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-412 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-413 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-414 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-415 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-416 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-417 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-418 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-419 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-202
author Karoly Lorentey <lorentey@elte.hu>
date Thu, 24 Jun 2004 07:44:13 +0000
parents 8d62eda26760 (current diff) fb1bd8c58401 (diff)
children 8e4ea1e2c254
files ChangeLog lisp/ChangeLog lisp/frame.el man/ChangeLog man/info.texi src/alloc.c src/buffer.c src/coding.c src/dispextern.h src/keyboard.c src/keymap.c src/lisp.h src/macterm.c src/minibuf.c src/print.c src/window.c src/window.h src/xdisp.c src/xfaces.c src/xselect.c src/xsmfns.c src/xterm.c src/xterm.h
diffstat 90 files changed, 1515 insertions(+), 506 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Jun 15 18:46:31 2004 +0000
+++ b/ChangeLog	Thu Jun 24 07:44:13 2004 +0000
@@ -1,3 +1,12 @@
+2004-06-21  Kenichi Handa  <handa@m17n.org>
+
+	* make-dist: Link leim-ext.el into tempdir.
+
+2004-06-15  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* info/dir (File): Add emacs-xtra.
+	* Makefile.in (install-arch-indep, uninstall): Add emacs-xtra.
+
 2004-06-12  Juri Linkov  <juri@jurta.org>
 
 	* info/dir: Move menu help lines from `* Menu:' to file header.
--- a/Makefile.in	Tue Jun 15 18:46:31 2004 +0000
+++ b/Makefile.in	Thu Jun 24 07:44:13 2004 +0000
@@ -474,7 +474,7 @@
 	      chmod a+r ${infodir}/dir); \
 	   fi; \
 	   cd ${srcdir}/info ; \
-	   for f in ada-mode* autotype* calc* ccmode* cl* dired-x* ebrowse* ediff* efaq* eintr* elisp* emacs* eshell* eudc* forms* gnus* idlwave* info* message* mh-e* pcl-cvs* reftex* sc* ses* speedbar* tramp* vip* widget* woman* smtpmail*; do \
+	   for f in ada-mode* autotype* calc* ccmode* cl* dired-x* ebrowse* ediff* efaq* eintr* elisp* emacs* emacs-xtra* eshell* eudc* forms* gnus* idlwave* info* message* mh-e* pcl-cvs* reftex* sc* ses* speedbar* tramp* vip* widget* woman* smtpmail*; do \
 	     (cd $${thisdir}; \
 	      ${INSTALL_DATA} ${srcdir}/info/$$f ${infodir}/$$f; \
 	      chmod a+r ${infodir}/$$f); \
@@ -484,7 +484,7 @@
 	thisdir=`/bin/pwd`; \
 	if [ `(cd ${srcdir}/info && /bin/pwd)` != `(cd ${infodir} && /bin/pwd)` ]; \
 	then \
-	  for f in ada-mode autotype calc ccmode cl dired-x ebrowse ediff efaq elisp eintr emacs emacs-mime eshell eudc forms gnus idlwave info message mh-e pcl-cvs reftex sc ses speedbar tramp vip viper widget woman smtpmail; do \
+	  for f in ada-mode autotype calc ccmode cl dired-x ebrowse ediff efaq elisp eintr emacs emacs-mime emacs-xtra eshell eudc forms gnus idlwave info message mh-e pcl-cvs reftex sc ses speedbar tramp vip viper widget woman smtpmail; do \
 	    (cd $${thisdir}; \
 	     ${INSTALL_INFO} --info-dir=${infodir} ${infodir}/$$f); \
 	  done; \
@@ -550,7 +550,7 @@
 	done
 	(cd ${archlibdir} && rm -f fns-*)
 	-rm -rf ${libexecdir}/emacs/${version}
-	(cd ${infodir} && rm -f cl* ada-mode* autotype* calc* ccmode* ebrowse* efaq* eintr elisp* eshell* eudc* idlwave* message* pcl-cvs* reftex* speedbar* tramp* widget* woman* dired-x* ediff* emacs* forms* gnus* info* mh-e* sc* ses* vip* smtpmail*)
+	(cd ${infodir} && rm -f cl* ada-mode* autotype* calc* ccmode* ebrowse* efaq* eintr elisp* eshell* eudc* idlwave* message* pcl-cvs* reftex* speedbar* tramp* widget* woman* dired-x* ediff* emacs* emacs-xtra* forms* gnus* info* mh-e* sc* ses* vip* smtpmail*)
 	(cd ${man1dir}  && rm -f emacs${manext} emacsclient${manext} etags${manext} ctags${manext})
 	(cd ${bindir}  && rm -f $(EMACSFULL) $(EMACS))
 
--- a/etc/ChangeLog	Tue Jun 15 18:46:31 2004 +0000
+++ b/etc/ChangeLog	Thu Jun 24 07:44:13 2004 +0000
@@ -1,3 +1,7 @@
+2004-06-23  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* MORE.STUFF: Delete obsolete URL.
+
 2004-06-10  Lars Hansen  <larsh@math.ku.dk>
 
 	* NEWS: Describe dired-omit-mode. Describe desktop package changes.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/etc/FOR-RELEASE	Thu Jun 24 07:44:13 2004 +0000
@@ -0,0 +1,21 @@
+Tasks needed before the next release.
+
+** Test the mbox branch of Rmail.
+
+** Install the mbox branch of Rmail.
+
+** Finish updating the Emacs Lisp manual.
+
+** Finish checking the Emacs Lisp manual.
+
+** Update the Emacs manual.
+
+** Check the Emacs manual.
+
+** Update man/info.texi.
+
+** Make geometry specifications work correctly for GTK.
+
+** Make GTK scrollbars behave like others w.r.t. overscrolling.
+
+** Make GTK toolbar look OK on monochrome displays.
--- a/etc/MORE.STUFF	Tue Jun 15 18:46:31 2004 +0000
+++ b/etc/MORE.STUFF	Thu Jun 24 07:44:13 2004 +0000
@@ -36,9 +36,6 @@
 
  * Ada: <URL:http://libre.act-europe.fr/adamode>
 
- * Autorevert, CWarn and Follow:
-   <URL:http://www.andersl.com/emacs/>
-
  * Battery and Info Look: <URL:ftp://ftp.ul.bawue.de/pub/purple/emacs>
 
  * BibTeX:
--- a/etc/NEWS	Tue Jun 15 18:46:31 2004 +0000
+++ b/etc/NEWS	Thu Jun 24 07:44:13 2004 +0000
@@ -2150,6 +2150,9 @@
 
 * Lisp Changes in Emacs 21.4
 
+** If a command sets transient-mark-mode to `only', that 
+enables Transient Mark mode for the following command, only.
+
 +++
 ** Cleaner way to enter key sequences.
 
@@ -2178,6 +2181,10 @@
 click-event-style position information for a given visible buffer
 position or for a given window pixel coordinate.
 
+** skip-chars-forward and skip-chars-backward now handle
+character classes such as [:alpha:], along with individual characters
+and ranges.
+
 ** Function pos-visible-in-window-p now returns the pixel coordinates
 and partial visiblity state of the corresponding row, if the PARTIALLY
 arg is non-nil.
--- a/lisp/ChangeLog	Tue Jun 15 18:46:31 2004 +0000
+++ b/lisp/ChangeLog	Thu Jun 24 07:44:13 2004 +0000
@@ -1,3 +1,112 @@
+2004-06-24  Daniel Pfeiffer  <occitan@esperanto.org>
+
+	* progmodes/grep.el (grep-error-screen-columns): New variable.
+	(grep-regexp-alist): Give it the full functionality of gnu style
+	compilation messages with line and column ranges.  Ask me for the
+	perl script I'm working on, that uses these.
+
+2004-06-23  Nick Roberts  <nickrob@gnu.org>
+
+	* comint.el: (comint-insert-clicked-input, comint-copy-old-input):
+	Remove.
+	(comint-insert-input, comint-mouse-insert-input): New functions
+	based on comint-insert-clicked-input for two bindings but just
+	one functionality.
+
+2004-06-23  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* net/goto-addr.el (goto-address-fontify): Fix help-echo text.
+
+2004-06-23  Lars Hansen  <larsh@math.ku.dk>
+
+	* files.el (write-contents-functions): Doc fix.
+
+2004-06-21  Juanma Barranquero  <lektu@terra.es>
+
+	* image.el (image-library-alist): Rewrite docstring in active
+	voice.
+
+2004-06-20  Richard M. Stallman  <rms@gnu.org>
+
+	* mouse.el (mouse-set-region-1): Set transient-mark-mode to `only'.
+
+	* isearch.el (isearch-repeat): Avoid testing old match data.
+	(isearch-message): Display trailing space in special font
+	when search is failing.
+	(isearch-search-fun-function): Doc fix.
+
+	* autorevert.el (global-auto-revert-non-file-buffers): Doc fix.
+
+2004-06-19  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* frame.el (show-trailing-whitespace): Doc fix.
+
+	* cus-edit.el (custom-variable-documentation): New function.
+	(custom-variable): Use it.
+
+2004-06-19  Nick Roberts  <nickrob@gnu.org>
+
+	* man.el (Man-getpage-in-background): Revert previous change but
+	make cygwin a special case.
+
+2004-06-18  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* autorevert.el (global-auto-revert-non-file-buffers): Update
+	docstring.
+
+2004-06-19  Daniel Pfeiffer  <occitan@esperanto.org>
+
+	* progmodes/compile.el (compilation-error-properties): Store one
+	more than end-col, if present, so that transient-mark-mode will
+	highlight last char too.
+	* progmodes/grep.el (grep-regexp-alist): Match columns and column
+	ranges, if present.
+
+2004-06-18  Jason Rumney  <jasonr@gnu.org>
+
+	* makefile.w32-in: Double percent signs in for loops.
+
+2004-06-17  David Kastrup  <dak@gnu.org>
+
+	* replace.el (query-replace-read-args): Only warn about use of \n
+	and \t when we are doing a regexp replacement and the actual
+	escaped character is n or t.
+	(query-replace-regexp): Add \, and \# interpretation to
+	interactive call and document it.
+	(query-replace-regexp-eval, replace-match-string-symbols): add \#
+	as shortkey for replace-count.
+	(replace-quote): New function for doubling backslashes.
+
+2004-06-17  Juanma Barranquero  <lektu@terra.es>
+
+	* files.el (parse-colon-path, cd): Mention in docstring that the
+	path separator is colon in GNU-like systems.
+
+	* newcomment.el (comment-region-internal): Fix docstring.
+
+	* emacs-lisp/ewoc.el (ewoc-create, ewoc-map, ewoc-locate)
+	(ewoc-invalidate, ewoc-collect): Doc fixes.
+	(ewoc--create-node, ewoc--delete-node-internal):
+	Fix typos in docstring.
+
+2004-06-15  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* files.el (buffer-stale-function): Add hyperlink to emacs-xtra
+	manual to docstring.
+
+2004-06-15  Vinicius Jose Latorre  <viniciusjl@ig.com.br>
+
+	* ps-print.el (ps-time-stamp-iso8601): Comment doc string of defalias.
+
+2004-06-15  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* dired-aux.el (dired-do-redisplay, dired-maybe-insert-subdir):
+	Add hyperlink to emacs-xtra manual to docstring.
+
+	* autorevert.el (global-auto-revert-non-file-buffers): Add
+	hyperlink to emacs-xtra manual to docstring, as well as an
+	info-link.
+
 2004-06-14  Juanma Barranquero  <lektu@terra.es>
 
 	* image.el (image-library-alist): New variable to map image types
--- a/lisp/autorevert.el	Tue Jun 15 18:46:31 2004 +0000
+++ b/lisp/autorevert.el	Thu Jun 24 07:44:13 2004 +0000
@@ -174,20 +174,21 @@
   :type 'hook)
 
 (defcustom global-auto-revert-non-file-buffers nil
-  "When nil only file buffers are reverted by Global Auto-Revert Mode.
+  "When nil, Global Auto-Revert mode operates only on file-visiting buffers.
 
 When non-nil, both file buffers and buffers with a custom
 `revert-buffer-function' and a `buffer-stale-function' are
-reverted by Global Auto-Revert Mode.
+reverted by Global Auto-Revert mode.  These include the Buffer
+List buffer, and Dired buffers showing complete local
+directories.  Dired buffers do not auto-revert as a result of
+changes in subdirectories or in the contents, size, modes, etc.,
+of files.  You may still sometimes want to revert them manually.
 
-Use this option with care since it could lead to excessive reverts.
-Note also that for some non-file buffers the check whether the
-buffer needs updating may be imperfect, due to efficiency
-considerations, and may not take all information listed in the
-buffer into account.  Hence, a non-nil value for this option does
-not necessarily make manual updates useless for non-file buffers."
+Use this option with care since it could lead to excessive auto-reverts.
+For more information, see Info node `(emacs-xtra)Autorevert'."
   :group 'auto-revert
-  :type 'boolean)
+  :type 'boolean
+  :link '(info-link "(emacs-xtra)Autorevert"))
 
 (defcustom global-auto-revert-ignore-modes '()
   "List of major modes Global Auto-Revert Mode should not check."
--- a/lisp/comint.el	Tue Jun 15 18:46:31 2004 +0000
+++ b/lisp/comint.el	Thu Jun 24 07:44:13 2004 +0000
@@ -571,7 +571,7 @@
   (define-key comint-mode-map "\C-c\C-c" 'comint-interrupt-subjob)
   (define-key comint-mode-map "\C-c\C-z" 'comint-stop-subjob)
   (define-key comint-mode-map "\C-c\C-\\" 'comint-quit-subjob)
-  (define-key comint-mode-map "\C-c\C-m" 'comint-copy-old-input)
+  (define-key comint-mode-map "\C-c\C-m" 'comint-insert-input)
   (define-key comint-mode-map "\C-c\C-o" 'comint-delete-output)
   (define-key comint-mode-map "\C-c\C-r" 'comint-show-output)
   (define-key comint-mode-map "\C-c\C-e" 'comint-show-maximum-output)
@@ -582,7 +582,7 @@
   (define-key comint-mode-map "\C-c\C-s" 'comint-write-output)
   (define-key comint-mode-map "\C-c." 'comint-insert-previous-argument)
   ;; Mouse Buttons:
-  (define-key comint-mode-map [mouse-2] 'comint-insert-clicked-input)
+  (define-key comint-mode-map [mouse-2] 'comint-mouse-insert-input)
   ;; Menu bars:
   ;; completion:
   (define-key comint-mode-map [menu-bar completion]
@@ -615,7 +615,7 @@
   (define-key comint-mode-map [menu-bar inout kill-input]
     '("Kill Current Input" . comint-kill-input))
   (define-key comint-mode-map [menu-bar inout copy-input]
-    '("Copy Old Input" . comint-copy-old-input))
+    '("Copy Old Input" . comint-insert-input))
   (define-key comint-mode-map [menu-bar inout forward-matching-history]
     '("Forward Matching Input..." . comint-forward-matching-input))
   (define-key comint-mode-map [menu-bar inout backward-matching-history]
@@ -798,11 +798,10 @@
 	(set-process-coding-system proc decoding encoding))
     proc))
 
-
-(defun comint-insert-clicked-input (event)
-  "In a Comint buffer, set the current input to the clicked-on previous input."
-  (interactive "e")
-  (let ((pos (posn-point (event-end event))))
+(defun comint-insert-input ()
+  "In a Comint buffer, set the current input to the previous input at point."
+  (interactive)
+  (let ((pos (point)))
     (if (not (eq (get-char-property pos 'field) 'input))
 	;; No input at POS, fall back to the global definition.
 	(let* ((keys (this-command-keys))
@@ -816,11 +815,16 @@
        (or (marker-position comint-accum-marker)
 	   (process-mark (get-buffer-process (current-buffer))))
        (point))
-      ;; Insert the clicked-upon input
+      ;; Insert the input at point
       (insert (buffer-substring-no-properties
 	       (previous-single-char-property-change (1+ pos) 'field)
 	       (next-single-char-property-change pos 'field))))))
 
+(defun comint-mouse-insert-input (event)
+  "In a Comint buffer, set the current input to the previous input you click on."
+  (interactive "e")
+  (mouse-set-point event)
+  (comint-insert-input)) 
 
 
 ;; Input history processing in a buffer
@@ -1858,17 +1862,6 @@
       (comint-bol)
       (buffer-substring-no-properties (point) (line-end-position)))))
 
-(defun comint-copy-old-input ()
-  "Insert after prompt old input at point as new input to be edited.
-Calls `comint-get-old-input' to get old input."
-  (interactive)
-  (let ((input (funcall comint-get-old-input))
-	(process (get-buffer-process (current-buffer))))
-    (if (not process)
-	(error "Current buffer has no process")
-      (goto-char (process-mark process))
-      (insert input))))
-
 (defun comint-skip-prompt ()
   "Skip past the text matching regexp `comint-prompt-regexp'.
 If this takes us past the end of the current line, don't skip at all."
--- a/lisp/cus-edit.el	Tue Jun 15 18:46:31 2004 +0000
+++ b/lisp/cus-edit.el	Thu Jun 24 07:44:13 2004 +0000
@@ -2074,11 +2074,25 @@
   :group 'custom-buffer
   :version "20.3")
 
+(defun custom-variable-documentation (variable)
+  "Return documentation of VARIABLE for use in Custom buffer.
+Normally just return the docstring.  But if VARIABLE automatically
+becomes buffer local when set, append a message to that effect."
+  (if (and (local-variable-if-set-p variable)
+	   (or (not (local-variable-p variable))
+	       (with-temp-buffer
+		 (local-variable-if-set-p variable))))
+      (concat (documentation-property variable 'variable-documentation)
+	      "\n
+This variable automatically becomes buffer-local when set outside Custom.
+However, setting it through Custom sets the default value.")
+    (documentation-property variable 'variable-documentation)))
+
 (define-widget 'custom-variable 'custom
   "Customize variable."
   :format "%v"
   :help-echo "Set or reset this variable."
-  :documentation-property 'variable-documentation
+  :documentation-property #'custom-variable-documentation
   :custom-category 'option
   :custom-state nil
   :custom-menu 'custom-variable-menu-create
--- a/lisp/dired-aux.el	Tue Jun 15 18:46:31 2004 +0000
+++ b/lisp/dired-aux.el	Thu Jun 24 07:44:13 2004 +0000
@@ -902,7 +902,8 @@
 or delete subdirectories can bypass this machinery.  Hence, you sometimes
 may have to reset some subdirectory switches after a `dired-undo'.
 You can reset all subdirectory switches to the default using
-\\<dired-mode-map>\\[dired-reset-subdir-switches]."
+\\<dired-mode-map>\\[dired-reset-subdir-switches].
+See Info node `(emacs-xtra)Subdir switches' for more details."
   ;; Moves point if the next ARG files are redisplayed.
   (interactive "P\np")
   (if (and test-for-subdir (dired-get-subdir))
@@ -1751,7 +1752,8 @@
 or delete subdirectories can bypass this machinery.  Hence, you sometimes
 may have to reset some subdirectory switches after a `dired-undo'.
 You can reset all subdirectory switches to the default using
-\\<dired-mode-map>\\[dired-reset-subdir-switches]."
+\\<dired-mode-map>\\[dired-reset-subdir-switches].
+See Info node `(emacs-xtra)Subdir switches' for more details."
   (interactive
    (list (dired-get-filename)
 	 (if current-prefix-arg
--- a/lisp/emacs-lisp/ewoc.el	Tue Jun 15 18:46:31 2004 +0000
+++ b/lisp/emacs-lisp/ewoc.el	Thu Jun 24 07:44:13 2004 +0000
@@ -1,6 +1,7 @@
 ;;; ewoc.el --- utility to maintain a view of a list of objects in a buffer
 
-;; Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000   Free Software Foundation
+;; Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 04
+;;      Free Software Foundation
 
 ;; Author: Per Cederqvist <ceder@lysator.liu.se>
 ;;	Inge Wallin <inge@lysator.liu.se>
@@ -244,7 +245,7 @@
 
 (defun ewoc--create-node (data pretty-printer pos)
   "Call PRETTY-PRINTER with point set at POS in current buffer.
-Remember the start position. Create a wrapper containing that
+Remember the start position.  Create a wrapper containing that
 start position and the element DATA."
   (save-excursion
     ;; Remember the position as a number so that it doesn't move
@@ -263,7 +264,7 @@
 
 (defun ewoc--delete-node-internal (ewoc node)
   "Delete a data string from EWOC.
-Can not be used on the footer. Returns the wrapper that is deleted.
+Can not be used on the footer.  Returns the wrapper that is deleted.
 The start-marker in the wrapper is set to nil, so that it doesn't
 consume any more resources."
   (let ((dll (ewoc--dll ewoc))
@@ -303,14 +304,14 @@
 
 PRETTY-PRINTER should be a function that takes one argument, an
 element, and inserts a string representing it in the buffer (at
-point). The string PRETTY-PRINTER inserts may be empty or span
-several linse. A trailing newline will always be inserted
-automatically. The PRETTY-PRINTER should use insert, and not
-insert-before-markers.
+point).  The string PRETTY-PRINTER inserts may be empty or span
+several lines.  A trailing newline will always be inserted
+automatically.  The PRETTY-PRINTER should use `insert', and not
+`insert-before-markers'.
 
-Optional third argument HEADER is a string that will always be
-present at the top of the ewoc. HEADER should end with a
-newline.  Optionaly fourth argument FOOTER is similar, and will
+Optional second argument HEADER is a string that will always be
+present at the top of the ewoc.  HEADER should end with a
+newline.  Optional third argument FOOTER is similar, and will
 be inserted at the bottom of the ewoc."
   (let ((new-ewoc
 	 (ewoc--create (current-buffer)
@@ -394,9 +395,9 @@
 If MAP-FUNCTION returns non-nil the element will be refreshed (its
 pretty-printer will be called once again).
 
-Note that the buffer for EWOC will be current buffer when MAP-FUNCTION
-is called.  MAP-FUNCTION must restore the current buffer to BUFFER before
-it returns, if it changes it.
+Note that the buffer for EWOC will be the current buffer when
+MAP-FUNCTION is called.  MAP-FUNCTION must restore the current
+buffer before it returns, if it changes it.
 
 If more than two arguments are given, the remaining
 arguments will be passed to MAP-FUNCTION."
@@ -411,9 +412,9 @@
 (defun ewoc-filter (ewoc predicate &rest args)
   "Remove all elements in EWOC for which PREDICATE returns nil.
 Note that the buffer for EWOC will be current-buffer when PREDICATE
-is called. PREDICATE must restore the current buffer before it returns
+is called.  PREDICATE must restore the current buffer before it returns
 if it changes it.
-The PREDICATE is called with the element as its first argument. If any
+The PREDICATE is called with the element as its first argument.  If any
 ARGS are given they will be passed to the PREDICATE."
   (ewoc--set-buffer-bind-dll-let* ewoc
       ((node (ewoc--node-nth dll 1))
@@ -428,7 +429,7 @@
 (defun ewoc-locate (ewoc &optional pos guess)
   "Return the node that POS (a buffer position) is within.
 POS may be a marker or an integer.  It defaults to point.
-GUESS should be a node that it is likely that POS is near.
+GUESS should be a node that it is likely to be near POS.
 
 If POS points before the first element, the first node is returned.
 If POS points after the last element, the last node is returned.
@@ -497,7 +498,7 @@
 
 (defun ewoc-invalidate (ewoc &rest nodes)
   "Refresh some elements.
-The pretty-printer that for EWOC will be called for all NODES."
+The pretty-printer set for EWOC will be called for all NODES."
   (ewoc--set-buffer-bind-dll ewoc
     (dolist (node nodes)
       (ewoc--refresh-node (ewoc--pretty-printer ewoc) node))))
@@ -564,13 +565,13 @@
 (defun ewoc-collect (ewoc predicate &rest args)
   "Select elements from EWOC using PREDICATE.
 Return a list of all selected data elements.
-PREDICATE is a function that takes a data element as its first argument.
-The elements on the returned list will appear in the same order as in
-the buffer.  You should not rely on in which order PREDICATE is
-called.
-Note that the buffer the EWOC is displayed in is current-buffer
-when PREDICATE is called.  If PREDICATE must restore current-buffer if
-it changes it.
+PREDICATE is a function that takes a data element as its first
+argument.  The elements on the returned list will appear in the
+same order as in the buffer.  You should not rely on the order of
+calls to PREDICATE.
+Note that the buffer the EWOC is displayed in is the current
+buffer when PREDICATE is called.  PREDICATE must restore it if it
+changes it.
 If more than two arguments are given the
 remaining arguments will be passed to PREDICATE."
   (ewoc--set-buffer-bind-dll-let* ewoc
--- a/lisp/files.el	Tue Jun 15 18:46:31 2004 +0000
+++ b/lisp/files.el	Thu Jun 24 07:44:13 2004 +0000
@@ -393,7 +393,8 @@
 (defvar write-contents-functions nil
   "List of functions to be called before writing out a buffer to a file.
 If one of them returns non-nil, the file is considered already written
-and the rest are not called.
+and the rest are not called and neither are the functions in
+`write-file-functions'.
 
 This variable is meant to be used for hooks that pertain to the
 buffer's contents, not to the particular visited file; thus,
@@ -527,7 +528,8 @@
 
 (defun parse-colon-path (cd-path)
   "Explode a search path into a list of directory names.
-Directories are separated by occurrences of `path-separator'."
+Directories are separated by occurrences of `path-separator'
+\(which is colon in GNU and GNU-like systems)."
   ;; We could use split-string here.
   (and cd-path
        (let (cd-list (cd-start 0) cd-colon)
@@ -562,7 +564,8 @@
   "Make DIR become the current buffer's default directory.
 If your environment includes a `CDPATH' variable, try each one of
 that list of directories (separated by occurrences of
-`path-separator') when resolving a relative directory name."
+`path-separator') when resolving a relative directory name.
+The path separator is colon in GNU and GNU-like systems."
   (interactive
    (list (read-directory-name "Change default directory: "
 			 default-directory default-directory
@@ -3480,7 +3483,10 @@
 The idea behind the NOCONFIRM argument is that it should be
 non-nil if the buffer is going to be reverted without asking the
 user.  In such situations, one has to be careful with potentially
-time consuming operations.")
+time consuming operations.
+
+For more information on how this variable is used by Auto Revert mode,
+see Info node `(emacs-xtra)Supporting additional buffers'.")
 
 (defvar before-revert-hook nil
   "Normal hook for `revert-buffer' to run before reverting.
--- a/lisp/frame.el	Tue Jun 15 18:46:31 2004 +0000
+++ b/lisp/frame.el	Thu Jun 24 07:44:13 2004 +0000
@@ -1244,9 +1244,8 @@
 (make-variable-buffer-local 'show-trailing-whitespace)
 
 (defcustom show-trailing-whitespace nil
-  "*Non-nil means highlight trailing whitespace in face `trailing-whitespace'.
-
-Setting this variable makes it local to the current buffer."
+  "*Non-nil means highlight trailing whitespace.
+This is done in the face `trailing-whitespace'."
   :tag "Highlight trailing whitespace."
   :type 'boolean
   :group 'font-lock)
--- a/lisp/image.el	Tue Jun 15 18:46:31 2004 +0000
+++ b/lisp/image.el	Thu Jun 24 07:44:13 2004 +0000
@@ -54,10 +54,12 @@
 
 Each element is a list (IMAGE-TYPE LIBRARY...), where the car is a symbol
 representing a supported image type, and the rest are strings giving
-alternate filenames for the corresponding external libraries to load.
-They are tried in the order they appear on the list; if none of them can
-be loaded, the running session of Emacs won't display the image type.
-No entries are needed for pbm and xbm images; they're always supported.")
+alternate filenames for the corresponding external libraries.
+
+Emacs tries to load the libraries in the order they appear on the
+list; if none is loaded, the running session of Emacs won't
+support the image type.  Types 'pbm and 'xbm don't need to be
+listed; they're always supported.")
 ;;;###autoload (put 'image-library-alist 'risky-local-variable t)
 
 (defun image-jpeg-p (data)
--- a/lisp/isearch.el	Tue Jun 15 18:46:31 2004 +0000
+++ b/lisp/isearch.el	Thu Jun 24 07:44:13 2004 +0000
@@ -999,7 +999,8 @@
 
   (if (equal isearch-string "")
       (setq isearch-success t)
-    (if (and isearch-success (equal (match-end 0) (match-beginning 0))
+    (if (and isearch-success
+	     (equal (point) isearch-other-end)
 	     (not isearch-just-started))
 	;; If repeating a search that found
 	;; an empty string, ensure we advance.
@@ -1764,7 +1765,13 @@
   (let ((cursor-in-echo-area ellipsis)
 	(m (concat
 	    (isearch-message-prefix c-q-hack ellipsis isearch-nonincremental)
-	    isearch-message
+	    (if (and (not isearch-success)
+                     (string-match " +$" isearch-message))
+                (concat
+                 (substring isearch-message 0 (match-beginning 0))
+                 (propertize (substring isearch-message (match-beginning 0))
+                             'face 'trailing-whitespace))
+              isearch-message)
 	    (isearch-message-suffix c-q-hack ellipsis)
 	    )))
     (if c-q-hack
@@ -1811,7 +1818,11 @@
 
 ;; Searching
 
-(defvar isearch-search-fun-function nil "Override `isearch-function-fun'.")
+(defvar isearch-search-fun-function nil
+  "Override `isearch-search-fun'.
+This function should return the search function for isearch to use.
+It will call this function with three arguments
+as if it were `search-forward'.")
 
 (defun isearch-search-fun ()
   "Return the function to use for the search.
--- a/lisp/makefile.w32-in	Tue Jun 15 18:46:31 2004 +0000
+++ b/lisp/makefile.w32-in	Thu Jun 24 07:44:13 2004 +0000
@@ -237,7 +237,7 @@
 	echo ;; In load-path, after this directory should come>> subdirs.el
 	echo ;; certain of its subdirectories.  Here we specify them.>> subdirs.el
 	echo (normal-top-level-add-to-load-path $(SQUOTE)(>> subdirs.el
-	@for %d in ($(WINS)) do if not (%d)==(term) echo "%d">> subdirs.el
+	@for %%d in ($(WINS)) do if not (%%d)==(term) echo "%%d">> subdirs.el
 	echo ))>> subdirs.el
 
 update-subdirs-SH: doit
@@ -282,11 +282,11 @@
 compile: subdirs.el compile-$(SHELLTYPE) doit
 
 compile-CMD:
-#	-for %f in ($(lisp) $(WINS)) do for %g in (%f\*.elc) do @attrib -r %g
-	for %f in ($(COMPILE_FIRST)) do \
-	  $(emacs) -l loaddefs -f batch-byte-compile-if-not-done %f
-	for %f in (. $(WINS)) do for %g in (%f/*.el) do \
-	  $(emacs) -l loaddefs -f batch-byte-compile-if-not-done %f/%g
+#	-for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g
+	for %%f in ($(COMPILE_FIRST)) do \
+	  $(emacs) -l loaddefs -f batch-byte-compile-if-not-done %%f
+	for %%f in (. $(WINS)) do for %%g in (%%f/*.el) do \
+	  $(emacs) -l loaddefs -f batch-byte-compile-if-not-done %%f/%%g
 
 compile-SH:
 #	for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
@@ -309,9 +309,9 @@
 compile-always: subdirs.el compile-always-$(SHELLTYPE) doit
 
 compile-always-CMD:
-#	-for %f in ($(lisp) $(WINS)) do for %g in (%f\*.elc) do @attrib -r %g
-	for %f in ($(COMPILE_FIRST)) do $(emacs) -f batch-byte-compile %f
-	for %f in (. $(WINS)) do for %g in (%f/*.el) do $(emacs) -f batch-byte-compile %f/%g
+#	-for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g
+	for %%f in ($(COMPILE_FIRST)) do $(emacs) -f batch-byte-compile %%f
+	for %%f in (. $(WINS)) do for %%g in (%%f/*.el) do $(emacs) -f batch-byte-compile %%f/%%g
 
 compile-always-SH:
 #	for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
@@ -329,7 +329,7 @@
 compile-calc: compile-calc-$(SHELLTYPE)
 
 compile-calc-CMD:
-	for %f in ($(lisp)/calc/*.el) do $(emacs) -f batch-byte-compile %f
+	for %%f in ($(lisp)/calc/*.el) do $(emacs) -f batch-byte-compile %%f
 
 compile-calc-SH:
 	for el in $(lisp)/calc/*.el; do \
@@ -374,7 +374,7 @@
 bootstrap-clean-CMD:
 #	if exist $(EMACS) $(MAKE) $(MFLAGS) autoloads
 	if not exist $(lisp)\loaddefs.el cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
-	-for %f in (. $(WINS)) do for %g in (%f\*.elc) do @$(DEL) %g
+	-for %%f in (. $(WINS)) do for %%g in (%%f\*.elc) do @$(DEL) %%g
 
 bootstrap-clean-SH:
 #	if test -f $(EMACS); then $(MAKE) $(MFLAGS) autoloads; fi
--- a/lisp/man.el	Tue Jun 15 18:46:31 2004 +0000
+++ b/lisp/man.el	Thu Jun 24 07:44:13 2004 +0000
@@ -733,7 +733,8 @@
 	(if (fboundp 'start-process)
 	    (set-process-sentinel
 	     (start-process manual-program buffer
-			    shell-file-name shell-command-switch
+			    (if (eq system-type 'cygwin) shell-file-name "sh")
+			    shell-command-switch
 			    (format (Man-build-man-command) man-args))
 	     'Man-bgproc-sentinel)
 	  (let ((exit-status
--- a/lisp/mouse.el	Tue Jun 15 18:46:31 2004 +0000
+++ b/lisp/mouse.el	Thu Jun 24 07:44:13 2004 +0000
@@ -625,7 +625,7 @@
 
 (defun mouse-set-region-1 ()
   ;; Set transient-mark-mode for a little while.
-  (setq transient-mark-mode (or transient-mark-mode 'lambda))
+  (setq transient-mark-mode (or transient-mark-mode 'only))
   (setq mouse-last-region-beg (region-beginning))
   (setq mouse-last-region-end (region-end))
   (setq mouse-last-region-tick (buffer-modified-tick)))
--- a/lisp/net/goto-addr.el	Tue Jun 15 18:46:31 2004 +0000
+++ b/lisp/net/goto-addr.el	Thu Jun 24 07:44:13 2004 +0000
@@ -168,7 +168,7 @@
 		(overlay-put this-overlay
                              'mouse-face goto-address-url-mouse-face)
 		(overlay-put this-overlay
-			     'help-echo "mouse-2: follow URL")
+			     'help-echo "mouse-2, C-c RET: follow URL")
 		(overlay-put this-overlay
                              'keymap goto-address-highlight-keymap)
 		(overlay-put this-overlay 'goto-address t)))
@@ -182,7 +182,7 @@
                 (overlay-put this-overlay 'mouse-face
                              goto-address-mail-mouse-face)
 		(overlay-put this-overlay
-			     'help-echo "mouse-2: mail this address")
+			     'help-echo "mouse-2, C-c RET: mail this address")
                 (overlay-put this-overlay
                              'keymap goto-address-highlight-keymap)
 		(overlay-put this-overlay 'goto-address t))))))))
--- a/lisp/newcomment.el	Tue Jun 15 18:46:31 2004 +0000
+++ b/lisp/newcomment.el	Thu Jun 24 07:44:13 2004 +0000
@@ -873,17 +873,17 @@
 		   (setq ,bindent (- ,bindent n)))))))))))
 
 (defun comment-region-internal (beg end cs ce
-				    &optional ccs cce block lines indent)
+                                &optional ccs cce block lines indent)
   "Comment region BEG .. END.
-CS and CE are the comment start resp end string.
-CCS and CCE are the comment continuation strings for the start resp end
-of lines (default to CS and CE).
-BLOCK indicates that end of lines should be marked with either CCE, CE or CS
-\(if CE is empty) and that those markers should be aligned.
-LINES indicates that an extra lines will be used at the beginning and end
-of the region for CE and CS.
-INDENT indicates to put CS and CCS at the current indentation of the region
-rather than at left margin."
+CS and CE are the comment start string and comment end string,
+respectively.  CCS and CCE are the comment continuation strings
+for the start and end of lines, respectively (default to CS and CE).
+BLOCK indicates that end of lines should be marked with either CCE,
+CE or CS \(if CE is empty) and that those markers should be aligned.
+LINES indicates that an extra lines will be used at the beginning
+and end of the region for CE and CS.
+INDENT indicates to put CS and CCS at the current indentation of
+the region rather than at left margin."
   ;;(assert (< beg end))
   (let ((no-empty (not (or (eq comment-empty-lines t)
 			   (and comment-empty-lines (zerop (length ce)))))))
--- a/lisp/progmodes/compile.el	Tue Jun 15 18:46:31 2004 +0000
+++ b/lisp/progmodes/compile.el	Thu Jun 24 07:44:13 2004 +0000
@@ -583,7 +583,7 @@
 	 (setq col (match-string-no-properties col))
 	 (setq col (- (string-to-number col) compilation-first-column)))
     (if (and end-col (setq end-col (match-string-no-properties end-col)))
-	(setq end-col (- (string-to-number end-col) compilation-first-column))
+	(setq end-col (- (string-to-number end-col) compilation-first-column -1))
       (if end-line (setq end-col -1)))
     (if (consp type)			; not a static type, check what it is.
 	(setq type (or (and (car type) (match-end (car type)) 1)
--- a/lisp/progmodes/grep.el	Tue Jun 15 18:46:31 2004 +0000
+++ b/lisp/progmodes/grep.el	Thu Jun 24 07:44:13 2004 +0000
@@ -146,6 +146,14 @@
   :type 'boolean
   :group 'grep)
 
+(defcustom grep-error-screen-columns nil
+  "*If non-nil, column numbers in grep hits are screen columns.
+See `compilation-error-screen-columns'"
+  :type '(choice (const :tag "Default" nil)
+		 integer)
+  :version "21.4"
+  :group 'grep)
+
 ;;;###autoload
 (defcustom grep-setup-hook nil
   "List of hook functions run by `grep-process-setup' (see `run-hooks')."
@@ -216,7 +224,9 @@
 `complation-last-buffer' rather than `grep-last-buffer'.")
 
 (defvar grep-regexp-alist
-  '(("^\\(.+?\\)[:( \t]+\\([0-9]+\\)[:) \t]" 1 2)
+  '(("^\\(.+?\\)[:( \t]+\
+\\([0-9]+\\)\\([.:]?\\)\\([0-9]+\\)?\
+\\(?:-\\(?:\\([0-9]+\\)\\3\\)?\\.?\\([0-9]+\\)?\\)?[:) \t]" 1 (2 . 5) (4 . 6))
     ("^Binary file \\(.+\\) matches$" 1 nil nil 1))
   "Regexp used to match grep hits.  See `compilation-error-regexp-alist'.")
 
--- a/lisp/ps-print.el	Tue Jun 15 18:46:31 2004 +0000
+++ b/lisp/ps-print.el	Thu Jun 24 07:44:13 2004 +0000
@@ -3737,8 +3737,8 @@
   (format-time-string "%Y-%m-%d"))
 
 
-(defalias 'ps-time-stamp-iso8601 'ps-time-stamp-yyyy-mm-dd
-  "Alias for `ps-time-stamp-yyyy-mm-dd' (which see).")
+;; Alias for `ps-time-stamp-yyyy-mm-dd' (which see).
+(defalias 'ps-time-stamp-iso8601 'ps-time-stamp-yyyy-mm-dd)
 
 
 (defun ps-time-stamp-hh:mm:ss ()
--- a/lisp/replace.el	Tue Jun 15 18:46:31 2004 +0000
+++ b/lisp/replace.el	Thu Jun 24 07:44:13 2004 +0000
@@ -1,7 +1,7 @@
 ;;; replace.el --- replace commands for Emacs
 
-;; Copyright (C) 1985, 86, 87, 92, 94, 96, 1997, 2000, 2001, 2002
-;;  Free Software Foundation, Inc.
+;; Copyright (C) 1985, 86, 87, 92, 94, 96, 1997, 2000, 2001, 2002,
+;;   2003, 2004 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 
@@ -81,14 +81,15 @@
 					 query-replace-from-history-variable
 					 nil t)))
       ;; Warn if user types \n or \t, but don't reject the input.
-      (if (string-match "\\\\[nt]" from)
-	  (let ((match (match-string 0 from)))
-	    (cond
-	     ((string= match "\\n")
-	      (message "Note: `\\n' here doesn't match a newline; to do that, type C-q C-j instead"))
-	     ((string= match "\\t")
-	      (message "Note: `\\t' here doesn't match a tab; to do that, just type TAB")))
-	    (sit-for 2))))
+      (and regexp-flag
+	   (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\(\\\\[nt]\\)" from)
+	   (let ((match (match-string 3 from)))
+	     (cond
+	      ((string= match "\\n")
+	       (message "Note: `\\n' here doesn't match a newline; to do that, type C-q C-j instead"))
+	      ((string= match "\\t")
+	       (message "Note: `\\t' here doesn't match a tab; to do that, just type TAB")))
+	     (sit-for 2))))
 
     (save-excursion
       (setq to (read-from-minibuffer (format "%s %s with: " string from)
@@ -161,20 +162,62 @@
 
 In TO-STRING, `\\&' stands for whatever matched the whole of REGEXP,
 and `\\=\\N' (where N is a digit) stands for
- whatever what matched the Nth `\\(...\\)' in REGEXP."
+whatever what matched the Nth `\\(...\\)' in REGEXP.
+
+When this function is called interactively, the replacement text
+can also contain `\\,' followed by a Lisp expression.  The escaped
+shorthands for `query-replace-regexp-eval' are also valid
+here: within the Lisp expression, you can use `\\&' for the whole
+match string, `\\N' for partial matches, `\\#&' and `\\#N' for
+the respective numeric values, and `\\#' for `replace-count'.
+
+If your Lisp expression is an identifier and the next
+letter in the replacement string would be interpreted as part of it,
+you can wrap it with an expression like `\\,(or \\#)'.  Incidentally,
+for this particular case you may also enter `\\#' in the replacement
+text directly.
+
+When you use `\\,' or `\\#' in the replacement, TO-STRING actually
+becomes a list with expanded shorthands.
+Use \\[repeat-complex-command] after this command to see details."
   (interactive
    (let ((common
 	  (query-replace-read-args "Query replace regexp" t)))
-     (list (nth 0 common) (nth 1 common) (nth 2 common)
-	   ;; These are done separately here
-	   ;; so that command-history will record these expressions
-	   ;; rather than the values they had this time.
-	   (if (and transient-mark-mode mark-active)
-	       (region-beginning))
-	   (if (and transient-mark-mode mark-active)
-	       (region-end)))))
+     (list
+      (nth 0 common)
+      (if (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\\\[,#]"
+			(nth 1 common))
+	  (let ((to-string (nth 1 common)) pos to-expr char prompt)
+	    (while (string-match
+		    "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\\\[,#]"
+		    to-string)
+	      (setq pos (match-end 0))
+	      (push (substring to-string 0 (- pos 2)) to-expr)
+	      (setq char (aref to-string (1- pos))
+		    to-string (substring to-string pos))
+	      (cond ((eq char ?\#)
+		     (push '(number-to-string replace-count) to-expr))
+		    ((eq char ?\,)
+		     (setq pos (read-from-string to-string))
+		     (push `(replace-quote ,(car pos)) to-expr)
+		     (setq to-string (substring to-string (cdr pos))))))
+	    (setq to-expr (nreverse (delete "" (cons to-string to-expr))))
+	    (replace-match-string-symbols to-expr)
+	    (cons 'replace-eval-replacement 
+		  (if (> (length to-expr) 1)
+		      (cons 'concat to-expr)
+		    (car to-expr))))
+	(nth 1 common))
+      (nth 2 common)
+      ;; These are done separately here
+      ;; so that command-history will record these expressions
+      ;; rather than the values they had this time.
+      (if (and transient-mark-mode mark-active)
+	  (region-beginning))
+      (if (and transient-mark-mode mark-active)
+	  (region-end)))))
+  (perform-replace regexp to-string t t delimited nil nil start end))
 
-  (perform-replace regexp to-string t t delimited nil nil start end))
 (define-key esc-map [?\C-%] 'query-replace-regexp)
 
 (defun query-replace-regexp-eval (regexp to-expr &optional delimited start end)
@@ -191,6 +234,7 @@
 `\\0' to stand for whatever matched the whole of REGEXP, and `\\N' (where
 N is a digit) to stand for whatever matched the Nth `\\(...\\)' in REGEXP.
 Use `\\#&' or `\\#N' if you want a number instead of a string.
+In interactive use, `\\#' in itself stands for `replace-count'.
 
 In Transient Mark mode, if the mark is active, operate on the contents
 of the region.  Otherwise, operate from point to the end of the buffer.
@@ -1012,6 +1056,7 @@
 #N    (string-to-number (match-string N))
 &     (match-string 0)
 #&    (string-to-number (match-string 0))
+#     replace-count
 
 Note that these symbols must be preceeded by a backslash in order to
 type them."
@@ -1031,7 +1076,9 @@
          ((string= "&" name)
           (setcar n '(match-string 0)))
          ((string= "#&" name)
-          (setcar n '(string-to-number (match-string 0))))))))
+          (setcar n '(string-to-number (match-string 0))))
+	 ((string= "#" name)
+	  (setcar n 'replace-count))))))
     (setq n (cdr n))))
 
 (defun replace-eval-replacement (expression replace-count)
@@ -1040,6 +1087,21 @@
         replacement
       (prin1-to-string replacement t))))
 
+(defun replace-quote (replacement)
+  "Quote a replacement string.
+This just doubles all backslashes in REPLACEMENT and
+returns the resulting string.  If REPLACEMENT is not
+a string, it is first passed through `prin1-to-string'
+with the `noescape' argument set.
+
+`match-data' is preserved across the call."
+  (save-match-data
+    (replace-regexp-in-string "\\\\" "\\\\"
+			      (if (stringp replacement)
+				  replacement
+				(prin1-to-string replacement t))
+			      t t)))
+
 (defun replace-loop-through-replacements (data replace-count)
   ;; DATA is a vector contaning the following values:
   ;;   0 next-rotate-count
--- a/lispref/ChangeLog	Tue Jun 15 18:46:31 2004 +0000
+++ b/lispref/ChangeLog	Thu Jun 24 07:44:13 2004 +0000
@@ -1,3 +1,27 @@
+2004-06-23  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* lists.texi, files.texi, processes.texi, macros.texi, hash.texi:
+	* frames.texi, buffers.texi, backups.texi, variables.texi:
+	* loading.texi, eval.texi, functions.texi, control.texi:
+	* symbols.texi, minibuf.texi: Reposition @anchor's.
+
+	* help.texi: Various small changes in addition to the following.
+	(Describing Characters): Describe PREFIX argument to
+	`key-description'.  Correct and clarify definition of
+	`text-char-description'.  Describe NEED-VECTOR argument to
+	`read-kbd-macro'.
+	(Help Functions): Clarify definition of `apropos'.
+
+2004-06-23  Lars Hansen  <larsh@math.ku.dk>
+
+	* files.texi (Saving Buffers): Correct description of
+	`write-contents-functions'.
+
+2004-06-21  Juanma Barranquero  <lektu@terra.es>
+
+	* display.texi (Images): Remove redundant @vindex directives.
+	Rewrite `image-library-alist' doc in active voice.
+
 2004-06-14  Juanma Barranquero  <lektu@terra.es>
 
 	* display.texi (Images): Document new delayed library loading,
--- a/lispref/backups.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/lispref/backups.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1999
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2004
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/backups
@@ -713,6 +713,7 @@
 buffer-local bindings for these variables:
 
 @defvar revert-buffer-function
+@anchor{Definition of revert-buffer-function}
 The value of this variable is the function to use to revert this
 buffer.  If non-@code{nil}, it should be a function with two optional
 arguments to do the work of reverting.  The two optional arguments,
--- a/lispref/buffers.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/lispref/buffers.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2004
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/buffers
@@ -227,8 +227,8 @@
 existing buffer.
 @end defmac
 
+@defmac with-temp-buffer body...
 @anchor{Definition of with-temp-buffer}
-@defmac with-temp-buffer body...
 The @code{with-temp-buffer} macro evaluates the @var{body} forms
 with a temporary buffer as the current buffer.  It saves the identity of
 the current buffer, creates a temporary buffer and makes it current,
--- a/lispref/control.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/lispref/control.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2003
 @c  Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/control
@@ -784,8 +784,8 @@
 undesirable results.  Instead, use @code{(error "%s" @var{string})}.
 @end defun
 
+@defun signal error-symbol data
 @anchor{Definition of signal}
-@defun signal error-symbol data
 This function signals an error named by @var{error-symbol}.  The
 argument @var{data} is a list of additional Lisp objects relevant to the
 circumstances of the error.
--- a/lispref/display.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/lispref/display.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -2892,7 +2892,6 @@
 @code{pbm}, @code{jpeg}, @code{tiff}, and @code{png}.
 
 @defvar image-types
-@vindex image-types
 This variable contains a list of those image type symbols that are
 potentially supported in the current configuration.
 @emph{Potentially} here means that Emacs knows about the image types,
@@ -2904,7 +2903,6 @@
 @end defvar
 
 @defvar image-library-alist
-@vindex image-library-alist
 This in an alist of image types vs external libraries needed to
 display them.
 
@@ -2913,9 +2911,9 @@
 the rest are strings giving alternate filenames for the corresponding
 external libraries to load.
 
-They are tried in the order they appear on the list; if none of them
-can be loaded, the running session of Emacs won't support the image
-type.  No entries are needed for @code{pbm} and @code{xbm} images;
+Emacs tries to load the libraries in the order they appear on the
+list; if none is loaded, the running session of Emacs won't support
+the image type.  @code{pbm} and @code{xbm} don't need to be listed;
 they're always supported.
 
 This variable is ignored if the image libraries are statically linked
@@ -2925,9 +2923,9 @@
 @defun  image-type-available-p type
 @findex image-type-available-p
 
-This function returns non-nil if image type TYPE is available, i.e.,
-if images of this type can be loaded and displayed in Emacs.  TYPE
-should be one of the types contained in @code{image-types}.
+This function returns non-nil if image type @var{TYPE} is available,
+i.e., if images of this type can be loaded and displayed in Emacs.
+@var{TYPE} should be one of the types contained in @code{image-types}.
 
 For image types whose support libraries are statically linked, this
 function always returns @code{t}; for other image types, it returns
--- a/lispref/eval.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/lispref/eval.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1998 Free Software Foundation, Inc.
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1998, 2003, 2004 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/eval
 @node Evaluation, Control Structures, Symbols, Top
@@ -313,8 +313,8 @@
 perform symbol function indirection explicitly.
 
 @c Emacs 19 feature
+@defun indirect-function function
 @anchor{Definition of indirect-function}
-@defun indirect-function function
 This function returns the meaning of @var{function} as a function.  If
 @var{function} is a symbol, then it finds @var{function}'s function
 definition and starts over with that value.  If @var{function} is not a
@@ -630,8 +630,8 @@
 @code{max-lisp-eval-depth} (see below).
 @end defun
 
+@deffn Command eval-region start end &optional stream read-function
 @anchor{Definition of eval-region}
-@deffn Command eval-region start end &optional stream read-function
 This function evaluates the forms in the current buffer in the region
 defined by the positions @var{start} and @var{end}.  It reads forms from
 the region and calls @code{eval} on them until the end of the region is
@@ -674,8 +674,8 @@
 @code{eval-current-buffer} is an alias for this command.
 @end deffn
 
+@defvar max-lisp-eval-depth
 @anchor{Definition of max-lisp-eval-depth}
-@defvar max-lisp-eval-depth
 This variable defines the maximum depth allowed in calls to @code{eval},
 @code{apply}, and @code{funcall} before an error is signaled (with error
 message @code{"Lisp nesting exceeds max-lisp-eval-depth"}).
--- a/lispref/files.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/lispref/files.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -329,8 +329,8 @@
 @end itemize
 @end deffn
 
+@deffn Command save-some-buffers &optional save-silently-p pred
 @anchor{Definition of save-some-buffers}
-@deffn Command save-some-buffers &optional save-silently-p pred
 This command saves some modified file-visiting buffers.  Normally it
 asks the user about each buffer.  But if @var{save-silently-p} is
 non-@code{nil}, it saves all the file-visiting buffers without querying
@@ -352,8 +352,8 @@
 value in a certain buffer, that means do offer to save that buffer.
 @end deffn
 
+@deffn Command write-file filename &optional confirm
 @anchor{Definition of write-file}
-@deffn Command write-file filename &optional confirm
 This function writes the current buffer into file @var{filename}, makes
 the buffer visit that file, and marks it not modified.  Then it renames
 the buffer based on @var{filename}, appending a string like @samp{<2>}
@@ -416,11 +416,12 @@
 @c Emacs 19 feature
 @defvar write-contents-functions
 This works just like @code{write-file-functions}, but it is intended for
-hooks that pertain to the contents of the file, as opposed to hooks that
-pertain to where the file came from.  Such hooks are usually set up by
+hooks that pertain to the contents of the buffer, as opposed to hooks that
+pertain to the file the buffers visits.  Such hooks are usually set up by
 major modes, as buffer-local bindings for this variable.  If any of the
-functions in this hook returns non-@code{nil}, @code{write-file-functions}
-is not run.
+functions in this hook returns non-@code{nil}, the file is considered
+already written and the rest are not called and neither are the functions
+in @code{write-file-functions}.
 
 This variable automatically becomes buffer-local whenever it is set;
 switching to a new major mode always resets this variable, but
@@ -625,8 +626,8 @@
 files that the user does not need to know about.
 @end deffn
 
+@defmac with-temp-file file body...
 @anchor{Definition of with-temp-file}
-@defmac with-temp-file file body...
 The @code{with-temp-file} macro evaluates the @var{body} forms with a
 temporary buffer as the current buffer; then, at the end, it writes the
 buffer contents into file @var{file}.  It kills the temporary buffer
@@ -1124,8 +1125,8 @@
 @end example
 @end defun
 
+@defun file-attributes filename &optional id-format
 @anchor{Definition of file-attributes}
-@defun file-attributes filename &optional id-format
 This function returns a list of attributes of file @var{filename}.  If
 the specified file cannot be opened, it returns @code{nil}.
 The optional parameter @var{id-format} specifies the preferred format
@@ -1823,8 +1824,8 @@
   To convert a directory name to its abbreviation, use this
 function:
 
+@defun abbreviate-file-name filename
 @anchor{Definition of abbreviate-file-name}
-@defun abbreviate-file-name filename
 This function applies abbreviations from @code{directory-abbrev-alist}
 to its argument, and substitutes @samp{~} for the user's home
 directory.  You can use it for directory names and for file names,
@@ -1951,8 +1952,8 @@
 @end example
 @end defvar
 
+@defun substitute-in-file-name filename
 @anchor{Definition of substitute-in-file-name}
-@defun substitute-in-file-name filename
 This function replaces environment variable references in
 @var{filename} with the environment variable values.  Following
 standard Unix shell syntax, @samp{$} is the prefix to substitute an
--- a/lispref/frames.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/lispref/frames.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -1503,8 +1503,8 @@
 If omitted @var{n} defaults to 0.
 @end defun
 
+@defun x-set-cut-buffer string &optional push
 @anchor{Definition of x-set-cut-buffer}
-@defun x-set-cut-buffer string &optional push
 This function stores @var{string} into the first cut buffer (cut buffer
 0).  If @var{push} is @code{nil}, only the first cut buffer is changed.
 If @var{push} is non-@code{nil}, that says to move the values down
@@ -1793,8 +1793,8 @@
 (All color displays can do this.)
 @end defun
 
+@defun display-supports-face-attributes-p attributes &optional display
 @anchor{Display Face Attribute Testing}
-@defun display-supports-face-attributes-p attributes &optional display
 @tindex display-supports-face-attributes-p
 This function returns non-@code{nil} if all the face attributes in
 @var{attributes} are supported (@pxref{Face Attributes}).
--- a/lispref/functions.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/lispref/functions.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2004
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/functions
@@ -577,8 +577,8 @@
 deliberate redefinition from unintentional redefinition.
 @end defspec
 
+@defun defalias name definition &optional docstring
 @anchor{Definition of defalias}
-@defun defalias name definition &optional docstring
 This special form defines the symbol @var{name} as a function, with
 definition @var{definition} (which can be any valid Lisp function).
 It returns @var{definition}.
@@ -752,8 +752,8 @@
 over a char-table in a way that deals properly with its sparse nature,
 use the function @code{map-char-table} (@pxref{Char-Tables}).
 
+@defun mapcar function sequence
 @anchor{Definition of mapcar}
-@defun mapcar function sequence
 @code{mapcar} applies @var{function} to each element of @var{sequence}
 in turn, and returns a list of the results.
 
--- a/lispref/hash.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/lispref/hash.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -205,8 +205,8 @@
 @end defun
 
 @tindex maphash
+@defun maphash function table
 @anchor{Definition of maphash}
-@defun maphash function table
 This function calls @var{function} once for each of the associations in
 @var{table}.  The function @var{function} should accept two
 arguments---a @var{key} listed in @var{table}, and its associated
--- a/lispref/help.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/lispref/help.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2004
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/help
@@ -59,7 +59,7 @@
 stand for key bindings to be looked up in the current keymaps when the
 documentation is displayed.  This allows documentation strings to refer
 to the keys for related commands and be accurate even when a user
-rearranges the key bindings.  (@xref{Accessing Documentation}.)
+rearranges the key bindings.  (@xref{Keys in Documentation}.)
 
   In Emacs Lisp, a documentation string is accessible through the
 function or variable that it describes:
@@ -260,8 +260,8 @@
 user option; see the description of @code{defvar} in @ref{Defining
 Variables}.
 
+@defun Snarf-documentation filename
 @anchor{Definition of Snarf-documentation}
-@defun Snarf-documentation filename
 This function is used only during Emacs initialization, just before
 the runnable Emacs is dumped.  It finds the file offsets of the
 documentation strings stored in the file @var{filename}, and records
@@ -282,8 +282,7 @@
 
 In most cases, this is the same as @code{data-directory}.  They may be
 different when you run Emacs from the directory where you built it,
-without actually installing it.  See @code{data-directory} in @ref{Help
-Functions}.
+without actually installing it.  @xref{Definition of data-directory}.
 
 In older Emacs versions, @code{exec-directory} was used for this.
 @end defvar
@@ -375,13 +374,27 @@
 characters.  The description of a non-whitespace printing character is
 the character itself.
 
-@defun key-description sequence
+@defun key-description sequence &optional prefix
 @cindex Emacs event standard notation
 This function returns a string containing the Emacs standard notation
-for the input events in @var{sequence}.  The argument @var{sequence} may
-be a string, vector or list.  @xref{Input Events}, for more information
-about valid events.  See also the examples for
-@code{single-key-description}, below.
+for the input events in @var{sequence}.  If @var{prefix} is
+non-@code{nil}, it is a sequence of input events leading up to
+@var{sequence} and is included in the return value.  Both arguments
+may be strings, vectors or lists.  @xref{Input Events}, for more
+information about valid events.
+
+@smallexample
+@group
+(key-description [?\M-3 delete])
+     @result{} "M-3 <delete>"
+@end group
+@group
+(key-description [delete] "\M-3")
+     @result{} "M-3 <delete>"
+@end group
+@end smallexample
+
+  See also the examples for @code{single-key-description}, below.
 @end defun
 
 @defun single-key-description event &optional no-angles
@@ -432,8 +445,10 @@
 standard Emacs notation for characters that appear in text---like
 @code{single-key-description}, except that control characters are
 represented with a leading caret (which is how control characters in
-Emacs buffers are usually displayed) and character codes 128
-and above are not treated as Meta characters.
+Emacs buffers are usually displayed).  Another difference is that
+@code{text-char-description} recognizes the 2**7 bit as the Meta
+character, whereas @code{single-key-description} uses the 2**27 bit
+for Meta.
 
 @smallexample
 @group
@@ -448,16 +463,25 @@
 (text-char-description ?\C-\M-m)
      @result{} "\x8d"
 @end group
+@group
+(text-char-description (+ 128 ?m))
+     @result{} "M-m"
+@end group
+@group
+(text-char-description (+ 128 ?\C-m))
+     @result{} "M-^M"
+@end group
 @end smallexample
 @end defun
 
-@defun read-kbd-macro string
+@defun read-kbd-macro string &optional need-vector
 This function is used mainly for operating on keyboard macros, but it
 can also be used as a rough inverse for @code{key-description}.  You
 call it with a string containing key descriptions, separated by spaces;
 it returns a string or vector containing the corresponding events.
 (This may or may not be a single valid key sequence, depending on what
-events you use; @pxref{Keymap Terminology}.)
+events you use; @pxref{Keymap Terminology}.)  If @var{need-vector} is
+non-@code{nil}, the return value is always a vector.
 @end defun
 
 @node Help Functions
@@ -469,29 +493,20 @@
 we describe some program-level interfaces to the same information.
 
 @deffn Command apropos regexp &optional do-all
-This function finds all symbols whose names contain a match for the
-regular expression @var{regexp}, and returns a list of them
-(@pxref{Regular Expressions}).  It also displays the symbols in a buffer
-named @samp{*Help*}, each with a one-line description taken from the
-beginning of its documentation string.
+This function finds all ``meaningful'' symbols whose names contain a
+match for the regular expression @var{regexp}, and returns a list of
+them, with associated documentation (@pxref{Regular Expressions}).  It
+also displays the symbols in a buffer named @samp{*Apropos*}, each
+with a one-line description taken from the beginning of its
+documentation string.  A symbol is ``meaningful'' if it has a
+definition as a function, variable, or face, or has properties.
 
 @c Emacs 19 feature
-If @var{do-all} is non-@code{nil}, then @code{apropos} also shows key
-bindings for the functions that are found; it also shows all symbols,
-even those that are neither functions nor variables.
-
-In the first of the following examples, @code{apropos} finds all the
-symbols with names containing @samp{exec}.  (We don't show here the
-output that results in the @samp{*Help*} buffer.)
-
-@smallexample
-@group
-(apropos "exec")
-     @result{} (Buffer-menu-execute command-execute exec-directory
-    exec-path execute-extended-command execute-kbd-macro
-    executing-kbd-macro executing-macro)
-@end group
-@end smallexample
+If @var{do-all} is non-@code{nil}, or if the user option
+@code{apropos-do-all} is non-@code{nil}, then @code{apropos} also
+shows key bindings for the functions that are found; it also shows
+@emph{all} interned symbols, not just meaningful ones (and it lists
+them in the return value as well).
 @end deffn
 
 @defvar help-map
@@ -506,7 +521,7 @@
 
 @smallexample
 @group
-(define-key global-map "\C-h" 'help-command)
+(define-key global-map (char-to-string help-char) 'help-command)
 (fset 'help-command help-map)
 @end group
 @end smallexample
@@ -562,7 +577,7 @@
 string that explains what the input is for and how to enter it properly.
 
 Entry to the minibuffer binds this variable to the value of
-@code{minibuffer-help-form} (@pxref{Minibuffer Misc}).
+@code{minibuffer-help-form} (@pxref{Definition of minibuffer-help-form}).
 @end defvar
 
 @defvar prefix-help-command
@@ -601,6 +616,7 @@
 
 @c Emacs 19 feature
 @defvar data-directory
+@anchor{Definition of data-directory}
 This variable holds the name of the directory in which Emacs finds
 certain documentation and text files that come with Emacs.  In older
 Emacs versions, @code{exec-directory} was used for this.
--- a/lispref/lists.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/lispref/lists.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -1,6 +1,7 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999,
+@c 2003, 2004
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/lists
@@ -348,8 +349,8 @@
 @end example
 @end defmac
 
+@defun nth n list
 @anchor{Definition of nth}
-@defun nth n list
 This function returns the @var{n}th element of @var{list}.  Elements
 are numbered starting with zero, so the @sc{car} of @var{list} is
 element number zero.  If the length of @var{list} is @var{n} or less,
@@ -413,8 +414,8 @@
 if @var{n} is bigger than @var{list}'s length.
 @end defun
 
+@defun safe-length list
 @anchor{Definition of safe-length}
-@defun safe-length list
 This function returns the length of @var{list}, with no risk of either
 an error or an infinite loop.  It generally returns the number of
 distinct cons cells in the list.  However, for circular lists,
--- a/lispref/loading.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/lispref/loading.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -1,6 +1,7 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999,
+@c 2003, 2004
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/loading
@@ -140,8 +141,8 @@
 file, and it is @code{nil} otherwise.
 @end defvar
 
+@defvar load-read-function
 @anchor{Definition of load-read-function}
-@defvar load-read-function
 This variable specifies an alternate expression-reading function for
 @code{load} and @code{eval-region} to use instead of @code{read}.
 The function should accept one argument, just as @code{read} does.
--- a/lispref/macros.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/lispref/macros.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -232,8 +232,8 @@
 which can specify how @key{TAB} should indent macro calls, and how to
 step through them for Edebug.
 
+@defmac declare @var{specs}@dots{}
 @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:
--- a/lispref/minibuf.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/lispref/minibuf.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -1,6 +1,7 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999,
+@c 2001, 2004
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/minibuf
@@ -214,8 +215,8 @@
 properties unconditionally, regardless of the value of this variable.
 @end defvar
 
+@defvar minibuffer-local-map
 @anchor{Definition of minibuffer-local-map}
-@defvar minibuffer-local-map
 This is the default local keymap for reading from the minibuffer.  By
 default, it makes the following bindings:
 
@@ -531,7 +532,7 @@
 
 Use of a cons cell as the value for @var{initial} arguments is
 deprecated in user code.
- 
+
 @node Completion
 @section Completion
 @cindex completion
@@ -726,8 +727,8 @@
 @end smallexample
 @end defun
 
+@defun test-completion string collection &optional predicate
 @anchor{Definition of test-completion}
-@defun test-completion string collection &optional predicate
 This function returns non-@code{nil} if @var{string} is a valid
 completion possibility specified by @var{collection} and
 @var{predicate}.  The arguments are the same as in
@@ -1755,6 +1756,7 @@
 @end defvar
 
 @defvar minibuffer-help-form
+@anchor{Definition of minibuffer-help-form}
 The current value of this variable is used to rebind @code{help-form}
 locally inside the minibuffer (@pxref{Help Functions}).
 @end defvar
--- a/lispref/processes.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/lispref/processes.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -676,8 +676,8 @@
 @ref{Asynchronous Processes}).
 @end defun
 
+@defun process-coding-system process
 @anchor{Coding systems for a subprocess}
-@defun process-coding-system process
 This function returns a cons cell describing the coding systems in use
 for decoding output from @var{process} and for encoding input to
 @var{process} (@pxref{Coding Systems}).  The value has this form:
--- a/lispref/symbols.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/lispref/symbols.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2003
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/symbols
@@ -360,8 +360,8 @@
 @code{read}.
 @end defvar
 
+@defun mapatoms function &optional obarray
 @anchor{Definition of mapatoms}
-@defun mapatoms function &optional obarray
 This function calls @var{function} once with each symbol in the obarray
 @var{obarray}.  Then it returns @code{nil}.  If @var{obarray} is
 omitted, it defaults to the value of @code{obarray}, the standard
--- a/lispref/variables.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/lispref/variables.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -1,6 +1,7 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999,
+@c 2000, 2003, 2004
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/variables
@@ -260,8 +261,8 @@
 they are localized depending on ``where'' you are in Emacs, rather than
 localized in time.
 
+@defvar max-specpdl-size
 @anchor{Definition of max-specpdl-size}
-@defvar max-specpdl-size
 @cindex variable limit error
 @cindex evaluation error
 @cindex infinite recursion
--- a/make-dist	Tue Jun 15 18:46:31 2004 +0000
+++ b/make-dist	Thu Jun 24 07:44:13 2004 +0000
@@ -406,6 +406,7 @@
  ln MISC-DIC/*.* ../${tempdir}/leim/MISC-DIC
  ln ja-dic/*.el ja-dic/*.elc ../${tempdir}/leim/ja-dic
  ln Makefile.in ../${tempdir}/leim/Makefile.in
+ ln leim-ext.el ../${tempdir}/leim/leim-ext.el
  ln quail/[a-z]*.el quail/[a-z]*.elc ../${tempdir}/leim/quail
  rm -f ../${tempdir}/leim/quail/quick-b5.*
  rm -f ../${tempdir}/leim/quail/quick-cns.*
--- a/man/ChangeLog	Tue Jun 15 18:46:31 2004 +0000
+++ b/man/ChangeLog	Thu Jun 24 07:44:13 2004 +0000
@@ -1,3 +1,36 @@
+2004-06-21  Nick Roberts  <nickrob@gnu.org>
+
+	* misc.texi (Shell History Copying): Document comint-insert-input.
+	(Shell Ring): Describe comint-dynamic-list-input-ring here.
+
+2004-06-21  Karl Berry  <karl@gnu.org>
+
+	* info.texi (Top): mention that only Emacs has mouse support.
+	(Getting Started): mention this in a few other places.
+
+2004-06-20  Jesper Harder  <harder@ifa.au.dk>
+
+	* msdog.texi (Text and Binary, MS-DOS Printing): Use m-dash.
+	* custom.texi (Customization): do.
+	* anti.texi (Antinews): do.
+	* abbrevs.texi (Defining Abbrevs): do.
+
+	* programs.texi (Info Lookup): Fix keybinding for
+	info-lookup-symbol.
+
+2004-06-16  Juanma Barranquero  <lektu@terra.es>
+
+	* makefile.w32-in (INFO_TARGETS, DVI_TARGETS, EMACSSOURCES):
+	Add emacs-xtra.
+	($(infodir)/emacs-xtra, emacs-xtra.dvi): New dependencies.
+	(clean): Add emacs-xtra and flymake.  Remove redundancies.
+
+2004-06-15  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* Makefile.in (INFO_TARGETS, DVI_TARGETS, ../info/emacs-xtra):
+	Add emacs-xtra.
+	* emacs-xtra.texi: New file.
+
 2004-06-14  Luc Teirlinck  <teirllm@auburn.edu>
 
 	* dired.texi (Dired Enter): Mention conditions on `ls' switches.
--- a/man/Makefile.in	Tue Jun 15 18:46:31 2004 +0000
+++ b/man/Makefile.in	Thu Jun 24 07:44:13 2004 +0000
@@ -33,7 +33,7 @@
 
 # The makeinfo program is part of the Texinfo distribution.
 MAKEINFO = makeinfo
-INFO_TARGETS = ../info/emacs ../info/ccmode ../info/cl \
+INFO_TARGETS = ../info/emacs ../info/emacs-xtra ../info/ccmode ../info/cl \
 	        ../info/dired-x ../info/ediff ../info/forms ../info/gnus \
 		../info/info ../info/message ../info/mh-e ../info/reftex \
 		../info/sc ../info/vip ../info/viper ../info/widget \
@@ -47,7 +47,8 @@
 		 reftex.dvi sc.dvi vip.dvi viper.dvi widget.dvi faq.dvi \
 		 ada-mode.dvi autotype.dvi idlwave.dvi eudc.dvi ebrowse.dvi \
 		 pcl-cvs.dvi woman.dvi emacs-mime.dvi eshell.dvi \
-		 speedbar.dvi tramp.dvi ses.dvi smtpmail.dvi flymake.dvi
+		 speedbar.dvi tramp.dvi ses.dvi smtpmail.dvi flymake.dvi \
+                 emacs-xtra.dvi
 INFOSOURCES = info.texi
 
 # The following rule does not work with all versions of `make'.
@@ -174,6 +175,11 @@
 ediff.dvi: ediff.texi
 	$(ENVADD) $(TEXI2DVI) ${srcdir}/ediff.texi
 
+../info/emacs-xtra: emacs-xtra.texi
+	cd $(srcdir); $(MAKEINFO) emacs-xtra.texi
+emacs-xtra.dvi: emacs-xtra.texi
+	$(ENVADD) $(TEXI2DVI) ${srcdir}/emacs-xtra.texi
+
 ../info/forms: forms.texi
 	cd $(srcdir); $(MAKEINFO) forms.texi
 forms.dvi: forms.texi
--- a/man/abbrevs.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/man/abbrevs.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -129,7 +129,7 @@
 @findex define-global-abbrev
   You can define an abbrev without inserting either the abbrev or its
 expansion in the buffer using the command @code{define-global-abbrev}.
-It reads two arguments--the abbrev, and its expansion.  The command
+It reads two arguments---the abbrev, and its expansion.  The command
 @code{define-mode-abbrev} does likewise for a mode-specific abbrev.
 
   To change the definition of an abbrev, just define a new definition.
--- a/man/anti.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/man/anti.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -108,7 +108,7 @@
 SGML mode does not handle XML syntax, and does not have indentation support.
 
 @item
-The @kbd{C-h} subcommands have been rearranged--especially those that
+The @kbd{C-h} subcommands have been rearranged---especially those that
 display specific files.  Type @kbd{C-h C-h} to see a list of these
 commands; that will show you what is different.
 
--- a/man/custom.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/man/custom.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -12,7 +12,7 @@
 for information on using X resources to customize Emacs.
 
   Customization that you do within Emacs normally affects only the
-particular Emacs session that you do it in--it does not persist
+particular Emacs session that you do it in---it does not persist
 between sessions unless you save the customization in a file such as
 @file{.emacs} or @file{.Xdefaults} that will affect future sessions.
 @xref{Init File}.  In the customization buffer, when you save
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/man/emacs-xtra.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -0,0 +1,313 @@
+\input texinfo    @c -*-texinfo-*-
+@comment %**start of header
+@setfilename ../info/emacs-xtra
+@settitle Specialized Emacs Features
+@syncodeindex fn cp
+@syncodeindex vr cp
+@syncodeindex ky cp
+@comment %**end of header
+
+@copying
+This manual describes specialized features of Emacs.
+
+Copyright (C) 2004
+Free Software Foundation, Inc.
+
+@quotation
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.1 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, with the Front-Cover texts being ``A GNU
+Manual'', and with the Back-Cover Texts as in (a) below.  A copy of the
+license is included in the section entitled ``GNU Free Documentation
+License'' in the Emacs manual.
+
+(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
+this GNU Manual, like GNU software.  Copies published by the Free
+Software Foundation raise funds for GNU development.''
+
+This document is part of a collection distributed under the GNU Free
+Documentation License.  If you want to distribute this document
+separately from the collection, you can do so by adding a copy of the
+license to the document, as described in section 6 of the license.
+@end quotation
+@end copying
+
+@dircategory Emacs
+@direntry
+* Emacs-Xtra: (emacs-xtra).    Specialized Emacs features.
+@end direntry
+
+@titlepage
+@title Specialized Emacs Features
+@page
+@vskip 0pt plus 1filll
+@insertcopying
+@end titlepage
+
+@contents
+
+@ifnottex
+@node Top
+@top Specialized Emacs Features
+
+@insertcopying
+
+@end ifnottex
+
+@menu
+* Introduction::                  What documentation belongs here?
+* Autorevert::                    Auto Reverting non-file buffers.
+* Subdir switches::               Subdirectory switches in Dired.
+* Index::
+@end menu
+
+@node Introduction
+@unnumbered Introduction
+
+This manual contains detailed information about various features that
+are too specialized to be included in the Emacs manual.  It is
+intended to be readable by anyone having a basic knowledge of Emacs.
+However, certain sections may be intended for a more specialized
+audience, such as Elisp authors.  This should be clearly pointed out
+at the beginning of these sections.
+
+This manual is intended as a complement, rather than an alternative,
+to other ways to gain a more detailed knowledge of Emacs than the
+Emacs manual can provide, such as browsing packages using @kbd{C-h p},
+accessing mode documentation using @kbd{C-h m} and browsing user
+options using Custom.  Also, certain packages, or collections of
+related features, have their own manuals.  The present manual is
+mainly intended to be a collection of smaller specialized features,
+too small to get their own manual.
+
+Sections intended specifically for Elisp programmers can follow the
+style of the Elisp manual.  Other sections should follow the style of
+the Emacs manual.
+
+@node Autorevert
+@chapter Auto Reverting non-file Buffers
+
+Normally Global Auto Revert Mode only reverts file buffers.  There are
+two ways to auto-revert certain non-file buffers: enabling Auto Revert
+Mode in those buffers (using @kbd{M-x auto-revert-mode}) and setting
+@code{global-auto-revert-non-file-buffers} to @code{t}.  The latter
+enables Auto Reverting for all types of buffers for which it is
+implemented, that is, for the types of buffers listed in the menu
+below.
+
+Like file buffers, non-file buffers should normally not revert while
+you are working on them, or while they contain information that might
+get lost after reverting.  Therefore, they do not revert if they are
+``modified''.  This can get tricky, because deciding when a non-file
+buffer should be marked modified is usually more difficult than for
+file buffers.
+
+Another tricky detail is that, for efficiency reasons, Auto Revert
+often does not try to detect all possible changes in the buffer, only
+changes that are ``major'' or easy to detect.  Hence, enabling
+auto-reverting for a non-file buffer does not always guarantee that
+all information in the buffer is up to date and does not necessarily
+make manual reverts useless.
+
+At the other extreme, certain buffers automatically auto-revert every
+@code{auto-revert-interval} seconds.  (This currently only applies to
+the Buffer Menu.)  In this case, Auto Revert does not print any
+messages while reverting, even when @code{auto-revert-verbose} is
+non-@code{nil}.
+
+The details depend on the particular types of buffers and are
+explained in the corresponding sections.
+
+@menu
+* Auto Reverting the Buffer Menu::
+* Auto Reverting Dired::
+* Supporting additional buffers::
+@end menu
+
+@node Auto Reverting the Buffer Menu
+@section Auto Reverting the Buffer Menu
+
+If auto-reverting of non-file buffers is enabled, the Buffer Menu
+automatically reverts every @code{auto-revert-interval} seconds,
+whether there is a need for it or not.  (It would probably take longer
+to check whether there is a need than to actually revert.)
+
+If the Buffer Menu inappropriately gets marked modified, just revert
+it manually using @kbd{g} and auto-reverting will resume.  However, if
+you marked certain buffers to get deleted or to be displayed, you have
+to be careful, because reverting erases all marks.  The fact that
+adding marks sets the buffer's modified flag prevents Auto Revert from
+automatically erasing the marks.
+
+@node Auto Reverting Dired
+@section Auto Reverting Dired buffers
+
+Auto-reverting Dired buffers currently works on GNU or Unix style
+operating systems.  It may not work satisfactorily on some other
+systems.
+
+Dired buffers only auto-revert when the file list of the buffer's main
+directory changes.  They do not auto-revert when information about a
+particular file changes or when inserted subdirectories change.  To be
+sure that @emph{all} listed information is up to date, you have to
+manually revert using @kbd{g}, @emph{even} if auto-reverting is
+enabled in the Dired buffer.  Sometimes, you might get the impression
+that modifying or saving files listed in the main directory actually
+does cause auto-reverting.  This is because making changes to a file,
+or saving it, very often causes changes in the directory itself, for
+instance, through backup files or auto-save files.  However, this is
+not guaranteed.
+
+If the Dired buffer is marked modified and there are no changes you
+want to protect, then most of the time you can make auto-reverting
+resume by manually reverting the buffer using @kbd{g}.  There is one
+exception.  If you flag or mark files, you can safely revert the
+buffer.  This will not erase the flags or marks (unless the marked
+file has been deleted, of course).  However, the buffer will stay
+modified, even after reverting, and auto-reverting will not resume.
+This is because, if you flag or mark files, you may be working on the
+buffer and you might not want the buffer to change without warning.
+If you want auto-reverting to resume in the presence of marks and
+flags, mark the buffer non-modified using @kbd{M-~}.  However, adding,
+deleting or changing marks or flags will mark it modified again.
+
+Remote Dired buffers are not auto-reverted.  Neither are Dired buffers
+for which you used shell wildcards or file arguments to list only some
+of the files.  @samp{*Find*} and @samp{*Locate*} buffers do not
+auto-revert either.
+
+@node Supporting additional buffers
+@section Adding Support for Auto-Reverting additional Buffers.
+
+This section is intended for Elisp programmers who would like to add
+support for auto-reverting new types of buffers.
+
+To support auto-reverting the buffer must first of all have a
+@code{revert-buffer-function}.  @xref{Definition of
+revert-buffer-function,, Reverting, elisp, the Emacs Lisp Reference Manual}.
+
+In addition, it @emph{must} have a @code{buffer-stale-function}.
+
+@defvar buffer-stale-function
+The value of this variable is a function to check whether a non-file
+buffer needs reverting.  This should be a function with one optional
+argument @var{noconfirm}.  The function should return non-@code{nil}
+if the buffer should be reverted.  The buffer is current when this
+function is called.
+
+While this function is mainly intended for use in auto-reverting, it
+could be used for other purposes as well.  For instance, if
+auto-reverting is not enabled, it could be used to warn the user that
+the buffer needs reverting.  The idea behind the @var{noconfirm}
+argument is that it should be @code{t} if the buffer is going to be
+reverted without asking the user and @code{nil} if the function is
+just going to be used to warn the user that the buffer is out of date.
+In particular, for use in auto-reverting, @var{noconfirm} is @code{t}.
+If the function is only going to be used for auto-reverting, you can
+ignore the @var{noconfirm} argument.
+
+If you just want to automatically auto-revert every
+@code{auto-revert-interval} seconds, use:
+
+@example
+(set (make-local-variable 'buffer-stale-function)
+     #'(lambda (&optional noconfirm) 'fast))
+@end example
+
+@noindent
+in the buffer's mode function.
+
+The special return value @samp{fast} tells the caller that the need
+for reverting was not checked, but that reverting the buffer is fast.
+It also tells Auto Revert not to print any revert messages, even if
+@code{auto-revert-verbose} is non-@code{nil}.  This is important, as
+getting revert messages every @code{auto-revert-interval} seconds can
+be very annoying.  The information provided by this return value could
+also be useful if the function is consulted for purposes other than
+auto-reverting.
+@end defvar
+
+Once the buffer has a @code{revert-buffer-function} and a
+@code{buffer-stale-function}, several problems usually remain.
+
+The buffer will only auto-revert if it is marked unmodified.  Hence,
+you will have to make sure that various functions mark the buffer
+modified if and only if either the buffer contains information that
+might be lost by reverting or there is reason to believe that the user
+might be inconvenienced by auto-reverting, because he is actively
+working on the buffer.  The user can always override this by manually
+adjusting the modified status of the buffer.  To support this, calling
+the @code{revert-buffer-function} on a buffer that is marked
+unmodified should always keep the buffer marked unmodified.
+
+It is important to assure that point does not continuously jump around
+as a consequence of auto-reverting.  Of course, moving point might be
+inevitable if the buffer radically changes.
+
+You should make sure that the @code{revert-buffer-function} does not
+print messages that unnecessarily duplicate Auto Revert's own messages
+if @code{auto-revert-verbose} is @code{t} and effectively override a
+@code{nil} value for @code{auto-revert-verbose}.  Hence, adapting a
+mode for auto-reverting often involves getting rid of such messages.
+This is especially important for buffers that automatically
+auto-revert every @code{auto-revert-interval} seconds.
+
+Also, you may want to update the documentation string of
+@code{global-auto-revert-non-file-buffers}.
+
+@ifinfo
+Finally, you should add a node to this chapter's menu.  This node
+@end ifinfo
+@ifnotinfo
+Finally, you should add a section to this chapter.  This section
+@end ifnotinfo
+should at the very least make clear whether enabling auto-reverting
+for the buffer reliably assures that all information in the buffer is
+completely up to date (or will be after @code{auto-revert-interval}
+seconds).
+
+@node Subdir switches
+@chapter Subdirectory Switches in Dired
+
+You can insert subdirectories with specified @code{ls} switches in
+Dired buffers, using @kbd{C-u i}.  You can change the @code{ls}
+switches of an already inserted subdirectory using @kbd{C-u l}.
+
+In Emacs versions 21.4 and later, Dired remembers the switches, so
+that reverting the buffer will not change them back to the main
+directory's switches.  Deleting a subdirectory forgets about its
+switches.
+
+Using @code{dired-undo} (usually bound to @kbd{C-_} and @kbd{C-x u})
+to reinsert or delete subdirectories, that were inserted with explicit
+switches, can bypass Dired's machinery for remembering (or forgetting)
+switches.  Deleting a subdirectory using @code{dired-undo} does not
+forget its switches.  When later reinserted using @kbd{i}, it will be
+reinserted using its old switches.  Using @code{dired-undo} to
+reinsert a subdirectory that was deleted using the regular
+Dired commands (not @code{dired-undo}) will originally insert it with
+its old switches.  However, reverting the buffer will relist it using
+the buffer's default switches.  If any of this yields problems, you
+can easily correct the situation using @kbd{C-u i} or @kbd{C-u l}.
+
+The buffer's default switches do not affect subdirectories that were
+inserted using explicitly specified switches.  In particular,
+commands such as @kbd{s}, that change the buffer's switches do not
+affect such subdirectories.  (They do affect subdirectories without
+explicitly assigned switches, however.)
+
+You can make Dired forget about all subdirectory switches and relist
+all subdirectories with the buffer's default switches using
+@kbd{M-x dired-reset-subdir-switches}.  This also reverts the Dired buffer.
+
+@node Index
+@unnumbered Index
+
+@printindex cp
+
+@bye
+
+@ignore
+   arch-tag: 75c33f13-32c6-41b6-9537-847a312e2e49
+@end ignore
--- a/man/info.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/man/info.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -62,6 +62,11 @@
 @dfn{Info format}, which you read using an @dfn{Info reader}.  You are
 probably using an Info reader to read this now.
 
+There are two primary Info readers: @code{info}, a stand-alone program
+designed just to read Info files, and the @code{info} package in GNU
+Emacs, a general-purpose editor.  At present, only the Emacs reader
+supports using a mouse.
+
 @ifinfo
 If you are new to the Info reader and want to learn how to use it,
 type the command @kbd{h} now.  It brings you to a programmed
@@ -84,7 +89,7 @@
 @comment  node-name,  next,  previous,  up
 @chapter Getting Started
 
-This first part of the Info manual describes how to get around inside
+This first part of this Info manual describes how to get around inside
 of Info.  The second part of the manual describes various advanced
 Info commands, and how to write an Info as distinct from a Texinfo
 file.  The third part briefly explains how to generate Info files from
@@ -111,7 +116,7 @@
 @item
 Type @code{emacs} at the command line; then type @kbd{C-h i}
 (@kbd{Control-h}, followed by @kbd{i}).  This approach uses the Info
-mode of the Emacs program, an editor with many other capabilities.
+mode of the Emacs editor.
 @end enumerate
 
 In either case, then type @kbd{mInfo} (just the letters), followed by
@@ -270,9 +275,10 @@
 node, @samp{Help-^L}.
 
 @format
->> But do not type @kbd{n} yet.  First, try the @kbd{p} command,
-   or click the middle mouse button on the @samp{Prev} link.  That
-   takes you to the @samp{Previous} node.  Then use @kbd{n} to return here.
+>> But do not type @kbd{n} yet.  First, try the @kbd{p} command, or
+   (in Emacs) click the middle mouse button on the @samp{Prev} link.
+   That takes you to the @samp{Previous} node.  Then use @kbd{n} to
+   return here.
 @end format
 
   If you read this in Emacs, you will see an @samp{Info} item in the
@@ -288,8 +294,8 @@
 coming up.
 
 @format
->> Now do an @kbd{n}, or click the middle mouse button on the @samp{Next}
-   link, to get to the node @samp{Help-^L} and learn more.
+>> Now do an @kbd{n}, or (in Emacs) click the middle mouse button on
+   the @samp{Next} link, to get to the node @samp{Help-^L} and learn more.
 @end format
 
 @node Help-^L, Help-Inv, Help-P, Getting Started
--- a/man/makefile.w32-in	Tue Jun 15 18:46:31 2004 +0000
+++ b/man/makefile.w32-in	Thu Jun 24 07:44:13 2004 +0000
@@ -46,13 +46,14 @@
 		$(infodir)/emacs-mime $(infodir)/eshell \
 		$(infodir)/speedbar $(infodir)/tramp \
 		$(infodir)/ses $(infodir)/smtpmail \
-		$(infodir)/flymake
+		$(infodir)/flymake $(infodir)/emacs-xtra
 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 \
 		 reftex.dvi sc.dvi vip.dvi viper.dvi widget.dvi faq.dvi \
 		 ada-mode.dvi autotype.dvi idlwave.dvi eudc.dvi ebrowse.dvi \
 		 pcl-cvs.dvi woman.dvi emacs-mime.dvi eshell.dvi \
-		 speedbar.dvi tramp.dvi ses.dvi smtpmail.dvi flymake.dvi
+		 speedbar.dvi tramp.dvi ses.dvi smtpmail.dvi flymake.dvi \
+		 emacs-xtra.dvi
 INFOSOURCES = info.texi
 
 # The following rule does not work with all versions of `make'.
@@ -66,6 +67,7 @@
 
 EMACSSOURCES= \
 	$(srcdir)/emacs.texi \
+	$(srcdir)/emacs-xtra.texi \
 	$(srcdir)/doclicense.texi \
 	$(srcdir)/screen.texi \
 	$(srcdir)/commands.texi \
@@ -297,6 +299,12 @@
 smtpmail.dvi: smtpmail.texi
 	$(ENVADD) $(TEXI2DVI) $(srcdir)/smtpmail.texi
 
+$(infodir)/emacs-xtra: emacs-xtra.texi
+	$(MAKEINFO) emacs-xtra.texi
+
+emacs-xtra.dvi: emacs-xtra.texi
+	$(ENVADD) $(TEXI2DVI) $(srcdir)/emacs-xtra.texi
+
 mostlyclean:
 	- $(DEL) *.log *.cp *.fn *.ky *.pg *.vr core *.tp *.core gnustmp.*
 
@@ -308,15 +316,15 @@
 		 $(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)/vip* $(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)/speedbar* $(infodir)/tramp* \
-		 $(infodir)/ses* $(infodir)/smtpmail*
+		 $(infodir)/ses* $(infodir)/smtpmail* \
+		 $(infodir)/flymake*
 
 distclean: clean
 
--- a/man/misc.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/man/misc.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -624,12 +624,6 @@
 Move backward across one shell command, but not beyond the current line
 (@code{shell-backward-command}).
 
-@item C-c C-l
-@kindex C-c C-l @r{(Shell mode)}
-@findex comint-dynamic-list-input-ring
-Display the buffer's history of shell commands in another window
-(@code{comint-dynamic-list-input-ring}).
-
 @item M-x dirs
 Ask the shell what its current directory is, so that Emacs can agree
 with the shell.
@@ -740,13 +734,21 @@
 @itemx M-s @var{regexp} @key{RET}
 Search backwards or forwards for old shell commands that match @var{regexp}.
 
-@item C-c C-x @r{(Shell mode)}
+@item C-c C-x
+@kindex C-c C-x @r{(Shell mode)}
 @findex comint-get-next-from-history
 Fetch the next subsequent command from the history.
 
-@item C-c . @r{(Shell mode)}
+@item C-c .
+@kindex C-c . @r{(Shell mode)}
 @findex comint-input-previous-argument
 Fetch one argument from an old shell command.
+
+@item C-c C-l
+@kindex C-c C-l @r{(Shell mode)}
+@findex comint-dynamic-list-input-ring
+Display the buffer's history of shell commands in another window
+(@code{comint-dynamic-list-input-ring}).
 @end table
 
   Shell buffers provide a history of previously entered shell commands.  To
@@ -815,21 +817,26 @@
 Move point to the following prompt (@code{comint-next-prompt}).
 
 @kindex C-c RET @r{(Shell mode)}
-@findex comint-copy-old-input
+@findex comint-insert-input
 @item C-c @key{RET}
 Copy the input command which point is in, inserting the copy at the end
-of the buffer (@code{comint-copy-old-input}).  This is useful if you
+of the buffer (@code{comint-insert-input}).  This is useful if you
 move point back to a previous command.  After you copy the command, you
 can submit the copy as input with @key{RET}.  If you wish, you can
 edit the copy before resubmitting it.
+
+@item Mouse-2
+Copy the input command that you click on, inserting the copy at the end
+of the buffer.
 @end table
 
   Moving to a previous input and then copying it with @kbd{C-c
-@key{RET}} produces the same results---the same buffer contents---that
-you would get by using @kbd{M-p} enough times to fetch that previous
-input from the history list.  However, @kbd{C-c @key{RET}} copies the
-text from the buffer, which can be different from what is in the history
-list if you edit the input text in the buffer after it has been sent.
+@key{RET}} or @kbd{Mouse-2} produces the same results---the same
+buffer contents---that you would get by using @kbd{M-p} enough times
+to fetch that previous input from the history list.  However, @kbd{C-c
+@key{RET}} copies the text from the buffer, which can be different
+from what is in the history list if you edit the input text in the
+buffer after it has been sent.
 
 @node History References
 @subsubsection Shell History References
--- a/man/msdog.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/man/msdog.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -352,7 +352,7 @@
 @findex add-untranslated-filesystem
   When you use NFS or Samba to access file systems that reside on
 computers using GNU or Unix systems, Emacs should not perform
-end-of-line translation on any files in these file systems--not even
+end-of-line translation on any files in these file systems---not even
 when you create a new file.  To request this, designate these file
 systems as @dfn{untranslated} file systems by calling the function
 @code{add-untranslated-filesystem}.  It takes one argument: the file
@@ -436,7 +436,7 @@
 
   On MS-Windows, when the Windows network software is installed, you can
 also use a printer shared by another machine by setting
-@code{printer-name} to the UNC share name for that printer--for example,
+@code{printer-name} to the UNC share name for that printer---for example,
 @code{"//joes_pc/hp4si"}.  (It doesn't matter whether you use forward
 slashes or backslashes here.)  To find out the names of shared printers,
 run the command @samp{net view} at a DOS command prompt to obtain a list
--- a/man/programs.texi	Tue Jun 15 18:46:31 2004 +0000
+++ b/man/programs.texi	Thu Jun 24 07:44:13 2004 +0000
@@ -1061,9 +1061,9 @@
 
 @findex info-lookup-symbol
 @findex info-lookup-file
-@kindex C-h C-i
+@kindex C-h S
   For C, Lisp, and other languages that have documentation in Info,
-you can use @kbd{C-h C-i} (@code{info-lookup-symbol}) to view the Info
+you can use @kbd{C-h S} (@code{info-lookup-symbol}) to view the Info
 documentation for a symbol.  You specify the symbol with the
 minibuffer; the default is the symbol appearing in the buffer at
 point.
--- a/src/ChangeLog	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/ChangeLog	Thu Jun 24 07:44:13 2004 +0000
@@ -1,10 +1,142 @@
+2004-06-23  David Kastrup  <dak@gnu.org>
+
+	* search.c (Freplace_match): Adjust the match-data more
+	thoroughly when replacing strings in the buffer.
+	search.c (match-data): When INTEGERS is non-nil and the last match
+	was in a buffer, add the buffer as last element to the match data.
+	(Fset_match_data): If an additional element of the match-data is
+	a buffer, restore it to last_thing_searched.
+	(save_search_regs): Save last_thing_searched as part of the match
+	data.
+	(restore_match_data): Restore it again.
+
+2004-06-23  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* keymap.c (Ftext_char_description): Doc fix.
+	* doc.c (Fsnarf_documentation): Doc fix.
+
+2004-06-22  Kim F. Storm  <storm@cua.dk>
+
+	* fns.c (Fmapcar, Fmapconcat): GCPRO the args array.
+
+	* lisp.h (struct Lisp_Save_Value): New member dogc.
+	(SAFE_ALLOCA_LISP): Change second arg to number of elements.
+	Set dogc member in Lisp_Save_Value object so it will be GC'ed.
+	(SAFE_FREE_LISP): New macro.
+
+	* alloc.c (safe_alloca_unwind): Clear dogc and pointer members.
+	(make_save_value): Init new dogc member.
+	(mark_object): Mark Lisp_Save_Value pointer array if dogc is set.
+
+	* fns.c (Fmapconcat, Fmapcar): Use new SAFE_ALLOCA_LISP and
+	SAFE_FREE_LISP macros.
+
+2004-06-22  Kim F. Storm  <storm@cua.dk>
+
+	* lisp.h (SAFE_ALLOCA_LISP): New macro to allocate Lisp_Objects.
+	Temporarily inhibits GC if memory is xmalloc'ed, as the Lisp_Objects
+	in that memory area are unknown to GC.  Add comments.
+
+	* fns.c (Fmapconcat, Fmapcar): Use SAFE_ALLOCA_LISP.
+
+2004-06-21  Kim F. Storm  <storm@cua.dk>
+
+	* lisp.h (MAX_ALLOCA): Define here.
+	(safe_alloca_unwind): Add prototype.
+	(USE_SAFE_ALLOCA, SAFE_ALLOCA, SAFE_FREE): New macros.
+
+	* alloc.c (safe_alloca_unwind): New function.
+
+	* casefiddle.c (casify_object): Use SAFE_ALLOCA.
+
+	* charset.c (Fstring): Use SAFE_ALLOCA.
+
+	* coding.c (MAX_ALLOCA): Remove define.
+
+	* data.c (MAX_ALLOCA): Remove define.
+	(Faset): Use SAFE_ALLOCA.
+
+	* editfns.c (Fformat, Ftranspose_regions): Use SAFE_ALLOCA.
+
+	* fns.c (string_make_multibyte, string_to_multibyte)
+	(string_make_unibyte, Fmapconcat, Fmapcar): Use SAFE_ALLOCA.
+	(MAX_ALLOCA): Remove define.
+	(Fbase64_encode_region, Fbase64_encode_string)
+	(Fbase64_decode_region, Fbase64_decode_string): Use SAFE_ALLOCA.
+	(Fbase64_encode_region, Fbase64_encode_string): Fix potential
+	memory leak if encoding fails.
+
+	* xdisp.c (add_to_log): Use SAFE_ALLOCA.
+
+2004-06-21  Eli Zaretskii  <eliz@gnu.org>
+
+	* print.c (Fwith_output_to_temp_buffer): Doc fix.
+
+2004-06-20  Richard M. Stallman  <rms@gnu.org>
+
+	* xfaces.c (Finternal_copy_lisp_face): Small cleanup; doc fix.
+
+	* search.c (match_limit): Cleaner err msg when no match data available.
+
+	* window.c (syms_of_window): Doc fix.
+
+	* keyboard.c (command_loop_1): Handle values `only' and `identity'
+	for Vtransient_mark_mode.
+
+	* buffer.c (syms_of_buffer): Doc fix.
+
+2004-06-21  David Kastrup  <dak@gnu.org>
+
+	* minibuf.c (Ftry_completion, Fall_completions): Do lazy binding
+	and unbinding of `case-fold-search' according to
+	`completion-ignore-case' around calls of string-match and
+	predicates, respectively.  Should give satisfactory performance
+	in all relevant cases.
+
+2004-06-17  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* xterm.c (x_draw_image_foreground_1): Subtract slice.x/y from
+	clip_x/y_origin.
+
+	* fns.c (string_to_multibyte): Use xmalloc/xfree instead of alloca.
+
+	* macfns.c (Fx_display_color_cells): Do not limit return value to 256.
+
+	* macterm.c (mac_initialize_display_info): Initialize n_planes correctly
+	on Mac OSX.
+
+2004-06-16  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* buffer.c (syms_of_buffer): Clarify `fill-column' docstring.
+
+2004-06-16  Kim F. Storm  <storm@cua.dk>
+
+	* dispextern.h (Vimage_types): Remove extern.
+
+2004-06-16  Miles Bader  <miles@gnu.org>
+
+	* image.c (lookup_image_type): Initialize image type if necessary.
+
+2004-06-15  Kim F. Storm  <storm@cua.dk>
+
+	* xdisp.c (try_cursor_movement): Exclude header line from scroll
+	margin at top of window.
+	(try_window_reusing_current_matrix): Calculate proper cursor position
+	after scrolling up with non-zero scroll margin, as the old cursor
+	position corresponds to value of PT before executing this command.
+	(try_window_id): Consider scroll margin at bottom of window too;
+	otherwise we fail to scroll when hl-line-mode is enabled.
+
+	* syntax.c (skip_chars): Only recognize [:class:] when it has the
+	proper format and class is a lower-case word.
+
 2004-06-14  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
 	* gtkutil.c (xg_get_image_for_pixmap): New function.
 	(xg_get_gdk_pixmap_and_mask): Removed.
 	(update_frame_tool_bar): Call xg_get_image_for_pixmap instead of
 	xg_get_gdk_pixmap_and_mask.
-	
+
 	* xterm.h (struct x_display_info): Typo in comment fixed.
 
 2004-06-14  Juanma Barranquero  <lektu@terra.es>
--- a/src/abbrev.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/abbrev.c	Thu Jun 24 07:44:13 2004 +0000
@@ -1,5 +1,5 @@
 /* Primitives for word-abbrev mode.
-   Copyright (C) 1985, 1986, 1993, 1996, 1998, 2001
+   Copyright (C) 1985, 1986, 1993, 1996, 1998, 2001,02,03,04
    Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
--- a/src/alloc.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/alloc.c	Thu Jun 24 07:44:13 2004 +0000
@@ -580,6 +580,21 @@
 }
 
 
+/* Unwind for SAFE_ALLOCA */
+
+Lisp_Object
+safe_alloca_unwind (arg)
+     Lisp_Object arg;
+{
+  register struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
+
+  p->dogc = 0;
+  xfree (p->pointer);
+  p->pointer = 0;
+  return Qnil;
+}
+
+
 /* Like malloc but used for allocating Lisp data.  NBYTES is the
    number of bytes to allocate, TYPE describes the intended use of the
    allcated memory block (for strings, for conses, ...).  */
@@ -2935,6 +2950,7 @@
   p = XSAVE_VALUE (val);
   p->pointer = pointer;
   p->integer = integer;
+  p->dogc = 0;
   return val;
 }
 
@@ -4969,6 +4985,7 @@
       if (XMARKER (obj)->gcmarkbit)
 	break;
       XMARKER (obj)->gcmarkbit = 1;
+
       switch (XMISCTYPE (obj))
 	{
 	case Lisp_Misc_Buffer_Local_Value:
@@ -4993,6 +5010,8 @@
 	  /* DO NOT mark thru the marker's chain.
 	     The buffer's markers chain does not preserve markers from gc;
 	     instead, markers are removed from the chain when freed by gc.  */
+	  break;
+
 	case Lisp_Misc_Intfwd:
 	case Lisp_Misc_Boolfwd:
 	case Lisp_Misc_Objfwd:
@@ -5002,7 +5021,21 @@
 	     since all markable slots in current buffer marked anyway.  */
 	  /* Don't need to do Lisp_Objfwd, since the places they point
 	     are protected with staticpro.  */
+	  break;
+
 	case Lisp_Misc_Save_Value:
+	  {
+	    register struct Lisp_Save_Value *ptr = XSAVE_VALUE (obj);
+	    /* If DOGC is set, POINTER is the address of a memory
+	       area containing INTEGER potential Lisp_Objects.  */
+	    if (ptr->dogc)
+	      {
+		Lisp_Object *p = (Lisp_Object *) ptr->pointer;
+		int nelt;
+		for (nelt = ptr->integer; nelt > 0; nelt--, p++)
+		  mark_maybe_object (*p);
+	      }
+	  }
 	  break;
 
 	case Lisp_Misc_Overlay:
--- a/src/atimer.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/atimer.c	Thu Jun 24 07:44:13 2004 +0000
@@ -1,5 +1,5 @@
 /* Asynchronous timers.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
--- a/src/atimer.h	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/atimer.h	Thu Jun 24 07:44:13 2004 +0000
@@ -1,5 +1,5 @@
 /* Asynchronous timers.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2003 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
--- a/src/blockinput.h	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/blockinput.h	Thu Jun 24 07:44:13 2004 +0000
@@ -1,5 +1,5 @@
 /* blockinput.h - interface to blocking complicated interrupt-driven input.
-   Copyright (C) 1989, 1993 Free Software Foundation, Inc.
+   Copyright (C) 1989, 1993, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
--- a/src/buffer.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/buffer.c	Thu Jun 24 07:44:13 2004 +0000
@@ -5437,7 +5437,7 @@
   DEFVAR_PER_BUFFER ("fill-column", &current_buffer->fill_column,
 		     make_number (Lisp_Int),
 		     doc: /* *Column beyond which automatic line-wrapping should happen.
-Interactively, you can set this using \\[set-fill-column].  */);
+Interactively, you can set the buffer local value using \\[set-fill-column].  */);
 
   DEFVAR_PER_BUFFER ("left-margin", &current_buffer->left_margin,
 		     make_number (Lisp_Int),
@@ -5847,7 +5847,11 @@
 	       doc: /* *Non-nil means deactivate the mark when the buffer contents change.
 Non-nil also enables highlighting of the region whenever the mark is active.
 The variable `highlight-nonselected-windows' controls whether to highlight
-all windows or just the selected window.  */);
+all windows or just the selected window.
+
+If the value is `lambda', that enables Transient Mark mode temporarily
+until the next buffer modification.  If a command sets the value to `only',
+that enables Transient Mark mode for the following command only.  */);
   Vtransient_mark_mode = Qnil;
 
   DEFVAR_LISP ("inhibit-read-only", &Vinhibit_read_only,
--- a/src/buffer.h	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/buffer.h	Thu Jun 24 07:44:13 2004 +0000
@@ -1,5 +1,5 @@
 /* Header file for the buffer manipulation primitives.
-   Copyright (C) 1985, 86, 93, 94, 95, 97, 1998, 1999, 2000, 01, 2003
+   Copyright (C) 1985,86,93,94,95,97,98,99,2000,01,03,04
    Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
--- a/src/callproc.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/callproc.c	Thu Jun 24 07:44:13 2004 +0000
@@ -1,5 +1,5 @@
 /* Synchronous subprocess invocation for GNU Emacs.
-   Copyright (C) 1985,86,87,88,93,94,95,99, 2000, 2001
+   Copyright (C) 1985,86,87,88,93,94,95,99, 2000,01,02,03,04
    Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -222,7 +222,7 @@
   register int pid;
   char buf[16384];
   char *bufptr = buf;
-  int bufsize = 16384;
+  int bufsize = sizeof buf;
   int count = SPECPDL_INDEX ();
 
   register const unsigned char **new_argv
--- a/src/casefiddle.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/casefiddle.c	Thu Jun 24 07:44:13 2004 +0000
@@ -1,5 +1,6 @@
 /* GNU Emacs case conversion functions.
-   Copyright (C) 1985, 1994, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1985,94,97,98,99, 2001, 2002, 2004
+   Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -109,8 +110,12 @@
 	      /* The work is not yet finished because of a multibyte
 		 character just encountered.  */
 	      int fromlen, j_byte = i;
-	      char *buf
-		= (char *) alloca ((len - i) * MAX_MULTIBYTE_LENGTH + i);
+	      char *buf;
+	      int bufsize;
+	      USE_SAFE_ALLOCA;
+
+	      bufsize = (len - i) * MAX_MULTIBYTE_LENGTH + i;
+	      SAFE_ALLOCA (buf, char *, bufsize);
 
 	      /* Copy data already handled.  */
 	      bcopy (SDATA (obj), buf, i);
@@ -132,6 +137,7 @@
 		}
 	      obj = make_multibyte_string (buf, SCHARS (obj),
 					   j_byte);
+	      SAFE_FREE (bufsize);
 	    }
 	  return obj;
 	}
--- a/src/charset.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/charset.c	Thu Jun 24 07:44:13 2004 +0000
@@ -1645,11 +1645,16 @@
      int n;
      Lisp_Object *args;
 {
-  int i;
-  unsigned char *buf = (unsigned char *) alloca (MAX_MULTIBYTE_LENGTH * n);
-  unsigned char *p = buf;
+  int i, bufsize;
+  unsigned char *buf, *p;
   int c;
   int multibyte = 0;
+  Lisp_Object ret;
+  USE_SAFE_ALLOCA;
+
+  bufsize = MAX_MULTIBYTE_LENGTH * n;
+  SAFE_ALLOCA (buf, unsigned char *, bufsize);
+  p = buf;
 
   for (i = 0; i < n; i++)
     {
@@ -1667,7 +1672,10 @@
 	*p++ = c;
     }
 
-  return make_string_from_bytes (buf, n, p - buf);
+  ret = make_string_from_bytes (buf, n, p - buf);
+  SAFE_FREE (bufsize);
+
+  return ret;
 }
 
 #endif /* emacs */
--- a/src/coding.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/coding.c	Thu Jun 24 07:44:13 2004 +0000
@@ -2094,7 +2094,7 @@
 		  int dim, M, L;
 		  int size, required;
 		  int produced_chars;
-		  
+
 		  ONE_MORE_BYTE (dim);
 		  ONE_MORE_BYTE (M);
 		  ONE_MORE_BYTE (L);
@@ -4548,10 +4548,6 @@
   unsigned char *data;
 };
 
-/* Don't use alloca for allocating memory space larger than this, lest
-   we overflow their stack.  */
-#define MAX_ALLOCA 16*1024
-
 /* Allocate LEN bytes of memory for BUF (struct conversion_buffer).  */
 #define allocate_conversion_buffer(buf, len)		\
   do {							\
@@ -6654,7 +6650,7 @@
 					accept_latin_extra));
 		}
 	    }
-	      
+
 	  if (! encodable
 	      && ((CHAR_TABLE_P (translation_table)
 		   && ! NILP (Faref (translation_table, ch)))
--- a/src/data.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/data.c	Thu Jun 24 07:44:13 2004 +0000
@@ -2052,11 +2052,6 @@
     }
 }
 
-/* Don't use alloca for relocating string data larger than this, lest
-   we overflow their stack.  The value is the same as what used in
-   fns.c for base64 handling.  */
-#define MAX_ALLOCA 16*1024
-
 DEFUN ("aset", Faset, Saset, 3, 3, 0,
        doc: /* Store into the element of ARRAY at index IDX the value NEWELT.
 Return NEWELT.  ARRAY may be a vector, a string, a char-table or a
@@ -2156,10 +2151,9 @@
 	  /* We must relocate the string data.  */
 	  int nchars = SCHARS (array);
 	  unsigned char *str;
-
-	  str = (nbytes <= MAX_ALLOCA
-		 ? (unsigned char *) alloca (nbytes)
-		 : (unsigned char *) xmalloc (nbytes));
+	  USE_SAFE_ALLOCA;
+
+	  SAFE_ALLOCA (str, unsigned char *, nbytes);
 	  bcopy (SDATA (array), str, nbytes);
 	  allocate_string_data (XSTRING (array), nchars,
 				nbytes + new_bytes - prev_bytes);
@@ -2167,8 +2161,7 @@
 	  p1 = SDATA (array) + idxval_byte;
 	  bcopy (str + idxval_byte + prev_bytes, p1 + new_bytes,
 		 nbytes - (idxval_byte + prev_bytes));
-	  if (nbytes > MAX_ALLOCA)
-	    xfree (str);
+	  SAFE_FREE (nbytes);
 	  clear_string_char_byte_cache ();
 	}
       while (new_bytes--)
@@ -2190,14 +2183,13 @@
 	  unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1;
 	  unsigned char *origstr = SDATA (array), *str;
 	  int nchars, nbytes;
+	  USE_SAFE_ALLOCA;
 
 	  nchars = SCHARS (array);
 	  nbytes = idxval_byte = count_size_as_multibyte (origstr, idxval);
 	  nbytes += count_size_as_multibyte (origstr + idxval,
 					     nchars - idxval);
-	  str = (nbytes <= MAX_ALLOCA
-		 ? (unsigned char *) alloca (nbytes)
-		 : (unsigned char *) xmalloc (nbytes));
+	  SAFE_ALLOCA (str, unsigned char *, nbytes);
 	  copy_text (SDATA (array), str, nchars, 0, 1);
 	  PARSE_MULTIBYTE_SEQ (str + idxval_byte, nbytes - idxval_byte,
 			       prev_bytes);
@@ -2210,8 +2202,7 @@
 	    *p1++ = *p0++;
 	  bcopy (str + idxval_byte + prev_bytes, p1,
 		 nbytes - (idxval_byte + prev_bytes));
-	  if (nbytes > MAX_ALLOCA)
-	    xfree (str);
+	  SAFE_FREE (nbytes);
 	  clear_string_char_byte_cache ();
 	}
     }
--- a/src/dispextern.h	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/dispextern.h	Thu Jun 24 07:44:13 2004 +0000
@@ -1,5 +1,5 @@
 /* Interface definitions for display code.
-   Copyright (C) 1985, 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Copyright (C) 1985,93,94,97,98,99, 2000,01,02,03, 2004
      Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -2645,8 +2645,6 @@
 
 #ifdef HAVE_WINDOW_SYSTEM
 
-extern Lisp_Object Vimage_types;
-
 extern int x_bitmap_height P_ ((struct frame *, int));
 extern int x_bitmap_width P_ ((struct frame *, int));
 extern int x_bitmap_pixmap P_ ((struct frame *, int));
--- a/src/doc.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/doc.c	Thu Jun 24 07:44:13 2004 +0000
@@ -570,7 +570,7 @@
 The function takes one argument, FILENAME, a string;
 it specifies the file name (without a directory) of the DOC file.
 That file is found in `../etc' now; later, when the dumped Emacs is run,
-the same file name is found in the `data-directory'.  */)
+the same file name is found in the `doc-directory'.  */)
      (filename)
      Lisp_Object filename;
 {
--- a/src/editfns.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/editfns.c	Thu Jun 24 07:44:13 2004 +0000
@@ -3225,6 +3225,7 @@
   int longest_format;
   Lisp_Object val;
   int arg_intervals = 0;
+  USE_SAFE_ALLOCA;
 
   /* discarded[I] is 1 if byte I of the format
      string was not copied into the output.
@@ -3273,7 +3274,7 @@
   longest_format = 0;
 
   /* Make room in result for all the non-%-codes in the control string.  */
-  total = 5 + CONVERTED_BYTE_SIZE (multibyte, args[0]);
+  total = 5 + CONVERTED_BYTE_SIZE (multibyte, args[0]) + 1;
 
   /* Allocate the info and discarded tables.  */
   {
@@ -3466,10 +3467,7 @@
 
   /* Allocate the space for the result.
      Note that TOTAL is an overestimate.  */
-  if (total < 1000)
-    buf = (char *) alloca (total + 1);
-  else
-    buf = (char *) xmalloc (total + 1);
+  SAFE_ALLOCA (buf, char *, total);
 
   p = buf;
   nchars = 0;
@@ -3602,7 +3600,7 @@
 		maybe_combine_byte = 1;
 	      this_nchars = strlen (p);
 	      if (multibyte)
-		p += str_to_multibyte (p, buf + total - p, this_nchars);
+		p += str_to_multibyte (p, buf + total - 1 - p, this_nchars);
 	      else
 		p += this_nchars;
 	      nchars += this_nchars;
@@ -3639,7 +3637,7 @@
 	*p++ = *format++, nchars++;
     }
 
-  if (p > buf + total + 1)
+  if (p > buf + total)
     abort ();
 
   if (maybe_combine_byte)
@@ -3647,8 +3645,7 @@
   val = make_specified_string (buf, nchars, p - buf, multibyte);
 
   /* If we allocated BUF with malloc, free it too.  */
-  if (total >= 1000)
-    xfree (buf);
+  SAFE_FREE (total);
 
   /* If the format string has text properties, or any of the string
      arguments has text properties, set up text properties of the
@@ -4005,12 +4002,9 @@
       /* First region smaller than second.  */
       if (len1_byte < len2_byte)
         {
-	  /* We use alloca only if it is small,
-	     because we want to avoid stack overflow.  */
-	  if (len2_byte > 20000)
-	    temp = (unsigned char *) xmalloc (len2_byte);
-	  else
-	    temp = (unsigned char *) alloca (len2_byte);
+	  USE_SAFE_ALLOCA;
+
+	  SAFE_ALLOCA (temp, unsigned char *, len2_byte);
 
 	  /* Don't precompute these addresses.  We have to compute them
 	     at the last minute, because the relocating allocator might
@@ -4021,23 +4015,20 @@
           bcopy (start2_addr, temp, len2_byte);
           bcopy (start1_addr, start1_addr + len2_byte, len1_byte);
           bcopy (temp, start1_addr, len2_byte);
-	  if (len2_byte > 20000)
-	    xfree (temp);
+	  SAFE_FREE (len2_byte);
         }
       else
 	/* First region not smaller than second.  */
         {
-	  if (len1_byte > 20000)
-	    temp = (unsigned char *) xmalloc (len1_byte);
-	  else
-	    temp = (unsigned char *) alloca (len1_byte);
+	  USE_SAFE_ALLOCA;
+
+	  SAFE_ALLOCA (temp, unsigned char *, len1_byte);
 	  start1_addr = BYTE_POS_ADDR (start1_byte);
 	  start2_addr = BYTE_POS_ADDR (start2_byte);
           bcopy (start1_addr, temp, len1_byte);
           bcopy (start2_addr, start1_addr, len2_byte);
           bcopy (temp, start1_addr + len2_byte, len1_byte);
-	  if (len1_byte > 20000)
-	    xfree (temp);
+	  SAFE_FREE (len1_byte);
         }
       graft_intervals_into_buffer (tmp_interval1, start1 + len2,
                                    len1, current_buffer, 0);
@@ -4054,6 +4045,8 @@
       if (len1_byte == len2_byte)
 	/* Regions are same size, though, how nice.  */
         {
+	  USE_SAFE_ALLOCA;
+
           modify_region (current_buffer, start1, end1);
           modify_region (current_buffer, start2, end2);
           record_change (start1, len1);
@@ -4065,17 +4058,14 @@
           Fset_text_properties (make_number (start2), make_number (end2),
 				Qnil, Qnil);
 
-	  if (len1_byte > 20000)
-	    temp = (unsigned char *) xmalloc (len1_byte);
-	  else
-	    temp = (unsigned char *) alloca (len1_byte);
+	  SAFE_ALLOCA (temp, unsigned char *, len1_byte);
 	  start1_addr = BYTE_POS_ADDR (start1_byte);
 	  start2_addr = BYTE_POS_ADDR (start2_byte);
           bcopy (start1_addr, temp, len1_byte);
           bcopy (start2_addr, start1_addr, len2_byte);
           bcopy (temp, start2_addr, len1_byte);
-	  if (len1_byte > 20000)
-	    xfree (temp);
+	  SAFE_FREE (len1_byte);
+
           graft_intervals_into_buffer (tmp_interval1, start2,
                                        len1, current_buffer, 0);
           graft_intervals_into_buffer (tmp_interval2, start1,
@@ -4085,6 +4075,8 @@
       else if (len1_byte < len2_byte)	/* Second region larger than first */
         /* Non-adjacent & unequal size, area between must also be shifted.  */
         {
+	  USE_SAFE_ALLOCA;
+
           modify_region (current_buffer, start1, end2);
           record_change (start1, (end2 - start1));
           tmp_interval1 = copy_intervals (cur_intv, start1, len1);
@@ -4094,18 +4086,15 @@
 				Qnil, Qnil);
 
 	  /* holds region 2 */
-	  if (len2_byte > 20000)
-	    temp = (unsigned char *) xmalloc (len2_byte);
-	  else
-	    temp = (unsigned char *) alloca (len2_byte);
+	  SAFE_ALLOCA (temp, unsigned char *, len2_byte);
 	  start1_addr = BYTE_POS_ADDR (start1_byte);
 	  start2_addr = BYTE_POS_ADDR (start2_byte);
           bcopy (start2_addr, temp, len2_byte);
           bcopy (start1_addr, start1_addr + len_mid + len2_byte, len1_byte);
           safe_bcopy (start1_addr + len1_byte, start1_addr + len2_byte, len_mid);
           bcopy (temp, start1_addr, len2_byte);
-	  if (len2_byte > 20000)
-	    xfree (temp);
+	  SAFE_FREE (len2_byte);
+
           graft_intervals_into_buffer (tmp_interval1, end2 - len1,
                                        len1, current_buffer, 0);
           graft_intervals_into_buffer (tmp_interval_mid, start1 + len2,
@@ -4116,6 +4105,8 @@
       else
 	/* Second region smaller than first.  */
         {
+	  USE_SAFE_ALLOCA;
+
           record_change (start1, (end2 - start1));
           modify_region (current_buffer, start1, end2);
 
@@ -4126,18 +4117,15 @@
 				Qnil, Qnil);
 
 	  /* holds region 1 */
-	  if (len1_byte > 20000)
-	    temp = (unsigned char *) xmalloc (len1_byte);
-	  else
-	    temp = (unsigned char *) alloca (len1_byte);
+	  SAFE_ALLOCA (temp, unsigned char *, len1_byte);
 	  start1_addr = BYTE_POS_ADDR (start1_byte);
 	  start2_addr = BYTE_POS_ADDR (start2_byte);
           bcopy (start1_addr, temp, len1_byte);
           bcopy (start2_addr, start1_addr, len2_byte);
           bcopy (start1_addr + len1_byte, start1_addr + len2_byte, len_mid);
           bcopy (temp, start1_addr + len2_byte + len_mid, len1_byte);
-	  if (len1_byte > 20000)
-	    xfree (temp);
+	  SAFE_FREE (len1_byte);
+
           graft_intervals_into_buffer (tmp_interval1, end2 - len1,
                                        len1, current_buffer, 0);
           graft_intervals_into_buffer (tmp_interval_mid, start1 + len2,
--- a/src/fns.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/fns.c	Thu Jun 24 07:44:13 2004 +0000
@@ -994,6 +994,8 @@
 {
   unsigned char *buf;
   int nbytes;
+  Lisp_Object ret;
+  USE_SAFE_ALLOCA;
 
   if (STRING_MULTIBYTE (string))
     return string;
@@ -1005,11 +1007,14 @@
   if (nbytes == SBYTES (string))
     return string;
 
-  buf = (unsigned char *) alloca (nbytes);
+  SAFE_ALLOCA (buf, unsigned char *, nbytes);
   copy_text (SDATA (string), buf, SBYTES (string),
 	     0, 1);
 
-  return make_multibyte_string (buf, SCHARS (string), nbytes);
+  ret = make_multibyte_string (buf, SCHARS (string), nbytes);
+  SAFE_FREE (nbytes);
+
+  return ret;
 }
 
 
@@ -1024,6 +1029,8 @@
 {
   unsigned char *buf;
   int nbytes;
+  Lisp_Object ret;
+  USE_SAFE_ALLOCA;
 
   if (STRING_MULTIBYTE (string))
     return string;
@@ -1034,11 +1041,14 @@
   if (nbytes == SBYTES (string))
     return make_multibyte_string (SDATA (string), nbytes, nbytes);
 
-  buf = (unsigned char *) alloca (nbytes);
+  SAFE_ALLOCA (buf, unsigned char *, nbytes);
   bcopy (SDATA (string), buf, SBYTES (string));
   str_to_multibyte (buf, nbytes, SBYTES (string));
 
-  return make_multibyte_string (buf, SCHARS (string), nbytes);
+  ret = make_multibyte_string (buf, SCHARS (string), nbytes);
+  SAFE_FREE (nbytes);
+
+  return ret;
 }
 
 
@@ -1048,17 +1058,24 @@
 string_make_unibyte (string)
      Lisp_Object string;
 {
+  int nchars;
   unsigned char *buf;
+  Lisp_Object ret;
+  USE_SAFE_ALLOCA;
 
   if (! STRING_MULTIBYTE (string))
     return string;
 
-  buf = (unsigned char *) alloca (SCHARS (string));
-
+  nchars = SCHARS (string);
+
+  SAFE_ALLOCA (buf, unsigned char *, nchars);
   copy_text (SDATA (string), buf, SBYTES (string),
 	     1, 0);
 
-  return make_unibyte_string (buf, SCHARS (string));
+  ret = make_unibyte_string (buf, nchars);
+  SAFE_FREE (nchars);
+
+  return ret;
 }
 
 DEFUN ("string-make-multibyte", Fstring_make_multibyte, Sstring_make_multibyte,
@@ -2983,13 +3000,15 @@
   register Lisp_Object *args;
   register int i;
   struct gcpro gcpro1;
+  Lisp_Object ret;
+  USE_SAFE_ALLOCA;
 
   len = Flength (sequence);
   leni = XINT (len);
   nargs = leni + leni - 1;
   if (nargs < 0) return build_string ("");
 
-  args = (Lisp_Object *) alloca (nargs * sizeof (Lisp_Object));
+  SAFE_ALLOCA_LISP (args, nargs);
 
   GCPRO1 (separator);
   mapcar1 (leni, args, function, sequence);
@@ -3001,7 +3020,14 @@
   for (i = 1; i < nargs; i += 2)
     args[i] = separator;
 
-  return Fconcat (nargs, args);
+  GCPRO1 (*args);
+  gcpro1.nvars = nargs;
+  ret = Fconcat (nargs, args);
+  UNGCPRO;
+
+  SAFE_FREE_LISP (nargs);
+
+  return ret;
 }
 
 DEFUN ("mapcar", Fmapcar, Smapcar, 2, 2, 0,
@@ -3014,14 +3040,25 @@
   register Lisp_Object len;
   register int leni;
   register Lisp_Object *args;
+  struct gcpro gcpro1;
+  Lisp_Object ret;
+  USE_SAFE_ALLOCA;
 
   len = Flength (sequence);
   leni = XFASTINT (len);
-  args = (Lisp_Object *) alloca (leni * sizeof (Lisp_Object));
+
+  SAFE_ALLOCA_LISP (args, leni);
 
   mapcar1 (leni, args, function, sequence);
 
-  return Flist (leni, args);
+  GCPRO1 (*args);
+  gcpro1.nvars = leni;
+  ret = Flist (leni, args);
+  UNGCPRO;
+
+  SAFE_FREE_LISP (leni);
+
+  return ret;
 }
 
 DEFUN ("mapc", Fmapc, Smapc, 2, 2, 0,
@@ -3636,10 +3673,6 @@
     }					\
   while (IS_BASE64_IGNORABLE (c))
 
-/* Don't use alloca for regions larger than this, lest we overflow
-   their stack.  */
-#define MAX_ALLOCA 16*1024
-
 /* Table of characters coding the 64 values.  */
 static char base64_value_to_char[64] =
 {
@@ -3705,6 +3738,7 @@
   int allength, length;
   int ibeg, iend, encoded_length;
   int old_pos = PT;
+  USE_SAFE_ALLOCA;
 
   validate_region (&beg, &end);
 
@@ -3719,10 +3753,7 @@
   allength = length + length/3 + 1;
   allength += allength / MIME_LINE_LENGTH + 1 + 6;
 
-  if (allength <= MAX_ALLOCA)
-    encoded = (char *) alloca (allength);
-  else
-    encoded = (char *) xmalloc (allength);
+  SAFE_ALLOCA (encoded, char *, allength);
   encoded_length = base64_encode_1 (BYTE_POS_ADDR (ibeg), encoded, length,
 				    NILP (no_line_break),
 				    !NILP (current_buffer->enable_multibyte_characters));
@@ -3732,8 +3763,7 @@
   if (encoded_length < 0)
     {
       /* The encoding wasn't possible. */
-      if (length > MAX_ALLOCA)
-	xfree (encoded);
+      SAFE_FREE (allength);
       error ("Multibyte character in data for base64 encoding");
     }
 
@@ -3741,8 +3771,7 @@
      and delete the old.  (Insert first in order to preserve markers.)  */
   SET_PT_BOTH (XFASTINT (beg), ibeg);
   insert (encoded, encoded_length);
-  if (allength > MAX_ALLOCA)
-    xfree (encoded);
+  SAFE_FREE (allength);
   del_range_byte (ibeg + encoded_length, iend + encoded_length, 1);
 
   /* If point was outside of the region, restore it exactly; else just
@@ -3768,6 +3797,7 @@
   int allength, length, encoded_length;
   char *encoded;
   Lisp_Object encoded_string;
+  USE_SAFE_ALLOCA;
 
   CHECK_STRING (string);
 
@@ -3779,10 +3809,7 @@
   allength += allength / MIME_LINE_LENGTH + 1 + 6;
 
   /* We need to allocate enough room for decoding the text. */
-  if (allength <= MAX_ALLOCA)
-    encoded = (char *) alloca (allength);
-  else
-    encoded = (char *) xmalloc (allength);
+  SAFE_ALLOCA (encoded, char *, allength);
 
   encoded_length = base64_encode_1 (SDATA (string),
 				    encoded, length, NILP (no_line_break),
@@ -3793,14 +3820,12 @@
   if (encoded_length < 0)
     {
       /* The encoding wasn't possible. */
-      if (length > MAX_ALLOCA)
-	xfree (encoded);
+      SAFE_FREE (allength);
       error ("Multibyte character in data for base64 encoding");
     }
 
   encoded_string = make_unibyte_string (encoded, encoded_length);
-  if (allength > MAX_ALLOCA)
-    xfree (encoded);
+  SAFE_FREE (allength);
 
   return encoded_string;
 }
@@ -3913,6 +3938,7 @@
   int decoded_length;
   int inserted_chars;
   int multibyte = !NILP (current_buffer->enable_multibyte_characters);
+  USE_SAFE_ALLOCA;
 
   validate_region (&beg, &end);
 
@@ -3925,10 +3951,7 @@
      working on a multibyte buffer, each decoded code may occupy at
      most two bytes.  */
   allength = multibyte ? length * 2 : length;
-  if (allength <= MAX_ALLOCA)
-    decoded = (char *) alloca (allength);
-  else
-    decoded = (char *) xmalloc (allength);
+  SAFE_ALLOCA (decoded, char *, allength);
 
   move_gap_both (XFASTINT (beg), ibeg);
   decoded_length = base64_decode_1 (BYTE_POS_ADDR (ibeg), decoded, length,
@@ -3939,8 +3962,7 @@
   if (decoded_length < 0)
     {
       /* The decoding wasn't possible. */
-      if (allength > MAX_ALLOCA)
-	xfree (decoded);
+      SAFE_FREE (allength);
       error ("Invalid base64 data");
     }
 
@@ -3948,8 +3970,8 @@
      and delete the old.  (Insert first in order to preserve markers.)  */
   TEMP_SET_PT_BOTH (XFASTINT (beg), ibeg);
   insert_1_both (decoded, inserted_chars, decoded_length, 0, 1, 0);
-  if (allength > MAX_ALLOCA)
-    xfree (decoded);
+  SAFE_FREE (allength);
+
   /* Delete the original text.  */
   del_range_both (PT, PT_BYTE, XFASTINT (end) + inserted_chars,
 		  iend + decoded_length, 1);
@@ -3974,15 +3996,13 @@
   char *decoded;
   int length, decoded_length;
   Lisp_Object decoded_string;
+  USE_SAFE_ALLOCA;
 
   CHECK_STRING (string);
 
   length = SBYTES (string);
   /* We need to allocate enough room for decoding the text. */
-  if (length <= MAX_ALLOCA)
-    decoded = (char *) alloca (length);
-  else
-    decoded = (char *) xmalloc (length);
+  SAFE_ALLOCA (decoded, char *, length);
 
   /* The decoded result should be unibyte. */
   decoded_length = base64_decode_1 (SDATA (string), decoded, length,
@@ -3994,8 +4014,7 @@
   else
     decoded_string = Qnil;
 
-  if (length > MAX_ALLOCA)
-    xfree (decoded);
+  SAFE_FREE (length);
   if (!STRINGP (decoded_string))
     error ("Invalid base64 data");
 
--- a/src/image.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/image.c	Thu Jun 24 07:44:13 2004 +0000
@@ -689,6 +689,10 @@
 {
   struct image_type *type;
 
+  /* We must initialize the image-type if it hasn't been already.  */
+  if (NILP (Finit_image_library (symbol)))
+    return 0;			/* unimplemented */
+
   for (type = image_types; type; type = type->next)
     if (EQ (symbol, *type->type))
       break;
--- a/src/keyboard.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/keyboard.c	Thu Jun 24 07:44:13 2004 +0000
@@ -670,6 +670,8 @@
    to support it.  */
 static int cannot_suspend;
 
+extern Lisp_Object Qidentity, Qonly;
+
 /* Install the string STR as the beginning of the string of echoing,
    so that it serves as a prompt for the next character.
    Also start echoing.  */
@@ -1809,6 +1811,16 @@
 	    call1 (Vrun_hooks, intern ("activate-mark-hook"));
 	}
 
+      /* Setting transient-mark-mode to `only' is a way of
+	 turning it on for just one command.  */
+      if (!NILP (current_buffer->mark_active) && !NILP (Vrun_hooks))
+	{
+	  if (EQ (Vtransient_mark_mode, Qidentity))
+	    Vtransient_mark_mode = Qnil;
+	  if (EQ (Vtransient_mark_mode, Qonly))
+	    Vtransient_mark_mode = Qidentity;
+	}
+
     finalize:
 
       if (current_buffer == prev_buffer
--- a/src/keymap.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/keymap.c	Thu Jun 24 07:44:13 2004 +0000
@@ -2283,7 +2283,11 @@
 
 DEFUN ("text-char-description", Ftext_char_description, Stext_char_description, 1, 1, 0,
        doc: /* Return a pretty description of file-character CHARACTER.
-Control characters turn into "^char", etc.  */)
+Control characters turn into "^char", etc.  This differs from
+`single-key-description' which turns them into "C-char".
+Also, this function recognizes the 2**7 bit as the Meta character,
+whereas `single-key-description' uses the 2**27 bit for Meta.
+See Info node `(elisp)Describing Characters' for examples.  */)
      (character)
      Lisp_Object character;
 {
--- a/src/lisp.h	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/lisp.h	Thu Jun 24 07:44:13 2004 +0000
@@ -1199,7 +1199,10 @@
   {
     int type : 16;	/* = Lisp_Misc_Save_Value */
     unsigned gcmarkbit : 1;
-    int spacer : 15;
+    int spacer : 14;
+    /* If DOGC is set, POINTER is the address of a memory
+       area containing INTEGER potential Lisp_Objects.  */
+    unsigned int dogc : 1;
     void *pointer;
     int integer;
   };
@@ -3248,6 +3251,64 @@
 	 : Fcons ((el), (check)))))
 
 
+/* SAFE_ALLOCA normally allocates memory on the stack, but if size is
+   larger than MAX_ALLOCA, use xmalloc to avoid overflowing the stack.  */
+
+#define MAX_ALLOCA 16*1024
+
+extern Lisp_Object safe_alloca_unwind (Lisp_Object);
+
+#define USE_SAFE_ALLOCA			\
+  int sa_count = SPECPDL_INDEX ()
+
+/* SAFE_ALLOCA allocates a simple buffer.  */
+
+#define SAFE_ALLOCA(buf, type, size)			  \
+  do {							  \
+    if ((size) < MAX_ALLOCA)				  \
+      buf = (type) alloca (size);			  \
+    else						  \
+      {							  \
+	buf = (type) xmalloc (size);			  \
+	record_unwind_protect (safe_alloca_unwind,	  \
+			       make_save_value (buf, 0)); \
+      }							  \
+  } while (0)
+
+/* SAFE_FREE frees xmalloced memory and enables GC as needed.  */
+
+#define SAFE_FREE(size)			\
+  do {					\
+    if ((size) >= MAX_ALLOCA)		\
+      unbind_to (sa_count, Qnil);	\
+  } while (0)
+
+
+/* SAFE_ALLOCA_LISP allocates an array of Lisp_Objects.  */
+
+#define SAFE_ALLOCA_LISP(buf, nelt)			  \
+  do {							  \
+    int size_ = (nelt) * sizeof (Lisp_Object);		  \
+    if (size_ < MAX_ALLOCA)				  \
+      buf = (Lisp_Object *) alloca (size_);		  \
+    else						  \
+      {							  \
+	Lisp_Object arg_;				  \
+	buf = (Lisp_Object *) xmalloc (size_);		  \
+	arg_ = make_save_value (buf, nelt);		  \
+	XSAVE_VALUE (arg_)->dogc = 1;			  \
+	record_unwind_protect (safe_alloca_unwind, arg_); \
+      }							  \
+  } while (0)
+
+#define SAFE_FREE_LISP(nelt)				\
+  do {							\
+    if (((nelt) * sizeof (Lisp_Object)) >= MAX_ALLOCA)	\
+      unbind_to (sa_count, Qnil);			\
+  } while (0)
+
+
+
 #endif /* EMACS_LISP_H */
 
 /* arch-tag: 9b2ed020-70eb-47ac-94ee-e1c2a5107d5e
--- a/src/macfns.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/macfns.c	Thu Jun 24 07:44:13 2004 +0000
@@ -2939,8 +2939,8 @@
 {
   struct mac_display_info *dpyinfo = check_x_display_info (display);
 
-  /* MAC_TODO: check whether this is right */
-  return make_number (dpyinfo->n_planes >= 8 ? 256 : 1 << dpyinfo->n_planes - 1);
+  /* We force 24+ bit depths to 24-bit to prevent an overflow.  */
+  return make_number (1 << min (dpyinfo->n_planes, 24));
 }
 
 DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
--- a/src/macterm.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/macterm.c	Thu Jun 24 07:44:13 2004 +0000
@@ -8840,10 +8840,16 @@
   dpyinfo->resx = 75.0;
   dpyinfo->resy = 75.0;
   dpyinfo->color_p = TestDeviceAttribute (main_device_handle, gdDevType);
+#ifdef MAC_OSX
+  /* HasDepth returns true if it is possible to have a 32 bit display,
+     but this may not be what is actually used.  Mac OSX can do better.  */
+  dpyinfo->n_planes = CGDisplayBitsPerPixel (CGMainDisplayID ());
+#else
   for (dpyinfo->n_planes = 32; dpyinfo->n_planes > 0; dpyinfo->n_planes >>= 1)
     if (HasDepth (main_device_handle, dpyinfo->n_planes,
 		  gdDevType, dpyinfo->color_p))
       break;
+#endif
   dpyinfo->height = (**main_device_handle).gdRect.bottom;
   dpyinfo->width = (**main_device_handle).gdRect.right;
   dpyinfo->grabbed = 0;
--- a/src/minibuf.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/minibuf.c	Thu Jun 24 07:44:13 2004 +0000
@@ -1212,6 +1212,7 @@
 			   || NILP (XCAR (alist))));
   int index = 0, obsize = 0;
   int matchcount = 0;
+  int bindcount = -1;
   Lisp_Object bucket, zero, end, tem;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
 
@@ -1290,21 +1291,22 @@
 	  XSETFASTINT (zero, 0);
 
 	  /* Ignore this element if it fails to match all the regexps.  */
-	  if (CONSP (Vcompletion_regexp_list))
-	    {
-	      int count = SPECPDL_INDEX ();
-	      specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil);
-	      for (regexps = Vcompletion_regexp_list; CONSP (regexps);
-		   regexps = XCDR (regexps))
-		{
-		  tem = Fstring_match (XCAR (regexps), eltstring, zero);
-		  if (NILP (tem))
-		    break;
+	  {
+	    for (regexps = Vcompletion_regexp_list; CONSP (regexps);
+		 regexps = XCDR (regexps))
+	      {
+		if (bindcount < 0) {
+		  bindcount = SPECPDL_INDEX ();
+		  specbind (Qcase_fold_search,
+			    completion_ignore_case ? Qt : Qnil);
 		}
-	      unbind_to (count, Qnil);
-	      if (CONSP (regexps))
-		continue;
-	    }
+		tem = Fstring_match (XCAR (regexps), eltstring, zero);
+		if (NILP (tem))
+		  break;
+	      }
+	    if (CONSP (regexps))
+	      continue;
+	  }
 
 	  /* Ignore this element if there is a predicate
 	     and the predicate doesn't like it. */
@@ -1315,6 +1317,10 @@
 		tem = Fcommandp (elt, Qnil);
 	      else
 		{
+		  if (bindcount >= 0) {
+		    unbind_to (bindcount, Qnil);
+		    bindcount = -1;
+		  }
 		  GCPRO4 (tail, string, eltstring, bestmatch);
 		  tem = type == 3
 		    ? call2 (predicate, elt,
@@ -1396,6 +1402,11 @@
 	}
     }
 
+  if (bindcount >= 0) {
+    unbind_to (bindcount, Qnil);
+    bindcount = -1;
+  }
+
   if (NILP (bestmatch))
     return Qnil;		/* No completions found */
   /* If we are ignoring case, and there is no exact match,
@@ -1458,6 +1469,7 @@
 		       && (!SYMBOLP (XCAR (alist))
 			   || NILP (XCAR (alist))));
   int index = 0, obsize = 0;
+  int bindcount = -1;
   Lisp_Object bucket, tem;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
 
@@ -1542,21 +1554,22 @@
 	  XSETFASTINT (zero, 0);
 
 	  /* Ignore this element if it fails to match all the regexps.  */
-	  if (CONSP (Vcompletion_regexp_list))
-	    {
-	      int count = SPECPDL_INDEX ();
-	      specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil);
-	      for (regexps = Vcompletion_regexp_list; CONSP (regexps);
-		   regexps = XCDR (regexps))
-		{
-		  tem = Fstring_match (XCAR (regexps), eltstring, zero);
-		  if (NILP (tem))
-		    break;
+	  {
+	    for (regexps = Vcompletion_regexp_list; CONSP (regexps);
+		 regexps = XCDR (regexps))
+	      {
+		if (bindcount < 0) {
+		  bindcount = SPECPDL_INDEX ();
+		  specbind (Qcase_fold_search,
+			    completion_ignore_case ? Qt : Qnil);
 		}
-	      unbind_to (count, Qnil);
-	      if (CONSP (regexps))
-		continue;
-	    }
+		tem = Fstring_match (XCAR (regexps), eltstring, zero);
+		if (NILP (tem))
+		  break;
+	      }
+	    if (CONSP (regexps))
+	      continue;
+	  }
 
 	  /* Ignore this element if there is a predicate
 	     and the predicate doesn't like it. */
@@ -1567,6 +1580,10 @@
 		tem = Fcommandp (elt, Qnil);
 	      else
 		{
+		  if (bindcount >= 0) {
+		    unbind_to (bindcount, Qnil);
+		    bindcount = -1;
+		  }
 		  GCPRO4 (tail, eltstring, allmatches, string);
 		  tem = type == 3
 		    ? call2 (predicate, elt,
@@ -1581,6 +1598,11 @@
 	}
     }
 
+  if (bindcount >= 0) {
+    unbind_to (bindcount, Qnil);
+    bindcount = -1;
+  }
+
   return Fnreverse (allmatches);
 }
 
--- a/src/print.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/print.c	Thu Jun 24 07:44:13 2004 +0000
@@ -658,7 +658,7 @@
 to get the buffer displayed instead of just displaying the non-selected
 buffer and calling the hook.  It gets one argument, the buffer to display.
 
-usage: (with-output-to-temp-buffer BUFFNAME BODY ...)  */)
+usage: (with-output-to-temp-buffer BUFNAME BODY ...)  */)
      (args)
      Lisp_Object args;
 {
--- a/src/search.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/search.c	Thu Jun 24 07:44:13 2004 +0000
@@ -2589,15 +2589,20 @@
   /* Adjust search data for this change.  */
   {
     int oldend = search_regs.end[sub];
+    int oldstart = search_regs.start[sub];
     int change = newpoint - search_regs.end[sub];
     int i;
 
     for (i = 0; i < search_regs.num_regs; i++)
       {
-	if (search_regs.start[i] > oldend)
+	if (search_regs.start[i] >= oldend)
 	  search_regs.start[i] += change;
-	if (search_regs.end[i] > oldend)
+	else if (search_regs.start[i] > oldstart)
+	  search_regs.start[i] = oldstart;
+	if (search_regs.end[i] >= oldend)
 	  search_regs.end[i] += change;
+	else if (search_regs.end[i] > oldstart)
+	  search_regs.end[i] = oldstart;
       }
   }
 
@@ -2622,8 +2627,10 @@
 
   CHECK_NUMBER (num);
   n = XINT (num);
-  if (n < 0 || search_regs.num_regs <= 0)
-    args_out_of_range (num, make_number (search_regs.num_regs));
+  if (n < 0)
+    args_out_of_range (num, 0);
+  if (search_regs.num_regs <= 0)
+    error ("No match data, because no search succeeded");
   if (n >= search_regs.num_regs
       || search_regs.start[n] < 0)
     return Qnil;
@@ -2664,8 +2671,11 @@
 if the last match was on a buffer; integers or nil if a string was matched.
 Use `store-match-data' to reinstate the data in this list.
 
-If INTEGERS (the optional first argument) is non-nil, always use integers
-\(rather than markers) to represent buffer positions.
+If INTEGERS (the optional first argument) is non-nil, always use
+integers \(rather than markers) to represent buffer positions.  In
+this case, and if the last match was in a buffer, the buffer will get
+stored as one additional element at the end of the list.
+
 If REUSE is a list, reuse it as part of the value.  If REUSE is long enough
 to hold all the values, and if INTEGERS is non-nil, no consing is done.
 
@@ -2682,10 +2692,10 @@
 
   prev = Qnil;
 
-  data = (Lisp_Object *) alloca ((2 * search_regs.num_regs)
+  data = (Lisp_Object *) alloca ((2 * search_regs.num_regs + 1)
 				 * sizeof (Lisp_Object));
 
-  len = -1;
+  len = 0;
   for (i = 0; i < search_regs.num_regs; i++)
     {
       int start = search_regs.start[i];
@@ -2712,22 +2722,29 @@
 	    /* last_thing_searched must always be Qt, a buffer, or Qnil.  */
 	    abort ();
 
-	  len = i;
+	  len = 2*(i+1);
 	}
       else
 	data[2 * i] = data [2 * i + 1] = Qnil;
     }
 
+  if (BUFFERP(last_thing_searched)
+      && ! NILP (integers))
+    {
+      XSETBUFFER(data[len], last_thing_searched);
+      len++;
+    }
+
   /* If REUSE is not usable, cons up the values and return them.  */
   if (! CONSP (reuse))
-    return Flist (2 * len + 2, data);
+    return Flist (len, data);
 
   /* If REUSE is a list, store as many value elements as will fit
      into the elements of REUSE.  */
   for (i = 0, tail = reuse; CONSP (tail);
        i++, tail = XCDR (tail))
     {
-      if (i < 2 * len + 2)
+      if (i < len)
 	XSETCAR (tail, data[i]);
       else
 	XSETCAR (tail, Qnil);
@@ -2736,8 +2753,8 @@
 
   /* If we couldn't fit all value elements into REUSE,
      cons up the rest of them and add them to the end of REUSE.  */
-  if (i < 2 * len + 2)
-    XSETCDR (prev, Flist (2 * len + 2 - i, data + i));
+  if (i < len)
+    XSETCDR (prev, Flist (len - i, data + i));
 
   return reuse;
 }
@@ -2758,8 +2775,8 @@
   if (!CONSP (list) && !NILP (list))
     list = wrong_type_argument (Qconsp, list);
 
-  /* Unless we find a marker with a buffer in LIST, assume that this
-     match data came from a string.  */
+  /* Unless we find a marker with a buffer or an explicit buffer
+     in LIST, assume that this match data came from a string.  */
   last_thing_searched = Qt;
 
   /* Allocate registers if they don't already exist.  */
@@ -2790,42 +2807,49 @@
 
 	search_regs.num_regs = length;
       }
+
+    for (i = 0; i < length; i++)
+      {
+	marker = Fcar (list);
+	if (NILP (marker))
+	  {
+	    search_regs.start[i] = -1;
+	    list = Fcdr (list);
+	  }
+	else
+	  {
+	    int from;
+	    
+	    if (MARKERP (marker))
+	      {
+		if (XMARKER (marker)->buffer == 0)
+		  XSETFASTINT (marker, 0);
+		else
+		  XSETBUFFER (last_thing_searched, XMARKER (marker)->buffer);
+	      }
+	    
+	    CHECK_NUMBER_COERCE_MARKER (marker);
+	    from = XINT (marker);
+	    list = Fcdr (list);
+	    
+	    marker = Fcar (list);
+	    if (MARKERP (marker) && XMARKER (marker)->buffer == 0)
+	      XSETFASTINT (marker, 0);
+	    
+	    CHECK_NUMBER_COERCE_MARKER (marker);
+	    search_regs.start[i] = from;
+	    search_regs.end[i] = XINT (marker);
+	  }
+	list = Fcdr (list);
+      }
+
+    for (; i < search_regs.num_regs; i++)
+      search_regs.start[i] = -1;
   }
 
-  for (i = 0; i < search_regs.num_regs; i++)
-    {
-      marker = Fcar (list);
-      if (NILP (marker))
-	{
-	  search_regs.start[i] = -1;
-	  list = Fcdr (list);
-	}
-      else
-	{
-	  int from;
-
-	  if (MARKERP (marker))
-	    {
-	      if (XMARKER (marker)->buffer == 0)
-		XSETFASTINT (marker, 0);
-	      else
-		XSETBUFFER (last_thing_searched, XMARKER (marker)->buffer);
-	    }
-
-	  CHECK_NUMBER_COERCE_MARKER (marker);
-	  from = XINT (marker);
-	  list = Fcdr (list);
-
-	  marker = Fcar (list);
-	  if (MARKERP (marker) && XMARKER (marker)->buffer == 0)
-	    XSETFASTINT (marker, 0);
-
-	  CHECK_NUMBER_COERCE_MARKER (marker);
-	  search_regs.start[i] = from;
-	  search_regs.end[i] = XINT (marker);
-	}
-      list = Fcdr (list);
-    }
+  if (CONSP(list) && BUFFERP(XCAR(list))) {
+    XSETBUFFER(last_thing_searched, XCAR(list));
+  }
 
   return Qnil;
 }
@@ -2834,6 +2858,7 @@
    during the execution of a sentinel or filter. */
 static int search_regs_saved;
 static struct re_registers saved_search_regs;
+static Lisp_Object saved_last_thing_searched;
 
 /* Called from Flooking_at, Fstring_match, search_buffer, Fstore_match_data
    if asynchronous code (filter or sentinel) is running. */
@@ -2845,6 +2870,8 @@
       saved_search_regs.num_regs = search_regs.num_regs;
       saved_search_regs.start = search_regs.start;
       saved_search_regs.end = search_regs.end;
+      saved_last_thing_searched = last_thing_searched;
+      last_thing_searched = Qnil;
       search_regs.num_regs = 0;
       search_regs.start = 0;
       search_regs.end = 0;
@@ -2867,7 +2894,8 @@
       search_regs.num_regs = saved_search_regs.num_regs;
       search_regs.start = saved_search_regs.start;
       search_regs.end = saved_search_regs.end;
-
+      last_thing_searched = saved_last_thing_searched;
+      saved_last_thing_searched = Qnil;
       search_regs_saved = 0;
     }
 }
--- a/src/syntax.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/syntax.c	Thu Jun 24 07:44:13 2004 +0000
@@ -1455,7 +1455,7 @@
 	    {
 	      const unsigned char *class_beg = str + i_byte + 1;
 	      const unsigned char *class_end = class_beg;
-	      const unsigned char *class_limit = str + size_byte;
+	      const unsigned char *class_limit = str + size_byte - 2;
 	      /* Leave room for the null.	 */
 	      unsigned char class_name[CHAR_CLASS_MAX_LENGTH + 1];
 	      re_wctype_t cc;
@@ -1463,17 +1463,13 @@
 	      if (class_limit - class_beg > CHAR_CLASS_MAX_LENGTH)
 		class_limit = class_beg + CHAR_CLASS_MAX_LENGTH;
 
-	      while (class_end != class_limit
-		     && ! (*class_end >= 0200
-			   || *class_end <= 040
-			   || (*class_end == ':'
-			       && class_end[1] == ']')))
+	      while (class_end < class_limit
+		     && *class_end >= 'a' && *class_end <= 'z')
 		class_end++;
 
-	      if (class_end == class_limit
-		  || *class_end >= 0200
-		  || *class_end <= 040)
-		error ("Invalid ISO C character class");
+	      if (class_end == class_beg
+		  || *class_end != ':' || class_end[1] != ']')
+		goto not_a_class_name;
 
 	      bcopy (class_beg, class_name, class_end - class_beg);
 	      class_name[class_end - class_beg] = 0;
@@ -1488,6 +1484,7 @@
 	      continue;
 	    }
 
+	not_a_class_name:
 	  if (c == '\\')
 	    {
 	      if (i_byte == size_byte)
--- a/src/window.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/window.c	Thu Jun 24 07:44:13 2004 +0000
@@ -6506,9 +6506,10 @@
 An element of the list can be a list instead of just a string.
 There are two ways to use a list as an element:
   (BUFFER FRAME-PARAMETERS...)   (BUFFER FUNCTION OTHER-ARGS...)
-In the first case, FRAME-PARAMETERS are used to create the frame.
-In the latter case, FUNCTION is called with BUFFER as the first argument,
-followed by OTHER-ARGS--it can display BUFFER in any way it likes.
+In the first case, the FRAME-PARAMETERS are pairs of the form
+\(PARAMETER . VALUE); these parameter values are used to create the frame.
+In the second case, FUNCTION is called with BUFFER as the first argument,
+followed by the OTHER-ARGS--it can display BUFFER in any way it likes.
 All this is done by the function found in `special-display-function'.
 
 If the specified frame parameters include (same-buffer . t), the
@@ -6531,9 +6532,10 @@
 An element of the list can be a list instead of just a string.
 There are two ways to use a list as an element:
   (REGEXP FRAME-PARAMETERS...)   (REGEXP FUNCTION OTHER-ARGS...)
-In the first case, FRAME-PARAMETERS are used to create the frame.
-In the latter case, FUNCTION is called with the buffer as first argument,
-followed by OTHER-ARGS--it can display the buffer in any way it likes.
+In the first case, the FRAME-PARAMETERS are pairs of the form
+\(PARAMETER . VALUE); these parameter values are used to create the frame.
+In the second case, FUNCTION is called with BUFFER as the first argument,
+followed by the OTHER-ARGS--it can display the buffer in any way it likes.
 All this is done by the function found in `special-display-function'.
 
 If the specified frame parameters include (same-buffer . t), the
--- a/src/window.h	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/window.h	Thu Jun 24 07:44:13 2004 +0000
@@ -1,5 +1,5 @@
 /* Window definitions for GNU Emacs.
-   Copyright (C) 1985, 1986, 1993, 1995, 1997, 1998, 1999, 2000, 2001, 2003
+   Copyright (C) 1985,86,93,95,97,98,99, 2000,01,03,04
    Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
--- a/src/xdisp.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/xdisp.c	Thu Jun 24 07:44:13 2004 +0000
@@ -6311,6 +6311,7 @@
   char *buffer;
   int len;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
+  USE_SAFE_ALLOCA;
 
   /* Do nothing if called asynchronously.  Inserting text into
      a buffer may call after-change-functions and alike and
@@ -6327,10 +6328,12 @@
   msg = Fformat (3, args);
 
   len = SBYTES (msg) + 1;
-  buffer = (char *) alloca (len);
+  SAFE_ALLOCA (buffer, char *, len);
   bcopy (SDATA (msg), buffer, len);
 
   message_dolog (buffer, len - 1, 1, 0);
+  SAFE_FREE (len);
+
   UNGCPRO;
 }
 
@@ -11263,7 +11266,7 @@
       && (FRAME_WINDOW_P (f)
 	  || !overlay_arrow_in_current_buffer_p ()))
     {
-      int this_scroll_margin;
+      int this_scroll_margin, top_scroll_margin;
       struct glyph_row *row = NULL;
 
 #if GLYPH_DEBUG
@@ -11276,6 +11279,10 @@
       this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4);
       this_scroll_margin *= FRAME_LINE_HEIGHT (f);
 
+      top_scroll_margin = this_scroll_margin;
+      if (WINDOW_WANTS_HEADER_LINE_P (w))
+	top_scroll_margin += CURRENT_HEADER_LINE_HEIGHT (w);
+
       /* Start with the row the cursor was displayed during the last
 	 not paused redisplay.  Give up if that row is not valid.  */
       if (w->last_cursor.vpos < 0
@@ -11336,7 +11343,7 @@
 		     && (MATRIX_ROW_START_CHARPOS (row) > PT
 			 || (MATRIX_ROW_START_CHARPOS (row) == PT
 			     && MATRIX_ROW_STARTS_IN_MIDDLE_OF_CHAR_P (row)))
-		     && (row->y > this_scroll_margin
+		     && (row->y > top_scroll_margin
 			 || CHARPOS (startp) == BEGV))
 		{
 		  xassert (row->enabled_p);
@@ -11364,7 +11371,7 @@
 		++row;
 
 	      /* If within the scroll margin, scroll.  */
-	      if (row->y < this_scroll_margin
+	      if (row->y < top_scroll_margin
 		  && CHARPOS (startp) != BEGV)
 		scroll_p = 1;
 	    }
@@ -12537,9 +12544,8 @@
 	 position.  */
       if (pt_row)
 	{
-	  w->cursor.vpos -= MATRIX_ROW_VPOS (first_reusable_row,
-					     w->current_matrix);
-	  w->cursor.y -= first_reusable_row->y;
+	  w->cursor.vpos -= nrows_scrolled;
+	  w->cursor.y -= first_reusable_row->y - start_row->y;
 	}
 
       /* Scroll the display.  */
@@ -12584,6 +12590,29 @@
       for (row -= nrows_scrolled; row < bottom_row; ++row)
 	row->enabled_p = 0;
 
+      /* Point may have moved to a different line, so we cannot assume that
+	 the previous cursor position is valid; locate the correct row.  */
+      if (pt_row)
+	{
+	  for (row = MATRIX_ROW (w->current_matrix, w->cursor.vpos);
+	       row < bottom_row && PT >= MATRIX_ROW_END_CHARPOS (row);
+	       row++)
+	    {
+	      w->cursor.vpos++;
+	      w->cursor.y = row->y;
+	    }
+	  if (row < bottom_row)
+	    {
+	      struct glyph *glyph = row->glyphs[TEXT_AREA] + w->cursor.hpos;
+	      while (glyph->charpos < PT)
+		{
+		  w->cursor.hpos++;
+		  w->cursor.x += glyph->pixel_width;
+		  glyph++;
+		}
+	    }
+	}
+
       /* Adjust window end.  A null value of last_text_row means that
 	 the window end is in reused rows which in turn means that
 	 only its vpos can have changed.  */
@@ -13367,9 +13396,9 @@
 
     if ((w->cursor.y < this_scroll_margin
 	 && CHARPOS (start) > BEGV)
-	/* Don't take scroll margin into account at the bottom because
-	   old redisplay didn't do it either.  */
-	|| w->cursor.y + cursor_height > it.last_visible_y)
+	/* 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 + cursor_height + this_scroll_margin > it.last_visible_y)
       {
 	w->cursor.vpos = -1;
 	clear_glyph_matrix (w->desired_matrix);
--- a/src/xfaces.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/xfaces.c	Thu Jun 24 07:44:13 2004 +0000
@@ -3899,12 +3899,13 @@
 DEFUN ("internal-copy-lisp-face", Finternal_copy_lisp_face,
        Sinternal_copy_lisp_face, 4, 4, 0,
        doc: /* Copy face FROM to TO.
-If FRAME is t, copy the global face definition of FROM to the
-global face definition of TO.  Otherwise, copy the frame-local
-definition of FROM on FRAME to the frame-local definition of TO
-on NEW-FRAME, or FRAME if NEW-FRAME is nil.
-
-Value is TO.  */)
+If FRAME is t, copy the global face definition of FROM.
+Otherwise, copy the frame-local definition of FROM on FRAME.
+If NEW-FRAME is a frame, copy that data into the frame-local
+definition of TO on NEW-FRAME.  If NEW-FRAME is nil.
+FRAME controls where the data is copied to.
+
+The value is TO.  */)
      (from, to, frame, new_frame)
      Lisp_Object from, to, frame, new_frame;
 {
@@ -3912,8 +3913,6 @@
 
   CHECK_SYMBOL (from);
   CHECK_SYMBOL (to);
-  if (NILP (new_frame))
-    new_frame = frame;
 
   if (EQ (frame, Qt))
     {
@@ -3925,6 +3924,8 @@
   else
     {
       /* Copy frame-local definition of FROM.  */
+      if (NILP (new_frame))
+	new_frame = frame;
       CHECK_LIVE_FRAME (frame);
       CHECK_LIVE_FRAME (new_frame);
       lface = lface_from_face_name (XFRAME (frame), from, 1);
--- a/src/xselect.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/xselect.c	Thu Jun 24 07:44:13 2004 +0000
@@ -1,5 +1,5 @@
 /* X Selection processing for Emacs.
-   Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2003
+   Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2004
    Free Software Foundation.
 
 This file is part of GNU Emacs.
@@ -2608,7 +2608,7 @@
   if (event.xclient.format != 8 && event.xclient.format != 16
       && event.xclient.format != 32)
     error ("FORMAT must be one of 8, 16 or 32");
-  
+
   if (FRAMEP (dest) || NILP (dest))
     {
       struct frame *fdest = check_x_frame (dest);
--- a/src/xsmfns.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/xsmfns.c	Thu Jun 24 07:44:13 2004 +0000
@@ -1,6 +1,6 @@
 /* Session management module for systems which understand the X Session
    management protocol.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
--- a/src/xterm.c	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/xterm.c	Thu Jun 24 07:44:13 2004 +0000
@@ -1,5 +1,5 @@
 /* X Communication module for terminals which understand the X protocol.
-   Copyright (C) 1989, 93, 94, 95, 96, 97, 98, 1999, 2000, 01, 02, 2003
+   Copyright (C) 1989, 93, 94, 95, 96, 97, 98, 1999, 2000,01,02,03,04
    Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -2359,8 +2359,8 @@
 	  XGCValues xgcv;
 
 	  xgcv.clip_mask = s->img->mask;
-	  xgcv.clip_x_origin = x;
-	  xgcv.clip_y_origin = y;
+	  xgcv.clip_x_origin = x - s->slice.x;
+	  xgcv.clip_y_origin = y - s->slice.y;
 	  xgcv.function = GXcopy;
 	  XChangeGC (s->display, s->gc, mask, &xgcv);
 
--- a/src/xterm.h	Tue Jun 15 18:46:31 2004 +0000
+++ b/src/xterm.h	Thu Jun 24 07:44:13 2004 +0000
@@ -1,5 +1,5 @@
 /* Definitions and headers for communication with X protocol.
-   Copyright (C) 1989, 1993, 1994, 1998, 1999, 2000, 2001, 2001
+   Copyright (C) 1989, 1993, 1994, 1998, 1999, 2000,01,02,03,04
    Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.