emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/corfu e84e5e1 2/4: Revert "Improve corfu mode setup if


From: Protesilaos Stavrou
Subject: [elpa] externals/corfu e84e5e1 2/4: Revert "Improve corfu mode setup if Emacs daemon is used (Fix #20)"
Date: Thu, 6 May 2021 02:56:39 -0400 (EDT)

branch: externals/corfu
commit e84e5e1cdc6beb304569c45109dfd71558d43924
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Revert "Improve corfu mode setup if Emacs daemon is used (Fix #20)"
    
    This reverts commit 3ec66c521f42c9e5aa3e406bf32b7bc112bb1dc0.
---
 corfu.el | 43 +++++++++++++++++--------------------------
 1 file changed, 17 insertions(+), 26 deletions(-)

diff --git a/corfu.el b/corfu.el
index 6ddacc4..392877a 100644
--- a/corfu.el
+++ b/corfu.el
@@ -688,38 +688,29 @@ Set to nil in order to disable confirmation."
 
 (defun corfu--completion-in-region (&rest args)
   "Corfu completion in region function passing ARGS to 
`completion--in-region'."
-  (if (corfu--ensure-display-graphic)
-      (let ((completion-show-inline-help)
-            (completion-auto-help)
-            ;; XXX Disable original predicate check, keep completion alive when
-            ;; popup is shown. Since the predicate is set always, it is ensured
-            ;; that `completion-in-region-mode' is turned on.
-            (completion-in-region-mode-predicate (lambda () t)))
-        ;; Prevent restarting the completion. This can happen for example if 
C-M-/
-        ;; (`dabbrev-completion') is pressed while the Corfu popup is already 
open.
-        (when (and completion-in-region-mode (not completion-cycling))
-          (user-error "Completion is already in progress"))
-        (apply #'completion--in-region args))
+  ;; Prevent restarting the completion. This can happen for example if C-M-/
+  ;; (`dabbrev-completion') is pressed while the Corfu popup is already open.
+  (when (and completion-in-region-mode (not completion-cycling))
+    (user-error "Completion is already in progress"))
+  (let ((completion-show-inline-help)
+        (completion-auto-help)
+        ;; XXX Disable original predicate check, keep completion alive when
+        ;; popup is shown. Since the predicate is set always, it is ensured
+        ;; that `completion-in-region-mode' is turned on.
+        (completion-in-region-mode-predicate (lambda () t)))
     (apply #'completion--in-region args)))
 
-(defun corfu--ensure-display-graphic ()
-  "Return non-nil if Corfu is running on a graphics display, otherwise self 
deactivate."
-  (or (and (not emacs-basic-display) (display-graphic-p))
-      (progn
-        (corfu-mode -1)
-        (message "Corfu mode is only compatible with the graphics display.")
-        nil)))
-
 ;;;###autoload
 (define-minor-mode corfu-mode
   "Completion Overlay Region FUnction"
   :global nil
-  (if corfu-mode
-      (when (or (daemonp) (corfu--ensure-display-graphic))
-        (add-hook 'completion-in-region-mode-hook #'corfu--mode-hook nil 
'local)
-        (setq-local completion-in-region-function 
#'corfu--completion-in-region))
-    (remove-hook 'completion-in-region-mode-hook #'corfu--mode-hook 'local)
-    (kill-local-variable 'completion-in-region-function)))
+  (remove-hook 'completion-in-region-mode-hook #'corfu--mode-hook 'local)
+  (kill-local-variable 'completion-in-region-function)
+  (when corfu-mode
+    (if (or emacs-basic-display (not (display-graphic-p)))
+        (message "Corfu mode is only compatible with the graphics display.")
+      (add-hook 'completion-in-region-mode-hook #'corfu--mode-hook nil 'local)
+      (setq-local completion-in-region-function 
#'corfu--completion-in-region))))
 
 ;;;###autoload
 (define-globalized-minor-mode corfu-global-mode corfu-mode corfu--on)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]