diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-07-01 10:38:53 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-07-01 10:38:53 -0700 |
commit | 34ab699add987fcbcd83e827a5a006f9dcfa6cdc (patch) | |
tree | fd57eb734c1d21d494cd3f475ab7c295f7737f6d /.emacs.d/init-spw.el | |
parent | 01e419ac514ef54f3fc3c3dbf21cf16686474892 (diff) | |
download | dotfiles-34ab699add987fcbcd83e827a5a006f9dcfa6cdc.tar.gz |
try to have sldb pop up in frame from which async eval was initiated
Diffstat (limited to '.emacs.d/init-spw.el')
-rw-r--r-- | .emacs.d/init-spw.el | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/.emacs.d/init-spw.el b/.emacs.d/init-spw.el index 46e1ea77..07c2b9e1 100644 --- a/.emacs.d/init-spw.el +++ b/.emacs.d/init-spw.el @@ -2739,12 +2739,14 @@ mutt's review view, after exiting EDITOR." (with-eval-after-load 'slime (defvar spw/last-command-was-slime-async-eval nil) + (defvar spw/last-slime-async-eval-command-frame nil) (defun spw/record-last-command-was-slime-async-eval (&rest ignore) (spw/add-once-hook 'pre-command-hook (lambda () (setq spw/last-command-was-slime-async-eval nil))) - (setq spw/last-command-was-slime-async-eval t)) + (setq spw/last-command-was-slime-async-eval t + spw/last-slime-async-eval-command-frame (selected-frame))) (dolist (f '(slime-repl-return slime-mrepl-return slime-compile-region @@ -2754,12 +2756,18 @@ mutt's review view, after exiting EDITOR." slime-interrupt)) (advice-add f :after #'spw/record-last-command-was-slime-async-eval)) + ;; Here we assume that (spw/use-tabs-not-frames) yields nil. (defun spw/sldb-setup-avoid-focus-grab (orig-fun &rest args) "Don't allow the Slime debugger to grab keyboard focus unless we are sure that the user is expecting that it might pop up." (if spw/last-command-was-slime-async-eval (apply orig-fun args) - (save-selected-window (apply orig-fun args)))) + (save-selected-window + (if (frame-live-p spw/last-slime-async-eval-command-frame) + (with-selected-frame spw/last-slime-async-eval-command-frame + (apply orig-fun args)) + (apply orig-fun args)))) + (setq spw/last-slime-async-eval-command-frame nil)) (advice-add 'sldb-setup :around #'spw/sldb-setup-avoid-focus-grab)) (with-eval-after-load 'slime-repl |