Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symbol’s function definition is void: seq-keep #5011

Closed
jroimartin opened this issue Sep 22, 2023 · 21 comments
Closed

Symbol’s function definition is void: seq-keep #5011

jroimartin opened this issue Sep 22, 2023 · 21 comments
Labels
straight updated Updating dependencies fixed it

Comments

@jroimartin
Copy link

After updating Magit, it looks like this:

image

It seems that 84eaa20 causes the following error to show up:

magit-format-ref-labels: Symbol’s function definition is void: seq-keep

I followed these instructions but the problem persists.

If you have just updated Magit, then restart Emacs. If that does not fix the issue, then also uninstall Magit and all dependencies that were updated at the same time, restart Emacs and then reinstall Magit.

Magit version: Magit 20230921.2037 [>= 3.3.0.50-git], Transient 0.4.3, Git 2.41.0, Emacs 28.2, gnu/linux

@jroimartin
Copy link
Author

jroimartin commented Sep 22, 2023

As a workaround I installed seq-2.24 manually and added (require 'seq-25) to my init file. I guess this has to do with the builtin seq package (v2.23 in my case) being loaded first. I'm adding this comment here just in case it helps on debugging the issue.

@tarsius
Copy link
Member

tarsius commented Sep 22, 2023

Last night I started using seq-keep in forge but did not add seq-2.24 as a dependency. It is possible you updated packages at this point. I then noticed the issue thanks to CI and fixed it for forge. I then went on to using seq-keep in magit as well. I did add the dependency this time around.

So it is likely that just updating packages again would also have fixed this issue; the fact that you had to manually install seq-2.24 speaks for that. If not -- if an older version of seq is being loaded, despite of the package-installed 2.24 being on the load-path -- then it is most likely an issue with package or something internal to the seq backport package itself.

@tarsius
Copy link
Member

tarsius commented Sep 22, 2023

You should not have to manually require seq-25 because that's what the package-installed seq.el does:

[snip]
;;; Code:

(if (version< emacs-version "25")
    (require 'seq-24)
  (require 'seq-25))

(provide 'seq)
;;; seq.el ends here

@jroimartin
Copy link
Author

I think I found the issue.

GNU Emacs 28.2 comes with seq-2.23 built in and it does not upgrade built-in packages automatically. Thus, I had to install seq-2.24 manually. Also, the function seq-keep used by magit is not autoloaded, which requires to explicitly load the library.

Long story short, my current workaround is:

  1. Install seq-2.24 manually.
  2. Add (load "seq") to the init file.

Does it make sense?

@jroimartin
Copy link
Author

Information about upgrading built-in packages in GNU Emacs 29: https://git.savannah.gnu.org/cgit/emacs.git/tree/etc/NEWS.29#n1714

tarsius added a commit that referenced this issue Sep 22, 2023
It is not autoloaded.  Re #5011.
@tarsius
Copy link
Member

tarsius commented Sep 22, 2023

I've added an explicit require.

(You shouldn't use load. It is almost always better to use require.)

I'll have to look into those news. I don't use package myself, and assume(d) that it does not silently ignore explicitly specified dependency versions (by default, or ever).

@jroimartin
Copy link
Author

jroimartin commented Sep 22, 2023

However, I cannot use (require 'seq) because it seems the feature seq is already provided by /usr/share/emacs/28.2/lisp/emacs-lisp/seq.elc (instead of ~/.emacs.d/elpa/seq-2.24/seq.el) by the time it is called from my init file. So require is ignored.

@tarsius
Copy link
Member

tarsius commented Sep 22, 2023

I see. That probably means that something loads seq before package-initialize is called. Across Emacs releases, there are big difference in how and when that is automatically called for you, if at all, how you can call it explicitly instead, and what the recommended way of doing that is. It could be that this defaults to being broken, but it could also could be that you do something that results in this behavior (possibly because it at one point was recommended that you do that).

In other words I will have to investigate. Meanwhile, other users running into this, should first try to update, and if that alone doesn't work add (require 'seq) explicitly early on (but after package-initialize, if that can be found in early-init.el or init.el), and only if that also doesn't work, fall back to (load 'seq).

If this is indeed a bug causes by the default configuration of some Emacs releases, or a common misconfiguration, then I might have to require seq like so:

(when (and (featurep' seq)
          (not (fboundp 'seq-keep)))
  (unload-feature 'seq 'force))
(require 'seq)

jroimartin added a commit to jroimartin/dotfiles that referenced this issue Sep 22, 2023
@makohoek
Copy link

@jroimartin thank you for opening this. I confirm your work-around works for me as well. I'm also on emacs 28.2.

I've made a similar hack in my spacemacs config here:
makohoek/dotfiles@c7868f9

@RastaDill
Copy link

Hello. Does anyone know how to install the previous version of the package?
Why used rolling release?

@qezz
Copy link

qezz commented Sep 24, 2023

As a short-term solution, it's possible to have the seq-keep definition in init.el

(defun seq-keep (function sequence)
  "Apply FUNCTION to SEQUENCE and return the list of all the non-nil results."
  (delq nil (seq-map function sequence)))

(from https://github.com/emacs-mirror/emacs/blob/master/lisp/emacs-lisp/seq.el)

After this, magit works fine.

@tarsius
Copy link
Member

tarsius commented Sep 24, 2023

I've installed the mentioned kludge.

@doolio
Copy link

doolio commented Oct 7, 2023

Just ran into this issue. Uninstalling magit and its dependencies and re-installing doesn't install the latest version of the seq package. I use straight.el rather than package.el if that matters and am still on Emacs 27.1. The workaround mentioned here is working for me though.

@tarsius
Copy link
Member

tarsius commented Oct 7, 2023

@doolio You should probably report that to Straight's maintainers.

@tarsius
Copy link
Member

tarsius commented Nov 7, 2023

Straight does not update dependencies and even ignores the specified minimal versions. See radian-software/straight.el#1083.

@doolio
Copy link

doolio commented Nov 13, 2023

Straight does not update dependencies and even ignores the specified minimal versions.

The latest commit on straight's develop branch fixes this issue wrt magit at least.

@spacekookie
Copy link

I ran into this issue again on magit version 20231112.914. I'm installing emacs and dependencies via nix, so manually side-loading seq isn't an option. But I thought it also wouldn't be required anymore in this version?

@tarsius
Copy link
Member

tarsius commented Dec 1, 2023

But I thought it also wouldn't be required anymore in this version?

Magit now works around deficits of package.el, but that doesn't change the fact that it depends on seq v2.24, which means that that package has to be installed independently when using an Emacs release that does not include that version yet.

I ran into this issue again on magit version 20231112.914. I'm installing emacs and dependencies via nix, so manually side-loading seq isn't an option.

That's a bug in how magit is packages in nix then. Please report this to the maintainer of magit in nix. Thanks!

@Nebucatnetzer
Copy link

Nebucatnetzer commented Dec 4, 2023

I ran into this issue again on magit version 20231112.914. I'm installing emacs and dependencies via nix, so manually side-loading seq isn't an option. But I thought it also wouldn't be required anymore in this version?

Do you have by chance a workaround for a Nix based config?
Edit: I installed the package from melpa for the moment until the package gets fixed in Nix or there is a known workaround.

@mmarx
Copy link

mmarx commented Dec 4, 2023

I ran into this issue again on magit version 20231112.914. I'm installing emacs and dependencies via nix, so manually side-loading seq isn't an option. But I thought it also wouldn't be required anymore in this version?

Do you have by chance a workaround for a Nix based config?

This is what I'm currently using:

  overrides = self: super: {
    elpaPackages =
      super.elpaPackages
      // {
        seq = self.callPackage ({
          elpaBuild,
          fetchurl,
          lib,
        }:
          elpaBuild rec {
            pname = "seq";
            ename = "seq";
            version = "2.24";
            src = fetchurl {
              url = "https://elpa.gnu.org/packages/seq-2.24.tar";
              sha256 = "1w2cysad3qwnzdabhq9xipbslsjm528fcxkwnslhlkh8v07karml";
            };
            packageRequires = [];
            meta = {
              homepage = "https://elpa.gnu.org/packages/seq.html";
              license = lib.licenses.free;
            };
            # tests take a _long_ time to byte-compile, skip them
            postInstall = ''rm -r $out/share/emacs/site-lisp/elpa/${pname}-${version}/tests'';
          }) {};
      };
  };

emacsPackage =
    ((pkgs.emacsPackagesFor pkgs.emacs29-gtk3).overrideScope' overrides).emacsWithPackages;`

Nebucatnetzer added a commit to Nebucatnetzer/nixos that referenced this issue Dec 4, 2023
There is currently a bug in the Nix version which breaks magit.
It's fixed upstream but doesn't work yet in the Nix version:
magit/magit#5011
@crawford
Copy link

crawford commented Dec 14, 2023

Thanks for the hint @mmarx. I've adapted it for Home Manager in case anyone is looking for that as well:

{
  programs = {
    emacs = {
      overrides = self: super: rec {
        # Taken from https://github.com/magit/magit/issues/5011#issuecomment-1838598138
        seq = self.callPackage ({ elpaBuild, fetchurl, lib }:
          elpaBuild rec {
            pname = "seq";
            ename = "seq";
            version = "2.24";
            src = fetchurl {
              url = "https://elpa.gnu.org/packages/seq-2.24.tar";
              sha256 = "1w2cysad3qwnzdabhq9xipbslsjm528fcxkwnslhlkh8v07karml";
            };
            packageRequires = [];
            meta = {
              homepage = "https://elpa.gnu.org/packages/seq.html";
              license = lib.licenses.free;
            };
            # tests take a _long_ time to byte-compile, skip them
            postInstall = ''rm -r $out/share/emacs/site-lisp/elpa/${pname}-${version}/tests'';
          }) {};
      };
    };
  };
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
straight updated Updating dependencies fixed it
Projects
None yet
Development

No branches or pull requests

10 participants