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

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

Re: Scroll preserving point position - other meaning


From: Alan Mackenzie
Subject: Re: Scroll preserving point position - other meaning
Date: Thu, 15 Jan 2009 23:14:33 +0000
User-agent: Mutt/1.5.9i

Hi,

On Wed, Jan 14, 2009 at 11:29:57PM -0800, volodyan wrote:

> Hi,
> I am using Emacs with X and struggling to do the following. How can I
> preserve point's position while scrolling IN TEXT?

You can't.  This is one of the few things, possibly the only thing, that
you can't configure in Emacs.  "Point" (that's the cursor position) is
constrained to be on the screen; lots of code depends on this.

The next question is what do you _really_ want to do?  There are likely
other things ways you can achieve this, whatever it is, in Emacs.

> I spent hours roaming through Internet/searched the forum, but everyone
> seems to be interested in preserving point's position on screen. I want
> to be able to use scroll bar with a mouse or PageUp/Down to look
> something up and then return, but the point insists on staying on
> screen. 

It does.  A couple of suggestions:

(i) Split the screen with C-x 2 (That's "control-x" then "2").  Scroll
within one of the windows.  Point will stay the same in the other window.
When you're ready, do C-x 0 to get rid of the "scrolly" window.

(ii) Do C-x <space> to set the "mark" to point.  Scroll arbitrarily.
Then do C-u C-x <space> to jump back to the mark.

> Another, I think related issue, if I want to find a matching
> parentheses, I click on one and the region between the two is selected.
> If this region fits the screen - fine. But if not, when I try scrolling
> using a mouse to find another end of the region, the region gets
> unselected.

If you're at an open paren, C-M-n (that's "control-meta-n", i.e. hold the
control and alt keys whilst you type n; the PC's alt key is called "meta"
for historical reasons) will take you to the matching close paren.  C-M-p
will take you from (just after) a close paren back to the open paren.
Think of "next" for n and "previous" for p.  Actually, you don't have to
be AT the paren, just outside it, somewhere.  A related command is C-M-k,
which "kills" the entire bit between the following parens.  You can then
"yank" (i.e. paste) it back again somewhere with C-y.

> In all other graphical editors scrolling with a mouse doesn't move
> point/unselects region. I just "upgraded" to Emacs from Eclipse and I
> guess there is a way to get such behavior in Emacs. How?

Emacs is primarily a text editor.  :-)  It works equally well on a
terminal without a mouse, say over a comms line.  Only some actions can
be done conveniently with the mouse.  I'd recommend you to learn some
key sequences (such as the ones above) too.  Try C-M-a and C-M-e
sometime.  :-)

> Thanks for your help

-- 
Alan Mackenzie (Nuremberg, Germany).




reply via email to

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