branch: externals/corfu commit cf58c19598aee9828da49bdfb7d596208a91ccc9 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
Extract function corfu--popup-support-p --- corfu.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/corfu.el b/corfu.el index 1e3ec7937c..c62a17806f 100644 --- a/corfu.el +++ b/corfu.el @@ -497,6 +497,10 @@ A scroll bar is displayed from LO to LO+BAR." (let ((inhibit-read-only t)) (erase-buffer))))) +(defun corfu--popup-support-p () + "Return non-nil if child frames are supported." + (display-graphic-p)) + (defun corfu--move-to-front (elem list) "Move ELEM to front of LIST." (if-let (found (member elem list)) @@ -1083,7 +1087,7 @@ Quit if no candidate is selected." "Corfu completion in region function called with ARGS." ;; XXX We can get an endless loop when `completion-in-region-function' is set ;; globally to `corfu--in-region'. This should never happen. - (apply (if (display-graphic-p) #'corfu--in-region-1 + (apply (if (corfu--popup-support-p) #'corfu--in-region-1 (default-value 'completion-in-region-function)) args)) @@ -1184,7 +1188,7 @@ See `completion-in-region' for the arguments BEG, END, TABLE, PRED." (when (and (not completion-in-region-mode) (not defining-kbd-macro) (corfu--match-symbol-p corfu-auto-commands this-command) - (display-graphic-p)) + (corfu--popup-support-p)) ;; NOTE: Do not use idle timer since this leads to unacceptable slowdowns, ;; in particular if flyspell-mode is enabled. (setq corfu--auto-timer