[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dtache f9c287a925 054/158: Make create session function
From: |
ELPA Syncer |
Subject: |
[elpa] externals/dtache f9c287a925 054/158: Make create session function public |
Date: |
Wed, 19 Jan 2022 18:57:52 -0500 (EST) |
branch: externals/dtache
commit f9c287a925dab66aaf8e8d2a70b406a53c7db728
Author: Niklas Eklund <niklas.eklund@posteo.net>
Commit: Niklas Eklund <niklas.eklund@posteo.net>
Make create session function public
This patch makes the dtache-create-session public, since we need to
expose this function in order to implement for example dtache-shell.
At the same time we also make sure that this function takes care of
starting a monitor for the session.
---
dtache-shell.el | 6 ++----
dtache.el | 49 ++++++++++++++++++++++++-------------------------
test/dtache-test.el | 2 +-
3 files changed, 27 insertions(+), 30 deletions(-)
diff --git a/dtache-shell.el b/dtache-shell.el
index f6072c851f..fded894e84 100755
--- a/dtache-shell.el
+++ b/dtache-shell.el
@@ -171,7 +171,7 @@ cluttering the comint-history with dtach commands."
dtache-shell-new-block-list)
'create
dtache--dtach-mode))
- (session (dtache--create-session
+ (session (dtache-create-session
(substring-no-properties string)))
(command (dtache-dtach-command session))
(shell-command
@@ -179,9 +179,7 @@ cluttering the comint-history with dtach commands."
,@(butlast command)
,(shell-quote-argument (car (last
command))))
" ")))
- (progn
- (dtache-setup-notification session)
- (comint-simple-send proc shell-command))
+ (comint-simple-send proc shell-command)
(comint-simple-send proc string))))
(defun dtache-shell--comint-read-input-ring-advice (orig-fun &rest args)
diff --git a/dtache.el b/dtache.el
index 76ab90404a..1c361b1d63 100644
--- a/dtache.el
+++ b/dtache.el
@@ -356,12 +356,34 @@ nil before closing."
;;;;; Session
+(defun dtache-create-session (command)
+ "Create a `dtache' session from COMMAND."
+ (dtache-create-session-directory)
+ (let ((session
+ (dtache--session-create :id (intern (dtache--create-id command))
+ :command command
+ :type dtache-session-type
+ :open-function dtache-open-session-function
+ :callback-function
dtache-session-callback-function
+ :status-function
dtache-session-status-function
+ :working-directory
(dtache-get-working-directory)
+ :redirect-only (dtache-redirect-only-p
command)
+ :creation-time (time-to-seconds
(current-time))
+ :status 'unknown
+ :output-size 0
+ :session-directory (file-name-as-directory
dtache-session-directory)
+ :host (dtache--host)
+ :metadata (dtache-metadata)
+ :active t)))
+ (dtache--db-insert-entry session)
+ (dtache-start-session-monitor session)
+ session))
+
(defun dtache-start-session (command)
"Start a `dtache' session running COMMAND."
(let* ((dtache--dtach-mode 'new)
- (session (dtache--create-session command))
+ (session (dtache-create-session command))
(dtache-command (dtache-dtach-command session)))
- (dtache-setup-notification session)
(apply #'start-file-process
`("dtache" nil ,dtache-dtach-program ,@dtache-command))))
@@ -608,29 +630,6 @@ Sessions running on current host or localhost are
updated."
;;;;; Session
-(defun dtache--create-session (command)
- "Create a `dtache' session from COMMAND."
- (dtache-create-session-directory)
- (let ((session
- (dtache--session-create :id (intern (dtache--create-id command))
- :command command
- :type dtache-session-type
- :open-function dtache-open-session-function
- :callback-function
dtache-session-callback-function
- :status-function
dtache-session-status-function
- :working-directory
(dtache-get-working-directory)
- :redirect-only (dtache-redirect-only-p
command)
- :creation-time (time-to-seconds
(current-time))
- :status 'unknown
- :output-size 0
- :session-directory (file-name-as-directory
dtache-session-directory)
- :host (dtache--host)
- :metadata (dtache-metadata)
- :active t)))
- ;; Update database
- (dtache--db-insert-entry session)
- session))
-
(defun dtache--session-pid (session)
"Return SESSION's pid."
(let* ((socket
diff --git a/test/dtache-test.el b/test/dtache-test.el
index 930f4c6c68..46134ab602 100644
--- a/test/dtache-test.el
+++ b/test/dtache-test.el
@@ -51,7 +51,7 @@
"Create session with COMMAND running on HOST."
(cl-letf* (((symbol-function #'dtache--host) (lambda () host))
((symbol-function #'dtache-metadata) (lambda () nil))
- (session (dtache--create-session command)))
+ (session (dtache-create-session command)))
(dtache-test--change-session-state session 'activate)
session))
- [elpa] externals/dtache 1cbeb7167e 136/158: Rename magic-command to dtache-command, (continued)
- [elpa] externals/dtache 1cbeb7167e 136/158: Rename magic-command to dtache-command, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 954b642659 074/158: Demote attach commands to functions, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 4778eda4df 085/158: Rename compile-session to post-compile-session, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 06cb91da1d 097/158: Make dtache-session-directory have a default value, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 4284951870 103/158: Make dtache-delete-sessions a command, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache f34f5b8a24 105/158: Harmonize function names, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 9756c43885 114/158: Improve dtache header, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 8baeb44c30 124/158: Remove unused variable, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache c08072612f 127/158: Update rerun command with prefix argument, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache caf2fc4914 154/158: Fix incorrect time, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache f9c287a925 054/158: Make create session function public,
ELPA Syncer <=
- [elpa] externals/dtache bc5bee8f56 062/158: Remove deprecated test files, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache dcdd9cbd8e 071/158: Update dtache-completing-read input, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 884bf8e44d 072/158: Improve dtache function, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 2e1a0d4f0e 075/158: Make attach handle redirect only sessions, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache acf98f042c 141/158: Update README, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 6f45c07a20 148/158: Fix checkdoc and package-lint violations, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 73021b0522 067/158: Improve dtache-shell-command, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 26cb80f343 158/158: Add installation section to README, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache cf9c37579d 153/158: Update time handling in session object, ELPA Syncer, 2022/01/19