Group Abstract Group Abstract

Message Boards Message Boards

1
|
7.8K Views
|
10 Replies
|
8 Total Likes
View groups...
Share
Share this post:

Disable auto-formatting of code?

Posted 8 years ago

Hi, how do I disable auto-formatting of code in mathematica?

Redrawing and reformatting of the entire screen per every key stroke makes mathematica absolutely unusable (I can type one line of formula and then watch for 15 second paragraphs jumping up and down on the page). Also, mathematica's randomly inserted/deleted line breaks make me crazy. Inserted line breaks make the code unreadable. Automatically deleted line breaks break the code (e.g., automatic concatenation of commented-out lines!). Also, automatic substitutions of character sequences to obscure utf8 characters make the code much harder to deal with. I have not yet seen so screwed-up text editor...

POSTED BY: waldir anonymous
10 Replies

You might also consider Workbench: http://www.wolfram.com/workbench

POSTED BY: Vitaliy Kaurov

Yes, 'code' behaves much better with respect to 'user experience'.

With respect to the response, it does not improve the situation much. Highlight/autocomplete/indent functionality still triggers unneccesary redrawing.

POSTED BY: waldir anonymous

I have a feeling this might be because it is done using software rendering. Anyhow, you can also disable syntax highlighting in the settings:

enter image description here

I've only used it locally and there it is instantaneously. Never had a problem with it...

POSTED BY: Sander Huisman

Ah, here it is!

Yep, I was afraid of the limits of software-sided font rasterisation. Still, after disabling function highlights, movement works fine and the response is much more 'regular'.

I guess this might be considered as solved. Thanks very much!

POSTED BY: waldir anonymous

Alternatively you could also write a .m file (regular text file) and run that directly on the kernel... Then you can use any editor you like...

good luck!

POSTED BY: Sander Huisman

Well, this is a perfect solution! I had no idea that there was a standalone interpreter.

In case someone stumbles upon this thread and wishes to use the commandline interpreter:

  • '$ ./WolframKernel' provides the text interpretter

  • graphics output may be obtained by entering once '<< JavaGraphics` '. All graphics will then be automatically opened.

  • tmux, vim and slime (vim addon for output redirection) allow elegant workflow

POSTED BY: waldir anonymous

For such a short code it should be instantaneous actually. But maybe because you use it remotely makes it awkward. The cell style is by default "Input". Try changing it to "Code". Right-click on the bracket of any cell, choose style, and then "Code".

POSTED BY: Sander Huisman

Ubuntu linux, mathematica 11.0, Intel Core i5–6500 3.20GHz with 8 GiB RAM; Ran over X forwarding (ssh with -XYC).

Example notebook: anything. E.g.,

(*helper function*)
MyJoin[l_, pts_] := 
 If[OddQ[Length[pts]], Join[l, pts], Join[l, Reverse[pts]]]

(*the algorithm itself*)

calcCasteljau[pts_, pts2_, t_] := 
 Table[pts[[i]]*(1 - t) + pts2[[i]]*t, {i, 1, Length[pts]}]
rankedCasteljau[pts_, t_, acum_] := 
 If[Length[pts] == 1, MyJoin[acum, pts], 
  rankedCasteljau[calcCasteljau[Drop[pts, -1], Drop[pts, 1], t], t, 
   MyJoin[acum, pts]]]

(*overloads for the basic casteljau algorithm-*)

casteljau[pts_, t_] := rankedCasteljau[pts, t, {}]
casteljauLast[pts_, t_] := {rankedCasteljau[pts, t, {}][[-1]]}

(*drawing functions*)

showCasteljau2[pts_, ptsOrig_] := 
 Show[ListPlot[pts, PlotMarkers -> Automatic], ListLinePlot[pts], 
  ParametricPlot[casteljauLast[ptsOrig, t], {t, 0, 1}]]
showCasteljau[pts_, t_] := showCasteljau2[casteljau[pts, t], pts]


Manipulate[
 showCasteljau[{{0, 0}, {0, 1}, {1, 1}, {1, 0}, {2, 0}, {2, 1}}, 
  t], {t, 0, 1}]

Slower response caused by the forwarding is of course anticipated. The problem is that:

  • that the entire screen is reformatted and rerenderred (with significant and anyway annoying changes) per every key stroke, which of course causes a lag when working with an X forwarded window. I want just to turn the formatting off so that it runs as smoothly as any normal text editor.

  • I do not want mathematica to tell me where my new-lines should be (e.g., any copy paste reformats the code)

POSTED BY: waldir anonymous

Have you tried the "Code" cell style?

POSTED BY: Gianluca Gorni

OS, version, example notebook, computer specs?

POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard