This is a collection of functions to make handling installed system packages more convenient through emacs.
Installation
System packages is available on [[https://melpa.org/#/][MELPA]]. If you use [[https://github.com/jwiegley/use-package][use-package]] and have MELPA set up correctly, all you'll need is something like the following:
(use-package system-packages :ensure t)
Configuration
The package attempts to guess which package manager you use. If it guesses wrong (or you'd like to set it manually), you may modify the variable =system-packages-package-manager=.
We also attempt to guess whether or not to use sudo with appropriate commands (like installing and uninstalling packages). Some package managers (like homebrew) warn not to use sudo, others (like =apt=) need sudo privileges. You may set this manually by configuring =system-packages-use-sudo=.
Other package customization options can be accessed with M-x =customize-group RET system-packages RET=.
Supported package managers Currently, =system-packages= knows about the following package managers. You can see exactly what commands are associated with =system-packages= commands by checking =system-packages-supported-package-managers=. The default package manager that we use is the first one found from this list:
Usage
The package doesn't presume to set keybindings for you, so you may set those up yourself or simply call functions with =M-x=. All commands start with =system-packages=
Adding other package managers It is straightforward to add support for package managers. First, add the commands to =system-packages-supported-package-managers= like so:
(add-to-list 'system-packages-supported-package-managers '(pacaur . ((default-sudo . nil) (install . "pacaur -S") (search . "pacaur -Ss") (uninstall . "pacaur -Rs") (update . "pacaur -Syu") (clean-cache . "pacaur -Sc") (log . "cat /var/log/pacman.log") (get-info . "pacaur -Qi") (get-info-remote . "pacaur -Si") (list-files-provided-by . "pacaur -Ql") (verify-all-packages . "pacaur -Qkk") (verify-all-dependencies . "pacaur -Dk") (remove-orphaned . "pacaur -Rns $(pacman -Qtdq)") (list-installed-packages . "pacaur -Qe") (list-installed-packages-all . "pacaur -Q") (list-dependencies-of . "pacaur -Qi") (noconfirm . "--noconfirm"))))
You may then need to adjust =system-packages-package-manager= and =system-packages-use-sudo= accordingly:
(setq system-packages-use-sudo t) (setq system-packages-package-manager 'pacaur)