[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
19/20: emacs: Use prompt for packages instead popup for edit action.
From: |
Alex Kost |
Subject: |
19/20: emacs: Use prompt for packages instead popup for edit action. |
Date: |
Tue, 18 Aug 2015 09:41:14 +0000 |
alezost pushed a commit to branch wip-emacs-popup-ui
in repository guix.
commit af95a1afda8e381b6be7a5e52211db5c240ad0d9
Author: Alex Kost <address@hidden>
Date: Mon Aug 17 12:05:05 2015 +0300
emacs: Use prompt for packages instead popup for edit action.
* emacs/guix-base.el (guix-package-location): New function.
(guix-edit-package): Rename and move to ...
* emacs/guix.el (guix-edit): ...here. Make it interactive.
* emacs/guix-command.el (guix-edit-action): New function (alias to
'guix-edit') to override the popup for edit command in "M-x guix".
* emacs/guix-list.el (guix-list-edit-package): Adjust for 'guix-edit'
renaming.
* emacs/guix-main.scm (package-location-string): Allow to accept package
id or package name as argument.
---
emacs/guix-base.el | 12 +++++-------
emacs/guix-command.el | 2 ++
emacs/guix-list.el | 2 +-
emacs/guix-main.scm | 7 ++++---
emacs/guix.el | 12 +++++++++++-
5 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/emacs/guix-base.el b/emacs/guix-base.el
index 2f23bdb..aa099b4 100644
--- a/emacs/guix-base.el
+++ b/emacs/guix-base.el
@@ -172,13 +172,11 @@ If PATH is relative, it is considered to be relative to
(move-to-column col)
(recenter 1))))
-(defun guix-edit-package (id)
- "Edit (go to location of) package with ID."
- (let ((loc (guix-eval-read (guix-make-guile-expression
- 'package-location-string id))))
- (if loc
- (guix-find-location loc)
- (message "Couldn't find package location."))))
+(defun guix-package-location (id-or-name)
+ "Return location of a package with ID-OR-NAME.
+For the meaning of location, see `guix-find-location'."
+ (guix-eval-read (guix-make-guile-expression
+ 'package-location-string id-or-name)))
;;; Receivable lists of packages, lint checkers, etc.
diff --git a/emacs/guix-command.el b/emacs/guix-command.el
index d26d745..93f3b12 100644
--- a/emacs/guix-command.el
+++ b/emacs/guix-command.el
@@ -611,6 +611,8 @@ EXECUTOR function is called with the current command line
arguments."
;;;###autoload (autoload 'guix "guix-command" "Popup window for 'guix'." t)
(guix-command-define-popup-action guix)
+(defalias 'guix-edit-action #'guix-edit)
+
(defvar guix-command-font-lock-keywords
(eval-when-compile
diff --git a/emacs/guix-list.el b/emacs/guix-list.el
index abb0232..9796464 100644
--- a/emacs/guix-list.el
+++ b/emacs/guix-list.el
@@ -472,7 +472,7 @@ With prefix (if ARG is non-nil), describe entries marked
with any mark."
(defun guix-list-edit-package ()
"Go to the location of the current package."
(interactive)
- (guix-edit-package (guix-list-current-package-id)))
+ (guix-edit (guix-list-current-package-id)))
;;; Displaying packages
diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm
index 1d15cf4..692a06e 100644
--- a/emacs/guix-main.scm
+++ b/emacs/guix-main.scm
@@ -888,9 +888,10 @@ GENERATIONS is a list of generation numbers."
(with-store store
(delete-generations store profile generations)))
-(define (package-location-string package-id)
- "Return a location string of a package PACKAGE-ID."
- (and-let* ((package (package-by-id package-id))
+(define (package-location-string id-or-name)
+ "Return a location string of a package with ID-OR-NAME."
+ (and-let* ((package (or (package-by-id id-or-name)
+ (first (packages-by-name id-or-name))))
(location (package-location package)))
(location->string location)))
diff --git a/emacs/guix.el b/emacs/guix.el
index afe7285..244696a 100644
--- a/emacs/guix.el
+++ b/emacs/guix.el
@@ -1,6 +1,6 @@
;;; guix.el --- Interface for GNU Guix package manager
-;; Copyright © 2014 Alex Kost <address@hidden>
+;; Copyright © 2014, 2015 Alex Kost <address@hidden>
;; Package-Requires: ((geiser "0.3"))
;; Keywords: tools
@@ -32,6 +32,7 @@
(require 'guix-list)
(require 'guix-info)
(require 'guix-utils)
+(require 'guix-read)
(defgroup guix nil
"Interface for Guix package manager."
@@ -193,6 +194,15 @@ Interactively with prefix, prompt for PROFILE."
(float-time from)
(float-time to)))
+;;;###autoload
+(defun guix-edit (id-or-name)
+ "Edit (go to location of) package with ID-OR-NAME."
+ (interactive (list (guix-read-package-name)))
+ (let ((loc (guix-package-location id-or-name)))
+ (if loc
+ (guix-find-location loc)
+ (message "Couldn't find package location."))))
+
(provide 'guix)
;;; guix.el ends here
- 02/20: emacs: Add 'guix-lint-checker-names'., (continued)
- 02/20: emacs: Add 'guix-lint-checker-names'., Alex Kost, 2015/08/18
- 14/20: emacs: Add code to run guix command in REPL., Alex Kost, 2015/08/18
- 10/20: emacs: Add help variables., Alex Kost, 2015/08/18
- 07/20: emacs: Add utils to copy guix command., Alex Kost, 2015/08/18
- 15/20: emacs: Add code to run guix command in shell., Alex Kost, 2015/08/18
- 20/20: emacs: Use popup interface instead 'guix-pull' command., Alex Kost, 2015/08/18
- 11/20: emacs: Add minibuffer readers., Alex Kost, 2015/08/18
- 16/20: doc: Reorganize "Emacs Interface" node., Alex Kost, 2015/08/18
- 17/20: emacs: Add "guix-popup.el"., Alex Kost, 2015/08/18
- 12/20: emacs: Add and use alist accessors., Alex Kost, 2015/08/18
- 19/20: emacs: Use prompt for packages instead popup for edit action.,
Alex Kost <=
- 18/20: emacs: Add popup interface for guix commands., Alex Kost, 2015/08/18