From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joel Reicher Newsgroups: gmane.emacs.help Subject: Re: Setting up indent-on-type in a treesit based major-mode Date: Mon, 30 Dec 2024 20:30:29 +1100 Message-ID: <86zfkd8qmi.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39942"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: help-gnu-emacs@gnu.org To: Karan Ahlawat Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 30 10:31:21 2024 Return-path: Envelope-to: geh-help-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 1tSC7N-000AF9-6Y for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 30 Dec 2024 10:31:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tSC6s-0008Ic-PN; Mon, 30 Dec 2024 04:30:50 -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 1tSC6m-0008Cl-Oo for help-gnu-emacs@gnu.org; Mon, 30 Dec 2024 04:30:44 -0500 Original-Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tSC6k-0001in-R2 for help-gnu-emacs@gnu.org; Mon, 30 Dec 2024 04:30:44 -0500 Original-Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-21670dce0a7so17493135ad.1 for ; Mon, 30 Dec 2024 01:30:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735551040; x=1736155840; darn=gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=sgteAqaaaRmASqCT7aa1nBL61tEeTksjYL8HJ9QkLjU=; b=bfjo0tngSmu6GjYXpWintpyQ6g6lrLTaADeds37OcOZvqTReu++bujM8loHPLku0ru pH28Um5uNj5DsB8yLw+4uXPb95Eo6vS6fnDvXxa0DGcOCGUwoudwMfV0qFPvphDxlySq OFVmklDKzrkne0egi/vK8wdH091DSgcUsCge1gMv3V0TitJg9Odha3di3eFsFp9noDTj /KfU2ICLCprV7aAeFokR9dFQr+YZ4iKh1UsaxBHEFBHiIJRYJgf0Q4fg3kehTA5gPrB9 quuySNGj2Sj1QICE/eM1rswGnPy6IcqVggGJui/vowJ2631Ta2V8n2ieA9n1Wt9lpztV hCWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735551040; x=1736155840; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=sgteAqaaaRmASqCT7aa1nBL61tEeTksjYL8HJ9QkLjU=; b=QH9en2FQXLcrMemhWCtcJYw2MGQdjG+I/A6ETzf42+s6biwHwr0SyZw2PuneIJikP1 M/byUusHaGKyXMY7uUlzitW8jLmYbZm/2mnotdgMkhCQ9XOyqR1Sw90wsmrVOs5X/Dbq nE9G1JAcKpqbUKPfcTm+3u5M+6D3Y9dsFwXIB8KOPSrX4DsHCZnnZRI+8vm7td1v9ZeR smHIexJ6wnSfDezz6TX5BYRQVxlUz71WBYvBOW4q8BRu5PkGWy/+AF2GaGLl1BMcAZd4 29H7eAIz9aoljnZ2i9EDX29/gDC2W7McT4TbujzwF7BKe0N+3BCERYToi/v3pzXTuCma TLjA== X-Gm-Message-State: AOJu0YwtMJxBNbuup3UiPXpn4WrTg/G25QdTpwkEPOjduCdpueED8E1j oIhvXRg6n9V0C5mCcqQtnDvvNBEz4mF3jIPOw5Dex36d9iMErNN9jBvNqQ== X-Gm-Gg: ASbGnct+KJhC5QXK2roqao+1vrmQzNodABhSSqF4D5/51OTxWj5U4mEpldrFY7Lwc9X qBDF/NvktugYY9Xfmhm3LYG/cioEC7o6Bs0wyFo+WVykraN72C5dmcYFwrs+NEjWHZlSd9PbM2Q a6iJIuN/AJ8m4wrrhEk82OsLydixvowUDWw2QTQfP0r8wSRuUdlW1hJrYm+xEmePp7KDYl4S/tB H5FpNX/O1oIbjL4fOxastMlQjSqQD2PXHLWzwL590ZJdTCL4w6DAufnlCg6WRdVapr14Lyj4n/3 bt0zmYp0W8lt02uoJMIgqWkhy7xMEmtfPuKDJxw3t+d8 X-Google-Smtp-Source: AGHT+IHGldMlMQl8aioF996UMuAyoG6wAT3Jlugl64+xB26CF0Fld66SK3CKT3UoyzHEOf4Tvcgxyw== X-Received: by 2002:a17:902:db0e:b0:215:8695:ef91 with SMTP id d9443c01a7336-219e6e8957amr531071515ad.6.1735551040009; Mon, 30 Dec 2024 01:30:40 -0800 (PST) Original-Received: from LAPTOP-ACR66VVN (139-218-25-158.sta.wbroadband.net.au. [139.218.25.158]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc9cdd9bsm174838585ad.132.2024.12.30.01.30.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Dec 2024 01:30:39 -0800 (PST) In-Reply-To: (Karan Ahlawat's message of "Mon, 21 Oct 2024 00:39:41 +0530") Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=joel.reicher@gmail.com; helo=mail-pl1-x636.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: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:149063 Archived-At: Karan Ahlawat writes: > Today I was using ruby-ts-mode and found out that it can indent > some keywords as soon as they're typed out fully (example, when > inside a case block). I'd love to implement such a feature in > scala-ts-mode, so I looked at the source code, but could not see > anything special it might be doing besides simple treesit indent > setup. > > So, how does it exactly achieve this indent-on-type behavior (I > can see the matcher being called if I set > treesit--indent-verbose to t), and how could I reproduce this in > my own major-mode? ruby-ts-mode is a derived mode, and the parent is ruby-base-mode which has some electric indent stuff. I think that's what you're after? Regards, - Joel