From: Lars Ingebrigtsen Date: Sun, 20 Oct 2019 10:07:42 +0000 (+0200) Subject: Mark breakpoints in edebug with highlights X-Git-Tag: emacs-27.0.90~969 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e8b3a15cb6ff187ce08afcb43bd9a0b7907268ca;p=emacs.git Mark breakpoints in edebug with highlights * lisp/emacs-lisp/edebug.el (edebug--overlay-breakpoints) (edebug--overlay-breakpoints-remove): New functions (bug#23468). (edebug-modify-breakpoint): Use them to highlight breakpoints. (edebug--display-1): Restore breakpoint highlights. (edebug--recursive-edit): Remove highlights on exit. --- diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index e0a4eb3db5a..a19ac3bc602 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -2723,6 +2723,7 @@ See `edebug-behavior-alist' for implementations.") (edebug-stop)) (edebug-overlay-arrow) + (edebug--overlay-breakpoints edebug-function) (unwind-protect (if (or edebug-stop @@ -2905,6 +2906,7 @@ See `edebug-behavior-alist' for implementations.") (setq signal-hook-function #'edebug-signal) (if edebug-backtrace-buffer (kill-buffer edebug-backtrace-buffer)) + (edebug--overlay-breakpoints-remove (point-min) (point-max)) ;; Remember selected-window after recursive-edit. ;; (setq edebug-inside-window (selected-window)) @@ -3186,7 +3188,27 @@ the breakpoint." (setcar (cdr edebug-data) edebug-breakpoints) (goto-char (+ edebug-def-mark (aref offset-vector index))) - )))) + (edebug--overlay-breakpoints edebug-def-name))))) + +(defun edebug--overlay-breakpoints (function) + (let* ((data (get function 'edebug)) + (start (nth 0 data)) + (breakpoints (nth 1 data)) + (offsets (nth 2 data))) + ;; First remove all old breakpoint overlays. + (edebug--overlay-breakpoints-remove + start (+ start (aref offsets (1- (length offsets))))) + ;; Then make overlays for the breakpoints. + (dolist (breakpoint breakpoints) + (let* ((pos (+ start (aref offsets (car breakpoint)))) + (overlay (make-overlay pos (1+ pos)))) + (overlay-put overlay 'edebug t) + (overlay-put overlay 'face 'highlight))))) + +(defun edebug--overlay-breakpoints-remove (start end) + (dolist (overlay (overlays-in start end)) + (when (overlay-get overlay 'edebug) + (delete-overlay overlay)))) (defun edebug-set-breakpoint (arg) "Set the breakpoint of nearest sexp.