(xscheme-control-g-synchronization-p): Doc fix.
[bpt/emacs.git] / lisp / replace.el
index 21aa051..219fab0 100644 (file)
@@ -240,8 +240,7 @@ Applies to lines after point."
   (setq occur-mode-map (make-sparse-keymap))
   (define-key occur-mode-map [mouse-2] 'occur-mode-mouse-goto)
   (define-key occur-mode-map "\C-c\C-c" 'occur-mode-goto-occurrence)
-  (define-key occur-mode-map "\C-m" 'occur-mode-goto-occurrence)
-  (define-key occur-mode-map [return] 'occur-mode-goto-occurrence))
+  (define-key occur-mode-map "\C-m" 'occur-mode-goto-occurrence))
 
 (defvar occur-buffer nil)
 (defvar occur-nlines nil)
@@ -345,6 +344,7 @@ It serves as a menu to find any of the occurrences in this buffer.
                 list-matching-lines-default-context-lines))
   (let ((first t)
        (buffer (current-buffer))
+       (dir default-directory)
        (linenum 1)
        (prevpos (point-min))
        (final-context-start (make-marker)))
@@ -355,6 +355,7 @@ It serves as a menu to find any of the occurrences in this buffer.
     (with-output-to-temp-buffer "*Occur*"
       (save-excursion
        (set-buffer standard-output)
+       (setq default-directory dir)
        ;; We will insert the number of lines, and "lines", later.
        (insert " matching ")
        (let ((print-escape-newlines t))
@@ -387,7 +388,7 @@ It serves as a menu to find any of the occurrences in this buffer.
                            (forward-line (1+ nlines))
                            (forward-line 1))
                        (point)))
-                (tag (format "%3d" linenum))
+                (tag (format "%5d" linenum))
                 (empty (make-string (length tag) ?\ ))
                 tem)
            (save-excursion
@@ -399,6 +400,8 @@ It serves as a menu to find any of the occurrences in this buffer.
                  (insert "--------\n"))
              (setq first nil)
              (insert-buffer-substring buffer start end)
+             (set-marker final-context-start 
+                         (- (point) (- end (match-end 0))))
              (backward-char (- end start))
              (setq tem nlines)
              (while (> tem 0)
@@ -406,11 +409,9 @@ It serves as a menu to find any of the occurrences in this buffer.
                (forward-line 1)
                (setq tem (1- tem)))
              (let ((this-linenum linenum))
-               (set-marker final-context-start
-                           (+ (point) (- (match-end 0) (match-beginning 0))))
                (while (< (point) final-context-start)
                  (if (null tag)
-                     (setq tag (format "%3d" this-linenum)))
+                     (setq tag (format "%5d" this-linenum)))
                  (insert tag ?:)
                  (put-text-property (save-excursion
                                       (beginning-of-line)
@@ -419,13 +420,18 @@ It serves as a menu to find any of the occurrences in this buffer.
                                       (end-of-line)
                                       (point))
                                     'mouse-face 'highlight)
+                 (forward-line 1)
                  (setq tag nil)
+                 (setq this-linenum (1+ this-linenum)))
+               (while (<= (point) final-context-start)
+                 (insert empty ?:)
                  (forward-line 1)
                  (setq this-linenum (1+ this-linenum))))
              (while (< tem nlines)
                (insert empty ?:)
                (forward-line 1)
-               (setq tem (1+ tem))))                           
+               (setq tem (1+ tem)))
+             (goto-char (point-max)))
            (forward-line 1)))
        (set-buffer standard-output)
        ;; Put positions in increasing order to go with buffer.
@@ -476,6 +482,8 @@ The valid answers include `act', `skip', `act-and-show',
 (define-key query-replace-map "!" 'automatic)
 (define-key query-replace-map "^" 'backup)
 (define-key query-replace-map "\C-h" 'help)
+(define-key query-replace-map [f1] 'help)
+(define-key query-replace-map [help] 'help)
 (define-key query-replace-map "?" 'help)
 (define-key query-replace-map "\C-g" 'quit)
 (define-key query-replace-map "\C-]" 'quit)
@@ -569,7 +577,10 @@ which will run faster and probably do exactly what you want."
              (while (not done)
                (store-match-data real-match-data)
                (replace-highlight (match-beginning 0) (match-end 0))
-               (message message from-string next-replacement)
+               ;; Bind message-log-max so we don't fill up the message log
+               ;; with a bunch of identical messages.
+               (let ((message-log-max nil))
+                 (message message from-string next-replacement))
                (setq key (read-event))
                (setq key (vector key))
                (setq def (lookup-key map key))