Function: TeX-forward-comment-skip

TeX-forward-comment-skip is a byte-compiled function defined in tex.el.

Signature

(TeX-forward-comment-skip &optional COUNT LIMIT)

Documentation

Move forward to the next comment skip.

This may be a switch between commented and not commented adjacent lines or between lines with different comment prefixes. With argument COUNT do it COUNT times. If argument LIMIT is given, do not move point further than this value.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex.el
(defun TeX-forward-comment-skip (&optional count limit)
  "Move forward to the next comment skip.
This may be a switch between commented and not commented adjacent
lines or between lines with different comment prefixes.  With
argument COUNT do it COUNT times.  If argument LIMIT is given, do
not move point further than this value."
  (unless count (setq count 1))
  ;; A value of 0 is nonsense.
  (when (= count 0) (setq count 1))
  (unless limit (setq limit (point-max)))
  (dotimes (_ (abs count))
    (if (< count 0)
        (forward-line -1)
      (beginning-of-line))
    (let ((prefix (when (looking-at (concat "\\([ \t]*"
                                            TeX-comment-start-regexp "+\\)+"))
                    (buffer-substring (+ (line-beginning-position)
                                         (current-indentation))
                                      (match-end 0)))))
      (while (save-excursion
               (and (if (> count 0)
                        (<= (point) limit)
                      (>= (point) limit))
                    (zerop (if (> count 0)
                               (forward-line 1)
                             (forward-line -1)))
                    (if prefix
                        (if (looking-at (concat "\\([ \t]*"
                                                TeX-comment-start-regexp
                                                "+\\)+"))
                            ;; If the preceding line is a commented line
                            ;; as well, check if the prefixes are
                            ;; identical.
                            (string= prefix
                                     (buffer-substring
                                      (+ (line-beginning-position)
                                         (current-indentation))
                                      (match-end 0)))
                          nil)
                      (not (looking-at (concat "[ \t]*"
                                               TeX-comment-start-regexp))))))
        (if (> count 0)
            (forward-line 1)
          (forward-line -1)))
      (if (> count 0)
          (forward-line 1)))))