Kill pending errors that are edited by the user

(Manual merge of a commit on master).
Fix scoping mistake (and reformat)

Found by byte-compiler, please pay attention to the warnings.