Subject: bug#21477: 24.4; Imenu - improper parse of shell function names

From: Stefan Kangas <[email-masked]>
Date: Tue, 11 Aug 2020 21:15:38 -0700

tags 21477 + moreinfo
thanks

"Matthew Persico (BLOOMBERG/ 731 LEX)" <[email-masked]> 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