From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#24766: 26.0.50: [PATCH] Confusing behaviour for indent-relative-maybe Date: Sun, 23 Oct 2016 09:23:45 +0300 Message-ID: <83a8dvpor2.fsf@gnu.org> References: <8760ok8ays.fsf@gmail.com> <83lgxgp4ts.fsf@gnu.org> <871sz8894m.fsf@gmail.com> <83h984p3lb.fsf@gnu.org> <87shro6ol6.fsf@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1477203862 15125 195.159.176.226 (23 Oct 2016 06:24:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 23 Oct 2016 06:24:22 +0000 (UTC) Cc: 24766@debbugs.gnu.org To: Alex Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 23 08:24:18 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1byCCY-0002Gb-HX for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Oct 2016 08:24:10 +0200 Original-Received: from localhost ([::1]:39843 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byCCa-0004Et-Si for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Oct 2016 02:24:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48869) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byCCR-0004Dz-Hb for bug-gnu-emacs@gnu.org; Sun, 23 Oct 2016 02:24:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1byCCQ-0001NK-Il for bug-gnu-emacs@gnu.org; Sun, 23 Oct 2016 02:24:03 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59878) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1byCCQ-0001NC-Es for bug-gnu-emacs@gnu.org; Sun, 23 Oct 2016 02:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1byCCQ-0000bp-78 for bug-gnu-emacs@gnu.org; Sun, 23 Oct 2016 02:24:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 Oct 2016 06:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24766 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 24766-submit@debbugs.gnu.org id=B24766.14772038402330 (code B ref 24766); Sun, 23 Oct 2016 06:24:02 +0000 Original-Received: (at 24766) by debbugs.gnu.org; 23 Oct 2016 06:24:00 +0000 Original-Received: from localhost ([127.0.0.1]:47044 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1byCCN-0000bW-RD for submit@debbugs.gnu.org; Sun, 23 Oct 2016 02:24:00 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:57832) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1byCCM-0000bI-Ia for 24766@debbugs.gnu.org; Sun, 23 Oct 2016 02:23:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1byCCE-000176-AP for 24766@debbugs.gnu.org; Sun, 23 Oct 2016 02:23:53 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:57980) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byCCE-000170-6a; Sun, 23 Oct 2016 02:23:50 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2416 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1byCCD-0006Kp-Jm; Sun, 23 Oct 2016 02:23:49 -0400 In-reply-to: <87shro6ol6.fsf@gmail.com> (message from Alex on Sat, 22 Oct 2016 15:49:57 -0600) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:124869 Archived-At: > From: Alex > Cc: 24766@debbugs.gnu.org > Date: Sat, 22 Oct 2016 15:49:57 -0600 > > Eli Zaretskii writes: > > >> I took UNINTENDED-OK to mean that "if non-nil, nothing is done in the > >> case that there are no appropriate indentation positions. If there are > >> appropriate indentation positions, then it should indent as usual." > >> > >> The docstring could be improved to state that. > > > > Definitely. Would you like to give it a try? > > Sure. That would describe the behaviour that my diff brings -- does that > mean that you're okay with the proposed change? No, I meant to improve the doc string to describe the current behavior. > >> The optional argument is implicitly mentioned as "unless > >> this command is invoked with a numeric argument, in which case it > >> does nothing." > > > > Well, that's not how we document such functions, right? Both the > > effect of the argument, when used from Lisp, and the fact that it's > > the prefix argument in interactive invocation, should be stated. > > Indeed. Though it seems, according to commit > 1fd63d9b9bc249488ec12a49cc3a576baf8c788a, that you were the one to > document it. ;-) Yes, but my change just described one subtlety of that function, it didn't change anything about the rest. Most probably I bumped into the aspect of the behavior I described, and found it not documented at all. > > No, it's definitely not a no-op. It is only a no-op if the previous > > non-blank line has no white space at its beginning, or the current > > column is already past that first indentation point. IOW, > > indent-relative-maybe only ever indents to the first indentation > > point, and only when that indentation point is preceded by whitespace. > > Oh, I see. Sorry about missing that. For some reason I was only testing > lines that started with non-whitespace. > > I feel more hesitant to change such old behaviour now, but I still think > that it should be done. Here are the functions that call > indent-relative-maybe or call indent-relative with an argument: > > * add-change-log-entry > * mh-letter-next-header-field-or-indent > * A few functions in AUCTeX (ELPA) > > I'm not sure if they should be changed, but if they should, a new > function could be made to match the previous indent-relative-maybe > behaviour: > > (let ((first-indent (save-excursion > (re-search-backward "^[^\n]") > (backward-to-indentation 0)))) > (when (< (current-column) > first-indent) > (indent-to first-indent))) Like I said, I don't think the behavior should be changed, only the documentation, which is somewhat misleading. If we want some different behavior, we could have a new function, or a new value of the argument to indent-relative. Thanks.