[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
19/23: emacs: Add code to run guix command in shell.
From: |
Alex Kost |
Subject: |
19/23: emacs: Add code to run guix command in shell. |
Date: |
Sun, 30 Aug 2015 15:28:16 +0000 |
alezost pushed a commit to branch master
in repository guix.
commit 7008dffff52b59bb37361e72f4319977a91db2f1
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 d1593e2..4dff0d6 100644
--- a/emacs/guix-base.el
+++ b/emacs/guix-base.el
@@ -1087,6 +1087,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
- 09/23: guix lint: Export checkers and <lint-checker> accessors., (continued)
- 09/23: guix lint: Export checkers and <lint-checker> accessors., Alex Kost, 2015/08/30
- 06/23: emacs: Add utils to copy guix command., Alex Kost, 2015/08/30
- 08/23: emacs: Add 'guix-memoized-defalias' macro., Alex Kost, 2015/08/30
- 07/23: emacs: Add 'guix-any'., Alex Kost, 2015/08/30
- 10/23: emacs: Add 'guix-lint-checker-names'., Alex Kost, 2015/08/30
- 17/23: ui: Add 'run-guix'., Alex Kost, 2015/08/30
- 11/23: guix graph: Export node types and <node-type> accessors., Alex Kost, 2015/08/30
- 12/23: emacs: Add 'guix-graph-type-names'., Alex Kost, 2015/08/30
- 18/23: emacs: Add code to run guix command in REPL., Alex Kost, 2015/08/30
- 15/23: emacs: Add minibuffer readers., Alex Kost, 2015/08/30
- 19/23: emacs: Add code to run guix command in shell.,
Alex Kost <=
- 13/23: emacs: Add 'guix-package-names'., Alex Kost, 2015/08/30
- 14/23: emacs: Add help variables., Alex Kost, 2015/08/30
- 21/23: emacs: Add "guix-popup.el"., Alex Kost, 2015/08/30
- 20/23: doc: Reorganize "Emacs Interface" node., Alex Kost, 2015/08/30
- 23/23: emacs: Use prompt for packages instead popup for edit action., Alex Kost, 2015/08/30
- 16/23: emacs: Add and use alist accessors., Alex Kost, 2015/08/30
- 22/23: emacs: Add popup interface for guix commands., Alex Kost, 2015/08/30