diff options
author | Alyssa Ross <hi@alyssa.is> | 2021-01-24 13:03:39 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2021-01-25 14:26:49 +0000 |
commit | c7e13feb54f65ed57556d1085cc6b14b861449b0 (patch) | |
tree | 82e1acf04a9cb1a09a7779fab43eb8db7eaa43b9 /modules/workstation/emacs/init.el | |
parent | daa8a4d7ead4785823ff96a156038c648ca1e086 (diff) | |
download | nixlib-c7e13feb54f65ed57556d1085cc6b14b861449b0.tar nixlib-c7e13feb54f65ed57556d1085cc6b14b861449b0.tar.gz nixlib-c7e13feb54f65ed57556d1085cc6b14b861449b0.tar.bz2 nixlib-c7e13feb54f65ed57556d1085cc6b14b861449b0.tar.lz nixlib-c7e13feb54f65ed57556d1085cc6b14b861449b0.tar.xz nixlib-c7e13feb54f65ed57556d1085cc6b14b861449b0.tar.zst nixlib-c7e13feb54f65ed57556d1085cc6b14b861449b0.zip |
modules/emacs: add browse-url-nixpkgs
Diffstat (limited to 'modules/workstation/emacs/init.el')
-rw-r--r-- | modules/workstation/emacs/init.el | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/workstation/emacs/init.el b/modules/workstation/emacs/init.el index f188a0b52f4f..bdfb1b9b155b 100644 --- a/modules/workstation/emacs/init.el +++ b/modules/workstation/emacs/init.el @@ -139,6 +139,15 @@ ;; cross-references. (setq Man-notify-method 'pushy) +;;; Nix support ;;; +(defun browse-url-nixpkgs (attr) + "Open a browser to the homepage for the Nixpkgs attribute ATTR." + (interactive "sAttribute: ") + (let* ((full-attr-quoted (shell-quote-argument (concat attr ".meta.homepage"))) + (command (concat "nix eval --raw -f '<nixpkgs>' " full-attr-quoted)) + (homepage (shell-command-to-string command))) + (browse-url homepage))) + ;;; Rainbow Delimiters ;;; (add-hook 'prog-mode-hook #'rainbow-delimiters-mode) |