unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Alex <agrambot@gmail.com>
Cc: 24766@debbugs.gnu.org
Subject: bug#24766: 26.0.50: [PATCH] Confusing behaviour for indent-relative-maybe
Date: Sun, 23 Oct 2016 09:23:45 +0300	[thread overview]
Message-ID: <83a8dvpor2.fsf@gnu.org> (raw)
In-Reply-To: <87shro6ol6.fsf@gmail.com> (message from Alex on Sat, 22 Oct 2016 15:49:57 -0600)

> From: Alex <agrambot@gmail.com>
> Cc: 24766@debbugs.gnu.org
> Date: Sat, 22 Oct 2016 15:49:57 -0600
> 
> Eli Zaretskii <eliz@gnu.org> 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.





  reply	other threads:[~2016-10-23  6:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-22 19:01 bug#24766: 26.0.50: [PATCH] Confusing behaviour for indent-relative-maybe Alex
2016-10-22 19:21 ` Eli Zaretskii
2016-10-22 19:40   ` Alex
2016-10-22 19:48     ` Eli Zaretskii
2016-10-22 21:49       ` Alex
2016-10-23  6:23         ` Eli Zaretskii [this message]
2016-10-23 20:43           ` Alex
2016-10-24  8:23             ` Eli Zaretskii
2016-10-24 19:27               ` Alex
2016-10-24 19:57                 ` Eli Zaretskii
2016-11-08  1:53                   ` Alex
2016-11-08 15:07                     ` Eli Zaretskii
2016-11-08 19:09                       ` Alex
2016-11-08 20:26                         ` Eli Zaretskii
2016-11-18  9:04                         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83a8dvpor2.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=24766@debbugs.gnu.org \
    --cc=agrambot@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).