unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: pillule <pillule@riseup.net>
Cc: Sujith Manoharan <sujith.wall@gmail.com>, 48493@debbugs.gnu.org
Subject: bug#48493: 28.0.50; quit-window doesn't work
Date: Tue, 25 May 2021 18:28:48 +0200	[thread overview]
Message-ID: <cc5965b4-acbb-cf91-c0ed-4da8905a295f@gmx.at> (raw)
In-Reply-To: <877djn3r3i.fsf@host.localdomain>

 > Which is what I think you are asking and IMHO ask to deal with the
 > dedicated window state to not cripple side-windows.

You're right, I forgot that side windows are by default dedicated to
their buffers.

The dedicated flag in a side window serves to prevent "normal" buffer
display to "avoid" that window.  A side window may be reused for showing
another buffer only by `display-buffer-in-side-window'.  This sense of
dedication is somewhat different from the normal sense where killing the
buffer always attempts to delete its dedicated windows (and maybe their
frames too) first.

Hence it is perfectly valid to switch to the previous buffer here - any
such buffer was meant to be displayed in that side window.  It would be,
however, invalid to switch to some buffer that was never shown in that
window here.  Note in this context that we can always delete a side
window, a side window can never be alone on its frame.

 > Thanks for the snippet, I think I am confused by this window dedication,
 > please help me to clarify my mind before I try to implement a solution
 > with or without the dedicated window state.

So maybe something like this might cut it:

       (if (and prev-buffer (memq (window-dedicated-p window) '(nil side)))
           ;; If a previous buffer exists, try to switch to it.  If that
           ;; fails for whatever reason, try to delete the window.
           (unless (switch-to-prev-buffer window bury-or-kill)
             (window--delete window nil (eq bury-or-kill 'kill)))
         ;; If no previous buffer exists, try to delete the window.  If
         ;; that fails for whatever reason, try to switch to some other
         ;; buffer.
         (unless (window--delete window nil (eq bury-or-kill 'kill))
           (switch-to-prev-buffer window bury-or-kill)))

Tell me whether this works with DOOM's `kill-buffer-hook'.

If you feel that it's more natural to delete the window in the case at
hand, we can consider that too.  But suppose someone uses such a side
window for something more permanent like a compile or shell buffer and
the backtrace buffer kicked in only accidentally, then deleting the side
window when killing the backtrace buffer might not be a good idea.

martin





  reply	other threads:[~2021-05-25 16:28 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18  3:21 bug#48493: 28.0.50; quit-window doesn't work Sujith Manoharan
2021-05-18  8:01 ` martin rudalics
2021-05-18 10:23   ` Sujith Manoharan
2021-05-18 13:31     ` martin rudalics
2021-05-19  7:43     ` martin rudalics
2021-05-24 14:53   ` pillule
2021-05-24 16:51     ` martin rudalics
2021-05-25  1:58       ` pillule
2021-05-25  6:50         ` martin rudalics
2021-05-25 13:01           ` pillule
2021-05-25 16:28             ` martin rudalics [this message]
2021-05-26 16:10               ` pillule
2021-05-27  7:47                 ` martin rudalics
2021-06-07 23:23                   ` pillule
2021-06-08  9:24                     ` pillule
2021-06-09  8:33                       ` martin rudalics
2021-06-09 12:34                         ` pillule
2021-06-09 13:00                           ` pillule
2021-06-09 13:36                             ` pillule
2021-06-13  8:49                               ` martin rudalics
2021-06-13  9:28                                 ` pillule
2021-06-13 14:52                                   ` martin rudalics
2021-06-14  8:28                               ` martin rudalics
2021-06-15 16:53                                 ` pillule
2021-06-08 12:09                     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cc5965b4-acbb-cf91-c0ed-4da8905a295f@gmx.at \
    --to=rudalics@gmx.at \
    --cc=48493@debbugs.gnu.org \
    --cc=pillule@riseup.net \
    --cc=sujith.wall@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).