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

Consider comint-send-input to only send if at end of buffer #72

Open
robnagler opened this issue Mar 24, 2023 · 0 comments
Open

Consider comint-send-input to only send if at end of buffer #72

robnagler opened this issue Mar 24, 2023 · 0 comments
Assignees

Comments

@robnagler
Copy link
Member

Maybe consider prompting on a multiline send, since that's not usual.

https://stackoverflow.com/a/52212547:

(defun my-comint-send-input-maybe ()
  "Only `comint-send-input' when point is after the latest prompt.

Otherwise move to the end of the buffer."
  (interactive)
  (let ((proc (get-buffer-process (current-buffer))))
    (if (and proc (>= (point) (marker-position (process-mark proc))))
        (comint-send-input)
      (goto-char (point-max)))))

(with-eval-after-load "comint"
  (define-key shell-mode-map [remap comint-send-input] 'my-comint-send-input-maybe))
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