From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#55889: 29.0.50; Support mksh-specific function names in imenu Date: Fri, 10 Jun 2022 20:06:21 +0530 Message-ID: <87pmjg37ru.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8318"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) To: 55889@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 10 16:37:23 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nzflJ-0001yl-NV for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 10 Jun 2022 16:37:21 +0200 Original-Received: from localhost ([::1]:36940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzflI-0000Vs-Of for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 10 Jun 2022 10:37:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzfl2-0000VU-7b for bug-gnu-emacs@gnu.org; Fri, 10 Jun 2022 10:37:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57054) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzfl0-000230-PQ for bug-gnu-emacs@gnu.org; Fri, 10 Jun 2022 10:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nzfl0-0000f5-Ki for bug-gnu-emacs@gnu.org; Fri, 10 Jun 2022 10:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 10 Jun 2022 14:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 55889 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16548718172517 (code B ref -1); Fri, 10 Jun 2022 14:37:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 10 Jun 2022 14:36:57 +0000 Original-Received: from localhost ([127.0.0.1]:50949 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzfku-0000eW-W5 for submit@debbugs.gnu.org; Fri, 10 Jun 2022 10:36:57 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:44424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nzfkq-0000eK-1s for submit@debbugs.gnu.org; Fri, 10 Jun 2022 10:36:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzfko-0000TG-Vs for bug-gnu-emacs@gnu.org; Fri, 10 Jun 2022 10:36:51 -0400 Original-Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:36471) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzfkn-00021X-1a for bug-gnu-emacs@gnu.org; Fri, 10 Jun 2022 10:36:50 -0400 Original-Received: by mail-pl1-x643.google.com with SMTP id u18so22942942plb.3 for ; Fri, 10 Jun 2022 07:36:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:user-agent:mime-version; bh=Y6U0OnTWXzQR/pMpOTYaDyZpivgXd6KscfqgMLBVLfc=; b=msadLTAbFfFMPoU8bON6um3FZBedvzOZMnSHpMr2WBneaywHa2X/kk3wRoNHqy8S64 zfi8fSjuyXtv8hN/YsYIudrAQAewUPx5tzGb6HCmhtAaZ+B7ODRpUSbdlYZjYYoBirFN cHU09D/5YBifvDG/Rl3bpwZBUU57CAlkHz5GOE2+v1BwL3ZnPAZSiU7wSkaj8bFR3P8P mjhmPL9vcTHysG2nT3crJOpnZPh++MCYsOcdF7cg7VB0E4p8IV9/WOqwq1qogVwP4nd6 79aghwSeBvD3zGlX1SoFnzunKrMFXZkTmj6ON3AJ8aq06UxO46yfGxXvlJ/7nElkveRM Q5dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version; bh=Y6U0OnTWXzQR/pMpOTYaDyZpivgXd6KscfqgMLBVLfc=; b=sKEr4PYrHa1bE9by4lLxfUTNYJ9dTNW5kO6eDcWL2I3BfJw+yKuEWWJ1RmyAyGBCq3 AFqG3Lo+AVDAkbsNMQa5RPu1rXoSjQNi8bNu0WEeVQ9SkHYge572352GLFbVCwpxGkru YxA8KVn+isUK1R5wvqZ90+ieJ7cfR94OdCQWiGNlJV3hBjbVb41/NA3cTMeYyeK1OQ9i BwO4NWZpFCutJaGXtTMaKKWJpBkaxf0UYKB6UdXTOZ5YWgNfbH4y+9EP+YqAqRgv99yj RD1UmjdXhXrDHVqEgqw0dApze1KieqErvFntfu6K0SC7a20EEzZZlSBf5lpvurNqT8GR +z1g== X-Gm-Message-State: AOAM533We2Gd/dyomibLH1i+xbZwqMFNAMOAULRJWDNuVoBSo0/Rbh38 LSQzwwc2nKfVPNRjIa759R/00/W+NRQ= X-Google-Smtp-Source: ABdhPJwapyOEf/wA16Rj+mVW/GoJckr/xYtteXEFJW+gv+l11s++PmQ58Yn8JyukAIRqJi1xsKkiCQ== X-Received: by 2002:a17:90a:4291:b0:1e2:92f3:20d1 with SMTP id p17-20020a17090a429100b001e292f320d1mr54148pjg.163.1654871794114; Fri, 10 Jun 2022 07:36:34 -0700 (PDT) Original-Received: from localhost ([49.204.138.90]) by smtp.gmail.com with ESMTPSA id s7-20020a63af47000000b0040175983762sm3665057pgo.37.2022.06.10.07.36.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jun 2022 07:36:33 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::643; envelope-from=visuweshm@gmail.com; helo=mail-pl1-x643.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:234228 Archived-At: --=-=-= Content-Type: text/plain Tags: patch mksh supports characters well beyond [:alnum:_] in its function names. More specifically, syn.c:function_body says the following /*- * Check for valid characters in name. POSIX and AT&T ksh93 say * only allow [a-zA-Z_0-9] but this allows more as old pdkshs * have allowed more; the following were never allowed: * NUL TAB NL SP " $ & ' ( ) ; < = > \ ` | * C_QUOTE|C_SPC covers all but adds # * ? [ ] */ However, it seems like executing a function with a forward-slash (/) character in it is impossible as well. Attached patch adds a mksh-specific entry to sh-imenu-generic-expression to do that. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Support-mksh-specific-function-names-in-imenu.patch >From 53139e53b75aa37cc808c1c8b3e3be367ae09fb3 Mon Sep 17 00:00:00 2001 From: Visuwesh Date: Fri, 10 Jun 2022 20:01:03 +0530 Subject: [PATCH] Support mksh-specific function names in imenu * lisp/progmodes/sh-script.el (sh-imenu-generic-expression): Add mksh-specific function names to imenu-generic-expression. --- lisp/progmodes/sh-script.el | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 4d2554c087..844fb690a5 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -286,7 +286,7 @@ sh-shell-arg :group 'sh-script) (defcustom sh-imenu-generic-expression - '((sh + `((sh . ((nil ;; function FOO ;; function FOO() @@ -295,8 +295,21 @@ sh-imenu-generic-expression ;; FOO() (nil "^\\s-*\\([[:alpha:]_][[:alnum:]_]*\\)\\s-*()" - 1) - ))) + 1))) + (mksh + . ((nil + ;; function FOO + ;; function FOO() + ,(rx bol (* (syntax whitespace)) "function" (+ (syntax whitespace)) + (group (1+ (not (any "\0\t\n \"$&'();<=>\\`|#*?[]/")))) + (* (syntax whitespace)) (? "()")) + 1) + (nil + ;; FOO() + ,(rx bol (* (syntax whitespace)) + (group (1+ (not (any "\0\t\n \"$&'();<=>\\`|#*?[]/")))) + (* (syntax whitespace)) "()") + 1)))) "Alist of regular expressions for recognizing shell function definitions. See `sh-feature' and `imenu-generic-expression'." :type '(alist :key-type (symbol :tag "Shell") -- 2.35.1 --=-=-=--