What is MIME type "text/x-emacs-lisp"?

A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.

text/x-emacs-lisp identifies files that hold Emacs Lisp code. It tells programs the file is plain text containing a script written to run inside the Emacs editor.

Emacs Lisp is the language used to customize and extend Emacs. Code in these files can add new commands, modify behavior, and automate tasks within the editor. Files with this content typically use the EL extension.

The MIME type ensures that tools and systems recognize the file as Emacs Lisp source code. For more technical insights into Emacs and its scripting language, visit GNU Emacs.

Associated file extensions

Usage Examples

HTTP Header

When serving content with this MIME type, set the Content-Type header:


    Content-Type: text/x-emacs-lisp    
  

HTML

In HTML, you can specify the MIME type in various elements:


    <a href="file.dat" type="text/x-emacs-lisp">Download file</a>    
  

Server-side (Node.js)

Setting the Content-Type header in Node.js:


    const http = require('http');    
    
    http.createServer((req, res) => {    
      res.setHeader('Content-Type', 'text/x-emacs-lisp');    
      res.end('Content here');    
    }).listen(3000);    
  

Associated file extensions

FAQs

What application is required to open text/x-emacs-lisp files?

GNU Emacs is the primary application used to edit and execute these files. However, because the content is plain text, you can view and edit the code using any standard text editor, such as Notepad++, Vim, or Visual Studio Code.

How do I configure Apache to serve .el files as text/x-emacs-lisp?

You can define the MIME type in your .htaccess file or main server configuration. Add the line AddType text/x-emacs-lisp .el to ensure that files with the .el extension are served with the correct header.

Can web browsers execute files with the text/x-emacs-lisp MIME type?

No, web browsers will display the file contents as plain text but cannot execute the code. To run the scripts contained in the file, you must load them into an interpreter like the one built into the Emacs editor.

Why does this MIME type start with 'x-'?

The x- prefix signifies that text/x-emacs-lisp is a non-standard or experimental subtype not officially registered with the IANA. While it is not a formal standard, it is the widely accepted convention for identifying Emacs Lisp source code.

What is the difference between text/x-emacs-lisp and compiled Emacs Lisp?

The MIME type text/x-emacs-lisp is used for human-readable source code files (usually .el). Compiled Emacs Lisp files, which have the extension .elc, are binary data and are typically handled as application/octet-stream rather than text.

Is text/x-emacs-lisp safe to download and open?

As with any script file, you should treat it with caution. While opening the file in a text viewer is safe, loading or executing the code inside Emacs can modify your editor's behavior or run arbitrary commands on your system.

General FAQ

What is a MIME type?

A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.

MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.

MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.

How do I find the MIME type for a file?

You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.

Why are multiple MIME types listed for one extension?

Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.