unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Ergus <spacibba@aol.com>
Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: RE: [External] : Custom for quit-window?
Date: Sun, 9 Jan 2022 00:26:54 +0000	[thread overview]
Message-ID: <SJ0PR10MB5488B4C4419B67A619F1C3D5F34F9@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <20220108182341.4asnh7b7ukiyzxpj@Ergus>

> >I use 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)))
> >
> >And I do this:
> >
> >(global-set-key [remap quit-window] ' quit-window-delete)
> 
> I just tried your suggestion and I don't get any difference...

You don't get any difference from what?

I didn't try your code.  I was just passing along
the info that this is what I use.  (It's in my
little library `misc-cmds.el'.)

> I saw that you had a package called window+ that is supposed to do more or
> less what I want, is it right? So actually kill the buffer like with
> "C-u q".

The (re)definition of `quit-window' in `window+.el'
is only for Emacs versions prior to 24.  That code
is conditionalized with:
 (when (< emacs-major-version 24)...).

You don't need it for Emacs 24+.  You can, I assume
still use it with Emacs 24+, though, if you like.

Part of what I was passing along was to say that
you can remap all keys that are normally bound to
`quit-window' to some other command. 

> But I am still not sure why this is not an currently an option and the
> implementation not simpler, or if there are some "bad" side effects in
> the implementation suggested in my initial email.

I can't speak to either of those things.  The code
I use was, IIRC, suggested by Martin Rudalics after
I complained about Emacs having changed the behavior
of `quit-window'.  The code I use, on his suggestion,
provides behavior like Emacs did before the change.

> I mean, to make it less intrusive and only call kill when called
> interactively (until I am sure there are not any undesired side effect)
> is this fine?

To only do it when interactive, don't redefine any
original function that's also used noninteractively.
Just define your own command, bind it to keys, and
don't invoke it noninteractively.



  reply	other threads:[~2022-01-09  0:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220107180521.7zgkfxro7c7tkdi7.ref@Ergus>
2022-01-07 18:05 ` Custom for quit-window? Ergus
2022-01-07 18:11   ` [External] : " Drew Adams
2022-01-08 18:23     ` Ergus
2022-01-09  0:26       ` Drew Adams [this message]
2022-01-07 18:20   ` John W Higgins

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=SJ0PR10MB5488B4C4419B67A619F1C3D5F34F9@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=spacibba@aol.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.
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).