Toggle diff (457 lines)
diff --git a/README b/README
index 55a6956..6a63f97 100644
--- a/README
+++ b/README
@@ -34,7 +34,7 @@ In short, Emacs-Guix provides the following features:
+ [[/gnu/store]] items
-- Magit-like popup interface for all Emacs-Guix and Guix shell commands
+- Magit-like keyboard-driven menu for all Emacs-Guix and Guix shell commands
(=M-x guix=).
- Modes to view logs of package builds (=guix-build-log-mode= and
diff --git a/configure.ac b/configure.ac
index dd1de4b..3461bb3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -130,18 +130,18 @@ AC_ARG_WITH([editindirect-lispdir],
[editindirectlispdir="no"])
AC_SUBST([editindirectlispdir])
-AC_ARG_WITH([popup-lispdir],
- [AS_HELP_STRING([--with-popup-lispdir],
- [directory with magit-popup.el file])],
- [popuplispdir="$withval"],
- [popuplispdir="no"])
-AC_SUBST([popuplispdir])
+AC_ARG_WITH([transient-lispdir],
+[AS_HELP_STRING([--with-transient-lispdir],
+ [directory with transient.el file])],
+ [transientlispdir="$withval"],
+ [transientlispdir="no"])
+AC_SUBST([transientlispdir])
AM_CONDITIONAL([GEISER_DIR], [test "x$geiserlispdir" != "xno"])
AM_CONDITIONAL([DASH_DIR], [test "x$dashlispdir" != "xno"])
AM_CONDITIONAL([BUI_DIR], [test "x$builispdir" != "xno"])
AM_CONDITIONAL([EDITINDIRECT_DIR], [test "x$editindirectlispdir" != "xno"])
-AM_CONDITIONAL([POPUP_DIR], [test "x$popuplispdir" != "xno"])
+AM_CONDITIONAL([TRANSIENT_DIR], [test "x$transientlispdir" != "xno"])
dnl If all elisp dependencies are specified, we can use "emacs -Q" for
dnl byte-compilation. Otherwise, "emacs" will be used, and it will
@@ -151,7 +151,7 @@ AM_CONDITIONAL([EMACS_Q],
"x$dashlispdir" != "xno" -a \
"x$builispdir" != "xno" -a \
"x$editindirectlispdir" != "xno" -a \
- "x$popuplispdir" != "xno"])
+ "x$transientlispdir" != "xno"])
dnl ----------------------------------------------------------------
diff --git a/doc/emacs-guix.texi b/doc/emacs-guix.texi
index 3219354..6bb3810 100644
--- a/doc/emacs-guix.texi
+++ b/doc/emacs-guix.texi
@@ -53,7 +53,7 @@ A copy of the license is available at
* System:: Interface for @code{operating-system} and services.
* Store Items:: Interface for store items.
* Package Licenses:: Interface for licenses of packages.
-* Popup Interface:: Magit-like interface for Emacs-Guix commands.
+* Keyboard-driven Menu:: Magit-like interface for Emacs-Guix commands.
* Prettify Mode:: Abbreviating @file{/gnu/store/@dots{}} file names.
* Prettify Variables:: Split and indent Shell variables.
* Build Log Mode:: Highlighting Guix build logs.
@@ -77,8 +77,8 @@ Indexes
Emacs-Guix (also known as ``guix.el'') provides various interfaces and
tools related to the GNU Guix package manager.
-Call @kbd{M-x guix} if you prefer to dive in right away (@pxref{Popup
-Interface}).
+Call @kbd{M-x guix} if you prefer to dive in right away
+(@pxref{Keyboard-driven Menu}).
In short, Emacs-Guix provides the following features:
@@ -99,8 +99,8 @@ Interfaces for:
@end itemize
@item
-Magit-like popup interface for all Emacs-Guix @kbd{M-x} commands and
-Guix shell commands (@pxref{Popup Interface}).
+Keyboard-driven magit-like menu for all Emacs-Guix @kbd{M-x} and Guix
+shell commands (@pxref{Keyboard-driven Menu}).
@item
Modes to view logs of package builds (@pxref{Build Log Mode}).
@@ -185,10 +185,9 @@ features as without Guix.
interfaces (to display packages, generations, licenses, etc.).
@item
-@uref{https://github.com/magit/magit-popup, magit-popup library}. You
-already have this library if you use Magit 2.1.0 or later. This
-library is required only for @kbd{M-x@tie{}guix} command (@pxref{Popup
-Interface}).
+@uref{https://github.com/magit/transient, transient library}. This
+library is required only for @kbd{M-x@tie{}guix} command
+(@pxref{Keyboard-driven Menu}).
@item
@uref{https://github.com/Fanael/edit-indirect, edit-indirect library},
@@ -204,7 +203,7 @@ list of packages (@pxref{Package Keys}).
@end itemize
To sum up, most likely, you'll need all the above dependencies except
-maybe @code{magit-popup}, @code{edit-indirect} and @code{build-farm}.
+maybe @code{transient}, @code{edit-indirect} and @code{build-farm}.
@node Using from Git
@section Using from Git
@@ -1058,24 +1057,24 @@ Open @file{@dots{}/guix/licenses.scm} and move to the specified license.
@end table
@c ----------------------------------------------------------------
-@node Popup Interface
-@chapter Popup Interface
+@node Keybord-driven Menu
+@chapter Keybord-driven Menu
-If you ever used Magit, you know what ``popup interface'' is
-(@pxref{Top,,, magit-popup, Magit-Popup User Manual}). Even if you are
-not acquainted with Magit, there should be no worries as it is very
-intuitive.
+Transient is the library used to implement keybord-driven ``menus'' like
+in Magit (@pxref{Top,,, transient, Transient User Manual}). Even if you
+are not acquainted with Magit, this interface it is very intuitive.
@findex guix
-So, @kbd{M-x@tie{}guix} command provides a top-level popup interface
-for almost all the available Emacs-Guix commands. It has 2 advantages
-comparing with calling @kbd{M-x@tie{}guix-@dots{}} commands directly:
+So, @kbd{M-x@tie{}guix} command provides a top-level keyboard-driven
+menu for almost all the available Emacs-Guix commands. It has 2
+advantages comparing with calling @kbd{M-x@tie{}guix-@dots{}} commands
+directly:
@itemize
@item
There is no need to remember the names of Emacs-Guix commands, as you
-can always find them in @kbd{M-x@tie{}guix} and its sub-popups.
+can always find them in @kbd{M-x@tie{}guix} and its suffix transients.
@item
It is faster (well, if you know what you are going to call), as it may
@@ -1092,17 +1091,17 @@ easy accessible key combination, for example, to @kbd{@key{super}-g}:
(global-set-key (kbd "s-g") 'guix)
@end example
-@node Guix Popup Interface
-@section Guix Popup Interface
+@node Guix Keyboard-driven Menu
+@section Guix Keyboard-driven Menu
@findex guix-command
-There is one rather special sub-popup in @kbd{M-x@tie{}guix}. It is
-bind to @kbd{c} by default, and you can call it separately with
-@kbd{M-x@tie{}guix-command}. It is a popup interface for
-@code{guix@tie{}@dots{}} shell commands. It is probably not very
+There is one rather special transient suffix in @kbd{M-x@tie{}guix}. It
+is bind to @kbd{c} by default, and you can call it separately with
+@kbd{M-x@tie{}guix-command}. It is a keyboard-driven, magit-like menu
+for @code{guix@tie{}@dots{}} shell commands. It is probably not very
useful, as it provides all the options and flags for all the shell
-actions and subcommands, so it may be confusing to see them all at
-once. Nevertheless, a description of this thing follows.
+actions and subcommands, so it may be confusing to see them all at once.
+Nevertheless, a description of this thing follows.
When you select an option, you'll be prompted for a value in the
minibuffer. Many values have completions, so don't hesitate to press
diff --git a/doc/htmlxref.cnf b/doc/htmlxref.cnf
index d547107..b42ac28 100644
--- a/doc/htmlxref.cnf
+++ b/doc/htmlxref.cnf
@@ -4,9 +4,9 @@
# manuals in the generated HTML pages (created by "make manual"
# command). See (info "(texinfo) HTML Xref Configuration") for details.
-MAGIT_POPUP = https://magit.vc/manual/magit-popup
-magit-popup mono ${MAGIT_POPUP}
-magit-popup node ${MAGIT_POPUP}/
+TRANSIENT = https://magit.vc/manual/transient
+transient mono ${TRANSIENT}
+transient node ${TRANSIENT}/
GEISER = http://www.nongnu.org/geiser
geiser mono ${GEISER}
diff --git a/elisp/guix-command.el b/elisp/guix-command.el
index cbfc0fa..affda4e 100644
--- a/elisp/guix-command.el
+++ b/elisp/guix-command.el
@@ -1,4 +1,4 @@
-;;; guix-command.el --- Popup interface for guix shell commands -*- lexical-binding: t -*-
+;;; guix-command.el --- Transient interface for guix shell commands -*- lexical-binding: t -*-
;; Copyright © 2015–2020 Alex Kost <alezost@gmail.com>
@@ -19,16 +19,16 @@
;;; Commentary:
-;; This file provides a magit-like popup interface for guix shell
-;; commands. You can run a selected command in *shell* buffer, in Guix
-;; REPL, or simply copy it into `kill-ring'.
+;; This file provides a transient interface for guix shell commands.
+;; You can run a selected command in *shell* buffer, in Guix REPL, or
+;; simply copy it into `kill-ring'.
;;
;; The entry point is "M-x guix-command". When it is called the first
;; time, "guix --help" output is parsed and `guix-COMMAND-action'
;; functions are generated for each available guix COMMAND. Then a
;; window with these commands is popped up. When a particular COMMAND
;; is called, "guix COMMAND --help" output is parsed, and a user get a
-;; new popup window with available options for this command and so on.
+;; new transient window with available options for this command and so on.
;; To avoid hard-coding all guix options, actions, etc., as much data is
;; taken from "guix ... --help" outputs as possible. But this data is
@@ -40,7 +40,7 @@
;; structures.
;; Only "M-x guix-command" is available after this file is loaded. The
-;; rest commands/actions/popups are generated on the fly only when they
+;; rest commands/actions/transients are generated on the fly only when they
;; are needed (that's why there is a couple of `eval'-s in this file).
;; COMMANDS argument is used by many functions in this file. It means a
@@ -48,7 +48,7 @@
;; ("import" "gnu"). The empty list stands for the plain "guix" without
;; subcommands.
-;; All actions in popup windows are divided into 2 groups:
+;; All actions in transient windows are divided into 2 groups:
;;
;; - 'Popup' actions - used to pop up another window. For example, every
;; action in the 'guix' or 'guix import' window is a popup action. They
@@ -56,13 +56,13 @@
;;
;; - 'Execute' actions - used to do something with the command line (to
;; run a command in Guix REPL or to copy it into kill-ring) constructed
-;; with the current popup. They are defined by
+;; with the current transient. They are defined by
;; `guix-command-define-execute-action' macro.
;;; Code:
(require 'cl-lib)
-(require 'magit-popup)
+(require 'transient)
(require 'bui-utils)
(require 'guix nil t)
(require 'guix-utils)
@@ -74,7 +74,7 @@
(require 'guix-external)
(defgroup guix-commands nil
- "Settings for guix popup windows."
+ "Settings for guix transient windows."
:group 'guix)
(defvar guix-command-complex-with-shared-arguments
@@ -484,10 +484,10 @@ to be modified."
argument))
(defun guix-command-improve-arguments (arguments commands)
- "Return ARGUMENTS for 'guix COMMANDS ...' modified for popup interface."
+ "Return ARGUMENTS for 'guix COMMANDS ...' modified for transient interface."
(let ((improvers (cons 'guix-command-improve-common-argument
(bui-assoc-value guix-command-argument-improvers
- commands))))
+ commands))))
(mapcar (lambda (argument)
(guix-command-improve-argument argument improvers))
arguments)))
@@ -592,7 +592,7 @@ commands.")
"Return additional arguments for COMMANDS."
(let ((rest-arg (guix-command-rest-argument commands)))
(append (bui-assoc-value guix-command-additional-arguments
- commands)
+ commands)
(and rest-arg (list rest-arg)))))
;; Ideally, only `guix-command-all-arguments' function should exist with
@@ -611,7 +611,7 @@ commands.")
(defun guix-command-all-arguments (&optional commands)
;; Note: `guix-command-arguments' name cannot be used because function
- ;; with this name is generated by `magit-define-popup'.
+ ;; with this name is generated by `transient-define-prefix'.
"Return list of arguments for 'guix COMMANDS ...'."
(let ((command (car commands)))
(if (member command
@@ -634,28 +634,25 @@ commands.")
(guix-command--all-arguments-memoize (list command))))
(guix-command--all-arguments commands))))
-(defun guix-command-switch->popup-switch (switch)
- "Return popup switch from command SWITCH argument."
- (list (guix-command-argument-char switch)
+(defun guix-command-switch->transient-switch (switch)
+ "Return transient switch from command SWITCH argument."
+ (list (format "-%c" (guix-command-argument-char switch))
+ (guix-command-argument-name switch)
(or (guix-command-argument-doc switch)
- "Unknown")
- (guix-command-argument-name switch)))
+ "Unknown")))
-(defun guix-command-option->popup-option (option)
- "Return popup option from command OPTION argument."
- (list (guix-command-argument-char option)
+(defun guix-command-option->transient-option (option)
+ "Return transient option from command OPTION argument."
+ (list (format "-%c" (guix-command-argument-char option))
+ (guix-command-argument-name option)
(or (guix-command-argument-doc option)
"Unknown")
- (let ((name (guix-command-argument-name option)))
- (if (string-match-p " \\'" name) ; ends with space
- name
- (concat name "=")))
(or (guix-command-argument-fun option)
'read-from-minibuffer)))
-(defun guix-command-action->popup-action (action)
- "Return popup action from command ACTION argument."
- (list (guix-command-argument-char action)
+(defun guix-command-action->transient-suffix (action)
+ "Return transient suffix from command ACTION argument."
+ (list (format "-%c" (guix-command-argument-char action))
(or (guix-command-argument-doc action)
(guix-command-argument-name action)
"Unknown")
@@ -683,8 +680,8 @@ commands.")
"Return actions from ARGUMENTS."
(cl-remove-if-not #'guix-command-argument-action? arguments))
-
-;;; Post processing popup arguments
+
+;;; Post processing transient arguments
(defvar guix-command-post-processors
'(("environment"
@@ -698,7 +695,7 @@ commands.")
("system"
guix-command-post-process-rest-single))
"Alist of guix commands and functions for post-processing
-a list of arguments returned from popup interface.
+a list of arguments returned from transient interface.
Each function is called on the returned arguments in turn.")
(defvar guix-command-rest-arg-regexp
@@ -760,13 +757,13 @@ Leave '--' string as a separate argument."
:split? t))
(defun guix-command-post-process-package-args (args)
- "Adjust popup ARGS for 'guix package' command."
+ "Adjust transient ARGS for 'guix package' command."
(guix-command-post-process-matching-args
args (rx string-start (or "--install " "--remove ") (+ any))
:split? t))
(defun guix-command-post-process-environment-packages (args)
- "Adjust popup ARGS for specified packages of 'guix environment'
+ "Adjust transient ARGS for specified packages of 'guix environment'
command."
(guix-command-post-process-matching-args
args (rx string-start "++packages " (group (+ any)))
@@ -774,14 +771,14 @@ command."
:split? t))
(defun guix-command-post-process-environment-ad-hoc (args)
- "Adjust popup ARGS for '--ad-hoc' argument of 'guix environment'
+ "Adjust transient ARGS for '--ad-hoc' argument of 'guix environment'
command."
(guix-command-post-process-matching-args
args (rx string-start "--ad-hoc " (+ any))
:split? t))
(defun guix-command-post-process-args (commands args)
- "Adjust popup ARGS for guix COMMANDS."
+ "Adjust transient ARGS for guix COMMANDS."
(let* ((command (car commands))
(processors
(append (bui-assoc-value guix-command-post-processors commands)
@@ -931,32 +928,31 @@ open the log file(s)."
;;; Generating popups, actions, etc.
(defmacro guix-command-define-popup-action (name &optional commands)
- "Define NAME function to generate (if needed) and run popup for COMMANDS."
+ "Define NAME function to generate (if needed) and run transient for COMMANDS."
(declare (indent 1) (debug t))
- (let* ((popup-fun (guix-command-symbol `(,@commands "popup")))
+ (let* ((prefix-fun (guix-command-symbol `(,@commands "prefix")))
(doc (format "Call `%s' (generate it if needed)."
- popup-fun)))
+ prefix-fun)))
`(defun ,name (&optional arg)
,doc
(interactive "P")
- (unless (fboundp ',popup-fun)
- (guix-command-generate-popup ',popup-fun ',commands))
- (,popup-fun arg))))
+ (unless (fboundp ',prefix-fun)
+ (guix-command-generate-prefix ',prefix-fun ',commands))
+ (,prefix-fun))))
(defmacro guix-command-define-execute-action (name executor
&optional commands)
"Define NAME function to execute the current action for guix COMMANDS.
EXECUTOR function is called with the current command line arguments."
(declare (indent 1) (debug t))
- (let* ((arguments-fun (guix-command-symbol `(,@commands "arguments")))
- (doc (format "Call `%s' with the current popup arguments."
+ (let* ((doc (format "Call `%s' with the current transient arguments."
executor)))
`(defun ,name (&rest args)
,doc
- (interactive (,arguments-fun))
+ (interactive)
(,executor (append ',commands
(guix-command-post-process-args
- ',commands args))))))
+ ',commands (transient-args (transient-current-command))))))))
(defun guix-command-generate-popup-actions (actions &optional commands)
"Generate 'popup' commands from ACTIONS arguments for guix COMMANDS."
@@ -977,11 +973,11 @@ EXECUTOR function is called with the current command line arguments."
commands (guix-command-argument-name action))
,commands))))))
-(defun guix-command-generate-popup (name &optional commands)
- "Define NAME popup with 'guix COMMANDS ...' interface."
+(defun guix-command-generate-prefix (name &optional commands)
+ "Define NAME prefix with 'guix COMMANDS ...' interface."
(let* ((command (car commands))
(man-page (concat "guix" (and command (concat "-" command))))
- (doc (format "Popup window for '%s' command."
+ (doc (format "Transient for '%s' command."
(guix-concat-strings (cons "guix" commands)
" ")))
(args (guix-command-all-arguments commands))
@@ -998,18 +994,22 @@ EXECUTOR function is called with the current command line arguments."
(guix-command-generate-popup-actions popup-actions commands)
(guix-command-generate-execute-actions execute-actions commands))
(eval
- `(magit-define-popup ,name
+ `(transient-define-prefix ,name ()
,doc
- 'guix-commands
:man-page ,man-page
- :switches ',(mapcar #'guix-command-switch->popup-switch switches)
- :options ',(mapcar #'guix-command-option->popup-option options)
- :actions ',(mapcar #'guix-command-action->popup-action actions)
- :max-a