Function: dape--read-config
dape--read-config is a natively compiled function defined in dape.el.
Signature
(dape--read-config)
Documentation
Read configuration from minibuffer.
Completes from suggested conjurations, a configuration is suggested if
it's for current major-mode and it's available.
See modes and ensure in dape-configs.
Source Code
;; Defined in /nix/store/1fiaif8pifqj2jh65rbg3fkhg3i56q42-emacs-packages-deps/share/emacs/site-lisp/elpa/dape-0.27.1/dape.el
(defun dape--read-config ()
"Read configuration from minibuffer.
Completes from suggested conjurations, a configuration is suggested if
it's for current `major-mode' and it's available.
See `modes' and `ensure' in `dape-configs'."
(run-hooks 'dape-read-config-hook)
(let* ((suggested-configs
(cl-loop for (name . config) in dape-configs
when (and (dape--config-mode-p config)
(ignore-errors (dape--config-ensure config)))
collect (symbol-name name)))
(initial-contents
(or
;; Take `dape-command' if exist
(when dape-command
(dape--config-to-string (car dape-command) (cdr dape-command)))
;; Take first valid history item
(cl-loop for string in dape-history
for (_ config) = (ignore-errors
(dape--config-from-string string))
when (and config
(dape--config-mode-p config)
(ignore-errors (dape--config-ensure config)))
return string)
;; Take first suggested config if only one exist
(when (and (length= suggested-configs 1)
(car suggested-configs))
suggested-configs)))
(default-value
(when initial-contents
(pcase-let ((`(,key ,config)
(ignore-errors (dape--config-from-string initial-contents))))
(list
(dape--config-to-string
key (ignore-errors (dape--config-eval key config 'skip-functions)))
(format "%s " key))))))
(setq dape--minibuffer-last-buffer (current-buffer)
dape--minibuffer-cache nil)
(minibuffer-with-setup-hook
(lambda ()
(setq-local dape--minibuffer-suggestions suggested-configs
comint-completion-addsuffix nil
resize-mini-windows t
max-mini-window-height 0.5
dape--minibuffer-hint-overlay (make-overlay (point) (point))
default-directory (dape-command-cwd)
;; Store origin buffer `dape-configs' value
dape-configs (buffer-local-value
'dape-configs dape--minibuffer-last-buffer))
(set-syntax-table emacs-lisp-mode-syntax-table)
(add-hook 'completion-at-point-functions
#'comint-filename-completion nil t)
(add-hook 'completion-at-point-functions
#'dape--config-completion-at-point nil t)
(add-hook 'after-change-functions
#'dape--minibuffer-hint nil t)
(dape--minibuffer-hint))
(pcase-let*
((str
(let ((history-add-new-input (eq dape-history-add 'input)))
(read-from-minibuffer
"Run adapter: "
initial-contents
(let ((map (make-sparse-keymap)))
(set-keymap-parent map minibuffer-local-map)
(define-key map (kbd "C-M-i") #'completion-at-point)
(define-key map "\t" #'completion-at-point)
;; This mapping is shadowed by `next-history-element'
;; future history (default-value)
(define-key map (kbd "C-c C-k")
(lambda ()
(interactive)
(pcase-let*
((str (buffer-substring (minibuffer-prompt-end)
(point-max)))
(`(,key) (dape--config-from-string str)))
(delete-region (minibuffer-prompt-end)
(point-max))
(insert (format "%s" key) " "))))
map)
nil 'dape-history default-value)))
(`(,key ,config)
(dape--config-from-string (substring-no-properties str)))
(evaled-config
(let ((default-directory (dape--guess-root config)))
(dape--config-eval key config))))
(unless (eq dape-history-add 'input)
(push (dape--config-to-string key evaled-config) dape-history))
evaled-config))))