GNU bug report logs -
#19754
sh-script.el: mostly wrong defun-prompt-regexp
Previous Next
Reported by: Carlos Pita <carlosjosepita <at> gmail.com>
Date: Tue, 3 Feb 2015 02:07:02 UTC
Severity: normal
Tags: fixed, patch
Fixed in version 26.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Carlos Pita <carlosjosepita <at> gmail.com> 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
This bug report was last modified 8 years and 172 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.