From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Debugging SMIE for sh-script.el Date: Sun, 05 Sep 2021 19:02:59 -0400 Message-ID: References: <87k0jz9rri.fsf@gmail.com> <04ae9f30-5e65-d7de-501e-92d557ddf84c@gmail.com> <87bl5ad5g4.fsf@gmail.com> <3b4cea5f-c08f-3307-655f-a43185ada5ee@gmail.com> <760e21aa-03ea-fb6c-5625-57493c59e455@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1900"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: help-gnu-emacs@gnu.org To: Nikolay Kudryavtsev Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 06 01:03:38 2021 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 1mN1An-0000FJ-As for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 06 Sep 2021 01:03:37 +0200 Original-Received: from localhost ([::1]:48020 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mN1Al-0005WQ-8k for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 05 Sep 2021 19:03:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59388) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mN1AJ-0005Vz-ET for help-gnu-emacs@gnu.org; Sun, 05 Sep 2021 19:03:07 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:39107) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mN1AF-00083s-Te for help-gnu-emacs@gnu.org; Sun, 05 Sep 2021 19:03:05 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id BD4CA440756; Sun, 5 Sep 2021 19:03:01 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 80C85440751; Sun, 5 Sep 2021 19:03:00 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1630882980; bh=DKYwdex4sdbWDd1rb06dd2YWd2hdrmq1Zx3K+iCmn7s=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=nBb6SNb0d19fPvaGRg/Et/DEuAObfg+9fqQKiHihk5LQIc+PBfJp2qW6RjLqsGxaK AYco4fyJZJtdO8K1LwT3jmZ2YzBwQn/Opzo4IKm8GQDj8J8tf+Zj73X0zjxqhk1Va0 CCX8KHkuicIU4qe1HPpS4m4gZMEzlPAPJMqI+PgGSszE/xcTjjBo4CBlwS+keyNFZk Ejqi8cMFOx/yM0a0ZPa7eElDiRdnAkOIpt1/Eow6tnFwsjoxP6aXaDnIyzqd5ADPOk OufjuFMT/XQUhgsKtvNoUButi3IhG8vwnm0Hv0jYhHIUmpGCTZVYEiGAXGFQsYadX8 p+ZaXsaZ8p4FQ== Original-Received: from milanesa (unknown [104.247.244.135]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 46034120376; Sun, 5 Sep 2021 19:03:00 -0400 (EDT) In-Reply-To: (Nikolay Kudryavtsev's message of "Sun, 5 Sep 2021 21:01:08 +0300") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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.23 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" Xref: news.gmane.io gmane.emacs.help:132912 Archived-At: > I do understand that, but the default (smie-indent-calculate) cycle being > inadequate for the current use case is where we started at. I don't think so. At the beginning the case for continuation lines was handled directly to indent things like /usr/bin/emacs -l foo/bar.el \ toto/titi.el and cat food; /usr/bin/emacs -l foo/bar.el \ toto/titi.el If you remove `sh-smie--indent-continuation` you should see that indeed the above lines are indented as shown. Then some users came and said they didn't like this style and wanted instead continuation lines to be indented without paying attention to the structure of the code on the logical line (which is spread over several lines) and just indent the subsequent lines at a fixed offset from the first line, as in: /usr/bin/emacs -l foo/bar.el \ toto/titi.el That's when `sh-smie--indent-continuation` was added (along with the var `sh-indent-after-continuation`), IIRC. Additionally, the original scheme (which pays attention to the structure of the code) was refined to make sure that continuation lines are indented at least a bit more than the first line, i.e. instead of if grep foo \ files; \ then bar; \ else baz; \ fi we wanted to impose something like: if grep foo \ files; \ then bar; \ else baz; \ fi which is why `sh-smie--indent-continuation` calls `smie-indent-calculate` first, then looks at the result and if it's less deep than "baseline indent + offset" then it forces "baseline indent + offset". Stefan