diff options
author | William Carroll <wpcarro@gmail.com> | 2018-09-10T18·51-0400 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2018-09-10T18·53-0400 |
commit | 17ee0e400bef47c371afcae76037f9ea6a44ad13 (patch) | |
tree | 0e5efee6f00e402890e91f3eceb4b29408a498b6 /configs/shared/emacs/.emacs.d/elpa/nix-mode-20180822.214/nix-drv-mode.el | |
parent | 8b2fadf4776b7ddb4a67b4bc8ff6463770e56028 (diff) |
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.
Diffstat (limited to 'configs/shared/emacs/.emacs.d/elpa/nix-mode-20180822.214/nix-drv-mode.el')
-rw-r--r-- | configs/shared/emacs/.emacs.d/elpa/nix-mode-20180822.214/nix-drv-mode.el | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180822.214/nix-drv-mode.el b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180822.214/nix-drv-mode.el new file mode 100644 index 000000000000..b9e184270f17 --- /dev/null +++ b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180822.214/nix-drv-mode.el @@ -0,0 +1,48 @@ +;;; nix-drv-mode.el --- Major mode for viewing .drv files + +;; Maintainer: Matthew Bauer <mjbauer95@gmail.com> +;; Homepage: https://github.com/NixOS/nix-mode +;; Version: 1.2.1 +;; Keywords: nix, languages, tools, unix +;; Package-Requires: ((emacs "24.3")) + +;; This file is NOT part of GNU Emacs. + +;;; Commentary: + +;; A major mode for viewing Nix derivations (.drv files). See the Nix +;; manual for more information available at +;; https://nixos.org/nix/manual/. + +;;; Code: + +(require 'json-mode) +(require 'nix) + +(defvar-local nix-drv-mode nil) + +;;;###autoload +(defun nix-drv-mode () + "Pretty print Nix’s .drv files." + (interactive) + (when (string-match (format "^%s/" nix-store-dir) (buffer-file-name)) + (if nix-drv-mode + (progn + (erase-buffer) + (insert-file-contents (buffer-file-name)) + (setq nix-drv-mode nil) + (set-buffer-modified-p nil) + (read-only-mode nil)) + (let ((inhibit-read-only t)) + (setq nix-drv-mode t) + (erase-buffer) + (insert (shell-command-to-string + (format "%s show-derivation \"%s\"" + nix-executable + (buffer-file-name)))) + (json-mode) + (set-buffer-modified-p nil) + (read-only-mode 1))))) + +(provide 'nix-drv-mode) +;;; nix-drv-mode.el ends here |