1
0
Fork 0

[oni-core] Add function to debug more hidden errors

https://gist.github.com/jdtsmith/1fbcacfe677d74bbe510aec80ac0050c
This commit is contained in:
Tom Willemse 2023-04-15 20:45:15 -07:00
parent 3c75681b25
commit 7e581611fb

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 2023.0401.230128 ;; Version: 2023.0415.204431
;; Package-Requires: (oni-data-dir oni-embrace oni-hydra expand-region multiple-cursors gcmh diminish ws-butler which-key insert-char-preview mixed-pitch ace-window vertico marginalia orderless consult embark docstr) ;; Package-Requires: (oni-data-dir oni-embrace oni-hydra expand-region multiple-cursors gcmh diminish ws-butler which-key insert-char-preview mixed-pitch ace-window vertico marginalia orderless consult embark docstr)
;; This program is free software; you can redistribute it and/or modify ;; This program is free software; you can redistribute it and/or modify
@ -452,6 +452,28 @@ _s_: String list"
(slot . 0) (slot . 0)
(window-width . oni-core-fit-window-to-buffer))) (window-width . oni-core-fit-window-to-buffer)))
;;; Extra debugging
;;; From https://gist.github.com/jdtsmith/1fbcacfe677d74bbe510aec80ac0050c
(defun oni-core-reraise-error (func &rest args)
"Call function FUNC with ARGS and re-raise any error which occurs.
Useful for debugging post-command hooks and filter functions,
which normally have their errors suppressed."
(condition-case err
(apply func args)
((debug error) (signal (car err) (cdr err)))))
(defun toggle-debug-on-hidden-errors (func)
"Toggle hidden error debugging for function FUNC."
(interactive "a")
(cond
((advice-member-p #'oni-core-reraise-error func)
(advice-remove func #'oni-core-reraise-error)
(message "Debug on hidden errors disabled for %s" func))
(t
(advice-add func :around #'oni-core-reraise-error)
(message "Debug on hidden errors enabled for %s" func))))
;;; Native Compilation ;;; Native Compilation
(setq native-comp-async-report-warnings-errors 'silent) (setq native-comp-async-report-warnings-errors 'silent)