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.devel Subject: About zcomplete Date: Sun, 20 Feb 2022 05:05:15 +0100 Message-ID: <20220220040515.zum3iodtpscj23j3@Ergus> References: <20220220040515.zum3iodtpscj23j3.ref@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="26932"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Feb 20 05:07:02 2022 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 1nLdUy-0006ke-Jj for ged-emacs-devel@m.gmane-mx.org; Sun, 20 Feb 2022 05:07:01 +0100 Original-Received: from localhost ([::1]:42650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nLdUw-0005Zy-Ub for ged-emacs-devel@m.gmane-mx.org; Sat, 19 Feb 2022 23:06:58 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:37608) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nLdU1-0004uB-TC for emacs-devel@gnu.org; Sat, 19 Feb 2022 23:06:01 -0500 Original-Received: from sonic301-1.consmr.mail.bf2.yahoo.com ([74.6.129.40]:34757) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nLdTz-00052N-6m for emacs-devel@gnu.org; Sat, 19 Feb 2022 23:06:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1645329956; bh=na69b2Lup6cwatmEcPHaYQrSVeVfDRZ4q/GVAH7DHwk=; h=Date:From:To:Cc:Subject:References:From:Subject:Reply-To; b=EPO9cSLfTjO/49nr2b4ppzB8FtXVEJP7+4AamfRKD/mbHH/Wbc2s8uWqAVjDRWjS8U6r1RC53mE9dM28+XC2nOc9c4PBAOfJmCBc7arYLlwdej8fiYLIbRiNgwGD4x2PCClATGq1UDyJujmo9plQKqpyH7pVTsN+NLHBoqJo9mkChNjadC2X7V+9Ts85vbKP/yRxgvklbNVAPly9DCgSo+AkYPknS9CpKc42HqgM++zNRyAgVZnfFM/8Xr2ifcm9Dyy0cVnhKS2nr3B3gAaVIYx7WNyQmw08Cj4NjLmVXpBlHRS6pMXnLMKiNt7kEMXZzaHd+bVOD3BznJzjviGUTQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1645329956; bh=Xqkxc+pKI6KWBc9GOudaDkXEbGFFtcAXqiPoQ+rfs/g=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=HqtDegp0tNe0u82Dz0Bbw3JekGRKkYbXxd3mV12+eoI0PYTQV0ZY+QexoxzXvns5bHxnlZOduNL+tDieUHgth/ipn7WUyoaZOGvveQU1zY9LvO4aFNrG4A4E60vam7EWD+FqOPU9rqcjfasRUUOVrIwmkdzoVHFgsGsKzww4rTxLjKJ8xoEeHEkymIV3Ayn2reVDfsNReR1O8tUTJpKnAsJCPFGuNKf3UyIZOgQ5FtYCOk4j4mPgLPf3FxPedlR+W+TLAfAwi8A2D7IR++hfofE2H3Xew9//GjV2NamdpMdYGVdUaQjuvz6bbqFx+tG59kQZR7It4skONEHoa0OIwg== X-YMail-OSG: CP7lofwVM1mGCC.ZACRHYrIz9Ls8rmkJJ4AJZ4zR_xGvHS65CXl3R9m04yZVjuy dUNlQ88DrJrWlDZIAQWfVJDeOpAAc1eFm_e8GR3N2LNMbY3ph.eXA6eQGyIUiukcDUvIhu74xpAr LpRYF_gbEW.LJcXKwDf4crz9zjcANCl.NQevrCFaNpCBiJuGPj8G5h97wgl4ABw.Dy6bRoEkUnSN EQTPnn7C87.U2LwwkMQBzLM0TfNfdBTQExqOhdnRWudmQsKltuLng30ygo7PmrdZQpByflXxGgKx tYM22uurWg4pVBTy4gQnFtPUZzKz4JFQqLN_o1ai90TD5_dNLnGWyAtwfVSBvXrOyxB2JdMjiJxW UAgBPeIGTg_OQEhzYBcsfMUYQ0fQlkjQM.CVdoAMeVSj4nQ0RiSebu_sG8pb7PhtMXoBBKZrfAOG _nIM6VpZJDOIGuQqhuLcFiMdTlc12ZpIBfvSwtRXMNECK2U.0NUu0_1zBvyyy4wUd2NtK_7x367J DICvE1k6pTgq5JUFjg_MhFIXnzYfkovd97cZAyrqT.3NX8o6E42TWEOOsQzTkKiWJvLvlrYGoVkG rHWpL_F.dx.qenFdFdmNgyE9jxrzWy8wxhmzdw6LrMpc7QGiijJZK1uEzWdS6BEnnzjfYspy9V8K 2wlJfxVfFfyQzFqU0fCt4EjYb.1ugQWv7U.Z2xdDCxp8I4uVrr_HWtZRl8ZMMrzXyZGH5S1eL_Bo gshSPdXIuK7LtZQZEvNXOGUfkG7t5aI2iU3R2LLYy0oQ_xNuLxbn9KJaMgWpzIS_Ux1Zo45NeELM LmkXMtb3LBc3uRFS9CnVr1mPK95XVHLq0T_LVyWlwj X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.bf2.yahoo.com with HTTP; Sun, 20 Feb 2022 04:05:56 +0000 Original-Received: by kubenode505.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 2dd6588071d92492052b4cd76f79c488; Sun, 20 Feb 2022 04:05:54 +0000 (UTC) Content-Disposition: inline X-Mailer: WebService/1.1.19797 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Received-SPF: pass client-ip=74.6.129.40; envelope-from=spacibba@aol.com; helo=sonic301-1.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, T_SCC_BODY_TEXT_LINE=-0.01 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:286499 Archived-At: Hi recently I have been trying to move back to default completion. As I had many issues with fido and icomplete. The default completion system received a nice improvement recently with the completion-autoselect... and I am wondering a simple mode like this may be added to vanilla (or at least it gives an idea to a better lisper to implement something better, this is just a proof of concept.) ``` (require 'simple) (require 'minibuffer) (defvar-keymap zcomplete-map :doc "Keymap used in *Completions* on zcomplete" :parent completion-list-mode-map "z" nil "n" nil "p" nil "q" nil "g" nil "h" nil "DEL" nil ) (defun zcomplete--try-on-minibuffer () "Try to execute the binding on minibuffer." (switch-to-minibuffer) (if-let ((command (lookup-key (current-active-maps) (this-single-command-keys)))) (progn (minibuffer-hide-completions) (call-interactively command) t) ;; back to completions (switch-to-completions) nil)) (defun zcomplete--completions-pre-hook () "Try on minibuffer when the command is not in *Completions* map." (when (eq this-command 'undefined) (zcomplete--try-on-minibuffer))) (defun zcomplete--hack (data context signal) "Alternative to command-error-default-function. This will try to execute on minibuffer, else emits the error" (unless (and (string= (buffer-name) "*Completions*") (zcomplete--try-on-minibuffer)) (command-error-default-function data context signal))) (defun zcomplete--completions-setup-hook () "To call on completions setup." (add-hook 'pre-command-hook #'zcomplete--completions-pre-hook nil t) (setq-local command-error-function #'zcomplete--hack) (setq-local mode-line-format nil) (use-local-map zcomplete-map)) (define-minor-mode zcomplete-mode "Completion highlight mode to enable candidates highlight in the minibuffer." :global t :group 'minibuffer (if zcomplete-mode (progn (setq completion-auto-select t) ;; (overlay-put zcomplete-overlay 'face 'zcomplete) (add-hook 'completion-setup-hook #'zcomplete--completions-setup-hook t)) (remove-hook 'completion-setup-hook #'zcomplete--completions-setup-hook))) (provide 'zcomplete) ``` It lacks some features (like highlight the current candidate or automatically update completion buffers when visible) to be really a zsh-like feature, but at least we don't need to press C-g every time we want to edit the minibuffer. With this a tab shows the completions and goes there, and any attempt to edit or not defined command tries to execute on the minibuffer... Parts of this could be implemented with advises, but I know we try to avoid those on vanilla code. WDYT? Best, Ergus