[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/corfu dfee8df 3/5: README: Move configuration section
From: |
ELPA Syncer |
Subject: |
[elpa] externals/corfu dfee8df 3/5: README: Move configuration section |
Date: |
Thu, 22 Jul 2021 15:57:09 -0400 (EDT) |
branch: externals/corfu
commit dfee8df7da3229df349e1d9250e72151db6d2c09
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
README: Move configuration section
---
README.org | 60 ++++++++++++++++++++++++++++++------------------------------
1 file changed, 30 insertions(+), 30 deletions(-)
diff --git a/README.org b/README.org
index 592b245..fe8d4d9 100644
--- a/README.org
+++ b/README.org
@@ -118,6 +118,36 @@
(setq tab-always-indent 'complete))
#+end_src
+** File path completion inside strings
+
+ In order to additional complete file paths in string literals, we can reuse
+ the file path completion of the ~comint-mode~. Comit provides the
+ ~comint--complete-file-name-data~ completion-at-point-function (Capf). We
write
+ a small wrapper function ~file-name-at-point~ and register it in the
+ ~completion-at-point-functions~ list for programming language modes.
+
+ #+begin_src emacs-lisp
+ (defvar comint-completion-addsuffix)
+ (autoload 'comint--match-partial-filename "comint")
+
+ (defun file-name-at-point ()
+ "File path completion function."
+ (when (comint--match-partial-filename)
+ (let ((comint-completion-addsuffix))
+ (comint--complete-file-name-data))))
+
+ (defun file-name-at-point-setup ()
+ "Setup file path completion at point in string literals."
+ (let ((global (memq t completion-at-point-functions)))
+ (setq-local completion-at-point-functions
+ (delete-dups
+ (append completion-at-point-functions
+ (list #'file-name-at-point)
+ (and global (list t)))))))
+
+ (add-hook 'prog-mode-hook #'file-name-at-point-setup)
+ #+end_src
+
* Key bindings
Corfu uses a transient keymap ~corfu-map~ which is active while the popup is
shown.
@@ -135,36 +165,6 @@
- =M-h= -> ~corfu-show-documentation~
- =C-g=, =ESC ESC ESC= -> ~corfu-quit~
-* File path completion inside strings
-
- In order to additional complete file paths in string literals, we can reuse
- the file path completion of the ~comint-mode~. Comit provides the
- ~comint--complete-file-name-data~ completion-at-point-function (Capf). We
write
- a small wrapper function ~file-name-at-point~ and register it in the
- ~completion-at-point-functions~ list for programming language modes.
-
- #+begin_src emacs-lisp
- (defvar comint-completion-addsuffix)
- (autoload 'comint--match-partial-filename "comint")
-
- (defun file-name-at-point ()
- "File path completion function."
- (when (comint--match-partial-filename)
- (let ((comint-completion-addsuffix))
- (comint--complete-file-name-data))))
-
- (defun file-name-at-point-setup ()
- "Setup file path completion at point in string literals."
- (let ((global (memq t completion-at-point-functions)))
- (setq-local completion-at-point-functions
- (delete-dups
- (append completion-at-point-functions
- (list #'file-name-at-point)
- (and global (list t)))))))
-
- (add-hook 'prog-mode-hook #'file-name-at-point-setup)
- #+end_src
-
* Complementary packages
Corfu works well together with all packages providing code completion via the