summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2021-04-17 18:59:11 +0200
committerDaniel Mendler <mail@daniel-mendler.de>2021-04-17 18:59:11 +0200
commit68d799a724c98de481f692b2fd36277ace378790 (patch)
treeafcc88f75529c822fecda097f8219cf2c24f9f78
parente226da3ea4feb7a43efb09ce62e5de9afbab2748 (diff)
Revert "Add corfu-completion-styles"
This reverts commit 6e9b8ef9b96037b5ee1ff583eafdde4cd78842fe. Revert this for since it needs more thought (See #5).
-rw-r--r--corfu.el24
1 files changed, 8 insertions, 16 deletions
diff --git a/corfu.el b/corfu.el
index 3532cc3..a873816 100644
--- a/corfu.el
+++ b/corfu.el
@@ -55,11 +55,6 @@
"Enable cycling for `corfu-next' and `corfu-previous'."
:type 'boolean)
-;; XXX Maybe there should be a `completion-in-region-styles' variable in Emacs
-(defcustom corfu-completion-styles nil
- "Completion styles to use for completion in region, defaults to `completion-styles'."
- :type '(choice (const nil) (repeat symbol)))
-
(defgroup corfu-faces nil
"Faces used by Corfu."
:group 'corfu
@@ -275,8 +270,7 @@ If `line-spacing/=nil' or in text-mode, the background color is used instead.")
(lambda (pattern cands)
(setq hl (lambda (x) (orderless-highlight-matches pattern x)))
cands)))
- (let ((completion-styles (or corfu-completion-styles completion-styles)))
- (cons (apply #'completion-all-completions args) hl))))
+ (cons (apply #'completion-all-completions args) hl)))
(defun corfu--sort-predicate (x y)
"Sorting predicate which compares X and Y."
@@ -477,11 +471,11 @@ If `line-spacing/=nil' or in text-mode, the background color is used instead.")
(other other-window-scroll-buffer)
(restore (make-symbol "corfu--restore")))
(fset restore (lambda ()
- (when (eq this-command #'corfu-abort)
- (setq this-command #'ignore))
- (remove-hook 'pre-command-hook restore)
- (setq other-window-scroll-buffer other)
- (set-window-configuration config)))
+ (when (eq this-command #'corfu-abort)
+ (setq this-command #'ignore))
+ (remove-hook 'pre-command-hook restore)
+ (setq other-window-scroll-buffer other)
+ (set-window-configuration config)))
(run-at-time 0 nil (lambda () (add-hook 'pre-command-hook restore)))))
;; Company support, taken from `company.el', see `company-show-doc-buffer'.
@@ -528,8 +522,7 @@ If `line-spacing/=nil' or in text-mode, the background color is used instead.")
(pt (max 0 (- (point) beg)))
(str (buffer-substring-no-properties beg end))
(metadata (completion-metadata (substring str 0 pt) table pred)))
- (pcase (let ((completion-styles (or corfu-completion-styles completion-styles)))
- (completion-try-completion str table pred pt metadata))
+ (pcase (completion-try-completion str table pred pt metadata)
((and `(,newstr . ,newpt) (guard (not (equal str newstr))))
(completion--replace beg end newstr)
(goto-char (+ beg newpt)))))))
@@ -571,8 +564,7 @@ If `line-spacing/=nil' or in text-mode, the background color is used instead.")
(defun corfu--completion-in-region (&rest args)
"Corfu completion in region function passing ARGS to `completion--in-region'."
- (let ((completion-styles (or corfu-completion-styles completion-styles))
- (completion-show-inline-help)
+ (let ((completion-show-inline-help)
(completion-auto-help))
(apply #'completion--in-region args)))