148 lines
22 KiB
HTML
148 lines
22 KiB
HTML
<!DOCTYPE html>
|
|
<html><head><title>EmacsWiki: Elisp Area</title><link rel="alternate" type="application/wiki" title="Edit this page" href="https://www.emacswiki.org/emacs?action=edit;id=ElispArea" /><link type="text/css" rel="stylesheet" href="https://www.emacswiki.org/light.css" /><meta name="robots" content="INDEX,FOLLOW" /><link rel="alternate" type="application/rss+xml" title="EmacsWiki" href="https://www.emacswiki.org/emacs?action=rss" /><link rel="alternate" type="application/rss+xml" title="EmacsWiki: ElispArea" href="https://www.emacswiki.org/emacs?action=rss;rcidonly=ElispArea" />
|
|
<link rel="alternate" type="application/rss+xml"
|
|
title="Emacs Wiki with page content"
|
|
href="https://www.emacswiki.org/full.rss" />
|
|
<link rel="alternate" type="application/rss+xml"
|
|
title="Emacs Wiki with page content and diff"
|
|
href="https://www.emacswiki.org/full-diff.rss" />
|
|
<link rel="alternate" type="application/rss+xml"
|
|
title="Emacs Wiki including minor differences"
|
|
href="https://www.emacswiki.org/minor-edits.rss" />
|
|
<link rel="alternate" type="application/rss+xml"
|
|
title="Changes for ElispArea only"
|
|
href="https://www.emacswiki.org/emacs?action=rss;rcidonly=ElispArea" /><meta content="width=device-width" name="viewport" />
|
|
<script type="text/javascript" src="/outliner-toc.js"></script>
|
|
<script type="text/javascript">
|
|
|
|
function addOnloadEvent(fnc) {
|
|
if ( typeof window.addEventListener != "undefined" )
|
|
window.addEventListener( "load", fnc, false );
|
|
else if ( typeof window.attachEvent != "undefined" ) {
|
|
window.attachEvent( "onload", fnc );
|
|
}
|
|
else {
|
|
if ( window.onload != null ) {
|
|
var oldOnload = window.onload;
|
|
window.onload = function ( e ) {
|
|
oldOnload( e );
|
|
window[fnc]();
|
|
};
|
|
}
|
|
else
|
|
window.onload = fnc;
|
|
}
|
|
}
|
|
|
|
// https://stackoverflow.com/questions/280634/endswith-in-javascript
|
|
if (typeof String.prototype.endsWith !== 'function') {
|
|
String.prototype.endsWith = function(suffix) {
|
|
return this.indexOf(suffix, this.length - suffix.length) !== -1;
|
|
};
|
|
}
|
|
|
|
var initToc=function() {
|
|
|
|
var outline = HTML5Outline(document.body);
|
|
if (outline.sections.length == 1) {
|
|
outline.sections = outline.sections[0].sections;
|
|
}
|
|
|
|
if (outline.sections.length > 1
|
|
|| outline.sections.length == 1
|
|
&& outline.sections[0].sections.length > 0) {
|
|
|
|
var toc = document.getElementById('toc');
|
|
|
|
if (!toc) {
|
|
var divs = document.getElementsByTagName('div');
|
|
for (var i = 0; i < divs.length; i++) {
|
|
if (divs[i].getAttribute('class') == 'toc') {
|
|
toc = divs[i];
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!toc) {
|
|
var h2 = document.getElementsByTagName('h2')[0];
|
|
if (h2) {
|
|
toc = document.createElement('div');
|
|
toc.setAttribute('class', 'toc');
|
|
h2.parentNode.insertBefore(toc, h2);
|
|
}
|
|
}
|
|
|
|
if (toc) {
|
|
var html = outline.asHTML(true);
|
|
toc.innerHTML = html;
|
|
|
|
items = toc.getElementsByTagName('a');
|
|
for (var i = 0; i < items.length; i++) {
|
|
while (items[i].textContent.endsWith('✎')) {
|
|
var text = items[i].childNodes[0].nodeValue;
|
|
items[i].childNodes[0].nodeValue = text.substring(0, text.length - 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
addOnloadEvent(initToc);
|
|
</script>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body class="default" lang="en"><header><a class="logo" href="https://www.emacswiki.org/emacs/SiteMap"><img alt="[Home]" class="logo" src="https://www.emacswiki.org/images/logo218x38.png" /></a><nav><span class="gotobar bar"><a class="local" href="https://www.emacswiki.org/emacs/SiteMap">SiteMap</a> <a class="local" href="https://www.emacswiki.org/emacs/Search">Search</a> <a class="local" href="https://www.emacswiki.org/emacs/ElispArea">ElispArea</a> <a class="local" href="https://www.emacswiki.org/emacs/HowTo">HowTo</a> <a class="local" href="https://www.emacswiki.org/emacs/Glossary">Glossary</a> <a class="local" href="https://www.emacswiki.org/emacs/RecentChanges">RecentChanges</a> <a class="local" href="https://www.emacswiki.org/emacs/News">News</a> <a class="local" href="https://www.emacswiki.org/emacs/Problems">Problems</a> <a class="local" href="https://www.emacswiki.org/emacs/Suggestions">Suggestions</a> <a href="https://www.emacswiki.org/emacs?action=random" rel="nofollow">Random</a></span><form method="get" action="https://www.emacswiki.org/emacs" enctype="multipart/form-data" accept-charset="utf-8" class="search"><p><label for="search">Search:</label> <input type="text" name="search" size="15" accesskey="f" id="search" /> <label for="searchlang">Language:</label> <input type="text" name="lang" size="5" id="searchlang" /> <input type="submit" name="dosearch" value="Go!" /></p></form></nav><h1><a href="https://www.emacswiki.org/emacs?search=%22ElispArea%22" rel="nofollow" title="Click to search for references to this page"><span style="padding-right: 0.5ex;">Elisp</span><span style="padding-right: 0.5ex;">Area</span></a></h1></header><div class="wrapper"><div class="content browse" lang="en"><p>This is the <a class="local" href="https://www.emacswiki.org/emacs/EmacsWiki">EmacsWiki</a> elisp area where we collect <a class="local" href="https://www.emacswiki.org/emacs/EmacsLisp">EmacsLisp</a> files. No login required, no version control required, no ftp required, no password required. It’s as simple as the wiki itself. That also means that anybody can place malicious code in these EmacsLisp files. If in doubt, don’t use them.</p><h2>Downloading</h2><p>Links to <a class="local" href="https://www.emacswiki.org/emacs/EmacsLisp">EmacsLisp</a> libraries hosted on the <a class="local" href="https://www.emacswiki.org/emacs/EmacsWiki">EmacsWiki</a> come in two different forms.</p><p>Links to the plain text library look like <a class="inter Download" href="/emacs/download/foo.el"><span class="site">Download</span><span class="separator">:</span><span class="interpage">foo.el</span></a>. To view the linked file just follow the link. After that you can use your browser’s save dialog to download the file.</p><p>Links that look like <a class="inter Lisp" href="/emacs/foo.el"><span class="site">Lisp</span><span class="separator">:</span><span class="interpage">foo.el</span></a> take you to a <strong>wiki page</strong> which is an HTML file. Click on the <strong>Download</strong> link on that page to view or download the plain text file.</p><p>If you accidentally download and then try to load an HTML file in Emacs you will get an error like: “Loading library.el (source)… File mode specification error: (void-variable <!--)”.</p><p>Sometimes you will encounter links to libraries with neither the <strong>Lisp:</strong> nor <strong>Download:</strong> prefix. If they link to libraries on the Emacswiki they will never-the-less take you to either the plain text or html version of the library. Otherwise they link to files outside the Emacswiki in which case anything can happen.</p><p>Besides downloading individual libraries, you can also use Wget, Rsync or a <b>version control system</b> to download the files. See <a class="local" href="https://www.emacswiki.org/emacs/WikiDownload">WikiDownload</a>.</p><ul><li><a class="inter Self outside" href="/emacs?action=elisp-area">Alphabetical list of all Elisp libraries on this Wiki</a></li><li><a class="inter EmacsWiki outside" href="/emacs?action=rc;match=%5C.%28el%7Ctar%29%28%5C.gz%29%3F%24;from=1117497600;showedit=1">Chronological list of all Elisp libraries on this Wiki</a> (<a class="inter EmacsWiki outside" href="/emacs?action=rc;match=%5C.%28el%7Ctar%29%28%5C.gz%29%3F%24;days=7;showedit=1">last seven days</a>)</li><li>By Category – Most of the links off of <a class="local" href="https://www.emacswiki.org/emacs/SiteMap">SiteMap</a> are to <strong>categories</strong> pages, which link to relevant user-contributed libraries</li></ul><p>For help installing a library, see <a class="local" href="https://www.emacswiki.org/emacs/InstallingPackages">InstallingPackages</a>.</p><h2>Uploading</h2><p>Small files up to maybe 200k can be pasted into ordinary pages. Basic instructions follow but please also read and wherever possible <strong>follow the <a class="local" href="https://www.emacswiki.org/emacs/ElispAreaConventions">ElispAreaConventions</a></strong>.</p><p>First, create a page on the wiki explaining what the file does. See <a class="local" href="https://www.emacswiki.org/emacs/CreateNewPages">CreateNewPages</a> for how to do this. On that page, create a link to the file itself using the Lisp prefix:</p><p>Example:</p><pre> Lisp<span class="builtin">:foo</span>.el</pre><p>Result:</p><dl class="quote"><dt /><dd><a class="inter Lisp" href="/emacs/foo.el"><span class="site">Lisp</span><span class="separator">:</span><span class="interpage">foo.el</span></a></dd></dl><p>This kind of link makes it easier for visitors to download the file, and to find references to the file.</p><p>Now follow the link, edit the page, and paste the file. When pasting, make sure the first line on the page starts with three semicolons: <code>;;;</code>.</p><p>When posting a link to the elisp file on other pages, a common practice is to also provide a link to the Wiki page(s) that describe the library, perhaps in parentheses. See <a class="local" href="https://www.emacswiki.org/emacs/TextFormattingRules">TextFormattingRules</a> for information about how to create link to wiki page.</p><p>Example:</p><pre> Lisp<span class="builtin">:color-moccur</span>.el (OccurBuffer)</pre><p>Result:</p><dl class="quote"><dt /><dd><a class="inter Lisp" href="/emacs/color-moccur.el"><span class="site">Lisp</span><span class="separator">:</span><span class="interpage">color-moccur.el</span></a> (<a class="local" href="https://www.emacswiki.org/emacs/OccurBuffer">OccurBuffer</a>)</dd></dl><h2>Uploading large files</h2><p>Gzip files and upload them. Create a page to hold your file. Use the filename as pagename, eg. color-theme.el.gz. Edit the page, and click on the link below the save button that says to replace the text with a file.</p><h2>Version Control</h2><dl class="quote"><dt /><dd>“Instead of hosting their projects in version control (say <a class="local" href="https://www.emacswiki.org/emacs/GitHub">GitHub</a>) they develop stuff locally, upload them to the wiki and say that this is the canonical way to obtain their software. Needless to say - this is a horrible, horrible practice.” – <a class="url http outside" href="http://batsov.com/articles/2012/03/20/die-emacswiki/">Die EmacsWiki, Die!</a>, by <a class="local" href="https://www.emacswiki.org/emacs/BozhidarBatsov">BozhidarBatsov</a></dd></dl><p>Use <a class="url http outside" href="http://savannah.gnu.org/">Savannah</a>, “the software forge for people committed to free software.”</p><p>Use <a class="local" href="https://www.emacswiki.org/emacs/Gists">Gists</a>: “Gist is a simple way to share snippets and pastes with others. All gists are git repositories, so they are automatically <b>versioned</b>, <b>forkable</b> and usable as a <b>git repository</b>.”</p><p>…or use <a class="url http outside" href="http:/fossil-scm.org/">Fossil</a> for all of those mini-projects and sync them via vc-fossil. Wiki, bug-tracker etc. included by default, easily clone- and forkable.</p><h2>Code snippets</h2><p>For a small set of functions or code snippets, just put them on the wiki pages directly, or add them to the <a class="local" href="https://www.emacswiki.org/emacs/ElispCookbook">ElispCookbook</a>. If you do, make sure you use the <pre> and </pre> or the {{{ and }}} tags to protect the code from formatting.</p><p>Or use <a class="local" href="https://www.emacswiki.org/emacs/Gists">Gists</a>: snippets of code hosted on github.</p><p>Or use <a class="url http outside" href="http://paste.lisp.org/">Lisppaste</a>:</p><pre><include lisppaste <span class="string">"http://paste.lisp.org/display/132682"</span>>
|
|
</pre><p>Result:</p><pre>(global-set-key (kbd <span class="string">"C-z"</span>) 'eshell)
|
|
(global-set-key (kbd <span class="string">"C-x 4 C-z"</span>) 'eshell-other-window)
|
|
(<span class="keyword">defun</span> <span class="function">eshell-other-window</span> (&optional arg)
|
|
(interactive <span class="string">"P"</span>)
|
|
(<span class="keyword elisp">if</span> (one-window-p)
|
|
(split-window)
|
|
(other-window 1))
|
|
(eshell arg))
|
|
</pre><h2>Conventions</h2><p>The wiki is for free software only. Please make sure your files contain an appropriate blurb that says so. Code snippets are covered by the license in the footer of every page.</p><p>Please describe the <a class="local" href="https://www.emacswiki.org/emacs/EmacsLisp">EmacsLisp</a> libraries you add to the Wiki. <a class="local" href="https://www.emacswiki.org/emacs/CreateNewPages">CreateNewPages</a> to do that, or add the descriptions to existing pages.</p><p>Proposed guidelines for Emacs Lisp files on Emacs Wiki are in <a class="local" href="https://www.emacswiki.org/emacs/ElispAreaConventions">ElispAreaConventions</a>.</p><p>If a file has been uploaded to the wiki, we consider it an implicit invitation to collaborative improve it. If you are the maintainer of code that has been changed on the site, you have several options:</p><ol><li>treat it is a fork and ignore it</li><li>review the change and reject it – roll back the change and revert to an earlier version</li><li>agree to the change and merge it with your working copy if you use a version control system</li><li>agree to the change and do nothing if the copy on the wiki is the only official location</li></ol><p>Other people fixing what they consider to be bugs and adding features they are missing seems to be the workflow that emerges naturally from the wiki nature of this site. If you disagree, see <i>Version Control</i>, above.</p><h2>Alternatives</h2><p>Here are some other places to download and distribute elisp code:</p><ul><li><a class="local" href="https://www.emacswiki.org/emacs/ELPA">ELPA</a> – packages included in ELPA can be installed using the package.el package manager. The number of packages is limited but the ones that are included are of good quality; <a class="local" href="https://www.emacswiki.org/emacs/Marmalade">Marmalade</a> and <a class="local" href="https://www.emacswiki.org/emacs/MELPA">MELPA</a> are both supplementary or alternative ELPA archives.</li><li><a class="local" href="https://www.emacswiki.org/emacs/el-get">el-get</a> – gives apt-get user experience to emacs, includes support for emacswiki elisp files</li><li><a class="local" href="https://www.emacswiki.org/emacs/DELPS">DELPS</a> – packages which are made available in DELPS format, called <i>epackages</i>, can be installed using the reference implementation <code>epackage.el</code> package manager. This a modern implementation of ELPA: from centralized package repository to individually maintained distributed <a class="local" href="https://www.emacswiki.org/emacs/Git">Git</a> repositories with Debian style of packaging.</li><li><a class="local" href="https://www.emacswiki.org/emacs/Emacsmirror">Emacsmirror</a> – a huge collection of packages which are distributed in form of <a class="local" href="https://www.emacswiki.org/emacs/Git">Git</a> repositories. Includes mirroring most of the packages found here: at <span>EmacsWiki</span>’s <span>ElispArea</span>. No support for <code>package.el</code> yet.</li><li><a class="local" href="https://www.emacswiki.org/emacs/WikifiedEmacsLispList">WikifiedEmacsLispList</a> – pointers to various files on authors’ own sites. Unfortunatly many links are dead (those that were not are also included in the Emacsmirror).</li><li>Many pages on the <span>EmacsWiki</span> link to external sites with elisp libraries</li><li>Various package hosting solutions (with version control). Some of the more popular ones are (links to Emacs specific pages for your searching pleasure):<ul><li>Using <a class="local" href="https://www.emacswiki.org/emacs/Git">Git</a> -- <a class="url http outside" href="http://repo.or.cz/w?a=project_list;temacs">repo.or.cz</a>, <a class="url https outside" href="https://gitlab.com/search?utf8=%E2%9C%93&snippets=&scope=&search=emacs">gitlab</a>, <a class="url http outside" href="http://github.com/languages/Emacs%20Lisp">github</a> (<a class="url http outside" href="http://git.wiki.kernel.org/index.php/GitHosting">more</a>)</li><li>Using <a class="local" href="https://www.emacswiki.org/emacs/Bazaar">Bazaar</a> -- <a class="url https outside" href="https://launchpad.net/+search?field.text=emacs">launchpad</a></li><li>Using <a class="local" href="https://www.emacswiki.org/emacs/Mercurial">Mercurial</a> -- <a class="url http outside" href="http://bitbucket.org/">bitbucket</a> (<a class="url http outside" href="http://mercurial.selenic.com/wiki/MercurialHosting">more</a>)</li><li>Various vcs -- <a class="url http outside" href="http://savannah.gnu.org/search/?words=emacs&type_of_search=soft&Search=Search&exact=1#options">savannah</a>, <a class="url http outside" href="http://savannah.nongnu.org/">savannah nongnu</a>, <a class="url http outside" href="http://sourceforge.net/search/?type_of_search=soft&words=emacs&search=Search">sourceforge</a></li></ul></li></ul><h2>Tips</h2><p>Additional tips can be found on <a class="local" href="https://www.emacswiki.org/emacs/Comments_on_ElispArea">Comments on ElispArea</a>.</p><h3>Tip: Version keyword</h3><p>If you put a percent sign (%), then “Id:” (the colon is necessary), then another %, in a page of elisp code, it will end up being expanded into a revision number and look like this:</p><p>%Id: 308%</p><p>So you can have lisp files on the wiki be version-numbered automatically instead of manually.</p><h3>Name conflicts</h3><p>If you find libraries that duplicate existing Emacs libraries, consider why the code has been posted on the wiki.</p><ol><li>A mistake – delete the page</li><li>A library that was hosted on the wiki before it got integrated into Emacs – in this case, it depends: Sometimes these copies are the last revision to actually work on older emacsen.</li><li>A patched copy – the page should probably be renamed.</li></ol><h3>Encoding</h3><p>When pasting code on a page, make sure the code is UTF-8 encoded. (ASCII encoding is automatically valid UTF-8!) The wiki serves pages using a HTTP header telling browsers that the page will be UTF-8 encoded. If your code contains Latin-1 or other encodings, this will result in garbage: Invalid UTF-8.</p><p>This usually happens when code contains string literals. Consider using octal escapes instead:</p><pre> (replace-string <span class="string">"<span>\2</span>21"</span> <span class="string">"`"</span> nil (point-min) (point-max)) <span class="comment">; opening single quote</span>
|
|
(replace-string <span class="string">"<span>\2</span>22"</span> <span class="string">"'"</span> nil (point-min) (point-max)) <span class="comment">; closing single quote</span></pre><p>To convince yourself that octal escapes really work, consider <code>(length "\221")</code> → 1.</p></div><div class="wrapper close"></div></div><footer><hr /><span class="translation bar"><br /> <a class="translation es" href="https://www.emacswiki.org/emacs/ÁreaElisp">Español</a> <a class="translation de" href="https://www.emacswiki.org/emacs/ElispSektion">Deutsch</a> <a class="translation fr" href="https://www.emacswiki.org/emacs/SectionElisp">Français</a> <a class="translation new" href="https://www.emacswiki.org/emacs?action=translate;id=ElispArea;missing=it_ja_ko_pt_ru_se_uk_zh" rel="nofollow">Add Translation</a></span><div class="edit bar"><a accesskey="c" class="comment local" href="https://www.emacswiki.org/emacs/Comments_on_ElispArea">Talk</a> <a accesskey="e" class="edit" href="https://www.emacswiki.org/emacs?action=edit;id=ElispArea" rel="nofollow" title="Click to edit this page">Edit this page</a> <a class="history" href="https://www.emacswiki.org/emacs?action=history;id=ElispArea" rel="nofollow">View other revisions</a> <a class="admin" href="https://www.emacswiki.org/emacs?action=admin;id=ElispArea" rel="nofollow">Administration</a></div><div class="time">Last edited 2020-07-18 20:46 UTC by <a class="author" href="https://www.emacswiki.org/emacs/Alex_Schroeder">Alex Schroeder</a> <a class="diff" href="https://www.emacswiki.org/emacs?action=browse;diff=2;id=ElispArea" rel="nofollow">(diff)</a></div><div style="float:right; margin-left:1ex;">
|
|
<!-- Creative Commons License -->
|
|
<a class="licence" href="https://creativecommons.org/licenses/GPL/2.0/"><img alt="CC-GNU GPL" style="border:none" src="/pics/cc-GPL-a.png" /></a>
|
|
<!-- /Creative Commons License -->
|
|
</div>
|
|
|
|
<!--
|
|
<rdf:RDF xmlns="http://web.resource.org/cc/"
|
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
|
<Work rdf:about="">
|
|
<license rdf:resource="https://creativecommons.org/licenses/GPL/2.0/" />
|
|
<dc:type rdf:resource="http://purl.org/dc/dcmitype/Software" />
|
|
</Work>
|
|
|
|
<License rdf:about="https://creativecommons.org/licenses/GPL/2.0/">
|
|
<permits rdf:resource="http://web.resource.org/cc/Reproduction" />
|
|
<permits rdf:resource="http://web.resource.org/cc/Distribution" />
|
|
<requires rdf:resource="http://web.resource.org/cc/Notice" />
|
|
<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
|
|
<requires rdf:resource="http://web.resource.org/cc/ShareAlike" />
|
|
<requires rdf:resource="http://web.resource.org/cc/SourceCode" />
|
|
</License>
|
|
</rdf:RDF>
|
|
-->
|
|
|
|
<p class="legal">
|
|
This work is licensed to you under version 2 of the
|
|
<a href="https://www.gnu.org/">GNU</a> <a href="/GPL">General Public License</a>.
|
|
Alternatively, you may choose to receive this work under any other
|
|
license that grants the right to use, copy, modify, and/or distribute
|
|
the work, as long as that license imposes the restriction that
|
|
derivative works have to grant the same rights and impose the same
|
|
restriction. For example, you may choose to receive this work under
|
|
the
|
|
<a href="https://www.gnu.org/">GNU</a>
|
|
<a href="/FDL">Free Documentation License</a>, the
|
|
<a href="https://creativecommons.org/">CreativeCommons</a>
|
|
<a href="https://creativecommons.org/licenses/sa/1.0/">ShareAlike</a>
|
|
License, the XEmacs manual license, or
|
|
<a href="/OLD">similar licenses</a>.
|
|
</p>
|
|
<p class="legal" style="padding-top: 0.5em">Please note our <a href="/emacs/Privacy">Privacy Statement</a>.</p>
|
|
</footer>
|
|
</body>
|
|
</html>
|