emacs-diffs
[Top][All Lists]
Advanced

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

emacs-29 9ecebcdded: * lisp/simple.el (next-completion): Handle first co


From: Juri Linkov
Subject: emacs-29 9ecebcdded: * lisp/simple.el (next-completion): Handle first completion specially.
Date: Thu, 12 Jan 2023 12:48:16 -0500 (EST)

branch: emacs-29
commit 9ecebcdded157e1efc2f51b67967fd101797f225
Author: Gregory Heytings <gregory@heytings.org>
Commit: Juri Linkov <juri@linkov.net>

    * lisp/simple.el (next-completion): Handle first completion specially.
    
    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 | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lisp/simple.el b/lisp/simple.el
index 24df86c80c..e23ee96187 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -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.



reply via email to

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