unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* current line to top or bottom of window
@ 2002-08-11 16:09 Bruce Korb
  2002-08-11 16:41 ` Ehud Karni
  2002-08-12 16:15 ` Fernando Dobladez
  0 siblings, 2 replies; 4+ messages in thread
From: Bruce Korb @ 2002-08-11 16:09 UTC (permalink / raw)



Hi,

Once upon a time, I used to be able to move the line with point
to the top or bottom of the window by clicking the scroll area
with the left (top) or right (bottom) button.  The new version
of emacs won't let me do that.  I've wandered around the docs
quite a bit and haven't found any way to do it, short of learning
emacs-lisp and writing my own macro.  That seems a little over
the top.  :-(  Does *anyone* have macros for this, either as
a keyboard macro or a mouse click?  Thank you.  I will *sure*
appreciate it!!

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

* Re: current line to top or bottom of window
  2002-08-11 16:09 current line to top or bottom of window Bruce Korb
@ 2002-08-11 16:41 ` Ehud Karni
  2002-08-12 16:15 ` Fernando Dobladez
  1 sibling, 0 replies; 4+ messages in thread
From: Ehud Karni @ 2002-08-11 16:41 UTC (permalink / raw)
  Cc: help-gnu-emacs

On Sun, 11 Aug 2002 09:09:19 -0700, Bruce Korb <bkorb@pacbell.net> wrote:
> 
> Once upon a time, I used to be able to move the line with point
> to the top or bottom of the window by clicking the scroll area
> with the left (top) or right (bottom) button.  The new version
> of emacs won't let me do that.  I've wandered around the docs
> quite a bit and haven't found any way to do it, short of learning
> emacs-lisp and writing my own macro.  That seems a little over
> the top.  :-(  Does *anyone* have macros for this, either as
> a keyboard macro or a mouse click?  Thank you.  I will *sure*
> appreciate it!!

Here are my defined functions:

(defun middle-window () "go to line in middle of window" 
       (interactive)
       (move-to-window-line (+ (/ (1- (window-height)) 2))))

(defun line-to-top (arg) "move current line to top of window"
       (interactive "p")
       (recenter (1- arg))
       (middle-window))

(defun line-to-bottom (arg) "move current line to bottom of window"
       (interactive "p")
       (recenter (- (window-height) (1+ arg)))
       (middle-window))

Please note that these functions will put the cursor at the middle of
window after moving the text. If you do not want that remove the
"(middle-window)" [ leave 1 ")" ].

I assign the keys Shift-Page-Up and Shift-Page-Down to these commands:

(define-key global-map '[S-next]     'line-to-top)    ;shift pg-dn key
(define-key global-map '[S-kp-next]  'line-to-top)    ;shift pg-dn key (keypad)

(define-key global-map '[S-prior]    'line-to-bottom) ;shift pg-up key
(define-key global-map '[S-kp-prior] 'line-to-bottom) ;shift pg-up key (keypad)

Ehud.


-- 
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 mailto:ehud@unix.mvs.co.il                  Better  Safe  Than  Sorry

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

* RE: current line to top or bottom of window
@ 2002-08-12  6:53 Dmitri.Minaev
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitri.Minaev @ 2002-08-12  6:53 UTC (permalink / raw)
  Cc: help-gnu-emacs

Mine are not that sophisticated :)

(defalias 'goto-page-top
  (read-kbd-macro "C-u 1 M-r"))
(defalias 'goto-page-bot
  (read-kbd-macro "C-u -1 M-r"))

and, of course:

(global-set-key [(control {)] 'goto-page-top)
(global-set-key [(control })] 'goto-page-bot)

--
With best regards,
Dmitri Minaev


> -----Original Message-----
> From: Ehud Karni [mailto:ehud@unix.mvs.co.il]
> Sent: Sunday, August 11, 2002 5:42 PM
> To: Bruce Korb
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: current line to top or bottom of window
> 
> 
> On Sun, 11 Aug 2002 09:09:19 -0700, Bruce Korb 
> <bkorb@pacbell.net> wrote:
> > 
> > Once upon a time, I used to be able to move the line with point
> > to the top or bottom of the window by clicking the scroll area
> > with the left (top) or right (bottom) button.  The new version
> > of emacs won't let me do that.  I've wandered around the docs
> > quite a bit and haven't found any way to do it, short of learning
> > emacs-lisp and writing my own macro.  That seems a little over
> > the top.  :-(  Does *anyone* have macros for this, either as
> > a keyboard macro or a mouse click?  Thank you.  I will *sure*
> > appreciate it!!
> 
> Here are my defined functions:
> 
> (defun middle-window () "go to line in middle of window" 
>        (interactive)
>        (move-to-window-line (+ (/ (1- (window-height)) 2))))
> 
> (defun line-to-top (arg) "move current line to top of window"
>        (interactive "p")
>        (recenter (1- arg))
>        (middle-window))
> 
> (defun line-to-bottom (arg) "move current line to bottom of window"
>        (interactive "p")
>        (recenter (- (window-height) (1+ arg)))
>        (middle-window))
> 
> Please note that these functions will put the cursor at the middle of
> window after moving the text. If you do not want that remove the
> "(middle-window)" [ leave 1 ")" ].
> 
> I assign the keys Shift-Page-Up and Shift-Page-Down to these commands:
> 
> (define-key global-map '[S-next]     'line-to-top)    ;shift pg-dn key
> (define-key global-map '[S-kp-next]  'line-to-top)    ;shift 
> pg-dn key (keypad)
> 
> (define-key global-map '[S-prior]    'line-to-bottom) ;shift pg-up key
> (define-key global-map '[S-kp-prior] 'line-to-bottom) ;shift 
> pg-up key (keypad)
> 
> Ehud.
> 
> 
> -- 
>  Ehud Karni           Tel: +972-3-7966-561  /"\
>  Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
>  Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
>  http://www.mvs.co.il  FAX:  1-815-5509341  / \
>  mailto:ehud@unix.mvs.co.il                  Better  Safe  Than  Sorry
> 
> 
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-gnu-emacs
> 

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

* Re: current line to top or bottom of window
  2002-08-11 16:09 current line to top or bottom of window Bruce Korb
  2002-08-11 16:41 ` Ehud Karni
@ 2002-08-12 16:15 ` Fernando Dobladez
  1 sibling, 0 replies; 4+ messages in thread
From: Fernando Dobladez @ 2002-08-12 16:15 UTC (permalink / raw)
  Cc: help-gnu-emacs

This default keybindings do the job:

    'C-0 C-l'  and 'C-- C-l'

or maybe, what you wanted is:

    'M-0 M-r'  and 'M-- M-r'

Fer


Bruce Korb wrote:

>Hi,
>
>Once upon a time, I used to be able to move the line with point
>to the top or bottom of the window by clicking the scroll area
>with the left (top) or right (bottom) button.  The new version
>of emacs won't let me do that.  I've wandered around the docs
>quite a bit and haven't found any way to do it, short of learning
>emacs-lisp and writing my own macro.  That seems a little over
>the top.  :-(  Does *anyone* have macros for this, either as
>a keyboard macro or a mouse click?  Thank you.  I will *sure*
>appreciate it!!
>
>
>_______________________________________________
>Help-gnu-emacs mailing list
>Help-gnu-emacs@gnu.org
>http://mail.gnu.org/mailman/listinfo/help-gnu-emacs
>
>  
>

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

end of thread, other threads:[~2002-08-12 16:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-11 16:09 current line to top or bottom of window Bruce Korb
2002-08-11 16:41 ` Ehud Karni
2002-08-12 16:15 ` Fernando Dobladez
  -- strict thread matches above, loose matches on Subject: below --
2002-08-12  6:53 Dmitri.Minaev

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