Skip to main content
added 44 characters in body
Source Link
Teddy
  • 173
  • 4

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(without rebinding C-xC-s or doing defadvice around save-buffer)?

(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.)

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.)

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 or doing defadvice around save-buffer)?

(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.)

Source Link
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.)