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

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

fill-region eats whitespace


From: Andreas Roehler
Subject: fill-region eats whitespace
Date: Thu, 16 Feb 2006 21:16:36 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050921

fill-region eats whitespace after sentence-end-dot.
Bug in fill.el, GNU Emacs 22.0.50.1 - CVS,
Example:

Filling the infotext-Node Checklist produces: - release.(If -

Looks afterwards like this:

   The best way to send a bug report is to mail it
electronically to the Emacs maintainers at
<address@hidden>, or to
<address@hidden> if you are pretesting an
Emacs beta release.(If you want to suggest a change as
an improvement, use the same address.)

My bugfix suggestions (tested in text-mode): Just replace all the
delete-region stuff with a simple `fixup-whitespace':

169,197c169,202
<       (delete-region
<        (cond
<         ;; `sentence-end' matched and did not match all spaces.
<         ;; I.e. it only matched the number of spaces it needs: drop the rest.
<         ((and (match-end 1) (> (match-end 0) (match-end 1)))  (match-end 1))
<         ;; `sentence-end' matched but with nothing left.  Either that means
<         ;; nothing should be removed, or it means it's the "old-style"
<         ;; sentence-end which matches all it can.  Keep only 2 spaces.
<         ;; We probably don't even need to check `sentence-end-double-space'.
<         ((match-end 1)
<          (min (match-end 0)
<               (+ (if sentence-end-double-space 2 1)
<                  (save-excursion (goto-char (match-end 0))
<                                  (skip-chars-backward " ")
<                                  (point)))))
<         (t ;; It's not an end of sentence.
<          (+ (match-beginning 0)
<             ;; Determine number of spaces to leave:
<             (save-excursion
<               (skip-chars-backward " ]})\"'")
<               (cond ((and sentence-end-double-space
<                           (or (memq (preceding-char) '(?. ?? ?!))
<                               (and sentence-end-without-period
<                                    (= (char-syntax (preceding-char)) ?w)))) 2)
<                     ((and colon-double-space
<                           (= (preceding-char) ?:))  2)
<                     ((char-equal (preceding-char) ?\n)  0)
<                     (t 1))))))
<        (match-end 0))))))
---
>       (fixup-whitespace)
>
>       ;; (delete-region
>       ;;  (cond
>       ;;   ;; `sentence-end' matched and did not match all spaces.
>       ;;   ;; I.e. it only matched the number of spaces it needs: drop the
rest.
>       ;;   ((and (match-end 1) (> (match-end 0) (match-end 1)))  (match-end 
> 1))
>       ;;   ;; `sentence-end' matched but with nothing left.  Either that means
>       ;;   ;; nothing should be removed, or it means it's the "old-style"
>       ;;   ;; sentence-end which matches all it can.  Keep only 2 spaces.
>       ;;   ;; We probably don't even need to check 
> `sentence-end-double-space'.
>       ;;   ((match-end 1)
>       ;;    (min (match-end 0)
>       ;;      (+ (if sentence-end-double-space 2 1)
>       ;;         (save-excursion (goto-char (match-end 0))
>       ;;                         (skip-chars-backward " ")
>       ;;                         (point)))))
>       ;;   (t ;; It's not an end of sentence.
>       ;;    (+ (match-beginning 0)
>       ;;       ;; Determine number of spaces to leave:
>       ;;       (save-excursion
>       ;;      (skip-chars-backward " ]})\"'")
>       ;;      (cond ((and sentence-end-double-space
>       ;;                  (or (memq (preceding-char) '(?. ?? ?!))
>       ;;                      (and sentence-end-without-period
>       ;;                           (= (char-syntax (preceding-char)) ?w)))) 2)
>       ;;            ((and colon-double-space
>       ;;                  (= (preceding-char) ?:))  2)
>       ;;            ((char-equal (preceding-char) ?\n)  0)
>       ;;            (t 1))))))
>       ;;  (match-end 0))
>
>       ))))

Thanks for developing Emacs!

Andreas Röhler




reply via email to

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