From: Peter G. <pe...@ar...> - 2004-09-19 15:13:49
|
On Sun, 19 Sep 2004 at 15:25:37 +0100, Chris Wilson wrote: > Is it possible to automatically wrap long lines in a plain text > buffer (preferably without changing the buffer itself)? In a word, no, assuming you want something like what emacs does by default for long lines. The various wrap commands in j all modify the text in the buffer. > I tried to select the whole document and run wrapRegion (which > doesn't autocomplete for some reason) but that was a disaster. > wrapParagraphs on each para takes forever, and changes the document. > toggleWrap and messageToggleWrap apparently do nothing. What should I > do? (I'm running 0.20.2). If you really need a way to have the lines wrap for display purposes without changing the text in the buffer, I don't have a solution. It would be, I think, a very big deal to change the display code to provide this behavior as an option. There's quite a bit of code that relies on a one-to-one correspondence between display lines and actual lines of text in editable buffers; basic things like cursor movement and selection are sure to break if that assumption no longer holds. In theory one could go on to fix the breakage and eventually come out on the other side, but it would be an architectural change and a big undertaking. On the other hand, if you can live with changing the text in the buffer, but the current wrap commands don't work well for you, that's much more likely to be a solvable problem in the short term. wrapRegion wants to wrap everything into a single paragraph, so that won't work on a whole multi-paragraph document. toggleWrap doesn't affect the text that's already in the buffer (it toggles automatic word wrap for long lines that you might subsequently type), and messageToggleWrap applies only to mail messages, so those commands aren't going to help. I think maybe what you need is a new command that works its way through the document calling wrapParagraph on each paragraph. Would that do the trick? I'm not sure whether "takes forever", above, means that the operation itself is intrinsically slow or that it just takes forever because you have to do it by hand, and I'm also not sure whether wrapParagraph does the right thing for you on all of your paragraphs, taken one at a time. Please let me know. -Peter |