Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Emacs Lisp
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Source code== Emacs Lisp code is stored in [[filesystem]]s as [[plain text]] files, by convention with the filename suffix "<code>.el</code>". The user's init file is an exception, often appearing as "<code>.emacs</code>" despite being evaluated as any Emacs Lisp code. Since the mid-1990s, Emacs also loads <code>~/.emacs.el</code> and <code>~/.emacs.d/init.el</code>. Additionally, users may specify any file to load as a config file on the command line, or explicitly state that no config file is to be loaded. When the files are loaded, an [[interpreter (computer software)|interpreter]] component of the Emacs program reads and parses the functions and variables, storing them in memory. They are then available to other editing functions, and to user commands. Functions and variables can be freely modified and redefined without restarting the editor or reloading the config file. In order to save time and memory space, much of the functionality of Emacs loads only when required. Each set of optional features shipped with Emacs is implemented by a collection of Emacs code called a [[package (package management system)|package]] or [[Library (computing)|library]]. For example, there is a library for highlighting keywords in program source code, and a library for playing the game of [[Tetris]]. Each library is implemented using one or more Emacs Lisp source files. Libraries can define one or more ''major modes'' to activate and control their function. Emacs developers write certain functions in C. These are ''primitives'', also termed ''built-in functions'' or ''subrs''. Although primitives can be called from Lisp code, they can only be modified by editing the C source files and recompiling. In [[GNU Emacs]], primitives are not available as external libraries; they are part of the Emacs executable. In [[XEmacs]], runtime loading of such primitives is possible, using the operating system's support for [[dynamic linking]]. Functions may be written as primitives because they need access to external data and libraries not otherwise available from Emacs Lisp, or because they are called often enough that the comparative speed of C versus Emacs Lisp makes a worthwhile difference. However, because errors in C code can easily lead to [[segmentation violation]]s or to more subtle bugs, which crash the editor, and because writing C code that interacts correctly with the Emacs Lisp [[Garbage collection (computer science)|garbage collector]] is error-prone, the number of functions implemented as primitives is kept to a necessary minimum. ===Byte code=== ''Byte-compiling'' can make Emacs Lisp code execute faster. Emacs contains a [[compiler]] which can translate Emacs Lisp source files into a special representation termed [[bytecode]]. Emacs Lisp bytecode files have the [[filename suffix]] "<code>.elc</code>". Compared to source files, bytecode files load and run faster, occupy less disk space, and use less memory when loaded. Bytecode still runs more slowly than primitives, but functions loaded as bytecode can be easily modified and re-loaded. In addition, bytecode files are platform-independent. The standard Emacs Lisp code distributed with Emacs is loaded as bytecode, although the matching source files are usually provided for the user's reference as well. User-supplied extensions are typically not byte-compiled, as they are neither as large nor as computationally intensive.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Emacs Lisp
(section)
Add topic