* bug#46331: provided-mode-derived-p doesn't work on aliases
@ 2021-02-05 17:13 Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-02-06 11:04 ` Lars Ingebrigtsen
0 siblings, 1 reply; 10+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-02-05 17:13 UTC (permalink / raw)
To: 46331
[-- Attachment #1: Type: text/plain, Size: 338 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 1492 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#46331: provided-mode-derived-p doesn't work on aliases
2021-02-05 17:13 bug#46331: provided-mode-derived-p doesn't work on aliases Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-02-06 11:04 ` Lars Ingebrigtsen
2021-02-06 11:22 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-06 11:04 UTC (permalink / raw)
To: Reuben Thomas; +Cc: 46331
Reuben Thomas <rrt@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
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#46331: provided-mode-derived-p doesn't work on aliases
2021-02-06 11:04 ` Lars Ingebrigtsen
@ 2021-02-06 11:22 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-02-06 11:27 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 10+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-02-06 11:22 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 46331
[-- Attachment #1: Type: text/plain, Size: 610 bytes --]
On Sat, 6 Feb 2021 at 11:04, Lars Ingebrigtsen <larsi@gnus.org> wrote:
> Reuben Thomas <rrt@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
[-- Attachment #2: Type: text/html, Size: 1337 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#46331: provided-mode-derived-p doesn't work on aliases
2021-02-06 11:22 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-02-06 11:27 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-02-06 11:31 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-02-06 11:37 ` Lars Ingebrigtsen
0 siblings, 2 replies; 10+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-02-06 11:27 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 46331
[-- Attachment #1: Type: text/plain, Size: 226 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 502 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#46331: provided-mode-derived-p doesn't work on aliases
2021-02-06 11:27 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-02-06 11:31 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-02-06 11:32 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-02-06 11:37 ` Lars Ingebrigtsen
1 sibling, 1 reply; 10+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-02-06 11:31 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 46331
[-- Attachment #1: Type: text/plain, Size: 397 bytes --]
On Sat, 6 Feb 2021 at 11:27, Reuben Thomas <rrt@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
[-- Attachment #2: Type: text/html, Size: 1020 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#46331: provided-mode-derived-p doesn't work on aliases
2021-02-06 11:31 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-02-06 11:32 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-02-06 11:39 ` Lars Ingebrigtsen
0 siblings, 1 reply; 10+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-02-06 11:32 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 46331
[-- Attachment #1: Type: text/plain, Size: 216 bytes --]
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?
[-- Attachment #2: Type: text/html, Size: 344 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#46331: provided-mode-derived-p doesn't work on aliases
2021-02-06 11:27 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-02-06 11:31 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-02-06 11:37 ` Lars Ingebrigtsen
1 sibling, 0 replies; 10+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-06 11:37 UTC (permalink / raw)
To: Reuben Thomas; +Cc: 46331
Reuben Thomas <rrt@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
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#46331: provided-mode-derived-p doesn't work on aliases
2021-02-06 11:32 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-02-06 11:39 ` Lars Ingebrigtsen
2021-02-06 11:41 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-06 11:39 UTC (permalink / raw)
To: Reuben Thomas; +Cc: 46331
Reuben Thomas <rrt@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
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#46331: provided-mode-derived-p doesn't work on aliases
2021-02-06 11:39 ` Lars Ingebrigtsen
@ 2021-02-06 11:41 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-02-06 12:54 ` Lars Ingebrigtsen
0 siblings, 1 reply; 10+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-02-06 11:41 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 46331
[-- Attachment #1: Type: text/plain, Size: 542 bytes --]
On Sat, 6 Feb 2021 at 11:39, Lars Ingebrigtsen <larsi@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
[-- Attachment #2: Type: text/html, Size: 1143 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#46331: provided-mode-derived-p doesn't work on aliases
2021-02-06 11:41 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-02-06 12:54 ` Lars Ingebrigtsen
0 siblings, 0 replies; 10+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-06 12:54 UTC (permalink / raw)
To: Reuben Thomas; +Cc: 46331
Reuben Thomas <rrt@sc3d.org> writes:
> On Sat, 6 Feb 2021 at 11:39, Lars Ingebrigtsen <larsi@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
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-02-06 12:54 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-05 17:13 bug#46331: provided-mode-derived-p doesn't work on aliases Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-02-06 11:04 ` Lars Ingebrigtsen
2021-02-06 11:22 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-02-06 11:27 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-02-06 11:31 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-02-06 11:32 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-02-06 11:39 ` Lars Ingebrigtsen
2021-02-06 11:41 ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-02-06 12:54 ` Lars Ingebrigtsen
2021-02-06 11:37 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).