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

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

bug#19754: sh-script.el: mostly wrong defun-prompt-regexp


From: Lars Ingebrigtsen
Subject: bug#19754: sh-script.el: mostly wrong defun-prompt-regexp
Date: Tue, 23 Feb 2016 22:15:55 +1100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Carlos Pita <address@hidden> writes:

> At least in bash you have several valid forms not allowed by that regexp:
>
> 1) spaces between (, ), and { are optional
>
> 2) function name {...} (indeed, function {} is not even valid!)
>
> 3) function name () {...}
>
> 4) function          name() {...}
>
> Also the concat seems pointless to me.
>
> Here is a patched version:
>
> (setq-local defun-prompt-regexp
>         (concat
>          "^\\("
>          "\\(function[ \t]\\)?[ \t]*[[:alnum:]]+[ \t]*([ \t]*)"
>          "\\|"
>          "function[ \t]+[[:alnum:]]+[ \t]*\\(([ \t]*)\\)?"
>          "\\)[ \t]*"))

I've tried a few function definition forms in bash scripts, and your
regexp seems to give much better `C-M-a' action, so I've applied it to
the Emacs trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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