unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Fernando de Morais <fernandodemorais.jf@gmail.com>
Cc: 61479@debbugs.gnu.org
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	[thread overview]
Message-ID: <868rgxea6c.fsf@mail.linkov.net> (raw)
In-Reply-To: <87y1p0dovd.fsf@gmail.com> (Fernando de Morais's message of "Tue,  14 Feb 2023 16:32:38 -0300")

>> 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)))
 





  parent reply	other threads:[~2023-02-16 18:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-13 14:56 bug#61479: 28.2; icomplete-in-buffer --- Error in post-command-hook: args-out-of-range Fernando de Morais
2023-02-13 17:56 ` Juri Linkov
2023-02-13 18:01   ` Fernando de Morais
2023-02-14  4:01     ` Fernando de Morais
2023-02-14 18:28       ` Juri Linkov
2023-02-14 19:32         ` Fernando de Morais
2023-02-15 18:20           ` Juri Linkov
2023-02-16 18:29           ` Juri Linkov [this message]
2023-02-18 13:24             ` Fernando de Morais
2023-02-23  8:36               ` Juri Linkov
2023-02-25 12:15                 ` Fernando de Morais
2023-02-27 18:45                   ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=868rgxea6c.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=61479@debbugs.gnu.org \
    --cc=fernandodemorais.jf@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).