all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
@ 2013-12-28  5:52 Drew Adams
  2014-01-03  4:23 ` Stefan Monnier
                   ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Drew Adams @ 2013-12-28  5:52 UTC (permalink / raw)
  To: 16274

I believe I reported long ago (in the Emacs 24 cycle, IIRC) that I
occasionally get this error.  This is still the case.  The value it
complains about not being a function is a list of completions (strings),
which each have text property `face' with values
`completions-common-part' and `(completions-first-difference)' (a list).

I haven't been able to see where in the code this error could occur.  I
have noticed it being raised with my setup (icomplete+.el).  Dunno
whether it occurs also in emacs -Q.

FWIW, my code does not even reference `icomplete-post-command-hook'
explicitly, and it does not use those particular faces explicitly.

I also have not been able to find the code that issues that error
message.  Perhaps it is in some C code - the latest C code I have is for
Emacs 24.3.

A wild guess about this is that the list of completions is the cached
value in variable `completion-all-sorted-completions'.  And perhaps in
code like this:

(completion-try-completion name comps nil (length name) md)

Maybe COMPS here (which is the value of
`completion-all-sorted-completions') is somehow expected to be a
function?  Does this ring a bell for anyone?  Just poking in the dark.
Dunno how to debug this better.  The error message does not stop
execution, being on `post-command-hook'.  It just flashes ephemerally
and then I can find it in `*Messages*'.

And, again, it seems that this happens just once in a while.

If this info does not help at all, feel free to close the bug.  Or leave
it open, for future reference.  It has been there for a while now.


In GNU Emacs 24.3.50.1 (i686-pc-mingw32)
 of 2013-12-27 on ODIEONE
Bzr revision: 115778 rgm@gnu.org-20131228000456-1797o8z6veuyozs0
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/Devel/emacs/binary --enable-checking=yes,glyphs
 'CFLAGS=-O0 -g3' LDFLAGS=-Lc:/Devel/emacs/lib
 CPPFLAGS=-Ic:/Devel/emacs/include'





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
  2013-12-28  5:52 bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...)) Drew Adams
@ 2014-01-03  4:23 ` Stefan Monnier
  2014-01-03 16:20   ` Drew Adams
  2015-01-30 14:25 ` bug#16274: ; One method to produce an error in icomplete-post-command-hook Jeremy Moore
  2015-08-11 19:02 ` bug#16274: Can still reproduce in Emacs 24.5.2/x86_64-unknown-linux-gnu Michael Hoffman
  2 siblings, 1 reply; 25+ messages in thread
From: Stefan Monnier @ 2014-01-03  4:23 UTC (permalink / raw)
  To: Drew Adams; +Cc: 16274

> I haven't been able to see where in the code this error could occur.
> I have noticed it being raised with my setup (icomplete+.el).  Dunno
> whether it occurs also in emacs -Q.

For now, I'll assume that the problem is in your icomplete+.el, because
in any case, there's not much info to go about tracking down
the problem.


        Stefan





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
  2014-01-03  4:23 ` Stefan Monnier
@ 2014-01-03 16:20   ` Drew Adams
  2014-01-03 22:14     ` Stefan Monnier
  0 siblings, 1 reply; 25+ messages in thread
From: Drew Adams @ 2014-01-03 16:20 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 16274

> > I haven't been able to see where in the code this error could
> > occur.  I have noticed it being raised with my setup
> > (icomplete+.el).  Dunno whether it occurs also in emacs -Q.
> 
> For now, I'll assume that the problem is in your icomplete+.el,
> because in any case, there's not much info to go about tracking
> down the problem.

Fair enough.  But note that I mentioned that:

> FWIW, my code does not even reference `icomplete-post-command-hook'
> explicitly, and it does not use those particular faces explicitly.

Can you identify the code that issues that error message?  That
might help.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
  2014-01-03 16:20   ` Drew Adams
@ 2014-01-03 22:14     ` Stefan Monnier
  2014-01-03 22:52       ` Drew Adams
  0 siblings, 1 reply; 25+ messages in thread
From: Stefan Monnier @ 2014-01-03 22:14 UTC (permalink / raw)
  To: Drew Adams; +Cc: 16274

>> FWIW, my code does not even reference `icomplete-post-command-hook'
>> explicitly,

The message only says that the error occurs while running
icomplete-post-command-hook.  So if your code affects
something run by icomplete-post-command-hook, it's still a possible culprit.

>> and it does not use those particular faces explicitly.

Obviously the list of strings comes from completion-all-completions or
completion-all-sorted-completions and looks sane.  So the error is that
some code mistakenly treats the list as a function.

> Can you identify the code that issues that error message?

It's the C code that runs `post-command-hook', AFAIK.


        Stefan





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
  2014-01-03 22:14     ` Stefan Monnier
@ 2014-01-03 22:52       ` Drew Adams
  2014-01-04  4:51         ` Stefan Monnier
  0 siblings, 1 reply; 25+ messages in thread
From: Drew Adams @ 2014-01-03 22:52 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 16274

> Obviously the list of strings comes from completion-all-completions
> or completion-all-sorted-completions and looks sane.  So the error is
> that some code mistakenly treats the list as a function.

Yes, I said as much, explicitly.

> > Can you identify the code that issues that error message?
> 
> It's the C code that runs `post-command-hook', AFAIK.

I was looking for the function that issued the `invalid-function'
error.  It seems to be `eval_sub' (via `Qinvalid_function').
So no special help there.

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

And I'm still wild-guessing that this somehow has to do with
the caching of the list of completions in variable
`completion-all-sorted-completions'.

Maybe `completion--nth-completion' (called by
`completion-try-completion') for some reason finds 
(completion-metadata-get metadata 'completion--unquote-requote) to be
non-nil, and so calls its TABLE argument, trying to requote?

Not easy to debug this.  I do not see the problem regularly.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
  2014-01-03 22:52       ` Drew Adams
@ 2014-01-04  4:51         ` Stefan Monnier
  2014-01-04  7:03           ` Drew Adams
  2017-10-22 15:06           ` Charles A. Roelli
  0 siblings, 2 replies; 25+ messages in thread
From: Stefan Monnier @ 2014-01-04  4:51 UTC (permalink / raw)
  To: Drew Adams; +Cc: 16274

>> > Can you identify the code that issues that error message?
>> It's the C code that runs `post-command-hook', AFAIK.
> I was looking for the function that issued the `invalid-function'
> error.  It seems to be `eval_sub' (via `Qinvalid_function').

Right, it's probably eval of funcall.

> So no special help there.

Indeed.

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

> Maybe `completion--nth-completion' (called by
> `completion-try-completion') for some reason finds 
> (completion-metadata-get metadata 'completion--unquote-requote) to be
> non-nil, and so calls its TABLE argument, trying to requote?

Apply the patch below.  That should replace your error message with
a different one, so if the error message stays the same, the problem
is elsewhere.  And if a new message appears we've found a culprit.
Of course, minibuffer.el is preloaded, so you'll want to re-dump your
Emacs, force reloading minibuffer.el(c) from your .emacs, or do some
other dance to make sure you use the new definition of
completion--nth-completion.


        Stefan


=== modified file 'lisp/minibuffer.el'
--- lisp/minibuffer.el	2014-01-01 07:43:34 +0000
+++ lisp/minibuffer.el	2014-01-04 04:48:56 +0000
@@ -819,6 +819,7 @@
   ;; part of the string (e.g. substitute-in-file-name).
   (let ((requote
          (when (completion-metadata-get metadata 'completion--unquote-requote)
+           (cl-assert (functionp table))
            (let ((new (funcall table string point 'completion--unquote)))
              (setq string (pop new))
              (setq table (pop new))






^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
  2014-01-04  4:51         ` Stefan Monnier
@ 2014-01-04  7:03           ` Drew Adams
  2014-01-04 15:45             ` Drew Adams
  2017-10-22 15:06           ` Charles A. Roelli
  1 sibling, 1 reply; 25+ messages in thread
From: Drew Adams @ 2014-01-04  7:03 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 16274

> Apply the patch below.  That should replace your error message with
> a different one, so if the error message stays the same, the problem
> is elsewhere.  And if a new message appears we've found a culprit.
> Of course, minibuffer.el is preloaded, so you'll want to re-dump
> your Emacs, force reloading minibuffer.el(c) from your .emacs, or
> do some other dance to make sure you use the new definition of
> completion--nth-completion.

Hey, thanks for hanging in there.  I patched minibuffer.el and will
`load-library' the patched version from my .emacs.  That should do it,
I assume.

It's not often that I notice the error (in *Messages*, since the message
itself is fleeting), but I'll try to keep an eye out for the new message
and let you know.  (I added a noticeable STRING arg to the `cl-assert'
form.)





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
  2014-01-04  7:03           ` Drew Adams
@ 2014-01-04 15:45             ` Drew Adams
  2014-02-10  3:53               ` Lars Ingebrigtsen
  0 siblings, 1 reply; 25+ messages in thread
From: Drew Adams @ 2014-01-04 15:45 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 16274

> It's not often that I notice the error (in *Messages*, since the
> message itself is fleeting), but I'll try to keep an eye out for
> the new message and let you know.  (I added a noticeable STRING
> arg to the `cl-assert' form.)

Well, it didn't take that long.  In the same session (after loading
the patched minibuffer.el.  I did not get the `cl-assert' violation.
I got the same, original error:

  Error in post-command-hook (icomplete-post-command-hook):
  (wrong-type-argument stringp nil)

Well, actually, that's not the same error, but it is (IIRC)
the one I reported originally.

I've added some more debug with `stringp' assertions.  Will let
you know what I find out.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
  2014-01-04 15:45             ` Drew Adams
@ 2014-02-10  3:53               ` Lars Ingebrigtsen
  2014-02-10 16:34                 ` Stefan Monnier
  0 siblings, 1 reply; 25+ messages in thread
From: Lars Ingebrigtsen @ 2014-02-10  3:53 UTC (permalink / raw)
  To: Drew Adams; +Cc: 16274

Drew Adams <drew.adams@oracle.com> writes:

>> It's not often that I notice the error (in *Messages*, since the
>> message itself is fleeting), but I'll try to keep an eye out for
>> the new message and let you know.  (I added a noticeable STRING
>> arg to the `cl-assert' form.)
>
> Well, it didn't take that long.  In the same session (after loading
> the patched minibuffer.el.  I did not get the `cl-assert' violation.
> I got the same, original error:
>
>   Error in post-command-hook (icomplete-post-command-hook):
>   (wrong-type-argument stringp nil)
>
> Well, actually, that's not the same error, but it is (IIRC)
> the one I reported originally.
>
> I've added some more debug with `stringp' assertions.  Will let
> you know what I find out.

You can also use `debug-on-message' to find what make the message appear.

Anyway, is this an Emacs bug?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
  2014-02-10  3:53               ` Lars Ingebrigtsen
@ 2014-02-10 16:34                 ` Stefan Monnier
  2014-02-10 20:55                   ` Drew Adams
  0 siblings, 1 reply; 25+ messages in thread
From: Stefan Monnier @ 2014-02-10 16:34 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 16274

>> Error in post-command-hook (icomplete-post-command-hook):
>> (wrong-type-argument stringp nil)
> You can also use `debug-on-message' to find what make the message appear.

In this case, you won't learn anything more than what the error message
says, sadly.

> Anyway, is this an Emacs bug?

That was the working hypothesis, yes.  Drew, any news on this bug?


        Stefan





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
  2014-02-10 16:34                 ` Stefan Monnier
@ 2014-02-10 20:55                   ` Drew Adams
  2014-02-20  5:09                     ` Drew Adams
  0 siblings, 1 reply; 25+ messages in thread
From: Drew Adams @ 2014-02-10 20:55 UTC (permalink / raw)
  To: Stefan Monnier, Lars Ingebrigtsen; +Cc: 16274

> > Anyway, is this an Emacs bug?
> 
> That was the working hypothesis, yes.  Drew, any news on this bug?

Not yet, unfortunately.  But I've been checking *Messages*.
And I've kept my copy of minibuffer.el, with the inserted cl-assert's,
up-to-date wrt minibuffer.el changes.  I'll keep watching *Messages*.

Unfortunately, although I've pretty much sprinkled cl-assert's
everywhere, I still see the error with no cl-assert message.  Here,
for example, an extract of *Messages* from today:

...

Refining difference region 22 ...
Saving old diff region #22 of buffer A.  To recover, type `ra' [2 times]
Only white-space differences in region 22 
Quit this Ediff session? (y or n)  y
Saving file d:/path/to/stefan-minibuffer.el...
Wrote d:/path/to/stefan-minibuffer.el
byte-code: Beginning of buffer
Quit
Undo! [2 times]
Error in post-command-hook (icomplete-post-command-hook): (wrong-type-argument stringp yes)
Sending...
Sending via mail...
Sending...done
Back to top level.
Mark set
Auto-saving...done
Mark set [2 times]

...





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
  2014-02-10 20:55                   ` Drew Adams
@ 2014-02-20  5:09                     ` Drew Adams
  2014-07-19 21:51                       ` Drew Adams
  0 siblings, 1 reply; 25+ messages in thread
From: Drew Adams @ 2014-02-20  5:09 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 16274

> > Drew, any news on this bug?

An update, but I'm not sure whether it is the exact same problem I
have seen before.  After changing some of my code recently, and doing
something different, I can now get such an assertion violation.
If I turn off icomplete-mode then the problem goes away.

The assertion violation occurs in `completion--nth-completion', after
(when (completion-metadata-get metadata 'completion--unquote-requote).

I inserted this debug code just after that arg to `when':

(message "N: %S, STRING: %S, TABLE: %S, PRED: %S, POINT: %S, METADATA: %S"
         n string table pred point metadata)
(cl-assert (functionp table) nil
           "=================== INVALID FUNCTION ==================")

This is what I see in *Messages* (I've added some newlines for the mail):

N: 2, STRING: "ls", TABLE: read-file-name-internal, PRED: file-exists-p,
POINT: 2, METADATA: (metadata (category . file) (completion--unquote-requote . t))

N: 1, STRING: "ls", TABLE: (#("ls-lisp+.el" 0 1 (face completions-common-part)
 1 2 (face completions-common-part) 2 3 (face (completions-first-difference)))
 #("ls-lisp-20.el" 0 1 (face completions-common-part) 1 2
 (face completions-common-part) 2 3 (face (completions-first-difference)))),
 PRED: nil, POINT: 2, METADATA: (metadata (category . file)
 (completion--unquote-requote . t))
Error in post-command-hook (icomplete-post-command-hook):
 (error "=================== INVALID FUNCTION ==================")

There are two calls to `completion--nth-completion' here, of which the
first (which I guess corresponds to `completion-all-completions') goes OK.
For the second (which I guess corresponds to `completion-try-completion'),
arg TABLE is a list of (propertized) strings, not a function.

I do not understand this code very well.  Hope this sheds some light for you.

I doubt if describing what I was doing at the time will help, but here
it is, just in case:

With my code (Icicles), I use a different kind of completion for `!'
in Dired (e.g.).  It is file-name completion (against program files in
the path etc.), but the minibuffer history in this case is
`shell-command-history'.  I hit `!' on a file in Dired, then hit `M-p'
to access the first item of the history, which was `ls' (which matches
a couple of file names).  It was when I hit `M-p' that I got the assertion
violation.

The same thing happened using my icomplete+.el and using vanilla
icomplete.el.

With a little more debug I determined that it is the second call to
`completion-try-completion' that causes the problem: the one that
is used when BASE-SIZE is not > 0.  In this case, BASE-SIZE = 0, so
this code is executed:

;; If the `comps' are 0-based, the result should be the same with `comps'.
(completion-try-completion name comps nil (length name) md)))

The problem is apparently that COMPS is a list of strings (file names),
not a function.

HTH.  Let me know if you have further debugging suggestions or need
more info.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
  2014-02-20  5:09                     ` Drew Adams
@ 2014-07-19 21:51                       ` Drew Adams
  2015-12-26  3:40                         ` Drew Adams
  0 siblings, 1 reply; 25+ messages in thread
From: Drew Adams @ 2014-07-19 21:51 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 16274

FWIW, just got the error again, in this version:

In GNU Emacs 24.4.50.1 (i686-pc-mingw32)
 of 2014-06-28 on ODIEONE
Bzr revision: 117431 rgm@gnu.org-20140628015517-eku6hj8mpgcvfnso
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/Devel/emacs/snapshot/trunk
 --enable-checking=yes,glyphs 'CFLAGS=-O0 -g3'
 LDFLAGS=-Lc:/Devel/emacs/lib 'CPPFLAGS=-DGC_MCHECK=1
 -Ic:/Devel/emacs/include''

Error in post-command-hook (icomplete-post-command-hook): (cl-assertion-failed (functionp table))





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#16274: ; One method to produce an error in icomplete-post-command-hook
  2013-12-28  5:52 bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...)) Drew Adams
  2014-01-03  4:23 ` Stefan Monnier
@ 2015-01-30 14:25 ` Jeremy Moore
  2015-08-11 19:02 ` bug#16274: Can still reproduce in Emacs 24.5.2/x86_64-unknown-linux-gnu Michael Hoffman
  2 siblings, 0 replies; 25+ messages in thread
From: Jeremy Moore @ 2015-01-30 14:25 UTC (permalink / raw)
  To: 16274

[-- Attachment #1: Type: text/plain, Size: 3494 bytes --]

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'

Important settings:
  value of $LANG: ENG
  locale-coding-system: cp1252

Major mode: Lisp Interaction

Minor modes in effect:
  icomplete-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x i c o m p l e t e SPC m o d e <return> M-x s e
t SPC v a r <return> i c o m p l e t e SPC s h o w
<return> t <return> C-x C-f C-a C-k C-g M-x r e p o
t <backspace> r t <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Icomplete mode enabled
Error in post-command-hook (icomplete-post-command-hook): (invalid-function
(#("./" 0 1 (face (completions-first-difference))) #("../" 0 1 (face
(completions-first-difference))) #("addpm.exe" 0 1 (face
(completions-first-difference))) #("ctags.exe" 0 1 (face
(completions-first-difference))) #("emacs.exe" 0 1 (face
(completions-first-difference))) #("etags.exe" 0 1 (face
(completions-first-difference))) #("libXpm.dll" 0 1 (face
(completions-first-difference))) #("ebrowse.exe" 0 1 (face
(completions-first-difference))) #("runemacs.exe" 0 1 (face
(completions-first-difference))) #("emacs-24.4.exe" 0 1 (face
(completions-first-difference))) #("grep-changelog" 0 1 (face
(completions-first-difference))) #("runvanilla.lnk" 0 1 (face
(completions-first-difference))) #("emacsclient.exe" 0 1 (face
(completions-first-difference))) #("emacsclientw.exe" 0 1 (face
(completions-first-difference)))))
Quit

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils cus-edit easymenu wid-edit cl-loaddefs cl-lib
help-fns mule-util cus-start cus-load icomplete time-date tooltip
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel dos-w32
ls-lisp w32-common-fns disp-table w32-win w32-vars tool-bar dnd fontset
image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode
register page menu-bar rfn-eshadow timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
w32notify w32 multi-tty emacs)

Memory information:
((conses 8 94199 5225)
 (symbols 32 19208 0)
 (miscs 32 36 138)
 (strings 16 14989 3911)
 (string-bytes 1 391743)
 (vectors 8 10790)
 (vector-slots 4 394081 3824)
 (floats 8 65 84)
 (intervals 28 212 41)
 (buffers 508 11))

[-- Attachment #2: Type: text/html, Size: 4096 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#16274: Can still reproduce in Emacs 24.5.2/x86_64-unknown-linux-gnu
  2013-12-28  5:52 bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...)) Drew Adams
  2014-01-03  4:23 ` Stefan Monnier
  2015-01-30 14:25 ` bug#16274: ; One method to produce an error in icomplete-post-command-hook Jeremy Moore
@ 2015-08-11 19:02 ` Michael Hoffman
  2 siblings, 0 replies; 25+ messages in thread
From: Michael Hoffman @ 2015-08-11 19:02 UTC (permalink / raw)
  To: 16274

I can reproduce this with Emacs 24.5.2 on Linux using the instructions found in <http://lists.gnu.org/archive/html/bug-gnu-emacs/2015-01/msg00995.html>. Specifically:

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

I have now set `icomplete-show-matches-on-no-input` to `nil` and have not triggered the bug again.

In GNU Emacs 24.5.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.8.8)
 of 2015-07-29 on mhoffman2.uhnres.utoronto.ca
Windowing system distributor `The X.Org Foundation', version 11.0.11500000
System Description:	CentOS Linux release 7.1.1503 (Core) 

Configured using:
 `configure --prefix=/users/mhoffman
 --exec-prefix=/users/mhoffman/arch/Linux-x86_64 'CFLAGS=-O2
 -march=native -pipe -fomit-frame-pointer' LDFLAGS=-Wl,-O1'

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  icomplete-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Icomplete mode enabled
Error in post-command-hook (icomplete-post-command-hook): (invalid-function (#("./" 0 1 (face (completions-first-difference))) #("../" 0 1 (face (completions-first-difference)))))
Quit

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils cus-edit easymenu wid-edit cl-loaddefs cl-lib
help-fns mule-util cus-start cus-load icomplete time-date tooltip
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
lisp-mode prog-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind gfilenotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 90594 3758)
 (symbols 48 19313 0)
 (miscs 40 36 124)
 (strings 32 13452 4435)
 (string-bytes 1 370253)
 (vectors 16 10101)
 (vector-slots 8 392565 9391)
 (floats 8 71 91)
 (intervals 56 176 1)
 (buffers 960 11)
 (heap 1024 20881 916))





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
  2014-07-19 21:51                       ` Drew Adams
@ 2015-12-26  3:40                         ` Drew Adams
  2017-02-03 15:49                           ` Drew Adams
  0 siblings, 1 reply; 25+ messages in thread
From: Drew Adams @ 2015-12-26  3:40 UTC (permalink / raw)
  To: 16274

> FWIW, just got the error again, in this version:
> 
> In GNU Emacs 24.4.50.1 (i686-pc-mingw32)
>  of 2014-06-28 on ODIEONE
> ...
> 
> Error in post-command-hook (icomplete-post-command-hook):
> (cl-assertion-failed (functionp table))

FYI, I still get this error fairly often, in Emacs 25 builds.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
  2015-12-26  3:40                         ` Drew Adams
@ 2017-02-03 15:49                           ` Drew Adams
  0 siblings, 0 replies; 25+ messages in thread
From: Drew Adams @ 2017-02-03 15:49 UTC (permalink / raw)
  To: 16274

Now that this bug reported 4 years ago has been confirmed by someone else, perhaps it can be fixed?  Thx.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
  2014-01-04  4:51         ` Stefan Monnier
  2014-01-04  7:03           ` Drew Adams
@ 2017-10-22 15:06           ` Charles A. Roelli
  2017-11-01 20:02             ` Charles A. Roelli
  1 sibling, 1 reply; 25+ messages in thread
From: Charles A. Roelli @ 2017-10-22 15:06 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 16274

> From: Stefan Monnier <monnier@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@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'





^ permalink raw reply related	[flat|nested] 25+ messages in thread

* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
  2017-10-22 15:06           ` Charles A. Roelli
@ 2017-11-01 20:02             ` Charles A. Roelli
  2017-11-04  8:56               ` Eli Zaretskii
  0 siblings, 1 reply; 25+ messages in thread
From: Charles A. Roelli @ 2017-11-01 20:02 UTC (permalink / raw)
  To: Charles A. Roelli; +Cc: 16274, monnier

Ping!  I hope to fix this for emacs-26 if it's possible.  It also
solves Bug#28898.

> Date: Sun, 22 Oct 2017 17:06:35 +0200
> From: charles@aurox.ch (Charles A. Roelli)
> 
> > From: Stefan Monnier <monnier@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@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'





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
  2017-11-01 20:02             ` Charles A. Roelli
@ 2017-11-04  8:56               ` Eli Zaretskii
  2017-11-07  4:06                 ` Stefan Monnier
  0 siblings, 1 reply; 25+ messages in thread
From: Eli Zaretskii @ 2017-11-04  8:56 UTC (permalink / raw)
  To: Charles A. Roelli; +Cc: 16274, monnier

> Date: Wed, 01 Nov 2017 21:02:00 +0100
> From: charles@aurox.ch (Charles A. Roelli)
> Cc: 16274@debbugs.gnu.org, monnier@iro.umontreal.ca
> 
> Ping!  I hope to fix this for emacs-26 if it's possible.  It also
> solves Bug#28898.

Stefan, any objections for pushing this to the emacs-26 branch?





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
  2017-11-04  8:56               ` Eli Zaretskii
@ 2017-11-07  4:06                 ` Stefan Monnier
  2017-11-11 10:09                   ` Eli Zaretskii
  0 siblings, 1 reply; 25+ messages in thread
From: Stefan Monnier @ 2017-11-07  4:06 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 16274, Charles A. Roelli

>> Ping!  I hope to fix this for emacs-26 if it's possible.  It also
>> solves Bug#28898.
> Stefan, any objections for pushing this to the emacs-26 branch?

Yes, using nil instead of `md` has other undesirable side-effects.
E.g. it loses the `category` metadata so it will cause the wrong
completion-styles to be used e.g. in C-x b.

Does the patch below work around the problem?

BTW, thanks Charles for the recipe,


        Stefan


diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index f13f1fa798..54a6afeca9 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -896,8 +896,15 @@ completion--nth-completion
   ;; than from completion-extra-properties) because it may apply only to some
   ;; part of the string (e.g. substitute-in-file-name).
   (let ((requote
-         (when (completion-metadata-get metadata 'completion--unquote-requote)
-           (cl-assert (functionp table))
+         (when (and
+                (completion-metadata-get metadata 'completion--unquote-requote)
+                ;; Sometimes a table's metadata is used on another
+                ;; table (typically that other table is just a list taken
+                ;; from the output of `all-completions' or something equivalent,
+                ;; for progressive refinement).
+                ;; FIXME: Rather than do nothing, we should somehow call
+                ;; the original table, in that case!
+                (functionp table))
            (let ((new (funcall table string point 'completion--unquote)))
              (setq string (pop new))
              (setq table (pop new))







^ permalink raw reply related	[flat|nested] 25+ messages in thread

* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
  2017-11-07  4:06                 ` Stefan Monnier
@ 2017-11-11 10:09                   ` Eli Zaretskii
  2017-11-11 10:31                     ` Charles A. Roelli
  0 siblings, 1 reply; 25+ messages in thread
From: Eli Zaretskii @ 2017-11-11 10:09 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 16274, charles

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: charles@aurox.ch (Charles A. Roelli),  16274@debbugs.gnu.org
> Date: Mon, 06 Nov 2017 23:06:26 -0500
> 
> >> Ping!  I hope to fix this for emacs-26 if it's possible.  It also
> >> solves Bug#28898.
> > Stefan, any objections for pushing this to the emacs-26 branch?
> 
> Yes, using nil instead of `md` has other undesirable side-effects.
> E.g. it loses the `category` metadata so it will cause the wrong
> completion-styles to be used e.g. in C-x b.
> 
> Does the patch below work around the problem?

Ping!  Charles, any comments?





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
  2017-11-11 10:09                   ` Eli Zaretskii
@ 2017-11-11 10:31                     ` Charles A. Roelli
  2017-11-11 10:41                       ` Eli Zaretskii
  0 siblings, 1 reply; 25+ messages in thread
From: Charles A. Roelli @ 2017-11-11 10:31 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 16274, monnier

> Date: Sat, 11 Nov 2017 12:09:00 +0200
> From: Eli Zaretskii <eliz@gnu.org>
>
> > From: Stefan Monnier <monnier@iro.umontreal.ca>
> > Cc: charles@aurox.ch (Charles A. Roelli),  16274@debbugs.gnu.org
> > Date: Mon, 06 Nov 2017 23:06:26 -0500
> > 
> > >> Ping!  I hope to fix this for emacs-26 if it's possible.  It also
> > >> solves Bug#28898.
> > > Stefan, any objections for pushing this to the emacs-26 branch?
> > 
> > Yes, using nil instead of `md` has other undesirable side-effects.
> > E.g. it loses the `category` metadata so it will cause the wrong
> > completion-styles to be used e.g. in C-x b.
> > 
> > Does the patch below work around the problem?
> 
> Ping!  Charles, any comments?

All good.  Thanks to both of you for looking into this.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
  2017-11-11 10:31                     ` Charles A. Roelli
@ 2017-11-11 10:41                       ` Eli Zaretskii
  2017-11-11 15:25                         ` Stefan Monnier
  0 siblings, 1 reply; 25+ messages in thread
From: Eli Zaretskii @ 2017-11-11 10:41 UTC (permalink / raw)
  To: Charles A. Roelli; +Cc: 16274, monnier

> Date: Sat, 11 Nov 2017 11:31:45 +0100
> From: charles@aurox.ch (Charles A. Roelli)
> CC: monnier@iro.umontreal.ca, 16274@debbugs.gnu.org
> 
> > Date: Sat, 11 Nov 2017 12:09:00 +0200
> > From: Eli Zaretskii <eliz@gnu.org>
> >
> > > From: Stefan Monnier <monnier@iro.umontreal.ca>
> > > Cc: charles@aurox.ch (Charles A. Roelli),  16274@debbugs.gnu.org
> > > Date: Mon, 06 Nov 2017 23:06:26 -0500
> > > 
> > > >> Ping!  I hope to fix this for emacs-26 if it's possible.  It also
> > > >> solves Bug#28898.
> > > > Stefan, any objections for pushing this to the emacs-26 branch?
> > > 
> > > Yes, using nil instead of `md` has other undesirable side-effects.
> > > E.g. it loses the `category` metadata so it will cause the wrong
> > > completion-styles to be used e.g. in C-x b.
> > > 
> > > Does the patch below work around the problem?
> > 
> > Ping!  Charles, any comments?
> 
> All good.  Thanks to both of you for looking into this.

Thanks.  Stefan, please install your changes and close the bug.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...))
  2017-11-11 10:41                       ` Eli Zaretskii
@ 2017-11-11 15:25                         ` Stefan Monnier
  0 siblings, 0 replies; 25+ messages in thread
From: Stefan Monnier @ 2017-11-11 15:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Charles A. Roelli, 16274-done

>> All good.  Thanks to both of you for looking into this.

Thanks, installed,


        Stefan





^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2017-11-11 15:25 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-28  5:52 bug#16274: 24.3.50; Error in post-command-hook (icomplete-post-command-hook): (invalid-function ("..." ...)) Drew Adams
2014-01-03  4:23 ` Stefan Monnier
2014-01-03 16:20   ` Drew Adams
2014-01-03 22:14     ` Stefan Monnier
2014-01-03 22:52       ` Drew Adams
2014-01-04  4:51         ` Stefan Monnier
2014-01-04  7:03           ` Drew Adams
2014-01-04 15:45             ` Drew Adams
2014-02-10  3:53               ` Lars Ingebrigtsen
2014-02-10 16:34                 ` Stefan Monnier
2014-02-10 20:55                   ` Drew Adams
2014-02-20  5:09                     ` Drew Adams
2014-07-19 21:51                       ` Drew Adams
2015-12-26  3:40                         ` Drew Adams
2017-02-03 15:49                           ` Drew Adams
2017-10-22 15:06           ` Charles A. Roelli
2017-11-01 20:02             ` Charles A. Roelli
2017-11-04  8:56               ` Eli Zaretskii
2017-11-07  4:06                 ` Stefan Monnier
2017-11-11 10:09                   ` Eli Zaretskii
2017-11-11 10:31                     ` Charles A. Roelli
2017-11-11 10:41                       ` Eli Zaretskii
2017-11-11 15:25                         ` Stefan Monnier
2015-01-30 14:25 ` bug#16274: ; One method to produce an error in icomplete-post-command-hook Jeremy Moore
2015-08-11 19:02 ` bug#16274: Can still reproduce in Emacs 24.5.2/x86_64-unknown-linux-gnu Michael Hoffman

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.