A simple and low-barrier Zettelkasten system designed to let you write without distraction.
- Any plain old org-document with a
#+TITLE:property can be a full citizen in your Zettelkasten. No special syntax or meta information needed. - The Zettelkasten is simply a directory containing org-documents. Each document corresponds to a topic.
- Links between topics are created automagically. No need to create and manage links by hand. No need to update links when their target document changes.
- No persistent index needed. MWK uses silversearcher (fast!) to see what’s the current state of affairs in your Zettelkasten.
- MWK aims to be an (almost) zero-configuration solution. The only thing that needs to be configured is the location of your Zettelkasten.
This software is quite young and still a bit rough around the edges. However, it’s also feature-complete (for my taste at least) and ready for daily use.
Known issues:
- MWK doesn’t work reliably in conjunction with emojify.el. When links are displayed, Emacs sometimes runs with 100% CPU load. There’s probably an incompatibility in how MWK and emojify use font-lock.
- A bunch of compiler warnings.
- The key distinguishing feature is that links are created automatically when a string that you type matches an existing topic’s name. Links are not written out in org syntax but are dynamically created in Emacs (via Font Lock) and are not part of the file. So if a new document is created and other documents already mention its topic, no new links need to be created. Links to the new document will instead magically appear.
Zettelkasten links are similar to org’s radio targets except that Zettelkasten links work across documents and that you don’t need to update Zettelkasten links manually. However, unlike radio targets, Zettelkasten links do not export to PDF, HTML, etc. But that’s a feature since the content of a Zettelkasten is typically private and should not become available to readers of an individual exported document.
Having to create links manually and explicitly was a major source of frustration for me when working with other Zettelkasten systems. With dynamic links, the user can focus on writing and doesn’t need to give any attention to the Zettelkasten.
Bonus: Zettelkasten links can also be displayed in other documents that are living outside the Zettelkasten, such as LaTeX and Markdown documents, e-mails, Emacs’ inline documentation, and so on. The content of your Zettelkasten will always be at your fingertips.
- All documents belonging to a Zettelkasten are located in a single directory (
mwk-directory). A Zettelkasten document is a simple org file that minimally defines a#+TITLE:property which specifies its topic. The string in the title will be used for finding references to that document and for creating links. Since a title property is enough, many of your existing documents can become part of your Zettelkasten simply by being copied to the Zettelkasten directory. - If there are multiple synonymous ways to refer to a topic, a list of so-called wiki names can be specified using the
#+WIKINAMES:property. If present, only the wiki names will be used for finding references and creating links (not the title). Wiki names are comma-separated regular expressions. An example is the wiki nameeye.?trackingto capture multiple different spellings: eye tracking, eyetracking and eye-tracking. Orbackups?to capture both backup and backups and Backup at the beginning of the sentence. Wiki names are case-insensitive unless they contain uppercase letters in which case they become case-sensitive (e.g.,Wi-Fi). If your wiki name contains characters that have special meaning in regular expression syntax, you need to escape them, e.g., to matchR^2in documents, use the wiki nameR\^2. Regular expressions are powerful, but it’s also easy to shoot yourself in the foot if you get too fancy. - Three helm commands help you navigate your Zettelkasten:
- The Helm command
helm-mwk-topicscan be used to find existing topics in your Zettelkasten. This command can also be used to create new topics. Simply type the title of a new topic and hit enter. - The Helm command
helm-mwk-referencescan be used to find back-references, i.e. Zettelkasten topics with references to the current topic. This is the signature feature of the Zettelkasten system which gives it much of its power. - The Helm command
helm-mwk-searchcan be used for a full-text search in your Zettelkasten.
- The Helm command
Many other features could be added to this system but most would detract from the main design goal: simplicity.
Magic Wikikasten (MWK) consists of three main components:
- A global minor mode,
global-mwk-mode, that watches the Zettelkasten and keeps an up-to-date list of topics in memory. (Unlike org-roam, MWK doesn’t store an index on disk.) - A local minor mode,
mwk-mode, that creates links in the current document, which may be a Zettelkasten document or something else outside the Zettelkasten. - Three Helm commands for navigating your Zettelkasten (
helm-mwk-topics), discovering connections (helm-mwk-references), and generally finding stuff (helm-mwk-search).
Behind the scenes, MWK uses silversearcher for searching which is super fast and much faster than opening and scanning files in Emacs. As a result, this MWK should work okay with large Zettelkästen containing many documents.
Comparison with org-roam
While org-roam (v1) was the main inspiration for this project, MWK has a different focus. Org-roam aims to be a complete and comprehensive Zettelkasten solution that is highly configurable and extensible. MWK, in contrast, is intended to be simple and easy to learn (hence “the lazy person’s Zettelkasten”). If you’d like to buy heavily into the Zettelkasten idea, org-roam might be the better solution for you. MWK is a good low-barrier starting point if you’d like to get your feet wet with the Zettelkasten idea.
- Magic Wikikasten uses silversearcher (the
agcommand) to scan the Zettelkasten. On Ubuntu-like systems it can be installed via:sudo apt install silversearcher-ag - MWK uses Helm for navigating the Zettelkasten. See here for installation instructions.
- Finally, make sure that
mwk.elis in yourload-path. MWK is currently not available via the usual package repositories but it can be installed directly from GitHub using straight.el:
(straight-use-package
'(mwk :type git :host github :repo "tmalsburg/mwk.el"))There is a single customization variable, mwk-directory, that specifies where the Zettelkasten is located on your file system. A complete configuration is then as simple as this:
(require 'mwk)
(setq mwk-directory "/home/user/zettelkasten")
(global-mwk-mode 1)In addition, you might want to create some key bindings for the following commands:
helm-mwk-topics: Searches for topics in your Zettelkastenhelm-mwk-references: Searches for back-references, i.e. references to the current topichelm-mwk-search: Full text search in your Zettelkastenmwk-flash-links: Display links to Zettelkasten topics for 3 seconds.
Execute helm-mwk-topics, type the title of a new topic, and hit enter. Make sure you save this file after editing.
Example: M-x helm-mwk-topics followed by My first topic RET creates the following new document in your Zettelkasten:
#+TITLE: My first topic #+WIKINAMES: |
Either add some wiki names or delete the #+WIKINAMES: property. When you save the document, MWK will automatically update its index of topics.
Same as above.
Same as above (e.g., M-x helm-mwk-topics, enter title and select topic using the return key.
Nothing you need to do. Just type a string that is matched by one of the topic’s wiki names (or title). No need to create explicit org links. Effectively you will create references on the fly without even thinking about it, just by writing prose. That’s the magic in Magic Wikikasten.
In documents belonging to your Zettelkasten, links will be displayed by default. In other documents you can execute M-x mwk-flash-links to show links for 3 seconds during which they will be clickable. Alternatively, enable mwk-mode to display links permanently.
Disable mwk-mode.
Execute M-x helm-mwk-references. Ideally this command is bound to some key combination for easy access.
Execute M-x helm-mwk-search, and enter a string.
You’re writing a document (e.g. a LaTeX manuscript) and need quick access to your notes about various relevant topics:
Three options:
- Activate
mwk-modeand references to topics in your Zettelkasten will become links. - Alternatively, use
mwk-flash-linksto display links for just a moment during which they will be clickable. - Execute
helm-mwk-topicsto search for a topic.
You figured out how to compile Emacs from source and would like to save this information for the future:
Execute helm-mwk-topics, type “Compiling Emacs”, hit enter, write down the recipe in the new org file, and save.
Add this to your helm/ivy-bibtex configuration:
(setq bibtex-completion-notes-path mwk-directory)
(setq bibtex-completion-notes-template-multiple-files
"#+TITLE: ${author-or-editor-abbrev} (${year}): ${title}\n#+WIKINAMES: ${=key=}\n\n")Then search for an article via helm-bibtex or ivy-bibtex, select “Edit notes”, and a new note will be created in your Zettelkasten (or the existing note will be opened). BibTeX keys in other documents will automatically become links to existing notes in your Zettelkasten when you activate mwk-mode or execute mwk-flash-links.