mmontone / emacs-inspector

Inspection tool for Emacs Lisp objects.
GNU General Public License v3.0
107 stars 8 forks source link

This is doesn't compose with eros, let's do something about it #34

Closed port19x closed 1 week ago

port19x commented 1 week ago

Would it be possible to pivot your emacs-inspector and emacs-tree-inspector to be minor modes hooking into elisp evaluation and refreshing a buffer accordingly, similar to how cider-inspect operates?

That way eros can be focussed on visually enhancing the elisp experience while your inspector continues to give contextual information in a side-buffer.

I also find it jarring that inspector-inspect-last-sexp et. al switches focus to window containing the inspector buffer.

mmontone commented 1 week ago

I don't understand what this is about. I don't use eros. Is it about providing evaluation in the inspector buffers? And so eros can be used there?

You mean, here: https://github.com/mmontone/emacs-inspector/blob/9be2a62028065b4a9158858d69ec807d2dabae8e/inspector.el#L1037

Use emacs-lisp-mode instead of fundamental-mode. ... I think I tried deriving it from emacs-lisp-mode, but there were issues (I don't remember which now).

mmontone commented 1 week ago

I also find it jarring that inspector-inspect-last-sexp et. al switches focus to window containing the inspector buffer.

You can now control that with inspector-switch-to-buffer variable. Good enough?

port19x commented 1 week ago

I don't understand what this is about

Appologies, I was quite brief in my request.

The problem I have is that there is a minor mode I like for emacs lisp, called eros, that harmonizes with default evaluation commands.

emacs-inspector, at least as of right now, expects me to use inspector-inspect-last-sexp instead of eval-last-sexp.

I should have been more thorough in my own testing though. An oversight on my part is that eros makes it's own eros-eval-last-sexp available, so it doesn't compose any better or worse than emacs-inspector.

This makes using both your emacs-inspector and eros at the same time a bit of a challenge, but I'll leave it to you to suggest if and how we should proceed to that goal in this repo.

You can now control that with inspector-switch-to-buffer variable. Good enough?

Yes, excellent. Give me a second to test it

port19x commented 1 week ago

It works, didn't work at first but that was due to weird caching of stuff. Resolved itself after an eval-buffer

mmontone commented 1 week ago

emacs-inspector, at least as of right now, expects me to use inspector-inspect-last-sexp instead of eval-last-sexp

The thing is inspector-inspect-last-sexp does inspection, which is different from just evaluation with eval-last-sexp.

Perhaps you want some plugging similar to this?: https://github.com/mmontone/emacs-inspector#setup-evaluation-commands-using-prefix-arguments

You can probably implement your own command to plug Eros evaluation to the inspector somehow.

port19x commented 1 week ago

Yes, the following kind of works as a workaround, very similar to your readme excerpt:

(defun port19s-cider-envy (arg)
  "Like `eros-eval-last-sexp', but also inspect when called with prefix ARG."
  (interactive "P")
  (pcase arg
    ('(4) (inspector-inspect-last-sexp))
    (_ (call-interactively #'eros-eval-last-sexp))))

If I were to figure out how to plug eros to the inspector, would you be open to me contributing support for that? This could work by checking if eros-mode is active and branching code accordingly

mmontone commented 1 week ago

If I were to figure out how to plug eros to the inspector, would you be open to me contributing support for that?

Sorry, but probably not in the emacs-inspector code. I prefer having that as separate configuration. At most maybe a mention with the code in the README, like what was done for evil-mode in the README.

port19x commented 1 week ago

That's fine. I'll see what I can do and perhaps it's easier to integrate inspector awareness into eros than the other direction anyway.

Thanks for adding the inspector-switch-to-buffer variable