emacs-languagetool / flycheck-languagetool

Flycheck support for LanguageTool
GNU General Public License v3.0
55 stars 9 forks source link

Autoloading #13

Open mavit opened 3 years ago

mavit commented 3 years ago

This allows a user to install this package via (list-packages) and start using is straight away, without having to add (require 'flycheck-languagetool) to their ~/.emacs.

jcs090218 commented 3 years ago

Would this slow the Emacs startup? I might recommend user to add this to their configuration.

(with-eval-after-load 'flycheck (require 'flycheck-languagetool))
mavit commented 3 years ago

Would this slow the Emacs startup?

Maybe? It will cause Flycheck to load at startup. However, active Flycheck users are probably already loading it at startup by running, say, (global-flycheck-mode).

I might recommend user to add this to their configuration.

(with-eval-after-load 'flycheck (require 'flycheck-languagetool))

We could do that ourselves in the following way. This seems like a nice solution, but package-lint warns that it’s probably a bad idea.

;;;###autoload
(with-eval-after-load 'flycheck
  (unless (featurep 'flycheck-languagetool)
    (require 'flycheck-languagetool)))
jcs090218 commented 3 years ago

Maybe? It will cause Flycheck to load at startup. However, active Flycheck users are probably already loading it at startup by running, say, (global-flycheck-mode).

I would prefer not to force user to load flycheck at startup. Leave options to users should be a better design of the package. That's said, I can accept with-eval-after-load.

This seems like a nice solution, but package-lint warns that it’s probably a bad idea.

Yeah, try not to have the package-lint warning unless it's necessary. 👍

mavit commented 3 years ago

I have asked on StackExchange if anyone knows of a better way of doing this. It seems like it should be quite common.

jcs090218 commented 3 years ago

I know there is function with-no-warnings, not sure if this is a good solution though.

I personally think that autoloading isn't necessary, I would suggest to leave the current code base as it? Users would just have to load it themselves so the program works as they expected to. ;)