From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: haj@posteo.de (Harald =?utf-8?Q?J=C3=B6rg?=) Newsgroups: gmane.emacs.devel Subject: Re: newline-and-indent vs. electric-indent-mode Date: Sat, 23 Jan 2021 17:27:42 +0100 Message-ID: <87a6szy5xd.fsf@hajtower> References: <87wnw5yt58.fsf@hajtower> <87o8hgzrzi.fsf@hajtower> <87a6t0z974.fsf@hajtower> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15647"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cc: Emacs Developer List To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jan 23 17:28:23 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 1l3Llv-0003xR-0t for ged-emacs-devel@m.gmane-mx.org; Sat, 23 Jan 2021 17:28:23 +0100 Original-Received: from localhost ([::1]:48100 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l3Llu-00076f-3R for ged-emacs-devel@m.gmane-mx.org; Sat, 23 Jan 2021 11:28:22 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44908) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3LlO-0006hi-99 for emacs-devel@gnu.org; Sat, 23 Jan 2021 11:27:50 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:56335) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3LlL-0001Og-Lj for emacs-devel@gnu.org; Sat, 23 Jan 2021 11:27:49 -0500 Original-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 097BA16005C for ; Sat, 23 Jan 2021 17:27:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1611419264; bh=emdU6AVixSE9XwuDRJA1s34olYZ1BUqJAPYfpwaq2W0=; h=From:To:Cc:Subject:Date:From; b=ATkf6T1+M5nk75os/SILdBA6qdeZ9zqLjqPk5JgN+TByF+enrbXgWa9kJ5g5MDagO nKTi/+1eLHFkO+3YueVIyCLg25iDq7hZawqrg1BBCsfkj5lAsG9Bk2w2gUj/rhbbn1 gBW0W6ZpQEPFPAiYLOgtjTppr/JEq3I1eHB0Mw/67BLNZ6HxTadGi2vkyZmM/tzY+j h5OT+gNICV0agCe+EXj8HELCfYiz7OOwDipUbwOC82HBc1dpwLJwvem4j6ubQPqbBN F+6vGHVF1FfkTWjFBOT4SR/Xk/WU4s5YzcQwJ3UVfzP1MNHiCPJGEsSvpaRlpE2e/7 nJhklLmp8x+cw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4DNM3z1Xcmz9rxP; Sat, 23 Jan 2021 17:27:43 +0100 (CET) In-Reply-To: (Stefan Monnier's message of "Fri, 22 Jan 2021 22:29:06 -0500") Received-SPF: pass client-ip=185.67.36.65; envelope-from=haj@posteo.de; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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:263303 Archived-At: Stefan Monnier writes: >>> Concrete examples would be helpful and could be reported as bugs ... >> I don't think these are bugs, but my personal user preference is to have >> RET indent in programming modes but not in text modes. > > You might like to try removing that customization ... I've already done that. It was part of my ancient customization stuff I wasn't aware of any more. I guess that was all that needed to be done to fix my doubts. >> I admit that the whole electric-indent stuff is new to me. I saw it >> happening but never checked *why* it is happening. First time I noticed >> it explicitly was in the backtrace leading to my original post. > > Yes, it happened because I think it's important to consolidate the > needs shared by all major modes. Agreed, I also consider this very valuable. > Then again, the users have the choice of either calling > `newline-and-indent` or `reindent-then-newline-and-indent`, so > presumably when they choose `newline-and-indent` it's because they don't > want the first line to be reindented. Well... actually, as a user, I don't want to be bothered with such choices while I'm typing. I want to hit RET and have the mode figure out what needs to be done so that the code follows some coding convention. But that's only me, so "anecdotal evidence". This choice might be of interest for mode maintainers, though. They might want to check how new user settings or global minor modes affect their mode's behavior. Maybe mode authors should wrap =E2=80=98electric-indent-local-mode=E2=80=99 with a mode-specific command (= in particular: a mode-specific docstring) because users shouldn't be supposed to figure out this particular's mode's settings for =E2=80=98electric-indent-functions=E2=80=99 and =E2=80=98electric-indent-ch= ars=E2=80=99, which is all they get from the docstring of the global =E2=80=98electric-indent-mode=E2= =80=99 command. > It also brings back the behavior they had before `electric-indent-mode`. I'm sure this is correct. I wasn't aware of it since I only used Emacs sporadically in that era. >> First experiments suggest that the patch does indeed change the behavior >> when a line contains just a closing "]" or ")" - neither >> (newline-and-indent) nor (cperl-linefeed) now re-indent that line (which >> they should) > > This behavior is the behavior that `cperl-linefeed` had when it was > written, so I disagree with "they should". I should rephrase that: They should according to my user expectation (basically Damian Conway's book Perl Best Practices, or perltidy conventions) - regardless of whether the current implementation of `cperl-linefeed` is up to this task. > Hell! I don't even know half of what the "fancystuff" does, so maybe > I'm just plain wrong about what should be done. CPerl mode is full of fancy stuff :) In particular, it can rewrite (not just indent) existing code to make it conforming to styleguides. Or just to "beautify" it. That said, I don't use this often, and maybe it isn't that popular overall. My main interest isn't the fancy stuff. I want to, however, support features which have been added to Perl in the current century. Therefore I struggle to understand how CPerl mode does things, and how it probably should do things in contemporary Emacs. So, bottom line: I've understood a lot about the intention of electric-indent-mode, about the current implementation and about my own blunders. Thanks for your patience! --=20 Cheers, haj