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

Defer load seems causing problems on switching buffers #81

Closed
braineo opened this issue Apr 12, 2024 · 7 comments · Fixed by #82
Closed

Defer load seems causing problems on switching buffers #81

braineo opened this issue Apr 12, 2024 · 7 comments · Fixed by #82

Comments

@braineo
Copy link
Contributor

braineo commented Apr 12, 2024

after 01bfb78

I started to get when i have a mini-buffer open (use M-x to bring up consult)

Error during redisplay: (parinfer-rust--defer-loading #<window 3 on init.el>) signaled (excessive-lisp-nesting 1601)
The following modes may cause issues with parinfer-rust, do you want to disable them? Mode(s): electric-pair-mode? (y or n) y
(use-package parinfer-rust-mode
  :if (string-match-p "MODULES" system-configuration-features)
  :hook
  ((emacs-lisp-mode scheme-mode) . (lambda (
   (progn
    (electric-pair-local-mode -1)
    (parinfer-rust-mode)))))

the problem is gone after removing these added lines

-   (parinfer-rust-enabled
-    (parinfer-rust-mode-disable))
-   ((not (eq (current-buffer)
-             (window-buffer (selected-window))))
-    (add-hook 'window-selection-change-functions #'parinfer-rust--defer-loading nil t))

the window-selection-change-functions seems to be an AOE affecting many things. i suspect every time my consult opens it makes emacs into a infinite loop on calling the defer load function

@justinbarclay
Copy link
Owner

Hey thanks for reporting this bug and narrowing to down to a potential issue.

I also use consult and haven't ran into this bug. Is it M-x in general that causes this or a specific command?

additionally, can you try setting these two variables and see if it resolves the issue for you

   (setq parinfer-rust-disable-troublesome-modes t)
   (setq parinfer-rust-check-before-enable 'defer)

@justinbarclay
Copy link
Owner

justinbarclay commented Apr 14, 2024

Follow up question, which package manager do you use? package.el? straight? elpaca?

I ask because I was able to replicate a very similar behavior in a very specific situation - using elpaca and being asked to download parinfer-rust. If I said no, I would get repeatedly asked to install it. However, if I already had the library installed Emacs behaves normally with elpaca.

If I use package.el I never run into this situation.

@braineo
Copy link
Contributor Author

braineo commented Apr 15, 2024

Follow up question, which package manager do you use? package.el? straight? elpaca?

I ask because I was able to replicate a very similar behavior in a very specific situation - using elpaca and being asked to download parinfer-rust. If I said no, I would get repeatedly asked to install it. However, if I already had the library installed Emacs behaves normally with elpaca.

If I use package.el I never run into this situation.

hmm i use use-package

https://github.com/braineo/fate-emacs/blob/master/modules/fate-langs.el#L36-L49

but i do think i saw the prompt once for downloading parinfer-rust and i hit y to install it

let me see if i can get more print on what's going on there

@braineo
Copy link
Contributor Author

braineo commented Apr 15, 2024

Follow up question, which package manager do you use? package.el? straight? elpaca?
I ask because I was able to replicate a very similar behavior in a very specific situation - using elpaca and being asked to download parinfer-rust. If I said no, I would get repeatedly asked to install it. However, if I already had the library installed Emacs behaves normally with elpaca.
If I use package.el I never run into this situation.

hmm i use use-package

https://github.com/braineo/fate-emacs/blob/master/modules/fate-langs.el#L36-L49

but i do think i saw the prompt once for downloading parinfer-rust and i hit y to install it

let me see if i can get more print on what's going on there

(defun parinfer-rust--defer-loading (&rest _)
  "Defer loading of `parinfer-rust-mode' until the buffer is in focus."
  (when (eq (current-buffer)
            (window-buffer (selected-window)))
+   (print (format "try to enable parinfer in %s" (buffer-name)))
    (remove-hook 'window-selection-change-functions #'parinfer-rust--defer-loading t)
    (parinfer-rust-mode)))

i added this line and this is what happened i opened a file treesit.el.gz, then i run any command that can bring up a minibuffer (consult, projectile, etc. does not matter which one)

this is what i got (at this point i cannot copy and paste from emacs, it died pretty much :(

starting from minibuf-1, the parinfer-mode seemed to keep calling itself? in mini buffer, which it should not.

what comes to the last is the buffer i need parinfer running (treesit.el.gz)

image

@justinbarclay
Copy link
Owner

Hey, thanks for the help debugging this.

I think I have a fix on the branch fix-recursion. If you want to test this out and see if it fixes the problem for you, that would be cool. If not, I'll be testing this some more tomorrow and hopefully releasing it tomorrow night.
#82

@justinbarclay justinbarclay linked a pull request Apr 15, 2024 that will close this issue
@braineo
Copy link
Contributor Author

braineo commented Apr 15, 2024

thanks for the very prompt fix! it seems my problem goes away with the fix.

@Manueljlin
Copy link

fixed it for me too, thank you <3

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

Successfully merging a pull request may close this issue.

3 participants