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.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Leo <sdl.web <at> gmail.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#12029: closed (24.1; cc-imenu-objc-function generates invalid
 imenu alist)
Date: Sun, 29 Jul 2012 13:38:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sun, 29 Jul 2012 21:29:43 +0800
with message-id <m1sjca66go.fsf <at> gmail.com>
and subject line Re: bug#12029: 24.1; cc-imenu-objc-function generates invalid imenu alist
has caused the debbugs.gnu.org bug report #12029,
regarding 24.1; cc-imenu-objc-function generates invalid imenu alist
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
12029: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12029
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
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 3 (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)]
[Message part 5 (message/rfc822, inline)]
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.


This bug report was last modified 13 years and 17 days ago.

Previous Next


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