From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "James K. Lowden" Newsgroups: gmane.emacs.help Subject: splitting a window at point Date: Mon, 16 Apr 2018 20:23:59 -0400 Organization: http://www.NewsDemon.com Message-ID: <20180416202359.5216cf029e1ca2451a7ac5e7@speakeasy.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1523924608 31772 195.159.176.226 (17 Apr 2018 00:23:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 17 Apr 2018 00:23:28 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Apr 17 02:23:24 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f8EP5-00088t-O1 for geh-help-gnu-emacs@m.gmane.org; Tue, 17 Apr 2018 02:23:23 +0200 Original-Received: from localhost ([::1]:54671 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f8ERA-0004LB-JW for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Apr 2018 20:25:32 -0400 X-Received: by 10.55.122.197 with SMTP id v188mr8787908qkc.57.1523924641153; Mon, 16 Apr 2018 17:24:01 -0700 (PDT) Original-Path: usenet.stanford.edu!s52-v6no251678qtc.0!news-out.google.com!p5-v6ni178qtp.1!nntp.google.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!post02.iad!fx38.iad.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help X-Newsreader: Sylpheed 3.4.3 (GTK+ 2.24.28; x86_64--netbsd) Original-Lines: 28 Original-X-Complaints-To: abuse@newsdemon.com Original-NNTP-Posting-Date: Tue, 17 Apr 2018 00:24:00 UTC X-Received-Bytes: 1814 X-Received-Body-CRC: 1931192805 Original-Xref: usenet.stanford.edu gnu.emacs.help:222435 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:116553 Archived-At: 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