[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#24766: 26.0.50: [PATCH] Confusing behaviour for indent-relative-mayb

From: Alex
Subject: bug#24766: 26.0.50: [PATCH] Confusing behaviour for indent-relative-maybe
Date: Sat, 22 Oct 2016 15:49:57 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> From: Alex <address@hidden>
>> Cc: address@hidden
>> Date: Sat, 22 Oct 2016 13:40:57 -0600
>> >> The point does not move even when there are appropriate indentation
>> >> points to move to.
>> >
>> > It doesn't move because that's what UNINDENTED-OK means.
>> 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?

>> 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. ;-)

>> > but other than fixing the documentation, I see
>> > no reason to change the behavior.  Am I missing something?
>> IIUC the current behaviour essentially makes indent-relative-maybe a
>> no-op.
> 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

(let ((first-indent (save-excursion
                      (re-search-backward "^[^\n]")
                      (backward-to-indentation 0))))
  (when (< (current-column)
    (indent-to first-indent)))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]