svaante / dape

Debug Adapter Protocol for Emacs
GNU General Public License v3.0
448 stars 25 forks source link

persist breakpoints across session #76

Closed chmouel closed 5 months ago

chmouel commented 5 months ago

Thanks again for dape.el it's fantastic.

One thing that would be nice to have is to be able to persist breakpoints across emacs session, the breakpoints currently get lost when we revert the buffer

Perhaps something with savehist.el ? (i could not make it works unfortunately)

svaante commented 5 months ago

This is a good idea.

dape uses overlays to represent breakpoints which does not naturally serialize into some printable type which would have made this straight forward to implement, but as that is not the case I have to do some thinking before this becomes an reality.

svaante commented 5 months ago

Hey did a retake in 8bc660f

As dape only stores breakpoints in live buffers, loading breakpoints forces dape to open buffers containing breakpoints. This feels to much of a departure of savehist original purpose.

Instead I added dape-breakpoint-load and dape-breakpoint-load

For persistent breakpoints across sessions:

(use-package dape
    :config
    ;; Save breakpoints on quit
    (add-hook 'kill-emacs-hook 'dape-breakpoint-save)
    ;; Load breakpoints on startup
    (dape-breakpoint-load))
chmouel commented 5 months ago

@svaante very cool thank you!!

I may end up doing this via use-package native :hook wrapper

(use-package dape
    :hook
    ;; Save breakpoints on quit
    (kill-emacs . dape-breakpoint-save)
    ;; Load breakpoints on startup
    (after-init . dape-breakpoint-load))
svaante commented 5 months ago

Nice, yanked into readme :)