Subject: Re: bug#14029: 24.2.50; [PATCH] imenu problems with special elements

From: Andreas Politz <[email-masked]>
Date: Fri, 29 Nov 2013 14:36:48 +0100

Dmitry Gutov <[email-masked]> writes:

> One note:
>
>>> Is it possible for (cadr item) to be a list and also be `functionp' and yet not
>>> have its car be `lambda'?
>
> The documentation allows FUNCTION in the third element, but
> imenu--subalist-p' is checking whether the second element is a
> function.

Yes, this doesn't make much sense.  I guess this function check was
intended to distinguish a special element

(INDEX-NAME POS FN . ARGS)

from a sub-alist element

(INDEX-NAME . SUB-ALIST).

The check would make sense, if this function was applied to the cdr of
an element, i.e. check if the argument is a SUB-ALIST.  But this is not
how this function is used in imenu.el .

I might have initially (and falsely) determined this as the source of
some bug.

-ap

P.S.: There is another dot missing in the documentation.

=== modified file 'lisp/imenu.el'
*** lisp/imenu.el	2013-11-29 03:38:20 +0000
--- lisp/imenu.el	2013-11-29 13:30:58 +0000
***************
*** 463,469 ****
  To \"go to\" a special element means applying FUNCTION
  to INDEX-NAME, POSITION, and the ARGUMENTS.
  
! A nested sub-alist element looks like (INDEX-NAME SUB-ALIST).
  The function `imenu--subalist-p' tests an element and returns t
  if it is a sub-alist.
  
--- 463,469 ----
  To \"go to\" a special element means applying FUNCTION
  to INDEX-NAME, POSITION, and the ARGUMENTS.
  
! A nested sub-alist element looks like (INDEX-NAME . SUB-ALIST).
  The function `imenu--subalist-p' tests an element and returns t
  if it is a sub-alist.