Posts

Showing posts from September, 2026

Plan 9: Code Assist (Rio)

Image
  This is part 2 of my vision of Plan 9 as an Infinity Notebook . This focuses on the developer tools expanding on these ideas . Syntax Highlight Highlight comment, string and keywords. This is triggered on demand presently. For more advanced rendering requirements, use plot . In general, syntax highlighting is a computing intensive operation. Each character needs an attribute to store font size, weight, slant and color attributes. Font attributes affect which font file (regular, bold, italic or bold-italic version) is used for rendering. Each of this also affects the box size calculations for line wrap. This implementation uses a simpler approach using spans to store color information: Scanner : table-driven matchers ( mblock , mline , mstring , mident ), first match wins, each returns a length and a class. Classes : one {name, rgba, img} table indexed by an enum, initialized once. Output : waddcolorspanclass stores sorted spans; spanfirst finds the first overlapping one. ...

Plan 9: Code Assist

Image
Jump to definition with ctags    Use ctags for jump-to-defintion. Also, you can use Button3 in acme to jump to include files - both system and local headers. readtags uses binary search . So it makes jump to symbol faster on a large codebase.  Note: Use  sig  command for signature lookup.  Use  src  command for jumping to Plan 9 command sources.  If you have mounted contrib sources, use this . Alternatively, download tar from https://ctags.sourceforge.net/  . Make following changes: in Makefile, add '-DHAVE_REMOVE' (remove() instead of unlink()) and '-DHAVE_OPENDIR' (for directory recursion option) to DEFS in config.h, remove or comment out the definition of INT_MAX  # Use one below to enable APE bind -b /$objtype/bin/ape /bin ape/psh    # ls doesn't support -di option in Plan 9 sed 's/ls -di/ls/' configure > configure.new mv configure.new configure   # Fake presence of egrep cp /bin/grep /$objtype/bin/ ...

Plan 9: Devanagari Input with kbmap

Image
  Note : The demo uses layer 3 for better key visualization while using Devanagari.                The PS/2 interface presents two physical layers, switched on if the input scancode is one or two bytes. This second "escaped" layer is typically generated for keys like `Home' and `Ins'. Kbdfs additionally maintains eight more virtual layers that are switched on `Shift', `Ctl', `AltGr', and `Mod4' modifier key state. Not all permutations of these modifiers are represented as layers, the exhaustive list is as follows: none Key shift Shift + Key esc Escaped Key altgr AltGr + Key ctl Ctl + Key ctlesc Ctl + Escaped Key shiftesc Shift + Escaped Key shiftaltgr Shift + AltGr + Key mod4 Mod4 + Key altgr...

Plan 9: Key Visualizer

Image
Simple key visualizer for capturing keystrokes during a screencast using kbdfs, awk and statusmsg. Note : You need a Truetype font for arbitrary large display ( /n/ttf/mine/32/font  in the example).  Also, ensure truetypefs is running if you do use Truetype font.   #!/bin/rc fn notify {     scr=`{awk '{print $4, $5}' /dev/screen}     w=200     h=60     ws=$scr(1)     hs=$scr(2)     minx=`{echo $ws - $w | bc}     warg=`{echo -w  $minx,0,$ws,$h}     font=/n/ttf/mine/32/font aux/statusmsg $warg $1 } {     tee /dev/kbdtap |     tr '\000' '\034' |     awk -v 'RS=\034' '     BEGIN {         esc   = sprintf("%c", 033)         tab   = sprintf("%c", 011)         bksp  = sprintf("%c", 010)         del   = sprintf("%c", 0177)      ...