help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there a way to move to next line in wrapped text?


From: Eric Eide
Subject: Re: Is there a way to move to next line in wrapped text?
Date: Wed, 07 Jan 2004 08:58:17 -0700 (MST)
User-agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.1 (Cuyahoga Valley, berkeley-unix)

"Jeff" == Jeff <jeffrey@cunningham.net> writes:

        Jeff> [...] when I do Ctrl-p or Ctrl-n to move up or down a line, it
        Jeff> goes to the next line in terms of linefeeds, not in terms of
        Jeff> wrapped text.  Are there keybindings I don't know about that will
        Jeff> move up and down to the next 'literal' line in the window?
        Jeff> (regardless of where linefeeds are?). If not, is there some other
        Jeff> way to do this?

The `scroll-in-place' package can help you with this.  Get it from:

        <http://www.cs.utah.edu/~eeide/emacs/scroll-in-place.el.gz>

Or if you are using XEmacs, you can get it as part of the XEmacs distribution.

Load the `scroll-in-place' package into your Emacs session, and then you can
use

        C-u 1 C-v       to move the cursor down screen one line ("scroll up")
        C-u 1 M-v       to move the cursor up one screen line ("scroll down")

Of course, `C-u 1 PgDown' and `C-u 1 PgUp' work just as well.

The keys `C-u 1' tell the scrolling commands how many lines to move, and it
turns out that the `scroll-in-place' commands remember the number of lines you
want to scroll, across a sequence of scrolling commands.  In other words, you
don't have to type `C-u 1' every time.  As long as you keep doing C-v and M-v
without interruption, you'll keep moving by the same distance each time.

To make one-line scrolling more convenient, you might want to define you own
one-line scrolling commands and bind them to keys --- something like this:

(defun scroll-down-one-line (arg)
  "Scroll down one line, or number of lines specified by prefix arg."
  (interactive "P")
    (let ((scroll-default-lines 1))
      (scroll-down-in-place arg)))

(global-set-key "\C-c\C-v" 'scroll-down-one-line)

The documentation in the `scroll-in-place.el' file comments (in the "advanced
customization" section) go into more detail about writing your own scrolling
commands.

Eric.

-- 
-------------------------------------------------------------------------------
Eric Eide <eeide@cs.utah.edu>  .         University of Utah School of Computing
http://www.cs.utah.edu/~eeide/ . +1 (801) 585-5512 voice, +1 (801) 581-5843 FAX


reply via email to

[Prev in Thread] Current Thread [Next in Thread]