The boolean variable truncate-lines
controls whether continuation lines are displayed or not. I use this when I am checking some log file where the very long lines are truncated thanks to a previous (setq truncate-lines t)
. This is convenient since the relevant contents is usually at the beginning of the lines. However I sometimes need to see the end of the inspected lines and I'll occasionally toggle truncate-lines
on and off (this is done in code temporarily bound to a function key).
The problem is that toggling truncate-lines
on and off does not update the display unless I do some editing, or move the cursor far enough, or .. I don't know what. I tried to insert a (redisplay t)
in my toggling code but this is not enough.
What bit of elisp magic will cause the display to be updated according to the new value of truncate-lines
once it is changed? And, by the way, is the lack of immediate update a bona fide bug?
How to reproduce the problem: After some investigation, it seems that the problem appears because I invoke the toggle via some key binding and not by execute-extended-command
aka M-x
. Here is a test file for you to download. Start with emacs -Q test_file
, then eval-defun
the first expression. Now M-x ttl
does the toggle ok but on my machine hitting CTRL l
(now bound to ttl
) does the toggle without redisplay. If I move to end of buffer, the redisplay is activated.
FWIW I use emacs 24.5.1
Added Jan. 5th: it turns out that the behaviour described above is due to a minor bug that will be fixed in Emacs 25, see here. In principle there is nothing wrong with changing truncate-lines
directly without going through toggle-truncate-lines
.