diff lisp/replace.el @ 90054:f2ebccfa87d4

Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-74 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-709 Update from CVS: src/indent.c (Fvertical_motion): Fix last change. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-710 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-715 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-716 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-74 Update from CVS
author Miles Bader <miles@gnu.org>
date Wed, 08 Dec 2004 05:02:30 +0000
parents cce1c0ee76ee 5ffd11b70941
children fb79180b618d
line wrap: on
line diff
--- a/lisp/replace.el	Mon Dec 06 12:38:25 2004 +0000
+++ b/lisp/replace.el	Wed Dec 08 05:02:30 2004 +0000
@@ -92,7 +92,7 @@
 		 (format "%s: " string))
 	       nil nil nil
 	       query-replace-from-history-variable
-	       nil t))))
+	       nil t t))))
       (if (and (zerop (length from)) lastto lastfrom)
 	  (cons lastfrom
 		(query-replace-compile-replacement lastto regexp-flag))
@@ -156,7 +156,7 @@
      (read-from-minibuffer
       (format "%s %s with: " string (query-replace-descr from))
       nil nil nil
-      query-replace-to-history-variable from t))
+      query-replace-to-history-variable from t t))
    regexp-flag))
 
 (defun query-replace-read-args (string regexp-flag &optional noerror)
@@ -734,18 +734,23 @@
   "Move to the Nth (default 1) next match in an Occur mode buffer.
 Compatibility function for \\[next-error] invocations."
   (interactive "p")
-  (when reset
-    (occur-find-match 0 #'next-single-property-change "No first match"))
-  (occur-find-match
-   (prefix-numeric-value argp)
-   (if (> 0 (prefix-numeric-value argp))
-       #'previous-single-property-change
-     #'next-single-property-change)
-   "No more matches")
-  ;; In case the *Occur* buffer is visible in a nonselected window.
-  (set-window-point (get-buffer-window (current-buffer)) (point))
-  (occur-mode-goto-occurrence))
-
+  ;; we need to run occur-find-match from within the Occur buffer
+  (with-current-buffer 
+      (if (next-error-buffer-p (current-buffer))
+	  (current-buffer)
+	(next-error-find-buffer nil nil (lambda() (eq major-mode 'occur-mode))))
+    
+    (when reset
+      (goto-char (point-min)))
+    (occur-find-match
+     (abs (prefix-numeric-value argp))
+     (if (> 0 (prefix-numeric-value argp))
+	 #'previous-single-property-change
+       #'next-single-property-change)
+     "No more matches")
+    ;; In case the *Occur* buffer is visible in a nonselected window.
+    (set-window-point (get-buffer-window (current-buffer)) (point))
+    (occur-mode-goto-occurrence)))
 
 (defcustom list-matching-lines-default-context-lines 0
   "*Default number of context lines included around `list-matching-lines' matches.
@@ -768,7 +773,7 @@
   :type 'face
   :group 'matching)
 
-(defun occur-accumulate-lines (count &optional no-props)
+(defun occur-accumulate-lines (count &optional keep-props)
   (save-excursion
     (let ((forwardp (> count 0))
 	  (result nil))
@@ -778,9 +783,9 @@
 			(bobp))))
 	(setq count (+ count (if forwardp -1 1)))
 	(push
-	 (funcall (if no-props
-		      #'buffer-substring-no-properties
-		    #'buffer-substring)
+	 (funcall (if keep-props
+		      #'buffer-substring
+		    #'buffer-substring-no-properties)
 	  (line-beginning-position)
 	  (line-end-position))
 	 result)
@@ -915,7 +920,7 @@
 		    (and case-fold-search
 			 (isearch-no-upper-case-p regexp t))
 		    list-matching-lines-buffer-name-face
-		    nil list-matching-lines-face nil)))
+		    nil list-matching-lines-face t)))
 	(let* ((bufcount (length active-bufs))
 	       (diff (- (length bufs) bufcount)))
 	  (message "Searched %d buffer%s%s; %s match%s for `%s'"
@@ -998,7 +1003,11 @@
 					     (append
 					      `(occur-match t)
 					      (when match-face
-						`(font-lock-face ,match-face)))
+						;; Use `face' rather than
+						;; `font-lock-face' here
+						;; so as to override faces
+						;; copied from the buffer.
+						`(face ,match-face)))
 					     curstring)
 			(setq start (match-end 0))))
 		    ;; Generate the string to insert for this match