emacs-devel
[Top][All Lists]
Advanced

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

Bugs #7240, #9133 - fixing them both at the same time.


From: Alan Mackenzie
Subject: Bugs #7240, #9133 - fixing them both at the same time.
Date: Fri, 23 Sep 2011 19:26:39 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

Good Day, Richard and good evening, Wolfgang.

A quick reminder about these bugs:

#7240:
############################################

  This sentence follows some spaces.
############################################
Put point inside the sentence and type M-a.  Point goes to BOL rather
than to the "T".



#9133:
############################################
Test.

This is a test.  Does it work?
############################################
Put point at the end.  Do M-a  C-x DEL.  This spuriously deletes the
separating line.



The cause of these failures was trying to make one variable, par-beg, do
two different jobs, namely 1) beginning of the paragraph; 2) start of
text in the paragraph.

By separating these out into par-beg and text-beg the bug simply
evaporates.

Please try out the following patch and confirm to me that it's OK.  Then
I will commit it.

Wolfgang:  Thanks very much for taking the trouble to report this bug,
submitting a patch (even if it wasn't quite right), and nagging me to get
it properly fixed.  ;-)



=== modified file 'lisp/textmodes/paragraphs.el'
*** lisp/textmodes/paragraphs.el        2011-09-22 13:34:02 +0000
--- lisp/textmodes/paragraphs.el        2011-09-23 18:38:42 +0000
***************
*** 455,474 ****
    (let ((opoint (point))
          (sentence-end (sentence-end)))
      (while (< arg 0)
!       (let ((pos (point))
!           (par-beg
!            (save-excursion
!              (start-of-paragraph-text)
!              ;; Move PAR-BEG back over indentation
!              ;; to allow s1entence-end to match if it is anchored at
!              ;; BOL and the paragraph starts indented.
!              (beginning-of-line)
!              (point))))
        (if (and (re-search-backward sentence-end par-beg t)
                 (or (< (match-end 0) pos)
                     (re-search-backward sentence-end par-beg t)))
            (goto-char (match-end 0))
!         (goto-char par-beg)))
        (setq arg (1+ arg)))
      (while (> arg 0)
        (let ((par-end (save-excursion (end-of-paragraph-text) (point))))
--- 455,481 ----
    (let ((opoint (point))
          (sentence-end (sentence-end)))
      (while (< arg 0)
!       (let* ((pos (point))
!            (text-beg
!             (progn (start-of-paragraph-text)
!                    (point)))
!            ;; PAR-BEG allows sentence-end to match if it is
!            ;; anchored at BOL and the paragraph starts indented.
!            ;; This can happen thus, when "  (iii)" is an EOS anchored
!            ;; at BOL:
!            ;;   (iii) Beginning of next sentence.
!            (par-beg
!             (progn
!               (backward-paragraph)
!               (if (looking-at paragraph-separate)
!                   (forward-line))
!               (point))))
!       (goto-char pos)
        (if (and (re-search-backward sentence-end par-beg t)
                 (or (< (match-end 0) pos)
                     (re-search-backward sentence-end par-beg t)))
            (goto-char (match-end 0))
!         (goto-char text-beg)))
        (setq arg (1+ arg)))
      (while (> arg 0)
        (let ((par-end (save-excursion (end-of-paragraph-text) (point))))



-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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