Office privacy

This morning with Rachael (who runs the community centre) and Jenny (who runs Te Whare Roimata) were in the office having a meeting, our resident conspiracy guy went through to interrupt and have a casual chat with them, and as a result I shared with him a few word about privacy and how just heading through to the Staff Only area is not all that appropriate. This of course spurred a good-natured chat about how Göring controlled access for Hitler, and my thoughts immediately turned to Godwin’s Law.


Normally code editors are capable of automatically indenting code for you, but the Clipper programming language is so old that attempts to auto-indent result in the code being messed up even worse. Fortunately though I can me good use of the guess-indent feature that I disabled earlier on. Because the program guesses an indent of 2 for the code instead of the actual 3 that the code is mostly indented at, I can work through each file making minimal corrections to the code layout until the guess results in a correct guess of 3 for the indenting instead.

The whole point of this process is to reduce the amount of editing that I have to do of the files at this stage. If the editor can correctly detect the amount of indentation, then that means the code is improved enough, over and above the rest that is there.

After setting up a new keyboard command (Ctrl+Shit+D) to detect the amount of indentation, the process for this is a fairly steamlined process:

  1. Open code file
  2. Cut out functions and move to a new file Ctrl+X Ctrl+Tab Ctrl+V
  3. Fold up the functions so they can then be easily selected Ctrl+K+1
  4. Cut off top function from new file Shift+Down Ctrl+X
  5. Paste that one function it back to the original Ctrl+Tab Ctrl+V
  6. Detect indentation Ctrl+Shift+D
  7. If it guesses correctly, loop back to line 4

If it guesses wrongly, then editing of the code can occur which involves nice features such as having an editing cursor on multiple lines at a time, so that screenfulls of code can be rapidly worked on simultaneously at a time.

Part-way through there was a situation where the detected indentation was wrong, even after the code had been correctly indented to the point of perfection. This is where I learned that it paid attention to comments too, so it was back through them all again from the first file to fix the comments at the top of each page to quickly adjust them all so that they wouldn’t throw off the detection either.

That’s how I was able to mostly fix up the indentation of 20+ years of code in just half a day, which is nothing to be sneezed at. Only as I neared the end of things though did I realise that I could have set up a macro to do the Ctrl+Tab Shift+Down Ctrl+X Ctrl+Tab Ctrl+V Ctrl+Shift+D, which would have retrieved the next function and detected its indentation setting – c’est la vie.