From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Bugs #7240, #9133 - fixing them both at the same time. Date: Fri, 23 Sep 2011 19:26:39 +0000 Message-ID: <20110923192639.GB2562@acm.acm> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1316806259 11719 80.91.229.12 (23 Sep 2011 19:30:59 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 23 Sep 2011 19:30:59 +0000 (UTC) To: Richard Stallman , Wolfgang Jenkner , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 23 21:30:55 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R7BSV-0002Ml-LV for ged-emacs-devel@m.gmane.org; Fri, 23 Sep 2011 21:30:51 +0200 Original-Received: from localhost ([::1]:43097 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R7BSV-0007iY-5t for ged-emacs-devel@m.gmane.org; Fri, 23 Sep 2011 15:30:51 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:49367) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R7BSR-0007iT-PC for emacs-devel@gnu.org; Fri, 23 Sep 2011 15:30:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R7BSQ-00086h-KX for emacs-devel@gnu.org; Fri, 23 Sep 2011 15:30:47 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:29512 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R7BSQ-00086D-Bs for emacs-devel@gnu.org; Fri, 23 Sep 2011 15:30:46 -0400 Original-Received: (qmail 71733 invoked by uid 3782); 23 Sep 2011 19:30:43 -0000 Original-Received: from acm.muc.de (pD95579CB.dip.t-dialin.net [217.85.121.203]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 23 Sep 2011 21:30:42 +0200 Original-Received: (qmail 3567 invoked by uid 1000); 23 Sep 2011 19:26:39 -0000 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:144233 Archived-At: 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).