Wishes for a folding editor

History: 12.sept.2007 [1] – updated 4Oct2022
This page is in group Technology.

Wishes for a folding editor

Intro

This post is meant for us to collect thoughts. I would appreciate anyone to comment here, and hope that we could collectively bring about a spec for a new folding editor. Maybe a programmer would emerge, too? Folding is a fantastic cognitive tool!

The starting point of this note may be seen in my Designer’s note [1].

The above Intro is made with the html tag <details> followed by <summary>. It gives a flavour of the first step of folding: a piece of text which is disclosed when pressing on the always visible heading, or fold crease as I was learnt to call it in the early nineties. I discovered this html tag just now (5Apr2022). But try to search for “collect” in this text with the “summary” not seen. Is this wanted semantics if this were a piece of source code?

Kstovo-BusStation-Sinks-1444Observe that I didn’t even tell you that the ▶ arrow points to something you may press to read the contents which reveals itself below the ▼ – it’s a semiotic fact for all of us. And then, how we close the text again. We know it, just as we immediately feel the crash when two cold water faucets have blue/cold and red/hot markings (picture). (Semiotics) (Then, why is the first arrow seem in a blue rectangle here? Ask WordPress, not me.)

The reason I’ve pointed out this “semiotic stuff” is because it also has some deeper connotations as to how we perceive text, ie. source code, ie. what it is doing, ie. the quality of the sw it’s the runnable engine of, ie. your trust in that program. There are many ways to do this, and deep folding, but not just <details>, is one of them.

Observe that my favourite folding editor is WinF (or F or WinF32 or winf32). It’s freely available at [2], as Windows exe and even source files. At the moment it just is best..!? (even after xcode!)

It was the F editor for the Inmos Transputer Development System that started it all. The manual is a shining example of how such manuals once were written [8]. Many peopled hated the folding of the TDS. Here, from Wikipedia [transputer]:

The initial occam development environment for the transputer was the Inmos D700 Transputer Development System (TDS). This was an unorthodox integrated development environment incorporating an editor, compiler, linker and (post-mortem) debugger. The TDS was a transputer application written in occam. The TDS text editor was notable in that it was a folding editor, allowing blocks of code to be hidden and revealed, to make the structure of the code more apparent. Unfortunately, the combination of an unfamiliar programming language and equally unfamiliar development environment did nothing for the early popularity of the transputer. Later, Inmos would release more conventional occam cross-compilers, the occam 2 Toolsets. (text 19Nov2020)

I came in with the occam 2 toolset, was on a course in Bristol, and just loved what was left of the all folding concept: The F editor only.

Read about folding in [3].

Winf32 on Mac OSX

OSX on MacBook with Retina 1600x2560 with winf32

I have now been able to get winf32 running on Apple OSX (10.8 Mountain Lion) on the free WineApp emulator (from Wine [4]), using free X11 windowing system (called XQuartz [5]).

This way Parallels Desktop for Mac [6] (or VMware Fusion [7]) and Microsoft Windows installs are not needed. You save €, $ or NOK!

Here is a fast recipe. Download XQuartz (starting with OSX 10.8 Mountain Lion X11 is not bundled any more). I have described the XQuartz download in my “FDR2 notes“. Then download the WineApp, install and run it.

[2] includes a winf32.ini file for MacBook Pro with retina screen and non-numeric keyboard. Then read the winf32_osx_non_numeric_keyboard.ini that you have downloaded and rename it to winf32.ini. Then you can just doubl-click the Winf32.exe file.  Yes, 147 kB does it!

Some of the important shortcuts (defined in winf32.ini)

Fold terminology and keys

In addition to remapping by editing in the winf32.ini, you can also see present mapping (and change it) in Options | Key bindings. Here are some that I have negotiated with the keyboard and standard shortcuts as well as what is possible. Some obvious keys I did not succeed with, like find next where I wanted “ctrl alt f2” but had to compromise to “ctrl alt 2” which is ok. But these seem to work pretty well for me:

  • Fold contents alone, left indented to pos 0:
    • Enter fold: ctrl backspace
    • Exit fold: ctrl alt backspace
  • Fold contents seen with other contents:
    • Open fold: shift backspace
    • Close fold: shift ctrl backspace
  • Create fold: same for begin and end: ctrl shift upparrow
  • Remove fold: will loose crease text: ctrl shift downarrow
  • Line or fold copy/paste:
    • Pick: f11
    • Copy pick: f12
    • Put: ctrl f11 or ctrl f12
  • Find / replace
    • New find: alt f1
    • Find next: ctrl alt 2
    • Replace current: ctrl alt 3

Now it’s just to double-click on winf32.exe to run it!

Post script: Of course, if you look at the full resolution of the picture (press on it and zoom), then it’s more obvious than ever that winf needs to be ported! It looks like the basic resolution of the winf window is low, compared to the retina resolution. And, again: see [1].

Update 3Dec2016: I did a comment on the WordPress plugin Collapse-O-Matic at https://wordpress.org/support/topic/expandclose-all-and-auto-expand-on-printing/, hoping to get some readers there to respond. Also see WordPress#collapse-o-matic_plugin. I also have my saying at 061:[Collapse-O-Matic plugin].

Origami

There also was this Origami editor that I used for several years. I just loved it. It was written by Vladimir Katalov from Elcom in Moscow. This is now ElcomSoft, (where he is CEO), who works with digital forensic tools. Here are some references, though, to the good old Origami:

The reason I updated with this info is that a fried of mine, in March 2021 sent me a file that I saw was folded and I asked which folding editor he used. Origami!

Notes

Apr2022: Why Vim is better than VSCode by Sean Warman (on Medium) is quite an interesting read, even if  there’s not a word there about folding. I did add a small comment (here).

Extensions/plugins for state of the art IDEs

VSCode

Microsoft Visual Studio Code

“Explicit Folding” by zokogun

Update 3Oct2022. See https://github.com/zokugun/vscode-explicit-folding

  1. What will C code look like in an editor that don’t support explicit folding?
  2. What happens with the C code if I install and use Explicit Folding and then decide to uninstall it? How is it uninstalled?
  3. How is a C file folded with “Explicit Folding” look for other users of VSCode that haven’t installed the extension?
  4. Is it possible to copy/paste a fold and thus move it around?
  5. Will it support nested folding? I think so, there is a “nested” keyword in there
  6. How does this work?
  7. How is a fold opened and closed?
  8. Does it distinguish between enter / exit (fold contents alone, left indented to pos 0) and open / close (fold contents seen with other contents) of a fold?

References

This note rendered my Blogspot note 012 from July 2009 as obsoleted (I have moved all over to this page).

  1. “Wishes for a folding editor” (1)
    http://www.teigfam.net/oyvind/pub/notes/11_Wishes.html
  2. “Download winf folding editor by Julian Wilson”
    http://www.teigfam.net/oyvind/extern/winf32_folding_editor/index.html
  3. “Folding editor” at Wikipedia
    http://en.wikipedia.org/wiki/Folding_editor
  4. WineApp http://en.wikipedia.org/wiki/Wine_(software) (Download from http://www.winehq.org)
  5. XQuartz
    http://en.wikipedia.org/wiki/XQuartz (Download from http://xquartz.macosforge.org/landing/)
  6. http://en.wikipedia.org/wiki/Parallels_Desktop_for_Mac
  7. http://en.wikipedia.org/wiki/VMware_Fusion
  8. F editor, Preliminary version, INMOS Limited, 72 TDS 277 00, March 1991, see http://transputer.net/prog/72-tds-277-00/feditpre.pdf (This copy come from my collection, in 2020, see Transputer TRAM (was: boards for sale)). As a backup I’ve also placed a copy in my own domain: inmos_f_folding_editor_manual_1991.pdf

1 thought on “Wishes for a folding editor

  1. aclassifier Post author

    “I fear that the ‘purist’ frame of mind that produced Occam and Winf has all but gone. But the trouble with winf32 is that it still thinks it’s on a small screen, which is a pity.Those clever folks at Google probably produce stuff that is equally cool and well designed, but it it always so packaged that we have all become consumers.” [From a UK engineer with whom I had mail contact, and who allowed me to quote this agreeable comment]

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.