[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/nix-mode a8a513770a 436/500: Simplify some functions
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/nix-mode a8a513770a 436/500: Simplify some functions |
Date: |
Sat, 29 Jan 2022 08:27:54 -0500 (EST) |
branch: elpa/nix-mode
commit a8a513770a61ca425f876e10bf7ea11d5c82d7c9
Author: Daniel Nagy <danielnagy@posteo.de>
Commit: Daniel Nagy <danielnagy@posteo.de>
Simplify some functions
Reduce the number of explicit temp buffers used.
---
nix.el | 34 ++++++++++++----------------------
1 file changed, 12 insertions(+), 22 deletions(-)
diff --git a/nix.el b/nix.el
index ede66d7790..2ea7d09b9b 100644
--- a/nix.el
+++ b/nix.el
@@ -17,6 +17,7 @@
;;; Code:
(require 'pcomplete)
+(require 'json)
(defgroup nix nil
"Nix-related customizations"
@@ -59,35 +60,24 @@
(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))
+ (with-temp-buffer
+ (call-process nix-executable nil (list t nil) nil "eval" "--raw"
"(builtins.currentSystem)")
+ (buffer-string)))
(defvar nix-version nil)
(defun nix-version ()
"Get the version of Nix"
- (if nix-version nix-version
- (let ((stdout (generate-new-buffer "nix eval"))
- result)
- (call-process nix-executable nil (list stdout nil) nil "--version")
- (with-current-buffer stdout (setq result (buffer-string)))
- (kill-buffer stdout)
- result)))
+ (or nix-version
+ (with-temp-buffer
+ (call-process nix-executable nil (list t nil) nil "--version")
+ (buffer-string))))
(defun nix-show-config ()
"Show nix config."
- (let ((stdout (generate-new-buffer "nix config"))
- result)
- (call-process nix-executable nil (list stdout nil) nil "show-config"
"--json")
- (setq result (with-current-buffer stdout
- (goto-char (point-min))
- (json-read)))
- (kill-buffer stdout)
- result))
+ (with-temp-buffer
+ (call-process nix-executable nil (list t nil) nil "show-config" "--json")
+ (goto-char (point-min))
+ (json-read)))
(defvar nix-commands
'("add-to-store"
- [nongnu] elpa/nix-mode 47ec698474 422/500: Add version to invocation of define-obsolete-function-alias, (continued)
- [nongnu] elpa/nix-mode 47ec698474 422/500: Add version to invocation of define-obsolete-function-alias, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode e32c6bf7ad 415/500: Merge pull request #115 from taku0/ffap-in-string, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 30587b2205 411/500: Merge pull request #114 from TristanCacqueray/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 471a90ac96 394/500: Release 1.4.5, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode fe00d5930b 423/500: Merge pull request #119 from NixOS/derived-nix-drv-mode, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 7e081a560b 427/500: nix-drv-mode.el: make regexp more selective, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 91e1a05ea6 399/500: Merge pull request #107 from rossabaker/check-for-proc, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode b4b7518231 441/500: Refactor process calling, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 75d2111891 433/500: Merge pull request #129 from nagy/nix-search-separate, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 949cb98ba5 432/500: Set meta.description, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode a8a513770a 436/500: Simplify some functions,
ELPA Syncer <=
- [nongnu] elpa/nix-mode 7f689c4161 450/500: In flake.nix, split name into pname and version, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode b12fa70dd7 446/500: Indicate constants, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 53d1fb9687 469/500: nix-flake: Add nix-flake-init, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 1604a9cec8 484/500: nix-flake: Allow updating the lockfile, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode e167b82e64 493/500: nix-flake: Fix inconsistent state after switching the flake, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 3d04d92d9c 496/500: Merge pull request #144 from akirak/update-cask-on-flake, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode cf957244e7 499/500: Merge pull request #149 from akirak/transient-dep, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 9ee2a867e6 481/500: nix-flake: Follow the terminology and syntax of the guideline, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode b97d0a0aae 488/500: Merge pull request #141 from akirak/dependabot, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 83980ca7e7 498/500: nix-mode: Add missing transient dependency for nix-flake, ELPA Syncer, 2022/01/29