Subject: Re: bug#15396: permanent-local truncate-lines

From: Glenn Morris <[email-masked]>
Date: Wed, 22 Nov 2017 14:20:47 -0500

Glenn Morris wrote:

> I wish truncate-lines was permanent local. Motivation:
>
> emacs -Q foo.txt
>    where foo.txt has lines longer than the frame width.
> M-x toggle-truncate-lines
>    now lines are truncated
> M-x revert-buffer   ; or even just change mode
>    now lines are untruncated again, grr

Here's a patch to enable this.

--- i/src/buffer.c
+++ w/src/buffer.c
@@ -5128,7 +5128,9 @@ struct mmap_region
   XSETFASTINT (BVAR (&buffer_local_flags, selective_display), idx); ++idx;
   XSETFASTINT (BVAR (&buffer_local_flags, selective_display_ellipses), idx); ++idx;
   XSETFASTINT (BVAR (&buffer_local_flags, tab_width), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, truncate_lines), idx); ++idx;
+  XSETFASTINT (BVAR (&buffer_local_flags, truncate_lines), idx);
+  /* Make this one a permanent local.  */
+  buffer_permanent_local_flags[idx++] = 1;
   XSETFASTINT (BVAR (&buffer_local_flags, word_wrap), idx); ++idx;
   XSETFASTINT (BVAR (&buffer_local_flags, ctl_arrow), idx); ++idx;
   XSETFASTINT (BVAR (&buffer_local_flags, fill_column), idx); ++idx;