From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#66466: [PATCH] Support lua-ts-mode in align.el Date: Thu, 12 Oct 2023 10:36:23 +0200 Message-ID: References: <87bkd5oyoj.fsf@pub.pink> Reply-To: Eshel Yaron Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18785"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 66466@debbugs.gnu.org, john muhl To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 12 10:37:03 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 1qqrBm-0004ez-Va for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 12 Oct 2023 10:37:02 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qqrBR-0008JV-Vs; Thu, 12 Oct 2023 04:36:42 -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 1qqrBQ-0008JA-Fr for bug-gnu-emacs@gnu.org; Thu, 12 Oct 2023 04:36:40 -0400 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 1qqrBQ-0002xn-73 for bug-gnu-emacs@gnu.org; Thu, 12 Oct 2023 04:36:40 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qqrBl-0004bc-Rg for bug-gnu-emacs@gnu.org; Thu, 12 Oct 2023 04:37:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eshel Yaron Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 12 Oct 2023 08:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66466 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 66466-submit@debbugs.gnu.org id=B66466.169709981117448 (code B ref 66466); Thu, 12 Oct 2023 08:37:01 +0000 Original-Received: (at 66466) by debbugs.gnu.org; 12 Oct 2023 08:36:51 +0000 Original-Received: from localhost ([127.0.0.1]:40596 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qqrBb-0004XI-4Q for submit@debbugs.gnu.org; Thu, 12 Oct 2023 04:36:51 -0400 Original-Received: from mail.eshelyaron.com ([107.175.124.16]:34076 helo=eshelyaron.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qqrBX-0004X4-Vz for 66466@debbugs.gnu.org; Thu, 12 Oct 2023 04:36:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1697099785; bh=dKPP7b/xgRHC8F9NEnsADX3XOFqNZBr4vGhv3SXUz9E=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=mTm+yKYaOnmhPw65BUCM53EARAieFYeibQ8twmloha9hscrqKNVbrIGQl2cINWr0h vz+8V7zYAo9ndsaAnWPWgirf2bys99dZZmu3zzRipG7r4BeTUxUOnoV/1YXrHvx8mR i0x46s4I8OXhgHbzao3W682ZPN/Y6I40cm6UpgRTm6WzwPBNwpax4RiKAUWsgKc0o9 b9XGyQAfBvs7hnxH1NoRYomnR68yozpa2S7opYIUesvG/uXJvgNiLepYfzfXjfhG+F ghBdCtuXGS6HeIuXsVzlEqpVdVzF/awHdViGLWKG14gxcftqDCl7oj1Fq7RJIcGGO7 0P1zCR6VeiU7w== In-Reply-To: (Stefan Kangas's message of "Thu, 12 Oct 2023 07:35:36 +0000") 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:272285 Archived-At: Hi, Stefan Kangas writes: > john muhl via "Bug reports for GNU Emacs, the Swiss army knife of text > editors" writes: > >> Add support for using align in Lua files. > > nThanks. > >> diff --git a/lisp/align.el b/lisp/align.el >> index a286addb51f..e6e62ce5726 100644 >> --- a/lisp/align.el >> +++ b/lisp/align.el >> @@ -577,7 +577,23 @@ align-rules-list >> "=" >> (group (zero-or-more (syntax whitespace))))) >> (group . (1 2)) >> - (modes . '(conf-toml-mode toml-ts-mode)))) >> + (modes . '(conf-toml-mode toml-ts-mode))) >> + >> + (lua-assignment >> + (regexp . ,(concat "\\(?:^\\(?:\\s-*\\(?:local\\s-+\\)?\\(?:[,<>_]" >> + "\\|\\w\\)+\\)+\\(\\s-*\\)=\\(\\s-*\\)\\)")) >> + (group . (1 2)) >> + (modes . '(lua-ts-mode)) >> + (tab-stop . nil)) >> + >> + (lua-comment >> + (regexp . "\\(?:\\(\\s-*\\)--.*\\)") >> + (modes . '(lua-ts-mode)) >> + (column . comment-column) >> + (valid . ,(lambda () >> + (save-excursion >> + (goto-char (match-beginning 1)) >> + (not (bolp))))))) > > Should `lua-mode' also be in `modes'? Another option would be for `lua-ts-mode` to define `align-mode-rules-list` locally, instead of extending `align-rules-list` globally. Also, I noticed that we already have several similar rules for aligning assignments and comments in `align-rules-list`. Do none of them work for Lua? If so, I wonder what specifics of Lua's syntax make the existing rules inapplicable. Maybe one of the existing rules can be extended instead. Best, Eshel