Subject: Re: bug#13432: 24.2; File does not get saved when save-buffer called

From: Glenn Morris <[email-masked]>
Date: Sun, 13 Jan 2013 19:54:29 -0500

Peter Milliken wrote:

> This behaviour started with Emacs 24.1 - it does not happen on earlier
> versions.
>
> In my .emacs I defadvice several major modes to include a call to
> untabify in the local-write-file-hooks. With this version of Emacs, the
> defadvice
> seems to trigger a bug where the message line states the file has been
> saved when it has not been saved - the status line indicates it is still
> in a modified state as well.
>
> Minimal/sample code that triggers/illustrates this bug is:
>
> (defadvice python-mode (after minor-modes-for-python activate compile)
>   (add-hook 'local-write-file-hooks '(lambda () (untabify (point-min)
> (point-max)))))

Please read the doc of local-write-file-hooks:

  This variable is obsolete since 22.1;
  use `write-file-functions' instead.

>From write-file-functions:

If one of them returns non-nil, the file is considered already written
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^
and the rest are not called.

So: ensure that any functions you add return nil. The return value of
untabify is unspecfied (ie, could be anything).