GNU bug report logs - #60787
setq-mode-local doesn't work for buffers not visiting files

Previous Next

Package: emacs;

Reported by: Sean Whitton <spwhitton <at> spwhitton.name>

Date: Fri, 13 Jan 2023 17:33:02 UTC

Severity: normal

To reply to this bug, email your comments to 60787 AT debbugs.gnu.org.

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#60787; Package emacs. (Fri, 13 Jan 2023 17:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sean Whitton <spwhitton <at> spwhitton.name>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 13 Jan 2023 17:33:02 GMT) Full text and rfc822 format available.

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

From: Sean Whitton <spwhitton <at> spwhitton.name>
To: bug-gnu-emacs <at> gnu.org
Subject: setq-mode-local doesn't work for buffers not visiting files
Date: Fri, 13 Jan 2023 10:32:34 -0700
Hello,

  (setq-mode-local diff-mode view-read-only nil)

doesn't affect *vc-diff* buffers, but it should, according to the docstring of
setq-mode-local.

-- 
Sean Whitton




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60787; Package emacs. (Tue, 17 Jan 2023 07:37:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Sean Whitton <spwhitton <at> spwhitton.name>
Cc: 60787 <at> debbugs.gnu.org
Subject: Re: bug#60787: setq-mode-local doesn't work for buffers not
 visiting files
Date: Tue, 17 Jan 2023 09:31:51 +0200
>   (setq-mode-local diff-mode view-read-only nil)
>
> doesn't affect *vc-diff* buffers, but it should, according to the docstring of
> setq-mode-local.

Is this because of the condition `(buffer-file-name b)`
in mode-local-map-file-buffers?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60787; Package emacs. (Wed, 18 Jan 2023 22:43:02 GMT) Full text and rfc822 format available.

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

From: Sean Whitton <spwhitton <at> spwhitton.name>
To: Juri Linkov <juri <at> linkov.net>
Cc: 60787 <at> debbugs.gnu.org
Subject: Re: bug#60787: setq-mode-local doesn't work for buffers not
 visiting files
Date: Wed, 18 Jan 2023 15:42:42 -0700
Hello,

On Tue 17 Jan 2023 at 09:31AM +02, Juri Linkov wrote:

>>   (setq-mode-local diff-mode view-read-only nil)
>>
>> doesn't affect *vc-diff* buffers, but it should, according to the docstring of
>> setq-mode-local.
>
> Is this because of the condition `(buffer-file-name b)`
> in mode-local-map-file-buffers?

Yes, but also how setq-mode-local relies on find-file-hook.

-- 
Sean Whitton




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60787; Package emacs. (Thu, 19 Jan 2023 06:32:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Sean Whitton <spwhitton <at> spwhitton.name>
Cc: 60787 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60787: setq-mode-local doesn't work for buffers not visiting
 files
Date: Thu, 19 Jan 2023 08:31:57 +0200
> Cc: 60787 <at> debbugs.gnu.org
> From: Sean Whitton <spwhitton <at> spwhitton.name>
> Date: Wed, 18 Jan 2023 15:42:42 -0700
> 
> On Tue 17 Jan 2023 at 09:31AM +02, Juri Linkov wrote:
> 
> >>   (setq-mode-local diff-mode view-read-only nil)
> >>
> >> doesn't affect *vc-diff* buffers, but it should, according to the docstring of
> >> setq-mode-local.
> >
> > Is this because of the condition `(buffer-file-name b)`
> > in mode-local-map-file-buffers?
> 
> Yes, but also how setq-mode-local relies on find-file-hook.

All of mode-local.el is written under the assumption that only
file-visiting buffers are supported.  Evidently, it assumes that modes
for buffers that don't visit files are "not interesting" enough.  This
assumption is explicitly in the doc strings of some of its functions.

I don't know why this was the assumption (maybe because CEDET was
about support of editing program source files?), but if we want to
lift the restriction, it would require changing many of the functions
in the package, not just this one.  Maybe we should do that.
mode-local.el wasn't significantly changed since it was added to Emacs
as part of CEDET merge, so maybe it's time to extend it?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60787; Package emacs. (Thu, 19 Jan 2023 21:07:02 GMT) Full text and rfc822 format available.

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

From: Sean Whitton <spwhitton <at> spwhitton.name>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 60787 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#60787: setq-mode-local doesn't work for buffers not
 visiting files
Date: Thu, 19 Jan 2023 14:06:30 -0700
Hello,

On Thu 19 Jan 2023 at 08:31AM +02, Eli Zaretskii wrote:

>> Cc: 60787 <at> debbugs.gnu.org
>> From: Sean Whitton <spwhitton <at> spwhitton.name>
>> Date: Wed, 18 Jan 2023 15:42:42 -0700
>>
>> On Tue 17 Jan 2023 at 09:31AM +02, Juri Linkov wrote:
>>
>> >>   (setq-mode-local diff-mode view-read-only nil)
>> >>
>> >> doesn't affect *vc-diff* buffers, but it should, according to the docstring of
>> >> setq-mode-local.
>> >
>> > Is this because of the condition `(buffer-file-name b)`
>> > in mode-local-map-file-buffers?
>>
>> Yes, but also how setq-mode-local relies on find-file-hook.
>
> All of mode-local.el is written under the assumption that only
> file-visiting buffers are supported.  Evidently, it assumes that modes
> for buffers that don't visit files are "not interesting" enough.  This
> assumption is explicitly in the doc strings of some of its functions.
>
> I don't know why this was the assumption (maybe because CEDET was
> about support of editing program source files?), but if we want to
> lift the restriction, it would require changing many of the functions
> in the package, not just this one.  Maybe we should do that.
> mode-local.el wasn't significantly changed since it was added to Emacs
> as part of CEDET merge, so maybe it's time to extend it?

Sounds good to me.

-- 
Sean Whitton




This bug report was last modified 1 year and 69 days ago.

Previous Next


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