From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Wolfgang Jenkner Newsgroups: gmane.emacs.bugs Subject: bug#7240: 24.0.50; backward-sentence sometimes overshoots (and breaks doctor) Date: Mon, 18 Oct 2010 18:49:42 +0200 Message-ID: <85wrpfbg49.fsf@iznogoud.viz> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1287425571 32162 80.91.229.12 (18 Oct 2010 18:12:51 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 18 Oct 2010 18:12:51 +0000 (UTC) To: 7240@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 18 20:12:49 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1P7uCS-0008Kd-4B for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Oct 2010 20:12:44 +0200 Original-Received: from localhost ([127.0.0.1]:56943 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P7uCR-0000B1-9W for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Oct 2010 14:12:43 -0400 Original-Received: from [140.186.70.92] (port=53290 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P7uCK-0000Ap-Gl for bug-gnu-emacs@gnu.org; Mon, 18 Oct 2010 14:12:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P7uCJ-0006gE-Cc for bug-gnu-emacs@gnu.org; Mon, 18 Oct 2010 14:12:36 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43204) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P7uCJ-0006g6-Ax for bug-gnu-emacs@gnu.org; Mon, 18 Oct 2010 14:12:35 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1P7u50-00004u-Gh; Mon, 18 Oct 2010 14:05:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Wolfgang Jenkner Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 Oct 2010 18:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 7240 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.128742508232745 (code B ref -1); Mon, 18 Oct 2010 18:05:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Oct 2010 18:04:42 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P7u4f-0008W4-T9 for submit@debbugs.gnu.org; Mon, 18 Oct 2010 14:04:42 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P7sqe-0007uk-4I for submit@debbugs.gnu.org; Mon, 18 Oct 2010 12:46:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P7suE-00045I-TW for submit@debbugs.gnu.org; Mon, 18 Oct 2010 12:49:51 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:36195) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P7suE-00045E-R6 for submit@debbugs.gnu.org; Mon, 18 Oct 2010 12:49:50 -0400 Original-Received: from [140.186.70.92] (port=53567 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P7suD-00077o-Go for bug-gnu-emacs@gnu.org; Mon, 18 Oct 2010 12:49:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P7suC-00044l-6K for bug-gnu-emacs@gnu.org; Mon, 18 Oct 2010 12:49:49 -0400 Original-Received: from mx04.lb01.inode.at ([62.99.145.4]:34894 helo=mx.inode.at) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P7suB-00044F-RV for bug-gnu-emacs@gnu.org; Mon, 18 Oct 2010 12:49:48 -0400 Original-Received: from [85.127.87.65] (port=5409 helo=iznogoud.viz) by smartmx-04.inode.at with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1P7su7-000318-80 for bug-gnu-emacs@gnu.org; Mon, 18 Oct 2010 18:49:43 +0200 Original-Received: from wolfgang by iznogoud.viz with local (Exim 4.72 (FreeBSD)) (envelope-from ) id 1P7su6-00048l-1X for bug-gnu-emacs@gnu.org; Mon, 18 Oct 2010 18:49:42 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Mailman-Approved-At: Mon, 18 Oct 2010 14:04:39 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 18 Oct 2010 14:05:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:40962 Archived-At: 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 + + * 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 * 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 * 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))))