GNU bug report logs -
#7240
24.0.50; backward-sentence sometimes overshoots (and breaks doctor)
Previous Next
Reported by: Wolfgang Jenkner <wjenkner <at> inode.at>
Date: Mon, 18 Oct 2010 18:05:02 UTC
Severity: normal
Merged with 9133
Found in version 24.0.50
Done: Chong Yidong <cyd <at> stupidchicken.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 7240 in the body.
You can then email your comments to 7240 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#7240
; Package
emacs
.
(Mon, 18 Oct 2010 18:05:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Wolfgang Jenkner <wjenkner <at> inode.at>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 18 Oct 2010 18:05:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Create a buffer like this
---------- Buffer: foo ---------
This sentence follows a newline.
---------- Buffer: foo ---------
Set point somewhere after the first character of the second line and
type M-a (which runs backward-sentence).
Point is now at the beginning of the first line, but it should be at
the beginning of the second line (cf. (emacs)Top > Text > Sentences).
A somewhat amusing consequence of this bug is that the doctor has been
more clueless than usual for quite a while.
-------------------------- Buffer: *doctor* --------------------------
I am the psychotherapist. Please, describe your problems. Each time
you are finished talking, type RET twice.
Get lost!
Why do you say
get lost?
-------------------------- Buffer: *doctor* --------------------------
Here speaks her real self again:
-------------------------- Buffer: *doctor* --------------------------
I am the psychotherapist. Please, describe your problems. Each time
you are finished talking, type RET twice.
Get lost!
My secretary will send you a bill.
-------------------------- Buffer: *doctor* --------------------------
The reason is this change
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2c81fc9..cdc35d6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2009-01-12 Alan Mackenzie <acm <at> muc.de>
+
+ * textmodes/paragraphs.el (forward-sentence): Change limit of
+ re-search-backward to allow values of `sentence-end' anchored at BOL.
+
2009-01-12 Stefan Monnier <monnier <at> iro.umontreal.ca>
* tar-mode.el (tar-header-block-tokenize): Properly ignore the version
diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
index 937140b..1d4a274 100644
--- a/lisp/textmodes/paragraphs.el
+++ b/lisp/textmodes/paragraphs.el
@@ -449,7 +449,10 @@ sentences. Also, every paragraph boundary terminates sentences as well."
(sentence-end (sentence-end)))
(while (< arg 0)
(let ((pos (point))
- (par-beg (save-excursion (start-of-paragraph-text) (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)))
I'm not sure that I understand the comment correctly but it seems to
describe a case where all text in a paragraph is actually preceded by
a sentence-end in the same paragraph, like
------ Buffer: bar ------
Two leading spaces here
------ Buffer: bar ------
with
(set (make-local-variable 'sentence-end) "^ ") ;one space
(set (make-local-variable 'paragraph-start) " ") ;two spaces
If just reverting that change is not an option the following fix is
straightforward but not tested very much.
Note that this exposes a quirk in start-of-paragraph-text,
viz. repeating M-a at the beginning of the buffer foo above moves
point to the beginning of the second line.
2010-10-18 Wolfgang Jenkner <wjenkner <at> inode.at>
* textmodes/paragraphs.el (forward-sentence): Fix moving backwards
to the beginning of the first sentence in a paragraph.
diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
index 4f1bcef..bcbb3a3 100644
--- a/lisp/textmodes/paragraphs.el
+++ b/lisp/textmodes/paragraphs.el
@@ -465,7 +465,8 @@ sentences. Also, every paragraph boundary terminates sentences as well."
(or (< (match-end 0) pos)
(re-search-backward sentence-end par-beg t)))
(goto-char (match-end 0))
- (goto-char par-beg)))
+ (goto-char opoint)
+ (start-of-paragraph-text)))
(setq arg (1+ arg)))
(while (> arg 0)
(let ((par-end (save-excursion (end-of-paragraph-text) (point))))
Merged 7240 9133.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Thu, 21 Jul 2011 00:03:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#7240
; Package
emacs
.
(Mon, 25 Jul 2011 21:56:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 7240 <at> debbugs.gnu.org (full text, mbox):
Since there has been recent interest in this (merge with bug#9133), I'd
like to point out that there's actually a patch in my original report.
Perhaps the author of the change which caused the different behaviour is
in the best position to decide the matter, though, so I am CC'ing him
hereby :-)
Wolfgang
bug closed, send any further explanations to
9133 <at> debbugs.gnu.org and rms <at> gnu.org
Request was from
Chong Yidong <cyd <at> stupidchicken.com>
to
control <at> debbugs.gnu.org
.
(Thu, 22 Sep 2011 16:33:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#7240
; Package
emacs
.
(Thu, 22 Sep 2011 18:14:01 GMT)
Full text and
rfc822 format available.
Message #15 received at 7240 <at> debbugs.gnu.org (full text, mbox):
RMS's last change to backward-sentence leaves that command broken.
Create a buffer like this
---------- Buffer: foo ---------
This sentence follows some spaces.
---------- Buffer: foo ---------
Set point somewhere after the first character of the second line and
type M-a (which runs backward-sentence).
Point is now at the beginning of the second line, but it should be at
the `T' (cf. (emacs)Top > Text > Sentences).
Obviously, I suggest reverting that change and applying my patch
instead.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#7240
; Package
emacs
.
(Sat, 24 Sep 2011 12:29:03 GMT)
Full text and
rfc822 format available.
Message #18 received at 7240 <at> debbugs.gnu.org (full text, mbox):
Your patch would work correctly. The reason I wanted to do it
differently was to avoid finding the start of the paragraph twice.
Does it work correctly now?
Thanks for making sure we fixed it.
--
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/
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#7240
; Package
emacs
.
(Sat, 24 Sep 2011 14:04:01 GMT)
Full text and
rfc822 format available.
Message #21 received at 7240 <at> debbugs.gnu.org (full text, mbox):
Richard Stallman <rms <at> gnu.org> writes:
> Your patch would work correctly. The reason I wanted to do it
> differently was to avoid finding the start of the paragraph twice.
Thank you very much for the explanation (and sorry if I was a bit too
blunt)!
I note that both you and Alan seem to think that backward-paragraph is
not always quite the right thing to use when moving backwards to
ahem... a paragraph beginning :-)
Wolfgang
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#7240
; Package
emacs
.
(Sat, 24 Sep 2011 17:32:01 GMT)
Full text and
rfc822 format available.
Message #24 received at 7240 <at> debbugs.gnu.org (full text, mbox):
I note that both you and Alan seem to think that backward-paragraph is
not always quite the right thing to use when moving backwards to
ahem... a paragraph beginning :-)
The point is that the paragraph beginning, in the usual sense,
is not the place to move to in this case.
--
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/
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 23 Oct 2011 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 13 years and 243 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.