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: Patch: Syntax and Hard Newlines Date: Mon, 13 Nov 2006 13:24:59 +0800 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: sea.gmane.org 1163395582 9121 80.91.229.2 (13 Nov 2006 05:26:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 13 Nov 2006 05:26:22 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 13 06:26:13 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 1GjUJr-0003V0-DR for ged-emacs-devel@m.gmane.org; Mon, 13 Nov 2006 06:25:20 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GjUJq-0006nJ-6Y for ged-emacs-devel@m.gmane.org; Mon, 13 Nov 2006 00:25:18 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GjUJc-0006mo-NL for emacs-devel@gnu.org; Mon, 13 Nov 2006 00:25:04 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GjUJZ-0006lr-LD for emacs-devel@gnu.org; Mon, 13 Nov 2006 00:25:04 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GjUJZ-0006li-BQ for emacs-devel@gnu.org; Mon, 13 Nov 2006 00:25:01 -0500 Original-Received: from [65.54.246.204] (helo=bay0-omc3-s4.bay0.hotmail.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GjUJZ-0006eJ-73 for emacs-devel@gnu.org; Mon, 13 Nov 2006 00:25:01 -0500 Original-Received: from hotmail.com ([64.4.26.12]) by bay0-omc3-s4.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.1830); Sun, 12 Nov 2006 21:25:00 -0800 Original-Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Sun, 12 Nov 2006 21:25:00 -0800 Original-Received: from 64.4.26.200 by by112fd.bay112.hotmail.msn.com with HTTP; Mon, 13 Nov 2006 05:24:59 GMT X-Originating-IP: [216.145.54.158] X-Originating-Email: [herberteuler@hotmail.com] X-Sender: herberteuler@hotmail.com Original-To: emacs-devel@gnu.org X-OriginalArrivalTime: 13 Nov 2006 05:25:00.0346 (UTC) FILETIME=[108EE9A0:01C706E4] 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:62168 Archived-At: Emacs provides a hard newline mode. If you type M-x use-hard-newlines RET, you turn on the hard newline mode. In this mode, all newlines in a buffer are re-scanned and marked as either a ``hard'' one or a ``soft'' one. The behavior of commands inserting a newline character is also altered: `newline' and `open-line' will add the text property `hard' (value set to t) to newlines that they insert. As documented in the doc string of the command `use-hard-newlines', newlines not marked hard are internal to paragraphs. However, currently the syntax feature does not work well with this. For example, if you turn on long-lines mode with M-x longlines-mode RET in the *scratch* buffer, you will see the word `evaluation' in the first line is wrapped into the second line, but not recognized as a part of the comment. To fix this, we can let the function `forw_comment' in syntax.c skip the soft newlines when possible. Below is the patch. Regards, Guanpeng Xu Index: syntax.c =================================================================== RCS file: /sources/emacs/emacs/src/syntax.c,v retrieving revision 1.166.4.20 diff -r1.166.4.20 syntax.c 2126a2127 > register int skip_soft_newlines; 2129a2131,2137 > /* If `use-hard-newlines' is t, only newlines with the `hard' > property set to t are real newlines. Other newlines are soft and > should be skipped. */ > skip_soft_newlines = !NILP (Fsymbol_value > (intern > ("use-hard-newlines"))); > 2145a2154,2163 > if (skip_soft_newlines > && c == '\n' > && NILP (Fget_text_property (make_number (from_byte), > intern ("hard"), > Qnil))) > { > INC_BOTH (from, from_byte); > UPDATE_SYNTAX_TABLE_FORWARD (from); > continue; > } _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/