[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#12029: 24.1; cc-imenu-objc-function generates invalid imenu alist
From: |
Leo |
Subject: |
bug#12029: 24.1; cc-imenu-objc-function generates invalid imenu alist |
Date: |
Mon, 23 Jul 2012 13:40:46 +0800 |
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
Description: t.m
- bug#12029: 24.1; cc-imenu-objc-function generates invalid imenu alist,
Leo <=