diff options
author | Alex Kost <alezost@gmail.com> | 2016-02-12 12:32:34 +0300 |
---|---|---|
committer | Alex Kost <alezost@gmail.com> | 2016-02-22 22:36:35 +0300 |
commit | 260795b7369c51d99c7ab4f3ef24f195938beabf (patch) | |
tree | bbbbfb3d622f044fb3c37284d0581e086e08935b /emacs/guix-profiles.el | |
parent | 0338132e655553358035f61df7e96f5cfac5378a (diff) | |
download | guix-260795b7369c51d99c7ab4f3ef24f195938beabf.tar guix-260795b7369c51d99c7ab4f3ef24f195938beabf.tar.gz |
emacs: Do not allow a user to modify system profiles.
Fixes <http://bugs.gnu.org/22607>.
Reported by myglc2 <myglc2@gmail.com>.
Remove possibilities to install/delete packages to/from a system profile
both for "Package List" and "Package Info" buffers.
* emacs/guix-profiles.el (guix-system-profile-regexp): New variable.
(guix-system-profile?): New procedure.
* emacs/guix-ui-package.el (guix-package-info-insert-output): Do not
display "Install"/"Delete" button for a system profile.
(guix-package-assert-non-system-profile): New procedure.
(guix-package-execute-actions): Use it.
Diffstat (limited to 'emacs/guix-profiles.el')
-rw-r--r-- | emacs/guix-profiles.el | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/emacs/guix-profiles.el b/emacs/guix-profiles.el index 43ad1d42eb..12cf46dbf8 100644 --- a/emacs/guix-profiles.el +++ b/emacs/guix-profiles.el @@ -40,6 +40,14 @@ (defvar guix-current-profile guix-default-profile "Current profile.") +(defvar guix-system-profile-regexp + (concat "\\`" (regexp-quote guix-system-profile)) + "Regexp matching system profiles.") + +(defun guix-system-profile? (profile) + "Return non-nil, if PROFILE is a system one." + (string-match-p guix-system-profile-regexp profile)) + (defun guix-profile-prompt (&optional default) "Prompt for profile and return it. Use DEFAULT as a start directory. If it is nil, use |