elisp/ui-package: Add 'guix-package-use-name-at-point' variable
* elisp/guix-ui-package.el (guix-package-use-name-at-point): New variable. (guix-packages-by-name): Use it.
This commit is contained in:
parent
36a151b2fc
commit
85d1f49e41
|
@ -52,6 +52,13 @@ a separate line)."
|
||||||
(const :tag "List of outputs" output))
|
(const :tag "List of outputs" output))
|
||||||
:group 'guix-package)
|
:group 'guix-package)
|
||||||
|
|
||||||
|
(defcustom guix-package-use-name-at-point t
|
||||||
|
"If non-nil, \\[guix-packages-by-name] uses symbol at point as default
|
||||||
|
if it is a package name.
|
||||||
|
If nil, then no default name is used."
|
||||||
|
:type 'boolean
|
||||||
|
:group 'guix-package)
|
||||||
|
|
||||||
(defun guix-package-list-type ()
|
(defun guix-package-list-type ()
|
||||||
"Return BUI list entry-type by `guix-package-list-type' variable."
|
"Return BUI list entry-type by `guix-package-list-type' variable."
|
||||||
(guix-make-symbol guix-package-list-type))
|
(guix-make-symbol guix-package-list-type))
|
||||||
|
@ -1512,12 +1519,13 @@ a version number. Examples: \"guile\", \"guile@2.0.11\".
|
||||||
If PROFILE is nil, use `guix-current-profile'.
|
If PROFILE is nil, use `guix-current-profile'.
|
||||||
Interactively with prefix, prompt for PROFILE."
|
Interactively with prefix, prompt for PROFILE."
|
||||||
(interactive
|
(interactive
|
||||||
(let ((at-point (thing-at-point 'symbol t))
|
(let (default-pkg)
|
||||||
default-pkg)
|
(when guix-package-use-name-at-point
|
||||||
(when (stringp at-point)
|
(let ((at-point (thing-at-point 'symbol t)))
|
||||||
(let ((at-point (car (split-string at-point "@"))))
|
(when (stringp at-point)
|
||||||
(setq default-pkg (and (member at-point (guix-package-names))
|
(let ((at-point (car (split-string at-point "@"))))
|
||||||
at-point))))
|
(setq default-pkg (and (member at-point (guix-package-names))
|
||||||
|
at-point))))))
|
||||||
(list (guix-read-package-name "Package: " default-pkg)
|
(list (guix-read-package-name "Package: " default-pkg)
|
||||||
(guix-ui-read-package-profile))))
|
(guix-ui-read-package-profile))))
|
||||||
(guix-package-get-display profile 'name name))
|
(guix-package-get-display profile 'name name))
|
||||||
|
|
Loading…
Reference in New Issue