anchor.diff:  let
   
     cfg = config.services.emacs;
  +
  +  editorScript = pkgs.writeScriptBin "emacseditor" ''
  +    #!${pkgs.stdenv.shell}
  +    if [ -z "$1" ]; then
  +      exec ${cfg.package}/bin/emacsclient --create-frame --alternate-editor ${cfg.package}/bin/emacs
  +    else
  +      exec ${cfg.package}/bin/emacsclient --alternate-editor ${cfg.package}/bin/emacs "$@"
  +    fi
  +  '';
   
   in {
   
  
positive.code:       '';
      };
  
    };
  
    config = mkIf (cfg.enable || cfg.install) {
  
negative.code:       };
      } // optionalAttrs cfg.enable { wantedBy = [ "default.target" ]; };
  
      environment.systemPackages = [ cfg.package editorScript ];
  
      environment.variables = if cfg.defaultEditor then {
        EDITOR = mkOverride 900 "${editorScript}/bin/emacseditor";
      } else {};
    };
  }
  