diff options
author | 2023-04-15 20:45:15 -0700 | |
---|---|---|
committer | 2023-04-15 20:45:15 -0700 | |
commit | 7e581611fb1744cf5bc77f5729f3fa3461582be4 (patch) | |
tree | e3660fbe1319dd349b274e316c4224fbc4b55b03 /oni-core.el | |
parent | 3c75681b252e33e04457e08025b95d8129e2a798 (diff) | |
download | emacs-config-7e581611fb1744cf5bc77f5729f3fa3461582be4.tar.gz emacs-config-7e581611fb1744cf5bc77f5729f3fa3461582be4.zip |
[oni-core] Add function to debug more hidden errors
https://gist.github.com/jdtsmith/1fbcacfe677d74bbe510aec80ac0050c
Diffstat (limited to 'oni-core.el')
-rw-r--r-- | oni-core.el | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/oni-core.el b/oni-core.el index 531eac6..a0a20a5 100644 --- a/oni-core.el +++ b/oni-core.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse <tom@ryuslash.org> ;; 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) ;; This program is free software; you can redistribute it and/or modify @@ -452,6 +452,28 @@ _s_: String list" (slot . 0) (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 (setq native-comp-async-report-warnings-errors 'silent) |