[Top][All Lists]

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

Re: canonically-space-region and fill-delete-newlines leave bounds

From: Stefan Monnier
Subject: Re: canonically-space-region and fill-delete-newlines leave bounds
Date: Thu, 24 May 2007 12:14:20 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

>>>>> "Nikolaj" == Nikolaj Schumacher <address@hidden> writes:

> Hello,

> `canonically-space-region' doesn't stop at the end of the region.
> That's because it limits its searches at `end', while the actual region
> keeps getting smaller.

I've installed the patch below to fix this problem.

> `fill-delete-newlines' has the same problem because it calls
> `canonically-space-region' and because it uses the `to' variable
> afterwards.

I don't think it's a real problem: fill-delete-newlines should simply always
be called with a marker as second argument (and this is currently the case
in the only call to it).  Most code in fill.el relies on this everywhere.
I just overlooked that canonically-space-region is interactive and should
hence double check its argument.


--- fill.el     16 mai 2007 11:59:30 -0400      1.203
+++ fill.el     24 mai 2007 11:56:08 -0400      
@@ -159,6 +159,11 @@
 and `sentence-end-without-period').
 Remove indentation from each line."
   (interactive "*r")
+  ;; Ideally, we'd want to scan the text from the end, so that changes to
+  ;; text don't affect the boundary, but the regexp we match against does
+  ;; not match as eagerly when matching backward, so we instead use
+  ;; a marker.
+  (unless (markerp end) (setq end (copy-marker end t)))
   (let ((end-spc-re (concat "\\(" (sentence-end) "\\) *\\|  +")))
       (goto-char beg)

reply via email to

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