From: martin rudalics <rudalics@gmx.at>
To: Stephen Leake <stephen_leake@stephe-leake.org>
Cc: emacs-devel@gnu.org
Subject: Re: managing windows in two frames
Date: Tue, 03 Sep 2013 14:52:29 +0200 [thread overview]
Message-ID: <5225DB8D.6060709@gmx.at> (raw)
In-Reply-To: <8561uiclrj.fsf@stephe-leake.org>
> (defun display-buffer-reuse-frame (buffer alist)
I'd call it `display-buffer-other-frame' ("reuse" currently has the
connotation that a window already displays the buffer in question).
> "Display BUFFER in an existing frame other than the current frame.
> If successful, return the window used; otherwise return nil.
>
> If ALIST has a non-nil `inhibit-switch-frame' entry, avoid
> raising the frame.
>
> If ALIST has a non-nil `pop-up-frame-parameters' entry, the
> corresponding value is an alist of frame parameters to give the
> new frame."
> (let* ((frame (car (filtered-frame-list
This is overly restrictive. We should be able to choose any window on
any frame. If necessary, we can invent a new alist element for picking
a frame.
> (lambda (frame)
> (and
> (not (eq frame (selected-frame)))
> (not (window-dedicated-p
> (or
> (get-lru-window frame)
> (frame-first-window frame)))))))))
The lru and first window of that frame could denote the same window.
Here too we can add a new alist element for picking the window.
> (window
> (and frame
> (or
> (get-lru-window frame)
> ;; lru-window can be nil if window was deleted, by ediff for example
Can you give a scenario? `get-lru-window' doesn't consider/return
deleted windows IIRC. It can return nil if all windows are dedicated or
slelected.
> (frame-first-window frame-2))))
What is frame-2 ?
> )
> (when window
> (prog1 (window--display-buffer
> buffer window 'frame alist display-buffer-mark-dedicated)
> (unless (cdr (assq 'inhibit-switch-frame alist))
> (window--maybe-raise-frame frame))))
> ))
>
> (defun display-buffer-other-window-or-frame (buffer alist)
> "Depending on `current-prefix-arg', show BUFFER in another window or frame.
> If current-prefix-arg is:
> '(4) - from C-u; show buffer in another window in current frame, creating new if needed.
> '(16) - from C-u C-u; show buffer in another frame, creating new if needed.
> other - return nil."
`display-buffer' decisions are currently not based on a prefix argument
given. Maybe we can reconcile your idea with Stefan's proposal to use
special prefixes for `display-buffer'-based functions.
> (or
> (cond
> ((equal current-prefix-arg '(4)) ;; other window
> (or (display-buffer-use-some-window buffer '((inhibit-same-window . t)))
> (display-buffer-pop-up-window buffer nil)))
>
> ((equal current-prefix-arg '(16)) ;; other frame
> (or (display-buffer-reuse-frame buffer '((reusable-frames . visible))) ;; reuse a window in other frame
> (display-buffer-pop-up-frame buffer nil)))
>
> (t nil)
>
> )))
>
> (defun sal-move-to-other-frame ()
> "Move current buffer to a window in another frame."
> (interactive)
> (let ((buffer (current-buffer)))
> (switch-to-prev-buffer nil 'bury)
> (let ((display-buffer-overriding-action
> '((display-buffer-reuse-frame buffer display-buffer-pop-up-frame)
> . '((reusable-frames . visible))))) ;; reuse a window in other frame
> (display-buffer buffer))))
>
>
> The use case for these:
>
> I use two Emacs frames, side by side, filling the screen. This allows
> two things:
>
> 1) opening other applications next to an Emacs frame
If Emacs fills the screen there doesn't seem much space left for other
applications ;-)
> 2) navigating between frames for horizontal movement (using window
> manager keys), and between windows for vertical movement (using Emacs
> keys).
>
> With one Emacs frame, split both horizontally and vertically, I find it
> difficult to navigate among the windows.
I'm using M-S-left, M-S-up ... to navigate to the window in that
direction.
> `display-buffer-reuse-frame' allows displaying a buffer in the other
> frame, without always creating a new frame.
Such functionality is missing, indeed.
> `display-buffer-other-window-or-frame' gives the user flexible control
> of all buffer display functions, via the prefix arg.
We have to decide how to integrate pefix arguments in buffer display
functions. So far, I don't know of a proposal that allows, for example,
to use the "same" window, thus overriding an application that wants to
display the buffer in another window.
martin
next prev parent reply other threads:[~2013-09-03 12:52 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-03 9:11 managing windows in two frames Stephen Leake
2013-09-03 12:52 ` martin rudalics [this message]
2013-09-04 18:16 ` Stephen Leake
2013-09-04 18:24 ` Stephen Leake
2013-09-04 19:33 ` Stefan Monnier
2013-09-04 21:22 ` Stephen Leake
2013-09-06 10:53 ` martin rudalics
2013-09-07 8:49 ` Stephen Leake
2013-09-07 9:37 ` martin rudalics
2013-09-07 13:19 ` Stephen Leake
2013-09-08 7:56 ` martin rudalics
2013-09-04 21:33 ` Drew Adams
2013-09-06 10:52 ` martin rudalics
2013-09-06 13:22 ` Stefan Monnier
2013-09-06 10:52 ` martin rudalics
2013-09-07 8:56 ` Stephen Leake
2013-09-07 9:37 ` martin rudalics
2013-09-07 13:29 ` Stephen Leake
2013-09-03 13:59 ` Stefan Monnier
2013-09-03 14:15 ` martin rudalics
2013-09-03 14:30 ` Stefan Monnier
2013-09-03 16:23 ` martin rudalics
2013-09-03 20:34 ` Stefan Monnier
2013-09-04 6:25 ` martin rudalics
2013-09-04 13:24 ` Stefan Monnier
2013-09-04 15:04 ` martin rudalics
2013-09-04 17:44 ` Stefan Monnier
2013-09-06 10:53 ` martin rudalics
2013-09-06 13:44 ` Stefan Monnier
2013-09-06 17:14 ` martin rudalics
2013-09-06 19:00 ` Stefan Monnier
2013-09-07 9:37 ` martin rudalics
2013-09-08 17:55 ` Stefan Monnier
2013-09-09 8:10 ` martin rudalics
2013-09-09 14:05 ` Stefan Monnier
2013-09-04 18:19 ` Stephen Leake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5225DB8D.6060709@gmx.at \
--to=rudalics@gmx.at \
--cc=emacs-devel@gnu.org \
--cc=stephen_leake@stephe-leake.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.