GNU bug report logs - #68235
29.1.90; Switching tabs stops following process output in selected window

Previous Next

Package: emacs;

Reported by: Dan McCarthy <daniel.c.mccarthy <at> gmail.com>

Date: Wed, 3 Jan 2024 20:49:02 UTC

Severity: normal

Found in version 29.1.90

Fixed in version 30.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> linkov.net>
Cc: 68235 <at> debbugs.gnu.org
Subject: bug#68235: 29.1.90; Switching tabs stops following process output in selected window
Date: Mon, 19 Feb 2024 10:42:09 +0100
[Message part 1 (text/plain, inline)]
>> You mean to do away with the KEEP-WINDOWS argument and keep windows iff
>> `window-state-put-keep-window-functions' is non-nil?
>
> Yes, I meant removing the KEEP-WINDOWS argument.

Patch attached.  I now provide only one hook I called
'window-kept-windows-functions' which is run by both
'set-window-configuration' and 'window-state-put'.
Tested with

(defun foo (frame windows)
  (while windows
    (let* ((quad (car windows))
	   (window (car quad))
	   (name (buffer-file-name (nth 1 quad)))
	   (buffer
	    (and name (find-file-noselect name))))
      (when buffer
	(set-window-buffer window buffer)
	(set-window-point window (nth 3 quad))
	(set-window-start window (nth 2 quad) t)))
    (setq windows (cdr windows))))

(add-hook 'window-kept-windows-functions 'foo)

(let ((window (selected-window))
      (buffer (pop-to-buffer
	       (find-file-noselect "...")))
      (window-1 (split-window))
      (window-2 (split-window nil nil t))
      configuration)
  (set-window-point window-1 5000)
  (set-window-point window-2 10000)
  (setq configuration (current-window-configuration))
  (y-or-n-p "Configuration saved ...")
  (delete-other-windows window)
  (kill-buffer buffer)
  (y-or-n-p "Configuration reset ...")
  (set-window-configuration configuration)
  (message "Configuration restored"))

(let ((window (selected-window))
      (buffer (pop-to-buffer
	       (find-file-noselect "...")))
      (window-1 (split-window))
      (window-2 (split-window nil nil t))
      state)
  (set-window-point window-1 5000)
  (set-window-point window-2 10000)
  (setq state (window-state-get))
  (y-or-n-p "State saved ...")
  (delete-other-windows window)
  (kill-buffer buffer)
  (y-or-n-p "State reset ...")
  (window-state-put state)
  (message "State restored"))

>> This would be up to you to decide.  Only some practice can tell what's
>> better here.
>
> Otherwise users won't be able to use this hook for existing commands
> that don't set the KEEP-WINDOWS argument.

OK.  But note that we now run this hook even if nothing in the window
configuration changes, typically, when calling 'read-minibuffer'.  So
use it with due care (for example, have the tab code bind it exclusively
around its calls of 'set-window-configuration').

martin
[keep-windows.diff (text/x-patch, attachment)]

This bug report was last modified 1 year and 30 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.