emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/replace.el


From: Juri Linkov
Subject: [Emacs-diffs] Changes to emacs/lisp/replace.el
Date: Thu, 16 Dec 2004 08:33:51 -0500

Index: emacs/lisp/replace.el
diff -c emacs/lisp/replace.el:1.196 emacs/lisp/replace.el:1.197
*** emacs/lisp/replace.el:1.196 Thu Dec 16 07:16:17 2004
--- emacs/lisp/replace.el       Thu Dec 16 13:16:30 2004
***************
*** 735,750 ****
  Compatibility function for \\[next-error] invocations."
    (interactive "p")
    ;; 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")
--- 735,751 ----
  Compatibility function for \\[next-error] invocations."
    (interactive "p")
    ;; 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))))
! 
!     (goto-char (cond (reset (point-min))
!                    ((< argp 0) (line-beginning-position))
!                    ((line-end-position))))
      (occur-find-match
!      (abs argp)
!      (if (> 0 argp)
         #'previous-single-property-change
         #'next-single-property-change)
       "No more matches")
***************
*** 790,807 ****
  (defun occur-accumulate-lines (count &optional keep-props)
    (save-excursion
      (let ((forwardp (> count 0))
!         (result nil))
        (while (not (or (zerop count)
                      (if forwardp
                          (eobp)
                        (bobp))))
        (setq count (+ count (if forwardp -1 1)))
        (push
         (funcall (if keep-props
                      #'buffer-substring
                    #'buffer-substring-no-properties)
!         (line-beginning-position)
!         (line-end-position))
         result)
        (forward-line (if forwardp 1 -1)))
        (nreverse result))))
--- 791,812 ----
  (defun occur-accumulate-lines (count &optional keep-props)
    (save-excursion
      (let ((forwardp (> count 0))
!         result beg end)
        (while (not (or (zerop count)
                      (if forwardp
                          (eobp)
                        (bobp))))
        (setq count (+ count (if forwardp -1 1)))
+       (setq beg (line-beginning-position)
+             end (line-end-position))
+       (if (and keep-props font-lock-mode
+                (text-property-not-all beg end 'fontified t))
+           (font-lock-fontify-region beg end))
        (push
         (funcall (if keep-props
                      #'buffer-substring
                    #'buffer-substring-no-properties)
!                 beg end)
         result)
        (forward-line (if forwardp 1 -1)))
        (nreverse result))))
***************
*** 996,1009 ****
                  (when (setq endpt (re-search-forward regexp nil t))
                    (setq matches (1+ matches)) ;; increment match count
                    (setq matchbeg (match-beginning 0))
-                   (setq begpt (save-excursion
-                                 (goto-char matchbeg)
-                                 (line-beginning-position)))
                    (setq lines (+ lines (1- (count-lines origpt endpt))))
                    (setq marker (make-marker))
                    (set-marker marker matchbeg)
!                   (setq curstring (buffer-substring begpt
!                                                     (line-end-position)))
                    ;; Depropertize the string, and maybe
                    ;; highlight the matches
                    (let ((len (length curstring))
--- 1001,1017 ----
                  (when (setq endpt (re-search-forward regexp nil t))
                    (setq matches (1+ matches)) ;; increment match count
                    (setq matchbeg (match-beginning 0))
                    (setq lines (+ lines (1- (count-lines origpt endpt))))
+                   (save-excursion
+                     (goto-char matchbeg)
+                     (setq begpt (line-beginning-position)
+                           endpt (line-end-position)))
                    (setq marker (make-marker))
                    (set-marker marker matchbeg)
!                   (if (and keep-props font-lock-mode
!                            (text-property-not-all begpt endpt 'fontified t))
!                       (font-lock-fontify-region begpt endpt))
!                   (setq curstring (buffer-substring begpt endpt))
                    ;; Depropertize the string, and maybe
                    ;; highlight the matches
                    (let ((len (length curstring))
***************
*** 1012,1028 ****
                        (set-text-properties 0 len nil curstring))
                      (while (and (< start len)
                                  (string-match regexp curstring start))
!                       (add-text-properties (match-beginning 0)
!                                            (match-end 0)
!                                            (append
!                                             `(occur-match t)
!                                             (when 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
                    (let* ((out-line
--- 1020,1034 ----
                        (set-text-properties 0 len nil curstring))
                      (while (and (< start len)
                                  (string-match regexp curstring start))
!                       (add-text-properties
!                        (match-beginning 0) (match-end 0)
!                        (append
!                         `(occur-match t)
!                         (when 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
                    (let* ((out-line
***************
*** 1033,1039 ****
                                     (when prefix-face
                                       `(font-lock-face prefix-face))
                                     '(occur-prefix t)))
!                            curstring
                             "\n"))
                           (data
                            (if (= nlines 0)
--- 1039,1048 ----
                                     (when prefix-face
                                       `(font-lock-face prefix-face))
                                     '(occur-prefix t)))
!                            ;; We don't put `mouse-face' on the newline,
!                            ;; because that loses.  And don't put it
!                            ;; on context lines to reduce flicker.
!                            (propertize curstring 'mouse-face 'highlight)
                             "\n"))
                           (data
                            (if (= nlines 0)
***************
*** 1057,1066 ****
                            (insert "-------\n"))
                          (add-text-properties
                           beg end
!                          `(occur-target ,marker help-echo "mouse-2: go to 
this occurrence"))
!                         ;; We don't put `mouse-face' on the newline,
!                         ;; because that loses.
!                         (add-text-properties beg (1- end) '(mouse-face 
highlight)))))
                    (goto-char endpt))
                  (if endpt
                      (progn
--- 1066,1072 ----
                            (insert "-------\n"))
                          (add-text-properties
                           beg end
!                          `(occur-target ,marker help-echo "mouse-2: go to 
this occurrence")))))
                    (goto-char endpt))
                  (if endpt
                      (progn




reply via email to

[Prev in Thread] Current Thread [Next in Thread]