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#59486: completion-auto-wrap disobeyed by vertical navigation Date: Tue, 22 Nov 2022 19:38:57 +0200 Organization: LINKOV.NET Message-ID: <8635aayjm6.fsf@mail.linkov.net> 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="30876"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) To: 59486@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 22 18:46:38 2022 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 1oxXLy-0007vI-0N for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Nov 2022 18:46:38 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oxXLU-0000O9-KM; Tue, 22 Nov 2022 12:46:08 -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 1oxXLO-0000Mp-DW for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2022 12:46:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oxXLO-0005iW-3f for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2022 12:46:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oxXLN-0003gA-VB for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2022 12:46:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Nov 2022 17:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 59486 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166913914014109 (code B ref -1); Tue, 22 Nov 2022 17:46:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Nov 2022 17:45:40 +0000 Original-Received: from localhost ([127.0.0.1]:52476 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxXL1-0003fV-Hq for submit@debbugs.gnu.org; Tue, 22 Nov 2022 12:45:39 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:59244) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxXL0-0003fO-2K for submit@debbugs.gnu.org; Tue, 22 Nov 2022 12:45:38 -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 1oxXKx-0000Di-7E for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2022 12:45:37 -0500 Original-Received: from relay10.mail.gandi.net ([217.70.178.230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oxXKu-0005Lt-5F for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2022 12:45:34 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 6335324000E for ; Tue, 22 Nov 2022 17:44:56 +0000 (UTC) Received-SPF: pass client-ip=217.70.178.230; envelope-from=juri@linkov.net; helo=relay10.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:248663 Archived-At: --=-=-= Content-Type: text/plain In a multi-column layout, the keys and wrap to the beginning/end of the completions buffer, but and don't. Here is a patch that supports completion-auto-wrap for wrapping to the top/bottom: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=next-line-completion.patch diff --git a/lisp/simple.el b/lisp/simple.el index 0f44b14948c..459af2fcf55 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -9572,6 +9574,8 @@ completion-list-mode-map (define-key map "\C-m" 'choose-completion) (define-key map "\e\e\e" 'delete-completion-window) (define-key map [remap keyboard-quit] #'delete-completion-window) + (define-key map [up] 'previous-line-completion) + (define-key map [down] 'next-line-completion) (define-key map [left] 'previous-completion) (define-key map [right] 'next-completion) (define-key map [?\t] 'next-completion) @@ -9736,6 +9740,77 @@ next-completion (when (/= 0 n) (switch-to-minibuffer)))) +(defun previous-line-completion (&optional n) + "Move to the item on the previous line in the completion list. +With prefix argument N, move back N items line-wise (negative N +means move forward). + +Also see the `completion-auto-wrap' variable." + (interactive "p") + (next-line-completion (- n))) + +(defun next-line-completion (&optional n) + "Move to the item on the next line in the completion list. +With prefix argument N, move N items line-wise (negative N +means move backward). + +Also see the `completion-auto-wrap' variable." + (interactive "p") + (let ((column (current-column)) + pos) + (catch 'bound + (while (> n 0) + (setq pos nil) + (save-excursion + (while (and (not pos) (not (eobp))) + (forward-line 1) + (when (and (not (eobp)) + (eq (move-to-column column) column) + (get-text-property (point) 'mouse-face)) + (setq pos (point))))) + (if pos + (goto-char pos) + (when completion-auto-wrap + (let ((column (current-column))) + (save-excursion + (goto-char (point-min)) + (when (and (eq (move-to-column column) column) + (get-text-property (point) 'mouse-face)) + (setq pos (point))) + (while (and (not pos) (not (eobp))) + (forward-line 1) + (when (and (eq (move-to-column column) column) + (get-text-property (point) 'mouse-face)) + (setq pos (point))))) + (if pos (goto-char pos))))) + (setq n (1- n))) + + (while (< n 0) + (setq pos nil) + (save-excursion + (while (and (not pos) (not (bobp))) + (forward-line -1) + (when (and (not (bobp)) + (eq (move-to-column column) column) + (get-text-property (point) 'mouse-face)) + (setq pos (point))))) + (if pos + (goto-char pos) + (when completion-auto-wrap + (let ((column (current-column))) + (save-excursion + (goto-char (point-max)) + (when (and (eq (move-to-column column) column) + (get-text-property (point) 'mouse-face)) + (setq pos (point))) + (while (and (not pos) (not (bobp))) + (forward-line -1) + (when (and (eq (move-to-column column) column) + (get-text-property (point) 'mouse-face)) + (setq pos (point))))) + (if pos (goto-char pos))))) + (setq n (1+ n)))))) + (defun choose-completion (&optional event no-exit no-quit) "Choose the completion at point. If EVENT, use EVENT's position to determine the starting position. --=-=-=--