From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.help Subject: Re: Stepping To Next C Function Date: Fri, 18 Jan 2008 20:37:35 +0000 Message-ID: <20080118203734.GA2634@muc.de> References: <434334.85968.qm@web50202.mail.re2.yahoo.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1200688173 14929 80.91.229.12 (18 Jan 2008 20:29:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 18 Jan 2008 20:29:33 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: A Shepard Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jan 18 21:29:50 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JFxqW-0008MI-9P for geh-help-gnu-emacs@m.gmane.org; Fri, 18 Jan 2008 21:29:48 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JFxq7-00017P-4f for geh-help-gnu-emacs@m.gmane.org; Fri, 18 Jan 2008 15:29:23 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JFxpi-00015S-VQ for help-gnu-emacs@gnu.org; Fri, 18 Jan 2008 15:28:58 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JFxph-00012H-5K for help-gnu-emacs@gnu.org; Fri, 18 Jan 2008 15:28:58 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JFxpg-00011z-M2 for help-gnu-emacs@gnu.org; Fri, 18 Jan 2008 15:28:56 -0500 Original-Received: from colin.muc.de ([193.149.48.1] helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JFxpg-0003aY-3B for help-gnu-emacs@gnu.org; Fri, 18 Jan 2008 15:28:56 -0500 Original-Received: (qmail 29540 invoked by uid 3782); 18 Jan 2008 20:27:21 -0000 Original-Received: from acm.muc.de (p57AF7D13.dip.t-dialin.net [87.175.125.19]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Fri, 18 Jan 2008 21:27:19 +0100 Original-Received: (qmail 2878 invoked by uid 1000); 18 Jan 2008 20:37:35 -0000 Content-Disposition: inline In-Reply-To: <434334.85968.qm@web50202.mail.re2.yahoo.com> User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.6-4.9 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:50811 Archived-At: Hi, Andy! On Fri, Jan 18, 2008 at 10:00:02AM -0800, A Shepard wrote: > Hello: > Is there a key mapping/function that provides the ability to step > through a C source file to the beginning of each function? No, not as such. But you surely know that C-M-a goes _backwards_ to a beginning of function. You can give a numeric argument of -1 to C-M-a (`c-beginning-of-defun') to make it go forward to the next function beginning, like this: M-- C-M-a (that's "Meta minus" ....) You might find this tedious if you want to do this a lot. In that case, put something like this into your .emacs: (defun my-next-c-function () "Go to start of next C function." (interactive) (c-beginning-of-defun -1)) (defun my-c-initialization-hook (define-key c-mode-base-map [ ?\C-\M-\S-a ] 'my-next-c-function)) (add-hook 'c-initialization-hook 'my-c-initialization-hook) This will define C-M-S-a ("Control-Meta-Shift a") to do what you want - Replace with any other key binding you prefer by adapting the second last line. If, like me, you use Emacs on a tty, that key binding needs a fair amount of additional magic to work. On X, (or MS Windows), it's just fine. > Thanks, Best of luck! > Andy... -- Alan Mackenzie (Nuremberg, Germany).