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


Message #133 received at 68235 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> linkov.net>
Cc: 68235 <at> debbugs.gnu.org
Subject: Re: bug#68235: 29.1.90; Switching tabs stops following process output
 in selected window
Date: Tue, 6 Feb 2024 11:34:54 +0100
[Message part 1 (text/plain, inline)]
> Is 'keep-windows' doable for 'window-state-put' as well?

I attach a patch that adds a fourth argument to 'window-state-put'.  It
and a new 'set-window-configuration' now use a new function I called
'marker-last-position' that returns the last position of a marker even
after its buffer was killed.

The patch also fixes a bug in 'window--state-put-2' that can be
reproduced with the following simple scenario

(let ((buffer (get-buffer-create "*foo*"))
      state)
  (pop-to-buffer buffer)
  (setq state (window-state-get))
  (kill-buffer buffer)
  (window-state-put state))

Did you never see it?

> So maybe the same option 'keep-windows' could call the same hook
> 'post-set-window-configuration-functions' from 'window-state-put' too?

I added a new hook called 'window-state-put-keep-window-functions' with
the same arguments as 'post-set-window-configuration-functions'.  Maybe
people wanted to keep them apart.  If you think the hook should be also
run when there are no "kept" windows, we can do that as well.

I tested it here with

(defun foo (frame windows)
  (while windows
    (let* ((quad (car windows))
	   (window (car quad))
	   (buffer (find-file-noselect
		    (buffer-file-name (nth 1 quad)))))
      (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-state-put-keep-window-functions 'foo)

(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 nil nil t)
  (message "State restored"))

martin
[keep-windows-2.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.