From: "Drew Adams" <drew.adams@oracle.com>
To: "'David De La Harpe Golden'" <david@harpegolden.net>
Cc: emacs-devel@gnu.org
Subject: RE: shouldn't `delete-blank-lines' treat form-feed as whitespace?
Date: Wed, 3 Mar 2010 14:21:29 -0800 [thread overview]
Message-ID: <B9B35623BBEC4B92AF43C7E91566BADC@us.oracle.com> (raw)
In-Reply-To: <4B8ED635.7010102@harpegolden.net>
> > `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.
next prev parent reply other threads:[~2010-03-03 22:21 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-28 20:44 shouldn't `delete-blank-lines' treat form-feed as whitespace? Drew Adams
2010-03-03 19:32 ` Juri Linkov
2010-03-03 19:54 ` Drew Adams
2010-03-04 4:28 ` Stefan Monnier
2010-03-05 8:48 ` Eli Zaretskii
2010-03-06 17:57 ` Juri Linkov
2010-03-06 18:56 ` Eli Zaretskii
2010-03-03 21:35 ` David De La Harpe Golden
2010-03-03 22:21 ` Drew Adams [this message]
2010-03-04 1:40 ` Miles Bader
2010-03-04 6:21 ` Drew Adams
[not found] <E1No0yT-0007vs-HZ@mail.fsf.org>
2010-03-06 22:34 ` Jonathan Yavner
2010-03-07 4:14 ` Eli Zaretskii
2010-03-07 4:34 ` Jonathan Yavner
2010-03-07 17:42 ` Eli Zaretskii
2010-03-07 18:11 ` Stephen J. Turnbull
2010-03-07 5:08 ` Stephen J. Turnbull
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B9B35623BBEC4B92AF43C7E91566BADC@us.oracle.com \
--to=drew.adams@oracle.com \
--cc=david@harpegolden.net \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.