emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/detached f3ee65f6c9 15/22: Rename env-mode to env


From: ELPA Syncer
Subject: [elpa] externals/detached f3ee65f6c9 15/22: Rename env-mode to env
Date: Mon, 30 May 2022 10:57:31 -0400 (EDT)

branch: externals/detached
commit f3ee65f6c99b2360c34937f653dce45c014d5422
Author: Niklas Eklund <niklas.eklund@posteo.net>
Commit: Niklas Eklund <niklas.eklund@posteo.net>

    Rename env-mode to env
---
 CHANGELOG.org         |  2 +-
 README.md             |  2 +-
 detached-compile.el   |  2 +-
 detached-eshell.el    |  4 ++--
 detached.el           | 30 +++++++++++++++---------------
 test/detached-test.el | 10 +++++-----
 6 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/CHANGELOG.org b/CHANGELOG.org
index d0a5e6e141..1149ed8f0e 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -4,7 +4,7 @@
 
 * Development
 - Remove the need for =detached-shell-history-file=, the advice is updated to 
figure out the history file based on the shell program.
-- Remove the need for =detached-env=, the logic of the script is moved into 
the package instead.
+- Remove the need for external =detached-env= script, the logic of the script 
is moved into the package instead.
 - Add =detached-terminal-data-command= which makes it possible for users to 
tweak the command used to run =script=.
 - Bug fix: Since the inception of the package there had been a bug which only 
occurred on remote hosts, and which was caused by =shell= not properly handling 
being adviced.
 - The package makes sure to let-bind the kill-ring before killing input in 
different modes, previously the killed text unintentionally ended up in users 
kill-ring.
diff --git a/README.md b/README.md
index e2f525444d..ab5bd8cf8b 100644
--- a/README.md
+++ b/README.md
@@ -275,7 +275,7 @@ Here a command beginning with `ls` would from now on be 
considered non-attachabl
 
 The package needs to use a trick to get programs programs such as `git` or 
`grep` to show color in their outputs. This is because these commands only use 
colors and ansi sequences if they are being run in a terminal, as opposed to a 
pipe. The package therefore has two different modes, either `plain-text` or 
`terminal-data`. The latter is now the default for all sessions. When in 
`terminal-data` mode the `script` tool is used to make programs run by 
`detached.el` think they are inside of  [...]
 
-The drawback is that there can be commands which generates escape sequences 
that the package supports and will therefore mess up the output for some 
commands. If you detect such an incompatible command you can add a regexp that 
matches that command to the list `detached-env-plain-text-commands`. By doing 
so `detached.el` will be instructed to run those commands in plain-text mode.
+The drawback is that there can be commands which generates escape sequences 
that the package supports and will therefore mess up the output for some 
commands. If you detect such an incompatible command you can add a regexp that 
matches that command to the list `detached-plain-text-commands`. By doing so 
`detached.el` will be instructed to run those commands in plain-text mode.
 
 The tool `script` can have different options depending on version and 
operating system. If you are having trouble with the default settings you 
should update the `detached-terminal-data-command`. Its default is:
 
diff --git a/detached-compile.el b/detached-compile.el
index ef1264c150..d5d328cabc 100644
--- a/detached-compile.el
+++ b/detached-compile.el
@@ -98,7 +98,7 @@ Optionally EDIT-COMMAND."
     (detached-compile--replace-modesetter)
     (when detached-filter-ansi-sequences
       (add-hook 'compilation-filter-hook #'ansi-color-compilation-filter 0 t))
-    (add-hook 'comint-preoutput-filter-functions 
#'detached--detached-env-message-filter 0 t)
+    (add-hook 'comint-preoutput-filter-functions 
#'detached--env-message-filter 0 t)
     (add-hook 'comint-preoutput-filter-functions 
#'detached--dtach-eof-message-filter 0 t)))
 
 ;;;;; Support functions
diff --git a/detached-eshell.el b/detached-eshell.el
index e78dea731b..4c6c758ac1 100644
--- a/detached-eshell.el
+++ b/detached-eshell.el
@@ -136,9 +136,9 @@ If prefix-argument directly DETACH from the session."
   (make-local-variable 'eshell-preoutput-filter-functions)
   (if detached-eshell-mode
       (progn
-        (add-hook 'eshell-preoutput-filter-functions 
#'detached--detached-env-message-filter)
+        (add-hook 'eshell-preoutput-filter-functions 
#'detached--env-message-filter)
         (add-hook 'eshell-preoutput-filter-functions 
#'detached--dtach-eof-message-filter))
-    (remove-hook 'eshell-preoutput-filter-functions 
#'detached--detached-env-message-filter)
+    (remove-hook 'eshell-preoutput-filter-functions 
#'detached--env-message-filter)
     (remove-hook 'eshell-preoutput-filter-functions 
#'detached--dtach-eof-message-filter)))
 
 (provide 'detached-eshell)
diff --git a/detached.el b/detached.el
index 57e37fa4b5..0ce5e93223 100644
--- a/detached.el
+++ b/detached.el
@@ -92,7 +92,7 @@
   :type 'string
   :group 'detached)
 
-(defcustom detached-env-plain-text-commands nil
+(defcustom detached-plain-text-commands nil
   "A list of regexps for commands to run in plain-text mode."
   :type 'list
   :group 'detached)
@@ -168,7 +168,7 @@ If set to a non nil value the latest entry to
   :group 'detached)
 
 (defcustom detached-shell-mode-filter-functions
-  '(detached--detached-env-message-filter
+  '(detached--env-message-filter
     detached--dtach-eof-message-filter)
   "A list of filter functions that are run in `detached-shell-mode'."
   :type 'list
@@ -194,7 +194,7 @@ Valid values are: create, new and attach")
 (defvar detached-metadata-annotators-alist nil
   "An alist of annotators for metadata.")
 
-(defconst detached-session-version "0.7.0"
+(defconst detached-session-version "0.7.1"
   "The version of `detached-session'.
 This version is encoded as [package-version].[revision].")
 
@@ -282,7 +282,7 @@ This version is encoded as [package-version].[revision].")
   (metadata nil :read-only t)
   (host nil :read-only t)
   (attachable nil :read-only t)
-  (env-mode nil :read-only t)
+  (env nil :read-only t)
   (action nil :read-only t)
   (time nil)
   (status nil)
@@ -407,7 +407,7 @@ The session is compiled by opening its output and enabling
   (when (detached-valid-session session)
     (with-temp-buffer
       (insert (detached--session-output session))
-      (when (eq 'terminal-data (detached--session-env-mode session))
+      (when (eq 'terminal-data (detached--session-env session))
         ;; Enable `detached-log-mode' to parse ansi-escape sequences
         (detached-log-mode))
       (kill-new (buffer-string)))))
@@ -508,14 +508,14 @@ Optionally DELETE the session if prefix-argument is 
provided."
         (erase-buffer)
         (insert (detached--session-header session1))
         (insert (detached--session-output session1))
-        (when (eq 'terminal-data (detached--session-env-mode session1))
+        (when (eq 'terminal-data (detached--session-env session1))
           ;; Enable `detached-log-mode' to parse ansi-escape sequences
           (detached-log-mode)))
       (with-current-buffer (get-buffer-create buffer2)
         (erase-buffer)
         (insert (detached--session-header session2))
         (insert (detached--session-output session2))
-        (when (eq 'terminal-data (detached--session-env-mode session2))
+        (when (eq 'terminal-data (detached--session-env session2))
           ;; Enable `detached-log-mode' to parse ansi-escape sequences
           (detached-log-mode)))
       (ediff-buffers buffer1 buffer2))))
@@ -602,7 +602,7 @@ nil before closing."
                                   :size 0
                                   :directory (if detached-local-session 
detached-session-directory
                                                (concat (file-remote-p 
default-directory) detached-session-directory))
-                                  :env-mode (detached--env-mode command)
+                                  :env (detached--env command)
                                   :host (detached--host)
                                   :metadata (detached-metadata)
                                   :state 'unknown)))
@@ -1160,22 +1160,22 @@ If SESSION is non-attachable fallback to a command that 
doesn't rely on tee."
           (if (detached--session-attachable session)
               (format "2>&1 | tee %s" log)
             (format "&> %s" log)))
-         (env (format "%s -c" detached-shell-program))
+         (shell (format "%s -c" detached-shell-program))
          (command
           (shell-quote-argument
            (format "if %s; then true; else echo \"[detached-exit-code: $?]\"; 
fi"
-                   (if (eq 'terminal-data (detached--session-env-mode session))
+                   (if (eq 'terminal-data (detached--session-env session))
                        (format "TERM=eterm-color %s"
                                (format detached-terminal-data-command
                                        (detached--session-command session)))
                      (detached--session-command session))))))
-    (format "%s %s %s; %s %s" begin-shell-group env command end-shell-group 
redirect)))
+    (format "%s %s %s; %s %s" begin-shell-group shell command end-shell-group 
redirect)))
 
-(defun detached--env-mode (command)
-  "Return mode to run in `detached-env' based on COMMAND."
+(defun detached--env (command)
+  "Return the environment to run in COMMAND in."
   (if (seq-find (lambda (regexp)
                   (string-match-p regexp command))
-                detached-env-plain-text-commands)
+                detached-plain-text-commands)
       'plain-text
     'terminal-data))
 
@@ -1210,7 +1210,7 @@ log to deduce the end time."
   (let ((current-time (current-time-string)))
     (secure-hash 'md5 (concat command current-time))))
 
-(defun detached--detached-env-message-filter (str)
+(defun detached--env-message-filter (str)
   "Remove `detached-env' message in STR."
   (replace-regexp-in-string "\n?.*detached-exit-code:.*\n?" "" str))
 
diff --git a/test/detached-test.el b/test/detached-test.el
index 4daa90eedb..61ff14abc5 100644
--- a/test/detached-test.el
+++ b/test/detached-test.el
@@ -212,14 +212,14 @@
                                    :working-directory "/home/user/"
                                    :command "ls -la"
                                    :attachable t
-                                   :env-mode 'terminal-data
+                                   :env 'terminal-data
                                    :id 'foo123))
         (nonattachable-plain-text-session
          (detached--session-create :directory "/tmp/detached/"
                                    :working-directory "/home/user/"
                                    :command "ls -la"
                                    :attachable nil
-                                   :env-mode 'plain-text
+                                   :env 'plain-text
                                    :id 'foo123)))
     (should (string= "{ bash -c if\\ TERM\\=eterm-color\\ script\\ --quiet\\ 
--flush\\ --return\\ --command\\ \\\"ls\\ -la\\\"\\ /dev/null\\;\\ then\\ 
true\\;\\ else\\ echo\\ \\\"\\[detached-exit-code\\:\\ \\$\\?\\]\\\"\\;\\ fi; } 
2>&1 | tee /tmp/detached/foo123.log"
                      (detached--detached-command 
attachable-terminal-data-session)))
@@ -282,11 +282,11 @@ user@machine "))
 user@machine "))
     (should (string= "
user@machine " (detached--dtach-detached-message-filter str)))))
 
-(ert-deftest detached-test-detached-env-message-filter ()
+(ert-deftest detached-test-env-message-filter ()
   (let ((str "output\n\nDetached session exited abnormally with code 127"))
-    (should (string= "output\n" (detached--detached-env-message-filter str))))
+    (should (string= "output\n" (detached--env-message-filter str))))
   (let ((str "output\n\nDetached session finished"))
-    (should (string= "output\n" (detached--detached-env-message-filter str)))))
+    (should (string= "output\n" (detached--env-message-filter str)))))
 
 (provide 'detached-test)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]