-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
1 changed file
with
14 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,13 @@ a separate line)." | |
(const :tag "List of outputs" output)) | ||
: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 () | ||
"Return BUI list entry-type by `guix-package-list-type' variable." | ||
(guix-make-symbol guix-package-list-type)) | ||
|
@@ -1512,12 +1519,13 @@ a version number. Examples: \"guile\", \"[email protected]\". | |
If PROFILE is nil, use `guix-current-profile'. | ||
Interactively with prefix, prompt for PROFILE." | ||
(interactive | ||
(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)))) | ||
(let (default-pkg) | ||
(when guix-package-use-name-at-point | ||
(let ((at-point (thing-at-point 'symbol t))) | ||
(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)) | ||
|