GNU bug report logs - #15658
24.1; (wishlist) Easy way to make a file-local variable also permanent-local

Previous Next

Package: emacs;

Reported by: yary <not.com <at> gmail.com>

Date: Sat, 19 Oct 2013 22:16:02 UTC

Severity: wishlist

Tags: moreinfo

Found in version 24.1

Fixed in version 26.1

Done: Lars Ingebrigtsen <larsi <at> gnus.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 15658 in the body.
You can then email your comments to 15658 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#15658; Package emacs. (Sat, 19 Oct 2013 22:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to yary <not.com <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 19 Oct 2013 22:16:02 GMT) Full text and rfc822 format available.

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

From: yary <not.com <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.1; (wishlist) Easy way to make a file-local variable also
 permanent-local
Date: Sat, 19 Oct 2013 18:15:04 -0400
There are occasional needs to preserve buffer-local variables across
major-mode changes. In the specific case of directory-local variables,
an automated solution looks to be feasible, see "bug#15577: 24.3;
dir-local variables not applied when switching major-mode"

File-local variables on the other hand are not as easy to categorize as
to their intent- for a particular mode, vs the file contents in general.

I propose adding `permanent' as another special "variable name" (along
the lines of `mode', `eval', `coding', and `unibyte') to let people
mark the file variables they want to remain between mode changes. For
example:

; mode: Lisp
; fill-column: 75
; comment-column: 50
; permanent: fill-column tab-width

would set & keep fill-column at 75 between mode changes, and would
preserve between major-mode switches any changes to tab-width.

(There is one edge case with this proposal: what would `permanent: eval'
do? Re-evaluate all `eval' file variables after a mode change? And
`permanent: mode' would have to be ignored or give a warning.)


In GNU Emacs 24.1.1 (i386-mingw-nt5.1.2600)
 of 2012-06-10 on MARVIN
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (4.6) --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-3.0.9/include'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  value of $XMODIFIERS: nil
  locale-coding-system: cp1252
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15658; Package emacs. (Tue, 10 May 2022 15:15:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: yary <not.com <at> gmail.com>
Cc: 15658 <at> debbugs.gnu.org
Subject: Re: bug#15658: 24.1; (wishlist) Easy way to make a file-local
 variable also permanent-local
Date: Tue, 10 May 2022 17:14:21 +0200
yary <not.com <at> gmail.com> writes:

> There are occasional needs to preserve buffer-local variables across
> major-mode changes. In the specific case of directory-local variables,
> an automated solution looks to be feasible, see "bug#15577: 24.3;
> dir-local variables not applied when switching major-mode"
>
> File-local variables on the other hand are not as easy to categorize as
> to their intent- for a particular mode, vs the file contents in general.
>
> I propose adding `permanent' as another special "variable name" (along
> the lines of `mode', `eval', `coding', and `unibyte') to let people
> mark the file variables they want to remain between mode changes. For
> example:
>
> ; mode: Lisp
> ; fill-column: 75
> ; comment-column: 50
> ; permanent: fill-column tab-width
>
> would set & keep fill-column at 75 between mode changes, and would
> preserve between major-mode switches any changes to tab-width.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

With the following:

;; Local variables:
;; foo-var: t
;; end:

foo-var is set whenever I change the major mode.  Has the behaviour
changed here since Emacs 24.1?  (The earliest Emacs I have is Emacs
25.1.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 10 May 2022 15:15:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15658; Package emacs. (Tue, 10 May 2022 19:55:02 GMT) Full text and rfc822 format available.

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

From: yary <not.com <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 15658 <at> debbugs.gnu.org
Subject: Re: bug#15658: 24.1; (wishlist) Easy way to make a file-local
 variable also permanent-local
Date: Tue, 10 May 2022 15:54:00 -0400
I was working on this about 5 years ago, before 24.1, and the use case
I had for this doesn't apply to my current situation. So it might
already work as I wanted it, and my wants have changed! OK to close
this.

-y

On Tue, May 10, 2022 at 11:14 AM Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
>
> yary <not.com <at> gmail.com> writes:
>
> > There are occasional needs to preserve buffer-local variables across
> > major-mode changes. In the specific case of directory-local variables,
> > an automated solution looks to be feasible, see "bug#15577: 24.3;
> > dir-local variables not applied when switching major-mode"
> >
> > File-local variables on the other hand are not as easy to categorize as
> > to their intent- for a particular mode, vs the file contents in general.
> >
> > I propose adding `permanent' as another special "variable name" (along
> > the lines of `mode', `eval', `coding', and `unibyte') to let people
> > mark the file variables they want to remain between mode changes. For
> > example:
> >
> > ; mode: Lisp
> > ; fill-column: 75
> > ; comment-column: 50
> > ; permanent: fill-column tab-width
> >
> > would set & keep fill-column at 75 between mode changes, and would
> > preserve between major-mode switches any changes to tab-width.
>
> (I'm going through old bug reports that unfortunately weren't resolved
> at the time.)
>
> With the following:
>
> ;; Local variables:
> ;; foo-var: t
> ;; end:
>
> foo-var is set whenever I change the major mode.  Has the behaviour
> changed here since Emacs 24.1?  (The earliest Emacs I have is Emacs
> 25.1.)
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15658; Package emacs. (Wed, 11 May 2022 04:06:02 GMT) Full text and rfc822 format available.

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

From: Phil Sainty <psainty <at> orcon.net.nz>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: yary <not.com <at> gmail.com>, 15658 <at> debbugs.gnu.org
Subject: Re: bug#15658: 24.1; (wishlist) Easy way to make a file-local
 variable also permanent-local
Date: Wed, 11 May 2022 16:05:38 +1200
On 2022-05-11 03:14, Lars Ingebrigtsen wrote:
> foo-var is set whenever I change the major mode.  Has the behaviour
> changed here since Emacs 24.1?  (The earliest Emacs I have is Emacs
> 25.1.)

This changed in `normal-mode' in 26.1 for bug #23460, so I'd expect
testing to have been different in 25.1.

The relevant NEWS entry is:

** File local and directory local variables are now initialized each
time the major mode is set, not just when the file is first visited.
These local variables will thus not vanish on setting a major mode.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15658; Package emacs. (Wed, 11 May 2022 11:49:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: yary <not.com <at> gmail.com>
Cc: 15658 <at> debbugs.gnu.org
Subject: Re: bug#15658: 24.1; (wishlist) Easy way to make a file-local
 variable also permanent-local
Date: Wed, 11 May 2022 13:47:52 +0200
yary <not.com <at> gmail.com> writes:

> I was working on this about 5 years ago, before 24.1, and the use case
> I had for this doesn't apply to my current situation. So it might
> already work as I wanted it, and my wants have changed! OK to close
> this.

Phil Sainty <psainty <at> orcon.net.nz> writes:

> This changed in `normal-mode' in 26.1 for bug #23460, so I'd expect
> testing to have been different in 25.1.
>
> The relevant NEWS entry is:
>
> ** File local and directory local variables are now initialized each
> time the major mode is set, not just when the file is first visited.
> These local variables will thus not vanish on setting a major mode.

Thanks; there doesn't seem to be anything more to do here, then, and I'm
closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 26.1, send any further explanations to 15658 <at> debbugs.gnu.org and yary <not.com <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 11 May 2022 11:49: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. (Thu, 09 Jun 2022 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 12 days ago.

Previous Next


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