GNU bug report logs -
#12769
24.2; Files won't save on Macintosh/Mountain Lion
Previous Next
Reported by: John Croix <jcroix <at> mac.com>
Date: Tue, 30 Oct 2012 19:32:01 UTC
Severity: normal
Tags: notabug
Found in version 24.2
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #23 received at 12769 <at> debbugs.gnu.org (full text, mbox):
> I tracked the problem down to the following (in red):
> (setq-default indent-tabs-mode nil)
> (add-hook 'write-file-hooks
> (lambda ()
> (if (not indent-tabs-mode)
> (untabify (point-min) (point-max))
> (delete-trailing-whitespace))))
> So, is this a bug or is the untabify command no longer supported? If
> it's now a bug, this should now be reproducible. If it's an obsolete
> package, do you have any suggestions for a replacement?
Properly indented, the `add-hook' form above here appears as
(add-hook 'write-file-hooks
(lambda ()
(if (not indent-tabs-mode)
(untabify (point-min) (point-max))
(delete-trailing-whitespace))))
so if `indent-tabs-mode' is on, you delete trailing whitespace and if
it's off, you untabify. Is this what you really want?
Anyway, the problem seems that `untabify' returns non-nil and according
to the doc-string of `write-file-hooks' we know that this is a
List of functions to be called before writing out a buffer to a file.
If one of them returns non-nil, the file is considered already written
and the rest are not called.
which is slightly ambiguous: One might think that if one of them returns
non-nil Emacs will "not call the rest" but nevertheless save the buffer
to its file.
In your case writing the file is aborted because `untabify' returns the
"current column `move-to-column' moved to" (whatever that is it seems to
be non-nil). So maybe we should modify the return value of `untabify'
(like in `delete-trailing-whitespace') or you should use
(add-hook 'write-file-hooks
(lambda ()
(if (not indent-tabs-mode)
(progn
(untabify (point-min) (point-max))
nil)
(delete-trailing-whitespace))))
still modulo your real intentions of what that lambda is supposed to do.
martin
This bug report was last modified 12 years and 261 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.