From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Matt Price Newsgroups: gmane.emacs.help Subject: Re: naming and/or directly addressing particular windows? Date: Mon, 3 Dec 2012 07:38:07 -0500 Message-ID: References: <50BB9407.7060104@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1354538305 1535 80.91.229.3 (3 Dec 2012 12:38:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Dec 2012 12:38:25 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: martin rudalics Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Dec 03 13:38:36 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TfVI5-0003yH-RC for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Dec 2012 13:38:29 +0100 Original-Received: from localhost ([::1]:40478 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfVHu-00055W-4y for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Dec 2012 07:38:18 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:51022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfVHn-00054Z-QR for help-gnu-emacs@gnu.org; Mon, 03 Dec 2012 07:38:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TfVHm-00046V-G2 for help-gnu-emacs@gnu.org; Mon, 03 Dec 2012 07:38:11 -0500 Original-Received: from mail-qc0-f169.google.com ([209.85.216.169]:40500) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfVHm-00046F-An for help-gnu-emacs@gnu.org; Mon, 03 Dec 2012 07:38:10 -0500 Original-Received: by mail-qc0-f169.google.com with SMTP id t2so1683925qcq.0 for ; Mon, 03 Dec 2012 04:38:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=f5/8tpsVD1Rg0JN/8v56YPqYd+bNj9c6/Y1Z85iKDNg=; b=BihKXuQ8sCh1zJntZFCIFh7rYhYNhEugftRRPA+UgB+0Lhfbv8LKNANBUoUJBoG6F4 9DJ/C+AsWlqhn0AaLNvDGdLGxTqzrXbj5Y+t+YZOqcvIsTGn8CBtWL4T1hc6FhjKXzAW hoFk5YsfjGwt90g/Io6PDh2Uk1uGhgCATuV00DDvtM6ju3IS+L2Mgabbd0yr3ZvS8nxo LQ7G2kYaeBax1Wvqde/f/4NUjuehr+0ayHYYFhjO5OWE/+iM9yWZ0CXPcmeZdom7JGbv NqSl2kt6h3PSyRfnuUUdVqOZ1/4OUWLwqPy28R7s+JS9JTFnZ/6drRCnIsyL1ybTs3Rt jamw== Original-Received: by 10.224.52.75 with SMTP id h11mr16785647qag.77.1354538288267; Mon, 03 Dec 2012 04:38:08 -0800 (PST) Original-Received: by 10.49.132.169 with HTTP; Mon, 3 Dec 2012 04:38:07 -0800 (PST) In-Reply-To: <50BB9407.7060104@gmx.at> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.216.169 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:88025 Archived-At: On Sun, Dec 2, 2012 at 12:46 PM, martin rudalics wrote: > > I'm not sure why you need names at all but with Emacs 24 it's simpler to > use window parameters as > > (defun set-window-name (window name) > (set-window-parameter window 'name name)) > > (defun window-with-name (name) > (window-with-parameter 'name name)) > > which also relieves you from the task to recycle dead windows from > `my-winlist', and rewrite your code as > > (let ((new-window (split-window-horizontally -35))) > (set-window-name new-window 'metadata)) > > ... > > (select-window (window-with-name 'guide)) > that is so very helpful, thank you. I may not really need names but for someone like me who has a hard time even reading lisp, I think they will be a helpful mneumonic. (probably it would be just as good to assign a variable the value of '(selected-window)' at various points in the function). I've rewritten my code like this, which seems to be much clearer than the original: (defun set-window-name (window name) (set-window-parameter window 'name name)) (defun window-with-name (name) (window-with-parameter 'name name)) (defun writers-room-windows (width) "Trying to figure out how to get a nice windows config for a writers room mode" (interactive ) (global-linum-mode 0) (delete-other-windows) (set-window-name (selected-window) 'guide) (let ((new-window (split-window-horizontally width))) (set-window-name new-window 'main)) (select-window (window-with-name 'main)) (let ((new-window (split-window-horizontally (- width)))) (set-window-name new-window 'metadata)) (select-window (window-with-name 'guide)) ) (writers-room-windows 25) > >> I'm not having an easy time figuring out how that function decides >> which window to use when creating and focussing on the new indirect >> buffer. I can see (and the documentation states) that a choice is >> first made between using a new or dedicated frame, or the same frame >> with either the original or another window. But the code to put the >> buffer in another window in the same frame is quite simple: >> >> ((eq org-indirect-buffer-display 'other-window) >> (pop-to-buffer ibuf)) >> >> >> I've been chasing the code down to native emacs functions -- >> pop-to-buffer ends up relying on display-buffer -- but I haven't yet >> found a place where I an specify a particular window for the new >> buffer. Does anyone else know a way? > > Depends (also) on the version of your Emacs. > emacs-version reports: GNU Emacs 24.2.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.6.0) of 2012-10-09 on meitnerium, modified by Debian If you have any more hints for this next problem -- forcing an indirect buffer to open in a particular window -- I'd be very grateful. Thanks so much, Matt