bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59486: completion-auto-wrap disobeyed by vertical navigation


From: Juri Linkov
Subject: bug#59486: completion-auto-wrap disobeyed by vertical navigation
Date: Wed, 23 Nov 2022 20:49:27 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

> In a multi-column layout, the keys <left> and <right>
> wrap to the beginning/end of the completions buffer,
> but <up> and <down> don't.  Here is a patch that supports
> completion-auto-wrap for wrapping to the top/bottom:

Now pushed.  And here are the corresponding commands for
navigating the completions buffer from the minibuffer:

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 6bb0fa3ae98..ea1e88c7234 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -4452,7 +4456,7 @@ minibuffer-completion-auto-choose
   :type 'boolean
   :version "29.1")
 
-(defun minibuffer-next-completion (&optional n)
+(defun minibuffer-next-completion (&optional n vertical)
   "Move to the next item in its completions window from the minibuffer.
 When `minibuffer-completion-auto-choose' is non-nil, then also
 insert the selected completion to the minibuffer."
@@ -4461,7 +4465,9 @@ minibuffer-next-completion
     (with-minibuffer-completions-window
       (when completions-highlight-face
         (setq-local cursor-face-highlight-nonselected-window t))
-      (next-completion (or n 1))
+      (if vertical
+          (next-line-completion (or n 1))
+        (next-completion (or n 1)))
       (when auto-choose
         (let ((completion-use-base-affixes t))
           (choose-completion nil t t))))))
@@ -4473,6 +4479,20 @@ minibuffer-previous-completion
   (interactive "p")
   (minibuffer-next-completion (- (or n 1))))
 
+(defun minibuffer-next-line-completion (&optional n)
+  "Move to the next completion line from the minibuffer.
+When `minibuffer-completion-auto-choose' is non-nil, then also
+insert the selected completion to the minibuffer."
+  (interactive "p")
+  (minibuffer-next-completion (or n 1) t))
+
+(defun minibuffer-previous-line-completion (&optional n)
+  "Move to the previous completion line from the minibuffer.
+When `minibuffer-completion-auto-choose' is non-nil, then also
+insert the selected completion to the minibuffer."
+  (interactive "p")
+  (minibuffer-next-completion (- (or n 1)) t))
+
 (defun minibuffer-choose-completion (&optional no-exit no-quit)
   "Run `choose-completion' from the minibuffer in its completions window.
 With prefix argument NO-EXIT, insert the completion at point to the

reply via email to

[Prev in Thread] Current Thread [Next in Thread]