From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#61211: 28.2; Feature request; facility for dispatch type major mode Date: Tue, 09 May 2023 11:21:20 -0400 Message-ID: References: <13351.1675254487@localhost> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6922"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 61211@debbugs.gnu.org To: Ikumi Keita Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 09 17:22:19 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1pwPAR-0001an-6S for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 May 2023 17:22:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwPAB-0007fE-9k; Tue, 09 May 2023 11:22:03 -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 1pwPAA-0007f0-5x for bug-gnu-emacs@gnu.org; Tue, 09 May 2023 11:22:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pwPA9-0000I9-PS for bug-gnu-emacs@gnu.org; Tue, 09 May 2023 11:22:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pwPA9-0004Y3-Ky for bug-gnu-emacs@gnu.org; Tue, 09 May 2023 11:22:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 09 May 2023 15:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61211 X-GNU-PR-Package: emacs Original-Received: via spool by 61211-submit@debbugs.gnu.org id=B61211.168364570717462 (code B ref 61211); Tue, 09 May 2023 15:22:01 +0000 Original-Received: (at 61211) by debbugs.gnu.org; 9 May 2023 15:21:47 +0000 Original-Received: from localhost ([127.0.0.1]:44168 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pwP9v-0004XZ-CL for submit@debbugs.gnu.org; Tue, 09 May 2023 11:21:47 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:44352) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pwP9s-0004XJ-Nh for 61211@debbugs.gnu.org; Tue, 09 May 2023 11:21:45 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 329FD441484; Tue, 9 May 2023 11:21:39 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 60B15441411; Tue, 9 May 2023 11:21:33 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1683645693; bh=DPmkFiESrMCLf3eCa7hK/pRm1nmHYOS5JiU30KTJYIE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=HQKcF+TNdDw80Vfnc0Te0/5ileRRzruFs/5mPOGio/xWoULGcqjgzSH03XCoF1Q6O l8kYX8UKFQWh//ZqhE9EeFPWXDa0FTb1uFDoVHYsrfglr2W2rjz7TtMNjOACii5YHy wrPm4elcazdBkr/U5/cioVaTyzcvdE5IzBtdUNGC3i7WUKvmnlLVFBvdUn1KombVhg RGUT4HKpcmwSNH29prrPIW7egkNDWG0AmprFWxOjnGEYwYXNk1E+mU0aoQuB4N5HkQ X+iODRnXzwnpThd5WKHGjuWJl4uAoDjTXv6UvmnkzhGBME8fPn1YjTUy8EBUbG69Lm Vyy0vgSY2l9jg== Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 2FA0C1208F2; Tue, 9 May 2023 11:21:33 -0400 (EDT) In-Reply-To: <13351.1675254487@localhost> (Ikumi Keita's message of "Wed, 01 Feb 2023 21:28:07 +0900") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261421 Archived-At: > I'd like to discuss dispatch functions or "superficial" major modes. > AUCTeX has the following major mode functions: > context-en-mode, context-nl-mode, japanese-latex-mode, japanese-plain-tex-mode > They only do language-specific set-ups and turn into context-mode, > latex-mode or plain-tex-mode eventually. In some aspects, they are > similar with dispatch functions `tex--guess-mode' and `TeX-tex-mode' > (AUCTeX) which guess a proper major mode and call it: > - They can be specified as `mode' tag of file local variable and entry > of `auto-mode-alist'. > - They never hold their own `major-mode' value. > - When called, they eventually turn into another proper major mode. > For these reasons, they can be called "superficial" major modes. > > Note that it isn't enough to define them like > (define-derived-mode japanese-latex-mode latex-mode "LaTeX" > ... > (setq major-mode 'latex-mode) > ...) IOW what are the advantages/disadvantages of using (setq major-mode 'latex-mode) above? Also, this seems different from the case of dispatch functions like `tex--guess-mode' and `TeX-tex-mode' since these may end up choosing `latex-mode` but they're definitely not "child" of `latex-mode`. [ Similarly for the tree-sitter case mentioned in another message: the function that dispatches to TS-vs-nonTS major modes can't be considered a child of those two major modes. ] > because it doesn't respond to directory local variable entry of the form > ((japanese-latex-mode > ...)) > in that case. If we make `japanese-latex-mode` a proper child mode, then this problem disappears, right? I'm also thinking that maybe `set-auto-mode` should remember the name of the "mode function" it called so we could consult this (in addition to the value of `major-mode`) when applying directory-local vars? Stefan