[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: naming and/or directly addressing particular windows?
From: |
Matt Price |
Subject: |
Re: naming and/or directly addressing particular windows? |
Date: |
Mon, 3 Dec 2012 14:58:50 -0500 |
On Mon, Dec 3, 2012 at 12:42 PM, martin rudalics <rudalics@gmx.at> wrote:
>
> You frequently select a window for the sole purpose to apply
> `split-window-horizontally' to it. But it's better to use
> `select-window' exclusively for editing its buffer.
>
> I would recommend to rewrite this part as
>
> (let* ((main (split-window nil width t))
> (metadata (split-window main (- width) t)))
> (set-window-name (selected-window) "guide")
> (set-window-name main "main")
> (set-window-name metadata "metadata"))
>
wow, that's so much cleaner. again. thanks.
>> 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.
>
> As a start try playing around with these:
>
> (defun display-buffer-in-foo (buffer alist)
> "Try displaying BUFFER in a window named *foo*."
> (let ((window (window-with-name "*foo*")))
> (when window
> (window--display-buffer
> buffer window 'reuse alist display-buffer-mark-dedicated))))
>
> (let ((display-buffer-alist
> (cons
> '("\\*foo\\*" (display-buffer-in-foo))
> display-buffer-alist)))
> (pop-to-buffer (get-buffer-create "*foo*")))
in the 'let' expression above, how would I replace \\*foo\\* and *foo*
with a regular expression that will match, say,
(concat (buffer-name) "-" [:digit:])
? I'm not quite clear on using regexes in emacs. thanks again so
much! I know I'm asking a lot of questions, I *am* trying things in
between but am getting stymied pretty quickly each time.
Matt
>
> martin