emacs-diffs
[Top][All Lists]
Advanced

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

master a1abb6a85e6: * lisp/simple.el (next-line-completion): Improve (bu


From: Juri Linkov
Subject: master a1abb6a85e6: * lisp/simple.el (next-line-completion): Improve (bug#59486).
Date: Mon, 6 Nov 2023 12:43:41 -0500 (EST)

branch: master
commit a1abb6a85e6605c256595b8d7b885018e5421c28
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    * lisp/simple.el (next-line-completion): Improve (bug#59486).
    
    Handle the case when lines with completion candidates are
    interspersed with lines that contain group headings.
---
 lisp/simple.el | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index 96cdedb4f38..3a5a81e0011 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -10017,7 +10017,7 @@ With prefix argument N, move N lines forward (negative 
N means move backward).
 
 Also see the `completion-auto-wrap' variable."
   (interactive "p")
-  (let (line column pos)
+  (let (line column pos found)
     (when (and (bobp)
                (> n 0)
                (get-text-property (point) 'mouse-face)
@@ -10044,12 +10044,14 @@ Also see the `completion-auto-wrap' variable."
               ((< n 0) (first-completion)))))
 
     (while (> n 0)
-      (setq pos nil column (current-column) line (line-number-at-pos))
-      (when (and (or (not (eq (forward-line 1) 0))
-                     (eobp)
-                     (not (eq (move-to-column column) column))
-                     (not (get-text-property (point) 'mouse-face)))
-                 completion-auto-wrap)
+      (setq found nil pos nil column (current-column) line 
(line-number-at-pos))
+      (while (and (not found)
+                  (eq (forward-line 1) 0)
+                  (not (eobp))
+                  (eq (move-to-column column) column))
+        (when (get-text-property (point) 'mouse-face)
+          (setq found t)))
+      (when (and (not found) completion-auto-wrap)
         (save-excursion
           (goto-char (point-min))
           (when (and (eq (move-to-column column) column)
@@ -10064,11 +10066,13 @@ Also see the `completion-auto-wrap' variable."
       (setq n (1- n)))
 
     (while (< n 0)
-      (setq pos nil column (current-column) line (line-number-at-pos))
-      (when (and (or (not (eq (forward-line -1) 0))
-                     (not (eq (move-to-column column) column))
-                     (not (get-text-property (point) 'mouse-face)))
-                 completion-auto-wrap)
+      (setq found nil pos nil column (current-column) line 
(line-number-at-pos))
+      (while (and (not found)
+                  (eq (forward-line -1) 0)
+                  (eq (move-to-column column) column))
+        (when (get-text-property (point) 'mouse-face)
+          (setq found t)))
+      (when (and (not found) completion-auto-wrap)
         (save-excursion
           (goto-char (point-max))
           (when (and (eq (move-to-column column) column)



reply via email to

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