unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ola Nilsson <ola.nilsson@gmail.com>
To: Noam Postavsky <npostavs@gmail.com>
Cc: 36317@debbugs.gnu.org
Subject: bug#36317: [PATCH v2] Allow underscore in defun-prompt-regex names for sh-script
Date: Wed, 26 Jun 2019 22:58:06 +0200	[thread overview]
Message-ID: <CAKyOKyEo6qeYgRo+6S1dXOhwJOOXMmX_HhwzoTSHX+yCP=xS7A@mail.gmail.com> (raw)
In-Reply-To: <85y31p69y7.fsf@gmail.com>

On Tue, Jun 25, 2019 at 4:01 PM Noam Postavsky <npostavs@gmail.com> wrote:
>
> Ola Nilsson <ola.nilsson@gmail.com> writes:
>
> > * lisp/progmodes/sh-script.el (defun-prompt-regexp):
> > Allow underscore in function names.
>
> Do you think we should allow dashes as too (as suggested in Bug#21477)?

Bug#21477 will not be fixed by changing defun-prompt-regexp.

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.

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.

-- 
Ola Nilsson





  reply	other threads:[~2019-06-26 20:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-20 23:01 bug#36317: [PATCH] Correct the name part of defun-prompt-regex in sh-script-mode Ola Nilsson
2019-06-22  4:13 ` Richard Stallman
2019-06-24 20:23   ` Ola Nilsson
2019-06-23 21:00 ` bug#36317: [PATCH v2] Allow underscore in defun-prompt-regex names for sh-script Ola Nilsson
2019-06-25 14:01   ` Noam Postavsky
2019-06-26 20:58     ` Ola Nilsson [this message]
2019-06-28  0:15       ` Noam Postavsky

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='CAKyOKyEo6qeYgRo+6S1dXOhwJOOXMmX_HhwzoTSHX+yCP=xS7A@mail.gmail.com' \
    --to=ola.nilsson@gmail.com \
    --cc=36317@debbugs.gnu.org \
    --cc=npostavs@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).