Skip to content

Commit

Permalink
style: Remove dead code and underscore unused parameters
Browse files Browse the repository at this point in the history
Follow lint suggestions.
  • Loading branch information
akirak committed Nov 10, 2024
1 parent 5c0c205 commit db3c0b0
Show file tree
Hide file tree
Showing 18 changed files with 17 additions and 47 deletions.
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

inputs.elisp-helpers.url = "github:emacs-twist/elisp-helpers";

outputs = {...} @ inputs: {
outputs = inputs: {
# The APIs under lib is unstable at present. It may undergo changes in the
# future.
lib = import ./lib inputs;
Expand Down
3 changes: 0 additions & 3 deletions lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ in

emacsBuiltinLibraries =
{
stdenv,
ripgrep,
emacs,
lib,
}@args:
lib.pipe (readFile (import ../pkgs/emacs/builtins.nix args)) [
Expand Down
4 changes: 1 addition & 3 deletions modules/home-manager.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ home-manager module that provides an installation of Emacs

emacs-config = cfg.config;

configurationRevision = emacs-config.configurationRevision;

initFile = pkgs.runCommandLocal "init.el" {} ''
mkdir -p $out
touch $out/init.el
Expand Down Expand Up @@ -45,7 +43,7 @@ home-manager module that provides an installation of Emacs
'';

desktopItem = pkgs.makeDesktopItem {
name = cfg.name;
inherit (cfg) name;
inherit (cfg.desktopItem) desktopName mimeTypes;
comment = "Edit text";
genericName = "Text Editor";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/build-support/elisp/collectFromSetup.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ with builtins; let
go = {
data,
rest,
} @ acc: fields: {
}: fields: {
data =
data
++ lib.pipe fields [
Expand Down
2 changes: 1 addition & 1 deletion pkgs/build-support/elisp/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
inputs.elisp-helpers.url = "github:emacs-twist/elisp-helpers";

outputs =
{ ... }:
_:
{
};
}
2 changes: 1 addition & 1 deletion pkgs/build-support/testToNix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ in
type = "github";
};
};
outputs = {...}: {};
outputs = _: {};
};
expected = ''
{ description = "description"; inputs = { bind-key = { flake = false; owner = "jwiegley"; repo = "use-package"; type = "github"; }; "bind-key+" = { flake = false; owner = "jwiegley"; repo = "use-package"; type = "github"; }; }; outputs = <LAMBDA>; }'';
Expand Down
2 changes: 0 additions & 2 deletions pkgs/build-support/toNix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
{lib}: let
inherit (builtins) isList isAttrs isFunction toJSON concatStringsSep match;

isPrimitive = v: ! (isList v || isAttrs v || isFunction v);

wrap = open: close: body: open + body + close;

printList = v:
Expand Down
3 changes: 0 additions & 3 deletions pkgs/emacs/data/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ let
tail
hasAttr
filter
elem
mapAttrs
readFile
pathExists
concatLists
isFunction
removeAttrs
attrNames
Expand Down
2 changes: 1 addition & 1 deletion pkgs/emacs/data/inventory/elpa.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ with builtins;
lib.pipe elpaEntries [
(lib.filterAttrs (_: entry: entry ? core))
(lib.mapAttrs (
_: {core, ...} @ entry: {
_: {core, ...}: {
inherit inventory;
src = args.core-src;
doTangle = true;
Expand Down
15 changes: 2 additions & 13 deletions pkgs/emacs/data/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,11 @@ let
inherit
(builtins)
pathExists
fetchTree
replaceStrings
map
readDir
hasAttr
readFile
attrNames
filter
all
match
isString
isList
typeOf
length
head
toJSON
Expand Down Expand Up @@ -120,10 +112,7 @@ in
];

mainFile =
if attrs ? mainFile
then attrs.mainFile
else
lib.findFirst
attrs.mainFile or (lib.findFirst
(file: baseNameOf file == ename + ".el")
(
if length self.lispFiles > 0
Expand All @@ -136,7 +125,7 @@ in
Entry: ${toJSON attrs.inventory}
''
)
self.lispFiles;
self.lispFiles);

# TODO: Check https://github.com/melpa/melpa/issues/2955 on the right versioning scheme
version =
Expand Down
3 changes: 0 additions & 3 deletions pkgs/emacs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,12 @@
(builtins)
readFile
attrNames
attrValues
concatLists
isFunction
split
filter
isString
mapAttrs
match
isList
isAttrs
elem
removeAttrs
Expand Down
7 changes: 2 additions & 5 deletions pkgs/emacs/lock/default.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
{
lib,
nix,
nixfmt-rfc-style,
jq,
coreutils,
runCommandLocal,
writeTextFile,
writeShellScript,
writeShellApplication,
# Current version
flakeLockFile ? null,
}: {
packageInputs,
flakeNix ? false,
Expand All @@ -19,7 +16,7 @@
postCommand ? null,
}:
assert (flakeNix || archiveLock); let
inherit (builtins) toJSON attrNames mapAttrs;
inherit (builtins) toJSON mapAttrs;

archiveLockData = lib.pipe packageInputs [
(lib.filterAttrs (_: attrs: attrs ? archive))
Expand Down Expand Up @@ -50,7 +47,7 @@ assert (flakeNix || archiveLock); let
(lib.filterAttrs (_: attrs: attrs ? origin))
(lib.mapAttrs (_: {origin, ...}: origin // {flake = false;}))
];
outputs = {...}: {};
outputs = _: {};
};
archiveLock = toJSON archiveLockData;
metadataJson = toJSON packageMetadata;
Expand Down
8 changes: 3 additions & 5 deletions pkgs/emacs/tools/check-versions.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
inherit
(builtins)
mapAttrs
all
hasAttr
elem
length
Expand All @@ -18,7 +17,6 @@
substring
lessThan
concatLists
sort
concatStringsSep
attrNames
;
Expand Down Expand Up @@ -90,9 +88,9 @@
}
// status)))
concatLists
(lib.groupBy ({ename, ...}: ename))
(mapAttrs (ename: statuses: {
current = (head statuses).current;
(builtins.groupBy ({ename, ...}: ename))
(mapAttrs (_ename: statuses: {
inherit ((head statuses)) current;
# Showing the source date may be useful, but maybe later.
#
# lastModifiedDate =
Expand Down
2 changes: 1 addition & 1 deletion pkgs/emacs/tools/reverse.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Reverse dependencies of elisp packages
{lib}: packageInputs: let
inherit (builtins) attrNames hasAttr mapAttrs substring;
inherit (builtins) mapAttrs substring;

revDeps = name:
lib.concatMapAttrs (
Expand Down
2 changes: 1 addition & 1 deletion pkgs/emacs/wrapper.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
configurationRevision,
extraSiteStartElisp,
}: let
inherit (builtins) length listToAttrs;
inherit (builtins) length;

elispInputs = lib.attrVals packageNames elispPackages;

Expand Down
1 change: 0 additions & 1 deletion template/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
};

outputs = {
self,
nixpkgs,
nixpkgs-emacs,
flake-utils,
Expand Down
2 changes: 1 addition & 1 deletion test/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
import nixpkgs {
inherit system;
overlays = [
(final: prev: {
(_final: _prev: {
emacsPackage = emacs-ci.packages.${system}.emacs-snapshot;
})
];
Expand Down
2 changes: 1 addition & 1 deletion test/lock/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,5 @@
type = "github";
};
};
outputs = { ... }: { };
outputs = _: { };
}

0 comments on commit db3c0b0

Please sign in to comment.