[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/crux b923d61 082/112: Support creating shells and terminal
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/crux b923d61 082/112: Support creating shells and terminal buffers |
Date: |
Wed, 11 Aug 2021 09:57:58 -0400 (EDT) |
branch: elpa/crux
commit b923d618133d8e6ff82554662f3c94f1e7a13b13
Author: Mathew Robinson <mathew@chasinglogic.io>
Commit: Bozhidar Batsov <bozhidar.batsov@gmail.com>
Support creating shells and terminal buffers
---
crux.el | 33 ++++++++++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/crux.el b/crux.el
index 7a74702..3a498dc 100644
--- a/crux.el
+++ b/crux.el
@@ -99,7 +99,8 @@
:type 'list
:group 'crux)
-(defcustom crux-shell-func
+
+(defcustom crux-term-func
#'crux-ansi-term
"The function used to start the term buffer if it's not already running.
@@ -108,6 +109,15 @@ expected name of the shell buffer."
:type 'symbol
:group 'crux)
+(defcustom crux-shell-func
+ #'crux-eshell
+ "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))
@@ -149,6 +159,10 @@ With a prefix ARG always prompt for command to use."
"The default buffer name used by `crux-visit-term-buffer'.
This variable can be set via .dir-locals.el to provide multi-term support.")
+(defvar crux-shell-buffer-name "shell"
+ "The default buffer name used by `crux-visit-shell-buffer'.
+This variable can be set via .dir-locals.el to provide multi-term support.")
+
(defun crux-start-or-switch-to (function buffer-name)
"Invoke FUNCTION if there is no buffer with BUFFER-NAME.
Otherwise switch to the buffer named BUFFER-NAME. Don't clobber
@@ -166,15 +180,28 @@ the current buffer."
If the process in that buffer died, ask to restart."
(interactive)
(crux-start-or-switch-to (lambda ()
- (apply crux-shell-func (list
crux-term-buffer-name)))
+ (apply crux-term-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)))
;;;###autoload
+(defun crux-visit-shell-buffer ()
+ "Create or visit a shell buffer.
+If the process in that buffer died, ask to restart."
+ (interactive)
+ (crux-start-or-switch-to (lambda ()
+ (apply crux-shell-func (list
crux-shell-buffer-name)))
+ (format "*%s*" crux-shell-buffer-name))
+ (when (and (null (get-buffer-process (current-buffer)))
+ (not (eq major-mode 'eshell)) ; eshell has no process
+ (y-or-n-p "The process has died. Do you want to restart it? "))
+ (kill-buffer-and-window)
+ (crux-visit-shell-buffer)))
+
+;;;###autoload
(defun crux-indent-rigidly-and-copy-to-clipboard (begin end arg)
"Indent region between BEGIN and END by ARG columns and copy to clipboard."
(interactive "r\nP")
- [nongnu] elpa/crux dcd693c 093/112: Rename move-to-mode-line-start to crux-move-to-mode-line-start, (continued)
- [nongnu] elpa/crux dcd693c 093/112: Rename move-to-mode-line-start to crux-move-to-mode-line-start, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux e805ab7 057/112: Use synchronous process for crux-open-with, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 4f5c8fe 059/112: [Fix #46] Address two issues with crux-move-beginning-line (#48), ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 49dc7d7 067/112: Remove unused prefix argument from crux-smart-kill-line, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 903db7b 080/112: Add history on crux and links to emacsredux blog posts, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux ba4a1f3 098/112: Restructure the README a bit, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux a0a34d1 100/112: Fix defcustom types, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux acaaa00e 065/112: Bump the copyright years, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux c79985f 077/112: Saner functions for modifying cases on region for humans, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 308f17d 079/112: Bump the copyright years, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux b923d61 082/112: Support creating shells and terminal buffers,
ELPA Syncer <=
- [nongnu] elpa/crux de603e9 088/112: Add function other-window-or-switch-buffer, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 96d4faa 097/112: Silence byte-compiler warnings, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 501a43c 105/112: Placate byte-compiler, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux d989f2a 110/112: Bump copyright years, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux e0457f6 103/112: Fix a major mode check, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux e3e16c1 066/112: Add a missing space, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux fa064d7 068/112: Remove a bunch of redundant progn usages, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 3e07035 073/112: Add missing autoloads, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 7365fdc 075/112: Add crux-copy-file-preserve-attribute, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux e67d040 078/112: Allow crux-sudo-edit on remote files, ELPA Syncer, 2021/08/11