From 260795b7369c51d99c7ab4f3ef24f195938beabf Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Fri, 12 Feb 2016 12:32:34 +0300 Subject: emacs: Do not allow a user to modify system profiles. Fixes . Reported by myglc2 . 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. --- emacs/guix-profiles.el | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'emacs/guix-profiles.el') 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 -- cgit v1.2.3