* Bugs #7240, #9133 - fixing them both at the same time.
@ 2011-09-23 19:26 Alan Mackenzie
2011-09-23 23:45 ` Wolfgang Jenkner
2011-09-24 12:28 ` Richard Stallman
0 siblings, 2 replies; 3+ messages in thread
From: Alan Mackenzie @ 2011-09-23 19:26 UTC (permalink / raw)
To: Richard Stallman, Wolfgang Jenkner, emacs-devel
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).
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Bugs #7240, #9133 - fixing them both at the same time.
2011-09-23 19:26 Bugs #7240, #9133 - fixing them both at the same time Alan Mackenzie
@ 2011-09-23 23:45 ` Wolfgang Jenkner
2011-09-24 12:28 ` Richard Stallman
1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Jenkner @ 2011-09-23 23:45 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: Richard Stallman, emacs-devel
Alan Mackenzie <acm@muc.de> writes:
> 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.
So part of your change is
> (let ((opoint (point))
> (sentence-end (sentence-end)))
> (while (< arg 0)
> ! (let* ((pos (point))
> ! (text-beg
> ! (progn (start-of-paragraph-text)
> ! (point)))
[...]
> (goto-char (match-end 0))
> ! (goto-char text-beg)))
and my whole patch is
(goto-char (match-end 0))
- (goto-char par-beg)))
+ (goto-char opoint)
+ (start-of-paragraph-text)))
This is equivalent. Of course, style matters.
The rest of your change (with respect to the code before rms patched it)
consists in adding the 4th and 5th line in
> ! (par-beg
> ! (progn
> ! (backward-paragraph)
> ! (if (looking-at paragraph-separate)
> ! (forward-line))
> ! (point))))
That may be a good change, but it is not directly related to the bugs.
> Please try out the following patch and confirm to me that it's OK. Then
> I will commit it.
Oh my. I'm afraid you got a code review instead;-)
> Wolfgang: Thanks very much for taking the trouble to report this bug,
> submitting a patch (even if it wasn't quite right),
Wolfgang
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Bugs #7240, #9133 - fixing them both at the same time.
2011-09-23 19:26 Bugs #7240, #9133 - fixing them both at the same time Alan Mackenzie
2011-09-23 23:45 ` Wolfgang Jenkner
@ 2011-09-24 12:28 ` Richard Stallman
1 sibling, 0 replies; 3+ messages in thread
From: Richard Stallman @ 2011-09-24 12:28 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: wjenkner, emacs-devel
Your patch is correct, but I wrote it a little more nicely.
Thanks.
--
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-09-24 12:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-23 19:26 Bugs #7240, #9133 - fixing them both at the same time Alan Mackenzie
2011-09-23 23:45 ` Wolfgang Jenkner
2011-09-24 12:28 ` Richard Stallman
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.