[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dtache b247ddc6dd 077/158: Rewrite dtache-dtach-command
From: |
ELPA Syncer |
Subject: |
[elpa] externals/dtache b247ddc6dd 077/158: Rewrite dtache-dtach-command |
Date: |
Wed, 19 Jan 2022 18:57:59 -0500 (EST) |
branch: externals/dtache
commit b247ddc6dd4fc100ffd0c9240beeed41c38be5b3
Author: Niklas Eklund <niklas.eklund@posteo.net>
Commit: Niklas Eklund <niklas.eklund@posteo.net>
Rewrite dtache-dtach-command
Implement the function using defmethod in order to work both for
commands as well as sessions.
---
dtache-shell.el | 3 +--
dtache.el | 36 ++++++++++++++++++++++--------------
2 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/dtache-shell.el b/dtache-shell.el
index 664929cf4c..9d73eb680f 100644
--- a/dtache-shell.el
+++ b/dtache-shell.el
@@ -133,8 +133,7 @@ cluttering the comint-history with dtach commands."
dtache-shell-new-block-list)
'create
dtache--dtach-mode))
- (session (dtache-create-session (substring-no-properties string)))
- (dtach-command (dtache-dtach-command session t)))
+ (dtach-command (dtache-dtach-command (substring-no-properties
string) t)))
(comint-simple-send proc dtach-command)
(comint-simple-send proc string))))
diff --git a/dtache.el b/dtache.el
index af70718a43..364cf355ee 100644
--- a/dtache.el
+++ b/dtache.el
@@ -455,8 +455,7 @@ Optionally SUPPRESS-OUTPUT."
(dtache-redirect-only-p command)))
(let* ((inhibit-message t)
(dtache--dtach-mode 'new)
- (session (dtache-create-session command))
- (dtach-command (dtache-dtach-command session)))
+ (dtach-command (dtache-dtach-command command)))
(apply #'start-file-process
`("dtache" nil ,dtache-dtach-program ,@dtach-command)))
(cl-letf* ((inhibit-message t)
@@ -655,8 +654,17 @@ If session is not valid trigger an automatic cleanup on
SESSION's host."
(dtache--session-macos-monitor session)
(dtache--session-filenotify-monitor session))))
-(defun dtache-dtach-command (session &optional concat)
- "Return a list of arguments to run SESSION.
+(cl-defgeneric dtache-dtach-command (entity &optional concat)
+ "Return dtach command for ENTITY optionally CONCAT.")
+
+(cl-defgeneric dtache-dtach-command ((command string) &optional concat)
+ "Return dtach command for COMMAND.
+
+Optionally CONCAT the command return command into a string."
+ (dtache-dtach-command (dtache-create-session command) concat))
+
+(cl-defgeneric dtache-dtach-command ((session dtache-session) &optional concat)
+ "Return dtach command for SESSION.
Optionally CONCAT the command return command into a string."
(with-connection-local-variables
@@ -674,16 +682,16 @@ Optionally CONCAT the command return command into a
string."
" ")
`(,(dtache--dtach-arg) ,socket))
(if concat
- (mapconcat 'identity
- `(,dtache-dtach-program
- ,(dtache--dtach-arg)
- ,socket "-z"
- ,dtache-shell-program "-c"
- ,(shell-quote-argument (dtache--magic-command
session)))
- " ")
- `(,(dtache--dtach-arg) ,socket "-z"
- ,dtache-shell-program "-c"
- ,(dtache--magic-command session)))))))
+ (mapconcat 'identity
+ `(,dtache-dtach-program
+ ,(dtache--dtach-arg)
+ ,socket "-z"
+ ,dtache-shell-program "-c"
+ ,(shell-quote-argument (dtache--magic-command
session)))
+ " ")
+ `(,(dtache--dtach-arg) ,socket "-z"
+ ,dtache-shell-program "-c"
+ ,(dtache--magic-command session)))))))
(defun dtache-redirect-only-p (command)
"Return t if COMMAND should run in degreaded mode."
- [elpa] externals/dtache 3d89804c20 155/158: Improve dtache--update-session, (continued)
- [elpa] externals/dtache 3d89804c20 155/158: Improve dtache--update-session, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 6037219c0a 018/158: Update documentation, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 199c4cffaa 070/158: Update incorrect regexp for dtache-message, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache b2b2b6ecd1 138/158: Fix error in dtache-attach, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 28cb384d96 143/158: Update attach with fallback, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 7ddd1e29ef 146/158: Fix error on remote hosts, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 9e0acd552d 150/158: Fix typo in dtache-test-dtach-command test, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache b8ab11cda6 091/158: Make sure to set current session in shell command, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache b1e4ead73e 094/158: Remove start-process advice, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 2c4520a3c5 015/158: Add missing variable to tail-mode, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache b247ddc6dd 077/158: Rewrite dtache-dtach-command,
ELPA Syncer <=
- [elpa] externals/dtache 471a2f57c7 058/158: Update dtache-session-annotation, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache e3a12a9dc8 073/158: Add connection local variable to timer, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 9b7e7ffd2e 086/158: Rename session-type to session-origin, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache e8bc20f563 095/158: Fix error in dtache-shell-command, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache c40f0b2203 102/158: Make some public functions private, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 9c16dd3751 109/158: Update active to state, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 3cc493e6b0 115/158: Add missing dtache-log-mode to detach-dwim, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache ebf9b491bd 117/158: Add variable for dtache-shell-command buffer, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache e9f6794621 129/158: Rename log-directory to directory, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 3969524f23 125/158: Improve dtache session header, ELPA Syncer, 2022/01/19