franks42 / clj-ns-browser

Smalltalk-like namespace/class/var/function browser for clojure docs and source-code based on seesaw
Eclipse Public License 1.0
175 stars 11 forks source link

results of Browse button are tiny and unreadable #47

Closed uvtc closed 12 years ago

uvtc commented 12 years ago

On Lubuntu 12.04, with Leiningen 2.0.0-preview4 on Java 1.6.0_24 OpenJDK 64-Bit Server VM, using Clojure 1.4.0, when I click the Browse button, the resulting java/swing window that pops up contains unreadably-tiny text.

My default browser is Firefox, so I'd assume that the Browse button would cause a new tab to open in the front-most Firefox window.

Also though, since the clj-ns-browser window Doc text area already contains the relevant clojuredocs url, I can just copy/paste that url into a new browser tab and visit the clojuredocs page that way. So, I'm not sure how useful the Browse button is. Maybe should the browse button be removed?

jafingerhut commented 12 years ago

clj-ns-browser uses (clojure.java.browse/browse-url "URL-string") to attempt to open a browser window. On an Ubuntu 11.10 system running Leiningen 2.0.0-preview4 and Java 1.7.0_02 from Oracle, clicking the Browse button does open a tab in Firefox. Strangely, evaluating an expression like that at the REPL open up the Chromium browser. I don't know why it uses two different browsers, but the issue is likely a problem with the implementation of clojure.java.browse/browse-url on the particular OS/JDK combo.

The implementation of clojure.java.browse/browse-url is pretty small in Clojure -- we could consider copying it and modifying it in clj-ns-browser until such time as it is improved in Clojure itself. CLJ-896 has a patch that might improve things:

http://dev.clojure.org/jira/browse/CLJ-896

jafingerhut commented 12 years ago

My attempted fix makes the menu items under the "Help" menu that open URLs work better on Lubuntu, but not the Browse button, because the Browse button uses a browse-url call that is inside the clj-info namespace.

Frank, any objection to adding some kind of optional argument to clj-info/bdoc*, one that specifies a function to call besides clojure.java.browse/browse-url? In the default case it would still call that function, but if the caller overrode that, it could call something else.

uvtc commented 12 years ago

Just some updated info: Today I changed distros from Lubuntu to Ubuntu (using Gnome shell) --- still 12.04 --- and using the same versions of Lein, Java, and Clojure, though using 1.3.0-SNAPSHOT of clj-ns-browser, I get the same issues with the unreadably-tiny fonts after hitting that Browse button.

As for the menu items under the "Help" menu, some give me a page with a solid blue background (such as "clj-ns-browser wiki" or "clojure.org", and others are just not terribly readable (such as "clojure cheatsheet" or "clojuredocs...").

I might suggest that if clj-ns-browser is unable to have the user's preferred browser open the page, then maybe it's better to just pop up a dialog ("Sorry, unable to open your preferred web browser. Please use this link: ....") with the link in it that they could copy/paste to their browser.

jafingerhut commented 12 years ago

If you are interested, you may try out the latest version of clj-ns-browser without waiting for a release. It may at least fix the problem when you use the "Help" menu items to open a web page, even if it doesn't fix the Browse button problem yet.

First retrieve a local copy of the clj-ns-browser source code. You may need to install the "git" package first if it is not already on your system:

% git clone git://github.com/franks42/clj-ns-browser.git [ ... some lines of output here while git retrieves the code ... ] % cd clj-ns-browser % lein repl [ ... perhaps many lines of output here while leiningen retrieves other needed libs ... ] user=> (use 'clj-ns-browser.sdoc) user=> (sdoc)

Then try out the Help menu items to see if they open web pages in your preferred browser.

uvtc commented 12 years ago

Andy, that actually isn't working for me. I get:

john@garnet:~/github-repos/clj-ns-browser$ lein repl
Could not find artifact org.clojure:clojure:pom:1.+ in central (http://repo1.maven.org/maven2)
Could not find artifact org.clojure:clojure:pom:1.+ in clojars (http://clojars.org/repo/)
Could not find artifact org.clojure:clojure:pom:1.+ in stuartsierra-releases (http://stuartsierra.com/maven2)
Could not find artifact org.clojure:clojure:pom:1.+ in central (http://repo1.maven.org/maven2)
Could not find artifact org.clojure:clojure:pom:1.+ in clojars (http://clojars.org/repo/)
Could not find artifact org.clojure:clojure:pom:1.+ in stuartsierra-releases (http://stuartsierra.com/maven2)
Could not find artifact org.clojure:clojure:pom:1.+ in central (http://repo1.maven.org/maven2)
Could not find artifact org.clojure:clojure:pom:1.+ in clojars (http://clojars.org/repo/)
Could not find artifact org.clojure:clojure:pom:1.+ in stuartsierra-releases (http://stuartsierra.com/maven2)
Compiling clj-ns-browser.core
REPL server launch timed out.
john@garnet:~/github-repos/clj-ns-browser$ 
jafingerhut commented 12 years ago

Does it do that repeatedly, if you try it multiple times?

I saw a "REPL server launch timed out" message recently, and tried the "lein repl" command again and it worked the next time.

I don't know why that timeout occurred in my case, or in yours, but it seems that there are at least some cases in which it can be transient.

uvtc commented 12 years ago

Yes, does it every time.

The last step "Compiling clj-ns-browser.core" uses cpu and takes about 24 seconds before I get "REPL server launch timed out".

jafingerhut commented 12 years ago

I've been able to reproduce this behavior on a slower computer than the one I normally use. There is a 30-second timeout in the "lein repl" command that causes it to abort, even if there is some long-running compilation that needs to occur before "lein repl" is ready to bring up the REPL prompt.

I have written some instructions for compiling your own local version of clj-ns-browser at the Wiki page linked below, under the heading "Compiling and installing your own local version from source". Try them out if you wish:

https://github.com/franks42/clj-ns-browser/wiki/Install

jafingerhut commented 12 years ago

Should be fixed now for items in Help menu, and for the Browse button.