bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#68235: 29.1.90; Switching tabs stops following process output in sel


From: martin rudalics
Subject: bug#68235: 29.1.90; Switching tabs stops following process output in selected window
Date: Tue, 6 Feb 2024 11:34:54 +0100
User-agent: Mozilla Thunderbird

> 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

Attachment: keep-windows-2.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]