nix-community / emacs-overlay

Bleeding edge emacs overlay [maintainer=@adisbladis]
506 stars 165 forks source link

Bug in emacsGcc breaking autoloads breaks working variants #215

Closed ParetoOptimalDev closed 3 months ago

ParetoOptimalDev commented 2 years ago

Diving into #212 more I found that working versions didn't work after a non-working, but they do the second time:

{ pkgs ? import (builtins.fetchTarball {
  url = "https://github.com/nixos/nixpkgs/archive/a7ecde854aee5c4c7cd6177f54a99d2c1ff28a31.tar.gz";
}) {
    overlays = [
      (import (builtins.fetchTarball {
        url = https://github.com/nix-community/emacs-overlay/archive/c4bcf4b66394a4472cc251e2350c557dac13d621.tar.gz;
      }))];}, ... }:
let
    emacsPkgs = epkgs: [
    (builtins.trace "===> ${epkgs.haskell-mode.name}" epkgs.melpaPackages.haskell-mode)
    ];
    pkgsWithOverlay = (import (builtins.fetchTarball {
      url = "https://github.com/nixos/nixpkgs/archive/a7ecde854aee5c4c7cd6177f54a99d2c1ff28a31.tar.gz";
    })) {
      overlays = [
        (import (builtins.fetchTarball {
          url = https://github.com/nix-community/emacs-overlay/archive/master.tar.gz;
        }))
      ];
    };

  # works
  myEmacsGcc = (pkgsWithOverlay.emacsPackagesGen pkgsWithOverlay.emacsGcc).emacsWithPackages (epkgs: ([
    epkgs.haskell-mode
  ]));

  myEmacsGccImportedEmacsPackages = (pkgsWithOverlay.emacsPackagesGen pkgsWithOverlay.emacsGcc).emacsWithPackages (import ./emacs-packages.nix);

  emacsWithOverlay = pkgsWithOverlay.emacsWithPackagesFromUsePackage {
    config = builtins.readFile dotEmacs; # builtins.readFile ./emacs.el;z

    # nix-shell ~/.emacs.d/flavors/emacs-haskell-mode-repro.nix --run test-emacs
    # I uncommented these and ran them in order and got really weird behavior

    # works
    # package = pkgs.emacs;
    # extraEmacsPackages = emacsPkgs;

    # works
    # package = pkgsWithOverlay.emacs;
    # extraEmacsPackages = emacsPkgs;

    # eldoc error: (void-function haskell-doc-current-info)
    # package = pkgsWithOverlay.emacsGcc;
    # extraEmacsPackages = emacsPkgs;

    # NOTE: same as the one that worked above
    # works
    # package = pkgsWithOverlay.emacs;
    # extraEmacsPackages = emacsPkgs;

    # doesn't work
    # package = myEmacsGcc;

    # NOTE: same as the one that worked above
    # doesn't work????
    # package = pkgsWithOverlay.emacs;
    # extraEmacsPackages = emacsPkgs;

    # eldoc error: (void-function haskell-doc-current-info)
    # package = myEmacsGccImportedEmacsPackages;

    # NOTE: same as the one that worked above
    # run 1. eldoc error: (void-function haskell-doc-current-info)
    # run 2 works
    # package = pkgsWithOverlay.emacs;
    # extraEmacsPackages = emacsPkgs;

  };
  dotEmacs = pkgs.writeText "dot-emacs" ''
  (require 'haskell-mode)
  '';
  trivialHaskell = pkgs.writeText "foo.hs" ''
  module Main where
  main = undefined
  '';
  testEmacsHaskell = pkgs.writeScriptBin "test-emacs" ''
    exec ${emacsWithOverlay}/bin/emacs -Q -l ${dotEmacs} ${trivialHaskell}
  '';
in pkgs.mkShell {
  buildInputs = [ testEmacsHaskell ];
}
adisbladis commented 2 years ago

Is this in any way inherent to the Nix expressions or is it an upstream bug? We don't track Emacs upstream issues here.

ParetoOptimalDev commented 2 years ago

The nix expression is responsible for loading autoloads correctly.

The one in nixpkgs does, but this one in emacs-overlay doesn't load autoloads correctly.

Therefore it seemed most appropriate to create here.

adisbladis commented 3 months ago

I am closing all issues that looks unrelated to the overlay itself. Issues reported here should only be pertaining to the overlay infrastructure.

Build issues, runtime issues & the like should be reported to nixpkgs, where this code actually lives.