Function: dape--stack-frame-display-1

dape--stack-frame-display-1 is a natively compiled function defined in dape.el.

Signature

(dape--stack-frame-display-1 CONN FRAME SELECTED-P FIRST-SELECTED-P)

Documentation

Display FRAME for adapter CONN.

If SELECTED-P is non-nil, this frame is selected. If FIRST-SELECTED-P is non-nil, the top frame is selected. Helper for dape--stack-frame-display.

Source Code

;; Defined in /nix/store/1fiaif8pifqj2jh65rbg3fkhg3i56q42-emacs-packages-deps/share/emacs/site-lisp/elpa/dape-0.27.1/dape.el
(defun dape--stack-frame-display-1 (conn frame selected-p first-selected-p)
  "Display FRAME for adapter CONN.
If SELECTED-P is non-nil, this frame is selected.
If FIRST-SELECTED-P is non-nil, the top frame is selected.
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)))
      (with-current-buffer (marker-buffer marker)
        (dape--add-eldoc-hook)
        (save-excursion
          (goto-char (marker-position marker))
          (setq dape--stack-position-overlay
                (let ((ov (make-overlay (line-beginning-position)
                                        (line-beginning-position 2))))
                  (overlay-put ov 'category 'dape-source-line)
                  (overlay-put ov 'face 'dape-source-line-face)
                  (when-let* (first-selected-p
                              (description (dape--exception-description conn)))
                    (overlay-put ov 'after-string
                                 (propertize description 'face
                                             'dape-exception-description-face)))
                  ov)
                fringe-indicator-alist
                (unless (and selected-p first-selected-p)
                  '((overlay-arrow . hollow-right-triangle))))
          ;; 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)))
          ;; Change selected window if not `dape-repl' buffer is selected
          (unless (with-current-buffer (window-buffer)
                    (cl-some #'derived-mode-p '(dape-repl-mode
                                                dape-info-parent-mode
                                                dape-disassemble-mode)))
            (select-window window))
          (with-selected-window window
            ;; XXX This is where point is moved after step commands.
            ;; Which means that `post-command-hook' has already run
            ;; from `dape-next' etc.  Can't call the hook directly
            ;; from this timer context because it will lead to
            ;; strangeness, but we can handle the important bits.
            (goto-char (marker-position marker))
            ;; ...like fixing `hl-line'
            (when (featurep 'hl-line)
	      (cond (global-hl-line-mode (global-hl-line-highlight))
                    ((and hl-line-mode hl-line-sticky-flag) (hl-line-highlight))))
            (run-hooks 'dape-display-source-hook)))))))