all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Joe Casadonte" <jcasadonte@northbound-train.com>
To: help-gnu-emacs@gnu.org
Subject: Re: How do you scroll the screen without moving the cursor ? (the C-E and C-Y keys in vi)
Date: Fri, 10 Oct 2008 17:49:56 -0400	[thread overview]
Message-ID: <utzbkf7cr.fsf@terrapin.northbound-train.com> (raw)
In-Reply-To: mailman.108.1223009092.25473.help-gnu-emacs@gnu.org

I wrote these years ago; maybe they will help?


(defun scroll-in-place (scroll-up)
  "Scroll window up (or down) without moving point (if possible).

SCROLL-Up is non-nil to scroll up one line, nil to scroll down."
  (interactive)
  (let ((pos (point))
		(col (current-column))
		(up-or-down (if scroll-up 1 -1)))
	(scroll-up up-or-down)
	(if (pos-visible-in-window-p pos)
		(goto-char pos)
	  (if (or (eq last-command 'next-line)
			  (eq last-command 'previous-line))
		  (move-to-column temporary-goal-column)
		(move-to-column col)
		(setq temporary-goal-column col))
	  (setq this-command 'next-line))))

;;;; ------------------------------------------------------------------------
(defun scroll-up-in-place ()
  "Scroll window up without moving point (if possible)."
  (interactive)
  (scroll-in-place t))

;;;; ------------------------------------------------------------------------
(defun scroll-down-in-place ()
  "Scroll window up without moving point (if possible)."
  (interactive)
  (scroll-in-place nil))

(global-set-key (read-kbd-macro "M-<down>") 'scroll-up-in-place)
(global-set-key (read-kbd-macro "M-<up>") 'scroll-down-in-place)


--
Regards,


joe
Joe Casadonte
jcasadonte@northbound-train.com

------------------------------------------------------------------------------
         Llama Fresh Farms => http://www.northbound-train.com
    Ramblings of a Gay Man => http://www.northbound-train.com/ramblings
               Emacs Stuff => http://www.northbound-train.com/emacs.html
          Music CD Trading => http://www.northbound-train.com/cdr.html
------------------------------------------------------------------------------
                       Live Free, that's the message!
------------------------------------------------------------------------------


  parent reply	other threads:[~2008-10-10 21:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.108.1223009092.25473.help-gnu-emacs@gnu.org>
2008-10-03  5:46 ` How do you scroll the screen without moving the cursor ? (the C-E and C-Y keys in vi) Livin Stephen
2008-10-03  6:42   ` zoltan
2008-10-03 14:20     ` How do you scroll the screen without moving the cursor ? (theC-E " Parker, Matthew
2008-10-04 21:11 ` How do you scroll the screen without moving the cursor ? (the C-E " Rodolfo Medina
2008-10-04 22:58   ` Rupert Swarbrick
2008-10-05 10:48     ` Rodolfo Medina
2008-10-10 21:49 ` Joe Casadonte [this message]
2008-10-02 22:11 David Lam

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=utzbkf7cr.fsf@terrapin.northbound-train.com \
    --to=jcasadonte@northbound-train.com \
    --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.