GNU bug report logs - #36317
[PATCH] Correct the name part of defun-prompt-regex in sh-script-mode

Previous Next

Package: emacs;

Reported by: Ola Nilsson <ola.nilsson <at> gmail.com>

Date: Thu, 20 Jun 2019 23:18:01 UTC

Severity: normal

Tags: fixed, patch

Fixed in version 27.1

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ola Nilsson <ola.nilsson <at> gmail.com>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 36317 <at> 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
On Tue, Jun 25, 2019 at 4:01 PM Noam Postavsky <npostavs <at> gmail.com> wrote:
>
> Ola Nilsson <ola.nilsson <at> 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




This bug report was last modified 5 years and 329 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.