title: Using Swank functions in a library
body: <p>I use SLIME/SBCL/Emacs and Quicklisp on Ubuntu Raring. I have the function defined below. I would like to add to my Lisp library's  top .lisp file, i.e.,  the one every other one depends on, so that I can use it in all the functions I write with my library by just adding <code>(update-swank)</code> to a function instead of having to add the entire function below to each piece of code that uses it.</p>
  
  <pre><code>(defun update-swank ()
     "Grabs SWANK connections and tells it to handle requests. 
      Call this every loop in the main loop of your program"
     (continuable
       (let ((connection (or swank::*emacs-connection*
                 (swank::default-connection))))
         (when connection
       (swank::handle-requests connection t)))))
  </code></pre>
  
  <p>When I do this and restart emacs, loading my library in the process because I have the <code>asdf:load-op</code> in my .sbclrc file, I get a   </p>
  
  <pre><code>READ error during COMPILE-FILE:
  ;   
     ;     Package SWANK does not exist.
  </code></pre>
  
  <p>in inferior lisp, and SLIME is stuck polling because the library doesn't load because in my current setup SLIME/SBCL doesn't know what swank is at the time the .lisp file that <code>update-swank</code> is in is loaded. I tried adding <code>(in-package :swank)</code> to the file that <code>update-swank</code> is in, but got</p>
  
  <pre><code>The name "SWANK" does not designate any package.
  </code></pre>
  
  <p>in inferior lisp when my library is loaded at emacs startup.</p>
  
  <p>I searched through CEPL (where i got update-swank from <a href="https://github.com/cbaggers/cepl/blob/master/cepl-utils.lisp" rel="nofollow">https://github.com/cbaggers/cepl/blob/master/cepl-utils.lisp</a>) and then copied what the creator of CEPL did and exported the function in my packages.lisp. I made sure the function was added like he did on line 20 of cepl-utils here <a href="https://github.com/cbaggers/cepl/blob/master/cepl-utils.lisp......I" rel="nofollow">https://github.com/cbaggers/cepl/blob/master/cepl-utils.lisp......I</a> load my library btw with </p>
  
  <pre><code>(asdf:operate 'asdf:load-op :cl-test)
  (in-package #:cl-test)
  </code></pre>
  
  <p>in my .sbclrc file which i assume is loaded before my <code>.emacs</code>  file loads slime at emacs start up (i have <code>(slime)</code> in my <code>.emacs</code> file) ...I just tested removing the <code>adsf:load-op</code> and <code>in-package</code> and from my <code>.sbclrc</code> and running the <code>asdf:load-op</code>  after slime/swank has been loaded and what i've been trying to do here worked with no error....but i would like to be able load my library automatically at emacs startup and the way i usually do that is by adding the <code>asdf:load-op</code> to my <code>.sbclrc</code>....If someone could tell me another way to load my library automatically at emacs startup after swank has been loaded that would answer this ?</p>