From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Herbert Euler" Newsgroups: gmane.emacs.devel Subject: Re: Patch: Syntax and Hard Newlines Date: Wed, 15 Nov 2006 12:24:27 +0800 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: sea.gmane.org 1163564994 11153 80.91.229.2 (15 Nov 2006 04:29:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 15 Nov 2006 04:29:54 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 15 05:29:52 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 1GkCPH-0001YV-Lz for ged-emacs-devel@m.gmane.org; Wed, 15 Nov 2006 05:29:52 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GkCPH-0000ZA-8M for ged-emacs-devel@m.gmane.org; Tue, 14 Nov 2006 23:29:51 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GkCP3-0000UK-EP for emacs-devel@gnu.org; Tue, 14 Nov 2006 23:29:37 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GkCP1-0000T1-Hg for emacs-devel@gnu.org; Tue, 14 Nov 2006 23:29:37 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GkCP1-0000Sw-Dp for emacs-devel@gnu.org; Tue, 14 Nov 2006 23:29:35 -0500 Original-Received: from [65.54.246.98] (helo=bay0-omc1-s26.bay0.hotmail.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GkCMn-0006RQ-Ha; Tue, 14 Nov 2006 23:27:17 -0500 Original-Received: from hotmail.com ([64.4.26.25]) by bay0-omc1-s26.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 14 Nov 2006 20:24:31 -0800 Original-Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Tue, 14 Nov 2006 20:24:31 -0800 Original-Received: from 64.4.26.200 by by112fd.bay112.hotmail.msn.com with HTTP; Wed, 15 Nov 2006 04:24:27 GMT X-Originating-IP: [216.145.54.158] X-Originating-Email: [herberteuler@hotmail.com] X-Sender: herberteuler@hotmail.com In-Reply-To: Original-To: monnier@iro.umontreal.ca X-OriginalArrivalTime: 15 Nov 2006 04:24:31.0341 (UTC) FILETIME=[F25431D0:01C7086D] 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:62315 Archived-At: > > *************** (defun longlines-wrap-line () > > *** 243,248 **** > > --- 245,257 ---- > > (progn (insert-before-markers ?\n) > > (backward-char 1) > > (delete-char -1) > > + (let* ((point (point)) > > + (state (syntax-ppss point))) > > + (if (nth 4 state) > > + ;; We are in a comment context. > > + (add-text-properties point > > + (1+ point) > > + '(syntax-table (14))))) > > (forward-char 1) > > nil) > > (if (longlines-merge-lines-p) > >Why not just unconditionally do > > (put-text-property (point) > (1+ (point)) > 'syntax-table '(0)) > >Or even just: > > (progn (insert-before-markers (propertize "\n" 'syntax-table '(0))) > ...) Yes, that works. Now the thing that should be considered is whether soft newlines should be regarded the same as blank characters. >>From the syntax's point of view, it should not. Moreover, since there exists the syntax text property feature, it seems that doing something in the Lisp level will be more flexible than doing in the C level. I'd ever used some editors for editing formatted text. In such editors, the idea of soft newlines is indeed that soft newlines and blank characters are interchangeable. `longlines' mode also means this: it substitutes soft newlines with spaces when saving files or quiting. From this point of view, the fix should be done in the C level to avoid each code that uses soft newlines takes care of this problem. Or in the Lisp level, perhaps we can make adding a `syntax-table' text property default when inserting soft newlines. Regards, Guanpeng Xu _________________________________________________________________ Don't just search. Find. Check out the new MSN Search! http://search.msn.com/