emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#14029: closed (24.2.50; [PATCH] imenu problems wit


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#14029: closed (24.2.50; [PATCH] imenu problems with special elements )
Date: Fri, 29 Nov 2013 03:45:02 +0000

Your message dated Fri, 29 Nov 2013 05:43:57 +0200
with message-id <address@hidden>
and subject line Re: bug#14029: 24.2.50; [PATCH] imenu problems with special 
elements
has caused the debbugs.gnu.org bug report #14029,
regarding 24.2.50; [PATCH] imenu problems with special elements 
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
14029: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14029
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 24.2.50; [PATCH] imenu problems with special elements Date: Fri, 22 Mar 2013 02:24:33 +0100
,----[ (info "(elisp) Imenu") ]
| Special elements look like this:
| 
|           (INDEX-NAME INDEX-POSITION FUNCTION ARGUMENTS...)
| 
|      Selecting a special element performs:
| 
|           (funcall FUNCTION
|                    INDEX-NAME INDEX-POSITION ARGUMENTS...)
`----

1. At least one function does not recognize these elements, resulting
in an error.

2. The advertised calling convention is different from the actual one in
`imenu'.

3. The `imenu--subalist-p' predicate is unsafe and incomplete.

Andreas

diff -c -L /home/politza/src/emacs/trunk/lisp/imenu.el -L \#\<buffer\ 
imenu.el\> /home/politza/src/emacs/trunk/lisp/imenu.el 
/tmp/buffer-content-3095O-q
*** /home/politza/src/emacs/trunk/lisp/imenu.el
--- #<buffer imenu.el>
***************
*** 286,293 ****
  
  
  (defun imenu--subalist-p (item)
!   (and (consp (cdr item)) (listp (cadr item))
!        (not (eq (car (cadr item)) 'lambda))))
  
  (defmacro imenu-progress-message (_prevpos &optional _relpos _reverse)
    "Macro to display a progress message.
--- 286,295 ----
  
  
  (defun imenu--subalist-p (item)
!   (and (consp item)
!        (consp (cdr item))
!        (listp (cadr item))
!        (not (functionp (cadr item)))))
  
  (defmacro imenu-progress-message (_prevpos &optional _relpos _reverse)
    "Macro to display a progress message.
***************
*** 641,647 ****
        ;; We are only interested in the bottom-level elements, so we need to
        ;; recurse if TAIL is a list.
        (cond ((listp tail)
!            (if (setq res (imenu--in-alist str tail))
                 (setq alist nil)))
            ((if imenu-name-lookup-function
                   (funcall imenu-name-lookup-function str head)
--- 643,650 ----
        ;; We are only interested in the bottom-level elements, so we need to
        ;; recurse if TAIL is a list.
        (cond ((listp tail)
!            (if (and (imenu--subalist-p elt)
!                       (setq res (imenu--in-alist str tail)))
                 (setq alist nil)))
            ((if imenu-name-lookup-function
                   (funcall imenu-name-lookup-function str head)
***************
*** 1024,1030 ****
                (nth 2 index-item) imenu-default-goto-function))
           (position (if is-special-item
                         (cadr index-item) (cdr index-item)))
!          (rest (if is-special-item (cddr index-item))))
        (apply function (car index-item) position rest))
      (run-hooks 'imenu-after-jump-hook)))
  
--- 1027,1033 ----
                (nth 2 index-item) imenu-default-goto-function))
           (position (if is-special-item
                         (cadr index-item) (cdr index-item)))
!          (rest (if is-special-item (cdddr index-item))))
        (apply function (car index-item) position rest))
      (run-hooks 'imenu-after-jump-hook)))
  

Diff finished.  Fri Mar 22 02:15:09 2013



--- End Message ---
--- Begin Message --- Subject: Re: bug#14029: 24.2.50; [PATCH] imenu problems with special elements Date: Fri, 29 Nov 2013 05:43:57 +0200 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1
Version: 24.4

Thanks, that's clearer. Installed in revision 115279.

One note:

>> Is it possible for (cadr item) to be a list and also be `functionp' and yet not >> have its car be `lambda'? Dunno. I was under the impression that it was >> impossible, but I could be wrong. If it is possible, is it better to test
>> `functionp' here?  Dunno.
>
> If the documentation states FUNCTION, then it should be a function.

The documentation allows FUNCTION in the third element, but `imenu--subalist-p' is checking whether the second element is a function.

AFAICT, it's checking against malformed items. Your change makes it also guard against lexically-bound lambdas (their car is `closure'), so that's good, I guess.


--- End Message ---

reply via email to

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