Re: [PATCH] Trim trailing whitespace in vim and emacs

Поиск
Список
Период
Сортировка
От David Fetter
Тема Re: [PATCH] Trim trailing whitespace in vim and emacs
Дата
Msg-id 20180605175113.GE10899@fetter.org
обсуждение исходный текст
Ответ на Re: [PATCH] Trim trailing whitespace in vim and emacs  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-hackers
On Tue, Jun 05, 2018 at 01:28:54PM -0400, Alvaro Herrera wrote:
> On 2018-Jun-05, David Fetter wrote:
> Hi David
> 
> > Here's my attempt to $subject. I've tested with vim, but I'm much less
> > certain I got the EMACS code right.
> > 
> > Is there any interest in such a feature?
> 
> I'd rather have the editor warn me (highlight) such things rather than
> fix them silently (I wonder if it'd cause a mess with regression .out
> files for example, which I do edit on occasion).

For what it's worth, the patch trims trailing whitespace only on
certain types of files in vim and just one (C) in emacs for just this
reason.

> I once tried to have vim highlight trailing whitespace, spaces before
> tabs, and overlength lines (>80 chars), and while I could do each thing
> in isolation, I wasn't able to get it to highlight the three of them at
> the same time.  If you have a recipe for that, I welcome it.

In vim, one way to do it is:

highlight link sensibleWhitespaceError Error
autocmd Syntax * syntax match sensibleWhitespaceError excludenl /\s\+\%#\@<!$\| \+\ze\t|^.\{81,}/ display
containedin=ALL

I'm sure there's something more elegant in emacs, but I'm not sure
what it is.

Best,
David.
-- 
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jeff Davis
Дата:
Сообщение: Re: Spilling hashed SetOps and aggregates to disk
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Spilling hashed SetOps and aggregates to disk