GNU bug report logs - #77746
[PATCH] sh-mode: Fix incorrect word syntax for punctuation in sh-mode

Previous Next

Package: emacs;

Reported by: James Cherti <contact <at> jamescherti.com>

Date: Fri, 11 Apr 2025 14:56:02 UTC

Severity: normal

Tags: patch

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

Bug is archived. No further changes may be made.

Full log


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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>,
 James Cherti <contact <at> jamescherti.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 77746 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#77746: [PATCH] sh-mode: Fix incorrect word syntax for
 punctuation in sh-mode
Date: Thu, 17 Apr 2025 02:43:14 +0300
Hi! Regarding this:

On 15/04/2025 23:46, Stefan Monnier via Bug reports for GNU Emacs, the 
Swiss army knife of text editors wrote:
> I added Dmitry to the Cc because AFAICT he's the last one to have
> changed that syntax-table and he seems to have changed it for the same
> kind of reasons as you:
> 
>      commit f6277911eb2c520aec8f0efd80c91999226e3322
>      Author: Dmitry Gutov<dgutov <at> yandex.ru>
>      Date:   Fri Oct 2 07:11:56 2020 +0200
>      
>          Make xref work better on variables in shell-script-mode
>          
>          * lisp/progmodes/sh-script.el (sh-mode-syntax-table): Classify "/"
>          as punctuation so that `M-.' on $foo/bar works on the $foo part
>          (bug#25585).
>      
>      diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
>      --- a/lisp/progmodes/sh-script.el
>      +++ b/lisp/progmodes/sh-script.el
>      @@ -370,26 +370,27 @@
>       (defvar sh-mode-syntax-table
>      [...]
>               ?= "."
>      +        ?/ "."
>               ?\; "."
>               ?| "."
> 
> Apparently this change hasn't brought any trouble over the last 5 years,
> so that's encouraging.

Sorry to say, I don't have much more experience with these files. The 
'/' character seemed safe enough, since it sounds silly to define 
symbols including it, given how prevalent its other use in scripts.

A lot of the questions that have been brought up in this thread seem 
very good. In particular, is there a more urgent subset of the 
characters that we would want to change, and what are the code examples 
that would be affected? Even if we just list the positive cases. But 
preferably realistic.

E.g. this one from the screenshot:

  var%name=1

What is such code supposed to do? Is that an assignment inside the 
modulo operation?

More generally, a good argument for a wholesale change could be made 
with be an analysis of some larger body of shell scripts. For example, 
the Git codebase has a lot of .sh files (even if a lot of them are in 
the 't' directory). Better examples welcome.




This bug report was last modified 107 days ago.

Previous Next


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