From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: shouldn't `delete-blank-lines' treat form-feed as whitespace? Date: Wed, 3 Mar 2010 14:21:29 -0800 Message-ID: References: <4CB6D99021EF440EAB10FFDB2740FE8B@us.oracle.com> <4B8ED635.7010102@harpegolden.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1267655003 20920 80.91.229.12 (3 Mar 2010 22:23:23 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 3 Mar 2010 22:23:23 +0000 (UTC) Cc: emacs-devel@gnu.org To: "'David De La Harpe Golden'" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 03 23:23:18 2010 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.69) (envelope-from ) id 1NmwyK-0004Nv-OT for ged-emacs-devel@m.gmane.org; Wed, 03 Mar 2010 23:23:17 +0100 Original-Received: from localhost ([127.0.0.1]:58829 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmwyK-0002XQ-3J for ged-emacs-devel@m.gmane.org; Wed, 03 Mar 2010 17:23:16 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NmwyE-0002WC-8G for emacs-devel@gnu.org; Wed, 03 Mar 2010 17:23:10 -0500 Original-Received: from [140.186.70.92] (port=54150 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmwyD-0002Vk-9g for emacs-devel@gnu.org; Wed, 03 Mar 2010 17:23:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NmwyB-00035i-09 for emacs-devel@gnu.org; Wed, 03 Mar 2010 17:23:09 -0500 Original-Received: from rcsinet12.oracle.com ([148.87.113.124]:18574) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NmwyA-00035b-RO for emacs-devel@gnu.org; Wed, 03 Mar 2010 17:23:06 -0500 Original-Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet12.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o23MN3qr009224 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 3 Mar 2010 22:23:04 GMT Original-Received: from acsmt354.oracle.com (acsmt354.oracle.com [141.146.40.154]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o23JiB14029548; Wed, 3 Mar 2010 22:23:02 GMT Original-Received: from abhmt017.oracle.com by acsmt354.oracle.com with ESMTP id 58595441267654889; Wed, 03 Mar 2010 14:21:29 -0800 Original-Received: from dradamslap1 (/130.35.178.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 03 Mar 2010 14:21:28 -0800 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <4B8ED635.7010102@harpegolden.net> Thread-Index: Acq7GYE4VihKiu1zT+usRPGyoRlg4QAA3shQ X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Source-IP: acsmt354.oracle.com [141.146.40.154] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090204.4B8EE146.021B:SCFMA4539814,ss=1,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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:121627 Archived-At: > > `delete-blank-lines' treats SPC, TAB, and newline as whitespace. > > Shouldn't it also treat form-feed (aka \f, aka ^L) as whitespace? > > While it's logically formally a whitespace class character, I'm quite > unconvinced it would "feel right" to me. formfeed is usually put in > much more rarely and with more forethought than space/tab/newline. > > It's also not "blank" in one possibly important sense: in emacs > "out-of-box" it shows up as a quite visible "^L", whereas > SPC/TAB/newline are invisible unless you turn on whitespace. > > So delete-blank-lines would end up deleting lines, that from a naive > viewpoint, look like they "have something on them". > > Imagine you've got a text file with "page breaks" in it > (represented as > formfeeds as is/was the convention (see "C-x [" / "C-x ]" !)): > > ^L > alpha > bravo > charlie[] > > > > > > > ^L > delta > epsilon > > > Say I hit C-x C-o where the point [] is. I wouldn't just delete those > stray blank lines on the first page, I'd suddenly merge two pages. > So I strongly suspect changing it would annoy people who > still sprinkle > ^L through their code or other files for pagination. > Something I guess > I personally don't do so much anymore (got a laser printer not a dot > matrix...), but anyway. Your point is a good one. Actually, the place where I ran into this, and where I thought it would be appropriate for \f to be considered blank lines and be deleted, was somewhat similar. I use an even more noticeable (much more noticeable) display artifact than a visible `^L' (see http://www.emacswiki.org/emacs/PrettyControlL). And I do use ^L in my libraries to separate various code and commentary sections (into "pages"). I use `finder-commentary' in some of my code, and it leaves such a ^L at the end (it comes before "Change log"), not considering it to be a blank line. (I also tweak `finder-commentary' to `delete-blank-lines' at the top and bottom.) Getting rid of that was the use case that prompted my post. So while I agree with you for the use case you mention, in that somewhat similar use case I think it does make sense to remove ^L lines as "blank". Perhaps the criterion I'm looking for is ^L followed or preceded by only whitespace lines (including ^L lines). With that as criterion, the only "pages" that would be dropped (merged, if you like) would be blank ones. For interactive use (`C-x C-o') I don't see a problem with deleting lines that contain only ^Ls - we have undo. For programmatic use, it's less clear that we should always delete ^L lines as being blank. That's why I mentioned possibly adding an optional arg etc. Being able to specify via such an arg just what to consider as whitespace ("blank") would give code such as (my tweaked) `finder-commentary' an easy way to trim off leading and trailing whitespace lines, including lines with ^L.