<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">I have no idea why loading the code from QL would cause problems.  But if you’re running this code form the command line rather than the IDE then you might want to try (require :objc-support) instead of (require :cocoa).  The latter does all kinds of funky things that you don’t really need.<div><br></div><div>If you continue to have problems I suggest creating a file that contains nothing but the REQUIRE and the DEFUN WRITE-TO-CLIPBOARD forms and see if you can get QL to successfully load that.  I can’t imagine anything that QL could possibly do that would cause that to fail, but I don’t really know much about what it does behind the scenes.<br><div><br></div><div>Merry Lispmas!</div><div><br><div><div>On Dec 25, 2014, at 9:01 AM, Steven Núñez <<a href="mailto:sales@illation.com">sales@illation.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">



<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div>
<div>
<div>
<div><font class="Apple-style-span" face="Calibri,sans-serif">Hi Ron,</font></div>
<div><font class="Apple-style-span" face="Calibri,sans-serif"><br>
</font></div>
<div><font class="Apple-style-span" face="Calibri,sans-serif">Thanks. That code works well and shaves a good bit of awkwardness off the </font><span class="Apple-style-span" style="font-family: Calibri, sans-serif;">workflow. I¹ve got one problem however:
 loading the file containing the </span><span class="Apple-style-span" style="font-family: Calibri, sans-serif; ">code via quicklisp, e.g. (ql:quickload “foo") errors out in the reader </span><span class="Apple-style-span" style="font-family: Calibri, sans-serif; ">when
 parsing that code. The problem appears to be related to (require “</span><span class="Apple-style-span" style="font-family: Calibri, sans-serif; ">cocoa") not being evaluated before the write-to-clipboard function is. It works </span><span class="Apple-style-span" style="font-family: Calibri, sans-serif; ">fine
 in slime/emacs when evaluating things individually (perhaps it is a </span><span class="Apple-style-span" style="font-family: Calibri, sans-serif; ">timing issue?)</span></div>
<div><font class="Apple-style-span" face="Calibri,sans-serif"><br>
</font></div>
<div><font class="Apple-style-span" face="Calibri,sans-serif">Two questions:</font></div>
<div><font class="Apple-style-span" face="Calibri,sans-serif"><br>
</font></div>
<ol>
<li><font class="Apple-style-span" face="Calibri,sans-serif">What is best practice when using (require “cocoa") and a project to be </font><span class="Apple-style-span" style="font-family: Calibri, sans-serif; ">loaded from quicklisp?</span></li><li><font class="Apple-style-span" face="Calibri,sans-serif">Do I need to bring in all the Objective-C bridge just to use the </font><span class="Apple-style-span" style="font-family: Calibri, sans-serif; ">clipboard? I.e. Is there a lighter-weight way to access
 pasteboard?</span></li></ol>
<div><font class="Apple-style-span" face="Calibri,sans-serif"><br>
</font></div>
<div><font class="Apple-style-span" face="Calibri,sans-serif">Happy Christmas,</font></div>
<div><font class="Apple-style-span" face="Calibri,sans-serif"><span class="Apple-tab-span" style="white-space:pre"></span>- Steve</font></div>
<div><font class="Apple-style-span" face="Calibri,sans-serif"><br>
</font></div>
<div><font class="Apple-style-span" face="Calibri,sans-serif"><br>
</font></div>
<div><font class="Apple-style-span" face="Calibri,sans-serif"><br>
</font></div>
</div>
</div>
</div>
<span id="OLK_SRC_BODY_SECTION" style="font-size: 14px; font-family: Calibri, sans-serif;">
<div style="font-family: Calibri; font-size: 11pt; text-align: left; border-width: 1pt medium medium; border-style: solid none none; padding: 3pt 0in 0in; border-top-color: rgb(181, 196, 223);">
<span style="font-weight:bold">From: </span>Ron Garret <<a href="mailto:ron@flownet.com">ron@flownet.com</a>><br>
<span style="font-weight:bold">Date: </span>Monday, 22 December 2014 11:22 <br>
<span style="font-weight:bold">To: </span>Steven Núñez <<a href="mailto:sales@illation.com">sales@illation.com</a>><br>
<span style="font-weight:bold">Cc: </span>"<a href="mailto:openmcl-devel@clozure.com">openmcl-devel@clozure.com</a>" <<a href="mailto:openmcl-devel@clozure.com">openmcl-devel@clozure.com</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [Openmcl-devel] GraphSketcher Anyone? (or: can I write to the clipboard)<br>
</div>
<div><br>
</div>
<div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
Turns out objc:make-nsstring is a built-in function now, so you can just do this:
<div><br>
</div>
<div>
<div>(defun write-to-clipboard (string)</div>
<div>  (let ((pb (#/generalPasteboard ns:ns-pasteboard)))</div>
<div>    (#/clearContents pb)</div>
<div>    (objc:with-autorelease-pool</div>
<div>      (#/writeObjects: pb (#/initWithObject:</div>
<div>                           (#/alloc ns:ns-array)</div>
<div>                           (objc:make-nsstring string))))))</div>
</div>
<div><br>
<div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</span>
</div>

</blockquote></div><br></div></div></body></html>