Open daanturo opened 6 months ago
Here's one conspicuously bad way of doing it:
(request-abort
(let ((req (request "http://httpbin.org/post"
:type "POST"
:data '(("key" . "value"))
:error (lambda (&rest _args) (message "got here"))
:parser #'json-read
:success #'ignore)))
(prog1 req
(add-function
:around
(process-sentinel (get-buffer-process
(request-response--buffer req)))
(lambda (f &rest args)
(let ((request-message-level -1))
(apply f args)))))))
Here's one conspicuously bad way of doing it:
(request-abort (let ((req (request "http://httpbin.org/post" :type "POST" :data '(("key" . "value")) :error (lambda (&rest _args) (message "got here")) :parser #'json-read :success #'ignore))) (prog1 req (add-function :around (process-sentinel (get-buffer-process (request-response--buffer req))) (lambda (f &rest args) (let ((request-message-level -1)) (apply f args)))))))
Thank you that works for me.
But I really hope that there would be an official support, like https://github.com/tkf/emacs-request/commit/506500e5e5e0eb4ed5e94812ea6376d1f9933863.
Currently when using
request-abort
, an error will be echoed:This cannot be disabled without setting
request-message-level
(If I understand correctly).Reproduce
Observed
[error] request--callback: peculiar error
appears in the echo area and*Message*
.Expected
Silent
Is it possible to abort the running request, without informing the user? My package depends of
request
, sosetq
-ing an user option without their consent is not polite. Maybe adding more optional arguments torequest-abort
to silence errors?