├── .gitignore ├── images ├── flood-fill.png ├── lisp-lists.png ├── mode-line.png ├── plus-shape.png ├── arrow-styles.png ├── boxes-arrows.png ├── decision-tree.png ├── fine-tweaking.png ├── first-drawing.png ├── four-styles.png ├── insert-glyphs.png ├── latex-block.png ├── line-spacing.png ├── lines-blocks.png ├── org-src-block.png ├── water-sketch.png ├── ascii-2-unicode.png ├── contour-tracing.png ├── draw-rectangle.png ├── move-rectangle.png ├── ascii-2-unicode-b.png ├── document-command.png ├── macro-doted-line.png ├── sketched-objects.png ├── macro-fancy-squares.png ├── schrodinger-equation.png ├── broken-lines-lang-env.png ├── foreign-language-sentence.png ├── general-relativity-equation.png └── same-sketch-several-styles.png ├── tests ├── bench17.el ├── bench11.el ├── bench18.el ├── bench01.el ├── bench20.el ├── bench12.el ├── bench24.el ├── bench16.el ├── bench10.el ├── bench13.el ├── bench07.el ├── bench25.el ├── bench03.el ├── bench04.el ├── bench05.el ├── bench14.el ├── bench06.el ├── bench02.el ├── bench15.el ├── bench09.el ├── bench19.el ├── bench23.el ├── bench27.el ├── bench26.el ├── bench28.el ├── bench08.el ├── bench21.el ├── bench22.el └── uniline-bench.el ├── uniline.el ├── uniline-transient.el ├── uniline-hydra.el ├── LICENSE └── README.org /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.elc 3 | -------------------------------------------------------------------------------- /images/flood-fill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/flood-fill.png -------------------------------------------------------------------------------- /images/lisp-lists.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/lisp-lists.png -------------------------------------------------------------------------------- /images/mode-line.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/mode-line.png -------------------------------------------------------------------------------- /images/plus-shape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/plus-shape.png -------------------------------------------------------------------------------- /images/arrow-styles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/arrow-styles.png -------------------------------------------------------------------------------- /images/boxes-arrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/boxes-arrows.png -------------------------------------------------------------------------------- /images/decision-tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/decision-tree.png -------------------------------------------------------------------------------- /images/fine-tweaking.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/fine-tweaking.png -------------------------------------------------------------------------------- /images/first-drawing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/first-drawing.png -------------------------------------------------------------------------------- /images/four-styles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/four-styles.png -------------------------------------------------------------------------------- /images/insert-glyphs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/insert-glyphs.png -------------------------------------------------------------------------------- /images/latex-block.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/latex-block.png -------------------------------------------------------------------------------- /images/line-spacing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/line-spacing.png -------------------------------------------------------------------------------- /images/lines-blocks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/lines-blocks.png -------------------------------------------------------------------------------- /images/org-src-block.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/org-src-block.png -------------------------------------------------------------------------------- /images/water-sketch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/water-sketch.png -------------------------------------------------------------------------------- /images/ascii-2-unicode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/ascii-2-unicode.png -------------------------------------------------------------------------------- /images/contour-tracing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/contour-tracing.png -------------------------------------------------------------------------------- /images/draw-rectangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/draw-rectangle.png -------------------------------------------------------------------------------- /images/move-rectangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/move-rectangle.png -------------------------------------------------------------------------------- /images/ascii-2-unicode-b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/ascii-2-unicode-b.png -------------------------------------------------------------------------------- /images/document-command.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/document-command.png -------------------------------------------------------------------------------- /images/macro-doted-line.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/macro-doted-line.png -------------------------------------------------------------------------------- /images/sketched-objects.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/sketched-objects.png -------------------------------------------------------------------------------- /images/macro-fancy-squares.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/macro-fancy-squares.png -------------------------------------------------------------------------------- /images/schrodinger-equation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/schrodinger-equation.png -------------------------------------------------------------------------------- /images/broken-lines-lang-env.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/broken-lines-lang-env.png -------------------------------------------------------------------------------- /images/foreign-language-sentence.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/foreign-language-sentence.png -------------------------------------------------------------------------------- /images/general-relativity-equation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/general-relativity-equation.png -------------------------------------------------------------------------------- /images/same-sketch-several-styles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbanel/uniline/HEAD/images/same-sketch-several-styles.png -------------------------------------------------------------------------------- /tests/bench17.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | (uniline-bench 23 | "3* a b c 24 | C-SPC 3*C-b 25 | 2* 26 | 2* d e f 27 | C-SPC C-a 28 | 29 | C-SPC 3*S- S- 2* " 30 | "\ 31 | ╭ 32 | abc 33 | def 34 | 35 | ") 36 | -------------------------------------------------------------------------------- /tests/bench11.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | ;; Check if TABs are converted to SPC when drawing on them 23 | 24 | (uniline-bench 25 | "C-q t a b s SPC ? 26 | C-a C-q C-q 2 SPC t a b s 27 | 2* 2* 10* 2* 28 | s " 29 | "\ 30 | ╭─────tabs╮? 31 | │ │ 2 tabs 32 | ╶─╯ □ 33 | ") 34 | -------------------------------------------------------------------------------- /tests/bench18.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | ;; Check # blocks contour 23 | 24 | (uniline-bench 25 | " 26 | 3* 6*t 27 | 3* 2*y 28 | 5* 4*r 29 | 30 | C- 4*o 31 | 5*o 32 | C- 2* 5* 33 | # c" 34 | "\ 35 | ▗▄▄▄▄▄▄▖ 36 | ▐tttttt▌ 37 | ▐███yy▛▘ 38 | ▐rrrr█▌ 39 | ▗▄▟█oooo▌ 40 | ooooo▛▀▀▘ 41 | ▀▀▀▀▀▘ 42 | ") 43 | -------------------------------------------------------------------------------- /tests/bench01.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | (uniline-bench 23 | "b RET c 24 | - 3* 5* 25 | C-SPC 6* 11* 2*RET 26 | 2* 27 | + 4* 28 | 2*a 29 | 3* 30 | a S- 31 | 8* 32 | RET 2* 14* 33 | - 3*" 34 | 35 | "\ 36 | │ 37 | bc╶┴─╮ 38 | ╰─┰──╯ 39 | ━━━━━━△━━◀━━━┛ 40 | ") 41 | -------------------------------------------------------------------------------- /tests/bench20.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | ;; Test fine tweaking 23 | 24 | (uniline-bench 25 | " 26 | 2* 2* 27 | 4* 3* 28 | 2* 3* 29 | = 4* 4* 30 | 5* 2* 31 | 2*S- 32 | 33 | 2* 34 | S- S- 35 | 2* 36 | # 8* 3* 37 | S- 38 | " 39 | "\ 40 | 41 | ╔══╘═━━┓ 42 | ╟───╮ ╻┃ ▝▀▟▀▘ 43 | ║ ╰─┠┚ 44 | ║ ┃ 45 | ╚━━━━━┛ 46 | ") 47 | -------------------------------------------------------------------------------- /tests/bench12.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | ;; Test rectangle fill 23 | 24 | (uniline-bench 25 | " 3* 5* 26 | 6*S- 11*S- i SPC 27 | 3* 7* 6*S- 8*S- i y 28 | 2* 5*S- S- i SPC 29 | " 30 | "\ 31 | 32 | 33 | 34 | ░░░░░░░░░░░ 35 | ░░▒▒▒▒▒░░░░ 36 | ░░▒▒▒▒▒░░░░ 37 | ░░░░░░░░░░░ 38 | ░░░░░░░yyyyyyyy 39 | ░░░░░░░yyyyyyyy 40 | ░░░░░░░yyyyyyyy 41 | yyyyyyyy 42 | yyyyyyyy 43 | yyyyyyyy 44 | yyyyyyyy 45 | ") 46 | -------------------------------------------------------------------------------- /tests/bench24.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | ;; Test undo 23 | 24 | (uniline-bench 25 | " 26 | 3* M-5 27 | 6*u 28 | 4* 29 | 6*u 30 | # 31 | 2* 2* 7* 3* 32 | 6*C-_ 33 | 2* 34 | 35 | 4* 36 | 37 | 3* M-4 M-6 4* 4* 38 | 3* 39 | 4*S- M-8 S- 40 | 41 | 2* 42 | s 43 | 44 | 5*C-_ 45 | 2*" 46 | "\ 47 | 48 | 49 | ╭─────╮ 50 | uuuuuu │ 51 | │uuuuuu▖ 52 | │ ▗▄▄▛▘ 53 | ╰──▐──╯ 54 | ") 55 | -------------------------------------------------------------------------------- /tests/bench16.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | (uniline-bench 23 | " 24 | 5* a 25 | 2* A 26 | 2* a S- 27 | 2* A S- 28 | C-a C-k C-y 29 | C-y 30 | a 31 | 2* a 32 | 2* a 33 | 2* a 34 | C-a C-k C-y 35 | C-a C-y 36 | C-a 5* 2*A 37 | 2* A 38 | 2* 2*A 39 | 2* A" 40 | "\ 41 | 42 | ▷ ↔ △ ↕ 43 | ▶ ◁ ▲ ◁ 44 | ↔ ↔ ↕ ↔ ") 45 | -------------------------------------------------------------------------------- /tests/bench10.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | ;; a macro cannot be defined inside another macro, 23 | ;; so this macro is defined outside 24 | (setq last-kbd-macro (kbd " C- C- ")) 25 | 26 | (uniline-bench 27 | " 2* 2* 20*a 28 | C-a C-k C-y 29 | C-a C-y 30 | C-a C-y 31 | C-a 4* 32 | C-x 4*e 3* 3* 5* 3* 33 | " 34 | "\ 35 | ╭╮╭╮╭╮╭╮╭╮╭╮ 36 | ╶┼┴╯╰╯╰╯╰╯╰╯│ 37 | ╰╴aaaaaaaaa╶╮aaaaaaa 38 | ╭aaaaaaaaaaa╯aaaaaaa 39 | ╰╴aaaaaaaaa╶╮aaaaaaa 40 | ╭╯ ╭╯ 41 | ╰╮ ╰╮ 42 | │╭╮╭╮╭╮╭╮╭─╯ 43 | ╰╯╰╯╰╯╰╯╰╯ 44 | ") 45 | -------------------------------------------------------------------------------- /tests/bench13.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | ;; Test glyph insertion 23 | 24 | (uniline-bench 25 | " 26 | 2* 4* 27 | 4* 2* 28 | a 29 | 2* 3* 30 | s 31 | 3* 2* 3* 3* 2* 32 | 2*o 33 | 2* 2* 4* 34 | 2*S- 3* 35 | 2*S- 3* 2* 36 | 2*S- 3* 37 | 2*S- 38 | 39 | 13* 2* 2*S-" 40 | "\ 41 | 42 | □ 43 | ╾───╮──╯──╮ 44 | │ │ 45 | ▽ ╰──╼ 46 | │ 47 | ∙ 48 | ") 49 | -------------------------------------------------------------------------------- /tests/bench07.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | (uniline-bench 23 | "a a 24 | 2*a 25 | 3* a 26 | a 27 | a 28 | 6*a 29 | a 30 | a 31 | 5*a 32 | 2* 33 | a 34 | a 35 | a 36 | a 37 | 4*a 38 | a 39 | a 40 | a 41 | 2* a 42 | 2* a 43 | 2* a 44 | a 45 | c" 46 | "\ 47 | aaaaa╷ ╷aaaaa╷ 48 | a╭─╮a│ │a╭───╯ 49 | a│ │a╰──╯a│ 50 | a│ │aaaaaa│ 51 | a╰─┴┬─────╯ 52 | aaaa│ 53 | ╶─╮a│ 54 | ╶─╯a│ 55 | aaaa│ 56 | a╭──╯ 57 | ╶╯ 58 | ") 59 | -------------------------------------------------------------------------------- /tests/bench25.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | (uniline-bench 23 | " 24 | 2* 5*a 25 | 5*a 26 | M-7 5*t 27 | 2* M-5 28 | 2*S- M-7 S- 29 | r 30 | 2* 31 | 4* 3*o 32 | M-4 33 | C-SPC 2* M-7 34 | c 35 | 36 | M-5 37 | C-x SPC y 38 | 2* 39 | M-12 40 | C-SPC y 41 | 42 | 3* 3* 43 | C-SPC y 44 | " 45 | "\ 46 | ╭─────╮ 47 | a│aaa• │ ╭─────╮ 48 | ╰──╭─────╮ │ ╭─────╮ 49 | tt│tt • │ ╰─│───• │ 50 | ╰─────╯ ╰─────╯ 51 | 52 | ") 53 | -------------------------------------------------------------------------------- /tests/bench03.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | (uniline-bench 23 | "2* 24 | 2* 3* 25 | # 6* 3* 6* 3* 6* 3* 6* 4* 3* 6* 12* 26 | 15* 27 | C-SPC 4* 12* 28 | r # R 29 | 30 | 4* 11* 4* 11* 31 | 23* 2* 32 | C-SPC 4* 16* 33 | 2* 3* 34 | C-c C-c" 35 | "\ 36 | 37 | ▗▄▄▄▄▄▄▄▄▄▄▄▄▖ 38 | ▐╭──────────╮▌ 39 | ▄▄ ▐│ │▌ 40 | ▝▀▀▌ ▛▀▀▌ ▌▐ ▐│ │▌ 41 | ▙▄▄▌ ▙▄▄▌▐ ▐│ │▌ 42 | ▗▄▄▄▄▄▟ ▐╰──────────╯▌ 43 | ▝▀▀▀▀▀▀▀▀▀▀▀▀▘ 44 | ") 45 | -------------------------------------------------------------------------------- /tests/bench04.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | (uniline-bench 23 | " 4* 2* 4* 24 | M 25 | 26 | = 3* M-6 3* 2* 27 | a 28 | M-7 29 | 3*a 30 | 3* M-4 3* 31 | 2* 2* 32 | s 33 | 2* 34 | 2*s 35 | 3* M-6 36 | x 37 | 38 | 5*o 39 | 4* M-9 40 | C-SPC M-6 M-12 41 | c 42 | M-13 M-6 43 | C-SPC y " 44 | "\ 45 | 46 | ╔═════╗ ╔═════╗ 47 | ║ □ ║ ║ □ ║ 48 | ║ ■ ║ ║ ■ ║ 49 | ╔←══M═══◁═╝ ╔←══M═══◁═╝ 50 | ║ ◦ ║ ║ ◦ ║ 51 | ║ ╳ ║ ║ ╳ ║ 52 | ╚═══╝ ╚═══╝ 53 | 54 | ") 55 | -------------------------------------------------------------------------------- /tests/bench05.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | (uniline-bench 23 | " a a a a 24 | a a a a 25 | a a a 26 | a a a a a a a a 27 | C-SPC M-26 c 28 | C-SPC y c 29 | C-SPC y 30 | c C-SPC y c 31 | 32 | C-SPC M-9 33 | C-r M-7 34 | C-SPC M-6 35 | C-r = R RET" 36 | "\ 37 | 38 | 39 | aaaa aa╭─────╦╤╤══aaaaaaaa 40 | aaaa │aaa ║┏┿━━━┓aaaaaaaa 41 | aaa│ aaaa║┃│aaa┃║ aaaaaaaa 42 | a╰─────╫╂╯ a┃a aaaaaaaa 43 | ║┗━━━━┛║ 44 | ╚══════╝ 45 | ") 46 | -------------------------------------------------------------------------------- /tests/bench14.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | (uniline-bench 23 | " 24 | 2* 3* 12*S- 6*S- # r 25 | S- 26 | 4* 27 | 4* S- 5* 28 | S- S- S- S- 3* 29 | S- 3* 30 | 2*S- S- S- 5* 31 | S- S- 6* 32 | S- S- S- 33 | 3* 34 | 4* 35 | a 36 | S- 2* 37 | a 38 | S- 2* 39 | a 40 | S- 2* 41 | 42 | 2*S- 43 | 9* 44 | 2*S- 2*S- S- S- 2* 45 | 2*S- S- S- 46 | " 47 | "\ 48 | 49 | 50 | █▀▀▀▀▀▛▀▀▀▀▙ 51 | ▌ ▐ 52 | ▌ ▐ 53 | ▌╰─┤△─▽─◁─╴▟ 54 | ▌ ▐ 55 | ▌ ▐ 56 | ▐▄▄▄▄▄█▄▄▄▄▛ 57 | ") 58 | -------------------------------------------------------------------------------- /tests/bench06.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | (uniline-bench 23 | " 2* 5* 24 | m ù q 25 | v 26 | h u 27 | u 28 | u 29 | u 2* 30 | u 2* 31 | u 2* 32 | u 33 | u 2* 34 | u 2* 35 | u 2* 36 | u 37 | u 2* 38 | a 39 | é 2* 40 | 1 41 | 2 2*i 42 | i 2* 4* 43 | C-SPC 6* 9* 44 | c 45 | M-3 M-5 46 | C-SPC y 47 | 6* 48 | 49 | 50 | c 51 | 7* 52 | j 53 | j 2* 54 | i SPC" 55 | "\ 56 | 57 | ╭───╮ 58 | │mùq╰╮ 59 | ╭──┴─┬╮v╰─╮ jmùq 60 | │2iii│╰╮hu│ j░░░v 61 | │1╶┬─╯ ╰╮u│ 2iii░░░hu 62 | ╰╮é╰╮╭──╯u│ 1░░░░░░░u 63 | │au╰╯uuuu│ é░░░░░░u 64 | ╰╮uuuu╭──╯ au░░uuuu 65 | ╰────╯ uuuu 66 | 67 | ") 68 | -------------------------------------------------------------------------------- /tests/bench02.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | (uniline-bench 23 | "C-c C-c i n i t i a l SPC t e x t e SPC SPC g o o d C-a M-x u n i l i n e - m o d e RET 24 | 2* C-SPC 12* 25 | 2* 3* R 26 | 27 | 28 | q 29 | 30 | 2* 31 | 2* 2* 32 | 3* 3* 33 | 3* 2* 3* 34 | C-SPC 19* 3* 35 | 2* c 36 | C-SPC y 37 | 2* 3* 4* 38 | = 6* 39 | s s s 40 | 5* 41 | o 42 | 6* " 43 | "\ 44 | ╷ 45 | │ 46 | ╭────────────╮ ╭──╯ ╭────────────╮ ╭──╯ 47 | │initial text│ q │initial text│ q 48 | ││ good ├─╯ ││ good ├─╯ 49 | ╰──────╥─────╯ ╰───╥────────╯ 50 | ╚═════·════▫═════╝ 51 | ") 52 | -------------------------------------------------------------------------------- /tests/bench15.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | (uniline-bench 23 | " 3* 10* 24 | 25 | 2* 3* a 26 | 2*a 27 | 3*a 28 | 4*a 29 | 5*a 30 | 6*a 31 | 3* A 32 | 2*A 33 | a 34 | 4*A 35 | a S- 36 | 3* A 37 | 38 | 18* A S- 39 | a 40 | 2* 41 | 2* 4*A 42 | 2* 3*a S- 43 | a S- 44 | 3*a 45 | 5*a 46 | 6*a S- 47 | 3* 48 | 49 | a 50 | 3* S- 51 | 3* 5* S- 52 | " 53 | "\ 54 | 55 | ╭──▷▶→▿▸↔──╮ 56 | ↔──▷ ↕ 57 | ▴ ▾ 58 | ↑ ▷ 59 | ▷ ↓ 60 | ← ▷ 61 | ╰─←─╴ ◁↕↔──╯ 62 | ") 63 | -------------------------------------------------------------------------------- /tests/bench09.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | (uniline-bench 23 | " 10* g 24 | 4*g 25 | g 26 | 2*g 27 | g 28 | 2* g 29 | 2* g 30 | 2* g 31 | 2* g 32 | g 33 | 7*g 34 | g 35 | g 36 | g 37 | 2* g 38 | 2* g 39 | 2* g 40 | 2* g 41 | 2* g 42 | 2* g 43 | 11*g 44 | g 45 | 10*g 46 | g 47 | g 48 | 6* g 49 | g 50 | 5* 4*g 51 | 6* 13* 2* 2* 6*p 52 | p 53 | p 54 | 2* p 55 | 2* p 56 | 2* p 57 | 2* p 58 | 2* p 59 | 4* c" 60 | "\ 61 | ggggggggggg╷ gg ╷ggggg╷ 62 | ggggggg╭─╮g╰──────╯g╭───╯ 63 | ╶────╮g│ │gggggggggg│ 64 | ╶────╯g│ ╰──────────╯ 65 | ggggggg│pppppp 66 | g╶───┬─╯pppppp 67 | ggggg│ 68 | ╶─╮gg│ 69 | ╶─╯g╭╯ 70 | gggg│ 71 | g╭──╯ 72 | ╶╯ 73 | ") 74 | -------------------------------------------------------------------------------- /tests/bench19.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | (uniline-bench 23 | " 24 | 3* C- 4*t 25 | C- 6*y 26 | C- 5*h 27 | C- 4*g 28 | C- 8*a 29 | C- 14*b 30 | C- 2*f 31 | C- 4*f 32 | 5* 6*d 33 | 5*g 34 | 4*SPC 3*h 35 | 5*SPC 4*i 36 | 2*h 37 | 6*h 38 | h 39 | M-< 19* 2*i 40 | 2*i 41 | 2*i 42 | 4*i 43 | 2*i 44 | 2*i 45 | 2*i 46 | # c 47 | M-< 3* # c 48 | 12* C-a M-f c 49 | # c" 50 | "\ 51 | ▐t▖ ▐gggga▖ ▐ii▄▖ ▗▟ii▖ 52 | ▐t▌ ▐h▛▀▜a▌ ▝▜ii▙▖▗▟ii▛▘ 53 | ▐t▌ ▐h▌ ▐a▌ ▝▜ii▙▟ii▛▘ 54 | ▐t▙▄▄▄▟h▌ ▐a▌ ▝▜iiii▛▘ 55 | ▐yyyyyyh▌ ▐a▌ ▝▀▀▀▀▘ 56 | ▗▄▟█▛▀▀▀▀▀▘ ▐a▌ 57 | ffff▌ ▐a▌ 58 | f███▙▄▄▄▄▄▄▄▟a▌ 59 | fbbbbbbbbbbbbb▌ 60 | ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▘ 61 | ▗▄▄▄▄▄▖ 62 | dddddd▌ 63 | ggggg█▙▖ 64 | ▀▀▀▜hhh▙▄▖ 65 | ▗▄▖▝▜iiii▌ 66 | hh▙▄▟█h▛▀▘ 67 | ▜hhhhhh▌ 68 | ▝▀▀▀▀▀▀▘ 69 | ") 70 | -------------------------------------------------------------------------------- /tests/bench23.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | (uniline-bench 23 | " 24 | 2* 5* 25 | M-x p i c t u r e - m o d e 26 | 5*S- 19*S- 2*S- C-c C-r 27 | 3* 10* 28 | 5*S- 17*S- C-c C-r 29 | 6* 30 | M-x M-p 31 | ( 32 | - 33 | r 34 | e x i t 35 | 2* 5* 10* 36 | 37 | 5* 10* 38 | 9*S- 27*S- 2*S- 39 | s 40 | 41 | 6* 42 | M-x 2*M-p 43 | 5*S- 9*S- C-c C-r 44 | M-x 2*M-p 45 | 6* 46 | 47 | 5* 10* 5* 48 | 7*S- 7*S- 49 | s 50 | 51 | 4* 8* 52 | 5*S- 10*S- 53 | s = " 54 | "\ 55 | 56 | ┏━━━━━---+ 57 | ╭──━┃━━━━━───|───╮ 58 | │ ┃ | │ 59 | │ ┃ ┏━━───|──────────╮ 60 | │ ┃ ┃ | ║ │ 61 | │ ┗━━╋━━---+ ║ │ 62 | ╰──━━━━╋━━─══════╝ │ 63 | ┃ │ 64 | ╰───══════════───╯ 65 | 66 | ") 67 | -------------------------------------------------------------------------------- /tests/bench27.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | 23 | ;; Test drawing right onto a TAB and also on the trail of a TAB 24 | ;; (drawing should occur) 25 | ;; Test writing on those 2 characters ╜┡ which are in 2-entries buckets 26 | ;; in the uniline--char-to-4halfs hash-table 27 | 28 | (uniline-bench 29 | " 3 0 30 | 2 0 31 | 16* 8* 32 | = 2* 33 | 34 | 2*S- 35 | 36 | S- S- 37 | C-x h M-x t a b i f y 38 | 8* 10* 14* 2* 2* 39 | C-SPC 4*C-p 3*C-b 40 | c 41 | 42 | 4* 43 | C-SPC y 44 | 45 | 7* 4*" 46 | "\ 47 | ╶───────┬─────────────────────╮ 48 | │ │ 49 | │ │ 50 | │ ╷ │ 51 | │ ╻ │ │ 52 | │ ║ ║ │ 53 | │ ╺╜ ╺┤ │ 54 | │ ┡╸ ┝╸ │ 55 | │ ╹ │ │ 56 | │ │ │ 57 | ╰─────────────────╯ │ 58 | │ 59 | │ 60 | │ 61 | │ 62 | │ 63 | │ 64 | │ 65 | │ 66 | │ 67 | ╵ 68 | ") 69 | -------------------------------------------------------------------------------- /tests/bench26.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | ;; Test ASCII → Uniline base-line 23 | 24 | (uniline-bench 25 | " C- 26 | 9*SPC 13* 13*SPC 14* 27 | C-a 28 | 3*SPC / 5* / SPC R e c t a n l g l e SPC 1 SPC | 13*- + SPC R e c t a n g l e SPC 2 2*SPC ` | 29 | C-a 30 | 3*SPC | 5*SPC | 2*SPC < s i n ^ g l e > 2*SPC | 13*SPC | SPC \" q o u o t e \" 6*SPC + - 31 | C-a 32 | 3*SPC | 5*SPC \\ 13* / 3*SPC / 5* \\ 3*SPC + 14* 33 | C-a 34 | 3*SPC | 5*SPC \\ 2* 7* 2* / 4*SPC | 35 | 5*SPC 4* v a v SPC | 3*SPC + 4* \\ 5* / 3* + 36 | C-a 37 | 3*SPC \\ > 2* \\ 4*SPC | 7*SPC | 6*SPC \\ 5* / 9*SPC | 5*SPC ` | 38 | C-a 39 | 7*SPC v 4*SPC \\ 2*SPC 2* 2* > 4*- / 21*SPC + 2*SPC 2* 2* < 2* + 6*SPC 40 | C- C-SPC M-< 2* s 41 | 2*" 42 | "\ 43 | 44 | ╭─────────────╮ ╭──────────────╮ 45 | ╭─────┤ Rectangle 1 │─────────────┤ Rectangle 2 │ 46 | │ │ │ │ \"quote\" ├─ 47 | │ ├─────────────┤ ╭─────╮ ├──────────────┤ 48 | │ ╰──┬───────┬──╯ │ vav │ ╰────┬─────┬───╯ 49 | ╰▷──╮ │ │ ╰─────╯ │ │ 50 | ▽ ╰──▷────╯ ╰──◁──╯ 51 | ") 52 | -------------------------------------------------------------------------------- /tests/bench28.el: -------------------------------------------------------------------------------- 1 | (uniline-bench 2 | "2*a C-q C-q a C-q C-q a C-q C-q C-q C-q 4*SPC C-q C-q 3*SPC a C-q C-j 3 | C-p 2*C-k 29*C-y 4 | M-< 5* 3* 2* 5 | 7* 2* 9* 16* 2* 12* 3* 10* 6 | 5*C-n 14*r 7 | 12* 16*r 8 | 14* 12*r 9 | 2*C-b c 10 | 12* 3* 11*r 11 | 9* 12*r 12 | 8* 8*r 13 | 2* 2*r 14 | 3*r 15 | C-SPC 3* 2* 3* 11* 16 | 2* c 17 | 4* 6* 10* 18 | C-SPC y 19 | " 20 | "\ 21 | aa───╮ a ╷a╷ a 22 | aa ╰──╮ a ╭──────┼a┼──╮ a 23 | aa ╰───────a╮ │ │a│ │ a 24 | aa ╭───────a┼──────╯ │a│ │ a 25 | aa ╰───────a╯ ╶────┼a┼──╯ a 26 | aa a │a│ a 27 | aa a │a│ a 28 | aa a │a│ a 29 | aa a ╭───────╯a╰────╮ a 30 | aa a │rrrrrrrrrrrrrr╰───╮ a 31 | aa a ╰─╮rrrrrrrrrrrrrrrr│ a 32 | aa a ╰─╮rrrrrrrrrrrr╭─╯ a 33 | aa a ╰───╮a╭──────╯ a 34 | aa a │a│ a 35 | aa a │a│ rrrrrrrrrrr a 36 | aa a │a│ rrrrrrrrrrrr a 37 | aa a │a│ rrrrrrrr a 38 | aa a │a│ rr a 39 | aa a │a│ rrr a 40 | aa a │a│ a 41 | aa a │a│ a 42 | aa a │a│ rrrrrrrrrrr a 43 | aa a │a│ rrrrrrrrrrrr a 44 | aa a │a│ rrrrrrrr a 45 | aa a │a│ rr a 46 | aa a │a│ rrr a 47 | aa a │a│ a 48 | aa a │a│ a 49 | aa a │a│ a 50 | ╰─╯ 51 | ") 52 | -------------------------------------------------------------------------------- /tests/bench08.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | (uniline-bench 23 | " a 24 | a 25 | a 26 | 2* 3*a 27 | c 28 | 6* 4*h 29 | h 30 | 2* h 31 | 9*h 32 | h 33 | 4*h 34 | 3* h 35 | h 36 | 37 | + c 38 | 5* 4*g 39 | g 40 | g 41 | g 42 | g 43 | g 44 | 2* g 45 | 2* g 46 | 2* g 47 | 4*g 48 | g 49 | g 50 | g 51 | g 52 | 2* g 53 | 2* g 54 | 2* g 55 | c 56 | 10* 8* 8*o 57 | o 58 | o 59 | o 60 | o 61 | o 62 | o 63 | o 64 | o 65 | 2* o 66 | 2* o 67 | 2* o 68 | 2* o 69 | 2* o 70 | o 71 | o 72 | o 73 | o 74 | o 75 | o 76 | o 77 | o 78 | c 79 | 2* i * 80 | 2* c" 81 | "\ 82 | aaaa╻ ╻hhhh╻ ╻hhhh╻ 83 | a┏━━┛ ┗━┓hh┗━━━━┛hh┏━┛ 84 | a┃ ┃hhhhhhhhhh┃ 85 | ╺┛ ┗━━━━━━━━━━┛ 86 | 87 | 88 | ╶───╮ ╭────────╮ 89 | gggg│ ╭╯oooooooo╰╮ 90 | ╶─╮g│ │o╭──────╮o│ 91 | │g│ │o│******│o│ 92 | │g│ │o│******│o│ 93 | ╶─╯g│ │o│******│o│ 94 | gggg│ │o╰╮*****│o│ 95 | gggg│ ╰╮o╰╮****│o│ 96 | ╶─╮g│ ╰╮o╰╮***│o│ 97 | │g│ ╰╮o╰───╯o│ 98 | ╶─╯g│ ╰╮ooooo╭╯ 99 | gggg│ ╰─────╯ 100 | ╶───╯ 101 | ") 102 | -------------------------------------------------------------------------------- /tests/bench21.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | ;; Test rectangle tracing & moving 23 | 24 | (uniline-bench 25 | " 26 | 5* 11* 27 | 15*S- 31*S- 2*S- 28 | # R 29 | 2* 30 | 31 | 3* 32 | 13*S- 25*S- S- S- 33 | # r 34 | 2* 35 | 2* 3* 36 | 9*S- 18*S- 37 | r 38 | 2* 39 | 2* 3* 40 | 5*S- 11*S- 41 | S- = r 42 | 2* 43 | 5* 2* 3* 4* 44 | 19*S- 16*S- 45 | 2* 46 | 2* 47 | 9*S- 27*S- 12*S- 48 | 2* 49 | 2* 50 | 15* 2* 51 | 27*S- 12*S- 9*S- 52 | 2* 53 | 2* 54 | 19* 9* 55 | 24*S- 21*S- 56 | 2* 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 | -------------------------------------------------------------------------------- /tests/bench22.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; URL: https://github.com/tbanel/uniline 8 | 9 | ;; Uniline is free software: you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; Uniline is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | (uniline-bench 23 | " 2* M-3 24 | M-9 M-3 M-5 M-4 M-11 2* 25 | a 26 | 3* 27 | 2*a 28 | 3* 29 | 3*a 30 | 3* 31 | 4*a 32 | 4* 33 | 5*a 34 | 2* 2* 35 | 36 | C-x SPC M-5 M-16 37 | c 38 | M-5 M-4 39 | C-SPC y s h 40 | 3*A M-3 41 | 42 | M-20 43 | C-SPC y s 4 44 | 3*B M-3 45 | 46 | C-SPC y s + 4 47 | 3*C M-3 48 | 49 | M-15 M-40 50 | C-x SPC y s + 51 | 3*D M-3 52 | 53 | M-0 M-8 54 | C-x SPC y 55 | C-x SPC y s 3 56 | 3*E M-3 57 | 58 | M-20 59 | C-x SPC y s 4 60 | 3*F M-3 61 | 62 | M-19 63 | C-SPC y s + 64 | 3*G M-3 65 | 66 | M-3 M-5 67 | 68 | 69 | M-18 70 | C-x SPC y s + 3 71 | 3*H M-3 72 | " 73 | "\ 74 | 75 | ╭──────────╮ AAA ┌──────────┐ CCC ┏┉┉┉┉┉┉┉┉┉┉┓ 76 | ╭───┼────╮ │ ┌───┼────┐ │ ┏┉┉┉╋┉┉┉┉┓ ┋ 77 | ╰─╮ │ │ ▽ └─┐ │ │ ▽ ┗┉┓ ┋ ┋ ▼ 78 | │ │ │ ╭──╯ │ │ │ ┌──┘ ┋ ┋ ┋ ┏┉┉┛ 79 | ▴ ╰────╯ ▼ ▴ └────┘ ▼ ▴ ┗┉┉┉┉┛ ▼ 80 | ╰───◃──←──╯ └───◃──←──┘ ┗┉┉┉◂┉┉←┉┉┛ 81 | 82 | EEE ╭╌╌╌╌╌╌╌╌╌╌╮ FFF ╭┈┈┈┈┈┈┈┈┈┈╮ GGG ┏━━━━━━━━━━┓ 83 | ╭╌╌╌┼╌╌╌╌╮ ┆ ╭┈┈┈┼┈┈┈┈╮ ┊ ┏━━━╋━━━━┓ ┃ 84 | ╰╌╮ ┆ ┆ ▽ ╰┈╮ ┊ ┊ ▽ ┗━┓ ┃ ┃ ▼ 85 | ┆ ┆ ┆ ╭╌╌╯ ┊ ┊ ┊ ╭┈┈╯ ┃ ┃ ┃ ┏━━┛ 86 | ▴ ╰╌╌╌╌╯ ▼ ▴ ╰┈┈┈┈╯ ▼ ▴ ┗━━━━┛ ▼ 87 | ╰╌╌╌◃╌╌←╌╌╯ ╰┈┈┈◃┈┈←┈┈╯ ┗━━━◂━━←━━┛ 88 | 89 | 90 | DDD ┏━━━━━━━━━━┓ HHH ┏╍╍╍╍╍╍╍╍╍╍┓ 91 | ┏━━━╋━━━━┓ ┃ ┏╍╍╍╋╍╍╍╍┓ ┇ 92 | ┗━┓ ┃ ┃ ▼ ┗╍┓ ┇ ┇ ▼ 93 | ┃ ┃ ┃ ┏━━┛ ┇ ┇ ┇ ┏╍╍┛ 94 | ▴ ┗━━━━┛ ▼ ▴ ┗╍╍╍╍┛ ▼ 95 | ┗━━━◂━━←━━┛ ┗╍╍╍◂╍╍←╍╍┛ 96 | 97 | ") 98 | -------------------------------------------------------------------------------- /uniline.el: -------------------------------------------------------------------------------- 1 | ;;; uniline.el --- Add▶ ■─UNICODE based diagrams─■ to▶ ■─text files─■ -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; Package-Requires: ((emacs "29.1") (hydra "0.15.0")) 8 | ;; Keywords: convenience, text 9 | ;; URL: https://github.com/tbanel/uniline 10 | 11 | ;; Uniline is free software: you can redistribute it and/or modify 12 | ;; it under the terms of the GNU General Public License as published by 13 | ;; the Free Software Foundation, either version 3 of the License, or 14 | ;; (at your option) any later version. 15 | 16 | ;; Uniline is distributed in the hope that it will be useful, 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | ;; GNU General Public License for more details. 20 | 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see . 23 | 24 | ;;; Commentary: 25 | ;; ┏━━━━━━━┓ 26 | ;; ╭──────╮ ┃ thick ┣═◁═╗ 27 | ;; │ thin ┝◀━━━┫ box ┃ ║ 28 | ;; │ box │ ┗━━━━━━━┛ ║ 29 | ;; ╰───┬──╯ ╔══════╩═╗ 30 | ;; ↓ ║ double ║ 31 | ;; ╰────────────╢ box ║ 32 | ;; ╚════╤═══╝ 33 | ;; ▛▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▜ │ 34 | ;; ▌quadrant-blocks▐─◁─╯ 35 | ;; ▙▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▟ 36 | ;; 37 | ;;╭─Pure text────────────────□ 38 | ;;│ UNICODE characters are available to draw nice boxes and lines. 39 | ;;│ They come in 4 flavours: thin, thick, double, and quadrant-blocks. 40 | ;;│ Uniline makes it easy to draw and combine all 4 flavours. 41 | ;;│ Use the arrows on the keyboard to move around leaving a line behind. 42 | ;;╰──────────────────────────╮ 43 | ;;╭─Minor mode───────────────╯ 44 | ;;│ Uniline is a minor mode. Enter it with: 45 | ;;│ M-x uniline-mode 46 | ;;│ Leave it with: 47 | ;;│ C-c C-c 48 | ;;╰──────────────────────────╮ 49 | ;;╭─Fonts────────────────────╯ 50 | ;;│ A font able to displays the needed UNICODE characters have to 51 | ;;│ be used. It works well with the following families: 52 | ;;│ - DejaVu Sans Mono 53 | ;;│ - Unifont 54 | ;;│ - Hack 55 | ;;│ - JetBrains Mono 56 | ;;│ - Cascadia Mono 57 | ;;│ - Agave 58 | ;;│ - JuliaMono 59 | ;;│ - FreeMono 60 | ;;│ - Iosevka Comfy Fixed, Iosevka Comfy Wide Fixed 61 | ;;│ - Aporetic Sans Mono, Aporetic Serif Mono 62 | ;;│ - Source Code Pro 63 | ;;╰──────────────────────────╮ 64 | ;;╭─UTF-8────────────────────╯ 65 | ;;│ Also, the encoding of the file must support UNICODE. 66 | ;;│ One way to do that, is to add a line like this one 67 | ;;│ at the top of your file: 68 | ;;│ -*- coding:utf-8; -*- 69 | ;;╰──────────────────────────╮ 70 | ;;╭─Hydra or Transient───────╯ 71 | ;;│ Uniline comes with two flavours of user interfaces: 72 | ;;│ Hydra and Transient. 73 | ;;│ Both versions are compiled when installing the package. 74 | ;;│ 75 | ;;│ Then one or the other packages must be loaded (not both) 76 | ;;│ for example with: 77 | ;;│ (require 'uniline-hydra) 78 | ;;│ or 79 | ;;│ (use-package uniline-hydra 80 | ;;│ :bind ("C-" . uniline-mode)) 81 | ;;│ 82 | ;;│ This file, uniline-core.el, is the largest one, the one 83 | ;;│ implementing all the core functions independent from 84 | ;;│ Hydra or Transient 85 | ;;╰──────────────────────────□ 86 | 87 | ;;; Requires: 88 | (require 'uniline-hydra) 89 | 90 | ;; this is an alias for uniline-hydra 91 | 92 | (provide 'uniline) 93 | ;;; uniline.el ends here 94 | -------------------------------------------------------------------------------- /tests/uniline-bench.el: -------------------------------------------------------------------------------- 1 | ;;; uniline-bench.el --- Regression tests for Uniline -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; Package-Requires: ((emacs "29.1") (hydra "0.15.0")) 8 | ;; URL: https://github.com/tbanel/uniline 9 | 10 | ;; Uniline is free software: you can redistribute it and/or modify 11 | ;; it under the terms of the GNU General Public License as published by 12 | ;; the Free Software Foundation, either version 3 of the License, or 13 | ;; (at your option) any later version. 14 | 15 | ;; Uniline is distributed in the hope that it will be useful, 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | ;; GNU General Public License for more details. 19 | 20 | ;; You should have received a copy of the GNU General Public License 21 | ;; along with this program. If not, see . 22 | 23 | ;;; Commentary: 24 | 25 | ;; Running regression tests 26 | ;; Just load this file: 27 | ;; (load "uniline-bench.el") 28 | ;; or 29 | ;; (eval-buffer) 30 | ;; 31 | ;; If OK, a message is displayed 32 | ;; If ERROR, two windows are displayed, the actual and the expected sketchs 33 | ;; with points on the first difference. 34 | 35 | ;; Creating a new bench 36 | ;; - Eval (uniline-bench-create) 37 | ;; - Draw a sketch 38 | ;; - When done, type $ 39 | ;; A Lisp buffer implementing the new test is displayed 40 | ;; - Save it permanently in a file ending in *.el along with this one 41 | 42 | ;;; Code: 43 | 44 | (defvar uniline-bench-result 45 | nil 46 | "Boolean where a bench result is stored. 47 | t if the bench ran as expected. 48 | nil if there was an error.") 49 | 50 | (defun uniline-bench (commands result) 51 | "Run a bench. 52 | COMMANDS is a string describing a sequence of keyboard strokes, 53 | supposed to draw a sketch using uniline minor-mode. 54 | Its format is the one used to store keyboard macros. 55 | RESULT is a string representing the expected result." 56 | (ignore-errors (kill-buffer "*uniline-interactive*")) 57 | (switch-to-buffer "*uniline-interactive*") 58 | ;; (set-default 'uniline-hint-style 1) 59 | (let ((uniline-show-welcome-message nil)) 60 | (uniline-mode 1)) 61 | (if (fboundp 'hydra-keyboard-quit) 62 | (hydra-keyboard-quit)) ;; clear any left-over from previous bench 63 | (if (fboundp 'transient-quit-all) 64 | (transient-quit-all)) ;; clear any left-over from previous bench 65 | (setq uniline--which-quadrant (uniline--char-to-4quadb ?▘)) 66 | (setq uniline-brush 1) 67 | (execute-kbd-macro (kbd commands)) 68 | 69 | (setq uniline-bench-result 70 | (string-equal 71 | (buffer-substring (point-min) (point-max)) 72 | result)) 73 | 74 | (unless uniline-bench-result 75 | (delete-other-windows) 76 | (switch-to-buffer "*uniline-interactive*") 77 | (goto-char (point-min)) 78 | (ignore-errors (kill-buffer "*uniline-expected*")) 79 | (switch-to-buffer-other-window "*uniline-expected*") 80 | (insert result) 81 | (goto-char (point-min)) 82 | (compare-windows nil)) 83 | 84 | uniline-bench-result) 85 | 86 | (defun uniline-bench-create () 87 | "Interactively create a bench. 88 | An empty buffer is made available, with uniline mode active. 89 | Draw a sketch. 90 | When done, type $. 91 | A Lisp buffer able to automatically re-run the drawing is presented. 92 | Save it in a *.el file along with other benches." 93 | (interactive) 94 | (ignore-errors (kill-buffer "*uniline-interactive*")) 95 | (switch-to-buffer "*uniline-interactive*") 96 | (uniline-mode) 97 | (local-set-key "$" 'uniline-bench-collect) 98 | (message "draw a sketch, type $ whend done") 99 | (kmacro-start-macro nil)) 100 | 101 | (defun uniline-bench-collect () 102 | "Called when typing $ to close the interactive drawing. 103 | Do not call it directly." 104 | (interactive) 105 | (kmacro-end-macro 1) 106 | (ignore-errors (kill-buffer "b.el")) 107 | (switch-to-buffer "b.el") 108 | (insert "(uniline-bench\n\"") 109 | (insert (key-description (kmacro--keys (kmacro last-kbd-macro)))) 110 | (insert "\"\n\"\\\n") 111 | (insert-buffer-substring "*uniline-interactive*") 112 | (insert "\")\n") 113 | (lisp-mode)) 114 | 115 | (defmacro uniline-bench-numcompact-n (n) 116 | "If N is 3, replace in the buffer to 3* 117 | It is a macro, because N is a dynamic variable which must be 118 | inserted into a regexp." 119 | `(save-excursion 120 | (replace-regexp 121 | (rx " " 122 | (group (+ (any "a-zA-Z<>-"))) 123 | (= ,(1- n) 124 | (+ blank) 125 | (backref 1))) 126 | ,(format " %d*\\1" n)))) 127 | 128 | (defun uniline-bench-numcompact () 129 | "Change to 3*. 130 | The `kbd' function understand this notation. 131 | And it is easier to read. 132 | Put the cursor inside the string to modify." 133 | (interactive) 134 | (search-backward "\"") 135 | (narrow-to-region (point) (progn (forward-sexp) (point))) 136 | (goto-char (point-min)) 137 | (uniline-bench-numcompact-n 27) 138 | (uniline-bench-numcompact-n 26) 139 | (uniline-bench-numcompact-n 25) 140 | (uniline-bench-numcompact-n 24) 141 | (uniline-bench-numcompact-n 23) 142 | (uniline-bench-numcompact-n 22) 143 | (uniline-bench-numcompact-n 21) 144 | (uniline-bench-numcompact-n 20) 145 | (uniline-bench-numcompact-n 19) 146 | (uniline-bench-numcompact-n 18) 147 | (uniline-bench-numcompact-n 17) 148 | (uniline-bench-numcompact-n 16) 149 | (uniline-bench-numcompact-n 15) 150 | (uniline-bench-numcompact-n 14) 151 | (uniline-bench-numcompact-n 13) 152 | (uniline-bench-numcompact-n 12) 153 | (uniline-bench-numcompact-n 11) 154 | (uniline-bench-numcompact-n 10) 155 | (uniline-bench-numcompact-n 9) 156 | (uniline-bench-numcompact-n 8) 157 | (uniline-bench-numcompact-n 7) 158 | (uniline-bench-numcompact-n 6) 159 | (uniline-bench-numcompact-n 5) 160 | (uniline-bench-numcompact-n 4) 161 | (uniline-bench-numcompact-n 3) 162 | (uniline-bench-numcompact-n 2) 163 | (widen)) 164 | 165 | (defun uniline-bench-run (&rest files) 166 | "Run all benches, or a specified list. 167 | When FILES is nil, the benches are all files with *.el suffix. 168 | Stops on the first error, presenting two buffers, 169 | - one with the actual drawing, 170 | - the other with the expected drawing, 171 | with points on the first difference. 172 | If there are no errors, a summary is presented." 173 | (interactive) 174 | (unless files 175 | (setq files 176 | (directory-files "." nil "^bench.*\\.el$"))) 177 | (let* ((buf (current-buffer)) 178 | (nbpassed 0) 179 | (nbfailed 0) 180 | (failed 181 | (cl-loop 182 | for file in files 183 | do 184 | (load (format "%s%s" default-directory file) nil nil t) 185 | (if uniline-bench-result 186 | (cl-incf nbpassed) 187 | (cl-incf nbfailed) 188 | (message "%s FAILED" file)) 189 | unless uniline-bench-result 190 | collect file))) 191 | (switch-to-buffer buf) 192 | (message "%s PASSED / %s FAILED %s" nbpassed nbfailed failed))) 193 | 194 | (pcase 0 195 | (0 196 | (uniline-bench-run)) 197 | (1 198 | (garbage-collect) 199 | (profiler-start 'cpu+mem) 200 | (uniline-bench-run) 201 | (profiler-stop) 202 | (profiler-report)) 203 | (2 204 | (garbage-collect) 205 | (elp-instrument-package "uniline") 206 | (uniline-bench-run) 207 | (elp-results) 208 | (elp-restore-all))) 209 | 210 | (if nil 211 | (uniline-bench-run "bench26.el" "bench27.el")) 212 | 213 | (provide 'uniline-bench) 214 | ;;; uniline-bench.el ends here 215 | -------------------------------------------------------------------------------- /uniline-transient.el: -------------------------------------------------------------------------------- 1 | ;;; uniline-transient.el --- Add▶ ■─UNICODE based diagrams─■ to▶ ■─text files─■ -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; Package-Requires: ((emacs "29.1")) 8 | ;; Keywords: convenience, text 9 | ;; URL: https://github.com/tbanel/uniline 10 | 11 | ;; Uniline is free software: you can redistribute it and/or modify 12 | ;; it under the terms of the GNU General Public License as published by 13 | ;; the Free Software Foundation, either version 3 of the License, or 14 | ;; (at your option) any later version. 15 | 16 | ;; Uniline is distributed in the hope that it will be useful, 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | ;; GNU General Public License for more details. 20 | 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see . 23 | 24 | ;;; Commentary: 25 | ;; ┏━━━━━━━┓ 26 | ;; ╭──────╮ ┃ thick ┣═◁═╗ 27 | ;; │ thin ┝◀━━━┫ box ┃ ║ 28 | ;; │ box │ ┗━━━━━━━┛ ║ 29 | ;; ╰───┬──╯ ╔══════╩═╗ 30 | ;; ↓ ║ double ║ 31 | ;; ╰────────────╢ box ║ 32 | ;; ╚════╤═══╝ 33 | ;; ▛▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▜ │ 34 | ;; ▌quadrant-blocks▐─◁─╯ 35 | ;; ▙▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▟ 36 | ;; 37 | ;;╭─Pure text────────────────□ 38 | ;;│ UNICODE characters are available to draw nice boxes and lines. 39 | ;;│ They come in 4 flavours: thin, thick, double, and quadrant-blocks. 40 | ;;│ Uniline makes it easy to draw and combine all 4 flavours. 41 | ;;│ Use the arrows on the keyboard to move around leaving a line behind. 42 | ;;╰──────────────────────────╮ 43 | ;;╭─Minor mode───────────────╯ 44 | ;;│ Uniline is a minor mode. Enter it with: 45 | ;;│ M-x uniline-mode 46 | ;;│ Leave it with: 47 | ;;│ C-c C-c 48 | ;;╰──────────────────────────╮ 49 | ;;╭─Fonts────────────────────╯ 50 | ;;│ A font able to displays the needed UNICODE characters have to 51 | ;;│ be used. It works well with the following families: 52 | ;;│ - DejaVu Sans Mono 53 | ;;│ - Unifont 54 | ;;│ - Hack 55 | ;;│ - JetBrains Mono 56 | ;;│ - Cascadia Mono 57 | ;;│ - Agave 58 | ;;│ - JuliaMono 59 | ;;│ - FreeMono 60 | ;;│ - Iosevka Comfy Fixed, Iosevka Comfy Wide Fixed 61 | ;;│ - Aporetic Sans Mono, Aporetic Serif Mono 62 | ;;│ - Source Code Pro 63 | ;;╰──────────────────────────╮ 64 | ;;╭─UTF-8────────────────────╯ 65 | ;;│ Also, the encoding of the file must support UNICODE. 66 | ;;│ One way to do that, is to add a line like this one 67 | ;;│ at the top of your file: 68 | ;;│ -*- coding:utf-8; -*- 69 | ;;╰──────────────────────────╮ 70 | ;;╭─Hydra or Transient───────╯ 71 | ;;│ Uniline comes with two flavours of user interfaces: 72 | ;;│ Hydra and Transient. 73 | ;;│ Both versions are compiled when installing the package. 74 | ;;│ 75 | ;;│ Then one or the other packages must be loaded (not both) 76 | ;;│ for example with: 77 | ;;│ (require 'uniline-hydra) 78 | ;;│ or 79 | ;;│ (use-package uniline-hydra 80 | ;;│ :bind ("C-" . uniline-mode)) 81 | ;;│ 82 | ;;│ This file, uniline-transient.el, implements the Transient interface 83 | ;;│ and calls the functions defined by uniline-core.el 84 | ;;╰──────────────────────────□ 85 | 86 | ;;; Requires: 87 | (require 'uniline-core) 88 | 89 | ;;; Code: 90 | 91 | ;;;╭───────────────────╮ 92 | ;;;│Transient interface│ 93 | ;;;╰───────────────────╯ 94 | 95 | (require 'transient) 96 | 97 | (defun uniline--self-insert-command (N) 98 | "To fool transient into thinking this is NOT self-insert-command." 99 | (interactive) 100 | (self-insert-command N)) 101 | 102 | ;; make this transient setting buffer local, so that Uniline can 103 | ;; tweak it without touching other usages like Magit for instance 104 | (make-variable-buffer-local 'transient-show-popup) 105 | 106 | (defun uniline-toggle-hints (&optional notoggle) 107 | "Toggle between styles of transient hints. 108 | When NOTOGGLE is t, do not toggle `uniline-hint-style', 109 | just put everything in sync." 110 | (interactive) 111 | (unless notoggle 112 | (setq transient-show-popup 113 | (cond 114 | ((eq transient-show-popup t) nil) 115 | ((eq transient-show-popup nil) t) 116 | ((numberp transient-show-popup) t)))) 117 | (setq uniline-hint-style 118 | (cond 119 | ((eq transient-show-popup t) t) 120 | ((eq transient-show-popup nil) 1) 121 | ((numberp transient-show-popup) 1)))) 122 | 123 | (transient-define-suffix uniline-toggle-transient-hints-suffix () 124 | "Toggle between full and one-liner menus. 125 | Associated with C-t, which does half the work natively in Transient: 126 | one-liner → full menu. 127 | Additionally, modify transient-show-popup so that the choice is remembered 128 | for later menu invocation in the same Uniline session." 129 | :transient 'transient--do-exit 130 | (interactive) 131 | (uniline-toggle-hints) 132 | (setq transient--showp nil) 133 | (eval-when-compile ;; suppress compilation warning "slot :command unknown" 134 | (put :command 'slot-name t)) 135 | (transient-setup (eieio-oref (transient-prefix-object) :command))) 136 | 137 | ;; Define common command classes to control state transitions 138 | 139 | (transient-define-suffix uniline--persistent-command (&rest args) 140 | "Base class for commands that should keep the transient state active." 141 | :transient t 142 | (interactive) 143 | args) ;; to avoid warnings 144 | 145 | (transient-define-suffix uniline--exit-command () 146 | "Base class for commands that should exit the transient state." 147 | :transient nil) 148 | 149 | (transient-define-prefix uniline-transient-fonts () 150 | "Font selection menu." 151 | :info-manual "(uniline) Which fonts?" 152 | :transient-non-suffix 'transient-quit-one 153 | [:class 154 | transient-columns 155 | :pad-keys t 156 | ["Try a font" 157 | ("d" (lambda () (uniline--font-name-ticked ?d)) uniline--set-font-d :transient t) 158 | ("h" (lambda () (uniline--font-name-ticked ?h)) uniline--set-font-h :transient t) 159 | ("c" (lambda () (uniline--font-name-ticked ?c)) uniline--set-font-c :transient t) 160 | ("j" (lambda () (uniline--font-name-ticked ?j)) uniline--set-font-j :transient t) 161 | ("s" (lambda () (uniline--font-name-ticked ?s)) uniline--set-font-s :transient t)] 162 | ["" 163 | ("b" (lambda () (uniline--font-name-ticked ?b)) uniline--set-font-b :transient t) 164 | ("f" (lambda () (uniline--font-name-ticked ?f)) uniline--set-font-f :transient t) 165 | ("a" (lambda () (uniline--font-name-ticked ?a)) uniline--set-font-a :transient t) 166 | ("u" (lambda () (uniline--font-name-ticked ?u)) uniline--set-font-u :transient t)] 167 | ["" 168 | ("i" (lambda () (uniline--font-name-ticked ?i)) uniline--set-font-i :transient t) 169 | ("I" (lambda () (uniline--font-name-ticked ?I)) uniline--set-font-I :transient t) 170 | ("p" (lambda () (uniline--font-name-ticked ?p)) uniline--set-font-p :transient t) 171 | ("P" (lambda () (uniline--font-name-ticked ?P)) uniline--set-font-P :transient t)] 172 | ["Actions" 173 | ("*" "Configure" uniline-customize-face) 174 | ("C-t" "Togg hints" uniline-toggle-transient-hints-suffix) 175 | ("q" "Quit" transient-quit-one) 176 | ("RET" "Quit" (lambda () (interactive)) :transient nil)]] 177 | (interactive) 178 | (transient-setup 'uniline-transient-fonts)) 179 | 180 | (transient-define-prefix uniline-transient-arrows () 181 | "Arrows and shapes interface." 182 | :info-manual "uniline" 183 | :transient-suffix 'transient--do-leave 184 | :transient-non-suffix 'transient--do-leave 185 | [:class 186 | transient-columns 187 | :pad-keys t 188 | ["Insert" 189 | ("a" "▷▶→▹▸↔" uniline-insert-fw-arrow :transient t) 190 | ("s" "□■◆◊" uniline-insert-fw-square :transient t) 191 | ("o" "·●◦Øø" uniline-insert-fw-oshape :transient t) 192 | ("x" "╳╱╲÷×±¤" uniline-insert-fw-cross :transient t)] 193 | ["" 194 | ("A" "↔▸▹→▶▷" uniline-insert-bw-arrow :transient t) 195 | ("S" "◊◆■□" uniline-insert-bw-square :transient t) 196 | ("O" "øØ◦●·" uniline-insert-bw-oshape :transient t) 197 | ("X" "¤±×÷╲╱╳" uniline-insert-bw-cross :transient t)] 198 | ["" 199 | ("-" "-" uniline--self-insert-- :transient t) 200 | ("+" "+" uniline--self-insert-+ :transient t) 201 | ("=" "=" self-insert-command :transient t) 202 | ("#" "#" self-insert-command :transient t)] 203 | ["Rotate & tweak" 204 | ("S-" "↑" uniline-rotate-up↑ :transient t) 205 | ("S-" "→" uniline-rotate-ri→ :transient t) 206 | ("S-" "↓" uniline-rotate-dw↓ :transient t) 207 | ("S-" "←" uniline-rotate-lf← :transient t)] 208 | ["Text dir" 209 | ("C-" "↑" uniline-text-direction-up↑ :transient nil) 210 | ("C-" "→" uniline-text-direction-ri→ :transient nil) 211 | ("C-" "↓" uniline-text-direction-dw↓ :transient nil) 212 | ("C-" "←" uniline-text-direction-lf← :transient nil)] 213 | ["Contour, Fill" 214 | ("c" "Draw contour" uniline-contour) 215 | ("C" "Ovwrt contour" (lambda () (interactive) (uniline-contour t))) 216 | ("i" "Fill area" uniline-fill)] 217 | ["Navigation" 218 | ("f" "Choose font" uniline-transient-fonts) 219 | ("C-t" "Togg hints" uniline-toggle-transient-hints-suffix) 220 | ("RET" "Quit" (lambda () (interactive)) :transient nil)]] 221 | (interactive) 222 | ;; the purpose of this keymap handling is to regain the basic behavior 223 | ;; of & 224 | ;; those keys were captured by Transient to navigate in the transient menu 225 | ;; the desired behavior is to exit this Transient menu and trace lines 226 | (let ((transient-popup-navigation-map 227 | (define-keymap 228 | "" #'transient-noop 229 | "C-r" #'transient-isearch-backward 230 | "C-s" #'transient-isearch-forward 231 | "M-RET" #'transient-push-button))) 232 | (transient-setup 'uniline-transient-arrows))) 233 | 234 | (transient-define-prefix uniline-transient-alt-styles () 235 | "Change lines style interface." 236 | :info-manual "(uniline) Rectangular actions" 237 | :transient-non-suffix 'transient-quit-one 238 | [:class 239 | transient-columns 240 | :pad-keys t 241 | ["Dashes" 242 | ("3" "3x2 dots" uniline-change-style-dot-3-2 :transient t) 243 | ("4" "4x4 dots" uniline-change-style-dot-4-4 :transient t) 244 | ("h" "hard corner" uniline-change-style-hard-corners :transient t)] 245 | ["Thickness" 246 | ("-" "thin" uniline-change-style-thin :transient t) 247 | ("+" "thick" uniline-change-style-thick :transient t) 248 | ("=" "double" uniline-change-style-double :transient t)] 249 | ["Base style" 250 | ("0" "standard" uniline-change-style-standard :transient t) 251 | ("a" "aa2u" uniline-aa2u-rectangle :transient t)] 252 | ;;["Move rectangle" 253 | ;; ("" "→" uniline-move-rect-ri→ :transient t) 254 | ;; ("" "←" uniline-move-rect-lf← :transient t) 255 | ;; ("" "↑" uniline-move-rect-up↑ :transient t) 256 | ;; ("" "↓" uniline-move-rect-dw↓ :transient t)] 257 | ["Misc" 258 | ("f" "fonts" uniline-transient-fonts) 259 | ("C-t" "Togg hints" uniline-toggle-transient-hints-suffix) 260 | ("s" "back" uniline-transient-moverect) 261 | ("RET" "exit" uniline--rect-quit)] 262 | ] 263 | (interactive) 264 | (rectangle-mark-mode 1) 265 | (transient-setup 'uniline-transient-alt-styles)) 266 | 267 | (transient-define-prefix uniline-transient-moverect () 268 | "Rectangle manipulation interface." 269 | :info-manual "(uniline) Rectangular actions" 270 | :transient-non-suffix 'transient-quit-one 271 | [:class 272 | transient-columns 273 | :pad-keys t 274 | ["Move" 275 | ("" "←" uniline-move-rect-lf← :transient t) 276 | ("" "→" uniline-move-rect-ri→ :transient t) 277 | ("" "↑" uniline-move-rect-up↑ :transient t) 278 | ("" "↓" uniline-move-rect-dw↓ :transient t)] 279 | ["Draw" 280 | ("r" "Trace inner" uniline-draw-inner-rectangle :transient t) 281 | ("R" "Trace outer" uniline-draw-outer-rectangle :transient t) 282 | ("C-r" "Ovwrt inner" uniline-overwrite-inner-rectangle :transient t) 283 | ("C-S-R" "Ovwrt outer" uniline-overwrite-outer-rectangle :transient t) 284 | ("i" "Fill" uniline-fill-rectangle :transient t)] 285 | ["Copy-paste" 286 | ("c" "Copy" uniline-copy-rectangle :transient nil) 287 | ("k" "Kill" uniline-kill-rectangle :transient nil) 288 | ("y" "Yank" uniline-yank-rectangle :transient t)] 289 | ["Brush" 290 | ("-" "╭─╯" uniline-set-brush-1 :transient t) 291 | ("+" "┏━┛" uniline-set-brush-2 :transient t) 292 | ("=" "╔═╝" uniline-set-brush-3 :transient t) 293 | ("#" "▄▄▟" uniline-set-brush-block :transient t) 294 | ("DEL" "DEL" uniline-set-brush-0 :transient t)] 295 | ["Misc" 296 | ("s" "Line styles" uniline-transient-alt-styles) 297 | ("f" "Choose font" uniline-transient-fonts) 298 | ;;("C-x C-x" "Exchg point-mark" rectangle-exchange-point-and-mark :transient t) 299 | ("C-t" "Togg hints" uniline-toggle-transient-hints-suffix) 300 | ("RET" "Exit" uniline--rect-quit)] 301 | ] 302 | (interactive) 303 | (rectangle-mark-mode 1) 304 | (transient-setup 'uniline-transient-moverect)) 305 | 306 | ;; those low-value helper-functions are needed because for an unknown reason 307 | ;; calling a macro exits a transient menu, so we have to re-enter it 308 | (defun uniline--transient-call-macro-in-direction-up↑ () 309 | (interactive) 310 | (uniline-call-macro-in-direction-up↑) 311 | (transient-setup 'uniline-transient-macro-exec)) 312 | (defun uniline--transient-call-macro-in-direction-ri→ () 313 | (interactive) 314 | (uniline-call-macro-in-direction-ri→) 315 | (transient-setup 'uniline-transient-macro-exec)) 316 | (defun uniline--transient-call-macro-in-direction-dw↓ () 317 | (interactive) 318 | (uniline-call-macro-in-direction-dw↓) 319 | (transient-setup 'uniline-transient-macro-exec)) 320 | (defun uniline--transient-call-macro-in-direction-lf← () 321 | (interactive) 322 | (uniline-call-macro-in-direction-lf←) 323 | (transient-setup 'uniline-transient-macro-exec)) 324 | (defun uniline--transient-call-macro () 325 | (interactive) 326 | (kmacro-end-and-call-macro 1) 327 | (transient-setup 'uniline-transient-macro-exec)) 328 | 329 | (defun uniline-macro-exec () 330 | (interactive) 331 | (transient-setup 'uniline-transient-macro-exec)) 332 | 333 | (transient-define-prefix uniline-transient-macro-exec () 334 | "Macro execution interface." 335 | :info-manual "(uniline) Macros" 336 | :transient-non-suffix 'transient-quit-one 337 | [:class 338 | transient-columns 339 | :pad-keys t 340 | ["Call macro in direction" 341 | ("" "→" uniline--transient-call-macro-in-direction-ri→) 342 | ("" "↑" uniline--transient-call-macro-in-direction-up↑) 343 | ("" "↓" uniline--transient-call-macro-in-direction-dw↓) 344 | ("" "←" uniline--transient-call-macro-in-direction-lf←)] 345 | ["" 346 | ("e" "Normal call" uniline--transient-call-macro) 347 | ("C-t" "Togg hints" uniline-toggle-transient-hints-suffix) 348 | ("RET" "Quit" transient-quit-one) 349 | ("q" "Quit" transient-quit-one)] 350 | ] 351 | (interactive) 352 | (transient-setup 'uniline-transient-macro-exec)) 353 | 354 | (eval-when-compile 355 | ;; this ugly patch removes dumb compilation warnings. 356 | ;; they appear when loading this file, then byte-compiling it. 357 | (dolist 358 | (s '(uniline-transient-moverect 359 | uniline-transient-arrows)) 360 | (plist-put (symbol-plist s) 'interactive-only nil))) 361 | 362 | (defun uniline-launch-interface () 363 | "Choose between rectangle and arrows interface based on selection." 364 | (interactive) 365 | (if (region-active-p) 366 | (uniline-transient-moverect) 367 | (uniline-transient-arrows))) 368 | 369 | (provide 'uniline-transient) 370 | ;;; uniline-transient.el ends here 371 | -------------------------------------------------------------------------------- /uniline-hydra.el: -------------------------------------------------------------------------------- 1 | ;;; uniline-hydra.el --- Add▶ ■─UNICODE based diagrams─■ to▶ ■─text files─■ -*- coding:utf-8; lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2024-2025 Thierry Banel 4 | 5 | ;; Author: Thierry Banel tbanelwebmin at free dot fr 6 | ;; Version: 1.0 7 | ;; Package-Requires: ((emacs "29.1") (hydra "0.15.0")) 8 | ;; Keywords: convenience, text 9 | ;; URL: https://github.com/tbanel/uniline 10 | 11 | ;; Uniline is free software: you can redistribute it and/or modify 12 | ;; it under the terms of the GNU General Public License as published by 13 | ;; the Free Software Foundation, either version 3 of the License, or 14 | ;; (at your option) any later version. 15 | 16 | ;; Uniline is distributed in the hope that it will be useful, 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | ;; GNU General Public License for more details. 20 | 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see . 23 | 24 | ;;; Commentary: 25 | ;; ┏━━━━━━━┓ 26 | ;; ╭──────╮ ┃ thick ┣═◁═╗ 27 | ;; │ thin ┝◀━━━┫ box ┃ ║ 28 | ;; │ box │ ┗━━━━━━━┛ ║ 29 | ;; ╰───┬──╯ ╔══════╩═╗ 30 | ;; ↓ ║ double ║ 31 | ;; ╰────────────╢ box ║ 32 | ;; ╚════╤═══╝ 33 | ;; ▛▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▜ │ 34 | ;; ▌quadrant-blocks▐─◁─╯ 35 | ;; ▙▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▟ 36 | ;; 37 | ;;╭─Pure text────────────────□ 38 | ;;│ UNICODE characters are available to draw nice boxes and lines. 39 | ;;│ They come in 4 flavours: thin, thick, double, and quadrant-blocks. 40 | ;;│ Uniline makes it easy to draw and combine all 4 flavours. 41 | ;;│ Use the arrows on the keyboard to move around leaving a line behind. 42 | ;;╰──────────────────────────╮ 43 | ;;╭─Minor mode───────────────╯ 44 | ;;│ Uniline is a minor mode. Enter it with: 45 | ;;│ M-x uniline-mode 46 | ;;│ Leave it with: 47 | ;;│ C-c C-c 48 | ;;╰──────────────────────────╮ 49 | ;;╭─Fonts────────────────────╯ 50 | ;;│ A font able to displays the needed UNICODE characters have to 51 | ;;│ be used. It works well with the following families: 52 | ;;│ - DejaVu Sans Mono 53 | ;;│ - Unifont 54 | ;;│ - Hack 55 | ;;│ - JetBrains Mono 56 | ;;│ - Cascadia Mono 57 | ;;│ - Agave 58 | ;;│ - JuliaMono 59 | ;;│ - FreeMono 60 | ;;│ - Iosevka Comfy Fixed, Iosevka Comfy Wide Fixed 61 | ;;│ - Aporetic Sans Mono, Aporetic Serif Mono 62 | ;;│ - Source Code Pro 63 | ;;╰──────────────────────────╮ 64 | ;;╭─UTF-8────────────────────╯ 65 | ;;│ Also, the encoding of the file must support UNICODE. 66 | ;;│ One way to do that, is to add a line like this one 67 | ;;│ at the top of your file: 68 | ;;│ -*- coding:utf-8; -*- 69 | ;;╰──────────────────────────╮ 70 | ;;╭─Hydra or Transient───────╯ 71 | ;;│ Uniline comes with two flavours of user interfaces: 72 | ;;│ Hydra and Transient. 73 | ;;│ Both versions are compiled when installing the package. 74 | ;;│ 75 | ;;│ Then one or the other packages must be loaded (not both) 76 | ;;│ for example with: 77 | ;;│ (require 'uniline-hydra) 78 | ;;│ or 79 | ;;│ (use-package uniline-hydra 80 | ;;│ :bind ("C-" . uniline-mode)) 81 | ;;│ 82 | ;;│ This file, uniline-hydra.el, implements the Hydra interface 83 | ;;│ and calls the functions defined by uniline-core.el 84 | ;;╰──────────────────────────□ 85 | 86 | ;;; Requires: 87 | (require 'uniline-core) 88 | ;; (require 'hydra) ;; no hard dependency 89 | 90 | ;;; Code: 91 | 92 | (eval-when-compile 93 | ;; temporarily fix a bug about Hydra generating too long docstrings 94 | (setq byte-compile-docstring-max-column 2000)) 95 | 96 | ;;;╭────────────────╮ 97 | ;;;│Hydra interfaces│ 98 | ;;;╰────────────────╯ 99 | 100 | (require 'hydra nil t) 101 | 102 | (unless (featurep 'hydra) 103 | (eval-and-compile 104 | (defun uniline-launch-interface () 105 | "Fake function only when Hydra requested but not installed" 106 | (interactive) 107 | (warn "Uniline-Hydra requested, but Hydra is not installed.")))) 108 | 109 | (when (featurep 'hydra) 110 | (eval-and-compile 111 | 112 | (defun uniline--is-font-str (letter) 113 | "Return a tick-glyph ▶ if current font is the one presented by LETTER." 114 | (if (uniline--is-font letter) "▶" " ")) 115 | 116 | (defhydra uniline-hydra-fonts 117 | (:hint nil :exit nil) 118 | ;; Docstring MUST begin with an empty line to benefit from substitutions 119 | (concat 120 | (replace-regexp-in-string 121 | "_\\([dhcjbfsiIuapP]\\)_ " 122 | "_\\1_%s(uniline--is-font-str ?\\1)" 123 | "\ 124 | ╭^─Try a font^──^─^───────────^─^───────────────────╮╭^─^───^─^──────╮ 125 | │_d_ DejaVu _b_ JetBrains _i_ Iosevka Comfy ││_*_ ^^configure│ 126 | │_h_ Hack _f_ FreeMono _I_ Iosevka Comfy Wide││_C-t_^^ tg hint│ 127 | │_c_ Cascadia _a_ Agave _p_ Aporetic Sans ││_?_ ^^info-mode│ 128 | │_j_ JuliaMono _u_ Unifont _P_ Aporetic Serif ││_RET_ _q_ exit│ 129 | │_s_ Source Code Pro^^╭───────^─^───────────────────╯╰^─^───^─^──────╯ 130 | ╰^─^────────────^─^───╯")) 131 | ("d" uniline--set-font-d) 132 | ("u" uniline--set-font-u) 133 | ("h" uniline--set-font-h) 134 | ("b" uniline--set-font-b) 135 | ("c" uniline--set-font-c) 136 | ("a" uniline--set-font-a) 137 | ("j" uniline--set-font-j) 138 | ("f" uniline--set-font-f) 139 | ("i" uniline--set-font-i) 140 | ("I" uniline--set-font-I) 141 | ("p" uniline--set-font-p) 142 | ("P" uniline--set-font-P) 143 | ("s" uniline--set-font-s) 144 | ("*" uniline-customize-face :exit t) 145 | ("C-t" uniline-toggle-hints) 146 | ("TAB" uniline-toggle-hints) 147 | ("?" (info "(uniline) Which fonts?")) 148 | ("q" () :exit t) 149 | ("RET" () :exit t)) 150 | 151 | (defhydra uniline-hydra-arrows 152 | (:hint nil :exit nil) 153 | ;; Docstring MUST begin with an empty line to benefit from substitutions 154 | (concat 155 | (string-replace 156 | "Text dir────" 157 | "Text dir─╴%s(uniline-text-direction-str)╶" 158 | "\ 159 | ╭^─^─^Insert glyph^─^─^─^─^─╮╭^Rotate arrow^╮╭^─Contour─^╮╭^Text dir────^╮╭^─^─^─^──────────────╮ 160 | │_a_,_A_rrow ▷ ▶ → ▹ ▸ ↔^^^^│╭^Tweak glyph─^╮│_c_ contour││_C-_ ← ││_f_ ^^ choose font│ 161 | │_s_,_S_quare □ ■ ◆ ◊ ^^^^││_S-_ ← ││_C_ ovwrt ││_C-_ → ││_C-t_ ^^ short hint │ 162 | │_o_,_O_-shape · ● ◦ Ø ø^^^^││_S-_ → │╰^─────────^╯│_C-_ ↑ ││_?_ ^^ info-mode │ 163 | │_x_,_X_-cross ╳ ÷ × ± ¤^^^^││_S-_ ↑ │╭^─Fill────^╮│_C-_ ↓ ││_q_ _RET_ exit │ 164 | │_-_ _+_ _=_ _#_ self-insert││_S-_ ↓ ││_i_ fill │╰^─^───────────╯╰^─^─^─^──────────────╯ 165 | ╰^─^─^─^─^─^─^─^────────────╯╰^────────────^╯╰^─────────^╯")) 166 | ("a" uniline-insert-fw-arrow ) 167 | ("A" uniline-insert-bw-arrow ) 168 | ("s" uniline-insert-fw-square) 169 | ("S" uniline-insert-bw-square) 170 | ("o" uniline-insert-fw-oshape) 171 | ("O" uniline-insert-bw-oshape) 172 | ("x" uniline-insert-fw-cross ) 173 | ("X" uniline-insert-bw-cross ) 174 | ("S-" uniline-rotate-lf←) 175 | ("S-" uniline-rotate-ri→) 176 | ("S-" uniline-rotate-up↑) 177 | ("S-" uniline-rotate-dw↓) 178 | ("C-" uniline-text-direction-ri→ :exit t) 179 | ("C-" uniline-text-direction-lf← :exit t) 180 | ("C-" uniline-text-direction-up↑ :exit t) 181 | ("C-" uniline-text-direction-dw↓ :exit t) 182 | ("" uniline--self-insert--) 183 | ("" uniline--self-insert-+) 184 | ("-" self-insert-command) 185 | ("+" self-insert-command) 186 | ("=" self-insert-command) 187 | ("#" self-insert-command) 188 | ("f" uniline-hydra-fonts/body :exit t) 189 | ("c" uniline-contour :exit t) 190 | ("C" (uniline-contour t) :exit t) 191 | ("i" uniline-fill :exit t) 192 | ("q" () :exit t) 193 | ("C-t" uniline-toggle-hints) 194 | ("TAB" uniline-toggle-hints) 195 | ("?" (info "uniline")) 196 | ("RET" () :exit t)) 197 | 198 | (defhydra uniline-hydra-alt-styles 199 | (:pre (rectangle-mark-mode 1) :hint nil :exit nil) 200 | ;; Docstring MUST begin with an empty line to benefit from substitutions 201 | " 202 | ╭^Thickness^╮╭^─Alt styles^──╮╭^Base style^╮╭^─^─^─^──────────────╮ 203 | │_-_ thin ││_3_ 3x2 dots ││_0_ standard││_f_ ^^ choose font│ 204 | │_+_ thick ││_4_ 4x4 dots ││_a_ aa2u ││_C-t_ ^^ short hint │ 205 | │_=_ double ││_h_ hard corner│╰─^─^────────╯│_?_ ^^ info-mode │ 206 | ╰^─^────────╯╰^─^────────────╯ ^ ^ │_q_ _RET_ exit │ 207 | ^ ^ ^ ^ ^ ^ ╰^─^─^─^──────────────╯" 208 | ("3" uniline-change-style-dot-3-2) 209 | ("" uniline-change-style-dot-3-2) 210 | ("4" uniline-change-style-dot-4-4) 211 | ("" uniline-change-style-dot-4-4) 212 | ("h" uniline-change-style-hard-corners) 213 | ("0" uniline-change-style-standard) 214 | ("" uniline-change-style-standard) 215 | ("-" uniline-change-style-thin) 216 | ("" uniline-change-style-thin) 217 | ("+" uniline-change-style-thick) 218 | ("" uniline-change-style-thick) 219 | ("=" uniline-change-style-double) 220 | ("a" uniline-aa2u-rectangle) 221 | ;; copy here the bindings for handling rectangles 222 | ("" uniline-move-rect-ri→) 223 | ("" uniline-move-rect-lf←) 224 | ("" uniline-move-rect-up↑) 225 | ("" uniline-move-rect-dw↓) 226 | ("r" uniline-draw-inner-rectangle) 227 | ("R" uniline-draw-outer-rectangle) 228 | ("C-r" uniline-overwrite-inner-rectangle) 229 | ("C-S-R" uniline-overwrite-outer-rectangle) 230 | ("i" uniline-fill-rectangle) 231 | ("f" uniline-hydra-fonts/body :exit t) 232 | ("s" uniline-hydra-moverect/body :exit t) 233 | ;; misc. 234 | ("C-x C-x" rectangle-exchange-point-and-mark) 235 | ("C-t" uniline-toggle-hints) 236 | ("TAB" uniline-toggle-hints) 237 | ("?" (info "(uniline) Rectangular actions")) 238 | ("q" uniline--rect-quit :exit t) 239 | ("RET" uniline--rect-quit :exit t)) 240 | 241 | (defhydra uniline-hydra-moverect 242 | (:pre (rectangle-mark-mode 1) :hint nil :exit nil) 243 | ;; Docstring MUST begin with an empty line to benefit from substitutions 244 | " 245 | ╭^Move ^rect╮╭────^Draw^ rect────╮╭^─Rect^─╮╭^Brush^╮╭──^Misc^─────────╮ 246 | │__ →││_r_ trace inner││_c_ copy││_-_ ╭─╯││_s_ alt styles │ 247 | │__ ←││_R_ trace outer││_k_ kill││_+_ ┏━┛││_f_ choose font│ 248 | │__ ↑││_C-r_ ovewr inner││_y_ yank││_=_ ╔═╝││_C-t_ short hints│ 249 | │__ ↓││_C-S-R_ ovewr outer│╰^^┬─────╯╯_#_ ▄▄▟││_?_ info │ 250 | ╰^─────^────╯│_i_ fill │ ^^│__ DEL││_RET_ exit │ 251 | ^ ^ ╰^────^─────────────╯ ^^╰^────────^────╯╰^───^────────────╯ 252 | " 253 | ("" uniline-move-rect-ri→) 254 | ("" uniline-move-rect-lf←) 255 | ("" uniline-move-rect-up↑) 256 | ("" uniline-move-rect-dw↓) 257 | 258 | ("r" uniline-draw-inner-rectangle) 259 | ("R" uniline-draw-outer-rectangle) 260 | ("C-r" uniline-overwrite-inner-rectangle) 261 | ("C-S-R" uniline-overwrite-outer-rectangle) 262 | ("i" uniline-fill-rectangle) 263 | 264 | ("c" uniline-copy-rectangle :exit t) 265 | ("k" uniline-kill-rectangle :exit t) 266 | ("y" uniline-yank-rectangle) 267 | 268 | ("" uniline-set-brush-0) 269 | ("" uniline-set-brush-0) 270 | ("C-" uniline-set-brush-0) 271 | ("C-" uniline-set-brush-0) 272 | ("-" uniline-set-brush-1) 273 | ("" uniline-set-brush-1) 274 | ("+" uniline-set-brush-2) 275 | ("" uniline-set-brush-2) 276 | ("=" uniline-set-brush-3) 277 | ("#" uniline-set-brush-block) 278 | 279 | ("C-t" uniline-toggle-hints) 280 | ("TAB" uniline-toggle-hints) 281 | ("?" (info "(uniline) Rectangular actions")) 282 | ("f" uniline-hydra-fonts/body :exit t) 283 | ("s" uniline-hydra-alt-styles/body :exit t) 284 | ("C-x C-x" rectangle-exchange-point-and-mark) 285 | ("RET" uniline--rect-quit :exit t)) 286 | 287 | (defun uniline-launch-interface () 288 | "Choose between two Hydras based on selection. 289 | When selection is active, most likely user wants to act 290 | on a rectangle. 291 | Therefore the rectangle hydra is launched. 292 | Otherwise, the arrows & shapes hydra is invoked." 293 | (interactive) 294 | (let ((message-log-max)) ; avoid hint copied in *Messages* 295 | (if (region-active-p) 296 | (uniline-hydra-moverect/body) 297 | (uniline-hydra-arrows/body)))) 298 | 299 | (defhydra uniline-hydra-macro-exec 300 | (:hint nil :exit nil) 301 | ;; Docstring MUST begin with an empty line to benefit from substitutions 302 | " 303 | ╭^╴Call macro╶^───╮╭^^^^──────────────╮ 304 | │_e_ usual call ││_C-t_^^ short hint│ 305 | │__ call → ││_?_ ^^ info-mode │ 306 | │__ call ← ││_q_ _RET_ exit │ 307 | │__ call ↑ │╰^─^─^───^─────────╯ 308 | │__ call ↓ │ 309 | ╰^^───────────────╯" 310 | ("e" (kmacro-end-and-call-macro 1)) 311 | ("" uniline-call-macro-in-direction-ri→) 312 | ("" uniline-call-macro-in-direction-lf←) 313 | ("" uniline-call-macro-in-direction-up↑) 314 | ("" uniline-call-macro-in-direction-dw↓) 315 | ("C-t" uniline-toggle-hints) 316 | ("TAB" uniline-toggle-hints) 317 | ("?" (info "(uniline) Macros")) 318 | ("q" () :exit t) 319 | ("RET" () :exit t)) 320 | 321 | (defun uniline-macro-exec () 322 | (interactive) 323 | (uniline-hydra-macro-exec/body)) 324 | 325 | ;;;╭───────────────────╮ 326 | ;;;│Smaller hydra hints│ 327 | ;;;╰───────────────────╯ 328 | 329 | ;; Pack 2 hints in the usual uniline-hydra-*/hint variables 330 | ;; one is the standard hint created by `defhydra' 331 | ;; the other is a one-liner 332 | (setq 333 | uniline-hydra-arrows/hint 334 | `(if (eq uniline-hint-style t) 335 | ,uniline-hydra-arrows/hint 336 | ,(eval-when-compile 337 | (uniline--color-hint 338 | "glyph:^aAsSoOxX-+=#^ arr&tweak:^S-→←↑↓^ text-dir:^C-→←↑↓^ ^c^ontour f^i^ll ^f^onts ^C-t^"))) 339 | uniline-hydra-fonts/hint 340 | `(if (eq uniline-hint-style t) 341 | ,uniline-hydra-fonts/hint 342 | ,(eval-when-compile 343 | (uniline--color-hint 344 | "font:^dhcjbfsiIpPua^ config:^*^ hint:^C-t^"))) 345 | uniline-hydra-moverect/hint 346 | `(if (eq uniline-hint-style t) 347 | ,uniline-hydra-moverect/hint 348 | ,(eval-when-compile 349 | (uniline--color-hint 350 | "move:^→←↑↓^ trace:^rR C-rR^ copy-paste:^cky^ f^i^ll brush:^-+=# DEL^ ^s^tyle ^f^onts ^C-t^"))) 351 | uniline-hydra-macro-exec/hint 352 | `(if (eq uniline-hint-style t) 353 | ,uniline-hydra-macro-exec/hint 354 | ,(eval-when-compile 355 | (uniline--color-hint 356 | "macro exec, usual:^e^ directional:^→←↑↓^ hint:^C-t^"))) 357 | uniline-hydra-alt-styles/hint 358 | `(if (eq uniline-hint-style t) 359 | ,uniline-hydra-alt-styles/hint 360 | ,(eval-when-compile 361 | (uniline--color-hint 362 | "alt styles, thick:^-+=^ dashed:^34^ corners:^h^ standard:^0^ ^a^a2u ^C-t^")))) 363 | 364 | (defun uniline-toggle-hints (&optional notoggle) 365 | "Toggle between styles of hydra hints. 366 | When NOTOGGLE is t, do not toggle `uniline-hint-style', 367 | just put everything in sync." 368 | (interactive) 369 | (unless notoggle 370 | (setq uniline-hint-style 371 | (if (eq uniline-hint-style t) 1 t))) 372 | (cl-loop 373 | for hydra in 374 | '(uniline-hydra-arrows 375 | uniline-hydra-fonts 376 | uniline-hydra-moverect 377 | uniline-hydra-macro-exec 378 | uniline-hydra-alt-styles) 379 | do 380 | (hydra-set-property 381 | hydra :verbosity uniline-hint-style))) 382 | 383 | )) 384 | 385 | (provide 'uniline-hydra) 386 | ;;; uniline-hydra.el ends here 387 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.org: -------------------------------------------------------------------------------- 1 | # -*- mode: org; coding:utf-8; -*- 2 | #+TITLE: Uniline 3 | #+OPTIONS: ^:{} authors:Thierry Banel, toc:nil 4 | #+LATEX_HEADER: \usepackage{pmboxdraw} 5 | 6 | * Getting started in 10 seconds 7 | :PROPERTIES: 8 | :CUSTOM_ID: getting-started-in-10-seconds 9 | :END: 10 | 11 | - Type =M-x uniline-mode= 12 | - Move cursor with the arrow-keys on the keyboard =→ ← ↑ ↓= 13 | - Quit =C-c C-c= 14 | 15 | [[file:images/first-drawing.png]] 16 | 17 | #+begin_example 18 | ╷ ╭─────────╮ 19 | ╰───┤my first ├─╮ 20 | │drawing │ ╰───╮ 21 | ╰─────────╯ │ 22 | ╭────┬───────╯ 23 | ╰────╯ 24 | #+end_example 25 | 26 | * New 27 | :PROPERTIES: 28 | :CUSTOM_ID: new 29 | :END: 30 | 31 | Changing user-interface from Hydra to Transient and the other way 32 | around is now possible without restarting the Uniline session. 33 | 34 | Take a look at the new "Customize" entry in the Uniline menu. This 35 | menu is available: 36 | - from the menu-bar at the top of the Emacs screen (if not made 37 | invisible), 38 | - by left-clicking on ="Uniline"= in the mode-line, at the bottom of the 39 | Emacs screen. 40 | 41 | Note that those changes are for the current session only. To 42 | permanently choose Hydra or Transient, change your =~/.emacs=. 43 | 44 | See [[#hydra-or-transient][Hydra or Transient?]] 45 | 46 | * Table of Contents 47 | :PROPERTIES: 48 | :TOC: :include all :depth 3 :force () :ignore (this) :local (nothing) 49 | :CUSTOM_ID: table-of-contents 50 | :END: 51 | 52 | :CONTENTS: 53 | - [[#getting-started-in-10-seconds][Getting started in 10 seconds]] 54 | - [[#new][New]] 55 | - [[#pure-unicode-text-diagrams-in-emacs][Pure UNICODE text diagrams in Emacs]] 56 | - [[#document-a-command][Document a command]] 57 | - [[#connect-boxes-with-arrows][Connect boxes with arrows]] 58 | - [[#explain-decisions-trees][Explain decisions trees]] 59 | - [[#draw-lines-or-blocks][Draw lines or blocks]] 60 | - [[#outline-the-general-relativity-and-the-schrödingers-equations][Outline the General Relativity and the Schrödinger's equations]] 61 | - [[#explain-the-structure-of-a-sentence-in-a-foreign-language][Explain the structure of a sentence in a foreign language]] 62 | - [[#explain-lisp-lists][Explain Lisp lists]] 63 | - [[#draw-sketched-objects][Draw sketched objects]] 64 | - [[#pure-text][Pure text]] 65 | - [[#beware][Beware!]] 66 | - [[#a-minor-mode-for-drawing][A minor mode for drawing]] 67 | - [[#minor-mode][Minor mode]] 68 | - [[#draw-lines-by-moving-the-cursor][Draw lines by moving the cursor]] 69 | - [[#brush-style][Brush style]] 70 | - [[#text-direction][Text direction]] 71 | - [[#the-insert-key][The key]] 72 | - [[#glyphs-------insertion--modification][Glyphs ▷ ▶ → □ ◆ ╮─ insertion & modification]] 73 | - [[#arrows-glyphs------][Arrows glyphs ▷ ▶ → ▹ ▸ ↔]] 74 | - [[#intersection-glyphs---][Intersection glyphs ■ ◆ ●]] 75 | - [[#fine-tweaking-of-lines][Fine tweaking of lines]] 76 | - [[#rectangular-actions][Rectangular actions]] 77 | - [[#drawing-a-rectangle][Drawing a rectangle]] 78 | - [[#filling-a-rectangle][Filling a rectangle]] 79 | - [[#moving-a-rectangle][Moving a rectangle]] 80 | - [[#copying-killing-yanking-a-rectangle][Copying, killing, yanking a rectangle]] 81 | - [[#dashed-lines-and-other-styles][Dashed lines and other styles]] 82 | - [[#ascii-to-unicode][ASCII to UNICODE]] 83 | - [[#long-range-actions-contour-and-flood-fill][Long range actions: contour and flood-fill]] 84 | - [[#tracing-a-contour][Tracing a contour]] 85 | - [[#flood-fill][Flood-fill]] 86 | - [[#macros][Macros]] 87 | - [[#which-fonts][Which fonts?]] 88 | - [[#recommended-fonts][Recommended fonts]] 89 | - [[#use-case-mixing-fonts][Use case: mixing fonts]] 90 | - [[#hydra-or-transient][Hydra or Transient?]] 91 | - [[#selecting-hydra-or-transient][Selecting Hydra or Transient]] 92 | - [[#instantly-selecting-hydra-or-transient][Instantly selecting Hydra or Transient]] 93 | - [[#one-liner-menus][One-liner menus]] 94 | - [[#the-hydra-interface][The Hydra interface]] 95 | - [[#the-transient-interface][The Transient interface]] 96 | - [[#customization][Customization]] 97 | - [[#interface-type-obsolete][Interface type (obsolete)]] 98 | - [[#insert-key][Insert key]] 99 | - [[#maximum-steps-when-drawing-a-contour][Maximum steps when drawing a contour]] 100 | - [[#cursor-type][Cursor type]] 101 | - [[#hint-style][Hint style]] 102 | - [[#welcome-message-visibility][Welcome message visibility]] 103 | - [[#line-spacing][Line spacing]] 104 | - [[#font][Font]] 105 | - [[#how-uniline-behaves-with-its-environment][How Uniline behaves with its environment?]] 106 | - [[#language-environment][Language environment]] 107 | - [[#compatibility-with-picture-mode][Compatibility with Picture-mode]] 108 | - [[#compatibility-with-artist-mode][Compatibility with Artist-mode]] 109 | - [[#compatibility-with-whitespace-mode][Compatibility with Whitespace-mode]] 110 | - [[#compatibility-with-org-mode][Compatibility with Org Mode]] 111 | - [[#org-mode-and-latex][Org Mode and LaTex]] 112 | - [[#what-about-t-tabs][What about \t tabs?]] 113 | - [[#what-about-l-page-separation][What about ^L page separation?]] 114 | - [[#emacs-on-the-linux-console][Emacs on the Linux console]] 115 | - [[#emacs-on-a-graphical-terminal-emulator][Emacs on a graphical terminal emulator]] 116 | - [[#emacs-on-windows][Emacs on Windows]] 117 | - [[#compatibility-with-asciiflow][Compatibility with ASCIIFlow]] 118 | - [[#lisp-api][Lisp API]] 119 | - [[#move-the-cursor][Move the cursor]] 120 | - [[#brush][Brush]] 121 | - [[#example-lisp-function-to-draw-a-plus-sign][Example: Lisp function to draw a plus sign]] 122 | - [[#long-range-actions-contour-flood-fill-rectangle][Long range actions (contour, flood-fill, rectangle)]] 123 | - [[#constants][Constants]] 124 | - [[#macro-and-text-direction][Macro and text direction]] 125 | - [[#insert-and-tweak-glyphs][Insert and tweak glyphs]] 126 | - [[#change-to-alternate-styles][Change to alternate styles]] 127 | - [[#mouse-support][Mouse support]] 128 | - [[#installation][Installation]] 129 | - [[#use-package-the-straightforward-way][use-package, the straightforward way]] 130 | - [[#without-use-package][Without use-package]] 131 | - [[#related-packages][Related packages]] 132 | - [[#author-contributors][Author, contributors]] 133 | - [[#license][License]] 134 | :END: 135 | 136 | * Pure UNICODE text diagrams in Emacs 137 | :PROPERTIES: 138 | :CUSTOM_ID: pure-unicode-text-diagrams-in-emacs 139 | :END: 140 | Draw diagrams like those: 141 | 142 | ** Document a command 143 | :PROPERTIES: 144 | :CUSTOM_ID: document-a-command 145 | :END: 146 | 147 | [[file:images/document-command.png]] 148 | 149 | #+begin_example 150 | pdfjam source.pdf 3-5,9 151 | ╶─────▲────▲────────▲──▲╴ 152 | command╶╯ │ │ │ 153 | input file╶──╯ │ │ 154 | select pages 3,4,5╶───╯ │ 155 | and page 9╶──────────────╯ 156 | #+end_example 157 | 158 | ** Connect boxes with arrows 159 | :PROPERTIES: 160 | :CUSTOM_ID: connect-boxes-with-arrows 161 | :END: 162 | 163 | [[file:images/boxes-arrows.png]] 164 | 165 | #+begin_example 166 | ╭───────────────────────╮ 167 | ╷123╭────▶┤ hundred and something │ 168 | ╰───╯ ╰───────────────────────╯ 169 | ╭────▶──╮A╷ 170 | ╭───╮ ┏━━━┓ ╔═══╗ │ ╰─╯ 171 | 0╶─→┤ 1 ┝━━━▶┫ 2 ┣═══▷╣ 3 ╟──●────▶──╮B╷ 172 | ╰───╯ ┗━┯━┛ ╚═╤═╝ │ ╰─╯ 173 | ╰────←───╯ ╰────▶──╮C╷ 174 | ╰─╯ 175 | ╔══════════╗ 176 | ║ 1 ║ ▐▀▀▀▀▀▀▀▀▜ 177 | ║ ╭─────╫───╮ ◁──▷ ▐ 3 ▐ 178 | ╚════╪═════╝ 2 │ ▐▄▄▄▄▄▄▄▄▟ 179 | ╰─────────╯ 180 | #+end_example 181 | 182 | ** Explain decisions trees 183 | :PROPERTIES: 184 | :CUSTOM_ID: explain-decisions-trees 185 | :END: 186 | 187 | [[file:images/decision-tree.png]] 188 | 189 | #+begin_example 190 | ┏━━━━━━━━━━━━┓ 191 | ┃which color?┃ 192 | ┗━┯━━━━━━━━━━┛ 193 | │ ╭──────╮ 194 | │ ╭──┤yellow├─▷╮good─choice╭□ 195 | ▽ │ ╰──────╯ ╰═══════════╯ 196 | ╰──● ╭───╮ ┏━━━━━┓ 197 | ├──┤red├───▷┨dark?┠──╮ 198 | │ ╰───╯ ┗━━━━━┛ │ 199 | │ ╭───◁──────────────╯ 200 | │ │ ╭───╮ 201 | │ ╰─●─┤yes├▷╮regular─red╭─□ 202 | │ │ ╰───╯ ╰═══════════╯ 203 | │ │ ╭──╮ 204 | │ ╰─┤no├─▷╮pink╭────────□ 205 | │ ╰──╯ ╰════╯ 206 | │ ╭────╮ 207 | ├──┤blue├───▷╮next week╭──□ 208 | │ ╰────╯ ╰═════════╯ 209 | │ ╭─────╮ 210 | ╰──┤white├──▷╮available╭──□ 211 | ╰─────╯ ╰═════════╯ 212 | #+end_example 213 | 214 | ** Draw lines or blocks 215 | :PROPERTIES: 216 | :CUSTOM_ID: draw-lines-or-blocks 217 | :END: 218 | 219 | [[file:images/lines-blocks.png]] 220 | 221 | #+begin_example 222 | ╭─╮←─╮ 223 | ╭╮ │ │ ╰──╴max 235 224 | ╭╮││ ╭╯ │ 225 | │╰╯│╭─╯ │ 226 | ╭╮ │ ││ │ 227 | ╭─╮││╭╮ ╭──╮╭╮ │ ╰╯ ╰╮ 228 | ╭╯ ╰╯╰╯│ ╭╯ ╰╯╰─╮ │ │ ╭╮ 229 | ◁─╯ ╰──╯ ╰──╯ ╰─╯╰────▷ 230 | ◀════════════════════════════════════════▶ 231 | ╭────────╮ 232 | ▲ │all time│ 233 | ┃ ▄ ▗▟█ ←─┤highest │ 234 | Qdx █▌ ████ ╰────────╯ 235 | ┃ ▗▄█▌ █████▙ 236 | ┃ ▟███████▄█████████▄▄▄ ▗▄ 237 | ┃▐▄▄████████████████████████████▄▄▖ 238 | ╺━━━━━━━━━━╸time╺━━━━━━━━━━━━━━━━▶ 239 | 240 | #+end_example 241 | 242 | ** Outline the General Relativity and the Schrödinger's equations 243 | :PROPERTIES: 244 | :CUSTOM_ID: outline-the-general-relativity-and-the-schrödingers-equations 245 | :END: 246 | 247 | [[file:images/general-relativity-equation.png]] 248 | 249 | #+begin_example 250 | 251 | ╭─────────────────────╴G: Einstein tensor 252 | │ ╭────╴κ: Gravitational coupling constant 253 | ╭──▽───╮ ╭───▽──╮ 254 | ┏━┷━━━━━━┷━━━━━━━━┷━━━━━━┷━━━┓ 255 | ┃ R - gR/2 + Λg = (8πG/c⁴)×T ┃◁╴General Relativity equation 256 | ┗━△━━━△△━━━━━△△━━━━━━△━△━━━△━┛ 257 | │ ││ ││ │ │ ╭╯ 258 | │ ││ ││ │ │ ╰╴Energy-impulsion tensor 259 | │ ││ ││ │ ╰───╴Speed of light 260 | │ ││ ││ ╰─────╴Gravitational constant 261 | │ ││ ╰┴────────────╴Cosmological constant 262 | │ │╰──────┴────────────╴Scalar curvature 263 | │ ╰───────╰────────────╴Metric tensor 264 | ╰────────────────────────╴Ricci tensor 265 | 266 | #+end_example 267 | 268 | [[file:images/schrodinger-equation.png]] 269 | 270 | #+begin_example 271 | 272 | ╭─────────────────────╴Derivative over time 273 | │ ╭──────────╭────╴State of quantum system at time t 274 | │ │ │ (the square of its absolute value 275 | ╭▽─╮ ╭─▽──╮ ╭─▽──╮ is the probability density) 276 | ┏━━━━━┷━━┷━┷━━━━┷━━━━━┷━━━━┷━┓ 277 | ┃ i ħ d/dt |Ψ(t)> = Ĥ |Ψ(t)> ┃◁─╴Schrödinger's equation 278 | ┗━△━△━━━━△━━━━△━━━━━△━━━━△━━━┛ 279 | │ │ ╰────╰─────┤────╰───╴Time 280 | │ │ ╰────────╴Hamiltonian 281 | │ ╰────────────────────────╴Reduced Plank constant 282 | ╰──────────────────────────╴Imaginary number i²=-1 283 | 284 | #+end_example 285 | 286 | ** Explain the structure of a sentence in a foreign language 287 | :PROPERTIES: 288 | :CUSTOM_ID: explain-the-structure-of-a-sentence-in-a-foreign-language 289 | :END: 290 | (which language?) 291 | 292 | [[file:images/foreign-language-sentence.png]] 293 | 294 | #+begin_example 295 | 296 | ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 297 | ┃ the pretty table is standing ┃ 298 | ┗┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 299 | │ ╭────┬─────┬─────╴radicals 300 | ↕ ╭┴╮ ╭┴─╮ ╭┴─╮ 301 | ┏┷━━━┿━┿━━┿━━┿━━┿━━┿━━━┓ 302 | ┃ la bela tablo staras ┃ 303 | ┗━━━━┿━┿△━┿━━┿△━┿━━┿△━━┛ 304 | ╰─╯│ ╰──╯│ ╰──╯│ ┏━━━━━suffixes━━━━━┓ 305 | │ │ ╰──╂╴as: present tense┃ 306 | │ │ ┃ os: future tense ┃ 307 | │ │ ┃ is: past tense ┃ 308 | │ ╰────────╂╴ o: noun ┃ 309 | ╰──────────────╂╴ a: adjective ┃ 310 | ┃ e: adverb ┃ 311 | ┗━━━━━━━━━━━━━━━━━━┛ 312 | 313 | #+end_example 314 | 315 | ** Explain Lisp lists 316 | :PROPERTIES: 317 | :CUSTOM_ID: explain-lisp-lists 318 | :END: 319 | 320 | [[file:images/lisp-lists.png]] 321 | 322 | #+begin_example 323 | '(a b c) 324 | ┏━━━┳━━━┓ ┏━━━┳━━━┓ ┏━━━┳━━━┓ 325 | ●━━━▶┫ ● ┃ ●─╂──▷┨ ● ┃ ●─╂──▷┨ ● ┃nil┃ 326 | ┗━┿━┻━━━┛ ┗━┿━┻━━━┛ ┗━┿━┻━━━┛ 327 | │ ╰──────────╮╰╮ 328 | │ ╭─────┬───────────╮ │ │ 329 | ╰─▷┤"a\0"│properties │ │ │ 330 | ├─────┼───────────┤ │ │ 331 | │"b\0"│properties ├◁╯ │ 332 | ├─────┼───────────┤ │ 333 | │"c\0"│properties ├◁──╯ 334 | ├─────┼───────────┤ 335 | │... │... │ 336 | ╵ ╵ ╵ 337 | #+end_example 338 | 339 | ** Draw sketched objects 340 | :PROPERTIES: 341 | :CUSTOM_ID: draw-sketched-objects 342 | :END: 343 | 344 | [[file:images/sketched-objects.png]] 345 | 346 | #+begin_example 347 | 348 | ◀─(-)────────(+)──▶ ~╭──────╮~ 349 | ▗──────────────╮ ~~│ ╭~~╮ │~~ 350 | ▐ ╰╮ ~│ ╵ ╵ │~ 351 | ╭□▐ 1.5 volts ╭╯□╮ ╰─╖ ╓─╯ 352 | │ ▝▀▀▀▀▀▀▀▀▀▀▀▀▀▀▘ │ ╠━━╣ 353 | │ ╰──────╯ │ 354 | ╰─────────────────────────────╯ 355 | #+end_example 356 | 357 | [[file:images/water-sketch.png]] 358 | 359 | #+begin_example 360 | ╶╮ ╭╴ 361 | ┏┳┥▒▒▒▒▒▒▒┝╸ 362 | ┃┃│▒▒eau▒▒│ 363 | ┃┃│▒▒▒▒▒▒▒│ ╔═════╗ 364 | ┃┃╰──╮▒╭──╯ ║ ╶╮ ▽ ╭╴ 365 | ┃┃ ▒ ║ │ ░ │ 366 | ┃┃ ▒ ║ │░░░░░░░░░░░░░░│ 367 | ┃┃ ╚═════╝ │░░░░░░░░░░░░░░╞════▷▒▒ 368 | ┃┃ │░░░░░akvo░░░░░│ ╶╮ ▒ ╭╴ 369 | ┃┃ │░░░░░░░░░░░░░░│ │ ▒ │ 370 | ┃┃ ╰─┲┳━━━━━━━━┳┱─╯ │▒▒▒▒▒▒▒▒▒▒▒│ 371 | ┃┃ ┃┃ ┃┃ │▒▒▒water▒▒▒│ 372 | ┃┃ ┃┃ ┃┃ │▒▒▒▒▒▒▒▒▒▒▒│ 373 | ┃┃ ┃┃ ┃┃ ╰───────────╯ 374 | ▝▀▀▀▀▀▀▘ ▝▀▘ ▝▀▘ ▀▀▀▀▀▀▀▀▀▀▀▀▀ 375 | #+end_example 376 | 377 | ** Pure text 378 | :PROPERTIES: 379 | :CUSTOM_ID: pure-text 380 | :END: 381 | 382 | Those diagrams are pure text. There is nothing graphic. They are 383 | achieved using UNICODE characters. Therefore they can be drawn within 384 | any text formatted document, like Org Mode, Markdown, txt, comments in 385 | any programming language source code (C++, Python, Rust, D, 386 | JavaScript, GnuPlot, LaTex, whatever). 387 | 388 | Most often, the text file will be encoded as UTF-8. This is becoming 389 | the de-facto standard for text and source code files. 390 | 391 | Creating such diagrams by hand is painfully slow. Use =Uniline= to 392 | draw lines while you move the cursor with keyboard arrows. 393 | 394 | ** Beware! 395 | :PROPERTIES: 396 | :CUSTOM_ID: beware 397 | :END: 398 | 399 | If you see those diagrams miss-aligned, most likely the font used to 400 | display them does not support UNICODE block characters. See bellow the 401 | paragraph [[#which-fonts][Which fonts?]] for details. 402 | 403 | If you get misalignment when drawing, this could come from too wide 404 | characters. Emojis are an example. Usual characters may also be 405 | considered twice as wide as normal under some "language 406 | environments". See the paragraph [[#language-environment][Language environment]] for details. 407 | 408 | * A minor mode for drawing 409 | :PROPERTIES: 410 | :CUSTOM_ID: a-minor-mode-for-drawing 411 | :END: 412 | 413 | ** Minor mode 414 | :PROPERTIES: 415 | :CUSTOM_ID: minor-mode 416 | :END: 417 | =Uniline= is a minor mode. Activate it temporarily: 418 | 419 | =M-x uniline-mode= 420 | 421 | Exit it with: 422 | 423 | =C-c C-c= 424 | 425 | The current major mode is still active underneath =uniline-mode=. 426 | 427 | While in =uniline-mode=, overwriting is active, as well as long lines 428 | truncation. Also, a hollow cursor is provided (customizable). Those 429 | settings are reset to their previous state when exiting =uniline-mode=. 430 | 431 | ** Draw lines by moving the cursor 432 | :PROPERTIES: 433 | :CUSTOM_ID: draw-lines-by-moving-the-cursor 434 | :END: 435 | 436 | Use keyboard arrows to draw lines. 437 | 438 | By default, drawing lines only happens over empty space or over other 439 | lines. If there is already text, it will not be erased. However, by 440 | hitting the control-key while moving, lines overwrite whatever there 441 | is. 442 | 443 | The buffer is infinite ∞ in bottom and right directions. Which means 444 | that when the cursor ends up outside the buffer, white space 445 | characters are automatically added. 446 | 447 | The usual numeric prefix is available. For instance, to draw a line 12 448 | characters wide downward, type: =M-12 = 449 | 450 | ** Brush style 451 | :PROPERTIES: 452 | :CUSTOM_ID: brush-style 453 | :END: 454 | Set the current brush with: 455 | 456 | - ~-~ single thin line 457 | =╭─┬─╮= 458 | 459 | - ~+~ single thick line 460 | =┏━┳━┓= 461 | 462 | - ~=~ double line 463 | =╔═╦═╗= 464 | 465 | - ~#~ quarter block 466 | =▙▄▟▀= 467 | 468 | - ~~ eraser 469 | 470 | - ~~ move without drawing anything 471 | 472 | The current brush and the current text direction (see [[#text-direction][Text direction]]) are 473 | reflected in the mode-line (at the bottom of the =Emacs= screen). It 474 | looks like this: 475 | 476 | [[file:images/mode-line.png]] 477 | 478 | #+begin_example 479 | 480 | current text current 481 | direction╶────╮ ╭───╴brush 482 | ▼ ▼ 483 | ══════════════════╧═══════╧══════════════ 484 | U:** buff (... →Uniline┼ ...) 485 | ═════════════════════════════════════════ 486 | 487 | #+end_example 488 | 489 | ** Text direction 490 | :PROPERTIES: 491 | :CUSTOM_ID: text-direction 492 | :END: 493 | Usually, inserting text in a buffer moves the cursor to the right. (And 494 | sometimes to the left for some locales). Any of the 4 directions can be 495 | selected under =Uniline=. Just type any of: 496 | 497 | - = C-= 498 | - = C-= 499 | - = C-= 500 | - = C-= 501 | 502 | The current direction is reflected in the mode-line, just before the 503 | word ="uniline"=. 504 | 505 | * The == key 506 | :PROPERTIES: 507 | :CUSTOM_ID: the-insert-key 508 | :END: 509 | The == key is a prefix for other keys: 510 | - for drawing arrows, squares, crosses, o-shapes glyphs, 511 | - for handling rectangles, 512 | - for inserting =# = - += which otherwise change the brush style, 513 | - for trying a choice of mono-spaced fonts. 514 | 515 | Why ==? Because: 516 | - =Uniline= tries to leave their original meaning to as many keys as 517 | possible, 518 | - the standard meaning of == is to toggle the =overwrite-mode=; 519 | but =Uniline= is already in =overwrite-mode=, and de-activating 520 | overwrite would break =Uniline=. 521 | 522 | So preempting == does not sacrifices anything. 523 | 524 | *Customization* 525 | 526 | Another key may be defined instead of ==. Type: 527 | 528 | #+begin_example 529 | M-x customize-variable uniline-key-insert 530 | #+end_example 531 | 532 | * Glyphs =▷ ▶ → □ ◆ ╮─= insertion & modification 533 | :PROPERTIES: 534 | :CUSTOM_ID: glyphs-------insertion--modification 535 | :END: 536 | 537 | Individual character glyphs may be inserted and changed. 538 | - Put the cursor where a glyphs should be edited or inserted. 539 | - Then press == (this key may be customized, see [[#insert-key][Insert key]]). 540 | 541 | Arrows, squares, circles, crosses may be handled. Also lines may be 542 | fine tweaked a single character at a time. 543 | 544 | ** Arrows glyphs =▷ ▶ → ▹ ▸ ↔= 545 | :PROPERTIES: 546 | :CUSTOM_ID: arrows-glyphs------ 547 | :END: 548 | When inserting an arrow, it points in the direction that the line 549 | drawing follows. 550 | 551 | =Uniline= supports 6 arrows types: =▷ ▶ → ▹ ▸ ↔= 552 | 553 | [[file:images/arrow-styles.png]] 554 | 555 | #+begin_example 556 | 557 | □ 558 | ╰─◁──▷─╮ □─╮ ╭─╮ ╭─╮ ╭─□ 559 | ╭─◀──▶─╯ △ ▲ ↑ ▵ ▴ ↕ 560 | ╰─←──→─╮ │ │ │ │ │ │ 561 | ╭─◃──▹─╯ ▽ ▼ ↓ ▿ ▾ ↕ 562 | ╰─◂──▸─╮ ╰─╯ ╰─╯ ╰─╯ 563 | ╭─↔──↔─╯ 564 | □ 565 | 566 | #+end_example 567 | 568 | Actually, there are tons of arrows of all styles in the UNICODE 569 | standard. Unfortunately, support by fonts is weak. So =Uniline= 570 | restrains itself to those six safe arrows. 571 | 572 | To insert an arrow, type: = a= or = a a= or = a a a=. (=a= 573 | cycles through the 6 styles, =A= cycles backward). 574 | 575 | = 4 a= is equivalent to = a a a a=, which is also equivalent to 576 | = A A A=. Those 3 shortcuts insert an arrow of this style: =▵▹▿◃=. The 577 | actual direction where the arrow points follows the last movement of 578 | the cursor. 579 | 580 | To change the direction of the arrow, use shift-arrow, for example: 581 | =S-= will change from =→= to =↑=. 582 | 583 | ** Intersection glyphs =■ ◆ ●= 584 | :PROPERTIES: 585 | :CUSTOM_ID: intersection-glyphs--- 586 | :END: 587 | There are a few UNICODE characters which are mono-space and symmetric 588 | in the 4 directions. They are great at line intersections: 589 | 590 | To insert a square =□ ■ ▫ ▪ ◆ ◊= type: 591 | = s s s...= (=s= cycles, =S= cycles backward). 592 | 593 | To insert a circular shape =· ∙ • ● ◦ Ø ø= type: 594 | = o o o...= (=o= cycles, =O= cycles backward). 595 | 596 | To insert a cross shape =╳ ╱ ╲ ÷ × ± ¤= type: 597 | = x x x...= (=x= cycles, =X= cycles backward). 598 | 599 | To insert a usual ASCII letter or symbol, just type it. 600 | 601 | As the keys =- + = #= are preempted by =uniline-mode=, to type them, 602 | prefix them with ==. Example: = -= inserts a =-= and 603 | = += inserts a =+=. 604 | 605 | [[file:images/insert-glyphs.png]] 606 | 607 | #+begin_example 608 | 609 | 610 | │ 611 | ▼ 612 | ╭┴╮ ╭───────╮ ╭──────────────────╮ 613 | │s├─▶─┤squares├──┤ □ ■ ▫ ▪ ◆ ◊ │ 614 | ╰┬╯ ╰───────╯ ╰──────────────────╯ 615 | ╭┴╮ ╭───────╮ ╭─────────────────────╮ 616 | │o├─▶─┼circles┼──┤ · ∙ • ● ◦ Ø ø │ 617 | ╰┬╯ ╰───────╯ ╰─────────────────────╯ 618 | ╭┴╮ ╭───────╮ ╭───────────────────╮ 619 | │x├─▶─┼crosses┼──┤ ╳ ╱ ╲ ÷ × ± ¤ │ 620 | ╰┬╯ ╰───────╯ ╰───────────────────╯ 621 | ╭┴╮ ╭───╮ 622 | │+├─▶────────────┤ + │ 623 | ╰┬╯ ╰───╯ 624 | ╭┴╮ ╭───╮ 625 | │-├─▶────────────┤ - │ 626 | ╰┬╯ ╰───╯ 627 | ╭┴╮ ╭───╮ 628 | │=├─▶────────────┤ = │ 629 | ╰┬╯ ╰───╯ 630 | ╭┴╮ ╭───╮ 631 | │#├─▶────────────┤ # │ 632 | ╰─╯ ╰───╯ 633 | 634 | #+end_example 635 | 636 | ** Fine tweaking of lines 637 | :PROPERTIES: 638 | :CUSTOM_ID: fine-tweaking-of-lines 639 | :END: 640 | 641 | [[file:images/fine-tweaking.png]] 642 | 643 | #+begin_example 644 | 645 | convert this ═══▶ into that 646 | ╭───────────╮ ╭───────────╮ 647 | │╶───┬────▷ │ │╶───╮────▷ │ 648 | │ │ │ │ │ │ 649 | │ │ │ │ 650 | │ ▀▀▀ │ │ ▀▟▀ │ 651 | ╰───────────╯ ╰───────────╯ 652 | 653 | #+end_example 654 | 655 | At the crossing of lines, it may be appealing to do small 656 | adjustments. In the above example, we removed a segment of line which 657 | occupies 1/4 of a character. This cannot be achieve with line tracing 658 | alone. We also modified a quarter-block line in a non-obvious way. 659 | 660 | - Put the point (the cursor) on the character where lines cross each other. 661 | - type =INS S- S-= 662 | 663 | == here refers to the right part of the character under the 664 | point. The 1/4 line segment will cycle through all displayable 665 | forms. On the second stroke, no segment will be displayed, which is 666 | what we want. 667 | 668 | Caveat! The UNICODE standard does not define all possible combinations 669 | including double line segments. (It does for all combinations of thin 670 | and tick lines). So sometimes, when working with double lines, the 671 | process may be frustrating. 672 | 673 | This works also for lines made of quarter-blocks. There are 4 674 | quarter-blocks in a character, either on or off. Each of the 4 shifted 675 | keyboard arrows flips a quarter-block on-and-off. 676 | 677 | In the above example, the effect was achieved with: 678 | =INS S- S- S-= 679 | 680 | * Rectangular actions 681 | :PROPERTIES: 682 | :CUSTOM_ID: rectangular-actions 683 | :END: 684 | 685 | - Drawing, 686 | - filling, 687 | - moving, 688 | - copying & yanking, 689 | - change line & glyph styles, 690 | 691 | those actions may be performed on a rectangular selection. 692 | 693 | Select a rectangular region with =C-SPC= or =C-x SPC= and move the cursor. 694 | 695 | You may also use =S-= (== being any of the 4 696 | directions) to extend the selection. The buffer grows as needed with 697 | white spaces to accommodate the selection. Selection extension mode is 698 | active when =shift-select-mode= is non-nil. 699 | 700 | Or you may use the mouse to highlight the desired region. 701 | 702 | All those region-highlighting are standard in =Emacs=, and unrelated to 703 | =Uniline=. 704 | 705 | Once you have a region highlighted, press == (this key can be 706 | customized, see [[#insert-key][Insert key]]). The selection becomes rectangular if it 707 | was not. You are offered a menu of possible actions. 708 | 709 | ** Drawing a rectangle 710 | :PROPERTIES: 711 | :CUSTOM_ID: drawing-a-rectangle 712 | :END: 713 | 714 | To draw a rectangle in one shot, select a region, press ==, then 715 | hit: 716 | - =r= to draw a rectangle inside the selection 717 | - =S-R= to draw a rectangle outside the selection 718 | - =C-r= to overwrite a rectangle inside the selection 719 | - =C-S-R= to overwrite a rectangle outside the selection 720 | 721 | If needed, change the brush with any of =- + = # = 722 | 723 | [[file:images/draw-rectangle.png]] 724 | 725 | #+begin_example 726 | ╭───────╮ r: inside╮╭───────╮ 727 | │ one │ ▗▄▄▄▄▄▄▖╭┤│▛▀▀▀▀▀▜│ 728 | │ ┏━━━━┿━━━━━━┓ ▐╭────╮▌│╰┼▌ ▐│ 729 | ╰──╂────╯ two ┃ ▐│ │▌│ │▙▄▄▄▄▄▟│ 730 | ┃ ╔═══════╋═╗ ▐│ ├▌╯ ╰─────┬─╯ 731 | ┗━━━╋━━━━━━━┛ ║ ▐╰────╯▌────────┴───╮ 732 | ║ three ║ ▝▀▀▀▀▀▀▘ R: outside╯ 733 | ╚═════════╝ 734 | 735 | ╭─────────╮ 736 | my text I │my text I│ 737 | want to ╶─R─▷ │want to │ 738 | box │box │ 739 | ╰─────────╯ 740 | #+end_example 741 | 742 | The usual =C-_= or =C-/= keys may be hit to undo, even with the region 743 | still active visually. 744 | 745 | ** Filling a rectangle 746 | :PROPERTIES: 747 | :CUSTOM_ID: filling-a-rectangle 748 | :END: 749 | 750 | While the rectangular mode is active, press =i= to fill the 751 | rectangle. You will be asked to choose a character. You have those 752 | options: 753 | 754 | - for a regular character like =t=, just type it. 755 | - =SPC= or =DEL= for a shade of grey =" ░▒▓█"= among the 5 available in 756 | UNICODE. =SPC= to make it darker and darker. =DEL= to make the rectangle 757 | lighter and lighter. 758 | - =C-y= to chose the first character in the top of the kill ring. 759 | 760 | The above selection is the same as for the flood-fill action (see 761 | [[#flood-fill][Flood-fill]]). 762 | 763 | ** Moving a rectangle 764 | :PROPERTIES: 765 | :CUSTOM_ID: moving-a-rectangle 766 | :END: 767 | Select a region, then press ==. 768 | 769 | Use arrow keys to move the rectangle around. A numeric prefix may be 770 | used to move the rectangle that many characters. 771 | - Under =Hydra=, be sure to specify the numeric prefix with just digits, 772 | without the =Alt= key. Typing =15 = moves the rectangle 15 773 | characters to the left. =M-15 = does not work. 774 | - Under =Transient=, use the =Alt= key, like anywhere else in =Emacs=. Type 775 | =M-15 = to move the selected rectangle 15 characters to the left. 776 | 777 | Press =q=, ==, or =C-g= to stop moving the rectangle. 778 | 779 | The =C-_= key may also be used to undo the previous movements, even 780 | though the selection is still active. 781 | 782 | [[file:images/move-rectangle.png]] 783 | 784 | #+begin_example 785 | ▲ 786 | │ 787 | 788 | ╭─────┴──────╮ 789 | │this is │ 790 | │my rectangle│ 791 | ◀───┤I want to ├──▶ 792 | │move │ 793 | ╰─────┬──────╯ 794 | 795 | │ 796 | ▼ 797 | #+end_example 798 | 799 | ** Copying, killing, yanking a rectangle 800 | :PROPERTIES: 801 | :CUSTOM_ID: copying-killing-yanking-a-rectangle 802 | :END: 803 | 804 | A rectangle can be copied or killed, then yanked somewhere else. 805 | 806 | Select a region, press ==, then: 807 | - =c= to copy 808 | - =k= to kill 809 | - =y= to yank (aka paste) 810 | 811 | This is similar to the =Emacs= standard rectangle handling: 812 | - =C-x r r= copy rectangle to register 813 | - =C-x r k= kill rectangle 814 | - =C-x r y= yank killed rectangle 815 | 816 | The first difference is that =Uniline= rectangles, when killed and 817 | yanked, do not move surrounding characters. 818 | 819 | The second difference is that the white characters of the yanked 820 | rectangle are considered transparent. As a result, only non-blank 821 | parts of the yanked rectangle are over-printed. 822 | 823 | =Uniline= and =Emacs= standard rectangle share the same storage for copied 824 | and killed rectangles, namely the =killed-rectangle= Lisp variable. So, 825 | a rectangle can be killed one way, and yanked another way. 826 | 827 | ** Dashed lines and other styles 828 | :PROPERTIES: 829 | :CUSTOM_ID: dashed-lines-and-other-styles 830 | :END: 831 | 832 | [[file:images/four-styles.png]] 833 | 834 | #+begin_example 835 | 836 | ╭────▷───╮ ┏━━━━▶━━━┓ ╔════▶═══╗ 837 | │ ╭─□──╮ │ ┃ ┏━■━━┓ ┃ ║ ╔═■══╗ ║ 838 | △ │ │ ▽ ▲ ┃ ┃ ▼ ▲ ║ ║ ▼ 839 | │ ╰───◦╯ │ ┃ ┗━━━•┛ ┃ ║ ╚═══•╝ ║ 840 | ╰───◁────╯ ┗━━━◀━━━━┛ ╚═══◀════╝ 841 | 842 | ╭╌╌╌╌▷╌╌╌╮ ┏╍╍╍╍▶╍╍╍┓ 843 | ┆ ╭╌□╌╌╮ ┆ ┇ ┏╍■╍╍┓ ┇ 844 | △ ┆ ┆ ▽ ▲ ┇ ┇ ▼ 845 | ┆ ╰╌╌╌◦╯ ┆ ┇ ┗╍╍╍•┛ ┇ 846 | ╰╌╌╌◁╌╌╌╌╯ ┗╍╍╍◀╍╍╍╍┛ 847 | 848 | ╭┈┈┈┈▷┈┈┈╮ ┏┉┉┉┉▶┉┉┉┓ 849 | ┊ ╭┈□┈┈╮ ┊ ┋ ┏┉■┉┉┓ ┋ 850 | △ ┊ ┊ ▽ ▲ ┋ ┋ ▼ 851 | ┊ ╰┈┈┈◦╯ ┊ ┋ ┗┉┉┉•┛ ┋ 852 | ╰┈┈┈◁┈┈┈┈╯ ┗┉┉┉◀┉┉┉┉┛ 853 | 854 | #+end_example 855 | 856 | A base drawing can be converted to dashed lines. Moreover, lines can 857 | be made either thin or thick. 858 | 859 | - Select the rectangular area you want to operate on (with mouse drag 860 | or =S-=, =S-= and so on as described earlier). 861 | - Type =INS=, then =s= (as "style"). 862 | 863 | You will be offered a choice of styles: 864 | - =3=: vertical lines will become 3 dashes per character, while 865 | horizontal ones will get 2 dashes per character. 866 | - =4=: vertical and horizontal lines will get 4 dashes per character. 867 | - =h=: thin lines corners, which are usually rounded, become hard angles. 868 | - =+=: thin lines and intersections become thick, empty glyphs get 869 | filled. 870 | - =-=: thick lines and intersections become thin, filled glyphs are 871 | emptied. 872 | - ~=~: thick and thin lines become double lines. 873 | - =0=: come back to standard base-line =Uniline= style: plain, not-dashed 874 | lines, thin corner rounded, ASCII art is converted to UNICODE. 875 | - =a=: apply the =aa2u-rectangle= function from the unrelated 876 | =ascii-art-to-unicode= package, to convert ASCII art to UNICODE (this 877 | only works if =ascii-art-to-unicode= is already installed). 878 | 879 | Converting parts of a drawing from one style to another can produce 880 | nice looking sketches. 881 | 882 | [[file:images/same-sketch-several-styles.png]] 883 | 884 | #+begin_example 885 | 886 | ╭───╮ ╭───╮ ╭───╮ 887 | │░░░│ │░░░│ │░░░┝━▶┓ ╭╌╌╌╌╌╮ 888 | │░░░╰───╯░░░╰───╯░░░│ ┃ ┆░░░░░╰╌╌╌╌╌╮ 889 | □░░░░░░░░░░░░░░░░░░░│ ┗━┥░░░░░░░░░░░┆ 890 | │░░░╭───╮░░░╭───╮░░░│ ┆░░░░░╭╌╌╌╌╌╯ 891 | ╰───╯ ╰─┰─╯ ╰─┰─╯ ╰╌╌┰╌╌╯ 892 | ▲ ┃ ▼ 893 | ┗━━━━━━━┻━━━━━━━━━┛ 894 | 895 | ┏━━━┓ ┏━━━┓ ┏━━━┓ 896 | ┃░░░┃ ┃░░░┃ ┃░░░┠─▷╮ ┏╍╍╍╍╍┓ 897 | ┃░░░┗━━━┛░░░┗━━━┛░░░┃ │ ┇░░░░░┗╍╍╍╍╍┓ 898 | ■░░░░░░░░░░░░░░░░░░░┃ ╰─┨░░░░░░░░░░░┇ 899 | ┃░░░┏━━━┓░░░┏━━━┓░░░┃ ┇░░░░░┏╍╍╍╍╍┛ 900 | ┗━━━┛ ┗━┯━┛ ┗━┯━┛ ┗╍╍┯╍╍┛ 901 | △ │ ▽ 902 | ╰───────┴─────────╯ 903 | 904 | #+end_example 905 | 906 | ** ASCII to UNICODE 907 | :PROPERTIES: 908 | :CUSTOM_ID: ascii-to-unicode 909 | :END: 910 | 911 | The standard base-line =Uniline= (=INS s 0=) or =aa2u-rectangle= (=INS s a=) 912 | conversions may be used to convert ASCII art to UNICODE. The original 913 | ASCII art may be drawn for instance by the =artist-mode= or the 914 | =picture-mode= packages. 915 | 916 | To use =aa2u-rectangle=, install the =ascii-art-to-unicode= package by 917 | Thien-Thi Nguyen (RIP), available on ELPA. =Uniline= does not requires a 918 | dependency on this package, by lazy evaluating any call to 919 | =aa2u-rectangle=. 920 | See https://elpa.gnu.org/packages/ascii-art-to-unicode.html 921 | 922 | [[file:images/ascii-2-unicode.png]] 923 | 924 | #+begin_example 925 | 926 | +-------------+ +--+ 927 | | +-->-| +-----+ ASCII art 928 | | 1 +--------+--+ | 3 | made by 929 | +----+--------+ | +----+---+ Artist-mode 930 | | 2 +-<----+ 931 | +-----------+ 932 | 933 | ╭─────────────╮ ╭──╮ 934 | │ ├──▷─│ ╰─────╮ Converted to 935 | │ 1 ╭────────┼──╮ │ 3 │ Uniline base style 936 | ╰────┼────────╯ │ ╰────┬───╯ INS s 0 937 | │ 2 ├─◁────╯ 938 | ╰───────────╯ 939 | 940 | ┌─────────────┐ ┌──┐ 941 | │ ├──>─│ └─────┐ Converted by 942 | │ 1 ┌────────┼──┐ │ 3 │ aa2u-rectangle 943 | └────┼────────┘ │ └────┬───┘ INS s a 944 | │ 2 ├─<────┘ 945 | └───────────┘ 946 | #+end_example 947 | 948 | =INS s 0= with selection active calls the =uniline-change-style-standard= 949 | function. It converts what looks ASCII-art to UNICODE-art. Of course, 950 | there are ambiguities regarding whether a character is part of a 951 | sketch or not. 952 | 953 | The heuristic is to consider that a character is part of a sketch if 954 | it is surrounded by at least one other character which is part of a 955 | sketch. So, an isolated =-= minus character will be left alone, while 956 | two such characters =--= will be converted to UNICODE. Conversion will 957 | happens also for =<-= for instance. 958 | 959 | Here is a fairly convoluted ASCII-art example, along with its 960 | conversion by =INS s 0=: 961 | 962 | [[file:images/ascii-2-unicode-b.png]] 963 | 964 | #+begin_example 965 | 966 | ╭─↔--<-◁-◀--━+ +--->------==+ 967 | /----/ Rectangle1 |-----+-----+ Rectangle2 v v 968 | | | ^ " | "quote" +-\ ▼ 969 | ^^ \------------/ /-+-\ +------------+ " v 970 | | \--+------+--/ | | +----\----/--+ " >▷▶> 971 | \>--\ | | \---/ | | " 972 | v \==<===/ a=b 1=2 a-to-b +----+ ◁==/ >-> 973 | 974 | ╭─↔──◁─◁─◀──━┑ ╭───▷──────══╕ 975 | ╭────┤ Rectangle1 │─────╥─────┤ Rectangle2 ▽ ▽ 976 | │ │ △ ║ │ "quote" ├─╖ ▼ 977 | △^ ├────────────┤ ╭─╨─╮ ├────────────┤ ║ ▽ 978 | │ ╰──┬──────┬──╯ │ │ ╰────┬────┬──╯ ║ ▷▷▶▷ 979 | ╰▷──╮ │ │ ╰───╯ │ │ ║ 980 | ▽ ╘══◁═══╛ a=b 1=2 a-to-b ╰────╯ ◁══╝ ▷─▷ 981 | 982 | #+end_example 983 | 984 | * Long range actions: contour and flood-fill 985 | :PROPERTIES: 986 | :CUSTOM_ID: long-range-actions-contour-and-flood-fill 987 | :END: 988 | ** Tracing a contour 989 | :PROPERTIES: 990 | :CUSTOM_ID: tracing-a-contour 991 | :END: 992 | 993 | [[file:images/contour-tracing.png]] 994 | 995 | #+begin_example 996 | ╭──────────────╮ 997 | ╭─╯A.written.text╰────────╮ 998 | │outlined by the.`contour'│ 999 | ╰─╮function.gets╶┬────────╯ 1000 | ╰╮a.surrounding╰───────╮ 1001 | ╰─╮line.in.the.current│ 1002 | ╰─╮brush.style╭─────╯ 1003 | ╰───────────╯ 1004 | #+end_example 1005 | 1006 | Choose or change the brush style with any of =-,+,=_,#,=. Put 1007 | the cursor anywhere on the shape or outside but touching it. Then 1008 | type: 1009 | 1010 | = c= 1011 | 1012 | A contour line is traced (or erased if brush style is ==) 1013 | around the contiguous shape close to the cursor. 1014 | 1015 | When hitting capital letter: = S-C= the contour is 1016 | overwritten. This means that if there was already a different style of 1017 | line on the contour path, it is overwritten. 1018 | 1019 | The shape is distinguished because it floats in a blank characters 1020 | ocean. For the shake of the contour function, blank characters are 1021 | those containing lines as drawn by =Uniline= (including true blank 1022 | characters). Locations outside the buffer are also considered blank. 1023 | 1024 | The algorithm has an upper limit of =10000= steps. This avoids an 1025 | infinite loop in which the algorithm may end up in some rare 1026 | cases. One of those cases is when the contour crosses a new-page 1027 | character, displayed by =Emacs= as =^L=. =10000= steps require a fraction of 1028 | a second to run. For shapes really huge, you may launch the contour 1029 | command once again, at the point where the previous run ended. 1030 | 1031 | This =10000= steps limit is customizable. Type: 1032 | 1033 | #+begin_example 1034 | M-x customize-variable uniline-contour-max-steps 1035 | #+end_example 1036 | 1037 | ** Flood-fill 1038 | :PROPERTIES: 1039 | :CUSTOM_ID: flood-fill 1040 | :END: 1041 | 1042 | [[file:images/flood-fill.png]] 1043 | 1044 | #+begin_example 1045 | 1046 | this.text.surrounds this.text.surrounds 1047 | . / .▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒/ 1048 | . //╶───▷╴.▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒// 1049 | ... //// ...▒▒▒▒▒▒▒▒▒▒▒▒//// 1050 | ...a.hole///// ...a.hole///// 1051 | 1052 | #+end_example 1053 | 1054 | A hollow shape is a contiguous region of identical characters (not 1055 | necessarily blank), surrounded by a boundary of different 1056 | characters. The end of the buffer in any direction is also considered 1057 | a boundary. 1058 | 1059 | Put the cursor anywhere in the hole. Then type: 1060 | 1061 | = i= 1062 | 1063 | Answer by giving a character to fill the hole. 1064 | 1065 | If instead of a character, =SPC= or =DEL= is typed, then a shade of grey 1066 | character is picked. =SPC= selects a darker grey than the one the point 1067 | is on, while =DEL= selects a lighter. There are 5 shades of grey in the 1068 | UNICODE standard: =" ░▒▓█"=. Those grey characters are well supported 1069 | by the suggested fonts. 1070 | 1071 | =C-y= is also an option. The first character in the top of the kill 1072 | ring will be chosen as the filling character. (The kill ring is filled 1073 | by functions like =C-k= or =M-w=, unrelated to =Uniline=). 1074 | 1075 | Typing == or =C-g= aborts the filling operation. 1076 | 1077 | A rectangular shape may also be filled. 1078 | - Mark a region 1079 | - = i= 1080 | - answer which character should be used to fill. 1081 | 1082 | There is no limit on the area to fill. Therefore, the filling 1083 | operation may flood the entire buffer (but no more). 1084 | 1085 | * Macros 1086 | :PROPERTIES: 1087 | :CUSTOM_ID: macros 1088 | :END: 1089 | =Uniline= adds directional macros to the =Emacs= standard macros. 1090 | 1091 | Record a macro as usual with =C-x (= … =C-x )=. 1092 | 1093 | Then call it with the usual =C-x e=. But then, instead of executing 1094 | the macro, a menu is offered to execute it in any of the 4 directions. 1095 | 1096 | When a macro is executed in a direction other than the one it was 1097 | recorded, it is twisted in that direction. This means that recorded 1098 | hits on the 4 keyboard arrows are rotated. It happens also for shift 1099 | and control variations of those keys. Direction of text insertion is 1100 | also rotated. 1101 | 1102 | There is still the classical =e= option to call the last recorded 1103 | macro. So instead of the usual =C-x e=, type =C-x e e=. And of course, 1104 | the usual repetition typing repeatedly =e= is available. 1105 | 1106 | Why are directional macros useful? To create fancy lines. For 1107 | instance, if we want a doted-line instead of the continuous one, we 1108 | record a macro for one step: 1109 | 1110 | #+begin_example 1111 | C-x ( ;; begin recording 1112 | INS o ;; insert a small dot 1113 | ;; draw a line over 2 characters 1114 | C-x ) ;; stop recording 1115 | #+end_example 1116 | 1117 | Then we call this macro repeatedly in any of the 4 directions: 1118 | 1119 | [[file:images/macro-doted-line.png]] 1120 | 1121 | #+begin_example 1122 | 1123 | ·─·─·─·─· ╷ ·──· 1124 | │ │ │ │ 1125 | · · · · 1126 | │ │ │ │ 1127 | · ·─·─·─· · 1128 | │ │ 1129 | ·─·─·─·─·─·─· 1130 | 1131 | #+end_example 1132 | 1133 | We can draw complex shapes by just drawing one step. Hereafter, we 1134 | call a macro in 4 directions, closing a square: 1135 | 1136 | [[file:images/macro-fancy-squares.png]] 1137 | 1138 | #+begin_example 1139 | 1140 | ╭╮╭╮╭╮╭╮╭╮╭╮ △ △ △ △ △ △ ╭─╮ ╭─╮ ╭─╮ ╭─╮ ╭─╮ ╭─╮ ╭─╮ ╭─╮ 1141 | ╭─╯╰╯╰╯╰╯╰╯╰╯│ ╶╯╶╯╶╯╶╯╶╯╶╯╷ ╭──╯∙╰─╯∙╰─╯∙╰─╯∙│ ▷┤□├▷┤□├▷┤□├▷┤□├▽ 1142 | ╰╮ ╰╮ ◁╮ ╰▷ │∙ │ ╭┴┼─╯ ╰─╯ ╰─╯ ╰─┼┴╮ 1143 | ╭╯ ╭╯ ╵ ╷ ╰╮ ╰╮ │□│ │□│ 1144 | ╰╮ ╰╮ ◁╮ ╰▷ │ ∙│ ╰┬╯ ╰┬╯ 1145 | ╭╯ ╭╯ ╵ ╷ ╭╯ ╭╯ △ ▽ 1146 | ╰╮ ╰╮ ◁╮ ╰▷ │∙ │ ╭┴╮ ╭┴╮ 1147 | ╭╯ ╭╯ ╵ ╷ ╰╮ ╰╮ │□│ │□│ 1148 | ╰╮ ╰╮ ◁╮ ╰▷ │ ∙│ ╰┬┼─╮ ╭─╮ ╭─╮ ╭─┼┬╯ 1149 | │╭╮╭╮╭╮╭╮╭╮╭─╯ ╵╭╴╭╴╭╴╭╴╭╴╭╴ │∙╭─╮∙╭─╮∙╭─╮∙╭──╯ △┤□├◁┤□├◁┤□├◁┤□├◁ 1150 | ╰╯╰╯╰╯╰╯╰╯╰╯ ▽ ▽ ▽ ▽ ▽ ▽ ╰─╯ ╰─╯ ╰─╯ ╰─╯ ╰─╯ ╰─╯ ╰─╯ ╰─╯ 1151 | 1152 | #+end_example 1153 | 1154 | * Which fonts? 1155 | :PROPERTIES: 1156 | :CUSTOM_ID: which-fonts 1157 | :END: 1158 | A mono-space character font must be used. It must also support UNICODE. 1159 | 1160 | ** Recommended fonts 1161 | :PROPERTIES: 1162 | :CUSTOM_ID: recommended-fonts 1163 | :END: 1164 | 1165 | Not all fonts are born equal. 1166 | 1167 | - =(set-frame-font "DejaVu Sans Mono" )= 1168 | - =(set-frame-font "Unifont" )= 1169 | - =(set-frame-font "Hack" )= 1170 | - =(set-frame-font "JetBrains Mono" )= 1171 | - =(set-frame-font "Cascadia Mono" )= 1172 | - =(set-frame-font "Agave" )= 1173 | - =(set-frame-font "JuliaMono" )= 1174 | - =(set-frame-font "FreeMono" )= 1175 | - =(set-frame-font "Iosevka Comfy Fixed" )= 1176 | - =(set-frame-font "Iosevka Comfy Wide Fixed")= 1177 | - =(set-frame-font "Aporetic Sans Mono" )= 1178 | - =(set-frame-font "Aporetic Serif Mono" )= 1179 | - =(set-frame-font "Source Code Pro" )= 1180 | 1181 | Those fonts are known to support the required UNICODE characters, AND 1182 | display them as mono-space. There are fonts advertised as mono-space 1183 | which give arbitrary widths to non-ASCII characters. That is bad for 1184 | the kind of drawings done by =Uniline=. 1185 | 1186 | You may want to try any of the suggested fonts. Just hit the 1187 | corresponding entry in the =Uniline= menu, or type = f=. You may 1188 | also execute the above Lisp commands like that: 1189 | 1190 | =M-: (set-frame-font "DejaVu Sans Mono")= 1191 | 1192 | This setting is for the current session only. If you want to make it 1193 | permanent, you may use the =Emacs= customization: 1194 | 1195 | = f *= 1196 | 1197 | or 1198 | 1199 | =M-x customize-face default= 1200 | 1201 | Beware that =Emacs= tries to compensate for missing UNICODE support by 1202 | the current font. =Emacs= substitutes one font for another, character 1203 | per character. The user may not notice until the drawings done under 1204 | =Emacs= are displayed on another text editor or on the Web. Of course, 1205 | using the suggested fonts and the UNICODEs drawn by =Uniline= keeps you 1206 | away from those glitches. 1207 | 1208 | To know which font =Emacs= has chosen for a given character, type: 1209 | 1210 | =C-u C-x == 1211 | 1212 | Note that none of those commands downloads a font from the Web. 1213 | The font should already be available. 1214 | 1215 | ** Use case: mixing fonts 1216 | :PROPERTIES: 1217 | :CUSTOM_ID: use-case-mixing-fonts 1218 | :END: 1219 | 1220 | A user on GitHub, dmullis, exposed his use-case. A source-code base is 1221 | usually edited with a font not in the Uniline list of recommended 1222 | fonts. However, it is desirable to document the source code with 1223 | Uniline, either directly along the source or in separate files. How to 1224 | achieve that without messing with the fonts in several Emacs buffers? 1225 | 1226 | Several solutions have emerged from the discussion. 1227 | 1228 | - =face-remap-add-relative= 1229 | 1230 | A line like this at the top of the files reserved for Uniline drawings: 1231 | 1232 | #+begin_example 1233 | -*- eval: (face-remap-add-relative 'default :family "DejaVu Sans Mono"); -*- 1234 | #+end_example 1235 | 1236 | This confines its effect to just the one single buffer. 1237 | 1238 | - =uniline-mode-hook= 1239 | 1240 | Add a hook (a function called when entering =uniline-mode=): 1241 | 1242 | #+begin_example 1243 | (add-hook 1244 | 'uniline-mode-hook 1245 | (lambda () (face-remap-add-relative 'default :family "DejaVu Sans Mono"))) 1246 | #+end_example 1247 | 1248 | There are also =uniline-mode-on-hook= & =uniline-mode-off-hook= which can be handy. 1249 | 1250 | - =font-lock-comment-face= 1251 | 1252 | An alternative mean of limiting the scope of the font change is the 1253 | Emacs standard font-lock mechanism. 1254 | 1255 | #+begin_example 1256 | (customize-face '(font-lock-comment-face)) 1257 | #+end_example 1258 | 1259 | Then check =Font Family=, type in value ="DejaVu Sans Mono",= and =C-x C-s=. 1260 | 1261 | Now any major mode that understands "comments" as distinct from other 1262 | text can safely nest a Uniline drawing within its boundaries, all text 1263 | outside the "comment" unaffected (except perhaps by spacing). 1264 | 1265 | Look also at the =font-lock-constant-face= face. 1266 | 1267 | - Org Mode 1268 | 1269 | In Org Mode, the usable faces could be =org-block=, =org-quote=, 1270 | =org-verse=. But first the =org-fontify-quote-and-verse-blocks= variable 1271 | must be set to =t=. 1272 | 1273 | - Markdown 1274 | 1275 | In Markdown mode, customize the =markdown-pre-face= or 1276 | =markdown-code-face= faces. 1277 | 1278 | * Hydra or Transient? 1279 | :PROPERTIES: 1280 | :CUSTOM_ID: hydra-or-transient 1281 | :END: 1282 | The basic usage of =Uniline= should be easy: just move the point, and lines 1283 | are traced. Change brush to draw thicker lines. 1284 | 1285 | More complex actions are summoned by the == key, with or without 1286 | selection. This is a single key to remember. Then a textual menu is 1287 | displayed, giving the possible keys continuations and their 1288 | meaning. All that is achieved by the =Hydra= or =Transient= libraries, 1289 | which are now part of =Emacs= (thanks!). 1290 | 1291 | The =Hydra= and =Transient= libraries offer similar features. Some users 1292 | may prefer one or the other. 1293 | 1294 | =Uniline= was developed from day one with =Hydra=. =Transient= is a late 1295 | addition. 1296 | 1297 | ** Selecting Hydra or Transient 1298 | :PROPERTIES: 1299 | :CUSTOM_ID: selecting-hydra-or-transient 1300 | :END: 1301 | 1302 | Two files are compiled when installing =Uniline= 1303 | - =uniline-hydra.el= 1304 | - =uniline-transient.el= 1305 | 1306 | One of them should be loaded (but not both). There are several 1307 | ways. The cleanest is =use-package=. Add those lines to your =~/.emacs= 1308 | file: 1309 | 1310 | #+begin_src elisp 1311 | (use-package uniline-hydra 1312 | :bind ("C-" . uniline-mode)) 1313 | #+end_src 1314 | 1315 | or: 1316 | 1317 | #+begin_src elisp 1318 | (use-package uniline-transient 1319 | :bind ("C-" . uniline-mode)) 1320 | #+end_src 1321 | 1322 | Note: there used to be a customizable setting to switch between the 1323 | two interfaces. This had many issues. One of them is that the 1324 | native-compiler is blind to all user-customized settings. 1325 | 1326 | There is a third file, =uniline-code.elc=. Loading =uniline-hydra.elc= or 1327 | =uniline-transient.elc= automatically loads =uniline-core.elc=. 1328 | 1329 | ** Instantly selecting Hydra or Transient 1330 | :PROPERTIES: 1331 | :CUSTOM_ID: instantly-selecting-hydra-or-transient 1332 | :END: 1333 | It is now possible to switch user interfaces on the fly. 1334 | 1335 | To do so, look at the "Customize" entry in the Uniline menu. This 1336 | menu is available: 1337 | - from the menu-bar at the top of the Emacs screen (if not made 1338 | invisible), 1339 | - by left-clicking on ="Uniline"= in the mode-line, at the bottom of the 1340 | Emacs screen. 1341 | 1342 | Note that the changes are for the current session only. To permanently 1343 | choose Hydra or Transient, change your =~/.emacs=initialization file 1344 | as describe in [[#selecting-hydra-or-transient][Selecting Hydra or Transient]]. 1345 | 1346 | The actions performed by the menu are: 1347 | - =(load-library "uniline-hydra")= 1348 | - =(load-library "uniline-transient")= 1349 | 1350 | You can execute them directly or by other means. 1351 | 1352 | ** One-liner menus 1353 | :PROPERTIES: 1354 | :CUSTOM_ID: one-liner-menus 1355 | :END: 1356 | The multi-lines menus in Hydra and Transient are quite useful for 1357 | casual users. For seasoned users, those huge textual menus may 1358 | distract them from their workflow. 1359 | 1360 | It is now possible to switch to less distracting textual menus. They 1361 | are displayed in the echo-area on a single line. 1362 | 1363 | To do so, type: 1364 | - =C-t= within a sub-mode (glyph insertion mode, rectangle handling, 1365 | etc.) 1366 | - =C-h TAB= at the top-level. 1367 | 1368 | This will flip between the two sizes of textual menus. It also affects 1369 | the welcome message, the one displayed when entering the =Uniline= minor 1370 | mode. 1371 | 1372 | The current size is controlled by the =uniline-hint-style= variable: 1373 | - =t= for full fledged messages over several lines 1374 | - =1= for one-liner messages 1375 | - =0= for no message at all 1376 | 1377 | The variable is "buffer-local", which means that it can take distinct 1378 | values on distinct buffers. 1379 | 1380 | Its default value can be customized and saved for future sessions: 1381 | 1382 | =M-x customize-variable uniline-hint-style= 1383 | 1384 | After customization it can be changed later, on a buffer per buffer 1385 | basis, with the =C-t= or =C-h TAB= keys. 1386 | 1387 | Transient natively offers a similar setting: 1388 | =transient-show-popup=. (There is no such variable in Hydra). It can be 1389 | customized with =t=, =nil=, =0= (zero), or a number. This is similar but not 1390 | exactly the same as the Hydra behavior and the =uniline-hint-style=. 1391 | the Transient setting stays in effect until the =C-t= or =C-h TAB= keys 1392 | are not used, . As soon as one of those keys is invoked, 1393 | =transient-show-popup= is toggled (which does not happens in Transient 1394 | alone). The change is kept in effect throughout the =Uniline= session, 1395 | but no longer. 1396 | 1397 | ** The Hydra interface 1398 | :PROPERTIES: 1399 | :CUSTOM_ID: the-hydra-interface 1400 | :END: 1401 | 1402 | Put that in your =~/.emacs= file: 1403 | 1404 | #+begin_src elisp 1405 | (use-package uniline-hydra 1406 | :bind ("C-" . uniline-mode)) 1407 | #+end_src 1408 | 1409 | It has been asked by =Transient=-only users to avoid installing the 1410 | =Hydra= package. Currently, it is not possible to make dependencies 1411 | conditional in =Melpa=. And removing the =Hydra= dependency would hurt 1412 | =Hydra= users. Therefore, for the time being, the =Hydra= package is still 1413 | installed when installing =Uniline= through =Melpa=. 1414 | 1415 | ** The Transient interface 1416 | :PROPERTIES: 1417 | :CUSTOM_ID: the-transient-interface 1418 | :END: 1419 | 1420 | Put that in your =~/.emacs= file: 1421 | 1422 | #+begin_src elisp 1423 | (use-package uniline-transient 1424 | :bind ("C-" . uniline-mode)) 1425 | #+end_src 1426 | 1427 | =Transient= interface was added recently to =Uniline=. This leaded to the 1428 | splitting of the single =uniline.el= file into 4 source 1429 | files. Hopefully, the added complexity remains hidden by the =Elpa= - 1430 | =Melpa= packaging system. 1431 | 1432 | * Customization 1433 | :PROPERTIES: 1434 | :CUSTOM_ID: customization 1435 | :END: 1436 | Type: =M-x customize-group uniline=. 1437 | 1438 | Or =Menu bar ⟶ Options ⟶ Customize Emacs ⟶ Specific Group… ⟶ "uniline"=. 1439 | 1440 | This invokes the standard =Emacs= customization system. Your settings 1441 | will be saved in the file pointed to by the =custom-file= variable if 1442 | set, or your =~/.emacs= file. (Along with all your other settings 1443 | unrelated to =Uniline=). 1444 | 1445 | Two settings are special: interface type (obsolete) & the insert 1446 | key. The other settings are self-explanatory 1447 | 1448 | ** Interface type (obsolete) 1449 | :PROPERTIES: 1450 | :CUSTOM_ID: interface-type-obsolete 1451 | :END: 1452 | 1453 | This switch is *obsolete*. Choosing between =Hydra= or =Transient= interface 1454 | is done by loading one or the other sub-package. See [[#installation][Installation]] for 1455 | details. 1456 | 1457 | ** Insert key 1458 | :PROPERTIES: 1459 | :CUSTOM_ID: insert-key 1460 | :END: 1461 | 1462 | By default, the == or =INS= key is the prefix for most of the 1463 | =Uniline= actions. Some computers do not have an =INS= key, or it is bound 1464 | to some other command (Apple?). 1465 | 1466 | This can be changed temporarily or permanently. The customization 1467 | allows to set several keys at the same time. 1468 | 1469 | Depending on whether =Emacs= is run in a graphical environment or a 1470 | text-only terminal, either the == or the == events are 1471 | generated by the =INS= key. Therefore, by default =Uniline= defines both 1472 | events as the =INS= key. 1473 | 1474 | Variable =uniline-key-insert=. 1475 | 1476 | ** Maximum steps when drawing a contour 1477 | :PROPERTIES: 1478 | :CUSTOM_ID: maximum-steps-when-drawing-a-contour 1479 | :END: 1480 | Defaults to =10000=. 1481 | To avoid an infinite loop in some rare cases. 1482 | 1483 | Variable =uniline-contour-max-steps=. 1484 | 1485 | ** Cursor type 1486 | :PROPERTIES: 1487 | :CUSTOM_ID: cursor-type 1488 | :END: 1489 | Hollow by default, so that what is under the cursor remains visible. 1490 | 1491 | There is the option to leave the cursor as it is. 1492 | 1493 | Variable =uniline-cursor-type.= 1494 | 1495 | ** Hint style 1496 | :PROPERTIES: 1497 | :CUSTOM_ID: hint-style 1498 | :END: 1499 | Currently only applicable to the =Hydra=. 1500 | It defaults to "full fledged menus". 1501 | 1502 | Variable =uniline-hint-style=. 1503 | 1504 | =Transient= offers a similar setting: =transient-show-popup=. 1505 | 1506 | ** Welcome message visibility 1507 | :PROPERTIES: 1508 | :CUSTOM_ID: welcome-message-visibility 1509 | :END: 1510 | Default is "on". Turn it "off" for less distraction. 1511 | 1512 | Even when turned of, the welcome message can still be displayed by 1513 | pressing =C-h TAB=. 1514 | 1515 | Variable =uniline-show-welcome-message=. 1516 | 1517 | ** Line spacing 1518 | :PROPERTIES: 1519 | :CUSTOM_ID: line-spacing 1520 | :END: 1521 | 1522 | The =line-spacing= setting in =Emacs= can change the display of a 1523 | sketch. (This setting is unrelated to =Uniline=). 1524 | 1525 | The best looking effect is given by: 1526 | : (setq line-spacing nil) 1527 | 1528 | You may want to change your current setting. =Uniline= may handle this 1529 | variable some day. Right now, =line-spacing= is left as a matter of 1530 | choice for everyone. 1531 | 1532 | [[file:images/line-spacing.png]] 1533 | 1534 | #+begin_example 1535 | 1536 | ╭────┬────────┬────╮ ╺┯━━━━┯┯━━┯┯━┯┯━━━━━━━━┯┯━━━━━━━┯┯━━━━━━┯╸ 1537 | │▒▒▒▒╰────────╯▒▒▒▒│ │ │╰is╯╰a╯│ ││ │╰around╯ 1538 | │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│ ╰this╯ ╰sentence╯╰hanging╯ 1539 | │▒▒▒╭─╮▒▒▒▒▒▒╭─╮▒▒▒│ △ 1540 | │▒▒▒╰─╯▒▒▒▒▒▒╰─╯▒▒▒│ │ △ 1541 | │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│ ╰─────────┬────────╯ 1542 | ╰──────────────────╯ verbs 1543 | (setq line-spacing nil) 1544 | 1545 | #+end_example 1546 | 1547 | ** Font 1548 | :PROPERTIES: 1549 | :CUSTOM_ID: font 1550 | :END: 1551 | 1552 | Face customization is unrelated to =Uniline=. However, =Uniline= can 1553 | assist in choosing a good font and customizing the =default= face. See 1554 | [[#which-fonts][Which fonts?]]. 1555 | 1556 | Type = f= to select a font just for the current =Uniline= 1557 | session. Type =*= to enter the =Emacs= customization of the =default= face 1558 | and retain your choice for future sessions. 1559 | 1560 | * How Uniline behaves with its environment? 1561 | :PROPERTIES: 1562 | :CUSTOM_ID: how-uniline-behaves-with-its-environment 1563 | :END: 1564 | ** Language environment 1565 | :PROPERTIES: 1566 | :CUSTOM_ID: language-environment 1567 | :END: 1568 | The so called "language environment" in Emacs can cause unwanted line 1569 | breaks, like in this drawing: 1570 | 1571 | [[file:images/broken-lines-lang-env.png]] 1572 | 1573 | #+begin_example 1574 | 1575 | ╶───────────┬─────╮ 1576 | │ │ 1577 | │ │ 1578 | │ │ 1579 | ╰───────────╯ 1580 | unexpected broken lines 1581 | 1582 | ╶─────┬───────────╮ 1583 | │ │ 1584 | │ │ 1585 | │ │ 1586 | ╰───────────╯ 1587 | expected continuous lines 1588 | 1589 | #+end_example 1590 | 1591 | The above example was drawn first with the =Chinese-BIG5= language 1592 | environment, then with the =English= environment. 1593 | 1594 | There is nothing specific about =Chinese-BIG5=. It is just an instance 1595 | picked out from more than 100 language environments. 1596 | 1597 | #+begin_example 1598 | C-x RET l Chinese-BIG5 1599 | C-x RET l English 1600 | #+end_example 1601 | 1602 | In =Chinese-BIG5=, some characters are considered twice as wide as 1603 | standard characters. Whereas in =English=, all characters needed by 1604 | Uniline are 1 unit wide. 1605 | 1606 | Thanks to *rumengling* (GitHub) for discovering and diagnosing the 1607 | issue! 1608 | 1609 | To workaround the issue, when entering =uniline-mode=, the width of all 1610 | characters Uniline uses is checked. If some of them are more than 1, 1611 | the =char-width-table= variable is patched. 1612 | 1613 | What are the consequences of this patch? The =char-width-table= variable 1614 | is an Emacs global. Therefore the patch by Uniline will affect all 1615 | buffers. As the characters touched by the patch are graphic, and have 1616 | nothing to do with Chinese, it should not have any significance on 1617 | text written in Chinese. 1618 | 1619 | It was pondered whether Uniline should put back =char-width-table= at 1620 | its original value upon exiting =uniline-mode=, or leaving the 1621 | patch. For now, it has been decided to leave it. Because anyway, 1622 | intertwining several =uniline-mode= and changes to the language 1623 | environment is intractable. 1624 | 1625 | In case of something, re-setting the language environment to its same 1626 | value cancels the patch to =char-width-table= by Uniline. 1627 | 1628 | ** Compatibility with Picture-mode 1629 | :PROPERTIES: 1630 | :CUSTOM_ID: compatibility-with-picture-mode 1631 | :END: 1632 | 1633 | =Picture-mode= and =uniline-mode= are compatible. Their features overlap 1634 | somehow: 1635 | - Both implement an unlimited buffer in east and south directions. 1636 | - Both visually truncate long lines (actual text is not truncated). 1637 | - Both set the overwrite mode (=uniline-mode= activates 1638 | =overwrite-mode=, while =picture-mode= re-implements it) 1639 | - Both are able to draw rectangles (=uniline-mode= in UNICODE, 1640 | =picture-mode= in ASCII), copy and yank them. 1641 | 1642 | They also have features unique to each: 1643 | - =Picture-mode= writes in 8 possible directions 1644 | - =Picture-mode= handles TAB stops 1645 | - =Uniline-mode= draws lines and arrows 1646 | 1647 | ** Compatibility with Artist-mode 1648 | :PROPERTIES: 1649 | :CUSTOM_ID: compatibility-with-artist-mode 1650 | :END: 1651 | 1652 | =Artist-mode= and =uniline-mode= are mostly incompatible. This is because 1653 | =artist-mode= preempts the arrow keys, which give access to a large part 1654 | of =uniline-mode= features. 1655 | 1656 | However, it is possible to use both one after the other. 1657 | 1658 | ** Compatibility with Whitespace-mode 1659 | :PROPERTIES: 1660 | :CUSTOM_ID: compatibility-with-whitespace-mode 1661 | :END: 1662 | 1663 | =Whitespace-mode= and =uniline-mode= are mostly compatible. 1664 | 1665 | Why activate =whitespace-mode= while in =uniline-mode=? Because 1666 | =Uniline= creates a lot of white-spaces to implement an infinite 1667 | buffer. And it is funny to look at this activity. 1668 | 1669 | To make =uniline-mode= and =whitespace-mode= fully compatible, disable 1670 | the newline visualization: 1671 | 1672 | - =M-x customize-variable whitespace-style= 1673 | - uncheck =(Mark) NEWLINEs= 1674 | 1675 | This is due to a glitch in =move-to-column= when a visual property is 1676 | attached to newlines. And =uniline-mode= makes heavy use of =move-to-column=. 1677 | 1678 | ** Compatibility with Org Mode 1679 | :PROPERTIES: 1680 | :CUSTOM_ID: compatibility-with-org-mode 1681 | :END: 1682 | You may want to customize the shift extension mode in =Org Mode=. This 1683 | is because =Org Mode= preempts =shift-select-mode= for other useful 1684 | purposes. Just type: 1685 | 1686 | #+begin_example 1687 | M-x customize-variable org-support-shift-select 1688 | #+end_example 1689 | 1690 | and choose "when outside special context", which sets it to =t=. 1691 | 1692 | You then get the shift-selection from =Org Mode=, not from =Uniline=. The 1693 | difference is that the =Uniline='s one handles the infinite-ness of the 1694 | buffer. 1695 | 1696 | Other than that, =Uniline= is compatible with =Org Mode= 1697 | 1698 | Thanks to jdtsmith (GitHub) for sharing a funny fact he discovered. If 1699 | a source block is created with the =Uniline= language (=Uniline= is 1700 | *not* a language like =C++,= =Python=, or =Bash=), then it can be 1701 | edited (=M-x org-edit-special=) with =uniline-mode= automatically 1702 | activated. 1703 | 1704 | [[file:images/org-src-block.png]] 1705 | 1706 | #+begin_example 1707 | #+begin_src uniline 1708 | ╭───╮ ╭───╮ 1709 | │ ╷ ╰───╯ ╷ │ 1710 | │ ╰─ ╶─╯ │ 1711 | ╰╮ ● ● ╭╯ 1712 | │ ╷ │ 1713 | ╰╮ ────╯ ╭╯ 1714 | ╰───────╯ 1715 | #+end_src 1716 | #+end_example 1717 | 1718 | ** Org Mode and LaTex 1719 | :PROPERTIES: 1720 | :CUSTOM_ID: org-mode-and-latex 1721 | :END: 1722 | Use the =pmboxdraw= LaTex module. This gives limited support for "box 1723 | drawing" characters in LaTex documents. 1724 | 1725 | Example: 1726 | 1727 | [[file:images/latex-block.png]] 1728 | 1729 | #+begin_example 1730 | #+LATEX_HEADER: \usepackage{pmboxdraw} 1731 | 1732 | #+begin_src text 1733 | 1734 | this works: 1735 | ┌─────┐ ┌────────────┐ 1736 | │ ├───────┤ │ 1737 | └─────┘ │ │ 1738 | ┌─────┐ ┌────┤ │ 1739 | │ ├──┘ │ │ 1740 | └─────┘ ┌────┤ │ 1741 | ┌─────┐ │ │ │ 1742 | │ ├──┘ └────────────┘ 1743 | └─────┘ 1744 | 1745 | this does not quite work: 1746 | ┏━━━┓ ┏━━┓ ┏━━━━━┓ 1747 | ┃ ┃ ┃ ┣━━━━━┫ ┃ 1748 | ┃ ┗━━┛ ┃ ┏┛ ┃ 1749 | ┗━━━━━━━━━┛ ┗━━━━━━┛ 1750 | 1751 | but that is OK: 1752 | ┏━━━┓ 1753 | ┃ ┃ 1754 | ┗━━━┛ 1755 | 1756 | that is OK too: 1757 | ╺════╦══╗ ╔════╗ 1758 | ║ A║ ║ B ╚══╗ 1759 | ╚══╝ ╚═══════╝ 1760 | 1761 | this works: 1762 | 1763 | ├── dev 1764 | └┬┬ release 1765 | │├── new 1766 | │└── old 1767 | ├── graph 1768 | └── non-graph 1769 | 1770 | #+end_src 1771 | #+end_example 1772 | 1773 | Note that corners of thin lines should be sharp. There is no support 1774 | for rounded corners. 1775 | 1776 | To export this Org Mode example to PDF through LaTex, type: 1777 | 1778 | =C-c C-E l o= 1779 | 1780 | ** What about =\t= tabs? 1781 | :PROPERTIES: 1782 | :CUSTOM_ID: what-about-t-tabs 1783 | :END: 1784 | Some files may contain tabs (the character =\t=). Those include 1785 | programming code (Python, Perl, C++, D, Rust, JavaScript and so on). 1786 | 1787 | When =Uniline= draws something in the middle of a TAB, or right onto a 1788 | TAB, it first converts it to spaces, then proceeds as usual. This 1789 | process is invisible. So be cautious if TABs have a special meaning in 1790 | the file. 1791 | 1792 | Also, rectangles are first untabified (if there are TABs) before 1793 | moving them. This avoids some rare instances of misalignment. 1794 | 1795 | One way to see what is going on, is to activate the =whitespace-mode=. 1796 | 1797 | ** What about =^L= page separation? 1798 | :PROPERTIES: 1799 | :CUSTOM_ID: what-about-l-page-separation 1800 | :END: 1801 | =Uniline= does not work well with =^L= (page separation) 1802 | character. Nor with similar characters, like =^T=. When trying to 1803 | draw a line over such a character, the cursor may get stuck. This is 1804 | because those characters occupy twice the width of a normal character. 1805 | 1806 | Just try to get away from =^L=, =^T= and such when drawing with 1807 | =Uniline=. 1808 | 1809 | ** Emacs on the Linux console 1810 | :PROPERTIES: 1811 | :CUSTOM_ID: emacs-on-the-linux-console 1812 | :END: 1813 | Linux consoles are the 7 non-graphic screens which can be accessed 1814 | usually typing =C-M-F1=, =C-M-F2=, and so on. Such a screen is also 1815 | presented when connecting through =ssh= or =tls= into a non-graphical server. 1816 | 1817 | By default they use a font named "Fixed" with poor support for 1818 | Unicode. However, it supports lines of the 3 types, mixing all of them 1819 | in thin lines though. 1820 | 1821 | Another problem is that by default =S-= and =C-= are 1822 | indistinguishable from ==. Same problem with ==, ==, == 1823 | and ==. This has nothing to do with =Emacs=. A solution can be 1824 | found here: https://www.emacswiki.org/emacs/MissingKeys 1825 | 1826 | ** Emacs on a graphical terminal emulator 1827 | :PROPERTIES: 1828 | :CUSTOM_ID: emacs-on-a-graphical-terminal-emulator 1829 | :END: 1830 | This is the =Emacs= launched from a terminal typing =emacs -nw=. In this 1831 | environment, == does not exist. It is replaced by 1832 | ==. This has already been taken into account by =Uniline= 1833 | by duplicating the key-bindings for the two flavors of this key. 1834 | 1835 | If you decide to bind globally =C-= to the toggling of 1836 | =Uniline= minor mode as suggested, then you will have to do the same 1837 | for =C-=, for example with =use-package= in your 1838 | =~/.emacs= file: 1839 | 1840 | #+begin_src elisp 1841 | (use-package uniline 1842 | :defer t 1843 | :bind ("C-" . uniline-mode) 1844 | :bind ("C-" . uniline-mode)) 1845 | #+end_src 1846 | 1847 | ** Emacs on Windows 1848 | :PROPERTIES: 1849 | :CUSTOM_ID: emacs-on-windows 1850 | :END: 1851 | On Windows the only native mono-spaced fonts are =Lucida Console= and 1852 | =Courier New=. They are not mono-spaced for the Unicodes used by 1853 | =Uniline=. 1854 | 1855 | Often, the =Consolas= font is present on Windows. It supports quite well 1856 | the required Unicodes to draw lines. A few glyphs produce unaligned 1857 | result though. They should be avoided under =Consolas=: =△▶▹◆= 1858 | 1859 | Of course, other fonts may be installed. It is quite easy. 1860 | 1861 | ** Compatibility with ASCIIFlow 1862 | :PROPERTIES: 1863 | :CUSTOM_ID: compatibility-with-asciiflow 1864 | :END: 1865 | 1866 | ASCIIFlow is a ASCII-UNICODE diagram drawing tool (as Uniline). It 1867 | works on a web browser. Just open https://asciiflow.com and start 1868 | drawing. There is no server, ASCIIFlow operates locally on your 1869 | PC. Your diagrams survive web browser sessions, as they are saved 1870 | locally behind the scene. 1871 | 1872 | When your drawing is complete, you can export it to Emacs-Uniline: 1873 | - Click on the download button 1874 | - Select ="ASCII Extended"= 1875 | - Paste your diagram in Emacs with =C-y= 1876 | - Modify it with Uniline 1877 | 1878 | For the other way around, a Uniline drawing can be exported to 1879 | ASCIIFlow: 1880 | - Copy it from Emacs (with =M-w= for instance). 1881 | - In ASCIIFlow, choose ="Select & Move"= 1882 | - Type =C-v= 1883 | - Edit with ASCIIFlow 1884 | 1885 | * Lisp API 1886 | :PROPERTIES: 1887 | :CUSTOM_ID: lisp-api 1888 | :END: 1889 | Could =Uniline= be programmed (versus used interactively)? 1890 | Yes! 1891 | 1892 | The API is usable programmatically: 1893 | 1894 | ** Move the cursor 1895 | :PROPERTIES: 1896 | :CUSTOM_ID: move-the-cursor 1897 | :END: 1898 | 1899 | Move cursor while drawing lines by calling any of the 4 directions 1900 | functions: 1901 | - =uniline-write-up↑= 1902 | - =uniline-write-ri→= 1903 | - =uniline-write-dw↓= 1904 | - =uniline-write-lf←= 1905 | 1906 | They expect a repeat =count= (usually 1) and optionally =force=t= to 1907 | overwrite the buffer 1908 | 1909 | ** Brush 1910 | :PROPERTIES: 1911 | :CUSTOM_ID: brush 1912 | :END: 1913 | 1914 | Set the current brush by calling any of the following: 1915 | 1916 | - =uniline--set-brush-nil= ;; write nothing 1917 | - =uniline--set-brush-0= ;; eraser 1918 | - =uniline--set-brush-1= ;; single thin line╶─╴ 1919 | - =uniline--set-brush-2= ;; single thick line╺━╸ 1920 | - =uniline--set-brush-3= ;; double line╺═╸ 1921 | - =uniline--set-brush-block= ;; blocks ▙▄▟▀ 1922 | 1923 | Those functions are equivalent to: 1924 | 1925 | - =(setq uniline--brush nil)= 1926 | - =(setq uniline--brush 0)= 1927 | - =(setq uniline--brush 1)= 1928 | - =(setq uniline--brush 2)= 1929 | - =(setq uniline--brush 3)= 1930 | - =(setq uniline--brush :block)= 1931 | 1932 | except the functions also update the mode-line. 1933 | 1934 | ** Example: Lisp function to draw a plus sign 1935 | :PROPERTIES: 1936 | :CUSTOM_ID: example-lisp-function-to-draw-a-plus-sign 1937 | :END: 1938 | For instance, if we want to create a function to draw a "plus" sign, 1939 | we can code it as follows: 1940 | 1941 | #+begin_src elisp 1942 | (defun uniline-draw-plus () 1943 | (interactive) 1944 | (uniline-write-ri→ 1) 1945 | (uniline-write-dw↓ 1) 1946 | (uniline-write-ri→ 1) 1947 | (uniline-write-dw↓ 1) 1948 | (uniline-write-lf← 1) 1949 | (uniline-write-dw↓ 1) 1950 | (uniline-write-lf← 1) 1951 | (uniline-write-up↑ 1) 1952 | (uniline-write-lf← 1) 1953 | (uniline-write-up↑ 1) 1954 | (uniline-write-ri→ 1) 1955 | (uniline-write-up↑ 1)) 1956 | #+end_src 1957 | 1958 | Calling =M-x uniline-draw-plus= will result in this nice little 1959 | plus-shape: 1960 | 1961 | [[file:images/plus-shape.png]] 1962 | 1963 | #+begin_example 1964 | ╭╮ 1965 | ╭╯╰╮ 1966 | ╰╮╭╯ 1967 | ╰╯ 1968 | generated by 1969 | M-x uniline-draw-plus 1970 | #+end_example 1971 | 1972 | We may modify the function to accept the size of the shape as a 1973 | parameter: 1974 | 1975 | #+begin_src elisp 1976 | (defun uniline-draw-plus (size) 1977 | (interactive "Nsize? ") 1978 | (uniline-write-ri→ size) 1979 | (uniline-write-dw↓ size) 1980 | (uniline-write-ri→ size) 1981 | (uniline-write-dw↓ size) 1982 | (uniline-write-lf← size) 1983 | (uniline-write-dw↓ size) 1984 | (uniline-write-lf← size) 1985 | (uniline-write-up↑ size) 1986 | (uniline-write-lf← size) 1987 | (uniline-write-up↑ size) 1988 | (uniline-write-ri→ size) 1989 | (uniline-write-up↑ size)) 1990 | #+end_src 1991 | 1992 | The =(interactive "Nsize? ")= form prompts user for the size of the 1993 | shape if not given as a parameter. 1994 | 1995 | This API works in any mode, not only in =Uniline= minor mode. It takes 1996 | care of the infiniteness of the buffer in the right and down 1997 | directions. 1998 | 1999 | ** Long range actions (contour, flood-fill, rectangle) 2000 | :PROPERTIES: 2001 | :CUSTOM_ID: long-range-actions-contour-flood-fill-rectangle 2002 | :END: 2003 | 2004 | There are other useful functions operating on many characters at 2005 | once. Contour tracing and flood-filling are among them: 2006 | 2007 | - =uniline-contour= 2008 | - =uniline-fill= 2009 | 2010 | The following functions operate on a rectangular region, which must be 2011 | active prior to calling them: 2012 | 2013 | - =uniline-draw-inner-rectangle= 2014 | - =uniline-draw-outer-rectangle= 2015 | - =uniline-copy-rectangle= 2016 | - =uniline-kill-rectangle= 2017 | - =uniline-yank-rectangle= 2018 | - =uniline-fill-rectangle= 2019 | - =uniline-move-rect-up↑= 2020 | - =uniline-move-rect-ri→= 2021 | - =uniline-move-rect-dw↓= 2022 | - =uniline-move-rect-lf←= 2023 | 2024 | ** Constants 2025 | :PROPERTIES: 2026 | :CUSTOM_ID: constants 2027 | :END: 2028 | 2029 | Constants for the 4 directions: 2030 | 2031 | - =uniline-direction-up↑= ;; constant 0 2032 | - =uniline-direction-ri→= ;; constant 1 2033 | - =uniline-direction-dw↓= ;; constant 2 2034 | - =uniline-direction-lf←= ;; constant 3 2035 | 2036 | ** Macro and text direction 2037 | :PROPERTIES: 2038 | :CUSTOM_ID: macro-and-text-direction 2039 | :END: 2040 | 2041 | Changing text direction: 2042 | 2043 | - =uniline-text-direction-up↑= 2044 | - =uniline-text-direction-ri→= 2045 | - =uniline-text-direction-dw↓= 2046 | - =uniline-text-direction-lf←= 2047 | 2048 | or (in this case the mode-line is not updated): 2049 | 2050 | - =(setq uniline-text-direction uniline-direction-up↑)= 2051 | - =(setq uniline-text-direction uniline-direction-ri→)= 2052 | - =(setq uniline-text-direction uniline-direction-dw↓)= 2053 | - =(setq uniline-text-direction uniline-direction-lf←)= 2054 | 2055 | Call macro in any direction: 2056 | 2057 | - =uniline-call-macro-in-direction-up↑= 2058 | - =uniline-call-macro-in-direction-ri→= 2059 | - =uniline-call-macro-in-direction-dw↓= 2060 | - =uniline-call-macro-in-direction-lf←= 2061 | 2062 | ** Insert and tweak glyphs 2063 | :PROPERTIES: 2064 | :CUSTOM_ID: insert-and-tweak-glyphs 2065 | :END: 2066 | 2067 | - =uniline-insert-fw-arrow= 2068 | - =uniline-insert-fw-square= 2069 | - =uniline-insert-fw-oshape= 2070 | - =uniline-insert-fw-cross= 2071 | - =uniline-insert-bw-arrow= 2072 | - =uniline-insert-bw-square= 2073 | - =uniline-insert-bw-oshape= 2074 | - =uniline-insert-bw-cross= 2075 | 2076 | Rotate arrow or tweak 4-half-lines or 4-block characters: 2077 | 2078 | - =uniline-rotate-up↑= 2079 | - =uniline-rotate-ri→= 2080 | - =uniline-rotate-dw↓= 2081 | - =uniline-rotate-lf←= 2082 | 2083 | Here are the lowest level functions. Move point, possibly extending 2084 | the buffer in right and bottom directions: 2085 | 2086 | - =uniline-move-to-column= 2087 | - =uniline-move-to-line= 2088 | - =uniline-move-to-lin-col= 2089 | - =uniline-move-to-delta-column= 2090 | - =uniline-move-to-delta-line= 2091 | 2092 | ** Change to alternate styles 2093 | :PROPERTIES: 2094 | :CUSTOM_ID: change-to-alternate-styles 2095 | :END: 2096 | 2097 | A drawing in a rectangular selection may have its style changed: 2098 | 2099 | - =uniline-change-style-dot-3-2= ;; 3 dashes vert. ┆, 2 horiz. ╌ 2100 | - =uniline-change-style-dot-4-4= ;; 4 dashes vert. ┊ & horiz. ┈ 2101 | - =uniline-change-style-standard= ;; back to Uniline base style 2102 | - =uniline-change-style-hard-corners= ;; rounded corners╭╴become hard┌ 2103 | - =uniline-change-style-thin= ;; convert to ╭╴ thin lines 2104 | - =uniline-change-style-thick= ;; convert to ┏╸ thick lines 2105 | - =uniline-change-style-double= ;; convert to ╔═ thick lines 2106 | - =uniline-aa2u-rectangle= ;; call aa2u to convert ASCII to Unicode 2107 | 2108 | The above functions require a region to be marked. 2109 | 2110 | * Mouse support 2111 | :PROPERTIES: 2112 | :CUSTOM_ID: mouse-support 2113 | :END: 2114 | The out-of-the-box mouse support of =Emacs= works perfectly. Except when 2115 | the mouse clicks on a position outside the buffer. This happens when 2116 | clicking past the end of a too short line, or past the end of the buffer. 2117 | 2118 | To handle those cases, a few standard =Emacs= functions have been 2119 | extended to add blank characters or blank lines. Doing so, the 2120 | mouse-click now falls on a valid part of the buffer. Of course, those 2121 | extensions are only active on =uniline-mode= activated buffers. 2122 | 2123 | Beware that when the window is at the same time zoomed with =C-x C-+ 2124 | C--= AND horizontally scrolled with =C-x <=, the cursor positioning is 2125 | not accurate. This is due to =Emacs= limitations and bugs. Just click 2126 | twice to fix the inaccuracy. 2127 | 2128 | * Installation 2129 | :PROPERTIES: 2130 | :CUSTOM_ID: installation 2131 | :END: 2132 | 2133 | ** use-package, the straightforward way 2134 | :PROPERTIES: 2135 | :CUSTOM_ID: use-package-the-straightforward-way 2136 | :END: 2137 | 2138 | The =use-package= library became the de-facto standard to manage 2139 | packages in your =.emacs= initialization file. The =use-package= library 2140 | comes along with Emacs. It can (among other services) delay loading 2141 | external packages until they are used, and bind keyboard shortcuts to 2142 | the package's entry points. 2143 | 2144 | Add the following lines to your =.emacs= file, and reload it, if not 2145 | already done. This says that the popular Melpa repository is one of 2146 | the central store of third parties packages. To day, it provides almost 2147 | 7000 packages to choose from. 2148 | 2149 | #+begin_src elisp 2150 | (add-to-list 'package-archives 2151 | '("melpa" . "http://melpa.org/packages/") 2152 | t) 2153 | (package-initialize) 2154 | #+end_src 2155 | 2156 | Alternately you may customize this variable: 2157 | 2158 | #+begin_example 2159 | M-x customize-variable package-archives 2160 | #+end_example 2161 | 2162 | Then add those lines in your Emacs initialization file (usually =~/.emacs=): 2163 | 2164 | #+begin_src elisp 2165 | (use-package uniline-hydra 2166 | :bind ("C-" . uniline-mode)) 2167 | #+end_src 2168 | 2169 | or: 2170 | 2171 | #+begin_src elisp 2172 | (use-package uniline-transient 2173 | :bind ("C-" . uniline-mode)) 2174 | #+end_src 2175 | 2176 | This tell Emacs: 2177 | - Be prepared to load =uniline-mode= when the user request it, but do 2178 | not load it now. 2179 | - Bind the =C-= keys to the function =uniline-mode=. This shortens 2180 | the longer =M-x uniline-mode= command. Any other key combinations can 2181 | be bound, as you prefer. == happens to also be the key used 2182 | inside =Uniline= (customizable). 2183 | - Load either the =uniline-hydra= or the =uniline-transient= file, as you 2184 | prefer. This gives Uniline one or the other flavour of 2185 | user-interface. 2186 | 2187 | There is an alias to =uniline-hydra=: 2188 | 2189 | #+begin_src elisp 2190 | (use-package uniline 2191 | :bind ("C-" . uniline-mode)) 2192 | #+end_src 2193 | 2194 | ** Without use-package 2195 | :PROPERTIES: 2196 | :CUSTOM_ID: without-use-package 2197 | :END: 2198 | Download the package from Melpa: 2199 | 2200 | #+begin_src elisp 2201 | (package-install "uniline") 2202 | #+end_src 2203 | 2204 | Alternately, you can download the Lisp files, and load them manually: 2205 | 2206 | #+begin_src elisp 2207 | (load-file "uniline-hydra.el") ;; interpreted form 2208 | (load-file "uniline-hydra.elc") ;; byte-compiled form 2209 | (load-file "uniline-hydra.eln") ;; native-compiled form 2210 | ;; this automatically 2211 | ;; loads "uniline-core.el" 2212 | ;; or "uniline-core.elc" 2213 | ;; or "uniline-core.eln" 2214 | #+end_src 2215 | 2216 | or if you prefer the Transient interface over the Hydra one: 2217 | #+begin_src elisp 2218 | (load-file "uniline-transient.el") ;; interpreted form 2219 | (load-file "uniline-transient.elc") ;; byte-compiled form 2220 | (load-file "uniline-transient.eln") ;; native-compiled form 2221 | ;; this automatically 2222 | ;; loads "uniline-core.el" 2223 | ;; or "uniline-core.elc" 2224 | ;; or "uniline-core.eln" 2225 | #+end_src 2226 | 2227 | You should prefer the byte-compiled or native-compiled forms over the 2228 | interpreted forms, because there are a lot of optimizations performed 2229 | at compile time. 2230 | 2231 | You may want to give =uniline-mode= a key-binding. A way to do that 2232 | without =use-package= is to add those lines to your initialization file 2233 | (usually =~/.emacs=): 2234 | 2235 | #+begin_src elisp 2236 | (require 'uniline-hydra) 2237 | (bind-keys :package uniline-hydra ("C-" . uniline-mode)) 2238 | #+end_src 2239 | 2240 | The downside is that =Uniline= will be loaded as soon as =Emacs= is 2241 | launched, rather than deferred until invoked. 2242 | 2243 | * Related packages 2244 | :PROPERTIES: 2245 | :CUSTOM_ID: related-packages 2246 | :END: 2247 | 2248 | - =artist-mode=: the ASCII art mode built into =Emacs=. 2249 | 2250 | - =ascii-art-to-unicode=: as the name suggest, converts ASCII drawings 2251 | to UNICODE, giving results similar to those of =Uniline=. 2252 | 2253 | - =picture-mode=: as in =Uniline=, the buffer is infinite in east & south 2254 | directions. 2255 | 2256 | - =ascii-art-to-unicode= ASCII art to UNICODE in =Emacs=. This is a 2257 | standard ELPA package by Thien-Thi Nguyen (rest in peace). =Uniline= 2258 | may call it to convert ASCII art drawings to equivalent 2259 | UNICODE. =Uniline= arranges to not require a dependency on 2260 | =ascii-art-to-unicode= by lazy evaluating a call to =aa2u=. 2261 | 2262 | - =org-pretty-table=: Org Mode tables /appear/ to be drawn in UNICODE 2263 | characters (actually they are still in ASCII). 2264 | 2265 | - =boxes=: draws artistic boxes around text, with nice looking unicorns, 2266 | flowers, parchments, all in ASCII art. 2267 | 2268 | - =org-drawio=: a bridge between the Draw.Io editor and =Emacs=, producing 2269 | drawing similar to those of =Uniline=, but in =.svg=. 2270 | 2271 | - =syntree=: draws ASCII trees on-the-fly from description. 2272 | 2273 | - =unicode-enbox=: create a UNICODE box around a text; input and output 2274 | are strings. 2275 | 2276 | - =unicode-fonts=: in =Emacs=, helps alleviate the lack of full UNICODE 2277 | coverage of most fonts. 2278 | 2279 | - =org-superstar=: prettify headings and plain lists in Org Mode, using 2280 | UNICODE glyphs. 2281 | 2282 | - =charmap=: UNICODE table viewer for =Emacs=. 2283 | 2284 | - =insert-char-preview=: insert UNICODEs with character preview in 2285 | completion prompt. 2286 | 2287 | - =list-unicode-display=: list all UNICODE characters, or a selection of 2288 | them. 2289 | 2290 | - =show-font=: show font features in a buffer. 2291 | 2292 | - =ob-svgbob=: convert your ascii diagram scribbles into happy little 2293 | SVG 2294 | 2295 | - =el-easydraw=: a full featured SVG editor right inside your =Emacs= 2296 | 2297 | - =asciiflow=: (not =Emacs=) draw on the web, then copy-paste your UNICODE text 2298 | 2299 | - =dot-to-ascii.ggerganov.com:= (not =Emacs=) describe your schema in the 2300 | Graphviz language, and copy-past your UNICODE text. 2301 | 2302 | - =monosketch=: (not =Emacs=) draw on the web, then copy-paste your UNICODE text 2303 | 2304 | - =ibm-box-drawing-hydra.el=: keyboard interface to insert UNICODE 2305 | box-drawing characters one at a time 2306 | 2307 | - =org-excalidraw=: integrate SVG images generated by excalidraw into 2308 | Org Mode 2309 | 2310 | - =rcd-box=: create tables surrounded by box-drawing characters from 2311 | Lisp descriptions 2312 | 2313 | - =ob-diagram=: generate various diagrams using diagrams backend 2314 | 2315 | - =ob-mermaid=: generate Mermaid diagrams within org-mode babel 2316 | 2317 | - =quail-boxdrawing.el=: input method for box drawing characters 2318 | 2319 | - =make-box.el=: box around part of a buffer 2320 | 2321 | - =vim drawit ascii diagrams=: in Vim, in ASCII 2322 | 2323 | * Author, contributors 2324 | :PROPERTIES: 2325 | :CUSTOM_ID: author-contributors 2326 | :END: 2327 | - Thierry Banel, author 2328 | 2329 | Feedback: 2330 | 2331 | - Chris Rayner (@riscy), gave recommendations prior to insertion in 2332 | MELPA 2333 | 2334 | - Adam Porter (@alphapapa), suggested submitting =Uniline= to =ELPA=; 2335 | should I? 2336 | 2337 | - Joost Kremers https://github.com/joostkremers found a bug in the 2338 | minor-mode key-binding definitions, and incompatibility with 2339 | 2340 | - DogLooksGood https://github.com/DogLooksGood gave feedback on 2341 | inserting usual characters not moving the cursor 2342 | 2343 | - LuciusChen & lhindir on GitHub, arthurno1 & karthink on Reddit, 2344 | pushed toward =Transient= as the default interface instead of =Hydra= 2345 | 2346 | - karthink noted that =Transient= was now built into =Emacs=, loosening 2347 | the dependencies conundrum, arthurno1 participated in the =Hydra= - 2348 | =Transient= discussion 2349 | 2350 | - karthink pointed to the new =Aporetic= font family, which was then 2351 | added to the =Uniline= supported fonts 2352 | 2353 | - rumengling on GitHub found and diagnosed the misaligned lines issue 2354 | produced by some "language environments" (see [[#language-environment][Language environment]]). 2355 | 2356 | Contributors: 2357 | 2358 | - JD Smith (jdtsmith on GitHub) rewrote the =:lighter= for added 2359 | flexibility (the information in the mode-line about the state of 2360 | =Uniline=) 2361 | 2362 | - JD Smith also pointed to =#+begin_src uniline= Org Mode block 2363 | suprising behavior (editing its content automatically switches to 2364 | =uniline-mode=) 2365 | 2366 | Utilities: 2367 | 2368 | - Oleh Krehel alias abo-abo for his package =Hydra= 2369 | 2370 | - The =Magit= team for the =Transient= library 2371 | 2372 | - Thien-Thi Nguyen (RIP) for his package =ascii-art-to-unicode= 2373 | 2374 | * License 2375 | :PROPERTIES: 2376 | :CUSTOM_ID: license 2377 | :END: 2378 | Copyright (C) 2024-2025 Thierry Banel 2379 | 2380 | Uniline is free software: you can redistribute it and/or modify it under 2381 | the terms of the GNU General Public License as published by the Free 2382 | Software Foundation, either version 3 of the License, or (at your 2383 | option) any later version. 2384 | 2385 | Uniline is distributed in the hope that it will be useful, but WITHOUT 2386 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 2387 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 2388 | for more details. 2389 | 2390 | You should have received a copy of the GNU General Public License 2391 | along with this program. If not, see . 2392 | --------------------------------------------------------------------------------