[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [h-e-w] Using control keys in bash shell within emacs
From: |
Rajesh J Advani |
Subject: |
RE: [h-e-w] Using control keys in bash shell within emacs |
Date: |
Thu, 10 Oct 2002 20:21:51 +0530 |
I just got used to using C-up, C-down for these. It's pretty neat.
eshell works the way you want it to, though. Up/Down cycles through
history. I find _that_ pretty annoying.
--
Rajesh J Advani
----------------------------
If you can feel the thorns,
there must be a rose nearby.
> -----Original Message-----
> From: Eli Daniel [mailto:address@hidden
> Sent: Thursday, October 10, 2002 8:01 PM
> To: 'Jeff Rancier'; 'Emacs Help (Windows)'
> Subject: RE: [h-e-w] Using control keys in bash shell within emacs
>
>
> You're inside emacs, so C-p (or the up key) just moves you up a line;
> there's a different function for cycling through history. I too found
> this annoying, so I wrote some code to detect whether I'm at a command
> prompt and, if so, to scroll through history instead of moving the
> cursor when I press the up and down keys.
>
> The downside to this is that if I really do want to scroll up
> in a shell
> buffer, I have to either use pgup, or left-arrow so I'm not at the
> prompt before pressing the up key.
>
> Anyway, here's the code... hope it's useful:
>
> ;; move cursor to the previous line or get previous history item,
> depending
> ;; on whether we're at a shell mode prompt
> (defun ewd-comint-up (arg)
> (interactive "p")
> (if (comint-after-pmark-p)
> (comint-previous-input arg)
> (previous-line arg)))
>
> ;; move cursor to the next line or get next history item, depending
> ;; on whether we're at a shell mode prompt
> (defun ewd-comint-down (arg)
> (interactive "p")
> (if (comint-after-pmark-p)
> (comint-next-input arg)
> (next-line arg)))
>
> ;; bind my special functions to the up and down keys in shell-mode
> (add-hook 'shell-mode-hook
> (lambda ()
> (define-key shell-mode-map [up] 'ewd-comint-up)
> (define-key shell-mode-map [down] 'ewd-comint-down)))
>
>
> -Eli Daniel
>
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On Behalf Of Jeff Rancier
> Sent: Thursday, October 10, 2002 9:12 AM
> To: Emacs Help (Windows)
> Subject: [h-e-w] Using control keys in bash shell within emacs
>
> Hi,
>
> I'm using cygwin bash, 2.05b, as my NTEmacs shell (GNU Emacs 21.2.1
> (i386-msvc-nt5.1.2600) of 2002-03-19 on buffy). Is there any way to
> have
> (e.g.) C-p, scroll through the history, instead of the default emacs
> behaviour of moving to the previous line in a buffer. I tried:
>
> set -o emacs
>
> in my .bash_profile/.bashrc, but that didn't work. Works fine when I
> kick
> off cygwin bash outside of NTEmacs. If this kind of thing
> doesn't work,
> can
> someone explain the advantage of kicking off a bash shell inside of
> Emacs?
>
InterScan_Disclaimer.txt
Description: Text document