[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/detached b3fa3b9893 13/38: Move functions to end to pre
From: |
ELPA Syncer |
Subject: |
[elpa] externals/detached b3fa3b9893 13/38: Move functions to end to prepare for deprecation |
Date: |
Thu, 17 Nov 2022 17:57:54 -0500 (EST) |
branch: externals/detached
commit b3fa3b9893ac360d7a588cb175467f8d0e79f32a
Author: Niklas Eklund <niklas.eklund@posteo.net>
Commit: Niklas Eklund <niklas.eklund@posteo.net>
Move functions to end to prepare for deprecation
---
detached.el | 194 ++++++++++++++++++++++++++++++------------------------------
1 file changed, 98 insertions(+), 96 deletions(-)
diff --git a/detached.el b/detached.el
index d659c5d1f9..8d0d8b832d 100644
--- a/detached.el
+++ b/detached.el
@@ -1166,102 +1166,6 @@ This function uses the `notifications' library."
"Return session."
detached-buffer-session)
-(cl-defgeneric detached--shell-command (entity &optional concat)
- "Return shell command for ENTITY optionally CONCAT.")
-
-(cl-defmethod detached--shell-command ((command string) &optional concat)
- "Return shell command for COMMAND.
-
-Optionally CONCAT the command return command into a string."
- (detached--shell-command (detached-create-session command) concat))
-
-(cl-defmethod detached--shell-command ((session detached-session) &optional
concat)
- "Return shell command for SESSION.
-
-Optionally CONCAT the command return command into a string."
- (if (detached--session-degraded session)
- (detached--tail-command session concat)
- (detached--dtach-command session concat)))
-
-(cl-defgeneric detached--tail-command (entity &optional concat)
- "Return tail command for ENTITY optionally CONCAT.")
-
-(cl-defmethod detached--tail-command ((command string) &optional concat)
- "Return tail command for COMMAND.
-
-Optionally CONCAT the command return command into a string."
- (detached--tail-command (detached-create-session command) concat))
-
-(cl-defmethod detached--tail-command ((session detached-session) &optional
concat)
- "Return tail command for SESSION.
-
-Optionally CONCAT the command return command into a string."
- (detached-connection-local-variables
- (let* ((log (detached--session-file session 'log t))
- (tail-command `(,detached-tail-program "-F"
- "-n"
- ,(number-to-string
detached-session-context-lines)
- ,log)))
- (cond ((eq 'create detached-session-mode)
- (detached--dtach-command session))
- ((eq 'create-and-attach detached-session-mode)
- (let ((detached-session-mode 'create)
- (detached-current-session session))
- (detached-start-session (detached--session-command session))
- (if concat
- (string-join tail-command " ")
- tail-command)))
- ((eq 'attach detached-session-mode)
- (if concat
- (string-join tail-command " ")
- tail-command))))))
-
-(cl-defgeneric detached--dtach-command (entity &optional concat)
- "Return dtach command for ENTITY optionally CONCAT.")
-
-(cl-defmethod detached--dtach-command ((command string) &optional concat)
- "Return dtach command for COMMAND.
-
-Optionally CONCAT the command return command into a string."
- (detached--dtach-command (detached-create-session command) concat))
-
-(cl-defmethod detached--dtach-command ((session detached-session) &optional
concat)
- "Return dtach command for SESSION.
-
-Optionally CONCAT the command return command into a string."
- (detached-connection-local-variables
- (let* ((socket (detached--session-file session 'socket t))
- (log (detached--session-file session 'log t))
- (dtach-arg (detached--dtach-arg)))
- (if (eq detached-session-mode 'attach)
- (if concat
- (string-join
- `(,(when detached-show-session-context
- (format "%s -n %s %s;" detached-tail-program
detached-session-context-lines log))
- ,detached-dtach-program
- ,dtach-arg
- ,socket
- "-r none")
- " ")
- (append
- (when detached-show-session-context
- `(,detached-tail-program "-n"
- ,(number-to-string
detached-session-context-lines)
- ,(concat log ";")))
- `(,detached-dtach-program ,dtach-arg ,socket "-r" "none")))
- (if concat
- (string-join
- `(,detached-dtach-program
- ,dtach-arg
- ,socket "-z"
- ,detached-shell-program "-c"
- ,(shell-quote-argument (detached--detached-command session)))
- " ")
- `(,detached-dtach-program
- ,dtach-arg ,socket "-z"
- ,detached-shell-program "-c"
- ,(detached--detached-command session)))))))
-
(defun detached-degraded-command-p (command)
"Return t if COMMAND is degraded."
(>
@@ -2058,6 +1962,104 @@ start searching at NUMBER offset."
(ansi-color-apply-on-region (point-min) (point-max)))
(read-only-mode t))
+;; TODO Deprecate the following functions:
+
+(cl-defgeneric detached--shell-command (entity &optional concat)
+ "Return shell command for ENTITY optionally CONCAT.")
+
+(cl-defmethod detached--shell-command ((command string) &optional concat)
+ "Return shell command for COMMAND.
+
+Optionally CONCAT the command return command into a string."
+ (detached--shell-command (detached-create-session command) concat))
+
+(cl-defmethod detached--shell-command ((session detached-session) &optional
concat)
+ "Return shell command for SESSION.
+
+Optionally CONCAT the command return command into a string."
+ (if (detached--session-degraded session)
+ (detached--tail-command session concat)
+ (detached--dtach-command session concat)))
+
+(cl-defgeneric detached--tail-command (entity &optional concat)
+ "Return tail command for ENTITY optionally CONCAT.")
+
+(cl-defmethod detached--tail-command ((command string) &optional concat)
+ "Return tail command for COMMAND.
+
+Optionally CONCAT the command return command into a string."
+ (detached--tail-command (detached-create-session command) concat))
+
+(cl-defmethod detached--tail-command ((session detached-session) &optional
concat)
+ "Return tail command for SESSION.
+
+Optionally CONCAT the command return command into a string."
+ (detached-connection-local-variables
+ (let* ((log (detached--session-file session 'log t))
+ (tail-command `(,detached-tail-program "-F"
+ "-n"
+ ,(number-to-string
detached-session-context-lines)
+ ,log)))
+ (cond ((eq 'create detached-session-mode)
+ (detached--dtach-command session))
+ ((eq 'create-and-attach detached-session-mode)
+ (let ((detached-session-mode 'create)
+ (detached-current-session session))
+ (detached-start-session (detached--session-command session))
+ (if concat
+ (string-join tail-command " ")
+ tail-command)))
+ ((eq 'attach detached-session-mode)
+ (if concat
+ (string-join tail-command " ")
+ tail-command))))))
+
+(cl-defgeneric detached--dtach-command (entity &optional concat)
+ "Return dtach command for ENTITY optionally CONCAT.")
+
+(cl-defmethod detached--dtach-command ((command string) &optional concat)
+ "Return dtach command for COMMAND.
+
+Optionally CONCAT the command return command into a string."
+ (detached--dtach-command (detached-create-session command) concat))
+
+(cl-defmethod detached--dtach-command ((session detached-session) &optional
concat)
+ "Return dtach command for SESSION.
+
+Optionally CONCAT the command return command into a string."
+ (detached-connection-local-variables
+ (let* ((socket (detached--session-file session 'socket t))
+ (log (detached--session-file session 'log t))
+ (dtach-arg (detached--dtach-arg)))
+ (if (eq detached-session-mode 'attach)
+ (if concat
+ (string-join
+ `(,(when detached-show-session-context
+ (format "%s -n %s %s;" detached-tail-program
detached-session-context-lines log))
+ ,detached-dtach-program
+ ,dtach-arg
+ ,socket
+ "-r none")
+ " ")
+ (append
+ (when detached-show-session-context
+ `(,detached-tail-program "-n"
+ ,(number-to-string
detached-session-context-lines)
+ ,(concat log ";")))
+ `(,detached-dtach-program ,dtach-arg ,socket "-r" "none")))
+ (if concat
+ (string-join
+ `(,detached-dtach-program
+ ,dtach-arg
+ ,socket "-z"
+ ,detached-shell-program "-c"
+ ,(shell-quote-argument (detached--detached-command session)))
+ " ")
+ `(,detached-dtach-program
+ ,dtach-arg ,socket "-z"
+ ,detached-shell-program "-c"
+ ,(detached--detached-command session)))))))
+
(provide 'detached)
;;; detached.el ends here
- [elpa] externals/detached 3dc3651e98 18/38: Add session working directory function, (continued)
- [elpa] externals/detached 3dc3651e98 18/38: Add session working directory function, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 88618a9cee 17/38: Add public function for session command, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 4b3609385d 01/38: Start session rewrite, ELPA Syncer, 2022/11/17
- [elpa] externals/detached f0f9728e2c 31/38: Make local predicate private, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 09b37f681c 30/38: Add detached-with-session macro, ELPA Syncer, 2022/11/17
- [elpa] externals/detached a57a728382 22/38: Remove detached-session-mode 'attach, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 4e36d9de69 10/38: Make current session public, ELPA Syncer, 2022/11/17
- [elpa] externals/detached f896cd9777 32/38: Reformat code, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 0d607044d9 03/38: Add session started predicate, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 4eb5e3e9aa 04/38: Add side effect to start command, ELPA Syncer, 2022/11/17
- [elpa] externals/detached b3fa3b9893 13/38: Move functions to end to prepare for deprecation,
ELPA Syncer <=
- [elpa] externals/detached 1604a7b5b8 11/38: Make detached-buffer-session public, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 26210dc5a8 28/38: Improve the core structure, ELPA Syncer, 2022/11/17