all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#15396: permanent-local truncate-lines
@ 2013-09-16 17:41 Glenn Morris
  2013-09-16 17:56 ` Drew Adams
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Glenn Morris @ 2013-09-16 17:41 UTC (permalink / raw)
  To: 15396

Package: emacs
Version: 24.3
Severity: wishlist

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

(Simply marking it permanent-local doesn't seem to be enough.)





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

* bug#15396: permanent-local truncate-lines
  2013-09-16 17:41 bug#15396: permanent-local truncate-lines Glenn Morris
@ 2013-09-16 17:56 ` Drew Adams
  2013-09-17  1:09   ` Stefan Monnier
  2013-09-17  1:07 ` Stefan Monnier
  2017-11-22 19:20 ` Glenn Morris
  2 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2013-09-16 17:56 UTC (permalink / raw)
  To: Glenn Morris, 15396

> I wish truncate-lines was permanent local. Motivation:
> M-x toggle-truncate-lines ; now lines are truncated
> M-x revert-buffer   ; now lines are untruncated again

FWIW, the manual says that "Permanent locals are appropriate for data
pertaining to where the file came from or how to save it, rather than
with how to edit the contents."

Display seems to be related more to how to edit than to where the file
came from or how to save it.

Not that that guideline is a biblical injunction, to be followed blindly,
but its characterization does not seem to apply here.  Dunno whether
it is appropriate to consider the guideline here.





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

* bug#15396: permanent-local truncate-lines
  2013-09-16 17:41 bug#15396: permanent-local truncate-lines Glenn Morris
  2013-09-16 17:56 ` Drew Adams
@ 2013-09-17  1:07 ` Stefan Monnier
  2017-11-22 19:20 ` Glenn Morris
  2 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2013-09-17  1:07 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 15396

> 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

I don't mind so much that truncate-lines gets reset when I change major
mode because I very rarely change major-mode, but recently I started
feeling like M-x revert-buffer should usually not change major-mode.
After all, I can call M-x normal-mode if I really need that extra step.


        Stefan





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

* bug#15396: permanent-local truncate-lines
  2013-09-16 17:56 ` Drew Adams
@ 2013-09-17  1:09   ` Stefan Monnier
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2013-09-17  1:09 UTC (permalink / raw)
  To: Drew Adams; +Cc: 15396

> FWIW, the manual says that "Permanent locals are appropriate for data
> pertaining to where the file came from or how to save it, rather than
> with how to edit the contents."

I think this makes a lot of sense for permanent-local settings made by
major-mode code.  But if the user calls M-x toggle-truncate-lines,
presumably it's because he finds the text to be more readable this way,
which will presumably still be the case after he changes major-mode.

IOW, maybe it's toggle-truncate-lines which should try and arrange for
the settings to survive a change of major-mode.


        Stefan





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

* bug#15396: permanent-local truncate-lines
  2013-09-16 17:41 bug#15396: permanent-local truncate-lines Glenn Morris
  2013-09-16 17:56 ` Drew Adams
  2013-09-17  1:07 ` Stefan Monnier
@ 2017-11-22 19:20 ` Glenn Morris
  2 siblings, 0 replies; 5+ messages in thread
From: Glenn Morris @ 2017-11-22 19:20 UTC (permalink / raw)
  To: 15396

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;





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

end of thread, other threads:[~2017-11-22 19:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-16 17:41 bug#15396: permanent-local truncate-lines Glenn Morris
2013-09-16 17:56 ` Drew Adams
2013-09-17  1:09   ` Stefan Monnier
2013-09-17  1:07 ` Stefan Monnier
2017-11-22 19:20 ` Glenn Morris

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.