Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Scrolling emacs window one line at a time

195 views
Skip to first unread message

Tarvinder Pal Singh

unread,
Apr 18, 1994, 8:38:05 PM4/18/94
to
Hi !
I am using emacs ver 18.58.1. Is it possible to scroll one line at
a time instead of half screen ?

Thanks
Tarvinder

Jim....@umich.edu

unread,
Apr 20, 1994, 6:46:09 PM4/20/94
to
In article <1994Apr19.0...@newstand.syr.edu>, tps...@furud.npac.syr.edu (Tarvinder Pal Singh) writes:

I am using emacs ver 18.58.1. Is it possible to scroll one line at
a time instead of half screen ?

Here's how I do it. With 18.58 you'll have to find some other key to bind
it to, obviously.

(defun scroll-up-one (arg)
"Scroll up one line."
(interactive "p")
(scroll-up arg))

(defun scroll-down-one (arg)
"Scroll down one line."
(interactive "p")
(scroll-down arg))

(global-set-key [S-up] 'scroll-down-one)
(global-set-key [S-down] 'scroll-up-one)

Lee Duncan

unread,
Apr 20, 1994, 8:25:27 PM4/20/94
to
Jim....@umich.edu wrote:
: In article <1994Apr19.0...@newstand.syr.edu>,

Tarvinder may have been asking about the auto scrolling that occurs when
you move off of the end of a window. The default for emacs is to scroll
one have the window scroll 1/2 window's worth.

To change this, use:

(setq scroll-step 1)

If you "gently" try to move past the top or bottom of your window, emacs will
scroll one line -- but, if you you move too quickly, such that emacs saves
up your move requests, then tries to move more than one line past the
end of the screen, you'll still get the half-screen behaviour.

Note: I use C-u C-v alot -- this scrolls the whole window 4 lines.

--
Lee Duncan Lee.D...@Sun.COM

Don't know if I can handle this -- Another day in metropolis -- Spin Doctors

Sunsoft, INC Rocky Mountain Technology Center

Alex Mystic Soto

unread,
Apr 21, 1994, 1:22:27 PM4/21/94
to

In .emacs:

(setq scroll-step 1)

Mystic
--
----------------------------------------------------------------------------
Mystic (617) 527-5571 (Home)
(alex...@analog.com) (617) 461-3822 (Work)
Analog Devices, Inc
----------------------------------------------------------------------------

Michael Hucka

unread,
Apr 22, 1994, 1:04:26 AM4/22/94
to
While on this topic, I'd like to share some scrolling & window resizing
customizations for Emacs 19 that I find extremely handy.

The comments and code below should be pretty self-explanatory. Just a word
about my motivations: I often found myself (1) adjusting the position of
something on the screen by a few lines at a time (e.g., using C-u C-v) and
(2) adjusting the sizes of windows just a jew lines at a time. My solution
was to bind `M-"' and `M-'' to scroll up/down, because those keys are very
conveniently located, and to use `M-+' and `M-=' to resize windows. These
may seem unintuitive at first, but they make more sense once you start using
them.

The bindings of the arrow keys just seemed like natural extensions, and are
more intuitive.

Note that these bindings redefine some standard Emacs functions, but they
happened to be ones that I personally never used. That may not be true for
other users. Also, these only make sense if one has a true Meta key -- if
you have to hit ESC, forget it; this stuff is worthless to you.

But I find I can't live without these, especially the one-line-up/down
bindings and the window resizing stuff.

(Yes, I know about the scroll bars -- obviously I'm one of those people that
hate to take their fingers off the keyboard.)

;; Customizations to scrolling and window resizing.
;; Redefines `M-=' (count-lines-region), `ESC-'' (abbrev-prefix-mark).

;; Basic idea:
;; Control-arrow keys move left/right/up/down by one line increments,
;; Meta-arrow keys move left/right/up/down by screen increments.
;; `M-+' enlarges the current window,
;; `M-=' shrinks it.
;;
;; `C-up', etc. are the arrow keys to the right of the main keys on a typical
;; PC-style keyboard (i.e., what one finds on an SGI, IBM, or Sun type-4
;; keyboards).
;;
;; Special: M-" (scroll one line up)
;; M-' (scroll one line down)
;;
;; I find these very convenient to type, but they only make sense if you
;; have a true Meta key. (These are senseless if you have to hit ESC).

(setq scroll-step 1)

(global-set-key "\e+" 'enlarge-window)
(global-set-key "\e=" 'shrink-window)
(global-set-key "\e\"" 'scroll-up-one-line)
(global-set-key "\e'" 'scroll-down-one-line)
(global-set-key [C-up] 'scroll-up-one-line)
(global-set-key [C-down] 'scroll-down-one-line)
(global-set-key [C-left] 'scroll-left-one-column)
(global-set-key [C-right] 'scroll-right-one-column)
(global-set-key [M-up] 'scroll-up)
(global-set-key [M-down] 'scroll-down)
(global-set-key [M-left] 'scroll-left)
(global-set-key [M-right] 'scroll-right)

(defun scroll-up-one-line ()
"Scroll text of current window upward 1 line."
(interactive)
(scroll-up 1))

(defun scroll-down-one-line ()
"Scroll text of current window downward 1 line."
(interactive)
(scroll-down 1))

(defun scroll-left-one-column ()
"Scroll selected window display 1 column to the left."
(interactive)
(scroll-left 1))

(defun scroll-right-one-column ()
"Scroll selected window display 1 column to the right."
(interactive)
(scroll-right 1))

;;; end
--
-- Mike Hucka
University of Michigan, Ann Arbor, Mich.

0 new messages