Closed brownts closed 2 months ago
Thanks for reporting, and your analysis is spot on. That dape moves point in timer context is both a feature and a bug.
It makes dape misbehave and move the point in a non command context, but it also removes all the spinlocks aka (accept-process-output
).
One could "just" call post-command-hook
instead of having this special handling for hl-line-mode
but is more likely to break other packages (repeat-mode
for example stops working).
See comment for more info.
;; This code is running within the timer context
;; rather than the command context. Since the
;; `post-command-hook' is executed before the point
;; (cursor position) is actually updated, we must
;; manually intervene to account for this. The
;; following logic borrows from gud.el to interact
;; with `hl-line'.
Please reopen this issue if the commit referenced above does not fix your issue!
Yes, this fixed my issue, thanks!
I use
hl-line-mode
to highlight the line where point resides in the buffer. I noticed that when I step within a file (e.g.,dape-step-in
,dape-next
, etc.), thathl-line-mode
updates to the line where point is, but then the debugger steps and the cursor is placed at the next location, whilehl-line-mode
doesn't move to this new location until I issue another step command, therefore usually lagging by one step.I believe this is because
hl-line-mode
is reacting to the initial stepping command (e.g.,dape-step-in
) and updates due to that, but once the debugger steps and reports back the new location, dape moves the point to this location, but it doesn't trigger thepost-command-hook
, whichhl-line-mode
uses to update. Anything that triggers thepost-command-hook
will cause the highlighting to update to the current point location.I used the following to test this theory and verified that the current line is not highlighted afterwards:
I've worked around this issue by adding
hl-line-highlight
to thedape-display-source-hook
, but sincehl-line-mode
is built in to Emacs, I would think this should "just work" without needing to add the hook.