unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Emacs text cursor position
@ 2005-01-23  3:05 AM
  2005-01-23  4:36 ` Eli Zaretskii
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: AM @ 2005-01-23  3:05 UTC (permalink / raw)


I'm trying to customize Emacs to my needs/wants and so far so good.
The only snag I encountered is in the position of the cursor. I want
to be able to to scroll the  buffer with mouse wheel or on the scroll
bars and have the cursor remain on the original line, even if the
cursor moves off-screen. Then when I start typing, emacs does C-l to
center back on the cursor, if the cursor is off-screen.

Is it possible to customize Emacs in this way? How can I set "mouse
scroll" not to affect the position of the cursor?

Thanks,
Adam

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Emacs text cursor position
  2005-01-23  3:05 Emacs text cursor position AM
@ 2005-01-23  4:36 ` Eli Zaretskii
  2005-01-23 13:33 ` David Hansen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2005-01-23  4:36 UTC (permalink / raw)


> From: ummajera@yahoo.ca (AM)
> Date: 22 Jan 2005 19:05:15 -0800
> 
> Is it possible to customize Emacs in this way? How can I set "mouse
> scroll" not to affect the position of the cursor?

Not easily, perhaps not at all.  Emacs's display engine was designed
with the explicit requirement that the cursor (which shows the
position of point, the place where characters you type are inserted)
is always visible.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Emacs text cursor position
  2005-01-23  3:05 Emacs text cursor position AM
  2005-01-23  4:36 ` Eli Zaretskii
@ 2005-01-23 13:33 ` David Hansen
  2005-01-23 14:48 ` Thien-Thi Nguyen
  2005-01-25 19:04 ` Cristian Gutierrez
  3 siblings, 0 replies; 5+ messages in thread
From: David Hansen @ 2005-01-23 13:33 UTC (permalink / raw)


On 22 Jan 2005 19:05:15 -0800 AM wrote:

> Is it possible to customize Emacs in this way? How can I set "mouse
> scroll" not to affect the position of the cursor?

I don't think so.  You may like (info "(emacs)Mark Ring") for
quick saving of positions within a buffer.

I often use `clone-indirect-buffer' when i have to edit/view two
parts of the same file.

David

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Emacs text cursor position
  2005-01-23  3:05 Emacs text cursor position AM
  2005-01-23  4:36 ` Eli Zaretskii
  2005-01-23 13:33 ` David Hansen
@ 2005-01-23 14:48 ` Thien-Thi Nguyen
  2005-01-25 19:04 ` Cristian Gutierrez
  3 siblings, 0 replies; 5+ messages in thread
From: Thien-Thi Nguyen @ 2005-01-23 14:48 UTC (permalink / raw)


ummajera@yahoo.ca (AM) writes:

> How can I set "mouse
> scroll" not to affect the position of the cursor?

probably you can remember the point on first
mouse scroll event and jump to it later.  you
can hide display of the cursor during scrolling.

rough sketch:
- advise scrolling commands to save point
  unless last-command is a scrolling command
- advise scrolling commands to hide cursor
- advise all other commands (or maybe just C-l)
  to show the cursor
- advise C-l to jump to the saved point
- make all this advising into a minor mode

feel free to post code when you find/write it!

thi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Emacs text cursor position
  2005-01-23  3:05 Emacs text cursor position AM
                   ` (2 preceding siblings ...)
  2005-01-23 14:48 ` Thien-Thi Nguyen
@ 2005-01-25 19:04 ` Cristian Gutierrez
  3 siblings, 0 replies; 5+ messages in thread
From: Cristian Gutierrez @ 2005-01-25 19:04 UTC (permalink / raw)


Este domingo, ummajera@yahoo.ca dijo:
> I'm trying to customize Emacs to my needs/wants and so far so good.
> The only snag I encountered is in the position of the cursor. I want
> to be able to to scroll the  buffer with mouse wheel or on the scroll
> bars and have the cursor remain on the original line, even if the
> cursor moves off-screen. Then when I start typing, emacs does C-l to
> center back on the cursor, if the cursor is off-screen.
>
> Is it possible to customize Emacs in this way? How can I set "mouse
> scroll" not to affect the position of the cursor?

Not exactly what you're asking (dunno about the mouse wheel), but I use
this hack to scroll text without getting the cursor off the center of
the screen:

,----
| ;; "smooth" scroll
| (defun guti-scroll-up (cuenta)
|   (interactive "p")
|   (move-to-window-line nil)
|   (scroll-up cuenta)
|   (forward-line cuenta)
|   )
| 
| (defun guti-scroll-down (cuenta)
|   (interactive "p")
|   (move-to-window-line nil)
|   (scroll-down cuenta)
|   (forward-line (* -1 cuenta))
|   )
| 
| (global-set-key (kbd "C-<") 'guti-scroll-down)
| (global-set-key (kbd "C->") 'guti-scroll-up)
`----

HTH,

-- 
Cristian Gutierrez			http://www.dcc.uchile.cl/~crgutier
crgutier[@]dcc.uchile.cl                        Jabber:crgutier@jabber.org

"If builders built buildings the way programmers write programs, then
the first woodpecker that came along would destroy civilization."
                              -- Weinberg's Second Law.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-01-25 19:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-23  3:05 Emacs text cursor position AM
2005-01-23  4:36 ` Eli Zaretskii
2005-01-23 13:33 ` David Hansen
2005-01-23 14:48 ` Thien-Thi Nguyen
2005-01-25 19:04 ` Cristian Gutierrez

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).