branch: externals/detached commit 473fcc2d43f6d7db0bf050749d86fbdb5060c01b Author: Niklas Eklund <niklas.ekl...@posteo.net> Commit: Niklas Eklund <niklas.ekl...@posteo.net>
Rename detached-session-modes - create becomes detached - create-and-attach becomes attached --- detached-compile.el | 6 +++--- detached-eshell.el | 2 +- detached-list.el | 24 ++++++++++++------------ detached-org.el | 2 +- detached-shell.el | 2 +- detached-vterm.el | 2 +- detached.el | 22 +++++++++++----------- test/detached-test.el | 10 +++++----- 8 files changed, 35 insertions(+), 35 deletions(-) diff --git a/detached-compile.el b/detached-compile.el index cc5fcdd934..e231c15843 100644 --- a/detached-compile.el +++ b/detached-compile.el @@ -57,7 +57,7 @@ Optionally enable COMINT if prefix-argument is provided." (detached-session-origin (or detached-session-origin 'compile)) (detached-session-action (or detached-session-action detached-compile-session-action)) - (detached-session-mode (or detached-session-mode 'create-and-attach)) + (detached-session-mode (or detached-session-mode 'attached)) (detached-current-session (detached-create-session command))) (compile command comint))) @@ -69,7 +69,7 @@ Optionally EDIT-COMMAND." (let* ((detached-enabled t) (detached-session-action detached-compile-session-action) (detached-session-origin 'compile) - (detached-session-mode 'create-and-attach) + (detached-session-mode 'attached) (detached-current-session edit-command)) (recompile edit-command))) @@ -110,7 +110,7 @@ Optionally EDIT-COMMAND." "Create a `detached' session before running COMPILATION-START with ARGS." (if detached-enabled (pcase-let ((`(,_command ,mode ,name-function ,highlight-regexp) args)) - (if (eq detached-session-mode 'create) + (if (eq detached-session-mode 'detached) (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 diff --git a/detached-eshell.el b/detached-eshell.el index 43e14a56a1..874499ccbb 100644 --- a/detached-eshell.el +++ b/detached-eshell.el @@ -65,7 +65,7 @@ If prefix-argument directly DETACH from the session." (interactive "P") (let* ((detached-session-origin 'eshell) - (detached-session-mode (if detach 'create 'create-and-attach)) + (detached-session-mode (if detach 'detached 'attached)) (detached-enabled t) (detached-current-session nil)) (advice-add #'eshell-external-command :around #'detached-eshell-external-command) diff --git a/detached-list.el b/detached-list.el index 8f0d8ff8a0..00477254ef 100644 --- a/detached-list.el +++ b/detached-list.el @@ -236,11 +236,11 @@ Optionally TOGGLE-SUPPRESS-OUTPUT." current-prefix-arg)) (let ((detached-session-mode (if toggle-suppress-output - (if (eq 'create (detached--session-initial-mode session)) - 'create-and-attach - 'create) + (if (eq 'detached (detached--session-initial-mode session)) + 'attached + 'detached) (detached--session-initial-mode session)))) - (unless (eq detached-session-mode 'create) + (unless (eq detached-session-mode 'detached) (when-let ((single-window (> (length (window-list)) 1)) (buffer (current-buffer))) (delete-window (get-buffer-window)) @@ -256,11 +256,11 @@ Optionally TOGGLE-SUPPRESS-OUTPUT." current-prefix-arg)) (let ((detached-session-mode (if toggle-suppress-output - (if (eq 'create (detached--session-initial-mode session)) - 'create-and-attach - 'create) + (if (eq 'detached (detached--session-initial-mode session)) + 'attached + 'detached) (detached--session-initial-mode session)))) - (unless (eq detached-session-mode 'create) + (unless (eq detached-session-mode 'detached) (when-let ((single-window (> (length (window-list)) 1)) (buffer (current-buffer))) (delete-window (get-buffer-window)) @@ -805,14 +805,14 @@ If prefix-argument is provided unmark instead of mark." ((eq status 'success) 'detached-state-face) (t 'detached-identifier-face))) (attach-str - (cond ((eq 'create-and-attach (detached--session-initial-mode session)) + (cond ((eq 'attached (detached--session-initial-mode session)) (alist-get 'initially-attached detached-list-state-symbols "?")) - ((eq 'create (detached--session-initial-mode session)) + ((eq 'detached (detached--session-initial-mode session)) (alist-get 'initially-detached detached-list-state-symbols "?")) (t "?"))) (initial-mode-face - (cond ((eq 'create-and-attach (detached--session-initial-mode session)) 'detached-identifier-face) - ((eq 'create (detached--session-initial-mode session)) 'detached-identifier-face) + (cond ((eq 'attached (detached--session-initial-mode session)) 'detached-identifier-face) + ((eq 'detached (detached--session-initial-mode session)) 'detached-identifier-face) (t "?")))) (string-join `(,(propertize status-str 'face status-face) diff --git a/detached-org.el b/detached-org.el index b933419d29..b38c1947a3 100644 --- a/detached-org.el +++ b/detached-org.el @@ -52,7 +52,7 @@ property of :detached t in the org babel src block." (if (alist-get :detached params) (cl-letf* ((detached-session-origin 'org) (detached-session-action detached-org-session-action) - (detached-session-mode 'create) + (detached-session-mode 'detached) (new-command (replace-regexp-in-string "\n" " && " full-body)) (detached-session (detached-create-session new-command)) (dtach-command diff --git a/detached-shell.el b/detached-shell.el index e3489cabe9..4d2634201a 100644 --- a/detached-shell.el +++ b/detached-shell.el @@ -63,7 +63,7 @@ This function also makes sure that the HISTFILE is disabled for local shells." (interactive "P") (let* ((detached-session-origin 'shell) (detached-session-action detached-shell-session-action) - (detached-session-mode (if detach 'create 'create-and-attach)) + (detached-session-mode (if detach 'detached 'attached)) (comint-input-sender #'detached-shell--create-input-sender)) (comint-send-input))) diff --git a/detached-vterm.el b/detached-vterm.el index 4cfd903ca4..050e9337e1 100644 --- a/detached-vterm.el +++ b/detached-vterm.el @@ -57,7 +57,7 @@ Optionally DETACH from it." (detached-session-origin 'vterm) (detached-session-action detached-vterm-session-action) (detached-session-mode - (if detach 'create 'create-and-attach)) + (if detach 'detached 'attached)) (detached-current-session (detached-create-session input)) (command (detached-session-start-command detached-current-session :type 'string))) diff --git a/detached.el b/detached.el index 4fb829888c..7dee55531d 100644 --- a/detached.el +++ b/detached.el @@ -417,7 +417,7 @@ Optionally SUPPRESS-OUTPUT if prefix-argument is provided." (detached-session-action (or detached-session-action detached-shell-command-session-action)) (detached-session-mode (or detached-session-mode - (if suppress-output 'create 'create-and-attach))) + (if suppress-output 'detached 'attached))) (detached-current-session (detached-create-session command))) (detached-start-session command suppress-output))) @@ -710,15 +710,15 @@ Optionally SUPPRESS-OUTPUT." (detached-enabled t)) (if-let ((run-in-background (or suppress-output - (eq detached-session-mode 'create))) - (detached-session-mode 'create)) + (eq detached-session-mode 'detached))) + (detached-session-mode 'detached)) (let ((detached-current-session (or detached-current-session (detached-create-session command)))) (setq detached-enabled nil) (detached-start-detached-session detached-current-session)) - (cl-letf* ((detached-session-mode 'create-and-attach) + (cl-letf* ((detached-session-mode 'attached) (detached-current-session (or detached-current-session (detached-create-session command))) @@ -916,7 +916,7 @@ This function uses the `notifications' library." (let* ((socket (detached--session-file session 'socket t)) (detached-session-mode (detached--session-initial-mode session)) (log (detached--session-file session 'log t)) - (dtach-arg (if (eq 'create (detached--session-initial-mode session)) + (dtach-arg (if (eq 'detached (detached--session-initial-mode session)) "-n" "-c")) (dtach-command-fun (lambda (session) @@ -931,7 +931,7 @@ This function uses the `notifications' library." (shell-quote-argument (detached--detached-command session)) (detached--detached-command session)))))) (command - (if (eq 'create (detached--session-initial-mode session)) + (if (eq 'detached (detached--session-initial-mode session)) (funcall dtach-command-fun session) (if (not (detached-session-degraded-p session)) (funcall dtach-command-fun session) @@ -1613,8 +1613,8 @@ Optionally make the path LOCAL to host." (defun detached--dtach-arg () "Return dtach argument based on `detached-session-mode'." (pcase detached-session-mode - ('create "-n") - ('create-and-attach "-c") + ('detached "-n") + ('attached "-c") ('attach "-a") (_ (error "`detached-session-mode' has an unknown value")))) @@ -2014,10 +2014,10 @@ Optionally CONCAT the command return command into a string." "-n" ,(number-to-string detached-session-context-lines) ,log))) - (cond ((eq 'create detached-session-mode) + (cond ((eq 'detached detached-session-mode) (detached--dtach-command session)) - ((eq 'create-and-attach detached-session-mode) - (let ((detached-session-mode 'create) + ((eq 'attached detached-session-mode) + (let ((detached-session-mode 'detached) (detached-current-session session)) (detached-start-session (detached-session-command session)) (if concat diff --git a/test/detached-test.el b/test/detached-test.el index 10dd888c3a..8d19fd20d1 100644 --- a/test/detached-test.el +++ b/test/detached-test.el @@ -109,7 +109,7 @@ ;; ;; "-F" ;; ;; "-n" ,(number-to-string detached-session-context-lines) ;; ;; ,log))) -;; ;; (setf (detached--session-initial-mode session) 'create-and-attach) +;; ;; (setf (detached--session-initial-mode session) 'attached) ;; ;; (should (equal expected-list (detached-session-start-command session ;; ;; :type 'list)))) @@ -121,7 +121,7 @@ ;; "-F" ;; "-n" ,(number-to-string detached-session-context-lines) ;; ,log))) -;; (setf (detached--session-initial-mode session) 'create-and-attach) +;; (setf (detached--session-initial-mode session) 'attached) ;; (should (equal expected-list (detached-session-start-command session ;; :type 'list)))) @@ -143,7 +143,7 @@ ((symbol-function #'detached--detached-command) (lambda (_) (format "{ detached-command }")))) - (let* ((detached-session-mode 'create-and-attach) + (let* ((detached-session-mode 'attached) (expected `(,detached-dtach-program "-c" ,(detached--session-file session 'socket t) "-z" ,detached-shell-program @@ -238,9 +238,9 @@ `(,session1 ,session3)))))) (ert-deftest detached-test-dtach-arg () - (let ((detached-session-mode 'create)) + (let ((detached-session-mode 'detached)) (should (string= "-n" (detached--dtach-arg)))) - (let ((detached-session-mode 'create-and-attach)) + (let ((detached-session-mode 'attached)) (should (string= "-c" (detached--dtach-arg)))) (let ((detached-session-mode 'attach)) (should (string= "-a" (detached--dtach-arg))))