From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Tree sitter: Should *-ts-modes derive from a common base? Date: Wed, 22 Mar 2023 09:32:19 +0200 Message-ID: <6b7d4ada-573f-7847-752a-097f6ac53b8a@yandex.ru> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6233"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 To: Phil Sainty , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Mar 22 08:32:55 2023 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 1pesxq-0001Ts-Q9 for ged-emacs-devel@m.gmane-mx.org; Wed, 22 Mar 2023 08:32:54 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pesxO-0002XK-Ry; Wed, 22 Mar 2023 03:32:26 -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 1pesxN-0002X1-Hc for emacs-devel@gnu.org; Wed, 22 Mar 2023 03:32:25 -0400 Original-Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pesxL-0002gN-N1 for emacs-devel@gnu.org; Wed, 22 Mar 2023 03:32:25 -0400 Original-Received: by mail-wm1-x32d.google.com with SMTP id p13-20020a05600c358d00b003ed346d4522so10806478wmq.2 for ; Wed, 22 Mar 2023 00:32:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679470342; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=MPdliamvS8YW3hwBDJpU1REAIY3qT12c6oXvamcrm38=; b=PrfNMqkiqwYO+8++MdCtwOXLLv+c7cJ4k0ixpoyzn/+Tn5svScsbdvoIUb8tly0GmC axoCoqfoHmnsqE8to3s5IG79Q2dbOic6/nJkDJHcNJVduGVDRXYf/4aPwU7CKNgO3cqm WAvRVJIltZqScIhsVCl9knJ2crYVnqhQGnsJhMCTxFtRq1PNzzgq5TMRGXRkKq8/cOTt qCTIje2CtBRwEqJwXW+XenHb/bk4HGxVof5c1mj5a4U/pAN60ymI2UNDdaf/+iTtbWvd n3qmYAIHx7xyqcmRdbbsuu3Pa6UV5aMHUeS+lVspzPJa71EEEg00aT2HItybejn+LZ2Z PEVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679470342; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=MPdliamvS8YW3hwBDJpU1REAIY3qT12c6oXvamcrm38=; b=n/e6qSI4HwO1sS2tso8Ft77oXqC8zGZfgBzAcglw28Peqy7VsfwSc3/Qc/TR8Y6CF5 p13tm3WrSfIimGcltcKlvLrV3aARQnUvvsE+aCU8yM4zhUZmEbdjzdWnZKSDZX1WVH7L TKXYdGWgV6vdHUQJ5aOOlmFg3hYA1nnccxhzDmpkx9svptLds2up2FZ0cRueFVEJMX6s xP1uNwY8QaDUkwx5CI/euonSPtQ6kcHZ05QZ+JEQGIldrCARErzVBbPMQ2EjRmn/I2Ou RCvBhubqmPanBpqaHRgyQOnzoGpEnzcp7TFmN2P3X9U9SBFlRSQ5O5Q/PISyk8K6v7Kg c1tw== X-Gm-Message-State: AO0yUKVKb3IMsr7WujyCAuIMqs0sHxom43Xy/a/C9h/t7CZgOzmm+etV W1w9hFk35tr7M8GpH5AmeHfiCJbMCYhjAg== X-Google-Smtp-Source: AK7set/fFojAKeemGzNxGJe55j0dc2E2FnFdqGTdFZm9J2jknYopsKnc4rDp9FCU6pfM5/r4oueuaQ== X-Received: by 2002:a1c:6a04:0:b0:3ee:392:39e3 with SMTP id f4-20020a1c6a04000000b003ee039239e3mr4054665wmc.30.1679470341681; Wed, 22 Mar 2023 00:32:21 -0700 (PDT) Original-Received: from [192.168.0.2] ([85.132.229.92]) by smtp.googlemail.com with ESMTPSA id l22-20020a05600c1d1600b003ee17ff73d3sm6257427wms.46.2023.03.22.00.32.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Mar 2023 00:32:21 -0700 (PDT) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=raaahh@gmail.com; helo=mail-wm1-x32d.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:304693 Archived-At: On 21/03/2023 11:30, Phil Sainty wrote: > The case I've spotted thus far which wouldn't work is the CSS modes, > where we have this: > > (define-derived-mode css-base-mode prog-mode "CSS" > (define-derived-mode css-mode css-base-mode "CSS" > (define-derived-mode css-ts-mode css-base-mode "CSS" > > That could be refactored if this idea was a sensible one. How would you refactor it? We don't have multiple inheritance. > Apologies if this has been discussed before... it seems like > something which might have come up, but I couldn't find anything > relevant.  I'm not across the tree-sitter work in general though, > and maybe this is a bad idea for some reason. There's been a bunch of discussions on the bug tracker, and at least one where the participants landed on the xxx-base-mode design. I don't have the bug number at hand, though.