emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] 232/352: Yksinkertaisempi silmukka: -read-strings ja -paint-strin


From: Stefan Monnier
Subject: [elpa] 232/352: Yksinkertaisempi silmukka: -read-strings ja -paint-strings
Date: Mon, 07 Jul 2014 14:04:28 +0000

monnier pushed a commit to branch master
in repository elpa.

commit 5b27989e49d0d6d1fdaed0f06483acdb5897f816
Author: Teemu Likonen <address@hidden>
Date:   Sat Feb 5 11:20:35 2011 +0000

    Yksinkertaisempi silmukka: -read-strings ja -paint-strings
---
 wcheck-mode.el |   80 ++++++++++++++++++++++++-------------------------------
 1 files changed, 35 insertions(+), 45 deletions(-)

diff --git a/wcheck-mode.el b/wcheck-mode.el
index 216dfb6..f9eaa07 100644
--- a/wcheck-mode.el
+++ b/wcheck-mode.el
@@ -1264,31 +1264,25 @@ areas, including invisible ones. Otherwise skip 
invisible text."
            (with-syntax-table (eval syntax)
              (goto-char beg)
              (save-match-data
-               (catch 'infinite
-                 (while (re-search-forward regexp end t)
-                   (cond ((= (point) old-point)
-                          ;; Make sure we don't end up in an infinite
-                          ;; loop when the regexp always matches with
-                          ;; zero width in the current point position.
-                          (throw 'infinite t))
-
-                         ((and (not invisible)
-                               (invisible-p (match-beginning 1)))
-                          ;; This point is invisible. Let's jump forward
-                          ;; to next change of "invisible" property.
-                          (goto-char (next-single-char-property-change
-                                      (match-beginning 1) 'invisible buffer
-                                      end)))
-
-                         ((and (eval face-p)
-                               (or (equal regexp-discard "")
-                                   (not (string-match
-                                         regexp-discard
-                                         (match-string-no-properties 1)))))
-                          ;; Add the match to the string list.
-                          (add-to-list
-                           'strings (match-string-no-properties 1))))
-                   (setq old-point (point))))))
+               (while (and (re-search-forward regexp end t)
+                           (> (point) old-point))
+                 (cond ((and (not invisible)
+                             (invisible-p (match-beginning 1)))
+                        ;; This point is invisible. Let's jump forward
+                        ;; to next change of "invisible" property.
+                        (goto-char (next-single-char-property-change
+                                    (match-beginning 1) 'invisible buffer
+                                    end)))
+
+                       ((and (eval face-p)
+                             (or (equal regexp-discard "")
+                                 (not (string-match
+                                       regexp-discard
+                                       (match-string-no-properties 1)))))
+                        ;; Add the match to the string list.
+                        (add-to-list
+                         'strings (match-string-no-properties 1))))
+                 (setq old-point (point)))))
            strings))))))
 
 
@@ -1331,26 +1325,22 @@ text."
                        old-point 0)
                  (goto-char beg)
 
-                 (catch 'infinite
-                   (while (re-search-forward regexp end t)
-                     (cond ((= (point) old-point)
-                            ;; We didn't move forward so break the loop.
-                            ;; Otherwise we would loop endlessly.
-                            (throw 'infinite t))
-                           ((and (not invisible)
-                                 (invisible-p (match-beginning 1)))
-                            ;; The point is invisible so jump forward to
-                            ;; the next change of "invisible" text
-                            ;; property.
-                            (goto-char (next-single-char-property-change
-                                        (match-beginning 1) 'invisible buffer
-                                        end)))
-                           ((eval face-p)
-                            ;; Make an overlay.
-                            (wcheck-make-overlay
-                             buffer ol-face ol-mouse-face ol-help-echo 
ol-keymap
-                             (match-beginning 1) (match-end 1))))
-                     (setq old-point (point)))))))))))))
+                 (while (and (re-search-forward regexp end t)
+                             (> (point) old-point))
+                   (cond ((and (not invisible)
+                               (invisible-p (match-beginning 1)))
+                          ;; The point is invisible so jump forward to
+                          ;; the next change of "invisible" text
+                          ;; property.
+                          (goto-char (next-single-char-property-change
+                                      (match-beginning 1) 'invisible buffer
+                                      end)))
+                         ((eval face-p)
+                          ;; Make an overlay.
+                          (wcheck-make-overlay
+                           buffer ol-face ol-mouse-face ol-help-echo ol-keymap
+                           (match-beginning 1) (match-end 1))))
+                   (setq old-point (point))))))))))))
 
 
 ;;; Jump forward or backward



reply via email to

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