Skip to content

Commit 1920567

Browse files
committed
Don't skip over the next subscriber after one unsubscribes
* jupyter-monads.el (jupyter-pseudo-bind-content): Do it.
1 parent 4264f07 commit 1920567

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

jupyter-monads.el

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -187,19 +187,18 @@ those subscribers that cancel their subscription.
187187
Errors signaled by a subscriber are demoted to messages."
188188
(pcase (funcall pub-fn content)
189189
((and `(content ,_) sub-content)
190-
(while subs
191-
;; NOTE: The first element of SUBS is ignored here so that
192-
;; the pointer to the subscriber list remains the same for
193-
;; each publisher, even when subscribers are being
194-
;; destructively removed.
195-
(when (cadr subs)
196-
(with-demoted-errors "Jupyter: I/O subscriber error: %S"
197-
;; Publish subscriber content to subscribers
198-
(pcase (funcall (cadr subs) sub-content)
199-
;; Destructively remove the subscriber when it returns an
200-
;; unsubscribe value.
201-
('(unsubscribe) (setcdr subs (cddr subs))))))
202-
(pop subs))
190+
;; NOTE: The first element of SUBS is ignored here so that the
191+
;; pointer to the subscriber list remains the same for each
192+
;; publisher, even when subscribers are being destructively
193+
;; removed.
194+
(while (cadr subs)
195+
(with-demoted-errors "Jupyter: I/O subscriber error: %S"
196+
;; Publish subscriber content to subscribers
197+
(pcase (funcall (cadr subs) sub-content)
198+
;; Destructively remove the subscriber when it returns an
199+
;; unsubscribe value.
200+
('(unsubscribe) (setcdr subs (cddr subs)))
201+
(_ (pop subs)))))
203202
nil)
204203
;; Cancel a publisher's subscription to another publisher.
205204
('(unsubscribe) '(unsubscribe))

0 commit comments

Comments
 (0)