unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Alan Mackenzie<none@example.invalid>
Subject: Re: Buffer Positioning
Date: Sat, 11 Jan 2003 08:46:00 +0000	[thread overview]
Message-ID: <8klova.r5.ln@acm.acm> (raw)
In-Reply-To: DCBT9.17709$aG4.691363@twister.austin.rr.com

CarlC <carlc@snowbd.com> wrote on Fri, 10 Jan 2003 15:26:27 GMT:
> Hi, All.

[ .... ]

> 2) How can I get arrow up/down to scroll the buffer by one line? If my
> cursor is on the last line of the window, I want a down arrow to remain
> at the bottom of the window (on the next line of the buffer).

Firstly, are you SURE you want arrow up/down to scroll the buffer?  If
so, you won't be able to use these keys for moving the cursor, and will
need C-n and C-p for these purposes.

My solution is to have these function definitions in my .emacs:

*************************************************************************
(defun scrollup-n (&optional n)
  "Scroll the text up n (default 1) lines."
  (interactive "p")
  (scroll-up (or n 1))
)
(global-set-key [S-down] 'scrollup-n)

(defun scrolldown-n (&optional n)
  "Scroll the text down n (default 1) lines."
  (interactive "p")
  (scroll-down (or n 1))
)
(global-set-key [S-up] 'scrolldown-n)

(defun scrollup-6n (&optional n)
  "Scroll the text up 6n (default 6) lines."
  (interactive "p")
  (scroll-up (* 6 (or n 1)))
)
(global-set-key [C-S-down] 'scrollup-6n)

(defun scrolldown-6n (&optional n)
  "Scroll the text down 6n (default 6) lines."
  (interactive "p")
  (scroll-down (* 6 (or n 1)))
)
(global-set-key [C-S-up] 'scrolldown-6n)
*************************************************************************

As can be seen, I use SHIFT-up/down for scrolling by a single line, and
Control-shift-up/down for scrolling six lines at a time.  You can modify
the global-set-key calls easily enough to take the SHIFT away.

> Any comments on these functions would be welcome. Thanks.

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").

  parent reply	other threads:[~2003-01-11  8:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-10 15:26 Buffer Positioning CarlC
2003-01-11  2:45 ` Jesper Harder
2003-01-11 10:32   ` Klaus Berndl
2003-01-13 16:08   ` CarlC
2003-01-11  8:46 ` Alan Mackenzie [this message]
2003-01-11 21:14   ` Kai Großjohann
2003-01-13 16:10     ` CarlC
2003-01-11 23:49 ` Eric Eide

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8klova.r5.ln@acm.acm \
    --to=none@example.invalid \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).