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, 16 Feb 2023 20:29:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

>> Does it also select a completion candidate?
>
> Well, when I hit C-j, it selects the candidate, but then:
>
>   - The buffer is modified in a way that only the selected candidate is
>     visible;
>   - The same is true for multiple C-M-i when in the candidate list;
>   - I need to use `undo' to go back to the previous state of the buffer.

Here is a short patch that completely fixes this problem.
But probably it's too late for the release branch
since icomplete never worked correctly in the buffer.

diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index f7a91599f3b..aadc2e32787 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)))
 





reply via email to

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