* Re: Scroll preserving point position - other meaning
2009-01-15 7:29 Scroll preserving point position - other meaning volodyan
@ 2009-01-15 15:25 ` Lennart Borgman
[not found] ` <mailman.4942.1232033132.26697.help-gnu-emacs@gnu.org>
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Lennart Borgman @ 2009-01-15 15:25 UTC (permalink / raw
To: volodyan; +Cc: Help-gnu-emacs
On Thu, Jan 15, 2009 at 8:29 AM, volodyan <volodyan@gmail.com> 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? 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.
I think that can't be done. If I remember correctly this was discussed
on Emacs devel a while ago.
What you can do is open a new window and do what you want there.
> 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. 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?
I think this was also discussed. You may want to try do ask this on
Emacs developers list.
> Thanks for your help
> --
> View this message in context: http://www.nabble.com/Scroll-preserving-point-position---other-meaning-tp21472671p21472671.html
> Sent from the Emacs - Help mailing list archive at Nabble.com.
>
>
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.4942.1232033132.26697.help-gnu-emacs@gnu.org>]
* Re: Scroll preserving point position - other meaning
[not found] ` <mailman.4942.1232033132.26697.help-gnu-emacs@gnu.org>
@ 2009-01-15 16:38 ` Andreas Politz
2009-01-15 21:27 ` volodyan
0 siblings, 1 reply; 8+ messages in thread
From: Andreas Politz @ 2009-01-15 16:38 UTC (permalink / raw
To: help-gnu-emacs
Lennart Borgman wrote:
> On Thu, Jan 15, 2009 at 8:29 AM, volodyan <volodyan@gmail.com> 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? 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.
>
> I think that can't be done. If I remember correctly this was discussed
> on Emacs devel a while ago.
I think one could write something like a modal scrolling,
like in this pseudo elisp.
(defun scroll-modal-pre-command-hook ()
"Pseudocode!"
(when (eq this-command 'scroll-bar-command)
(save-window-excursion
(while (scroll-bar-command-p)
(apply 'scroll-command)
(read-event)))))
I don't know if that's what eveybody has in mind here.
-ap
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Scroll preserving point position - other meaning
2009-01-15 16:38 ` Andreas Politz
@ 2009-01-15 21:27 ` volodyan
0 siblings, 0 replies; 8+ messages in thread
From: volodyan @ 2009-01-15 21:27 UTC (permalink / raw
To: Help-gnu-emacs
What should I do with this code? I've just started learning emacs, but
scrolling is so basic that I hope to make it as I like before I graduate my
emacs studies...
This is the emacs I use:
GNU Emacs 23.0.60.1 (x86_64-pc-linux-gnu, GTK+ Version 2.14.3)
------------------------------
Rant follows...
I cannot think of any use a point getting stuck somewhere on the edge of the
display or jump randomly when I scroll with a mouse. Every other editor I've
used waits for a left mouse click to position the point. Only arrows,
characters and mouse click move the point. I understand that some users like
the current behavior, just hope that I will be able to customize it. Ability
to customize supposed to be the strongest point of emacs and the first
response that IT JUST CANNOT BE DONE really frustrated me.
For example, as wrote earlier if a block of code is longer than a screen, I
can click on its closing bracket to highlight the region. But I just cannot
reach to see where the block starts as the highlighting will turn off as
soon as the point touches the edge of the screen.
End of rant.
Thanks,
Vlad
-----------------------------------------------------------------------------
I think one could write something like a modal scrolling,
like in this pseudo elisp.
(defun scroll-modal-pre-command-hook ()
"Pseudocode!"
(when (eq this-command 'scroll-bar-command)
(save-window-excursion
(while (scroll-bar-command-p)
(apply 'scroll-command)
(read-event)))))
I don't know if that's what eveybody has in mind here.
-ap
--
View this message in context: http://www.nabble.com/Scroll-preserving-point-position---other-meaning-tp21472671p21487298.html
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Scroll preserving point position - other meaning
2009-01-15 7:29 Scroll preserving point position - other meaning volodyan
2009-01-15 15:25 ` Lennart Borgman
[not found] ` <mailman.4942.1232033132.26697.help-gnu-emacs@gnu.org>
@ 2009-01-15 21:55 ` tyler
2009-01-15 23:14 ` Alan Mackenzie
3 siblings, 0 replies; 8+ messages in thread
From: tyler @ 2009-01-15 21:55 UTC (permalink / raw
To: help-gnu-emacs
volodyan <volodyan@gmail.com> writes:
> I am using Emacs with X and struggling to do the following. How can I
> preserve point's position while scrolling IN TEXT?
Others have sent you code that maybe can solve this problem, although
I'm not sure it's possible. Another approach that might be simpler is to
use the mark. If you set the mark before you start scrolling (C-spc),
you can then return to the spot you started at with C-x C-x.
> 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 want to find the matching parenthesis, put the cursor/point on
the first one and use M-C-n to jump to the closing parenthesis. Or put
point on the closing bracket and use M-C-p to jump to the opening
parenthesis.
> 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?
I'm not sure if you can actually get the specific behaviour you want
with Emacs, but if you experiment a bit you might find keyboard
shortcuts that achieve the same objective. Most of the time I've found
that things that seem really dumb/painful in Emacs are that way because
there is a more sensible alternative. Finding those alternatives is part
of the fun of Emacs.
Cheers,
Tyler
--
Saint Mary's - they do science there!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Scroll preserving point position - other meaning
2009-01-15 7:29 Scroll preserving point position - other meaning volodyan
` (2 preceding siblings ...)
2009-01-15 21:55 ` tyler
@ 2009-01-15 23:14 ` Alan Mackenzie
2009-01-16 3:10 ` volodyan
3 siblings, 1 reply; 8+ messages in thread
From: Alan Mackenzie @ 2009-01-15 23:14 UTC (permalink / raw
To: volodyan; +Cc: Help-gnu-emacs
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).
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Scroll preserving point position - other meaning
2009-01-15 23:14 ` Alan Mackenzie
@ 2009-01-16 3:10 ` volodyan
0 siblings, 0 replies; 8+ messages in thread
From: volodyan @ 2009-01-16 3:10 UTC (permalink / raw
To: Help-gnu-emacs
I was trying to use Emacs in "browser mode": while editing keystrokes are
very convenient, but when reading code I like to use a mouse, highlight a
piece of code selecting it and then use scroll bar to read it and around.
But I will learn alternative ways. Still I tried to find the discussion on
this on DEV list and couldn't. I still find it hard to believe that adding a
couple of global variables cannot make the cursor disappear when it touches
the edge of the window and then reappear on entry. (I've never seen Emacs
code before :-)
Alan Mackenzie wrote:
>
> Hi,
>
>
>> 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.
>
>
>> 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).
>
>
>
>
--
View this message in context: http://www.nabble.com/Scroll-preserving-point-position---other-meaning-tp21472671p21491801.html
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 8+ messages in thread