* Stepping To Next C Function
@ 2008-01-18 18:00 A Shepard
2008-01-18 20:37 ` Alan Mackenzie
0 siblings, 1 reply; 2+ messages in thread
From: A Shepard @ 2008-01-18 18:00 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1.1: Type: text/plain, Size: 159 bytes --]
Hello:
Is there a key mapping/function that provides the ability to step through a C source file to the beginning of each function?
Thanks,
Andy...
[-- Attachment #1.2: Type: text/html, Size: 472 bytes --]
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Stepping To Next C Function
2008-01-18 18:00 Stepping To Next C Function A Shepard
@ 2008-01-18 20:37 ` Alan Mackenzie
0 siblings, 0 replies; 2+ messages in thread
From: Alan Mackenzie @ 2008-01-18 20:37 UTC (permalink / raw)
To: A Shepard; +Cc: help-gnu-emacs
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).
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-01-18 20:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-18 18:00 Stepping To Next C Function A Shepard
2008-01-18 20:37 ` Alan Mackenzie
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).