help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Error with fill-paragraph in my own major mode


From: Stefan Monnier
Subject: Re: Error with fill-paragraph in my own major mode
Date: Thu, 31 Jan 2008 10:25:21 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

> Nevertheless I must admit that I don't really grok that code in
> fill.el.  What is that (concat "\0" commark "a") good for?

The code in fill.el is fiendishly subtle (I should know, I wrote it).
This (concat "\0" commark "a") thingy is there to check whether or not
we can build a stricter comment-start-skip that will only match
a specific comment-marker rather than any comment marker.

E.g. we're looking at a line that starts with "//" and we want to find
all the lines that start with "//" and refill them together, but we
don't want to consider lines that start with "///" or "/*".

The `concat' builds a test case to check whether the comment-start-skip
regexp is restricting the comment starter to be in column 0 (as is the
case in Fortran), and whether a space (or similar) char is needed
between the comment-marker and the comment's content (as is the case
with Texinfo's "@c" and Basic's "Rem").

That's what the comment tries to explain:

              ;; A regexp more specialized than comment-start-skip, that only
              ;; matches the current commark rather than any valid commark.
              ;;
              ;; The specialized regexp only works for "normal" comment
              ;; syntax, not for Texinfo's "@c" (which can't be immediately
              ;; followed by word-chars) or Fortran's "C" (which needs to be
              ;; at bol), so check that comment-start-skip indeed allows the
              ;; commark to appear in the middle of the line and followed by
              ;; word chars.  The choice of "\0" and "a" is mostly arbitrary.


-- Stefan


reply via email to

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