Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with moving around in the sly stickers replay #554

Open
rpgoldman opened this issue Jan 3, 2023 · 3 comments
Open

Issue with moving around in the sly stickers replay #554

rpgoldman opened this issue Jan 3, 2023 · 3 comments

Comments

@rpgoldman
Copy link
Contributor

I had trouble with moving around in the sly stickers replay minibuffer. Specifically, when I go to the next sticker, my cursor gets left in the buffer for the source file, instead of being returned to the replay buffer after the source code location is flashed.

When I look at the source code, I see this:

(cl-defun sly-stickers--find-and-flash (sticker-id &key (otherwise nil))
  "Find and flash the sticker referenced by STICKER-ID.
otherwise call OTHERWISE with a single argument, a string stating
the reason why the sticker couldn't be found"
  (let ((sticker (sly-stickers--sticker-by-id sticker-id)))
    (cond (sticker
           (let ((buffer (overlay-buffer sticker)))
             (when buffer
               (with-current-buffer buffer
                 (let* ((window (display-buffer buffer t)))
                   (when window
                     (with-selected-window window
                       (push-mark nil t)
                       (goto-char (overlay-start sticker))
                       (sly-recenter (point))
                       (setq sly-stickers--flashing-sticker sticker)
                       (pulse-momentary-highlight-overlay sticker 'highlight)
                       (run-with-timer
                        2 nil
                        (lambda ()
                          (when (eq sly-stickers--flashing-sticker sticker)
                            (pulse-momentary-highlight-overlay
                             sticker 'highlight)))))))))))
          (otherwise
           (funcall otherwise "Can't find sticker (probably deleted!)")))))

I'm finding this line particularly confusing:

(let* ((window (display-buffer buffer t)))

First, there's only one binding, so I don't know why it's a let*, but probably that's just a place where a later binding was removed, and the remaining * is just an oversight.

More importantly, the call to display-buffer seems to be wrong. According to the elisp manual it seems that the optional action argument should only be t when the function is invoked interactively. Otherwise it should be one or more action functions.

I don't know whether this is my problem, or whether my problem comes from my working with multiple frames and with-current-buffer not working across frames or if this is Aquamacs confusing things again.

Any help would be welcome.

@rpgoldman
Copy link
Contributor Author

I have tried advising the functions sly-stickers--find-and-flash and sly-stickers-replay-refresh to force them to return the cursor to the right location. This does not fix my problem, either, although messages printed show that the advice is being triggered as expected.

This makes me wonder if the problem could be related to the use of run-with-timer -- is there any chance that the cursor is being returned to the right location, but that after that happens the timer fires again and moves the cursor back to the source buffer? I have tried to advise pulse-momentary-highlight-overlay to wrap it with with-selected-window, but that does not solve my problem either.

@joaotavora
Copy link
Owner

joaotavora commented Jan 4, 2023 via email

@rpgoldman
Copy link
Contributor Author

Thanks for the advice, @joaotavora . Sorry to have so many questions, and many thanks for your patience. I have built up a lot of technical debt in my Emacs configuration, I see. Partly from sticking with Aquamacs while it has fallen behind mainstream Emacs.

I have switched to the MacOS port of standard emacs, bringing me up to Emacs 28.2 and dropping the Aquamacs configuration modifications. But so far I have been unable to get SLY (master) working there. I can get SLIME to work, after some trouble, but SLY hangs when trying to present any substantial amount of output to the MREPL buffer. I have been stripping away configuration, but still haven't identified what causes that problem.

So please consider this an interim report, and once again, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants