GNU bug report logs - #12029
24.1; cc-imenu-objc-function generates invalid imenu alist

Previous Next

Package: emacs;

Reported by: Leo <sdl.web <at> gmail.com>

Date: Mon, 23 Jul 2012 05:48:01 UTC

Severity: normal

Found in version 24.1

Done: Leo <sdl.web <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12029 in the body.
You can then email your comments to 12029 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-cc-mode <at> gnu.org, bug-gnu-emacs <at> gnu.org:
bug#12029; Package emacs. (Mon, 23 Jul 2012 05:48:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo <sdl.web <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-cc-mode <at> gnu.org, bug-gnu-emacs <at> gnu.org. (Mon, 23 Jul 2012 05:48:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.1; cc-imenu-objc-function generates invalid imenu alist
Date: Mon, 23 Jul 2012 13:40:46 +0800
[Message part 1 (text/plain, inline)]
1. Open the attached file t.m
2. Move point to be on @interface
3. M-x imenu

,----[ Backtrace ]
| Debugger entered--Lisp error: (wrong-type-argument stringp nil)
|   string-match("\\`@interface\\'" nil)
|   (if (string-match re (car x)) (throw (quote found) (car x)))
|   (while --cl-dolist-temp-- (setq x (car --cl-dolist-temp--)) (if (string-match re (car x)) (throw (quote found) (car x))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--)))
|   (let ((--cl-dolist-temp-- completions) x) (while --cl-dolist-temp-- (setq x (car --cl-dolist-temp--)) (if (string-match re (car x)) (throw (quote found) (car x))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--))))
|   (catch (quote --cl-block-nil--) (let ((--cl-dolist-temp-- completions) x) (while --cl-dolist-temp-- (setq x (car --cl-dolist-temp--)) (if (string-match re (car x)) (throw (quote found) (car x))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--)))))
|   (cl-block-wrapper (catch (quote --cl-block-nil--) (let ((--cl-dolist-temp-- completions) x) (while --cl-dolist-temp-- (setq x (car --cl-dolist-temp--)) (if (string-match re (car x)) (throw (quote found) (car x))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--))))))
|   (block nil (let ((--cl-dolist-temp-- completions) x) (while --cl-dolist-temp-- (setq x (car --cl-dolist-temp--)) (if (string-match re (car x)) (throw (quote found) (car x))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--)))))
|   (dolist (x completions) (if (string-match re (car x)) (throw (quote found) (car x))))
|   (while --cl-dolist-temp-- (setq re (car --cl-dolist-temp--)) (dolist (x completions) (if (string-match re (car x)) (throw (quote found) (car x)))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--)))
|   (let ((--cl-dolist-temp-- (list (concat "\\`" (regexp-quote guess) "\\'") (concat "\\`" (regexp-quote guess)) (concat (regexp-quote guess) "\\'") (regexp-quote guess))) re) (while --cl-dolist-temp-- (setq re (car --cl-dolist-temp--)) (dolist (x completions) (if (string-match re (car x)) (throw (quote found) (car x)))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--))))
|   (catch (quote --cl-block-nil--) (let ((--cl-dolist-temp-- (list (concat "\\`" (regexp-quote guess) "\\'") (concat "\\`" (regexp-quote guess)) (concat (regexp-quote guess) "\\'") (regexp-quote guess))) re) (while --cl-dolist-temp-- (setq re (car --cl-dolist-temp--)) (dolist (x completions) (if (string-match re (car x)) (throw (quote found) (car x)))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--)))))
|   (cl-block-wrapper (catch (quote --cl-block-nil--) (let ((--cl-dolist-temp-- (list (concat "\\`" (regexp-quote guess) "\\'") (concat "\\`" (regexp-quote guess)) (concat (regexp-quote guess) "\\'") (regexp-quote guess))) re) (while --cl-dolist-temp-- (setq re (car --cl-dolist-temp--)) (dolist (x completions) (if (string-match re (car x)) (throw (quote found) (car x)))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--))))))
|   (block nil (let ((--cl-dolist-temp-- (list (concat "\\`" (regexp-quote guess) "\\'") (concat "\\`" (regexp-quote guess)) (concat (regexp-quote guess) "\\'") (regexp-quote guess))) re) (while --cl-dolist-temp-- (setq re (car --cl-dolist-temp--)) (dolist (x completions) (if (string-match re (car x)) (throw (quote found) (car x)))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--)))))
|   (dolist (re (list (concat "\\`" (regexp-quote guess) "\\'") (concat "\\`" (regexp-quote guess)) (concat (regexp-quote guess) "\\'") (regexp-quote guess))) (dolist (x completions) (if (string-match re (car x)) (throw (quote found) (car x)))))
|   (if (assoc guess completions) guess (dolist (re (list (concat "\\`" (regexp-quote guess) "\\'") (concat "\\`" (regexp-quote guess)) (concat (regexp-quote guess) "\\'") (regexp-quote guess))) (dolist (x completions) (if (string-match re (car x)) (throw (quote found) (car x))))))
|   (let ((case-fold-search t)) (if (assoc guess completions) guess (dolist (re (list (concat "\\`" (regexp-quote guess) "\\'") (concat "\\`" (regexp-quote guess)) (concat (regexp-quote guess) "\\'") (regexp-quote guess))) (dolist (x completions) (if (string-match re (car x)) (throw (quote found) (car x)))))))
|   (catch (quote found) (let ((case-fold-search t)) (if (assoc guess completions) guess (dolist (re (list (concat "\\`" (regexp-quote guess) "\\'") (concat "\\`" (regexp-quote guess)) (concat (regexp-quote guess) "\\'") (regexp-quote guess))) (dolist (x completions) (if (string-match re (car x)) (throw (quote found) (car x))))))))
|   imenu-find-default(#("@interface" 0 10 (fontified t face font-lock-keyword-face)) (("*Rescan*" . -99) ("BarCodeViewController(Private)" ("@interface" . 1) ("-initReaderView" . 45)) (nil) ("BarCodeViewController" ("@implementation" . 76) ("-alertView:didDismissWithButtonIndex:" . 140))))
|   imenu--completion-buffer((("*Rescan*" . -99) ("BarCodeViewController(Private)" ("@interface" . 1) ("-initReaderView" . 45)) nil ("BarCodeViewController" ("@implementation" . 76) ("-alertView:didDismissWithButtonIndex:" . 140))) nil)
|   imenu-choose-buffer-index()
|   (list (imenu-choose-buffer-index))
|   call-interactively(imenu t nil)
|   execute-extended-command(nil)
|   call-interactively(execute-extended-command nil nil)
`----

This is due to cc-imenu-objc-function generates invalid imenu alist:

,----[ C-h v imenu--index-alist RET ]
| imenu--index-alist is a variable defined in `imenu.el'.
| Its value is nil
| 
|   Automatically becomes buffer-local when set in any fashion.
|   This variable is potentially risky when used as a file local variable.
| 
| Documentation:
| The buffer index alist computed for this buffer in Imenu.
| 
| Simple elements in the alist look like (INDEX-NAME . POSITION).
| POSITION is the buffer position of the item; to go to the item
| is simply to move point to that position.
| 
| Special elements look like (INDEX-NAME POSITION FUNCTION ARGUMENTS...).
| 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.
| 
| There is one simple element with negative POSITION; selecting that
| element recalculates the buffer's index alist.
| 
| [back]
`----

The following patch fixes this bug:

 lisp/progmodes/cc-menus.el |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

	Modified lisp/progmodes/cc-menus.el
diff --git a/lisp/progmodes/cc-menus.el b/lisp/progmodes/cc-menus.el
index a53d65f6..76e3002a 100644
--- a/lisp/progmodes/cc-menus.el
+++ b/lisp/progmodes/cc-menus.el
@@ -399,14 +399,10 @@ (defun cc-imenu-objc-function ()
 		str2 "@protocol")))
 	(setq str (cc-imenu-objc-remove-white-space str))
 	(setq methodlist (cons (cons str2
-			      (match-beginning langnum))
+				     (match-beginning langnum))
 			       methodlist))
-	(setq toplist (cons nil (cons (cons str
-					  methodlist) toplist))
+	(setq toplist (cons (cons str methodlist) toplist)
 	      methodlist nil))))
-    ;;
-    (if (eq (car toplist) nil)
-	(setq toplist (cdr toplist)))
 
     ;; In this buffer, there is only one or zero @{interface|implementation|protocol}.
     (if (< classcount 2)


[t.m (text/plain, attachment)]

Reply sent to Leo <sdl.web <at> gmail.com>:
You have taken responsibility. (Sun, 29 Jul 2012 13:38:02 GMT) Full text and rfc822 format available.

Notification sent to Leo <sdl.web <at> gmail.com>:
bug acknowledged by developer. (Sun, 29 Jul 2012 13:38:02 GMT) Full text and rfc822 format available.

Message #10 received at 12029-done <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: 12029-done <at> debbugs.gnu.org
Subject: Re: bug#12029: 24.1;
	cc-imenu-objc-function generates invalid imenu alist
Date: Sun, 29 Jul 2012 21:29:43 +0800
Fixed in emacs-24.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 27 Aug 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 265 days ago.

Previous Next


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