Using org-attach in Emacs org-mode
==================================
Use org-attach to create an independent structure for your notes and
files
--------------------------------------------------------------------
org-attach is a great method to link files to your org-mode notes,
and org-mode todos.
These attachments can be of any type, f.e., a PDF, an image, a text
file, or even another org file.
The attachments are linked to headers in your org-file. You can link
any attachment to any header.
org-attach links the file to the header of the current node. It
offers several different ways to create a connection between your
org-file and the file to attach, like copying the file, moving the
file, creating a symlink, or a hard link, and others.
The most robust way is to copy or to move the file. The location
where the attachment is copied to, or moved to, depends on the
configuration of the org-attach attachment directory.
Attachment directory
--------------------
The default way to store the copy of the file is in a directory-tree
under the sub-directory `data`, which is created in the directory
where the org-file is located.
Another option is to create a specific directory for all your
attachments, f.e. `~/.emacs.d/data/`, where org-attach creates its
directory-tree.
Node ID
-------
org-attach uses an ID to establish the link between the node and the
attachment. The first time you create an attachment for a node,
org-attach creates a property-drawer for the heading of the node,
and places an ID in it, using an UUID.
Here is an example:
** Example header
:PROPERTIES:
:ID: 1B02325F-2989-45CC-AEDF-0B2C942DC1D1
:END:
Directory-tree within in the attachment directory
-------------------------------------------------
org-attach creates a directory-tree within the attachment directory.
First, it creates a directory with the name of the first two
characters of the UUID, in the above example "1B".
Next, it creates a sub-directory within this directory, with the
name of the remainder of the UUID, in the above example
"02325F-2989-45CC-AEDF-0B2C942DC1D1".
It places the attachment in this sub-directory.
The end result is something like this:
.
|-- data
| |-- 1B
| | `-- 02325F-2989-45CC-AEDF-0B2C942DC1D1
| | |-- my-first-attachment.pdf
| | `-- my-second-attachment.pdf
| |-- 52
| | `-- 245B02-4459-4CE4-81B6-D84DF86B0D33
...
org-attach adds a tag to your headline
--------------------------------------
org-attach adds a tag `:ATTACH:` to headline of the node, so you
know there are one or more attachments for this node.
Default configuration
.....................
org-attach works right out of the box, without any configuration. As
usual, the default configuration is already fine, and hardly needs
any tinkering.
As mentioned above, in the default configuration org-mode creates a
sub-directory `data` in the directory of your current org-mode file.
The advantage of this is that you can sync the complete
directory-tree to another computer, and everything keeps working.
In the default configuration, org-attach copies the file to the tree
under the `data` directory. So, the original file is not touched.
This way, your org notes, together with the attachments, becomes
independent from the rest of your system. Nothing breaks when you
later move or delete the original file, your org note and the
attachments are still fine.
Workflow in the default configuration
-------------------------------------
All the org-attach key bindings start with `C-c C-a`.
Attaching a file to node
........................
Attach a file to your current node with `C-c C-a a`
(org-attach-attach).
This will open a directory listing where you can choose a file.
Select a file, org-attach will create a properties drawer and an
UUID if needed, create the directory tree under the attachment
directory if needed, and copy the file to this tree. It adds a tag
`:ATTACH:` to the header of your current node..
Attach from Dired
.................
Another option to attach files is to mark one or more files in
Dired, followed by `M-x org-attach-dired-to-subtree`.
Retrieving an attached file
...........................
The command `C-c C-a f` opens a listing of attached files for this
node (org-attach-reveal).
The command `C-c C-a F` (upper case F) opens the listing in Dired
(org-attach-reveal-in-emacs).
Choose one of the files to open it.
Synchronize
...........
The command `C-c C-a z` synchronizes the current node and its
attachments. This is useful when you have manually added files to
the directory-tree.
Links to the attachment
-----------------------
I have only added one single line to my `~/.emacs` for working with
org-attach:
(setq org-attach-store-link-p 'attached)
With this, you can add links to the attachment in the text of your
node.
After adding a attachment with `C-c C-a a` you can use `C-c C-l` to
insert a link to the attachment into to the text of your org file.
This will become a link to the file in the directory-tree, f.e.:
[[attachment:myattachment.pdf][myattachment.pdf]]
As usual, edit the second part if you want to change the text that
is shown.
When reading your org-note, hit `Ret` on the link to open the
attachment, or `C-u Ret` to open the link in Emacs.
You don't need to add these links in the text of your org file,
org-attach works perfectly fine without it. But I like the extra
visibility.
When you have added several attachments to the same node, individual
links makes retrieving an attachment faster.
More options
------------
Of course, org-attach has a lot more to offer than described here.
However, this is already a solid, workable system.
I have the complete tree, starting with the top directory with the
org-files, in a git repository. Because of the default set up with
the `data` directory within this tree, it has become an independent
system.
A clone of this repository on another computer will work, with all
the links between the org notes and the attachments in working
order. It might need a synchronize command (`C-c C-a z`) the first
time you use it.
Another option is to sync the directory with Syncthing, or use
Nextcloud, Dropbox, or alternative, and use that to distribute it to
other computers.
Last edited: $Date: 2023/05/26 07:51:52 $
* EOF *
New PGP key
===========
I created a new PGP key.
New key:
5DA4CDCE759F29F13EAA8BABF0A67BC632EE59A4
5DA4 CDCE 759F 29F1 3EAA 8BAB F0A6 7BC6 32EE 59A4
Old key:
3607934AA0B11DC0883ED667DCA954CDC7A2415A
3607 934A A0B1 1DC0 883E D667 DCA9 54CD C7A2 415A
Of course, I signed the new key with the old key.
Please use the new key.
You can find the key here:
gopher://box.matto.nl/0/gpgpubkey.txt
Last edited: $Date: 2023/05/18 08:18:14 $
* EOF *
Create texinfo files with org-mode for your personal notes
==========================================================
Build your Personal Knowledge Base with org-mode and Texinfo
------------------------------------------------------------
Org-mode is a wonderful system and for many people the main reason
to start with Emacs. Org-mode is easy to use, powerful and a great
environment to create and maintain your personal notes, organize
your to-do items, and much more.
Org-mode provides an export function that supports many formats.
Org-mode can export to Texinfo and directly to info.
Texinfo is a brilliant hypertext system that predates HTML. You
access it with `info`, which is a text mode application. The content
consists of a number of nodes. Each node is an information element.
You access the nodes through menus, hyperlinks, and indices. Also
you can "walk" through a info file with keys like `[` and `]`. See
`info info`.
Personal Knowledge Base with Texinfo
------------------------------------
Texinfo is a great way to access your Personal Knowledge Base.
Texinfo has been developed to create manuals. So it is specially
made to supply you with structured information.
Texinfo is used by GNU as it's documentation system. Some other open
source applications provide their documentation in the texinfo
format, like ZSH.
Texinfo is also a great medium for your personal notes. Using info
to fetch your notes is very fast and most often requires just a few
key strokes.
See [my page: Texinfo as Personal Knowledge Base].
Type of information
-------------------
Creating a Personal Knowledge Base with Texinfo is best suited for
information that you write once and then retrieve it multiple times.
Once you have written an org file with your notes, it is easy to
update and create an updated info file from it.
I use it for describing tasks that I do infrequent, like installing
a new server, using Docker, manipulation PDF files, my notes on
using ledger, and so on. I document all the necessary steps, in the
right order, and any additional information.
Write with org-mode
--------------------
For each subject I create a separate org-mode file, f.e. an org-mode
file for OpenBSD notes, an org-mode file for FreeBSD notes, one for
Raspberry Pi OS notes, etcetera.
In these files, I use three levels of headers:
* Level 1 header for the main sections.
* Level 2 headers, one for each subsection within the main section.
* Level 3 headers, to create sub-subsections in the subsections,
when needed.
In most org-mode files that I use this way, I have several level 1
headers, to break up the information in logical sections. Within
each section I have several level 2 headers for the subsections.
In some subsections I break up the information in sub-subsections,
using level 3 headers.
Verbatim text
-------------
For verbatim text, like code, commands, and so on, I use an org-mode
block that starts with `#+begin_example` and ends with `#+end_example`.
With the keybindings this is easy to enter.
* Mark the block
* Hit `C-c C-,` followed by `e`
(Hold the control key, hit "c" followed by ".". Release the control
key and hit "e").
Bullet list
-----------
Bullet lists can be used in Texinfo. Just enter these in the normal
org-mode way:
- First item
- Second item
- Another item
Set the Texinfo specific export settings
----------------------------------------
At the top of the org-mode document, add some keywords with their
settings.
#+TITLE: The title of the document
#+TEXINFO_DIR_CATEGORY: Personal notes
#+TEXINFO_DIR_TITLE: The title in the top "dir" document
#+TEXINFO_DIR_DESC: The description shown in the top "dir" document
The title will become the name of the Top node.
The dir-categorie is the categorie, where your info file will appear
in the top-level menu. I use "Personal notes" for all my own info
files, so they appear together in the top-level menu, sorted
alphabetically.
The title in the top "dir" document (TEXINFO_DIR_TITLE) creates the
menu entry in the top level menu. This has to be in the format
`description: (file-name-without-extension).`
This consists of three parts:
* description: the text that will appear in the top level menu, so
write it as a menu item. The colon direct after the text is
mandatory.
* file-name between parenthesis: this is the file info has to open.
Use the file name of your org-file, without the ".org" extension.
* a dot: close the line with a dot direct after the closing
parenthesis.
The dir-title will become the menu entry in the top-level menu.
See also the GNU info node on [Texinfo specific export settings].
This is a small example:
#+TITLE: FreeBSD Notes
#+TEXINFO_DIR_CATEGORY: Personal notes
#+TEXINFO_DIR_TITLE: FreeBSD Notes: (freebsd-notes).
#+TEXINFO_DIR_DESC: My personal FreeBSD notes
Creating indices
----------------
In info you can search for text, but also search in the index.
Indices can help you find the required information quicker.
Completion is available when searching in index. which makes indices
even more valuable.
Create a lot of index entries, so you can later find things more
efficient.
Adding a index entry
....................
Use the export command `#+CINDEX:`, f.e.:
#+CINDEX: GPT partitioning
Like all the export settings and commands, `#+CINDEX:` ends with
a colon. Don't forget to type it.
Write the CINDEX line just below the header for the specific node.
When you use the index in info and jump to the index, you will end
in the right position.
Close the org-mode file with an Index headline
..............................................
To activate the index entries, add the following block at the end of
your org-mode file:
* Index
:PROPERTIES:
:INDEX: cp
:END:
This will create a node at the end of your info file with the index
entries. Without this, you can not search in the index.
The properties block shown above is needed for this.
Searching with index entries
............................
When your info file is in place, and you open it in info, you can
search with `i`-key.
When you have entered the CINDEX mentioned above, and you have
opened the info file in info, you hit "i", followed by GPT and the
tab-key. This will complete to "GPT partitioning". Hit the
enter-key, and info will jump to the specific node with this index
entry.
When there are more index entries with your search term, you can
jump to the next search result with `,`-key.
Again, this is very fast and efficient.
Export from org-mode to Texinfo
-------------------------------
Org-mode support two export methods:
* `org-texinfo-export-to-texinfo`
* `org-texinfo-export-to-info`
When you export to texinfo, and not to info, you can edit your
texinfo file before converting that to info with makeinfo.
Substitute @uref with @ref
--------------------------
When you create a link to another info file, that you are also
writing in org-mode, just create an org-mode link to that file.
When you have org-mode links to other texinfo files, the export
function will create a `@uref` link. A `@uref` link will
become just plain text in the final info file.
When you substitute `@uref` with `@ref` before running makeinfo, the
link will become an active link. You have to alter the text between
the curly braces to.
Export from org-mode:
@uref{org-file-name.org, Header title}
You have to convert this to:
@ref{org-file-name}
After this correction, makeinfo will create an active link to
`org-file-name.info` in your infor file. This way you can jump in
info to the target of the link with the enter key.
Simple shell script to perform the substitution
...............................................
#!/bin/sh
ed $1 <<\EOF
H
g/^@uref/s/\..*}/}/
g/^@uref/s/^@uref/@ref/
wq
EOF
You can run this from the command line with the name of the texi
file as argument.
Convert the texinfo file to an info file
----------------------------------------
makeinfo --no-validate
The --no-validate is needed when there is a link to another info
file in the texinfo, that does not exist yet.
Add the info file to your knowledge base
----------------------------------------
On your system, you will find the info files probably in
`/usr/share/info` or `/usr/local/share/info`. These are the
documentation files for the applications that are installed by the
installer or your package manager.
Create a separate directory for all your personal info files, like
`~/.info`.
Setup an environment variable named INFOPATH to this directory, and
close with a colon, like:
export INFOPATH=/home//.info:
Move the info file to this directory, and run:
install-info --info-dir=./
See also [my page: Texinfo as Personal Knowledge Base].
Now open `info`. You will see a block with menu entries to your
personal notes as well all the menu entries to the info files
installed by your installer or package manager.
Automation
----------
Let your computer do the work for you, where possible.
* Use a snippet system like yasnippet with a template for your
org-files
* Create a Makefile to run the shell script with the substitution
for uref lines and run makeinfo and install-info command.
Have fun!
Last edited: $Date: 2023/05/15 14:29:26 $
* EOF *
The old Thinkpad X201 has become my daily driver
================================================
Lenovo Thinkpad X201
--------------------
The X201 is a machine from 2010, and one of the last Thinkpad X-models
with a classical keyboard. And like all Thinkpads, it has a great
TrackPoint.
Specs
.....
I upgraded the RAM to 8 Gb.
Some specs of the laptop:
* Intel Core i5 M 520 CPU
* 8 GB DDR3 RAM 2Rx8
* Display size 12.1 inches
* 1200x800 display resolution
* 128 Gb SSD (SAMSUNG MZ7LN128)
So, in this present day, this is not a real number cruncher.
However, the machine holds it own.
Setup
-----
This is my setup:
* Suckless dwm window manager
* Suckelss st terminal
* Suckless slstatus status monitor
* Tmux
Daily use
---------
On a typical day, you will find the following on my X201 desktop:
* Emacs, compiled from a recent git pull
* Firefox
* ssh to local shell server, running tmux with irssi, mcabber, and
some other stuff
The X201 runs these tasks surprisingly well.
Once you start using Emacs, more and more tasks are done in Emacs.
Because of this, e.g., I tend to use Tmux less.
Why I prefer the X201
---------------------
I own several laptops, including the much more capable Thinkpad X270.
Still, I prefer to use the X201. There is mainly one reason for this:
The wonderful keyboard of the X201.
This is a classic Thinkpad keyboard. Typing on this keyboard is so nice!
The Trackpoint also works very fine, after I set some lines in .xinitrc.
The keyboard and the trackpoint make a feast of using this small laptop!
Because of the 8 Gb RAM, I can run a virtual machine, using vmd, the
OpenBSD hypervisor. I have done this once, as a kind of proof of
concept.
For running virtual machines the X270 is a much better choice.
Also, my X270 runs FreeBSD, so it can run jails, something that OpenBSD
does not facilitate.
So, I still boot my X270 on several occasions, but for most of my
every day things, the X201 is the machine I prefer.
Last edited: $Date: 2023/04/28 20:04:31 $
Compiling Emacs
===============
Quite some time ago I started with a git clone of the Emacs sources
and compiled that.
From that time on, on a regular basis I do a git pull and recompile
Emacs.
Like all self compiled software, I manage the installation with GNU
Stow, see https://www.gnu.org/software/stow/.
Being Emacs, there is probably more than one way to compile it, and I
don't know if the way I compile Emacs is the best way, but it works
and has never failed.
Before you start, make sure you have the right dependencies installed.
The (not very big) list of packages to install is, of course, for
every operating system different.
Lucid toolkit
-------------
In the past, I had some problems with the GTK version, can't
remember exactly what it was, I guess some problems with the
interaction with the window manager (either ratpoison or dwm).
I changed to the Lucid toolkit, and all problems were gone.
From than on, I have sticked with Lucid.
Prepare to install with stow
----------------------------
mkdir -p /usr/local/stow/emacs
Initial git clone
-----------------
As mortal user:
git clone https://git.savannah.gnu.org/git/emacs.git
./autogen.sh
./configure --with-x-toolkit=lucid --prefix=/usr/local/stow/emacs
make bootstrap
As root:
make install
cd /usr/local/stow
stow --ignore=dir emacs
After this, Emacs has been installed, with a number of
subdirectories, under /usr/local/stow/emacs:
.
|-- bin
| |-- ctags
| |-- ebrowse
| |-- emacs -> emacs-30.0.50
| |-- emacs-30.0.50
| |-- emacsclient
| `-- etags
|-- include
| `-- emacs-module.h
|-- lib
| `-- systemd
|-- libexec
| `-- emacs
`-- share
|-- applications
|-- emacs
|-- icons
|-- info
|-- man
`-- metainfo
The command stow --ignore=dir emacs creates
symlinks in /usr/local/bin, /usr/local/include, and so on,
to these subdirectories.
Upgrade and recompile
---------------------
Recompiling Emacs is not much different.
This is how I do this:
As mortal user:
git pull
git clean -dxf
./autogen.sh
./configure --with-x-toolkit=lucid --prefix=/usr/local/stow/emacs
make bootstrap
As root:
cd /usr/local/stow
stow -D --ignore=dir emacs
rm -rf emacs-old
mv emacs emacs-old
cd [git clone dir]
make install
cd /usr/local/stow
stow --ignore=dir emacs
This moves the current install from /usr/local/stow/emacs
to /usr/local/stow/emacs-old, creates a new directory
/usr/local/stow/emacs and installs the new version there.
This way, if the new compiled version has any problems, I can always
revert to the last compiled version. In practice, however, I have
never had to do this.
Also, on several boxes with the same OS (and OS-version), the
stow-directory can be shared, so compilation on only one system
is needed.
Upgrade packages
----------------
After a recompile, I upgrade the packages in Emacs.
Happy Emacsing !
Last edited: $Date: 2023/04/12 10:33:21 $
Org-capture template for weeknotes
==================================
Today I created a small template for org capture, to create weeknotes.
This is the template:
* Week %(format-time-string "%Y-%W")
** %?
*** Reading
*** Things I have learned
*** Events
Entered on %U
;; Weeknote ends here
This will create a note starting with the header
* Week 2023-15
for week 15 in the year 2023.
Config
------
This is how I added the template to the capture config:
("w" "Weeknote" entry (file+headline "~/org/weeknotes.org" "Weeknotes")
(file "~/org/templates/weeknote.tpl"))
Ability to parse
----------------
Maybe that in the future I would like to parse the notes. That is
why I choose the format YYYY-WW, so it can be chronologically
sorted.
The line ";; Weeknote ends here" at the end of the note, also
might be helpful when parsing the notes.
For now, however, I just want to capture the weeknotes, and see
how it develops over time.
Last edited: $Date: 2023/04/11 11:26:50 $
Some notes on OpenBSD 7.2 on a Thinkpad X201
============================================
It has been a while since I had a laptop running OpenBSD.
Recently I bought a refurbished Thinkpad X201, so this was
a great occasion to put OpenBSD on it.
Of course, installing OpenBSD on a Thinkpad is not
difficult.
You need to install OpenBSD with an ethernet cable
attached, in order to be able to run fwupdate. This
installs firmware for the wifi card. After that, wifi
works fine.
Lenovo Thinkpad X201
The X201 is a machine from 2010, and one of the last
Thinkpad X-models with a classical keyboard. And like all
Thinkpads, it has a great TrackPoint.
Some specs of the refurbished laptop I bought:
* Intel Core i5 M 520 CPU
* 4 GB DDR3 RAM 2Rx8
* 1200x800 display resolution
* 128 Gb SSD (SAMSUNG MZ7LN128)
Perfectly usable
Although the specs are not very spectacular, this machine
is perfecty usable. It all depends on how it is used, of
course.
I set it up mostly with the great tools from suckless.org:
* dwm window manager, with slstatus
* st virtual terminal
Most of the time I am either in tmux, mostly for ssh
sessions to remote machines, or in Emacs, to read email,
use-net and follow RSS-feeds, and to visit websites with
eww, and Gopherholes and Gemini capsules with Elpher.
I also use Firefox, which in practice turns out to be the
heaviest user of the memory.
Keyboard and TrackPoint
The X201 has a small trackpad with two buttonst. The --for
Thinkpads typical-- TrackPoint comes with three buttons.
I don't use the trackpad, the TrackPoint functions very
fine.
In .xinitrc I have some lines to improve the usablilty of
the trackppint:
xinput set-prop "/dev/wsmouse" "WS Pointer Wheel Emulation" 1
xinput set-prop "/dev/wsmouse" "WS Pointer Wheel Emulation Button" 2
xinput set-prop "/dev/wsmouse" "WS Pointer Wheel Emulation Axes" 6 7 4 5
xinput set-prop /dev/wsmouse "Device Accel Constant Deceleration" 0.2
This makes it possible to use the TrackPoint for
scrolling, by moving the pointer up or down with the
middle button pushed down.
In the BIOS I have changed the setting so the Fn key
functions as the left Control key, and the left Control
key functions as the Fn key.
I have added /etc/wsconsctl.conf with the following line:
keyboard.map+="keysym Caps_Lock = Control_L"
This sets up the Capslock key as an extra Control key.
Also in .xinitrc I have some lines with some keyboard
mods:
xmodmap -e "keycode 234 = Prior"
xmodmap -e "keycode 233 = Next"
This makes the two keys left and right of the upper arrow
key behave like those on newer Thinkpads, as PageUp and
PageDown.
Battery life
I installed the package obsdfreqd.
In /etc/rc.conf.local are the following lines:
apmd_flags=-L
pkg_scripts=obsdfreqd
With a fully charged battery, slstatus reports a battery
life around 3.5 hours.
With sysctl hw.sensors.acpibat0 we get some information
about the battery:
hw.sensors.acpibat0.volt0=11.10 VDC (voltage)
hw.sensors.acpibat0.volt1=11.68 VDC (current voltage)
hw.sensors.acpibat0.current0=1.31 A (rate)
hw.sensors.acpibat0.amphour0=4.56 Ah (last full capacity)
hw.sensors.acpibat0.amphour1=0.23 Ah (warning capacity)
hw.sensors.acpibat0.amphour2=0.02 Ah (low capacity)
hw.sensors.acpibat0.amphour3=2.29 Ah (remaining capacity), OK
hw.sensors.acpibat0.amphour4=9.32 Ah (design capacity)
hw.sensors.acpibat0.raw0=1 (battery discharging), OK
Other stuff
When I close the lid, the laptop goes to sleep.
After opening the lid again, the laptop wakes up,
including the Wifi and X.
I was able to mount a SD-card and boot from an SD card.
Overall experience
The display resolution of 1200x800 is a bit crampy when
opening two windows in Emacs side-by-side.
I am touch-typist, and typing on the X201 keyboard is
wonderful. The keyboard is a bit loud.
With the deceleration mod, mentioned above, the TrackPoint
is a joy to use. It feels completely effortless to use the
TrackPoint.
The escape key is located where it should be, above the F1
key. On my X270 it is left of the Function keys, so it
takes some time to get again used to the Escape key in its
proper place.
The X201 and the X270 are almost identical in size, but
one way or the other, the X201 feels smaller.
References
There are plenty pages on the internet about OpenBSD on
laptops and of course OpenBSD supplies wonderful
documentation.
Here are some useful pages:
* https://www.c0ffee.net/blog/openbsd-on-a-laptop
* https://sohcahtoa.org.uk/openbsd.html
* https://paedubucher.ch/articles/2020-09-05-openbsd-on-the-desktop-part-i.html
* https://dataswamp.org/~solene/2022-04-21-openbsd-71-fan-noise-temperature.html/etc/wsconsctl.conf
Last edited: $Date: 2023/03/04 16:16:04 $
Zoom window in Emacs
====================
Zoom in tmux
------------
I am a great fan of the zoom function in tmux, which can
be called with [escape-key]-z.
This is useful when you have split the tmux window into
two or more panels.
* Calling zoom in tmux will enlarge the current panel to
fill the entire window.
* Calling zoom again will return to the 'normal' state.
Zoom in Emacs
-------------
zoom-window.el provides a simular function for Emacs.
To notify that a window is zoomed, the background color of
the mode line is changed. The default background color for
this is light green.
When the text in the mode line is white, it becomes hard
to read on the light green background. A variable can be
set to change the default background color.
This is in my .emacs:
(use-package zoom-window
:ensure t
:config
(setq zoom-window-mode-line-color "DarkGreen")
:bind ("C-x C-z" . zoom-window-zoom))
This will install the package, set a key binding C-x C-z
to zoom / unzoom, and change the background color of the
mode line in zoom-mode to dark green.
You find more here:
https://github.com/emacsorphanage/zoom-window
Have fun!
Last edited: $Date: 2023/02/25 20:08:06 $
Using Elpher to browse the Gopher sphere
========================================
Lynx
----
As long as I can remember, I used lynx to browse the Gopher sphere.
Lynx is fast, and has a great user interface.
In the old days, Lynx was installed by default by most Linux
distributions, like Slackware, and RedHat. Later, this changed
and Lynx had to be manually installed.
Elpher
------
With the advent of Gemini, I started looking for a Gemini browser
and settled with Elpher. Elpher describes it self as a "Elpher
Gopher and Gemini Client".
See: gopher://thelambdalab.xyz/1/projects/elpher/
In the beginning I only used Elpher to browse the Gemini sphere, and
kept using Lynx for Gopher. In a email conversation, Szczezuja (see:
gopher://sdf.org/1/users/szczezuja) inspired my to try Elpher also
for Gopher.
Advantages of Elpher
--------------------
Of course it is nice to have the same client for Gopher as well as
for Gemini. The integration with Emacs helps to run everything in
the same environment.
What really sets Elpher apart, is that it turns an URL into an
active link. For example, when there is somewhere on the gopher page
you are visiting, a link to gopher://sdf.org. then in Elpher it
automagically becomes a link, which you can easily follow just by
hitting Enter on it.
And because it runs in Emacs, URL's pointing to an http server will
open in eww, so everything looks and feels the same, and you don't
have to leave Emacs at all.
Keybindings
-----------
The default keybindings of Elpher are a bit gewöhnungsbedürftig
(great German word, meaning "it takes time to get used to"):
- TAB/Shift-TAB: next/prev item on current page
- RET/mouse-1: open item under cursor
- m: select an item on current page by name (autocompletes)
- u/mouse-3/U: return to previous page or to the start page
- g: go to a particular address (gopher, gemini, finger)
- o/O: open a different address selector or the root menu of
the current server
- d/D: download item under cursor or current page
- i/I: info on item under cursor or current page
- c/C: copy URL representation of item under cursor or current
page
- a/A: bookmark the item under cursor or current page
- B: list all bookmarks
- s/S: show current history stack or all previously visted
pages
- r: redraw current page (using cached contents if available)
- R: reload current page (regenerates cache)
- !: set character coding system for gopher (default is to
autodetect)
- T: toggle TLS gopher mode
- F: forget/discard current TLS client certificate
- .: display the raw server response for the current page
For more info on Elhper, see:
gopher://thelambdalab.xyz/1/projects/elpher/
Last edited: $Date: 2023/02/18 16:16:30 $
* EOF *
Reading notes with nov.el-mode and org-noter
============================================
Within Emacs, you can read PDF and EPUB files and keep reading notes
in a separate but linked org file. With DocView you can also read
odt and docx files, with these also you can keep linked reading
notes.
I have only used org-noter with EPUB files.
Below, we look at using Emacs to read EPUB files, and create and
maintain reading notes.
I use the Vanilla Emacs key bindings (without Doom or Spacemacs).
nov.el and org-noter can both be installed from Melpa.
Read EPUB files with nov.el
---------------------------
nov.el (https://depp.brause.cc/nov.el) is a wonderful major mode for
reading EPUB files in Emacs.
Configuration
.............
With nov.el you open and read EPUB-files in Emacs. Depending on your
preferences the text is shown with a variable pitch font, a
monospace font or your standard font in Emacs.
I prefer the standard Emacs font, this way everything uses the same
presentation.
Nov.el by default fills the text to column 80. I prefer a smaller
text width and set this to column 70. This way I can have two
windows side-by-side and still have some 'air' around the text.
This is my configuration:
(use-package nov
:ensure t
:config
(setq nov-variable-pitch nil
nov-text-width 70))
Line numbers are probably not very useful while reading a EPUB.
Therefor I have disabled the line numbers in nov.el-mode, and some
other modes:
(dolist (mode '(deft-mode-hook
term-mode-hook
nov-mode-hook
shell-mode-hook))
(add-hook mode (lambda () (display-line-numbers-mode 0))))
Usage
.....
Just open an EPUB file to start reading.
The main navigation is with the standard key bindings, like in info
or eww:
* To scroll, use space and to scroll back use backspace.
* To move to the next chapter, use n and to the previous, use p,
or use the ] and [ keys.
For more key bindings, see the nov.el file, search for nov-mode-map.
Take reading notes with org-noter
---------------------------------
org-noter (https://github.com/weirdNox/org-noter) advertises itself
as "a synchronized, org-mode document annotator".
Org-noter shows the buffer with your EPUB-file side-by-side with the
buffer with the org file containing the notes.
It keeps both buffers synchronized, so when you walk through the
EPUB file, the notes for the current chapter are shown, if any. And
vice versa, when you walk through your notes, the for the current
note corresponding chapter from the EPUB file is shown.
Org-noter can be used with PDF files, with EPUB files, and ODT and
docx files.
org-noter creates org PROPERTIES drawers in the org file, to link
your notes to the specific EPUB file, and to link the individual
notes to the chapters in the EPUB file.
Frames
......
For each EPUB file or PDF file, org-noter creates a new frame. This
new frame contains two windows, the left one containing the buffer
with the EPUB or PDF file, and the right one containing the org file
for the notes.
These frames makes it possible to open several PDF- and EPUB files
at the same time, each together with their own org-noter window.
When you press q in one of the frames, the specific frame is closed
again.
In the beginning this was something that I really had to get used
to, normally I run Emacs in a single frame. Once used to this
however, it turns out to work fine.
Configuration
.............
Default org-noter uses a file called "Notes.org", but I prefer
lowercase-only filenames, so I configured it to use "notes.org".
Org-noter needs a default path.
This is my configuration:
(use-package org-noter
:after org
:ensure t
:config
(setq org-noter-default-notes-file-names '("notes.org")
org-noter-notes-search-path '("/path-to-the-notes/")))
Usage
.....
Open an EPUB file and start org-noter with M-x org-noter. Org-noter
opens the notes.org file as configured. At this point, you can
choose to not use the default notes.org file, but a different org
file.
Start reading the EPUB file.
* To create a new note, use i
* To create a precise note, use M-i
* To stop taking notes and close the frame, use q
* To go to the previous page or chapter, use M-p
* To go to the next page or chapter, use M-n
* To go to the previous note, use C-M-p
* To go to the next note, use C-M-n
A "precise note" is a note linked to a specific location which you
have marked with your mouse. I haven't used this.
For more key bindings, see the org-noter.el file, search for
org-noter-doc-mode-map.
When you walk through the EPUB file, the note referring to the
currently opened page is unfolded, the other notes are folded so you
only see their headings.
Taking notes
------------
After you have started org-noter from an opened EPUB or PDF file,
you have a frame with two windows:
* The left window contains the EPUB or PDF
* The right window contains the org file for the reading notes.
At any location you currently are in the EPUB file, Just press i,
and org-noter will prompt in the minibuffer for the title text for a
new heading.
Just enter the title text followed by Return, org-noter now creates
a level two header (** Note title) in the org document in the right
window, followed by a folded PROPERTIES drawer, and puts the point
right below it. so you can start typing your note right away.
The note you just have entered is linked to the current location in
the EPUB file.
It doesn't take long to get used to this workflow, and very soon you
take notes while staying "in the flow".
The reading notes are kept in the right order
.............................................
If you make a note at say, chapter 2, and after that a note at
chapter 5, followed by a note at chapter 3. org-noter will put the
last note between the notes for chapter 2 and chapter 5, so it keeps
your notes in the right order.
In your org file you will see:
* Title of your note on Chapter 2
* Title of your note on Chapter 3
* Title of your note on Chapter 5
This is a great feature!
While reading the EPUB and going through the text, you can stay in
the flow, and at any time make a note on any place in the EPUB file,
without having to think about the placement.
You will end with a perfectly organized org-file with all your
notes, each with a nice org-heading, and all in the right order.
Organization of your reading notes
----------------------------------
Default org-noter uses the "notes.org" file, as defined in its
configuration.
For each EPUB, PDF and so on, for which you have made notes, there
is a level one header (* Title) with the title, followed by the
level two headers (** Note-title) with their actual note.
However, if you want the notes for a certain PDF of EPUB in a
different org file, you can do that.
If you have notes made with org-noter in a different file, and want
to read the notes together with the original PDF or EPUB file the
notes relate to, first open the org-file, and start org-noter from
there. Org-noter retrieves the right PDF or EPUB, including its file
name and path, from the PROPERTIES drawer and open it.
Org files
---------
org-noter creates standard org files. You can read and edit these
files like any other org file.
When you want to review your notes, there is no need to open the
related EPUB or PDF, just open the org file directly, without
org-noter.
At any time while reading the org file, you can start org-noter,
which will open the related EPUB or PDF and you can see the original
file and your notes side-by-side and synchronized again.
org-noter uses only the org-files, and puts all the necessary
information it needs to function, in the PROPERTIES drawers. No
extra tools, like a database, are needed. It is all just plain org.
Just give it a try!
Last edited: $Date: 2023/01/26 14:18:35 $
* EOF *
Emacs Gnus for following Usenet, mailing lists and RSS-feeds
============================================================
Emacs Gnus
----------
Emacs Gnus is an Usenet newsreader and email client, and is an
integral part of GNU Emacs.
Usenet started in 1980, it uses the NetWork News Transfer Protocol
(NNTP) on TCP port 119. It is used for announcements and to have
online discussions, in the form of postings into threads in
topic-focussed news groups.
Gnus is mature, the first release was in 1987 and is still used a
lot.
People use Gnus to:
* Read and write email messages
* Read Usenet News and post new messages to Usenet
* Read web pages through RSS-feeds
* And more
The most common way to configure Gnus is to place the configuration
items in the file "$HOME/.gnus.el".
-----
Gnus functions also as email client, it allows you to read mail in
several different ways.
I use a local Maildir, together with fetchmail.
In order to send messages, Gnus requires a SMTP server. You can use
your account of the SMTP server of your internet provider, or an
account on another SMTP server, or your own local SMTP server.
Usenet
------
To access Usenet, and to read Usenet messages, you need an account
at an Usenet news-server.
You can get a free account on the news-server of
eternal-september.org.
To use your news account, you have to do two things:
* Add the news-server to the Gnus config
* Put the authentication details in the file "$HOME/.authinfo".
Add the news-server to the Gnus config
......................................
Add the following to your ~/.gnus.el:
(add-to-list 'gnus-secondary-select-methods
'(nntp "news.eternal-september.org"
(nntp-open-connection-function nntp-open-ssl-stream)
(nntp-port-number 563)))
We use here "gnus-secondary-select-methods", presuming that you
already have "gnus-select-method" in use for your email.
Authentication details in "$HOME/.authinfo"
...........................................
Create the file ~/.authinfo and add a line:
machine news.eternal-september.org login [username] force yes password [password]
And replace [username] [password] with your real username and
password from your news-server account.
If you have more than one account, like an account at another
news-server, you can add more lines, for each account a line.
Subscribing to groups
.....................
You can now start Gnus with M-x gnus. After Gnus has set up the
connection with the news-server you can request the list of
available news groups (there are a lot of those), first hit '^'
(shift-6) to see the list of servers, set point on "opened". Walk
through the list and subscribe to some groups with 'u'. No worries,
you can always un-subscribe later (again with 'u' on the same line).
Many news groups have a lot of history, download only 100 messages
or so to get a feel for the kind of discussions taking place. Hit
'c' ("catch up"), this will mark the messages as seen.
Close the news group with 'q', go back to the line of the news group
and hit 'c'. This will mark all the messages in the news group as
seen. The next time you start Gnus, only new arrivals will be
listed.
You can mark individual messages as 'expired' with 'E'. Use this if
you don't want all the messages in the current message list to be
marked as seen.
With Gnus you can not only read Usenet messages, you can also write
and post your own too. First, make sure you have read the rules of
your news-server about posting messages.
Follow mailing lists with gmane.io
----------------------------------
gmane.io (http://gmane.io/) is a brilliant service that provide
mailing lists as news groups. gmane.io acts like any Usenet nntp
news-server, so you can use any nntp news-reader.
There are many, many mailing lists that are made available this way.
For many of the open source applications you use, there is a mailing
list. Sometimes this is single mailing list aimed at the developers,
sometimes there a several mailing list, aimed at the developers and
aimed at the users. Following these lists can help you discover new
(to you) options, solve problems and so.
There are some great advantages to use the NNTP protocol to read
mailing list messages.
* By using gmane.io you don't need to be subscribed to these mailing
lists to read the messages on the list. Of course, almost all
mailing lists require a subscription before you can post messages
your self.
* Usenet news-readers are build to let you process a large number
of messages, and will remember the messages you have seen or have
expired, so you get to see only new arrivals.
In Gnus you can choose to get a threaded view of the messages.
Following mailing lists this way is very efficient.
You don't need an account on gmane.io. Just add the following to
your ~/.gnus.el:
(add-to-list 'gnus-secondary-select-methods '(nntp "news.gmane.io"))
Restart Gnus and request the list of available news groups at
news.gmane.io. You will see a list of mailing lists that gmane.io
provides. Choose a few lists and subscribe with 'u'.
The individual messages in the mailing list will be presented as
individual Usenet postings. The history of some mailing lists in
gmane.io can be quite large, so again, start with just 100 messages
or so, and use 'catch up' ('c') to mark all messages as read.
The next time you start Gnus, you will be informed of only new
arrivals.
Follow RSS feeds with gwene.org
-------------------------------
The services of gmane.io has been extended with yet another
brilliant service, a RSS-to-NNTP gateway.
This means you can follow a lot of RSS feeds in your Usenet
news-reader.
* In new.gwene.org, each RSS feed is a news group.
* Each RSS item is shown as a Usenet message, including the URL of
the item, the link to the original web page.
Gwene.org also adds the link to the original web page as a header of
the specific Usenet messages. This link is embedded in the header
"Archived-at".
There are many, many RSS feeds that are made available this way.
gwene.org (http://gwene.org/) allows you to add feeds, in case you
want to follow a feed that is not already on gwene.org.
You don't need an account on gmane.io. Just add the following to
your ~/.gnus.el:
(add-to-list 'gnus-secondary-select-methods '(nntp "news.gwene.org"))
After this, the procedure is the same as with gmane.io, open the
list of available news groups, which are RSS feeds this time, and
subscribe to your favorite feeds with 'u'.
Fast and efficient
..................
Compared to the "normal" way of reading RSS-feeds, you win a lot of
time. There is no feed-reader fetching and parsing all the
individual RSS-files you are subscribed to, gwene.org has done that
work for you. Gnus only has to retreive the headers from gwene.org,
which hardly require any time.
Following RSS feeds with Gnus and gwene.org is again very efficient.
Gnus shows only the news groups (feeds in this case) with new
messages. When you open a group (a RSS feed in this case) you get a
list of new RSS items.
You only open the messages that seems interesting to you. Opening a
messages shows the RSS item. Depending on how the specific RSS feed
is constructed you get a complete web page, sometimes only a little
teaser followed by a link, and sometimes only just a link, or
anything in between that.
I use eww to open the links of the individual RSS items and read the
specific web page.
Eww
---
Emacs comes with a small web browser built in, called eww. I have
configured eww to act like text mode web browser, with only the
standard font and no images, comparable with the text mode web
browser lynx.
This leads to:
* fast loading
* good readability
* no advertising crap, no auto playing video and so on
When just reading text is not enough, or the specific web site
requires JavaScript, just hit '&' (shift-7) and Emacs opens the
current web page in your graphical web browser (like Chrome or
Firefox).
Reading messages in Gnus
------------------------
In the message list of the news group (or mailing list or RSS feed)
you hit 'Enter' on a message. A new window below the message list
will be opened.
You can jump between the message list window and the message window
with 'h'. **But most of the time you don't need to**:
* Without leaving the window with the message list, you can scroll
the text in the message window line by line with 'enter' and back
with 'Alt-enter' and screen by screen with 'space', and scroll
back with 'backspace'.
* When you scroll the text in the message window with 'space' and
you reach the end of the message, hit `space' again, to open the
next message.
* When you reach the end of the message list, hit 'space' again, to
open the next news group.
All in one place, and one user interface
----------------------------------------
Reading email, Usenet news messages, mailing list messages, and RSS
feeds with Gnus all works the same and looks the same. The web pages
opened in eww also uses the same theme, font, and so on.
This means you have just one set of keys to remember and use.
Emacs is wonderful!
Thanks
------
Gijs Hillenius (https://hillenius.net/) was a big help and
inspiration at setting up Gnus and pointing me to gwane.io and
gwene.org.
Last edited: $Date: 2023/01/24 13:45:57 $
* EOF *
Fun with ersatz-emacs on NetBSD 3.0
===================================
Ersatz-Emacs: a Micro-Emacs
---------------------------
Ersatz-Emacs is a tiny Micro-Emacs.
Chris Baird created Ersatz-Emacs, starting with MicroEMACS 3.6 as
released to mod.sources and the Public Domain by Daniel Lawrence in
1986, and was itself based on the work of Steve Wilhite and George
Jones to MicroEMACS 2.0 (then also public domain) by Dave Conroy.
Chris Baird stripped out most of the features he personally never
used from 3.6, played with it for twelve years, completed the
key-bindings chart, and wrote a man-page. He called his version
"Ersatz-Emacs", referring to a well-known rant from Richard Stallman
in a memo,
The key-bindings chart, a handy overview of keybindings, is called
"ERSATZ.keys", and is dated on September 14th, 2000.
Ersatz-Emacs is a capable editor, with support for working on
multiple files, using multiple windows, and working with keyboard
macro's,
NetBSD 3.0
----------
I revived an old Arm board, which comes with NetBSD 3.0, and has
only a mininal set installed. This means that adding software can be
challenging.
Building Ersatz-Emacs on NetBSD 3.0, however, is a piece of cake.
I downloaded the tar-ball for Ersatz-Emacs on this system, unpacked
the tar-ball and ran 'make'. And behold, it compiled :)
The compilation ends with the building of an executable, called
'ee'.
Why a Micro-Emacs
-----------------
I like the elegance of a very small editor, and using the terminal,
tmux and terminal applications.
Early 2020, when I started out learning to use GNU Emacs (with
vanilla key-bindings), using a Micro-Emacs helped me a lot. A
Micro-Emacs felt less intimidating than the full fledged Emacs. I
know that this is not rational thinking, and this is all in my head,
but it worked.
Micro indeed
------------
Ersatz-Emacs is very small indeed. The executable ee is just 39K.
ldd ee
ee:
-ltermcap.0 => /usr/lib/libtermcap.so.0
-lc.12 => /usr/lib/libc.so.12
Smaller than ed
...............
For comparison: ed on the same Arm NetBSD 3.0 box is 58K.
ldd ed
ed:
-lcrypt.0 => /lib/libcrypt.so.0
-lc.12 => /lib/libc.so.12
Windows and buffers
-------------------
Ersatz-Emacs can work with several files and several buffers, and
the screen can be split into multiple windows. Like any other
Micro-Emacs, windows can only split horizontally (one above the
other).
Splitting windows uses the well-known keybindings:
- C-x 2 to split the screen and add a window
- C-x o to go move the-other-window
- C-x 1 to show only one window
Scroll the-other-window up or down with M-C-v and M-C-z.
Usage
-----
You won't need much time to get going with Ersatz-Emacs. The
keybindings for cursor-movement, searching, and basic editing are
the same as in vanilla GNU Emacs, and so is the method for copying
or deleting a region.
Filling paragraphs works also the same as in Emacs:
- First set the right margin, with C-u [column-number] C-x f
- Put the cursor (point) somewhere in a paragraph
- Hit M-q
Read the Friendly Manual
------------------------
Have a look at the great key-bindings chart, and the ee man-page,
both shipped in the tar-ball.
Download
--------
You can find the tar-ball at:
http://rho.tuxfamily.org/museum/
Last edited: $Date: 2022/12/11 09:47:00 $
* EOF *
NetBSD 9.3 on FreeBSD bhyve
===========================
NetBSD 9.3 as guest on the FreeBSD bhyve hypervisor
---------------------------------------------------
Headless FreeBSD box, with existing bridge.
...........................................
I wanted to install NetBSD 9.3 as a virtual machine on a headless
FreeBSD machine. This machine already has a bridge in place.
vm-bhyve
--------
bhyve was already running on this machine, however I got UEFI
problems when I tried to setup a VM on the 'normal' way, with
bhyvectl.
It turned out that using vm-bhyve makes things much easier.
Also, using this method, there is no need for VNC, only a ssh
connection to the FreeBSD host is required. The console runs in your
terminal, so in your tmux session.
Steps to get a running NetBSD VM
--------------------------------
- Install packages
- Create ZFS dataset
- Enable and configure vm-bhyve
- Initiate vm-bhyve
- Add existing bridge to vm-bhyve config
- Create the VM and start the installation
1 Install packages
------------------
First install bhyve, and vm-bhyve.
The following packages where already installed:
- bhyve-firmware
- grub2-bhyve
- uefi-edk2-bhyve-csm
Therefor, I only had to install vm-bhyve:
pkg install vm-bhyve
2 Create ZFS dataset
--------------------
zfs create zroot/vm-bhyve
zfs set mountpoint=/vm-bhyve zroot/vm-bhyve
3 Enable and configure vm-bhyve
-------------------------------
Add to ```/etc/rc.conf```:
vm_enable="YES"
vm_dir="zfs:zroot/vm-bhyve"
4 Initiate vm-bhyve
-------------------
vm init
cd /vm-bhyve/
cp /usr/local/share/examples/vm-bhyve/* .templates/
5 Add existing bridge to vm-bhyve config
----------------------------------------
vm switch create -t manual -b bridge0 bridge0
6 Create the VM and start the installation
------------------------------------------
mv NetBSD-9.3-amd64.iso /vm-bhyve/.iso
vm create -t netbsd -s 10G netbsdvm
vm install netbsdvm NetBSD-9.3-amd64.iso
vm console netbsdvm
Now you can perform the normal installation.
I accepted most default settings, and set the console to 115200
baud.
Make sure vm-bhyve uses a tap device that is already added to the
bridge. If not, you can add a tap device to the bridge with:
ifconfig bridge0 addm tap1
Setup the network config in the guest fitting to your bridge
settings.
After the installation, NetBSD will reboot, you can stay in the
console.
Close the console with ```~Ctrl D```, that is tilde, followed by
Ctrl-D.
Run the VM
----------
You can start and stop the VM with
vm start netbsdvm
vm stop netbsdvm
Happy VM-ing !
Last edited: $Date: 2022/12/09 17:18:39 $
* EOF *
Open files with Deft in read only mode
======================================
Deft for Emacs
--------------
Deft for Emacs is an Emacs mode for quickly browsing, filtering, and
editing directories of plain text notes.
See: https://jblevins.org/projects/deft/
It was designed for increased productivity when writing and taking
notes by making it fast and simple to find the right file at the
right time and by automating many of the usual tasks such as
creating new files and saving files.
Read-only-mode
--------------
Read-only-mode is a great mode in Emacs for reading text, like text
files, documents, web-pages, man-pages, and info-pages.
The read-only-mode turns a buffer into a read-only buffer.
Using the read-only-mode is very intuitive.
- Space-bar: scroll down one page
- Backspace: scroll up one page
- q: quit and close buffer
Toggle read-only-mode
---------------------
The standard key binding to toggle the read-only-mode is `C-x C-q`.
Open files with Deft in read-only-mode
--------------------------------------
Deft is designed to quickly create and edit notes. However, most of
the time I open a note, I want just to browse the contents, not edit
it.
It seems much more efficient to open these notes in read-only-mode.
That way I can go through the note with the space-bar and backspace
keys, not having to worry about accidentally altering the note.
Closing the buffer with the note with 'q' add to the efficiency.
Fortunately, Deft comes with some handy hooks, one of those is the
`deft-open-file-hook`, which runs after opening a file.
All it takes to let Deft open notes in read-only-mode is:
(add-hook 'deft-open-file-hook 'read-only-mode)
Of course, to edit a note, one first have to toggle the
read-only-mode, with `C-x C-q`.
This is also the case when starting a new note from within Deft, so
first consider your workflow before putting this in your Emacs
configuration.
Last edited: $Date: 2022/12/05 19:36:30 $
* EOF *
Build SBCL on FreeBSD
=====================
Motivation
----------
Installing the binary package for SBCL on a FreeBSD 13.1 system will
install version 2.2.7.
Using the SBCL from the binary package gives an error when compiling
lisp programs using compression, saying that the runtime was not
built with zstd support.
I wanted to see if building from source would solve this.
Build in a jail
---------------
I choose to build SBCL in a jail, so that it would not touch my
system. This way I can do a kind of test-install, and if everything
works fine, I can adopt it to my main system.
With ZFS creating a new jail is a piece of cake and a matter of
seconds. So I setup a new jail by cloning a snapshot I made earlier
from a default jail install.
Using Stow
----------
GNU Stow is a great solution when you want to install self compiled
software.
See: https://www.gnu.org/software/stow/
It makes installing, de-installing and upgrading software very easy.
BTW: I also use stow to manage my dotfiles.
Prepare the jail
----------------
You need SBCL to build SBCL.
In the jail I installed the binary packages git, stow, gmake,
texinfo, zstd, and sbcl and created the directory
/usr/local/stow/sbcl.
pkg install -y git stow gmake texinfo zstd sbcl
mkdir -p /usr/local/stow/sbcl
Now I could download and compile SBCL.
Build SBCL
----------
git clone git://git.code.sf.net/p/sbcl/sbcl cd sbcl
sh make.sh --fancy --prefix=/usr/local/stow/sbcl
cd ./doc/manual && gmake cd -
setenv INSTALL_ROOT /usr/local/stow/sbcl && sh install.sh
Finish the install
------------------
Remove the binary package and use the newly compiled version:
pkg delete sbcl cd /usr/local/stow stow --ignore=dir sbcl
The --ignore=dir is because of the info pages.
Starting sbcl now shows the current version:
This is SBCL 2.2.9.140-ca0170fb7
Installing on a different host
------------------------------
I installed quicklisp in this jail and did some test compliations.
Happy with the result, I migrated this to my main FreeBSD box:
scp -r /usr/local/stow/sbcl main-host:
At the main-host:
mv sbcl /usr/local/stow/
cd /usr/local/stow
stow --ignore=dir sbcl
Compression
-----------
Now compression works :)
For the binary that generates this website, this results in the
following:
- before compression: 23M
- after compression: 14M
So, that is quite a lot, for small programs.
Have fun !
Last edited: $Date: 2022/10/22 16:16:35 $
* EOF *
Set filedate on photo according to EXIF
=======================================
File date and time
------------------
On Linux, *BSD and so on, files have a "last modified" date and
time.
It is easy to have a sorted view of your photo directory, sorted by
date.
Different timestamps
--------------------
Sometimes, the photo files have a different "last modified" date and
time. Perhaps you moved the files to a different directory, or a
different computer.
EXIF
----
The EXIF information is a set of data that your camera or smart
phone has put into the JPG file. One of the elements of this set is
the actual date and time you made the photo.
So, if we can extract that information we can restore the right date
and time for our photo file.
Jhead
-----
Jhead is just the right tool for that.
See: https://github.com/4dvn/jhead
Issue the following command:
jhead -ft IMG_1234.JPG
where "IMG_1234.JPG" is the name of the photo file which timestamp
you want to set.
It is easy to do a whole directory:
jhead -ft *.JPG
So, make sure your camera has the right date and time before the
start of the photo shoothotoshoot and you are good to go :)
Last edited: $Date: 2022/10/10 13:06:17 $
* EOF *
First Common Lisp work
======================
First Elisp
-----------
I have started to explore coding in Lisp.
The first step was writing some Elisp code. I build some stuff, and
used those to do some actual stuff, take those "in production", so
to say.
Those working things are in all about 1,000 lines of Elisp code.
So, that is only just a small start. I have been enjoying this.
Next step: Common Lisp
----------------------
I started reading books on Common Lisp, and explore Common Lisp
related websites.
I installed SBCL with quicklisp and started to build some stuff.
I started with the same projects as my first Elisp projects.
* Wiki to texinfo converter
* Static site generator
These are now two compiled programs, that I run from the command
line.
Wiki to texinfo converter
-------------------------
I use awkiawki as a personal wiki. This is a wiki written in Awk
that sits on a pool of Markdown files. When a page is requested,
awkiakwi converts the Markdown on the fly to HTML. The wiki to
texinfo converter converts a number of these wiki-pages into some
texinfo files, and installs the result in a personal info-directory.
This is not rocket science of course, but it was a great way to
learn a lot :)
Static site generator
---------------------
The source of my website is a directory with Markdown files. This
started as a Vimwiki diary, so the files are named after the date,
in the format "YYYY-MM-DD.md". It uses Vimwiki-tags, every file has
a line with tags, surrounded and delimited with a colon. So the
format is ":tag1:tag2:tag3:".
The static site generator uses the 3bmd package to convert the
Markdown to HTML, creates a list of all used tags and a page a per
tag with the related HTML-files.
I have a Links-page on my website. In my home network I have an
instance of Linkding running, that I use for my bookmarks. The
static site generator talks with the REST API of Linkding, collects
the bookmarks with a certain tag and compiles a list for the
Links-webpage.
I am not completely happy with the Links page, because it simply
dumps the list, without any organization or categorization. So,
there is room for improvement.
Large executables
-----------------
The compiled version of these two scripts are rather large.
This is in general the case with SBCL. With the FreeBSD SBCL
package, the option "compression" does not work. My guess is has to
do with the compile time configuration. My plan is to set up a jail
and compile SBCL in there, to see if this can be resolved.
Just starting
-------------
These are just my first Common Lisp projects. Any experienced Lisper
would probably laugh about the code. But the programs work. The next
step is to tidy the code, look for possibilities to refactor, and so
on.
So I started, and enjoyed, writing code in Common Lisp. The quest
will continue !
Last edited: $Date: 2022/10/09 11:21:48 $
* EOF *
The 2022 Old Computer Challenge (Version 2)
===========================================
Solene has organized a follow up on last year's Old Computer
Challenge. This follow up is called
"The Old Computer Challenge V2: back to RTC"
The difference with last year's challenge is that now your
"internet-time" is limited, to 60 minutes per day. This resembles a
bit how it was in the old days.
When I started using the internet, back in the mid-nineties, I used
a 14k4 modem to call in. The internet provider charged not only a
monthly fee, but also a fee per minute. Also the telephone provider
charged a fee per minute, albeit less lower than the internet per
minute fee.
So, in those days it was normal that you were only connected to the
internet for just a short period per day.
Reading guide
-------------
In the text below I will first tell something about my set up, using
my Acer as X-terminal for my old Raspberry as remote workstation.
After that, I will keep a daily diary of my experiences.
Raspberry Pi B as XDMCP X-terminal Server
-----------------------------------------
Although a old computer is not mandatory in this year's challenge, I
still like to keep that element.
This year I like to participate with a Raspberry Pi B, with 256 Mb
RAM, as a XDMCP X-terminal server.
See also https://en.wikipedia.org/wiki/X_display_manager#XDMCP
My laptop functions as an X-terminal.
See also https://en.wikipedia.org/wiki/X_terminal
This setup resembles the way I have once worked at home: in the late
nineties I used a SLXT Sparc-Linux X-Terminal, with a Linux server
as X-terminal server.
See also
https://tldp.org/HOWTO/html_single/SPARC-HOWTO/#ss12.7
I will use my Acer Aspire One ZG5, just like last year. The
Aspire One runs FreeBSD 13.
I am typing this text in Emacs running on the Raspberry Pi B, logged
on from my Acer Aspire.
Raspberry Pi B with NetBSD 9.2
------------------------------
The machine that is my X-terminal server is a Raspberry Pi B, based
on a 700 MHz ARM11 CPU, and with 256 Mb RAM. This model is from
about 2012, and was replaced in 2014 with the Raspberry Pi B+.
For the challenge, I installed NetBSD 9.2 with the Modular X11
server from modular X.org on the Raspberry Pi.
X-terminal Server
.................
It is not that difficult to set up a X-terminal server. Two files
needs to be edited:
* xdm-config:
Comment the following line (by putting an exclamation mark at the
first position of the line):
DisplayManager.requestPort: 0
* Xaccess:
Remove the comment in front of the line with
"#any host can get a login window"
(so it starts with an asterix)
Restart xdm and everything should be working.
Make sure that port 6000 is open and not blocked by any
firewall/packetfilter.
Next, from your workstation, either open X or Xnest with query or
indirect.
* X -query [ip-address]
* Xnest :1 -query [ip-address]
For this, it is necessary that X (or Xnest) listens to tcp, for
security reasons for X this is disabled by default. To get things up
and running quickly, I use Xnest.
The -query command, if successful, will lead to a login screen.
The -indirect [ip-address] command will lead to a chooser.
Because of the small screen of the Acer Aspire One ZG5 (1024x600
pixels) I run there X -query [ip-address] right from the command
line, so the whole screen real estate will be used (Xnest doesn't do
full screen).
Day 1: How To Keep Up With The News
-----------------------------------
We have abandoned the television from our lives a couple of years
ago. I rely on the internet to keep up with the news. I do this
mostly by reading my RSS feeds on a daily basis.
People like Henry David Thoreau teach us, that keeping up with the
news is not that important, and that the news is best consumed after
it has aged a few months.
But still I have the feeling that I have to keep up with the news,
and I am curious how this challenge will affect me in this regard.
Emacs, Elfeed and Eww
.....................
I read my RSS feeds in Emacs, with Elfeed. From Elfeed I open
webpages with eww. eww is a simple web browser that is part of
Emacs. On the Raspberry I use Emacs in text modus, so images will
not be displayed and all text is rendered by the terminal.
Because the Raspberry Pi B is s-l-o-w, and because of the time
limit, I have filtered out of my RSS feeds all the feeds with high
traffic. These are all commercial feeds. such as a small number of
news sources like the BBC, the Guardian, and Science Alert, and a
number of feeds of more general interest like those from the
Marginalian and the Literary Hub, among others. The second group is
of course less a matter of Keeping Up With The News and mostly a
matter of Other Interesting Stuff.
The biggest part of my RSS feeds however, are feeds with low
traffic, mostly with one posting per day or less, like personal
blogs and other personal websites. Often these postings contain Very
Interesting Stuff.
After this reduction of the feed-list, I started Elfeed and let it
update its feeds.
**This took 29 minutes.**
This is a great part of my precious internet time, so it is obvious
that I haven't filtered out enough feeds. I overlooked a few high
traffic feeds, and I have removed those now. I still have kept a
couple of high traffic feeds, like lobste.rs and Hacker News.
Tomorrow I will see if this is enough to make the time needed for
the update more acceptable.
Day 2: Ratpoison window manager and keeping up with the Fediverse
-----------------------------------------------------------------
I set up the Ratpoison window manager and my .Xresources file.
Using the Ratpoison window manager is a lot more efficient that
using TWM. I use a small awk-script together with ratmen to switch
between windows.
Emacs and Xterm
...............
Because I have also scp-ed my .Xresources file to the Raspberry, I
can now use Emacs in Xterm (with ```XTerm*metaSendsEscape: true```).
I also tried to use Emacs as X application (starting just
```emacs``` in stead of ```emacs -nw```), but this is not a real
option. When the Emacs windows looses focus and regain focus, the
screen is white and has to be redrawn, which takes too much time to
be actual workable.
Editing text with text mode Emacs (starting Emacs with ```emacs
-nw```) works surprisingly good. Things like "flyspell-buffer" are
of course not as fast, but still workable.

Screenshot
of ratpoison with tree windows (click for larger version)
RSS feeds
.........
With the smaller list of RSS feeds, the load time has been reduced
to about 16 minutes. Also, it became apparent that there are a lot
of lobste.rs entries that are not in my fields of interest.
I have now replaced the general "newest.rss" of lobste.rs with a few
tag-related feeds, like "emacs.rss". Tomorrow I will see if this is
an improvement, or not.
Keeping up with the Fediverse
.............................
During the preparation of the Raspberry Pi I had already installed
"toot", a text mode Mastodon client, and had launched it once to see
if everything OK. Yesterday there wasn't any internet time left, so
I didn't use toot.
At the start of toot, it fetches your timeline and shows a list of
toots. My guess is that toot caches the toots and so they can be
read without internet connection. To test this, I started toot on my
laptop, and after it had fetched and shows the list of toots, I
brought the wlan interface down. I could indeed read the contents of
the toots. Of course, embedded images or links can not be viewed,
nor can there be any reaction (like boost of favorite).
So, this is not the optimal approach, but as long as updating and
reading my RSS feeds takes up most of the internet-time, this is the
only option.
Tmux sessions
.............
I have been using a private shell server for decades where I use
several text mode applications. Like many people are used to, my
workflow is:
* ssh into the server
* tmux a to attach to the running tmux session
* do whatever I came to do
* detach from tmux
* close the ssh connection
On my laptop I also use tmux, starting a session after booting up
the laptop.
Because of the XDMCP session, working on the Raspberry Pi from my
Acer Aspire feels as working on my laptop, and out of habit start a
new tmux session. With the result that I had three running tmux
sessions today.
So, this is something I had overlooked. Just as on my shell server,
I can simply detach from tmux and log out. The next time I create a
new XDMCP session, I can conveniently re-attach to the running tmux
session. Because I run Emacs in tmux, this means I don't have to
start Emacs, which takes ages on the Raspberry, so this a Great
Thing.
Challenge leads to adventurous day
..................................
This day there is no blue sky, but a completely closed sky with
grey-ish clouds. My first impulse was to get my tablet to check the
weather, but because of the limited internet time I have disabled
wifi on it.
So this challenge already leads to the first adventurous action: I
jumped on my bicycle without checking the weather to go shopping.
Because I hadn't bought anything that needed to go into the
refrigerator, I took a little detour on the way back, so the
shopping trip became a small tour of about 25~30 km :)
I am happy to report there was no rain.
Day 3: Sitting quietly in a room ...
------------------------------------
Today I hit a wall while writing some code in elisp.
I am a great fan of the info system, and so I tried to come up with
a solution with the help of the info pages and consulting the
available code from the installed packages, but unfortunately this
failed. In the end I did use the internet to search for some clues
and spend a big chunk of my precious "internet-time".
During the last year's edition of the Old Computer Challenge I came
to the conclusion that the challenge not only lets you play with
interesting hardware, but also lets you learn more about yourself.
That last element is even more true for this year's challenge. Oh
yeah.
> All of humanity's problems stem from man's inability to sit
> quietly alone in a room --- Blaise Pascal
During this challenge I am confronted with my habit to pick up my 8
inch tablet and do something that has to do with using the internet.
A lot.
Like first thing in the morning, checking the app with the local
"teletekst", I don't know the English name for this (and currently
can not look it up :) but maybe it is indeed 'teletext' (will check
this after the challenge :). This is/was a protocol where a number
of small text-only pages are superimposed on the wireless television
signal, to be decoded by the television. In the Netherlands, the
news is still broadcasted this way in a very condensed format, and
these pages are also made available with an app. So, this is my
go-to method to be up to date with what that news agency considers
to be the most important news.
And during the day I use this tablet to keep up with the Fediverse,
to check the chance of rain, to look up stuff on the internet, and
so on.
Because of the challenge, I can't do that now. Which is not easy.
This all makes me well aware of this habit, and how very often I am
triggered to it.
To wrap it all up:
* Consulting the internet today to solve some coding-problems left no
time for me to update my RSS feeds
* I am learning the hard way about my habit to pick up my tablet
throughout the day
Now I am going to sit quietly in my chair, with a nice book.
Day 4: Same old same old
------------------------
I woke up to discover that the world was still turning although I
hadn't read the news the previous day.
I have been working at my Elisp code pet project a bit, but didn't
make much progress.
Due to the very nice weather, and a nice 28 km bicycle trip --at a
really leisure speed-- through the nature in our area, I spend less
time at the keyboard.
So the challenge was less of a challenge today.
Capslock key as Control key
...........................
Like described above, during this challenge I use an old Acer Aspire
One ZG5 as X-terminal and a old Raspberry Pi (1) B as X-server.
One of the things I keep running into in this setup is that Capslock
functions as ... Capslock. On my daily driver, a X270 laptop, I have
configured Capslock to function as Control-modifier, as a little
step in preventing the so called Emacs-pinky.
So todays quest was to change the behavior of the Capslock key,
without consulting the internet. This seemed a little complicated,
because X runs on the Acer Aspire and the session runs on the
Raspberry Pi.
After poking around with setxkbmap (on both machines) without
getting to a solution, followed by playing with kbdcontrol and
keymaps (on the Acer Aspire), with only a working solution on the
command line on the Acer Aspire, I finally nailed it with a simple
.Xmodmap with just three lines:
remove Lock = Caps_Lock
keysym Caps_Lock = Control_L
add Control = Control_L
RSS (again)
...........
The changes I made in the RSS turn out to be fine, although now the
Hacker News RSS feed dominates my feeds. Unlike lobste.rs, where
there are topic-specific feeds besides the generic feed, I have only
found a Hacker News generic feed.
I gave it a good look, only a small part of the Hacker News links is
of interest to me. I have created a bookmark to
https://news.ycombinator.com in eww (the web browser build in Emacs)
and removed the feed from my list of feeds. So, when I have gone
through my RSS feeds and there is still "internet-time" left, I can
quickly scan the first 30 items to see if there is any link of
interest to me.
Fediverse
.........
I fetched my timeline in toot, so I could go though the messages.
Because I had exhausted my "internet-time-budget" for the day, I
couldn't react nor pull up images.
I guess I will keep it a text-only version of the Fediverse for the
rest of the challenge.
I must admit that I haven't even looked at updates in Gemini-space
nor Gopher-space during the last days ...
Day 5: Adapting well
--------------------
Time flies, it is already day 5 ...
Outside activities
..................
The weather was fine today. I did some work in the garden, and
sanded and painted the posts of two windows of our house.
So I do not have much to report today.
More time left
..............
The list of entries in Elfeed is much shorter now. Also it loaded
quicker. I didn't time it, but when I changed windows in ratpoison,
the update in Elfeed was already finished.
I had time to read some posts of fellow old-computer-challengers in
their blogs, gemlogs and phlogs. It is nice to see such a diversity,
and Gopher and Gemini fit perfectly well in the old-computer fan
world.
In toot I loaded the latest 40 entries in my time line and went
through them, text-only.
I also did a quick scan of the news (through the Teletekst-app), but
didn't get the feeling that I have missed much.
Don't miss streaming services
.............................
In some posts from other participants I read about watching video's
from Youtube and other usage of streaming services. I don't use
these services, so this is not a real problem for me.
Day 6: Quiet IRC channel
------------------------
One of the great things of the old computer challenge is the people
you meet on the IRC channel. This channel was set up in preparation
of last year's old computer challenge. A nice group of people, both
participants as well as like-minded people, joined the channel.
During the last year, this channel stayed active and some new people
joined.
Due to the current challenge, with limited "internet-time", the IRC
channel has of course become very quiet. That is IMHO one of the
lesser aspects of this years challenge.
Today I also did some writing, around 900 words. I have two elements
that I want to consult the internet on, but those can wait until
after the challenge.
Also, I finished the book that I was reading.
Keeping up with the news
........................
I used the Teletekst app again, went through the reduced RSS feeds.
Without the main news sources in my RSS feeds I have a feeling am
less aware of that is happening in the world.
I also went in toot quickly through 40 messages of my Fediverse
timeline, but the text only format is for a large part of the toots
not the right format.
Form factor
...........
During these 6 days I totally have fallen in love again with the
small form factor and low weight of the Acer Aspire One ZG5.
I remember that I kept it around after last year's challenge, as a
second laptop, but somehow I stopped using it.
Of course, the performance is not exactly great, and using Firefox
or a comparable graphical browser is not an option. But for TUI
applications (text mode user interface) like lynx, irssi, and so, it
is fine.
And during the challenge I did use Emacs in text mode (emacs -nw) on
the even less powerful Raspberry Pi (1) B.
In preparation for this year's challenge and during this challenge I
have discovered that using this small laptop ("netbook") as an
X-terminal using XDMCP is really fun. I am now considering to set up
a X-server after the challenge, on much more capable hardware, to
see if this is an option.
Due to outdoor activities, I have no report on day 7.
Day 8: Final day
----------------
Today is the final day of the challenge, which of course requires an
evaluation of the last week.
Hardware setup
..............
It turned out that I didn't used any graphical application. only TUI
applications (text mode user interface). I tried Emacs as graphical
application, but this is not really usable in this setup. In
text-mode (with ```emacs -nw```) it worked fine.
So, in hindsight I was great to set up the X-terminal/X-server
combo, consisting of old hardware, but I could just as well use ssh
to log on to the Raspberry Pi and run everything in tmux.
Limited "internet-time"
.......................
I had to adopt to not being able to use the internet whenever I saw
the need.
* I had to reduce the number of RSS feeds in my feed reader and omit
all high traffic feeds
* I had to reduce the number of times I checked the news (with the
Teletekst app)
* I had to stop checking my timeline on the Fediverse several times
a day on my tablet
* I could check my timeline on the Fediverse only once a day in toot,
a text-only Mastodon client written in Python, see
https://toot.readthedocs.io/en/latest/index.html.
The result of participating in the challenge is that I am much more
aware about the amount of time I use to spend on these activities. I
came to the conclusion that I want to change this and spend less
time checking the news, checking my Fediverse timeline and my
reading my RSS feeds.
I will scrutinize my list of RSS feeds, and take a hard look at the
commercial feeds. Of course, the [Pareto
principle](https://en.wikipedia.org/wiki/Pareto_principle) applies
here too. A small number of feeds will generate a large portion of
the entries in the feed reader.
Community
.........
I really appreciate the small and very friendly community that has
grown around Solene's initiative and enjoy being a member. I hope
that the IRC channel will continue to be active, just as it was the
last 12 months.
And again, just like the previous time, a big Thank You to Solene
for starting last year's and this year's challenge!
Last edited: $Date: 2022/07/17 12:34:02 $
* EOF *
Tinkering with capsule scripts
==============================
Scripting
---------
One of the reasons I like using a Unix-like OS, like FreeBSD, OpenBSD,
or Linux, is that it is a great environment for tinkering.
I love writing small scripts, like awk scripts, ed scripts, m4
scripts, shell scripts, and even (less small) Perl scripts.
Capsule
-------
Building and creating content for a Gemini capsule is a great excuse
to play around, and create or enhance scripts.
The only real problem is, that it has to stop somewhere, there comes a
moment in time when it is "finished". Well, there are always small
things that you could improve ...
Last edited: $Date: 2022/06/26 09:01:11 $
* EOF *
The case of the collapsing calendar
===================================
Going into retirement
---------------------
Recently I quit my job to become 'retired'. This leads to a lot of
changes, some more predictable than others. The lock down period and
working from home during the last two years already brought some
changes, like not having to commute every day and being able to have
lunch with my wife.
One of the nice things of being retired, is that you don't have to
set your alarm clock every day. On some days you do, on most days
you don't.
Not having to hurry from meeting to meeting is also fine.
The rise of the digital calendar
--------------------------------
In the past, everybody had a paper calendar (sometimes also called
"agenda" or "diary"). When somebody wanted to make an appointment,
they had to consult you (or, if you were higher ranked, your
secretary) to check your availability. It also gave you some
control. You were in control regarding your schedule and also, to
some extend, with whom you were meeting and when.
Early in the new millennium this all changed.
The change from a paper to a digital calendar involves much more
than just the medium.
It shifts a lot of power to the person who is making the
appointment. People can suddenly see when you are available, and can
insert items in your calendar without consulting you first.
Very quickly, the time between two appointments reduced to nil. When
someone sees you are in meeting from 10:00-11:00, they will easily
put in a meeting from 11:00-12:00, and so on.
Also rescheduling meetings becomes super easy, and requires just a
few clicks. This can result in some surprises. A meeting, important
for you to get some things in motion, is suddenly suspended. Another
meeting, which requires a lot of prep work, is suddenly a week
earlier. And so on.
Collapse of the calendar
------------------------
Before my retirement, my calendar was usually completely filled and
I had to be vigilant in order to keep some space between some
appointments and have some time to actually, you know, do some work.
This changed overnight. The meetings are gone, and those
appointments that are there, don't tend to shift much. As a result
of this, there is no need to keep an eye on the calendar app all the
time, to see how much time there is left and where you have to be
next.
Now I no longer have the habit to check my calendar app first thing
in the morning and at regular intervals.
Where to put the appointments
-----------------------------
My first thought was to say goodbye to the calendar app, with it's
data in the cloud, and move to some self managed solution. So I had
to think about an alternative.
FreeBSD calendar and Herbe
..........................
FreeBSD comes with a nice application called 'calendar'. You feed it
with a ~/.calendar file, or, it bit more flexible, a ~/.calendar
directory with a bunch of calendar files (including one with the
local holidays). At the start of X, through my ~/.xinitrc, Herbe
gives a nice notification with the calendar events for the current
day.
I tried this first, but discovered that I don't open my FreeBSD
laptop every day in the morning. When the weather is fine, we have
breakfast in the garden, or at least coffee in the garden. Or I do
some chores in the morning, and so on.
Smart phone
...........
The next thought was to put something on my smartphone (like, hmm,
an app), but the thing is, I don't open my phone that often. I never
installed that much apps and I use it mostly for some messaging with
apps like Signal. But there are days when I don't have any
"Signal-conversations".
It turns out that just as I don't open my laptop every morning, I
don't open my smart phone every morning.
Current situation
.................
When I now make an appointment, or want to schedule some event, I
now put it both in a file in the FreeBSD ~/.calendar directory as
well as in the calendar app on my smart phone, but I am not happy
with this outcome.
Something to think about ...
Last edited: $Date: 2022/06/24 20:19:18 $
* EOF *