pashky / restclient.el

HTTP REST client tool for emacs
2k stars 169 forks source link

`Unknown restclient hook type jq-set-var` With Latest Version #282

Open tompurl opened 2 years ago

tompurl commented 2 years ago

I'm using Doom emacs. The pinned version is a few commits behind so I added the following to my packages.el file:

(package! restclient :pin "ae79e7dd283890072da69b8f48aeec1afd0d9442" )

I then ran doom sync -u and confirmed that the newer version was installed.

I also have jq-mode installed here:

However, when I attempt the use jq-set-var I get the following message:

Unknown restclient hook type jq-set-var

I have also tried running the following commands from a scratch buffer before executing a restclient query:

(require 'restclient)
(require 'jq-mode)
shackra commented 2 years ago

yeah, I'm experiencing this as well having jq installed and using the commit ae79e7dd2838

shackra commented 2 years ago

Okay, after toying around with this issue, I got a workaround for Doom Emacs users:

(use-package! restclient
  :defer)
(after! restclient
  (require 'restclient-jq))

yes, we need to manually require the restclient-jq module.

And that's it, basically.

you can declare the package in your packages.el like this:

(when (package! restclient :recipe (:host github :repo "pashky/restclient.el"
                                    :files ("restclient.el" "restclient-jq.el"))
        :pin "ae79e7dd283890072da69b8f48aeec1afd0d9442")
  (package! jq-mode :recipe (:host github :repo "ljos/jq-mode")
    :pin "1af31ba701cf844f938f840ed78867c9a28174b6"))

I was unsure if Doom would pull the dependency for restclient-jq module, jq-mode, so we do that ourselves just in case.

tompurl commented 2 years ago

This is excellent, thank you!

micahbf commented 2 years ago

If anyone else comes across this, doom now has this built in.

In init.el, you just need to enable the jq flag for the rest module, i.e. (rest +jq)