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

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

Re: scroll-down and beginning-of-buffer


From: Marco Gidde
Subject: Re: scroll-down and beginning-of-buffer
Date: Fri, 07 Jan 2005 23:01:31 +0100
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

"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

reply via email to

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