Function: LaTeX-fill-code-comment

LaTeX-fill-code-comment is a byte-compiled function defined in latex.el.

Signature

(LaTeX-fill-code-comment &optional JUSTIFY-FLAG)

Documentation

Fill a line including code followed by a comment.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/latex.el
(defun LaTeX-fill-code-comment (&optional justify-flag)
  "Fill a line including code followed by a comment."
  (let ((beg (line-beginning-position))
        fill-prefix code-comment-start)
    (indent-according-to-mode)
    (when (when (setq code-comment-start (save-excursion
                                           (goto-char beg)
                                           (TeX-search-forward-comment-start
                                            (line-end-position))))
            (goto-char code-comment-start)
            (while (not (looking-at TeX-comment-start-regexp)) (forward-char))
            ;; See if there is at least one non-whitespace character
            ;; before the comment starts.
            (save-excursion
              (re-search-backward "[^ \t\n]" (line-beginning-position) t)))
      (setq fill-prefix
            (concat
             (if indent-tabs-mode
                 (concat (make-string (/ (current-column) tab-width) ?\t)
                         (make-string (% (current-column) tab-width) ?\ ))
               (make-string (current-column) ?\ ))
             (progn
               (looking-at (concat TeX-comment-start-regexp "+[ \t]*"))
               (TeX-match-buffer 0))))
      (fill-region-as-paragraph beg (line-beginning-position 2)
                                justify-flag  nil
                                (save-excursion
                                  (goto-char beg)
                                  (if (looking-at fill-prefix)
                                      nil
                                    (re-search-forward comment-start-skip nil t)
                                    (point)))))))