Browse Source

Refactor indium-breakpoint--update-breakpoints-in-current-buffer

* indium-breakpoint.el (indium-breakpoint--update-breakpoints-in-current-buffer):
  Refactor and extract a new utility function.
workspaces
Nicolas Petton 3 years ago
parent
commit
4d24d95a5a
No known key found for this signature in database GPG Key ID: E8BCD7866AFCF978
1 changed files with 17 additions and 11 deletions
  1. +17
    -11
      indium-breakpoint.el

+ 17
- 11
indium-breakpoint.el View File

@ -157,17 +157,15 @@ An icon is added to the left fringe."
(defun indium-breakpoint--update-breakpoints-in-current-buffer ()
"Update the breakpoints for the current buffer in the backend."
(let ((overlays (overlays-in (point-min) (point-max))))
(seq-doseq (ov overlays)
(when-let ((brk (overlay-get ov 'indium-breakpoint))
(start (overlay-start ov)))
(indium-backend-remove-breakpoint
(indium-current-connection-backend)
(indium-breakpoint-id brk)
(lambda ()
(save-excursion
(goto-char start)
(indium-breakpoint-add (indium-breakpoint-condition brk)))))))))
(indium-breakpoint--breakpoints-in-buffer-do
(lambda (brk overlay)
(indium-backend-unregister-breakpoint
(indium-current-connection-backend)
(indium-breakpoint-id brk)
(lambda ()
(save-excursion
(goto-char (overlay-start overlay))
(indium-breakpoint-add (indium-breakpoint-condition brk))))))))
(defun indium-breakpoint--resolve-breakpoints-in-all-buffers (&optional pred)
"Resolve breakpoints from all buffers.
@ -241,6 +239,14 @@ overlay."
(when-let ((brk (overlay-get ov 'indium-breakpoint)))
(funcall fn brk ov)))))
(defun indium-breakpoint--breakpoints-in-all-buffers-do (fn)
"Evaluate FN on all breakpoints in all buffers.
FN takes two arguments, the breakpoint and its associated
overlay."
(seq-doseq (buf (buffer-list))
(with-current-buffer buf
(indium-breakpoint--breakpoints-in-buffer-do fn))))
(when (and (fboundp 'define-fringe-bitmap) (display-images-p))
(define-fringe-bitmap 'indium-breakpoint


Loading…
Cancel
Save