From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#36317: [PATCH] Correct the name part of defun-prompt-regex in sh-script-mode Resent-From: Ola Nilsson Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 20 Jun 2019 23:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 36317 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 36317@debbugs.gnu.org Cc: Ola Nilsson X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.156107266711169 (code B ref -1); Thu, 20 Jun 2019 23:18:01 +0000 Received: (at submit) by debbugs.gnu.org; 20 Jun 2019 23:17:47 +0000 Received: from localhost ([127.0.0.1]:49415 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1he6JP-0002u5-CY for submit@debbugs.gnu.org; Thu, 20 Jun 2019 19:17:47 -0400 Received: from lists.gnu.org ([209.51.188.17]:42093) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1he6JM-0002tx-NK for submit@debbugs.gnu.org; Thu, 20 Jun 2019 19:17:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50484) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1he6JK-0000A7-K9 for bug-gnu-emacs@gnu.org; Thu, 20 Jun 2019 19:17:44 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1he642-00045S-0H for bug-gnu-emacs@gnu.org; Thu, 20 Jun 2019 19:01:56 -0400 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]:40380) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1he63s-00041l-RK for bug-gnu-emacs@gnu.org; Thu, 20 Jun 2019 19:01:47 -0400 Received: by mail-lj1-x241.google.com with SMTP id a21so4221878ljh.7 for ; Thu, 20 Jun 2019 16:01:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=U1vhVEgs1+th3BOpaR2/7AunLyFVfwbl7IStUqFFTMU=; b=C4mWQsBHe6JsMTquIsR/eGspCK0ZaFYijyiGhflEH+GufER+AQQee9fwT8iUyMqMrV 69ZmiVul3h1RTzK3L7uOT51Iq9WDJLXYv+SobZbbk+O4O6W+vZmCIn5SUpwSAA30rxu5 INT+Cjobb8Y4ZghJj+i/rw5a9m8Vk2kj7V6VzgYR0+u77dndvUGjT6AIm+whhhx/xq2P riodr1xcb3/TlWfMMlB8zQ1d8pXNGFLYluDYq+V8XmtSKgrV5Cyx04d7nWtAnqWAwMkv fWEdxApg3d71YLbco2u+HNSXh6X3mT8cjbKEU8byd9yz3hFtfYQKzbLpkTb4ov3rtixS cqqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=U1vhVEgs1+th3BOpaR2/7AunLyFVfwbl7IStUqFFTMU=; b=ss6JLFQ7/4o0z10iNHC1IerJd2W6HJlQJoZEkEF1vnH9BF8zsntzoColKGnVpVMcE5 ze6b3ZaHqr3aOCh2lZEw7H/iTKIQIVXbCr22Ud08NH+ro9UDwAVtVuYLCEaYd6LdDMwW eBG17dJl/sA9S2iVQmIPYnoz2sX9lWNXbGon14A+i+/5OIdeyzG1anYyb9v24rYPaGZM U5bZ59ilf69l16zK3JcieqIdrk08jGaPpu+gHpkeCAMp95p/SwZOSaz068nPOACLQmyN YGh4KtCDS7hFv+0N7Y4UgKi9GkcYoRwMi+BSR8v/wFjL8E05pA2s/BMTodliFJ32Ury+ 8zbA== X-Gm-Message-State: APjAAAXKF+CurVk5OPvXhetU5S3aE8dzzoA/Ok79Jpa8LPMKslo+At4P z24WHFtpsemj8cYRjPBM65aw9lNA X-Google-Smtp-Source: APXvYqybkgeW3X5EFvWMSHCl+1G1tMEsxJz8oleY+n/1BSkKn/eDIfPAFyq52TT8aTO9gJVGO8FNiw== X-Received: by 2002:a2e:9e81:: with SMTP id f1mr5955266ljk.29.1561071696157; Thu, 20 Jun 2019 16:01:36 -0700 (PDT) Received: from localhost.localdomain (h77-53-36-254.cust.a3fiber.se. [77.53.36.254]) by smtp.gmail.com with ESMTPSA id s14sm130505ljd.88.2019.06.20.16.01.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 16:01:35 -0700 (PDT) From: Ola Nilsson Date: Fri, 21 Jun 2019 01:01:22 +0200 Message-Id: <20190620230122.22553-1-ola.nilsson@gmail.com> X-Mailer: git-send-email 2.11.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::241 X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) POSIX.1-2017 defines that functions should have a name that 'consisting solely of underscores, digits, and alphabetics from the portable character set'. Make sure the name part of defun-prompt-regexp starts with a letter and allows underscores. * lisp/progmodes/sh-script.el (defun-prompt-regexp): Correct the function name part of the regexp. --- lisp/progmodes/sh-script.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 853a3500ee..24f242572f 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1619,9 +1619,9 @@ sh-mode (setq-local defun-prompt-regexp (concat "^\\(" - "\\(function[ \t]\\)?[ \t]*[[:alnum:]]+[ \t]*([ \t]*)" + "\\(function[ \t]\\)?[ \t]*[[:alpha:]][[:alnum:]_]+[ \t]*([ \t]*)" "\\|" - "function[ \t]+[[:alnum:]]+[ \t]*\\(([ \t]*)\\)?" + "function[ \t]+[[:alpha:]][[:alnum:]_]+[ \t]*\\(([ \t]*)\\)?" "\\)[ \t]*")) (setq-local add-log-current-defun-function #'sh-current-defun-name) (add-hook 'completion-at-point-functions -- 2.11.0 From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#36317: [PATCH] Correct the name part of defun-prompt-regex in sh-script-mode Resent-From: Richard Stallman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 22 Jun 2019 04:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36317 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Ola Nilsson Cc: 36317@debbugs.gnu.org, ola.nilsson@gmail.com Reply-To: rms@gnu.org Received: via spool by 36317-submit@debbugs.gnu.org id=B36317.156117679118214 (code B ref 36317); Sat, 22 Jun 2019 04:14:02 +0000 Received: (at 36317) by debbugs.gnu.org; 22 Jun 2019 04:13:11 +0000 Received: from localhost ([127.0.0.1]:50859 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1heXOo-0004jh-QA for submit@debbugs.gnu.org; Sat, 22 Jun 2019 00:13:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59522) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1heXOm-0004jS-KE for 36317@debbugs.gnu.org; Sat, 22 Jun 2019 00:13:09 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:55143) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1heXOh-0003BI-BI; Sat, 22 Jun 2019 00:13:03 -0400 Received: from rms by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1heXOf-0007hm-NX; Sat, 22 Jun 2019 00:13:01 -0400 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman In-Reply-To: <20190620230122.22553-1-ola.nilsson@gmail.com> (message from Ola Nilsson on Fri, 21 Jun 2019 01:01:22 +0200) References: <20190620230122.22553-1-ola.nilsson@gmail.com> Message-Id: Date: Sat, 22 Jun 2019 00:13:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) [[[ 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) From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#36317: [PATCH v2] Allow underscore in defun-prompt-regex names for sh-script References: <20190620230122.22553-1-ola.nilsson@gmail.com> In-Reply-To: <20190620230122.22553-1-ola.nilsson@gmail.com> Resent-From: Ola Nilsson Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 Jun 2019 21:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36317 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 36317@debbugs.gnu.org Cc: Ola Nilsson Received: via spool by 36317-submit@debbugs.gnu.org id=B36317.156132363816721 (code B ref 36317); Sun, 23 Jun 2019 21:01:01 +0000 Received: (at 36317) by debbugs.gnu.org; 23 Jun 2019 21:00:38 +0000 Received: from localhost ([127.0.0.1]:54943 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hf9bJ-0004LI-On for submit@debbugs.gnu.org; Sun, 23 Jun 2019 17:00:38 -0400 Received: from mail-lf1-f50.google.com ([209.85.167.50]:34113) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hf9bH-0004CZ-Ih for 36317@debbugs.gnu.org; Sun, 23 Jun 2019 17:00:36 -0400 Received: by mail-lf1-f50.google.com with SMTP id y198so8531139lfa.1 for <36317@debbugs.gnu.org>; Sun, 23 Jun 2019 14:00:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=cj+cRlDZZb33SsJxVtDC5gEefuIHUhcPM8kUdkZf/W8=; b=BayCen9R89cup1nG/0LWbgIGMDGvkhWEeB/AEX7W+AvO+mUtYhXqbe1OawShRWK5GL QfJIqeYtEOCTySNnTtzYyUsMfKgzI4gjJkA9iNpRhRKSQIHOJrVXL+dQy5EaolHs4ntU K1tGQUVDq7J3FVhxPOUF7uW39TyEEqe1aLlavfdErNlo+8JFPj/NFO4g2tJ31ut8BPlC 5NANi4m9CoLVUlQLd+aZ3AhCuAZQg1EgQsTtbHfYbdS9mq9i4Tq1GJIxX/pW9ybX91e6 elzo/ojOTN/f1i6mRO/pOObTSs8KM1LvTu2SDe/PWmpiZxCwuRdP/l3BEU3M404IiTr6 +AfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=cj+cRlDZZb33SsJxVtDC5gEefuIHUhcPM8kUdkZf/W8=; b=gXRHXhaUcyVw6BwobPLOU5k5sJfVJy4DIJt64Salx2HvpSerbuP+zidEgDA01SH2dS t7m+dLj1ft1U8v9yvFj7SUIldflUFPiyJJp4t+0Fu4GxV6FT7PDGYt+D3dVUKnT+WLDr xPgnzZdKQSsM7ozcfS6xghNCHQsQuQ89fswqx2ybmQFJdhU1c5z9We96wDZY1BXA49EJ NIaBBWVuCCCRHzS29IghSXa8fYrbtZUXbaWEzYmPv7puc8RRo/CUGzixmU6UjswOnlUo DqWrU81Ia4XWjZQy+rLdk8wY1NdcZiTvS/93Rzu3Jl4peI/+oESxGBuRC600IPYdmflQ P4RA== X-Gm-Message-State: APjAAAXmBM9c+qsQC637FbnHldnwTggd8od15Fya3RVXYWhJKRxnV7Zs iXtJme7ZeZJHIbxsDzfS19tyKOFU X-Google-Smtp-Source: APXvYqzwqn7RMVkxKChEiXLii0IHOMc5kjCa/rh/nCNLQ7uC9MZP/GoN+a04XSd+j4TFlIisM8whqg== X-Received: by 2002:ac2:5382:: with SMTP id g2mr17891437lfh.92.1561323629150; Sun, 23 Jun 2019 14:00:29 -0700 (PDT) Received: from localhost.localdomain (h77-53-36-254.cust.a3fiber.se. [77.53.36.254]) by smtp.gmail.com with ESMTPSA id 25sm1416701ljv.40.2019.06.23.14.00.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Jun 2019 14:00:28 -0700 (PDT) From: Ola Nilsson Date: Sun, 23 Jun 2019 23:00:25 +0200 Message-Id: <20190623210025.8366-1-ola.nilsson@gmail.com> X-Mailer: git-send-email 2.11.0 X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * lisp/progmodes/sh-script.el (defun-prompt-regexp): Allow underscore in function names. --- lisp/progmodes/sh-script.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 853a3500ee..8a0ab20d70 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1619,9 +1619,9 @@ sh-mode (setq-local defun-prompt-regexp (concat "^\\(" - "\\(function[ \t]\\)?[ \t]*[[:alnum:]]+[ \t]*([ \t]*)" + "\\(function[ \t]\\)?[ \t]*[[:alnum:]_]+[ \t]*([ \t]*)" "\\|" - "function[ \t]+[[:alnum:]]+[ \t]*\\(([ \t]*)\\)?" + "function[ \t]+[[:alnum:]_]+[ \t]*\\(([ \t]*)\\)?" "\\)[ \t]*")) (setq-local add-log-current-defun-function #'sh-current-defun-name) (add-hook 'completion-at-point-functions -- 2.11.0 From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#36317: [PATCH] Correct the name part of defun-prompt-regex in sh-script-mode Resent-From: Ola Nilsson Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Jun 2019 20:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36317 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: rms@gnu.org Cc: 36317@debbugs.gnu.org Received: via spool by 36317-submit@debbugs.gnu.org id=B36317.156140781713499 (code B ref 36317); Mon, 24 Jun 2019 20:24:01 +0000 Received: (at 36317) by debbugs.gnu.org; 24 Jun 2019 20:23:37 +0000 Received: from localhost ([127.0.0.1]:58113 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfVV3-0003Vf-Ba for submit@debbugs.gnu.org; Mon, 24 Jun 2019 16:23:37 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:35140) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfVV0-0003VP-W8 for 36317@debbugs.gnu.org; Mon, 24 Jun 2019 16:23:36 -0400 Received: by mail-pl1-f196.google.com with SMTP id p1so7542825plo.2 for <36317@debbugs.gnu.org>; Mon, 24 Jun 2019 13:23:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6qAI+VHhU0BblPLOIfvLDAf3GhmEljHiuV4x6osRmR0=; b=W1/ahsqADcHFodX4hS9bEVBdJZL/x8rOhLvD6aSKnGgxg7N5UGSpINvRB8Jd78USTE Zm4Fs6HV4GGkSAeQezx5236g7VN1FLBxsdH7ilnTQpHX62BsCnXFM6UzEo99RSbI7zy/ e42hFbTjjspImSzR9ud+OeSfZA3+a/DeIhgWeGNCursNhP1YsnOXO67bot5TDhVV4817 +u6E1AXJ5jW0MxQDhDjHc/bmAaR8So+zafg5868YgKpcJ/Q6Oaamz3GJMP8rxCpuYWqK x/ksC5kjePEKzJQbsMdKiY4kS0tqbhkOnW0rEuhtbswO3J8p/POW13sewvJTL1xEeZ4+ A6YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6qAI+VHhU0BblPLOIfvLDAf3GhmEljHiuV4x6osRmR0=; b=B6m2/2VH8/Bk8SPUyM14U82zGnzP6NgqWUQRUdFUf//8PlryCcxReyzgDmNLBUZzFO cTj+S5dc60EtxLuxpOXrYI7Hda8ulnfFeS/820NKt9OLmm3JYscyNnJxFYkPYBT74Vxv FRe/KyXJaGASLyyHPf4HWJx7AbWnJxBEScpkXLpffmOwRe+KLmWOSSb0BRuh6lVrr/0X v+9F4Hdr3dpKWQaIctBxEvbqrngmFNPpM2OhDTzC5o1PT+ha0xUVObkCzpEltJtYRjjw DHfpbmMCFnERwXEfRm7xOaXQqTtYRPcnV7ZMc1x4Ocb7WfqfizSWP0SwO9RaSXvx0qVD khdg== X-Gm-Message-State: APjAAAW7tW3jgqzrlfDp9pGLiAo65vdMfdPVM05tbb3S3c76+WL3SFA/ fUO2tZ6ZgD6YkGZOPj1buZI8ooF4UfRrpWp3dO8= X-Google-Smtp-Source: APXvYqzar7QOloxdRNCK3lMjGKBZqj4tCS1IqOUZ+PknJx7sxlsO+xSjhlLisrah88Fhd8lgYAJSg6CNUYTeXYf8kjI= X-Received: by 2002:a17:902:704a:: with SMTP id h10mr41771138plt.337.1561407809065; Mon, 24 Jun 2019 13:23:29 -0700 (PDT) MIME-Version: 1.0 References: <20190620230122.22553-1-ola.nilsson@gmail.com> In-Reply-To: From: Ola Nilsson Date: Mon, 24 Jun 2019 22:23:18 +0200 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Sat, Jun 22, 2019 at 6:13 AM Richard Stallman wrote: > > 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. Ok, that makes total sense and is probably mentioned in the POSIX specification. > 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. This is not actually about highlighting, but function navigation. beginning-of-defun, end-of-defun, and narrow-to-defun does not behave as expected for functions with underscores in their names. I've sent a V2 patch. -- Ola Nilsson From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#36317: [PATCH v2] Allow underscore in defun-prompt-regex names for sh-script Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Jun 2019 14:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36317 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Ola Nilsson Cc: 36317@debbugs.gnu.org Received: via spool by 36317-submit@debbugs.gnu.org id=B36317.156147127627848 (code B ref 36317); Tue, 25 Jun 2019 14:02:02 +0000 Received: (at 36317) by debbugs.gnu.org; 25 Jun 2019 14:01:16 +0000 Received: from localhost ([127.0.0.1]:33072 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfm0a-0007Er-0u for submit@debbugs.gnu.org; Tue, 25 Jun 2019 10:01:16 -0400 Received: from mail-io1-f54.google.com ([209.85.166.54]:41605) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfm0W-000770-6m for 36317@debbugs.gnu.org; Tue, 25 Jun 2019 10:01:12 -0400 Received: by mail-io1-f54.google.com with SMTP id w25so2583194ioc.8 for <36317@debbugs.gnu.org>; Tue, 25 Jun 2019 07:01:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=NXPLZxwCfHEc1LYusP+qk7h+Vr/q/tOY14t3FFIavdQ=; b=PjLnbfrTBH5+HJSPQjc2/LS1vXUS9r+2peyZpB9lcD/uU5g0nOtFCyvViYrYsxVOXw R2mSPzxcM/xF5bOf0pC9pK51YDCDTlL3a4Bh82g8/4Io+buo6r8ITbmZYdZiMSS87365 ty+dsNe1yMY8DbwouA8VcEF+3mo8/eG0jSwBijwhO4lE45ZZ6HjgsZOvxTBHK3Ra9eDx KyEcNjnZcQBIdoWE/GeB5y8Xyp/CGQ7TmKaMBQBhegVZ+KkMsNX/qcm8mCnNMGoBVNJO lNE5WHUt9xtAJe95UiE+w7ZbfvK9IN4EzGGDyoqV1aX3fWmxvgtB3wci+O9mmAY53uls vjvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=NXPLZxwCfHEc1LYusP+qk7h+Vr/q/tOY14t3FFIavdQ=; b=JqomE90H2tX8e6a/hx6D0QizJ8dkqYGpKdqHoY9ANA8g4ucSXLXluMIzBZwSEoQGct 053vcYZhOKlxVhzFCsc+9gqWR0xYnFd+VM66K+dnjAcOiXBRMsXA+GkgsCssQIZwnQmR hX9zRbUswx9XL4gZKg49nUNLO3X7ntkAOJodW93jvTHWmO6HOXQBbpGKgbvdW52tK90o +VkaErEjGnppast77eubmOmELf78azOz8+Yae2fUritszcTa3vEOL0bK2e+uLGX02ovY M1k7SUnKNVlReYkzqxmEGS7kTohKPD6+Oxf03cDUiYfiBCQRREyDio+91OaVTt7ksUim k9iQ== X-Gm-Message-State: APjAAAVHxMInNc+GWDwdPhgqjAxvH+fPZB2TOVPtQ84jXMpvqhJ08Np2 vXFOfXmk5taJLUj46L9dOJTJ3KHE X-Google-Smtp-Source: APXvYqy+US0HAxJ+1MP3U1rQBm7dD4EEQdBVjTjB5MusGaOpngTWL5QHd2NysnIPpa0BXy5wDyV7Pg== X-Received: by 2002:a5d:9613:: with SMTP id w19mr44671461iol.140.1561471266274; Tue, 25 Jun 2019 07:01:06 -0700 (PDT) Received: from vhost2 (CPE001143542e1f-CMf81d0f809fa0.cpe.net.cable.rogers.com. [99.230.51.196]) by smtp.gmail.com with ESMTPSA id c23sm15543942iod.11.2019.06.25.07.01.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Jun 2019 07:01:05 -0700 (PDT) From: Noam Postavsky References: <20190620230122.22553-1-ola.nilsson@gmail.com> <20190623210025.8366-1-ola.nilsson@gmail.com> Date: Tue, 25 Jun 2019 10:01:04 -0400 In-Reply-To: <20190623210025.8366-1-ola.nilsson@gmail.com> (Ola Nilsson's message of "Sun, 23 Jun 2019 23:00:25 +0200") Message-ID: <85y31p69y7.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.92 (windows-nt) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Ola Nilsson 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)? From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#36317: [PATCH v2] Allow underscore in defun-prompt-regex names for sh-script Resent-From: Ola Nilsson Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Jun 2019 20:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36317 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Noam Postavsky Cc: 36317@debbugs.gnu.org Received: via spool by 36317-submit@debbugs.gnu.org id=B36317.15615827078501 (code B ref 36317); Wed, 26 Jun 2019 20:59:02 +0000 Received: (at 36317) by debbugs.gnu.org; 26 Jun 2019 20:58:27 +0000 Received: from localhost ([127.0.0.1]:37102 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hgEzq-0002D0-4r for submit@debbugs.gnu.org; Wed, 26 Jun 2019 16:58:27 -0400 Received: from mail-pf1-f180.google.com ([209.85.210.180]:34826) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hgEzo-0002Cm-9k for 36317@debbugs.gnu.org; Wed, 26 Jun 2019 16:58:25 -0400 Received: by mail-pf1-f180.google.com with SMTP id d126so55110pfd.2 for <36317@debbugs.gnu.org>; Wed, 26 Jun 2019 13:58:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Tr6zVwWOz+u4qxqptUVSsRyX+C57D1yNufbHPac4JFM=; b=IscGqZfdtib0eBmr60jftZWNDCYMK5fkHVeMzbc8P4Sa2itNNOoBgbui9P/obYhyLB XPnV+8ItWxP6ojjBiARBw5M7M7kpY1ZlGpl6CVC0/pQPvF/XF6Rg9AKZcnG4rvp0vgg1 G4VWs9fqxlt/7o8UuNXP5xhoSXxoWbFBYnL79JQB6hVrJkdNf1KtPYt1hRd/0eAYtYgv t6PdYcCCNbtKFR3U+AN5r7P0sK3mUs25e0+mZHZHH0xyaYkqNdeqjZEplqARAAzD1/xQ Kps/Mw1c7s3uOxsCPwcE+oAoR9Ue7sxfxI5dERre26ebhbO/4FmHk2QjOfBgzzi5ssI+ A/wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Tr6zVwWOz+u4qxqptUVSsRyX+C57D1yNufbHPac4JFM=; b=Jx0jdTAWSniMvmvbWidtgPb0NP2oQ9gXY8FaR+Ex6GzoLsHbFHcvVVMRVfsW0kLX7L nVLS4QYtQfI58lTsHRFK9EIlzdrrbYCdh0/R8gftdKGdyRTnP9Nozdrs70sjEmHPglCg /jwlFXKry8FFbKekEqiyvT8RTK/tkn5mt+so74UDMW3JaYtDbXw3XmLncH3ozKmIzdZT bf1WBgHYVtLyoSdaqLwQOqhUmNc3tJhH+H0IAmbK1Sbz86Frt644fcn0zwYDrpljeTsS eu2WCu1wdAVvsgLRNQxlDfVYAtpq+1zeul4HYfr7tq15n1LFPKqIFFpfOrOfU4HibBo4 mvEw== X-Gm-Message-State: APjAAAVHheMRB0kncpP3knQ3299sHA3XEs72PYEPMrpOB2+gQFZMOM3R fHAHvPHCb9f9sM5+hO/apvynYLHj8aGrsYXPAzE= X-Google-Smtp-Source: APXvYqxAPKQVrjV4vce9DSP9E4kyxidQlUc3Wbp6iwmlLCHVU5hfhJ2bSFEZoLTu7SzrNdhEgtRh/WDYnVA6k0TNi0s= X-Received: by 2002:a17:90a:ac13:: with SMTP id o19mr1264641pjq.143.1561582698168; Wed, 26 Jun 2019 13:58:18 -0700 (PDT) MIME-Version: 1.0 References: <20190620230122.22553-1-ola.nilsson@gmail.com> <20190623210025.8366-1-ola.nilsson@gmail.com> <85y31p69y7.fsf@gmail.com> In-Reply-To: <85y31p69y7.fsf@gmail.com> From: Ola Nilsson Date: Wed, 26 Jun 2019 22:58:06 +0200 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Tue, Jun 25, 2019 at 4:01 PM Noam Postavsky wrote: > > Ola Nilsson 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 From unknown Sun Jun 22 07:57:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#36317: [PATCH v2] Allow underscore in defun-prompt-regex names for sh-script Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 28 Jun 2019 00:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36317 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Ola Nilsson Cc: 36317@debbugs.gnu.org Received: via spool by 36317-submit@debbugs.gnu.org id=B36317.156168092723182 (code B ref 36317); Fri, 28 Jun 2019 00:16:01 +0000 Received: (at 36317) by debbugs.gnu.org; 28 Jun 2019 00:15:27 +0000 Received: from localhost ([127.0.0.1]:40077 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hgeY3-00061l-Ab for submit@debbugs.gnu.org; Thu, 27 Jun 2019 20:15:27 -0400 Received: from mail-io1-f42.google.com ([209.85.166.42]:34116) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hgeY0-00061R-R6; Thu, 27 Jun 2019 20:15:25 -0400 Received: by mail-io1-f42.google.com with SMTP id k8so8812760iot.1; Thu, 27 Jun 2019 17:15:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=9Ck68x1m1ZZvkqSO25kBiyv1zeh77YlzousDhiMapIc=; b=GnJ8fVsez6HuO6c6Y3J2yYHh3BwOe7UNZlVozT50ABB2gRc6YMfpEzmB8slAaSkT4o wdK23/gFjjYpknP6zp1aa9cv/h3iA7cEuu540yjP63o9QbTtvdrSUlqmQ3L++VaBBiNr ZGKmgvb9WMRZWhfImiaruY2r9B7xF5FD10q9PyrXyykbEEiH5eEjR0T0Bn6ox8NkbTio 4icmo4i1q5yHlZuP8b6RK3pWGceHRayN27UYWfVlQ2l+RcIkiLBuhi80SyZvyt1SS2Ux dyMWWLlRq2KVnQ+Nv/xERw+2Tw9iVxC2T5jaERsc0lWPOaWC6oRYL5NChJgmYcJlatql nTGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=9Ck68x1m1ZZvkqSO25kBiyv1zeh77YlzousDhiMapIc=; b=Z1/auyixRQEipcGRMrtmutvpcdPlLcQFRFuhInO7lMWLbxRAdVVU5jGtFt2ytSNcLb DD1awDPCZ7DLBV2W8fjr1XASck8hyXzySFG8nhc6jiiS3ou3uo5Fj4X5N2omnSPKGfE1 9iDpE56liPHtKshmT9WLxM4N43o7gMH/dJlssAREE2UhGejRnR7sVn6NOvlrfWx/i+Uj nW0fboVRnApMMq7nNyeXWHAk8OO7On2nOWQkCHRggbNn0sQqrPBWg1WvLjeazoItHyIZ SXtiRwxBFVAr/znNKfiEnDFGOwv1hLU9uz5rvJOnw6VegqbGJJNkDigCMq2k9KNIsnS9 uvMA== X-Gm-Message-State: APjAAAURNBgBct1Wdzb3mlBiW7OjnNRbIle7AaYNGydfDw7ECzHuGAzS 0ix3q/WUHHt75IFxcsMeTp1KUV4A X-Google-Smtp-Source: APXvYqxIr7aUdZJAYwgBH4u4GZGCrTd9NXAth+uUkaJLu0CGPfb7/TGdxVW8NtMaCEPcDBU73uxxCA== X-Received: by 2002:a6b:3883:: with SMTP id f125mr7826549ioa.109.1561680919063; Thu, 27 Jun 2019 17:15:19 -0700 (PDT) Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.gmail.com with ESMTPSA id r24sm507823ioc.76.2019.06.27.17.15.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jun 2019 17:15:18 -0700 (PDT) From: Noam Postavsky References: <20190620230122.22553-1-ola.nilsson@gmail.com> <20190623210025.8366-1-ola.nilsson@gmail.com> <85y31p69y7.fsf@gmail.com> Date: Thu, 27 Jun 2019 20:15:17 -0400 In-Reply-To: (Ola Nilsson's message of "Wed, 26 Jun 2019 22:58:06 +0200") Message-ID: <875zoq7ega.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 36317 fixed close 36317 27.1 quit Ola Nilsson writes: > 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. Darn, that's a lot more complicated than I was hoping. > 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. IMO, allowing more things makes sense, but I've just gone ahead and push your patch v2 to master, since it's clearly a step in the right direction. Cleaning up the rest of the mess would be nice too, but it looks like a lot of untangling to be done. fa3af359df 2019-06-27T20:02:54-04:00 "Allow underscore in defun-prompt-regex names for sh-script" https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=fa3af359df8754423a197682d31245ad88c02033