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