#emacs I like `visible bookmarks` package (bm) a lot, but since some time ago it doesn't work correctly on my system (compiled from master branch): `bm-next` enters an infinite loop.

Today I've decided to take a look.

1/4

It seems the problems comes from the `bm-lists` function:

#+begin_src
...
(cond ((equal 'forward direction)
(cons nil (remq nil (mapcar predicate (cdr (overlay-lists))))))
((equal 'backward direction)
(cons (remq nil (mapcar predicate (car (overlay-lists)))) nil))
(t
(cons (remq nil (mapcar predicate (car (overlay-lists))))
(remq nil (mapcar predicate (cdr (overlay-lists))))))))
#+end_src

2/4

Here, `(overlay-lists)` is expected to return a list with 2 elements, a list with the overlays from the beginning of buffer to the point (car), and a list with the overlays from the point to the end of buffer (cdr).

But `overlay-lists` documentation does not say so. And I don't understand how and why it worked before, as the function behavior hasn't changed.

3/4

Anyway, the fix is easy:

#+begin_src
...
(cond ((equal 'forward direction)
(cons nil (remq nil (mapcar predicate (overlays-in (point) (point-max))))))
((equal 'backward direction)
(cons (reverse (remq nil (mapcar predicate (overlays-in (point-min) (point))))) nil))
(t
(cons (reverse (remq nil (mapcar predicate (overlays-in (point-min) (point)))))
(remq nil (mapcar predicate (overlays-in (point) (point-max))))))))
#+end_src

4/4

Ouch!!!
As usual, after spending a couple of hours on the issue, I've discovered it was a known problem: github.com/joodland/bm/issues/
Even someone used the same solution!

Anyway, haven't we got a funny night?

Follow

@inigo Nice. Repo appears dead though...

@ambihelical Sorry, which repo? bm repository in github works here.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.