Skip to content

Commit

Permalink
Integrate debug with purpose
Browse files Browse the repository at this point in the history
  • Loading branch information
wyuenho committed Mar 14, 2021
1 parent b437e12 commit d9c7ab8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions window-purpose-fixes.el
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@ SYMBOL, WHERE and FUNCTION."
(purpose-toggle-advice symbol where function)
(add-hook 'purpose-fix-togglers-hook (purpose-advice-toggler symbol where function)))

(defun purpose--fix-debug ()
"Integrates `debug' with Purpose."

(with-eval-after-load 'debug
(defun purpose--debug (fn &rest args)
"Ignore `pop-to-buffer' display actions given by `debug'."
(let ((pop-to-buffer-definition (symbol-function 'pop-to-buffer)))
(cl-letf (((symbol-function 'pop-to-buffer)
(lambda (buffer &optional _action _record)
(funcall pop-to-buffer-definition buffer))))
(apply fn args))))

(purpose-install-advice-toggler 'debug :around 'purpose--debug)))

(defun purpose--fix-edebug ()
"Integrates Edebug with Purpose."

Expand Down Expand Up @@ -362,6 +376,7 @@ Don't call this function before `popwin' is loaded."
"Install fixes for integrating Purpose with other features.
EXCLUDE is a list of integrations to skip. Known members of EXCLUDE
are:
- 'debug : don't integrate with debug
- 'edebug : don't integrate with edebug
- 'compilation-next-error-function : don't integrate with
`compilation-next-error-function'.
Expand All @@ -376,6 +391,8 @@ are:
- 'which-key : don't integrate with which-key
- 'whitespace : don't integrate with whitespace"
(interactive)
(unless (member 'debug exclude)
(purpose--fix-debug))
(unless (member 'edebug exclude)
(purpose--fix-edebug))
(unless (member 'compilation-next-error-function exclude)
Expand Down

0 comments on commit d9c7ab8

Please sign in to comment.