tkf / emacs-request

Request.el -- Easy HTTP request for Emacs Lisp
http://tkf.github.com/emacs-request/
GNU General Public License v3.0
617 stars 91 forks source link

Question regarding request + Tramp #188

Closed Knusper closed 3 years ago

Knusper commented 3 years ago

I noticed that when I run functions that use request in a tramp buffer, it does call curl on the machine where the file is that is visited in tramp. While I can envision many scenarios where this is extremely usefull, in my case the remote machine has limited access to the outside world - so the requests naturally fail. My workaround is to run the functions from a local buffer - but this is a bit inconvenient. How can I enforce request to use the curl from the machine in which I have emacs running?

dickmao commented 3 years ago
(advice-add 'request :around (lambda (orig-fun &rest args)
                               "Always start curl from local directory."
                               (let ((default-directory "~"))
                                 (apply orig-fun args))))
Knusper commented 3 years ago

Thanks for the quick answer. I saw in the meantime also another code, where default-directory is set like this for each request.