emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/nix-mode 3aeec264e0 236/500: nix-search: add nix-search-re


From: ELPA Syncer
Subject: [nongnu] elpa/nix-mode 3aeec264e0 236/500: nix-search: add nix-search-read-attr
Date: Sat, 29 Jan 2022 08:27:10 -0500 (EST)

branch: elpa/nix-mode
commit 3aeec264e09caa2f9bb5e651d7c70105257bfcd9
Author: Matthew Bauer <mjbauer95@gmail.com>
Commit: Matthew Bauer <mjbauer95@gmail.com>

    nix-search: add nix-search-read-attr
    
    This can be used for completion
---
 nix-search.el | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/nix-search.el b/nix-search.el
index f82f3cc3d3..e60e16923e 100644
--- a/nix-search.el
+++ b/nix-search.el
@@ -42,7 +42,19 @@ NIX-FILE a Nix expression to search in."
                     (alist-get 'description (cdr entry)))))
          )
        (display-buffer display 'display-buffer-pop-up-window)))
+    (kill-buffer stdout)
     result))
 
+(defun nix-search-read-attr (nix-file)
+  "Read from a list of attributes.
+NIX-FILE the nix file to look in."
+  (let ((collection
+        (sort (mapcar (lambda (x) (symbol-name (car x)))
+                      (nix-search "" nix-file))
+              'string<))
+       (read (cond ((fboundp 'ivy-read) 'ivy-read)
+                   (t 'completing-read))))
+    (funcall read "Attribute: " collection)))
+
 (provide 'nix-search)
 ;;; nix-search.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]