Skip to content

Commit 8b7cbc6

Browse files
committed
`dap-register-debug-template': allow no :name
`dap-register-debug-template' requires a configuration name parameter anyway, so it can be used to infer :name if omitted. Fixes #404.
1 parent 435f8e5 commit 8b7cbc6

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

dap-mode.el

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1493,10 +1493,19 @@ arguments which contain the debug port to use for opening TCP connection."
14931493
(defun dap-register-debug-template (configuration-name configuration-settings)
14941494
"Register configuration template CONFIGURATION-NAME.
14951495
1496-
CONFIGURATION-SETTINGS - plist containing the preset settings for the configuration."
1496+
CONFIGURATION-SETTINGS is a plist containing the preset settings
1497+
for the configuration. If its :name is omitted, it defaults to
1498+
CONFIGURATION-NAME."
14971499
(setq dap-debug-template-configurations
14981500
(delq (assoc configuration-name dap-debug-template-configurations)
14991501
dap-debug-template-configurations))
1502+
;; Use `plist-member' instead of just `plist-get', because :name would
1503+
;; possibly not be properly removed in `dap-start-debugging-noexpand' due to
1504+
;; being specified twice (the inferred name, followed by nil).
1505+
(unless (plist-member configuration-settings :name)
1506+
;; We mustn't modify CONFIGURATION-SETTINGS; `push' is non-destructive.
1507+
(push configuration-name configuration-settings)
1508+
(push :name configuration-settings))
15001509
(add-to-list
15011510
'dap-debug-template-configurations
15021511
(cons configuration-name configuration-settings)))

0 commit comments

Comments
 (0)