unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Re: make ctrl+v (page-down) move even when near the end of document
@ 2008-04-03  8:30 Pavol Murin
  2008-04-03 13:56 ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 6+ messages in thread
From: Pavol Murin @ 2008-04-03  8:30 UTC (permalink / raw)
  To: help-gnu-emacs

On Apr 2, 6:57 pm, "Lennart Borgman (gmail)" <lennart.borg...@gmail.com> wrote:
> B. T. Raven wrote:
> > Pavol Murin wrote:
> >> hello fellow emacs users,
> >>  I would like to makectrl+vlike page-down (and page-up) do in other
> >> applications when near the beginning or end of the document. This
> >> means that when the point cannot move by a full page, it moves to the
> >> first or last position in the document. I can program it in elisp, but
> >> there might be a simpler solution (maybe a different function to
> >> bind)?
>
> >>  thanks, muro
>
> > The pertinent code that would have to be hacked is in window.c and the
> > only other candidate I see is the variable next-screen-context-lines,
> > also in window.c  Maybe if you can make a good case for the usefulness
> > of this behavior, someone will change the code for you. Out of
> > curiosity, why do you care if the cursor is exactly at top or bottom of
> > buffer as long as you can see the text there.


muscle memory - using it like that in windows applications for 10+ years.


> > Immediately after the last
> > M-v or C-v you can M-< or M-> if you need extreme cursor movement.

that's exactly what I want the command to do :-)

>
> cua-mode has the code for this. It is however bound to PgUp/Down.

where can I find this code? I had a look at cua-base.el, cua-gmrk.el
and cua-rect.el and couldn't find it.

>
> Ed


I couldn't get (scroll-down) to work in lisp, when I was near the
beginning of buffer, then found condition-case. The final scrolling
function is now
8 lines in each direction:


(defun scroll-down-to-point-min ()
  (interactive)
  (let ((curr (window-start)))
    (condition-case ()
	(scroll-down)
      (error nil))
    (if (and (eq curr (window-start)) (/= (point) (point-min)))
	(goto-char (point-min)))))

(defun scroll-up-to-point-max ()
  (interactive)
  (let ((curr (window-start)))
    (condition-case ()
	(scroll-up)
      (error nil))
    (if (and (eq curr (window-start)) (/= (point) (point-max)))
	(goto-char (point-max)))))


(global-set-key [prior] 'scroll-down-to-point-min)
(global-set-key [next] 'scroll-up-to-point-max)


thanks for all hints, muro




^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <mailman.9543.1206720440.18990.help-gnu-emacs@gnu.org>]
* make ctrl+v (page-down) move even when near the end of document
@ 2008-03-28 15:57 Pavol Murin
  0 siblings, 0 replies; 6+ messages in thread
From: Pavol Murin @ 2008-03-28 15:57 UTC (permalink / raw)
  To: help-gnu-emacs

hello fellow emacs users,
 I would like to make ctrl+v like page-down (and page-up) do in other
applications when near the beginning or end of the document. This
means that when the point cannot move by a full page, it moves to the
first or last position in the document. I can program it in elisp, but
there might be a simpler solution (maybe a different function to
bind)?

 thanks, muro




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

end of thread, other threads:[~2008-04-03 13:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-03  8:30 make ctrl+v (page-down) move even when near the end of document Pavol Murin
2008-04-03 13:56 ` Lennart Borgman (gmail)
     [not found] <mailman.9543.1206720440.18990.help-gnu-emacs@gnu.org>
2008-04-02 16:17 ` B. T. Raven
2008-04-02 16:57   ` Lennart Borgman (gmail)
2008-04-03  1:42 ` Jim Diamond
  -- strict thread matches above, loose matches on Subject: below --
2008-03-28 15:57 Pavol Murin

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