What is MIME type "application/x-elisp"?

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

application/x-elisp is a MIME type that marks files containing Emacs Lisp code. It informs systems to treat these files as scripts for the Emacs editor.

Files of this type usually have the extension EL.

For more details on MIME types and their purpose, visit the Media Type Wikipedia page.
For additional reading on Emacs Lisp itself, check the GNU Emacs Manual.

Associated file extensions

Usage Examples

HTTP Header

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


    Content-Type: application/x-elisp    
  

HTML

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


    <a href="file.dat" type="application/x-elisp">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', 'application/x-elisp');    
      res.end('Content here');    
    }).listen(3000);    
  

Associated file extensions

FAQs

How do I open a file with the application/x-elisp MIME type?

GNU Emacs is the primary software used to edit and execute these files. Since application/x-elisp files are plain text source code, you can also view them in any standard text editor, such as Notepad, Vim, or VS Code.

How do I configure Apache to serve .el files correctly?

To associate the extension with the MIME type, add the following line to your .htaccess file or main server configuration: AddType application/x-elisp .el. This ensures that browsers and package managers identify the file correctly as Emacs Lisp.

Why does my web browser download .el files instead of displaying them?

Browsers do not have built-in support for executing or rendering application/x-elisp. Consequently, most browsers default to downloading the .el file. To force the browser to display the code, the server must send the file with a text/plain Content-Type header instead.

What is the difference between application/x-elisp and compiled Emacs Lisp?

application/x-elisp is used for source code files ending in .el. When these files are byte-compiled for performance, they become .elc files, which are binary and often served as application/octet-stream or a specific compiled Lisp type, rather than the text-based x-elisp type.

Is application/x-elisp a standard IANA MIME type?

No, the x- prefix indicates that it is a non-standard or experimental subtype. While it is not officially registered in the IANA media type registry, it is widely recognized by convention within the Emacs community and web servers.

Are files served as application/x-elisp safe to run?

These files contain executable scripts that can modify files or access the network if run inside Emacs. Always review the code in a text editor before loading unknown scripts into your editor environment.

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.