unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Valera Rozuvan <valera.rozuvan@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Scrolling the screen vertically
Date: Fri, 6 Jul 2012 18:38:05 +0300	[thread overview]
Message-ID: <CAM8kQFwsXFQZMrYarKqYnVcJ5Ae_0_nq1GJkQfacAmCxXQGuCw@mail.gmail.com> (raw)

From: Eli Zaretskii
> Look at window-width and window-hscroll, I think they give you all you
> need.  The functions to actually scroll are those bound to the keys I
> mentioned, and you can control by how much to scroll by giving them an
> argument (see their doc strings).

Thanks! window-width and window-hscroll actually offer everything that
I need. Here is what I came up with:

(defun goto-window-left-margin ()
    "Move point to the left edge of the window."
    (interactive)
    (setq leftEdge (window-hscroll))
    (move-to-column leftEdge))
(defun goto-window-right-margin ()
    "Move point to the right edge of the window."
    (interactive)
    (setq rightEdge (+ (window-hscroll) (window-width)))
    (move-to-column rightEdge))
(defun goto-window-middle ()
    "Move point to the middle of the window."
    (interactive)
    (setq rightEdge (+ (window-hscroll) (window-width)))
    (move-to-column (- rightEdge (floor (* 0.5 (window-width))))))
(global-set-key [C-return] 'goto-window-left-margin)
(global-set-key [M-return] 'goto-window-right-margin)
(global-set-key [M-C-return] 'goto-window-middle)

Now if I want to peek off the screen to the right (or left), I do
M-return, see what is hidden, and then I do C-return, which brings me
back to my original point. Also I added a shortcut to move the cursor
to the center of the screen.

Regards,
Valera Rozuvan



             reply	other threads:[~2012-07-06 15:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-06 15:38 Valera Rozuvan [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-07-04 18:19 Scrolling the screen vertically Valera Rozuvan
2012-07-04 20:20 ` Eli Zaretskii
2012-07-04 14:29 Valera Rozuvan
2012-07-04 15:34 ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=CAM8kQFwsXFQZMrYarKqYnVcJ5Ae_0_nq1GJkQfacAmCxXQGuCw@mail.gmail.com \
    --to=valera.rozuvan@gmail.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.
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).