[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/corfu fe8674a 05/11: Ensure that the corfu popup works
From: |
Protesilaos Stavrou |
Subject: |
[elpa] externals/corfu fe8674a 05/11: Ensure that the corfu popup works with `dabbrev-completion` |
Date: |
Tue, 27 Apr 2021 11:39:06 -0400 (EDT) |
branch: externals/corfu
commit fe8674a9ef4fb557ec2a5a8b4f1de2acdc960c31
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Ensure that the corfu popup works with `dabbrev-completion`
* Add `corfu-global-mode`
* Always ensure that the `completion-in-region-mode` is turned on
* Document dabbrev configuration
---
README.org | 20 ++++++++++++++------
corfu.el | 17 +++++++++++++----
2 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/README.org b/README.org
index 494d2e1..b8205f2 100644
--- a/README.org
+++ b/README.org
@@ -61,15 +61,17 @@ Here is an example configuration:
;; ("TAB" . corfu-next)
;; ("S-TAB" . corfu-previous))
- ;; Enable the overlay only for certain modes.
- ;; For example it is not a useful UI for completions at point in the
- ;; minibuffer.
- :hook ((prog-mode . corfu-mode)
- (shell-mode . corfu-mode)
- (eshell-mode . corfu-mode))
+ ;; You may want to enable Corfu only for certain modes.
+ ;; :hook ((prog-mode . corfu-mode)
+ ;; (shell-mode . corfu-mode)
+ ;; (eshell-mode . corfu-mode))
:config
+ ;; Alternatively enable Corfu globally.
+ ;; This is recommended if Corfu is used with dabbrev.
+ (corfu-global-mode)
+
;; Optionally enable cycling for `corfu-next' and `corfu-previous'.
;; (setq corfu-cycle t)
)
@@ -83,6 +85,12 @@ Here is an example configuration:
completion-category-defaults nil
completion-category-overrides '((file (styles .
(partial-completion))))))
+ ;; Dabbrev works with Corfu
+ (use-package dabbrev
+ ;; Swap M-/ and C-M-/
+ :bind (("M-/" . dabbrev-completion)
+ ("C-M-/" . dabbrev-expand)))
+
;; A few more useful configurations...
(use-package emacs
:init
diff --git a/corfu.el b/corfu.el
index 61c9370..bf202bc 100644
--- a/corfu.el
+++ b/corfu.el
@@ -212,7 +212,7 @@ If `line-spacing/=nil' or in text-mode, the background
color is used instead.")
width (apply #'max (car corfu-width-limits) (mapcar
#'string-width lines))))
(beginning-of-line)
(forward-line (if (and (< count ypos)
- (>= count (- (floor (window-pixel-height) (cdr
size)) ypos 1)))
+ (>= count (- (floor (window-pixel-height) (cdr
size)) ypos 2)))
(- count) 1))
(setq beg (point))
(when (save-excursion
@@ -606,9 +606,10 @@ If `line-spacing/=nil' or in text-mode, the background
color is used instead.")
"Corfu completion in region function passing ARGS to
`completion--in-region'."
(let ((completion-show-inline-help)
(completion-auto-help)
- ;; Disable original predicate check, keep completion alive when popup
is shown
- (completion-in-region-mode-predicate
- (and completion-in-region-mode-predicate (lambda () t))))
+ ;; 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)))
;;;###autoload
@@ -621,5 +622,13 @@ If `line-spacing/=nil' or in text-mode, the background
color is used instead.")
(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)
+
+(defun corfu--on ()
+ "Turn on `corfu-mode'."
+ (unless (minibufferp)
+ (corfu-mode 1)))
+
(provide 'corfu)
;;; corfu.el ends here
- [elpa] externals/corfu updated (71386bf -> 1db9916), Protesilaos Stavrou, 2021/04/27
- [elpa] externals/corfu 8b4d5d8 02/11: Simplify corfu--restore-on-next-command, Protesilaos Stavrou, 2021/04/27
- [elpa] externals/corfu 6dfa254 01/11: Fix corfu-show-location, Protesilaos Stavrou, 2021/04/27
- [elpa] externals/corfu 6845fb0 03/11: Simplify corfu--pre-command-hook, Protesilaos Stavrou, 2021/04/27
- [elpa] externals/corfu a04dfe5 04/11: Add `corfu-confirm`, more tolerance for typos (Fix #14), Protesilaos Stavrou, 2021/04/27
- [elpa] externals/corfu fe8674a 05/11: Ensure that the corfu popup works with `dabbrev-completion`,
Protesilaos Stavrou <=
- [elpa] externals/corfu 1db9916 11/11: Show "No match" message if no candidates are found, Protesilaos Stavrou, 2021/04/27
- [elpa] externals/corfu 5641e3b 06/11: Update readme, Protesilaos Stavrou, 2021/04/27
- [elpa] externals/corfu 0b87702 07/11: Add `corfu-excluded-modes`, Protesilaos Stavrou, 2021/04/27
- [elpa] externals/corfu 9dc4759 09/11: Exit conditions: Minor cleanup, Protesilaos Stavrou, 2021/04/27
- [elpa] externals/corfu ed3a26b 10/11: Better guarding against errors during candidate generation, Protesilaos Stavrou, 2021/04/27
- [elpa] externals/corfu ba858df 08/11: Guard against dabbrev error if there are no matches, Protesilaos Stavrou, 2021/04/27