emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r99725: * replace.el (occur-accumulat


From: Juri Linkov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r99725: * replace.el (occur-accumulate-lines, occur-engine):
Date: Tue, 23 Mar 2010 09:16:57 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 99725
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Tue 2010-03-23 09:16:57 +0200
message:
  * replace.el (occur-accumulate-lines, occur-engine):
  Use `occur-engine-line' instead of duplicate code.
  (occur-engine-line): New function created from duplicate code
  in `occur-accumulate-lines' and `occur-engine'.
modified:
  lisp/ChangeLog
  lisp/replace.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-03-23 07:11:50 +0000
+++ b/lisp/ChangeLog    2010-03-23 07:16:57 +0000
@@ -1,5 +1,12 @@
 2010-03-23  Juri Linkov  <address@hidden>
 
+       * replace.el (occur-accumulate-lines, occur-engine):
+       Use `occur-engine-line' instead of duplicate code.
+       (occur-engine-line): New function created from duplicate code
+       in `occur-accumulate-lines' and `occur-engine'.
+
+2010-03-23  Juri Linkov  <address@hidden>
+
        * finder.el: Remove TODO tasks.
 
        * info.el (Info-finder-find-node): Add node "all"

=== modified file 'lisp/replace.el'
--- a/lisp/replace.el   2010-03-21 10:52:51 +0000
+++ b/lisp/replace.el   2010-03-23 07:16:57 +0000
@@ -1016,18 +1016,7 @@
        (setq count (+ count (if forwardp -1 1)))
        (setq beg (line-beginning-position)
              end (line-end-position))
-       (if (and keep-props (if (boundp 'jit-lock-mode) jit-lock-mode)
-                (text-property-not-all beg end 'fontified t))
-           (if (fboundp 'jit-lock-fontify-now)
-               (jit-lock-fontify-now beg end)))
-       (push
-        (if (and keep-props (not (eq occur-excluded-properties t)))
-            (let ((str (buffer-substring beg end)))
-              (remove-list-of-text-properties
-               0 (length str) occur-excluded-properties str)
-              str)
-          (buffer-substring-no-properties beg end))
-        result)
+       (push (occur-engine-line beg end) result)
        (forward-line (if forwardp 1 -1)))
       (nreverse result))))
 
@@ -1228,17 +1217,7 @@
                            endpt (line-end-position)))
                    (setq marker (make-marker))
                    (set-marker marker matchbeg)
-                   (if (and keep-props
-                            (if (boundp 'jit-lock-mode) jit-lock-mode)
-                            (text-property-not-all begpt endpt 'fontified t))
-                       (if (fboundp 'jit-lock-fontify-now)
-                           (jit-lock-fontify-now begpt endpt)))
-                   (if (and keep-props (not (eq occur-excluded-properties t)))
-                       (progn
-                         (setq curstring (buffer-substring begpt endpt))
-                         (remove-list-of-text-properties
-                          0 (length curstring) occur-excluded-properties 
curstring))
-                     (setq curstring (buffer-substring-no-properties begpt 
endpt)))
+                   (setq curstring (occur-engine-line begpt endpt))
                    ;; Highlight the matches
                    (let ((len (length curstring))
                          (start 0))
@@ -1335,6 +1314,18 @@
       ;; Return the number of matches
       globalcount)))
 
+(defun occur-engine-line (beg end)
+  (if (and keep-props (if (boundp 'jit-lock-mode) jit-lock-mode)
+          (text-property-not-all beg end 'fontified t))
+      (if (fboundp 'jit-lock-fontify-now)
+         (jit-lock-fontify-now beg end)))
+  (if (and keep-props (not (eq occur-excluded-properties t)))
+      (let ((str (buffer-substring beg end)))
+       (remove-list-of-text-properties
+        0 (length str) occur-excluded-properties str)
+       str)
+    (buffer-substring-no-properties beg end)))
+
 ;; Generate context display for occur.
 ;; OUT-LINE is the line where the match is.
 ;; NLINES and KEEP-PROPS are args to occur-engine.


reply via email to

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