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

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

[elpa] externals/dtache 60ec4c26d1 03/14: Add smart-mode-block-list


From: ELPA Syncer
Subject: [elpa] externals/dtache 60ec4c26d1 03/14: Add smart-mode-block-list
Date: Fri, 13 May 2022 11:57:47 -0400 (EDT)

branch: externals/dtache
commit 60ec4c26d1e3b8915950419167e7abf0bc212376
Author: Niklas Eklund <niklas.eklund@posteo.net>
Commit: Niklas Eklund <niklas.eklund@posteo.net>

    Add smart-mode-block-list
---
 dtache.el | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/dtache.el b/dtache.el
index 9483e7f424..236a95d14e 100644
--- a/dtache.el
+++ b/dtache.el
@@ -92,6 +92,11 @@
   :type 'string
   :group 'dtache)
 
+(defcustom dtache-env-smart-mode-block-list nil
+  "A list of regexps for commands that should be run in dumb mode in 
`dtache-env'."
+  :type 'list
+  :group 'dtache)
+
 (defcustom dtache-annotation-format
   '((:width 3 :function dtache--state-str :face dtache-state-face)
     (:width 3 :function dtache--status-str :face dtache-failure-face)
@@ -1126,10 +1131,20 @@ If SESSION is nonattachable fallback to a command that 
doesn't rely on tee."
          (env (if dtache-env dtache-env (format "%s -c" dtache-shell-program)))
          (command
           (if dtache-env
-              (concat "smart " (shell-quote-argument (dtache--session-command 
session)))
+              (concat (format "%s " (dtache--env-mode (dtache--session-command 
session)))
+                      (shell-quote-argument (dtache--session-command session)))
             (shell-quote-argument (dtache--session-command session)))))
     (format "%s %s %s; %s %s" begin-shell-group env command end-shell-group 
redirect)))
 
+(defun dtache--env-mode (command)
+  "Return mode to run in `dtache-env' based on COMMAND."
+  (if-let ((blocked-command
+            (seq-find (lambda (regexp)
+                        (string-match-p regexp command))
+                      dtache-env-smart-mode-block-list)))
+     'dumb
+    'smart))
+
 (defun dtache--host ()
   "Return a cons with (host . type)."
   (let ((remote (file-remote-p default-directory)))



reply via email to

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