[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: whitespace-cleanup + untabify?
From: |
Nikolaj Schumacher |
Subject: |
Re: whitespace-cleanup + untabify? |
Date: |
Sat, 14 Jun 2008 18:49:43 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.2 (darwin) |
Kevin Rodgers <kevin.d.rodgers@gmail.com> wrote:
> It's not documented, but because whitespace-global-mode is defined
> via define-minor-mode there should be whitespace-global-mode-hook.
> So perhaps something like this will work:
>
> (add-hook 'whitespace-global-mode-hook
> (lambda ()
> (when whitespace-global-mode
> (untabify (point-min) (point-max)))))
That won't work. It will probably only untabify the .emacs file.
It should instead add an `untabify' variant to
'find-file-hook, 'write-file-functions and 'kill-buffer-hook.
Of course that would ignore the setting of `whitespace-auto-cleanup',
and would stay active after the mode has been disabled.
I think the cleanest way would be a parallel mode:
(defun untabify-buffer ()
(untabify (point-min) (point-max))
nil ;; for write-file-functions
)
(define-minor-mode untabify-global-mode
:global t
:group 'whitespace
(if untabify-global-mode
(progn
(add-hook 'find-file-hook 'untabify-buffer)
(add-hook 'write-file-functions 'untabify-buffer nil t)
(add-hook 'kill-buffer-hook 'untabify-buffer))
(remove-hook 'find-file-hook 'untabify-buffer)
(remove-hook 'write-file-functions 'untabify-buffer t)
(remove-hook 'kill-buffer-hook 'untabify-buffer)))
(Not tested.)
regards,
Nikolaj Schumacher
- whitespace-cleanup + untabify?, address@hidden, 2008/06/14
- Re: whitespace-cleanup + untabify?, Kevin Rodgers, 2008/06/14
- Re: whitespace-cleanup + untabify?,
Nikolaj Schumacher <=
- 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, 2008/06/14
- Re: whitespace-cleanup + untabify?, Lennart Borgman (gmail), 2008/06/14
- Message not available
- Message not available