GNU bug report logs - #15396
permanent-local truncate-lines

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Mon, 16 Sep 2013 17:42:01 UTC

Severity: wishlist

Found in version 24.3

Fixed in version 27.1

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15396 in the body.
You can then email your comments to 15396 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#15396; Package emacs. (Mon, 16 Sep 2013 17:42:02 GMT) Full text and rfc822 format available.

Message #3 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: submit <at> debbugs.gnu.org
Subject: permanent-local truncate-lines
Date: Mon, 16 Sep 2013 13:41:17 -0400
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.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15396; Package emacs. (Mon, 16 Sep 2013 17:57:01 GMT) Full text and rfc822 format available.

Message #6 received at 15396 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Glenn Morris <rgm <at> gnu.org>, 15396 <at> debbugs.gnu.org
Subject: RE: bug#15396: permanent-local truncate-lines
Date: Mon, 16 Sep 2013 10:56:29 -0700 (PDT)
> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15396; Package emacs. (Tue, 17 Sep 2013 01:08:02 GMT) Full text and rfc822 format available.

Message #9 received at 15396 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 15396 <at> debbugs.gnu.org
Subject: Re: bug#15396: permanent-local truncate-lines
Date: Mon, 16 Sep 2013 21:07:22 -0400
> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15396; Package emacs. (Tue, 17 Sep 2013 01:11:02 GMT) Full text and rfc822 format available.

Message #12 received at 15396 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: Glenn Morris <rgm <at> gnu.org>, 15396 <at> debbugs.gnu.org
Subject: Re: bug#15396: permanent-local truncate-lines
Date: Mon, 16 Sep 2013 21:09:59 -0400
> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15396; Package emacs. (Wed, 22 Nov 2017 19:21:02 GMT) Full text and rfc822 format available.

Message #15 received at 15396 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 15396 <at> debbugs.gnu.org
Subject: Re: bug#15396: permanent-local truncate-lines
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;




bug marked as fixed in version 27.1, send any further explanations to 15396 <at> debbugs.gnu.org and Glenn Morris <rgm <at> gnu.org> Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 30 Nov 2017 17:42:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 29 Dec 2017 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 177 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.