diff options
author | John Wiegley <johnw@newartisans.com> | 2018-06-25 12:09:44 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-25 12:09:44 -0700 |
commit | 5fb369c96847191c3ded14fc3c1cdc462eac416c (patch) | |
tree | df27b81e248e8dd37cdf605c962578a367e79a44 /lisp/use-package/use-package-ensure-system-package.el | |
parent | dc83e2f035033fa038888115a8a92f5df69b1732 (diff) | |
parent | 87e26db44f4abd2e3a076a9b6fda684921883525 (diff) | |
download | emacs-5fb369c96847191c3ded14fc3c1cdc462eac416c.tar.gz emacs-5fb369c96847191c3ded14fc3c1cdc462eac416c.tar.bz2 emacs-5fb369c96847191c3ded14fc3c1cdc462eac416c.zip |
Merge branch 'master' into patch-1
Diffstat (limited to 'lisp/use-package/use-package-ensure-system-package.el')
-rw-r--r-- | lisp/use-package/use-package-ensure-system-package.el | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/lisp/use-package/use-package-ensure-system-package.el b/lisp/use-package/use-package-ensure-system-package.el index 81beaec104f..476a4f2b930 100644 --- a/lisp/use-package/use-package-ensure-system-package.el +++ b/lisp/use-package/use-package-ensure-system-package.el @@ -1,4 +1,4 @@ -;;; use-package-ensure-system-package.el --- auto install system packages -*- lexical: t; -*- +;;; use-package-ensure-system-package.el --- auto install system packages -*- lexical-binding: t; -*- ;; Copyright (C) 2017 Justin Talbott @@ -6,7 +6,7 @@ ;; Keywords: convenience, tools, extensions ;; URL: https://github.com/waymondo/use-package-ensure-system-package ;; Version: 0.1 -;; Package-Requires: ((use-package "2.1") (system-packages "0.1")) +;; Package-Requires: ((use-package "2.1") (system-packages "1.0.4")) ;; Filename: use-package-ensure-system-package.el ;; License: GNU General Public License version 3, or (at your option) any later version ;; @@ -23,23 +23,11 @@ (require 'system-packages nil t) (eval-when-compile - (defvar system-packages-package-manager) - (defvar system-packages-supported-package-managers) - (defvar system-packages-use-sudo)) + (declare-function system-packages-get-command "system-packages")) (defun use-package-ensure-system-package-install-command (pack) "Return the default install command for PACK." - (let ((command - (cdr (assoc 'install (cdr (assoc system-packages-package-manager - system-packages-supported-package-managers)))))) - (unless command - (error (format "%S not supported in %S" 'install system-packages-package-manager))) - (unless (listp command) - (setq command (list command))) - (when system-packages-use-sudo - (setq command (mapcar (lambda (part) (concat "sudo " part)) command))) - (setq command (mapconcat 'identity command " && ")) - (mapconcat 'identity (list command pack) " "))) + (system-packages-get-command 'install pack)) (defun use-package-ensure-system-package-consify (arg) "Turn `arg' into a cons of (`package-name' . `install-command')." @@ -55,10 +43,10 @@ (use-package-ensure-system-package-install-command (symbol-name (cdr arg)))))))) ;;;###autoload -(defun use-package-normalize/:ensure-system-package (name-symbol keyword args) +(defun use-package-normalize/:ensure-system-package (_name-symbol keyword args) "Turn `arg' into a list of cons-es of (`package-name' . `install-command')." (use-package-only-one (symbol-name keyword) args - (lambda (label arg) + (lambda (_label arg) (cond ((and (listp arg) (listp (cdr arg))) (mapcar #'use-package-ensure-system-package-consify arg)) @@ -66,7 +54,7 @@ (list (use-package-ensure-system-package-consify arg))))))) ;;;###autoload -(defun use-package-handler/:ensure-system-package (name keyword arg rest state) +(defun use-package-handler/:ensure-system-package (name _keyword arg rest state) "Execute the handler for `:ensure-system-package' keyword in `use-package'." (let ((body (use-package-process-keywords name rest state))) (use-package-concat |