all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#12029: 24.1; cc-imenu-objc-function generates invalid imenu alist
@ 2012-07-23  5:40 Leo
  2012-07-29 13:29 ` Leo
  0 siblings, 1 reply; 2+ messages in thread
From: Leo @ 2012-07-23  5:40 UTC (permalink / raw)
  To: 12029; +Cc: bug-cc-mode

[-- Attachment #1: Type: text/plain, Size: 7232 bytes --]

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)



[-- Attachment #2: t.m --]
[-- Type: text/plain, Size: 592 bytes --]

@interface BarCodeViewController (Private)

- (void)initReaderView;

@end

@implementation BarCodeViewController

@synthesize readerView;

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex{
    if (buttonIndex!=0) {
        HandInputViewController *handInputViewController = [[HandInputViewController alloc] initWithNibName:@"HandInputViewController" bundle:nil];
        handInputViewController.delegate = self;
        [self presentModalViewController:handInputViewController animated:YES];
        [handInputViewController release];
    }
}

@end

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#12029: 24.1; cc-imenu-objc-function generates invalid imenu alist
  2012-07-23  5:40 bug#12029: 24.1; cc-imenu-objc-function generates invalid imenu alist Leo
@ 2012-07-29 13:29 ` Leo
  0 siblings, 0 replies; 2+ messages in thread
From: Leo @ 2012-07-29 13:29 UTC (permalink / raw)
  To: 12029-done

Fixed in emacs-24.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-29 13:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-23  5:40 bug#12029: 24.1; cc-imenu-objc-function generates invalid imenu alist Leo
2012-07-29 13:29 ` Leo

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.