[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 156/352: Tallennetaan ja palautetaan säännöllisten lausekkeiden
From: |
Stefan Monnier |
Subject: |
[elpa] 156/352: Tallennetaan ja palautetaan säännöllisten lausekkeiden täsmäystiedot |
Date: |
Mon, 07 Jul 2014 14:03:28 +0000 |
monnier pushed a commit to branch master
in repository elpa.
commit c265935cf89972d7df95ed7f3d4d910283409c9a
Author: Teemu Likonen <address@hidden>
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))))))))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- [elpa] 257/352: Use plural "actions" with the install instruction's autoload, (continued)
- [elpa] 257/352: Use plural "actions" with the install instruction's autoload, Stefan Monnier, 2014/07/07
- [elpa] 314/352: Add variable and interactive function wcheck-version, Stefan Monnier, 2014/07/07
- [elpa] 160/352: Hiotaan tekstipohjaista oikolukuehdotusvalikkoa, Stefan Monnier, 2014/07/07
- [elpa] 267/352: Rephrase examples, Stefan Monnier, 2014/07/07
- [elpa] 345/352: Use prefix wcheck-- in internal functions and variables, Stefan Monnier, 2014/07/07
- [elpa] 155/352: Varmistetaan, ettei välilyöntejä tulkita väärin regexpissä, Stefan Monnier, 2014/07/07
- [elpa] 113/352: Muutetaan lukemis- ja maalauspyyntöfunktioiden nimet, Stefan Monnier, 2014/07/07
- [elpa] 333/352: Add a missing "is" to README, Stefan Monnier, 2014/07/07
- [elpa] 262/352: Version 2011.06.29, Stefan Monnier, 2014/07/07
- [elpa] 351/352: Version 2014.6.21, Stefan Monnier, 2014/07/07
- [elpa] 156/352: Tallennetaan ja palautetaan säännöllisten lausekkeiden täsmäystiedot,
Stefan Monnier <=
- [elpa] 152/352: Toteutetaan wcheck-combine-overlapping-areas järkevämmin, Stefan Monnier, 2014/07/07
- [elpa] 150/352: Lisätään matalan tason funktiot face-tietojen käsittelyyn, Stefan Monnier, 2014/07/07
- [elpa] 296/352: Put the subtitle under the main title and modify it a bit, Stefan Monnier, 2014/07/07
- [elpa] 307/352: Add "URL" header which points to GitHub, Stefan Monnier, 2014/07/07
- [elpa] 322/352: Add Makefile to the repository, Stefan Monnier, 2014/07/07
- [elpa] 310/352: Update README.org url in doc string, Stefan Monnier, 2014/07/07
- [elpa] 159/352: Täydennetään funktioiden kuvauksia, Stefan Monnier, 2014/07/07
- [elpa] 275/352: Remove a duplicate sentence from wcheck-language-data doc, Stefan Monnier, 2014/07/07
- [elpa] 167/352: Vaihdetaan näppäimenlukufunktiota read-char-exclusive -> read-key, Stefan Monnier, 2014/07/07
- [elpa] 168/352: Dokumenttien kielellistä hienosäätöä, Stefan Monnier, 2014/07/07