]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/simple.el (next-completion): Handle first completion specially.
authorGregory Heytings <gregory@heytings.org>
Thu, 12 Jan 2023 17:47:28 +0000 (19:47 +0200)
committerJuri Linkov <juri@linkov.net>
Thu, 12 Jan 2023 17:47:28 +0000 (19:47 +0200)
When completions-header-format is nil and completion-show-help is nil,
the first completion is at the beginning the buffer, so 'M-<down>'
missed it and moved to the second completion.  Handle this case by
setting/checking the special text-property 'first-completion' that
is nil at the first call (bug#60411).

lisp/simple.el

index 24df86c80c2bb48bfc726772bc7e939705a4783e..e23ee961879d8a1d89a6da66a42d1fb754239fd3 100644 (file)
@@ -9755,6 +9755,14 @@ Also see the `completion-auto-wrap' variable."
   (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)))
+
       (while (> n 0)
         (setq pos (point))
         ;; If in a completion, move to the end of it.