[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
15/20: emacs: Add code to run guix command in shell.
From: |
Alex Kost |
Subject: |
15/20: emacs: Add code to run guix command in shell. |
Date: |
Tue, 18 Aug 2015 09:41:13 +0000 |
alezost pushed a commit to branch wip-emacs-popup-ui
in repository guix.
commit 73a1691ffefb0fa68eb23d119c74be9367fe8e5f
Author: Alex Kost <address@hidden>
Date: Sun Aug 16 13:55:25 2015 +0300
emacs: Add code to run guix command in shell.
* emacs/guix-base.el (guix-run-in-shell, guix-run-in-eshell,
guix-run-command-in-shell): New functions.
(guix-run-in-shell-function, guix-shell-buffer-name): New variables.
---
emacs/guix-base.el | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/emacs/guix-base.el b/emacs/guix-base.el
index 5e6873c..2f23bdb 100644
--- a/emacs/guix-base.el
+++ b/emacs/guix-base.el
@@ -1096,6 +1096,42 @@ FILE. With a prefix argument, also prompt for PROFILE."
;;; Executing guix commands
+(defcustom guix-run-in-shell-function #'guix-run-in-shell
+ "Function used to run guix command.
+The function is called with a single argument - a command line string."
+ :type '(choice (function-item guix-run-in-shell)
+ (function-item guix-run-in-eshell)
+ (function :tag "Other function"))
+ :group 'guix)
+
+(defcustom guix-shell-buffer-name "*shell*"
+ "Default name of a shell buffer used for running guix commands."
+ :type 'string
+ :group 'guix)
+
+(declare-function comint-send-input "comint" t)
+
+(defun guix-run-in-shell (string)
+ "Run command line STRING in `guix-shell-buffer-name' buffer."
+ (shell guix-shell-buffer-name)
+ (goto-char (point-max))
+ (insert string)
+ (comint-send-input))
+
+(declare-function eshell-send-input "esh-mode" t)
+
+(defun guix-run-in-eshell (string)
+ "Run command line STRING in eshell buffer."
+ (eshell)
+ (goto-char (point-max))
+ (insert string)
+ (eshell-send-input))
+
+(defun guix-run-command-in-shell (args)
+ "Execute 'guix ARGS ...' command in a shell buffer."
+ (funcall guix-run-in-shell-function
+ (guix-command-string args)))
+
(defun guix-run-command-in-repl (args)
"Execute 'guix ARGS ...' command in Guix REPL."
(guix-eval-in-repl
- 05/20: emacs: Add and use 'guix-concat-strings'., (continued)
- 05/20: emacs: Add and use 'guix-concat-strings'., Alex Kost, 2015/08/18
- 04/20: emacs: Add and use 'guix-while-search'., Alex Kost, 2015/08/18
- 06/20: emacs: Add utils to make symbol and string for guix command., Alex Kost, 2015/08/18
- 08/20: emacs: Add 'guix-any'., Alex Kost, 2015/08/18
- 09/20: emacs: Add 'guix-memoized-defalias' macro., Alex Kost, 2015/08/18
- 13/20: ui: Add 'run-guix'., Alex Kost, 2015/08/18
- 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 <=
- 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, 2015/08/18
- 18/20: emacs: Add popup interface for guix commands., Alex Kost, 2015/08/18