summaryrefslogtreecommitdiff
path: root/README.org
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2023-04-01 08:07:15 +0200
committerDaniel Mendler <mail@daniel-mendler.de>2023-04-01 08:07:15 +0200
commit87e30394e2434df63275464f4405ca8770968b97 (patch)
treebf3fbcbbca9fb3e38a6867bebe5929f78aef6f85 /README.org
parent12b9712f546fc7b6229e56336bfa375fa3165406 (diff)
README: Add paragraph about debugging Corfu
Diffstat (limited to 'README.org')
-rw-r--r--README.org20
1 files changed, 20 insertions, 0 deletions
diff --git a/README.org b/README.org
index 166f0e5..8f49bc6 100644
--- a/README.org
+++ b/README.org
@@ -529,6 +529,26 @@ enhance your setup.
your completions in the minibuffer ~consult-completion-in-region~ is your best
option.
+* Debugging Corfu
+
+When you observe an error in the =corfu--post-command= post command hook, you
+should install an advice to enforce debugging. This allows you to obtain a stack
+trace in order to narrow down the location of the error. The reason is that post
+command hooks are automatically disabled (and not debugged) by Emacs. Otherwise
+Emacs would become unusable, given that the hooks are executed after every
+command.
+
+#+begin_src emacs-lisp
+ (setq debug-on-error t)
+
+ (defun force-debug (func &rest args)
+ (condition-case e
+ (apply func args)
+ ((debug error) (signal (car e) (cdr e)))))
+
+ (advice-add #'corfu--post-command :around #'force-debug)
+#+end_src
+
* Contributions
Since this package is part of [[https://elpa.gnu.org/packages/corfu.html][GNU ELPA]] contributions require a copyright