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.devel Subject: Re: newline-and-indent vs. electric-indent-mode Date: Sat, 23 Jan 2021 02:45:01 +0200 Message-ID: <66b7932d-4cee-9628-fae0-168ee6ebc041@yandex.ru> References: <87wnw5yt58.fsf@hajtower> <01d07f6d-cc4c-2f54-4bae-a611bba7be93@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="4858"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Cc: =?UTF-8?Q?Harald_J=c3=b6rg?= , Emacs Developer List To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jan 23 01:46:24 2021 Return-path: Envelope-to: ged-emacs-devel@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 1l374K-0001Bd-Jk for ged-emacs-devel@m.gmane-mx.org; Sat, 23 Jan 2021 01:46:24 +0100 Original-Received: from localhost ([::1]:59190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l374J-0003Yq-K6 for ged-emacs-devel@m.gmane-mx.org; Fri, 22 Jan 2021 19:46:23 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42032) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3736-000310-AB for emacs-devel@gnu.org; Fri, 22 Jan 2021 19:45:12 -0500 Original-Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]:40590) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l3734-0005n2-4y for emacs-devel@gnu.org; Fri, 22 Jan 2021 19:45:08 -0500 Original-Received: by mail-ed1-x52c.google.com with SMTP id s3so204954edt.7 for ; Fri, 22 Jan 2021 16:45:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=jfWdgnWeYLEDzNFCDD8SNQzmFkLmbTbyMmc9GDcydkw=; b=mrpsaCltwOQKoOZ1IrfFUJaTLo/eyv3xMGQXjz9oxIpGN0Uqy+XjIpCOz81p6CfYoG +GndKVaCw/JXMEjUwj2cGLxPJd5qlUkXXhg/oCdK/bzgVyw3mjyF31yZXz42MRPcRcAE xuHVx0/Gf5MusFm/ZQp1uigNOY9kN1F7NyWva/oMRtRrsIubd5mpqUdFNgmlRBxJ7FjQ oxeDtKF1EpxGCbAohGY1hHMoU5G2/duhjxGdc2znKcG/c+Uwyf9T8uJzbdWe7VTHXi/J A3V8buuqJR6MWzlOPdlW0sdgsiszKmA7j3CvqJqDXgSjG4fNG0JdGcPeqUi3VYRkCDG9 UG1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=jfWdgnWeYLEDzNFCDD8SNQzmFkLmbTbyMmc9GDcydkw=; b=MHsI2ttvXRsz8OH7ZkWhYEI2qOLzzpQZ6k+2uKep5BXmqC0Xye0wtpPv5WHXrfwhtZ O+PkRN5q/4W1oK+uP2Jj8JpRNxEtJDUDG9Q4zoFRK/ABUzdrIRHcO6gBVqhFzztXCpP0 UBopb3fCuEaQZSTyqfCIQQUQ95YK4Wk5erZvUgMPtWSbmOkSxhHbLCd7pE8wwdqabbcM GCA40NHMz9C7nHgygxvV8EzAegQwkAVzet8/xOWbMpC5hcRxASgmrvbg6qCKQIwzzSB2 KW6mvCrV53VPDr3Hu9KxrVbRw2XOwp2udEgDlGFICQBfYp0sekhsfteXMH9lFzcLvOvQ yp8A== X-Gm-Message-State: AOAM531BXKi33sv5rVtKwpxoPHawIWtjRZdUDiL7BINluz0c9MfMAtdj UwsxhFiJ4clI4s6TTAVnRZVkKazk5f4= X-Google-Smtp-Source: ABdhPJyLzAlH0ZgwTUe2kc/os68Q/IHtju9KGLBBjbzgbta1dBrhdqmgpmZozH9ENjmjENkU6dm3+w== X-Received: by 2002:a05:6402:8cd:: with SMTP id d13mr5087698edz.335.1611362704087; Fri, 22 Jan 2021 16:45:04 -0800 (PST) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id j18sm5402002ejv.18.2021.01.22.16.45.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 22 Jan 2021 16:45:03 -0800 (PST) In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::52c; envelope-from=raaahh@gmail.com; helo=mail-ed1-x52c.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NICE_REPLY_A=-0.221, 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-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:263291 Archived-At: On 23.01.2021 01:16, Stefan Monnier wrote: >>>> That would disable the effects of electric-indent-functions, and in >>>> particular, of ruby--electric-indent-p. >>> I don't see why. AFAIK it should only inhibit the "reindent original >>> line when inserting \n". It should affect indentation of the line after >>> the inserted \n nor should it affect indentation when inserting >>> other chars. >> It also affect "reindent original line when inserting something other than >> \n", which is what ruby--electric-indent-p is all about (e.g. I type 'd' >> finishing the token 'end', and the line is reindented). > > Hmm... indeed I now see that the code also inhibits reindentation in > that case. Weird! > Could you open a bug report for this? I'm not sure how it is a bug. It's "reindentation" in both cases, right? And electric-indent-inhibit's docstring refers to reindentation. >> It's just that in my mental model \n doesn't belong to the current line, >> only to the next one. So it shouldn't reindent the original line. > > It's often useful for me, as in typing > > foo RET else RET blabla > > where the else benefits from being reindented upon the second RET. I see. Well, ruby--electric-indent-p covers this scenario already. Perhaps your approach is simpler, but always reindenting the original line gets annoying if the indentation function sometimes produces suboptimal results. Or, you know, just results that disagree with the style guide used in a project. Then I have to go back and change the indentation manually again, or undo the change and go with C-o C-n TAB.