Scott Randby <sran...@gmail.com> wrote: > On 06/01/2011 10:49 PM, Nick Dokos wrote: > > Scott Randby <sran...@gmail.com> wrote: > > > >> This is a problem that has been bugging me for some time because I use > >> visual-line-mode a lot when I'm working on my org-mode files. > >> > >> Say I have visual-line-mode turned on when I'm editing an org-mode file. > >> If I do C-c C-l, put in the link address, hit <Enter>, put in a > >> description, and hit <Enter>, then the long lines in the document are no > >> longer wrapped even though "(Org Wrap)" still appears on the mode line. > >> The only way I've been able to get wrapping back is to do M-x > >> visual-line-mode twice (which is just leaving the mode and then bringing > >> it back. This is very inconvenient, especially when I want to enter > >> several links. Is this a bug or is there an easy way to remind Emacs > >> that it is in visual-line-mode and that it should wrap long lines? > >> > >> I have org-mode 7.5 on Emacs 23.2.1 > >> > > > > Cannot reproduce this either on emacs 23.1.1 or emacs 24.0.50 - the only > > versions I have available here. org-mode is from earlier today. > > > > The word-wrap documentation suggests some interaction with > > truncate-lines and truncate-partial-width-windows, so that might be a > > path of investigation. But when I try setting truncate-lines to t > > (which does truncate long lines even though "Wrap" is still on the mode > > line) and then do (visual-line-mode 1), the variable is set back to nil > > again. In any case, inserting links does not cause any other changes, no > > matter what I set the variable to. > > In my .emacs, I have pop-up-windows set to nil. If I change that setting > to t, then visual-line-mode keeps working when C-c C-l is used to insert > a link. Changing pop-up-windows back to nil causes the bad behavior. > > One reason I want pop-up-windows to be set to nil is because I > frequently use C-x C-b to look at the buffer list. If pop-up-windows is > set to t, then C-x C-b opens the buffer list in a pop-up window while > the active cursor is in the other window. This is ridiculous. > > I found this message about org-mode and pop-up windows in the mailing > list archives: > > http://lists.gnu.org/archive/html/emacs-orgmode/2009-04/msg00712.html > > While the issue described is not the same as mine, the complaint about > org-mode not playing nice when pop-up-windows is set to nil is still valid. >
Yes, with pop-up-windows set to nil, I can reproduce it too. The problem is that truncate-lines is set to t inside org-insert-link. When I comment that out, I get the behavior you expect. The question is: why is truncate-lines set to t? I don't know the answer to that, but it seems to be unnecessary: I think it could be let-bound instead or explicitly reset to its former value afterwards. The problems described by Samuel in the link you provided may be caused by the same setting, but I haven't looked in detail. Nick