Skip to content

Commit

Permalink
feat: Add isAsciiMainFile option to remove IFD
Browse files Browse the repository at this point in the history
  • Loading branch information
akirak committed Nov 23, 2023
1 parent 9c3c6ba commit 92ad7ee
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions pkgs/emacs/data/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,19 @@ in

# builtins.readFile fails when the source file contains control characters.
# pydoc.el is an example. A workaround is to take only the first N bytes of
# the file using `head` command and read its output.
# the file using `head` command and read its output. This is IFD.
headers =
lib.parseElispHeaders
(lib.readFirstBytes
# magit.el has a relatively long header, so other libraries would be shorter.
1500
(self.src + "/${self.mainFile}"));
(
# This adds support for an option isAsciiMainFile to remove IFD.
if self.isAsciiMainFile or false
then builtins.readFile (self.src + "/${self.mainFile}")
else
(lib.readFirstBytes
# magit.el has a relatively long header, so other libraries would be shorter.
1500
(self.src + "/${self.mainFile}"))
);
in
lib.getAttrs
(filter (name: hasAttr name attrs) [
Expand Down

0 comments on commit 92ad7ee

Please sign in to comment.