Subject: Re: bug#72704: 29.4; repunctuate-sentences ignores NO-QUERY

From: Visuwesh <[email-masked]>
Date: Sat, 24 Aug 2024 12:23:58 +0530

[வெள்ளி ஆகஸ்ட் 23, 2024] Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote:

> [...]
> Please see the attached patch, which makes repunctuate-sentences respect
> the current prefix argument.
>
> Juri, do I need to update the interactive-args declaration?  I'm not
> totally clear on how that works.
>
> Thank you!
>
> Joseph
>
> From b5689dd1907fc8e2bd2752d8c8248f3747d52ff3 Mon Sep 17 00:00:00 2001
> From: Joseph Turner <[email-masked]>
> Date: Fri, 23 Aug 2024 23:19:33 -0700
> Subject: [PATCH] Interpret prefix argument as NO-QUERY in
>  repunctuate-sentences
>
> * lisp/textmodes/paragraphs.el (repunctuate-sentences): Respect
> current-prefix-arg.
> * etc/NEWS: Announce changes.
> ---
>  etc/NEWS                     | 4 ++++
>  lisp/textmodes/paragraphs.el | 3 ++-
>  2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/etc/NEWS b/etc/NEWS
> index 2ddbab29528..5f9f86bce53 100644
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -95,6 +95,10 @@ When using 'visual-wrap-prefix-mode' in buffers with variable-pitch
>  fonts, the wrapped text will now be lined up correctly so that it's
>  exactly below the text after the prefix on the first line.
>  
> +---
> +** When invoked with a prefix argument, 'repunctuate-sentences' now
> +replaces text without querying for confirmation.
> +
>  
>  * Changes in Specialized Modes and Packages in Emacs 31.1
>  
> diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
> index be741e6517b..79bfc7fab3c 100644
> --- a/lisp/textmodes/paragraphs.el
> +++ b/lisp/textmodes/paragraphs.el
> @@ -550,7 +550,8 @@ repunctuate-sentences
>  filters to skip occurrences of spaces that don't need to be replaced."

Should you not update the docstring to say that interactively prefix
argument implies a non-nil NO-QUERY argument?
[ P.S. you forgot to include the bug number in the commit log.  ]

>    (declare (interactive-args (start (use-region-beginning))
>                               (end (use-region-end))))
> -  (interactive (list nil (use-region-beginning) (use-region-end)))
> +  (interactive
> +   (list current-prefix-arg (use-region-beginning) (use-region-end)))
>    (let ((regexp "\\([]\"')]?\\)\\([.?!]\\)\\([]\"')]?\\) +")
>          (to-string "\\1\\2\\3  "))
>      (if no-query