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: PING!!!: [acm@muc.de: M-a casts anchored `sentence-end' adrift.] Date: Tue, 29 Jul 2008 20:29:05 +0000 Message-ID: <20080729202905.GB2208@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1217363349 7630 80.91.229.12 (29 Jul 2008 20:29:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Jul 2008 20:29:09 +0000 (UTC) To: Stefan Monnier , Chong Yidong , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 29 22:29:58 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KNvpO-0004Py-2w for ged-emacs-devel@m.gmane.org; Tue, 29 Jul 2008 22:29:50 +0200 Original-Received: from localhost ([127.0.0.1]:58151 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KNvoT-0004Az-FL for ged-emacs-devel@m.gmane.org; Tue, 29 Jul 2008 16:28:53 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KNvoL-00048A-6o for emacs-devel@gnu.org; Tue, 29 Jul 2008 16:28:45 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KNvoI-00044r-Og for emacs-devel@gnu.org; Tue, 29 Jul 2008 16:28:43 -0400 Original-Received: from [199.232.76.173] (port=50144 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KNvoI-00044V-9L for emacs-devel@gnu.org; Tue, 29 Jul 2008 16:28:42 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:1722 helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KNvoH-0004S0-Kx for emacs-devel@gnu.org; Tue, 29 Jul 2008 16:28:42 -0400 Original-Received: (qmail 33253 invoked by uid 3782); 29 Jul 2008 20:28:39 -0000 Original-Received: from acm.muc.de (pD9E53939.dip.t-dialin.net [217.229.57.57]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Tue, 29 Jul 2008 22:28:33 +0200 Original-Received: (qmail 5102 invoked by uid 1000); 29 Jul 2008 20:29:05 -0000 Content-Disposition: inline User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.6-4.9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:101717 Archived-At: Hi, Stefan, Yidong, everybody. I've not yet hat an answer to this one, so forgive me reposting it. A minimal answer of 3 letters would be appreciated. :-) Looking at it, I think I could have been clearer. So let me add this sentence: M-a fouls up at a beginning of paragraph when `sentence-end' is anchored at BOL. Thanks! -- Alan Mackenzie (Nuremberg, Germany) ----- Forwarded message from Alan Mackenzie ----- X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on colin2.muc.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Date: Mon, 7 Jul 2008 09:01:35 +0000 To: emacs-devel@gnu.org X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.6-4.9 Subject: M-a casts anchored `sentence-end' adrift. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Hi, Emacs! Suppose you've got an enhanced text mode, in which lines and paragraphs look something like this: o - This is a paragraph with a "bullet" heading. Typically, it extends over several lines, with indentation. o - This line starts a "sub-bullet" paragraph. Now put point on the word "heading" and do M-a. This is going to move point to the "bullet". Clearly, the Right Thing is to move point to "This". An obvious way to do this is to enhance `sentence-end' so that " o - " gets recognised as a full stop. Something like this should do it: (defvar my-sentence-end (let (sentence-end) (concat "^[ \t]*o - [ \t]+\\|\\(" (sentence-end) "\\)"))) , then put (setq sentence-end my-sentence-end) in the mode startup code. Note the "^" at the start of the regexp. However, M-a _still_ doesn't work. The problem is that (forward-sentence -1) limits its re-search-backwards to the paragraph TEXT, as opposed to the entire paragraph including leading whitespace. The specification of sentence-end doesn't preclude anchoring a "full-stop" at BOL (or even EOL). Therefore, there is a bug. The following patch fixes it. Can anybody see any problems with this patch? May I install it? 2008-07-07 Alan Mackenzie * textmodes/paragraphs.el (forward-sentence): Change limit of re-search-backward to allow values of `sentence-end' anchored at BOL. *** paragraphs.el 2008-05-29 18:20:14.000000000 +0000 --- paragraphs.070708.el 2008-07-07 08:54:43.856911952 +0000 *************** *** 887,893 **** (sentence-end (sentence-end))) (while (< arg 0) (let ((pos (point)) ! (par-beg (save-excursion (start-of-paragraph-text) (point)))) (if (and (re-search-backward sentence-end par-beg t) (or (< (match-end 0) pos) (re-search-backward sentence-end par-beg t))) --- 887,893 ---- (sentence-end (sentence-end))) (while (< arg 0) (let ((pos (point)) ! (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))) -- Alan Mackenzie (Nuremberg, Germany). ----- End forwarded message -----