Subject: bug#36317: [PATCH] Correct the name part of defun-prompt-regex in sh-script-mode

From: Richard Stallman <[email-masked]>
Date: Sat, 22 Jun 2019 00:13:01 -0400

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > POSIX.1-2017 defines that functions should have a name that
  > 'consisting solely of underscores, digits, and alphabetics from the
  > portable character set'.

Ok.

			      Make sure the name part of
  > defun-prompt-regexp starts with a letter and allows underscores.

It should try to recognize anything that POSIX says is valid.
However, rejecting something just because POSIX says it is invalid
is a non-goal.

If the names that POSIX does not like actually work in some shells,
that is an _extension_.  Maybe some users use that extension.  If they
do use it, Emacs should highlight their code right.

Maybe shells don't support such function names.  If so, maybe the
change not to highlight them is good -- maybe.  Highlighting erroneous
function names might be helpful for the user.  When person runs the
script, and gets an error, person will change the name.  Until then,
highlighting the name during editing might still be helpful.

The point is, do not leap straight from "POSIX says this is invalid"
to "Emacs should not recognize it."  That is not the right way to
think about questions like this.

In the GNU Project, we treat standards as guides, not authorities.  We
follow standards when and as that serves users; we do not "obey" them.

See the GNU Coding Standards, section Non-GNU Standards.

-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)