Using Emacs for Gophermaps | |
Why use Emacs when everyone suggests I use vim for creating a | |
gophermap? | |
That's easy. Because I can. | |
Gopher was born around the same time as the World Wide Web. | |
Were it not for a few bad decisions, the net could have been a | |
vastly different place. I'm old enough to remember it, if | |
only vaguely. I'm also old enough to be getting tired of | |
progress and miss things being simple and mostly text based | |
without all the advertisements and trackers. Cookies were | |
snacks next to the computer. | |
I'm not going to pretend I remembered much of anything about | |
it, but lines were of the format. | |
PText[Tab]Fspec[Tab]Host[Tab]Port | |
Where the P field is the Protocol: | |
0 Text /* Link to a Text File. */ | |
1 Gophermap /* Link to a Gophermap. */ | |
9 Binary /* Link to a Download. */ | |
i Informational /* Informational Text. */ | |
h URL /* Link to a URL */ | |
The Text field cannot contain tab characters. | |
The Fspec field is of the format [dir][/][filename] at least | |
one element must be present. | |
The Host field is the canonical name of the host. | |
The Port filed is the TCP port to use. Gopher usually ran on | |
port 70 while http usually ran on port 80. See /etc/services | |
for more information. | |
Informational text and URL types ignore the information in the | |
Host and Port fields. | |
URL should pass the text following "URL:" off to the operating | |
system's protocol handler. | |
hHome[Tab]URL:https://mcsuper5.freeshell.org/[Tab]null[Tab]1 | |
Using Emacs | |
Emacs tends to use the tab key for auto formatting. You can | |
avoid this by quoting it by typing a "C-q" before the tab | |
character. | |
If your gophermaps look weird in your client, try cat with the | |
"-t" flag to see if you have stray tab characters. | |
Because the format is textual, you'll want to limit the length | |
of your lines or refill them using Emacs using "C-x f 62" and | |
"M-q" for each paragraph. Update the line length according to | |
your preference. | |
For your informational text it is useful to use a macro. | |
Go to the top line of your informational text and begin | |
recording. | |
"C-x (" or "[F3]"; | |
"C-a i"; | |
"C-e C-q [tab] / C-q [tab] null C-q [tab] 1"; | |
"C-n" or "[Cursor Down]"; | |
"C-x )" or "[F4]". | |
You can then execute the macro with "C-x e" or "[F4]". | |
Hope that helps. | |
MJC 2024.04.23 | |