From: "James K. Lowden" <jklowden@speakeasy.net>
To: help-gnu-emacs@gnu.org
Subject: splitting a window at point
Date: Mon, 16 Apr 2018 20:23:59 -0400 [thread overview]
Message-ID: <20180416202359.5216cf029e1ca2451a7ac5e7@speakeasy.net> (raw)
It seems like an obvious function: I'd like to split a window
vertically, such that the top of the lower window is positioned where
the cursor is. If I'm on line 6, the top window will have 6 lines, and
the bottom window gets the rest. I (would) do this from time to time,
to leave a function definition in the top window while in the lower
window I operate on the code that uses it.
split-window-vertically takes an optional argument for the top (or
bottom) window size. So far, so good. C-u C-x 2 does indeed open the
top window with 4 lines.
How, then, to compute the cursor's window position?
move-to-window-line moves to the line, but there's no get-window-line.
what-cursor-position reports the buffer position, not the window
location. I could compute the cursor's window position from it if I
knew the window's buffer position, but apropos returns no function
for "window" that mentions buffer position in its description.
Do I "just" save the curent cursor position, jump to window line 1, get
its buffer position, jump back, and take the difference? I guess that
will work, but I'd rather not move the cursor just to compute its
location.
What am I overlooking?
--jkl
next reply other threads:[~2018-04-17 0:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-17 0:23 James K. Lowden [this message]
2018-04-19 18:13 ` splitting a window at point Tomas Nordin
[not found] ` <mailman.12737.1524161596.27995.help-gnu-emacs@gnu.org>
2018-04-20 0:42 ` James K. Lowden
2018-04-20 18:07 ` Tomas Nordin
-- strict thread matches above, loose matches on Subject: below --
2018-04-17 6:32 martin rudalics
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=20180416202359.5216cf029e1ca2451a7ac5e7@speakeasy.net \
--to=jklowden@speakeasy.net \
--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).