From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.help Subject: Re: [External] : Custom for quit-window? Date: Sat, 8 Jan 2022 19:23:41 +0100 Message-ID: <20220108182341.4asnh7b7ukiyzxpj@Ergus> References: <20220107180521.7zgkfxro7c7tkdi7.ref@Ergus> <20220107180521.7zgkfxro7c7tkdi7@Ergus> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2490"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "help-gnu-emacs@gnu.org" To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 08 19:25:29 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n6GPB-0000VH-1A for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 08 Jan 2022 19:25:29 +0100 Original-Received: from localhost ([::1]:59990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n6GP8-0002X2-K5 for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 08 Jan 2022 13:25:26 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:53542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n6GO6-0002U7-VN for help-gnu-emacs@gnu.org; Sat, 08 Jan 2022 13:24:22 -0500 Original-Received: from sonic309-14.consmr.mail.bf2.yahoo.com ([74.6.129.124]:43764) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n6GO4-0004dm-Eu for help-gnu-emacs@gnu.org; Sat, 08 Jan 2022 13:24:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1641666258; bh=msKtp56jRCX24hIPwo4noq27PFcIbdJGnnu21N/1Y4I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=XvBzlooxvrO/6XZnUSWaWLwGHp2BHLvkRxo1VUiKHUBDA2BW8CfU23zHsVtXQHz2Gld2DOSaqBWgI9Rf8DdYpnihs3Zp8r409BLPI3QnW5A9kbKY398C97h7k0ngnanGtlKcxGyquqBLfdwZ5Q2WEudd5g2p1qa746Gw41/aEGNAu+9MfkFYstuW3vqHXkYh02NUkZNguJgp6bWT+Nl4HTFL3QVXAC6pl3fdgTlknfdlPicVnkiPNVXUOPh8DAEuMxhGj9RNAJ0CC5zkGgFUFng4hcmLD4ZGukp0Bb0yKpTwxjjfeJQKKvURe8X54GWNncT+7A2sTxVsvOmZvWDbvQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1641666258; bh=gDSJ8he1c2tuOsbU6wTaUnqnFBg7r4gw5AIAPnwdgBy=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=Xp6l4qSrEi/xomcLe9eOvmXSDPk/b2377qkPFNctg4uAc3Lq2wHpHOJ58TM9pY0PQQw/gmr6R9LHweDj0JHuFv8ZPM4ct/FcSQllInimxeyZNLU7zrOKAXQ7vnRyxF4dnSnglPjj0B7eipE9PrBTlPpPLwTqSY0SlY7dNiDtu9LGa3DxqrSkOh4lq9VFq56AfevsQpjSqrDkfZ39oSXdkEvgoudQ7zMElVfNod60ICPE+pK7Qakle19wRSmqpuoJbz0IToH6meQngrf+DK18Myn3NEuS/F6qpGBNi+7InQUT09+6awE25DoW5clujYzpGyFg9ZF7DxhSJ+NZXCZ5vw== X-YMail-OSG: D5RBsKQVM1ltAhZE6wrPb2v56ZtKNeQ3tEi.umDJHM9hlu4hMYc1kT1ei90U20S vmG4y1vnsYo.0lXZXdoeypnAXi14NJnnuy_12cO.2hCkWkHnSn8CxHiWINOF9p434nHe2tNMpBB8 hvV_VWxJYHV9LQvdCceIO2lnz35yS38FOm.treoJgjT2CnJtgpLZPtFiQQ1YEZ_GzuWKD3LuSAXR ovT8dO.Rp0O6ZZLn5OCjM4d7ckH8RfKxRQU.LTfeiDmL..ncv9ksHO3ogLgLKw3YiotUIJLO1GIF twhQOAtWlSNmW1g1yvNDsqwtUZ.4J5yZWpo8qEaYqr10sUje4zy7g4f.EcrGULN7z2.DvPl8HjfU pnqis.IEmgxn04g1AMF8Zf.mOCHI5tjM6HyL8F4I1M.hfEyv81lzVOo0j87gLKzcwehCv0MFXiMv eO8QkGs2NJtcBdz8mO24c6LNt0ugJT7UXnpaGS9IP08X6e5TMgCrXFDN9tkHYv_1she0bgdBEfVs 6F66zG8s32kXQZCelfoLbAHslH8pSB8mb.WkF8q3qza020ZNbIlSuCMeCge4Z6Sc5QPGG4DCeuq1 RLEnfmS.FiFaq3MBJdGC1qq8AsOhLH4Rml5aHXoF9XzSSu3Pjlm8uZdstQC2ML_THP.CsDMsIgnw DaxURdwWGC6B3BnfJReOWEiCDbIoNqLbzG4GuHCTbwqZiNqsv3vmY965ACWKM.rHTLSkU8Rb0K1W b4XQ6GXfDVIsE4Konkw.N7vctThkpX08fmbpf1LMgYpKnzDZEfEc_t8HrcA5S5rUKZ8Gnyyj3XJl jh.GXCanPTvHd.CTxK0YaI_jrNo2e6bc0MrVfPZOJw X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.bf2.yahoo.com with HTTP; Sat, 8 Jan 2022 18:24:18 +0000 Original-Received: by kubenode519.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 7ddf153794e8ab98527b1ce8156be91d; Sat, 08 Jan 2022 18:24:15 +0000 (UTC) Content-Disposition: inline In-Reply-To: X-Mailer: WebService/1.1.19551 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Received-SPF: pass client-ip=74.6.129.124; envelope-from=spacibba@aol.com; helo=sonic309-14.consmr.mail.bf2.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:135133 Archived-At: On Fri, Jan 07, 2022 at 06:11:49PM +0000, Drew Adams wrote: >> Is it there a "simple method" to make quit-window to kill the buffer >> without needing a prefix? >> >> When working with 10 files and using dired, help and some other >> special-mode derived buffers it becomes awkward to have 10 working files >> and 15 random noisy buffers that makes "C-x "" navigation >> useless and "C-x b" harder to read. >> >> Such simple custom option I am pretty sure has been deserved by someone >> before, and a simple approach may be to remap quit-window to something >> like: >> >> (defun my/quit-window (&optional kill window) >> (interactive "P") >> (quit-window t window)) >> >> But I am wondering if it is so simple why isn't there an option for >> that. Is there any very bad side effect on this? >> >> Another alternative is to hide/filter buffers using a regex or so, but >> IMHO it is like hiding the real issue under the carpet. Hi Drew: > >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... 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". 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 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? (defcustom quit-window-kills-interactive nil "Some docstring...") (defun quit-window (&optional kill window) (interactive "P") (with-current-buffer (window-buffer (window-normalize-window window)) (run-hooks 'quit-window-hook)) (quit-restore-window window (if (or kill (and quit-window-kills-interactive (called-interactively-p 'any))) 'kill 'bury))) Thanks in advance, Ergus