unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Visuwesh <visuweshm@gmail.com>
Cc: briandg@gmail.com, Juri Linkov <juri@linkov.net>,
	Richard Stallman <rms@gnu.org>,
	72704@debbugs.gnu.org
Subject: bug#72704: 29.4; repunctuate-sentences ignores NO-QUERY
Date: Sat, 24 Aug 2024 00:51:36 -0700	[thread overview]
Message-ID: <87o75i2waf.fsf@breatheoutbreathe.in> (raw)
In-Reply-To: <87o75i76nt.fsf@gmail.com> (Visuwesh's message of "Sat, 24 Aug 2024 12:23:58 +0530")

[-- Attachment #1: Type: text/plain, Size: 2557 bytes --]

Visuwesh <visuweshm@gmail.com> writes:

> [வெள்ளி ஆகஸ்ட் 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 <joseph@breatheoutbreathe.in>
>> 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.
>> +
>>  \f
>>  * 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.  ]

You're right on both accounts.  Thanks.  See patch.

>>    (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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Interpret-prefix-argument-as-NO-QUERY-in-repunctuate.patch --]
[-- Type: text/x-diff, Size: 2303 bytes --]

From dccbecaf1b421c60a8846d782fb437d1cad3aa1f Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
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.  bug#72704
* etc/NEWS: Announce changes.
---
 etc/NEWS                     |  4 ++++
 lisp/textmodes/paragraphs.el | 10 ++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

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.
+
 \f
 * Changes in Specialized Modes and Packages in Emacs 31.1
 
diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
index be741e6517b..f9351ef5afe 100644
--- a/lisp/textmodes/paragraphs.el
+++ b/lisp/textmodes/paragraphs.el
@@ -545,12 +545,14 @@ repunctuate-sentences
 It works using `query-replace-regexp'.  In Transient Mark mode,
 if the mark is active, operate on the contents of the region.
 Second and third arg START and END specify the region to operate on.
-If optional argument NO-QUERY is non-nil, make changes without asking
-for confirmation.  You can use `repunctuate-sentences-filter' to add
-filters to skip occurrences of spaces that don't need to be replaced."
+If optional argument NO-QUERY is non-nil (interactively with prefix
+argument), make changes without asking for confirmation.  You can use
+`repunctuate-sentences-filter' to add filters to skip occurrences of
+spaces that don't need to be replaced."
   (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
-- 
2.41.0


  reply	other threads:[~2024-08-24  7:51 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-18 20:14 bug#72704: 29.4; repunctuate-sentences ignores NO-QUERY Brian Green
2024-08-19  4:48 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-19  6:52   ` Juri Linkov
2024-08-24  3:00     ` Richard Stallman
2024-08-24  6:18       ` Eli Zaretskii
2024-08-27 13:06         ` Richard Stallman
2024-08-27 13:53           ` Eli Zaretskii
2024-08-30  2:32             ` Richard Stallman
2024-08-30  6:40               ` Eli Zaretskii
2024-08-27 13:06         ` Richard Stallman
2024-08-24  6:30       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-24  6:53         ` Visuwesh
2024-08-24  7:51           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-08-24  7:28         ` Eli Zaretskii
2024-08-24  7:54           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-24  8:29             ` Brian Green
2024-08-24  9:33               ` Eli Zaretskii
2024-08-24 17:09                 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-24 18:23                   ` Brian Green
2024-08-24 19:18                     ` Brian Green
2024-08-24 19:41                       ` Brian Green
2024-08-25  2:23                         ` Visuwesh
2024-08-25 16:53                           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-31  9:23                   ` Eli Zaretskii
2024-08-31 12:19                     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-31 12:39                       ` Eli Zaretskii
2024-08-31 15:50                         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-31 16:08                           ` Eli Zaretskii
2024-08-31 17:26                             ` Brian Green
2024-08-25  6:51         ` Juri Linkov
2024-08-25 15:11           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o75i2waf.fsf@breatheoutbreathe.in \
    --to=bug-gnu-emacs@gnu.org \
    --cc=72704@debbugs.gnu.org \
    --cc=briandg@gmail.com \
    --cc=joseph@breatheoutbreathe.in \
    --cc=juri@linkov.net \
    --cc=rms@gnu.org \
    --cc=visuweshm@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).