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

[Improvement] Download grammalect automatically #22

Open
Cletip opened this issue Aug 17, 2022 · 3 comments
Open

[Improvement] Download grammalect automatically #22

Cletip opened this issue Aug 17, 2022 · 3 comments

Comments

@Cletip
Copy link

Cletip commented Aug 17, 2022

Small code share to keep up to date and download grammalecte automatically (normally it works for me)

(use-package flycheck
    :config
    (global-flycheck-mode t) ;;activate flycheck-mode to work the dowload
    )

  (use-package flycheck-grammalecte
    :after flycheck
;; the configuration go here

    (flycheck-grammalecte-setup)

;; try and install
    (unless (fboundp 'grammalecte--version)
      (grammalecte-download-grammalecte))

;; update
    (let ((local-version (grammalecte--version))
          (upstream-version (grammalecte--upstream-version)))
      (when (stringp upstream-version)
        (if (stringp local-version)
            ;; It seems we have a local version of grammalecte.
            ;; Compare it with upstream
            (when (and (string-version-lessp local-version upstream-version)
                       (or grammalecte-download-without-asking
                           (yes-or-no-p
                            "[Grammalecte] Grammalecte is out of date.  Download it NOW?")))
              (grammalecte-download-grammalecte upstream-version))
          ;; It seems there is no currently downloaded Grammalecte
          ;; package. Force install it, as nothing will work without it.
          (grammalecte-download-grammalecte upstream-version))))
)

Test and give me a feedback ^^

@milouse
Copy link
Owner

milouse commented Aug 18, 2022 via email

@milouse
Copy link
Owner

milouse commented Aug 22, 2022

Wow, I just came back to this, and in fact I think you miss something: the grammalecte-download-grammalecte function already take care of updating grammalecte if needed.

However you are right that once it is installed, I never call it again in the flycheck setup function (the reason behind it was to avoid yes or no question poping out of the blue from time to time). Thus it is a manual process.

I’ll check what I can do to improve that.

@Cletip
Copy link
Author

Cletip commented Aug 28, 2022

No problem. I invite you to go and see "the other way out" that I opened (you just didn't answer it I think)

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