summary refs log blame commit diff
path: root/pkgs/build-support/emacs/buffer.nix
blob: 5632eae944c0eb3ccd4eb5867c0a6ff443d158fd (plain) (tree)
1
2
3
4
5
6


                                                                    
                   

 















                                                                                                                  
 
# Functions to build elisp files to locally configure emcas buffers.
# See https://github.com/shlevy/nix-buffer

{ lib, writeText }:

{
  withPackages = pkgs: let
      coqs = builtins.filter (x: (builtins.parseDrvName x.name).name == "coq") pkgs;
      coq = builtins.head coqs;
      pg-setup = if builtins.length coqs == 0 then "" else ''
        (setq-local coq-prog-name "${coq}/bin/coqtop")
        (setq-local coq-dependency-analyzer "${coq}/bin/coqdep")
        (setq-local coq-compiler "${coq}/bin/coqc")
	(setq-local coq-library-directory (get-coq-library-directory))
	(coq-prog-args)
      '';
    in writeText "dir-locals.el" ''
      (make-local-variable 'process-environment)
      (setenv "PATH" (concat "${lib.makeSearchPath "bin" pkgs}:" (getenv "PATH")))
      (setq-local exec-path (append '(${builtins.concatStringsSep " " (map (p: "\"${p}/bin\"") pkgs)}) exec-path))
      ${pg-setup}
    '';
}