branch: externals/detached commit 4e36d9de692525c77a81c0b6bac69fad4a393ed8 Author: Niklas Eklund <niklas.ekl...@posteo.net> Commit: Niklas Eklund <niklas.ekl...@posteo.net>
Make current session public --- detached-compile.el | 22 +++++++++++----------- detached-eshell.el | 2 +- detached-shell.el | 4 ++-- detached-vterm.el | 6 +++--- detached.el | 24 ++++++++++++------------ 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/detached-compile.el b/detached-compile.el index bcf1b6fc29..e19ac4a882 100644 --- a/detached-compile.el +++ b/detached-compile.el @@ -58,7 +58,7 @@ Optionally enable COMINT if prefix-argument is provided." (detached-session-action (or detached-session-action detached-compile-session-action)) (detached-session-mode (or detached-session-mode 'create-and-attach)) - (detached--current-session (detached-create-session command))) + (detached-current-session (detached-create-session command))) (compile command comint))) ;;;###autoload @@ -70,7 +70,7 @@ Optionally EDIT-COMMAND." (detached-session-action detached-compile-session-action) (detached-session-origin 'compile) (detached-session-mode 'create-and-attach) - (detached--current-session edit-command)) + (detached-current-session edit-command)) (recompile edit-command))) (defun detached-compile-kill () @@ -86,7 +86,7 @@ Optionally EDIT-COMMAND." (when (detached-valid-session session) (let* ((detached-enabled t) (detached-session-mode 'attach) - (detached--current-session session) + (detached-current-session session) (detached-local-session (detached--session-local session)) (default-directory (detached--session-directory session))) (compilation-start (detached--session-command session))))) @@ -97,9 +97,9 @@ Optionally EDIT-COMMAND." (defun detached-compile--start (_) "Run in `compilation-start-hook' if `detached-enabled'." (when detached-enabled - (setq-local default-directory (detached--session-working-directory detached--current-session)) - (setq detached--buffer-session detached--current-session) - (setq compile-command (detached--session-command detached--current-session)) + (setq-local default-directory (detached--session-working-directory detached-current-session)) + (setq detached--buffer-session detached-current-session) + (setq compile-command (detached--session-command detached-current-session)) (setq compilation-arguments nil) (detached-compile--replace-modesetter) (when detached-filter-ansi-sequences @@ -112,11 +112,11 @@ Optionally EDIT-COMMAND." (if detached-enabled (pcase-let ((`(,_command ,mode ,name-function ,highlight-regexp) args)) (if (eq detached-session-mode 'create) - (detached-start-detached-session detached--current-session) - (apply compilation-start `(,(if (detached-session-started-p detached--current-session) - (detached-session-attach-command detached--current-session + (detached-start-detached-session detached-current-session) + (apply compilation-start `(,(if (detached-session-started-p detached-current-session) + (detached-session-attach-command detached-current-session :type 'string) - (detached-session-start-command detached--current-session + (detached-session-start-command detached-current-session :type 'string)) ,(or mode 'detached-compilation-mode) ,name-function @@ -131,7 +131,7 @@ Optionally EDIT-COMMAND." (goto-char (point-min)) (when (re-search-forward regexp nil t) (delete-region (match-beginning 0) (match-end 0)) - (insert (detached--session-command detached--current-session)))))) + (insert (detached--session-command detached-current-session)))))) (defun detached-compile--compilation-detached-filter () "Filter to modify the output in a compilation buffer." diff --git a/detached-eshell.el b/detached-eshell.el index 53c943005f..7612bf2e2e 100644 --- a/detached-eshell.el +++ b/detached-eshell.el @@ -67,7 +67,7 @@ If prefix-argument directly DETACH from the session." (let* ((detached-session-origin 'eshell) (detached-session-mode (if detach 'create 'create-and-attach)) (detached-enabled t) - (detached--current-session nil)) + (detached-current-session nil)) (advice-add #'eshell-external-command :around #'detached-eshell-external-command) (call-interactively #'eshell-send-input))) diff --git a/detached-shell.el b/detached-shell.el index d7e58830e3..c080b87c5b 100644 --- a/detached-shell.el +++ b/detached-shell.el @@ -76,7 +76,7 @@ cluttering the `comint-history' with dtach commands." (list (detached-shell--select-session))) (when (detached-valid-session session) (if (detached-session-active-p session) - (cl-letf ((detached--current-session session) + (cl-letf ((detached-current-session session) (comint-input-sender #'detached-shell--attach-input-sender) ((symbol-function 'comint-add-to-input-history) (lambda (_) t))) (setq detached--buffer-session session) @@ -102,7 +102,7 @@ cluttering the `comint-history' with dtach commands." "Attach to `detached--session' and send the attach command to PROC." (let* ((detached-session-mode 'attach) (input - (detached-session-attach-command detached--current-session + (detached-session-attach-command detached-current-session :type 'string))) (comint-simple-send proc input))) diff --git a/detached-vterm.el b/detached-vterm.el index 948fa64f5a..5c5b89eef7 100644 --- a/detached-vterm.el +++ b/detached-vterm.el @@ -58,13 +58,13 @@ Optionally DETACH from it." (detached-session-action detached-vterm-session-action) (detached-session-mode (if detach 'create 'create-and-attach)) - (detached--current-session (detached-create-session input)) - (command (detached-session-start-command detached--current-session + (detached-current-session (detached-create-session input)) + (command (detached-session-start-command detached-current-session :type 'string))) (vterm-send-C-a) (vterm-send-C-k) (process-send-string vterm--process command) - (setq detached--buffer-session detached--current-session) + (setq detached--buffer-session detached-current-session) (vterm-send-C-e) (vterm-send-return))) diff --git a/detached.el b/detached.el index e0596fab69..7c9fe5905b 100644 --- a/detached.el +++ b/detached.el @@ -337,7 +337,7 @@ This version is encoded as [package-version].[revision].") (defvar-local detached--buffer-session nil "The `detached-session' session in current buffer.") -(defvar detached--current-session nil +(defvar detached-current-session nil "The current session.") (defvar detached--session-candidates nil @@ -418,7 +418,7 @@ Optionally SUPPRESS-OUTPUT if prefix-argument is provided." detached-shell-command-session-action)) (detached-session-mode (or detached-session-mode (if suppress-output 'create 'create-and-attach))) - (detached--current-session (detached-create-session command))) + (detached-current-session (detached-create-session command))) (detached-start-session command suppress-output))) ;;;###autoload @@ -712,26 +712,26 @@ Optionally SUPPRESS-OUTPUT." (or suppress-output (eq detached-session-mode 'create))) (detached-session-mode 'create)) - (let ((detached--current-session - (or detached--current-session + (let ((detached-current-session + (or detached-current-session (detached-create-session command)))) (setq detached-enabled nil) (detached-start-detached-session - detached--current-session)) + detached-current-session)) (cl-letf* ((detached-session-mode 'create-and-attach) - (detached--current-session - (or detached--current-session + (detached-current-session + (or detached-current-session (detached-create-session command))) ((symbol-function #'set-process-sentinel) #'ignore) (buffer (detached--generate-buffer detached--shell-command-buffer (lambda (buffer) (not (get-buffer-process buffer))))) - (command (detached-session-start-command detached--current-session + (command (detached-session-start-command detached-current-session :type 'string))) (setq detached-enabled nil) (funcall #'async-shell-command command buffer) (with-current-buffer buffer - (setq detached--buffer-session detached--current-session)))))) + (setq detached--buffer-session detached-current-session)))))) (defun detached-start-detached-session (session) "Start SESSION in detached mode." @@ -894,7 +894,7 @@ This function uses the `notifications' library." (defun detached-shell-command-attach-session (session) "Attach to SESSION with `async-shell-command'." - (let* ((detached--current-session session) + (let* ((detached-current-session session) (detached-session-mode 'attach) (inhibit-message t)) (cl-letf* (((symbol-function #'set-process-sentinel) #'ignore) @@ -907,7 +907,7 @@ This function uses the `notifications' library." (funcall #'async-shell-command command buffer) (with-current-buffer buffer (setq-local default-directory (detached--session-working-directory session)) - (setq detached--buffer-session detached--current-session))))) + (setq detached--buffer-session detached-current-session))))) ;;;;; Public session functions @@ -1206,7 +1206,7 @@ Optionally CONCAT the command return command into a string." (detached--dtach-command session)) ((eq 'create-and-attach detached-session-mode) (let ((detached-session-mode 'create) - (detached--current-session session)) + (detached-current-session session)) (detached-start-session (detached--session-command session)) (if concat (string-join tail-command " ")