From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#11142: 24.0.94; objc-mode fails for imenu and which-function-mode Date: Fri, 6 Apr 2012 17:11:54 +0000 Message-ID: <20120406171154.GA3085@acm.acm> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1333732478 5259 80.91.229.3 (6 Apr 2012 17:14:38 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 6 Apr 2012 17:14:38 +0000 (UTC) Cc: 11142@debbugs.gnu.org To: Leo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Apr 06 19:14:34 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SGCk4-00059k-RB for geb-bug-gnu-emacs@m.gmane.org; Fri, 06 Apr 2012 19:14:33 +0200 Original-Received: from localhost ([::1]:47963 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SGCk3-0005kn-VZ for geb-bug-gnu-emacs@m.gmane.org; Fri, 06 Apr 2012 13:14:31 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:59837) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SGCk1-0005jx-08 for bug-gnu-emacs@gnu.org; Fri, 06 Apr 2012 13:14:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SGCjz-0005vl-1R for bug-gnu-emacs@gnu.org; Fri, 06 Apr 2012 13:14:28 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46274) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SGCju-0005nP-Ug; Fri, 06 Apr 2012 13:14:22 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SGCkY-0007XY-7K; Fri, 06 Apr 2012 13:15:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Fri, 06 Apr 2012 17:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11142 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 11142-submit@debbugs.gnu.org id=B11142.133373245128908 (code B ref 11142); Fri, 06 Apr 2012 17:15:02 +0000 Original-Received: (at 11142) by debbugs.gnu.org; 6 Apr 2012 17:14:11 +0000 Original-Received: from localhost ([127.0.0.1]:42812 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SGCji-0007WD-KP for submit@debbugs.gnu.org; Fri, 06 Apr 2012 13:14:10 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:42076 helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SGCjg-0007W3-Na for 11142@debbugs.gnu.org; Fri, 06 Apr 2012 13:14:10 -0400 Original-Received: (qmail 22801 invoked by uid 3782); 6 Apr 2012 17:13:26 -0000 Original-Received: from acm.muc.de (pD951A7BF.dip.t-dialin.net [217.81.167.191]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 06 Apr 2012 19:13:22 +0200 Original-Received: (qmail 3120 invoked by uid 1000); 6 Apr 2012 17:11:54 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:58565 Archived-At: 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 > 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).