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

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

[elpa] externals/dape d91fb1ad85 2/6: Extending support for zap notation


From: ELPA Syncer
Subject: [elpa] externals/dape d91fb1ad85 2/6: Extending support for zap notation to create zap history
Date: Sun, 10 Nov 2024 09:57:50 -0500 (EST)

branch: externals/dape
commit d91fb1ad8529b4b1aac15e27c434b0dd7528ae89
Author: Daniel Pettersson <daniel@dpettersson.net>
Commit: Daniel Pettersson <daniel@dpettersson.net>

    Extending support for zap notation to create zap history
---
 dape.el | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/dape.el b/dape.el
index 83f642d8d0..f9768f34bd 100644
--- a/dape.el
+++ b/dape.el
@@ -528,6 +528,10 @@ Functions and symbols:
                         ((const :tag "Adapter type" :type) string)
                         ((const :tag "Request type launch/attach" :request) 
string)))))
 
+(defcustom dape-config-dash-form-p nil
+  "If ENV PROGRAM ARGS sh like string format is preferred."
+  :type 'boolean)
+
 (defcustom dape-default-config-functions
   '(dape-config-autoport dape-config-tramp)
   "Functions applied on config before starting debugging session.
@@ -5105,12 +5109,26 @@ Where ALIST-KEY exists in `dape-configs'."
 
 (defun dape--config-to-string (key post-eval-config)
   "Create string from KEY and POST-EVAL-CONFIG."
-  (let ((config-diff (dape--config-diff key post-eval-config)))
+  (pcase-let* ((config-diff (dape--config-diff key post-eval-config))
+               ((map :env :program :args) config-diff)
+               (zap-form-p (and dape-config-dash-form-p
+                                (or program (and env (not args))))))
+    (when zap-form-p
+      (cl-loop for key in '(:program :env :args) do
+               (setq config-diff (map-delete config-diff key))))
     (concat (when key (format "%s" key))
-            (and-let* ((config-diff)
+            (when-let ((config-diff)
                        (config-str (prin1-to-string config-diff)))
-              (format " %s"
-                      (substring config-str 1 (1- (length config-str))))))))
+              (format " %s" (substring config-str 1 (1- (length config-str)))))
+            (when zap-form-p
+              (concat " -"
+                      (cl-loop for (symbol value) on env by #'cddr
+                               for name = (substring (symbol-name symbol) 1)
+                               concat (format " %s=%s"
+                                              (shell-quote-argument name)
+                                              (shell-quote-argument value)))
+                      (cl-loop for arg in (cons program (append args nil)) 
concat
+                               (format " %s" (shell-quote-argument arg))))))))
 
 (defun dape--config-ensure (config &optional signal)
   "Ensure that CONFIG is executable.



reply via email to

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