unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Shortcut to have the cursor move X nu,ber of lines up or down
@ 2013-03-30  8:31 Rami A
  2013-03-30 14:36 ` Drew Adams
       [not found] ` <mailman.23099.1364654185.855.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Rami A @ 2013-03-30  8:31 UTC (permalink / raw)
  To: help-gnu-emacs

I would like to have the cursor move up or down X number of lines.
Kind of like C-n and C-p but instead of 1 line to be a programmable X number of lines.

Thanks in advance.


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

* RE: Shortcut to have the cursor move X nu,ber of lines up or down
  2013-03-30  8:31 Shortcut to have the cursor move X nu,ber of lines up or down Rami A
@ 2013-03-30 14:36 ` Drew Adams
  2013-03-30 20:43   ` Shortcut to have the cursor move X number " Gregory Benjamin
       [not found] ` <mailman.23099.1364654185.855.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 7+ messages in thread
From: Drew Adams @ 2013-03-30 14:36 UTC (permalink / raw)
  To: 'Rami A', help-gnu-emacs

> I would like to have the cursor move up or down X number of lines.
> Kind of like C-n and C-p but instead of 1 line to be a 
> programmable X number of lines.

`C-h k C-n' tells you that it runs the command `next-line', and that a prefix
arg does what you want: e.g., `C-6 C-n' moves down 6 lines.

If you want a command that always moves a particular number of lines then roll
that argument into the definition.

(defun six-lines-down ()
  "..."
  (interactive)
  (next-line 6))




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

* Re: Shortcut to have the cursor move X nu,ber of lines up or down
       [not found] ` <mailman.23099.1364654185.855.help-gnu-emacs@gnu.org>
@ 2013-03-30 19:49   ` Rami A
  0 siblings, 0 replies; 7+ messages in thread
From: Rami A @ 2013-03-30 19:49 UTC (permalink / raw)
  To: gnu.emacs.help; +Cc: help-gnu-emacs, Rami A

Excellent!
Thanks Drew...will try it out.



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

* Re: Shortcut to have the cursor move X number of lines up or down
  2013-03-30 14:36 ` Drew Adams
@ 2013-03-30 20:43   ` Gregory Benjamin
  2013-03-30 20:50     ` Drew Adams
  0 siblings, 1 reply; 7+ messages in thread
From: Gregory Benjamin @ 2013-03-30 20:43 UTC (permalink / raw)
  To: help-gnu-emacs

On Sat, Mar 30, 2013 at 07:36:09AM -0700, Drew Adams wrote:
> > I would like to have the cursor move up or down X number of lines.
> > Kind of like C-n and C-p but instead of 1 line to be a 
> > programmable X number of lines.
> 
> `C-h k C-n' tells you that it runs the command `next-line', and that a prefix
> arg does what you want: e.g., `C-6 C-n' moves down 6 lines.

Wouldn't that be: 'C-u 6 C-n'? You can do 'C-u 6 C-p' to go up,
or 'C-u -6 C-n' to go up.

> If you want a command that always moves a particular number of lines then roll
> that argument into the definition.
> 
> (defun six-lines-down ()
>   "..."
>   (interactive)
>   (next-line 6))
> 



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

* RE: Shortcut to have the cursor move X number of lines up or down
  2013-03-30 20:43   ` Shortcut to have the cursor move X number " Gregory Benjamin
@ 2013-03-30 20:50     ` Drew Adams
  2013-03-30 21:58       ` Bob Proulx
  0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2013-03-30 20:50 UTC (permalink / raw)
  To: 'Gregory Benjamin', help-gnu-emacs

> > e.g., `C-6 C-n' moves down 6 lines.
> 
> Wouldn't that be: 'C-u 6 C-n'? You can do 'C-u 6 C-p' to go up,
> or 'C-u -6 C-n' to go up.

C-6 has the same effect as C-u 6.
C-- 6 has the same effect as C-u -6.
C-- has the same effect as C-u -1.




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

* Re: Shortcut to have the cursor move X number of lines up or down
  2013-03-30 20:50     ` Drew Adams
@ 2013-03-30 21:58       ` Bob Proulx
  2013-03-30 22:03         ` Drew Adams
  0 siblings, 1 reply; 7+ messages in thread
From: Bob Proulx @ 2013-03-30 21:58 UTC (permalink / raw)
  To: help-gnu-emacs

Drew Adams wrote:
> Gregory Benjamin wrote:
> > > e.g., `C-6 C-n' moves down 6 lines.
> > 
> > Wouldn't that be: 'C-u 6 C-n'? You can do 'C-u 6 C-p' to go up,
> > or 'C-u -6 C-n' to go up.
> 
> C-6 has the same effect as C-u 6.
> C-- 6 has the same effect as C-u -6.
> C-- has the same effect as C-u -1.

That depends upon whether you are running emacs in a graphics window
or in a terminal window.  If in a graphics window then emacs can tell
that you are pressing Control + 6 individually.  But in a terminal
window then Control+6 produces C-^ instead and sends that to emacs.
And the rest produce a variety of other results.  Control+2 produces
C-@.  Control+3 produces ESC.  And so forth for the rest.

Bob



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

* RE: Shortcut to have the cursor move X number of lines up or down
  2013-03-30 21:58       ` Bob Proulx
@ 2013-03-30 22:03         ` Drew Adams
  0 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2013-03-30 22:03 UTC (permalink / raw)
  To: 'Bob Proulx', help-gnu-emacs

> > C-6 has the same effect as C-u 6.
> > C-- 6 has the same effect as C-u -6.
> > C-- has the same effect as C-u -1.
> 
> That depends upon whether you are running emacs in a graphics window
> or in a terminal window.  If in a graphics window then emacs can tell
> that you are pressing Control + 6 individually.  But in a terminal
> window then Control+6 produces C-^ instead and sends that to emacs.
> And the rest produce a variety of other results.  Control+2 produces
> C-@.  Control+3 produces ESC.  And so forth for the rest.

True.  A useful correction for those using `emacs -nw'.  Thx, Bob.




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

end of thread, other threads:[~2013-03-30 22:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-30  8:31 Shortcut to have the cursor move X nu,ber of lines up or down Rami A
2013-03-30 14:36 ` Drew Adams
2013-03-30 20:43   ` Shortcut to have the cursor move X number " Gregory Benjamin
2013-03-30 20:50     ` Drew Adams
2013-03-30 21:58       ` Bob Proulx
2013-03-30 22:03         ` Drew Adams
     [not found] ` <mailman.23099.1364654185.855.help-gnu-emacs@gnu.org>
2013-03-30 19:49   ` Shortcut to have the cursor move X nu,ber " Rami A

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).