help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: naming and/or directly addressing particular windows?


From: martin rudalics
Subject: Re: naming and/or directly addressing particular windows?
Date: Sun, 02 Dec 2012 18:46:47 +0100

> I'm slowly starting to understand.  I now have this primitive code,
> which at least sets up the windows the way I want them:
>
> (defun my-windows-function ()
>   "Trying to figure out how to get a nice windows config for 
writers-room-mode"
...
>   (split-window-horizontally)
>   (windmove-right)
>   (fix-window-horizontal-size 35)
>   (add-to-list 'my-winlist
>                (cons 'metadata  (selected-window))
>                )
...
>   (select-window(cdr(assoc 'guide my-winlist)) )
>   )

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))

> 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.

martin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]