From unknown Sat Jun 21 12:14:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#65580: [PATCH] ; * lisp/help-fns.el (help-do-arg-highlight): Fix regexp. Resent-From: Eshel Yaron Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 28 Aug 2023 12:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 65580 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 65580@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.169322416511503 (code B ref -1); Mon, 28 Aug 2023 12:03:02 +0000 Received: (at submit) by debbugs.gnu.org; 28 Aug 2023 12:02:45 +0000 Received: from localhost ([127.0.0.1]:47269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qaaxA-0002zT-Uj for submit@debbugs.gnu.org; Mon, 28 Aug 2023 08:02:45 -0400 Received: from lists.gnu.org ([2001:470:142::17]:41710) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qaax8-0002zF-V3 for submit@debbugs.gnu.org; Mon, 28 Aug 2023 08:02:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qaawr-00084A-SP for bug-gnu-emacs@gnu.org; Mon, 28 Aug 2023 08:02:27 -0400 Received: from mail.eshelyaron.com ([107.175.124.16] helo=eshelyaron.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qaawp-0001or-JM for bug-gnu-emacs@gnu.org; Mon, 28 Aug 2023 08:02:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1693224141; bh=1gRqD9kJ4trjfWKGE90lfCBj7e1DbWT9bJFgEcGVMdE=; h=From:To:Subject:Date:From; b=xUxVmBfVCPsWj4/jDOce0XZD5fXBSzYG+lfQ5SIHZ32e4Mv9TF1dz7Mx+VLz723OU 2Z5IdHK1fgOuoLBJpMnLwu8xXC/AgGo0Guu35qKXUa+aUzxwTsbiQ44JtoS00g/ML8 w7+d1wSMC3Vompgr0mEd9TjxjnQNeJkU8cUnOLsodoceLnqgZJo7oKdSsV+i3nqYeN 9QRdvt2wQR5ND701DB8qOJvG5sLYlCGZFk/DLufrrEImVPG4r+FzXYe6wx8i7PLdWS qHL2AvjtQ7Gg1UuYgjar+RF6XG7o8oBhnWAnbDaJj4J+0WFisXLYIUYR5qMJwgYwCv Dn+pACWJB6g2Q== From: Eshel Yaron X-Hashcash: 1:20:230828:bug-gnu-emacs@gnu.org::hUQ0V3UPxG+WZWGv:8bdI Date: Mon, 28 Aug 2023 14:02:18 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=107.175.124.16; envelope-from=me@eshelyaron.com; helo=eshelyaron.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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) 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: -0.1 (/) --=-=-= Content-Type: text/plain Tags: patch Tags: patch This patch addresses the following existing issue: In the output of `C-h f with-delayed-message RET`, the word `message` in the function name is incorrectly highlighted with `help-argument-name`. This can be seen also with a definition such as: --8<---------------cut here---------------start------------->8--- (defun foo-bar (baz) "Frobnicate BAZ. \(fn (foo bar))" nil) --8<---------------cut here---------------end--------------->8--- Now `C-h f foo-bar RET` shows both `foo` and `bar` in the function name with `help-argument-name` (as well as the `foo` and `bar` arguments). The attached patch tweaks the regular expression that `help-do-arg-highlight` uses to find argument occurrences such that it skips the function name. In GNU Emacs 30.0.50 (build 3, x86_64-apple-darwin22.5.0, NS appkit-2299.60 Version 13.4 (Build 22F66)) of 2023-08-27 Repository revision: c122cc831869a9a11f50187c5cf999389b223eee Repository branch: master Windowing system distributor 'Apple', version 10.3.2299 System Description: macOS 13.4 Configured using: 'configure 'CFLAGS=-g0 -O3' --with-native-compilation --with-json --with-imagemagick --with-tree-sitter --enable-link-time-optimization' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-lisp-help-fns.el-help-do-arg-highlight-Fix-regexp.patch >From 1d7fcb5cb407f3b9c6d2040307d2bdad2632456c Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Mon, 28 Aug 2023 13:43:52 +0200 Subject: [PATCH] ; * lisp/help-fns.el (help-do-arg-highlight): Fix regexp. Avoid highlighting (parts of) the function name as arguments in the output of 'describe-function' when the function has an argument with the same name. Do achieve this, refine the regular expression that 'help-do-arg-highlight' uses such that it doesn't match anything in the function name. --- lisp/help-fns.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 609bed18f2f..b34778773a9 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -369,7 +369,8 @@ help-do-arg-highlight (setq doc (replace-regexp-in-string ;; This is heuristic, but covers all common cases ;; except ARG1-ARG2 - (concat "\\<" ; beginning of word + (concat "([^ ]+ .*" ; skip function name + "\\<" ; beginning of word "\\(?:[a-z-]*-\\)?" ; for xxx-ARG "\\(" (regexp-quote arg) -- 2.41.0 --=-=-=-- From unknown Sat Jun 21 12:14:01 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Eshel Yaron Subject: bug#65580: closed (Re: bug#65580: [PATCH] ; * lisp/help-fns.el (help-do-arg-highlight): Fix regexp.) Message-ID: References: X-Gnu-PR-Message: they-closed 65580 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 65580@debbugs.gnu.org Date: Fri, 01 Sep 2023 18:34:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1693593242-9701-1" This is a multi-part message in MIME format... ------------=_1693593242-9701-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #65580: [PATCH] ; * lisp/help-fns.el (help-do-arg-highlight): Fix regexp. which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 65580@debbugs.gnu.org. --=20 65580: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D65580 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1693593242-9701-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 65580-done) by debbugs.gnu.org; 1 Sep 2023 18:33:02 +0000 Received: from localhost ([127.0.0.1]:33854 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qc8x4-0002VC-IH for submit@debbugs.gnu.org; Fri, 01 Sep 2023 14:33:02 -0400 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]:53295) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qc8x2-0002Ug-Tv for 65580-done@debbugs.gnu.org; Fri, 01 Sep 2023 14:33:01 -0400 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-500cfb168c6so3924442e87.2 for <65580-done@debbugs.gnu.org>; Fri, 01 Sep 2023 11:32:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693593165; x=1694197965; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=a/5ua/O8sSvShqxba+pnrJl5qa+6WFEPV0I8aKb1vr8=; b=sRNczsdXffrDwqRZpFz1eDjOG51pfFJOOceC4qH0/YE4J9HnsnKZTkCXyJwszOI1pm AnLAAsko5ao+sp0JeVOVLnrrPOokwFRH1lFtjUCao/3e7//sq1IktOCw8UGF9I//O41e Xn6neL8NqX9NaMgJuxk1YBImexw9VgevT8DrGx4MkslXvKI9C9cZHMrJvpIB/Y3i/eVz S6wYkeBZT3gxCstDgXYGaIylY4gVO4ikhmFiSP6AQ2UDTxROIKu2MXnVneA6+D3p+n+g 9z10nQ8VVL6Muj0Ck4mgdIuRzRRdGvK57DSf0QEG5t59nKNZ2eX+WpxKf0xfn6gISc+R L1WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693593165; x=1694197965; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=a/5ua/O8sSvShqxba+pnrJl5qa+6WFEPV0I8aKb1vr8=; b=CmNoab9UKhHbuJyV/NDrx+5F7NTPEGB4cC1OV+dZlHid3LAdcbkupGLEBffDQND61X ho6dL5YJg4tcMvASptxV1q3YtndKdwuzmhKCKdFJAfnHvQOIPfml8A/4UMiZ0EDi21dJ CAx6jXEsy86hzjoyWaEkEfnmS4ZWqjEv32mHxTtfP+wa4pUNKEG+IkVjQpe9q1kDYLBv 7PqE8/xcIonXqbuJeak0o+mn+Np2VheySfiKOptBAukm7U76QzogFeUVhaC9+4bj3pbr II6gJ7VrbXfi6CoPwiVTf0PWhSxShpMfrxsS0pa92QpCxcu/EAZQjPjqbMXan+/zuVqe YQ2g== X-Gm-Message-State: AOJu0Ywm1WQ8MimBpVlKHiAapaNvhOqDDjKcttwYsUCSrO+gRoeIBZTn KywZmXjPFRVaG5uw9ZnrDnLAflJK2E4Ugxr/RMk= X-Google-Smtp-Source: AGHT+IG4nwir9NOEy+0nP2cNwtXm2OM16M8Bcf5EUjU1LyC0ChjFHKqzyqO6CHldQBHHgzYvIPuOnddbRvdAsNM7L4A= X-Received: by 2002:a19:4f4f:0:b0:500:a1e4:fc44 with SMTP id a15-20020a194f4f000000b00500a1e4fc44mr2047695lfk.61.1693593165275; Fri, 01 Sep 2023 11:32:45 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Stefan Kangas Date: Fri, 1 Sep 2023 20:32:33 +0200 Message-ID: Subject: Re: bug#65580: [PATCH] ; * lisp/help-fns.el (help-do-arg-highlight): Fix regexp. To: Eshel Yaron Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65580-done Cc: 65580-done@debbugs.gnu.org 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 (-) Version: 30.1 > This patch addresses the following existing issue: > > In the output of `C-h f with-delayed-message RET`, the word `message` in > the function name is incorrectly highlighted with `help-argument-name`. > > This can be seen also with a definition such as: > > --8<---------------cut here---------------start------------->8--- > (defun foo-bar (baz) > "Frobnicate BAZ. > > \(fn (foo bar))" > nil) > --8<---------------cut here---------------end--------------->8--- > > Now `C-h f foo-bar RET` shows both `foo` and `bar` in the function name > with `help-argument-name` (as well as the `foo` and `bar` arguments). > > The attached patch tweaks the regular expression that > `help-do-arg-highlight` uses to find argument occurrences such that it > skips the function name. Thanks, pushed to master. ------------=_1693593242-9701-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 28 Aug 2023 12:02:45 +0000 Received: from localhost ([127.0.0.1]:47269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qaaxA-0002zT-Uj for submit@debbugs.gnu.org; Mon, 28 Aug 2023 08:02:45 -0400 Received: from lists.gnu.org ([2001:470:142::17]:41710) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qaax8-0002zF-V3 for submit@debbugs.gnu.org; Mon, 28 Aug 2023 08:02:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qaawr-00084A-SP for bug-gnu-emacs@gnu.org; Mon, 28 Aug 2023 08:02:27 -0400 Received: from mail.eshelyaron.com ([107.175.124.16] helo=eshelyaron.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qaawp-0001or-JM for bug-gnu-emacs@gnu.org; Mon, 28 Aug 2023 08:02:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1693224141; bh=1gRqD9kJ4trjfWKGE90lfCBj7e1DbWT9bJFgEcGVMdE=; h=From:To:Subject:Date:From; b=xUxVmBfVCPsWj4/jDOce0XZD5fXBSzYG+lfQ5SIHZ32e4Mv9TF1dz7Mx+VLz723OU 2Z5IdHK1fgOuoLBJpMnLwu8xXC/AgGo0Guu35qKXUa+aUzxwTsbiQ44JtoS00g/ML8 w7+d1wSMC3Vompgr0mEd9TjxjnQNeJkU8cUnOLsodoceLnqgZJo7oKdSsV+i3nqYeN 9QRdvt2wQR5ND701DB8qOJvG5sLYlCGZFk/DLufrrEImVPG4r+FzXYe6wx8i7PLdWS qHL2AvjtQ7Gg1UuYgjar+RF6XG7o8oBhnWAnbDaJj4J+0WFisXLYIUYR5qMJwgYwCv Dn+pACWJB6g2Q== From: Eshel Yaron To: bug-gnu-emacs@gnu.org Subject: [PATCH] ; * lisp/help-fns.el (help-do-arg-highlight): Fix regexp. X-Hashcash: 1:20:230828:bug-gnu-emacs@gnu.org::hUQ0V3UPxG+WZWGv:8bdI Date: Mon, 28 Aug 2023 14:02:18 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=107.175.124.16; envelope-from=me@eshelyaron.com; helo=eshelyaron.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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit 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: -0.1 (/) --=-=-= Content-Type: text/plain Tags: patch Tags: patch This patch addresses the following existing issue: In the output of `C-h f with-delayed-message RET`, the word `message` in the function name is incorrectly highlighted with `help-argument-name`. This can be seen also with a definition such as: --8<---------------cut here---------------start------------->8--- (defun foo-bar (baz) "Frobnicate BAZ. \(fn (foo bar))" nil) --8<---------------cut here---------------end--------------->8--- Now `C-h f foo-bar RET` shows both `foo` and `bar` in the function name with `help-argument-name` (as well as the `foo` and `bar` arguments). The attached patch tweaks the regular expression that `help-do-arg-highlight` uses to find argument occurrences such that it skips the function name. In GNU Emacs 30.0.50 (build 3, x86_64-apple-darwin22.5.0, NS appkit-2299.60 Version 13.4 (Build 22F66)) of 2023-08-27 Repository revision: c122cc831869a9a11f50187c5cf999389b223eee Repository branch: master Windowing system distributor 'Apple', version 10.3.2299 System Description: macOS 13.4 Configured using: 'configure 'CFLAGS=-g0 -O3' --with-native-compilation --with-json --with-imagemagick --with-tree-sitter --enable-link-time-optimization' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-lisp-help-fns.el-help-do-arg-highlight-Fix-regexp.patch >From 1d7fcb5cb407f3b9c6d2040307d2bdad2632456c Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Mon, 28 Aug 2023 13:43:52 +0200 Subject: [PATCH] ; * lisp/help-fns.el (help-do-arg-highlight): Fix regexp. Avoid highlighting (parts of) the function name as arguments in the output of 'describe-function' when the function has an argument with the same name. Do achieve this, refine the regular expression that 'help-do-arg-highlight' uses such that it doesn't match anything in the function name. --- lisp/help-fns.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 609bed18f2f..b34778773a9 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -369,7 +369,8 @@ help-do-arg-highlight (setq doc (replace-regexp-in-string ;; This is heuristic, but covers all common cases ;; except ARG1-ARG2 - (concat "\\<" ; beginning of word + (concat "([^ ]+ .*" ; skip function name + "\\<" ; beginning of word "\\(?:[a-z-]*-\\)?" ; for xxx-ARG "\\(" (regexp-quote arg) -- 2.41.0 --=-=-=-- ------------=_1693593242-9701-1--