doomemacs / doomemacs

An Emacs framework for the stubborn martian hacker
MIT License
19.34k stars 3.05k forks source link

`wrong-number-of-arguments: #<subr general-unbind-non-prefix-key> 5` errors at startup #5785

Closed llight3 closed 2 years ago

llight3 commented 2 years ago

What did you expect to happen?

After the default install I expect the splash screen to load and the default keybindings to work

What actually happened?

doom loads a warning buffer with the following in and keybindings are broken

Error (doom-init-ui-hook): Error running hook "persp-mode" because: (wrong-number-of-arguments #<subr general-unbind-non-prefix-key> 5) Disable showing Disable logging
Error (doom-first-input-hook): Error running hook "evil-snipe-mode" because: (wrong-number-of-arguments #<subr general-unbind-non-prefix-key> 5) Disable showing Disable logging

Describe your attempts to resolve the issue

I tried using -debug-init but this didn't seem to help since it left emacs in the same state

Steps to reproduce

install emacs from source with ./configure --with-native-compilation --with-mailutils --with-imagemagick --with-xwidgets --with-dbus --without-libsystemd --with-x run doom install run emacs

System Information

https://pastebin.com/gWDuV010

ankhers commented 2 years ago

I'm having the same issue at the moment. Also using nativecomp. Let me know if I can provide any extra details.

system information

quangIO commented 2 years ago

I can confirm this issue using https://github.com/emacs-mirror/emacs/commit/ce2f7335f1f4ec8d276e47de79b3c9bd9797233d with native-comp and xwidgets on MacOS

yuuyins commented 2 years ago

same doom is unusable.

hlissner commented 2 years ago

I can't reproduce this issue. general-unbind-non-prefix-key is not used directly by Doom, so I suspect an upstream or local configuration issue.

Can any of you produce a backtrace from the error?

yuuyins commented 2 years ago

@hlissner if you want try emacs 29 compiled with native comp, or some recent commit from nix-community/emacs-overlay with emacsGcc. --debug-init doesn't help, M-x doesn't work, SPC h d same error. i'm reproducing it on vanilla doom

$ doom info
> Executing 'doom info' with Emacs 29.0.50 at 2021-11-18 17:20:41
    generated    Nov 18, 2021 17:20:41
      system       NixOS 21.11pre331460.931ab058daa (Porcupine) Linux 5.10.79 x86_64
      emacs        29.0.50 master 38322419e ~/.config/emacs/ -> ~/.config/emacs/
      doom         21.12.0-alpha HEAD -> develop, origin/develop b66aaf9e9 2021-11-18 19:23:55 +0100 ~/.config/doom/ -> ~/.config/doom/
      shell        /run/current-system/sw/bin/zsh
      features     CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB
      traits       batch envvar-file
      modules      :completion company vertico :ui doom doom-dashboard doom-quit hl-todo modeline ophints (popup +defaults) vc-gutter vi-tilde-fringe workspaces :editor (evil +everywhere) file-templates fold snippets :emacs dired electric undo vc :checkers syntax :tools (eval +overlay) lookup magit :lang emacs-lisp markdown org sh :config (default +bindings +smartparens)
yuuyins commented 2 years ago

more specifically i'm using

  emacs-overlay = (import (builtins.fetchTarball {
    url = "https://github.com/nix-community/emacs-overlay/archive/88c62860a48ce89a4631520e4a32037702cc285e.tar.gz";
    sha256 = "1vyxjjjra0mlfmay7bnys11mpdh0ly0c0mckv6fs2sgjh55wb8fg";
  }));
yuuyins commented 2 years ago

@hlissner that function is from https://github.com/noctuid/general.el/blob/master/general.el#L2252

so somewhere in?

$ rg general-auto-unbind-keys
core/core-keybinds.el
116:  (add-hook 'doom-after-init-modules-hook #'general-auto-unbind-keys))

core/autoload/config.el
84:          (general-auto-unbind-keys)
87:            (general-auto-unbind-keys t)))
hlissner commented 2 years ago

From the sound of it, the signature of define-key has changed on the tip of Emacs 29. If so, this should be raised upstream. I don't have access to 29 at the moment, so your best bet is to check out 28.x. I don't recommend using 29+; there are breaking updates almost every other week.

(I'll keep this open until I can investigate it more closely)

sekunho commented 2 years ago

Ram into this issue as well so I wanted to fallback to 28 to avoid frequent breakages of 29. emacs-overlay is a bit weird right now because 28 doesn't exist. emacsGcc points to 29, emacsUnstable points to 27 https://github.com/nix-community/emacs-overlay/issues/176. It's a bit difficult to look for the commit with 28, but I found a comment with a commit hash that has 28. This requires a full rebuild though since the binary is probably gone from Cachix. I don't really have the time to sift through the commit history for the latest commit with 28, especially since the commits aren't labeled anything specific.

  nixpkgs.overlays = [
    (import (builtins.fetchTarball {
      url = https://github.com/nix-community/emacs-overlay/archive/8320c615b706f0d459544d7d37a59c5a5ff5e7e0.tar.gz;
      sha256 = "1pajyn4n0yzi8qxlqjlh20zhdifxfvxqdcjmphqmb8b5p2grk2rx";
    }))
  ];

  services.emacs = {
    package = pkgs.emacsGcc;
    enable = true;
  };
[sekun@nixos:~]$ emacs --version
GNU Emacs 28.0.50
Copyright (C) 2021 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
yuuyins commented 2 years ago

@sekunho the issue was introduced after initial 29 commit. so nix-community/emacs-overlay/archive/f01c9352ea15574602234feea5b4dc25df26a77a.tar.gz, which is 29 commit 12d554e5c54487d753a133c048e262f3d54019bd, works. henrik likely was referring to latest changes in https://github.com/emacs-mirror/emacs/commits/master/src/keymap.c

doyougnu commented 2 years ago

For what its worth commit 64580e3ac034e2704895a272f341a0729d165b93 works for me:

let unstable = import <unstable> { overlays = [
      (import (builtins.fetchTarball {
        url = https://github.com/nix-community/emacs-overlay/archive/64580e3ac034e2704895a272f341a0729d165b93.tar.gz;
      }))
    ];};

This is dated to just 18 days ago: https://github.com/nix-community/emacs-overlay/commit/64580e3ac034e2704895a272f341a0729d165b93

So a not-so-great workaround seems to be to pick a commit, point emacs-overlay to the commit (by changing the url from blah/blah/master.tar.gz to blah/blah/<commit>.tar.gz like I have above, and then rebuild. This allows you to use emacs 29 with native compilation and doom.

qleguennec commented 2 years ago

I reproduce this on emacs commit 54b2bd1be6715cbc6bc87e2a6e65ffa04aff256b

sekunho commented 2 years ago

@yuuyins Yeah I just want to give the commit with 28 since 29 is more unstable.

SwiftLawnGnome commented 2 years ago

The error is apparently the advice general adds to define-key. putting

(general-auto-unbind-keys :off)
(remove-hook 'doom-after-init-modules-hook #'general-auto-unbind-keys)

in my config eliminated the issue.

jackmac92 commented 2 years ago

FYI if you're using emacs-overlay and found this issue, you probably want to use emacsUnstable variants instead (unstable variants are the last tagged release, as opposed to the head of master)

evidence

These attributes are named emacsGit and emacsUnstable. emacsGit is built from the latest master branch and emacsUnstable is built from the latest tag.
hlissner commented 2 years ago

This issue was resolved and the responsible package was bumped in 5535457. Let me know if that isn't the case and I'll reopen it. Thanks for bringing it to my attention!