unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Cursor stays in middle of frame vertically- minor mode?
@ 2008-04-09 14:45 David Bush
  2008-04-10  7:43 ` Jens Teich
  0 siblings, 1 reply; 5+ messages in thread
From: David Bush @ 2008-04-09 14:45 UTC (permalink / raw)
  To: help-gnu-emacs

I want the cursor to stay in the middle line of my frame as I view and 
edit. For example, if I am typing text and press Enter, the text above 
should scroll up, the text below stays put, and the cursor is sitting at 
the beginning of a new line in the middle of the frame. Any other 
operation that moves the cursor in that frame should have a similar 
result. The cursor stays in the vertical middle while the lines of text 
move. Of course if the cursor is in the first few lines, it could be 
nearer the top of the frame.

This is so basic, I would be amazed if it has not already been 
implemented, perhaps as some minor mode? I first saw this feature in an 
assembly language editor for the TRS-80 Color Computer. It was decidedly 
easier on my eyes and posture to look at the middle of the screen instead 
of the bottom. Emacs programmers aren't going to let some rinky dink 
editor from the stone age beat them out in this regard, are they?


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

* Re: Cursor stays in middle of frame vertically- minor mode?
  2008-04-09 14:45 Cursor stays in middle of frame vertically- minor mode? David Bush
@ 2008-04-10  7:43 ` Jens Teich
  2008-04-11  2:31   ` David Bush
  2008-04-11  4:14   ` Timothy Hobbs
  0 siblings, 2 replies; 5+ messages in thread
From: Jens Teich @ 2008-04-10  7:43 UTC (permalink / raw)
  To: help-gnu-emacs

David Bush <twixt@cstone.net> writes:

> I want the cursor to stay in the middle line of my frame as I view and 
> edit. 

You might be looking for centered-cursor-mode, see

http://www.emacswiki.org/cgi-bin/wiki/centered-cursor-mode.el

Jens


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

* Re: Cursor stays in middle of frame vertically- minor mode?
  2008-04-10  7:43 ` Jens Teich
@ 2008-04-11  2:31   ` David Bush
  2008-04-11  4:14   ` Timothy Hobbs
  1 sibling, 0 replies; 5+ messages in thread
From: David Bush @ 2008-04-11  2:31 UTC (permalink / raw)
  To: help-gnu-emacs

On Thu, 10 Apr 2008 09:43:56 +0200, Jens Teich <spamtrap@jensteich.de>
wrote:

> David Bush <twixt@cstone.net> writes:
> 
>> I want the cursor to stay in the middle line of my frame as I view and
>> edit.
> 
> You might be looking for centered-cursor-mode, see
> 
> http://www.emacswiki.org/cgi-bin/wiki/centered-cursor-mode.el
> 
> Jens

Fantastic, that's exactly what I want! Thanks.


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

* Re: Cursor stays in middle of frame vertically- minor mode?
  2008-04-10  7:43 ` Jens Teich
  2008-04-11  2:31   ` David Bush
@ 2008-04-11  4:14   ` Timothy Hobbs
  2008-04-11 12:44     ` Nikolaj Schumacher
  1 sibling, 1 reply; 5+ messages in thread
From: Timothy Hobbs @ 2008-04-11  4:14 UTC (permalink / raw)
  To: EMACS list

Jens Teich <spamtrap@jensteich.de> writes:

> David Bush <twixt@cstone.net> writes:
>
>> I want the cursor to stay in the middle line of my frame as I view and 
>> edit. 
>
> You might be looking for centered-cursor-mode, see
>
> http://www.emacswiki.org/cgi-bin/wiki/centered-cursor-mode.el
>
> Jens

You might also be interested in looking at this.
http://www.timthelion.com/cgi-bin/blosxom.cgi//emacs-polarity-reader.html
Though I'll note that my recenter-non-flashy is not perfect, and since the flashyness is only a problem with x11 emacs and I use -nw, I use at home:

(defadvice next-line (after scroll-with-cursor activate)
"scroll the window as you move the cursor"
  (recenter))

(defadvice previous-line (after scroll-with-cursor activate)
"scroll the window as you move the cursor"
        (recenter))

I don't use this, I lie, I'm using a small screen and so I keep the cursor at the very beginning and end of the screen like so:

(defadvice next-line (after scroll-with-cursor activate)
"scroll the window as you move the cursor"
  (recenter (window-height)))

(defadvice previous-line (after scroll-with-cursor activate)
"scroll the window as you move the cursor"
        (recenter 0))




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

* Re: Cursor stays in middle of frame vertically- minor mode?
  2008-04-11  4:14   ` Timothy Hobbs
@ 2008-04-11 12:44     ` Nikolaj Schumacher
  0 siblings, 0 replies; 5+ messages in thread
From: Nikolaj Schumacher @ 2008-04-11 12:44 UTC (permalink / raw)
  To: Timothy Hobbs; +Cc: EMACS list

Timothy Hobbs <tim.thelion@gmail.com> wrote:

> Jens Teich <spamtrap@jensteich.de> writes:
>
> Though I'll note that my recenter-non-flashy is not perfect, and since
> the flashyness is only a problem with x11 emacs and I use -nw, I use
> at home:

By flashy, do you mean the redraw that occurs?

From the doc:
"If arg is omitted or nil, erase the entire frame and then redraw with
point in the center of the current window."

Here's what I use.

(defun recenter-without-redraw (arg)
  "Like `recenter', but invert the prefix behavior."
  (interactive "P")
  (recenter (if arg
                (unless (consp arg)
                  (prefix-numeric-value arg))
              '(nil . nil))))

But calling (recenter '(nil . nil)) should be enough for non-interactive
use.

regards,
Nikolaj Schumacher




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

end of thread, other threads:[~2008-04-11 12:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-09 14:45 Cursor stays in middle of frame vertically- minor mode? David Bush
2008-04-10  7:43 ` Jens Teich
2008-04-11  2:31   ` David Bush
2008-04-11  4:14   ` Timothy Hobbs
2008-04-11 12:44     ` Nikolaj Schumacher

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