all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Carlos Pita <carlosjosepita@gmail.com>
To: 19754@debbugs.gnu.org
Subject: bug#19754: sh-script.el: mostly wrong defun-prompt-regexp
Date: Mon, 2 Feb 2015 23:05:31 -0300	[thread overview]
Message-ID: <CAELgYhe17wrQ9RjZcHM-o0tT9YV+dC+Va1VxUxNu0XVVjAaeyw@mail.gmail.com> (raw)

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





             reply	other threads:[~2015-02-03  2:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-03  2:05 Carlos Pita [this message]
2016-02-23 11:15 ` bug#19754: sh-script.el: mostly wrong defun-prompt-regexp Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAELgYhe17wrQ9RjZcHM-o0tT9YV+dC+Va1VxUxNu0XVVjAaeyw@mail.gmail.com \
    --to=carlosjosepita@gmail.com \
    --cc=19754@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.