Subject: 29.2; `shortdoc-copy-function-as-kill' copies the ')' for some functions

From: <[email-masked]>
Date: Sun, 10 Mar 2024 14:47:52 -0400

Emacs Maintainers,

   The function ‘shortdoc-copy-function-as-kill’ copies the
function name of the function of the shortdoc item in
which point is located.  This works as expected when a
function has arguments, but when a function does not have
arguments, then ‘shortdoc-copy-function-as-kill’ copies the
trailing parenthesis (that is, the ‘)’).

   So, for example in the shortdoc function summary for
‘buffer’, when point is in the item for ‘current-buffer’,
then ‘shortdoc-copy-function-as-kill’ (mapped to ‘w’) will
copy the text "current-buffer)", rather than the expected
"current-buffer".  The same error occurs for ‘point’,
‘point-min’, ‘point-max’, and so on.

   In the definition of ‘shortdoc-copy-function-as-kill’,
the specification of the regular expression that is used to
match the function name searches for a space (" ") to find
the end of the name, rather than searching for a space or
right parenthesis (" )").  That is, the expression (in " ")
in the ‘when-let*’ expression:

    (when-let* ((re (rx bol "(" (group (+ (not (in " "))))))...

A possible fix is to change (in " ") to (in " )"):

    (when-let* ((re (rx bol "(" (group (+ (not (in " )"))))))...

--