Klimi's new dotfiles with stow.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

48 rindas
1.3 KiB

pirms 5 gadiem
  1. ;;; nix-drv-mode.el --- Major mode for viewing .drv files
  2. ;; Maintainer: Matthew Bauer <mjbauer95@gmail.com>
  3. ;; Homepage: https://github.com/NixOS/nix-mode
  4. ;; Version: 1.2.1
  5. ;; Keywords: nix, languages, tools, unix
  6. ;; Package-Requires: ((emacs "24.3") (json-mode "1.6.0"))
  7. ;; This file is NOT part of GNU Emacs.
  8. ;;; Commentary:
  9. ;; A major mode for viewing Nix derivations (.drv files). See the Nix
  10. ;; manual for more information available at
  11. ;; https://nixos.org/nix/manual/.
  12. ;;; Code:
  13. (require 'json-mode)
  14. (require 'nix)
  15. (defvar-local nix-drv-mode nil)
  16. ;;;###autoload
  17. (defun nix-drv-mode ()
  18. "Pretty print Nix’s .drv files."
  19. (interactive)
  20. (when (string-match (format "^%s/" nix-store-dir) (buffer-file-name))
  21. (if nix-drv-mode
  22. (progn
  23. (erase-buffer)
  24. (insert-file-contents (buffer-file-name))
  25. (setq nix-drv-mode nil)
  26. (set-buffer-modified-p nil)
  27. (read-only-mode nil))
  28. (let ((inhibit-read-only t))
  29. (setq nix-drv-mode t)
  30. (erase-buffer)
  31. (insert (shell-command-to-string
  32. (format "%s show-derivation \"%s\""
  33. nix-executable
  34. (buffer-file-name))))
  35. (json-mode)
  36. (set-buffer-modified-p nil)
  37. (read-only-mode 1)))))
  38. (provide 'nix-drv-mode)
  39. ;;; nix-drv-mode.el ends here