Subject: bug#52319: imenu not detecting every bash function

From: [email-masked]
Date: Wed, 8 Dec 2021 08:29:36 +0100 (CET)

Dec 5, 2021, 22:48 by [email-masked]:

> fatiparty--- via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <[email-masked]> writes:
>
>> I am loading the attached bash file but imenu is not showing all the
>> declared bash functions in the file, it only shows PF(), PFB(), PF2(),
>> and pfm.  This has also the consequence of not displaying all
>> functions in speedbar.
>>
>> File is attached.
>>
>> Fati
>>
>
> The problem lies in that some of the functions have a hyphen in their
> name (for example "linge-newline ()").  Something like "linge_newline
> ()" should be detected correctly.  If I'm not mistaken, POSIX requires
> that shell function names only contain alphanumeric characters or an
> underscore; support for hyphens could be a Bash extension.
>
> One way to fix the issue could be to extend the
> sh-imenu-generic-expression alist in sh-script.el with a specific regexp
> for bash that accounts for hyphens (and any other character that Bash
> may support in function names).
>
It would help me a lot if I can see all supported bash function names in the speedbar.
Currently this is slowing me down when going through the code base.