Git Product home page Git Product logo

Comments (6)

pashky avatar pashky commented on September 13, 2024

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.

alf avatar alf commented on September 13, 2024

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.

pashky avatar pashky commented on September 13, 2024

(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.

alf avatar alf commented on September 13, 2024

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.

alf avatar alf commented on September 13, 2024

I've made an attempt at #91. Please feel free to reject it and suggest improvements.

from restclient.el.

alf avatar alf commented on September 13, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.