From: Nikolaj Schumacher <n_schumacher@web.de>
To: Kevin Rodgers <kevin.d.rodgers@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: whitespace-cleanup + untabify?
Date: Sat, 14 Jun 2008 18:49:43 +0200 [thread overview]
Message-ID: <m2ej70yna0.fsf@nschum.de> (raw)
In-Reply-To: <g30e1f$6ke$1@ger.gmane.org> (Kevin Rodgers's message of "Sat\, 14 Jun 2008 06\:37\:07 -0600")
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
next prev parent reply other threads:[~2008-06-14 16:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-14 10:56 whitespace-cleanup + untabify? dsevilla
2008-06-14 12:02 ` Juanma Barranquero
2008-06-14 12:03 ` Nikolaj Schumacher
2008-06-14 12:37 ` Kevin Rodgers
2008-06-14 16:49 ` Nikolaj Schumacher [this message]
2008-06-14 13:43 ` Juanma
2008-06-14 15:02 ` Rupert Swarbrick
2008-06-14 15:10 ` dsevilla
2008-06-14 16:24 ` Lennart Borgman (gmail)
[not found] ` <mailman.13261.1213458961.18990.help-gnu-emacs@gnu.org>
2008-06-15 20:05 ` dsevilla
[not found] ` <mailman.13267.1213460678.18990.help-gnu-emacs@gnu.org>
2008-06-15 20:07 ` dsevilla
2008-06-15 20:53 ` Lennart Borgman (gmail)
2008-06-15 21:23 ` Nikolaj Schumacher
2008-06-15 21:32 ` Lennart Borgman (gmail)
2008-06-16 6:28 ` Thierry Volpiatto
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2ej70yna0.fsf@nschum.de \
--to=n_schumacher@web.de \
--cc=help-gnu-emacs@gnu.org \
--cc=kevin.d.rodgers@gmail.com \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).