How can I copy text from the inspector via keybinding/Lisp?

Hi again, amazing people!

I am playing around with integration between Emacs and Nyxt, and I was looking into how to make inspecting more enjoyable for myself.

I found out something weird:

I can copy text only with right clicking and selecting copy!
Using nyxt/web-mode::copy does not work here.
So I wonder, how can I learn which Lisp function right-click-Copy is calling?

Or maybe it is not calling Lisp at all because in buffer.lisp, open-inspector seems an external functionality?

(define-command open-inspector ()
  "Open the inspector, a graphical tool to inspect and change the content of the buffer."
  (ffi-inspector-show (current-buffer)))

You can basically only copy in that way. The inspector window is technically not bound/managed by Nyxt. As you’ve guessed, it is external functionality. I wish we could more tightly integrate, maybe in the future we can.

1 Like

If you want to “copy” html from the page, right now you can do it by manipulating the DOM using parenscript/javascript.

“Right now” because apparently there is a plan to expose that natively.

Something like:

(define-parenscript copy-from-dom ()
(let ((note (ps:@ (ps:chain document (get-element-by-id "element-id")) inner-text)))
  (ps:chain console (log (+ "inner text:" note)))))
1 Like

Ah thanks, I will try that because I want to get more into parenscript.
What I wanted really was to have interaction with the browser inspector, because I wanted to make Emacs communicate with it.
But most likely getting raw html will come useful as well: so thank you @johnhilts !

1 Like

There were a couple of good parenscript questions in r/lisp today …

1 Like