summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2022-05-11 20:42:32 +0200
committerDaniel Mendler <mail@daniel-mendler.de>2022-05-11 20:42:32 +0200
commitf078f093549009e0104b1d0578ce4c4844b9a944 (patch)
tree451fa25f9d9944323c06cde9e4009f62a3fce275
parent3b3f7b6e6d1f8a1fd344fbbf63bed86b7ced334f (diff)
Revert "Redirect focus in after-focus-change-function (Fix #159)"
This reverts commit ad712043b43791cacf13db66be901f271fb70bcf.
-rw-r--r--corfu.el9
1 files changed, 4 insertions, 5 deletions
diff --git a/corfu.el b/corfu.el
index 097ea9b..c3cc2d9 100644
--- a/corfu.el
+++ b/corfu.el
@@ -368,8 +368,7 @@ The completion backend can override this with
(defun corfu--popup-redirect-focus ()
"Redirect focus from popup."
- (when (and (frame-live-p corfu--frame) (eq (selected-frame) corfu--frame))
- (redirect-frame-focus corfu--frame (frame-parent corfu--frame))))
+ (redirect-frame-focus corfu--frame (frame-parent corfu--frame)))
(defun corfu--make-buffer (content)
"Create corfu buffer with CONTENT."
@@ -377,6 +376,8 @@ The completion backend can override this with
(ls line-spacing)
(buffer (get-buffer-create " *corfu*")))
(with-current-buffer buffer
+ ;;; XXX HACK install redirect focus hook
+ (add-hook 'pre-command-hook #'corfu--popup-redirect-focus nil 'local)
;;; XXX HACK install mouse ignore map
(use-local-map corfu--mouse-ignore-map)
(dolist (var corfu--buffer-parameters)
@@ -1212,9 +1213,7 @@ Auto completion is only performed if the tick did not change."
;; advice is active *globally*.
(advice-add #'completion--capf-wrapper :around #'corfu--capf-wrapper-advice)
(advice-add #'eldoc-display-message-no-interference-p :before-while #'corfu--allow-eldoc)
- ;;; XXX HACK install redirect focus hook
- (add-function :after after-focus-change-function #'corfu--popup-redirect-focus)
- (when corfu-auto (add-hook 'post-command-hook #'corfu--auto-post-command nil 'local))
+ (and corfu-auto (add-hook 'post-command-hook #'corfu--auto-post-command nil 'local))
(setq-local completion-in-region-function #'corfu--in-region))
(t
(remove-hook 'post-command-hook #'corfu--auto-post-command 'local)