From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: What is the use of derived-mode-add-parents? Date: Mon, 18 Mar 2024 15:25:01 +0200 Message-ID: <86le6f4qqa.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29713"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Pankaj Jangid Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Mar 18 14:25:44 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rmCzo-0007UU-CI for ged-emacs-devel@m.gmane-mx.org; Mon, 18 Mar 2024 14:25:44 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmCzD-0002Df-0t; Mon, 18 Mar 2024 09:25:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmCzB-0002DJ-It for emacs-devel@gnu.org; Mon, 18 Mar 2024 09:25:05 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmCzB-000517-2m; Mon, 18 Mar 2024 09:25:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=3OkraEomQH09sBp7PbyHCPkeQgsImYkg3dCa0UIoJbw=; b=Zz7a8b6XpU/D nY3uVQNwvSfmXls57amtCSO1YIGJyG67SSWJiEwPkkQFu6IMeCetConQtx78VylXlbjwSx4XIL+wE 7R3FEOoimjl3O4mx2bqQM2L4+rkCqv/AZaK6A/nYajtO0tfgC9KK0tBC5wkOEovMB+D51z5gdULGJ usf+lFbyTFwuEWSezADB3YSAiB27rpkys/R7DzlqAVH9Em2IWp1SImDSDjRuBljRcRiQZ6JyYcVav i/hWUuYZkdi/CGgQBs0/k4UNqixqJBgzKeoFSCceqZ2gGXGzTi8dYVpBPPkysIF0Avga1YNWAVGZ7 uGxLoPOVTAFP77Zh/IhSog==; In-Reply-To: (message from Pankaj Jangid on Mon, 18 Mar 2024 13:04:51 +0530) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:317168 Archived-At: > From: Pankaj Jangid > 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.