Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to select (mark) the body of a C function in emacs?

Tags:

emacs

c-mode

I used to remember a key combination in c-mode to select a C function (i mean select the text between start and end of function for copying/killing etc) but i've since forgotten it and can't seem to find it anywhere. Does anyone remember what this key combination is?

like image 607
horseyguy Avatar asked Aug 12 '09 20:08

horseyguy


People also ask

How do you set a mark in Emacs?

To set the mark, type C- SPC ( set-mark-command ). This makes the mark active; as you move point, you will see the region highlighting grow and shrink. The mouse commands for specifying the mark also make it active.

How do I select a block of code in Emacs?

You can select blocks of text in Emacs just as you would in most other environments. You could, for example, drag your mouse over a region. You could also hold down the Shift key and use arrow keys.

How do I select a region of text in Emacs?

Alternatively, if you are running Emacs in its own window (and not within an "xterm" window) as part of an X Window session, you can select the region simply by using the mouse. Click the mouse's left button at the start of the area to be selected, and drag the mouse to the end of the area.

How do I select all lines in Emacs?

With Emacs 25, simply press Ctrl + Space and then move your cursor wherever you want to highlight/select the region of text which interests you. After that, you may need these commands: Ctrl + W for cutting.


Video Answer


1 Answers

In Emacs 23, it appears to be bound to:

C-M-h           c-mark-function

FWIW, I found this by listing all the commands for the mode C-h b, and searching for 'mark'.

like image 50
Trey Jackson Avatar answered Sep 22 '22 16:09

Trey Jackson