0

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?

4
  • 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.
    – Drew
    Commented Dec 16, 2019 at 15:15
  • a private message from one of the channels. The window always is openned in the focused frame... Commented Dec 16, 2019 at 15:27
  • Please put any such info in the question itself. Comments can be deleted at any time.
    – Drew
    Commented Dec 16, 2019 at 16:04
  • Sorry, my english is not good enough. Commented Dec 16, 2019 at 16:08

1 Answer 1

0

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))))))
1
  • Under testing, but for now, it seems to work perfectly, thanks phisl Commented Dec 17, 2019 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.