From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: flush-lines and keep-lines Date: Wed, 15 Jun 2005 22:17:48 -0500 (CDT) Message-ID: <200506160317.j5G3Hmp26222@raven.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1118892186 3729 80.91.229.2 (16 Jun 2005 03:23:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 16 Jun 2005 03:23:06 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 16 05:23:05 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Dikxu-0007Ch-Ab for ged-emacs-devel@m.gmane.org; Thu, 16 Jun 2005 05:22:50 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dil3E-00051k-UN for ged-emacs-devel@m.gmane.org; Wed, 15 Jun 2005 23:28:20 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Dil2k-0004tv-Nx for emacs-devel@gnu.org; Wed, 15 Jun 2005 23:27:51 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Dil2b-0004qs-67 for emacs-devel@gnu.org; Wed, 15 Jun 2005 23:27:43 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dil2a-0004oE-UF for emacs-devel@gnu.org; Wed, 15 Jun 2005 23:27:40 -0400 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Dikvr-0005sO-0j for emacs-devel@gnu.org; Wed, 15 Jun 2005 23:20:43 -0400 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.12.10/8.12.10) with ESMTP id j5G3J1CK005118 for ; Wed, 15 Jun 2005 22:19:01 -0500 (CDT) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.7p1+Sun/8.11.7) id j5G3Hmp26222; Wed, 15 Jun 2005 22:17:48 -0500 (CDT) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: emacs-devel@gnu.org 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:38922 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:38922 There are some inconsistencies between flush-lines and keep-lines, if they operate on a region that contains partial lines. If point is not at the beginning of a line, `flush-lines' gets rid of the line point is on if and only if the part of the line _after_ point contains a match for the regexp. `keep-lines' unconditionally keeps that line. This difference in philosophy might not be too bad and could just be documented. With transient mark mode enabled and an active region, a partial line at the beginning of the region is treated as above. Might again not be too bad. `flush-lines' erases a partial line at the end of the region if and only if the part _inside the region_ contains a match for regexp, thereby being consistent with its own behavior for the line at the beginning of the region. But the behavior of `keep-lines' there seems very unexpected. Take a buffer with the following three lines: 12 34 56 If the region starts at 2 and ends at 5 (both _inclusive_) M-x keep-lines RET 7 RET results in: 12 6 The last line got _partially_ erased. The docs seem to suggest that keep-lines should keep or erase entire lines, not parts of them, even in the presence of partial lines. To make the behavior of `keep-lines' symmetric at both ends of the region, the last line should be unconditionally kept in its entirety. Maybe the difference with flush-lines could then be explained by the principle: If you are not sure, just by looking at the region, whether to erase or keep, then keep the line. You can never be sure by looking only at part of a line that the entire line does _not_ contain a match, so keep-lines always needs to keep all partial lines. But if the part you are seeing contains a match, you _know_ that flush-lines needs to erase it. Sincerely, Luc.