[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What is the use of derived-mode-add-parents?
From: |
Eli Zaretskii |
Subject: |
Re: What is the use of derived-mode-add-parents? |
Date: |
Mon, 18 Mar 2024 15:25:01 +0200 |
> From: Pankaj Jangid <pankaj@codeisgreat.org>
> Date: Mon, 18 Mar 2024 13:04:51 +0530
>
> I am working on a new -ts-mode for Move language. Rust is the closest
> language so I am looking at rust-ts-mode's code. There I encountered a
> call in the end,
>
> (derived-mode-add-parents 'rust-ts-mode '(rust-mode))
>
> I need help in understanding what this call does. The docstring says this,
>
> --8<---------------cut here---------------start------------->8---
> (defun derived-mode-add-parents (mode extra-parents)
> "Add EXTRA-PARENTS to the parents of MODE.
> Declares the parents of MODE to be its main parent (as defined
> in `define-derived-mode') plus EXTRA-PARENTS, which should be a list
> of symbols."
> (put mode 'derived-mode-extra-parents extra-parents)
> (derived-mode--flush mode))
> --8<---------------cut here---------------end--------------->8---
>
> Please help me understand, what is the use of parent modes?
Did you read the documentation of derived-mode-add-parents in the
ELisp manual? I think it attempts to answer your questions.