emacs-devel
[Top][All Lists]
Advanced

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

Fixing C-x DEL bug


From: Richard Stallman
Subject: Fixing C-x DEL bug
Date: Thu, 18 Aug 2011 19:43:27 -0400

I decided to debug the C-x DEL bug I reported a few weeks ago.
I found that the problem is in this change:

    2009-01-12  Alan Mackenzie  <address@hidden>

            * textmodes/paragraphs.el (forward-sentence): Change limit of
            re-search-backward to allow values of `sentence-end' anchored at 
BOL.

I wrote a fix that handles my case right (see below), and maybe
handles that other case, but I can't be sure because the description
of that case is not very clear to me.

In fact, the idea of a sentence-end at the beginning of the line
seems rather bizarre.  Alan, what case is that meant for?

=== modified file 'lisp/textmodes/paragraphs.el'
*** lisp/textmodes/paragraphs.el        2011-02-28 01:07:29 +0000
--- lisp/textmodes/paragraphs.el        2011-08-18 02:45:53 +0000
***************
*** 456,476 ****
          (sentence-end (sentence-end)))
      (while (< arg 0)
        (let ((pos (point))
!           ;; We used to use (start-of-paragraph-text), but this can
!           ;; prevent sentence-end from matching if it is anchored at
!           ;; BOL and the paragraph starts indented.
!           (par-beg (save-excursion (backward-paragraph) (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))))
!        (if (re-search-forward sentence-end par-end t)
!          (skip-chars-backward " \t\n")
!        (goto-char par-end)))
        (setq arg (1- arg)))
      (constrain-to-field nil opoint t)))
  
--- 456,480 ----
          (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))))
!       (if (re-search-forward sentence-end par-end t)
!           (skip-chars-backward " \t\n")
!         (goto-char par-end)))
        (setq arg (1- arg)))
      (constrain-to-field nil opoint t)))
  




-- 
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org  www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
  Use free telephony http://directory.fsf.org/category/tel/



reply via email to

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