[Openmcl-devel] GraphSketcher Anyone? (or: can I write to the clipboard)
ron at flownet.com
Thu Dec 25 17:24:21 UTC 2014
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.
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.
On Dec 25, 2014, at 9:01 AM, Steven Núñez <sales at illation.com> wrote:
> Hi Ron,
> Thanks. That code works well and shaves a good bit of awkwardness off the workflow. I¹ve got one problem however: loading the file containing the code via quicklisp, e.g. (ql:quickload “foo") errors out in the reader when parsing that code. The problem appears to be related to (require “cocoa") not being evaluated before the write-to-clipboard function is. It works fine in slime/emacs when evaluating things individually (perhaps it is a timing issue?)
> Two questions:
> What is best practice when using (require “cocoa") and a project to be loaded from quicklisp?
> Do I need to bring in all the Objective-C bridge just to use the clipboard? I.e. Is there a lighter-weight way to access pasteboard?
> Happy Christmas,
> - Steve
> From: Ron Garret <ron at flownet.com>
> Date: Monday, 22 December 2014 11:22
> To: Steven Núñez <sales at illation.com>
> Cc: "openmcl-devel at clozure.com" <openmcl-devel at clozure.com>
> Subject: Re: [Openmcl-devel] GraphSketcher Anyone? (or: can I write to the clipboard)
> Turns out objc:make-nsstring is a built-in function now, so you can just do this:
> (defun write-to-clipboard (string)
> (let ((pb (#/generalPasteboard ns:ns-pasteboard)))
> (#/clearContents pb)
> (#/writeObjects: pb (#/initWithObject:
> (#/alloc ns:ns-array)
> (objc:make-nsstring string))))))
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Openmcl-devel