all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ehud Karni" <ehud@unix.mvs.co.il>
Cc: help-gnu-emacs@gnu.org
Subject: Re: current line to top or bottom of window
Date: Sun, 11 Aug 2002 19:41:41 +0300	[thread overview]
Message-ID: <200208111641.g7BGffr23539@beta.mvs.co.il> (raw)
In-Reply-To: <3D568C2F.1E362E18@pacbell.net> (message from Bruce Korb on Sun, 11 Aug 2002 09:09:19 -0700)

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

  reply	other threads:[~2002-08-11 16:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-11 16:09 current line to top or bottom of window Bruce Korb
2002-08-11 16:41 ` Ehud Karni [this message]
2002-08-12 16:15 ` Fernando Dobladez
  -- strict thread matches above, loose matches on Subject: below --
2002-08-12  6:53 Dmitri.Minaev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200208111641.g7BGffr23539@beta.mvs.co.il \
    --to=ehud@unix.mvs.co.il \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.