unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Leo <sdl.web@gmail.com>
Cc: 11142@debbugs.gnu.org
Subject: bug#11142: 24.0.94; objc-mode fails for imenu and which-function-mode
Date: Wed, 04 Apr 2012 12:18:59 -0400	[thread overview]
Message-ID: <jwv7gxvpjb2.fsf-monnier+emacs__31037.9534880214$1333556616$gmane$org@gnu.org> (raw)
In-Reply-To: <m2mx6wkwmv.fsf@gmail.com> (Leo's message of "Sun, 01 Apr 2012 10:34:48 +0800")

> Turn on which-function-mode and open an objc file, it cannot show the
> function name.

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


        Stefan


The imenu error has the following backtrace:

Debugger entered--Lisp error: (wrong-type-argument integerp nil)
  match-beginning(nil)
  (funcall func (match-beginning langnum) (match-end langnum))
  (setq str (funcall func (match-beginning langnum) (match-end langnum)))
  (while (re-search-backward cc-imenu-objc-generic-expression nil t) (setq langnum (if (match-beginning OBJC) OBJC (cond ((match-beginning Cproto) Cproto) ((match-beginning Cgeneralfunc) Cgeneralfunc) ((match-beginning Cnoreturn) Cnoreturn)))) (setq str (funcall func (match-beginning langnum) (match-end langnum))) (cond ((not (eq langnum OBJC)) (setq clist (cons (cons str (match-beginning langnum)) clist))) ((eq (aref str 0) 45) (setq str (concat "-" (cc-imenu-objc-method-to-selector str))) (setq methodlist (cons (cons str (match-beginning langnum)) methodlist))) ((eq (aref str 0) 43) (setq str (concat "+" (cc-imenu-objc-method-to-selector str))) (setq methodlist (cons (cons str (match-beginning langnum)) methodlist))) ((eq (aref str 0) 64) (setq classcount (1+ classcount)) (cond ((and (> (length str) implen) (string= (substring str 0 implen) "@implementation")) (setq str (substring str implen) str2 "@implementation")) ((string= (substring str 0 intflen) "@interface") (setq str (substring str intflen) str2 "@interface")) ((string= (substring str 0 prtlen) "@protocol") (setq str (substring str prtlen) str2 "@protocol"))) (setq str (cc-imenu-objc-remove-white-space str)) (setq methodlist (cons (cons str2 (match-beginning langnum)) methodlist)) (setq toplist (cons nil (cons (cons str methodlist) toplist)) methodlist nil))))
  (let (methodlist clist (OBJC cc-imenu-objc-generic-expression-objc-base-index) (Cnoreturn cc-imenu-objc-generic-expression-noreturn-index) (Cgeneralfunc cc-imenu-objc-generic-expression-general-func-index) (Cproto cc-imenu-objc-generic-expression-proto-index) langnum (classcount 0) toplist str str2 (intflen (length "@interface")) (implen (length "@implementation")) (prtlen (length "@protocol")) (func (if (fboundp (quote buffer-substring-no-properties)) (quote buffer-substring-no-properties) (quote buffer-substring)))) (goto-char (point-max)) (while (re-search-backward cc-imenu-objc-generic-expression nil t) (setq langnum (if (match-beginning OBJC) OBJC (cond ((match-beginning Cproto) Cproto) ((match-beginning Cgeneralfunc) Cgeneralfunc) ((match-beginning Cnoreturn) Cnoreturn)))) (setq str (funcall func (match-beginning langnum) (match-end langnum))) (cond ((not (eq langnum OBJC)) (setq clist (cons (cons str (match-beginning langnum)) clist))) ((eq (aref str 0) 45) (setq str (concat "-" (cc-imenu-objc-method-to-selector str))) (setq methodlist (cons (cons str (match-beginning langnum)) methodlist))) ((eq (aref str 0) 43) (setq str (concat "+" (cc-imenu-objc-method-to-selector str))) (setq methodlist (cons (cons str (match-beginning langnum)) methodlist))) ((eq (aref str 0) 64) (setq classcount (1+ classcount)) (cond ((and (> ... implen) (string= ... "@implementation")) (setq str (substring str implen) str2 "@implementation")) ((string= (substring str 0 intflen) "@interface") (setq str (substring str intflen) str2 "@interface")) ((string= (substring str 0 prtlen) "@protocol") (setq str (substring str prtlen) str2 "@protocol"))) (setq str (cc-imenu-objc-remove-white-space str)) (setq methodlist (cons (cons str2 (match-beginning langnum)) methodlist)) (setq toplist (cons nil (cons (cons str methodlist) toplist)) methodlist nil)))) (if (eq (car toplist) nil) (setq toplist (cdr toplist))) (if (< classcount 2) (let ((classname (car (car toplist))) (p (cdr (car (cdr ...)))) last) (setq toplist (cons (cons classname p) (cdr (cdr (car toplist))))) (if clist (progn (setq last toplist) (while (cdr last) (setq last (cdr last))) (setcdr last clist)))) (if clist (setq toplist (cons (cons "C" clist) toplist)))) toplist)
  cc-imenu-objc-function()
  imenu--make-index-alist(t)
  imenu-update-menubar()
  eval((imenu-update-menubar) nil)
  eval-expression((imenu-update-menubar) nil)
  call-interactively(eval-expression nil nil)






  reply	other threads:[~2012-04-04 16:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-01  2:34 bug#11142: 24.0.94; objc-mode fails for imenu and which-function-mode Leo
2012-04-04 16:18 ` Stefan Monnier [this message]
2012-04-05 11:18   ` Leo
     [not found]   ` <m1wr5uifz0.fsf@gmail.com>
2012-04-06 17:11     ` Alan Mackenzie
2012-04-13  6:53       ` Chong Yidong
2012-04-11 18:15     ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='jwv7gxvpjb2.fsf-monnier+emacs__31037.9534880214$1333556616$gmane$org@gnu.org' \
    --to=monnier@iro.umontreal.ca \
    --cc=11142@debbugs.gnu.org \
    --cc=sdl.web@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).