Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Next: , Previous: Program Modes, Up: Programs


31.2 Top-Level Definitions, or Defuns

In Emacs, a major definition at the top level in the buffer, something like a function, is called a defun. The name comes from Lisp, but in Emacs we use it for all languages.

In many programming language modes, Emacs assumes that a defun is any pair of parentheses (or braces, if the language uses braces this way) that starts at the left margin. For example, in C, the body of a function definition is a defun, usually recognized as an open-brace that begins at the left margin1. A variable's initializer can also count as a defun, if the open-brace that begins the initializer is at the left margin.

However, some language modes provide their own code for recognizing defuns in a way that suits the language syntax and conventions better.


Footnotes

[1] Alternatively, you can set up C Mode to recognize a defun at an opening brace at the outermost level. See Movement Commands.



 
 
  Published under the terms of the GNU General Public License Design by Interspire