From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Aleksandar Dimitrov Newsgroups: gmane.emacs.bugs Subject: bug#62204: 30.0.50; Feature Request: treesit-major-mode-hook Date: Wed, 15 Mar 2023 12:50:38 +0100 Message-ID: <86cz5adyi9.fsf@aleks.bg> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2917"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.8.14; emacs 30.0.50 To: 62204@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Mar 15 14:11:34 2023 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 1pcQuj-0000Us-Dk for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 15 Mar 2023 14:11:34 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pcQuP-0003lW-Pm; Wed, 15 Mar 2023 09:11:13 -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 1pcQuF-0003kP-2k for bug-gnu-emacs@gnu.org; Wed, 15 Mar 2023 09:11:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pcQuE-0007ay-Q8 for bug-gnu-emacs@gnu.org; Wed, 15 Mar 2023 09:11:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pcQuE-00024v-JI for bug-gnu-emacs@gnu.org; Wed, 15 Mar 2023 09:11:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Aleksandar Dimitrov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 15 Mar 2023 13:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62204 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16788858427957 (code B ref -1); Wed, 15 Mar 2023 13:11:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 15 Mar 2023 13:10:42 +0000 Original-Received: from localhost ([127.0.0.1]:39384 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcQtt-00024H-EK for submit@debbugs.gnu.org; Wed, 15 Mar 2023 09:10:41 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:44176) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcPeY-0008FA-Ij for submit@debbugs.gnu.org; Wed, 15 Mar 2023 07:50:47 -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 1pcPeY-00029b-Bv for bug-gnu-emacs@gnu.org; Wed, 15 Mar 2023 07:50:46 -0400 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pcPeW-0004s0-2m for bug-gnu-emacs@gnu.org; Wed, 15 Mar 2023 07:50:46 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 27A695C0846 for ; Wed, 15 Mar 2023 07:50:41 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 15 Mar 2023 07:50:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aleks.bg; h=cc :content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to; s=fm3; t=1678881041; x=1678967441; bh=Hs6af7AXixDJ3j+Mo5546XuTG I4ENEGL5qSOvBDeOH0=; b=vPWtjLFM/fq6r+Lkbx77PMi6ZxDq5q8vrY8ojGrY8 tt2OJmDN7RqNTHWH1GMkqE3Q8QC+oO1XNv2hIkpKt5njQZY3yasKSfMQB8B0umLx kA1QYT33itBlWYD2VclxUWuSuww4toHq48+rYzDaw0oqtdmLO6psfJl9t7OF8ciW yyJ0WJnpKHpLMXMz9vWvWhUcLTmv4QQonvHCFCmBsuZwcuo+sDIQQaNOAfDy9xkQ 9cFOrPNtzJ0qdxzJRp1gcmqMd6yYxuK46Bz96ibkm5tZE64T9fqTTtnFRW7cDXeo sPbPvV1JjJOn+1YmvYVBOPWA5mdhXdGRhpOZslCp4BCYA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1678881041; x=1678967441; bh=Hs6af7AXixDJ3j+Mo5546XuTGI4ENEGL5qS OvBDeOH0=; b=hRCywCHhdSaPzeC0X0QjV7jG6w6JTEea72eqdEy0uHLRislsDue LCW2OrcVCxm31CcE2IeyX9c8J1uLP5Rh2kaYxpDs4XSVb16/OFv6kzyo4zMvau0W C/UGaq/+PpB7ukWyUXrRZqwqB0SJvkT2XZXNuSMSOgiQ2GzsFYT6bmwv2y0leprZ fhzEPetDzYl25ZXnG5auFs9jzIlzuepSTI3PqWqy+4OIWPZIgFg/8tVRJj6Rtdmo 7MODfQ+bOt+xzlIr41Z51J9ByDLPRSr3YCrahoNFPfc/AGrHwDvzj2up+pE4YQbz tcs9JY4WkJvmIpXj0upqWZsrKZzHk0weJ/g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvddvkedgfeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpegfhffvufffkfggtgesthdtredttd ertdenucfhrhhomheptehlvghkshgrnhgurghrucffihhmihhtrhhovhcuoegtohguvges rghlvghkshdrsghgqeenucggtffrrghtthgvrhhnpeegfeehgfejhfetteehffelvedvge ejhffgtddvveeugeeivdduteetveffhfdugeenucffohhmrghinhepghhithhhuhgsrdgt ohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheptg houggvsegrlhgvkhhsrdgsgh X-ME-Proxy: Feedback-ID: i015146a0:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 15 Mar 2023 07:50:40 -0400 (EDT) Received-SPF: pass client-ip=66.111.4.29; envelope-from=code@aleks.bg; helo=out5-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 15 Mar 2023 09:10:40 -0400 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:257958 Archived-At: I'd like to propose a major mode hook that is called every time any treesit-based major mode is enabled. My use case is this: I'd like to extend the expand-region.el package so that it can make use of treesit to set the region to any treesit node. This should work in all treesit-based major modes. Currently, I've found two ways to accomplish loading my functionality for all ts-modes: - enumerate them all and use their respective hooks - advise something like `treesit-major-mode-setup` to execute my code The first idea might miss a mode if Emacs decides to add one down the line, or if the user defines her own ts-mode. The second idea does not feel idiomatic, as this sort of functionality is usually covered by hooks. I'd imagine there are other use cases for minor modes and other functionality that we'd like to provide to any ts-based mode, not just particular ones. The concrete use-case is exemplified here: https://github.com/magnars/expand-region.el/pull/279/