[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 17:00:01 +0000 (UTC) |
Hi Ergus
> >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)
>
>
> 1) Should we provide a custom variable to conditionally enable the
> set-window-parameter part of your code within quit-window?
>
> 2) I am not very trained in lisp, so I must ask if you think that
> this changes is general enough for all the buffers like: Help,
> man, Compile, magit etc?? and won't conflict with others?
>
> if 1 && 2): as this is your code, could you please add the
> changes if nobody has any concern about it?
No idea; sorry. I'm just saying what I do.
The definition of `quit-window-delete' that I use
has this comment:
;; Candidate as a replacement for `quit-window',
;; at least when used interactively. For example:
;; (define-key global-map [remap quit-window] 'quit-window-delete)
;;
;; Thanks to Martin Rudalics for suggestions.
Someone else will need to make changes to Emacs, if
such is decided.
The things I mentioned don't necessarily belong
together for others. For me they make sense together.
For example, making buffers `*...*' special-display
is unrelated to quitting help buffers with `q'.
But for me it makes sense. I show all such buffers
in their own dedicated window (frame, in fact), and
when I use `q' to quit the buffer I want to delete
the frame. I imagine that at least some others won't
want such behavior.
Do I think that it would be good to have a simple way
to get `q' to delete the window? Yes. Do I think it
would be good to have a simple way for `q' to delete
a one-window frame? Yes. But someone else will need
to think about and decide whether that's helpful in
general and, if so, what's the best way to offer it.
Re: Quit and Close Emacs Special Windows, Stefan Monnier, 2020/06/30