Commits

camlspotter  committed c09ecfe

hopefully avoid infinite loops at looking-at

  • Participants
  • Parent commits e9e5a83

Comments (0)

Files changed (1)

File offside-trap.el

 
 ;; if the lines match with the following regexp, they are skipped
 ;; in the sticky check.
-;; CR: It is not perfect. ex: {- "{-" -}. But who cares?
-;; CR: it may loop infinitely!!!
+;; CR: It is not perfect. ex: {- "{-" -}. But who cares? ;; -> now it's fixed
 (defconst offside-trap-sticky-skip-lines-regexp
-  (let ((empty-or-commented "[ \t]*\\(--.*\\)?\n")
-	(block-comment "[ \t]*{-\\([^-.]\\|-[^}]\\|\n\\)*-}.*\n"))
-    (format "\\(%s\\|%s\\)+" empty-or-commented block-comment)))
+  (let ((empty "[ \t]*\n")
+	(commented "[ \t]*--.*\n")
+	(block-comment "[ \t]*{-\\([^-]\\|-[^}]\\)*-}[ \t]*\n"))
+    (format "\\(%s\\|%s\\|%s\\)+" empty commented block-comment)))
 
 (defun offside-trap-skip-sticky-skip-lines ()
   (if (save-excursion
       (progn
 	(move-beginning-of-line nil)
 	(re-search-forward offside-trap-sticky-skip-lines-regexp)
+	;; (save-excursion (forward-char -1) (insert "XX"))
 	t)
     nil))
 
 	    (forward-line 1))
 	(while
 	    (if (offside-trap-skip-sticky-skip-lines)
-		(not (= (point-at-eol) (point-max)))
+		(not (= (point) (point-max)))
 	      (if (offside-trap-is-sticky-line min-indent)
 		  (progn
+		    ;; (insert "<>")
 		    (setq result (line-number-at-pos))
 		    (if (= (point-at-eol) (point-max)) nil
 		      (forward-line 1)