all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* RE: How do you scroll the screen without moving the cursor ? (theC-E and C-Y keys in vi)
  2008-10-03  6:42 How do you scroll the screen without moving the cursor ? (the C-E " zoltan
@ 2008-10-03 14:20 ` Parker, Matthew
  0 siblings, 0 replies; 8+ messages in thread
From: Parker, Matthew @ 2008-10-03 14:20 UTC (permalink / raw)
  To: zoltan, help-gnu-emacs

This might not be the most elegant... but it works... and I think it is what you have in mind...

Add these to .emacs, and try Control-Alt-n or p

  ;; Navigation Functions
      (defun scroll-up-by-one-line()
        "scroll ahead one line at a time"
        (interactive)
        (scroll-up 1))

      
      (defun scroll-down-by-one-line()
        "scroll ahead one line at a time"
        (interactive)
        (scroll-down 1))

  ;; key bindings

      (global-set-key "\C-\M-n" 'scroll-up-by-one-line)
      (global-set-key "\C-\M-p" 'scroll-down-by-one-line)


Matthew Parker

SEI  | 1 Freedom Valley Drive | Oaks, PA 19456 | p: 610-676-1279 | f: 484-676-1279 | www.seic.com

-----Original Message-----
From: help-gnu-emacs-bounces+mparker=seic.com@gnu.org [mailto:help-gnu-emacs-bounces+mparker=seic.com@gnu.org] On Behalf Of zoltan
Sent: Friday, October 03, 2008 2:43 AM
To: help-gnu-emacs@gnu.org
Subject: Re: How do you scroll the screen without moving the cursor ? (theC-E and C-Y keys in vi)

On Oct 3, 7:46 am, Livin Stephen <livin.step...@gmail.com> wrote:
> On Oct 3, 3:11 am, "David Lam" <david.k.l...@gmail.com> wrote:
>
> >...
> > i saw this...http://www.wlindley.com/gnu/vi and in the first two rows
> > theres no listed equivalent
> > ...
>
> David,
>  C-v is how you scroll one-page-at-a-time, so with numerical arguments
> ( "C-u 1" [ or "Cu -1" ] ),
> here is how I would do it:
>
> C-u 1 C-v for "up", and
> C-u -1 C-v for "down" .
>
> I don't know *any* lisp,
>  so if I found myself wanting to do this a lot,
>  I would probably create a macro and setup a key-binding.

You can also use M-v to scroll up.
And C-M-v to scroll down the next buffer




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

* Re: How do you scroll the screen without moving the cursor ? (theC-E and C-Y keys in vi)
       [not found] <mailman.142.1223043676.25473.help-gnu-emacs@gnu.org>
@ 2008-10-03 15:31 ` Chris McMahan
  2008-10-03 16:09   ` Paul R
       [not found]   ` <mailman.153.1223050175.25473.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 8+ messages in thread
From: Chris McMahan @ 2008-10-03 15:31 UTC (permalink / raw)
  To: help-gnu-emacs

If that's not what you have in mind, I've been using these for some
time. They keep the cursor in place and move the text underneath it.

(defun scroll-down-in-place (n)
  (interactive "p")
  (previous-line n)
  (scroll-down n))

(defun scroll-up-in-place (n)
  (interactive "p")
  (next-line n)
  (scroll-up n))

(global-set-key "\M-n" 'scroll-up-in-place)
(global-set-key "\M-p" 'scroll-down-in-place)

- Chris

"Parker, Matthew" <MParker@seic.com> writes:

> This might not be the most elegant... but it works... and I think it is what you have in mind...
>
> Add these to .emacs, and try Control-Alt-n or p
>
>   ;; Navigation Functions
>       (defun scroll-up-by-one-line()
>         "scroll ahead one line at a time"
>         (interactive)
>         (scroll-up 1))
>
>       
>       (defun scroll-down-by-one-line()
>         "scroll ahead one line at a time"
>         (interactive)
>         (scroll-down 1))
>
>   ;; key bindings
>
>       (global-set-key "\C-\M-n" 'scroll-up-by-one-line)
>       (global-set-key "\C-\M-p" 'scroll-down-by-one-line)
>
>
> Matthew Parker
>
> SEI  | 1 Freedom Valley Drive | Oaks, PA 19456 | p: 610-676-1279 | f: 484-676-1279 | www.seic.com
>
> -----Original Message-----
> From: help-gnu-emacs-bounces+mparker=seic.com@gnu.org [mailto:help-gnu-emacs-bounces+mparker=seic.com@gnu.org] On Behalf Of zoltan
> Sent: Friday, October 03, 2008 2:43 AM
> To: help-gnu-emacs@gnu.org
> Subject: Re: How do you scroll the screen without moving the cursor ? (theC-E and C-Y keys in vi)
>
> On Oct 3, 7:46 am, Livin Stephen <livin.step...@gmail.com> wrote:
>> On Oct 3, 3:11 am, "David Lam" <david.k.l...@gmail.com> wrote:
>>
>> >...
>> > i saw this...http://www.wlindley.com/gnu/vi and in the first two rows
>> > theres no listed equivalent
>> > ...
>>
>> David,
>>  C-v is how you scroll one-page-at-a-time, so with numerical arguments
>> ( "C-u 1" [ or "Cu -1" ] ),
>> here is how I would do it:
>>
>> C-u 1 C-v for "up", and
>> C-u -1 C-v for "down" .
>>
>> I don't know *any* lisp,
>>  so if I found myself wanting to do this a lot,
>>  I would probably create a macro and setup a key-binding.
>
> You can also use M-v to scroll up.
> And C-M-v to scroll down the next buffer
>
>

-- 
     (.   .)
  =ooO=(_)=Ooo=====================================
  Chris McMahan | first_initiallastname@one.dot.net
  =================================================


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

* Re: How do you scroll the screen without moving the cursor ? (theC-E and C-Y keys in vi)
  2008-10-03 15:31 ` How do you scroll the screen without moving the cursor ? (theC-E and C-Y keys in vi) Chris McMahan
@ 2008-10-03 16:09   ` Paul R
  2008-10-03 19:57     ` How do you create a "cscope buffer window" in ecb ? - very useful Sanjeev Kumar.S
       [not found]   ` <mailman.153.1223050175.25473.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 8+ messages in thread
From: Paul R @ 2008-10-03 16:09 UTC (permalink / raw)
  To: help-gnu-emacs


Chris> If that's not what you have in mind, I've been using these for
Chris> some time. They keep the cursor in place and move the text
Chris> underneath it.

Chris> (defun scroll-down-in-place (n) (interactive "p")
Chris> (previous-line n) (scroll-down n))

Chris> (defun scroll-up-in-place (n) (interactive "p") (next-line n)
Chris> (scroll-up n))

To avoid weird behaviour when seeing ends of your buffer, use the code
below.

(global-set-key [down] (lambda ()
			 (interactive)
			 (next-line 1)
			 (unless (eq (window-end) (point-max))
			   (scroll-up 1))))
(global-set-key [up] (lambda ()
		       (interactive)
		       (previous-line 1)
		       (unless (eq (window-start) (point-min))
			 (scroll-down 1))))

-- 
  Paul




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

* How do you create a "cscope buffer window" in ecb ? - very useful
  2008-10-03 16:09   ` Paul R
@ 2008-10-03 19:57     ` Sanjeev Kumar.S
  0 siblings, 0 replies; 8+ messages in thread
From: Sanjeev Kumar.S @ 2008-10-03 19:57 UTC (permalink / raw)
  To: help-gnu-emacs, Paul R

[-- Attachment #1: Type: text/plain, Size: 358 bytes --]

I've tried creating one with the name *cscope*, but it still says it is still an unassigned 
buffer. This would be useful as we don't have to worry about cscope cluttering
the window. for example i can have the main window open and see all the definitions of the 
symbol on the left hand side without splitting the main window. 

Regards,
Maindoor.



      

[-- Attachment #2: Type: text/html, Size: 495 bytes --]

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

* Re: How do you scroll the screen without moving the cursor ? (theC-E and C-Y keys in vi)
       [not found]   ` <mailman.153.1223050175.25473.help-gnu-emacs@gnu.org>
@ 2008-10-03 20:07     ` Chris McMahan
  2008-10-04  0:57       ` David Lam
  2008-10-04  9:03       ` Paul R
  2008-10-04 21:24     ` Livin Stephen
  1 sibling, 2 replies; 8+ messages in thread
From: Chris McMahan @ 2008-10-03 20:07 UTC (permalink / raw)
  To: help-gnu-emacs

Paul R <paul.r.ml@gmail.com> writes:

> Chris> If that's not what you have in mind, I've been using these for
> Chris> some time. They keep the cursor in place and move the text
> Chris> underneath it.
>
> Chris> (defun scroll-down-in-place (n) (interactive "p")
> Chris> (previous-line n) (scroll-down n))
>
> Chris> (defun scroll-up-in-place (n) (interactive "p") (next-line n)
> Chris> (scroll-up n))
>
> To avoid weird behaviour when seeing ends of your buffer, use the code
> below.
>
> (global-set-key [down] (lambda ()
> 			 (interactive)
> 			 (next-line 1)
> 			 (unless (eq (window-end) (point-max))
> 			   (scroll-up 1))))
> (global-set-key [up] (lambda ()
> 		       (interactive)
> 		       (previous-line 1)
> 		       (unless (eq (window-start) (point-min))
> 			 (scroll-down 1))))

Excellent! Thank you!

BTW, where can I get info on the key syntax you're using? [down] and
[up]...

- Chris

-- 
     (.   .)
  =ooO=(_)=Ooo=====================================
  Chris McMahan | first_initiallastname@one.dot.net
  =================================================


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

* Re: How do you scroll the screen without moving the cursor ? (theC-E and C-Y keys in vi)
  2008-10-03 20:07     ` How do you scroll the screen without moving the cursor ? (theC-E and C-Y keys in vi) Chris McMahan
@ 2008-10-04  0:57       ` David Lam
  2008-10-04  9:03       ` Paul R
  1 sibling, 0 replies; 8+ messages in thread
From: David Lam @ 2008-10-04  0:57 UTC (permalink / raw)
  To: Chris McMahan; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1678 bytes --]

aww cool thanks... i just tried the stuffs

this is what i ended up with ->

;; ^E in Vi
(defun ctrl-e-in-vi (n)
 (interactive "p")
 (scroll-down n))

;; ^Y in Vi
(defun ctrl-y-in-vi (n)
 (interactive "p")
 (scroll-up n))

(global-set-key "\M-n" 'ctrl-y-in-vi)
(global-set-key "\M-p" 'ctrl-e-in-vi)






On Fri, Oct 3, 2008 at 1:07 PM, Chris McMahan <
first_initiallastname@one.dot.net> wrote:

> Paul R <paul.r.ml@gmail.com> writes:
>
> > Chris> If that's not what you have in mind, I've been using these for
> > Chris> some time. They keep the cursor in place and move the text
> > Chris> underneath it.
> >
> > Chris> (defun scroll-down-in-place (n) (interactive "p")
> > Chris> (previous-line n) (scroll-down n))
> >
> > Chris> (defun scroll-up-in-place (n) (interactive "p") (next-line n)
> > Chris> (scroll-up n))
> >
> > To avoid weird behaviour when seeing ends of your buffer, use the code
> > below.
> >
> > (global-set-key [down] (lambda ()
> >                        (interactive)
> >                        (next-line 1)
> >                        (unless (eq (window-end) (point-max))
> >                          (scroll-up 1))))
> > (global-set-key [up] (lambda ()
> >                      (interactive)
> >                      (previous-line 1)
> >                      (unless (eq (window-start) (point-min))
> >                        (scroll-down 1))))
>
> Excellent! Thank you!
>
> BTW, where can I get info on the key syntax you're using? [down] and
> [up]...
>
> - Chris
>
> --
>     (.   .)
>  =ooO=(_)=Ooo=====================================
>  Chris McMahan | first_initiallastname@one.dot.net
>  =================================================
>

[-- Attachment #2: Type: text/html, Size: 3087 bytes --]

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

* Re: How do you scroll the screen without moving the cursor ? (theC-E and C-Y keys in vi)
  2008-10-03 20:07     ` How do you scroll the screen without moving the cursor ? (theC-E and C-Y keys in vi) Chris McMahan
  2008-10-04  0:57       ` David Lam
@ 2008-10-04  9:03       ` Paul R
  1 sibling, 0 replies; 8+ messages in thread
From: Paul R @ 2008-10-04  9:03 UTC (permalink / raw)
  To: Chris McMahan; +Cc: help-gnu-emacs

On Fri, 03 Oct 2008 16:07:24 -0400, Chris McMahan <first_initiallastname@one.dot.net> said:
Chris> BTW, where can I get info on the key syntax you're using?
Chris> [down] and [up]...

In emacs documentation, look for "key bindings".
Also, if you want an in-depth review of emacs-all-flavour-all-versions
key bindings syntax, read this good ressource :
     http://tiny-tools.sourceforge.net/emacs-keys.html

-- 
  Paul




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

* Re: How do you scroll the screen without moving the cursor ? (theC-E and C-Y keys in vi)
       [not found]   ` <mailman.153.1223050175.25473.help-gnu-emacs@gnu.org>
  2008-10-03 20:07     ` How do you scroll the screen without moving the cursor ? (theC-E and C-Y keys in vi) Chris McMahan
@ 2008-10-04 21:24     ` Livin Stephen
  1 sibling, 0 replies; 8+ messages in thread
From: Livin Stephen @ 2008-10-04 21:24 UTC (permalink / raw)
  To: help-gnu-emacs

On Oct 3, 9:09 pm, Paul R <paul.r...@gmail.com> wrote:
> Chris> If that's not what you have in mind, I've been using these for
> Chris> some time. They keep the cursor in place and move the text
> Chris> underneath it.
>
> Chris> (defun scroll-down-in-place (n) (interactive "p")
> Chris> (previous-line n) (scroll-down n))
>
> Chris> (defun scroll-up-in-place (n) (interactive "p") (next-line n)
> Chris> (scroll-up n))
>
> To avoid weird behaviour when seeing ends of your buffer, use the code
> below.
>
> (global-set-key [down] (lambda ()
>                          (interactive)
>                          (next-line 1)
>                          (unless (eq (window-end) (point-max))
>                            (scroll-up 1))))
> (global-set-key [up] (lambda ()
>                        (interactive)
>                        (previous-line 1)
>                        (unless (eq (window-start) (point-min))
>                          (scroll-down 1))))
>
> --
>   Paul

The initial request from David Lam was for scrolling-in-place such
that
 the cursor remained "in place" with respect to the text - not with
respect to the frame/window.

In VI, C-e (C-y is the counterpart),
1. scrolls the page up by line, AND
2. moves the up cursor ALSO by one line - so that it stays at the same
character at which it was originally.

In the lisp examples (thanks for them!), I commented out "(previous-
line 1)" and "(next-line 1)" to achieve this.

 I *do* also like what your original lisp samples do.



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

end of thread, other threads:[~2008-10-04 21:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.142.1223043676.25473.help-gnu-emacs@gnu.org>
2008-10-03 15:31 ` How do you scroll the screen without moving the cursor ? (theC-E and C-Y keys in vi) Chris McMahan
2008-10-03 16:09   ` Paul R
2008-10-03 19:57     ` How do you create a "cscope buffer window" in ecb ? - very useful Sanjeev Kumar.S
     [not found]   ` <mailman.153.1223050175.25473.help-gnu-emacs@gnu.org>
2008-10-03 20:07     ` How do you scroll the screen without moving the cursor ? (theC-E and C-Y keys in vi) Chris McMahan
2008-10-04  0:57       ` David Lam
2008-10-04  9:03       ` Paul R
2008-10-04 21:24     ` Livin Stephen
2008-10-03  6:42 How do you scroll the screen without moving the cursor ? (the C-E " zoltan
2008-10-03 14:20 ` How do you scroll the screen without moving the cursor ? (theC-E " Parker, Matthew

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.