emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/textmodes/tex-mode.el


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/textmodes/tex-mode.el
Date: Mon, 09 Jun 2003 13:42:22 -0400

Index: emacs/lisp/textmodes/tex-mode.el
diff -c emacs/lisp/textmodes/tex-mode.el:1.134 
emacs/lisp/textmodes/tex-mode.el:1.135
*** emacs/lisp/textmodes/tex-mode.el:1.134      Sat Jun  7 20:49:38 2003
--- emacs/lisp/textmodes/tex-mode.el    Mon Jun  9 13:42:22 2003
***************
*** 1263,1279 ****
  ;;;; LaTeX syntax navigation
  ;;;;
  
  (defun tex-last-unended-begin ()
    "Leave point at the beginning of the last `\\begin{...}' that is unended."
    (condition-case nil
!       (while (and (re-search-backward "\\\\\\(begin\\|end\\)\\s *{")
                  (looking-at "\\\\end"))
        (tex-last-unended-begin))
      (search-failed (error "Couldn't find unended \\begin"))))
  
  (defun tex-next-unmatched-end ()
    "Leave point at the end of the next `\\end' that is unended."
!   (while (and (re-search-forward "\\\\\\(begin\\|end\\)\\s *{[^}]+}")
              (save-excursion (goto-char (match-beginning 0))
                              (looking-at "\\\\begin")))
      (tex-next-unmatched-end)))
--- 1263,1292 ----
  ;;;; LaTeX syntax navigation
  ;;;;
  
+ (defmacro tex-search-noncomment (&rest body)
+   "Execute BODY as long as it return non-nil and point is in a comment.
+ Return the value returned by the last execution of BODY."
+   (declare (debug t))
+   (let ((res-sym (make-symbol "result")))
+     `(let (,res-sym)
+        (while
+          (and (setq ,res-sym (progn ,@body))
+               (save-excursion (skip-chars-backward "^\n%") (not (bolp)))))
+        ,res-sym)))
+ 
  (defun tex-last-unended-begin ()
    "Leave point at the beginning of the last `\\begin{...}' that is unended."
    (condition-case nil
!       (while (and (tex-search-noncomment
!                  (re-search-backward "\\\\\\(begin\\|end\\)\\s *{"))
                  (looking-at "\\\\end"))
        (tex-last-unended-begin))
      (search-failed (error "Couldn't find unended \\begin"))))
  
  (defun tex-next-unmatched-end ()
    "Leave point at the end of the next `\\end' that is unended."
!   (while (and (tex-search-noncomment
!              (re-search-forward "\\\\\\(begin\\|end\\)\\s *{[^}]+}"))
              (save-excursion (goto-char (match-beginning 0))
                              (looking-at "\\\\begin")))
      (tex-next-unmatched-end)))
***************
*** 1813,1825 ****
    ;; FIXME: Use time-stamps on files to decide the next op.
    (interactive
     (let* ((file (tex-main-file))
!         (dir (prog1 (file-name-directory (expand-file-name file))
!                (setq file (file-name-nondirectory file))))
          (root (file-name-sans-extension file))
          (fspec (list (cons ?r (comint-quote-filename root))
                       (cons ?f (comint-quote-filename file))))
          (default (tex-compile-default fspec)))
!      (list dir
           (completing-read
            (format "Command [%s]: " (tex-summarize-command default))
            (mapcar (lambda (x)
--- 1826,1839 ----
    ;; FIXME: Use time-stamps on files to decide the next op.
    (interactive
     (let* ((file (tex-main-file))
!         (default-directory
!           (prog1 (file-name-directory (expand-file-name file))
!             (setq file (file-name-nondirectory file))))
          (root (file-name-sans-extension file))
          (fspec (list (cons ?r (comint-quote-filename root))
                       (cons ?f (comint-quote-filename file))))
          (default (tex-compile-default fspec)))
!      (list default-directory
           (completing-read
            (format "Command [%s]: " (tex-summarize-command default))
            (mapcar (lambda (x)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]