Comments (6)
What'd you prefer to happen to results then?
You should see end of restclient-http-handle-response function. There's a display-buffer call you can adjust to set your own behaviour.
from restclient.el.
Here's my current (minimal) ob-restclient code:
(defun org-babel-execute:restclient (body params)
"Execute a block of Restclient code with org-babel.
This function is called by `org-babel-execute-src-block'"
(message "executing Restclient source code block")
(save-window-excursion
(with-temp-buffer
(insert body)
(restclient-http-send-current-stay-in-window))
(with-current-buffer restclient-same-buffer-response-name
(goto-char (point-min))
(insert "#+BEGIN_SRC html\n")
(goto-char (point-max))
(insert "#+END_SRC\n")
(buffer-string))))
Since I'm showing it inline in the org-mode buffer, having the result window is redundant and annoying. Unfortunately (probably related to my limited understanding of elisp) I find no way to prevent the window with the result from popping up.
The above code also depends on restclient-same-buffer-response being t. If it's nil, the code breaks.
Ideally, I'd like to get the result buffer as the result value from restclient-http-send-current-stay-in-window, and some way to prevent that buffer from being displayed.
from restclient.el.
(restclient-http-parse-current-and-do 'restclient-http-do ...args...) call will pass those args all the way down to restclient-http-handle-response, where you can make (display-buffer) conditional or even pass a callback function there, so one will return response text for your case or another one will display a buffer.
from restclient.el.
Just to be sure I understand you last comment.
You're saying that I can modify restclient-http-handle-response
to take extra arguments that will allow me to do what I'm asking.
Is this a change you'll be interested in merging if done properly?
from restclient.el.
I've made an attempt at #91. Please feel free to reject it and suggest improvements.
from restclient.el.
After reading the manual for display-buffer I no longer believe this bug is relevant. I'm able to use dynamic binding to make restclient behave as I want.
from restclient.el.
Related Issues (20)
- error in process sentinel: peculiar error: "connect", :host, "identity.xero.com", :service, 443
- Feature request: save body of GET result to file HOT 4
- How do you set multiple variables?
- Binary at start of cached response from ASP.NET server
- Content-length header: Inconsistent case HOT 1
- `Unknown restclient hook type jq-set-var` With Latest Version HOT 4
- Set variable from response header
- Fall back to fundamental mode when response is huge
- Feature request: generate curl command with quotes instead of backslashes HOT 3
- Load Variables from a Different File
- Feature request: convert a multi-line curl command to request block inplace
- Prismjs syntax highlighter for this mode
- Feature request: support for server sent events
- 400 Request Header Or Cookie Too Large on all requests from restclient, but curl works.
- GET being sent with a body HOT 1
- POSTing files not working as an upload HOT 1
- Support streaming response?
- Variables set via hooks (jq-set-var) always override variables set in a file
- [FR] WebDAV: Add `PROPFIND` HTTP method HOT 1
- HTTP/2 support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from restclient.el.