UP | HOME

Plain Text Diagramming

Figure 4.2 Process-group hierarchy.

                            ╭───────────╮                                  
                            │ process A │                               
                            ╰─┬──────┬──╯                               
                   p_children ▼      ▲ p_pptr                           
                            ╭─┴──────┴──╮                               
                            │ process B │                               
                            ╰┬─┬────┬──┬╯                               
      ╭──────────p_children──╯ ▲    ▲  ▲                                   
      │   ╭────────p_pptr──────╯    │  ╰──────p_pptr────────╮              
      ▼   │                       p_pptr                    │              
  ╭───┴───┴───╮             ╭───────┴───╮             ╭─────┴─────╮         
  │ process C ├◀─p_sibling─▶┤ process D ├◀─p_sibling─▶┤ process E │         
  ╰───────────╯             ╰───────────╯             ╰───────────╯         

A diagram from The Design and Implementation of the 4.4BSD Operating System that I copied using the Emacs package uniline. This my first attempt at really using it, so pardon the amateurish layout.

Getting this working the way I liked both on MacOS and NetBSD was bit more of an adventure than I was expecting so here are some notes.

uniline

Just go read the documentation. Lots of pretty, motivating examples and clear guidance. One really cool feature, you can use a rectangular selection to extend a drawing along a particular direction and uniline automatically inserts the necessary strokes. Overall rectangular selections work great: moving elements, moving text, creating boxes, copy/paste etc.

Mac OS Keyboard troubles

The very first problem I hit was that uniline binds the INS or INSERT key to get at some important actions. Mac OS, as far as I can tell does not handle this key at all. Even after mapping my Kinesis Advantage 360 to send it, Emacs told me that it received HELP. Ok, so I ended up with the following:

(use-package uniline
  :ensure t
  :bind   ("C-| " . uniline-mode)
  :init
  (when (not my/is-netbsd)
    (setopt uniline-key-insert '("<help>"))))

org-mode rendering troubles

The next Mac OS problem, I was getting both Courier and Iosevka Term faces in text source blocks leading to uniline diagrams that wouldn't align while drafting a post. This was due to Protesilaos Stavrou's excellent monochromatic doric-themes. I was missing setting the face attribute for 'fixed-pitch.

(set-face-attribute 'fixed-pitch nil :family "Iosevka Term")

If you need to get the face attribute currently under the cursor C-u C-x =.

NetBSD & X11 bitmap fonts

On NetBSD, I run Emacs 30.2 compiled with Lucid Toolkit. I was using the X11 system 7X14 bitmap font. However this font does not provide the unicode characters used by uniline. I looked around and came across UW ttyp0 which covered the bases and was clearly designed by someone who appreciates the clarity of X11 bitmap fonts. Fortunately this font was readily available from pkgsrc and then I needed two lines in my Emacs NetBSD font configuration to get org-mode file rendering with uniline diagrams looking quite nice.

(set-frame-font "Ttyp0:pixelsize=14" nil t)
(set-face-attribute 'fixed-pitch :family "Ttyp0")

I rebuilt the blog and got the diagram you see above.

Emacs 30.2 (Org mode 9.7.11)

Served from NetBSD 9.2 via SDF

About this site