From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#53817: 28.0.91; sh-mode indent misses on 'if test; then' when 'then' is on 'if' line Date: Sun, 06 Feb 2022 19:11:23 -0500 Message-ID: References: <87czk0zk43.fsf@maxeygroup.tech> <87y22n367a.fsf@gnus.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33221"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Doug Maxey , 53817@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 07 01:13:29 2022 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 1nGreq-0008Pl-Ln for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 07 Feb 2022 01:13:28 +0100 Original-Received: from localhost ([::1]:46078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGrep-0007pT-01 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 06 Feb 2022 19:13:27 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:49484) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGrdS-0007B6-QU for bug-gnu-emacs@gnu.org; Sun, 06 Feb 2022 19:12:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46414) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nGrdS-0001ag-Gx for bug-gnu-emacs@gnu.org; Sun, 06 Feb 2022 19:12:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nGrdS-0002TV-Cl for bug-gnu-emacs@gnu.org; Sun, 06 Feb 2022 19:12:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 07 Feb 2022 00:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53817 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 53817-submit@debbugs.gnu.org id=B53817.16441927099478 (code B ref 53817); Mon, 07 Feb 2022 00:12:02 +0000 Original-Received: (at 53817) by debbugs.gnu.org; 7 Feb 2022 00:11:49 +0000 Original-Received: from localhost ([127.0.0.1]:40305 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nGrdE-0002So-PO for submit@debbugs.gnu.org; Sun, 06 Feb 2022 19:11:49 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:23042) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nGrcy-0002SK-Ik for 53817@debbugs.gnu.org; Sun, 06 Feb 2022 19:11:47 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 81858100189; Sun, 6 Feb 2022 19:11:26 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 0F90110000D; Sun, 6 Feb 2022 19:11:25 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1644192685; bh=ok9TCPBZVuBDf2Sr9/AgUVUE+cRntmsLtlInFIek76k=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=TWYBKJ2cTM36JgDCBs7WPPOOxc5GhcYvKNFriol+z4h4uaoA4ORNlKARgbDz4q/Nc wwUX5oF22xEvS8giALuKXw7yhj2nqIkbasz7T3rKPXsp+Mo2iVu0AAQ2cE1KKjXr9E LZ0QighfEqQbBLr5eBJgaLswSSycpiVK/3D0Stdd8UKOx1oonHvVEl7pv4tifjh+R9 XnzQ7y4pxoe3AHccywp/cf868M79tQR/AkrqSqREp0/YaxlmY04XiD9E/bb3Hj6x6z KRreS+7+LBD51vOIOBVyN2OuQr66cYUTBMpK+IQj9Iuuimi1OajYJv/7gRWBgylIu2 DLTBuh4rR/mfw== Original-Received: from ceviche (76-10-138-212.dsl.teksavvy.com [76.10.138.212]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id AB19A120315; Sun, 6 Feb 2022 19:11:24 -0500 (EST) In-Reply-To: <87y22n367a.fsf@gnus.org> (Lars Ingebrigtsen's message of "Mon, 07 Feb 2022 00:50:49 +0100") 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" Xref: news.gmane.io gmane.emacs.bugs:226196 Archived-At: > (defun sh-smie--default-backward-token () > [...] > (progn (skip-syntax-backward ".w_'") > (or (not (zerop (skip-syntax-backward "\\"))) > (when (eq ?\\ (char-before (1- (point)))) > > Semi-colons have punctuation syntax, so we're skipping back over the > entirety of "test;then" instead of stopping after "then". We should indeed only skip over "then", and then only over ";" and then only over "test". > This looks easy enough to fix, but the overall logic of that function is > somewhat obscure to me, so I've added Stefan to the comments; perhaps he > has some comments. The sh syntax is fairly nasty to parse, especially backwards, so I can't give you any general comment here. I'd try something and then see if it breaks any tests (including looking at test/manual/indent/shell.sh). For sure, I'd recommend adding a regression test. Stefan