The wonderful Emacs Org mode is the basis for the largest part of my personal knowledge management system.
However, as I’ve mentioned before, mobile accessibility is its weakest point.
In this post, I’m going to explain my possibly unconventional new solution to the important requirement I mentioned in that note-taking post:
Ideally, I would have easy access to my complete org database and any related files.
As you can easily deduce from the title of this post, the solution involves converting all of my org database into docx files, with the main motivation that the Dropbox mobile app has excellent support both for the fast previewing and searching through the contents of docx files, while it has none of that sort of support for .org or .md files.
The desired outcome: An example
Let’s say I needed to find my Org mode notes about the
TDBGrid in the Lazarus
IDE on my phone.
In the Dropbox app, searching for
TDBGrid finds the relevant docx instantaneously:
Previewing the docx file, still in the Dropbox app, shows me exactly the code example and context I needed to see, reasonably rendered as well:
For reference, this is what the source note looks like in full-fat Emacs Org mode:
The above search-and-preview flow is not possible on the source Org mode files with the Dropbox app on mobile.
What is not shown here, is that you also get a navigable document structure view (based on the headings) right in the dropbox app preview.
CMakeLists for the Pandoc conversion of a nested directory of files
At the highest level, I wanted to use Pandoc to convert each org file, along with any embedded images, to docx.
(I started with HTML, but Dropbox previewing of that was inconsistent, search did not seem to work that well, and there was no heading navigation.)
I knew that I wanted a Makefile to do this conversion, so that pandoc would only be applied on org files that had not yet been converted, or had their most recent version converted. This saves a tremendous amount of time when updating the docx repo.
I also knew that I would prefer not to write the Makefile by hand, and so I reached for CMake.
A great number of browser tabs later, I came up with the following
CMakeLists.txt, which now lives in the same directory as my org-file hierarchy
(the directory is named
pkb4000 which lives in my dropbox):
To generate the
Makefile, I did:
From here on out, a simple
make inside of
docx-pkb4000 will update the docx
files to the latest org files.
If you add new org files, you wil have to re-run
cmake ../pkb4000 from the
docx-pkb4000 directory before running
Add to cron for automatic updates
Thanks to a suggestion by ZH from work, I’ve added the folllowing to my
crontab to update the docx notes archive every 30 minutes, taking into
account that new org files have possibly been added:
For the first time, this definitely satisfies my requirement of having easy access to my complete Org mode database and any related files, through the Dropbox app’s great support for the full text searching and previewing of DOCX files.
Having the docx files available on all of the systems where I have dropbox installed, has proven to be a convenience by itself. System search tools generally also do a better job of previewing docx files than Org mode files.
This mobile accessibility is indeed limited to viewing (which was the largest part of my need on the phone), and does not cater for adding new multimedia content.
For that, I have become quite interested in Dropbox Paper’s capabilities, but that is a topic for another post.