[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
23/24: emacs: Use prompt for packages instead popup for edit action.
From: |
Alex Kost |
Subject: |
23/24: emacs: Use prompt for packages instead popup for edit action. |
Date: |
Fri, 28 Aug 2015 20:06:38 +0000 |
alezost pushed a commit to branch wip-emacs-popup-ui
in repository guix.
commit 32107a7565065076bf41d39591491f072279f263
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 4dff0d6..3bee910 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 e00b792..462429a 100644
--- a/emacs/guix-command.el
+++ b/emacs/guix-command.el
@@ -620,6 +620,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 bd42f8f..fe224fb 100644
--- a/emacs/guix-main.scm
+++ b/emacs/guix-main.scm
@@ -889,9 +889,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
- 09/24: guix lint: Export checkers and <lint-checker> accessors., (continued)
- 09/24: guix lint: Export checkers and <lint-checker> accessors., Alex Kost, 2015/08/28
- 10/24: emacs: Add 'guix-lint-checker-names'., Alex Kost, 2015/08/28
- 11/24: guix graph: Export node types and <node-type> accessors., Alex Kost, 2015/08/28
- 12/24: emacs: Add 'guix-graph-type-names'., Alex Kost, 2015/08/28
- 13/24: emacs: Add 'guix-package-names'., Alex Kost, 2015/08/28
- 17/24: ui: Add 'run-guix'., Alex Kost, 2015/08/28
- 15/24: emacs: Add minibuffer readers., Alex Kost, 2015/08/28
- 18/24: emacs: Add code to run guix command in REPL., Alex Kost, 2015/08/28
- 14/24: emacs: Add help variables., Alex Kost, 2015/08/28
- 20/24: doc: Reorganize "Emacs Interface" node., Alex Kost, 2015/08/28
- 23/24: emacs: Use prompt for packages instead popup for edit action.,
Alex Kost <=
- 19/24: emacs: Add code to run guix command in shell., Alex Kost, 2015/08/28
- 21/24: emacs: Add "guix-popup.el"., Alex Kost, 2015/08/28
- 24/24: emacs: Use popup interface instead 'guix-pull' command., Alex Kost, 2015/08/28
- 16/24: emacs: Add and use alist accessors., Alex Kost, 2015/08/28
- 22/24: emacs: Add popup interface for guix commands., Alex Kost, 2015/08/28