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: Re: [PATCH] Re: Other details about completion. Date: Mon, 4 Apr 2022 21:35:01 +0200 Message-ID: <20220404193501.adojhz7uvvaoq4sj@Ergus> References: <20220401153839.idrzrbfl2yfzga3y.ref@Ergus> <20220401153839.idrzrbfl2yfzga3y@Ergus> <86r16g92v5.fsf@mail.linkov.net> <20220401202425.jfrwqmkm3ffmcm5h@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="32276"; 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 Mon Apr 04 21:36:45 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 1nbSVI-0008HD-DO for ged-emacs-devel@m.gmane-mx.org; Mon, 04 Apr 2022 21:36:44 +0200 Original-Received: from localhost ([::1]:43018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nbSVH-0003zk-DS for ged-emacs-devel@m.gmane-mx.org; Mon, 04 Apr 2022 15:36:43 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:33358) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nbSTs-000374-I6 for emacs-devel@gnu.org; Mon, 04 Apr 2022 15:35:16 -0400 Original-Received: from sonic308-2.consmr.mail.bf2.yahoo.com ([74.6.130.41]:44980) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nbSTq-0002mI-As for emacs-devel@gnu.org; Mon, 04 Apr 2022 15:35:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1649100911; bh=fwtNYPetsa1QotwclLCdpK8XAwsOp4hFQo1h89lYi/s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=VKmlJ4jZQFN6X5zQhkJio64X+zjvsZn9rKdL7oEAWEBd6N+mJH5D6RwzaqV1zQ6TGUao3xAl/+tW/+QXNObIwsrJFV3YT1n/fA7GTAwNVzLZVG3/W22fPt8wgOnWlT1uKKBAUeKqTCcX5Klywvq08sHN2K5my/rHPKy44KLlSya8exqEExdJEBD55g3t0nddkgTS7MPa0+0lNVN2HaGe5Hpea+CYz74IkM5yKEyPBVXALz4p6wS7VKoF0s3qEvk0Ib2Irzd5vb9zpiwXBt6XmjFaVsNKyPkLBPX37glaMkzdxQrSqgRchH616d4dnzxqFjTTGloGk9ufw9weFsftIQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1649100911; bh=7LJOIfWZ2+A6EZNwW5VOmUbUS3/Kudoq/eL8uJbVN0v=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=F/OiLATYPOY9Z04KCikCp6C3mnANULHjNLsRNKdC6fX4o5NkZSFOJ4K6uu1r1zDuGDlk6y5yGheBc2vkY+cwwBHFumsrjzyf2h0ZnEhExGVnzOHU3xn/rz+yfRNPAWaQfI98VaLcv8d3VnMVE0Tbv8vpP3rL6DSzeaENnCi3ntHWLXQKwXMbxX3r9zI1+GGLE7eedUbJTolFro5UAP0Q+0JYL8oCbMDr4vS5td97SCAk1KnXq6X/aM8mi6ESv+JzqXGUO2FrqWcwOdwb8EVSlGItN+NfQm3Yoq3/dUe+E2ihoe23zyKH+n46TfqGdVLcAIfDLbswLFM/7YUQNPtqew== X-YMail-OSG: FvBPaiQVM1lsSl4qnd9xXjNvEz7n8hyTi.80L1p466YxuTy9VHCCnOyjT9hPuIW 18rkgZTj3yiuUS7517cPRPgU7xodVCKZxAhEyUkSuO2sbJskuCiHWzHZg1OA5FNWMYkglK0WfTfF Pdk9M_e12gFziT_LnmH.qEx0EsKnwGzFcW_5pbeW25ujtbiiXFbQQa_sCtE.hCU6SCJkq_F58e4L D9HH73iH9uxK7sQCPfLgQ_hPuR2_K29VDdYZgHUc5vY34xWCUP992HP7WVCfH7wYKRTf1qT8B2e4 Ezpj.yw722kdxDp0h.fYz0JLPssf8z.MwcuRuu1eK7LHQCU4XBRiDynejSDxnUoPVgkIBh3crw_G 36M2PLLtJa3LIg3V4XTd4FsaoqXjigiCy819TY7ksMGiAi7FEj1TQZN6F9M8Uk6NUYwXGhXSU6nN 7N458XhDpiXuHDjeuAxDfpozvFwuNl3w0AB3tHnqgGiy7wKoq3BLmKOCItbaycUr9spvJVfvfpUT StwIpOvUGxgNN3Ek3zH0UGZZAf99QiNXFhTvLZcZ_nGEjGjs3tsoSvVGbiK9dZ8KXmGFk6_dpEXF SchInsKhm1dbXHULEdoF7YcuO2v0VHw7.gCmdNOj97UBP3I5uIU739g_hxB9Jvd0idsG3Q5BWHTi uik3cQQhQLaG3omr.KAbK6O._hsUvfeSso5bgZI0Hz6LTs9PUD6PUMqN5zAx0JAkkrAy0DFDiBJx d4bxk8rRnWo1X4wAdsBHP_6b_N9TOfnD3rLGpDyc71dmxQ__NRPCelb3HUbxe_Ys8wYVa0pXQ6dO DQ733bR6KooJvW48tE0YUriVZL6ujNzjhbZtzYoQqH X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic308.consmr.mail.bf2.yahoo.com with HTTP; Mon, 4 Apr 2022 19:35:11 +0000 Original-Received: by hermes--canary-production-bf1-665cdb9985-85ftg (VZM Hermes SMTP Server) with ESMTPA ID 34f11a03f0a08882b66752ad47b4244d; Mon, 04 Apr 2022 19:35:05 +0000 (UTC) Content-Disposition: inline In-Reply-To: <20220401202425.jfrwqmkm3ffmcm5h@Ergus> X-Mailer: WebService/1.1.20001 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Received-SPF: pass client-ip=74.6.130.41; envelope-from=spacibba@aol.com; helo=sonic308-2.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:287771 Archived-At: May I finally add this patch to master?? On Fri, Apr 01, 2022 at 10:24:25PM +0200, Ergus wrote: >Hi again... > >Here I attached a small patch that makes 3 small changes: > >1) Remove the trailing newline in completions one-column >2) Use another condition in next-completion to jump to minibuffer. > >Normally next-completion with tabs at the end of the buffer needs an >extra tab because it goes to the end of the last completion before >jumping to the minibuffer or wrap.. That extra tab is because the >condition to jump or wrap was eobp/bobp assuming that there is not text >unproppertized after the last candidate. > >3) Remove a comment in switch-to-completions. That comment suggested that >the next-completion action must be called inside >minibuffer-completion-help but IMO that is not totally correct when >completion-auto-select has some of the new values. > >Please, if anyone could review,correct and push I would be very >grateful. > >Best, >Ergus >diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el >index d8df1799c9..5ad44a7a2d 100644 >--- a/lisp/minibuffer.el >+++ b/lisp/minibuffer.el >@@ -2044,7 +2044,8 @@ completion--insert-one-column > (when title > (insert (format completions-group-format title) "\n"))))) > (completion--insert str group-fun) >- (insert "\n"))))) >+ (insert "\n"))) >+ (delete-char -1))) > > (defun completion--insert (str group-fun) > (if (not (consp str)) >diff --git a/lisp/simple.el b/lisp/simple.el >index c60abcb1f4..7918767a75 100644 >--- a/lisp/simple.el >+++ b/lisp/simple.el >@@ -9179,46 +9179,53 @@ next-completion > ((/= prev (point)) > (point)) > (t prev)))) >- (let ((beg (point-min)) (end (point-max))) >+ >+ (let ((beg (point-min)) >+ (end (point-max)) >+ (tabcommand (member (this-command-keys) '("\t" [backtab]))) >+ prop) > (catch 'bound > (while (> n 0) > ;; If in a completion, move to the end of it. > (when (get-text-property (point) 'mouse-face) > (goto-char (next-single-property-change (point) 'mouse-face nil end))) > ;; If at the last completion option, wrap or skip to the >- ;; minibuffer, if requested. >- (when (and completion-wrap-movement (eobp)) >- (if (and (member (this-command-keys) '("\t" [backtab])) >- completion-auto-select) >+ ;; minibuffer, if requested. We can't use (eobp) because some >+ ;; extra text may be after the last candidate: ex: when >+ ;; completion-detailed >+ (setq prop (next-single-property-change (point) 'mouse-face nil end)) >+ (when (and completion-wrap-movement (eq end prop)) >+ (if (and completion-auto-select tabcommand) > (throw 'bound nil) > (goto-char (point-min)))) > ;; Move to start of next one. > (unless (get-text-property (point) 'mouse-face) > (goto-char (next-single-property-change (point) 'mouse-face nil end))) > (setq n (1- n))) >+ > (while (and (< n 0) (not (bobp))) >- (let ((prop (get-text-property (1- (point)) 'mouse-face))) >- ;; If in a completion, move to the start of it. >- (when (and prop (eq prop (get-text-property (point) 'mouse-face))) >- (goto-char (previous-single-property-change >- (point) 'mouse-face nil beg))) >- ;; Move to end of the previous completion. >- (unless (or (bobp) (get-text-property (1- (point)) 'mouse-face)) >- (goto-char (previous-single-property-change >- (point) 'mouse-face nil beg))) >- ;; If at the first completion option, wrap or skip to the >- ;; minibuffer, if requested. >- (when (and completion-wrap-movement (bobp)) >- (if (and (member (this-command-keys) '("\t" [backtab])) >- completion-auto-select) >- (progn >- (goto-char (next-single-property-change (point) 'mouse-face nil end)) >- (throw 'bound nil)) >- (goto-char (point-max)))) >- ;; Move to the start of that one. >+ (setq prop (get-text-property (1- (point)) 'mouse-face)) >+ ;; If in a completion, move to the start of it. >+ (when (and prop (eq prop (get-text-property (point) 'mouse-face))) > (goto-char (previous-single-property-change >- (point) 'mouse-face nil beg)) >- (setq n (1+ n))))) >+ (point) 'mouse-face nil beg))) >+ ;; Move to end of the previous completion. >+ (unless (or (bobp) (get-text-property (1- (point)) 'mouse-face)) >+ (goto-char (previous-single-property-change >+ (point) 'mouse-face nil beg))) >+ ;; If at the first completion option, wrap or skip to the >+ ;; minibuffer, if requested. >+ (setq prop (previous-single-property-change (point) 'mouse-face nil beg)) >+ (when (and completion-wrap-movement (eq beg prop)) >+ (if (and completion-auto-select tabcommand) >+ (progn >+ (goto-char (next-single-property-change (point) 'mouse-face nil end)) >+ (throw 'bound nil)) >+ (goto-char (point-max)))) >+ ;; Move to the start of that one. >+ (goto-char (previous-single-property-change >+ (point) 'mouse-face nil beg)) >+ (setq n (1+ n)))) > (when (/= 0 n) > (switch-to-minibuffer)))) > >@@ -9436,22 +9443,18 @@ completion-setup-function > (defun switch-to-completions () > "Select the completion list window." > (interactive) >- (let ((window (or (get-buffer-window "*Completions*" 0) >- ;; Make sure we have a completions window. >- (progn (minibuffer-completion-help) >- (get-buffer-window "*Completions*" 0))))) >- (when window >- (select-window window) >+ (when-let ((window (or (get-buffer-window "*Completions*" 0) >+ ;; Make sure we have a completions window. >+ (progn (minibuffer-completion-help) >+ (get-buffer-window "*Completions*" 0))))) >+ (select-window window) >+ (when (bobp) > (cond > ((and (memq this-command '(completion-at-point minibuffer-complete)) >- (equal (this-command-keys) [backtab]) >- (bobp)) >+ (equal (this-command-keys) [backtab])) > (goto-char (point-max)) > (previous-completion 1)) >- ;; In the new buffer, go to the first completion. >- ;; FIXME: Perhaps this should be done in `minibuffer-completion-help'. >- ((bobp) >- (next-completion 1)))))) >+ (t (next-completion 1)))))) > > (defun read-expression-switch-to-completions () > "Select the completion list window while reading an expression."