all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andreas Politz <politza@fh-trier.de>
To: 14029@debbugs.gnu.org
Subject: bug#14029: 24.2.50; [PATCH] imenu problems with special elements
Date: Fri, 22 Mar 2013 02:24:33 +0100	[thread overview]
Message-ID: <87hak4gram.fsf@fh-trier.de> (raw)

,----[ (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





             reply	other threads:[~2013-03-22  1:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-22  1:24 Andreas Politz [this message]
2013-03-22  5:12 ` bug#14029: 24.2.50; [PATCH] imenu problems with special elements Drew Adams
     [not found]   ` <87ip4iwfoe.fsf@fh-trier.de>
2013-03-23 15:54     ` Andreas Politz
2013-03-23 16:15       ` Drew Adams
2013-11-24 23:53       ` Dmitry Gutov
2013-11-25  1:32         ` Andreas Politz
2013-11-25  1:40           ` Andreas Politz
2013-11-25  1:32         ` Andreas Politz
2013-11-29  3:43           ` Dmitry Gutov
2013-11-29 13:36             ` Andreas Politz
2013-11-29 14:35               ` Dmitry Gutov
2013-11-29 15:34               ` Drew Adams

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

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

  git send-email \
    --in-reply-to=87hak4gram.fsf@fh-trier.de \
    --to=politza@fh-trier.de \
    --cc=14029@debbugs.gnu.org \
    /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 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.