Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can i view the result in separate buffer in interactive mode #14

Open
huangyg11 opened this issue May 28, 2019 · 3 comments
Open

can i view the result in separate buffer in interactive mode #14

huangyg11 opened this issue May 28, 2019 · 3 comments

Comments

@huangyg11
Copy link

In interactive mode, how can I view the result in a separate view instead of replacing current buffer.

Thanks!

@ljos
Copy link
Owner

ljos commented May 28, 2019

This hasn't been implemented. You might be able to jury-rig it with another window showing a copy of the current buffer.

I will look into how to implement this at a later date unless someone else is interested in working on it.

@danilevy1212
Copy link

This is exactly what I just did for my doom-emacs config:

  (defadvice! dan/jq-interactivly--show-original-other-window (fn beg end)
    "TODO"
    :around #'jq-interactively
    (let ((cb  (current-buffer)))
      (with-current-buffer (get-buffer-create "*jq-interactive*")
        (insert (with-current-buffer cb (buffer-string)))
        (display-buffer (current-buffer) #'display-buffer-pop-up-window)
        (with-current-buffer cb
          (funcall fn beg end))
        (kill-buffer-and-window)))))

@cfclavijo
Copy link

cfclavijo commented Sep 4, 2024

based on @danilevy1212 input, this is the equivalent with the advice-add

(defun my/jq-interactivly--show-original-other-window (fn beg end)
  "TODO"
  (let ((cb (current-buffer)))
    (with-current-buffer (get-buffer-create "*jq-interactive-original-input*")
      (insert (with-current-buffer cb (buffer-string)))
      (display-buffer (current-buffer) #'display-buffer-pop-up-window)
      (with-current-buffer cb
        (funcall fn beg end))
      (kill-buffer-and-window)
      )
    )
  )
(advice-add #'jq-interactively :around #'my/jq-interactivly--show-original-other-window)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants