unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#43324: Auto-indenting csh/tcsh shell scripts [emacs-28]
@ 2020-09-11  3:25 Kaushal Modi
  2022-06-06 16:20 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Kaushal Modi @ 2020-09-11  3:25 UTC (permalink / raw)
  To: 43324, monnier

[-- Attachment #1: Type: text/plain, Size: 538 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1098 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#43324: Auto-indenting csh/tcsh shell scripts [emacs-28]
  2020-09-11  3:25 bug#43324: Auto-indenting csh/tcsh shell scripts [emacs-28] Kaushal Modi
@ 2022-06-06 16:20 ` Lars Ingebrigtsen
  2022-06-06 16:44   ` Kaushal Modi
  2022-06-06 17:03   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-06 16:20 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: 43324, monnier

Kaushal Modi <kaushal.modi@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





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#43324: Auto-indenting csh/tcsh shell scripts [emacs-28]
  2022-06-06 16:20 ` Lars Ingebrigtsen
@ 2022-06-06 16:44   ` Kaushal Modi
  2022-06-06 16:58     ` Kaushal Modi
  2022-06-07  9:20     ` Lars Ingebrigtsen
  2022-06-06 17:03   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 2 replies; 6+ messages in thread
From: Kaushal Modi @ 2022-06-06 16:44 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 43324, Stefan Monnier

[-- Attachment #1: Type: text/plain, Size: 1810 bytes --]

On Mon, Jun 6, 2022 at 12:20 PM Lars Ingebrigtsen <larsi@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
=====

[-- Attachment #2: tcsh_auto_indentation.gif --]
[-- Type: image/gif, Size: 23779 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#43324: Auto-indenting csh/tcsh shell scripts [emacs-28]
  2022-06-06 16:44   ` Kaushal Modi
@ 2022-06-06 16:58     ` Kaushal Modi
  2022-06-07  9:20     ` Lars Ingebrigtsen
  1 sibling, 0 replies; 6+ messages in thread
From: Kaushal Modi @ 2022-06-06 16:58 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 43324, Stefan Monnier

> 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





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#43324: Auto-indenting csh/tcsh shell scripts [emacs-28]
  2022-06-06 16:20 ` Lars Ingebrigtsen
  2022-06-06 16:44   ` Kaushal Modi
@ 2022-06-06 17:03   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 6+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-06-06 17:03 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 43324, Kaushal Modi

> 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






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#43324: Auto-indenting csh/tcsh shell scripts [emacs-28]
  2022-06-06 16:44   ` Kaushal Modi
  2022-06-06 16:58     ` Kaushal Modi
@ 2022-06-07  9:20     ` Lars Ingebrigtsen
  1 sibling, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-07  9:20 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: 43324, Stefan Monnier

Kaushal Modi <kaushal.modi@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@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





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-07  9:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-11  3:25 bug#43324: Auto-indenting csh/tcsh shell scripts [emacs-28] Kaushal Modi
2022-06-06 16:20 ` Lars Ingebrigtsen
2022-06-06 16:44   ` Kaushal Modi
2022-06-06 16:58     ` Kaushal Modi
2022-06-07  9:20     ` Lars Ingebrigtsen
2022-06-06 17:03   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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).