<commit_before>{ stdenv, fetchurl, ncurses, pkgconfig, texinfo, libxml2, gnutls
, Carbon, Cocoa, ImageCaptureCore, OSAKit, Quartz, WebKit
}:

stdenv.mkDerivation rec {
  emacsName = "emacs-24.5";
  name = "${emacsName}-mac-5.13";

  #builder = ./builder.sh;

  src = fetchurl {
    url = "mirror://gnu/emacs/${emacsName}.tar.xz";
    sha256 = "0kn3rzm91qiswi0cql89kbv6mqn27rwsyjfb8xmwy9m5s8fxfiyx";
  };

  macportSrc = fetchurl {
    url = "ftp://ftp.math.s.chiba-u.ac.jp/emacs/${name}.tar.gz";
    sha256 = "0p8xpsnsdpwpfq4mz0fazm785d0my0pq4ifbw533g959jh17b36h";
  };

  enableParallelBuilding = true;

  buildInputs = [
    ncurses pkgconfig texinfo libxml2 gnutls
  ];

  propagatedBuildInputs = [
    Carbon Cocoa ImageCaptureCore OSAKit Quartz WebKit
  ];

  postUnpack = ''
    mv $emacsName $name
    tar xzf $macportSrc
    mv $name $emacsName
  '';

  preConfigure = ''
    substituteInPlace lisp/international/mule-cmds.el --replace /usr $TMPDIR
    substituteInPlace Makefile.in --replace "/bin/pwd" "pwd"
    substituteInPlace lib-src/Makefile.in --replace "/bin/pwd" "pwd"

    patch -p1 < patch-mac

    # The search for 'tputs' will fail because it's in ncursesw within the
    # ncurses package, yet Emacs' configure script only looks in ncurses.
    # Further, we need to make sure that the -L option occurs before mention
    # of the library, so that it finds it within the Nix store.
    sed -i 's/tinfo ncurses/tinfo ncursesw/' configure
    ncurseslib=$(echo ${ncurses}/lib | sed 's#/#\\/#g')
    sed -i "s/OLIBS=\$LIBS/OLIBS=\"-L$ncurseslib \$LIBS\"/" configure
    sed -i 's/LIBS="\$LIBS_TERMCAP \$LIBS"/LIBS="\$LIBS \$LIBS_TERMCAP"/' configure

    configureFlagsArray=(
      LDFLAGS=-L${ncurses}/lib
      --with-xml2=yes
      --with-gnutls=yes
      --with-mac
      --enable-mac-app=$out/Applications
    )
    makeFlagsArray=(
      CFLAGS=-O3
      LDFLAGS="-O3 -L${ncurses}/lib"
    );
  '';

  postInstall = ''
    cat >$out/share/emacs/site-lisp/site-start.el <<EOF
    ;; nixos specific load-path
    (when (getenv "NIX_PROFILES") (setq load-path
                          (append (reverse (mapcar (lambda (x) (concat x "/share/emacs/site-lisp/"))
                             (split-string (getenv "NIX_PROFILES"))))
                    load-path)))

    ;; make tramp work for NixOS machines
    (eval-after-load 'tramp '(add-to-list 'tramp-remote-path "/run/current-system/sw/bin"))
    EOF
  '';

  doCheck = true;

  meta = with stdenv.lib; {
    description = "GNU Emacs 24, the extensible, customizable text editor";
    homepage    = http://www.gnu.org/software/emacs/;
    license     = licenses.gpl3Plus;
    maintainers = with maintainers; [ jwiegley ];
    platforms   = platforms.darwin;

    longDescription = ''
      GNU Emacs is an extensible, customizable text editor—and more.  At its
      core is an interpreter for Emacs Lisp, a dialect of the Lisp
      programming language with extensions to support text editing.

      The features of GNU Emacs include: content-sensitive editing modes,
      including syntax coloring, for a wide variety of file types including
      plain text, source code, and HTML; complete built-in documentation,
      including a tutorial for new users; full Unicode support for nearly all
      human languages and their scripts; highly customizable, using Emacs
      Lisp code or a graphical interface; a large number of extensions that
      add other functionality, including a project planner, mail and news
      reader, debugger interface, calendar, and more.  Many of these
      extensions are distributed with GNU Emacs; others are available
      separately.

      This is "Mac port" addition to GNU Emacs 24. This provides a native
      GUI support for Mac OS X 10.4 - 10.11. Note that Emacs 23 and later
      already contain the official GUI support via the NS (Cocoa) port for
      Mac OS X 10.4 and later. So if it is good enough for you, then you
      don't need to try this.
    '';
  };
}
<commit_msg>emacs24Macport: 5.13 -> 5.15<commit_after>{ stdenv, fetchurl, ncurses, pkgconfig, texinfo, libxml2, gnutls
, Carbon, Cocoa, ImageCaptureCore, OSAKit, Quartz, WebKit
}:

stdenv.mkDerivation rec {
  emacsName = "emacs-24.5";
  name = "${emacsName}-mac-5.15";

  #builder = ./builder.sh;

  src = fetchurl {
    url = "mirror://gnu/emacs/${emacsName}.tar.xz";
    sha256 = "0kn3rzm91qiswi0cql89kbv6mqn27rwsyjfb8xmwy9m5s8fxfiyx";
  };

  macportSrc = fetchurl {
    url = "ftp://ftp.math.s.chiba-u.ac.jp/emacs/${name}.tar.gz";
    sha256 = "1r47bm1pf5av2yr37byz91y7bp6vdw9smahiy18g5qp4jp6mz193";
  };

  enableParallelBuilding = true;

  buildInputs = [
    ncurses pkgconfig texinfo libxml2 gnutls
  ];

  propagatedBuildInputs = [
    Carbon Cocoa ImageCaptureCore OSAKit Quartz WebKit
  ];

  postUnpack = ''
    mv $emacsName $name
    tar xzf $macportSrc
    mv $name $emacsName
  '';

  preConfigure = ''
    substituteInPlace lisp/international/mule-cmds.el --replace /usr $TMPDIR
    substituteInPlace Makefile.in --replace "/bin/pwd" "pwd"
    substituteInPlace lib-src/Makefile.in --replace "/bin/pwd" "pwd"

    patch -p1 < patch-mac

    # The search for 'tputs' will fail because it's in ncursesw within the
    # ncurses package, yet Emacs' configure script only looks in ncurses.
    # Further, we need to make sure that the -L option occurs before mention
    # of the library, so that it finds it within the Nix store.
    sed -i 's/tinfo ncurses/tinfo ncursesw/' configure
    ncurseslib=$(echo ${ncurses}/lib | sed 's#/#\\/#g')
    sed -i "s/OLIBS=\$LIBS/OLIBS=\"-L$ncurseslib \$LIBS\"/" configure
    sed -i 's/LIBS="\$LIBS_TERMCAP \$LIBS"/LIBS="\$LIBS \$LIBS_TERMCAP"/' configure

    configureFlagsArray=(
      LDFLAGS=-L${ncurses}/lib
      --with-xml2=yes
      --with-gnutls=yes
      --with-mac
      --enable-mac-app=$out/Applications
    )
    makeFlagsArray=(
      CFLAGS=-O3
      LDFLAGS="-O3 -L${ncurses}/lib"
    );
  '';

  postInstall = ''
    cat >$out/share/emacs/site-lisp/site-start.el <<EOF
    ;; nixos specific load-path
    (when (getenv "NIX_PROFILES") (setq load-path
                          (append (reverse (mapcar (lambda (x) (concat x "/share/emacs/site-lisp/"))
                             (split-string (getenv "NIX_PROFILES"))))
                    load-path)))

    ;; make tramp work for NixOS machines
    (eval-after-load 'tramp '(add-to-list 'tramp-remote-path "/run/current-system/sw/bin"))
    EOF
  '';

  doCheck = true;

  meta = with stdenv.lib; {
    description = "GNU Emacs 24, the extensible, customizable text editor";
    homepage    = http://www.gnu.org/software/emacs/;
    license     = licenses.gpl3Plus;
    maintainers = with maintainers; [ jwiegley ];
    platforms   = platforms.darwin;

    longDescription = ''
      GNU Emacs is an extensible, customizable text editor—and more.  At its
      core is an interpreter for Emacs Lisp, a dialect of the Lisp
      programming language with extensions to support text editing.

      The features of GNU Emacs include: content-sensitive editing modes,
      including syntax coloring, for a wide variety of file types including
      plain text, source code, and HTML; complete built-in documentation,
      including a tutorial for new users; full Unicode support for nearly all
      human languages and their scripts; highly customizable, using Emacs
      Lisp code or a graphical interface; a large number of extensions that
      add other functionality, including a project planner, mail and news
      reader, debugger interface, calendar, and more.  Many of these
      extensions are distributed with GNU Emacs; others are available
      separately.

      This is "Mac port" addition to GNU Emacs 24. This provides a native
      GUI support for Mac OS X 10.4 - 10.11. Note that Emacs 23 and later
      already contain the official GUI support via the NS (Cocoa) port for
      Mac OS X 10.4 and later. So if it is good enough for you, then you
      don't need to try this.
    '';
  };
}

{'fraction_non_alphanumeric': 0.10704960835509138, 'fraction_numerical': 0.018276762402088774, 'mean_word_length': 2.803309692671395, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1785119', 'n_tokens_mistral': 2794, 'n_tokens_neox': 2645, 'n_words': 800}