GNU bug report logs -
#60832
[PATCH] sh-script.el: Use sh-indent-for-continuation to indent line continuations.
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 60832 in the body.
You can then email your comments to 60832 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60832
; Package
emacs
.
(Sun, 15 Jan 2023 14:14:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Philippe Altherr <philippe.altherr <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 15 Jan 2023 14:14:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
The variable sh-indent-for-continuation
<https://github.com/emacs-mirror/emacs/blob/77ca6aa56e3425c87861cab8abce52bee3697cf4/lisp/progmodes/sh-script.el#L1300>
is defined in sh-script.el as "How much to indent for a continuation
statement." but it is never used. In particular, the function
sh-smie--indent-continuation
<https://github.com/emacs-mirror/emacs/blob/77ca6aa56e3425c87861cab8abce52bee3697cf4/lisp/progmodes/sh-script.el#L2000>,
which indents line continuations, doesn't use it and instead uses
sh-basic-offset. The attached patch modifies
sh-smie--indent-continuation to use sh-indent-for-continuation instead of
sh-basic-offset.
I have tested the patch by adding the patched function
sh-smie--indent-continuation to my .emacs (in a (with-eval-after-load
'sh-script ...) statement).
Here are details of what changes on the example used in the description of
sh-indent-after-continuation
<https://github.com/emacs-mirror/emacs/blob/77ca6aa56e3425c87861cab8abce52bee3697cf4/lisp/progmodes/sh-script.el#L1965>.
In all cases I have used the following settings:
(setq sh-basic-offset 4)
(setq sh-indent-for-continuation '++)
- With (setq sh-indent-after-continuation 'always), I get the following
result with the unpatched function:
for f \
in a; do \
toto; \
done
This looks wrong to me because it doesn't take into account my setting
(setq sh-indent-for-continuation '++) for line continuations. With the
patched function I get the expected result:
for f \
in a; do \
toto; \
done
- With (setq sh-indent-after-continuation nil), I get the following
result with the unpatched and the patched function:
for f \
in a; do \
toto; \
done
This looks correct to me. My understanding is that with (setq
sh-indent-after-continuation nil), line continuations are kind of ignored
and thus the setting (setq sh-indent-for-continuation '++) should never
intervene, which is also the case.
- With (setq sh-indent-after-continuation t), I get the following result
with the unpatched function:
for f \
in a; do \
toto; \
done
With the patched function, I get the following result:
for f \
in a; do \
toto; \
done
I think that's also what's expected with (setq
sh-indent-for-continuation '++) but I'm not entirely sure as I don't fully
understand how (setq sh-indent-after-continuation t) is supposed to work.
Overall, I'm pretty confident that the first change in my patch should be
done. It's what affects the setting (setq sh-indent-after-continuation
'always). I'm a bit less confident about the second change, which affects
the setting (setq sh-indent-after-continuation t).
Philippe
[Message part 2 (text/html, inline)]
[0001-For-line-continuations-use-sh-indent-for-continuatio.patch (application/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60832
; Package
emacs
.
(Mon, 23 Jan 2023 05:53:04 GMT)
Full text and
rfc822 format available.
Message #8 received at 60832 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Here is an updated patch that includes a test case. I was able to test it
in my *scratch* buffer. Please double-check that it works as intended.
On Sun, Jan 15, 2023 at 3:14 PM GNU bug Tracking System <
help-debbugs <at> gnu.org> wrote:
> Thank you for filing a new bug report with debbugs.gnu.org.
>
> This is an automatically generated reply to let you know your message
> has been received.
>
> Your message is being forwarded to the package maintainers and other
> interested parties for their attention; they will reply in due course.
>
> Your message has been sent to the package maintainer(s):
> bug-gnu-emacs <at> gnu.org
>
> If you wish to submit further information on this problem, please
> send it to 60832 <at> debbugs.gnu.org.
>
> Please do not send mail to help-debbugs <at> gnu.org unless you wish
> to report a problem with the Bug-tracking system.
>
> --
> 60832: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60832
> GNU Bug Tracking System
> Contact help-debbugs <at> gnu.org with problems
>
[Message part 2 (text/html, inline)]
[0001-For-line-continuations-use-sh-indent-for-continuatio.patch (application/octet-stream, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60832
; Package
emacs
.
(Fri, 17 Feb 2023 15:22:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 60832 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Here is an updated patch against the current master branch.
On Mon, Jan 23, 2023 at 5:18 AM Philippe Altherr <philippe.altherr <at> gmail.com>
wrote:
> Here is an updated patch that includes a test case. I was able to test it
> in my *scratch* buffer. Please double-check that it works as intended.
>
>
> On Sun, Jan 15, 2023 at 3:14 PM GNU bug Tracking System <
> help-debbugs <at> gnu.org> wrote:
>
>> Thank you for filing a new bug report with debbugs.gnu.org.
>>
>> This is an automatically generated reply to let you know your message
>> has been received.
>>
>> Your message is being forwarded to the package maintainers and other
>> interested parties for their attention; they will reply in due course.
>>
>> Your message has been sent to the package maintainer(s):
>> bug-gnu-emacs <at> gnu.org
>>
>> If you wish to submit further information on this problem, please
>> send it to 60832 <at> debbugs.gnu.org.
>>
>> Please do not send mail to help-debbugs <at> gnu.org unless you wish
>> to report a problem with the Bug-tracking system.
>>
>> --
>> 60832: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60832
>> GNU Bug Tracking System
>> Contact help-debbugs <at> gnu.org with problems
>>
>
[Message part 2 (text/html, inline)]
[0001-For-line-continuations-use-sh-indent-for-continuatio.patch (application/octet-stream, attachment)]
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
You have taken responsibility.
(Thu, 02 Mar 2023 10:43:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Philippe Altherr <philippe.altherr <at> gmail.com>
:
bug acknowledged by developer.
(Thu, 02 Mar 2023 10:43:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 60832-done <at> debbugs.gnu.org (full text, mbox):
> From: Philippe Altherr <philippe.altherr <at> gmail.com>
> Date: Fri, 17 Feb 2023 16:21:36 +0100
>
> Here is an updated patch against the current master branch.
Thanks, installed on master.
Please in the future accompany the changes with a ChangeLog-style
commit log messages (see CONTRIBUTE for details). Also, the summary
in the Subject line cannot be longer than 78 characters (again
mentioned in CONTRIBUTE), otherwise our Git commit hooks reject the
patch, and I need to apply it by hand.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 30 Mar 2023 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 45 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.