Skip to content

Commit

Permalink
elisp/ui-package: Fix an error on package name read
Browse files Browse the repository at this point in the history
This is a followup to commit fbc2bbc.

Reported by Nicolò Balzarotti at
<#45>
and by Christopher Howard at
<https://lists.gnu.org/archive/html/bug-guix/2021-06/msg00036.html>.

* 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).
  • Loading branch information
alezost committed Jun 8, 2021
1 parent 8ce6d21 commit e5ff0e5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions elisp/guix-ui-package.el
Original file line number Diff line number Diff line change
Expand Up @@ -1512,16 +1512,16 @@ a version number. Examples: \"guile\", \"[email protected]\".
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.
Expand Down

0 comments on commit e5ff0e5

Please sign in to comment.