From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: adaptive-fill-mode and auto-fill-mode Date: Mon, 09 Oct 2006 23:04:18 +0200 Message-ID: <452AB952.6010006@gmx.at> References: <4527F569.2030007@gmx.at> <4528D303.3080903@gmx.at> <45294B77.5030202@gmx.at> <452A4213.8080106@gmx.at> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1160427942 24708 80.91.229.2 (9 Oct 2006 21:05:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 9 Oct 2006 21:05:42 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 09 23:05:41 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GX2JB-0001pZ-Ks for ged-emacs-devel@m.gmane.org; Mon, 09 Oct 2006 23:05:10 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GX2JB-0007IP-62 for ged-emacs-devel@m.gmane.org; Mon, 09 Oct 2006 17:05:09 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GX2J0-0007Hx-Ti for emacs-devel@gnu.org; Mon, 09 Oct 2006 17:04:58 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GX2Iz-0007Hl-Cl for emacs-devel@gnu.org; Mon, 09 Oct 2006 17:04:58 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GX2Iz-0007Hi-9R for emacs-devel@gnu.org; Mon, 09 Oct 2006 17:04:57 -0400 Original-Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.52) id 1GX2Qc-0000tM-29 for emacs-devel@gnu.org; Mon, 09 Oct 2006 17:12:50 -0400 Original-Received: (qmail invoked by alias); 09 Oct 2006 21:04:55 -0000 Original-Received: from N711P022.adsl.highway.telekom.at (EHLO [62.47.32.214]) [62.47.32.214] by mail.gmx.net (mp043) with SMTP; 09 Oct 2006 23:04:55 +0200 X-Authenticated: #14592706 User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en Original-To: Stefan Monnier In-Reply-To: X-Y-GMX-Trusted: 0 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:60555 Archived-At: >>>>I fail to understand you here. If the comment at compos doesn't match >>>>the prefix why should I want to insert the prefix on the next line? >>> >>>Why not? > > >>Your own patch might impede you. If you manually change the >>comment-start sequence at compos or the whitespace preceding it, the >>prefix won't match the comment at compos any more and hence won't be >>used. > > > I'm not sure what you're referring to. Of course, if the comment-start is > different, I want to reject the prefix, and if the leading whitespace is of > different length, I also want to reject it. Both of these are pretty clear > signs that the prefix was built from some other unrelated comment. > Of course, one can never be sure, but one has to guess. You said it all here. If the stripped comment-start doesn't match the prefix it will be rejected, as in your patch. >>! (save-excursion >>! (goto-char compos) >>! ;; The comstart marker is the same. >>! (and (looking-at comment-start-skip) >>! (string-equal >>! prefix-comstart >>! (comment-string-strip (match-string 0) nil t)) > > > AFAICT this is the only spot I also added arguments to the `string-match's, please check 'em. > where you changed my suggested code. > What was the scenario where this change is needed? Scenarios where the stripped comment-start sequence is longer than the prefix. Otherwise, with ;; x ;; x ;;; xxxxxx ..... breaking the third comment would give something like ;; x ;; x ;;; xxxxxx ..... ;; xxx and breaking the third comment in ;; x ;;; x ;;; xxxxxx ..... something like ;; x ;;; x ;;; xxxxxx ..... ;;xxxxxx > BTW comment-start-skip can't be used like that in `looking-at' because it > may need to match some chars *before* the actual comment start. This is > typically the case when it starts with > "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)" as in elisp. So you need to > either narrow so as to pretend that compos is at BOL, or match from BOL and > prepend something like ".*". Instead I just did (looking-at (regexp-quote > prefix-comstart)) which I thought should work just as well. The `looking-at' is a preparatory kludge to (a) make sure that we really are at a valid comment-start and (b) produce the match-string for the next conjunct. The real test is obviously the following `string-equal' (where I `comment-string-strip' trailing whitespace - newcomment.el is a pocketful of miracles). I don't care about leading whitespace because compos is beyond that already. Maybe you find a better solution.