branch: externals/dape commit c41ee1c2596a520262ef82b9ee3e12a348e20df1 Author: Daniel Pettersson <dan...@dpettersson.net> Commit: Daniel Pettersson <dan...@dpettersson.net>
Fixing build warnings from usage of when-let and if-let --- dape.el | 250 ++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 125 insertions(+), 125 deletions(-) diff --git a/dape.el b/dape.el index 8eeffe6a29..97100dbd8f 100644 --- a/dape.el +++ b/dape.el @@ -242,8 +242,8 @@ ,@(let ((js-debug `( ensure ,(lambda (config) (dape-ensure-command config) - (when-let ((runtime-executable - (dape-config-get config :runtimeExecutable))) + (when-let* ((runtime-executable + (dape-config-get config :runtimeExecutable))) (dape--ensure-executable runtime-executable)) (let ((dap-debug-server-path (car (plist-get config 'command-args)))) @@ -307,9 +307,9 @@ command-args ["--interpreter=vscode"] :request "launch" :cwd dape-cwd - :program (if-let ((dlls - (file-expand-wildcards - (file-name-concat "bin" "Debug" "*" "*.dll")))) + :program (if-let* ((dlls + (file-expand-wildcards + (file-name-concat "bin" "Debug" "*" "*.dll")))) (file-relative-name (file-relative-name (car dlls))) ".dll") :stopAtEntry nil) @@ -357,7 +357,7 @@ fn (lambda (config) (with-current-buffer (find-file-noselect (dape-config-get config :filePath)) - (if-let ((server (eglot-current-server))) + (if-let* ((server (eglot-current-server))) (pcase-let ((`[,module-paths ,class-paths] (eglot-execute-command server "vscode.java.resolveClasspath" @@ -961,7 +961,7 @@ by `dape--threads-make-update-handle'." (defun dape--thread-id-object (conn) "Construct a thread id object for CONN." - (when-let ((thread-id (dape--thread-id conn))) + (when-let* ((thread-id (dape--thread-id conn))) (list :threadId thread-id))) (defun dape--stopped-threads (conn) @@ -1034,28 +1034,28 @@ See `dape--path-1'." "Return marker created from PLIST and CONN config. Marker is created from PLIST keys :source and :line. Note requires `dape--source-ensure' if source is by reference." - (when-let ((source (plist-get plist :source)) - (line (or (plist-get plist :line) 1)) - (buffer (or - ;; Take buffer by source reference - (when-let* ((reference (plist-get source :sourceReference)) - (buffer (plist-get dape--source-buffers reference)) - ((buffer-live-p buffer))) - buffer) - ;; Take buffer by path - (when-let* ((remote-path (plist-get source :path)) - (path (dape--path-local conn remote-path)) - ((file-exists-p path))) - (find-file-noselect path t))))) + (when-let* ((source (plist-get plist :source)) + (line (or (plist-get plist :line) 1)) + (buffer (or + ;; Take buffer by source reference + (when-let* ((reference (plist-get source :sourceReference)) + (buffer (plist-get dape--source-buffers reference)) + ((buffer-live-p buffer))) + buffer) + ;; Take buffer by path + (when-let* ((remote-path (plist-get source :path)) + (path (dape--path-local conn remote-path)) + ((file-exists-p path))) + (find-file-noselect path t))))) (dape--with-line buffer line - (when-let ((column (plist-get plist :column))) + (when-let* ((column (plist-get plist :column))) (when (> column 0) (forward-char (1- column)))) (point-marker)))) (defun dape--default-cwd () "Try to guess current project absolute file path with `project'." - (or (when-let ((project (project-current))) + (or (when-let* ((project (project-current))) (expand-file-name (project-root project))) default-directory)) @@ -1104,9 +1104,9 @@ the value of config key `port'." ((eq arg :autoport) port-string) ((stringp arg) (string-replace ":autoport" port-string arg)) (t arg))))) - (when-let ((command-args (plist-get config 'command-args))) + (when-let* ((command-args (plist-get config 'command-args))) (plist-put config 'command-args (seq-map replace-fn command-args))) - (when-let ((command-env (plist-get config 'command-env))) + (when-let* ((command-env (plist-get config 'command-env))) (plist-put config 'command-env (cl-loop for (key value) on command-env by #'cddr collect key @@ -1166,7 +1166,7 @@ as is." (config (and conn ;; If child connection check parent - (or (when-let ((parent (dape--parent conn))) + (or (when-let* ((parent (dape--parent conn))) (dape--config parent)) (dape--config conn)))) (root-guess (dape--guess-root config)) @@ -1667,10 +1667,10 @@ See `dape-request' for expected CB signature." (defun dape--set-breakpoints (conn cb) "Set breakpoints for adapter CONN. See `dape-request' for expected CB signature." - (if-let ((sources - (thread-last dape--breakpoints - (seq-group-by #'dape--breakpoint-source) - (mapcar #'car)))) + (if-let* ((sources + (thread-last dape--breakpoints + (seq-group-by #'dape--breakpoint-source) + (mapcar #'car)))) (cl-loop with responses = 0 for source in sources do (dape--with-request (dape--set-breakpoints-in-source conn source) @@ -1723,11 +1723,11 @@ See `dape-request' for expected CB signature." (setf (dape--threads conn) (mapcar (lambda (new-thread) - (if-let ((old-thread - (cl-find-if (lambda (old-thread) - (eql (plist-get new-thread :id) - (plist-get old-thread :id))) - (dape--threads conn)))) + (if-let* ((old-thread + (cl-find-if (lambda (old-thread) + (eql (plist-get new-thread :id) + (plist-get old-thread :id))) + (dape--threads conn)))) (plist-put old-thread :name (plist-get new-thread :name)) new-thread)) (append threads nil))) @@ -1880,8 +1880,8 @@ Runs the appropriate hooks on non error response." (defun dape--scopes (conn stack-frame cb) "Send scopes request to CONN for STACK-FRAME plist. See `dape-request' for expected CB signature." - (if-let ((id (plist-get stack-frame :id)) - ((not (plist-get stack-frame :scopes)))) + (if-let* ((id (plist-get stack-frame :id)) + ((not (plist-get stack-frame :scopes)))) (dape--with-request-bind ((&key scopes &allow-other-keys) error) (dape-request conn "scopes" (list :frameId id)) @@ -1927,7 +1927,7 @@ selected stack frame." "Handle runInTerminal requests. Starts a new adapter CONNs from ARGUMENTS." (let ((default-directory - (or (when-let ((cwd (plist-get arguments :cwd))) + (or (when-let* ((cwd (plist-get arguments :cwd))) (dape--path-local conn cwd)) default-directory)) (process-environment @@ -2009,18 +2009,18 @@ BODY is an plist of adapter capabilities." (cl-defmethod dape-handle-event (conn (_event (eql breakpoint)) body) "Handle adapter CONNs breakpoint events. Update `dape--breakpoints' according to BODY." - (when-let ((update (plist-get body :breakpoint)) - (id (plist-get update :id))) + (when-let* ((update (plist-get body :breakpoint)) + (id (plist-get update :id))) ;; Until `:reason' gets properly speced, try to infer update ;; intention, would prefer `pcase' on `:reason'. - (if-let ((breakpoint - (cl-find id dape--breakpoints - :key (lambda (breakpoint) - (plist-get (dape--breakpoint-id breakpoint) conn))))) + (if-let* ((breakpoint + (cl-find id dape--breakpoints + :key (lambda (breakpoint) + (plist-get (dape--breakpoint-id breakpoint) conn))))) (dape--breakpoint-update conn breakpoint update) (unless (equal (plist-get body :reason) "removed") (dape--with-request (dape--source-ensure conn update) - (when-let ((marker (dape--object-to-marker conn update))) + (when-let* ((marker (dape--object-to-marker conn update))) (dape--with-line (marker-buffer marker) (plist-get update :line) (dape--message "Creating breakpoint in %s:%d" (buffer-name) (plist-get update :line)) @@ -2157,7 +2157,7 @@ Sets `dape--thread-id' from BODY if not set." (cl-defmethod dape-handle-event (_conn (_event (eql output)) body) "Handle output events by printing BODY with `dape--repl-message'." - (when-let ((output (plist-get body :output))) + (when-let* ((output (plist-get body :output))) (pcase (plist-get body :category) ((or "stdout" "console" "output") (dape--repl-insert output)) ("stderr" (dape--repl-insert-error output))))) @@ -2311,7 +2311,7 @@ symbol `dape-connection'." ;; When connection w/o parent cleanup in source buffer UI (dape--stack-frame-cleanup) ;; Cleanup server process - (when-let ((server-process (dape--server-process conn))) + (when-let* ((server-process (dape--server-process conn))) (delete-process (process-get server-process 'stderr-pipe)) (delete-process server-process) (while (process-live-p server-process) @@ -2480,9 +2480,9 @@ Expressions within `{}` are interpolated." (interactive (list (read-string "Log (Expressions within {} are interpolated): " - (when-let ((breakpoint - (cl-find 'log (dape--breakpoints-at-point) - :key #'dape--breakpoint-type))) + (when-let* ((breakpoint + (cl-find 'log (dape--breakpoints-at-point) + :key #'dape--breakpoint-type))) (dape--breakpoint-value breakpoint))))) (if (string-empty-p message) (dape-breakpoint-remove-at-point) @@ -2494,9 +2494,9 @@ Expressions within `{}` are interpolated." (interactive (list (read-string "Condition: " - (when-let ((breakpoint - (cl-find 'expression (dape--breakpoints-at-point) - :key #'dape--breakpoint-type))) + (when-let* ((breakpoint + (cl-find 'expression (dape--breakpoints-at-point) + :key #'dape--breakpoint-type))) (dape--breakpoint-value breakpoint))))) (if (string-empty-p expression) (dape-breakpoint-remove-at-point) @@ -2622,10 +2622,10 @@ NO-REMOVE limits usage to only adding watched vars." (or (and (region-active-p) (buffer-substring (region-beginning) (region-end))) (thing-at-point 'symbol)))))) - (if-let ((watched - (cl-find expression dape--watched - :key (lambda (plist) (plist-get plist :name)) - :test #'equal))) + (if-let* ((watched + (cl-find expression dape--watched + :key (lambda (plist) (plist-get plist :name)) + :test #'equal))) (unless no-remove (setq dape--watched (cl-delete watched dape--watched))) (unless no-add @@ -2687,9 +2687,9 @@ For more information see `dape-configs'." ;; Hooks need to be run before any REPL messaging but after we ;; have tried ensured that config is executable. (run-hooks 'dape-start-hook) - (when-let ((fn (or (plist-get config 'fn) 'identity)) - (fns (or (and (functionp fn) (list fn)) - (and (listp fn) fn)))) + (when-let* ((fn (or (plist-get config 'fn) 'identity)) + (fns (or (and (functionp fn) (list fn)) + (and (listp fn) fn)))) (setq config (seq-reduce (lambda (config fn) (funcall fn config)) (append fns dape-default-config-functions) @@ -2838,7 +2838,7 @@ of memory read." (interactive (list (string-trim (read-string "Address: " nil nil - (when-let ((number (thing-at-point 'number))) + (when-let* ((number (thing-at-point 'number))) (format "0x%08x" number)))))) (let ((conn (dape--live-connection 'stopped))) (unless (dape--capable-p conn :supportsReadMemoryRequest) @@ -2884,7 +2884,7 @@ of memory read." (list (string-trim (read-string "Address: " nil nil - (when-let ((number (thing-at-point 'number))) + (when-let* ((number (thing-at-point 'number))) (format "0x%08x" number)))) 100)) (if-let* ((conn (dape--live-connection 'stopped)) @@ -3161,7 +3161,7 @@ Handling restoring margin if necessary." ;; Reset margin (setq-local left-margin-width dape--original-margin dape--original-margin nil) - (when-let ((window (get-buffer-window buffer))) + (when-let* ((window (get-buffer-window buffer))) (set-window-buffer window buffer))))) (defun dape--breakpoint-remove (breakpoint &optional skip-update) @@ -3177,7 +3177,7 @@ When SKIP-UPDATE is non nil, does not notify adapter about removal." (defun dape--breakpoint-source (breakpoint) "Return the source of BREAKPOINT. The source is either a buffer or a file path." - (if-let ((buffer (dape--breakpoint-buffer breakpoint))) + (if-let* ((buffer (dape--breakpoint-buffer breakpoint))) buffer (dape--breakpoint-path breakpoint))) @@ -3293,8 +3293,8 @@ See `dape-request' for expected CB signature." (plist-get source :sourceReference) buffer)) (with-current-buffer buffer (when mimeType - (if-let ((mode - (alist-get mimeType dape-mime-mode-alist nil nil 'equal))) + (if-let* ((mode + (alist-get mimeType dape-mime-mode-alist nil nil 'equal))) (unless (eq major-mode mode) (funcall mode)) (message "Unknown mime type %s, see `dape-mime-mode-alist'" @@ -3319,7 +3319,7 @@ See `dape-request' for expected CB signature." (defun dape--stack-frame-cleanup () "Cleanup after `dape--stack-frame-display'." - (when-let ((buffer (marker-buffer dape--overlay-arrow-position))) + (when-let* ((buffer (marker-buffer dape--overlay-arrow-position))) (with-current-buffer buffer (dape--remove-eldoc-hook))) (when (overlayp dape--stack-position-overlay) @@ -3332,7 +3332,7 @@ Helper for `dape--stack-frame-display'." (dape--with-request (dape--source-ensure conn frame) ;; Delete overlay before dropping the reference (dape--stack-frame-cleanup) - (when-let ((marker (dape--object-to-marker conn frame))) + (when-let* ((marker (dape--object-to-marker conn frame))) (with-current-buffer (marker-buffer marker) (dape--add-eldoc-hook) (save-excursion @@ -3354,9 +3354,9 @@ Helper for `dape--stack-frame-display'." ;; Move `overaly-arrow' arrow to point (move-marker dape--overlay-arrow-position (line-beginning-position))) - (when-let ((window - (display-buffer (marker-buffer marker) - dape-display-source-buffer-action))) + (when-let* ((window + (display-buffer (marker-buffer marker) + dape-display-source-buffer-action))) ;; Change selected window if not `dape-repl' buffer is selected (unless (with-current-buffer (window-buffer) (memq major-mode '(dape-repl-mode dape-disassemble-mode))) @@ -3390,17 +3390,17 @@ Buffer is displayed with `dape-display-source-buffer-action'." (cl-loop for frame in cell for source = (plist-get frame :source) when - (or (when-let ((reference (plist-get source :sourceReference))) + (or (when-let* ((reference (plist-get source :sourceReference))) (< 0 reference)) (when-let* ((remote-path (plist-get source :path)) (path (dape--path-local conn remote-path))) (file-exists-p path))) return frame)))) ;; Check if `displayable-frame' PLIST exist, otherwise fetch all - (if-let ((frame (displayable-frame))) + (if-let* ((frame (displayable-frame))) (dape--stack-frame-display-1 conn frame deepest-p) (dape--with-request (dape--stack-trace conn thread dape-stack-trace-levels) - (when-let ((frame (displayable-frame))) + (when-let* ((frame (displayable-frame))) (dape--stack-frame-display-1 conn frame deepest-p)))))))) @@ -3514,7 +3514,7 @@ FN is expected to update insert buffer contents, update (let ((line (line-number-at-pos (point) t)) (old-window (selected-window))) ;; Try to keep point and scroll - (when-let ((window (get-buffer-window))) + (when-let* ((window (get-buffer-window))) (select-window window)) (save-window-excursion (let ((inhibit-read-only t)) @@ -3618,7 +3618,7 @@ buffers get displayed and how they are grouped." (cl-loop for scope in scopes for var upfrom 0 collect `(dape-info-scope-mode ,var ,(plist-get scope :name)))) ((and (eq 'dape-info-scope-mode mode) var) - (when-let ((scope (nth var scopes))) + (when-let* ((scope (nth var scopes))) `((dape-info-scope-mode ,var ,(plist-get scope :name))))) (`((,mode nil ,(alist-get mode dape--info-buffer-name-alist)))))) header-line-format @@ -3689,7 +3689,7 @@ without log or expression breakpoint")))))) (setq dape--data-breakpoints (delq dape--info-data-breakpoint dape--data-breakpoints)) - (when-let ((conn (dape--live-connection 'stopped t))) + (when-let* ((conn (dape--live-connection 'stopped t))) (dape--with-request (dape--set-data-breakpoints conn))) (revert-buffer) (run-hooks 'dape-update-ui-hook)) @@ -3736,7 +3736,7 @@ without log or expression breakpoint")))))) table (list (cond ((dape--breakpoint-disabled breakpoint) n) - ((when-let ((hits (dape--breakpoint-hits breakpoint))) + ((when-let* ((hits (dape--breakpoint-hits breakpoint))) (format "%s" hits))) (y)) (pcase (dape--breakpoint-type breakpoint) @@ -3745,14 +3745,14 @@ without log or expression breakpoint")))))) ('expression "Cond ") (_ "Break")) (cond - ((when-let ((buffer (dape--breakpoint-buffer breakpoint))) + ((when-let* ((buffer (dape--breakpoint-buffer breakpoint))) (concat - (if-let ((file (buffer-file-name buffer))) + (if-let* ((file (buffer-file-name buffer))) (dape--format-file-line file line) (format "%s:%d" (buffer-name buffer) line)) (dape--with-line buffer line (concat " " (string-trim (or (thing-at-point 'line) ""))))))) - ((when-let ((path (dape--breakpoint-path breakpoint))) + ((when-let* ((path (dape--breakpoint-path breakpoint))) (dape--format-file-line path line))))) `( dape--info-breakpoint ,breakpoint keymap ,dape-info-breakpoints-line-map @@ -3770,7 +3770,7 @@ without log or expression breakpoint")))))) 'font-lock-face 'font-lock-variable-name-face) (plist-get plist :accessType) - (when-let ((data-id (plist-get plist :dataId))) + (when-let* ((data-id (plist-get plist :dataId))) (format "(%s)" data-id)))) (list 'dape--info-data-breakpoint plist 'keymap dape-info-data-breakpoints-line-map))) @@ -3884,7 +3884,7 @@ See `dape-request' for expected CB signature." (concat (plist-get thread :name) " " - (if-let ((status (plist-get thread :status))) + (if-let* ((status (plist-get thread :status))) (format "%s" status) "unknown") (if-let* (((equal (plist-get thread :status) 'stopped)) @@ -3898,9 +3898,9 @@ See `dape-request' for expected CB signature." (path (dape--path-local conn path)) (line (plist-get top-stack :line))) (concat " of " (dape--format-file-line path line))) - (when-let ((dape-info-thread-buffer-addresses) - (addr - (plist-get top-stack :instructionPointerReference))) + (when-let* ((dape-info-thread-buffer-addresses) + (addr + (plist-get top-stack :instructionPointerReference))) (concat " at " addr)) " ")))) (list 'dape--info-conn conn @@ -3966,8 +3966,8 @@ current buffer with CONN config." (path (dape--path-local conn path))) (concat " of " (dape--format-file-line path (plist-get frame :line)))) - (when-let ((dape-info-stack-buffer-addresses) - (ref (plist-get frame :instructionPointerReference))) + (when-let* ((dape-info-stack-buffer-addresses) + (ref (plist-get frame :instructionPointerReference))) (concat " at " ref)) " ")) (list 'dape--info-frame frame @@ -4021,8 +4021,8 @@ current buffer with CONN config." (let ((conn (dape--live-connection 'last t)) (source (list :source dape--info-module))) (dape--with-request (dape--source-ensure conn source) - (if-let ((marker - (dape--object-to-marker conn source))) + (if-let* ((marker + (dape--object-to-marker conn source))) (pop-to-buffer (marker-buffer marker)) (user-error "Unable to open module"))))) @@ -4051,9 +4051,9 @@ current buffer with CONN config." (list (concat (plist-get module :name) - (when-let ((path (plist-get module :path))) + (when-let* ((path (plist-get module :path))) (concat " of " (dape--format-file-line path nil))) - (when-let ((address-range (plist-get module :addressRange))) + (when-let* ((address-range (plist-get module :addressRange))) (concat " at " address-range nil)) " ")) @@ -4072,8 +4072,8 @@ current buffer with CONN config." (let ((conn (dape--live-connection 'last t)) (source (list :source dape--info-source))) (dape--with-request (dape--source-ensure conn source) - (if-let ((marker - (dape--object-to-marker conn source))) + (if-let* ((marker + (dape--object-to-marker conn source))) (pop-to-buffer (marker-buffer marker)) (user-error "Unable to get source"))))) @@ -4113,11 +4113,11 @@ current buffer with CONN config." (defun dape--variable-expanded-p (path) "If PATH should be expanded." (gethash path dape--variable-expanded-p - (when-let ((auto-expand - ;; See `dape-variable-auto-expand-alist'. - ;; Expects car of PATH to specify context - (or (alist-get (car (last path)) dape-variable-auto-expand-alist) - (alist-get nil dape-variable-auto-expand-alist)))) + (when-let* ((auto-expand + ;; See `dape-variable-auto-expand-alist'. + ;; Expects car of PATH to specify context + (or (alist-get (car (last path)) dape-variable-auto-expand-alist) + (alist-get nil dape-variable-auto-expand-alist)))) (length< path (+ auto-expand 2))))) (dape--command-at-line dape-info-scope-toggle (dape--info-path) @@ -4231,15 +4231,15 @@ calls should continue. If NO-HANDLES is non nil skip + - handles." row) (setq name (propertize name - 'font-lock-face font-lock-variable-name-face - 'face font-lock-variable-name-face + 'font-lock-face 'font-lock-variable-name-face + 'face 'font-lock-variable-name-face 'mouse-face 'highlight 'help-echo "mouse-2: create or remove watch expression" 'keymap dape-info-variable-name-map) type (propertize type - 'font-lock-face font-lock-type-face - 'face font-lock-type-face) + 'font-lock-face 'font-lock-type-face + 'face 'font-lock-type-face) value (propertize value 'mouse-face 'highlight @@ -4449,7 +4449,7 @@ or \\[dape-info-watch-abort-changes] to abort changes")) "Insert STRING into REPL. If REPL buffer is not live STRING will be displayed in minibuffer." (when (stringp string) - (if-let ((buffer (get-buffer "*dape-repl*"))) + (if-let* ((buffer (get-buffer "*dape-repl*"))) (with-current-buffer buffer (save-excursion (let (start) @@ -4463,7 +4463,7 @@ If REPL buffer is not live STRING will be displayed in minibuffer." (when comint-last-prompt (move-marker (car comint-last-prompt) (point))) ;; and process marker, this forces us to move them by hand. - (when-let ((process (get-buffer-process buffer))) + (when-let* ((process (get-buffer-process buffer))) (set-marker (process-mark process) (+ (point) (length dape--repl-prompt)))) ;; HACK Run hooks as if `comint-output-filter' was executed (let ((comint-last-output-start start)) @@ -4492,13 +4492,13 @@ The search is done backwards from POINT. The line is marked with (defun dape--repl-revert-region (&rest _) "Revert region by cont text property dape--revert-tag." - (when-let ((fn (get-text-property (point) 'dape--revert-fn)) - (start (save-excursion - (previous-single-property-change - (1+ (point)) 'dape--revert-tag))) - (end (save-excursion - (next-single-property-change - (point) 'dape--revert-tag)))) + (when-let* ((fn (get-text-property (point) 'dape--revert-fn)) + (start (save-excursion + (previous-single-property-change + (1+ (point)) 'dape--revert-tag))) + (end (save-excursion + (next-single-property-change + (point) 'dape--revert-tag)))) (let ((line (line-number-at-pos (point) t)) (col (current-column))) (delete-region start end) @@ -4558,7 +4558,7 @@ See `dape--info-var' for information on INDEX." "Insert content of MODE info buffer into repl. See `dape--repl-info-string' for information on INDEX." (dape--repl-insert (concat (dape--repl-info-string mode index) "\n")) - (when-let ((buffer (get-buffer "*dape-repl*"))) + (when-let* ((buffer (get-buffer "*dape-repl*"))) (with-current-buffer buffer (dape--repl-move-marker (point-max))))) @@ -4579,7 +4579,7 @@ Called by `comint-input-sender' in `dape-repl-mode'." ;; Run previous input ((and (string-empty-p input) (not (string-empty-p (car (ring-elements comint-input-ring))))) - (when-let ((last (car (ring-elements comint-input-ring)))) + (when-let* ((last (car (ring-elements comint-input-ring)))) (message "Repeating last input `%s'" last) (dape--repl-input-sender dummy-process last))) ;; Run command from `dape-named-commands' @@ -4612,8 +4612,8 @@ Called by `comint-input-sender' in `dape-repl-mode'." (let* ((bounds (or (bounds-of-thing-at-point 'word) (cons (point) (point)))) (trigger-chars - (when-let ((conn (or (dape--live-connection 'stopped t) - (dape--live-connection 'last t)))) + (when-let* ((conn (or (dape--live-connection 'stopped t) + (dape--live-connection 'last t)))) (or (thread-first conn (dape--capabilities) ;; completionTriggerCharacters is an @@ -4667,9 +4667,9 @@ Called by `comint-input-sender' in `dape-repl-mode'." (cons (or (plist-get target :text) (plist-get target :label)) - (concat (when-let ((type (plist-get target :type))) + (concat (when-let* ((type (plist-get target :type))) (format " %s" (propertize type 'face 'font-lock-type-face))) - (when-let ((detail (plist-get target :detail))) + (when-let* ((detail (plist-get target :detail))) (format " %s" (propertize detail 'face 'font-lock-doc-face)))))) targets))) (setf done t)) @@ -4679,9 +4679,9 @@ Called by `comint-input-sender' in `dape-repl-mode'." collection)) :annotation-function (lambda (str) - (when-let ((annotation - (alist-get (substring-no-properties str) collection - nil nil 'equal))) + (when-let* ((annotation + (alist-get (substring-no-properties str) collection + nil nil 'equal))) annotation)) :company-prefix-length (save-excursion @@ -5192,8 +5192,8 @@ Where ALIST-KEY exists in `dape-configs'." (cl-loop for key in '(:program :env :args) do (setq config-diff (map-delete config-diff key)))) (concat (when key (format "%s" key)) - (when-let ((config-diff) - (config-str (prin1-to-string config-diff))) + (when-let* ((config-diff) + (config-str (prin1-to-string config-diff))) (format " %s" (substring config-str 1 (1- (length config-str))))) (when zap-form-p (concat " -" @@ -5209,9 +5209,9 @@ Where ALIST-KEY exists in `dape-configs'." "Ensure that CONFIG is executable. If SIGNAL is non nil raises `user-error' on failure otherwise returns nil." - (if-let ((ensure-fn (plist-get config 'ensure))) + (if-let* ((ensure-fn (plist-get config 'ensure))) (let ((default-directory - (or (when-let ((command-cwd (plist-get config 'command-cwd))) + (or (when-let* ((command-cwd (plist-get config 'command-cwd))) (dape--config-eval-value command-cwd)) default-directory))) (condition-case err @@ -5463,7 +5463,7 @@ mouse-1: Display minor mode menu" (:propertize ,(format "%s" (or (and conn (dape--state conn)) 'unknown)) face font-lock-doc-face) - ,@(when-let ((reason (and conn (dape--state-reason conn)))) + ,@(when-let* ((reason (and conn (dape--state-reason conn)))) `("/" (:propertize ,reason face font-lock-doc-face))) ,@(when-let* ((conns (dape--live-connections)) (nof-conns