emacs-devel
[Top][All Lists]
Advanced

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

Re: Fixing C-x DEL bug


From: Alan Mackenzie
Subject: Re: Fixing C-x DEL bug
Date: Fri, 19 Aug 2011 08:18:22 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

Hello, Richard.

On Thu, Aug 18, 2011 at 07:43:27PM -0400, Richard Stallman wrote:
> I decided to debug the C-x DEL bug I reported a few weeks ago.
> I found that the problem is in this change:

Where did you report it?  I've had a look through emacs-devel and on
debbugs.gnu.org, but not found the bug.  I don't know what your bug is.

>     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?

So that what follows is recognised as the beginning of the next sentence.
In particular, in my personal text mode, I use "bullet points" something
like this:

    o - One point
      o - Indented point
      o - This sentence starts with "This".

I want M-a on the third line to go back to "This", not to the bullet.  If
"This" is to be recognised as BO sentence, then the "    o - ", anchored
at BOL, needs to be an EO sentence.

> === 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)))

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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