* bug#65580: [PATCH] ; * lisp/help-fns.el (help-do-arg-highlight): Fix regexp.
@ 2023-08-28 12:02 Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-01 18:32 ` Stefan Kangas
0 siblings, 1 reply; 2+ messages in thread
From: Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-28 12:02 UTC (permalink / raw)
To: 65580
[-- Attachment #1: Type: text/plain, Size: 1222 bytes --]
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'
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-help-fns.el-help-do-arg-highlight-Fix-regexp.patch --]
[-- Type: text/patch, Size: 1282 bytes --]
From 1d7fcb5cb407f3b9c6d2040307d2bdad2632456c Mon Sep 17 00:00:00 2001
From: Eshel Yaron <me@eshelyaron.com>
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#65580: [PATCH] ; * lisp/help-fns.el (help-do-arg-highlight): Fix regexp.
2023-08-28 12:02 bug#65580: [PATCH] ; * lisp/help-fns.el (help-do-arg-highlight): Fix regexp Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-01 18:32 ` Stefan Kangas
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Kangas @ 2023-09-01 18:32 UTC (permalink / raw)
To: Eshel Yaron; +Cc: 65580-done
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-01 18:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-28 12:02 bug#65580: [PATCH] ; * lisp/help-fns.el (help-do-arg-highlight): Fix regexp Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-01 18:32 ` Stefan Kangas
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.