From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 01 07:28:23 2023 Received: (at submit) by debbugs.gnu.org; 1 Feb 2023 12:28:23 +0000 Received: from localhost ([127.0.0.1]:56779 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNCDu-0002JH-Mv for submit@debbugs.gnu.org; Wed, 01 Feb 2023 07:28:23 -0500 Received: from lists.gnu.org ([209.51.188.17]:52784) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNCDq-0002J6-Ce for submit@debbugs.gnu.org; Wed, 01 Feb 2023 07:28:20 -0500 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 1pNCDo-0007kg-Qm for bug-gnu-emacs@gnu.org; Wed, 01 Feb 2023 07:28:18 -0500 Received: from smtp1a.inetd.co.jp ([210.129.88.11]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNCDk-0007Dp-Ow for bug-gnu-emacs@gnu.org; Wed, 01 Feb 2023 07:28:16 -0500 Received: from localhost (42-144-46-173.rev.home.ne.jp [42.144.46.173]) by smtp1a.inetd.co.jp (Postfix) with ESMTPA id 1CAFB5C for ; Wed, 1 Feb 2023 21:28:08 +0900 (JST) From: Ikumi Keita To: bug-gnu-emacs@gnu.org Subject: 28.2; Feature request; facility for dispatch type major mode X-Mailer: MH-E 8.6+git; nmh 1.7.1; GNU Emacs 28.2 X-Debbugs-Cc: Stefan Monnier MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <13349.1675254487.1@localhost> Content-Transfer-Encoding: quoted-printable Date: Wed, 01 Feb 2023 21:28:07 +0900 Message-ID: <13351.1675254487@localhost> Received-SPF: pass client-ip=210.129.88.11; envelope-from=ikumi@ikumi.que.jp; helo=smtp1a.inetd.co.jp X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) 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) ...) because it doesn't respond to directory local variable entry of the form ((japanese-latex-mode ...)) in that case. So I hope emacs to have facility to handle such superficial major modes in a clean way. Regards, Ikumi Keita #StandWithUkraine #StopWarInUkraine In GNU Emacs 28.2 (build 1, x86_64-unknown-freebsd13.1, GTK+ Version 3.24.= 33, cairo version 1.17.4) of 2022-09-15 built on freebsd.vmware Windowing system distributor 'The X.Org Foundation', version 11.0.12101004 System Description: 13.1-RELEASE-p5 Configured using: 'configure --with-canna --with-canna-includes=3D/usr/local/canna/include --with-canna-libraries=3D/usr/local/canna/lib --without-xim --disable-largefile --without-modules --with-sound=3Dyes --with-file-notification=3Dyes CFLAGS=3D-O3' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GNUTLS GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBXML2 NOTIFY KQUEUE PDUMPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB Important settings: value of $EMACSLOADPATH: /home/keita/elisp: value of $LANG: ja_JP.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: shell-dirtrack-mode: t TeX-PDF-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t Load-path shadows: /home/keita/.emacs.d/elpa/transient-20230124.2013/transient hides /usr/loc= al/share/emacs/28.2/lisp/transient ~/elisp/reftex-parse hides /usr/local/share/emacs/28.2/lisp/textmodes/reft= ex-parse /home/keita/.emacs.d/elpa/soap-client-3.2.1/soap-inspect hides /usr/local/= share/emacs/28.2/lisp/net/soap-inspect /home/keita/.emacs.d/elpa/soap-client-3.2.1/soap-client hides /usr/local/s= hare/emacs/28.2/lisp/net/soap-client Features: (pp shadow emacsbug mh-thread supercite regi mh-identity mh-letter mh-comp sendmail reftex-sel reftex-ref reftex-parse preview reftex-dcr reftex-auc reftex reftex-loaddefs reftex-vars tex-bar toolbar-x noutline outline tex-mode shell pcomplete font-latex tex-jp latex easy-mmode latex-flymake flymake-proc flymake project compile comint ansi-color ring warnings tex-ispell tex-style tex texmathp latexenc mh-search qp mm-archive smiley mail-extr mh-mime mh-gnus mh-alias multi-prompt crm mh-show goto-addr thingatpt gnus-cite gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum shr svg dom gnus-group gnus-undo gnus-start gnus-dbus dbus gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo gnus-spec gnus-int message dired dired-loaddefs rfc822 mml mml-sec mm-decode mm-bodies mm-encode gmm-utils mailheader gnus-win gnus-range gnus nnheader wid-edit mh-seq mh-inc hl-line mh-tool-bar mh-xface mh-utils mh-folder which-func imenu gnus-util rmail rmail-loaddefs mail-utils text-property-search mh-scan mh-e mh-compat mailabbrev mh-buffers mh-loaddefs skeleton misearch multi-isearch conf-mode mule-util kinsoku cl-extra help-mode parse-time iso8601 time-date ucs-normalize epa derived epg rfc6068 epg-config url-http url-auth mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr url-gw nsm rmc puny jka-compr twittering-mode advice xml edmacro kmacro preview-latex tex-site canna-im info package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib japan-util iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind kqueue lcms2 dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 865676 104494) (symbols 48 23604 44) (strings 32 132282 18657) (string-bytes 1 5868969) (vectors 16 74186) (vector-slots 8 1681559 71081) (floats 8 424 893) (intervals 56 21817 8038) (buffers 992 35)) From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 09 20:29:45 2023 Received: (at 61211) by debbugs.gnu.org; 10 Feb 2023 01:29:45 +0000 Received: from localhost ([127.0.0.1]:33955 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pQIET-0006Pb-Fw for submit@debbugs.gnu.org; Thu, 09 Feb 2023 20:29:45 -0500 Received: from mail-pj1-f54.google.com ([209.85.216.54]:53206) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pQIEQ-0006PG-VD for 61211@debbugs.gnu.org; Thu, 09 Feb 2023 20:29:43 -0500 Received: by mail-pj1-f54.google.com with SMTP id o13so3792536pjg.2 for <61211@debbugs.gnu.org>; Thu, 09 Feb 2023 17:29:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=VEQJZygow98Qkbdbr8XrvxdMFuHj6AN5Wy9SKZkolLQ=; b=BQQ/m4ZKHHLgA0kM0osj519sDs2Zck/yPYEA2826oHSBYkICuZp/uPf4eVqenBT9eC QrJx6RoW7AOHSSWFpP+S9EtST+DR/2t0YHvGNrQjI00tltBM3Zco8RYKXjRjj2iwv8zN BLY6oEhNOEWYUSH72r0JdFZeHpYK+5A4gPWgTfSsxa1YWRKpdL36wMXbkGBtbOPIsLyh u4CZvlpcSMJgvWklA8TAOsFTeESqCK6MD4dSWNls6yrbmugYMcuMJBRGkjUhiPl9qDY5 yG41UL6V1VPg6IFeJeJJ+dnc0tGyyo3lAOBMsAk/0cY3oQRScUZBgHl3WsjAzGx9WGVV 5Lug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VEQJZygow98Qkbdbr8XrvxdMFuHj6AN5Wy9SKZkolLQ=; b=B0H8QKAyukQqjH6KMR0EtgTYpQeEwsvFcjsqMixISjSiDK6Mn0zwdJeF80Xh/oNGGw OIhKJCpmb6cV+sMtZ2sHBLPFfa8l4Uu0h6MIAZq9oJW/OHqsHFQU/q2/KwW+NLaA3cpU z2OLOXciUp4z+nBWxsXeOuiIN1wV/u/F7eyh4h8VGoRlG38UdpIm/AIIHg5VHkL6k3dd 3aEab1tGPx/ZAZQWiKbtlJP8sXOlzYb1qHk5X5V1DFvMlfOBafVDD2X721vcop0gIBp/ oaL4/zkPFAr7cees9BKlteaT35WXFGm8urx0NF2a3riI6UYxgdf6RCTk0Y/HoLLRCUny VM6Q== X-Gm-Message-State: AO0yUKX38u/qrcBz52t1/+jEcW55sIsj8a4aeqdgE1yz/lUHlmSi78Hl fwcwuHRc0bJD1PrETqfwQdM= X-Google-Smtp-Source: AK7set/Kl6WbbdvOpOy3YYLJEpRAd+Jx+nAW1iF30cQcaf2tofrDLL1swbnPFbhH0IYkXPIuymIFcg== X-Received: by 2002:a17:902:e414:b0:199:5593:cdba with SMTP id m20-20020a170902e41400b001995593cdbamr4596654ple.69.1675992577085; Thu, 09 Feb 2023 17:29:37 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id m3-20020a632603000000b0049f77341db3sm1839652pgm.42.2023.02.09.17.29.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Feb 2023 17:29:36 -0800 (PST) From: Yuan Fu Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) Subject: Re: bug#61211: 28.2; Feature request; facility for dispatch type major mode Message-Id: <1D8721C5-5B3F-49D2-950A-409D984F91E2@gmail.com> Date: Thu, 9 Feb 2023 17:29:26 -0800 To: ikumi@ikumi.que.jp X-Mailer: Apple Mail (2.3731.300.101.1.3) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 61211 Cc: monnier@iro.umontreal.ca, 61211@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Ikumi Keita writes: > 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) > ...) > because it doesn't respond to directory local variable entry of the = form > ((japanese-latex-mode > ...)) > in that case. > > So I hope emacs to have facility to handle such superficial major = modes > in a clean way. > > Regards, > Ikumi Keita > #StandWithUkraine #StopWarInUkraine Another use-case is for tree-sitter modes: we want to dispatch to tree-sitter/non-tree-sitter major modes automatically. Yuan From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 10 00:10:51 2023 Received: (at 61211) by debbugs.gnu.org; 10 Feb 2023 05:10:51 +0000 Received: from localhost ([127.0.0.1]:34106 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pQLgQ-0004CF-Ry for submit@debbugs.gnu.org; Fri, 10 Feb 2023 00:10:51 -0500 Received: from smtp1a.inetd.co.jp ([210.129.88.11]:50418) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pQLg9-0004Bb-Jd for 61211@debbugs.gnu.org; Fri, 10 Feb 2023 00:10:48 -0500 Received: from localhost (42-144-46-173.rev.home.ne.jp [42.144.46.173]) by smtp1a.inetd.co.jp (Postfix) with ESMTPA id 6A1805C; Fri, 10 Feb 2023 14:10:31 +0900 (JST) From: Ikumi Keita To: Yuan Fu Subject: Re: bug#61211: 28.2; Feature request; facility for dispatch type major mode In-reply-to: <1D8721C5-5B3F-49D2-950A-409D984F91E2@gmail.com> References: <1D8721C5-5B3F-49D2-950A-409D984F91E2@gmail.com> Comments: In-reply-to Yuan Fu message dated "Thu, 09 Feb 2023 17:29:26 -0800." X-Mailer: MH-E 8.6+git; nmh 1.7.1; GNU Emacs 28.2 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <69667.1676005831.1@localhost> Date: Fri, 10 Feb 2023 14:10:31 +0900 Message-ID: <69670.1676005831@localhost> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 61211 Cc: monnier@iro.umontreal.ca, 61211@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> Yuan Fu writes: > Another use-case is for tree-sitter modes: we want to dispatch to > tree-sitter/non-tree-sitter major modes automatically. Yeah, reasonable consideration. Regards, Ikumi Keita #StandWithUkraine #StopWarInUkraine From debbugs-submit-bounces@debbugs.gnu.org Tue May 09 11:21:47 2023 Received: (at 61211) by debbugs.gnu.org; 9 May 2023 15:21:47 +0000 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 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 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) 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== 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) From: Stefan Monnier To: Ikumi Keita Subject: Re: bug#61211: 28.2; Feature request; facility for dispatch type major mode In-Reply-To: <13351.1675254487@localhost> (Ikumi Keita's message of "Wed, 01 Feb 2023 21:28:07 +0900") Message-ID: References: <13351.1675254487@localhost> Date: Tue, 09 May 2023 11:21:20 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.114 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61211 Cc: 61211@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > 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 From debbugs-submit-bounces@debbugs.gnu.org Thu May 11 08:23:35 2023 Received: (at 61211) by debbugs.gnu.org; 11 May 2023 12:23:35 +0000 Received: from localhost ([127.0.0.1]:49946 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1px5KZ-0003xT-0E for submit@debbugs.gnu.org; Thu, 11 May 2023 08:23:35 -0400 Received: from smtp1a.inetd.co.jp ([210.129.88.11]:53970) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1px5KV-0003xJ-Oq for 61211@debbugs.gnu.org; Thu, 11 May 2023 08:23:33 -0400 Received: from localhost (42-144-46-173.rev.home.ne.jp [42.144.46.173]) by smtp1a.inetd.co.jp (Postfix) with ESMTPA id 29C235F; Thu, 11 May 2023 21:23:29 +0900 (JST) From: Ikumi Keita To: Stefan Monnier Subject: Re: bug#61211: 28.2; Feature request; facility for dispatch type major mode In-reply-to: References: <13351.1675254487@localhost> Comments: In-reply-to Stefan Monnier message dated "Tue, 09 May 2023 11:21:20 -0400." X-Mailer: MH-E 8.6+git; nmh 1.7.1; GNU Emacs 28.2 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <95919.1683807806.1@localhost> Date: Thu, 11 May 2023 21:23:26 +0900 Message-ID: <95920.1683807806@localhost> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 61211 Cc: 61211@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> Stefan Monnier writes: >> 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? The rest of the codes are written without considering japanese-* variants. For example there are codes like (if (eq major-mode 'LaTeX-mode) ...) (if (memq major-mode (nth 4 TeX-command-list)) ...) (assq major-mode ALIST-WITHOUT-JAPANESE-VARIANTS) Of course, we can "fix" these codes to cover japanese-* variants like (if (memq major-mode '(LaTeX-mode japanese-LaTeX-mode) ...)) (let ((mode (if (string-prefix-p (symbol-name major-mode) "japanese-") (intern (substring 9 major-mode)) major-mode))) (memq mode (nth 4 TeX-command-list)) ...) (let ((mode (if (string-prefix-p (symbol-name major-mode) "japanese-") (intern (substring 9 major-mode)) major-mode))) (assq mode ALIST-WITHOUT-JAPANESE-VARIANTS)) However, such treatments don't look good to me. It is true that we could make wrapper function/macro to reduce such complexity. However, practically all third party packages developed by non-Japanese wouldn't notice the necesity of such wrapper for the first place and write simply like (if (eq major-mode 'LaTeX-mode) ...) ; such codes, incompatible with japanse-LaTeX-mode, will continue to spawn on ELPA, MELPA, stackexchange etc. (or even in AUCTeX itself after I cease to participate develop, unless a new Japanese developer joins.) > 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`. Yes, not the same, only a similarity. >> 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? Yes, restricting the scope only within the availability of directory local variables. > 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? If that's possible, it will be a solution, I think. Regards, Ikumi Keita #StandWithUkraine #StopWarInUkraine