branch: externals/corfu
commit 0b87702819a5eefb79101b64f17183e174278089
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>
Add `corfu-excluded-modes`
---
README.org | 2 +-
corfu.el | 10 ++++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/README.org b/README.org
index 326dec1..a49e053 100644
--- a/README.org
+++ b/README.org
@@ -19,7 +19,7 @@ Corfu and Vertico are two separate packages in order to
optimize the UI for the
two distinct use cases, also leading to code bases which are easier to
understand.
-Corfu is a minimal package (~500 lines of code without whitespace and
comments).
+Corfu is a minimal package (~600 lines of code without whitespace and
comments).
In contrast to the featureful and complex Company package, Corfu concentrates
on
the completion UI and does not include custom completion backends. Completions
are either provided by commands like ~dabbrev-completion~ or by pluggable
diff --git a/corfu.el b/corfu.el
index bf202bc..59f9cd4 100644
--- a/corfu.el
+++ b/corfu.el
@@ -61,6 +61,10 @@
Set to nil in order to disable confirmation."
:type '(choice (const nil) string))
+(defcustom corfu-excluded-modes nil
+ "List of modes excluded by `corfu-global-mode'."
+ :type '(repeat symbol))
+
(defgroup corfu-faces nil
"Faces used by Corfu."
:group 'corfu
@@ -626,8 +630,10 @@ If `line-spacing/=nil' or in text-mode, the background
color is used instead.")
(define-globalized-minor-mode corfu-global-mode corfu-mode corfu--on)
(defun corfu--on ()
- "Turn on `corfu-mode'."
- (unless (minibufferp)
+ "Turn `corfu-mode' on."
+ (unless (or noninteractive
+ (eq (aref (buffer-name) 0) ?\s)
+ (memq major-mode corfu-excluded-modes))
(corfu-mode 1)))
(provide 'corfu)