From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.devel Subject: Re: which-function => DEFUN? Date: Mon, 10 May 2010 16:22:30 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: dough.gmane.org 1273501514 1789 80.91.229.12 (10 May 2010 14:25:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 10 May 2010 14:25:14 +0000 (UTC) Cc: Emacs-Devel devel To: Lennart Borgman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 10 16:25:13 2010 connect(): No such file or directory Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OBTux-0007qM-CT for ged-emacs-devel@m.gmane.org; Mon, 10 May 2010 16:25:11 +0200 Original-Received: from localhost ([127.0.0.1]:36603 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OBTuw-00053J-Qb for ged-emacs-devel@m.gmane.org; Mon, 10 May 2010 10:25:10 -0400 Original-Received: from [140.186.70.92] (port=40515 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OBTt7-0003uw-Cu for emacs-devel@gnu.org; Mon, 10 May 2010 10:23:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OBTsi-0003nS-Qz for emacs-devel@gnu.org; Mon, 10 May 2010 10:23:16 -0400 Original-Received: from mail-bw0-f212.google.com ([209.85.218.212]:46514) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OBTsi-0003mw-M1 for emacs-devel@gnu.org; Mon, 10 May 2010 10:22:52 -0400 Original-Received: by bwz4 with SMTP id 4so1876518bwz.26 for ; Mon, 10 May 2010 07:22:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=Vyz8n+zjz1GG0LsXNtdTZ9RqKmGhXnrcgIHJwZ7cDYA=; b=TohKy4LEeNJ7W7KOAlxudtfoBOs8bcoPIRWur/p8wkAaKDOyp7wDg5l2pO163aE4jv yc2DfDJ3/rI//lt7IMBj5fDIEqoUIeIO2+BQ+lvTuZ1DUH3zjNuYtZvsEGQvUfzDEyKA W7DDfLihaRpZ87GEYMZUSL3ytn5Js88YRFfWA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=s5BdzFFNpJ5832cp37pwopp4IRVhJPGQzwdjkrhoy7q4H8wz+EowaXPHcaRhzl84Mp 9wYJxZT4nbK0aGsFDA6qaWv0lsCTE0wPYxEO3R0jhptNDUXIgVwx7IJhm1UDzMWpKgqT n937FS3sIMUMr0NistnJvW8tyj0w11fHzeLMs= Original-Received: by 10.204.48.20 with SMTP id p20mr2494214bkf.56.1273501370244; Mon, 10 May 2010 07:22:50 -0700 (PDT) Original-Received: by 10.204.84.81 with HTTP; Mon, 10 May 2010 07:22:30 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:124660 Archived-At: On Mon, May 10, 2010 at 15:58, Lennart Borgman wrote: > It is a bit annoying to see DEFUN as the function shown by which-function-mode. > > I am sure someone here has written an > imenu-extract-index-name-function for use in Emacs C sources... ;-) (defun which-func-identify-DEFUN () (save-excursion (save-match-data (beginning-of-defun) (and (looking-at "DEFUN +(\"[^\"]+\",[ \n]+\\(F[^,]+\\),") (match-string-no-properties 1))))) Likely the `save-match-data' is not required, but I tend to err on the side of saving it on my code. > Where is it? How do you set it up? (add-hook 'which-func-functions 'which-func-identify-DEFUN nil t) on the required buffers (I set it through `c-mode-hook'). Juanma