anchor.diff:        cp $srcdir/TAGS $dstdir
         echo '((nil . ((tags-file-name . "TAGS"))))' > $dstdir/.dir-locals.el
       done
  -  '' + lib.optionalString stdenv.isDarwin ''
  +  '' + lib.optionalString withNS ''
       mkdir -p $out/Applications
       mv nextstep/Emacs.app $out/Applications
     '';
  
positive.code: , alsaLib, cairo, acl, gpm, AppKit, GSS, ImageIO, m17n_lib, libotf
  , systemd ? null
  , withX ? !stdenv.isDarwin
  , withGTK2 ? false, gtk2 ? null
  , withGTK3 ? true, gtk3 ? null, gsettings-desktop-schemas ? null
  , withXwidgets ? false, webkitgtk ? null, wrapGAppsHook ? null, glib-networking ? null
  , withCsrc ? true
  , srcRepo ? false, autoconf ? null, automake ? null, texinfo ? null
  
negative.code:     ++ lib.optionals stdenv.isLinux [ dbus libselinux systemd ]
      ++ lib.optionals withX
        [ xlibsWrapper libXaw Xaw3d libXpm libpng libjpeg libungif libtiff librsvg libXft
          imagemagick gconf ]
      ++ lib.optionals (stdenv.isLinux && withX) [ m17n_lib libotf ]
      ++ lib.optional (withX && withGTK2) gtk2-x11
      ++ lib.optionals (withX && withGTK3) [ gtk3-x11 gsettings-desktop-schemas ]
      ++ lib.optional (stdenv.isDarwin && withX) cairo
      ++ lib.optionals (withX && withXwidgets) [ webkitgtk ];
  
    propagatedBuildInputs = lib.optionals withNS [ AppKit GSS ImageIO ];
  
    hardeningDisable = [ "format" ];
  
    configureFlags = [ "--with-modules" ] ++
      (lib.optional stdenv.isDarwin
        (lib.withFeature withNS "ns")) ++
      (if withNS
        then [ "--disable-ns-self-contained" ]
      else if withX
        then [ "--with-x-toolkit=${toolkit}" "--with-xft" ]
        else [ "--with-x=no" "--with-xpm=no" "--with-jpeg=no" "--with-png=no"
  