Function: dape--config-to-string

dape--config-to-string is a natively compiled function defined in dape.el.

Signature

(dape--config-to-string KEY EXPANDED-CONFIG)

Documentation

Create string from KEY and EXPANDED-CONFIG.

Source Code

;; Defined in /nix/store/1fiaif8pifqj2jh65rbg3fkhg3i56q42-emacs-packages-deps/share/emacs/site-lisp/elpa/dape-0.27.1/dape.el
(defun dape--config-to-string (key expanded-config)
  "Create string from KEY and EXPANDED-CONFIG."
  (pcase-let* ((diff (dape--config-diff key expanded-config))
               ((map :env :program :args) expanded-config)
               (zap-form-p (and (eq dape-history-add 'shell-like)
                                (or (stringp program)
                                    (and (consp env) (keywordp (car env))
                                         (not args))))))
    (when zap-form-p
      (cl-loop for key in '(:program :env :args) do
               (setq diff (map-delete diff key))))
    (concat (when key (format "%s" key))
            (when-let* (diff (config-str (prin1-to-string diff)))
              (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))))))))