From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Calling another major mode in a major mode body Date: Mon, 21 Nov 2022 14:07:27 -0800 Message-ID: <1263D369-330F-4624-A376-ECC1E1A26A52@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24536"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Nov 21 23:08:37 2022 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 1oxExu-0006Bq-G3 for ged-emacs-devel@m.gmane-mx.org; Mon, 21 Nov 2022 23:08:34 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oxEwz-0005JX-QL; Mon, 21 Nov 2022 17:07:37 -0500 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 1oxEwv-0005JG-KW for emacs-devel@gnu.org; Mon, 21 Nov 2022 17:07:34 -0500 Original-Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oxEwt-000716-Tu for emacs-devel@gnu.org; Mon, 21 Nov 2022 17:07:33 -0500 Original-Received: by mail-pj1-x1035.google.com with SMTP id l22-20020a17090a3f1600b00212fbbcfb78so15499745pjc.3 for ; Mon, 21 Nov 2022 14:07:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:from:to:cc:subject:date:message-id:reply-to; bh=lLmJKR842FeEX2elJvtJsTsXuigBvVpkvnGfYOybgMM=; b=H4o74rTL3djQSZfJHO86En1OvO1/VsqJF+DS2unC7gur5XF5QLA5/UN0L1Fmy24L4o Tu8uKMyXFcFClkaJ1zA7Yo1xVwb57NNR8B/upO5GyrPfMiG2vHHTfvHiZjfi9DAFeoWO NgtW7yqat0Ox3LUxOCad95RF8DeeYXwEsSo0Av/zsQTnyiVS7dnKQbIShe5OZhFM9Rn/ HUIYtbUKaIHKJyp2gBKtNs/QmlU36Gkg29JTb6a71MIhEQFbE9bU0Inl6YQ3tcJ3Y8K2 OzqRkD3e+18mVZUFhDkAmUcLGyJWpAb9lvppxiAZ02n3rS5GKHadDDPqgKjAwNapA8x1 X08w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lLmJKR842FeEX2elJvtJsTsXuigBvVpkvnGfYOybgMM=; b=Ox3D5Aj2L5XlFDGKpTxgm4QNUOb/XgLvk0WrFP2xI47JpCTBLjq3/D929LllYxmTtc eWIyuExrh074UsdXPfo90qiTLWDFrqgU4nNbScOVEAhDE4lHsV4t+We8q/zGOKOO/2LH lrh1dnkgYByem+ZpPl7sO8P4Yy3fXVyVEd/RAEsqu6VEJ0hXUJvRrtBvOudIwCGrAK9n /d5xuuqzh6XtotxCLk11Y1nzRy37y187Wbg2hsxPPRjZ+zdgHGznM4xVfUO4R1nMy53v +mTXeqcvqsbH/CxZuSOXL88REKcJee//UrW+PFo3aCMqnkbYJOduVtPx8lQ7FdE6Ye9/ 8BGA== X-Gm-Message-State: ANoB5pm98w22lBKB4tiSWqXtr+aVGUEWqRQqvTrCRL5rF7ZSk1XX7FZo 2DpFznKO3Ogqtf0bO5DqcQToaC3K5GA= X-Google-Smtp-Source: AA0mqf6xEZI065hZB3RPYXuI+cWxgANuF/CFoIm7fLawQADrsvdYucVde1h7J3aJXAkBxRAnP1t16A== X-Received: by 2002:a17:902:b20f:b0:188:d4ea:251f with SMTP id t15-20020a170902b20f00b00188d4ea251fmr13775677plr.36.1669068450134; Mon, 21 Nov 2022 14:07:30 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id i15-20020a654d0f000000b0047744510d6bsm5075730pgt.5.2022.11.21.14.07.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Nov 2022 14:07:29 -0800 (PST) X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=casouri@gmail.com; helo=mail-pj1-x1035.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:300313 Archived-At: Sometimes it would be nice for the tree-sitter mode to fallback to the = non-tree-sitter mode, eg, when the buffer is to large. Sh-mode needs = something similar, too, because tree-sitter only supports bash right = now. If the shell is some other shell, the tree-sitter mode should fall = back to the normal sh-mode. Fallback in the above two cases are necessary because users can=E2=80=99t = easily avoid them: currently there is no easy way to make Emacs use = different major modes based on file size, or shell type. (You could use = magic-mode-alist for shell, but that=E2=80=99s not TRT, I think) So I wonder if it=E2=80=99s ok to fall back to another major mode by = simply calling that mode. Yuan=