GNU bug report logs - #16274
24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Sat, 28 Dec 2013 05:53:02 UTC

Severity: normal

Tags: confirmed

Found in versions 25.1, 24.3.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: charles <at> aurox.ch (Charles A. Roelli)
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 16274 <at> debbugs.gnu.org, drew.adams <at> oracle.com
Subject: bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
Date: Sun, 22 Oct 2017 17:06:35 +0200
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Date: Fri, 03 Jan 2014 23:51:48 -0500
> 
> > So far, my best guess is still that in
> > (completion-try-completion name comps nil (length name) md)
> > the list COMPS is for some reason being treated as a function (the
> > second argument can of course be either).
> 
> Oh, you mean that the error could come from the fact that `md' goes with
> `candidates', so some code might assume that the completion table is
> a function based on the `md' data, whereas we passed `comps' which is
> a list of strings?
> 
> Hmm... that sounds plausible.

This seems to be the mistake.  If you pass nil instead of `md' (as in
the patch below), then there's no more problem.

diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 038f58f..38be657 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -395,7 +395,7 @@ icomplete-completions
                 ;; If the `comps' are 0-based, the result should be
                 ;; the same with `comps'.
                 (completion-try-completion
-                 name comps nil (length name) md)))
+                 name comps nil (length name) nil)))
 	     (most (if (consp most-try) (car most-try)
                      (if most-try (car comps) "")))
              ;; Compare name and most, so we can determine if name is

Alternatively, this part of `completion--nth-completion' could be
updated to respond to `completio--unquote-requote' in the completion
metadata when `table' is not a function:

         (when (completion-metadata-get metadata 'completion--unquote-requote)
           (cl-assert (functionp table))
           (let ((new (funcall table string point 'completion--unquote)))

(No idea if that would make sense.)

I was using this recipe for testing:

> Date: Fri, 30 Jan 2015 14:25:04 +0000
> From: Jeremy Moore <jmoore <at> ieee.org>
> 
> Hi folks,
> 
> I get a similar error by following this sequence in 24.4.1:
> 1. emacs -Q
> 2. M-x icomplete-mode
> 3. M-x set-variable icomplete-show-matches-on-no-input t
> 4. C-x C-f C-a C-k
> 
> Version and settings are below.
> 
> Regards,
> Jeremy
> 
> In GNU Emacs 24.4.1 (i686-pc-mingw32)
> of 2014-10-24 on LEG570
> Windowing system distributor `Microsoft Corp.', version 6.1.7601
> Configured using:
> `configure --prefix=/c/usr'




This bug report was last modified 7 years and 196 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.