changeset 83200:cc29203a9a04

Merged in changes from CVS trunk. Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-519 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-520 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-240
author Karoly Lorentey <lorentey@elte.hu>
date Thu, 02 Sep 2004 07:43:01 +0000
parents 0e38a1bd20a8 (current diff) e0e96606bedd (diff)
children 8a6fd1c164cd
files lisp/ChangeLog lisp/simple.el lisp/x-dnd.el man/ChangeLog man/kmacro.texi
diffstat 13 files changed, 408 insertions(+), 191 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS	Tue Aug 31 16:31:03 2004 +0000
+++ b/etc/NEWS	Thu Sep 02 07:43:01 2004 +0000
@@ -98,6 +98,10 @@
 
 * Changes in Emacs 21.4
 
++++
+** `apply-macro-to-region-lines' now operates on all lines that begin
+in the region, rather than on all complete lines in the region.
+
 ** global-whitespace-mode is a new alias for whitespace-global-mode.
 
 +++
@@ -1858,7 +1862,9 @@
 compilation processes without affecting the environment that all
 subprocesses inherit.
 
-*** `next-error' now temporarily highlights the corresponding source line.
+*** New options `next-error-highlight' and `next-error-highlight-no-select'
+specify the method of highlighting of the corresponding source line
+in new face `next-error'.
 
 ** Grep has been decoupled from compilation mode setup.
 
--- a/lisp/ChangeLog	Tue Aug 31 16:31:03 2004 +0000
+++ b/lisp/ChangeLog	Thu Sep 02 07:43:01 2004 +0000
@@ -1,3 +1,72 @@
+2004-09-01  Juri Linkov  <juri@jurta.org>
+
+	* isearch.el (isearch-wrap-function)
+	(isearch-push-state-function): New defvars.
+	(isearch-pop-fun-state): New defsubst.
+	(isearch-top-state): Call function saved in `isearch-pop-fun-state'.
+	(isearch-push-state): Set the result of calling
+	`isearch-push-state-function' to the `isearch-pop-fun-state' field.
+	(isearch-cancel): Call function saved in `isearch-pop-fun-state' to
+	restore the mode-specific starting point of terminated search.
+	(isearch-abort): Call `isearch-cancel' instead of its duplicated code.
+	(isearch-repeat): Call `isearch-wrap-function' if defined.
+	(isearch-message-prefix): Don't add prefix "over" to the message
+	for wrapped search if `isearch-wrap-function' is defined.
+	(isearch-search): Call function saved in `isearch-pop-fun-state' to
+	restore the mode-specific starting point of failed search.
+
+	* info.el (Info-search-whitespace-regexp): Fix backslashes.
+	(Info-search): Add new optional arguments for the sake of isearch.
+	Replace whitespace in Info-search-whitespace-regexp literally.
+	Add backward search.  Don't call `Info-select-node' if regexp is
+	found in the same Info node.  Don't add node to Info-history for
+	wrapped isearch.
+	(Info-search-backward, Info-isearch-search, Info-isearch-wrap)
+	(Info-isearch-push-state, Info-isearch-pop-state): New funs.
+	(Info-mode): Set local variables `isearch-search-fun-function',
+	`isearch-wrap-function', `isearch-push-state-function',
+	`search-whitespace-regexp'.
+
+	* isearch.el: Remove ancient Change Log section.
+	(isearch-string, isearch-message-string, isearch-point)
+	(isearch-success, isearch-forward-flag, isearch-other-end)
+	(isearch-word, isearch-invalid-regexp, isearch-wrapped)
+	(isearch-barrier, isearch-within-brackets)
+	(isearch-case-fold-search): Add suffix `-state' to state-related
+	defsubsts to avoid name clashes with other function names.
+
+	* simple.el (next-error): New defgroup and defface.
+	(next-error-highlight, next-error-highlight-no-select):
+	New defcustoms.
+	(next-error-no-select): Let-bind next-error-highlight to the value
+	of next-error-highlight-no-select before calling `next-error'.
+
+	* progmodes/compile.el (compilation-goto-locus):
+	Use `next-error' face instead of `region'.  Set 4-th argument of
+	`move-overlay' to `current-buffer' to move overlay to different
+	source buffers.  Use new variable `next-error-highlight'.
+
+	* simple.el (next-error-find-buffer): Move the rule
+	"if current buffer is a next-error capable buffer" after the
+	rule "if next-error-last-buffer is set to a live buffer".
+	Simplify to test all rules in one `or'.
+	(next-error): Doc fix.
+	(next-error, previous-error, first-error)
+	(next-error-no-select, previous-error-no-select):
+	Make arguments optional.
+
+2004-08-31  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* macros.el (apply-macro-to-region-lines): Make it operate on all
+	lines that begin in the region, rather than on all complete lines
+	in the region.
+
+2004-08-31  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* x-dnd.el (x-dnd-protocol-alist): Document update.
+	(x-dnd-known-types): Defcustom it.
+	(x-dnd-handle-motif): Print message-atom in error message.
+
 2004-08-30  John Paul Wallington  <jpw@gnu.org>
 
 	* textmodes/tex-mode.el (tex-validate-buffer): Use distinct
@@ -600,7 +669,6 @@
 	(ps-generate-string-list): Comment fix.
 	(ps-message-log-max): Code fix.
 
-
 2004-07-22  Michael Piotrowski  <mxp@dynalabs.de>  (tiny change)
 
 	* ps-print.el (ps-begin-file): Improve the DSC compliance of the
@@ -620,11 +688,9 @@
 
 2004-07-20  Richard M. Stallman  <rms@gnu.org>
 
-	* textmodes/fill.el (fill-comment-paragraph): Handle indent-tabs-mode.
-	(fill-delete-newlines): Call sentence-end as function.
-	(fill-nobreak-p, canonically-space-region): Likewise.
-	(fill-nobreak-p): If this break point is at the end of the line,
-	don't consider the newline which follows as a reason to return t.
+	* textmodes/fill.el (fill-nobreak-p): If this break point is
+	at the end of the line, don't consider the newline which follows
+	as a reason to return t.
 
 2004-07-19  John Paul Wallington  <jpw@gnu.org>
 
--- a/lisp/info.el	Tue Aug 31 16:31:03 2004 +0000
+++ b/lisp/info.el	Thu Sep 02 07:43:01 2004 +0000
@@ -188,7 +188,7 @@
   :type 'boolean
   :group 'info)
 
-(defcustom Info-search-whitespace-regexp "\\\\(?:\\\\s-+\\\\)"
+(defcustom Info-search-whitespace-regexp "\\(?:\\s-+\\)"
   "*If non-nil, regular expression to match a sequence of whitespace chars.
 This applies to Info search for regular expressions.
 You might want to use something like \"[ \\t\\r\\n]+\" instead.
@@ -1442,8 +1442,9 @@
 (defvar Info-search-case-fold nil
   "The value of `case-fold-search' from previous `Info-search' command.")
 
-(defun Info-search (regexp)
-  "Search for REGEXP, starting from point, and select node it's found in."
+(defun Info-search (regexp &optional bound noerror count direction)
+  "Search for REGEXP, starting from point, and select node it's found in.
+If DIRECTION is `backward', search in the reverse direction."
   (interactive (list (read-string
 		      (if Info-search-history
 			  (format "Regexp search%s (default `%s'): "
@@ -1458,31 +1459,42 @@
     (setq regexp (car Info-search-history)))
   (when regexp
     (let (found beg-found give-up
+	  (backward (eq direction 'backward))
 	  (onode Info-current-node)
 	  (ofile Info-current-file)
 	  (opoint (point))
+	  (opoint-min (point-min))
+	  (opoint-max (point-max))
 	  (ostart (window-start))
 	  (osubfile Info-current-subfile))
       (when Info-search-whitespace-regexp
-        (setq regexp (replace-regexp-in-string
-                      "[ \t\n]+" Info-search-whitespace-regexp regexp)))
+        (setq regexp
+              (mapconcat 'identity (split-string regexp "[ \t\n]+")
+                         Info-search-whitespace-regexp)))
       (setq Info-search-case-fold case-fold-search)
       (save-excursion
 	(save-restriction
 	  (widen)
 	  (while (and (not give-up)
 		      (or (null found)
-			  (isearch-range-invisible beg-found found)))
-	    (if (re-search-forward regexp nil t)
-		(setq found (point) beg-found (match-beginning 0))
+			  (if backward
+                              (isearch-range-invisible found beg-found)
+                            (isearch-range-invisible beg-found found))))
+	    (if (if backward
+                    (re-search-backward regexp bound t)
+                  (re-search-forward regexp bound t))
+		(setq found (point) beg-found (if backward (match-end 0)
+                                                (match-beginning 0)))
 	      (setq give-up t)))))
       ;; If no subfiles, give error now.
       (if give-up
 	  (if (null Info-current-subfile)
-	      (re-search-forward regexp)
+	      (if backward
+                  (re-search-backward regexp)
+                (re-search-forward regexp))
 	    (setq found nil)))
 
-      (unless found
+      (unless (or found bound)
 	(unwind-protect
 	    ;; Try other subfiles.
 	    (let ((list ()))
@@ -1498,29 +1510,39 @@
 		  ;; Find the subfile we just searched.
 		  (search-forward (concat "\n" osubfile ": "))
 		  ;; Skip that one.
-		  (forward-line 1)
+		  (forward-line (if backward 0 1))
 		  ;; Make a list of all following subfiles.
 		  ;; Each elt has the form (VIRT-POSITION . SUBFILENAME).
-		  (while (not (eobp))
-		    (re-search-forward "\\(^.*\\): [0-9]+$")
+		  (while (not (if backward (bobp) (eobp)))
+		    (if backward
+		        (re-search-backward "\\(^.*\\): [0-9]+$")
+		      (re-search-forward "\\(^.*\\): [0-9]+$"))
 		    (goto-char (+ (match-end 1) 2))
 		    (setq list (cons (cons (+ (point-min)
 					      (read (current-buffer)))
 					   (match-string-no-properties 1))
 				     list))
-		    (goto-char (1+ (match-end 0))))
+		    (goto-char (if backward
+                                   (1- (match-beginning 0))
+                                 (1+ (match-end 0)))))
 		  ;; Put in forward order
 		  (setq list (nreverse list))))
 	      (while list
 		(message "Searching subfile %s..." (cdr (car list)))
 		(Info-read-subfile (car (car list)))
+                (if backward (goto-char (point-max)))
 		(setq list (cdr list))
 		(setq give-up nil found nil)
 		(while (and (not give-up)
 			    (or (null found)
-				(isearch-range-invisible beg-found found)))
-		  (if (re-search-forward regexp nil t)
-		      (setq found (point) beg-found (match-beginning 0))
+				(if backward
+                                    (isearch-range-invisible found beg-found)
+                                  (isearch-range-invisible beg-found found))))
+		  (if (if backward
+                          (re-search-backward regexp nil t)
+                        (re-search-forward regexp nil t))
+		      (setq found (point) beg-found (if backward (match-end 0)
+                                                      (match-beginning 0)))
 		    (setq give-up t)))
 		(if give-up
 		    (setq found nil))
@@ -1534,12 +1556,20 @@
 		     (goto-char opoint)
 		     (Info-select-node)
 		     (set-window-start (selected-window) ostart)))))
-      (widen)
-      (goto-char found)
-      (Info-select-node)
+
+      (if (and (string= osubfile Info-current-subfile)
+               (> found opoint-min)
+               (< found opoint-max))
+          ;; Search landed in the same node
+          (goto-char found)
+        (widen)
+        (goto-char found)
+        (save-match-data (Info-select-node)))
+
       ;; Use string-equal, not equal, to ignore text props.
       (or (and (string-equal onode Info-current-node)
 	       (equal ofile Info-current-file))
+          (and isearch-mode isearch-wrapped (eq opoint opoint-min))
 	  (setq Info-history (cons (list ofile onode opoint)
 				   Info-history))))))
 
@@ -1556,6 +1586,48 @@
     (if Info-search-history
         (Info-search (car Info-search-history))
       (call-interactively 'Info-search))))
+
+(defun Info-search-backward (regexp &optional bound noerror count)
+  "Search for REGEXP in the reverse direction."
+  (interactive (list (read-string
+		      (if Info-search-history
+			  (format "Regexp search%s backward (default `%s'): "
+                                  (if case-fold-search "" " case-sensitively")
+				  (car Info-search-history))
+			(format "Regexp search%s backward: "
+                                (if case-fold-search "" " case-sensitively")))
+		      nil 'Info-search-history)))
+  (Info-search regexp bound noerror count 'backward))
+
+(defun Info-isearch-search ()
+  (cond
+   (isearch-word
+    (if isearch-forward 'word-search-forward 'word-search-backward))
+   (isearch-regexp
+    (lambda (regexp bound noerror)
+      (condition-case nil
+          (progn
+            (Info-search regexp bound noerror nil
+                         (unless isearch-forward 'backward))
+            (point))
+        (error nil))))
+   (t
+    (if isearch-forward 'search-forward 'search-backward))))
+
+(defun Info-isearch-wrap ()
+  (if isearch-regexp
+      (if isearch-forward (Info-top-node) (Info-final-node))
+    (goto-char (if isearch-forward (point-min) (point-max)))))
+
+(defun Info-isearch-push-state ()
+  `(lambda (cmd)
+     (Info-isearch-pop-state cmd ,Info-current-file ,Info-current-node)))
+
+(defun Info-isearch-pop-state (cmd file node)
+  (or (and (string= Info-current-file file)
+           (string= Info-current-node node))
+      (progn (Info-find-node file node) (sit-for 0))))
+
 
 (defun Info-extract-pointer (name &optional errorname)
   "Extract the value of the node-pointer named NAME.
@@ -3064,6 +3136,14 @@
   (setq desktop-save-buffer 'Info-desktop-buffer-misc-data)
   (add-hook 'clone-buffer-hook 'Info-clone-buffer-hook nil t)
   (add-hook 'change-major-mode-hook 'font-lock-defontify nil t)
+  (set (make-local-variable 'isearch-search-fun-function)
+       'Info-isearch-search)
+  (set (make-local-variable 'isearch-wrap-function)
+       'Info-isearch-wrap)
+  (set (make-local-variable 'isearch-push-state-function)
+       'Info-isearch-push-state)
+  (set (make-local-variable 'search-whitespace-regexp)
+       Info-search-whitespace-regexp)
   (Info-set-mode-line)
   (run-hooks 'Info-mode-hook))
 
--- a/lisp/isearch.el	Tue Aug 31 16:31:03 2004 +0000
+++ b/lisp/isearch.el	Thu Sep 02 07:43:01 2004 +0000
@@ -57,47 +57,6 @@
 ;; keep the behavior.  No point in forcing nonincremental search until
 ;; the last possible moment.
 
-;; TODO
-;; - Integrate the emacs 19 generalized command history.
-;; - Hooks and options for failed search.
-
-;;; Change Log:
-
-;; Changes before those recorded in ChangeLog:
-
-;; Revision 1.4  92/09/14  16:26:02  liberte
-;; Added prefix args to isearch-forward, etc. to switch between
-;;    string and regular expression searching.
-;; Added some support for lemacs.
-;; Added general isearch-highlight option - but only for lemacs so far.
-;; Added support for frame switching in emacs 19.
-;; Added word search option to isearch-edit-string.
-;; Renamed isearch-quit to isearch-abort.
-;; Numerous changes to comments and doc strings.
-;;
-;; Revision 1.3  92/06/29  13:10:08  liberte
-;; Moved modal isearch-mode handling into isearch-mode.
-;; Got rid of buffer-local isearch variables.
-;; isearch-edit-string used by ring adjustments, completion, and
-;; nonincremental searching.  C-s and C-r are additional exit commands.
-;; Renamed all regex to regexp.
-;; Got rid of found-start and found-point globals.
-;; Generalized handling of upper-case chars.
-
-;; Revision 1.2  92/05/27  11:33:57  liberte
-;; Emacs version 19 has a search ring, which is supported here.
-;; Other fixes found in the version 19 isearch are included here.
-;;
-;; Also see variables search-caps-disable-folding,
-;; search-nonincremental-instead, search-whitespace-regexp, and
-;; commands isearch-toggle-regexp, isearch-edit-string.
-;;
-;; semi-modal isearching is supported.
-
-;; Changes for 1.1
-;; 3/18/92 Fixed invalid-regexp.
-;; 3/18/92 Fixed yanking in regexps.
-
 ;;; Code:
 
 
@@ -198,6 +157,15 @@
 (defvar isearch-mode-end-hook nil
   "Function(s) to call after terminating an incremental search.")
 
+(defvar isearch-wrap-function nil
+  "Function to call to wrap the search when search is failed.
+If nil, move point to the beginning of the buffer for a forward search,
+or to the end of the buffer for a backward search.")
+
+(defvar isearch-push-state-function nil
+  "Function to save a function restoring the mode-specific isearch state
+to the search status stack.")
+
 ;; Search ring.
 
 (defvar search-ring nil
@@ -776,57 +744,62 @@
 
 ;; The search status structure and stack.
 
-(defsubst isearch-string (frame)
+(defsubst isearch-string-state (frame)
   "Return the search string in FRAME."
   (aref frame 0))
-(defsubst isearch-message-string (frame)
+(defsubst isearch-message-state (frame)
   "Return the search string to display to the user in FRAME."
   (aref frame 1))
-(defsubst isearch-point (frame)
+(defsubst isearch-point-state (frame)
   "Return the point in FRAME."
   (aref frame 2))
-(defsubst isearch-success (frame)
+(defsubst isearch-success-state (frame)
   "Return the success flag in FRAME."
   (aref frame 3))
-(defsubst isearch-forward-flag (frame)
+(defsubst isearch-forward-state (frame)
   "Return the searching-forward flag in FRAME."
   (aref frame 4))
-(defsubst isearch-other-end (frame)
+(defsubst isearch-other-end-state (frame)
   "Return the other end of the match in FRAME."
   (aref frame 5))
-(defsubst isearch-word (frame)
+(defsubst isearch-word-state (frame)
   "Return the search-by-word flag in FRAME."
   (aref frame 6))
-(defsubst isearch-invalid-regexp (frame)
+(defsubst isearch-invalid-regexp-state (frame)
   "Return the regexp error message in FRAME, or nil if its regexp is valid."
   (aref frame 7))
-(defsubst isearch-wrapped (frame)
+(defsubst isearch-wrapped-state (frame)
   "Return the search-wrapped flag in FRAME."
   (aref frame 8))
-(defsubst isearch-barrier (frame)
+(defsubst isearch-barrier-state (frame)
   "Return the barrier value in FRAME."
   (aref frame 9))
-(defsubst isearch-within-brackets (frame)
+(defsubst isearch-within-brackets-state (frame)
   "Return the in-character-class flag in FRAME."
   (aref frame 10))
-(defsubst isearch-case-fold-search (frame)
+(defsubst isearch-case-fold-search-state (frame)
   "Return the case-folding flag in FRAME."
   (aref frame 11))
+(defsubst isearch-pop-fun-state (frame)
+  "Return the function restoring the mode-specific isearch state in FRAME."
+  (aref frame 12))
 
 (defun isearch-top-state ()
   (let ((cmd (car isearch-cmds)))
-    (setq isearch-string (isearch-string cmd)
-	  isearch-message (isearch-message-string cmd)
-	  isearch-success (isearch-success cmd)
-	  isearch-forward (isearch-forward-flag cmd)
-	  isearch-other-end (isearch-other-end cmd)
-	  isearch-word (isearch-word cmd)
-	  isearch-invalid-regexp (isearch-invalid-regexp cmd)
-	  isearch-wrapped (isearch-wrapped cmd)
-	  isearch-barrier (isearch-barrier cmd)
-	  isearch-within-brackets (isearch-within-brackets cmd)
-	  isearch-case-fold-search (isearch-case-fold-search cmd))
-    (goto-char (isearch-point cmd))))
+    (setq isearch-string (isearch-string-state cmd)
+	  isearch-message (isearch-message-state cmd)
+	  isearch-success (isearch-success-state cmd)
+	  isearch-forward (isearch-forward-state cmd)
+	  isearch-other-end (isearch-other-end-state cmd)
+	  isearch-word (isearch-word-state cmd)
+	  isearch-invalid-regexp (isearch-invalid-regexp-state cmd)
+	  isearch-wrapped (isearch-wrapped-state cmd)
+	  isearch-barrier (isearch-barrier-state cmd)
+	  isearch-within-brackets (isearch-within-brackets-state cmd)
+	  isearch-case-fold-search (isearch-case-fold-search-state cmd))
+    (if (functionp (isearch-pop-fun-state cmd))
+	(funcall (isearch-pop-fun-state cmd) cmd))
+    (goto-char (isearch-point-state cmd))))
 
 (defun isearch-pop-state ()
   (setq isearch-cmds (cdr isearch-cmds))
@@ -838,7 +811,9 @@
 		      isearch-success isearch-forward isearch-other-end
 		      isearch-word
 		      isearch-invalid-regexp isearch-wrapped isearch-barrier
-		      isearch-within-brackets isearch-case-fold-search)
+		      isearch-within-brackets isearch-case-fold-search
+		      (if isearch-push-state-function
+			  (funcall isearch-push-state-function)))
 	      isearch-cmds)))
 
 
@@ -1024,10 +999,13 @@
 (defun isearch-cancel ()
   "Terminate the search and go back to the starting point."
   (interactive)
+  (if (functionp (isearch-pop-fun-state (car (last isearch-cmds))))
+      (funcall (isearch-pop-fun-state (car (last isearch-cmds)))
+               (car (last isearch-cmds))))
   (goto-char isearch-opoint)
-  (isearch-done t)
+  (isearch-done t)                      ; exit isearch
   (isearch-clean-overlays)
-  (signal 'quit nil))  ; and pass on quit signal
+  (signal 'quit nil))                   ; and pass on quit signal
 
 (defun isearch-abort ()
   "Abort incremental search mode if searching is successful, signaling quit.
@@ -1039,11 +1017,9 @@
   (if isearch-success
       ;; If search is successful, move back to starting point
       ;; and really do quit.
-      (progn (goto-char isearch-opoint)
-	     (setq isearch-success nil)
-	     (isearch-done t)   ; exit isearch
-	     (isearch-clean-overlays)
-	     (signal 'quit nil))  ; and pass on quit signal
+      (progn
+        (setq isearch-success nil)
+        (isearch-cancel))
     ;; If search is failing, or has an incomplete regexp,
     ;; rub out until it is once more successful.
     (while (or (not isearch-success) isearch-invalid-regexp)
@@ -1068,7 +1044,9 @@
 	;; If already have what to search for, repeat it.
 	(or isearch-success
 	    (progn
-	      (goto-char (if isearch-forward (point-min) (point-max)))
+	      (if isearch-wrap-function
+		  (funcall isearch-wrap-function)
+	        (goto-char (if isearch-forward (point-min) (point-max))))
 	      (setq isearch-wrapped t))))
     ;; C-s in reverse or C-r in forward, change direction.
     (setq isearch-forward (not isearch-forward)))
@@ -1347,7 +1325,7 @@
 	     ;; We have to check 2 stack frames because the last might be
 	     ;; invalid just because of a backslash.
 	     (or (not isearch-invalid-regexp)
-		 (not (isearch-invalid-regexp (cadr isearch-cmds)))
+		 (not (isearch-invalid-regexp-state (cadr isearch-cmds)))
 		 allow-invalid))
     (if to-barrier
 	(progn (goto-char isearch-barrier)
@@ -1362,8 +1340,8 @@
 	;; Also skip over postfix operators -- though horrid,
 	;; 'ab?\{5,6\}+\{1,2\}*' is perfectly legal.
 	(while (and previous
-		    (or (isearch-invalid-regexp frame)
-			(let* ((string (isearch-string frame))
+		    (or (isearch-invalid-regexp-state frame)
+			(let* ((string (isearch-string-state frame))
 			       (lchar (aref string (1- (length string)))))
 			  ;; The operators aren't always operators; check
 			  ;; backslashes.  This doesn't handle the case of
@@ -1371,7 +1349,7 @@
 			  ;; being special, but then we should fall back to
 			  ;; the barrier anyway because it's all optional.
 			  (if (isearch-backslash
-			       (isearch-string (car previous)))
+			       (isearch-string-state (car previous)))
 			      (eq lchar ?\})
 			    (memq lchar '(?* ?? ?+))))))
 	  (setq stack previous previous (cdr previous) frame (car stack)))
@@ -1379,7 +1357,7 @@
 	  ;; `stack' now refers the most recent valid regexp that is not at
 	  ;; all optional in its last term.  Now dig one level deeper and find
 	  ;; what matched before that.
-	  (let ((last-other-end (or (isearch-other-end (car previous))
+	  (let ((last-other-end (or (isearch-other-end-state (car previous))
 				    isearch-barrier)))
 	    (goto-char (if isearch-forward
 			   (max last-other-end isearch-barrier)
@@ -1918,6 +1896,7 @@
   (or isearch-success (setq ellipsis nil))
   (let ((m (concat (if isearch-success "" "failing ")
 		   (if (and isearch-wrapped
+			    (not isearch-wrap-function)
 			    (if isearch-forward
 				(> (point) isearch-opoint)
 			      (< (point) isearch-opoint)))
@@ -2012,9 +1991,11 @@
   (if isearch-success
       nil
     ;; Ding if failed this time after succeeding last time.
-    (and (isearch-success (car isearch-cmds))
+    (and (isearch-success-state (car isearch-cmds))
 	 (ding))
-    (goto-char (isearch-point (car isearch-cmds)))))
+    (if (functionp (isearch-pop-fun-state (car isearch-cmds)))
+        (funcall (isearch-pop-fun-state (car isearch-cmds)) (car isearch-cmds)))
+    (goto-char (isearch-point-state (car isearch-cmds)))))
 
 
 ;; Called when opening an overlay, and we are still in isearch.
--- a/lisp/macros.el	Tue Aug 31 16:31:03 2004 +0000
+++ b/lisp/macros.el	Thu Sep 02 07:43:01 2004 +0000
@@ -1,6 +1,6 @@
 ;;; macros.el --- non-primitive commands for keyboard macros
 
-;; Copyright (C) 1985, 86, 87, 92, 94, 95 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 86, 87, 92, 94, 95, 04 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: abbrev
@@ -151,7 +151,7 @@
 		     (cond ((= char ?\\)
 			    (insert "\\\\"))
                            ((= char ?\")
-                            (insert "\\\""))   
+                            (insert "\\\""))
 			   ((= char ?\;)
 			    (insert "\\;"))
 			   ((= char 127)
@@ -240,8 +240,9 @@
 
 ;;;###autoload
 (defun apply-macro-to-region-lines (top bottom &optional macro)
-  "For each complete line between point and mark, move to the beginning
-of the line, and run the last keyboard macro.
+  "Apply last keyboard macro to all lines in the region.
+For each line that begins in the region, move to the beginning of
+the line, and run the last keyboard macro.
 
 When called from lisp, this function takes two arguments TOP and
 BOTTOM, describing the current region.  TOP must be before BOTTOM.
@@ -277,8 +278,7 @@
     \\C-x )
 
 and then select the region of un-tablified names and use
-`\\[apply-macro-to-region-lines]' to build the table from the names.
-"
+`\\[apply-macro-to-region-lines]' to build the table from the names."
   (interactive "r")
   (or macro
       (progn
@@ -286,10 +286,7 @@
 	    (error "No keyboard macro has been defined"))
 	(setq macro last-kbd-macro)))
   (save-excursion
-    (let ((end-marker (progn
-			(goto-char bottom)
-			(beginning-of-line)
-			(point-marker)))
+    (let ((end-marker (copy-marker bottom))
 	  next-line-marker)
       (goto-char top)
       (if (not (bolp))
--- a/lisp/progmodes/compile.el	Tue Aug 31 16:31:03 2004 +0000
+++ b/lisp/progmodes/compile.el	Thu Sep 02 07:43:01 2004 +0000
@@ -1564,7 +1564,7 @@
       (unless compilation-highlight-overlay
 	(setq compilation-highlight-overlay
 	      (make-overlay (point-min) (point-min)))
-	(overlay-put compilation-highlight-overlay 'face 'region))
+	(overlay-put compilation-highlight-overlay 'face 'next-error))
       (with-current-buffer (marker-buffer mk)
 	(save-excursion
 	  (end-of-line)
@@ -1574,11 +1574,18 @@
 		     (re-search-forward highlight-regexp end t))
 		(progn
 		  (goto-char (match-beginning 0))
-		  (move-overlay compilation-highlight-overlay (match-beginning 0) (match-end 0)))
-	      (move-overlay compilation-highlight-overlay (point) end))
-	    (sit-for 0.5)
-	    (delete-overlay compilation-highlight-overlay)))))))
-
+		  (move-overlay compilation-highlight-overlay
+				(match-beginning 0) (match-end 0)
+				(current-buffer)))
+	      (move-overlay compilation-highlight-overlay
+			    (point) end (current-buffer)))
+	    (if (numberp next-error-highlight)
+		(sit-for next-error-highlight))
+	    (if (not (eq next-error-highlight t))
+		(delete-overlay compilation-highlight-overlay))))))
+    (when (and (eq next-error-highlight 'fringe-arrow))
+      (set (make-local-variable 'overlay-arrow-position)
+	   (copy-marker (line-beginning-position))))))
 
 (defun compilation-find-file (marker filename dir &rest formats)
   "Find a buffer for file FILENAME.
--- a/lisp/simple.el	Tue Aug 31 16:31:03 2004 +0000
+++ b/lisp/simple.el	Thu Sep 02 07:43:01 2004 +0000
@@ -65,7 +65,7 @@
 	    (setq found buffer)))
       (setq list (cdr list)))
     (switch-to-buffer found)))
-
+
 ;;; next-error support framework
 (defvar next-error-last-buffer nil
   "The most recent next-error buffer.
@@ -91,51 +91,50 @@
     (or (and extra-test (funcall extra-test))
 	next-error-function)))
 
-;; Return a next-error capable buffer according to the following rules:
-;; 1. If the current buffer is a next-error capable buffer, return it.
-;; 2. If one window on the selected frame displays such buffer, return it.
-;; 3. If next-error-last-buffer is set to a live buffer, use that.
-;; 4. Otherwise, look for a next-error capable buffer in a buffer list.
-;; 5. Signal an error if there are none.
 (defun next-error-find-buffer (&optional other-buffer extra-test)
-  (if (and (not other-buffer)
-	   (next-error-buffer-p (current-buffer) extra-test))
-      ;; The current buffer is a next-error capable buffer.
-      (current-buffer)
-    (or
-     (let ((window-buffers
-            (delete-dups
-             (delq nil
-              (mapcar (lambda (w)
-                        (and (next-error-buffer-p (window-buffer w) extra-test)
-                             (window-buffer w)))
-                      (window-list))))))
-       (if other-buffer
-           (setq window-buffers (delq (current-buffer) window-buffers)))
-       (if (eq (length window-buffers) 1)
-           (car window-buffers)))
-     (if (and next-error-last-buffer (buffer-name next-error-last-buffer)
-              (next-error-buffer-p next-error-last-buffer extra-test)
-              (or (not other-buffer) (not (eq next-error-last-buffer
-                                              (current-buffer)))))
-         next-error-last-buffer
-       (let ((buffers (buffer-list)))
-         (while (and buffers (or (not (next-error-buffer-p (car buffers) extra-test))
-                                 (and other-buffer
-                                      (eq (car buffers) (current-buffer)))))
-           (setq buffers (cdr buffers)))
-         (if buffers
-             (car buffers)
-           (or (and other-buffer
-                    (next-error-buffer-p (current-buffer) extra-test)
-                    ;; The current buffer is a next-error capable buffer.
-                    (progn
-                      (if other-buffer
-                          (message "This is the only next-error capable buffer."))
-                      (current-buffer)))
-               (error "No next-error capable buffer found"))))))))
-
-(defun next-error (arg &optional reset)
+  "Return a next-error capable buffer."
+  (or
+   ;; 1. If one window on the selected frame displays such buffer, return it.
+   (let ((window-buffers
+          (delete-dups
+           (delq nil (mapcar (lambda (w)
+                               (if (next-error-buffer-p
+                                    (window-buffer w) extra-test)
+                                   (window-buffer w)))
+                             (window-list))))))
+     (if other-buffer
+         (setq window-buffers (delq (current-buffer) window-buffers)))
+     (if (eq (length window-buffers) 1)
+         (car window-buffers)))
+   ;; 2. If next-error-last-buffer is set to a live buffer, use that.
+   (if (and next-error-last-buffer
+            (buffer-name next-error-last-buffer)
+            (next-error-buffer-p next-error-last-buffer extra-test)
+            (or (not other-buffer)
+                (not (eq next-error-last-buffer (current-buffer)))))
+       next-error-last-buffer)
+   ;; 3. If the current buffer is a next-error capable buffer, return it.
+   (if (and (not other-buffer)
+            (next-error-buffer-p (current-buffer) extra-test))
+       (current-buffer))
+   ;; 4. Look for a next-error capable buffer in a buffer list.
+   (let ((buffers (buffer-list)))
+     (while (and buffers
+                 (or (not (next-error-buffer-p (car buffers) extra-test))
+                     (and other-buffer (eq (car buffers) (current-buffer)))))
+       (setq buffers (cdr buffers)))
+     (if buffers
+         (car buffers)
+       (or (and other-buffer
+                (next-error-buffer-p (current-buffer) extra-test)
+                ;; The current buffer is a next-error capable buffer.
+                (progn
+                  (if other-buffer
+                      (message "This is the only next-error capable buffer"))
+                  (current-buffer)))
+           (error "No next-error capable buffer found"))))))
+
+(defun next-error (&optional arg reset)
   "Visit next next-error message and corresponding source code.
 
 If all the error messages parsed so far have been processed already,
@@ -153,9 +152,10 @@
 buffer with output from the \\[compile], \\[grep] commands, or,
 more generally, on any buffer in Compilation mode or with
 Compilation Minor mode enabled, or any buffer in which
-`next-error-function' is bound to an appropriate
-function.  To specify use of a particular buffer for error
-messages, type \\[next-error] in that buffer.
+`next-error-function' is bound to an appropriate function.
+To specify use of a particular buffer for error messages, type
+\\[next-error] in that buffer when it is the only one displayed
+in the current frame.
 
 Once \\[next-error] has chosen the buffer for error messages,
 it stays with that buffer until you use it in some other buffer which
@@ -175,7 +175,7 @@
 
 (define-key ctl-x-map "`" 'next-error)
 
-(defun previous-error (n)
+(defun previous-error (&optional n)
   "Visit previous next-error message and corresponding source code.
 
 Prefix arg N says how many error messages to move backwards (or
@@ -183,9 +183,9 @@
 
 This operates on the output from the \\[compile] and \\[grep] commands."
   (interactive "p")
-  (next-error (- n)))
-
-(defun first-error (n)
+  (next-error (- (or n 1))))
+
+(defun first-error (&optional n)
   "Restart at the first error.
 Visit corresponding source code.
 With prefix arg N, visit the source code of the Nth error.
@@ -193,25 +193,63 @@
   (interactive "p")
   (next-error n t))
 
-(defun next-error-no-select (n)
+(defun next-error-no-select (&optional n)
   "Move point to the next error in the next-error buffer and highlight match.
 Prefix arg N says how many error messages to move forwards (or
 backwards, if negative).
 Finds and highlights the source line like \\[next-error], but does not
 select the source buffer."
   (interactive "p")
-  (next-error n)
+  (let ((next-error-highlight next-error-highlight-no-select))
+    (next-error n))
   (pop-to-buffer next-error-last-buffer))
 
-(defun previous-error-no-select (n)
+(defun previous-error-no-select (&optional n)
   "Move point to the previous error in the next-error buffer and highlight match.
 Prefix arg N says how many error messages to move backwards (or
 forwards, if negative).
 Finds and highlights the source line like \\[previous-error], but does not
 select the source buffer."
   (interactive "p")
-  (next-error-no-select (- n)))
-
+  (next-error-no-select (- (or n 1))))
+
+(defgroup next-error nil
+  "next-error support framework."
+  :group 'compilation
+  :version "21.4")
+
+(defface next-error
+  '((t (:inherit region)))
+  "Face used to highlight next error locus."
+  :group 'next-error
+  :version "21.4")
+
+(defcustom next-error-highlight 0.1
+  "*Highlighting of locations in selected source buffers.
+If number, highlight the locus in next-error face for given time in seconds.
+If t, use persistent overlays fontified in next-error face.
+If nil, don't highlight the locus in the source buffer.
+If `fringe-arrow', indicate the locus by the fringe arrow."
+  :type '(choice (number :tag "Delay")
+                 (const :tag "Persistent overlay" t)
+                 (const :tag "No highlighting" nil)
+                 (const :tag "Fringe arrow" 'fringe-arrow))
+  :group 'next-error
+  :version "21.4")
+
+(defcustom next-error-highlight-no-select 0.1
+  "*Highlighting of locations in non-selected source buffers.
+If number, highlight the locus in next-error face for given time in seconds.
+If t, use persistent overlays fontified in next-error face.
+If nil, don't highlight the locus in the source buffer.
+If `fringe-arrow', indicate the locus by the fringe arrow."
+  :type '(choice (number :tag "Delay")
+                 (const :tag "Persistent overlay" t)
+                 (const :tag "No highlighting" nil)
+                 (const :tag "Fringe arrow" 'fringe-arrow))
+  :group 'next-error
+  :version "21.4")
+
 ;;;
 
 (defun fundamental-mode ()
--- a/lisp/x-dnd.el	Tue Aug 31 16:31:03 2004 +0000
+++ b/lisp/x-dnd.el	Thu Sep 02 07:43:01 2004 +0000
@@ -58,8 +58,8 @@
     )
 
   "The functions to call for different protocols when a drop is made.
-This variable is used by `x-dnd-handle-uri-list' and `x-dnd-handle-moz-url'.
-The list contains of (REGEXP . FUNCTION) pairs.
+This variable is used by `x-dnd-handle-uri-list', `x-dnd-handle-file-name'
+and `x-dnd-handle-moz-url'.  The list contains of (REGEXP . FUNCTION) pairs.
 The functions shall take two arguments, URL, which is the URL dropped and
 ACTION which is the action to be performed for the drop (move, copy, link,
 private or ask).
@@ -104,9 +104,7 @@
   :type 'boolean
   :group 'x)
 
-;; Internal variables
-
-(defvar x-dnd-known-types
+(defcustom x-dnd-known-types
   '("text/uri-list"
     "text/x-moz-url"
     "_NETSCAPE_URL"
@@ -121,7 +119,12 @@
     "TEXT"
     )
   "The types accepted by default for dropped data.
-The types are chosen in the order they appear in the list.")
+The types are chosen in the order they appear in the list."
+  :type '(repeat string)
+  :group 'x
+)
+
+;; Internal variables
 
 (defvar x-dnd-current-state nil
   "The current state for a drop.
@@ -866,7 +869,7 @@
 	      timestamp)
 	     (x-dnd-forget-drop frame)))
 
-	  (t (error "Unknown Motif DND message %s %s" message data)))))
+	  (t (error "Unknown Motif DND message %s %s" message-atom data)))))
 					   
 
 ;;;
--- a/man/ChangeLog	Tue Aug 31 16:31:03 2004 +0000
+++ b/man/ChangeLog	Thu Sep 02 07:43:01 2004 +0000
@@ -1,3 +1,14 @@
+2004-08-31  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* kmacro.texi (Basic Keyboard Macro):
+	`apply-macro-to-region-lines' now operates on all lines that begin
+	in the region, rather than on all complete lines in the region.
+
+2004-08-31  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* frames.texi (Drag and drop): Add documentation about
+	x-dnd-test-function and x-dnd-known-types.
+
 2004-08-30  Luc Teirlinck  <teirllm@auburn.edu>
 
 	* indent.texi: Various minor changes in addition to:
--- a/man/frames.texi	Tue Aug 31 16:31:03 2004 +0000
+++ b/man/frames.texi	Thu Sep 02 07:43:01 2004 +0000
@@ -809,6 +809,17 @@
 copied or moved (depends on exactly how it is dragged and the application
 it was dragged from) to the directory the dired buffer is displaying.
 
+@vindex x-dnd-test-function
+@vindex x-dnd-known-types
+  When a user drags something from another application over Emacs, that other
+application expects Emacs to tell it if Emacs can handle the data that is
+dragged.  The variable @code{x-dnd-test-function} is used by Emacs to determine
+what to reply.  The default value is @code{x-dnd-default-test-function}
+which accepts drops if the type of the data to be dropped is present in
+@code{x-dnd-known-types}.  You can customize @code{x-dnd-test-function} and/or
+@code{x-dnd-known-types} if you want Emacs to accept or reject drops based
+on some other criteria.
+
 @vindex x-dnd-open-file-other-window
   A file is normally opened in the window it is dropped on, but if you
 prefer the file to be opened in a new window you can customize the variable
--- a/man/kmacro.texi	Tue Aug 31 16:31:03 2004 +0000
+++ b/man/kmacro.texi	Thu Sep 02 07:43:01 2004 +0000
@@ -71,7 +71,7 @@
 @item C-x C-k e
 Edit a previously defined keyboard macro (@code{edit-kbd-macro}).
 @item C-x C-k r
-Run the last keyboard macro on each complete line in the region
+Run the last keyboard macro on each line that begins in the region
 (@code{apply-macro-to-region-lines}).
 @end table
 
@@ -174,8 +174,8 @@
 @findex apply-macro-to-region-lines
 @kindex C-x C-k r
   The command @kbd{C-x C-k r} (@code{apply-macro-to-region-lines})
-repeats the last defined keyboard macro on each complete line within
-the current region.  It does this line by line, by moving point to the
+repeats the last defined keyboard macro on each line that begins in
+the region.  It does this line by line, by moving point to the
 beginning of the line and then executing the macro.
 
 @node Keyboard Macro Ring
--- a/src/ChangeLog	Tue Aug 31 16:31:03 2004 +0000
+++ b/src/ChangeLog	Thu Sep 02 07:43:01 2004 +0000
@@ -1,3 +1,8 @@
+2004-08-31  NAKAMURA Toshikazu  <nr-tkz@nifty.com>  (tiny change)
+
+	* w32fns.c (w32_load_font): If a BDF font is already loaded, do not
+	reload it.
+
 2004-08-30  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
 	* macmenu.c (_widget_value): Added lname and lkey.
--- a/src/w32fns.c	Tue Aug 31 16:31:03 2004 +0000
+++ b/src/w32fns.c	Thu Sep 02 07:43:01 2004 +0000
@@ -4642,6 +4642,7 @@
 {
   Lisp_Object bdf_fonts;
   struct font_info *retval = NULL;
+  struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
 
   bdf_fonts = w32_list_bdf_fonts (build_string (fontname), 1);
 
@@ -4649,11 +4650,22 @@
     {
       char *bdf_name, *bdf_file;
       Lisp_Object bdf_pair;
+      int i;
 
       bdf_name = SDATA (XCAR (bdf_fonts));
       bdf_pair = Fassoc (XCAR (bdf_fonts), Vw32_bdf_filename_alist);
       bdf_file = SDATA (XCDR (bdf_pair));
 
+      // If the font is already loaded, do not load it again.
+      for (i = 0; i < dpyinfo->n_fonts; i++)
+	{
+	  if ((dpyinfo->font_table[i].name
+	       && !strcmp (dpyinfo->font_table[i].name, bdf_name))
+	      || (dpyinfo->font_table[i].full_name
+		  && !strcmp (dpyinfo->font_table[i].full_name, bdf_name)))
+	    return dpyinfo->font_table + i;
+	}
+
       retval = w32_load_bdf_font (f, bdf_name, size, bdf_file);
 
       bdf_fonts = XCDR (bdf_fonts);