Closed behrica closed 9 years ago
I found a partial solution. Emacs ISpell has a command "ispell-comments-and-strings" which is clojure aware. So it does work relatively well on the clj files written by gorilla.
Unfortunately the output of clojure commands is inside of comments as well. In my case, there is rather long text (from clojure lists), which is pure garbage from the spell checking perspective.
It would be nice, if I could save a file from the Gorilla application "without the command outputs".
So that instead of saving: ;; @@ ;; => ;;; {"type":"html","content":"25701","value":"25701"} ;; <=
it would save it "empty": ;; @@ ;; =>
;; <=
I wrote a little script, which replaces automatically all occurrences of
;; =>
;;; {"type":"html","content":"25701","value":"25701"}
;; <=
by
;; =>
;;;
;; <=
The resulting clj file is still valid and can be loaded into gorilla.
By looking at this, I was wondering why the output is part of the saved file anyway ? I think it would be better in any case to not save the output at all. The output in the file might make efficient version control on the file impractical.
So I have a workarround... But I am still wondering, if Gorilla itself can do anything to better support the spell checking.
For me this is nearly a show stopper for using Gorilla for analysis, specially by comparing it with knitr (and the spell checker) in RStudio.
Yes embedding the output in the file is a double edged sword. It's done because a worksheet is supposed to be a self contained document. Imagine transferring a file between systems where the available resources are different or dependencies are missing e.g. a hadoop or spark cluster. The output is as much part of the the document as the text and code.
I'm not sure if I understand you correctly. You want spell checking in the code comments and strings rf in the markdown segments?
Embedded output is an important part of the worksheets, so I think that it must stay. One thing we could add though, that would be convenient for people who want to remove the output would be a "delete all output" command. That would at least make the process of stripping the worksheet before save easier.
I haven't looked into adding spell-checking yet, but I think it's probably going to be tricky.
My use case is "spell checking" of the text I typed....
Either in the Gorilla Web Interface (but could be difficult / impossible to do)
or
find a way to spell check the "saved clj file from Gorilla" with any editor. (this is not easy right know, because the saved clj contains "text", "code" and "output", but I only want to check the spelling of "text") So you could consider this an "editor problem"....
Having a way to remove the "output" from the saved clojure file, makes it possible to use other Clojure editors for the spell checking. Having the output in "clojure comments" as currently, lets the editor check the spelling of the output as well, which creates lots of false-positive for "spelling mistakes" , up to the point that the overall spell checking becomes useless.
I'd like to support spell-checking if possible, as it's useful and it makes the software more accessible too. Looking at the Codemirror docs, it looks like there's an option to enable spell checking, so it might not be too hard. I'll take a look at it when I have a little time.
I'll open a separate issue for the "delete all output" command, as I think that is independently useful.
@ticking Just for my understanding.
Why is in your view the output part of the document ?
I am used to work with "knitr", from R. And there is no way to save the output as part of the document.
In "knitr" there is even the idea that the "code" gets "replaced" by the output during rendering. So a kind of template mechanism. (and to keep the code is just an option, which can be turned of and on)
I see of course, that Gorilla works very different then knitr. Maybe is follows more the IPython notebook style ?
Yes, like IPython or Mathematica gorilla is a notebook system.
To elaborate.
In knitr you have the concept of a write time, and a compile time. Making the external R repl of R-Studio necessary if you want live development.
You "program" the document by source and the compile it into html.
In gorilla there is no such distinction, you are always working in the final document. Live. This makes it not only WYSIWYG but also allows you to use it during exploratory development or as a Clojure IDE.
I for example scraped my emacs workflow in favour of gorilla, in comparison I don't think one would be able to replace R-Studio with knitr only.
Cheers Jan
I'd agree with all that @ticking said. I tend to think of knitr etc as reproducible report/article generation tools, whereas the notebook style of Gorilla/Mathematica/IPython I think of more like a lab-book. For me, I often use it as a record of my experimentation, and in that context, the output makes sense.
There's a long-standing plan to support an "offline" compile-type workflow, like in knitr, which would allow Gorilla worksheets to act as templates for report generation (see #7).
Thanks for the comments.
Regarding the spell checking, #175, can be a good option. This would ease a lot to do a "one time spell check" with an external Clojure Editor.
Maybe you want to create an other issue for investigating, if CodeMirror can be configured to do spell checking, so we could close this issue
Let's make this one the "CodeMirror spell checking" issue - no need for a new one :-)
So, spell checking in CodeMirror isn't going to be easy ... turns out the CodeMirror docs I mentioned above were for version 1 :-( Subsequent versions don't support spell-checking. I found some discussion by the IPython people, who are using Typo.js in a CodeMirror overlay to do the spell checking themselves.
http://mail.scipy.org/pipermail/ipython-dev/2014-July/014493.html
This would be a lot of work though, and would introduces headaches like providing UI for the user to specify their language etc.
I think, for the moment this will be a case of Gorilla does it if/when CodeMirror does it. Or, I suppose, if we ever move away from CodeMirror. So I'm going to close this one as "won't fix" for the moment. (Note that the delete output command #175 is now implemented in develop, which should provide a workaround at least. I'll put out an "0.3.5-SNAPSHOT" release shortly with it in.)
I was looking for a way to get spell checking working in Gorilla.
It seems to be impossible, as it is not supported via Code Mirror and the fields are non input fields, so the browser based spell checking does not work neither.
So I was looking for a workaround...
But even that seems to be hard, as I did not find any editor, which could be told to "spell check only lines starting with ;;;"
I tried notepad++, Emacs, Intellij .... none does waht I want.
In reality I is even more complex to extract from the raw report.clj file "the text I typed".
It is probably something such as checking only
"all lines starting with ;;;
But even with that, I still have the output from the commands.
Maybe you have an advise on how to handle that.