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

Ctrl-RET doesn't copy the command text; it tries to find a file (likely not a bug in shx) #36

Open
epa opened this issue Apr 24, 2024 · 2 comments

Comments

@epa
Copy link

epa commented Apr 24, 2024

Hi, I am trying out shx (cloned from gitlab today) with emacs 28.2. If I move point to an earlier command and press C-RET, I expected the text of that command to be copied to the current prompt. But instead I get "Find file or URL: ~/" in the minibuffer. To reproduce

% emacs -q
In the *scratch* buffer run

(add-to-list 'load-path "~/git_working/shx-for-emacs/")
(require 'shx)

Then M-x shx to start a new shell buffer. Wait for the prompt to appear and enter echo hello followed by RET. The command runs. Then C-p a couple of times to move up to the previous prompt, and C-RET. But instead of copying the echo hello text to the current prompt to run again, it thinks I want to open a file.

The buffer does have shx active, as shown by (Shell:run shx) at the bottom.

I thought maybe it was the prompt printed by the shell that wasn't being recognized, so I tried setting the PS1 environment variable to a plain %, but that didn't help. The shell buffer is fontifying the prompt text differently to the commands I entered and the output of those commands.

You know, I think I may have found the problem. But I'll post this bug report just in case, as a helper for anyone else hitting the same issue. If I do C-h k to describe the key sequence, then press C-RET, it tells me

RET runs the command shx-send-input-or-open-thing

That's RET, not C-RET, so somehow the Ctrl key is not getting through. This connecting to a Linux box from a Windows desktop with PuTTY.

@epa
Copy link
Author

epa commented Apr 24, 2024

I added this to shx.el

(define-key keymap (kbd "M-RET") #'shx-send-input-or-copy-line)

Then I can move up to the earlier line and hit M-RET (on my PC keyboard, Alt-Enter) to copy. But it ends up copying the whole line, including the shell prompt, not just the text that was entered. Would you like me to file a separate issue for that?

@riscy
Copy link
Owner

riscy commented Apr 28, 2024

Thank you so much - I've had issues with different terminals as well, but hadn't gotten a chance to test with PuTTY.

No need to open a separate issue regarding copying the whole line; I'll use this issue to track that too. I've been having issues with it as well in certain situations (e.g. inferior python mode) so it's definitely itching me too.

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

No branches or pull requests

2 participants