From e5ff0e590511bbdaf081d955642e5d60e5752730 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Tue, 8 Jun 2021 19:34:03 +0300 Subject: [PATCH] elisp/ui-package: Fix an error on package name read MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a followup to commit fbc2bbc12873ce080992f99b12c652ae007fc3c6. Reported by Nicolò Balzarotti at and by Christopher Howard at . * elisp/guix-ui-package.el (guix-packages-by-name): Make sure 'thing-at-point' returns a string (it can also return nil). Otherwise, do not read package names (as it would be a useless function call). --- elisp/guix-ui-package.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/elisp/guix-ui-package.el b/elisp/guix-ui-package.el index 3a6e744..9ac587f 100644 --- a/elisp/guix-ui-package.el +++ b/elisp/guix-ui-package.el @@ -1512,16 +1512,16 @@ a version number. Examples: \"guile\", \"guile@2.0.11\". If PROFILE is nil, use `guix-current-profile'. Interactively with prefix, prompt for PROFILE." (interactive - (let ((packages (guix-package-names)) - (at-point (car (split-string (thing-at-point 'symbol t) - "@")))) - (list (guix-read-package-name "Package: " - (and (member at-point packages) - at-point)) + (let ((at-point (thing-at-point 'symbol t)) + default-pkg) + (when (stringp at-point) + (let ((at-point (car (split-string at-point "@")))) + (setq default-pkg (and (member at-point (guix-package-names)) + at-point)))) + (list (guix-read-package-name "Package: " default-pkg) (guix-ui-read-package-profile)))) (guix-package-get-display profile 'name name)) - ;;;###autoload (defun guix-packages-by-regexp (regexp &optional params profile) "Search for Guix packages by REGEXP.