/[auctex]/auctex/texmathp.el
ViewVC logotype

Diff of /auctex/texmathp.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 5.16 by ataka, Thu Sep 29 11:08:19 2005 UTC revision 5.17 by angeli, Sun Oct 2 11:22:30 2005 UTC
# Line 316  Limit searched to BOUND.  The return val Line 316  Limit searched to BOUND.  The return val
316    (catch 'exit    (catch 'exit
317      (save-excursion      (save-excursion
318        (and (null texmathp-environments) (throw 'exit nil))        (and (null texmathp-environments) (throw 'exit nil))
319        (let (end-list env)        ;; Check if the line we are starting with is a commented one.
320          (let ((orig-comment-flag
321                 ;; Could be replaced by `TeX-in-commented-line'.
322                 (progn
323                   (save-excursion
324                     (beginning-of-line)
325                     (skip-chars-forward " \t")
326                     (string= (buffer-substring-no-properties
327                               (point) (min (point-max)
328                                            (+ (point) (length comment-start))))
329                              comment-start))))
330                end-list env)
331          (while (re-search-backward "\\\\\\(begin\\|end\\)[ \t]*{\\([^}]+\\)}"          (while (re-search-backward "\\\\\\(begin\\|end\\)[ \t]*{\\([^}]+\\)}"
332                                     bound t)                                     bound t)
333            (setq env (buffer-substring-no-properties            ;; Check if the match found is inside of a comment.
334                       (match-beginning 2) (match-end 2)))            (let ((current-comment-flag
335            (cond ((string= (match-string 1) "end")                   ;; Could be replaced by `TeX-in-comment'.
336                   (setq end-list (cons env end-list)))                   (when (save-match-data
337                  ((equal env (car end-list))                           (re-search-backward comment-start-skip
338                   (setq end-list (cdr end-list)))                                               (line-beginning-position) t))
339                  ((member env texmathp-environments)                     ;; We need a t for comparison with `orig-comment-flag',
340                   (throw 'exit (cons env (point))))))                     ;; not a number.
341                       t)))
342                ;; Only consider matching alternatives with respect to
343                ;; "in-commentness", i.e. if we started with a comment
344                ;; only consider matches which are in comments as well and
345                ;; vice versa.
346                (when (eq orig-comment-flag current-comment-flag)
347                  (setq env (buffer-substring-no-properties
348                             (match-beginning 2) (match-end 2)))
349                  (cond ((string= (match-string 1) "end")
350                         (setq end-list (cons env end-list)))
351                        ((equal env (car end-list))
352                         (setq end-list (cdr end-list)))
353                        ((member env texmathp-environments)
354                         (throw 'exit (cons env (point))))))))
355          nil))))          nil))))
356    
357  (defun texmathp-match-macro (bound)  (defun texmathp-match-macro (bound)

Legend:
Removed from v.5.16  
changed lines
  Added in v.5.17

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26