GNU bug report logs - #46331
provided-mode-derived-p doesn't work on aliases

Previous Next

Package: emacs;

Reported by: Reuben Thomas <rrt <at> sc3d.org>

Date: Fri, 5 Feb 2021 17:14:01 UTC

Severity: normal

Tags: fixed

Fixed in version 28.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 46331 in the body.
You can then email your comments to 46331 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#46331; Package emacs. (Fri, 05 Feb 2021 17:14:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Reuben Thomas <rrt <at> sc3d.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 05 Feb 2021 17:14:01 GMT) Full text and rfc822 format available.

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

From: Reuben Thomas <rrt <at> sc3d.org>
To: bug-emacs <bug-emacs <at> gnu.org>
Subject: provided-mode-derived-p doesn't work on aliases
Date: Fri, 5 Feb 2021 17:13:06 +0000
[Message part 1 (text/plain, inline)]
javascript-mode is an alias for js-mode, and some third-party modes (e.g.
json-mode) derive from it.

(provided-mode-derived-p 'js-mode 'prog-mode) == t

but

(provided-mode-derived-p 'javascript-mode 'prog-mode) == nil

Hence in json-mode, (derived-mode-p 'prog-mode) evaluates to nil, which
seems unfortunate.

-- 
https://rrt.sc3d.org
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46331; Package emacs. (Sat, 06 Feb 2021 11:05:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Reuben Thomas <rrt <at> sc3d.org>
Cc: 46331 <at> debbugs.gnu.org
Subject: Re: bug#46331: provided-mode-derived-p doesn't work on aliases
Date: Sat, 06 Feb 2021 12:04:14 +0100
Reuben Thomas <rrt <at> sc3d.org> writes:

> javascript-mode is an alias for js-mode, and some third-party modes (e.g.
> json-mode) derive from it.
>
> (provided-mode-derived-p 'js-mode 'prog-mode) == t
>
> but
>
> (provided-mode-derived-p 'javascript-mode 'prog-mode) == nil
>
> Hence in json-mode, (derived-mode-p 'prog-mode) evaluates to nil, which seems
> unfortunate.

Yup.  I've now changed the function to also work on MODE parameters that
are function aliases.

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




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 06 Feb 2021 11:05:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 46331 <at> debbugs.gnu.org and Reuben Thomas <rrt <at> sc3d.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 06 Feb 2021 11:05:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46331; Package emacs. (Sat, 06 Feb 2021 11:23:02 GMT) Full text and rfc822 format available.

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

From: Reuben Thomas <rrt <at> sc3d.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 46331 <at> debbugs.gnu.org
Subject: Re: bug#46331: provided-mode-derived-p doesn't work on aliases
Date: Sat, 6 Feb 2021 11:22:31 +0000
[Message part 1 (text/plain, inline)]
On Sat, 6 Feb 2021 at 11:04, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

> Reuben Thomas <rrt <at> sc3d.org> writes:
>
> > javascript-mode is an alias for js-mode, and some third-party modes (e.g.
> > json-mode) derive from it.
> >
> > (provided-mode-derived-p 'js-mode 'prog-mode) == t
> >
> > but
> >
> > (provided-mode-derived-p 'javascript-mode 'prog-mode) == nil
> >
> > Hence in json-mode, (derived-mode-p 'prog-mode) evaluates to nil, which
> seems
> > unfortunate.
>
> Yup.  I've now changed the function to also work on MODE parameters that
> are function aliases.
>

Many thanks!

-- 
https://rrt.sc3d.org
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46331; Package emacs. (Sat, 06 Feb 2021 11:28:02 GMT) Full text and rfc822 format available.

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

From: Reuben Thomas <rrt <at> sc3d.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 46331 <at> debbugs.gnu.org
Subject: Re: bug#46331: provided-mode-derived-p doesn't work on aliases
Date: Sat, 6 Feb 2021 11:27:10 +0000
[Message part 1 (text/plain, inline)]
I just looked at the history of provided-mode-derived-p, and it seems that
a fix had already been made for this problem. See commit 48ff4c0b2f7. (I am
using emacs 26.3, which does not have this fix.)

-- 
https://rrt.sc3d.org
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46331; Package emacs. (Sat, 06 Feb 2021 11:32:02 GMT) Full text and rfc822 format available.

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

From: Reuben Thomas <rrt <at> sc3d.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 46331 <at> debbugs.gnu.org
Subject: Re: bug#46331: provided-mode-derived-p doesn't work on aliases
Date: Sat, 6 Feb 2021 11:31:36 +0000
[Message part 1 (text/plain, inline)]
On Sat, 6 Feb 2021 at 11:27, Reuben Thomas <rrt <at> sc3d.org> wrote:

> I just looked at the history of provided-mode-derived-p, and it seems that
> a fix had already been made for this problem. See commit 48ff4c0b2f7. (I am
> using emacs 26.3, which does not have this fix.)
>

Ah, sorry, the earlier fix is for when one of MODES is an alias, not for
when MODE is an alias!

-- 
https://rrt.sc3d.org
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46331; Package emacs. (Sat, 06 Feb 2021 11:34:01 GMT) Full text and rfc822 format available.

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

From: Reuben Thomas <rrt <at> sc3d.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 46331 <at> debbugs.gnu.org
Subject: Re: bug#46331: provided-mode-derived-p doesn't work on aliases
Date: Sat, 6 Feb 2021 11:32:48 +0000
[Message part 1 (text/plain, inline)]
There is one remaining nit: the docstring of provided-mode-derived-p was
updated by that earlier commit to say "MODES or their aliases"; presumably
a similar change should be made to the docstring of derived-mode-p?
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46331; Package emacs. (Sat, 06 Feb 2021 11:38:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Reuben Thomas <rrt <at> sc3d.org>
Cc: 46331 <at> debbugs.gnu.org
Subject: Re: bug#46331: provided-mode-derived-p doesn't work on aliases
Date: Sat, 06 Feb 2021 12:37:07 +0100
Reuben Thomas <rrt <at> sc3d.org> writes:

> I just looked at the history of provided-mode-derived-p, and it seems that a fix had
> already been made for this problem. See commit 48ff4c0b2f7. (I am using emacs
> 26.3, which does not have this fix.)

No, that fix was for the opposite problem.  :-)  It allows checking
parents that are aliases, but does nothing for checking a child that's an
alias.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46331; Package emacs. (Sat, 06 Feb 2021 11:40:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Reuben Thomas <rrt <at> sc3d.org>
Cc: 46331 <at> debbugs.gnu.org
Subject: Re: bug#46331: provided-mode-derived-p doesn't work on aliases
Date: Sat, 06 Feb 2021 12:39:06 +0100
Reuben Thomas <rrt <at> sc3d.org> writes:

> There is one remaining nit: the docstring of provided-mode-derived-p
> was updated by that earlier commit to say "MODES or their aliases";
> presumably a similar change should be made to the docstring of
> derived-mode-p?

I think adding "MODES or their aliases" was a bit superfluous -- I think
it should be self-evident that that's what's meant here.  I didn't
remove that bit from the doc string, but I think adding it to
derived-mode-p isn't all that helpful.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46331; Package emacs. (Sat, 06 Feb 2021 11:43:02 GMT) Full text and rfc822 format available.

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

From: Reuben Thomas <rrt <at> sc3d.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 46331 <at> debbugs.gnu.org
Subject: Re: bug#46331: provided-mode-derived-p doesn't work on aliases
Date: Sat, 6 Feb 2021 11:41:53 +0000
[Message part 1 (text/plain, inline)]
On Sat, 6 Feb 2021 at 11:39, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

>
> I think adding "MODES or their aliases" was a bit superfluous -- I think
> it should be self-evident that that's what's meant here.  I didn't
> remove that bit from the doc string, but I think adding it to
> derived-mode-p isn't all that helpful.
>

I agree, but I think it should be consistent between the two functions,
otherwise it looks as though they work differently. (If one is reading only
the docstrings, not looking at the code.)

-- 
https://rrt.sc3d.org
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46331; Package emacs. (Sat, 06 Feb 2021 12:56:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Reuben Thomas <rrt <at> sc3d.org>
Cc: 46331 <at> debbugs.gnu.org
Subject: Re: bug#46331: provided-mode-derived-p doesn't work on aliases
Date: Sat, 06 Feb 2021 13:54:57 +0100
Reuben Thomas <rrt <at> sc3d.org> writes:

> On Sat, 6 Feb 2021 at 11:39, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
>
>  I think adding "MODES or their aliases" was a bit superfluous -- I think
>  it should be self-evident that that's what's meant here.  I didn't
>  remove that bit from the doc string, but I think adding it to
>  derived-mode-p isn't all that helpful.
>
> I agree, but I think it should be consistent between the two functions, otherwise it
> looks as though they work differently. (If one is reading only the docstrings, not
> looking at the code.)

That's true.  So I've now removed the "or their aliases" from the doc
string.

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




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

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

Previous Next


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