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

From: Stefan Monnier <[email-masked]>
Date: Sun, 13 Jan 2013 20:38:56 -0500

tags 13432 notabug
thanks

> (defadvice python-mode (after minor-modes-for-python activate compile)
>   (add-hook 'local-write-file-hooks
>             '(lambda () (untabify (point-min) (point-max)))))

As Glenn explains, this is not a bug.  It's probably due to a change in
untabify which now returns a different value, but since the return value
of untabify is undocumented, this is not a bug/regression.

But while I'm here, I'll point out a few improvement to your above code:
- don't quote lambda.
- use python-mode-hook rather than defadvice.
- use before-save-hook rather than local-write-file-hooks (this will
  also fix your problem).

I.e.

  (add-hook 'python-mode-hook
            (lambda ()
              (add-hook 'before-save-hook
                        (lambda () (untabify (point-min) (point-max)))
                        nil 'local)))

-- Stefan