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

Previous Next

Package: emacs;

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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 19754 in the body.
You can then email your comments to 19754 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#19754; Package emacs. (Tue, 03 Feb 2015 02:07:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Carlos Pita <carlosjosepita <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 03 Feb 2015 02:07:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Carlos Pita <carlosjosepita <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: sh-script.el: mostly wrong defun-prompt-regexp
Date: Mon, 2 Feb 2015 23:05:31 -0300
Tags: patch

The defun regexp is defined for sh-sript mode as:

  (setq-local defun-prompt-regexp
     (concat "^\\(function[ \t]\\|[[:alnum:]]+[ \t]+()[ \t]+\\)"))


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]*"))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#19754; Package emacs. (Tue, 23 Feb 2016 11:17:02 GMT) Full text and rfc822 format available.

Message #8 received at 19754 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Carlos Pita <carlosjosepita <at> gmail.com>
Cc: 19754 <at> debbugs.gnu.org
Subject: Re: bug#19754: sh-script.el: mostly wrong defun-prompt-regexp
Date: Tue, 23 Feb 2016 22:15:55 +1100
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




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 23 Feb 2016 11:17:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 25.2, send any further explanations to 19754 <at> debbugs.gnu.org and Carlos Pita <carlosjosepita <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 23 Feb 2016 11:17:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 22 Mar 2016 11:24:04 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 04 Dec 2016 02:50:07 GMT) Full text and rfc822 format available.

bug Marked as fixed in versions 26.1. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 04 Dec 2016 02:50:07 GMT) Full text and rfc822 format available.

bug No longer marked as fixed in versions 25.2. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 04 Dec 2016 02:50:07 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 01 Jan 2017 12:24:18 GMT) Full text and rfc822 format available.

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.