bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#11142: 24.0.94; objc-mode fails for imenu and which-function-mode


From: Alan Mackenzie
Subject: bug#11142: 24.0.94; objc-mode fails for imenu and which-function-mode
Date: Fri, 6 Apr 2012 17:11:54 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

Hi, Leo.

On Thu, Apr 05, 2012 at 07:18:59PM +0800, Leo wrote:
> On 2012-04-05 00:18 +0800, Stefan Monnier wrote:
> > That's partly normal: objc-mode is not in `which-func-modes'.
> > But if you add `objc-mode' to which-func-modes, indeed the function name
> > still doesn't show up in the mode-line (whereas it did in Emacs-23, so
> > this is a regression).

> >> Also, M-x imenu-add-menubar-index says: Error in
> >> menu-bar-update-hook (imenu-update-menubar): (wrong-type-argument
> >> integerp nil)

> > I can indeed reproduce it (I used the src/nsfont.m file as sample ObjC 
> > file).

> > Hopefully Alan can figure it out

> It seems the bug was brought in by commit

> ------------------------------------------------------------
> revno: 105590
> committer: Alan Mackenzie <acm@muc.de>
> branch nick: trunk
> timestamp: Sat 2011-08-27 08:41:23 +0000
> message:
>   progmodes/cc-menus.el (cc-imenu-c++-generic-expression): Make it handle
>   function pointer parameters properly.

> which increases the number of grouped matches by 1 and the sad fact that
> cc-imenu-objc-generic-expression-*-index dependent on that.

Brilliant diagnosis, absolutely right!  Thanks.  There're some pretty
non-standard coding techniques in that file.  ;-)

Here's the final bit of the fix; please try it out if you haven't done
already, and let me know whether it works fully.

> BTW, the warning

> ,----
> | ;;                        *Warning for cc-mode developers*
> | ;;
> | ;; `cc-imenu-objc-generic-expression' elements depend on
> | ....
> `----

> should be placed in front of cc-imenu-c++-generic-expression to be of
> any use.

Yes indeed.

> Leo


diff -r 4b03c7ef6cf2 cc-menus.el
--- a/cc-menus.el       Tue Apr 03 20:57:45 2012 +0000
+++ b/cc-menus.el       Fri Apr 06 17:03:33 2012 +0000
@@ -223,7 +223,7 @@
    "\\|"
    ;; > General function name regexp
    ;; Pick a token by  (match-string 3)
-   (car (cdr (nth 2 cc-imenu-c++-generic-expression))) ; -> index += 5
+   (car (cdr (nth 2 cc-imenu-c++-generic-expression))) ; -> index += 6
    (prog2 (setq cc-imenu-objc-generic-expression-general-func-index 3) "")
    ;; > Special case for definitions using phony prototype macros like:
    ;; > `int main _PROTO( (int argc,char *argv[]) )'.
@@ -232,11 +232,11 @@
        (concat
        "\\|"
        (car (cdr (nth 3 cc-imenu-c++-generic-expression))) ; -> index += 1
-       (prog2 (setq cc-imenu-objc-generic-expression-objc-base-index 9) "")
+       (prog2 (setq cc-imenu-objc-generic-expression-objc-base-index 10) "")
        )
-     (prog2 (setq cc-imenu-objc-generic-expression-objc-base-index 8) "")
+     (prog2 (setq cc-imenu-objc-generic-expression-objc-base-index 9) "")
      "")                               ; -> index += 0
-   (prog2 (setq cc-imenu-objc-generic-expression-proto-index 8) "")
+   (prog2 (setq cc-imenu-objc-generic-expression-proto-index 9) "")
    ;;
    ;; For Objective-C
    ;; Pick a token by (match-string 8 or 9)


-- 
Alan Mackenzie (Nuremberg, Germany).





reply via email to

[Prev in Thread] Current Thread [Next in Thread]