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: Re: Calling another major mode in a major mode body Date: Wed, 23 Nov 2022 10:36:22 -0800 Message-ID: <3FDE8ADA-C67E-4047-816B-9259E8041ED2@gmail.com> References: <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="9045"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Phil Sainty , emacs-devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Nov 23 19:37:22 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 1oxucc-00028M-2t for ged-emacs-devel@m.gmane-mx.org; Wed, 23 Nov 2022 19:37:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oxubn-0006lN-7I; Wed, 23 Nov 2022 13:36:31 -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 1oxubj-0006hl-Cl for emacs-devel@gnu.org; Wed, 23 Nov 2022 13:36:27 -0500 Original-Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oxubh-0000Oc-N7 for emacs-devel@gnu.org; Wed, 23 Nov 2022 13:36:27 -0500 Original-Received: by mail-pj1-x1029.google.com with SMTP id k5so16562311pjo.5 for ; Wed, 23 Nov 2022 10:36:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=jvbSwabSauotmZBafh5vZAPrO654xELgovvSgbXiwPM=; b=Jz9Hu4xua+ZfBgaFiVH7KJ22k4c+ifGOVNMYercW2Tnq3l1ELGFGWNwD66XJcBrO5Q +bNEuEG5QLVA1p5WAQuMq5TXm8MT2zf23sKX9atDWtaeJ2RbJda6vVp0plBRfw7Icetr elAlw+hKLB2UbbTNc2suYKuD4terMVOGFpF+aG7rV/XF1qAXMqxhdaTnqWYa4/o3GCAF jhYhjjFZ0kjM/Na3IKY6xsn2WA60Y03Wl9V5K/RPSh0BJgbxO25KxShIAsFRpVDWnKZ5 3pZo9AB9W7Vgg625thj+4CF8m1GvnF9tOVIaMziGrGiylrqGt755izg45oI3yNT8JnlJ 2q+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jvbSwabSauotmZBafh5vZAPrO654xELgovvSgbXiwPM=; b=2FyohwPfjqySHi15oWm94Yde2eO7Sq7NoXBeuSL4noJTPXynJkK3+ihmivrauqcfEe 02UmFNhYpW6/lGqEOP5IX2pQU2r5NPU6u5eQaowp5RQn57v0Ft4myO7w2XDKIZOAALIH mXlsplJyr4balYEVwnTjXTOmX9/CFFcNXu3i9RBmqnomrtFe+5zmmLbIKWDu3o880dGJ KXmgX6lu+lfltPI6RhyPDJrMN+I3UwOIUNOrRfbEqWHUSUrHrzsAj7pQ5JzYmuFwBLg2 6miNzmBJANtESctMC+EAlkScQJYqR0VvvJjaQRXsLaPsaJWrqe1lvy/rOvnDUKcStMYy ViXw== X-Gm-Message-State: ANoB5pni/K7basP3ScQrenSHcIH8gGX4/dx/p/pTqRoMG74Ul0rDPeE0 NwtWp1x4L4MoS+kaUtqElL4Nc8yRjvXltA== X-Google-Smtp-Source: AA0mqf41/xjQEJH0PBvvirzA8Ph3fL56udhTXat+S4Gu4nN94C1EEJv0GN5K5xqqvmENjG1lc9jHMA== X-Received: by 2002:a17:90a:8d0c:b0:213:1a9f:8d77 with SMTP id c12-20020a17090a8d0c00b002131a9f8d77mr30999907pjo.102.1669228584241; Wed, 23 Nov 2022 10:36:24 -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 a14-20020a170902ecce00b00188fe19e124sm4063687plh.185.2022.11.23.10.36.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Nov 2022 10:36:23 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=casouri@gmail.com; helo=mail-pj1-x1029.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:300405 Archived-At: > On Nov 22, 2022, at 6:46 PM, Stefan Monnier = wrote: >=20 >> Thanks for that detailed explanation :-) >>=20 >> It seems the current mode=E2=80=99s after-hook is ran the very last. = So it might be >> a good place to call the fallback major mode. The call to run-hooks = in >> a major mode invocation command is outside the scope = delay-mode-hooks, so >> simply calling the fallback major mode should be fine? >=20 > I think even cleaner is if the dispatch can happen before we even call > `kill-all-local-variables`. >=20 > That's what `tex-mode` does (tho it gets there in a roundabout way > because I didn't want to change `define-derived-mode`). >=20 >=20 > Stefan >=20 Yes, it=E2=80=99s much cleaner. If we don=E2=80=99t care too much about = using advice in our source. I=E2=80=99ll do that instead. Yuan=