unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Automatically move cursor to end of shell-mode buffer on M-p / M-n
@ 2015-02-24 15:50 Andrew Pennebaker
  2015-02-25  1:30 ` Robert Thorpe
  2015-02-25 13:51 ` J. David Boyd
  0 siblings, 2 replies; 5+ messages in thread
From: Andrew Pennebaker @ 2015-02-24 15:50 UTC (permalink / raw)
  To: Emacs Help

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?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Automatically move cursor to end of shell-mode buffer on M-p / M-n
  2015-02-24 15:50 Automatically move cursor to end of shell-mode buffer on M-p / M-n Andrew Pennebaker
@ 2015-02-25  1:30 ` Robert Thorpe
  2015-02-25  3:04   ` John Mastro
  2015-02-25 13:51 ` J. David Boyd
  1 sibling, 1 reply; 5+ messages in thread
From: Robert Thorpe @ 2015-02-25  1:30 UTC (permalink / raw)
  To: Andrew Pennebaker; +Cc: help-gnu-emacs

Andrew Pennebaker <andrew.pennebaker@gmail.com> 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.

Doesn't C-a do that?  It does for me.

BR,
Robert Thorpe



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Automatically move cursor to end of shell-mode buffer on M-p / M-n
  2015-02-25  1:30 ` Robert Thorpe
@ 2015-02-25  3:04   ` John Mastro
  0 siblings, 0 replies; 5+ messages in thread
From: John Mastro @ 2015-02-25  3:04 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org; +Cc: Andrew Pennebaker, Robert Thorpe

>> 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.
>
> Doesn't C-a do that?  It does for me.

I believe Andrew is thinking of the situation where you're on a
different (i.e. previous) line.

This sometimes happens to me too, typically after I've done an isearch
to look at some earlier output. I'm trying out Andrew's idea and so far
I like it.

-- 
john



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Automatically move cursor to end of shell-mode buffer on M-p / M-n
  2015-02-24 15:50 Automatically move cursor to end of shell-mode buffer on M-p / M-n Andrew Pennebaker
  2015-02-25  1:30 ` Robert Thorpe
@ 2015-02-25 13:51 ` J. David Boyd
  2015-02-25 15:15   ` Andrew Pennebaker
  1 sibling, 1 reply; 5+ messages in thread
From: J. David Boyd @ 2015-02-25 13:51 UTC (permalink / raw)
  To: help-gnu-emacs

Andrew Pennebaker <andrew.pennebaker@gmail.com> 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




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Automatically move cursor to end of shell-mode buffer on M-p / M-n
  2015-02-25 13:51 ` J. David Boyd
@ 2015-02-25 15:15   ` Andrew Pennebaker
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Pennebaker @ 2015-02-25 15:15 UTC (permalink / raw)
  To: J. David Boyd; +Cc: Emacs Help

That's an interesting setting. Though most of my command line interaction
is going up/down in the history and pressing enter, not sure if M-p / M-n
qualifies as input.

On Wed, Feb 25, 2015 at 7:51 AM, J. David Boyd <dboyd2@mmm.com> wrote:

> Andrew Pennebaker <andrew.pennebaker@gmail.com> 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
>
>
>


-- 
Cheers,

Andrew Pennebaker
www.yellosoft.us


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-02-25 15:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-24 15:50 Automatically move cursor to end of shell-mode buffer on M-p / M-n Andrew Pennebaker
2015-02-25  1:30 ` Robert Thorpe
2015-02-25  3:04   ` John Mastro
2015-02-25 13:51 ` J. David Boyd
2015-02-25 15:15   ` Andrew Pennebaker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).