emacs-devel
[Top][All Lists]
Advanced

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

Re: fortran-fill-paragraph fails


From: Stefan Monnier
Subject: Re: fortran-fill-paragraph fails
Date: Tue, 02 Jan 2007 18:22:57 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux)

>     Suppose commark is `C', we will have :
>     (string-match "^C" (concat "\0" commark "a")) -> nil
>     (string-match "C" (concat "\0" commark "a")) -> 1
>     (string-match "^ ?C" (concat "\0" commark "a")) -> nil

> Why are these results correct?  What is the overall explanation for
> the job this code is trying to do?

> I find I can't understand these comments

>             ;; `commark' is surrounded with arbitrary text (`\0' and `a')
>             ;;  to make sure it can be used as an optimization of
>             ;; `comment-start-skip' in the middle of a line.  For example,
>             ;; `commark' can't be used with the "@c" in TeXinfo (hence
>             ;; the `a') or with the "C" at BOL in Fortran (hence the `\0').

> As far as I know, COMMARK (which is how it should be written) refers
> to some text copied out of the buffer.  What does it mean to say
> whether that that text "can't be used with the address@hidden' in Texinfo"?

> Is there anyone that actually understands that comment
> and could rewrite it more clearly?

It seems a bit hard to understand indeed.  What the code around there is
trying to do is to try and come up with a more precise regexp than
comment-start-skip, which should not match any comment-start but only the
exact comment starter used in these comment lines.

So if the comment starter used is ";;;" the regexp can just be something
like ";;;[^;]".  But that's only for "typical" comment markers.
For Texinfo's "@c" we can't just use "@c[^c]" because "@ca" is not a comment
starter.  And For Fortran we can't just use "C[^C]" because the "C" is only
a comment starter when it's at the beginning of a line.

We heuristically try to discover whether it's a "typical" comment starter by
matching (concat "\0" comstart "a") against comment-start-skip, which should
correctly distinguish those two special cases.


        Stefan




reply via email to

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