From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#68246: 30.0.50; Add non-TS mode as extra parent of TS modes Date: Mon, 15 Jan 2024 23:11:54 +0000 Message-ID: References: <831qavvcbo.fsf@gnu.org> <83a5phskd5.fsf@gnu.org> <83h6joqz0t.fsf@gnu.org> <834jfoq86m.fsf@gnu.org> <831qarrbjx.fsf@gnu.org> <87a5p84nlh.fsf@gmail.com> <83edekfldq.fsf@gnu.org> Mime-Version: 1.0 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="38046"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 68246@debbugs.gnu.org, Eli Zaretskii , casouri@gmail.com, Stefan Kangas , monnier@iro.umontreal.ca To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jan 16 00:13:19 2024 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 1rPW8s-0009iP-BS for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 16 Jan 2024 00:13:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rPW8e-0005lQ-A7; Mon, 15 Jan 2024 18:13:04 -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 1rPW8d-0005lI-8B for bug-gnu-emacs@gnu.org; Mon, 15 Jan 2024 18:13:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rPW8c-0007ue-Vv for bug-gnu-emacs@gnu.org; Mon, 15 Jan 2024 18:13:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rPW8c-0002Kv-Hk for bug-gnu-emacs@gnu.org; Mon, 15 Jan 2024 18:13:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 Jan 2024 23:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68246 X-GNU-PR-Package: emacs Original-Received: via spool by 68246-submit@debbugs.gnu.org id=B68246.17053603358917 (code B ref 68246); Mon, 15 Jan 2024 23:13:02 +0000 Original-Received: (at 68246) by debbugs.gnu.org; 15 Jan 2024 23:12:15 +0000 Original-Received: from localhost ([127.0.0.1]:47249 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rPW7r-0002Jk-3B for submit@debbugs.gnu.org; Mon, 15 Jan 2024 18:12:15 -0500 Original-Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]:49267) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rPW7o-0002JX-EP for 68246@debbugs.gnu.org; Mon, 15 Jan 2024 18:12:13 -0500 Original-Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2cd880ceaf2so51318481fa.2 for <68246@debbugs.gnu.org>; Mon, 15 Jan 2024 15:12:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705360326; x=1705965126; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=V8tP1/XLGKv1Tbra/8yoe7FpHvEV0dB8La/+HOQn8hI=; b=BhBXsN9PRGpVsTO1cRu4wUwCRhtjsJUuCEg5LDIIeri9R3ID/cnXIPNU0E9WKV+GBw vOETGSpgMT5HKWb46tt08AdtWoKZ0eHRhWQtojjinJKTv/h2CEYqkpfdCdQVoDtSBL0l 6XXG7Dv+UFF0KO1b72jdOY1XzL52CA/x3NuX5YYNYoXWMYK8iw24g5PYH73zg5Rnnb+5 X75mhRtGfwbCkGK6Hyij4Y3xxhO/cCoNU1FrLD4C7pCM1VvDu5gOYniTyBPG6yk89JTz 7d+5bofrIihobxICjqz0HRkXx0HkwD78aB6ss15kRFmGbbvl+EvCe/JGu3o6Mcifm7tX SaZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705360326; x=1705965126; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V8tP1/XLGKv1Tbra/8yoe7FpHvEV0dB8La/+HOQn8hI=; b=XXl8uQ/8/CAzbn4gjn/tcm4967hp41pVEYddql38CIDSAbUmEs5ycN6mPWvv9U2iAG 9GUBi8JY0VClPfhVsvowhHFEV4U6dBfZnAhhvG14E/qWa5icq9P0MR2kSQUgIigvUfsL Pv7M0QDsRLLEkXtNWiJIrbFHx/a4KXzIX7k0ZGXxCFZTAeXxPc8+56HXVgCcH6wJ2d9B VEnUXHMF90J/OEslMICtDL/OVVqXDoVhAlVPca4tEVBWJM+jpeiG00FZeL031gdhuacp mrkOsRAcgKi7pnQSItCFsSEBTT/VBpJsq6CVzwhAkuw2nvq/21UZukHrUfKDW2dvt+i3 OgcQ== X-Gm-Message-State: AOJu0YzNKs1CSNwnbzaxtkKVUdF3rcIeCy33FvNlSHosy7LSTZrHQFKN gabFG3G0dEmWpO2uXr7xz5zCRW6gctKV7+APwtQ= X-Google-Smtp-Source: AGHT+IHOpVtz342Fb1Xw7hCy5bmb7ac4CCT+k77LmmL738thpByYMW9E51oQkP6BLK4a0MgNEkso9GLAP8IfpVV9Ht0= X-Received: by 2002:a2e:9b91:0:b0:2cd:1ca6:87c0 with SMTP id z17-20020a2e9b91000000b002cd1ca687c0mr2798353lji.23.1705360326082; Mon, 15 Jan 2024 15:12:06 -0800 (PST) In-Reply-To: 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:278310 Archived-At: On Mon, Jan 15, 2024 at 8:51=E2=80=AFPM Dmitry Gutov wro= te: > > I don't think there's anything magical about a base mode. But I like y= our > > solution too. > > As "magical", I meant the original patch for this report. I wouldn't > mind the "base mode" approach, but I guess its still suffers from not > being suitable for using with earlier Emacs versions. > > And every programming mode will have to come with -base-mode defined, We could define them all in batch in a macro, that's not too bad. And then let the existing fleshed out ones overwrite those definitions by making sure to load them later. The main advantages of the foo-base-mode approach is that: * it is easily grokkable by everybody, as it is very simply based on simple inheritance, which everybody knows already. * there's already a fair number of such modes in the tree. But I do like your patch better, it seems pretty useful to introduce the language concept, as it solves this and more problems more cleanly. So let's see where that goes. > This choice is coupled with the corresponding logic in 'buffer-language' > (whether to keep the replace-regexp-in-string branch). Yes. I think we should err on the side on convenience. What exactly are the defects can we get? I can't see anything else but the tuareg-mode, and= we can plug that on our side. Maybe you can see more. > Are there specific uses for get-mode-for-language when there is no > existing buffer? Yes, I'd say this markdown-mode use is exactly that. Markdown inserts some text into a buffer and all it knows is the language it's supposed to fontify it with. The major mode has that logic, so it must invoke the correct (and preferred) major-mode function. Another use is allowing the user to choose major modes for languages, say from a tutorial or wizard or at Emacs startup. Say, I prefer ruby-ts-mode for Ruby, but c++-mode for C++. It'd be helpful to summarize those preferences. > We could have both functions: buffer-language and get-language-for-mode > ('get-mode-language'?). Or define one initially and add the other as need= ed. Yes. buffer-language isn't bad, it's a useful helper. But buffer-language should be just (with-current-buffer buffer (get-language-for-mode major-mode)) Right? Modulo some caching if it turns out to be very inneficient (which I really doubt) Jo=C3=A3o