From unknown Sun Jun 15 08:57:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16116: 24.3.50; smie-indent-close aligns inner closing paren with the outer opening paren Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 12 Dec 2013 01:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16116 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 16116@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13868134513296 (code B ref -1); Thu, 12 Dec 2013 01:58:02 +0000 Received: (at submit) by debbugs.gnu.org; 12 Dec 2013 01:57:31 +0000 Received: from localhost ([127.0.0.1]:44505 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VqvWt-0000r5-0r for submit@debbugs.gnu.org; Wed, 11 Dec 2013 20:57:31 -0500 Received: from eggs.gnu.org ([208.118.235.92]:39903) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VqvWq-0000qx-Eq for submit@debbugs.gnu.org; Wed, 11 Dec 2013 20:57:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VqvWk-0006i4-8l for submit@debbugs.gnu.org; Wed, 11 Dec 2013 20:57:28 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:41272) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqvWk-0006i0-5I for submit@debbugs.gnu.org; Wed, 11 Dec 2013 20:57:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqvWe-00046X-7f for bug-gnu-emacs@gnu.org; Wed, 11 Dec 2013 20:57:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VqvWY-0006cM-Cd for bug-gnu-emacs@gnu.org; Wed, 11 Dec 2013 20:57:16 -0500 Received: from mail-ea0-x232.google.com ([2a00:1450:4013:c01::232]:54232) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqvWY-0006cI-5Y for bug-gnu-emacs@gnu.org; Wed, 11 Dec 2013 20:57:10 -0500 Received: by mail-ea0-f178.google.com with SMTP id d10so3225525eaj.37 for ; Wed, 11 Dec 2013 17:57:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:mime-version:content-type; bh=/scbkl1cqoopjwn4nUCFuEnYsmOp2bIk5XkyFVhEh9E=; b=V/aiS3IxnQiHf5B4QB3oFgRc7F8MPrvb9QWTYLnPwWEFUS3GYitP5xgpgej2Mie5e6 xhvVNjbmKh0vVyNqhy4rfmeTQWdajxklO4vMVilDmK/Go8W8pMjYDUOGlVLoDZ14vWug XM7dMm/O8DYokznrCsdjwT0pYVhylCCR5kJQOp1ZBxu4KmnC6kDabvXQeFqM34dAIH+W h36F6tjthA51LgB2BlK1B7O9Gd5kvNVUPx0UIV5ZHXMvMA1AItIeI5vQbezLGzy7kpjj oHbRGTvkfD3OW+mXZ8rq7ID6Q124Z2Rvo6NYaK/Q7T1DP0ZbAHbbS7A7Iwcdwa/jf6kS 0Kkg== X-Received: by 10.15.61.134 with SMTP id i6mr4861151eex.48.1386813428923; Wed, 11 Dec 2013 17:57:08 -0800 (PST) Received: from axl (213-241-09.netrun.cytanet.com.cy. [213.7.241.9]) by mx.google.com with ESMTPSA id g47sm60113049eeo.19.2013.12.11.17.57.07 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 11 Dec 2013 17:57:08 -0800 (PST) From: Dmitry Gutov Date: Thu, 12 Dec 2013 03:57:01 +0200 Message-ID: <87sity96he.fsf@yandex.ru> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Try this example with ruby-mode: foo( a, b => [ 1, 3, 4 ], c => [ 5, 6 ]) Currently, it will indent the last line to the 0th column, which doesn't look right to me. The following patch fixes that. Would it be all right to install it? === modified file 'lisp/emacs-lisp/smie.el' --- lisp/emacs-lisp/smie.el 2013-11-04 20:45:36 +0000 +++ lisp/emacs-lisp/smie.el 2013-12-12 01:39:59 +0000 @@ -1423,8 +1423,7 @@ (save-excursion ;; (forward-comment (point-max)) (when (looking-at "\\s)") - (while (not (zerop (skip-syntax-forward ")"))) - (skip-chars-forward " \t")) + (forward-char 1) (condition-case nil (progn (backward-sexp 1) In GNU Emacs 24.3.50.8 (x86_64-unknown-linux-gnu, GTK+ Version 3.8.6) of 2013-12-09 on axl Bzr revision: 115440 dmantipov@yandex.ru-20131209163052-oess75ps2o5tt61q Windowing system distributor `The X.Org Foundation', version 11.0.11403000 System Description: Ubuntu 13.10 From unknown Sun Jun 15 08:57:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16116: 24.3.50; smie-indent-close aligns inner closing paren with the outer opening paren Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 12 Dec 2013 12:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16116 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Dmitry Gutov Cc: 16116@debbugs.gnu.org Received: via spool by 16116-submit@debbugs.gnu.org id=B16116.138685292511404 (code B ref 16116); Thu, 12 Dec 2013 12:56:01 +0000 Received: (at 16116) by debbugs.gnu.org; 12 Dec 2013 12:55:25 +0000 Received: from localhost ([127.0.0.1]:44924 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vr5nY-0002xr-D3 for submit@debbugs.gnu.org; Thu, 12 Dec 2013 07:55:24 -0500 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:44211) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vr5nU-0002xh-7r for 16116@debbugs.gnu.org; Thu, 12 Dec 2013 07:55:21 -0500 Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id rBCCtHAs020511; Thu, 12 Dec 2013 07:55:18 -0500 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 6B85BAE25E; Thu, 12 Dec 2013 07:55:15 -0500 (EST) From: Stefan Monnier Message-ID: References: <87sity96he.fsf@yandex.ru> Date: Thu, 12 Dec 2013 07:55:15 -0500 In-Reply-To: <87sity96he.fsf@yandex.ru> (Dmitry Gutov's message of "Thu, 12 Dec 2013 03:57:01 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Level: X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0.2 X-NAI-Spam-Rules: 2 Rules triggered GEN_SPAM_FEATRE=0.2, RV4789=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4789> : inlines <313> : streams <1089601> : uri <1621805> X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.3 (-) > Currently, it will indent the last line to the 0th column, which doesn't > look right to me. Well, it does look right to me, because that line closes the whole construct. Stefan From unknown Sun Jun 15 08:57:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16116: 24.3.50; smie-indent-close aligns inner closing paren with the outer opening paren Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 12 Dec 2013 16:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16116 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Monnier Cc: 16116@debbugs.gnu.org Received: via spool by 16116-submit@debbugs.gnu.org id=B16116.1386865850843 (code B ref 16116); Thu, 12 Dec 2013 16:31:01 +0000 Received: (at 16116) by debbugs.gnu.org; 12 Dec 2013 16:30:50 +0000 Received: from localhost ([127.0.0.1]:45925 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vr99z-0000DR-Mz for submit@debbugs.gnu.org; Thu, 12 Dec 2013 11:30:48 -0500 Received: from mail-bk0-f53.google.com ([209.85.214.53]:45369) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vr99v-0000DD-V7 for 16116@debbugs.gnu.org; Thu, 12 Dec 2013 11:30:44 -0500 Received: by mail-bk0-f53.google.com with SMTP id na10so960011bkb.26 for <16116@debbugs.gnu.org>; Thu, 12 Dec 2013 08:30:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=LAqByYQ8SPqpFugppTxWpeHeU2DHDuHwJgYJWPyYY/Q=; b=Tw/6NABo0VTn3O18BULGUoqTcBfi/b1n5XnDR4+skUJFG/wpY8nB5e5W0JFBEUqSw2 1z+ojZVGKFUq0DknSoM4MuQX3cfYItDfWAqdU0BFCjGmd73IMO17ObRrSgxkm3YiPQwL HPY6h/zu9hzb7FZtxWGZCcrhWh2lAcFxlax2fHzDVa7sdmuILHlrOfWVU63pLERfQuxW Jskom3oCPDEsfdRW6S2LndIo+v8EWv6WNpYilwHXWO4SnJxVN+Y+MCJbmYh3dx26RznA YQVTdPMsgGfe4r1kIiAskmKu7XRRMzcOZ1rCukAPEKs3zFmFmvNzo5cSzwATuyJmBDcr xnoA== X-Received: by 10.205.36.81 with SMTP id sz17mr3076189bkb.29.1386865842946; Thu, 12 Dec 2013 08:30:42 -0800 (PST) Received: from [192.168.10.48] (93-245-142.netrun.cytanet.com.cy. [93.109.245.142]) by mx.google.com with ESMTPSA id xm9sm18792308bkb.1.2013.12.12.08.30.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Dec 2013 08:30:41 -0800 (PST) Message-ID: <52A9E4AF.40006@yandex.ru> Date: Thu, 12 Dec 2013 18:30:39 +0200 From: Dmitry Gutov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 References: <87sity96he.fsf@yandex.ru> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 12.12.2013 14:55, Stefan Monnier wrote: > Well, it does look right to me, because that line closes the whole construct. Here are some arguments on why it's wrong: - It deforms the last array literal and breaks the symmetry with the previous one. - If it emphasizes the fact that the construct is closed, why doesn't it align the opening and closing round parens, and aligns delimiters from different sexps instead? - What about the following example? The last line likewise closes the whole construct, but we don't indent it to the 0th column, right? foo( a, b, c) - Likewise, this example: foo([a, b]) - Indentation functions usually don't care about tokens that go after the first one after indentation. I'm used to that. For example, take js-mode. It handles the initial example differently, but compare this one under both modes: foo([a, b ]) js-mode indents it as I would expect. - If I want to emphasize the closing of the whole construct, I can put the closing paren on a separate line. From unknown Sun Jun 15 08:57:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16116: 24.3.50; smie-indent-close aligns inner closing paren with the outer opening paren References: <87sity96he.fsf@yandex.ru> In-Reply-To: <87sity96he.fsf@yandex.ru> Resent-From: Steve Purcell Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 Dec 2013 08:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16116 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 16116@debbugs.gnu.org Received: via spool by 16116-submit@debbugs.gnu.org id=B16116.13870094059093 (code B ref 16116); Sat, 14 Dec 2013 08:24:02 +0000 Received: (at 16116) by debbugs.gnu.org; 14 Dec 2013 08:23:25 +0000 Received: from localhost ([127.0.0.1]:49178 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VrkVQ-0002Ma-Ih for submit@debbugs.gnu.org; Sat, 14 Dec 2013 03:23:24 -0500 Received: from h1189701.stratoserver.net ([85.214.32.38]:49037) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VrkVN-0002MP-KE for 16116@debbugs.gnu.org; Sat, 14 Dec 2013 03:23:22 -0500 Received: from [192.168.1.112] (host86-153-254-0.range86-153.btcentralplus.com [86.153.254.0]) by h1189701.stratoserver.net (Postfix) with ESMTPSA id 16DBA1118002 for <16116@debbugs.gnu.org>; Sat, 14 Dec 2013 09:23:19 +0100 (CET) From: Steve Purcell Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Message-Id: <6B783955-B72E-4876-BCF2-C864F3D74A62@sanityinc.com> Date: Sat, 14 Dec 2013 08:23:18 +0000 Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1822\)) X-Mailer: Apple Mail (2.1822) X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) I agree strongly with Dmitry here. Column zero is fine if the paren is = on its own, but if there are any preceding characters on the line which = have a different logical indent level, as is the case with =93]=94 here, = the indentation for those should dominate. As another example, in the case of javascript, there=92s the idiomatic = function case: something(function() { =85 blah }); and I don=92t think this is inconsistent with the above: unindenting the = =93}=94 relative to the function body will have the right effect without = even needing to consider the =93)=94. -Steve= From unknown Sun Jun 15 08:57:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16116: 24.3.50; smie-indent-close aligns inner closing paren with the outer opening paren Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 Dec 2013 14:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16116 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Steve Purcell Cc: 16116@debbugs.gnu.org Received: via spool by 16116-submit@debbugs.gnu.org id=B16116.138703039918654 (code B ref 16116); Sat, 14 Dec 2013 14:14:02 +0000 Received: (at 16116) by debbugs.gnu.org; 14 Dec 2013 14:13:19 +0000 Received: from localhost ([127.0.0.1]:49446 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vrpy3-0004qo-00 for submit@debbugs.gnu.org; Sat, 14 Dec 2013 09:13:19 -0500 Received: from chene.dit.umontreal.ca ([132.204.246.20]:50397) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vrpy0-0004qd-Pd for 16116@debbugs.gnu.org; Sat, 14 Dec 2013 09:13:17 -0500 Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id rBEEDCju022629; Sat, 14 Dec 2013 09:13:13 -0500 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 0970FAE358; Sat, 14 Dec 2013 09:13:12 -0500 (EST) From: Stefan Monnier Message-ID: References: <87sity96he.fsf@yandex.ru> <6B783955-B72E-4876-BCF2-C864F3D74A62@sanityinc.com> Date: Sat, 14 Dec 2013 09:13:11 -0500 In-Reply-To: <6B783955-B72E-4876-BCF2-C864F3D74A62@sanityinc.com> (Steve Purcell's message of "Sat, 14 Dec 2013 08:23:18 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Level: X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0.2 X-NAI-Spam-Rules: 2 Rules triggered GEN_SPAM_FEATRE=0.2, RV4792=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4792> : inlines <324> : streams <1090732> : uri <1623765> X-Spam-Score: -1.8 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.8 (-) > I agree strongly with Dmitry here. No need to convince anyone here. I was just pointing out that what is right will depend, so the right fix is to let the rules-function control it, rather than to replace one hard-coded choice with another. Stefan From unknown Sun Jun 15 08:57:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16116: 24.3.50; smie-indent-close aligns inner closing paren with the outer opening paren Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 Dec 2013 15:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16116 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Monnier Cc: 16116@debbugs.gnu.org, Steve Purcell Received: via spool by 16116-submit@debbugs.gnu.org id=B16116.138703350024366 (code B ref 16116); Sat, 14 Dec 2013 15:05:02 +0000 Received: (at 16116) by debbugs.gnu.org; 14 Dec 2013 15:05:00 +0000 Received: from localhost ([127.0.0.1]:50163 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vrqm3-0006Ku-D2 for submit@debbugs.gnu.org; Sat, 14 Dec 2013 10:04:59 -0500 Received: from mail-ea0-f178.google.com ([209.85.215.178]:41618) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vrqm0-0006Kl-Lc for 16116@debbugs.gnu.org; Sat, 14 Dec 2013 10:04:57 -0500 Received: by mail-ea0-f178.google.com with SMTP id d10so1423570eaj.9 for <16116@debbugs.gnu.org>; Sat, 14 Dec 2013 07:04:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=KzExouGUy9XglcXhNnJccz783dDIuwOC5rI0Ztt1rYM=; b=QTrU+Q8vvEqsZYBUcGVhqYv7IyVRa8JBTnkSVbhpisb3KA5HtJ6FVJXjye2xv7eC9+ qS27ye/KiZAs2rkG8QcKW7sU+p5bIptDyaGYY8GRT51Wgi0uAhs3V0QrAnDSY8OkVUJI bzJ2i7G9GXiGDFCAJMOOVqbfG3GjNzuvGdAt0BrVuZ1M758NwSOLE9ShjRyvDJggXaR0 xbdZbriw7v/Cd8kTU1wKekUqkUxRHfsuhpwG8lV87eJYHrKdZ+aYzPeECEf/o9w0zJPr TLix+WHz45b0DUj3qUiAKlWEBeseIVDfIGqtyCcgnmosia4qyM8hbsyvz8it7sbWmxXp ir8g== X-Received: by 10.14.47.130 with SMTP id t2mr8149826eeb.12.1387033495590; Sat, 14 Dec 2013 07:04:55 -0800 (PST) Received: from axl ([83.168.26.131]) by mx.google.com with ESMTPSA id o1sm19405561eea.10.2013.12.14.07.04.53 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 14 Dec 2013 07:04:54 -0800 (PST) From: Dmitry Gutov References: <87sity96he.fsf@yandex.ru> <6B783955-B72E-4876-BCF2-C864F3D74A62@sanityinc.com> Date: Sat, 14 Dec 2013 17:04:47 +0200 In-Reply-To: (Stefan Monnier's message of "Sat, 14 Dec 2013 09:13:11 -0500") Message-ID: <87y53niicw.fsf@yandex.ru> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Stefan Monnier writes: > No need to convince anyone here. I was just pointing out that what is > right will depend Sorry, I didn't get that. > so the right fix is to let the rules-function > control it, rather than to replace one hard-coded choice with another. That won't work. ruby-smie-rules is never called because smie-indent-close doesn't use smie-indent--rule, and it goes before the functions that do in smie-indent-functions. Unless you're suggesting to change either of those points. I thought rather to add a defvar to switch between the two behaviors in smie-indent-close, or make smie-indent-functions buffer-local and replace smie-indent-close there with a modified implementation. Still inclined toward the latter. From unknown Sun Jun 15 08:57:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16116: 24.3.50; smie-indent-close aligns inner closing paren with the outer opening paren Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 Dec 2013 15:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16116 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Dmitry Gutov Cc: 16116@debbugs.gnu.org, Steve Purcell Received: via spool by 16116-submit@debbugs.gnu.org id=B16116.138703517427164 (code B ref 16116); Sat, 14 Dec 2013 15:33:01 +0000 Received: (at 16116) by debbugs.gnu.org; 14 Dec 2013 15:32:54 +0000 Received: from localhost ([127.0.0.1]:50179 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VrrD3-000743-HT for submit@debbugs.gnu.org; Sat, 14 Dec 2013 10:32:53 -0500 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:43967) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VrrCz-00073q-JD for 16116@debbugs.gnu.org; Sat, 14 Dec 2013 10:32:50 -0500 Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.DIT.UMontreal.CA (8.14.1/8.14.1) with ESMTP id rBEFWiFs024061; Sat, 14 Dec 2013 10:32:45 -0500 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id E4A12AE358; Sat, 14 Dec 2013 10:32:43 -0500 (EST) From: Stefan Monnier Message-ID: References: <87sity96he.fsf@yandex.ru> <6B783955-B72E-4876-BCF2-C864F3D74A62@sanityinc.com> <87y53niicw.fsf@yandex.ru> Date: Sat, 14 Dec 2013 10:32:43 -0500 In-Reply-To: <87y53niicw.fsf@yandex.ru> (Dmitry Gutov's message of "Sat, 14 Dec 2013 17:04:47 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4792=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4792> : inlines <324> : streams <1090759> : uri <1623822> X-Spam-Score: -1.8 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.8 (-) > Unless you're suggesting to change either of those points. That's exactly what I'm suggesting, yes. > I thought rather to add a defvar to switch between the two behaviors in > smie-indent-close, That could be acceptable, tho so far all the indentation is controlled by the rules-function, so it makes sense to keep it that way rather than to introduce a variable. Also, if it's done in the rules-function, the function may return different results depending on context. > or make smie-indent-functions buffer-local and replace > smie-indent-close there with a modified implementation. This approach would work if the requirement is very specific to one particular major mode, but in this case, it seems to be a fairly common one. Stefan From unknown Sun Jun 15 08:57:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16116: 24.3.50; smie-indent-close aligns inner closing paren with the outer opening paren Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 Dec 2013 18:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16116 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Monnier Cc: 16116@debbugs.gnu.org, Steve Purcell Received: via spool by 16116-submit@debbugs.gnu.org id=B16116.138704554513226 (code B ref 16116); Sat, 14 Dec 2013 18:26:02 +0000 Received: (at 16116) by debbugs.gnu.org; 14 Dec 2013 18:25:45 +0000 Received: from localhost ([127.0.0.1]:50306 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VrtuK-0003RF-30 for submit@debbugs.gnu.org; Sat, 14 Dec 2013 13:25:44 -0500 Received: from mail-ea0-f180.google.com ([209.85.215.180]:51880) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VrtuF-0003R1-PI for 16116@debbugs.gnu.org; Sat, 14 Dec 2013 13:25:41 -0500 Received: by mail-ea0-f180.google.com with SMTP id f15so1462516eak.39 for <16116@debbugs.gnu.org>; Sat, 14 Dec 2013 10:25:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=9cUMof6gNsTahFUL/AZusIE2tWRqp4/mtEQuwM7ecEE=; b=0PrywKdWwIPxwS2Io4OfrJLu5GkXiSiy9sedpjGuFRyUveBnmv5g3PwaiQVKIGBZdr vmZHWLCCpzlPrqTKvdtxzgcoTa34XGGNmY353yGM6u+NBRxjKadc24g3zdEheoqAFhWB 72h/c5prDHQDwV2z0TZphjBoW7O9P2ibBMm8Rx0mXMDxemC6K1veSvZsBTjFsV6gN6VV t/+mmoi0UQBCYDgUY3ISzHTEQTeoiUcr27a/F8qu3seBYTHqNvj9M2zkzHG8OZ3Eo212 ZR/4a53+0v4GD1ddAH0FGq9K+bKMsPvPQGQzEbMTiq3v4WpmaMH0rX3gI88rTEYLnSeD FLuQ== X-Received: by 10.14.199.197 with SMTP id x45mr8889494een.8.1387045538792; Sat, 14 Dec 2013 10:25:38 -0800 (PST) Received: from axl ([83.168.26.131]) by mx.google.com with ESMTPSA id g7sm21178630eet.12.2013.12.14.10.25.36 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 14 Dec 2013 10:25:38 -0800 (PST) From: Dmitry Gutov References: <87sity96he.fsf@yandex.ru> <6B783955-B72E-4876-BCF2-C864F3D74A62@sanityinc.com> <87y53niicw.fsf@yandex.ru> Date: Sat, 14 Dec 2013 20:25:29 +0200 In-Reply-To: (Stefan Monnier's message of "Sat, 14 Dec 2013 10:32:43 -0500") Message-ID: <87r49fe1d2.fsf@yandex.ru> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Stefan Monnier writes: > That's exactly what I'm suggesting, yes. So, call `smie-indent--rule' from `smie-indent-close'? That should work. >> I thought rather to add a defvar to switch between the two behaviors in >> smie-indent-close, > > That could be acceptable, tho so far all the indentation is controlled > by the rules-function, so it makes sense to keep it that way rather than > to introduce a variable. Maybe so. > Also, if it's done in the rules-function, the > function may return different results depending on context. True, but so far I don't see a situation in Ruby where it'd depend on the context. >> or make smie-indent-functions buffer-local and replace >> smie-indent-close there with a modified implementation. > > This approach would work if the requirement is very specific to one > particular major mode, but in this case, it seems to be a fairly > common one. I believe this argument also works against doing it in the rules function, and in favor of adding a defvar. From unknown Sun Jun 15 08:57:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16116: 24.3.50; smie-indent-close aligns inner closing paren with the outer opening paren Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 15 Dec 2013 01:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16116 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Dmitry Gutov Cc: 16116@debbugs.gnu.org, Steve Purcell Received: via spool by 16116-submit@debbugs.gnu.org id=B16116.138707226432069 (code B ref 16116); Sun, 15 Dec 2013 01:52:02 +0000 Received: (at 16116) by debbugs.gnu.org; 15 Dec 2013 01:51:04 +0000 Received: from localhost ([127.0.0.1]:50514 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vs0rH-0008LA-OP for submit@debbugs.gnu.org; Sat, 14 Dec 2013 20:51:04 -0500 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:34173) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vs0rE-0008Kk-NN for 16116@debbugs.gnu.org; Sat, 14 Dec 2013 20:51:01 -0500 Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.DIT.UMontreal.CA (8.14.1/8.14.1) with ESMTP id rBF1ovkL031202; Sat, 14 Dec 2013 20:50:58 -0500 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 9FEFAAE358; Sat, 14 Dec 2013 20:50:56 -0500 (EST) From: Stefan Monnier Message-ID: References: <87sity96he.fsf@yandex.ru> <6B783955-B72E-4876-BCF2-C864F3D74A62@sanityinc.com> <87y53niicw.fsf@yandex.ru> <87r49fe1d2.fsf@yandex.ru> Date: Sat, 14 Dec 2013 20:50:56 -0500 In-Reply-To: <87r49fe1d2.fsf@yandex.ru> (Dmitry Gutov's message of "Sat, 14 Dec 2013 20:25:29 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4792=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4792> : inlines <324> : streams <1090994> : uri <1624280> X-Spam-Score: -1.8 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.8 (-) >> Also, if it's done in the rules-function, the >> function may return different results depending on context. > True, but so far I don't see a situation in Ruby where it'd depend on > the context. Agreed, but we're talking about a change in smie.el, not in ruby-mode.el ;-) >>> or make smie-indent-functions buffer-local and replace >>> smie-indent-close there with a modified implementation. >> This approach would work if the requirement is very specific to one >> particular major mode, but in this case, it seems to be a fairly >> common one. > I believe this argument also works against doing it in the rules > function, and in favor of adding a defvar. I don't think so: setting the var is a one-liner, adding the rule to the rule-function is also a one-liner. So either way is just as easy for the major-mode. By contrast, setting smie-indent-functions buffer-locally, then removing smie-indent-close from it and adding some other function requires a lot more code, and a lot more brittle as well (the ordering in smie-indent-functions is important, the set of functions in there and their order is not guaranteed to stay unchanged in future versions, the replacement function needs to be written (delegating to smie-indent-close seems like it might not work), ... Stefan From unknown Sun Jun 15 08:57:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16116: 24.3.50; smie-indent-close aligns inner closing paren with the outer opening paren Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 15 Dec 2013 02:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16116 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Monnier Cc: 16116@debbugs.gnu.org, Steve Purcell Received: via spool by 16116-submit@debbugs.gnu.org id=B16116.13870754845197 (code B ref 16116); Sun, 15 Dec 2013 02:45:02 +0000 Received: (at 16116) by debbugs.gnu.org; 15 Dec 2013 02:44:44 +0000 Received: from localhost ([127.0.0.1]:50540 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vs1hD-0001Lk-Qs for submit@debbugs.gnu.org; Sat, 14 Dec 2013 21:44:44 -0500 Received: from mail-ea0-f169.google.com ([209.85.215.169]:48849) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vs1hB-0001Lc-Ey for 16116@debbugs.gnu.org; Sat, 14 Dec 2013 21:44:41 -0500 Received: by mail-ea0-f169.google.com with SMTP id l9so1331822eaj.14 for <16116@debbugs.gnu.org>; Sat, 14 Dec 2013 18:44:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=P4PjnyVxUYkg3xMx+dGKV4a5uEUnfzFi+/LOWO1FJUw=; b=wxmCsVRVl7xpU/IPQi6F1m/IVx+K3pMPBL8ejajMzn4rmWTBDydM+ew2Amy+kEqcqc tc2m3wSfK/6gNMDr8A6RDWP75pEmuG7OHBwMIjWUolQaci7koc6VnvT32idgmw74a1Yz tIhwQnmpzTclFyeugL6KMH8z7hJ5e9hco4o0hl/an4+nItKmZwQyq17juw9yLIrXabEW tfPKKXkGi2oasugsNNPFTZfMdp11HGuP3aRlyKWVpW27rg71HQ3XutO0AK7gFJRVKBF1 41HHyloYOeHEjWBGfjEJWrdBZgV+YHAw2mo7mfdSdzXjXq0hJFORb3ljvhq8K/Jp9KOJ fF9A== X-Received: by 10.14.251.132 with SMTP id b4mr10075091ees.78.1387075480497; Sat, 14 Dec 2013 18:44:40 -0800 (PST) Received: from [192.168.10.2] ([83.168.26.131]) by mx.google.com with ESMTPSA id o47sm24936735eem.21.2013.12.14.18.44.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 14 Dec 2013 18:44:39 -0800 (PST) Message-ID: <52AD1793.50901@yandex.ru> Date: Sun, 15 Dec 2013 04:44:35 +0200 From: Dmitry Gutov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 References: <87sity96he.fsf@yandex.ru> <6B783955-B72E-4876-BCF2-C864F3D74A62@sanityinc.com> <87y53niicw.fsf@yandex.ru> <87r49fe1d2.fsf@yandex.ru> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 15.12.2013 03:50, Stefan Monnier wrote: >> I believe this argument also works against doing it in the rules >> function, and in favor of adding a defvar. > > I don't think so: setting the var is a one-liner, adding the rule to the > rule-function is also a one-liner. So either way is just as easy for > the major-mode. I mean in terms of code reuse: the rules function is also specific to a major mode. The rule itself doesn't look like it'll take just one line to me, AFAICS it'll have to duplicate most of the code in `smie-indent-close': (`(:before . ,(or `")" `"]" `"}")) (save-excursion (forward-char 1) (condition-case nil (progn (backward-sexp 1) (cons 'column . (smie-indent-virtual))) (scan-error nil)))) If any other major mode wants to do the same, they have to duplicate this, or extract this code to a helper function in smie.el. Using the rules function will also add 2-3 lines to `smie-indent-close'. > By contrast, setting smie-indent-functions buffer-locally, then > removing smie-indent-close from it and adding some other function > requires a lot more code, and a lot more brittle as well (the ordering > in smie-indent-functions is important, the set of functions in there and > their order is not guaranteed to stay unchanged in future versions, the > replacement function needs to be written (delegating to > smie-indent-close seems like it might not work), ... Looks like three lines to me. :) (setq-local smie-indent-functions (copy-sequence smie-indent-functions)) (setcar (memq 'smie-indent-close smie-indent-functions) 'ruby--smie-indent-close) And the replacement function wouldn't be much longer than the added rule. From unknown Sun Jun 15 08:57:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16116: 24.3.50; smie-indent-close aligns inner closing paren with the outer opening paren Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 15 Dec 2013 13:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16116 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Dmitry Gutov Cc: 16116@debbugs.gnu.org, Steve Purcell Received: via spool by 16116-submit@debbugs.gnu.org id=B16116.13871124106666 (code B ref 16116); Sun, 15 Dec 2013 13:01:01 +0000 Received: (at 16116) by debbugs.gnu.org; 15 Dec 2013 13:00:10 +0000 Received: from localhost ([127.0.0.1]:50903 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VsBIn-0001jP-QN for submit@debbugs.gnu.org; Sun, 15 Dec 2013 08:00:10 -0500 Received: from chene.dit.umontreal.ca ([132.204.246.20]:56815) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VsBIj-0001iX-8v for 16116@debbugs.gnu.org; Sun, 15 Dec 2013 08:00:06 -0500 Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id rBFD008l029453; Sun, 15 Dec 2013 08:00:01 -0500 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id D3D4EAE358; Sun, 15 Dec 2013 08:00:00 -0500 (EST) From: Stefan Monnier Message-ID: References: <87sity96he.fsf@yandex.ru> <6B783955-B72E-4876-BCF2-C864F3D74A62@sanityinc.com> <87y53niicw.fsf@yandex.ru> <87r49fe1d2.fsf@yandex.ru> <52AD1793.50901@yandex.ru> Date: Sun, 15 Dec 2013 08:00:00 -0500 In-Reply-To: <52AD1793.50901@yandex.ru> (Dmitry Gutov's message of "Sun, 15 Dec 2013 04:44:35 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4793=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4793> : inlines <324> : streams <1091244> : uri <1624676> X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) >>> I believe this argument also works against doing it in the rules >>> function, and in favor of adding a defvar. >> I don't think so: setting the var is a one-liner, adding the rule to the >> rule-function is also a one-liner. So either way is just as easy for >> the major-mode. > I mean in terms of code reuse: the rules function is also specific > to a major mode. The rule itself doesn't look like it'll take just one line > to me, AFAICS it'll have to duplicate most of the code in > smie-indent-close': No, the rule should be something like (`(:close-all . ,_) t) I.e. equivalent to (setq-local smie-indent-close-all t) -- Stefan From unknown Sun Jun 15 08:57:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16116: 24.3.50; smie-indent-close aligns inner closing paren with the outer opening paren Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 15 Dec 2013 23:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16116 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Monnier Cc: 16116@debbugs.gnu.org, Steve Purcell Received: via spool by 16116-submit@debbugs.gnu.org id=B16116.138714974417575 (code B ref 16116); Sun, 15 Dec 2013 23:23:01 +0000 Received: (at 16116) by debbugs.gnu.org; 15 Dec 2013 23:22:24 +0000 Received: from localhost ([127.0.0.1]:52295 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VsL0x-0004ZP-Dr for submit@debbugs.gnu.org; Sun, 15 Dec 2013 18:22:23 -0500 Received: from mail-ea0-f179.google.com ([209.85.215.179]:36598) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VsL0u-0004ZG-TD for 16116@debbugs.gnu.org; Sun, 15 Dec 2013 18:22:21 -0500 Received: by mail-ea0-f179.google.com with SMTP id r15so1902751ead.10 for <16116@debbugs.gnu.org>; Sun, 15 Dec 2013 15:22:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=CnFl7e5ZPr6m/vlRriXYj26eLJtPcar46PHdBsXw4w8=; b=HrBJD4pPwt9QhAh1kLDigzXH7raWuWD0ivKa/0TNgpGWB0NWuqddkqUmuAhw6Xx1Bk wH69pajx2uAjF7lEFPwuA7hG33N6QkwsODN+wG/z1KXSqikzNtnDrsuWR8kK/W40YFA9 OuJj6gUSkxXNmOGw0SB8e+mqaVltUQL7cY15hj5voz7ekD/4IgoeejIMP6IOe0sWwdZo IltPZqUsfvA3LzO/x7e8pigLsTJO+WjgGb278oAxE9k0EjuCOTv7kkXI5kY6cSK45Uu+ aos+PIK1fs+fTMUXMDvEp+6s/SpbGj/UUFfekbc7ixLdmHeRZueVr1rxYFJhE/KGqowS mxOw== X-Received: by 10.15.108.73 with SMTP id cc49mr13683379eeb.93.1387149739998; Sun, 15 Dec 2013 15:22:19 -0800 (PST) Received: from axl ([83.168.26.131]) by mx.google.com with ESMTPSA id v1sm35322329eef.9.2013.12.15.15.22.17 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 15 Dec 2013 15:22:18 -0800 (PST) From: Dmitry Gutov References: <87sity96he.fsf@yandex.ru> <6B783955-B72E-4876-BCF2-C864F3D74A62@sanityinc.com> <87y53niicw.fsf@yandex.ru> <87r49fe1d2.fsf@yandex.ru> <52AD1793.50901@yandex.ru> Date: Mon, 16 Dec 2013 01:22:10 +0200 In-Reply-To: (Stefan Monnier's message of "Sun, 15 Dec 2013 08:00:00 -0500") Message-ID: <87k3f5lmxp.fsf@yandex.ru> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-=-= Content-Type: text/plain Stefan Monnier writes: > No, the rule should be something like > > (`(:close-all . ,_) t) Ah, ok. How does this look to you? Note that it makes the new behavior the default one, because "close all" sounds more fitting to characterize the current behavior ("closing" all sexps ending on the current line). If that's not what you meant, maybe a different method name is in order. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=smie-close-all.diff === modified file 'lisp/emacs-lisp/smie.el' --- lisp/emacs-lisp/smie.el 2013-12-11 15:59:27 +0000 +++ lisp/emacs-lisp/smie.el 2013-12-15 23:09:35 +0000 @@ -1135,6 +1135,10 @@ - :list-intro, in which case ARG is a token and the function should return non-nil if TOKEN is followed by a list of expressions (not separated by any token) rather than an expression. +- :close-all, in which case ARG is a close-paren token at indentation and + the function should return non-nil if it should be aligned with the opener + of the last close-paren token on the same line, if there are multiple. + Otherwise, it will be aligned with its own opener. When ARG is a token, the function is called with point just before that token. A return value of nil always means to fallback on the default behavior, so the @@ -1316,8 +1320,8 @@ (defun smie-indent--rule (method token ;; FIXME: Too many parameters. &optional after parent base-pos) - "Compute indentation column according to `indent-rule-functions'. -METHOD and TOKEN are passed to `indent-rule-functions'. + "Compute indentation column according to `smie-rules-function'. +METHOD and TOKEN are passed to `smie-rules-function'. AFTER is the position after TOKEN, if known. PARENT is the parent info returned by `smie-backward-sexp', if known. BASE-POS is the position relative to which offsets should be applied." @@ -1330,11 +1334,7 @@ ;; - :after tok, where ;; ; after is set; parent=nil; base-pos=point; (save-excursion - (let ((offset - (let ((smie--parent parent) - (smie--token token) - (smie--after after)) - (funcall smie-rules-function method token)))) + (let ((offset (smie-indent--rule-1 method token after parent))) (cond ((not offset) nil) ((eq (car-safe offset) 'column) (cdr offset)) @@ -1355,6 +1355,12 @@ (smie-indent-virtual) (current-column))))) (t (error "Unknown indentation offset %s" offset)))))) +(defun smie-indent--rule-1 (method token &optional after parent) + (let ((smie--parent parent) + (smie--token token) + (smie--after after)) + (funcall smie-rules-function method token))) + (defun smie-indent-forward-token () "Skip token forward and return it, along with its levels." (let ((tok (funcall smie-forward-token-function))) @@ -1423,8 +1429,13 @@ (save-excursion ;; (forward-comment (point-max)) (when (looking-at "\\s)") - (while (not (zerop (skip-syntax-forward ")"))) - (skip-chars-forward " \t")) + (if (smie-indent--rule-1 :close-all + (buffer-substring-no-properties + (point) (1+ (point))) + (1+ (point))) + (while (not (zerop (skip-syntax-forward ")"))) + (skip-chars-forward " \t")) + (forward-char 1)) (condition-case nil (progn (backward-sexp 1) --=-=-=-- From unknown Sun Jun 15 08:57:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16116: 24.3.50; smie-indent-close aligns inner closing paren with the outer opening paren Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 Dec 2013 14:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16116 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Dmitry Gutov Cc: 16116@debbugs.gnu.org, Steve Purcell Received: via spool by 16116-submit@debbugs.gnu.org id=B16116.138720383429205 (code B ref 16116); Mon, 16 Dec 2013 14:24:02 +0000 Received: (at 16116) by debbugs.gnu.org; 16 Dec 2013 14:23:54 +0000 Received: from localhost ([127.0.0.1]:53260 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VsZ5N-0007az-IM for submit@debbugs.gnu.org; Mon, 16 Dec 2013 09:23:53 -0500 Received: from chene.dit.umontreal.ca ([132.204.246.20]:51036) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VsZ5L-0007ar-MJ for 16116@debbugs.gnu.org; Mon, 16 Dec 2013 09:23:52 -0500 Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id rBGENmZp021528; Mon, 16 Dec 2013 09:23:49 -0500 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 6C061AE2BE; Mon, 16 Dec 2013 09:23:49 -0500 (EST) From: Stefan Monnier Message-ID: References: <87sity96he.fsf@yandex.ru> <6B783955-B72E-4876-BCF2-C864F3D74A62@sanityinc.com> <87y53niicw.fsf@yandex.ru> <87r49fe1d2.fsf@yandex.ru> <52AD1793.50901@yandex.ru> <87k3f5lmxp.fsf@yandex.ru> Date: Mon, 16 Dec 2013 09:23:49 -0500 In-Reply-To: <87k3f5lmxp.fsf@yandex.ru> (Dmitry Gutov's message of "Mon, 16 Dec 2013 01:22:10 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4794=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4794> : inlines <327> : streams <1091722> : uri <1625730> X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) > Ah, ok. How does this look to you? I think it's OK. > If that's not what you meant, maybe a different method name is in order. Preserving the old behavior would maybe be better, but ... let's try it as is. Stefan From unknown Sun Jun 15 08:57:19 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Dmitry Gutov Subject: bug#16116: closed (Re: bug#16116: 24.3.50; smie-indent-close aligns inner closing paren with the outer opening paren) Message-ID: References: <52AFBF0E.4000505@yandex.ru> <87sity96he.fsf@yandex.ru> X-Gnu-PR-Message: they-closed 16116 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 16116@debbugs.gnu.org Date: Tue, 17 Dec 2013 03:04:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1387249442-23728-1" This is a multi-part message in MIME format... ------------=_1387249442-23728-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #16116: 24.3.50; smie-indent-close aligns inner closing paren with the oute= r opening paren which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 16116@debbugs.gnu.org. --=20 16116: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D16116 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1387249442-23728-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 16116-done) by debbugs.gnu.org; 17 Dec 2013 03:03:50 +0000 Received: from localhost ([127.0.0.1]:54770 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vskwn-0006AE-QQ for submit@debbugs.gnu.org; Mon, 16 Dec 2013 22:03:50 -0500 Received: from mail-ee0-f46.google.com ([74.125.83.46]:56034) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vskwk-0006A2-Pu for 16116-done@debbugs.gnu.org; Mon, 16 Dec 2013 22:03:47 -0500 Received: by mail-ee0-f46.google.com with SMTP id d49so2531688eek.5 for <16116-done@debbugs.gnu.org>; Mon, 16 Dec 2013 19:03:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=wzl8ree7+ET1UbcOEedWy7NdSMa2xFaljihpkJAJ0Pw=; b=jcfaPmLyoY4rd1a6zIKJl3RovZNbLlPuOLAUduvNMnuGocXk6lJ2WWc4ZLMWbAuDxo cnLllNWT9e8RLsym1ozeK6tNSVc48ldISRrwTu/zpIvCNM+ES1Z9vrsGyuOrwjP/0JXC 313bJOfjatT8SlYS5TXp3I9iJA3UfU1QJEfvJHcTR0T4VHTv+qFACA5qhzF9KAbAUhRY iuJF9ljH9lwbZpf9DcSSIDVU0mlh0cHGOHWxGDHefihBO3HVMmk8z2CnupgZX3WRyhYy en7e4sY1VT6XSNLuHdM7ujXeK/Y4+heWwYPgN3UOdv/juwOUXiyZwx5/I4dOQ7Zu37Cm Cj4w== X-Received: by 10.15.54.72 with SMTP id s48mr19939509eew.3.1387249425827; Mon, 16 Dec 2013 19:03:45 -0800 (PST) Received: from [192.168.10.2] ([83.168.26.131]) by mx.google.com with ESMTPSA id 4sm48901571eed.14.2013.12.16.19.03.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Dec 2013 19:03:45 -0800 (PST) Message-ID: <52AFBF0E.4000505@yandex.ru> Date: Tue, 17 Dec 2013 05:03:42 +0200 From: Dmitry Gutov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Stefan Monnier Subject: Re: bug#16116: 24.3.50; smie-indent-close aligns inner closing paren with the outer opening paren References: <87sity96he.fsf@yandex.ru> <6B783955-B72E-4876-BCF2-C864F3D74A62@sanityinc.com> <87y53niicw.fsf@yandex.ru> <87r49fe1d2.fsf@yandex.ru> <52AD1793.50901@yandex.ru> <87k3f5lmxp.fsf@yandex.ru> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 16116-done Cc: 16116-done@debbugs.gnu.org, Steve Purcell X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 16.12.2013 16:23, Stefan Monnier wrote: > I think it's OK. Thanks for looking, applied. > Preserving the old behavior would maybe be better, but ... let's try it > as is. I do believe the new behavior is a better default. Octave, Prolog, etc, examples in test/indent seem unaffected, but there is one affected example in elpa/packages/sml-mode/testcases.sml (I'm also getting other mismatches there, but those are probably unrelated). ------------=_1387249442-23728-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 12 Dec 2013 01:57:31 +0000 Received: from localhost ([127.0.0.1]:44505 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VqvWt-0000r5-0r for submit@debbugs.gnu.org; Wed, 11 Dec 2013 20:57:31 -0500 Received: from eggs.gnu.org ([208.118.235.92]:39903) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VqvWq-0000qx-Eq for submit@debbugs.gnu.org; Wed, 11 Dec 2013 20:57:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VqvWk-0006i4-8l for submit@debbugs.gnu.org; Wed, 11 Dec 2013 20:57:28 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:41272) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqvWk-0006i0-5I for submit@debbugs.gnu.org; Wed, 11 Dec 2013 20:57:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqvWe-00046X-7f for bug-gnu-emacs@gnu.org; Wed, 11 Dec 2013 20:57:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VqvWY-0006cM-Cd for bug-gnu-emacs@gnu.org; Wed, 11 Dec 2013 20:57:16 -0500 Received: from mail-ea0-x232.google.com ([2a00:1450:4013:c01::232]:54232) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqvWY-0006cI-5Y for bug-gnu-emacs@gnu.org; Wed, 11 Dec 2013 20:57:10 -0500 Received: by mail-ea0-f178.google.com with SMTP id d10so3225525eaj.37 for ; Wed, 11 Dec 2013 17:57:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:mime-version:content-type; bh=/scbkl1cqoopjwn4nUCFuEnYsmOp2bIk5XkyFVhEh9E=; b=V/aiS3IxnQiHf5B4QB3oFgRc7F8MPrvb9QWTYLnPwWEFUS3GYitP5xgpgej2Mie5e6 xhvVNjbmKh0vVyNqhy4rfmeTQWdajxklO4vMVilDmK/Go8W8pMjYDUOGlVLoDZ14vWug XM7dMm/O8DYokznrCsdjwT0pYVhylCCR5kJQOp1ZBxu4KmnC6kDabvXQeFqM34dAIH+W h36F6tjthA51LgB2BlK1B7O9Gd5kvNVUPx0UIV5ZHXMvMA1AItIeI5vQbezLGzy7kpjj oHbRGTvkfD3OW+mXZ8rq7ID6Q124Z2Rvo6NYaK/Q7T1DP0ZbAHbbS7A7Iwcdwa/jf6kS 0Kkg== X-Received: by 10.15.61.134 with SMTP id i6mr4861151eex.48.1386813428923; Wed, 11 Dec 2013 17:57:08 -0800 (PST) Received: from axl (213-241-09.netrun.cytanet.com.cy. [213.7.241.9]) by mx.google.com with ESMTPSA id g47sm60113049eeo.19.2013.12.11.17.57.07 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 11 Dec 2013 17:57:08 -0800 (PST) From: Dmitry Gutov To: bug-gnu-emacs@gnu.org Subject: 24.3.50; smie-indent-close aligns inner closing paren with the outer opening paren Date: Thu, 12 Dec 2013 03:57:01 +0200 Message-ID: <87sity96he.fsf@yandex.ru> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Try this example with ruby-mode: foo( a, b => [ 1, 3, 4 ], c => [ 5, 6 ]) Currently, it will indent the last line to the 0th column, which doesn't look right to me. The following patch fixes that. Would it be all right to install it? === modified file 'lisp/emacs-lisp/smie.el' --- lisp/emacs-lisp/smie.el 2013-11-04 20:45:36 +0000 +++ lisp/emacs-lisp/smie.el 2013-12-12 01:39:59 +0000 @@ -1423,8 +1423,7 @@ (save-excursion ;; (forward-comment (point-max)) (when (looking-at "\\s)") - (while (not (zerop (skip-syntax-forward ")"))) - (skip-chars-forward " \t")) + (forward-char 1) (condition-case nil (progn (backward-sexp 1) In GNU Emacs 24.3.50.8 (x86_64-unknown-linux-gnu, GTK+ Version 3.8.6) of 2013-12-09 on axl Bzr revision: 115440 dmantipov@yandex.ru-20131209163052-oess75ps2o5tt61q Windowing system distributor `The X.Org Foundation', version 11.0.11403000 System Description: Ubuntu 13.10 ------------=_1387249442-23728-1--