From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.devel Subject: Re: Suggestions for improvements to the *Completions* buffer Date: Sat, 18 Dec 2021 13:39:04 +0000 Message-ID: <87o85eqbgn.fsf@posteo.net> References: <87pmpurtl9.fsf@posteo.net> <87ee6adrhp.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18747"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, Juri Linkov To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 18 14:43:13 2021 Return-path: Envelope-to: ged-emacs-devel@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 1myZzT-0004eS-Qc for ged-emacs-devel@m.gmane-mx.org; Sat, 18 Dec 2021 14:43:11 +0100 Original-Received: from localhost ([::1]:52280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1myZzS-00071X-KW for ged-emacs-devel@m.gmane-mx.org; Sat, 18 Dec 2021 08:43:10 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58202) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1myZvZ-0002vm-43 for emacs-devel@gnu.org; Sat, 18 Dec 2021 08:39:09 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:40393) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1myZvX-0003dF-7Y for emacs-devel@gnu.org; Sat, 18 Dec 2021 08:39:08 -0500 Original-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 75D8E24002A for ; Sat, 18 Dec 2021 14:39:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1639834745; bh=2oQe4+RfwqHQqn4TzFDKp5HOFeRsWCDJ4no5iI5BLm4=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=BflrluEg4aWWdoi3r1OoY0rIVwzwLpMYPRE0AHXqj7pN5b1qefzAqYs7W4OmS9oSx DxXRaKUp8PaATdoms9B8Ub+HdnH8SRe/wPRlh72wFXew035WAg6HV90jNgr59Fh2xP KyXwYrLg1QOOxKrgIXhLiCOrUTmcixAT9QXv8k0Xal9eMt47Z1LEvhbFR9J3WeCfKD xp3uqIfHUeAPg/VrUn6FCD9uq0+6ZAiWR3aWnu8Are9REd1ieL+tchC9cDw79B0rK/ kNVqUc6wqLrN5EgSfkgsEYewbEzlPokf2NJhCCo9PZId/lw/Xer5aRfWWbSOZJjlhL 4J8JfKCRT6/uA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4JGRlX69VRz6tm6; Sat, 18 Dec 2021 14:39:04 +0100 (CET) Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB In-Reply-To: <87ee6adrhp.fsf@yahoo.com> (Po Lu's message of "Sat, 18 Dec 2021 20:31:14 +0800") Received-SPF: pass client-ip=185.67.36.65; envelope-from=philipk@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, 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: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:282305 Archived-At: --=-=-= Content-Type: text/plain Po Lu writes: > Philip Kaludercic writes: > >> Here are the patches that would implement this behaviour. I have to use >> it for a bit longer before I can say if it is preferable, but I guess if >> something along these lines were to be applied, this could be an option. > > Could this part be made optional, at least for those of us with muscle > memory? I actually expect the focus to return to the previous window > (not necessarily the minibuffer) when I press `z' in a completion > buffer. Sure, that was a mistake on end. I don't even think it needs an option, so I just removed the code entirely: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0003-Switch-back-to-minibuffer-when-quitting-completion-b.patch >From b1f2aa11bdad6f07baef54ac6db15ee714d3941e Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Thu, 9 Dec 2021 17:36:14 +0100 Subject: [PATCH 3/3] Switch back to minibuffer when quitting completion buffer * lisp/simple.el (completion-quit): Add new command (completion-list-mode-map): Rebind completion-quit over keyboard-quit and delete-completion-window over keyboard-quit. --- lisp/simple.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lisp/simple.el b/lisp/simple.el index 6a7d7ba918..74deb4bdc4 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -8971,6 +8971,12 @@ set-variable ;; Define the major mode for lists of completions. +(defun completion-quit () + "Close the completion buffer and return to the minibuffer." + (interactive) + (quit-window) + (switch-to-minibuffer)) + (defvar completion-list-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map special-mode-map) @@ -8988,6 +8994,8 @@ completion-list-mode-map (define-key map "n" 'next-completion) (define-key map "p" 'previous-completion) (define-key map "\M-g\M-c" 'switch-to-minibuffer) + (define-key map [remap keyboard-quit] #'delete-completion-window) + (define-key map [remap quit-window] #'completion-quit) map) "Local map for completion list buffers.") -- 2.30.2 --=-=-= Content-Type: text/plain > Thanks. -- Philip Kaludercic --=-=-=--