help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: "longlines mode" doesn't work well after restore by "desktop"


From: brianjiang
Subject: RE: "longlines mode" doesn't work well after restore by "desktop"
Date: Fri, 3 Aug 2007 12:54:25 +0800

The problem has been solved finally. That is because I put
(desktop-read) in my .emacs and it caused (desktop-read) running
twice. 
And I sent a bug report to bug-gnu-emacs@gnu.org regarding this
problem too. See below: 

----------------------------------------------------
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). 




-----Original Message-----
From: Brian Jiang 
Sent: 2007年7月12日 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]