[Openmcl-devel] Openmcl-devel Digest, Vol 134, Issue 20

Steven Núñez steven.nunez at inference.sg
Thu Dec 25 09:05:01 PST 2014


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:


  1.  What is best practice when using (require “cocoa") and a project to be loaded from quicklisp?
  2.  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

P.S. Moderators: please forgive me if you’ve seen this a few times in the moderation queue. I’m having some email problems.

From: Ron Garret <ron at flownet.com<mailto:ron at flownet.com>>
Date: Monday, 22 December 2014 11:22
To: Steven Núñez <sales at illation.com<mailto:sales at illation.com>>
Cc: "openmcl-devel at clozure.com<mailto:openmcl-devel at clozure.com>" <openmcl-devel at clozure.com<mailto: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)
    (objc:with-autorelease-pool
      (#/writeObjects: pb (#/initWithObject:
                           (#/alloc ns:ns-array)
                           (objc:make-nsstring string))))))

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20141225/1f7ed025/attachment.htm>


More information about the Openmcl-devel mailing list