diff options
Diffstat (limited to 'configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240')
30 files changed, 0 insertions, 2076 deletions
diff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-build.el b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-build.el deleted file mode 100644 index df85a676d699..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-build.el +++ /dev/null @@ -1,32 +0,0 @@ -;;; nix-build.el -- run nix commands in Emacs -*- lexical-binding: t -*- - -;; Author: Matthew Bauer <mjbauer95@gmail.com> -;; 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-build (&optional file attr) - "Run nix-build in a compilation buffer. -FILE the file to parse. -ATTR the attribute to build." - (interactive (list (nix-read-file) nil)) - (unless attr (setq attr (nix-read-attr file))) - - (setq compile-command (format "%s %s -A '%s'" nix-build-executable - file attr)) - (setq-default compilation-directory default-directory) - (compilation-start compile-command nil - (apply-partially (lambda (attr _) - (format "*nix-build*<%s>" attr)) - attr))) - -(provide 'nix-build) -;;; nix-build.el ends here diff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-build.elc b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-build.elc deleted file mode 100644 index 1f0ed82959c1..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-build.elc +++ /dev/null Binary files differdiff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-drv-mode.el b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-drv-mode.el deleted file mode 100644 index b9e184270f17..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-drv-mode.el +++ /dev/null @@ -1,48 +0,0 @@ -;;; 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 diff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-drv-mode.elc b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-drv-mode.elc deleted file mode 100644 index 43eab55d2955..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-drv-mode.elc +++ /dev/null Binary files differdiff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-edit.el b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-edit.el deleted file mode 100644 index 3e5c255f3404..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-edit.el +++ /dev/null @@ -1,37 +0,0 @@ -;;; nix-edit.el -- run nix commands in Emacs -*- lexical-binding: t -*- - -;; Author: Matthew Bauer <mjbauer95@gmail.com> -;; 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 diff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-edit.elc b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-edit.elc deleted file mode 100644 index 474ed1fe99f3..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-edit.elc +++ /dev/null Binary files differdiff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-format.el b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-format.el deleted file mode 100644 index e9a65a6a41c7..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-format.el +++ /dev/null @@ -1,35 +0,0 @@ -;;; nix-format.el --- Nix formatter -*- lexical-binding: t -*- - -;; This file is NOT part of GNU Emacs. - -;;; Commentary: - -;;; Code: - -(defcustom nix-nixfmt-bin "nixfmt" - "Path to nixfmt executable." - :group 'nix - :type 'string) - -(defun nix--format-call (buf) - "Format BUF using nixfmt." - (with-current-buffer (get-buffer-create "*nixfmt*") - (erase-buffer) - (insert-buffer-substring buf) - (if (zerop (call-process-region (point-min) (point-max) nix-nixfmt-bin t t nil)) - (progn - (if (not (string= (buffer-string) (with-current-buffer buf (buffer-string)))) - (copy-to-buffer buf (point-min) (point-max))) - (kill-buffer)) - (error "Nixfmt failed, see *nixfmt* buffer for details")))) - -(defun nix-format-buffer () - "Format the current buffer using nixfmt." - (interactive) - (unless (executable-find nix-nixfmt-bin) - (error "Could not locate executable \"%s\"" nix-nixfmt-bin)) - (nix--format-call (current-buffer)) - (message "Formatted buffer with nixfmt.")) - -(provide 'nix-format) -;;; nix-format.el ends here diff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-format.elc b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-format.elc deleted file mode 100644 index 8183f8f4b8db..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-format.elc +++ /dev/null Binary files differdiff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-instantiate.el b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-instantiate.el deleted file mode 100644 index 899ec9790b79..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-instantiate.el +++ /dev/null @@ -1,104 +0,0 @@ -;;; nix-instantiate.el -- run nix commands in Emacs -*- lexical-binding: t -*- - -;; Author: Matthew Bauer <mjbauer95@gmail.com> -;; Homepage: https://github.com/NixOS/nix-mode -;; Keywords: nix - -;; This file is NOT part of GNU Emacs. - -;;; Commentary: - -;;; Code: - -(require 'nix) -(require 'json) - -(defun nix-instantiate--parsed (drv) - "Get the parsed version of the .drv file. -DRV file to load from." - (let ((stdout (generate-new-buffer "nix show-derivation")) - result) - (call-process nix-executable nil (list stdout nil) nil - "show-derivation" drv) - (setq result - (cdar (with-current-buffer stdout - (when (eq (buffer-size) 0) - (error "Nix’s show-derivation %s failed to produce any output" - drv)) - (goto-char (point-min)) - (json-read)))) - (kill-buffer stdout) - result)) - -(defun nix-instantiate (nix-file &optional attribute parse) - "Run nix-instantiate on a Nix expression. -NIX-FILE the file to instantiate. -ATTRIBUTE an attribute of the Nix file to use. -PARSE whether to parse nix-instantiate output." - (interactive (list (read-file-name "Nix file: ") nil t)) - - (let ((stdout (generate-new-buffer "nix-instantiate")) - result) - (if attribute - (call-process nix-instantiate-executable nil (list stdout nil) nil - nix-file "-A" attribute) - (call-process nix-instantiate-executable nil (list stdout nil) nil - nix-file)) - (with-current-buffer stdout - (when (eq (buffer-size) 0) - (error - "Error: nix-instantiate %s failed to produce any output" - nix-file)) - (setq result (substring (buffer-string) 0 (- (buffer-size) 1))) - (when parse - (setq result (nix-instantiate--parsed result)))) - (kill-buffer stdout) - result)) - -(defvar nix-instantiate--running-processes nil) - -(defun nix-instantiate--sentinel (prop err proc event) - "Make a nix-instantiate process. -PROP the prop name of nix-instantiate--running-processes. -ERR the error buffer. -PROC the process that has been run. -EVENT the event that was fired." - (when (string= event "finished\n") - (with-current-buffer (process-buffer proc) - (unless (eq (buffer-size) 0) - (let ((drv (nix-instantiate--parsed - (substring (buffer-string) 0 (- (buffer-size) 1))))) - (dolist - (callback (lax-plist-get nix-instantiate--running-processes prop)) - (funcall callback drv))))) - (setq nix-instantiate--running-processes - (lax-plist-put nix-instantiate--running-processes prop nil))) - (unless (process-live-p proc) - (kill-buffer (process-buffer proc)) - (kill-buffer err))) - -(defun nix-instantiate-async (callback nix-file &optional attribute) - "Run nix-instantiate on a Nix expression, asynchronously. -CALLBACK the function to call when instantiate completes. -NIX-FILE the file to instantiate -ATTRIBUTE an attribute of the Nix file to use." - (setq nix-file (expand-file-name nix-file)) - (let* ((prop (if attribute - (expand-file-name attribute nix-file) nix-file)) - (data (lax-plist-get nix-instantiate--running-processes prop)) - (stdout (generate-new-buffer "nix-instantiate")) - (stderr (generate-new-buffer "nix-instantiate error"))) - (setq nix-instantiate--running-processes - (lax-plist-put nix-instantiate--running-processes - prop (cons callback data))) - (make-process - :name "nix-instantiate" - :buffer stdout - :command (append (list nix-instantiate-executable nix-file) - (when attribute (list "-A" attribute))) - :noquery t - :sentinel (apply-partially 'nix-instantiate--sentinel prop stderr) - :stderr stderr))) - -(provide 'nix-instantiate) -;;; nix-instantiate.el ends here diff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-instantiate.elc b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-instantiate.elc deleted file mode 100644 index ef8c7fd20dfe..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-instantiate.elc +++ /dev/null Binary files differdiff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-log.el b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-log.el deleted file mode 100644 index 192ab3170e87..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-log.el +++ /dev/null @@ -1,36 +0,0 @@ -;;; nix-log.el -- run nix commands in Emacs -*- lexical-binding: t -*- - -;; Author: Matthew Bauer <mjbauer95@gmail.com> -;; Homepage: https://github.com/NixOS/nix-mode -;; Keywords: nix - -;; This file is NOT part of GNU Emacs. - -;;; Commentary: - -;;; Code: - -(require 'nix) -(require 'nix-search) -(require 'nix-instantiate) - -(defun nix-log (file attr) - "Open the nix log. -FILE nix file to parse. -ATTR attribute to load the log of." - (interactive (list (nix-read-file) nil)) - (unless attr (setq attr (nix-read-attr file))) - - (let* ((drv-file (nix-instantiate file attr)) - (drv-name (progn - (string-match (format "^%s/\\(.*\\)$" nix-store-dir) drv-file) - (match-string 1 drv-file))) - (log-file (format "%s/log/nix/drvs/%s/%s.bz2" - nix-state-dir - (substring drv-name 0 2) drv-name))) - (if (file-exists-p log-file) - (find-file log-file) - (error "No log is available for derivation")))) - -(provide 'nix-log) -;;; nix-log.el ends here diff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-log.elc b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-log.elc deleted file mode 100644 index ca73de44c9c5..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-log.elc +++ /dev/null Binary files differdiff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-mode-autoloads.el b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-mode-autoloads.el deleted file mode 100644 index 3c0e2aa1a943..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-mode-autoloads.el +++ /dev/null @@ -1,195 +0,0 @@ -;;; nix-mode-autoloads.el --- automatically extracted autoloads -;; -;;; Code: -(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) - -;;;### (autoloads nil "nix" "nix.el" (23450 31820 380204 865000)) -;;; Generated autoloads from nix.el - -(autoload 'pcomplete/nix "nix" "\ -Completion for the nix command. - -\(fn)" nil nil) - -;;;*** - -;;;### (autoloads nil "nix-drv-mode" "nix-drv-mode.el" (23450 31820 -;;;;;; 368284 688000)) -;;; Generated autoloads from nix-drv-mode.el - -(autoload 'nix-drv-mode "nix-drv-mode" "\ -Pretty print Nix’s .drv files. - -\(fn)" t nil) - -;;;*** - -;;;### (autoloads nil "nix-mode" "nix-mode.el" (23450 31820 375199 -;;;;;; 485000)) -;;; Generated autoloads from nix-mode.el - -(autoload 'nix-mode-format "nix-mode" "\ -Format the entire nix-mode buffer - -\(fn)" t nil) - -(autoload 'nix-indent-line "nix-mode" "\ -Indent current line in a Nix expression. - -\(fn)" t nil) - -(autoload 'nix-mode "nix-mode" "\ -Major mode for editing Nix expressions. - -The following commands may be useful: - - '\\[newline-and-indent]' - Insert a newline and move the cursor to align with the previous - non-empty line. - - '\\[fill-paragraph]' - Refill a paragraph so that all lines are at most `fill-column' - lines long. This should do the right thing for comments beginning - with `#'. However, this command doesn't work properly yet if the - comment is adjacent to code (i.e., no intervening empty lines). - In that case, select the text to be refilled and use - `\\[fill-region]' instead. - -The hook `nix-mode-hook' is run when Nix mode is started. - -\\{nix-mode-map} - -\(fn)" t nil) - -;;;*** - -;;;### (autoloads nil "nix-prettify-mode" "nix-prettify-mode.el" -;;;;;; (23450 31820 373468 244000)) -;;; Generated autoloads from nix-prettify-mode.el - -(autoload 'nix-prettify-mode "nix-prettify-mode" "\ -Toggle Nix Prettify mode. - -With a prefix argument ARG, enable Nix Prettify mode if ARG is -positive, and disable it otherwise. If called from Lisp, enable -the mode if ARG is omitted or nil. - -When Nix Prettify mode is enabled, hash-parts of the Nix store -file names (see `nix-prettify-regexp') are prettified, -i.e. displayed as `nix-prettify-char' character. This mode can -be enabled programmatically using hooks: - - (add-hook 'shell-mode-hook 'nix-prettify-mode) - -It is possible to enable the mode in any buffer, however not any -buffer's highlighting may survive after adding new elements to -`font-lock-keywords' (see `nix-prettify-special-modes' for -details). - -Also you can use `global-nix-prettify-mode' to enable Nix -Prettify mode for all modes that support font-locking. - -\(fn &optional ARG)" t nil) - -(defvar nix-prettify-global-mode nil "\ -Non-nil if Nix-Prettify-Global mode is enabled. -See the `nix-prettify-global-mode' command -for a description of this minor mode. -Setting this variable directly does not take effect; -either customize it (see the info node `Easy Customization') -or call the function `nix-prettify-global-mode'.") - -(custom-autoload 'nix-prettify-global-mode "nix-prettify-mode" nil) - -(autoload 'nix-prettify-global-mode "nix-prettify-mode" "\ -Toggle Nix-Prettify mode in all buffers. -With prefix ARG, enable Nix-Prettify-Global mode if ARG is positive; -otherwise, disable it. If called from Lisp, enable the mode if -ARG is omitted or nil. - -Nix-Prettify mode is enabled in all buffers where -`nix-prettify-turn-on' would do it. -See `nix-prettify-mode' for more information on Nix-Prettify mode. - -\(fn &optional ARG)" t nil) - -(define-obsolete-function-alias 'global-nix-prettify-mode 'nix-prettify-global-mode) - -;;;*** - -;;;### (autoloads nil "nix-repl" "nix-repl.el" (23450 31820 376723 -;;;;;; 937000)) -;;; Generated autoloads from nix-repl.el - -(autoload 'nix-repl "nix-repl" "\ -Load the Nix-REPL. - -\(fn)" t nil) - -;;;*** - -;;;### (autoloads nil "nix-search" "nix-search.el" (23450 31820 365888 -;;;;;; 565000)) -;;; Generated autoloads from nix-search.el - -(autoload 'nix-search "nix-search" "\ -Run nix search. -SEARCH a search term to use. -FILE a Nix expression to search in. - -\(fn &optional SEARCH FILE)" t nil) - -;;;*** - -;;;### (autoloads nil "nix-shell" "nix-shell.el" (23450 31820 385703 -;;;;;; 48000)) -;;; Generated autoloads from nix-shell.el - -(autoload 'nix-shell-unpack "nix-shell" "\ -Run Nix’s unpackPhase. -FILE is the file to unpack from. -ATTR is the attribute to unpack. - -\(fn FILE ATTR)" t nil) - -(autoload 'nix-shell-configure "nix-shell" "\ -Run Nix’s configurePhase. -FILE is the file to configure from. -ATTR is the attribute to configure. - -\(fn FILE ATTR)" t nil) - -(autoload 'nix-shell-build "nix-shell" "\ -Run Nix’s buildPhase. -FILE is the file to build from. -ATTR is the attribute to build. - -\(fn FILE ATTR)" t nil) - -(autoload 'nix-shell-with-string "nix-shell" "\ -A nix-shell emulator in Emacs from a string. -STRING the nix expression to use. - -\(fn STRING)" nil nil) - -(autoload 'nix-shell "nix-shell" "\ -A nix-shell emulator in Emacs. -FILE the file to instantiate. -ATTR an attribute of the Nix file to use. - -\(fn FILE &optional ATTR)" t nil) - -;;;*** - -;;;### (autoloads nil nil ("nix-build.el" "nix-edit.el" "nix-format.el" -;;;;;; "nix-instantiate.el" "nix-log.el" "nix-mode-pkg.el" "nix-shebang.el" -;;;;;; "nix-store.el") (23450 31820 389478 574000)) - -;;;*** - -;; Local Variables: -;; version-control: never -;; no-byte-compile: t -;; no-update-autoloads: t -;; End: -;;; nix-mode-autoloads.el ends here diff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-mode-pkg.el b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-mode-pkg.el deleted file mode 100644 index b39dd987ca70..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-mode-pkg.el +++ /dev/null @@ -1,10 +0,0 @@ -(define-package "nix-mode" "20180908.2240" "Major mode for editing .nix files" - '((emacs "24.3")) - :keywords - '("nix" "languages" "tools" "unix") - :maintainer - '("Matthew Bauer" . "mjbauer95@gmail.com") - :url "https://github.com/NixOS/nix-mode") -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-mode.el b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-mode.el deleted file mode 100644 index 759c85f6785a..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-mode.el +++ /dev/null @@ -1,590 +0,0 @@ -;;; nix-mode.el --- Major mode for editing .nix files -*- lexical-binding: t -*- - -;; 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 editing Nix expressions (.nix files). See the Nix manual -;; for more information available at https://nixos.org/nix/manual/. - -;;; Code: - -(require 'nix) -(require 'nix-format) -(require 'nix-shebang) -(require 'nix-shell) -(require 'nix-repl) - -(defgroup nix-mode nil - "Nix mode customizations" - :group 'nix) - -(defcustom nix-indent-function 'indent-relative - "The function to use to indent. - -Valid functions for this are: - -- ‘indent-relative’ -- nix-indent-line (buggy)" - :group 'nix-mode - :type 'function) - -(defcustom nix-mode-caps - '(" =[ \n]" "\(" "\{" "\\[" "\\bwith\\b" "\\blet\\b" "\\binherit\\b") - "Regular expressions to consider expression caps." - :group 'nix-mode - :type '(repeat string)) - -(defcustom nix-mode-ends - '(";" "\)" "\\]" "\}" "\\bin\\b") - "Regular expressions to consider expression ends." - :group 'nix-mode - :type '(repeat string)) - -(defcustom nix-mode-quotes - '("''" "\"") - "Regular expressions to consider expression quotes." - :group 'nix-mode - :type '(repeat string)) - -(defgroup nix-faces nil - "Nix faces." - :group 'nix-mode - :group 'faces) - -(defface nix-keyword-face - '((t :inherit font-lock-keyword-face)) - "Face used to highlight Nix keywords." - :group 'nix-faces) - -(defface nix-keyword-warning-face - '((t :inherit font-lock-warning-face)) - "Face used to highlight Nix warning keywords." - :group 'nix-faces) - -(defface nix-builtin-face - '((t :inherit font-lock-builtin-face)) - "Face used to highlight Nix builtins." - :group 'nix-faces) - -(defface nix-constant-face - '((t :inherit font-lock-constant-face)) - "Face used to highlight Nix constants." - :group 'nix-faces) - -(defface nix-attribute-face - '((t :inherit font-lock-variable-name-face)) - "Face used to highlight Nix attributes." - :group 'nix-faces) - -(defface nix-antiquote-face - '((t :inherit font-lock-preprocessor-face)) - "Face used to highlight Nix antiquotes." - :group 'nix-faces) - -(defvar nix-system-types - '("x86_64-linux" "i686-linux" "aarch64-linux" "x86_64-darwin") - "List of supported systems.") - -;;; Syntax coloring - -(defconst nix-keywords - '("if" "then" - "else" "with" - "let" "in" - "rec" "inherit" - "or")) - -(defconst nix-builtins - '("builtins" "baseNameOf" - "derivation" "dirOf" - "true" "false" "null" - "isNull" "toString" - "fetchTarball" "import" - "map" "removeAttrs")) - -(defconst nix-warning-keywords - '("assert" "abort" "throw")) - -(defconst nix-re-file-path - "[a-zA-Z0-9._\\+-]*\\(/[a-zA-Z0-9._\\+-]+\\)+") - -(defconst nix-re-url - "[a-zA-Z][a-zA-Z0-9\\+-\\.]*:[a-zA-Z0-9%/\\?:@&=\\+\\$,_\\.!~\\*'-]+") - -(defconst nix-re-bracket-path - "<[a-zA-Z0-9._\\+-]+\\(/[a-zA-Z0-9._\\+-]+\\)*>") - -(defconst nix-re-variable-assign - "\\<\\([a-zA-Z_][a-zA-Z0-9_'\-\.]*\\)[ \t]*=[^=]") - -(defconst nix-font-lock-keywords - `( - (,(regexp-opt nix-keywords 'symbols) 0 'nix-keyword-face) - (,(regexp-opt nix-warning-keywords 'symbols) 0 'nix-keyword-warning-face) - (,(regexp-opt nix-builtins 'symbols) 0 'nix-builtin-face) - (,nix-re-url 0 'nix-constant-face) - (,nix-re-file-path 0 'nix-constant-face) - (,nix-re-variable-assign 1 'nix-attribute-face) - (,nix-re-bracket-path 0 'nix-constant-face) - (nix--syntax-match-antiquote 0 'nix-antiquote-face t) - ) - "Font lock keywords for nix.") - -(defconst nix--variable-char "[a-zA-Z0-9_'\-]") - -(defvar nix-mode-abbrev-table - (make-abbrev-table) - "Abbrev table for Nix mode.") - -(makunbound 'nix-mode-syntax-table) - -(defvar nix-mode-syntax-table - (let ((table (make-syntax-table))) - (modify-syntax-entry ?/ ". 14" table) - (modify-syntax-entry ?* ". 23" table) - (modify-syntax-entry ?# "< b" table) - (modify-syntax-entry ?\n "> b" table) - ;; We handle strings - (modify-syntax-entry ?\" "." table) - ;; We handle escapes - (modify-syntax-entry ?\\ "." table) - table) - "Syntax table for Nix mode.") - -(defun nix--syntax-match-antiquote (limit) - "Find antiquote within a Nix expression up to LIMIT." - (unless (> (point) limit) - (if (get-text-property (point) 'nix-syntax-antiquote) - (progn - (set-match-data (list (point) (1+ (point)))) - (forward-char 1) - t) - (let ((pos (next-single-char-property-change (point) 'nix-syntax-antiquote - nil limit))) - (when (and pos (not (> pos limit))) - (goto-char pos) - (let ((char (char-after pos))) - (pcase char - (`?{ - (forward-char 1) - (set-match-data (list (1- pos) (point))) - t) - (`?} - (forward-char 1) - (set-match-data (list pos (point))) - t)))))))) - -(defun nix--mark-string (pos string-type) - "Mark string as a Nix string. - -POS position of start of string -STRING-TYPE type of string based off of Emacs syntax table types" - (put-text-property pos (1+ pos) - 'syntax-table (string-to-syntax "|")) - (put-text-property pos (1+ pos) - 'nix-string-type string-type)) - -(defun nix--get-parse-state (pos) - "Get the result of `syntax-ppss' at POS." - (save-excursion (save-match-data (syntax-ppss pos)))) - -(defun nix--get-string-type (parse-state) - "Get the type of string based on PARSE-STATE." - (let ((string-start (nth 8 parse-state))) - (and string-start (get-text-property string-start 'nix-string-type)))) - -(defun nix--open-brace-string-type (parse-state) - "Determine if this is an open brace string type based on PARSE-STATE." - (let ((open-brace (nth 1 parse-state))) - (and open-brace (get-text-property open-brace 'nix-string-type)))) - -(defun nix--open-brace-antiquote-p (parse-state) - "Determine if this is an open brace antiquote based on PARSE-STATE." - (let ((open-brace (nth 1 parse-state))) - (and open-brace (get-text-property open-brace 'nix-syntax-antiquote)))) - -(defun nix--single-quotes () - "Handle Nix single quotes." - (let* ((start (match-beginning 0)) - (end (match-end 0)) - (context (nix--get-parse-state start)) - (string-type (nix--get-string-type context))) - (unless (or (equal string-type ?\") - (and (equal string-type nil) - (< 1 start) - (string-match-p nix--variable-char - (buffer-substring (1- start) start)))) - (when (equal string-type nil) - (nix--mark-string start ?\') - (setq start (+ 2 start))) - (when (equal (mod (- end start) 3) 2) - (let ((str-peek (buffer-substring end (min (point-max) (+ 2 end))))) - (if (member str-peek '("${" "\\n" "\\r" "\\t")) - (goto-char (+ 2 end)) - (nix--mark-string (1- end) ?\'))))))) - -(defun nix--escaped-antiquote-dq-style () - "Handle Nix escaped antiquote dq style." - (let* ((start (match-beginning 0)) - (ps (nix--get-parse-state start)) - (string-type (nix--get-string-type ps))) - (when (equal string-type ?\') - (nix--antiquote-open-at (1+ start) ?\')))) - -(defun nix--double-quotes () - "Handle Nix double quotes." - (let* ((pos (match-beginning 0)) - (ps (nix--get-parse-state pos)) - (string-type (nix--get-string-type ps))) - (unless (equal string-type ?\') - (nix--mark-string pos ?\")))) - -(defun nix--antiquote-open-at (pos string-type) - "Handle Nix antiquote open at based on POS and STRING-TYPE." - (put-text-property pos (1+ pos) - 'syntax-table (string-to-syntax "|")) - (put-text-property pos (+ 2 pos) - 'nix-string-type string-type) - (put-text-property (1+ pos) (+ 2 pos) - 'nix-syntax-antiquote t)) - -(defun nix--antiquote-open () - "Handle Nix antiquote open." - (let* ((start (match-beginning 0)) - (ps (nix--get-parse-state start)) - (string-type (nix--get-string-type ps))) - (when string-type - (nix--antiquote-open-at start string-type)))) - -(defun nix--antiquote-close-open () - "Handle Nix antiquote close then open." - (let* ((start (match-beginning 0)) - (ps (nix--get-parse-state start)) - (string-type (nix--get-string-type ps))) - (if string-type - (nix--antiquote-open-at (1+ start) string-type) - (when (nix--open-brace-antiquote-p ps) - (let ((string-type (nix--open-brace-string-type ps))) - (put-text-property start (+ 3 start) - 'nix-string-type string-type) - (put-text-property start (1+ start) - 'nix-syntax-antiquote t) - (put-text-property (+ 2 start) (+ 3 start) - 'nix-syntax-antiquote t)))))) - -(defun nix--antiquote-close () - "Handle Nix antiquote close." - (let* ((start (match-beginning 0)) - (ps (nix--get-parse-state start))) - (unless (nix--get-string-type ps) - (let ((string-type (nix--open-brace-string-type ps))) - (when string-type - (put-text-property start (1+ start) - 'nix-string-type string-type) - (put-text-property start (1+ start) - 'nix-syntax-antiquote t) - (let ((ahead (buffer-substring (1+ start) (min (point-max) (+ 5 start))))) - (pcase string-type - (`?\" (cond - ((or (string-match "^\\\\\"" ahead) - (string-match "^\\\\\\${" ahead)) - (nix--mark-string (1+ start) string-type) - (goto-char (+ start (match-end 0) 1))) - ((string-match-p "^\"" ahead) - (goto-char (+ 2 start))) - ((< (1+ start) (point-max)) - (nix--mark-string (1+ start) string-type) - (goto-char (+ 2 start))))) - (`?\' (cond - ((or (string-match "^'''" ahead) - (string-match "^''\\${" ahead) - (string-match "^''\\\\[nrt]" ahead)) - (nix--mark-string (1+ start) string-type) - (goto-char (+ start (match-end 0) 1))) - ((string-match-p "^''" ahead) - (goto-char (+ 3 start))) - ((< (1+ start) (point-max)) - (nix--mark-string (1+ start) string-type) - (goto-char (+ 2 start)))))))))))) - -(defun nix-syntax-propertize (start end) - "Special syntax properties for Nix from START to END." - (goto-char start) - (remove-text-properties start end - '(syntax-table nil nix-string-type nil nix-syntax-antiquote nil)) - (funcall - (syntax-propertize-rules - ("\\\\\\\\" - (0 nil)) - ("\\\\\"" - (0 nil)) - ("\\\\\\${" - (0 (ignore (nix--escaped-antiquote-dq-style)))) - ("'\\{2,\\}" - (0 (ignore (nix--single-quotes)))) - ("}\\${" - (0 (ignore (nix--antiquote-close-open)))) - ("\\${" - (0 (ignore (nix--antiquote-open)))) - ("}" - (0 (ignore (nix--antiquote-close)))) - ("\"" - (0 (ignore (nix--double-quotes))))) - start end)) - -;;; Indentation - -(defun nix--inside-string-or-comment () - (or (nix--get-string-type (nix--get-parse-state (point))) - (nth 4 (syntax-ppss)))) - -(defun nix-find-backward-matching-token () - (cond - ((looking-at "in\\b") - (let ((counter 1)) - (while (and (> counter 0) (re-search-backward "\\b\\(let\\|in\\)\\b" nil t)) - (unless (nix--inside-string-or-comment) - (setq counter (cond ((looking-at "let") (- counter 1)) - ((looking-at "in") (+ counter 1)))) - ) - ) - counter )) - ((looking-at "}") - (backward-up-list) t) - ((looking-at "]") - (backward-up-list) t) - ((looking-at ")") - (backward-up-list) t) - )) - -(defun nix-indent-to-backward-match () - (let ((matching-indentation (save-excursion - (beginning-of-line) - (skip-chars-forward "[:space:]") - (if (nix-find-backward-matching-token) - (current-indentation))))) - (when matching-indentation (indent-line-to matching-indentation) t)) - ) - -(defun nix-mode-make-regexp (parts) - "Combine the regexps into a single or-delimited regexp." - (declare (indent defun)) - (string-join parts "\\|")) - -(defun nix-mode-caps-regexp () - "Return regexp for matching expression caps." - (nix-mode-make-regexp nix-mode-caps)) - -(defun nix-mode-ends-regexp () - "Return regexp for matching expression ends." - (nix-mode-make-regexp nix-mode-ends)) - -(defun nix-mode-quotes-regexp () - "Return regexp for matching string quotes." - (nix-mode-make-regexp nix-mode-quotes)) - -(defun nix-mode-combined-regexp () - "Return combined regexp for matching items of interest." - (nix-mode-make-regexp (append nix-mode-caps - nix-mode-ends - nix-mode-quotes))) - -(defun nix-mode-search-backward () - "Search backward for items of interest regarding indentation." - (re-search-backward (nix-mode-combined-regexp) nil t)) - -(defun nix-indent-expression-start () - (let* ((ends 0) - (once nil) - (done nil) - (indent (current-indentation))) - (save-excursion - ;; we want to indent this line, so we don't care what it contains - ;; skip to the beginning so reverse searching doesn't find any matches within - (beginning-of-line) - ;; search backward until an unbalanced cap is found or no cap or end is found - (while (and (not done) (nix-mode-search-backward)) - (cond - ((looking-at (nix-mode-quotes-regexp)) - ;; skip over strings entirely - (re-search-backward (nix-mode-quotes-regexp) nil t)) - ((looking-at (nix-mode-ends-regexp)) - ;; count the matched end - ;; this means we expect to find at least one more cap - (setq ends (+ ends 1))) - ((looking-at (nix-mode-caps-regexp)) - ;; we found at least one cap - ;; this means our function will return true - ;; this signals to the caller we handled the indentation - (setq once t) - (if (> ends 0) - ;; this cap corresponds to a previously matched end - ;; reduce the number of unbalanced ends - (setq ends (- ends 1)) - ;; no unbalanced ends correspond to this cap - ;; this means we have found the expression that contains our line - ;; we want to indent relative to this line - (setq indent (current-indentation)) - ;; signal that the search loop should exit - (setq done t)))))) - ;; done is t when we found an unbalanced expression cap - (when done - ;; indent relative to the indentation of the expression containing our line - (indent-line-to (+ tab-width indent))) - ;; return t to the caller if we found at least one cap - ;; this signals that we handled the indentation - once)) - -(defun nix-indent-prev-level () - "Get the indent level of the previous line." - (save-excursion - (beginning-of-line) - (skip-chars-backward "\n[:space:]") - (current-indentation))) - -;;;###autoload -(defun nix-mode-format () - "Format the entire nix-mode buffer" - (interactive) - (when (eq major-mode 'nix-mode) - (save-excursion - (beginning-of-buffer) - (while (not (equal (point) (point-max))) - (if (equal (string-match-p "^[\s-]*$" (thing-at-point 'line)) 0) - (delete-horizontal-space) - (nix-indent-line)) - (next-line))))) - -;;;###autoload -(defun nix-indent-line () - "Indent current line in a Nix expression." - (interactive) - (let ((end-of-indentation (save-excursion - (cond - - ;; comment - ((save-excursion - (beginning-of-line) - (nth 4 (syntax-ppss))) - (indent-line-to (nix-indent-prev-level))) - - ;; string - ((save-excursion - (beginning-of-line) - (nth 3 (syntax-ppss))) - (indent-line-to (+ (nix-indent-prev-level) - (* tab-width (+ (if (save-excursion - (forward-line -1) - (end-of-line) - (skip-chars-backward "[:space:]") - (looking-back "''" 0)) 1 0) - (if (save-excursion - (beginning-of-line) - (skip-chars-forward - "[:space:]") - (looking-at "''") - ) -1 0) - ))))) - - ;; dedent '}', ']', ')' 'in' - ((nix-indent-to-backward-match)) - - ;; indent between = and ; + 2, or to 2 - ((nix-indent-expression-start)) - - ;; else - (t - (indent-line-to (nix-indent-prev-level))) - ) - (point)))) - (when (> end-of-indentation (point)) (goto-char end-of-indentation))) - ) - -;; Key maps - -(defvar nix-mode-menu (make-sparse-keymap "Nix") - "Menu for Nix mode.") - -(defvar nix-mode-map (make-sparse-keymap) - "Local keymap used for Nix mode.") - -(defun nix-create-keymap () - "Create the keymap associated with the Nix mode." - ) - -(defun nix-create-menu () - "Create the Nix menu as shown in the menu bar." - (let ((m '("Nix" - ["Format buffer" nix-format-buffer t]) - )) - (easy-menu-define ada-mode-menu nix-mode-map "Menu keymap for Nix mode" m))) - -(nix-create-keymap) -(nix-create-menu) - -;;;###autoload -(define-derived-mode nix-mode prog-mode "Nix" - "Major mode for editing Nix expressions. - -The following commands may be useful: - - '\\[newline-and-indent]' - Insert a newline and move the cursor to align with the previous - non-empty line. - - '\\[fill-paragraph]' - Refill a paragraph so that all lines are at most `fill-column' - lines long. This should do the right thing for comments beginning - with `#'. However, this command doesn't work properly yet if the - comment is adjacent to code (i.e., no intervening empty lines). - In that case, select the text to be refilled and use - `\\[fill-region]' instead. - -The hook `nix-mode-hook' is run when Nix mode is started. - -\\{nix-mode-map} -" - :group 'nix-mode - :syntax-table nix-mode-syntax-table - :abbrev-table nix-mode-abbrev-table - - ;; Disable hard tabs and set tab to 2 spaces - ;; Recommended by nixpkgs manual: https://nixos.org/nixpkgs/manual/#sec-syntax - (setq-local indent-tabs-mode nil) - (setq-local tab-width 2) - (setq-local electric-indent-chars '(?\n ?{ ?} ?\[ ?\] ?\( ?\))) - - ;; Font lock support. - (setq-local font-lock-defaults '(nix-font-lock-keywords)) - - ;; Special syntax properties for Nix - (setq-local syntax-propertize-function 'nix-syntax-propertize) - - ;; Look at text properties when parsing - (setq-local parse-sexp-lookup-properties t) - - ;; Automatic indentation [C-j] - (setq-local indent-line-function nix-indent-function) - - ;; Indenting of comments - (setq-local comment-start "# ") - (setq-local comment-end "") - (setq-local comment-start-skip "\\(^\\|\\s-\\);?#+ *") - (setq-local comment-multi-line t) - - ;; Filling of comments - (setq-local adaptive-fill-mode t) - (setq-local paragraph-start "[ \t]*\\(#+[ \t]*\\)?$") - (setq-local paragraph-separate paragraph-start) - - (easy-menu-add nix-mode-menu nix-mode-map)) - -(provide 'nix-mode) -;;; nix-mode.el ends here diff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-mode.elc b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-mode.elc deleted file mode 100644 index d7b3444b6e28..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-mode.elc +++ /dev/null Binary files differdiff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-prettify-mode.el b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-prettify-mode.el deleted file mode 100644 index 99fa9e270c99..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-prettify-mode.el +++ /dev/null @@ -1,202 +0,0 @@ -;;; nix-prettify.el -- Prettify Nix store file names -*- lexical-binding: t -*- - -;; Copyright © 2014, 2015 Alex Kost <alezost@gmail.com> -;; Modified by Matthew Bauer for use in nix-mode - -;; Author: Alex Kost -;; Maintainer: Matthew Bauer <mjbauer95@gmail.com> -;; Homepage: https://github.com/NixOS/nix-mode -;; Version: 1.1 -;; Keywords: nix - -;; This file is NOT part of GNU Emacs. - -;;; Commentary: - -;; This package provides minor-mode for prettifying Nix store file -;; names — i.e., after enabling `nix-prettify-mode', -;; '/gnu/store/72f54nfp6g1hz873w8z3gfcah0h4nl9p-foo-0.1' names will be -;; replaced with '/gnu/store/…-foo-0.1' in the current buffer. There is -;; also `global-nix-prettify-mode' for global prettifying. - -;; To install, add the following to your Emacs init file: -;; -;; (add-to-list 'load-path "/path/to/dir-with-nix-prettify") -;; (autoload 'nix-prettify-mode "nix-prettify" nil t) -;; (autoload 'global-nix-prettify-mode "nix-prettify" nil t) - -;; If you want to enable/disable composition after "M-x font-lock-mode", -;; use the following setting: -;; -;; (setq font-lock-extra-managed-props -;; (cons 'composition font-lock-extra-managed-props)) - -;; Credits: -;; -;; Thanks to Ludovic Courtès for the idea of this package. -;; -;; Thanks to the authors of `prettify-symbols-mode' (part of Emacs 24.4) -;; and "pretty-symbols.el" <http://github.com/drothlis/pretty-symbols> -;; for the code. It helped to write this package. - -;;; Code: - -(defgroup nix-prettify nil - "Prettify Nix store file names." - :prefix "nix-prettify-" - :group 'nix - :group 'font-lock - :group 'convenience) - -(defcustom nix-prettify-char ?… - "Character used for prettifying." - :type 'character - :group 'nix-prettify) - -(defcustom nix-prettify-decompose-force nil - "If non-nil, remove any composition. - -By default, after disabling `nix-prettify-mode', -compositions (prettifying names with `nix-prettify-char') are -removed only from strings matching `nix-prettify-regexp', so -that compositions created by other modes are left untouched. - -Set this variable to non-nil, if you want to remove any -composition unconditionally (like variable `prettify-symbols-mode' does). -Most likely it will do no harm and will make the process of -disabling `nix-prettify-mode' a little faster." - :type 'boolean - :group 'nix-prettify) - -(defcustom nix-prettify-regexp - ;; The following file names / URLs should be abbreviated: - - ;; /gnu/store/…-foo-0.1 - ;; /nix/store/…-foo-0.1 - ;; http://hydra.gnu.org/nar/…-foo-0.1 - ;; http://hydra.gnu.org/log/…-foo-0.1 - - (rx "/" (or "store" "nar" "log") "/" - ;; Hash-parts do not include "e", "o", "u" and "t". See base32Chars - ;; at <https://github.com/NixOS/nix/blob/master/src/libutil/hash.cc> - (group (= 32 (any "0-9" "a-d" "f-n" "p-s" "v-z")))) - "Regexp matching file names for prettifying. - -Disable `nix-prettify-mode' before modifying this variable and -make sure to modify `nix-prettify-regexp-group' if needed. - -Example of a \"deeper\" prettifying: - - (setq nix-prettify-regexp \"store/[[:alnum:]]\\\\\\={32\\\\}\" - nix-prettify-regexp-group 0) - -This will transform -'/gnu/store/72f54nfp6g1hz873w8z3gfcah0h4nl9p-foo-0.1' into -'/gnu/…-foo-0.1'" - :type 'regexp - :group 'nix-prettify) - -(defcustom nix-prettify-regexp-group 1 - "Regexp group in `nix-prettify-regexp' for prettifying." - :type 'integer - :group 'nix-prettify) - -(defvar nix-prettify-special-modes - '(nix-info-mode ibuffer-mode) - "List of special modes that support font-locking. - -By default, \\[global-nix-prettify-mode] enables prettifying in -all buffers except the ones where `font-lock-defaults' is -nil (see Info node `(elisp) Font Lock Basics'), because it may -break the existing highlighting. - -Modes from this list and all derived modes are exceptions -\(`global-nix-prettify-mode' enables prettifying there).") - -(defvar nix-prettify-flush-function - (cond ((fboundp 'font-lock-flush) #'font-lock-flush) - ((fboundp 'jit-lock-refontify) #'jit-lock-refontify)) - "Function used to refontify buffer. -This function is called without arguments after -enabling/disabling `nix-prettify-mode'. If nil, do nothing.") - -(defun nix-prettify-compose () - "Compose matching region in the current buffer." - (let ((beg (match-beginning nix-prettify-regexp-group)) - (end (match-end nix-prettify-regexp-group))) - (compose-region beg end nix-prettify-char 'decompose-region)) - ;; Return nil because we're not adding any face property. - nil) - -(defun nix-prettify-decompose-buffer () - "Remove file names compositions from the current buffer." - (with-silent-modifications - (let ((inhibit-read-only t)) - (if nix-prettify-decompose-force - (remove-text-properties (point-min) - (point-max) - '(composition nil)) - (nix-while-search nix-prettify-regexp - (remove-text-properties - (match-beginning nix-prettify-regexp-group) - (match-end nix-prettify-regexp-group) - '(composition nil))))))) - -;;;###autoload -(define-minor-mode nix-prettify-mode - "Toggle Nix Prettify mode. - -With a prefix argument ARG, enable Nix Prettify mode if ARG is -positive, and disable it otherwise. If called from Lisp, enable -the mode if ARG is omitted or nil. - -When Nix Prettify mode is enabled, hash-parts of the Nix store -file names (see `nix-prettify-regexp') are prettified, -i.e. displayed as `nix-prettify-char' character. This mode can -be enabled programmatically using hooks: - - (add-hook 'shell-mode-hook 'nix-prettify-mode) - -It is possible to enable the mode in any buffer, however not any -buffer's highlighting may survive after adding new elements to -`font-lock-keywords' (see `nix-prettify-special-modes' for -details). - -Also you can use `global-nix-prettify-mode' to enable Nix -Prettify mode for all modes that support font-locking." - :init-value nil - :lighter " …" - (let ((keywords `((,nix-prettify-regexp - (,nix-prettify-regexp-group - (nix-prettify-compose)))))) - (if nix-prettify-mode - ;; Turn on. - (font-lock-add-keywords nil keywords) - ;; Turn off. - (font-lock-remove-keywords nil keywords) - (nix-prettify-decompose-buffer)) - (and nix-prettify-flush-function - (funcall nix-prettify-flush-function)))) - -(defun nix-prettify-supported-p () - "Return non-nil, if the mode can be harmlessly enabled in current buffer." - (or font-lock-defaults - (apply #'derived-mode-p nix-prettify-special-modes))) - -(defun nix-prettify-turn-on () - "Enable `nix-prettify-mode' in the current buffer if needed. -See `nix-prettify-special-modes' for details." - (and (not nix-prettify-mode) - (nix-prettify-supported-p) - (nix-prettify-mode))) - -;;;###autoload -(define-globalized-minor-mode nix-prettify-global-mode - nix-prettify-mode nix-prettify-turn-on) - -;;;###autoload -(define-obsolete-function-alias 'global-nix-prettify-mode 'nix-prettify-global-mode) - -(provide 'nix-prettify-mode) - -;;; nix-prettify-mode.el ends here diff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-prettify-mode.elc b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-prettify-mode.elc deleted file mode 100644 index 984617c7da3b..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-prettify-mode.elc +++ /dev/null Binary files differdiff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-repl.el b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-repl.el deleted file mode 100644 index 79eeb78d03d7..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-repl.el +++ /dev/null @@ -1,112 +0,0 @@ -;;; nix-repl.el --- Nix repl -*- lexical-binding: t -*- - -;; This file is NOT part of GNU Emacs. - -;;; Commentary: - -;;; Code: - -(defvar nix-prompt-regexp "nix-repl> ") - -(require 'comint) -(require 'nix) - -(defgroup nix-repl nil - "nix-repl customizations" - :group 'nix) - -(defcustom nix-repl-executable-args '("repl") - "Arguments to provide to nix-repl." - :type 'list) - -(define-derived-mode nix-repl-mode comint-mode "Nix-REPL" - "Interactive prompt for Nix." - (setq-local comint-prompt-regexp nix-prompt-regexp) - (setq-local comint-prompt-read-only t)) - -(defmacro nix--with-temp-process-filter (proc &rest body) - "Use temp process PROC filter on BODY." - (declare (indent defun)) - `(let* ((buf (generate-new-buffer " *temp-process-output*")) - (proc-filter-saved (process-filter ,proc)) - (proc-marker (with-current-buffer buf (point-marker)))) - (set-process-filter ,proc (nix--process-filter buf proc-marker)) - (unwind-protect - (with-current-buffer buf - ,@body) - (set-process-filter ,proc proc-filter-saved) - (kill-buffer buf)))) - -;;;###autoload -(defun nix-repl () - "Load the Nix-REPL." - (interactive) - (pop-to-buffer-same-window - (get-buffer-create "*Nix-REPL*")) - (unless (comint-check-proc (current-buffer)) - (nix--make-repl-in-buffer (current-buffer)) - (nix-repl-mode))) - -(defalias 'nix-repl-show 'nix-repl) - -(defun nix--make-repl-in-buffer (buffer) - "Make Nix Repl in BUFFER." - (apply - 'make-comint-in-buffer - (append `("Nix-REPL" ,buffer ,nix-executable nil) - nix-repl-executable-args))) - -(defun nix-get-completions (proc prefix) - "Get Nix completions from Nix-repl process PROC and based off of PREFIX." - (save-match-data - (nix--with-temp-process-filter proc - (goto-char (point-min)) - (process-send-string proc (concat prefix "\t\"" (nix--char-with-ctrl ?a) "\"\n")) - (let ((i 0)) - (while (and (< (setq i (1+ i)) 100) - (not (search-forward-regexp "\"\\([^\"]*\\)\"[\n]*nix-repl>" nil t))) - (sleep-for 0.01)) - (let ((new-prefix (match-string 1)) - (start-compl (point))) - (if (string-suffix-p " " new-prefix) - (list (substring new-prefix 0 -1)) - (process-send-string proc (concat new-prefix "\t\t" (nix--char-with-ctrl ?u) "\n")) - (goto-char start-compl) - (setq i 0) - (while (and (< (setq i (1+ i)) 100) - (not (search-forward-regexp - "[\n]+nix-repl>\\|Display all \\([0-9]+\\)" nil t))) - (sleep-for 0.01)) - (if (match-string 1) - (progn - (process-send-string proc "n") - '()) - (search-backward "\n" nil t) - (split-string (buffer-substring start-compl (1- (point))))))))))) - -(defun nix--send-repl (input &optional process mute) - "Send INPUT to PROCESS. - -MUTE if true then don’t alert user." - (let ((proc (or process (get-buffer-process (current-buffer))))) - (if mute - (nix--with-temp-process-filter proc - (process-send-string proc input)) - (process-send-string proc input)))) - -(defun nix--char-with-ctrl (char) - "Generate control character CHAR." - (char-to-string (logand #b10011111 char))) - -(defun nix--process-filter (buf marker) - "Process filter for Nix-rel buffer BUF at MARKER." - (lambda (_proc string) - (when (buffer-live-p buf) - (with-current-buffer buf - (save-excursion - (goto-char marker) - (insert string) - (set-marker marker (point))))))) - -(provide 'nix-repl) -;;; nix-repl.el ends here diff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-repl.elc b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-repl.elc deleted file mode 100644 index a832106c2e80..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-repl.elc +++ /dev/null Binary files differdiff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-search.el b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-search.el deleted file mode 100644 index 85a1e837f299..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-search.el +++ /dev/null @@ -1,64 +0,0 @@ -;;; nix-search.el -- run nix commands in Emacs -*- lexical-binding: t -*- - -;; Author: Matthew Bauer <mjbauer95@gmail.com> -;; Homepage: https://github.com/NixOS/nix-mode -;; Keywords: nix - -;; This file is NOT part of GNU Emacs. - -;;; Commentary: - -;;; Code: - -(require 'nix) -(require 'nix-instantiate) -(require 'nix-shell) -(require 'json) - -;;;###autoload -(defun nix-search (&optional search file) - "Run nix search. -SEARCH a search term to use. -FILE a Nix expression to search in." - (interactive) - (unless search (setq search "")) - (unless file (nix-read-file)) - - (let ((stdout (generate-new-buffer "nix search")) - result) - (call-process nix-executable nil (list stdout nil) nil - "search" "--json" "-f" file search) - (with-current-buffer stdout - (when (eq (buffer-size) 0) - (error "Error: nix search %s failed to produce any output" search)) - (goto-char (point-min)) - (setq result (json-read))) - (kill-buffer stdout) - (when (called-interactively-p 'any) - (let ((display (generate-new-buffer "*nix search*"))) - (with-current-buffer display - (dolist (entry result) - (widget-insert - (format "attr: %s\nname: %s\nversion: %s\ndescription: %s\n\n" - (car entry) - (alist-get 'pkgName (cdr entry)) - (alist-get 'version (cdr entry)) - (alist-get 'description (cdr entry))))) - ) - (display-buffer display 'display-buffer-pop-up-window))) - (kill-buffer stdout) - result)) - -(defun nix-search-read-attr (file) - "Read from a list of attributes. -FILE the nix file to look in." - (let ((collection - (sort (mapcar (lambda (x) (symbol-name (car x))) - (nix-search "" file)) - 'string<)) - (read (cond ((fboundp 'ivy-read) 'ivy-read) - (t 'completing-read)))) - (funcall read "Attribute: " collection))) - -(provide 'nix-search) -;;; nix-search.el ends here diff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-search.elc b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-search.elc deleted file mode 100644 index b5fa47b7d804..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-search.elc +++ /dev/null Binary files differdiff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-shebang.el b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-shebang.el deleted file mode 100644 index 08cc1629dd74..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-shebang.el +++ /dev/null @@ -1,47 +0,0 @@ -;;; nix-shebang.el --- Handle nix shebang header -*- lexical-binding: t -*- - -;; Author: 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: - -;; This detects file headers that look like: -;; #!/usr/bin/env nix-shell -;; #!nix-shell -i bash - -;; and correctly detects their file modes. - -;;; Code: - -(require 'files) - -(defvar nix-shebang-interpreter-regexp "#!\s*nix-shell -i \\([^ \t\n]+\\)" - "Regexp for nix-shell -i header.") - -(defun nix-shebang-get-interpreter () - "Get interpreter string from nix-shell -i file." - (save-excursion - (goto-char (point-min)) - (forward-line 1) - (when (looking-at nix-shebang-interpreter-regexp) - (match-string 1)))) - -(defun nix-shebang-mode () - "Detect and run file’s interpreter mode." - (let ((mode (nix-shebang-get-interpreter))) - (when mode - (funcall (assoc-default mode - (mapcar (lambda (e) - (cons - (format "\\`%s\\'" (car e)) - (cdr e))) - interpreter-mode-alist) - #'string-match-p))))) - -(provide 'nix-shebang) -;;; nix-shebang.el ends here diff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-shebang.elc b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-shebang.elc deleted file mode 100644 index 2f2188235eb9..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-shebang.elc +++ /dev/null Binary files differdiff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-shell.el b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-shell.el deleted file mode 100644 index 8f6da2b09893..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-shell.el +++ /dev/null @@ -1,250 +0,0 @@ -;;; nix-shell.el -- run nix commands in Emacs -*- lexical-binding: t -*- - -;; Author: Matthew Bauer <mjbauer95@gmail.com> -;; Homepage: https://github.com/NixOS/nix-mode -;; Keywords: nix - -;; This file is NOT part of GNU Emacs. - -;;; Commentary: - -;; To use this just run: - -;; M-x RET nix-shell RET - -;; This will give you some - -;;; Code: - -(require 'nix) -(require 'nix-instantiate) -(require 'nix-store) - -(defgroup nix-shell nil - "All nix-shell options." - :group 'nix) - -(defcustom nix-shell-inputs '(depsBuildBuild - depsBuildBuildPropagated - nativeBuildInputs - propagatedNativeBuildInputs - depsBuildTarget - depsBuildTargetPropagated) - "List of inputs to collect for nix-shell." - :type 'list - :group 'nix-shell) - -(defcustom nix-shell-clear-environment nil - "Whether to clear the old ‘exec-path’ & environment. -Similar to ‘--pure’ argument in command line nix-shell." - :type 'boolean - :group 'nix-shell) - -(defcustom nix-shell-auto-realise t - "Whether we can realise paths in the built .drv file." - :type 'boolean - :group 'nix-shell) - -(defcustom nix-file nil - "Nix file to build expressions from. -Should only be set in dir-locals.el file." - :type 'stringp - :group 'nix-shell) - -(defcustom nix-attr nil - "Nix attribute path to use. -Should only be set in dir-locals.el file." - :type 'stringp - :group 'nix-shell) - -;;;###autoload -(defun nix-shell-unpack (file attr) - "Run Nix’s unpackPhase. -FILE is the file to unpack from. -ATTR is the attribute to unpack." - (interactive (list (nix-read-file) nil)) - (unless attr (setq attr (nix-read-attr file))) - - (nix-shell--run-phase "unpack" file attr)) - -(defun nix-read-attr (_) - "Get nix attribute from user." - (read-string "Nix attr: ")) - -(defun nix-read-file () - "Get nix file from user." - (cond - (nix-file nix-file) - ((file-exists-p "shell.nix") "shell.nix") - ((file-exists-p "default.nix") "default.nix") - (t (read-file-name "Nix file: " nil "<nixpkgs>")))) - -;;;###autoload -(defun nix-shell-configure (file attr) - "Run Nix’s configurePhase. -FILE is the file to configure from. -ATTR is the attribute to configure." - (interactive (list (nix-read-file) nil)) - (unless attr (setq attr (nix-read-attr file))) - - (nix-shell--run-phase "configure" file attr)) - -;;;###autoload -(defun nix-shell-build (file attr) - "Run Nix’s buildPhase. -FILE is the file to build from. -ATTR is the attribute to build." - (interactive (list (nix-read-file) nil)) - (unless attr (setq attr (nix-read-attr file))) - - (nix-shell--run-phase "build" file attr)) - -(defun nix-shell--run-phase (phase file attr) - "Get source from a Nix derivation. -PHASE phase to run. -FILE used for base of Nix expresions. -ATTR from NIX-FILE to get Nix expressions from." - (shell-command - (format "%s '%s' -A '%s' --run 'if [ -z \"$%sPhase\" ]; then eval %sPhase; else eval \"$%sPhase\"; fi' &" - nix-shell-executable - file attr phase phase phase))) - -(declare-function flycheck-buffer "flycheck") - -(defun nix-shell--callback (buffer drv) - "Run the nix-shell callback to setup the buffer. -The BUFFER to run in. -The DRV file to use." - (let* ((env (alist-get 'env drv)) - (stdenv (alist-get 'stdenv env)) - (system (alist-get 'system env)) - (inputs (remove nil - (apply 'append - (mapcar (lambda (prop) - (split-string (alist-get prop env))) - nix-shell-inputs))))) - - ;; Prevent accidentally rebuilding the world. - (unless (file-directory-p stdenv) - (error - "Your stdenv at %s has not been built. Please run: nix-store -r %s" - stdenv stdenv)) - - ;; Make sure this .drv file can actually be built here. - (unless (string= system (nix-system)) - (error - "Your system (%s) does not match .drv’s build system (%s)" - (nix-system) system)) - - (with-current-buffer buffer - (when nix-shell-clear-environment - (setq-local exec-path nil) - (setq-local eshell-path-env "") - ;; (setq-local process-environment nil) - ) - - (dolist (input inputs) - (when (and (not (file-directory-p input)) - nix-shell-auto-realise) - (nix-store-realise input)) - - (let ((bin (expand-file-name "bin" input)) - (man (expand-file-name "share/man" input)) - (include (expand-file-name "include" input))) - (add-to-list 'exec-path bin) - (setq-local eshell-path-env - (format "%s:%s" bin eshell-path-env)) - (add-to-list 'woman-manpath man) - (add-to-list 'ffap-c-path include) - (add-to-list 'Man-header-file-path include) - (add-to-list 'irony-additional-clang-options - (format "-I%s" include)))) - - (when flycheck-mode - (flycheck-buffer)) - ))) - -(defun nix-shell-with-packages (packages &optional pkgs-file) - "Create a nix shell environment from the listed package. -PACKAGES a list of packages to use. -PKGS-FILE the Nix file to get the packages from." - (nix-instantiate-async (apply-partially 'nix-shell--callback - (current-buffer)) - (nix-shell--with-packages-file packages pkgs-file) - )) - -(defun nix-shell--with-packages-file (packages &optional pkgs-file) - "Get a .nix file from the packages list. -PACKAGES to put in the .nix file. -PKGS-FILE package set to pull from." - (unless pkgs-file (setq pkgs-file "<nixpkgs>")) - (let ((nix-file (make-temp-file "nix-shell" nil ".nix"))) - (with-temp-file nix-file - (insert (format "with import %s { };\n" pkgs-file)) - (insert "runCommandCC \"shell\" {\n") - (insert " nativeBuildInputs = [\n") - (mapc (lambda (x) (insert (format " %s\n" x))) packages) - (insert " ];\n") - (insert "} \"\"\n")) - nix-file)) - -(defun nix-eshell-with-packages (packages &optional pkgs-file) - "Create an Eshell buffer that has the shell environment in it. -PACKAGES a list of packages to pull in. -PKGS-FILE a file to use to get the packages." - (let ((buffer (generate-new-buffer "*nix-eshell*"))) - (pop-to-buffer-same-window buffer) - - (setq-local nix-shell-clear-environment t) - - (nix-shell--callback - (current-buffer) - (nix-instantiate - (nix-shell--with-packages-file packages pkgs-file) nil t)) - - (eshell-mode) - buffer)) - -(defun nix-eshell (file &optional attr) - "Create an Eshell buffer that has the shell environment in it. -FILE the .nix expression to create a shell for. -ATTR attribute to instantiate in NIX-FILE." - (interactive (list (nix-read-file) nil)) - (unless attr (setq attr (nix-read-attr nix-file))) - - (let ((buffer (generate-new-buffer "*nix-eshell*"))) - (pop-to-buffer-same-window buffer) - - (setq-local nix-shell-clear-environment t) - - (nix-shell--callback - (current-buffer) - (nix-instantiate file attr t)) - - (eshell-mode) - buffer)) - -;;;###autoload -(defun nix-shell-with-string (string) - "A nix-shell emulator in Emacs from a string. -STRING the nix expression to use." - (let ((file (make-temp-file "nix-shell" nil ".nix"))) - (with-temp-file file (insert string)) - (nix-instantiate-async (apply-partially 'nix-shell--callback - (current-buffer)) - file))) - -;;;###autoload -(defun nix-shell (file &optional attr) - "A nix-shell emulator in Emacs. -FILE the file to instantiate. -ATTR an attribute of the Nix file to use." - (interactive (list (nix-read-file) nil)) - (unless attr (setq attr (nix-read-attr file))) - - (nix-instantiate-async (apply-partially 'nix-shell--callback - (current-buffer)) - file attr)) - -(provide 'nix-shell) -;;; nix-shell.el ends here diff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-shell.elc b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-shell.elc deleted file mode 100644 index bf250a8bb8fc..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-shell.elc +++ /dev/null Binary files differdiff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-store.el b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-store.el deleted file mode 100644 index eeaecbb453ac..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-store.el +++ /dev/null @@ -1,25 +0,0 @@ -;;; nix-store.el -- run nix commands in Emacs -*- lexical-binding: t -*- - -;; Author: Matthew Bauer <mjbauer95@gmail.com> -;; Homepage: https://github.com/NixOS/nix-mode -;; Keywords: nix - -;; This file is NOT part of GNU Emacs. - -;;; Commentary: - -;;; Code: - -(require 'nix) - -(defun nix-store-realise (path) - "Realise a path asynchronously. -PATH the path within /nix/store to realise" - (make-process - :buffer nil - :command (list nix-store-executable "-r" path) - :noquery t - :name (format "*nix-store*<%s>" path))) - -(provide 'nix-store) -;;; nix-store.el ends here diff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-store.elc b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-store.elc deleted file mode 100644 index f7fb690221f3..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix-store.elc +++ /dev/null Binary files differdiff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix.el b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix.el deleted file mode 100644 index 3261e075b4e7..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix.el +++ /dev/null @@ -1,289 +0,0 @@ -;;; nix.el -- run nix commands in Emacs -*- lexical-binding: t -*- - -;; Author: Matthew Bauer <mjbauer95@gmail.com> -;; Homepage: https://github.com/NixOS/nix-mode -;; Keywords: nix - -;; This file is NOT part of GNU Emacs. - -;;; Commentary: - -;; To use this just run: - -;; M-x RET nix-shell RET - -;; This will give you some - -;;; Code: - -(require 'pcomplete) - -(defgroup nix nil - "Nix-related customizations" - :group 'languages) - -(defcustom nix-executable (executable-find "nix") - "Nix executable location." - :group 'nix - :type 'string) - -(defcustom nix-build-executable (executable-find "nix-build") - "Nix-build executable location." - :group 'nix - :type 'string) - -(defcustom nix-instantiate-executable (executable-find "nix-instantiate") - "Nix executable location." - :group 'nix - :type 'string) - -(defcustom nix-store-executable (executable-find "nix-store") - "Nix executable location." - :group 'nix - :type 'string) - -(defcustom nix-shell-executable (executable-find "nix-shell") - "Location of ‘nix-shell’ executable." - :group 'nix - :type 'string) - -(defcustom nix-store-dir "/nix/store" - "Nix store directory." - :group 'nix - :type 'string) - -(defcustom nix-state-dir "/nix/var" - "Nix store directory." - :group 'nix - :type 'string) - -(defun nix-system () - "Get the current system tuple." - (let ((stdout (generate-new-buffer "nix eval")) - result) - (call-process nix-executable nil (list stdout nil) nil - "eval" "--raw" "(builtins.currentSystem)") - (with-current-buffer stdout (setq result (buffer-string))) - (kill-buffer stdout) - result)) - -(defvar nix-commands - '("add-to-store" - "build" - "cat-nar" - "cat-store" - "copy" - "copy-sigs" - "dump-path" - "edit" - "eval" - "hash-file" - "hash-path" - "log" - "ls-nar" - "ls-store" - "optimise-store" - "path-info" - "ping-store" - "repl" - "run" - "search" - "show-config" - "show-derivation" - "sign-paths" - "to-base16" - "to-base32" - "to-base64" - "upgrade-nix" - "verify" - "why-depends")) - -(defvar nix-toplevel-options - '("-v" - "--verbose" - "-h" - "--help" - "--debug" - "--help-config" - "--option" - "--version")) - -(defvar nix-config-options - '("allowed-uris" - "allow-import-from-derivation" - "allow-new-priveleges" - "allowed-users" - "auto-optimise-store" - "builders" - "builders-use-substitutes" - "build-users-group" - "compress-build-log" - "connect-timeout" - "cores" - "extra-sandbox-paths" - "extra-substituters" - "fallback" - "fsync-metadata" - "hashed-mirrors" - "http-connections" - "keep-build-log" - "keep-derivations" - "keep-env-derivations" - "keep-outputs" - "max-build-log-size" - "max-jobs" - "max-silent-time" - "netrc-file" - "plugin-files" - "pre-build-hook" - "repeat" - "require-sigs" - "restrict-eval" - "sandbox" - "sandbox-dev-shm-size" - "sandbox-paths" - "secret-key-files" - "show-trace" - "substitute" - "substituters" - "system" - "timeout" - "trusted-public-keys" - "trusted-subtituters" - "trusted-users")) - -(defun nix--pcomplete-flags (options) - "Complete flags to the Nix command. -OPTIONS a list of options to accept." - (while (pcomplete-match "^-" 0) - (pcomplete-here options) - (let ((last-arg (nth (1- pcomplete-index) pcomplete-args))) - (cond - ((string= "--option" last-arg) - (pcomplete-here nix-config-options) - (pcomplete-here)) - ((or (string= "-f" last-arg) (string= "--file" last-arg)) - (pcomplete-here (pcomplete-entries nil 'file-exists-p))) - ((or (string= "--arg" last-arg) (string= "--argstr" last-arg)) - (pcomplete-here) - (pcomplete-here)) - ((or (string= "-I" last-arg) (string= "--include" last-arg)) - (pcomplete-here (pcomplete-entries nil 'file-exists-p))) - ((or (string= "-k" last-arg) (string= "--keep" last-arg)) - (pcomplete-here)) - ((or (string= "-u" last-arg) (string= "--unset" last-arg)) - (pcomplete-here)) - ((or (string= "-s" last-arg) (string= "--substituter" last-arg)) - (pcomplete-here)))))) - -;;;###autoload -(defun pcomplete/nix () - "Completion for the nix command." - (nix--pcomplete-flags nix-toplevel-options) - (pcomplete-here nix-commands) - (pcase (nth (1- pcomplete-index) pcomplete-args) - ("run" - (nix--pcomplete-flags - (append nix-toplevel-options '("--arg" "--argstr" "-c" "--command" - "-f" "--file" "-i" "-I" "--include" - "-k" "--keep" "-u" "--unset")))) - ("build" - (nix--pcomplete-flags - (append nix-toplevel-options '("--arg" "--argstr" "--dry-run" - "-f" "--file" "-I" "--include" - "--no-link" "-o" "--out-link")))) - ("add-to-store" - (nix--pcomplete-flags - (append nix-toplevel-options '("--dry-run" "-n" "--name")))) - ("copy" - (nix--pcomplete-flags - (append nix-toplevel-options '("--all" "--arg" "--argstr" - "-f" "--file" "--from" - "-I" "--include" "--no-check-sigs" - "--no-recursive" "-s" "--substitute" - "--to")))) - ("copy-sigs" - (nix--pcomplete-flags - (append nix-toplevel-options '("--all" "--arg" "--argstr" - "-f" "--file" "-I" "--include" - "-r" "--recursive" "-s" "--substituter")))) - ("dump-path" - (nix--pcomplete-flags - (append nix-toplevel-options '("--arg" "--argstr" - "-f" "--file" "-I" "--include")))) - ("edit" - (nix--pcomplete-flags - (append nix-toplevel-options '("--arg" "--argstr" - "-f" "--file" "-I" "--include")))) - ("eval" - (nix--pcomplete-flags - (append nix-toplevel-options '("--arg" "--argstr" - "-f" "--file" "-I" "--include" - "--json" "--raw")))) - ("hash-file" - (nix--pcomplete-flags - (append nix-toplevel-options '("--base16" "--base32" - "--base64" "--type")))) - ("hash-path" - (nix--pcomplete-flags - (append nix-toplevel-options '("--base16" "--base32" - "--base64" "--type")))) - ("log" - (nix--pcomplete-flags - (append nix-toplevel-options '("--arg" "--argstr" - "-f" "--file" "-I" "--include" - "--json" "--raw")))) - ("ls-nar" - (nix--pcomplete-flags - (append nix-toplevel-options '("-d" "--directory" - "--json" "-l" "--long" - "-R" "--recursive")))) - ("ls-store" - (nix--pcomplete-flags - (append nix-toplevel-options '("-d" "--directory" - "--json" "-l" "--long" - "-R" "--recursive")))) - ("repl" - (nix--pcomplete-flags - (append nix-toplevel-options '("--arg" "--argstr" - "-I" "--include")))) - ("search" - (nix--pcomplete-flags - (append nix-toplevel-options '("--arg" "--argstr" - "-f" "--file" - "-I" "--include" - "--json" "--no-cache" - "-u" "--update-cache")))) - ("show-config" - (nix--pcomplete-flags - (append nix-toplevel-options '("--json")))) - ("show-derivation" - (nix--pcomplete-flags - (append nix-toplevel-options '("--arg" "--argstr" - "-f" "--file" - "-I" "--include" - "-r" "--recursive")))) - ("sign-paths" - (nix--pcomplete-flags - (append nix-toplevel-options '("--all" "--arg" "--argstr" - "-f" "--file" "-I" "--include" - "-k" "--key-file" "-r" "--recursive")))) - ("upgrade-nix" - (nix--pcomplete-flags - (append nix-toplevel-options '("-p" "--profile")))) - ("verify" - (nix--pcomplete-flags - (append nix-toplevel-options '("--all" "--arg" "--argstr" - "-f" "--file" "-I" "--include" - "--no-contents" "--no-trust" - "-r" "--recursive" "-n" "--sigs-needed" - "-s" "--substuter")))) - ("why-depends" - (nix--pcomplete-flags - (append nix-toplevel-options '("-a" "--all" "--arg" "--argstr" - "-f" "--file" "-I" "--include")))) - (_ (nix--pcomplete-flags nix-toplevel-options))) - (pcomplete-here (pcomplete-entries))) - -(provide 'nix) -;;; nix.el ends here diff --git a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix.elc b/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix.elc deleted file mode 100644 index 9f0243b30704..000000000000 --- a/configs/shared/emacs/.emacs.d/elpa/nix-mode-20180908.2240/nix.elc +++ /dev/null Binary files differ |