I use to have diferent frames for diferent tasks... I'd like to get new private message windows open in the same frame that the rest of the ERC stuff, not in the current focused frame. I'm searching for a long time, and I can't find any way to get this... Any idea?
-
Could you please describe what you mean by "query message"? It may not be clear to some readers who otherwise might be able to help. Thx.– DrewCommented Dec 16, 2019 at 15:15
-
a private message from one of the channels. The window always is openned in the focused frame...– Manuel MárquezCommented Dec 16, 2019 at 15:27
-
Please put any such info in the question itself. Comments can be deleted at any time.– DrewCommented Dec 16, 2019 at 16:04
-
Sorry, my english is not good enough.– Manuel MárquezCommented Dec 16, 2019 at 16:08
Add a comment
|
1 Answer
Does this work?
(defun my-major-mode-frame-p (mode frame)
"Return non-nil if FRAME displays any buffer in major mode MODE."
(catch 'window
(walk-windows
(lambda (w)
(and (window-live-p w)
(eq mode (buffer-local-value 'major-mode (window-buffer w)))
(throw 'window w)))
'nomini frame)))
;; Always display ERC buffers in the same frame.
(let ((ercframep (apply-partially #'my-major-mode-frame-p 'erc-mode)))
(add-to-list 'display-buffer-alist
(cons (lambda (buffer alist)
(with-current-buffer buffer
(derived-mode-p 'erc-mode)))
(cons #'display-buffer-use-some-frame
`((inhibit-switch-frame . nil)
(inhibit-same-window . nil)
(frame-predicate . ,ercframep))))))
-
Under testing, but for now, it seems to work perfectly, thanks phisl Commented Dec 17, 2019 at 16:37