GNU bug report logs -
#57481
elisp code utilising derived-mode-parent
Previous Next
Reported by: Christopher Dimech <dimech <at> gmx.com>
Date: Tue, 30 Aug 2022 05:45:02 UTC
Severity: normal
Tags: wontfix
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 57481 in the body.
You can then email your comments to 57481 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57481
; Package
emacs
.
(Tue, 30 Aug 2022 05:45:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Christopher Dimech <dimech <at> gmx.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 30 Aug 2022 05:45:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Have seen that (get 'latex-mode 'derived-mode-parent) as a normal elisp command.
For instance, I cannot run it in "lisp-interaction-mode" or simply make a elisp
function that iterates the result of the expression until reacting "nil" to get
a tree of all parents.
Would be a handy tool to have.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57481
; Package
emacs
.
(Tue, 30 Aug 2022 06:38:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 57481 <at> debbugs.gnu.org (full text, mbox):
You can derive (as it were) such a function from the code of
`provided-mode-derived-p' like so:
(defun derived-mode-chain (mode)
"Return the chain of derived modes for MODE."
(let (chain)
(while (progn (push mode chain)
(let* ((parent (get mode 'derived-mode-parent))
(parentfn (symbol-function parent)))
(setq mode (if (and parentfn (symbolp parentfn))
parentfn
parent)))))
(nreverse chain)))
(derived-mode-chain 'latex-mode)
=> (latex-mode tex-mode text-mode)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57481
; Package
emacs
.
(Tue, 30 Aug 2022 10:37:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 57481 <at> debbugs.gnu.org (full text, mbox):
Christopher Dimech <dimech <at> gmx.com> writes:
> Have seen that (get 'latex-mode 'derived-mode-parent) as a normal
> elisp command.
> For instance, I cannot run it in "lisp-interaction-mode" or simply make a elisp
> function that iterates the result of the expression until reacting "nil" to get
> a tree of all parents.
>
> Would be a handy tool to have.
I don't think that would be generally useful -- it's internal data that
wouldn't be interesting to the vast majority of users.
So I'm closing this as a "wontfix".
Added tag(s) wontfix.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Tue, 30 Aug 2022 10:38:01 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
57481 <at> debbugs.gnu.org and Christopher Dimech <dimech <at> gmx.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Tue, 30 Aug 2022 10:38:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57481
; Package
emacs
.
(Tue, 30 Aug 2022 11:34:01 GMT)
Full text and
rfc822 format available.
Message #18 received at 57481 <at> debbugs.gnu.org (full text, mbox):
> Sent: Tuesday, August 30, 2022 at 6:37 PM
> From: "Phil Sainty" <psainty <at> orcon.net.nz>
> To: "Christopher Dimech" <dimech <at> gmx.com>
> Cc: 57481 <at> debbugs.gnu.org
> Subject: bug#57481: elisp code utilising derived-mode-parent
>
> You can derive (as it were) such a function from the code of
> `provided-mode-derived-p' like so:
>
>
> (defun derived-mode-chain (mode)
> "Return the chain of derived modes for MODE."
> (let (chain)
> (while (progn (push mode chain)
> (let* ((parent (get mode 'derived-mode-parent))
> (parentfn (symbol-function parent)))
> (setq mode (if (and parentfn (symbolp parentfn))
> parentfn
> parent)))))
> (nreverse chain)))
>
>
> (derived-mode-chain 'latex-mode)
> => (latex-mode tex-mode text-mode)
We are getting somewhere, but am only getting (latex-mode) on Emacs 27.2
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57481
; Package
emacs
.
(Tue, 30 Aug 2022 11:49:02 GMT)
Full text and
rfc822 format available.
Message #21 received at 57481 <at> debbugs.gnu.org (full text, mbox):
> Sent: Tuesday, August 30, 2022 at 10:36 PM
> From: "Lars Ingebrigtsen" <larsi <at> gnus.org>
> To: "Christopher Dimech" <dimech <at> gmx.com>
> Cc: 57481 <at> debbugs.gnu.org
> Subject: bug#57481: elisp code utilising derived-mode-parent
>
> Christopher Dimech <dimech <at> gmx.com> writes:
>
> > Have seen that (get 'latex-mode 'derived-mode-parent) as a normal
> > elisp command.
> > For instance, I cannot run it in "lisp-interaction-mode" or simply make a elisp
> > function that iterates the result of the expression until reacting "nil" to get
> > a tree of all parents.
> >
> > Would be a handy tool to have.
>
> I don't think that would be generally useful -- it's internal data that
> wouldn't be interesting to the vast majority of users.
>
> So I'm closing this as a "wontfix".
I encourage tools that assist the perusing of internal data. Such tools
would be instrumental for people keenly interested in Emacs Internals.
Besides users there should be a separate focus towards developer needs.
Will elevate emacs work substantially.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57481
; Package
emacs
.
(Tue, 30 Aug 2022 12:03:02 GMT)
Full text and
rfc822 format available.
Message #24 received at 57481 <at> debbugs.gnu.org (full text, mbox):
On 2022-08-30 23:33, Christopher Dimech wrote:
> am only getting (latex-mode) on Emacs 27.2
You obviously haven't loaded the library defining the mode
(which is tex-mode.el). Don't expect Emacs to know much
about something that hasn't been loaded.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57481
; Package
emacs
.
(Tue, 30 Aug 2022 12:09:02 GMT)
Full text and
rfc822 format available.
Message #27 received at 57481 <at> debbugs.gnu.org (full text, mbox):
> Sent: Tuesday, August 30, 2022 at 6:37 PM
> From: "Phil Sainty" <psainty <at> orcon.net.nz>
> To: "Christopher Dimech" <dimech <at> gmx.com>
> Cc: 57481 <at> debbugs.gnu.org
> Subject: Re: bug#57481: elisp code utilising derived-mode-parent
>
> You can derive (as it were) such a function from the code of
> `provided-mode-derived-p' like so:
>
>
> (defun derived-mode-chain (mode)
> "Return the chain of derived modes for MODE."
> (let (chain)
> (while (progn (push mode chain)
> (let* ((parent (get mode 'derived-mode-parent))
> (parentfn (symbol-function parent)))
> (setq mode (if (and parentfn (symbolp parentfn))
> parentfn
> parent)))))
> (nreverse chain)))
>
>
> (derived-mode-chain 'latex-mode)
> => (latex-mode tex-mode text-mode)
Can one do something that can be run in elisp code and in
lisp-interaction-mode without requirement that the mode one
is interested in has been loaded?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57481
; Package
emacs
.
(Tue, 30 Aug 2022 12:39:02 GMT)
Full text and
rfc822 format available.
Message #30 received at 57481 <at> debbugs.gnu.org (full text, mbox):
On 2022-08-31 00:08, Christopher Dimech wrote:
> Can one do something that can be run in elisp code and in
> lisp-interaction-mode without requirement that the mode one
> is interested in has been loaded?
You're asking whether Emacs can tell you things it doesn't know.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57481
; Package
emacs
.
(Tue, 30 Aug 2022 12:47:01 GMT)
Full text and
rfc822 format available.
Message #33 received at 57481 <at> debbugs.gnu.org (full text, mbox):
> Sent: Wednesday, August 31, 2022 at 12:38 AM
> From: "Phil Sainty" <psainty <at> orcon.net.nz>
> To: "Christopher Dimech" <dimech <at> gmx.com>
> Cc: 57481 <at> debbugs.gnu.org
> Subject: Re: bug#57481: elisp code utilising derived-mode-parent
>
> On 2022-08-31 00:08, Christopher Dimech wrote:
> > Can one do something that can be run in elisp code and in
> > lisp-interaction-mode without requirement that the mode one
> > is interested in has been loaded?
>
> You're asking whether Emacs can tell you things it doesn't know.
Then the information can only be traced at run-time. Could things get loaded
if needed without having this requirement done by users?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57481
; Package
emacs
.
(Tue, 30 Aug 2022 13:03:01 GMT)
Full text and
rfc822 format available.
Message #36 received at 57481 <at> debbugs.gnu.org (full text, mbox):
> Cc: 57481 <at> debbugs.gnu.org
> Date: Wed, 31 Aug 2022 00:38:46 +1200
> From: Phil Sainty <psainty <at> orcon.net.nz>
>
> On 2022-08-31 00:08, Christopher Dimech wrote:
> > Can one do something that can be run in elisp code and in
> > lisp-interaction-mode without requirement that the mode one
> > is interested in has been loaded?
>
> You're asking whether Emacs can tell you things it doesn't know.
Well, it's Emacs, isn't it? Why shouldn't it have a feature whereby
it tells us things it doesn't know about? It certainly sounds useful
to have.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57481
; Package
emacs
.
(Tue, 30 Aug 2022 13:18:01 GMT)
Full text and
rfc822 format available.
Message #39 received at 57481 <at> debbugs.gnu.org (full text, mbox):
> Sent: Wednesday, August 31, 2022 at 1:02 AM
> From: "Eli Zaretskii" <eliz <at> gnu.org>
> To: "Phil Sainty" <psainty <at> orcon.net.nz>
> Cc: dimech <at> gmx.com, 57481 <at> debbugs.gnu.org
> Subject: Re: bug#57481: elisp code utilising derived-mode-parent
>
> > Cc: 57481 <at> debbugs.gnu.org
> > Date: Wed, 31 Aug 2022 00:38:46 +1200
> > From: Phil Sainty <psainty <at> orcon.net.nz>
> >
> > On 2022-08-31 00:08, Christopher Dimech wrote:
> > > Can one do something that can be run in elisp code and in
> > > lisp-interaction-mode without requirement that the mode one
> > > is interested in has been loaded?
> >
> > You're asking whether Emacs can tell you things it doesn't know.
>
> Well, it's Emacs, isn't it? Why shouldn't it have a feature whereby
> it tells us things it doesn't know about? It certainly sounds useful
> to have.
It could find things through and do what it has to do, without requirements
for user mode loading.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57481
; Package
emacs
.
(Tue, 30 Aug 2022 22:08:02 GMT)
Full text and
rfc822 format available.
Message #42 received at 57481 <at> debbugs.gnu.org (full text, mbox):
On 2022-08-31 01:16, Christopher Dimech wrote:
> It could find things through and do what it has to do,
> without requirements for user mode loading.
Except that what it needs to do is load the mode.
If you're now saying that you're actually happy for the mode
to be loaded just so long as the user doesn't have to do it
themselves, then you can do that for autoloaded modes.
Check autoloadp and, if non-nil, call autoload-do-load.
For modes which are neither loaded nor known as autoloads,
Emacs doesn't even know they exist, let alone how to tell
you what they derive from.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57481
; Package
emacs
.
(Wed, 31 Aug 2022 06:25:02 GMT)
Full text and
rfc822 format available.
Message #45 received at 57481 <at> debbugs.gnu.org (full text, mbox):
> Sent: Wednesday, August 31, 2022 at 10:07 AM
> From: "Phil Sainty" <psainty <at> orcon.net.nz>
> To: "Christopher Dimech" <dimech <at> gmx.com>
> Cc: "Eli Zaretskii" <eliz <at> gnu.org>, 57481 <at> debbugs.gnu.org
> Subject: Re: bug#57481: elisp code utilising derived-mode-parent
>
> On 2022-08-31 01:16, Christopher Dimech wrote:
> > It could find things through and do what it has to do,
> > without requirements for user mode loading.
>
> Except that what it needs to do is load the mode.
>
> If you're now saying that you're actually happy for the mode
> to be loaded just so long as the user doesn't have to do it
> themselves, then you can do that for autoloaded modes.
> Check autoloadp and, if non-nil, call autoload-do-load.
It has been a misinterpretation. Not-loading was a reference to
make the loading requirement fall upon the user. Unless the
user has already loaded it or was loaded it for whatever task
user is doing, then I can load the mode appropriately when the
user calls the function.
> For modes which are neither loaded nor known as autoloads,
> Emacs doesn't even know they exist, let alone how to tell
> you what they derive from.
Can scrutinise that some other time.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57481
; Package
emacs
.
(Wed, 31 Aug 2022 11:32:01 GMT)
Full text and
rfc822 format available.
Message #48 received at 57481 <at> debbugs.gnu.org (full text, mbox):
> Sent: Tuesday, August 30, 2022 at 6:37 PM
> From: "Phil Sainty" <psainty <at> orcon.net.nz>
> To: "Christopher Dimech" <dimech <at> gmx.com>
> Cc: 57481 <at> debbugs.gnu.org
> Subject: Re: bug#57481: elisp code utilising derived-mode-parent
>
> You can derive (as it were) such a function from the code of
> `provided-mode-derived-p' like so:
>
>
> (defun derived-mode-chain (mode)
> "Return the chain of derived modes for MODE."
> (let (chain)
> (while (progn (push mode chain)
> (let* ((parent (get mode 'derived-mode-parent))
> (parentfn (symbol-function parent)))
> (setq mode (if (and parentfn (symbolp parentfn))
> parentfn
> parent)))))
> (nreverse chain)))
>
>
> (derived-mode-chain 'latex-mode)
> => (latex-mode tex-mode text-mode)
>
Have not encountered "(while" with "(progn" in "(while (progn". Could you be so kind to explain it?
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 29 Sep 2022 11:24:10 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 210 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.