Stefan Kangas <stefankangas@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 60321) by debbugs.gnu.org; 27 Dec 2022 01:38:23 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 26 20:38:23 2022 Received: from localhost ([127.0.0.1]:54401 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1p9yv8-0000dI-Uc for submit <at> debbugs.gnu.org; Mon, 26 Dec 2022 20:38:23 -0500 Received: from mail-pf1-f180.google.com ([209.85.210.180]:42801) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <aaronjensen@HIDDEN>) id 1p9yv6-0000d4-Ru for 60321 <at> debbugs.gnu.org; Mon, 26 Dec 2022 20:38:21 -0500 Received: by mail-pf1-f180.google.com with SMTP id 65so8038373pfx.9 for <60321 <at> debbugs.gnu.org>; Mon, 26 Dec 2022 17:38:20 -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=gzqil5gDqWHnl76ZxfppUAYj0jRao6Z1FEDcEOZdqXE=; b=CRTOgt+p6ufFHiO5KXbelNge+PEpYwbKDVWN+xi9Z+WZcyjkbFYlL/GdIkwq1UuuSx +hCxWy+q9ZV2/NuxNSFuZnNPFiP9eI3CXP+IcN4u2xDRmVPX4URQDxE9wz8tf4gAHc8I /u0Hzz3liomMev+jvE3n0msR4FLIFvN+bgDLnEZQNBKoggeTlHXCetTeiYr/RrJSyUAf w4kEfU0P73wNQSWNSMxGidmcgyC1JtEX1uwGQJ4daPI9SHbMSqX1SYelZEx7BGLW0b+E fHD3x8cqOTde5Oc8eNhezNJ/V+5+ctvUl4YxRl5H2s71aksgpK2AT6Cso7pIh+QcOEe0 Z3/A== 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=gzqil5gDqWHnl76ZxfppUAYj0jRao6Z1FEDcEOZdqXE=; b=BNYH2wwK+KvW1TQVEVzXpSxkVC6CG3aGr5eicjEsb04nEVTKlNuZ+KdVfL/hqfvPCt vp9JCSSYV3sN3e6wl33VxFxcYpbd4ee/4Zop0f/7AfcobwaTJ8Kg1rq/V/KnWrHrI33R D0lid0jRGgiGEn07h3w0isZ6th/+foM0Gz5sNrh3XkGTki2oNdmPu6Q3u/WgED82CWNz Ws+K8gO8k4gkEtlCqb6KhCruNSCPBlx8uA/31SBK2hVApZltom/UytaCOklVDLvb+aIF TCMW/lyLxPvkKiwP2ohLUA0SyNg6Fmhm70xtMgq2oy54GRx7M8908NXgnbwYfwQKTBPZ +mYw== X-Gm-Message-State: AFqh2kphPLuokDpiUrMixe1jSMwx5aJ2eOj+sb1c+PJOVg7m/i9a95G4 LBBNBahiqH/ZsmhxoZ3XMLUbd7lLRJu5tX5mxzQ= X-Google-Smtp-Source: AMrXdXvaaPKgXlUEaQFwpXAdleaYEqFd8DWnEdJrKkrv5Aqvveh0gS/Ee8QTjvn34KoNesr/igvYt9TsuLiZZixd4Bg= X-Received: by 2002:a62:388d:0:b0:576:9786:94c2 with SMTP id f135-20020a62388d000000b00576978694c2mr1267302pfa.26.1672105094553; Mon, 26 Dec 2022 17:38:14 -0800 (PST) MIME-Version: 1.0 References: <m2pmcgxfvp.fsf@HIDDEN> <4e44df18-207c-c7ca-0588-7285f3008dfb@HIDDEN> <CAHyO48zDS-029joWMVhu2_w4jx_s+gRRrDTk3ThuQfXHmJLQ2Q@HIDDEN> <358bbd65-9375-04c8-f0a2-24a4383f142e@HIDDEN> <CAHyO48ybYrvkHbztSkUjLkh5vQWOVhBhi-7sdUqui5LZBrr5Rw@HIDDEN> <2b4a91e1-bad1-382f-dd64-abf171efb404@HIDDEN> <CAHyO48wapPi=D7C9WZCBx8-iCPmqO9sNWLC0v_M8BpVr89LN3g@HIDDEN> <60e207e0-7378-ad9f-3ef0-99df1c139939@HIDDEN> <CAHyO48xEcUFGybUnDgsqywnFe3rLv4mO30hGA==TZ=cLP4t6fw@HIDDEN> <902440c7-706a-20e1-55af-4e12e8cdda2c@HIDDEN> <CAHyO48wn2CBMmzBH25mFT_u_Fk_qDQA=NRnv29MkqDfzRYvA4A@HIDDEN> <c8a360cb-a5e3-7a1d-79ef-5e2c6114a9e9@HIDDEN> <CAHyO48zowqgthV0_NUtfh9yq3XgEGwaKUEa0XNKB=eLDB=0g2g@HIDDEN> <1191195d-1528-dc2a-64e0-15426e4b5608@HIDDEN> <CAHyO48wJ0iizhWbir-ywi+F6t31Rj+-87Oq-KpR0bxm28SOVsg@HIDDEN> <75342f40-d576-e1c6-3d63-692b80e78bfe@HIDDEN> In-Reply-To: <75342f40-d576-e1c6-3d63-692b80e78bfe@HIDDEN> From: Aaron Jensen <aaronjensen@HIDDEN> Date: Mon, 26 Dec 2022 20:38:03 -0500 Message-ID: <CAHyO48zQiusY05KpiVPPDPnyL9L-Ybq13ukeoSfOezKr66o0kA@HIDDEN> Subject: Re: bug#60321: 29.0.60; ruby-mode indentation of hash or array as first arg in multiline method call To: Dmitry Gutov <dgutov@HIDDEN> Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 60321 Cc: 60321 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On Mon, Dec 26, 2022 at 8:16 PM Dmitry Gutov <dgutov@HIDDEN> wrote: > > Vim's choice looks saner to my eye. Probably comes down to the choice of > indentation algorithm, though. Agreed, though it's hard to pick which is more sane when all the options start with insanity. > > If I had to type it as above, I would probably indent it like this: > > > > and_in_a_method_call({ > > no: :difference > > }, > > foo, > > bar) > > > > But I can't imagine that would be easy to implement at all, so I > > wouldn't bother. > > The indentation logic itself might be not that difficult to write, but > the fact that the expression will have to be reindented as soon as the > method call grows a second argument (after the user types the comma?), > makes it a hard sell usability-wise. Right, I think that's just more of the same thing... We are looking at ways of writing code that are out of the realm of reason. It's a challenge to define behavior when the behavior could very well be undefined. But, if we must define it, then what are our guiding principles? Not having to reindent preceding lines when adding a new line may be a very reasonable one. In that case, the only two options I could think of would be: and_in_a_method_call({ no: :difference }, foo, bar) or and_in_a_method_call({ no: :difference }, foo, bar) The difference being if we decide to dedent upon the last closing indent-requiring-token or the first. I think a reasonable rule of thumb for a human might be: "If you open N indents on one line, you must close N indents on one line". Any time you stray away from this, behavior becomes... not ideal. Aaron
bug-gnu-emacs@HIDDEN
:bug#60321
; Package emacs
.
Full text available.Received: (at 60321) by debbugs.gnu.org; 27 Dec 2022 01:16:40 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 26 20:16:40 2022 Received: from localhost ([127.0.0.1]:54382 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1p9ya7-00006r-OD for submit <at> debbugs.gnu.org; Mon, 26 Dec 2022 20:16:39 -0500 Received: from mail-wr1-f46.google.com ([209.85.221.46]:38431) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <raaahh@HIDDEN>) id 1p9ya3-00006W-RZ for 60321 <at> debbugs.gnu.org; Mon, 26 Dec 2022 20:16:37 -0500 Received: by mail-wr1-f46.google.com with SMTP id n3so10473054wrc.5 for <60321 <at> debbugs.gnu.org>; Mon, 26 Dec 2022 17:16:35 -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=15algWF4IAmoDoWU6/OlRTFdBhoTGIUmXL1M+IeAZZI=; b=lAVxa51H4L7dq38zW9KS0dtPSw1yNfnZsVhjo5HcEjL1pSG0sqxoXCqipTd78Jn/tc 1+GH9bYhSkQejwF6EOxJaESDkD71uS435giI+ScCwRofpktw7tCcXicSBuZ/sTX0OGOE NQqNhM3zX2MeyNXPkAe6ZbKQv73WDlXZAhSOgtakIT3lSqejbpKrsCrDOJZAZEdhfAZz hFPbTbomyRHM/o5otpAKNIYuMNILyK3zuSeJfMcNNqGIqnP5La/ywALCvyGL6/59pFSW sYR3PitvHFpJiP1L9gyFJ8SRzpY3sGoKv2zsDctapcUd02FSXb2SOum4zhlw5PiPNFu+ AiQQ== 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=15algWF4IAmoDoWU6/OlRTFdBhoTGIUmXL1M+IeAZZI=; b=qpz90+uIU61wELMs+RnDA4GxdQHbapxDCnpgS6QVliF93oqBir1j/F6aLxM1dmuOGR miGouWfL8ZhWjXSgruLyUjxlmjMGRvbztxVbKTt3KN5ZeRmT+KeoSTDYhZebTR+qQ7dn 34TtheJL271Q50BUQDhvpLWra0cV9Ke+iTUuq6AATWnH3SMr+sn+oI6NCoZ47Q+jrTwt ApaaVWKGbp21QpIeWvWrjlCINZlv6ilDeBKkZo5Z8zeZrIv0Wn4nyE8ZnkZIoEKxOh0y 4sM4sLYvpxHZ41gvrXmk89XEzYArmcaD9XWmsWzErGmZv+E/r7CtWBY4VvUwoJDfzmHs OhgA== X-Gm-Message-State: AFqh2koQP0nstC+oh2mb7/dyvXavdEnhxjQXiZ2BPm2RrJ+g8xB/5t4i JqzMxi4tAbONxlcSSyoXbvM= X-Google-Smtp-Source: AMrXdXvBE8k75tylI3tBP/ytmvr1O8opPZ8z/kR/imlim/VE/q9eDV9jz8d9TIMtdbfFndJ1bS+cRQ== X-Received: by 2002:a5d:5544:0:b0:26d:2af7:420 with SMTP id g4-20020a5d5544000000b0026d2af70420mr12004831wrw.33.1672103789949; Mon, 26 Dec 2022 17:16:29 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id f13-20020a5d4dcd000000b0023659925b2asm11323815wru.51.2022.12.26.17.16.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Dec 2022 17:16:29 -0800 (PST) Message-ID: <75342f40-d576-e1c6-3d63-692b80e78bfe@HIDDEN> Date: Tue, 27 Dec 2022 03:16:27 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: bug#60321: 29.0.60; ruby-mode indentation of hash or array as first arg in multiline method call Content-Language: en-US To: Aaron Jensen <aaronjensen@HIDDEN> References: <m2pmcgxfvp.fsf@HIDDEN> <4e44df18-207c-c7ca-0588-7285f3008dfb@HIDDEN> <CAHyO48zDS-029joWMVhu2_w4jx_s+gRRrDTk3ThuQfXHmJLQ2Q@HIDDEN> <358bbd65-9375-04c8-f0a2-24a4383f142e@HIDDEN> <CAHyO48ybYrvkHbztSkUjLkh5vQWOVhBhi-7sdUqui5LZBrr5Rw@HIDDEN> <2b4a91e1-bad1-382f-dd64-abf171efb404@HIDDEN> <CAHyO48wapPi=D7C9WZCBx8-iCPmqO9sNWLC0v_M8BpVr89LN3g@HIDDEN> <60e207e0-7378-ad9f-3ef0-99df1c139939@HIDDEN> <CAHyO48xEcUFGybUnDgsqywnFe3rLv4mO30hGA==TZ=cLP4t6fw@HIDDEN> <902440c7-706a-20e1-55af-4e12e8cdda2c@HIDDEN> <CAHyO48wn2CBMmzBH25mFT_u_Fk_qDQA=NRnv29MkqDfzRYvA4A@HIDDEN> <c8a360cb-a5e3-7a1d-79ef-5e2c6114a9e9@HIDDEN> <CAHyO48zowqgthV0_NUtfh9yq3XgEGwaKUEa0XNKB=eLDB=0g2g@HIDDEN> <1191195d-1528-dc2a-64e0-15426e4b5608@HIDDEN> <CAHyO48wJ0iizhWbir-ywi+F6t31Rj+-87Oq-KpR0bxm28SOVsg@HIDDEN> From: Dmitry Gutov <dgutov@HIDDEN> In-Reply-To: <CAHyO48wJ0iizhWbir-ywi+F6t31Rj+-87Oq-KpR0bxm28SOVsg@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 60321 Cc: 60321 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.9 (-) On 26/12/2022 01:46, Aaron Jensen wrote: > enh-ruby-mode and vim do the same thing, which I think is fine: > > takes_multi_pairs_hash(x: { > a: 1, > b: 2 > }) Makes sense to me, I just wanted to keep this case in the bug report because it will likely need a separate indentation rule or a separate clause. >> and_in_a_method_call({ >> no: :difference >> }, >> foo, >> bar) > > enh-ruby-mode: > > and_in_a_method_call({ > no: :difference > }, > foo, > bar) > > > Vim: > > and_in_a_method_call({ > no: :difference > }, > foo, > bar) Vim's choice looks saner to my eye. Probably comes down to the choice of indentation algorithm, though. > I think this falls under something I wouldn't put too much effort into > fixing. I would write it like this: > > and_in_a_method_call( > { > no: :difference > }, > foo, > bar > ) > > Which indents in a straightforward manner. Indeed. But this works already, no changes required. > If I had to type it as above, I would probably indent it like this: > > and_in_a_method_call({ > no: :difference > }, > foo, > bar) > > But I can't imagine that would be easy to implement at all, so I > wouldn't bother. The indentation logic itself might be not that difficult to write, but the fact that the expression will have to be reindented as soon as the method call grows a second argument (after the user types the comma?), makes it a hard sell usability-wise.
bug-gnu-emacs@HIDDEN
:bug#60321
; Package emacs
.
Full text available.Received: (at 60321) by debbugs.gnu.org; 25 Dec 2022 23:46:26 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 25 18:46:26 2022 Received: from localhost ([127.0.0.1]:50358 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1p9ahG-0000x5-1c for submit <at> debbugs.gnu.org; Sun, 25 Dec 2022 18:46:26 -0500 Received: from mail-pl1-f171.google.com ([209.85.214.171]:41716) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <aaronjensen@HIDDEN>) id 1p9ahE-0000wr-On for 60321 <at> debbugs.gnu.org; Sun, 25 Dec 2022 18:46:25 -0500 Received: by mail-pl1-f171.google.com with SMTP id jl4so3250198plb.8 for <60321 <at> debbugs.gnu.org>; Sun, 25 Dec 2022 15:46:24 -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=smI/z2zLCYnUj31j5QxB0AfnM3u0kc3TmMdJlt2tX1g=; b=Wubt8IYYYN5HWSXj90/jdm2eEtLjlnDfFSdqO+TLIf73xZIkKwJN+ZZfjC1DUUJCYa 2MftOAPywFggs9UwiYcBzbbkAg3Vnlb47fMbzlLZvRyiUjgtvqlQCq24/NCc/ZkmJDud NOKbhAsUPP+trT6ULD2Pfe7ozUPN6Vf/LtL7g0qCoLqr1M7p5gccSYxmOmFa6V21ILbD 5Ff6ReG+zByP33V5RP6n59PjMOcqZjusJgGKk+KCGv5AJHMmrYyAgmKQ7+FTE00vO1zL yW2FJKpP8jZi/a9LWOaCr8Bmx+NVykmLqDRE/cZQZwtbrAOcK0FWcJ3StuOmTCixBWDr Z0rQ== 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=smI/z2zLCYnUj31j5QxB0AfnM3u0kc3TmMdJlt2tX1g=; b=UF6vBOz6WDfiewHojnxhncJ4iwayyDwwCvsbGq7ngFQE0Wf1q6EQDPM7H1viYrmmxO atJtyLhWlNf8mjTm11hu+xe0hR1gjQ5Sb/OUvTGLhgJ9lxhDJuqkKL7HzH74Ujm2HFsK G0dR/muCeB9XizelDQJE7ZK1osp3rfXay7dYzMq00co9S2W9Yo/VKAVHMvythfpljxHC wUEEN+S5yqvqGwf8kKaoWWJOXKjySlqY1gs7GezeG5YvIjLOiwsGPF5tCzZgEegi6gdg E4c7lSw1dAwtlb4mCf+8ZDJor9ajRNnAlJOfIBjqCx4pJ5c6fnbq2Qm1fdvYDb/IhCnc 380A== X-Gm-Message-State: AFqh2koE33lzknUi7ZT2U/l0EUlIfTlgKwqfLqg3H88BbferzSMLSGgt g2ioSRiOkgyViWk2voUcFwiVQU93DHSL6KIx048= X-Google-Smtp-Source: AMrXdXtT118kMALEMT5qyAmI0IvVUUlmOfHVOCh30aysOYzF/Mcu/M9HDZXPVvs9ZpjJY3nROgZcSaoNURdRG9R1Bcw= X-Received: by 2002:a17:90b:d8a:b0:223:f336:1519 with SMTP id bg10-20020a17090b0d8a00b00223f3361519mr1288524pjb.198.1672011978822; Sun, 25 Dec 2022 15:46:18 -0800 (PST) MIME-Version: 1.0 References: <m2pmcgxfvp.fsf@HIDDEN> <4e44df18-207c-c7ca-0588-7285f3008dfb@HIDDEN> <CAHyO48zDS-029joWMVhu2_w4jx_s+gRRrDTk3ThuQfXHmJLQ2Q@HIDDEN> <358bbd65-9375-04c8-f0a2-24a4383f142e@HIDDEN> <CAHyO48ybYrvkHbztSkUjLkh5vQWOVhBhi-7sdUqui5LZBrr5Rw@HIDDEN> <2b4a91e1-bad1-382f-dd64-abf171efb404@HIDDEN> <CAHyO48wapPi=D7C9WZCBx8-iCPmqO9sNWLC0v_M8BpVr89LN3g@HIDDEN> <60e207e0-7378-ad9f-3ef0-99df1c139939@HIDDEN> <CAHyO48xEcUFGybUnDgsqywnFe3rLv4mO30hGA==TZ=cLP4t6fw@HIDDEN> <902440c7-706a-20e1-55af-4e12e8cdda2c@HIDDEN> <CAHyO48wn2CBMmzBH25mFT_u_Fk_qDQA=NRnv29MkqDfzRYvA4A@HIDDEN> <c8a360cb-a5e3-7a1d-79ef-5e2c6114a9e9@HIDDEN> <CAHyO48zowqgthV0_NUtfh9yq3XgEGwaKUEa0XNKB=eLDB=0g2g@HIDDEN> <1191195d-1528-dc2a-64e0-15426e4b5608@HIDDEN> In-Reply-To: <1191195d-1528-dc2a-64e0-15426e4b5608@HIDDEN> From: Aaron Jensen <aaronjensen@HIDDEN> Date: Sun, 25 Dec 2022 18:46:07 -0500 Message-ID: <CAHyO48wJ0iizhWbir-ywi+F6t31Rj+-87Oq-KpR0bxm28SOVsg@HIDDEN> Subject: Re: bug#60321: 29.0.60; ruby-mode indentation of hash or array as first arg in multiline method call To: Dmitry Gutov <dgutov@HIDDEN> Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 60321 Cc: 60321 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On Sun, Dec 25, 2022 at 4:30 PM Dmitry Gutov <dgutov@HIDDEN> wrote: > > X-Debbugs-CC: aaronjensen@HIDDEN > > Splitting off from debbugs#60186, second try. > > Since this setting also seems orthogonal to the "simplified" preference, > and it'll require some more work. > > For future reference, here are the relevant Rubocop settings: > > https://docs.rubocop.org/rubocop/cops_layout.html#layoutfirsthashelementindentation > https://docs.rubocop.org/rubocop/cops_layout.html#layoutfirstarrayelementindentation > > On 25/12/2022 02:12, Aaron Jensen wrote: > >> We could also discuss cases like > >> > >> foo = bar({ > >> tee: 1, > >> qux: 2 > >> }) > >> > >> baz([ > >> 1, > >> 2, > >> 3 > >> ]) > >> > >> but those would be an orthogonal feature. And I don't see them much in > >> the wild, for some reason. > > The same logic would apply. It doesn't matter how many indent starters > > there are in a line, the indentation should only increase by one: > > > > > > foo = bar({ > > tee: 1, > > qux: 2 > > }) > > > > baz([ > > 1, > > 2, > > 3 > > ]) > > > > Of course, that begs the question what happens if you do this: > > > > baz([ > > 1, > > 2, > > 3 > > ] > > ) > > Here are a couple trickier examples: > > takes_multi_pairs_hash(x: { > a: 1, > b: 2 > }) enh-ruby-mode and vim do the same thing, which I think is fine: takes_multi_pairs_hash(x: { a: 1, b: 2 }) Though again, the best answer imo is "don't do this". > > and_in_a_method_call({ > no: :difference > }, > foo, > bar) enh-ruby-mode: and_in_a_method_call({ no: :difference }, foo, bar) Vim: and_in_a_method_call({ no: :difference }, foo, bar) I think this falls under something I wouldn't put too much effort into fixing. I would write it like this: and_in_a_method_call( { no: :difference }, foo, bar ) Which indents in a straightforward manner. If I had to type it as above, I would probably indent it like this: and_in_a_method_call({ no: :difference }, foo, bar) But I can't imagine that would be easy to implement at all, so I wouldn't bother. > AFAICT even Rubocop doesn't have a setting which would indent the second > one somewhat reasonably, while keeping two-space indent before "no". > > > And, I think again, the answer is a social one, rather than a technical one. > > > > enh-ruby-mode and vim both do this this: > > > > baz([ > > 1, > > 2, > > 3 > > ] > > ) > > Yup, that looks pretty bizarre. OTOH, I don't see why a developer would > put a newline between "]" and ")" in this case. Exactly, that's what I meant by a social problem. We have a (somewhat harsh) saying for stuff like this: you get what you deserve. That's actually why I don't mind enh-ruby-mode's behavior here. It's clearly undefined/out of bounds, so that tells a person they are currently out of bounds and they should get back in bounds. Aaron
bug-gnu-emacs@HIDDEN
:bug#60321
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 25 Dec 2022 21:29:29 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 25 16:29:29 2022 Received: from localhost ([127.0.0.1]:50199 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1p9YYj-0002cP-7B for submit <at> debbugs.gnu.org; Sun, 25 Dec 2022 16:29:29 -0500 Received: from lists.gnu.org ([209.51.188.17]:45608) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <raaahh@HIDDEN>) id 1p9YYh-0002cF-Ql for submit <at> debbugs.gnu.org; Sun, 25 Dec 2022 16:29:28 -0500 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 <raaahh@HIDDEN>) id 1p9YYh-0005fS-Le for bug-gnu-emacs@HIDDEN; Sun, 25 Dec 2022 16:29:27 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <raaahh@HIDDEN>) id 1p9YYf-0006oM-QV for bug-gnu-emacs@HIDDEN; Sun, 25 Dec 2022 16:29:27 -0500 Received: by mail-wm1-x32a.google.com with SMTP id fm16-20020a05600c0c1000b003d96fb976efso4267156wmb.3 for <bug-gnu-emacs@HIDDEN>; Sun, 25 Dec 2022 13:29:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:content-language:references :to:subject:from:user-agent:mime-version:date:message-id:sender:from :to:cc:subject:date:message-id:reply-to; bh=FaKgCphL0BiOAeir2i+HxIhDZi6RNovCtJwBDIlsq54=; b=GTxjojhXDlfoTvh9CA+uP4M20fDOiiVN+1CUCcVb5ZT7Q/HCNJcrwT7wr5bfN6OQoq B/126N+qpZ2aOWxytKbzy8DUlQXOnve6jC7weSp3pjktFMspC3jJo7qlc0/GbwondNtJ 3Pog3pygDobUcyzZyP1huthDg83WFkHG/+5n2onkcEXXX+bfcsCSoi2uogsS94WDnqeM ovTjw09zPy80dx0xa/IezaFiNt8TrW9LpSjgHZA8/n7uICZonvHgre3YxZx4Qs1QvVxH 812mr9jDGUNkhiwCxgtr4aknCfzxiavtgn34j2+Kx8DkCrxzRS6qlBzJcCM5h4ronKXF o95A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:content-language:references :to:subject:from:user-agent:mime-version:date:message-id:sender :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FaKgCphL0BiOAeir2i+HxIhDZi6RNovCtJwBDIlsq54=; b=SL6b9q+/L0Ui+j+PshfpLWWSLgQizIKc26ENF5j+UyxSuPKBsNGW7UM60LJdeh5l3E AfDDMb5rA5gc7lvQb/eSA1ioWWuloA/eOOi5E7Cg+OW5WcK9SXs9HS1oBiMSsezFEjkv 9T9tIbQY23WwCS0Cg8pT+geC/rn7nhaltM4pjfJGMUWOSCchSqP8J6Egegr/M1W/33xL 4Iev8qlke146RaCepc98428BsjdLBqQYYjtSlQpzI2h+Ti5ejjY0QtUDiRaiwwMJqeHu UTuuVWCcxck7cn4TjdftdRKrKWSHPGtC6p46iPykJtqZphyyiKd9Tct/hgYVBe8wJliU 2I8Q== X-Gm-Message-State: AFqh2krHX7gTKIgg8QCkxopuvoXRpZExoQJqyC0cU40IkoV1q99F5gxg dwOVPo4SyqIwMBGqzeP56PgdqROyuAg= X-Google-Smtp-Source: AMrXdXtnsZx4pCtANiI6O6dRZaTbKsMgWEZhWmnkOdxLJbS6iSlV2xJQ3mLAu7jJJ1KlZ8g2kwpBWw== X-Received: by 2002:a05:600c:4255:b0:3d3:3d34:5d63 with SMTP id r21-20020a05600c425500b003d33d345d63mr12225413wmm.8.1672003763127; Sun, 25 Dec 2022 13:29:23 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id v26-20020a7bcb5a000000b003cf4eac8e80sm13697165wmj.23.2022.12.25.13.29.22 for <bug-gnu-emacs@HIDDEN> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 25 Dec 2022 13:29:22 -0800 (PST) Message-ID: <1191195d-1528-dc2a-64e0-15426e4b5608@HIDDEN> Date: Sun, 25 Dec 2022 23:29:21 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 From: Dmitry Gutov <dgutov@HIDDEN> Subject: 29.0.60; ruby-mode indentation of hash or array as first arg in multiline method call To: bug-gnu-emacs@HIDDEN References: <m2pmcgxfvp.fsf@HIDDEN> <4e44df18-207c-c7ca-0588-7285f3008dfb@HIDDEN> <CAHyO48zDS-029joWMVhu2_w4jx_s+gRRrDTk3ThuQfXHmJLQ2Q@HIDDEN> <358bbd65-9375-04c8-f0a2-24a4383f142e@HIDDEN> <CAHyO48ybYrvkHbztSkUjLkh5vQWOVhBhi-7sdUqui5LZBrr5Rw@HIDDEN> <2b4a91e1-bad1-382f-dd64-abf171efb404@HIDDEN> <CAHyO48wapPi=D7C9WZCBx8-iCPmqO9sNWLC0v_M8BpVr89LN3g@HIDDEN> <60e207e0-7378-ad9f-3ef0-99df1c139939@HIDDEN> <CAHyO48xEcUFGybUnDgsqywnFe3rLv4mO30hGA==TZ=cLP4t6fw@HIDDEN> <902440c7-706a-20e1-55af-4e12e8cdda2c@HIDDEN> <CAHyO48wn2CBMmzBH25mFT_u_Fk_qDQA=NRnv29MkqDfzRYvA4A@HIDDEN> <c8a360cb-a5e3-7a1d-79ef-5e2c6114a9e9@HIDDEN> <CAHyO48zowqgthV0_NUtfh9yq3XgEGwaKUEa0XNKB=eLDB=0g2g@HIDDEN> Content-Language: en-US In-Reply-To: <CAHyO48zowqgthV0_NUtfh9yq3XgEGwaKUEa0XNKB=eLDB=0g2g@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=raaahh@HIDDEN; helo=mail-wm1-x32a.google.com X-Spam_score_int: -7 X-Spam_score: -0.8 X-Spam_bar: / X-Spam_report: (-0.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, FREEMAIL_REPLY=1, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.1 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.1 (--) X-Debbugs-CC: aaronjensen@HIDDEN Splitting off from debbugs#60186, second try. Since this setting also seems orthogonal to the "simplified" preference, and it'll require some more work. For future reference, here are the relevant Rubocop settings: https://docs.rubocop.org/rubocop/cops_layout.html#layoutfirsthashelementindentation https://docs.rubocop.org/rubocop/cops_layout.html#layoutfirstarrayelementindentation On 25/12/2022 02:12, Aaron Jensen wrote: >> We could also discuss cases like >> >> foo = bar({ >> tee: 1, >> qux: 2 >> }) >> >> baz([ >> 1, >> 2, >> 3 >> ]) >> >> but those would be an orthogonal feature. And I don't see them much in >> the wild, for some reason. > The same logic would apply. It doesn't matter how many indent starters > there are in a line, the indentation should only increase by one: > > > foo = bar({ > tee: 1, > qux: 2 > }) > > baz([ > 1, > 2, > 3 > ]) > > Of course, that begs the question what happens if you do this: > > baz([ > 1, > 2, > 3 > ] > ) Here are a couple trickier examples: takes_multi_pairs_hash(x: { a: 1, b: 2 }) and_in_a_method_call({ no: :difference }, foo, bar) AFAICT even Rubocop doesn't have a setting which would indent the second one somewhat reasonably, while keeping two-space indent before "no". > And, I think again, the answer is a social one, rather than a technical one. > > enh-ruby-mode and vim both do this this: > > baz([ > 1, > 2, > 3 > ] > ) Yup, that looks pretty bizarre. OTOH, I don't see why a developer would put a newline between "]" and ")" in this case.
Dmitry Gutov <dgutov@HIDDEN>
:aaronjensen@HIDDEN, bug-gnu-emacs@HIDDEN
.
Full text available.aaronjensen@HIDDEN, bug-gnu-emacs@HIDDEN
:bug#60321
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.