all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 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

* Re: make ctrl+v (page-down) move even when near the end of document
       [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
  1 sibling, 1 reply; 6+ messages in thread
From: B. T. Raven @ 2008-04-02 16:17 UTC (permalink / raw)
  To: help-gnu-emacs

Pavol Murin wrote:
> 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
> 
> 

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. Immediately after the last 
M-v or C-v you can M-< or M-> if you need extreme cursor movement.


Ed


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

* Re: make ctrl+v (page-down) move even when near the end of document
  2008-04-02 16:17 ` make ctrl+v (page-down) move even when near the end of document B. T. Raven
@ 2008-04-02 16:57   ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 6+ messages in thread
From: Lennart Borgman (gmail) @ 2008-04-02 16:57 UTC (permalink / raw)
  To: help-gnu-emacs

B. T. Raven wrote:
> Pavol Murin wrote:
>> 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
>>
>>
> 
> 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. Immediately after the last 
> M-v or C-v you can M-< or M-> if you need extreme cursor movement.

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




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

* Re: make ctrl+v (page-down) move even when near the end of document
       [not found] <mailman.9543.1206720440.18990.help-gnu-emacs@gnu.org>
  2008-04-02 16:17 ` make ctrl+v (page-down) move even when near the end of document B. T. Raven
@ 2008-04-03  1:42 ` Jim Diamond
  1 sibling, 0 replies; 6+ messages in thread
From: Jim Diamond @ 2008-04-03  1:42 UTC (permalink / raw)
  To: help-gnu-emacs

On 2008-03-28, Pavol Murin <palomurin@gmail.com> wrote:
> 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)?
>

Have you considered

(require 'scroll-in-place)
(global-set-key "\^V"   'scroll-up-in-place)
(global-set-key "\M-v"  'scroll-down-in-place)

Maybe not exactly what you are looking for, but possibly worth a look.

				Jim


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

* 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

* 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, 0 replies; 6+ messages in thread
From: Lennart Borgman (gmail) @ 2008-04-03 13:56 UTC (permalink / raw)
  To: Pavol Murin; +Cc: help-gnu-emacs

Pavol Murin wrote:
>> 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

Turn on cua-mode and use C-h k.




^ 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 --
     [not found] <mailman.9543.1206720440.18990.help-gnu-emacs@gnu.org>
2008-04-02 16:17 ` make ctrl+v (page-down) move even when near the end of document B. T. Raven
2008-04-02 16:57   ` Lennart Borgman (gmail)
2008-04-03  1:42 ` Jim Diamond
2008-04-03  8:30 Pavol Murin
2008-04-03 13:56 ` Lennart Borgman (gmail)
  -- strict thread matches above, loose matches on Subject: below --
2008-03-28 15:57 Pavol Murin

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.