From 17ee0e400bef47c371afcae76037f9ea6a44ad13 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Mon, 10 Sep 2018 14:51:14 -0400 Subject: Support Vim, Tmux, Emacs with Stow After moving off of Meta, Dotfiles has a greater responsibility to manage configs. Vim, Tmux, and Emacs are now within Stow's purview. --- .../elpa/nix-mode-20180822.214/nix-edit.el | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 configs/shared/emacs/.emacs.d/elpa/nix-mode-20180822.214/nix-edit.el (limited to 'configs/shared/emacs/.emacs.d/elpa/nix-mode-20180822.214/nix-edit.el') diff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180822.214/nix-edit.el b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180822.214/nix-edit.el new file mode 100644 index 000000000000..3e5c255f3404 --- /dev/null +++ b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180822.214/nix-edit.el @@ -0,0 +1,37 @@ +;;; nix-edit.el -- run nix commands in Emacs -*- lexical-binding: t -*- + +;; Author: Matthew Bauer +;; Homepage: https://github.com/NixOS/nix-mode +;; Keywords: nix + +;; This file is NOT part of GNU Emacs. + +;;; Commentary: + +;;; Code: + +(require 'nix) +(require 'nix-search) + +(defun nix-edit (&optional file attr) + "Open the nix log. +FILE the nix file to load from. +ATTR the attribute to find in nix expressions." + (interactive (list (nix-read-file) nil)) + (unless attr (setq attr (nix-read-attr file))) + + (let ((stdout (generate-new-buffer "nix-edit")) + (process-environment (cons "EDITOR=echo" process-environment)) + result) + (call-process nix-executable nil (list stdout nil) nil + "edit" "-f" file attr) + (with-current-buffer stdout + (when (eq (buffer-size) 0) + (error + "Error: nix edit failed to produce any output")) + (setq result (substring (buffer-string) 0 (- (buffer-size) 1)))) + (kill-buffer stdout) + (find-file result))) + +(provide 'nix-edit) +;;; nix-edit.el ends here -- cgit 1.4.1