GNU bug report logs - #21477
24.4; Imenu - improper parse of shell function names

Previous Next

Package: emacs;

Reported by: Matthew Persico <mpersico5 <at> bloomberg.net>

Date: Mon, 14 Sep 2015 15:29:02 UTC

Severity: normal

Merged with 52319, 52928, 54265, 56003, 57255, 58554

Found in version 24.4

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: "Matthew Persico (BLOOMBERG/ 919 3RD A)" <mpersico5 <at> bloomberg.net>
To: stefan <at> marxist.se
Cc: 21477 <at> debbugs.gnu.org
Subject: bug#21477: 24.4; Imenu - improper parse of shell function names
Date: Wed, 12 Aug 2020 13:51:44 -0000
[Message part 1 (text/plain, inline)]
Interesting. I have function names with dashes all over and nothing complains. Not Bash 4.X, not shellcheck. If you ran that file in the post, it would not complain.

Now, you can't use dashes in variables. But functions work just fine.

I wonder if the bash manual needs an update?

From: stefan <at> marxist.se At: 08/12/20 00:15:40To:  Matthew Persico (BLOOMBERG/ 919 3RD A ) 
Cc:  21477 <at> debbugs.gnu.org
Subject: Re: bug#21477: 24.4; Imenu - improper parse of shell function names

tags 21477 + moreinfo
thanks

"Matthew Persico (BLOOMBERG/ 731 LEX)" <mpersico5 <at> bloomberg.net> writes:

> 1) Create a file with this text:
> # -*- sh -*-
> this_is_parsed ()
> {
> echo 1
> }
>
> function this_is_also_parsed
> {
> echo 1
> }
>
> this-is-not-parsed ()
> {
> echo 1
> }
>
> function this-is-also-not-parsed
> {
> echo 1
> }
>
> 2) Load it into emacs that has imenu.
>
> 3) Look for functions in the imenu list. Only the ones with '_' show up. The 
ones with '-' do not.

I can reproduce this behaviour, but is it really a bug?  Aren't the
names with '-' invalid?

The Bash Reference Manual says:

name

    A word consisting solely of letters, numbers, and underscores, and
    beginning with a letter or underscore. Names are used as shell
    variable and function names. Also referred to as an identifier.

https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html

Best regards,
Stefan Kangas


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

This bug report was last modified 224 days ago.

Previous Next


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