Re: bug#76404: 31.0.50; ERC 5.6.1-git: new erc query buffer becomes sole window on RET
"J.P." <[email protected]> Tue, 18 Feb 2025 19:38:23 -0800
| Newsgroups | gmane.emacs.erc.general |
|---|---|
| Message-ID | <[email protected]> |
--=-=-= Content-Type: text/plain Trevor Arjeski <[email protected]> writes: > Using a few new emacs 31 window configurations, upon creating a new erc > query buffer with `/query yournick`, hitting RET or sending a message > makes the window the sole window in the frame as if C-x 1 was entered. > > Minimal reproduction: > > (use-package window > :custom > (kill-buffer-quit-windows t) > (quit-restore-window-no-switch 'skip-first)) > > 1. Start erc > 2. Open a query from the server buffer with `/query trev` > 3. Hit enter > 4. Notice that the query buffer that was created as a split becomes the > only window in the frame. > > This seems to trigger in `erc--split-line` in erc-backend.el, where a > temp buffer is created and then subsequently killed. Thanks for investigating. Does the attached patch improve the situation? --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-5.6.1-Don-t-kill-window-buffer-in-erc-split-line.patch From 4b9a02f7b46f84d8a78a671d2bb2fa246f102c46 Mon Sep 17 00:00:00 2001 From: "F. Jason Park" <[email protected]> Date: Tue, 18 Feb 2025 19:20:45 -0800 Subject: [PATCH] [5.6.1] Don't kill window buffer in erc--split-line * lisp/erc/erc-backend.el (erc--split-line): Restore original window buffer before killing temp buffer. (Bug#76404) --- lisp/erc/erc-backend.el | 57 +++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index 713547a591a..e9b39a6f3f4 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el @@ -588,34 +588,35 @@ erc--split-line (when (consp coding) (setq coding (car coding))) (setq coding (coding-system-change-eol-conversion coding 'unix)) - (unwind-protect - (with-temp-buffer - (set-window-buffer (selected-window) (current-buffer)) - (insert longline) - (goto-char (point-min)) - (while (not (eobp)) - (let ((upper (filepos-to-bufferpos erc-split-line-length - 'exact coding))) - (goto-char (or upper (point-max))) - (unless (eobp) - (skip-chars-backward "^ \t")) - (when (bobp) - (when erc--reject-unbreakable-lines - (user-error - (substitute-command-keys - (concat "Unbreakable line encountered " - "(Recover input with \\[erc-previous-command])")))) - (goto-char upper)) - (when-let* ((cmp (find-composition (point) (1+ (point))))) - (if (= (car cmp) (point-min)) - (goto-char (nth 1 cmp)) - (goto-char (car cmp))))) - (when (= (point-min) (point)) - (goto-char (point-max))) - (push (buffer-substring-no-properties (point-min) (point)) out) - (delete-region (point-min) (point))) - (or (nreverse out) (list ""))) - (set-window-buffer (selected-window) original-window-buf)))) + (with-temp-buffer + (unwind-protect + (progn + (set-window-buffer (selected-window) (current-buffer)) + (insert longline) + (goto-char (point-min)) + (while (not (eobp)) + (let ((upper (filepos-to-bufferpos erc-split-line-length + 'exact coding))) + (goto-char (or upper (point-max))) + (unless (eobp) + (skip-chars-backward "^ \t")) + (when (bobp) + (when erc--reject-unbreakable-lines + (user-error + (substitute-command-keys + (concat "Unbreakable line encountered (Recover input" + " with \\[erc-previous-command])")))) + (goto-char upper)) + (when-let* ((cmp (find-composition (point) (1+ (point))))) + (if (= (car cmp) (point-min)) + (goto-char (nth 1 cmp)) + (goto-char (car cmp))))) + (when (= (point-min) (point)) + (goto-char (point-max))) + (push (buffer-substring-no-properties (point-min) (point)) out) + (delete-region (point-min) (point))) + (or (nreverse out) (list ""))) + (set-window-buffer (selected-window) original-window-buf))))) ;; From Circe (defun erc-split-line (longline) -- 2.48.1 --=-=-=--