I'm very new with emacs, so please forgive me if this is a silly question. I'm having an issue while programming in Ocaml using tuareg (https://github.com/ocaml/tuareg)
When I evaluate a single expression that produces a very long output (displayed in the Ocaml buffer), the output gets truncated with ellipsis. For example, if I call a function to print the first 1000 natural numbers, it stops at the 300th element, like this:
# range 1000;;
- : int list =
[1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21;
22; 23; 24; 25; 26; 27; 28; 29; 30; 31; 32; 33; 34; 35; 36; 37; 38; 39; 40;
41; 42; 43; 44; 45; 46; 47; 48; 49; 50; 51; 52; 53; 54; 55; 56; 57; 58; 59;
60; 61; 62; 63; 64; 65; 66; 67; 68; 69; 70; 71; 72; 73; 74; 75; 76; 77; 78;
79; 80; 81; 82; 83; 84; 85; 86; 87; 88; 89; 90; 91; 92; 93; 94; 95; 96; 97;
98; 99; 100; 101; 102; 103; 104; 105; 106; 107; 108; 109; 110; 111; 112;
113; 114; 115; 116; 117; 118; 119; 120; 121; 122; 123; 124; 125; 126; 127;
128; 129; 130; 131; 132; 133; 134; 135; 136; 137; 138; 139; 140; 141; 142;
143; 144; 145; 146; 147; 148; 149; 150; 151; 152; 153; 154; 155; 156; 157;
158; 159; 160; 161; 162; 163; 164; 165; 166; 167; 168; 169; 170; 171; 172;
173; 174; 175; 176; 177; 178; 179; 180; 181; 182; 183; 184; 185; 186; 187;
188; 189; 190; 191; 192; 193; 194; 195; 196; 197; 198; 199; 200; 201; 202;
203; 204; 205; 206; 207; 208; 209; 210; 211; 212; 213; 214; 215; 216; 217;
218; 219; 220; 221; 222; 223; 224; 225; 226; 227; 228; 229; 230; 231; 232;
233; 234; 235; 236; 237; 238; 239; 240; 241; 242; 243; 244; 245; 246; 247;
248; 249; 250; 251; 252; 253; 254; 255; 256; 257; 258; 259; 260; 261; 262;
263; 264; 265; 266; 267; 268; 269; 270; 271; 272; 273; 274; 275; 276; 277;
278; 279; 280; 281; 282; 283; 284; 285; 286; 287; 288; 289; 290; 291; 292;
293; 294; 295; 296; 297; 298; 299; ...]
Obviously in this example the issue is trivial, however I have another project I'm working on where I need to see what's going on with the rest of my output.
I didn't find a way to display the entire thing, the closest I found is the "print length" setting... but that's only for Lisp. I also tried pressing the RET
key on the ellipsis but it doesn't work.
Does anyone have a solution?
EDIT: My apologies, I'll add some clarification. The problem itself isn't in the code, that was just an example, but I'll elaborate further.
The function range is the following:
let rec range = function
1 -> 1::[]
| n -> range (n-1) @ [n];;
it simply prints n natural numbers. So I evaluate that by pressing either C-c C-e
, or C-x C-e
, or even evaluating the entire buffer with C-c C-b
(I've tried all of these and it doesn't make any difference for this particular issue) and this is the output:
# let rec range = function
1 -> 1::[]
| n -> range (n-1) @ [n];;
val range : int -> int list = <fun>
Nothing strange there. Now if I write
range 10;;
and evaluate it with C-c C-e
(or any of the other options I wrote above), what appears in the buffer is:
# range 10;;
- : int list = [1; 2; 3; 4; 5; 6; 7; 8; 9; 10]
Again, nothing strange. But if I try:
range 1000;;
the output shown in the buffer is as I've shown in the original question, truncated. It's not an issue in the actual output of the range function; the function does return a list with the first 1000 natural numbers. This is easily verified by checking how many items there are in the list returned by the range function, for example by using List.length:
# List.length(range 1000);;
- : int = 1000
The problem is, the output is not shown in the buffer. I'll include a screenshot, because I don't know how else to explain it.
As for print-length and print-level, I did try changing them from emacs settings. Now I'm not very confident I've done everything correctly, but even setting it to infinite, it doesn't work. Here is another screenshot:
It probably doesn't work because it only applies to Lisp, but I'm working with Ocaml.
print-length
to, say,nil
help? There's also variableprint-level
, which you can similarly set tonil
.ocaml-mode
?tuareg-mode
? Please specify such info in the question. I've added tagtuareg-mode
. If that's incorrect, please delete it. Thx.