emacs-devel
[Top][All Lists]
Advanced

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

RE: Quit and Close Emacs Special Windows


From: Drew Adams
Subject: RE: Quit and Close Emacs Special Windows
Date: Mon, 29 Jun 2020 15:09:59 +0000 (UTC)

> I have been reading this site:
> 
> https://urldefense.com/v3/__https://christiantietze.de/posts/2019/10/emacs-
> quit-special-
> windows/__;!!GqivPVa7Brio!MYwcdeIdWpFMGgsvTIkt5Vbrg69dFCUgHqpfuyAyObkHKL7IAog
> HWMmQFaH3DjBy$
> 
> and I am wondering why we don't provide an option to enable this
> behaviour by default in some cases without needing the "hack" in the
> link. It doesn't seems to be too complex to implement right?
> 
> I know it is just a detail, but in some cases (like when using man or
> compile mode, or reading a function documentation, or after executing
> magit commands) it doesn't make sense to keep the buffer in the buffer
> list after pressing q in 90% of the times.
> 
> Could we consider to add this as (for example) an option to enable it by
> default OR add a customisable list with the modes where the user could
> desire to have this behaviour?

FWIW, I do this:

(defun quit-window-delete (&optional kill window)
  "Quit WINDOW, deleting it, and bury its buffer.
WINDOW must be a live window and defaults to the selected one.
With prefix argument KILL non-nil, kill the buffer instead of
burying it.

This is similar to the version of `quit-window' that Emacs had before
the introduction of `quit-restore-window'.  It ignores the information
stored in WINDOW's `quit-restore' window parameter.

It deletes the WINDOW more often, rather than switching to another
buffer in it.  If WINDOW is alone in its frame then the frame is
deleted or iconified, according to option `frame-auto-hide-function'."
  (interactive "P")
  (set-window-parameter
    window 'quit-restore `(frame frame nil ,(current-buffer)))
  (quit-restore-window window (if kill 'kill 'bury)))

(global-set-key [remap quit-window] 'quit-window-delete)

I also use dedicated windows for buffers with names `*...*',
and I make frame "hiding" delete frames rather than iconify.

(setq special-display-regexps '("[ ]?[*][^*]+[*]"))
(setq frame-auto-hide-function 'delete-frame)




reply via email to

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