[Top][All Lists]

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

Re: [AUCTeX-devel] Filling of code comments

From: Ralf Angeli
Subject: Re: [AUCTeX-devel] Filling of code comments
Date: Thu, 28 Jul 2005 15:58:27 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

* David Kastrup (2005-07-28) writes:

> Not really.  I think that M-q should not reflow code comments when
> executed before the % sign, and it should only reflow the comments
> when executed after the % sign (if the % signs occur in the same
> column, the comment block is formatted as one block).

Not too bad an idea.  That would spare us the requirement of a
separate command for filling code comments.

> Of course, this can get pretty much insanely complicated.  I think
> that we should probably just leave code comments completely alone.
> auto-fill-mode will have to do something about them, but M-q might
> just be too hard.

No, it would be rather easy.  I already have this in
`LaTeX-fill-paragraph' of my local latex.el:

         ;; A line with some code, followed by a comment?
         ((and (setq code-comment-start (LaTeX-code-comment-start))
                 (goto-char code-comment-start)
                  ;; Don't treat trailing comment starters as code comments.
                  (not (looking-at
                        (concat TeX-comment-start-regexp "+[ \t]*$")))
                  ;; See if there is at least one non-whitespace character
                  ;; before the comment starts.
                  (re-search-backward "[^ \t\n]" (line-beginning-position) t))))
          (setq has-comment t
                has-code-and-comment t))))

`LaTeX-code-comment-start' returns the start of a code comment.


reply via email to

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