tools/debugger: conform to new advice conventions
This commit is contained in:
parent
8e096f7a23
commit
8e09b8b7fe
1 changed files with 6 additions and 7 deletions
|
@ -69,20 +69,21 @@
|
||||||
(set-popup-rule! "^\\*\\(?:trepanjs:\\(?:g\\|zsh\\|bash\\)db\\|pdb \\)"
|
(set-popup-rule! "^\\*\\(?:trepanjs:\\(?:g\\|zsh\\|bash\\)db\\|pdb \\)"
|
||||||
:size 20 :select nil :quit nil)
|
:size 20 :select nil :quit nil)
|
||||||
|
|
||||||
(defun +debugger*cleanup-when-realgud-terminates (&optional buf)
|
(def-advice! +debugger-cleanup-after-realgud-a (&optional buf)
|
||||||
"Kill command buffer when debugging session ends (which closes its popup)."
|
"Kill command buffer when debugging session ends (which closes its popup)."
|
||||||
|
:after #'realgud:terminate
|
||||||
(when (stringp buf)
|
(when (stringp buf)
|
||||||
(setq buf (get-buffer buf)))
|
(setq buf (get-buffer buf)))
|
||||||
(when-let (cmdbuf (realgud-get-cmdbuf buf))
|
(when-let (cmdbuf (realgud-get-cmdbuf buf))
|
||||||
(let (kill-buffer-hook)
|
(let (kill-buffer-hook)
|
||||||
(kill-buffer buf))))
|
(kill-buffer buf))))
|
||||||
(advice-add #'realgud:terminate :after #'+debugger*cleanup-when-realgud-terminates)
|
|
||||||
|
|
||||||
;; Monkey-patch `realgud:run-process' to run in a popup.
|
;; Monkey-patch `realgud:run-process' to run in a popup.
|
||||||
;; TODO Find a more elegant solution
|
;; TODO Find a more elegant solution
|
||||||
;; FIXME Causes realgud:cmd-* to focus popup on every invocation
|
;; FIXME Causes realgud:cmd-* to focus popup on every invocation
|
||||||
(defun +debugger*realgud-run-process
|
(def-advice! +debugger-realgud-run-process-a
|
||||||
(debugger-name script-filename cmd-args minibuffer-history-var &optional no-reset)
|
(debugger-name script-filename cmd-args minibuffer-history-var &optional no-reset)
|
||||||
|
:override #'realgud:run-process
|
||||||
(let* ((cmd-buf (apply #'realgud-exec-shell debugger-name script-filename
|
(let* ((cmd-buf (apply #'realgud-exec-shell debugger-name script-filename
|
||||||
(car cmd-args) no-reset (cdr cmd-args)))
|
(car cmd-args) no-reset (cdr cmd-args)))
|
||||||
(process (get-buffer-process cmd-buf)))
|
(process (get-buffer-process cmd-buf)))
|
||||||
|
@ -106,6 +107,4 @@
|
||||||
(t
|
(t
|
||||||
(if cmd-buf (switch-to-buffer cmd-buf))
|
(if cmd-buf (switch-to-buffer cmd-buf))
|
||||||
(message "Error running command: %s" (mapconcat #'identity cmd-args " "))))
|
(message "Error running command: %s" (mapconcat #'identity cmd-args " "))))
|
||||||
cmd-buf))
|
cmd-buf)))
|
||||||
(advice-add #'realgud:run-process :override #'+debugger*realgud-run-process))
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue