Skip to content

fix: Avoid recursive initialization#8

Open
jcs090218 wants to merge 1 commit into
purcell:mainfrom
jcs-PR:fix/rec
Open

fix: Avoid recursive initialization#8
jcs090218 wants to merge 1 commit into
purcell:mainfrom
jcs-PR:fix/rec

Conversation

@jcs090218

Copy link
Copy Markdown

I want to setup the checker only when flymake is loaded; therefore, I have this:

(use-package flymake-ruby :hook (flymake-mode . flymake-ruby-load))

But this will cause infinite recursion due to

(flymake-mode t))

This patch avoid this.

@purcell

purcell commented Mar 4, 2024

Copy link
Copy Markdown
Owner
(use-package flymake-ruby :hook (flymake-mode . flymake-ruby-load))

I'm confused: this looks like it would enable the ruby checker in all buffers, even non-ruby buffers. Am I missing something?

@jcs090218

Copy link
Copy Markdown
Author

Sorry, flymake-ruby isn't a good example in this situation. I thought flymake-ruby would have something like the following:

 (defun flymake-ruby-load ()
   "Configure flymake mode to check the current buffer's ruby syntax."
   (interactive)
+  (when (eq 'ruby-mode major-mode)
     (flymake-easy-load 'flymake-ruby-command
                        flymake-ruby-err-line-patterns
                        'tempdir
                        "rb")))

You can use flymake-eask as the example:

(use-package flymake-eask :hook (flymake-mode . flymake-eask-load))

All my flymake packages have the major mode guard: 🤔

@purcell

purcell commented Mar 5, 2024

Copy link
Copy Markdown
Owner

flymake-ruby doesn't do that because that way of configuring things doesn't really make sense to me. Why would you want every flymake-enabled buffer to try initialising every one of those backends? It looks like it's just for the convenience of a specific use-package syntax, but it means Emacs is doing extra work, and this pattern ignores the convention of just using major mode hooks.

@jcs090218

Copy link
Copy Markdown
Author

The real issue is that I don't want flymake-mode to turn on when registering a Flymake checker. I configured it this way because flymake-mode will be turned on once I enter the major mode. 🤔

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 this pull request may close these issues.

2 participants