[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/crux 772123a 081/112: Support using any shell creating fun
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/crux 772123a 081/112: Support using any shell creating function with crux-visit-term-buffer |
Date: |
Wed, 11 Aug 2021 09:57:58 -0400 (EDT) |
branch: elpa/crux
commit 772123a44a1be1bfe763f73a3e5cd3f502b18aca
Author: Mathew Robinson <mathew@chasinglogic.io>
Commit: Bozhidar Batsov <bozhidar.batsov@gmail.com>
Support using any shell creating function with crux-visit-term-buffer
Closes #66
---
crux.el | 33 ++++++++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/crux.el b/crux.el
index 6167a6d..7a74702 100644
--- a/crux.el
+++ b/crux.el
@@ -59,7 +59,7 @@
:group 'crux)
(defcustom crux-shell (getenv "SHELL")
- "The default shell to run with `crux-visit-term-buffer'."
+ "The default shell to run with `crux-ansi-term'."
:type 'string
:group 'crux)
@@ -99,6 +99,28 @@
:type 'list
:group 'crux)
+(defcustom crux-shell-func
+ #'crux-ansi-term
+ "The function used to start the term buffer if it's not already running.
+
+It will be called with a two arguments: the shell to start and the
+expected name of the shell buffer."
+ :type 'symbol
+ :group 'crux)
+
+(defun crux-ansi-term (buffer-name)
+ "Use ansi-term for `crux-visit-term-buffer'"
+ (ansi-term crux-shell buffer-name))
+
+(defun crux-eshell (buffer-name)
+ "Use eshell for `crux-visit-term-buffer'"
+ (let ((eshell-buffer-name (format "*%s*" buffer-name)))
+ (eshell buffer-name)))
+
+(defun crux-shell (buffer-name)
+ "Use eshell for `crux-visit-term-buffer'"
+ (shell (format "*%s*" buffer-name)))
+
;;;###autoload
(defun crux-open-with (arg)
"Open visited file in default external program.
@@ -123,8 +145,8 @@ With a prefix ARG always prompt for command to use."
(with-current-buffer buffer-or-name
major-mode))
-(defvar crux-term-buffer-name "ansi"
- "The default `ansi-term' name used by `crux-visit-term-buffer'.
+(defvar crux-term-buffer-name "ansi-term"
+ "The default buffer name used by `crux-visit-term-buffer'.
This variable can be set via .dir-locals.el to provide multi-term support.")
(defun crux-start-or-switch-to (function buffer-name)
@@ -144,9 +166,10 @@ the current buffer."
If the process in that buffer died, ask to restart."
(interactive)
(crux-start-or-switch-to (lambda ()
- (ansi-term crux-shell (concat
crux-term-buffer-name "-term")))
- (format "*%s-term*" crux-term-buffer-name))
+ (apply crux-shell-func (list
crux-term-buffer-name)))
+ (format "*%s*" crux-term-buffer-name))
(when (and (null (get-buffer-process (current-buffer)))
+ (not (eq major-mode 'eshell-mode)) ; eshell doesn't have a process
(y-or-n-p "The process has died. Do you want to restart it? "))
(kill-buffer-and-window)
(crux-visit-term-buffer)))
- [nongnu] elpa/crux 3b377b4 054/112: Add smart kill line function, (continued)
- [nongnu] elpa/crux 3b377b4 054/112: Add smart kill line function, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 1c2c179 061/112: Improve a docstring, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 2b6ddf0 060/112: Add missing space, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 5a7201a 062/112: Fix a docstring, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 32baf6a 064/112: Bump the development version, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux a71669e 033/112: Merge pull request #17 from jiegec/master, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux cf547b7 037/112: Typo Fix: Missed an s in transpose, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux a6e0a52 043/112: Define a minor mode for crux-reopen-as-root (#28), ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 2cdf266 069/112: Insert literal s-exp instead of printing in crux-eval-and-replace (#50), ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 2b4bf62 074/112: Give crux group to crux-reopen-as-root-mode, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 772123a 081/112: Support using any shell creating function with crux-visit-term-buffer,
ELPA Syncer <=
- [nongnu] elpa/crux b401f45 050/112: [Fix #35] Replace a deprecated function, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux ad42bcf 053/112: Support make `crux-cleanup-buffer-or-region` support makefiles, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux e3c9714 055/112: Make crux-move-beginning-of-line function mode aware (#45), ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 1e591c5 031/112: Merge pull request #16 from jiegec/master, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux ca62859 038/112: Merge pull request #22 from dgtized/fix-tranpose-typo, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux fde9d4b 044/112: Fix malformed header line, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 5b3c815 047/112: Release 0.3, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 3e03d72 049/112: Don't use dash.el function (#34), ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux b60d9f4 051/112: Fix a compilation warning, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 54cc9b8 056/112: Fix typo in crux-top-join-line, ELPA Syncer, 2021/08/11