1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Revert "Allow erc-reuse-frames to favor connections"

This (mostly) reverts commit 0e4c07dc74.

* etc/ERC-NEWS: Also revert hunk from 52c8d537 "* etc/ERC-NEWS: Add
section for ERC 5.6." because it announced this feature, which no
longer exists.
* lisp/erc/erc.el (erc-reuse-frames): Revise doc string instead of
reverting completely.  (Bug#62833)
This commit is contained in:
F. Jason Park 2023-06-19 23:14:40 -07:00
parent c64021d58a
commit d2a7b0c76d
3 changed files with 10 additions and 365 deletions

View file

@ -1626,23 +1626,14 @@ This only has effect when `erc-join-buffer' is set to `frame'."
(defcustom erc-reuse-frames t
"Determines whether new frames are always created.
A value of t means only create a frame for undisplayed buffers.
`displayed' means use any existing, potentially hidden frame
already displaying a buffer from the same network context or,
failing that, a frame showing any ERC buffer. As a last resort,
`displayed' defaults to the selected frame, except for brand new
connections, for which the invoking frame is always used. When
this option is nil, a new frame is always created.
Regardless of its value, this option is ignored unless
`erc-join-buffer' is set to `frame'. And like most options in
the `erc-buffer' customize group, this has no effect on server
buffers while reconnecting because those are always buried."
:package-version '(ERC . "5.6") ; FIXME sync on release
Non-nil means only create a frame for undisplayed buffers. Nil
means always create a new frame. Regardless of its value, ERC
ignores this option unless `erc-join-buffer' is `frame'. And
like most options in the `erc-buffer' customize group, this has
no effect on server buffers while reconnecting because ERC always
buries those."
:group 'erc-buffers
:type '(choice boolean
(const displayed)))
:type 'boolean)
(defun erc-channel-p (channel)
"Return non-nil if CHANNEL seems to be an IRC channel name."
@ -2095,35 +2086,6 @@ realizes it's missing some required module \"foo\", it can
confidently call (erc-foo-mode 1) without having to learn
anything about the dependency's implementation.")
(defun erc--setup-buffer-first-window (frame a b)
(catch 'found
(walk-window-tree
(lambda (w)
(when (cond ((functionp a) (with-current-buffer (window-buffer w)
(funcall a b)))
(t (eq (buffer-local-value a (window-buffer w)) b)))
(throw 'found t)))
frame nil 0)))
(defun erc--display-buffer-use-some-frame (buffer alist)
"Maybe display BUFFER in an existing frame for the same connection.
If performed, return window used; otherwise, return nil. Forward ALIST
to display-buffer machinery."
(when-let*
((idp (lambda (value)
(and erc-networks--id
(erc-networks--id-equal-p erc-networks--id value))))
(procp (lambda (frame)
(erc--setup-buffer-first-window frame idp erc-networks--id)))
(ercp (lambda (frame)
(erc--setup-buffer-first-window frame 'major-mode 'erc-mode)))
((or (cdr (frame-list)) (funcall ercp (selected-frame)))))
;; Workaround to avoid calling `window--display-buffer' directly
(or (display-buffer-use-some-frame buffer
`((frame-predicate . ,procp) ,@alist))
(display-buffer-use-some-frame buffer
`((frame-predicate . ,ercp) ,@alist)))))
(defvar erc--setup-buffer-hook nil
"Internal hook for module setup involving windows and frames.")
@ -2142,21 +2104,15 @@ to display-buffer machinery."
('bury
nil)
('frame
(cond
((and (eq erc-reuse-frames 'displayed)
(not (get-buffer-window buffer t)))
(display-buffer buffer '((erc--display-buffer-use-some-frame)
(inhibit-switch-frame . t)
(inhibit-same-window . t))))
((or (not erc-reuse-frames)
(not (get-buffer-window buffer t)))
(when (or (not erc-reuse-frames)
(not (get-buffer-window buffer t)))
(let ((frame (make-frame (or erc-frame-alist
default-frame-alist))))
(raise-frame frame)
(select-frame frame))
(switch-to-buffer buffer)
(when erc-frame-dedicated-flag
(set-window-dedicated-p (selected-window) t)))))
(set-window-dedicated-p (selected-window) t))))
(_
(if (active-minibuffer-window)
(display-buffer buffer)