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 #50 received at 77746 <at> debbugs.gnu.org (full text, mbox):

From: James Cherti <contact <at> jamescherti.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Stefan Monnier <monnier <at> iro.umontreal.ca>,
 Juri Linkov <juri <at> linkov.net>
Cc: 77746 <at> debbugs.gnu.org
Subject: Re: bug#77746: [PATCH] sh-mode: Fix incorrect word syntax for
 punctuation in sh-mode
Date: Mon, 14 Apr 2025 15:39:24 -0400
[Message part 1 (text/plain, inline)]
Attached: v2 of this patch

This patch marks only the following characters as
punctuation: !%^~:,

I removed . because it is commonly used in command names
(e.g., mkfs.ext4).

(Excluding '.' not only covers the majority of command and
function names but also prevents using ,!%^~: as
symbol constituents, resulting in more accurate
variable symbols.)

--
James Cherti
GitHub: https://github.com/jamescherti
Website: https://www.jamescherti.com/

On 2025-04-13 05:45, Eli Zaretskii wrote:
>> Date: Fri, 11 Apr 2025 10:55:02 -0400
>> From: James Cherti <contact <at> jamescherti.com>
>>
>> In sh and Bash, the characters !%^~:.,= and are not valid in variable or
>> function names.
>>
>> Assigning them the "_" syntax causes Emacs to treat them as word
>> constituents, disrupting navigation and completion
>> (e.g. dabbrev-expand, forward-word, etc.).
>>
>> The attached patch updates the syntax table in sh-mode to mark
>> these characters as punctuation, correcting the issue.
> 
> Thanks.
> 
> TBH, such a change sounds scary, as it could cause all kinds of
> unintended changes in behavior.
> 
> I've added a couple of people who might know this mode better than I
> do, in the hope that they will have comments or opinions.
[fix-sh-mode-syntax-table-v2.patch (text/x-patch, attachment)]

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.