all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* "longlines mode" doesn't work well after restore by "desktop"
  2007-07-12  0:56 opening files result in read-only buffers weber
@ 2007-07-12  9:05 ` brianjiang
  0 siblings, 0 replies; 2+ messages in thread
From: brianjiang @ 2007-07-12  9:05 UTC (permalink / raw)
  To: help-gnu-emacs


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: "longlines mode" doesn't work well after restore by "desktop"
@ 2007-08-03  4:54 brianjiang
  0 siblings, 0 replies; 2+ messages in thread
From: brianjiang @ 2007-08-03  4:54 UTC (permalink / raw)
  To: help-gnu-emacs

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-08-03  4:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-03  4:54 "longlines mode" doesn't work well after restore by "desktop" brianjiang
  -- strict thread matches above, loose matches on Subject: below --
2007-07-12  0:56 opening files result in read-only buffers weber
2007-07-12  9:05 ` "longlines mode" doesn't work well after restore by "desktop" brianjiang

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.