unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Re: naming and/or directly addressing particular windows?
@ 2012-12-02 17:46 martin rudalics
  2012-12-03 12:38 ` Matt Price
  0 siblings, 1 reply; 11+ messages in thread
From: martin rudalics @ 2012-12-02 17:46 UTC (permalink / raw)
  To: moptop99; +Cc: help-gnu-emacs

 > 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



^ permalink raw reply	[flat|nested] 11+ messages in thread
* naming and/or directly addressing particular windows?
@ 2012-12-01 15:22 Matt Price
  2012-12-01 15:59 ` Drew Adams
  0 siblings, 1 reply; 11+ messages in thread
From: Matt Price @ 2012-12-01 15:22 UTC (permalink / raw)
  To: Bastien; +Cc: drain, Help-gnu-emacs, Org Mode

Hi,

After the recent conversation about Scrivener (on help-gnu-emacs) I
thought the very first step would be to write a simple function that
would create a window layout and populate the windows with a set of
buffers, then set mjor and minor modes for some of hte buffers.
(After that I guess I will have to figure out how to write some very
simple minor modes, or at least some functions that allow e.g. direct
editing of org-mode properties on a selected node.)

So, what I have so far is quite trivial but doesn't seem to work
exactly as I expected:

(delete-other-windows)
(split-window-horizontally)
(windmove-right)
(split-window-horizontally)
(enlarge-window-horizontally 20)
(windmove-right)
(split-window-vertically)


Anyway presumably I'll fiddle with this and eventually it will work,
but something better would be

(set-window-name "outline")
(split-named-window-horizontally-and-name-the-other-window "outline" "main")
(split-named-window-horizontally-and-name-the-other-window "main" "metadata")
(set-width-named-window "main" 60)

and then write a function, bound to say Ctrl-Enter,

open-node-as-indirect-buffer-in-named-window

Anyway:  is it possible to give/get a name for a window that persists
long enough to be called in functions?

Thanks,
Matt



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-12-05 16:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-02 17:46 naming and/or directly addressing particular windows? martin rudalics
2012-12-03 12:38 ` Matt Price
2012-12-03 17:42   ` martin rudalics
2012-12-03 19:58     ` Matt Price
2012-12-03 20:58       ` Jambunathan K
2012-12-04 13:52         ` Matt Price
2012-12-04  9:01       ` martin rudalics
2012-12-05 16:11         ` Matt Price
  -- strict thread matches above, loose matches on Subject: below --
2012-12-01 15:22 Matt Price
2012-12-01 15:59 ` Drew Adams
2012-12-02  5:31   ` Matt Price

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