minad / corfu

:desert_island: corfu.el - COmpletion in Region FUnction
GNU General Public License v3.0
1.1k stars 43 forks source link

TAB-only completion example fails on recent versions of Emacs #492

Closed erganemic closed 3 weeks ago

erganemic commented 3 weeks ago

On Emacs 31.0.50, specifically

GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.0) of 2024-08-12

run with emacs -Q, the code block in the "TAB-only Completion" section of the README fails with

Error (use-package): Failed to parse package corfu: use-package: corfu wants arguments acceptable to the `bind-keys' macro, or a list of such values

I've been using this block instead, which seems to be equivalent:

(use-package corfu
  :custom
  (corfu-auto t)
  (corfu-preselect 'directory)
  :bind
  (:map corfu-map
        ("RET" . nil)
        :filter
        (or (derived-mode-p 'eshell-mode) (derived-mode-p 'comint-mode))
        ("RET" . #'corfu-send))
  :init
  (global-corfu-mode))
erganemic commented 3 weeks ago

I think the ("RET" . nil) prior to the :filter is still necessary in the updated "Option 2" scenario, otherwise "RET" will still be bound to corfu-insert.

minad commented 3 weeks ago

I went with the more obvious keymap-set for now, see https://github.com/minad/corfu/commit/e0b7936c21121158628bc2b392fc7a42e26ae536. My familiarity with use-package is limited since I stopped using it years ago.