monnier pushed a commit to branch master
in repository elpa.
commit c265935cf89972d7df95ed7f3d4d910283409c9a
Author: Teemu Likonen <[email protected]>
Date: Mon Aug 2 12:18:24 2010 +0000
Tallennetaan ja palautetaan säännöllisten lausekkeiden täsmäystiedot
Laitetaan wcheck-moden sisäisten etsimistoimintojen ympärille
(save-match-data ...), jolloin mahdolliset käyttäjän jäljiltä olevat
täsmäystiedot säilyvät.
---
wcheck-mode.el | 96 +++++++++++++++++++++++++++++---------------------------
1 files changed, 50 insertions(+), 46 deletions(-)
diff --git a/wcheck-mode.el b/wcheck-mode.el
index d507d2f..4fdee0e 100644
--- a/wcheck-mode.el
+++ b/wcheck-mode.el
@@ -863,28 +863,30 @@ elements between BEG and END; all hidden parts are
omitted."
(with-syntax-table syntax
(goto-char beg)
- (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))
-
- ((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 discard "")
- (not (string-match
- discard (match-string-no-properties
1)))))
- ;; Add the match to the word list.
- (add-to-list 'words (match-string-no-properties 1))))
- (setq old-point (point)))))
+ (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))
+
+ ((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 discard "")
+ (not (string-match
+ discard
+ (match-string-no-properties 1)))))
+ ;; Add the match to the word list.
+ (add-to-list 'words (match-string-no-properties 1))))
+ (setq old-point (point))))))
words)))))
@@ -922,30 +924,32 @@ visible in BUFFER within position range from BEG to END."
regexp old-point)
(with-syntax-table syntax
- (dolist (word wordlist)
- (setq regexp (concat r-start "\\("
- (regexp-quote word) "\\)"
- r-end)
- 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))
- ((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 face (match-beginning 1) (match-end 1))))
- (setq old-point (point)))))))))))
+ (save-match-data
+ (dolist (word wordlist)
+ (setq regexp (concat r-start "\\("
+ (regexp-quote word) "\\)"
+ r-end)
+ 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))
+ ((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 face (match-beginning 1) (match-end 1))))
+ (setq old-point (point))))))))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;