auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] Changes to auctex/font-latex.el


From: Ralf Angeli
Subject: [AUCTeX-diffs] Changes to auctex/font-latex.el
Date: Tue, 10 May 2005 03:42:36 -0400

Index: auctex/font-latex.el
diff -u auctex/font-latex.el:5.112 auctex/font-latex.el:5.113
--- auctex/font-latex.el:5.112  Mon May  9 12:19:39 2005
+++ auctex/font-latex.el        Tue May 10 07:42:35 2005
@@ -1077,6 +1077,21 @@
     (not (= (progn (beginning-of-line) (point))
             (progn (goto-char cache-start) (beginning-of-line) (point))))))
 
+(defun font-latex-forward-comment ()
+  "Like `forward-comment' but with special provisions for docTeX mode.
+In docTeX mode \"%\" at the start of a line will be treated as whitespace."
+  (if (eq major-mode 'doctex-mode)
+      ;; XXX: We should probably cater for ^^A as well.
+      (progn
+       (when (bolp) (skip-chars-forward "%"))
+       (skip-chars-forward " \t\n")
+       (while (looking-at "^%* [ \t]*$") (beginning-of-line 2))
+       (when (bolp) (skip-chars-forward "%"))
+       (skip-chars-forward " \t")
+       (when (eq (char-after) ?%)
+         (beginning-of-line 2)))
+    (forward-comment 1)))
+
 
 ;;;;------------------
 ;;;; Cache Method:
@@ -1252,11 +1267,11 @@
        (setq kend (point))
        ;; FIXME: `forward-comment' should disregard comment starters
        ;; at line beginnings. (Performace hog!)
-       (while (and (< (point) limit) (forward-comment 1)))
+       (while (and (< (point) limit) (font-latex-forward-comment)))
        ;; Optional arguments [...]
        (while (and (< (point) limit)
                    (eq (following-char) ?\[))
-         (setq sbeg kend)
+         (setq sbeg (point))
          (save-restriction
            ;; Restrict to LIMIT.
            (narrow-to-region (point-min) limit)
@@ -1269,7 +1284,7 @@
        (dotimes (i arg-count)
          ;; FIXME: `forward-comment' should disregard comment starters
          ;; at line beginnings. (Performace hog!)
-         (while (and (< (point) limit) (forward-comment 1)))
+         (while (and (< (point) limit) (font-latex-forward-comment)))
          (when (and (< (point) limit)
                     (eq (following-char) ?\{))
            (when (= i 0) (setq cbeg (point)))




reply via email to

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