GNU bug report logs - #43324
Auto-indenting csh/tcsh shell scripts [emacs-28]

Previous Next

Package: emacs;

Reported by: Kaushal Modi <kaushal.modi <at> gmail.com>

Date: Fri, 11 Sep 2020 03:26:02 UTC

Severity: normal

To reply to this bug, email your comments to 43324 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#43324; Package emacs. (Fri, 11 Sep 2020 03:26:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kaushal Modi <kaushal.modi <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 11 Sep 2020 03:26:02 GMT) Full text and rfc822 format available.

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

From: Kaushal Modi <kaushal.modi <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Auto-indenting csh/tcsh shell scripts [emacs-28]
Date: Thu, 10 Sep 2020 23:25:01 -0400
[Message part 1 (text/plain, inline)]
Hello,

I had some old csh auto-indentation code from
https://github.com/Tux/tcsh/blob/tux/csh-mode.el that worked pretty well
but relied on the code that got removed in
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=f9504ffba2e2604338c243dd77c877bbb8162e4a

I had this code that relied on the now-removed code:
https://github.com/kaushalmodi/.emacs.d/blob/fec110f5281e0bd4fe5c16ca18832e1df1c8f27f/setup-files/setup-shell.el#L43-L148

Can you please add SMIE auto-indentation support for csh/tcsh shell scripts?


--
Kaushal Modi
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43324; Package emacs. (Mon, 06 Jun 2022 16:21:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Kaushal Modi <kaushal.modi <at> gmail.com>
Cc: 43324 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#43324: Auto-indenting csh/tcsh shell scripts [emacs-28]
Date: Mon, 06 Jun 2022 18:20:45 +0200
Kaushal Modi <kaushal.modi <at> gmail.com> writes:

> I had this code that relied on the now-removed code:
> https://github.com/kaushalmodi/.emacs.d/blob/fec110f5281e0bd4fe5c16ca18832e1df1c8f27f/setup-files/setup-shell.el#L43-L148
>
> Can you please add SMIE auto-indentation support for csh/tcsh shell scripts?

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

Does this mean that indentation doesn't work for tcsh in
shell-script-mode?  I had a brief look at a tcsh script and did some
indentation, and it seemed to work OK for me.

What are the bits that are missing?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 06 Jun 2022 16:22:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43324; Package emacs. (Mon, 06 Jun 2022 16:46:02 GMT) Full text and rfc822 format available.

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

From: Kaushal Modi <kaushal.modi <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 43324 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#43324: Auto-indenting csh/tcsh shell scripts [emacs-28]
Date: Mon, 6 Jun 2022 12:44:35 -0400
[Message part 1 (text/plain, inline)]
On Mon, Jun 6, 2022 at 12:20 PM Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
> Does this mean that indentation doesn't work for tcsh in
> shell-script-mode?  I had a brief look at a tcsh script and did some
> indentation, and it seemed to work OK for me.
>
> What are the bits that are missing?

Hi Lars,

Thank you for following up on this. tcsh script indentation is still
broken on the 28.1 release for me.

Here's a GIF recording (attached with this email) showing me opening a
tcsh script in emacs -Q and attempting to auto-indent the whole buffer
and also a region. Both mess up the whole indentation.


Example script:

=====
#!/bin/tcsh -f
# Time-stamp: <2015-05-22 10:30:53 kmodi>

# This script splits the pane depending on the current panes height and width
# The result is to not result in too narrow or too wide panes after split

set pane_height=`tmux display -p -F '#{pane_height}'`
set pane_width=`tmux display -p -F '#{pane_width}'`
# echo "Pane Height = $pane_height"
# echo "Pane Width  = $pane_width"

# for the small Dell monitor when the terminal is full screen
# Small Dell monitor resolution = 1600 x 1200
#  width in chars = 174, height in chars = 59
# Normalize the pane height and width (resolution/char)
set height_factor = `expr 1200 / 59`
set width_factor  = `expr 1600 / 174`
set pane_height_norm = `expr $pane_height \* $height_factor`
set pane_width_norm  = `expr $pane_width  \* $width_factor`
# echo "Pane Height factor = $height_factor"
# echo "Pane Width factor  = $width_factor"
# echo "Pane Height normalized = $pane_height_norm"
# echo "Pane Width  normalized = $pane_width_norm"

if ( $pane_width_norm > $pane_height_norm ) then
   tmux split-window -h "$*" # splits current pane vertically
else
   tmux split-window -v "$*" # splits current pane horizontally
endif
=====
[tcsh_auto_indentation.gif (image/gif, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43324; Package emacs. (Mon, 06 Jun 2022 17:00:02 GMT) Full text and rfc822 format available.

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

From: Kaushal Modi <kaushal.modi <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 43324 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#43324: Auto-indenting csh/tcsh shell scripts [emacs-28]
Date: Mon, 6 Jun 2022 12:58:36 -0400
> Here's a GIF recording (attached with this email) showing me opening a
> tcsh script in emacs -Q and attempting to auto-indent the whole buffer
> and also a region. Both mess up the whole indentation.

Oops! That GIF decided not to get recorded. Here's my second attempt:
https://i.imgur.com/sQg1yXS.gif




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43324; Package emacs. (Mon, 06 Jun 2022 17:04:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 43324 <at> debbugs.gnu.org, Kaushal Modi <kaushal.modi <at> gmail.com>
Subject: Re: bug#43324: Auto-indenting csh/tcsh shell scripts [emacs-28]
Date: Mon, 06 Jun 2022 13:03:29 -0400
> Does this mean that indentation doesn't work for tcsh in
> shell-script-mode?

IIRC sh-script.el provides usable indentation (based on SMIE) for `sh`
and for `rc` but for `csh` there's basically nothing (or if there's
something it's naive enough to be nearly unusable).


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43324; Package emacs. (Tue, 07 Jun 2022 09:21:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Kaushal Modi <kaushal.modi <at> gmail.com>
Cc: 43324 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#43324: Auto-indenting csh/tcsh shell scripts [emacs-28]
Date: Tue, 07 Jun 2022 11:20:36 +0200
Kaushal Modi <kaushal.modi <at> gmail.com> writes:

> Here's a GIF recording (attached with this email) showing me opening a
> tcsh script in emacs -Q and attempting to auto-indent the whole buffer
> and also a region. Both mess up the whole indentation.
>
> Example script:

Thanks for the example.

Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> Does this mean that indentation doesn't work for tcsh in
>> shell-script-mode?
>
> IIRC sh-script.el provides usable indentation (based on SMIE) for `sh`
> and for `rc` but for `csh` there's basically nothing (or if there's
> something it's naive enough to be nearly unusable).

Ah, I see.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Removed tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 05 Jul 2022 11:38:02 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 346 days ago.

Previous Next


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