bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#36317: [PATCH v2] Allow underscore in defun-prompt-regex names for s


From: Noam Postavsky
Subject: bug#36317: [PATCH v2] Allow underscore in defun-prompt-regex names for sh-script
Date: Thu, 27 Jun 2019 20:15:17 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux)

tags 36317 fixed
close 36317 27.1
quit

Ola Nilsson <ola.nilsson@gmail.com> writes:

> sh-script.el does not have a centralized way of dealing with function names.
>
> * imenu (the problem in Bug#21477) does not use defun-prompt-regexp,
> but rather its
>   own regexp found in sh-imenu-generic-expression.  Funnily enough
> those function
>   names _do_ follow the posix standard (letters, digits, underscore,
> must not start with
>   a digit).
> * sh-current-defun-name also has its own regexps, matching those of
>   sh-imenu-generic-expression.
> * sh-font-lock-keyword-var uses "\\sw+" which is a lot less strict with what
>   characters can be included.
> * sh-completion-at-point-function uses "[[:alnum:]_]" to skip to
> beginning and end
>   of a function name.
>
> I assume there are some other cases that I missed.

Darn, that's a lot more complicated than I was hoping.

> As far as I can tell from a quick search of shell manuals and net
> questions most shells stick to the posix spec. Bash is the exception
> and seems to be very forgiving at least as long as you use the
> 'function name() {...}' format.
>
> So I guess it boils down to how allowing we want to be.

IMO, allowing more things makes sense, but I've just gone ahead and push
your patch v2 to master, since it's clearly a step in the right
direction.  Cleaning up the rest of the mess would be nice too, but it
looks like a lot of untangling to be done.

fa3af359df 2019-06-27T20:02:54-04:00 "Allow underscore in defun-prompt-regex 
names for sh-script"
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=fa3af359df8754423a197682d31245ad88c02033





reply via email to

[Prev in Thread] Current Thread [Next in Thread]