From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Aaron Jensen Newsgroups: gmane.emacs.bugs Subject: bug#61822: 29.0.60; Ruby indentation with assignment and method calls Date: Sun, 26 Feb 2023 18:59:37 -0500 Message-ID: References: <1ec48204-0650-23f7-0d36-8ac7bdae2718@yandex.ru> <04f40592-80dd-ec66-a30a-c30e3fa5de81@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36508"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61822@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 27 01:00:11 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 1pWQw7-0009M7-Ju for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 27 Feb 2023 01:00:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWQw0-0006mm-GE; Sun, 26 Feb 2023 19:00:04 -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 1pWQvy-0006ky-Cg for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2023 19:00:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pWQvx-0004TU-VY for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2023 19:00:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pWQvx-000590-Rj for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2023 19:00:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Aaron Jensen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Feb 2023 00:00:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61822 X-GNU-PR-Package: emacs Original-Received: via spool by 61822-submit@debbugs.gnu.org id=B61822.167745599619738 (code B ref 61822); Mon, 27 Feb 2023 00:00:01 +0000 Original-Received: (at 61822) by debbugs.gnu.org; 26 Feb 2023 23:59:56 +0000 Original-Received: from localhost ([127.0.0.1]:45259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWQvr-00058H-LY for submit@debbugs.gnu.org; Sun, 26 Feb 2023 18:59:55 -0500 Original-Received: from mail-pg1-f180.google.com ([209.85.215.180]:40524) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWQvq-000584-8W for 61822@debbugs.gnu.org; Sun, 26 Feb 2023 18:59:54 -0500 Original-Received: by mail-pg1-f180.google.com with SMTP id q23so2554690pgt.7 for <61822@debbugs.gnu.org>; Sun, 26 Feb 2023 15:59:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=NmwEw/E06L/tY9J3+y255zEhmDxtgyclYp91K+biAcc=; b=jg7JQS2OciZcTwh+e9wn7Yh5hL52Dy2lCYLY0SpYt1ctVktcYPBymVT2HTEAdlSFKO wXyNPD4UFCUcSlOl2AM6qsMpb232RNAQI9xhQRgAHQMLNV+1LY6zx+r5e9XN+C3eWzdI FA8+rP3x/U3t5g6VjrNIgHDzKH3lO+/ML2SXkmydQHbEnte68aEI5i1akdB9TTJ7YxTK dDyf+UapbsFVzpYiI3vflapFQWKQ2ifRQe7o6P835pDjS+umcemHjBcIaktPvvtujJbc g6h04qmr00vyzJb7EMW7feMCG/JXumRulmxQrEKOm3CGMjsrRDC4eRK+kdU9QzLfRKRR oq0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NmwEw/E06L/tY9J3+y255zEhmDxtgyclYp91K+biAcc=; b=rHKkn5aBOs7zXebZo+maLgJ2ZVLsGmp+PrNc2WA89FkVo1HYZup6yJoVpE3cMi3slM UWTro2LhNhV6UWzWDNOMdKwCo0jovP2ZyWWW7IcSFhaeOaD2WAqHWul68DCyHX6MMcv9 uoGkOni7otfW8Y2ZdLwS9tFY755oMH4BF2MQAT7qta0m5OPplt98mYeueYLH07F7Mg4b Li2oOTk4k+9LntFeLx6C3iPbVCeEiH/WEsPnodzRu/7vbukFOuV4ENqxpZM+x6umcrg1 6KLN2mFfkkZYrKmM3OIfL+vTd07mBkBoyopJDTPKHVfQXiTcCmUWNOHJfjsvy1Toopps soGg== X-Gm-Message-State: AO0yUKULorhN1vdhB1QwNS4wOCuQZODcYlZPp/QSWYm+v3EKoUgCH/4V N0fAnGVTqBp/dN1Vi3oqa7JoBbHls43nZ+uqlvQ= X-Google-Smtp-Source: AK7set+ipJKn4pvg9Lw44Qu64bbjVyCf0+F/TNHi5rhOBQydG5NroTCRk/OWKDxko3CIbwLzUuMJh0dFnej8KPzRNM0= X-Received: by 2002:a63:77cc:0:b0:4d8:aa76:4e26 with SMTP id s195-20020a6377cc000000b004d8aa764e26mr5159517pgc.0.1677455988403; Sun, 26 Feb 2023 15:59:48 -0800 (PST) In-Reply-To: <04f40592-80dd-ec66-a30a-c30e3fa5de81@yandex.ru> 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:256837 Archived-At: On Sun, Feb 26, 2023 at 6:57 PM Dmitry Gutov wrote: > > On 27/02/2023 00:57, Aaron Jensen wrote: > >> diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el > >> index dba9ff0a846..6778507bc2b 100644 > >> --- a/lisp/progmodes/ruby-mode.el > >> +++ b/lisp/progmodes/ruby-mode.el > >> @@ -908,7 +908,8 @@ ruby-smie-rules > >> "+=" "-=" "*=" "/=" "%=" "**=" "&=" "|=" "^=" "|" > >> "<<=" ">>=" "&&=" "||=" "and" "or")) > >> (cond > >> - ((not ruby-after-operator-indent) > >> + ((and (not ruby-after-operator-indent) > >> + (smie-indent--hanging-p)) > >> (ruby-smie--indent-to-stmt ruby-indent-level)) > >> ((and (smie-rule-parent-p ";" nil) > >> (smie-indent--hanging-p)) > >> > > This seems to work for me. I'm good with this being the same too as it > > is with your patch: > > > > foo + bar( > > asdasd > > ) > > Hmm, that one seems to misindent this example: > > some_variable = abc + some_method( > some_argument > ) > > How about this patch? > > diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el > index dba9ff0a846..559b62fef54 100644 > --- a/lisp/progmodes/ruby-mode.el > +++ b/lisp/progmodes/ruby-mode.el > @@ -909,7 +909,9 @@ ruby-smie-rules > "<<=" ">>=" "&&=" "||=" "and" "or")) > (cond > ((not ruby-after-operator-indent) > - (ruby-smie--indent-to-stmt ruby-indent-level)) > + (ruby-smie--indent-to-stmt (if (smie-indent--hanging-p) > + ruby-indent-level > + 0))) > ((and (smie-rule-parent-p ";" nil) > (smie-indent--hanging-p)) > ruby-indent-level))) > Nice catch. This patch looks good to me. Aaron