unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* scroll-down and beginning-of-buffer
@ 2005-01-07 17:05 Paul Raines
  2005-01-07 17:58 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Paul Raines @ 2005-01-07 17:05 UTC (permalink / raw)



I am trying to ge the Page Up and Page Down keys to behave like
they do in almost every other editor out there.  Specifically, when
hitting Page Up repeatedly, you eventually end up with the curson
on the very first line of the file.  Instead, emails stops at some
random line below and refuses to go any further and just displays
"beginning of buffer" in the mini-buffer.

I have tried definining the following function:

(defun my-scroll-down (arg)
   "Same as scroll-down except really goes to beginning of file"
   (interactive "P")
   (if (not (call-interactively 'scroll-down))
       (call-interactively 'beginning-of-buffer)))

Which works but has the horrible side effect of reseting the mark
each time it is used to the region scrolled.  How do I stop it
from doing that?  Or is the better way to get what I want?


-- 
---------------------------------------------------------------
Paul Raines                   email: raines@nmr.mgh.harvard.edu
MGH/MIT/HMS Athinoula A. Martinos Center for Biomedical Imaging
149 (2301) 13th Street        Charlestown, MA 02129	USA

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

* Re: scroll-down and beginning-of-buffer
  2005-01-07 17:05 scroll-down and beginning-of-buffer Paul Raines
@ 2005-01-07 17:58 ` Eli Zaretskii
       [not found] ` <mailman.11719.1105122181.27204.help-gnu-emacs@gnu.org>
  2005-01-09 19:12 ` Paul Raines
  2 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2005-01-07 17:58 UTC (permalink / raw)


> Date: Fri, 7 Jan 2005 12:05:31 -0500 (EST)
> From: Paul Raines <raines@nmr.mgh.harvard.edu>
> 
> (defun my-scroll-down (arg)
>    "Same as scroll-down except really goes to beginning of file"
>    (interactive "P")
>    (if (not (call-interactively 'scroll-down))
>        (call-interactively 'beginning-of-buffer)))
> 
> Which works but has the horrible side effect of reseting the mark
> each time it is used to the region scrolled.  How do I stop it
> from doing that?

If you call pop-mark after beginning-of-buffer, it will restore the
mark to what it was before that.

Alternatively, replace the call to beginning-of-buffer with a loop
that moves one line backwards until it hits the first line.

> Or is the better way to get what I want?

A better way would be to get used to what Emacs does when you press
PageDown repeatedly ;-)

Anyway, why did you invoke scroll-down and beginning-of-buffer via
call-interactively?  Why not simply call (scroll-down) and
(beginning-of-buffer)?

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

* Re: scroll-down and beginning-of-buffer
       [not found] ` <mailman.11719.1105122181.27204.help-gnu-emacs@gnu.org>
@ 2005-01-07 22:01   ` Marco Gidde
  0 siblings, 0 replies; 6+ messages in thread
From: Marco Gidde @ 2005-01-07 22:01 UTC (permalink / raw)


"Eli Zaretskii" <eliz@gnu.org> writes:

>> Date: Fri, 7 Jan 2005 12:05:31 -0500 (EST)
>> From: Paul Raines <raines@nmr.mgh.harvard.edu>
>> 
>> (defun my-scroll-down (arg)
>>    "Same as scroll-down except really goes to beginning of file"
>>    (interactive "P")
>>    (if (not (call-interactively 'scroll-down))
>>        (call-interactively 'beginning-of-buffer)))
>> 
>> Which works but has the horrible side effect of reseting the mark
>> each time it is used to the region scrolled.  How do I stop it
>> from doing that?
>
> If you call pop-mark after beginning-of-buffer, it will restore the
> mark to what it was before that.
>
> Alternatively, replace the call to beginning-of-buffer with a loop
> that moves one line backwards until it hits the first line.
>
>> Or is the better way to get what I want?
>
> A better way would be to get used to what Emacs does when you press
> PageDown repeatedly ;-)
>
> Anyway, why did you invoke scroll-down and beginning-of-buffer via
> call-interactively?  Why not simply call (scroll-down) and
> (beginning-of-buffer)?

Just a side note from the documentation of `beginning-of-buffer':

     Don't use this command in Lisp programs!
     (goto-char (point-min)) is faster and avoids clobbering the mark.


-- 
Marco Gidde

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

* Re: scroll-down and beginning-of-buffer
  2005-01-07 17:05 scroll-down and beginning-of-buffer Paul Raines
  2005-01-07 17:58 ` Eli Zaretskii
       [not found] ` <mailman.11719.1105122181.27204.help-gnu-emacs@gnu.org>
@ 2005-01-09 19:12 ` Paul Raines
  2 siblings, 0 replies; 6+ messages in thread
From: Paul Raines @ 2005-01-09 19:12 UTC (permalink / raw)



Thanks guys

Sounds like (goto-char (point-min)) is the way to go.

Eli, the reason I was using the call-interactively thing was I
was sort of copying blindly from the scroll-all.el as a template
( I as looking at it for another solution).

As far as getting used to it, I have been trying for over 10 years.
And getting upset at it for 10 years.  SO I don't think I will
ever get used to it.  Now I don't have to.

-- 
---------------------------------------------------------------
Paul Raines                   email: raines@nmr.mgh.harvard.edu
MGH/MIT/HMS Athinoula A. Martinos Center for Biomedical Imaging
149 (2301) 13th Street        Charlestown, MA 02129	USA

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

* Re: scroll-down and beginning-of-buffer
       [not found] <mailman.11706.1105118323.27204.help-gnu-emacs@gnu.org>
@ 2005-02-11 14:45 ` John Russell
  2005-02-11 19:20   ` August
  0 siblings, 1 reply; 6+ messages in thread
From: John Russell @ 2005-02-11 14:45 UTC (permalink / raw)


Paul Raines <raines@nmr.mgh.harvard.edu> writes:

> I am trying to ge the Page Up and Page Down keys to behave like
> they do in almost every other editor out there.  Specifically, when
> hitting Page Up repeatedly, you eventually end up with the curson
> on the very first line of the file.  Instead, emails stops at some
> random line below and refuses to go any further and just displays
> "beginning of buffer" in the mini-buffer.
>
> I have tried definining the following function:
>
> (defun my-scroll-down (arg)
>    "Same as scroll-down except really goes to beginning of file"
>    (interactive "P")
>    (if (not (call-interactively 'scroll-down))
>        (call-interactively 'beginning-of-buffer)))
>
> Which works but has the horrible side effect of reseting the mark
> each time it is used to the region scrolled.  How do I stop it
> from doing that?  Or is the better way to get what I want?
>

Google for pager.el.  It makes pg-up and pg-down make sense.  At if 
page up and then page down the point returns to the same place.
very nice package.

John

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

* Re: scroll-down and beginning-of-buffer
  2005-02-11 14:45 ` John Russell
@ 2005-02-11 19:20   ` August
  0 siblings, 0 replies; 6+ messages in thread
From: August @ 2005-02-11 19:20 UTC (permalink / raw)


On fre, 2005-02-11 at 09:45 -0500, John Russell wrote:
> Paul Raines <raines@nmr.mgh.harvard.edu> writes:
> 
> > I am trying to ge the Page Up and Page Down keys to behave like
> > they do in almost every other editor out there.  Specifically, when
> > hitting Page Up repeatedly, you eventually end up with the curson
> > on the very first line of the file.  Instead, emails stops at some
> > random line below and refuses to go any further and just displays
> > "beginning of buffer" in the mini-buffer.
> >
> > I have tried definining the following function:
> >
> > (defun my-scroll-down (arg)
> >    "Same as scroll-down except really goes to beginning of file"
> >    (interactive "P")
> >    (if (not (call-interactively 'scroll-down))
> >        (call-interactively 'beginning-of-buffer)))
> >
> > Which works but has the horrible side effect of reseting the mark
> > each time it is used to the region scrolled.  How do I stop it
> > from doing that?  Or is the better way to get what I want?
> >
> 
> Google for pager.el.  It makes pg-up and pg-down make sense.  At if 
> page up and then page down the point returns to the same place.
> very nice package.

You can also try `pc-selection-mode' that makes several motions commands
from the keyboard behave in a more familiar manner.

-- 
August

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

end of thread, other threads:[~2005-02-11 19:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-07 17:05 scroll-down and beginning-of-buffer Paul Raines
2005-01-07 17:58 ` Eli Zaretskii
     [not found] ` <mailman.11719.1105122181.27204.help-gnu-emacs@gnu.org>
2005-01-07 22:01   ` Marco Gidde
2005-01-09 19:12 ` Paul Raines
     [not found] <mailman.11706.1105118323.27204.help-gnu-emacs@gnu.org>
2005-02-11 14:45 ` John Russell
2005-02-11 19:20   ` August

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