changeset 83163:8e4ea1e2c254

Merged in changes from CVS trunk. Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-420 Tweak permissions * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-421 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-422 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-423 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-424 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-425 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-426 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-203
author Karoly Lorentey <lorentey@elte.hu>
date Mon, 28 Jun 2004 16:04:52 +0000
parents dbcd0af66869 (current diff) 39084f238fe5 (diff)
children e8df1878cfd1
files etc/FOR-RELEASE lisp/ChangeLog lisp/font-lock.el man/ChangeLog src/alloc.c src/emacs.c src/lisp.h
diffstat 30 files changed, 714 insertions(+), 272 deletions(-) [+]
line wrap: on
line diff
--- a/admin/ChangeLog	Thu Jun 24 07:44:13 2004 +0000
+++ b/admin/ChangeLog	Mon Jun 28 16:04:52 2004 +0000
@@ -1,3 +1,7 @@
+2002-06-26  Eli Zaretskii  <eliz@is.elta.co.il>
+
+	* FOR-RELEASE: Moved here from the etc directory.
+
 2004-05-08  Thien-Thi Nguyen  <ttn@gnu.org>
 
 	* notes/BRANCH: New file, to be maintained per CVS branch.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/admin/FOR-RELEASE	Mon Jun 28 16:04:52 2004 +0000
@@ -0,0 +1,24 @@
+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.
+
+** Add missing years in copyright notices of all files.
+
+** 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/ChangeLog	Thu Jun 24 07:44:13 2004 +0000
+++ b/etc/ChangeLog	Mon Jun 28 16:04:52 2004 +0000
@@ -1,3 +1,14 @@
+2002-06-26  Eli Zaretskii  <eliz@is.elta.co.il>
+
+	* FOR-RELEASE: Moved to the admin directory.
+
+2004-06-24  David Kastrup  <dak@gnu.org>
+
+	* NEWS: Move description from new paragraph-start and
+	indent-line-function defaults to general news instead of new
+	packages.  Same for query-replace-skip-read-only.  Add
+	description of new `\,' and `\?' replacement string features.
+
 2004-06-23  Luc Teirlinck  <teirllm@auburn.edu>
 
 	* MORE.STUFF: Delete obsolete URL.
--- a/etc/FOR-RELEASE	Thu Jun 24 07:44:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-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/NEWS	Thu Jun 24 07:44:13 2004 +0000
+++ b/etc/NEWS	Mon Jun 28 16:04:52 2004 +0000
@@ -913,6 +913,23 @@
 buffers to search by their filename.  Internally, Occur mode has been
 rewritten, and now uses font-lock, among other changes.
 
+** The default values of paragraph-start and indent-line-function have
+been changed to reflect those used in Text mode rather than those used
+in Indented-Text mode.
+
+** New user option `query-replace-skip-read-only': when non-nil,
+`query-replace' and related functions simply ignore
+a match if part of it has a read-only property.
+
+** When used interactively, the commands `query-replace-regexp' and
+`replace-regexp' allow \,expr to be used in a replacement string,
+where expr is an arbitrary Lisp expression evaluated at replacement
+time.  In many cases, this will be more convenient than using
+`query-replace-regexp-eval'.  All regular expression replacement
+commands now allow `\?' in the replacement string to specify a
+position where the replacement string can be edited for each
+replacement.
+
 +++
 ** Emacs normally highlights mouse sensitive text whenever the mouse
 is over the text.  By setting the new variable `mouse-highlight', you
@@ -2135,14 +2152,6 @@
 ** New package benchmark.el contains simple support for convenient
 timing measurements of code (including the garbage collection component).
 
-** The default values of paragraph-start and indent-line-function have
-been changed to reflect those used in Text mode rather than those used
-in Indented-Text mode.
-
-** If you set `query-replace-skip-read-only' non-nil,
-`query-replace' and related functions simply ignore
-a match if part of it has a read-only property.
-
 ** The new Lisp library fringe.el controls the apperance of fringes.
 
 ** `cfengine-mode' is a major mode for editing GNU Cfengine
--- a/lisp/ChangeLog	Thu Jun 24 07:44:13 2004 +0000
+++ b/lisp/ChangeLog	Mon Jun 28 16:04:52 2004 +0000
@@ -1,3 +1,67 @@
+2004-06-26  David Kastrup  <dak@gnu.org>
+
+	* replace.el (perform-replace): Highlight the match even in
+	non-query mode if there is potential replace string editing.
+
+2004-06-26  Kai Grossjohann  <kai.grossjohann@gmx.net>
+
+	* net/tramp.el (tramp-handle-file-remote-p): New implementation to
+	agree with new return value of `file-remote-p'.
+	This syncs with Tramp 2.0.42.
+
+	* net/ange-ftp.el (ange-ftp-file-remote-p): New return value,
+	according to new documentation of `file-remote-p'.
+
+	* files.el (file-remote-p): Fix doc to say that return value is
+	identification of remote system, if not nil.
+	(file-relative-name): Use new return value of `file-remote-p'.
+
+2004-06-26  Nick Roberts  <nickrob@gnu.org>
+
+	* progmodes/gdb-ui.el (gdb-toggle-breakpoint) 
+	(gdb-goto-breakpoint): Fix breakage.
+
+2004-06-26  Eli Zaretskii  <eliz@gnu.org>
+
+	* man.el (Man-getpage-in-background): Add windows-nt to the list
+	of systems where shell-file-name should be used instead of
+	literal "sh".
+
+2004-06-25  Sam Steingold  <sds@gnu.org>
+
+	* add-log.el (change-log-font-lock-keywords): Support Common Lisp
+	function names `(setf symbol)'.
+
+2004-06-24  Richard M. Stallman  <rms@gnu.org>
+
+	* replace.el (query-replace-read-args): Swallow space after \,SYMBOL.
+
+	* font-lock.el (font-lock-keywords): Change format of compiled values.
+	Document it.
+	(font-lock-add-keywords): If font-lock-keywords is compiled,
+	extract the uncompiled version, modify, then recompile.
+	(font-lock-remove-keywords): Likewise.
+	(font-lock-fontify-keywords-region): Handle changed format.
+	(font-lock-compile-keywords): Handle changed format.
+	(font-lock-set-defaults): Compile the keywords explicitly here.
+
+2004-06-24  David Kastrup  <dak@gnu.org>
+
+	* replace.el (query-replace-read-args): Implement `\,' and `\#'
+	replacements here.
+	(query-replace-regexp): Doc string explaining this and the new
+	`\?' replacement.  Remove `\,' and `\#' implementation here, as it
+	is better placed in `query-replace-read-args'.
+	(replace-regexp): Explain `\,', `\#' and `\?'.
+	(replace-match-data): New function for thorough reuse/destruction
+	of old match-data.
+	(replace-match-maybe-edit): Function for implementing `\?'
+	editing.
+	(perform-replace): Fix maintaining of the match stack including
+	already matched regions, implement `\?', fix various problems
+	with regions while editing and other stuff.
+	(replace-highlight): Simplified.
+
 2004-06-24  Daniel Pfeiffer  <occitan@esperanto.org>
 
 	* progmodes/grep.el (grep-error-screen-columns): New variable.
--- a/lisp/add-log.el	Thu Jun 24 07:44:13 2004 +0000
+++ b/lisp/add-log.el	Mon Jun 28 16:04:52 2004 +0000
@@ -230,13 +230,16 @@
      ;; Possibly further names in a list:
      ("\\=, \\([^ ,:([\n]+\\)" nil nil (1 'change-log-file-face))
      ;; Possibly a parenthesized list of names:
-     ("\\= (\\([^) ,\n]+\\)" nil nil (1 'change-log-list-face))
-     ("\\=, *\\([^) ,\n]+\\)" nil nil (1 'change-log-list-face)))
+     ("\\= (\\([^() ,\n]+\\|(\\(setf\\|SETF\\) [^() ,\n]+)\\)"
+      nil nil (1 'change-log-list-face))
+     ("\\=, *\\([^() ,\n]+\\|(\\(setf\\|SETF\\) [^() ,\n]+)\\)"
+      nil nil (1 'change-log-list-face)))
     ;;
     ;; Function or variable names.
-    ("^\t(\\([^) ,\n]+\\)"
+    ("^\t(\\([^() ,\n]+\\|(\\(setf\\|SETF\\) [^() ,\n]+)\\)"
      (1 'change-log-list-face)
-     ("\\=, *\\([^) ,\n]+\\)" nil nil (1 'change-log-list-face)))
+     ("\\=, *\\([^() ,\n]+\\|(\\(setf\\|SETF\\) [^() ,\n]+)\\)" nil nil
+      (1 'change-log-list-face)))
     ;;
     ;; Conditionals.
     ("\\[!?\\([^]\n]+\\)\\]\\(:\\| (\\)" (1 'change-log-conditionals-face))
--- a/lisp/files.el	Thu Jun 24 07:44:13 2004 +0000
+++ b/lisp/files.el	Mon Jun 28 16:04:52 2004 +0000
@@ -650,7 +650,13 @@
   (load library))
 
 (defun file-remote-p (file)
-  "Test whether FILE specifies a location on a remote system."
+  "Test whether FILE specifies a location on a remote system.
+Return an identification of the system if the location is indeed
+remote.  The identification of the system may comprise a method
+to access the system and its hostname, amongst other things.
+
+For example, the filename \"/user@host:/foo\" specifies a location
+on the system \"/user@host:\"."
   (let ((handler (find-file-name-handler file 'file-remote-p)))
     (if handler
 	(funcall handler 'file-remote-p file)
@@ -2916,8 +2922,8 @@
 	  (file-name-as-directory (expand-file-name (or directory
 							default-directory))))
     (setq filename (expand-file-name filename))
-    (let ((hf (find-file-name-handler filename 'file-remote-p))
-          (hd (find-file-name-handler directory 'file-remote-p)))
+    (let ((fremote (file-remote-p filename))
+          (dremote (file-remote-p directory)))
       (if ;; Conditions for separate trees
 	  (or
 	   ;; Test for different drives on DOS/Windows
@@ -2925,20 +2931,8 @@
 	    ;; Should `cygwin' really be included here?  --stef
 	    (memq system-type '(ms-dos cygwin windows-nt))
 	    (not (eq t (compare-strings filename 0 2 directory 0 2))))
-	   ;; Test for different remote file handlers
-	   (not (eq hf hd))
 	   ;; Test for different remote file system identification
-	   (and
-	    hf
-	    (let ((re (car (rassq hf file-name-handler-alist))))
-	      (not
-	       (equal
-		(and
-		 (string-match re filename)
-		 (substring filename 0 (match-end 0)))
-		(and
-		 (string-match re directory)
-		 (substring directory 0 (match-end 0))))))))
+	   (not (equal fremote dremote)))
 	  filename
         (let ((ancestor ".")
 	      (filename-dir (file-name-as-directory filename)))
--- a/lisp/font-lock.el	Thu Jun 24 07:44:13 2004 +0000
+++ b/lisp/font-lock.el	Mon Jun 28 16:04:52 2004 +0000
@@ -340,7 +340,15 @@
 
 (defvar font-lock-keywords nil
   "A list of the keywords to highlight.
-Each element should have one of these forms:
+There are two kinds of values: user-level, and compiled.
+
+A user-level keywords list is what a major mode or the user would
+set up.  Normally the list would come from `font-lock-defaults'.
+through selection of a fontification level and evaluation of any
+contained expressions.  You can also alter it by calling
+`font-lock-add-keywords' or `font-lock-remove-keywords' with MODE = nil.
+
+Each element in a user-level keywords list should have one of these forms:
 
  MATCHER
  (MATCHER . MATCH)
@@ -438,7 +446,14 @@
 
 This variable is set by major modes via the variable `font-lock-defaults'.
 Be careful when composing regexps for this list; a poorly written pattern can
-dramatically slow things down!")
+dramatically slow things down!
+
+A compiled keywords list starts with t.  It is produced internal
+by `font-lock-compile-keywords' from a user-level keywords list.
+Its second element is the user-level keywords list that was
+compiled.  The remaining elements have the same form as
+user-level keywords, but normally their values have been
+optimized.")
 
 (defvar font-lock-keywords-alist nil
   "*Alist of `font-lock-keywords' local to a `major-mode'.
@@ -659,16 +674,26 @@
 	 (font-lock-update-removed-keyword-alist mode keywords append))
 	(t
 	 ;; Otherwise set or add the keywords now.
+	 ;; This is a no-op if it has been done already in this buffer.
 	 (font-lock-set-defaults)
- 	 (if (eq append 'set)
- 	     (setq font-lock-keywords keywords)
-	   (font-lock-remove-keywords nil keywords) ;to avoid duplicates
-	   (let ((old (if (eq (car-safe font-lock-keywords) t)
-			  (cdr font-lock-keywords)
-			font-lock-keywords)))
-	     (setq font-lock-keywords (if append
-					  (append old keywords)
-					(append keywords old))))))))
+	 (let ((was-compiled (eq (car font-lock-keywords) t)))
+	   ;; Bring back the user-level (uncompiled) keywords.
+	   (if was-compiled
+	       (setq font-lock-keywords (cadr font-lock-keywords)))
+	   ;; Now modify or replace them.
+	   (if (eq append 'set)
+	       (setq font-lock-keywords keywords)
+	     (font-lock-remove-keywords nil keywords) ;to avoid duplicates
+	     (let ((old (if (eq (car-safe font-lock-keywords) t)
+			    (cdr font-lock-keywords)
+			  font-lock-keywords)))
+	       (setq font-lock-keywords (if append
+					    (append old keywords)
+					  (append keywords old)))))
+	   ;; If the keywords were compiled before, compile them again.
+	   (if was-compiled
+	       (set (make-local-variable 'font-lock-keywords)
+		    (font-lock-compile-keywords keywords t)))))))
 
 (defun font-lock-update-removed-keyword-alist (mode keywords append)
   ;; Update `font-lock-removed-keywords-alist' when adding new
@@ -762,13 +787,21 @@
 	(t
 	 ;; Otherwise remove it immediately.
 	 (font-lock-set-defaults)
-	 (setq font-lock-keywords (copy-sequence font-lock-keywords))
-	 (dolist (keyword keywords)
-	   (setq font-lock-keywords
-		 (delete keyword
-			 ;; The keywords might be compiled.
-			 (delete (font-lock-compile-keyword keyword)
-				 font-lock-keywords)))))))
+	 (let ((was-compiled (eq (car font-lock-keywords) t)))
+	   ;; Bring back the user-level (uncompiled) keywords.
+	   (if was-compiled
+	       (setq font-lock-keywords (cadr font-lock-keywords)))
+
+	   ;; Edit them.
+	   (setq font-lock-keywords (copy-sequence font-lock-keywords))
+	   (dolist (keyword keywords)
+	     (setq font-lock-keywords
+		   (delete keyword font-lock-keywords)))
+
+	   ;; If the keywords were compiled before, compile them again.
+	   (if was-compiled
+	       (set (make-local-variable 'font-lock-keywords)
+		    (font-lock-compile-keywords keywords t)))))))
 
 ;;; Font Lock Support mode.
 
@@ -1349,7 +1382,7 @@
     (setq font-lock-keywords
 	  (font-lock-compile-keywords font-lock-keywords t)))
   (let ((case-fold-search font-lock-keywords-case-fold-search)
-	(keywords (cdr font-lock-keywords))
+	(keywords (cddr font-lock-keywords))
 	(bufname (buffer-name)) (count 0)
 	keyword matcher highlights)
     ;;
@@ -1394,14 +1427,16 @@
 ;; Various functions.
 
 (defun font-lock-compile-keywords (keywords &optional regexp)
-  "Compile KEYWORDS into the form (t KEYWORD ...).
-Here KEYWORD is of the form (MATCHER HIGHLIGHT ...) as shown in the
+  "Compile KEYWORDS into the form (t KEYWORDS COMPILED...)
+Here each COMPILED is of the form (MATCHER HIGHLIGHT ...) as shown in the
 `font-lock-keywords' doc string.
 If REGEXP is non-nil, it means these keywords are used for
 `font-lock-keywords' rather than for `font-lock-syntactic-keywords'."
   (if (eq (car-safe keywords) t)
       keywords
-    (setq keywords (cons t (mapcar 'font-lock-compile-keyword keywords)))
+    (setq keywords
+	  (cons t (cons keywords
+			(mapcar 'font-lock-compile-keyword keywords))))
     (if (and regexp
 	     (eq (or syntax-begin-function
 		     font-lock-beginning-of-syntax-function)
@@ -1512,17 +1547,21 @@
       ;; Variable alist?
       (dolist (x (nthcdr 5 defaults))
 	(set (make-local-variable (car x)) (cdr x)))
-      ;; Setup `font-lock-keywords' last because its value might depend
+      ;; Set up `font-lock-keywords' last because its value might depend
       ;; on other settings (e.g. font-lock-compile-keywords uses
       ;; font-lock-beginning-of-syntax-function).
       (set (make-local-variable 'font-lock-keywords)
-	   (font-lock-compile-keywords (font-lock-eval-keywords keywords) t))
+	   (font-lock-eval-keywords keywords))
       ;; Local fontification?
       (while local
 	(font-lock-add-keywords nil (car (car local)) (cdr (car local)))
 	(setq local (cdr local)))
       (when removed-keywords
-	(font-lock-remove-keywords nil removed-keywords)))))
+	(font-lock-remove-keywords nil removed-keywords))
+      ;; Now compile the keywords.
+      (unless (eq (car font-lock-keywords) t)
+	(set (make-local-variable 'font-lock-keywords)
+	     (font-lock-compile-keywords font-lock-keywords t))))))
 
 ;;; Colour etc. support.
 
--- a/lisp/man.el	Thu Jun 24 07:44:13 2004 +0000
+++ b/lisp/man.el	Mon Jun 28 16:04:52 2004 +0000
@@ -733,7 +733,9 @@
 	(if (fboundp 'start-process)
 	    (set-process-sentinel
 	     (start-process manual-program buffer
-			    (if (eq system-type 'cygwin) shell-file-name "sh")
+			    (if (memq system-type '(cygwin windows-nt))
+				shell-file-name
+			      "sh")
 			    shell-command-switch
 			    (format (Man-build-man-command) man-args))
 	     'Man-bgproc-sentinel)
--- a/lisp/net/ange-ftp.el	Thu Jun 24 07:44:13 2004 +0000
+++ b/lisp/net/ange-ftp.el	Mon Jun 28 16:04:52 2004 +0000
@@ -4117,7 +4117,7 @@
 	  tmp1))))
 
 (defun ange-ftp-file-remote-p (file)
-  (when (ange-ftp-ftp-name file) t))
+  (ange-ftp-replace-name-component file ""))
 
 (defun ange-ftp-load (file &optional noerror nomessage nosuffix)
   (if (ange-ftp-ftp-name file)
--- a/lisp/net/tramp.el	Thu Jun 24 07:44:13 2004 +0000
+++ b/lisp/net/tramp.el	Mon Jun 28 16:04:52 2004 +0000
@@ -3542,7 +3542,14 @@
 
 (defun tramp-handle-file-remote-p (filename)
   "Like `file-remote-p' for tramp files."
-  (when (tramp-tramp-file-p filename) t))
+  (when (tramp-tramp-file-p filename)
+    (with-parsed-tramp-file-name filename nil
+      (make-tramp-file-name
+       :multi-method multi-method
+       :method method
+       :user user
+       :host host
+       :localname ""))))
 
 (defun tramp-handle-insert-file-contents
   (filename &optional visit beg end replace)
--- a/lisp/progmodes/gdb-ui.el	Thu Jun 24 07:44:13 2004 +0000
+++ b/lisp/progmodes/gdb-ui.el	Mon Jun 28 16:04:52 2004 +0000
@@ -29,10 +29,9 @@
 ;; GDB through the GUD buffer in the usual way, but there are also further
 ;; buffers which control the execution and describe the state of your program.
 ;; It separates the input/output of your program from that of GDB, if
-;; required, and displays expressions and their current values in their own
-;; buffers. It also uses features of Emacs 21 such as the display margin for
-;; breakpoints, and the toolbar (see the GDB Graphical Interface section in
-;; the Emacs info manual).
+;; required, and watches expressions in the speedbar. It also uses features of
+;; Emacs 21 such as the fringe/display margin for breakpoints, and the toolbar
+;; (see the GDB Graphical Interface section in the Emacs info manual).
 
 ;; Start the debugger with M-x gdba.
 
@@ -1207,8 +1206,8 @@
        (list
 	(concat
 	 (if (eq ?y (char-after (match-beginning 2)))
-	     gdb-server-prefix "disable "
-	   gdb-server-prefix "enable ")
+	     (concat gdb-server-prefix "disable ")
+	   (concat gdb-server-prefix "enable "))
 	 (match-string 1) "\n")
 	'ignore)))))
 
@@ -1226,10 +1225,12 @@
   (interactive)
   (save-excursion
     (beginning-of-line 1)
-    (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdbmi))
-	(looking-at "[0-9]*\\s-*\\S-*\\s-*\\S-*\\s-*.\\s-*\\S-*\\s-*\\(\\S-*\\):\\([0-9]+\\)")
-      (re-search-forward "in\\s-+\\S-+\\s-+at\\s-+" nil t)
-      (looking-at "\\(\\S-*\\):\\([0-9]+\\)")))
+    (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))
+	(progn
+	  (re-search-forward "in\\s-+\\S-+\\s-+at\\s-+" nil t)
+	  (looking-at "\\(\\S-*\\):\\([0-9]+\\)"))
+    (looking-at
+     "[0-9]*\\s-*\\S-*\\s-*\\S-*\\s-*.\\s-*\\S-*\\s-*\\(\\S-*\\):\\([0-9]+\\)")))
   (if (match-string 2)
       (let ((line (match-string 2))
 	    (file (match-string 1)))
--- a/lisp/replace.el	Thu Jun 24 07:44:13 2004 +0000
+++ b/lisp/replace.el	Mon Jun 28 16:04:52 2004 +0000
@@ -95,6 +95,40 @@
       (setq to (read-from-minibuffer (format "%s %s with: " string from)
 				     nil nil nil
 				     query-replace-to-history-variable from t)))
+    (when (and regexp-flag
+	       (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\\\[,#]" to))
+      (let (pos list char)
+	(while
+	    (progn
+	      (setq pos (match-end 0))
+	      (push (substring to 0 (- pos 2)) list)
+	      (setq char (aref to (1- pos))
+		    to (substring to pos))
+	      (cond ((eq char ?\#)
+		     (push '(number-to-string replace-count) list))
+		    ((eq char ?\,)
+		     (setq pos (read-from-string to))
+		     (push `(replace-quote ,(car pos)) list)
+		     (let ((end
+			    ;; Swallow a space after a symbol
+			    ;; if there is a space.
+			    (if (and (or (symbolp (car pos))
+					 ;; Swallow a space after 'foo
+					 ;; but not after (quote foo).
+					 (and (eq (car-safe (car pos)) 'quote)
+					      (= ?\( (aref to-string 0))))
+				     (equal " " (substring to-string (cdr pos)
+							   (1+ (cdr pos)))))
+				(1+ (cdr pos))
+			      (cdr pos))))
+		       (setq to (substring to end)))))
+	      (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\\\[,#]" to)))
+	(setq to (nreverse (delete "" (cons to list)))))
+      (replace-match-string-symbols to)
+      (setq to (cons 'replace-eval-replacement 
+		     (if (> (length to) 1)
+			 (cons 'concat to)
+		       (car to)))))
     (list from to current-prefix-arg)))
 
 (defun query-replace (from-string to-string &optional delimited start end)
@@ -163,59 +197,35 @@
 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.
-
-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'.
+`\\?' lets you edit the replacement text in the minibuffer
+at the given position for each replacement.
 
-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.
+In interactive calls, the replacement text can contain `\\,'
+followed by a Lisp expression.  Each
+replacement evaluates that expression to compute the replacement
+string.  Inside of that expression, `\\&' is a string denoting the
+whole match as a sting, `\\N' for a partial match, `\\#&' and `\\#N'
+for the whole or a partial match converted to a number with
+`string-to-number', and `\\#' itself for the number of replacements
+done so far (starting with zero).
 
-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."
+If the replacement expression is a symbol, write a space after it
+to terminate it.  One space there, if any, will be discarded.
+
+When using those Lisp features interactively in the replacement
+text, TO-STRING is actually made a list instead of a string.
+Use \\[repeat-complex-command] after this command for details."
   (interactive
    (let ((common
 	  (query-replace-read-args "Query replace regexp" t)))
-     (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)))))
+     (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)))))
   (perform-replace regexp to-string t t delimited nil nil start end))
 
 (define-key esc-map [?\C-%] 'query-replace-regexp)
@@ -374,7 +384,27 @@
 
 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.
+`\\?' lets you edit the replacement text in the minibuffer
+at the given position for each replacement.
+
+In interactive calls, the replacement text may contain `\\,'
+followed by a Lisp expression used as part of the replacement
+text.  Inside of that expression, `\\&' is a string denoting the
+whole match, `\\N' a partial matches, `\\#&' and `\\#N' the
+respective numeric values from `string-to-number', and `\\#'
+itself for `replace-count', the number of replacements occured so
+far.
+
+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 using those Lisp features interactively in the replacement
+text, TO-STRING is actually made a list instead of a string.
+Use \\[repeat-complex-command] after this command for details.
 
 If `query-replace-interactive' is non-nil, the last incremental search
 regexp is used as REGEXP--you don't have to specify it with the minibuffer.
@@ -1115,6 +1145,49 @@
           (aset data 2 (if (consp next) next (aref data 3))))))
   (car (aref data 2)))
 
+(defun replace-match-data (integers reuse &optional new)
+  "Like `match-data', but markers in REUSE get invalidated.
+If NEW is non-NIL, it is set and returned instead of fresh data,
+but coerced to the correct value of INTEGERS."
+  (or (and new
+	   (progn
+	     (set-match-data new)
+	     (and (eq new reuse)
+		  (eq (null integers) (markerp (car reuse)))
+		  new)))
+      (match-data integers
+		  (prog1 reuse
+		    (while reuse
+		      (if (markerp (car reuse))
+			  (set-marker (car reuse) nil))
+		      (setq reuse (cdr reuse)))))))
+
+(defun replace-match-maybe-edit (newtext fixedcase literal noedit match-data)
+  "Make a replacement with `replace-match', editing `\\?'.
+NEXTEXT, FIXEDCASE, LITERAL are just passed on.  If NOEDIT is true, no
+check for `\\?' is made to save time.  MATCH-DATA is used for the
+replacement.  In case editing is done, it is changed to use markers.
+
+The return value is non-NIL if there has been no `\\?' or NOEDIT was
+passed in.  If LITERAL is set, no checking is done, anyway."
+  (unless (or literal noedit)
+    (setq noedit t)
+    (while (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\(\\\\\\?\\)"
+			 newtext)
+      (setq newtext
+	    (read-input "Edit replacement string: "
+			(prog1
+			    (cons
+			     (replace-match "" t t newtext 3)
+			     (1+ (match-beginning 3)))
+			  (setq match-data
+				(replace-match-data
+				 nil match-data match-data))))
+	    noedit nil)))
+  (set-match-data match-data)
+  (replace-match newtext fixedcase literal)
+  noedit)
+
 (defun perform-replace (from-string replacements
 		        query-flag regexp-flag delimited-flag
 			&optional repeat-count map start end)
@@ -1145,6 +1218,7 @@
 	(search-string from-string)
 	(real-match-data nil)		; the match data for the current match
 	(next-replacement nil)
+	(noedit nil)
 	(keep-going t)
 	(stack nil)
 	(replace-count 0)
@@ -1201,7 +1275,9 @@
 		    (setq real-match-data
 			  (if (consp match-again)
 			      (progn (goto-char (nth 1 match-again))
-				     match-again)
+				     (replace-match-data t
+				      real-match-data
+				      match-again))
 			    (and (or match-again
 				     ;; MATCH-AGAIN non-nil means we
 				     ;; accept an adjacent match.  If
@@ -1217,7 +1293,7 @@
 				 (funcall search-function search-string limit t)
 				 ;; For speed, use only integers and
 				 ;; reuse the list used last time.
-				 (match-data t real-match-data)))))
+				 (replace-match-data t real-match-data)))))
 	  ;; Optionally ignore matches that have a read-only property.
 	  (unless (and query-replace-skip-read-only
 		       (text-property-not-all
@@ -1249,16 +1325,27 @@
 	      (set-match-data real-match-data)
 	      (setq next-replacement
 		    (funcall (car replacements) (cdr replacements)
-			     replace-count)))
+			     replace-count)
+		    noedit nil))
 	    (if (not query-flag)
-		(let ((inhibit-read-only query-replace-skip-read-only))
-		  (set-match-data real-match-data)
-		  (replace-match next-replacement nocasify literal)
-		  (setq replace-count (1+ replace-count)))
+		(let ((inhibit-read-only
+		       query-replace-skip-read-only))
+		  (unless noedit
+		    (replace-highlight (nth 0 real-match-data)
+				       (nth 1 real-match-data)))
+		  (setq noedit
+			(replace-match-maybe-edit
+			 next-replacement nocasify literal
+			 noedit real-match-data)
+			replace-count (1+ replace-count)))
 	      (undo-boundary)
 	      (let (done replaced key def)
 		;; Loop reading commands until one of them sets done,
-		;; which means it has finished handling this occurrence.
+		;; which means it has finished handling this
+		;; occurrence.  Any command that sets `done' should
+		;; leave behind proper match data for the stack.
+		;; Commands not setting `done' need to adjust
+		;; `real-match-data'.
 		(while (not done)
 		  (set-match-data real-match-data)
 		  (replace-highlight (match-beginning 0) (match-end 0))
@@ -1290,37 +1377,49 @@
 			((eq def 'backup)
 			 (if stack
 			     (let ((elt (pop stack)))
-			       (goto-char (car elt))
-			       (setq replaced (eq t (cdr elt)))
-			       (or replaced
-				   (set-match-data (cdr elt))))
+			       (goto-char (nth 0 elt))
+			       (setq replaced (nth 1 elt)
+				     real-match-data
+				     (replace-match-data
+				      t real-match-data
+				      (nth 2 elt))))
 			   (message "No previous match")
 			   (ding 'no-terminate)
 			   (sit-for 1)))
 			((eq def 'act)
 			 (or replaced
-			     (progn
-			       (replace-match next-replacement nocasify literal)
-			       (setq replace-count (1+ replace-count))))
+			     (setq noedit
+				   (replace-match-maybe-edit
+				    next-replacement nocasify literal
+				    noedit real-match-data)
+				   replace-count (1+ replace-count)))
 			 (setq done t replaced t))
 			((eq def 'act-and-exit)
 			 (or replaced
-			     (progn
-			       (replace-match next-replacement nocasify literal)
-			       (setq replace-count (1+ replace-count))))
+			     (setq noedit
+				   (replace-match-maybe-edit 
+				    next-replacement nocasify literal
+				    noedit real-match-data)
+				   replace-count (1+ replace-count)))
 			 (setq keep-going nil)
 			 (setq done t replaced t))
 			((eq def 'act-and-show)
 			 (if (not replaced)
-			     (progn
-			       (replace-match next-replacement nocasify literal)
-			       (setq replace-count (1+ replace-count))
-			       (setq replaced t))))
+			     (setq noedit
+				   (replace-match-maybe-edit
+				    next-replacement nocasify literal
+				    noedit real-match-data)
+				   replace-count (1+ replace-count)
+				   real-match-data (replace-match-data
+						    t real-match-data)
+				   replaced t)))
 			((eq def 'automatic)
 			 (or replaced
-			     (progn
-			       (replace-match next-replacement nocasify literal)
-			       (setq replace-count (1+ replace-count))))
+			     (setq noedit
+				   (replace-match-maybe-edit
+				    next-replacement nocasify literal
+				    noedit real-match-data)
+				   replace-count (1+ replace-count)))
 			 (setq done t query-flag nil replaced t))
 			((eq def 'skip)
 			 (setq done t))
@@ -1328,36 +1427,45 @@
 			 (recenter nil))
 			((eq def 'edit)
 			 (let ((opos (point-marker)))
+			   (setq real-match-data (replace-match-data
+						  nil real-match-data
+						  real-match-data))
 			   (goto-char (match-beginning 0))
 			   (save-excursion
-			     (funcall search-function search-string limit t)
-			     (setq real-match-data (match-data)))
-			   (save-excursion
 			     (save-window-excursion
 			       (recursive-edit)))
-			   (goto-char opos))
-			 (set-match-data real-match-data)
+			   (goto-char opos)
+			   (set-marker opos nil))
 			 ;; Before we make the replacement,
 			 ;; decide whether the search string
 			 ;; can match again just after this match.
 			 (if (and regexp-flag nonempty-match)
 			     (setq match-again (and (looking-at search-string)
 						    (match-data)))))
-
 			;; Edit replacement.
 			((eq def 'edit-replacement)
-			 (setq next-replacement
+			 (setq real-match-data (replace-match-data
+						nil real-match-data
+						real-match-data)
+			       next-replacement
 			       (read-input "Edit replacement string: "
-					   next-replacement))
-			 (or replaced
-			     (replace-match next-replacement nocasify literal))
+					   next-replacement)
+			       noedit nil)
+			 (if replaced
+			     (set-match-data real-match-data)
+			   (setq noedit
+				 (replace-match-maybe-edit
+				  next-replacement nocasify literal noedit
+				  real-match-data)
+				 replaced t))
 			 (setq done t))
 
 			((eq def 'delete-and-edit)
-			 (delete-region (match-beginning 0) (match-end 0))
-			 (set-match-data
-			  (prog1 (match-data)
-			    (save-excursion (recursive-edit))))
+			 (replace-match "" t t)
+			 (setq real-match-data (replace-match-data
+						nil real-match-data))
+			 (replace-dehighlight)
+			 (save-excursion (recursive-edit))
 			 (setq replaced t))
 			;; Note: we do not need to treat `exit-prefix'
 			;; specially here, since we reread
@@ -1372,10 +1480,23 @@
 		;; Record previous position for ^ when we move on.
 		;; Change markers to numbers in the match data
 		;; since lots of markers slow down editing.
-		(setq stack
-		      (cons (cons (point)
-				  (or replaced (match-data t)))
-			    stack))))))
+		(push (list (point) replaced
+;;; If the replacement has already happened, all we need is the
+;;; current match start and end.  We could get this with a trivial
+;;; match like
+;;; (save-excursion (goto-char (match-beginning 0))
+;;;		    (search-forward (match-string 0))
+;;;                 (match-data t))
+;;; if we really wanted to avoid manually constructing match data.
+;;; Adding current-buffer is necessary so that match-data calls can
+;;; return markers which are appropriate for editing.
+			    (if replaced
+				(list
+				 (match-beginning 0)
+				 (match-end 0)
+				 (current-buffer))
+			      (match-data t)))
+		      stack)))))
 
       ;; The code preventing adjacent regexp matches in the condition
       ;; of the while-loop above will haven taken us one character
@@ -1405,14 +1526,12 @@
 
 (defun replace-highlight (start end)
   (and query-replace-highlight
-       (progn
-	 (or replace-overlay
-	     (progn
-	       (setq replace-overlay (make-overlay start end))
-	       (overlay-put replace-overlay 'face
-			    (if (facep 'query-replace)
-				'query-replace 'region))))
-	 (move-overlay replace-overlay start end (current-buffer)))))
+       (if replace-overlay
+	   (move-overlay replace-overlay start end (current-buffer))
+	 (setq replace-overlay (make-overlay start end))
+	 (overlay-put replace-overlay 'face
+		      (if (facep 'query-replace)
+			  'query-replace 'region)))))
 
 ;;; arch-tag: 16b4cd61-fd40-497b-b86f-b667c4cf88e4
 ;;; replace.el ends here
--- a/lisp/woman.el	Thu Jun 24 07:44:13 2004 +0000
+++ b/lisp/woman.el	Mon Jun 28 16:04:52 2004 +0000
@@ -5,7 +5,7 @@
 ;; Author: Francis J. Wright <F.J.Wright@qmul.ac.uk>
 ;; Maintainer: Francis J. Wright <F.J.Wright@qmul.ac.uk>
 ;; Keywords: help, unix
-;; Adapted-By: Eli Zaretskii <eliz@is.elta.co.il>
+;; Adapted-By: Eli Zaretskii <eliz@gnu.org>
 ;; Version: see `woman-version'
 ;; URL: http://centaur.maths.qmul.ac.uk/Emacs/WoMan/
 
--- a/lispref/ChangeLog	Thu Jun 24 07:44:13 2004 +0000
+++ b/lispref/ChangeLog	Mon Jun 28 16:04:52 2004 +0000
@@ -1,3 +1,26 @@
+2004-06-24  Richard M. Stallman  <rms@gnu.org>
+
+	* commands.texi (Misc Events): Describe usr1-signal, usr2-signal event.
+
+	* customize.texi (Variable Definitions): Note about doc strings
+	and :set.
+
+	* keymaps.texi (Keymap Terminology): Document `kbd'.
+	(Changing Key Bindings, Key Binding Commands): Use kbd in examples.
+
+	* display.texi (Invisible Text): Setting buffer-invisibility-spec
+	makes it buffer-local.
+
+	* files.texi (Saving Buffers): Correct previous change.
+
+	* commands.texi (Accessing Events):
+	Clarify posn-col-row and posn-actual-col-row.
+
+2004-06-24  David Ponce  <david.ponce@wanadoo.fr>
+
+	* commands.texi (Accessing Events): New functions
+	posn-at-point and posn-at-x-y.  Add example to posn-x-y.
+
 2004-06-23  Luc Teirlinck  <teirllm@auburn.edu>
 
 	* lists.texi, files.texi, processes.texi, macros.texi, hash.texi:
--- a/lispref/commands.texi	Thu Jun 24 07:44:13 2004 +0000
+++ b/lispref/commands.texi	Mon Jun 28 16:04:52 2004 +0000
@@ -872,7 +872,7 @@
 * Repeat Events::               Double and triple click (or drag, or down).
 * Motion Events::		Just moving the mouse, not pushing a button.
 * Focus Events::		Moving the mouse between frames.
-* Misc Events::                 Other events window systems can generate.
+* Misc Events::                 Other events the system can generate.
 * Event Examples::		Examples of the lists for mouse events.
 * Classifying Events::		Finding the modifier keys in an event symbol.
 				Event types.
@@ -1462,9 +1462,9 @@
 sequence, and not within it.
 
 @node Misc Events
-@subsection Miscellaneous Window System Events
-
-A few other event types represent occurrences within the window system.
+@subsection Miscellaneous System Events
+
+A few other event types represent occurrences within the system.
 
 @table @code
 @cindex @code{delete-frame} event
@@ -1517,6 +1517,14 @@
 
 This kind of event is generated, at present, only on some kinds of
 systems.
+
+@cindex @code{usr1-signal} event
+@cindex @code{usr2-signal} event
+@item usr1-signal
+@itemx usr2-signal
+These events are generated when the Emacs process receives the signals
+@code{SIGUSR1} and @code{SIGUSR2}.  They contain no additional data
+because signals do not carry additional information.
 @end table
 
   If one of these events arrives in the middle of a key sequence---that
@@ -1695,7 +1703,7 @@
 @end defun
 
 @cindex mouse position list, accessing
-  These seven functions take a position list as described above, and
+  These functions take a position list as described above, and
 return various parts of it.
 
 @defun posn-window position
@@ -1716,23 +1724,37 @@
 @end defun
 
 @defun posn-x-y position
-Return the pixel-based x and y coordinates in @var{position}, as a cons
-cell @code{(@var{x} . @var{y})}.
+Return the pixel-based x and y coordinates in @var{position}, as a
+cons cell @code{(@var{x} . @var{y})}.  These coordinates are relative
+to the window given by @code{posn-window}.
+
+This example shows how to convert these window-relative coordinates
+into frame-relative coordinates:
+
+@example
+(defun frame-relative-coordinates (position)
+  "Return frame-relative coordinates from POSITION."
+  (let* ((x-y (posn-x-y position))
+         (window (posn-window position))
+         (edges (window-inside-pixel-edges window)))
+    (cons (+ (car x-y) (car edges))
+          (+ (cdr x-y) (cadr edges)))))
+@end example
 @end defun
 
 @defun posn-col-row position
-Return the row and column (in units of frame default characters) of
-@var{position}, as a cons cell @code{(@var{col} . @var{row})}.  These
-are computed from the @var{x} and @var{y} values actually found in
-@var{position}.
+Return the row and column (in units of the frame's default character
+height and width) of @var{position}, as a cons cell @code{(@var{col} .
+@var{row})}.  These are computed from the @var{x} and @var{y} values
+actually found in @var{position}.
 @end defun
 
 @defun posn-actual-col-row position
 Return the actual row and column in @var{position}, as a cons cell
 @code{(@var{col} . @var{row})}.  The values are the actual row number
-in the window, and the actual character number in that row.  Return
-@code{nil} if @var{position} does not include the actual positions; in that
-case, @code{posn-col-row} can be used to get approximate values.
+in the window, and the actual character number in that row.  It returns
+@code{nil} if @var{position} does not include actual positions values.
+You can use @code{posn-col-row} to get approximate values.
 @end defun
 
 @defun posn-string position
@@ -1771,6 +1793,27 @@
 event occurred, in milliseconds.
 @end defun
 
+  These functions compute a position list given particular buffer
+position or screen position.  You can access the data in this position
+list with the functions described above.
+
+@defun posn-at-point &optional pos window
+This function returns a position list for position @var{pos} in
+@var{window}.  @var{pos} defaults to point in @var{window};
+@var{window} defaults to the selected window.
+
+@code{posn-at-point} returns @code{nil} if @var{pos} is not visible in
+@var{window}.
+@end defun
+
+@defun posn-at-x-y x y &optional frame-or-window
+This function returns position information corresponding to pixel
+coordinates @var{x} and @var{y} in a specified frame or window,
+@var{frame-or-window}, which defaults to the selected window.
+The coordinates @var{x} and @var{y} are relative to the
+frame or window used.
+@end defun
+
   These functions are useful for decoding scroll bar events.
 
 @defun scroll-bar-event-ratio event
--- a/lispref/customize.texi	Thu Jun 24 07:44:13 2004 +0000
+++ b/lispref/customize.texi	Mon Jun 28 16:04:52 2004 +0000
@@ -194,6 +194,11 @@
 @var{default} because they are not expanded when editing the value,
 causing list values to appear to have the wrong structure.
 
+If you specify the @code{:set} option, to make the variable take other
+special actions when set through the customization buffer, the
+variable's documentation string should tell the user specifically how
+to do the same job in hand-written Lisp code.
+
 When you evaluate a @code{defcustom} form with @kbd{C-M-x} in Emacs Lisp
 mode (@code{eval-defun}), a special feature of @code{eval-defun}
 arranges to set the variable unconditionally, without testing whether
--- a/lispref/display.texi	Thu Jun 24 07:44:13 2004 +0000
+++ b/lispref/display.texi	Mon Jun 28 16:04:52 2004 +0000
@@ -562,7 +562,8 @@
 
 @defvar buffer-invisibility-spec
 This variable specifies which kinds of @code{invisible} properties
-actually make a character invisible.
+actually make a character invisible.  Setting this variable makes it
+buffer-local.
 
 @table @asis
 @item @code{t}
--- a/lispref/files.texi	Thu Jun 24 07:44:13 2004 +0000
+++ b/lispref/files.texi	Mon Jun 28 16:04:52 2004 +0000
@@ -416,8 +416,8 @@
 @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 buffer, as opposed to hooks that
-pertain to the file the buffers visits.  Such hooks are usually set up by
+hooks that pertain to the contents of the file, as opposed to hooks that
+pertain to the file's name or location.  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}, the file is considered
 already written and the rest are not called and neither are the functions
--- a/lispref/keymaps.texi	Thu Jun 24 07:44:13 2004 +0000
+++ b/lispref/keymaps.texi	Mon Jun 28 16:04:52 2004 +0000
@@ -95,6 +95,27 @@
 keymaps shadow both local and global keymaps.  @xref{Active Keymaps},
 for details.
 
+  The Emacs Lisp representation for a key sequence is a string or vector.
+You can enter key sequence constants using the ordinary string or vector
+representation; it is also convenient to use @code{kbd}:
+
+@defmac kbd keyseq-text
+This macro converts the text @var{keyseq-text} (a string constant)
+into a key sequence (a string or vector constant).  The contents
+of @var{keyseq-text} should describe the key sequence using the syntax
+used in this manual:
+
+@example
+(kbd "C-x") @result{} "\C-x"
+(kbd "C-x C-f") @result{} "\C-x\C-f"
+(kbd "C-c C-c") @result{} "\C-c\C-c"
+(kbd "C-x 4 C-f") @result{} "\C-x4\C-f"
+(kbd "X") @result{} "X"
+(kbd "RET") @result{} "\^M"
+(kbd "C-c 3") @result{} "\C-c3"
+@end example
+@end defmac
+
 @node Format of Keymaps
 @section Format of Keymaps
 @cindex format of keymaps
@@ -880,6 +901,10 @@
     @result{} find-file
 @end group
 @group
+(lookup-key (current-global-map) (kbd "C-x C-f"))
+    @result{} find-file
+@end group
+@group
 (lookup-key (current-global-map) "\C-x\C-f12345")
     @result{} 2
 @end group
@@ -1126,7 +1151,7 @@
 
 @group
 ;; @r{Build sparse submap for @kbd{C-x} and bind @kbd{f} in that.}
-(define-key map "\C-xf" 'forward-word)
+(define-key map (kbd "C-x f") 'forward-word)
     @result{} forward-word
 @end group
 @group
@@ -1139,14 +1164,14 @@
 
 @group
 ;; @r{Bind @kbd{C-p} to the @code{ctl-x-map}.}
-(define-key map "\C-p" ctl-x-map)
+(define-key map (kbd "C-p") ctl-x-map)
 ;; @code{ctl-x-map}
 @result{} [nil @dots{} find-file @dots{} backward-kill-sentence]
 @end group
 
 @group
 ;; @r{Bind @kbd{C-f} to @code{foo} in the @code{ctl-x-map}.}
-(define-key map "\C-p\C-f" 'foo)
+(define-key map (kbd "C-p C-f") 'foo)
 @result{} 'foo
 @end group
 @group
@@ -1333,7 +1358,7 @@
 (@pxref{Init File}) for simple customization.  For example,
 
 @smallexample
-(global-set-key "\C-x\C-\\" 'next-line)
+(global-set-key (kbd "C-x C-\\") 'next-line)
 @end smallexample
 
 @noindent
--- a/man/ChangeLog	Thu Jun 24 07:44:13 2004 +0000
+++ b/man/ChangeLog	Mon Jun 28 16:04:52 2004 +0000
@@ -1,3 +1,21 @@
+2004-06-25  Richard M. Stallman  <rms@gnu.org>
+
+	* search.texi (Regexp Replace): Rewrite description of \# \, and \?.
+
+2004-06-25  David Kastrup  <dak@gnu.org>
+
+	* search.texi (Regexp Replace): Some typo corrections and
+	rearrangement.
+
+2004-06-24  David Kastrup  <dak@gnu.org>
+
+	* search.texi (Unconditional Replace): Use replace-string instead
+	of query-replace in example.
+	(Regexp Replace): Add explanations for `\,', `\#' and `\?'
+	sequences.
+	(Query Replace): Correct explanation of `^' which does not use
+	the mark stack.
+
 2004-06-21  Nick Roberts  <nickrob@gnu.org>
 
 	* misc.texi (Shell History Copying): Document comint-insert-input.
--- a/man/search.texi	Thu Jun 24 07:44:13 2004 +0000
+++ b/man/search.texi	Mon Jun 28 16:04:52 2004 +0000
@@ -977,9 +977,9 @@
   What if you want to exchange @samp{x} and @samp{y}: replace every @samp{x} with a @samp{y} and vice versa?  You can do it this way:
 
 @example
-M-x query-replace @key{RET} x @key{RET} @@TEMP@@ @key{RET}
-M-x query-replace @key{RET} y @key{RET} x @key{RET}
-M-x query-replace @key{RET} @@TEMP@@ @key{RET} y @key{RET}
+M-x replace-string @key{RET} x @key{RET} @@TEMP@@ @key{RET}
+M-< M-x replace-string @key{RET} y @key{RET} x @key{RET}
+M-< M-x replace-string @key{RET} @@TEMP@@ @key{RET} y @key{RET}
 @end example
 
 @noindent
@@ -993,13 +993,15 @@
 single string.  The similar command @kbd{M-x replace-regexp} replaces
 any match for a specified pattern.
 
-  In @code{replace-regexp}, the @var{newstring} need not be constant: it
-can refer to all or part of what is matched by the @var{regexp}.
-@samp{\&} in @var{newstring} stands for the entire match being replaced.
-@samp{\@var{d}} in @var{newstring}, where @var{d} is a digit, stands for
-whatever matched the @var{d}th parenthesized grouping in @var{regexp}.
-To include a @samp{\} in the text to replace with, you must enter
-@samp{\\}.  For example,
+  In @code{replace-regexp}, the @var{newstring} need not be constant:
+it can refer to all or part of what is matched by the @var{regexp}.
+@samp{\&} in @var{newstring} stands for the entire match being
+replaced.  @samp{\@var{d}} in @var{newstring}, where @var{d} is a
+digit, stands for whatever matched the @var{d}th parenthesized
+grouping in @var{regexp}.  @samp{\#} refers to the count of
+replacements already made in this command, as a decimal number.  In
+the first replacement, @samp{\#} stands for @samp{0}; in the second,
+for @samp{1}; and so on.  For example,
 
 @example
 M-x replace-regexp @key{RET} c[ad]+r @key{RET} \&-safe @key{RET}
@@ -1014,7 +1016,61 @@
 @end example
 
 @noindent
-performs the inverse transformation.
+performs the inverse transformation.  To include a @samp{\} in the
+text to replace with, you must enter @samp{\\}.
+
+  You can also use Lisp expressions to calculate parts of the
+replacement string.  To do this, write @samp{\,} followed by the
+expression in the replacement string.  Each replacement calculates the
+value of the expression, which ought to be a string, and uses it in
+the replacement string in place of the expression itself.  If the
+expression is a symbol, one space in the replacement string after the
+symbol name counts as part of the symbol name, so the value replaces
+them both.
+
+  Inside such an expression, @samp{\&} and @samp{\@var{n}} used as
+subexpressions refer respectively to the entire match as a string, and
+to a submatch as a string.  @var{n} may exceed 9 here, and the value
+of @samp{\@var{n}} is @code{nil} if subexpression @var{n} did not
+match.  You can also use @samp{\#&} and @samp{\#@var{n}} refer to
+those matches converted to numbers (this is valid when the match or
+submatch has the form of a number).  @samp{\#} stands for the number
+of already-completed replacements.
+
+  Repeating our example to exchange @samp{x} and @samp{y}, we can thus
+do it also this way:
+
+@example
+M-x replace-regexp @key{RET} \(x\)\|y @key{RET}
+\,(if \1 "y" "x") @key{RET}
+@end example
+
+  The @code{format} function (@pxref{Formatting Strings,,,elisp, GNU
+Emacs Lisp Reference Manual}) comes in handy for computing replacement
+strings for @samp{\,}.  For example, to add consecutively numbered
+strings like @samp{ABC00042} to columns 73 @w{to 80} (unless they are
+already occupied), you can use
+
+@example
+M-x replace-regexp @key{RET} ^.\@{0,72\@}$ @key{RET}
+\,(format "%-72sABC%05d" \& \#) @key{RET}
+@end example
+
+  If you want to enter part of the replacement string by hand each
+time, use @samp{\?} in the replacement string.  Each replacement will
+enter a recursive edit, with point at the position where the @samp{\?}
+was.  For example,
+
+@example
+M-x replace-regexp @key{RET} \footnote@{ @key{RET}
+\&\\label@{fn:\#\?@} @key{RET}
+@end example
+
+@noindent
+will add labels starting with @samp{\label@{fn:0@}} to occurences of
+@samp{\footnote@{}, but letting you edit each replacement before
+performing it.  To number the labels starting at 1, use @samp{\,(1+
+\#)} instead of @samp{\#}.
 
 @node Replacement and Case, Query Replace, Regexp Replace, Replace
 @subsection Replace Commands and Case
@@ -1126,9 +1182,8 @@
 
 @item ^
 to go back to the position of the previous occurrence (or what used to
-be an occurrence), in case you changed it by mistake.  This works by
-popping the mark ring.  Only one @kbd{^} in a row is meaningful, because
-only one previous replacement position is kept during @code{query-replace}.
+be an occurrence), in case you changed it by mistake or want to
+reexamine it.
 
 @item C-r
 to enter a recursive editing level, in case the occurrence needs to be
--- a/man/trampver.texi	Thu Jun 24 07:44:13 2004 +0000
+++ b/man/trampver.texi	Mon Jun 28 16:04:52 2004 +0000
@@ -4,7 +4,7 @@
 @c In the Tramp CVS, the version number is auto-frobbed from
 @c configure.ac, so you should edit that file and run
 @c "autoconf && ./configure" to change the version number.
-@set trampver 2.0.41
+@set trampver 2.0.42
 
 @c Other flags from configuration
 @set prefix /usr/local
--- a/src/ChangeLog	Thu Jun 24 07:44:13 2004 +0000
+++ b/src/ChangeLog	Mon Jun 28 16:04:52 2004 +0000
@@ -1,11 +1,33 @@
+2004-06-27  Jason Rumney  <jasonr@gnu.org>
+
+	* w32fns.c (file_dialog_callback): Disable edit control if set
+	to directories only on CDN_INITDONE message.
+	(Fx_file_dialog): Default to directories only when prompt starts
+	with "Dired".
+
+2004-06-25  Kim F. Storm  <storm@cua.dk>
+
+	* alloc.c (allocate_misc): Update total_free_markers.
+	(free_misc): New function.
+	(safe_alloca_unwind, free_marker): Use it.
+
+	* lisp.h (free_misc): Add prototype.
+
+	* fns.c (Fmapconcat, Fmapcar): Remove superfluous GCPROs.
+
+2004-06-24  Richard M. Stallman  <rms@gnu.org>
+
+	* emacs.c (Vsignal_USR1_hook, Vsignal_USR2_hook): Definitions deleted.
+	(syms_of_emacs): Lisp variables deleted.
+
 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.
+	* search.c (Freplace_match): Adjust the match-data more thoroughly
+	when replacing strings in the buffer.
+	(Fmatch_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.
--- a/src/alloc.c	Thu Jun 24 07:44:13 2004 +0000
+++ b/src/alloc.c	Mon Jun 28 16:04:52 2004 +0000
@@ -591,6 +591,7 @@
   p->dogc = 0;
   xfree (p->pointer);
   p->pointer = 0;
+  free_misc (arg);
   return Qnil;
 }
 
@@ -2922,17 +2923,32 @@
 	  marker_block = new;
 	  marker_block_index = 0;
 	  n_marker_blocks++;
+	  total_free_markers += MARKER_BLOCK_SIZE;
 	}
       XSETMISC (val, &marker_block->markers[marker_block_index]);
       marker_block_index++;
     }
 
+  --total_free_markers;
   consing_since_gc += sizeof (union Lisp_Misc);
   misc_objects_consed++;
   XMARKER (val)->gcmarkbit = 0;
   return val;
 }
 
+/* Free a Lisp_Misc object */
+
+void
+free_misc (misc)
+     Lisp_Object misc;
+{
+  XMISC (misc)->u_marker.type = Lisp_Misc_Free;
+  XMISC (misc)->u_free.chain = marker_free_list;
+  marker_free_list = XMISC (misc);
+
+  total_free_markers++;
+}
+
 /* Return a Lisp_Misc_Save_Value object containing POINTER and
    INTEGER.  This is used to package C values to call record_unwind_protect.
    The unwind function can get the C values back using XSAVE_VALUE.  */
@@ -2979,12 +2995,7 @@
      Lisp_Object marker;
 {
   unchain_marker (XMARKER (marker));
-
-  XMISC (marker)->u_marker.type = Lisp_Misc_Free;
-  XMISC (marker)->u_free.chain = marker_free_list;
-  marker_free_list = XMISC (marker);
-
-  total_free_markers++;
+  free_misc (marker);
 }
 
 
--- a/src/emacs.c	Thu Jun 24 07:44:13 2004 +0000
+++ b/src/emacs.c	Mon Jun 28 16:04:52 2004 +0000
@@ -127,14 +127,6 @@
 /* An empty lisp string.  To avoid having to build any other.  */
 Lisp_Object empty_string;
 
-#ifdef SIGUSR1
-/* Hooks for signal USR1 and USR2 handling.  */
-Lisp_Object Vsignal_USR1_hook;
-#ifdef SIGUSR2
-Lisp_Object Vsignal_USR2_hook;
-#endif
-#endif
-
 /* Search path separator.  */
 Lisp_Object Vpath_separator;
 
@@ -2370,18 +2362,6 @@
   empty_string = build_string ("");
   staticpro (&empty_string);
 
-#ifdef SIGUSR1
-  DEFVAR_LISP ("signal-USR1-hook", &Vsignal_USR1_hook,
-	       doc: /* Hook to be run whenever emacs receives a USR1 signal.  */);
-  Vsignal_USR1_hook = Qnil;
-#ifdef SIGUSR2
-  DEFVAR_LISP ("signal-USR2-hook", &Vsignal_USR2_hook,
-	       doc: /* Hook to be run whenever emacs receives a USR2 signal.  */);
-  Vsignal_USR2_hook = Qnil;
-#endif
-#endif
-
-
   DEFVAR_INT ("emacs-priority", &emacs_priority,
 	      doc: /* Priority for Emacs to run at.
 This value is effective only if set before Emacs is dumped,
--- a/src/fns.c	Thu Jun 24 07:44:13 2004 +0000
+++ b/src/fns.c	Mon Jun 28 16:04:52 2004 +0000
@@ -3020,11 +3020,7 @@
   for (i = 1; i < nargs; i += 2)
     args[i] = separator;
 
-  GCPRO1 (*args);
-  gcpro1.nvars = nargs;
   ret = Fconcat (nargs, args);
-  UNGCPRO;
-
   SAFE_FREE_LISP (nargs);
 
   return ret;
@@ -3040,7 +3036,6 @@
   register Lisp_Object len;
   register int leni;
   register Lisp_Object *args;
-  struct gcpro gcpro1;
   Lisp_Object ret;
   USE_SAFE_ALLOCA;
 
@@ -3051,11 +3046,7 @@
 
   mapcar1 (leni, args, function, sequence);
 
-  GCPRO1 (*args);
-  gcpro1.nvars = leni;
   ret = Flist (leni, args);
-  UNGCPRO;
-
   SAFE_FREE_LISP (leni);
 
   return ret;
--- a/src/lisp.h	Thu Jun 24 07:44:13 2004 +0000
+++ b/src/lisp.h	Mon Jun 28 16:04:52 2004 +0000
@@ -2486,6 +2486,7 @@
 extern void display_malloc_warning P_ ((void));
 extern int inhibit_garbage_collection P_ ((void));
 extern Lisp_Object make_save_value P_ ((void *, int));
+extern void free_misc P_ ((Lisp_Object));
 extern void free_marker P_ ((Lisp_Object));
 extern void free_cons P_ ((struct Lisp_Cons *));
 extern void init_alloc_once P_ ((void));
--- a/src/w32fns.c	Thu Jun 24 07:44:13 2004 +0000
+++ b/src/w32fns.c	Mon Jun 28 16:04:52 2004 +0000
@@ -7686,7 +7686,8 @@
     {
       OFNOTIFY * notify = (OFNOTIFY *)lParam;
       /* Detect when the Filter dropdown is changed.  */
-      if (notify->hdr.code == CDN_TYPECHANGE)
+      if (notify->hdr.code == CDN_TYPECHANGE
+	  || notify->hdr.code == CDN_INITDONE)
 	{
 	  HWND dialog = GetParent (hwnd);
 	  HWND edit_control = GetDlgItem (dialog, FILE_NAME_TEXT_FIELD);
@@ -7700,8 +7701,10 @@
 	    }
 	  else
 	    {
-	      CommDlg_OpenSave_SetControlText (dialog, FILE_NAME_TEXT_FIELD,
-					       "");
+	      /* Don't override default filename on init done.  */
+	      if (notify->hdr.code == CDN_TYPECHANGE)
+		CommDlg_OpenSave_SetControlText (dialog,
+						 FILE_NAME_TEXT_FIELD, "");
 	      EnableWindow (edit_control, TRUE);
 	    }
 	}
@@ -7723,6 +7726,7 @@
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
   char filename[MAX_PATH + 1];
   char init_dir[MAX_PATH + 1];
+  int default_filter_index = 1; /* 1: All Files, 2: Directories only  */
 
   GCPRO5 (prompt, dir, default_filename, mustmatch, file);
   CHECK_STRING (prompt);
@@ -7746,9 +7750,7 @@
       if (!file_name_only)
         file_name_only = full_path_name;
       else
-        {
-          file_name_only++;
-        }
+	file_name_only++;
 
       strncpy (filename, file_name_only, MAX_PATH);
       filename[MAX_PATH] = '\0';
@@ -7773,6 +7775,15 @@
     file_details.nMaxFile = sizeof (filename);
     file_details.lpstrInitialDir = init_dir;
     file_details.lpstrTitle = SDATA (prompt);
+
+    /* If prompt starts with Dired, default to directories only.  */
+    /* A bit hacky, but there doesn't seem to be a better way to
+       DTRT for dired.  */
+    if (strncmp (file_details.lpstrTitle, "Dired", 5) == 0)
+      default_filter_index = 2;
+
+    file_details.nFilterIndex = default_filter_index;
+
     file_details.Flags = (OFN_HIDEREADONLY | OFN_NOCHANGEDIR
 			  | OFN_EXPLORER | OFN_ENABLEHOOK);
     if (!NILP (mustmatch))
@@ -7785,7 +7796,7 @@
 	dostounix_filename (filename);
 	if (file_details.nFilterIndex == 2)
 	  {
-	    /* "Folder Only" selected - strip dummy file name.  */
+	    /* "Directories" selected - strip dummy file name.  */
 	    char * last = strrchr (filename, '/');
 	    *last = '\0';
 	  }