From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#61822: 29.0.60; Ruby indentation with assignment and method calls Date: Mon, 27 Feb 2023 02:10:55 +0200 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; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11379"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Cc: 61822-done@debbugs.gnu.org To: Aaron Jensen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 27 01:12:24 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 1pWR7v-0002lN-8p for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 27 Feb 2023 01:12:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWR7e-0000pI-Mu; Sun, 26 Feb 2023 19:12:06 -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 1pWR7c-0000nl-Jz for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2023 19:12:04 -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 1pWR7c-0007Mw-Aq for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2023 19:12:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pWR7c-0005U1-6B for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2023 19:12:04 -0500 Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Feb 2023 00:12:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 61822 X-GNU-PR-Package: emacs Mail-Followup-To: 61822@debbugs.gnu.org, dgutov@yandex.ru, aaronjensen@gmail.com Original-Received: via spool by 61822-done@debbugs.gnu.org id=D61822.167745666520876 (code D ref 61822); Mon, 27 Feb 2023 00:12:04 +0000 Original-Received: (at 61822-done) by debbugs.gnu.org; 27 Feb 2023 00:11:05 +0000 Original-Received: from localhost ([127.0.0.1]:45277 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWR6e-0005Qe-Lh for submit@debbugs.gnu.org; Sun, 26 Feb 2023 19:11:05 -0500 Original-Received: from mail-ed1-f48.google.com ([209.85.208.48]:33300) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWR6d-0005Pn-7f for 61822-done@debbugs.gnu.org; Sun, 26 Feb 2023 19:11:03 -0500 Original-Received: by mail-ed1-f48.google.com with SMTP id ck15so19408806edb.0 for <61822-done@debbugs.gnu.org>; Sun, 26 Feb 2023 16:11:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=ny4bCSWFP8dGU9fMUQDGAxZwtT7YohSZNHk1RefiIQU=; b=pgMz/vWfPX68adOrG427IqiDqlyMjYmF0k//v8ofWa/DIZ+90CuzOhDgDhz9wZTnCU Rok00x4UXhHMZ6+4fFZsD0CCQN/sPaH15jD2eb9uSDu089lW3Ka8S86l0eAFEd1BdwtB aunXuxC6uWSuhFWQw8rQs6IwPPTGTnthq2KAr1V3fi4KDu61RK4UFkb2CXtwSnmkomNy 2a8OmVNZmawb+qJvBrrk0hLYwXqFiL2vOD+LJrtfaFZ+d8lwrw2H5e0bgxMLJ93cPcyQ PuQWsrRn1y092shpzviTtbVJSc5GYoBQF4l1KSVNmFniipYDCUmhO3VvNuGVwCJwD/Xn dEKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ny4bCSWFP8dGU9fMUQDGAxZwtT7YohSZNHk1RefiIQU=; b=5VJOSEMP2dQMX0fx4ugpba5uHix65OqfM4PaBncuwLPGFWEkGzaqXoBxpu+xIraazJ 4qnUkLrEN+0rGsXO+JLlfEd7REwB18NKz3fwBcnyrKMamFJe7WVa/4Tii1GBAwcqHBfa PEnydxYy71cLIeE01UA1ZWoMM/r9OjDwu2v0L12MJ8ZqHuNcF56gIEdHGdmAQXdeRrPX P8zFk7YNlTTIythY1/nNYri9qfmM0hAGgThl+dOuO+UnaxeGov2RQfg56BAJuBidwL/e sjM03avf/eb9hzaQR5YNeubIOVV6hcqNpu3hqKQN8kLJTsyKpgKrA7xWJKqsKWJbDbRD 627w== X-Gm-Message-State: AO0yUKUBEoKuJrdT3dfKqlljbva0m4mWX8WLVY3/Y2Gv5dcnk8IAJPSP 4ITI2Ic4VGnsfhDLOwwG0AE= X-Google-Smtp-Source: AK7set9esbpwBf+qv2wBUyt9fF1Aq3Wxg0/xHsoQt8NJWBSoLx/2ainNDC4xU5+eZxioCGD+onCFLA== X-Received: by 2002:aa7:d494:0:b0:4ab:4949:32e9 with SMTP id b20-20020aa7d494000000b004ab494932e9mr22417284edr.18.1677456657296; Sun, 26 Feb 2023 16:10:57 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id a28-20020a509b5c000000b004af6c5f1805sm2487545edj.52.2023.02.26.16.10.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Feb 2023 16:10:56 -0800 (PST) Content-Language: en-US In-Reply-To: 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:256838 Archived-At: On 27/02/2023 01:59, Aaron Jensen wrote: > 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. Thanks for testing, pushed to emacs-29.