riscy / shx-for-emacs

An Emacs shell-mode (and comint-mode) extension that enables displaying small plots and graphics and lets users write shell commands in Emacs Lisp.
GNU General Public License v3.0
218 stars 10 forks source link

shx does not seem to work in ielm buffers #25

Open jave opened 3 years ago

jave commented 3 years ago

I used m-x shx-global-mode, which interferes with m-x ielm.

ielm will behave very oddly, outputing streams of hex rather than doing anything useful.

Is there a way to inhibit shx-global-mode in ielm buffers?

riscy commented 3 years ago

Thanks, this is great to know. I've quickly tried shx with ielm and I see the problem happening. I'll add a change to at least inhibit shx-global-mode in ielm buffers this weekend -- it will amount to redefining shx--global-on as:

(defun shx--global-on ()
  "Call the function `shx-mode' if appropriate for the buffer."
  (when (and (derived-mode-p 'comint-mode)
             (not (eq major-mode 'inferior-emacs-lisp-mode)))
             (shx-mode +1)))
BooAA commented 3 years ago

Similar issue happened for sly, which was a fork of slime and use comint-mode to redesign their repl.

screenshot: Screenshot from 2020-11-15 15-31-59

riscy commented 3 years ago

Thanks! There might be a way to get shx to cooperate with these modes, but for now I'll add sly to the exceptions too.

BooAA commented 3 years ago

for c20495c, I think it should be sly-mrepl-mode.

riscy commented 3 years ago

I wasn't able to locate the definition of sly-mrepl-mode to confirm, but I think the root cause was that shx shadows the RET binding which these modes (and probably others) require.

BooAA commented 3 years ago

You can find out definition of sly-mrepl-mode here, the keymap it uses is sly-mrepl-mode-map, which RET is bind to sly-mrepl-return

root cause was that shx shadows the RET binding which these modes (and probably others) require.

Sounds reasonable. Now shx works for sly now, thanks.