Re: fortran-fill-paragraph fails

From:

Michaël Cadilhac

Subject:

Re: fortran-fill-paragraph fails

Date:

Sat, 30 Dec 2006 13:56:45 +0100

User-agent:

Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.90 (gnu/linux)

Richard Stallman <address@hidden> writes:
> There's nothing specific to elisp there, and the \0 is just some
> arbitrary char: a space would have probably worked just as well.
>
> What purpose does that character serve? Is the aim to prevent the
> regexp from ever matching, in practice?
No! The aim of \0 is to prevent the match when the regexp is "^C",
for example, but also "^x?C" (no mode does that AFAIK, but it's just
a security) where x is any non regexp-special char except \0.
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
If ` ' was used instead of "\0", the last one would have returned 0.
Of course, it doesn't prevent a regexp like "^.C", but we can suppose,
IMO, that no mode will do that. And IMO, it would be overkill to do
something to prevent that. "\0" is just a more secure char in this
precise context, at no cost :-) (except this thread ;-))
--
| Michaël `Micha' Cadilhac | In a World without Walls and Fences, |
| Epita/LRDE Promo 2007 | who needs Windows and Gates? |
| http://michael.cadilhac.name | -- Dino Esposito |
`--JID: address@hidden' - --'