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

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

bug#59862: quit-restore per window buffer


From: Juri Linkov
Subject: bug#59862: quit-restore per window buffer
Date: Tue, 09 Jul 2024 09:58:49 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)

> It took me some time to rewrite the code for this since I found a couple
> of leaks in the window handling code which I tried to plug now.  In a
> nutshell, the new patch is supposed to fix the following issues.
>
> - I introduced a new variable called 'kill-buffer-quit-windows'.  If
>   non-nil, it makes killing a buffer call 'quit-restore-window' for each
>   window showing the buffer thus implementing the behavior you want.  If
>   nil, killing a buffer works as before apart from the fixes I added
>   below.

Thanks, I hope it will help to replace such configurations:

  (defun quit-window-kill-buffer ()
    "Quit WINDOW and kill its buffer."
    (interactive)
    (quit-window 1))
  (define-key special-mode-map "q" 'quit-window-kill-buffer)
  (define-key image-mode-map "q" 'quit-window-kill-buffer)
  (define-key global-map "\C-q" 'quit-window-kill-buffer)
  (define-key dired-mode-map "q" 'quit-window-kill-buffer)
  (define-key archive-mode-map "q" 'quit-window-kill-buffer)
  (define-key tar-mode-map "q" 'quit-window-kill-buffer)
  ...

I suppose it will affect only interactive uses of 'kill-buffer'.

> In earlier versions of Emacs, window configurations were mostly used to
> handle window excursions and were consequently rather short-lived.  Your
> tab bar code has changed that.  Hence we should try to avoid any leaks
> introduced by long-lived configurations.

Indeed now window configurations are long-lived, so tab-bar uses
(split-window) followed by (delete-window) to create a new window
different from the window saved in a window configuration.

> Please test the patch intensively and report any problems you see.  I
> used the forms below to test the various features of the patch.

I have used your previous patch for a long time,
and it worked perfectly.  I hope your new patch
will be as good as the old one.

PS: I noticed one difference between handling of frames and tabs:

C-x 5 5   ;; other-frame-prefix
C-h i     ;; info
C-h e     ;; view-echo-area-messages
q         ;; quit-window
This deletes the Info window, and doesn't delete the frame.
Everything is correct.

C-x t t   ;; other-tab-prefix
C-h i     ;; info
C-h e     ;; view-echo-area-messages
q         ;; quit-window
This doesn't close the tab (correct),
but doesn't delete the Info window.
This differs from the frame case that keeps
only the Messages window on the frame.





reply via email to

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