Function: align-match-tex-pattern
align-match-tex-pattern is a byte-compiled function defined in
align.el.gz.
Signature
(align-match-tex-pattern REGEXP END &optional REVERSE)
Documentation
Match REGEXP in TeX mode, counting backslashes appropriately.
END denotes the end of the region to be searched, while REVERSE, if non-nil, indicates that the search should proceed backward from the current position.
Source Code
;; Defined in /usr/src/emacs/lisp/align.el.gz
;;; Internal Functions:
(defun align-match-tex-pattern (regexp end &optional reverse)
"Match REGEXP in TeX mode, counting backslashes appropriately.
END denotes the end of the region to be searched, while REVERSE, if
non-nil, indicates that the search should proceed backward from the
current position."
(let (result)
(while
(and (setq result
(funcall
(if reverse 're-search-backward
're-search-forward)
(concat "\\(\\s-*\\)" regexp
"\\(\\s-*\\)") end t))
(let ((pos (match-end 1))
(count 0))
(while (and (> pos (point-min))
(eq (char-before pos) ?\\))
(setq count (1+ count) pos (1- pos)))
(eq (mod count 2) 1))
(goto-char (match-beginning (if reverse 1 2)))))
result))