help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automatically move cursor to end of shell-mode buffer on M-p / M-n


From: J. David Boyd
Subject: Re: Automatically move cursor to end of shell-mode buffer on M-p / M-n
Date: Wed, 25 Feb 2015 08:51:13 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (cygwin)

Andrew Pennebaker <address@hidden> writes:

> As a shell user, I want shell-mode M-p / M-n to automatically move my
> cursor to the shell prompt, so that shell-mode behaves more intuitively.
>
> Currently, attempting to use M-p / M-n when the cursor is not at the
> prompt, results in a warning message. I think we can make shell-mode behave
> more intuitively.
>
> I have a workaround for this in my .emacs:
>
> ;; Automatically move cursor to prompt on shell up/down
> (add-hook 'shell-mode-hook
>           (lambda ()
>             (define-key comint-mode-map (kbd "M-p")
>               (lambda (arg)
>                 (interactive "*p")
>                 (goto-char (point-max))
>                 (comint-previous-input arg)))
>             (define-key comint-mode-map (kbd "M-n")
>               (lambda (arg)
>                 (interactive "*p")
>                 (goto-char (point-max))
>                 (comint-next-input arg)))))
>
> In the next version of Emacs, could we bake this behavior in, so that
> shell-mode behaves more intuitively?

What about setting comint-scroll-to-bottom-on-input to true?  ()I have that set
when I am in a shell buffer, and any keystrokes move me right to the bottom
and the prompt.)

Documentation:
Controls whether input to interpreter causes window to scroll.
If nil, then do not scroll.  If t or `all', scroll all windows showing buffer.
If `this', scroll only the selected window.

The default is nil.


Dave




reply via email to

[Prev in Thread] Current Thread [Next in Thread]