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

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

bug#61479: 28.2; icomplete-in-buffer --- Error in post-command-hook: arg


From: Juri Linkov
Subject: bug#61479: 28.2; icomplete-in-buffer --- Error in post-command-hook: args-out-of-range
Date: Thu, 23 Feb 2023 10:36:45 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

> This patch fixes the problem when we hit C-j to select a candidate, but
> the problem persists if we type multiple C-M-i when in the candidate
> list, unfortunately.

Thanks for finding another way to reproduce the problem.  This shows
that C-M-i bound to icomplete-force-complete needs the same treatment:

diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index f7a91599f3b..b0b55dd1e7e 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -215,7 +215,11 @@ icomplete-force-complete-and-exit
        ;; calculated, This causes the first cached completion to
        ;; be taken (i.e. the one that the user sees highlighted)
        completion-all-sorted-completions)
-      (minibuffer-force-complete-and-exit)
+      (if (window-minibuffer-p)
+          (minibuffer-force-complete-and-exit)
+        (minibuffer-force-complete (icomplete--field-beg)
+                                   (icomplete--field-end)
+                                   'dont-cycle))
     ;; Otherwise take the faster route...
     (minibuffer-complete-and-exit)))
 
@@ -223,7 +227,11 @@ icomplete-force-complete
   "Complete the icomplete minibuffer."
   (interactive)
   ;; We're not at all interested in cycling here (bug#34077).
-  (minibuffer-force-complete nil nil 'dont-cycle))
+  (if (window-minibuffer-p)
+      (minibuffer-force-complete nil nil 'dont-cycle)
+    (minibuffer-force-complete (icomplete--field-beg)
+                               (icomplete--field-end)
+                               'dont-cycle)))
 
 ;; Apropos `icomplete-scroll', we implement "scrolling icomplete"
 ;; within classic icomplete, which is "rotating", by contrast.





reply via email to

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