[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: whitespace-cleanup + untabify?
From: |
Juanma Barranquero |
Subject: |
Re: whitespace-cleanup + untabify? |
Date: |
Sat, 14 Jun 2008 14:02:17 +0200 |
On Sat, Jun 14, 2008 at 12:56, dsevilla@gmail.com <dsevilla@gmail.com> wrote:
> I haven't found any
> option that connects untabify and whitespace-cleanup. I'm using:
That really depends on how do you want to do the untabify.
For example, you can defadvice `whitespace-cleanup' like so
(defadvice whitespace-cleanup (after whitespace-untabify activate compile)
(save-restriction
(widen)
(untabify (point-min) (point-max))))
so when you do M-x whitespace cleanup, it first cleans up and then
untabifies. Take into account that untabify removes tabs anywhere in
the line; if you prefer only to untabify at the beginning of line, you
could use this instead:
(defadvice whitespace-cleanup (after whitespace-untabify activate compile)
(save-restriction
(widen)
(let ((tabify-regexp "^\t* [ \t]+"))
(untabify (point-min) (point-max)))))
Both examples untabify the whole buffer (that's what the
`save-restriction' and `widen' calls are for), so if you in fact only
want to untabify the region, it's even simpler:
(defadvice whitespace-cleanup (after whitespace-untabify activate compile)
(untabify (point-min) (point-max)))
Does this help?
Juanma
- whitespace-cleanup + untabify?, address@hidden, 2008/06/14
- Re: whitespace-cleanup + untabify?, Kevin Rodgers, 2008/06/14
- Re: whitespace-cleanup + untabify?, Rupert Swarbrick, 2008/06/14
- Re: whitespace-cleanup + untabify?, Juanma, 2008/06/14
- Re: whitespace-cleanup + untabify?, Nikolaj Schumacher, 2008/06/14
- Re: whitespace-cleanup + untabify?,
Juanma Barranquero <=
- Re: whitespace-cleanup + untabify?, Lennart Borgman (gmail), 2008/06/14
- Message not available
- Message not available