Merge pull request #47238 from obsidiansystems/overrideScope-order

lib: Deprecate `overrideScope` in lieu of `overrideScope'` taking arguments in the conventional order
This commit is contained in:
John Ericson 2018-09-24 18:04:18 -04:00 committed by GitHub
commit 22ce614112
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 9 deletions

View File

@ -643,15 +643,15 @@ cp ${myEmacsConfig} $out/share/emacs/site-lisp/default.el
required dependencies manually - but it's tedious and there is always a required dependencies manually - but it's tedious and there is always a
possibility that an unwanted dependency will sneak in through some other possibility that an unwanted dependency will sneak in through some other
package. To completely override such a package you can use package. To completely override such a package you can use
<varname>overrideScope</varname>. <varname>overrideScope'</varname>.
</para> </para>
<screen> <screen>
overrides = super: self: rec { overrides = self: super: rec {
haskell-mode = self.melpaPackages.haskell-mode; haskell-mode = self.melpaPackages.haskell-mode;
... ...
}; };
((emacsPackagesNgGen emacs).overrideScope overrides).emacsWithPackages (p: with p; [ ((emacsPackagesNgGen emacs).overrideScope' overrides).emacsWithPackages (p: with p; [
# here both these package will use haskell-mode of our own choice # here both these package will use haskell-mode of our own choice
ghc-mod ghc-mod
dante dante

View File

@ -185,7 +185,7 @@ rec {
/* Make a set of packages with a common scope. All packages called /* Make a set of packages with a common scope. All packages called
with the provided `callPackage' will be evaluated with the same with the provided `callPackage' will be evaluated with the same
arguments. Any package in the set may depend on any other. The arguments. Any package in the set may depend on any other. The
`overrideScope' function allows subsequent modification of the package `overrideScope'` function allows subsequent modification of the package
set in a consistent way, i.e. all packages in the set will be set in a consistent way, i.e. all packages in the set will be
called with the overridden packages. The package sets may be called with the overridden packages. The package sets may be
hierarchical: the packages in the set are called with the scope hierarchical: the packages in the set are called with the scope
@ -195,10 +195,10 @@ rec {
let self = f self // { let self = f self // {
newScope = scope: newScope (self // scope); newScope = scope: newScope (self // scope);
callPackage = self.newScope {}; callPackage = self.newScope {};
# TODO(@Ericson2314): Haromonize argument order of `g` with everything else overrideScope = g: lib.warn
overrideScope = g: "`overrideScope` (from `lib.makeScope`) is deprecated. Do `overrideScope' (self: self: { })` instead of `overrideScope (super: self: { })`. All other overrides have the parameters in that order, including other definitions of `overrideScope`. This was the only definition violating the pattern."
makeScope newScope (makeScope newScope (lib.fixedPoints.extends (lib.flip g) f));
(lib.fixedPoints.extends (lib.flip g) f); overrideScope' = g: makeScope newScope (lib.fixedPoints.extends g f);
packages = f; packages = f;
}; };
in self; in self;

View File

@ -21,7 +21,7 @@ set which contains `emacsWithPackages`. For example, to override
`emacsPackagesNg.emacsWithPackages`, `emacsPackagesNg.emacsWithPackages`,
``` ```
let customEmacsPackages = let customEmacsPackages =
emacsPackagesNg.overrideScope (super: self: { emacsPackagesNg.overrideScope' (self: super: {
# use a custom version of emacs # use a custom version of emacs
emacs = ...; emacs = ...;
# use the unstable MELPA version of magit # use the unstable MELPA version of magit