I have just seen a state problem with regexps. I am not able to isolate the problem completely at the moment, but here is a sketch of it:

I have this regexp:

(defconst mumamo-script-tag-start-regex
  (rx "<script"
      (1+ space)
      "type"
      (0+ space)
      "="
      (0+ space)
      ?\"
      ;;(or "text" "application")
      ;;"/"
      ;;(or "javascript" "ecmascript")
      "text/javascript"
      ?\"
      (0+ (not (any ">")))
      ">"
      (optional (0+ space) "<![CDATA[" )
      ))

This matches at the start of this text with `looking-at':

<script type="text/javascript">
<![CDATA[

However sometimes it matches just to the end of the first line and sometimes to the end of the second line (as it should). I am using this little function to test:

(defun x() (interactive)
  (when (looking-at mumamo-script-tag-start-regex)
    (goto-char (match-end 0))))

(global-set-key [f7] 'x)

That is unfortunately not all that is needed to reproduce the problem however. It looks like the regexp engine somehow saves a state. Once it matches the first variant it continue to do that and the same for the second variant. It does not matter where in the file I try to do the match. (As long as the text above is available at the test point of course.)

As I said it is easily reproduceable by me, but unfortunately there is a lot of other code involved to "switch between the two states above".




In GNU Emacs 22.1.50.1 (i386-mingw-nt5.1.2600)
 of 2007-04-27 on


_______________________________________________
emacs-pretest-bug mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug

Reply via email to