Closed soilc closed 2 years ago
This command-line invocation of emacs is a bit above your pay grade, but it demonstrably proves the basic case:
git clone https://github.com/tkf/emacs-request.git my-request.el
cd my-request.el
emacs -Q --batch -L . -l request --eval \
"(request \"http://httpbin.org/get\" \
:params (quote ((\"key\" . \"value\") (\"key2\" . \"value2\"))) \
:parser (quote json-read) \
:sync t \
:success (cl-function \
(lambda (&key data &allow-other-keys) \
(message \"I sent: %S\" (assoc-default (quote args) data)))))"
Output:
I sent: ((key . "value") (key2 . "value2"))
There's a lot to know about emacs, the first being how to install a package, and then require'ing it.
I thought that smart people like you should understand that the package is already installed according to the instructions given: M-x package-refresh-contents RET M-x package-install RET request RET
So, you can see it: Package request is installed.
Status: Installed in ‘request-0.3.3/’. Delete
Version: 0.3.3
Summary: Compatible layer for URL request in Emacs
Requires: emacs-24.4
Website: https://github.com/tkf/emacs-request
Maintainer: Takafumi Arakaki
I thought that smart people like you
Sorry, you must be mistaking me for someone else.
Why did you close the question?
This command-line invocation
Yes, it works. But the correct answer to my question is quite different - (require 'request) in 'init.el'. The problem is in your poor instruction (https://github.com/tkf/emacs-request): "... M-x package-refresh-contents RET M-x package-install RET request RET Alternatively, directly clone this repo and make install." And yes, you are not very kind.
you are not very kind.
Glad you noticed. But a samaritan @tomterl has come to your aid in #217 so that the following
works (note the absence of -l request
),
emacs -Q --batch -f package-initialize --eval \
"(request \"http://httpbin.org/get\" \
:params (quote ((\"key\" . \"value\") (\"key2\" . \"value2\"))) \
:parser (quote json-read) \
:sync t \
:success (cl-function \
(lambda (&key data &allow-other-keys) \
(message \"I sent: %S\" (assoc-default (quote args) data)))))"
works once the beat drops in MELPA two hours from now.
I see that you are a writer, not a reader. Therefore, I will repeat. The problem is in your poor instruction (https://github.com/tkf/emacs-request). And the correct answer to my question is a lack of the '(require 'request)' in my 'init.el'. That's all you need for the right answer.
I see that you are a writer, not a reader. Therefore, I will repeat. The problem is in your poor instruction (https://github.com/tkf/emacs-request). And the correct answer to my question is a lack of the '(require 'request)' in my 'init.el'. That's all you need for the right answer.
No, the require is no longer needed once the autoload cookie update hits melpa...
I see that you are a writer, not a reader.
Odd that you mention it. I just finished all 1300 pages of Les Miserables by Hugo. The musical was better.
No, the require is no longer needed once the autoload cookie update hits melpa...
It just means that a samaritan @tomterl is helping you, not me.
Debugger entered--Lisp error: (void-function request) (request "http://httpbin.org/get" :params '(("key" . "value") ("key2" . "value2")) :parser 'json-read :success #'(lambda (&rest --cl-rest--) "\n\n(fn &key DATA &allow-other-keys)" (let ((data (car (cdr ...)))) (message "I sent: %S" (assoc-default 'args data))))) (progn (request "http://httpbin.org/get" :params '(("key" . "value") ("key2" . "value2")) :parser 'json-read :success #'(lambda (&rest --cl-rest--) "\n\n(fn &key DATA &allow-other-keys)" (let ((data (car ...))) (message "I sent: %S" (assoc-default 'args data)))))) elisp--eval-last-sexp(nil) eval-last-sexp(nil) funcall-interactively(eval-last-sexp nil) command-execute(eval-last-sexp)