GNU bug report logs - #60833
[PATCH] sh-script.el: Add support for Zsh's case branches ;|.

Previous Next

Package: emacs;

Reported by: Philippe Altherr <philippe.altherr <at> gmail.com>

Date: Sun, 15 Jan 2023 14:14:03 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Philippe Altherr <philippe.altherr <at> gmail.com>
Cc: 60833 <at> debbugs.gnu.org
Subject: bug#60833: [PATCH] sh-script.el: Add support for Zsh's case branches ; |.
Date: Sat, 21 Jan 2023 09:33:12 +0200
> From: Philippe Altherr <philippe.altherr <at> gmail.com>
> Date: Sun, 15 Jan 2023 14:28:08 +0100
> 
> In shell scripts, case branches traditionally end with ;;. Bash additionally supports case branches ending with
> ;& and ;;&. Zsh similarly supports case branches ending with ;& and ;|. Currently sh-script.el supports case
> branches ending with ;;, ;&, and ;;&, but not with ;|. The attached patch adds support for case branches
> ending with ;|.
> 
> I have tested the patch by defining all the modified functions (sh-smie-sh-rules, sh-font-lock-paren) and
> constants (sh-smie-sh-grammar, sh-smie-rc-grammar, sh-smie--sh-operators, sh-smie--sh-operators-re,
> sh-smie--sh-operators-back-re) in my .emacs (in a (with-eval-after-load 'sh-script ...) statement).
> 
> Here is an example indented without the patch:
> 
> case $input in
>     *a* ) echo A;;
>     *b* ) echo B;&
>     *c* ) echo C;;&
>     *d* ) echo D;|
> *e* ) echo E;;
> esac
> 
> and with the (simulated) patch:
> 
> case $input in
>     *a* ) echo A;;
>     *b* ) echo B;&
>     *c* ) echo C;;&
>     *d* ) echo D;|
>     *e* ) echo E;;
> esac

Thanks.  First, would it be possible to add tests for these
situations?

And second, your contributions (this and the other one) are larger
than we can accept without your assigning the copyright to the FSF.
Would you like to start your legal paperwork at this time, so that we
could accept the changes after it is completed?  If so, I will send
you the form to fill.

Thanks again for your interest in Emacs.




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

Previous Next


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