Skip to content

Commit 0833f3b

Browse files
authored
cleanup: fix bunches of warnings when byte-compile (emacs-lsp#279)
1 parent 86fc65d commit 0833f3b

File tree

2 files changed

+45
-41
lines changed

2 files changed

+45
-41
lines changed

dap-mode.el

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ thread exection but the server will log message."
528528
(defun dap--parser-read (p output)
529529
"Parser OUTPUT using parser P."
530530
(let* ((messages '())
531-
(output (string-as-unibyte output))
531+
(output (encode-coding-string output 'utf-8 'nocopy))
532532
(chunk (concat (dap--parser-leftovers p) output)))
533533
(while (not (string-empty-p chunk))
534534
(if (not (dap--parser-reading-body p))
@@ -607,7 +607,7 @@ thread exection but the server will log message."
607607
(interactive (list (dap--cur-active-session-or-die)))
608608
(dap--send-message (dap--make-request "disconnect"
609609
(list :restart :json-false))
610-
(lambda (result)
610+
(lambda (_result)
611611
(when-let (proc (dap--debug-session-program-proc session))
612612
(lsp--info "Killing process %s" proc)
613613
(kill-process proc)))
@@ -890,7 +890,10 @@ PARAMS are the event params.")
890890
debug-session
891891
(gethash "command" parsed-msg)))
892892
(message "Unable to find handler for %s." (pp parsed-msg))))
893-
("request" (-let* (((&hash "arguments" (&hash? "args" "cwd" "title") "command" "seq") parsed-msg)
893+
("request" (-let* (((&hash "arguments"
894+
(&hash? "args" "cwd")
895+
"seq")
896+
parsed-msg)
894897
(default-directory cwd))
895898
(async-shell-command (s-join " " args))
896899
(dap--send-message (dap--make-response seq)
@@ -913,8 +916,8 @@ PARAMS are the event params.")
913916
(list :command command
914917
:type "request")))
915918

916-
(defun dap--make-response (id &optional args)
917-
"Make request for COMMAND with arguments ARGS."
919+
(defun dap--make-response (id &optional _args)
920+
"Make request with ID and arguments ARGS."
918921
(list :request_seq id
919922
:success t
920923
:type "response"))
@@ -1059,10 +1062,10 @@ DEBUG-SESSION is the active debug session."
10591062

10601063
(defun dap--breakpoint-filter-enabled (filter type default)
10611064
(alist-get filter
1062-
(alist-get type dap-exception-breakpoints nil nil #'string=)
1065+
(alist-get type dap-exception-breakpoints nil nil #'equal)
10631066
default
10641067
nil
1065-
#'string=))
1068+
#'equal))
10661069

10671070
(defun dap--set-exception-breakpoints (debug-session callback)
10681071
(-let [(&dap-session 'initialize-result 'launch-args (&plist :type)) debug-session]
@@ -1076,7 +1079,7 @@ DEBUG-SESSION is the active debug session."
10761079
(when (dap--breakpoint-filter-enabled filter type default)
10771080
filter))))
10781081
[])))
1079-
(lambda (result)
1082+
(lambda (_result)
10801083
(funcall callback))
10811084
debug-session)))
10821085

@@ -1444,39 +1447,38 @@ after selecting configuration template."
14441447
(funcall launch-args #'dap-start-debugging)
14451448
(dap-start-debugging launch-args))))
14461449

1447-
(defun dap-debug-edit-template (&optional parg debug-args)
1450+
(defun dap-debug-edit-template (&optional debug-args)
14481451
"Edit registered template DEBUG-ARGS.
14491452
When being invoked with prefix argument, poping up the prepopulated version of the template.
1450-
Otherwise, return its original version. After registration, the new template can be used
1451-
normally with dap-debug"
1452-
1453-
(interactive "P")
1454-
(let ((debug-args (dap--select-template (not parg))))
1455-
(progn
1456-
(with-current-buffer (or (get-buffer "*DAP Templates*")
1457-
(with-current-buffer (get-buffer-create "*DAP Templates*")
1458-
(emacs-lisp-mode)
1459-
(current-buffer)))
1460-
(goto-char (point-max))
1461-
(when (s-blank? (buffer-string))
1462-
(insert ";; Eval Buffer with `M-x eval-buffer' to register the newly created template."))
1463-
(insert
1464-
(format "\n\n(dap-register-debug-template\n \"%s%s\"\n"
1465-
(plist-get debug-args :name)
1466-
(if parg " - Copy" "")))
1467-
(insert " (list ")
1468-
(-let ((column (current-column))
1469-
((fst snd . rst) debug-args))
1470-
(insert (format "%s %s" fst (prin1-to-string snd)))
1471-
(cl-loop for (k v) on rst by (function cddr)
1472-
do (if (not (equal k :program-to-start))
1473-
(progn
1474-
(insert "\n")
1475-
(--dotimes column (insert " "))
1476-
(insert (format "%s %s" k (prin1-to-string v)))))))
1477-
(insert "))"))
1478-
(pop-to-buffer "*DAP Templates*")
1479-
(goto-char (point-max)))))
1453+
Otherwise, return its original version. After registration, the new template can be used
1454+
normally with `dap-debug'"
1455+
(interactive)
1456+
(unless debug-args
1457+
(setq debug-args (dap--select-template (not current-prefix-arg))))
1458+
(with-current-buffer (or (get-buffer "*DAP Templates*")
1459+
(with-current-buffer (get-buffer-create "*DAP Templates*")
1460+
(emacs-lisp-mode)
1461+
(current-buffer)))
1462+
(goto-char (point-max))
1463+
(when (s-blank? (buffer-string))
1464+
(insert ";; Eval Buffer with `M-x eval-buffer' to register the newly created template."))
1465+
(insert
1466+
(format "\n\n(dap-register-debug-template\n \"%s%s\"\n"
1467+
(plist-get debug-args :name)
1468+
(if current-prefix-arg " - Copy" "")))
1469+
(insert " (list ")
1470+
(-let ((column (current-column))
1471+
((fst snd . rst) debug-args))
1472+
(insert (format "%s %s" fst (prin1-to-string snd)))
1473+
(cl-loop for (k v) on rst by (function cddr)
1474+
do (if (not (equal k :program-to-start))
1475+
(progn
1476+
(insert "\n")
1477+
(--dotimes column (insert " "))
1478+
(insert (format "%s %s" k (prin1-to-string v)))))))
1479+
(insert "))"))
1480+
(pop-to-buffer "*DAP Templates*")
1481+
(goto-char (point-max)))
14801482

14811483
(defun dap-debug-last ()
14821484
"Debug last configuration."

dap-ui.el

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ DEBUG-SESSION is the debug session triggering the event."
556556
`(defun ,name (&rest args)
557557
,(format "Code action %s" name)
558558
(interactive)
559+
(ignore args)
559560
(if-let (node (treemacs-node-at-point))
560561
(-let [,(cons '&plist keys) (button-get node :item)]
561562
,@body)
@@ -753,7 +754,8 @@ DEBUG-SESSION is the debug session triggering the event."
753754
(list :variablesReference variables-reference
754755
:name name
755756
:value (read-string (format "Enter value for %s: " name ) value)))
756-
(-lambda (result))
757+
;; FIXME: create properly callback here
758+
#'ignore
757759
session))
758760

759761
(defun dap-ui-render-variables (debug-session variables-reference _node)
@@ -763,7 +765,7 @@ DEBUG-SESSION is the debug session triggering the event."
763765
(dap-request debug-session "variables" :variablesReference)
764766
(gethash "variables")
765767
(-map (-lambda ((&hash "value" "name"
766-
"indexedVariables" indexed-variables
768+
"indexedVariables" _indexed-variables
767769
"variablesReference" variables-reference))
768770
`(:label ,(concat (propertize (format "%s" name)
769771
'face 'font-lock-variable-name-face)

0 commit comments

Comments
 (0)