From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#68688: 30.0.50; next-line-completion doesn't work with multiline completions Date: Wed, 24 Jan 2024 18:45:08 +0200 Organization: LINKOV.NET Message-ID: <86ttn23ckr.fsf@mail.linkov.net> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12918"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: 68688@debbugs.gnu.org To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 24 17:51:09 2024 Return-path: Envelope-to: geb-bug-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 1rSgSz-00038D-6J for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 24 Jan 2024 17:51:09 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSgSp-0006on-39; Wed, 24 Jan 2024 11:50:59 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rSgSn-0006nq-7X for bug-gnu-emacs@gnu.org; Wed, 24 Jan 2024 11:50:57 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSgSm-0006Ji-V4 for bug-gnu-emacs@gnu.org; Wed, 24 Jan 2024 11:50:56 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rSgSr-0002Qj-W1 for bug-gnu-emacs@gnu.org; Wed, 24 Jan 2024 11:51:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Jan 2024 16:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68688 X-GNU-PR-Package: emacs Original-Received: via spool by 68688-submit@debbugs.gnu.org id=B68688.17061150389284 (code B ref 68688); Wed, 24 Jan 2024 16:51:01 +0000 Original-Received: (at 68688) by debbugs.gnu.org; 24 Jan 2024 16:50:38 +0000 Original-Received: from localhost ([127.0.0.1]:46429 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rSgST-0002Pg-KZ for submit@debbugs.gnu.org; Wed, 24 Jan 2024 11:50:38 -0500 Original-Received: from relay8-d.mail.gandi.net ([217.70.183.201]:56173) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rSgSR-0002PQ-6g for 68688@debbugs.gnu.org; Wed, 24 Jan 2024 11:50:36 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id C60771BF203; Wed, 24 Jan 2024 16:50:22 +0000 (UTC) In-Reply-To: (Spencer Baugh's message of "Wed, 24 Jan 2024 10:55:37 -0500") X-GND-Sasl: juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:278797 Archived-At: > Patch which fixes this attached. Thanks for fixing the multi-line case. Could you please add a test in minibuffer-tests.el. Maybe easier is to replace '("aa" "ab" "ac") with '("aa" "a\nb" "ac"). Or a new test would be better, I don't know. > It simply adds an additional loop around forward-line which runs > until we leave the completion at point. Alternatively without a loop maybe simpler would be just to move to the end of the current completion before calling forward-line? > BTW, I think we should have some helper functions for "get start of > completion candidate or point-min" and "get end of completion candidate > or point-max", or possibly "move to start of candidate" and "move to end > of candidate"; it's pretty hard to get right. Completely agreed. We need more helper functions for all 4 functions: previous-completion, next-completion, previous-line-completion, next-line-completion. BTW, do you think that these parts below are not needed anymore since you implemented a hidden placeholder at the top in case of no header? diff --git a/lisp/simple.el b/lisp/simple.el index 692c0dacefc..ca3599e6cb3 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -9913,11 +9913,11 @@ first-completion "Move to the first item in the completions buffer." (interactive) (goto-char (point-min)) - (if (get-text-property (point) 'mouse-face) - (unless (get-text-property (point) 'first-completion) - (let ((inhibit-read-only t)) - (add-text-properties (point) (min (1+ (point)) (point-max)) - '(first-completion t)))) + (if t ;; (get-text-property (point) 'mouse-face) + ;; (unless (get-text-property (point) 'first-completion) + ;; (let ((inhibit-read-only t)) + ;; (add-text-properties (point) (min (1+ (point)) (point-max)) + ;; '(first-completion t)))) (when-let ((pos (next-single-property-change (point) 'mouse-face))) (goto-char pos)))) @@ -9950,13 +9950,13 @@ next-completion (let ((tabcommand (member (this-command-keys) '("\t" [backtab]))) pos) (catch 'bound - (when (and (bobp) - (> n 0) - (get-text-property (point) 'mouse-face) - (not (get-text-property (point) 'first-completion))) - (let ((inhibit-read-only t)) - (add-text-properties (point) (1+ (point)) '(first-completion t))) - (setq n (1- n))) + ;; (when (and (bobp) + ;; (> n 0) + ;; (get-text-property (point) 'mouse-face) + ;; (not (get-text-property (point) 'first-completion))) + ;; (let ((inhibit-read-only t)) + ;; (add-text-properties (point) (1+ (point)) '(first-completion t))) + ;; (setq n (1- n))) (while (> n 0) (setq pos (point)) @@ -10019,13 +10019,13 @@ next-line-completion Also see the `completion-auto-wrap' variable." (interactive "p") (let (line column pos found) - (when (and (bobp) - (> n 0) - (get-text-property (point) 'mouse-face) - (not (get-text-property (point) 'first-completion))) - (let ((inhibit-read-only t)) - (add-text-properties (point) (1+ (point)) '(first-completion t))) - (setq n (1- n))) + ;; (when (and (bobp) + ;; (> n 0) + ;; (get-text-property (point) 'mouse-face) + ;; (not (get-text-property (point) 'first-completion))) + ;; (let ((inhibit-read-only t)) + ;; (add-text-properties (point) (1+ (point)) '(first-completion t))) + ;; (setq n (1- n))) (if (get-text-property (point) 'mouse-face) ;; If in a completion, move to the start of it.