emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: shouldn't `delete-blank-lines' treat form-feed as whitespace?


From: Drew Adams
Subject: RE: shouldn't `delete-blank-lines' treat form-feed as whitespace?
Date: Wed, 3 Mar 2010 11:54:09 -0800

> > `delete-blank-lines' treats SPC, TAB, and newline as whitespace.
> > Shouldn't it also treat form-feed (aka \f, aka ^L) as whitespace?
> 
> Maybe it should depend of the current buffer's syntax?  I mean using
> "[:space:]" in `delete-blank-lines'.

Yes, I suppose the notion of whitespace is mode-dependent, and [:space:] should
capture that notion appropriately for each mode. Good point.

> This has a problem: e.g. in Lisp mode \n has the
> `endcomment' syntax instead of `whitespace'.

Hm. Then we seem to have a choice:

1. Always consider \n, \t, \f, SPC, etc. as whitespace for purposes of
`delete-blank-lines', _in addition_ to whatever other characters might
correspond to [:space:] for the given mode.

2. Use only [:space:], always, as the sole "whitespace" criterion for
`delete-blank-lines'.

Your \n as `endcomment' example seems to show that the notion of "whitespace"
for syntax table purposes is too restrictive to use as the criterion for things
like `delete-blank-lines'. So [:space:] would not be an adequate (sole)
criterion.

We could add an optional arg to `delete-blank-lines' that would override
whatever default behavior we decide on, but the default choice is important, as
it affects existing calls to `delete-blank-lines'.

I'm leaning toward #1 above. It seems to me that `delete-blank-lines' uses a
notion of blank line, and that should always include things like \n, even if
that has `endcomment' syntax.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]