summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2024-07-13 15:39:24 +0200
committerDaniel Mendler <mail@daniel-mendler.de>2024-07-13 15:39:24 +0200
commit5b7a40b006cc93d502b2ffd48368ff35fb596b3f (patch)
tree9141f9f02eac109de2fe7f61c2a446e98d8a1a77
parentf74d3e7b5aa658663705035aaac2c321bb8ed5cc (diff)
README: Simplify configuration
-rw-r--r--README.org13
1 files changed, 6 insertions, 7 deletions
diff --git a/README.org b/README.org
index ceb284f..68488a3 100644
--- a/README.org
+++ b/README.org
@@ -415,7 +415,7 @@ open. This can feel intrusive, in particular in combination with auto
completion. ~RET~ may accidentally commit an automatically selected candidate,
while you actually wanted to start a new line. As an alternative we can unbind
the ~RET~ key completely from ~corfu-map~ or reserve the ~RET~ key only in shell
-modes.
+modes using a menu-item filter.
#+begin_src emacs-lisp
;; TAB-only configuration
@@ -430,15 +430,14 @@ modes.
;; Option 1: Unbind RET completely
;;; ("RET" . nil)
;; Option 2: Use RET only in shell modes
- ("RET" . (menu-item "" nil :filter corfu-send-filter)))
+ ("RET" . (menu-item
+ "" nil :filter
+ (lambda (&optional _)
+ (and (or (derived-mode-p 'eshell-mode) (derived-mode-p 'comint-mode))
+ #'corfu-send)))))
:init
(global-corfu-mode))
-
-(defun corfu-send-filter (&optional _)
- "Insert completion candidate and send when inside comint/eshell."
- (when (or (derived-mode-p 'eshell-mode) (derived-mode-p 'comint-mode))
- #'corfu-send))
#+end_src
** TAB-and-Go completion