From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Chong Yidong" Newsgroups: gmane.emacs.devel Subject: require-hard-newlines to use newline Date: Tue, 1 Mar 2005 22:26:55 -0500 (EST) Message-ID: <2750.220.255.172.231.1109734015.squirrel@www.stupidchicken.com> References: <1483.220.255.172.231.1109730379.squirrel@www.stupidchicken.com> <200503020302.j2232fR21722@raven.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1109737146 8544 80.91.229.2 (2 Mar 2005 04:19:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 2 Mar 2005 04:19:06 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 02 05:19:06 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D6LK6-00042D-Ng for ged-emacs-devel@m.gmane.org; Wed, 02 Mar 2005 05:18:59 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D6Lcn-00029s-Es for ged-emacs-devel@m.gmane.org; Tue, 01 Mar 2005 23:38:17 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D6LaL-0000r9-1x for emacs-devel@gnu.org; Tue, 01 Mar 2005 23:35:45 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D6LaJ-0000qH-DH for emacs-devel@gnu.org; Tue, 01 Mar 2005 23:35:44 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D6LVQ-0007Yy-8b for emacs-devel@gnu.org; Tue, 01 Mar 2005 23:30:40 -0500 Original-Received: from [64.21.80.18] (helo=shark.dnsvelocity.com) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1D6KW0-0005K3-U1 for emacs-devel@gnu.org; Tue, 01 Mar 2005 22:27:13 -0500 Original-Received: from stupidch by shark.dnsvelocity.com with local (Exim 4.44) id 1D6KVj-00084C-UO; Tue, 01 Mar 2005 22:26:55 -0500 Original-Received: from 220.255.172.231 ([220.255.172.231]) (SquirrelMail authenticated user cyd@stupidchicken.com) by www.stupidchicken.com with HTTP; Tue, 1 Mar 2005 22:26:55 -0500 (EST) In-Reply-To: <200503020302.j2232fR21722@raven.dms.auburn.edu> Original-To: "Luc Teirlinck" User-Agent: SquirrelMail/1.4.4 X-Priority: 3 (Normal) Importance: Normal X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - shark.dnsvelocity.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [32675 33085] / [47 12] X-AntiAbuse: Sender Address Domain - stupidchicken.com X-Source: /usr/local/cpanel/3rdparty/bin/php X-Source-Args: /usr/local/cpanel/3rdparty/bin/php /usr/local/cpanel/base/3rdparty/squirrelmail/src/compose.php X-Source-Dir: :/base/3rdparty/squirrelmail/src 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 X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: main.gmane.org gmane.emacs.devel:34037 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:34037 (Sorry for leaving out a subject field) > Could this patch be checked in? When require-final-newlines is t, the > newline is inserted by (insert "\n"), which does not take > use-hard-newlines into account, so the newline is not marked as 'hard. > > Are you really _sure_ that a newline inserted by saving a buffer > should be hard if use-hard-newlines is enabled? I would guess that > people might occasionally save their work to file while in the middle > of a long paragraph, in which case the inserted newline should be > soft. I guess that if people want to mark the end of a paragraph > before saving, they would explicitly type RET. > > What situation are you thinking of that would motivate making C-x C-s > insert a hard newline? As I see it, the rationale for turning on require-final-newline is that a particular type of file should always end in a newline. The user should type RET himself, but in case he forgets to do so, Emacs does it for him. So (newline) should be used. Nothing will go wrong when you save in the middle of a paragraph, since the code inserts the newline inside a save-excursion. The hard newline always goes *after* point, at the end of the buffer, where it won't get in the way. The specific problem I am trying to solve is with Longlines mode (which is not part of Emacs.) It is, in principle, impossible for Longlines to distinguish between the soft newline inserted by require-final-newline and the soft newline inserted by filling when performing automatic line wrapping. It therefore turns that newline into a space, with the effect that buffer-modified-p is always t if you try to save a Longlines buffer with require-final-newline.