Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion dape.el
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,20 @@ Debug logging has an noticeable effect on performance."
If valid connection, this connection will be of highest priority when
querying for connections with `dape--live-connection'.")

(defvar dape-tool-bar-map
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All defvar should contain docs

(let ((map (make-sparse-keymap)))
(dolist (x '((dape-continue "gud/go" "Continue")
(dape-next "gud/next" "Next")
(dape-step-in "gud/step" "Step in")
(dape-step-out "gud/finish" "Step out")
(dape-pause "mpc/pause" "Pause")
(dape-restart "refresh" "Restart")
(dape-quit "gud/stop" "Quit"))
map)
(tool-bar-local-item
(nth 1 x) (car x) (car x) map
:help (nth 2 x)))))

(define-minor-mode dape-active-mode
"On when dape debugging session is active.
Non interactive global minor mode."
Expand Down Expand Up @@ -4758,7 +4772,8 @@ If EXPRESSIONS is non blank add or remove expression to watch list."
scroll-conservatively 101
comint-input-sender 'dape--repl-input-sender
comint-prompt-regexp (concat "^" (regexp-quote dape--repl-prompt))
comint-process-echoes nil)
comint-process-echoes nil
tool-bar-map dape-tool-bar-map)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should to the same in dape-shell-mode, dape-disassemble-mode and `dape-info-parent-mode'.

(add-to-list 'overlay-arrow-variable-list 'dape--repl-marker)
(add-hook 'completion-at-point-functions
#'dape--repl-completion-at-point nil t)
Expand Down Expand Up @@ -4803,6 +4818,20 @@ Empty input will rerun last command.\n\n"
(when (called-interactively-p 'interactive)
(select-window window)))))


;;; Tool bar config
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just call this sections Tool bar?


(defun dape-update-tool-bar ()
(if (not dape-active-mode)
(dolist (buffer (buffer-list))
(with-current-buffer buffer
(when (eq tool-bar-map dape-tool-bar-map)
(kill-local-variable 'tool-bar-map))))
(unless (eq tool-bar-map dape-tool-bar-map)
(setq-local tool-bar-map dape-tool-bar-map))))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be fine to have only dape-*-mode buffers having a tool bar but as dape does not select repl it is quite awkward to first select repl then use the buttons.

The reason I am bringing this up is that this will only prime the buffers opened when dape starts with the tool bar but not new buffers created by dape (Also we should restore local value of tool-bar-map if we overwrite it).

I see two options:

  1. Use repl as the selected starting window and skip this hook
  2. Use find-file-hook to add the tool-bar to each new buffer (and buffers created from dape-mime-mode-alist)

If we go with option (2.) we should probobly use modes key to figure out if a buffer should have the tool-bar.

WDYT? If we feel fine with using repl as the initial selection I think it's preferable to skip the bookkeeping needed for (2.).

If you have any other alternative ideas please share

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find using find-file-hook (2.) somewhat complex, since it will add the tool-bar icons to any unrelated file, for example an elisp file from another project.

I think that adding the icons to only the repl buffer would be the best choice, but the problem is that cursor have to be in the repl buffer (since tool-bar icons are buffer-local)

Another idea would be to use the header-line, since it is rarely used, and unlike the tool-bar, the icons are kept even if you're not in the repl buffer


(add-hook 'dape-active-mode-hook #'dape-update-tool-bar)


;;; Inlay hints

Expand Down