unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#69720: 29.2; `shortdoc-copy-function-as-kill' copies the ')' for some functions
@ 2024-03-10 18:47 tpeplt
  2024-03-14 16:16 ` tpeplt
  2024-03-16 11:08 ` Eli Zaretskii
  0 siblings, 2 replies; 3+ messages in thread
From: tpeplt @ 2024-03-10 18:47 UTC (permalink / raw)
  To: 69720

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 " )"))))))...

--





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#69720: 29.2; `shortdoc-copy-function-as-kill' copies the ')' for some functions
  2024-03-10 18:47 bug#69720: 29.2; `shortdoc-copy-function-as-kill' copies the ')' for some functions tpeplt
@ 2024-03-14 16:16 ` tpeplt
  2024-03-16 11:08 ` Eli Zaretskii
  1 sibling, 0 replies; 3+ messages in thread
From: tpeplt @ 2024-03-14 16:16 UTC (permalink / raw)
  To: 69720


Here is a recipe for reproducing this error:

1. Start Emacs from a shell prompt with ‘emacs -Q’.

2. Run the ‘shortdoc’ command: M-x shortdoc

3. At the prompt "Show summary for functions in: ", type: buffer RET

4. In the buffer "*Shortdoc buffer*", position point on the line that
begins description of the ‘current-buffer’ entry, (current-buffer).

5. Type ‘w’ to copy the name of the function (w runs the command
‘shortdoc-copy-function-as-kill’).

6. Switch to the *scratch* buffer.

7. Type C-y to yank the name of the function ‘current-buffer’ into the
buffer.  Note that the text that is inserted is "current-buffer)", with
a trailing parenthesis instead of "current-buffer".

8. Repeat the sequence of operations above to copy the names of
functions that have at least one argument.  The function name is copied
correctly.

9. Repeat the sequence of operations above to copy the names of other
functions in the *Shortdoc buffer* that have no arguments (such as
‘point’, ‘point-min’, and so on).  Note that when the function name is
yanked into the *scratch* buffer, a trailing parenthesis is
(incorrectly) included in the text.

--





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#69720: 29.2; `shortdoc-copy-function-as-kill' copies the ')' for some functions
  2024-03-10 18:47 bug#69720: 29.2; `shortdoc-copy-function-as-kill' copies the ')' for some functions tpeplt
  2024-03-14 16:16 ` tpeplt
@ 2024-03-16 11:08 ` Eli Zaretskii
  1 sibling, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2024-03-16 11:08 UTC (permalink / raw)
  To: tpeplt; +Cc: 69720-done

> From: <tpeplt@gmail.com>
> 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 " )"))))))...

Thanks, fixed on the emacs-29 branch, and closing the bug.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-16 11:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-10 18:47 bug#69720: 29.2; `shortdoc-copy-function-as-kill' copies the ')' for some functions tpeplt
2024-03-14 16:16 ` tpeplt
2024-03-16 11:08 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).