unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alex <agrambot@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Alex Branham <alex.branham@gmail.com>, 34858@debbugs.gnu.org
Subject: bug#34858: indent-relative called with prefix calls tab-to-tab-stop
Date: Thu, 14 Mar 2019 10:45:32 -0600	[thread overview]
Message-ID: <87o96d5rrn.fsf@gmail.com> (raw)
In-Reply-To: <83wol11m5b.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 14 Mar 2019 18:00:32 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Alex Branham <alex.branham@gmail.com>
>> Date: Thu, 14 Mar 2019 10:35:13 -0500
>> 
>> If the previous nonblank line has no indent points beyond the
>> column point starts at, then `tab-to-tab-stop' is done, if both
>> FIRST-ONLY and UNINDENTED-OK are nil, otherwise nothing is done
>> in this case.
>> 
>> Yet in a buffer like this:
>> 
>> foo
>> 
>> with point at the beginning of line, C-u M-x indent-relative results in:
>> 
>>         test
>> 
>> I'm happy to submit a patch fixing this, but should it update the
>> documentation to match what happens or should it update the code to
>> match the documentation?
>
> I think this is a documentation bug, as it doesn't describe the
> special case of "no previous nonblank line".

I believe that the case of "no previous nonblank line" could be
considered as there being a single indent point at column 0, so if
FIRST-ONLY is non-nil, then `tab-to-tab-stop' shouldn't be called. How
about the following patch instead?

diff --git a/lisp/indent.el b/lisp/indent.el
index 34757a43d7..4ee4617de9 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -597,7 +597,7 @@ indent-relative
 considered.
 
 If the previous nonblank line has no indent points beyond the
-column point starts at, then `tab-to-tab-stop' is done, if both
+column point starts at, then `tab-to-tab-stop' is done if both
 FIRST-ONLY and UNINDENTED-OK are nil, otherwise nothing is done
 in this case.
 
@@ -627,7 +627,7 @@ indent-relative
              (if (> opoint (point))
                  (goto-char opoint))
              (move-marker opoint nil)))
-          (unindented-ok nil)
+          ((or unindented-ok first-only) nil)
           (t (tab-to-tab-stop)))))
 
 (defcustom tab-stop-list nil





  parent reply	other threads:[~2019-03-14 16:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-14 15:35 bug#34858: indent-relative called with prefix calls tab-to-tab-stop Alex Branham
2019-03-14 16:00 ` Eli Zaretskii
2019-03-14 16:17   ` Alex Branham
2019-03-20 20:23     ` Filipp Gunbin
2019-03-25 23:06       ` Alex Branham
2019-03-26 15:39         ` Eli Zaretskii
2019-03-26 15:42           ` Alex Branham
2019-03-26 16:47             ` Eli Zaretskii
2019-04-02  0:11     ` Basil L. Contovounesios
2019-04-02 14:40       ` Eli Zaretskii
2019-04-03 17:12         ` Basil L. Contovounesios
2019-04-06  0:52           ` Alex Branham
2019-03-14 16:45   ` Alex [this message]
2019-03-14 18:02     ` Eli Zaretskii
2019-03-14 18:57       ` Alex
2019-03-14 20:18         ` Eli Zaretskii
2019-03-14 21:27           ` Alex
2019-03-15  4:52             ` 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=87o96d5rrn.fsf@gmail.com \
    --to=agrambot@gmail.com \
    --cc=34858@debbugs.gnu.org \
    --cc=alex.branham@gmail.com \
    --cc=eliz@gnu.org \
    /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).