From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: fortran-fill-paragraph fails Date: Tue, 02 Jan 2007 18:22:57 -0500 Message-ID: References: <87d56acfod.fsf@lrde.org> <17810.43383.385509.776556@tfkp07.physik.uni-erlangen.de> <87ejqhwnhu.fsf@lrde.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1167782021 26195 80.91.229.12 (2 Jan 2007 23:53:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 2 Jan 2007 23:53:41 +0000 (UTC) Cc: emacs-devel@gnu.org, =?iso-8859-1?Q?Micha=EBl?= Cadilhac , Roland.Winkler@physik.uni-erlangen.de Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 03 00:53:38 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1H1tRk-000299-PY for ged-emacs-devel@m.gmane.org; Wed, 03 Jan 2007 00:53:33 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H1tRk-000402-8p for ged-emacs-devel@m.gmane.org; Tue, 02 Jan 2007 18:53:32 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H1tRX-0003zn-JV for emacs-devel@gnu.org; Tue, 02 Jan 2007 18:53:19 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H1tRW-0003zB-Ea for emacs-devel@gnu.org; Tue, 02 Jan 2007 18:53:18 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H1tRW-0003z8-8q for emacs-devel@gnu.org; Tue, 02 Jan 2007 18:53:18 -0500 Original-Received: from [209.226.175.97] (helo=tomts40-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1H1tRV-00017T-49; Tue, 02 Jan 2007 18:53:17 -0500 Original-Received: from pastel.home ([74.12.206.167]) by tomts40-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20070102235316.GFVN1750.tomts40-srv.bellnexxia.net@pastel.home>; Tue, 2 Jan 2007 18:53:16 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id B8BE07EDD; Tue, 2 Jan 2007 18:22:57 -0500 (EST) Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Sat\, 30 Dec 2006 20\:45\:33 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:64661 Archived-At: > 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 `@c' 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