From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: [PATCH 6/6] emacs: Add license/location "Packages" buttons to Info buffer. Date: Mon, 4 Apr 2016 22:47:46 +0300 Message-ID: <1459799266-7426-7-git-send-email-alezost@gmail.com> References: <1459799266-7426-1-git-send-email-alezost@gmail.com> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51132) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1anATv-0003FQ-AF for guix-devel@gnu.org; Mon, 04 Apr 2016 15:48:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1anATu-0000NC-2M for guix-devel@gnu.org; Mon, 04 Apr 2016 15:48:14 -0400 Received: from mail-lb0-x243.google.com ([2a00:1450:4010:c04::243]:34753) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1anATt-0000MW-Mv for guix-devel@gnu.org; Mon, 04 Apr 2016 15:48:14 -0400 Received: by mail-lb0-x243.google.com with SMTP id vk4so24520430lbb.1 for ; Mon, 04 Apr 2016 12:48:13 -0700 (PDT) Received: from localhost.localdomain ([217.107.192.146]) by smtp.gmail.com with ESMTPSA id e141sm5130223lfe.18.2016.04.04.12.48.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Apr 2016 12:48:12 -0700 (PDT) In-Reply-To: <1459799266-7426-1-git-send-email-alezost@gmail.com> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org * emacs/guix-ui-package.el (guix-package-info-insert-location) (guix-package-info-insert-license): New procedures. (guix-package-info-format): Use them. (guix-output-info-format): Likewise. --- emacs/guix-ui-package.el | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/emacs/guix-ui-package.el b/emacs/guix-ui-package.el index aba30ab..e6f836d 100644 --- a/emacs/guix-ui-package.el +++ b/emacs/guix-ui-package.el @@ -223,9 +223,9 @@ ENTRIES is a list of package entries to get info about packages." ignore (outputs simple guix-package-info-insert-outputs) (source simple guix-package-info-insert-source) - (location format (format guix-package-location)) + (location simple guix-package-info-insert-location) + (license simple guix-package-info-insert-license) (home-url format (format guix-url)) - (license format (format guix-package-license)) (systems format guix-package-info-insert-systems) (inputs format (format guix-package-input)) (native-inputs format (format guix-package-native-input)) @@ -383,6 +383,38 @@ formatted with this string, an action button is inserted.") 'guix-package-heading 'spec (guix-package-entry->name-specification entry))) +(defun guix-package-info-insert-location (location &optional _) + "Insert package LOCATION at point." + (if (null location) + (guix-format-insert nil) + (let ((location-file (car (split-string location ":")))) + (guix-info-insert-value-indent location 'guix-package-location) + (guix-info-insert-indent) + (guix-info-insert-action-button + "Packages" + (lambda (btn) + (guix-package-get-display (guix-ui-current-profile) + 'location + (button-get btn 'location))) + (concat "Show packages from location: " location-file) + 'location location-file)))) + +(defun guix-package-info-insert-license (licenses &optional _) + "Insert package LICENSES at point." + (if (null licenses) + (guix-format-insert nil) + (dolist (license licenses) + (guix-info-insert-value-indent license 'guix-package-license) + (guix-info-insert-indent) + (guix-info-insert-action-button + "Packages" + (lambda (btn) + (guix-package-get-display (guix-ui-current-profile) + 'license + (button-get btn 'license))) + (concat "Show packages with license: " license) + 'license license)))) + (defun guix-package-info-insert-systems (systems entry) "Insert supported package SYSTEMS at point." (guix-info-insert-value-format @@ -798,9 +830,9 @@ for all ARGS." (source simple guix-package-info-insert-source) (path simple (indent guix-file)) (dependencies simple (indent guix-file)) - (location format (format guix-package-location)) + (location simple guix-package-info-insert-location) + (license simple guix-package-info-insert-license) (home-url format (format guix-url)) - (license format (format guix-package-license)) (systems format guix-package-info-insert-systems) (inputs format (format guix-package-input)) (native-inputs format (format guix-package-native-input)) -- 2.7.3