Skip to main content
1 of 2
Teddy
  • 173
  • 4

How to abort saving in a before-save-hook function?

If, in a function run from before-save-hook, I want to abort the saving of a file, so that the file is not saved and the user is signaled, how can I do that? Is it possible without rebinding C-xC-s?

(It used to be, I think in Emacs 23, that all you had to do was (error "Bad!"), and the file save operation would be aborted. But that does no longer work; any errors in a before-save-hook are ignored.)

Teddy
  • 173
  • 4