From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.help Subject: RE: "longlines mode" doesn't work well after restore by "desktop" Date: Fri, 3 Aug 2007 12:54:25 +0800 Message-ID: <63F95800EDD046419F17688AAFD41CCF01C0620A@rnd-ex01.rnd.gdnt.local> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1186117842 20739 80.91.229.12 (3 Aug 2007 05:10:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 3 Aug 2007 05:10:42 +0000 (UTC) To: Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 03 07:10:40 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IGpQr-00086W-8p for geh-help-gnu-emacs@m.gmane.org; Fri, 03 Aug 2007 07:10:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IGpQq-0005Ag-Q2 for geh-help-gnu-emacs@m.gmane.org; Fri, 03 Aug 2007 01:10:36 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IGpQ0-00051m-FX for help-gnu-emacs@gnu.org; Fri, 03 Aug 2007 01:09:44 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IGpPx-00051Z-CK for help-gnu-emacs@gnu.org; Fri, 03 Aug 2007 01:09:43 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IGpPx-00051W-1w for help-gnu-emacs@gnu.org; Fri, 03 Aug 2007 01:09:41 -0400 Original-Received: from [202.104.30.38] (helo=email.gdnt.com.cn) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IGpPw-0001Qq-CD for help-gnu-emacs@gnu.org; Fri, 03 Aug 2007 01:09:40 -0400 Original-Received: from sd-ef-01.cnshn.gdnt.local ([202.38.41.132]) by email.gdnt.com.cn with Microsoft SMTPSVC(6.0.3790.1830); Fri, 3 Aug 2007 12:58:26 +0800 Original-Received: from sd-ex-01.cnshn.gdnt.local ([202.38.38.8]) by sd-ef-01.cnshn.gdnt.local with Microsoft SMTPSVC(6.0.3790.1830); Thu, 2 Aug 2007 23:58:14 -0500 Original-Received: from rnd-ex01.rnd.gdnt.local ([202.38.32.250]) by sd-ex-01.cnshn.gdnt.local with Microsoft SMTPSVC(6.0.3790.1830); Fri, 3 Aug 2007 12:58:13 +0800 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: "longlines mode" doesn't work well after restore by "desktop" Thread-Index: AcfEJf9gDyZcIsZhQMGxzSEufsZUXAAPFDqgBEngKwA= X-OriginalArrivalTime: 03 Aug 2007 04:58:13.0726 (UTC) FILETIME=[E59467E0:01C7D58A] X-TM-AS-Product-Ver: SMEX-7.0.0.1345-3.6.1039-15232.002 X-TM-AS-Result: No--8.468100-8.000000-31 X-Detected-Kernel: Windows 2000 SP4, XP SP1+ X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:46280 Archived-At: The problem has been solved finally. That is because I put (desktop-read) in my .emacs and it caused (desktop-read) running twice.=20 And I sent a bug report to bug-gnu-emacs@gnu.org regarding this problem too. See below:=20 ---------------------------------------------------- A potential bug of longlines-mode. If for some reason executing (longlines-mode 1) twice for the same buffer, the longlines will be cut with "hard newline" instead of the "soft newline". Then when the buffer is saved, the long line will be saved as multiple lines. And when the longlines-mode is disabled, the longline cannot go back to a single lines. This may break the format of the user's file unexpectedly (since no modified flag wil be set when adding the newline.). I met this issue recently because I put "(desktop-read)" in my .emacs file (I followed some out-of-date tips) wrongly. then the (desktop-read) is executing twice (one is during load eva the .emacs file, the other time is when after-init-hook is running.). So the (longlines-mode 1) is executing twice too. I have a brief look at the longlines.el, and find the mechanism of the mode is: When enabling the mode, it replaces all the newline with "hard newline" and the fill the paragraph using "soft newline". When disabling the mode, it removes all the "soft newline" so that the buffer go back to its original content. But if we executing (longlines-mode 1) when the longlines mode already turned on, then all the "soft newline" added by longlines mode previously will be replaced by "hard newline" and the when we disable the mode or save the file, we cannot go back to the original text since we cannot distinguish which newline is added by longlines and which newline the file already has before. All we need to do to fix this problem is that when enabling the longlines mode, check whether the longlnes mode have already enabled. If yes, then don't replace the "soft newline" with "hard newline" (or don't do the turn on action again).=20 -----Original Message----- From: Brian Jiang=20 Sent: 2007=C4=EA7=D4=C212=C8=D5 17:06 To: help-gnu-emacs@gnu.org Subject: "longlines mode" doesn't work well after restore by "desktop" longlines-mode work well after I turn it on a buffer. When I close Emacs = and then start Emacs again, and the buffer is stored by the "desktop" el = with "longlines" minor mode activated. But the longlines doesn't work = correctly after that. And if I save the file at this time, the long line = will be saved as multiple lines just like the long line is auto-filled. Likely the "longlines" and "desktop" doesn't work well with each other. Any idea about this? Thanks. Regards, Brian