GNU bug report logs - #34858
indent-relative called with prefix calls tab-to-tab-stop

Previous Next

Package: emacs;

Reported by: Alex Branham <alex.branham <at> gmail.com>

Date: Thu, 14 Mar 2019 15:36:01 UTC

Severity: normal

Done: Alex Branham <alex.branham <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 34858 <at> debbugs.gnu.org (full text, mbox):

From: Alex <agrambot <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Alex Branham <alex.branham <at> gmail.com>, 34858 <at> debbugs.gnu.org
Subject: Re: bug#34858: indent-relative called with prefix calls
 tab-to-tab-stop
Date: Thu, 14 Mar 2019 10:45:32 -0600
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Alex Branham <alex.branham <at> 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




This bug report was last modified 6 years and 102 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.