bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#70832: 30.0.50; repunctuate-sentences should respect sentence-end-do


From: Geoffrey Teale
Subject: bug#70832: 30.0.50; repunctuate-sentences should respect sentence-end-double-space
Date: Mon, 13 May 2024 09:39:52 +0200


On Mon, 13 May 2024 at 08:58, Juri Linkov <juri@linkov.net> wrote:
> So you are saying that query-replace already does the job?  Fine by
> me; if no one else supports this bug report in a week or two, I will
> close.

Actually there is another problem: whereas it's easy to rely on the
variable sentence-end-double-space as was asked by this request:

diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
index af99a96e045..974a83efdea 100644
--- a/lisp/textmodes/paragraphs.el
+++ b/lisp/textmodes/paragraphs.el
@@ -532,7 +532,10 @@ repunctuate-sentences
                              (end (use-region-end))))
   (interactive (list nil (use-region-beginning) (use-region-end)))
   (let ((regexp "\\([]\"')]?\\)\\([.?!]\\)\\([]\"')]?\\) +")
-        (to-string "\\1\\2\\3  "))
+        (to-string (concat "\\1\\2\\3 "
+                           (if sentence-end-double-space
+                               " "
+                             ""))))
     (if no-query
         (progn
           (when start (goto-char start))

But the problem is that when a user customized
sentence-end-double-space to nil, the user still
might want to put two spaces since the docstring says:

  "Put two spaces at the end of sentences"

So using one space will contradict the docstring.

I was actually aware about the docstring when I raised the bug, but I assumed that changing that docstring would be part of the fix.  If I get to the essence of the issue: two spaces at the end of a sentence is no longer considered correct in most prose-authoring contexts.  In that sense what I really wanted is the ability to automatically remove any such instances from an Org or Markdown file, for example.  When I went looking for that in emacs this seemed like the correct tool for the job, and it is a little bit glaring that there's such a variable that one can set, but this function, defined in the same file, doesn't respect it.  

That said, yes of course one could easily use query-replace as suggested above. 

-- 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]