{"id":261,"date":"2008-05-30T14:04:00","date_gmt":"2008-05-30T19:04:00","guid":{"rendered":"http:\/\/www.pchristensen.com\/blog\/?p=261"},"modified":"2008-05-30T21:21:49","modified_gmt":"2008-05-31T02:21:49","slug":"installing-sbcl-emacs-and-slime-on-windows-xp","status":"publish","type":"post","link":"http:\/\/pchristensen.com\/blog\/articles\/installing-sbcl-emacs-and-slime-on-windows-xp\/","title":{"rendered":"Installing SBCL, Emacs, and SLIME on Windows XP"},"content":{"rendered":"<p>My recent <a href=\"http:\/\/www.pchristensen.com\/blog\/articles\/installing-clisp-emacs-and-slime-on-windows-xp\/\">install guide for CLISP, Emacs, and SLIME on Windows XP<\/a> was a big hit &#8211; it has had about 2000 hits and 5 sincere thanks in the comments (it even got <a href=\"http:\/\/www.pchristensen.com\/blog\/articles\/installing-clisp-emacs-and-slime-on-windows-xp\/#comment-478\">praise from a troll!<\/a>).  In it I promised a similar guide for SBCL, and here it is.<\/p>\n<p>The nice thing is that swapping out Common Lisp implementations within an Emacs\/SLIME setup is easy, so maybe 3\/4 of this guide is identical to the CLISP guide.  I&#8217;ll put a disclaimer at the beginning of each section saying whether there&#8217;s anything new or whether you can skip it.<\/p>\n<p><!--more--><\/p>\n<p><strong>0. Files to Download<\/strong> [<strong>DIFF<\/strong>: The only difference is the link to the SBCL installer instead of the CLisp installer]<\/p>\n<p>If you want to get started on downloading the setup files, here are the links:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.7-zip.org\/\" target=\"_blank\">7-zip<\/a> (<a href=\"http:\/\/downloads.sourceforge.net\/sevenzip\/7z457.exe\">download v4.57<\/a> &#8211; 840K) &#8211; for unpacking .tar and .tar.gz files commonly used in *nix.<\/li>\n<li><a href=\"http:\/\/www.gnu.org\/software\/emacs\/\" target=\"_blank\">Emacs<\/a> (<a href=\"http:\/\/ftp.gnu.org\/pub\/gnu\/emacs\/windows\/emacs-22.2-bin-i386.zip\">download v22.2<\/a> &#8211; 37MB)<\/li>\n<li><a href=\"http:\/\/www.sbcl.org\/\" target=\"_blank\">SBCL<\/a> (<a href=\"http:\/\/downloads.sourceforge.net\/sbcl\/sbcl-1.0.13-x86-windows-binary.msi\">download v1.0.13<\/a> &#8211; 9.8 MB)<\/li>\n<li><a href=\"http:\/\/common-lisp.net\/project\/slime\/\" target=\"_blank\">SLIME<\/a> (<a href=\"http:\/\/common-lisp.net\/cgi-bin\/viewcvs.cgi\/root.tar.gz?root=slime&amp;view=tar\">download CVS snapshot<\/a> &#8211; 700K) &#8211; apparently the SLIME 2.0 release is ancient and not worth using<\/li>\n<\/ul>\n<p><strong>1. Setup Directories <\/strong>[<strong>NO DIFF<\/strong>: skip if you&#8217;ve completed the CLisp guide]<\/p>\n<p>Windows XP loves extremely long pathnames like C:\\Documents and Settings\\Username\\Application Data. This is okay if for GUI-driven apps, but in Emacs, you\\&#8217;re not clicking, you\\&#8217;re typing, and you want short path names. Also, much (most?) of the open source Common Lisp tools are developed on *nix, so there\\&#8217;s less impedance mismatch when using stuff off the net if you have a *nix-ish folder structure.<\/p>\n<p>Start with a root folder. In the pathnames in the rest of this guide, I\\&#8217;ll refer to it as [HOME]. I used C:\\home\\ to match the *nix convention of having user files be in \/home\/username\/. You also need a username directory &#8211; I called mine peter and I\\&#8217;ll refer to it as [USR]. So in my case, [HOME]\/[USR] would be C:\\home\\peter\\.<\/p>\n<p><strong>Emacs NOTE #1:<\/strong> One important point about filenames in Emacs is that they CAN be entered with \u00e2\u20ac\u02dc\/\\&#8217;, but if you prefer to use \u00e2\u20ac\u02dc\\\\&#8217;, you have to escape it with another back slash, so in Emacs buffers and files, you would enter \u00e2\u20ac\u0153C:\/home\/\u00e2\u20ac\u009d or \u00e2\u20ac\u0153C:\\\\home\\\\\u00e2\u20ac\u009d but never \u00e2\u20ac\u0153C:\\home\\\u00e2\u20ac\u009d. The trailing slash is also important because it indicates that it\\&#8217;s a directory. Now that you have chosen your [ROOT] and [USR] values, these are the folders you should setup:<\/p>\n<ul>\n<li>[HOME]\\[USR]\\<\/li>\n<li>[HOME]\\[USR]\\site\\<\/li>\n<li>[HOME]\\[USR]\\docs\\<\/li>\n<li>[HOME]\\[USR]\\lisp\\<\/li>\n<li>[HOME]\\[USR]\\info\\<\/li>\n<li>[HOME]\\bin\\<\/li>\n<\/ul>\n<p><strong>2. Setup Emacs <\/strong>[<strong>NO DIFF<\/strong>: skip if you&#8217;ve completed the CLisp guide]<\/p>\n<p>Emacs does not need to be \u00e2\u20ac\u0153installed\u00e2\u20ac\u009d like most Windows apps &#8211; it just runs from its directory. Extract it to [HOME]\\bin\\. I changed the folder name from emacs-22.2 to just emacs, so my path was c:\\home\\bin\\emacs\\. You run emacs by running the file [HOME]\\bin\\emacs\\bin\\runemacs.exe.<\/p>\n<p>Emacs settings are stored in a configuration file called \u00e2\u20ac\u0153.emacs\u00e2\u20ac\u009d. On Windows, the default working folder and .emacs location is C:\\Documents and Settings\\Username\\Application Data, but that\\&#8217;s too painful to type and it\\&#8217;s a hidden folder so it\\&#8217;s not even easy to get through with the GUI. To have Emacs work in a different folder, create a file called site-start.el in the emacs\\site-lisp folder. In that folder, put the following line (but change the path to match yours):<\/p>\n<blockquote><p>(setenv \u00e2\u20ac\u0153HOME\u00e2\u20ac\u009d \u00e2\u20ac\u0153[HOME]\/[USR]\/\u00e2\u20ac\u009d)<\/p><\/blockquote>\n<p>(<a href=\"http:\/\/groups.google.com\/group\/comp.lang.lisp\/msg\/44e7f62088460aa7\" target=\"_blank\">Thanks Nathaniel!<\/a> This was probably the biggest annoyance of mine that made me put off finishing setup for so long.)<\/p>\n<p><strong>Emacs NOTE #2:<\/strong> Emacs has lots (and lots and lots) of keyboard shortcuts, many more than there are letters in the alphabet. Many of them require multiple keys or a sequence of keys called a \u00e2\u20ac\u0153chord\u00e2\u20ac\u009d. The two modifier keys used are Control and Alt (also called Meta). The common way to write chords is to use C- and M- for Control and Meta, so to run the command to close Emacs, you hold down Control and X, then let go, then hold down Control and C. This is written as C-x C-c. Sometimes a chord is followed by another letter or the name of a command. For instance, to undo, you hold Control and x, then let go and hit u. This is written as C-x u. Dashes mean press at the same time, space means let go. Easy! I made a <a href=\"..\/articles\/public-beta-open-for-ultimate-n00b-slimeemacs-cheat-sheet\/\">cheat sheet for common commands in Emacs and SLIME<\/a>.<\/p>\n<p>Now it\\&#8217;s time to create your .emacs file. Run emacs and hit C-x C-f. This is the find command, which is used to create or open a file. At the prompt \u00e2\u20ac\u0153Find file: \u00e2\u20ac\u0153, type \u00e2\u20ac\u0153~\/.emacs\u00e2\u20ac\u009d (without quotes). Right now just put a ; (that\\&#8217;s the comment marker in Emacs Lisp files) and save it by hitting C-x C-s. There\\&#8217;s a world of stuff you can put in a .emacs file, but that\\&#8217;s too much to bite off now.<\/p>\n<p><strong>3. Install SBCL<\/strong> [<strong>DIFF<\/strong>: This section is completely different]<\/p>\n<p>Although the Windows port of SBCL is still experimental, there is a Windows installer (.msi) file for v1.0.13 (highest version as of now is v1.0.17).  Just run the installer, and install it to the directory:<\/p>\n<p style=\"padding-left: 30px;\">[HOME]\\bin\\sbcl-1013\\<\/p>\n<p>Then just finish the install wizard.  But you&#8217;re not finished yet.<\/p>\n<p>Robert Zubek wrote a post about 2 months ago about how to <a href=\"http:\/\/robert.zubek.net\/blog\/2008\/04\/09\/sbcl-emacs-windows-vista\/\" target=\"_blank\">setup SBCL\/Emacs\/SLIME on Vista<\/a>, but it doesn&#8217;t work exactly right on Windows XP.  If you use the .emacs settings from his post, you get this error when you start SLIME (instead of using the .emacs settings in step 4):<\/p>\n<p style=\"padding-left: 30px;\">fatal error encountered in SBCL pid XXXX:<\/p>\n<p style=\"padding-left: 30px;\">can&#8217;t find core file at \/user\/local\/lib\/sbcl\/\/sbcl.core<\/p>\n<p style=\"padding-left: 30px;\">Process inferior-lisp exited abnormally with code 1<\/p>\n<p>If you use the settings in step 4, you&#8217;ll get a different error message:<\/p>\n<p style=\"padding-left: 30px;\">Searching for program: no such file or directory, sbcl<\/p>\n<p>If you SBCL looks in the environment variable PATH to find the executable and core file.  The default directories are *nixy, so it won&#8217;t find your sbcl directory on accident.  But why should it look for the directory if you entered it into the install wizard?<\/p>\n<p>Apparently <a href=\"http:\/\/www.helpwithwindows.com\/WindowsXP\/howto-04.html\" target=\"_blank\">Windows XP doesn&#8217;t update system environment variables until the system reboots<\/a>.  So right after you install SBCL, you have the user environment variables PATH and SBCL_Home but SBCL looks in the system variables.  I couldn&#8217;t find out a way to fix that without rebooting, but the good news is that a reboot solves the problem.<\/p>\n<p>So <strong>reboot your computer now<\/strong>.<\/p>\n<p><strong>4. Setup SLIME<\/strong> [<strong>DIFF<\/strong>: This section has some differences &#8211; links and .emacs setup]<\/p>\n<p>Apparently the SLIME 2.0 is very old; several people recommend ignoring it and going straight to the CVS snapshot, so that&#8217;s what I linked to above.<\/p>\n<p>Extract the SLIME folder to [HOME]\\bin\\emacs\\site-lisp. (Here\\&#8217;s a tip about <a href=\"http:\/\/groups.google.com\/group\/comp.lang.lisp\/msg\/5fce0960ef4e27be\" target=\"_blank\">putting emacs code in site-lisp<\/a>).<\/p>\n<p>Now in Emacs, open your .emacs file (C-x C-f, ~\/.emacs) and enter the following (<a href=\"http:\/\/common-lisp.net\/project\/slime\/doc\/html\/Installation.html\" target=\"_blank\">general SLIME instructions<\/a>, <a href=\"http:\/\/common-lisp.net\/pipermail\/slime-devel\/2008-May\/007331.html\" target=\"_blank\">SBCL specific setup<\/a>), changing your pathnames as usual.  The good news is that because SBCL looks in the environment variables, you don&#8217;t need any of the command line parameters in the inferior-lisp-program variable:<\/p>\n<blockquote><p>(setq inferior-lisp-program \u00e2\u20ac\u0153sbcl\u00e2\u20ac\u009d)<br \/>\n(add-to-list \u00e2\u20ac\u02dcload-path \u00e2\u20ac\u0153[HOME]\/bin\/emacs\/site-lisp\/slime\/\u00e2\u20ac\u009d)<br \/>\n(require \\&#8217;slime)<br \/>\n(slime-setup)<\/p><\/blockquote>\n<p>Save the .emacs file (C-x C-s), then run the eval-buffer command (M-x eval-buffer). This will run the code that you just entered and tell Emacs how to run SLIME.<\/p>\n<p>Now, you start slime with M-x slime and you\\&#8217;re ready to go!<\/p>\n<p>NOTE: This is a basic SBCL setup &#8211; I&#8217;ve found some more advanced setup links that I&#8217;ll write guides for later:<\/p>\n<ul>\n<li><a href=\"http:\/\/robert.zubek.net\/blog\/2008\/04\/09\/sbcl-emacs-windows-vista\/#comment-5\" target=\"_blank\">Setup ASDF-Install\/SBCL on Windows<\/a><\/li>\n<li><a href=\"http:\/\/brainrack.wordpress.com\/2008\/05\/29\/running-sbcl-on-windows\/\" target=\"_blank\">Running SBCL on Windows<\/a> &#8211; this is again for Vista, with the newest (v1.0.16 and v1.0.17) versions of SBCL.  It also includes configuring shell commands, etc.<\/li>\n<\/ul>\n<p>Additional comments at <a href=\"http:\/\/groups.google.com\/group\/comp.lang.lisp\/browse_thread\/thread\/9d8e78f7c53a7c4f?hl=en\" target=\"_blank\">comp.lang.lisp<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My recent install guide for CLISP, Emacs, and SLIME on Windows XP was a big hit &#8211; it has had about 2000 hits and 5 sincere thanks in the comments (it even got praise from a troll!). In it I promised a similar guide for SBCL, and here it is. The nice thing is that [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[9,10],"tags":[],"class_list":{"0":"post-261","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-lisp","7":"category-programming","8":"entry"},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pazgP-4d","_links":{"self":[{"href":"http:\/\/pchristensen.com\/blog\/wp-json\/wp\/v2\/posts\/261","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/pchristensen.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pchristensen.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pchristensen.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/pchristensen.com\/blog\/wp-json\/wp\/v2\/comments?post=261"}],"version-history":[{"count":0,"href":"http:\/\/pchristensen.com\/blog\/wp-json\/wp\/v2\/posts\/261\/revisions"}],"wp:attachment":[{"href":"http:\/\/pchristensen.com\/blog\/wp-json\/wp\/v2\/media?parent=261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pchristensen.com\/blog\/wp-json\/wp\/v2\/categories?post=261"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pchristensen.com\/blog\/wp-json\/wp\/v2\/tags?post=261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}