jwiegley / use-package

A use-package declaration for simplifying your .emacs
https://jwiegley.github.io/use-package
GNU General Public License v3.0
4.39k stars 259 forks source link

:bind not accepting key binding #925

Closed ZelphirKaltstahl closed 3 years ago

ZelphirKaltstahl commented 3 years ago

I want to try to reorganize my init.el file using use-package. Part of that is setting key bindings in the use package declarations of the packages, for which the key bindings apply.

Currently I have this:

;;; Emacs-Config --- This is my Emacs config file.

;;; Commentary:
;; None.

;;; Code:
;; None.

(require 'package)

;; =====
;; MELPA
;; =====

(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(add-to-list 'package-archives '("melpa-stable" . "https://melpa.org/packages/"))

;; ===========
;; USE-PACKAGE
;; ===========

(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

(eval-when-compile
  (require 'use-package))

;; ... many other packages here, all loaded with (use-package PACKAGE_NAME :ensure t) ...

(use-package neotree
  :ensure t
  :bind (("<f8>" 'neotree-toggle)))

;; ... many other packages here, all loaded with (use-package PACKAGE_NAME :ensure t) ...

This results in:

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

And seemingly no matter what syntax I try to satisfy the bind-keys macro, it shows the same error. So far I have tried:

To no avail. The readme states:

The syntax for the keybindings is similar to the "kbd" syntax: see https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-Rebinding.html for more information.

The question here would be: Where can I find a documentation of how the syntax of key bindings is similar, but not the same, or a note, that it really is the same.

How can I get this key binding to work?

Additional info

Addendum 1

It seems, that :bind also does not accept other key bindings like the following:

(use-package goto-last-change
  :ensure t
  :bind
  (("C-g l" 'goto-last-change)))

Same error:

Error (use-package): Failed to parse package goto-last-change: use-package: goto-last-change wants arguments acceptable to the `bind-keys' macro, or a list of such values
thomasf commented 3 years ago

you forgot the .

ZelphirKaltstahl commented 3 years ago

@thomasf Ah! I see! It is a pair! That's my unfamiliarity with Elisp, I guess. Thank you!