klipse

raymcdermott 2017-06-06T08:16:59.445833Z

I want to add cljs-time to my klipse blog … is this supported? [https://github.com/andrewmcveigh/cljs-time]

Yehonathan Sharvit 2017-06-06T08:17:29.452929Z

You need to try

raymcdermott 2017-06-06T08:17:58.459581Z

I have seen the blog post http://blog.klipse.tech/klipse/2016/10/16/klipse-is-fast.html

raymcdermott 2017-06-06T08:18:16.464048Z

but cannot see how to bring a CLJS lib in

Yehonathan Sharvit 2017-06-06T08:18:52.472491Z

It’s not explained here

raymcdermott 2017-06-06T08:19:16.478007Z

that’s a relief 😉

Yehonathan Sharvit 2017-06-06T08:19:40.483373Z

You need to have a klipse snippet with data-external-libs=<https://raw.githubusercontent.com/andrewmcveigh/cljs-time/master/>

Yehonathan Sharvit 2017-06-06T08:20:12.490638Z

And the content of the snippet will something like : require '[cljs-time.core :as t]

Yehonathan Sharvit 2017-06-06T08:20:28.494486Z

data-external-libs is like the classpath

raymcdermott 2017-06-06T08:20:33.495650Z

I’ll give it a go

Yehonathan Sharvit 2017-06-06T08:20:42.497760Z

it tells klipse where to resolve the namespaces

raymcdermott 2017-06-06T08:20:45.498300Z

I saw that

raymcdermott 2017-06-06T08:20:58.501293Z

but wasn’t sure how to form the URL for the lib

raymcdermott 2017-06-06T08:22:35.524805Z

I guess I could also use a tag rather than master

Yehonathan Sharvit 2017-06-06T08:22:46.527205Z

yes

Yehonathan Sharvit 2017-06-06T08:22:52.528534Z

it might be a better idea

Yehonathan Sharvit 2017-06-06T08:23:26.536375Z

I’d appreciate if you could improve the instructions for using external libs

Yehonathan Sharvit 2017-06-06T08:23:32.537545Z

it confuses a lot of people

raymcdermott 2017-06-06T08:24:12.546915Z

sure - if I get it to work, I’ll try to help

Yehonathan Sharvit 2017-06-06T08:24:24.549920Z

Awesome:metal:

raymcdermott 2017-06-06T08:34:50.704977Z

it’s not working yet so don’t get to excited 😛

Yehonathan Sharvit 2017-06-06T08:35:00.707207Z

ah

raymcdermott 2017-06-06T08:35:08.709141Z

#error {:message “No such namespace: cljs-time.core, could not locate cljs_time/core.cljs, cljs_time/core.cljc, or Closure namespace \“cljs-time.core\“”, :data {:tag :cljs/analysis-error}}

raymcdermott 2017-06-06T08:35:44.718169Z

this is the code I have…

Yehonathan Sharvit 2017-06-06T08:36:29.729051Z

sorry, I made a mistake in the data-external-libs

Yehonathan Sharvit 2017-06-06T08:36:42.732162Z

It has to be: data-external-libs=<https://raw.githubusercontent.com/andrewmcveigh/cljs-time/master/src>

Yehonathan Sharvit 2017-06-06T08:36:57.735484Z

Notice the src at the end

raymcdermott 2017-06-06T08:38:13.753823Z

yes, makes no difference

raymcdermott 2017-06-06T08:39:33.773240Z

maybe it should have /cljs_time also

Yehonathan Sharvit 2017-06-06T08:39:41.775006Z

no

Yehonathan Sharvit 2017-06-06T08:39:48.776693Z

what error do you see now?

raymcdermott 2017-06-06T08:40:26.786284Z

no 🙂

raymcdermott 2017-06-06T08:41:14.798631Z

#error {:message “No such namespace: cljs-time.core, could not locate cljs_time/core.cljs, cljs_time/core.cljc, or Closure namespace \“cljs-time.core\“”, :data {:tag :cljs/analysis-error}}

raymcdermott 2017-06-06T08:42:11.811991Z

I am doing it within a deckjs presentation

Yehonathan Sharvit 2017-06-06T08:42:28.816435Z

It shouldn’t make a difference

Yehonathan Sharvit 2017-06-06T08:42:32.817456Z

Let me try

raymcdermott 2017-06-06T08:42:48.821136Z

I thought not but mention it for completeness

Yehonathan Sharvit 2017-06-06T08:43:04.824980Z

What’s the topic of your presentation?

raymcdermott 2017-06-06T08:43:39.833497Z

It’s a bunch of jokes about Clojure and FP, written in Clojure

raymcdermott 2017-06-06T08:43:58.837935Z

I previously had to swap between keynote and the terminal

raymcdermott 2017-06-06T08:44:15.842256Z

and I would rather do it all in one 🙂

Yehonathan Sharvit 2017-06-06T08:44:38.847847Z

Yeah!

raymcdermott 2017-06-06T08:45:26.859891Z

for example I make a macro called joke that can be called with a story and a punchline

raymcdermott 2017-06-06T08:45:48.865412Z

but it has no side effects

raymcdermott 2017-06-06T08:46:01.868549Z

and jokes should always have a side effect

raymcdermott 2017-06-06T08:46:20.873306Z

otherwise it’s a quantum joke

arnaud_bos 2017-06-06T08:46:31.875958Z

I'm screenshoting that

raymcdermott 2017-06-06T08:46:49.880116Z

what?

arnaud_bos 2017-06-06T08:47:09.884741Z

The four sentences, out of context it's hilarious

raymcdermott 2017-06-06T08:47:34.891137Z

LOL, it’s meant to be a joke so I’m happy about that 🙂

raymcdermott 2017-06-06T08:48:06.898947Z

I can see I’m going to have t o be careful not to reveal too much here!

arnaud_bos 2017-06-06T08:49:11.914715Z

It was last year's EuroClojure where you did a clojure jokes "unsession" or something, right?

raymcdermott 2017-06-06T08:49:34.920198Z

yes, I’m hoping to do the same this year too

raymcdermott 2017-06-06T08:49:50.924309Z

I have an unsession booked at least

arnaud_bos 2017-06-06T08:50:23.932428Z

Cool, I'll probably book my ticket and flight sometime this week, when are the unsessions?

raymcdermott 2017-06-06T08:50:44.937448Z

normally on the Thursday evening

arnaud_bos 2017-06-06T08:52:13.959894Z

Perfect, I was disappointed not to go to EuroClojure last year, hopefully I'll see your unsession this year.

raymcdermott 2017-06-06T08:52:59.971450Z

that would be great

Yehonathan Sharvit 2017-06-06T09:15:02.306741Z

@raymcdermott I think I found the issue

Yehonathan Sharvit 2017-06-06T09:15:13.309499Z

Could you try

(require 'goog.i18n.DateTimeSymbols
         '[cljs-time.core :as t])

Yehonathan Sharvit 2017-06-06T09:15:22.311855Z

?

raymcdermott 2017-06-06T09:22:52.423189Z

#error {:message “Could not eval my.klipse”, :data {:tag :cljs/analysis-error}, :cause #error {:message “Only :as alias, :refer (names) and :rename {from to} options supported in :require; offending spec: (quote goog.i18n.DateTimeSymbols) at line 1 “, :data {:file nil, :line 1, :column 1, :tag :cljs/analysis-error}}}

Yehonathan Sharvit 2017-06-06T09:23:36.434542Z

can you show me the page source?

raymcdermott 2017-06-06T09:23:52.438501Z

#error {:message “Could not eval my.klipse”, :data {:tag :cljs/analysis-error}, :cause #error {:message “Only :refer-clojure, :require, :require-macros, :use, :use-macros, and :import libspecs supported. Got (require (quote goog.i18n.DateTimeSymbols) (quote [cljs-time.core :as t])) instead. at line 1 “, :data {:file nil, :line 1, :column 1, :tag :cljs/analysis-error}}}

raymcdermott 2017-06-06T09:24:12.443509Z

I used :require, not require first

Yehonathan Sharvit 2017-06-06T09:24:43.451427Z

That should work also

Yehonathan Sharvit 2017-06-06T09:25:26.462050Z

oh no!

Yehonathan Sharvit 2017-06-06T09:25:52.468319Z

You cannot put (require) inside a ns

Yehonathan Sharvit 2017-06-06T09:25:59.470263Z

You have to use :require

Yehonathan Sharvit 2017-06-06T09:26:05.471677Z

but without the quotes

raymcdermott 2017-06-06T09:26:22.475739Z

I had that… but OK let me revert

Yehonathan Sharvit 2017-06-06T09:26:31.478076Z

Also it is better to put the require statement in a separate snippet

Yehonathan Sharvit 2017-06-06T09:26:50.482429Z

Then it is not re-evaluated when you modify your code

raymcdermott 2017-06-06T09:27:05.486036Z

#error {:message “No such namespace: cljs-time.core, could not locate cljs_time/core.cljs, cljs_time/core.cljc, or Closure namespace \“cljs-time.core\“”, :data {:tag :cljs/analysis-error}}

Yehonathan Sharvit 2017-06-06T09:27:08.486704Z

also, you have a typo

Yehonathan Sharvit 2017-06-06T09:27:19.489376Z

It should be

Yehonathan Sharvit 2017-06-06T09:27:26.491114Z

&lt;code class="clojure"
              data-external-libs="https://raw.githubusercontent.com/andrewmcveigh/cljs-time/master/src/"&gt;

raymcdermott 2017-06-06T09:28:52.512086Z

LOL yes the typo

raymcdermott 2017-06-06T09:28:59.513615Z

OK, it’s working now!!

Yehonathan Sharvit 2017-06-06T09:29:06.515307Z

COOL!!!

raymcdermott 2017-06-06T09:29:48.525413Z

does Klipse support macros (I assume yes)

Yehonathan Sharvit 2017-06-06T09:30:18.533126Z

yes

raymcdermott 2017-06-06T09:30:48.540946Z

OK, let me play with that and I promise to do a little write-up on external libs

Yehonathan Sharvit 2017-06-06T09:31:38.553452Z

When using macro, you have to do a special trick with the namespace

Yehonathan Sharvit 2017-06-06T09:31:40.553827Z

See http://blog.klipse.tech/clojure/2016/05/01/macro-tutorial-1.html

Yehonathan Sharvit 2017-06-06T09:32:14.562105Z

And be careful not to create more than 1 ns in your presentation

Yehonathan Sharvit 2017-06-06T09:32:20.563837Z

otherwise it’s going to be a big mess

raymcdermott 2017-06-06T09:33:04.574347Z

Good tip!

Yehonathan Sharvit 2017-06-06T09:33:30.580411Z

And I have a surpris for you

Yehonathan Sharvit 2017-06-06T09:33:48.584778Z

While we were talking, I have added cljs-time to the analysis cache of Klipse

raymcdermott 2017-06-06T09:33:50.585416Z

so can I put the ns/require in a snippet at the top and assume it’s going to be usable everywhere?

Yehonathan Sharvit 2017-06-06T09:34:01.587912Z

correct

raymcdermott 2017-06-06T09:34:03.588445Z

haha, cool

Yehonathan Sharvit 2017-06-06T09:34:14.591237Z

Starting from Klipse version 7.1.1

Yehonathan Sharvit 2017-06-06T09:34:24.593807Z

you don’t need the data-external-libs

Yehonathan Sharvit 2017-06-06T09:34:26.594138Z

in order to use cljs-time

Yehonathan Sharvit 2017-06-06T09:34:43.598374Z

and it loads much faster

raymcdermott 2017-06-06T09:35:30.609823Z

so will that get picked up automagically now?

Yehonathan Sharvit 2017-06-06T09:35:40.612327Z

exactly

raymcdermott 2017-06-06T09:36:12.619716Z

I mean “http://app.klipse.tech/plugin/js/klipse_plugin.js” is now 7.1.1?

Yehonathan Sharvit 2017-06-06T09:36:51.629037Z

yes

raymcdermott 2017-06-06T09:36:57.630403Z

sweeeeet!

Yehonathan Sharvit 2017-06-06T09:37:07.632830Z

You can check the browser console

Yehonathan Sharvit 2017-06-06T09:37:12.634108Z

to see what version you get

raymcdermott 2017-06-06T09:38:03.646708Z

ok, I’ll give it a shot

raymcdermott 2017-06-06T09:39:25.666531Z

boom, yes that works

raymcdermott 2017-06-06T11:27:10.089987Z

something else I’m having an issue with…. hiding code

raymcdermott 2017-06-06T11:27:14.090904Z

if I do this

raymcdermott 2017-06-06T11:27:58.099593Z

I get this

Yehonathan Sharvit 2017-06-06T11:28:39.107693Z

the snippet is not hidden at all!!

raymcdermott 2017-06-06T11:29:04.112572Z

you see my problem

raymcdermott 2017-06-06T11:29:09.113600Z

quite literally

Yehonathan Sharvit 2017-06-06T11:29:27.117335Z

You need to create a css rule that hides element with class hidden

Yehonathan Sharvit 2017-06-06T11:29:30.117949Z

something like

raymcdermott 2017-06-06T11:29:44.120646Z

oh, I thought that was with klipse

Yehonathan Sharvit 2017-06-06T11:29:45.120971Z

.hidden {
visibility: hidden
}

Yehonathan Sharvit 2017-06-06T11:29:55.122935Z

It’s not part of klipse

raymcdermott 2017-06-06T11:30:49.134625Z

it’s in the manual

Yehonathan Sharvit 2017-06-06T11:31:12.139178Z

is it form the gitbook?

raymcdermott 2017-06-06T11:31:15.139986Z

yes

Yehonathan Sharvit 2017-06-06T11:31:28.142582Z

that’s because gitbook has such a css rule

Yehonathan Sharvit 2017-06-06T11:31:44.145989Z

Probably, I need to make it clearer

raymcdermott 2017-06-06T11:31:50.147201Z

haha ok

raymcdermott 2017-06-06T11:36:27.203058Z

the css rule does not collapse the space that the code would have occupied

raymcdermott 2017-06-06T11:36:40.205522Z

I’m not a CSS guru

raymcdermott 2017-06-06T11:36:47.206955Z

so any clues would be appreciated

raymcdermott 2017-06-06T12:00:45.509399Z

.hidden { display: none; }

raymcdermott 2017-06-06T12:01:12.515907Z

does the right thing - the visibility CSS rule is literally bullshit

raymcdermott 2017-06-06T12:11:37.662190Z

I have the macros working now too - so that’s cool and the gang