-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathuniline.info
1446 lines (1048 loc) · 52.9 KB
/
uniline.info
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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
This is uniline.info, produced by makeinfo version 6.8 from
uniline.texi.
INFO-DIR-SECTION Emacs
START-INFO-DIR-ENTRY
* Uniline: (uniline). Draw UNICODE diagrams
END-INFO-DIR-ENTRY
File: uniline.info, Node: Top, Next: Getting started in 10 seconds, Up: (dir)
Uniline
*******
*New*: fine tweak at the quarter character scale
* Menu:
* Getting started in 10 seconds::
* Pure UNICODE text diagrams in Emacs::
* Minor mode::
* Drawing lines::
* Brush style::
* The <insert> key::
* Arrows glyphs ▷ ▶ → ▹ ▸ ↔::
* Intersection glyphs ■ ◆ ●::
* Drawing rectangles::
* Moving rectangles::
* Tracing a contour::
* Flood-fill::
* Text direction::
* Macros::
* Fine tweaking::
* Which fonts?::
* Text menus (Hydra)::
* Line spacing::
* How Uniline behaves with its environment?::
* Lisp API::
* Installation::
* Related packages::
* Author, contributors: Author contributors.
* License::
— The Detailed Node Listing —
How ‘Uniline’ behaves with its environment?
* Compatibility with Picture-mode::
* Compatibility with Artist-mode::
* Compatibility with Whitespace-mode::
* Compatibility with Org Mode::
* Org Mode and LaTex::
* What about \t tabs?::
* What about ^L page separation?::
* Emacs on the Linux console::
* Emacs on a graphical terminal emulator::
* Emacs on Windows::
File: uniline.info, Node: Getting started in 10 seconds, Next: Pure UNICODE text diagrams in Emacs, Prev: Top, Up: Top
1 Getting started in 10 seconds
*******************************
• Type ‘M-x uniline-mode’
• Move cursor with the arrow-keys on the keyboard ‘→ ↑ ↓ ←’
• Quit ‘C-c C-c’
File: uniline.info, Node: Pure UNICODE text diagrams in Emacs, Next: Minor mode, Prev: Getting started in 10 seconds, Up: Top
2 Pure UNICODE text diagrams in Emacs
*************************************
Draw diagrams like those:
Document a command:
pdfjam source.pdf 3-5,9
▲ ▲ ▲ ▲
command╶╯ │ │ │
input file╶──╯ │ │
select pages 3,4,5╶───╯ │
and page 9╶──────────────╯
Connect boxes with arrows:
╭───────────────────────╮
╷123╭────▶┤ hundred and something │
╰───╯ ╰───────────────────────╯
╭────▶──╮A╷
╭───╮ ┏━━━┓ ╔═══╗ │ ╰─╯
0╶─→┤ 1 ┝━━━▶┫ 2 ┣═══▷╣ 3 ╟──●────▶──╮B╷
╰───╯ ┗━┯━┛ ╚═╤═╝ │ ╰─╯
╰────←───╯ ╰────▶──╮C╷
╰─╯
╔══════════╗
║ 1 ║ ▐▀▀▀▀▀▀▀▀▜
║ ╭─────╫───╮ ◁──▷ ▐ 3 ▐
╚════╪═════╝ 2 │ ▐▄▄▄▄▄▄▄▄▟
╰─────────╯
Explain decisions trees:
┏━━━━━━━━━━━━┓
┃which color?┃
┗━┯━━━━━━━━━━┛
│ ╭──────╮
│ ╭──┤yellow├─▷╮good─choice╭□
▽ │ ╰──────╯ ╰═══════════╯
╰──● ╭───╮ ┏━━━━━┓
├──┤red├───▷┨dark?┠──╮
│ ╰───╯ ┗━━━━━┛ │
│ ╭───◁──────────────╯
│ │ ╭───╮
│ ╰─●─┤yes├▷╮regular─red╭─□
│ │ ╰───╯ ╰═══════════╯
│ │ ╭──╮
│ ╰─┤no├─▷╮pink╭────────□
│ ╰──╯ ╰════╯
│ ╭────╮
├──┤blue├───▷╮next week╭──□
│ ╰────╯ ╰═════════╯
│ ╭─────╮
╰──┤white├──▷╮available╭──□
╰─────╯ ╰═════════╯
Draw lines or blocks:
╭─╮←─╮
╭╮ │ │ ╰──╴max 235
╭╮││ ╭╯ │
│╰╯│╭─╯ │
╭╮ │ ││ │
╭─╮││╭╮ ╭──╮╭╮ │ ╰╯ ╰╮
╭╯ ╰╯╰╯│ ╭╯ ╰╯╰─╮ │ │ ╭╮
◁─╯ ╰──╯ ╰──╯ ╰─╯╰────▷
◀════════════════════════════════════════▶
╭────────╮
▲ │all time│
┃ ▄ ▗▟█ ←─┤highest │
Qdx █▌ ████ ╰────────╯
┃ ▗▄█▌ █████▙
┃ ▟███████▄█████████▄▄▄ ▗▄
┃▐▄▄████████████████████████████▄▄▖
╺━━━━━━━━━━╸time╺━━━━━━━━━━━━━━━━▶
Explain Lisp lists:
'(a b c)
┏━━━┳━━━┓ ┏━━━┳━━━┓ ┏━━━┳━━━┓
●━━━▶┫ ● ┃ ●─╂──▷┨ ● ┃ ●─╂──▷┨ ● ┃nil┃
┗━┿━┻━━━┛ ┗━┿━┻━━━┛ ┗━┿━┻━━━┛
│ ╰──────────╮╰╮
│ ╭─────┬───────────╮ │ │
╰─▷┤"a\0"│properties │ │ │
├─────┼───────────┤ │ │
│"b\0"│properties ├◁╯ │
├─────┼───────────┤ │
│"c\0"│properties ├◁──╯
├─────┼───────────┤
│... │... │
╵ ╵ ╵
Draw sketched objects:
◀─(-)────────(+)──▶ ~╭──────╮~
▗──────────────╮ ~~│ ╭~~╮ │~~
▐ ╰╮ ~│ ╵ ╵ │~
╭□▐ 1.5 volts ╭╯□╮ ╰─╖ ╓─╯
│ ▝▀▀▀▀▀▀▀▀▀▀▀▀▀▀▘ │ ╠━━╣
│ ╰──────╯ │
╰─────────────────────────────╯
╶╮ ╭╴
┏┳┥▒▒▒▒▒▒▒┝╸
┃┃│▒▒eau▒▒│
┃┃│▒▒▒▒▒▒▒│ ╔═════╗
┃┃╰──╮▒╭──╯ ║ ╶╮ ▽ ╭╴
┃┃ ▒ ║ │ ░ │
┃┃ ▒ ║ │░░░░░░░░░░░░░░│
┃┃ ╚═════╝ │░░░░░░░░░░░░░░╞════▷▒▒
┃┃ │░░░░░akvo░░░░░│ ╶╮ ▒ ╭╴
┃┃ │░░░░░░░░░░░░░░│ │ ▒ │
┃┃ ╰─┲┳━━━━━━━━┳┱─╯ │▒▒▒▒▒▒▒▒▒▒▒│
┃┃ ┃┃ ┃┃ │▒▒▒water▒▒▒│
┃┃ ┃┃ ┃┃ │▒▒▒▒▒▒▒▒▒▒▒│
┃┃ ┃┃ ┃┃ ╰───────────╯
▝▀▀▀▀▀▀▘ ▝▀▘ ▝▀▘ ▀▀▀▀▀▀▀▀▀▀▀▀▀
Those diagrams are pure text. There is nothing graphic. They are
achieved using UNICODE characters. Most often, the text file will be
encoded as UTF-8.
Creating such diagrams by hand is painfully slow. Use ‘Uniline’ to
draw lines while you move the cursor with keyboard arrows.
*Beware!*
If you see those diagrams miss-aligned, most likely the font used to
display them does not support UNICODE block characters. See bellow the
paragraph "Which fonts?".
File: uniline.info, Node: Minor mode, Next: Drawing lines, Prev: Pure UNICODE text diagrams in Emacs, Up: Top
3 Minor mode
************
‘Uniline’ is a minor mode. Activate it temporarily:
‘M-x uniline-mode’
Exit it with:
‘C-c C-c’
The current major mode is still active underneath ‘uniline-mode’.
While in ‘uniline-mode’, overwriting is active, as well as long lines
truncation. Also, a hollow cursor is provided. Those settings are
reset to their previous state when exiting ‘uniline-mode’.
File: uniline.info, Node: Drawing lines, Next: Brush style, Prev: Minor mode, Up: Top
4 Drawing lines
***************
Use keyboard arrows to draw lines.
By default, drawing lines only happens over empty space or over other
lines. If there is already text, it will not be erased. However, by
hitting the control-key while moving, lines overwrite whatever there is.
The buffer is "infinite" in bottom and right directions. Which means
that when the cursor ends up outside the buffer, white space characters
are automatically added.
The usual numeric prefix is available. For instance, to draw a line
12 characters wide downward, type: ‘M-12 <down>’
File: uniline.info, Node: Brush style, Next: The <insert> key, Prev: Drawing lines, Up: Top
5 Brush style
*************
Set the current brush with:
• ‘-’ single thin line ‘╭─┬─╮’
• ‘+’ single thick line ‘┏━┳━┓’
• ‘=’ double line ‘╔═╦═╗’
• ‘#’ quarter block ‘▙▄▟▀’
• ‘<delete>’ eraser
• ‘<return>’ move without drawing anything
The current bush and the current text direction (see below) are
reflected in the mode-line (at the bottom of the Emacs screen). It
looks like this:
╭─current brush
▽
→Uniline┼
△
╰──current text direction
File: uniline.info, Node: The <insert> key, Next: Arrows glyphs ▷ ▶ → ▹ ▸ ↔, Prev: Brush style, Up: Top
6 The ‘<insert>’ key
********************
The ‘<insert>’ key is a prefix for other keys:
• for drawing arrows, squares, crosses, o-shapes glyphs,
• for handling rectangles,
• for inserting ‘# = - +’ which otherwise change the brush style,
• for trying a choice of mono-spaced fonts.
Why ‘<insert>’? Because:
• ‘Uniline’ tries to leave their original meaning to as much keys as
possible,
• the standard meaning of ‘<insert>’ is to toggle the
‘overwrite-mode’; but ‘Uniline’ is already in ‘overwrite-mode’, and
de-activating overwrite would break ‘Uniline’.
So preempting ‘<insert>’ does not sacrifices anything.
File: uniline.info, Node: Arrows glyphs ▷ ▶ → ▹ ▸ ↔, Next: Intersection glyphs ■ ◆ ●, Prev: The <insert> key, Up: Top
7 Arrows glyphs ‘▷ ▶ → ▹ ▸ ↔’
*****************************
At any time, an arrow may be drawn. The arrow points in the direction
that the line drawing follows.
‘Uniline’ supports 6 arrows types: ‘▷ ▶ → ▹ ▸ ↔’
△ ▵ ↑ ▲ ▴
◁ ▷ ◃ ▹ ← → ◀ ▶ ◂ ▸
▽ ▿ ↓ ▼ ▾
Actually, there are tons of arrows of all styles in the UNICODE
standard. Unfortunately, the support by fonts is weak. So ‘Uniline’
restrains itself to those six safe arrows.
To insert an arrow, type: ‘<insert> a’ or ‘<insert> a a’ or ‘<insert>
a a a’. (‘a’ cycles through the 5 styles, ‘A’ cycles backward).
‘<insert> 4 a’ is equivalent to ‘<insert> a a a a’, which is also
equivalent to ‘<insert> A A A’. Those 3 shortcuts insert an arrow of
this style: ‘▵▹▿◃’. The actual direction where the arrow points follows
the last movement of the cursor.
To change the direction of the arrow, use shift-arrow, for example:
‘S-<up>’ will change from ‘→’ to ‘↑’.
File: uniline.info, Node: Intersection glyphs ■ ◆ ●, Next: Drawing rectangles, Prev: Arrows glyphs ▷ ▶ → ▹ ▸ ↔, Up: Top
8 Intersection glyphs ‘■ ◆ ●’
*****************************
There are a few other UNICODE characters which are mono-space and
symmetric in the 4 directions. They are great at line intersections:
To insert a square ‘□ ■ ▫ ▪ ◇ ◆ ◊’ type: ‘<insert> s s s...’ (‘s’
cycles, ‘S’ cycles backward).
To insert a circular shape ‘· ∙ • ● ◦ Ø ø’ type: ‘<insert> o o o...’
(‘o’ cycles, ‘O’ cycles backward).
To insert a cross shape ‘╳ ÷ × ± ¤’ type: ‘<insert> x x x...’ (‘x’
cycles, ‘X’ cycles backward).
To insert a usual ASCII letter or symbol, just type it.
As the keys ‘- + = #’ are preempted by ‘Uniline’ mode, to type them,
prefix them with ‘<insert>’. Example: ‘<insert> -’ inserts a ‘-’ and
‘<insert> +’ inserts a ‘+’.
<insert>
│
▼
╭┴╮ ╭───────╮ ╭─────────────────────╮
│s├─▶─┤squares├──┤ □ ■ ▫ ▪ ◇ ◆ ◊ │
╰┬╯ ╰───────╯ ╰─────────────────────╯
╭┴╮ ╭───────╮ ╭─────────────────────╮
│o├─▶─┼circles┼──┤ · ∙ • ● ◦ Ø ø │
╰┬╯ ╰───────╯ ╰─────────────────────╯
╭┴╮ ╭───────╮ ╭───────────────╮
│x├─▶─┼crosses┼──┤ ╳ ÷ × ± ¤ │
╰┬╯ ╰───────╯ ╰───────────────╯
╭┴╮ ╭───╮
│+├─▶────────────┤ + │
╰┬╯ ╰───╯
╭┴╮ ╭───╮
│-├─▶────────────┤ - │
╰┬╯ ╰───╯
╭┴╮ ╭───╮
│=├─▶────────────┤ = │
╰┬╯ ╰───╯
╭┴╮ ╭───╮
│#├─▶────────────┤ # │
╰─╯ ╰───╯
File: uniline.info, Node: Drawing rectangles, Next: Moving rectangles, Prev: Intersection glyphs ■ ◆ ●, Up: Top
9 Drawing rectangles
********************
To draw a rectangle in one shot, select a rectangular region with
‘C-SPC’ or ‘C-x SPC’ and move the cursor.
You may also use ‘S-<arrow>’ (‘<arrow>’ being any of the 4
directions) to extend the selection. The buffer grows as needed with
white spaces to accommodate the selection. Selection extension mode is
active when ‘shift-select-mode’ is non-nil.
If needed, change the brush with any of ‘- + = # <delete>’
then hit
• ‘r’ to draw a rectangle inside the selection
• ‘S-R’ to draw a rectangle outside the selection
• ‘C-r’ to overwrite a rectangle inside the selection
• ‘C-S-R’ to overwrite a rectangle outside the selection
╭───────╮ r: inside╮╭───────╮
│ one │ ▗▄▄▄▄▄▄▖╭┤│▛▀▀▀▀▀▜│
│ ┏━━━━┿━━━━━━┓ ▐╭────╮▌│╰┼▌ ▐│
╰──╂────╯ two ┃ ▐│ │▌│ │▙▄▄▄▄▄▟│
┃ ╔═══════╋═╗ ▐│ ├▌╯ ╰─────┬─╯
┗━━━╋━━━━━━━┛ ║ ▐╰────╯▌────────┴───╮
║ three ║ ▝▀▀▀▀▀▀▘ R: outside╯
╚═════════╝
╭─────────╮
my text I │my text I│
want to ╶─<insert>R─▷ │want to │
box │box │
╰─────────╯
The usual ‘C-_’ or ‘C-/’ keys may be hit to undo, even with the
region still active visually.
File: uniline.info, Node: Moving rectangles, Next: Tracing a contour, Prev: Drawing rectangles, Up: Top
10 Moving rectangles
********************
Select a region, then press ‘<insert>’. The selection becomes
rectangular if it was not.
Use arrow keys to move the rectangle around. A numeric prefix may be
used to move the rectangle that many characters. Be sure to specify the
numeric prefix with just digits, without the ‘Alt’ key. Typing ‘15
<left>’ moves the rectangle 15 characters to the left. ‘M-15 <left>’
does not work.
Press ‘q’, ‘<return>’, or ‘C-g’ to stop moving the rectangle.
The ‘C-_’ key may also be used to undo the previous movements, even
though the selection is still active.
▲
│
<up>
╭─────┴──────╮
│this is │
│my rectangle│
◀─<left>──┤I want to ├─<right>─▶
│move │
╰─────┬──────╯
<down>
│
▼
A rectangle can be copied or killed, then yanked somewhere else.
Press:
• ‘c’ to copy
• ‘k’ to kill
• ‘y’ to yank (aka paste)
This is similar to the Emacs standard rectangle handling:
• ‘C-x r r’ copy rectangle to register
• ‘C-x r k’ kill rectangle
• ‘C-x r y’ yank killed rectangle
The difference is that ‘Uniline’ rectangles when killed and yanked,
do not move surrounding characters.
‘Uniline’ and Emacs standard rectangle share the same storage for
copied and killed rectangles, ‘killed-rectangle’. So, a rectangle can
be killed one way, and yanked another way.
File: uniline.info, Node: Tracing a contour, Next: Flood-fill, Prev: Moving rectangles, Up: Top
11 Tracing a contour
********************
╭──────────────╮
╭─╯A.written.text╰────────╮
│outlined by the.`contour'│
╰─╮function.gets╶┬────────╯
╰╮a.surrounding╰───────╮
╰─╮line.in.the.current│
╰─╮brush.style╭─────╯
╰───────────╯
Choose or change the brush style with any of ‘-,+,=_,#,<delete>’.
Put the cursor anywhere on the shape or outside but touching it. Then
type:
‘<insert> c’
A contour line is traced (or erased if brush style is ‘<delete>’)
around the contiguous shape close to the cursor.
When hitting capital letter: ‘<insert> C’ the contour is overwritten.
This means that if there was already a different style of line on the
contour path, it is overwritten.
The shape is distinguished because it floats in a blank characters
ocean. For the shake of the contour function, blank characters are
those containing lines as drawn by ‘Uniline’ (including true blank
characters). Locations outside the buffer are also considered blank.
The algorithm has an upper limit of 10000 steps. This avoids an
infinite loop in which the algorithm may end up in some rare cases. One
of those cases is when the contour crosses a new-page character,
displayed by Emacs as ‘^L’. 10000 steps require a fraction of a second
to run. For shapes really huge, you may launch the contour command once
again, at the point where the previous run ended.
File: uniline.info, Node: Flood-fill, Next: Text direction, Prev: Tracing a contour, Up: Top
12 Flood-fill
*************
this.text.surrounds this.text.surrounds
. / .▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒/
. //╶───▷╴.▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒//
... //// ...▒▒▒▒▒▒▒▒▒▒▒▒////
...a.hole///// ...a.hole/////
A hollow shape is a contiguous region of identical characters (not
necessarily blank), surrounded by a boundary of different characters.
The end of the buffer in any direction is also considered a boundary.
Put the cursor anywhere in the hole. Then type:
‘<insert> i’
Answer by giving a character to fill the hole.
If instead of a character, ‘SPC’ or ‘DEL’ is typed, then a shade of
grey character is picked. ‘SPC’ selects a darker grey than the one the
point is on, while ‘DEL’ selects a lighter. There are 5 shades of grey
in the UNICODE standard: ‘" ░▒▓█"’. Those grey characters are well
supported by the suggested fonts.
‘C-y’ is also an option. The first character in the top of the kill
ring will be chosen as the filling character. The kill ring is filled
by functions like ‘C-k’ or ‘M-w’, which remove text from the buffer.
Typing ‘<return>’ aborts the filling operation.
A rectangular shape may also be filled.
• Mark a region
• ‘<insert> i’
• answer which character should be used to fill.
There is no limit on the area to fill. Therefore, the filling
operation may flood the entire buffer (but no more).
File: uniline.info, Node: Text direction, Next: Macros, Prev: Flood-fill, Up: Top
13 Text direction
*****************
Usually, inserting text in a buffer moves the cursor to the right. (And
sometimes to the left for some locales). Any of the 4 directions can be
selected under ‘Uniline’. Just type any of:
• ‘<insert> C-<up>’
• ‘<insert> C-<right>’
• ‘<insert> C-<down>’
• ‘<insert> C-<left>’
The current direction is reflected in the mode-line, just before the
word ‘"uniline"’.
File: uniline.info, Node: Macros, Next: Fine tweaking, Prev: Text direction, Up: Top
14 Macros
*********
‘Uniline’ adds directional macros to the Emacs standard macros.
Record a macro as usual with ‘C-x (’ … ‘C-x )’.
Then call it with the usual ‘C-x e’. But then, instead of executing
the macro, a menu is offered to execute it in any of the 4 directions.
When a macro is executed in a direction other than the one it was
recorded, it is twisted in that direction. This means that recorded
hits on the 4 keyboard arrows are rotated. It happens also for shift
and control variations of those keys. Direction of text insertion is
also rotated.
There is still the classical ‘e’ option to call the last recorded
macro. So instead of the usual ‘C-x e’, type ‘C-x e e’. And of course,
the usual repetition typing repeatedly ‘e’ is available.
Why are directional macros useful? To create fancy lines. For
instance, if we want a doted line instead of the continuous one, we
record a macro for one step:
C-x ( ;; begin recording
INS o ;; insert a small dot
<right> <right> ;; draw a line over 2 characters
C-x ) ;; stop recording
Then we call this macro repeatedly in any of the 4 directions:
·─·─·─·─· ╷ ·──·
│ │ │ │
· · · ·
│ │ │ │
· ·─·─·─· ·
│ │
·─·─·─·─·─·─·
We can draw complex shapes by just drawing one step. Hereafter, we
call a macro in 4 directions, closing a square:
╭╮╭╮╭╮╭╮╭╮╭╮ △ △ △ △ △ △ ╭─╮ ╭─╮ ╭─╮ ╭─╮ ╭─╮ ╭─╮ ╭─╮ ╭─╮
╭─╯╰╯╰╯╰╯╰╯╰╯│ ╶╯╶╯╶╯╶╯╶╯╶╯╷ ╭──╯∙╰─╯∙╰─╯∙╰─╯∙│ ▷┤□├▷┤□├▷┤□├▷┤□├▽
╰╮ ╰╮ ◁╮ ╰▷ │∙ │ ╭┴┼─╯ ╰─╯ ╰─╯ ╰─┼┴╮
╭╯ ╭╯ ╵ ╷ ╰╮ ╰╮ │□│ │□│
╰╮ ╰╮ ◁╮ ╰▷ │ ∙│ ╰┬╯ ╰┬╯
╭╯ ╭╯ ╵ ╷ ╭╯ ╭╯ △ ▽
╰╮ ╰╮ ◁╮ ╰▷ │∙ │ ╭┴╮ ╭┴╮
╭╯ ╭╯ ╵ ╷ ╰╮ ╰╮ │□│ │□│
╰╮ ╰╮ ◁╮ ╰▷ │ ∙│ ╰┬┼─╮ ╭─╮ ╭─╮ ╭─┼┬╯
│╭╮╭╮╭╮╭╮╭╮╭─╯ ╵╭╴╭╴╭╴╭╴╭╴╭╴ │∙╭─╮∙╭─╮∙╭─╮∙╭──╯ △┤□├◁┤□├◁┤□├◁┤□├◁
╰╯╰╯╰╯╰╯╰╯╰╯ ▽ ▽ ▽ ▽ ▽ ▽ ╰─╯ ╰─╯ ╰─╯ ╰─╯ ╰─╯ ╰─╯ ╰─╯ ╰─╯
File: uniline.info, Node: Fine tweaking, Next: Which fonts?, Prev: Macros, Up: Top
15 Fine tweaking
****************
convert this ═══▶ into that
╭───────────╮ ╭───────────╮
│╶───┬────▷ │ │╶───╮────▷ │
│ │ │ │ │ │
│ │ │ │
│ ▀▀▀ │ │ ▀▟▀ │
╰───────────╯ ╰───────────╯
At the crossing of lines, it may be appealing to do small
adjustments. In the above example, we removed a segment of line which
occupies 1/4 of a character. This cannot be achieve with line tracing
alone. We also modified a quarter-block line in a non-obvious way.
• Put the point (the cursor) on the character where lines cross each
other.
• type ‘INS S-<right> S-<right>’
‘<right>’ here refers to the right part of the character under the
point. The 1/4 line segment will cycle through all displayable forms.
On the second stroke, no segment will be displayed, which is what we
want.
Caveat! The UNICODE standard does not define all possible
combinations including double line segments. (It does for all
combinations of thin and tick lines). So sometimes, when working with
double lines, the process may be frustrating.
This works also for lines made of quarter-blocks. There are 4
quarter-blocks in a character, either on or off. Each of the 4 shifted
keyboard arrows flips a quarter-block on-and-off.
In the above example, the effect was achieved with: ‘INS S-<up>
S-<down> S-<left>’
File: uniline.info, Node: Which fonts?, Next: Text menus (Hydra), Prev: Fine tweaking, Up: Top
16 Which fonts?
***************
A mono-space character font must be used. It must also support UNICODE.
Not all fonts are born equal.
• ‘(set-frame-font "DejaVu Sans Mono" )’
• ‘(set-frame-font "Unifont" )’
• ‘(set-frame-font "Hack" )’
• ‘(set-frame-font "JetBrains Mono" )’
• ‘(set-frame-font "Cascadia Mono" )’
• ‘(set-frame-font "Agave" )’
• ‘(set-frame-font "JuliaMono" )’
• ‘(set-frame-font "FreeMono" )’
• ‘(set-frame-font "Iosevka Comfy Fixed")’
• ‘(set-frame-font "Source Code Pro" )’
Those fonts are known to support the required UNICODE characters, AND
display them as mono-space. There are fonts advertised as mono-space
which give arbitrary widths to non-ASCII characters. That is bad for
the kind of drawings done by ‘Uniline’.
You may want to try any of the 10 suggested fonts. Just hit the
corresponding entry in the ‘Uniline’ menu, or type ‘<insert> f’. You
may also execute the above Lisp commands like that:
‘M-: (set-frame-font "DejaVu Sans Mono")’
This setting is for the current session only. If you want to make it
permanent, you may use the Emacs customization:
‘<insert> f *’
or
‘M-x customize-face default’
Beware that Emacs tries to compensate for missing UNICODE support by
the current font. Emacs substitutes one font for another, character per
character. The user may not notice until the drawings done under Emacs
are displayed on another text editor or on the Web.
To know which font Emacs has chosen for a given character, type:
‘C-u C-x =’
Note that none of those commands downloads a font from the Web. The
font should already be available.
File: uniline.info, Node: Text menus (Hydra), Next: Line spacing, Prev: Which fonts?, Up: Top
17 Text menus (Hydra)
*********************
Casual usage of ‘Uniline’ should be easy: just move the point, and lines
are traced.
More complex actions are summoned by the ‘<insert>’ key, with or
without selection. This is a single key to remember. Then a textual
menu is displayed, giving the possible keys continuations and their
meaning. All that is achieved by the ‘Hydra’ library, which is now part
of Emacs (thanks!).
For seasoned users, those multi-lines textual menus may distract them
from their workflow. Beside, they disturb the layout of windows.
It is now possible to switch to less distracting textual menus. They
are displayed in the echo-area on a single line.
To do so, type:
• ‘TAB’ within a sub-mode (glyph insertion mode, rectangle handling,
etc.)
• ‘C-h TAB’ at the top-level
This will flip between the two sizes of textual menus. It also
affects the welcome message, the one displayed when entering the
‘Uniline’ minor mode.
The current size is controlled by the ‘uniline-hint-style’ variable:
• ‘t’ for full fledged messages over several lines
• ‘1’ for one-liner messages
• ‘0’ for no message at all
The variable is "buffer-local", which means that it can take distinct
values on distinct buffers.
There are no customizable ‘Uniline’ variables (not yet). This does
not prevent customizing ‘uniline-hint-style’ for future sessions. For
instance, in the ‘~/.emacs’ file, there might be:
(use-package uniline
:config (set-default 'uniline-hint-style 1))
This setting gives one-liner messages. It can be changed later on a
buffer per buffer basis with the ‘TAB’ key. Note the use of
‘set-default’. Using ‘setq’ instead would assign the value ‘1’ only in
the ‘~/.emacs’ buffer.
File: uniline.info, Node: Line spacing, Next: How Uniline behaves with its environment?, Prev: Text menus (Hydra), Up: Top
18 Line spacing
***************
The ‘line-spacing’ setting in Emacs can change the display of a sketch.
The best looking effect is given by:
(setq line-spacing nil)
You may want to change your current setting. ‘Uniline’ may handle
this variable some day. Right now, ‘line-spacing’ is left as a matter
of choice for everyone.
╭────┬────────┬────╮ ╺┯━━━━┯┯━━┯┯━┯┯━━━━━━━━┯┯━━━━━━━┯┯━━━━━━┯╸
│▒▒▒▒╰────────╯▒▒▒▒│ │ │╰is╯╰a╯│ ││ │╰around╯
│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│ ╰this╯ ╰sentence╯╰hanging╯
│▒▒▒╭─╮▒▒▒▒▒▒╭─╮▒▒▒│ △
│▒▒▒╰─╯▒▒▒▒▒▒╰─╯▒▒▒│ │ △
│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│ ╰─────────┬────────╯
╰──────────────────╯ verbs
(setq line-spacing nil)
File: uniline.info, Node: How Uniline behaves with its environment?, Next: Lisp API, Prev: Line spacing, Up: Top
19 How ‘Uniline’ behaves with its environment?
**********************************************
* Menu:
* Compatibility with Picture-mode::
* Compatibility with Artist-mode::
* Compatibility with Whitespace-mode::
* Compatibility with Org Mode::
* Org Mode and LaTex::
* What about \t tabs?::
* What about ^L page separation?::
* Emacs on the Linux console::
* Emacs on a graphical terminal emulator::
* Emacs on Windows::
File: uniline.info, Node: Compatibility with Picture-mode, Next: Compatibility with Artist-mode, Up: How Uniline behaves with its environment?
19.1 Compatibility with Picture-mode
====================================
‘Picture-mode’ and ‘uniline-mode’ are compatible. Their features
overlap somehow:
• Both implement an unlimited buffer in east and south directions.
• Both visually truncate long lines (actual text is not truncated).
• Both set the overwrite mode (‘uniline-mode’ activates
‘overwrite-mode’, while ‘picture-mode’ re-implements it)
• Both are able to draw rectangles (‘uniline-mode’ in UNICODE,
‘picture-mode’ in ASCII), copy and yank them.
They also have features unique to each:
• ‘Picture-mode’ writes in 8 possible directions
• ‘Picture-mode’ handles TAB stops
• ‘Uniline-mode’ draws lines and arrows
File: uniline.info, Node: Compatibility with Artist-mode, Next: Compatibility with Whitespace-mode, Prev: Compatibility with Picture-mode, Up: How Uniline behaves with its environment?
19.2 Compatibility with Artist-mode
===================================
‘Artist-mode’ and ‘uniline-mode’ are mostly incompatible. This is
because ‘artist-mode’ preempts the arrow keys, which give access to a
large part of ‘uniline-mode’ features.
However, it is possible to use both one after the other.
File: uniline.info, Node: Compatibility with Whitespace-mode, Next: Compatibility with Org Mode, Prev: Compatibility with Artist-mode, Up: How Uniline behaves with its environment?
19.3 Compatibility with Whitespace-mode
=======================================
‘Whitespace-mode’ and ‘uniline-mode’ are mostly compatible.
Why activate ‘whitespace-mode’ while in ‘uniline-mode’? Because
‘Uniline’ creates a lot of white-spaces to implement an infinite buffer.
And it is funny to look at this activity.
To make ‘uniline-mode’ and ‘whitespace-mode’ fully compatible,
disable the newline visualization:
• ‘M-x customize-variable whitespace-style’
• uncheck ‘(Mark) NEWLINEs’
This is due to a glitch in ‘move-to-column’ when a visual property is
attached to newlines. And ‘uniline-mode’ makes heavy use of
‘move-to-column’.
File: uniline.info, Node: Compatibility with Org Mode, Next: Org Mode and LaTex, Prev: Compatibility with Whitespace-mode, Up: How Uniline behaves with its environment?
19.4 Compatibility with Org Mode
================================
You may want to customize the shift extension mode in ‘Org Mode’. This
is because ‘Org Mode’ preempts ‘shift-select-mode’ for other useful
purposes. Just type:
M-x customize-variable org-support-shift-select
and choose "when outside special context", which sets it to ‘t’.
You then get the shift-selection from ‘Org Mode’, not from ‘Uniline’.
The difference is that the ‘Uniline’’s one handles the infinite-ness of
the buffer.
Other than that, ‘Uniline’ is compatible with ‘Org Mode’
File: uniline.info, Node: Org Mode and LaTex, Next: What about \t tabs?, Prev: Compatibility with Org Mode, Up: How Uniline behaves with its environment?
19.5 Org Mode and LaTex
=======================
Use the ‘pmboxdraw’ LaTex module. This gives limited support for "box
drawing" characters in LaTex documents.
Example:
#+LATEX_HEADER: \usepackage{pmboxdraw}
#+begin_src text
this works:
┌─────┐ ┌────────────┐
│ ├───────┤ │
└─────┘ │ │
┌─────┐ ┌────┤ │
│ ├──┘ │ │
└─────┘ ┌────┤ │
┌─────┐ │ │ │
│ ├──┘ └────────────┘
└─────┘
this does not quite work:
┏━━━┓ ┏━━┓ ┏━━━━━┓
┃ ┃ ┃ ┣━━━━━┫ ┃
┃ ┗━━┛ ┃ ┏┛ ┃
┗━━━━━━━━━┛ ┗━━━━━━┛
but that is OK:
┏━━━┓
┃ ┃
┗━━━┛
that is OK too:
╺════╦══╗ ╔════╗
║ A║ ║ B ╚══╗
╚══╝ ╚═══════╝
this works:
├── dev
└┬┬ release
│├── new
│└── old
├── graph
└── non-graph
#+end_src
Note that corners of thin lines should be sharp. There is no support
for rounded corners. ‘Uniline’ does not (yet) draw sharp thin corners.
But it can recognize them.
To export this Org Mode example to PDF through LaTex, type:
‘C-c C-E l o’
File: uniline.info, Node: What about \t tabs?, Next: What about ^L page separation?, Prev: Org Mode and LaTex, Up: How Uniline behaves with its environment?
19.6 What about ‘\t’ tabs?